Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): show a terminal's first prompt by starting the shell after attach (PRD-8498) (#4273)

serafin-garcia703155995b44
diff --git a/.changeset/terminal-start-after-attach.md b/.changeset/terminal-start-after-attach.md
new file mode 100644
index 000000000..6416aa264
--- /dev/null
+++ b/.changeset/terminal-start-after-attach.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+A terminal tab now shows its shell prompt as soon as it opens. Before this, output the shell printed before the tab was listening could be dropped, leaving the tab on `Starting terminal…` until you pressed a key. A tab whose shell never starts at all now says `The terminal couldn't start.` and offers `Try again`, instead of reporting that the shell stopped unexpectedly.
diff --git a/packages/app/src/components/TerminalExitNotice.dom.test.tsx b/packages/app/src/components/TerminalExitNotice.dom.test.tsx
index 5d1e33a82..1c9eecac3 100644
--- a/packages/app/src/components/TerminalExitNotice.dom.test.tsx
+++ b/packages/app/src/components/TerminalExitNotice.dom.test.tsx
@@ -6,26 +6,38 @@ afterEach(() => cleanup());
describe('TerminalExitNotice', () => {
test('a clean exit shows the ended state inside an alert live region', () => {
- render(<TerminalExitNotice info={{ exitCode: 0, signal: null }} onRestart={() => {}} />);
+ render(
+ <TerminalExitNotice
+ info={{ phase: 'exit', exitCode: 0, signal: null }}
+ onRestart={() => {}}
+ />,
+ );
expect(screen.getByRole('alert')).toBeTruthy();
expect(screen.getByText(/terminal session ended/i)).toBeTruthy();
});
test('a non-zero exit code is conveyed so the state is actionable', () => {
- render(<TerminalExitNotice info={{ exitCode: 1, signal: null }} onRestart={() => {}} />);
+ render(
+ <TerminalExitNotice
+ info={{ phase: 'exit', exitCode: 1, signal: null }}
+ onRestart={() => {}}
+ />,
+ );
expect(screen.getByText(/exit code 1/)).toBeTruthy();
});
test('a signal termination is conveyed and takes precedence over the exit code', () => {
- render(<TerminalExitNotice info={{ exitCode: 0, signal: 9 }} onRestart={() => {}} />);
+ render(
+ <TerminalExitNotice info={{ phase: 'exit', exitCode: 0, signal: 9 }} onRestart={() => {}} />,
+ );
expect(screen.getByText(/signal 9/)).toBeTruthy();
});
test('a crash is distinguished from a clean exit', () => {
render(
<TerminalExitNotice
- info={{ exitCode: 1, signal: null, error: 'host crashed' }}
+ info={{ phase: 'exit', exitCode: 1, signal: null, error: 'host crashed' }}
onRestart={() => {}}
/>,
);
@@ -33,9 +45,61 @@ describe('TerminalExitNotice', () => {
expect(screen.queryByText(/host crashed/)).toBeNull();
});
+ test('a host process death is distinguished from a clean exit', () => {
+ render(
+ <TerminalExitNotice
+ info={{ phase: 'exit', exitCode: 1, signal: null, hostExited: true }}
+ onRestart={() => {}}
+ />,
+ );
+ expect(screen.getByText(/stopped unexpectedly/i)).toBeTruthy();
+ });
+
+ test('a shell that never started is distinguished from one that ran and died', () => {
+ render(
+ <TerminalExitNotice
+ info={{ phase: 'start', reason: 'host-unavailable' }}
+ onRestart={() => {}}
+ />,
+ );
+ expect(screen.getByText(/couldn't start/i)).toBeTruthy();
+ expect(screen.getByText(/background service isn't running/i)).toBeTruthy();
+ expect(screen.queryByText('host-unavailable')).toBeNull();
+ expect(screen.getByRole('button', { name: 'Try again' })).toBeTruthy();
+ expect(screen.queryByText(/stopped unexpectedly/i)).toBeNull();
+ });
+
+ test('a real spawn error is shown verbatim rather than translated away', () => {
+ render(
+ <TerminalExitNotice
+ info={{ phase: 'start', detail: 'posix_spawnp failed' }}
+ onRestart={() => {}}
+ />,
+ );
+ expect(screen.getByText(/couldn't start/i)).toBeTruthy();
+ expect(screen.getByText('posix_spawnp failed')).toBeTruthy();
+ });
+
+ test('a launch composition failure reads as localized copy, never as the machine reason', () => {
+ render(
+ <TerminalExitNotice
+ info={{ phase: 'start', reason: 'launch-unsupported' }}
+ onRestart={() => {}}
+ />,
+ );
+ expect(screen.getByText(/couldn't start/i)).toBeTruthy();
+ expect(screen.getByText(/can't run this command in the configured shell/i)).toBeTruthy();
+ expect(screen.queryByText(/unsafe-argument|unsupported-shell|invalid-launch/)).toBeNull();
+ });
+
test('the restart control is an accessible button that spawns a fresh session', () => {
const onRestart = vi.fn(() => {});
- render(<TerminalExitNotice info={{ exitCode: 0, signal: null }} onRestart={onRestart} />);
+ render(
+ <TerminalExitNotice
+ info={{ phase: 'exit', exitCode: 0, signal: null }}
+ onRestart={onRestart}
+ />,
+ );
const restart = screen.getByRole('button', { name: 'Restart terminal' });
fireEvent.click(restart);
diff --git a/packages/app/src/components/TerminalExitNotice.tsx b/packages/app/src/components/TerminalExitNotice.tsx
index 0079482f3..bbee3235e 100644
--- a/packages/app/src/components/TerminalExitNotice.tsx
+++ b/packages/app/src/components/TerminalExitNotice.tsx
@@ -1,11 +1,31 @@
import { useLingui } from '@lingui/react/macro';
import { Button } from '@/components/ui/button';
-export interface TerminalExitInfo {
- readonly exitCode: number;
- readonly signal: number | null;
- readonly error?: string;
-}
+type TerminalStartFailureReason =
+ | 'not-started'
+ | 'unknown-session'
+ | 'host-unavailable'
+ | 'host-exited'
+ | 'launch-unsupported';
+
+export type TerminalExitInfo =
+ | {
+ readonly phase: 'exit';
+ readonly exitCode: number;
+ readonly signal: number | null;
+ readonly error?: string;
+ readonly hostExited?: true;
+ }
+ | {
+ readonly phase: 'start';
+ readonly reason: TerminalStartFailureReason;
+ readonly detail?: undefined;
+ }
+ | {
+ readonly phase: 'start';
+ readonly reason?: undefined;
+ readonly detail?: string;
+ };
interface TerminalExitNoticeProps {
readonly info: TerminalExitInfo;
@@ -15,8 +35,25 @@ interface TerminalExitNoticeProps {
export function TerminalExitNotice({ info, onRestart }: TerminalExitNoticeProps) {
const { t } = useLingui();
+ const startFailureCopy = (reason: TerminalStartFailureReason): string => {
+ switch (reason) {
+ case 'host-unavailable':
+ return t`The terminal background service isn't running.`;
+ case 'host-exited':
+ return t`The terminal background service stopped before the shell could start.`;
+ case 'unknown-session':
+ return t`This terminal session is no longer available.`;
+ case 'not-started':
+ return t`The shell for this session was never started.`;
+ case 'launch-unsupported':
+ return t`The terminal can't run this command in the configured shell.`;
+ }
+ };
+
let message: string;
- if (info.error != null) {
+ if (info.phase === 'start') {
+ message = t`The terminal couldn't start.`;
+ } else if (info.error != null || info.hostExited === true) {
message = t`The terminal stopped unexpectedly.`;
} else if (info.signal != null && info.signal !== 0) {
message = t`The terminal session ended (signal ${info.signal}).`;
@@ -26,14 +63,24 @@ export function TerminalExitNotice({ info, onRestart }: TerminalExitNoticeProps)
message = t`The terminal session ended.`;
}
+ const reasonCopy =
+ info.phase !== 'start' || info.reason === undefined ? null : startFailureCopy(info.reason);
+
return (
<div
role="alert"
className="absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-background/90 dark:bg-transparent p-6 text-center"
>
<p className="max-w-sm text-sm text-muted-foreground">{message}</p>
+ {reasonCopy !== null ? (
+ <p className="max-w-sm text-sm text-muted-foreground/80">{reasonCopy}</p>
+ ) : info.phase === 'start' && info.detail !== undefined && info.detail !== '' ? (
+ <p className="max-w-sm break-words font-mono text-muted-foreground/80 text-xs">
+ {info.detail}
+ </p>
+ ) : null}
<Button size="sm" variant="outline" className="uppercase font-mono" onClick={onRestart}>
- {t`Restart terminal`}
+ {info.phase === 'start' ? t`Try again` : t`Restart terminal`}
</Button>
</div>
);
diff --git a/packages/app/src/components/TerminalPanel.dom.test.tsx b/packages/app/src/components/TerminalPanel.dom.test.tsx
index d3bf0c091..dda6f25bb 100644
--- a/packages/app/src/components/TerminalPanel.dom.test.tsx
+++ b/packages/app/src/components/TerminalPanel.dom.test.tsx
@@ -4,6 +4,7 @@ import type {
ClaudeReadiness,
OkDesktopBridge,
OkPtyAdoptResult,
+ OkPtyCreateResult,
OkPtyData,
OkPtyExit,
OkPtyNotice,
@@ -227,16 +228,12 @@ vi.doMock('next-themes', () => ({
useTheme: () => ({ resolvedTheme: mockResolvedTheme }),
}));
-type CreateResult =
- | { ok: true; ptyId: string }
- | { ok: false; reason: 'no-project' | 'not-consented' };
-
const WIRED: ClaudeReadiness = { claude: 'present', mcp: 'wired' };
function makeBridge(
- createResult: CreateResult,
+ createResult: OkPtyCreateResult,
preflight: ClaudeReadiness = WIRED,
- adopt: (id: string) => Promise<OkPtyAdoptResult> = async () => ({
+ adopt: (id: string, opts?: { start?: boolean }) => Promise<OkPtyAdoptResult> = async () => ({
ok: true,
replay: '',
}),
@@ -264,9 +261,11 @@ function makeBridge(
'exists' as const,
);
const rewireClaudeMcp = vi.fn(async () => preflight);
+ const adoptMock = vi.fn(adopt);
const terminal = {
create: vi.fn(async () => createResult),
- adopt: vi.fn(adopt),
+ adopt: adoptMock,
+ start: vi.fn((id: string) => adoptMock(id, { start: true })),
input: vi.fn((_id: string, _d: string) => {}),
resize: vi.fn((_id: string, _c: number, _r: number) => {}),
kill: vi.fn(async (_id: string) => {}),
@@ -408,6 +407,101 @@ describe('TerminalPanel', () => {
expect(lastTerm?.options.screenReaderMode).toBe(true);
});
+ test('captures the one-shot prompt before the start handshake resolves without typing', async () => {
+ const h = makeBridge({ ok: true, ptyId: 'pty-1' });
+ h.terminal.adopt.mockImplementationOnce(async () => {
+ h.pushData({ ptyId: 'pty-1', data: 'prompt$ ' });
+ return { ok: true, replay: '' };
+ });
+ render(<TerminalPanel bridge={h.bridge} />);
+ await waitFor(() => expect(h.terminal.start).toHaveBeenCalledWith('pty-1'));
+ await waitFor(() => expect(screen.queryByTestId('terminal-starting-notice')).toBeNull());
+ expect(lastTerm?.write).toHaveBeenCalledExactlyOnceWith('prompt$ ', expect.any(Function));
+ expect(h.terminal.input).not.toHaveBeenCalled();
+ });
+
+ test('keeps an exit received before the start reply in the exited state', async () => {
+ const h = makeBridge({ ok: true, ptyId: 'pty-1' });
+ h.terminal.adopt.mockImplementationOnce(async () => {
+ h.pushData({ ptyId: 'pty-1', data: 'goodbye\r\n' });
+ h.pushExit({ ptyId: 'pty-1', exitCode: 7, signal: null });
+ return { ok: true, replay: '' };
+ });
+ render(<TerminalPanel bridge={h.bridge} />);
+ await waitFor(() =>
+ expect(screen.getByRole('button', { name: 'Restart terminal' })).toBeTruthy(),
+ );
+ expect(document.querySelector('[data-terminal-status="exited"]')).toBeTruthy();
+ expect(screen.queryByTestId('terminal-starting-notice')).toBeNull();
+ expect(lastTerm?.write).toHaveBeenCalledExactlyOnceWith('goodbye\r\n', expect.any(Function));
+ act(() => lastTerm?.onDataCb?.('ignored input'));
+ expect(h.terminal.input).not.toHaveBeenCalled();
+ });
+
+ test('shows a restartable error if the reserved session disappears before attachment', async () => {
+ const h = makeBridge({ ok: true, ptyId: 'pty-1' });
+ h.terminal.adopt.mockResolvedValueOnce({ ok: false, reason: 'unknown-session' });
+ render(<TerminalPanel bridge={h.bridge} />);
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Try again' })).toBeTruthy());
+ expect(screen.getByText(/couldn't start/i)).toBeTruthy();
+ expect(screen.getByText(/no longer available/i)).toBeTruthy();
+ expect(screen.queryByText('unknown-session')).toBeNull();
+ expect(screen.queryByTestId('terminal-starting-notice')).toBeNull();
+ expect(h.terminal.input).not.toHaveBeenCalled();
+ });
+
+ test('rehydrating a survivor adopts it for replay and never asks for a fresh start', async () => {
+ const h = makeBridge({ ok: true, ptyId: 'unused' });
+ h.terminal.adopt.mockResolvedValueOnce({ ok: true, replay: 'restored$ ' });
+ render(<TerminalPanel bridge={h.bridge} adoptPtyId="surv-1" />);
+ await waitFor(() => expect(h.terminal.adopt).toHaveBeenCalledWith('surv-1'));
+ await waitFor(() => expect(screen.queryByTestId('terminal-starting-notice')).toBeNull());
+ expect(h.terminal.adopt).toHaveBeenCalledExactlyOnceWith('surv-1');
+ expect(lastTerm?.write).toHaveBeenCalledExactlyOnceWith('restored$ ', expect.any(Function));
+ expect(h.terminal.create).not.toHaveBeenCalled();
+ });
+
+ test('keeps the panel non-interactive until the shell start is acknowledged', async () => {
+ const h = makeBridge({ ok: true, ptyId: 'pty-1' });
+ let releaseStart = (): void => {};
+ h.terminal.adopt.mockImplementationOnce(
+ async () =>
+ await new Promise<OkPtyAdoptResult>((resolve) => {
+ releaseStart = () => resolve({ ok: true, replay: '' });
+ }),
+ );
+ render(<TerminalPanel bridge={h.bridge} />);
+ await waitFor(() => expect(h.terminal.start).toHaveBeenCalledWith('pty-1'));
+ act(() => lastTerm?.onDataCb?.('typed too early'));
+ expect(h.terminal.input).not.toHaveBeenCalled();
+ expect(document.querySelector('[data-terminal-status="starting"]')).toBeTruthy();
+ expect(document.querySelector('[data-terminal-status="starting"]')?.ariaBusy).toBe('true');
+ await act(async () => {
+ releaseStart();
+ await Promise.resolve();
+ });
+ await waitFor(() =>
+ expect(document.querySelector('[data-terminal-status="running"]')).toBeTruthy(),
+ );
+ expect(screen.getByTestId('terminal-starting-notice')).toBeTruthy();
+ expect(document.querySelector('[data-terminal-status="running"]')?.ariaBusy).toBe('true');
+ act(() => lastTerm?.onDataCb?.('now live'));
+ expect(h.terminal.input).toHaveBeenCalledWith('pty-1', 'now live');
+ act(() => h.pushData({ ptyId: 'pty-1', data: '$ ' }));
+ expect(screen.queryByTestId('terminal-starting-notice')).toBeNull();
+ expect(document.querySelector('[data-terminal-status="running"]')?.ariaBusy).toBe('false');
+ });
+
+ test('surfaces a withdrawn terminal consent at start time as a refusal, not a crash', async () => {
+ const h = makeBridge({ ok: true, ptyId: 'pty-1' });
+ h.terminal.adopt.mockResolvedValueOnce({ ok: false, reason: 'not-consented' });
+ render(<TerminalPanel bridge={h.bridge} />);
+ await waitFor(() =>
+ expect(screen.getByText(/Terminal access isn't enabled for this project\./)).toBeTruthy(),
+ );
+ expect(screen.queryByRole('button', { name: 'Restart terminal' })).toBeNull();
+ });
+
test('reload rehydration: adopts a surviving session instead of spawning a fresh one', async () => {
const { bridge, terminal } = makeBridge({ ok: true, ptyId: 'pty-fresh' });
render(<TerminalPanel bridge={bridge} adoptPtyId="pty-survivor" />);
@@ -782,6 +876,42 @@ describe('TerminalPanel', () => {
expect(terminal.input).toHaveBeenCalledWith('pty-1', "'C:\\Users\\O'\\''Brien\\shot.png' ");
});
+ test('a shell family learned before the start reply survives the start reply', async () => {
+ const { bridge, terminal, pushNotice } = makeBridge(
+ { ok: true, ptyId: 'pty-1' },
+ WIRED,
+ undefined,
+ 'win32',
+ );
+ let releaseStart = (): void => {};
+ terminal.adopt.mockImplementationOnce(
+ async () =>
+ await new Promise<OkPtyAdoptResult>((resolve) => {
+ releaseStart = () => resolve({ ok: true, replay: '' });
+ }),
+ );
+ (bridge as unknown as { getPathForFile: (file: File) => string }).getPathForFile = () =>
+ 'C:\\Users\\A B\\safe.png';
+ render(<TerminalPanel bridge={bridge} />);
+ await waitFor(() => expect(terminal.start).toHaveBeenCalledWith('pty-1'));
+ act(() => pushNotice({ ptyId: 'pty-1', notice: 'shell-resolved', shellFamily: 'cmd' }));
+ await act(async () => {
+ releaseStart();
+ await Promise.resolve();
+ });
+ await waitFor(() =>
+ expect(document.querySelector('[data-terminal-status="running"]')).toBeTruthy(),
+ );
+
+ const container = document.querySelector('[data-terminal-status]');
+ if (container === null) throw new Error('terminal container not found');
+ const file = new File(['x'], 'safe.png', { type: 'image/png' });
+ fireEvent.drop(container, { dataTransfer: { types: ['Files'], files: [file] } });
+
+ expect(terminal.input).toHaveBeenCalledWith('pty-1', '"C:\\Users\\A B\\safe.png" ');
+ expect(screen.queryByTestId('terminal-path-drop-notice-banner')).toBeNull();
+ });
+
test('a cmd terminal quotes safe paths and refuses variable-expanding paths', async () => {
const { bridge, terminal, pushNotice } = makeBridge(
{ ok: true, ptyId: 'pty-1' },
@@ -1864,13 +1994,15 @@ describe('TerminalPanel', () => {
});
test('reaps a PTY that finishes spawning after the panel has already unmounted', async () => {
- let resolveCreate: ((r: CreateResult) => void) | undefined;
- const createPromise = new Promise<CreateResult>((res) => {
+ let resolveCreate: ((r: OkPtyCreateResult) => void) | undefined;
+ const createPromise = new Promise<OkPtyCreateResult>((res) => {
resolveCreate = res;
});
const kill = vi.fn(async (_id: string) => {});
const terminal = {
create: vi.fn(() => createPromise),
+ adopt: vi.fn(async () => ({ ok: true, replay: '' }) as const),
+ start: vi.fn(async () => ({ ok: true, replay: '' }) as const),
input: vi.fn(() => {}),
resize: vi.fn(() => {}),
kill,
@@ -1894,6 +2026,30 @@ describe('TerminalPanel', () => {
expect(terminal.onData).not.toHaveBeenCalled();
});
+ test('reaps a PTY that is mid-start when the panel unmounts', async () => {
+ let resolveAdopt: ((r: OkPtyAdoptResult) => void) | undefined;
+ const adoptPromise = new Promise<OkPtyAdoptResult>((res) => {
+ resolveAdopt = res;
+ });
+ const { bridge, terminal } = makeBridge(
+ { ok: true, ptyId: 'pty-1' },
+ WIRED,
+ () => adoptPromise,
+ );
+
+ const { unmount } = render(<TerminalPanel bridge={bridge} />);
+ await waitFor(() => expect(terminal.start).toHaveBeenCalledWith('pty-1'));
+ expect(terminal.kill).not.toHaveBeenCalled();
+
+ act(() => unmount());
+ await act(async () => {
+ resolveAdopt?.({ ok: true, replay: '' });
+ await adoptPromise;
+ });
+
+ expect(terminal.kill).toHaveBeenCalledWith('pty-1');
+ });
+
test('a claude launch probes readiness and shows a help affordance when claude is not on PATH', async () => {
const { bridge, terminal, openExternal } = makeBridge(
{ ok: true, ptyId: 'pty-1' },
@@ -1958,6 +2114,8 @@ describe('TerminalPanel', () => {
await createGate;
return { ok: true, ptyId: 'pty-restarted' } as const;
}),
+ adopt: vi.fn(async () => ({ ok: true, replay: '' }) as const),
+ start: vi.fn(async () => ({ ok: true, replay: '' }) as const),
input: vi.fn(() => {}),
resize: vi.fn(() => {}),
kill: vi.fn(async () => {}),
@@ -1978,7 +2136,9 @@ describe('TerminalPanel', () => {
render(<TerminalPanel bridge={bridge} />);
expect(await screen.findByRole('alert')).toBeTruthy();
- const restart = screen.getByRole('button', { name: 'Restart terminal' });
+ expect(screen.getByText(/couldn't start/i)).toBeTruthy();
+ expect(screen.queryByText(/stopped unexpectedly/i)).toBeNull();
+ const restart = screen.getByRole('button', { name: 'Try again' });
fireEvent.click(restart);
await waitFor(() => expect(terminal.create).toHaveBeenCalledTimes(2));
@@ -2001,6 +2161,140 @@ describe('TerminalPanel', () => {
expect(screen.getByRole('button', { name: 'Restart terminal' })).toBeTruthy();
});
+ test('a throw anywhere in the mount sequence lands a restartable state, not a stuck spinner', async () => {
+ const h = makeBridge({ ok: true, ptyId: 'pty-1' });
+ h.terminal.onExit = vi.fn(() => {
+ throw new Error('bridge channel closed');
+ });
+ render(<TerminalPanel bridge={h.bridge} />);
+
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Try again' })).toBeTruthy());
+ expect(screen.getByText(/couldn't start/i)).toBeTruthy();
+ expect(screen.getByText('bridge channel closed')).toBeTruthy();
+ expect(screen.queryByTestId('terminal-starting-notice')).toBeNull();
+ });
+
+ test('a throw anywhere in the adopt mount sequence lands a restartable state, not a stuck spinner', async () => {
+ const h = makeBridge({ ok: true, ptyId: 'unused' }, WIRED, async () => ({
+ ok: true,
+ replay: '',
+ }));
+ h.terminal.onExit = vi.fn(() => {
+ throw new Error('bridge channel closed');
+ });
+ render(<TerminalPanel bridge={h.bridge} adoptPtyId="surv-1" />);
+
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Try again' })).toBeTruthy());
+ expect(screen.getByText(/couldn't start/i)).toBeTruthy();
+ expect(screen.getByText('bridge channel closed')).toBeTruthy();
+ expect(screen.queryByTestId('terminal-starting-notice')).toBeNull();
+ });
+
+ test('a throw after the shell is live keeps the session running instead of reporting never-started', async () => {
+ const h = makeBridge({ ok: true, ptyId: 'pty-1' });
+ render(<TerminalPanel bridge={h.bridge} />);
+ lastTerm?.focus.mockImplementationOnce(() => {
+ throw new Error('focus after start blew up');
+ });
+
+ await waitFor(() =>
+ expect(document.querySelector('[data-terminal-status="running"]')).toBeTruthy(),
+ );
+ expect(screen.queryByText(/couldn't start/i)).toBeNull();
+ expect(screen.queryByRole('button', { name: 'Try again' })).toBeNull();
+ });
+
+ test('a throw after the adopted shell is live keeps the session running instead of reporting never-started', async () => {
+ let releaseAdopt: ((r: OkPtyAdoptResult) => void) | undefined;
+ const h = makeBridge(
+ { ok: true, ptyId: 'unused' },
+ WIRED,
+ async () =>
+ await new Promise<OkPtyAdoptResult>((resolve) => {
+ releaseAdopt = resolve;
+ }),
+ );
+ render(<TerminalPanel bridge={h.bridge} adoptPtyId="surv-1" />);
+ await waitFor(() => expect(h.terminal.adopt).toHaveBeenCalledWith('surv-1'));
+ lastTerm?.write.mockImplementationOnce(() => {
+ throw new Error('write after adopt blew up');
+ });
+ await act(async () => {
+ releaseAdopt?.({ ok: true, replay: 'restored$ ' });
+ await Promise.resolve();
+ });
+
+ await waitFor(() =>
+ expect(document.querySelector('[data-terminal-status="running"]')).toBeTruthy(),
+ );
+ expect(screen.queryByText(/couldn't start/i)).toBeNull();
+ expect(screen.queryByRole('button', { name: 'Try again' })).toBeNull();
+ });
+
+ test('a shell that failed to spawn reads as never-started, not as a crash', async () => {
+ const { bridge, terminal, pushExit } = makeBridge({ ok: true, ptyId: 'pty-1' });
+ const onExit = vi.fn();
+ render(<TerminalPanel bridge={bridge} onExit={onExit} />);
+ await waitFor(() => expect(terminal.onExit).toHaveBeenCalledTimes(1));
+
+ act(() =>
+ pushExit({
+ ptyId: 'pty-1',
+ error: 'posix_spawnp failed',
+ neverStarted: true,
+ }),
+ );
+
+ expect(screen.getByText(/couldn't start/i)).toBeTruthy();
+ expect(screen.getByText('posix_spawnp failed')).toBeTruthy();
+ expect(screen.queryByText(/stopped unexpectedly/i)).toBeNull();
+ expect(screen.queryByText(/exit code/i)).toBeNull();
+ expect(screen.getByRole('button', { name: 'Try again' })).toBeTruthy();
+ expect(onExit).not.toHaveBeenCalled();
+ });
+
+ test('a host that dies before the shell spawns reads as localized copy, not a wire marker', async () => {
+ const { bridge, terminal, pushExit } = makeBridge({ ok: true, ptyId: 'pty-1' });
+ render(<TerminalPanel bridge={bridge} />);
+ await waitFor(() => expect(terminal.onExit).toHaveBeenCalledTimes(1));
+
+ act(() => pushExit({ ptyId: 'pty-1', neverStarted: true, hostExited: true }));
+
+ expect(screen.getByText(/couldn't start/i)).toBeTruthy();
+ expect(
+ screen.getByText(/background service stopped before the shell could start/i),
+ ).toBeTruthy();
+ expect(screen.queryByText(/terminal host exited/)).toBeNull();
+ expect(screen.getByRole('button', { name: 'Try again' })).toBeTruthy();
+ });
+
+ test('a launch that could not be composed reads as localized copy, not a machine reason', async () => {
+ const { bridge, terminal, pushExit } = makeBridge({ ok: true, ptyId: 'pty-1' });
+ render(<TerminalPanel bridge={bridge} />);
+ await waitFor(() => expect(terminal.onExit).toHaveBeenCalledTimes(1));
+
+ act(() => pushExit({ ptyId: 'pty-1', neverStarted: true, launchFailure: 'unsafe-argument' }));
+
+ expect(screen.getByText(/couldn't start/i)).toBeTruthy();
+ expect(screen.getByText(/can't run this command in the configured shell/i)).toBeTruthy();
+ expect(screen.queryByText('unsafe-argument')).toBeNull();
+ expect(screen.getByRole('button', { name: 'Try again' })).toBeTruthy();
+ });
+
+ test('a reaped start with no failure detail reads as bare start copy and nothing else', async () => {
+ const { bridge, terminal, pushExit } = makeBridge({ ok: true, ptyId: 'pty-1' });
+ render(<TerminalPanel bridge={bridge} />);
+ await waitFor(() => expect(terminal.onExit).toHaveBeenCalledTimes(1));
+
+ act(() => pushExit({ ptyId: 'pty-1', neverStarted: true }));
+
+ expect(screen.getByText(/couldn't start/i)).toBeTruthy();
+ expect(screen.getByRole('alert').querySelectorAll('p')).toHaveLength(1);
+ expect(screen.getByRole('button', { name: 'Try again' })).toBeTruthy();
+ expect(screen.queryByRole('button', { name: 'Restart terminal' })).toBeNull();
+ expect(screen.queryByText(/exit code/i)).toBeNull();
+ });
+
test('Restart spawns a fresh PTY in the same window and clears the exit state', async () => {
const { bridge, terminal, pushExit } = makeBridge({ ok: true, ptyId: 'pty-1' });
render(<TerminalPanel bridge={bridge} />);
@@ -2168,6 +2462,8 @@ describe('TerminalPanel', () => {
const kill = vi.fn(async (_id: string) => {});
const terminal = {
create,
+ adopt: vi.fn(async () => ({ ok: true, replay: '' }) as const),
+ start: vi.fn(async () => ({ ok: true, replay: '' }) as const),
input: vi.fn(() => {}),
resize: vi.fn(() => {}),
kill,
diff --git a/packages/app/src/components/TerminalPanel.launch.dom.test.tsx b/packages/app/src/components/TerminalPanel.launch.dom.test.tsx
index b09242633..e2d7c1aba 100644
--- a/packages/app/src/components/TerminalPanel.launch.dom.test.tsx
+++ b/packages/app/src/components/TerminalPanel.launch.dom.test.tsx
@@ -128,6 +128,12 @@ function makeBridge(
replay: '',
}),
),
+ start: vi.fn(
+ async (): Promise<{ ok: true; replay: string } | { ok: false; reason: string }> => ({
+ ok: true,
+ replay: '',
+ }),
+ ),
onData: vi.fn((cb: (m: OkPtyData) => void) => {
dataSubs.push(cb);
return vi.fn(() => {});
@@ -695,7 +701,7 @@ describe('TerminalPanel "Open in terminal" launch (baked into the PTY spawn)', (
/>,
);
- await waitFor(() => expect(terminal.adopt).toHaveBeenCalledTimes(1));
+ await waitFor(() => expect(terminal.adopt).toHaveBeenCalledWith('surv-1'));
await act(async () => {
await Promise.resolve();
});
@@ -705,13 +711,8 @@ describe('TerminalPanel "Open in terminal" launch (baked into the PTY spawn)', (
test('a FAILED adoption (survivor gone) falls through to a plain shell — does NOT re-bake the launch', async () => {
const { bridge, terminal } = makeBridge(WIRED);
- terminal.adopt = vi.fn(
- async (): Promise<{ ok: true; replay: string } | { ok: false; reason: string }> => ({
- ok: false,
- reason: 'unknown-session',
- }),
- );
- render(
+ terminal.adopt.mockResolvedValueOnce({ ok: false, reason: 'unknown-session' });
+ const { container } = render(
<TerminalPanel
bridge={bridge}
adoptPtyId="surv-gone"
@@ -719,10 +720,13 @@ describe('TerminalPanel "Open in terminal" launch (baked into the PTY spawn)', (
/>,
);
- await waitFor(() => expect(terminal.adopt).toHaveBeenCalledTimes(1));
+ await waitFor(() => expect(terminal.adopt).toHaveBeenCalledWith('surv-gone'));
await waitFor(() => expect(terminal.create).toHaveBeenCalledTimes(1));
+ await waitFor(() =>
+ expect(container.querySelector('[data-terminal-status="running"]')).not.toBeNull(),
+ );
expect(bakedLaunch(terminal.create)).toBeUndefined();
- expect(launchInputWrites(terminal.input)).toEqual([]);
+ expect(terminal.input).not.toHaveBeenCalled();
});
});
diff --git a/packages/app/src/components/TerminalPanel.tsx b/packages/app/src/components/TerminalPanel.tsx
index 20954275f..c40fea5b0 100644
--- a/packages/app/src/components/TerminalPanel.tsx
+++ b/packages/app/src/components/TerminalPanel.tsx
@@ -11,6 +11,10 @@ import {
type TerminalLaunchCommand,
type WindowsShellFamily,
} from '@inkeep/open-knowledge-core';
+import {
+ assertNeverPtyAdoptReason,
+ assertNeverPtyCreateReason,
+} from '@inkeep/open-knowledge-core/desktop-bridge';
import { useLingui } from '@lingui/react/macro';
import { FitAddon } from '@xterm/addon-fit';
import { Unicode11Addon } from '@xterm/addon-unicode11';
@@ -184,6 +188,7 @@ function TerminalSession({
let cancelled = false;
let sessionEnded = false;
+ let shellLive = false;
let ptyId: string | null = null;
let unsubData: (() => void) | undefined;
let unsubExit: (() => void) | undefined;
@@ -518,9 +523,23 @@ function TerminalSession({
if (msg.ptyId !== ptyId) return;
sessionEnded = true;
terminalInputEnabledRef.current = false;
- setExitInfo({ exitCode: msg.exitCode, signal: msg.signal, error: msg.error });
+ setExitInfo(
+ msg.neverStarted
+ ? msg.hostExited === true
+ ? { phase: 'start', reason: 'host-exited' }
+ : msg.launchFailure !== undefined
+ ? { phase: 'start', reason: 'launch-unsupported' }
+ : { phase: 'start', detail: msg.error ?? '' }
+ : {
+ phase: 'exit',
+ exitCode: msg.exitCode,
+ signal: msg.signal,
+ error: msg.error,
+ ...(msg.hostExited === true ? ({ hostExited: true } as const) : {}),
+ },
+ );
setStatus('exited');
- onExitRef.current?.({ exitCode: msg.exitCode, signal: msg.signal });
+ if (!msg.neverStarted) onExitRef.current?.({ exitCode: msg.exitCode, signal: msg.signal });
});
ptyResizeThrottle = createResizeThrottle(() => {
@@ -540,6 +559,54 @@ function TerminalSession({
observer.observe(container);
};
+ const startSession = async (livePtyId: string): Promise<void> => {
+ let failure: TerminalExitInfo;
+ try {
+ const attached = await bridge.terminal.start(livePtyId);
+ if (attached.ok) {
+ shellLive = true;
+ if (cancelled) return;
+ if (attached.shellFamily !== undefined) shellFamilyRef.current = attached.shellFamily;
+ if (attached.shellNoticeReason !== undefined) {
+ applyShellNotice({
+ ptyId: livePtyId,
+ notice: 'invalid-shell-override',
+ reason: attached.shellNoticeReason,
+ });
+ }
+ if (attached.replay !== '') {
+ markFirstOutput();
+ term.write(attached.replay);
+ }
+ return;
+ }
+ if (cancelled) return;
+ console.error('[terminal] shell start refused:', attached.reason, livePtyId);
+ switch (attached.reason) {
+ case 'not-consented':
+ sessionEnded = true;
+ terminalInputEnabledRef.current = false;
+ setStatus('not-consented');
+ return;
+ case 'not-started':
+ case 'unknown-session':
+ case 'host-unavailable':
+ failure = { phase: 'start', reason: attached.reason };
+ break;
+ default:
+ assertNeverPtyAdoptReason(attached.reason);
+ }
+ } catch (err) {
+ console.error('[terminal] initial start() failed:', err);
+ failure = { phase: 'start', detail: err instanceof Error ? err.message : String(err) };
+ }
+ if (cancelled || sessionEnded || shellLive) return;
+ sessionEnded = true;
+ terminalInputEnabledRef.current = false;
+ setExitInfo(failure);
+ setStatus('exited');
+ };
+
const resolveLaunchCommand = async (
intent: TerminalLaunchIntent,
): Promise<string | TerminalLaunchCommand | undefined> => {
@@ -622,6 +689,7 @@ function TerminalSession({
const replay = adopted.replay;
const hasReplay = replay !== '';
attachSession(adoptPtyId);
+ shellLive = true;
if (hasReplay) {
markFirstOutput();
term.write(replay, markInteractive);
@@ -657,9 +725,8 @@ function TerminalSession({
console.error('[terminal] create() failed:', err);
if (cancelled) return;
setExitInfo({
- exitCode: 1,
- signal: null,
- error: err instanceof Error ? err.message : String(err),
+ phase: 'start',
+ detail: err instanceof Error ? err.message : String(err),
});
setStatus('exited');
return;
@@ -673,11 +740,21 @@ function TerminalSession({
return;
}
if (!result.ok) {
- setStatus(result.reason === 'not-consented' ? 'not-consented' : 'no-project');
+ switch (result.reason) {
+ case 'not-consented':
+ case 'no-project':
+ setStatus(result.reason);
+ break;
+ default:
+ assertNeverPtyCreateReason(result.reason);
+ }
return;
}
+ // STOP: attachSession installs onData/onExit before start() posts the spawn (terminal-manager.ts, same tick); once start() resolves, nothing below may await before the readinessScan assignment or the shell's first output outruns the scanner.
attachSession(result.ptyId);
+ await startSession(result.ptyId);
+ if (cancelled || sessionEnded) return;
markInteractive();
const staged = launch?.stagePaste;
@@ -735,7 +812,18 @@ function TerminalSession({
term.focus();
}, STAGE_PASTE_SETTLE_MS);
}
- })();
+ })().catch((err) => {
+ console.error('[terminal] mount sequence failed:', err);
+ if (cancelled || sessionEnded) return;
+ if (shellLive) {
+ markInteractive();
+ return;
+ }
+ sessionEnded = true;
+ terminalInputEnabledRef.current = false;
+ setExitInfo({ phase: 'start', detail: err instanceof Error ? err.message : String(err) });
+ setStatus('exited');
+ });
return () => {
cancelled = true;
@@ -825,6 +913,8 @@ function TerminalSession({
};
}, [bridge]);
+ const isSettling = status === 'starting' || (status === 'running' && !hasOutput);
+
return (
<div className="flex h-full w-full flex-col">
{status === 'running' && readiness ? (
@@ -888,8 +978,13 @@ function TerminalSession({
) : null}
{}
<div className="relative min-h-0 flex-1">
- <div ref={containerRef} data-terminal-status={status} className="h-full w-full px-1.5" />
- {status === 'starting' || (status === 'running' && !hasOutput) ? (
+ <div
+ ref={containerRef}
+ data-terminal-status={status}
+ aria-busy={isSettling}
+ className="h-full w-full px-1.5"
+ />
+ {isSettling ? (
<TerminalStartingNotice className="pointer-events-none absolute inset-0 z-20" />
) : null}
</div>
diff --git a/packages/app/src/locales/GLOSSARY.md b/packages/app/src/locales/GLOSSARY.md
index d094b28e1..666d2a002 100644
--- a/packages/app/src/locales/GLOSSARY.md
+++ b/packages/app/src/locales/GLOSSARY.md
@@ -106,6 +106,12 @@ rendering than the English carries. Settle them here rather than per-PR.
- **knowledge base** is the user's own collection of notes. Where a native compound exists and
reads naturally it wins over a transliteration; `ur` keeps the transliteration because the
native compound is not in common software use.
+- **background service** is the pty-host utility process that backs a terminal. The
+ OpenKnowledge server is a different process on a different path and is never what this
+ wording refers to. The product already says *the agent service* and *the
+ OpenKnowledge server* for adjacent concepts, so this one is pinned to keep a fourth name
+ from appearing: user-facing terminal copy says *background service*, never *server*,
+ *helper process*, or *host*.
- **Follow** is the pull-only sync mode. Korean uses 팔로우 consistently rather than mixing the
English label with 따라오기.
diff --git a/packages/app/src/locales/ar/messages.json b/packages/app/src/locales/ar/messages.json
index 5b5e04242..289dd0609 100644
--- a/packages/app/src/locales/ar/messages.json
+++ b/packages/app/src/locales/ar/messages.json
@@ -331,6 +331,7 @@
"2wTb8w": ["أعدّه في صفحته الخاصة تحت «الإضافات»."],
"2wxgft": ["إعادة تسمية"],
"2zvUIK": ["عرض هذه التعليقات في لوحة التعليقات"],
+ "3-1BY2": ["لم تعد جلسة الطرفية هذه متاحة."],
"322lyb": ["أبرِز النصائح والتحذيرات والملاحظات."],
"32TTpa": ["مراسلة الدعم بشأن هذا التقرير"],
"34qyH5": ["تعذّر الوصول إلى الخادم"],
@@ -805,6 +806,7 @@
"7Voget": ["تحديد ", ["name"]],
"7WnfoD": ["هذا التقرير في طريقه بالفعل. ستظهر نتيجته في سجل تقارير العلل."],
"7Y9yTo": ["تم إنشاء ", ["owner"], "/", ["name"], "، لكن فشل الدفع."],
+ "7YJr6i": ["لم تبدأ الصدفة الخاصة بهذه الجلسة مطلقًا."],
"7YRrJ9": [
"متاح في تطبيق OpenKnowledge لسطح المكتب. من الطرفية، استخدم<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."
],
@@ -1433,6 +1435,7 @@
"ENpRJV": ["معاينات الروابط الخارجية"],
"EO4Dt1": ["تفعيل ", ["file"]],
"EOjU5V": ["خصائص الرياضيات المضمَّنة"],
+ "EP-R3L": ["تعذّر بدء الطرفية."],
"EP8mZC": ["الكشف وإعادة التشغيل"],
"EPGePE": ["رُفع باسم «", ["0"], "» — الاسم «", ["1"], "» كان مأخوذًا."],
"EPKVES": ["هل تحدّث «", ["skillName"], "» فوق تعديلاتك؟"],
@@ -2268,6 +2271,7 @@
"NRSLBe": ["قبل ", ["diffMin"], " دقيقة"],
"NSnIUP": ["صفحتان (زوجي)"],
"NUr4kz": ["نقطة انطلاق قابلة لإعادة الاستخدام للمستندات الجديدة في هذا المجلد."],
+ "NVghPF": ["تعذّر على الطرفية تشغيل هذا الأمر في الصدفة المُهيّأة."],
"NY0p7s": ["تم تخطّي تفعيل أدوات Open Knowledge. تعمل هذه السلسلة بدونها."],
"NYUhy5": ["اسم المجلد الفرعي"],
"NYn1cR": ["يجري تحميل المحرر"],
@@ -4084,6 +4088,7 @@
" موثوقة."
],
"fqSfXY": ["استبدال"],
+ "frREUl": ["توقفت خدمة الطرفية الخلفية قبل أن تتمكن الصدفة من البدء."],
"ft-BOm": ["الإبلاغ عن علة…"],
"fuJZKk": ["البحث في الفروع"],
"fvrHin": ["متاح في كل مشروع على هذا الجهاز. غير مشترك عبر git."],
@@ -4972,6 +4977,7 @@
"oCZkaG": ["نسخ المسار"],
"oJl7eO": ["مكوّن غير معروف: ", ["componentName"], " — يمكن تحرير المصدر أدناه"],
"oKBnk5": ["حُظرت طلبات إضافية."],
+ "oLyLo6": ["خدمة الطرفية الخلفية ليست قيد التشغيل."],
"oP-FQW": ["استخدم مسارًا نسبيًا داخل المهارة"],
"oPU_4D": ["الإرسال عندما يكون الوكيل متفرغًا"],
"oQA-cA": ["المسار الكامل"],
diff --git a/packages/app/src/locales/ar/messages.po b/packages/app/src/locales/ar/messages.po
index 015caba24..722d676ef 100644
--- a/packages/app/src/locales/ar/messages.po
+++ b/packages/app/src/locales/ar/messages.po
@@ -13775,6 +13775,10 @@ msgstr "سيقبل الخادم الطلبات الموجّهة إلى {0} دو
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr "أشكال title وdescription وresource وtags عند استخدامها. لا شيء مطلوب. الإعلان عن نوع واحد فقط، لذلك يتم وضع علامة على tags المكتوب كسلسلة مفصولة بفواصل."
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr "لم تبدأ الصدفة الخاصة بهذه الجلسة مطلقًا."
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "مجلد المهارة نفسه — المصدر الذي تنسخ منه المواقع الأخرى أو ترتبط به"
@@ -13803,6 +13807,22 @@ msgstr "يتشارك صفّا الطرفية وسطح المكتب لـ {label}
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr "يتشارك صفّا الطرفية وسطح المكتب لـ {label} إعدادًا واحدًا، لذا فإن إزالته يقطع اتصال كليهما."
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr "خدمة الطرفية الخلفية ليست قيد التشغيل."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr "توقفت خدمة الطرفية الخلفية قبل أن تتمكن الصدفة من البدء."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr "تعذّر على الطرفية تشغيل هذا الأمر في الصدفة المُهيّأة."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr "تعذّر بدء الطرفية."
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr "الطرفية معطّلة لهذا المشروع. أعد تشغيلها لتنفيذ الأوامر هنا."
@@ -14379,6 +14399,10 @@ msgstr "يحزم هذا المصدر عدة مهارات — اختر ما تر
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr "يعيش هذا القالب في مجلد أب — حذفه يؤثر في كل مجلد تحته لا يعرّف نسخته الخاصة."
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr "لم تعد جلسة الطرفية هذه متاحة."
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr "لا يمكن استخدام هذه السمة حتى يُصلح الملف."
@@ -14591,6 +14615,7 @@ msgstr "جرّب موجّهًا"
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr "أعد المحاولة"
diff --git a/packages/app/src/locales/bn/messages.json b/packages/app/src/locales/bn/messages.json
index fad9d032d..b223faebb 100644
--- a/packages/app/src/locales/bn/messages.json
+++ b/packages/app/src/locales/bn/messages.json
@@ -274,6 +274,7 @@
"2wTb8w": ["Plugins-এর নিচে এর নিজের পাতায় এটি সাজান।"],
"2wxgft": ["নাম বদলান"],
"2zvUIK": ["এই মন্তব্যগুলি মন্তব্য প্যানেলে দেখান"],
+ "3-1BY2": ["এই টার্মিনাল সেশনটি আর উপলব্ধ নেই।"],
"322lyb": ["পরামর্শ, সতর্কতা ও নোট হাইলাইট করুন।"],
"32TTpa": ["এই রিপোর্ট সম্পর্কে সাপোর্টে ইমেইল করুন"],
"34qyH5": ["সার্ভারের নাগাল পাওয়া যায়নি"],
@@ -642,6 +643,7 @@
"7Voget": [["name"], " নির্বাচন করুন"],
"7WnfoD": ["এই রিপোর্ট ইতিমধ্যেই পথে আছে। এর ফলাফল বাগ রিপোর্টের ইতিহাসে দেখা যাবে।"],
"7Y9yTo": [["owner"], "/", ["name"], " তৈরি হয়েছে, তবে পুশ ব্যর্থ হয়েছে।"],
+ "7YJr6i": ["এই সেশনের শেল কখনও চালু করা হয়নি।"],
"7YRrJ9": [
"OpenKnowledge ডেস্কটপ অ্যাপে পাওয়া যায়। টার্মিনাল থেকে <0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2> ব্যবহার করুন।"
],
@@ -1160,6 +1162,7 @@
"ENpRJV": ["বাইরের লিংকের প্রাকদর্শন"],
"EO4Dt1": [["file"], " চালু করুন"],
"EOjU5V": ["ইনলাইন গণিত প্রপার্টি"],
+ "EP-R3L": ["টার্মিনাল চালু করা যায়নি।"],
"EP8mZC": ["এক্সপোজ করুন এবং পুনরায় চালু করুন"],
"EPGePE": ["\"", ["0"], "\" হিসেবে আপলোড হয়েছে — \"", ["1"], "\" নামটি আগেই নেওয়া ছিল।"],
"EPKVES": ["আপনার সম্পাদনার উপরে \"", ["skillName"], "\" হালনাগাদ করবেন?"],
@@ -1883,6 +1886,7 @@
"NRSLBe": [["diffMin"], " মিনিট আগে"],
"NSnIUP": ["দুই পাতা (জোড়)"],
"NUr4kz": ["এই ফোল্ডারে নতুন নথির জন্য একটি পুনর্ব্যবহারযোগ্য শুরুর বিন্দু।"],
+ "NVghPF": ["টার্মিনাল কনফিগার করা শেলে এই কমান্ড চালাতে পারে না।"],
"NY0p7s": ["Open Knowledge টুল সক্ষম করা এড়িয়ে যাওয়া হয়েছে। এই থ্রেড সেগুলো ছাড়াই চলবে।"],
"NYUhy5": ["উপ-ফোল্ডারের নাম"],
"NYn1cR": ["সম্পাদক লোড হচ্ছে"],
@@ -3421,6 +3425,7 @@
" সেশনে এই প্রকল্প খুললে এটি নিজে থেকেই যুক্ত হয়।"
],
"fqSfXY": ["বদলান"],
+ "frREUl": ["শেল চালু হওয়ার আগেই টার্মিনালের ব্যাকগ্রাউন্ড সার্ভিস থেমে গেছে।"],
"ft-BOm": ["একটি বাগ জানান…"],
"fuJZKk": ["ব্রাঞ্চ খুঁজুন"],
"fvrHin": ["এই মেশিনের প্রতিটি প্রকল্পে পাওয়া যায়। git-এর মাধ্যমে ভাগ করা হয় না।"],
@@ -4230,6 +4235,7 @@
"oCZkaG": ["পথ কপি করুন"],
"oJl7eO": ["অজানা কম্পোনেন্ট: ", ["componentName"], " — সোর্স নিচে সম্পাদনাযোগ্য"],
"oKBnk5": ["আরও অনুরোধ আটকে দেওয়া হয়েছে।"],
+ "oLyLo6": ["টার্মিনালের ব্যাকগ্রাউন্ড সার্ভিস চলছে না।"],
"oP-FQW": ["স্কিলের ভিতরে একটি আপেক্ষিক পাথ ব্যবহার করুন"],
"oPU_4D": ["এজেন্ট মুক্ত হলে পাঠান"],
"oQA-cA": ["পূর্ণ পথ"],
diff --git a/packages/app/src/locales/bn/messages.po b/packages/app/src/locales/bn/messages.po
index 17ef44a19..b31d73050 100644
--- a/packages/app/src/locales/bn/messages.po
+++ b/packages/app/src/locales/bn/messages.po
@@ -13771,6 +13771,10 @@ msgstr "সার্ভারটি কোনো অন্তর্নির্
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr "title, description, resource, এবং tags এর আকার আপনি যখন ব্যবহার করেন। কোনটির প্রয়োজন নেই; একটি ঘোষণা করলে শুধুমাত্র তার টাইপ পিন হয়, তাই tags একটি কমা-বিচ্ছিন্ন স্ট্রিং হিসাবে ফ্ল্যাগ করা হয়।"
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr "এই সেশনের শেল কখনও চালু করা হয়নি।"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "স্কিলের নিজের ফোল্ডার — যে উৎস থেকে অন্য জায়গাগুলো অনুলিপি করে বা লিংক করে"
@@ -13799,6 +13803,22 @@ msgstr "{label}-এর টার্মিনাল ও ডেস্কটপ স
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr "{label}-এর টার্মিনাল ও ডেস্কটপ সারি একই সেটআপ ভাগ করে, তাই এটি সরালে দুটোরই সংযোগ বিচ্ছিন্ন হবে।"
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr "টার্মিনালের ব্যাকগ্রাউন্ড সার্ভিস চলছে না।"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr "শেল চালু হওয়ার আগেই টার্মিনালের ব্যাকগ্রাউন্ড সার্ভিস থেমে গেছে।"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr "টার্মিনাল কনফিগার করা শেলে এই কমান্ড চালাতে পারে না।"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr "টার্মিনাল চালু করা যায়নি।"
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr "এই প্রকল্পের জন্য টার্মিনাল বন্ধ। এখানে কমান্ড চালাতে সেটি আবার চালু করুন।"
@@ -14375,6 +14395,10 @@ msgstr "এই উৎসে কয়েকটি স্কিল আছে —
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr "এই টেমপ্লেটটি একটি মূল ফোল্ডারে আছে — এটি মুছে ফেললে এর নিচের প্রতিটি ফোল্ডার প্রভাবিত হয় যেগুলো নিজেদের সংস্করণ ঠিক করে না।"
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr "এই টার্মিনাল সেশনটি আর উপলব্ধ নেই।"
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr "ফাইলটি ঠিক না করা পর্যন্ত এই থিম ব্যবহার করা যাবে না।"
@@ -14587,6 +14611,7 @@ msgstr "একটি প্রম্পট চেষ্টা করে দে
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr "আবার চেষ্টা করুন"
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index 03c4a467a..1b54966ce 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -279,6 +279,7 @@
"2wTb8w": ["Set it up on its own page under Plugins."],
"2wxgft": ["Rename"],
"2zvUIK": ["Show these comments in the Comments panel"],
+ "3-1BY2": ["This terminal session is no longer available."],
"322lyb": ["Highlight tips, warnings, and notes."],
"32TTpa": ["Email support about this report"],
"34qyH5": ["Could not reach server"],
@@ -653,6 +654,7 @@
"This report is already on its way. Its result will appear in your bug report history."
],
"7Y9yTo": ["Created ", ["owner"], "/", ["name"], ", push failed."],
+ "7YJr6i": ["The shell for this session was never started."],
"7YRrJ9": [
"Available in the OpenKnowledge desktop app. From a terminal, use<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."
],
@@ -1196,6 +1198,7 @@
"ENpRJV": ["External link previews"],
"EO4Dt1": ["Enable ", ["file"]],
"EOjU5V": ["Inline Math Properties"],
+ "EP-R3L": ["The terminal couldn't start."],
"EP8mZC": ["Expose and restart"],
"EPGePE": ["Uploaded as \"", ["0"], "\" — the name \"", ["1"], "\" was taken."],
"EPKVES": ["Update \"", ["skillName"], "\" over your edits?"],
@@ -1947,6 +1950,7 @@
"NRSLBe": [["diffMin"], "m ago"],
"NSnIUP": ["Two-page (even)"],
"NUr4kz": ["A reusable starting point for new documents in this folder."],
+ "NVghPF": ["The terminal can't run this command in the configured shell."],
"NY0p7s": ["Skipped enabling Open Knowledge tools. This thread runs without them."],
"NYUhy5": ["Subfolder name"],
"NYn1cR": ["Loading editor"],
@@ -3510,6 +3514,7 @@
" session."
],
"fqSfXY": ["Replace"],
+ "frREUl": ["The terminal background service stopped before the shell could start."],
"ft-BOm": ["Report a bug…"],
"fuJZKk": ["Search branches"],
"fvrHin": ["Available in every project on this machine. Not shared through git."],
@@ -4359,6 +4364,7 @@
"oCZkaG": ["Copy path"],
"oJl7eO": ["Unknown component: ", ["componentName"], " — source editable below"],
"oKBnk5": ["More requests were blocked."],
+ "oLyLo6": ["The terminal background service isn't running."],
"oP-FQW": ["Use a relative path inside the skill"],
"oPU_4D": ["Send when the agent is free"],
"oQA-cA": ["Full path"],
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index 996b2d1d3..2c638cc2d 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -13775,6 +13775,10 @@ msgstr "The server will accept requests for {0} with no built-in authentication.
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr "The shell for this session was never started."
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "The skill's own folder — the source other locations copy or link from"
@@ -13803,6 +13807,22 @@ msgstr "The terminal and desktop rows for {label} share one setup, so changes he
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr "The terminal background service isn't running."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr "The terminal background service stopped before the shell could start."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr "The terminal can't run this command in the configured shell."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr "The terminal couldn't start."
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr "The terminal is turned off for this project. Turn it back on to run commands here."
@@ -14379,6 +14399,10 @@ msgstr "This source bundles several skills — choose the one to import."
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr "This terminal session is no longer available."
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr "This theme can’t be used until the file is fixed."
@@ -14591,6 +14615,7 @@ msgstr "Try a prompt"
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr "Try again"
diff --git a/packages/app/src/locales/es/messages.json b/packages/app/src/locales/es/messages.json
index 5fd9c6477..46d828a2c 100644
--- a/packages/app/src/locales/es/messages.json
+++ b/packages/app/src/locales/es/messages.json
@@ -319,6 +319,7 @@
"2wTb8w": ["Configúralo en su propia página, bajo Complementos."],
"2wxgft": ["Renombrar"],
"2zvUIK": ["Mostrar estos comentarios en el panel de comentarios"],
+ "3-1BY2": ["Esta sesión de terminal ya no está disponible."],
"322lyb": ["Resalta consejos, advertencias y notas."],
"32TTpa": ["Escribir a soporte sobre este informe"],
"34qyH5": ["No se pudo contactar con el servidor"],
@@ -785,6 +786,7 @@
"Este informe ya va en camino. Su resultado aparecerá en el historial de informes de error."
],
"7Y9yTo": ["Se creó ", ["owner"], "/", ["name"], ", pero falló el envío."],
+ "7YJr6i": ["El shell de esta sesión nunca se inició."],
"7YRrJ9": [
"Disponible en la aplicación de escritorio de OpenKnowledge. Desde una terminal, usa<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."
],
@@ -1415,6 +1417,7 @@
"ENpRJV": ["Vista previa de enlaces externos"],
"EO4Dt1": ["Activar ", ["file"]],
"EOjU5V": ["Propiedades de la fórmula en línea"],
+ "EP-R3L": ["La terminal no pudo iniciarse."],
"EP8mZC": ["Exponer y reiniciar"],
"EPGePE": ["Se subió como \"", ["0"], "\": el nombre \"", ["1"], "\" ya estaba ocupado."],
"EPKVES": ["¿Actualizar \"", ["skillName"], "\" sobre tus ediciones?"],
@@ -2271,6 +2274,7 @@
"NRSLBe": ["hace ", ["diffMin"], " min"],
"NSnIUP": ["Dos páginas (pares)"],
"NUr4kz": ["Un punto de partida reutilizable para los documentos nuevos de esta carpeta."],
+ "NVghPF": ["La terminal no puede ejecutar este comando en el shell configurado."],
"NY0p7s": [
"Se omitió habilitar las herramientas de Open Knowledge. Este hilo funciona sin ellas."
],
@@ -4110,6 +4114,9 @@
" de confianza."
],
"fqSfXY": ["Reemplazar"],
+ "frREUl": [
+ "El servicio en segundo plano de la terminal se detuvo antes de que el shell pudiera iniciarse."
+ ],
"ft-BOm": ["Informar de un error…"],
"fuJZKk": ["Buscar ramas"],
"fvrHin": ["Disponible en todos los proyectos de este equipo. No se comparte por git."],
@@ -5032,6 +5039,7 @@
"oCZkaG": ["Copiar ruta"],
"oJl7eO": ["Componente desconocido: ", ["componentName"], "; el código se puede editar abajo"],
"oKBnk5": ["Se bloquearon más solicitudes."],
+ "oLyLo6": ["El servicio en segundo plano de la terminal no está en ejecución."],
"oP-FQW": ["Usa una ruta relativa dentro de la habilidad"],
"oPU_4D": ["Enviar cuando el agente esté libre"],
"oQA-cA": ["Ruta completa"],
diff --git a/packages/app/src/locales/es/messages.po b/packages/app/src/locales/es/messages.po
index bcbe1766f..587c1be23 100644
--- a/packages/app/src/locales/es/messages.po
+++ b/packages/app/src/locales/es/messages.po
@@ -13775,6 +13775,10 @@ msgstr "El servidor aceptará solicitudes para {0} sin autenticación integrada.
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr "Las formas de title, description, resource y tags cuando se usan. Ninguno es obligatorio; declararlos solo fija su tipo, por lo que se marca si tags se escribe como una cadena separada por comas."
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr "El shell de esta sesión nunca se inició."
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "La carpeta propia de la habilidad: el origen del que copian o al que enlazan las demás ubicaciones"
@@ -13803,6 +13807,22 @@ msgstr "Las filas de terminal y de escritorio de {label} comparten una misma con
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr "Las filas de terminal y de escritorio de {label} comparten una misma configuración, así que quitarla desconecta ambas."
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr "El servicio en segundo plano de la terminal no está en ejecución."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr "El servicio en segundo plano de la terminal se detuvo antes de que el shell pudiera iniciarse."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr "La terminal no puede ejecutar este comando en el shell configurado."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr "La terminal no pudo iniciarse."
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr "La terminal está desactivada en este proyecto. Vuelve a activarla para ejecutar comandos aquí."
@@ -14379,6 +14399,10 @@ msgstr "Este origen incluye varias habilidades: elige cuál importar."
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr "Esta plantilla vive en una carpeta superior: eliminarla afecta a todas las carpetas por debajo que no definan su propia versión."
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr "Esta sesión de terminal ya no está disponible."
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr "Este tema no se puede usar hasta que se corrija el archivo."
@@ -14591,6 +14615,7 @@ msgstr "Prueba un prompt"
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr "Inténtalo de nuevo"
diff --git a/packages/app/src/locales/fr/messages.json b/packages/app/src/locales/fr/messages.json
index 57cab2333..0d00c6f1e 100644
--- a/packages/app/src/locales/fr/messages.json
+++ b/packages/app/src/locales/fr/messages.json
@@ -331,6 +331,7 @@
"2wTb8w": ["Configurez-le sur sa propre page sous Plugins."],
"2wxgft": ["Renommer"],
"2zvUIK": ["Afficher ces commentaires dans le panneau des commentaires"],
+ "3-1BY2": ["Cette session de terminal n'est plus disponible."],
"322lyb": ["Mettez en avant des conseils, des avertissements et des remarques."],
"32TTpa": ["Écrire au support à propos de ce rapport"],
"34qyH5": ["Impossible de joindre le serveur"],
@@ -812,6 +813,7 @@
"Ce rapport est déjà en route. Son résultat apparaîtra dans l'historique des rapports de bug."
],
"7Y9yTo": [["owner"], "/", ["name"], " a été créé, mais l'envoi a échoué."],
+ "7YJr6i": ["Le shell de cette session n'a jamais démarré."],
"7YRrJ9": [
"Disponible dans l'application de bureau OpenKnowledge. Depuis un terminal, utilisez<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."
],
@@ -1444,6 +1446,7 @@
"ENpRJV": ["Aperçus de liens externes"],
"EO4Dt1": ["Activer ", ["file"]],
"EOjU5V": ["Propriétés de la formule en ligne"],
+ "EP-R3L": ["Le terminal n'a pas pu démarrer."],
"EP8mZC": ["Exposer et redémarrer"],
"EPGePE": ["Envoyé sous « ", ["0"], " » — le nom « ", ["1"], " » était déjà pris."],
"EPKVES": ["Mettre à jour « ", ["skillName"], " » par-dessus vos modifications ?"],
@@ -2314,6 +2317,7 @@
"NRSLBe": ["il y a ", ["diffMin"], " min"],
"NSnIUP": ["Deux pages (paires)"],
"NUr4kz": ["Un point de départ réutilisable pour les nouveaux documents de ce dossier."],
+ "NVghPF": ["Le terminal ne peut pas exécuter cette commande dans le shell configuré."],
"NY0p7s": ["Activation des outils Open Knowledge ignorée. Ce fil fonctionne sans eux."],
"NYUhy5": ["Nom du sous-dossier"],
"NYn1cR": ["Chargement de l'éditeur"],
@@ -4149,6 +4153,9 @@
" de confiance."
],
"fqSfXY": ["Remplacer"],
+ "frREUl": [
+ "Le service d'arrière-plan du terminal s'est arrêté avant que le shell puisse démarrer."
+ ],
"ft-BOm": ["Signaler un bug…"],
"fuJZKk": ["Rechercher des branches"],
"fvrHin": ["Disponible dans tous les projets de cette machine. Non partagé via git."],
@@ -5081,6 +5088,7 @@
"oCZkaG": ["Copier le chemin"],
"oJl7eO": ["Composant inconnu : ", ["componentName"], " — source modifiable ci-dessous"],
"oKBnk5": ["D'autres requêtes ont été bloquées."],
+ "oLyLo6": ["Le service d'arrière-plan du terminal n'est pas en cours d'exécution."],
"oP-FQW": ["Utilisez un chemin relatif à l'intérieur de la compétence"],
"oPU_4D": ["Envoyer quand l’agent sera libre"],
"oQA-cA": ["Chemin complet"],
diff --git a/packages/app/src/locales/fr/messages.po b/packages/app/src/locales/fr/messages.po
index 5c3865a03..d4da10cfa 100644
--- a/packages/app/src/locales/fr/messages.po
+++ b/packages/app/src/locales/fr/messages.po
@@ -13775,6 +13775,10 @@ msgstr "Le serveur acceptera les requêtes pour {0} sans authentification intég
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr "Les formes de title, description, resource et tags lorsque vous les utilisez. Aucun n'est requis ; en déclarer un épingle uniquement son type, donc tags écrit sous forme de chaîne séparée par des virgules est signalé."
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr "Le shell de cette session n'a jamais démarré."
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "Le dossier propre à la compétence — la source depuis laquelle les autres emplacements copient ou pointent"
@@ -13803,6 +13807,22 @@ msgstr "Les lignes terminal et bureau de {label} partagent une même configurati
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr "Les lignes terminal et bureau de {label} partagent une même configuration, donc la supprimer les déconnecte toutes les deux."
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr "Le service d'arrière-plan du terminal n'est pas en cours d'exécution."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr "Le service d'arrière-plan du terminal s'est arrêté avant que le shell puisse démarrer."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr "Le terminal ne peut pas exécuter cette commande dans le shell configuré."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr "Le terminal n'a pas pu démarrer."
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr "Le terminal est désactivé pour ce projet. Réactivez-le pour exécuter des commandes ici."
@@ -14379,6 +14399,10 @@ msgstr "Cette source regroupe plusieurs compétences — choisissez celle à imp
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr "Ce modèle réside dans un dossier parent — le supprimer affecte tous les dossiers situés en dessous qui ne définissent pas leur propre version."
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr "Cette session de terminal n'est plus disponible."
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr "Ce thème ne peut pas être utilisé tant que le fichier n’est pas corrigé."
@@ -14591,6 +14615,7 @@ msgstr "Essayer une invite"
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr "Réessayer"
diff --git a/packages/app/src/locales/hi/messages.json b/packages/app/src/locales/hi/messages.json
index cc71d52a0..c2b9f6694 100644
--- a/packages/app/src/locales/hi/messages.json
+++ b/packages/app/src/locales/hi/messages.json
@@ -276,6 +276,7 @@
"2wTb8w": ["इसे Plugins के अंतर्गत इसके अपने पेज पर सेट करें।"],
"2wxgft": ["नाम बदलें"],
"2zvUIK": ["इन टिप्पणियों को टिप्पणियाँ पैनल में दिखाएँ"],
+ "3-1BY2": ["यह टर्मिनल सत्र अब उपलब्ध नहीं है।"],
"322lyb": ["सुझाव, चेतावनियाँ और नोट उभारें।"],
"32TTpa": ["इस रिपोर्ट के बारे में सहायता को ईमेल करें"],
"34qyH5": ["सर्वर तक नहीं पहुँचा जा सका"],
@@ -647,6 +648,7 @@
"7Voget": [["name"], " चुनें"],
"7WnfoD": ["यह रिपोर्ट पहले ही रास्ते में है। इसका नतीजा बग रिपोर्ट इतिहास में दिखेगा।"],
"7Y9yTo": [["owner"], "/", ["name"], " बन गया, लेकिन पुश विफल रहा।"],
+ "7YJr6i": ["इस सत्र का शेल कभी शुरू नहीं हुआ।"],
"7YRrJ9": [
"OpenKnowledge डेस्कटॉप ऐप में उपलब्ध। टर्मिनल से <0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2> का उपयोग करें।"
],
@@ -1174,6 +1176,7 @@
"ENpRJV": ["बाहरी लिंक पूर्वावलोकन"],
"EO4Dt1": [["file"], " सक्षम करें"],
"EOjU5V": ["इनलाइन गणित प्रॉपर्टी"],
+ "EP-R3L": ["टर्मिनल शुरू नहीं हो सका।"],
"EP8mZC": ["एक्सपोज़ करें और पुनः प्रारंभ करें"],
"EPGePE": ["\"", ["0"], "\" के रूप में अपलोड किया गया — नाम \"", ["1"], "\" पहले से लिया जा चुका था।"],
"EPKVES": ["अपने संपादनों के ऊपर \"", ["skillName"], "\" अपडेट करें?"],
@@ -1892,6 +1895,7 @@
"NRSLBe": [["diffMin"], " मिनट पहले"],
"NSnIUP": ["दो पेज (सम)"],
"NUr4kz": ["इस फ़ोल्डर में नए दस्तावेज़ों के लिए एक पुन: उपयोग योग्य शुरुआती बिंदु।"],
+ "NVghPF": ["टर्मिनल कॉन्फ़िगर किए गए शेल में यह कमांड नहीं चला सकता।"],
"NY0p7s": ["Open Knowledge टूल सक्षम करना छोड़ दिया गया। यह थ्रेड उनके बिना चलता है।"],
"NYUhy5": ["उप-फ़ोल्डर का नाम"],
"NYn1cR": ["संपादक लोड हो रहा है"],
@@ -3408,6 +3412,7 @@
" सत्र में खोलेंगे तो यह अपने आप जुड़ जाएगा।"
],
"fqSfXY": ["बदलें"],
+ "frREUl": ["शेल शुरू होने से पहले ही टर्मिनल की बैकग्राउंड सेवा रुक गई।"],
"ft-BOm": ["बग की रिपोर्ट करें…"],
"fuJZKk": ["ब्रांच खोजें"],
"fvrHin": ["इस मशीन के हर प्रोजेक्ट में उपलब्ध। git के ज़रिए साझा नहीं।"],
@@ -4222,6 +4227,7 @@
"oCZkaG": ["पथ कॉपी करें"],
"oJl7eO": ["अज्ञात कंपोनेंट: ", ["componentName"], " — स्रोत नीचे संपादन योग्य"],
"oKBnk5": ["और अनुरोध रोके गए।"],
+ "oLyLo6": ["टर्मिनल की बैकग्राउंड सेवा नहीं चल रही है।"],
"oP-FQW": ["स्किल के भीतर सापेक्ष पथ का उपयोग करें"],
"oPU_4D": ["एजेंट के खाली होने पर भेजें"],
"oQA-cA": ["पूरा पथ"],
diff --git a/packages/app/src/locales/hi/messages.po b/packages/app/src/locales/hi/messages.po
index 839389d78..9596652b2 100644
--- a/packages/app/src/locales/hi/messages.po
+++ b/packages/app/src/locales/hi/messages.po
@@ -13771,6 +13771,10 @@ msgstr "सर्वर बिना किसी बिल्ट-इन प्
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr "जब आप title, description, resource, और tags का उपयोग करते हैं तो उनकी आकृतियाँ। किसी की भी आवश्यकता नहीं है; किसी को घोषित करने से केवल उसके प्रकार का पता चलता है, इसलिए अल्पविराम से अलग की गई स्ट्रिंग के रूप में लिखे गए tags को चिह्नित किया जाता है।"
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr "इस सत्र का शेल कभी शुरू नहीं हुआ।"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "स्किल का अपना फ़ोल्डर — वह स्रोत जिससे बाकी स्थान प्रति बनाते या लिंक करते हैं"
@@ -13799,6 +13803,22 @@ msgstr "{label} की टर्मिनल और डेस्कटॉप प
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr "{label} की टर्मिनल और डेस्कटॉप पंक्तियाँ एक ही सेटअप साझा करती हैं, इसलिए इसे हटाने पर दोनों का कनेक्शन टूट जाएगा।"
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr "टर्मिनल की बैकग्राउंड सेवा नहीं चल रही है।"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr "शेल शुरू होने से पहले ही टर्मिनल की बैकग्राउंड सेवा रुक गई।"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr "टर्मिनल कॉन्फ़िगर किए गए शेल में यह कमांड नहीं चला सकता।"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr "टर्मिनल शुरू नहीं हो सका।"
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr "इस प्रोजेक्ट के लिए टर्मिनल बंद है। यहाँ कमांड चलाने के लिए इसे वापस चालू करें।"
@@ -14375,6 +14395,10 @@ msgstr "इस स्रोत में कई स्किल हैं —
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr "यह टेम्पलेट किसी मूल फ़ोल्डर में रहता है — इसे हटाने पर उसके नीचे का हर वह फ़ोल्डर प्रभावित होता है जो अपना संस्करण तय नहीं करता।"
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr "यह टर्मिनल सत्र अब उपलब्ध नहीं है।"
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr "फ़ाइल ठीक होने तक इस थीम का उपयोग नहीं किया जा सकता।"
@@ -14587,6 +14611,7 @@ msgstr "कोई प्रॉम्प्ट आज़माएँ"
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr "फिर कोशिश करें"
diff --git a/packages/app/src/locales/id/messages.json b/packages/app/src/locales/id/messages.json
index 1b0f6b703..b9c11223e 100644
--- a/packages/app/src/locales/id/messages.json
+++ b/packages/app/src/locales/id/messages.json
@@ -279,6 +279,7 @@
"2wTb8w": ["Siapkan di halamannya sendiri di bawah Plugin."],
"2wxgft": ["Ganti nama"],
"2zvUIK": ["Tampilkan komentar ini di panel komentar"],
+ "3-1BY2": ["Sesi terminal ini sudah tidak tersedia."],
"322lyb": ["Menyoroti tip, peringatan, dan catatan."],
"32TTpa": ["Kirim surel ke dukungan tentang laporan ini"],
"34qyH5": ["Server tidak dapat dihubungi"],
@@ -668,6 +669,7 @@
"7Voget": ["Pilih ", ["name"]],
"7WnfoD": ["Laporan ini sudah dalam perjalanan. Hasilnya akan muncul di riwayat laporan bug."],
"7Y9yTo": [["owner"], "/", ["name"], " dibuat, tetapi push gagal."],
+ "7YJr6i": ["Shell untuk sesi ini tidak pernah dimulai."],
"7YRrJ9": [
"Tersedia di aplikasi desktop OpenKnowledge. Dari terminal, gunakan<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."
],
@@ -1199,6 +1201,7 @@
"ENpRJV": ["Pratinjau tautan eksternal"],
"EO4Dt1": ["Aktifkan ", ["file"]],
"EOjU5V": ["Properti Matematika Sebaris"],
+ "EP-R3L": ["Terminal tidak dapat dimulai."],
"EP8mZC": ["Ekspos dan mulai ulang"],
"EPGePE": ["Diunggah sebagai \"", ["0"], "\" — nama \"", ["1"], "\" sudah dipakai."],
"EPKVES": ["Perbarui \"", ["skillName"], "\" menimpa suntingan Anda?"],
@@ -1962,6 +1965,7 @@
"NRSLBe": [["diffMin"], " mnt lalu"],
"NSnIUP": ["Dua halaman (genap)"],
"NUr4kz": ["Titik awal yang bisa dipakai ulang untuk dokumen baru di folder ini."],
+ "NVghPF": ["Terminal tidak dapat menjalankan perintah ini di shell yang dikonfigurasi."],
"NY0p7s": ["Pengaktifan alat Open Knowledge dilewati. Utas ini berjalan tanpa alat itu."],
"NYUhy5": ["Nama subfolder"],
"NYn1cR": ["Memuat penyunting"],
@@ -3532,6 +3536,7 @@
" tepercaya."
],
"fqSfXY": ["Ganti"],
+ "frREUl": ["Layanan latar belakang terminal berhenti sebelum shell sempat dimulai."],
"ft-BOm": ["Laporkan bug…"],
"fuJZKk": ["Cari cabang"],
"fvrHin": ["Tersedia di setiap proyek pada komputer ini. Tidak dibagikan lewat git."],
@@ -4384,6 +4389,7 @@
"oCZkaG": ["Salin jalur"],
"oJl7eO": ["Komponen tidak dikenal: ", ["componentName"], " — sumber bisa disunting di bawah"],
"oKBnk5": ["Lebih banyak permintaan diblokir."],
+ "oLyLo6": ["Layanan latar belakang terminal tidak berjalan."],
"oP-FQW": ["Gunakan jalur relatif di dalam skill"],
"oPU_4D": ["Kirim saat agen sedang senggang"],
"oQA-cA": ["Jalur lengkap"],
diff --git a/packages/app/src/locales/id/messages.po b/packages/app/src/locales/id/messages.po
index 40c8e3e9f..077854feb 100644
--- a/packages/app/src/locales/id/messages.po
+++ b/packages/app/src/locales/id/messages.po
@@ -13771,6 +13771,10 @@ msgstr "Server akan menerima permintaan untuk {0} tanpa autentikasi bawaan. Siap
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr "Bentuk title, description, resource, dan tags saat Anda menggunakannya. Tidak ada yang diperlukan; mendeklarasikan satu hanya menyematkan tipenya, jadi tags yang ditulis sebagai string yang dipisahkan koma akan ditandai."
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr "Shell untuk sesi ini tidak pernah dimulai."
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "Folder milik keterampilan itu sendiri — sumber tempat lokasi lain menyalin atau menaut"
@@ -13799,6 +13803,22 @@ msgstr "Baris terminal dan desktop untuk {label} berbagi satu pengaturan, jadi p
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr "Baris terminal dan desktop untuk {label} berbagi satu pengaturan, jadi menghapusnya akan memutuskan keduanya."
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr "Layanan latar belakang terminal tidak berjalan."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr "Layanan latar belakang terminal berhenti sebelum shell sempat dimulai."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr "Terminal tidak dapat menjalankan perintah ini di shell yang dikonfigurasi."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr "Terminal tidak dapat dimulai."
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr "Terminal dimatikan untuk proyek ini. Nyalakan lagi untuk menjalankan perintah di sini."
@@ -14375,6 +14395,10 @@ msgstr "Sumber ini memuat beberapa keterampilan — pilih yang akan diimpor."
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr "Templat ini berada di folder induk — menghapusnya memengaruhi setiap folder di bawahnya yang tidak menentukan versinya sendiri."
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr "Sesi terminal ini sudah tidak tersedia."
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr "Tema ini tidak dapat digunakan sampai berkasnya diperbaiki."
@@ -14587,6 +14611,7 @@ msgstr "Coba sebuah prompt"
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr "Coba lagi"
diff --git a/packages/app/src/locales/ko/messages.json b/packages/app/src/locales/ko/messages.json
index d10e470b2..4b662d218 100644
--- a/packages/app/src/locales/ko/messages.json
+++ b/packages/app/src/locales/ko/messages.json
@@ -268,6 +268,7 @@
"2wTb8w": ["플러그인 아래의 자체 페이지에서 설정합니다."],
"2wxgft": ["이름 변경"],
"2zvUIK": ["댓글 패널에서 이 댓글 보기"],
+ "3-1BY2": ["이 터미널 세션은 더 이상 사용할 수 없습니다."],
"322lyb": ["팁, 경고, 노트를 강조합니다."],
"32TTpa": ["이 보고서에 대해 지원팀에 이메일 보내기"],
"34qyH5": ["서버에 연결하지 못했습니다"],
@@ -640,6 +641,7 @@
"7Voget": [["name"], " 선택"],
"7WnfoD": ["이 보고서는 이미 전송 중입니다. 결과는 버그 신고 기록에 표시됩니다."],
"7Y9yTo": [["owner"], "/", ["name"], " 생성 완료. 푸시에 실패했습니다."],
+ "7YJr6i": ["이 세션의 셸이 시작된 적이 없습니다."],
"7YRrJ9": [
"OpenKnowledge 데스크톱 앱에서 사용할 수 있습니다. 터미널에서 <0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>를 사용합니다."
],
@@ -1156,6 +1158,7 @@
"ENpRJV": ["외부 링크 미리보기"],
"EO4Dt1": [["file"], " 활성화"],
"EOjU5V": ["인라인 수식 속성"],
+ "EP-R3L": ["터미널을 시작하지 못했습니다."],
"EP8mZC": ["노출하고 재시작"],
"EPGePE": ["\"", ["0"], "\"으로 업로드했습니다. 이름 \"", ["1"], "\"은 이미 사용 중입니다."],
"EPKVES": ["\"", ["skillName"], "\"을 편집한 내용 위에 업데이트할까요?"],
@@ -1879,6 +1882,7 @@
"NRSLBe": [["diffMin"], "분 전"],
"NSnIUP": ["두 페이지 (짝수)"],
"NUr4kz": ["이 폴더에서 새 문서를 시작할 수 있는 재사용 가능한 출발점입니다."],
+ "NVghPF": ["터미널이 구성된 셸에서 이 명령을 실행할 수 없습니다."],
"NY0p7s": ["Open Knowledge 도구 사용 설정을 건너뛰었습니다. 이 스레드는 도구 없이 실행됩니다."],
"NYUhy5": ["하위 폴더 이름"],
"NYn1cR": ["편집기 불러오는 중"],
@@ -3392,6 +3396,7 @@
" 세션에서 이 프로젝트를 열면 자동으로 연결됩니다."
],
"fqSfXY": ["바꾸기"],
+ "frREUl": ["셸이 시작되기 전에 터미널 백그라운드 서비스가 중지되었습니다."],
"ft-BOm": ["버그 신고…"],
"fuJZKk": ["브랜치 검색"],
"fvrHin": ["이 컴퓨터의 모든 프로젝트에서 사용할 수 있습니다. git으로 공유되지 않습니다."],
@@ -4195,6 +4200,7 @@
"oCZkaG": ["경로 복사"],
"oJl7eO": ["알 수 없는 컴포넌트: ", ["componentName"], ", 아래에서 소스를 편집할 수 있습니다"],
"oKBnk5": ["더 많은 요청이 차단되었습니다."],
+ "oLyLo6": ["터미널 백그라운드 서비스가 실행되고 있지 않습니다."],
"oP-FQW": ["스킬 내부의 상대 경로를 사용하세요"],
"oPU_4D": ["에이전트 유휴 시 전송"],
"oQA-cA": ["전체 경로"],
diff --git a/packages/app/src/locales/ko/messages.po b/packages/app/src/locales/ko/messages.po
index ec3f76dda..77c10a76f 100644
--- a/packages/app/src/locales/ko/messages.po
+++ b/packages/app/src/locales/ko/messages.po
@@ -13775,6 +13775,10 @@ msgstr "서버는 기본 인증 없이 {0}에 대한 요청을 허용합니다.
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr "사용할 때 title, description, resource, tags의 형태를 설정합니다. 모두 필수는 아니며, 하나를 선언하면 유형만 고정됩니다. 쉼표로 구분한 문자열로 작성한 tags는 오류로 표시됩니다."
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr "이 세션의 셸이 시작된 적이 없습니다."
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "스킬 자체의 폴더. 다른 위치가 복사하거나 링크하는 소스입니다"
@@ -13803,6 +13807,22 @@ msgstr "{label}의 터미널 행과 데스크톱 행은 하나의 설정을 공
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr "{label}의 터미널 행과 데스크톱 행은 하나의 설정을 공유하므로, 이를 제거하면 둘 다 연결이 끊깁니다."
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr "터미널 백그라운드 서비스가 실행되고 있지 않습니다."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr "셸이 시작되기 전에 터미널 백그라운드 서비스가 중지되었습니다."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr "터미널이 구성된 셸에서 이 명령을 실행할 수 없습니다."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr "터미널을 시작하지 못했습니다."
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr "이 프로젝트의 터미널 꺼짐. 다시 켜면 여기서 명령 실행 가능."
@@ -14379,6 +14399,10 @@ msgstr "이 소스에는 여러 스킬이 들어 있습니다. 가져올 항목
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr "이 템플릿은 상위 폴더에 있습니다. 삭제하면 자체 버전을 정의하지 않은 하위 폴더 모두에 영향을 줍니다."
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr "이 터미널 세션은 더 이상 사용할 수 없습니다."
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr "파일을 수정할 때까지 이 테마를 사용할 수 없습니다."
@@ -14591,6 +14615,7 @@ msgstr "프롬프트 사용"
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr "다시 시도"
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index 13cec855a..39f19b84d 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -279,6 +279,7 @@
"2wTb8w": ["Śēţ ĩţ ũƥ ōń ĩţś ōŵń ƥàĝē ũńďēŕ Ƥĺũĝĩńś."],
"2wxgft": ["Ŕēńàḿē"],
"2zvUIK": ["Śĥōŵ ţĥēśē ćōḿḿēńţś ĩń ţĥē Ćōḿḿēńţś ƥàńēĺ"],
+ "3-1BY2": ["Ţĥĩś ţēŕḿĩńàĺ śēśśĩōń ĩś ńō ĺōńĝēŕ àvàĩĺàƀĺē."],
"322lyb": ["Ĥĩĝĥĺĩĝĥţ ţĩƥś, ŵàŕńĩńĝś, àńď ńōţēś."],
"32TTpa": ["Ēḿàĩĺ śũƥƥōŕţ àƀōũţ ţĥĩś ŕēƥōŕţ"],
"34qyH5": ["Ćōũĺď ńōţ ŕēàćĥ śēŕvēŕ"],
@@ -653,6 +654,7 @@
"Ţĥĩś ŕēƥōŕţ ĩś àĺŕēàďŷ ōń ĩţś ŵàŷ. Ĩţś ŕēśũĺţ ŵĩĺĺ àƥƥēàŕ ĩń ŷōũŕ ƀũĝ ŕēƥōŕţ ĥĩśţōŕŷ."
],
"7Y9yTo": ["Ćŕēàţēď ", ["owner"], "/", ["name"], ", ƥũśĥ ƒàĩĺēď."],
+ "7YJr6i": ["Ţĥē śĥēĺĺ ƒōŕ ţĥĩś śēśśĩōń ŵàś ńēvēŕ śţàŕţēď."],
"7YRrJ9": [
"Àvàĩĺàƀĺē ĩń ţĥē ŌƥēńĶńōŵĺēďĝē ďēśķţōƥ àƥƥ. Ƒŕōḿ à ţēŕḿĩńàĺ, ũśē<0> ōķ ćōńƒĩĝ-śĥàŕĩńĝ śţàţũś</0> / <1>śĥàŕē</1> / <2>ũńśĥàŕē</2>."
],
@@ -1196,6 +1198,7 @@
"ENpRJV": ["Ēxţēŕńàĺ ĺĩńķ ƥŕēvĩēŵś"],
"EO4Dt1": ["Ēńàƀĺē ", ["file"]],
"EOjU5V": ["Ĩńĺĩńē Ḿàţĥ Ƥŕōƥēŕţĩēś"],
+ "EP-R3L": ["Ţĥē ţēŕḿĩńàĺ ćōũĺďń'ţ śţàŕţ."],
"EP8mZC": ["Ēxƥōśē àńď ŕēśţàŕţ"],
"EPGePE": ["Ũƥĺōàďēď àś \"", ["0"], "\" — ţĥē ńàḿē \"", ["1"], "\" ŵàś ţàķēń."],
"EPKVES": ["Ũƥďàţē \"", ["skillName"], "\" ōvēŕ ŷōũŕ ēďĩţś?"],
@@ -1947,6 +1950,7 @@
"NRSLBe": [["diffMin"], "ḿ àĝō"],
"NSnIUP": ["Ţŵō-ƥàĝē (ēvēń)"],
"NUr4kz": ["À ŕēũśàƀĺē śţàŕţĩńĝ ƥōĩńţ ƒōŕ ńēŵ ďōćũḿēńţś ĩń ţĥĩś ƒōĺďēŕ."],
+ "NVghPF": ["Ţĥē ţēŕḿĩńàĺ ćàń'ţ ŕũń ţĥĩś ćōḿḿàńď ĩń ţĥē ćōńƒĩĝũŕēď śĥēĺĺ."],
"NY0p7s": ["Śķĩƥƥēď ēńàƀĺĩńĝ Ōƥēń Ķńōŵĺēďĝē ţōōĺś. Ţĥĩś ţĥŕēàď ŕũńś ŵĩţĥōũţ ţĥēḿ."],
"NYUhy5": ["Śũƀƒōĺďēŕ ńàḿē"],
"NYn1cR": ["Ĺōàďĩńĝ ēďĩţōŕ"],
@@ -3510,6 +3514,7 @@
" śēśśĩōń."
],
"fqSfXY": ["Ŕēƥĺàćē"],
+ "frREUl": ["Ţĥē ţēŕḿĩńàĺ ƀàćķĝŕōũńď śēŕvĩćē śţōƥƥēď ƀēƒōŕē ţĥē śĥēĺĺ ćōũĺď śţàŕţ."],
"ft-BOm": ["Ŕēƥōŕţ à ƀũĝ…"],
"fuJZKk": ["Śēàŕćĥ ƀŕàńćĥēś"],
"fvrHin": ["Àvàĩĺàƀĺē ĩń ēvēŕŷ ƥŕōĴēćţ ōń ţĥĩś ḿàćĥĩńē. Ńōţ śĥàŕēď ţĥŕōũĝĥ ĝĩţ."],
@@ -4359,6 +4364,7 @@
"oCZkaG": ["Ćōƥŷ ƥàţĥ"],
"oJl7eO": ["Ũńķńōŵń ćōḿƥōńēńţ: ", ["componentName"], " — śōũŕćē ēďĩţàƀĺē ƀēĺōŵ"],
"oKBnk5": ["Ḿōŕē ŕēǫũēśţś ŵēŕē ƀĺōćķēď."],
+ "oLyLo6": ["Ţĥē ţēŕḿĩńàĺ ƀàćķĝŕōũńď śēŕvĩćē ĩśń'ţ ŕũńńĩńĝ."],
"oP-FQW": ["Ũśē à ŕēĺàţĩvē ƥàţĥ ĩńśĩďē ţĥē śķĩĺĺ"],
"oPU_4D": ["Śēńď ŵĥēń ţĥē àĝēńţ ĩś ƒŕēē"],
"oQA-cA": ["Ƒũĺĺ ƥàţĥ"],
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index 91fb73323..e0fa206b3 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -13771,6 +13771,10 @@ msgstr ""
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr ""
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr ""
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr ""
@@ -13799,6 +13803,22 @@ msgstr ""
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr ""
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr ""
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr ""
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr ""
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr ""
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr ""
@@ -14375,6 +14395,10 @@ msgstr ""
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr ""
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr ""
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr ""
@@ -14587,6 +14611,7 @@ msgstr ""
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr ""
diff --git a/packages/app/src/locales/pt-BR/messages.json b/packages/app/src/locales/pt-BR/messages.json
index 7264a890c..e9158623f 100644
--- a/packages/app/src/locales/pt-BR/messages.json
+++ b/packages/app/src/locales/pt-BR/messages.json
@@ -319,6 +319,7 @@
"2wTb8w": ["Configure na página própria dele, em Plugins."],
"2wxgft": ["Renomear"],
"2zvUIK": ["Mostrar estes comentários no painel de comentários"],
+ "3-1BY2": ["Esta sessão de terminal não está mais disponível."],
"322lyb": ["Destaca dicas, avisos e notas."],
"32TTpa": ["Escrever para o suporte sobre este relatório"],
"34qyH5": ["Não foi possível contatar o servidor"],
@@ -785,6 +786,7 @@
"Este relatório já está a caminho. O resultado vai aparecer no histórico de relatórios de erro."
],
"7Y9yTo": [["owner"], "/", ["name"], " foi criado, mas o envio falhou."],
+ "7YJr6i": ["O shell desta sessão nunca foi iniciado."],
"7YRrJ9": [
"Disponível no app de desktop do OpenKnowledge. Em um terminal, use<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."
],
@@ -1393,6 +1395,7 @@
"ENpRJV": ["Pré-visualização de links externos"],
"EO4Dt1": ["Ativar ", ["file"]],
"EOjU5V": ["Propriedades da fórmula em linha"],
+ "EP-R3L": ["O terminal não pôde iniciar."],
"EP8mZC": ["Expor e reiniciar"],
"EPGePE": ["Enviado como \"", ["0"], "\" — o nome \"", ["1"], "\" já estava em uso."],
"EPKVES": ["Atualizar \"", ["skillName"], "\" por cima das suas edições?"],
@@ -2245,6 +2248,7 @@
"NRSLBe": ["há ", ["diffMin"], " min"],
"NSnIUP": ["Duas páginas (pares)"],
"NUr4kz": ["Um ponto de partida reutilizável para novos documentos nesta pasta."],
+ "NVghPF": ["O terminal não pode executar este comando no shell configurado."],
"NY0p7s": [
"A ativação das ferramentas do Open Knowledge foi ignorada. Esta conversa funciona sem elas."
],
@@ -4029,6 +4033,7 @@
"."
],
"fqSfXY": ["Substituir"],
+ "frREUl": ["O serviço em segundo plano do terminal parou antes que o shell pudesse iniciar."],
"ft-BOm": ["Relatar um erro…"],
"fuJZKk": ["Buscar ramos"],
"fvrHin": ["Disponível em todos os projetos deste computador. Não é compartilhado por git."],
@@ -4946,6 +4951,7 @@
"oCZkaG": ["Copiar caminho"],
"oJl7eO": ["Componente desconhecido: ", ["componentName"], " — código editável abaixo"],
"oKBnk5": ["Mais requisições foram bloqueadas."],
+ "oLyLo6": ["O serviço em segundo plano do terminal não está em execução."],
"oP-FQW": ["Use um caminho relativo dentro da habilidade"],
"oPU_4D": ["Enviar quando o agente estiver livre"],
"oQA-cA": ["Caminho completo"],
diff --git a/packages/app/src/locales/pt-BR/messages.po b/packages/app/src/locales/pt-BR/messages.po
index b46ceb1b1..8429cbf50 100644
--- a/packages/app/src/locales/pt-BR/messages.po
+++ b/packages/app/src/locales/pt-BR/messages.po
@@ -13771,6 +13771,10 @@ msgstr "O servidor aceitará solicitações para {0} sem autenticação integrad
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr "As formas de title, description, resource e tags quando você as usa. Nenhum é obrigatório; declarar um apenas fixa seu tipo, então tags escrito como uma string separada por vírgula é sinalizado."
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr "O shell desta sessão nunca foi iniciado."
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "A pasta própria da habilidade — a fonte de onde os outros locais copiam ou para onde apontam"
@@ -13799,6 +13803,22 @@ msgstr "As linhas de terminal e desktop de {label} compartilham uma mesma config
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr "As linhas de terminal e desktop de {label} compartilham uma mesma configuração, então removê-la desconecta as duas."
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr "O serviço em segundo plano do terminal não está em execução."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr "O serviço em segundo plano do terminal parou antes que o shell pudesse iniciar."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr "O terminal não pode executar este comando no shell configurado."
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr "O terminal não pôde iniciar."
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr "O terminal está desligado neste projeto. Ligue de novo para rodar comandos aqui."
@@ -14375,6 +14395,10 @@ msgstr "Esta fonte traz várias habilidades — escolha qual importar."
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr "Este modelo fica em uma pasta acima — excluí-lo afeta todas as pastas abaixo dela que não definem a própria versão."
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr "Esta sessão de terminal não está mais disponível."
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr "Este tema não pode ser usado até que o arquivo seja corrigido."
@@ -14587,6 +14611,7 @@ msgstr "Experimente um prompt"
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr "Tente de novo"
diff --git a/packages/app/src/locales/ur/messages.json b/packages/app/src/locales/ur/messages.json
index b7ffd63cf..01c0b8e59 100644
--- a/packages/app/src/locales/ur/messages.json
+++ b/packages/app/src/locales/ur/messages.json
@@ -278,6 +278,7 @@
"2wTb8w": ["اسے پلگ اِنز کے تحت اس کے اپنے صفحے پر ترتیب دیں۔"],
"2wxgft": ["نام بدلیں"],
"2zvUIK": ["ان تبصروں کو تبصرے پینل میں دکھائیں"],
+ "3-1BY2": ["یہ ٹرمینل سیشن اب دستیاب نہیں ہے۔"],
"322lyb": ["مشورے، انتباہات اور نوٹس نمایاں کریں۔"],
"32TTpa": ["اس رپورٹ کے بارے میں سپورٹ کو ای میل کریں"],
"34qyH5": ["سرور تک رسائی نہیں ہو سکی"],
@@ -671,6 +672,7 @@
"7Voget": [["name"], " منتخب کریں"],
"7WnfoD": ["یہ رپورٹ پہلے ہی راستے میں ہے۔ اس کا نتیجہ بگ رپورٹ کی تاریخ میں نظر آئے گا۔"],
"7Y9yTo": [["owner"], "/", ["name"], " بن گیا، لیکن پش ناکام رہا۔"],
+ "7YJr6i": ["اس سیشن کا شیل کبھی شروع نہیں ہوا۔"],
"7YRrJ9": [
"OpenKnowledge ڈیسک ٹاپ ایپ میں دستیاب۔ ٹرمینل سے<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2> استعمال کریں۔"
],
@@ -1216,6 +1218,7 @@
"ENpRJV": ["بیرونی لنکس کے پیش منظر"],
"EO4Dt1": [["file"], " فعال کریں"],
"EOjU5V": ["اِن لائن ریاضی کی خصوصیات"],
+ "EP-R3L": ["ٹرمینل شروع نہیں ہو سکا۔"],
"EP8mZC": ["ایکسپوز کریں اور دوبارہ شروع کریں"],
"EPGePE": ["«", ["0"], "» کے نام سے اپ لوڈ ہوا — نام «", ["1"], "» پہلے سے لیا ہوا تھا۔"],
"EPKVES": ["کیا «", ["skillName"], "» کو آپ کی ترامیم پر اپ ڈیٹ کر دیا جائے؟"],
@@ -1988,6 +1991,7 @@
"NRSLBe": [["diffMin"], " منٹ پہلے"],
"NSnIUP": ["دو صفحے (جفت)"],
"NUr4kz": ["اس فولڈر میں نئی دستاویزات کے لیے دوبارہ استعمال ہونے والا نقطۂ آغاز۔"],
+ "NVghPF": ["ٹرمینل ترتیب دیے گئے شیل میں یہ کمانڈ نہیں چلا سکتا۔"],
"NY0p7s": ["Open Knowledge ٹولز فعال کرنا چھوڑ دیا گیا۔ یہ تھریڈ ان کے بغیر چلے گا۔"],
"NYUhy5": ["ذیلی فولڈر کا نام"],
"NYn1cR": ["ایڈیٹر لوڈ ہو رہا ہے"],
@@ -3597,6 +3601,7 @@
" سیشن میں کھولیں گے تو یہ خودکار طور پر منسلک ہو جائے گا۔"
],
"fqSfXY": ["تبدیل کریں"],
+ "frREUl": ["شیل شروع ہونے سے پہلے ہی ٹرمینل کی بیک گراؤنڈ سروس رک گئی۔"],
"ft-BOm": ["بگ رپورٹ کریں…"],
"fuJZKk": ["برانچیں تلاش کریں"],
"fvrHin": ["اس مشین کے ہر پروجیکٹ میں دستیاب۔ git کے ذریعے شیئر نہیں ہوتا۔"],
@@ -4458,6 +4463,7 @@
"oCZkaG": ["راستہ نقل کریں"],
"oJl7eO": ["نامعلوم جزو: ", ["componentName"], " — سورس نیچے قابلِ ترمیم ہے"],
"oKBnk5": ["مزید درخواستیں روکی گئیں۔"],
+ "oLyLo6": ["ٹرمینل کی بیک گراؤنڈ سروس نہیں چل رہی۔"],
"oP-FQW": ["اسکل کے اندر نسبتی پاتھ استعمال کریں"],
"oPU_4D": ["ایجنٹ فارغ ہونے پر بھیجیں"],
"oQA-cA": ["مکمل راستہ"],
diff --git a/packages/app/src/locales/ur/messages.po b/packages/app/src/locales/ur/messages.po
index 2db97a362..d35eb16c9 100644
--- a/packages/app/src/locales/ur/messages.po
+++ b/packages/app/src/locales/ur/messages.po
@@ -13775,6 +13775,10 @@ msgstr "سرور بغیر کسی بلٹ اِن تصدیق کے {0} کے لیے
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr "title، description، resource، اور tags کی شکلیں جب آپ انہیں استعمال کرتے ہیں۔ کسی کی ضرورت نہیں ہے؛ صرف ایک کا اعلان کرنا اس کی قسم کو پن کرتا ہے، لہذا tags کوما سے الگ کردہ سٹرنگ کے طور پر لکھا جاتا ہے۔"
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr "اس سیشن کا شیل کبھی شروع نہیں ہوا۔"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "مہارت کا اپنا فولڈر — وہ ماخذ جس سے دیگر مقامات نقل کرتے یا جڑتے ہیں"
@@ -13803,6 +13807,22 @@ msgstr "{label} کی ٹرمینل اور ڈیسک ٹاپ قطاریں ایک ہ
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr "{label} کی ٹرمینل اور ڈیسک ٹاپ قطاریں ایک ہی ترتیب استعمال کرتی ہیں، اس لیے اسے ہٹانے سے دونوں کا رابطہ منقطع ہو جائے گا۔"
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr "ٹرمینل کی بیک گراؤنڈ سروس نہیں چل رہی۔"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr "شیل شروع ہونے سے پہلے ہی ٹرمینل کی بیک گراؤنڈ سروس رک گئی۔"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr "ٹرمینل ترتیب دیے گئے شیل میں یہ کمانڈ نہیں چلا سکتا۔"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr "ٹرمینل شروع نہیں ہو سکا۔"
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr "اس پروجیکٹ کے لیے ٹرمینل بند ہے۔ یہاں کمانڈز چلانے کے لیے اسے دوبارہ فعال کریں۔"
@@ -14379,6 +14399,10 @@ msgstr "یہ ماخذ کئی مہارتیں سمیٹے ہوئے ہے — درآ
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr "یہ ٹیمپلیٹ کسی والد فولڈر میں رہتا ہے — اسے حذف کرنا اس کے نیچے کے ہر اُس فولڈر پر اثر ڈالتا ہے جو اپنا ورژن متعین نہیں کرتا۔"
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr "یہ ٹرمینل سیشن اب دستیاب نہیں ہے۔"
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr "فائل درست کیے جانے تک یہ تھیم استعمال نہیں کی جا سکتی۔"
@@ -14591,6 +14615,7 @@ msgstr "کوئی پرامپٹ آزمائیں"
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr "دوبارہ کوشش کریں"
diff --git a/packages/app/src/locales/zh-Hans/messages.json b/packages/app/src/locales/zh-Hans/messages.json
index 199dff6a1..5605df857 100644
--- a/packages/app/src/locales/zh-Hans/messages.json
+++ b/packages/app/src/locales/zh-Hans/messages.json
@@ -248,6 +248,7 @@
"2wTb8w": ["在「插件」下它自己的页面中进行设置。"],
"2wxgft": ["重命名"],
"2zvUIK": ["在评论面板中显示这些评论"],
+ "3-1BY2": ["该终端会话已不可用。"],
"322lyb": ["突出显示提示、警告和备注。"],
"32TTpa": ["就此报告发送邮件给支持团队"],
"34qyH5": ["无法连接到服务器"],
@@ -582,6 +583,7 @@
"7Voget": ["选择 ", ["name"]],
"7WnfoD": ["该报告已经在发送途中,结果会显示在错误报告历史里。"],
"7Y9yTo": ["已创建 ", ["owner"], "/", ["name"], ",但推送失败。"],
+ "7YJr6i": ["此会话的 shell 从未启动。"],
"7YRrJ9": [
"在 OpenKnowledge 桌面应用中可用。在终端里可使用<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>。"
],
@@ -1053,6 +1055,7 @@
"ENpRJV": ["外部链接预览"],
"EO4Dt1": ["启用 ", ["file"]],
"EOjU5V": ["行内公式属性"],
+ "EP-R3L": ["终端无法启动。"],
"EP8mZC": ["公开并重启"],
"EPGePE": ["已作为“", ["0"], "”上传——名称“", ["1"], "”已被占用。"],
"EPKVES": ["要用“", ["skillName"], "”覆盖你的编辑进行更新吗?"],
@@ -1696,6 +1699,7 @@
"NRSLBe": [["diffMin"], " 分钟前"],
"NSnIUP": ["双页(偶数)"],
"NUr4kz": ["这个文件夹中新文档可复用的起点。"],
+ "NVghPF": ["终端无法在配置的 shell 中运行此命令。"],
"NY0p7s": ["已跳过启用 Open Knowledge 工具。此线程将在没有这些工具的情况下运行。"],
"NYUhy5": ["子文件夹名"],
"NYn1cR": ["正在加载编辑器"],
@@ -3068,6 +3072,7 @@
],
"followup.trust-gated": ["下次你在受信任的 ", ["agent"], " 会话中打开这个项目时会自动连接。"],
"fqSfXY": ["替换"],
+ "frREUl": ["终端后台服务在 shell 启动前就已停止。"],
"ft-BOm": ["报告问题…"],
"fuJZKk": ["搜索分支"],
"fvrHin": ["在这台电脑的每个项目中都可用。不通过 git 共享。"],
@@ -3802,6 +3807,7 @@
"oCZkaG": ["复制路径"],
"oJl7eO": ["未知组件:", ["componentName"], "——可在下方编辑源码"],
"oKBnk5": ["还有更多请求被拦截。"],
+ "oLyLo6": ["终端后台服务未在运行。"],
"oP-FQW": ["使用技能内部的相对路径"],
"oPU_4D": ["在智能体空闲时发送"],
"oQA-cA": ["完整路径"],
diff --git a/packages/app/src/locales/zh-Hans/messages.po b/packages/app/src/locales/zh-Hans/messages.po
index 8193b47b9..19be3ab72 100644
--- a/packages/app/src/locales/zh-Hans/messages.po
+++ b/packages/app/src/locales/zh-Hans/messages.po
@@ -13775,6 +13775,10 @@ msgstr "服务器将在没有内置身份验证的情况下接受对 {0} 的请
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr "使用 title、description、resource 和 tags 时的形状。不需要;声明一个仅固定其类型,因此标记为以逗号分隔的字符串形式编写的 tags 。"
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr "此会话的 shell 从未启动。"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "技能自己的文件夹——其他位置从这里复制或链接"
@@ -13803,6 +13807,22 @@ msgstr "{label} 的终端行和桌面行共用同一套设置,因此这里的
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr "{label} 的终端行和桌面行共用同一套设置,因此移除它会同时断开两者。"
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr "终端后台服务未在运行。"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr "终端后台服务在 shell 启动前就已停止。"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr "终端无法在配置的 shell 中运行此命令。"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr "终端无法启动。"
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr "这个项目关闭了终端。重新开启后才能在这里运行命令。"
@@ -14379,6 +14399,10 @@ msgstr "这个来源包含多个技能——请选择要导入的那一个。"
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr "这个模板位于上级文件夹中——删除它会影响下面所有没有定义自己版本的文件夹。"
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr "该终端会话已不可用。"
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr "修复文件后才能使用此主题。"
@@ -14591,6 +14615,7 @@ msgstr "试试一段提示词"
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr "重试"
diff --git a/packages/app/src/locales/zh-Hant/messages.json b/packages/app/src/locales/zh-Hant/messages.json
index 503c25ecb..a1d05299b 100644
--- a/packages/app/src/locales/zh-Hant/messages.json
+++ b/packages/app/src/locales/zh-Hant/messages.json
@@ -252,6 +252,7 @@
"2wTb8w": ["在「外掛」底下它自己的頁面中設定。"],
"2wxgft": ["重新命名"],
"2zvUIK": ["在註解面板中顯示這些註解"],
+ "3-1BY2": ["此終端機工作階段已無法使用。"],
"322lyb": ["凸顯提示、警告和備註。"],
"32TTpa": ["就此回報寄郵件給支援團隊"],
"34qyH5": ["無法連上伺服器"],
@@ -584,6 +585,7 @@
"7Voget": ["選取 ", ["name"]],
"7WnfoD": ["這份回報已經在傳送途中,結果會顯示在錯誤回報記錄裡。"],
"7Y9yTo": ["已建立 ", ["owner"], "/", ["name"], ",但推送失敗。"],
+ "7YJr6i": ["此工作階段的 shell 從未啟動。"],
"7YRrJ9": [
"在 OpenKnowledge 桌面應用程式中提供。在終端機裡可以使用<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>。"
],
@@ -1059,6 +1061,7 @@
"ENpRJV": ["外部連結預覽"],
"EO4Dt1": ["啟用 ", ["file"]],
"EOjU5V": ["行內公式屬性"],
+ "EP-R3L": ["終端機無法啟動。"],
"EP8mZC": ["公開並重新啟動"],
"EPGePE": ["已用「", ["0"], "」這個名稱上傳——名稱「", ["1"], "」已被占用。"],
"EPKVES": ["要用「", ["skillName"], "」覆蓋你的編輯來更新嗎?"],
@@ -1716,6 +1719,7 @@
"NRSLBe": [["diffMin"], " 分鐘前"],
"NSnIUP": ["雙頁(偶數)"],
"NUr4kz": ["這個資料夾中新文件可重複使用的起點。"],
+ "NVghPF": ["終端機無法在設定的 shell 中執行此命令。"],
"NY0p7s": ["已略過啟用 Open Knowledge 工具。此執行緒將在沒有這些工具的情況下運作。"],
"NYUhy5": ["子資料夾名稱"],
"NYn1cR": ["正在載入編輯器"],
@@ -3096,6 +3100,7 @@
" 工作階段中開啟這個專案時會自動連接。"
],
"fqSfXY": ["取代"],
+ "frREUl": ["終端機背景服務在 shell 啟動前就已停止。"],
"ft-BOm": ["回報問題…"],
"fuJZKk": ["搜尋分支"],
"fvrHin": ["在這台電腦的每個專案中都可以使用。不會透過 git 分享。"],
@@ -3832,6 +3837,7 @@
"oCZkaG": ["複製路徑"],
"oJl7eO": ["未知的元件:", ["componentName"], "——可在下方編輯原始碼"],
"oKBnk5": ["還有更多要求被攔截。"],
+ "oLyLo6": ["終端機背景服務未在執行。"],
"oP-FQW": ["使用技能內部的相對路徑"],
"oPU_4D": ["在智慧體空閒時傳送"],
"oQA-cA": ["完整路徑"],
diff --git a/packages/app/src/locales/zh-Hant/messages.po b/packages/app/src/locales/zh-Hant/messages.po
index f31dba01f..68c653eed 100644
--- a/packages/app/src/locales/zh-Hant/messages.po
+++ b/packages/app/src/locales/zh-Hant/messages.po
@@ -13775,6 +13775,10 @@ msgstr "伺服器將在沒有內建驗證的情況下接受對 {0} 的請求。
msgid "The shapes of title, description, resource, and tags when you use them. None are required; declaring one only pins its type, so tags written as a comma-separated string is flagged."
msgstr "使用 title、description、resource 和 tags 時的形狀。不需要;聲明一個僅固定其類型,因此標記為以逗號分隔的字串形式編寫的 tags 。"
+#: src/components/TerminalExitNotice.tsx
+msgid "The shell for this session was never started."
+msgstr "此工作階段的 shell 從未啟動。"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "技能自己的資料夾——其他位置從這裡複製或連結"
@@ -13803,6 +13807,22 @@ msgstr "{label} 的終端行與桌面行共用同一套設定,因此這裡的
msgid "The terminal and desktop rows for {label} share one setup, so removing it disconnects both."
msgstr "{label} 的終端行與桌面行共用同一套設定,因此移除它會同時中斷兩者。"
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service isn't running."
+msgstr "終端機背景服務未在執行。"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal background service stopped before the shell could start."
+msgstr "終端機背景服務在 shell 啟動前就已停止。"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal can't run this command in the configured shell."
+msgstr "終端機無法在設定的 shell 中執行此命令。"
+
+#: src/components/TerminalExitNotice.tsx
+msgid "The terminal couldn't start."
+msgstr "終端機無法啟動。"
+
#: src/components/TerminalGate.tsx
msgid "The terminal is turned off for this project. Turn it back on to run commands here."
msgstr "這個專案關閉了終端機。重新開啟後才能在這裡執行指令。"
@@ -14379,6 +14399,10 @@ msgstr "這個來源包含好幾個技能——請選要匯入的那一個。"
msgid "This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."
msgstr "這個範本放在上層資料夾中——刪掉它會影響底下所有沒有定義自己版本的資料夾。"
+#: src/components/TerminalExitNotice.tsx
+msgid "This terminal session is no longer available."
+msgstr "此終端機工作階段已無法使用。"
+
#: src/components/settings/SavedThemesTiles.tsx
msgid "This theme can’t be used until the file is fixed."
msgstr "修正檔案後才能使用這個主題。"
@@ -14591,6 +14615,7 @@ msgstr "試試一段提示"
#: src/components/settings/SavedThemesTiles.tsx
#: src/components/ShareReceiveDialog.tsx
#: src/components/SlidesToolbarControls.tsx
+#: src/components/TerminalExitNotice.tsx
#: src/editor/components/ExcalidrawEmbed.tsx
msgid "Try again"
msgstr "再試一次"
diff --git a/packages/app/tests/integration/ipc-exhaustiveness-coverage.test.ts b/packages/app/tests/integration/ipc-exhaustiveness-coverage.test.ts
index 1092af9f1..b09d45568 100644
--- a/packages/app/tests/integration/ipc-exhaustiveness-coverage.test.ts
+++ b/packages/app/tests/integration/ipc-exhaustiveness-coverage.test.ts
@@ -34,6 +34,18 @@ const REGISTRY: readonly DuRegistration[] = [
variantLabels: new Set(['invalid-path', 'not-installed', 'timeout', 'spawn-error']),
uniqueLabels: new Set(['spawn-error', 'not-installed']),
},
+ {
+ name: 'OkPtyAdoptReason',
+ helper: 'assertNeverPtyAdoptReason',
+ variantLabels: new Set(['unknown-session', 'not-started', 'not-consented', 'host-unavailable']),
+ uniqueLabels: new Set(['unknown-session', 'not-started', 'host-unavailable']),
+ },
+ {
+ name: 'OkPtyCreateReason',
+ helper: 'assertNeverPtyCreateReason',
+ variantLabels: new Set(['no-project', 'not-consented']),
+ uniqueLabels: new Set(['no-project']),
+ },
];
export const IPC_EXHAUSTIVENESS_OPT_OUT_LIMIT = 2;
diff --git a/packages/app/tests/stress/fixtures/handoff-mocks.ts b/packages/app/tests/stress/fixtures/handoff-mocks.ts
index 5d1fa7bb9..c7447a164 100644
--- a/packages/app/tests/stress/fixtures/handoff-mocks.ts
+++ b/packages/app/tests/stress/fixtures/handoff-mocks.ts
@@ -474,6 +474,7 @@ export async function installHandoffMocks(page: Page, cfg: HandoffMockConfig): P
drain: () => {},
list: async () => [],
adopt: async () => ({ ok: true as const, replay: '' }),
+ start: async () => ({ ok: true as const, replay: '' }),
setMeta: () => {},
setOrder: () => {},
getDockState: async () => ({ terminalVisible: false, agentPanelVisible: false }),
diff --git a/packages/core/src/desktop-bridge.ts b/packages/core/src/desktop-bridge.ts
index f48df8bb6..1f9e94e13 100644
--- a/packages/core/src/desktop-bridge.ts
+++ b/packages/core/src/desktop-bridge.ts
@@ -12,6 +12,7 @@ import type {
TerminalCli,
TerminalLaunchCommand,
WindowsShellFamily,
+ WindowsShellLaunchFailureReason,
} from './handoff/terminal-launch.ts';
import type { HandoffFailureReason, HandoffScope } from './handoff/types.ts';
import type { LanguagePreference } from './i18n/locales.ts';
@@ -851,9 +852,15 @@ export type OkServerRestartOutcome =
| { readonly ok: true }
| { readonly ok: false; readonly reason: 'eperm' | 'other' };
+export type OkPtyCreateReason = 'no-project' | 'not-consented';
+
+export function assertNeverPtyCreateReason(value: never): never {
+ throw new Error(`unhandled pty create reason: ${String(value)}`);
+}
+
export type OkPtyCreateResult =
| { readonly ok: true; readonly ptyId: string }
- | { readonly ok: false; readonly reason: 'no-project' | 'not-consented' };
+ | { readonly ok: false; readonly reason: OkPtyCreateReason };
export interface OkPtyListEntry {
readonly ptyId: string;
@@ -861,6 +868,16 @@ export interface OkPtyListEntry {
readonly ordinal: number | null;
}
+export type OkPtyAdoptReason =
+ | 'unknown-session'
+ | 'not-started'
+ | 'not-consented'
+ | 'host-unavailable';
+
+export function assertNeverPtyAdoptReason(value: never): never {
+ throw new Error(`unhandled pty adopt reason: ${String(value)}`);
+}
+
export type OkPtyAdoptResult =
| {
readonly ok: true;
@@ -868,19 +885,32 @@ export type OkPtyAdoptResult =
readonly shellFamily?: WindowsShellFamily;
readonly shellNoticeReason?: Extract<TerminalShellNoticeReason, 'unsupported-family'>;
}
- | { readonly ok: false; readonly reason: 'unknown-session' };
+ | {
+ readonly ok: false;
+ readonly reason: OkPtyAdoptReason;
+ };
export interface OkPtyData {
readonly ptyId: string;
readonly data: string;
}
-export interface OkPtyExit {
- readonly ptyId: string;
- readonly exitCode: number;
- readonly signal: number | null;
- readonly error?: string;
-}
+export type OkPtyExit =
+ | {
+ readonly ptyId: string;
+ readonly neverStarted: true;
+ readonly error?: string;
+ readonly hostExited?: true;
+ readonly launchFailure?: WindowsShellLaunchFailureReason;
+ }
+ | {
+ readonly ptyId: string;
+ readonly neverStarted?: false;
+ readonly exitCode: number;
+ readonly signal: number | null;
+ readonly error?: string;
+ readonly hostExited?: true;
+ };
const TERMINAL_SHELL_NOTICE_REASON_VOCABULARY = [
'config-unreadable',
@@ -1281,6 +1311,7 @@ export interface OkDesktopBridge {
};
terminal: {
+ // STOP: create only reserves a session; install onData/onExit before start(ptyId) posts the deferred spawn in terminal-manager.ts.
create(opts: {
cols: number;
rows: number;
@@ -1292,7 +1323,8 @@ export interface OkDesktopBridge {
kill(ptyId: string): Promise<void>;
drain(ptyId: string, bytes: number): void;
list(): Promise<OkPtyListEntry[]>;
- adopt(ptyId: string): Promise<OkPtyAdoptResult>;
+ adopt(ptyId: string, opts?: { start?: boolean }): Promise<OkPtyAdoptResult>;
+ start(ptyId: string): Promise<OkPtyAdoptResult>;
setMeta(ptyId: string, meta: { customLabel?: string | null; ordinal?: number }): void;
setOrder(orderedPtyIds: readonly string[]): void;
getDockState(): Promise<OkTerminalDockState>;
diff --git a/packages/core/src/handoff/index.ts b/packages/core/src/handoff/index.ts
index bba4a229e..3419682a7 100644
--- a/packages/core/src/handoff/index.ts
+++ b/packages/core/src/handoff/index.ts
@@ -34,6 +34,7 @@ export {
buildWindowsCliLaunch,
composeWindowsShellLaunchArgs,
isWindowsShellFamily,
+ isWindowsShellLaunchFailureReason,
launchWithoutSupportFile,
OK_GATED_TOOL_NAMES,
psQuoteArg,
@@ -48,6 +49,8 @@ export {
type TerminalLaunchCommand,
WINDOWS_SHELL_FAMILIES,
type WindowsShellFamily,
+ WindowsShellLaunchError,
+ type WindowsShellLaunchFailureReason,
} from './terminal-launch.ts';
export type {
DocContext,
diff --git a/packages/core/src/handoff/terminal-launch.test.ts b/packages/core/src/handoff/terminal-launch.test.ts
index 76dd9e6dc..4a545c808 100644
--- a/packages/core/src/handoff/terminal-launch.test.ts
+++ b/packages/core/src/handoff/terminal-launch.test.ts
@@ -13,6 +13,7 @@ import {
composeWindowsShellLaunchArgs,
encodePowerShellCommand,
isWindowsShellFamily,
+ isWindowsShellLaunchFailureReason,
launchWithoutSupportFile,
OK_GATED_TOOL_NAMES,
psQuoteArg,
@@ -23,6 +24,7 @@ import {
TERMINAL_CLI_IDS,
TERMINAL_CLIS,
WINDOWS_SHELL_FAMILIES,
+ WindowsShellLaunchError,
} from './terminal-launch.ts';
const CLAUDE_PREAPPROVE = `--settings '{"enabledMcpjsonServers":["${MCP_SERVER_NAME}"]}'`;
@@ -178,7 +180,52 @@ describe('Windows launch composition', () => {
executable: 'agent.cmd',
args: ['safe', '" & calc & "'],
}),
- ).toThrow(/unsafe batch argument/);
+ ).toThrow(
+ expect.objectContaining({ name: 'WindowsShellLaunchError', reason: 'unsafe-argument' }),
+ );
+ });
+
+ it('reports every compose refusal as a typed reason rather than a display string', () => {
+ const reasons = [
+ [
+ 'unsupported-shell',
+ () =>
+ composeWindowsShellLaunchArgs('C:\\Tools\\fish.exe', {
+ executable: 'npm',
+ args: [],
+ }),
+ ],
+ [
+ 'invalid-launch',
+ () =>
+ composeWindowsShellLaunchArgs('C:\\Windows\\System32\\cmd.exe', {
+ executable: '',
+ args: [],
+ }),
+ ],
+ [
+ 'unsafe-argument',
+ () =>
+ composeWindowsShellLaunchArgs('C:\\Windows\\System32\\cmd.exe', {
+ executable: 'npm',
+ args: ['a b'],
+ }),
+ ],
+ ] as const;
+ for (const [reason, compose] of reasons) {
+ let caught: unknown = null;
+ try {
+ compose();
+ } catch (error) {
+ caught = error;
+ }
+ expect(caught).toBeInstanceOf(WindowsShellLaunchError);
+ expect((caught as WindowsShellLaunchError).reason).toBe(reason);
+ expect(isWindowsShellLaunchFailureReason((caught as WindowsShellLaunchError).reason)).toBe(
+ true,
+ );
+ }
+ expect(isWindowsShellLaunchFailureReason('unsafe batch argument')).toBe(false);
});
it('base64-transports Git Bash argv across the MSYS parser without interpolation or byte loss', () => {
diff --git a/packages/core/src/handoff/terminal-launch.ts b/packages/core/src/handoff/terminal-launch.ts
index 396c0fa8d..15cb6a541 100644
--- a/packages/core/src/handoff/terminal-launch.ts
+++ b/packages/core/src/handoff/terminal-launch.ts
@@ -83,18 +83,50 @@ function isCmdSafeToken(value: string): boolean {
);
}
+const WINDOWS_SHELL_LAUNCH_FAILURE_VOCABULARY = [
+ 'unsupported-shell',
+ 'invalid-launch',
+ 'unsafe-argument',
+] as const;
+
+export type WindowsShellLaunchFailureReason =
+ (typeof WINDOWS_SHELL_LAUNCH_FAILURE_VOCABULARY)[number];
+
+const WINDOWS_SHELL_LAUNCH_FAILURE_REASONS: ReadonlySet<WindowsShellLaunchFailureReason> = new Set(
+ WINDOWS_SHELL_LAUNCH_FAILURE_VOCABULARY,
+);
+
+export function isWindowsShellLaunchFailureReason(
+ value: unknown,
+): value is WindowsShellLaunchFailureReason {
+ return (
+ typeof value === 'string' &&
+ WINDOWS_SHELL_LAUNCH_FAILURE_REASONS.has(value as WindowsShellLaunchFailureReason)
+ );
+}
+
+export class WindowsShellLaunchError extends Error {
+ readonly reason: WindowsShellLaunchFailureReason;
+
+ constructor(reason: WindowsShellLaunchFailureReason) {
+ super(reason);
+ this.name = 'WindowsShellLaunchError';
+ this.reason = reason;
+ }
+}
+
export function composeWindowsShellLaunchArgs(
shell: string,
launch: TerminalLaunchCommand,
): string[] | string {
const family = resolveWindowsShellFamily(shell);
- if (family === null) throw new Error('unsupported Windows terminal shell');
+ if (family === null) throw new WindowsShellLaunchError('unsupported-shell');
if (
launch.executable.length === 0 ||
launch.executable.includes('\u0000') ||
launch.args.some((arg) => arg.includes('\u0000'))
) {
- throw new Error('invalid Windows terminal launch');
+ throw new WindowsShellLaunchError('invalid-launch');
}
if (family === 'bash') {
return [
@@ -110,7 +142,7 @@ export function composeWindowsShellLaunchArgs(
if (family === 'cmd' || batchTarget) {
const tokens = [launch.executable, ...launch.args];
if (tokens.some((token) => !isCmdSafeToken(token))) {
- throw new Error('unsafe batch argument');
+ throw new WindowsShellLaunchError('unsafe-argument');
}
if (family === 'cmd') return `/K ${tokens.join(' ')}`;
}
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index adcd98757..dd7735a81 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -719,6 +719,7 @@ export {
type IpcChannelReason,
type IpcChannelWithUrn,
isWindowsShellFamily,
+ isWindowsShellLaunchFailureReason,
type LintFixPromptInput,
launchWithoutSupportFile,
lookupUrnInRegistry,
@@ -744,6 +745,8 @@ export {
type UrnIpcLookup,
WINDOWS_SHELL_FAMILIES,
type WindowsShellFamily,
+ WindowsShellLaunchError,
+ type WindowsShellLaunchFailureReason,
withSkillPointer,
} from './handoff/index.ts';
export { asBcp47Tag, type Bcp47Tag, toBcp47Tags } from './i18n/bcp47.ts';
diff --git a/packages/desktop/scripts/smoke-terminal-package-cdp.py b/packages/desktop/scripts/smoke-terminal-package-cdp.py
index 3e76ae1d6..c7b77b3b6 100755
--- a/packages/desktop/scripts/smoke-terminal-package-cdp.py
+++ b/packages/desktop/scripts/smoke-terminal-package-cdp.py
@@ -117,7 +117,6 @@ def evaluate_pty_echo(socket_url: str) -> Dict[str, object]:
let output = '';
let ptyId = null;
let settled = false;
- const pendingData = [];
let unsubscribe = () => {{}};
const finish = async (error) => {{
if (settled) return;
@@ -151,10 +150,6 @@ def evaluate_pty_echo(socket_url: str) -> Dict[str, object]:
20000,
);
unsubscribe = bridge.terminal.onData((message) => {{
- if (ptyId === null) {{
- pendingData.push(message);
- return;
- }}
if (message.ptyId !== ptyId) return;
consume(message.data);
}});
@@ -176,8 +171,10 @@ def evaluate_pty_echo(socket_url: str) -> Dict[str, object]:
return;
}}
ptyId = created.ptyId;
- for (const message of pendingData) {{
- if (message.ptyId === ptyId) consume(message.data);
+ const attached = await bridge.terminal.start(ptyId);
+ if (!attached.ok) {{
+ await finish(new Error(`PTY attach failed: ${{attached.reason}}`));
+ return;
}}
if (!isWindows) bridge.terminal.input(ptyId, `echo ${{marker}}\\r`);
}});
diff --git a/packages/desktop/src/main/index.ts b/packages/desktop/src/main/index.ts
index f6659e275..91d6ac92c 100644
--- a/packages/desktop/src/main/index.ts
+++ b/packages/desktop/src/main/index.ts
@@ -3691,7 +3691,10 @@ function registerIpcHandlers() {
newPtyId: () => randomUUID(),
setTimer: (cb, ms) => setTimeout(cb, ms),
clearTimer: (token) => clearTimeout(token as ReturnType<typeof setTimeout>),
- logger: { warn: (data) => getLogger('terminal').warn(data, 'unexpected pty-host message') },
+ logger: {
+ warn: (data) => getLogger('terminal').warn(data, String(data.event ?? 'terminal-manager')),
+ },
+ canSpawnAt: (projectRoot) => isTerminalConsented(projectRoot),
recordShellExit,
recordTerminalSession,
recordConcurrentSessions,
@@ -3793,11 +3796,21 @@ function registerIpcHandlers() {
});
return { ok: false, reason: 'unknown-session' };
}
- return terminalManager.adoptSession({
+ const outcome = terminalManager.adoptSession({
+ start: req.start,
windowId: win.id,
ptyId: req.ptyId,
webContents: win.webContents,
});
+ if (!outcome.ok) {
+ logIpcError({
+ event: 'ipc.error',
+ channel: 'ok:pty:adopt',
+ reason: outcome.reason,
+ handler: 'adoptPty',
+ });
+ }
+ return outcome;
});
handle('ok:pty:set-meta', async (event, req) => {
const win = BrowserWindow.fromWebContents(event.sender);
diff --git a/packages/desktop/src/main/terminal-manager.ts b/packages/desktop/src/main/terminal-manager.ts
index 3bf1cda3b..2f5e7d3a3 100644
--- a/packages/desktop/src/main/terminal-manager.ts
+++ b/packages/desktop/src/main/terminal-manager.ts
@@ -1,5 +1,6 @@
import {
isWindowsShellFamily,
+ isWindowsShellLaunchFailureReason,
type TerminalLaunchCommand,
type WindowsShellFamily,
} from '@inkeep/open-knowledge-core';
@@ -9,12 +10,18 @@ import {
} from '@inkeep/open-knowledge-core/desktop-bridge';
import type {
OkPtyAdoptResult,
+ OkPtyCreateResult,
+ OkPtyExit,
OkPtyListEntry,
OkPtyNotice,
TerminalShellNoticeReason,
} from '../shared/bridge-contract.ts';
import type { SendableWebContents } from '../shared/ipc-send.ts';
-import type { PtyHostIncomingMessage, PtyHostOutgoingMessage } from '../utility/pty-host.ts';
+import type {
+ PtyCreateMessage,
+ PtyHostIncomingMessage,
+ PtyHostOutgoingMessage,
+} from '../utility/pty-host.ts';
export interface PtyUtilityLike {
postMessage(message: PtyHostIncomingMessage): void;
@@ -28,12 +35,10 @@ type TimerToken = unknown;
export interface TerminalManagerDeps {
forkPtyHost: () => PtyUtilityLike;
sendData: (webContents: SendableWebContents, payload: { ptyId: string; data: string }) => void;
- sendExit: (
- webContents: SendableWebContents,
- payload: { ptyId: string; exitCode: number; signal: number | null; error?: string },
- ) => void;
+ sendExit: (webContents: SendableWebContents, payload: OkPtyExit) => void;
sendNotice?: (webContents: SendableWebContents, payload: OkPtyNotice) => void;
newPtyId: () => string;
+ canSpawnAt: (projectRoot: string) => boolean;
setTimer: (cb: () => void, ms: number) => TimerToken;
clearTimer: (token: TimerToken) => void;
coalesceMs?: number;
@@ -64,19 +69,18 @@ interface TerminalAddressedRequest {
}
interface TerminalAdoptRequest {
+ start?: boolean;
windowId: number;
ptyId: string;
webContents: SendableWebContents;
}
-type CreateResult =
- | { readonly ok: true; readonly ptyId: string }
- | { readonly ok: false; readonly reason: 'no-project' | 'not-consented' };
-
interface SessionState {
+ pendingCreate: PtyCreateMessage | null;
outbound: string;
replay: string;
flushToken: TimerToken | null;
+ staleToken: TimerToken | null;
pendingBytes: number;
paused: boolean;
commandRan: boolean;
@@ -101,6 +105,7 @@ const DEFAULT_HIGH_WATER = 1024 * 1024;
const DEFAULT_LOW_WATER = 256 * 1024;
const DEFAULT_REPLAY_CAP = 256 * 1024;
const DEFAULT_SHUTDOWN_MS = 2000;
+const STALE_RESERVATION_WARN_MS = 30_000;
export const DEFAULT_PTY_COLS = 80;
export const DEFAULT_PTY_ROWS = 24;
@@ -120,7 +125,7 @@ function containsCommandSubmit(data: string): boolean {
}
export interface TerminalManager {
- create(req: TerminalCreateRequest): CreateResult;
+ create(req: TerminalCreateRequest): OkPtyCreateResult;
input(req: TerminalAddressedRequest & { data: string }): void;
resize(req: TerminalAddressedRequest & { cols: number; rows: number }): void;
kill(req: TerminalAddressedRequest): void;
@@ -205,17 +210,9 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
deps.sendData(handle.webContents, { ptyId, data });
}
- function pushExit(
- handle: PtyWindowHandle,
- payload: {
- ptyId: string;
- exitCode: number | undefined;
- signal: number | null;
- error?: string;
- },
- ): void {
+ function pushExit(handle: PtyWindowHandle, payload: OkPtyExit): void {
if (handle.webContents.isDestroyed?.()) return;
- deps.sendExit(handle.webContents, { ...payload, exitCode: payload.exitCode ?? -1 });
+ deps.sendExit(handle.webContents, payload);
}
function pushNotice(handle: PtyWindowHandle, payload: OkPtyNotice): void {
@@ -249,11 +246,15 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
session.flushToken = deps.setTimer(() => flushTick(windowId, ptyId), coalesceMs);
}
- function clearFlush(session: SessionState): void {
+ function clearSessionTimers(session: SessionState): void {
if (session.flushToken !== null) {
deps.clearTimer(session.flushToken);
session.flushToken = null;
}
+ if (session.staleToken !== null) {
+ deps.clearTimer(session.staleToken);
+ session.staleToken = null;
+ }
}
function asHostMessage(raw: unknown): PtyHostOutgoingMessage | null {
@@ -269,7 +270,10 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
? (raw as PtyHostOutgoingMessage)
: null;
case 'spawn-error':
- return typeof m.message === 'string' ? (raw as PtyHostOutgoingMessage) : null;
+ return (typeof m.message === 'string' && m.launchFailure === undefined) ||
+ (m.message === undefined && isWindowsShellLaunchFailureReason(m.launchFailure))
+ ? (raw as PtyHostOutgoingMessage)
+ : null;
case 'shell-notice':
return (m.notice === 'invalid-shell-override' && isTerminalShellNoticeReason(m.reason)) ||
(m.notice === 'shell-resolved' && isWindowsShellFamily(m.shellFamily)) ||
@@ -286,7 +290,27 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
if (!handle) return;
const message = asHostMessage(raw);
if (!message) {
- deps.logger?.warn({ event: 'pty-host-unexpected-message', windowId });
+ const m = typeof raw === 'object' && raw !== null ? (raw as Record<string, unknown>) : null;
+ const rejectedPtyId =
+ typeof m?.ptyId === 'string' && m.ptyId.length > 0 ? m.ptyId : undefined;
+ const rejectedType = typeof m?.type === 'string' ? m.type : undefined;
+ const stranded =
+ rejectedType === 'spawn-error' && rejectedPtyId !== undefined
+ ? handle.sessions.get(rejectedPtyId)
+ : undefined;
+ deps.logger?.warn({
+ event: 'pty-host-unexpected-message',
+ windowId,
+ ...(rejectedPtyId === undefined ? {} : { ptyId: rejectedPtyId }),
+ ...(rejectedType === undefined ? {} : { rawType: rejectedType }),
+ reaped: stranded !== undefined,
+ });
+ if (rejectedPtyId !== undefined && stranded !== undefined) {
+ clearSessionTimers(stranded);
+ handle.sessions.delete(rejectedPtyId);
+ pushExit(handle, { ptyId: rejectedPtyId, neverStarted: true });
+ handle.utility.postMessage({ type: 'kill', ptyId: rejectedPtyId });
+ }
return;
}
const session = handle.sessions.get(message.ptyId);
@@ -303,24 +327,36 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
break;
case 'exit': {
const { ptyId } = message;
- clearFlush(session);
+ clearSessionTimers(session);
deliver(handle, ptyId, session);
maybeRecordSession(session);
handle.sessions.delete(ptyId);
deps.recordShellExit?.({ crashed: false });
pushExit(handle, {
ptyId,
- exitCode: message.exitCode,
+ exitCode: message.exitCode ?? -1,
signal: message.signal,
});
break;
}
case 'spawn-error': {
const { ptyId } = message;
- clearFlush(session);
+ clearSessionTimers(session);
handle.sessions.delete(ptyId);
- deps.recordShellExit?.({ crashed: true });
- pushExit(handle, { ptyId, exitCode: 1, signal: null, error: message.message });
+ deps.logger?.warn({
+ event: 'terminal-manager-spawn-error',
+ windowId,
+ ptyId,
+ ...(message.launchFailure === undefined
+ ? { message: message.message }
+ : { launchFailure: message.launchFailure }),
+ });
+ pushExit(
+ handle,
+ message.launchFailure === undefined
+ ? { ptyId, error: message.message, neverStarted: true }
+ : { ptyId, launchFailure: message.launchFailure, neverStarted: true },
+ );
break;
}
case 'shell-notice':
@@ -355,20 +391,26 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
finishHostShutdown(handle);
if (handles.get(windowId) !== handle) return;
handles.delete(windowId);
+ deps.logger?.warn({
+ event: 'terminal-manager-host-exited',
+ windowId,
+ code,
+ sessions: handle.sessions.size,
+ reserved: [...handle.sessions.values()].filter((s) => s.pendingCreate !== null).length,
+ });
for (const [ptyId, session] of handle.sessions) {
- clearFlush(session);
+ clearSessionTimers(session);
if (session.outbound.length > 0) {
pushData(handle, ptyId, session.outbound);
session.outbound = '';
}
- maybeRecordSession(session);
- deps.recordShellExit?.({ crashed: true });
- pushExit(handle, {
- ptyId,
- exitCode: code ?? 1,
- signal: null,
- error: 'terminal host exited',
- });
+ if (session.pendingCreate !== null) {
+ pushExit(handle, { ptyId, neverStarted: true, hostExited: true });
+ } else {
+ maybeRecordSession(session);
+ deps.recordShellExit?.({ crashed: true });
+ pushExit(handle, { ptyId, exitCode: code ?? 1, signal: null, hostExited: true });
+ }
}
handle.sessions.clear();
}
@@ -401,7 +443,7 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
}
return {
- create(req): CreateResult {
+ create(req): OkPtyCreateResult {
if (req.projectRoot === null) return { ok: false, reason: 'no-project' };
const handle = ensureHandle(req);
const ptyId = deps.newPtyId();
@@ -409,7 +451,19 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
handle.sessions.size === 0
? 0
: Math.max(...[...handle.sessions.values()].map((s) => s.order)) + 1;
- handle.sessions.set(ptyId, {
+ const session: SessionState = {
+ pendingCreate: {
+ type: 'create',
+ ptyId,
+ cwd: req.projectRoot,
+ cols: req.cols,
+ rows: req.rows,
+ ...(req.shell === undefined ? {} : { shell: req.shell }),
+ ...(req.shellInvalidReason === undefined
+ ? {}
+ : { shellInvalidReason: req.shellInvalidReason }),
+ ...(req.launchCommand === undefined ? {} : { launchCommand: req.launchCommand }),
+ },
outbound: '',
replay: '',
flushToken: null,
@@ -421,34 +475,40 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
order: nextOrder,
shellFamily: null,
shellNoticeReason: null,
- });
- deps.recordConcurrentSessions?.({ count: handle.sessions.size });
- handle.utility.postMessage({
- type: 'create',
- ptyId,
- cwd: req.projectRoot,
- cols: req.cols,
- rows: req.rows,
- ...(req.shell === undefined ? {} : { shell: req.shell }),
- ...(req.shellInvalidReason === undefined
- ? {}
- : { shellInvalidReason: req.shellInvalidReason }),
- ...(req.launchCommand === undefined ? {} : { launchCommand: req.launchCommand }),
- });
+ staleToken: null,
+ };
+ session.staleToken = deps.setTimer(() => {
+ const live = handles.get(req.windowId)?.sessions.get(ptyId);
+ if (live === undefined || live.staleToken === null) return;
+ live.staleToken = null;
+ if (live.pendingCreate === null) return;
+ deps.logger?.warn({
+ event: 'terminal-manager-stale-reservation',
+ windowId: req.windowId,
+ ptyId,
+ });
+ }, STALE_RESERVATION_WARN_MS);
+ handle.sessions.set(ptyId, session);
return { ok: true, ptyId };
},
input(req): void {
const handle = handles.get(req.windowId);
const session = handle?.sessions.get(req.ptyId);
- if (!handle || !session) return;
+ if (!handle || !session || session.pendingCreate !== null) return;
if (!session.commandRan && containsCommandSubmit(req.data)) session.commandRan = true;
handle.utility.postMessage({ type: 'input', ptyId: req.ptyId, data: req.data });
},
resize(req): void {
const handle = handles.get(req.windowId);
- if (!handle?.sessions.has(req.ptyId)) return;
+ const session = handle?.sessions.get(req.ptyId);
+ if (!handle || !session) return;
+ if (session.pendingCreate !== null) {
+ session.pendingCreate.cols = req.cols;
+ session.pendingCreate.rows = req.rows;
+ return;
+ }
handle.utility.postMessage({
type: 'resize',
ptyId: req.ptyId,
@@ -459,7 +519,13 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
kill(req): void {
const handle = handles.get(req.windowId);
- if (!handle?.sessions.has(req.ptyId)) return;
+ const session = handle?.sessions.get(req.ptyId);
+ if (!handle || !session) return;
+ if (session.pendingCreate !== null) {
+ clearSessionTimers(session);
+ handle.sessions.delete(req.ptyId);
+ return;
+ }
handle.utility.postMessage({ type: 'kill', ptyId: req.ptyId });
},
@@ -478,6 +544,7 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
const handle = handles.get(windowId);
if (!handle) return [];
return [...handle.sessions.entries()]
+ .filter(([, session]) => session.pendingCreate === null)
.sort((a, b) => a[1].order - b[1].order)
.map(([ptyId, session]) => ({
ptyId,
@@ -512,7 +579,47 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
const handle = handles.get(req.windowId);
const session = handle?.sessions.get(req.ptyId);
if (!handle || !session) return { ok: false, reason: 'unknown-session' };
- clearFlush(session);
+ if (session.pendingCreate !== null) {
+ if (!req.start) {
+ deps.logger?.warn({
+ event: 'terminal-manager-adopt-unstarted-reservation',
+ windowId: req.windowId,
+ ptyId: req.ptyId,
+ });
+ return { ok: false, reason: 'not-started' };
+ }
+ const message = session.pendingCreate;
+ if (!deps.canSpawnAt(message.cwd)) {
+ clearSessionTimers(session);
+ handle.sessions.delete(req.ptyId);
+ deps.logger?.warn({
+ event: 'terminal-manager-start-refused',
+ windowId: req.windowId,
+ ptyId: req.ptyId,
+ });
+ return { ok: false, reason: 'not-consented' };
+ }
+ handle.webContents = req.webContents;
+ session.pendingCreate = null;
+ clearSessionTimers(session);
+ const liveCount = [...handle.sessions.values()].filter(
+ (live) => live.pendingCreate === null,
+ ).length;
+ // STOP: post and return in the same tick; TerminalPanel installs its readiness scanner after this reply, so an await below would let the shell's first output outrun it.
+ try {
+ handle.utility.postMessage(message);
+ } catch (err) {
+ handle.sessions.delete(req.ptyId);
+ warnPostFailed('terminal-manager-start-failed', err, {
+ windowId: req.windowId,
+ ptyId: req.ptyId,
+ });
+ return { ok: false, reason: 'host-unavailable' };
+ }
+ deps.recordConcurrentSessions?.({ count: liveCount });
+ return { ok: true, replay: '' };
+ }
+ clearSessionTimers(session);
session.outbound = '';
session.pendingBytes = 0;
session.paused = false;
@@ -523,7 +630,7 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
windowId: req.windowId,
ptyId: req.ptyId,
});
- return { ok: false, reason: 'unknown-session' };
+ return { ok: false, reason: 'host-unavailable' };
}
handle.webContents = req.webContents;
return {
@@ -539,21 +646,29 @@ export function createTerminalManager(deps: TerminalManagerDeps): TerminalManage
killForWindow(windowId): void {
const handle = handles.get(windowId);
if (!handle) return;
+ let reserved = 0;
for (const session of handle.sessions.values()) {
- clearFlush(session);
+ clearSessionTimers(session);
maybeRecordSession(session);
+ if (session.pendingCreate !== null) reserved += 1;
}
+ if (reserved > 0)
+ deps.logger?.warn({ event: 'terminal-manager-reaped-reservations', windowId, reserved });
handles.delete(windowId);
void beginHostShutdown(handle);
},
async killAll(): Promise<void> {
const shutdowns: Promise<void>[] = [];
- for (const handle of handles.values()) {
+ for (const [windowId, handle] of handles) {
+ let reserved = 0;
for (const session of handle.sessions.values()) {
- clearFlush(session);
+ clearSessionTimers(session);
maybeRecordSession(session);
+ if (session.pendingCreate !== null) reserved += 1;
}
+ if (reserved > 0)
+ deps.logger?.warn({ event: 'terminal-manager-reaped-reservations', windowId, reserved });
shutdowns.push(beginHostShutdown(handle));
}
handles.clear();
diff --git a/packages/desktop/src/preload/index.ts b/packages/desktop/src/preload/index.ts
index e7e19daa9..213eb0c0a 100644
--- a/packages/desktop/src/preload/index.ts
+++ b/packages/desktop/src/preload/index.ts
@@ -787,7 +787,8 @@ const bridge: OkDesktopBridge = {
invoke('ok:pty:drain', { ptyId, bytes }).catch(() => {});
},
list: () => invoke('ok:pty:list'),
- adopt: (ptyId) => invoke('ok:pty:adopt', { ptyId }),
+ adopt: (ptyId, opts) => invoke('ok:pty:adopt', { ptyId, ...opts }),
+ start: (ptyId) => invoke('ok:pty:adopt', { ptyId, start: true }),
setMeta: (ptyId, meta) => {
invoke('ok:pty:set-meta', { ptyId, ...meta }).catch(() => {});
},
diff --git a/packages/desktop/src/shared/ipc-channels.ts b/packages/desktop/src/shared/ipc-channels.ts
index 761d7d271..a1ae9157d 100644
--- a/packages/desktop/src/shared/ipc-channels.ts
+++ b/packages/desktop/src/shared/ipc-channels.ts
@@ -702,7 +702,7 @@ export interface RequestChannels {
result: OkPtyListEntry[];
};
'ok:pty:adopt': {
- args: [req: { ptyId: string }];
+ args: [req: { ptyId: string; start?: boolean }];
result: OkPtyAdoptResult;
};
'ok:pty:set-meta': {
diff --git a/packages/desktop/src/utility/pty-host.ts b/packages/desktop/src/utility/pty-host.ts
index e0d51616c..f37800e3e 100644
--- a/packages/desktop/src/utility/pty-host.ts
+++ b/packages/desktop/src/utility/pty-host.ts
@@ -9,6 +9,8 @@ import {
resolveWindowsShellFamily,
type TerminalLaunchCommand,
type WindowsShellFamily,
+ WindowsShellLaunchError,
+ type WindowsShellLaunchFailureReason,
} from '@inkeep/open-knowledge-core';
import { isTerminalShellNoticeReason } from '@inkeep/open-knowledge-core/desktop-bridge';
import type {
@@ -87,11 +89,19 @@ interface PtyExitMessage {
exitCode: number | undefined;
signal: number | null;
}
-interface PtySpawnErrorMessage {
- type: 'spawn-error';
- ptyId: string;
- message: string;
-}
+type PtySpawnErrorMessage =
+ | {
+ type: 'spawn-error';
+ ptyId: string;
+ message: string;
+ launchFailure?: undefined;
+ }
+ | {
+ type: 'spawn-error';
+ ptyId: string;
+ message?: undefined;
+ launchFailure: WindowsShellLaunchFailureReason;
+ };
type PtyShellNoticeMessage =
| {
type: 'shell-notice';
@@ -696,16 +706,22 @@ export function setupPtyHost(deps: SetupPtyHostDeps): PtyHostHandle {
try {
shellArgs = buildShellArgs(platform, shell, launchCommand);
} catch (error) {
+ const launchFailure = error instanceof WindowsShellLaunchError ? error.reason : null;
deps.logger?.warn({
event: 'pty-host-launch-compose-failed',
platform,
rung: resolution.rung,
+ ...(launchFailure === null ? {} : { launchFailure }),
});
- post({
- type: 'spawn-error',
- ptyId,
- message: error instanceof Error ? error.message : String(error),
- });
+ post(
+ launchFailure === null
+ ? {
+ type: 'spawn-error',
+ ptyId,
+ message: error instanceof Error ? error.message : String(error),
+ }
+ : { type: 'spawn-error', ptyId, launchFailure },
+ );
return;
}
const spawnOptions: PtySpawnOptions = {
diff --git a/packages/desktop/tests/integration/terminal-consent-wiring.test.ts b/packages/desktop/tests/integration/terminal-consent-wiring.test.ts
new file mode 100644
index 000000000..36cba8f80
--- /dev/null
+++ b/packages/desktop/tests/integration/terminal-consent-wiring.test.ts
@@ -0,0 +1,56 @@
+import { readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { describe, expect, test } from 'vitest';
+
+const indexTsPath = resolve(fileURLToPath(new URL('../../src/main/index.ts', import.meta.url)));
+const src = readFileSync(indexTsPath, 'utf-8');
+
+const FIX = (what: string): string =>
+ `\n[terminal-consent] ${what}\n\n` +
+ `isTerminalConsented is the main-process backstop for the terminal, and since PRD-8498 it is\n` +
+ `read at two gates: the ok:pty:create handler, and canSpawnAt, which the manager consults\n` +
+ `immediately before it posts the deferred spawn. Requiring canSpawnAt makes a DROPPED wiring a\n` +
+ `compile error; this pin covers the substitution that still type-checks — a literal true, a\n` +
+ `cached boolean, or a different predicate — which would silently restore shells for a user who\n` +
+ `set terminal.enabled: false. See the corrigendum at specs/2026-06-17-terminal-usability/SPEC.md\n` +
+ `and the ok:pty:* protocol paragraph in packages/desktop/README.md.\n`;
+
+describe('terminal consent spawn-gate wiring (bypass-pin)', () => {
+ test('canSpawnAt is isTerminalConsented over the caller-supplied root, with nothing appended', () => {
+ const wiring =
+ /canSpawnAt:\s*(?:isTerminalConsented\s*[,}]|\(\s*(\w+)\s*\)\s*=>\s*isTerminalConsented\(\s*\1\s*\)\s*[,}])/g;
+ expect(
+ (src.match(wiring) ?? []).length,
+ FIX(
+ 'index.ts no longer wires canSpawnAt straight through to isTerminalConsented, or appended a disjunct to it.',
+ ),
+ ).toBe(1);
+ });
+
+ test('the ok:pty:create handler refuses on withdrawn consent before it reaches the manager', () => {
+ const createGate =
+ /if\s*\(\s*!isTerminalConsented\(\s*(\w+)\s*\)\s*&&\s*!\(\s*await\s+isTerminalConsentedWithGrace\(\s*\1\s*\)\s*\)\s*\)\s*\{/g;
+ const gates = src.match(createGate) ?? [];
+ expect(
+ gates.length,
+ FIX('index.ts no longer gates ok:pty:create on isTerminalConsented.'),
+ ).toBe(1);
+
+ const gateAt = src.indexOf(gates[0] ?? '\u0000');
+ const refusalAt = src.indexOf("return { ok: false, reason: 'not-consented' };", gateAt);
+ const createAt = src.indexOf('terminalManager.create(', gateAt);
+ expect(
+ refusalAt,
+ FIX('the consent gate no longer refuses with reason not-consented.'),
+ ).toBeGreaterThan(-1);
+ expect(
+ createAt,
+ FIX('the consent gate is no longer followed by terminalManager.create.'),
+ ).toBeGreaterThan(-1);
+ expect(
+ refusalAt,
+ FIX('the consent refusal no longer precedes terminalManager.create.'),
+ ).toBeLessThan(createAt);
+ });
+});
diff --git a/packages/desktop/tests/main/terminal-lifecycle.test.ts b/packages/desktop/tests/main/terminal-lifecycle.test.ts
index c857437e3..10df6e4de 100644
--- a/packages/desktop/tests/main/terminal-lifecycle.test.ts
+++ b/packages/desktop/tests/main/terminal-lifecycle.test.ts
@@ -11,6 +11,7 @@ import {
} from '../../src/main/terminal-manager.ts';
import type { SendableWebContents } from '../../src/shared/ipc-send.ts';
import type { PtyHostIncomingMessage } from '../../src/utility/pty-host.ts';
+import { createStartedTerminal } from '../support/terminal-create.test-helper.ts';
class FakeUtility {
posted: PtyHostIncomingMessage[] = [];
@@ -60,6 +61,7 @@ function makeRig() {
const warnings: Array<Record<string, unknown>> = [];
let idn = 0;
const mgr: TerminalManager = createTerminalManager({
+ canSpawnAt: () => true,
forkPtyHost: () => {
const u = new FakeUtility();
forked.push(u);
@@ -81,7 +83,7 @@ function makeRig() {
function openTerminalWindow(id: number): { win: FakeWindow; ptyId: string } {
const win = new FakeWindow(id);
wireWindowTerminalReap(win, reaper);
- const res = mgr.create({
+ const res = createStartedTerminal(mgr, {
windowId: id,
webContents: makeWebContents(),
projectRoot: PROJECT,
diff --git a/packages/desktop/tests/main/terminal-manager.test.ts b/packages/desktop/tests/main/terminal-manager.test.ts
index 41511e197..62626df82 100644
--- a/packages/desktop/tests/main/terminal-manager.test.ts
+++ b/packages/desktop/tests/main/terminal-manager.test.ts
@@ -14,14 +14,17 @@ import {
} from '../../src/main/terminal-manager.ts';
import type { SendableWebContents } from '../../src/shared/ipc-send.ts';
import type { PtyHostIncomingMessage } from '../../src/utility/pty-host.ts';
+import { createStartedTerminal } from '../support/terminal-create.test-helper.ts';
class FakeUtility {
posted: PtyHostIncomingMessage[] = [];
+ attempted: PtyHostIncomingMessage[] = [];
killed = 0;
throwOnPost: unknown = null;
private msgCb: ((raw: unknown) => void) | null = null;
private exitCb: ((code: number | null) => void) | null = null;
postMessage(m: PtyHostIncomingMessage): void {
+ this.attempted.push(m);
if (this.throwOnPost !== null) throw this.throwOnPost;
this.posted.push(m);
}
@@ -68,6 +71,7 @@ function makeManager(over?: Partial<TerminalManagerDeps>) {
const warns: Array<Record<string, unknown>> = [];
let idn = 0;
const mgr = createTerminalManager({
+ canSpawnAt: () => true,
forkPtyHost: () => {
const u = new FakeUtility();
forked.push(u);
@@ -115,8 +119,10 @@ function makeManager(over?: Partial<TerminalManagerDeps>) {
const exits = (): Array<Record<string, unknown>> =>
sent.filter((s) => s.channel === 'ok:pty:exit').map((s) => s.payload);
const liveTimerCount = (): number => timers.filter((t) => t !== null).length;
+ const staleTimerArmed = (): boolean => timers[0] !== null;
return {
mgr,
+ staleTimerArmed,
sent,
forked,
warns,
@@ -130,11 +136,281 @@ function makeManager(over?: Partial<TerminalManagerDeps>) {
const PROJECT = '/Users/me/project';
+describe('terminal creation waits for the renderer to subscribe', () => {
+ function reserve(over?: Partial<TerminalManagerDeps>) {
+ const h = makeManager(over);
+ const webContents = makeWebContents();
+ const result = h.mgr.create({
+ windowId: 1,
+ webContents,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ launchCommand: 'echo ready',
+ });
+ expect(result).toEqual({ ok: true, ptyId: 'pty-1' });
+ const start = () =>
+ h.mgr.adoptSession({ windowId: 1, ptyId: 'pty-1', webContents, start: true });
+ return { ...h, webContents, start };
+ }
+
+ test('neither create nor a replay request starts the shell; the first start starts it once', () => {
+ const h = reserve();
+ h.runTimers();
+ expect(h.forked[0]?.posted).toEqual([]);
+ expect(h.mgr.adoptSession({ windowId: 1, ptyId: 'pty-1', webContents: h.webContents })).toEqual(
+ {
+ ok: false,
+ reason: 'not-started',
+ },
+ );
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({ event: 'terminal-manager-adopt-unstarted-reservation' }),
+ );
+ expect(h.forked[0]?.posted).toEqual([]);
+ expect(h.start()).toEqual({ ok: true, replay: '' });
+ h.forked[0]?.emitMessage({ type: 'data', ptyId: 'pty-1', data: 'prompt$ ' });
+ h.runTimers();
+ expect(h.dataPayloads()).toEqual(['prompt$ ']);
+ expect(h.forked[0]?.posted).toEqual([
+ {
+ type: 'create',
+ ptyId: 'pty-1',
+ cwd: PROJECT,
+ cols: 80,
+ rows: 24,
+ launchCommand: 'echo ready',
+ },
+ ]);
+ });
+
+ test('a start against an already-live session adopts it instead of respawning', () => {
+ const h = reserve();
+ expect(h.start()).toEqual({ ok: true, replay: '' });
+ h.forked[0]?.emitMessage({ type: 'data', ptyId: 'pty-1', data: 'prompt$ ' });
+ h.runTimers();
+ expect(h.start()).toEqual({ ok: true, replay: 'prompt$ ' });
+ expect(h.forked[0]?.posted.filter((m) => m.type === 'create')).toHaveLength(1);
+ });
+
+ test('delivers immediate output and exit in order without needing later input', () => {
+ const h = reserve();
+ const utility = h.forked[0];
+ if (!utility) throw new Error('missing host');
+ vi.spyOn(utility, 'postMessage').mockImplementation((message) => {
+ if (message.type !== 'create') return;
+ utility.emitMessage({ type: 'data', ptyId: message.ptyId, data: 'prompt$ ' });
+ utility.emitMessage({ type: 'exit', ptyId: message.ptyId, exitCode: 0, signal: null });
+ });
+ expect(h.sent).toEqual([]);
+ expect(h.start()).toEqual({ ok: true, replay: '' });
+ expect(h.sent).toEqual([
+ { channel: 'ok:pty:data', payload: { ptyId: 'pty-1', data: 'prompt$ ' } },
+ { channel: 'ok:pty:exit', payload: { ptyId: 'pty-1', exitCode: 0, signal: null } },
+ ]);
+ h.runTimers();
+ expect(h.sent).toHaveLength(2);
+ expect(h.mgr.listSessions(1)).toEqual([]);
+ });
+
+ test('delivers an immediate spawn failure after the start', () => {
+ const h = reserve();
+ const utility = h.forked[0];
+ if (!utility) throw new Error('missing host');
+ vi.spyOn(utility, 'postMessage').mockImplementation((message) => {
+ if (message.type === 'create') {
+ utility.emitMessage({ type: 'spawn-error', ptyId: message.ptyId, message: 'spawn failed' });
+ }
+ });
+ h.start();
+ expect(h.exits()).toEqual([{ ptyId: 'pty-1', error: 'spawn failed', neverStarted: true }]);
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({ event: 'terminal-manager-spawn-error', ptyId: 'pty-1' }),
+ );
+ });
+
+ test('cancels an unstarted tab without starting a shell', () => {
+ const h = reserve();
+ h.mgr.kill({ windowId: 1, ptyId: 'pty-1' });
+ expect(h.start()).toEqual({ ok: false, reason: 'unknown-session' });
+ expect(h.forked[0]?.posted).toEqual([]);
+ expect(h.mgr.listSessions(1)).toEqual([]);
+ });
+
+ test('keeps the start scoped to the owning window', () => {
+ const h = reserve();
+ expect(
+ h.mgr.adoptSession({ windowId: 2, ptyId: 'pty-1', webContents: h.webContents, start: true }),
+ ).toEqual({
+ ok: false,
+ reason: 'unknown-session',
+ });
+ expect(h.forked[0]?.posted).toEqual([]);
+ expect(h.start().ok).toBe(true);
+ });
+
+ test('applies pre-start resizing and posts no input until the shell starts', () => {
+ const h = reserve();
+ h.mgr.resize({ windowId: 1, ptyId: 'pty-1', cols: 100, rows: 40 });
+ h.mgr.input({ windowId: 1, ptyId: 'pty-1', data: 'too early\r' });
+ expect(h.forked[0]?.posted).toEqual([]);
+ h.start();
+ expect(h.forked[0]?.posted[0]).toMatchObject({ type: 'create', cols: 100, rows: 40 });
+ });
+
+ test('reports a failed start and removes its reservation', () => {
+ const h = reserve();
+ const utility = h.forked[0];
+ if (!utility) throw new Error('missing host');
+ utility.throwOnPost = new Error('host gone');
+ expect(h.start()).toEqual({ ok: false, reason: 'host-unavailable' });
+ expect(h.mgr.listSessions(1)).toEqual([]);
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({ event: 'terminal-manager-start-failed' }),
+ );
+ });
+
+ test('reports an unavailable session when the host dies before the start', () => {
+ const h = reserve();
+ h.forked[0]?.emitExit(1);
+ expect(h.start()).toEqual({ ok: false, reason: 'unknown-session' });
+ expect(h.exits()).toEqual([{ ptyId: 'pty-1', neverStarted: true, hostExited: true }]);
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({ event: 'terminal-manager-host-exited', reserved: 1 }),
+ );
+ });
+
+ test('logs the reservations it reaps when the owning window closes', () => {
+ const h = reserve();
+ h.mgr.killForWindow(1);
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({ event: 'terminal-manager-reaped-reservations', reserved: 1 }),
+ );
+ });
+
+ test('logs the reservations it reaps when the app quits', () => {
+ const h = reserve();
+ h.mgr.killAll();
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({ event: 'terminal-manager-reaped-reservations', reserved: 1 }),
+ );
+ });
+
+ test('refuses to spawn when consent was withdrawn between the create and the start', () => {
+ let consented = true;
+ const h = reserve({ canSpawnAt: () => consented });
+ consented = false;
+ expect(h.start()).toEqual({ ok: false, reason: 'not-consented' });
+ expect(h.forked[0]?.posted).toEqual([]);
+ expect(h.mgr.listSessions(1)).toEqual([]);
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({ event: 'terminal-manager-start-refused' }),
+ );
+ });
+
+ test('a reservation is never offered for reload rehydration and listing does not cancel it', () => {
+ const h = reserve();
+ expect(h.mgr.listSessions(1)).toEqual([]);
+ expect(h.start()).toEqual({ ok: true, replay: '' });
+ expect(h.forked[0]?.posted).toHaveLength(1);
+ expect(h.mgr.listSessions(1).map((e) => e.ptyId)).toEqual(['pty-1']);
+ });
+
+ test('a granted spawn check receives the reserved cwd and lets the create through', () => {
+ const roots: string[] = [];
+ const h = reserve({
+ canSpawnAt: (root) => {
+ roots.push(root);
+ return root === PROJECT;
+ },
+ });
+ expect(h.start()).toEqual({ ok: true, replay: '' });
+ expect(roots).toEqual([PROJECT]);
+ expect(h.forked[0]?.posted).toHaveLength(1);
+ });
+
+ test('a reservation left pending past the staleness threshold warns while the window is open', () => {
+ const h = reserve();
+ expect(h.timerDelays[0]).toBe(30_000);
+ expect(h.warns).toEqual([]);
+ h.runTimers();
+ expect(h.warns).toContainEqual({
+ event: 'terminal-manager-stale-reservation',
+ windowId: 1,
+ ptyId: 'pty-1',
+ });
+ expect(h.mgr.listSessions(1)).toEqual([]);
+ expect(h.exits()).toEqual([]);
+ expect(h.start()).toEqual({ ok: true, replay: '' });
+ });
+
+ test('a healthy handshake disarms the staleness warn', () => {
+ const h = reserve();
+ expect(h.staleTimerArmed()).toBe(true);
+ expect(h.start()).toEqual({ ok: true, replay: '' });
+ expect(h.staleTimerArmed()).toBe(false);
+ h.runTimers();
+ expect(h.warns).not.toContainEqual(
+ expect.objectContaining({ event: 'terminal-manager-stale-reservation' }),
+ );
+ });
+
+ test('a reaped reservation disarms the staleness warn', () => {
+ const h = reserve();
+ h.mgr.kill({ windowId: 1, ptyId: 'pty-1' });
+ expect(h.staleTimerArmed()).toBe(false);
+ h.runTimers();
+ expect(h.warns).not.toContainEqual(
+ expect.objectContaining({ event: 'terminal-manager-stale-reservation' }),
+ );
+ });
+
+ test('killForWindow disarms the staleness warn', () => {
+ const h = reserve();
+ h.mgr.killForWindow(1);
+ expect(h.staleTimerArmed()).toBe(false);
+ h.runTimers();
+ expect(h.warns).not.toContainEqual(
+ expect.objectContaining({ event: 'terminal-manager-stale-reservation' }),
+ );
+ });
+
+ test('a reservation deleted without its timer cleared warns for nobody', () => {
+ const h = reserve({ clearTimer: () => {} });
+ h.mgr.killForWindow(1);
+ h.runTimers();
+ expect(h.warns).not.toContainEqual(
+ expect.objectContaining({ event: 'terminal-manager-stale-reservation' }),
+ );
+ });
+
+ test('a live session stays listed while a sibling reservation stays hidden and startable', () => {
+ const h = reserve();
+ expect(h.start().ok).toBe(true);
+ h.mgr.create({
+ windowId: 1,
+ webContents: h.webContents,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ expect(h.mgr.listSessions(1).map((e) => e.ptyId)).toEqual(['pty-1']);
+ expect(
+ h.mgr.adoptSession({
+ windowId: 1,
+ ptyId: 'pty-2',
+ webContents: h.webContents,
+ start: true,
+ }),
+ ).toEqual({ ok: true, replay: '' });
+ });
+});
+
describe('createTerminalManager — create', () => {
test('forks a host, posts create at the project root, returns the ptyId', () => {
const h = makeManager();
const wc = makeWebContents();
- const r = h.mgr.create({
+ const r = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: wc,
projectRoot: PROJECT,
@@ -151,7 +427,7 @@ describe('createTerminalManager — create', () => {
test('forwards configured and invalid shell override state to the host resolver', () => {
const h = makeManager();
const wc = makeWebContents();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: wc,
projectRoot: PROJECT,
@@ -174,7 +450,7 @@ describe('createTerminalManager — create', () => {
test('forwards an invalid-override notice only to the addressed renderer session', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -197,7 +473,7 @@ describe('createTerminalManager — create', () => {
test('forwards the resolved Windows shell family to the addressed renderer session', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -222,7 +498,7 @@ describe('createTerminalManager — create', () => {
'forwards the shared invalid-override reason %s to the renderer',
(reason) => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -248,7 +524,7 @@ describe('createTerminalManager — create', () => {
'forwards the shared resolved shell family %s to the renderer',
(shellFamily) => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -274,7 +550,7 @@ describe('createTerminalManager — create', () => {
'forwards the support-file degradation reason %s to the renderer',
(reason) => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -298,7 +574,7 @@ describe('createTerminalManager — create', () => {
test('drops a shell notice whose reason or family is outside the shared sets', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -335,7 +611,7 @@ describe('createTerminalManager — create', () => {
});
const h = makeManager({ sendNotice });
const wc = makeWebContents();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: wc,
projectRoot: PROJECT,
@@ -357,7 +633,7 @@ describe('createTerminalManager — create', () => {
test('a window with no project root gets no terminal and no fork', () => {
const h = makeManager();
- const r = h.mgr.create({
+ const r = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: null,
@@ -371,8 +647,14 @@ describe('createTerminalManager — create', () => {
test('a second create for the same window reuses the host with a fresh ptyId', () => {
const h = makeManager();
const wc = makeWebContents();
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
- const r2 = h.mgr.create({
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ const r2 = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: wc,
projectRoot: PROJECT,
@@ -392,14 +674,14 @@ describe('createTerminalManager — create', () => {
test('separate windows each fork their own host', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
cols: 80,
rows: 24,
});
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 2,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -414,7 +696,13 @@ describe('createTerminalManager — addressing', () => {
function setup() {
const h = makeManager();
const wc = makeWebContents();
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
return h;
}
@@ -447,7 +735,7 @@ describe('createTerminalManager — addressing', () => {
describe('createTerminalManager — coalescing + UTF-8 integrity', () => {
test('batches multiple host reads into one push on the timer tick', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -464,7 +752,7 @@ describe('createTerminalManager — coalescing + UTF-8 integrity', () => {
test('concatenating whole reads preserves multibyte UTF-8 across the coalesce boundary', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -480,7 +768,7 @@ describe('createTerminalManager — coalescing + UTF-8 integrity', () => {
test('drops host data tagged with a superseded ptyId', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -496,7 +784,7 @@ describe('createTerminalManager — coalescing + UTF-8 integrity', () => {
describe('createTerminalManager — exit + crash surfacing', () => {
test('flushes buffered output before the exit state, then clears the pty', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -514,7 +802,7 @@ describe('createTerminalManager — exit + crash surfacing', () => {
test('passes a crash signal through on the exit payload', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -527,7 +815,7 @@ describe('createTerminalManager — exit + crash surfacing', () => {
test('normalizes the node-pty undefined exitCode race before renderer delivery', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -544,9 +832,9 @@ describe('createTerminalManager — exit + crash surfacing', () => {
expect(h.exits()[0]).toEqual({ ptyId: 'pty-1', exitCode: -1, signal: null });
});
- test('maps a host spawn-error to a crashed exit carrying the message', () => {
+ test('maps a host spawn-error to a never-started exit carrying the message', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -560,15 +848,182 @@ describe('createTerminalManager — exit + crash surfacing', () => {
});
expect(h.exits()[0]).toEqual({
ptyId: 'pty-1',
- exitCode: 1,
- signal: null,
error: 'EMFILE: too many open files',
+ neverStarted: true,
+ });
+ });
+
+ test('maps a launch-composition failure to a structured reason, never to prose', () => {
+ const h = makeManager();
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: makeWebContents(),
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ h.forked[0]?.emitMessage({
+ type: 'spawn-error',
+ ptyId: 'pty-1',
+ launchFailure: 'unsafe-argument',
+ });
+ expect(h.exits()[0]).toEqual({
+ ptyId: 'pty-1',
+ launchFailure: 'unsafe-argument',
+ neverStarted: true,
+ });
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({
+ event: 'terminal-manager-spawn-error',
+ launchFailure: 'unsafe-argument',
+ }),
+ );
+ });
+
+ test('rejects a spawn-error that carries neither a message nor a known launch reason', () => {
+ const h = makeManager();
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: makeWebContents(),
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ h.forked[0]?.emitMessage({ type: 'spawn-error', ptyId: 'pty-1', launchFailure: 'made-up' });
+ expect(h.exits()).toEqual([{ ptyId: 'pty-1', neverStarted: true }]);
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({
+ event: 'pty-host-unexpected-message',
+ ptyId: 'pty-1',
+ rawType: 'spawn-error',
+ reaped: true,
+ }),
+ );
+ });
+
+ test('rejects a spawn-error carrying both a message and a launch reason', () => {
+ const h = makeManager();
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: makeWebContents(),
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ h.forked[0]?.emitMessage({
+ type: 'spawn-error',
+ ptyId: 'pty-1',
+ message: 'EACCES',
+ launchFailure: 'unsafe-argument',
+ });
+ expect(h.exits()).toEqual([{ ptyId: 'pty-1', neverStarted: true }]);
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({ event: 'pty-host-unexpected-message', reaped: true }),
+ );
+ });
+
+ test('rejects a spawn-error whose message rides an out-of-vocabulary launch reason', () => {
+ const h = makeManager();
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: makeWebContents(),
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ h.forked[0]?.emitMessage({
+ type: 'spawn-error',
+ ptyId: 'pty-1',
+ message: 'spawn ENOENT',
+ launchFailure: 'made-up',
+ });
+ expect(h.exits()).toEqual([{ ptyId: 'pty-1', neverStarted: true }]);
+ expect(h.forked[0]?.posted).toContainEqual({ type: 'kill', ptyId: 'pty-1' });
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({ event: 'pty-host-unexpected-message', reaped: true }),
+ );
+ });
+
+ test('a reaped spawn-error drops its session and lands its exit before the best-effort kill post', () => {
+ const h = makeManager();
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: makeWebContents(),
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
});
+ const utility = h.forked[0];
+ if (!utility) throw new Error('missing host');
+ utility.throwOnPost = new Error('injected post failure');
+ try {
+ utility.emitMessage({ type: 'spawn-error', ptyId: 'pty-1', launchFailure: 'made-up' });
+ } catch (err) {
+ if (err !== utility.throwOnPost) throw err;
+ }
+ expect(utility.attempted).toContainEqual({ type: 'kill', ptyId: 'pty-1' });
+ expect(utility.posted).not.toContainEqual({ type: 'kill', ptyId: 'pty-1' });
+ expect(h.exits()).toEqual([{ ptyId: 'pty-1', neverStarted: true }]);
+ expect(h.mgr.listSessions(1)).toEqual([]);
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({
+ event: 'pty-host-unexpected-message',
+ ptyId: 'pty-1',
+ rawType: 'spawn-error',
+ reaped: true,
+ }),
+ );
+ });
+
+ test('a rejected data message leaves the session running', () => {
+ const h = makeManager();
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: makeWebContents(),
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ h.forked[0]?.emitMessage({ type: 'data', ptyId: 'pty-1', data: 42 });
+ expect(h.exits()).toEqual([]);
+ expect(h.mgr.listSessions(1).map((s) => s.ptyId)).toEqual(['pty-1']);
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({
+ event: 'pty-host-unexpected-message',
+ rawType: 'data',
+ reaped: false,
+ }),
+ );
+ });
+
+ test('a rejected spawn-error for an unknown session pushes no exit', () => {
+ const h = makeManager();
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: makeWebContents(),
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ h.forked[0]?.emitMessage({
+ type: 'spawn-error',
+ ptyId: 'pty-absent',
+ launchFailure: 'made-up',
+ });
+ expect(h.exits()).toEqual([]);
+ expect(h.forked[0]?.posted).not.toContainEqual({ type: 'kill', ptyId: 'pty-absent' });
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({
+ event: 'pty-host-unexpected-message',
+ ptyId: 'pty-absent',
+ reaped: false,
+ }),
+ );
});
test('surfaces a utilityProcess crash as an exit and drops the dead host', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -580,9 +1035,9 @@ describe('createTerminalManager — exit + crash surfacing', () => {
ptyId: 'pty-1',
exitCode: 1,
signal: null,
- error: 'terminal host exited',
+ hostExited: true,
});
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -594,7 +1049,7 @@ describe('createTerminalManager — exit + crash surfacing', () => {
test('flushes a session buffered output before its exit on a host crash', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -609,7 +1064,7 @@ describe('createTerminalManager — exit + crash surfacing', () => {
test('ignores a malformed host message without crashing or sending', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -631,7 +1086,7 @@ describe('createTerminalManager — exit + crash surfacing', () => {
describe('createTerminalManager — backpressure', () => {
test('pauses the host when in-flight bytes cross the high-water mark', () => {
const h = makeManager({ highWaterBytes: 100, lowWaterBytes: 20 });
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -645,7 +1100,7 @@ describe('createTerminalManager — backpressure', () => {
test('resumes only once drain acks bring in-flight back under the low-water mark', () => {
const h = makeManager({ highWaterBytes: 100, lowWaterBytes: 20 });
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -662,7 +1117,7 @@ describe('createTerminalManager — backpressure', () => {
test('does not resume a host that was never paused', () => {
const h = makeManager({ highWaterBytes: 100, lowWaterBytes: 20 });
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -677,7 +1132,7 @@ describe('createTerminalManager — backpressure', () => {
test('drain for a stale ptyId is ignored', () => {
const h = makeManager({ highWaterBytes: 100, lowWaterBytes: 20 });
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -695,7 +1150,13 @@ describe('createTerminalManager — destroyed-window guard', () => {
test('skips data + exit pushes once the window is destroyed', () => {
const h = makeManager();
const wc = makeWebContents();
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
wc.destroyed = true;
h.forked[0]?.emitMessage({ type: 'data', ptyId: 'pty-1', data: 'late' });
h.runTimers();
@@ -706,7 +1167,13 @@ describe('createTerminalManager — destroyed-window guard', () => {
test('a dead page does not spin the flush timer: a tick that delivered nothing stays disarmed', () => {
const h = makeManager();
const wc = makeWebContents();
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
wc.destroyed = true;
h.forked[0]?.emitMessage({ type: 'data', ptyId: 'pty-1', data: 'a' });
h.runTimers();
@@ -718,7 +1185,7 @@ describe('createTerminalManager — destroyed-window guard', () => {
describe('createTerminalManager — lifecycle reap', () => {
test('killForWindow requests shutdown, then force-kills at the deadline', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -735,7 +1202,7 @@ describe('createTerminalManager — lifecycle reap', () => {
expect(h.warns).toContainEqual({ event: 'terminal-manager-shutdown-deadline' });
utility?.emitExit(0);
expect(h.exits()).toEqual([]);
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -747,7 +1214,7 @@ describe('createTerminalManager — lifecycle reap', () => {
test('a cooperative host exit cancels the force-kill deadline', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -770,14 +1237,14 @@ describe('createTerminalManager — lifecycle reap', () => {
test('killAll reaps every window host', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
cols: 80,
rows: 24,
});
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 2,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -792,7 +1259,7 @@ describe('createTerminalManager — lifecycle reap', () => {
h.runTimers();
expect(h.forked[0]?.killed).toBe(1);
expect(h.forked[1]?.killed).toBe(1);
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -804,7 +1271,7 @@ describe('createTerminalManager — lifecycle reap', () => {
test('the killAll promise stays pending until the host exit arrives', async () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -826,7 +1293,7 @@ describe('createTerminalManager — lifecycle reap', () => {
test('the killAll promise settles at the deadline when the host never exits', async () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -852,6 +1319,7 @@ describe('createTerminalManager — lifecycle reap', () => {
const timers: Array<() => void> = [];
let idn = 0;
const mgr = createTerminalManager({
+ canSpawnAt: () => true,
forkPtyHost: () => {
const u = new ThrowingUtility(forked.length === 0);
forked.push(u);
@@ -867,7 +1335,7 @@ describe('createTerminalManager — lifecycle reap', () => {
clearTimer: () => {},
});
for (const windowId of [1, 2, 3]) {
- mgr.create({
+ createStartedTerminal(mgr, {
windowId,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -883,7 +1351,7 @@ describe('createTerminalManager — lifecycle reap', () => {
test('a shutdown-send failure is surfaced even when it carries a kill-shaped code', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -908,6 +1376,7 @@ describe('createTerminalManager — lifecycle reap', () => {
const timers: Array<() => void> = [];
let idn = 0;
const mgr = createTerminalManager({
+ canSpawnAt: () => true,
forkPtyHost: () => {
const u = new ThrowingUtility(true);
forked.push(u);
@@ -922,7 +1391,7 @@ describe('createTerminalManager — lifecycle reap', () => {
},
clearTimer: () => {},
});
- mgr.create({
+ createStartedTerminal(mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -930,7 +1399,7 @@ describe('createTerminalManager — lifecycle reap', () => {
rows: 24,
});
expect(() => mgr.killForWindow(1)).not.toThrow();
- expect(() => timers[0]?.()).not.toThrow();
+ expect(() => timers.at(-1)?.()).not.toThrow();
expect(forked[0]?.killAttempts).toBe(1);
});
});
@@ -958,7 +1427,7 @@ describe('createTerminalManager — telemetry', () => {
recordConcurrentSessions: (info) => concurrent.push(info),
});
const start = (windowId: number): void => {
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -1003,12 +1472,47 @@ describe('createTerminalManager — telemetry', () => {
expect(h.sessions).toHaveLength(1);
});
- test('a spawn-error emits a crashed shell-exit and no session (the shell never ran)', () => {
+ test('a start that never reaches the host is not counted as a crashed shell', () => {
+ const h = makeTelemetryManager();
+ const wc = makeWebContents();
+ const created = h.mgr.create({
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ expect(created.ok).toBe(true);
+ const utility = h.forked[0];
+ if (!utility) throw new Error('missing host');
+ utility.throwOnPost = new Error('host gone');
+ expect(
+ h.mgr.adoptSession({ windowId: 1, ptyId: 'pty-1', webContents: wc, start: true }),
+ ).toEqual({ ok: false, reason: 'host-unavailable' });
+ expect(h.shellExits).toEqual([]);
+ });
+
+ test('the concurrency count reports live shells only, never outstanding reservations', () => {
+ const h = makeTelemetryManager();
+ const wc = makeWebContents();
+ h.start(1);
+ h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
+ h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
+ expect(
+ h.mgr.adoptSession({ windowId: 1, ptyId: 'pty-2', webContents: wc, start: true }).ok,
+ ).toBe(true);
+ expect(h.concurrent).toEqual([{ count: 1 }, { count: 2 }]);
+ });
+
+ test('a spawn-error books no shell exit at all — the shell never ran', () => {
const h = makeTelemetryManager();
h.start(1);
h.forked[0]?.emitMessage({ type: 'spawn-error', ptyId: 'pty-1', message: 'EMFILE' });
- expect(h.shellExits).toEqual([{ crashed: true }]);
+ expect(h.shellExits).toEqual([]);
expect(h.sessions).toEqual([]);
+ expect(h.warns).toContainEqual(
+ expect.objectContaining({ event: 'terminal-manager-spawn-error', message: 'EMFILE' }),
+ );
});
test('a host crash emits a crashed shell-exit and counts the session if a command ran', () => {
@@ -1061,7 +1565,7 @@ describe('createTerminalManager — telemetry', () => {
test('a window-close reap counts every concurrent session that ran a command', () => {
const h = makeTelemetryManager();
h.start(1);
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -1078,7 +1582,7 @@ describe('createTerminalManager — telemetry', () => {
test('a host crash emits a crashed shell-exit per session and counts only the ones that ran a command', () => {
const h = makeTelemetryManager();
h.start(1);
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -1091,13 +1595,40 @@ describe('createTerminalManager — telemetry', () => {
expect(h.sessions).toHaveLength(1);
});
- test('each create emits the concurrency signal with the window’s live session count', () => {
+ test('each started shell emits the concurrency signal with the window’s live session count', () => {
const h = makeTelemetryManager();
h.start(1);
h.start(1);
expect(h.concurrent.map((c) => c.count)).toEqual([1, 2]);
});
+ test('a reservation that never started emits no concurrency signal', () => {
+ const h = makeTelemetryManager();
+ h.mgr.create({
+ windowId: 1,
+ webContents: makeWebContents(),
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ expect(h.concurrent).toEqual([]);
+ });
+
+ test('a host crash books no crashed shell-exit for a session that never spawned', () => {
+ const h = makeTelemetryManager();
+ h.start(1);
+ h.mgr.create({
+ windowId: 1,
+ webContents: makeWebContents(),
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ h.forked[0]?.emitExit(1);
+ expect(h.shellExits).toEqual([{ crashed: true }]);
+ expect(h.exits().map((e) => e.ptyId)).toEqual(['pty-1', 'pty-2']);
+ });
+
test('concurrency is counted per window independently', () => {
const h = makeTelemetryManager();
h.start(1);
@@ -1117,7 +1648,7 @@ describe('createTerminalManager — telemetry', () => {
test('a refused create (no project) emits no concurrency signal', () => {
const h = makeTelemetryManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: null,
@@ -1150,14 +1681,14 @@ describe('createTerminalManager — concurrent sessions', () => {
function twoSessions(over?: Partial<TerminalManagerDeps>) {
const h = makeManager({ highWaterBytes: 100, lowWaterBytes: 20, ...over });
const wc = makeWebContents();
- const a = h.mgr.create({
+ const a = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: wc,
projectRoot: PROJECT,
cols: 80,
rows: 24,
});
- const b = h.mgr.create({
+ const b = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: wc,
projectRoot: PROJECT,
@@ -1271,13 +1802,13 @@ describe('createTerminalManager — concurrent sessions', () => {
ptyId: 'pty-1',
exitCode: 7,
signal: null,
- error: 'terminal host exited',
+ hostExited: true,
});
expect(h.exits()).toContainEqual({
ptyId: 'pty-2',
exitCode: 7,
signal: null,
- error: 'terminal host exited',
+ hostExited: true,
});
});
@@ -1317,8 +1848,20 @@ describe('createTerminalManager — reload-survival metadata (label + order)', (
test('listSessions returns creation order with null label/ordinal until set', () => {
const h = makeManager();
const wc = makeWebContents();
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
expect(h.mgr.listSessions(1)).toEqual([
{ ptyId: 'pty-1', customLabel: null, ordinal: null },
{ ptyId: 'pty-2', customLabel: null, ordinal: null },
@@ -1328,9 +1871,27 @@ describe('createTerminalManager — reload-survival metadata (label + order)', (
test('setSessionMeta persists name + ordinal, setSessionOrder reorders, listSessions restores both', () => {
const h = makeManager();
const wc = makeWebContents();
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
h.mgr.setSessionMeta({ windowId: 1, ptyId: 'pty-1', customLabel: 'alpha', ordinal: 1 });
h.mgr.setSessionMeta({ windowId: 1, ptyId: 'pty-3', customLabel: 'gamma', ordinal: 3 });
@@ -1346,7 +1907,13 @@ describe('createTerminalManager — reload-survival metadata (label + order)', (
test('setSessionMeta is a partial update — one field never clobbers the other', () => {
const h = makeManager();
const wc = makeWebContents();
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
h.mgr.setSessionMeta({ windowId: 1, ptyId: 'pty-1', ordinal: 5 });
h.mgr.setSessionMeta({ windowId: 1, ptyId: 'pty-1', customLabel: 'renamed' });
expect(h.mgr.listSessions(1)).toEqual([{ ptyId: 'pty-1', customLabel: 'renamed', ordinal: 5 }]);
@@ -1357,17 +1924,41 @@ describe('createTerminalManager — reload-survival metadata (label + order)', (
test('a session created after a reorder appends after the reordered block', () => {
const h = makeManager();
const wc = makeWebContents();
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
h.mgr.setSessionOrder({ windowId: 1, orderedPtyIds: ['pty-2', 'pty-1'] });
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
expect(h.mgr.listSessions(1).map((e) => e.ptyId)).toEqual(['pty-2', 'pty-1', 'pty-3']);
});
test('setSessionMeta / setSessionOrder on an unknown window or ptyId is a no-op', () => {
const h = makeManager();
const wc = makeWebContents();
- h.mgr.create({ windowId: 1, webContents: wc, projectRoot: PROJECT, cols: 80, rows: 24 });
+ createStartedTerminal(h.mgr, {
+ windowId: 1,
+ webContents: wc,
+ projectRoot: PROJECT,
+ cols: 80,
+ rows: 24,
+ });
h.mgr.setSessionMeta({ windowId: 999, ptyId: 'pty-1', customLabel: 'x' });
h.mgr.setSessionMeta({ windowId: 1, ptyId: 'pty-UNKNOWN', customLabel: 'x' });
h.mgr.setSessionOrder({ windowId: 999, orderedPtyIds: ['pty-1'] });
diff --git a/packages/desktop/tests/main/terminal-reload-survival.test.ts b/packages/desktop/tests/main/terminal-reload-survival.test.ts
index 2646cfc89..59e515100 100644
--- a/packages/desktop/tests/main/terminal-reload-survival.test.ts
+++ b/packages/desktop/tests/main/terminal-reload-survival.test.ts
@@ -7,6 +7,7 @@ import {
} from '../../src/main/terminal-manager.ts';
import type { SendableWebContents } from '../../src/shared/ipc-send.ts';
import type { PtyHostIncomingMessage } from '../../src/utility/pty-host.ts';
+import { createStartedTerminal } from '../support/terminal-create.test-helper.ts';
class FakeUtility {
posted: PtyHostIncomingMessage[] = [];
@@ -50,6 +51,7 @@ function makeManager(over?: Partial<TerminalManagerDeps>) {
const forked: FakeUtility[] = [];
let idn = 0;
const mgr = createTerminalManager({
+ canSpawnAt: () => true,
forkPtyHost: () => {
const u = new FakeUtility();
forked.push(u);
@@ -121,14 +123,14 @@ describe('issue #351 — the terminal manager exposes a per-window live-session
test('enumerates the live sessions for a window and tracks their lifecycle', () => {
const h = makeManager();
const wc = makeWebContents();
- const a = h.mgr.create({
+ const a = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: wc,
projectRoot: PROJECT,
cols: 80,
rows: 24,
});
- const b = h.mgr.create({
+ const b = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: wc,
projectRoot: PROJECT,
@@ -151,14 +153,14 @@ describe('issue #351 — the terminal manager exposes a per-window live-session
test("a separate window's sessions are not reported for this window", () => {
const h = makeManager();
- const a = h.mgr.create({
+ const a = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
cols: 80,
rows: 24,
});
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 2,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -176,7 +178,7 @@ describe('issue #351 — the terminal manager exposes a per-window live-session
describe('issue #351 — re-adopting a surviving session is edge-correct across the reload gap', () => {
test('a ptyId no longer live for the window is refused with unknown-session', () => {
const h = makeManager();
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -195,7 +197,7 @@ describe('issue #351 — re-adopting a surviving session is edge-correct across
test('adopting a live session succeeds and clears its stale backpressure', () => {
const h = makeManager();
- const created = h.mgr.create({
+ const created = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -223,7 +225,7 @@ describe('issue #351 — re-adopting a surviving session is edge-correct across
test('adopting a live session replays its pre-reload output into the reloaded renderer', () => {
const h = makeManager();
- const created = h.mgr.create({
+ const created = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -253,7 +255,7 @@ describe('issue #351 — re-adopting a surviving session is edge-correct across
test('adoption retains the resolved Windows shell family for path escaping', () => {
const h = makeManager();
- const created = h.mgr.create({
+ const created = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -278,7 +280,7 @@ describe('issue #351 — re-adopting a surviving session is edge-correct across
test('adoption retains a standing unsupported-shell capability notice', () => {
const h = makeManager();
- const created = h.mgr.create({
+ const created = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -317,7 +319,7 @@ describe('issue #351 — re-adopting a surviving session is edge-correct across
},
});
const deadRenderer = makeWebContents();
- const created = h.mgr.create({
+ const created = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: deadRenderer,
projectRoot: PROJECT,
@@ -347,7 +349,7 @@ describe('issue #351 — re-adopting a surviving session is edge-correct across
test('the replay buffer is capped — oldest output is trimmed, the recent tail is kept', () => {
const h = makeManager({ replayCapBytes: 10 });
- const created = h.mgr.create({
+ const created = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -376,7 +378,7 @@ describe('issue #351 — re-adopting a surviving session is edge-correct across
test('a host that dies between the presence check and the resume post is refused and warned', () => {
const warns: Record<string, unknown>[] = [];
const h = makeManager({ logger: { warn: (o) => warns.push(o) } });
- const created = h.mgr.create({
+ const created = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
@@ -396,7 +398,7 @@ describe('issue #351 — re-adopting a surviving session is edge-correct across
ptyId: idLive,
webContents: makeWebContents(),
});
- expect(outcome).toEqual({ ok: false, reason: 'unknown-session' });
+ expect(outcome).toEqual({ ok: false, reason: 'host-unavailable' });
expect(warns).toHaveLength(1);
expect(warns[0]).toMatchObject({
event: 'terminal-manager-adopt-resume-failed',
@@ -408,14 +410,14 @@ describe('issue #351 — re-adopting a surviving session is edge-correct across
test('a ptyId belonging to another window is refused (no cross-window adoption)', () => {
const h = makeManager();
- const w1 = h.mgr.create({
+ const w1 = createStartedTerminal(h.mgr, {
windowId: 1,
webContents: makeWebContents(),
projectRoot: PROJECT,
cols: 80,
rows: 24,
});
- h.mgr.create({
+ createStartedTerminal(h.mgr, {
windowId: 2,
webContents: makeWebContents(),
projectRoot: PROJECT,
diff --git a/packages/desktop/tests/main/terminal-window-attach-survival.test.ts b/packages/desktop/tests/main/terminal-window-attach-survival.test.ts
index 385f697f1..0aae10839 100644
--- a/packages/desktop/tests/main/terminal-window-attach-survival.test.ts
+++ b/packages/desktop/tests/main/terminal-window-attach-survival.test.ts
@@ -14,6 +14,7 @@ import {
type WindowManagerDeps,
} from '../../src/main/window-manager.ts';
import type { SendableWebContents } from '../../src/shared/ipc-send.ts';
+import { createStartedTerminal } from '../support/terminal-create.test-helper.ts';
const HOME = '/Users/test-home';
const PROJECT = '/tmp/attach-survival-project';
@@ -54,6 +55,7 @@ function makeTerminalManager() {
const shutdownTimers: Array<() => void> = [];
let idn = 0;
const mgr = createTerminalManager({
+ canSpawnAt: () => true,
forkPtyHost: () => {
const h = new FakeHost();
forked.push(h);
@@ -181,7 +183,7 @@ describe('terminal window PTY survives owner-server teardown (seam 6 / FR4 / D2)
const { mgr, forked, dataPushes, runShutdownTimers } = makeTerminalManager();
const termWc = makeWebContents();
- const created = mgr.create({
+ const created = createStartedTerminal(mgr, {
windowId: TERM_WIN_ID,
webContents: termWc,
projectRoot: cwd,
diff --git a/packages/desktop/tests/main/terminal-window-pty.test.ts b/packages/desktop/tests/main/terminal-window-pty.test.ts
index 55d66a91b..c04b2c984 100644
--- a/packages/desktop/tests/main/terminal-window-pty.test.ts
+++ b/packages/desktop/tests/main/terminal-window-pty.test.ts
@@ -7,6 +7,7 @@ import {
unregisterTerminalWindow,
} from '../../src/main/terminal-window-registry.ts';
import type { SendableWebContents } from '../../src/shared/ipc-send.ts';
+import { createStartedTerminal } from '../support/terminal-create.test-helper.ts';
const HOME = '/Users/test-home';
const PROJECT = '/Users/me/proj';
@@ -30,6 +31,7 @@ function makeManager() {
const forked: FakeHost[] = [];
let idn = 0;
const mgr = createTerminalManager({
+ canSpawnAt: () => true,
forkPtyHost: () => {
const h = new FakeHost();
forked.push(h);
@@ -69,7 +71,7 @@ describe('terminal window ok:pty:create cwd resolution (seam 7 / D10)', () => {
expect(cwd).toBe(PROJECT);
const { mgr, forked } = makeManager();
- const result = mgr.create({
+ const result = createStartedTerminal(mgr, {
windowId: WIN_BOUND,
webContents: makeWebContents(),
projectRoot: cwd,
@@ -95,7 +97,7 @@ describe('terminal window ok:pty:create cwd resolution (seam 7 / D10)', () => {
expect(cwd).toBe(HOME);
const { mgr, forked } = makeManager();
- const result = mgr.create({
+ const result = createStartedTerminal(mgr, {
windowId: WIN_LESS,
webContents: makeWebContents(),
projectRoot: cwd,
@@ -119,14 +121,14 @@ describe('terminal window ok:pty:create cwd resolution (seam 7 / D10)', () => {
registerTerminalWindow(WIN_B, { projectRoot: PROJECT });
const { mgr, forked } = makeManager();
- const a = mgr.create({
+ const a = createStartedTerminal(mgr, {
windowId: WIN_A,
webContents: makeWebContents(),
projectRoot: resolveTerminalWindowCwd(WIN_A),
cols: 80,
rows: 24,
});
- const b = mgr.create({
+ const b = createStartedTerminal(mgr, {
windowId: WIN_B,
webContents: makeWebContents(),
projectRoot: resolveTerminalWindowCwd(WIN_B),
diff --git a/packages/desktop/tests/smoke/terminal-collection-size.json b/packages/desktop/tests/smoke/terminal-collection-size.json
index cde93690b..869876892 100644
--- a/packages/desktop/tests/smoke/terminal-collection-size.json
+++ b/packages/desktop/tests/smoke/terminal-collection-size.json
@@ -1,4 +1,4 @@
{
"$comment": "Total tests collected by `playwright test tests/smoke/terminal-*.e2e.ts`, skipped ones included. Inkeep runs that collection sharded across parallel Windows CI cells and sums each shard's Playwright JSON stats against this number, so a shard that never ran cannot leave part of the collection unexecuted while every cell reads green. That guard and the workflow driving it live in Inkeep's internal monorepo, so whether a stale number fails anything depends on which checkout you are reading: it does there, and in the public mirror the guard is absent and nothing reads this file. Add or remove a terminal smoke test and this number moves with it either way; the guard prints the observed total when the two disagree.",
- "terminalSmokeTestCount": 39
+ "terminalSmokeTestCount": 41
}
diff --git a/packages/desktop/tests/smoke/terminal-tabs.e2e.ts b/packages/desktop/tests/smoke/terminal-tabs.e2e.ts
index 1a832e691..e758387a1 100644
--- a/packages/desktop/tests/smoke/terminal-tabs.e2e.ts
+++ b/packages/desktop/tests/smoke/terminal-tabs.e2e.ts
@@ -4,7 +4,7 @@ import { join } from 'node:path';
import type { ElectronApplication, Locator, Page } from '@playwright/test';
import { _electron as electron } from '@playwright/test';
import { desktopLaunchOptions, resolveDesktopTarget } from './_helpers/launch-desktop';
-import { launchDesktopApp } from './_helpers/launch-readiness';
+import { launchDesktopApp, waitForWindowByMode } from './_helpers/launch-readiness';
import {
PTY_PLATFORM_SKIP_REASON,
PTY_PLATFORM_SUPPORTED,
@@ -92,20 +92,8 @@ async function launchApp(s: Seed): Promise<ElectronApplication> {
});
}
-async function findEditorWindow(app: ElectronApplication, timeoutMs = 25_000): Promise<Page> {
- let page: Page | undefined;
- await expect(async () => {
- for (const p of app.windows()) {
- const mode = await p.evaluate(() => window.okDesktop?.config?.mode).catch(() => undefined);
- if (mode === 'editor') {
- page = p;
- return;
- }
- }
- throw new Error('no editor window yet');
- }).toPass({ timeout: timeoutMs });
- if (!page) throw new Error('editor window vanished after readiness poll');
- return page;
+async function findEditorWindow(app: ElectronApplication): Promise<Page> {
+ return waitForWindowByMode(app, 'editor', { capMs: 25_000 });
}
async function clickViewTerminalItem(app: ElectronApplication): Promise<void> {
@@ -196,6 +184,88 @@ test.describe('Terminal tabs — live Electron', () => {
test.skip(!SMOKE_ENABLED, 'Set OK_DESKTOP_E2E_SMOKE=1 to run Electron smoke tests.');
test.skip(!PTY_PLATFORM_SUPPORTED, PTY_PLATFORM_SKIP_REASON);
test.skip(!TARGET.exists, TARGET.missingReason);
+
+ test('first and second tabs display their initial prompt without keyboard input', async ({
+ captureStderrFor,
+ }) => {
+ const s = seed('initial-prompts');
+ const app = await launchApp(s);
+ captureStderrFor(app, { home: s.tmpHome, cleanupDirs: [s.tmpHome, s.projectDir] });
+ const page = await findEditorWindow(app);
+ const expectPrompt = async () => {
+ await expect(visibleSection(page)).toBeVisible();
+ await expect
+ .poll(async () => (await readActiveText(page)).trim(), { timeout: 25_000 })
+ .not.toBe('');
+ await expect(visibleSection(page).getByTestId('terminal-starting-notice')).toHaveCount(0);
+ };
+ await clickViewTerminalItem(app);
+ await expectPrompt();
+ await openBareTerminalTab(page, expectPrompt);
+ await expect(terminalTabs(page)).toHaveCount(2);
+ });
+
+ test('no output arrives before the explicit start, and the initial prompt survives a late one', async ({
+ captureStderrFor,
+ }) => {
+ const s = seed('delayed-attach');
+ const app = await launchApp(s);
+ captureStderrFor(app, { home: s.tmpHome, cleanupDirs: [s.tmpHome, s.projectDir] });
+ const page = await findEditorWindow(app);
+ await clickViewTerminalItem(app);
+ await expect(visibleSection(page)).toBeVisible();
+ await expect
+ .poll(async () => (await readActiveText(page)).trim(), { timeout: 25_000 })
+ .not.toBe('');
+ const output = await page.evaluate(async () => {
+ const bridge = window.okDesktop;
+ if (!bridge) throw new Error('missing desktop bridge');
+ const created = await bridge.terminal.create({ cols: 80, rows: 24 });
+ if (!created.ok) throw new Error(created.reason);
+ const beforeStart: string[] = [];
+ let onData = (data: string): void => {
+ beforeStart.push(data);
+ };
+ const unsubscribe = bridge.terminal.onData((message) => {
+ if (message.ptyId !== created.ptyId || message.data.length === 0) return;
+ bridge.terminal.drain(message.ptyId, message.data.length);
+ onData(message.data);
+ });
+ let unsubscribeExit = () => {};
+ let timer: ReturnType<typeof setTimeout> | undefined;
+ try {
+ await new Promise((resolve) => setTimeout(resolve, 500));
+ const started = await new Promise<string>((resolve, reject) => {
+ timer = setTimeout(() => reject(new Error('initial prompt did not arrive')), 15_000);
+ onData = resolve;
+ unsubscribeExit = bridge.terminal.onExit((message) => {
+ if (message.ptyId === created.ptyId) {
+ reject(
+ new Error(
+ message.error ??
+ (message.neverStarted
+ ? 'shell never started'
+ : `shell exited: ${message.exitCode}`),
+ ),
+ );
+ }
+ });
+ void bridge.terminal.start(created.ptyId).then((attached) => {
+ if (!attached.ok) reject(new Error(attached.reason));
+ }, reject);
+ });
+ return { beforeStart, started };
+ } finally {
+ clearTimeout(timer);
+ unsubscribe();
+ unsubscribeExit();
+ await bridge.terminal.kill(created.ptyId);
+ }
+ });
+ expect(output.beforeStart).toEqual([]);
+ expect(output.started).not.toBe('');
+ });
+
test('a second tab spawns its own live shell (independent sessions)', async ({
captureStderrFor,
}) => {
diff --git a/packages/desktop/tests/support/pty-readiness.test-helper.ts b/packages/desktop/tests/support/pty-readiness.test-helper.ts
index 22098a336..e53354c0f 100644
--- a/packages/desktop/tests/support/pty-readiness.test-helper.ts
+++ b/packages/desktop/tests/support/pty-readiness.test-helper.ts
@@ -40,7 +40,8 @@ export function createPtyHostProbe(options: PtyHostProbeOptions): PtyHostProbe {
if (msg.type === 'data') data.set(msg.ptyId, (data.get(msg.ptyId) ?? '') + msg.data);
else if (msg.type === 'exit')
exits.set(msg.ptyId, { exitCode: msg.exitCode, signal: msg.signal });
- else if (msg.type === 'spawn-error') errors.set(msg.ptyId, msg.message);
+ else if (msg.type === 'spawn-error')
+ errors.set(msg.ptyId, msg.message ?? msg.launchFailure);
},
},
spawn: options.spawn,
diff --git a/packages/desktop/tests/support/terminal-create.test-helper.ts b/packages/desktop/tests/support/terminal-create.test-helper.ts
new file mode 100644
index 000000000..c73b80d27
--- /dev/null
+++ b/packages/desktop/tests/support/terminal-create.test-helper.ts
@@ -0,0 +1,18 @@
+import type { TerminalManager } from '../../src/main/terminal-manager.ts';
+
+export function createStartedTerminal(
+ manager: TerminalManager,
+ request: Parameters<TerminalManager['create']>[0],
+): ReturnType<TerminalManager['create']> {
+ const result = manager.create(request);
+ if (result.ok) {
+ const attached = manager.adoptSession({
+ windowId: request.windowId,
+ start: true,
+ ptyId: result.ptyId,
+ webContents: request.webContents,
+ });
+ if (!attached.ok) throw new Error(attached.reason);
+ }
+ return result;
+}
diff --git a/packages/desktop/tests/utility/pty-flood.harness.ts b/packages/desktop/tests/utility/pty-flood.harness.ts
index b90fcc0e3..54adc2951 100644
--- a/packages/desktop/tests/utility/pty-flood.harness.ts
+++ b/packages/desktop/tests/utility/pty-flood.harness.ts
@@ -16,6 +16,7 @@ import {
setupPtyHost,
} from '../../src/utility/pty-host.ts';
import { removeTempDirBestEffort } from '../support/temp-dir-cleanup.test-helper.ts';
+import { createStartedTerminal } from '../support/terminal-create.test-helper.ts';
const require = createRequire(import.meta.url);
@@ -201,6 +202,7 @@ async function runFloodScenario(opts: FloodOptions): Promise<FloodMetrics> {
};
manager = createTerminalManager({
+ canSpawnAt: () => true,
forkPtyHost: () => bridge,
sendData: (_wc, payload) => {
chunks.push(payload.data);
@@ -253,7 +255,13 @@ async function runFloodScenario(opts: FloodOptions): Promise<FloodMetrics> {
: null;
try {
- manager.create({ windowId: 1, webContents, projectRoot: tmp, cols: 80, rows: 24 });
+ createStartedTerminal(manager, {
+ windowId: 1,
+ webContents,
+ projectRoot: tmp,
+ cols: 80,
+ rows: 24,
+ });
await waitFor(() => totalPushed > 0, 'shell prompt', 15000);
const floodStart = Date.now();
@@ -398,6 +406,7 @@ function createMultiSessionRig(opts: {
};
manager = createTerminalManager({
+ canSpawnAt: () => true,
forkPtyHost: () => bridge,
sendData: (_wc, payload) => {
const session = sessions.get(payload.ptyId);
@@ -460,7 +469,7 @@ function createMultiSessionRig(opts: {
bridge,
tmp,
addSession(spec): SessionRuntime {
- const result = manager.create({
+ const result = createStartedTerminal(manager, {
windowId: 1,
webContents,
projectRoot: tmp,
diff --git a/packages/desktop/tests/utility/pty-host.test.ts b/packages/desktop/tests/utility/pty-host.test.ts
index 064d42d3b..71cbd23f5 100644
--- a/packages/desktop/tests/utility/pty-host.test.ts
+++ b/packages/desktop/tests/utility/pty-host.test.ts
@@ -1574,14 +1574,18 @@ describe('buildShellArgs Windows launch composition', () => {
expect.objectContaining({
type: 'spawn-error',
ptyId: 'p1',
- message: expect.stringMatching(/unsafe batch argument/),
+ launchFailure: 'unsafe-argument',
}),
);
+ expect(h.posted).not.toContainEqual(
+ expect.objectContaining({ type: 'spawn-error', message: expect.any(String) }),
+ );
expect(warnings).toContainEqual(
expect.objectContaining({
event: 'pty-host-launch-compose-failed',
platform: 'win32',
rung: 'override',
+ launchFailure: 'unsafe-argument',
}),
);