Skip to content

Commit 10146e4

Browse files
committed
fix(desktop): reconcile the Windows parts after merge
Gate computer use through the platform feature table, guard the now-optional terminal bridge in the e2e specs, and name the Windows File/Help menus in the self-hosting docs and sim-setup output.
1 parent 9bb3c50 commit 10146e4

8 files changed

Lines changed: 34 additions & 19 deletions

File tree

‎apps/desktop/e2e/browser-tools.spec.ts‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,18 +1309,22 @@ test.describe('browser tools', () => {
13091309
})
13101310
test('local terminal executes through its native PTY and refuses repeated authorization', async () => {
13111311
await window.evaluate(async (scope) => {
1312-
const api = (globalThis as typeof globalThis & { simDesktop: SimDesktopApi }).simDesktop
1313-
await api.terminal.activateScope(scope)
1314-
await api.terminal.openTerminal(undefined, scope)
1312+
const terminal = (globalThis as typeof globalThis & { simDesktop: SimDesktopApi }).simDesktop
1313+
.terminal
1314+
if (!terminal) throw new Error('No agent terminal on this platform')
1315+
await terminal.activateScope(scope)
1316+
await terminal.openTerminal(undefined, scope)
13151317
}, SCOPE)
13161318
calls.set('local-cwd', {
13171319
chatId: SCOPE,
13181320
toolName: 'terminal',
13191321
args: { operation: 'cwd', args: {} },
13201322
})
13211323
const cwd = await window.evaluate(async (scope) => {
1322-
const api = (globalThis as typeof globalThis & { simDesktop: SimDesktopApi }).simDesktop
1323-
return api.terminal.executeTool('local-cwd', 'cwd', {}, scope)
1324+
const terminal = (globalThis as typeof globalThis & { simDesktop: SimDesktopApi }).simDesktop
1325+
.terminal
1326+
if (!terminal) throw new Error('No agent terminal on this platform')
1327+
return terminal.executeTool('local-cwd', 'cwd', {}, scope)
13241328
}, SCOPE)
13251329
expect(cwd.ok).toBe(true)
13261330
calls.set('local-run', {
@@ -1329,14 +1333,18 @@ test.describe('browser tools', () => {
13291333
args: { operation: 'run', args: { command: "printf 'SIM_NATIVE_TERMINAL_VERIFIED\\n'" } },
13301334
})
13311335
const result = await window.evaluate(async (scope) => {
1332-
const api = (globalThis as typeof globalThis & { simDesktop: SimDesktopApi }).simDesktop
1333-
return api.terminal.executeTool('local-run', 'run', {}, scope)
1336+
const terminal = (globalThis as typeof globalThis & { simDesktop: SimDesktopApi }).simDesktop
1337+
.terminal
1338+
if (!terminal) throw new Error('No agent terminal on this platform')
1339+
return terminal.executeTool('local-run', 'run', {}, scope)
13341340
}, SCOPE)
13351341
expect(result.ok).toBe(true)
13361342
expect(JSON.stringify(result)).toContain('SIM_NATIVE_TERMINAL_VERIFIED')
13371343
const replay = await window.evaluate(async (scope) => {
1338-
const api = (globalThis as typeof globalThis & { simDesktop: SimDesktopApi }).simDesktop
1339-
return api.terminal.executeTool('local-run', 'run', {}, scope)
1344+
const terminal = (globalThis as typeof globalThis & { simDesktop: SimDesktopApi }).simDesktop
1345+
.terminal
1346+
if (!terminal) throw new Error('No agent terminal on this platform')
1347+
return terminal.executeTool('local-run', 'run', {}, scope)
13401348
}, SCOPE)
13411349
expect(replay.ok).toBe(false)
13421350
})

‎apps/desktop/e2e/desktop-tools-live-sim.spec.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,10 +672,13 @@ test.describe('desktop tools against a live Sim', () => {
672672
// stays pending and unclaimed. Whether a handed-over command then runs depends on a terminal
673673
// being open for the chat, which this test does not set up, so it checks the claim only.
674674
const response = await page.evaluate(
675-
({ toolCallId, command }) =>
676-
(globalThis as DesktopWindow).simDesktop.terminal
675+
({ toolCallId, command }) => {
676+
const terminal = (globalThis as DesktopWindow).simDesktop.terminal
677+
if (!terminal) throw new Error('No agent terminal on this platform')
678+
return terminal
677679
.executeTool(toolCallId, 'run', { command }, 'unapproved-e2e')
678-
.catch((error: unknown) => ({ ok: false, error: String(error) })),
680+
.catch((error: unknown) => ({ ok: false, error: String(error) }))
681+
},
679682
{ toolCallId: run.toolCallId, command }
680683
)
681684
expect(response).toMatchObject({ ok: false })

‎apps/desktop/e2e/terminal-cancel.spec.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ function bridge(window: Page) {
158158
const terminalId = await window.evaluate(async (scopeId) => {
159159
const terminal = (globalThis as typeof globalThis & { simDesktop: SimDesktopApi })
160160
.simDesktop.terminal
161+
if (!terminal) throw new Error('No agent terminal on this platform')
161162
await terminal.activateScope(scopeId)
162163
terminal.setVisible?.(true, scopeId)
163164
terminal.setFocused(true, scopeId)
@@ -171,7 +172,7 @@ function bridge(window: Page) {
171172
([id, text, scopeId]) =>
172173
(
173174
globalThis as typeof globalThis & { simDesktop: SimDesktopApi }
174-
).simDesktop.terminal.write(id, text, scopeId),
175+
).simDesktop.terminal?.write(id, text, scopeId),
175176
[terminalId, `${command}\r`, scope] as const
176177
)
177178
},
@@ -180,6 +181,7 @@ function bridge(window: Page) {
180181
return window.evaluate(async (scopeId) => {
181182
const terminal = (globalThis as typeof globalThis & { simDesktop: SimDesktopApi })
182183
.simDesktop.terminal
184+
if (!terminal) throw new Error('No agent terminal on this platform')
183185
await terminal.activateScope(scopeId)
184186
return terminal.suspendScope(scopeId)
185187
}, scope)

‎apps/desktop/src/main/index.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ import { checkForUpdatesInteractive, initUpdater, type UpdaterHandle } from '@/m
117117
import { installBrowserUserAgent } from '@/main/user-agent'
118118
import { createMainWindow, handleSecondInstance, setupPermissionHandlers } from '@/main/window'
119119
import { attachWindowOpenPolicy, isPopupContents } from '@/main/windows'
120+
import { desktopFeatures } from '@/shared/platform-features'
120121

121122
const logger = createLogger('DesktopMain')
122123

@@ -184,7 +185,8 @@ function main(): void {
184185
const computerStopShortcut = 'CommandOrControl+Shift+Escape'
185186
const computerUse = new ComputerUseService({
186187
config,
187-
supported: process.platform === 'darwin' && Number.parseInt(release(), 10) >= 23,
188+
supported:
189+
desktopFeatures(process.platform).computerUse && Number.parseInt(release(), 10) >= 23,
188190
native: computerNative,
189191
openPermissionSettings: (permission) =>
190192
shell.openExternal(

‎apps/docs/content/docs/desktop/index.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ This section also shows the installed version and a downloaded version waiting f
165165

166166
Use **Let Chat run commands** to enable or disable Terminal. **Theme** and **Default zoom** control its appearance.
167167

168-
The **Sim** menu also contains **Settings…**, **Server…**, **Check for Updates…**, and **Sign Out**.
168+
The **Sim** menu also contains **Settings…**, **Server…**, **Check for Updates…**, and **Sign Out**. On Windows, **Settings…**, **Server…** and **Sign Out** are in the **File** menu and **Check for Updates…** is in **Help**; press Alt to show the menu bar.
169169

170170
## Keyboard shortcuts
171171

‎apps/docs/content/docs/platform/self-hosting/desktop.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ On macOS, open the `.dmg` and drag Sim to **Applications**. On Windows, run the
5353

5454
### Connect to your server
5555

56-
Launch Sim, choose **Sim → Server…** (on Windows, **Server…** in the **Sim** menu), enter your deployment origin, and select **Connect**. The app relaunches against that server and saves the setting across updates.
56+
Launch Sim, choose **Sim → Server…** (on Windows, **File → Server…**; press Alt to show the menu bar), enter your deployment origin, and select **Connect**. The app relaunches against that server and saves the setting across updates.
5757

5858
</Step>
5959
</Steps>

‎packages/sim-setup/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ npx sim-setup desktop --no-open
167167
The desktop app is not tied to sim.ai — it bakes in only a default server, and
168168
every Sim deployment already serves `/api/desktop/update/download` and the
169169
update feed installed apps poll. Install the signed build, then point it at your
170-
deployment with **Server…** in the Sim menu. Nothing has to be built or signed by you.
170+
deployment with **Server…** (in the Sim menu on macOS, the File menu on Windows). Nothing has to be built or signed by you.
171171

172172
### Add or change capabilities
173173

‎packages/sim-setup/src/desktop.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ const DESKTOP_PLATFORMS = {
2424
windows: {
2525
downloadPath: '/api/desktop/update/download?platform=windows',
2626
feedPath: '/api/desktop/update/latest.yml',
27-
serverCommand: 'Server…',
28-
serverCommandWhere: 'from the Sim menu',
27+
serverCommand: 'File → Server…',
28+
serverCommandWhere: 'in the menu bar (press Alt to show it)',
2929
},
3030
} as const
3131

0 commit comments

Comments
 (0)