@zyro-sec/gui-plugins 0.0.0-stage → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1085) hide show
  1. package/AGENTS.md +116 -0
  2. package/README.md +874 -3
  3. package/bunfig.toml +3 -0
  4. package/happydom.ts +77 -0
  5. package/package.json +63 -4
  6. package/src/browser/activation-delay.ts +134 -0
  7. package/src/browser/address-machine.ts +468 -0
  8. package/src/browser/address.ts +111 -0
  9. package/src/browser/agent-rendering.ts +61 -0
  10. package/src/browser/analysis.ts +260 -0
  11. package/src/browser/artifact-link.ts +69 -0
  12. package/src/browser/artifact-links.ts +55 -0
  13. package/src/browser/artifact-preview.ts +61 -0
  14. package/src/browser/assets/viewport-device-chevron.svg +5 -0
  15. package/src/browser/assets/viewport-rotate.svg +7 -0
  16. package/src/browser/bar.css +562 -0
  17. package/src/browser/capture.ts +158 -0
  18. package/src/browser/cdp.ts +97 -0
  19. package/src/browser/child-targets.ts +30 -0
  20. package/src/browser/choices.tsx +42 -0
  21. package/src/browser/chromium.ts +3018 -0
  22. package/src/browser/comment.css +38 -0
  23. package/src/browser/comment.ts +98 -0
  24. package/src/browser/connection.ts +122 -0
  25. package/src/browser/default-browser.ts +59 -0
  26. package/src/browser/diagnostics-machine.ts +522 -0
  27. package/src/browser/diagnostics.ts +317 -0
  28. package/src/browser/dialog-machine.ts +268 -0
  29. package/src/browser/disk/contained-file.ts +43 -0
  30. package/src/browser/disk/handle-path.fixture.ts +99 -0
  31. package/src/browser/disk/handle-path.ts +122 -0
  32. package/src/browser/disk/index.ts +5 -0
  33. package/src/browser/disk/preview-scope.ts +90 -0
  34. package/src/browser/electron-address.fixture.ts +143 -0
  35. package/src/browser/electron-app-badge.fixture.ts +97 -0
  36. package/src/browser/electron-crash.fixture.ts +216 -0
  37. package/src/browser/electron-dialogs.fixture.ts +114 -0
  38. package/src/browser/electron-history.fixture.ts +61 -0
  39. package/src/browser/electron-icon.fixture.ts +145 -0
  40. package/src/browser/electron-import-choice.fixture.ts +58 -0
  41. package/src/browser/electron-links.fixture.ts +549 -0
  42. package/src/browser/electron-main.ts +85 -0
  43. package/src/browser/electron-media.fixture.ts +66 -0
  44. package/src/browser/electron-open.fixture.ts +351 -0
  45. package/src/browser/electron-page.fixture.ts +253 -0
  46. package/src/browser/electron-restore.fixture.ts +135 -0
  47. package/src/browser/electron-run.ts +184 -0
  48. package/src/browser/electron-sign-in-copy.fixture.ts +365 -0
  49. package/src/browser/electron-webauthn.fixture.ts +229 -0
  50. package/src/browser/electron-workers.fixture.ts +54 -0
  51. package/src/browser/errors.ts +175 -0
  52. package/src/browser/failure-view.tsx +92 -0
  53. package/src/browser/failure.ts +174 -0
  54. package/src/browser/field-value.ts +60 -0
  55. package/src/browser/file-choosers.ts +42 -0
  56. package/src/browser/file-verification.ts +18 -0
  57. package/src/browser/files.ts +134 -0
  58. package/src/browser/find-bar.tsx +80 -0
  59. package/src/browser/find-machine.ts +43 -0
  60. package/src/browser/history/earlier.ts +23 -0
  61. package/src/browser/history/index.ts +5 -0
  62. package/src/browser/history/ipc.ts +44 -0
  63. package/src/browser/history/match.ts +196 -0
  64. package/src/browser/history/page.ts +86 -0
  65. package/src/browser/history/search.ts +209 -0
  66. package/src/browser/history/store.ts +272 -0
  67. package/src/browser/history/suggest.ts +51 -0
  68. package/src/browser/history/visits.ts +59 -0
  69. package/src/browser/host-display.ts +32 -0
  70. package/src/browser/i18n/am.ts +42 -0
  71. package/src/browser/i18n/ar.ts +46 -0
  72. package/src/browser/i18n/az.ts +42 -0
  73. package/src/browser/i18n/bg.ts +42 -0
  74. package/src/browser/i18n/bn.ts +42 -0
  75. package/src/browser/i18n/br.ts +44 -0
  76. package/src/browser/i18n/bs.ts +43 -0
  77. package/src/browser/i18n/ca.ts +44 -0
  78. package/src/browser/i18n/cs.ts +44 -0
  79. package/src/browser/i18n/da.ts +42 -0
  80. package/src/browser/i18n/de.ts +43 -0
  81. package/src/browser/i18n/dv.ts +43 -0
  82. package/src/browser/i18n/dz.ts +42 -0
  83. package/src/browser/i18n/el.ts +44 -0
  84. package/src/browser/i18n/en.ts +455 -0
  85. package/src/browser/i18n/es.ts +44 -0
  86. package/src/browser/i18n/et.ts +42 -0
  87. package/src/browser/i18n/fa.ts +42 -0
  88. package/src/browser/i18n/fi.ts +42 -0
  89. package/src/browser/i18n/fo.ts +42 -0
  90. package/src/browser/i18n/fr.ts +45 -0
  91. package/src/browser/i18n/he.ts +43 -0
  92. package/src/browser/i18n/hi.ts +42 -0
  93. package/src/browser/i18n/hr.ts +43 -0
  94. package/src/browser/i18n/hu.ts +43 -0
  95. package/src/browser/i18n/hy.ts +42 -0
  96. package/src/browser/i18n/id.ts +42 -0
  97. package/src/browser/i18n/is.ts +42 -0
  98. package/src/browser/i18n/it.ts +44 -0
  99. package/src/browser/i18n/ja.ts +42 -0
  100. package/src/browser/i18n/ka.ts +42 -0
  101. package/src/browser/i18n/km.ts +42 -0
  102. package/src/browser/i18n/ko.ts +42 -0
  103. package/src/browser/i18n/lo.ts +42 -0
  104. package/src/browser/i18n/lt.ts +44 -0
  105. package/src/browser/i18n/lv.ts +43 -0
  106. package/src/browser/i18n/mk.ts +42 -0
  107. package/src/browser/i18n/mn.ts +42 -0
  108. package/src/browser/i18n/ms.ts +42 -0
  109. package/src/browser/i18n/my.ts +43 -0
  110. package/src/browser/i18n/ne.ts +42 -0
  111. package/src/browser/i18n/nl.ts +42 -0
  112. package/src/browser/i18n/no.ts +42 -0
  113. package/src/browser/i18n/pa.ts +42 -0
  114. package/src/browser/i18n/pl.ts +44 -0
  115. package/src/browser/i18n/ro.ts +43 -0
  116. package/src/browser/i18n/ru.ts +44 -0
  117. package/src/browser/i18n/si.ts +42 -0
  118. package/src/browser/i18n/sk.ts +44 -0
  119. package/src/browser/i18n/sl.ts +44 -0
  120. package/src/browser/i18n/sq.ts +43 -0
  121. package/src/browser/i18n/sr.ts +43 -0
  122. package/src/browser/i18n/sv.ts +42 -0
  123. package/src/browser/i18n/tg.ts +42 -0
  124. package/src/browser/i18n/th.ts +42 -0
  125. package/src/browser/i18n/tk.ts +42 -0
  126. package/src/browser/i18n/tr.ts +42 -0
  127. package/src/browser/i18n/uk.ts +44 -0
  128. package/src/browser/i18n/ur.ts +42 -0
  129. package/src/browser/i18n/uz.ts +42 -0
  130. package/src/browser/i18n/vi.ts +42 -0
  131. package/src/browser/i18n/zh.ts +42 -0
  132. package/src/browser/i18n/zht.ts +42 -0
  133. package/src/browser/icon-image.ts +110 -0
  134. package/src/browser/icon-samples.ts +110 -0
  135. package/src/browser/icon.ts +72 -0
  136. package/src/browser/import-prompt.tsx +265 -0
  137. package/src/browser/index.ts +97 -0
  138. package/src/browser/ipc.ts +304 -0
  139. package/src/browser/jobs-machine.ts +181 -0
  140. package/src/browser/jobs.ts +373 -0
  141. package/src/browser/keys.ts +109 -0
  142. package/src/browser/lighthouse.ts +103 -0
  143. package/src/browser/link.ts +19 -0
  144. package/src/browser/machine.ts +1522 -0
  145. package/src/browser/main-machine.ts +99 -0
  146. package/src/browser/main.ts +394 -0
  147. package/src/browser/media-gate.ts +131 -0
  148. package/src/browser/mobile-emulation.ts +121 -0
  149. package/src/browser/model-machine.ts +93 -0
  150. package/src/browser/model.ts +1173 -0
  151. package/src/browser/native-page-menu.ts +189 -0
  152. package/src/browser/navigation-deadline.ts +20 -0
  153. package/src/browser/navigation-turn.ts +118 -0
  154. package/src/browser/network.ts +140 -0
  155. package/src/browser/notice-actions.ts +52 -0
  156. package/src/browser/overlay-machine.ts +330 -0
  157. package/src/browser/page-find.ts +71 -0
  158. package/src/browser/page-icon.tsx +27 -0
  159. package/src/browser/page-log.ts +276 -0
  160. package/src/browser/page-machine.ts +329 -0
  161. package/src/browser/page-menu.ts +158 -0
  162. package/src/browser/page-prompts.ts +753 -0
  163. package/src/browser/pane-machine.ts +664 -0
  164. package/src/browser/pane.ts +1335 -0
  165. package/src/browser/panel.fixture.tsx +2046 -0
  166. package/src/browser/panel.stories.tsx +147 -0
  167. package/src/browser/panel.tsx +2029 -0
  168. package/src/browser/passkey-groups.ts +34 -0
  169. package/src/browser/picker-machine.ts +214 -0
  170. package/src/browser/plugin-tabs.ts +26 -0
  171. package/src/browser/policy.ts +439 -0
  172. package/src/browser/preview.ts +40 -0
  173. package/src/browser/profile/chromium.ts +198 -0
  174. package/src/browser/profile/compatibility.ts +177 -0
  175. package/src/browser/profile/cookie.ts +215 -0
  176. package/src/browser/profile/database.ts +116 -0
  177. package/src/browser/profile/electron-import.fixture.ts +43 -0
  178. package/src/browser/profile/electron-link.fixture.ts +137 -0
  179. package/src/browser/profile/extension-api/action.ts +276 -0
  180. package/src/browser/profile/extension-api/api.ts +112 -0
  181. package/src/browser/profile/extension-api/app-badge.js +19 -0
  182. package/src/browser/profile/extension-api/context-menus.ts +327 -0
  183. package/src/browser/profile/extension-api/cookies.ts +192 -0
  184. package/src/browser/profile/extension-api/event-page.ts +73 -0
  185. package/src/browser/profile/extension-api/frame-styles.js +46 -0
  186. package/src/browser/profile/extension-api/host.ts +291 -0
  187. package/src/browser/profile/extension-api/index.ts +119 -0
  188. package/src/browser/profile/extension-api/label.ts +4 -0
  189. package/src/browser/profile/extension-api/manifest.ts +76 -0
  190. package/src/browser/profile/extension-api/match-pattern.ts +98 -0
  191. package/src/browser/profile/extension-api/notifications.ts +100 -0
  192. package/src/browser/profile/extension-api/permissions.ts +51 -0
  193. package/src/browser/profile/extension-api/popup.ts +200 -0
  194. package/src/browser/profile/extension-api/preload.js +203 -0
  195. package/src/browser/profile/extension-api/resource.ts +36 -0
  196. package/src/browser/profile/extension-api/storage-sync.ts +167 -0
  197. package/src/browser/profile/extension-api/stubs.ts +152 -0
  198. package/src/browser/profile/extension-api/styles.ts +230 -0
  199. package/src/browser/profile/extension-api/tab-activity.ts +23 -0
  200. package/src/browser/profile/extension-api/tabs.ts +545 -0
  201. package/src/browser/profile/extension-api/web-navigation.ts +172 -0
  202. package/src/browser/profile/extension-api/worker-events.ts +114 -0
  203. package/src/browser/profile/extensions.ts +491 -0
  204. package/src/browser/profile/filter-startup.fixture.ts +111 -0
  205. package/src/browser/profile/filter-startup.ts +178 -0
  206. package/src/browser/profile/firefox.ts +119 -0
  207. package/src/browser/profile/history.ts +146 -0
  208. package/src/browser/profile/import.ts +37 -0
  209. package/src/browser/profile/index.ts +694 -0
  210. package/src/browser/profile/install.ts +131 -0
  211. package/src/browser/profile/integrity.ts +56 -0
  212. package/src/browser/profile/ipc.ts +306 -0
  213. package/src/browser/profile/link-machine.ts +183 -0
  214. package/src/browser/profile/link.ts +335 -0
  215. package/src/browser/profile/made-up-firefox.fixture.ts +67 -0
  216. package/src/browser/profile/previews.ts +70 -0
  217. package/src/browser/profile/probe.ts +43 -0
  218. package/src/browser/profile/range.ts +14 -0
  219. package/src/browser/profile/review.ts +38 -0
  220. package/src/browser/profile/safari.ts +77 -0
  221. package/src/browser/profile/serve.ts +117 -0
  222. package/src/browser/profile/sites.ts +74 -0
  223. package/src/browser/profile/sources.ts +682 -0
  224. package/src/browser/profiling-machine.ts +554 -0
  225. package/src/browser/profiling.ts +404 -0
  226. package/src/browser/prompt-gate.ts +41 -0
  227. package/src/browser/prompt-keys.ts +120 -0
  228. package/src/browser/prompt-machine.ts +242 -0
  229. package/src/browser/prompts.tsx +594 -0
  230. package/src/browser/refs.ts +65 -0
  231. package/src/browser/refusal-bar.tsx +163 -0
  232. package/src/browser/refusal-notice.ts +60 -0
  233. package/src/browser/remote-address.ts +1 -0
  234. package/src/browser/remote-preview.ts +56 -0
  235. package/src/browser/renderer.tsx +683 -0
  236. package/src/browser/restore.ts +77 -0
  237. package/src/browser/saved-tabs.ts +135 -0
  238. package/src/browser/scheme.ts +1 -0
  239. package/src/browser/session-guard.ts +94 -0
  240. package/src/browser/settings-view.ts +49 -0
  241. package/src/browser/settings.fixture.tsx +306 -0
  242. package/src/browser/settings.tsx +1036 -0
  243. package/src/browser/site-auth.ts +58 -0
  244. package/src/browser/site-chooser.fixture.tsx +222 -0
  245. package/src/browser/site-chooser.tsx +778 -0
  246. package/src/browser/site-keys.ts +35 -0
  247. package/src/browser/site-machine.ts +134 -0
  248. package/src/browser/site-permissions.ts +239 -0
  249. package/src/browser/site-search.ts +26 -0
  250. package/src/browser/snapshot.ts +440 -0
  251. package/src/browser/system-media.ts +80 -0
  252. package/src/browser/tab-openers.ts +65 -0
  253. package/src/browser/tabs.css +20 -0
  254. package/src/browser/viewport-controls-machine.ts +134 -0
  255. package/src/browser/viewport-controls.tsx +170 -0
  256. package/src/browser/viewport-handles.tsx +119 -0
  257. package/src/browser/viewport-layout.ts +24 -0
  258. package/src/browser/viewport-native.ts +99 -0
  259. package/src/browser/viewport-preset-menu.tsx +69 -0
  260. package/src/browser/viewport-presets.ts +28 -0
  261. package/src/browser/viewport-toolbar-machine.ts +94 -0
  262. package/src/browser/webauthn-gate.ts +222 -0
  263. package/src/browser/window-open.ts +143 -0
  264. package/src/browser/wire.ts +20 -0
  265. package/src/browser/workspace-file.ts +126 -0
  266. package/src/browser/workspace-pages.ts +156 -0
  267. package/src/btw/i18n/en.ts +12 -0
  268. package/src/btw/index.ts +31 -0
  269. package/src/btw/machine.ts +341 -0
  270. package/src/btw/model.ts +222 -0
  271. package/src/btw/panel.tsx +229 -0
  272. package/src/btw/renderer.tsx +125 -0
  273. package/src/context/catalog-machine.ts +153 -0
  274. package/src/context/catalog.ts +123 -0
  275. package/src/context/export.ts +57 -0
  276. package/src/context/format.ts +32 -0
  277. package/src/context/i18n/am.ts +31 -0
  278. package/src/context/i18n/ar.ts +31 -0
  279. package/src/context/i18n/az.ts +31 -0
  280. package/src/context/i18n/bg.ts +31 -0
  281. package/src/context/i18n/bn.ts +31 -0
  282. package/src/context/i18n/br.ts +31 -0
  283. package/src/context/i18n/bs.ts +31 -0
  284. package/src/context/i18n/ca.ts +31 -0
  285. package/src/context/i18n/cs.ts +31 -0
  286. package/src/context/i18n/da.ts +31 -0
  287. package/src/context/i18n/de.ts +31 -0
  288. package/src/context/i18n/dv.ts +31 -0
  289. package/src/context/i18n/dz.ts +31 -0
  290. package/src/context/i18n/el.ts +31 -0
  291. package/src/context/i18n/en.ts +31 -0
  292. package/src/context/i18n/es.ts +31 -0
  293. package/src/context/i18n/et.ts +31 -0
  294. package/src/context/i18n/fa.ts +31 -0
  295. package/src/context/i18n/fi.ts +31 -0
  296. package/src/context/i18n/fo.ts +31 -0
  297. package/src/context/i18n/fr.ts +31 -0
  298. package/src/context/i18n/he.ts +31 -0
  299. package/src/context/i18n/hi.ts +31 -0
  300. package/src/context/i18n/hr.ts +31 -0
  301. package/src/context/i18n/hu.ts +31 -0
  302. package/src/context/i18n/hy.ts +31 -0
  303. package/src/context/i18n/id.ts +31 -0
  304. package/src/context/i18n/is.ts +31 -0
  305. package/src/context/i18n/it.ts +31 -0
  306. package/src/context/i18n/ja.ts +31 -0
  307. package/src/context/i18n/ka.ts +31 -0
  308. package/src/context/i18n/km.ts +31 -0
  309. package/src/context/i18n/ko.ts +31 -0
  310. package/src/context/i18n/lo.ts +31 -0
  311. package/src/context/i18n/lt.ts +31 -0
  312. package/src/context/i18n/lv.ts +31 -0
  313. package/src/context/i18n/mk.ts +31 -0
  314. package/src/context/i18n/mn.ts +31 -0
  315. package/src/context/i18n/ms.ts +31 -0
  316. package/src/context/i18n/my.ts +31 -0
  317. package/src/context/i18n/ne.ts +31 -0
  318. package/src/context/i18n/nl.ts +31 -0
  319. package/src/context/i18n/no.ts +31 -0
  320. package/src/context/i18n/pa.ts +31 -0
  321. package/src/context/i18n/pl.ts +31 -0
  322. package/src/context/i18n/ro.ts +31 -0
  323. package/src/context/i18n/ru.ts +31 -0
  324. package/src/context/i18n/si.ts +31 -0
  325. package/src/context/i18n/sk.ts +31 -0
  326. package/src/context/i18n/sl.ts +31 -0
  327. package/src/context/i18n/sq.ts +31 -0
  328. package/src/context/i18n/sr.ts +31 -0
  329. package/src/context/i18n/sv.ts +31 -0
  330. package/src/context/i18n/tg.ts +31 -0
  331. package/src/context/i18n/th.ts +31 -0
  332. package/src/context/i18n/tk.ts +31 -0
  333. package/src/context/i18n/tr.ts +31 -0
  334. package/src/context/i18n/uk.ts +31 -0
  335. package/src/context/i18n/ur.ts +31 -0
  336. package/src/context/i18n/uz.ts +31 -0
  337. package/src/context/i18n/vi.ts +31 -0
  338. package/src/context/i18n/zh.ts +31 -0
  339. package/src/context/i18n/zht.ts +31 -0
  340. package/src/context/index.ts +71 -0
  341. package/src/context/indicator.tsx +199 -0
  342. package/src/context/machine.ts +271 -0
  343. package/src/context/renderer.tsx +72 -0
  344. package/src/context/tab.tsx +439 -0
  345. package/src/debug/bar.tsx +409 -0
  346. package/src/debug/contract.ts +45 -0
  347. package/src/debug/focus-machine.ts +84 -0
  348. package/src/debug/heap-machine.ts +229 -0
  349. package/src/debug/i18n/am.ts +50 -0
  350. package/src/debug/i18n/ar.ts +50 -0
  351. package/src/debug/i18n/az.ts +50 -0
  352. package/src/debug/i18n/bg.ts +53 -0
  353. package/src/debug/i18n/bn.ts +50 -0
  354. package/src/debug/i18n/br.ts +51 -0
  355. package/src/debug/i18n/bs.ts +52 -0
  356. package/src/debug/i18n/ca.ts +53 -0
  357. package/src/debug/i18n/cs.ts +52 -0
  358. package/src/debug/i18n/da.ts +51 -0
  359. package/src/debug/i18n/de.ts +50 -0
  360. package/src/debug/i18n/dv.ts +51 -0
  361. package/src/debug/i18n/dz.ts +52 -0
  362. package/src/debug/i18n/el.ts +54 -0
  363. package/src/debug/i18n/en.ts +50 -0
  364. package/src/debug/i18n/es.ts +52 -0
  365. package/src/debug/i18n/et.ts +50 -0
  366. package/src/debug/i18n/fa.ts +50 -0
  367. package/src/debug/i18n/fi.ts +50 -0
  368. package/src/debug/i18n/fo.ts +50 -0
  369. package/src/debug/i18n/fr.ts +52 -0
  370. package/src/debug/i18n/he.ts +50 -0
  371. package/src/debug/i18n/hi.ts +50 -0
  372. package/src/debug/i18n/hr.ts +52 -0
  373. package/src/debug/i18n/hu.ts +52 -0
  374. package/src/debug/i18n/hy.ts +52 -0
  375. package/src/debug/i18n/id.ts +51 -0
  376. package/src/debug/i18n/is.ts +50 -0
  377. package/src/debug/i18n/it.ts +52 -0
  378. package/src/debug/i18n/ja.ts +50 -0
  379. package/src/debug/i18n/ka.ts +50 -0
  380. package/src/debug/i18n/km.ts +50 -0
  381. package/src/debug/i18n/ko.ts +50 -0
  382. package/src/debug/i18n/lo.ts +50 -0
  383. package/src/debug/i18n/lt.ts +51 -0
  384. package/src/debug/i18n/lv.ts +50 -0
  385. package/src/debug/i18n/mk.ts +53 -0
  386. package/src/debug/i18n/mn.ts +52 -0
  387. package/src/debug/i18n/ms.ts +51 -0
  388. package/src/debug/i18n/my.ts +53 -0
  389. package/src/debug/i18n/ne.ts +50 -0
  390. package/src/debug/i18n/nl.ts +50 -0
  391. package/src/debug/i18n/no.ts +50 -0
  392. package/src/debug/i18n/pa.ts +50 -0
  393. package/src/debug/i18n/pl.ts +51 -0
  394. package/src/debug/i18n/ro.ts +52 -0
  395. package/src/debug/i18n/ru.ts +51 -0
  396. package/src/debug/i18n/si.ts +50 -0
  397. package/src/debug/i18n/sk.ts +52 -0
  398. package/src/debug/i18n/sl.ts +50 -0
  399. package/src/debug/i18n/sq.ts +52 -0
  400. package/src/debug/i18n/sr.ts +52 -0
  401. package/src/debug/i18n/sv.ts +51 -0
  402. package/src/debug/i18n/tg.ts +51 -0
  403. package/src/debug/i18n/th.ts +50 -0
  404. package/src/debug/i18n/tk.ts +51 -0
  405. package/src/debug/i18n/tr.ts +50 -0
  406. package/src/debug/i18n/uk.ts +50 -0
  407. package/src/debug/i18n/ur.ts +50 -0
  408. package/src/debug/i18n/uz.ts +51 -0
  409. package/src/debug/i18n/vi.ts +51 -0
  410. package/src/debug/i18n/zh.ts +49 -0
  411. package/src/debug/i18n/zht.ts +50 -0
  412. package/src/debug/index.ts +79 -0
  413. package/src/debug/main.ts +417 -0
  414. package/src/debug/memory-infra.ts +159 -0
  415. package/src/debug/memory-log.ts +65 -0
  416. package/src/debug/memory-machine.ts +151 -0
  417. package/src/debug/memory-record.ts +36 -0
  418. package/src/debug/motion-machine.ts +229 -0
  419. package/src/debug/motion.tsx +697 -0
  420. package/src/debug/options.ts +15 -0
  421. package/src/debug/renderer.tsx +185 -0
  422. package/src/debug/server-heap.ts +63 -0
  423. package/src/debug/signal.ts +13 -0
  424. package/src/details/config-action-machine.ts +107 -0
  425. package/src/details/config-file.ts +43 -0
  426. package/src/details/details.css +555 -0
  427. package/src/details/flyout-machine.ts +252 -0
  428. package/src/details/flyout-motion.ts +26 -0
  429. package/src/details/i18n/am.ts +68 -0
  430. package/src/details/i18n/ar.ts +71 -0
  431. package/src/details/i18n/az.ts +71 -0
  432. package/src/details/i18n/bg.ts +73 -0
  433. package/src/details/i18n/bn.ts +71 -0
  434. package/src/details/i18n/br.ts +71 -0
  435. package/src/details/i18n/bs.ts +72 -0
  436. package/src/details/i18n/ca.ts +72 -0
  437. package/src/details/i18n/cs.ts +71 -0
  438. package/src/details/i18n/da.ts +71 -0
  439. package/src/details/i18n/de.ts +73 -0
  440. package/src/details/i18n/dv.ts +73 -0
  441. package/src/details/i18n/dz.ts +72 -0
  442. package/src/details/i18n/el.ts +73 -0
  443. package/src/details/i18n/en.ts +71 -0
  444. package/src/details/i18n/es.ts +72 -0
  445. package/src/details/i18n/et.ts +72 -0
  446. package/src/details/i18n/fa.ts +71 -0
  447. package/src/details/i18n/fi.ts +71 -0
  448. package/src/details/i18n/fo.ts +72 -0
  449. package/src/details/i18n/fr.ts +73 -0
  450. package/src/details/i18n/he.ts +71 -0
  451. package/src/details/i18n/hi.ts +71 -0
  452. package/src/details/i18n/hr.ts +72 -0
  453. package/src/details/i18n/hu.ts +72 -0
  454. package/src/details/i18n/hy.ts +72 -0
  455. package/src/details/i18n/id.ts +71 -0
  456. package/src/details/i18n/is.ts +71 -0
  457. package/src/details/i18n/it.ts +73 -0
  458. package/src/details/i18n/ja.ts +71 -0
  459. package/src/details/i18n/ka.ts +72 -0
  460. package/src/details/i18n/km.ts +72 -0
  461. package/src/details/i18n/ko.ts +71 -0
  462. package/src/details/i18n/lo.ts +72 -0
  463. package/src/details/i18n/lt.ts +72 -0
  464. package/src/details/i18n/lv.ts +72 -0
  465. package/src/details/i18n/mk.ts +73 -0
  466. package/src/details/i18n/mn.ts +71 -0
  467. package/src/details/i18n/ms.ts +71 -0
  468. package/src/details/i18n/my.ts +72 -0
  469. package/src/details/i18n/ne.ts +71 -0
  470. package/src/details/i18n/nl.ts +71 -0
  471. package/src/details/i18n/no.ts +71 -0
  472. package/src/details/i18n/pa.ts +71 -0
  473. package/src/details/i18n/pl.ts +72 -0
  474. package/src/details/i18n/ro.ts +72 -0
  475. package/src/details/i18n/ru.ts +72 -0
  476. package/src/details/i18n/si.ts +71 -0
  477. package/src/details/i18n/sk.ts +71 -0
  478. package/src/details/i18n/sl.ts +73 -0
  479. package/src/details/i18n/sq.ts +71 -0
  480. package/src/details/i18n/sr.ts +72 -0
  481. package/src/details/i18n/sv.ts +72 -0
  482. package/src/details/i18n/tg.ts +71 -0
  483. package/src/details/i18n/th.ts +72 -0
  484. package/src/details/i18n/tk.ts +72 -0
  485. package/src/details/i18n/tr.ts +71 -0
  486. package/src/details/i18n/uk.ts +71 -0
  487. package/src/details/i18n/ur.ts +71 -0
  488. package/src/details/i18n/uz.ts +72 -0
  489. package/src/details/i18n/vi.ts +71 -0
  490. package/src/details/i18n/zh.ts +69 -0
  491. package/src/details/i18n/zht.ts +70 -0
  492. package/src/details/index.ts +71 -0
  493. package/src/details/location-menu.tsx +82 -0
  494. package/src/details/location-workspace.tsx +39 -0
  495. package/src/details/mcp-machine.ts +278 -0
  496. package/src/details/panel.tsx +27 -0
  497. package/src/details/paths.ts +17 -0
  498. package/src/details/popover-machine.ts +97 -0
  499. package/src/details/popover.tsx +179 -0
  500. package/src/details/renderer.tsx +99 -0
  501. package/src/details/server-panel.tsx +1632 -0
  502. package/src/details/service-load-machine.ts +246 -0
  503. package/src/details/workspace-menu.tsx +490 -0
  504. package/src/details/workspace-move-machine.ts +643 -0
  505. package/src/file/apps.ts +25 -0
  506. package/src/file/arrival-guard-machine.ts +59 -0
  507. package/src/file/artifact-toolbar.tsx +161 -0
  508. package/src/file/artifact-view-machine.ts +396 -0
  509. package/src/file/artifact-view.css +336 -0
  510. package/src/file/artifact-view.tsx +1031 -0
  511. package/src/file/artifact.ts +225 -0
  512. package/src/file/browser.stories.tsx +57 -0
  513. package/src/file/browser.tsx +502 -0
  514. package/src/file/context.ts +67 -0
  515. package/src/file/contract.ts +10 -0
  516. package/src/file/drag.ts +35 -0
  517. package/src/file/find.tsx +376 -0
  518. package/src/file/i18n/am.ts +56 -0
  519. package/src/file/i18n/ar.ts +64 -0
  520. package/src/file/i18n/az.ts +56 -0
  521. package/src/file/i18n/bg.ts +56 -0
  522. package/src/file/i18n/bn.ts +56 -0
  523. package/src/file/i18n/br.ts +58 -0
  524. package/src/file/i18n/bs.ts +58 -0
  525. package/src/file/i18n/ca.ts +58 -0
  526. package/src/file/i18n/cs.ts +60 -0
  527. package/src/file/i18n/da.ts +56 -0
  528. package/src/file/i18n/de.ts +56 -0
  529. package/src/file/i18n/dv.ts +56 -0
  530. package/src/file/i18n/dz.ts +56 -0
  531. package/src/file/i18n/el.ts +56 -0
  532. package/src/file/i18n/en.ts +63 -0
  533. package/src/file/i18n/es.ts +58 -0
  534. package/src/file/i18n/et.ts +56 -0
  535. package/src/file/i18n/fa.ts +56 -0
  536. package/src/file/i18n/fi.ts +56 -0
  537. package/src/file/i18n/fo.ts +56 -0
  538. package/src/file/i18n/fr.ts +58 -0
  539. package/src/file/i18n/he.ts +58 -0
  540. package/src/file/i18n/hi.ts +56 -0
  541. package/src/file/i18n/hr.ts +58 -0
  542. package/src/file/i18n/hu.ts +56 -0
  543. package/src/file/i18n/hy.ts +56 -0
  544. package/src/file/i18n/id.ts +56 -0
  545. package/src/file/i18n/is.ts +56 -0
  546. package/src/file/i18n/it.ts +58 -0
  547. package/src/file/i18n/ja.ts +56 -0
  548. package/src/file/i18n/ka.ts +56 -0
  549. package/src/file/i18n/km.ts +56 -0
  550. package/src/file/i18n/ko.ts +56 -0
  551. package/src/file/i18n/lo.ts +56 -0
  552. package/src/file/i18n/lt.ts +60 -0
  553. package/src/file/i18n/lv.ts +58 -0
  554. package/src/file/i18n/mk.ts +56 -0
  555. package/src/file/i18n/mn.ts +56 -0
  556. package/src/file/i18n/ms.ts +56 -0
  557. package/src/file/i18n/my.ts +56 -0
  558. package/src/file/i18n/ne.ts +56 -0
  559. package/src/file/i18n/nl.ts +56 -0
  560. package/src/file/i18n/no.ts +56 -0
  561. package/src/file/i18n/pa.ts +56 -0
  562. package/src/file/i18n/pl.ts +60 -0
  563. package/src/file/i18n/ro.ts +58 -0
  564. package/src/file/i18n/ru.ts +60 -0
  565. package/src/file/i18n/si.ts +56 -0
  566. package/src/file/i18n/sk.ts +60 -0
  567. package/src/file/i18n/sl.ts +60 -0
  568. package/src/file/i18n/sq.ts +56 -0
  569. package/src/file/i18n/sr.ts +58 -0
  570. package/src/file/i18n/sv.ts +56 -0
  571. package/src/file/i18n/tg.ts +56 -0
  572. package/src/file/i18n/th.ts +56 -0
  573. package/src/file/i18n/tk.ts +56 -0
  574. package/src/file/i18n/tr.ts +56 -0
  575. package/src/file/i18n/uk.ts +60 -0
  576. package/src/file/i18n/ur.ts +57 -0
  577. package/src/file/i18n/uz.ts +56 -0
  578. package/src/file/i18n/vi.ts +56 -0
  579. package/src/file/i18n/zh.ts +56 -0
  580. package/src/file/i18n/zht.ts +56 -0
  581. package/src/file/index.ts +76 -0
  582. package/src/file/label.tsx +22 -0
  583. package/src/file/link-exists-machine.ts +137 -0
  584. package/src/file/link-open-machine.ts +249 -0
  585. package/src/file/list.tsx +224 -0
  586. package/src/file/mobile.css +35 -0
  587. package/src/file/mobile.tsx +116 -0
  588. package/src/file/open-in-app-machine.ts +185 -0
  589. package/src/file/open-in-app.tsx +395 -0
  590. package/src/file/path.ts +43 -0
  591. package/src/file/picker-machine.ts +190 -0
  592. package/src/file/pierre-tree-machine.ts +679 -0
  593. package/src/file/pierre-tree.tsx +503 -0
  594. package/src/file/renderer.tsx +1030 -0
  595. package/src/file/resolve-link.ts +152 -0
  596. package/src/file/scroll-machine.ts +272 -0
  597. package/src/file/search-machine.ts +202 -0
  598. package/src/file/styles.ts +5 -0
  599. package/src/file/tabs.css +15 -0
  600. package/src/file/tree-focus.css +6 -0
  601. package/src/file/tree-model.ts +239 -0
  602. package/src/file/view.tsx +572 -0
  603. package/src/goal/goal.css +43 -0
  604. package/src/goal/i18n/en.ts +12 -0
  605. package/src/goal/icons/active.svg +13 -0
  606. package/src/goal/icons/complete.svg +4 -0
  607. package/src/goal/icons/paused.svg +4 -0
  608. package/src/goal/index.ts +9 -0
  609. package/src/goal/machine.ts +364 -0
  610. package/src/goal/renderer.tsx +287 -0
  611. package/src/icon-name.typecheck.ts +9 -0
  612. package/src/main.ts +35 -0
  613. package/src/microsoft-office/document.tsx +436 -0
  614. package/src/microsoft-office/document.worker.ts +360 -0
  615. package/src/microsoft-office/fonts-cjk.ts +3 -0
  616. package/src/microsoft-office/fonts.ts +75 -0
  617. package/src/microsoft-office/i18n/en.ts +22 -0
  618. package/src/microsoft-office/index.ts +7 -0
  619. package/src/microsoft-office/links.ts +22 -0
  620. package/src/microsoft-office/office-worker.ts +124 -0
  621. package/src/microsoft-office/pages-machine.ts +356 -0
  622. package/src/microsoft-office/pages.tsx +387 -0
  623. package/src/microsoft-office/paper.ts +2 -0
  624. package/src/microsoft-office/presentation.tsx +303 -0
  625. package/src/microsoft-office/presentation.worker.ts +373 -0
  626. package/src/microsoft-office/renderer.tsx +57 -0
  627. package/src/microsoft-office/sheet-activate.ts +35 -0
  628. package/src/microsoft-office/sheet-cells.ts +188 -0
  629. package/src/microsoft-office/sheet-frame-machine.ts +286 -0
  630. package/src/microsoft-office/sheet-frame.ts +158 -0
  631. package/src/microsoft-office/sheet-paint.ts +357 -0
  632. package/src/microsoft-office/sheet-pick-machine.ts +138 -0
  633. package/src/microsoft-office/sheet-pointer-machine.ts +169 -0
  634. package/src/microsoft-office/sheet-protocol.ts +88 -0
  635. package/src/microsoft-office/slide-fonts-machine.ts +290 -0
  636. package/src/microsoft-office/slide-fonts.ts +157 -0
  637. package/src/microsoft-office/slide-paint-machine.ts +322 -0
  638. package/src/microsoft-office/slide-protocol.ts +50 -0
  639. package/src/microsoft-office/slide-text.ts +334 -0
  640. package/src/microsoft-office/spreadsheet.tsx +1165 -0
  641. package/src/microsoft-office/spreadsheet.worker.ts +259 -0
  642. package/src/microsoft-office/word-images.ts +105 -0
  643. package/src/microsoft-office/word-layout-machine.ts +219 -0
  644. package/src/microsoft-office/word-paint-machine.ts +174 -0
  645. package/src/microsoft-office/word-protocol.ts +78 -0
  646. package/src/microsoft-office/word-text.ts +260 -0
  647. package/src/microsoft-office/worker-machine.ts +111 -0
  648. package/src/microsoft-office/worker-rpc-machine.ts +336 -0
  649. package/src/microsoft-office/worker-rpc.fixture.ts +90 -0
  650. package/src/microsoft-office/worker-rpc.ts +292 -0
  651. package/src/pairing/contract.ts +24 -0
  652. package/src/pairing/copy-machine.ts +107 -0
  653. package/src/pairing/dialog.stories.tsx +69 -0
  654. package/src/pairing/dispatch.ts +42 -0
  655. package/src/pairing/i18n/en.ts +28 -0
  656. package/src/pairing/icons/pair.svg +4 -0
  657. package/src/pairing/index.ts +5 -0
  658. package/src/pairing/machine.ts +869 -0
  659. package/src/pairing/main-machine.ts +239 -0
  660. package/src/pairing/main.ts +130 -0
  661. package/src/pairing/page.stories.tsx +108 -0
  662. package/src/pairing/page.tsx +486 -0
  663. package/src/pairing/remote.ts +7 -0
  664. package/src/pairing/renderer.tsx +66 -0
  665. package/src/renderer.ts +55 -0
  666. package/src/review/contract.ts +31 -0
  667. package/src/review/detail-machine.ts +250 -0
  668. package/src/review/folder-machine.ts +404 -0
  669. package/src/review/i18n/am.ts +23 -0
  670. package/src/review/i18n/ar.ts +35 -0
  671. package/src/review/i18n/az.ts +23 -0
  672. package/src/review/i18n/bg.ts +23 -0
  673. package/src/review/i18n/bn.ts +23 -0
  674. package/src/review/i18n/br.ts +27 -0
  675. package/src/review/i18n/bs.ts +26 -0
  676. package/src/review/i18n/ca.ts +27 -0
  677. package/src/review/i18n/cs.ts +29 -0
  678. package/src/review/i18n/da.ts +23 -0
  679. package/src/review/i18n/de.ts +23 -0
  680. package/src/review/i18n/dv.ts +24 -0
  681. package/src/review/i18n/dz.ts +24 -0
  682. package/src/review/i18n/el.ts +23 -0
  683. package/src/review/i18n/en.ts +28 -0
  684. package/src/review/i18n/es.ts +27 -0
  685. package/src/review/i18n/et.ts +23 -0
  686. package/src/review/i18n/fa.ts +23 -0
  687. package/src/review/i18n/fi.ts +23 -0
  688. package/src/review/i18n/fo.ts +23 -0
  689. package/src/review/i18n/fr.ts +27 -0
  690. package/src/review/i18n/he.ts +26 -0
  691. package/src/review/i18n/hi.ts +23 -0
  692. package/src/review/i18n/hr.ts +26 -0
  693. package/src/review/i18n/hu.ts +23 -0
  694. package/src/review/i18n/hy.ts +23 -0
  695. package/src/review/i18n/id.ts +24 -0
  696. package/src/review/i18n/is.ts +23 -0
  697. package/src/review/i18n/it.ts +27 -0
  698. package/src/review/i18n/ja.ts +23 -0
  699. package/src/review/i18n/ka.ts +23 -0
  700. package/src/review/i18n/km.ts +23 -0
  701. package/src/review/i18n/ko.ts +23 -0
  702. package/src/review/i18n/lo.ts +23 -0
  703. package/src/review/i18n/lt.ts +29 -0
  704. package/src/review/i18n/lv.ts +26 -0
  705. package/src/review/i18n/mk.ts +23 -0
  706. package/src/review/i18n/mn.ts +23 -0
  707. package/src/review/i18n/ms.ts +24 -0
  708. package/src/review/i18n/my.ts +24 -0
  709. package/src/review/i18n/ne.ts +23 -0
  710. package/src/review/i18n/nl.ts +23 -0
  711. package/src/review/i18n/no.ts +23 -0
  712. package/src/review/i18n/pa.ts +23 -0
  713. package/src/review/i18n/pl.ts +29 -0
  714. package/src/review/i18n/ro.ts +26 -0
  715. package/src/review/i18n/ru.ts +29 -0
  716. package/src/review/i18n/si.ts +23 -0
  717. package/src/review/i18n/sk.ts +29 -0
  718. package/src/review/i18n/sl.ts +29 -0
  719. package/src/review/i18n/sq.ts +24 -0
  720. package/src/review/i18n/sr.ts +27 -0
  721. package/src/review/i18n/sv.ts +23 -0
  722. package/src/review/i18n/tg.ts +23 -0
  723. package/src/review/i18n/th.ts +23 -0
  724. package/src/review/i18n/tk.ts +23 -0
  725. package/src/review/i18n/tr.ts +23 -0
  726. package/src/review/i18n/uk.ts +30 -0
  727. package/src/review/i18n/ur.ts +23 -0
  728. package/src/review/i18n/uz.ts +23 -0
  729. package/src/review/i18n/vi.ts +24 -0
  730. package/src/review/i18n/zh.ts +23 -0
  731. package/src/review/i18n/zht.ts +23 -0
  732. package/src/review/index.ts +138 -0
  733. package/src/review/init-git-machine.ts +152 -0
  734. package/src/review/kinds.ts +191 -0
  735. package/src/review/machine.ts +274 -0
  736. package/src/review/mobile.tsx +91 -0
  737. package/src/review/model.ts +1123 -0
  738. package/src/review/panel.stories.tsx +50 -0
  739. package/src/review/panel.tsx +516 -0
  740. package/src/review/parts.tsx +141 -0
  741. package/src/review/render-machine.ts +74 -0
  742. package/src/review/renderer.tsx +403 -0
  743. package/src/review/screen-machine.ts +199 -0
  744. package/src/review/scroll-machine.ts +265 -0
  745. package/src/review/settings.tsx +28 -0
  746. package/src/schemes.ts +9 -0
  747. package/src/sources/i18n/en.ts +3 -0
  748. package/src/sources/index.ts +4 -0
  749. package/src/sources/panel.tsx +36 -0
  750. package/src/sources/renderer.tsx +95 -0
  751. package/src/ssh/add-machine.ts +63 -0
  752. package/src/ssh/askpass.ts +94 -0
  753. package/src/ssh/bootstrap.ts +160 -0
  754. package/src/ssh/command.ts +243 -0
  755. package/src/ssh/contract.ts +89 -0
  756. package/src/ssh/controller.ts +345 -0
  757. package/src/ssh/cover.tsx +66 -0
  758. package/src/ssh/dialog-machine.ts +249 -0
  759. package/src/ssh/dialog.stories.tsx +348 -0
  760. package/src/ssh/dialog.tsx +236 -0
  761. package/src/ssh/i18n/am.ts +37 -0
  762. package/src/ssh/i18n/ar.ts +38 -0
  763. package/src/ssh/i18n/az.ts +43 -0
  764. package/src/ssh/i18n/bg.ts +42 -0
  765. package/src/ssh/i18n/bn.ts +41 -0
  766. package/src/ssh/i18n/br.ts +43 -0
  767. package/src/ssh/i18n/bs.ts +43 -0
  768. package/src/ssh/i18n/ca.ts +43 -0
  769. package/src/ssh/i18n/cs.ts +43 -0
  770. package/src/ssh/i18n/da.ts +43 -0
  771. package/src/ssh/i18n/de.ts +44 -0
  772. package/src/ssh/i18n/dv.ts +43 -0
  773. package/src/ssh/i18n/dz.ts +43 -0
  774. package/src/ssh/i18n/el.ts +45 -0
  775. package/src/ssh/i18n/en.ts +40 -0
  776. package/src/ssh/i18n/es.ts +43 -0
  777. package/src/ssh/i18n/et.ts +41 -0
  778. package/src/ssh/i18n/fa.ts +39 -0
  779. package/src/ssh/i18n/fi.ts +40 -0
  780. package/src/ssh/i18n/fo.ts +41 -0
  781. package/src/ssh/i18n/fr.ts +43 -0
  782. package/src/ssh/i18n/he.ts +37 -0
  783. package/src/ssh/i18n/hi.ts +40 -0
  784. package/src/ssh/i18n/hr.ts +43 -0
  785. package/src/ssh/i18n/hu.ts +43 -0
  786. package/src/ssh/i18n/hy.ts +41 -0
  787. package/src/ssh/i18n/id.ts +42 -0
  788. package/src/ssh/i18n/is.ts +40 -0
  789. package/src/ssh/i18n/it.ts +43 -0
  790. package/src/ssh/i18n/ja.ts +43 -0
  791. package/src/ssh/i18n/ka.ts +43 -0
  792. package/src/ssh/i18n/km.ts +41 -0
  793. package/src/ssh/i18n/ko.ts +40 -0
  794. package/src/ssh/i18n/lo.ts +39 -0
  795. package/src/ssh/i18n/lt.ts +41 -0
  796. package/src/ssh/i18n/lv.ts +42 -0
  797. package/src/ssh/i18n/mk.ts +43 -0
  798. package/src/ssh/i18n/mn.ts +41 -0
  799. package/src/ssh/i18n/ms.ts +40 -0
  800. package/src/ssh/i18n/my.ts +41 -0
  801. package/src/ssh/i18n/ne.ts +39 -0
  802. package/src/ssh/i18n/nl.ts +43 -0
  803. package/src/ssh/i18n/no.ts +42 -0
  804. package/src/ssh/i18n/pa.ts +40 -0
  805. package/src/ssh/i18n/pl.ts +42 -0
  806. package/src/ssh/i18n/ro.ts +44 -0
  807. package/src/ssh/i18n/ru.ts +42 -0
  808. package/src/ssh/i18n/si.ts +41 -0
  809. package/src/ssh/i18n/sk.ts +42 -0
  810. package/src/ssh/i18n/sl.ts +41 -0
  811. package/src/ssh/i18n/sq.ts +43 -0
  812. package/src/ssh/i18n/sr.ts +41 -0
  813. package/src/ssh/i18n/sv.ts +43 -0
  814. package/src/ssh/i18n/tg.ts +43 -0
  815. package/src/ssh/i18n/th.ts +38 -0
  816. package/src/ssh/i18n/tk.ts +41 -0
  817. package/src/ssh/i18n/tr.ts +42 -0
  818. package/src/ssh/i18n/uk.ts +40 -0
  819. package/src/ssh/i18n/ur.ts +40 -0
  820. package/src/ssh/i18n/uz.ts +43 -0
  821. package/src/ssh/i18n/vi.ts +42 -0
  822. package/src/ssh/i18n/zh.ts +36 -0
  823. package/src/ssh/i18n/zht.ts +36 -0
  824. package/src/ssh/index.ts +71 -0
  825. package/src/ssh/main-machine.ts +532 -0
  826. package/src/ssh/main.ts +75 -0
  827. package/src/ssh/name.ts +28 -0
  828. package/src/ssh/remote-cli.ts +137 -0
  829. package/src/ssh/renderer.tsx +254 -0
  830. package/src/ssh/row.tsx +97 -0
  831. package/src/ssh/ssh.css +35 -0
  832. package/src/ssh/state.ts +217 -0
  833. package/src/ssh/window-machine.ts +533 -0
  834. package/src/terminal/connection-machine.ts +285 -0
  835. package/src/terminal/connection.ts +112 -0
  836. package/src/terminal/dispatch.ts +44 -0
  837. package/src/terminal/focus-machine.ts +112 -0
  838. package/src/terminal/focus.ts +23 -0
  839. package/src/terminal/hover-label.ts +20 -0
  840. package/src/terminal/i18n/am.ts +28 -0
  841. package/src/terminal/i18n/ar.ts +28 -0
  842. package/src/terminal/i18n/az.ts +29 -0
  843. package/src/terminal/i18n/bg.ts +29 -0
  844. package/src/terminal/i18n/bn.ts +28 -0
  845. package/src/terminal/i18n/br.ts +29 -0
  846. package/src/terminal/i18n/bs.ts +29 -0
  847. package/src/terminal/i18n/ca.ts +28 -0
  848. package/src/terminal/i18n/cs.ts +28 -0
  849. package/src/terminal/i18n/da.ts +28 -0
  850. package/src/terminal/i18n/de.ts +29 -0
  851. package/src/terminal/i18n/dv.ts +28 -0
  852. package/src/terminal/i18n/dz.ts +28 -0
  853. package/src/terminal/i18n/el.ts +30 -0
  854. package/src/terminal/i18n/en.ts +30 -0
  855. package/src/terminal/i18n/es.ts +28 -0
  856. package/src/terminal/i18n/et.ts +28 -0
  857. package/src/terminal/i18n/fa.ts +28 -0
  858. package/src/terminal/i18n/fi.ts +29 -0
  859. package/src/terminal/i18n/fo.ts +28 -0
  860. package/src/terminal/i18n/fr.ts +29 -0
  861. package/src/terminal/i18n/he.ts +28 -0
  862. package/src/terminal/i18n/hi.ts +28 -0
  863. package/src/terminal/i18n/hr.ts +28 -0
  864. package/src/terminal/i18n/hu.ts +28 -0
  865. package/src/terminal/i18n/hy.ts +29 -0
  866. package/src/terminal/i18n/id.ts +28 -0
  867. package/src/terminal/i18n/is.ts +28 -0
  868. package/src/terminal/i18n/it.ts +28 -0
  869. package/src/terminal/i18n/ja.ts +29 -0
  870. package/src/terminal/i18n/ka.ts +29 -0
  871. package/src/terminal/i18n/km.ts +28 -0
  872. package/src/terminal/i18n/ko.ts +28 -0
  873. package/src/terminal/i18n/lo.ts +28 -0
  874. package/src/terminal/i18n/lt.ts +29 -0
  875. package/src/terminal/i18n/lv.ts +28 -0
  876. package/src/terminal/i18n/mk.ts +29 -0
  877. package/src/terminal/i18n/mn.ts +30 -0
  878. package/src/terminal/i18n/ms.ts +28 -0
  879. package/src/terminal/i18n/my.ts +29 -0
  880. package/src/terminal/i18n/ne.ts +28 -0
  881. package/src/terminal/i18n/nl.ts +28 -0
  882. package/src/terminal/i18n/no.ts +28 -0
  883. package/src/terminal/i18n/pa.ts +28 -0
  884. package/src/terminal/i18n/pl.ts +28 -0
  885. package/src/terminal/i18n/ro.ts +28 -0
  886. package/src/terminal/i18n/ru.ts +28 -0
  887. package/src/terminal/i18n/si.ts +28 -0
  888. package/src/terminal/i18n/sk.ts +28 -0
  889. package/src/terminal/i18n/sl.ts +28 -0
  890. package/src/terminal/i18n/sq.ts +29 -0
  891. package/src/terminal/i18n/sr.ts +28 -0
  892. package/src/terminal/i18n/sv.ts +28 -0
  893. package/src/terminal/i18n/tg.ts +29 -0
  894. package/src/terminal/i18n/th.ts +28 -0
  895. package/src/terminal/i18n/tk.ts +29 -0
  896. package/src/terminal/i18n/tr.ts +29 -0
  897. package/src/terminal/i18n/uk.ts +28 -0
  898. package/src/terminal/i18n/ur.ts +28 -0
  899. package/src/terminal/i18n/uz.ts +29 -0
  900. package/src/terminal/i18n/vi.ts +28 -0
  901. package/src/terminal/i18n/zh.ts +28 -0
  902. package/src/terminal/i18n/zht.ts +28 -0
  903. package/src/terminal/index.ts +74 -0
  904. package/src/terminal/inline-rename.ts +93 -0
  905. package/src/terminal/label.tsx +71 -0
  906. package/src/terminal/machine.ts +767 -0
  907. package/src/terminal/model.ts +661 -0
  908. package/src/terminal/pane-machine.ts +260 -0
  909. package/src/terminal/panel.tsx +280 -0
  910. package/src/terminal/props.ts +16 -0
  911. package/src/terminal/quote-machine.ts +381 -0
  912. package/src/terminal/quote.css +7 -0
  913. package/src/terminal/quote.tsx +218 -0
  914. package/src/terminal/rename-machine.ts +98 -0
  915. package/src/terminal/renderer.tsx +298 -0
  916. package/src/terminal/runtime-adapters.ts +34 -0
  917. package/src/terminal/surface-machine.ts +186 -0
  918. package/src/terminal/tab.tsx +112 -0
  919. package/src/terminal/terminal-key-event.ts +58 -0
  920. package/src/terminal/terminal.fixture.tsx +71 -0
  921. package/src/terminal/terminal.tsx +652 -0
  922. package/src/terminal/title.ts +41 -0
  923. package/src/terminal/writer.ts +87 -0
  924. package/src/updater/action.ts +37 -0
  925. package/src/updater/actions.tsx +110 -0
  926. package/src/updater/i18n/am.ts +40 -0
  927. package/src/updater/i18n/ar.ts +40 -0
  928. package/src/updater/i18n/az.ts +41 -0
  929. package/src/updater/i18n/bg.ts +40 -0
  930. package/src/updater/i18n/bn.ts +41 -0
  931. package/src/updater/i18n/br.ts +40 -0
  932. package/src/updater/i18n/bs.ts +41 -0
  933. package/src/updater/i18n/ca.ts +41 -0
  934. package/src/updater/i18n/cs.ts +41 -0
  935. package/src/updater/i18n/da.ts +40 -0
  936. package/src/updater/i18n/de.ts +41 -0
  937. package/src/updater/i18n/dv.ts +41 -0
  938. package/src/updater/i18n/dz.ts +42 -0
  939. package/src/updater/i18n/el.ts +42 -0
  940. package/src/updater/i18n/en.ts +42 -0
  941. package/src/updater/i18n/es.ts +40 -0
  942. package/src/updater/i18n/et.ts +40 -0
  943. package/src/updater/i18n/fa.ts +40 -0
  944. package/src/updater/i18n/fi.ts +41 -0
  945. package/src/updater/i18n/fo.ts +40 -0
  946. package/src/updater/i18n/fr.ts +41 -0
  947. package/src/updater/i18n/he.ts +40 -0
  948. package/src/updater/i18n/hi.ts +40 -0
  949. package/src/updater/i18n/hr.ts +41 -0
  950. package/src/updater/i18n/hu.ts +40 -0
  951. package/src/updater/i18n/hy.ts +41 -0
  952. package/src/updater/i18n/id.ts +41 -0
  953. package/src/updater/i18n/is.ts +40 -0
  954. package/src/updater/i18n/it.ts +40 -0
  955. package/src/updater/i18n/ja.ts +41 -0
  956. package/src/updater/i18n/ka.ts +40 -0
  957. package/src/updater/i18n/km.ts +40 -0
  958. package/src/updater/i18n/ko.ts +40 -0
  959. package/src/updater/i18n/lo.ts +40 -0
  960. package/src/updater/i18n/lt.ts +41 -0
  961. package/src/updater/i18n/lv.ts +40 -0
  962. package/src/updater/i18n/mk.ts +41 -0
  963. package/src/updater/i18n/mn.ts +40 -0
  964. package/src/updater/i18n/ms.ts +41 -0
  965. package/src/updater/i18n/my.ts +40 -0
  966. package/src/updater/i18n/ne.ts +40 -0
  967. package/src/updater/i18n/nl.ts +41 -0
  968. package/src/updater/i18n/no.ts +40 -0
  969. package/src/updater/i18n/pa.ts +40 -0
  970. package/src/updater/i18n/pl.ts +41 -0
  971. package/src/updater/i18n/ro.ts +41 -0
  972. package/src/updater/i18n/ru.ts +40 -0
  973. package/src/updater/i18n/si.ts +40 -0
  974. package/src/updater/i18n/sk.ts +41 -0
  975. package/src/updater/i18n/sl.ts +40 -0
  976. package/src/updater/i18n/sq.ts +40 -0
  977. package/src/updater/i18n/sr.ts +41 -0
  978. package/src/updater/i18n/sv.ts +40 -0
  979. package/src/updater/i18n/tg.ts +41 -0
  980. package/src/updater/i18n/th.ts +40 -0
  981. package/src/updater/i18n/tk.ts +40 -0
  982. package/src/updater/i18n/tr.ts +40 -0
  983. package/src/updater/i18n/uk.ts +40 -0
  984. package/src/updater/i18n/ur.ts +40 -0
  985. package/src/updater/i18n/uz.ts +41 -0
  986. package/src/updater/i18n/vi.ts +41 -0
  987. package/src/updater/i18n/zh.ts +40 -0
  988. package/src/updater/i18n/zht.ts +40 -0
  989. package/src/updater/index.ts +94 -0
  990. package/src/updater/log.ts +41 -0
  991. package/src/updater/machine.ts +919 -0
  992. package/src/updater/main.ts +138 -0
  993. package/src/updater/platform.ts +160 -0
  994. package/src/updater/renderer.tsx +203 -0
  995. package/src/updater/section.tsx +65 -0
  996. package/src/updater/web-driver.ts +200 -0
  997. package/src/updater/web-machine.ts +222 -0
  998. package/src/updater/web.tsx +103 -0
  999. package/src/updater/whats-new-machine.ts +97 -0
  1000. package/src/updater/whats-new.stories.tsx +38 -0
  1001. package/src/updater/whats-new.tsx +304 -0
  1002. package/src/updater/window-machine.ts +73 -0
  1003. package/src/wsl/add-machine.ts +56 -0
  1004. package/src/wsl/contract.ts +104 -0
  1005. package/src/wsl/dialog-machine.ts +322 -0
  1006. package/src/wsl/dialog.css +372 -0
  1007. package/src/wsl/dialog.tsx +492 -0
  1008. package/src/wsl/i18n/am.ts +53 -0
  1009. package/src/wsl/i18n/ar.ts +55 -0
  1010. package/src/wsl/i18n/az.ts +57 -0
  1011. package/src/wsl/i18n/bg.ts +58 -0
  1012. package/src/wsl/i18n/bn.ts +56 -0
  1013. package/src/wsl/i18n/br.ts +58 -0
  1014. package/src/wsl/i18n/bs.ts +58 -0
  1015. package/src/wsl/i18n/ca.ts +58 -0
  1016. package/src/wsl/i18n/cs.ts +57 -0
  1017. package/src/wsl/i18n/da.ts +57 -0
  1018. package/src/wsl/i18n/de.ts +59 -0
  1019. package/src/wsl/i18n/dv.ts +58 -0
  1020. package/src/wsl/i18n/dz.ts +59 -0
  1021. package/src/wsl/i18n/el.ts +57 -0
  1022. package/src/wsl/i18n/en.ts +55 -0
  1023. package/src/wsl/i18n/es.ts +58 -0
  1024. package/src/wsl/i18n/et.ts +55 -0
  1025. package/src/wsl/i18n/fa.ts +56 -0
  1026. package/src/wsl/i18n/fi.ts +57 -0
  1027. package/src/wsl/i18n/fo.ts +56 -0
  1028. package/src/wsl/i18n/fr.ts +57 -0
  1029. package/src/wsl/i18n/he.ts +54 -0
  1030. package/src/wsl/i18n/hi.ts +57 -0
  1031. package/src/wsl/i18n/hr.ts +58 -0
  1032. package/src/wsl/i18n/hu.ts +58 -0
  1033. package/src/wsl/i18n/hy.ts +57 -0
  1034. package/src/wsl/i18n/id.ts +56 -0
  1035. package/src/wsl/i18n/is.ts +55 -0
  1036. package/src/wsl/i18n/it.ts +57 -0
  1037. package/src/wsl/i18n/ja.ts +57 -0
  1038. package/src/wsl/i18n/ka.ts +56 -0
  1039. package/src/wsl/i18n/km.ts +57 -0
  1040. package/src/wsl/i18n/ko.ts +56 -0
  1041. package/src/wsl/i18n/lo.ts +54 -0
  1042. package/src/wsl/i18n/lt.ts +57 -0
  1043. package/src/wsl/i18n/lv.ts +57 -0
  1044. package/src/wsl/i18n/mk.ts +57 -0
  1045. package/src/wsl/i18n/mn.ts +58 -0
  1046. package/src/wsl/i18n/ms.ts +57 -0
  1047. package/src/wsl/i18n/my.ts +57 -0
  1048. package/src/wsl/i18n/ne.ts +57 -0
  1049. package/src/wsl/i18n/nl.ts +57 -0
  1050. package/src/wsl/i18n/no.ts +57 -0
  1051. package/src/wsl/i18n/pa.ts +57 -0
  1052. package/src/wsl/i18n/pl.ts +58 -0
  1053. package/src/wsl/i18n/ro.ts +56 -0
  1054. package/src/wsl/i18n/ru.ts +57 -0
  1055. package/src/wsl/i18n/si.ts +56 -0
  1056. package/src/wsl/i18n/sk.ts +57 -0
  1057. package/src/wsl/i18n/sl.ts +57 -0
  1058. package/src/wsl/i18n/sq.ts +56 -0
  1059. package/src/wsl/i18n/sr.ts +57 -0
  1060. package/src/wsl/i18n/sv.ts +58 -0
  1061. package/src/wsl/i18n/tg.ts +57 -0
  1062. package/src/wsl/i18n/th.ts +57 -0
  1063. package/src/wsl/i18n/tk.ts +56 -0
  1064. package/src/wsl/i18n/tr.ts +57 -0
  1065. package/src/wsl/i18n/uk.ts +57 -0
  1066. package/src/wsl/i18n/ur.ts +57 -0
  1067. package/src/wsl/i18n/uz.ts +57 -0
  1068. package/src/wsl/i18n/vi.ts +56 -0
  1069. package/src/wsl/i18n/zh.ts +53 -0
  1070. package/src/wsl/i18n/zht.ts +53 -0
  1071. package/src/wsl/index.ts +72 -0
  1072. package/src/wsl/local.ts +41 -0
  1073. package/src/wsl/machine.ts +652 -0
  1074. package/src/wsl/main.ts +95 -0
  1075. package/src/wsl/model.ts +369 -0
  1076. package/src/wsl/probe-machine.ts +143 -0
  1077. package/src/wsl/probes.ts +107 -0
  1078. package/src/wsl/remote-cli.ts +49 -0
  1079. package/src/wsl/renderer.tsx +164 -0
  1080. package/src/wsl/row-view.ts +25 -0
  1081. package/src/wsl/row.tsx +76 -0
  1082. package/src/wsl/runtime.ts +441 -0
  1083. package/src/wsl/servers.ts +330 -0
  1084. package/src/wsl/sidecar.ts +186 -0
  1085. package/tsconfig.json +21 -0
@@ -0,0 +1,2046 @@
1
+ import { Browser } from "@zyro-sec/plugin-browser/rpc"
2
+ import { uuid } from "@zyro-sec/util/uuid"
3
+ import { Schema } from "effect"
4
+ import { DialogProvider } from "@zyro-sec/ui/context/dialog"
5
+ import { ResizeHandle } from "@zyro-sec/ui/resize-handle"
6
+ import {
7
+ batch,
8
+ createSignal,
9
+ For,
10
+ Show,
11
+ type Accessor,
12
+ type Component,
13
+ type JSX,
14
+ type ParentComponent,
15
+ type ParentProps,
16
+ } from "solid-js"
17
+ import { createStore, produce, reconcile } from "solid-js/store"
18
+ import { Portal, render } from "solid-js/web"
19
+ import {
20
+ liveAccessor,
21
+ PanelContext,
22
+ PluginContext,
23
+ type Bridge,
24
+ type BridgeLayout,
25
+ type Entry,
26
+ } from "@zyro-sec/plugin/gui/host"
27
+ import {
28
+ type Appearance,
29
+ type App,
30
+ type ComposerDelivery,
31
+ type ComposerNote,
32
+ type Context,
33
+ type Embeds,
34
+ type Ipc,
35
+ type IpcClient,
36
+ type Keybinds,
37
+ type Locale,
38
+ type MountedSession,
39
+ type Mutable,
40
+ type PanelFrame,
41
+ type Panel,
42
+ type PanelTab,
43
+ type Router,
44
+ type Servers,
45
+ type SessionRef,
46
+ type SessionScreen,
47
+ type SetupContext,
48
+ type Storage,
49
+ type Workspaces,
50
+ } from "@zyro-sec/plugin/gui"
51
+ import barStyles from "./bar.css?inline"
52
+ import { BrowserHistory } from "./history/ipc"
53
+ import { pageKey, type PageVisit } from "./history/page"
54
+ import { createPageIndex, findPages } from "./history/search"
55
+ import type { History } from "./history/visits"
56
+ import browserEn from "./i18n/en"
57
+ import type definition from "./index"
58
+ import { createModel } from "./model"
59
+ import SessionBrowserPane from "./panel"
60
+ import { BrowserPane, PluginTabHandle, type PaneEvent, type PromptAnswer, type PromptView } from "./ipc"
61
+ import { pageShortcut } from "./keys"
62
+ import { normalizeURL, refusal } from "./policy"
63
+ import { navigationNotice } from "./refusal-notice"
64
+ import { type BuiltinLayout } from "@zyro-sec/plugin/gui/builtin"
65
+
66
+ /** The renderer host pieces the pane runs on, passed in by `packages/app/component-tests/browser-pane.spec.ts`. */
67
+ type PaneHost = {
68
+ createAppLinks(review: (href: string) => void): void
69
+ /** The host's routing of another app's address: the system mail app, the review, or a copy. */
70
+ appLinkRoute(href: string, reviewer: boolean): "mail" | "review" | "copy"
71
+ createEmbeds(input: {
72
+ bridge: Bridge | undefined
73
+ zoom: () => number
74
+ dialog: () => boolean
75
+ moving: () => boolean
76
+ }): Embeds
77
+ /** The host's panel motion, whose resize drags hide native views like flights do. */
78
+ panelMotion: { panelsMoving(): boolean; setPanelResizing(dragging: boolean): void }
79
+ LanguageProvider: Component<{ locale: string; children: JSX.Element }>
80
+ UiI18nBridge: ParentComponent
81
+ useLanguage(): { t(key: string): string }
82
+ }
83
+
84
+ type PaneFixtureState = {
85
+ session: string
86
+ /** The user's answers to the tab's prompts, as main receives them. */
87
+ answers: PromptAnswer[]
88
+ /** The tab each answer went to, by title. */
89
+ answeredTabs: string[]
90
+ secondTab: boolean
91
+ mounted: boolean
92
+ visible: boolean
93
+ url: string | undefined
94
+ loading: boolean
95
+ generation: number
96
+ delayNavigation: boolean
97
+ pendingURL: string | undefined
98
+ loadErrors: Record<string, string | undefined>
99
+ error: string | undefined
100
+ layouts: Record<string, BridgeLayout | undefined>
101
+ layoutCalls: number
102
+ covered: boolean
103
+ /** A panel is in flight, as the host's panel motion reports it. */
104
+ moving: boolean
105
+ /** The pane box's width, which its resize handle drags. */
106
+ width: number
107
+ /** Whether a host dialog is open over the app. */
108
+ dialog: boolean
109
+ captures: number
110
+ holdCapture: boolean
111
+ /** Main returns no still, as when the view cannot be captured. */
112
+ failCapture: boolean
113
+ picker: Record<string, boolean | undefined>
114
+ /** Main drops picker requests unanswered, as when the tab has no page or no registration yet. */
115
+ dropInspect: boolean
116
+ highlights: { sessionKey: string; ref?: Browser.Ref }[]
117
+ comments: ComposerNote[]
118
+ /** The comment IDs a comment editor's Mod+Enter sent. */
119
+ sent: string[]
120
+ /** Presentation details last reported by each native tab. */
121
+ pages: Record<string, PageDetails | undefined>
122
+ /** The browser history store. */
123
+ history: History
124
+ /** How many pages main's history holds. */
125
+ historyPages: number
126
+ /** Main's history store cannot open: every call to it rejects, as with a damaged file. */
127
+ historyAway: boolean
128
+ /** What the pane last said in a toast. */
129
+ toast: string
130
+ /** URLs the pane opened in the system browser. */
131
+ external: string[]
132
+ /** Cookies the page's address can read. */
133
+ cookies: number
134
+ /** Main fails the next cookie read, as when the pane is suspended. */
135
+ failSite: boolean
136
+ /** Main rejects the next command for a reason of its own, with a message the window has no sentence for. */
137
+ failCommand: boolean
138
+ selection: string
139
+ }
140
+
141
+ export type BrowserScenario = "Page" | "Empty" | "Recent" | "History" | "Loading" | "Failed" | "Suspended"
142
+
143
+ type ElementRect = Pick<DOMRect, "x" | "y" | "width" | "height">
144
+
145
+ type StoryHost = Pick<PaneHost, "useLanguage"> & {
146
+ scenario: BrowserScenario
147
+ /** How the composer would send a comment now; undefined while nothing can be sent. */
148
+ delivery?: ComposerDelivery
149
+ Page: Component<{ url: string; zoom: number; picking: boolean; pick: (rect: ElementRect) => void }>
150
+ Frame: ParentComponent<{
151
+ loading: boolean
152
+ finish: () => void
153
+ suspended: boolean
154
+ reconnect: () => void
155
+ external: string | undefined
156
+ comments: readonly ComposerNote[]
157
+ sent: readonly string[]
158
+ }>
159
+ }
160
+
161
+ type PageDetails = Pick<Extract<PaneEvent, { type: "page" }>, "zoom" | "viewport" | "icon">
162
+
163
+ // A 16px blue square, as main reports a page icon.
164
+ const icon =
165
+ "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiByeD0iMyIgZmlsbD0iIzNiODJmNiIvPjwvc3ZnPg=="
166
+
167
+ const visits: History["visits"] = [
168
+ {
169
+ url: "https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements",
170
+ title: "HTML elements reference - HTML | MDN",
171
+ icon,
172
+ },
173
+ {
174
+ url: "https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Colors/Color_format_converter",
175
+ title: "Color format converter - CSS | MDN",
176
+ icon,
177
+ },
178
+ { url: "http://localhost:5173/settings", title: "Settings - Preview" },
179
+ { url: "https://alpha.example/", title: "Alpha" },
180
+ ]
181
+
182
+ const DAY = 86_400_000
183
+
184
+ // A made-up history as an import from another browser leaves it in main: many GitHub repositories, of which a few
185
+ // have "rune" in their name or title, and other sites. No page has an icon, as imported pages have none.
186
+ const repositories = [
187
+ "anomalyco/opencode",
188
+ "anomalyco/opentui",
189
+ "anomalyco/models.dev",
190
+ "sst/sst",
191
+ "solidjs/solid",
192
+ "oven-sh/bun",
193
+ "effect-ts/effect",
194
+ "microsoft/typescript",
195
+ "vitejs/vite",
196
+ "electron/electron",
197
+ "nodejs/node",
198
+ "denoland/deno",
199
+ "rust-lang/rust",
200
+ "ziglang/zig",
201
+ "neovim/neovim",
202
+ "zed-industries/zed",
203
+ "withastro/astro",
204
+ "sveltejs/svelte",
205
+ "tailwindlabs/tailwindcss",
206
+ "oxc-project/oxc",
207
+ "biomejs/biome",
208
+ "microsoft/playwright",
209
+ "tanstack/query",
210
+ "drizzle-team/drizzle-orm",
211
+ "example-org/prune-cli",
212
+ ]
213
+
214
+ function importedPages(now: number): PageVisit[] {
215
+ const page = (url: string, title: string, visits: number, days: number, typed = 0): PageVisit => ({ url, title, visits, typed, visited: now - days * DAY })
216
+
217
+ return [
218
+ page("https://github.com/anomalyco/rune-desktop", "anomalyco/rune-desktop: Rune for the desktop", 46, 1, 3),
219
+ page("https://github.com/anomalyco/rune-desktop/pulls", "Pull requests · anomalyco/rune-desktop", 18, 2),
220
+ page("https://github.com/anomalyco/rune-desktop/issues/128", "Rune panel flickers on resize · Issue #128 · anomalyco/rune-desktop", 5, 6),
221
+ page("https://github.com/runelabs/rune-lang", "runelabs/rune-lang: A small language for layouts", 7, 40),
222
+ page("https://docs.rune.example/guide/getting-started", "Getting started - Rune guide", 9, 12),
223
+ page("https://github.com/", "GitHub", 22, 0, 12),
224
+ page("https://news.ycombinator.com/", "Hacker News", 140, 0, 30),
225
+ page("https://developer.mozilla.org/en-US/docs/Web/API/Popover_API", "Popover API - Web APIs | MDN", 12, 3),
226
+ page("http://localhost:5173/", "OpenCode dev", 80, 0, 8),
227
+ ...repositories.map((name, position) => page(`https://github.com/${name}`, `${name}: ${name.split("/")[1]} on GitHub`, 3 + ((position * 7) % 40), position % 30)),
228
+ ...repositories.map((name, position) => page(`https://github.com/${name}/issues`, `Issues · ${name}`, 1 + (position % 6), 5 + position)),
229
+ ]
230
+ }
231
+
232
+ // Component-test fixture: the real pane on the real host embeds, with the desktop faked at its two
233
+ // boundaries: the model's main-process pane (tab state, picker events) and the host bridge that shows native views.
234
+ export function mountBrowserPane(input: PaneHost) {
235
+ const host = document.createElement("main")
236
+ host.dataset.testid = "browser-pane-fixture"
237
+ host.style.cssText = "position:fixed;inset:0;z-index:1000;background:#181818;color:#eee;padding:24px"
238
+ document.body.appendChild(host)
239
+
240
+ const Fixture = browserPaneFixture(input)
241
+
242
+ return render(
243
+ () => (
244
+ <input.LanguageProvider locale="en">
245
+ <input.UiI18nBridge>
246
+ <Fixture />
247
+ </input.UiI18nBridge>
248
+ </input.LanguageProvider>
249
+ ),
250
+ host,
251
+ )
252
+ }
253
+
254
+ // Both hosts exercise the real model and pane. The lab draws an in-memory document where the component tests
255
+ // measure native embed layouts and captures.
256
+ export function browserPaneFixture(input: PaneHost | StoryHost) {
257
+ return function Fixture() {
258
+ const language = input.useLanguage()
259
+ const messages = new Map(Object.entries(browserEn))
260
+
261
+ const scenario = "scenario" in input ? input.scenario : undefined
262
+
263
+ const [store, setStore] = createStore<PaneFixtureState>({
264
+ session: "Alpha",
265
+ answers: [],
266
+ answeredTabs: [],
267
+ secondTab: false,
268
+ mounted: true,
269
+ visible: true,
270
+ url: scenario === "Empty" || scenario === "Recent" ? "about:blank" : undefined,
271
+ loading: scenario === "Loading",
272
+ generation: 0,
273
+ delayNavigation: false,
274
+ pendingURL: undefined,
275
+ loadErrors: scenario === "Failed" ? { Alpha: "ERR_CONNECTION_REFUSED" } : {},
276
+ error: scenario === "Suspended" ? "browser.pane.suspended" : undefined,
277
+ layouts: {},
278
+ layoutCalls: 0,
279
+ covered: false,
280
+ moving: false,
281
+ width: 640,
282
+ dialog: false,
283
+ captures: 0,
284
+ holdCapture: false,
285
+ failCapture: false,
286
+ picker: {},
287
+ dropInspect: false,
288
+ highlights: [],
289
+ comments: [],
290
+ sent: [],
291
+ pages: {},
292
+ history: { visits: scenario === "Recent" ? structuredClone(visits) : [] },
293
+ historyPages: 0,
294
+ historyAway: false,
295
+ toast: "",
296
+ external: [],
297
+ cookies: 3,
298
+ failSite: false,
299
+ failCommand: false,
300
+ selection: "default",
301
+ })
302
+
303
+ // Each capture waits until the fixture releases it, so a spec can observe the pending state.
304
+ const held: (() => void)[] = []
305
+ const bindings = new Map<string, string>()
306
+ const listeners = new Set<(value: { binding: string; event: PaneEvent }) => void>()
307
+
308
+ const emit = (key: string, event: PaneEvent) => {
309
+ const binding = bindings.get(key)
310
+
311
+ if (binding) listeners.forEach((listener) => listener({ binding, event }))
312
+ }
313
+
314
+ const tabs = ["Alpha", "Beta", "Second"].map((name, index) => ({
315
+ id: Browser.TabID.make(`tab_${String(index + 1).repeat(8)}-1111-1111-1111-111111111111`),
316
+ owner: name === "Second" ? "Alpha" : name,
317
+ title: name,
318
+ url: `https://${name.toLowerCase()}.example/`,
319
+ loading: false,
320
+ canGoBack: false,
321
+ canGoForward: false,
322
+ generation: 0,
323
+ }))
324
+
325
+ const current = (key = store.session) =>
326
+ tabs.find((tab) => tab.title === (key === "Alpha" && store.secondTab ? "Second" : key)) ?? tabs[0]
327
+
328
+ const target = (value: { binding: string; tabID: Browser.TabID }) => {
329
+ const tab = tabs.find((item) => item.id === value.tabID && bindings.get(item.owner) === value.binding)
330
+
331
+ if (!tab) throw new Error("Unknown browser tab")
332
+
333
+ return tab
334
+ }
335
+
336
+ const details = (tabID: Browser.TabID): PageDetails => store.pages[tabID] ?? { zoom: 1, viewport: { mode: "auto" } }
337
+
338
+ const page = (tab: (typeof tabs)[number], update: Partial<PageDetails> = {}, notice?: "zoom") => {
339
+ const next = { ...details(tab.id), ...update }
340
+ setStore("pages", (pages) => ({ ...pages, [tab.id]: next }))
341
+ emit(tab.owner, { type: "page", tabID: tab.id, ...next, ...(notice && { viewportNotice: notice }) })
342
+ }
343
+
344
+ // Main's window focus reports, which focus moving into an embed does not end.
345
+ const windowFocus = new Set<Parameters<Bridge["on"]>[0]>()
346
+
347
+ const bridge: Pick<Bridge, "embed" | "capture" | "on"> = {
348
+ on: (listener) => {
349
+ windowFocus.add(listener)
350
+
351
+ return () => windowFocus.delete(listener)
352
+ },
353
+ embed: (id, layout) => batch(() => {
354
+ setStore("layoutCalls", count => count + 1)
355
+ setStore("layouts", id, layout)
356
+ }),
357
+ capture: async () => {
358
+ const count = store.captures + 1
359
+ setStore("captures", count)
360
+
361
+ if (store.holdCapture) await new Promise<void>((resolve) => held.push(resolve))
362
+
363
+ if (store.failCapture) return undefined
364
+ // Each capture is a pixel wider than the last, so a spec can tell which one a still shows.
365
+ const canvas = new OffscreenCanvas(3 + count, 4)
366
+ const paint = canvas.getContext("2d")
367
+
368
+ if (paint) {
369
+ paint.fillStyle = "#3b82f6"
370
+ paint.fillRect(0, 0, 4, 4)
371
+ }
372
+
373
+ return new Uint8Array(await (await canvas.convertToBlob({ type: "image/jpeg" })).arrayBuffer())
374
+ },
375
+ }
376
+
377
+ // SAFETY: the host embeds call only `embed`, `capture` and `on` on their bridge (`runtime/plugin/embeds.tsx`).
378
+ const embeds: Embeds =
379
+ "createEmbeds" in input
380
+ ? input.createEmbeds({
381
+ bridge: bridge as Bridge,
382
+ zoom: () => (store.selection === "zoomed" ? 1.25 : 1),
383
+ dialog: () => store.dialog,
384
+ moving: () => store.moving || input.panelMotion.panelsMoving(),
385
+ })
386
+ : {
387
+ capture: async () => undefined,
388
+ View: (props) => (
389
+ <div class={props.class}>
390
+ <Show when={props.id && props.visible && !store.loading && !model.suspended({ key: store.session })}>
391
+ <input.Page
392
+ url={store.url ?? current().url}
393
+ zoom={details(current().id).zoom}
394
+ picking={!!store.picker[store.session]}
395
+ pick={pick}
396
+ />
397
+ </Show>
398
+ {props.children}
399
+ </div>
400
+ ),
401
+ }
402
+
403
+ const t = (key: string, params?: Readonly<Partial<Record<string, string | number>>>) =>
404
+ (messages.get(key) ?? language.t(key)).replace(/\{\{(\w+)\}\}/g, (_, name: string) =>
405
+ String(params?.[name] ?? ""),
406
+ )
407
+
408
+ const base = {
409
+ id: "browser",
410
+ keybinds: { keybind: () => [], keys: (bind: string) => bind.split("+") },
411
+ desktop: { zoom: () => (store.selection === "zoomed" ? 1.25 : 1) },
412
+ embeds,
413
+ t,
414
+ // English plural forms, as the host picks them.
415
+ plural: (key: string, count: number, params?: Parameters<typeof t>[1]) => t(`${key}.${count === 1 ? "one" : "other"}`, { ...params, count }),
416
+ }
417
+
418
+ const panel: PanelFrame = {
419
+ visible: () => store.visible,
420
+ present: () => store.visible,
421
+ placement: () => "side",
422
+ reserve: () => false,
423
+ animate: () => false,
424
+ sidebar: {
425
+ opened: () => false,
426
+ width: () => 0,
427
+ transition: () => false,
428
+ resize() {},
429
+ toggle() {},
430
+ side: () => "start",
431
+ move() {},
432
+ },
433
+ open: () => [],
434
+ }
435
+
436
+ const server = {
437
+ id: "browser-test",
438
+ name: "Local",
439
+ local: true,
440
+ compatible: true,
441
+ data: { on: () => () => undefined, session: { status: () => "idle" } },
442
+ }
443
+
444
+ const [reads, setReads] = createStore({ directory: 0 })
445
+
446
+ // Frozen session refs, as the real host supplies. Only the key belongs in the pane's transient state.
447
+ const views = new Map(
448
+ ["Alpha", "Beta", "Empty"].map((key) => {
449
+ const value = Object.freeze({
450
+ key,
451
+ id: key,
452
+ server,
453
+ pending: false,
454
+ location: { directory: "/repo" },
455
+ get directory() {
456
+ setReads("directory", (count) => count + 1)
457
+
458
+ return "/repo"
459
+ },
460
+ })
461
+
462
+ // SAFETY: the pane reads only `key`; the real model reads these listed fields and `server.data.on`.
463
+ // oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above
464
+ return [key, value as unknown as MountedSession] as const
465
+ }),
466
+ )
467
+
468
+ const session = () => {
469
+ const view = views.get(store.session)
470
+
471
+ if (!view) throw new Error("Unknown fixture session")
472
+
473
+ return view
474
+ }
475
+
476
+ // The session screen: one object that follows the route, with the composer the pane attaches comments to.
477
+ // SAFETY: the pane reads only file.search and composer.attach, delivery and send; the model's workspace-link paths
478
+ // are not invoked.
479
+ // oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above
480
+ const screen = {
481
+ file: { search: async () => [] },
482
+ composer: {
483
+ attach: (note: ComposerNote) => setStore("comments", (items) => [...items, note]),
484
+ delivery: () => ("delivery" in input ? input.delivery : undefined),
485
+ send: (commentID: string) => setStore("sent", (items) => [...items, commentID]),
486
+ },
487
+ } as unknown as SessionScreen
488
+
489
+ const back: string[] = []
490
+ const forward: string[] = []
491
+
492
+ const report = (key = store.session) => {
493
+ const inventory = tabs.filter((item) => item.owner === key)
494
+
495
+ if (!inventory.length) return
496
+
497
+ const tab = current(key)
498
+ emit(key, {
499
+ type: "state",
500
+ state: {
501
+ tabs: inventory.map((item) =>
502
+ item === tab
503
+ ? {
504
+ ...item,
505
+ url: store.url ?? item.url,
506
+ canGoBack: back.length > 0,
507
+ canGoForward: forward.length > 0,
508
+ loading: store.loading,
509
+ generation: store.generation,
510
+ loadError: store.loadErrors[key],
511
+ }
512
+ : item,
513
+ ),
514
+ focusedTabID: tab.id,
515
+ },
516
+ error: store.error,
517
+ })
518
+
519
+ return tab
520
+ }
521
+
522
+ const embed = (tab: (typeof tabs)[number]) =>
523
+ emit(tab.owner, { type: "embed", tabID: tab.id, embed: `embed-${tab.title}` })
524
+
525
+ // Address rejection counters and cleanup run through the real model over this main-process Ipc boundary.
526
+ const pane: PaneClient = {
527
+ register: async (value) => {
528
+ bindings.set(value.session, value.binding)
529
+ queueMicrotask(() => {
530
+ const tab = report(value.session)
531
+
532
+ // A suspended attachment reports its retained inventory once. The next interaction can reconnect it.
533
+ if (store.error === "browser.pane.suspended") return setStore("error", undefined)
534
+
535
+ if (tab) {
536
+ embed(tab)
537
+ page(tab)
538
+ }
539
+ })
540
+ },
541
+ load: async () => undefined,
542
+ command: async (value) => {
543
+ const command = value.command
544
+ // Main refuses what it does not open before anything happens, naming why.
545
+ const reason = command.type === "navigate" ? refusal(command.url) : undefined
546
+
547
+ if (reason) throw new Error(reason)
548
+
549
+ if (store.failCommand) {
550
+ setStore("failCommand", false)
551
+ throw new Error("The browser page did not finish starting.")
552
+ }
553
+
554
+ setStore("error", undefined)
555
+
556
+ if (command.type === "navigate" || command.type === "reload") setStore("loadErrors", store.session, undefined)
557
+
558
+ if (command.type === "navigate") {
559
+ const url = normalizeURL(command.url)
560
+
561
+ if (store.delayNavigation) {
562
+ setStore("pendingURL", url)
563
+
564
+ return
565
+ }
566
+
567
+ back.push(store.url ?? current().url)
568
+ forward.length = 0
569
+ setStore({ url, loading: false, generation: store.generation + 1 })
570
+ }
571
+
572
+ if (command.type === "back" || command.type === "forward") {
573
+ const stack = command.type === "back" ? back : forward
574
+ const url = stack.pop()
575
+
576
+ if (url) {
577
+ const other = command.type === "back" ? forward : back
578
+ other.push(store.url ?? current().url)
579
+ setStore({ url, loading: false, generation: store.generation + 1 })
580
+ }
581
+ }
582
+
583
+ if (command.type === "reload") setStore({ loading: false, generation: store.generation + 1 })
584
+
585
+ if (command.type === "stop") setStore("loading", false)
586
+ report()
587
+ },
588
+ // The desktop confirms each picker change, as the page does once inspect mode is armed.
589
+ inspect: async (value) => {
590
+ const key = Array.from(bindings).find((item) => item[1] === value.binding)?.[0]
591
+
592
+ if (!key) throw new Error("Unknown picker binding")
593
+
594
+ if (store.dropInspect) return
595
+ setStore("picker", key, value.enabled)
596
+ emit(key, { type: "inspect", tabID: value.tabID, active: value.enabled })
597
+ },
598
+ highlight: async (value) => {
599
+ const key = Array.from(bindings).find((item) => item[1] === value.binding)?.[0]
600
+
601
+ if (!key) throw new Error("Unknown highlight binding")
602
+ setStore("highlights", (items) => [...items, { sessionKey: key, ref: value.ref }])
603
+ },
604
+ // Main steps through Chromium's presets and reports the page's new zoom.
605
+ zoom: async (value) => {
606
+ const tab = target(value)
607
+
608
+ const previous = details(tab.id)
609
+
610
+ const steps = [0.9, 1, 1.1, 1.25]
611
+
612
+ const index = steps.indexOf(previous.zoom)
613
+
614
+ const zoom = value.zoom === "reset" ? 1 : (steps[index + (value.zoom === "in" ? 1 : -1)] ?? previous.zoom)
615
+
616
+ if (zoom === previous.zoom) return
617
+ page(tab, { zoom, viewport: { mode: "auto" } }, previous.viewport.mode === "fixed" ? "zoom" : undefined)
618
+ },
619
+ setViewport: async (value) => page(target(value), { viewport: value.viewport }),
620
+ site: async () => {
621
+ if (store.failSite) {
622
+ setStore("failSite", false)
623
+ throw new Error("browser.pane.unavailable")
624
+ }
625
+
626
+ return { cookies: store.cookies }
627
+ },
628
+ find: async (value) => {
629
+ const action = value.action
630
+ const query = action.type === "query" ? action.query : model.search({ key: store.session }, value.tabID)?.query ?? ""
631
+ emit(store.session, { type: "find", tabID: value.tabID, view: action.type === "close" ? null : {
632
+ query, result: query ? { active: action.type === "next" ? 2 : 1, total: 3 } : null,
633
+ } })
634
+ },
635
+ notice: async () => undefined,
636
+ reviewLink: async ({ url }) => {
637
+ const tabID = tabs[0].id
638
+ emit(store.session, { type: "refusal", tabID, token: uuid(), notice: navigationNotice(url, {}, "conversation") })
639
+
640
+ return tabID
641
+ },
642
+ // Main answers the page, which then waits on nothing.
643
+ answer: async (value) => {
644
+ setStore("answers", (answers) => [...answers, value.answer])
645
+ setStore("answeredTabs", (titles) => [...titles, target(value).title])
646
+ emit(store.session, { type: "prompt", tabID: value.tabID, prompt: null })
647
+ },
648
+ reveal: async () => undefined,
649
+ openPage: async ({ expected }) => { setStore("external", (items) => [...items, expected]) },
650
+ createTab: async () => PluginTabHandle.make("handle"),
651
+ closeTab: async () => true,
652
+ // Main deletes the site's data and reloads the page.
653
+ clearSite: async () => {
654
+ setStore({ cookies: 0, generation: store.generation + 1 })
655
+ report()
656
+ },
657
+ clearCache: async () => {
658
+ setStore("generation", (value) => value + 1)
659
+ report()
660
+ },
661
+ close: async () => undefined,
662
+ forget: async () => undefined,
663
+ state: () => undefined,
664
+ on: (_name, listener) => {
665
+ // SAFETY: the pane's Ipc has one event, whose payload is exactly this binding and PaneEvent.
666
+ const added = listener as (value: { binding: string; event: PaneEvent }) => void
667
+ listeners.add(added)
668
+
669
+ return () => void listeners.delete(added)
670
+ },
671
+ }
672
+
673
+ const live = liveAccessor(() => ({ status: "active", generation: 1, value: pane }))
674
+
675
+ // Main's history, faked at its Ipc with the real search over an index of its pages: what an import left, and the
676
+ // visits the model records.
677
+ const index = createPageIndex()
678
+ const pages = new Map<number, PageVisit>()
679
+ const position = (url: string) => Array.from(pages).find((item) => pageKey(item[1].url) === pageKey(url))?.[0]
680
+
681
+ const keep = (page: PageVisit, id = pages.size + 1) => {
682
+ pages.set(id, page)
683
+ index.set(id, page)
684
+ setStore("historyPages", pages.size)
685
+ }
686
+
687
+ const seedImported = () => importedPages(Date.now()).forEach((page) => keep(page))
688
+
689
+ // As main rejects each call while its store cannot open.
690
+ const reachable = () => {
691
+ if (store.historyAway) throw new Error("unable to open database file")
692
+ }
693
+
694
+ const historyClient = {
695
+ prepare: async () => reachable(),
696
+ search: async (request: { query: string; limit: number }) => {
697
+ reachable()
698
+
699
+ return findPages(index, request.query, request.limit, Date.now(), {
700
+ shown: (id) => pages.get(id),
701
+ front: (host) => Array.from(pages.values()).find((page) => pageKey(page.url) === host),
702
+ })
703
+ },
704
+ visit: async (request: { url: string; title: string }) => {
705
+ reachable()
706
+ const id = position(request.url)
707
+ const known = id === undefined ? undefined : pages.get(id)
708
+
709
+ if (pageKey(request.url)) keep({ ...request, visits: (known?.visits ?? 0) + 1, typed: known?.typed ?? 0, visited: Date.now() }, id)
710
+ },
711
+ retitle: async () => undefined,
712
+ remove: async (request: { url: string }) => {
713
+ reachable()
714
+ const id = position(request.url)
715
+
716
+ if (id === undefined) return
717
+ pages.delete(id)
718
+ index.remove(id)
719
+ setStore("historyPages", pages.size)
720
+ },
721
+ clear: async () => {
722
+ reachable()
723
+ pages.clear()
724
+ index.clear()
725
+ setStore("historyPages", 0)
726
+ },
727
+ }
728
+
729
+ // SAFETY: the model calls only the six methods above, with the inputs the history's Ipc schemas describe.
730
+ // oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above
731
+ const historyMain = historyClient as unknown as IpcClient<(typeof BrowserHistory)["spec"]>
732
+ const historyLive = liveAccessor(() => ({ status: "active", generation: 1, value: historyMain }))
733
+
734
+ if (scenario === "History") seedImported()
735
+
736
+ const fake = {
737
+ ...base,
738
+ app: { name: "opencode", version: "", channel: "dev", platform: "desktop", packaged: false },
739
+ use: (token: { readonly id: string }) => (token.id === BrowserHistory.id ? historyLive : live),
740
+ // The plugin instance's lifetime, which the model's calls to main's history end with.
741
+ signal: new AbortController().signal,
742
+ toast: { show: (shown: { title: string }) => setStore("toast", shown.title) },
743
+ sessions: { current: session, list: () => Array.from(views.values()).filter((view) => view.key !== "Empty") },
744
+ screen: { current: () => screen },
745
+ layout: {
746
+ narrow: () => false,
747
+ fitsSide: () => true,
748
+ // The stored layout has not loaded, so the pane's model reads no strip from it.
749
+ ready: () => false,
750
+ stored: () => [],
751
+ // The open pane shows each session's current tab; its other tab is in the strip behind it.
752
+ state: (key: string) => (tabs.some((tab) => key === `browser:${tab.id}` && tab !== current(tab.owner)) ? "open" : "visible"),
753
+ // As the host does for the model's own selection of a tab: the strip selects it.
754
+ open(key: string, _session: SessionRef, options?: { tab?: string }) {
755
+ const tab = tabs.find((item) => key === `browser:${item.id}`)
756
+
757
+ if (options?.tab !== "select" || !tab || tab.owner !== "Alpha" || tab === current("Alpha")) return
758
+ setStore("secondTab", tab.title === "Second")
759
+ report("Alpha")
760
+ embed(tab)
761
+ },
762
+ close() {},
763
+ side: { opened: () => true, toggle() {}, menu: () => [], width: () => undefined, resize() {} },
764
+ },
765
+ links: { open() {} },
766
+ stores: {
767
+ history: {
768
+ get value() {
769
+ return store.history
770
+ },
771
+ set: (next: History) => setStore("history", reconcile(next)),
772
+ },
773
+ // Already welcomed: the pane's offer to import sign-ins needs main's profile, which this fixture has none of.
774
+ preferences: { value: { links: true, welcomed: true }, set() {} },
775
+ // The pane fixture has no strip to draw saved tabs in.
776
+ tabs: { value: { sessions: [] }, set() {} },
777
+ },
778
+ system: {
779
+ copy: async () => undefined,
780
+ openExternal: (url: string) => setStore("external", (items) => [...items, url]),
781
+ },
782
+ }
783
+
784
+ // SAFETY: the real model and pane use only the host boundaries implemented above in this fixture's flows.
785
+ // oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above
786
+ const plugin = fake as unknown as Context & SetupContext<typeof definition>
787
+ const model = createModel(plugin)
788
+
789
+ // As the host routes it; a mail or copied address is recorded on the body instead of leaving the page.
790
+ if ("createAppLinks" in input) input.createAppLinks((href) => {
791
+ const route = input.appLinkRoute(href, true)
792
+
793
+ if (route !== "review") return void (document.body.dataset[route] = href)
794
+ const view = session()
795
+
796
+ if (view) void model.reviewLink(view, href)
797
+ })
798
+
799
+ const pick = (rect?: ElementRect) => {
800
+ const selector = () => {
801
+ if (store.selection === "fallback") return ""
802
+
803
+ if (store.selection === "long")
804
+ return `main > section[data-label="إعدادات"] > ${".nested-selector".repeat(24)} > button.primary`
805
+
806
+ return "main > button.primary"
807
+ }
808
+
809
+ setStore("picker", store.session, false)
810
+ emit(store.session, {
811
+ type: "inspect",
812
+ tabID: current().id,
813
+ active: false,
814
+ element: {
815
+ ref: Browser.Ref.make("e7"),
816
+ selector: selector(),
817
+ label: "button.primary",
818
+ role: "button",
819
+ name: "Save changes",
820
+ rect: rect ?? { x: 48, y: store.selection === "low" ? 180 : 40, width: 160, height: 36 },
821
+ },
822
+ })
823
+ }
824
+
825
+ if ("Frame" in input)
826
+ return (
827
+ <PluginContext.Provider value={plugin}>
828
+ <PanelContext.Provider value={panel}>
829
+ <input.Frame
830
+ loading={store.loading}
831
+ finish={() => {
832
+ setStore("loading", false)
833
+ report()
834
+ }}
835
+ suspended={model.suspended({ key: store.session })}
836
+ reconnect={() => model.command({ key: store.session }, { type: "reload", tabID: current().id })}
837
+ comments={store.comments}
838
+ sent={store.sent}
839
+ external={store.external.at(-1)}
840
+ >
841
+ <SessionBrowserPane tab={current} session={session()} screen={screen} model={model} />
842
+ </input.Frame>
843
+ </PanelContext.Provider>
844
+ </PluginContext.Provider>
845
+ )
846
+
847
+ return (
848
+ <PluginContext.Provider value={plugin}>
849
+ <PanelContext.Provider value={panel}>
850
+ {/* The plugin contributes the bar's styles through the host's Style registry, which this fixture skips.
851
+ Menus and suggestions portal into <body>, under this fixture's fixed host unless raised above it. */}
852
+ <style>{`${barStyles}\n[data-popper-positioner] { z-index: 1001 !important; }`}</style>
853
+ {/* Beside the title, so the controls below keep their rows and the pane keeps its place. */}
854
+ <h1 style={{ "font-size": "24px", "margin-bottom": "16px", display: "flex", "justify-content": "space-between" }}>
855
+ Browser pane lifecycle
856
+ <span style={{ display: "flex", gap: "8px" }}>
857
+ {/* Beside the title too: the pane below is measured where it is. */}
858
+ <span style={{ "font-size": "14px", "align-self": "center" }}>Main history: {store.historyPages}</span>
859
+ <span style={{ "font-size": "14px", "align-self": "center" }}>{store.toast}</span>
860
+ <button style={{ "font-size": "14px" }} onClick={seedImported}>
861
+ Seed imported history
862
+ </button>
863
+ <button style={{ "font-size": "14px" }} onClick={() => setStore("historyAway", (away) => !away)}>
864
+ History away
865
+ </button>
866
+ <button style={{ "font-size": "14px" }} onClick={() => setStore("failCommand", true)}>
867
+ Fail next command
868
+ </button>
869
+ <button
870
+ style={{ "font-size": "14px" }}
871
+ disabled={store.session !== "Alpha"}
872
+ onClick={() => {
873
+ setStore("secondTab", (selected) => !selected)
874
+ report()
875
+ embed(current())
876
+ }}
877
+ >
878
+ Switch browser tab
879
+ </button>
880
+ </span>
881
+ </h1>
882
+ <nav style={{ display: "flex", "flex-wrap": "wrap", gap: "12px", margin: "16px 0" }}>
883
+ <For each={["Alpha", "Beta", "Empty"]}>
884
+ {(name) => <button onClick={() => setStore({ session: name, mounted: name !== "Empty" })}>{name}</button>}
885
+ </For>
886
+ <button onClick={() => setStore("mounted", false)}>Unmount pane</button>
887
+ <button
888
+ onClick={() => {
889
+ setStore({ url: "about:blank", loading: false })
890
+ report()
891
+ }}
892
+ >
893
+ Blank page
894
+ </button>
895
+ <button
896
+ onClick={() => {
897
+ setStore({ url: "about:blank", loading: true })
898
+ report()
899
+ }}
900
+ >
901
+ Loading page
902
+ </button>
903
+ <button
904
+ onClick={() => {
905
+ setStore({
906
+ loading: true,
907
+ generation: store.generation + 1,
908
+ loadErrors: { [store.session]: undefined },
909
+ })
910
+ report()
911
+ }}
912
+ >
913
+ Load current page
914
+ </button>
915
+ <button
916
+ onClick={() => {
917
+ setStore("loadErrors", store.session, "ERR_CONNECTION_REFUSED")
918
+ report()
919
+ }}
920
+ >
921
+ Failed page
922
+ </button>
923
+ <button onClick={() => setStore("delayNavigation", true)}>Delay navigation</button>
924
+ <button
925
+ onClick={() => {
926
+ setStore({ error: "browser.address.web", pendingURL: undefined })
927
+ report()
928
+ }}
929
+ >
930
+ Block navigation
931
+ </button>
932
+ <button
933
+ onClick={() => {
934
+ setStore({
935
+ url: store.pendingURL,
936
+ pendingURL: undefined,
937
+ loading: false,
938
+ generation: store.generation + 1,
939
+ })
940
+ report()
941
+ }}
942
+ >
943
+ Complete navigation
944
+ </button>
945
+ <button onClick={() => setStore("visible", (visible) => !visible)}>Toggle Review tab</button>
946
+ <button onClick={() => setStore("holdCapture", true)}>Hold capture</button>
947
+ <button onClick={() => held.splice(0).forEach((resolve) => resolve())}>Release capture</button>
948
+ <button onClick={() => setStore("covered", (covered) => !covered)}>Toggle popover</button>
949
+ <button onClick={() => setStore("moving", (moving) => !moving)}>Toggle panel motion</button>
950
+ <For each={[false, true]}>
951
+ {(focused) => (
952
+ <button onClick={() => windowFocus.forEach((listener) => listener({ type: "focus", focused }))}>
953
+ {focused ? "Focus window" : "Blur window"}
954
+ </button>
955
+ )}
956
+ </For>
957
+ <button onClick={() => setStore("dialog", (open) => !open)}>Toggle dialog</button>
958
+ <button onClick={() => pick()}>Pick element</button>
959
+ <button onClick={() => setStore("dropInspect", true)}>Drop picker requests</button>
960
+ <select
961
+ aria-label="Picked element scenario"
962
+ onChange={(event) => setStore("selection", event.currentTarget.value)}
963
+ >
964
+ <For each={["default", "long", "fallback", "low", "zoomed"]}>{(value) => <option>{value}</option>}</For>
965
+ </select>
966
+ <button onClick={() => setStore("history", { visits })}>Seed history</button>
967
+ <button onClick={() => setStore("failSite", true)}>Fail next site read</button>
968
+ <button onClick={() => page(current(), { icon })}>Page icon</button>
969
+ </nav>
970
+
971
+ <p>Captures: {store.captures}</p>
972
+ <p>Zoom: {Math.round(details(current().id).zoom * 100)}</p>
973
+ <p>Visits: {store.history.visits.map((visit) => visit.url).join(" ")}</p>
974
+ <p>External: {store.external.join(" ")}</p>
975
+ <p>Session getter reads: {reads.directory}</p>
976
+ <p>Picker: {store.picker[store.session] ? "on" : "off"}</p>
977
+ <For each={tabs.filter((tab) => tab.title !== "Second")}>
978
+ {(tab) => (
979
+ <p>
980
+ Picker {tab.title}: {store.picker[tab.title] ? "on" : "off"}
981
+ </p>
982
+ )}
983
+ </For>
984
+ <p>Highlights: {store.highlights.map((item) => item.ref ?? "clear").join(",")}</p>
985
+ <p>Highlight owners: {store.highlights.map((item) => item.sessionKey).join(",")}</p>
986
+ <div style={{ position: "relative", width: `${store.width}px`, height: "360px", border: "1px solid #555" }}>
987
+ <Show when={store.mounted}>
988
+ <SessionBrowserPane tab={current} session={session()!} screen={screen} model={model} />
989
+ </Show>
990
+ <ResizeHandle
991
+ data-testid="pane-resize-handle"
992
+ direction="horizontal"
993
+ size={store.width}
994
+ min={320}
995
+ max={800}
996
+ onResize={(width) => setStore("width", width)}
997
+ onDraggingChange={input.panelMotion.setPanelResizing}
998
+ />
999
+ </div>
1000
+ <ul data-testid="fixture-comments">
1001
+ <For each={store.comments}>
1002
+ {(note) => (
1003
+ <li>
1004
+ {note.label} {note.live?.href?.includes("#") ? `@${note.live.href.split("#")[1]}` : "(no ref)"}:{" "}
1005
+ {note.comment}
1006
+ </li>
1007
+ )}
1008
+ </For>
1009
+ </ul>
1010
+ <div data-testid="fixture-comment-metadata">{JSON.stringify(store.comments)}</div>
1011
+ {/* Below the pane, so the pane keeps the place the geometry specs measure. */}
1012
+ <nav>
1013
+ <button onClick={() => setStore("failCapture", true)}>Fail capture</button>
1014
+ <button
1015
+ onClick={() =>
1016
+ emit(store.session, {
1017
+ type: "prompt",
1018
+ tabID: current().id,
1019
+ prompt: {
1020
+ id: 1,
1021
+ waiting: 1,
1022
+ focus: true,
1023
+ asked: 1,
1024
+ page: false,
1025
+ ask: {
1026
+ kind: "dialog",
1027
+ dialog: "confirm",
1028
+ site: { kind: "web", host: "alpha.example", embedded: false },
1029
+ message: "Discard the draft?\nIt cannot be restored.",
1030
+ value: "",
1031
+ stop: true,
1032
+ },
1033
+ },
1034
+ })
1035
+ }
1036
+ >
1037
+ Page confirm
1038
+ </button>
1039
+ <button
1040
+ onClick={() =>
1041
+ emit(store.session, {
1042
+ type: "prompt",
1043
+ tabID: current().id,
1044
+ prompt: {
1045
+ id: 2,
1046
+ waiting: 0,
1047
+ focus: false,
1048
+ asked: 1,
1049
+ page: false,
1050
+ ask: {
1051
+ kind: "permission",
1052
+ site: { kind: "web", host: "alpha.example", embedded: false },
1053
+ permissions: ["notifications"],
1054
+ remember: "kept",
1055
+ agent: false,
1056
+ system: false,
1057
+ },
1058
+ },
1059
+ })
1060
+ }
1061
+ >
1062
+ Permission request
1063
+ </button>
1064
+ <button
1065
+ onClick={() =>
1066
+ emit(store.session, {
1067
+ type: "prompt",
1068
+ tabID: current().id,
1069
+ prompt: {
1070
+ id: 2,
1071
+ waiting: 0,
1072
+ focus: false,
1073
+ asked: 2,
1074
+ page: false,
1075
+ ask: {
1076
+ kind: "permission",
1077
+ site: { kind: "web", host: "alpha.example", embedded: false },
1078
+ permissions: ["notifications"],
1079
+ remember: "kept",
1080
+ agent: false,
1081
+ system: false,
1082
+ },
1083
+ },
1084
+ })
1085
+ }
1086
+ >
1087
+ Repeat permission request
1088
+ </button>
1089
+ {/* Where the keyboard is in the window outside the pane, as the chat composer. */}
1090
+ <input aria-label="Composer stand-in" />
1091
+ <button
1092
+ onClick={() =>
1093
+ emit(store.session, {
1094
+ type: "prompt",
1095
+ tabID: current().id,
1096
+ prompt: {
1097
+ id: 3,
1098
+ waiting: 0,
1099
+ focus: false,
1100
+ asked: 1,
1101
+ page: false,
1102
+ ask: {
1103
+ kind: "permission",
1104
+ site: { kind: "web", host: "alpha.example", embedded: false },
1105
+ permissions: ["microphone"],
1106
+ remember: "none",
1107
+ agent: true,
1108
+ system: false,
1109
+ },
1110
+ },
1111
+ })
1112
+ }
1113
+ >
1114
+ Agent permission request
1115
+ </button>
1116
+ <button
1117
+ onClick={() =>
1118
+ emit(store.session, {
1119
+ type: "prompt",
1120
+ tabID: current().id,
1121
+ prompt: {
1122
+ id: 4,
1123
+ waiting: 0,
1124
+ focus: true,
1125
+ asked: 1,
1126
+ page: false,
1127
+ ask: {
1128
+ kind: "dialog",
1129
+ dialog: "prompt",
1130
+ site: { kind: "web", host: "alpha.example", embedded: false },
1131
+ message: "Name the copy",
1132
+ value: "Draft",
1133
+ stop: false,
1134
+ },
1135
+ },
1136
+ })
1137
+ }
1138
+ >
1139
+ Page prompt
1140
+ </button>
1141
+ <button
1142
+ onClick={() =>
1143
+ emit(store.session, {
1144
+ type: "prompt",
1145
+ tabID: current().id,
1146
+ prompt: {
1147
+ id: 5,
1148
+ waiting: 0,
1149
+ focus: true,
1150
+ asked: 1,
1151
+ page: false,
1152
+ ask: { kind: "auth", host: "intranet.alpha.example", realm: "Staff area", failed: true },
1153
+ },
1154
+ })
1155
+ }
1156
+ >
1157
+ Sign-in request
1158
+ </button>
1159
+ <button
1160
+ onClick={() => {
1161
+ const second = tabs[2]
1162
+
1163
+ if (!second) return
1164
+ // The agent's page asked before the agent showed it. Each tab counts its requests alone, so this one
1165
+ // has the id of the first tab's "Permission request".
1166
+ emit("Alpha", {
1167
+ type: "prompt",
1168
+ tabID: second.id,
1169
+ prompt: {
1170
+ id: 2,
1171
+ waiting: 0,
1172
+ focus: false,
1173
+ asked: 1,
1174
+ page: false,
1175
+ ask: {
1176
+ kind: "permission",
1177
+ site: { kind: "web", host: "second.example", embedded: false },
1178
+ permissions: ["camera"],
1179
+ remember: "none",
1180
+ agent: true,
1181
+ system: false,
1182
+ },
1183
+ },
1184
+ })
1185
+ emit("Alpha", { type: "activity", tabID: second.id, reveal: "tab" })
1186
+ }}
1187
+ >
1188
+ Agent shows a page that asks
1189
+ </button>
1190
+ </nav>
1191
+ <p>Answers: {JSON.stringify(store.answers)}</p>
1192
+ <p>Answered in: {JSON.stringify(store.answeredTabs)}</p>
1193
+ <Show when={store.covered}>
1194
+ {/* Floating content portals into <body> like a menu or hover card over the page. */}
1195
+ <Portal mount={document.body}>
1196
+ <div
1197
+ data-popper-positioner
1198
+ style={{
1199
+ position: "fixed",
1200
+ top: "0",
1201
+ left: "0",
1202
+ width: "320px",
1203
+ height: "480px",
1204
+ "z-index": "1001",
1205
+ "pointer-events": "none",
1206
+ }}
1207
+ />
1208
+ </Portal>
1209
+ </Show>
1210
+ <For each={tabs}>
1211
+ {(tab) => {
1212
+ const layout = () => store.layouts[`embed-${tab.title}`]
1213
+
1214
+ return (
1215
+ <div
1216
+ data-testid={`native-${tab.title}`}
1217
+ data-visible={!!layout()?.visible}
1218
+ data-x={layout()?.bounds?.x}
1219
+ data-y={layout()?.bounds?.y}
1220
+ data-width={layout()?.bounds?.width}
1221
+ data-height={layout()?.bounds?.height}
1222
+ data-layout-calls={store.layoutCalls}
1223
+ style={{ padding: "12px", margin: "8px 0", border: "1px solid #555" }}
1224
+ >
1225
+ {tab.title}: {layout()?.visible ? "visible" : "hidden"}
1226
+ </div>
1227
+ )
1228
+ }}
1229
+ </For>
1230
+ </PanelContext.Provider>
1231
+ </PluginContext.Provider>
1232
+ )
1233
+ }
1234
+ }
1235
+
1236
+ type StripTabs = {
1237
+ /** The stored strip; the fixture keeps every tab in the side pane. */
1238
+ tabs(): { all: string[]; active?: string }
1239
+ all(): string[]
1240
+ active(): string | undefined
1241
+ setAll(all: string[]): void
1242
+ setActive(tab: string | undefined): void
1243
+ close(tab: string): void
1244
+ remap(rewrite: (tab: string) => string): void
1245
+ /** Where the next new tab lands; the fixture keeps every tab in the side pane, in open order. */
1246
+ target(pane: "side" | "split" | "bottom", plugin?: string, index?: number): void
1247
+ }
1248
+
1249
+ type PaneClient = IpcClient<(typeof BrowserPane)["spec"]>
1250
+
1251
+ /** Whether a key event belongs to the side region, and whether the user's focus last was there. */
1252
+ type SideFocus = ((event: Event) => boolean) & { focused: () => boolean }
1253
+
1254
+ /** What the side region's shortcuts drive. */
1255
+ type SideShortcuts = {
1256
+ keys: () => readonly string[]
1257
+ active: () => string | undefined
1258
+ select: (key: string) => void
1259
+ close: (key: string) => void
1260
+ focus: SideFocus
1261
+ openNewTab: () => void
1262
+ closeNewTab: () => boolean
1263
+ }
1264
+
1265
+ /** The app's plugin host and side region, passed in by `packages/app/component-tests/browser-pane-restore.spec.ts`. */
1266
+ type RegionHost = {
1267
+ LanguageProvider: Component<{ locale: string; children: JSX.Element }>
1268
+ PluginHostProvider: Component<
1269
+ ParentProps<{
1270
+ definitions: Accessor<readonly Entry[]>
1271
+ disabled: Accessor<ReadonlySet<string>>
1272
+ /** The HostApis the fixture provides, by context property; the host provides links and dialogs itself. */
1273
+ apis: { readonly [api: string]: (plugin: string) => object | undefined }
1274
+ /** Runs once the app interface mounts; the fixture's is always mounted. */
1275
+ whenMounted: (run: () => void) => () => void
1276
+ ipc: (token: Ipc) => PaneClient | undefined
1277
+ }>
1278
+ >
1279
+ usePluginHost(): { ready(): boolean; links: { open(link: { href: string; exact: boolean; session: MountedSession }): void } }
1280
+ createRegion(input: {
1281
+ region: "side"
1282
+ view: Accessor<MountedSession>
1283
+ screen: SessionScreen
1284
+ tabs: Accessor<StripTabs>
1285
+ side: Accessor<{ opened(): boolean; toggle(): void }>
1286
+ }): {
1287
+ keys(): readonly string[]
1288
+ active(): string | undefined
1289
+ toggle(): void
1290
+ entry(key: string): { readonly tab: PanelTab; readonly plugin: string; readonly provider: Panel } | undefined
1291
+ select(key: string): void
1292
+ close(key: string): void
1293
+ reopen(): void
1294
+ focus: SideFocus
1295
+ newTab(pane: "side"): boolean
1296
+ openNewTab(): void
1297
+ closeNewTab(): boolean
1298
+ }
1299
+ /** The real browser and file plugins. */
1300
+ definitions: readonly Entry[]
1301
+ /** Real shell command providers for shortcut cases. */
1302
+ Shell: ParentComponent
1303
+ /** Shell fallback and the real plugin command adapter. */
1304
+ Commands: Component<{
1305
+ close: () => void
1306
+ review: () => void
1307
+ newSession: () => void
1308
+ reopenSession: () => void
1309
+ reopenSide: () => void
1310
+ switchSession: () => void
1311
+ /** The side region, for its tab shortcuts. */
1312
+ side: () => SideShortcuts | undefined
1313
+ /** The shortcut the browser's + menu item shows, as the host formats it; empty when it shows none. */
1314
+ shortcut: (shortcut: Accessor<string>) => void
1315
+ }>
1316
+ /** The real host wrapper that renders a plugin in its context. */
1317
+ Contribution: Component<{ plugin: string; children: () => JSX.Element }>
1318
+ /** The host's own placement of a tab it adds without selecting it: after `after` when the strip has it, else last. */
1319
+ appendTab(strip: { all: string[] }, tab: string, after?: string): { all: string[] }
1320
+ /** The host's own choice of the sessions whose stored strips it forgets: all but the `max` used last, and never `keep`. */
1321
+ pruneKeys(input: { keep?: string; max: number; used: Map<string, number>; view: string[]; tabs: string[] }): string[]
1322
+ }
1323
+
1324
+ type RegionFixtureState = {
1325
+ session: string
1326
+ strips: Record<string, { all: string[]; active?: string }>
1327
+ /** Each registration of a pane binding, with how many tabs it asked main to restore. */
1328
+ registrations: { binding: string; session: string; restore: number }[]
1329
+ /** The pane's Ipc is gone, as while its main plugin reloads or is not active. */
1330
+ away: boolean
1331
+ /** The browser plugin is not running, as between quitting the app and opening it again. */
1332
+ quit: boolean
1333
+ /** Whether the fixture's shell session was closed by its fallback shortcut. */
1334
+ closed: boolean
1335
+ /** How many times the review side panel toggled from a shortcut. */
1336
+ reviews: number
1337
+ /** Whether the side region is open. The pane stays mounted either way, so a page keeps its shortcuts. */
1338
+ opened: boolean
1339
+ /** How many times the shell's new session shortcut ran. */
1340
+ sessions: number
1341
+ /** How many browser tabs the pane asked main to open. */
1342
+ opens: number
1343
+ previewURL?: string
1344
+ toast?: string
1345
+ /** How many page reloads the pane asked main for. */
1346
+ reloads: number
1347
+ reopens: number
1348
+ switches: number
1349
+ /** The page main reports, blank or loaded. */
1350
+ blank: boolean
1351
+ /** Native browser tab close requests, by tab id. */
1352
+ closes: string[]
1353
+ /** Native element picker requests, by tab id and state. */
1354
+ inspects: { tabID: string; enabled: boolean }[]
1355
+ }
1356
+
1357
+ // Component-test fixture: the real side region over the real browser and file plugins, with the host's
1358
+ // session, layout, and storage HostApis and the pane's main-process Ipc faked at their boundaries. Alpha was
1359
+ // left on a file tab; Beta on a browser tab whose page the desktop reports only with its first inventory.
1360
+ export function mountBrowserRegion(input: RegionHost) {
1361
+ const host = document.createElement("main")
1362
+ host.dataset.testid = "browser-region-fixture"
1363
+ host.style.cssText = "position:fixed;inset:0;z-index:1000;background:#181818;color:#eee;padding:24px"
1364
+ document.body.appendChild(host)
1365
+
1366
+ function Fixture() {
1367
+ const alpha = "browser-test\nses_alpha"
1368
+ const beta = "browser-test\nses_beta"
1369
+ const tabID = Browser.TabID.make("tab_33333333-3333-3333-3333-333333333333")
1370
+
1371
+ const [store, setStore] = createStore<RegionFixtureState>({
1372
+ session: alpha,
1373
+ strips: {
1374
+ [alpha]: { all: ["file://alpha.ts"], active: "file://alpha.ts" },
1375
+ [beta]: { all: ["file://beta.ts", `browser:${tabID}`], active: `browser:${tabID}` },
1376
+ },
1377
+ registrations: [],
1378
+ away: false,
1379
+ quit: false,
1380
+ closed: false,
1381
+ reviews: 0,
1382
+ opened: true,
1383
+ sessions: 0,
1384
+ opens: 0,
1385
+ reloads: 0,
1386
+ reopens: 0,
1387
+ switches: 0,
1388
+ blank: false,
1389
+ closes: [],
1390
+ inspects: [],
1391
+ })
1392
+
1393
+ const [shortcut, setShortcut] = createSignal<Accessor<string>>(() => "")
1394
+ const [sideRegion, setSideRegion] = createSignal<ReturnType<RegionHost["createRegion"]>>()
1395
+ const strip = (session: string) => store.strips[session] ?? { all: [] }
1396
+ const setAll = (session: string, all: string[]) => setStore("strips", session, "all", all)
1397
+
1398
+ const close = (session: string, key: string) =>
1399
+ batch(() => {
1400
+ setAll(
1401
+ session,
1402
+ strip(session).all.filter((item) => item !== key),
1403
+ )
1404
+
1405
+ if (strip(session).active === key) setStore("strips", session, "active", undefined)
1406
+ })
1407
+
1408
+ const server = {
1409
+ id: "browser-test",
1410
+ name: "Browser test",
1411
+ url: "http://127.0.0.1:4096",
1412
+ data: { on: () => () => undefined, session: { status: () => "idle" } },
1413
+ local: true,
1414
+ builtin: true,
1415
+ compatible: true,
1416
+ connected: true,
1417
+ }
1418
+
1419
+ const location = { directory: "/repo" }
1420
+
1421
+ const refs = [alpha, beta].map(
1422
+ // SAFETY: the plugins read only these fields of a listed session, and of its server the ones `server` has.
1423
+ // oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above
1424
+ (key) => ({ key, id: key.split("\n")[1], tab: key, server, pending: false, location }) as unknown as SessionRef,
1425
+ )
1426
+
1427
+ // The session screen's file model, which follows the route.
1428
+ const file = {
1429
+ root: "/repo",
1430
+ ready: () => false,
1431
+ resolve: (path: string) => path.replace(/^file:\/\//, ""),
1432
+ absolute: () => false,
1433
+ get: () => undefined,
1434
+ missing: () => false,
1435
+ sync: async () => undefined,
1436
+ exists: async () => true,
1437
+ search: async () => [],
1438
+ }
1439
+
1440
+ // One object per routed session, as the host gives each its own.
1441
+ const views = new Map(
1442
+ [alpha, beta].map((key) => {
1443
+ const routed = {
1444
+ key,
1445
+ id: key.split("\n")[1],
1446
+ tab: key,
1447
+ visit: {},
1448
+ server,
1449
+ pending: false,
1450
+ location,
1451
+ directory: "/repo",
1452
+ local: true,
1453
+ background: [],
1454
+ }
1455
+
1456
+ // SAFETY: the browser and file plugins read only these fields of the routed session in this fixture's flows.
1457
+ // oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above
1458
+ return [key, routed as unknown as MountedSession] as const
1459
+ }),
1460
+ )
1461
+
1462
+ const fallback = views.get(alpha)
1463
+
1464
+ if (!fallback) throw new Error("The fixture has no Alpha session")
1465
+
1466
+ const view = () => views.get(store.session) ?? fallback
1467
+
1468
+ // One screen object while the strip mounts, whichever session it routes.
1469
+ // SAFETY: this fixture draws file tab triggers and the browser pane. Its file model implements list,
1470
+ // normalize and focus; the browser has composer attach, delivery and send callbacks. File-view operations are never
1471
+ // invoked here.
1472
+ // oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above
1473
+ const screen = { file, composer: { attach() {}, delivery: () => undefined, send() {} } } as unknown as SessionScreen
1474
+
1475
+ const layout = (plugin: string): BuiltinLayout => ({
1476
+ narrow: () => false,
1477
+ fitsSide: () => true,
1478
+ ready: () => true,
1479
+ open(key, session, options) {
1480
+ setAll(session.key, input.appendTab({ all: [...strip(session.key).all] }, key, options?.after).all)
1481
+
1482
+ if (options?.tab !== "append") setStore("strips", session.key, "active", key)
1483
+
1484
+ // As the host does for a selected tab, without the toggle's move of keyboard focus.
1485
+ if (options?.tab === "select") setStore("opened", true)
1486
+ },
1487
+ // As the host does, the routed session's strip closes it.
1488
+ close: (key, session) => (session.key === view().key ? sideRegion()?.close(key) : close(session.key, key)),
1489
+ toggle() {},
1490
+ hide() {},
1491
+ state(key, session) {
1492
+ if (strip(session.key).active === key) return "visible"
1493
+
1494
+ return strip(session.key).all.includes(key) ? "open" : "closed"
1495
+ },
1496
+ stored: (session) =>
1497
+ strip(session.key).all.flatMap((key) => (key.startsWith(`${plugin}:`) ? [key.slice(plugin.length + 1)] : [])),
1498
+ side: { opened: () => store.opened, toggle() {}, menu: () => [], width: () => undefined, resize() {} },
1499
+ sidebar: { opened: () => true },
1500
+ scroll: { get: () => undefined, set() {} },
1501
+ settings() {},
1502
+ project() {},
1503
+ draft() {},
1504
+ command() {},
1505
+ })
1506
+
1507
+ const keep = <T extends object>(key: string, initial: T) => {
1508
+ const [value, set] = createStore<T>(structuredClone(initial))
1509
+
1510
+ return {
1511
+ memory: [value, (mutation: (draft: T) => void) => set(produce(mutation))] as const,
1512
+ store: {
1513
+ value,
1514
+ ready: () => true,
1515
+ update: (mutate: (draft: Mutable<T>) => undefined) =>
1516
+ set(
1517
+ produce((draft) => {
1518
+ // SAFETY: keep uses Solid's writable produce draft; readonly schema fields apply only to readers.
1519
+ const returned = mutate(draft as Mutable<T>)
1520
+
1521
+ if (returned !== undefined) throw new Error("Use set(next) to replace the value.")
1522
+ }),
1523
+ ),
1524
+ set: (next: T) => set(reconcile(next)),
1525
+ },
1526
+ }
1527
+ }
1528
+
1529
+ // What each store holds, as JSON: it outlives the plugin's instance, as storage outlives a quit.
1530
+ const kept = new Map<string, () => string>()
1531
+
1532
+ // Loaded at once.
1533
+ const storage = (plugin: string): Storage => ({
1534
+ store(key, options) {
1535
+ const name = `${plugin}:${key}`
1536
+ const saved = kept.get(name)
1537
+ const opened = keep(name, saved ? Schema.decodeUnknownSync(options.schema)(JSON.parse(saved())) : options.initial).store
1538
+ kept.set(name, () => JSON.stringify(opened.value))
1539
+
1540
+ return opened
1541
+ },
1542
+ memory: (key, options) => keep(`${plugin}:${key}`, options.initial).memory,
1543
+ remove() {},
1544
+ })
1545
+
1546
+ const about: App = { name: "opencode", version: "", channel: "dev", platform: "desktop", packaged: false }
1547
+ const locale: Locale = { locale: () => "en", direction: () => "ltr" }
1548
+ const appearance: Appearance = { font: () => "monospace", mode: () => "light" }
1549
+ const router: Router = { routing: () => false, path: () => "/" }
1550
+ const keybinds: Keybinds = { keybind: () => [], keys: (bind) => bind.split("+"), matches: () => false }
1551
+ const servers: Servers = { list: () => [server.id], get: () => undefined }
1552
+ const workspaces: Workspaces = { on: () => () => undefined }
1553
+
1554
+ const listeners = new Set<(value: { binding: string; event: PaneEvent }) => void>()
1555
+
1556
+ // The page main reports for a tab.
1557
+ const tab = (id: Browser.TabID) => ({
1558
+ id,
1559
+ url: store.blank ? "about:blank" : "http://localhost:4173/",
1560
+ title: store.blank ? "" : "Preview",
1561
+ loading: false,
1562
+ canGoBack: false,
1563
+ canGoForward: false,
1564
+ generation: 0,
1565
+ })
1566
+
1567
+ const pane: PaneClient = {
1568
+ register: async (value) => {
1569
+ setStore("registrations", (items) => [
1570
+ ...items,
1571
+ { binding: value.binding, session: value.session, restore: value.restore?.tabs.length ?? 0 },
1572
+ ])
1573
+ },
1574
+ load: async () => undefined,
1575
+ command: async (value) => {
1576
+ if (value.command.type === "tabs.open") {
1577
+ setStore("opens", (count) => count + 1)
1578
+ setStore("previewURL", value.command.url)
1579
+ }
1580
+
1581
+ if (value.command.type === "reload") setStore("reloads", (count) => count + 1)
1582
+
1583
+ // As main answers a new tab beside a blank page: the new blank tab joins the inventory and is selected.
1584
+ if (value.command.type === "tabs.open" && !value.command.url && store.blank) {
1585
+ const opened = Browser.TabID.make(`tab_44444444-4444-4444-4444-${String(store.opens).padStart(12, "0")}`)
1586
+ const state = { tabs: [tab(tabID), tab(opened)], focusedTabID: opened }
1587
+ listeners.forEach((listener) => listener({ binding: value.binding, event: { type: "state", state } }))
1588
+ listeners.forEach((listener) => listener({ binding: value.binding, event: { type: "focus", tabID: opened } }))
1589
+ }
1590
+
1591
+ if (value.command.type !== "tabs.close") return
1592
+
1593
+ const closed = value.command.tabID
1594
+
1595
+ setStore("closes", (items) => [...items, closed])
1596
+ listeners.forEach((listener) =>
1597
+ listener({ binding: value.binding, event: { type: "state", state: { tabs: [], focusedTabID: null } } }),
1598
+ )
1599
+ },
1600
+ inspect: async (value) => {
1601
+ setStore("inspects", (items) => [...items, { tabID: value.tabID, enabled: value.enabled }])
1602
+ listeners.forEach((listener) =>
1603
+ listener({ binding: value.binding, event: { type: "inspect", tabID: value.tabID, active: value.enabled } }),
1604
+ )
1605
+ },
1606
+ highlight: async () => undefined,
1607
+ zoom: async () => undefined,
1608
+ setViewport: async () => undefined,
1609
+ site: async () => ({ cookies: 0 }),
1610
+ clearSite: async () => undefined,
1611
+ clearCache: async () => undefined,
1612
+ find: async () => undefined,
1613
+ notice: async () => undefined,
1614
+ reviewLink: async () => tabID,
1615
+ // Main answers the page, which then waits on nothing.
1616
+ answer: async () => ask(null),
1617
+ reveal: async () => undefined,
1618
+ close: async () => undefined,
1619
+ openPage: async () => undefined,
1620
+ createTab: async () => PluginTabHandle.make("handle"),
1621
+ closeTab: async () => true,
1622
+ forget: async () => undefined,
1623
+ state: () => undefined,
1624
+ on: (_name, listener) => {
1625
+ // SAFETY: the pane's Ipc has one event, so every listener takes that event's payload.
1626
+ const added = listener as (value: { binding: string; event: PaneEvent }) => void
1627
+ listeners.add(added)
1628
+
1629
+ return () => void listeners.delete(added)
1630
+ },
1631
+ }
1632
+
1633
+ const apis = {
1634
+ app: () => about,
1635
+ locale: () => locale,
1636
+ appearance: () => appearance,
1637
+ router: () => router,
1638
+ keybinds: () => keybinds,
1639
+ servers: () => servers,
1640
+ workspaces: () => workspaces,
1641
+ desktop: () => ({ zoom: () => 1 }),
1642
+ // The page area with what the pane draws over it, as a page's prompt; the page itself is the iframe above.
1643
+ embeds: () => ({
1644
+ View: (props: Parameters<Embeds["View"]>[0]) => (
1645
+ <div class={props.class} style={{ "min-height": "240px" }}>
1646
+ {props.children}
1647
+ </div>
1648
+ ),
1649
+ capture: async () => undefined,
1650
+ }),
1651
+ system: () => ({ copy: async () => undefined, openExternal() {}, save: async () => false }),
1652
+ sessions: () => ({ list: () => refs, current: view }),
1653
+ screen: () => ({ current: () => screen }),
1654
+ toast: () => ({ show: (input: { title: string }) => {
1655
+ setStore("toast", input.title)
1656
+
1657
+ return { dismiss() {} }
1658
+ } }),
1659
+ tabs: () => ({ list: () => [], open() {}, focus() {}, move() {}, close() {} }),
1660
+ layout,
1661
+ storage,
1662
+ }
1663
+
1664
+ const latest = () => store.registrations.filter((item) => item.session === "ses_beta").at(-1)
1665
+
1666
+ const probe = { open: async (): Promise<void> => { throw new Error("Fixture consumer not active") } }
1667
+ const [apiResult, setApiResult] = createSignal("")
1668
+
1669
+ const consumer: Entry = { id: "fixture-tabs", windowEntry: async () => {
1670
+ const contract = await import("@zyro-sec/plugin/gui/browser")
1671
+
1672
+ return { default(ctx: Context) {
1673
+ const read = ctx.use(contract.Browser)
1674
+ probe.open = async () => {
1675
+ const pane = read()
1676
+
1677
+ if (pane.status !== "active") throw new Error("missing pane")
1678
+ const id = await pane.value.experimental.open(view(), "https://fixture.invalid")
1679
+ setApiResult(String(await pane.value.experimental.close(id)))
1680
+ }
1681
+ } }
1682
+ } }
1683
+
1684
+ // The desktop answers Beta's latest registration with the tab it restored.
1685
+ const inventory = () => {
1686
+ const binding = latest()?.binding
1687
+
1688
+ if (!binding) return
1689
+
1690
+ listeners.forEach((listener) =>
1691
+ listener({ binding, event: { type: "state", state: { tabs: [tab(tabID)], focusedTabID: tabID } } }),
1692
+ )
1693
+ }
1694
+
1695
+ // What main sends Beta's latest registration, as the JSON a test wrote, read by the Ipc's own event schema.
1696
+ const [mainEvent, setMainEvent] = createSignal<HTMLTextAreaElement>()
1697
+
1698
+ const sendMainEvent = () => {
1699
+ const binding = latest()?.binding
1700
+ const field = mainEvent()
1701
+
1702
+ if (!binding || !field) return
1703
+ const sent = Schema.decodeUnknownSync(BrowserPane.spec.events.event)({ binding, event: JSON.parse(field.value) })
1704
+ listeners.forEach((listener) => listener(sent))
1705
+ }
1706
+
1707
+ // As main reports a page's prompt on Beta's tab.
1708
+ const ask = (prompt: PromptView | null) => {
1709
+ const binding = latest()?.binding
1710
+
1711
+ if (binding) listeners.forEach((listener) => listener({ binding, event: { type: "prompt", tabID, prompt } }))
1712
+ }
1713
+
1714
+ // Wires an embedded page with the same before-input-event shortcut interception as chromium.ts.
1715
+ const wirePage = (frame: HTMLIFrameElement) => {
1716
+ const win = frame.contentWindow
1717
+
1718
+ if (!win) return
1719
+ const mac = /(Mac|iPod|iPhone|iPad)/.test(navigator.platform)
1720
+
1721
+ win.addEventListener(
1722
+ "keydown",
1723
+ (event) => {
1724
+ const shortcut = pageShortcut(
1725
+ {
1726
+ key: event.key,
1727
+ code: event.code,
1728
+ control: event.ctrlKey,
1729
+ meta: event.metaKey,
1730
+ shift: event.shiftKey,
1731
+ alt: event.altKey,
1732
+ },
1733
+ mac,
1734
+ true,
1735
+ )
1736
+
1737
+ const binding = latest()?.binding
1738
+
1739
+ if (!shortcut || !binding) return
1740
+ event.preventDefault()
1741
+ event.stopImmediatePropagation()
1742
+ listeners.forEach((listener) => listener({ binding, event: { type: "shortcut", ...shortcut } }))
1743
+ },
1744
+ true,
1745
+ )
1746
+ // As chromium.ts reports the native page taking keyboard focus, which arrives over IPC after the click.
1747
+ win.addEventListener("focus", () =>
1748
+ setTimeout(() => {
1749
+ const binding = latest()?.binding
1750
+
1751
+ if (binding) listeners.forEach((listener) => listener({ binding, event: { type: "focused", tabID } }))
1752
+ }),
1753
+ )
1754
+ }
1755
+
1756
+ // Mounts once every plugin is active, as the session screen does.
1757
+ function Strip() {
1758
+ const region = input.createRegion({
1759
+ region: "side",
1760
+ view,
1761
+ screen,
1762
+ tabs: () => ({
1763
+ tabs: () => strip(view().key),
1764
+ all: () => strip(view().key).all,
1765
+ active: () => strip(view().key).active,
1766
+ setAll: (all) => setAll(view().key, all),
1767
+ setActive: (tab) => setStore("strips", view().key, "active", tab),
1768
+ close: (tab) => close(view().key, tab),
1769
+ remap(rewrite) {
1770
+ const all = strip(view().key).all
1771
+ const next = Array.from(new Set(all.map(rewrite)))
1772
+
1773
+ if (next.length !== all.length || next.some((key, index) => key !== all[index])) setAll(view().key, next)
1774
+ },
1775
+ target() {},
1776
+ }),
1777
+ side: () => ({ opened: () => store.opened, toggle: () => setStore("opened", (opened) => !opened) }),
1778
+ })
1779
+
1780
+ setSideRegion(() => region)
1781
+
1782
+ const browser = () => {
1783
+ const entry = region.entry(region.active() ?? "")
1784
+
1785
+ return entry?.plugin === "browser" ? entry : undefined
1786
+ }
1787
+
1788
+ return (
1789
+ <aside
1790
+ id="review-panel"
1791
+ tabIndex={-1}
1792
+ aria-label="Side region"
1793
+ data-focused={region.focus.focused() || undefined}
1794
+ >
1795
+ {/* The host strip draws a trigger for each of these keys. */}
1796
+ <div role="tablist" aria-label="Side panel" style={{ display: "flex", gap: "8px", margin: "16px 0" }}>
1797
+ <For each={region.keys()}>
1798
+ {(key) => (
1799
+ <button type="button" role="tab" aria-selected={region.active() === key} onClick={() => region.select(key)} style={{ padding: "4px 8px" }}>
1800
+ {region.entry(key)?.tab.label?.({ active: region.active() === key, preview: false, session: view() }) ?? region.entry(key)?.tab.title}
1801
+ </button>
1802
+ )}
1803
+ </For>
1804
+ </div>
1805
+ <p data-testid="selected">{region.active() ?? "none"}</p>
1806
+ <p data-testid="side-new-tab">{region.newTab("side") ? "shown" : "none"}</p>
1807
+ <Show when={browser()}>
1808
+ {(shown) => {
1809
+ // The pane's last reads come after the route has left its tab: they get the entry it mounted with.
1810
+ const mounted = shown()
1811
+ const entry = () => browser() ?? mounted
1812
+
1813
+ return (
1814
+ <PanelContext.Provider
1815
+ value={{
1816
+ visible: () => true,
1817
+ present: () => true,
1818
+ placement: () => "side",
1819
+ reserve: () => false,
1820
+ animate: () => false,
1821
+ sidebar: {
1822
+ opened: () => false,
1823
+ width: () => 0,
1824
+ transition: () => false,
1825
+ resize() {},
1826
+ toggle() {},
1827
+ side: () => "start",
1828
+ move() {},
1829
+ },
1830
+ open: () => [tabID],
1831
+ }}
1832
+ >
1833
+ <input.Contribution plugin={entry().plugin}>
1834
+ {() =>
1835
+ entry().provider.render({
1836
+ get tab() {
1837
+ return entry().tab
1838
+ },
1839
+ get session() {
1840
+ return view()
1841
+ },
1842
+ screen,
1843
+ })
1844
+ }
1845
+ </input.Contribution>
1846
+ </PanelContext.Provider>
1847
+ )
1848
+ }}
1849
+ </Show>
1850
+ </aside>
1851
+ )
1852
+ }
1853
+
1854
+ function Ready(props: ParentProps) {
1855
+ const plugins = input.usePluginHost()
1856
+
1857
+ return <Show when={plugins.ready()}>
1858
+ <button onClick={() => plugins.links.open({ href: "report.html", exact: true, session: view() })}>Open workspace HTML</button>
1859
+ <output>{store.previewURL}</output>
1860
+ <output>{store.toast}</output>
1861
+ {props.children}
1862
+ </Show>
1863
+ }
1864
+
1865
+ return (
1866
+ <DialogProvider>
1867
+ <input.Shell>
1868
+ <input.PluginHostProvider
1869
+ definitions={() => [...input.definitions, consumer]}
1870
+ disabled={() => new Set(store.quit ? ["browser"] : [])}
1871
+ apis={apis}
1872
+ whenMounted={(run) => {
1873
+ run()
1874
+
1875
+ return () => undefined
1876
+ }}
1877
+ ipc={(token) => (token.id === BrowserPane.id && !store.away ? pane : undefined)}
1878
+ >
1879
+ <input.Commands
1880
+ close={() => setStore("closed", true)}
1881
+ review={() => {
1882
+ setStore("reviews", (count) => count + 1)
1883
+ sideRegion()?.toggle()
1884
+ }}
1885
+ newSession={() => setStore("sessions", (count) => count + 1)}
1886
+ reopenSession={() => setStore("reopens", (count) => count + 1)}
1887
+ reopenSide={() => sideRegion()?.reopen()}
1888
+ switchSession={() => setStore("switches", (count) => count + 1)}
1889
+ side={sideRegion}
1890
+ shortcut={(next) => setShortcut(() => next)}
1891
+ />
1892
+ <h1 style={{ "font-size": "24px", "margin-bottom": "16px" }}>Restored side strip</h1>
1893
+ <nav style={{ display: "flex", gap: "12px", margin: "16px 0" }}>
1894
+ <button onClick={() => setStore({ session: beta, closed: false })}>Beta</button>
1895
+ <button
1896
+ onClick={() => {
1897
+ setStore("blank", false)
1898
+ inventory()
1899
+ }}
1900
+ >
1901
+ First inventory
1902
+ </button>
1903
+ <button onClick={() => {
1904
+ const binding = latest()?.binding
1905
+
1906
+ if (binding) listeners.forEach(listener => listener({ binding, event: { type: "state", state: { tabs: [tab(tabID)], focusedTabID: tabID }, error: "browser.pane.suspended" } }))
1907
+ }}>Suspend binding</button>
1908
+ <button onClick={() => void probe.open?.()}>Plugin open and close</button>
1909
+ <button onClick={() => {
1910
+ const binding = latest()?.binding
1911
+
1912
+ if (binding) listeners.forEach(listener => listener({ binding, event: { type: "activity", tabID, reveal: "tab" } }))
1913
+ }}>Agent show request</button>
1914
+ {/* Off screen, so the strip below keeps its place: a test dispatches its click, as the agent's request
1915
+ arrives with no input from the person. */}
1916
+ <button style={{ position: "absolute", left: "-9999px" }} onClick={() => {
1917
+ const binding = latest()?.binding
1918
+ const shown = Browser.TabID.make("tab_55555555-5555-5555-5555-555555555555")
1919
+
1920
+ if (!binding) return
1921
+ // As main reports a tab the agent opened beside the person's and asked to show.
1922
+ listeners.forEach(listener => listener({ binding, event: { type: "state", state: { tabs: [tab(tabID), tab(shown)], focusedTabID: tabID } } }))
1923
+ listeners.forEach(listener => listener({ binding, event: { type: "activity", tabID: shown, reveal: "tab" } }))
1924
+ }}>Agent shows another page</button>
1925
+ <output>Plugin closed: {apiResult()}</output>
1926
+ <button
1927
+ onClick={() => {
1928
+ setStore("blank", true)
1929
+ inventory()
1930
+ }}
1931
+ >
1932
+ Blank page
1933
+ </button>
1934
+ {/* Off screen, like the agent's request above, so the strip keeps its place: a test dispatches each click. */}
1935
+ <div style={{ position: "absolute", left: "-9999px" }}>
1936
+ {/* The plugin's instance ends and a new one starts over the same storage and strip, as the app does. */}
1937
+ <button
1938
+ onClick={() => {
1939
+ setStore("quit", true)
1940
+ queueMicrotask(() => setStore("quit", false))
1941
+ }}
1942
+ >
1943
+ Quit and reopen
1944
+ </button>
1945
+ <textarea aria-label="Main event" ref={setMainEvent} />
1946
+ <button onClick={sendMainEvent}>Send main event</button>
1947
+ <button onClick={() => setStore("session", alpha)}>Alpha</button>
1948
+ {/* As the host's layout does (`prune` in layout.tsx): it stores the strips of the 50 sessions used last. Fifty
1949
+ other sessions were used since Beta, so it forgets Beta's, whose shell tab is still open. No plugin
1950
+ hears of it. */}
1951
+ <button
1952
+ onClick={() => {
1953
+ const others = Array.from({ length: 50 }, (_, index) => `browser-test\nses_other${index}`)
1954
+ const used = new Map([[beta, 1], ...others.map((key, index): [string, number] => [key, index + 2])])
1955
+
1956
+ input
1957
+ .pruneKeys({ keep: store.session, max: 50, used, view: [], tabs: [alpha, beta, ...others] })
1958
+ .forEach((key) => setStore("strips", key, { all: [], active: undefined }))
1959
+ }}
1960
+ >
1961
+ Fifty other sessions used
1962
+ </button>
1963
+ </div>
1964
+ <button onClick={() => setStore("away", true)}>Pane away</button>
1965
+ <button onClick={() => setStore("away", false)}>Pane back</button>
1966
+ <button
1967
+ onClick={() =>
1968
+ ask({
1969
+ id: 1,
1970
+ waiting: 0,
1971
+ focus: true,
1972
+ asked: 1,
1973
+ page: false,
1974
+ ask: {
1975
+ kind: "dialog",
1976
+ dialog: "prompt",
1977
+ site: { kind: "web", host: "beta.example", embedded: false },
1978
+ message: "Name the copy",
1979
+ value: "Draft",
1980
+ stop: false,
1981
+ },
1982
+ })
1983
+ }
1984
+ >
1985
+ Page prompt
1986
+ </button>
1987
+ <button
1988
+ onClick={() =>
1989
+ ask({
1990
+ id: 2,
1991
+ waiting: 0,
1992
+ focus: true,
1993
+ asked: 1,
1994
+ page: false,
1995
+ ask: {
1996
+ kind: "permission",
1997
+ site: { kind: "web", host: "beta.example", embedded: false },
1998
+ permissions: ["notifications"],
1999
+ remember: "kept",
2000
+ agent: false,
2001
+ system: false,
2002
+ },
2003
+ })
2004
+ }
2005
+ >
2006
+ Permission request
2007
+ </button>
2008
+ </nav>
2009
+ <iframe
2010
+ title="Browser page"
2011
+ srcdoc='<!doctype html><input aria-label="Editor page input" onkeydown="if ((event.ctrlKey || event.metaKey) &amp;&amp; /^[kw]$/i.test(event.key)) { event.preventDefault(); this.value = &apos;handled:&apos; + event.key.toLowerCase() }" />'
2012
+ onLoad={(event) => wirePage(event.currentTarget)}
2013
+ style={{ height: "48px" }}
2014
+ />
2015
+ <p>Registrations: {store.registrations.length}</p>
2016
+ <p>Beta restores: {latest()?.restore ?? 0}</p>
2017
+ <p data-testid="session-state">{store.closed ? "closed" : "open"}</p>
2018
+ <p data-testid="review-toggles">{store.reviews}</p>
2019
+ <p data-testid="side-state">{store.opened ? "open" : "closed"}</p>
2020
+ <textarea aria-label="Composer" />
2021
+ <p data-testid="new-sessions">{store.sessions}</p>
2022
+ <p data-testid="browser-opens">{store.opens}</p>
2023
+ <p data-testid="browser-reloads">{store.reloads}</p>
2024
+ <p data-testid="session-reopens">{store.reopens}</p>
2025
+ <p data-testid="session-switches">{store.switches}</p>
2026
+ <p data-testid="add-shortcut">{shortcut()() || "none"}</p>
2027
+ <p data-testid="browser-closes">{JSON.stringify(store.closes)}</p>
2028
+ <p data-testid="browser-inspects">{JSON.stringify(store.inspects)}</p>
2029
+ <Ready>
2030
+ <Strip />
2031
+ </Ready>
2032
+ </input.PluginHostProvider>
2033
+ </input.Shell>
2034
+ </DialogProvider>
2035
+ )
2036
+ }
2037
+
2038
+ return render(
2039
+ () => (
2040
+ <input.LanguageProvider locale="en">
2041
+ <Fixture />
2042
+ </input.LanguageProvider>
2043
+ ),
2044
+ host,
2045
+ )
2046
+ }