feat: add CentOS7 single executable build

This commit is contained in:
shiyue
2026-06-24 10:36:03 +08:00
parent a794607817
commit 67914ba10f
8 changed files with 365 additions and 26 deletions

View File

@@ -9,7 +9,7 @@ function createAgentRuntime(deps) {
getDefaultCodexModel,
loadCodexConfig,
prepareCodexCustomRuntime,
ccwebMcpServerPath,
ccwebMcpServerArg,
internalMcpUrl,
internalMcpToken,
nodePath,
@@ -31,7 +31,7 @@ function createAgentRuntime(deps) {
}
function createCcwebMcpEnv(session, options = {}) {
if (!ccwebMcpServerPath || !internalMcpUrl || !internalMcpToken || !session?.id) return null;
if (!ccwebMcpServerArg || !internalMcpUrl || !internalMcpToken || !session?.id) return null;
const rawHopCount = Number.parseInt(String(options.mcpContext?.hopCount || 0), 10);
const hopCount = Number.isFinite(rawHopCount) ? Math.max(0, rawHopCount) : 0;
return {
@@ -48,7 +48,7 @@ function createAgentRuntime(deps) {
args.push(
'-c', 'mcp_servers.ccweb.type="stdio"',
'-c', `mcp_servers.ccweb.command=${tomlString(nodePath || 'node')}`,
'-c', `mcp_servers.ccweb.args=${tomlStringArray([ccwebMcpServerPath])}`,
'-c', `mcp_servers.ccweb.args=${tomlStringArray([ccwebMcpServerArg])}`,
'-c', `mcp_servers.ccweb.env_vars=${tomlStringArray(envVars)}`,
'-c', 'mcp_servers.ccweb.startup_timeout_sec=10',
'-c', 'mcp_servers.ccweb.tool_timeout_sec=60'

View File

@@ -306,9 +306,7 @@ async function handleRequest(message) {
}
}
module.exports = { TOOLS };
if (require.main === module) {
function runStdioServer() {
let lineBuffer = '';
process.stdin.setEncoding('utf8');
@@ -334,3 +332,9 @@ if (require.main === module) {
process.exit(0);
});
}
module.exports = { TOOLS, runStdioServer };
if (require.main === module) {
runStdioServer();
}

View File

@@ -1,10 +1,12 @@
'use strict';
const path = require('path');
const { fork } = require('child_process');
const { fork, spawn } = require('child_process');
function createCodexAppWorkerClient(options = {}) {
const workerPath = options.workerPath || path.join(__dirname, 'codex-app-worker.js');
const workerCommand = String(options.workerCommand || '').trim();
const workerArgs = Array.isArray(options.workerArgs) ? options.workerArgs : [];
const onNotification = typeof options.onNotification === 'function' ? options.onNotification : () => {};
const onServerRequest = typeof options.onServerRequest === 'function' ? options.onServerRequest : null;
const onExit = typeof options.onExit === 'function' ? options.onExit : () => {};
@@ -40,11 +42,14 @@ function createCodexAppWorkerClient(options = {}) {
workerExited = false;
configured = false;
appServerRunning = false;
worker = fork(workerPath, [], {
const spawnOptions = {
cwd: options.cwd || process.cwd(),
env: options.env || process.env,
stdio: ['ignore', 'ignore', 'ignore', 'ipc'],
});
};
worker = workerCommand
? spawn(workerCommand, workerArgs, spawnOptions)
: fork(workerPath, [], spawnOptions);
worker.on('message', (message = {}) => {
if (Object.prototype.hasOwnProperty.call(message, 'id')) {