Skip to content

The agent that grows with you

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

hermes-seaeye[bot]1cb26bf248e1
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index b8d0ff24033..1a36826418e 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -443,7 +443,13 @@ import {
import { createPoolStopper } from './pool-stop'
import { poolTouchKeys } from './pool-touch-scope'
import { createPortalSession } from './portal-session'
-import { createKeepAwake, type KeepAwakeMode, keepAwakeWanted, parseKeepAwakeMode, readKeepAwakeMode } from './power-save'
+import {
+ createKeepAwake,
+ type KeepAwakeMode,
+ keepAwakeWanted,
+ parseKeepAwakeMode,
+ readKeepAwakeMode
+} from './power-save'
import { readPreUpdateBackupEnabled } from './pre-update-backup-config'
import { capturePreviewContents } from './preview-capture'
import { onPreviewWatchOwnerDestroyed, sendPreviewFileChangedToOwner } from './preview-file-watch'
diff --git a/apps/desktop/electron/power-save.test.ts b/apps/desktop/electron/power-save.test.ts
index e818ab3258a..58d1a31bc3b 100644
--- a/apps/desktop/electron/power-save.test.ts
+++ b/apps/desktop/electron/power-save.test.ts
@@ -83,7 +83,7 @@ describe('keep-awake mode', () => {
expect(readKeepAwakeMode({ mode: 'sometimes' })).toBe('off')
})
- it("holds the blocker only when the mode and the live turn picture agree", () => {
+ it('holds the blocker only when the mode and the live turn picture agree', () => {
expect(keepAwakeWanted('off', true)).toBe(false)
expect(keepAwakeWanted('off', false)).toBe(false)
expect(keepAwakeWanted('always', true)).toBe(true)
diff --git a/apps/desktop/src/i18n/zh-hant_settings.ts b/apps/desktop/src/i18n/zh-hant_settings.ts
index af39e9a835d..4f323d14fb0 100644
--- a/apps/desktop/src/i18n/zh-hant_settings.ts
+++ b/apps/desktop/src/i18n/zh-hant_settings.ts
@@ -776,7 +776,8 @@ export const zhHantSettings = {
imported: '設定已匯入',
invalidJson: '設定 JSON 無效',
keepAwakeTitle: '保持電腦喚醒',
- keepAwakeDesc: '阻止本機睡眠。「執行期間」僅在有回合進行時生效,整夜執行得以持續,又不會讓筆電整週保持喚醒。螢幕仍可變暗。',
+ keepAwakeDesc:
+ '阻止本機睡眠。「執行期間」僅在有回合進行時生效,整夜執行得以持續,又不會讓筆電整週保持喚醒。螢幕仍可變暗。',
keepAwakeOff: '關閉',
keepAwakeWhileWorking: '執行期間',
keepAwakeAlways: '一律',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 30befe55772..1257bf27340 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -1323,7 +1323,8 @@ export const zh = defineLocale({
toolsetsWipeConfirm:
'确定移除所有已启用的工具集吗?这将禁用记忆、终端、网络搜索、委派以及大多数其他工具,直到你重新启用它们。',
keepAwakeTitle: '保持电脑唤醒',
- keepAwakeDesc: '阻止本机休眠。“运行期间”仅在有回合进行时生效,通宵运行得以继续,又不会让笔记本整周保持唤醒。屏幕仍可变暗。',
+ keepAwakeDesc:
+ '阻止本机休眠。“运行期间”仅在有回合进行时生效,通宵运行得以继续,又不会让笔记本整周保持唤醒。屏幕仍可变暗。',
keepAwakeOff: '关闭',
keepAwakeWhileWorking: '运行期间',
keepAwakeAlways: '始终',
diff --git a/apps/desktop/src/plugins/hermes-bots/data.bot-meta.test.ts b/apps/desktop/src/plugins/hermes-bots/data.bot-meta.test.ts
index 53004f7131b..1ea0f820917 100644
--- a/apps/desktop/src/plugins/hermes-bots/data.bot-meta.test.ts
+++ b/apps/desktop/src/plugins/hermes-bots/data.bot-meta.test.ts
@@ -368,7 +368,7 @@ describe('server metadata reconciliation', () => {
// Two machines, both with a profile literally named `default`: the VPS bot is
// "Agent A" on its own backend; this Desktop's local agent is "Agent B", whose
// title still sits under the bare legacy key from its single-source days.
-describe('a bot is named by its own backend, never by another bot\'s cached record', () => {
+describe("a bot is named by its own backend, never by another bot's cached record", () => {
const vps = {
connectionId: 'vps',
display_name: 'Agent A',
@@ -382,34 +382,36 @@ describe('a bot is named by its own backend, never by another bot\'s cached reco
let revision = 3
const configures: Array<Record<string, unknown>> = []
- hostMock.requestProfile.mockImplementation(async (_route: unknown, method: string, params: Record<string, unknown>) => {
- if (method === 'profiles.list') {
- return {
- profiles: [
- {
- name: 'default',
- ui_meta: { 'hermes-bots': { color: '#0000ff', groups: [] } },
- ui_meta_revisions: { 'hermes-bots': revision }
- }
- ]
+ hostMock.requestProfile.mockImplementation(
+ async (_route: unknown, method: string, params: Record<string, unknown>) => {
+ if (method === 'profiles.list') {
+ return {
+ profiles: [
+ {
+ name: 'default',
+ ui_meta: { 'hermes-bots': { color: '#0000ff', groups: [] } },
+ ui_meta_revisions: { 'hermes-bots': revision }
+ }
+ ]
+ }
}
- }
- if (method === 'profiles.configure') {
- configures.push(structuredClone(params))
+ if (method === 'profiles.configure') {
+ configures.push(structuredClone(params))
+
+ // Another writer lands between this save's read and its write, once.
+ if (configures.length === 1) {
+ revision = 4
- // Another writer lands between this save's read and its write, once.
- if (configures.length === 1) {
- revision = 4
+ return { applied: { ui_meta: false, ui_meta_conflicts: { 'hermes-bots': { actual: 4, expected: 3 } } } }
+ }
- return { applied: { ui_meta: false, ui_meta_conflicts: { 'hermes-bots': { actual: 4, expected: 3 } } } }
+ return { applied: { ui_meta: true } }
}
- return { applied: { ui_meta: true } }
+ return {}
}
-
- return {}
- })
+ )
await expect(saveBotMeta(vps, { groups: ['room'] })).resolves.toMatchObject({ serverOutcome: 'persisted' })
@@ -443,7 +445,7 @@ describe('a bot is named by its own backend, never by another bot\'s cached reco
expect(groupSpeakerLabel('vps::default')).not.toBe('Agent B')
})
- it('only a fresh answer from the bot\'s backend corrects its record, and a title alone never mints one', () => {
+ it("only a fresh answer from the bot's backend corrects its record, and a title alone never mints one", () => {
$botMeta.set({ 'vps::default': { color: '#00ff00', title: 'New title' } })
// The VPS stops answering; the pane keeps its last-painted row, which predates the rename.
const painted = { ...vps, title: 'Old title' } as RosterRow
diff --git a/apps/desktop/src/plugins/hermes-bots/data.ts b/apps/desktop/src/plugins/hermes-bots/data.ts
index ddace56378e..24b91ecfdb6 100644
--- a/apps/desktop/src/plugins/hermes-bots/data.ts
+++ b/apps/desktop/src/plugins/hermes-bots/data.ts
@@ -333,7 +333,11 @@ interface ServerBotMeta {
/** How many times a save re-reads the server after losing a CAS race. */
const BOT_META_CAS_ATTEMPTS = 3
-async function readServerBotMeta(bot: RosterRow, name: string, route: null | ProfileRoute): Promise<null | ServerBotMeta> {
+async function readServerBotMeta(
+ bot: RosterRow,
+ name: string,
+ route: null | ProfileRoute
+): Promise<null | ServerBotMeta> {
const params = { include_sessions: false }
// The read is the first half of a user's save: it dials foreground like the write.
diff --git a/apps/desktop/src/plugins/hermes-bots/hidden-bots.test.ts b/apps/desktop/src/plugins/hermes-bots/hidden-bots.test.ts
index cc65372616c..ad02b40052c 100644
--- a/apps/desktop/src/plugins/hermes-bots/hidden-bots.test.ts
+++ b/apps/desktop/src/plugins/hermes-bots/hidden-bots.test.ts
@@ -83,9 +83,7 @@ beforeEach(() => {
vi.clearAllMocks()
// A save reads the bot's server namespace (profiles.list) before writing it.
request.mockImplementation(async (method: string) =>
- method === 'profiles.list'
- ? { profiles: [{ name: 'default' }, { name: 'ghost' }] }
- : { applied: { ui_meta: true } }
+ method === 'profiles.list' ? { profiles: [{ name: 'default' }, { name: 'ghost' }] } : { applied: { ui_meta: true } }
)
})