synabun 2.3.1 → 2.4.1

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 (370) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +1 -1
  3. package/browser-extension/content.js +189 -0
  4. package/browser-extension/engine.js +508 -0
  5. package/browser-extension/icons/icon-128.png +0 -0
  6. package/browser-extension/icons/icon-16.png +0 -0
  7. package/browser-extension/icons/icon-32.png +0 -0
  8. package/browser-extension/icons/icon-48.png +0 -0
  9. package/browser-extension/icons/status-off-16.png +0 -0
  10. package/browser-extension/icons/status-off-32.png +0 -0
  11. package/browser-extension/icons/status-off-48.png +0 -0
  12. package/browser-extension/icons/status-on-16.png +0 -0
  13. package/browser-extension/icons/status-on-32.png +0 -0
  14. package/browser-extension/icons/status-on-48.png +0 -0
  15. package/browser-extension/manifest.json +56 -0
  16. package/browser-extension/popup-strings.js +250 -0
  17. package/browser-extension/popup-view.js +151 -0
  18. package/browser-extension/popup.css +166 -0
  19. package/browser-extension/popup.html +108 -0
  20. package/browser-extension/popup.js +359 -0
  21. package/browser-extension/protocol.js +232 -0
  22. package/browser-extension/service-worker.js +275 -0
  23. package/browser-extension/setup-content.js +36 -0
  24. package/browser-extension/tokens.css +326 -0
  25. package/docs/browser-extension-bridge.md +84 -0
  26. package/docs/whatsapp.md +1 -1
  27. package/lib/data-home-files.js +45 -0
  28. package/lib/data-home-migration.js +34 -58
  29. package/mcp-server/dist/http.d.ts +2 -0
  30. package/mcp-server/dist/http.d.ts.map +1 -1
  31. package/mcp-server/dist/http.js +9 -1
  32. package/mcp-server/dist/http.js.map +1 -1
  33. package/mcp-server/dist/index.d.ts +11 -0
  34. package/mcp-server/dist/index.d.ts.map +1 -1
  35. package/mcp-server/dist/index.js +38 -3
  36. package/mcp-server/dist/index.js.map +1 -1
  37. package/mcp-server/dist/services/browser-route-flow.d.ts +6 -2
  38. package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
  39. package/mcp-server/dist/services/browser-route-flow.js +10 -3
  40. package/mcp-server/dist/services/browser-route-flow.js.map +1 -1
  41. package/mcp-server/dist/services/codex-config-heal.d.ts.map +1 -1
  42. package/mcp-server/dist/services/codex-config-heal.js +7 -0
  43. package/mcp-server/dist/services/codex-config-heal.js.map +1 -1
  44. package/mcp-server/dist/services/neural-interface.d.ts +95 -3
  45. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  46. package/mcp-server/dist/services/neural-interface.js +168 -23
  47. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  48. package/mcp-server/dist/services/team-context.d.ts +18 -0
  49. package/mcp-server/dist/services/team-context.d.ts.map +1 -0
  50. package/mcp-server/dist/services/team-context.js +29 -0
  51. package/mcp-server/dist/services/team-context.js.map +1 -0
  52. package/mcp-server/dist/services/tool-catalog.d.ts +5 -2
  53. package/mcp-server/dist/services/tool-catalog.d.ts.map +1 -1
  54. package/mcp-server/dist/services/tool-catalog.js +22 -6
  55. package/mcp-server/dist/services/tool-catalog.js.map +1 -1
  56. package/mcp-server/dist/services/tool-list.d.ts.map +1 -1
  57. package/mcp-server/dist/services/tool-list.js +4 -0
  58. package/mcp-server/dist/services/tool-list.js.map +1 -1
  59. package/mcp-server/dist/services/tool-runtime.d.ts +8 -1
  60. package/mcp-server/dist/services/tool-runtime.d.ts.map +1 -1
  61. package/mcp-server/dist/services/tool-runtime.js +18 -1
  62. package/mcp-server/dist/services/tool-runtime.js.map +1 -1
  63. package/mcp-server/dist/tools/agent-definition.d.ts +133 -0
  64. package/mcp-server/dist/tools/agent-definition.d.ts.map +1 -0
  65. package/mcp-server/dist/tools/agent-definition.js +483 -0
  66. package/mcp-server/dist/tools/agent-definition.js.map +1 -0
  67. package/mcp-server/dist/tools/agents.d.ts +92 -9
  68. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  69. package/mcp-server/dist/tools/agents.js +163 -20
  70. package/mcp-server/dist/tools/agents.js.map +1 -1
  71. package/mcp-server/dist/tools/browser-advanced.d.ts +8 -1
  72. package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
  73. package/mcp-server/dist/tools/browser-advanced.js +70 -6
  74. package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
  75. package/mcp-server/dist/tools/git-tools.d.ts +4 -2
  76. package/mcp-server/dist/tools/git-tools.d.ts.map +1 -1
  77. package/mcp-server/dist/tools/git-tools.js +283 -2
  78. package/mcp-server/dist/tools/git-tools.js.map +1 -1
  79. package/mcp-server/dist/tools/morelogin.d.ts +8 -2
  80. package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
  81. package/mcp-server/dist/tools/morelogin.js +22 -5
  82. package/mcp-server/dist/tools/morelogin.js.map +1 -1
  83. package/mcp-server/dist/tools/team.d.ts +32 -0
  84. package/mcp-server/dist/tools/team.d.ts.map +1 -0
  85. package/mcp-server/dist/tools/team.js +87 -0
  86. package/mcp-server/dist/tools/team.js.map +1 -0
  87. package/mcp-server/package-lock.json +2 -2
  88. package/mcp-server/package.json +1 -1
  89. package/mcp-server/src/http.ts +9 -1
  90. package/mcp-server/src/index.ts +34 -4
  91. package/mcp-server/src/services/browser-route-flow.ts +12 -5
  92. package/mcp-server/src/services/codex-config-heal.ts +7 -0
  93. package/mcp-server/src/services/neural-interface.ts +191 -29
  94. package/mcp-server/src/services/team-context.ts +27 -0
  95. package/mcp-server/src/services/tool-catalog.ts +26 -8
  96. package/mcp-server/src/services/tool-list.ts +4 -0
  97. package/mcp-server/src/services/tool-runtime.ts +21 -2
  98. package/mcp-server/src/tools/agent-definition.ts +458 -0
  99. package/mcp-server/src/tools/agents.ts +177 -19
  100. package/mcp-server/src/tools/browser-advanced.ts +60 -6
  101. package/mcp-server/src/tools/git-tools.ts +249 -3
  102. package/mcp-server/src/tools/morelogin.ts +20 -5
  103. package/mcp-server/src/tools/team.ts +97 -0
  104. package/neural-interface/i18n/en.json +1119 -47
  105. package/neural-interface/i18n/pt-BR.json +1119 -47
  106. package/neural-interface/lib/account-usage.js +1 -1
  107. package/neural-interface/lib/agents/builtins.json +207 -0
  108. package/neural-interface/lib/agents/density.js +101 -0
  109. package/neural-interface/lib/agents/forge-host.js +223 -0
  110. package/neural-interface/lib/agents/native-export-targets.js +190 -0
  111. package/neural-interface/lib/agents/native-export.js +365 -0
  112. package/neural-interface/lib/agents/registry.js +885 -0
  113. package/neural-interface/lib/agents/resolve.js +603 -0
  114. package/neural-interface/lib/agents/schema.js +642 -0
  115. package/neural-interface/lib/agents/split.js +37 -0
  116. package/neural-interface/lib/agents-studio-api.js +591 -0
  117. package/neural-interface/lib/assistant-api.js +76 -7
  118. package/neural-interface/lib/assistant-brains/opencode.js +60 -11
  119. package/neural-interface/lib/assistant-catalog.js +2 -0
  120. package/neural-interface/lib/assistant-continuity.js +49 -0
  121. package/neural-interface/lib/assistant-dispatch.js +351 -121
  122. package/neural-interface/lib/assistant-persona.js +105 -8
  123. package/neural-interface/lib/assistant-route-gate.js +24 -9
  124. package/neural-interface/lib/assistant-router.js +432 -47
  125. package/neural-interface/lib/assistant-run-tail.js +151 -0
  126. package/neural-interface/lib/assistant-run-wait.js +183 -0
  127. package/neural-interface/lib/assistant-runtime.js +449 -94
  128. package/neural-interface/lib/assistant-task-prompt.js +11 -2
  129. package/neural-interface/lib/assistant-usage.js +3 -2
  130. package/neural-interface/lib/automation-approval.js +2 -2
  131. package/neural-interface/lib/backup-service.js +64 -105
  132. package/neural-interface/lib/browser-close-evidence.js +80 -0
  133. package/neural-interface/lib/browser-default.js +210 -0
  134. package/neural-interface/lib/browser-extension-adapter.js +264 -0
  135. package/neural-interface/lib/browser-extension-bridge.js +441 -0
  136. package/neural-interface/lib/browser-extension-folder.js +116 -0
  137. package/neural-interface/lib/browser-extension-setup.js +140 -0
  138. package/neural-interface/lib/browser-profile-choices.js +3 -3
  139. package/neural-interface/lib/browser-tool-policy.js +1 -1
  140. package/neural-interface/lib/claude-account-links.js +301 -0
  141. package/neural-interface/lib/claude-accounts.js +45 -20
  142. package/neural-interface/lib/claude-agent-bridge.js +142 -10
  143. package/neural-interface/lib/claude-model-catalog.js +6 -0
  144. package/neural-interface/lib/claude-panel-session.js +33 -0
  145. package/neural-interface/lib/codex-accounts.js +67 -24
  146. package/neural-interface/lib/coordination/README.md +384 -0
  147. package/neural-interface/lib/coordination/service.js +563 -0
  148. package/neural-interface/lib/coordination/store.js +1138 -0
  149. package/neural-interface/lib/db.js +22 -1
  150. package/neural-interface/lib/effort-levels.js +10 -1
  151. package/neural-interface/lib/memory-list-page.js +49 -0
  152. package/neural-interface/lib/memory-list-stamp.js +60 -0
  153. package/neural-interface/lib/morelogin-outside-close.js +186 -0
  154. package/neural-interface/lib/morelogin-profile-failures.js +206 -0
  155. package/neural-interface/lib/morelogin-start-cooldown.js +160 -0
  156. package/neural-interface/lib/morelogin.js +194 -8
  157. package/neural-interface/lib/native-loop-runtime.js +26 -7
  158. package/neural-interface/lib/opencode-build-preflight.js +28 -8
  159. package/neural-interface/lib/opencode-native-boundary.js +83 -13
  160. package/neural-interface/lib/opencode-serve-records.js +14 -9
  161. package/neural-interface/lib/page-session.js +1 -1
  162. package/neural-interface/lib/peer-identity.js +73 -29
  163. package/neural-interface/lib/process-identity.js +68 -7
  164. package/neural-interface/lib/request-gate.js +3 -0
  165. package/neural-interface/lib/screenshot-location.js +33 -0
  166. package/neural-interface/lib/session-cache-builder.js +41 -3
  167. package/neural-interface/lib/skills/creation.js +1 -1
  168. package/neural-interface/lib/skills/known-bridge-digests.json +40 -0
  169. package/neural-interface/lib/studio-attention.js +56 -0
  170. package/neural-interface/lib/teams/README.md +382 -0
  171. package/neural-interface/lib/teams/api.js +287 -0
  172. package/neural-interface/lib/teams/brief.js +185 -0
  173. package/neural-interface/lib/teams/claims.js +315 -0
  174. package/neural-interface/lib/teams/git.js +293 -0
  175. package/neural-interface/lib/teams/index.js +122 -0
  176. package/neural-interface/lib/teams/integration.js +580 -0
  177. package/neural-interface/lib/teams/landing.js +184 -0
  178. package/neural-interface/lib/teams/recovery.js +256 -0
  179. package/neural-interface/lib/teams/scheduler.js +1474 -0
  180. package/neural-interface/lib/teams/schema.js +559 -0
  181. package/neural-interface/lib/teams/state.js +181 -0
  182. package/neural-interface/lib/teams/test-runner.js +86 -0
  183. package/neural-interface/lib/teams/test-sandbox.js +99 -0
  184. package/neural-interface/lib/teams/worktrees.js +757 -0
  185. package/neural-interface/lib/tool-permission-choices.js +226 -0
  186. package/neural-interface/lib/whatsapp/cards.js +24 -10
  187. package/neural-interface/lib/worker-confinement.js +206 -6
  188. package/neural-interface/package-lock.json +2 -2
  189. package/neural-interface/package.json +1 -1
  190. package/neural-interface/public/extension-setup.html +107 -0
  191. package/neural-interface/public/index.html +103 -12
  192. package/neural-interface/public/offline.html +4 -3
  193. package/neural-interface/public/shared/agent-runtime-options.js +3 -1
  194. package/neural-interface/public/shared/agents/studio/ax-agent-view.js +614 -0
  195. package/neural-interface/public/shared/agents/studio/ax-api.js +198 -0
  196. package/neural-interface/public/shared/agents/studio/ax-create-view.js +221 -0
  197. package/neural-interface/public/shared/agents/studio/ax-diff.js +143 -0
  198. package/neural-interface/public/shared/agents/studio/ax-editor-view.js +392 -0
  199. package/neural-interface/public/shared/agents/studio/ax-export-view.js +94 -0
  200. package/neural-interface/public/shared/agents/studio/ax-form.js +191 -0
  201. package/neural-interface/public/shared/agents/studio/ax-icons.js +87 -0
  202. package/neural-interface/public/shared/agents/studio/ax-library-view.js +158 -0
  203. package/neural-interface/public/shared/agents/studio/ax-library.js +162 -0
  204. package/neural-interface/public/shared/agents/studio/ax-main.js +712 -0
  205. package/neural-interface/public/shared/agents/studio/ax-native-export.js +35 -0
  206. package/neural-interface/public/shared/agents/studio/ax-options.js +198 -0
  207. package/neural-interface/public/shared/agents/studio/ax-review-view.js +175 -0
  208. package/neural-interface/public/shared/agents/studio/ax-revisions-view.js +189 -0
  209. package/neural-interface/public/shared/agents/studio/ax-runs-view.js +202 -0
  210. package/neural-interface/public/shared/agents/studio/ax-runs.js +82 -0
  211. package/neural-interface/public/shared/agents/studio/ax-teams-view.js +256 -0
  212. package/neural-interface/public/shared/agents/studio/ax-teams.js +200 -0
  213. package/neural-interface/public/shared/agents/studio/ax-templates.js +50 -0
  214. package/neural-interface/public/shared/agents/studio/ax-ui.js +194 -0
  215. package/neural-interface/public/shared/agents/studio/ax-views.js +170 -0
  216. package/neural-interface/public/shared/agy/agy-panel.js +142 -28
  217. package/neural-interface/public/shared/agy/agy-styles.js +25 -5
  218. package/neural-interface/public/shared/api.js +2 -1
  219. package/neural-interface/public/shared/assistant/asst-account-menu.js +13 -13
  220. package/neural-interface/public/shared/assistant/asst-ask-styles.js +2 -3
  221. package/neural-interface/public/shared/assistant/asst-brain-picker.js +91 -9
  222. package/neural-interface/public/shared/assistant/asst-control.js +3 -0
  223. package/neural-interface/public/shared/assistant/asst-interaction-hold.js +99 -0
  224. package/neural-interface/public/shared/assistant/asst-limit-dismissals.js +111 -0
  225. package/neural-interface/public/shared/assistant/asst-limit-dock.js +37 -3
  226. package/neural-interface/public/shared/assistant/asst-limit-wait.js +30 -7
  227. package/neural-interface/public/shared/assistant/asst-panel.js +177 -30
  228. package/neural-interface/public/shared/assistant/asst-rack-styles.js +15 -8
  229. package/neural-interface/public/shared/assistant/asst-render.js +37 -6
  230. package/neural-interface/public/shared/assistant/asst-route.js +80 -12
  231. package/neural-interface/public/shared/assistant/asst-routes-editor.js +148 -70
  232. package/neural-interface/public/shared/assistant/asst-roving.js +17 -1
  233. package/neural-interface/public/shared/assistant/asst-scene-styles.js +7 -2
  234. package/neural-interface/public/shared/assistant/asst-scenes.js +12 -1
  235. package/neural-interface/public/shared/assistant/asst-sidepanel.js +12 -2
  236. package/neural-interface/public/shared/assistant/asst-state.js +66 -1
  237. package/neural-interface/public/shared/assistant/asst-styles.js +98 -44
  238. package/neural-interface/public/shared/assistant/route-identity.js +16 -0
  239. package/neural-interface/public/shared/cc-dropdown.js +21 -15
  240. package/neural-interface/public/shared/cdx/cdx-output.js +10 -0
  241. package/neural-interface/public/shared/cdx/cdx-panel.js +18 -16
  242. package/neural-interface/public/shared/cdx/cdx-plan.js +3 -2
  243. package/neural-interface/public/shared/cdx/cdx-render.js +122 -45
  244. package/neural-interface/public/shared/cdx/cdx-requests.js +4 -4
  245. package/neural-interface/public/shared/cdx/cdx-styles.js +8 -36
  246. package/neural-interface/public/shared/cdx/cdx-tabs.js +110 -42
  247. package/neural-interface/public/shared/claude-panel-lazy.js +12 -0
  248. package/neural-interface/public/shared/code-copy.js +120 -0
  249. package/neural-interface/public/shared/constants.js +7 -0
  250. package/neural-interface/public/shared/context-menu-model.js +1 -0
  251. package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
  252. package/neural-interface/public/shared/cp/cp-session-model.js +86 -5
  253. package/neural-interface/public/shared/cp/cp-session-settings.js +58 -30
  254. package/neural-interface/public/shared/cp/cp-styles.js +9 -0
  255. package/neural-interface/public/shared/dom-change-flag.js +66 -0
  256. package/neural-interface/public/shared/dom-morph.js +124 -0
  257. package/neural-interface/public/shared/extension-setup/es-page.css +134 -0
  258. package/neural-interface/public/shared/extension-setup/es-page.js +120 -0
  259. package/neural-interface/public/shared/extension-setup/es-view.js +100 -0
  260. package/neural-interface/public/shared/html-shell.js +34 -4
  261. package/neural-interface/public/shared/i18n.js +14 -1
  262. package/neural-interface/public/shared/idle-queue.js +78 -0
  263. package/neural-interface/public/shared/iface-config.js +227 -0
  264. package/neural-interface/public/shared/lazy-module.js +108 -0
  265. package/neural-interface/public/shared/memory-list.js +117 -0
  266. package/neural-interface/public/shared/morelogin-profile-choices.js +1 -1
  267. package/neural-interface/public/shared/morelogin-profile-field.js +3 -3
  268. package/neural-interface/public/shared/mtc/mtc-panel.js +3 -1
  269. package/neural-interface/public/shared/mtc/mtc-styles.js +4 -1
  270. package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +35 -15
  271. package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +77 -23
  272. package/neural-interface/public/shared/ocp-v2/ocp-v2-projectbar.js +3 -6
  273. package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +24 -21
  274. package/neural-interface/public/shared/ocp-v2/ocp-v2-send-logic.js +16 -5
  275. package/neural-interface/public/shared/ocp-v2/ocp-v2-sessions-logic.js +16 -2
  276. package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +27 -43
  277. package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +73 -9
  278. package/neural-interface/public/shared/owner-authority-view.js +4 -10
  279. package/neural-interface/public/shared/page-session.js +1 -1
  280. package/neural-interface/public/shared/schedules-view.js +2 -2
  281. package/neural-interface/public/shared/session-project-items.js +11 -0
  282. package/neural-interface/public/shared/settings/settings-ai-browser.js +119 -0
  283. package/neural-interface/public/shared/settings/settings-browser-extension.js +446 -0
  284. package/neural-interface/public/shared/settings/settings-ia.js +4 -2
  285. package/neural-interface/public/shared/settings/settings-morelogin-cooldown.js +63 -0
  286. package/neural-interface/public/shared/settings/settings-tool-permissions.js +70 -0
  287. package/neural-interface/public/shared/sidepanel-lazy.js +40 -0
  288. package/neural-interface/public/shared/sidepanel-session-status.js +8 -14
  289. package/neural-interface/public/shared/sidepanel-shown.js +73 -0
  290. package/neural-interface/public/shared/start-bridge.js +2 -2
  291. package/neural-interface/public/shared/storage.js +6 -1
  292. package/neural-interface/public/shared/studio-attention.js +83 -0
  293. package/neural-interface/public/shared/styles.css +694 -50
  294. package/neural-interface/public/shared/term-browser-tabs.js +34 -0
  295. package/neural-interface/public/shared/transcript-rows.js +334 -0
  296. package/neural-interface/public/shared/tray-auto-close.js +106 -0
  297. package/neural-interface/public/shared/ui-agents.js +97 -0
  298. package/neural-interface/public/shared/ui-antigravity-panel.js +16 -14
  299. package/neural-interface/public/shared/ui-automation-studio.js +3 -3
  300. package/neural-interface/public/shared/ui-claude-panel.js +162 -95
  301. package/neural-interface/public/shared/ui-code-copy.js +256 -0
  302. package/neural-interface/public/shared/ui-codex-panel.js +14 -10
  303. package/neural-interface/public/shared/ui-context-menu.js +1 -1
  304. package/neural-interface/public/shared/ui-file-explorer.js +2 -3
  305. package/neural-interface/public/shared/ui-games.js +1 -1
  306. package/neural-interface/public/shared/ui-loading.js +83 -19
  307. package/neural-interface/public/shared/ui-maritaca-panel.js +12 -11
  308. package/neural-interface/public/shared/ui-menubar.js +23 -0
  309. package/neural-interface/public/shared/ui-native-loop-router.js +50 -21
  310. package/neural-interface/public/shared/ui-navbar.js +15 -9
  311. package/neural-interface/public/shared/ui-opencode-panel-v2.js +13 -11
  312. package/neural-interface/public/shared/ui-owner-authority.js +48 -25
  313. package/neural-interface/public/shared/ui-schedules-studio.js +3 -3
  314. package/neural-interface/public/shared/ui-scroll-follow.js +39 -0
  315. package/neural-interface/public/shared/ui-sessions.js +3 -3
  316. package/neural-interface/public/shared/ui-settings-entry.js +55 -0
  317. package/neural-interface/public/shared/ui-settings.js +363 -400
  318. package/neural-interface/public/shared/ui-sidepanel-layout.js +44 -25
  319. package/neural-interface/public/shared/ui-sidepanel-session-entry.js +22 -9
  320. package/neural-interface/public/shared/ui-sidepanel-sessions.js +10 -2
  321. package/neural-interface/public/shared/ui-sidepanel-tray.js +36 -41
  322. package/neural-interface/public/shared/ui-sidepanel-windows.js +14 -1
  323. package/neural-interface/public/shared/ui-styleguide.js +10 -2
  324. package/neural-interface/public/shared/ui-sync.js +6 -0
  325. package/neural-interface/public/shared/ui-terminal.js +13 -9
  326. package/neural-interface/public/shared/ui-tooltip.js +28 -7
  327. package/neural-interface/public/shared/ui-topright-overflow.js +26 -4
  328. package/neural-interface/public/shared/ui-tray-columns.js +375 -0
  329. package/neural-interface/public/shared/ui-whiteboard.js +51 -6
  330. package/neural-interface/public/shared/ui-worker-end.js +28 -1
  331. package/neural-interface/public/shared/ui-workspaces.js +13 -0
  332. package/neural-interface/public/shared/window-keys.js +71 -0
  333. package/neural-interface/public/sw.js +4 -3
  334. package/neural-interface/public/variant/2d/main.js +2 -0
  335. package/neural-interface/public/variant/3d/app.js +620 -0
  336. package/neural-interface/public/variant/3d/boot-reveal.js +47 -0
  337. package/neural-interface/public/variant/3d/main.js +30 -544
  338. package/neural-interface/public/variant/3d/map-controls.js +4 -2
  339. package/neural-interface/public/vendor/fonts/fonts.css +508 -0
  340. package/neural-interface/public/vendor/fonts/inter-OFL.txt +93 -0
  341. package/neural-interface/public/vendor/fonts/inter-cyrillic-ext.woff2 +0 -0
  342. package/neural-interface/public/vendor/fonts/inter-cyrillic.woff2 +0 -0
  343. package/neural-interface/public/vendor/fonts/inter-greek-ext.woff2 +0 -0
  344. package/neural-interface/public/vendor/fonts/inter-greek.woff2 +0 -0
  345. package/neural-interface/public/vendor/fonts/inter-latin-ext.woff2 +0 -0
  346. package/neural-interface/public/vendor/fonts/inter-latin.woff2 +0 -0
  347. package/neural-interface/public/vendor/fonts/inter-vietnamese.woff2 +0 -0
  348. package/neural-interface/public/vendor/fonts/jetbrains-mono-OFL.txt +93 -0
  349. package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
  350. package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
  351. package/neural-interface/public/vendor/fonts/jetbrains-mono-greek.woff2 +0 -0
  352. package/neural-interface/public/vendor/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
  353. package/neural-interface/public/vendor/fonts/jetbrains-mono-latin.woff2 +0 -0
  354. package/neural-interface/public/vendor/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
  355. package/neural-interface/public/vendor/fonts/manifest.json +142 -0
  356. package/neural-interface/public/vendor/fonts/space-grotesk-OFL.txt +93 -0
  357. package/neural-interface/public/vendor/fonts/space-grotesk-latin-ext.woff2 +0 -0
  358. package/neural-interface/public/vendor/fonts/space-grotesk-latin.woff2 +0 -0
  359. package/neural-interface/public/vendor/fonts/space-grotesk-vietnamese.woff2 +0 -0
  360. package/neural-interface/scripts/boot-graph.mjs +270 -0
  361. package/neural-interface/scripts/vendor-fonts.mjs +124 -0
  362. package/neural-interface/server.js +1083 -164
  363. package/npm-shrinkwrap.json +2 -2
  364. package/package.json +4 -1
  365. package/skills/agent-forge/SKILL.md +182 -0
  366. package/skills/agent-forge/evals/evals.json +56 -0
  367. package/skills/agent-forge/references/definition-fields.md +61 -0
  368. package/skills/agent-forge/references/examples.md +105 -0
  369. package/skills/agent-forge/references/instructions.md +51 -0
  370. package/skills/agent-forge/references/review-and-export.md +84 -0
@@ -218,13 +218,89 @@ export function changedStartSettings(before, after) {
218
218
  return [...new Set(Object.entries(START_KEYS).filter(([k]) => JSON.stringify(a[k]) !== JSON.stringify(b[k])).map(([, label]) => label))];
219
219
  }
220
220
 
221
+ // ── Thinking that cannot be turned off ──
222
+ // Claude Code says per model whether it can run with thinking off (ModelInfo
223
+ // `supportsThinkingOff`; the Assistant catalog's `thinkingOff`). false: the
224
+ // model rejects disabled thinking and the CLI sends adaptive thinking instead
225
+ // (Opus 5.5 on Claude Code 2.1.326), so an Off the panel showed would be a
226
+ // claim nothing on the wire honours. Missing (an older CLI): nothing changes.
227
+ // The same reading as agent-runtime-options.js modelSupportsEffortOff and
228
+ // lib/effort-levels.js thinkingAlwaysOn.
229
+ export const THINKING_ALWAYS_ON_NOTE = "thinking can't be turned off on this model";
230
+
231
+ /** Did the CLI say this model always thinks? Only an explicit false counts. */
232
+ export function thinkingAlwaysOn(model) {
233
+ return !!model && typeof model === 'object' && (model.supportsThinkingOff === false || model.thinkingOff === false);
234
+ }
235
+
236
+ const THINK_TITLES = {
237
+ off: 'Thinking off',
238
+ low: 'Thinking: low',
239
+ medium: 'Thinking: medium',
240
+ high: 'Thinking: high',
241
+ xhigh: 'Thinking: extra high',
242
+ max: 'Thinking: max',
243
+ };
244
+
245
+ /**
246
+ * What the Think toggle shows at a level, for the model in use. The toggle's
247
+ * first stop (`off`) is Off, except on a model that always thinks, where it
248
+ * is the model's default and says why: never "Thinking off" there.
249
+ * → { label, title, corrected } (corrected: the stop is not what it was picked as).
250
+ */
251
+ export function thinkToggleView(level, model) {
252
+ const id = THINK_TITLES[level] ? level : 'off';
253
+ if (id === 'off' && thinkingAlwaysOn(model)) {
254
+ return { label: 'Think', title: `Thinking: model default · ${THINKING_ALWAYS_ON_NOTE}`, corrected: true };
255
+ }
256
+ return { label: id === 'off' ? 'Think' : ({ low: 'lo', medium: 'med', high: 'hi', xhigh: 'xhi', max: 'max' })[id], title: THINK_TITLES[id], corrected: false };
257
+ }
258
+
259
+ /**
260
+ * The effort a query carries for the Think toggle's level: a level as is; Off
261
+ * as 'off' (thinking disabled, over the user's settings' effortLevel) only
262
+ * when the bridge reads it (`effortOff`) and the model has thinking it can turn
263
+ * off; otherwise nothing, the model's default. → string | undefined.
264
+ */
265
+ export function thinkWireEffort(level, model, { effortOff = false, modelHasEffort = true } = {}) {
266
+ const id = String(level || 'off');
267
+ if (id !== 'off') return id;
268
+ if (!effortOff || !modelHasEffort || thinkingAlwaysOn(model)) return undefined;
269
+ return 'off';
270
+ }
271
+
272
+ /** The session's Thinking setting as it runs on this model: 'off' becomes 'default' where it cannot be off. */
273
+ export function effectiveSessionThinking(session, model) {
274
+ const s = normalizeSession(session);
275
+ return s.thinking === 'off' && thinkingAlwaysOn(model) ? 'default' : s.thinking;
276
+ }
277
+
278
+ /**
279
+ * What a query says about the tab's session and thinking, for the model in use.
280
+ * With a bridge that reads the thinking that runs (`effective`: capability
281
+ * 'thinking_effective'), a saved Off goes only to a model that can turn
282
+ * thinking off: a model that always thinks gets the default and
283
+ * `thinkingAlwaysOn: true`, so the bridge neither sends Off nor counts the
284
+ * dropped value as a change (it compares with how its process was started).
285
+ * The tab keeps its Off. A model the CLI said nothing about (an older CLI),
286
+ * or an older bridge, gets the settings as saved, as before.
287
+ * → { session, thinkingAlwaysOn } (thinkingAlwaysOn: true or undefined).
288
+ */
289
+ export function sessionWireSettings(session, model, { effective = false } = {}) {
290
+ const s = normalizeSession(session);
291
+ if (!effective) return { session: s, thinkingAlwaysOn: undefined };
292
+ const alwaysOn = thinkingAlwaysOn(model);
293
+ return { session: alwaysOn && s.thinking === 'off' ? { ...s, thinking: 'default' } : s, thinkingAlwaysOn: alwaysOn ? true : undefined };
294
+ }
295
+
221
296
  /** Short words for the statusline: what is switched on for this tab. */
222
- export function sessionFlags(session, { toolPolicy = 'full', fastModeState = '', account = '' } = {}) {
297
+ export function sessionFlags(session, { toolPolicy = 'full', fastModeState = '', account = '', thinkingAlwaysOn: alwaysOn = false } = {}) {
223
298
  const s = normalizeSession(session);
224
299
  const flags = [];
225
300
  if (account && account !== 'default') flags.push(`account ${account}`);
226
301
  if (s.fastMode) flags.push(fastModeState === 'cooldown' ? 'fast (cooldown)' : 'fast');
227
- if (s.thinking === 'off') flags.push('no thinking');
302
+ // (Off on a model that always thinks is not claimed: it runs with adaptive thinking.)
303
+ if (s.thinking === 'off' && !alwaysOn) flags.push('no thinking');
228
304
  if (s.sandbox.enabled) flags.push('sandbox');
229
305
  if (toolPolicy && toolPolicy !== 'full') flags.push(toolPolicy);
230
306
  if (s.strictMcp) flags.push('SynaBun MCP only');
@@ -234,11 +310,11 @@ export function sessionFlags(session, { toolPolicy = 'full', fastModeState = '',
234
310
  }
235
311
 
236
312
  /** Rows for /status and for the note after a change: [label, value]. */
237
- export function sessionRows(session) {
313
+ export function sessionRows(session, { thinkingAlwaysOn: alwaysOn = false } = {}) {
238
314
  const s = normalizeSession(session);
239
315
  const rows = [];
240
316
  if (s.fastMode) rows.push(['Fast mode', 'on']);
241
- if (s.thinking === 'off') rows.push(['Thinking', 'off']);
317
+ if (s.thinking === 'off') rows.push(['Thinking', alwaysOn ? `model default (${THINKING_ALWAYS_ON_NOTE})` : 'off']);
242
318
  if (s.outputStyle) rows.push(['Output style', s.outputStyle]);
243
319
  if (s.agent) rows.push(['Agent', s.agent]);
244
320
  if (s.fallbackModel) rows.push(['Fallback model', s.fallbackModel]);
@@ -297,7 +373,11 @@ export function mergeSessionModels(catalog, sessionModels) {
297
373
  supportsFastMode: live.supportsFastMode === true,
298
374
  supportsAdaptiveThinking: live.supportsAdaptiveThinking === true,
299
375
  };
300
- if (Object.entries(flags).every(([k, v]) => (row[k] === true) === v)) return row;
376
+ // Whether thinking can be off: only what the session said (true / false) replaces the catalog's.
377
+ const thinkingOff = typeof live.supportsThinkingOff === 'boolean' ? live.supportsThinkingOff : null;
378
+ if (Object.entries(flags).every(([k, v]) => (row[k] === true) === v)
379
+ && (thinkingOff === null || row.supportsThinkingOff === thinkingOff)) return row;
380
+ if (thinkingOff !== null) flags.supportsThinkingOff = thinkingOff;
301
381
  changed = true;
302
382
  return { ...row, ...flags };
303
383
  });
@@ -318,6 +398,7 @@ export function mergeSessionModels(catalog, sessionModels) {
318
398
  supportsFastMode: m.supportsFastMode === true,
319
399
  supportsAutoMode: m.supportsAutoMode === true,
320
400
  supportsAdaptiveThinking: m.supportsAdaptiveThinking === true,
401
+ supportsThinkingOff: typeof m.supportsThinkingOff === 'boolean' ? m.supportsThinkingOff : null,
321
402
  cliReady: true,
322
403
  fromSession: true,
323
404
  });
@@ -4,10 +4,13 @@
4
4
  // fields of the same object.
5
5
 
6
6
  import { cpCtx } from './cp-ctx.js';
7
- import { normalizeSession, parseList, parseMcpServerLines, formatMcpServerLines, parseAgentsJson, formatAgentsJson } from './cp-session-model.js';
7
+ import { dropdownHTML, wireDropdowns, closeDropdowns } from '../cc-dropdown.js';
8
+ import { normalizeSession, parseList, parseMcpServerLines, formatMcpServerLines, parseAgentsJson, formatAgentsJson, THINKING_ALWAYS_ON_NOTE } from './cp-session-model.js';
8
9
 
9
10
  function field(labelText, control, hint = '') {
10
- const row = document.createElement('label');
11
+ // A dropdown's row is not a <label>: a click inside a label is sent on to its first button, which would
12
+ // open the menu again right after a choice closed it. The dropdown is named by its own aria-label.
13
+ const row = document.createElement(control.classList?.contains('cp-session-dropdown') ? 'div' : 'label');
11
14
  row.className = 'cp-elicit-field cp-session-field';
12
15
  const label = document.createElement('span');
13
16
  label.className = 'cp-elicit-label';
@@ -22,24 +25,33 @@ function field(labelText, control, hint = '') {
22
25
  return row;
23
26
  }
24
27
 
25
- function select(options, value) {
26
- const el = document.createElement('select');
27
- el.className = 'cp-elicit-input';
28
- for (const [v, label] of options) {
29
- const opt = document.createElement('option');
30
- opt.value = v;
31
- opt.textContent = label;
32
- el.appendChild(opt);
33
- }
34
- // A stored value the session does not list (yet) stays selectable.
35
- if (value && !options.some(([v]) => v === value)) {
36
- const opt = document.createElement('option');
37
- opt.value = value;
38
- opt.textContent = value;
39
- el.appendChild(opt);
40
- }
41
- el.value = value || '';
42
- return el;
28
+ /**
29
+ * The entries of a choice field (cc-dropdown.js): `options` as [value, label] pairs, `value` chosen. A stored
30
+ * value the session does not list (yet) stays selectable, last. `disabled` maps a value to the note it shows:
31
+ * the option stays listed, cannot be chosen, and carries the note as its sub-line and tooltip.
32
+ */
33
+ export function choiceEntries(options, value, disabled = {}) {
34
+ const chosen = value || '';
35
+ const entries = options.map(([v, label]) => ({
36
+ value: v,
37
+ label,
38
+ selected: v === chosen,
39
+ ...(Object.hasOwn(disabled, v) ? { disabled: true, caption: disabled[v] } : {}),
40
+ }));
41
+ if (value && !options.some(([v]) => v === value)) entries.push({ value, label: value, selected: true });
42
+ return entries;
43
+ }
44
+
45
+ let dropdownSeq = 0;
46
+
47
+ // A choice field is the app's dropdown (a native <select> is not allowed: tests/no-native-select.test.mjs).
48
+ // To the card it reads like the <select> it replaced: `.value` is the hidden input's, which a choice sets.
49
+ function choice(name, options, value, disabled) {
50
+ const wrap = document.createElement('div');
51
+ wrap.className = 'cp-session-dropdown';
52
+ wrap.innerHTML = dropdownHTML(`cp-session-${++dropdownSeq}`, choiceEntries(options, value, disabled), { label: name });
53
+ Object.defineProperty(wrap, 'value', { get: () => wrap.querySelector('input[type="hidden"]')?.value ?? '' });
54
+ return wrap;
43
55
  }
44
56
 
45
57
  function input(type, value, placeholder = '') {
@@ -73,13 +85,14 @@ function area(value, placeholder, rows = 2) {
73
85
  * @param o.agents [{name, description}]
74
86
  * @param o.outputStyles string[]
75
87
  * @param o.fastSupported whether the model in use supports fast mode
88
+ * @param o.thinkingAlwaysOn the model in use cannot run with thinking off (its CLI said so): Off is not offered
76
89
  * @param o.advanced the bridge reads the advanced fields (tools, MCP servers, agents, skills, overlay, debug)
77
90
  * @param o.onSave (session) => void
78
91
  */
79
92
  export function renderSessionSettingsCard(tab, o = {}) {
80
93
  const $msgs = tab.messagesEl;
81
94
  if (!$msgs) return null;
82
- $msgs.querySelectorAll('.cp-session-card.active-perm').forEach(n => n.remove());
95
+ $msgs.querySelectorAll('.cp-session-card.active-perm').forEach(n => { n._cpDropdowns?.abort(); n.remove(); });
83
96
  const s = normalizeSession(o.session);
84
97
 
85
98
  const el = document.createElement('div');
@@ -95,15 +108,21 @@ export function renderSessionSettingsCard(tab, o = {}) {
95
108
 
96
109
  const fast = checkbox(s.fastMode);
97
110
  fast.disabled = !o.fastSupported && !s.fastMode;
98
- const thinking = select([['default', 'Model default'], ['off', 'Off']], s.thinking);
111
+ // A model that always thinks (cp-session-model.js thinkingAlwaysOn) offers no Off, and a saved Off shows as
112
+ // what runs: the model default.
113
+ const alwaysOn = o.thinkingAlwaysOn === true;
114
+ // (Off stays listed there, disabled, with the reason under it.)
115
+ const thinking = choice('Thinking', [['default', 'Model default'], ['off', 'Off']], alwaysOn ? 'default' : s.thinking,
116
+ alwaysOn ? { off: THINKING_ALWAYS_ON_NOTE } : {});
117
+ if (alwaysOn) thinking.title = `Off: ${THINKING_ALWAYS_ON_NOTE}`;
99
118
  const style = (o.outputStyles || []).length
100
- ? select([['', 'Default'], ...o.outputStyles.filter(n => n && n !== 'default').map(n => [n, n])], s.outputStyle)
119
+ ? choice('Output style', [['', 'Default'], ...o.outputStyles.filter(n => n && n !== 'default').map(n => [n, n])], s.outputStyle)
101
120
  : input('text', s.outputStyle, 'Default');
102
121
  const agent = (o.agents || []).length
103
- ? select([['', 'None'], ...o.agents.map(a => [a.name, a.description ? `${a.name}: ${String(a.description).slice(0, 60)}` : a.name])], s.agent)
122
+ ? choice('Run as agent', [['', 'None'], ...o.agents.map(a => [a.name, a.description ? `${a.name}: ${String(a.description).slice(0, 60)}` : a.name])], s.agent)
104
123
  : input('text', s.agent, 'None');
105
124
  const fallback = (o.models || []).length
106
- ? select([['', 'None'], ...o.models.map(m => [m.value, m.displayName || m.value])], s.fallbackModel)
125
+ ? choice('Fallback model', [['', 'None'], ...o.models.map(m => [m.value, m.displayName || m.value])], s.fallbackModel)
107
126
  : input('text', s.fallbackModel, 'None');
108
127
  const budget = input('number', s.maxBudgetUsd, 'No limit');
109
128
  const turns = input('number', s.maxTurns, 'No limit');
@@ -121,7 +140,9 @@ export function renderSessionSettingsCard(tab, o = {}) {
121
140
 
122
141
  form.append(
123
142
  field('Fast mode', fast, o.fastSupported ? 'Faster output at a higher price, on models that support it.' : 'The model in use does not report fast mode support.'),
124
- field('Thinking', thinking, 'Off starts the session without extended thinking.'),
143
+ field('Thinking', thinking, alwaysOn
144
+ ? `Off is not available: ${THINKING_ALWAYS_ON_NOTE}. It runs with adaptive thinking at the model's default effort.`
145
+ : 'Off starts the session without extended thinking.'),
125
146
  field('Output style', style),
126
147
  field('Run as agent', agent, "The main conversation uses the agent's prompt, tools and model."),
127
148
  field('Fallback model', fallback, 'Used when the main model is overloaded or unavailable.'),
@@ -154,8 +175,8 @@ export function renderSessionSettingsCard(tab, o = {}) {
154
175
  adv.agents = area(formatAgentsJson(s.agents), '{ "reviewer": { "description": "…", "prompt": "…", "tools": ["Read"], "model": "haiku" } }', 4);
155
176
  adv.skills = area(s.skills.join('\n'), 'Empty: every skill');
156
177
  adv.language = input('text', s.overlay.language, 'From your settings');
157
- adv.autoCompact = select([['default', 'From your settings'], ['on', 'On'], ['off', 'Off']], s.overlay.autoCompact);
158
- adv.cacheTtl = select([['', 'From your settings'], ['5m', '5 minutes'], ['1h', '1 hour']], s.overlay.promptCacheTtl);
178
+ adv.autoCompact = choice('Auto-compact', [['default', 'From your settings'], ['on', 'On'], ['off', 'Off']], s.overlay.autoCompact);
179
+ adv.cacheTtl = choice('Prompt cache lifetime', [['', 'From your settings'], ['5m', '5 minutes'], ['1h', '1 hour']], s.overlay.promptCacheTtl);
159
180
  adv.advisor = input('text', s.overlay.advisorModel, 'From your settings');
160
181
  adv.debug = checkbox(s.debug);
161
182
  const details = document.createElement('details');
@@ -197,7 +218,10 @@ export function renderSessionSettingsCard(tab, o = {}) {
197
218
  cancel.textContent = 'Close';
198
219
  const close = () => {
199
220
  el.classList.remove('active-perm');
200
- el.querySelectorAll('button, input, select, textarea').forEach(n => { n.disabled = true; });
221
+ closeDropdowns(el);
222
+ el.querySelectorAll('button, input, textarea').forEach(n => { n.disabled = true; });
223
+ el.querySelectorAll('.cc-dropdown').forEach(n => n.classList.add('disabled'));
224
+ el._cpDropdowns?.abort();
201
225
  };
202
226
  save.addEventListener('click', () => {
203
227
  let advanced = {};
@@ -224,7 +248,8 @@ export function renderSessionSettingsCard(tab, o = {}) {
224
248
  ...s,
225
249
  ...advanced,
226
250
  fastMode: fast.checked,
227
- thinking: thinking.value,
251
+ // (A saved Off stays saved on a model that always thinks: it applies again on a model that can.)
252
+ thinking: alwaysOn && s.thinking === 'off' ? 'off' : thinking.value,
228
253
  outputStyle: style.value,
229
254
  agent: agent.value,
230
255
  fallbackModel: fallback.value,
@@ -249,6 +274,9 @@ export function renderSessionSettingsCard(tab, o = {}) {
249
274
  body.appendChild(actions);
250
275
  el.appendChild(body);
251
276
  $msgs.appendChild(el);
277
+ // The dropdowns: mouse, keyboard, outside click and Escape. Taken off when the card closes or is replaced.
278
+ el._cpDropdowns = new AbortController();
279
+ wireDropdowns(el, { signal: el._cpDropdowns.signal });
252
280
  if (tab === cpCtx.activeTab()) cpCtx.scrollEnd();
253
281
  return el;
254
282
  }
@@ -294,6 +294,15 @@ a.cp-chip:hover { text-decoration: underline; }
294
294
  .cp-session-card textarea.cp-elicit-input { resize: vertical; font-family: "SF Mono", Menlo, monospace; }
295
295
  .cp-session-card .cp-session-field input[type="checkbox"] { align-self: flex-start; accent-color: #d4a848; }
296
296
  .cp-session-card:not(.active-perm) { opacity: 0.7; }
297
+ /* Its choice fields are the app's dropdown (cc-dropdown.js) in the look of the card's own inputs. */
298
+ .cp-session-card .cc-dropdown { display: block; }
299
+ .cp-session-card .cc-dropdown-trigger { width: 100%; min-width: 0; box-sizing: border-box; background: rgba(0,0,0,0.35); border: 1px solid rgba(180,140,60,0.2); border-radius: 6px; color: rgba(255,255,255,0.88); font: 10.5px/1.5 Inter, sans-serif; letter-spacing: normal; padding: 3px 6px; text-align: left; }
300
+ .cp-session-card .cc-dropdown-trigger:focus { outline: none; }
301
+ .cp-session-card .cc-dropdown-trigger:focus-visible, .cp-session-card .cc-dropdown.open .cc-dropdown-trigger { border-color: rgba(212,168,72,0.5); }
302
+ .cp-session-card .cc-dropdown.disabled .cc-dropdown-trigger { cursor: default; }
303
+ .cp-session-card .cc-dropdown-item { font: 10.5px/1.4 Inter, sans-serif; }
304
+ .cp-session-card .cc-dropdown-item.highlight { background: rgba(255,255,255,0.06); color: var(--t-bright); }
305
+ .cp-session-card .cc-dropdown-item[aria-disabled="true"], .cp-session-card .cc-dropdown-item[aria-disabled="true"]:hover { opacity: .45; cursor: default; background: none; color: var(--t-secondary); }
297
306
 
298
307
  /* ═══ Statusline: usage limit ═══ */
299
308
  .cp-sl-limit { font: 600 9.5px/1 "SF Mono", Menlo, monospace; border-radius: 8px; padding: 2px 6px; white-space: nowrap; flex-shrink: 0; cursor: default; color: #d4a848; background: rgba(212,168,72,0.12); }
@@ -0,0 +1,66 @@
1
+ // ═══════════════════════════════════════════
2
+ // SynaBun Neural Interface — "did this subtree change since I last looked?"
3
+ // ═══════════════════════════════════════════
4
+ // One MutationObserver and one boolean per watched element. The side panels
5
+ // store a snapshot of each transcript (its markup, serialised) so a session
6
+ // shows at once after a reload; they wrote it again on every tab switch,
7
+ // changed or not: a clone and a serialisation of the whole transcript, plus an
8
+ // upload, inside the click that opens another session. With the flag a switch
9
+ // writes only what changed since the last write.
10
+ //
11
+ // createDomChangeFlag(el) → { changed(), clear(), disconnect() }
12
+ //
13
+ // `changed()` is true from the start (nothing is known yet), after any node,
14
+ // text or attribute change under `el`, and always where there is no observer
15
+ // (an old engine, a test without one): a caller that cannot tell writes, as it
16
+ // did before. `clear()` says "what is there now has been written". Changes of
17
+ // the current task that the observer has not delivered yet are counted too.
18
+ // DOM-light on purpose: tests/dom-change-flag.test.mjs drives it with a
19
+ // stand-in observer.
20
+ //
21
+ // `ignore(record)` (optional) names records that are not a change of what is
22
+ // stored: the inline declarations transcript-rows.js puts on rows far from the
23
+ // screen come and go as the user scrolls, and a stored transcript holds none
24
+ // of them. A record it throws on counts as a change.
25
+
26
+ export function createDomChangeFlag(el, { MutationObserver: Observer, ignore = null } = {}) {
27
+ const Ctor = Observer || el?.ownerDocument?.defaultView?.MutationObserver || globalThis.MutationObserver;
28
+ let changed = true;
29
+ let observer = null;
30
+ /** Does any of these records count? Without a filter every record does. */
31
+ const counts = (records) => {
32
+ if (typeof ignore !== 'function') return records.length > 0;
33
+ for (const record of records) {
34
+ try { if (!ignore(record)) return true; } catch { return true; }
35
+ }
36
+ return false;
37
+ };
38
+ if (el && typeof Ctor === 'function') {
39
+ try {
40
+ observer = new Ctor((records) => { if (!Array.isArray(records) || counts(records)) changed = true; });
41
+ observer.observe(el, { subtree: true, childList: true, characterData: true, attributes: true });
42
+ } catch { observer = null; }
43
+ }
44
+
45
+ /** Records the observer holds but has not delivered: a change made earlier in this very task. */
46
+ function pending() {
47
+ try { return counts(observer?.takeRecords?.() || []); } catch { return true; }
48
+ }
49
+
50
+ return {
51
+ changed() {
52
+ if (!observer) return true;
53
+ if (!changed && pending()) changed = true;
54
+ return changed;
55
+ },
56
+ clear() {
57
+ if (!observer) return;
58
+ pending();
59
+ changed = false;
60
+ },
61
+ disconnect() {
62
+ try { observer?.disconnect(); } catch { /* already gone */ }
63
+ observer = null;
64
+ },
65
+ };
66
+ }
@@ -0,0 +1,124 @@
1
+ // ═══════════════════════════════════════════
2
+ // SynaBun Neural Interface — put new markup on screen without replacing what did not change
3
+ // ═══════════════════════════════════════════
4
+ // Two side panels drew a stream by writing innerHTML: Antigravity the whole transcript on every frame,
5
+ // Codex the whole message on every tick. Every element was made again, styled, laid out and painted, and
6
+ // whatever the page knew about the old ones was lost (a text selection, a fold the user opened, a hover).
7
+ // What they draw is still decided exactly as before, as markup; these two helpers only decide which nodes
8
+ // have to change for the page to show it.
9
+ //
10
+ // createKeyedHtmlList(box) a list of keyed pieces of markup (a transcript's rows): a piece whose
11
+ // markup is what it was keeps its nodes.
12
+ // morphChildren(target, source) one element's children against a freshly built copy (a message being
13
+ // written): the leading children that are equal stay, the rest is replaced.
14
+ //
15
+ // The result is node for node what innerHTML would have given. tests/dom-morph.test.mjs.
16
+
17
+ function defaultParse(html, doc) {
18
+ const template = doc.createElement('template');
19
+ template.innerHTML = html;
20
+ return [...template.content.childNodes];
21
+ }
22
+
23
+ /**
24
+ * A container whose children are the nodes of keyed pieces of markup, in order.
25
+ *
26
+ * `patch(pieces)` takes `[{ key, html }]` and makes the container hold exactly their nodes, in that order:
27
+ * a piece whose `html` is unchanged keeps its nodes (and their state), a changed or new one is parsed, one
28
+ * that is no longer listed is removed, and anything else found in the container goes too, as it would with
29
+ * innerHTML. It returns the keys it built. Keys must be unique; a repeated key makes the whole list be built
30
+ * again, which is always correct.
31
+ *
32
+ * `forget()`: the container was written some other way; nothing in it is known any more.
33
+ */
34
+ export function createKeyedHtmlList(box, { doc = box?.ownerDocument || globalThis.document, parse = (html) => defaultParse(html, doc) } = {}) {
35
+ /** @type {Map<string, { html: string, nodes: Node[] }>} */
36
+ let known = new Map();
37
+
38
+ function patch(pieces) {
39
+ const list = [];
40
+ const seen = new Set();
41
+ let repeated = false;
42
+ for (const piece of pieces || []) {
43
+ if (!piece || !piece.html) continue;
44
+ const key = String(piece.key);
45
+ if (seen.has(key)) repeated = true;
46
+ seen.add(key);
47
+ list.push({ key, html: String(piece.html) });
48
+ }
49
+ if (repeated) known = new Map();
50
+
51
+ const next = new Map();
52
+ const built = new Set();
53
+ for (const piece of list) {
54
+ const had = known.get(piece.key);
55
+ // Kept only when its nodes are still where they were put: something else may have taken them out.
56
+ const intact = had && had.html === piece.html && had.nodes.every((node) => node.parentNode === box);
57
+ if (intact && !next.has(piece.key)) {
58
+ next.set(piece.key, had);
59
+ } else {
60
+ next.set(repeated ? `${piece.key}\u0000${next.size}` : piece.key, { html: piece.html, nodes: parse(piece.html) });
61
+ built.add(piece.key);
62
+ }
63
+ }
64
+
65
+ // What stays, in order; everything else in the container leaves.
66
+ const wanted = [];
67
+ for (const entry of next.values()) for (const node of entry.nodes) wanted.push(node);
68
+ const keep = new Set(wanted);
69
+ for (let node = box.firstChild; node;) {
70
+ const after = node.nextSibling;
71
+ if (!keep.has(node)) box.removeChild(node);
72
+ node = after;
73
+ }
74
+ let cursor = box.firstChild;
75
+ for (const node of wanted) {
76
+ if (node === cursor) cursor = cursor.nextSibling;
77
+ else box.insertBefore(node, cursor);
78
+ }
79
+ known = repeated ? new Map() : next;
80
+ return { built, kept: list.length - built.size };
81
+ }
82
+
83
+ return {
84
+ patch,
85
+ forget() { known = new Map(); },
86
+ size: () => known.size,
87
+ };
88
+ }
89
+
90
+ /**
91
+ * Make `target`'s children those of `source`, keeping the leading children that are already equal.
92
+ *
93
+ * `source` is a freshly built copy of what `target` should hold (same markup, same post-processing). The
94
+ * children of `target` that equal `source`'s, counted from the start, stay as they are; from the first
95
+ * difference on, `target`'s are removed and `source`'s are moved in. A stream only ever changes the end of
96
+ * a message, so one tick replaces the paragraph being written and nothing before it.
97
+ *
98
+ * @returns {{ kept: number, removed: number, added: number }}
99
+ */
100
+ export function morphChildren(target, source, { equal = (a, b) => a.isEqualNode(b) } = {}) {
101
+ let kept = 0;
102
+ let live = target.firstChild;
103
+ let fresh = source.firstChild;
104
+ while (live && fresh && equal(live, fresh)) {
105
+ kept += 1;
106
+ live = live.nextSibling;
107
+ fresh = fresh.nextSibling;
108
+ }
109
+ let removed = 0;
110
+ while (live) {
111
+ const after = live.nextSibling;
112
+ target.removeChild(live);
113
+ removed += 1;
114
+ live = after;
115
+ }
116
+ let added = 0;
117
+ while (fresh) {
118
+ const after = fresh.nextSibling;
119
+ target.appendChild(fresh); // moved out of `source`
120
+ added += 1;
121
+ fresh = after;
122
+ }
123
+ return { kept, removed, added };
124
+ }
@@ -0,0 +1,134 @@
1
+ /* SynaBun's "Connect your browser" page (public/extension-setup.html), as approved in docs/design/browser-extension
2
+ ("Setup guide"; prototype/app.css is the reference). The page loads neither the app's styles.css nor its storage,
3
+ so the style guide's tokens are named here once, with their values from .synabun/style-guide/tokens.css (rev 19):
4
+ no new palette, font or radius. Fonts are the app's own vendored files (/vendor/fonts/fonts.css). */
5
+ :root {
6
+ --es-bg: #050505; /* --color-background */
7
+ --es-panel: #121214; /* --color-neutral-800 */
8
+ --es-menu: #131316; /* --color-neutral-700 */
9
+ --es-subtle: #ffffff0a; /* --color-surface-subtle */
10
+ --es-hover: #ffffff14; /* --color-surface-hover */
11
+ --es-field: #00000040; /* --color-settings-field */
12
+ --es-text: #ffffffe6; /* --color-text */
13
+ --es-primary-text: #ffffffb3; /* --color-text-primary */
14
+ --es-muted: #ffffff8c; /* --color-text-muted */
15
+ --es-border: #ffffff1a; /* --color-border */
16
+ --es-fill: #636363; /* --color-primary */
17
+ --es-fill-hover: #717171; /* --color-primary-hover */
18
+ --es-on-fill: #ffffff; /* --color-on-primary */
19
+ --es-focus: #93c5fd; /* --color-focus */
20
+ --es-ok: #86efac; --es-warn: #fbbf24; --es-err: #fca5a5; --es-info: #cccccc; /* status colours */
21
+ --es-radius-control: 5px; --es-radius-card: 9px;
22
+ --es-font-body: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
23
+ --es-font-heading: "Space Grotesk", Inter, sans-serif;
24
+ --es-font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
25
+ color-scheme: dark;
26
+ }
27
+ *, *::before, *::after { box-sizing: border-box; }
28
+ html { background: var(--es-bg); }
29
+ body { margin: 0; background: var(--es-bg); color: var(--es-text); font: 400 14px/1.5 var(--es-font-body); -webkit-font-smoothing: antialiased; }
30
+ h1, h2, h3, p { margin: 0; }
31
+ img, svg { display: block; }
32
+ svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
33
+ :is(a, button, summary):focus-visible { outline: 2px solid var(--es-focus); outline-offset: 3px; }
34
+ [hidden] { display: none !important; }
35
+
36
+ .es-setup { max-width: 960px; margin: 0 auto; padding: 32px 24px 48px; }
37
+ .es-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 32px; }
38
+ .es-brand { display: flex; align-items: center; gap: 8px; font: 600 15px/1.3 var(--es-font-heading); color: var(--es-text); }
39
+ .es-brand img { width: 32px; height: 32px; border-radius: var(--es-radius-control); }
40
+ .es-browser { font-size: 12px; color: var(--es-muted); }
41
+ .es-browser strong { color: var(--es-text); font-weight: 500; }
42
+
43
+ .es-header { max-width: 70ch; margin-bottom: 24px; }
44
+ .es-eyebrow { margin-bottom: 8px; font-size: 12px; color: var(--es-muted); }
45
+ .es-title { font: 600 28px/1.2 var(--es-font-heading); color: var(--es-text); margin-bottom: 12px; }
46
+ .es-lead { font-size: 14px; color: var(--es-primary-text); }
47
+
48
+ .es-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
49
+ .es-setup[data-layout="result"] .es-grid { grid-template-columns: minmax(0, 640px); }
50
+ .es-setup[data-layout="result"] .es-info { display: none; }
51
+ .es-surface { background: var(--es-panel); border: 1px solid var(--es-border); border-radius: var(--es-radius-card); }
52
+
53
+ /* the three steps (and the automatic fourth): a number, what to do, the one thing to copy or show */
54
+ .es-steps { list-style: none; margin: 0; padding: 0; }
55
+ .es-step { display: flex; gap: 16px; padding: 24px; border-bottom: 1px solid var(--es-border); }
56
+ .es-step:last-child { border-bottom: 0; }
57
+ .es-step-number {
58
+ display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border: 1px solid var(--es-muted);
59
+ border-radius: var(--es-radius-control); font: 500 12px/1 var(--es-font-mono); color: var(--es-text);
60
+ }
61
+ .es-step[data-done="true"] .es-step-number { border-color: var(--es-ok); color: var(--es-ok); font-size: 0; }
62
+ .es-step[data-done="true"] .es-step-number::before { content: '✓'; font-size: 14px; }
63
+ .es-step-main { flex: 1; min-width: 0; }
64
+ .es-step-title { font: 600 15px/1.4 var(--es-font-body); margin-bottom: 4px; color: var(--es-text); }
65
+ .es-step-text { font-size: 13px; color: var(--es-primary-text); }
66
+ .es-step[data-step="pair"] .es-step-title { color: var(--es-primary-text); }
67
+ .es-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
68
+ .es-step .es-row { margin-top: 12px; }
69
+ .es-address { padding: 8px 12px; background: var(--es-field); border: 1px solid var(--es-border); border-radius: var(--es-radius-control); }
70
+ .es-address .es-code { flex: 1 1 160px; user-select: all; }
71
+ .es-code { font: 400 12px/1.5 var(--es-font-mono); color: var(--es-primary-text); overflow-wrap: anywhere; word-break: break-all; unicode-bidi: isolate; }
72
+ .es-folder { display: flex; gap: 12px; align-items: center; margin-top: 12px; padding: 12px; background: var(--es-subtle); border-radius: var(--es-radius-control); }
73
+ .es-folder > svg { width: 24px; height: 24px; color: var(--es-muted); }
74
+ .es-folder-text { min-width: 0; }
75
+ .es-folder .es-code { display: block; user-select: all; }
76
+ .es-caption { display: block; font-size: 12px; color: var(--es-muted); }
77
+
78
+ /* buttons: 44 px to hit, the guide's 5 px corners */
79
+ .es-button {
80
+ display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; min-width: 0; padding: 8px 12px;
81
+ border: 1px solid var(--es-muted); border-radius: var(--es-radius-control); background: var(--es-subtle); color: var(--es-text);
82
+ font: 500 12px/1.35 var(--es-font-body); text-align: center; text-decoration: none; white-space: normal; overflow-wrap: anywhere; cursor: pointer;
83
+ }
84
+ .es-button:hover { background: var(--es-hover); }
85
+ .es-button-primary { background: var(--es-fill); border-color: var(--es-fill); color: var(--es-on-fill); }
86
+ .es-button-primary:hover { background: var(--es-fill-hover); }
87
+ .es-button-ghost { border-color: transparent; background: transparent; }
88
+ .es-address .es-button { flex: 0 0 auto; }
89
+
90
+ /* the status beside the steps; alone in a card once there is nothing more to do */
91
+ .es-aside { display: grid; gap: 16px; min-width: 0; }
92
+ .es-status { display: flex; gap: 12px; padding: 16px; }
93
+ .es-symbol { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: var(--es-radius-control); background: var(--es-subtle); color: var(--es-info); }
94
+ .es-symbol svg { display: none; }
95
+ .es-status[data-tone="warn"] .es-symbol { color: var(--es-warn); }
96
+ .es-status[data-tone="ok"] .es-symbol { color: var(--es-ok); }
97
+ .es-status[data-tone="err"] .es-symbol { color: var(--es-err); }
98
+ .es-status[data-tone="warn"] [data-sym="warn"], .es-status[data-tone="ok"] [data-sym="ok"],
99
+ .es-status[data-tone="err"] [data-sym="err"], .es-status[data-tone="idle"] [data-sym="idle"] { display: block; }
100
+ .es-status-body { flex: 1; min-width: 0; }
101
+ .es-status-title { font: 600 14px/1.35 var(--es-font-body); color: var(--es-text); }
102
+ .es-setup[data-layout="result"] .es-status-title { display: none; }
103
+ .es-live { margin-top: 4px; font-size: 13px; color: var(--es-primary-text); }
104
+ .es-live[data-tone="ok"] { color: var(--es-ok); } .es-live[data-tone="err"] { color: var(--es-err); }
105
+ .es-setup[data-layout="result"] .es-live { margin-top: 0; font-size: 14px; }
106
+ .es-setup[data-layout="result"] .es-status { padding: 24px; }
107
+ .es-setup[data-layout="result"] .es-symbol { width: 48px; height: 48px; }
108
+ .es-setup[data-layout="result"] .es-symbol svg { width: 24px; height: 24px; }
109
+ .es-note { font-size: 12px; line-height: 1.5; color: var(--es-muted); }
110
+ .es-status-body > * + * { margin-top: 12px; }
111
+ .es-status-body > .es-live { margin-top: 4px; }
112
+ .es-warn { color: var(--es-warn); }
113
+ .es-copied:empty { display: none; }
114
+ .es-subtitle { font: 600 13px/1.35 var(--es-font-body); color: var(--es-text); margin-bottom: 8px; }
115
+ .es-info { padding: 16px; }
116
+ .es-help { padding: 0; }
117
+ .es-help > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 12px 16px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 500; }
118
+ .es-help > summary::-webkit-details-marker { display: none; }
119
+ .es-help > summary::after { content: '+'; font-size: 18px; color: var(--es-muted); }
120
+ .es-help[open] > summary::after { content: '−'; }
121
+ .es-help > p { padding: 0 16px 12px; }
122
+
123
+ @media (max-width: 760px) {
124
+ .es-setup { padding: 24px 16px 32px; }
125
+ .es-grid { grid-template-columns: minmax(0, 1fr); }
126
+ .es-step { padding: 16px; gap: 12px; }
127
+ }
128
+ @media (max-width: 420px) {
129
+ .es-status { flex-direction: column; }
130
+ .es-row > .es-button { flex: 1 1 auto; }
131
+ }
132
+ @media (prefers-reduced-motion: no-preference) {
133
+ .es-button, .es-help > summary { transition: background-color 150ms ease, color 150ms ease; }
134
+ }