@amalgm/browser 0.1.2-preview.35541635545 → 0.1.2-preview.37254096068

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 (390) hide show
  1. package/PURPOSE.md +119 -97
  2. package/README.md +51 -56
  3. package/SECURITY.md +10 -8
  4. package/dist/bin/amalgm-browser-mcp.js +2 -3
  5. package/dist/bin/amalgm-browser-mcp.js.map +1 -1
  6. package/dist/bin/amalgm-browser-rest.js +8 -18
  7. package/dist/bin/amalgm-browser-rest.js.map +1 -1
  8. package/dist/src/account.d.ts +8 -0
  9. package/dist/src/account.js +42 -0
  10. package/dist/src/account.js.map +1 -0
  11. package/dist/src/action.d.ts +1 -2
  12. package/dist/src/action.js +3 -7
  13. package/dist/src/action.js.map +1 -1
  14. package/dist/src/adapters/cli/actions.d.ts +0 -1
  15. package/dist/src/adapters/cli/actions.js +0 -7
  16. package/dist/src/adapters/cli/actions.js.map +1 -1
  17. package/dist/src/adapters/cli/help.d.ts +1 -1
  18. package/dist/src/adapters/cli/help.js +1 -4
  19. package/dist/src/adapters/cli/help.js.map +1 -1
  20. package/dist/src/adapters/cli/resources.js +0 -22
  21. package/dist/src/adapters/cli/resources.js.map +1 -1
  22. package/dist/src/adapters/cli/run.js +25 -19
  23. package/dist/src/adapters/cli/run.js.map +1 -1
  24. package/dist/src/adapters/execute.js +2 -2
  25. package/dist/src/adapters/execute.js.map +1 -1
  26. package/dist/src/adapters/http/events.d.ts +5 -2
  27. package/dist/src/adapters/http/events.js +18 -2
  28. package/dist/src/adapters/http/events.js.map +1 -1
  29. package/dist/src/adapters/http/internal-routes.js +9 -4
  30. package/dist/src/adapters/http/internal-routes.js.map +1 -1
  31. package/dist/src/adapters/http/navigation-stream.d.ts +4 -0
  32. package/dist/src/adapters/http/navigation-stream.js +17 -0
  33. package/dist/src/adapters/http/navigation-stream.js.map +1 -0
  34. package/dist/src/adapters/http/openapi.js +2 -8
  35. package/dist/src/adapters/http/openapi.js.map +1 -1
  36. package/dist/src/adapters/http/server.js +54 -14
  37. package/dist/src/adapters/http/server.js.map +1 -1
  38. package/dist/src/adapters/http/session-routes.js +0 -1
  39. package/dist/src/adapters/http/session-routes.js.map +1 -1
  40. package/dist/src/adapters/http/stream.d.ts +6 -0
  41. package/dist/src/adapters/http/stream.js +89 -0
  42. package/dist/src/adapters/http/stream.js.map +1 -0
  43. package/dist/src/adapters/mcp/server.js +2 -2
  44. package/dist/src/adapters/mcp/server.js.map +1 -1
  45. package/dist/src/adapters/mcp/tools.js +2 -4
  46. package/dist/src/adapters/mcp/tools.js.map +1 -1
  47. package/dist/src/adapters/mcp/types.d.ts +3 -2
  48. package/dist/src/adapters/toolbox/manifest.js +1 -1
  49. package/dist/src/adapters/toolbox/manifest.js.map +1 -1
  50. package/dist/src/auth/login.d.ts +3 -1
  51. package/dist/src/auth/login.js +48 -33
  52. package/dist/src/auth/login.js.map +1 -1
  53. package/dist/src/auth/service.js +56 -67
  54. package/dist/src/auth/service.js.map +1 -1
  55. package/dist/src/{drivers/cdp → cdp}/capture.d.ts +1 -1
  56. package/dist/src/{drivers/cdp → cdp}/capture.js +1 -1
  57. package/dist/src/cdp/capture.js.map +1 -0
  58. package/dist/src/{drivers/cdp → cdp}/client.d.ts +3 -1
  59. package/dist/src/{drivers/cdp → cdp}/client.js +51 -14
  60. package/dist/src/cdp/client.js.map +1 -0
  61. package/dist/src/cdp/input.js.map +1 -0
  62. package/dist/src/cdp/navigation.d.ts +5 -0
  63. package/dist/src/cdp/navigation.js +47 -0
  64. package/dist/src/cdp/navigation.js.map +1 -0
  65. package/dist/src/{drivers/cdp → cdp}/screencast.js +1 -1
  66. package/dist/src/cdp/screencast.js.map +1 -0
  67. package/dist/src/chrome/cookie-adapter.d.ts +23 -0
  68. package/dist/src/chrome/cookie-adapter.js +74 -0
  69. package/dist/src/chrome/cookie-adapter.js.map +1 -0
  70. package/dist/src/chrome/cookie-changes.d.ts +12 -0
  71. package/dist/src/chrome/cookie-changes.js +100 -0
  72. package/dist/src/chrome/cookie-changes.js.map +1 -0
  73. package/dist/src/chrome/cookie-observer.d.ts +20 -0
  74. package/dist/src/chrome/cookie-observer.js +44 -0
  75. package/dist/src/chrome/cookie-observer.js.map +1 -0
  76. package/dist/src/chrome/executable.d.ts +1 -0
  77. package/dist/src/chrome/executable.js +55 -0
  78. package/dist/src/chrome/executable.js.map +1 -0
  79. package/dist/src/chrome/flags.d.ts +7 -0
  80. package/dist/src/chrome/flags.js +59 -0
  81. package/dist/src/chrome/flags.js.map +1 -0
  82. package/dist/src/chrome/host.d.ts +25 -0
  83. package/dist/src/chrome/host.js +137 -0
  84. package/dist/src/chrome/host.js.map +1 -0
  85. package/dist/src/chrome/launch.d.ts +11 -0
  86. package/dist/src/chrome/launch.js +105 -0
  87. package/dist/src/chrome/launch.js.map +1 -0
  88. package/dist/src/chrome/relay/editing.d.ts +2 -0
  89. package/dist/src/chrome/relay/editing.js +14 -0
  90. package/dist/src/chrome/relay/editing.js.map +1 -0
  91. package/dist/src/chrome/relay/server.d.ts +18 -0
  92. package/dist/src/chrome/relay/server.js +120 -0
  93. package/dist/src/chrome/relay/server.js.map +1 -0
  94. package/dist/src/chrome/relay/targets.d.ts +11 -0
  95. package/dist/src/chrome/relay/targets.js +59 -0
  96. package/dist/src/chrome/relay/targets.js.map +1 -0
  97. package/dist/src/chrome/relay/view.d.ts +34 -0
  98. package/dist/src/chrome/relay/view.js +185 -0
  99. package/dist/src/chrome/relay/view.js.map +1 -0
  100. package/dist/src/cookies/adapter-credential.d.ts +6 -0
  101. package/dist/src/cookies/adapter-credential.js +33 -0
  102. package/dist/src/cookies/adapter-credential.js.map +1 -0
  103. package/dist/src/cookies/coordinator.d.ts +14 -13
  104. package/dist/src/cookies/coordinator.js +157 -75
  105. package/dist/src/cookies/coordinator.js.map +1 -1
  106. package/dist/src/cookies/database.d.ts +29 -0
  107. package/dist/src/cookies/database.js +113 -0
  108. package/dist/src/cookies/database.js.map +1 -0
  109. package/dist/src/cookies/diff.d.ts +6 -0
  110. package/dist/src/cookies/diff.js +19 -0
  111. package/dist/src/cookies/diff.js.map +1 -0
  112. package/dist/src/cookies/http-store.d.ts +7 -0
  113. package/dist/src/cookies/http-store.js +105 -0
  114. package/dist/src/cookies/http-store.js.map +1 -0
  115. package/dist/src/cookies/jar.d.ts +12 -11
  116. package/dist/src/cookies/jar.js +128 -120
  117. package/dist/src/cookies/jar.js.map +1 -1
  118. package/dist/src/cookies/policy.js +10 -4
  119. package/dist/src/cookies/policy.js.map +1 -1
  120. package/dist/src/cookies/secret-file.d.ts +4 -0
  121. package/dist/src/cookies/secret-file.js +47 -9
  122. package/dist/src/cookies/secret-file.js.map +1 -1
  123. package/dist/src/cookies/types.d.ts +34 -2
  124. package/dist/src/cookies.d.ts +2 -0
  125. package/dist/src/cookies.js +2 -0
  126. package/dist/src/cookies.js.map +1 -1
  127. package/dist/src/defaults.d.ts +1 -5
  128. package/dist/src/defaults.js +49 -58
  129. package/dist/src/defaults.js.map +1 -1
  130. package/dist/src/driver/cli-policy.d.ts +1 -0
  131. package/dist/src/driver/cli-policy.js +17 -0
  132. package/dist/src/driver/cli-policy.js.map +1 -0
  133. package/dist/src/{drivers/headless → driver}/command.d.ts +3 -7
  134. package/dist/src/{drivers/headless → driver}/command.js +29 -29
  135. package/dist/src/driver/command.js.map +1 -0
  136. package/dist/src/{drivers/headless → driver}/driver.d.ts +13 -10
  137. package/dist/src/{drivers/headless → driver}/driver.js +67 -82
  138. package/dist/src/driver/driver.js.map +1 -0
  139. package/dist/src/{interaction/delta.d.ts → driver/evidence.d.ts} +3 -2
  140. package/dist/src/{interaction/delta.js → driver/evidence.js} +6 -3
  141. package/dist/src/driver/evidence.js.map +1 -0
  142. package/dist/src/driver/executable.js.map +1 -0
  143. package/dist/src/driver/stream.d.ts +1 -0
  144. package/dist/src/driver/stream.js +22 -0
  145. package/dist/src/driver/stream.js.map +1 -0
  146. package/dist/src/driver/wait.d.ts +6 -0
  147. package/dist/src/driver/wait.js +28 -0
  148. package/dist/src/driver/wait.js.map +1 -0
  149. package/dist/src/electron/adblock/cache.js.map +1 -0
  150. package/dist/src/electron/adblock/cosmetics.js.map +1 -0
  151. package/dist/src/{drivers/electron/native → electron}/adblock/index.d.ts +0 -1
  152. package/dist/src/{drivers/electron/native → electron}/adblock/index.js +0 -1
  153. package/dist/src/{drivers/electron/native → electron}/adblock/index.js.map +1 -1
  154. package/dist/src/electron/adblock/policy.js.map +1 -0
  155. package/dist/src/electron/adblock/preload.js.map +1 -0
  156. package/dist/src/electron/adblock/settings.js.map +1 -0
  157. package/dist/src/{drivers/electron/native → electron}/contracts.d.ts +0 -14
  158. package/dist/src/{drivers/electron/native → electron}/contracts.js +0 -1
  159. package/dist/src/electron/contracts.js.map +1 -0
  160. package/dist/src/{drivers/electron → electron}/cookie-adapter.d.ts +4 -4
  161. package/dist/src/{drivers/electron → electron}/cookie-adapter.js +9 -6
  162. package/dist/src/electron/cookie-adapter.js.map +1 -0
  163. package/dist/src/electron/cookie-sync.d.ts +6 -0
  164. package/dist/src/electron/cookie-sync.js +18 -0
  165. package/dist/src/electron/cookie-sync.js.map +1 -0
  166. package/dist/src/electron/policy.js.map +1 -0
  167. package/dist/src/electron/session.d.ts +2 -0
  168. package/dist/src/electron/session.js +9 -0
  169. package/dist/src/electron/session.js.map +1 -0
  170. package/dist/src/electron/shell/adblock-ipc.js.map +1 -0
  171. package/dist/src/electron/shell/context-menu.js.map +1 -0
  172. package/dist/src/electron/shell/downloads.js.map +1 -0
  173. package/dist/src/electron/shell/helpers.js.map +1 -0
  174. package/dist/src/electron/shell/permissions.js.map +1 -0
  175. package/dist/src/{drivers/electron/native → electron}/shell/sites.d.ts +1 -3
  176. package/dist/src/{drivers/electron/native → electron}/shell/sites.js +2 -34
  177. package/dist/src/electron/shell/sites.js.map +1 -0
  178. package/dist/src/{drivers/electron/native → electron}/shell/types.d.ts +0 -1
  179. package/dist/src/electron/shell/types.js.map +1 -0
  180. package/dist/src/electron/shell.d.ts +13 -0
  181. package/dist/src/electron/shell.js +73 -0
  182. package/dist/src/electron/shell.js.map +1 -0
  183. package/dist/src/electron/surface/commands.js.map +1 -0
  184. package/dist/src/{drivers/electron/native → electron}/surface/create.js +0 -6
  185. package/dist/src/electron/surface/create.js.map +1 -0
  186. package/dist/src/{drivers/electron/native → electron}/surface/events.js +1 -13
  187. package/dist/src/electron/surface/events.js.map +1 -0
  188. package/dist/src/{drivers/electron/native → electron}/surface/presentation.d.ts +2 -9
  189. package/dist/src/electron/surface/presentation.js +29 -0
  190. package/dist/src/electron/surface/presentation.js.map +1 -0
  191. package/dist/src/{drivers/electron/native → electron}/surface/state.d.ts +5 -0
  192. package/dist/src/{drivers/electron/native → electron}/surface/state.js +10 -4
  193. package/dist/src/electron/surface/state.js.map +1 -0
  194. package/dist/src/{drivers/electron/native → electron}/surface/types.d.ts +2 -8
  195. package/dist/src/electron/surface/types.js.map +1 -0
  196. package/dist/src/{drivers/electron/native → electron}/surface-controller.js +9 -12
  197. package/dist/src/electron/surface-controller.js.map +1 -0
  198. package/dist/src/electron-preload.cjs +1 -1
  199. package/dist/src/electron.cjs +587 -820
  200. package/dist/src/electron.d.cts +4 -14
  201. package/dist/src/electron.d.ts +4 -14
  202. package/dist/src/electron.js +4 -14
  203. package/dist/src/electron.js.map +1 -1
  204. package/dist/src/errors.d.ts +1 -1
  205. package/dist/src/errors.js.map +1 -1
  206. package/dist/src/index.d.ts +2 -3
  207. package/dist/src/index.js +0 -2
  208. package/dist/src/index.js.map +1 -1
  209. package/dist/src/migration/legacy-migration.d.ts +0 -1
  210. package/dist/src/migration/legacy-migration.js +3 -9
  211. package/dist/src/migration/legacy-migration.js.map +1 -1
  212. package/dist/src/migration/legacy-rows.d.ts +1 -2
  213. package/dist/src/migration/legacy-rows.js +0 -14
  214. package/dist/src/migration/legacy-rows.js.map +1 -1
  215. package/dist/src/ports.d.ts +12 -15
  216. package/dist/src/ports.js.map +1 -1
  217. package/dist/src/process.d.ts +1 -0
  218. package/dist/src/process.js +11 -0
  219. package/dist/src/process.js.map +1 -1
  220. package/dist/src/product-service.d.ts +4 -6
  221. package/dist/src/product-service.js +21 -15
  222. package/dist/src/product-service.js.map +1 -1
  223. package/dist/src/recording/encoder.js +1 -1
  224. package/dist/src/recording/encoder.js.map +1 -1
  225. package/dist/src/recording/service.d.ts +4 -0
  226. package/dist/src/recording/service.js +72 -62
  227. package/dist/src/recording/service.js.map +1 -1
  228. package/dist/src/recording/source.js +1 -1
  229. package/dist/src/recording/source.js.map +1 -1
  230. package/dist/src/registry.d.ts +4 -0
  231. package/dist/src/registry.js +17 -0
  232. package/dist/src/registry.js.map +1 -1
  233. package/dist/src/service-options.d.ts +5 -7
  234. package/dist/src/service.d.ts +16 -18
  235. package/dist/src/service.js +108 -108
  236. package/dist/src/service.js.map +1 -1
  237. package/dist/src/sessions/operations.d.ts +12 -0
  238. package/dist/src/sessions/operations.js +56 -0
  239. package/dist/src/sessions/operations.js.map +1 -0
  240. package/dist/src/testing.d.ts +8 -4
  241. package/dist/src/testing.js +7 -5
  242. package/dist/src/testing.js.map +1 -1
  243. package/dist/src/types.d.ts +0 -39
  244. package/docs/ACTIONS.md +0 -4
  245. package/docs/ARCHITECTURE.md +51 -55
  246. package/docs/AUTHENTICATION.md +41 -36
  247. package/docs/AXIOMS.md +13 -11
  248. package/docs/CHROME.md +143 -0
  249. package/docs/CLI.md +63 -31
  250. package/docs/COMPATIBILITY.md +14 -23
  251. package/docs/COOKIES.md +95 -52
  252. package/docs/ELECTRON_INTEGRATION.md +84 -77
  253. package/docs/EVENTS.md +5 -9
  254. package/docs/MCP.md +10 -6
  255. package/docs/MIGRATION.md +43 -36
  256. package/docs/OPERATIONS.md +48 -40
  257. package/docs/README.md +5 -5
  258. package/docs/REALTIME_BOUNDARY.md +3 -3
  259. package/docs/RECORDING.md +16 -15
  260. package/docs/REST.md +57 -26
  261. package/docs/SDK.md +65 -55
  262. package/docs/SHELL_INTEGRATION.md +78 -36
  263. package/docs/TESTING.md +58 -42
  264. package/docs/TOOLBOX_INTEGRATION.md +9 -4
  265. package/docs/TROUBLESHOOTING.md +68 -40
  266. package/examples/basic.ts +1 -0
  267. package/package.json +8 -15
  268. package/skills/use-amalgm-browser/SKILL.md +16 -29
  269. package/skills/use-amalgm-browser/references/actions.md +2 -2
  270. package/dist/src/adapters/http/profile-routes.d.ts +0 -2
  271. package/dist/src/adapters/http/profile-routes.js +0 -42
  272. package/dist/src/adapters/http/profile-routes.js.map +0 -1
  273. package/dist/src/auth/transport.d.ts +0 -8
  274. package/dist/src/auth/transport.js +0 -45
  275. package/dist/src/auth/transport.js.map +0 -1
  276. package/dist/src/drivers/cdp/capture.js.map +0 -1
  277. package/dist/src/drivers/cdp/client.js.map +0 -1
  278. package/dist/src/drivers/cdp/input.js.map +0 -1
  279. package/dist/src/drivers/cdp/screencast.js.map +0 -1
  280. package/dist/src/drivers/cdp/target.d.ts +0 -4
  281. package/dist/src/drivers/cdp/target.js +0 -34
  282. package/dist/src/drivers/cdp/target.js.map +0 -1
  283. package/dist/src/drivers/electron/advertisement.d.ts +0 -12
  284. package/dist/src/drivers/electron/advertisement.js +0 -57
  285. package/dist/src/drivers/electron/advertisement.js.map +0 -1
  286. package/dist/src/drivers/electron/contracts.d.ts +0 -45
  287. package/dist/src/drivers/electron/contracts.js +0 -10
  288. package/dist/src/drivers/electron/contracts.js.map +0 -1
  289. package/dist/src/drivers/electron/cookie-adapter.js.map +0 -1
  290. package/dist/src/drivers/electron/driver.d.ts +0 -19
  291. package/dist/src/drivers/electron/driver.js +0 -115
  292. package/dist/src/drivers/electron/driver.js.map +0 -1
  293. package/dist/src/drivers/electron/native/adblock/cache.js.map +0 -1
  294. package/dist/src/drivers/electron/native/adblock/cosmetics.js.map +0 -1
  295. package/dist/src/drivers/electron/native/adblock/policy.js.map +0 -1
  296. package/dist/src/drivers/electron/native/adblock/preload.js.map +0 -1
  297. package/dist/src/drivers/electron/native/adblock/settings.js.map +0 -1
  298. package/dist/src/drivers/electron/native/config.d.ts +0 -4
  299. package/dist/src/drivers/electron/native/config.js +0 -9
  300. package/dist/src/drivers/electron/native/config.js.map +0 -1
  301. package/dist/src/drivers/electron/native/contracts.js.map +0 -1
  302. package/dist/src/drivers/electron/native/policy.js.map +0 -1
  303. package/dist/src/drivers/electron/native/session.d.ts +0 -4
  304. package/dist/src/drivers/electron/native/session.js +0 -11
  305. package/dist/src/drivers/electron/native/session.js.map +0 -1
  306. package/dist/src/drivers/electron/native/shell/adblock-ipc.js.map +0 -1
  307. package/dist/src/drivers/electron/native/shell/context-menu.js.map +0 -1
  308. package/dist/src/drivers/electron/native/shell/downloads.js.map +0 -1
  309. package/dist/src/drivers/electron/native/shell/helpers.js.map +0 -1
  310. package/dist/src/drivers/electron/native/shell/permissions.js.map +0 -1
  311. package/dist/src/drivers/electron/native/shell/sites.js.map +0 -1
  312. package/dist/src/drivers/electron/native/shell/types.js.map +0 -1
  313. package/dist/src/drivers/electron/native/shell.d.ts +0 -14
  314. package/dist/src/drivers/electron/native/shell.js +0 -115
  315. package/dist/src/drivers/electron/native/shell.js.map +0 -1
  316. package/dist/src/drivers/electron/native/surface/commands.js.map +0 -1
  317. package/dist/src/drivers/electron/native/surface/create.js.map +0 -1
  318. package/dist/src/drivers/electron/native/surface/events.js.map +0 -1
  319. package/dist/src/drivers/electron/native/surface/presentation.js +0 -87
  320. package/dist/src/drivers/electron/native/surface/presentation.js.map +0 -1
  321. package/dist/src/drivers/electron/native/surface/state.js.map +0 -1
  322. package/dist/src/drivers/electron/native/surface/types.js.map +0 -1
  323. package/dist/src/drivers/electron/native/surface-controller.js.map +0 -1
  324. package/dist/src/drivers/electron/policy.d.ts +0 -4
  325. package/dist/src/drivers/electron/policy.js +0 -39
  326. package/dist/src/drivers/electron/policy.js.map +0 -1
  327. package/dist/src/drivers/electron/session.d.ts +0 -4
  328. package/dist/src/drivers/electron/session.js +0 -5
  329. package/dist/src/drivers/electron/session.js.map +0 -1
  330. package/dist/src/drivers/headless/command.js.map +0 -1
  331. package/dist/src/drivers/headless/cookie-adapter.d.ts +0 -16
  332. package/dist/src/drivers/headless/cookie-adapter.js +0 -59
  333. package/dist/src/drivers/headless/cookie-adapter.js.map +0 -1
  334. package/dist/src/drivers/headless/driver.js.map +0 -1
  335. package/dist/src/drivers/headless/executable.js.map +0 -1
  336. package/dist/src/drivers/headless/screencast.d.ts +0 -3
  337. package/dist/src/drivers/headless/screencast.js +0 -21
  338. package/dist/src/drivers/headless/screencast.js.map +0 -1
  339. package/dist/src/headless.d.ts +0 -3
  340. package/dist/src/headless.js +0 -4
  341. package/dist/src/headless.js.map +0 -1
  342. package/dist/src/interaction/delta.js.map +0 -1
  343. package/dist/src/interaction/typing.d.ts +0 -39
  344. package/dist/src/interaction/typing.js +0 -189
  345. package/dist/src/interaction/typing.js.map +0 -1
  346. package/dist/src/profiles/directories.d.ts +0 -9
  347. package/dist/src/profiles/directories.js +0 -57
  348. package/dist/src/profiles/directories.js.map +0 -1
  349. package/dist/src/profiles/service.d.ts +0 -30
  350. package/dist/src/profiles/service.js +0 -89
  351. package/dist/src/profiles/service.js.map +0 -1
  352. package/dist/src/runtime-selector.d.ts +0 -12
  353. package/dist/src/runtime-selector.js +0 -72
  354. package/dist/src/runtime-selector.js.map +0 -1
  355. package/docs/HEADLESS_RUNTIME.md +0 -58
  356. package/examples/custom-driver.ts +0 -45
  357. /package/dist/src/{drivers/cdp → cdp}/input.d.ts +0 -0
  358. /package/dist/src/{drivers/cdp → cdp}/input.js +0 -0
  359. /package/dist/src/{drivers/cdp → cdp}/screencast.d.ts +0 -0
  360. /package/dist/src/{drivers/headless → driver}/executable.d.ts +0 -0
  361. /package/dist/src/{drivers/headless → driver}/executable.js +0 -0
  362. /package/dist/src/{drivers/electron/native → electron}/adblock/cache.d.ts +0 -0
  363. /package/dist/src/{drivers/electron/native → electron}/adblock/cache.js +0 -0
  364. /package/dist/src/{drivers/electron/native → electron}/adblock/cosmetics.d.ts +0 -0
  365. /package/dist/src/{drivers/electron/native → electron}/adblock/cosmetics.js +0 -0
  366. /package/dist/src/{drivers/electron/native → electron}/adblock/policy.d.ts +0 -0
  367. /package/dist/src/{drivers/electron/native → electron}/adblock/policy.js +0 -0
  368. /package/dist/src/{drivers/electron/native → electron}/adblock/preload.d.ts +0 -0
  369. /package/dist/src/{drivers/electron/native → electron}/adblock/preload.js +0 -0
  370. /package/dist/src/{drivers/electron/native → electron}/adblock/settings.d.ts +0 -0
  371. /package/dist/src/{drivers/electron/native → electron}/adblock/settings.js +0 -0
  372. /package/dist/src/{drivers/electron/native → electron}/policy.d.ts +0 -0
  373. /package/dist/src/{drivers/electron/native → electron}/policy.js +0 -0
  374. /package/dist/src/{drivers/electron/native → electron}/shell/adblock-ipc.d.ts +0 -0
  375. /package/dist/src/{drivers/electron/native → electron}/shell/adblock-ipc.js +0 -0
  376. /package/dist/src/{drivers/electron/native → electron}/shell/context-menu.d.ts +0 -0
  377. /package/dist/src/{drivers/electron/native → electron}/shell/context-menu.js +0 -0
  378. /package/dist/src/{drivers/electron/native → electron}/shell/downloads.d.ts +0 -0
  379. /package/dist/src/{drivers/electron/native → electron}/shell/downloads.js +0 -0
  380. /package/dist/src/{drivers/electron/native → electron}/shell/helpers.d.ts +0 -0
  381. /package/dist/src/{drivers/electron/native → electron}/shell/helpers.js +0 -0
  382. /package/dist/src/{drivers/electron/native → electron}/shell/permissions.d.ts +0 -0
  383. /package/dist/src/{drivers/electron/native → electron}/shell/permissions.js +0 -0
  384. /package/dist/src/{drivers/electron/native → electron}/shell/types.js +0 -0
  385. /package/dist/src/{drivers/electron/native → electron}/surface/commands.d.ts +0 -0
  386. /package/dist/src/{drivers/electron/native → electron}/surface/commands.js +0 -0
  387. /package/dist/src/{drivers/electron/native → electron}/surface/create.d.ts +0 -0
  388. /package/dist/src/{drivers/electron/native → electron}/surface/events.d.ts +0 -0
  389. /package/dist/src/{drivers/electron/native → electron}/surface/types.js +0 -0
  390. /package/dist/src/{drivers/electron/native → electron}/surface-controller.d.ts +0 -0
package/docs/COOKIES.md CHANGED
@@ -1,61 +1,104 @@
1
1
  # Cookies
2
2
 
3
- Browser has three separate security domains:
4
-
5
- 1. the Amalgm application renderer and account session;
6
- 2. the visible Electron `persist:amalgm-browser` partition;
7
- 3. each headless Chromium profile store.
8
-
9
- The application renderer is outside Browser. Electron and headless stores are
10
- physically isolated and never read one another.
11
-
12
- ## Logical jar
13
-
14
- Cross-backend portability occurs through one encrypted Browser cookie jar.
15
- Each trusted `BrowserCookieAdapter` reports a normalized snapshot or mutation;
16
- the coordinator merges records and applies changes back to other adapters.
17
-
18
- The record identity includes domain, path, name, and partition key. Merges use
19
- timestamp then source ID for deterministic last-writer-wins ordering. Deletes
20
- are durable tombstones, so a stale physical snapshot cannot resurrect a logged
21
- out cookie. One adapter update cannot replace unrelated records.
22
-
23
- Adapter baselines suppress feedback generated while applying jar changes.
24
- Failed application is retried. Partitioned identity is preserved; an adapter
25
- that cannot represent partitioned cookies skips them rather than flattening
26
- them.
27
-
28
- ## Filtering
29
-
30
- The central boundary rejects application/authentication hosts, Amalgm API
31
- hosts, Supabase hosts, loopback, and configured exclusions. Filtering happens
32
- before secret persistence or propagation. Automatic synchronization moves
33
- cookies only; it never copies localStorage or sessionStorage.
3
+ The account's encrypted jar (`cookie-jar.sqlite`) is the store of record.
4
+ Chrome uses one account profile; Electron uses one persistent partition per
5
+ account. Application authentication in Electron's `defaultSession` is outside
6
+ Browser. Physical browser storage follows the browser's own storage policy.
7
+
8
+ ## Events and consequences
9
+
10
+ | Event | Consequence |
11
+ | --- | --- |
12
+ | Physical cookie added, changed, expired, evicted or deleted | Commit that record or tombstone to the jar. |
13
+ | Jar transaction committed | Notify the new revision; deliver only records changed since the receiver's acknowledged revision. |
14
+ | Adapter connected, or Chrome restarted the observer's stopped worker | Read one snapshot and reconcile that physical store. |
15
+ | Live revision stream ended after delivering | Rejoin it once. A refused stream is not retried. |
16
+ | Runtime binding published or native cookie changed while disconnected | Attempt the connection with the current credentials. |
17
+ | Account closed | Drain admitted changes, unsubscribe and release resources. |
18
+
19
+ Chrome's SDK-owned private extension listens to `chrome.cookies.onChanged`.
20
+ It observes HttpOnly and partitioned cookies independently of websites and page
21
+ activity. Electron's `cookies.changed` supplies the same record information.
22
+ Neither adapter installs website listeners, enables network observation, scans
23
+ on input/actions, or runs a synchronization timer. A replacement's intermediate
24
+ `overwrite` removal is followed by its insertion event and is not a logout.
25
+
26
+ Each adapter serializes its events. Pending changes to the same identity
27
+ coalesce while existing work is in flight; there is no debounce delay. Applying
28
+ a jar change records its expected echo before writing the physical store.
29
+ That echo never becomes a new local edit, including after an interrupted apply.
30
+ On first contact, physical cookies contribute only identities the jar has never
31
+ known. Stale disk cookies cannot resurrect a deletion; an observed new edit can.
32
+ An unavailable store retains pending changes and waits for another cookie or
33
+ host readiness event. No timer guesses when the runtime will be ready.
34
+
35
+ The private authenticated stream carries value-free revision notifications.
36
+ Cookie values travel only through the private delta endpoint. A new database
37
+ epoch requires a snapshot; normal revisions use an indexed delta query. Each
38
+ identity occupies one encrypted row. A row is forgotten once its cookie can
39
+ no longer exist in any browser: at its expiry, and never more than 400 days
40
+ (Chrome's lifetime cap) after its last change. A tombstone keeps the expiry of
41
+ the cookie it buries; deleting an unknown, already-expired cookie writes nothing.
42
+ Automatic synchronization moves cookies only, never origin storage.
43
+
44
+ Custom adapters implement `subscribe` with `{cookie, removed}` records;
45
+ `undefined` means observation restarted and requires reconciliation.
46
+ Custom stores implement `changes(version)` with upserts, deletions and the
47
+ acknowledged revision; `reset` requests a new connection snapshot. These are
48
+ trusted adapter ports, separate from the value-free public event stream.
49
+
50
+ ## Records
51
+
52
+ A record's identity is domain (including its host-only or domain scope), path,
53
+ name, and partition key. Merges keep the
54
+ newest change, ordered by change time and then source ID. Deletes are durable
55
+ tombstones. Partitioned cookies keep their partition; an adapter that cannot
56
+ represent partitions skips those cookies rather than flattening them.
57
+
58
+ ## Protected hosts
59
+
60
+ The jar never stores and sync never moves or removes cookies for `amalgm.ai`,
61
+ `supabase.co`, `supabase.io`, `supabase.in`, loopback hosts, or their
62
+ subdomains. A `BrowserCookieJar` built by hand may add more excluded hosts.
34
63
 
35
64
  ## Encryption and failure behavior
36
65
 
37
- The jar uses AES-256-GCM with an integrity tag, atomic replacement, private
38
- directories, and mode `0600`. The local key is stored separately but on the
39
- same device. This prevents accidental plaintext exposure; it does not defend
40
- against an attacker able to read both ciphertext and key.
66
+ Each row uses AES-256-GCM; HMAC identifiers hide cookie identities in the
67
+ index. The revision counter holds no cookie data and is stored plainly. SQLite
68
+ write-ahead-log transactions commit only touched rows, using a bounded page
69
+ cache and private `0700` directories / `0600` files. A committed change
70
+ survives an application crash (`synchronous=NORMAL`); Chrome itself writes
71
+ cookies to disk in batches. The previous encrypted whole-file jar is imported
72
+ transactionally on first open and then removed, so it is never a second writer.
73
+ The key (`browser.key`) sits beside the jar on the same device. This prevents accidental plaintext exposure; it does not
74
+ defend against an attacker who can read both the jar and the key.
41
75
 
42
- A missing or corrupt jar reports value-free health metadata and ordinary
43
- browsing continues with backend-local state. An incorrect key never causes
44
- cookie values to enter an error.
76
+ If the jar is corrupt or the key is wrong, the jar reports itself unhealthy,
77
+ sync stops, and browsing continues with whatever cookies Chrome already has.
78
+ Cookie values never enter an error message.
45
79
 
46
80
  ## Public versus trusted APIs
47
81
 
48
- Ordinary SDK, CLI, MCP, REST, events, and Toolbox projections return only
49
- sanitized metadata such as domains, names, expiry, partition presence, count,
50
- and version. Raw values are available only to trusted in-process adapters or
51
- the separately credentialed loopback internal REST transport.
52
-
53
- Named auth bundles are a separate explicit snapshot mechanism. They may carry
54
- filtered origin storage and do not become the automatic jar.
55
-
56
- ## Reconciliation lifecycle
57
-
58
- Register physical adapters with `browser.cookieAdapters`, then initialize the
59
- coordinator. The first available physical store may seed an absent logical jar
60
- exactly once. Thereafter the jar is authoritative. Subscribe to sanitized
61
- `cookie-jar.changed` events or version tokens rather than secret data.
82
+ `browser.cookies` is the jar. Its `inspect()` returns value-free metadata:
83
+ key, name, domain, path, expiry, partition presence, change time, and a
84
+ version token. Actions, MCP, REST, events, and Toolbox never return cookie
85
+ values. Raw values are available only in process or through the separately
86
+ credentialed internal REST routes (see [REST](./REST.md)). Subscribe to
87
+ `cookie-jar.changed` events for version changes.
88
+
89
+ `@amalgm/browser/cookies` exports the jar, the coordinator, the encrypted file
90
+ store, and the cookie policy helpers for hosts that build their own cookie
91
+ stores.
92
+
93
+ Named auth bundles are a separate, explicit snapshot (see
94
+ [authentication](./AUTHENTICATION.md)). They may carry origin storage and are
95
+ not the jar.
96
+
97
+ ## Performance contract
98
+
99
+ After connection, an idle adapter performs zero cookie reads or writes. A
100
+ sequence of N independent cookie changes performs zero full-store scans and
101
+ at most N durable mutations; encrypted work and delta payloads depend on the
102
+ changed records, not on the total jar size. Functional and performance evidence
103
+ are separate: native Chrome/Electron tests verify event delivery, while the
104
+ bounded load examination counts physical reads, encrypted rows, and writes.
@@ -1,93 +1,100 @@
1
1
  # Electron integration
2
2
 
3
- Electron is an optional peer dependency and appears only behind
4
- `@amalgm/browser/electron`. Headless consumers do not load it.
3
+ `@amalgm/browser/electron` is the desktop app's in-app browser: native tabs
4
+ the user browses in, with Browser's navigation policy, downloads, permissions,
5
+ context menus, and ad blocking. Agents do not drive these tabs; agent sessions
6
+ run in the runtime's Chrome (see [Chrome runtime](./CHROME.md)).
5
7
 
6
- The published Electron entry has both ESM and generated CommonJS conditions.
7
- Desktop builds may copy `electron.cjs` and `electron-preload.cjs` into their
8
- own generated output so Electron ships the native adapter without the full
9
- headless dependency graph. Both files are build products of Browser's
10
- TypeScript source and must never be edited or reimplemented by a host app.
8
+ Electron is an optional peer dependency and loads only through this entry
9
+ point. It has ESM and generated CommonJS conditions. Desktop builds may copy
10
+ `electron.cjs` and `electron-preload.cjs` into their own output. Both are
11
+ build products of Browser's TypeScript source; a host app must not edit or
12
+ reimplement them.
11
13
 
12
- ## Composition
14
+ ## What it exports
13
15
 
14
- The package contains both sides of the visible boundary:
16
+ - `createBrowserShell({ accountId, cookieStore?, isTrustedAppUrl, isDev, adBlockFetch? })`
17
+ installs the account's IPC handlers and returns asynchronous `dispose`.
18
+ - `createHttpCookieStore` and `readCookieAdapter` connect a trusted native host
19
+ to the runtime's separately credentialed cookie port.
20
+ - `BROWSER_IPC`, the IPC channel names, and the typed payloads for tabs,
21
+ context menus, permissions, downloads, ad blocking, and shortcuts.
15
22
 
16
- - `createBrowserShell` owns native page sites, policy, downloads, permissions,
17
- context menus, popup conversion, ad blocking, and safe teardown.
18
- - `createBrowserSurfaceController` owns automation surfaces, bounds,
19
- presentation, capture, focus, find, zoom, and surface state.
20
- - `ElectronBrowserDriver` presents those verified surfaces to the Browser SDK.
21
- - host advertisement helpers publish a private, atomic loopback CDP bridge.
23
+ The renderer supplies presentation and IPC wiring. It is not a browser-state
24
+ authority.
22
25
 
23
- The application renderer supplies presentation and IPC wiring; it is not a
24
- browser-state authority.
26
+ ## Partition
25
27
 
26
- ## Partition isolation
27
-
28
- Always obtain the physical Browser session with `getBrowserSession` or
29
- `isolatedBrowserSession`. Both require the exact partition:
28
+ Every account uses a separate persistent partition:
30
29
 
31
30
  ```text
32
- persist:amalgm-browser
31
+ persist:amalgm-browser-<sha256 of the Amalgm account ID>
33
32
  ```
34
33
 
35
- Do not pass Electron `defaultSession` to the shell or cookie adapter. The
36
- Browser partition owns its cookies, cache, storage, service workers,
37
- permissions, zoom, and request policy without touching application auth.
38
-
39
- ## Surface identity
40
-
41
- Protocol 6 uses native page targets; protocol 5 remains a rolling-compatibility
42
- reader for the prior webview bridge. A requested automation surface receives a
43
- neutral marker URL, surface ID, and session stamp. The driver binds this
44
- identity and verifies it before every action.
45
-
46
- It never selects a target by order, target count, active tab, or URL. Identical
47
- URLs in two sessions remain distinct. A destroyed target may be reattached
48
- once only to the same verified identity. Mismatch or ambiguity fails before
49
- input, capture, or recording.
50
-
51
- ## Native shell policy
52
-
53
- The shell provides:
54
-
55
- - safe `http`, `https`, and controlled external-protocol navigation
56
- - popup-to-tab and child-window disposition
57
- - page state, favicon, navigation, and load-failure events
58
- - back, forward, reload, focus, location, find, and zoom commands
34
+ Each tab runs sandboxed in that partition with context isolation and web
35
+ security on and Node integration off. Application authentication stays in
36
+ Electron's `defaultSession`, which Browser never uses.
37
+ The host retires the old account's views and adapter before activating another
38
+ account. Signing out disposes the shell; native cookies remain in that account's
39
+ partition for the next authenticated activation.
40
+
41
+ ## Native tabs
42
+
43
+ The shell hosts each tab as a native `WebContentsView` created through
44
+ `BROWSER_IPC.surfaceCreate`. The renderer places it over the tab's box with
45
+ `surfaceUpdate`, sending the box exactly as it measures it, in its own CSS
46
+ pixels. The shell scales the box by the renderer's zoom and puts each edge on
47
+ the nearest whole window point, the only positions a native view can take.
48
+ The view paints its own white page background, so the box under it paints
49
+ nothing. A hidden tab's view stays in its window, invisible. Only the
50
+ renderer that created a tab can update, command, capture, or destroy it, and
51
+ its tabs close when that renderer navigates away or is destroyed. Capture
52
+ returns the tab's current frame as a JPEG, or `null` when the tab paints no
53
+ frame within two seconds. The first frame after a move or resize takes a few
54
+ hundred milliseconds; the renderer decides how long to wait for it. Commands are
55
+ navigate, back, forward, reload, focus, find, stop-find, and zoom. The preload
56
+ reports `capabilities.version` 2 for this contract.
57
+
58
+ ## Shell policy
59
+
60
+ - navigation limited to `http`, `https`, and `about`, with `mailto:` and
61
+ `tel:` handed to the OS
62
+ - popups become tabs; real child windows stay windows
63
+ - page state, favicon, navigation, and load-failure updates
59
64
  - spellcheck-aware context menus
60
- - unique basename-only download destinations and lifecycle actions
61
- - requesting-frame permission origins with fail-closed defaults
62
- - browser-only shortcuts and renderer ownership checks
63
- - off-screen parking and fixed automation viewport behavior
64
-
65
- The host maps these typed contracts to its visible chrome; the renderer should
66
- not reproduce their policy.
67
-
68
- ## Cookies and ad blocking
69
-
70
- Construct `ElectronCookieAdapter` with the isolated partition's `Cookies`
71
- object. Its stable adapter ID is `electron:default-session` for historical jar
72
- compatibility; the object itself is never Electron `defaultSession`.
73
-
74
- `NativeAdBlocker` uses Ghostery-compatible filtering, a compiled cache,
75
- seven-day refresh, a last-good-cache fallback, cosmetic rules, scriptlets,
76
- mutation observation, and per-site settings. `AMALGM_BROWSER_ADBLOCK=0`
77
- disables it explicitly. Filtering is attached only to Browser contents, not the
78
- application renderer, API, or auth traffic.
79
-
80
- ## Host advertisement
81
-
82
- `writeHostAdvertisement` validates a loopback CDP URL, writes atomically with
83
- private permissions, and records PID/protocol/target types. The selector
84
- rejects stale, dead, remote, or incompatible advertisements. Call
85
- `removeHostAdvertisement` during owner teardown; it only removes an
86
- advertisement owned by the expected PID.
65
+ - basename-only download paths that never overwrite, plus download actions
66
+ - permission prompts keyed to the requesting frame's origin, failing closed
67
+ - browser shortcuts: focus location, new or close tab, find, reload, zoom
68
+
69
+ ## Ad blocking
70
+
71
+ `NativeAdBlocker` uses Ghostery-compatible filter lists, a compiled cache
72
+ under Electron's `userData/browser/adblock`, a seven-day refresh, a
73
+ last-good-cache fallback, cosmetic rules, scriptlets, and per-site settings.
74
+ `AMALGM_BROWSER_ADBLOCK=0` turns it off. It applies only to Browser tabs, not
75
+ to the application renderer, API, or auth traffic.
76
+
77
+ ## Cookies
78
+
79
+ When supplied a `cookieStore`, the shell registers `ElectronCookieAdapter` as
80
+ `electron:account`. Native cookie records and jar revision notifications
81
+ converge through the account's jar; disposal drains pending work. Shell publishes the Browser state root
82
+ in its private runtime discovery record and a separate private adapter token
83
+ in that root. The UI's Electron main process rediscovers the exact runtime and
84
+ account for each connection; cookies and credentials never enter renderer IPC.
85
+ The host passes `subscribeReady` to `createHttpCookieStore`, using its runtime
86
+ publication events to reopen the authenticated stream when the binding changes.
87
+ A stream that ends after delivering rejoins at once; a refused stream waits for
88
+ that event. There is no reconnect timer. Native edits can also attempt a disconnected port.
89
+ Offline native browsing retains its physical cookies; uncommitted edits remain
90
+ pending during the active account connection. Tombstones prevent stale partitions from undoing a sign-out.
87
91
 
88
92
  ## Verification
89
93
 
90
- `npm run test:electron` runs a real macOS Electron harness. It checks the exact
91
- partition, two simultaneous same-URL surfaces, action isolation, failure before
92
- identity mismatch, one remount, CSS-pixel capture, fixed off-screen viewport,
93
- and page-only WebM recording.
94
+ `electron-policy`, `electron-surface`, `electron-adblock`, and
95
+ `electron-cookies` tests cover URL, popup, permission, and download policy,
96
+ where a tab's page goes in a zoomed window, the ad-block cache and kill
97
+ switch, and the cookie adapter against an injected partition store.
98
+ The UI's source examination additionally drives actual Electron views and the
99
+ Shell/Browser runtime, proving bidirectional cookies, scope, deletion, account
100
+ switching, sign-out and fractional native bounds on the examined platform.
package/docs/EVENTS.md CHANGED
@@ -1,23 +1,19 @@
1
1
  # Events
2
2
 
3
3
  Browser emits version-1 state transitions through an injected
4
- `BrowserEventSink`. `BrowserEventBus` provides a bounded standalone history and
5
- subscription implementation; REST exposes it as SSE.
4
+ `BrowserEventSink`. `BrowserEventBus` provides a standalone implementation with
5
+ subscriptions and a history of the last 1,000 events; REST exposes it as SSE.
6
6
 
7
- Event families are:
7
+ The event types are:
8
8
 
9
9
  - `session.created`, `session.ready`, `session.closed`, `session.failed`
10
- - `surface.requested`, `surface.bound`, `surface.updated`, `surface.lost`
11
- - `page.navigated`, `page.failed`
12
- - `profile.updated`
10
+ - `page.navigated`
13
11
  - `recording.started`, `recording.stopped`
14
12
  - `login.updated`
15
13
  - `cookie-jar.changed`
16
- - `download.updated`
17
- - `permission.requested`
18
14
 
19
15
  Every event has a stable random ID, ISO timestamp, version, and only the
20
- resource identifiers/metadata required by that transition. Navigation uses a
16
+ resource identifiers and metadata that transition needs. Navigation uses a
21
17
  sanitized origin rather than a sensitive full URL. Error text is redacted and
22
18
  bounded. Cookie values, auth payloads, login tokens, storage contents, keys,
23
19
  authorization headers, and captured pixels are forbidden.
package/docs/MCP.md CHANGED
@@ -18,18 +18,22 @@ browser_auth_save browser_auth_load
18
18
  ```
19
19
 
20
20
  Schemas derive from the same action descriptor array used by CLI, REST, and
21
- Toolbox. The optional `session` field selects the persistent session; otherwise
22
- the adapter uses `default`.
21
+ Toolbox. The optional `session` field selects the session. Without it, a call
22
+ uses the caller's session: the `callerId` the host passes to
23
+ `handle(message, context)`, such as the calling chat (see
24
+ [Shell integration](./SHELL_INTEGRATION.md)). The stdio server passes no
25
+ caller, so it uses `default`. The session is created on first use.
23
26
 
24
27
  `notifications/cancelled` aborts the active SDK operation identified by the
25
28
  JSON-RPC request ID. Text results are bounded. Captures are emitted as MCP image
26
29
  content when the result is an image. Recording and resource results contain
27
30
  sanitized metadata.
28
31
 
29
- Raw cookie values, auth payloads, encryption keys, bearer headers, and stored
30
- login token hashes are not MCP tools or resource output. Login-link creation is
31
- the deliberate one-time credential-delivery operation; callers must treat its
32
- returned token-bearing URL as a secret.
32
+ Every result is sanitized: keys naming cookies, tokens, secrets, ciphertext,
33
+ authorization, or web storage are dropped, and `?token=` values in strings are
34
+ redacted. `browser_auth_link_create` therefore returns the login's metadata but
35
+ never a usable login token; a host delivers login links through the SDK or
36
+ REST (see [authentication](./AUTHENTICATION.md)).
33
37
 
34
38
  Toolbox uses a different compatibility namespace,
35
39
  `toolbox__browser_<action>`, documented in
package/docs/MIGRATION.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # Migration
2
2
 
3
- Browser preserves existing user state through path reuse plus a versioned
4
- legacy import. Migration is read-only with respect to the legacy Engine DB and
5
- is recorded as `engine-browser-v1` metadata in the new registry.
3
+ Browser keeps existing user state through a versioned, one-time import from
4
+ the legacy Engine database. The import only reads that database and records
5
+ itself as `engine-browser-v1` metadata in the new registry.
6
6
 
7
7
  ## Automatic path
8
8
 
9
- When `createBrowser()` uses its normal `$AMALGM_DIR/browser` root, it checks
10
- for `$AMALGM_DIR/amalgm.db`. An explicit root does not guess a database;
11
- provide `legacyDatabaseFile` to opt in, or `false` to disable import.
9
+ When `createBrowser()` is not given `root`, it looks for `amalgm.db` in the
10
+ directory above the resolved root (for example `$AMALGM_DIR/amalgm.db`). An
11
+ explicit root does not guess a database; pass `legacyDatabaseFile` to opt in,
12
+ or `false` to turn the import off.
12
13
 
13
14
  ```ts
14
15
  const browser = createBrowser({
@@ -17,48 +18,54 @@ const browser = createBrowser({
17
18
  });
18
19
  ```
19
20
 
20
- The importer opens the old DB read-only and imports inside one new-registry
21
- transaction:
21
+ The importer opens the old database read-only and imports inside one
22
+ new-registry transaction:
22
23
 
23
- - `browser_profiles` into durable/ephemeral profile metadata;
24
- - ordinary `browser_auth_bundles` after hash and AES-GCM verification;
25
- - the `browser-cookie-source` bundle into record-level cookies and tombstones;
26
- - `browser_login_sessions` plus stored token hashes.
24
+ - ordinary `browser_auth_bundles`, after hash and AES-GCM verification;
25
+ - the `browser-cookie-source` bundle, into the account's cookie jar as
26
+ records and tombstones;
27
+ - `browser_login_sessions`, with the token hashes of pending and active ones.
27
28
 
28
- The source database path is recorded only after successful completion. A
29
- second start reports `already-migrated` and makes no changes. A failure rolls
30
- back SQLite metadata and leaves the source untouched.
29
+ Legacy profiles are not imported. Everything imported belongs to the runtime's
30
+ account, so a user signed in before the upgrade stays signed in after it.
31
+
32
+ The legacy key comes from `AMALGM_BROWSER_AUTH_KEY` (64 hex characters) or
33
+ `auth-bundles/keys/local-device.key`. The source database path is recorded
34
+ only after success. A second start reports `already-migrated` and changes
35
+ nothing. A failure rolls back SQLite metadata and leaves the source untouched.
36
+
37
+ The registry also imports `registry-v1.json` once when present and never
38
+ deletes that file.
31
39
 
32
40
  ## State reused in place
33
41
 
34
- - Electron partition `persist:amalgm-browser`
35
- - `$AMALGM_DIR/browser` root and headless profile directories
36
- - existing project `.amalgm/recordings`
37
- - native Electron `userData/browser/adblock` cache and settings
38
- - bridge protocol 5 advertisement readers during rolling upgrade
39
- - legacy key from `AMALGM_BROWSER_AUTH_KEY` or
40
- `auth-bundles/keys/local-device.key`
42
+ - the `$AMALGM_DIR/browser` root
43
+ - project `.amalgm/recordings` directories
44
+ - the Electron ad-block cache and settings under `userData/browser/adblock`
41
45
 
42
- The new registry also imports `registry-v1.json` transactionally once when
43
- present. It never deletes that source file automatically.
46
+ Native browsing now selects `persist:amalgm-browser-<account hash>`. The old
47
+ unscoped `persist:amalgm-browser` partition is retained but is not adopted into
48
+ an account: it has no reliable account owner. Verified legacy cookies imported
49
+ into the runtime's account jar reach the new native partition through its
50
+ ordinary cookie adapter.
44
51
 
45
52
  ## Verification checklist
46
53
 
47
54
  1. Stop all legacy Browser writers.
48
- 2. Back up the Engine DB and Browser directory.
49
- 3. Run import against a copy first.
50
- 4. Compare profile, bundle, login, cookie-record, and tombstone counts.
51
- 5. Open a durable headless profile and the isolated Electron partition.
52
- 6. Load a named auth bundle and verify only its declared domains.
53
- 7. Confirm DB/key/encrypted files are private and the source is unchanged.
54
- 8. Re-run and confirm an idempotent no-op.
55
+ 2. Back up the Engine database and the Browser directory.
56
+ 3. Run the import against a copy first.
57
+ 4. Compare bundle, login, cookie-record, and tombstone counts.
58
+ 5. Browse a site the user was signed in to and confirm the sign-in carried
59
+ over.
60
+ 6. Load a named auth bundle and confirm only its declared domains load.
61
+ 7. Confirm the database, key, and encrypted files are private and the source
62
+ is unchanged.
63
+ 8. Start again and confirm the import is a no-op.
55
64
 
56
- Representative encrypted legacy fixtures exercise this sequence in the test
57
- suite.
65
+ Encrypted legacy fixtures exercise this sequence in the test suite.
58
66
 
59
67
  ## Non-destructive rollback
60
68
 
61
69
  Before cutover, discard the new Browser root and continue from the untouched
62
- legacy source. After cutover writes occur, restore the complete pre-cutover
63
- backup rather than mixing formats or replaying selected files. Never copy
64
- cookies into a different Electron partition merely to normalize names.
70
+ legacy source. After cutover writes, restore the complete pre-cutover backup
71
+ rather than mixing formats or replaying selected files.