fmt(js): `npm run fix` on merge (#81849)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
31cedb4830
commit
2389564d83
|
|
@ -85,14 +85,7 @@ const POSIX_ABSOLUTE_PATH_RE = /^\/(?!\/)/
|
|||
// (docker/ssh/singularity/modal/...) cannot see the desktop's host paths —
|
||||
// they must be crossed as bytes, like remote attachments. Mirrors the
|
||||
// container_backend set in tools/terminal_tool.py::_get_env_config.
|
||||
const CONTAINER_TERMINAL_BACKENDS = new Set([
|
||||
'docker',
|
||||
'ssh',
|
||||
'singularity',
|
||||
'modal',
|
||||
'daytona',
|
||||
'vercel_sandbox'
|
||||
])
|
||||
const CONTAINER_TERMINAL_BACKENDS = new Set(['docker', 'ssh', 'singularity', 'modal', 'daytona', 'vercel_sandbox'])
|
||||
|
||||
// `mode: local` means the gateway was launched locally, not necessarily that
|
||||
// Electron and the gateway share a filesystem. Windows Desktop can front a
|
||||
|
|
@ -104,6 +97,7 @@ function attachmentPathNeedsUpload(path: string, backendCwd?: null | string, ter
|
|||
if (CONTAINER_TERMINAL_BACKENDS.has((terminalBackend || '').trim().toLowerCase())) {
|
||||
return true
|
||||
}
|
||||
|
||||
return WINDOWS_ABSOLUTE_PATH_RE.test(path.trim()) && POSIX_ABSOLUTE_PATH_RE.test(backendCwd?.trim() || '')
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,12 @@ describe('tokenizeSearchText', () => {
|
|||
})
|
||||
|
||||
describe('scoreSlashMenuItem', () => {
|
||||
const item = { aliases: ['recap', 'summary'], description: 'Turn session recaps on/off', id: 'recaps', label: 'recaps' }
|
||||
const item = {
|
||||
aliases: ['recap', 'summary'],
|
||||
description: 'Turn session recaps on/off',
|
||||
id: 'recaps',
|
||||
label: 'recaps'
|
||||
}
|
||||
|
||||
it('scores exact name matches at tier 0', () => {
|
||||
expect(scoreSlashMenuItem(item, 'recaps')).toBe(0)
|
||||
|
|
@ -65,11 +70,7 @@ describe('rankSlashItems', () => {
|
|||
})
|
||||
|
||||
it('ranks name matches above description matches and drops non-matches', () => {
|
||||
const ranked = rankSlashItems(
|
||||
[{ help: 'model picker widget', id: 'gallery' }, ...apps],
|
||||
'/model',
|
||||
toScoreItem
|
||||
)
|
||||
const ranked = rankSlashItems([{ help: 'model picker widget', id: 'gallery' }, ...apps], '/model', toScoreItem)
|
||||
|
||||
expect(ranked.map(app => app.id)).toEqual(['models', 'gallery'])
|
||||
})
|
||||
|
|
|
|||
|
|
@ -51,9 +51,7 @@ function scoreFields(fields: string[], query: string, offset: number): number {
|
|||
|
||||
/** Score one item against a normalized query. Lower is better; Infinity = no match. */
|
||||
export function scoreSlashMenuItem(item: SlashScoreItem, query: string): number {
|
||||
const commandFields = [item.id, item.label ?? '', ...(item.aliases ?? [])]
|
||||
.filter(Boolean)
|
||||
.flatMap(tokenizeSearchText)
|
||||
const commandFields = [item.id, item.label ?? '', ...(item.aliases ?? [])].filter(Boolean).flatMap(tokenizeSearchText)
|
||||
|
||||
const descriptionFields = tokenizeSearchText(item.description ?? '')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue