synabun 2026.4.20-beta.0 → 2026.4.20-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/mcp-server/src/http.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Mount on any Express app or run standalone.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import express from 'express';
|
|
9
|
+
import express, { type Router } from 'express';
|
|
10
10
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
11
11
|
import { ensureDatabase } from './services/sqlite.js';
|
|
12
12
|
import { initCategoryCache } from './services/categories.js';
|
|
@@ -39,7 +39,7 @@ export async function ensureInit() {
|
|
|
39
39
|
* Auth is handled externally (URL-embedded key in server.js).
|
|
40
40
|
* Can be mounted on an existing Express app: app.use('/mcp', createMcpRoutes());
|
|
41
41
|
*/
|
|
42
|
-
export function createMcpRoutes() {
|
|
42
|
+
export function createMcpRoutes(): Router {
|
|
43
43
|
const router = express.Router();
|
|
44
44
|
router.use(express.json());
|
|
45
45
|
|
|
@@ -45,6 +45,13 @@ function runUpdate(key, badge) {
|
|
|
45
45
|
if (btn?.dataset.tooltipOriginal) btn.dataset.tooltip = btn.dataset.tooltipOriginal;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
// Poll for the new installed version after the install completes.
|
|
49
|
+
// npm-global installs typically take 5–45s; opencode upgrade similar.
|
|
50
|
+
// Re-check a few times, bail once the badge is cleared or retries run out.
|
|
51
|
+
const delays = [20000, 45000, 90000];
|
|
52
|
+
for (const ms of delays) {
|
|
53
|
+
setTimeout(() => { forceCheckToolUpdates(); }, ms);
|
|
54
|
+
}
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
function wireParentIntercept(parentId, badgeId, key) {
|
|
@@ -2224,10 +2224,36 @@ function resolveLocalCodexBin() {
|
|
|
2224
2224
|
}
|
|
2225
2225
|
}
|
|
2226
2226
|
|
|
2227
|
+
function ensureBundledCodexExecutable(bundledJsPath) {
|
|
2228
|
+
if (process.platform === 'win32') return;
|
|
2229
|
+
try {
|
|
2230
|
+
const st = statSync(bundledJsPath);
|
|
2231
|
+
if (!(st.mode & 0o111)) chmodSync(bundledJsPath, st.mode | 0o755);
|
|
2232
|
+
} catch {}
|
|
2233
|
+
const PLATFORM_PACKAGE = {
|
|
2234
|
+
'darwin-arm64': { pkg: '@openai/codex-darwin-arm64', triple: 'aarch64-apple-darwin' },
|
|
2235
|
+
'darwin-x64': { pkg: '@openai/codex-darwin-x64', triple: 'x86_64-apple-darwin' },
|
|
2236
|
+
'linux-x64': { pkg: '@openai/codex-linux-x64', triple: 'x86_64-unknown-linux-musl' },
|
|
2237
|
+
'linux-arm64': { pkg: '@openai/codex-linux-arm64', triple: 'aarch64-unknown-linux-musl' },
|
|
2238
|
+
};
|
|
2239
|
+
const info = PLATFORM_PACKAGE[`${process.platform}-${process.arch}`];
|
|
2240
|
+
if (!info) return;
|
|
2241
|
+
try {
|
|
2242
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
2243
|
+
const pkgJson = requireFromHere.resolve(`${info.pkg}/package.json`);
|
|
2244
|
+
const nativeBin = join(dirname(pkgJson), 'vendor', info.triple, 'codex', 'codex');
|
|
2245
|
+
if (existsSync(nativeBin)) {
|
|
2246
|
+
const st = statSync(nativeBin);
|
|
2247
|
+
if (!(st.mode & 0o111)) chmodSync(nativeBin, st.mode | 0o755);
|
|
2248
|
+
}
|
|
2249
|
+
} catch {}
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2227
2252
|
function getCodexBin() {
|
|
2228
2253
|
if (_codexBinPath) return _codexBinPath;
|
|
2229
2254
|
const bundledBin = resolveLocalCodexBin();
|
|
2230
2255
|
if (bundledBin && existsSync(bundledBin)) {
|
|
2256
|
+
ensureBundledCodexExecutable(bundledBin);
|
|
2231
2257
|
_codexBinPath = bundledBin;
|
|
2232
2258
|
_codexBinSource = 'bundled';
|
|
2233
2259
|
return _codexBinPath;
|
|
@@ -2879,7 +2905,7 @@ CRITICAL — When you need clarification during planning:
|
|
|
2879
2905
|
if (child) return child;
|
|
2880
2906
|
let codexBin = getCodexBin();
|
|
2881
2907
|
const args = ['app-server'];
|
|
2882
|
-
if (
|
|
2908
|
+
if (/\.js$/i.test(codexBin)) {
|
|
2883
2909
|
args.unshift(codexBin);
|
|
2884
2910
|
codexBin = process.execPath;
|
|
2885
2911
|
}
|
|
@@ -9744,7 +9770,7 @@ app.get('/api/system/tool-versions', async (req, res) => {
|
|
|
9744
9770
|
try { await checkToolVersions(); } catch {}
|
|
9745
9771
|
} else {
|
|
9746
9772
|
const age = Date.now() - new Date(_toolVersionCache.checkedAt).getTime();
|
|
9747
|
-
if (age >
|
|
9773
|
+
if (age > 15 * 60 * 1000) {
|
|
9748
9774
|
try { await checkToolVersions(); } catch {}
|
|
9749
9775
|
}
|
|
9750
9776
|
}
|
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -95,17 +95,21 @@ function buildMcpServer() {
|
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
warn('MCP server dist/ not found — attempting build (requires TypeScript)');
|
|
98
|
+
info('Building MCP server from source...');
|
|
100
99
|
try {
|
|
101
100
|
execSync('npx tsc', {
|
|
102
101
|
cwd: resolve(__dirname, 'mcp-server'),
|
|
103
|
-
stdio: 'pipe',
|
|
104
|
-
timeout:
|
|
102
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
103
|
+
timeout: 120_000,
|
|
105
104
|
});
|
|
106
105
|
ok('MCP server built');
|
|
107
106
|
} catch (err) {
|
|
108
|
-
|
|
107
|
+
fail('MCP server build failed:');
|
|
108
|
+
const stdout = err.stdout?.toString().trim();
|
|
109
|
+
const stderr = err.stderr?.toString().trim();
|
|
110
|
+
if (stdout) console.error(stdout);
|
|
111
|
+
if (stderr) console.error(stderr);
|
|
112
|
+
if (!stdout && !stderr) console.error(err.message);
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
|
package/setup.js
CHANGED
|
@@ -166,16 +166,22 @@ function buildMcpServer() {
|
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
info('Building MCP server from source...');
|
|
170
170
|
try {
|
|
171
171
|
execSync('npx tsc', {
|
|
172
172
|
cwd: resolve(PACKAGE_ROOT, 'mcp-server'),
|
|
173
|
-
stdio: 'pipe',
|
|
174
|
-
timeout:
|
|
173
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
174
|
+
timeout: 120_000,
|
|
175
175
|
});
|
|
176
176
|
ok('MCP server built');
|
|
177
177
|
} catch (err) {
|
|
178
|
-
|
|
178
|
+
fail('MCP server build failed:');
|
|
179
|
+
const stdout = err.stdout?.toString().trim();
|
|
180
|
+
const stderr = err.stderr?.toString().trim();
|
|
181
|
+
if (stdout) console.error(stdout);
|
|
182
|
+
if (stderr) console.error(stderr);
|
|
183
|
+
if (!stdout && !stderr) console.error(err.message);
|
|
184
|
+
console.error('\n Report this at: https://github.com/danilokhury/Synabun/issues');
|
|
179
185
|
}
|
|
180
186
|
}
|
|
181
187
|
|