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
@@ -0,0 +1,206 @@
1
+ /**
2
+ * A run's own browser profile failed in that run: the run may not move to another profile (2026-11-15).
3
+ *
4
+ * Every start of a MoreLogin profile that is not running spends one of the plan's 20 daily launches. On 2026-11-15 at
5
+ * 21:13:36 run 8d50b0303fd3aabcdab1eceb52850b90, which had chosen P-4 itself (`morelogin use`, so not pinned), could
6
+ * not connect to P-4 ("Browser context management is not supported": MoreLogin listed P-4 running with no window); at
7
+ * 21:13:43 it called `morelogin use` with P-1 and its next browser call started P-1 (21:13:44, one launch). A pinned
8
+ * run is refused such a move already (PROFILE_PINNED); a run that chose its profile itself was not.
9
+ *
10
+ * Now a failure of the run's own profile (a start or a connection that failed in one of the run's acquisitions:
11
+ * server.js acquireSharedBrowserTab, an automation's POST /api/browser/sessions in the default profile, its own
12
+ * POST /api/morelogin/start of that profile) is noted for the run. While it holds, the run's `morelogin use` of any
13
+ * other profile, or back to the default browser when that is another profile or Chrome (POST /api/morelogin/use, which
14
+ * `browser_session create` with `moreloginProfile` calls too), and its `morelogin start` of another profile are
15
+ * refused with 409 PROFILE_FAILED_NO_SWITCH: which profile failed, when, why, and how to go on. Asking `use` for the
16
+ * failed profile itself is no move and stays allowed, and so does a start of it (that is how it is fixed).
17
+ *
18
+ * The bar lifts when:
19
+ * - the failed profile connects again in this run: an acquisition of the run lands in a session of that profile
20
+ * (the user started or fixed it, in MoreLogin or Settings → Connected tools → MoreLogin → Start, and the run's next
21
+ * browser call attached). A start that only reports success does not lift it: the connection must work;
22
+ * - the run no longer works in that profile because the owner moved it (profileSwitchDecision `lifted`): its
23
+ * effective profile (its pin, else the default AI browser) is not the failed one any more. The run cannot move
24
+ * itself while barred, so any such change is the owner's (a new default in Settings → Connected tools → MoreLogin);
25
+ * - the run ends (server.js forgetRunMoreLoginProfile, with its pin), or the entry is older than
26
+ * PROFILE_FAILURE_MAX_AGE_MS.
27
+ * The owner's own actions are never asked: the owner's page has no session to switch (POST /api/morelogin/use answers it
28
+ * SESSION_REQUIRED), and its Start, Stop and default change go through as before.
29
+ *
30
+ * State: in memory and in DATA_HOME/data/morelogin-profile-failures.json (a restart resumes runs: a barred run must stay
31
+ * barred), like the sessions' profile choices (lib/browser-profile-choices.js). Never throws.
32
+ */
33
+ import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
34
+ import { dirname } from 'node:path';
35
+
36
+ export const PROFILE_FAILED_NO_SWITCH = 'PROFILE_FAILED_NO_SWITCH';
37
+ /** Entries kept at most (the oldest go first). */
38
+ export const PROFILE_FAILURES_MAX = 500;
39
+ /** An entry older than this no longer bars anything (its run has long ended). */
40
+ export const PROFILE_FAILURE_MAX_AGE_MS = 7 * 24 * 60 * 60_000;
41
+
42
+ const OWNER_RE = /^[A-Za-z0-9_:-]{1,128}$/;
43
+ const cleanId = (value) => {
44
+ const id = value === null || value === undefined ? '' : String(value).trim();
45
+ return id && id.length <= 128 && !/[\u0000-\u001f]/.test(id) ? id : '';
46
+ };
47
+ const cleanText = (value, max) => (typeof value === 'string' ? value.replace(/[\u0000-\u001f]+/g, ' ').trim().slice(0, max) : '');
48
+
49
+ /** "2026-11-15 21:13:36 (UTC-03:00)": the local time a failure happened, to the second. */
50
+ export function formatFailureTime(ms) {
51
+ const d = new Date(ms);
52
+ const p = (n) => String(n).padStart(2, '0');
53
+ const off = -d.getTimezoneOffset();
54
+ const abs = Math.abs(off);
55
+ return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())} (UTC${off >= 0 ? '+' : '-'}${p(Math.floor(abs / 60))}:${p(abs % 60)})`;
56
+ }
57
+
58
+ /**
59
+ * The reason of a failure as the refusal quotes it: the failure's first sentence (a start error carries its whole
60
+ * advice after it), at most 240 characters, never empty.
61
+ */
62
+ export function failureReasonOf(text) {
63
+ const flat = cleanText(String(text ?? ''), 2000);
64
+ if (!flat) return 'no reason was given';
65
+ const first = flat.split(/(?<=[.!?])\s+(?=[A-Z])/)[0] || flat;
66
+ return first.length > 240 ? `${first.slice(0, 237).trimEnd()}…` : first;
67
+ }
68
+
69
+ /**
70
+ * What a switch of a run with this failure is: `none` (no failure held), `lifted` (the run no longer works in the
71
+ * failed profile: the owner moved it, so the failure is over), `same` (the target is the failed profile itself: no
72
+ * move) or `barred`. `current`: the run's effective profile now (an envId, or null for a browser that is no profile:
73
+ * Chrome, the mirror, the extension); `sameTarget`: whether what it asks for is the failed profile.
74
+ */
75
+ export function profileSwitchDecision({ failure = null, current = null, sameTarget = false } = {}) {
76
+ if (!failure?.envId) return 'none';
77
+ if ((current === null || current === undefined ? null : String(current)) !== String(failure.envId)) return 'lifted';
78
+ return sameTarget === true ? 'same' : 'barred';
79
+ }
80
+
81
+ /**
82
+ * Whether a `use` request's reference ({ envId, name, profile }, as POST /api/morelogin/use takes it) names the failed
83
+ * profile itself: its id, or its name without regard to case. Then it is no move, and the request is resolved and
84
+ * answered as usual; anything else is refused before MoreLogin is asked for its list.
85
+ */
86
+ export function namesFailedProfile(ref, failure) {
87
+ if (!failure?.envId || !ref || typeof ref !== 'object') return false;
88
+ const id = String(failure.envId);
89
+ const name = cleanText(failure.name, 200).toLowerCase();
90
+ const same = (value) => {
91
+ const text = value === null || value === undefined ? '' : cleanText(String(value), 200);
92
+ return !!text && (text === id || (!!name && text.toLowerCase() === name));
93
+ };
94
+ return same(ref.envId) || same(ref.name) || same(ref.profile);
95
+ }
96
+
97
+ /**
98
+ * The refusal of a run's switch after its own profile failed. `label` / `targetLabel`: how the failed profile and the
99
+ * target are named (`MoreLogin profile "P-4" (id)`, `the default browser`); `action`: 'use' (a move) or 'start' (a
100
+ * start of another profile). Code PROFILE_FAILED_NO_SWITCH, status 409, needsUser, with envId, failedAt, failedCode.
101
+ */
102
+ export function profileSwitchBarError(failure, { label = null, targetLabel = null, action = 'use' } = {}) {
103
+ const name = label || `profile ${failure?.envId}`;
104
+ const there = targetLabel || 'another profile';
105
+ const when = Number.isFinite(Number(failure?.at)) ? formatFailureTime(Number(failure.at)) : 'an earlier moment';
106
+ const why = failureReasonOf(failure?.reason);
107
+ const code = failure?.code ? `${failure.code}: ` : '';
108
+ const starting = action === 'start';
109
+ const e = new Error(`This run cannot ${starting ? 'start' : 'move to'} ${there}: its own profile, ${name}, failed in this run at ${when} (${code}${why}). After its own profile fails, a run does not ${starting ? 'start another profile or move to one' : 'switch to another profile or browser'}: each start of another MoreLogin profile spends one of the plan's daily launches, and the run's work belongs in its own profile. Nothing was ${starting ? 'started' : 'changed'}: the run still works in ${name}. To go on, the user starts or fixes ${name} (in MoreLogin, or SynaBun → Settings → Connected tools → MoreLogin → Start); the run's next browser call then connects to it, and from then on it may switch again. Otherwise the owner moves the run (where it is set up, or the default in Settings → Connected tools → MoreLogin (Default AI browser)). This needs the user, not a retry: report it and stop`);
110
+ e.code = PROFILE_FAILED_NO_SWITCH;
111
+ e.status = 409;
112
+ e.needsUser = true;
113
+ e.envId = String(failure?.envId ?? '');
114
+ if (Number.isFinite(Number(failure?.at))) e.failedAt = new Date(Number(failure.at)).toISOString();
115
+ if (failure?.code) e.failedCode = String(failure.code);
116
+ return e;
117
+ }
118
+
119
+ /**
120
+ * The failures file. Every method is synchronous and never throws: a file that cannot be read holds no failures, and a
121
+ * write that fails is logged and leaves the entry in memory (it bars until a restart).
122
+ * @param {{ file?: string|null, now?: () => number, log?: (line: string) => void, max?: number, maxAgeMs?: number }} opts
123
+ */
124
+ export function createProfileFailureStore({ file = null, now = Date.now, log = () => {}, max = PROFILE_FAILURES_MAX, maxAgeMs = PROFILE_FAILURE_MAX_AGE_MS } = {}) {
125
+ /** ownerKey → { envId, name, at, code, reason }, oldest first. */
126
+ let rows = null;
127
+
128
+ const fresh = (row) => row && Number.isFinite(Number(row.at)) && now() - Number(row.at) < maxAgeMs;
129
+
130
+ function read() {
131
+ const out = new Map();
132
+ try {
133
+ if (!file || !existsSync(file)) return out;
134
+ const data = JSON.parse(readFileSync(file, 'utf-8'));
135
+ const list = data && typeof data === 'object' && data.failures && typeof data.failures === 'object' ? Object.entries(data.failures) : [];
136
+ for (const [owner, row] of list.filter(([owner, row]) => OWNER_RE.test(owner) && fresh(row)).sort((a, b) => Number(a[1].at) - Number(b[1].at))) {
137
+ const envId = cleanId(row.envId);
138
+ if (!envId) continue;
139
+ out.set(owner, { envId, name: cleanText(row.name, 200) || null, at: Number(row.at), code: cleanText(row.code, 64) || null, reason: cleanText(row.reason, 600) || null });
140
+ }
141
+ } catch (error) {
142
+ log(`the runs' failed browser profiles could not be read (${error?.message || error}): no run is barred from switching`);
143
+ }
144
+ return out;
145
+ }
146
+
147
+ function write() {
148
+ if (!file) return;
149
+ try {
150
+ mkdirSync(dirname(file), { recursive: true });
151
+ const temp = `${file}.${process.pid}.tmp`;
152
+ writeFileSync(temp, JSON.stringify({ version: 1, failures: Object.fromEntries(rows) }, null, 2), { mode: 0o600 });
153
+ renameSync(temp, file);
154
+ } catch (error) {
155
+ log(`a run's failed browser profile was not saved (${error?.message || error}): it bars the run until the server restarts`);
156
+ }
157
+ }
158
+
159
+ const loaded = () => (rows ||= read());
160
+ const copy = (row) => ({ ...row });
161
+
162
+ return {
163
+ /** The failure held for `ownerKey` ({ envId, name, at, code, reason }), or null. An expired one is dropped. */
164
+ get(ownerKey) {
165
+ const map = loaded();
166
+ const row = map.get(String(ownerKey || ''));
167
+ if (!row) return null;
168
+ if (!fresh(row)) { map.delete(String(ownerKey)); write(); return null; }
169
+ return copy(row);
170
+ },
171
+ /**
172
+ * `ownerKey`'s own profile `envId` failed now (or at `at`). A later failure replaces an earlier one (the newest
173
+ * profile and reason are what the refusal names). Returns the entry, or null when nothing was noted.
174
+ */
175
+ note(ownerKey, { envId, name = null, code = null, reason = null, at = now() } = {}) {
176
+ const owner = String(ownerKey || '');
177
+ const id = cleanId(envId);
178
+ if (!OWNER_RE.test(owner) || !id) return null;
179
+ const map = loaded();
180
+ const row = { envId: id, name: cleanText(name, 200) || null, at: Number.isFinite(Number(at)) ? Number(at) : now(), code: cleanText(code, 64) || null, reason: cleanText(reason, 600) || null };
181
+ map.delete(owner); // newest last
182
+ map.set(owner, row);
183
+ while (map.size > max) map.delete(map.keys().next().value);
184
+ write();
185
+ return copy(row);
186
+ },
187
+ /**
188
+ * The failure of `ownerKey` is over: always, or only when it is about `envId` (a connection to another profile
189
+ * says nothing about the failed one). Returns the entry that was dropped, or null.
190
+ */
191
+ clear(ownerKey, { envId = null } = {}) {
192
+ const map = loaded();
193
+ const owner = String(ownerKey || '');
194
+ const row = map.get(owner);
195
+ if (!row) return null;
196
+ if (envId !== null && envId !== undefined && String(envId) !== row.envId) return null;
197
+ map.delete(owner);
198
+ write();
199
+ return copy(row);
200
+ },
201
+ /** Every failure held now: [ownerKey, entry], oldest first. */
202
+ entries() {
203
+ return [...loaded()].filter(([, row]) => fresh(row)).map(([owner, row]) => [owner, copy(row)]);
204
+ },
205
+ };
206
+ }
@@ -0,0 +1,160 @@
1
+ /**
2
+ * MoreLogin's daily start quota, remembered per profile (2026-11-15).
3
+ *
4
+ * MoreLogin's plan caps how many profile launches an account makes per day: past it, `/api/env/start` answers code
5
+ * 19124 ("The daily startup limit is exceeded. Please upgrade the package to increase the daily limit."). About 90
6
+ * scheduled runs a day share one profile, and each failed run asked for a start at least twice (strategy 2 of
7
+ * acquireSharedBrowserTab, then the recover / create paths), so the whole afternoon kept asking MoreLogin for starts
8
+ * it had already refused. Once a start of a profile is refused for the plan's limit, SynaBun does not ask MoreLogin to
9
+ * start that profile again until MoreLogin's next day: every start fails at once with the same error
10
+ * (MORELOGIN_START_REFUSED, the same apiCode / planLimit / needsUser) and the reset time.
11
+ *
12
+ * When MoreLogin's day starts, found from MoreLogin's own logs (`~/Library/Application Support/MoreLogin/logs`):
13
+ * every launch is an `envkit.*.log` line "get shop detail:-{"id":"<envId>",…}" (one `main.*.log` "onopensucceedbrower"
14
+ * each). Today's (2026-11-15) first refusal was at 15:02:54 local time (UTC-03:00, 18:02:54 UTC), 33 s after the
15
+ * last launch that worked (15:02:21). Launches counted before it, per candidate day:
16
+ * - local day (UTC-03:00, from 03:00 UTC): 13 today (plus an unlogged stretch 00:00-02:57 local), while the
17
+ * local day 2026-11-14 had 23 launches that all worked: not a cap of 20;
18
+ * - UTC+8 day (from 16:00 UTC, 13:00 local): only 5 launches in the window that refused, while the UTC+8 day before
19
+ * it took 24: ruled out;
20
+ * - UTC day (from 00:00 UTC, 21:00 local): 18 logged today plus the unlogged stretch, and no earlier UTC day above
21
+ * 19 (11-08: 6, 11-09: 2, 11-10: 16, 11-11: 17, 11-12: 5, 11-13: 9, 11-14: 19). MoreLogin's own counter read
22
+ * "5/20" just before the launch of 2026-11-14 03:08:48 local and "6/20" after it: 5 is exactly the count of that
23
+ * UTC day so far (the local day had 4).
24
+ * So the quota is 20 launches per UTC day for the account, and it resets at 00:00 UTC. A launch is spent only when the
25
+ * profile is not running already (startProfile asks the status first and attaches to a running profile).
26
+ *
27
+ * A refusal right after a reset (within RESET_SLACK_MS) holds only RESET_SLACK_MS: MoreLogin's clock may be a little
28
+ * behind ours, and a whole day's wait for that would be wrong.
29
+ *
30
+ * State: in memory, and in DATA_HOME/data/morelogin-start-cooldowns.json (another process, such as fetch-deals.mjs,
31
+ * and the next start of the server read the same). Only a plan-limit refusal is kept; any other refusal is not.
32
+ * The copy in memory is read again whenever the file changed under it (its size or modification time), so a refusal
33
+ * another process noted holds here too, and a save never writes over an entry another process added meanwhile.
34
+ */
35
+ import { mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs';
36
+ import { dirname, join } from 'node:path';
37
+ import { getDataHome } from '../../lib/paths.js';
38
+
39
+ export const RESET_SLACK_MS = 15 * 60_000;
40
+ const MAX_ENTRIES = 200;
41
+ const DAY_MS = 24 * 60 * 60_000;
42
+
43
+ /** The file the cooldowns live in (read through getDataHome each time: SYNABUN_DATA_HOME decides, tests use a temp one). */
44
+ export function cooldownFile() {
45
+ return join(getDataHome(), 'data', 'morelogin-start-cooldowns.json');
46
+ }
47
+
48
+ /** The first 00:00 UTC after `at` (ms): when MoreLogin's daily start quota resets. */
49
+ export function nextMoreLoginDayReset(at = Date.now()) {
50
+ return (Math.floor(at / DAY_MS) + 1) * DAY_MS;
51
+ }
52
+
53
+ /** Until when a refusal at `at` holds: the next reset, or RESET_SLACK_MS when the last reset was only just now. */
54
+ export function cooldownUntil(at = Date.now()) {
55
+ const lastReset = Math.floor(at / DAY_MS) * DAY_MS;
56
+ if (at - lastReset < RESET_SLACK_MS) return at + RESET_SLACK_MS;
57
+ return nextMoreLoginDayReset(at);
58
+ }
59
+
60
+ /** A time in the computer's own zone, as people read it: "2026-11-15 21:00 (UTC-03:00)". */
61
+ export function formatLocalTime(ms) {
62
+ const d = new Date(ms);
63
+ const p = (n) => String(n).padStart(2, '0');
64
+ const off = -d.getTimezoneOffset();
65
+ const sign = off >= 0 ? '+' : '-';
66
+ const abs = Math.abs(off);
67
+ return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())} (UTC${sign}${p(Math.floor(abs / 60))}:${p(abs % 60)})`;
68
+ }
69
+
70
+ let _entries = null; // envId → { envId, since, until, apiCode, reason }
71
+ let _loadedFrom = null;
72
+ let _loadedStamp = null; // the file's size and modification time when it was last read or written here
73
+
74
+ /** What tells one version of the file from the next: 'none' while there is none. */
75
+ function fileStamp(file) {
76
+ try { const s = statSync(file); return `${s.size}:${s.mtimeMs}`; } catch { return 'none'; }
77
+ }
78
+
79
+ function load() {
80
+ const file = cooldownFile();
81
+ const stamp = fileStamp(file);
82
+ if (_entries && _loadedFrom === file && _loadedStamp === stamp) return _entries;
83
+ _entries = new Map();
84
+ _loadedFrom = file;
85
+ _loadedStamp = stamp;
86
+ try {
87
+ const raw = JSON.parse(readFileSync(file, 'utf8'));
88
+ for (const e of Array.isArray(raw?.cooldowns) ? raw.cooldowns : []) {
89
+ const until = Number(e?.until);
90
+ if (!e?.envId || !Number.isFinite(until)) continue;
91
+ _entries.set(String(e.envId), {
92
+ envId: String(e.envId), since: Number(e.since) || null, until,
93
+ apiCode: e.apiCode ?? null, reason: typeof e.reason === 'string' ? e.reason.slice(0, 500) : '',
94
+ });
95
+ }
96
+ } catch { /* none yet, or unreadable: no cooldown (a start is asked, and a refusal writes it again) */ }
97
+ return _entries;
98
+ }
99
+
100
+ function save() {
101
+ const file = cooldownFile();
102
+ try {
103
+ mkdirSync(dirname(file), { recursive: true });
104
+ const tmp = `${file}.${process.pid}.tmp`;
105
+ writeFileSync(tmp, JSON.stringify({ version: 1, cooldowns: [..._entries.values()] }, null, 2) + '\n', { mode: 0o600 });
106
+ renameSync(tmp, file);
107
+ // What this process wrote is what it holds: not read back on the next call.
108
+ _loadedStamp = fileStamp(file);
109
+ } catch (err) {
110
+ console.warn(`[morelogin] could not save the start cooldowns (${err?.message || err}); they hold in memory until a restart`);
111
+ }
112
+ }
113
+
114
+ function prune(now) {
115
+ let changed = false;
116
+ for (const [id, e] of load()) if (!(e.until > now)) { _entries.delete(id); changed = true; }
117
+ return changed;
118
+ }
119
+
120
+ /**
121
+ * Note a refused start. Kept only for a plan-limit refusal (`err.planLimit`): returns the entry, or null.
122
+ */
123
+ export function noteStartRefusal(envId, err, now = Date.now()) {
124
+ if (!envId || !err?.planLimit) return null;
125
+ const entries = load();
126
+ prune(now);
127
+ const reason = String(err.reason || err.message || '').slice(0, 500);
128
+ const entry = { envId: String(envId), since: now, until: cooldownUntil(now), apiCode: err.apiCode ?? null, reason };
129
+ entries.delete(entry.envId); // newest last
130
+ entries.set(entry.envId, entry);
131
+ while (entries.size > MAX_ENTRIES) entries.delete(entries.keys().next().value);
132
+ save();
133
+ return { ...entry };
134
+ }
135
+
136
+ /** The cooldown that holds for a profile now, or null. */
137
+ export function activeStartCooldown(envId, now = Date.now()) {
138
+ if (!envId) return null;
139
+ const e = load().get(String(envId));
140
+ if (!e) return null;
141
+ if (!(e.until > now)) { _entries.delete(String(envId)); save(); return null; }
142
+ return { ...e };
143
+ }
144
+
145
+ /** Every cooldown that holds now: [{ envId, since, until, apiCode, reason, resetAt, resetLocal }]. */
146
+ export function listStartCooldowns(now = Date.now()) {
147
+ if (prune(now)) save();
148
+ return [...load().values()].map((e) => ({ ...e, resetAt: new Date(e.until).toISOString(), resetLocal: formatLocalTime(e.until) }));
149
+ }
150
+
151
+ /** End a profile's cooldown (a start that worked: the quota was reset or raised). */
152
+ export function clearStartCooldown(envId) {
153
+ if (!envId) return false;
154
+ const had = load().delete(String(envId));
155
+ if (had) save();
156
+ return had;
157
+ }
158
+
159
+ /** Forget what is held in memory: the next call reads the file again (what a new process or a reload sees). */
160
+ export function _reloadStartCooldownsForTests() { _entries = null; _loadedFrom = null; }