synabun 2.4.2 → 2.4.3
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 +20 -0
- package/README.md +1 -1
- package/docs/browser-extension-bridge.md +23 -3
- package/lib/release-npm-ci.mjs +23 -1
- package/mcp-server/dist/services/neural-interface.js +1 -1
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/tools/browser-extension-setup.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-extension-setup.js +8 -2
- package/mcp-server/dist/tools/browser-extension-setup.js.map +1 -1
- package/mcp-server/package-lock.json +5 -5
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/services/neural-interface.ts +1 -1
- package/mcp-server/src/tools/browser-extension-setup.ts +8 -2
- package/neural-interface/i18n/en.json +50 -1
- package/neural-interface/i18n/pt-BR.json +57 -8
- package/neural-interface/lib/assistant-api.js +33 -0
- package/neural-interface/lib/assistant-brains/opencode.js +121 -7
- package/neural-interface/lib/assistant-dispatch.js +26 -2
- package/neural-interface/lib/assistant-envelope.js +40 -0
- package/neural-interface/lib/assistant-runtime.js +95 -10
- package/neural-interface/lib/browser-extension-adapter.js +1 -3
- package/neural-interface/lib/browser-extension-archive.js +149 -0
- package/neural-interface/lib/browser-extension-bridge.js +7 -4
- package/neural-interface/lib/browser-extension-folder.js +596 -76
- package/neural-interface/lib/browser-extension-package.js +200 -0
- package/neural-interface/lib/browser-extension-pin.js +84 -0
- package/neural-interface/lib/browser-extension-pin.json +33 -0
- package/neural-interface/lib/browser-extension-setup.js +105 -18
- package/neural-interface/lib/cli-install.js +23 -3
- package/neural-interface/lib/cli-update-planner.js +67 -4
- package/neural-interface/lib/native-loop-providers.js +10 -1
- package/neural-interface/lib/native-loop-runtime.js +20 -2
- package/neural-interface/lib/opencode-shell-read.js +107 -0
- package/neural-interface/lib/opencode-stop-failures.js +40 -0
- package/neural-interface/lib/opencode-turn-release.js +173 -0
- package/neural-interface/lib/opencode-v2-client.js +4 -1
- package/neural-interface/lib/opencode-v2-ws-requests.js +34 -0
- package/neural-interface/lib/opencode2-client.js +341 -6
- package/neural-interface/lib/opencode2-translate.js +161 -4
- package/neural-interface/lib/terminal-token-redaction.js +83 -0
- package/neural-interface/lib/whatsapp/bridge.js +52 -6
- package/neural-interface/package-lock.json +5 -5
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/extension-setup.html +5 -2
- package/neural-interface/public/shared/agy/agy-panel.js +38 -10
- package/neural-interface/public/shared/assistant/asst-api.js +25 -0
- package/neural-interface/public/shared/assistant/asst-panel.js +69 -1
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +23 -0
- package/neural-interface/public/shared/assistant/asst-render.js +138 -6
- package/neural-interface/public/shared/assistant/asst-shell-logic.js +200 -0
- package/neural-interface/public/shared/assistant/asst-shell.js +111 -0
- package/neural-interface/public/shared/assistant/asst-styles.js +1 -0
- package/neural-interface/public/shared/cdx/cdx-tabs.js +25 -0
- package/neural-interface/public/shared/extension-setup/es-page.js +10 -4
- package/neural-interface/public/shared/extension-setup/es-view.js +25 -10
- package/neural-interface/public/shared/mtc/mtc-panel.js +17 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +5 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +1 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +34 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-rehydrate.js +7 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +26 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send.js +39 -6
- package/neural-interface/public/shared/ocp-v2/ocp-v2-session-actions.js +20 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-shell-block.js +165 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-shell-logic.js +346 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-shell.js +108 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-state.js +49 -3
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +40 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-tools-logic.js +20 -5
- package/neural-interface/public/shared/ocp-v2/ocp-v2-tools.js +7 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +7 -2
- package/neural-interface/public/shared/settings/settings-browser-extension.js +54 -12
- package/neural-interface/public/shared/shell-stop-view.js +83 -0
- package/neural-interface/public/shared/tour/tour-actor.js +14 -3
- package/neural-interface/public/shared/tray-auto-close.js +36 -6
- package/neural-interface/public/shared/ui-claude-panel.js +20 -0
- package/neural-interface/public/shared/ui-native-loop-router.js +45 -3
- package/neural-interface/public/shared/ui-scroll-follow.js +4 -0
- package/neural-interface/server.js +249 -35
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -2
- package/browser-extension/content.js +0 -231
- package/browser-extension/engine.js +0 -658
- package/browser-extension/icons/icon-128.png +0 -0
- package/browser-extension/icons/icon-16.png +0 -0
- package/browser-extension/icons/icon-32.png +0 -0
- package/browser-extension/icons/icon-48.png +0 -0
- package/browser-extension/icons/status-off-16.png +0 -0
- package/browser-extension/icons/status-off-32.png +0 -0
- package/browser-extension/icons/status-off-48.png +0 -0
- package/browser-extension/icons/status-on-16.png +0 -0
- package/browser-extension/icons/status-on-32.png +0 -0
- package/browser-extension/icons/status-on-48.png +0 -0
- package/browser-extension/manifest.json +0 -58
- package/browser-extension/popup-strings.js +0 -250
- package/browser-extension/popup-view.js +0 -151
- package/browser-extension/popup.css +0 -166
- package/browser-extension/popup.html +0 -108
- package/browser-extension/popup.js +0 -359
- package/browser-extension/service-worker.js +0 -283
- package/browser-extension/setup-content.js +0 -36
- package/browser-extension/tokens.css +0 -326
- /package/{browser-extension/protocol.js → neural-interface/lib/browser-extension-protocol.js} +0 -0
|
@@ -167,7 +167,9 @@ import {
|
|
|
167
167
|
buildInstallCommand,
|
|
168
168
|
buildUpdateCommand,
|
|
169
169
|
isBrewSource,
|
|
170
|
+
OPENCODE_WINGET_SEARCH_ARGS,
|
|
170
171
|
parseBrewOutdated,
|
|
172
|
+
parseWingetSearchVersion,
|
|
171
173
|
quoteCommandPath,
|
|
172
174
|
resolveBrewToken,
|
|
173
175
|
resolveLatest,
|
|
@@ -213,6 +215,7 @@ import * as opencodeV2Client from './lib/opencode-v2-client.js';
|
|
|
213
215
|
import { OPENCODE_MIN_VERSION, basicAuthHeader, checkPrivateOpencodeServer as checkOpencodeServer, createServeLogRedactor, opencodeInstallCommands, opencodeProblemText, opencodeSupportFor, redactServeOutput, servePasswordReader, serveSpecFor, serveUnsetCommand, withServeEnv } from './lib/opencode-protocol.js';
|
|
214
216
|
import { SERVE_TOKEN_ENV } from './lib/process-identity.js';
|
|
215
217
|
import { commandArgs, createServeRecords } from './lib/opencode-serve-records.js';
|
|
218
|
+
import { activeOpencodeSessions, binaryFileKey as opencodeBinaryFileKey, createServeEnds, staleServePlan } from './lib/opencode-turn-release.js';
|
|
216
219
|
import { opencode2Proxy } from './lib/opencode2-proxy.js';
|
|
217
220
|
import { macScreenshotDir } from './lib/screenshot-location.js';
|
|
218
221
|
import { integrationCredentialIds, integrationsWithCredentials } from './lib/opencode2-translate.js';
|
|
@@ -228,6 +231,7 @@ import {
|
|
|
228
231
|
handleOpencodeV2Request, opencodeV2WsCapabilities,
|
|
229
232
|
buildSessionListQuery, mapSessionListRow, OPENCODE_V2_WS_MUTATION_TYPES, guardOpencodeV2Request, folderIsGone,
|
|
230
233
|
} from './lib/opencode-v2-ws-requests.js';
|
|
234
|
+
import { createStopFailures } from './lib/opencode-stop-failures.js';
|
|
231
235
|
import { NativeLoopRuntime, isNativeLoopProfile } from './lib/native-loop-runtime.js';
|
|
232
236
|
import { scheduleScratchRetention } from './lib/scratch-retention.js';
|
|
233
237
|
import { migrateAutomationContextFiles, normalizeAutomationRecord } from './lib/automation-storage-migration.js';
|
|
@@ -697,11 +701,12 @@ import { createOpencodeCompletionEngine } from './lib/editor-completion-opencode
|
|
|
697
701
|
import { createEndpointCompletionEngine } from './lib/editor-completion-endpoint.js';
|
|
698
702
|
import { ownerRouteGuard } from './lib/http-guards.js';
|
|
699
703
|
import { createBridgeStore, createExtensionBridge } from './lib/browser-extension-bridge.js';
|
|
700
|
-
import { createExtensionAdapter
|
|
704
|
+
import { createExtensionAdapter } from './lib/browser-extension-adapter.js';
|
|
701
705
|
import { detectBrowsers } from './lib/browser-default.js';
|
|
702
|
-
import { extensionFolderState
|
|
703
|
-
import {
|
|
704
|
-
import {
|
|
706
|
+
import { extensionFolderState } from './lib/browser-extension-folder.js';
|
|
707
|
+
import { createExtensionPackage } from './lib/browser-extension-package.js';
|
|
708
|
+
import { createExtensionSetup, extensionVersions, setupError as extensionSetupError } from './lib/browser-extension-setup.js';
|
|
709
|
+
import { safeError as extensionSafeError } from './lib/browser-extension-protocol.js';
|
|
705
710
|
import { setUntrustedFileHeaders } from './lib/untrusted-file-headers.js';
|
|
706
711
|
import { BUNDLED_LOGO_FILES, UPLOADED_IMAGE_PATH } from './lib/request-gate.js';
|
|
707
712
|
import { createCloudflaredManager } from './lib/cloudflared/manager.js';
|
|
@@ -2583,6 +2588,10 @@ async function runGracefulShutdown(reason) {
|
|
|
2583
2588
|
|
|
2584
2589
|
// 1. opencode sidecar — has its own teardown that handles managed PID + ollama.
|
|
2585
2590
|
try { stopOpencodeServer(); } catch (err) { console.warn(' opencode stop err:', err?.message); }
|
|
2591
|
+
// The serves stopped above interrupt the turns still running on them before their processes end
|
|
2592
|
+
// (lib/opencode-turn-release.js). Waited for here, bounded, so that the exit does not cut that short and leave a
|
|
2593
|
+
// session claimed for OpenCode's own background service to resume.
|
|
2594
|
+
try { await _ocpServeEnds.settled(); } catch (err) { console.warn(' opencode serve end err:', err?.message); }
|
|
2586
2595
|
|
|
2587
2596
|
// 2. Agents in agentRegistry — use platform-native tree kill so descendants die too.
|
|
2588
2597
|
try {
|
|
@@ -8423,6 +8432,16 @@ const opencodeServeRecords = createServeRecords({
|
|
|
8423
8432
|
migrateOpencodeManagedPid();
|
|
8424
8433
|
let _ocpBootReconcileTried = false;
|
|
8425
8434
|
let _ocpLastBootAt = 0; // Date.now() when serve process last became ready
|
|
8435
|
+
// The file SynaBun's shared serve was started from (lib/opencode-turn-release.js binaryFileKey), while SynaBun's own
|
|
8436
|
+
// child runs it: an OpenCode update replaces the file on disk and leaves this serve on the old program.
|
|
8437
|
+
let _ocpServeFileKey = null;
|
|
8438
|
+
// The end of the shared serve while its turns are still being released: a new start waits for it, so that it never
|
|
8439
|
+
// finds the serve that is being stopped still answering on the port.
|
|
8440
|
+
let _ocpSharedEnd = null;
|
|
8441
|
+
// How SynaBun ends its serves (lib/opencode-turn-release.js): the turns still running on a serve are interrupted
|
|
8442
|
+
// before its process is stopped. A turn left in flight stays claimed in OpenCode's database, and OpenCode's own
|
|
8443
|
+
// background service (a plain `opencode` in a terminal starts it) resumes every such session at its boot.
|
|
8444
|
+
const _ocpServeEnds = createServeEnds({ log: (line) => console.log(`[opencode] ${line}`) });
|
|
8426
8445
|
|
|
8427
8446
|
// ── Verbose trace logging (opt-in: OCP_VERBOSE=1 to enable) ──
|
|
8428
8447
|
const OCP_VERBOSE = process.env.OCP_VERBOSE === '1';
|
|
@@ -9074,6 +9093,8 @@ async function ensureIsolatedServe(termId, { xdgRoot: requestedXdgRoot = null, c
|
|
|
9074
9093
|
});
|
|
9075
9094
|
entry.proc = proc;
|
|
9076
9095
|
entry.password = launch.password || null;
|
|
9096
|
+
// The file this serve runs: an update of OpenCode makes it a serve of the old program (retireStaleOpencodeServes).
|
|
9097
|
+
entry.fileKey = opencodeBinaryFileKey(launch.nativeServe?.identity);
|
|
9077
9098
|
// On record from its spawn: a crash of SynaBun from here on does not leave it running for good.
|
|
9078
9099
|
const tracked = trackOpencodeServe(proc, { kind: 'isolated', id: termId, port, token, nativeWebSocketSafe: launch.nativeWebSocketSafe, nativeServe: launch.nativeServe });
|
|
9079
9100
|
// While it boots, its start sees an exit itself (another server on the port is a collision); afterwards
|
|
@@ -9191,7 +9212,10 @@ async function ensureIsolatedServe(termId, { xdgRoot: requestedXdgRoot = null, c
|
|
|
9191
9212
|
}
|
|
9192
9213
|
}
|
|
9193
9214
|
|
|
9194
|
-
|
|
9215
|
+
// `immediate`: the process's exit handler, where nothing can be awaited: the serve's process is ended at once.
|
|
9216
|
+
// Otherwise the turns still running on the serve are interrupted first (lib/opencode-turn-release.js, a bounded
|
|
9217
|
+
// wait), so that none of its sessions stays claimed in OpenCode's database; everything else here is done at once.
|
|
9218
|
+
function stopIsolatedServe(termId, { preserveBindings = false, immediate = false } = {}) {
|
|
9195
9219
|
const entry = _ocpIsoServes.get(termId);
|
|
9196
9220
|
if (entry?.xdgRoot) _externalMcpLogValues.delete(entry.xdgRoot);
|
|
9197
9221
|
if (!entry) return;
|
|
@@ -9208,12 +9232,20 @@ function stopIsolatedServe(termId, { preserveBindings = false } = {}) {
|
|
|
9208
9232
|
}
|
|
9209
9233
|
try { entry.unsub?.(); } catch {}
|
|
9210
9234
|
try { entry.client?.stop(); } catch {}
|
|
9211
|
-
|
|
9235
|
+
const proc = entry.proc;
|
|
9236
|
+
_ocpServeEnds.end({
|
|
9237
|
+
port: entry.ready ? entry.port : null,
|
|
9238
|
+
password: entry.password || null,
|
|
9239
|
+
alive: () => !!proc && proc.exitCode == null && proc.signalCode == null,
|
|
9240
|
+
kill: () => killIsolatedServeProcess(proc),
|
|
9241
|
+
label: `serve ${String(termId).slice(-8)}`,
|
|
9242
|
+
immediate,
|
|
9243
|
+
});
|
|
9212
9244
|
try { if (!entry.persistentData && entry.xdgRoot && existsSync(entry.xdgRoot)) rmSync(entry.xdgRoot, { recursive: true, force: true }); } catch {}
|
|
9213
9245
|
}
|
|
9214
9246
|
|
|
9215
|
-
function stopAllIsolatedServes() {
|
|
9216
|
-
for (const termId of [..._ocpIsoServes.keys()]) stopIsolatedServe(termId);
|
|
9247
|
+
function stopAllIsolatedServes({ immediate = false } = {}) {
|
|
9248
|
+
for (const termId of [..._ocpIsoServes.keys()]) stopIsolatedServe(termId, { immediate });
|
|
9217
9249
|
}
|
|
9218
9250
|
|
|
9219
9251
|
// Resolve the client to run a TURN for a session. Every sidepanel session gets
|
|
@@ -9393,7 +9425,62 @@ setInterval(() => {
|
|
|
9393
9425
|
}
|
|
9394
9426
|
}, 60 * 1000).unref?.();
|
|
9395
9427
|
|
|
9396
|
-
|
|
9428
|
+
// Whether an isolated serve is in use right now (the reaper's own rule): a live run or brain keeps it, a turn runs
|
|
9429
|
+
// on it, or it is still starting.
|
|
9430
|
+
function isolatedServeBusy(termId, entry) {
|
|
9431
|
+
if (entry.keepAlive && (_nativeLoopRuntime?.isAlive(termId) || _assistantRuntime?.ownsIsolatedServe?.(termId))) return true;
|
|
9432
|
+
if (entry.starting || !entry.ready) return true;
|
|
9433
|
+
if ([..._ocpSessionServeStarts.values()].some((pending) => pending.termId === termId)) return true;
|
|
9434
|
+
return [...entry.sessions].some((sessionId) => _ocpActiveSessionTurns.has(sessionId));
|
|
9435
|
+
}
|
|
9436
|
+
|
|
9437
|
+
// The file of the OpenCode SynaBun would start now, as a key. null (nothing is decided) when Settings names a
|
|
9438
|
+
// command line (which runs whatever it names), while the file has not answered `--version` yet (an update still
|
|
9439
|
+
// being written; the resolver asks in the background and the next look knows), and for an OpenCode SynaBun does not
|
|
9440
|
+
// drive: a serve that works is never stopped for one that would be refused.
|
|
9441
|
+
function currentOpencodeFileKey() {
|
|
9442
|
+
if (configuredCommandLine('opencode')) return null;
|
|
9443
|
+
const found = cliResolver.launcher('opencode');
|
|
9444
|
+
if (found.state !== 'installed' || !opencodeSupportFor(found.version, { path: found.path }).supported) return null;
|
|
9445
|
+
return opencodeBinaryFileKey(opencodeBinaryIdentity(found.launchPath || found.path || null));
|
|
9446
|
+
}
|
|
9447
|
+
|
|
9448
|
+
// OpenCode was updated while SynaBun runs (its badge, `opencode upgrade` in a terminal, OpenCode's own updater):
|
|
9449
|
+
// the file on disk is the new program, and the serves SynaBun started before still run the old one. The shared
|
|
9450
|
+
// serve is restarted once it runs no turn, and a session's serve that is not in use is stopped (the session's next
|
|
9451
|
+
// message starts one, as after the idle reaper). A serve in use is left for the next look. Looked at after every
|
|
9452
|
+
// check of the CLI versions and once a minute while a serve of SynaBun's runs.
|
|
9453
|
+
let _ocpRetireInFlight = null;
|
|
9454
|
+
function retireStaleOpencodeServes(reason = 'watch') {
|
|
9455
|
+
if (_ocpRetireInFlight) return _ocpRetireInFlight;
|
|
9456
|
+
_ocpRetireInFlight = (async () => {
|
|
9457
|
+
if (_ocpHistoryClearInProgress || (!_ocpProc && _ocpIsoServes.size === 0)) return null;
|
|
9458
|
+
let current = null;
|
|
9459
|
+
try { current = currentOpencodeFileKey(); } catch { current = null; }
|
|
9460
|
+
const plan = staleServePlan({
|
|
9461
|
+
current,
|
|
9462
|
+
shared: { key: _ocpServeFileKey, managed: !!_ocpProc, ready: _ocpReady, starting: _ocpStarting },
|
|
9463
|
+
isolated: [..._ocpIsoServes].map(([termId, entry]) => ({ termId, key: entry.fileKey || null, busy: isolatedServeBusy(termId, entry) })),
|
|
9464
|
+
});
|
|
9465
|
+
for (const termId of plan.isolated) {
|
|
9466
|
+
console.log(`[ocp-iso] OpenCode on disk changed: stopping serve ${String(termId).slice(-8)}, which runs the earlier program (${reason}); its session's next message starts a new one`);
|
|
9467
|
+
stopIsolatedServe(termId);
|
|
9468
|
+
}
|
|
9469
|
+
if (plan.shared === 'restart') {
|
|
9470
|
+
const turns = await activeOpencodeSessions({ port: _ocpPort, password: _ocpPassword });
|
|
9471
|
+
// Asked again after the wait: a stop or a restart meanwhile has already replaced it.
|
|
9472
|
+
if (turns.ok && !turns.ids.length && _ocpProc && _ocpReady && !_ocpStarting && _ocpServeFileKey && _ocpServeFileKey !== current) {
|
|
9473
|
+
console.log(`[opencode] OpenCode on disk changed: restarting SynaBun's shared serve, which runs the earlier program (v${_ocpVersion || '?'}; ${reason})`);
|
|
9474
|
+
try { await takeoverOpencodeServer(); } catch (error) { console.warn(`[opencode] shared serve restart after an OpenCode update failed: ${error?.message || error}`); }
|
|
9475
|
+
}
|
|
9476
|
+
}
|
|
9477
|
+
return plan;
|
|
9478
|
+
})().catch(() => null).finally(() => { _ocpRetireInFlight = null; });
|
|
9479
|
+
return _ocpRetireInFlight;
|
|
9480
|
+
}
|
|
9481
|
+
setInterval(() => { retireStaleOpencodeServes('watch'); }, 60 * 1000).unref?.();
|
|
9482
|
+
|
|
9483
|
+
process.once('exit', () => { stopAllIsolatedServes({ immediate: true }); _ocpServeEnds.killNow(); });
|
|
9397
9484
|
|
|
9398
9485
|
// ── Antigravity side panel (/ws/antigravity) ──
|
|
9399
9486
|
// One `agy acp` (Google's Antigravity ACP server) per panel socket, one ACP session per tab
|
|
@@ -9468,6 +9555,10 @@ function handleOpencodeV2Ws(ws) {
|
|
|
9468
9555
|
|
|
9469
9556
|
// Track in-flight prompts so a fresh send can abort the previous turn cleanly.
|
|
9470
9557
|
const sendAborts = new Map(); // sessionID → AbortController
|
|
9558
|
+
// Stops that could not end a command of the turn (lib/opencode-stop-failures.js): from the second one on the panel
|
|
9559
|
+
// offers "Stop anyway" (message:abort with `force`). A new turn starts the count again; an entry goes with its
|
|
9560
|
+
// turn, its session and this socket.
|
|
9561
|
+
const stopFailures = createStopFailures({ activeTurn: (sid) => _ocpActiveSessionTurns.get(sid) });
|
|
9471
9562
|
|
|
9472
9563
|
const send = (data) => {
|
|
9473
9564
|
if (ws.readyState === 1) {
|
|
@@ -9507,6 +9598,7 @@ function handleOpencodeV2Ws(ws) {
|
|
|
9507
9598
|
end() {
|
|
9508
9599
|
if (_ocpActiveSessionTurns.get(sid) === token) _ocpActiveSessionTurns.delete(sid);
|
|
9509
9600
|
if (sendAborts.get(sid) === ctrl) sendAborts.delete(sid);
|
|
9601
|
+
stopFailures.prune();
|
|
9510
9602
|
},
|
|
9511
9603
|
};
|
|
9512
9604
|
},
|
|
@@ -9632,6 +9724,7 @@ function handleOpencodeV2Ws(ws) {
|
|
|
9632
9724
|
_ocpSessionToServe.delete(msg.sessionId);
|
|
9633
9725
|
_ocpSessionTools.delete(msg.sessionId);
|
|
9634
9726
|
_ocpActiveSessionTurns.delete(msg.sessionId);
|
|
9727
|
+
stopFailures.clear(msg.sessionId);
|
|
9635
9728
|
if (entry && entry.sessions.size === 0) stopIsolatedServe(termId);
|
|
9636
9729
|
send({ type: 'session:delete:result', id, status: r.status, data: r.data });
|
|
9637
9730
|
break;
|
|
@@ -9734,19 +9827,43 @@ function handleOpencodeV2Ws(ws) {
|
|
|
9734
9827
|
_ocpActiveSessionTurns.delete(sid);
|
|
9735
9828
|
}
|
|
9736
9829
|
if (sendAborts.get(sid) === ctrl) sendAborts.delete(sid);
|
|
9830
|
+
// A turn that ended (or was replaced by this one) takes its failed Stops along.
|
|
9831
|
+
stopFailures.prune();
|
|
9737
9832
|
}
|
|
9738
9833
|
break;
|
|
9739
9834
|
}
|
|
9740
9835
|
case 'message:abort': {
|
|
9741
9836
|
const sid = msg.sessionId;
|
|
9742
|
-
|
|
9743
|
-
|
|
9837
|
+
// `force`: "Stop anyway", offered after a second failed Stop. The turn ends even while a command OpenCode
|
|
9838
|
+
// could not end may still run (its removal goes on in the background, lib/opencode2-client.js).
|
|
9839
|
+
const force = msg.force === true;
|
|
9840
|
+
const bound = boundIsoClient(sid);
|
|
9841
|
+
const endSend = () => {
|
|
9842
|
+
const ctrl = sendAborts.get(sid);
|
|
9843
|
+
if (ctrl) { try { ctrl.abort(); } catch {} sendAborts.delete(sid); }
|
|
9844
|
+
};
|
|
9845
|
+
// A Stop with a command to end can fail, and then the turn goes on: the prompt's wait (`sendAborts`) is
|
|
9846
|
+
// ended only once the stop worked. With none, as always: the wait ends first.
|
|
9847
|
+
const mayFail = !force && bound?.getClient?.()?.stopNeedsKill?.(sid) === true;
|
|
9848
|
+
if (!mayFail) endSend();
|
|
9744
9849
|
try {
|
|
9745
|
-
await
|
|
9850
|
+
const r = await bound.session.abort({ sessionID: sid, ...(force ? { force: true } : {}) });
|
|
9851
|
+
endSend();
|
|
9746
9852
|
_ocpActiveSessionTurns.delete(sid);
|
|
9747
|
-
|
|
9853
|
+
stopFailures.clear(sid);
|
|
9854
|
+
const abandoned = Array.isArray(r?.data?.abandoned) ? r.data.abandoned : [];
|
|
9855
|
+
send({ type: 'message:abort:result', id, ok: true, ...(abandoned.length ? { abandoned } : {}) });
|
|
9748
9856
|
} catch (err) {
|
|
9749
|
-
|
|
9857
|
+
if (err?.cause?.name === 'ShellStopFailed') {
|
|
9858
|
+
// A command Stop could not end still runs (lib/opencode2-client.js abortSession): the turn goes on,
|
|
9859
|
+
// and the panel says so instead of showing it stopped; from the second failure it offers Stop anyway.
|
|
9860
|
+
const count = stopFailures.fail(sid);
|
|
9861
|
+
const shells = Array.isArray(err?.data?.shells) ? err.data.shells : [];
|
|
9862
|
+
send({ type: 'message:abort:result', id, ok: false, error: err?.message, code: 'SHELL_STOP_FAILED', shells, failures: count, canForce: count >= 2 });
|
|
9863
|
+
} else {
|
|
9864
|
+
endSend();
|
|
9865
|
+
send({ type: 'message:abort:result', id, ok: false, error: err?.message });
|
|
9866
|
+
}
|
|
9750
9867
|
}
|
|
9751
9868
|
break;
|
|
9752
9869
|
}
|
|
@@ -9790,6 +9907,7 @@ function handleOpencodeV2Ws(ws) {
|
|
|
9790
9907
|
_ocpV2WsClients.delete(ws);
|
|
9791
9908
|
for (const ctrl of sendAborts.values()) { try { ctrl.abort(); } catch {} }
|
|
9792
9909
|
sendAborts.clear();
|
|
9910
|
+
stopFailures.clearAll();
|
|
9793
9911
|
console.log(`[ocp-v2-ws] close conn=${connId} total=${_ocpV2WsClients.size}`);
|
|
9794
9912
|
});
|
|
9795
9913
|
|
|
@@ -9923,6 +10041,7 @@ async function ensureOpencodeServer({ allowDuringHistoryClear = false } = {}) {
|
|
|
9923
10041
|
return false;
|
|
9924
10042
|
}
|
|
9925
10043
|
_ocpStarting = true;
|
|
10044
|
+
if (_ocpSharedEnd) await _ocpSharedEnd;
|
|
9926
10045
|
|
|
9927
10046
|
// 0. Which OpenCode is installed. One SynaBun does not drive (OpenCode 1, an OpenCode 2 older than the
|
|
9928
10047
|
// minimum) is refused here, with a sentence the panel and Settings show, instead of failing call by call later.
|
|
@@ -9986,6 +10105,7 @@ async function ensureOpencodeServer({ allowDuringHistoryClear = false } = {}) {
|
|
|
9986
10105
|
shell: false,
|
|
9987
10106
|
});
|
|
9988
10107
|
_ocpProc = proc;
|
|
10108
|
+
_ocpServeFileKey = opencodeBinaryFileKey(launch.nativeServe?.identity);
|
|
9989
10109
|
// On record from its spawn: a crash of SynaBun from here on does not leave it running for good.
|
|
9990
10110
|
tracked = trackOpencodeServe(proc, { kind: 'shared', id: 'shared', port: _ocpPort, token, nativeWebSocketSafe: launch.nativeWebSocketSafe, nativeServe: launch.nativeServe });
|
|
9991
10111
|
const readPassword = servePasswordReader();
|
|
@@ -10006,6 +10126,7 @@ async function ensureOpencodeServer({ allowDuringHistoryClear = false } = {}) {
|
|
|
10006
10126
|
// its process either way: trackOpencodeServe.)
|
|
10007
10127
|
if (_ocpProc !== proc) return;
|
|
10008
10128
|
_ocpProc = null;
|
|
10129
|
+
_ocpServeFileKey = null;
|
|
10009
10130
|
_ocpReady = false;
|
|
10010
10131
|
opencodeV2Client.disconnect().catch(() => {});
|
|
10011
10132
|
broadcastToOpencodeV2Clients({ type: 'server:status', status: 'offline', port: _ocpPort });
|
|
@@ -10068,10 +10189,14 @@ async function ensureOpencodeServer({ allowDuringHistoryClear = false } = {}) {
|
|
|
10068
10189
|
return false;
|
|
10069
10190
|
}
|
|
10070
10191
|
|
|
10071
|
-
|
|
10192
|
+
// Returns a promise of the end of SynaBun's own child when its turns are released first (a bounded wait,
|
|
10193
|
+
// lib/opencode-turn-release.js), else null: its process was ended at once. `immediate`: the process's exit handler,
|
|
10194
|
+
// where nothing can be awaited.
|
|
10195
|
+
function stopOpencodeServer({ stopManagedOllama = true, immediate = false } = {}) {
|
|
10072
10196
|
opencodeV2Client.disconnect().catch(() => {});
|
|
10073
10197
|
const procPid = _ocpProc?.pid || null;
|
|
10074
10198
|
const isWin = process.platform === 'win32';
|
|
10199
|
+
let ended = null;
|
|
10075
10200
|
|
|
10076
10201
|
// On Windows `process.kill(pid, 'SIGTERM')` is unreliable for non-Node
|
|
10077
10202
|
// children (cmd.exe shells, opencode native binaries). Use taskkill /T /F
|
|
@@ -10088,12 +10213,26 @@ function stopOpencodeServer({ stopManagedOllama = true } = {}) {
|
|
|
10088
10213
|
};
|
|
10089
10214
|
|
|
10090
10215
|
if (_ocpProc && !_ocpProc.killed) {
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10216
|
+
const proc = _ocpProc;
|
|
10217
|
+
ended = _ocpServeEnds.end({
|
|
10218
|
+
// Only a serve that answered can be asked for its turns; one that never became healthy has none.
|
|
10219
|
+
port: _ocpReady ? _ocpPort : null,
|
|
10220
|
+
password: _ocpPassword,
|
|
10221
|
+
alive: () => proc.exitCode == null && proc.signalCode == null,
|
|
10222
|
+
kill: () => {
|
|
10223
|
+
if (isWin && procPid) winKill(procPid);
|
|
10224
|
+
else { try { proc.kill(); } catch {} }
|
|
10225
|
+
},
|
|
10226
|
+
label: 'shared serve',
|
|
10227
|
+
immediate,
|
|
10228
|
+
});
|
|
10229
|
+
if (ended) {
|
|
10230
|
+
const ending = ended;
|
|
10231
|
+
_ocpSharedEnd = ending;
|
|
10232
|
+
ending.finally(() => { if (_ocpSharedEnd === ending) _ocpSharedEnd = null; });
|
|
10095
10233
|
}
|
|
10096
10234
|
_ocpProc = null;
|
|
10235
|
+
_ocpServeFileKey = null;
|
|
10097
10236
|
}
|
|
10098
10237
|
// SynaBun's recorded serves (a process its child started that answers on the port; one of an earlier run whose
|
|
10099
10238
|
// SynaBun has ended), only while the OS still reports each as that very process: a pid another program has by now,
|
|
@@ -10112,6 +10251,7 @@ function stopOpencodeServer({ stopManagedOllama = true } = {}) {
|
|
|
10112
10251
|
if (stopManagedOllama) {
|
|
10113
10252
|
try { stopOllama(); } catch {}
|
|
10114
10253
|
}
|
|
10254
|
+
return ended;
|
|
10115
10255
|
}
|
|
10116
10256
|
|
|
10117
10257
|
// Takeover: a fresh shared serve that boots from the updated auth/config files. A serve is stopped only when it
|
|
@@ -10124,8 +10264,9 @@ function stopOpencodeServer({ stopManagedOllama = true } = {}) {
|
|
|
10124
10264
|
async function takeoverOpencodeServer() {
|
|
10125
10265
|
if (_ocpHistoryClearInProgress) throw new Error('OpenCode history is being cleared');
|
|
10126
10266
|
if (_ocpProc) {
|
|
10127
|
-
// Already managed — simple restart
|
|
10128
|
-
|
|
10267
|
+
// Already managed — simple restart. The old serve's end is waited for (its turns are released first): the new
|
|
10268
|
+
// start must never find the old one still answering on the port.
|
|
10269
|
+
await stopOpencodeServer();
|
|
10129
10270
|
await new Promise(r => setTimeout(r, 1000));
|
|
10130
10271
|
return ensureOpencodeServer();
|
|
10131
10272
|
}
|
|
@@ -18937,6 +19078,32 @@ async function probeBrewOutdated(env) {
|
|
|
18937
19078
|
}
|
|
18938
19079
|
}
|
|
18939
19080
|
|
|
19081
|
+
// Ask WinGet which version of OpenCode it can install (`winget search`, as OpenCode's own updater does: a release
|
|
19082
|
+
// reaches WinGet's repository days after OpenCode publishes it, and some never do). `{ version }`, or null when
|
|
19083
|
+
// WinGet could not be asked or lists no version: the caller fails closed, like the brew probe.
|
|
19084
|
+
async function probeWingetOpencode(env) {
|
|
19085
|
+
try {
|
|
19086
|
+
const { stdout } = await execFileAsync('winget', [...OPENCODE_WINGET_SEARCH_ARGS], {
|
|
19087
|
+
encoding: 'utf-8',
|
|
19088
|
+
timeout: 20000,
|
|
19089
|
+
env,
|
|
19090
|
+
windowsHide: true,
|
|
19091
|
+
maxBuffer: 1024 * 1024,
|
|
19092
|
+
});
|
|
19093
|
+
const version = parseWingetSearchVersion(stdout);
|
|
19094
|
+
return version ? { version } : null;
|
|
19095
|
+
} catch {
|
|
19096
|
+
return null;
|
|
19097
|
+
}
|
|
19098
|
+
}
|
|
19099
|
+
|
|
19100
|
+
// The Git Bash this PC has, for OpenCode's own installer (`opencode upgrade --method curl` on Windows runs it with
|
|
19101
|
+
// Git Bash): the one Claude Code gets (lib/git-bash/). null anywhere else, and where there is none.
|
|
19102
|
+
function opencodeGitBashPath() {
|
|
19103
|
+
if (process.platform !== 'win32') return null;
|
|
19104
|
+
try { return gitBash.resolution()?.path || null; } catch { return null; }
|
|
19105
|
+
}
|
|
19106
|
+
|
|
18940
19107
|
// Resolve SynaBun's own install roots so we can reject any tool binary that
|
|
18941
19108
|
// lives inside our bundled node_modules — bulletproof guard for the recurring
|
|
18942
19109
|
// phantom-version bug (e.g. stale @anthropic-ai/claude-code left over from
|
|
@@ -19000,6 +19167,10 @@ async function checkToolVersions({ force = false } = {}) {
|
|
|
19000
19167
|
const brewOutdated = Object.values(statuses).some((status) => status.state === 'installed' && isBrewSource(status.installSource))
|
|
19001
19168
|
? await probeBrewOutdated(cleanEnv)
|
|
19002
19169
|
: null;
|
|
19170
|
+
// A WinGet install of OpenCode is measured against what WinGet can install (`undefined`: not such an install).
|
|
19171
|
+
const wingetOpencode = process.platform === 'win32' && statuses.opencode?.state === 'installed' && statuses.opencode.installSource === 'winget'
|
|
19172
|
+
? await probeWingetOpencode(cleanEnv)
|
|
19173
|
+
: undefined;
|
|
19003
19174
|
|
|
19004
19175
|
const checkOneTool = async (tool) => {
|
|
19005
19176
|
const status = statuses[tool.key];
|
|
@@ -19046,12 +19217,13 @@ async function checkToolVersions({ force = false } = {}) {
|
|
|
19046
19217
|
npmLatest: upstreamLatest,
|
|
19047
19218
|
brewUpstream,
|
|
19048
19219
|
installed,
|
|
19220
|
+
...(tool.key === 'opencode' ? { winget: wingetOpencode } : {}),
|
|
19049
19221
|
});
|
|
19050
19222
|
const refreshBrew = brewNeedsRefresh({ installSource, brewToken, brewOutdated, brewUpstream, installed });
|
|
19051
19223
|
// A self-updater is started by the path found, so the update reaches this
|
|
19052
19224
|
// very installation even where a terminal's PATH does not name its folder.
|
|
19053
19225
|
const updateCommand = installed
|
|
19054
|
-
? buildUpdateCommand(tool.key, installSource, { brewToken, binPath: status.path, platform: process.platform, refreshBrew })
|
|
19226
|
+
? buildUpdateCommand(tool.key, installSource, { brewToken, binPath: status.path, platform: process.platform, refreshBrew, installedVersion: installed, gitBash: tool.key === 'opencode' ? opencodeGitBashPath() : null })
|
|
19055
19227
|
: null;
|
|
19056
19228
|
|
|
19057
19229
|
return [tool.key, {
|
|
@@ -19106,6 +19278,9 @@ async function checkToolVersions({ force = false } = {}) {
|
|
|
19106
19278
|
// A check started before a newer refresh must never publish its stale answer.
|
|
19107
19279
|
if (generation !== _toolVersionGeneration) return;
|
|
19108
19280
|
_toolVersionCache = { checkedAt: new Date().toISOString(), tools: results };
|
|
19281
|
+
// An update that just landed (the badge's own poll asks every 10 s until it has): SynaBun's serves that still run
|
|
19282
|
+
// the earlier program are replaced now, not at the next restart of SynaBun.
|
|
19283
|
+
try { retireStaleOpencodeServes('version check'); } catch { /* the once-a-minute look tries again */ }
|
|
19109
19284
|
|
|
19110
19285
|
const updates = Object.entries(results).filter(([, v]) => v.updateAvailable);
|
|
19111
19286
|
const broken = Object.entries(results).filter(([, v]) => v.state === 'broken');
|
|
@@ -33100,13 +33275,22 @@ const extensionAdapter = createExtensionAdapter({
|
|
|
33100
33275
|
caller: browserCaller, ownerPage: browserOwnerPageOnly, evaluateGate: extensionEvaluateGate,
|
|
33101
33276
|
selected: req => loadBrowserConfig().connectMode === 'extension' && !runMoreLoginPin(browserCaller(req).id),
|
|
33102
33277
|
});
|
|
33103
|
-
// The extension folder the owner loads (DATA_HOME/browser-extension/unpacked)
|
|
33104
|
-
//
|
|
33105
|
-
//
|
|
33106
|
-
//
|
|
33107
|
-
|
|
33108
|
-
|
|
33109
|
-
|
|
33278
|
+
// The extension folder the owner loads (DATA_HOME/browser-extension/unpacked). Its files are the one package this
|
|
33279
|
+
// release pins (lib/browser-extension-pin.js), downloaded from synabun.ai and verified (lib/browser-extension-package.js):
|
|
33280
|
+
// nothing of the extension is inside the app, and nothing here needs it or the network to start. At start only the
|
|
33281
|
+
// folder's own setup content script is brought to this server's port (no network). A folder older than the pin is
|
|
33282
|
+
// refreshed after listen, in the background (the old one stays on any failure); a folder that is not there is
|
|
33283
|
+
// downloaded only when the owner starts "Connect your browser". The browser then needs the extension's Reload, which
|
|
33284
|
+
// Settings and the setup page say (`reloadNeeded`). Never fatal.
|
|
33285
|
+
const extensionPackage = createExtensionPackage({
|
|
33286
|
+
home: DATA_HOME, appPort: () => Number(PORT) || 3344,
|
|
33287
|
+
log: record => console.log('[extension-bridge]', JSON.stringify(record)),
|
|
33288
|
+
});
|
|
33289
|
+
// Under the data home's lock: a replacement a stopped process left is finished or taken back, its leftovers removed, the
|
|
33290
|
+
// pinned extension's setup script set to this port from its own verified files, and a changed folder repaired from the
|
|
33291
|
+
// verified package the data home keeps (no network; otherwise the background refresh below downloads it).
|
|
33292
|
+
try { const prepared = extensionPackage.retarget(); if (prepared.changed) console.log(`[extension-bridge] extension folder ${prepared.reason === 'repair' ? 'repaired from the verified package' : "set to this server's port"} (${prepared.version}); reload the extension in the browser`); else if (prepared.state === 'other') console.warn('[extension-bridge] the extension folder is not the pinned extension; it is downloaded again after start-up'); }
|
|
33293
|
+
catch (error) { console.warn(`[extension-bridge] extension folder not checked (${error?.code || 'error'}${error?.code === 'EXTENSION_FOLDER_UNSAFE' && error.reason ? `: ${error.reason}` : ''})`); }
|
|
33110
33294
|
// The one-button setup (Settings → Browser → "Connect your browser"; docs/browser-extension-bridge.md → One-button
|
|
33111
33295
|
// setup). Programs are started with execFile/spawn and argument arrays, never a shell; reads time out.
|
|
33112
33296
|
const extensionSetup = createExtensionSetup({
|
|
@@ -33117,13 +33301,15 @@ const extensionSetup = createExtensionSetup({
|
|
|
33117
33301
|
exists: path => { try { return existsSync(path); } catch { return false; } },
|
|
33118
33302
|
list: dir => { try { return readdirSync(dir); } catch { return []; } },
|
|
33119
33303
|
}),
|
|
33120
|
-
prepare: () =>
|
|
33304
|
+
prepare: ({ signal } = {}) => extensionPackage.ensure({ reason: 'setup', signal }),
|
|
33305
|
+
packageStatus: () => extensionPackage.status(),
|
|
33306
|
+
confirmReload: () => extensionPackage.confirmReload(),
|
|
33121
33307
|
exec: (cmd, args) => new Promise((resolveExec, rejectExec) => {
|
|
33122
33308
|
const child = spawn(cmd, args, { detached: true, stdio: 'ignore', windowsHide: true, shell: false });
|
|
33123
33309
|
child.once('error', rejectExec); child.once('spawn', () => { child.unref(); resolveExec(); });
|
|
33124
33310
|
}),
|
|
33125
33311
|
appOrigin: () => `http://127.0.0.1:${Number(PORT) || 3344}`,
|
|
33126
|
-
folderVersion: () => extensionFolderState(DATA_HOME).version,
|
|
33312
|
+
folderVersion: () => { const state = extensionFolderState(DATA_HOME); return state.present ? state.version : null; },
|
|
33127
33313
|
});
|
|
33128
33314
|
{
|
|
33129
33315
|
const restored = extensionBridge.restore();
|
|
@@ -37387,9 +37573,12 @@ app.use('/api/browser/extension', extensionOwnerGuard, (req, res, next) => {
|
|
|
37387
37573
|
});
|
|
37388
37574
|
app.get('/api/browser/extension', (_req, res) => {
|
|
37389
37575
|
const folderState = extensionFolderState(DATA_HOME), status = extensionBridge.status();
|
|
37390
|
-
// `folder`: the folder the owner loads
|
|
37391
|
-
|
|
37392
|
-
|
|
37576
|
+
// `folder`: the folder the owner loads, once it is there (null until "Connect your browser" downloaded the extension).
|
|
37577
|
+
// `package`: the pinned package and its download (pinnedVersion, needs, phase, received, total, code).
|
|
37578
|
+
const pkg = extensionPackage.status();
|
|
37579
|
+
res.json({ ...status, folder: folderState.present ? folderState.folder : null, uploadFolder: extensionUploadRoot,
|
|
37580
|
+
folderVersion: folderState.present ? folderState.version : null, pinnedVersion: pkg.pinnedVersion, package: pkg,
|
|
37581
|
+
...extensionVersions({ connected: status.connected, extensionVersion: status.extensionVersion, folderVersion: folderState.present ? folderState.version : null, pinnedVersion: pkg.pinnedVersion, reloadPending: pkg.reloadPending === true, reloadReason: pkg.reloadReason ?? null }),
|
|
37393
37582
|
setup: extensionSetup.status().state });
|
|
37394
37583
|
});
|
|
37395
37584
|
// The one-button setup. Owner only: these sit under the guard above (ownerRouteGuard, the page secret, no automation
|
|
@@ -37402,6 +37591,20 @@ app.post('/api/browser/extension/setup/ticket', (_req, res) => { res.setHeader('
|
|
|
37402
37591
|
app.post('/api/browser/extension/setup/cancel', (_req, res) => sendSetup(res, () => extensionSetup.cancel()));
|
|
37403
37592
|
app.post('/api/browser/extension/setup/reveal', (_req, res) => sendSetup(res, () => extensionSetup.reveal()));
|
|
37404
37593
|
app.post('/api/browser/extension/setup/reopen', (_req, res) => sendSetup(res, () => extensionSetup.reopen()));
|
|
37594
|
+
// The setup page saw the extension's content script on this port: the Reload a port change asked for is done. A
|
|
37595
|
+
// repair's Reload is not (the copy the browser still runs answers the page just the same): see reload/confirm.
|
|
37596
|
+
app.post('/api/browser/extension/setup/seen', (_req, res) => sendSetup(res, () => extensionSetup.seen()));
|
|
37597
|
+
// The owner's click in Settings ("I reloaded the extension"): the one way a repair's Reload is cleared. Behind the
|
|
37598
|
+
// guard above like `seen` (ownerRouteGuard with its own Origin required, this boot's page secret, no agent or guest),
|
|
37599
|
+
// and also refused here for a request from an extension's own origin, one the browser does not mark same-origin, or
|
|
37600
|
+
// one without the app's X-SynaBun-UI header. The body must say so (`reloaded: true`): nothing the page loads or polls
|
|
37601
|
+
// sends it.
|
|
37602
|
+
app.post('/api/browser/extension/reload/confirm', (req, res) => {
|
|
37603
|
+
const origin = String(req.headers.origin || ''), site = req.headers['sec-fetch-site'];
|
|
37604
|
+
if (/^[a-z-]*extension:/i.test(origin) || (site !== undefined && site !== 'same-origin') || req.headers['x-synabun-ui'] !== '1') return res.status(403).json({ code: 'OWNER_ROUTE', error: 'Only the owner\'s SynaBun Settings can confirm the Reload.' });
|
|
37605
|
+
if (req.body?.reloaded !== true) return res.status(400).json({ code: 'INVALID_MESSAGE', error: 'Send { "reloaded": true } once the extension was reloaded in the browser.' });
|
|
37606
|
+
return sendSetup(res, () => ({ cleared: extensionPackage.confirmRepairReload(), ...extensionSetup.status() }));
|
|
37607
|
+
});
|
|
37405
37608
|
app.post('/api/browser/extension/:action', async (req, res) => {
|
|
37406
37609
|
try {
|
|
37407
37610
|
const action = req.params.action;
|
|
@@ -37413,6 +37616,8 @@ app.post('/api/browser/extension/:action', async (req, res) => {
|
|
|
37413
37616
|
else if (action === 'revoke-site') await extensionBridge.revokeSite(req.body?.site);
|
|
37414
37617
|
// The owner's mode: full control (any site and tab of the paired browser) or only what the owner shares.
|
|
37415
37618
|
else if (action === 'mode') await extensionBridge.setMode(req.body?.fullControl);
|
|
37619
|
+
// The owner's retry of an update that did not download (Settings): only for a folder that is already there.
|
|
37620
|
+
else if (action === 'update') { if (extensionPackage.needs() === 'update') extensionPackage.ensure({ reason: 'update' }).catch(() => {}); }
|
|
37416
37621
|
else return res.status(400).json({ code: 'INVALID_MESSAGE', error: 'Unknown extension action.' });
|
|
37417
37622
|
return res.json({ ok: true, ...extensionBridge.status() });
|
|
37418
37623
|
} catch (error) { return res.status(400).json(extensionSafeError(error)); }
|
|
@@ -39971,6 +40176,14 @@ const httpServer = app.listen(PORT, async () => {
|
|
|
39971
40176
|
// The lists windows, menus and Settings wait for, read once in the background (see LAUNCH_TASKS above).
|
|
39972
40177
|
startLaunchWarmup();
|
|
39973
40178
|
|
|
40179
|
+
// The owner's extension folder, when it holds an older extension than this release pins: the pinned package is
|
|
40180
|
+
// fetched and verified in the background (lib/browser-extension-package.js). Nothing is downloaded for somebody who
|
|
40181
|
+
// never set the extension up, and a failure keeps the folder that is there.
|
|
40182
|
+
setTimeout(() => {
|
|
40183
|
+
try { markActivity('startup:extension-package'); extensionPackage.refreshInBackground(); }
|
|
40184
|
+
catch (error) { console.warn(`[extension-bridge] extension update not started (${error?.code || 'error'})`); }
|
|
40185
|
+
}, 4000).unref?.();
|
|
40186
|
+
|
|
39974
40187
|
// Windows: the Git Bash every Claude Code gets (lib/git-bash/). Looked for now (the settings of the user's own
|
|
39975
40188
|
// claude follow it); a PC with none, and an app that carries none, gets SynaBun's copy, fetched in the background.
|
|
39976
40189
|
setTimeout(() => {
|
|
@@ -40972,7 +41185,8 @@ process.on('exit', () => {
|
|
|
40972
41185
|
try { _whatsapp?.killNow(); } catch {}
|
|
40973
41186
|
try { tunnel.killNow(); } catch {}
|
|
40974
41187
|
try { gitBash.cancel(); } catch {}
|
|
40975
|
-
try { stopOpencodeServer(); } catch {}
|
|
41188
|
+
try { stopOpencodeServer({ immediate: true }); } catch {}
|
|
41189
|
+
try { _ocpServeEnds.killNow(); } catch {}
|
|
40976
41190
|
try { editorCompletionServe.stop('exit'); } catch {}
|
|
40977
41191
|
try { _claudeBridge?.shutdownAllBridges?.(); } catch {}
|
|
40978
41192
|
try { antigravityPanel.closeAll(); } catch {}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "synabun",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "synabun",
|
|
9
|
-
"version": "2.4.
|
|
9
|
+
"version": "2.4.3",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"dependencies": {
|
|
@@ -1842,9 +1842,9 @@
|
|
|
1842
1842
|
"license": "MIT"
|
|
1843
1843
|
},
|
|
1844
1844
|
"node_modules/body-parser": {
|
|
1845
|
-
"version": "1.20.
|
|
1846
|
-
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.
|
|
1847
|
-
"integrity": "sha512-
|
|
1845
|
+
"version": "1.20.9",
|
|
1846
|
+
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.9.tgz",
|
|
1847
|
+
"integrity": "sha512-FISIQxV5u91Y9gvuFq3q/tA/qTqLJn3AhRcEvyozyhJTh5OBFFtv827AdHU7Rbyct4r+Ba1/99oFa1Y3yuFsdw==",
|
|
1848
1848
|
"license": "MIT",
|
|
1849
1849
|
"dependencies": {
|
|
1850
1850
|
"bytes": "~3.1.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "synabun",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"mcpName": "io.github.danilokhury/synabun",
|
|
5
5
|
"description": "Local-first persistent vector memory, MCP tooling, and multi-agent workflows for AI assistants",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"lib/release-scan.mjs",
|
|
39
39
|
"lib/release-publish.mjs",
|
|
40
40
|
"lib/release-npm-ci.mjs",
|
|
41
|
-
"browser-extension/",
|
|
42
41
|
"docs/browser-extension-bridge.md",
|
|
43
42
|
"neural-interface/server.js",
|
|
44
43
|
"neural-interface/lib/",
|