synabun 2026.7.32 → 2026.7.34
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 +38 -0
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/neural-interface/lib/claude-agent-bridge.js +119 -10
- package/neural-interface/lib/codex-runtime-path.js +102 -35
- package/neural-interface/lib/native-binary-runtime.js +650 -0
- package/neural-interface/lib/native-loop-providers.js +28 -1
- package/neural-interface/package-lock.json +2 -2
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/claude-chat.css +7 -0
- package/neural-interface/public/claude-chat.js +18 -0
- package/neural-interface/public/shared/ui-claude-panel.js +17 -0
- package/neural-interface/scripts/rebuild-pty.js +37 -23
- package/neural-interface/server.js +120 -47
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Codex } from '@openai/codex-sdk';
|
|
2
2
|
import { query as claudeQuery } from '@anthropic-ai/claude-agent-sdk';
|
|
3
3
|
import { CLAUDE_EFFORT_LEVELS } from './claude-model-catalog.js';
|
|
4
|
+
import { claudeRuntime, resolveClaudeExecutableOverride } from './native-binary-runtime.js';
|
|
4
5
|
import { dirname } from 'node:path';
|
|
5
6
|
|
|
6
7
|
function stringEnv(source) {
|
|
@@ -175,6 +176,8 @@ export async function createClaudeNativeLoopAdapter(options = {}) {
|
|
|
175
176
|
runId, cwd, model, effort, browserSessionId, browserTabId,
|
|
176
177
|
mcpUrl, onIdentity = () => {}, onEvent = () => {}, queryFactory = claudeQuery,
|
|
177
178
|
sdkExecutable, includePartialMessages = process.platform !== 'win32',
|
|
179
|
+
// Fallback CLI + runtime probe, injectable for tests.
|
|
180
|
+
claudeBin = null, resolveRuntime = claudeRuntime, logWarn = console.warn,
|
|
178
181
|
} = options;
|
|
179
182
|
const input = createInputQueue();
|
|
180
183
|
const abortController = new AbortController();
|
|
@@ -224,7 +227,31 @@ export async function createClaudeNativeLoopAdapter(options = {}) {
|
|
|
224
227
|
if (mcpUrl) queryOptions.mcpServers = { SynaBun: { type: 'http', url: mcpUrl, headers } };
|
|
225
228
|
if (model) queryOptions.model = model;
|
|
226
229
|
if (effort && CLAUDE_EFFORT_LEVELS.includes(effort)) queryOptions.effort = effort;
|
|
227
|
-
|
|
230
|
+
// The SDK uses pathToClaudeCodeExecutable verbatim with no validation, so vet
|
|
231
|
+
// the override first (a bare command name would ENOENT under shell:false).
|
|
232
|
+
// With no override, calling resolveRuntime() also restores the execute bit on
|
|
233
|
+
// the bundled binary — npm drops it, and this repo commits node_modules.
|
|
234
|
+
//
|
|
235
|
+
// Pre-flight only: unattended loops have no one to prompt, and retries are
|
|
236
|
+
// owned by native-loop-runtime.js. A bad runtime here means we pick the
|
|
237
|
+
// fallback CLI up front rather than failing mid-loop.
|
|
238
|
+
const override = resolveClaudeExecutableOverride(sdkExecutable);
|
|
239
|
+
if (override.path) {
|
|
240
|
+
queryOptions.pathToClaudeCodeExecutable = override.path;
|
|
241
|
+
} else {
|
|
242
|
+
if (sdkExecutable) logWarn(`[native-loop] ignoring sdkExecutable override — ${override.reason}`);
|
|
243
|
+
const runtime = resolveRuntime();
|
|
244
|
+
if (!runtime.ok) {
|
|
245
|
+
const fallback = resolveClaudeExecutableOverride(claudeBin);
|
|
246
|
+
if (fallback.ok && fallback.path) {
|
|
247
|
+
queryOptions.pathToClaudeCodeExecutable = fallback.path;
|
|
248
|
+
logWarn(`[native-loop] bundled Claude binary unusable (${runtime.state}) — using ${fallback.path}`);
|
|
249
|
+
} else {
|
|
250
|
+
logWarn(`[native-loop] bundled Claude binary unusable (${runtime.state}) and no launchable `
|
|
251
|
+
+ `fallback CLI: ${runtime.reason || fallback.reason || 'none configured'}`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
228
255
|
|
|
229
256
|
const q = queryFactory({ prompt: input, options: queryOptions });
|
|
230
257
|
const deltaBuffer = new Map();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neural-memory-interface",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.34",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "neural-memory-interface",
|
|
9
|
-
"version": "2026.7.
|
|
9
|
+
"version": "2026.7.34",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"dependencies": {
|
|
@@ -417,6 +417,13 @@
|
|
|
417
417
|
color: #ff5252;
|
|
418
418
|
font-family: 'JetBrains Mono', monospace;
|
|
419
419
|
}
|
|
420
|
+
.msg-warn {
|
|
421
|
+
padding: 6px 16px 6px 52px;
|
|
422
|
+
font-size: 11.5px;
|
|
423
|
+
color: #e0a33e;
|
|
424
|
+
font-family: 'JetBrains Mono', monospace;
|
|
425
|
+
white-space: pre-wrap;
|
|
426
|
+
}
|
|
420
427
|
|
|
421
428
|
.thinking {
|
|
422
429
|
display: flex;
|
|
@@ -220,6 +220,14 @@ function handleMsg(msg) {
|
|
|
220
220
|
function handleEvent(ev) {
|
|
221
221
|
if (!ev?.type) return;
|
|
222
222
|
|
|
223
|
+
// Non-fatal runtime problems (bundled binary repaired, or fell back to the
|
|
224
|
+
// globally installed CLI). The turn continues — never render this as fatal.
|
|
225
|
+
if (ev.type === 'system' && ev.subtype === 'runtime_notice') {
|
|
226
|
+
if (ev.level === 'error') appendError(ev.message || 'Runtime error');
|
|
227
|
+
else appendWarn(ev.message || 'Runtime notice');
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
223
231
|
// init
|
|
224
232
|
if (ev.type === 'system' && ev.subtype === 'init') {
|
|
225
233
|
if (ev.session_id) {
|
|
@@ -669,6 +677,16 @@ function appendError(text) {
|
|
|
669
677
|
scrollEnd();
|
|
670
678
|
}
|
|
671
679
|
|
|
680
|
+
// Amber: something went wrong and was worked around. The session continues, but
|
|
681
|
+
// it is degraded (e.g. running on the global CLI instead of the bundled one).
|
|
682
|
+
function appendWarn(text) {
|
|
683
|
+
const el = document.createElement('div');
|
|
684
|
+
el.className = 'msg-warn';
|
|
685
|
+
el.textContent = text;
|
|
686
|
+
$msgs.appendChild(el);
|
|
687
|
+
scrollEnd();
|
|
688
|
+
}
|
|
689
|
+
|
|
672
690
|
function scrollEnd() {
|
|
673
691
|
requestAnimationFrame(() => { $msgs.scrollTop = $msgs.scrollHeight; });
|
|
674
692
|
}
|
|
@@ -1125,6 +1125,7 @@ function injectStyles() {
|
|
|
1125
1125
|
/* ── Status / errors / thinking ── */
|
|
1126
1126
|
.cp-messages .msg-status { padding: 2px 14px 2px 48px; font-size: 10px; color: var(--t-faint); font-family: 'JetBrains Mono', monospace; }
|
|
1127
1127
|
.cp-messages .msg-error { padding: 4px 14px 4px 48px; font-size: 10.5px; color: #ff5252; font-family: 'JetBrains Mono', monospace; }
|
|
1128
|
+
.cp-messages .msg-warn { padding: 4px 14px 4px 48px; font-size: 10.5px; color: #e0a33e; font-family: 'JetBrains Mono', monospace; white-space: pre-wrap; }
|
|
1128
1129
|
.cp-messages .msg-tools-summary {
|
|
1129
1130
|
font-size: 9.5px; font-family: 'JetBrains Mono', monospace;
|
|
1130
1131
|
color: rgba(255,255,255,0.2); padding: 3px 0; margin-top: 2px;
|
|
@@ -4997,6 +4998,14 @@ function handleTabEvent(tab, ev) {
|
|
|
4997
4998
|
appendStatus(tab, ev.message || 'Retrying…');
|
|
4998
4999
|
return;
|
|
4999
5000
|
}
|
|
5001
|
+
// Non-fatal runtime problems (e.g. the bundled Claude binary lost its execute
|
|
5002
|
+
// bit and was repaired, or we fell back to the globally installed CLI). The
|
|
5003
|
+
// session continues — this must not render as a fatal error.
|
|
5004
|
+
if (ev.type === 'system' && ev.subtype === 'runtime_notice') {
|
|
5005
|
+
if (ev.level === 'error') appendError(tab, ev.message || 'Runtime error');
|
|
5006
|
+
else appendWarn(tab, ev.message || 'Runtime notice');
|
|
5007
|
+
return;
|
|
5008
|
+
}
|
|
5000
5009
|
|
|
5001
5010
|
if (ev.type === 'system' && (ev.subtype === 'compact' || ev.subtype === 'compact_started')) {
|
|
5002
5011
|
tab.compacting = true;
|
|
@@ -7338,6 +7347,14 @@ function appendError(tab, text) {
|
|
|
7338
7347
|
$msgs.appendChild(el); pruneMessages($msgs); if (tab === activeTab()) scrollEnd();
|
|
7339
7348
|
scheduleSessionSnapshotSave(tab);
|
|
7340
7349
|
}
|
|
7350
|
+
// Amber, between status (grey, ignorable) and error (red, fatal): something went
|
|
7351
|
+
// wrong and was worked around, and the user should know the session is degraded.
|
|
7352
|
+
function appendWarn(tab, text) {
|
|
7353
|
+
const $msgs = tab.messagesEl; if (!$msgs) return;
|
|
7354
|
+
const el = document.createElement('div'); el.className = 'msg-warn'; el.textContent = text;
|
|
7355
|
+
$msgs.appendChild(el); pruneMessages($msgs); if (tab === activeTab()) scrollEnd();
|
|
7356
|
+
scheduleSessionSnapshotSave(tab);
|
|
7357
|
+
}
|
|
7341
7358
|
|
|
7342
7359
|
function scrollEnd(force) {
|
|
7343
7360
|
const tab = activeTab();
|
|
@@ -11,30 +11,48 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { execSync } from 'node:child_process';
|
|
14
|
-
import { existsSync, cpSync, mkdirSync
|
|
14
|
+
import { existsSync, cpSync, mkdirSync } from 'node:fs';
|
|
15
15
|
import { resolve, dirname } from 'node:path';
|
|
16
16
|
import { fileURLToPath } from 'node:url';
|
|
17
|
+
import { ensureVendoredExecutables } from '../lib/native-binary-runtime.js';
|
|
17
18
|
|
|
18
19
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
|
-
const
|
|
20
|
+
const neuralRoot = resolve(__dirname, '..');
|
|
21
|
+
const ptyDir = resolve(neuralRoot, 'node_modules', 'node-pty');
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
// Step 1a: Restore execute permissions on every vendored native binary.
|
|
24
|
+
//
|
|
25
|
+
// npm does not preserve the execute bit for files shipped via a package's
|
|
26
|
+
// `files` array with no `bin` entry — which is exactly how the Claude Agent SDK
|
|
27
|
+
// and Codex ship their native payloads. This repo also commits node_modules, so
|
|
28
|
+
// a checkout can materialize them 0644 as well.
|
|
29
|
+
//
|
|
30
|
+
// The previous version of this step hardcoded four prebuild directories (naming
|
|
31
|
+
// linux dirs that do not exist here while missing ones that do) and chmod'd
|
|
32
|
+
// node_modules/.bin/claude and @anthropic-ai/claude-code/cli.js — neither of
|
|
33
|
+
// which exists any more, since that package was replaced by
|
|
34
|
+
// @anthropic-ai/claude-agent-sdk. The sweep below enumerates instead.
|
|
35
|
+
//
|
|
36
|
+
// This runs BEFORE the node-pty guard below: the sweep also covers the Claude
|
|
37
|
+
// and Codex binaries, which must be repaired even in an install that has no
|
|
38
|
+
// node-pty at all.
|
|
39
|
+
function sweepVendoredBinaries(label) {
|
|
40
|
+
const sweep = ensureVendoredExecutables({ root: neuralRoot, log: console.log });
|
|
41
|
+
for (const failure of sweep.failed) {
|
|
42
|
+
console.warn(`[rebuild-pty] ${failure.path} is not launchable (${failure.state}).`
|
|
43
|
+
+ (failure.repairCommand ? ` Try: ${failure.repairCommand}` : ''));
|
|
44
|
+
}
|
|
45
|
+
if (label && sweep.repaired.length) {
|
|
46
|
+
console.log(`[rebuild-pty] ${label}: repaired ${sweep.repaired.length} binaries`);
|
|
47
|
+
}
|
|
48
|
+
return sweep;
|
|
24
49
|
}
|
|
25
50
|
|
|
26
|
-
|
|
27
|
-
if (process.platform !== 'win32') {
|
|
28
|
-
for (const dir of ['prebuilds/darwin-arm64', 'prebuilds/darwin-x64', 'prebuilds/linux-x64', 'prebuilds/linux-arm64', 'build/Release']) {
|
|
29
|
-
const sh = resolve(ptyDir, dir, 'spawn-helper');
|
|
30
|
-
if (existsSync(sh)) try { chmodSync(sh, 0o755); } catch {}
|
|
31
|
-
}
|
|
51
|
+
sweepVendoredBinaries();
|
|
32
52
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const claudeCli = resolve(__dirname, '..', 'node_modules', '@anthropic-ai', 'claude-code', 'cli.js');
|
|
37
|
-
if (existsSync(claudeCli)) try { chmodSync(claudeCli, 0o755); } catch {}
|
|
53
|
+
if (!existsSync(ptyDir)) {
|
|
54
|
+
console.log('[rebuild-pty] node-pty not found, skipping rebuild');
|
|
55
|
+
process.exit(0);
|
|
38
56
|
}
|
|
39
57
|
|
|
40
58
|
// Step 1b: Check if node-pty actually works (spawn test, not just module load)
|
|
@@ -86,13 +104,9 @@ if (existsSync(buildDir)) {
|
|
|
86
104
|
}
|
|
87
105
|
}
|
|
88
106
|
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (existsSync(spawnHelper)) {
|
|
93
|
-
chmodSync(spawnHelper, 0o755);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
107
|
+
// cpSync does not preserve the execute bit, so re-sweep the freshly copied
|
|
108
|
+
// binaries (this also picks up the prebuilds dir we just created).
|
|
109
|
+
sweepVendoredBinaries('post-rebuild');
|
|
96
110
|
|
|
97
111
|
console.log(`[rebuild-pty] Rebuilt for ${platform}-${arch} (Node ${process.version})`);
|
|
98
112
|
} else {
|
|
@@ -79,7 +79,15 @@ import {
|
|
|
79
79
|
createCodexNativeLoopAdapter,
|
|
80
80
|
createOpenCodeNativeLoopAdapter,
|
|
81
81
|
} from './lib/native-loop-providers.js';
|
|
82
|
-
import {
|
|
82
|
+
import {
|
|
83
|
+
resolveTrustedWindowsCodexBinary,
|
|
84
|
+
selectWindowsCodexLauncher,
|
|
85
|
+
windowsCodexPackageJsonCandidates,
|
|
86
|
+
} from './lib/codex-runtime-path.js';
|
|
87
|
+
import {
|
|
88
|
+
claudeRuntime,
|
|
89
|
+
ensureVendoredExecutables,
|
|
90
|
+
} from './lib/native-binary-runtime.js';
|
|
83
91
|
import {
|
|
84
92
|
buildExecInvocation,
|
|
85
93
|
execWrapperExtension,
|
|
@@ -180,26 +188,23 @@ const readFdAsync = promisify(readCb);
|
|
|
180
188
|
const __filename = fileURLToPath(import.meta.url);
|
|
181
189
|
const __dirname = dirname(__filename);
|
|
182
190
|
|
|
183
|
-
//
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
} catch (err) {
|
|
201
|
-
console.warn('[pty] Could not verify spawn-helper permissions:', err.message);
|
|
191
|
+
// Restore execute permissions on every vendored native binary (Claude Agent SDK,
|
|
192
|
+
// Codex, node-pty). npm and cpSync drop the execute bit, and this repo commits
|
|
193
|
+
// node_modules — historically with core.filemode=false, so binaries checked out
|
|
194
|
+
// 0644 and failed to spawn. The Claude sidepanel surfaced that as the SDK's
|
|
195
|
+
// misleading "does not match this system's libc" error.
|
|
196
|
+
//
|
|
197
|
+
// This sweeps ALL platform directories, not just this host's: a vendored
|
|
198
|
+
// checkout can carry several, and repairing only the current one left e.g.
|
|
199
|
+
// prebuilds/darwin-x64/spawn-helper broken for Intel Macs.
|
|
200
|
+
try {
|
|
201
|
+
const sweep = ensureVendoredExecutables({ root: __dirname, log: (msg) => console.log(msg) });
|
|
202
|
+
for (const failure of sweep.failed) {
|
|
203
|
+
console.warn(`[binaries] ${failure.path} is not launchable (${failure.state}).`
|
|
204
|
+
+ (failure.repairCommand ? ` Try: ${failure.repairCommand}` : ''));
|
|
202
205
|
}
|
|
206
|
+
} catch (err) {
|
|
207
|
+
console.warn('[binaries] Could not verify vendored binary permissions:', err.message);
|
|
203
208
|
}
|
|
204
209
|
|
|
205
210
|
// Load only the canonical data-home environment. Importing `dotenv/config`
|
|
@@ -2994,13 +2999,28 @@ function _heartbeatLock(sessionId, windowId) {
|
|
|
2994
2999
|
let _claudeBinPath = null;
|
|
2995
3000
|
function getAugmentedPath() {
|
|
2996
3001
|
const home = os.homedir();
|
|
2997
|
-
const
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3002
|
+
const npmPrefix = process.env.NPM_CONFIG_PREFIX || process.env.npm_config_prefix || '';
|
|
3003
|
+
const extra = process.platform === 'win32'
|
|
3004
|
+
? [
|
|
3005
|
+
process.env.APPDATA ? join(process.env.APPDATA, 'npm') : join(home, 'AppData', 'Roaming', 'npm'),
|
|
3006
|
+
npmPrefix,
|
|
3007
|
+
dirname(process.execPath),
|
|
3008
|
+
]
|
|
3009
|
+
: [
|
|
3010
|
+
join(home, '.local', 'bin'),
|
|
3011
|
+
'/usr/local/bin',
|
|
3012
|
+
join(home, '.npm-global', 'bin'),
|
|
3013
|
+
npmPrefix ? join(npmPrefix, 'bin') : '',
|
|
3014
|
+
];
|
|
3015
|
+
const entries = [...extra.filter(d => d && existsSync(d)), ...(process.env.PATH || '').split(delimiter)];
|
|
3016
|
+
const seen = new Set();
|
|
3017
|
+
return entries.filter((entry) => {
|
|
3018
|
+
if (!entry) return false;
|
|
3019
|
+
const key = process.platform === 'win32' ? entry.toLowerCase() : entry;
|
|
3020
|
+
if (seen.has(key)) return false;
|
|
3021
|
+
seen.add(key);
|
|
3022
|
+
return true;
|
|
3023
|
+
}).join(delimiter);
|
|
3004
3024
|
}
|
|
3005
3025
|
|
|
3006
3026
|
function getClaudeBin() {
|
|
@@ -3088,6 +3108,47 @@ let _nativeCodexBinPath = null;
|
|
|
3088
3108
|
// exported subpath, so resolving that file reports a false negative.
|
|
3089
3109
|
const _codexSdkInstalled = true;
|
|
3090
3110
|
|
|
3111
|
+
function resolveWindowsGlobalCodexRuntime() {
|
|
3112
|
+
const globalPath = getAugmentedPath().split(delimiter)
|
|
3113
|
+
.filter((entry) => !/[\\/]node_modules[\\/]\.bin[\\/]?$/i.test(entry))
|
|
3114
|
+
.join(delimiter);
|
|
3115
|
+
const env = { ...process.env, PATH: globalPath };
|
|
3116
|
+
const whereExecutable = process.env.SystemRoot
|
|
3117
|
+
? join(process.env.SystemRoot, 'System32', 'where.exe')
|
|
3118
|
+
: 'where.exe';
|
|
3119
|
+
const lookup = spawnSync(whereExecutable, ['codex'], {
|
|
3120
|
+
encoding: 'utf-8',
|
|
3121
|
+
env,
|
|
3122
|
+
windowsHide: true,
|
|
3123
|
+
});
|
|
3124
|
+
const launchers = lookup.status === 0
|
|
3125
|
+
? String(lookup.stdout || '').split(/\r?\n/).map((line) => line.trim()).filter(Boolean)
|
|
3126
|
+
: [];
|
|
3127
|
+
|
|
3128
|
+
const npmRootProbe = spawnSync(
|
|
3129
|
+
process.env.ComSpec || process.env.COMSPEC || 'cmd.exe',
|
|
3130
|
+
['/d', '/s', '/c', 'npm root -g'],
|
|
3131
|
+
{ encoding: 'utf-8', env, windowsHide: true, timeout: 5000 },
|
|
3132
|
+
);
|
|
3133
|
+
const npmRoots = npmRootProbe.status === 0
|
|
3134
|
+
? String(npmRootProbe.stdout || '').split(/\r?\n/).map((line) => line.trim()).filter(Boolean)
|
|
3135
|
+
: [];
|
|
3136
|
+
const codexPackageJsonPaths = windowsCodexPackageJsonCandidates({
|
|
3137
|
+
npmRoots,
|
|
3138
|
+
appData: process.env.APPDATA,
|
|
3139
|
+
npmConfigPrefix: process.env.NPM_CONFIG_PREFIX || process.env.npm_config_prefix,
|
|
3140
|
+
synabunPackageRoot: PACKAGE_ROOT,
|
|
3141
|
+
nodeExecutable: process.execPath,
|
|
3142
|
+
});
|
|
3143
|
+
const resolved = resolveTrustedWindowsCodexBinary({
|
|
3144
|
+
launchers,
|
|
3145
|
+
codexPackageJsonPaths,
|
|
3146
|
+
arch: process.arch,
|
|
3147
|
+
acceptBinary: (candidate) => !isInsideSynabun(candidate),
|
|
3148
|
+
});
|
|
3149
|
+
return { ...resolved, launchers, codexPackageJsonPaths, npmRoots };
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3091
3152
|
function getCodexBin() {
|
|
3092
3153
|
if (_codexBinPath) return _codexBinPath;
|
|
3093
3154
|
// All Codex surfaces follow the user's trusted global install. Never fall
|
|
@@ -3098,8 +3159,16 @@ function getCodexBin() {
|
|
|
3098
3159
|
.join(delimiter);
|
|
3099
3160
|
const envWithPath = { ...process.env, PATH: globalPath };
|
|
3100
3161
|
if (process.platform === 'win32') {
|
|
3101
|
-
|
|
3102
|
-
|
|
3162
|
+
const resolution = resolveWindowsGlobalCodexRuntime();
|
|
3163
|
+
if (resolution.path) {
|
|
3164
|
+
_codexBinPath = resolution.path;
|
|
3165
|
+
_nativeCodexBinPath = resolution.path;
|
|
3166
|
+
} else {
|
|
3167
|
+
_codexBinPath = selectWindowsCodexLauncher(
|
|
3168
|
+
resolution.launchers,
|
|
3169
|
+
(launcher) => !isInsideSynabun(launcher),
|
|
3170
|
+
);
|
|
3171
|
+
}
|
|
3103
3172
|
} else {
|
|
3104
3173
|
try { _codexBinPath = execSync('which codex', { encoding: 'utf-8', env: envWithPath }).trim(); }
|
|
3105
3174
|
catch { _codexBinPath = null; }
|
|
@@ -3121,31 +3190,25 @@ function getNativeCodexBin() {
|
|
|
3121
3190
|
if (_nativeCodexBinPath) return _nativeCodexBinPath;
|
|
3122
3191
|
|
|
3123
3192
|
if (process.platform === 'win32') {
|
|
3124
|
-
const
|
|
3125
|
-
.filter((entry) => !/[\\/]node_modules[\\/]\.bin[\\/]?$/i.test(entry))
|
|
3126
|
-
.join(delimiter);
|
|
3127
|
-
const lookup = spawnSync('where.exe', ['codex'], {
|
|
3128
|
-
encoding: 'utf-8',
|
|
3129
|
-
env: { ...process.env, PATH: globalPath },
|
|
3130
|
-
windowsHide: true,
|
|
3131
|
-
});
|
|
3132
|
-
const launchers = lookup.status === 0
|
|
3133
|
-
? String(lookup.stdout || '').split(/\r?\n/).map((line) => line.trim()).filter(Boolean)
|
|
3134
|
-
: [];
|
|
3135
|
-
const resolved = resolveTrustedWindowsCodexBinary({
|
|
3136
|
-
launchers,
|
|
3137
|
-
arch: process.arch,
|
|
3138
|
-
acceptBinary: (candidate) => !isInsideSynabun(candidate),
|
|
3139
|
-
});
|
|
3193
|
+
const resolved = resolveWindowsGlobalCodexRuntime();
|
|
3140
3194
|
if (resolved.path) {
|
|
3141
3195
|
_nativeCodexBinPath = resolved.path;
|
|
3196
|
+
_codexBinPath = resolved.path;
|
|
3197
|
+
_codexBinSource = 'global';
|
|
3198
|
+
console.log(`[codex-native] Resolved Windows runtime (${resolved.source}): ${resolved.path}`);
|
|
3142
3199
|
return _nativeCodexBinPath;
|
|
3143
3200
|
}
|
|
3144
3201
|
if (resolved.reason) {
|
|
3145
3202
|
console.warn(`[codex-native] ${resolved.reason}`);
|
|
3146
3203
|
}
|
|
3204
|
+
if (resolved.checked?.length) {
|
|
3205
|
+
console.warn(`[codex-native] Checked: ${resolved.checked.slice(0, 16).join(' | ')}`);
|
|
3206
|
+
}
|
|
3207
|
+
const globalPackageFound = resolved.codexPackageJsonPaths.some((candidate) => existsSync(candidate));
|
|
3147
3208
|
throw new Error(
|
|
3148
|
-
|
|
3209
|
+
globalPackageFound
|
|
3210
|
+
? 'The global Codex package was found, but its Windows runtime is missing. Reinstall it with: npm install -g @openai/codex@latest --include=optional, then restart SynaBun.'
|
|
3211
|
+
: 'Codex is not installed globally or could not be located. Install it with: npm install -g @openai/codex@latest --include=optional, then restart SynaBun.',
|
|
3149
3212
|
);
|
|
3150
3213
|
}
|
|
3151
3214
|
|
|
@@ -9579,8 +9642,14 @@ let _claudeBridgeError = null;
|
|
|
9579
9642
|
if (typeof cfg.partials === 'boolean') return cfg.partials;
|
|
9580
9643
|
return process.platform !== 'win32';
|
|
9581
9644
|
},
|
|
9582
|
-
// Optional explicit
|
|
9645
|
+
// Optional explicit executable override; bundled SDK CLI is the default.
|
|
9646
|
+
// Accepts a .js entrypoint (launched via node) or a native binary path —
|
|
9647
|
+
// see resolveClaudeExecutableOverride() in lib/native-binary-runtime.js.
|
|
9583
9648
|
get sdkExecutable() { return _readClaudeSkinConfig().sdkExecutable || null; },
|
|
9649
|
+
// Last-resort runtime for the bridge: if the SDK's bundled native binary
|
|
9650
|
+
// cannot be launched or repaired, fall back to the user's installed CLI.
|
|
9651
|
+
// Lazy so the (memoized) resolution happens on demand, not at boot.
|
|
9652
|
+
getClaudeBin: () => getClaudeBin(),
|
|
9584
9653
|
});
|
|
9585
9654
|
const shutdown = () => { try { _claudeBridge.shutdownAllBridges(); } catch {} };
|
|
9586
9655
|
process.on('exit', shutdown);
|
|
@@ -26004,6 +26073,10 @@ _nativeLoopRuntime = new NativeLoopRuntime({
|
|
|
26004
26073
|
model: state.model && state.model.includes(':') ? toCliModelName(state.model) : state.model,
|
|
26005
26074
|
mcpUrl: `http://localhost:${PORT}/mcp`,
|
|
26006
26075
|
sdkExecutable: config.sdkExecutable || undefined,
|
|
26076
|
+
// Fallback if the SDK's bundled native binary is unusable — unattended
|
|
26077
|
+
// loops cannot surface a permission error to anyone, so they need the
|
|
26078
|
+
// same escape hatch the sidepanel has.
|
|
26079
|
+
claudeBin: getClaudeBin(),
|
|
26007
26080
|
includePartialMessages: typeof config.partials === 'boolean'
|
|
26008
26081
|
? config.partials
|
|
26009
26082
|
: process.platform !== 'win32',
|
package/package.json
CHANGED