diff --git a/src/renderer/src/components/orca-cloud/offline/CloudAsleepTerminalNotice.tsx b/src/renderer/src/components/orca-cloud/offline/CloudAsleepTerminalNotice.tsx
index 863b5c4acc5..800afd8b7e8 100644
--- a/src/renderer/src/components/orca-cloud/offline/CloudAsleepTerminalNotice.tsx
+++ b/src/renderer/src/components/orca-cloud/offline/CloudAsleepTerminalNotice.tsx
@@ -5,10 +5,14 @@ import { useTranslate } from '@/i18n/use-translate'
import { getIntlLocale } from '@/i18n/i18n'
import { wakeCloudWorkspace } from '../cloud-workspace-actions'
-export function formatAsleepSince(at: number): string {
- return new Intl.DateTimeFormat(getIntlLocale(), { hour: 'numeric', minute: '2-digit' }).format(
- new Date(at)
- )
+/** "3:10 PM" today; "Nov 10, 3:10 PM" once it has been asleep across a day boundary. */
+export function formatAsleepSince(at: number, now = Date.now()): string {
+ const sameDay = new Date(at).toDateString() === new Date(now).toDateString()
+ return new Intl.DateTimeFormat(getIntlLocale(), {
+ ...(sameDay ? {} : { month: 'short', day: 'numeric' }),
+ hour: 'numeric',
+ minute: '2-digit'
+ }).format(new Date(at))
}
/**
diff --git a/src/renderer/src/components/orca-cloud/offline/CloudWakeTerminalNotices.test.tsx b/src/renderer/src/components/orca-cloud/offline/CloudWakeTerminalNotices.test.tsx
index 3f7772ca2f0..6c520236610 100644
--- a/src/renderer/src/components/orca-cloud/offline/CloudWakeTerminalNotices.test.tsx
+++ b/src/renderer/src/components/orca-cloud/offline/CloudWakeTerminalNotices.test.tsx
@@ -1,8 +1,9 @@
// @vitest-environment happy-dom
import { afterEach, describe, expect, it, vi } from 'vitest'
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
-import { CloudAsleepTerminalNotice } from './CloudAsleepTerminalNotice'
-import { CloudWokeProcessesNotice } from './CloudWokeProcessesNotice'
+import { CloudAsleepTerminalNotice, formatAsleepSince } from './CloudAsleepTerminalNotice'
+import { CloudWokeProcessesNotice, truncateMiddle } from './CloudWokeProcessesNotice'
+import { noteUserInputForPane } from '@/components/terminal-pane/input/pane-user-input'
vi.mock('../cloud-workspace-actions', () => ({ wakeCloudWorkspace: vi.fn() }))
vi.mock('@/i18n/use-translate', () => ({
@@ -12,6 +13,13 @@ vi.mock('@/i18n/use-translate', () => ({
)
}))
afterEach(() => cleanup())
+if (globalThis.ResizeObserver === undefined) {
+ globalThis.ResizeObserver = class {
+ observe(): void {}
+ unobserve(): void {}
+ disconnect(): void {}
+ } as unknown as typeof ResizeObserver
+}
describe('CloudAsleepTerminalNotice', () => {
it('greys the scrollback and shows the "Asleep since" divider', () => {
@@ -35,8 +43,44 @@ describe('CloudWokeProcessesNotice', () => {
const onRerun = vi.fn()
render()
expect(screen.getByText('Woke up · processes stopped while asleep')).toBeTruthy()
+ expect(screen.getByRole('button', { name: /Rerun pnpm dev/ }).getAttribute('title')).toBe(
+ 'pnpm dev'
+ )
expect(onRerun).not.toHaveBeenCalled()
fireEvent.click(screen.getByRole('button', { name: /Rerun pnpm dev/ }))
expect(onRerun).toHaveBeenCalledTimes(1)
})
+
+ it('truncates a long command in the middle, keeping both ends', () => {
+ const long = 'python3 -m http.server --directory /very/long/path/to/site 8000'
+ const short = truncateMiddle(long, 24)
+ expect(short.length).toBe(24)
+ expect(short.startsWith('python3')).toBe(true)
+ expect(short.endsWith('8000')).toBe(true)
+ })
+
+ it('goes away once the person types in the pane', () => {
+ vi.useFakeTimers()
+ const onDismiss = vi.fn()
+ render(
+
+ )
+ noteUserInputForPane('leaf-x', Date.now() + 1)
+ vi.advanceTimersByTime(600)
+ expect(onDismiss).toHaveBeenCalled()
+ vi.useRealTimers()
+ })
+})
+
+describe('formatAsleepSince', () => {
+ it('adds the date once it has been asleep across a day boundary', () => {
+ const at = new Date(2026, 10, 10, 15, 10).getTime()
+ expect(formatAsleepSince(at, new Date(2026, 10, 10, 18, 0).getTime())).not.toMatch(/Nov/)
+ expect(formatAsleepSince(at, new Date(2026, 10, 11, 9, 0).getTime())).toMatch(/Nov/)
+ })
})
diff --git a/src/renderer/src/components/orca-cloud/offline/CloudWokeProcessesNotice.tsx b/src/renderer/src/components/orca-cloud/offline/CloudWokeProcessesNotice.tsx
index 1092aa386fd..cf4d07c3dc2 100644
--- a/src/renderer/src/components/orca-cloud/offline/CloudWokeProcessesNotice.tsx
+++ b/src/renderer/src/components/orca-cloud/offline/CloudWokeProcessesNotice.tsx
@@ -1,55 +1,76 @@
-import React from 'react'
-import { RotateCcw, X } from 'lucide-react'
+import React, { useEffect, useState } from 'react'
+import { RotateCcw } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { useTranslate } from '@/i18n/use-translate'
+import { PaneTopWarningBanner } from '@/components/terminal-pane/appearance/pane-top-banner/PaneTopWarningBanner'
+import { paneHadUserInputSince } from '@/components/terminal-pane/input/pane-user-input'
+
+const MAX_COMMAND_CHARS = 48
+
+/** "python3 -m http…server 8000": keeps both ends of a long command readable. */
+export function truncateMiddle(text: string, max = MAX_COMMAND_CHARS): string {
+ if (text.length <= max) {
+ return text
+ }
+ const keep = max - 1
+ const head = Math.ceil(keep / 2)
+ return `${text.slice(0, head)}…${text.slice(text.length - (keep - head))}`
+}
/**
* After a wake, in a pane that was running something when the workspace went to sleep: sleep is a
- * reboot, so the process is gone. One line says so and offers the command back; it never runs it
- * by itself (JA-15).
+ * reboot, so the process is gone. A strip at the top of the pane (it reserves its height, so it
+ * never covers terminal rows) says so and offers the command back; it never runs it by itself, and
+ * it goes away once the person types in the pane (JA-15).
*/
export function CloudWokeProcessesNotice({
command,
+ paneLeafId,
onRerun,
onDismiss
}: {
command: string
+ /** When set, typing into this pane dismisses the strip. */
+ paneLeafId?: string
onRerun: () => void
onDismiss: () => void
}): React.JSX.Element {
const t = useTranslate()
+ const [shownAt] = useState(() => Date.now())
+ useEffect(() => {
+ if (!paneLeafId) {
+ return
+ }
+ const timer = setInterval(() => {
+ if (paneHadUserInputSince(paneLeafId, shownAt)) {
+ onDismiss()
+ }
+ }, 500)
+ return () => clearInterval(timer)
+ }, [paneLeafId, shownAt, onDismiss])
return (
-
-
- {t(
- 'orcaCloudWorkspace.terminal.wokeProcessesStopped',
- 'Woke up · processes stopped while asleep'
- )}
-
-
-
-
+
+
+ {t('orcaCloudWorkspace.terminal.rerunLabel', 'Rerun')}
+ {truncateMiddle(command)}
+
+ }
+ onDismiss={onDismiss}
+ />
)
}
diff --git a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/TerminalPaneRecoveryPortals.tsx b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/TerminalPaneRecoveryPortals.tsx
index e5c5c57589b..7dcef37ba69 100644
--- a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/TerminalPaneRecoveryPortals.tsx
+++ b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/TerminalPaneRecoveryPortals.tsx
@@ -238,6 +238,7 @@ export function TerminalPaneRecoveryPortals({
return createPortal(
{
dismissWakeProcessHint(pane.leafId)
paneTransportsRef.current
diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json
index ec448c98c22..17099da4084 100644
--- a/src/renderer/src/i18n/locales/en.json
+++ b/src/renderer/src/i18n/locales/en.json
@@ -26967,7 +26967,11 @@
"recentCommits": "Recent commits"
},
"terminal": {
- "asleepHistoryKept": "This workspace is asleep. Your terminal history is kept."
+ "asleepHistoryKept": "This workspace is asleep. Your terminal history is kept.",
+ "asleepSince": "Asleep since {{time}}",
+ "rerun": "Rerun {{command}}",
+ "rerunLabel": "Rerun",
+ "wokeProcessesStopped": "Woke up · processes stopped while asleep"
}
},
"cloudAgentSetup": {