The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): match app.asar segment on either separator in resolveOutsideAsar
kshitijk4poor45760ac022a7
diff --git a/apps/desktop/electron/window-below.test.ts b/apps/desktop/electron/window-below.test.tsindex 21bfde665ec..5dcb741d848 100644--- a/apps/desktop/electron/window-below.test.ts+++ b/apps/desktop/electron/window-below.test.ts@@ -156,17 +156,22 @@ describe('resolveOutsideAsar', () => {).toBe('file:///Applications/Hermes.app/Contents/Resources/app.asar.unpacked/dist/node_modules/get-windows/index.js')})- it('leaves a dev-tree specifier alone', () => {- const dev = 'file:///Users/dev/hermes-agent/node_modules/get-windows/index.js'-- expect(resolveOutsideAsar(dev)).toBe(dev)+ // The staged specifier is built with path.join, so on Windows the archive+ // segment is delimited by backslashes, not the slashes a file: URL has.+ it('redirects a Windows packaged path built with backslashes', () => {+ expect(resolveOutsideAsar('C:\\Users\\me\\AppData\\Local\\Hermes\\resources\\app.asar\\dist\\node_modules\\get-windows\\index.js')).toBe(+ 'C:\\Users\\me\\AppData\\Local\\Hermes\\resources\\app.asar.unpacked\\dist\\node_modules\\get-windows\\index.js'+ )})// Only the exact archive segment counts — a directory that merely starts- // with the name must not be rewritten.+ // with the name must not be rewritten, and a dev tree has nothing to rewrite.it('requires app.asar to be a complete path segment', () => {- const lookalike = 'file:///opt/app.asar-tools/node_modules/get-windows/index.js'-- expect(resolveOutsideAsar(lookalike)).toBe(lookalike)+ for (const untouched of [+ 'file:///opt/app.asar-tools/node_modules/get-windows/index.js',+ 'file:///Users/dev/hermes-agent/node_modules/get-windows/index.js'+ ]) {+ expect(resolveOutsideAsar(untouched)).toBe(untouched)+ }})})diff --git a/apps/desktop/electron/window-below.ts b/apps/desktop/electron/window-below.tsindex 9ccce04baf8..ca22056bc94 100644--- a/apps/desktop/electron/window-below.ts+++ b/apps/desktop/electron/window-below.ts@@ -150,12 +150,14 @@ const describeError = (error: unknown): string =>/*** Redirect a resolved module specifier out of `app.asar` so its files exist on- * the real filesystem. `/app.asar/` only ever appears as a complete path+ * the real filesystem. `app.asar` only ever appears as a complete path* segment in a packaged build (electron-builder names the archive exactly- * that), so in dev — where nothing is archived — this is a no-op.+ * that), so in dev — where nothing is archived — this is a no-op. The segment+ * is matched against either separator because the staged specifier comes from+ * `path.join`, which on Windows yields backslashes; same regex as main.ts.*/export const resolveOutsideAsar = (specifier: string): string =>- specifier.replace('/app.asar/', '/app.asar.unpacked/')+ specifier.replace(/app\.asar(?=$|[\\/])/, 'app.asar.unpacked')let getWindowsModule: Promise<GetWindowsModule | EnumerationFailure> | null = null