You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dd427dd
Browse filesBrowse the repository at this point in the historyBrowse files
Only keep awaits sequential when a later call genuinely uses an earlier result, or when the ordering is deliberate (rate-limited batches, retry loops, write-then-read).
92
92
93
+
## Carry exact lifecycle ownership across async boundaries
94
+
95
+
When asynchronous work can outlive an execution, session, or resource instance, capture its
96
+
opaque ownership token before the first `await` and pass that exact token through completion and
97
+
error cleanup. Never re-adopt the current owner from delayed cleanup: a replacement may now own
98
+
the same scope. End the lifecycle by exact-token match, and clear shared state only when that end
99
+
succeeds. Current-owner adoption is reserved for synchronous user actions that explicitly stop
100
+
the current lifecycle.
101
+
93
102
## Prefetch dynamic destination lists on intent
94
103
95
104
For long lists of dynamic destinations, do not viewport-prefetch every row and do not assume
@@ -99,6 +108,12 @@ server state with the consumer's shared React Query options. A short, cancelable
99
108
avoids drive-by downloads. Do not treat `touchstart` as intent because it also begins scrolling;
100
109
let the actual unmodified click start the data request.
101
110
111
+
A speculative failure must not poison a later visit when the app default disables
112
+
`retryOnMount`: remove only that exact failed query while it is inactive, keep failures visible
113
+
to mounted consumers, and set the shared options to `retryOnMount: true` so a quick-click failure
114
+
can recover after the user leaves and returns. Never carry placeholder data between protected
115
+
resource keys (for example, workspace A to workspace B); an explicit loading state is truthful.
116
+
102
117
If a continuity-focused surface intentionally omits `loading.tsx` so the current view remains
103
118
mounted until its peer is ready, the intent path must warm both the full route and its critical
104
119
data. Otherwise keep the loading boundary so dynamic navigation remains responsive.
native/ # Node-API/AppKit bridge for native macOS Help docs search
39
41
static/ # bundled local pages (offline.html)
40
42
e2e/ # Playwright _electron smoke suite
@@ -54,7 +56,7 @@ SIM_DESKTOP_ORIGIN=http://localhost:3000 bun run dev # against local sim
54
56
-`bun run type-check` / `lint:check` — standard workspace checks; CI picks these up automatically via `turbo run`.
55
57
-`SIM_DESKTOP_USER_DATA=<dir>` isolates settings/partition state (used by e2e).
56
58
57
-
Everything is bundled by esbuild into `dist/main.cjs` + `dist/preload.cjs` — including `electron-updater` and the `@sim/*` packages — so the packaged app has **no runtime node_modules** and `electron-builder` needs no lockfile/npmRebuild step (this is the deliberate workaround for Bun ↔ electron-builder friction; there is no `package-lock.json`).
59
+
The main process and two preloads are bundled by esbuild into `dist/main.cjs`, `dist/preload.cjs`, and `dist/browser-preload.cjs`, including `electron-updater` and the `@sim/*` packages. The native `@lydell/node-pty` packages stay external so Electron can load their architecture-specific prebuilds from the packaged runtime `node_modules`; `npmRebuild` remains disabled because those Node-API prebuilds are already ABI-stable. There is no `package-lock.json`.
58
60
59
61
## Auth model (read before touching auth)
60
62
@@ -99,7 +101,7 @@ Overall this is **within normal thin-wrapper coupling** — every item is either
99
101
100
102
Local unsigned build: `bun run package:dir` (app in `release/mac-universal/`). Signed: `bun run package:mac` with `CSC_LINK`/`CSC_KEY_PASSWORD` exported.
101
103
102
-
Pre-release share (no Developer ID yet): `SIM_DESKTOP_DEFAULT_ORIGIN=https://www.dev.sim.ai bun run package:share` builds a DMG whose fresh installs default to that origin (baked at build time; official builds leave it unset → prod) and skips per-file signature timestamps. Recipients must clear quarantine once: `xattr -cr /Applications/Sim.app`.
104
+
Local unsigned pre-release share: `SIM_DESKTOP_DEFAULT_ORIGIN=https://www.dev.sim.ai bun run package:share` builds a DMG whose fresh installs default to that origin (baked at build time; official builds leave it unset → prod) and skips per-file signature timestamps. Recipients must clear quarantine once: `xattr -cr /Applications/Sim.app`.
103
105
104
106
The build also derives the app icon from `SIM_DESKTOP_DEFAULT_ORIGIN`. Every channel uses the exact production icon with its white background and black `sim` mark. Non-production channels add a thin outline using existing platform colors: dev uses orange, staging uses Loop blue, and localhost uses Workflow violet. The macOS menu-bar icon also carries a compact `D`, `S`, or `L` subscript for those environments; production remains unmarked. Native Icon Composer assets live in `build/`; `scripts/build.ts` copies the selected variant to the ignored `build/generated-icon.icon` path consumed by electron-builder. Electron-builder compiles it to `Assets.car` and derives the legacy `.icns` fallback from the same source. Matching 512px PNGs in `static/` provide the Dock icon for unpackaged runs.
105
107
@@ -185,10 +187,11 @@ Raw local file bytes are never exposed through the preload bridge and cannot be
185
187
186
188
## Known caveats
187
189
188
-
- Microphone and camera are denied by design (the permission matrix grants only sanitized clipboard writes to the app origin).
190
+
- The hosted Sim renderer may request microphone access for voice input from the configured app origin; camera access remains denied. On macOS the shell also requires the operating-system microphone grant. Separately, a page in the isolated agent browser may request microphone or camera only from its main frame after a recent native user gesture; Sim then requires an explicit document-scoped prompt and the operating-system grant where applicable.
191
+
- The built-in agent browser is not a general-purpose download manager. Its dedicated partition applies the same bounded policy to every download, including one started by a direct user click: at most 2 GiB per file, two active downloads per task, six app-wide, and a 1 GiB free-disk reserve. A rejected download appears in the browser's downloads menu; use a normal browser for an intentionally larger transfer.
189
192
- Default Electron ships H.264/AAC/MP3 — do not swap in the codec-free ffmpeg build.
190
193
- Third-party web analytics (GTM/GA) are blocked at the network layer by default (`blockThirdPartyAnalytics`); first-party PostHog `/ingest` is untouched.
191
-
-`Cmd+F` find-in-page overlay is not implemented (Monaco and tables ship their own finds); revisit if users ask.
194
+
-`Cmd+F`opens the native find overlay in built-in browser tabs. The hosted Sim workspace continues to use Monaco- and table-specific find surfaces.
192
195
- Sign-in uses only the `127.0.0.1` loopback callback, which needs no OS registration — so it completes identically under `bun run dev` (unpackaged) and in a packaged build. There is no custom URL scheme.
0 commit comments