synabun 2.4.4 → 2.4.5
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.
- package/CHANGELOG.md +17 -0
- package/README.md +1 -1
- package/docs/browser-extension-bridge.md +5 -4
- package/docs/whatsapp.md +3 -3
- package/mcp-server/dist/services/neural-interface.d.ts +1 -0
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +1 -0
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/tools/agents.d.ts +16 -3
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +74 -11
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/services/neural-interface.ts +2 -1
- package/mcp-server/src/tools/agents.ts +67 -11
- package/neural-interface/i18n/en.json +349 -9
- package/neural-interface/i18n/pt-BR.json +349 -9
- package/neural-interface/lib/agents-studio-api.js +7 -2
- package/neural-interface/lib/antigravity/home.js +43 -8
- package/neural-interface/lib/antigravity/tool-call.js +14 -0
- package/neural-interface/lib/assistant-brains/antigravity.js +4 -2
- package/neural-interface/lib/assistant-persona.js +8 -3
- package/neural-interface/lib/assistant-route-gate.js +11 -2
- package/neural-interface/lib/assistant-runtime.js +16 -5
- package/neural-interface/lib/assistant-spilled-output.js +53 -0
- package/neural-interface/lib/browser-default.js +22 -2
- package/neural-interface/lib/browser-extension-bridge.js +50 -3
- package/neural-interface/lib/browser-extension-pin.json +7 -7
- package/neural-interface/lib/browser-extension-protocol.js +30 -1
- package/neural-interface/lib/browser-extension-setup.js +204 -36
- package/neural-interface/lib/remote-policy.js +24 -7
- package/neural-interface/lib/teams/README.md +22 -1
- package/neural-interface/lib/teams/api.js +79 -6
- package/neural-interface/lib/teams/index.js +2 -0
- package/neural-interface/lib/teams/recovery.js +68 -0
- package/neural-interface/lib/teams/scheduler.js +349 -29
- package/neural-interface/lib/teams/worktrees.js +123 -30
- package/neural-interface/package-lock.json +2 -2
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/extension-setup.html +6 -2
- package/neural-interface/public/shared/agents/studio/ax-api.js +16 -0
- package/neural-interface/public/shared/agents/studio/ax-teams-view.js +318 -13
- package/neural-interface/public/shared/agents/studio/ax-teams.js +141 -9
- package/neural-interface/public/shared/browser-extension-updates.js +3 -1
- package/neural-interface/public/shared/extension-setup/es-page.js +23 -4
- package/neural-interface/public/shared/extension-setup/es-view.js +51 -11
- package/neural-interface/public/shared/extension-update-view.js +1 -1
- package/neural-interface/public/shared/settings/settings-ai-browser.js +23 -3
- package/neural-interface/public/shared/settings/settings-browser-extension.js +575 -197
- package/neural-interface/public/shared/settings/settings-extension-diagrams.js +116 -0
- package/neural-interface/public/shared/settings/settings-extension-guide.js +222 -0
- package/neural-interface/public/shared/settings/settings-ia.js +2 -2
- package/neural-interface/public/shared/settings/settings-shell.js +5 -0
- package/neural-interface/public/shared/styles.css +196 -13
- package/neural-interface/public/shared/ui-settings.js +48 -11
- package/neural-interface/server.js +20 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// #synabun-setup-ticket only while the extension's content script is on this page and the server waits for it, and is
|
|
4
4
|
// taken out again as soon as the setup moves on.
|
|
5
5
|
import { extensionUpdateView } from '../extension-update-view.js';
|
|
6
|
-
import { makeTranslator, pageLocale, revealKey, setupView, wantsTicket } from './es-view.js';
|
|
6
|
+
import { makeTranslator, pageLocale, pageTurns, revealKey, setupView, wantsTicket } from './es-view.js';
|
|
7
7
|
|
|
8
8
|
const $ = id => document.getElementById(id);
|
|
9
9
|
let t = key => key;
|
|
@@ -22,6 +22,17 @@ const extensionSeen = () => document.documentElement.dataset.synabunExtension ||
|
|
|
22
22
|
const pairAnswer = () => document.documentElement.dataset.synabunPair || '';
|
|
23
23
|
function clearTicket() { const node = $('synabun-setup-ticket'); delete node.dataset.token; delete node.dataset.bridgePort; }
|
|
24
24
|
|
|
25
|
+
// ── One pairing page at a time ──
|
|
26
|
+
// The guide's "Copy address & open <Browser>" opens this page with ?focus=1 only to bring the browser forward: the
|
|
27
|
+
// owner pastes the extensions address over it. That page never asks for a token (es-view.js `focus`).
|
|
28
|
+
const FOCUS_ONLY = (() => { try { return new URLSearchParams(globalThis.location?.search || '').get('focus') === '1'; } catch { return false; } })();
|
|
29
|
+
// The pairing page may still be open more than once: only the newest one that sees the extension asks for tokens
|
|
30
|
+
// (es-view.js pageTurns). The others wait with no token on the page, and ask afresh once their turn comes back.
|
|
31
|
+
let peers = null, waitingTurn = false;
|
|
32
|
+
try { if (!FOCUS_ONLY && typeof BroadcastChannel === 'function') { peers = new BroadcastChannel('synabun-extension-setup'); peers.unref?.(); } } catch { peers = null; }
|
|
33
|
+
const turns = pageTurns({ id: `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`, born: Date.now(), channel: peers });
|
|
34
|
+
globalThis.addEventListener?.('pagehide', () => turns.gone());
|
|
35
|
+
|
|
25
36
|
// Text that changed only: the same words set again would be read out again by a screen reader on every poll.
|
|
26
37
|
const put = (node, text) => { if (node.textContent !== text) node.textContent = text; };
|
|
27
38
|
// The words that never change while the page is open.
|
|
@@ -36,11 +47,13 @@ function fixedText() {
|
|
|
36
47
|
put($('es-trouble-title'), tx('needHelp')); put($('es-trouble-help'), tx('helpText')); put($('es-moved-help'), tx('movedText')); put($('es-policy-help'), tx('policyText'));
|
|
37
48
|
}
|
|
38
49
|
function render() {
|
|
39
|
-
const view = setupView(status, { extensionVersion: extensionSeen(), pairAnswer: pairAnswer() });
|
|
50
|
+
const view = setupView(status, { extensionVersion: extensionSeen(), pairAnswer: pairAnswer(), focus: FOCUS_ONLY });
|
|
40
51
|
const update = extensionUpdateView(status.update, t);
|
|
41
52
|
const updating = update && ['idle', 'connected'].includes(view.state);
|
|
42
53
|
const main = $('es-setup');
|
|
43
54
|
main.dataset.state = view.state; main.dataset.layout = view.layout; main.setAttribute('aria-busy', 'false');
|
|
55
|
+
// The Settings guide's companion: the same page, its steps left to Settings (es-view.js `companion`).
|
|
56
|
+
main.dataset.companion = String(view.companion);
|
|
44
57
|
put($('es-title'), updating ? update.title : tx(view.title));
|
|
45
58
|
$('es-lead').hidden = !!updating;
|
|
46
59
|
put($('es-lead'), tx(view.lead, { browser: view.browser }));
|
|
@@ -93,7 +106,12 @@ async function poll() {
|
|
|
93
106
|
// copy the browser still runs would answer the same, so this page only says to confirm in SynaBun Settings (and the
|
|
94
107
|
// server ignores `seen` for it anyway).
|
|
95
108
|
if (status.reloadNeeded && !status.reloadRepaired && (!status.update || status.update.reason === 'port') && extensionSeen() && extensionSeen() === status.folderVersion) status = await call('seen', {});
|
|
96
|
-
if (
|
|
109
|
+
if (extensionSeen()) turns.here();
|
|
110
|
+
const turn = !FOCUS_ONLY && turns.mine();
|
|
111
|
+
// A newer pairing page took over: this one's token comes off the page. Its turn again: a fresh token, at once.
|
|
112
|
+
if (!turn) { waitingTurn = true; clearTicket(); }
|
|
113
|
+
else if (waitingTurn) { waitingTurn = false; offeredAt = 0; }
|
|
114
|
+
if (turn && wantsTicket(status, { extensionVersion: extensionSeen(), pairAnswer: pairAnswer(), offeredAt, tickets })) {
|
|
97
115
|
tickets++;
|
|
98
116
|
const ticket = await call('ticket', {});
|
|
99
117
|
delete document.documentElement.dataset.synabunPair;
|
|
@@ -111,7 +129,8 @@ async function act(action, target) {
|
|
|
111
129
|
else if (action === 'copy-folder') { await navigator.clipboard.writeText(status.folder || '').then(() => { note.textContent = tx('copiedFolder'); }, () => { note.textContent = tx('copyFailed'); }); }
|
|
112
130
|
else if (action === 'reveal') { const r = await call('reveal', {}); note.textContent = tx(r.ok === false ? 'revealFailed' : 'revealed'); }
|
|
113
131
|
else if (action === 'open-in') { status = await call('start', { browser: target.dataset.browser }); offeredAt = 0; tickets = 0; note.textContent = tx('openedIn', { browser: status.browser?.name || '' }); }
|
|
114
|
-
|
|
132
|
+
// Beside the Settings guide this starts the guide's kind of setup again (nothing opened); otherwise the page's own.
|
|
133
|
+
else if (action === 'restart') { status = await call('start', setupView(status).restartBody); offeredAt = 0; tickets = 0; note.textContent = ''; }
|
|
115
134
|
} catch (error) { note.textContent = error.message; }
|
|
116
135
|
render();
|
|
117
136
|
}
|
|
@@ -21,13 +21,16 @@ const RETRY_AFTER = Object.freeze({ ALREADY_PAIRED: 8000, BUSY: 2500, REFUSED: 5
|
|
|
21
21
|
* The page's view of a status (GET /api/browser/extension/setup/status) and what the page saw of the extension:
|
|
22
22
|
* `extensionVersion` (data-synabun-extension, '' when absent) and `pairAnswer` (data-synabun-pair).
|
|
23
23
|
* Returns { state, title, lead, steps, browser, extensionsUrl, folder, alternatives, live, tone, reloadNeeded, reloadRepaired, updateNeeded,
|
|
24
|
-
* progress, restart, restartLabel }.
|
|
24
|
+
* progress, restart, restartLabel, companion, restartBody, focus }. `companion`: the status says `guided` (the steps are in
|
|
25
|
+
* SynaBun Settings); `restartBody`: what "Start again" sends to …/setup/start. `focus`: the page was opened by the
|
|
26
|
+
* guide's "Copy address & open" (?focus=1) only to bring the browser forward for the paste that replaces it: it shows
|
|
27
|
+
* where to paste, never pairs (no token, no "Extension found") and starts nothing.
|
|
25
28
|
* Strings are i18n keys under browserExtension.setup (the page translates them); `params` fill their {placeholders}.
|
|
26
29
|
*/
|
|
27
|
-
export function setupView(status = {}, { extensionVersion = '', pairAnswer = '' } = {}) {
|
|
30
|
+
export function setupView(status = {}, { extensionVersion = '', pairAnswer = '', focus = false } = {}) {
|
|
28
31
|
const server = SETUP_STATES.includes(status.state) ? status.state : 'error';
|
|
29
32
|
const found = !!extensionVersion;
|
|
30
|
-
const state = server === 'waiting-for-extension' && found ? 'extension-found' : server;
|
|
33
|
+
const state = server === 'waiting-for-extension' && found && !focus ? 'extension-found' : server;
|
|
31
34
|
const browser = status.browser || null;
|
|
32
35
|
const name = browser?.name || '';
|
|
33
36
|
const extensionsUrl = browser?.supported ? browser.extensionsUrl || null : null;
|
|
@@ -58,25 +61,33 @@ export function setupView(status = {}, { extensionVersion = '', pairAnswer = ''
|
|
|
58
61
|
const layout = showSteps && state !== 'connected' ? 'guide' : 'result';
|
|
59
62
|
const statusTitle = { downloading: 'downloadingTitle', 'waiting-for-extension': 'waitingTitle', 'extension-found': 'foundTitle', pairing: 'pairingTitle', connected: 'titleConnected',
|
|
60
63
|
unsupported: 'titleUnsupported', idle: 'idleTitle', error: downloadFailed ? 'downloadErrorTitle' : 'errorTitle' }[state];
|
|
64
|
+
// The Settings guide's companion (a setup started with `present: 'none'`, status `guided`): the steps are in SynaBun
|
|
65
|
+
// Settings, so this page is one card with the live status only (no steps, folder or other browsers), and it stays
|
|
66
|
+
// open to pair the extension by itself. "Start again" here starts the guide's kind of setup for the same browser,
|
|
67
|
+
// which opens nothing.
|
|
68
|
+
const companion = status.guided === true || focus;
|
|
69
|
+
const installedIds = (status.installedBrowsers || []).filter(b => b?.supported).map(b => b.id);
|
|
70
|
+
const restartBody = companion ? { present: 'none', ...(browser?.supported && installedIds.includes(browser.id) ? { browser: browser.id } : {}) } : {};
|
|
61
71
|
return {
|
|
62
|
-
|
|
72
|
+
companion, restartBody, focus,
|
|
73
|
+
layout: companion ? 'result' : layout, statusTitle, eyebrow: name ? 'eyebrow' : '',
|
|
63
74
|
help: state === 'connected' ? 'connectedHelp' : state === 'downloading' ? 'downloadingHelp' : '',
|
|
64
75
|
progress,
|
|
65
|
-
state, title: state === 'connected' ? 'titleConnected' : state === 'unsupported' ? 'titleUnsupported' : 'title',
|
|
66
|
-
lead: state === 'unsupported' ? 'leadUnsupported' : 'lead', steps, browser: name, extensionsUrl,
|
|
67
|
-
folder: typeof status.folder === 'string' ? status.folder : '', alternatives, live, liveParams: { browser: name }, tone,
|
|
76
|
+
state, title: focus ? 'focusTitle' : companion ? 'companionTitle' : state === 'connected' ? 'titleConnected' : state === 'unsupported' ? 'titleUnsupported' : 'title',
|
|
77
|
+
lead: focus ? 'focusLead' : companion ? 'companionLead' : state === 'unsupported' ? 'leadUnsupported' : 'lead', steps, browser: name, extensionsUrl,
|
|
78
|
+
folder: !companion && typeof status.folder === 'string' ? status.folder : '', alternatives: companion ? [] : alternatives, live, liveParams: { browser: name }, tone,
|
|
68
79
|
reloadNeeded: status.reloadNeeded === true,
|
|
69
80
|
// SynaBun replaced files that were not its extension: the same Reload, in the words of a repair.
|
|
70
81
|
reloadRepaired: status.reloadNeeded === true && status.reloadRepaired === true,
|
|
71
82
|
// The folder holds an older extension than this release's: SynaBun downloads the new one; a Reload comes after.
|
|
72
83
|
updateNeeded: status.updateNeeded === true && status.reloadNeeded !== true,
|
|
73
|
-
showSteps,
|
|
84
|
+
showSteps: showSteps && !companion,
|
|
74
85
|
// What the page offers: start again (idle, error), back to SynaBun and the pin tip (connected).
|
|
75
|
-
restart: ['error', 'idle'].includes(state), back: state === 'connected', pinTip: state === 'connected',
|
|
86
|
+
restart: !focus && ['error', 'idle'].includes(state), back: state === 'connected', pinTip: state === 'connected',
|
|
76
87
|
// A download that failed is tried again by the same button, under its own words.
|
|
77
88
|
restartLabel: downloadFailed ? 'retryDownload' : 'restart',
|
|
78
|
-
// "Open in X instead" while there is still something to install here; never once pairing began.
|
|
79
|
-
showAlternatives: alternatives.length > 0 && !['pairing', 'connected'].includes(state),
|
|
89
|
+
// "Open in X instead" while there is still something to install here; never once pairing began, never beside the guide.
|
|
90
|
+
showAlternatives: !companion && alternatives.length > 0 && !['pairing', 'connected'].includes(state),
|
|
80
91
|
};
|
|
81
92
|
}
|
|
82
93
|
/** The words for "show the folder" on this computer: Finder, Explorer or the file manager. */
|
|
@@ -96,6 +107,35 @@ export function wantsTicket(status = {}, { extensionVersion = '', pairAnswer = '
|
|
|
96
107
|
return wait !== undefined && now - offeredAt >= wait;
|
|
97
108
|
}
|
|
98
109
|
|
|
110
|
+
/** How long a newer pairing page keeps its turn without being heard from (it speaks at every poll, 1.5 s). */
|
|
111
|
+
export const PEER_SILENT_MS = 5000;
|
|
112
|
+
/**
|
|
113
|
+
* Which of SynaBun's pairing pages asks for tokens (es-page.js). The pairing page may be open more than once (the
|
|
114
|
+
* guide's companion, then Pair in <Browser>): each would ask for its own token, and each token replaces the last, so
|
|
115
|
+
* they would undo each other's pairing and spend the setup's five tokens. The pages that see the extension say so on
|
|
116
|
+
* `channel` (a BroadcastChannel of this origin; null: the page is alone) and only the newest of them asks. `here()`:
|
|
117
|
+
* this page sees the extension (at every poll); `gone()`: it is leaving; `mine()`: no newer page was heard from in the
|
|
118
|
+
* last `silentMs`. A message that is not one of these two shapes is ignored.
|
|
119
|
+
*/
|
|
120
|
+
export function pageTurns({ id, born, channel = null, now = Date.now, silentMs = PEER_SILENT_MS }) {
|
|
121
|
+
const newer = new Map();
|
|
122
|
+
channel?.addEventListener?.('message', ({ data } = {}) => {
|
|
123
|
+
if (!data || typeof data !== 'object' || typeof data.id !== 'string' || data.id === id) return;
|
|
124
|
+
if (data.type === 'gone') newer.delete(data.id);
|
|
125
|
+
else if (data.type === 'here' && Number.isFinite(data.born) && (data.born > born || (data.born === born && data.id > id))) newer.set(data.id, now());
|
|
126
|
+
});
|
|
127
|
+
const say = message => { try { channel?.postMessage?.(message); } catch { /* a closed channel: alone */ } };
|
|
128
|
+
return {
|
|
129
|
+
here: () => say({ type: 'here', id, born }),
|
|
130
|
+
gone: () => say({ type: 'gone', id }),
|
|
131
|
+
mine() {
|
|
132
|
+
const at = now();
|
|
133
|
+
for (const [peer, heard] of newer) if (at - heard > silentMs) newer.delete(peer);
|
|
134
|
+
return newer.size === 0;
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
99
139
|
/**
|
|
100
140
|
* The page's translator: the active locale's strings with English behind them, key by key, `{name}` filled from
|
|
101
141
|
* params. The page loads the two JSON files itself (es-page.js), never the app's i18n module: that one brings the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Shared words and actions for Settings, the setup page, the notification and the Assistant.
|
|
2
|
-
const releaseNotes = { '1.5.0': 'notes.v1_5_0' };
|
|
2
|
+
const releaseNotes = { '1.5.0': 'notes.v1_5_0', '1.6.0': 'notes.v1_6_0' };
|
|
3
3
|
const downloadErrors = {
|
|
4
4
|
EXTENSION_DOWNLOAD_OFFLINE: 'offline', EXTENSION_DOWNLOAD_UNAVAILABLE: 'unavailable',
|
|
5
5
|
EXTENSION_VERIFY_FAILED: 'unverified', EXTENSION_FOLDER_UNSAFE: 'unsafe',
|
|
@@ -17,6 +17,24 @@ export const LOCAL_CONNECT_OPTIONS = Object.freeze(['attach', 'extension']);
|
|
|
17
17
|
/** Deprecated in the menu. Still supported for saved configs and as the server's local default. */
|
|
18
18
|
export const LOCAL_DEFAULT_MODE = 'mirror';
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* The Browser tab's Connection mode menu, in reading order: my browser through the extension, the local browser, and
|
|
22
|
+
* a MoreLogin / SynaBun profile. The last one is a view only: it shows where a profile is chosen (Connected tools) and
|
|
23
|
+
* is never saved from here (browserSaveFields keeps the local mode the server holds).
|
|
24
|
+
*/
|
|
25
|
+
export const CONNECT_MENU_OPTIONS = Object.freeze(['extension', 'attach', 'morelogin']);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Which parts of the Browser tab a Connection mode shows. A profile that is the AI browser wins over the form: the menu
|
|
29
|
+
* then shows the profile choice, disabled, with the banner that names it.
|
|
30
|
+
* @returns {{ mode: string, extension: boolean, local: boolean, profile: boolean, active: boolean }}
|
|
31
|
+
*/
|
|
32
|
+
export function connectionParts(formMode, current) {
|
|
33
|
+
const active = !!(current && typeof current === 'object' && current.moreLogin === true);
|
|
34
|
+
const mode = active ? 'morelogin' : (CONNECT_MENU_OPTIONS.includes(formMode) || formMode === LOCAL_DEFAULT_MODE ? formMode : LOCAL_DEFAULT_MODE);
|
|
35
|
+
return { mode, extension: mode === 'extension', local: mode === 'attach' || mode === LOCAL_DEFAULT_MODE, profile: mode === 'morelogin' && !active, active };
|
|
36
|
+
}
|
|
37
|
+
|
|
20
38
|
const idOf = (value) => (value === undefined || value === null || value === '' ? null : String(value));
|
|
21
39
|
|
|
22
40
|
/**
|
|
@@ -47,14 +65,16 @@ export function localConnectModeOf(cfg) {
|
|
|
47
65
|
* The connection fields of a Browser tab save. `formMode`: its Connection dropdown. `current`: the AI browser as the
|
|
48
66
|
* server holds it now (aiBrowserOf of a fresh read; the last one known when that read failed). A MoreLogin AI browser
|
|
49
67
|
* stays exactly as it is, profile included; otherwise the local mode is the form's and the remembered profile id is
|
|
50
|
-
* kept (never cleared from here).
|
|
68
|
+
* kept (never cleared from here). `savedLocal`: the local mode the last read held, kept when the form only shows the
|
|
69
|
+
* profile choice (that choice is never saved from the Browser tab: a profile is turned on in Connected tools).
|
|
51
70
|
* @returns {{ connectMode: string, moreloginEnvId: string|null }}
|
|
52
71
|
*/
|
|
53
|
-
export function browserSaveFields(formMode, current) {
|
|
72
|
+
export function browserSaveFields(formMode, current, savedLocal = LOCAL_DEFAULT_MODE) {
|
|
54
73
|
const now = current && typeof current === 'object' ? current : {};
|
|
55
74
|
const envId = idOf(now.envId);
|
|
56
75
|
if (now.moreLogin === true) return { connectMode: 'morelogin', moreloginEnvId: envId };
|
|
57
|
-
|
|
76
|
+
const kept = LOCAL_CONNECT_OPTIONS.includes(savedLocal) ? savedLocal : LOCAL_DEFAULT_MODE;
|
|
77
|
+
return { connectMode: LOCAL_CONNECT_OPTIONS.includes(formMode) ? formMode : formMode === 'morelogin' ? kept : LOCAL_DEFAULT_MODE, moreloginEnvId: envId };
|
|
58
78
|
}
|
|
59
79
|
|
|
60
80
|
/**
|