feat(runtime): default to passthrough and persist execution permissions

This commit is contained in:
Agent Workbench Dev
2026-11-06 04:58:57 +08:00
parent 67c034f4b6
commit 2fa220735d
113 changed files with 1866 additions and 631 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ export function gitArguments(root, args, hooksDirectory) {
...(hooksDirectory ? ['-c', 'core.hooksPath=' + hooksDirectory] : []), ...args];
}
export function runGit(root, args, { input, env = {}, signal, timeoutMs = 10000, hooksDirectory, maximumBytes = 2 * 1024 * 1024, onSpawn } = {}) {
export function runGit(root, args, { input, env = {}, signal, timeoutMs = 0, hooksDirectory, maximumBytes = Infinity, onSpawn } = {}) {
return new Promise((resolve, reject) => {
if (signal?.aborted) return reject(signal.reason ?? new Error('Git操作已停止。'));
const child = spawn('git', gitArguments(root, args, hooksDirectory), { env: gitEnvironment(env), windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] });
@@ -22,7 +22,7 @@ export function runGit(root, args, { input, env = {}, signal, timeoutMs = 10000,
const capture = list => chunk => { bytes += chunk.length; if (bytes > maximumBytes) { exceeded = true; child.kill(); } else list.push(chunk); };
child.stdout.on('data', capture(chunks)); child.stderr.on('data', capture(errors));
child.stdin.on('error', () => {});
const timer = setTimeout(() => { timedOut = true; child.kill(); }, timeoutMs);
const timer = timeoutMs > 0 ? setTimeout(() => { timedOut = true; child.kill(); }, timeoutMs) : null;
const stop = () => child.kill();
signal?.addEventListener('abort', stop, { once: true });
child.once('error', error => { clearTimeout(timer); signal?.removeEventListener('abort', stop); reject(error); });