Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/desktop-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:
jobs:
e2e:
name: E2E (${{ matrix.electron }})
runs-on: macos-14
runs-on: macos-26
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:

package-smoke:
name: Unsigned package smoke
runs-on: macos-14
runs-on: macos-26
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/desktop-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ permissions:
jobs:
build-sign-notarize:
name: Build, Sign, Notarize
runs-on: macos-14
runs-on: macos-26
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
Expand Down Expand Up @@ -167,8 +167,8 @@ jobs:
if: ${{ inputs.sign }}
run: |
DMG="$(ls apps/desktop/release/*.dmg | head -1)"
xcrun stapler validate "$DMG"
hdiutil attach "$DMG" -mountpoint /tmp/sim-dmg -nobrowse -quiet
xcrun stapler validate /tmp/sim-dmg/*.app
spctl --assess --type execute --verbose /tmp/sim-dmg/*.app
codesign --verify --deep --strict /tmp/sim-dmg/*.app
hdiutil detach /tmp/sim-dmg -quiet
Expand Down
Binary file added apps/desktop/build/dmg-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/desktop/build/dmg-background@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions apps/desktop/build/entitlements.mac.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<!-- Hardened Runtime blocks microphone capture without this, so the
composer's voice input fails with NotAllowedError in signed builds
even after the user grants access in System Settings. -->
<key>com.apple.security.device.audio-input</key>
<true/>
</dict>
</plist>
20 changes: 20 additions & 0 deletions apps/desktop/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,32 @@ mac:
mergeASARs: false
hardenedRuntime: true
gatekeeperAssess: false
# macOS refuses to show the microphone prompt at all — it kills the process —
# unless the bundle declares why it wants the device.
extendInfo:
NSMicrophoneUsageDescription: Sim uses your microphone for voice input in Chat.
entitlements: build/entitlements.mac.plist
entitlementsInherit: build/entitlements.mac.plist
notarize: true

dmg:
sign: false
title: ${productName}
# Finder uses the image dimensions as the installer window dimensions. The
# @2x companion is detected automatically and keeps the mountain artwork and
# install arrow sharp on Retina displays.
background: build/dmg-background.png
iconSize: 96
iconTextSize: 13
# Keep both icon centers inside the compact 660x420 Finder canvas.
contents:
- x: 165
y: 210
type: file
- x: 495
y: 210
type: link
path: /Applications

# node-pty ships pure N-API prebuilds, which are ABI-stable across Node and
# Electron versions, so there is nothing to rebuild against Electron's ABI.
Expand Down
11 changes: 11 additions & 0 deletions apps/desktop/src/main/browser-agent/cdp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export interface CdpCallbacks {
const callbacksByContents = new WeakMap<WebContents, CdpCallbacks>()
/** Contents already instrumented (attach survives for the tab's lifetime). */
const instrumented = new WeakSet<WebContents>()
/** Tracks trusted input currently being dispatched by the agent itself. */
const agentInputDepthByContents = new WeakMap<WebContents, number>()
/** Flattened CDP child-target sessions keyed by their protocol frame/target id. */
const childSessionsByContents = new WeakMap<WebContents, Map<string, string>>()
const FRAME_WORLD_NAME = 'sim-browser-agent'
Expand All @@ -62,6 +64,7 @@ async function sendInput(
method: string,
params: Record<string, unknown>
): Promise<void> {
agentInputDepthByContents.set(contents, (agentInputDepthByContents.get(contents) ?? 0) + 1)
let timer: NodeJS.Timeout | undefined
const timeout = new Promise<never>((_resolve, reject) => {
timer = setTimeout(
Expand All @@ -73,9 +76,17 @@ async function sendInput(
await Promise.race([send(contents, method, params), timeout])
} finally {
clearTimeout(timer)
const nextDepth = (agentInputDepthByContents.get(contents) ?? 1) - 1
if (nextDepth > 0) agentInputDepthByContents.set(contents, nextDepth)
else agentInputDepthByContents.delete(contents)
}
}

/** Distinguishes user input from CDP input when Electron mirrors it as an event. */
export function isDispatchingAgentInput(contents: WebContents): boolean {
return (agentInputDepthByContents.get(contents) ?? 0) > 0
}

/** Idempotently instruments a tab's WebContents. */
export async function ensureInstrumented(contents: WebContents, cb: CdpCallbacks): Promise<void> {
callbacksByContents.set(contents, cb)
Expand Down
Loading
Loading