mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 09:07:40 +00:00
* Stop timing out slow profile-state writes; warn instead Profile-state writes used to fault after 30 seconds. A stalled main loop or a slow disk could then drop the writer and show a "could not confirm your save" dialog, even when the write was still in progress. Slow requests now record a diagnostic breadcrumb and keep waiting for the worker's reply. Close waits for the worker to actually exit, and a termination request alone no longer counts as proof. Pane-alias and migration-listener changes now save only their own sections, not a full state rebuild. Quit teardown also keeps the profile admission held until the final flush finishes, so a pending write is no longer released early at the deadline. * fix tests * Warn when profile saves run slow Slow profile-state writes used to leave only a diagnostic log entry, so users had no way to tell that recent changes were not yet confirmed saved. The writer now reports when a save write passes the slow-warning threshold and reports recovery when the reply arrives. Writes are never failed or retried because of the delay. - Main keeps the current delayed/healthy status and publishes changes to the renderer, so a reopened window gets the correct state. - The renderer shows one persistent warning toast while a save is delayed and dismisses it on recovery. - Observer errors are logged and do not interrupt saving. - The web build reports saving as healthy because it does not use the desktop profile writer. * Fix save-delay toast dismissal racing with a re-shown warning The save-delay warning used one fixed toast ID. Sonner applies a dismissal a frame late, so a dismissal could remove a warning that had just been shown again with the same ID. The hook now tracks the ID of each delayed-save warning it shows and dismisses only that toast. A new delay gets a fresh ID. Add Sonner-level tests for remount, StrictMode cleanup, and recover-then- delay races. Harden the e2e spec with a paused clock and a retry around main-process evaluate. * Report slow profile revision checks and exports as save delays Revision checks and JSON exports run on the same profile-state worker as saves, so a slow one holds up later writes just like a slow write does. The save-delay warning only tracked write-* commands, so those stalls went unreported. Every command except initialize and close now raises the warning. Tests cover the export-latest path and assert the delay signal fires once with true before clearing. * Clarify slow-save toast to name profile storage The delayed-save warning said recent changes were not yet confirmed saved, which overstated the risk while Orca was still retrying. The real condition is a slow profile-state write, so the toast now names profile storage and says later saves may wait until that operation finishes. The copy is updated in every locale, and the unit and e2e tests that assert it are updated to match.
102 lines
5.8 KiB
TypeScript
102 lines
5.8 KiB
TypeScript
import type { AppIdentity } from '../../shared/app-identity'
|
|
import type { E2EConfig } from '../../shared/e2e-config'
|
|
import type { ExecutionHostId } from '../../shared/execution-host'
|
|
import type {
|
|
WriteTerminalRenderDesyncEvidenceArgs,
|
|
WriteTerminalRenderDesyncEvidenceResult
|
|
} from '../../shared/terminal-render-desync-evidence'
|
|
import type { MacCapturedDigitRowChord } from '../../shared/macos-symbolic-hotkeys'
|
|
import type { MarkdownDocument } from '../../shared/filesystem-entry-types'
|
|
import type { PersistedUIState } from '../../shared/persisted-ui-state-types'
|
|
import type { FloatingTerminalCwdRequest } from '../../shared/ui-chrome-types'
|
|
import type { WorkspaceSessionState } from '../../shared/workspace-session-state-types'
|
|
import type { KeyboardLayoutSnapshot } from '../../shared/keyboard-layout-snapshot'
|
|
import type { KeyboardLayoutChangeEvent } from '../../shared/keyboard-layout-events'
|
|
|
|
export type AppApi = {
|
|
/** A local profile storage operation is delayed and holds up subsequent saves. */
|
|
isProfileStateSaveDelayed: () => Promise<boolean>
|
|
onProfileStateSaveDelayChanged: (callback: (delayed: boolean) => void) => () => void
|
|
/** Returns the app identity currently exposed to native chrome and the titlebar. */
|
|
getIdentity: () => Promise<AppIdentity>
|
|
/** Returns a URL base for feature-wall assets. In dev this is Vite /@fs;
|
|
* in packaged builds this is file:// resources. Renderer appends filenames. */
|
|
getFeatureWallAssetBaseUrl: () => Promise<string>
|
|
/** Relaunches the app (app.relaunch() + app.exit(0)) for settings that need a full restart to apply. */
|
|
relaunch: () => Promise<void>
|
|
/** Restarts Orca through the normal quit pipeline so daemon-backed terminal
|
|
* sessions survive and can reattach after the new process starts. */
|
|
restart: () => Promise<void>
|
|
/** Reloads the current app renderer through main so expected renderer
|
|
* teardown can be classified before Electron emits process-gone events. */
|
|
reload: () => Promise<void>
|
|
/** Stages the renderer's final state synchronously before unload. */
|
|
stageBeforeUnloadSync: (args: {
|
|
sessions: { state: WorkspaceSessionState; hostId?: ExecutionHostId }[]
|
|
ui: Partial<PersistedUIState>
|
|
}) => void
|
|
/** Resolves once the last staged checkpoint is durably written; rejects if that
|
|
* write failed, so a reload/restart can abort instead of losing the snapshot. */
|
|
awaitBeforeUnloadCheckpoint: () => Promise<void>
|
|
/** Resolves when the daemon PTY provider and hook receiver have either
|
|
* started or failed open for the first BrowserWindow. */
|
|
awaitFirstWindowStartupServices: () => Promise<void>
|
|
/** Resolves when host Git can run: shell-PATH generation is published and the
|
|
* managed WSL CLI registration has reconciled. Does not wait on PTY services. */
|
|
awaitGitEnvironmentStartupBarrier: () => Promise<void>
|
|
/** Inventories retained PTYs and restores durable structured ownership before renderer adoption. */
|
|
prepareTerminalStartupRestoration: () => Promise<void>
|
|
/** Whether this machine's runtime holds a structured chat, saved or live. */
|
|
holdsStructuredAgentSessions: () => Promise<boolean>
|
|
/** Fires when that answer changes, e.g. when a paired client creates the first chat here. */
|
|
onStructuredAgentSessionsHeldChanged: (callback: (held: boolean) => void) => () => void
|
|
/** Reconciles legacy worker authority around persisted terminal reconnect. */
|
|
recoverLegacyWorkerTerminalsForRendererStartup: () => Promise<void>
|
|
/** Emits a startup benchmark marker when ORCA_STARTUP_DIAGNOSTICS is enabled. */
|
|
startupDiagnostic: (event: string, details?: Record<string, unknown>) => Promise<void>
|
|
/** macOS active input mode, or layout ID when no IME is selected (e.g. `com.apple.keylayout.PolishPro`).
|
|
* Distinguishes CJK IMEs and Option-layer-composing layouts that look like US QWERTY (issue #1205).
|
|
* Returns null on non-Darwin or when the defaults read fails. */
|
|
getKeyboardInputSourceId: () => Promise<string | null>
|
|
/** Physical Mission Control chords before layout resolution. */
|
|
getMacCapturedDigitRowChords: () => Promise<MacCapturedDigitRowChord[]>
|
|
/** Active macOS layout characters without Option, or null off macOS or when the native probe fails. */
|
|
getKeyboardLayoutSnapshot: () => Promise<KeyboardLayoutSnapshot | null>
|
|
/** Subscribes to active macOS input-source changes. No-op in the browser fallback. */
|
|
onKeyboardLayoutChanged: (callback: (event: KeyboardLayoutChangeEvent) => void) => () => void
|
|
/** Updates the macOS Dock unread badge. No-op on Windows/Linux. */
|
|
setUnreadDockBadgeCount: (count: number) => Promise<void>
|
|
/** Resolves the launch directory for global Floating Terminal tabs. */
|
|
getFloatingTerminalCwd: (args?: FloatingTerminalCwdRequest) => Promise<string>
|
|
/** Resolves Orca's app-owned directory for auto-created Floating Workspace
|
|
* markdown notes. */
|
|
getFloatingMarkdownDirectory: () => Promise<string>
|
|
/** Opens a native picker for markdown documents, rooted in the floating
|
|
* workspace, and authorizes the selected file for editor reads/writes. */
|
|
pickFloatingMarkdownDocument: () => Promise<MarkdownDocument | null>
|
|
/** Opens a native directory picker and authorizes the selected directory
|
|
* for Floating Workspace markdown file creation. */
|
|
pickFloatingWorkspaceDirectory: () => Promise<string | null>
|
|
/** Persists flag-gated terminal render evidence under app-owned userData. */
|
|
writeTerminalRenderDesyncEvidence: (
|
|
args: WriteTerminalRenderDesyncEvidenceArgs
|
|
) => Promise<WriteTerminalRenderDesyncEvidenceResult>
|
|
}
|
|
|
|
/** Panel contribution as surfaced by the main-process plugin service. */
|
|
|
|
export type PlatformApi = {
|
|
get: () => {
|
|
platform: NodeJS.Platform
|
|
osRelease: string
|
|
arch: string
|
|
/** Login shell or ComSpec when available. */
|
|
shell: string
|
|
displayServer: 'wayland' | 'x11' | null
|
|
}
|
|
}
|
|
|
|
export type E2EApi = {
|
|
getConfig: () => E2EConfig
|
|
}
|