@kiki_agent/daemon 0.1.0 → 0.1.1
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/cli.cjs +402 -83
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -38459,7 +38459,7 @@ var require_readdir_glob = __commonJS({
|
|
|
38459
38459
|
});
|
|
38460
38460
|
});
|
|
38461
38461
|
}
|
|
38462
|
-
function
|
|
38462
|
+
function stat2(file, followSymlinks) {
|
|
38463
38463
|
return new Promise((resolve2, reject) => {
|
|
38464
38464
|
const statFunc = followSymlinks ? fs14.stat : fs14.lstat;
|
|
38465
38465
|
statFunc(file, (err, stats) => {
|
|
@@ -38467,7 +38467,7 @@ var require_readdir_glob = __commonJS({
|
|
|
38467
38467
|
switch (err.code) {
|
|
38468
38468
|
case "ENOENT":
|
|
38469
38469
|
if (followSymlinks) {
|
|
38470
|
-
resolve2(
|
|
38470
|
+
resolve2(stat2(file, false));
|
|
38471
38471
|
} else {
|
|
38472
38472
|
resolve2(null);
|
|
38473
38473
|
}
|
|
@@ -38495,7 +38495,7 @@ var require_readdir_glob = __commonJS({
|
|
|
38495
38495
|
const absolute = path12 + "/" + relative;
|
|
38496
38496
|
let stats = null;
|
|
38497
38497
|
if (useStat || followSymlinks) {
|
|
38498
|
-
stats = await
|
|
38498
|
+
stats = await stat2(absolute, followSymlinks);
|
|
38499
38499
|
}
|
|
38500
38500
|
if (!stats && file.name !== void 0) {
|
|
38501
38501
|
stats = file;
|
|
@@ -42562,15 +42562,15 @@ var require_old = __commonJS({
|
|
|
42562
42562
|
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
42563
42563
|
resolvedLink = cache[base];
|
|
42564
42564
|
} else {
|
|
42565
|
-
var
|
|
42566
|
-
if (!
|
|
42565
|
+
var stat2 = fs14.lstatSync(base);
|
|
42566
|
+
if (!stat2.isSymbolicLink()) {
|
|
42567
42567
|
knownHard[base] = true;
|
|
42568
42568
|
if (cache) cache[base] = base;
|
|
42569
42569
|
continue;
|
|
42570
42570
|
}
|
|
42571
42571
|
var linkTarget = null;
|
|
42572
42572
|
if (!isWindows) {
|
|
42573
|
-
var id =
|
|
42573
|
+
var id = stat2.dev.toString(32) + ":" + stat2.ino.toString(32);
|
|
42574
42574
|
if (seenLinks.hasOwnProperty(id)) {
|
|
42575
42575
|
linkTarget = seenLinks[id];
|
|
42576
42576
|
}
|
|
@@ -42639,15 +42639,15 @@ var require_old = __commonJS({
|
|
|
42639
42639
|
}
|
|
42640
42640
|
return fs14.lstat(base, gotStat);
|
|
42641
42641
|
}
|
|
42642
|
-
function gotStat(err,
|
|
42642
|
+
function gotStat(err, stat2) {
|
|
42643
42643
|
if (err) return cb(err);
|
|
42644
|
-
if (!
|
|
42644
|
+
if (!stat2.isSymbolicLink()) {
|
|
42645
42645
|
knownHard[base] = true;
|
|
42646
42646
|
if (cache) cache[base] = base;
|
|
42647
42647
|
return process.nextTick(LOOP);
|
|
42648
42648
|
}
|
|
42649
42649
|
if (!isWindows) {
|
|
42650
|
-
var id =
|
|
42650
|
+
var id = stat2.dev.toString(32) + ":" + stat2.ino.toString(32);
|
|
42651
42651
|
if (seenLinks.hasOwnProperty(id)) {
|
|
42652
42652
|
return gotTarget(null, seenLinks[id], base);
|
|
42653
42653
|
}
|
|
@@ -43970,7 +43970,7 @@ var require_sync = __commonJS({
|
|
|
43970
43970
|
return this._readdir(abs, false);
|
|
43971
43971
|
var entries;
|
|
43972
43972
|
var lstat;
|
|
43973
|
-
var
|
|
43973
|
+
var stat2;
|
|
43974
43974
|
try {
|
|
43975
43975
|
lstat = this.fs.lstatSync(abs);
|
|
43976
43976
|
} catch (er) {
|
|
@@ -44105,8 +44105,8 @@ var require_sync = __commonJS({
|
|
|
44105
44105
|
return false;
|
|
44106
44106
|
}
|
|
44107
44107
|
var exists;
|
|
44108
|
-
var
|
|
44109
|
-
if (!
|
|
44108
|
+
var stat2 = this.statCache[abs];
|
|
44109
|
+
if (!stat2) {
|
|
44110
44110
|
var lstat;
|
|
44111
44111
|
try {
|
|
44112
44112
|
lstat = this.fs.lstatSync(abs);
|
|
@@ -44118,18 +44118,18 @@ var require_sync = __commonJS({
|
|
|
44118
44118
|
}
|
|
44119
44119
|
if (lstat && lstat.isSymbolicLink()) {
|
|
44120
44120
|
try {
|
|
44121
|
-
|
|
44121
|
+
stat2 = this.fs.statSync(abs);
|
|
44122
44122
|
} catch (er) {
|
|
44123
|
-
|
|
44123
|
+
stat2 = lstat;
|
|
44124
44124
|
}
|
|
44125
44125
|
} else {
|
|
44126
|
-
|
|
44126
|
+
stat2 = lstat;
|
|
44127
44127
|
}
|
|
44128
44128
|
}
|
|
44129
|
-
this.statCache[abs] =
|
|
44129
|
+
this.statCache[abs] = stat2;
|
|
44130
44130
|
var c = true;
|
|
44131
|
-
if (
|
|
44132
|
-
c =
|
|
44131
|
+
if (stat2)
|
|
44132
|
+
c = stat2.isDirectory() ? "DIR" : "FILE";
|
|
44133
44133
|
this.cache[abs] = this.cache[abs] || c;
|
|
44134
44134
|
if (needDir && c === "FILE")
|
|
44135
44135
|
return false;
|
|
@@ -44775,16 +44775,16 @@ var require_glob = __commonJS({
|
|
|
44775
44775
|
return cb();
|
|
44776
44776
|
}
|
|
44777
44777
|
var exists;
|
|
44778
|
-
var
|
|
44779
|
-
if (
|
|
44780
|
-
if (
|
|
44781
|
-
return cb(null,
|
|
44778
|
+
var stat2 = this.statCache[abs];
|
|
44779
|
+
if (stat2 !== void 0) {
|
|
44780
|
+
if (stat2 === false)
|
|
44781
|
+
return cb(null, stat2);
|
|
44782
44782
|
else {
|
|
44783
|
-
var type =
|
|
44783
|
+
var type = stat2.isDirectory() ? "DIR" : "FILE";
|
|
44784
44784
|
if (needDir && type === "FILE")
|
|
44785
44785
|
return cb();
|
|
44786
44786
|
else
|
|
44787
|
-
return cb(null, type,
|
|
44787
|
+
return cb(null, type, stat2);
|
|
44788
44788
|
}
|
|
44789
44789
|
}
|
|
44790
44790
|
var self2 = this;
|
|
@@ -44793,33 +44793,33 @@ var require_glob = __commonJS({
|
|
|
44793
44793
|
self2.fs.lstat(abs, statcb);
|
|
44794
44794
|
function lstatcb_(er, lstat) {
|
|
44795
44795
|
if (lstat && lstat.isSymbolicLink()) {
|
|
44796
|
-
return self2.fs.stat(abs, function(er2,
|
|
44796
|
+
return self2.fs.stat(abs, function(er2, stat3) {
|
|
44797
44797
|
if (er2)
|
|
44798
44798
|
self2._stat2(f, abs, null, lstat, cb);
|
|
44799
44799
|
else
|
|
44800
|
-
self2._stat2(f, abs, er2,
|
|
44800
|
+
self2._stat2(f, abs, er2, stat3, cb);
|
|
44801
44801
|
});
|
|
44802
44802
|
} else {
|
|
44803
44803
|
self2._stat2(f, abs, er, lstat, cb);
|
|
44804
44804
|
}
|
|
44805
44805
|
}
|
|
44806
44806
|
};
|
|
44807
|
-
Glob.prototype._stat2 = function(f, abs, er,
|
|
44807
|
+
Glob.prototype._stat2 = function(f, abs, er, stat2, cb) {
|
|
44808
44808
|
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
|
|
44809
44809
|
this.statCache[abs] = false;
|
|
44810
44810
|
return cb();
|
|
44811
44811
|
}
|
|
44812
44812
|
var needDir = f.slice(-1) === "/";
|
|
44813
|
-
this.statCache[abs] =
|
|
44814
|
-
if (abs.slice(-1) === "/" &&
|
|
44815
|
-
return cb(null, false,
|
|
44813
|
+
this.statCache[abs] = stat2;
|
|
44814
|
+
if (abs.slice(-1) === "/" && stat2 && !stat2.isDirectory())
|
|
44815
|
+
return cb(null, false, stat2);
|
|
44816
44816
|
var c = true;
|
|
44817
|
-
if (
|
|
44818
|
-
c =
|
|
44817
|
+
if (stat2)
|
|
44818
|
+
c = stat2.isDirectory() ? "DIR" : "FILE";
|
|
44819
44819
|
this.cache[abs] = this.cache[abs] || c;
|
|
44820
44820
|
if (needDir && c === "FILE")
|
|
44821
44821
|
return cb();
|
|
44822
|
-
return cb(null, c,
|
|
44822
|
+
return cb(null, c, stat2);
|
|
44823
44823
|
};
|
|
44824
44824
|
}
|
|
44825
44825
|
});
|
|
@@ -54662,7 +54662,7 @@ var require_promisify = __commonJS({
|
|
|
54662
54662
|
util.toFastProperties(obj2);
|
|
54663
54663
|
return obj2;
|
|
54664
54664
|
}
|
|
54665
|
-
function
|
|
54665
|
+
function promisify4(callback, receiver, multiArgs) {
|
|
54666
54666
|
return makeNodePromisified(
|
|
54667
54667
|
callback,
|
|
54668
54668
|
receiver,
|
|
@@ -54682,7 +54682,7 @@ var require_promisify = __commonJS({
|
|
|
54682
54682
|
options = Object(options);
|
|
54683
54683
|
var receiver = options.context === void 0 ? THIS : options.context;
|
|
54684
54684
|
var multiArgs = !!options.multiArgs;
|
|
54685
|
-
var ret2 =
|
|
54685
|
+
var ret2 = promisify4(fn, receiver, multiArgs);
|
|
54686
54686
|
util.copyDescriptors(fn, ret2, propsFilter);
|
|
54687
54687
|
return ret2;
|
|
54688
54688
|
};
|
|
@@ -56734,17 +56734,17 @@ var require_dir_reader = __commonJS({
|
|
|
56734
56734
|
assert(p !== self2._path);
|
|
56735
56735
|
assert(self2.entries[self2._index]);
|
|
56736
56736
|
self2._currentEntry = p;
|
|
56737
|
-
fs14[self2.props.follow ? "stat" : "lstat"](p, function(er,
|
|
56737
|
+
fs14[self2.props.follow ? "stat" : "lstat"](p, function(er, stat2) {
|
|
56738
56738
|
if (er) return self2.error(er);
|
|
56739
56739
|
var who = self2._proxy || self2;
|
|
56740
|
-
|
|
56741
|
-
|
|
56742
|
-
|
|
56743
|
-
var childProps = self2.getChildProps.call(who,
|
|
56740
|
+
stat2.path = p;
|
|
56741
|
+
stat2.basename = path12.basename(p);
|
|
56742
|
+
stat2.dirname = path12.dirname(p);
|
|
56743
|
+
var childProps = self2.getChildProps.call(who, stat2);
|
|
56744
56744
|
childProps.path = p;
|
|
56745
56745
|
childProps.basename = path12.basename(p);
|
|
56746
56746
|
childProps.dirname = path12.dirname(p);
|
|
56747
|
-
var entry = Reader(childProps,
|
|
56747
|
+
var entry = Reader(childProps, stat2);
|
|
56748
56748
|
self2._currentEntry = entry;
|
|
56749
56749
|
entry.on("pause", function(who2) {
|
|
56750
56750
|
if (!self2._paused && !entry._disowned) {
|
|
@@ -57020,8 +57020,8 @@ var require_proxy_reader = __commonJS({
|
|
|
57020
57020
|
ProxyReader.prototype._stat = function() {
|
|
57021
57021
|
var self2 = this;
|
|
57022
57022
|
var props = self2.props;
|
|
57023
|
-
var
|
|
57024
|
-
fs14[
|
|
57023
|
+
var stat2 = props.follow ? "stat" : "lstat";
|
|
57024
|
+
fs14[stat2](props.path, function(er, current) {
|
|
57025
57025
|
var type;
|
|
57026
57026
|
if (er || !current) {
|
|
57027
57027
|
type = "File";
|
|
@@ -57171,9 +57171,9 @@ var require_reader = __commonJS({
|
|
|
57171
57171
|
Reader.prototype._stat = function(currentStat) {
|
|
57172
57172
|
var self2 = this;
|
|
57173
57173
|
var props = self2.props;
|
|
57174
|
-
var
|
|
57174
|
+
var stat2 = props.follow ? "stat" : "lstat";
|
|
57175
57175
|
if (currentStat) process.nextTick(statCb.bind(null, null, currentStat));
|
|
57176
|
-
else fs14[
|
|
57176
|
+
else fs14[stat2](self2._path, statCb);
|
|
57177
57177
|
function statCb(er, props_) {
|
|
57178
57178
|
if (er) return self2.error(er);
|
|
57179
57179
|
Object.keys(props_).forEach(function(k2) {
|
|
@@ -57324,7 +57324,7 @@ var require_rimraf = __commonJS({
|
|
|
57324
57324
|
var n = 0;
|
|
57325
57325
|
if (options.disableGlob || !glob.hasMagic(p))
|
|
57326
57326
|
return afterGlob(null, [p]);
|
|
57327
|
-
options.lstat(p, function(er,
|
|
57327
|
+
options.lstat(p, function(er, stat2) {
|
|
57328
57328
|
if (!er)
|
|
57329
57329
|
return afterGlob(null, [p]);
|
|
57330
57330
|
glob(p, options.glob, afterGlob);
|
|
@@ -57598,8 +57598,8 @@ var require_mkdirp = __commonJS({
|
|
|
57598
57598
|
// there already. If so, then hooray! If not, then something
|
|
57599
57599
|
// is borked.
|
|
57600
57600
|
default:
|
|
57601
|
-
xfs.stat(p, function(er2,
|
|
57602
|
-
if (er2 || !
|
|
57601
|
+
xfs.stat(p, function(er2, stat2) {
|
|
57602
|
+
if (er2 || !stat2.isDirectory()) cb(er, made);
|
|
57603
57603
|
else cb(null, made);
|
|
57604
57604
|
});
|
|
57605
57605
|
break;
|
|
@@ -57630,13 +57630,13 @@ var require_mkdirp = __commonJS({
|
|
|
57630
57630
|
// there already. If so, then hooray! If not, then something
|
|
57631
57631
|
// is borked.
|
|
57632
57632
|
default:
|
|
57633
|
-
var
|
|
57633
|
+
var stat2;
|
|
57634
57634
|
try {
|
|
57635
|
-
|
|
57635
|
+
stat2 = xfs.statSync(p);
|
|
57636
57636
|
} catch (err1) {
|
|
57637
57637
|
throw err0;
|
|
57638
57638
|
}
|
|
57639
|
-
if (!
|
|
57639
|
+
if (!stat2.isDirectory()) throw err0;
|
|
57640
57640
|
break;
|
|
57641
57641
|
}
|
|
57642
57642
|
}
|
|
@@ -58001,8 +58001,8 @@ var require_proxy_writer = __commonJS({
|
|
|
58001
58001
|
ProxyWriter.prototype._stat = function() {
|
|
58002
58002
|
var self2 = this;
|
|
58003
58003
|
var props = self2.props;
|
|
58004
|
-
var
|
|
58005
|
-
fs14[
|
|
58004
|
+
var stat2 = props.follow ? "stat" : "lstat";
|
|
58005
|
+
fs14[stat2](props.path, function(er, current) {
|
|
58006
58006
|
var type;
|
|
58007
58007
|
if (er || !current) {
|
|
58008
58008
|
type = "File";
|
|
@@ -58153,10 +58153,10 @@ var require_writer = __commonJS({
|
|
|
58153
58153
|
Writer.prototype._stat = function(current) {
|
|
58154
58154
|
var self2 = this;
|
|
58155
58155
|
var props = self2.props;
|
|
58156
|
-
var
|
|
58156
|
+
var stat2 = props.follow ? "stat" : "lstat";
|
|
58157
58157
|
var who = self2._proxy || self2;
|
|
58158
58158
|
if (current) statCb(null, current);
|
|
58159
|
-
else fs14[
|
|
58159
|
+
else fs14[stat2](self2._path, statCb);
|
|
58160
58160
|
function statCb(er, current2) {
|
|
58161
58161
|
if (self2.filter && !self2.filter.call(who, who, current2)) {
|
|
58162
58162
|
self2._aborted = true;
|
|
@@ -58237,8 +58237,8 @@ var require_writer = __commonJS({
|
|
|
58237
58237
|
self2._old.mtime = /* @__PURE__ */ new Date(0);
|
|
58238
58238
|
setProps(self2._old);
|
|
58239
58239
|
} else {
|
|
58240
|
-
var
|
|
58241
|
-
fs14[
|
|
58240
|
+
var stat2 = self2.props.follow ? "stat" : "lstat";
|
|
58241
|
+
fs14[stat2](self2._path, function(er, current) {
|
|
58242
58242
|
if (er) {
|
|
58243
58243
|
if (er.code === "ENOENT" && (self2.type === "Link" || self2.type === "SymbolicLink") && process.platform === "win32") {
|
|
58244
58244
|
self2.ready = true;
|
|
@@ -60069,15 +60069,15 @@ var require_tmp = __commonJS({
|
|
|
60069
60069
|
"../../node_modules/.pnpm/tmp@0.2.6/node_modules/tmp/lib/tmp.js"(exports2, module2) {
|
|
60070
60070
|
"use strict";
|
|
60071
60071
|
var fs14 = require("fs");
|
|
60072
|
-
var
|
|
60072
|
+
var os4 = require("os");
|
|
60073
60073
|
var path12 = require("path");
|
|
60074
60074
|
var crypto4 = require("crypto");
|
|
60075
|
-
var _c = { fs: fs14.constants, os:
|
|
60075
|
+
var _c = { fs: fs14.constants, os: os4.constants };
|
|
60076
60076
|
var RANDOM_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
60077
60077
|
var TEMPLATE_PATTERN = /XXXXXX/;
|
|
60078
60078
|
var DEFAULT_TRIES = 3;
|
|
60079
60079
|
var CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR);
|
|
60080
|
-
var IS_WIN32 =
|
|
60080
|
+
var IS_WIN32 = os4.platform() === "win32";
|
|
60081
60081
|
var EBADF = _c.EBADF || _c.os.errno.EBADF;
|
|
60082
60082
|
var ENOENT = _c.ENOENT || _c.os.errno.ENOENT;
|
|
60083
60083
|
var DIR_MODE = 448;
|
|
@@ -60408,10 +60408,10 @@ var require_tmp = __commonJS({
|
|
|
60408
60408
|
_gracefulCleanup = true;
|
|
60409
60409
|
}
|
|
60410
60410
|
function _getTmpDir(options, cb) {
|
|
60411
|
-
return fs14.realpath(options && options.tmpdir ||
|
|
60411
|
+
return fs14.realpath(options && options.tmpdir || os4.tmpdir(), cb);
|
|
60412
60412
|
}
|
|
60413
60413
|
function _getTmpDirSync(options) {
|
|
60414
|
-
return fs14.realpathSync(options && options.tmpdir ||
|
|
60414
|
+
return fs14.realpathSync(options && options.tmpdir || os4.tmpdir());
|
|
60415
60415
|
}
|
|
60416
60416
|
process.addListener(EXIT, _garbageCollector);
|
|
60417
60417
|
Object.defineProperty(module2.exports, "tmpdir", {
|
|
@@ -61239,6 +61239,9 @@ var require_excel = __commonJS({
|
|
|
61239
61239
|
// src/cli.ts
|
|
61240
61240
|
var import_path10 = __toESM(require("path"));
|
|
61241
61241
|
|
|
61242
|
+
// ../../src/lib/daemon/remoteDaemonLoop.ts
|
|
61243
|
+
var import_os2 = __toESM(require("os"));
|
|
61244
|
+
|
|
61242
61245
|
// ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/wrapper.mjs
|
|
61243
61246
|
var import_stream = __toESM(require_stream(), 1);
|
|
61244
61247
|
var import_extension = __toESM(require_extension(), 1);
|
|
@@ -63466,6 +63469,98 @@ function buildToolArgs(policy) {
|
|
|
63466
63469
|
}
|
|
63467
63470
|
return args;
|
|
63468
63471
|
}
|
|
63472
|
+
async function runPromptJson(input) {
|
|
63473
|
+
assertServerLocalCliAllowed();
|
|
63474
|
+
const cwd = normalizeWorkingDirectory(input.cwd);
|
|
63475
|
+
const cliPath = await resolveCliPath(input.runtimeEnv.cliPath);
|
|
63476
|
+
const startedAt = Date.now();
|
|
63477
|
+
const resolvedToolPolicy = resolveRuntimeToolPolicy({
|
|
63478
|
+
filePolicy: input.filePolicy ?? input.runtimeEnv.filePolicy,
|
|
63479
|
+
permissionMode: input.permissionMode ?? input.runtimeEnv.permissionMode,
|
|
63480
|
+
channelPolicy: input.channelPolicy ?? {
|
|
63481
|
+
mode: "readonly_json",
|
|
63482
|
+
...input.toolPolicy?.mode === "readonly_only" ? { allow: input.toolPolicy.allow } : {}
|
|
63483
|
+
}
|
|
63484
|
+
});
|
|
63485
|
+
const args = [
|
|
63486
|
+
"-p",
|
|
63487
|
+
"--output-format",
|
|
63488
|
+
"json",
|
|
63489
|
+
"--permission-mode",
|
|
63490
|
+
mapPermissionMode(input.permissionMode ?? input.runtimeEnv.permissionMode),
|
|
63491
|
+
...buildToolArgs(resolvedToolPolicy)
|
|
63492
|
+
];
|
|
63493
|
+
const trace = createClaudeTrace({
|
|
63494
|
+
cwd,
|
|
63495
|
+
cliPath,
|
|
63496
|
+
args,
|
|
63497
|
+
permissionMode: input.permissionMode ?? input.runtimeEnv.permissionMode,
|
|
63498
|
+
toolPolicy: resolvedToolPolicy,
|
|
63499
|
+
requestId: input.traceContext?.requestId,
|
|
63500
|
+
scope: input.traceContext?.scope ?? "claude_json",
|
|
63501
|
+
phase: input.traceContext?.phase,
|
|
63502
|
+
stepLabel: input.traceContext?.stepLabel
|
|
63503
|
+
});
|
|
63504
|
+
trace?.writePrompt(input.prompt);
|
|
63505
|
+
return new Promise((resolve, reject) => {
|
|
63506
|
+
const child = (0, import_child_process2.spawn)(cliPath, args, {
|
|
63507
|
+
cwd,
|
|
63508
|
+
env: buildClaudeEnv(),
|
|
63509
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
63510
|
+
detached: true
|
|
63511
|
+
});
|
|
63512
|
+
child.stdin.write(input.prompt);
|
|
63513
|
+
child.stdin.end();
|
|
63514
|
+
let output = "";
|
|
63515
|
+
let errorOutput = "";
|
|
63516
|
+
let aborted = false;
|
|
63517
|
+
const abort = () => {
|
|
63518
|
+
aborted = true;
|
|
63519
|
+
killChildTree(child);
|
|
63520
|
+
trace?.finish("aborted", input.abortMessage ?? "Claude CLI \u8C03\u7528\u5DF2\u4E2D\u65AD");
|
|
63521
|
+
reject(new DOMException(input.abortMessage ?? "Claude CLI \u8C03\u7528\u5DF2\u4E2D\u65AD", "AbortError"));
|
|
63522
|
+
};
|
|
63523
|
+
if (input.abortSignal?.aborted) {
|
|
63524
|
+
abort();
|
|
63525
|
+
return;
|
|
63526
|
+
}
|
|
63527
|
+
input.abortSignal?.addEventListener("abort", abort, { once: true });
|
|
63528
|
+
child.stdout.on("data", (chunk) => {
|
|
63529
|
+
const text2 = chunk.toString("utf8");
|
|
63530
|
+
output += text2;
|
|
63531
|
+
trace?.appendStdout(text2);
|
|
63532
|
+
});
|
|
63533
|
+
child.stderr.on("data", (chunk) => {
|
|
63534
|
+
const text2 = chunk.toString("utf8");
|
|
63535
|
+
errorOutput += text2;
|
|
63536
|
+
trace?.appendStderr(text2);
|
|
63537
|
+
});
|
|
63538
|
+
child.on("error", (error) => {
|
|
63539
|
+
input.abortSignal?.removeEventListener("abort", abort);
|
|
63540
|
+
trace?.finish("failed", error.message);
|
|
63541
|
+
reject(error);
|
|
63542
|
+
});
|
|
63543
|
+
child.on("close", (code) => {
|
|
63544
|
+
input.abortSignal?.removeEventListener("abort", abort);
|
|
63545
|
+
if (aborted) return;
|
|
63546
|
+
const exitCode = code ?? 0;
|
|
63547
|
+
if (exitCode !== 0) {
|
|
63548
|
+
trace?.finish("failed", errorOutput.trim() || input.failureMessage || "Claude CLI JSON \u8C03\u7528\u5931\u8D25");
|
|
63549
|
+
reject(new Error(errorOutput.trim() || input.failureMessage || "Claude CLI JSON \u8C03\u7528\u5931\u8D25"));
|
|
63550
|
+
return;
|
|
63551
|
+
}
|
|
63552
|
+
const parsedOutput = extractClaudeOutputText(output);
|
|
63553
|
+
if (parsedOutput) trace?.writeOutput(parsedOutput);
|
|
63554
|
+
trace?.finish("completed");
|
|
63555
|
+
resolve({
|
|
63556
|
+
raw: output,
|
|
63557
|
+
exitCode,
|
|
63558
|
+
stderr: errorOutput.trim(),
|
|
63559
|
+
elapsedMs: Date.now() - startedAt
|
|
63560
|
+
});
|
|
63561
|
+
});
|
|
63562
|
+
});
|
|
63563
|
+
}
|
|
63469
63564
|
function mapPermissionMode(permissionMode) {
|
|
63470
63565
|
switch (permissionMode) {
|
|
63471
63566
|
case "execute":
|
|
@@ -63573,6 +63668,16 @@ function parseToolInput(rawInput, partialJson) {
|
|
|
63573
63668
|
return rawInput;
|
|
63574
63669
|
}
|
|
63575
63670
|
}
|
|
63671
|
+
function extractClaudeOutputText(raw) {
|
|
63672
|
+
try {
|
|
63673
|
+
const parsed = JSON.parse(raw.trim());
|
|
63674
|
+
if (typeof parsed.result === "string") return parsed.result;
|
|
63675
|
+
const content = parsed.message?.content?.map((item) => item.text || item.thinking || "").join("");
|
|
63676
|
+
return content?.trim() || "";
|
|
63677
|
+
} catch {
|
|
63678
|
+
return raw.trim();
|
|
63679
|
+
}
|
|
63680
|
+
}
|
|
63576
63681
|
function extractAssistantTraceText(payload) {
|
|
63577
63682
|
const pieces = payload.message?.content?.map((item) => item.thinking || item.text || "").filter(Boolean);
|
|
63578
63683
|
return pieces?.join("\n") ?? "";
|
|
@@ -66562,7 +66667,7 @@ function persistFileArtifact(input) {
|
|
|
66562
66667
|
} else {
|
|
66563
66668
|
import_fs10.default.writeFileSync(filePath, input.bytes);
|
|
66564
66669
|
}
|
|
66565
|
-
const
|
|
66670
|
+
const stat2 = import_fs10.default.statSync(filePath);
|
|
66566
66671
|
const artifact = {
|
|
66567
66672
|
id: artifactId,
|
|
66568
66673
|
conversationId: input.conversationId,
|
|
@@ -66574,7 +66679,7 @@ function persistFileArtifact(input) {
|
|
|
66574
66679
|
kind: "file",
|
|
66575
66680
|
storageRelPath: import_path7.default.relative(workspace.workspaceDir, filePath),
|
|
66576
66681
|
mime: input.mime,
|
|
66577
|
-
size:
|
|
66682
|
+
size: stat2.size,
|
|
66578
66683
|
createdAt: nowIso6()
|
|
66579
66684
|
};
|
|
66580
66685
|
upsertArtifact(artifact);
|
|
@@ -71444,6 +71549,169 @@ async function runGoalTask(input) {
|
|
|
71444
71549
|
}
|
|
71445
71550
|
}
|
|
71446
71551
|
|
|
71552
|
+
// ../../src/lib/server/runtimeEnvValidation.ts
|
|
71553
|
+
var import_promises2 = require("fs/promises");
|
|
71554
|
+
var import_child_process3 = require("child_process");
|
|
71555
|
+
var import_util2 = require("util");
|
|
71556
|
+
var execFileAsync2 = (0, import_util2.promisify)(import_child_process3.execFile);
|
|
71557
|
+
var runtimeDefinitions = {
|
|
71558
|
+
claude: {
|
|
71559
|
+
label: "Claude CLI",
|
|
71560
|
+
command: "claude",
|
|
71561
|
+
versionArgs: ["--version"],
|
|
71562
|
+
installHint: "\u5B89\u88C5 Claude Code \u540E\u786E\u4FDD `claude` \u547D\u4EE4\u5728 PATH \u4E2D\u53EF\u7528\u3002"
|
|
71563
|
+
},
|
|
71564
|
+
codex: {
|
|
71565
|
+
label: "Codex CLI",
|
|
71566
|
+
command: "codex",
|
|
71567
|
+
versionArgs: ["--version"],
|
|
71568
|
+
installHint: "\u5B89\u88C5 Codex CLI \u540E\u786E\u4FDD `codex` \u547D\u4EE4\u5728 PATH \u4E2D\u53EF\u7528\u3002"
|
|
71569
|
+
},
|
|
71570
|
+
gemini: {
|
|
71571
|
+
label: "Gemini CLI",
|
|
71572
|
+
command: "gemini",
|
|
71573
|
+
versionArgs: ["--version"],
|
|
71574
|
+
installHint: "\u5B89\u88C5 Gemini CLI \u540E\u786E\u4FDD `gemini` \u547D\u4EE4\u5728 PATH \u4E2D\u53EF\u7528\u3002"
|
|
71575
|
+
}
|
|
71576
|
+
};
|
|
71577
|
+
async function pathExists(path12) {
|
|
71578
|
+
try {
|
|
71579
|
+
await (0, import_promises2.stat)(path12);
|
|
71580
|
+
return true;
|
|
71581
|
+
} catch {
|
|
71582
|
+
return false;
|
|
71583
|
+
}
|
|
71584
|
+
}
|
|
71585
|
+
async function getRuntimeVersion(runtimeKind, cliPath) {
|
|
71586
|
+
const definition = runtimeDefinitions[runtimeKind];
|
|
71587
|
+
const { stdout, stderr } = await execFileAsync2(cliPath, definition.versionArgs, {
|
|
71588
|
+
timeout: 1e4,
|
|
71589
|
+
maxBuffer: 512 * 1024
|
|
71590
|
+
});
|
|
71591
|
+
return (stdout || stderr).trim();
|
|
71592
|
+
}
|
|
71593
|
+
async function discoverLocalRuntimes() {
|
|
71594
|
+
const items = await Promise.all(
|
|
71595
|
+
Object.keys(runtimeDefinitions).map(async (runtimeKind) => {
|
|
71596
|
+
const definition = runtimeDefinitions[runtimeKind];
|
|
71597
|
+
try {
|
|
71598
|
+
const cliPath = await resolveCliPath(definition.command);
|
|
71599
|
+
const version2 = await getRuntimeVersion(runtimeKind, cliPath);
|
|
71600
|
+
return {
|
|
71601
|
+
runtimeKind,
|
|
71602
|
+
label: definition.label,
|
|
71603
|
+
command: definition.command,
|
|
71604
|
+
cliPath,
|
|
71605
|
+
installed: true,
|
|
71606
|
+
version: version2,
|
|
71607
|
+
installHint: definition.installHint
|
|
71608
|
+
};
|
|
71609
|
+
} catch {
|
|
71610
|
+
return {
|
|
71611
|
+
runtimeKind,
|
|
71612
|
+
label: definition.label,
|
|
71613
|
+
command: definition.command,
|
|
71614
|
+
installed: false,
|
|
71615
|
+
installHint: definition.installHint
|
|
71616
|
+
};
|
|
71617
|
+
}
|
|
71618
|
+
})
|
|
71619
|
+
);
|
|
71620
|
+
return { items };
|
|
71621
|
+
}
|
|
71622
|
+
async function runHealthCheck(cliPath, workingDirectory, filePolicy) {
|
|
71623
|
+
const controller = new AbortController();
|
|
71624
|
+
const timeout = setTimeout(() => controller.abort(), 3e4);
|
|
71625
|
+
let stdout = "";
|
|
71626
|
+
try {
|
|
71627
|
+
const result = await runPromptJson({
|
|
71628
|
+
prompt: "\u8BF7\u53EA\u56DE\u590D ok",
|
|
71629
|
+
runtimeEnv: {
|
|
71630
|
+
id: "health-check",
|
|
71631
|
+
type: "local",
|
|
71632
|
+
name: "Claude CLI",
|
|
71633
|
+
workingDirectory,
|
|
71634
|
+
cliPath,
|
|
71635
|
+
permissionMode: "readonly",
|
|
71636
|
+
filePolicy: normalizeRuntimeFilePolicy(filePolicy)
|
|
71637
|
+
},
|
|
71638
|
+
cwd: workingDirectory,
|
|
71639
|
+
filePolicy: normalizeRuntimeFilePolicy(filePolicy),
|
|
71640
|
+
channelPolicy: { mode: "readonly_json" },
|
|
71641
|
+
abortSignal: controller.signal,
|
|
71642
|
+
abortMessage: "Claude CLI \u53EF\u7528\u6027\u68C0\u6D4B\u8D85\u65F6",
|
|
71643
|
+
failureMessage: "Claude CLI \u53EF\u7528\u6027\u68C0\u6D4B\u5931\u8D25"
|
|
71644
|
+
});
|
|
71645
|
+
stdout = result.raw;
|
|
71646
|
+
} finally {
|
|
71647
|
+
clearTimeout(timeout);
|
|
71648
|
+
}
|
|
71649
|
+
const lines = stdout.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
71650
|
+
const lastLine = lines[lines.length - 1];
|
|
71651
|
+
if (!lastLine) {
|
|
71652
|
+
throw new Error("Claude CLI \u53EF\u7528\u6027\u68C0\u6D4B\u5931\u8D25\uFF1A\u672A\u8FD4\u56DE\u6709\u6548 JSON \u8F93\u51FA");
|
|
71653
|
+
}
|
|
71654
|
+
let parsed;
|
|
71655
|
+
try {
|
|
71656
|
+
parsed = JSON.parse(lastLine);
|
|
71657
|
+
} catch {
|
|
71658
|
+
throw new Error("Claude CLI \u53EF\u7528\u6027\u68C0\u6D4B\u5931\u8D25\uFF1A\u8FD4\u56DE\u5185\u5BB9\u4E0D\u662F\u6709\u6548 JSON");
|
|
71659
|
+
}
|
|
71660
|
+
return {
|
|
71661
|
+
authenticated: parsed.subtype === "success" && !parsed.is_error,
|
|
71662
|
+
result: parsed.result?.trim() || ""
|
|
71663
|
+
};
|
|
71664
|
+
}
|
|
71665
|
+
async function validateRuntimeEnvironment(input) {
|
|
71666
|
+
const workingDirectory = expandHomeDir(input.workingDirectory);
|
|
71667
|
+
const workingDirectoryExists = await pathExists(workingDirectory);
|
|
71668
|
+
if (!workingDirectoryExists) {
|
|
71669
|
+
return {
|
|
71670
|
+
ok: false,
|
|
71671
|
+
runtimeKind: input.runtimeKind,
|
|
71672
|
+
cliPath: input.cliPath,
|
|
71673
|
+
workingDirectoryExists: false,
|
|
71674
|
+
authenticated: false,
|
|
71675
|
+
reason: "\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u8FDE\u63A5\u672C\u5730 Claude CLI"
|
|
71676
|
+
};
|
|
71677
|
+
}
|
|
71678
|
+
try {
|
|
71679
|
+
const runtimeKind = input.runtimeKind || "claude";
|
|
71680
|
+
const resolvedCliPath = await resolveCliPath(input.cliPath);
|
|
71681
|
+
const version2 = await getRuntimeVersion(runtimeKind, resolvedCliPath);
|
|
71682
|
+
const health = runtimeKind === "claude" ? await runHealthCheck(resolvedCliPath, workingDirectory, input.filePolicy) : { authenticated: true, result: version2 };
|
|
71683
|
+
if (!health.authenticated) {
|
|
71684
|
+
return {
|
|
71685
|
+
ok: false,
|
|
71686
|
+
runtimeKind: input.runtimeKind,
|
|
71687
|
+
cliPath: resolvedCliPath,
|
|
71688
|
+
workingDirectoryExists: true,
|
|
71689
|
+
authenticated: false,
|
|
71690
|
+
version: version2,
|
|
71691
|
+
reason: "Claude CLI \u53EF\u6267\u884C\uFF0C\u4F46\u5F53\u524D\u672A\u901A\u8FC7\u53EF\u7528\u6027\u68C0\u6D4B"
|
|
71692
|
+
};
|
|
71693
|
+
}
|
|
71694
|
+
return {
|
|
71695
|
+
ok: true,
|
|
71696
|
+
runtimeKind: input.runtimeKind,
|
|
71697
|
+
cliPath: resolvedCliPath,
|
|
71698
|
+
workingDirectoryExists: true,
|
|
71699
|
+
authenticated: true,
|
|
71700
|
+
version: version2
|
|
71701
|
+
};
|
|
71702
|
+
} catch (error) {
|
|
71703
|
+
const reason = error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF";
|
|
71704
|
+
return {
|
|
71705
|
+
ok: false,
|
|
71706
|
+
runtimeKind: input.runtimeKind,
|
|
71707
|
+
cliPath: input.cliPath,
|
|
71708
|
+
workingDirectoryExists: true,
|
|
71709
|
+
authenticated: false,
|
|
71710
|
+
reason
|
|
71711
|
+
};
|
|
71712
|
+
}
|
|
71713
|
+
}
|
|
71714
|
+
|
|
71447
71715
|
// ../../src/lib/runtime/defaultRuntimeEnvironments.ts
|
|
71448
71716
|
var INITIAL_RUNTIME_ENVIRONMENTS = [
|
|
71449
71717
|
{
|
|
@@ -71517,7 +71785,7 @@ async function runRemoteDaemonLoop(input) {
|
|
|
71517
71785
|
type: "register",
|
|
71518
71786
|
machineId: "pending",
|
|
71519
71787
|
os: osFingerprint(),
|
|
71520
|
-
daemonVersion: "0.1.
|
|
71788
|
+
daemonVersion: "0.1.1",
|
|
71521
71789
|
fingerprint: osFingerprint()
|
|
71522
71790
|
})
|
|
71523
71791
|
);
|
|
@@ -71539,6 +71807,57 @@ async function runRemoteDaemonLoop(input) {
|
|
|
71539
71807
|
appendRuntimeDaemonLog(`machine \u5DF2\u6CE8\u518C\uFF1A${message.machineId}\uFF08\u7528\u6237 ${message.userId}\uFF09`);
|
|
71540
71808
|
return;
|
|
71541
71809
|
}
|
|
71810
|
+
if (message.type === "discover_runtimes") {
|
|
71811
|
+
void (async () => {
|
|
71812
|
+
try {
|
|
71813
|
+
const result = await discoverLocalRuntimes();
|
|
71814
|
+
socket.send(
|
|
71815
|
+
JSON.stringify({
|
|
71816
|
+
type: "discover_runtimes_result",
|
|
71817
|
+
requestId: message.requestId,
|
|
71818
|
+
ok: true,
|
|
71819
|
+
items: result.items,
|
|
71820
|
+
workingDirectory: import_os2.default.homedir()
|
|
71821
|
+
})
|
|
71822
|
+
);
|
|
71823
|
+
} catch (error) {
|
|
71824
|
+
socket.send(
|
|
71825
|
+
JSON.stringify({
|
|
71826
|
+
type: "discover_runtimes_result",
|
|
71827
|
+
requestId: message.requestId,
|
|
71828
|
+
ok: false,
|
|
71829
|
+
error: error instanceof Error ? error.message : "\u626B\u63CF\u5931\u8D25"
|
|
71830
|
+
})
|
|
71831
|
+
);
|
|
71832
|
+
}
|
|
71833
|
+
})();
|
|
71834
|
+
return;
|
|
71835
|
+
}
|
|
71836
|
+
if (message.type === "check_runtime") {
|
|
71837
|
+
void (async () => {
|
|
71838
|
+
try {
|
|
71839
|
+
const result = await validateRuntimeEnvironment(message.payload);
|
|
71840
|
+
socket.send(
|
|
71841
|
+
JSON.stringify({
|
|
71842
|
+
type: "check_runtime_result",
|
|
71843
|
+
requestId: message.requestId,
|
|
71844
|
+
ok: result.ok,
|
|
71845
|
+
result
|
|
71846
|
+
})
|
|
71847
|
+
);
|
|
71848
|
+
} catch (error) {
|
|
71849
|
+
socket.send(
|
|
71850
|
+
JSON.stringify({
|
|
71851
|
+
type: "check_runtime_result",
|
|
71852
|
+
requestId: message.requestId,
|
|
71853
|
+
ok: false,
|
|
71854
|
+
error: error instanceof Error ? error.message : "\u68C0\u6D4B\u5931\u8D25"
|
|
71855
|
+
})
|
|
71856
|
+
);
|
|
71857
|
+
}
|
|
71858
|
+
})();
|
|
71859
|
+
return;
|
|
71860
|
+
}
|
|
71542
71861
|
if (message.type !== "execute") return;
|
|
71543
71862
|
void (async () => {
|
|
71544
71863
|
try {
|
|
@@ -71597,15 +71916,15 @@ async function runRemoteDaemonLoop(input) {
|
|
|
71597
71916
|
|
|
71598
71917
|
// src/service.ts
|
|
71599
71918
|
var import_fs13 = __toESM(require("fs"));
|
|
71600
|
-
var
|
|
71919
|
+
var import_os3 = __toESM(require("os"));
|
|
71601
71920
|
var import_path9 = __toESM(require("path"));
|
|
71602
|
-
var
|
|
71603
|
-
var
|
|
71604
|
-
var
|
|
71921
|
+
var import_child_process4 = require("child_process");
|
|
71922
|
+
var import_util3 = require("util");
|
|
71923
|
+
var execFileAsync3 = (0, import_util3.promisify)(import_child_process4.execFile);
|
|
71605
71924
|
var MAC_LABEL = "com.kiki.daemon";
|
|
71606
71925
|
var LINUX_UNIT = "kiki-daemon.service";
|
|
71607
71926
|
function kikiHome() {
|
|
71608
|
-
return import_path9.default.join(
|
|
71927
|
+
return import_path9.default.join(import_os3.default.homedir(), ".kiki");
|
|
71609
71928
|
}
|
|
71610
71929
|
function logsDir() {
|
|
71611
71930
|
const dir = import_path9.default.join(kikiHome(), "runtime", "logs");
|
|
@@ -71618,10 +71937,10 @@ function dataDir() {
|
|
|
71618
71937
|
return dir;
|
|
71619
71938
|
}
|
|
71620
71939
|
function macPlistPath() {
|
|
71621
|
-
return import_path9.default.join(
|
|
71940
|
+
return import_path9.default.join(import_os3.default.homedir(), "Library", "LaunchAgents", `${MAC_LABEL}.plist`);
|
|
71622
71941
|
}
|
|
71623
71942
|
function linuxUnitPath() {
|
|
71624
|
-
return import_path9.default.join(
|
|
71943
|
+
return import_path9.default.join(import_os3.default.homedir(), ".config", "systemd", "user", LINUX_UNIT);
|
|
71625
71944
|
}
|
|
71626
71945
|
function xmlEscape(value) {
|
|
71627
71946
|
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
@@ -71700,18 +72019,18 @@ async function installService(ctx) {
|
|
|
71700
72019
|
const id = await uid();
|
|
71701
72020
|
if (!id) throw new Error("\u65E0\u6CD5\u8BC6\u522B\u5F53\u524D\u7528\u6237\uFF0C\u65E0\u6CD5\u5B89\u88C5 LaunchAgent");
|
|
71702
72021
|
const domain = `gui/${id}`;
|
|
71703
|
-
await
|
|
71704
|
-
await
|
|
71705
|
-
await
|
|
72022
|
+
await execFileAsync3("launchctl", ["bootout", domain, target]).catch(() => void 0);
|
|
72023
|
+
await execFileAsync3("launchctl", ["bootstrap", domain, target]);
|
|
72024
|
+
await execFileAsync3("launchctl", ["kickstart", "-k", `${domain}/${MAC_LABEL}`]);
|
|
71706
72025
|
return { kind: "launchd", path: target };
|
|
71707
72026
|
}
|
|
71708
72027
|
if (process.platform === "linux") {
|
|
71709
72028
|
const target = linuxUnitPath();
|
|
71710
72029
|
import_fs13.default.mkdirSync(import_path9.default.dirname(target), { recursive: true });
|
|
71711
72030
|
import_fs13.default.writeFileSync(target, buildLinuxUnit(ctx), "utf8");
|
|
71712
|
-
await
|
|
71713
|
-
await
|
|
71714
|
-
await
|
|
72031
|
+
await execFileAsync3("systemctl", ["--user", "daemon-reload"]);
|
|
72032
|
+
await execFileAsync3("systemctl", ["--user", "enable", "--now", LINUX_UNIT]);
|
|
72033
|
+
await execFileAsync3("loginctl", ["enable-linger", import_os3.default.userInfo().username]).catch(() => void 0);
|
|
71715
72034
|
return { kind: "systemd", path: target };
|
|
71716
72035
|
}
|
|
71717
72036
|
throw new Error(
|
|
@@ -71724,16 +72043,16 @@ async function uninstallService() {
|
|
|
71724
72043
|
const target = macPlistPath();
|
|
71725
72044
|
const id = await uid();
|
|
71726
72045
|
if (id && import_fs13.default.existsSync(target)) {
|
|
71727
|
-
await
|
|
72046
|
+
await execFileAsync3("launchctl", ["bootout", `gui/${id}`, target]).catch(() => void 0);
|
|
71728
72047
|
}
|
|
71729
72048
|
if (import_fs13.default.existsSync(target)) import_fs13.default.unlinkSync(target);
|
|
71730
72049
|
return { kind: "launchd", path: target };
|
|
71731
72050
|
}
|
|
71732
72051
|
if (process.platform === "linux") {
|
|
71733
72052
|
const target = linuxUnitPath();
|
|
71734
|
-
await
|
|
72053
|
+
await execFileAsync3("systemctl", ["--user", "disable", "--now", LINUX_UNIT]).catch(() => void 0);
|
|
71735
72054
|
if (import_fs13.default.existsSync(target)) import_fs13.default.unlinkSync(target);
|
|
71736
|
-
await
|
|
72055
|
+
await execFileAsync3("systemctl", ["--user", "daemon-reload"]).catch(() => void 0);
|
|
71737
72056
|
return { kind: "systemd", path: target };
|
|
71738
72057
|
}
|
|
71739
72058
|
throw new Error(`\u5F53\u524D\u5E73\u53F0 ${process.platform} \u6682\u4E0D\u652F\u6301\u81EA\u52A8\u5378\u8F7D\u540E\u53F0\u670D\u52A1`);
|
|
@@ -71746,7 +72065,7 @@ async function serviceStatus() {
|
|
|
71746
72065
|
if (installed) {
|
|
71747
72066
|
const id = await uid();
|
|
71748
72067
|
if (id) {
|
|
71749
|
-
const result = await
|
|
72068
|
+
const result = await execFileAsync3("launchctl", ["print", `gui/${id}/${MAC_LABEL}`]).catch(() => null);
|
|
71750
72069
|
running = Boolean(result && /state = running/.test(result.stdout));
|
|
71751
72070
|
}
|
|
71752
72071
|
}
|
|
@@ -71755,7 +72074,7 @@ async function serviceStatus() {
|
|
|
71755
72074
|
if (process.platform === "linux") {
|
|
71756
72075
|
const target = linuxUnitPath();
|
|
71757
72076
|
const installed = import_fs13.default.existsSync(target);
|
|
71758
|
-
const result = await
|
|
72077
|
+
const result = await execFileAsync3("systemctl", ["--user", "is-active", LINUX_UNIT]).catch((error) => error);
|
|
71759
72078
|
const running = Boolean(result && typeof result.stdout === "string" && result.stdout.trim() === "active");
|
|
71760
72079
|
return { kind: "systemd", installed, running, path: target };
|
|
71761
72080
|
}
|