@usepowerplant/cli 0.4.5 → 0.4.6
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/README.md +93 -20
- package/dist/cli.js +739 -523
- package/dist/menubar/Powerplant.app.zip +0 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6877,19 +6877,19 @@ var require_module_details_from_path = __commonJS({
|
|
|
6877
6877
|
basedir += segments[i] + sep2;
|
|
6878
6878
|
}
|
|
6879
6879
|
}
|
|
6880
|
-
var
|
|
6880
|
+
var path29 = "";
|
|
6881
6881
|
var lastSegmentIndex = segments.length - 1;
|
|
6882
6882
|
for (var i2 = index + offset; i2 <= lastSegmentIndex; i2++) {
|
|
6883
6883
|
if (i2 === lastSegmentIndex) {
|
|
6884
|
-
|
|
6884
|
+
path29 += segments[i2];
|
|
6885
6885
|
} else {
|
|
6886
|
-
|
|
6886
|
+
path29 += segments[i2] + sep2;
|
|
6887
6887
|
}
|
|
6888
6888
|
}
|
|
6889
6889
|
return {
|
|
6890
6890
|
name,
|
|
6891
6891
|
basedir,
|
|
6892
|
-
path:
|
|
6892
|
+
path: path29
|
|
6893
6893
|
};
|
|
6894
6894
|
};
|
|
6895
6895
|
}
|
|
@@ -6899,7 +6899,7 @@ var require_module_details_from_path = __commonJS({
|
|
|
6899
6899
|
var require_require_in_the_middle = __commonJS({
|
|
6900
6900
|
"../../node_modules/.pnpm/require-in-the-middle@8.0.1/node_modules/require-in-the-middle/index.js"(exports, module2) {
|
|
6901
6901
|
"use strict";
|
|
6902
|
-
var
|
|
6902
|
+
var path29 = __require("path");
|
|
6903
6903
|
var Module = __require("module");
|
|
6904
6904
|
var debug2 = require_src3()("require-in-the-middle");
|
|
6905
6905
|
var moduleDetailsFromPath = require_module_details_from_path();
|
|
@@ -7044,7 +7044,7 @@ var require_require_in_the_middle = __commonJS({
|
|
|
7044
7044
|
}
|
|
7045
7045
|
moduleName = filename;
|
|
7046
7046
|
} else if (hasWhitelist === true && modules.includes(filename)) {
|
|
7047
|
-
const parsedPath =
|
|
7047
|
+
const parsedPath = path29.parse(filename);
|
|
7048
7048
|
moduleName = parsedPath.name;
|
|
7049
7049
|
basedir = parsedPath.dir;
|
|
7050
7050
|
} else {
|
|
@@ -7082,7 +7082,7 @@ var require_require_in_the_middle = __commonJS({
|
|
|
7082
7082
|
}
|
|
7083
7083
|
if (res !== filename) {
|
|
7084
7084
|
if (internals === true) {
|
|
7085
|
-
moduleName = moduleName +
|
|
7085
|
+
moduleName = moduleName + path29.sep + path29.relative(basedir, filename);
|
|
7086
7086
|
debug2("preparing to process require of internal file: %s", moduleName);
|
|
7087
7087
|
} else {
|
|
7088
7088
|
debug2("ignoring require of non-main module file: %s", res);
|
|
@@ -7118,8 +7118,8 @@ var require_require_in_the_middle = __commonJS({
|
|
|
7118
7118
|
}
|
|
7119
7119
|
};
|
|
7120
7120
|
function resolveModuleName(stat) {
|
|
7121
|
-
const normalizedPath =
|
|
7122
|
-
return
|
|
7121
|
+
const normalizedPath = path29.sep !== "/" ? stat.path.split(path29.sep).join("/") : stat.path;
|
|
7122
|
+
return path29.posix.join(stat.name, normalizedPath).replace(normalize3, "");
|
|
7123
7123
|
}
|
|
7124
7124
|
}
|
|
7125
7125
|
});
|
|
@@ -7204,7 +7204,7 @@ var require_RequireInTheMiddleSingleton = __commonJS({
|
|
|
7204
7204
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7205
7205
|
exports.RequireInTheMiddleSingleton = void 0;
|
|
7206
7206
|
var require_in_the_middle_1 = require_require_in_the_middle();
|
|
7207
|
-
var
|
|
7207
|
+
var path29 = __require("path");
|
|
7208
7208
|
var ModuleNameTrie_1 = require_ModuleNameTrie();
|
|
7209
7209
|
var isMocha = [
|
|
7210
7210
|
"afterEach",
|
|
@@ -7268,7 +7268,7 @@ var require_RequireInTheMiddleSingleton = __commonJS({
|
|
|
7268
7268
|
};
|
|
7269
7269
|
exports.RequireInTheMiddleSingleton = RequireInTheMiddleSingleton;
|
|
7270
7270
|
function normalizePathSeparators(moduleNameOrPath) {
|
|
7271
|
-
return
|
|
7271
|
+
return path29.sep !== ModuleNameTrie_1.ModuleNameSeparator ? moduleNameOrPath.split(path29.sep).join(ModuleNameTrie_1.ModuleNameSeparator) : moduleNameOrPath;
|
|
7272
7272
|
}
|
|
7273
7273
|
}
|
|
7274
7274
|
});
|
|
@@ -7434,7 +7434,7 @@ var require_register = __commonJS({
|
|
|
7434
7434
|
// ../../node_modules/.pnpm/import-in-the-middle@3.4.0/node_modules/import-in-the-middle/index.js
|
|
7435
7435
|
var require_import_in_the_middle = __commonJS({
|
|
7436
7436
|
"../../node_modules/.pnpm/import-in-the-middle@3.4.0/node_modules/import-in-the-middle/index.js"(exports, module2) {
|
|
7437
|
-
var
|
|
7437
|
+
var path29 = __require("path");
|
|
7438
7438
|
var moduleDetailsFromPath = require_module_details_from_path();
|
|
7439
7439
|
var { fileURLToPath: fileURLToPath3 } = __require("url");
|
|
7440
7440
|
var { MessageChannel } = __require("worker_threads");
|
|
@@ -7553,7 +7553,7 @@ var require_import_in_the_middle = __commonJS({
|
|
|
7553
7553
|
} else if (baseDir.endsWith(specifiers.get(loadUrl)) || isTurbopackSpecifier(specifiers.get(loadUrl), baseDir)) {
|
|
7554
7554
|
callHookFn(hookFn, namespace, name, baseDir);
|
|
7555
7555
|
} else if (internals) {
|
|
7556
|
-
const internalPath = name +
|
|
7556
|
+
const internalPath = name + path29.sep + path29.relative(baseDir, filePath);
|
|
7557
7557
|
callHookFn(hookFn, namespace, internalPath, baseDir);
|
|
7558
7558
|
}
|
|
7559
7559
|
} else if (matchArg === specifier) {
|
|
@@ -7628,7 +7628,7 @@ var require_instrumentation2 = __commonJS({
|
|
|
7628
7628
|
"use strict";
|
|
7629
7629
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7630
7630
|
exports.InstrumentationBase = void 0;
|
|
7631
|
-
var
|
|
7631
|
+
var path29 = __require("path");
|
|
7632
7632
|
var util_1 = __require("util");
|
|
7633
7633
|
var semver_1 = require_semver();
|
|
7634
7634
|
var shimmer_1 = require_shimmer();
|
|
@@ -7729,7 +7729,7 @@ var require_instrumentation2 = __commonJS({
|
|
|
7729
7729
|
}
|
|
7730
7730
|
_extractPackageVersion(baseDir) {
|
|
7731
7731
|
try {
|
|
7732
|
-
const json2 = (0, fs_1.readFileSync)(
|
|
7732
|
+
const json2 = (0, fs_1.readFileSync)(path29.join(baseDir, "package.json"), {
|
|
7733
7733
|
encoding: "utf8"
|
|
7734
7734
|
});
|
|
7735
7735
|
const version2 = JSON.parse(json2).version;
|
|
@@ -7771,7 +7771,7 @@ var require_instrumentation2 = __commonJS({
|
|
|
7771
7771
|
return exports2;
|
|
7772
7772
|
}
|
|
7773
7773
|
const files = module3.files ?? [];
|
|
7774
|
-
const normalizedName =
|
|
7774
|
+
const normalizedName = path29.normalize(name);
|
|
7775
7775
|
const supportedFileInstrumentations = files.filter((f) => f.name === normalizedName && isSupported(f.supportedVersions, version2, module3.includePrerelease));
|
|
7776
7776
|
return supportedFileInstrumentations.reduce((patchedExports, file2) => {
|
|
7777
7777
|
file2.moduleExports = patchedExports;
|
|
@@ -7817,8 +7817,8 @@ var require_instrumentation2 = __commonJS({
|
|
|
7817
7817
|
this._warnOnPreloadedModules();
|
|
7818
7818
|
for (const module3 of this._modules) {
|
|
7819
7819
|
const hookFn = (exports2, name, baseDir) => {
|
|
7820
|
-
if (!baseDir &&
|
|
7821
|
-
const parsedPath =
|
|
7820
|
+
if (!baseDir && path29.isAbsolute(name)) {
|
|
7821
|
+
const parsedPath = path29.parse(name);
|
|
7822
7822
|
name = parsedPath.name;
|
|
7823
7823
|
baseDir = parsedPath.dir;
|
|
7824
7824
|
}
|
|
@@ -7827,7 +7827,7 @@ var require_instrumentation2 = __commonJS({
|
|
|
7827
7827
|
const onRequire = (exports2, name, baseDir) => {
|
|
7828
7828
|
return this._onRequire(module3, exports2, name, baseDir);
|
|
7829
7829
|
};
|
|
7830
|
-
const hook =
|
|
7830
|
+
const hook = path29.isAbsolute(module3.name) ? new require_in_the_middle_1.Hook([module3.name], { internals: true }, onRequire) : this._requireInTheMiddleSingleton.register(module3.name, onRequire);
|
|
7831
7831
|
this._hooks.push(hook);
|
|
7832
7832
|
const esmHook = new import_in_the_middle_1.Hook([module3.name], { internals: true }, hookFn);
|
|
7833
7833
|
this._hooks.push(esmHook);
|
|
@@ -8435,9 +8435,9 @@ var require_getMachineId_linux = __commonJS({
|
|
|
8435
8435
|
var api_1 = (init_esm(), __toCommonJS(esm_exports));
|
|
8436
8436
|
async function getMachineId() {
|
|
8437
8437
|
const paths = ["/etc/machine-id", "/var/lib/dbus/machine-id"];
|
|
8438
|
-
for (const
|
|
8438
|
+
for (const path29 of paths) {
|
|
8439
8439
|
try {
|
|
8440
|
-
const result = await fs_1.promises.readFile(
|
|
8440
|
+
const result = await fs_1.promises.readFile(path29, { encoding: "utf8" });
|
|
8441
8441
|
return result.trim();
|
|
8442
8442
|
} catch (e) {
|
|
8443
8443
|
api_1.diag.debug(`error reading machine id: ${e}`);
|
|
@@ -8643,7 +8643,7 @@ var require_ProcessDetector = __commonJS({
|
|
|
8643
8643
|
exports.processDetector = void 0;
|
|
8644
8644
|
var api_1 = (init_esm(), __toCommonJS(esm_exports));
|
|
8645
8645
|
var semconv_1 = require_semconv2();
|
|
8646
|
-
var
|
|
8646
|
+
var os22 = __require("os");
|
|
8647
8647
|
var ProcessDetector = class {
|
|
8648
8648
|
detect(_config) {
|
|
8649
8649
|
const attributes = {
|
|
@@ -8663,7 +8663,7 @@ var require_ProcessDetector = __commonJS({
|
|
|
8663
8663
|
attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
|
|
8664
8664
|
}
|
|
8665
8665
|
try {
|
|
8666
|
-
const userInfo =
|
|
8666
|
+
const userInfo = os22.userInfo();
|
|
8667
8667
|
attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
|
|
8668
8668
|
} catch (e) {
|
|
8669
8669
|
api_1.diag.debug(`error obtaining process owner: ${e}`);
|
|
@@ -11797,14 +11797,14 @@ var require_util = __commonJS({
|
|
|
11797
11797
|
}
|
|
11798
11798
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
11799
11799
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
11800
|
-
let
|
|
11800
|
+
let path29 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
11801
11801
|
if (origin[origin.length - 1] === "/") {
|
|
11802
11802
|
origin = origin.slice(0, origin.length - 1);
|
|
11803
11803
|
}
|
|
11804
|
-
if (
|
|
11805
|
-
|
|
11804
|
+
if (path29 && path29[0] !== "/") {
|
|
11805
|
+
path29 = `/${path29}`;
|
|
11806
11806
|
}
|
|
11807
|
-
return new URL(`${origin}${
|
|
11807
|
+
return new URL(`${origin}${path29}`);
|
|
11808
11808
|
}
|
|
11809
11809
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
11810
11810
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -12625,9 +12625,9 @@ var require_diagnostics = __commonJS({
|
|
|
12625
12625
|
"undici:client:sendHeaders",
|
|
12626
12626
|
(evt) => {
|
|
12627
12627
|
const {
|
|
12628
|
-
request: { method, path:
|
|
12628
|
+
request: { method, path: path29, origin }
|
|
12629
12629
|
} = evt;
|
|
12630
|
-
debugLog3("sending request to %s %s%s", method, origin,
|
|
12630
|
+
debugLog3("sending request to %s %s%s", method, origin, path29);
|
|
12631
12631
|
}
|
|
12632
12632
|
);
|
|
12633
12633
|
}
|
|
@@ -12645,14 +12645,14 @@ var require_diagnostics = __commonJS({
|
|
|
12645
12645
|
"undici:request:headers",
|
|
12646
12646
|
(evt) => {
|
|
12647
12647
|
const {
|
|
12648
|
-
request: { method, path:
|
|
12648
|
+
request: { method, path: path29, origin },
|
|
12649
12649
|
response: { statusCode }
|
|
12650
12650
|
} = evt;
|
|
12651
12651
|
debugLog3(
|
|
12652
12652
|
"received response to %s %s%s - HTTP %d",
|
|
12653
12653
|
method,
|
|
12654
12654
|
origin,
|
|
12655
|
-
|
|
12655
|
+
path29,
|
|
12656
12656
|
statusCode
|
|
12657
12657
|
);
|
|
12658
12658
|
}
|
|
@@ -12661,23 +12661,23 @@ var require_diagnostics = __commonJS({
|
|
|
12661
12661
|
"undici:request:trailers",
|
|
12662
12662
|
(evt) => {
|
|
12663
12663
|
const {
|
|
12664
|
-
request: { method, path:
|
|
12664
|
+
request: { method, path: path29, origin }
|
|
12665
12665
|
} = evt;
|
|
12666
|
-
debugLog3("trailers received from %s %s%s", method, origin,
|
|
12666
|
+
debugLog3("trailers received from %s %s%s", method, origin, path29);
|
|
12667
12667
|
}
|
|
12668
12668
|
);
|
|
12669
12669
|
diagnosticsChannel9.subscribe(
|
|
12670
12670
|
"undici:request:error",
|
|
12671
12671
|
(evt) => {
|
|
12672
12672
|
const {
|
|
12673
|
-
request: { method, path:
|
|
12673
|
+
request: { method, path: path29, origin },
|
|
12674
12674
|
error: error62
|
|
12675
12675
|
} = evt;
|
|
12676
12676
|
debugLog3(
|
|
12677
12677
|
"request to %s %s%s errored - %s",
|
|
12678
12678
|
method,
|
|
12679
12679
|
origin,
|
|
12680
|
-
|
|
12680
|
+
path29,
|
|
12681
12681
|
error62.message
|
|
12682
12682
|
);
|
|
12683
12683
|
}
|
|
@@ -12792,7 +12792,7 @@ var require_request = __commonJS({
|
|
|
12792
12792
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
12793
12793
|
var Request2 = class {
|
|
12794
12794
|
constructor(origin, {
|
|
12795
|
-
path:
|
|
12795
|
+
path: path29,
|
|
12796
12796
|
method,
|
|
12797
12797
|
body,
|
|
12798
12798
|
headers,
|
|
@@ -12809,11 +12809,11 @@ var require_request = __commonJS({
|
|
|
12809
12809
|
maxRedirections,
|
|
12810
12810
|
typeOfService
|
|
12811
12811
|
}, handler) {
|
|
12812
|
-
if (typeof
|
|
12812
|
+
if (typeof path29 !== "string") {
|
|
12813
12813
|
throw new InvalidArgumentError("path must be a string");
|
|
12814
|
-
} else if (
|
|
12814
|
+
} else if (path29[0] !== "/" && !(path29.startsWith("http://") || path29.startsWith("https://")) && method !== "CONNECT") {
|
|
12815
12815
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
12816
|
-
} else if (invalidPathRegex.test(
|
|
12816
|
+
} else if (invalidPathRegex.test(path29)) {
|
|
12817
12817
|
throw new InvalidArgumentError("invalid request path");
|
|
12818
12818
|
}
|
|
12819
12819
|
if (typeof method !== "string") {
|
|
@@ -12888,7 +12888,7 @@ var require_request = __commonJS({
|
|
|
12888
12888
|
this.completed = false;
|
|
12889
12889
|
this.aborted = false;
|
|
12890
12890
|
this.upgrade = upgrade || null;
|
|
12891
|
-
this.path = query ? serializePathWithQuery(
|
|
12891
|
+
this.path = query ? serializePathWithQuery(path29, query) : path29;
|
|
12892
12892
|
this.origin = origin;
|
|
12893
12893
|
this.protocol = getProtocolFromUrlString(origin);
|
|
12894
12894
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -17281,7 +17281,7 @@ var require_client_h1 = __commonJS({
|
|
|
17281
17281
|
kHTTPContext,
|
|
17282
17282
|
kClosed
|
|
17283
17283
|
} = require_symbols();
|
|
17284
|
-
var
|
|
17284
|
+
var constants3 = require_constants3();
|
|
17285
17285
|
var EMPTY_BUF = Buffer.alloc(0);
|
|
17286
17286
|
var FastBuffer = Buffer[Symbol.species];
|
|
17287
17287
|
var removeAllListeners = util2.removeAllListeners;
|
|
@@ -17410,7 +17410,7 @@ var require_client_h1 = __commonJS({
|
|
|
17410
17410
|
*/
|
|
17411
17411
|
constructor(client, socket, { exports: exports2 }) {
|
|
17412
17412
|
this.llhttp = exports2;
|
|
17413
|
-
this.ptr = this.llhttp.llhttp_alloc(
|
|
17413
|
+
this.ptr = this.llhttp.llhttp_alloc(constants3.TYPE.RESPONSE);
|
|
17414
17414
|
this.client = client;
|
|
17415
17415
|
this.socket = socket;
|
|
17416
17416
|
this.timeout = null;
|
|
@@ -17506,11 +17506,11 @@ var require_client_h1 = __commonJS({
|
|
|
17506
17506
|
currentParser = null;
|
|
17507
17507
|
currentBufferRef = null;
|
|
17508
17508
|
}
|
|
17509
|
-
if (ret !==
|
|
17509
|
+
if (ret !== constants3.ERROR.OK) {
|
|
17510
17510
|
const data = chunk.subarray(llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr);
|
|
17511
|
-
if (ret ===
|
|
17511
|
+
if (ret === constants3.ERROR.PAUSED_UPGRADE) {
|
|
17512
17512
|
this.onUpgrade(data);
|
|
17513
|
-
} else if (ret ===
|
|
17513
|
+
} else if (ret === constants3.ERROR.PAUSED) {
|
|
17514
17514
|
this.paused = true;
|
|
17515
17515
|
socket.unshift(data);
|
|
17516
17516
|
} else {
|
|
@@ -17533,10 +17533,10 @@ var require_client_h1 = __commonJS({
|
|
|
17533
17533
|
} finally {
|
|
17534
17534
|
currentParser = null;
|
|
17535
17535
|
}
|
|
17536
|
-
if (ret ===
|
|
17536
|
+
if (ret === constants3.ERROR.OK) {
|
|
17537
17537
|
return null;
|
|
17538
17538
|
}
|
|
17539
|
-
if (ret ===
|
|
17539
|
+
if (ret === constants3.ERROR.PAUSED || ret === constants3.ERROR.PAUSED_UPGRADE) {
|
|
17540
17540
|
this.paused = true;
|
|
17541
17541
|
return null;
|
|
17542
17542
|
}
|
|
@@ -17553,7 +17553,7 @@ var require_client_h1 = __commonJS({
|
|
|
17553
17553
|
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
|
|
17554
17554
|
message2 = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")";
|
|
17555
17555
|
}
|
|
17556
|
-
return new HTTPParserError(message2,
|
|
17556
|
+
return new HTTPParserError(message2, constants3.ERROR[ret], data);
|
|
17557
17557
|
}
|
|
17558
17558
|
destroy() {
|
|
17559
17559
|
assert2(currentParser === null);
|
|
@@ -17763,7 +17763,7 @@ var require_client_h1 = __commonJS({
|
|
|
17763
17763
|
socket[kBlocking] = false;
|
|
17764
17764
|
client[kResume]();
|
|
17765
17765
|
}
|
|
17766
|
-
return pause ?
|
|
17766
|
+
return pause ? constants3.ERROR.PAUSED : 0;
|
|
17767
17767
|
}
|
|
17768
17768
|
/**
|
|
17769
17769
|
* @param {Buffer} buf
|
|
@@ -17789,7 +17789,7 @@ var require_client_h1 = __commonJS({
|
|
|
17789
17789
|
}
|
|
17790
17790
|
this.bytesRead += buf.length;
|
|
17791
17791
|
if (request2.onData(buf) === false) {
|
|
17792
|
-
return
|
|
17792
|
+
return constants3.ERROR.PAUSED;
|
|
17793
17793
|
}
|
|
17794
17794
|
return 0;
|
|
17795
17795
|
}
|
|
@@ -17829,13 +17829,13 @@ var require_client_h1 = __commonJS({
|
|
|
17829
17829
|
if (socket[kWriting]) {
|
|
17830
17830
|
assert2(client[kRunning] === 0);
|
|
17831
17831
|
util2.destroy(socket, new InformationalError("reset"));
|
|
17832
|
-
return
|
|
17832
|
+
return constants3.ERROR.PAUSED;
|
|
17833
17833
|
} else if (!shouldKeepAlive) {
|
|
17834
17834
|
util2.destroy(socket, new InformationalError("reset"));
|
|
17835
|
-
return
|
|
17835
|
+
return constants3.ERROR.PAUSED;
|
|
17836
17836
|
} else if (socket[kReset] && client[kRunning] === 0) {
|
|
17837
17837
|
util2.destroy(socket, new InformationalError("reset"));
|
|
17838
|
-
return
|
|
17838
|
+
return constants3.ERROR.PAUSED;
|
|
17839
17839
|
} else if (client[kPipelining] == null || client[kPipelining] === 1) {
|
|
17840
17840
|
setImmediate(client[kResume]);
|
|
17841
17841
|
} else {
|
|
@@ -18070,7 +18070,7 @@ var require_client_h1 = __commonJS({
|
|
|
18070
18070
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
18071
18071
|
}
|
|
18072
18072
|
function writeH1(client, request2) {
|
|
18073
|
-
const { method, path:
|
|
18073
|
+
const { method, path: path29, host, upgrade, blocking, reset } = request2;
|
|
18074
18074
|
let { body, headers, contentLength } = request2;
|
|
18075
18075
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
18076
18076
|
if (util2.isFormDataLike(body)) {
|
|
@@ -18148,7 +18148,7 @@ var require_client_h1 = __commonJS({
|
|
|
18148
18148
|
if (socket.setTypeOfService) {
|
|
18149
18149
|
socket.setTypeOfService(request2.typeOfService);
|
|
18150
18150
|
}
|
|
18151
|
-
let header = `${method} ${
|
|
18151
|
+
let header = `${method} ${path29} HTTP/1.1\r
|
|
18152
18152
|
`;
|
|
18153
18153
|
if (typeof host === "string") {
|
|
18154
18154
|
header += `host: ${host}\r
|
|
@@ -18827,7 +18827,7 @@ var require_client_h2 = __commonJS({
|
|
|
18827
18827
|
const headersTimeout = request2.headersTimeout ?? client[kHeadersTimeout];
|
|
18828
18828
|
const bodyTimeout = request2.bodyTimeout ?? client[kBodyTimeout];
|
|
18829
18829
|
const session = client[kHTTP2Session];
|
|
18830
|
-
const { method, path:
|
|
18830
|
+
const { method, path: path29, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request2;
|
|
18831
18831
|
let { body } = request2;
|
|
18832
18832
|
if (upgrade != null && upgrade !== "websocket") {
|
|
18833
18833
|
util2.errorRequest(client, request2, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -18896,7 +18896,7 @@ var require_client_h2 = __commonJS({
|
|
|
18896
18896
|
}
|
|
18897
18897
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
18898
18898
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
18899
|
-
headers[HTTP2_HEADER_PATH] =
|
|
18899
|
+
headers[HTTP2_HEADER_PATH] = path29;
|
|
18900
18900
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
18901
18901
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
18902
18902
|
} else {
|
|
@@ -18938,7 +18938,7 @@ var require_client_h2 = __commonJS({
|
|
|
18938
18938
|
stream.setTimeout(headersTimeout);
|
|
18939
18939
|
return true;
|
|
18940
18940
|
}
|
|
18941
|
-
headers[HTTP2_HEADER_PATH] =
|
|
18941
|
+
headers[HTTP2_HEADER_PATH] = path29;
|
|
18942
18942
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
18943
18943
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
18944
18944
|
if (body && typeof body.read === "function") {
|
|
@@ -21290,10 +21290,10 @@ var require_proxy_agent = __commonJS({
|
|
|
21290
21290
|
};
|
|
21291
21291
|
const {
|
|
21292
21292
|
origin,
|
|
21293
|
-
path:
|
|
21293
|
+
path: path29 = "/",
|
|
21294
21294
|
headers = {}
|
|
21295
21295
|
} = opts;
|
|
21296
|
-
opts.path = origin +
|
|
21296
|
+
opts.path = origin + path29;
|
|
21297
21297
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
21298
21298
|
const { host } = new URL(origin);
|
|
21299
21299
|
headers.host = host;
|
|
@@ -23402,20 +23402,20 @@ var require_mock_utils = __commonJS({
|
|
|
23402
23402
|
}
|
|
23403
23403
|
return normalizedQp;
|
|
23404
23404
|
}
|
|
23405
|
-
function safeUrl(
|
|
23406
|
-
if (typeof
|
|
23407
|
-
return
|
|
23405
|
+
function safeUrl(path29) {
|
|
23406
|
+
if (typeof path29 !== "string") {
|
|
23407
|
+
return path29;
|
|
23408
23408
|
}
|
|
23409
|
-
const pathSegments =
|
|
23409
|
+
const pathSegments = path29.split("?", 3);
|
|
23410
23410
|
if (pathSegments.length !== 2) {
|
|
23411
|
-
return
|
|
23411
|
+
return path29;
|
|
23412
23412
|
}
|
|
23413
23413
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
23414
23414
|
qp.sort();
|
|
23415
23415
|
return [...pathSegments, qp.toString()].join("?");
|
|
23416
23416
|
}
|
|
23417
|
-
function matchKey(mockDispatch2, { path:
|
|
23418
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
23417
|
+
function matchKey(mockDispatch2, { path: path29, method, body, headers }) {
|
|
23418
|
+
const pathMatch = matchValue(mockDispatch2.path, path29);
|
|
23419
23419
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
23420
23420
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
23421
23421
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -23440,8 +23440,8 @@ var require_mock_utils = __commonJS({
|
|
|
23440
23440
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
23441
23441
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
23442
23442
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
23443
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
23444
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
23443
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path29, ignoreTrailingSlash }) => {
|
|
23444
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path29)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path29), resolvedPath);
|
|
23445
23445
|
});
|
|
23446
23446
|
if (matchedMockDispatches.length === 0) {
|
|
23447
23447
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -23480,19 +23480,19 @@ var require_mock_utils = __commonJS({
|
|
|
23480
23480
|
mockDispatches.splice(index, 1);
|
|
23481
23481
|
}
|
|
23482
23482
|
}
|
|
23483
|
-
function removeTrailingSlash(
|
|
23484
|
-
while (
|
|
23485
|
-
|
|
23483
|
+
function removeTrailingSlash(path29) {
|
|
23484
|
+
while (path29.endsWith("/")) {
|
|
23485
|
+
path29 = path29.slice(0, -1);
|
|
23486
23486
|
}
|
|
23487
|
-
if (
|
|
23488
|
-
|
|
23487
|
+
if (path29.length === 0) {
|
|
23488
|
+
path29 = "/";
|
|
23489
23489
|
}
|
|
23490
|
-
return
|
|
23490
|
+
return path29;
|
|
23491
23491
|
}
|
|
23492
23492
|
function buildKey(opts) {
|
|
23493
|
-
const { path:
|
|
23493
|
+
const { path: path29, method, body, headers, query } = opts;
|
|
23494
23494
|
return {
|
|
23495
|
-
path:
|
|
23495
|
+
path: path29,
|
|
23496
23496
|
method,
|
|
23497
23497
|
body,
|
|
23498
23498
|
headers,
|
|
@@ -24182,10 +24182,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
24182
24182
|
}
|
|
24183
24183
|
format(pendingInterceptors) {
|
|
24184
24184
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
24185
|
-
({ method, path:
|
|
24185
|
+
({ method, path: path29, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
24186
24186
|
Method: method,
|
|
24187
24187
|
Origin: origin,
|
|
24188
|
-
Path:
|
|
24188
|
+
Path: path29,
|
|
24189
24189
|
"Status code": statusCode,
|
|
24190
24190
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
24191
24191
|
Invocations: timesInvoked,
|
|
@@ -24267,9 +24267,9 @@ var require_mock_agent = __commonJS({
|
|
|
24267
24267
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
24268
24268
|
const dispatchOpts = { ...opts };
|
|
24269
24269
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
24270
|
-
const [
|
|
24270
|
+
const [path29, searchParams] = dispatchOpts.path.split("?");
|
|
24271
24271
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
24272
|
-
dispatchOpts.path = `${
|
|
24272
|
+
dispatchOpts.path = `${path29}?${normalizedSearchParams}`;
|
|
24273
24273
|
}
|
|
24274
24274
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
24275
24275
|
}
|
|
@@ -24670,12 +24670,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
24670
24670
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
24671
24671
|
*/
|
|
24672
24672
|
async loadSnapshots(filePath) {
|
|
24673
|
-
const
|
|
24674
|
-
if (!
|
|
24673
|
+
const path29 = filePath || this.#snapshotPath;
|
|
24674
|
+
if (!path29) {
|
|
24675
24675
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
24676
24676
|
}
|
|
24677
24677
|
try {
|
|
24678
|
-
const data = await readFile3(resolve2(
|
|
24678
|
+
const data = await readFile3(resolve2(path29), "utf8");
|
|
24679
24679
|
const parsed = JSON.parse(data);
|
|
24680
24680
|
if (Array.isArray(parsed)) {
|
|
24681
24681
|
this.#snapshots.clear();
|
|
@@ -24689,7 +24689,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
24689
24689
|
if (error62.code === "ENOENT") {
|
|
24690
24690
|
this.#snapshots.clear();
|
|
24691
24691
|
} else {
|
|
24692
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
24692
|
+
throw new UndiciError(`Failed to load snapshots from ${path29}`, { cause: error62 });
|
|
24693
24693
|
}
|
|
24694
24694
|
}
|
|
24695
24695
|
}
|
|
@@ -24700,11 +24700,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
24700
24700
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
24701
24701
|
*/
|
|
24702
24702
|
async saveSnapshots(filePath) {
|
|
24703
|
-
const
|
|
24704
|
-
if (!
|
|
24703
|
+
const path29 = filePath || this.#snapshotPath;
|
|
24704
|
+
if (!path29) {
|
|
24705
24705
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
24706
24706
|
}
|
|
24707
|
-
const resolvedPath = resolve2(
|
|
24707
|
+
const resolvedPath = resolve2(path29);
|
|
24708
24708
|
await mkdir(dirname2(resolvedPath), { recursive: true });
|
|
24709
24709
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
24710
24710
|
hash: hash2,
|
|
@@ -25336,15 +25336,15 @@ var require_redirect_handler = __commonJS({
|
|
|
25336
25336
|
return;
|
|
25337
25337
|
}
|
|
25338
25338
|
const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
25339
|
-
const
|
|
25340
|
-
const redirectUrlString = `${origin}${
|
|
25339
|
+
const path29 = search ? `${pathname}${search}` : pathname;
|
|
25340
|
+
const redirectUrlString = `${origin}${path29}`;
|
|
25341
25341
|
for (const historyUrl of this.history) {
|
|
25342
25342
|
if (historyUrl.toString() === redirectUrlString) {
|
|
25343
25343
|
throw new InvalidArgumentError(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
|
|
25344
25344
|
}
|
|
25345
25345
|
}
|
|
25346
25346
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
25347
|
-
this.opts.path =
|
|
25347
|
+
this.opts.path = path29;
|
|
25348
25348
|
this.opts.origin = origin;
|
|
25349
25349
|
this.opts.query = null;
|
|
25350
25350
|
}
|
|
@@ -27104,10 +27104,10 @@ var require_cache_handler = __commonJS({
|
|
|
27104
27104
|
}
|
|
27105
27105
|
return locationUrl.pathname + locationUrl.search;
|
|
27106
27106
|
}
|
|
27107
|
-
function deleteCachedUri(store, cacheKey,
|
|
27107
|
+
function deleteCachedUri(store, cacheKey, path29) {
|
|
27108
27108
|
deleteCachedValue(store, {
|
|
27109
27109
|
...cacheKey,
|
|
27110
|
-
path:
|
|
27110
|
+
path: path29
|
|
27111
27111
|
});
|
|
27112
27112
|
for (let i = 0; i < util2.safeHTTPMethods.length; i++) {
|
|
27113
27113
|
const method = util2.safeHTTPMethods[i];
|
|
@@ -27115,7 +27115,7 @@ var require_cache_handler = __commonJS({
|
|
|
27115
27115
|
deleteCachedValue(store, {
|
|
27116
27116
|
...cacheKey,
|
|
27117
27117
|
method,
|
|
27118
|
-
path:
|
|
27118
|
+
path: path29
|
|
27119
27119
|
});
|
|
27120
27120
|
}
|
|
27121
27121
|
}
|
|
@@ -27126,9 +27126,9 @@ var require_cache_handler = __commonJS({
|
|
|
27126
27126
|
}
|
|
27127
27127
|
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
27128
27128
|
for (let i = 0; i < values.length; i++) {
|
|
27129
|
-
const
|
|
27130
|
-
if (
|
|
27131
|
-
deleteCachedUri(store, cacheKey,
|
|
27129
|
+
const path29 = getSameOriginPath(cacheKey, values[i]);
|
|
27130
|
+
if (path29 !== void 0) {
|
|
27131
|
+
deleteCachedUri(store, cacheKey, path29);
|
|
27132
27132
|
}
|
|
27133
27133
|
}
|
|
27134
27134
|
}
|
|
@@ -32128,11 +32128,11 @@ var require_fetch = __commonJS({
|
|
|
32128
32128
|
function dispatch({ body }) {
|
|
32129
32129
|
const url2 = requestCurrentURL(request2);
|
|
32130
32130
|
const agent = fetchParams.controller.dispatcher;
|
|
32131
|
-
const
|
|
32131
|
+
const path29 = url2.pathname + url2.search;
|
|
32132
32132
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
32133
32133
|
return new Promise((resolve2, reject) => agent.dispatch(
|
|
32134
32134
|
{
|
|
32135
|
-
path: hasTrailingQuestionMark ? `${
|
|
32135
|
+
path: hasTrailingQuestionMark ? `${path29}?` : path29,
|
|
32136
32136
|
origin: url2.origin,
|
|
32137
32137
|
method: request2.method,
|
|
32138
32138
|
body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body,
|
|
@@ -33079,9 +33079,9 @@ var require_util4 = __commonJS({
|
|
|
33079
33079
|
}
|
|
33080
33080
|
}
|
|
33081
33081
|
}
|
|
33082
|
-
function validateCookiePath(
|
|
33083
|
-
for (let i = 0; i <
|
|
33084
|
-
const code =
|
|
33082
|
+
function validateCookiePath(path29) {
|
|
33083
|
+
for (let i = 0; i < path29.length; ++i) {
|
|
33084
|
+
const code = path29.charCodeAt(i);
|
|
33085
33085
|
if (code < 32 || // exclude CTLs (0-31)
|
|
33086
33086
|
code > 126 || // exclude DEL and non-ascii
|
|
33087
33087
|
code === 59) {
|
|
@@ -36429,11 +36429,11 @@ var require_undici = __commonJS({
|
|
|
36429
36429
|
if (typeof opts.path !== "string") {
|
|
36430
36430
|
throw new InvalidArgumentError("invalid opts.path");
|
|
36431
36431
|
}
|
|
36432
|
-
let
|
|
36432
|
+
let path29 = opts.path;
|
|
36433
36433
|
if (!opts.path.startsWith("/")) {
|
|
36434
|
-
|
|
36434
|
+
path29 = `/${path29}`;
|
|
36435
36435
|
}
|
|
36436
|
-
url2 = new URL(util2.parseOrigin(url2).origin +
|
|
36436
|
+
url2 = new URL(util2.parseOrigin(url2).origin + path29);
|
|
36437
36437
|
} else {
|
|
36438
36438
|
if (!opts) {
|
|
36439
36439
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -36542,11 +36542,8 @@ ${captureLines}` : capture.stack;
|
|
|
36542
36542
|
}
|
|
36543
36543
|
});
|
|
36544
36544
|
|
|
36545
|
-
// src/
|
|
36546
|
-
import {
|
|
36547
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync11, openSync as openSync5, realpathSync as realpathSync4, rmSync as rmSync6 } from "node:fs";
|
|
36548
|
-
import path26 from "node:path";
|
|
36549
|
-
import { parseArgs } from "node:util";
|
|
36545
|
+
// src/clientFailure.ts
|
|
36546
|
+
import { constants } from "node:os";
|
|
36550
36547
|
|
|
36551
36548
|
// ../../apps/collector/src/credentials.ts
|
|
36552
36549
|
import { execFileSync } from "node:child_process";
|
|
@@ -37298,10 +37295,10 @@ function mergeDefs(...defs) {
|
|
|
37298
37295
|
function cloneDef(schema) {
|
|
37299
37296
|
return mergeDefs(schema._zod.def);
|
|
37300
37297
|
}
|
|
37301
|
-
function getElementAtPath(obj,
|
|
37302
|
-
if (!
|
|
37298
|
+
function getElementAtPath(obj, path29) {
|
|
37299
|
+
if (!path29)
|
|
37303
37300
|
return obj;
|
|
37304
|
-
return
|
|
37301
|
+
return path29.reduce((acc, key) => acc?.[key], obj);
|
|
37305
37302
|
}
|
|
37306
37303
|
function promiseAllObject(promisesObj) {
|
|
37307
37304
|
const keys = Object.keys(promisesObj);
|
|
@@ -37713,11 +37710,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
37713
37710
|
}
|
|
37714
37711
|
return false;
|
|
37715
37712
|
}
|
|
37716
|
-
function prefixIssues(
|
|
37713
|
+
function prefixIssues(path29, issues) {
|
|
37717
37714
|
return issues.map((iss) => {
|
|
37718
37715
|
var _a4;
|
|
37719
37716
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
37720
|
-
iss.path.unshift(
|
|
37717
|
+
iss.path.unshift(path29);
|
|
37721
37718
|
return iss;
|
|
37722
37719
|
});
|
|
37723
37720
|
}
|
|
@@ -38150,16 +38147,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
38150
38147
|
}
|
|
38151
38148
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
38152
38149
|
const fieldErrors = { _errors: [] };
|
|
38153
|
-
const processError = (error63,
|
|
38150
|
+
const processError = (error63, path29 = []) => {
|
|
38154
38151
|
for (const issue2 of error63.issues) {
|
|
38155
38152
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
38156
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
38153
|
+
issue2.errors.map((issues) => processError({ issues }, [...path29, ...issue2.path]));
|
|
38157
38154
|
} else if (issue2.code === "invalid_key") {
|
|
38158
|
-
processError({ issues: issue2.issues }, [...
|
|
38155
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
38159
38156
|
} else if (issue2.code === "invalid_element") {
|
|
38160
|
-
processError({ issues: issue2.issues }, [...
|
|
38157
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
38161
38158
|
} else {
|
|
38162
|
-
const fullpath = [...
|
|
38159
|
+
const fullpath = [...path29, ...issue2.path];
|
|
38163
38160
|
if (fullpath.length === 0) {
|
|
38164
38161
|
fieldErrors._errors.push(mapper(issue2));
|
|
38165
38162
|
} else {
|
|
@@ -38198,17 +38195,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
38198
38195
|
}
|
|
38199
38196
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
38200
38197
|
const result = { errors: [] };
|
|
38201
|
-
const processError = (error63,
|
|
38198
|
+
const processError = (error63, path29 = []) => {
|
|
38202
38199
|
var _a4;
|
|
38203
38200
|
for (const issue2 of error63.issues) {
|
|
38204
38201
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
38205
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
38202
|
+
issue2.errors.map((issues) => processError({ issues }, [...path29, ...issue2.path]));
|
|
38206
38203
|
} else if (issue2.code === "invalid_key") {
|
|
38207
|
-
processError({ issues: issue2.issues }, [...
|
|
38204
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
38208
38205
|
} else if (issue2.code === "invalid_element") {
|
|
38209
|
-
processError({ issues: issue2.issues }, [...
|
|
38206
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
38210
38207
|
} else {
|
|
38211
|
-
const fullpath = [...
|
|
38208
|
+
const fullpath = [...path29, ...issue2.path];
|
|
38212
38209
|
if (fullpath.length === 0) {
|
|
38213
38210
|
result.errors.push(mapper(issue2));
|
|
38214
38211
|
continue;
|
|
@@ -38247,8 +38244,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
38247
38244
|
}
|
|
38248
38245
|
function toDotPath(_path) {
|
|
38249
38246
|
const segs = [];
|
|
38250
|
-
const
|
|
38251
|
-
for (const seg of
|
|
38247
|
+
const path29 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
38248
|
+
for (const seg of path29) {
|
|
38252
38249
|
if (typeof seg === "number")
|
|
38253
38250
|
segs.push(`[${seg}]`);
|
|
38254
38251
|
else if (typeof seg === "symbol")
|
|
@@ -54758,13 +54755,13 @@ function resolveRef(ref, ctx) {
|
|
|
54758
54755
|
if (!ref.startsWith("#")) {
|
|
54759
54756
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
54760
54757
|
}
|
|
54761
|
-
const
|
|
54762
|
-
if (
|
|
54758
|
+
const path29 = ref.slice(1).split("/").filter(Boolean);
|
|
54759
|
+
if (path29.length === 0) {
|
|
54763
54760
|
return ctx.rootSchema;
|
|
54764
54761
|
}
|
|
54765
54762
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
54766
|
-
if (
|
|
54767
|
-
const key =
|
|
54763
|
+
if (path29[0] === defsKey) {
|
|
54764
|
+
const key = path29[1] === void 0 ? void 0 : decodeJSONPointerSegment(path29[1]);
|
|
54768
54765
|
if (!key || !ctx.defs[key]) {
|
|
54769
54766
|
throw new Error(`Reference not found: ${ref}`);
|
|
54770
54767
|
}
|
|
@@ -56053,8 +56050,8 @@ function primaryArg(args) {
|
|
|
56053
56050
|
function readFilePath(name, primary) {
|
|
56054
56051
|
if (!primary || !READ_TOOLS.has(name)) return null;
|
|
56055
56052
|
if (ARTIFACT_PATH_RE.test(primary)) return null;
|
|
56056
|
-
const
|
|
56057
|
-
return
|
|
56053
|
+
const path29 = primary.startsWith("/workspace/") ? primary.slice("/workspace/".length) : primary;
|
|
56054
|
+
return path29.length > 0 ? path29 : null;
|
|
56058
56055
|
}
|
|
56059
56056
|
function asRecord3(value) {
|
|
56060
56057
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
@@ -56461,6 +56458,21 @@ var HARNESS_SESSION_RULES = {
|
|
|
56461
56458
|
evidence: external_exports.object({ thread_source: external_exports.enum(["subagent", "guardian_review"]) })
|
|
56462
56459
|
},
|
|
56463
56460
|
{ fact: "subagent", evidence: external_exports.object({ source: external_exports.object({ subagent: external_exports.object({}) }) }) },
|
|
56461
|
+
{
|
|
56462
|
+
fact: "standaloneReview",
|
|
56463
|
+
evidence: external_exports.object({
|
|
56464
|
+
source: external_exports.literal("exec"),
|
|
56465
|
+
thread_source: external_exports.literal("user"),
|
|
56466
|
+
// The adapter supplies the record immediately after session_meta.
|
|
56467
|
+
initialEvent: external_exports.object({
|
|
56468
|
+
type: external_exports.literal("event_msg"),
|
|
56469
|
+
payload: external_exports.object({
|
|
56470
|
+
type: external_exports.literal("item_completed"),
|
|
56471
|
+
item: external_exports.object({ type: external_exports.literal("EnteredReviewMode") })
|
|
56472
|
+
})
|
|
56473
|
+
})
|
|
56474
|
+
})
|
|
56475
|
+
},
|
|
56464
56476
|
{ fact: "archived", evidence: external_exports.object({ archived: trueFlag }) }
|
|
56465
56477
|
],
|
|
56466
56478
|
cursor: [
|
|
@@ -56668,8 +56680,8 @@ function getFunctionName(fn) {
|
|
|
56668
56680
|
return defaultFunctionName;
|
|
56669
56681
|
}
|
|
56670
56682
|
}
|
|
56671
|
-
function normalizeStackTracePath(
|
|
56672
|
-
let filename =
|
|
56683
|
+
function normalizeStackTracePath(path29) {
|
|
56684
|
+
let filename = path29?.startsWith("file://") ? path29.slice(7) : path29;
|
|
56673
56685
|
if (filename?.match(/\/[A-Z]:/)) {
|
|
56674
56686
|
filename = filename.slice(1);
|
|
56675
56687
|
}
|
|
@@ -58479,8 +58491,8 @@ function isValidProtocol(protocol) {
|
|
|
58479
58491
|
return protocol === "http" || protocol === "https";
|
|
58480
58492
|
}
|
|
58481
58493
|
function dsnToString(dsn, withPassword = false) {
|
|
58482
|
-
const { host, path:
|
|
58483
|
-
return `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ""}@${host}${port ? `:${port}` : ""}/${
|
|
58494
|
+
const { host, path: path29, pass, port, projectId, protocol, publicKey } = dsn;
|
|
58495
|
+
return `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ""}@${host}${port ? `:${port}` : ""}/${path29 ? `${path29}/` : path29}${projectId}`;
|
|
58484
58496
|
}
|
|
58485
58497
|
function dsnFromString(str) {
|
|
58486
58498
|
const match = DSN_REGEX.exec(str);
|
|
@@ -58491,11 +58503,11 @@ function dsnFromString(str) {
|
|
|
58491
58503
|
return void 0;
|
|
58492
58504
|
}
|
|
58493
58505
|
const [protocol, publicKey, pass = "", host = "", port = "", lastPath = ""] = match.slice(1);
|
|
58494
|
-
let
|
|
58506
|
+
let path29 = "";
|
|
58495
58507
|
let projectId = lastPath;
|
|
58496
58508
|
const split = projectId.split("/");
|
|
58497
58509
|
if (split.length > 1) {
|
|
58498
|
-
|
|
58510
|
+
path29 = split.slice(0, -1).join("/");
|
|
58499
58511
|
projectId = split.pop();
|
|
58500
58512
|
}
|
|
58501
58513
|
if (projectId) {
|
|
@@ -58504,7 +58516,7 @@ function dsnFromString(str) {
|
|
|
58504
58516
|
projectId = projectMatch[0];
|
|
58505
58517
|
}
|
|
58506
58518
|
}
|
|
58507
|
-
return dsnFromComponents({ host, pass, path:
|
|
58519
|
+
return dsnFromComponents({ host, pass, path: path29, projectId, port, protocol, publicKey });
|
|
58508
58520
|
}
|
|
58509
58521
|
function dsnFromComponents(components) {
|
|
58510
58522
|
return {
|
|
@@ -63038,9 +63050,9 @@ function stripUrlQueryAndFragment(urlPath) {
|
|
|
63038
63050
|
return urlPath.split(/[?#]/, 1)[0];
|
|
63039
63051
|
}
|
|
63040
63052
|
function getSanitizedUrlString(url2) {
|
|
63041
|
-
const { protocol, host, path:
|
|
63053
|
+
const { protocol, host, path: path29 } = url2;
|
|
63042
63054
|
const filteredHost = host?.replace(/^.*@/, "[filtered]:[filtered]@").replace(/(:80)$/, "").replace(/(:443)$/, "") || "";
|
|
63043
|
-
return `${protocol ? `${protocol}://` : ""}${filteredHost}${
|
|
63055
|
+
return `${protocol ? `${protocol}://` : ""}${filteredHost}${path29}`;
|
|
63044
63056
|
}
|
|
63045
63057
|
function stripDataUrlContent(url2, includeDataPrefix = true) {
|
|
63046
63058
|
if (url2.startsWith("data:")) {
|
|
@@ -63983,8 +63995,8 @@ function splitPath(filename) {
|
|
|
63983
63995
|
const parts = splitPathRe.exec(truncated);
|
|
63984
63996
|
return parts ? parts.slice(1) : [];
|
|
63985
63997
|
}
|
|
63986
|
-
function dirname(
|
|
63987
|
-
const result = splitPath(
|
|
63998
|
+
function dirname(path29) {
|
|
63999
|
+
const result = splitPath(path29);
|
|
63988
64000
|
const root = result[0] || "";
|
|
63989
64001
|
let dir = result[1];
|
|
63990
64002
|
if (!root && !dir) {
|
|
@@ -67807,15 +67819,15 @@ var getLayerMetadata = (route, layer, layerPath) => {
|
|
|
67807
67819
|
};
|
|
67808
67820
|
}
|
|
67809
67821
|
};
|
|
67810
|
-
var getRouterPath = (
|
|
67822
|
+
var getRouterPath = (path29, layer) => {
|
|
67811
67823
|
const stackLayer = Array.isArray(layer.handle?.stack) ? layer.handle?.stack?.[0] : void 0;
|
|
67812
67824
|
if (stackLayer?.route?.path) {
|
|
67813
|
-
return `${
|
|
67825
|
+
return `${path29}${stackLayer.route.path}`;
|
|
67814
67826
|
}
|
|
67815
67827
|
if (stackLayer && Array.isArray(stackLayer?.handle?.stack)) {
|
|
67816
|
-
return getRouterPath(
|
|
67828
|
+
return getRouterPath(path29, stackLayer);
|
|
67817
67829
|
}
|
|
67818
|
-
return
|
|
67830
|
+
return path29;
|
|
67819
67831
|
};
|
|
67820
67832
|
var isLayerIgnored = (name, type, config2) => {
|
|
67821
67833
|
if (Array.isArray(config2?.ignoreLayersType) && config2?.ignoreLayersType?.includes(type)) {
|
|
@@ -67835,7 +67847,7 @@ function getActualMatchedRoute(req, constructedRoute) {
|
|
|
67835
67847
|
if (layersStore.length === 0) {
|
|
67836
67848
|
return void 0;
|
|
67837
67849
|
}
|
|
67838
|
-
if (layersStore.every((
|
|
67850
|
+
if (layersStore.every((path29) => path29 === "/")) {
|
|
67839
67851
|
return req.originalUrl === "/" ? "/" : void 0;
|
|
67840
67852
|
}
|
|
67841
67853
|
if (constructedRoute === "*") {
|
|
@@ -67851,11 +67863,11 @@ function getActualMatchedRoute(req, constructedRoute) {
|
|
|
67851
67863
|
function getConstructedRoute(req) {
|
|
67852
67864
|
const layersStore = getStoredLayers(req);
|
|
67853
67865
|
let constructedRoute = "";
|
|
67854
|
-
for (const
|
|
67855
|
-
if (
|
|
67866
|
+
for (const path29 of layersStore) {
|
|
67867
|
+
if (path29 === "/" || path29 === "/*") {
|
|
67856
67868
|
continue;
|
|
67857
67869
|
}
|
|
67858
|
-
constructedRoute += !constructedRoute || constructedRoute.endsWith("/") ?
|
|
67870
|
+
constructedRoute += !constructedRoute || constructedRoute.endsWith("/") ? path29 : `/${path29}`;
|
|
67859
67871
|
}
|
|
67860
67872
|
return constructedRoute.replace(/\/{2,}/g, "/");
|
|
67861
67873
|
}
|
|
@@ -68360,9 +68372,9 @@ function getRequestUrlObject(requestOptions) {
|
|
|
68360
68372
|
const hostHeader = requestOptions.headers?.host && String(requestOptions.headers?.host);
|
|
68361
68373
|
const hostname4 = hostHeader || requestOptions.hostname || requestOptions.host || "";
|
|
68362
68374
|
const port = !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^(.*):(\d+)$/.test(hostname4) ? "" : `:${requestOptions.port}`;
|
|
68363
|
-
const
|
|
68375
|
+
const path29 = requestOptions.path ? requestOptions.path : "/";
|
|
68364
68376
|
const base = `${protocol}//${hostname4}${port}`;
|
|
68365
|
-
return new URL(
|
|
68377
|
+
return new URL(path29.startsWith("//") ? `${base}${path29}` : path29, base);
|
|
68366
68378
|
}
|
|
68367
68379
|
function getRequestUrlFromClientRequest(request2) {
|
|
68368
68380
|
return String(getRequestUrl(getRequestOptions(request2)));
|
|
@@ -69035,11 +69047,11 @@ function shouldIgnoreSpansForIncomingRequest(request2, {
|
|
|
69035
69047
|
return false;
|
|
69036
69048
|
}
|
|
69037
69049
|
function isStaticAssetRequest(urlPath) {
|
|
69038
|
-
const
|
|
69039
|
-
if (
|
|
69050
|
+
const path29 = stripUrlQueryAndFragment(urlPath);
|
|
69051
|
+
if (path29.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {
|
|
69040
69052
|
return true;
|
|
69041
69053
|
}
|
|
69042
|
-
if (
|
|
69054
|
+
if (path29.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) {
|
|
69043
69055
|
return true;
|
|
69044
69056
|
}
|
|
69045
69057
|
return false;
|
|
@@ -69280,11 +69292,11 @@ function isKnownPrefetchRequest2(req) {
|
|
|
69280
69292
|
return req.headers["next-router-prefetch"] === "1";
|
|
69281
69293
|
}
|
|
69282
69294
|
function isStaticAssetRequest2(urlPath) {
|
|
69283
|
-
const
|
|
69284
|
-
if (
|
|
69295
|
+
const path29 = stripUrlQueryAndFragment(urlPath);
|
|
69296
|
+
if (path29.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {
|
|
69285
69297
|
return true;
|
|
69286
69298
|
}
|
|
69287
|
-
if (
|
|
69299
|
+
if (path29.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) {
|
|
69288
69300
|
return true;
|
|
69289
69301
|
}
|
|
69290
69302
|
return false;
|
|
@@ -69644,19 +69656,19 @@ function getBreadcrumbData(request2) {
|
|
|
69644
69656
|
return {};
|
|
69645
69657
|
}
|
|
69646
69658
|
}
|
|
69647
|
-
function getAbsoluteUrl2(origin,
|
|
69659
|
+
function getAbsoluteUrl2(origin, path29 = "/") {
|
|
69648
69660
|
try {
|
|
69649
|
-
const url2 = new URL(
|
|
69661
|
+
const url2 = new URL(path29, origin);
|
|
69650
69662
|
return url2.toString();
|
|
69651
69663
|
} catch {
|
|
69652
69664
|
const url2 = `${origin}`;
|
|
69653
|
-
if (url2.endsWith("/") &&
|
|
69654
|
-
return `${url2}${
|
|
69665
|
+
if (url2.endsWith("/") && path29.startsWith("/")) {
|
|
69666
|
+
return `${url2}${path29.slice(1)}`;
|
|
69655
69667
|
}
|
|
69656
|
-
if (!url2.endsWith("/") && !
|
|
69657
|
-
return `${url2}/${
|
|
69668
|
+
if (!url2.endsWith("/") && !path29.startsWith("/")) {
|
|
69669
|
+
return `${url2}/${path29}`;
|
|
69658
69670
|
}
|
|
69659
|
-
return `${url2}${
|
|
69671
|
+
return `${url2}${path29}`;
|
|
69660
69672
|
}
|
|
69661
69673
|
}
|
|
69662
69674
|
|
|
@@ -69901,15 +69913,15 @@ function getRequestMethod(original) {
|
|
|
69901
69913
|
}
|
|
69902
69914
|
return "_OTHER";
|
|
69903
69915
|
}
|
|
69904
|
-
function getAbsoluteUrl3(origin,
|
|
69916
|
+
function getAbsoluteUrl3(origin, path29 = "/") {
|
|
69905
69917
|
const url2 = `${origin}`;
|
|
69906
|
-
if (url2.endsWith("/") &&
|
|
69907
|
-
return `${url2}${
|
|
69918
|
+
if (url2.endsWith("/") && path29.startsWith("/")) {
|
|
69919
|
+
return `${url2}${path29.slice(1)}`;
|
|
69908
69920
|
}
|
|
69909
|
-
if (!url2.endsWith("/") && !
|
|
69910
|
-
return `${url2}/${
|
|
69921
|
+
if (!url2.endsWith("/") && !path29.startsWith("/")) {
|
|
69922
|
+
return `${url2}/${path29}`;
|
|
69911
69923
|
}
|
|
69912
|
-
return `${url2}${
|
|
69924
|
+
return `${url2}${path29}`;
|
|
69913
69925
|
}
|
|
69914
69926
|
|
|
69915
69927
|
// ../../node_modules/.pnpm/@sentry+node-core@10.73.0_@opentelemetry+api@1.9.1_@opentelemetry+core@2.11.0_@opentele_0c1f249c3fa9afb330ae7de0346c118f/node_modules/@sentry/node-core/build/esm/integrations/node-fetch/index.js
|
|
@@ -72395,12 +72407,12 @@ function emplace(map2, key, contents) {
|
|
|
72395
72407
|
}
|
|
72396
72408
|
return value;
|
|
72397
72409
|
}
|
|
72398
|
-
function shouldSkipContextLinesForFile(
|
|
72399
|
-
if (
|
|
72400
|
-
if (
|
|
72401
|
-
if (
|
|
72402
|
-
if (
|
|
72403
|
-
if (
|
|
72410
|
+
function shouldSkipContextLinesForFile(path29) {
|
|
72411
|
+
if (path29.startsWith("node:")) return true;
|
|
72412
|
+
if (path29.endsWith(".min.js")) return true;
|
|
72413
|
+
if (path29.endsWith(".min.cjs")) return true;
|
|
72414
|
+
if (path29.endsWith(".min.mjs")) return true;
|
|
72415
|
+
if (path29.startsWith("data:")) return true;
|
|
72404
72416
|
return false;
|
|
72405
72417
|
}
|
|
72406
72418
|
function shouldSkipContextLinesForFrame(frame) {
|
|
@@ -72448,9 +72460,9 @@ function makeLineReaderRanges(lines, linecontext) {
|
|
|
72448
72460
|
}
|
|
72449
72461
|
return out;
|
|
72450
72462
|
}
|
|
72451
|
-
function getContextLinesFromFile(
|
|
72463
|
+
function getContextLinesFromFile(path29, ranges, output2) {
|
|
72452
72464
|
return new Promise((resolve2, _reject) => {
|
|
72453
|
-
const stream = createReadStream(
|
|
72465
|
+
const stream = createReadStream(path29);
|
|
72454
72466
|
const lineReaded = createInterface({
|
|
72455
72467
|
input: stream
|
|
72456
72468
|
});
|
|
@@ -72468,8 +72480,8 @@ function getContextLinesFromFile(path27, ranges, output2) {
|
|
|
72468
72480
|
let rangeStart = range[0];
|
|
72469
72481
|
let rangeEnd = range[1];
|
|
72470
72482
|
function onStreamError(e) {
|
|
72471
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
72472
|
-
DEBUG_BUILD2 && debug.error(`Failed to read file: ${
|
|
72483
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path29, 1);
|
|
72484
|
+
DEBUG_BUILD2 && debug.error(`Failed to read file: ${path29}. Error: ${e}`);
|
|
72473
72485
|
lineReaded.close();
|
|
72474
72486
|
lineReaded.removeAllListeners();
|
|
72475
72487
|
destroyStreamAndResolve();
|
|
@@ -73908,8 +73920,8 @@ function getSpotlightConfig(optionsSpotlight) {
|
|
|
73908
73920
|
|
|
73909
73921
|
// ../../node_modules/.pnpm/@sentry+node-core@10.73.0_@opentelemetry+api@1.9.1_@opentelemetry+core@2.11.0_@opentele_0c1f249c3fa9afb330ae7de0346c118f/node_modules/@sentry/node-core/build/esm/utils/module.js
|
|
73910
73922
|
import { posix, sep } from "node:path";
|
|
73911
|
-
function normalizeWindowsPath(
|
|
73912
|
-
return
|
|
73923
|
+
function normalizeWindowsPath(path29) {
|
|
73924
|
+
return path29.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
73913
73925
|
}
|
|
73914
73926
|
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname(process.argv[1]) : process.cwd(), isWindows = sep === "\\") {
|
|
73915
73927
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
@@ -76785,22 +76797,22 @@ function addSpanSource(span, loc, start, end) {
|
|
|
76785
76797
|
span.setAttribute(AttributeNames2.SOURCE, source);
|
|
76786
76798
|
}
|
|
76787
76799
|
}
|
|
76788
|
-
function createFieldIfNotExists(contextValue, info,
|
|
76789
|
-
let field = getField(contextValue,
|
|
76800
|
+
function createFieldIfNotExists(contextValue, info, path29) {
|
|
76801
|
+
let field = getField(contextValue, path29);
|
|
76790
76802
|
if (field) {
|
|
76791
76803
|
return { field, spanAdded: false };
|
|
76792
76804
|
}
|
|
76793
|
-
const parentSpan = getParentFieldSpan(contextValue,
|
|
76805
|
+
const parentSpan = getParentFieldSpan(contextValue, path29);
|
|
76794
76806
|
field = {
|
|
76795
|
-
span: createResolverSpan(contextValue, info,
|
|
76807
|
+
span: createResolverSpan(contextValue, info, path29, parentSpan)
|
|
76796
76808
|
};
|
|
76797
|
-
addField(contextValue,
|
|
76809
|
+
addField(contextValue, path29, field);
|
|
76798
76810
|
return { field, spanAdded: true };
|
|
76799
76811
|
}
|
|
76800
|
-
function createResolverSpan(contextValue, info,
|
|
76812
|
+
function createResolverSpan(contextValue, info, path29, parentSpan) {
|
|
76801
76813
|
const attributes = {
|
|
76802
76814
|
[AttributeNames2.FIELD_NAME]: info.fieldName,
|
|
76803
|
-
[AttributeNames2.FIELD_PATH]:
|
|
76815
|
+
[AttributeNames2.FIELD_PATH]: path29.join("."),
|
|
76804
76816
|
[AttributeNames2.FIELD_TYPE]: info.returnType.toString(),
|
|
76805
76817
|
[AttributeNames2.PARENT_NAME]: info.parentType.name
|
|
76806
76818
|
};
|
|
@@ -76832,15 +76844,15 @@ function getOperation(document2, operationName) {
|
|
|
76832
76844
|
return document2.definitions.find((definition) => OPERATION_VALUES.indexOf(definition?.operation) !== -1);
|
|
76833
76845
|
}
|
|
76834
76846
|
}
|
|
76835
|
-
function addField(contextValue,
|
|
76836
|
-
return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].fields[
|
|
76847
|
+
function addField(contextValue, path29, field) {
|
|
76848
|
+
return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].fields[path29.join(".")] = field;
|
|
76837
76849
|
}
|
|
76838
|
-
function getField(contextValue,
|
|
76839
|
-
return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].fields[
|
|
76850
|
+
function getField(contextValue, path29) {
|
|
76851
|
+
return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].fields[path29.join(".")];
|
|
76840
76852
|
}
|
|
76841
|
-
function getParentFieldSpan(contextValue,
|
|
76842
|
-
for (let i =
|
|
76843
|
-
const field = getField(contextValue,
|
|
76853
|
+
function getParentFieldSpan(contextValue, path29) {
|
|
76854
|
+
for (let i = path29.length - 1; i > 0; i--) {
|
|
76855
|
+
const field = getField(contextValue, path29.slice(0, i));
|
|
76844
76856
|
if (field) {
|
|
76845
76857
|
return field.span;
|
|
76846
76858
|
}
|
|
@@ -76850,9 +76862,9 @@ function getParentFieldSpan(contextValue, path27) {
|
|
|
76850
76862
|
function getRootSpan2(contextValue) {
|
|
76851
76863
|
return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].span;
|
|
76852
76864
|
}
|
|
76853
|
-
function pathToArray(
|
|
76865
|
+
function pathToArray(path29) {
|
|
76854
76866
|
const flattened = [];
|
|
76855
|
-
let curr =
|
|
76867
|
+
let curr = path29;
|
|
76856
76868
|
while (curr) {
|
|
76857
76869
|
flattened.push(String(curr.key));
|
|
76858
76870
|
curr = curr.prev;
|
|
@@ -76993,8 +77005,8 @@ function wrapFieldResolver(getConfig3, fieldResolver, isDefaultResolver = false)
|
|
|
76993
77005
|
if (!contextValue[OTEL_GRAPHQL_DATA_SYMBOL]) {
|
|
76994
77006
|
return fieldResolver.call(this, source, args, contextValue, info);
|
|
76995
77007
|
}
|
|
76996
|
-
const
|
|
76997
|
-
const { field, spanAdded } = createFieldIfNotExists(contextValue, info,
|
|
77008
|
+
const path29 = pathToArray(info?.path);
|
|
77009
|
+
const { field, spanAdded } = createFieldIfNotExists(contextValue, info, path29);
|
|
76998
77010
|
const span = field.span;
|
|
76999
77011
|
const shouldEndSpan = spanAdded;
|
|
77000
77012
|
return withActiveSpan(span, () => {
|
|
@@ -79977,10 +79989,10 @@ var PostgresJsInstrumentation = class extends import_instrumentation24.Instrumen
|
|
|
79977
79989
|
},
|
|
79978
79990
|
(exports) => exports
|
|
79979
79991
|
);
|
|
79980
|
-
["src", "cf/src", "cjs/src"].forEach((
|
|
79992
|
+
["src", "cf/src", "cjs/src"].forEach((path29) => {
|
|
79981
79993
|
module2.files.push(
|
|
79982
79994
|
new InstrumentationNodeModuleFile(
|
|
79983
|
-
`postgres/${
|
|
79995
|
+
`postgres/${path29}/query.js`,
|
|
79984
79996
|
SUPPORTED_VERSIONS4,
|
|
79985
79997
|
this._patchQueryPrototype.bind(this),
|
|
79986
79998
|
this._unpatchQueryPrototype.bind(this)
|
|
@@ -80611,13 +80623,13 @@ var HonoInstrumentation = class extends import_instrumentation27.Instrumentation
|
|
|
80611
80623
|
return function(original) {
|
|
80612
80624
|
return function wrappedHandler(...args) {
|
|
80613
80625
|
if (typeof args[0] === "string") {
|
|
80614
|
-
const
|
|
80626
|
+
const path29 = args[0];
|
|
80615
80627
|
if (args.length === 1) {
|
|
80616
|
-
return original.apply(this, [
|
|
80628
|
+
return original.apply(this, [path29]);
|
|
80617
80629
|
}
|
|
80618
80630
|
const handlers2 = args.slice(1);
|
|
80619
80631
|
return original.apply(this, [
|
|
80620
|
-
|
|
80632
|
+
path29,
|
|
80621
80633
|
...handlers2.map((handler) => instrumentation._wrapHandler(handler))
|
|
80622
80634
|
]);
|
|
80623
80635
|
}
|
|
@@ -80651,13 +80663,13 @@ var HonoInstrumentation = class extends import_instrumentation27.Instrumentation
|
|
|
80651
80663
|
return function(original) {
|
|
80652
80664
|
return function wrappedHandler(...args) {
|
|
80653
80665
|
if (typeof args[0] === "string") {
|
|
80654
|
-
const
|
|
80666
|
+
const path29 = args[0];
|
|
80655
80667
|
if (args.length === 1) {
|
|
80656
|
-
return original.apply(this, [
|
|
80668
|
+
return original.apply(this, [path29]);
|
|
80657
80669
|
}
|
|
80658
80670
|
const handlers2 = args.slice(1);
|
|
80659
80671
|
return original.apply(this, [
|
|
80660
|
-
|
|
80672
|
+
path29,
|
|
80661
80673
|
...handlers2.map((handler) => instrumentation._wrapHandler(handler))
|
|
80662
80674
|
]);
|
|
80663
80675
|
}
|
|
@@ -80677,8 +80689,8 @@ var HonoInstrumentation = class extends import_instrumentation27.Instrumentation
|
|
|
80677
80689
|
if (!instrumentation.isEnabled()) {
|
|
80678
80690
|
return handler.apply(this, [c, next]);
|
|
80679
80691
|
}
|
|
80680
|
-
const
|
|
80681
|
-
const span = instrumentation.tracer.startSpan(
|
|
80692
|
+
const path29 = c.req.path;
|
|
80693
|
+
const span = instrumentation.tracer.startSpan(path29);
|
|
80682
80694
|
return context.with(trace.setSpan(context.active(), span), () => {
|
|
80683
80695
|
return instrumentation._safeExecute(
|
|
80684
80696
|
() => {
|
|
@@ -80688,7 +80700,7 @@ var HonoInstrumentation = class extends import_instrumentation27.Instrumentation
|
|
|
80688
80700
|
const type = instrumentation._determineHandlerType(result2);
|
|
80689
80701
|
span.setAttributes({
|
|
80690
80702
|
[AttributeNames5.HONO_TYPE]: type,
|
|
80691
|
-
[AttributeNames5.HONO_NAME]: type === HonoTypes.REQUEST_HANDLER ?
|
|
80703
|
+
[AttributeNames5.HONO_NAME]: type === HonoTypes.REQUEST_HANDLER ? path29 : handler.name || "anonymous"
|
|
80692
80704
|
});
|
|
80693
80705
|
instrumentation.getConfig().responseHook?.(span);
|
|
80694
80706
|
return result2;
|
|
@@ -80697,7 +80709,7 @@ var HonoInstrumentation = class extends import_instrumentation27.Instrumentation
|
|
|
80697
80709
|
const type = instrumentation._determineHandlerType(result);
|
|
80698
80710
|
span.setAttributes({
|
|
80699
80711
|
[AttributeNames5.HONO_TYPE]: type,
|
|
80700
|
-
[AttributeNames5.HONO_NAME]: type === HonoTypes.REQUEST_HANDLER ?
|
|
80712
|
+
[AttributeNames5.HONO_NAME]: type === HonoTypes.REQUEST_HANDLER ? path29 : handler.name || "anonymous"
|
|
80701
80713
|
});
|
|
80702
80714
|
instrumentation.getConfig().responseHook?.(span);
|
|
80703
80715
|
return result;
|
|
@@ -80901,11 +80913,11 @@ var KoaInstrumentation = class extends import_instrumentation29.InstrumentationB
|
|
|
80901
80913
|
const router = dispatchLayer.router;
|
|
80902
80914
|
const routesStack = router?.stack ?? [];
|
|
80903
80915
|
for (const pathLayer of routesStack) {
|
|
80904
|
-
const
|
|
80916
|
+
const path29 = pathLayer.path;
|
|
80905
80917
|
const pathStack = pathLayer.stack;
|
|
80906
80918
|
for (let j = 0; j < pathStack.length; j++) {
|
|
80907
80919
|
const routedMiddleware = pathStack[j];
|
|
80908
|
-
pathStack[j] = this._patchLayer(routedMiddleware, true,
|
|
80920
|
+
pathStack[j] = this._patchLayer(routedMiddleware, true, path29);
|
|
80909
80921
|
}
|
|
80910
80922
|
}
|
|
80911
80923
|
return dispatchLayer;
|
|
@@ -83359,7 +83371,7 @@ import os6 from "node:os";
|
|
|
83359
83371
|
// ../../apps/collector/src/http.ts
|
|
83360
83372
|
var import_undici = __toESM(require_undici(), 1);
|
|
83361
83373
|
var CLI_VERSION_HEADER = "x-powerplant-cli-version";
|
|
83362
|
-
var cliVersion = true ? "0.4.
|
|
83374
|
+
var cliVersion = true ? "0.4.6" : "0.0.0-checkout";
|
|
83363
83375
|
function cliVersionHeaders() {
|
|
83364
83376
|
return { [CLI_VERSION_HEADER]: cliVersion, "user-agent": `powerplant-cli/${cliVersion}` };
|
|
83365
83377
|
}
|
|
@@ -86109,13 +86121,22 @@ function allowProtectedRepoDiscovery(config2, found, environment = {}, deps = de
|
|
|
86109
86121
|
const needsReview = new ProtectedRootTally(environment);
|
|
86110
86122
|
for (const entry of found) {
|
|
86111
86123
|
const probes = entry.folders.flatMap(
|
|
86112
|
-
(folder) => folder.cwds.map((cwd) => ({ cwd, probe: probeOf(cwd),
|
|
86124
|
+
(folder) => folder.cwds.map((cwd) => ({ cwd, probe: probeOf(cwd), folder }))
|
|
86113
86125
|
);
|
|
86114
86126
|
let unconsented = 0;
|
|
86115
|
-
|
|
86127
|
+
const countedFolderTargets = /* @__PURE__ */ new Set();
|
|
86128
|
+
for (const { cwd, probe, folder } of probes) {
|
|
86116
86129
|
if (probe.kind !== "unconsented") continue;
|
|
86117
86130
|
unconsented += 1;
|
|
86118
|
-
|
|
86131
|
+
const checkout = checkoutOfGitDir(probe.path);
|
|
86132
|
+
const target = [folder.path, probe.root, checkout].join("\0");
|
|
86133
|
+
needsReview.add(
|
|
86134
|
+
probe.root,
|
|
86135
|
+
checkout,
|
|
86136
|
+
cwd,
|
|
86137
|
+
countedFolderTargets.has(target) ? 0 : folder.sessionCount
|
|
86138
|
+
);
|
|
86139
|
+
countedFolderTargets.add(target);
|
|
86119
86140
|
}
|
|
86120
86141
|
if (probes.some(({ probe }) => probe.kind === "found")) outcome.enabled.push(entry);
|
|
86121
86142
|
else if (probes.some(({ probe }) => probe.kind === "denied")) outcome.blocked.push(entry);
|
|
@@ -87818,22 +87839,96 @@ function describeDelay(ms) {
|
|
|
87818
87839
|
}
|
|
87819
87840
|
|
|
87820
87841
|
// ../../apps/collector/src/localSessionFacts.ts
|
|
87821
|
-
import { existsSync as existsSync7, readdirSync as readdirSync4 } from "node:fs";
|
|
87842
|
+
import { existsSync as existsSync7, readdirSync as readdirSync4, statSync as statSync4 } from "node:fs";
|
|
87822
87843
|
import os16 from "node:os";
|
|
87844
|
+
import path18 from "node:path";
|
|
87845
|
+
|
|
87846
|
+
// ../../apps/collector/src/codexReviewFacts.ts
|
|
87847
|
+
import { closeSync as closeSync4, lstatSync as lstatSync4, openSync as openSync4, readSync as readSync4, realpathSync as realpathSync3 } from "node:fs";
|
|
87823
87848
|
import path17 from "node:path";
|
|
87849
|
+
var pointerSchema = external_exports.object({
|
|
87850
|
+
source: external_exports.unknown().optional(),
|
|
87851
|
+
rollout_path: external_exports.string().nullish()
|
|
87852
|
+
});
|
|
87853
|
+
var metaSchema = external_exports.object({
|
|
87854
|
+
type: external_exports.literal("session_meta"),
|
|
87855
|
+
payload: external_exports.object({
|
|
87856
|
+
id: external_exports.string(),
|
|
87857
|
+
source: external_exports.unknown().optional(),
|
|
87858
|
+
thread_source: external_exports.string().optional()
|
|
87859
|
+
})
|
|
87860
|
+
});
|
|
87861
|
+
var MAX_PREFIX_BYTES = 256 * 1024;
|
|
87862
|
+
function readCodexReviewFacts(row, id, home) {
|
|
87863
|
+
const pointer = pointerSchema.parse(row);
|
|
87864
|
+
if (pointer.source !== "exec" || !pointer.rollout_path) return {};
|
|
87865
|
+
const file2 = pointer.rollout_path;
|
|
87866
|
+
if (!path17.isAbsolute(file2) || !file2.endsWith(".jsonl")) return {};
|
|
87867
|
+
const root = ["sessions", "archived_sessions"].map((store) => path17.join(home, ".codex", store)).find((store) => {
|
|
87868
|
+
const relative2 = path17.relative(store, file2);
|
|
87869
|
+
return relative2 !== "" && relative2 !== ".." && !relative2.startsWith(`..${path17.sep}`) && !path17.isAbsolute(relative2);
|
|
87870
|
+
});
|
|
87871
|
+
if (!root) return {};
|
|
87872
|
+
try {
|
|
87873
|
+
if (!lstatSync4(file2).isFile() || realpathSync3(file2) !== path17.join(realpathSync3(root), path17.relative(root, file2))) return {};
|
|
87874
|
+
const records = readPrefix(file2);
|
|
87875
|
+
if (records === null) return {};
|
|
87876
|
+
const meta3 = metaSchema.safeParse(records[0]);
|
|
87877
|
+
if (!meta3.success || meta3.data.payload.id !== id) return {};
|
|
87878
|
+
return harnessSessionFacts("codex", { ...meta3.data.payload, initialEvent: records[1] });
|
|
87879
|
+
} catch (error62) {
|
|
87880
|
+
if (error62 instanceof Error && "code" in error62 && error62.code === "ENOENT") return {};
|
|
87881
|
+
throw error62;
|
|
87882
|
+
}
|
|
87883
|
+
}
|
|
87884
|
+
function readPrefix(file2) {
|
|
87885
|
+
const fd = openSync4(file2, "r");
|
|
87886
|
+
const buffer = Buffer.alloc(MAX_PREFIX_BYTES);
|
|
87887
|
+
let used = 0;
|
|
87888
|
+
let first = -1;
|
|
87889
|
+
let second = -1;
|
|
87890
|
+
try {
|
|
87891
|
+
while (used < buffer.length && second < 0) {
|
|
87892
|
+
const bytes = readSync4(fd, buffer, used, Math.min(4096, buffer.length - used), null);
|
|
87893
|
+
if (bytes === 0) break;
|
|
87894
|
+
const end = used + bytes;
|
|
87895
|
+
for (let i = used; i < end; i++) {
|
|
87896
|
+
if (buffer[i] !== 10) continue;
|
|
87897
|
+
if (first < 0) first = i;
|
|
87898
|
+
else {
|
|
87899
|
+
second = i;
|
|
87900
|
+
break;
|
|
87901
|
+
}
|
|
87902
|
+
}
|
|
87903
|
+
used = end;
|
|
87904
|
+
}
|
|
87905
|
+
} finally {
|
|
87906
|
+
closeSync4(fd);
|
|
87907
|
+
}
|
|
87908
|
+
if (first < 0 || second < 0) return null;
|
|
87909
|
+
try {
|
|
87910
|
+
return [JSON.parse(buffer.subarray(0, first).toString("utf8")), JSON.parse(buffer.subarray(first + 1, second).toString("utf8"))];
|
|
87911
|
+
} catch {
|
|
87912
|
+
return null;
|
|
87913
|
+
}
|
|
87914
|
+
}
|
|
87915
|
+
|
|
87916
|
+
// ../../apps/collector/src/localSessionFacts.ts
|
|
87917
|
+
var WORKING_FRESH_MS = 9e4;
|
|
87824
87918
|
var STORES = [
|
|
87825
87919
|
{
|
|
87826
87920
|
source: "codex",
|
|
87827
87921
|
file: (home) => {
|
|
87828
|
-
const directory =
|
|
87922
|
+
const directory = path18.join(home, ".codex");
|
|
87829
87923
|
if (!existsSync7(directory)) return null;
|
|
87830
87924
|
const files = readdirSync4(directory).filter((name) => /^state_\d+\.sqlite$/.test(name)).sort((a, b2) => Number(b2.match(/\d+/)?.[0]) - Number(a.match(/\d+/)?.[0]));
|
|
87831
|
-
return files[0] ?
|
|
87925
|
+
return files[0] ? path18.join(directory, files[0]) : null;
|
|
87832
87926
|
},
|
|
87833
87927
|
id: (externalId) => /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i.exec(externalId)?.[1],
|
|
87834
87928
|
table: "threads",
|
|
87835
87929
|
key: "id",
|
|
87836
|
-
fields: ["source", "thread_source", "archived"],
|
|
87930
|
+
fields: ["source", "thread_source", "archived", "rollout_path"],
|
|
87931
|
+
additionalFacts: readCodexReviewFacts,
|
|
87837
87932
|
decode: (row) => {
|
|
87838
87933
|
const parsed = external_exports.object({
|
|
87839
87934
|
source: external_exports.unknown().optional(),
|
|
@@ -87848,20 +87943,29 @@ var STORES = [
|
|
|
87848
87943
|
}
|
|
87849
87944
|
}
|
|
87850
87945
|
return { ...parsed, source };
|
|
87946
|
+
},
|
|
87947
|
+
written: (row) => {
|
|
87948
|
+
const rollout = external_exports.object({ rollout_path: external_exports.string() }).safeParse(row);
|
|
87949
|
+
return rollout.success ? fileWrittenAt(rollout.data.rollout_path) : null;
|
|
87851
87950
|
}
|
|
87852
87951
|
},
|
|
87853
87952
|
{
|
|
87854
87953
|
source: "cursor",
|
|
87855
|
-
file: (home) =>
|
|
87954
|
+
file: (home) => path18.join(defaultCursorUserDir(home), "globalStorage", "state.vscdb"),
|
|
87856
87955
|
id: (externalId) => externalId,
|
|
87857
87956
|
table: "composerHeaders",
|
|
87858
87957
|
key: "composerId",
|
|
87859
|
-
fields: ["isArchived", "isSubagent"],
|
|
87860
|
-
decode: (row) => row
|
|
87958
|
+
fields: ["isArchived", "isSubagent", "lastUpdatedAt"],
|
|
87959
|
+
decode: (row) => row,
|
|
87960
|
+
written: (row) => {
|
|
87961
|
+
const stamp = external_exports.object({ lastUpdatedAt: external_exports.number() }).safeParse(row);
|
|
87962
|
+
return stamp.success ? stamp.data.lastUpdatedAt : null;
|
|
87963
|
+
}
|
|
87861
87964
|
}
|
|
87862
87965
|
];
|
|
87863
|
-
async function readLocalSessionFacts(sessions, onError2, home = os16.homedir()) {
|
|
87966
|
+
async function readLocalSessionFacts(sessions, onError2, home = os16.homedir(), now = Date.now()) {
|
|
87864
87967
|
const result = /* @__PURE__ */ new Map();
|
|
87968
|
+
const working = (writtenAt) => writtenAt !== null && now - writtenAt < WORKING_FRESH_MS ? { working: true } : {};
|
|
87865
87969
|
for (const store of STORES) {
|
|
87866
87970
|
const wanted = sessions.filter((session) => session.source === store.source);
|
|
87867
87971
|
if (wanted.length === 0) continue;
|
|
@@ -87885,11 +87989,16 @@ async function readLocalSessionFacts(sessions, onError2, home = os16.homedir())
|
|
|
87885
87989
|
if (!id) continue;
|
|
87886
87990
|
try {
|
|
87887
87991
|
const row = statement.get(id);
|
|
87888
|
-
if (row !== void 0)
|
|
87889
|
-
|
|
87890
|
-
|
|
87891
|
-
harnessSessionFacts(store.source, store.decode(row))
|
|
87892
|
-
|
|
87992
|
+
if (row !== void 0) {
|
|
87993
|
+
const key = localSessionKey(session);
|
|
87994
|
+
const facts = {
|
|
87995
|
+
...harnessSessionFacts(store.source, store.decode(row)),
|
|
87996
|
+
...working(store.written(row))
|
|
87997
|
+
};
|
|
87998
|
+
result.set(key, facts);
|
|
87999
|
+
if ("additionalFacts" in store && facts.archived !== true && facts.subagent !== true)
|
|
88000
|
+
result.set(key, { ...facts, ...store.additionalFacts(row, id, home) });
|
|
88001
|
+
}
|
|
87893
88002
|
} catch (error62) {
|
|
87894
88003
|
onError2(error62, store.source);
|
|
87895
88004
|
}
|
|
@@ -87901,26 +88010,297 @@ async function readLocalSessionFacts(sessions, onError2, home = os16.homedir())
|
|
|
87901
88010
|
onError2(error62, store.source);
|
|
87902
88011
|
}
|
|
87903
88012
|
}
|
|
88013
|
+
try {
|
|
88014
|
+
for (const session of sessions.filter((session2) => session2.source === "claude-code")) {
|
|
88015
|
+
const facts = working(claudeTranscriptWrittenAt(session.externalId, home));
|
|
88016
|
+
if (facts.working) result.set(localSessionKey(session), facts);
|
|
88017
|
+
}
|
|
88018
|
+
} catch (error62) {
|
|
88019
|
+
onError2(error62, "claude-code");
|
|
88020
|
+
}
|
|
87904
88021
|
return result;
|
|
87905
88022
|
}
|
|
88023
|
+
function claudeTranscriptWrittenAt(sessionId, home) {
|
|
88024
|
+
if (!/^[0-9a-f-]{36}$/i.test(sessionId)) return null;
|
|
88025
|
+
const projects = path18.join(home, ".claude", "projects");
|
|
88026
|
+
if (!existsSync7(projects)) return null;
|
|
88027
|
+
for (const entry of readdirSync4(projects, { withFileTypes: true })) {
|
|
88028
|
+
if (!entry.isDirectory()) continue;
|
|
88029
|
+
const writtenAt = fileWrittenAt(path18.join(projects, entry.name, `${sessionId}.jsonl`));
|
|
88030
|
+
if (writtenAt !== null) return writtenAt;
|
|
88031
|
+
}
|
|
88032
|
+
return null;
|
|
88033
|
+
}
|
|
88034
|
+
function fileWrittenAt(file2) {
|
|
88035
|
+
try {
|
|
88036
|
+
return statSync4(file2).mtimeMs;
|
|
88037
|
+
} catch {
|
|
88038
|
+
return null;
|
|
88039
|
+
}
|
|
88040
|
+
}
|
|
87906
88041
|
function localSessionKey(session) {
|
|
87907
88042
|
return JSON.stringify([session.source, session.externalId]);
|
|
87908
88043
|
}
|
|
87909
88044
|
|
|
88045
|
+
// src/clientFailure.ts
|
|
88046
|
+
function clientFailure(error62) {
|
|
88047
|
+
if (error62 instanceof ExpectedCliError) {
|
|
88048
|
+
return { outcome: "failed", domain: "Powerplant", code: "EXPECTED_CLI_OUTCOME" };
|
|
88049
|
+
}
|
|
88050
|
+
const code = error62 instanceof Error && "code" in error62 && typeof error62.code === "string" && /^E[A-Z0-9_]{1,31}$/.test(error62.code) ? error62.code : void 0;
|
|
88051
|
+
return {
|
|
88052
|
+
outcome: code === "ENOENT" ? "missing" : code === "EACCES" || code === "EPERM" ? "denied" : "failed",
|
|
88053
|
+
domain: code ? Object.hasOwn(constants.errno, code) ? "POSIX" : "Node" : "JavaScript",
|
|
88054
|
+
code: code ?? (error62 instanceof TypeError ? "TypeError" : error62 instanceof RangeError ? "RangeError" : "unclassified")
|
|
88055
|
+
};
|
|
88056
|
+
}
|
|
88057
|
+
function nativeFailureRecord(error62) {
|
|
88058
|
+
return `POWERPLANT_DIAGNOSTIC ${JSON.stringify({ version: 1, failure: clientFailure(error62) })}`;
|
|
88059
|
+
}
|
|
88060
|
+
|
|
88061
|
+
// src/desktopDiagnostics.ts
|
|
88062
|
+
import os18 from "node:os";
|
|
88063
|
+
import path20 from "node:path";
|
|
88064
|
+
|
|
88065
|
+
// src/memberSessions.ts
|
|
88066
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
88067
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
88068
|
+
import { open as open2, readdir as readdir2 } from "node:fs/promises";
|
|
88069
|
+
import os17 from "node:os";
|
|
88070
|
+
import path19 from "node:path";
|
|
88071
|
+
var memberSessionSchema = external_exports.object({
|
|
88072
|
+
id: external_exports.string().min(1),
|
|
88073
|
+
source: external_exports.string().min(1),
|
|
88074
|
+
externalId: external_exports.string().min(1),
|
|
88075
|
+
title: external_exports.string().nullable(),
|
|
88076
|
+
repoDir: external_exports.string().nullable(),
|
|
88077
|
+
machineId: external_exports.string().nullable(),
|
|
88078
|
+
lastActivityAt: external_exports.string().min(1),
|
|
88079
|
+
providerUrl: external_exports.string().nullable(),
|
|
88080
|
+
archived: external_exports.boolean().optional(),
|
|
88081
|
+
subagent: external_exports.boolean().optional(),
|
|
88082
|
+
standaloneReview: external_exports.boolean().optional(),
|
|
88083
|
+
/** The harness wrote to the session moments ago (this machine only, see
|
|
88084
|
+
* the collector's LocalSessionFacts). Absent is unknown, never idle. */
|
|
88085
|
+
working: external_exports.boolean().optional()
|
|
88086
|
+
});
|
|
88087
|
+
function applyLocalFacts(sessions, machineId, localFacts, localKey, claudeDesktop) {
|
|
88088
|
+
return sessions.map((session) => {
|
|
88089
|
+
if (machineId === null || session.machineId !== machineId) return session;
|
|
88090
|
+
const desktop = session.source === "claude-code" ? claudeDesktop.get(session.externalId) : void 0;
|
|
88091
|
+
return {
|
|
88092
|
+
...session,
|
|
88093
|
+
...localFacts.get(localKey(session)),
|
|
88094
|
+
...desktop?.archived === true && { archived: true }
|
|
88095
|
+
};
|
|
88096
|
+
});
|
|
88097
|
+
}
|
|
88098
|
+
async function fetchMemberSessions(credentials, fetchImpl = fetch, options = { windowHours: RECENT_SESSION_WINDOW_MS / 36e5, limit: RECENT_SESSION_VISIBLE_LIMIT }) {
|
|
88099
|
+
const { windowHours, limit } = recentSessionOptionsSchema.parse(options);
|
|
88100
|
+
try {
|
|
88101
|
+
const query = new URLSearchParams({ view: "recent", windowHours: String(windowHours), limit: String(limit) });
|
|
88102
|
+
const response = await fetchImpl(`${credentials.apiUrl}/api/collector/member-sessions?${query.toString()}`, {
|
|
88103
|
+
headers: { authorization: `Bearer ${credentials.token}`, ...cliVersionHeaders() },
|
|
88104
|
+
signal: AbortSignal.timeout(1e4)
|
|
88105
|
+
});
|
|
88106
|
+
if (!response.ok) throw new Error(`session read returned ${response.status}`);
|
|
88107
|
+
const { data } = external_exports.object({ data: external_exports.object({
|
|
88108
|
+
sessions: external_exports.array(memberSessionSchema).max(50),
|
|
88109
|
+
nextCursor: external_exports.string().max(512).nullable().optional()
|
|
88110
|
+
}) }).parse(await response.json());
|
|
88111
|
+
return {
|
|
88112
|
+
sessions: data.sessions.slice(0, limit),
|
|
88113
|
+
// Older servers ignore the recent window and omit this field.
|
|
88114
|
+
// A cursor on a supported server is an intentional cap, not a failure.
|
|
88115
|
+
incomplete: data.nextCursor === void 0
|
|
88116
|
+
};
|
|
88117
|
+
} catch {
|
|
88118
|
+
return null;
|
|
88119
|
+
}
|
|
88120
|
+
}
|
|
88121
|
+
function resumeCommand(source, sessionId, powerplantUrl) {
|
|
88122
|
+
return ["resume-session", source, sessionId, "--open", powerplantUrl];
|
|
88123
|
+
}
|
|
88124
|
+
function sessionLinks(session, webUrl, options) {
|
|
88125
|
+
const powerplantUrl = `${webUrl}/rooms/${session.id}`;
|
|
88126
|
+
switch (session.source) {
|
|
88127
|
+
case "claude-code":
|
|
88128
|
+
if (!options.localMachine) return { powerplantUrl };
|
|
88129
|
+
if (options.terminalSession !== void 0) {
|
|
88130
|
+
const { tty, appPid, appName } = options.terminalSession;
|
|
88131
|
+
return {
|
|
88132
|
+
powerplantUrl,
|
|
88133
|
+
extra: {
|
|
88134
|
+
label: `Show in ${appName}`,
|
|
88135
|
+
focus: { tty, appPid },
|
|
88136
|
+
terminal: resumeCommand("claude-code", session.externalId, powerplantUrl)
|
|
88137
|
+
}
|
|
88138
|
+
};
|
|
88139
|
+
}
|
|
88140
|
+
if (options.claudeDesktopSessionId !== void 0) {
|
|
88141
|
+
return {
|
|
88142
|
+
powerplantUrl,
|
|
88143
|
+
extra: {
|
|
88144
|
+
label: "Open in Claude",
|
|
88145
|
+
url: `claude://claude.ai/epitaxy/${encodeURIComponent(options.claudeDesktopSessionId)}`
|
|
88146
|
+
}
|
|
88147
|
+
};
|
|
88148
|
+
}
|
|
88149
|
+
return {
|
|
88150
|
+
powerplantUrl,
|
|
88151
|
+
extra: {
|
|
88152
|
+
label: "Resume in terminal",
|
|
88153
|
+
terminal: resumeCommand("claude-code", session.externalId, powerplantUrl)
|
|
88154
|
+
}
|
|
88155
|
+
};
|
|
88156
|
+
case "codex": {
|
|
88157
|
+
const threadId2 = codexThreadId(session.externalId);
|
|
88158
|
+
if (threadId2 === null || !options.localMachine) return { powerplantUrl };
|
|
88159
|
+
return {
|
|
88160
|
+
powerplantUrl,
|
|
88161
|
+
extra: options.codexDesktop ? { label: "Open in Codex", url: `codex://threads/${threadId2}` } : { label: "Resume in terminal", terminal: resumeCommand("codex", threadId2, powerplantUrl) }
|
|
88162
|
+
};
|
|
88163
|
+
}
|
|
88164
|
+
case "claude-cloud":
|
|
88165
|
+
return {
|
|
88166
|
+
powerplantUrl,
|
|
88167
|
+
extra: { label: "Open on claude.ai", url: `https://claude.ai/code/${encodeURIComponent(session.externalId)}` }
|
|
88168
|
+
};
|
|
88169
|
+
default:
|
|
88170
|
+
return session.providerUrl === null ? { powerplantUrl } : { powerplantUrl, extra: { label: "Open in Cursor", url: session.providerUrl } };
|
|
88171
|
+
}
|
|
88172
|
+
}
|
|
88173
|
+
var TRAILING_UUID = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i;
|
|
88174
|
+
function codexThreadId(externalId) {
|
|
88175
|
+
return TRAILING_UUID.exec(externalId)?.[1] ?? null;
|
|
88176
|
+
}
|
|
88177
|
+
var CODEX_APP_BUNDLES = ["ChatGPT.app", "Codex.app"];
|
|
88178
|
+
var urlSchemesSchema = external_exports.array(external_exports.object({ CFBundleURLSchemes: external_exports.array(external_exports.string()).optional() }));
|
|
88179
|
+
function detectCodexDesktop(probe) {
|
|
88180
|
+
return detectDesktopScheme(CODEX_APP_BUNDLES, "codex", probe);
|
|
88181
|
+
}
|
|
88182
|
+
function detectClaudeDesktop(probe) {
|
|
88183
|
+
return detectDesktopScheme(["Claude.app"], "claude", probe);
|
|
88184
|
+
}
|
|
88185
|
+
function detectDesktopScheme(bundles, scheme, probe = { exists: existsSync8, readUrlSchemes: realReadUrlSchemes }) {
|
|
88186
|
+
const roots = ["/Applications", path19.join(os17.homedir(), "Applications")];
|
|
88187
|
+
return roots.some(
|
|
88188
|
+
(root) => bundles.some((bundle) => {
|
|
88189
|
+
const bundlePath = path19.join(root, bundle);
|
|
88190
|
+
return probe.exists(bundlePath) && probe.readUrlSchemes(bundlePath).includes(scheme);
|
|
88191
|
+
})
|
|
88192
|
+
);
|
|
88193
|
+
}
|
|
88194
|
+
function realReadUrlSchemes(bundlePath) {
|
|
88195
|
+
if (process.platform !== "darwin") return [];
|
|
88196
|
+
try {
|
|
88197
|
+
const json2 = execFileSync4(
|
|
88198
|
+
"plutil",
|
|
88199
|
+
["-extract", "CFBundleURLTypes", "json", "-o", "-", path19.join(bundlePath, "Contents", "Info.plist")],
|
|
88200
|
+
{ stdio: ["ignore", "pipe", "ignore"] }
|
|
88201
|
+
).toString();
|
|
88202
|
+
const parsed = urlSchemesSchema.safeParse(JSON.parse(json2));
|
|
88203
|
+
if (!parsed.success) return [];
|
|
88204
|
+
return parsed.data.flatMap((entry) => entry.CFBundleURLSchemes ?? []);
|
|
88205
|
+
} catch {
|
|
88206
|
+
return [];
|
|
88207
|
+
}
|
|
88208
|
+
}
|
|
88209
|
+
var claudeDesktopSessionSchema = external_exports.object({
|
|
88210
|
+
sessionId: external_exports.string().regex(/^local_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
88211
|
+
cliSessionId: external_exports.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
88212
|
+
/** Observed 2026-09-10 on Claude 1.52386.0: the app sets this itself on
|
|
88213
|
+
* older sessions as well as on a user's archive action. A file without
|
|
88214
|
+
* it, or with another shape, is not archived as far as this read knows,
|
|
88215
|
+
* and still links: the flag must never cost the row its desktop link. */
|
|
88216
|
+
isArchived: external_exports.unknown().optional()
|
|
88217
|
+
});
|
|
88218
|
+
async function readClaudeDesktopSessions(wanted, root = path19.join(os17.homedir(), "Library/Application Support/Claude/claude-code-sessions")) {
|
|
88219
|
+
const sessions = /* @__PURE__ */ new Map();
|
|
88220
|
+
const ambiguous = /* @__PURE__ */ new Set();
|
|
88221
|
+
if (wanted.size === 0) return sessions;
|
|
88222
|
+
const buffer = Buffer.alloc(1024 * 1024 + 1);
|
|
88223
|
+
async function visit3(directory, depth) {
|
|
88224
|
+
const entries = await readdir2(directory, { withFileTypes: true }).catch((error62) => {
|
|
88225
|
+
if (depth > 0 && isMissingFile(error62)) return [];
|
|
88226
|
+
throw error62;
|
|
88227
|
+
});
|
|
88228
|
+
for (const entry of entries) {
|
|
88229
|
+
const file2 = path19.join(directory, entry.name);
|
|
88230
|
+
if (entry.isDirectory() && depth < 2) {
|
|
88231
|
+
await visit3(file2, depth + 1);
|
|
88232
|
+
} else if (depth === 2 && entry.isFile() && /^local_.*\.json$/.test(entry.name)) {
|
|
88233
|
+
const handle = await open2(file2, "r").catch((error62) => {
|
|
88234
|
+
if (isMissingFile(error62)) return null;
|
|
88235
|
+
throw error62;
|
|
88236
|
+
});
|
|
88237
|
+
if (handle === null) continue;
|
|
88238
|
+
try {
|
|
88239
|
+
const { bytesRead } = await handle.read(buffer);
|
|
88240
|
+
if (bytesRead > 1024 * 1024) continue;
|
|
88241
|
+
const parsed = claudeDesktopSessionSchema.safeParse(
|
|
88242
|
+
JSON.parse(buffer.subarray(0, bytesRead).toString())
|
|
88243
|
+
);
|
|
88244
|
+
if (!parsed.success || !wanted.has(parsed.data.cliSessionId)) continue;
|
|
88245
|
+
const { cliSessionId, sessionId, isArchived } = parsed.data;
|
|
88246
|
+
if (ambiguous.has(cliSessionId)) continue;
|
|
88247
|
+
if (sessions.has(cliSessionId) && sessions.get(cliSessionId)?.sessionId !== sessionId) {
|
|
88248
|
+
sessions.delete(cliSessionId);
|
|
88249
|
+
ambiguous.add(cliSessionId);
|
|
88250
|
+
} else {
|
|
88251
|
+
sessions.set(cliSessionId, { sessionId, archived: isArchived === true });
|
|
88252
|
+
}
|
|
88253
|
+
} catch (error62) {
|
|
88254
|
+
if (!(error62 instanceof SyntaxError)) throw error62;
|
|
88255
|
+
} finally {
|
|
88256
|
+
await handle.close();
|
|
88257
|
+
}
|
|
88258
|
+
}
|
|
88259
|
+
}
|
|
88260
|
+
}
|
|
88261
|
+
await visit3(root, 0);
|
|
88262
|
+
return sessions;
|
|
88263
|
+
}
|
|
88264
|
+
function isMissingFile(error62) {
|
|
88265
|
+
return error62 instanceof Error && "code" in error62 && error62.code === "ENOENT";
|
|
88266
|
+
}
|
|
88267
|
+
|
|
88268
|
+
// src/desktopDiagnostics.ts
|
|
88269
|
+
async function probeClaudeDesktopSessions(wanted, installed, reportFault, root = path20.join(os18.homedir(), "Library/Application Support/Claude/claude-code-sessions"), read = readClaudeDesktopSessions) {
|
|
88270
|
+
if (!installed || wanted.size === 0) {
|
|
88271
|
+
return { sessions: /* @__PURE__ */ new Map(), diagnostic: { outcome: "not-needed" } };
|
|
88272
|
+
}
|
|
88273
|
+
try {
|
|
88274
|
+
return { sessions: await read(wanted, root), diagnostic: { outcome: "available" } };
|
|
88275
|
+
} catch (error62) {
|
|
88276
|
+
const diagnostic = clientFailure(error62);
|
|
88277
|
+
if (diagnostic.domain === "JavaScript" || diagnostic.domain === "Node") {
|
|
88278
|
+
reportFault(new Error(`Claude desktop registry failed (${diagnostic.domain}:${diagnostic.code})`));
|
|
88279
|
+
}
|
|
88280
|
+
return { sessions: /* @__PURE__ */ new Map(), diagnostic };
|
|
88281
|
+
}
|
|
88282
|
+
}
|
|
88283
|
+
|
|
88284
|
+
// src/cli.ts
|
|
88285
|
+
import { spawn as spawn2, spawnSync as spawnSync5 } from "node:child_process";
|
|
88286
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync11, openSync as openSync6, realpathSync as realpathSync5, rmSync as rmSync6 } from "node:fs";
|
|
88287
|
+
import path28 from "node:path";
|
|
88288
|
+
import { parseArgs } from "node:util";
|
|
88289
|
+
|
|
87910
88290
|
// src/connect.ts
|
|
87911
|
-
import { execFileSync as
|
|
88291
|
+
import { execFileSync as execFileSync5, spawnSync } from "node:child_process";
|
|
87912
88292
|
import {
|
|
87913
|
-
existsSync as
|
|
88293
|
+
existsSync as existsSync9,
|
|
87914
88294
|
mkdirSync as mkdirSync8,
|
|
87915
88295
|
mkdtempSync,
|
|
87916
88296
|
readdirSync as readdirSync5,
|
|
87917
88297
|
readFileSync as readFileSync11,
|
|
87918
|
-
realpathSync as
|
|
87919
|
-
statSync as
|
|
88298
|
+
realpathSync as realpathSync4,
|
|
88299
|
+
statSync as statSync5,
|
|
87920
88300
|
writeFileSync as writeFileSync8
|
|
87921
88301
|
} from "node:fs";
|
|
87922
|
-
import
|
|
87923
|
-
import
|
|
88302
|
+
import os19 from "node:os";
|
|
88303
|
+
import path21 from "node:path";
|
|
87924
88304
|
import { emitKeypressEvents } from "node:readline";
|
|
87925
88305
|
|
|
87926
88306
|
// src/agentVersions.ts
|
|
@@ -87978,6 +88358,11 @@ var officialClientsSchema = external_exports.object({
|
|
|
87978
88358
|
cursor: external_exports.object({ clientId: external_exports.string().min(1) })
|
|
87979
88359
|
}).nullable();
|
|
87980
88360
|
var officialClientsDocumentSchema = external_exports.object({ clients: officialClientsSchema });
|
|
88361
|
+
function connectExitCode(outcome, background) {
|
|
88362
|
+
if (outcome.failed > 0) return 1;
|
|
88363
|
+
if (background && (outcome.pending > 0 || outcome.connected + outcome.configured === 0)) return 1;
|
|
88364
|
+
return 0;
|
|
88365
|
+
}
|
|
87981
88366
|
var OPENAI_TEAM_ID = "2DC432GLL2";
|
|
87982
88367
|
var CURSOR_TEAM_ID = "VDXQ22DGB9";
|
|
87983
88368
|
var CODEX_BUNDLE_ID = "com.openai.codex";
|
|
@@ -87989,10 +88374,10 @@ function startTimeBudget(totalMs, now = Date.now) {
|
|
|
87989
88374
|
return { remainingMs: () => Math.max(0, deadline - now()) };
|
|
87990
88375
|
}
|
|
87991
88376
|
function defaultApplicationsDirs(homeDir) {
|
|
87992
|
-
return process.platform === "darwin" ? ["/Applications",
|
|
88377
|
+
return process.platform === "darwin" ? ["/Applications", path21.join(homeDir, "Applications")] : [];
|
|
87993
88378
|
}
|
|
87994
88379
|
function detectClients(options = {}) {
|
|
87995
|
-
const homeDir = options.homeDir ??
|
|
88380
|
+
const homeDir = options.homeDir ?? os19.homedir();
|
|
87996
88381
|
const whichAll = options.whichAll ?? defaultWhichAll;
|
|
87997
88382
|
const env = options.env ?? process.env;
|
|
87998
88383
|
const applicationsDirs = options.applicationsDirs ?? defaultApplicationsDirs(homeDir);
|
|
@@ -88007,7 +88392,7 @@ function detectClients(options = {}) {
|
|
|
88007
88392
|
const add = (client, bin, configDir) => {
|
|
88008
88393
|
let real;
|
|
88009
88394
|
try {
|
|
88010
|
-
real =
|
|
88395
|
+
real = realpathSync4(bin);
|
|
88011
88396
|
} catch {
|
|
88012
88397
|
return;
|
|
88013
88398
|
}
|
|
@@ -88017,20 +88402,20 @@ function detectClients(options = {}) {
|
|
|
88017
88402
|
clients.push({ client, bin, ...configDir !== void 0 && { configDir } });
|
|
88018
88403
|
};
|
|
88019
88404
|
for (const bin of whichAll("claude")) add("claude", bin);
|
|
88020
|
-
const localClaude =
|
|
88021
|
-
if (
|
|
88405
|
+
const localClaude = path21.join(homeDir, ".local", "bin", "claude");
|
|
88406
|
+
if (existsSync9(localClaude)) add("claude", localClaude);
|
|
88022
88407
|
for (const bin of desktopClaudeBinaries(homeDir)) add("claude", bin);
|
|
88023
88408
|
const claudeBins = clients.filter((client) => client.client === "claude" && client.configDir === void 0).map((client) => client.bin);
|
|
88024
88409
|
for (const configDir of claudeConfigHomes(homeDir, env)) {
|
|
88025
88410
|
for (const bin of claudeBins) add("claude", bin, configDir);
|
|
88026
88411
|
}
|
|
88027
88412
|
for (const bin of whichAll("codex")) add("codex", bin);
|
|
88028
|
-
const localCodex =
|
|
88029
|
-
if (
|
|
88413
|
+
const localCodex = path21.join(homeDir, ".local", "bin", "codex");
|
|
88414
|
+
if (existsSync9(localCodex)) add("codex", localCodex);
|
|
88030
88415
|
for (const bin of codexBundleBinaries(applicationsDirs, bundleSeams)) add("codex", bin);
|
|
88031
|
-
const cursorDir =
|
|
88032
|
-
if (
|
|
88033
|
-
clients.push({ client: "cursor", bin:
|
|
88416
|
+
const cursorDir = path21.join(homeDir, ".cursor");
|
|
88417
|
+
if (existsSync9(cursorDir) || cursorAppInstalled(applicationsDirs, bundleSeams)) {
|
|
88418
|
+
clients.push({ client: "cursor", bin: path21.join(cursorDir, "mcp.json") });
|
|
88034
88419
|
}
|
|
88035
88420
|
return clients;
|
|
88036
88421
|
}
|
|
@@ -88038,19 +88423,19 @@ function claudeConfigHomes(homeDir, env) {
|
|
|
88038
88423
|
const homes = [];
|
|
88039
88424
|
const seen = /* @__PURE__ */ new Set();
|
|
88040
88425
|
try {
|
|
88041
|
-
seen.add(
|
|
88426
|
+
seen.add(realpathSync4(path21.join(homeDir, ".claude")));
|
|
88042
88427
|
} catch {
|
|
88043
88428
|
}
|
|
88044
88429
|
const add = (configDir) => {
|
|
88045
88430
|
let real;
|
|
88046
88431
|
try {
|
|
88047
|
-
real =
|
|
88432
|
+
real = realpathSync4(configDir);
|
|
88048
88433
|
} catch {
|
|
88049
88434
|
return;
|
|
88050
88435
|
}
|
|
88051
88436
|
if (seen.has(real)) return;
|
|
88052
88437
|
seen.add(real);
|
|
88053
|
-
homes.push(
|
|
88438
|
+
homes.push(path21.resolve(configDir));
|
|
88054
88439
|
};
|
|
88055
88440
|
let entries = [];
|
|
88056
88441
|
try {
|
|
@@ -88058,8 +88443,8 @@ function claudeConfigHomes(homeDir, env) {
|
|
|
88058
88443
|
} catch {
|
|
88059
88444
|
}
|
|
88060
88445
|
for (const entry of entries.sort()) {
|
|
88061
|
-
if (entry.startsWith(".claude-") &&
|
|
88062
|
-
add(
|
|
88446
|
+
if (entry.startsWith(".claude-") && existsSync9(path21.join(homeDir, entry, ".claude.json"))) {
|
|
88447
|
+
add(path21.join(homeDir, entry));
|
|
88063
88448
|
}
|
|
88064
88449
|
}
|
|
88065
88450
|
if (env.CLAUDE_CONFIG_DIR) add(env.CLAUDE_CONFIG_DIR);
|
|
@@ -88087,7 +88472,7 @@ function appBundles(applicationsDirs, namePrefixes) {
|
|
|
88087
88472
|
for (const entry of entries) {
|
|
88088
88473
|
if (!entry.endsWith(".app")) continue;
|
|
88089
88474
|
if (!namePrefixes.some((prefix) => entry.startsWith(prefix))) continue;
|
|
88090
|
-
bundles.push(
|
|
88475
|
+
bundles.push(path21.join(dir, entry));
|
|
88091
88476
|
}
|
|
88092
88477
|
}
|
|
88093
88478
|
return bundles;
|
|
@@ -88107,7 +88492,7 @@ function codexBundleBinaries(applicationsDirs, seams) {
|
|
|
88107
88492
|
const infoTimeoutMs = budgetedTimeout(BUNDLE_INFO_TIMEOUT_MS, appDir, seams);
|
|
88108
88493
|
if (infoTimeoutMs === null) continue;
|
|
88109
88494
|
if (seams.readBundleInfo(appDir, infoTimeoutMs)?.bundleId !== CODEX_BUNDLE_ID) continue;
|
|
88110
|
-
const bin =
|
|
88495
|
+
const bin = path21.join(appDir, "Contents", "Resources", "codex");
|
|
88111
88496
|
if (!isExecutableFile(bin)) continue;
|
|
88112
88497
|
if (!signedByTeam(bin, OPENAI_TEAM_ID, "OpenAI", appDir, seams)) continue;
|
|
88113
88498
|
found.push(bin);
|
|
@@ -88119,7 +88504,7 @@ function trustedCursorBundle(appDir, seams) {
|
|
|
88119
88504
|
if (infoTimeoutMs === null) return null;
|
|
88120
88505
|
const info = seams.readBundleInfo(appDir, infoTimeoutMs);
|
|
88121
88506
|
if (info?.executable === void 0) return null;
|
|
88122
|
-
const bin =
|
|
88507
|
+
const bin = path21.join(appDir, "Contents", "MacOS", info.executable);
|
|
88123
88508
|
if (!isExecutableFile(bin)) return null;
|
|
88124
88509
|
if (!signedByTeam(bin, CURSOR_TEAM_ID, "Cursor", appDir, seams)) return null;
|
|
88125
88510
|
return info;
|
|
@@ -88142,7 +88527,7 @@ function cursorAppVersion(applicationsDirs, seams) {
|
|
|
88142
88527
|
}
|
|
88143
88528
|
function isExecutableFile(filePath) {
|
|
88144
88529
|
try {
|
|
88145
|
-
const stats =
|
|
88530
|
+
const stats = statSync5(filePath);
|
|
88146
88531
|
return stats.isFile() && (stats.mode & 73) !== 0;
|
|
88147
88532
|
} catch {
|
|
88148
88533
|
return false;
|
|
@@ -88156,7 +88541,7 @@ var bundleInfoSchema = external_exports.object({
|
|
|
88156
88541
|
function realReadBundleInfo(appDir, timeoutMs) {
|
|
88157
88542
|
const result = spawnSync(
|
|
88158
88543
|
"plutil",
|
|
88159
|
-
["-convert", "json", "-o", "-",
|
|
88544
|
+
["-convert", "json", "-o", "-", path21.join(appDir, "Contents", "Info.plist")],
|
|
88160
88545
|
{ encoding: "utf8", timeout: timeoutMs }
|
|
88161
88546
|
);
|
|
88162
88547
|
if (result.status !== 0) return null;
|
|
@@ -88178,18 +88563,18 @@ function realVerifySignature(binPath, teamId, timeoutMs) {
|
|
|
88178
88563
|
}).status === 0;
|
|
88179
88564
|
}
|
|
88180
88565
|
function desktopClaudeBinaries(homeDir) {
|
|
88181
|
-
const root =
|
|
88566
|
+
const root = path21.join(homeDir, "Library", "Application Support", "Claude", "claude-code");
|
|
88182
88567
|
let versions;
|
|
88183
88568
|
try {
|
|
88184
88569
|
versions = readdirSync5(root);
|
|
88185
88570
|
} catch {
|
|
88186
88571
|
return [];
|
|
88187
88572
|
}
|
|
88188
|
-
return versions.map((version2) =>
|
|
88573
|
+
return versions.map((version2) => path21.join(root, version2, "claude.app", "Contents", "MacOS", "claude")).filter((bin) => existsSync9(bin));
|
|
88189
88574
|
}
|
|
88190
88575
|
function defaultWhichAll(name) {
|
|
88191
88576
|
try {
|
|
88192
|
-
return
|
|
88577
|
+
return execFileSync5("which", ["-a", name], { encoding: "utf8" }).split("\n").map((line) => line.trim()).filter(Boolean);
|
|
88193
88578
|
} catch {
|
|
88194
88579
|
return [];
|
|
88195
88580
|
}
|
|
@@ -88284,9 +88669,9 @@ function displayName(client, all) {
|
|
|
88284
88669
|
const sameTarget = peers.filter((peer) => peer.configDir === client.configDir);
|
|
88285
88670
|
const details = [];
|
|
88286
88671
|
if (profiles.size > 1) {
|
|
88287
|
-
details.push(client.configDir?.replace(
|
|
88672
|
+
details.push(client.configDir?.replace(os19.homedir(), "~") ?? "default profile");
|
|
88288
88673
|
}
|
|
88289
|
-
if (sameTarget.length > 1) details.push(client.bin.replace(
|
|
88674
|
+
if (sameTarget.length > 1) details.push(client.bin.replace(os19.homedir(), "~"));
|
|
88290
88675
|
return details.length > 0 ? `${product} (${details.join(", ")})` : product;
|
|
88291
88676
|
}
|
|
88292
88677
|
function pickerAllowed(options) {
|
|
@@ -88736,7 +89121,7 @@ function connectCursor(mcpJsonPath, name, deps) {
|
|
|
88736
89121
|
);
|
|
88737
89122
|
if (patch.error !== void 0 || patch.entry === void 0) {
|
|
88738
89123
|
return failed(
|
|
88739
|
-
`${mcpJsonPath.replace(
|
|
89124
|
+
`${mcpJsonPath.replace(os19.homedir(), "~")} is ${patch.error}, fix it by hand, then re-run ${deps.connectCommand}.`
|
|
88740
89125
|
);
|
|
88741
89126
|
}
|
|
88742
89127
|
if (patch.changed) deps.writeTextFile(mcpJsonPath, patch.content);
|
|
@@ -88792,7 +89177,7 @@ function disconnectTarget(agent, candidates, deps) {
|
|
|
88792
89177
|
try {
|
|
88793
89178
|
last = candidate.client === "claude" ? disconnectClaude(candidate, deps) : candidate.client === "codex" ? disconnectCodex(candidate.bin, deps) : disconnectCursor(candidate.bin, deps);
|
|
88794
89179
|
} catch (error62) {
|
|
88795
|
-
const name = candidate.client === "cursor" ? `Cursor (${candidate.bin.replace(
|
|
89180
|
+
const name = candidate.client === "cursor" ? `Cursor (${candidate.bin.replace(os19.homedir(), "~")})` : describeBinary(candidate.bin);
|
|
88796
89181
|
deps.log(`\u2717 ${name}: ${error62 instanceof Error ? error62.message : String(error62)}`);
|
|
88797
89182
|
last = "failed";
|
|
88798
89183
|
}
|
|
@@ -88854,7 +89239,7 @@ function disconnectCodex(bin, deps) {
|
|
|
88854
89239
|
return "disconnected";
|
|
88855
89240
|
}
|
|
88856
89241
|
function disconnectCursor(mcpJsonPath, deps) {
|
|
88857
|
-
const name = `Cursor (${mcpJsonPath.replace(
|
|
89242
|
+
const name = `Cursor (${mcpJsonPath.replace(os19.homedir(), "~")})`;
|
|
88858
89243
|
const patch = unpatchCursorMcpJson(deps.readTextFile(mcpJsonPath), MCP_SERVER_NAME);
|
|
88859
89244
|
if (patch.error !== void 0) {
|
|
88860
89245
|
deps.log(`\u2717 ${name}: mcp.json is ${patch.error}, fix it by hand, then re-run powerplant disconnect.`);
|
|
@@ -88884,11 +89269,11 @@ function anyClientStillConnected(clients, deps) {
|
|
|
88884
89269
|
});
|
|
88885
89270
|
}
|
|
88886
89271
|
function describeBinary(bin) {
|
|
88887
|
-
return `${
|
|
89272
|
+
return `${path21.basename(bin)} (${bin.replace(os19.homedir(), "~")})`;
|
|
88888
89273
|
}
|
|
88889
89274
|
function describeClaudeTarget(client) {
|
|
88890
89275
|
if (client.configDir === void 0) return describeBinary(client.bin);
|
|
88891
|
-
return `${
|
|
89276
|
+
return `${path21.basename(client.bin)} (${client.configDir.replace(os19.homedir(), "~")})`;
|
|
88892
89277
|
}
|
|
88893
89278
|
var FAILURE_DETAIL_MAX_CHARS = 200;
|
|
88894
89279
|
function describeFailure(result) {
|
|
@@ -88901,7 +89286,7 @@ function describeFailure(result) {
|
|
|
88901
89286
|
}
|
|
88902
89287
|
var neutralDirMemo;
|
|
88903
89288
|
function neutralWorkdir() {
|
|
88904
|
-
neutralDirMemo ??= mkdtempSync(
|
|
89289
|
+
neutralDirMemo ??= mkdtempSync(path21.join(os19.tmpdir(), "powerplant-connect-"));
|
|
88905
89290
|
return neutralDirMemo;
|
|
88906
89291
|
}
|
|
88907
89292
|
async function fetchOfficialClients(apiUrl, log3) {
|
|
@@ -88945,11 +89330,11 @@ function realReadTextFileStrict(filePath) {
|
|
|
88945
89330
|
}
|
|
88946
89331
|
}
|
|
88947
89332
|
function realWriteTextFile(filePath, content) {
|
|
88948
|
-
mkdirSync8(
|
|
89333
|
+
mkdirSync8(path21.dirname(filePath), { recursive: true });
|
|
88949
89334
|
writeFileSync8(filePath, content);
|
|
88950
89335
|
}
|
|
88951
|
-
function codexConfigPath(homeDir =
|
|
88952
|
-
return
|
|
89336
|
+
function codexConfigPath(homeDir = os19.homedir()) {
|
|
89337
|
+
return path21.join(process.env.CODEX_HOME ?? path21.join(homeDir, ".codex"), "config.toml");
|
|
88953
89338
|
}
|
|
88954
89339
|
function realOpenUrl(url2) {
|
|
88955
89340
|
const bin = process.platform === "darwin" ? "open" : process.platform === "linux" ? "xdg-open" : null;
|
|
@@ -88969,7 +89354,7 @@ function commandEnv(overrides) {
|
|
|
88969
89354
|
}
|
|
88970
89355
|
function realAgentVersion(client) {
|
|
88971
89356
|
if (client.client === "cursor") {
|
|
88972
|
-
return cursorAppVersion(defaultApplicationsDirs(
|
|
89357
|
+
return cursorAppVersion(defaultApplicationsDirs(os19.homedir()), {
|
|
88973
89358
|
readBundleInfo: realReadBundleInfo,
|
|
88974
89359
|
verifySignature: realVerifySignature,
|
|
88975
89360
|
budget: UNLIMITED_TIME_BUDGET,
|
|
@@ -89009,9 +89394,9 @@ function realRunInteractive(bin, args, env) {
|
|
|
89009
89394
|
}
|
|
89010
89395
|
|
|
89011
89396
|
// src/connections.ts
|
|
89012
|
-
import { execFileSync as
|
|
89397
|
+
import { execFileSync as execFileSync6, spawnSync as spawnSync2 } from "node:child_process";
|
|
89013
89398
|
import { mkdirSync as mkdirSync9, writeFileSync as writeFileSync9 } from "node:fs";
|
|
89014
|
-
import
|
|
89399
|
+
import path22 from "node:path";
|
|
89015
89400
|
function probeConnections(clients, deps) {
|
|
89016
89401
|
const reports = [];
|
|
89017
89402
|
for (const kind of ["claude", "codex", "cursor"]) {
|
|
@@ -89055,7 +89440,7 @@ function aggregateClaudeTargets(targets) {
|
|
|
89055
89440
|
if (targets.length === 1 || worst.report.state === "signed-in") return worst.report;
|
|
89056
89441
|
return {
|
|
89057
89442
|
...worst.report,
|
|
89058
|
-
target: worst.configDir === void 0 ? "default profile" :
|
|
89443
|
+
target: worst.configDir === void 0 ? "default profile" : path22.basename(worst.configDir)
|
|
89059
89444
|
};
|
|
89060
89445
|
}
|
|
89061
89446
|
function probeClient(client, deps) {
|
|
@@ -89134,12 +89519,12 @@ var detectedClientsSchema = external_exports.object({
|
|
|
89134
89519
|
)
|
|
89135
89520
|
});
|
|
89136
89521
|
function detectedClientsPath(homeDir) {
|
|
89137
|
-
return
|
|
89522
|
+
return path22.join(collectorStateDir(homeDir), "detected-clients.json");
|
|
89138
89523
|
}
|
|
89139
89524
|
function saveDetectedClients(clients, pathValue, homeDir) {
|
|
89140
89525
|
try {
|
|
89141
89526
|
const file2 = detectedClientsPath(homeDir);
|
|
89142
|
-
mkdirSync9(
|
|
89527
|
+
mkdirSync9(path22.dirname(file2), { recursive: true });
|
|
89143
89528
|
const record2 = {
|
|
89144
89529
|
detectedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
89145
89530
|
path: pathValue,
|
|
@@ -89212,7 +89597,7 @@ function runWithPath(pathValue, budget = UNLIMITED_TIME_BUDGET) {
|
|
|
89212
89597
|
function whichAllWith(pathValue) {
|
|
89213
89598
|
return (name) => {
|
|
89214
89599
|
try {
|
|
89215
|
-
return
|
|
89600
|
+
return execFileSync6("which", ["-a", name], {
|
|
89216
89601
|
encoding: "utf8",
|
|
89217
89602
|
env: { ...process.env, PATH: pathValue }
|
|
89218
89603
|
}).split("\n").map((line) => line.trim()).filter(Boolean);
|
|
@@ -89223,10 +89608,10 @@ function whichAllWith(pathValue) {
|
|
|
89223
89608
|
}
|
|
89224
89609
|
|
|
89225
89610
|
// src/doctor.ts
|
|
89226
|
-
import { closeSync as
|
|
89611
|
+
import { closeSync as closeSync5, fstatSync, openSync as openSync5, readSync as readSync5 } from "node:fs";
|
|
89227
89612
|
|
|
89228
89613
|
// src/update.ts
|
|
89229
|
-
import
|
|
89614
|
+
import path24 from "node:path";
|
|
89230
89615
|
|
|
89231
89616
|
// src/duration.ts
|
|
89232
89617
|
function duration3(ms) {
|
|
@@ -89244,11 +89629,11 @@ function ago(ms) {
|
|
|
89244
89629
|
}
|
|
89245
89630
|
|
|
89246
89631
|
// src/installOwner.ts
|
|
89247
|
-
import { accessSync, constants } from "node:fs";
|
|
89248
|
-
import
|
|
89632
|
+
import { accessSync, constants as constants2 } from "node:fs";
|
|
89633
|
+
import path23 from "node:path";
|
|
89249
89634
|
|
|
89250
89635
|
// src/version.ts
|
|
89251
|
-
var CLI_VERSION = true ? "0.4.
|
|
89636
|
+
var CLI_VERSION = true ? "0.4.6" : "0.0.0-checkout";
|
|
89252
89637
|
var CLI_RELEASE_BUILD = true ? true : false;
|
|
89253
89638
|
var CLI_PACKAGE_NAME = "@usepowerplant/cli";
|
|
89254
89639
|
|
|
@@ -89272,8 +89657,8 @@ function inspectInstall(entryPath2, env) {
|
|
|
89272
89657
|
inPlace: { ok: false, reason: `the install at ${packageDir} isn't a layout this CLI recognises` }
|
|
89273
89658
|
};
|
|
89274
89659
|
}
|
|
89275
|
-
const modulesDir =
|
|
89276
|
-
const prefix = manager === "npm" ?
|
|
89660
|
+
const modulesDir = path23.dirname(path23.dirname(packageDir));
|
|
89661
|
+
const prefix = manager === "npm" ? path23.dirname(path23.dirname(modulesDir)) : null;
|
|
89277
89662
|
if (!env.isWritableDirectory(modulesDir)) {
|
|
89278
89663
|
return { manager, packageDir, prefix, inPlace: { ok: false, reason: `${modulesDir} isn't writable by you` } };
|
|
89279
89664
|
}
|
|
@@ -89312,7 +89697,7 @@ function manualUpdateCommand(manager, version2, prefix = null, channel3 = "lates
|
|
|
89312
89697
|
return [bin, ...args].join(" ");
|
|
89313
89698
|
}
|
|
89314
89699
|
function installedVersion(packageDir, readTextFile) {
|
|
89315
|
-
const raw = readTextFile(
|
|
89700
|
+
const raw = readTextFile(path23.join(packageDir, "package.json"));
|
|
89316
89701
|
if (raw === null) return null;
|
|
89317
89702
|
try {
|
|
89318
89703
|
const parsed = JSON.parse(raw);
|
|
@@ -89329,7 +89714,7 @@ function realInspectEnvironment() {
|
|
|
89329
89714
|
pnpmHome: process.env.PNPM_HOME,
|
|
89330
89715
|
isWritableDirectory: (dir) => {
|
|
89331
89716
|
try {
|
|
89332
|
-
accessSync(dir,
|
|
89717
|
+
accessSync(dir, constants2.W_OK);
|
|
89333
89718
|
return true;
|
|
89334
89719
|
} catch {
|
|
89335
89720
|
return false;
|
|
@@ -89353,10 +89738,10 @@ var updateProgressSchema = external_exports.object({
|
|
|
89353
89738
|
});
|
|
89354
89739
|
var UPDATE_PROGRESS_STALE_MS = 15 * 6e4;
|
|
89355
89740
|
function updateProgressPath(homeDir) {
|
|
89356
|
-
return
|
|
89741
|
+
return path24.join(collectorStateDir(homeDir), "cli-update.json");
|
|
89357
89742
|
}
|
|
89358
89743
|
function updateLogPath(homeDir) {
|
|
89359
|
-
return
|
|
89744
|
+
return path24.join(collectorStateDir(homeDir), "cli-update.log");
|
|
89360
89745
|
}
|
|
89361
89746
|
function readUpdateProgress(readTextFile, file2 = updateProgressPath()) {
|
|
89362
89747
|
const raw = readTextFile(file2);
|
|
@@ -89549,26 +89934,26 @@ function redactedLogTail(raw) {
|
|
|
89549
89934
|
while (lines.length > 0 && lines[lines.length - 1]?.trim() === "") lines.pop();
|
|
89550
89935
|
return lines.slice(-DOCTOR_LOG_TAIL_LINES);
|
|
89551
89936
|
}
|
|
89552
|
-
function readDoctorLogTail(
|
|
89937
|
+
function readDoctorLogTail(path29) {
|
|
89553
89938
|
let fd;
|
|
89554
89939
|
try {
|
|
89555
|
-
fd =
|
|
89940
|
+
fd = openSync5(path29, "r");
|
|
89556
89941
|
} catch (error62) {
|
|
89557
|
-
if (error62.code === "ENOENT") return { path:
|
|
89558
|
-
return { path:
|
|
89942
|
+
if (error62.code === "ENOENT") return { path: path29, lines: null };
|
|
89943
|
+
return { path: path29, lines: null, readError: error62 instanceof Error ? error62.message : String(error62) };
|
|
89559
89944
|
}
|
|
89560
89945
|
try {
|
|
89561
89946
|
const size = fstatSync(fd).size;
|
|
89562
89947
|
const offset = Math.max(0, size - LOG_TAIL_READ_BYTES);
|
|
89563
89948
|
const buffer = Buffer.alloc(Math.min(size, LOG_TAIL_READ_BYTES));
|
|
89564
|
-
|
|
89949
|
+
readSync5(fd, buffer, 0, buffer.length, offset);
|
|
89565
89950
|
let text = buffer.toString("utf8");
|
|
89566
89951
|
if (offset > 0) text = text.slice(text.indexOf("\n") + 1);
|
|
89567
|
-
return { path:
|
|
89952
|
+
return { path: path29, lines: redactedLogTail(text) };
|
|
89568
89953
|
} catch (error62) {
|
|
89569
|
-
return { path:
|
|
89954
|
+
return { path: path29, lines: null, readError: error62 instanceof Error ? error62.message : String(error62) };
|
|
89570
89955
|
} finally {
|
|
89571
|
-
|
|
89956
|
+
closeSync5(fd);
|
|
89572
89957
|
}
|
|
89573
89958
|
}
|
|
89574
89959
|
function renderDoctorReport(i) {
|
|
@@ -90075,191 +90460,8 @@ async function realPromptLine(question) {
|
|
|
90075
90460
|
}
|
|
90076
90461
|
}
|
|
90077
90462
|
|
|
90078
|
-
// src/memberSessions.ts
|
|
90079
|
-
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
90080
|
-
import { existsSync as existsSync9 } from "node:fs";
|
|
90081
|
-
import { open as open2, readdir as readdir2 } from "node:fs/promises";
|
|
90082
|
-
import os18 from "node:os";
|
|
90083
|
-
import path22 from "node:path";
|
|
90084
|
-
var memberSessionSchema = external_exports.object({
|
|
90085
|
-
id: external_exports.string().min(1),
|
|
90086
|
-
source: external_exports.string().min(1),
|
|
90087
|
-
externalId: external_exports.string().min(1),
|
|
90088
|
-
title: external_exports.string().nullable(),
|
|
90089
|
-
repoDir: external_exports.string().nullable(),
|
|
90090
|
-
machineId: external_exports.string().nullable(),
|
|
90091
|
-
lastActivityAt: external_exports.string().min(1),
|
|
90092
|
-
providerUrl: external_exports.string().nullable(),
|
|
90093
|
-
archived: external_exports.boolean().optional(),
|
|
90094
|
-
subagent: external_exports.boolean().optional()
|
|
90095
|
-
});
|
|
90096
|
-
async function fetchMemberSessions(credentials, fetchImpl = fetch, options = { windowHours: RECENT_SESSION_WINDOW_MS / 36e5, limit: RECENT_SESSION_VISIBLE_LIMIT }) {
|
|
90097
|
-
const { windowHours, limit } = recentSessionOptionsSchema.parse(options);
|
|
90098
|
-
try {
|
|
90099
|
-
const query = new URLSearchParams({ view: "recent", windowHours: String(windowHours), limit: String(limit) });
|
|
90100
|
-
const response = await fetchImpl(`${credentials.apiUrl}/api/collector/member-sessions?${query.toString()}`, {
|
|
90101
|
-
headers: { authorization: `Bearer ${credentials.token}`, ...cliVersionHeaders() },
|
|
90102
|
-
signal: AbortSignal.timeout(1e4)
|
|
90103
|
-
});
|
|
90104
|
-
if (!response.ok) throw new Error(`session read returned ${response.status}`);
|
|
90105
|
-
const { data } = external_exports.object({ data: external_exports.object({
|
|
90106
|
-
sessions: external_exports.array(memberSessionSchema).max(50),
|
|
90107
|
-
nextCursor: external_exports.string().max(512).nullable().optional()
|
|
90108
|
-
}) }).parse(await response.json());
|
|
90109
|
-
return {
|
|
90110
|
-
sessions: data.sessions.slice(0, limit),
|
|
90111
|
-
// Older servers ignore the recent window and omit this field.
|
|
90112
|
-
// A cursor on a supported server is an intentional cap, not a failure.
|
|
90113
|
-
incomplete: data.nextCursor === void 0
|
|
90114
|
-
};
|
|
90115
|
-
} catch {
|
|
90116
|
-
return null;
|
|
90117
|
-
}
|
|
90118
|
-
}
|
|
90119
|
-
function resumeCommand(source, sessionId, powerplantUrl) {
|
|
90120
|
-
return ["resume-session", source, sessionId, "--open", powerplantUrl];
|
|
90121
|
-
}
|
|
90122
|
-
function sessionLinks(session, webUrl, options) {
|
|
90123
|
-
const powerplantUrl = `${webUrl}/rooms/${session.id}`;
|
|
90124
|
-
switch (session.source) {
|
|
90125
|
-
case "claude-code":
|
|
90126
|
-
if (!options.localMachine) return { powerplantUrl };
|
|
90127
|
-
if (options.terminalSession !== void 0) {
|
|
90128
|
-
const { tty, appPid, appName } = options.terminalSession;
|
|
90129
|
-
return {
|
|
90130
|
-
powerplantUrl,
|
|
90131
|
-
extra: {
|
|
90132
|
-
label: `Show in ${appName}`,
|
|
90133
|
-
focus: { tty, appPid },
|
|
90134
|
-
terminal: resumeCommand("claude-code", session.externalId, powerplantUrl)
|
|
90135
|
-
}
|
|
90136
|
-
};
|
|
90137
|
-
}
|
|
90138
|
-
if (options.claudeDesktopSessionId !== void 0) {
|
|
90139
|
-
return {
|
|
90140
|
-
powerplantUrl,
|
|
90141
|
-
extra: {
|
|
90142
|
-
label: "Open in Claude",
|
|
90143
|
-
url: `claude://claude.ai/epitaxy/${encodeURIComponent(options.claudeDesktopSessionId)}`
|
|
90144
|
-
}
|
|
90145
|
-
};
|
|
90146
|
-
}
|
|
90147
|
-
return {
|
|
90148
|
-
powerplantUrl,
|
|
90149
|
-
extra: {
|
|
90150
|
-
label: "Resume in terminal",
|
|
90151
|
-
terminal: resumeCommand("claude-code", session.externalId, powerplantUrl)
|
|
90152
|
-
}
|
|
90153
|
-
};
|
|
90154
|
-
case "codex": {
|
|
90155
|
-
const threadId2 = codexThreadId(session.externalId);
|
|
90156
|
-
if (threadId2 === null || !options.localMachine) return { powerplantUrl };
|
|
90157
|
-
return {
|
|
90158
|
-
powerplantUrl,
|
|
90159
|
-
extra: options.codexDesktop ? { label: "Open in Codex", url: `codex://threads/${threadId2}` } : { label: "Resume in terminal", terminal: resumeCommand("codex", threadId2, powerplantUrl) }
|
|
90160
|
-
};
|
|
90161
|
-
}
|
|
90162
|
-
case "claude-cloud":
|
|
90163
|
-
return {
|
|
90164
|
-
powerplantUrl,
|
|
90165
|
-
extra: { label: "Open on claude.ai", url: `https://claude.ai/code/${encodeURIComponent(session.externalId)}` }
|
|
90166
|
-
};
|
|
90167
|
-
default:
|
|
90168
|
-
return session.providerUrl === null ? { powerplantUrl } : { powerplantUrl, extra: { label: "Open in Cursor", url: session.providerUrl } };
|
|
90169
|
-
}
|
|
90170
|
-
}
|
|
90171
|
-
var TRAILING_UUID = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i;
|
|
90172
|
-
function codexThreadId(externalId) {
|
|
90173
|
-
return TRAILING_UUID.exec(externalId)?.[1] ?? null;
|
|
90174
|
-
}
|
|
90175
|
-
var CODEX_APP_BUNDLES = ["ChatGPT.app", "Codex.app"];
|
|
90176
|
-
var urlSchemesSchema = external_exports.array(external_exports.object({ CFBundleURLSchemes: external_exports.array(external_exports.string()).optional() }));
|
|
90177
|
-
function detectCodexDesktop(probe) {
|
|
90178
|
-
return detectDesktopScheme(CODEX_APP_BUNDLES, "codex", probe);
|
|
90179
|
-
}
|
|
90180
|
-
function detectClaudeDesktop(probe) {
|
|
90181
|
-
return detectDesktopScheme(["Claude.app"], "claude", probe);
|
|
90182
|
-
}
|
|
90183
|
-
function detectDesktopScheme(bundles, scheme, probe = { exists: existsSync9, readUrlSchemes: realReadUrlSchemes }) {
|
|
90184
|
-
const roots = ["/Applications", path22.join(os18.homedir(), "Applications")];
|
|
90185
|
-
return roots.some(
|
|
90186
|
-
(root) => bundles.some((bundle) => {
|
|
90187
|
-
const bundlePath = path22.join(root, bundle);
|
|
90188
|
-
return probe.exists(bundlePath) && probe.readUrlSchemes(bundlePath).includes(scheme);
|
|
90189
|
-
})
|
|
90190
|
-
);
|
|
90191
|
-
}
|
|
90192
|
-
function realReadUrlSchemes(bundlePath) {
|
|
90193
|
-
if (process.platform !== "darwin") return [];
|
|
90194
|
-
try {
|
|
90195
|
-
const json2 = execFileSync6(
|
|
90196
|
-
"plutil",
|
|
90197
|
-
["-extract", "CFBundleURLTypes", "json", "-o", "-", path22.join(bundlePath, "Contents", "Info.plist")],
|
|
90198
|
-
{ stdio: ["ignore", "pipe", "ignore"] }
|
|
90199
|
-
).toString();
|
|
90200
|
-
const parsed = urlSchemesSchema.safeParse(JSON.parse(json2));
|
|
90201
|
-
if (!parsed.success) return [];
|
|
90202
|
-
return parsed.data.flatMap((entry) => entry.CFBundleURLSchemes ?? []);
|
|
90203
|
-
} catch {
|
|
90204
|
-
return [];
|
|
90205
|
-
}
|
|
90206
|
-
}
|
|
90207
|
-
var claudeDesktopSessionSchema = external_exports.object({
|
|
90208
|
-
sessionId: external_exports.string().regex(/^local_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
90209
|
-
cliSessionId: external_exports.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)
|
|
90210
|
-
});
|
|
90211
|
-
async function readClaudeDesktopSessions(wanted, root = path22.join(os18.homedir(), "Library/Application Support/Claude/claude-code-sessions")) {
|
|
90212
|
-
const sessions = /* @__PURE__ */ new Map();
|
|
90213
|
-
const ambiguous = /* @__PURE__ */ new Set();
|
|
90214
|
-
if (wanted.size === 0) return sessions;
|
|
90215
|
-
const buffer = Buffer.alloc(1024 * 1024 + 1);
|
|
90216
|
-
async function visit3(directory, depth) {
|
|
90217
|
-
const entries = await readdir2(directory, { withFileTypes: true }).catch((error62) => {
|
|
90218
|
-
if (isMissingFile(error62)) return [];
|
|
90219
|
-
throw error62;
|
|
90220
|
-
});
|
|
90221
|
-
for (const entry of entries) {
|
|
90222
|
-
const file2 = path22.join(directory, entry.name);
|
|
90223
|
-
if (entry.isDirectory() && depth < 2) {
|
|
90224
|
-
await visit3(file2, depth + 1);
|
|
90225
|
-
} else if (depth === 2 && entry.isFile() && /^local_.*\.json$/.test(entry.name)) {
|
|
90226
|
-
const handle = await open2(file2, "r").catch((error62) => {
|
|
90227
|
-
if (isMissingFile(error62)) return null;
|
|
90228
|
-
throw error62;
|
|
90229
|
-
});
|
|
90230
|
-
if (handle === null) continue;
|
|
90231
|
-
try {
|
|
90232
|
-
const { bytesRead } = await handle.read(buffer);
|
|
90233
|
-
if (bytesRead > 1024 * 1024) continue;
|
|
90234
|
-
const parsed = claudeDesktopSessionSchema.safeParse(
|
|
90235
|
-
JSON.parse(buffer.subarray(0, bytesRead).toString())
|
|
90236
|
-
);
|
|
90237
|
-
if (!parsed.success || !wanted.has(parsed.data.cliSessionId)) continue;
|
|
90238
|
-
const { cliSessionId, sessionId } = parsed.data;
|
|
90239
|
-
if (ambiguous.has(cliSessionId)) continue;
|
|
90240
|
-
if (sessions.has(cliSessionId) && sessions.get(cliSessionId) !== sessionId) {
|
|
90241
|
-
sessions.delete(cliSessionId);
|
|
90242
|
-
ambiguous.add(cliSessionId);
|
|
90243
|
-
} else {
|
|
90244
|
-
sessions.set(cliSessionId, sessionId);
|
|
90245
|
-
}
|
|
90246
|
-
} catch (error62) {
|
|
90247
|
-
if (!(error62 instanceof SyntaxError)) throw error62;
|
|
90248
|
-
} finally {
|
|
90249
|
-
await handle.close();
|
|
90250
|
-
}
|
|
90251
|
-
}
|
|
90252
|
-
}
|
|
90253
|
-
}
|
|
90254
|
-
await visit3(root, 0);
|
|
90255
|
-
return sessions;
|
|
90256
|
-
}
|
|
90257
|
-
function isMissingFile(error62) {
|
|
90258
|
-
return error62 instanceof Error && "code" in error62 && error62.code === "ENOENT";
|
|
90259
|
-
}
|
|
90260
|
-
|
|
90261
90463
|
// src/menu.ts
|
|
90262
|
-
import
|
|
90464
|
+
import path25 from "node:path";
|
|
90263
90465
|
var MENU_CONTRACT = 1;
|
|
90264
90466
|
var CLIENT_NAMES = { claude: "Claude Code", codex: "Codex", cursor: "Cursor" };
|
|
90265
90467
|
function renderMenu(i) {
|
|
@@ -90318,6 +90520,12 @@ function renderMenu(i) {
|
|
|
90318
90520
|
if (agents !== null) {
|
|
90319
90521
|
items.push({ type: "separator" });
|
|
90320
90522
|
items.push({ type: "section", title: "Recent sessions" });
|
|
90523
|
+
if (i.desktopDiagnostic?.outcome === "denied" || i.desktopDiagnostic?.outcome === "failed") {
|
|
90524
|
+
items.push(problem(
|
|
90525
|
+
i.desktopDiagnostic.outcome === "denied" ? "Claude desktop session access was denied" : "Claude desktop sessions could not be read",
|
|
90526
|
+
"Desktop links are unavailable. Retry by reopening this menu; use Terminal or Powerplant in the meantime."
|
|
90527
|
+
));
|
|
90528
|
+
}
|
|
90321
90529
|
items.push(...agents);
|
|
90322
90530
|
}
|
|
90323
90531
|
if (!unsupported && (isUpdateAvailable(i.cliVersion, i.latestVersion) || progress.kind !== "none")) {
|
|
@@ -90340,6 +90548,7 @@ function renderMenu(i) {
|
|
|
90340
90548
|
const icon = attention ? "attention" : i.control.paused ? "paused" : "running";
|
|
90341
90549
|
return {
|
|
90342
90550
|
contract: MENU_CONTRACT,
|
|
90551
|
+
...i.desktopDiagnostic && { desktopDiagnostic: i.desktopDiagnostic },
|
|
90343
90552
|
appEnv: i.config.appEnv,
|
|
90344
90553
|
cliVersion: i.cliVersion,
|
|
90345
90554
|
icon,
|
|
@@ -90456,7 +90665,7 @@ function collectorBlock(i, envArgs, problem) {
|
|
|
90456
90665
|
var AGENT_TITLE_MAX = 48;
|
|
90457
90666
|
function recentAgentItems(i) {
|
|
90458
90667
|
if (i.memberSessions === null) return null;
|
|
90459
|
-
const recent = i.memberSessions.filter((session) => i.now - Date.parse(session.lastActivityAt) < RECENT_SESSION_WINDOW_MS).filter((session) => session.archived !== true && session.subagent !== true).sort((a, b2) => Date.parse(b2.lastActivityAt) - Date.parse(a.lastActivityAt)).map((session) => agentRow(session, i));
|
|
90668
|
+
const recent = i.memberSessions.filter((session) => i.now - Date.parse(session.lastActivityAt) < RECENT_SESSION_WINDOW_MS).filter((session) => session.archived !== true && session.subagent !== true && session.standaloneReview !== true).sort((a, b2) => Date.parse(b2.lastActivityAt) - Date.parse(a.lastActivityAt)).map((session) => agentRow(session, i));
|
|
90460
90669
|
const rows = recent.length === 0 ? [{ type: "status", mark: "muted", title: i.memberSessionsIncomplete ? "No sessions found in the partial list" : "No eligible sessions in the latest results" }] : groupedAgentRows(recent.slice(0, RECENT_SESSION_VISIBLE_LIMIT));
|
|
90461
90670
|
if (i.memberSessionsIncomplete) rows.push({
|
|
90462
90671
|
type: "status",
|
|
@@ -90476,7 +90685,7 @@ function agentRow(session, i) {
|
|
|
90476
90685
|
const trimmed = name.length > AGENT_TITLE_MAX ? `${name.slice(0, AGENT_TITLE_MAX - 1)}\u2026` : name;
|
|
90477
90686
|
const when = ago(i.now - Date.parse(session.lastActivityAt));
|
|
90478
90687
|
const localMachine = i.credentials !== null && session.machineId === i.credentials.machineId;
|
|
90479
|
-
const desktopSessionId = localMachine && session.source === "claude-code" ? i.claudeDesktopSessions?.get(session.externalId) : void 0;
|
|
90688
|
+
const desktopSessionId = localMachine && session.source === "claude-code" ? i.claudeDesktopSessions?.get(session.externalId)?.sessionId : void 0;
|
|
90480
90689
|
const app = desktopSessionId !== void 0 ? "Claude desktop" : isSessionSource(session.source) ? describeSessionSource(session.source) : session.source;
|
|
90481
90690
|
const links = sessionLinks(session, i.config.webUrl, {
|
|
90482
90691
|
codexDesktop: i.codexDesktop,
|
|
@@ -90485,7 +90694,8 @@ function agentRow(session, i) {
|
|
|
90485
90694
|
terminalSession: i.liveTerminalSessions?.get(session.externalId)
|
|
90486
90695
|
});
|
|
90487
90696
|
const agent = {
|
|
90488
|
-
icon: session.source === "codex" ? "chatgpt" : session.source === "cursor" || session.source === "cursor-cloud" ? "cursor" : session.source === "claude-code" || session.source === "claude-cloud" ? "claude" : "unknown"
|
|
90697
|
+
icon: session.source === "codex" ? "chatgpt" : session.source === "cursor" || session.source === "cursor-cloud" ? "cursor" : session.source === "claude-code" || session.source === "claude-cloud" ? "claude" : "unknown",
|
|
90698
|
+
...session.working === true && { working: true }
|
|
90489
90699
|
};
|
|
90490
90700
|
if (links.extra !== void 0) {
|
|
90491
90701
|
const envArgs = i.config.appEnv === "production" ? [] : ["--env", i.config.appEnv];
|
|
@@ -90515,6 +90725,11 @@ function connectionRow(connection, envArgs) {
|
|
|
90515
90725
|
const fix = (title) => ({
|
|
90516
90726
|
type: "action",
|
|
90517
90727
|
title,
|
|
90728
|
+
background: {
|
|
90729
|
+
argv: ["connect", "--background", "--client", connection.client, ...envArgs],
|
|
90730
|
+
progress: `Connecting ${name}\u2026`,
|
|
90731
|
+
detail: connection.client === "cursor" ? "Finish setup in Cursor if prompted." : "Complete sign-in in your browser if prompted."
|
|
90732
|
+
},
|
|
90518
90733
|
terminal: ["connect", "--client", connection.client, ...envArgs]
|
|
90519
90734
|
});
|
|
90520
90735
|
const row = (mark, state) => ({
|
|
@@ -90603,7 +90818,7 @@ function daemonVersionNote(i) {
|
|
|
90603
90818
|
}
|
|
90604
90819
|
var VERSION_CACHE_TTL_MS = 60 * 6e4;
|
|
90605
90820
|
function versionCachePath(homeDir, source = "npm") {
|
|
90606
|
-
return
|
|
90821
|
+
return path25.join(collectorStateDir(homeDir), source === "npm" ? "version-check.json" : "version-check-promoted.json");
|
|
90607
90822
|
}
|
|
90608
90823
|
async function cachedLatestVersion(options) {
|
|
90609
90824
|
const raw = options.readTextFile(options.cacheFile);
|
|
@@ -90631,8 +90846,8 @@ async function cachedLatestVersion(options) {
|
|
|
90631
90846
|
// src/liveTerminalSessions.ts
|
|
90632
90847
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
90633
90848
|
import { readdir as readdir3, readFile as readFile2 } from "node:fs/promises";
|
|
90634
|
-
import
|
|
90635
|
-
import
|
|
90849
|
+
import os20 from "node:os";
|
|
90850
|
+
import path26 from "node:path";
|
|
90636
90851
|
var sessionFileAsObserved = external_exports.looseObject({
|
|
90637
90852
|
pid: external_exports.number().int().positive(),
|
|
90638
90853
|
sessionId: external_exports.string().min(1),
|
|
@@ -90640,8 +90855,8 @@ var sessionFileAsObserved = external_exports.looseObject({
|
|
|
90640
90855
|
});
|
|
90641
90856
|
var START_TIME_TOLERANCE_MS = 3e4;
|
|
90642
90857
|
var SESSION_FILE = /^(\d+)\.json$/;
|
|
90643
|
-
function claudeSessionsDir(homeDir =
|
|
90644
|
-
return
|
|
90858
|
+
function claudeSessionsDir(homeDir = os20.homedir()) {
|
|
90859
|
+
return path26.join(homeDir, ".claude", "sessions");
|
|
90645
90860
|
}
|
|
90646
90861
|
async function readLiveTerminalSessions(wanted, deps = {}) {
|
|
90647
90862
|
const found = /* @__PURE__ */ new Map();
|
|
@@ -90666,7 +90881,7 @@ async function readLiveTerminalSessions(wanted, deps = {}) {
|
|
|
90666
90881
|
}
|
|
90667
90882
|
continue;
|
|
90668
90883
|
}
|
|
90669
|
-
const session = await readSessionFile(
|
|
90884
|
+
const session = await readSessionFile(path26.join(sessionsDir, entry), report2);
|
|
90670
90885
|
if (session === null) continue;
|
|
90671
90886
|
if (session.pid !== Number(match[1])) {
|
|
90672
90887
|
report2({
|
|
@@ -90704,7 +90919,7 @@ async function readSessionFile(file2, report2) {
|
|
|
90704
90919
|
report2({
|
|
90705
90920
|
operation: "claude-session-registry-shape",
|
|
90706
90921
|
message: "A Claude Code session file has a shape this CLI can't read",
|
|
90707
|
-
context: { file:
|
|
90922
|
+
context: { file: path26.basename(file2), shape: describeShape(raw) }
|
|
90708
90923
|
});
|
|
90709
90924
|
return null;
|
|
90710
90925
|
}
|
|
@@ -91101,8 +91316,8 @@ function createTerminalOutput(options) {
|
|
|
91101
91316
|
|
|
91102
91317
|
// src/menubarApp.ts
|
|
91103
91318
|
import { existsSync as existsSync11, mkdirSync as mkdirSync10, renameSync as renameSync3, rmSync as rmSync5 } from "node:fs";
|
|
91104
|
-
import
|
|
91105
|
-
import
|
|
91319
|
+
import os21 from "node:os";
|
|
91320
|
+
import path27 from "node:path";
|
|
91106
91321
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
91107
91322
|
var MENUBAR_APP_ZIP = "dist/menubar/Powerplant.app.zip";
|
|
91108
91323
|
var MENUBAR_APP_NAME = "Powerplant.app";
|
|
@@ -91140,14 +91355,14 @@ async function syncMenubarApp(ops, context2) {
|
|
|
91140
91355
|
}
|
|
91141
91356
|
}
|
|
91142
91357
|
function realMenubarAppOps(input2) {
|
|
91143
|
-
const home = input2.homeDir ??
|
|
91144
|
-
const userAppPath =
|
|
91145
|
-
const candidates = [userAppPath,
|
|
91358
|
+
const home = input2.homeDir ?? os21.homedir();
|
|
91359
|
+
const userAppPath = path27.join(home, "Applications", MENUBAR_APP_NAME);
|
|
91360
|
+
const candidates = [userAppPath, path27.join("/Applications", MENUBAR_APP_NAME)];
|
|
91146
91361
|
return {
|
|
91147
91362
|
cliVersion: input2.cliVersion,
|
|
91148
91363
|
packagedZip: () => {
|
|
91149
91364
|
if (input2.packageDir === null) return null;
|
|
91150
|
-
const zip =
|
|
91365
|
+
const zip = path27.join(input2.packageDir, MENUBAR_APP_ZIP);
|
|
91151
91366
|
return existsSync11(zip) ? zip : null;
|
|
91152
91367
|
},
|
|
91153
91368
|
installedApp: () => {
|
|
@@ -91167,10 +91382,10 @@ function realMenubarAppOps(input2) {
|
|
|
91167
91382
|
throw new Error(`the running app at ${appPath} did not quit`);
|
|
91168
91383
|
},
|
|
91169
91384
|
replace: (zip, appPath) => {
|
|
91170
|
-
const parent =
|
|
91385
|
+
const parent = path27.dirname(appPath);
|
|
91171
91386
|
mkdirSync10(parent, { recursive: true });
|
|
91172
|
-
const staging =
|
|
91173
|
-
const retired =
|
|
91387
|
+
const staging = path27.join(parent, `.${MENUBAR_APP_NAME}.swap-${process.pid}`);
|
|
91388
|
+
const retired = path27.join(parent, `.${MENUBAR_APP_NAME}.old-${process.pid}`);
|
|
91174
91389
|
rmSync5(staging, { recursive: true, force: true });
|
|
91175
91390
|
rmSync5(retired, { recursive: true, force: true });
|
|
91176
91391
|
try {
|
|
@@ -91180,8 +91395,8 @@ function realMenubarAppOps(input2) {
|
|
|
91180
91395
|
`ditto could not extract ${zip} (${extract.stderr?.toString().trim() || `exit ${extract.status}`})`
|
|
91181
91396
|
);
|
|
91182
91397
|
}
|
|
91183
|
-
const extracted =
|
|
91184
|
-
if (!existsSync11(
|
|
91398
|
+
const extracted = path27.join(staging, MENUBAR_APP_NAME);
|
|
91399
|
+
if (!existsSync11(path27.join(extracted, "Contents", "Info.plist"))) {
|
|
91185
91400
|
throw new Error(`${zip} does not contain ${MENUBAR_APP_NAME}`);
|
|
91186
91401
|
}
|
|
91187
91402
|
const hadOld = existsSync11(appPath);
|
|
@@ -91209,7 +91424,7 @@ function realMenubarAppOps(input2) {
|
|
|
91209
91424
|
};
|
|
91210
91425
|
}
|
|
91211
91426
|
function appProcessIds(appPath) {
|
|
91212
|
-
const executable =
|
|
91427
|
+
const executable = path27.join(appPath, "Contents", "MacOS", "PowerplantMenubar");
|
|
91213
91428
|
const result = spawnSync4("ps", ["-axo", "pid=,comm="], { encoding: "utf8" });
|
|
91214
91429
|
if (result.status !== 0) {
|
|
91215
91430
|
throw new Error(`ps could not list processes (${result.error?.message ?? `exit ${result.status}`})`);
|
|
@@ -91238,10 +91453,10 @@ var workspaceSchema = external_exports.object({
|
|
|
91238
91453
|
active: external_exports.boolean()
|
|
91239
91454
|
});
|
|
91240
91455
|
var FETCH_TIMEOUT_MS2 = 1e4;
|
|
91241
|
-
async function callApi(credentials,
|
|
91456
|
+
async function callApi(credentials, path29, init3, fetchImpl) {
|
|
91242
91457
|
let response;
|
|
91243
91458
|
try {
|
|
91244
|
-
response = await fetchImpl(`${credentials.apiUrl}${
|
|
91459
|
+
response = await fetchImpl(`${credentials.apiUrl}${path29}`, {
|
|
91245
91460
|
...init3,
|
|
91246
91461
|
headers: {
|
|
91247
91462
|
authorization: `Bearer ${credentials.token}`,
|
|
@@ -91260,7 +91475,7 @@ async function callApi(credentials, path27, init3, fetchImpl) {
|
|
|
91260
91475
|
);
|
|
91261
91476
|
}
|
|
91262
91477
|
if (!response.ok) {
|
|
91263
|
-
throw new ExpectedCliError(`Powerplant answered ${response.status} for ${
|
|
91478
|
+
throw new ExpectedCliError(`Powerplant answered ${response.status} for ${path29}.`);
|
|
91264
91479
|
}
|
|
91265
91480
|
return response.json();
|
|
91266
91481
|
}
|
|
@@ -91404,7 +91619,8 @@ function parseCliArgs() {
|
|
|
91404
91619
|
"dry-run": { type: "boolean", default: false },
|
|
91405
91620
|
json: { type: "boolean", default: false },
|
|
91406
91621
|
forget: { type: "boolean", default: false },
|
|
91407
|
-
// Internal:
|
|
91622
|
+
// Internal: connect reports unfinished login as failure to the menu.
|
|
91623
|
+
// For update, hands the update to a
|
|
91408
91624
|
// detached copy of this command so the app's verb deadline can't kill
|
|
91409
91625
|
// a package manager mid-install; progress lands in the state file the
|
|
91410
91626
|
// menu reads (update.ts).
|
|
@@ -91579,7 +91795,7 @@ ${USAGE}`);
|
|
|
91579
91795
|
if (outcome.pending > 0) {
|
|
91580
91796
|
console.log(`Some logins are unfinished, re-run \`${connectCommand}\` any time.`);
|
|
91581
91797
|
}
|
|
91582
|
-
|
|
91798
|
+
process.exitCode = connectExitCode(outcome, values.background);
|
|
91583
91799
|
return;
|
|
91584
91800
|
}
|
|
91585
91801
|
case "disconnect": {
|
|
@@ -91691,17 +91907,15 @@ The access you granted these agents stays on your Powerplant account until you r
|
|
|
91691
91907
|
(memberSessions?.sessions ?? []).filter((session) => credentials !== null && session.machineId === credentials.machineId),
|
|
91692
91908
|
(error62, source) => reportDaily(error62, `powerplant-menu-${source}-metadata`)
|
|
91693
91909
|
);
|
|
91694
|
-
const menuSessions = memberSessions?.sessions.map((session) => ({
|
|
91695
|
-
...session,
|
|
91696
|
-
...session.machineId === credentials?.machineId ? localFacts.get(localSessionKey(session)) : {}
|
|
91697
|
-
})) ?? null;
|
|
91698
91910
|
const localClaudeIds = new Set(
|
|
91699
91911
|
(memberSessions?.sessions ?? []).filter((session) => credentials !== null && session.machineId === credentials.machineId && session.source === "claude-code").map((session) => session.externalId)
|
|
91700
91912
|
);
|
|
91701
|
-
const
|
|
91702
|
-
|
|
91703
|
-
|
|
91704
|
-
|
|
91913
|
+
const desktopProbe = await probeClaudeDesktopSessions(
|
|
91914
|
+
localClaudeIds,
|
|
91915
|
+
detectClaudeDesktop(),
|
|
91916
|
+
(error62) => reportDaily(error62, "powerplant-menu-desktop-sessions")
|
|
91917
|
+
);
|
|
91918
|
+
const menuSessions = memberSessions === null ? null : applyLocalFacts(memberSessions.sessions, credentials?.machineId ?? null, localFacts, localSessionKey, desktopProbe.sessions);
|
|
91705
91919
|
const liveTerminalSessions = await readLiveTerminalSessions(localClaudeIds, {
|
|
91706
91920
|
report: (finding) => reportDaily(
|
|
91707
91921
|
new Error(finding.message),
|
|
@@ -91732,7 +91946,8 @@ The access you granted these agents stays on your Powerplant account until you r
|
|
|
91732
91946
|
memberSessions: menuSessions,
|
|
91733
91947
|
memberSessionsIncomplete: memberSessions?.incomplete,
|
|
91734
91948
|
codexDesktop: detectCodexDesktop(),
|
|
91735
|
-
claudeDesktopSessions,
|
|
91949
|
+
claudeDesktopSessions: desktopProbe.sessions,
|
|
91950
|
+
desktopDiagnostic: desktopProbe.diagnostic,
|
|
91736
91951
|
liveTerminalSessions,
|
|
91737
91952
|
update: { inPlace: inspectThisInstall().inPlace.ok, progress: updateProgress.read() },
|
|
91738
91953
|
now: Date.now()
|
|
@@ -91924,8 +92139,8 @@ function startBackgroundUpdate(config2, target) {
|
|
|
91924
92139
|
readProgress: updateProgress.read,
|
|
91925
92140
|
writeProgress: updateProgress.write,
|
|
91926
92141
|
spawnChild: () => {
|
|
91927
|
-
mkdirSync11(
|
|
91928
|
-
const log3 =
|
|
92142
|
+
mkdirSync11(path28.dirname(updateLogPath()), { recursive: true });
|
|
92143
|
+
const log3 = openSync6(updateLogPath(), "a");
|
|
91929
92144
|
const child = spawn2(process.execPath, [entryPath(), "update", ...envArgsFor(config2)], {
|
|
91930
92145
|
detached: true,
|
|
91931
92146
|
stdio: ["ignore", log3, log3],
|
|
@@ -92004,7 +92219,7 @@ function entryPath() {
|
|
|
92004
92219
|
const entry = process.argv[1];
|
|
92005
92220
|
if (!entry) throw new Error("cannot resolve the CLI entry path from argv");
|
|
92006
92221
|
try {
|
|
92007
|
-
return linkedEntryPath(
|
|
92222
|
+
return linkedEntryPath(realpathSync5(entry));
|
|
92008
92223
|
} catch {
|
|
92009
92224
|
return entry;
|
|
92010
92225
|
}
|
|
@@ -92018,6 +92233,7 @@ main().catch(async (error62) => {
|
|
|
92018
92233
|
} else {
|
|
92019
92234
|
console.error(error62);
|
|
92020
92235
|
}
|
|
92236
|
+
if (process.env.POWERPLANT_NATIVE_DIAGNOSTICS === "1") console.error(nativeFailureRecord(error62));
|
|
92021
92237
|
reportCollectorError(error62, `powerplant-cli-${cliCommand}`);
|
|
92022
92238
|
await flushReporting();
|
|
92023
92239
|
process.exitCode = 1;
|