synabun 2.4.5 → 2.4.7

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 (108) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +1 -1
  3. package/docs/whatsapp.md +17 -1
  4. package/hooks/claude-code/session-start.mjs +21 -18
  5. package/lib/claude-global-config.js +214 -0
  6. package/lib/client-config-repair.js +17 -3
  7. package/mcp-server/dist/index.d.ts.map +1 -1
  8. package/mcp-server/dist/index.js +6 -1
  9. package/mcp-server/dist/index.js.map +1 -1
  10. package/mcp-server/dist/services/tool-catalog.js +1 -1
  11. package/mcp-server/dist/services/tool-catalog.js.map +1 -1
  12. package/mcp-server/dist/tools/agents.d.ts +2 -0
  13. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  14. package/mcp-server/dist/tools/agents.js +11 -5
  15. package/mcp-server/dist/tools/agents.js.map +1 -1
  16. package/mcp-server/dist/tools/skill-tools.d.ts +24 -5
  17. package/mcp-server/dist/tools/skill-tools.d.ts.map +1 -1
  18. package/mcp-server/dist/tools/skill-tools.js +88 -8
  19. package/mcp-server/dist/tools/skill-tools.js.map +1 -1
  20. package/mcp-server/dist/tools/tool-groups.d.ts.map +1 -1
  21. package/mcp-server/dist/tools/tool-groups.js +19 -4
  22. package/mcp-server/dist/tools/tool-groups.js.map +1 -1
  23. package/mcp-server/package-lock.json +2 -2
  24. package/mcp-server/package.json +1 -1
  25. package/mcp-server/src/index.ts +6 -1
  26. package/mcp-server/src/services/tool-catalog.ts +1 -1
  27. package/mcp-server/src/tools/agents.ts +11 -5
  28. package/mcp-server/src/tools/skill-tools.ts +82 -9
  29. package/mcp-server/src/tools/tool-groups.ts +19 -4
  30. package/neural-interface/i18n/en.json +153 -10
  31. package/neural-interface/i18n/pt-BR.json +153 -10
  32. package/neural-interface/lib/antigravity/panel-bridge.js +7 -3
  33. package/neural-interface/lib/assistant-dispatch.js +15 -1
  34. package/neural-interface/lib/assistant-runtime.js +79 -8
  35. package/neural-interface/lib/assistant-user-context.js +7 -3
  36. package/neural-interface/lib/browser-background-tab.js +12 -0
  37. package/neural-interface/lib/browser-guard-cdp.js +2 -1
  38. package/neural-interface/lib/browser-network-guard.js +140 -3
  39. package/neural-interface/lib/browser-own-targets.js +350 -0
  40. package/neural-interface/lib/claude-agent-bridge.js +13 -2
  41. package/neural-interface/lib/codex-thread-history.js +144 -7
  42. package/neural-interface/lib/codex-worker-app-server.js +84 -30
  43. package/neural-interface/lib/db.js +26 -0
  44. package/neural-interface/lib/greeting/sources.js +7 -3
  45. package/neural-interface/lib/jsonl-lines.js +10 -11
  46. package/neural-interface/lib/launch-block-api.js +86 -0
  47. package/neural-interface/lib/line-buffer.js +88 -0
  48. package/neural-interface/lib/loop-stall.js +15 -1
  49. package/neural-interface/lib/memory-list-read.js +105 -0
  50. package/neural-interface/lib/memory-timers.js +4 -1
  51. package/neural-interface/lib/morelogin-launch-recovery.js +506 -0
  52. package/neural-interface/lib/morelogin-profile-failures.js +48 -1
  53. package/neural-interface/lib/morelogin.js +16 -2
  54. package/neural-interface/lib/native-loop-runtime.js +7 -3
  55. package/neural-interface/lib/provider-panel-api-key-auth.js +33 -6
  56. package/neural-interface/lib/skills/api-v2.js +18 -3
  57. package/neural-interface/lib/skills/bundle.js +2 -2
  58. package/neural-interface/lib/skills/deploy.js +169 -34
  59. package/neural-interface/lib/skills/digest.js +57 -3
  60. package/neural-interface/lib/skills/health.js +55 -1
  61. package/neural-interface/lib/skills/known-bridge-digests.json +12 -0
  62. package/neural-interface/lib/skills/runtime-checks.js +7 -4
  63. package/neural-interface/lib/skills/scan-shell.js +56 -7
  64. package/neural-interface/lib/skills/scan.js +13 -12
  65. package/neural-interface/lib/skills/service.js +7 -2
  66. package/neural-interface/lib/skills/telemetry.js +2 -2
  67. package/neural-interface/lib/teams/README.md +12 -5
  68. package/neural-interface/lib/teams/api.js +15 -4
  69. package/neural-interface/lib/teams/index.js +2 -0
  70. package/neural-interface/lib/teams/landing.js +195 -75
  71. package/neural-interface/lib/teams/scheduler.js +31 -32
  72. package/neural-interface/lib/terminal-token-redaction.js +228 -58
  73. package/neural-interface/lib/terminal-tokens.js +18 -0
  74. package/neural-interface/lib/whatsapp/brain.js +21 -0
  75. package/neural-interface/lib/whatsapp/bridge.js +40 -4
  76. package/neural-interface/package-lock.json +2 -2
  77. package/neural-interface/package.json +1 -1
  78. package/neural-interface/public/index.html +117 -37
  79. package/neural-interface/public/shared/agents/studio/ax-api.js +11 -0
  80. package/neural-interface/public/shared/agents/studio/ax-create-view.js +1 -1
  81. package/neural-interface/public/shared/agents/studio/ax-icons.js +1 -0
  82. package/neural-interface/public/shared/agents/studio/ax-library-view.js +3 -2
  83. package/neural-interface/public/shared/agents/studio/ax-main.js +127 -41
  84. package/neural-interface/public/shared/agents/studio/ax-review-view.js +3 -2
  85. package/neural-interface/public/shared/agents/studio/ax-teams-view.js +137 -39
  86. package/neural-interface/public/shared/agents/studio/ax-teams.js +219 -4
  87. package/neural-interface/public/shared/agents/studio/ax-ui.js +31 -0
  88. package/neural-interface/public/shared/agents/studio/ax-views.js +67 -69
  89. package/neural-interface/public/shared/agents/studio/ax-work-answer.js +86 -0
  90. package/neural-interface/public/shared/agents/studio/ax-work-view.js +305 -0
  91. package/neural-interface/public/shared/agents/studio/ax-work.css +74 -0
  92. package/neural-interface/public/shared/agents/studio/ax-work.js +300 -0
  93. package/neural-interface/public/shared/cdx/cdx-deferred.js +90 -0
  94. package/neural-interface/public/shared/cdx/cdx-render.js +18 -7
  95. package/neural-interface/public/shared/cdx/cdx-tabs.js +2 -1
  96. package/neural-interface/public/shared/launch-block-view.js +124 -0
  97. package/neural-interface/public/shared/loading-diagnostic-entry.js +16 -1
  98. package/neural-interface/public/shared/skills/studio/sx-operations-view.js +5 -0
  99. package/neural-interface/public/shared/skills/studio/sx-plan.js +42 -3
  100. package/neural-interface/public/shared/skills/studio/sx-publish-view.js +20 -4
  101. package/neural-interface/public/shared/styles.css +17 -0
  102. package/neural-interface/public/shared/ui-launch-block-notice.js +155 -0
  103. package/neural-interface/public/shared/ui-navbar.js +11 -0
  104. package/neural-interface/public/shared/ui-sync.js +2 -0
  105. package/neural-interface/server.js +745 -270
  106. package/npm-shrinkwrap.json +2 -2
  107. package/package.json +2 -1
  108. package/skills/skill-forge/SKILL.md +7 -3
@@ -0,0 +1,124 @@
1
+ // ═══════════════════════════════════════════
2
+ // SynaBun Neural Interface — the notice that launches keep failing on a browser profile: what it says
3
+ // ═══════════════════════════════════════════
4
+ //
5
+ // When the launches of one browser profile (a MoreLogin profile, a local one) fail several times in a row, the
6
+ // server keeps one notice for it (lib/morelogin-launch-recovery.js, GET /api/system/launch-blocks): which profile,
7
+ // how many launches, the error, what SynaBun did about it and what fixes it. The owner's pages show it until a
8
+ // launch works there again or the owner dismisses it: one notice for the streak, never one per run. This module
9
+ // decides the words; ui-launch-block-notice.js asks the server and draws them.
10
+ //
11
+ // The fix it names is the one that matches what failed:
12
+ // - restart: the profile's browser does not answer, or a tab in it froze (SynaBun restarts such a profile itself
13
+ // once; it is named when that did not help, or was not allowed: another automation had a tab there);
14
+ // - start-limit: MoreLogin's plan allows no more starts today;
15
+ // - check: anything else (the profile is gone, MoreLogin is closed, …).
16
+ //
17
+ // No imports and no DOM: `node --test` loads this file as it is (tests/launch-block-view.test.mjs).
18
+ // LAUNCH_BLOCK_COPY is the English of every sentence; `launchBlock.*` in i18n/en.json must equal it and
19
+ // i18n/pt-BR.json must have the same keys.
20
+
21
+ export const LAUNCH_BLOCK_COPY = Object.freeze({
22
+ label: 'Runs keep failing to start in a browser profile',
23
+ title: 'Runs in {profile} keep failing to start.',
24
+ countToday: '{count} launches in a row failed, the last at {time}.',
25
+ countEarlier: '{count} launches in a row failed, the last on {date} at {time}.',
26
+ launches: 'Last affected: {names}.',
27
+ errorTitle: 'What the browser answered',
28
+ restartedFailed: 'SynaBun restarted the profile once at {time} and the next launch failed too.',
29
+ restartFailed: 'SynaBun tried to restart the profile at {time} and could not.',
30
+ notRestarted: 'SynaBun did not restart the profile.',
31
+ fixTitle: 'How to fix it',
32
+ fixRestart: 'Stop the profile and start it again, in MoreLogin or in Settings → Connected tools → MoreLogin. If the tab the error names opens again and freezes, close it.',
33
+ fixStartLimit: 'MoreLogin allows no more starts of this profile today. Wait for its daily reset, raise the plan, or keep the profile open so runs need no new start.',
34
+ fixCheck: 'Check the profile in MoreLogin or in Settings → Connected tools → MoreLogin: that it still exists, that MoreLogin is open, and that it starts.',
35
+ profileNamed: '"{name}"',
36
+ profileById: 'profile {id}',
37
+ dismiss: 'Dismiss',
38
+ });
39
+
40
+ /** The fix sentence for each fix the server names. */
41
+ export const LAUNCH_BLOCK_FIX_KEYS = Object.freeze({ restart: 'fixRestart', 'start-limit': 'fixStartLimit', check: 'fixCheck' });
42
+
43
+ /** A sentence of LAUNCH_BLOCK_COPY in English with its {values} filled; an unknown key is itself. */
44
+ export function fillLaunchBlockCopy(key, params = {}) {
45
+ const text = Object.prototype.hasOwnProperty.call(LAUNCH_BLOCK_COPY, key) ? LAUNCH_BLOCK_COPY[key] : key;
46
+ return text.replace(/\{(\w+)\}/g, (whole, name) => (params[name] != null ? String(params[name]) : whole));
47
+ }
48
+
49
+ const ID = /^[0-9a-f]{16,32}$/;
50
+ const FIXES = new Set(Object.keys(LAUNCH_BLOCK_FIX_KEYS));
51
+ const FAILED_RESTARTS = new Set(['stop-failed', 'start-failed']);
52
+ const line = (value, max) => (typeof value === 'string' ? value.replace(/[\u0000-\u001f]+/g, ' ').trim().slice(0, max) : '');
53
+ const time = (value) => (Number.isFinite(Number(value)) && Number(value) > 0 ? Number(value) : null);
54
+
55
+ /**
56
+ * The notices in an answer of GET /api/system/launch-blocks (or a `schedule:launch-blocked` message: both carry
57
+ * `notices`), each checked field by field; what is not a notice is left out.
58
+ */
59
+ export function readLaunchBlockNotices(answer) {
60
+ const list = answer && typeof answer === 'object' && Array.isArray(answer.notices) ? answer.notices : [];
61
+ const out = [];
62
+ for (const notice of list) {
63
+ if (!notice || typeof notice !== 'object' || typeof notice.id !== 'string' || !ID.test(notice.id)) continue;
64
+ const envId = line(String(notice.envId ?? ''), 128);
65
+ if (!envId) continue;
66
+ const recovery = notice.recovery && typeof notice.recovery === 'object' && time(notice.recovery.at) && typeof notice.recovery.outcome === 'string'
67
+ ? { at: time(notice.recovery.at), outcome: line(notice.recovery.outcome, 32) } : null;
68
+ out.push({
69
+ id: notice.id, envId, name: line(notice.name, 200),
70
+ count: Number.isInteger(notice.count) && notice.count > 0 ? Math.min(notice.count, 9999) : 1,
71
+ lastAt: time(notice.lastAt), error: line(notice.error, 600),
72
+ fix: FIXES.has(notice.fix) ? notice.fix : 'check',
73
+ launches: (Array.isArray(notice.launches) ? notice.launches : []).map((name) => line(name, 120)).filter(Boolean).slice(0, 5),
74
+ recovery,
75
+ });
76
+ if (out.length >= 10) break;
77
+ }
78
+ return out;
79
+ }
80
+
81
+ /** When something happened, in the reader's locale: { today, date, time } (the date is for another day). */
82
+ export function launchBlockTimeParts(at, { now = Date.now(), locale = undefined } = {}) {
83
+ const when = new Date(at);
84
+ if (!Number.isFinite(when.getTime())) return null;
85
+ const day = new Date(now);
86
+ const today = when.getFullYear() === day.getFullYear() && when.getMonth() === day.getMonth() && when.getDate() === day.getDate();
87
+ const format = (fn, options, fallback) => { try { return fn.call(when, locale, options); } catch { return fallback; } };
88
+ return {
89
+ today,
90
+ date: format(Date.prototype.toLocaleDateString, { dateStyle: 'medium' }, when.toISOString().slice(0, 10)),
91
+ time: format(Date.prototype.toLocaleTimeString, { hour: '2-digit', minute: '2-digit' }, when.toISOString().slice(11, 16)),
92
+ };
93
+ }
94
+
95
+ /**
96
+ * What one notice shows, or null: { id, label, title, count, launches, errorTitle, error, did, fixTitle, fix,
97
+ * actions[] }. `t(key, params)` is a sentence of LAUNCH_BLOCK_COPY in the page's language.
98
+ */
99
+ export function launchBlockView(notice, { t = fillLaunchBlockCopy, now = Date.now(), locale = undefined } = {}) {
100
+ if (!notice || typeof notice !== 'object' || !notice.id) return null;
101
+ const profile = notice.name ? t('profileNamed', { name: notice.name }) : t('profileById', { id: notice.envId });
102
+ const last = launchBlockTimeParts(notice.lastAt, { now, locale }) || { today: true, date: '', time: '' };
103
+ const restart = notice.recovery ? launchBlockTimeParts(notice.recovery.at, { now, locale }) : null;
104
+ // What SynaBun did is said only for the fix it belongs to: a restart that did not help, or one it could not make.
105
+ let did = '';
106
+ if (notice.fix === 'restart') {
107
+ if (notice.recovery?.outcome === 'restarted-retry-failed' && restart) did = t('restartedFailed', { time: restart.time });
108
+ else if (FAILED_RESTARTS.has(notice.recovery?.outcome) && restart) did = t('restartFailed', { time: restart.time });
109
+ else did = t('notRestarted');
110
+ }
111
+ return {
112
+ id: notice.id,
113
+ label: t('label'),
114
+ title: t('title', { profile }),
115
+ count: t(last.today ? 'countToday' : 'countEarlier', { count: notice.count, date: last.date, time: last.time }),
116
+ launches: notice.launches?.length ? t('launches', { names: notice.launches.join(', ') }) : '',
117
+ errorTitle: t('errorTitle'),
118
+ error: notice.error || '',
119
+ did,
120
+ fixTitle: t('fixTitle'),
121
+ fix: t(LAUNCH_BLOCK_FIX_KEYS[notice.fix] || 'fixCheck'),
122
+ actions: [{ id: 'dismiss', label: t('dismiss') }],
123
+ };
124
+ }
@@ -1,5 +1,6 @@
1
1
  // The complete wire format. Neither a health body, a translated subtitle, a URL,
2
- // nor an exception/refusal message belongs in the trail or the server log.
2
+ // nor an exception/refusal message belongs in the trail or the server log. The one
3
+ // name it carries is a file name of SynaBun's own first frame (`import-probe`).
3
4
  export const DIAGNOSTIC_BATCH = 20;
4
5
  const loadingTitles = [
5
6
  'loading.serverOffline', 'loading.connectionFailed', 'loading.health.databaseUnreachable.title',
@@ -8,6 +9,7 @@ const loadingTitles = [
8
9
 
9
10
  const bool = value => typeof value === 'boolean';
10
11
  const count = value => Number.isInteger(value) && value >= 1 && value <= 20;
12
+ const upTo = max => value => Number.isInteger(value) && value >= 0 && value <= max;
11
13
  const oneOf = (...values) => value => values.includes(value);
12
14
  const states = oneOf('idle', 'launching', 'starting', 'waiting', 'stalled', 'failed', 'online', 'restarting', 'refused');
13
15
  const moduleName = oneOf('entry', 'app');
@@ -40,6 +42,19 @@ const events = {
40
42
  'probe-answered': { misses: count, seconds: value => Number.isInteger(value) && value >= 0 && value <= 3600 },
41
43
  'import-failed': { module: moduleName },
42
44
  'import-retry': { module: moduleName },
45
+ // What index.html found when it asked again, plainly, for every module of a first frame that failed to load: how
46
+ // the document came (and whether from the network), whether a service worker controls it, how many of the modules
47
+ // could not be fetched and the first of them (its file name, never an address), with why.
48
+ 'import-probe': {
49
+ module: moduleName,
50
+ navigation: oneOf('navigate', 'reload', 'back_forward', 'prerender', 'unknown'),
51
+ document: oneOf('network', 'cache', 'unknown'),
52
+ worker: oneOf('controlled', 'none', 'unsupported'),
53
+ asked: upTo(40), failed: upTo(40),
54
+ first: value => value === '' || (typeof value === 'string' && /^[a-z0-9][a-z0-9.-]{0,47}\.js$/.test(value)),
55
+ reason: oneOf('none', 'network', 'timeout', 'status', 'type'),
56
+ status: upTo(599),
57
+ },
43
58
  };
44
59
 
45
60
  function matches(object, fields) {
@@ -74,6 +74,9 @@ export async function renderOperationsPlace(host, ctx, place) {
74
74
  }
75
75
  function healthHTML(data, usage, settings, scanners) {
76
76
  const nameOf = (id) => ctx.data?.skills?.find((s) => s.skillId === id)?.name || id;
77
+ // Per runtime (health.js runtimeVerification): which are not confirmed yet, which have no listing to ask.
78
+ const runtimeNames = (list) => list.map((rt) => (['claude', 'codex', 'opencode', 'antigravity'].includes(rt) ? ctx.t(`skillsStudio.runtime.${rt}`) : rt)).join(', ');
79
+ const staticOnly = (r) => Object.entries(r.runtimes || {}).filter(([, v]) => v?.verification === 'static-only').map(([rt]) => rt);
77
80
  return html`<div class="sx-ops-grid"><section class="sx-ops-card">
78
81
  <h4 class="sx-section-title">${t('collection')}</h4><label class="sx-choice"><input type="checkbox" id="sx-usage-enabled"${attr('checked', settings.telemetryEnabled)}${attr('disabled', ctx.guest)}> ${t('collect')}</label>
79
82
  <label class="sx-field-label" for="sx-retention">${t('retention')}</label><input class="sx-input" type="number" id="sx-retention" min="1" max="365" value="${settings.retentionDays}"${attr('disabled', ctx.guest)}>
@@ -89,6 +92,8 @@ export async function renderOperationsPlace(host, ctx, place) {
89
92
  <h4 class="sx-section-title">${t('usage')}</h4>${usage.rows.length ? html`<div class="sx-ops-grid">${usage.rows.map((r) => html`<article class="sx-ops-card"><strong>${nameOf(r.skillId)} · ${r.runtime}</strong><p class="sx-help">${r.revisionId}</p><p>${t('counts', r)}</p></article>`)}</div>` : html`<p class="sx-help">${t('noUsage')}</p>`}
90
93
  <h4 class="sx-section-title">${t('installations')}</h4>${data.rows.length ? html`<div class="sx-ops-grid">${data.rows.map((r) => html`<article class="sx-ops-card"><strong>${r.name || nameOf(r.skillId)} · ${r.runtime}</strong>
91
94
  <p class="sx-help">${r.revisionId}</p><p class="${r.issues.length ? 'sx-warn-text' : 'sx-help'}">${t(`state_${r.status}`)}</p>
95
+ ${r.unverifiedRuntimes?.length ? html`<p class="sx-help">${t('unverifiedRuntimes', { runtimes: runtimeNames(r.unverifiedRuntimes) })}</p>` : ''}
96
+ ${staticOnly(r).length ? html`<p class="sx-help">${t('staticOnlyRuntimes', { runtimes: runtimeNames(staticOnly(r)) })}</p>` : ''}
92
97
  <ul class="sx-plain-list">${r.issues.map((i) => html`<li>${t(`issue_${i}`)}</li>`)}</ul>
93
98
  ${r.scan ? html`<p class="sx-help">${r.scan.engine} ${r.scan.engineVersion} · ${r.scan.policy}</p><ul class="sx-plain-list">${r.scan.findings.slice(0, 12).map((f) => html`<li>${f.severity} · ${f.ruleId} · ${f.file || ''}${f.line ? `:${f.line}` : ''} — ${scanFindingText(t, f)}</li>`)}</ul>` : ''}
94
99
  </article>`)}</div>` : html`<p class="sx-help">${t('noChecks')}</p>`}
@@ -19,8 +19,10 @@ export const BLOCK_CODES = Object.freeze(['no_root', 'shared_root_off', 'root_re
19
19
  export const REFRESH_KINDS = Object.freeze(['automatic', 'reload-skills', 'new-session', 'panel-reload', 'terminal-only']);
20
20
  // Why a runtime could not be asked on Verify (lib/skills/runtime-checks.js probe, deploy.js verify): each has its words.
21
21
  export const PROBE_CODES = Object.freeze(['not-installed', 'not-running', 'no-answer', 'no-list', 'terminal-only']);
22
- export const ELIGIBILITY_STATES = Object.freeze(['enabled', 'disabled', 'unknown']);
23
- export const ELIGIBILITY_REASONS = Object.freeze(['codex-config', 'claude-override', 'claude-deny', 'opencode-permission', 'unreadable', 'invalid-json']);
22
+ // 'not-checked': a runtime whose settings SynaBun does not read (Antigravity, reason `not-read`); never "could not
23
+ // be read", so the plan says nothing about it (sx-install.js lists only disabled and unknown-with-a-reason).
24
+ export const ELIGIBILITY_STATES = Object.freeze(['enabled', 'disabled', 'unknown', 'not-checked']);
25
+ export const ELIGIBILITY_REASONS = Object.freeze(['codex-config', 'claude-override', 'claude-deny', 'opencode-permission', 'unreadable', 'invalid-json', 'not-read']);
24
26
  export const RESULT_STATES = Object.freeze(['committed', 'skipped', 'needs-confirmation', 'failed']);
25
27
 
26
28
  const list = (v) => (Array.isArray(v) ? v : []);
@@ -137,20 +139,57 @@ export function resultModel(result) {
137
139
  }));
138
140
  }
139
141
 
140
- /** What a verify found, fact by fact; nothing is claimed that the service did not establish ("loaded" never is). */
142
+ // Per runtime of an installation (lib/skills/deploy.js eligibilityByRuntime): 'not-checked' is a runtime whose
143
+ // settings SynaBun does not read (Antigravity), never "could not be read".
144
+ export const RUNTIME_ELIGIBILITY_STATES = ELIGIBILITY_STATES;
145
+ // Whether a runtime was or can be asked (deploy.js probeStates): Codex and OpenCode have a listing; Claude Code and
146
+ // Antigravity never can be asked.
147
+ export const PROBE_STATES = Object.freeze(['found', 'not-found', 'no-answer', 'not-probed', 'cannot-probe']);
148
+ const PROBEABLE_RUNTIMES = ['codex', 'opencode'];
149
+
150
+ /** Per runtime, what asking it said or why it was not asked; a record from before reads the same way. */
151
+ function probeFacts(runtimes, discovered) {
152
+ const d = discovered && typeof discovered === 'object' ? discovered : {};
153
+ return runtimes.map((runtime) => {
154
+ const v = d[runtime];
155
+ const answer = v && typeof v === 'object' ? v.discovered : (typeof v === 'boolean' ? v : undefined);
156
+ const code = PROBE_CODES.includes(v?.code) ? v.code : null;
157
+ if (answer === true) return { runtime, state: 'found', code: null };
158
+ if (answer === false) return { runtime, state: 'not-found', code: null };
159
+ if (!PROBEABLE_RUNTIMES.includes(runtime) || code === 'no-list') return { runtime, state: 'cannot-probe', code: 'no-list' };
160
+ if (code === 'terminal-only') return { runtime, state: 'cannot-probe', code };
161
+ if (v && typeof v === 'object') return { runtime, state: 'no-answer', code };
162
+ return { runtime, state: 'not-probed', code: null };
163
+ });
164
+ }
165
+
166
+ /**
167
+ * What a verify (or the check SynaBun runs right after an install) found, fact by fact; nothing is claimed that the
168
+ * service did not establish ("loaded" never is). Takes an installation record or a skill view's installation row
169
+ * (`affectedRuntimes`, `state`). `checked`: whether a check ever ran (a record from before the automatic check
170
+ * that nobody verified has not).
171
+ */
141
172
  export function verifyFacts(installation) {
142
173
  const s = installation?.state || {};
143
174
  const written = s.writtenCheck || (s.written === true ? 'verified' : s.written === false ? 'changed' : 'unknown');
144
175
  const discovered = s.discovered && typeof s.discovered === 'object'
145
176
  ? Object.entries(s.discovered).map(([runtime, v]) => ({ runtime, discovered: v?.discovered ?? (typeof v === 'boolean' ? v : null), error: v?.error || null, code: PROBE_CODES.includes(v?.code) ? v.code : null }))
146
177
  : [];
178
+ const runtimes = list(installation?.destination?.affectedRuntimes).length ? list(installation.destination.affectedRuntimes) : list(installation?.affectedRuntimes);
179
+ const byRuntime = s.eligibilityByRuntime && typeof s.eligibilityByRuntime === 'object' ? s.eligibilityByRuntime : {};
180
+ const reasons = s.eligibilityReasons && typeof s.eligibilityReasons === 'object' ? s.eligibilityReasons : {};
147
181
  return {
148
182
  written,
149
183
  discoverable: s.discoverable === true ? 'yes' : s.discoverable === false ? 'no' : 'unknown',
150
184
  eligibility: ['enabled', 'disabled'].includes(s.eligibility) ? s.eligibility : 'unknown',
185
+ eligibilityByRuntime: Object.entries(byRuntime).map(([runtime, v]) => ({ runtime, state: RUNTIME_ELIGIBILITY_STATES.includes(v) ? v : 'unknown', reason: reasons[runtime] || null })),
186
+ notChecked: Array.isArray(s.eligibilityNotChecked) ? s.eligibilityNotChecked.slice() : Object.keys(byRuntime).filter((r) => byRuntime[r] === 'not-checked'),
151
187
  discovered,
188
+ probes: probeFacts(runtimes, s.discovered),
152
189
  checks: list(s.checks).map((c) => ({ runtime: c.runtime || null, ok: !!c.ok, message: String(c.message ?? '') })),
153
190
  checkedAt: s.checkedAt || null,
191
+ checked: s.staticCheck?.state === 'ok' || s.discoverable === true || s.discoverable === false,
192
+ checkError: s.staticCheck?.state === 'error' ? String(s.staticCheck.error || '') : null,
154
193
  };
155
194
  }
156
195
 
@@ -21,7 +21,7 @@
21
21
  import { scanStatus, scanText, scanFindingText } from './sx-scan.js';
22
22
  import { studioErrorText } from './sx-errors.js';
23
23
  import { dropdownHTML, wireDropdowns } from '../../cc-dropdown.js';
24
- import { html, raw, setHTML, ICONS, relativeTime, listText } from './sx-dom.js';
24
+ import { html, raw, attr, setHTML, ICONS, relativeTime, listText } from './sx-dom.js';
25
25
  import { installTargets, targetState, wholeTarget, sameAsk } from './sx-subject.js';
26
26
  import { verifyFacts, needsConfirmation, newPublishState, clearPlan, choosePublishRevision, planModel } from './sx-plan.js';
27
27
  import { defaultSelection, scopeOf, simplePicker, moveScope, defaultRevisionId, plainLabel, planLines, installButton, installStatus, whereOf } from './sx-install.js';
@@ -326,7 +326,9 @@ function outcomeHTML(ctx, results) {
326
326
  function installRowHTML(ctx, ws, i, revisionId, owner) {
327
327
  const { t } = ctx;
328
328
  const current = revisionId ? i.sourceRevisionId === revisionId : !i.updateAvailable;
329
- const facts = ws.pub.verify[i.installationId] || null;
329
+ // What Verify just found, else what SynaBun's own check after the install stored (a server from before sends no state).
330
+ const stored = i.state ? verifyFacts(i) : null;
331
+ const facts = ws.pub.verify[i.installationId] || (stored && (stored.checked || stored.checkError !== null) ? stored : null);
330
332
  return html`<li class="sx-install-row">
331
333
  <span class="sx-install-where">${targetWords(ctx, whereOf(i))}</span>
332
334
  <span class="sx-mono sx-dim sx-path" title="${i.destination || ''}">${shortPath(i.destination || '')}</span>
@@ -343,12 +345,26 @@ function factsHTML(t, f) {
343
345
  return html`<ul class="sx-facts sx-install-facts">
344
346
  <li>${t(`skillsStudio.publish.fact.written.${f.written === 'verified' ? 'ok' : f.written === 'missing' ? 'missing' : f.written === 'changed' ? 'changed' : 'unknown'}`)}</li>
345
347
  <li>${t(`skillsStudio.publish.fact.discoverable.${f.discoverable}`)}</li>
346
- <li>${t(`skillsStudio.publish.fact.eligibility.${f.eligibility}`)}</li>
347
- ${f.discovered.map((d) => html`<li>${t(`skillsStudio.publish.fact.discovered.${d.discovered === true ? 'yes' : d.discovered === false ? 'no' : d.code || 'unknown'}`, { runtime: t(`skillsStudio.runtime.${d.runtime}`) })}</li>`)}
348
+ ${(f.eligibilityByRuntime || []).length
349
+ ? f.eligibilityByRuntime.map((e) => html`<li${attr('class', e.state === 'disabled' ? 'sx-warn-text' : null)}>${t(`skillsStudio.publish.fact.eligibilityRuntime.${e.state}`, { runtime: t(`skillsStudio.runtime.${e.runtime}`) })}</li>`)
350
+ : html`<li>${t(`skillsStudio.publish.fact.eligibility.${f.eligibility}`)}</li>`}
351
+ ${(f.probes || []).length ? f.probes.map((p) => html`<li>${probeLine(t, p)}</li>`)
352
+ : f.discovered.map((d) => html`<li>${t(`skillsStudio.publish.fact.discovered.${d.discovered === true ? 'yes' : d.discovered === false ? 'no' : d.code || 'unknown'}`, { runtime: t(`skillsStudio.runtime.${d.runtime}`) })}</li>`)}
353
+ ${f.checkError !== null && f.checkError !== undefined ? html`<li class="sx-warn-text">${t('skillsStudio.publish.fact.checkFailed', { error: f.checkError })}</li>` : ''}
348
354
  ${f.checks.filter((c) => !c.ok).map((c) => html`<li class="sx-warn-text">${c.message}</li>`)}
349
355
  </ul>`;
350
356
  }
351
357
 
358
+ /** One runtime: what asking it said, "cannot be asked" (no listing: Claude Code, Antigravity), or "not asked yet". */
359
+ function probeLine(t, p) {
360
+ const runtime = t(`skillsStudio.runtime.${p.runtime}`);
361
+ if (p.state === 'found') return t('skillsStudio.publish.fact.discovered.yes', { runtime });
362
+ if (p.state === 'not-found') return t('skillsStudio.publish.fact.discovered.no', { runtime });
363
+ if (p.state === 'cannot-probe') return t(p.code === 'terminal-only' ? 'skillsStudio.publish.fact.discovered.terminal-only' : 'skillsStudio.publish.fact.probe.cannot-probe', { runtime });
364
+ if (p.state === 'not-probed') return t('skillsStudio.publish.fact.probe.not-probed', { runtime });
365
+ return t(`skillsStudio.publish.fact.discovered.${p.code || 'unknown'}`, { runtime });
366
+ }
367
+
352
368
  /** The foot of the tab: what is picked, and the one button. */
353
369
  function barHTML(ctx, ws, picker, revisionId, rev) {
354
370
  const { t } = ctx;
@@ -30012,6 +30012,23 @@
30012
30012
  .update-check-toast:not(.crash-notice) ~ .crash-notice,
30013
30013
  .crash-notice:has(~ .update-check-toast:not(.crash-notice)) { bottom: auto; top: 64px; }
30014
30014
  @media (prefers-reduced-motion: reduce) { .crash-notice { transition: none; } }
30015
+ /* The notice that launches keep failing on a browser profile (ui-launch-block-notice.js): the crash notice's toast,
30016
+ one per profile, stacked at the top right so the bottom right stays the update toasts' and the crash notice's. */
30017
+ .launch-block-stack {
30018
+ position: fixed;
30019
+ top: 64px;
30020
+ right: 20px;
30021
+ z-index: 300050;
30022
+ display: flex;
30023
+ flex-direction: column;
30024
+ gap: var(--s-sm, 8px);
30025
+ max-height: calc(100vh - 84px);
30026
+ overflow-y: auto;
30027
+ pointer-events: none;
30028
+ }
30029
+ .launch-block-stack .launch-block-notice { position: static; max-height: none; pointer-events: auto; }
30030
+ .launch-block-notice .launch-block-error { color: var(--t-primary); }
30031
+ .launch-block-notice .launch-block-did { margin-top: 6px; }
30015
30032
  /* The banner of a degraded owner authority (ui-owner-authority.js): the update toast's glass and type (DESIGN.md
30016
30033
  `toast`), at the top centre of the page so it never meets the bottom-right toasts, which replace each other (it is
30017
30034
  not an .update-check-toast for that reason), non-modal (nothing behind it is blocked), with the warning tint of the
@@ -0,0 +1,155 @@
1
+ // ═══════════════════════════════════════════
2
+ // SynaBun Neural Interface — the notice that launches keep failing on a browser profile: the page side
3
+ // ═══════════════════════════════════════════
4
+ //
5
+ // Asks GET /api/system/launch-blocks when the page starts and every time its sync socket connects, and is told of
6
+ // every change at once (`schedule:launch-blocked`, ui-sync.js). What launch-block-view.js says is drawn in the crash
7
+ // notice's shape (styles.css .update-check-toast, .crash-notice, .launch-block-notice: top right, so the bottom
8
+ // right stays the update toasts'), one notice per profile, once the loading screen is gone. It stays until a launch
9
+ // works on the profile again (the server then sends a list without it) or the owner dismisses it (POST
10
+ // /api/system/launch-blocks/dismiss, which tells every other window). Never asked by an invite guest and never
11
+ // drawn for one: /api/system is the owner's, and the server sends `schedule:` messages to the owner's pages only.
12
+ // An older server answers 404: then there is nothing to show.
13
+
14
+ import { on } from './state.js';
15
+ import { getLocale, t } from './i18n.js';
16
+ import { isGuest } from './ui-sync.js';
17
+ import { launchBlockView, readLaunchBlockNotices } from './launch-block-view.js';
18
+
19
+ const NOTICE_URL = '/api/system/launch-blocks';
20
+ const WRITE = Object.freeze({ 'Content-Type': 'application/json', 'X-SynaBun-UI': '1', Accept: 'application/json' });
21
+ const STACK_ID = 'launch-block-notices';
22
+
23
+ const translate = (key, params) => t(`launchBlock.${key}`, params);
24
+
25
+ let _wired = false;
26
+ let _asking = null;
27
+ let _guest = false;
28
+ let _notices = []; // what the server last said
29
+ const _dismissed = new Set(); // dismissed here while the server is asked
30
+
31
+ const guestPage = () => _guest || isGuest();
32
+
33
+ function esc(value) {
34
+ return String(value ?? '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
35
+ }
36
+
37
+ /** The loading screen covers the page while it starts: the notices wait for it to go. */
38
+ function whenPageShown(run) {
39
+ const overlay = document.getElementById('loading-overlay');
40
+ if (!overlay || overlay.classList.contains('hidden')) { run(); return; }
41
+ const watch = new MutationObserver(() => {
42
+ if (!overlay.classList.contains('hidden')) return;
43
+ watch.disconnect();
44
+ run();
45
+ });
46
+ watch.observe(overlay, { attributes: true, attributeFilter: ['class'] });
47
+ }
48
+
49
+ function stack() {
50
+ let el = document.getElementById(STACK_ID);
51
+ if (!el) {
52
+ el = document.createElement('div');
53
+ el.id = STACK_ID;
54
+ el.className = 'launch-block-stack';
55
+ document.body.appendChild(el);
56
+ }
57
+ return el;
58
+ }
59
+
60
+ function card(view) {
61
+ const el = document.createElement('div');
62
+ el.className = 'update-check-toast crash-notice launch-block-notice';
63
+ el.setAttribute('role', 'status');
64
+ el.setAttribute('aria-label', view.label);
65
+ el.dataset.noticeId = view.id;
66
+ el.innerHTML = `
67
+ <div class="utc-icon utc-icon--err" aria-hidden="true">!</div>
68
+ <div class="utc-body">
69
+ <div class="utc-title">${esc(view.title)}</div>
70
+ <div class="utc-sub">${esc(view.count)}</div>
71
+ ${view.launches ? `<div class="utc-sub">${esc(view.launches)}</div>` : ''}
72
+ ${view.error ? `<div class="crash-notice-lost-title">${esc(view.errorTitle)}</div><div class="utc-sub launch-block-error">${esc(view.error)}</div>` : ''}
73
+ ${view.did ? `<div class="utc-sub launch-block-did">${esc(view.did)}</div>` : ''}
74
+ <div class="crash-notice-lost-title">${esc(view.fixTitle)}</div>
75
+ <div class="utc-sub">${esc(view.fix)}</div>
76
+ <div class="update-notice-actions">${view.actions.map((item) => `<button class="action-btn action-btn--ghost crash-notice-btn" type="button" data-launch-block-action="${esc(item.id)}">${esc(item.label)}</button>`).join('')}</div>
77
+ </div>`;
78
+ el.querySelector('[data-launch-block-action="dismiss"]')?.addEventListener('click', (event) => {
79
+ event.stopPropagation();
80
+ dismiss(view.id);
81
+ });
82
+ return el;
83
+ }
84
+
85
+ /** Draw exactly the notices that hold now: a card that is still wanted stays as it is (no flicker, focus kept). */
86
+ function draw() {
87
+ const wanted = guestPage() ? [] : _notices.filter((notice) => !_dismissed.has(notice.id));
88
+ const existing = document.getElementById(STACK_ID);
89
+ if (!wanted.length) { existing?.remove(); return; }
90
+ const host = stack();
91
+ const keep = new Set(wanted.map((notice) => notice.id));
92
+ for (const el of [...host.children]) if (!keep.has(el.dataset.noticeId)) el.remove();
93
+ for (const notice of wanted) {
94
+ const view = launchBlockView(notice, { t: translate, locale: getLocale() });
95
+ if (!view) continue;
96
+ const fresh = card(view);
97
+ const old = [...host.children].find((el) => el.dataset.noticeId === notice.id);
98
+ if (old) {
99
+ // Same notice, newer numbers: its text is replaced in place.
100
+ if (old.innerHTML !== fresh.innerHTML) {
101
+ fresh.classList.add('show');
102
+ old.replaceWith(fresh);
103
+ }
104
+ } else {
105
+ host.appendChild(fresh);
106
+ requestAnimationFrame(() => fresh.classList.add('show'));
107
+ }
108
+ }
109
+ }
110
+
111
+ function present(notices) {
112
+ _notices = notices;
113
+ for (const id of [..._dismissed]) if (!notices.some((notice) => notice.id === id)) _dismissed.delete(id);
114
+ whenPageShown(draw);
115
+ }
116
+
117
+ /** Ask the server; an older server (404) or a guest (403) has nothing to say. */
118
+ export function checkLaunchBlocks() {
119
+ if (guestPage()) return Promise.resolve([]);
120
+ if (_asking) return _asking;
121
+ _asking = (async () => {
122
+ try {
123
+ const res = await fetch(NOTICE_URL, { headers: { Accept: 'application/json' }, cache: 'no-store' });
124
+ if (!res.ok) return [];
125
+ const notices = readLaunchBlockNotices(await res.json());
126
+ present(notices);
127
+ return notices;
128
+ } catch {
129
+ return [];
130
+ }
131
+ })().finally(() => { _asking = null; });
132
+ return _asking;
133
+ }
134
+
135
+ async function dismiss(id) {
136
+ _dismissed.add(id);
137
+ draw();
138
+ try {
139
+ const res = await fetch(`${NOTICE_URL}/dismiss`, { method: 'POST', headers: WRITE, body: JSON.stringify({ id }) });
140
+ if (res.ok) present(readLaunchBlockNotices(await res.json()));
141
+ } catch { /* the server is away: this page keeps it dismissed */ }
142
+ }
143
+
144
+ /** Wire the notices once: ask now, and again every time the sync socket connects. */
145
+ export function initLaunchBlockNotice() {
146
+ if (_wired) return;
147
+ _wired = true;
148
+ on('session:info', (info) => {
149
+ _guest = !!info?.isGuest;
150
+ if (_guest) present([]);
151
+ else checkLaunchBlocks();
152
+ });
153
+ on('sync:schedule:launch-blocked', (message) => { if (!guestPage()) present(readLaunchBlockNotices(message)); });
154
+ checkLaunchBlocks();
155
+ }
@@ -431,6 +431,17 @@ export function initNavbar() {
431
431
  initToolUpdates();
432
432
  // ── The notice after an automatic restart (the server crashed and its supervisor started it again) ──
433
433
  initCrashNotice();
434
+ // ── The notice that launches keep failing on a browser profile (one per profile, not one per run). It loads
435
+ // once the page is idle: nothing before the page is shown waits for it (tests/boot-critical-path.test.mjs),
436
+ // and it asks the server as it starts, so a notice raised meanwhile is not missed. The idle wait has a
437
+ // timeout: a page left in a hidden tab may never be idle, and still loads it within a few seconds ──
438
+ const LAUNCH_BLOCK_NOTICE_WITHIN_MS = 3000;
439
+ const whenIdle = typeof window.requestIdleCallback === 'function'
440
+ ? (run) => window.requestIdleCallback(run, { timeout: LAUNCH_BLOCK_NOTICE_WITHIN_MS })
441
+ : (run) => setTimeout(run, 1200);
442
+ whenIdle(() => {
443
+ import('./ui-launch-block-notice.js').then((notice) => notice.initLaunchBlockNotice()).catch(() => {});
444
+ });
434
445
  // ── The banner while the server cannot identify its callers (macOS: the owner's actions are paused, 503) ──
435
446
  initOwnerAuthorityNotice();
436
447
  // ── The banner on a page the server refuses the owner's access (SynaBun's automation browser opened it) ──
@@ -196,6 +196,8 @@ const SYNC_HANDLERS = {
196
196
  'schedule:fired': (msg) => emit('sync:schedule:fired', msg),
197
197
  'schedule:completed': (msg) => emit('sync:schedule:completed', msg),
198
198
  'schedule:failed': (msg) => emit('sync:schedule:failed', msg),
199
+ // Launches keep failing on a browser profile, or no longer do: the one notice per profile (ui-launch-block-notice.js)
200
+ 'schedule:launch-blocked': (msg) => emit('sync:schedule:launch-blocked', msg),
199
201
  'schedule:deferred': (msg) => emit('sync:schedule:deferred', msg),
200
202
  'schedule:deferred-expired':(msg) => emit('sync:schedule:deferred-expired', msg),
201
203
  'schedule:timer-set': (msg) => emit('sync:schedule:timer-set', msg),