mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-21 16:18:55 +00:00
feat(desktop): add workspace path status action
This commit is contained in:
parent
8895335453
commit
5fc08c0e0d
1 changed files with 50 additions and 1 deletions
|
|
@ -8,15 +8,18 @@ import { GatewayMenuPanel } from '@/app/shell/gateway-menu-panel'
|
|||
import { Codicon } from '@/components/ui/codicon'
|
||||
import { GlyphSpinner } from '@/components/ui/glyph-spinner'
|
||||
import { useI18n } from '@/i18n'
|
||||
import { Activity, AlertCircle, Clock, Command, Hash, Loader2, Terminal, Zap, ZapFilled } from '@/lib/icons'
|
||||
import { Activity, AlertCircle, Clock, Command, CopyIcon, FolderOpen, Hash, Loader2, Terminal, Zap, ZapFilled } from '@/lib/icons'
|
||||
import type { RuntimeReadinessResult } from '@/lib/runtime-readiness'
|
||||
import { contextBarLabel, LiveDuration, usageContextLabel } from '@/lib/statusbar'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { setGlobalYolo, setSessionYolo } from '@/lib/yolo-session'
|
||||
import { copyFilePath, revealFile } from '@/store/file-actions'
|
||||
import { revealFileInTree } from '@/store/layout'
|
||||
import {
|
||||
$activeSessionId,
|
||||
$busy,
|
||||
$connection,
|
||||
$currentCwd,
|
||||
$currentUsage,
|
||||
$sessionStartedAt,
|
||||
$turnStartedAt,
|
||||
|
|
@ -38,6 +41,13 @@ import type { StatusResponse } from '@/types/hermes'
|
|||
import { CRON_ROUTE } from '../../routes'
|
||||
import type { StatusbarItem, StatusbarSelectModifiers } from '../statusbar-controls'
|
||||
|
||||
function workspaceLabel(cwd: string): string {
|
||||
const normalized = cwd.replace(/[\\/]+$/, '')
|
||||
const leaf = normalized.split(/[\\/]/).filter(Boolean).pop()
|
||||
|
||||
return leaf || cwd
|
||||
}
|
||||
|
||||
interface StatusbarItemsOptions {
|
||||
agentsOpen: boolean
|
||||
chatOpen: boolean
|
||||
|
|
@ -71,10 +81,12 @@ export function useStatusbarItems({
|
|||
}: StatusbarItemsOptions) {
|
||||
const { t } = useI18n()
|
||||
const copy = t.shell.statusbar
|
||||
const fileMenu = t.fileMenu
|
||||
const activeSessionId = useStore($activeSessionId)
|
||||
const terminalTakeover = useStore($terminalTakeover)
|
||||
const yoloActive = useStore($yoloActive)
|
||||
const busy = useStore($busy)
|
||||
const currentCwd = useStore($currentCwd)
|
||||
const currentUsage = useStore($currentUsage)
|
||||
const gatewayRestarting = useStore($gatewayRestarting)
|
||||
const sessionStartedAt = useStore($sessionStartedAt)
|
||||
|
|
@ -299,6 +311,39 @@ export function useStatusbarItems({
|
|||
title: inferenceStatus?.reason || copy.gatewayTitle,
|
||||
variant: 'menu'
|
||||
},
|
||||
{
|
||||
hidden: !currentCwd,
|
||||
icon: <FolderOpen className="size-3" />,
|
||||
id: 'workspace-cwd',
|
||||
label: currentCwd ? workspaceLabel(currentCwd) : undefined,
|
||||
menuItems: currentCwd
|
||||
? [
|
||||
{
|
||||
icon: <CopyIcon className="size-4" />,
|
||||
id: 'copy-workspace-path',
|
||||
label: fileMenu.copyPath,
|
||||
onSelect: () => void copyFilePath(currentCwd),
|
||||
title: currentCwd
|
||||
},
|
||||
{
|
||||
icon: <FolderOpen className="size-4" />,
|
||||
id: 'reveal-workspace-finder',
|
||||
label: fileMenu.revealFileManager,
|
||||
onSelect: () => void revealFile(currentCwd),
|
||||
title: currentCwd
|
||||
},
|
||||
{
|
||||
icon: <Codicon name="go-to-file" size="1rem" />,
|
||||
id: 'reveal-workspace-sidebar',
|
||||
label: fileMenu.revealInSidebar,
|
||||
onSelect: () => revealFileInTree(currentCwd),
|
||||
title: currentCwd
|
||||
}
|
||||
]
|
||||
: undefined,
|
||||
title: currentCwd || undefined,
|
||||
variant: 'menu'
|
||||
},
|
||||
{
|
||||
className: cn(
|
||||
agentsOpen && 'bg-accent/55 text-foreground',
|
||||
|
|
@ -337,6 +382,10 @@ export function useStatusbarItems({
|
|||
agentsOpen,
|
||||
commandCenterOpen,
|
||||
copy,
|
||||
currentCwd,
|
||||
fileMenu.copyPath,
|
||||
fileMenu.revealFileManager,
|
||||
fileMenu.revealInSidebar,
|
||||
gatewayMenuContent,
|
||||
gatewayClassName,
|
||||
gatewayDetail,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue