Skip to content

The agent that grows with you

fmt(js): `npm run fix` on merge (#89501)

hermes-seaeye[bot]19591aa390ae
diff --git a/apps/desktop/electron/desktop-plugin-install.test.ts b/apps/desktop/electron/desktop-plugin-install.test.ts
index 43b28867823..e7bb67e9b00 100644
--- a/apps/desktop/electron/desktop-plugin-install.test.ts
+++ b/apps/desktop/electron/desktop-plugin-install.test.ts
@@ -55,9 +55,7 @@ describe('desktopPluginFolderName', () => {
})
it('uses the last meaningful subdir, not a generic desktop folder', () => {
- expect(desktopPluginFolderName('https://github.com/o/monorepo.git', 'plugins/alerts/desktop')).toBe(
- 'alerts'
- )
+ expect(desktopPluginFolderName('https://github.com/o/monorepo.git', 'plugins/alerts/desktop')).toBe('alerts')
})
})
diff --git a/apps/desktop/electron/desktop-plugin-install.ts b/apps/desktop/electron/desktop-plugin-install.ts
index 8d9d2157487..ed6096d7205 100644
--- a/apps/desktop/electron/desktop-plugin-install.ts
+++ b/apps/desktop/electron/desktop-plugin-install.ts
@@ -98,9 +98,7 @@ export function resolvePluginGitUrl(identifier: string): ResolvedGitUrl {
return { gitUrl, subdir }
}
- throw new Error(
- "Invalid plugin identifier. Use a Git URL or 'owner/repo' (optionally with a subdirectory)."
- )
+ throw new Error("Invalid plugin identifier. Use a Git URL or 'owner/repo' (optionally with a subdirectory).")
}
export function repoNameFromUrl(url: string): string {
@@ -195,8 +193,8 @@ export function findDesktopEntry(pluginRoot: string): { entryFile: string; sourc
export async function detectPluginComponents(pluginRoot: string): Promise<PluginComponentDetection> {
const hasYaml =
- pathExistsSync(path.join(pluginRoot, 'plugin.yaml')) ||
- pathExistsSync(path.join(pluginRoot, 'plugin.yml'))
+ pathExistsSync(path.join(pluginRoot, 'plugin.yaml')) || pathExistsSync(path.join(pluginRoot, 'plugin.yml'))
+
const hasInit = pathExistsSync(path.join(pluginRoot, '__init__.py'))
const hasPortable = pathExistsSync(path.join(pluginRoot, 'plugin.json'))
const agent = (hasYaml && hasInit) || hasPortable
@@ -214,6 +212,7 @@ export async function detectPluginComponents(pluginRoot: string): Promise<Plugin
const yamlPath = pathExistsSync(path.join(pluginRoot, 'plugin.yaml'))
? path.join(pluginRoot, 'plugin.yaml')
: path.join(pluginRoot, 'plugin.yml')
+
const text = await fsp.readFile(yamlPath, 'utf8')
const match = text.match(/^name:\s*['"]?([^'"\n]+)['"]?\s*$/m)
@@ -271,6 +270,7 @@ function runGit(gitBin: string, args: string[], cwd?: string): Promise<{ code: n
})
let stderr = ''
+
const timer = setTimeout(() => {
child.kill('SIGKILL')
reject(new Error('Git clone timed out after 60 seconds.'))
@@ -326,9 +326,7 @@ async function resolvePluginRoot(cloneRoot: string, subdir: string | null): Prom
function insecureSchemeWarnings(gitUrl: string): { warnings: string[]; insecure: boolean } {
if (gitUrl.startsWith('http://') || gitUrl.startsWith('file://')) {
return {
- warnings: [
- 'This URL uses an insecure or local scheme. Prefer https:// or git@ for production installs.'
- ],
+ warnings: ['This URL uses an insecure or local scheme. Prefer https:// or git@ for production installs.'],
insecure: true
}
}
@@ -336,10 +334,7 @@ function insecureSchemeWarnings(gitUrl: string): { warnings: string[]; insecure:
return { warnings: [], insecure: false }
}
-export async function probePluginRepo(
- gitBin: string,
- identifier: string
-): Promise<PluginProbeResult> {
+export async function probePluginRepo(gitBin: string, identifier: string): Promise<PluginProbeResult> {
try {
const { gitUrl, subdir } = resolvePluginGitUrl(identifier)
const { warnings, insecure } = insecureSchemeWarnings(gitUrl)
@@ -409,9 +404,8 @@ export async function installDesktopPluginFromGit(
}
const sourceDir =
- detected.desktopSourceSubdir === '.'
- ? pluginRoot
- : path.join(pluginRoot, detected.desktopSourceSubdir)
+ detected.desktopSourceSubdir === '.' ? pluginRoot : path.join(pluginRoot, detected.desktopSourceSubdir)
+
const pluginName = desktopPluginFolderName(gitUrl, subdir)
const targetDir = path.join(desktopPluginsRoot, pluginName)
const targetPlugin = path.join(targetDir, 'plugin.js')
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index b4877438788..b0b25c49b99 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -14659,12 +14659,7 @@ ipcMain.handle('hermes:plugin:installDesktop', async (_event, payload) => {
const desktopPluginsRoot = await localPluginsRoot('desktop-plugins')
- return installDesktopPluginFromGit(
- resolveGitBinary(),
- identifier,
- desktopPluginsRoot,
- Boolean(payload?.force)
- )
+ return installDesktopPluginFromGit(resolveGitBinary(), identifier, desktopPluginsRoot, Boolean(payload?.force))
})
// Rename a file/folder in place. The renderer passes the existing path + a new
@@ -15274,11 +15269,7 @@ function _extractDeepLink(argv) {
return null
}
- return (
- argv.find(
- a => typeof a === 'string' && DEEPLINK_SCHEMES.some(s => a.startsWith(`${s}://`))
- ) || null
- )
+ return argv.find(a => typeof a === 'string' && DEEPLINK_SCHEMES.some(s => a.startsWith(`${s}://`))) || null
}
function handleDeepLink(url) {
diff --git a/apps/desktop/src/app/settings/plugin-install-modal.tsx b/apps/desktop/src/app/settings/plugin-install-modal.tsx
index da7365de7a0..40012f238c2 100644
--- a/apps/desktop/src/app/settings/plugin-install-modal.tsx
+++ b/apps/desktop/src/app/settings/plugin-install-modal.tsx
@@ -31,9 +31,7 @@ import {
import { $activeGatewayProfile, $profileScope } from '@/store/profile'
import { $connection } from '@/store/session'
-type ProbeResult = Awaited<
- ReturnType<NonNullable<NonNullable<Window['hermesDesktop']>['probePluginRepo']>>
->
+type ProbeResult = Awaited<ReturnType<NonNullable<NonNullable<Window['hermesDesktop']>['probePluginRepo']>>>
type ProbePhase = 'idle' | 'probing' | 'ready' | 'error'
@@ -148,12 +146,11 @@ export function PluginInstallModal() {
}, [request, resetState, runProbe])
const profileLabel = activeProfile || profileScope || 'default'
+
const agentTargetHint =
connection?.mode === 'remote' ? m.agentTargetRemote(profileLabel) : m.agentTargetLocal(profileLabel)
- const sourceLinks = useMemo(
- () => (request ? resolvePluginSourceLinks(request.repo) : null),
- [request]
- )
+
+ const sourceLinks = useMemo(() => (request ? resolvePluginSourceLinks(request.repo) : null), [request])
const handleClose = () => {
if (installing) {
@@ -306,7 +303,11 @@ export function PluginInstallModal() {
)}
</div>
- {phase === 'probing' && <p className="text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">{m.probing}</p>}
+ {phase === 'probing' && (
+ <p className="text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
+ {m.probing}
+ </p>
+ )}
{phase === 'error' && probe?.error && (
<p className="rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-[length:var(--conversation-caption-font-size)] text-destructive">
@@ -316,7 +317,9 @@ export function PluginInstallModal() {
{phase === 'ready' && probe && (
<div className="space-y-3">
- <div className="text-[length:var(--conversation-caption-font-size)] font-medium text-foreground">{m.includesHeading}</div>
+ <div className="text-[length:var(--conversation-caption-font-size)] font-medium text-foreground">
+ {m.includesHeading}
+ </div>
{probe.agent && (
<label className="flex items-start gap-3 rounded-lg border border-(--ui-stroke-tertiary) px-3 py-2">
@@ -353,25 +356,36 @@ export function PluginInstallModal() {
)}
{probe.desktop && !probe.agent && (
- <p className="text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">{m.desktopOnlyNote}</p>
+ <p className="text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
+ {m.desktopOnlyNote}
+ </p>
)}
{(probe.insecure || (probe.warnings?.length ?? 0) > 0) && (
<div className="flex items-start gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[length:var(--conversation-caption-font-size)] text-foreground">
- <AlertTriangle aria-hidden className="mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400" />
- <span>{[...(probe.warnings ?? []), probe.insecure ? m.insecureWarning : ''].filter(Boolean).join(' ')}</span>
+ <AlertTriangle
+ aria-hidden
+ className="mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400"
+ />
+ <span>
+ {[...(probe.warnings ?? []), probe.insecure ? m.insecureWarning : ''].filter(Boolean).join(' ')}
+ </span>
</div>
)}
{probe.agent && (
<label className="flex items-center justify-between gap-3">
- <span className="text-[length:var(--conversation-caption-font-size)] text-foreground">{m.enableAgent}</span>
+ <span className="text-[length:var(--conversation-caption-font-size)] text-foreground">
+ {m.enableAgent}
+ </span>
<Switch checked={enableAgent} disabled={busy || !installAgent} onCheckedChange={setEnableAgent} />
</label>
)}
<label className="flex items-center justify-between gap-3">
- <span className="text-[length:var(--conversation-caption-font-size)] text-foreground">{m.forceReinstall}</span>
+ <span className="text-[length:var(--conversation-caption-font-size)] text-foreground">
+ {m.forceReinstall}
+ </span>
<Switch checked={forceReinstall} disabled={busy} onCheckedChange={setForceReinstall} />
</label>
</div>
@@ -389,10 +403,7 @@ export function PluginInstallModal() {
<Button disabled={busy} onClick={handleClose} variant="outline">
{t.common.cancel}
</Button>
- <Button
- disabled={busy || phase !== 'ready' || !probe?.ok}
- onClick={() => void handleInstall()}
- >
+ <Button disabled={busy || phase !== 'ready' || !probe?.ok} onClick={() => void handleInstall()}>
{installing ? m.installing : m.install}
</Button>
</DialogFooter>
diff --git a/apps/desktop/src/global.d.ts b/apps/desktop/src/global.d.ts
index 72c6a4c6a30..55be4019271 100644
--- a/apps/desktop/src/global.d.ts
+++ b/apps/desktop/src/global.d.ts
@@ -359,10 +359,7 @@ declare global {
callback: (payload: { kind: string; name: string; params: Record<string, string> }) => void
) => () => void
signalDeepLinkReady?: () => Promise<{ ok: boolean }>
- probePluginRepo?: (payload: {
- identifier?: string
- repo?: string
- }) => Promise<{
+ probePluginRepo?: (payload: { identifier?: string; repo?: string }) => Promise<{
ok: boolean
agent: boolean
desktop: boolean
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 131006736fd..8fd119411a2 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -404,8 +404,7 @@ export const en: Translations = {
agentTargetRemote: profile => `Installs into the connected ${profile} backend`,
desktopTarget: "Installs into this app's local desktop-plugins folder",
desktopOnlyNote: 'Desktop-only packages do not install a backend agent plugin.',
- insecureWarning:
- 'This URL uses an insecure or local scheme. Prefer https:// or git@ for production installs.',
+ insecureWarning: 'This URL uses an insecure or local scheme. Prefer https:// or git@ for production installs.',
securityHeading: 'Before you install',
securityIntro:
'Install only from sources you trust — review the repository below if you want to see what will be added.',