synabun 2.2.1 → 2.2.2

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 (149) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +1 -1
  3. package/hooks/claude-code/pre-websearch.mjs +4 -1
  4. package/hooks/claude-code/prompt-submit.mjs +7 -0
  5. package/lib/release-scan.mjs +23 -10
  6. package/lib/virustotal.mjs +143 -39
  7. package/mcp-server/dist/http.d.ts +19 -0
  8. package/mcp-server/dist/http.d.ts.map +1 -1
  9. package/mcp-server/dist/http.js +55 -13
  10. package/mcp-server/dist/http.js.map +1 -1
  11. package/mcp-server/dist/index.d.ts.map +1 -1
  12. package/mcp-server/dist/index.js +14 -9
  13. package/mcp-server/dist/index.js.map +1 -1
  14. package/mcp-server/dist/services/browser-route-flow.d.ts +118 -0
  15. package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -0
  16. package/mcp-server/dist/services/browser-route-flow.js +339 -0
  17. package/mcp-server/dist/services/browser-route-flow.js.map +1 -0
  18. package/mcp-server/dist/services/desktop-client.js +2 -2
  19. package/mcp-server/dist/services/desktop-client.js.map +1 -1
  20. package/mcp-server/dist/services/identity.d.ts +66 -3
  21. package/mcp-server/dist/services/identity.d.ts.map +1 -1
  22. package/mcp-server/dist/services/identity.js +61 -4
  23. package/mcp-server/dist/services/identity.js.map +1 -1
  24. package/mcp-server/dist/services/neural-interface.d.ts +112 -1
  25. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  26. package/mcp-server/dist/services/neural-interface.js +555 -61
  27. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  28. package/mcp-server/dist/tools/bluesky.d.ts +20 -7
  29. package/mcp-server/dist/tools/bluesky.d.ts.map +1 -1
  30. package/mcp-server/dist/tools/bluesky.js +147 -45
  31. package/mcp-server/dist/tools/bluesky.js.map +1 -1
  32. package/mcp-server/dist/tools/browser-advanced.d.ts +11 -2
  33. package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
  34. package/mcp-server/dist/tools/browser-advanced.js +131 -18
  35. package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
  36. package/mcp-server/dist/tools/browser-cheatsheet.d.ts +2 -0
  37. package/mcp-server/dist/tools/browser-cheatsheet.d.ts.map +1 -1
  38. package/mcp-server/dist/tools/browser-cheatsheet.js +3 -0
  39. package/mcp-server/dist/tools/browser-cheatsheet.js.map +1 -1
  40. package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
  41. package/mcp-server/dist/tools/morelogin.js +4 -2
  42. package/mcp-server/dist/tools/morelogin.js.map +1 -1
  43. package/mcp-server/dist/tools/skill-tools.d.ts +4 -4
  44. package/mcp-server/dist/tools/youtube/helpers.d.ts +1 -0
  45. package/mcp-server/dist/tools/youtube/helpers.d.ts.map +1 -1
  46. package/mcp-server/dist/tools/youtube/helpers.js +1 -1
  47. package/mcp-server/dist/tools/youtube/helpers.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 +58 -12
  51. package/mcp-server/src/index.ts +15 -9
  52. package/mcp-server/src/services/browser-route-flow.ts +402 -0
  53. package/mcp-server/src/services/desktop-client.ts +2 -2
  54. package/mcp-server/src/services/identity.ts +80 -4
  55. package/mcp-server/src/services/neural-interface.ts +572 -70
  56. package/mcp-server/src/tools/bluesky.ts +164 -51
  57. package/mcp-server/src/tools/browser-advanced.ts +121 -17
  58. package/mcp-server/src/tools/browser-cheatsheet.ts +3 -0
  59. package/mcp-server/src/tools/morelogin.ts +4 -2
  60. package/mcp-server/src/tools/youtube/helpers.ts +2 -2
  61. package/neural-interface/i18n/en.json +24 -0
  62. package/neural-interface/i18n/pt-BR.json +24 -0
  63. package/neural-interface/lib/assistant-api.js +64 -23
  64. package/neural-interface/lib/assistant-catalog.js +20 -2
  65. package/neural-interface/lib/assistant-dispatch.js +27 -1
  66. package/neural-interface/lib/assistant-persona.js +1 -0
  67. package/neural-interface/lib/assistant-runtime.js +15 -1
  68. package/neural-interface/lib/assistant-tools.js +10 -1
  69. package/neural-interface/lib/browser-automation-routes.js +84 -0
  70. package/neural-interface/lib/browser-execution.js +16 -3
  71. package/neural-interface/lib/browser-owner.js +48 -0
  72. package/neural-interface/lib/browser-session-close.js +84 -0
  73. package/neural-interface/lib/browser-start-handoff.js +202 -0
  74. package/neural-interface/lib/browser-tool-policy.js +21 -4
  75. package/neural-interface/lib/browser-wedge-retire.js +64 -0
  76. package/neural-interface/lib/claude-agent-bridge.js +36 -1
  77. package/neural-interface/lib/claude-background-hold.js +239 -0
  78. package/neural-interface/lib/exec-loop-command.js +8 -0
  79. package/neural-interface/lib/http-guards.js +11 -6
  80. package/neural-interface/lib/loop-logger.js +6 -1
  81. package/neural-interface/lib/mcp-external-servers.js +37 -10
  82. package/neural-interface/lib/native-loop-providers.js +121 -10
  83. package/neural-interface/lib/native-loop-runtime.js +112 -11
  84. package/neural-interface/lib/owner-authority.js +113 -37
  85. package/neural-interface/lib/page-session.js +81 -23
  86. package/neural-interface/lib/peer-identity.js +263 -43
  87. package/neural-interface/lib/provider-panel-api-key-auth.js +7 -2
  88. package/neural-interface/lib/pty-host/core.js +36 -0
  89. package/neural-interface/lib/pty-host/protocol.js +2 -0
  90. package/neural-interface/lib/skills/api-v2.js +13 -2
  91. package/neural-interface/lib/skills/creation-api.js +3 -1
  92. package/neural-interface/lib/skills/evals-api.js +5 -1
  93. package/neural-interface/lib/social-write-pacing.js +151 -0
  94. package/neural-interface/lib/terminal-token-redaction.js +293 -0
  95. package/neural-interface/lib/terminal-tokens.js +359 -0
  96. package/neural-interface/lib/worker-mcp-channel.js +45 -10
  97. package/neural-interface/package-lock.json +2 -2
  98. package/neural-interface/package.json +1 -1
  99. package/neural-interface/public/shared/agy/agy-render.js +41 -1
  100. package/neural-interface/public/shared/agy/agy-styles.js +5 -0
  101. package/neural-interface/public/shared/api.js +1 -0
  102. package/neural-interface/public/shared/assistant/asst-computer.js +47 -2
  103. package/neural-interface/public/shared/assistant/asst-limit-wait.js +3 -1
  104. package/neural-interface/public/shared/assistant/asst-panel.js +7 -3
  105. package/neural-interface/public/shared/assistant/asst-render.js +10 -4
  106. package/neural-interface/public/shared/assistant/asst-styles.js +2 -1
  107. package/neural-interface/public/shared/cdx/cdx-render.js +73 -7
  108. package/neural-interface/public/shared/cdx/cdx-tabs.js +3 -3
  109. package/neural-interface/public/shared/cp/cp-agents.js +8 -0
  110. package/neural-interface/public/shared/cp/cp-permissions.js +6 -2
  111. package/neural-interface/public/shared/cp/cp-rehydrate.js +25 -1
  112. package/neural-interface/public/shared/cp/cp-tasks-model.js +33 -0
  113. package/neural-interface/public/shared/judgments-log-origins.js +29 -0
  114. package/neural-interface/public/shared/ocp-v2/ocp-v2-automation-ownership.js +23 -0
  115. package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +13 -0
  116. package/neural-interface/public/shared/ocp-v2/ocp-v2-icons.js +3 -1
  117. package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +4 -2
  118. package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +6 -86
  119. package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +5 -2
  120. package/neural-interface/public/shared/owner-access.js +134 -0
  121. package/neural-interface/public/shared/owner-authority-view.js +92 -0
  122. package/neural-interface/public/shared/page-session.js +143 -14
  123. package/neural-interface/public/shared/poll-backoff.js +59 -0
  124. package/neural-interface/public/shared/settings/settings-data.js +6 -1
  125. package/neural-interface/public/shared/settings/settings-kit.js +11 -3
  126. package/neural-interface/public/shared/settings/settings-shell.js +7 -0
  127. package/neural-interface/public/shared/shown-children.js +72 -0
  128. package/neural-interface/public/shared/static-bg-state.js +22 -0
  129. package/neural-interface/public/shared/styles.css +101 -7
  130. package/neural-interface/public/shared/synabun-tools.js +173 -0
  131. package/neural-interface/public/shared/tool-heartbeat.js +43 -0
  132. package/neural-interface/public/shared/tool-list-picker.js +3 -1
  133. package/neural-interface/public/shared/tool-list-view.js +23 -4
  134. package/neural-interface/public/shared/ui-automation-studio.js +8 -1
  135. package/neural-interface/public/shared/ui-claude-panel.js +159 -29
  136. package/neural-interface/public/shared/ui-judgments.js +37 -10
  137. package/neural-interface/public/shared/ui-navbar.js +6 -0
  138. package/neural-interface/public/shared/ui-owner-access.js +191 -0
  139. package/neural-interface/public/shared/ui-owner-authority.js +162 -0
  140. package/neural-interface/public/shared/ui-sessions.js +45 -16
  141. package/neural-interface/public/shared/ui-settings.js +86 -15
  142. package/neural-interface/public/shared/ui-terminal.js +15 -7
  143. package/neural-interface/public/shared/ui-tutorial-preview.js +4 -0
  144. package/neural-interface/public/shared/ui-update.js +3 -0
  145. package/neural-interface/public/shared/ui-whiteboard.js +4 -0
  146. package/neural-interface/public/shared/window-keys.js +38 -0
  147. package/neural-interface/server.js +1160 -205
  148. package/npm-shrinkwrap.json +2 -2
  149. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { fetchToolCatalog } from './agent-runtime-options.js';
2
- import { configureToolPickerTranslation, toolPickerHTML, readToolPicker, toolWord } from './tool-list-picker.js';
2
+ import { configureToolPickerTranslation, toolPickerHTML, readToolPicker, toolWord, toolServersNote } from './tool-list-picker.js';
3
3
  import { mountMemoryMaintenance } from './ui-memory-maintenance.js';
4
4
  import { buildJudgmentsTab, wireJudgmentsTab } from './ui-judgments.js';
5
5
  import { buildWhatsAppTab, wireWhatsAppTab } from './ui-whatsapp.js';
@@ -21,6 +21,7 @@ import { remoteMcpAddress } from './tunnel-view.js';
21
21
  import { recheckCliStatus, getCliStatus, addCliToPath } from './cli-status.js';
22
22
  import { cliInstallText, setCliInstallTranslator } from './cli-install-view.js';
23
23
  import { dropdownHTML, wireDropdowns, setDropdownItems, setDropdownValue } from './cc-dropdown.js';
24
+ import { setStaticBgVisible } from './static-bg-state.js';
24
25
  setCliInstallTranslator((key, params) => kit.tx(`cliInstall.${key}`, params));
25
26
  import { setGitBashTranslator } from './git-bash-view.js';
26
27
  import { gitBashRowHtml, wireGitBashRow } from './ui-git-bash.js';
@@ -56,6 +57,8 @@ import {
56
57
  fetchRulesStatus, fetchRulesTextWithFallback, installRules, removeRules, installAllRules, setRulesAutoUpdate, removeLegacyRules,
57
58
  } from './api.js';
58
59
  import { centeredInFrame } from './app-frame.js';
60
+ import { markNoAccess, noteOwnerAccessRefusal, ownerAccessSay, refusalOfError, refusalOfResponse } from './ui-owner-access.js';
61
+ import { readOwnerAccessRefusal } from './owner-access.js';
59
62
 
60
63
  // ── SVG icon constants ──
61
64
 
@@ -253,12 +256,12 @@ export function applyIfaceConfig(cfg, { instant = false } = {}) {
253
256
  if (instant) {
254
257
  // Page load — apply immediately without animation
255
258
  if (graphContainer) graphContainer.classList.add('focus-active');
256
- if (staticBg) staticBg.classList.add('visible');
259
+ setStaticBgVisible(staticBg, true);
257
260
  } else {
258
261
  // User toggle — stagger: controls fade first, then iris closes
259
262
  setTimeout(() => {
260
263
  if (graphContainer) graphContainer.classList.add('focus-active');
261
- if (staticBg) staticBg.classList.add('visible');
264
+ setStaticBgVisible(staticBg, true);
262
265
  }, 100);
263
266
  }
264
267
  // Notify variant-specific cleanup (lasso, context menu, etc.)
@@ -267,7 +270,7 @@ export function applyIfaceConfig(cfg, { instant = false } = {}) {
267
270
  // EXITING FOCUS MODE
268
271
  // Iris open the graph + close focus bg
269
272
  if (graphContainer) graphContainer.classList.remove('focus-active');
270
- if (staticBg) staticBg.classList.remove('visible');
273
+ setStaticBgVisible(staticBg, false);
271
274
  // 2D canvases
272
275
  for (const id of ['bg-canvas', 'hull-canvas', 'lasso-canvas']) {
273
276
  const el = document.getElementById(id);
@@ -2569,7 +2572,8 @@ function wireMoreLoginTab(overlay) {
2569
2572
  let _defaultEnvId = null;
2570
2573
  const okBg = 'rgba(76,175,80,0.12)', errBg = 'rgba(244,67,54,0.12)';
2571
2574
 
2572
- const jget = (u) => fetch(u).then(r => r.json()).catch(() => ({ ok: false, error: kit.tx('settings.redesign.morelogin.networkError') }));
2575
+ // The answer's HTTP status rides along (`_status`): a refusal of the owner's access is told apart from a MoreLogin error.
2576
+ const jget = (u) => fetch(u).then(async (r) => { const body = await r.json(); if (body && typeof body === 'object') body._status = r.status; return body; }).catch(() => ({ ok: false, error: kit.tx('settings.redesign.morelogin.networkError') }));
2573
2577
  const jpost = (u, body) => fetch(u, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) }).then(r => r.json()).catch(() => ({ ok: false, error: kit.tx('settings.redesign.morelogin.networkError') }));
2574
2578
 
2575
2579
  function setStatus(s) {
@@ -2618,6 +2622,13 @@ function wireMoreLoginTab(overlay) {
2618
2622
 
2619
2623
  async function reload() {
2620
2624
  const s = await jget('/api/morelogin/status');
2625
+ // No owner access (SynaBun's automation browser opened this page): "No access", never "not installed" or defaults.
2626
+ if (markPaneRefused(overlay, 'morelogin', refusalOfError({ status: s._status, code: s.code }))) {
2627
+ const dot = $('ml-status-dot'), line = $('ml-status-line');
2628
+ if (dot) dot.className = 'settings-status-dot disconnected';
2629
+ if (line) line.textContent = ownerAccessSay('panelTitle');
2630
+ return;
2631
+ }
2621
2632
  if (s.ok) setStatus(s);
2622
2633
  const cfg = await jget('/api/morelogin/config');
2623
2634
  if (cfg.ok) {
@@ -3376,11 +3387,18 @@ async function openSettingsModalNow(options = {}) {
3376
3387
  let workerGuardReading = readWorkerGuardResponse({ status: 0 });
3377
3388
  // SynaBun's Claude Code hooks (lib/claude-hooks-status.js): the `claudeHooks` of the integrations read, as a reading.
3378
3389
  let claudeHooksReading = readClaudeHooksResponse({ status: 0 });
3390
+ // The reads the server refused this page (it has no owner access: SynaBun's automation browser opened it). The panes
3391
+ // they feed say "No access" with their Save and actions off, and their nav item "(No access)", never "(Off)".
3392
+ const refusedReads = new Set();
3379
3393
 
3380
3394
  try {
3381
3395
  // Read through the page's data cache (settings/settings-data.js): kept answers at once (each open its own
3382
3396
  // copy; read again in the background when old), so Settings waits only the first time.
3383
3397
  const reads = await readSettingsData();
3398
+ for (const [name, entry] of Object.entries(reads)) {
3399
+ const refusal = settingsReadRefusal(entry);
3400
+ if (refusal) { refusedReads.add(name); noteOwnerAccessRefusal(refusal); }
3401
+ }
3384
3402
  // The greeting and the user context are readings of what their endpoints answered (no answer is a reading too).
3385
3403
  const readingOf = (entry, make) => ({ status: 'fulfilled', value: entry?.status === 'fulfilled' ? make(entry.value) : make({ status: 0, error: entry?.reason?.message }) });
3386
3404
  const greetRes = readingOf(reads.greeting, readGreetingStatus);
@@ -3510,10 +3528,10 @@ async function openSettingsModalNow(options = {}) {
3510
3528
  overlay.setAttribute('aria-labelledby', 'stg-title');
3511
3529
 
3512
3530
  // ── Nav status dots (Judgments and WhatsApp update theirs as they wire) ──
3513
- kit.setNavStatus(overlay, 'server', settings.storage === 'sqlite' ? 'connected' : 'disconnected');
3514
- kit.setNavStatus(overlay, 'setup', (setupStatus.claude?.connected || setupStatus.antigravity?.connected || setupStatus.codex?.connected || setupStatus.opencode?.connected) ? 'connected' : 'disconnected');
3515
- kit.setNavStatus(overlay, 'discord', discordConfig.botToken ? 'connected' : 'disconnected');
3516
- kit.setNavStatus(overlay, 'judgments', (typesafeConfig && typesafeConfig.enabled) ? 'connected' : 'disconnected');
3531
+ kit.setNavStatus(overlay, 'server', refusedReads.has('settings') ? 'refused' : settings.storage === 'sqlite' ? 'connected' : 'disconnected');
3532
+ kit.setNavStatus(overlay, 'setup', refusedReads.has('setup') ? 'refused' : (setupStatus.claude?.connected || setupStatus.antigravity?.connected || setupStatus.codex?.connected || setupStatus.opencode?.connected) ? 'connected' : 'disconnected');
3533
+ kit.setNavStatus(overlay, 'discord', refusedReads.has('discord') ? 'refused' : discordConfig.botToken ? 'connected' : 'disconnected');
3534
+ kit.setNavStatus(overlay, 'judgments', refusedReads.has('typesafe') ? 'refused' : (typesafeConfig && typesafeConfig.enabled) ? 'connected' : 'disconnected');
3517
3535
 
3518
3536
  // ── Open animation (matches Skills/Automation Studio) ──
3519
3537
  requestAnimationFrame(() => { backdrop.classList.add('open'); overlay.classList.add('open'); });
@@ -4383,12 +4401,16 @@ async function openSettingsModalNow(options = {}) {
4383
4401
  }
4384
4402
 
4385
4403
  // Load impact data + current settings
4386
- fetch('/api/recall-impact').then(r => r.json()).then(data => {
4404
+ // A refused read (no owner access) is "No access" on the pane, never the defaults (ui-owner-access.js).
4405
+ const readOrRefuse = async (r) => (markPaneRefused(overlay, 'memory', await refusalOfResponse(r)) ? null : r.json());
4406
+ fetch('/api/recall-impact').then(readOrRefuse).then(data => {
4407
+ if (!Array.isArray(data?.rows)) return;
4387
4408
  _recallImpactData = data;
4388
4409
  updateImpactIndicator();
4389
4410
  }).catch(() => {});
4390
4411
 
4391
- fetch('/api/display-settings').then(r => r.json()).then(data => {
4412
+ fetch('/api/display-settings').then(readOrRefuse).then(data => {
4413
+ if (!data) return;
4392
4414
  const profile = data.profile || 'balanced';
4393
4415
  const d = data.recallDefaults;
4394
4416
  if (d) {
@@ -6693,8 +6715,12 @@ async function openSettingsModalNow(options = {}) {
6693
6715
  }
6694
6716
  }
6695
6717
 
6696
- // Load config on open, then auto-detect profiles
6697
- fetch('/api/browser/config').then(r => r.json()).then(async (data) => {
6718
+ // Load config on open, then auto-detect profiles. A refused read (no owner access) is "No access", never defaults.
6719
+ fetch('/api/browser/config').then(async (r) => {
6720
+ if (markPaneRefused(overlay, 'browser', await refusalOfResponse(r))) return null;
6721
+ return r.json();
6722
+ }).then(async (data) => {
6723
+ if (!data) return;
6698
6724
  if (data.config) { applyBrowserConfig(data.config); syncBcDropdowns(); }
6699
6725
  // Show detected path
6700
6726
  const hint = overlay.querySelector('#bc-detected-path');
@@ -8639,11 +8665,14 @@ async function openSettingsModalNow(options = {}) {
8639
8665
  const servers = { ...(_mcpRegistry.servers || {}) };
8640
8666
  for (const row of _settingsToolCatalog?.servers || []) { const name = row.ref.slice(4); if (!servers[name]) servers[name] = { type: toolWord('configuredExternally'), discovered: true }; }
8641
8667
  const entries = Object.entries(servers).filter(([, info]) => !info.builtin);
8668
+ // A provider whose MCP configuration could not be read is named, never shown as having no servers.
8669
+ const unreadable = toolServersNote(_settingsToolCatalog);
8670
+ const unreadableNote = unreadable ? `<div class="stg-mcp-empty-note" role="status" data-mcp-unreadable>${esc(unreadable)}</div>` : '';
8642
8671
  if (!entries.length) {
8643
- el.innerHTML = '<div class="stg-mcp-empty-note">' + kit.te('settings.redesign.mcp.noExternalServersConfigured') + '</div>';
8672
+ el.innerHTML = unreadableNote + '<div class="stg-mcp-empty-note">' + kit.te('settings.redesign.mcp.noExternalServersConfigured') + '</div>';
8644
8673
  return;
8645
8674
  }
8646
- el.innerHTML = entries.map(([name, info]) =>
8675
+ el.innerHTML = unreadableNote + entries.map(([name, info]) =>
8647
8676
  `<div class="stg-mx-ext-row">
8648
8677
  <div class="stg-mx-ext-main">
8649
8678
  <span class="stg-mx-ext-dot"></span>
@@ -9589,10 +9618,52 @@ async function openSettingsModalNow(options = {}) {
9589
9618
  sources: SEARCH_ROW_SOURCES,
9590
9619
  off: SEARCH_OFF,
9591
9620
  });
9621
+ // ── No owner access: the panes whose reads were refused say so (after they wired, which may enable controls) ──
9622
+ markRefusedPanes(overlay, refusedReads);
9592
9623
  // A deep link's `expand` wins over anything a pane collapsed while it wired itself.
9593
9624
  applySettingsOpenOptions(overlay, options, { quiet: true });
9594
9625
  }
9595
9626
 
9627
+ // ── No owner access (ui-owner-access.js) ──
9628
+ // Which panes each of Settings' reads (settings/settings-data.js SETTINGS_READS) fills. A pane whose read the server
9629
+ // refused this page shows "No access" on top and its Save and actions disabled, instead of defaults that look saved.
9630
+ const SETTINGS_READ_PANES = Object.freeze({
9631
+ settings: ['server'],
9632
+ connections: ['collections'],
9633
+ integrations: ['projects'],
9634
+ skills: ['skills'],
9635
+ setup: ['setup'],
9636
+ cli: ['terminal'],
9637
+ toolPermissions: ['permissions', 'social'],
9638
+ discord: ['discord'],
9639
+ youtube: ['youtube'],
9640
+ typesafe: ['judgments'],
9641
+ });
9642
+
9643
+ /** The owner refusal one of Settings' reads stands for (a rejected read, or a raw read's 403 body), or null. */
9644
+ function settingsReadRefusal(entry) {
9645
+ if (!entry) return null;
9646
+ if (entry.status === 'rejected') return refusalOfError(entry.reason);
9647
+ const value = entry.value;
9648
+ if (value && typeof value === 'object' && 'status' in value && 'body' in value) return readOwnerAccessRefusal(value.status, value.body);
9649
+ return null;
9650
+ }
9651
+
9652
+ function markRefusedPanes(overlay, refusedReads) {
9653
+ for (const name of refusedReads) {
9654
+ for (const paneId of SETTINGS_READ_PANES[name] || []) markNoAccess(kit.paneOf(overlay, paneId));
9655
+ }
9656
+ }
9657
+
9658
+ /** A pane that loads itself (Browser, MoreLogin): its read refused → "No access" and the nav item says so. */
9659
+ function markPaneRefused(overlay, paneId, refusal) {
9660
+ if (!refusal) return false;
9661
+ noteOwnerAccessRefusal(refusal);
9662
+ markNoAccess(kit.paneOf(overlay, paneId));
9663
+ kit.setNavStatus(overlay, paneId, 'refused');
9664
+ return true;
9665
+ }
9666
+
9596
9667
 
9597
9668
  // ═══════════════════════════════════════════
9598
9669
  // MEMORY SYNC
@@ -14,6 +14,7 @@ import { registerAction } from './ui-keybinds.js';
14
14
  import { isGuest, hasPermission } from './ui-sync.js';
15
15
  import { getWhiteboardElementById } from './ui-whiteboard.js';
16
16
  import { createFrameRenderer } from './utils.js';
17
+ import { refreshPageSession } from './page-session.js';
17
18
  import { frameRect, onFrameChange, clampBox, clampBoxLoose } from './app-frame.js';
18
19
  import { notify, NOTIF_TYPE } from './ui-notifications.js';
19
20
  import { getProviderMeta } from './provider-icons.js';
@@ -22,6 +23,7 @@ import { initRendererManager, acquireRenderer, disposeRenderer, hasWebgl, noteFo
22
23
  import { mountAssistant } from './assistant/asst-panel.js';
23
24
  import { getAssistantSession } from './assistant/asst-api.js';
24
25
  import { mascotCameoSvg } from './synabun-mascot.js';
26
+ import { refusalOfError } from './owner-access.js';
25
27
  import { brainLabel, normalizeBrain, readStoredBrain, restoredSessionName, sessionNameGivenUp } from './assistant/asst-state.js';
26
28
  import { initAssistant, registerAssistantHost, openAssistant, assistantOwnerOf, readLiveAssistantSessions, assistantBlocked, isAssistantSessionLive } from './ui-assistant.js';
27
29
 
@@ -3051,7 +3053,9 @@ async function openBrowserSession(url, fresh, _unused, force) {
3051
3053
  if (!_wsReconnectAttempted) {
3052
3054
  _wsReconnectAttempted = true;
3053
3055
  console.log('[browser] WS closed unexpectedly, attempting reconnect for', sessionId);
3054
- setTimeout(() => {
3056
+ setTimeout(async () => {
3057
+ // A socket refused for an earlier boot's page secret never says why: ask for this boot's first.
3058
+ await refreshPageSession(window);
3055
3059
  const sess2 = _sessions.find(s => s.id === sessionId);
3056
3060
  if (!sess2 || sess2.dead) return;
3057
3061
  const proto2 = location.protocol === 'https:' ? 'wss:' : 'ws:';
@@ -3300,7 +3304,9 @@ async function reconnectBrowserSession(sessionId, liveData, saved) {
3300
3304
  if (!_wsReconnAttempted) {
3301
3305
  _wsReconnAttempted = true;
3302
3306
  console.log('[browser] Reconnect WS closed, retrying once for', sessionId);
3303
- setTimeout(() => {
3307
+ setTimeout(async () => {
3308
+ // A socket refused for an earlier boot's page secret never says why: ask for this boot's first.
3309
+ await refreshPageSession(window);
3304
3310
  const sess2 = _sessions.find(s => s.id === sessionId);
3305
3311
  if (!sess2 || sess2.dead) return;
3306
3312
  const proto2 = location.protocol === 'https:' ? 'wss:' : 'ws:';
@@ -6219,12 +6225,14 @@ export async function initTerminal() {
6219
6225
  // ── Auto-reconnect to surviving sessions on page load ──
6220
6226
  const registry = loadSessionRegistry();
6221
6227
  if (registry.length > 0) {
6222
- // Fetch live terminal sessions
6228
+ // Fetch live terminal sessions. A read the server refused this page (no owner access: SynaBun's automation
6229
+ // browser opened it) says nothing about which sessions live: the saved list is then left as it is (below).
6230
+ let refusedRead = false;
6223
6231
  let liveSessions = [];
6224
6232
  try {
6225
6233
  const data = await fetchTerminalSessions();
6226
6234
  liveSessions = data.sessions || [];
6227
- } catch {}
6235
+ } catch (err) { if (refusalOfError(err)) refusedRead = true; }
6228
6236
  const liveMap = new Map(liveSessions.map(s => [s.id, s]));
6229
6237
 
6230
6238
  // Fetch live browser sessions + check stream config
@@ -6233,7 +6241,7 @@ export async function initTerminal() {
6233
6241
  try {
6234
6242
  const data = await fetchBrowserSessions();
6235
6243
  liveBrowserSessions = data.sessions || [];
6236
- } catch {}
6244
+ } catch (err) { if (refusalOfError(err)) refusedRead = true; }
6237
6245
  try {
6238
6246
  const cfgRes = await fetch('/api/browser/config');
6239
6247
  const cfgData = await cfgRes.json();
@@ -6319,8 +6327,8 @@ export async function initTerminal() {
6319
6327
 
6320
6328
  _markLatePaneSwitches();
6321
6329
 
6322
- // Clean up dead sessions from registry
6323
- if (toReconnect.length !== registry.length) {
6330
+ // Clean up dead sessions from registry (never after a refused read: those sessions may well be alive)
6331
+ if (toReconnect.length !== registry.length && !refusedRead) {
6324
6332
  saveSessionRegistry();
6325
6333
  }
6326
6334
  }
@@ -15,6 +15,7 @@ import { createBrainPicker } from './assistant/asst-brain-picker.js';
15
15
  import { createComposer } from './assistant/asst-composer.js';
16
16
  import { createComputerToggle } from './assistant/asst-computer.js';
17
17
  import { createRouteModeControl } from './assistant/asst-route.js';
18
+ import { watchEmpty } from './shown-children.js';
18
19
 
19
20
  const macLike = () => /Mac/i.test(navigator.platform || navigator.userAgent || '');
20
21
 
@@ -28,6 +29,8 @@ export function createTutorialPreview(panel, { onSend = () => {} } = {}) {
28
29
  bar.innerHTML = '<div class="asst-bar"><div class="asst-bar-left"><div class="asst-bar-group" data-group="route"></div><div class="asst-bar-group" data-group="context"></div><div class="asst-bar-group" data-group="computer"></div></div><div class="asst-bar-right"></div></div>';
29
30
  panel.querySelector('.asp-body').append(viewport);
30
31
  panel.querySelector('.asp-bar-slot').append(bar);
32
+ // A group with nothing to show is hidden through data-empty, as in the panel (asst-panel.js).
33
+ const barEmpty = watchEmpty(bar, '.asst-bar-group');
31
34
  const root = viewport.querySelector('.asst-root');
32
35
  const transcript = root.querySelector('.asst-transcript');
33
36
  transcript.setAttribute('aria-label', t('assistant.transcript'));
@@ -96,6 +99,7 @@ export function createTutorialPreview(panel, { onSend = () => {} } = {}) {
96
99
  route.destroy();
97
100
  computer.destroy();
98
101
  renderer.destroy?.();
102
+ barEmpty.disconnect();
99
103
  viewport.remove();
100
104
  bar.remove();
101
105
  },
@@ -71,6 +71,9 @@ function applyTopRightButton(data) {
71
71
  if (!btn) return;
72
72
  const has = !!data?.updateAvailable;
73
73
  btn.style.display = has ? '' : 'none';
74
+ // The same state on <html> for styles.css (the row's width, the dot on the tools toggle): a selector reading the
75
+ // button's inline style from the root re-styled the whole page on every style change (css-has-performance test).
76
+ document.documentElement.classList.toggle('topright-update-shown', has);
74
77
  if (badge) {
75
78
  badge.classList.add('update-click-target');
76
79
  badge.textContent = has ? '!' : '';
@@ -15,6 +15,7 @@ import { openSettingsModal } from './ui-settings.js';
15
15
  import { fetchRulesStatus } from './api.js';
16
16
  import { registerContextMenuArea } from './context-menu-areas.js';
17
17
  import { frameRect } from './app-frame.js';
18
+ import { windowTakesKey } from './window-keys.js';
18
19
  import { readListItems, writeListItems, fitListLevels, indentListItem, outdentListItem, listMarkers } from './whiteboard-list.js';
19
20
 
20
21
  // ── Helpers ──
@@ -3090,6 +3091,9 @@ function onKeyDown(e) {
3090
3091
  // Nor while it is in the File Explorer, or in what it opens over the page (its menu, preview and questions):
3091
3092
  // Delete there deletes a file, and a letter is the name of a row being typed.
3092
3093
  if (ae?.closest?.('#file-explorer-panel, .fe-ctx-flyout, .fe-modal-overlay, .fe-git-popover')) return;
3094
+ // Nor a key of an open Notifications or Automation Studio window, and their Escape wherever the focus is (they
3095
+ // close on it; window-keys.js): taken here first, it never reached them.
3096
+ if (windowTakesKey(e, ae)) return;
3093
3097
 
3094
3098
  const isEditingText = !!document.activeElement?.closest('.wb-text.editing');
3095
3099
  const editingListLi = document.activeElement?.closest('.wb-list.editing li') || null;
@@ -0,0 +1,38 @@
1
+ // ═══════════════════════════════════════════
2
+ // SynaBun Neural Interface — which keys a floating window takes from the whiteboard
3
+ // ═══════════════════════════════════════════
4
+ //
5
+ // The whiteboard listens for keys at the document in the capture phase, ahead of every element, and stops the ones
6
+ // it acts on (Escape deselects and resets the tool there). The Notifications window (ui-sessions.js) and Automation
7
+ // Studio (ui-automation-studio.js) close on Escape from a listener at the document, so on a page showing the board
8
+ // that Escape never reached them. While one of these windows is open:
9
+ // • a key pressed inside it (target or focus) is the window's, never a board shortcut;
10
+ // • Escape is the window's wherever the focus is (the window is the top layer: its backdrop covers the board, and
11
+ // its own Escape handling closes a list, a popover or the search first), except while a text on the board is
12
+ // being edited (the focus is inside the board): that Escape still ends the edit.
13
+ // Text fields keep their own Escape: the whiteboard leaves keys typed in a field alone already.
14
+ //
15
+ // No DOM needed: `node --test` passes stand-ins with closest / querySelector (tests/window-keys.test.mjs).
16
+
17
+ /** The windows that close on Escape and take it from the board. */
18
+ export const ESCAPE_WINDOWS = Object.freeze(['#session-monitor-panel', '#automation-studio-panel']);
19
+ const SELECTOR = ESCAPE_WINDOWS.join(', ');
20
+ const BOARD = '#static-bg';
21
+
22
+ const inside = (node, selector) => {
23
+ try { return !!(node && typeof node.closest === 'function' && node.closest(selector)); } catch { return false; }
24
+ };
25
+
26
+ /** Whether one of ESCAPE_WINDOWS is on the page. */
27
+ export function escapeWindowOpen(doc = globalThis.document) {
28
+ try { return !!(doc && typeof doc.querySelector === 'function' && doc.querySelector(SELECTOR)); } catch { return false; }
29
+ }
30
+
31
+ /** Whether the board must leave this key to an open window (see above). */
32
+ export function windowTakesKey(event, active = globalThis.document?.activeElement, doc = globalThis.document) {
33
+ if (!event) return false;
34
+ if (inside(event.target, SELECTOR) || inside(active, SELECTOR)) return true;
35
+ if (event.key !== 'Escape') return false;
36
+ if (inside(active, BOARD)) return false;
37
+ return escapeWindowOpen(doc);
38
+ }