fmt(js): npm run fix on merge (#99917)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0b247df94f
commit
de590cc3cb
@@ -406,11 +406,7 @@ export const focusComposerInput = (el: HTMLElement | null) => {
|
||||
|
||||
const active = document.activeElement
|
||||
|
||||
if (
|
||||
active instanceof HTMLElement &&
|
||||
active.dataset.slot === RICH_INPUT_SLOT &&
|
||||
!isElementInHiddenPane(active)
|
||||
) {
|
||||
if (active instanceof HTMLElement && active.dataset.slot === RICH_INPUT_SLOT && !isElementInHiddenPane(active)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@ import { MAIN_COMPOSER_SCOPE } from './composer/scope'
|
||||
const requestGatewayMock = vi.hoisted(() => vi.fn())
|
||||
|
||||
const { $activeSessionId, $sessions, setSessions } = await import('@/store/session')
|
||||
|
||||
const { $sessionStates, $sessionTiles, clearAllSessionStates, publishSessionState, setSessionTileDelegate } =
|
||||
await import('@/store/session-states')
|
||||
|
||||
const { listTileSessionRow, useSessionTileActions } = await import('./session-tile-actions')
|
||||
|
||||
const RUNTIME_SESSION_ID = 'rt-tile-current'
|
||||
|
||||
@@ -171,6 +171,7 @@ function TileChat({
|
||||
queryClient,
|
||||
requestGateway: requestTileGateway
|
||||
})
|
||||
|
||||
const activeGatewayProfile = useStore($activeGatewayProfile)
|
||||
const cwd = useStore(view.$cwd)
|
||||
const gatewayOpen = useStore($gatewayState) === 'open'
|
||||
|
||||
@@ -10,10 +10,7 @@ describe('SidebarDateDivider', () => {
|
||||
const onToggle = vi.fn()
|
||||
|
||||
render(
|
||||
<SidebarDateDivider
|
||||
label="Yesterday"
|
||||
toggle={{ ariaLabel: 'Hide Yesterday sessions', onToggle, open: true }}
|
||||
/>
|
||||
<SidebarDateDivider label="Yesterday" toggle={{ ariaLabel: 'Hide Yesterday sessions', onToggle, open: true }} />
|
||||
)
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Hide Yesterday sessions' }))
|
||||
|
||||
@@ -64,6 +64,7 @@ export function SidebarDateDivider({
|
||||
{label}
|
||||
</span>
|
||||
)
|
||||
|
||||
const rule = <span aria-hidden="true" className="h-px min-w-4 flex-1 bg-(--ui-stroke-tertiary)" />
|
||||
|
||||
return (
|
||||
|
||||
@@ -174,6 +174,7 @@ export function SidebarFilterMenu({ className }: { className?: string }) {
|
||||
// locally, the gateway's REST mirror remotely. Resolved per render, not once
|
||||
// at module load: switching to a remote profile swaps the bridge underneath.
|
||||
const prAvailable = Boolean(desktopGit()?.review?.prList)
|
||||
|
||||
// Fold the level in view: project rows, or the date/status buckets. Project
|
||||
// rows default open, so "all collapsed" means every one of them has been
|
||||
// explicitly shut. Never sweeps Pinned or Cron.
|
||||
@@ -183,6 +184,7 @@ export function SidebarFilterMenu({ className }: { className?: string }) {
|
||||
: grouping === 'date' || grouping === 'status'
|
||||
? listGroupIds
|
||||
: []
|
||||
|
||||
const foldCollapsed = foldIds.length > 0 && foldIds.every(id => nodeOpen[id] === false)
|
||||
|
||||
const groupingLabel = GROUPINGS.find(option => option.id === grouping)?.label
|
||||
|
||||
@@ -384,10 +384,7 @@ export function SidebarSessionsSection({
|
||||
// Closed date/status buckets keep their divider and drop the sessions under
|
||||
// it. Same array when nothing is collapsed so the virtualizer's rows ref
|
||||
// stays stable across parent re-renders.
|
||||
const visibleRows = useMemo(
|
||||
() => hideCollapsedGroupRows(flatRows, isListGroupOpen),
|
||||
[flatRows, isListGroupOpen]
|
||||
)
|
||||
const visibleRows = useMemo(() => hideCollapsedGroupRows(flatRows, isListGroupOpen), [flatRows, isListGroupOpen])
|
||||
|
||||
// dnd-kit must see exactly the ids it renders, in render order: the sortable
|
||||
// set is derived from the rows, not from `sessions`. Feeding it the unrendered
|
||||
@@ -395,6 +392,7 @@ export function SidebarSessionsSection({
|
||||
// wasn't looking at — the drag that landed a row in the wrong slot.
|
||||
const sortableRowIds = useMemo(() => reorderableRowIds(visibleRows), [visibleRows])
|
||||
const allSortableRowIds = useMemo(() => reorderableRowIds(flatRows), [flatRows])
|
||||
|
||||
const persistSessionOrder = useCallback(
|
||||
(ids: string[]) => onReorderSessions?.(mergeVisibleReorder(allSortableRowIds, ids)),
|
||||
[allSortableRowIds, onReorderSessions]
|
||||
@@ -405,9 +403,7 @@ export function SidebarSessionsSection({
|
||||
return
|
||||
}
|
||||
|
||||
$sidebarListGroupIds.set(
|
||||
flatRows.flatMap(row => (row.kind === 'divider' ? [listGroupNodeId(row.key)] : []))
|
||||
)
|
||||
$sidebarListGroupIds.set(flatRows.flatMap(row => (row.kind === 'divider' ? [listGroupNodeId(row.key)] : [])))
|
||||
|
||||
return () => {
|
||||
$sidebarListGroupIds.set([])
|
||||
|
||||
@@ -18,12 +18,7 @@ import {
|
||||
setModelPickerOpen
|
||||
} from '@/store/session'
|
||||
import { requestForSessionProfile } from '@/store/session-request-router'
|
||||
import {
|
||||
$focusedRuntimeId,
|
||||
$focusedSessionState,
|
||||
$focusedStoredSessionId,
|
||||
$sessionTiles
|
||||
} from '@/store/session-states'
|
||||
import { $focusedRuntimeId, $focusedSessionState, $focusedStoredSessionId, $sessionTiles } from '@/store/session-states'
|
||||
|
||||
interface ModelPickerOverlayProps {
|
||||
gateway?: HermesGateway
|
||||
@@ -96,9 +91,7 @@ export function ModelPickerOverlay({
|
||||
currentProvider={currentProvider}
|
||||
gw={gateway}
|
||||
onOpenChange={setModelPickerOpen}
|
||||
onSelect={selection =>
|
||||
(pickerOwner.route ? selectFocusedModel : onSelect)({ ...selection, sessionId })
|
||||
}
|
||||
onSelect={selection => (pickerOwner.route ? selectFocusedModel : onSelect)({ ...selection, sessionId })}
|
||||
open={open}
|
||||
ownerConnectionId={pickerOwner.connectionId}
|
||||
profile={pickerOwner.profile}
|
||||
|
||||
@@ -723,9 +723,9 @@ describe('useModelControls', () => {
|
||||
})
|
||||
)
|
||||
|
||||
await expect(
|
||||
result.current.selectModel({ model: 'bogus', provider: 'xai', sessionId: 'runtime-b' })
|
||||
).resolves.toBe(false)
|
||||
await expect(result.current.selectModel({ model: 'bogus', provider: 'xai', sessionId: 'runtime-b' })).resolves.toBe(
|
||||
false
|
||||
)
|
||||
|
||||
expect(queryClient.getQueryData(ownerBKey)).toMatchObject({ model: 'old-b', provider: 'provider-b' })
|
||||
expect(queryClient.getQueryData(ambientAKey)).toMatchObject({ model: 'model-a', provider: 'provider-a' })
|
||||
|
||||
@@ -73,10 +73,7 @@ export function useModelControls({
|
||||
return { ...prev, provider, model, providers }
|
||||
}
|
||||
|
||||
queryClient.setQueryData<ModelOptionsResponse>(
|
||||
modelOptionsQueryKey(profile, sessionId, ownerConnectionId),
|
||||
patch
|
||||
)
|
||||
queryClient.setQueryData<ModelOptionsResponse>(modelOptionsQueryKey(profile, sessionId, ownerConnectionId), patch)
|
||||
|
||||
if (includeGlobal) {
|
||||
queryClient.setQueryData<ModelOptionsResponse>(modelOptionsQueryKey(profile, null, ownerConnectionId), patch)
|
||||
@@ -140,11 +137,7 @@ export function useModelControls({
|
||||
}
|
||||
|
||||
const options = queryClient.getQueryData<ModelOptionsResponse>(
|
||||
modelOptionsQueryKey(
|
||||
cacheProfile || $activeGatewayProfile.get(),
|
||||
null,
|
||||
cacheOwnerConnectionId
|
||||
)
|
||||
modelOptionsQueryKey(cacheProfile || $activeGatewayProfile.get(), null, cacheOwnerConnectionId)
|
||||
)
|
||||
|
||||
return !manualPickRemoved(options?.providers, $currentProvider.get(), $currentModel.get())
|
||||
|
||||
@@ -5789,6 +5789,7 @@ describe('usePromptActions reloadFromMessage failed-submit rollback (#95745)', (
|
||||
setMessages(seed as never)
|
||||
|
||||
let latest: Record<string, unknown> | undefined
|
||||
|
||||
const requestGateway = vi.fn(async (method: string) => {
|
||||
if (method === 'prompt.submit') {
|
||||
throw new JsonRpcGatewayError('target user message is no longer in session history', {
|
||||
|
||||
@@ -143,20 +143,14 @@ export const resolveThreadScrollTarget: GetTargetScrollTop = (targetScrollTop, {
|
||||
* off the bottom should still track, but a reader in history must not yank. */
|
||||
export const RUN_START_SNAP_THRESHOLD_PX = 64
|
||||
|
||||
export function shouldSnapOnRunStart(
|
||||
remainingPx: number,
|
||||
thresholdPx = RUN_START_SNAP_THRESHOLD_PX
|
||||
): boolean {
|
||||
export function shouldSnapOnRunStart(remainingPx: number, thresholdPx = RUN_START_SNAP_THRESHOLD_PX): boolean {
|
||||
return remainingPx < thresholdPx
|
||||
}
|
||||
|
||||
// True when the pin-to-bottom settle should re-arm. A same-session refresh
|
||||
// (transcript briefly emptied and repopulated under the same key) must keep
|
||||
// the reader's position; only a session switch or a cold-load arrival re-pins.
|
||||
export function shouldRePinOnTranscriptReload(opts: {
|
||||
sessionSwitched: boolean
|
||||
settledNonEmpty: boolean
|
||||
}): boolean {
|
||||
export function shouldRePinOnTranscriptReload(opts: { sessionSwitched: boolean; settledNonEmpty: boolean }): boolean {
|
||||
return opts.sessionSwitched || !opts.settledNonEmpty
|
||||
}
|
||||
|
||||
@@ -609,10 +603,7 @@ const ThreadMessageListInner: FC<ThreadMessageListProps> = ({
|
||||
useEffect(() => () => resetPublishedThreadScroll({ paneVisible }), [paneVisible])
|
||||
|
||||
// Floating jump button (outside this subtree) → return to the bottom.
|
||||
useEffect(
|
||||
() => onScrollToBottomRequest(() => void scrollToBottom(), sessionId),
|
||||
[scrollToBottom, sessionId]
|
||||
)
|
||||
useEffect(() => onScrollToBottomRequest(() => void scrollToBottom(), sessionId), [scrollToBottom, sessionId])
|
||||
|
||||
// Waking from display: hidden (HUD mode hides the main window; OS hide does
|
||||
// the same to any window): rAF and ResizeObserver may have been frozen, so
|
||||
|
||||
@@ -163,7 +163,8 @@ export const ja = defineLocale({
|
||||
openaiRejectedApiKey: 'OpenAI が API キーを拒否しました。',
|
||||
openaiRejectedApiKeyWithStatus: status => `OpenAI が API キーを拒否しました (${status} invalid_api_key)。`,
|
||||
openaiTtsNeedsKey: 'OpenAI TTS には VOICE_TOOLS_OPENAI_KEY または OPENAI_API_KEY が必要です。',
|
||||
codeSkewRestartRequired: 'アップデート後、このバックエンドは古いコードのままです。再起動して新しいコードを読み込んでください。'
|
||||
codeSkewRestartRequired:
|
||||
'アップデート後、このバックエンドは古いコードのままです。再起動して新しいコードを読み込んでください。'
|
||||
},
|
||||
voice: {
|
||||
configureSpeechToText: '音声モードを使用するには音声認識を設定してください。',
|
||||
@@ -998,7 +999,8 @@ export const ja = defineLocale({
|
||||
model: 'モデル',
|
||||
applying: '適用中...',
|
||||
loadFailed: 'モデルを読み込めませんでした',
|
||||
restartRequired: 'アップデート後、このバックエンドは古いコードのままです。再起動して新しいコードを読み込んでください。',
|
||||
restartRequired:
|
||||
'アップデート後、このバックエンドは古いコードのままです。再起動して新しいコードを読み込んでください。',
|
||||
restartBackend: 'バックエンドを再起動',
|
||||
restartingBackend: 'バックエンドを再起動中...',
|
||||
restartFailed: 'バックエンドを再起動できませんでした',
|
||||
|
||||
@@ -206,13 +206,7 @@ describe('modelOptionsQueryKey', () => {
|
||||
const sourceBKey = modelOptionsQueryKey('default', 'session-1', 'source-b')
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
expect(sourceAKey).toEqual([
|
||||
'model-options',
|
||||
'default',
|
||||
'session-1',
|
||||
'owner',
|
||||
'source-a'
|
||||
])
|
||||
expect(sourceAKey).toEqual(['model-options', 'default', 'session-1', 'owner', 'source-a'])
|
||||
queryClient.setQueryData(sourceAKey, { providers: [{ models: ['a/model'], slug: 'a' }] })
|
||||
queryClient.setQueryData(sourceBKey, { providers: [{ models: ['b/model'], slug: 'b' }] })
|
||||
|
||||
|
||||
@@ -43,4 +43,4 @@ describe('resolveModelPickerOwner', () => {
|
||||
})
|
||||
).toEqual({ connectionId: 'connection-a', profile: 'profile-a', route: undefined })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -36,4 +36,4 @@ export function resolveModelPickerOwner({
|
||||
profile: route?.targetProfile || route?.profile || ambientProfile,
|
||||
route
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,12 +214,7 @@ describe('hideCollapsedGroupRows', () => {
|
||||
|
||||
const visible = hideCollapsedGroupRows(rows, key => key !== 'yesterday')
|
||||
|
||||
expect(visible).toEqual([
|
||||
rows[0],
|
||||
rows[1],
|
||||
rows[4],
|
||||
rows[5]
|
||||
])
|
||||
expect(visible).toEqual([rows[0], rows[1], rows[4], rows[5]])
|
||||
})
|
||||
|
||||
it('never hides the unlabelled head above the first divider', () => {
|
||||
|
||||
@@ -195,6 +195,7 @@ export function hideCollapsedGroupRows(
|
||||
if (row.kind === 'divider') {
|
||||
hiding = !isOpen(row.key)
|
||||
out.push(row)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,11 @@ import { lastVisibleMessageIsUser } from '@/app/chat/thread-loading'
|
||||
import type { ContextSuggestion } from '@/app/types'
|
||||
import type { HermesConnection } from '@/global'
|
||||
import type { ChatMessage } from '@/lib/chat-messages'
|
||||
import { activeConnectionScopeSuffix, connectionScopeSuffix, rescopeConnectionScopedStores } from '@/lib/connection-scoped'
|
||||
import {
|
||||
activeConnectionScopeSuffix,
|
||||
connectionScopeSuffix,
|
||||
rescopeConnectionScopedStores
|
||||
} from '@/lib/connection-scoped'
|
||||
import { persistBoolean, persistString, readJson, storedBoolean, storedString, writeJson } from '@/lib/storage'
|
||||
import { syncCronModelImpactConnection } from '@/store/cron-model-impact-scope'
|
||||
import type { SessionInfo, UsageStats } from '@/types/hermes'
|
||||
|
||||
@@ -32,7 +32,7 @@ describe('publishThreadAtBottom', () => {
|
||||
expect($threadScrolledUp.get()).toBe(false)
|
||||
})
|
||||
|
||||
it('keeps the visible pane\'s scrolled-up chrome when a hidden pane publishes', () => {
|
||||
it("keeps the visible pane's scrolled-up chrome when a hidden pane publishes", () => {
|
||||
publishThreadAtBottom(false, { paneVisible: true })
|
||||
|
||||
publishThreadAtBottom(true, { paneVisible: false })
|
||||
@@ -77,7 +77,7 @@ describe('requestScrollToBottom', () => {
|
||||
stopB()
|
||||
})
|
||||
|
||||
it('does not let a late unmount clear a newer session\'s handler', () => {
|
||||
it("does not let a late unmount clear a newer session's handler", () => {
|
||||
const first = vi.fn()
|
||||
const second = vi.fn()
|
||||
const stopFirst = onScrollToBottomRequest(first, 'session-a')
|
||||
|
||||
Reference in New Issue
Block a user