diff --git a/packages/app/e2e/regression/home.spec.ts b/packages/app/e2e/regression/home.spec.ts index 15d190d8a43..c4e5d0ce19e 100644 --- a/packages/app/e2e/regression/home.spec.ts +++ b/packages/app/e2e/regression/home.spec.ts @@ -17,29 +17,16 @@ async function openHome(page: Page, input: Parameters await page.goto("/") } -test("Home uses the session list for tabs and the session inbox only when selected in Settings", async ({ page }) => { - const replies: { sessionID: string; permissionID: string; body: unknown }[] = [] - const waiting = { id: "ses_home_waiting", title: "Waiting on approval" } +test("Home keeps the session list in every interface mode", async ({ page }) => { const earlier = { id: "ses_home_earlier", title: "Finished earlier" } - await mockWorkspace(page, { - name: "Home", - sessions: [earlier, waiting], - sessionStatus: { [waiting.id]: { type: "running" } }, - sessionPermissions: { - [waiting.id]: [ - { id: "per_home", sessionID: waiting.id, action: "shell", resources: ["git status"], metadata: {}, save: [] }, - ], - }, - onPermissionReply: (reply) => replies.push(reply), - }) + await mockWorkspace(page, { name: "Home", sessions: [earlier] }) await page.goto("/") const search = page.getByRole("textbox", { name: /Search sessions/ }) - const inbox = page.locator('[data-slot="start-row"]') await expect(search).toBeVisible() await expect(row(page, earlier.title)).toBeVisible() - await expect(inbox).toHaveCount(0) - for (const mode of ["Side tabs", "Inbox", "Top tabs", "Inbox"]) { + // The Inbox mode moves session tabs into the sidebar inbox; Home stays the session list. + for (const mode of ["Side tabs", "Inbox", "Top tabs"]) { await page.keyboard.press("Control+,") const settings = page.getByTestId("settings-screen") const option = settings.getByRole("radio", { name: mode, exact: true }) @@ -47,31 +34,9 @@ test("Home uses the session list for tabs and the session inbox only when select await expect(option).toBeChecked() await settings.getByRole("button", { name: "Back to app", exact: true }).click() await expect(page).toHaveURL("/") - - if (mode === "Inbox") { - await expect(inbox.filter({ hasText: earlier.title })).toHaveAttribute("data-status", "ready") - await expect(search).toHaveCount(0) - await expect(row(page, earlier.title)).toHaveCount(0) - continue - } - await expect(search).toBeVisible() await expect(row(page, earlier.title)).toBeVisible() - await expect(inbox).toHaveCount(0) } - - await page.reload() - const approval = inbox.filter({ hasText: waiting.title }) - await expect(approval).toHaveAttribute("data-status", "approval") - await expect(approval).toContainText("git status") - await expect(search).toHaveCount(0) - await approval.getByRole("button", { name: "Allow", exact: true }).click() - await expect - .poll(() => replies) - .toEqual([{ sessionID: waiting.id, permissionID: "per_home", body: { decision: "once" } }]) - await expect(approval).toHaveAttribute("data-status", "working") - await inbox.filter({ hasText: earlier.title }).click() - await expectPath(page, sessionHref(earlier.id)) }) test("the session context menu renames, exports, and deletes a Home session", async ({ page }) => { diff --git a/packages/app/src/home/route.tsx b/packages/app/src/home/route.tsx index 8781d78b246..6626e90f8f7 100644 --- a/packages/app/src/home/route.tsx +++ b/packages/app/src/home/route.tsx @@ -1,7 +1,6 @@ import { ScrollView } from "@opencode/ui/scroll-view" import { createMediaQuery } from "@solid-primitives/media" import { Show } from "solid-js" -import { useSettings } from "@/settings/model" import { createHomeController } from "./model" import { createHomeProjectsController } from "./projects/controller" import { HomeUtilityNav } from "./projects/view" @@ -10,19 +9,8 @@ import { createHomeScrollController } from "./scroll" import { createHomeSessionSearchController } from "./sessions/search" import { createHomeSessionsController } from "./sessions/controller" import { HomeSessions } from "./sessions/region" -import { StartHome } from "./start/start" export function Home() { - const settings = useSettings() - - return ( - }> - - - ) -} - -function SessionHome() { const mobile = createMediaQuery("(max-width: 767px)") const home = createHomeController() const projects = createHomeProjectsController(home) diff --git a/packages/app/src/home/start/model.ts b/packages/app/src/home/start/model.ts deleted file mode 100644 index 80001f3e64b..00000000000 --- a/packages/app/src/home/start/model.ts +++ /dev/null @@ -1,150 +0,0 @@ -import { createEffect, createMemo, startTransition } from "solid-js" -import { useGlobal } from "@/runtime/server/runtime" -import { ServerConnection, useServers } from "@/runtime/server/registry" -import type { Project } from "@/runtime/server/types" -import { useCommand } from "@/shell/commands/command" -import { useTabs } from "@/shell/tabs/tabs" -import { createSessionInbox, inboxArchived, type InboxEntry } from "@/shell/titlebar/inbox-model" -import { pathKey } from "@/workspaces/path-key" - -const EARLIER_LIMIT = 8 - -const PROJECT_LIMIT = 10 - -export type StartProject = { - key: string - project: Project - waiting: number - running: number - entries: InboxEntry[] -} - -export type StartServer = { - key: ServerConnection.Key - conn: ServerConnection.Any - projects: StartProject[] -} - -/** - * Home: sessions on every connected server, sorted by what they need from you, and each server's recent projects. - * Needs you holds sessions the agent cannot continue without you: an approval, a question, or a failed run. - */ -export function createStartModel() { - const global = useGlobal() - const servers = useServers() - const tabs = useTabs() - const command = useCommand() - const inbox = createSessionInbox() - - const live = createMemo(() => inbox.entries().filter((entry) => !inboxArchived(entry))) - const byIdle = (a: InboxEntry, b: InboxEntry) => (b.session.time.idle ?? 0) - (a.session.time.idle ?? 0) - - const groups = createMemo(() => { - const list = live() - - return { - needs: [ - ...list.filter((entry) => entry.status === "approval" || entry.status === "input"), - ...list.filter((entry) => entry.status === "failed").toSorted(byIdle), - ], - done: list.filter((entry) => entry.status === "done").toSorted(byIdle), - working: list.filter((entry) => entry.status === "working"), - earlier: list.filter((entry) => entry.status === "ready").slice(0, EARLIER_LIMIT), - } - }) - - const projectOf = (entry: InboxEntry) => - entry.ctx.projects.forSession(entry.session)?.worktree ?? entry.session.location.directory - - // This computer first, then other servers in the order they were added. - const ordered = createMemo(() => - servers.visible.toSorted((a, b) => Number(servers.current(b)) - Number(servers.current(a))), - ) - - // Each server's projects, most recently active first. Projects are added on the server, so Home only lists them. - const projectServers = createMemo(() => - ordered() - .map((conn): StartServer => { - const key = ServerConnection.key(conn) - - return { - key, - conn, - projects: global - .ensureServerCtx(conn) - .projects.unique() - .map((project): StartProject => { - const entries = live().filter( - (entry) => entry.server === key && pathKey(projectOf(entry)) === pathKey(project.worktree), - ) - - return { - key: `${key}\0${pathKey(project.worktree)}`, - project, - waiting: entries.filter((entry) => entry.status === "approval" || entry.status === "input").length, - running: entries.filter((entry) => entry.status === "working").length, - entries, - } - }) - .toSorted((a, b) => activity(b) - activity(a)) - .slice(0, PROJECT_LIMIT), - } - }) - .filter((server) => server.projects.length > 0), - ) - - // A server that does not answer contributes no sessions; say so instead of showing a shorter list. - const unreachable = createMemo(() => - ordered().filter((conn) => { - const health = global.servers.health[ServerConnection.key(conn)] - - return !!health && !health.checking && !health.healthy - }), - ) - - // The account this computer's server runs as is the best name the app has for the person. - const health = () => { - const conn = ordered()[0] - - return conn ? global.servers.health[ServerConnection.key(conn)] : undefined - } - - const name = createMemo(() => { - const account = health()?.username - - return account ? account.charAt(0).toUpperCase() + account.slice(1) : undefined - }) - - // The client only refreshes `time.idle` for loaded sessions when a run ends, so load every working one. - createEffect(() => { - groups().working.forEach((entry) => { - if (entry.ctx.data.session.get(entry.session.id)) return - void entry.ctx.data.session.sync(entry.session.id).catch(() => undefined) - }) - }) - - return { - inbox, - groups, - projectServers, - unreachable, - name, - /** The greeting waits for the first health check, so the name never pops in after it. */ - greeted: () => !!health() && !health()?.checking, - loading: inbox.loading, - newSession: () => command.trigger("tab.new"), - openProject: (server: StartServer, item: StartProject) => { - global.ensureServerCtx(server.conn).projects.touch(item.project.worktree) - void startTransition(() => { - void tabs.newDraft({ server: server.key, directory: item.project.worktree }) - }) - }, - markAllViewed: () => groups().done.forEach(inbox.markViewed), - } -} - -export type StartModel = ReturnType - -function activity(item: StartProject) { - return Math.max(item.project.time.active, ...item.entries.map((entry) => entry.session.time.updated)) -} diff --git a/packages/app/src/home/start/start.tsx b/packages/app/src/home/start/start.tsx deleted file mode 100644 index 15b23e579bb..00000000000 --- a/packages/app/src/home/start/start.tsx +++ /dev/null @@ -1,602 +0,0 @@ -import { Button } from "@opencode/ui/button" -import { Icon } from "@opencode/ui/icon" -import { IconButton } from "@opencode/ui/icon-button" -import { Keybind } from "@opencode/ui/keybind" -import { - displayName, - getProjectAvatarGenerated, - getProjectAvatarSource, - getProjectAvatarVariant, - ProjectAvatar, -} from "@opencode/ui/project-avatar" -import { TextShimmer } from "@opencode/ui/text-shimmer" -import { Tooltip } from "@opencode/ui/tooltip" -import { createEffect, createMemo, For, Match, Show, Switch, type JSX } from "solid-js" -import { useLanguage } from "@/runtime/i18n/language" -import { useGlobal } from "@/runtime/server/runtime" -import { ServerConnection, useServers } from "@/runtime/server/registry" -import { useSettingsCommand } from "@/settings/command" -import { useSettingsSurface } from "@/settings/surface" -import { usePlatform } from "@/runtime/platform/platform" -import { useCommand } from "@/shell/commands/command" -import { SessionTabAvatarView } from "@/shell/layout/session-tab-avatar" -import { sessionTabTitle } from "@/shell/titlebar/tab-title" -import type { InboxEntry } from "@/shell/titlebar/inbox-model" -import { createStartModel, type StartModel, type StartServer } from "./model" - -type Language = ReturnType - -/** Home: a greeting, every session sorted by what it needs from you, and recent projects beside them. */ -export function StartHome() { - const model = createStartModel() - // Settings opens from Home like from a session; the palette is the shell's. - useSettingsCommand() - - return ( -
-
-
-
- - - -
- -
-
-
- ) -} - -function StartGreeting(props: { model: StartModel }) { - const language = useLanguage() - const command = useCommand() - const platform = usePlatform() - const groups = props.model.groups - const hour = () => new Date(props.model.inbox.now()).getHours() - const period = () => (hour() < 12 ? "morning" : hour() < 18 ? "afternoon" : "evening") - - const greeting = () => { - const name = props.model.name() - - return name ? language.t(`start.greeting.${period()}.named`, { name }) : language.t(`start.greeting.${period()}`) - } - - // Each count is its own complete phrase, so locales never assemble a sentence from fragments. - const summary = createMemo(() => - [ - groups().needs.length > 0 ? language.plural("start.summary.needsYou", groups().needs.length) : undefined, - groups().working.length > 0 ? language.plural("start.summary.running", groups().working.length) : undefined, - groups().done.length > 0 ? language.plural("start.summary.done", groups().done.length) : undefined, - ].filter((item) => item !== undefined), - ) - - return ( -
- {/* Both lines keep their height while they wait, so nothing below moves when they fill in. */} -
-

- {greeting()} -

-

- }> - 0} fallback={language.t("start.caughtUp")}> - {summary().join(" ยท ")} - - -

-
-
- - } - onClick={() => platform.openExternal("https://opencode.ai/desktop-feedback")} - /> - - - {language.t("sidebar.settings")} - 0}> - - - - } - > - } - onClick={() => command.trigger("settings.open")} - /> - - - {language.t("command.session.new")} - 0}> - - - - } - > - - -
-
- ) -} - -/** Servers that do not answer leave their sessions out of every list, so each gets a line saying so. */ -function StartUnreachable(props: { model: StartModel }) { - const language = useLanguage() - const servers = useServers() - const global = useGlobal() - const settings = useSettingsSurface() - - return ( - 0}> -
- - {(conn) => ( -
- - - - - {language.t( - global.servers.health[ServerConnection.key(conn)]?.unauthorized - ? "start.server.unauthorized" - : "start.server.unreachable", - { server: servers.label(conn) }, - )} - - -
- )} -
-
-
- ) -} - -/** Needs you, then results waiting to be read, then work in flight, then everything already read. */ -function StartSections(props: { model: StartModel }) { - const language = useLanguage() - const groups = props.model.groups - - createEffect(() => - props.model.inbox.loadBranches([...groups().needs, ...groups().done, ...groups().working, ...groups().earlier]), - ) - - return ( - }> -
- 0} fallback={}> -
- {(entry) => } -
-
- 0}> -
- {language.t("start.markAllRead")} - - } - > - {(entry) => } -
-
- 0}> -
- {(entry) => } -
-
- 0}> -
- {(entry) => } -
-
-
-
- ) -} - -/** Row-shaped placeholders while the first load settles; claiming inbox zero before then would be wrong. */ -function Skeleton() { - return ( - - ) -} - -function Bar(props: { class?: string; style?: JSX.CSSProperties }) { - return ( - - ) -} - -/** Recent projects per server. Choosing one starts a session there; projects are added on the server, not here. */ -function StartProjects(props: { model: StartModel }) { - const language = useLanguage() - const servers = useServers() - const several = () => props.model.projectServers().length > 1 - - return ( -
- - {(server, index) => ( -
-
- - - {servers.label(server.conn)} - - - {(name) => {name()}} - -
- -
- )} -
-
- ) -} - -function ProjectList(props: { model: StartModel; server: StartServer }) { - const language = useLanguage() - - // Projects that share a name, like a repository and its worktrees, are told apart by their parent folder. - const repeated = createMemo(() => { - const names = props.server.projects.map((item) => displayName(item.project)) - - return new Set(names.filter((name, index) => names.indexOf(name) !== index)) - }) - - const parent = (worktree: string) => - worktree - .replace(/[/\\]+$/, "") - .split(/[/\\]/) - .at(-2) - - return ( - - {(item) => ( - - )} - - ) -} - -function ProjectCounts(props: { waiting: number; running: number }) { - const language = useLanguage() - - return ( - - - - {props.waiting} - - - - - {props.running} - - - - ) -} - -function Section(props: { title: string; count?: number; icon: string; action?: JSX.Element; children: JSX.Element }) { - return ( -
- {/* The icon sits in the rows' 16px avatar column so the label lines up with the session titles. */} -
- - - - - {props.title} - - {props.count} - - - - {props.action} - -
-
{props.children}
-
- ) -} - -/** Nothing is waiting on you: the one state worth celebrating, so it takes Needs you's place instead of an empty list. */ -function InboxZero() { - const language = useLanguage() - - return ( -
- - - -
- {language.t("start.inboxZero")} - {language.t("start.inboxZero.description")} -
-
- ) -} - -function StartRow(props: { model: StartModel; entry: InboxEntry }) { - const language = useLanguage() - const inbox = props.model.inbox - const loud = () => props.entry.status !== "ready" - - return ( -
inbox.open(props.entry)} - onKeyDown={(event) => { - if (event.key !== "Enter" && event.key !== " ") return - event.preventDefault() - inbox.open(props.entry) - }} - > - -
- - {sessionTabTitle(props.entry.session.title, language.t("session.tab.session"))} - - -
-
event.stopPropagation()}> - - - - -
-
- ) -} - -function RowActions(props: { model: StartModel; entry: InboxEntry }) { - const language = useLanguage() - const inbox = props.model.inbox - - return ( - - -
- - -
-
- - - - - - } - onClick={() => inbox.markViewed(props.entry)} - /> - - -
- ) -} - -function Meta(props: { model: StartModel; entry: InboxEntry }) { - const language = useLanguage() - const servers = useServers() - const inbox = props.model.inbox - const project = () => props.entry.ctx.projects.forSession(props.entry.session) - const branch = () => inbox.branch(props.entry) - const permission = () => (props.entry.status === "approval" ? inbox.permission(props.entry) : undefined) - const form = () => (props.entry.status === "input" ? inbox.form(props.entry) : undefined) - - return ( - - {/* Sessions on this computer are not marked. */} - - {(name) => ( - - - {name()} - - )} - - {displayName(project() ?? { worktree: props.entry.session.location.directory })} - - {(name) => ( - - - - {name()} - - - )} - - - {(request) => ( - - - {request().resources.join(" ") || request().action} - - )} - - - {(request) => ( - - - {request().title || language.t("start.question")} - - )} - - - ) -} - -function Status(props: { model: StartModel; entry: InboxEntry }) { - const language = useLanguage() - const now = props.model.inbox.now - const status = () => props.entry.status - - return ( - - - - {language.t("sidebar.inbox.status.working")} - - - - - - {age(language, now(), props.entry.session.time.idle ?? props.entry.session.time.updated)} - - - - - { - // SAFETY: working and ready matched above, so the remaining statuses each have a label. - language.t(`sidebar.inbox.status.${status() as "approval" | "input" | "failed" | "done"}`) - } - - - - ) -} - -function SessionAvatar(props: { entry: InboxEntry }) { - return ( - - - - ) -} - -function compact(language: Language, seconds: number) { - if (seconds < 3600) return language.plural("sidebar.inbox.elapsed.minutes", Math.floor(seconds / 60)) - - if (seconds < 86_400) return language.plural("sidebar.inbox.elapsed.hours", Math.floor(seconds / 3600)) - - return language.plural("sidebar.inbox.elapsed.days", Math.floor(seconds / 86_400)) -} - -function elapsed(language: Language, now: number, from: number) { - const seconds = Math.max(0, Math.floor((now - from) / 1000)) - - return seconds < 60 ? language.plural("sidebar.inbox.elapsed.seconds", seconds) : compact(language, seconds) -} - -function age(language: Language, now: number, from: number) { - const seconds = Math.max(0, Math.floor((now - from) / 1000)) - - return seconds < 60 ? language.t("sidebar.inbox.time.now") : compact(language, seconds) -} diff --git a/packages/app/src/runtime/i18n/en.ts b/packages/app/src/runtime/i18n/en.ts index d447bc9caf7..493f50b6e7a 100644 --- a/packages/app/src/runtime/i18n/en.ts +++ b/packages/app/src/runtime/i18n/en.ts @@ -731,40 +731,6 @@ export const dict = { "sidebar.inbox.elapsed.days.one": "{{count}}d", "sidebar.inbox.elapsed.days.other": "{{count}}d", "sidebar.inbox.time.now": "now", - "start.section.needsYou": "Needs you", - "start.section.done": "Done", - "start.section.running": "Running", - "start.section.earlier": "Earlier", - "start.projects": "Projects", - "start.projects.waiting.one": "{{count}} waiting", - "start.projects.waiting.other": "{{count}} waiting", - "start.projects.running.one": "{{count}} running", - "start.projects.running.other": "{{count}} running", - "start.projects.newSession": "New session in {{project}}", - "start.server.unreachable": "Can't reach {{server}}. Its sessions aren't shown.", - "start.server.unauthorized": "{{server}} needs you to sign in again. Its sessions aren't shown.", - "start.server.manage": "Manage", - "start.allow": "Allow", - "start.deny": "Deny", - "start.answer": "Answer", - "start.markRead": "Mark as read", - "start.markAllRead": "Mark all as read", - "start.question": "Waiting for your answer", - "start.caughtUp": "You're all caught up", - "start.inboxZero": "Inbox zero", - "start.inboxZero.description": "Nothing is waiting on you right now", - "start.greeting.morning": "Good morning", - "start.greeting.afternoon": "Good afternoon", - "start.greeting.evening": "Good evening", - "start.greeting.morning.named": "Good morning, {{name}}", - "start.greeting.afternoon.named": "Good afternoon, {{name}}", - "start.greeting.evening.named": "Good evening, {{name}}", - "start.summary.needsYou.one": "{{count}} session needs you", - "start.summary.needsYou.other": "{{count}} sessions need you", - "start.summary.running.one": "{{count}} running", - "start.summary.running.other": "{{count}} running", - "start.summary.done.one": "{{count}} finished", - "start.summary.done.other": "{{count}} finished", "sidebar.project.recentSessions": "Recent sessions", "sidebar.project.clearNotifications": "Clear notifications", diff --git a/packages/app/src/runtime/server/health.ts b/packages/app/src/runtime/server/health.ts index 1fc39e6e735..cc008bbd4e2 100644 --- a/packages/app/src/runtime/server/health.ts +++ b/packages/app/src/runtime/server/health.ts @@ -10,8 +10,6 @@ export type ServerHealth = { version?: string /** The server machine's name, when the server reports one. */ hostname?: string - /** The OS account the server runs as, when the server reports one. */ - username?: string incompatible?: boolean checking?: boolean unauthorized?: boolean @@ -127,7 +125,7 @@ export async function checkServerHealth( }) .server.info({ signal }) .then((status) => ({ - data: { healthy: true as const, version: status.version, hostname: status.hostname, username: status.username }, + data: { healthy: true as const, version: status.version, hostname: status.hostname }, })) .catch((error) => ({ error })) diff --git a/packages/client/src/effect/api/api.ts b/packages/client/src/effect/api/api.ts index 3dcb6fcd395..fadf62bae76 100644 --- a/packages/client/src/effect/api/api.ts +++ b/packages/client/src/effect/api/api.ts @@ -47,7 +47,6 @@ export type ServerInfoOutput = { readonly version: string readonly pid: number readonly hostname?: string | undefined - readonly username?: string | undefined readonly urls: ReadonlyArray readonly paths: { readonly tmp: string } readonly capabilities?: { readonly persistentPty?: boolean | undefined } | undefined diff --git a/packages/client/src/promise/generated/types.ts b/packages/client/src/promise/generated/types.ts index db06602762e..152b9ef1bee 100644 --- a/packages/client/src/promise/generated/types.ts +++ b/packages/client/src/promise/generated/types.ts @@ -4,7 +4,6 @@ export type ServerInfo = { version: string pid: number hostname?: string | undefined - username?: string | undefined urls: Array paths: { tmp: string } capabilities?: { persistentPty?: boolean | undefined } | undefined diff --git a/packages/protocol/openapi.json b/packages/protocol/openapi.json index 9c0457c56e6..c06a02f16ed 100644 --- a/packages/protocol/openapi.json +++ b/packages/protocol/openapi.json @@ -19157,16 +19157,6 @@ } ] }, - "username": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, "urls": { "type": "array", "items": { diff --git a/packages/protocol/src/groups/server.ts b/packages/protocol/src/groups/server.ts index a5d1b033c3b..d78813bfc8b 100644 --- a/packages/protocol/src/groups/server.ts +++ b/packages/protocol/src/groups/server.ts @@ -8,8 +8,6 @@ export const ServerInfo = Schema.Struct({ pid: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), // The machine's name, absent where the runtime has none (e.g. workerd). hostname: Schema.optional(Schema.String), - // The OS account the server runs as, absent where the runtime has none (e.g. workerd). - username: Schema.optional(Schema.String), urls: Schema.Array(Schema.String), paths: Schema.Struct({ tmp: Schema.String, diff --git a/packages/server/src/handlers/server.ts b/packages/server/src/handlers/server.ts index ad9515f34ab..7487581e70d 100644 --- a/packages/server/src/handlers/server.ts +++ b/packages/server/src/handlers/server.ts @@ -1,4 +1,4 @@ -import { hostname, userInfo } from "node:os" +import { hostname } from "node:os" import { Duration, Effect } from "effect" import { HttpServerRequest, HttpServerResponse } from "effect/http" import { HttpApiBuilder } from "effect/http-api" @@ -22,7 +22,6 @@ export const ServerHandler = HttpApiBuilder.group(Api, "server.server", (handler version: info.app.version ?? "unknown", pid: process.pid ?? 0, hostname: hostname() || undefined, - username: account(), urls: info.urls(), paths: info.paths, capabilities: { persistentPty: PersistentPty.available }, @@ -57,12 +56,3 @@ export const ServerHandler = HttpApiBuilder.group(Api, "server.server", (handler ) }), ) - -// userInfo throws when the process has no account entry, e.g. some containers. -function account() { - try { - return userInfo().username || undefined - } catch { - return undefined - } -}