happy-imou-cloud 2.0.5 → 2.0.7
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/dist/{BaseReasoningProcessor-bFVTvf3Q.mjs → BaseReasoningProcessor-ClrT-x-H.mjs} +2 -2
- package/dist/{BaseReasoningProcessor-DPVZIJ4n.cjs → BaseReasoningProcessor-DphULXS-.cjs} +2 -2
- package/dist/{api-DaqnNHfl.cjs → api-Dwkm7s_E.cjs} +3 -3
- package/dist/{api-DoHt-HyL.mjs → api-dwwHBzLc.mjs} +3 -3
- package/dist/{command-Dl9SrMnv.mjs → command-Cfq3Uc0S.mjs} +3 -3
- package/dist/{command-D9-hmqVq.cjs → command-DiAVIsxX.cjs} +3 -3
- package/dist/{index-Dc92gnxM.cjs → index-CfqxEoyl.cjs} +235 -93
- package/dist/{index-C5wR2qKT.mjs → index-HyqLXzw-.mjs} +233 -91
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +5 -5
- package/dist/lib.cjs +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-QqeBvUxX.mjs → persistence-Dg-rxY2a.mjs} +1 -1
- package/dist/{persistence-D6Y0604_.cjs → persistence-hbhwAYIV.cjs} +1 -1
- package/dist/{registerKillSessionHandler-CC9zGBPE.mjs → registerKillSessionHandler-BAvk4GYO.mjs} +26 -2
- package/dist/{registerKillSessionHandler-C6yXr8ky.cjs → registerKillSessionHandler-D1ouN10n.cjs} +26 -2
- package/dist/{runClaude-gHKFB1UG.cjs → runClaude-CZmJ7qEP.cjs} +5 -5
- package/dist/{runClaude-CZ8gxaJL.mjs → runClaude-OxYbt3ZQ.mjs} +4 -4
- package/dist/{runCodex-DT7g4MPm.mjs → runCodex-ByVTEbSY.mjs} +35 -62
- package/dist/{runCodex-CdjzG1N7.cjs → runCodex-CtncAgso.cjs} +34 -62
- package/dist/{runGemini-CmY5386l.mjs → runGemini-BRO6A2jm.mjs} +5 -5
- package/dist/{runGemini-DxjvRmOc.cjs → runGemini-ChwjLmhI.cjs} +5 -5
- package/package.json +2 -2
- package/scripts/release-smoke.mjs +4 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
|
-
import { c as configuration, p as packageJson, s as startOfflineReconnection, l as logger } from './api-
|
|
4
|
-
import { p as projectPath } from './index-
|
|
3
|
+
import { c as configuration, p as packageJson, s as startOfflineReconnection, l as logger } from './api-dwwHBzLc.mjs';
|
|
4
|
+
import { p as projectPath } from './index-HyqLXzw-.mjs';
|
|
5
5
|
import { EventEmitter } from 'node:events';
|
|
6
6
|
import { randomUUID } from 'node:crypto';
|
|
7
7
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var os = require('node:os');
|
|
4
4
|
var node_path = require('node:path');
|
|
5
|
-
var api = require('./api-
|
|
6
|
-
var index = require('./index-
|
|
5
|
+
var api = require('./api-Dwkm7s_E.cjs');
|
|
6
|
+
var index = require('./index-CfqxEoyl.cjs');
|
|
7
7
|
var node_events = require('node:events');
|
|
8
8
|
var node_crypto = require('node:crypto');
|
|
9
9
|
|
|
@@ -19,7 +19,7 @@ var path = require('path');
|
|
|
19
19
|
var expoServerSdk = require('expo-server-sdk');
|
|
20
20
|
|
|
21
21
|
var name = "happy-imou-cloud";
|
|
22
|
-
var version = "2.0.
|
|
22
|
+
var version = "2.0.7";
|
|
23
23
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
24
24
|
var author = "long.zhu";
|
|
25
25
|
var license = "MIT";
|
|
@@ -78,7 +78,7 @@ var scripts = {
|
|
|
78
78
|
"dev:local-server": "yarn build && tsx --env-file .env.dev-local-server src/index.ts",
|
|
79
79
|
"dev:integration-test-env": "yarn build && tsx --env-file .env.integration-test src/index.ts",
|
|
80
80
|
"// ==== Release ====": "",
|
|
81
|
-
prepublishOnly: "
|
|
81
|
+
prepublishOnly: "yarn release:smoke",
|
|
82
82
|
release: "yarn install && release-it",
|
|
83
83
|
"release:smoke": "node ./scripts/release-smoke.mjs",
|
|
84
84
|
"// ==== Dev/Stable Variant Management ====": "",
|
|
@@ -433,7 +433,7 @@ async function listDaemonLogFiles(limit = 50) {
|
|
|
433
433
|
return { file, path: fullPath, modified: stats.mtime };
|
|
434
434
|
}).sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
435
435
|
try {
|
|
436
|
-
const { readDaemonState } = await Promise.resolve().then(function () { return require('./persistence-
|
|
436
|
+
const { readDaemonState } = await Promise.resolve().then(function () { return require('./persistence-hbhwAYIV.cjs'); });
|
|
437
437
|
const state = await readDaemonState();
|
|
438
438
|
if (!state) {
|
|
439
439
|
return logs;
|
|
@@ -17,7 +17,7 @@ import { resolve, join as join$1 } from 'path';
|
|
|
17
17
|
import { Expo } from 'expo-server-sdk';
|
|
18
18
|
|
|
19
19
|
var name = "happy-imou-cloud";
|
|
20
|
-
var version = "2.0.
|
|
20
|
+
var version = "2.0.7";
|
|
21
21
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
22
22
|
var author = "long.zhu";
|
|
23
23
|
var license = "MIT";
|
|
@@ -76,7 +76,7 @@ var scripts = {
|
|
|
76
76
|
"dev:local-server": "yarn build && tsx --env-file .env.dev-local-server src/index.ts",
|
|
77
77
|
"dev:integration-test-env": "yarn build && tsx --env-file .env.integration-test src/index.ts",
|
|
78
78
|
"// ==== Release ====": "",
|
|
79
|
-
prepublishOnly: "
|
|
79
|
+
prepublishOnly: "yarn release:smoke",
|
|
80
80
|
release: "yarn install && release-it",
|
|
81
81
|
"release:smoke": "node ./scripts/release-smoke.mjs",
|
|
82
82
|
"// ==== Dev/Stable Variant Management ====": "",
|
|
@@ -431,7 +431,7 @@ async function listDaemonLogFiles(limit = 50) {
|
|
|
431
431
|
return { file, path: fullPath, modified: stats.mtime };
|
|
432
432
|
}).sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
433
433
|
try {
|
|
434
|
-
const { readDaemonState } = await import('./persistence-
|
|
434
|
+
const { readDaemonState } = await import('./persistence-Dg-rxY2a.mjs');
|
|
435
435
|
const state = await readDaemonState();
|
|
436
436
|
if (!state) {
|
|
437
437
|
return logs;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as createDefaultRuntimeShell } from './index-
|
|
1
|
+
import { c as createDefaultRuntimeShell } from './index-HyqLXzw-.mjs';
|
|
2
2
|
import 'chalk';
|
|
3
|
-
import './api-
|
|
3
|
+
import './api-dwwHBzLc.mjs';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'node:fs';
|
|
@@ -17,7 +17,7 @@ import 'fs/promises';
|
|
|
17
17
|
import 'crypto';
|
|
18
18
|
import 'path';
|
|
19
19
|
import 'expo-server-sdk';
|
|
20
|
-
import './persistence-
|
|
20
|
+
import './persistence-Dg-rxY2a.mjs';
|
|
21
21
|
import 'node:fs/promises';
|
|
22
22
|
import 'os';
|
|
23
23
|
import 'tmp';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-CfqxEoyl.cjs');
|
|
4
4
|
require('chalk');
|
|
5
|
-
require('./api-
|
|
5
|
+
require('./api-Dwkm7s_E.cjs');
|
|
6
6
|
require('axios');
|
|
7
7
|
require('fs');
|
|
8
8
|
require('node:fs');
|
|
@@ -19,7 +19,7 @@ require('fs/promises');
|
|
|
19
19
|
require('crypto');
|
|
20
20
|
require('path');
|
|
21
21
|
require('expo-server-sdk');
|
|
22
|
-
require('./persistence-
|
|
22
|
+
require('./persistence-hbhwAYIV.cjs');
|
|
23
23
|
require('node:fs/promises');
|
|
24
24
|
require('os');
|
|
25
25
|
require('tmp');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
|
-
var api = require('./api-
|
|
5
|
-
var persistence = require('./persistence-
|
|
4
|
+
var api = require('./api-Dwkm7s_E.cjs');
|
|
5
|
+
var persistence = require('./persistence-hbhwAYIV.cjs');
|
|
6
6
|
var z = require('zod');
|
|
7
7
|
var fs$1 = require('fs/promises');
|
|
8
8
|
var os$1 = require('os');
|
|
@@ -70,7 +70,7 @@ async function openBrowser(url) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
73
|
+
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-CfqxEoyl.cjs', document.baseURI).href)));
|
|
74
74
|
const QRCode = require$1("qrcode-terminal/vendor/QRCode");
|
|
75
75
|
const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
|
|
76
76
|
const pendingTempFiles = /* @__PURE__ */ new Set();
|
|
@@ -693,7 +693,7 @@ function setupCleanupHandlers() {
|
|
|
693
693
|
});
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
-
const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
696
|
+
const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-CfqxEoyl.cjs', document.baseURI).href))));
|
|
697
697
|
function projectPath() {
|
|
698
698
|
const path$1 = path.resolve(__dirname$1, "..");
|
|
699
699
|
return path$1;
|
|
@@ -4928,6 +4928,205 @@ function handleThinkingUpdate(update, ctx) {
|
|
|
4928
4928
|
return { handled: true };
|
|
4929
4929
|
}
|
|
4930
4930
|
|
|
4931
|
+
function buildAcpSpawnSpec(params) {
|
|
4932
|
+
return {
|
|
4933
|
+
command: params.command,
|
|
4934
|
+
args: (params.args ?? []).map((arg) => String(arg)),
|
|
4935
|
+
options: {
|
|
4936
|
+
cwd: params.cwd,
|
|
4937
|
+
env: params.env,
|
|
4938
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
4939
|
+
windowsHide: process.platform === "win32"
|
|
4940
|
+
}
|
|
4941
|
+
};
|
|
4942
|
+
}
|
|
4943
|
+
|
|
4944
|
+
function createAcpFilteredStdoutReadable(params) {
|
|
4945
|
+
const maxMultilineBytes = typeof params.maxMultilineBytes === "number" && Number.isFinite(params.maxMultilineBytes) && params.maxMultilineBytes > 0 ? Math.trunc(params.maxMultilineBytes) : 1e6;
|
|
4946
|
+
const decoder = new TextDecoder();
|
|
4947
|
+
const encoder = new TextEncoder();
|
|
4948
|
+
return new ReadableStream({
|
|
4949
|
+
async start(controller) {
|
|
4950
|
+
const reader = params.readable.getReader();
|
|
4951
|
+
let buffer = "";
|
|
4952
|
+
let multiline = null;
|
|
4953
|
+
let controllerErrored = false;
|
|
4954
|
+
const drop = (reason, line) => {
|
|
4955
|
+
params.onDroppedLine?.({ reason, line });
|
|
4956
|
+
};
|
|
4957
|
+
const enqueueLine = (line) => {
|
|
4958
|
+
if (!line.trim()) {
|
|
4959
|
+
return;
|
|
4960
|
+
}
|
|
4961
|
+
const filtered = params.transport.filterStdoutLine?.(line);
|
|
4962
|
+
if (filtered === void 0) {
|
|
4963
|
+
controller.enqueue(encoder.encode(line + "\n"));
|
|
4964
|
+
return;
|
|
4965
|
+
}
|
|
4966
|
+
if (filtered === null) {
|
|
4967
|
+
drop("transport_filter_null", line);
|
|
4968
|
+
return;
|
|
4969
|
+
}
|
|
4970
|
+
controller.enqueue(encoder.encode(filtered + "\n"));
|
|
4971
|
+
};
|
|
4972
|
+
const tryFlushMultiline = (candidate) => {
|
|
4973
|
+
const trimmed = candidate.trim();
|
|
4974
|
+
if (!trimmed) {
|
|
4975
|
+
return false;
|
|
4976
|
+
}
|
|
4977
|
+
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
|
|
4978
|
+
return false;
|
|
4979
|
+
}
|
|
4980
|
+
try {
|
|
4981
|
+
const parsed = JSON.parse(trimmed);
|
|
4982
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
4983
|
+
return false;
|
|
4984
|
+
}
|
|
4985
|
+
enqueueLine(JSON.stringify(parsed));
|
|
4986
|
+
return true;
|
|
4987
|
+
} catch {
|
|
4988
|
+
return false;
|
|
4989
|
+
}
|
|
4990
|
+
};
|
|
4991
|
+
try {
|
|
4992
|
+
while (true) {
|
|
4993
|
+
const { value, done } = await reader.read();
|
|
4994
|
+
if (done) {
|
|
4995
|
+
break;
|
|
4996
|
+
}
|
|
4997
|
+
if (!value) {
|
|
4998
|
+
continue;
|
|
4999
|
+
}
|
|
5000
|
+
buffer += decoder.decode(value, { stream: true });
|
|
5001
|
+
const lines = buffer.split("\n");
|
|
5002
|
+
buffer = lines.pop() || "";
|
|
5003
|
+
for (const line of lines) {
|
|
5004
|
+
if (multiline) {
|
|
5005
|
+
const nextBuf = multiline.buf.length > 0 ? `${multiline.buf}
|
|
5006
|
+
${line}` : line;
|
|
5007
|
+
const nextBytes = multiline.bytes + line.length + 1;
|
|
5008
|
+
if (nextBytes > maxMultilineBytes) {
|
|
5009
|
+
drop("multiline_overflow", multiline.buf);
|
|
5010
|
+
multiline = null;
|
|
5011
|
+
enqueueLine(line);
|
|
5012
|
+
continue;
|
|
5013
|
+
}
|
|
5014
|
+
multiline = { buf: nextBuf, bytes: nextBytes };
|
|
5015
|
+
if (tryFlushMultiline(multiline.buf)) {
|
|
5016
|
+
multiline = null;
|
|
5017
|
+
}
|
|
5018
|
+
continue;
|
|
5019
|
+
}
|
|
5020
|
+
const trimmed = line.trim();
|
|
5021
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
5022
|
+
try {
|
|
5023
|
+
const parsed = JSON.parse(trimmed);
|
|
5024
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
5025
|
+
enqueueLine(line);
|
|
5026
|
+
continue;
|
|
5027
|
+
}
|
|
5028
|
+
} catch {
|
|
5029
|
+
multiline = { buf: line, bytes: line.length };
|
|
5030
|
+
continue;
|
|
5031
|
+
}
|
|
5032
|
+
}
|
|
5033
|
+
enqueueLine(line);
|
|
5034
|
+
}
|
|
5035
|
+
}
|
|
5036
|
+
if (multiline) {
|
|
5037
|
+
if (!tryFlushMultiline(multiline.buf)) {
|
|
5038
|
+
drop("multiline_incomplete", multiline.buf);
|
|
5039
|
+
}
|
|
5040
|
+
multiline = null;
|
|
5041
|
+
}
|
|
5042
|
+
const trailing = buffer.trim();
|
|
5043
|
+
if (trailing) {
|
|
5044
|
+
drop("multiline_incomplete", buffer);
|
|
5045
|
+
}
|
|
5046
|
+
} catch (error) {
|
|
5047
|
+
controllerErrored = true;
|
|
5048
|
+
controller.error(error);
|
|
5049
|
+
} finally {
|
|
5050
|
+
reader.releaseLock();
|
|
5051
|
+
if (!controllerErrored) {
|
|
5052
|
+
controller.close();
|
|
5053
|
+
}
|
|
5054
|
+
}
|
|
5055
|
+
}
|
|
5056
|
+
});
|
|
5057
|
+
}
|
|
5058
|
+
|
|
5059
|
+
function isAlive(pid) {
|
|
5060
|
+
try {
|
|
5061
|
+
process.kill(pid, 0);
|
|
5062
|
+
return true;
|
|
5063
|
+
} catch {
|
|
5064
|
+
return false;
|
|
5065
|
+
}
|
|
5066
|
+
}
|
|
5067
|
+
async function resolveDescendantPids(rootPid) {
|
|
5068
|
+
const processes = await psList();
|
|
5069
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
5070
|
+
for (const proc of processes) {
|
|
5071
|
+
if (typeof proc.pid !== "number" || typeof proc.ppid !== "number") {
|
|
5072
|
+
continue;
|
|
5073
|
+
}
|
|
5074
|
+
const children = childrenByParent.get(proc.ppid) ?? [];
|
|
5075
|
+
children.push(proc.pid);
|
|
5076
|
+
childrenByParent.set(proc.ppid, children);
|
|
5077
|
+
}
|
|
5078
|
+
const descendants = [];
|
|
5079
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5080
|
+
const visit = (pid) => {
|
|
5081
|
+
for (const childPid of childrenByParent.get(pid) ?? []) {
|
|
5082
|
+
if (seen.has(childPid)) {
|
|
5083
|
+
continue;
|
|
5084
|
+
}
|
|
5085
|
+
seen.add(childPid);
|
|
5086
|
+
visit(childPid);
|
|
5087
|
+
descendants.push(childPid);
|
|
5088
|
+
}
|
|
5089
|
+
};
|
|
5090
|
+
visit(rootPid);
|
|
5091
|
+
return descendants;
|
|
5092
|
+
}
|
|
5093
|
+
function bestEffortKillPid(pid, signal) {
|
|
5094
|
+
try {
|
|
5095
|
+
process.kill(pid, signal);
|
|
5096
|
+
} catch {
|
|
5097
|
+
}
|
|
5098
|
+
}
|
|
5099
|
+
async function waitForAllGone(pids, timeoutMs) {
|
|
5100
|
+
const start = Date.now();
|
|
5101
|
+
while (Date.now() - start < timeoutMs) {
|
|
5102
|
+
if (pids.every((pid) => !isAlive(pid))) {
|
|
5103
|
+
return;
|
|
5104
|
+
}
|
|
5105
|
+
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
5106
|
+
}
|
|
5107
|
+
}
|
|
5108
|
+
async function killProcessTree(proc, options) {
|
|
5109
|
+
const pid = proc.pid;
|
|
5110
|
+
if (!pid) {
|
|
5111
|
+
return;
|
|
5112
|
+
}
|
|
5113
|
+
const graceMs = Math.max(1, options?.graceMs);
|
|
5114
|
+
const descendants = await resolveDescendantPids(pid).catch(() => []);
|
|
5115
|
+
const allPids = [...descendants, pid];
|
|
5116
|
+
for (const targetPid of allPids) {
|
|
5117
|
+
bestEffortKillPid(targetPid, "SIGTERM");
|
|
5118
|
+
}
|
|
5119
|
+
await waitForAllGone(allPids, graceMs);
|
|
5120
|
+
const remaining = allPids.filter((targetPid) => isAlive(targetPid));
|
|
5121
|
+
if (remaining.length === 0) {
|
|
5122
|
+
return;
|
|
5123
|
+
}
|
|
5124
|
+
for (const targetPid of remaining) {
|
|
5125
|
+
bestEffortKillPid(targetPid, "SIGKILL");
|
|
5126
|
+
}
|
|
5127
|
+
await waitForAllGone(remaining, Math.min(250, graceMs));
|
|
5128
|
+
}
|
|
5129
|
+
|
|
4931
5130
|
const RETRY_CONFIG = {
|
|
4932
5131
|
/** Maximum number of retry attempts for init/newSession */
|
|
4933
5132
|
maxAttempts: 3,
|
|
@@ -5316,24 +5515,13 @@ class AcpBackend {
|
|
|
5316
5515
|
try {
|
|
5317
5516
|
api.logger.debug(`[AcpBackend] Starting session: ${sessionId}`);
|
|
5318
5517
|
this.recentStderrLines = [];
|
|
5319
|
-
const
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
this.
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
windowsHide: true
|
|
5327
|
-
});
|
|
5328
|
-
} else {
|
|
5329
|
-
this.process = node_child_process.spawn(this.options.command, args, {
|
|
5330
|
-
cwd: this.options.cwd,
|
|
5331
|
-
env: { ...process.env, ...this.options.env },
|
|
5332
|
-
// Use 'pipe' for all stdio to capture output without printing to console
|
|
5333
|
-
// stdout and stderr will be handled by our event listeners
|
|
5334
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
5335
|
-
});
|
|
5336
|
-
}
|
|
5518
|
+
const spawnSpec = buildAcpSpawnSpec({
|
|
5519
|
+
command: this.options.command,
|
|
5520
|
+
args: this.options.args ?? [],
|
|
5521
|
+
cwd: this.options.cwd,
|
|
5522
|
+
env: { ...process.env, ...this.options.env }
|
|
5523
|
+
});
|
|
5524
|
+
this.process = spawn(spawnSpec.command, spawnSpec.args, spawnSpec.options);
|
|
5337
5525
|
if (this.process.stderr) {
|
|
5338
5526
|
}
|
|
5339
5527
|
if (!this.process.stdin || !this.process.stdout || !this.process.stderr) {
|
|
@@ -5381,57 +5569,20 @@ class AcpBackend {
|
|
|
5381
5569
|
);
|
|
5382
5570
|
const writable = streams.writable;
|
|
5383
5571
|
const readable = streams.readable;
|
|
5384
|
-
const
|
|
5385
|
-
const filteredReadable =
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
let buffer = "";
|
|
5391
|
-
let filteredCount = 0;
|
|
5392
|
-
try {
|
|
5393
|
-
while (true) {
|
|
5394
|
-
const { done, value } = await reader.read();
|
|
5395
|
-
if (done) {
|
|
5396
|
-
if (buffer.trim()) {
|
|
5397
|
-
const filtered = transport.filterStdoutLine?.(buffer);
|
|
5398
|
-
if (filtered === void 0) {
|
|
5399
|
-
controller.enqueue(encoder.encode(buffer));
|
|
5400
|
-
} else if (filtered !== null) {
|
|
5401
|
-
controller.enqueue(encoder.encode(filtered));
|
|
5402
|
-
} else {
|
|
5403
|
-
filteredCount++;
|
|
5404
|
-
}
|
|
5405
|
-
}
|
|
5406
|
-
if (filteredCount > 0) {
|
|
5407
|
-
api.logger.debug(`[AcpBackend] Filtered out ${filteredCount} non-JSON lines from ${transport.agentName} stdout`);
|
|
5408
|
-
}
|
|
5409
|
-
controller.close();
|
|
5410
|
-
break;
|
|
5411
|
-
}
|
|
5412
|
-
buffer += decoder.decode(value, { stream: true });
|
|
5413
|
-
const lines = buffer.split("\n");
|
|
5414
|
-
buffer = lines.pop() || "";
|
|
5415
|
-
for (const line of lines) {
|
|
5416
|
-
if (!line.trim()) continue;
|
|
5417
|
-
const filtered = transport.filterStdoutLine?.(line);
|
|
5418
|
-
if (filtered === void 0) {
|
|
5419
|
-
controller.enqueue(encoder.encode(line + "\n"));
|
|
5420
|
-
} else if (filtered !== null) {
|
|
5421
|
-
controller.enqueue(encoder.encode(filtered + "\n"));
|
|
5422
|
-
} else {
|
|
5423
|
-
filteredCount++;
|
|
5424
|
-
}
|
|
5425
|
-
}
|
|
5426
|
-
}
|
|
5427
|
-
} catch (error) {
|
|
5428
|
-
api.logger.debug(`[AcpBackend] Error filtering stdout stream:`, error);
|
|
5429
|
-
controller.error(error);
|
|
5430
|
-
} finally {
|
|
5431
|
-
reader.releaseLock();
|
|
5432
|
-
}
|
|
5572
|
+
const droppedStdoutLines = [];
|
|
5573
|
+
const filteredReadable = createAcpFilteredStdoutReadable({
|
|
5574
|
+
readable,
|
|
5575
|
+
transport: this.transport,
|
|
5576
|
+
onDroppedLine: (entry) => {
|
|
5577
|
+
droppedStdoutLines.push(entry);
|
|
5433
5578
|
}
|
|
5434
5579
|
});
|
|
5580
|
+
if (droppedStdoutLines.length > 0) {
|
|
5581
|
+
api.logger.debug(
|
|
5582
|
+
`[AcpBackend] Filtered out ${droppedStdoutLines.length} stdout lines from ${this.transport.agentName}`,
|
|
5583
|
+
droppedStdoutLines.slice(0, 5)
|
|
5584
|
+
);
|
|
5585
|
+
}
|
|
5435
5586
|
const stream = sdk.ndJsonStream(writable, filteredReadable);
|
|
5436
5587
|
const client = {
|
|
5437
5588
|
sessionUpdate: async (params) => {
|
|
@@ -5959,21 +6110,13 @@ class AcpBackend {
|
|
|
5959
6110
|
}
|
|
5960
6111
|
}
|
|
5961
6112
|
if (this.process) {
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
resolve();
|
|
5970
|
-
}, 1e3);
|
|
5971
|
-
this.process?.once("exit", () => {
|
|
5972
|
-
clearTimeout(timeout);
|
|
5973
|
-
resolve();
|
|
5974
|
-
});
|
|
5975
|
-
});
|
|
5976
|
-
this.process = null;
|
|
6113
|
+
try {
|
|
6114
|
+
await killProcessTree(this.process, { graceMs: 1e3 });
|
|
6115
|
+
} catch (error) {
|
|
6116
|
+
api.logger.debug("[AcpBackend] Failed to kill ACP process tree:", error);
|
|
6117
|
+
} finally {
|
|
6118
|
+
this.process = null;
|
|
6119
|
+
}
|
|
5977
6120
|
}
|
|
5978
6121
|
this.clearIdleTimeoutState();
|
|
5979
6122
|
this.listeners = [];
|
|
@@ -6417,7 +6560,6 @@ function createCodexBackend(options) {
|
|
|
6417
6560
|
...options.env,
|
|
6418
6561
|
NODE_ENV: "production"
|
|
6419
6562
|
},
|
|
6420
|
-
mcpServers: options.mcpServers,
|
|
6421
6563
|
permissionHandler: options.permissionHandler,
|
|
6422
6564
|
selectionHandler: options.selectionHandler,
|
|
6423
6565
|
transportHandler: resolveCodexTransport(spawn.command)
|
|
@@ -6625,12 +6767,12 @@ async function ensureUnifiedDaemonStarted() {
|
|
|
6625
6767
|
async function executeUnifiedProvider(opts) {
|
|
6626
6768
|
const credentials = await ensureUnifiedRuntimePrerequisites(opts.credentials);
|
|
6627
6769
|
if (opts.provider === "claude") {
|
|
6628
|
-
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-
|
|
6770
|
+
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-CZmJ7qEP.cjs'); });
|
|
6629
6771
|
await runClaude(credentials, opts.claudeOptions ?? {});
|
|
6630
6772
|
return;
|
|
6631
6773
|
}
|
|
6632
6774
|
if (opts.provider === "codex") {
|
|
6633
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
6775
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CtncAgso.cjs'); });
|
|
6634
6776
|
await runCodex({
|
|
6635
6777
|
credentials,
|
|
6636
6778
|
startedBy: opts.startedBy,
|
|
@@ -6640,7 +6782,7 @@ async function executeUnifiedProvider(opts) {
|
|
|
6640
6782
|
return;
|
|
6641
6783
|
}
|
|
6642
6784
|
if (opts.provider === "gemini") {
|
|
6643
|
-
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-
|
|
6785
|
+
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-ChwjLmhI.cjs'); });
|
|
6644
6786
|
await runGemini({
|
|
6645
6787
|
credentials,
|
|
6646
6788
|
startedBy: opts.startedBy
|
|
@@ -6682,7 +6824,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6682
6824
|
return;
|
|
6683
6825
|
} else if (subcommand === "runtime") {
|
|
6684
6826
|
if (args[1] === "providers") {
|
|
6685
|
-
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-
|
|
6827
|
+
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-DiAVIsxX.cjs'); });
|
|
6686
6828
|
console.log(renderRuntimeProviders());
|
|
6687
6829
|
return;
|
|
6688
6830
|
}
|
|
@@ -6860,8 +7002,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6860
7002
|
const projectId = args[3];
|
|
6861
7003
|
try {
|
|
6862
7004
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
6863
|
-
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-
|
|
6864
|
-
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-
|
|
7005
|
+
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-hbhwAYIV.cjs'); });
|
|
7006
|
+
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-Dwkm7s_E.cjs'); }).then(function (n) { return n.api; });
|
|
6865
7007
|
let userEmail = void 0;
|
|
6866
7008
|
try {
|
|
6867
7009
|
const credentials = await readCredentials2();
|