synabun 2.2.2 → 2.3.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 (276) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/docs/whatsapp.md +52 -20
  4. package/lib/mcp-build.js +519 -0
  5. package/lib/mcp-dist.js +10 -4
  6. package/lib/server-supervisor.js +7 -1
  7. package/lib/virustotal.mjs +4 -2
  8. package/mcp-server/dist/http.d.ts +38 -0
  9. package/mcp-server/dist/http.d.ts.map +1 -1
  10. package/mcp-server/dist/http.js +75 -7
  11. package/mcp-server/dist/http.js.map +1 -1
  12. package/mcp-server/dist/services/browser-route-flow.d.ts +3 -2
  13. package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
  14. package/mcp-server/dist/services/browser-route-flow.js +4 -3
  15. package/mcp-server/dist/services/browser-route-flow.js.map +1 -1
  16. package/mcp-server/dist/services/embedding-service.d.ts.map +1 -1
  17. package/mcp-server/dist/services/embedding-service.js +2 -1
  18. package/mcp-server/dist/services/embedding-service.js.map +1 -1
  19. package/mcp-server/dist/services/neural-interface.d.ts +21 -0
  20. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  21. package/mcp-server/dist/services/neural-interface.js +76 -4
  22. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  23. package/mcp-server/dist/services/tool-catalog.js +2 -2
  24. package/mcp-server/dist/services/tool-catalog.js.map +1 -1
  25. package/mcp-server/dist/tools/agents.d.ts +3 -2
  26. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  27. package/mcp-server/dist/tools/agents.js +6 -4
  28. package/mcp-server/dist/tools/agents.js.map +1 -1
  29. package/mcp-server/dist/tools/browser-advanced.d.ts +3 -1
  30. package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
  31. package/mcp-server/dist/tools/browser-advanced.js +30 -8
  32. package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
  33. package/mcp-server/dist/tools/browser-navigate.d.ts +3 -3
  34. package/mcp-server/dist/tools/browser-navigate.d.ts.map +1 -1
  35. package/mcp-server/dist/tools/browser-navigate.js +19 -16
  36. package/mcp-server/dist/tools/browser-navigate.js.map +1 -1
  37. package/mcp-server/dist/tools/browser-observe.d.ts +2 -1
  38. package/mcp-server/dist/tools/browser-observe.d.ts.map +1 -1
  39. package/mcp-server/dist/tools/browser-observe.js +61 -20
  40. package/mcp-server/dist/tools/browser-observe.js.map +1 -1
  41. package/mcp-server/dist/tools/morelogin.d.ts +13 -3
  42. package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
  43. package/mcp-server/dist/tools/morelogin.js +81 -20
  44. package/mcp-server/dist/tools/morelogin.js.map +1 -1
  45. package/mcp-server/dist/tools/youtube/upload.d.ts.map +1 -1
  46. package/mcp-server/dist/tools/youtube/upload.js +225 -88
  47. package/mcp-server/dist/tools/youtube/upload.js.map +1 -1
  48. package/mcp-server/package-lock.json +2 -2
  49. package/mcp-server/package.json +1 -1
  50. package/mcp-server/src/http.ts +79 -7
  51. package/mcp-server/src/services/browser-route-flow.ts +4 -3
  52. package/mcp-server/src/services/embedding-service.ts +2 -1
  53. package/mcp-server/src/services/neural-interface.ts +77 -4
  54. package/mcp-server/src/services/tool-catalog.ts +2 -2
  55. package/mcp-server/src/tools/agents.ts +8 -4
  56. package/mcp-server/src/tools/browser-advanced.ts +29 -8
  57. package/mcp-server/src/tools/browser-navigate.ts +19 -16
  58. package/mcp-server/src/tools/browser-observe.ts +62 -20
  59. package/mcp-server/src/tools/morelogin.ts +81 -20
  60. package/mcp-server/src/tools/youtube/upload.ts +218 -99
  61. package/neural-interface/i18n/en.json +631 -123
  62. package/neural-interface/i18n/pt-BR.json +518 -10
  63. package/neural-interface/lib/assistant-api.js +26 -0
  64. package/neural-interface/lib/assistant-brains/claude.js +5 -0
  65. package/neural-interface/lib/assistant-catalog.js +114 -1
  66. package/neural-interface/lib/assistant-dispatch.js +71 -1
  67. package/neural-interface/lib/assistant-persona.js +14 -7
  68. package/neural-interface/lib/assistant-router.js +6 -4
  69. package/neural-interface/lib/assistant-runtime.js +3 -0
  70. package/neural-interface/lib/assistant-task-prompt.js +5 -0
  71. package/neural-interface/lib/automation-approval.js +249 -0
  72. package/neural-interface/lib/automation-browser-owner-access.js +82 -0
  73. package/neural-interface/lib/backup-service.js +16 -1
  74. package/neural-interface/lib/browser-background-tab.js +72 -3
  75. package/neural-interface/lib/browser-extraction.js +106 -45
  76. package/neural-interface/lib/browser-profile-choices.js +143 -0
  77. package/neural-interface/lib/browser-profiles.js +142 -0
  78. package/neural-interface/lib/browser-tab-recovery.js +153 -0
  79. package/neural-interface/lib/browser-tool-policy.js +2 -0
  80. package/neural-interface/lib/chromium-on-device-model.js +67 -0
  81. package/neural-interface/lib/claude-agent-bridge.js +7 -4
  82. package/neural-interface/lib/claude-model-catalog.js +12 -0
  83. package/neural-interface/lib/effort-levels.js +28 -2
  84. package/neural-interface/lib/local-profile-proxy.js +362 -0
  85. package/neural-interface/lib/local-profiles.js +929 -0
  86. package/neural-interface/lib/loop-logger.js +25 -4
  87. package/neural-interface/lib/maritaca/api.js +179 -0
  88. package/neural-interface/lib/maritaca/attachments.js +44 -0
  89. package/neural-interface/lib/maritaca/client.js +362 -0
  90. package/neural-interface/lib/maritaca/key-store.js +122 -0
  91. package/neural-interface/lib/maritaca/models.js +181 -0
  92. package/neural-interface/lib/maritaca/modes.js +39 -0
  93. package/neural-interface/lib/maritaca/opencode-proxy.js +236 -0
  94. package/neural-interface/lib/maritaca/opencode-stream.js +345 -0
  95. package/neural-interface/lib/maritaca/opencode.js +218 -0
  96. package/neural-interface/lib/maritaca/panel-bridge.js +273 -0
  97. package/neural-interface/lib/maritaca/sessions.js +198 -0
  98. package/neural-interface/lib/morelogin-agent-profiles.js +149 -0
  99. package/neural-interface/lib/morelogin.js +278 -14
  100. package/neural-interface/lib/native-loop-providers.js +3 -1
  101. package/neural-interface/lib/owner-authority.js +30 -12
  102. package/neural-interface/lib/page-session.js +43 -17
  103. package/neural-interface/lib/request-gate.js +2 -0
  104. package/neural-interface/lib/system-activity.js +1 -1
  105. package/neural-interface/lib/terminal-tokens.js +82 -5
  106. package/neural-interface/package-lock.json +3 -2
  107. package/neural-interface/package.json +2 -1
  108. package/neural-interface/public/assets/mascot/README.md +11 -0
  109. package/neural-interface/public/assets/mascot/ask.gif +0 -0
  110. package/neural-interface/public/assets/mascot/ask.png +0 -0
  111. package/neural-interface/public/assets/mascot/blocked.gif +0 -0
  112. package/neural-interface/public/assets/mascot/blocked.png +0 -0
  113. package/neural-interface/public/assets/mascot/budget.gif +0 -0
  114. package/neural-interface/public/assets/mascot/budget.png +0 -0
  115. package/neural-interface/public/assets/mascot/computer.gif +0 -0
  116. package/neural-interface/public/assets/mascot/computer.png +0 -0
  117. package/neural-interface/public/assets/mascot/edit.gif +0 -0
  118. package/neural-interface/public/assets/mascot/edit.png +0 -0
  119. package/neural-interface/public/assets/mascot/error.gif +0 -0
  120. package/neural-interface/public/assets/mascot/error.png +0 -0
  121. package/neural-interface/public/assets/mascot/hover-attention.gif +0 -0
  122. package/neural-interface/public/assets/mascot/hover-attention.png +0 -0
  123. package/neural-interface/public/assets/mascot/idle-hero.gif +0 -0
  124. package/neural-interface/public/assets/mascot/idle-hero.png +0 -0
  125. package/neural-interface/public/assets/mascot/idle.gif +0 -0
  126. package/neural-interface/public/assets/mascot/idle.png +0 -0
  127. package/neural-interface/public/assets/mascot/manifest.json +254 -0
  128. package/neural-interface/public/assets/mascot/mcp.gif +0 -0
  129. package/neural-interface/public/assets/mascot/mcp.png +0 -0
  130. package/neural-interface/public/assets/mascot/memory.gif +0 -0
  131. package/neural-interface/public/assets/mascot/memory.png +0 -0
  132. package/neural-interface/public/assets/mascot/offline.gif +0 -0
  133. package/neural-interface/public/assets/mascot/offline.png +0 -0
  134. package/neural-interface/public/assets/mascot/pick.gif +0 -0
  135. package/neural-interface/public/assets/mascot/pick.png +0 -0
  136. package/neural-interface/public/assets/mascot/plan.gif +0 -0
  137. package/neural-interface/public/assets/mascot/plan.png +0 -0
  138. package/neural-interface/public/assets/mascot/present.gif +0 -0
  139. package/neural-interface/public/assets/mascot/present.png +0 -0
  140. package/neural-interface/public/assets/mascot/project.gif +0 -0
  141. package/neural-interface/public/assets/mascot/project.png +0 -0
  142. package/neural-interface/public/assets/mascot/read.gif +0 -0
  143. package/neural-interface/public/assets/mascot/read.png +0 -0
  144. package/neural-interface/public/assets/mascot/runs.gif +0 -0
  145. package/neural-interface/public/assets/mascot/runs.png +0 -0
  146. package/neural-interface/public/assets/mascot/scenes/automation.gif +0 -0
  147. package/neural-interface/public/assets/mascot/scenes/automation.png +0 -0
  148. package/neural-interface/public/assets/mascot/scenes/browser.gif +0 -0
  149. package/neural-interface/public/assets/mascot/scenes/browser.png +0 -0
  150. package/neural-interface/public/assets/mascot/scenes/code.gif +0 -0
  151. package/neural-interface/public/assets/mascot/scenes/code.png +0 -0
  152. package/neural-interface/public/assets/mascot/scenes/complex.gif +0 -0
  153. package/neural-interface/public/assets/mascot/scenes/complex.png +0 -0
  154. package/neural-interface/public/assets/mascot/scenes/computer.gif +0 -0
  155. package/neural-interface/public/assets/mascot/scenes/computer.png +0 -0
  156. package/neural-interface/public/assets/mascot/scenes/design.gif +0 -0
  157. package/neural-interface/public/assets/mascot/scenes/design.png +0 -0
  158. package/neural-interface/public/assets/mascot/scenes/edit.gif +0 -0
  159. package/neural-interface/public/assets/mascot/scenes/edit.png +0 -0
  160. package/neural-interface/public/assets/mascot/scenes/generic.gif +0 -0
  161. package/neural-interface/public/assets/mascot/scenes/generic.png +0 -0
  162. package/neural-interface/public/assets/mascot/scenes/image_gen.gif +0 -0
  163. package/neural-interface/public/assets/mascot/scenes/image_gen.png +0 -0
  164. package/neural-interface/public/assets/mascot/scenes/manifest.json +173 -0
  165. package/neural-interface/public/assets/mascot/scenes/memory.gif +0 -0
  166. package/neural-interface/public/assets/mascot/scenes/memory.png +0 -0
  167. package/neural-interface/public/assets/mascot/scenes/quick.gif +0 -0
  168. package/neural-interface/public/assets/mascot/scenes/quick.png +0 -0
  169. package/neural-interface/public/assets/mascot/scenes/read.gif +0 -0
  170. package/neural-interface/public/assets/mascot/scenes/read.png +0 -0
  171. package/neural-interface/public/assets/mascot/scenes/research.gif +0 -0
  172. package/neural-interface/public/assets/mascot/scenes/research.png +0 -0
  173. package/neural-interface/public/assets/mascot/scenes/review.gif +0 -0
  174. package/neural-interface/public/assets/mascot/scenes/review.png +0 -0
  175. package/neural-interface/public/assets/mascot/scenes/search.gif +0 -0
  176. package/neural-interface/public/assets/mascot/scenes/search.png +0 -0
  177. package/neural-interface/public/assets/mascot/scenes/shell.gif +0 -0
  178. package/neural-interface/public/assets/mascot/scenes/shell.png +0 -0
  179. package/neural-interface/public/assets/mascot/scenes/thinking.gif +0 -0
  180. package/neural-interface/public/assets/mascot/scenes/thinking.png +0 -0
  181. package/neural-interface/public/assets/mascot/scenes/video_gen.gif +0 -0
  182. package/neural-interface/public/assets/mascot/scenes/video_gen.png +0 -0
  183. package/neural-interface/public/assets/mascot/scenes/web.gif +0 -0
  184. package/neural-interface/public/assets/mascot/scenes/web.png +0 -0
  185. package/neural-interface/public/assets/mascot/search.gif +0 -0
  186. package/neural-interface/public/assets/mascot/search.png +0 -0
  187. package/neural-interface/public/assets/mascot/shell.gif +0 -0
  188. package/neural-interface/public/assets/mascot/shell.png +0 -0
  189. package/neural-interface/public/assets/mascot/skill.gif +0 -0
  190. package/neural-interface/public/assets/mascot/skill.png +0 -0
  191. package/neural-interface/public/assets/mascot/sleep.gif +0 -0
  192. package/neural-interface/public/assets/mascot/sleep.png +0 -0
  193. package/neural-interface/public/assets/mascot/subagent.gif +0 -0
  194. package/neural-interface/public/assets/mascot/subagent.png +0 -0
  195. package/neural-interface/public/assets/mascot/success.gif +0 -0
  196. package/neural-interface/public/assets/mascot/success.png +0 -0
  197. package/neural-interface/public/assets/mascot/think.gif +0 -0
  198. package/neural-interface/public/assets/mascot/think.png +0 -0
  199. package/neural-interface/public/assets/mascot/wait.gif +0 -0
  200. package/neural-interface/public/assets/mascot/wait.png +0 -0
  201. package/neural-interface/public/assets/mascot/watch.gif +0 -0
  202. package/neural-interface/public/assets/mascot/watch.png +0 -0
  203. package/neural-interface/public/assets/mascot/web.gif +0 -0
  204. package/neural-interface/public/assets/mascot/web.png +0 -0
  205. package/neural-interface/public/onboarding.html +14 -1
  206. package/neural-interface/public/shared/agent-runtime-options.js +49 -8
  207. package/neural-interface/public/shared/agy/agy-panel.js +2 -2
  208. package/neural-interface/public/shared/api.js +4 -4
  209. package/neural-interface/public/shared/assistant/asst-ask-styles.js +8 -8
  210. package/neural-interface/public/shared/assistant/asst-ask.js +1 -1
  211. package/neural-interface/public/shared/assistant/asst-brain-picker.js +99 -9
  212. package/neural-interface/public/shared/assistant/asst-control.js +1 -1
  213. package/neural-interface/public/shared/assistant/asst-limit-wait.js +4 -4
  214. package/neural-interface/public/shared/assistant/asst-panel.js +6 -2
  215. package/neural-interface/public/shared/assistant/asst-rack-styles.js +4 -4
  216. package/neural-interface/public/shared/assistant/asst-render.js +6 -6
  217. package/neural-interface/public/shared/assistant/asst-route-models.js +64 -4
  218. package/neural-interface/public/shared/assistant/asst-route.js +24 -7
  219. package/neural-interface/public/shared/assistant/asst-routes-editor.js +154 -39
  220. package/neural-interface/public/shared/assistant/asst-run-stage.js +3 -3
  221. package/neural-interface/public/shared/assistant/asst-scene-styles.js +8 -111
  222. package/neural-interface/public/shared/assistant/asst-scenes.js +46 -318
  223. package/neural-interface/public/shared/assistant/asst-sidepanel.js +2 -2
  224. package/neural-interface/public/shared/assistant/asst-state.js +72 -2
  225. package/neural-interface/public/shared/assistant/asst-styles.js +58 -14
  226. package/neural-interface/public/shared/automation-approval-view.js +75 -0
  227. package/neural-interface/public/shared/cdx/cdx-panel.js +2 -2
  228. package/neural-interface/public/shared/context-menu-model.js +2 -0
  229. package/neural-interface/public/shared/editor/editor-panel-logic.js +10 -0
  230. package/neural-interface/public/shared/editor/editor-panel.js +10 -2
  231. package/neural-interface/public/shared/html-shell.js +30 -22
  232. package/neural-interface/public/shared/morelogin-profile-choices.js +107 -0
  233. package/neural-interface/public/shared/morelogin-profile-field.js +186 -0
  234. package/neural-interface/public/shared/mtc/mtc-client.js +181 -0
  235. package/neural-interface/public/shared/mtc/mtc-compose.js +40 -0
  236. package/neural-interface/public/shared/mtc/mtc-copy.js +253 -0
  237. package/neural-interface/public/shared/mtc/mtc-logic.js +478 -0
  238. package/neural-interface/public/shared/mtc/mtc-panel.js +1354 -0
  239. package/neural-interface/public/shared/mtc/mtc-render.js +172 -0
  240. package/neural-interface/public/shared/mtc/mtc-styles.js +437 -0
  241. package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +6 -2
  242. package/neural-interface/public/shared/provider-icons.js +3 -0
  243. package/neural-interface/public/shared/schedules-view.js +7 -0
  244. package/neural-interface/public/shared/server-back.js +50 -0
  245. package/neural-interface/public/shared/settings/settings-browser-owner-access.js +72 -0
  246. package/neural-interface/public/shared/settings/settings-data.js +1 -0
  247. package/neural-interface/public/shared/settings/settings-ia.js +3 -1
  248. package/neural-interface/public/shared/settings/settings-local-profiles.js +153 -0
  249. package/neural-interface/public/shared/settings/settings-maritaca-opencode.js +105 -0
  250. package/neural-interface/public/shared/sidepanel-session-status.js +16 -2
  251. package/neural-interface/public/shared/state.js +1 -1
  252. package/neural-interface/public/shared/styles.css +356 -157
  253. package/neural-interface/public/shared/synabun-mascot-assets.js +67 -0
  254. package/neural-interface/public/shared/synabun-mascot.js +136 -12
  255. package/neural-interface/public/shared/synabun-ticker.js +3 -0
  256. package/neural-interface/public/shared/topright-overflow-logic.js +1 -0
  257. package/neural-interface/public/shared/ui-automation-approval.js +188 -0
  258. package/neural-interface/public/shared/ui-automation-studio.js +130 -90
  259. package/neural-interface/public/shared/ui-claude-panel.js +50 -2
  260. package/neural-interface/public/shared/ui-maritaca-panel.js +15 -0
  261. package/neural-interface/public/shared/ui-navbar.js +17 -0
  262. package/neural-interface/public/shared/ui-panels.js +3 -1
  263. package/neural-interface/public/shared/ui-schedules-studio.js +118 -17
  264. package/neural-interface/public/shared/ui-scroll-follow.js +3 -0
  265. package/neural-interface/public/shared/ui-settings.js +590 -27
  266. package/neural-interface/public/shared/ui-sidepanel-session-entry.js +8 -2
  267. package/neural-interface/public/shared/ui-sidepanel-sessions.js +3 -3
  268. package/neural-interface/public/shared/ui-sidepanel-tray.js +24 -0
  269. package/neural-interface/public/shared/ui-sidepanel-windows.js +1 -1
  270. package/neural-interface/scripts/build-mascot-assets.mjs +30 -0
  271. package/neural-interface/server.js +1784 -195
  272. package/npm-shrinkwrap.json +5 -17
  273. package/package.json +5 -6
  274. package/postinstall.js +38 -39
  275. package/setup.js +33 -31
  276. package/skills/synabun/modules/changelog.md +14 -0
@@ -81,6 +81,25 @@ export const BRAIN_CREDENTIAL_SHAPE_RE = /^sbb_[A-Za-z0-9_-]{43}$/;
81
81
  export const BRAIN_CREDENTIAL_HEADER = 'x-synabun-brain-token';
82
82
  /** How many ended runs stay refused (oldest first out). */
83
83
  export const REVOKED_KEPT_MAX = 10_000;
84
+ /**
85
+ * How many closed MCP sessions stay refused, in a list of their own (oldest first out). Anybody on this computer can
86
+ * open and close MCP sessions, so they never share the ended runs' list: before 2026-11-10 (review b6631e9d, finding
87
+ * 7) 10,000 open-and-close cycles pushed every ended run out of it, and an ended run's id was sayable again.
88
+ */
89
+ export const REVOKED_SESSIONS_KEPT_MAX = 10_000;
90
+
91
+ /** The shape of the ids the MCP transport mints for its sessions (a random UUID): a bearer for that session. */
92
+ export const MCP_SESSION_ID_SHAPE_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
93
+ /**
94
+ * `id` as a log line or a refusal may show it (finding 4 of the re-review of 2026-11-11): an id shaped like an MCP
95
+ * session's (MCP_SESSION_ID_SHAPE_RE) or `isMcpSession` says is one, cut to its first 8 characters and "…" (as
96
+ * mcp-server/src/http.ts sessionLogId); anything else (a run's id, which is nothing without its token) up to 128
97
+ * characters, so a log still finds the run.
98
+ */
99
+ export function logIdOf(id, isMcpSession = false) {
100
+ const text = String(id ?? '');
101
+ return isMcpSession === true || MCP_SESSION_ID_SHAPE_RE.test(text) ? `${text.slice(0, 8)}…` : text.slice(0, 128);
102
+ }
84
103
 
85
104
  /** A new token. */
86
105
  export function mintTerminalToken(random = cryptoRandomBytes) {
@@ -123,7 +142,10 @@ const digestOf = (text) => createHash('sha256').update(String(text)).digest();
123
142
  * @param {string} id the run the request named
124
143
  */
125
144
  export function terminalRefusal(status, id) {
126
- const run = String(id).slice(0, 128);
145
+ // Finding 4 (re-review of 2026-11-11): the id a request names may be a live Mcp-Session-Id, a bearer for that MCP
146
+ // session. A refusal goes back to the caller that sent it, but it can be copied into a log on its way (a route's
147
+ // catch, a proxy), so an id of that shape is said by its short form here too (logIdOf).
148
+ const run = logIdOf(id);
127
149
  if (status === 'missing') {
128
150
  return {
129
151
  status: 403, code: 'TERMINAL_TOKEN_REQUIRED',
@@ -150,6 +172,10 @@ export function terminalRefusal(status, id) {
150
172
  * environment says (read at every check); `graceWindowMs` how long grace may last after the registry was made (the
151
173
  * server's start), read at every check too; `now` the clock. `knownSecrets` is told every live proof and every one
152
174
  * that stops proving anything (lib/terminal-token-redaction.js: the scrubbers then mask its base64 and hex too).
175
+ * `maxRevokedSessions`: how many closed MCP sessions stay refused, apart from the ended runs. `onEnded(id, kind)` is
176
+ * told every id whose owner ended (revoke() of a run, revokeSession() of an MCP session; never rotate() or retire(),
177
+ * which are a new process or a pause of the same owner): the server forgets what that id held (its MoreLogin
178
+ * profile pin and its saved choice, server.js forgetRunMoreLoginProfile), so nothing outlives its owner.
153
179
  */
154
180
  export function createTerminalTokenRegistry({
155
181
  random = cryptoRandomBytes,
@@ -161,9 +187,15 @@ export function createTerminalTokenRegistry({
161
187
  now = Date.now,
162
188
  logEveryMs = GRACE_LOG_EVERY_MS,
163
189
  knownSecrets = { add: registerKnownSecret, remove: forgetKnownSecret },
190
+ maxRevokedSessions = REVOKED_SESSIONS_KEPT_MAX,
191
+ onEnded = null,
164
192
  } = {}) {
165
- const live = new Map(); // terminal id → { token, digest, kind: 'token' | 'credential' }
193
+ const live = new Map(); // terminal id → { token, digest, kind: 'token' | 'credential' | 'mcp-session' }
166
194
  const revoked = new Set(); // ids of ended runs, oldest first
195
+ const revokedSessions = new Set(); // ids of closed MCP sessions, oldest first: never in `revoked` (finding 7)
196
+ const sessionCap = Math.max(1, Number(maxRevokedSessions) || REVOKED_SESSIONS_KEPT_MAX);
197
+ /** Tell the host an id's owner ended (never a reason to fail a revoke). */
198
+ const ended = (id, kind) => { if (typeof onEnded === 'function') { try { onEnded(id, kind); } catch { /* the host's own failure */ } } };
167
199
  const graceLog = new Map(); // id → { at, more }: when a grace acceptance was last logged, and how many since
168
200
  const cap = Math.max(1, Number(maxRevoked) || REVOKED_KEPT_MAX);
169
201
  const startedAt = now();
@@ -203,7 +235,7 @@ export function createTerminalTokenRegistry({
203
235
  graceLog.set(id, { at, more: 0 });
204
236
  while (graceLog.size > cap) graceLog.delete(graceLog.keys().next().value);
205
237
  const ends = graceEndsAt();
206
- say(`[terminal-tokens] grace: run ${id} was let through without its terminal token (${TERMINAL_TOKEN_MODE_ENV}=grace)${more ? `; ${more} more time${more === 1 ? '' : 's'} since the last line` : ''}${Number.isFinite(ends) ? `; grace ends at ${new Date(ends).toISOString()}` : ''}`);
238
+ say(`[terminal-tokens] grace: run ${logIdOf(id)} was let through without its terminal token (${TERMINAL_TOKEN_MODE_ENV}=grace)${more ? `; ${more} more time${more === 1 ? '' : 's'} since the last line` : ''}${Number.isFinite(ends) ? `; grace ends at ${new Date(ends).toISOString()}` : ''}`);
207
239
  }
208
240
 
209
241
  /** The scrubbers learn a live proof's value and forget a dead one's (never a reason to fail a check). */
@@ -218,6 +250,7 @@ export function createTerminalTokenRegistry({
218
250
  }
219
251
  function setLive(id, token, kind) {
220
252
  revoked.delete(id);
253
+ revokedSessions.delete(id);
221
254
  graceLog.delete(id);
222
255
  if (live.has(id)) dropLive(id);
223
256
  live.set(id, { token, digest: digestOf(token), kind });
@@ -259,6 +292,42 @@ export function createTerminalTokenRegistry({
259
292
  return true;
260
293
  }
261
294
 
295
+ /**
296
+ * A proof for a plain MCP session of SynaBun's own HTTP MCP endpoint (a CLI window's Claude Code or Codex that SynaBun
297
+ * did not start: its id is the Mcp-Session-Id the endpoint minted at its initialize). Kind 'mcp-session': it makes
298
+ * the session's id verified (nobody else can name it any more, and the browser and MoreLogin routes know it is
299
+ * that session), but it is not a run: moreLoginGate lets it work in a profile of its own (`use`) and never `start`
300
+ * or `use-default` (kindOf). Never replaces a proof an id already holds (a run's token, a brain's credential), and
301
+ * never reopens an ended id. Returns the token, or null.
302
+ */
303
+ function issueSession(sessionId) {
304
+ const id = idOf(sessionId);
305
+ if (!id || live.has(id) || revoked.has(id) || revokedSessions.has(id)) return null;
306
+ return setLive(id, mintTerminalToken(random), 'mcp-session');
307
+ }
308
+
309
+ /**
310
+ * The MCP session ended: its proof stops working and its id stays refused. Only a proof issueSession gave. The id
311
+ * goes to the closed sessions' own list (revokedSessions), never to the ended runs' (finding 7: see
312
+ * REVOKED_SESSIONS_KEPT_MAX), so no number of sessions opened and closed can make an ended run's id sayable again.
313
+ */
314
+ function revokeSession(sessionId) {
315
+ const id = idOf(sessionId);
316
+ if (!id || live.get(id)?.kind !== 'mcp-session') return false;
317
+ dropLive(id);
318
+ graceLog.delete(id);
319
+ revokedSessions.delete(id);
320
+ revokedSessions.add(id);
321
+ while (revokedSessions.size > sessionCap) revokedSessions.delete(revokedSessions.values().next().value);
322
+ ended(id, 'mcp-session');
323
+ return true;
324
+ }
325
+
326
+ /** What proves `terminalId`: 'token' (a run, a panel), 'credential' (a brain), 'mcp-session', or null. */
327
+ function kindOf(terminalId) {
328
+ return (typeof terminalId === 'string' && live.get(terminalId)?.kind) || null;
329
+ }
330
+
262
331
  /** The live token of `terminalId`, or null (none issued, or revoked). For a handoff to a process the run starts. */
263
332
  function tokenFor(terminalId) {
264
333
  const id = idOf(terminalId);
@@ -269,6 +338,8 @@ export function createTerminalTokenRegistry({
269
338
  function revoke(terminalId) {
270
339
  const id = idOf(terminalId);
271
340
  if (!id) return false;
341
+ // An MCP session's proof ends in its own list, whoever asks (revokeSession).
342
+ if (live.get(id)?.kind === 'mcp-session') return revokeSession(id);
272
343
  const had = dropLive(id);
273
344
  graceLog.delete(id);
274
345
  if (had || revoked.has(id)) {
@@ -276,6 +347,7 @@ export function createTerminalTokenRegistry({
276
347
  revoked.add(id);
277
348
  while (revoked.size > cap) revoked.delete(revoked.values().next().value);
278
349
  }
350
+ ended(id, 'run');
279
351
  return had;
280
352
  }
281
353
 
@@ -306,7 +378,7 @@ export function createTerminalTokenRegistry({
306
378
  const held = id ? live.get(id) : null;
307
379
  const absent = presented === undefined || presented === null || presented === '';
308
380
  if (!held) {
309
- if (id && revoked.has(id)) return 'revoked';
381
+ if (id && (revoked.has(id) || revokedSessions.has(id))) return 'revoked';
310
382
  return 'unregistered';
311
383
  }
312
384
  if (absent) return 'missing';
@@ -335,6 +407,9 @@ export function createTerminalTokenRegistry({
335
407
  issue,
336
408
  rotate,
337
409
  bind,
410
+ issueSession,
411
+ revokeSession,
412
+ kindOf,
338
413
  tokenFor,
339
414
  revoke,
340
415
  retire,
@@ -345,7 +420,7 @@ export function createTerminalTokenRegistry({
345
420
  /** Whether `id` holds a live token (or a bound credential). */
346
421
  has: (terminalId) => live.has(terminalId),
347
422
  /** Whether `id` is an ended run's. */
348
- isRevoked: (terminalId) => revoked.has(terminalId),
423
+ isRevoked: (terminalId) => revoked.has(terminalId) || revokedSessions.has(terminalId),
349
424
  /** The mode in force: 'grace' only while the environment asks for it and its window is open. */
350
425
  mode: () => currentMode(),
351
426
  /** For diagnostics: the mode in force, the one asked for, and when grace ends (an ISO time, or null for never). */
@@ -355,5 +430,7 @@ export function createTerminalTokenRegistry({
355
430
  },
356
431
  /** For tests and diagnostics: how many runs hold a token, how many ended ones are kept. */
357
432
  stats: () => ({ live: live.size, revoked: revoked.size }),
433
+ /** For tests and diagnostics: how many closed MCP sessions are kept refused (their own list, never the runs'). */
434
+ sessionStats: () => ({ revokedSessions: revokedSessions.size }),
358
435
  };
359
436
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "neural-memory-interface",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "neural-memory-interface",
9
- "version": "2.2.2",
9
+ "version": "2.3.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "Apache-2.0",
12
12
  "dependencies": {
@@ -52,6 +52,7 @@
52
52
  "html2canvas": "1.4.1",
53
53
  "marked": "14.1.4",
54
54
  "mermaid": "11.17.2",
55
+ "sharp": "0.34.5",
55
56
  "three": "0.169.0"
56
57
  },
57
58
  "engines": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neural-memory-interface",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "private": true,
5
5
  "description": "Private local SynaBun interface for memory visualization and multi-agent workflows",
6
6
  "license": "Apache-2.0",
@@ -69,6 +69,7 @@
69
69
  "html2canvas": "1.4.1",
70
70
  "marked": "14.1.4",
71
71
  "mermaid": "11.17.2",
72
+ "sharp": "0.34.5",
72
73
  "three": "0.169.0"
73
74
  }
74
75
  }
@@ -0,0 +1,11 @@
1
+ # Assistant mascot artwork (v2)
2
+
3
+ 28 GIFs with matching still PNGs, copied from the approved drawn animations in `.synabun/design/mascot-animations-v2/` (approved 2026-11-11). Each file is the whole character (eyes, smile, hands and props together), 120×120, eight drawn cels at the drawing's own timing.
4
+
5
+ `manifest.json` records every state's source, duration, one-shot flag, frame count, which frame the still is, and size. `shared/synabun-mascot-assets.js` owns the allowlisted URL mapping (`MASCOT_ASSET_VERSION` 2). The rig's `thinking` art ships as `think`. Variants without their own v2 art (subagent-2/3, plan-0/2/3, pick-0/2/3, memory-remember, budget-unlimited) fall back to the base state's file (`MASCOT_ASSET_FALLBACKS`). `idle-hero` is the empty page's rest and `hover-attention` its one-shot on hover. The tray cameo keeps its vector eyes: the drawing is unreadable at 10×7 px.
6
+
7
+ Success, error, blocked, offline and hover-attention play once and hold their last cel; every other state loops. The still PNG is the opening cel, or the held last cel for success, error, blocked and offline.
8
+
9
+ The rig shows the art as one image in the 280×140 box (`ART_BOX`) and never draws its pill eyes, smile or props over it. Gaze, blends and reactions move the image as a whole (`artTransform`: small translate, tilt, clamped scale; never a blink). Inactive, offscreen, hidden, dragged and reduced-motion rigs switch to PNGs. Receipts, station minis, answered cards and quota-wait stills use PNGs without registering a rig.
10
+
11
+ Rebuild from `neural-interface` with `node scripts/build-mascot-assets.mjs`: it keys out the `#0a0a0c` review matte (GIF has one-bit alpha; anti-aliased edges stay matted against the Assistant background, which is that colour), sets the loop flags, writes the stills and the manifest, and removes any other GIF/PNG here. It draws nothing and calls no API.
@@ -0,0 +1,254 @@
1
+ {
2
+ "think": {
3
+ "source": "gifs/thinking.gif",
4
+ "duration": 2020,
5
+ "once": false,
6
+ "width": 480,
7
+ "height": 480,
8
+ "frames": 8,
9
+ "bytes": 19379
10
+ },
11
+ "shell": {
12
+ "source": "gifs/shell.gif",
13
+ "duration": 2020,
14
+ "once": false,
15
+ "width": 480,
16
+ "height": 480,
17
+ "frames": 8,
18
+ "bytes": 22095
19
+ },
20
+ "read": {
21
+ "source": "gifs/read.gif",
22
+ "duration": 2020,
23
+ "once": false,
24
+ "width": 480,
25
+ "height": 480,
26
+ "frames": 8,
27
+ "bytes": 21765
28
+ },
29
+ "edit": {
30
+ "source": "gifs/edit.gif",
31
+ "duration": 2020,
32
+ "once": false,
33
+ "width": 480,
34
+ "height": 480,
35
+ "frames": 8,
36
+ "bytes": 21031
37
+ },
38
+ "search": {
39
+ "source": "gifs/search.gif",
40
+ "duration": 2020,
41
+ "once": false,
42
+ "width": 480,
43
+ "height": 480,
44
+ "frames": 8,
45
+ "bytes": 21002
46
+ },
47
+ "web": {
48
+ "source": "gifs/web.gif",
49
+ "duration": 2020,
50
+ "once": false,
51
+ "width": 480,
52
+ "height": 480,
53
+ "frames": 8,
54
+ "bytes": 21447
55
+ },
56
+ "subagent": {
57
+ "source": "gifs/subagent.gif",
58
+ "duration": 2020,
59
+ "once": false,
60
+ "width": 480,
61
+ "height": 480,
62
+ "frames": 8,
63
+ "bytes": 22982
64
+ },
65
+ "plan": {
66
+ "source": "gifs/plan.gif",
67
+ "duration": 2060,
68
+ "once": false,
69
+ "width": 480,
70
+ "height": 480,
71
+ "frames": 8,
72
+ "bytes": 22273
73
+ },
74
+ "memory": {
75
+ "source": "gifs/memory.gif",
76
+ "duration": 2080,
77
+ "once": false,
78
+ "width": 480,
79
+ "height": 480,
80
+ "frames": 8,
81
+ "bytes": 18648
82
+ },
83
+ "runs": {
84
+ "source": "gifs/runs.gif",
85
+ "duration": 2020,
86
+ "once": false,
87
+ "width": 480,
88
+ "height": 480,
89
+ "frames": 8,
90
+ "bytes": 22330
91
+ },
92
+ "computer": {
93
+ "source": "gifs/computer.gif",
94
+ "duration": 2020,
95
+ "once": false,
96
+ "width": 480,
97
+ "height": 480,
98
+ "frames": 8,
99
+ "bytes": 24397
100
+ },
101
+ "mcp": {
102
+ "source": "gifs/mcp.gif",
103
+ "duration": 2020,
104
+ "once": false,
105
+ "width": 480,
106
+ "height": 480,
107
+ "frames": 8,
108
+ "bytes": 20753
109
+ },
110
+ "idle": {
111
+ "source": "gifs/idle.gif",
112
+ "duration": 2840,
113
+ "once": false,
114
+ "width": 480,
115
+ "height": 480,
116
+ "frames": 8,
117
+ "bytes": 17047
118
+ },
119
+ "sleep": {
120
+ "source": "gifs/sleep.gif",
121
+ "duration": 3480,
122
+ "once": false,
123
+ "width": 480,
124
+ "height": 480,
125
+ "frames": 8,
126
+ "bytes": 10410
127
+ },
128
+ "watch": {
129
+ "source": "gifs/watch.gif",
130
+ "duration": 2020,
131
+ "once": false,
132
+ "width": 480,
133
+ "height": 480,
134
+ "frames": 8,
135
+ "bytes": 19030
136
+ },
137
+ "wait": {
138
+ "source": "gifs/wait.gif",
139
+ "duration": 3060,
140
+ "once": false,
141
+ "width": 480,
142
+ "height": 480,
143
+ "frames": 8,
144
+ "bytes": 20151
145
+ },
146
+ "success": {
147
+ "source": "gifs/success.gif",
148
+ "duration": 1660,
149
+ "once": true,
150
+ "width": 480,
151
+ "height": 480,
152
+ "frames": 8,
153
+ "bytes": 16678
154
+ },
155
+ "error": {
156
+ "source": "gifs/error.gif",
157
+ "duration": 1720,
158
+ "once": true,
159
+ "width": 480,
160
+ "height": 480,
161
+ "frames": 8,
162
+ "bytes": 19703
163
+ },
164
+ "blocked": {
165
+ "source": "gifs/blocked.gif",
166
+ "duration": 3100,
167
+ "once": true,
168
+ "width": 480,
169
+ "height": 480,
170
+ "frames": 8,
171
+ "bytes": 23455
172
+ },
173
+ "offline": {
174
+ "source": "gifs/offline.gif",
175
+ "duration": 3260,
176
+ "once": true,
177
+ "width": 480,
178
+ "height": 480,
179
+ "frames": 8,
180
+ "bytes": 20745
181
+ },
182
+ "project": {
183
+ "source": "gifs/project.gif",
184
+ "duration": 2020,
185
+ "once": false,
186
+ "width": 480,
187
+ "height": 480,
188
+ "frames": 8,
189
+ "bytes": 21648
190
+ },
191
+ "budget": {
192
+ "source": "gifs/budget.gif",
193
+ "duration": 2020,
194
+ "once": false,
195
+ "width": 480,
196
+ "height": 480,
197
+ "frames": 8,
198
+ "bytes": 21166
199
+ },
200
+ "skill": {
201
+ "source": "gifs/skill.gif",
202
+ "duration": 2020,
203
+ "once": false,
204
+ "width": 480,
205
+ "height": 480,
206
+ "frames": 8,
207
+ "bytes": 20951
208
+ },
209
+ "present": {
210
+ "source": "gifs/present.gif",
211
+ "duration": 2020,
212
+ "once": false,
213
+ "width": 480,
214
+ "height": 480,
215
+ "frames": 8,
216
+ "bytes": 20716
217
+ },
218
+ "pick": {
219
+ "source": "gifs/pick.gif",
220
+ "duration": 2020,
221
+ "once": false,
222
+ "width": 480,
223
+ "height": 480,
224
+ "frames": 8,
225
+ "bytes": 20521
226
+ },
227
+ "ask": {
228
+ "source": "gifs/ask.gif",
229
+ "duration": 3260,
230
+ "once": true,
231
+ "width": 480,
232
+ "height": 480,
233
+ "frames": 8,
234
+ "bytes": 22095
235
+ },
236
+ "idle-hero": {
237
+ "source": "gifs/idle-hero.gif",
238
+ "duration": 2780,
239
+ "once": false,
240
+ "width": 480,
241
+ "height": 480,
242
+ "frames": 8,
243
+ "bytes": 17084
244
+ },
245
+ "hover-attention": {
246
+ "source": "gifs/hover-attention.gif",
247
+ "duration": 1740,
248
+ "once": true,
249
+ "width": 480,
250
+ "height": 480,
251
+ "frames": 8,
252
+ "bytes": 16953
253
+ }
254
+ }