mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
fmt(js): npm run fix on merge (#69805)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
9f5e568812
commit
7d96e602a9
16 changed files with 88 additions and 34 deletions
|
|
@ -12,7 +12,12 @@ import path from 'node:path'
|
|||
|
||||
import { test } from 'vitest'
|
||||
|
||||
import { canImportHermesCli, hermesRuntimeImportProbe, shouldTrustHermesOverride, verifyHermesCli } from './backend-probes'
|
||||
import {
|
||||
canImportHermesCli,
|
||||
hermesRuntimeImportProbe,
|
||||
shouldTrustHermesOverride,
|
||||
verifyHermesCli
|
||||
} from './backend-probes'
|
||||
|
||||
// Resolve the host's own Node binary -- guaranteed to be on disk and
|
||||
// runnable. We use it as both a stand-in for "a python that doesn't
|
||||
|
|
|
|||
|
|
@ -115,7 +115,10 @@ export function ComposerControls({
|
|||
<Tip
|
||||
label={
|
||||
busy ? (
|
||||
<TipKeybindLabel actionId={busyAction === 'steer' ? 'composer.steer' : 'composer.send'} text={busyLabel} />
|
||||
<TipKeybindLabel
|
||||
actionId={busyAction === 'steer' ? 'composer.steer' : 'composer.send'}
|
||||
text={busyLabel}
|
||||
/>
|
||||
) : (
|
||||
<TipKeybindLabel actionId="composer.send" text={c.send} />
|
||||
)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,12 @@ interface SubmitHarnessOptions {
|
|||
text?: string
|
||||
}
|
||||
|
||||
function renderSubmitHook({ attachments = [], busy = false, compacting = false, text = '' }: SubmitHarnessOptions = {}) {
|
||||
function renderSubmitHook({
|
||||
attachments = [],
|
||||
busy = false,
|
||||
compacting = false,
|
||||
text = ''
|
||||
}: SubmitHarnessOptions = {}) {
|
||||
const draftRef = { current: text }
|
||||
const editor = document.createElement('div')
|
||||
editor.dataset.slot = 'composer-rich-input'
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ describe('useHermesConfig refreshHermesConfig', () => {
|
|||
expect($currentCwd.get()).toBe('/Users/example/repo/.worktrees/attached')
|
||||
})
|
||||
|
||||
|
||||
it('does not let a stale forced config refresh overwrite newer draft selector intent', async () => {
|
||||
const profileConfig = deferred<Awaited<ReturnType<typeof getHermesConfig>>>()
|
||||
vi.mocked(getHermesConfig).mockReturnValueOnce(profileConfig.promise)
|
||||
|
|
|
|||
|
|
@ -1062,11 +1062,7 @@ describe('usePromptActions submit / queue drain semantics', () => {
|
|||
|
||||
let handle: HarnessHandle | null = null
|
||||
await actRender(
|
||||
<Harness
|
||||
onReady={h => (handle = h)}
|
||||
refreshSessions={async () => undefined}
|
||||
requestGateway={requestGateway}
|
||||
/>
|
||||
<Harness onReady={h => (handle = h)} refreshSessions={async () => undefined} requestGateway={requestGateway} />
|
||||
)
|
||||
|
||||
markVoicePlaybackInterrupted()
|
||||
|
|
|
|||
|
|
@ -247,16 +247,22 @@ export function usePromptActions({
|
|||
role,
|
||||
parts: [textPart(body)]
|
||||
}
|
||||
const streamIndex = options.insertBeforeActiveReply && state.streamId
|
||||
? state.messages.findIndex(candidate => candidate.id === state.streamId)
|
||||
: -1
|
||||
|
||||
const streamIndex =
|
||||
options.insertBeforeActiveReply && state.streamId
|
||||
? state.messages.findIndex(candidate => candidate.id === state.streamId)
|
||||
: -1
|
||||
|
||||
const lastAssistantIndex = options.insertBeforeActiveReply
|
||||
? state.messages.map(candidate => candidate.role).lastIndexOf('assistant')
|
||||
: -1
|
||||
|
||||
const insertionIndex = streamIndex >= 0 ? streamIndex : lastAssistantIndex
|
||||
const messages = insertionIndex >= 0
|
||||
? [...state.messages.slice(0, insertionIndex), message, ...state.messages.slice(insertionIndex)]
|
||||
: [...state.messages, message]
|
||||
|
||||
const messages =
|
||||
insertionIndex >= 0
|
||||
? [...state.messages.slice(0, insertionIndex), message, ...state.messages.slice(insertionIndex)]
|
||||
: [...state.messages, message]
|
||||
|
||||
return { ...state, messages }
|
||||
},
|
||||
|
|
@ -643,11 +649,13 @@ export function usePromptActions({
|
|||
// gateway; appending after the response leaves the correction below a
|
||||
// reply that the redirect has already replaced.
|
||||
const messageId = appendSessionTextMessage(id, 'user', text, undefined, { insertBeforeActiveReply: true })
|
||||
|
||||
const discardOptimisticMessage = () =>
|
||||
updateSessionState(id, state => ({
|
||||
...state,
|
||||
messages: state.messages.filter(message => message.id !== messageId)
|
||||
}))
|
||||
|
||||
const moveOptimisticMessageToEnd = () =>
|
||||
updateSessionState(id, state => {
|
||||
const message = state.messages.find(candidate => candidate.id === messageId)
|
||||
|
|
@ -713,7 +721,14 @@ export function usePromptActions({
|
|||
|
||||
return false
|
||||
},
|
||||
[activeSessionId, activeSessionIdRef, appendSessionTextMessage, requestGateway, selectedStoredSessionIdRef, updateSessionState]
|
||||
[
|
||||
activeSessionId,
|
||||
activeSessionIdRef,
|
||||
appendSessionTextMessage,
|
||||
requestGateway,
|
||||
selectedStoredSessionIdRef,
|
||||
updateSessionState
|
||||
]
|
||||
)
|
||||
|
||||
const reloadFromMessage = useCallback(
|
||||
|
|
|
|||
|
|
@ -342,11 +342,9 @@ describe('preserveLocalPendingTurnMessages', () => {
|
|||
msg('user-inflight', 'user', 'the one genuinely in-flight prompt')
|
||||
]
|
||||
|
||||
expect(preserveLocalPendingTurnMessages(compressedAuthority, pollutedWarmCache).map(message => message.id)).toEqual([
|
||||
'stored-user',
|
||||
'stored-assistant',
|
||||
'user-inflight'
|
||||
])
|
||||
expect(preserveLocalPendingTurnMessages(compressedAuthority, pollutedWarmCache).map(message => message.id)).toEqual(
|
||||
['stored-user', 'stored-assistant', 'user-inflight']
|
||||
)
|
||||
})
|
||||
|
||||
it('drops the live tail once the latest authoritative user has persisted it after compression', () => {
|
||||
|
|
|
|||
|
|
@ -260,9 +260,11 @@ export function preserveLocalPendingTurnMessages(
|
|||
|
||||
const nextIds = new Set(nextMessages.map(message => message.id))
|
||||
const previousRoleCounts = new Map<ChatMessage['role'], number>()
|
||||
|
||||
const newestOptimisticUser = [...previousMessages]
|
||||
.reverse()
|
||||
.find(message => message.role === 'user' && message.id.startsWith('user-'))
|
||||
|
||||
const latestAuthoritativeUser = [...nextMessages].reverse().find(message => message.role === 'user')
|
||||
const preserved: ChatMessage[] = []
|
||||
|
||||
|
|
@ -283,7 +285,11 @@ export function preserveLocalPendingTurnMessages(
|
|||
continue
|
||||
}
|
||||
|
||||
if (isOptimisticUser && latestAuthoritativeUser && chatMessageText(latestAuthoritativeUser).trim() === chatMessageText(message).trim()) {
|
||||
if (
|
||||
isOptimisticUser &&
|
||||
latestAuthoritativeUser &&
|
||||
chatMessageText(latestAuthoritativeUser).trim() === chatMessageText(message).trim()
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -668,7 +668,9 @@ describe('BillingSettings', () => {
|
|||
|
||||
expect(await screen.findByText('No payment method on file')).toBeTruthy()
|
||||
expect(
|
||||
screen.getByText('Buying top-up credits and auto-refill stay disabled until a card is on file. Add one on the portal.')
|
||||
screen.getByText(
|
||||
'Buying top-up credits and auto-refill stay disabled until a card is on file. Add one on the portal.'
|
||||
)
|
||||
).toBeTruthy()
|
||||
expect(screen.getByRole('button', { name: /Add card/ })).toBeTruthy()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -985,7 +985,14 @@ export function GatewaySettings({ embedded = false }: { embedded?: boolean } = {
|
|||
}
|
||||
|
||||
if (loading) {
|
||||
return <SettingsSkeleton sections={[{ heading: true, rows: 3 }, { heading: true, rows: 3 }]} />
|
||||
return (
|
||||
<SettingsSkeleton
|
||||
sections={[
|
||||
{ heading: true, rows: 3 },
|
||||
{ heading: true, rows: 3 }
|
||||
]}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
if (!window.hermesDesktop?.getConnectionConfig) {
|
||||
|
|
|
|||
|
|
@ -194,7 +194,12 @@ export function SectionHeadingSkeleton() {
|
|||
export function ListRowSkeleton({ wide = false }: { wide?: boolean }) {
|
||||
return (
|
||||
<div className="@container">
|
||||
<div className={cn('grid gap-3 py-3', !wide && '@2xl:grid-cols-[minmax(0,1fr)_minmax(15rem,22rem)] @2xl:items-center')}>
|
||||
<div
|
||||
className={cn(
|
||||
'grid gap-3 py-3',
|
||||
!wide && '@2xl:grid-cols-[minmax(0,1fr)_minmax(15rem,22rem)] @2xl:items-center'
|
||||
)}
|
||||
>
|
||||
<div className="min-w-0 space-y-1.5">
|
||||
<Skeleton className="h-3.5 w-40 max-w-full" />
|
||||
<Skeleton className="h-3 w-64 max-w-full" />
|
||||
|
|
|
|||
|
|
@ -12,7 +12,12 @@ interface ContextUsagePanelProps {
|
|||
sessionId: string | null
|
||||
}
|
||||
|
||||
export function ContextUsagePanel({ currentUsage, onUsageSnapshot, requestGateway, sessionId }: ContextUsagePanelProps) {
|
||||
export function ContextUsagePanel({
|
||||
currentUsage,
|
||||
onUsageSnapshot,
|
||||
requestGateway,
|
||||
sessionId
|
||||
}: ContextUsagePanelProps) {
|
||||
const { t } = useI18n()
|
||||
const copy = t.shell.statusbar.contextUsagePanel
|
||||
const [breakdown, setBreakdown] = useState<ContextBreakdown | null>(null)
|
||||
|
|
|
|||
|
|
@ -397,7 +397,12 @@ function ApplyingView({ apply, isBackend }: { apply: UpdateApplyState; isBackend
|
|||
) : null}
|
||||
</div>
|
||||
|
||||
<Progress aria-label={label} indeterminate={percent === null} size="lg" value={percent === null ? 0 : percent / 100} />
|
||||
<Progress
|
||||
aria-label={label}
|
||||
indeterminate={percent === null}
|
||||
size="lg"
|
||||
value={percent === null ? 0 : percent / 100}
|
||||
/>
|
||||
|
||||
{recentLog.length > 1 ? (
|
||||
<div className="max-h-24 overflow-hidden rounded-md border border-border/70 bg-muted/35 px-3 py-2 text-left font-mono text-[11px] leading-4 text-muted-foreground">
|
||||
|
|
|
|||
|
|
@ -59,9 +59,13 @@ function Input({ className, containerClassName, prefix, suffix, size, type, ...p
|
|||
)}
|
||||
data-slot="input-group"
|
||||
>
|
||||
{prefix != null && <span className="pointer-events-none shrink-0 select-none text-muted-foreground">{prefix}</span>}
|
||||
{prefix != null && (
|
||||
<span className="pointer-events-none shrink-0 select-none text-muted-foreground">{prefix}</span>
|
||||
)}
|
||||
{field}
|
||||
{suffix != null && <span className="pointer-events-none shrink-0 select-none text-muted-foreground">{suffix}</span>}
|
||||
{suffix != null && (
|
||||
<span className="pointer-events-none shrink-0 select-none text-muted-foreground">{suffix}</span>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,9 +71,6 @@ export function runBillingRecovery(block: BillingBlock): void {
|
|||
requestBillingSettings()
|
||||
}
|
||||
|
||||
export function billingCtaLabel(
|
||||
block: BillingBlock,
|
||||
copy: { addCredits: string; openBilling: string }
|
||||
): string {
|
||||
export function billingCtaLabel(block: BillingBlock, copy: { addCredits: string; openBilling: string }): string {
|
||||
return block.is_nous ? copy.openBilling : copy.addCredits
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,5 +74,7 @@ export function sessionColorFor(session: null | SessionInfo | undefined): string
|
|||
return undefined
|
||||
}
|
||||
|
||||
return $sessionColorById.get()[session.id] ?? resolveSessionColor(session, $projects.get(), $sessionColorOverrides.get())
|
||||
return (
|
||||
$sessionColorById.get()[session.id] ?? resolveSessionColor(session, $projects.get(), $sessionColorOverrides.get())
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue