synabun 2.3.0 → 2.4.0

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 (367) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +1 -1
  3. package/browser-extension/content.js +169 -0
  4. package/browser-extension/engine.js +477 -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 +244 -0
  17. package/browser-extension/popup-view.js +151 -0
  18. package/browser-extension/popup.css +165 -0
  19. package/browser-extension/popup.html +105 -0
  20. package/browser-extension/popup.js +347 -0
  21. package/browser-extension/protocol.js +226 -0
  22. package/browser-extension/service-worker.js +267 -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/mcp-server/dist/http.d.ts +2 -0
  28. package/mcp-server/dist/http.d.ts.map +1 -1
  29. package/mcp-server/dist/http.js +9 -1
  30. package/mcp-server/dist/http.js.map +1 -1
  31. package/mcp-server/dist/index.d.ts +11 -0
  32. package/mcp-server/dist/index.d.ts.map +1 -1
  33. package/mcp-server/dist/index.js +38 -3
  34. package/mcp-server/dist/index.js.map +1 -1
  35. package/mcp-server/dist/services/browser-route-flow.d.ts +6 -2
  36. package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
  37. package/mcp-server/dist/services/browser-route-flow.js +10 -3
  38. package/mcp-server/dist/services/browser-route-flow.js.map +1 -1
  39. package/mcp-server/dist/services/codex-config-heal.d.ts.map +1 -1
  40. package/mcp-server/dist/services/codex-config-heal.js +7 -0
  41. package/mcp-server/dist/services/codex-config-heal.js.map +1 -1
  42. package/mcp-server/dist/services/neural-interface.d.ts +94 -3
  43. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  44. package/mcp-server/dist/services/neural-interface.js +168 -23
  45. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  46. package/mcp-server/dist/services/team-context.d.ts +18 -0
  47. package/mcp-server/dist/services/team-context.d.ts.map +1 -0
  48. package/mcp-server/dist/services/team-context.js +29 -0
  49. package/mcp-server/dist/services/team-context.js.map +1 -0
  50. package/mcp-server/dist/services/tool-catalog.d.ts +5 -2
  51. package/mcp-server/dist/services/tool-catalog.d.ts.map +1 -1
  52. package/mcp-server/dist/services/tool-catalog.js +22 -6
  53. package/mcp-server/dist/services/tool-catalog.js.map +1 -1
  54. package/mcp-server/dist/services/tool-list.d.ts.map +1 -1
  55. package/mcp-server/dist/services/tool-list.js +4 -0
  56. package/mcp-server/dist/services/tool-list.js.map +1 -1
  57. package/mcp-server/dist/services/tool-runtime.d.ts +8 -1
  58. package/mcp-server/dist/services/tool-runtime.d.ts.map +1 -1
  59. package/mcp-server/dist/services/tool-runtime.js +18 -1
  60. package/mcp-server/dist/services/tool-runtime.js.map +1 -1
  61. package/mcp-server/dist/tools/agent-definition.d.ts +133 -0
  62. package/mcp-server/dist/tools/agent-definition.d.ts.map +1 -0
  63. package/mcp-server/dist/tools/agent-definition.js +483 -0
  64. package/mcp-server/dist/tools/agent-definition.js.map +1 -0
  65. package/mcp-server/dist/tools/agents.d.ts +91 -9
  66. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  67. package/mcp-server/dist/tools/agents.js +161 -20
  68. package/mcp-server/dist/tools/agents.js.map +1 -1
  69. package/mcp-server/dist/tools/browser-advanced.d.ts +8 -1
  70. package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
  71. package/mcp-server/dist/tools/browser-advanced.js +70 -6
  72. package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
  73. package/mcp-server/dist/tools/git-tools.d.ts +4 -2
  74. package/mcp-server/dist/tools/git-tools.d.ts.map +1 -1
  75. package/mcp-server/dist/tools/git-tools.js +283 -2
  76. package/mcp-server/dist/tools/git-tools.js.map +1 -1
  77. package/mcp-server/dist/tools/morelogin.d.ts +8 -2
  78. package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
  79. package/mcp-server/dist/tools/morelogin.js +22 -5
  80. package/mcp-server/dist/tools/morelogin.js.map +1 -1
  81. package/mcp-server/dist/tools/team.d.ts +32 -0
  82. package/mcp-server/dist/tools/team.d.ts.map +1 -0
  83. package/mcp-server/dist/tools/team.js +87 -0
  84. package/mcp-server/dist/tools/team.js.map +1 -0
  85. package/mcp-server/package-lock.json +2 -2
  86. package/mcp-server/package.json +1 -1
  87. package/mcp-server/src/http.ts +9 -1
  88. package/mcp-server/src/index.ts +34 -4
  89. package/mcp-server/src/services/browser-route-flow.ts +12 -5
  90. package/mcp-server/src/services/codex-config-heal.ts +7 -0
  91. package/mcp-server/src/services/neural-interface.ts +190 -29
  92. package/mcp-server/src/services/team-context.ts +27 -0
  93. package/mcp-server/src/services/tool-catalog.ts +26 -8
  94. package/mcp-server/src/services/tool-list.ts +4 -0
  95. package/mcp-server/src/services/tool-runtime.ts +21 -2
  96. package/mcp-server/src/tools/agent-definition.ts +458 -0
  97. package/mcp-server/src/tools/agents.ts +175 -19
  98. package/mcp-server/src/tools/browser-advanced.ts +60 -6
  99. package/mcp-server/src/tools/git-tools.ts +249 -3
  100. package/mcp-server/src/tools/morelogin.ts +20 -5
  101. package/mcp-server/src/tools/team.ts +97 -0
  102. package/neural-interface/i18n/en.json +1174 -47
  103. package/neural-interface/i18n/pt-BR.json +1174 -47
  104. package/neural-interface/lib/account-usage.js +1 -1
  105. package/neural-interface/lib/agents/density.js +101 -0
  106. package/neural-interface/lib/agents/forge-host.js +223 -0
  107. package/neural-interface/lib/agents/native-export-targets.js +190 -0
  108. package/neural-interface/lib/agents/native-export.js +365 -0
  109. package/neural-interface/lib/agents/registry.js +840 -0
  110. package/neural-interface/lib/agents/resolve.js +544 -0
  111. package/neural-interface/lib/agents/schema.js +642 -0
  112. package/neural-interface/lib/agents/split.js +37 -0
  113. package/neural-interface/lib/agents-studio-api.js +591 -0
  114. package/neural-interface/lib/assistant-api.js +76 -7
  115. package/neural-interface/lib/assistant-catalog.js +2 -0
  116. package/neural-interface/lib/assistant-continuity.js +49 -0
  117. package/neural-interface/lib/assistant-dispatch.js +229 -102
  118. package/neural-interface/lib/assistant-persona.js +105 -8
  119. package/neural-interface/lib/assistant-route-gate.js +24 -9
  120. package/neural-interface/lib/assistant-router.js +384 -42
  121. package/neural-interface/lib/assistant-run-tail.js +151 -0
  122. package/neural-interface/lib/assistant-run-wait.js +183 -0
  123. package/neural-interface/lib/assistant-runtime.js +440 -93
  124. package/neural-interface/lib/assistant-task-prompt.js +11 -2
  125. package/neural-interface/lib/assistant-usage.js +3 -2
  126. package/neural-interface/lib/automation-approval.js +2 -2
  127. package/neural-interface/lib/browser-close-evidence.js +80 -0
  128. package/neural-interface/lib/browser-default.js +210 -0
  129. package/neural-interface/lib/browser-extension-adapter.js +255 -0
  130. package/neural-interface/lib/browser-extension-bridge.js +418 -0
  131. package/neural-interface/lib/browser-extension-folder.js +116 -0
  132. package/neural-interface/lib/browser-extension-setup.js +140 -0
  133. package/neural-interface/lib/browser-profile-choices.js +3 -3
  134. package/neural-interface/lib/browser-profiles.js +1 -1
  135. package/neural-interface/lib/browser-tool-policy.js +1 -1
  136. package/neural-interface/lib/claude-account-links.js +301 -0
  137. package/neural-interface/lib/claude-accounts.js +45 -20
  138. package/neural-interface/lib/claude-agent-bridge.js +142 -10
  139. package/neural-interface/lib/claude-model-catalog.js +6 -0
  140. package/neural-interface/lib/claude-panel-session.js +33 -0
  141. package/neural-interface/lib/cli-install-api.js +23 -0
  142. package/neural-interface/lib/codex-accounts.js +67 -24
  143. package/neural-interface/lib/coordination/README.md +384 -0
  144. package/neural-interface/lib/coordination/service.js +563 -0
  145. package/neural-interface/lib/coordination/store.js +1138 -0
  146. package/neural-interface/lib/db.js +22 -1
  147. package/neural-interface/lib/editor-completion-opencode.js +4 -3
  148. package/neural-interface/lib/effort-levels.js +10 -1
  149. package/neural-interface/lib/maritaca/opencode-proxy.js +7 -2
  150. package/neural-interface/lib/maritaca/opencode.js +35 -0
  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 +219 -7
  157. package/neural-interface/lib/native-loop-runtime.js +24 -1
  158. package/neural-interface/lib/opencode-build-preflight.js +116 -0
  159. package/neural-interface/lib/opencode-launch-error.js +13 -0
  160. package/neural-interface/lib/opencode-native-boundary.js +800 -84
  161. package/neural-interface/lib/opencode-serve-probe.js +426 -0
  162. package/neural-interface/lib/opencode-serve-records.js +14 -9
  163. package/neural-interface/lib/opencode-serve-scan.js +108 -0
  164. package/neural-interface/lib/page-session.js +1 -1
  165. package/neural-interface/lib/peer-identity.js +60 -21
  166. package/neural-interface/lib/process-identity.js +235 -7
  167. package/neural-interface/lib/request-gate.js +3 -0
  168. package/neural-interface/lib/screenshot-location.js +33 -0
  169. package/neural-interface/lib/skills/creation.js +1 -1
  170. package/neural-interface/lib/skills/known-bridge-digests.json +40 -0
  171. package/neural-interface/lib/studio-attention.js +56 -0
  172. package/neural-interface/lib/teams/README.md +382 -0
  173. package/neural-interface/lib/teams/api.js +287 -0
  174. package/neural-interface/lib/teams/brief.js +185 -0
  175. package/neural-interface/lib/teams/claims.js +315 -0
  176. package/neural-interface/lib/teams/git.js +293 -0
  177. package/neural-interface/lib/teams/index.js +122 -0
  178. package/neural-interface/lib/teams/integration.js +580 -0
  179. package/neural-interface/lib/teams/landing.js +184 -0
  180. package/neural-interface/lib/teams/recovery.js +256 -0
  181. package/neural-interface/lib/teams/scheduler.js +1474 -0
  182. package/neural-interface/lib/teams/schema.js +559 -0
  183. package/neural-interface/lib/teams/state.js +181 -0
  184. package/neural-interface/lib/teams/test-runner.js +86 -0
  185. package/neural-interface/lib/teams/test-sandbox.js +99 -0
  186. package/neural-interface/lib/teams/worktrees.js +757 -0
  187. package/neural-interface/lib/tool-permission-choices.js +226 -0
  188. package/neural-interface/lib/whatsapp/cards.js +24 -10
  189. package/neural-interface/lib/worker-confinement.js +206 -6
  190. package/neural-interface/lib/worker-mcp-channel.js +38 -1
  191. package/neural-interface/package-lock.json +4 -2
  192. package/neural-interface/package.json +3 -1
  193. package/neural-interface/public/extension-setup.html +107 -0
  194. package/neural-interface/public/index.html +52 -12
  195. package/neural-interface/public/shared/agent-runtime-options.js +3 -1
  196. package/neural-interface/public/shared/agents/studio/ax-agent-view.js +614 -0
  197. package/neural-interface/public/shared/agents/studio/ax-api.js +198 -0
  198. package/neural-interface/public/shared/agents/studio/ax-create-view.js +221 -0
  199. package/neural-interface/public/shared/agents/studio/ax-diff.js +143 -0
  200. package/neural-interface/public/shared/agents/studio/ax-editor-view.js +392 -0
  201. package/neural-interface/public/shared/agents/studio/ax-export-view.js +94 -0
  202. package/neural-interface/public/shared/agents/studio/ax-form.js +191 -0
  203. package/neural-interface/public/shared/agents/studio/ax-icons.js +87 -0
  204. package/neural-interface/public/shared/agents/studio/ax-library-view.js +158 -0
  205. package/neural-interface/public/shared/agents/studio/ax-library.js +162 -0
  206. package/neural-interface/public/shared/agents/studio/ax-main.js +712 -0
  207. package/neural-interface/public/shared/agents/studio/ax-native-export.js +35 -0
  208. package/neural-interface/public/shared/agents/studio/ax-options.js +198 -0
  209. package/neural-interface/public/shared/agents/studio/ax-review-view.js +175 -0
  210. package/neural-interface/public/shared/agents/studio/ax-revisions-view.js +189 -0
  211. package/neural-interface/public/shared/agents/studio/ax-runs-view.js +202 -0
  212. package/neural-interface/public/shared/agents/studio/ax-runs.js +82 -0
  213. package/neural-interface/public/shared/agents/studio/ax-teams-view.js +256 -0
  214. package/neural-interface/public/shared/agents/studio/ax-teams.js +200 -0
  215. package/neural-interface/public/shared/agents/studio/ax-templates.js +50 -0
  216. package/neural-interface/public/shared/agents/studio/ax-ui.js +194 -0
  217. package/neural-interface/public/shared/agents/studio/ax-views.js +170 -0
  218. package/neural-interface/public/shared/agy/agy-panel.js +142 -28
  219. package/neural-interface/public/shared/agy/agy-styles.js +25 -5
  220. package/neural-interface/public/shared/assistant/asst-account-menu.js +13 -13
  221. package/neural-interface/public/shared/assistant/asst-ask-styles.js +2 -3
  222. package/neural-interface/public/shared/assistant/asst-brain-picker.js +91 -9
  223. package/neural-interface/public/shared/assistant/asst-control.js +3 -0
  224. package/neural-interface/public/shared/assistant/asst-interaction-hold.js +99 -0
  225. package/neural-interface/public/shared/assistant/asst-limit-dismissals.js +111 -0
  226. package/neural-interface/public/shared/assistant/asst-limit-dock.js +37 -3
  227. package/neural-interface/public/shared/assistant/asst-limit-wait.js +30 -7
  228. package/neural-interface/public/shared/assistant/asst-panel.js +177 -30
  229. package/neural-interface/public/shared/assistant/asst-rack-styles.js +15 -8
  230. package/neural-interface/public/shared/assistant/asst-render.js +36 -6
  231. package/neural-interface/public/shared/assistant/asst-route.js +78 -12
  232. package/neural-interface/public/shared/assistant/asst-routes-editor.js +148 -70
  233. package/neural-interface/public/shared/assistant/asst-roving.js +17 -1
  234. package/neural-interface/public/shared/assistant/asst-scene-styles.js +7 -2
  235. package/neural-interface/public/shared/assistant/asst-scenes.js +12 -1
  236. package/neural-interface/public/shared/assistant/asst-sidepanel.js +12 -2
  237. package/neural-interface/public/shared/assistant/asst-state.js +66 -1
  238. package/neural-interface/public/shared/assistant/asst-styles.js +98 -44
  239. package/neural-interface/public/shared/assistant/route-identity.js +16 -0
  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 +33 -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/opencode-verify-view.js +175 -0
  279. package/neural-interface/public/shared/schedules-view.js +2 -2
  280. package/neural-interface/public/shared/session-project-items.js +11 -0
  281. package/neural-interface/public/shared/settings/settings-ai-browser.js +119 -0
  282. package/neural-interface/public/shared/settings/settings-browser-extension.js +446 -0
  283. package/neural-interface/public/shared/settings/settings-ia.js +4 -2
  284. package/neural-interface/public/shared/settings/settings-morelogin-cooldown.js +63 -0
  285. package/neural-interface/public/shared/settings/settings-tool-permissions.js +70 -0
  286. package/neural-interface/public/shared/sidepanel-lazy.js +40 -0
  287. package/neural-interface/public/shared/sidepanel-session-status.js +8 -14
  288. package/neural-interface/public/shared/sidepanel-shown.js +73 -0
  289. package/neural-interface/public/shared/storage.js +6 -1
  290. package/neural-interface/public/shared/studio-attention.js +83 -0
  291. package/neural-interface/public/shared/styles.css +713 -61
  292. package/neural-interface/public/shared/term-browser-tabs.js +34 -0
  293. package/neural-interface/public/shared/transcript-rows.js +334 -0
  294. package/neural-interface/public/shared/tray-auto-close.js +106 -0
  295. package/neural-interface/public/shared/ui-agents.js +97 -0
  296. package/neural-interface/public/shared/ui-antigravity-panel.js +16 -14
  297. package/neural-interface/public/shared/ui-automation-studio.js +3 -3
  298. package/neural-interface/public/shared/ui-claude-panel.js +162 -95
  299. package/neural-interface/public/shared/ui-code-copy.js +256 -0
  300. package/neural-interface/public/shared/ui-codex-panel.js +14 -10
  301. package/neural-interface/public/shared/ui-context-menu.js +1 -1
  302. package/neural-interface/public/shared/ui-file-explorer.js +2 -3
  303. package/neural-interface/public/shared/ui-games.js +1 -1
  304. package/neural-interface/public/shared/ui-loading.js +12 -1
  305. package/neural-interface/public/shared/ui-maritaca-panel.js +12 -11
  306. package/neural-interface/public/shared/ui-menubar.js +23 -0
  307. package/neural-interface/public/shared/ui-native-loop-router.js +1 -1
  308. package/neural-interface/public/shared/ui-navbar.js +15 -9
  309. package/neural-interface/public/shared/ui-opencode-panel-v2.js +13 -11
  310. package/neural-interface/public/shared/ui-opencode-verify.js +120 -0
  311. package/neural-interface/public/shared/ui-schedules-studio.js +3 -3
  312. package/neural-interface/public/shared/ui-scroll-follow.js +39 -0
  313. package/neural-interface/public/shared/ui-sessions.js +3 -3
  314. package/neural-interface/public/shared/ui-settings-entry.js +55 -0
  315. package/neural-interface/public/shared/ui-settings.js +372 -402
  316. package/neural-interface/public/shared/ui-sidepanel-layout.js +44 -25
  317. package/neural-interface/public/shared/ui-sidepanel-session-entry.js +22 -9
  318. package/neural-interface/public/shared/ui-sidepanel-sessions.js +10 -2
  319. package/neural-interface/public/shared/ui-sidepanel-tray.js +36 -41
  320. package/neural-interface/public/shared/ui-sidepanel-windows.js +14 -1
  321. package/neural-interface/public/shared/ui-styleguide.js +10 -2
  322. package/neural-interface/public/shared/ui-sync.js +5 -0
  323. package/neural-interface/public/shared/ui-terminal.js +13 -9
  324. package/neural-interface/public/shared/ui-tooltip.js +28 -7
  325. package/neural-interface/public/shared/ui-topright-overflow.js +26 -4
  326. package/neural-interface/public/shared/ui-tray-columns.js +375 -0
  327. package/neural-interface/public/shared/ui-whiteboard.js +51 -6
  328. package/neural-interface/public/shared/ui-worker-end.js +28 -1
  329. package/neural-interface/public/shared/ui-workspaces.js +13 -0
  330. package/neural-interface/public/shared/window-keys.js +71 -0
  331. package/neural-interface/public/variant/2d/main.js +2 -0
  332. package/neural-interface/public/variant/3d/app.js +620 -0
  333. package/neural-interface/public/variant/3d/boot-reveal.js +47 -0
  334. package/neural-interface/public/variant/3d/main.js +21 -544
  335. package/neural-interface/public/variant/3d/map-controls.js +4 -2
  336. package/neural-interface/public/vendor/fonts/fonts.css +508 -0
  337. package/neural-interface/public/vendor/fonts/inter-OFL.txt +93 -0
  338. package/neural-interface/public/vendor/fonts/inter-cyrillic-ext.woff2 +0 -0
  339. package/neural-interface/public/vendor/fonts/inter-cyrillic.woff2 +0 -0
  340. package/neural-interface/public/vendor/fonts/inter-greek-ext.woff2 +0 -0
  341. package/neural-interface/public/vendor/fonts/inter-greek.woff2 +0 -0
  342. package/neural-interface/public/vendor/fonts/inter-latin-ext.woff2 +0 -0
  343. package/neural-interface/public/vendor/fonts/inter-latin.woff2 +0 -0
  344. package/neural-interface/public/vendor/fonts/inter-vietnamese.woff2 +0 -0
  345. package/neural-interface/public/vendor/fonts/jetbrains-mono-OFL.txt +93 -0
  346. package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
  347. package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
  348. package/neural-interface/public/vendor/fonts/jetbrains-mono-greek.woff2 +0 -0
  349. package/neural-interface/public/vendor/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
  350. package/neural-interface/public/vendor/fonts/jetbrains-mono-latin.woff2 +0 -0
  351. package/neural-interface/public/vendor/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
  352. package/neural-interface/public/vendor/fonts/manifest.json +142 -0
  353. package/neural-interface/public/vendor/fonts/space-grotesk-OFL.txt +93 -0
  354. package/neural-interface/public/vendor/fonts/space-grotesk-latin-ext.woff2 +0 -0
  355. package/neural-interface/public/vendor/fonts/space-grotesk-latin.woff2 +0 -0
  356. package/neural-interface/public/vendor/fonts/space-grotesk-vietnamese.woff2 +0 -0
  357. package/neural-interface/scripts/boot-graph.mjs +270 -0
  358. package/neural-interface/scripts/vendor-fonts.mjs +124 -0
  359. package/neural-interface/server.js +1164 -157
  360. package/npm-shrinkwrap.json +2 -2
  361. package/package.json +3 -1
  362. package/skills/agent-forge/SKILL.md +182 -0
  363. package/skills/agent-forge/evals/evals.json +56 -0
  364. package/skills/agent-forge/references/definition-fields.md +61 -0
  365. package/skills/agent-forge/references/examples.md +105 -0
  366. package/skills/agent-forge/references/instructions.md +51 -0
  367. package/skills/agent-forge/references/review-and-export.md +84 -0
@@ -2,68 +2,22 @@
2
2
  // SynaBun Neural Interface — 3D Variant Entry Point (Memory Map)
3
3
  // ═══════════════════════════════════════════
4
4
  //
5
- // Registers the 3D variant, wires the shared UI to the memory map and boots.
6
- // The map paints as soon as /api/map arrives; the full memory list (sidebar,
7
- // explorer, cards, tooltips) hydrates right behind it.
5
+ // What the first frame needs and nothing else: the variant, the translations, the shared HTML and the loading
6
+ // overlay (about twenty modules). The rest of the app (app.js: the map, the shared UI, the side panels' facades,
7
+ // boot) is imported right after, while the overlay shows; it used to load all of it, about four hundred modules,
8
+ // before the first frame. The map paints as soon as /api/map arrives; the full memory list (sidebar, explorer,
9
+ // cards, tooltips) hydrates right behind it.
8
10
 
9
11
  // ── Storage (self-hydrating — importing it populates the cache) ──
10
12
  import { storage, isShowcaseMode } from '../../shared/storage.js';
11
- import { posStore } from '../../shared/node-positions-store.js';
12
13
 
13
14
  // ── Shared foundation ──
14
- import { state, emit, on } from '../../shared/state.js';
15
- import { registerVariant, registerHelpSection } from '../../shared/registry.js';
16
- import { normalizeNodes } from '../../shared/utils.js';
15
+ import { registerVariant } from '../../shared/registry.js';
17
16
  import { injectSharedHTML } from '../../shared/html-shell.js';
18
- import { KEYS } from '../../shared/constants.js';
19
17
  import { migrateViewPreferences, normalizeViewUrl } from '../../shared/view-variant.js';
20
18
  import { initI18n, t } from '../../shared/i18n.js';
21
-
22
- // ── Shared UI modules (side-effect: each registers its own event listeners) ──
23
- import { initTooltip } from '../../shared/ui-tooltip.js';
24
- import { initPanelSystem, initPinToggle, clampPanelsToViewport } from '../../shared/ui-panels.js';
25
- import { initLoading, showLoadingError, hideLoading, rememberHealth } from '../../shared/ui-loading.js';
26
- import { initNavbar } from '../../shared/ui-navbar.js';
27
- import { initMenubar, closeMenubar } from '../../shared/ui-menubar.js';
28
- import { initSearch, clearSearch } from '../../shared/ui-search.js';
29
- import { buildCategorySidebar, initSidebar, loadCategories } from '../../shared/ui-sidebar.js';
30
- import { openMemoryCard, restoreOpenCards, initDetailPanel, setDetailCallbacks } from '../../shared/ui-detail.js';
31
- import { initSettings, restoreInterfaceConfig, restoreSkin, loadIfaceConfig } from '../../shared/ui-settings.js';
32
- import { initTrash } from '../../shared/ui-trash.js';
33
- import { initBookmarks } from '../../shared/ui-bookmarks.js';
34
- import { initResume } from '../../shared/ui-resume.js';
35
- import { initHelp } from '../../shared/ui-help.js';
36
- import { initMultiSelect, clearMultiSelect } from '../../shared/ui-multiselect.js';
37
- import { updateStats, initStats } from '../../shared/ui-stats.js';
38
- import { initExplorer } from '../../shared/ui-explorer.js';
39
- import { initFileExplorer } from '../../shared/ui-file-explorer.js';
40
- import { initSkillsStudio } from '../../shared/ui-skills.js';
41
- import { initStyleGuide } from '../../shared/ui-styleguide.js';
42
- import { initTerminal } from '../../shared/ui-terminal.js';
43
- import { initLink } from '../../shared/ui-link.js';
44
- import { initWhiteboard } from '../../shared/ui-whiteboard.js';
45
- import { initCostWidget } from '../../shared/ui-cost-widget.js';
46
- import { initGames, clearGameOnLoad } from '../../shared/ui-games.js';
47
- import { initWorkspaces } from '../../shared/ui-workspaces.js';
48
- import { initInvite } from '../../shared/ui-invite.js';
49
- import { initSync, isGuest } from '../../shared/ui-sync.js';
50
- import { startLaunchPrefetch } from '../../shared/launch-prefetch.js';
51
- import { initKeybinds, registerAction } from '../../shared/ui-keybinds.js';
52
- import { initTutorial } from '../../shared/ui-tutorial.js';
53
- import { initImageGallery } from '../../shared/ui-image-gallery.js';
54
- import { initScheduleQueue } from '../../shared/ui-schedule-queue.js';
55
- import { initAutomationStudio } from '../../shared/ui-automation-studio.js';
56
- import { initSchedulesStudio } from '../../shared/ui-schedules-studio.js';
57
- import { initNativeLoopRouter } from '../../shared/ui-native-loop-router.js';
58
- import { initCommandRunner } from '../../shared/ui-command-runner.js';
59
- import { initAppContextMenu, openAppContextMenu, registerContextMenuArea } from '../../shared/ui-context-menu.js';
60
-
61
- // ── Memory map (three.js itself loads only when the map is shown) ──
62
- import { createLabelLayer } from './map-labels.js';
63
- import { createMapView } from './map-view.js';
64
- import { initMapControls } from './map-controls.js';
65
- import { fetchMap, requestRebuild } from './map-data.js';
66
-
19
+ import { initLoading, showLoadingError } from '../../shared/ui-loading.js';
20
+ import { loadMemoryList } from '../../shared/memory-list.js';
67
21
 
68
22
  // ═══════════════════════════════════════════
69
23
  // 1. REGISTER VARIANT
@@ -80,7 +34,7 @@ if (canonicalUrl !== window.location.pathname + window.location.search + window.
80
34
 
81
35
 
82
36
  // ═══════════════════════════════════════════
83
- // 2. TRANSLATIONS, SHARED HTML, HELP
37
+ // 2. TRANSLATIONS, SHARED HTML (the help section is app.js's)
84
38
  // ═══════════════════════════════════════════
85
39
 
86
40
  // Showcase mode (?showcase): the user's own content is blurred for product captures,
@@ -95,498 +49,21 @@ if (isShowcaseMode()) {
95
49
  await initI18n();
96
50
  injectSharedHTML();
97
51
 
98
- const helpRow = (keys, desc) =>
99
- `<div class="help-row"><div class="help-keys">${keys.map((k) => `<span class="help-key">${k}</span>`).join('')}</div><span class="help-desc">${desc}</span></div>`;
100
- registerHelpSection({
101
- order: 50,
102
- html: `<div class="help-section">
103
- <div class="help-section-title">${t('map.help.title')}</div>
104
- ${helpRow(['Drag'], t('map.help.orbit'))}
105
- ${helpRow(['Right-drag'], t('map.help.pan'))}
106
- ${helpRow(['Scroll'], t('map.help.zoom'))}
107
- ${helpRow(['←', '→', '↑', '↓'], t('map.help.keysPan'))}
108
- ${helpRow(['Shift', '←', '→'], t('map.help.keysOrbit'))}
109
- ${helpRow(['Click'], t('map.help.open'))}
110
- ${helpRow(['⌘/Ctrl', 'Click'], t('map.help.multi'))}
111
- ${helpRow(['Click name'], t('map.help.flyTo'))}
112
- ${helpRow(['H'], t('map.help.frameAll'))}
113
- ${helpRow(['Esc'], t('map.help.clear'))}
114
- <div class="help-row"><span class="help-desc">${t('map.help.legend')}</span></div>
115
- </div>`,
116
- });
117
-
118
-
119
- // ═══════════════════════════════════════════
120
- // 3. THE MAP
121
- // ═══════════════════════════════════════════
122
-
123
- let renderer = null;
124
- let labels = null;
125
- let view = null;
126
- let mapInit = null;
127
- let _vizEnabled = loadIfaceConfig().visualizationEnabled !== false;
128
- let _inFocusMode = false;
129
- let _bootComplete = false;
130
- const _seenCategories = new Set();
131
-
132
- function statusPill(container) {
133
- let el = document.getElementById('map-status');
134
- if (!el) {
135
- el = document.createElement('div');
136
- el.id = 'map-status';
137
- container.appendChild(el);
138
- }
139
- return el;
140
- }
141
-
142
- function showMapMessage(text) {
143
- const container = document.getElementById('graph-container');
144
- if (!container) return;
145
- const el = statusPill(container);
146
- el.textContent = text;
147
- el.classList.add('visible', 'error');
148
- }
149
-
150
- /** Create renderer, labels, view and input once; three.js is fetched here. */
151
- function ensureMap() {
152
- if (!mapInit) {
153
- mapInit = (async () => {
154
- const container = document.getElementById('graph-container');
155
- const { createMapRenderer } = await import('./map-renderer.js');
156
- labels = createLabelLayer(container);
157
- let v = null;
158
- renderer = createMapRenderer(container, {
159
- onFrame: (now) => (v ? v.drawLabels(now) : false),
160
- onSettle: () => v?.onSettle(),
161
- onResize: (w, h) => labels.resize(w, h),
162
- onMorphEnd: () => v?.onMorphEnd(),
163
- });
164
- labels.resize(renderer.size.width, renderer.size.height);
165
- v = createMapView({ renderer, labels, statusEl: statusPill(container), onMissingNodes: (ids) => addMissingMemories(ids) });
166
- initMapControls({ renderer, view: v, labels, onContextMenu: openMapMenu });
167
- view = v;
168
- applyRunState();
169
- syncMapMenuChecks();
170
- return v;
171
- })();
172
- mapInit.catch((err) => {
173
- console.error('[map] could not start:', err);
174
- showMapMessage(t('map.status.noWebgl'));
175
- });
176
- }
177
- return mapInit;
178
- }
179
-
180
- /** The map renders only while the visualisation is on and focus mode is off. */
181
- function applyRunState() {
182
- if (!view) return;
183
- if (_vizEnabled && !_inFocusMode) view.resume();
184
- else view.pause();
185
- }
186
-
187
-
188
- // ═══════════════════════════════════════════
189
- // 4. DATA
190
- // ═══════════════════════════════════════════
191
-
192
- const prefetch = window.__synPrefetch || {};
193
-
194
- async function fetchJson(url) {
195
- const res = await fetch(url);
196
- if (!res.ok) throw new Error(`HTTP ${res.status}`);
197
- return res.json();
198
- }
199
-
200
- function activateNewCategories(names) {
201
- for (const name of names) {
202
- if (_seenCategories.has(name)) continue;
203
- _seenCategories.add(name);
204
- state.activeCategories.add(name);
205
- }
206
- }
207
-
208
- // Memories the map already shows but the page has no data for (written through
209
- // MCP, which never broadcasts). A few are fetched one by one; the 23 MB list is
210
- // re-downloaded only when many are missing, and at most once a minute.
211
- const _missingAsked = new Map(); // id → when it was last requested
212
- let _lastFullReload = 0;
213
- async function addMissingMemories(ids) {
214
- const now = Date.now();
215
- if (!ids) {
216
- if (now - _lastFullReload < 60_000) return;
217
- _lastFullReload = now;
218
- scheduleReload();
219
- return;
220
- }
221
- const want = ids.filter((id) => now - (_missingAsked.get(id) || 0) > 60_000);
222
- if (!want.length) return;
223
- for (const id of want) _missingAsked.set(id, now);
224
- const fetched = [];
225
- for (let i = 0; i < want.length; i += 6) {
226
- const batch = await Promise.all(want.slice(i, i + 6).map((id) =>
227
- fetch(`/api/memory/${encodeURIComponent(id)}`).then((r) => (r.ok ? r.json() : null)).catch(() => null)));
228
- for (const m of batch) if (m?.id && m.payload) fetched.push({ id: m.id, payload: m.payload });
229
- }
230
- const known = new Set(state.allNodes.map((n) => n.id));
231
- const fresh = normalizeNodes(fetched).filter((n) => !known.has(n.id));
232
- if (!fresh.length) return;
233
- state.allNodes = [...fresh, ...state.allNodes]; // the list is newest-first
234
- const presentCats = new Set(state.allNodes.map((n) => n.payload.category));
235
- activateNewCategories([...presentCats]);
236
- buildCategorySidebar(presentCats);
237
- view?.hydrate();
238
- view?.refreshVisibility();
239
- updateStats();
240
- }
241
-
242
- let _reloadTimer = null;
243
- let _reloading = null;
244
- function scheduleReload() {
245
- if (_reloadTimer) return;
246
- _reloadTimer = setTimeout(() => { _reloadTimer = null; reloadMemories(); }, 300);
247
- }
248
-
249
- /** Refetch the memory list (slim payload) and the map (304 when unchanged). */
250
- async function reloadMemories() {
251
- if (_reloading) return _reloading;
252
- _reloading = (async () => {
253
- try {
254
- const data = await fetchJson('/api/memories?links=false&fields=graph');
255
- state.allNodes = normalizeNodes(data.nodes);
256
- state.allLinks = data.links || [];
257
- await loadCategories();
258
- const presentCats = new Set(state.allNodes.map((n) => n.payload.category));
259
- activateNewCategories([...presentCats, ...state.allCategoryNames]);
260
- buildCategorySidebar(presentCats);
261
- view?.hydrate();
262
- view?.refreshColors();
263
- view?.refreshVisibility();
264
- view?.refetch();
265
- updateStats();
266
- } catch (err) {
267
- console.error('data:reload failed:', err);
268
- } finally {
269
- _reloading = null;
270
- }
271
- })();
272
- return _reloading;
273
- }
274
-
275
- /** Old 3D renderer state that nothing reads any more. Idempotent. */
276
- function dropLegacy3dState() {
277
- try {
278
- posStore.removeItem(KEYS.NODE_POS_3D);
279
- for (const key of ['neural-gfx-config', 'neural-gfx-preset', 'neural-cam-hud-pinned', 'neural-cam-hud-pos', 'synabun-layout-version']) {
280
- storage.removeItem(key);
281
- }
282
- } catch {}
283
- }
284
-
285
-
286
- // ═══════════════════════════════════════════
287
- // 5. EVENT BUS
288
- // ═══════════════════════════════════════════
289
-
290
- on('graph:navigate', ({ node }) => { if (node) view?.select(node.id, { fly: true }); });
291
-
292
- on('node-selected', (node) => {
293
- if (!node) return;
294
- view?.select(node.id, { fly: true });
295
- openMemoryCard(node);
296
- });
297
-
298
- on('search:apply', ({ ids, results } = {}) => view?.applySearch(ids, results));
299
- on('search:clear', () => view?.clearSearch());
300
-
301
- // A category toggle emits links:dirty immediately and graph:refresh 600 ms later.
302
- on('links:dirty', () => view?.refreshVisibility());
303
- on('graph:refresh', () => { view?.refreshVisibility(); updateStats(); });
304
-
305
- const onCategoriesChanged = () => { view?.refreshColors(); view?.refreshVisibility(); };
306
- on('categories-changed', onCategoriesChanged);
307
- on('categories:changed', onCategoriesChanged);
308
- on('graph:nodeThreeObject', () => view?.refreshColors()); // a category colour changed
309
-
310
- on('data:reload', () => scheduleReload());
311
- on('graph:reload', () => scheduleReload());
312
-
313
- on('multiselect:cleared', () => view?.refreshVisibility());
314
- on('detail:opened', () => view?.syncSelectionFromState());
315
- on('detail:closed', () => view?.syncSelectionFromState());
316
-
317
- on('layout:reset', () => view?.frameAll());
318
- on('sync:map:updated', (msg) => view?.onServerUpdate(msg));
319
-
320
- on('workspace:get-scene', (callback) => callback(view ? view.getScene() : { nodePositions: {}, camera: null }));
321
- on('workspace:restore-scene', (scene) => view?.restoreScene(scene));
322
-
323
- // Visualisation off / focus mode (whiteboard): zero frames, no input.
324
- on('viz:toggle', (enabled) => {
325
- _vizEnabled = !!enabled;
326
- if (!_bootComplete) return;
327
- if (_vizEnabled && !view) {
328
- ensureMap().then(async (v) => {
329
- const json = await fetchMap().catch(() => null);
330
- if (json) { v.applyMap(json, { morph: false }); v.hydrate(); v.refreshVisibility(); v.frameAll(0); }
331
- }).catch(() => {});
332
- return;
333
- }
334
- applyRunState();
335
- });
336
- on('focus:enter', () => {
337
- _inFocusMode = true;
338
- state.hoveredNodeId = null;
339
- applyRunState();
340
- });
341
- on('focus:exit', () => {
342
- _inFocusMode = false;
343
- applyRunState();
344
- });
345
-
346
-
347
- // ═══════════════════════════════════════════
348
- // 6. DETAIL CARD CALLBACKS (the names ui-detail.js calls)
349
- // ═══════════════════════════════════════════
350
-
351
- setDetailCallbacks({
352
- applyGraphData: () => {
353
- view?.hydrate();
354
- view?.syncFocusFromState();
355
- view?.refreshVisibility();
356
- },
357
- updateStats: () => updateStats(),
358
- buildCategorySidebar: (cats) => buildCategorySidebar(cats),
359
- clearMultiSelect: () => clearMultiSelect(),
360
- fetchTrashItems: () => emit('trash:refresh'),
361
- refreshNodeAppearance: () => { view?.refreshColors(); view?.refreshVisibility(); },
362
- });
363
-
364
-
365
52
  // ═══════════════════════════════════════════
366
- // 7. MAP MENU + KEYS
53
+ // 3. THE LOADING OVERLAY, THEN THE APP
367
54
  // ═══════════════════════════════════════════
368
55
 
369
- const MAP_TOGGLES = { 'menu-map-neighbors': 'neighbors', 'menu-map-recency': 'recency', 'menu-map-grid': 'grid' };
56
+ // The overlay is the first frame. Its retry and Start Server buttons boot the app again once it has loaded; before
57
+ // that (the app's modules could not be fetched: the server went away mid-load) the page loads again.
58
+ let app = null;
59
+ initLoading({ onInit: () => (app ? app.boot() : window.location.reload()) });
370
60
 
371
- function syncMapMenuChecks() {
372
- const opts = view?.options;
373
- if (!opts) return;
374
- for (const [id, key] of Object.entries(MAP_TOGGLES)) document.getElementById(id)?.classList.toggle('active', !!opts[key]);
375
- }
376
-
377
- function wireMapMenu() {
378
- const click = (id, fn) => {
379
- const el = document.getElementById(id);
380
- if (el) el.addEventListener('click', () => { closeMenubar(); fn(el); });
381
- return el;
382
- };
383
- click('menu-map-frame-all', () => view?.frameAll());
384
- for (const [id, key] of Object.entries(MAP_TOGGLES)) {
385
- click(id, () => { if (!view) return; view.setOption(key, !view.options[key]); syncMapMenuChecks(); });
386
- }
387
- const rebuild = click('menu-map-rebuild', () => {
388
- requestRebuild().catch((err) => console.warn('[map] rebuild failed:', err?.message || err));
389
- });
390
- const syncGuest = () => { if (rebuild) rebuild.style.display = isGuest() ? 'none' : ''; };
391
- syncGuest();
392
- on('session:info', syncGuest);
393
- }
394
-
395
- registerAction('map-frame-all', () => view?.frameAll());
396
-
397
-
398
- // ═══════════════════════════════════════════
399
- // 8. CONTEXT MENU (shared/ui-context-menu.js)
400
- // ═══════════════════════════════════════════
401
- // A right-click (no drag) on the map opens the app's menu with the map's part on top: a memory, a name on the
402
- // map, or its empty space. The same functions as the map's clicks and Apps › Map.
403
-
404
- const mapActions = {
405
- frameAll: () => view?.frameAll(),
406
- toggleOption: (key) => { if (!view) return; view.setOption(key, !view.options[key]); syncMapMenuChecks(); },
407
- toggleSelect: (id) => view?.toggleMulti(id),
408
- flyToIsland: (name) => view?.flyToIsland(name),
409
- clearSearch: () => clearSearch(),
410
- clearSelection: () => view?.clearSelection(),
411
- };
412
-
413
- /** The map's part of the menu for what a press resolved to (map-controls.js resolve), null before the map exists. */
414
- function mapMenuArea(hit) {
415
- if (!view?.map) return null;
416
- if (hit && hit.i >= 0) {
417
- const d = view.describe(hit.i);
418
- if (d) {
419
- const island = view.map.islands[view.map.islandOf[hit.i]]?.name || d.category;
420
- return {
421
- kind: 'memory',
422
- memory: { id: d.id, onMap: true, island, selected: state.multiSelected.has(d.id) },
423
- act: { ...mapActions, openMemory: () => view.clickPoint(hit.i) },
424
- };
425
- }
426
- }
427
- const label = hit?.label && hit.label.type !== 'memory' ? hit.label : null;
428
- return {
429
- kind: 'map',
430
- map: { options: view.options, searching: view.searching, selected: !!view.selectedId, label, variant: '3d' },
431
- act: { ...mapActions, flyToLabel: () => label && view.clickLabel(label) },
432
- };
433
- }
434
-
435
- function openMapMenu({ clientX, clientY, hit }) {
436
- openAppContextMenu({ x: clientX, y: clientY, target: renderer?.canvas || null, area: mapMenuArea(hit),
437
- returnFocus: renderer?.canvas || null });
438
- }
439
-
440
- // From the keyboard (ContextMenu key, Shift+F10) on the focused map: the selected memory, else the map.
441
- registerContextMenuArea({
442
- id: 'memory-map',
443
- match(el) {
444
- if (!renderer || el !== renderer.canvas) return null;
445
- const i = view?.selectedId ? view.map?.indexOf.get(view.selectedId) : undefined;
446
- return mapMenuArea(i === undefined ? null : { i, label: null });
447
- },
61
+ import('./app.js').then((module) => { app = module; }, (err) => {
62
+ console.error('Init error:', err);
63
+ showLoadingError(t('loading.serverOffline'), t('loading.serverNotRunning'), false, true);
448
64
  });
449
65
 
450
-
451
- // ═══════════════════════════════════════════
452
- // 9. BOOT
453
- // ═══════════════════════════════════════════
454
-
455
- async function boot() {
456
- try {
457
- restoreInterfaceConfig();
458
- restoreSkin();
459
- dropLegacy3dState();
460
-
461
- try {
462
- const healthRes = await fetch('/api/health');
463
- const health = await healthRes.json();
464
- rememberHealth(health);
465
- if (!health.ok) {
466
- const messages = {
467
- db_missing: [t('loading.health.databaseUnreachable.title'), health.detail || t('loading.health.databaseUnreachable.sub')],
468
- db_error: [t('loading.health.databaseUnreachable.title'), health.detail || t('loading.health.databaseUnreachable.sub')],
469
- remote_unreachable: [t('loading.health.remoteUnreachable.title'), health.detail || t('loading.health.remoteUnreachable.sub')],
470
- auth_error: [t('loading.health.authError.title'), health.detail || t('loading.health.authError.sub')],
471
- };
472
- const [title, sub] = messages[health.reason] || [t('loading.health.connectionError.title'), health.detail || t('loading.health.connectionError.sub')];
473
- showLoadingError(title, sub, !!health.canAutoStart);
474
- return;
475
- }
476
- } catch {
477
- // /api/health failed — continue to try the data
478
- }
479
-
480
- const memoriesP = prefetch.memories || fetchJson('/api/memories?links=false&fields=graph');
481
- const mapP = prefetch.map || fetchMap().catch(() => null);
482
-
483
- // Categories first, so the first frame already has the sidebar's colours.
484
- await loadCategories();
485
-
486
- if (_vizEnabled) {
487
- try {
488
- const [v, mapJson] = await Promise.all([ensureMap(), mapP]);
489
- if (mapJson) {
490
- state.activeCategories = new Set([...state.allCategoryNames, ...mapJson.islands.map((i) => i.name)]);
491
- v.applyMap(mapJson, { morph: false });
492
- v.frameAll(0);
493
- hideLoading(150); // the map is up; the rest fills in behind it
494
- } else {
495
- showMapMessage(t('map.status.error'));
496
- }
497
- } catch {
498
- // ensureMap already reported it; the rest of the app still works
499
- }
500
- }
501
-
502
- const data = await memoriesP;
503
- if (data?.error) throw data.error;
504
- state.allNodes = normalizeNodes(data.nodes);
505
- state.allLinks = data.links || [];
506
- const presentCats = new Set(state.allNodes.map((n) => n.payload.category));
507
- state.activeCategories = new Set([...presentCats, ...state.allCategoryNames]);
508
- for (const name of state.activeCategories) _seenCategories.add(name);
509
- buildCategorySidebar(presentCats);
510
- view?.hydrate();
511
- view?.refreshVisibility();
512
- updateStats();
513
-
514
- emit('data-loaded', data);
515
- restoreOpenCards();
516
-
517
- // Recover a selected memory handed over by a legacy 2D tab
518
- const switchNodeId = sessionStorage.getItem('neural-selected-node-switch');
519
- if (switchNodeId) {
520
- sessionStorage.removeItem('neural-selected-node-switch');
521
- const node = state.allNodes.find((n) => n.id === switchNodeId);
522
- if (node) {
523
- openMemoryCard(node);
524
- view?.select(node.id, { fly: true });
525
- }
526
- }
527
-
528
- try { emit('trash:refresh'); } catch {}
529
- hideLoading(400);
530
- _bootComplete = true;
531
- // Painted: what the windows, menus and Settings wait for is read now, in idle time (launch-prefetch.js).
532
- startLaunchPrefetch({ isGuest });
533
- } catch (err) {
534
- console.error('Init error:', err);
535
- const isNetworkError = err.message === 'Failed to fetch' || err.name === 'TypeError';
536
- showLoadingError(
537
- isNetworkError ? t('loading.serverOffline') : t('loading.connectionFailed'),
538
- isNetworkError ? t('loading.serverNotRunning') : err.message,
539
- false,
540
- isNetworkError,
541
- );
542
- }
543
- }
544
-
545
-
546
- // ═══════════════════════════════════════════
547
- // 10. INIT ALL SHARED UI SYSTEMS
548
- // ═══════════════════════════════════════════
549
-
550
- initLoading({ onInit: boot });
551
- initKeybinds();
552
- initTooltip();
553
- initPanelSystem();
554
- initPinToggle();
555
- initNavbar();
556
- initMenubar();
557
- initSearch();
558
- initSidebar();
559
- initDetailPanel();
560
- initSettings();
561
- initTrash();
562
- initBookmarks();
563
- initResume();
564
- initWorkspaces();
565
- initInvite();
566
- initSync();
567
- initHelp();
568
- initMultiSelect();
569
- initStats();
570
- initExplorer();
571
- initFileExplorer();
572
- initSkillsStudio();
573
- initStyleGuide();
574
- initAutomationStudio();
575
- initSchedulesStudio();
576
- initNativeLoopRouter();
577
- initImageGallery();
578
- initScheduleQueue();
579
- initCommandRunner();
580
- initTerminal();
581
- initLink();
582
- clearGameOnLoad();
583
- initWhiteboard();
584
- initCostWidget();
585
- initGames();
586
- initTutorial();
587
- initAppContextMenu();
588
- wireMapMenu();
589
-
590
- window.addEventListener('resize', () => clampPanelsToViewport());
591
-
592
- boot();
66
+ // The memory list: index.html asked for its first page; the others are read now, one page at a time, while the app
67
+ // loads (shared/memory-list.js). boot() takes the whole list from here, in the shape the single answer had.
68
+ const prefetch = window.__synPrefetch || (window.__synPrefetch = {});
69
+ prefetch.memories = loadMemoryList({ first: prefetch.memories || null });
@@ -13,6 +13,7 @@ import { isGraphPointerActivity } from '../../shared/graph-activity.js';
13
13
  import { clearSearch } from '../../shared/ui-search.js';
14
14
  import { escapeHtml } from '../../shared/utils.js';
15
15
  import { frameRect } from '../../shared/app-frame.js';
16
+ import { openEscapeOverlay } from '../../shared/window-keys.js';
16
17
 
17
18
  const CLICK_SLOP = 5; // px a press may move and still count as a click
18
19
 
@@ -137,12 +138,13 @@ export function initMapControls({ renderer, view, labels, onContextMenu = null }
137
138
  view.frameAll();
138
139
  });
139
140
 
140
- // Esc: search first, then selection. Backs off whenever something else owns it.
141
+ // Esc: search first, then selection. Backs off whenever something else owns it: the focus is elsewhere, or a
142
+ // dialog, picker, menu or dropdown is open (the same list the whiteboard yields to: shared/window-keys.js).
141
143
  const onKeyDown = (e) => {
142
144
  if (e.key !== 'Escape' || e.defaultPrevented) return;
143
145
  const active = document.activeElement;
144
146
  const owned = active && active !== document.body && active !== canvas;
145
- if (owned || document.querySelector('.menubar-item.open, .modal-overlay.open, .settings-modal.open')) return;
147
+ if (owned || document.querySelector('.menubar-item.open, .modal-overlay.open, .settings-modal.open') || openEscapeOverlay(document)) return;
146
148
  if (view.searching) { clearSearch(); return; }
147
149
  if (view.selectedId) view.clearSelection();
148
150
  };