@vibedeckx/linux-x64 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +523 -265
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -26774,14 +26774,14 @@ var require_tls_helpers = __commonJS({
|
|
|
26774
26774
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26775
26775
|
exports.CIPHER_SUITES = void 0;
|
|
26776
26776
|
exports.getDefaultRootsData = getDefaultRootsData;
|
|
26777
|
-
var
|
|
26777
|
+
var fs15 = __require("fs");
|
|
26778
26778
|
exports.CIPHER_SUITES = process.env.GRPC_SSL_CIPHER_SUITES;
|
|
26779
26779
|
var DEFAULT_ROOTS_FILE_PATH = process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH;
|
|
26780
26780
|
var defaultRootsData = null;
|
|
26781
26781
|
function getDefaultRootsData() {
|
|
26782
26782
|
if (DEFAULT_ROOTS_FILE_PATH) {
|
|
26783
26783
|
if (defaultRootsData === null) {
|
|
26784
|
-
defaultRootsData =
|
|
26784
|
+
defaultRootsData = fs15.readFileSync(DEFAULT_ROOTS_FILE_PATH);
|
|
26785
26785
|
}
|
|
26786
26786
|
return defaultRootsData;
|
|
26787
26787
|
}
|
|
@@ -31817,7 +31817,7 @@ var require_fetch = __commonJS({
|
|
|
31817
31817
|
module.exports = fetch2;
|
|
31818
31818
|
var asPromise = require_aspromise();
|
|
31819
31819
|
var inquire = require_inquire();
|
|
31820
|
-
var
|
|
31820
|
+
var fs15 = inquire("fs");
|
|
31821
31821
|
function fetch2(filename, options, callback) {
|
|
31822
31822
|
if (typeof options === "function") {
|
|
31823
31823
|
callback = options;
|
|
@@ -31826,8 +31826,8 @@ var require_fetch = __commonJS({
|
|
|
31826
31826
|
options = {};
|
|
31827
31827
|
if (!callback)
|
|
31828
31828
|
return asPromise(fetch2, this, filename, options);
|
|
31829
|
-
if (!options.xhr &&
|
|
31830
|
-
return
|
|
31829
|
+
if (!options.xhr && fs15 && fs15.readFile)
|
|
31830
|
+
return fs15.readFile(filename, function fetchReadFileCallback(err, contents) {
|
|
31831
31831
|
return err && typeof XMLHttpRequest !== "undefined" ? fetch2.xhr(filename, options, callback) : err ? callback(err) : callback(null, options.binary ? contents : contents.toString("utf8"));
|
|
31832
31832
|
});
|
|
31833
31833
|
return fetch2.xhr(filename, options, callback);
|
|
@@ -38161,7 +38161,7 @@ var require_util3 = __commonJS({
|
|
|
38161
38161
|
"use strict";
|
|
38162
38162
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38163
38163
|
exports.addCommonProtos = exports.loadProtosWithOptionsSync = exports.loadProtosWithOptions = void 0;
|
|
38164
|
-
var
|
|
38164
|
+
var fs15 = __require("fs");
|
|
38165
38165
|
var path22 = __require("path");
|
|
38166
38166
|
var Protobuf = require_protobufjs();
|
|
38167
38167
|
function addIncludePathResolver(root, includePaths) {
|
|
@@ -38173,7 +38173,7 @@ var require_util3 = __commonJS({
|
|
|
38173
38173
|
for (const directory of includePaths) {
|
|
38174
38174
|
const fullPath = path22.join(directory, target);
|
|
38175
38175
|
try {
|
|
38176
|
-
|
|
38176
|
+
fs15.accessSync(fullPath, fs15.constants.R_OK);
|
|
38177
38177
|
return fullPath;
|
|
38178
38178
|
} catch (err) {
|
|
38179
38179
|
continue;
|
|
@@ -47995,7 +47995,7 @@ var require_certificate_provider = __commonJS({
|
|
|
47995
47995
|
"use strict";
|
|
47996
47996
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47997
47997
|
exports.FileWatcherCertificateProvider = void 0;
|
|
47998
|
-
var
|
|
47998
|
+
var fs15 = __require("fs");
|
|
47999
47999
|
var logging = require_logging();
|
|
48000
48000
|
var constants_1 = require_constants2();
|
|
48001
48001
|
var util_1 = __require("util");
|
|
@@ -48003,7 +48003,7 @@ var require_certificate_provider = __commonJS({
|
|
|
48003
48003
|
function trace2(text2) {
|
|
48004
48004
|
logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text2);
|
|
48005
48005
|
}
|
|
48006
|
-
var readFilePromise = (0, util_1.promisify)(
|
|
48006
|
+
var readFilePromise = (0, util_1.promisify)(fs15.readFile);
|
|
48007
48007
|
var FileWatcherCertificateProvider = class {
|
|
48008
48008
|
constructor(config2) {
|
|
48009
48009
|
this.config = config2;
|
|
@@ -49915,7 +49915,7 @@ var require_otlp_grpc_env_configuration = __commonJS({
|
|
|
49915
49915
|
var core_1 = require_src();
|
|
49916
49916
|
var grpc_exporter_transport_1 = require_grpc_exporter_transport();
|
|
49917
49917
|
var node_http_1 = (init_index_node_http(), __toCommonJS(index_node_http_exports));
|
|
49918
|
-
var
|
|
49918
|
+
var fs15 = __require("fs");
|
|
49919
49919
|
var path22 = __require("path");
|
|
49920
49920
|
var api_1 = (init_esm(), __toCommonJS(esm_exports));
|
|
49921
49921
|
function fallbackIfNullishOrBlank(signalSpecific, nonSignalSpecific) {
|
|
@@ -49965,7 +49965,7 @@ var require_otlp_grpc_env_configuration = __commonJS({
|
|
|
49965
49965
|
const filePath = fallbackIfNullishOrBlank(signalSpecificPath, nonSignalSpecificPath);
|
|
49966
49966
|
if (filePath != null) {
|
|
49967
49967
|
try {
|
|
49968
|
-
return
|
|
49968
|
+
return fs15.readFileSync(path22.resolve(process.cwd(), filePath));
|
|
49969
49969
|
} catch {
|
|
49970
49970
|
api_1.diag.warn(warningMessage);
|
|
49971
49971
|
return void 0;
|
|
@@ -51728,7 +51728,7 @@ var require_utils10 = __commonJS({
|
|
|
51728
51728
|
var exporter_metrics_otlp_http_1 = require_src26();
|
|
51729
51729
|
var exporter_metrics_otlp_proto_1 = require_src28();
|
|
51730
51730
|
var sdk_logs_1 = require_src4();
|
|
51731
|
-
var
|
|
51731
|
+
var fs15 = __require("fs");
|
|
51732
51732
|
var RESOURCE_DETECTOR_ENVIRONMENT = "env";
|
|
51733
51733
|
var RESOURCE_DETECTOR_HOST = "host";
|
|
51734
51734
|
var RESOURCE_DETECTOR_OS = "os";
|
|
@@ -52151,21 +52151,21 @@ var require_utils10 = __commonJS({
|
|
|
52151
52151
|
const httpsAgentOptions = {};
|
|
52152
52152
|
if (tls.ca_file) {
|
|
52153
52153
|
try {
|
|
52154
|
-
httpsAgentOptions.ca =
|
|
52154
|
+
httpsAgentOptions.ca = fs15.readFileSync(tls.ca_file);
|
|
52155
52155
|
} catch (e) {
|
|
52156
52156
|
api_1.diag.warn(`Failed to read TLS CA file at ${tls.ca_file}: ${e}`);
|
|
52157
52157
|
}
|
|
52158
52158
|
}
|
|
52159
52159
|
if (tls.cert_file) {
|
|
52160
52160
|
try {
|
|
52161
|
-
httpsAgentOptions.cert =
|
|
52161
|
+
httpsAgentOptions.cert = fs15.readFileSync(tls.cert_file);
|
|
52162
52162
|
} catch (e) {
|
|
52163
52163
|
api_1.diag.warn(`Failed to read TLS cert file at ${tls.cert_file}: ${e}`);
|
|
52164
52164
|
}
|
|
52165
52165
|
}
|
|
52166
52166
|
if (tls.key_file) {
|
|
52167
52167
|
try {
|
|
52168
|
-
httpsAgentOptions.key =
|
|
52168
|
+
httpsAgentOptions.key = fs15.readFileSync(tls.key_file);
|
|
52169
52169
|
} catch (e) {
|
|
52170
52170
|
api_1.diag.warn(`Failed to read TLS key file at ${tls.key_file}: ${e}`);
|
|
52171
52171
|
}
|
|
@@ -60537,14 +60537,14 @@ var require_parser = __commonJS({
|
|
|
60537
60537
|
case "scalar":
|
|
60538
60538
|
case "single-quoted-scalar":
|
|
60539
60539
|
case "double-quoted-scalar": {
|
|
60540
|
-
const
|
|
60540
|
+
const fs15 = this.flowScalar(this.type);
|
|
60541
60541
|
if (atNextItem || it.value) {
|
|
60542
|
-
map2.items.push({ start, key:
|
|
60542
|
+
map2.items.push({ start, key: fs15, sep: [] });
|
|
60543
60543
|
this.onKeyLine = true;
|
|
60544
60544
|
} else if (it.sep) {
|
|
60545
|
-
this.stack.push(
|
|
60545
|
+
this.stack.push(fs15);
|
|
60546
60546
|
} else {
|
|
60547
|
-
Object.assign(it, { key:
|
|
60547
|
+
Object.assign(it, { key: fs15, sep: [] });
|
|
60548
60548
|
this.onKeyLine = true;
|
|
60549
60549
|
}
|
|
60550
60550
|
return;
|
|
@@ -60672,13 +60672,13 @@ var require_parser = __commonJS({
|
|
|
60672
60672
|
case "scalar":
|
|
60673
60673
|
case "single-quoted-scalar":
|
|
60674
60674
|
case "double-quoted-scalar": {
|
|
60675
|
-
const
|
|
60675
|
+
const fs15 = this.flowScalar(this.type);
|
|
60676
60676
|
if (!it || it.value)
|
|
60677
|
-
fc.items.push({ start: [], key:
|
|
60677
|
+
fc.items.push({ start: [], key: fs15, sep: [] });
|
|
60678
60678
|
else if (it.sep)
|
|
60679
|
-
this.stack.push(
|
|
60679
|
+
this.stack.push(fs15);
|
|
60680
60680
|
else
|
|
60681
|
-
Object.assign(it, { key:
|
|
60681
|
+
Object.assign(it, { key: fs15, sep: [] });
|
|
60682
60682
|
return;
|
|
60683
60683
|
}
|
|
60684
60684
|
case "flow-map-end":
|
|
@@ -60994,7 +60994,7 @@ var require_FileConfigFactory = __commonJS({
|
|
|
60994
60994
|
exports.setLoggerProvider = exports.getSeverity = exports.setMeterProvider = exports.getTemporalityPreference = exports.setTracerProvider = exports.setPropagator = exports.setAttributeLimits = exports.setResourceAttributes = exports.parseConfigFile = exports.hasValidConfigFile = exports.FileConfigFactory = void 0;
|
|
60995
60995
|
var core_1 = require_src();
|
|
60996
60996
|
var configModel_1 = require_configModel();
|
|
60997
|
-
var
|
|
60997
|
+
var fs15 = __require("fs");
|
|
60998
60998
|
var yaml = require_dist();
|
|
60999
60999
|
var utils_1 = require_utils11();
|
|
61000
61000
|
var commonModel_1 = require_commonModel();
|
|
@@ -61016,7 +61016,7 @@ var require_FileConfigFactory = __commonJS({
|
|
|
61016
61016
|
function hasValidConfigFile() {
|
|
61017
61017
|
const configFile = (0, core_1.getStringFromEnv)("OTEL_CONFIG_FILE");
|
|
61018
61018
|
if (configFile) {
|
|
61019
|
-
if (!(configFile.endsWith(".yaml") || configFile.endsWith(".yml")) || !
|
|
61019
|
+
if (!(configFile.endsWith(".yaml") || configFile.endsWith(".yml")) || !fs15.existsSync(configFile)) {
|
|
61020
61020
|
api_1.diag.warn(`Config file ${configFile} set on OTEL_CONFIG_FILE is not valid`);
|
|
61021
61021
|
return false;
|
|
61022
61022
|
}
|
|
@@ -61028,7 +61028,7 @@ var require_FileConfigFactory = __commonJS({
|
|
|
61028
61028
|
function parseConfigFile(config2) {
|
|
61029
61029
|
const supportedFileVersions = ["1.0-rc.3"];
|
|
61030
61030
|
const configFile = (0, core_1.getStringFromEnv)("OTEL_CONFIG_FILE") || "";
|
|
61031
|
-
const file2 =
|
|
61031
|
+
const file2 = fs15.readFileSync(configFile, "utf8");
|
|
61032
61032
|
const parsedContent = yaml.parse(file2);
|
|
61033
61033
|
if (parsedContent["file_format"] && supportedFileVersions.includes(parsedContent["file_format"])) {
|
|
61034
61034
|
const disabled = (0, utils_1.getBooleanFromConfigFile)(parsedContent["disabled"]);
|
|
@@ -66890,7 +66890,7 @@ var require_atomic_sleep = __commonJS({
|
|
|
66890
66890
|
var require_sonic_boom = __commonJS({
|
|
66891
66891
|
"../../node_modules/.pnpm/sonic-boom@4.2.0/node_modules/sonic-boom/index.js"(exports, module) {
|
|
66892
66892
|
"use strict";
|
|
66893
|
-
var
|
|
66893
|
+
var fs15 = __require("fs");
|
|
66894
66894
|
var EventEmitter3 = __require("events");
|
|
66895
66895
|
var inherits = __require("util").inherits;
|
|
66896
66896
|
var path22 = __require("path");
|
|
@@ -66947,20 +66947,20 @@ var require_sonic_boom = __commonJS({
|
|
|
66947
66947
|
const mode = sonic.mode;
|
|
66948
66948
|
if (sonic.sync) {
|
|
66949
66949
|
try {
|
|
66950
|
-
if (sonic.mkdir)
|
|
66951
|
-
const fd =
|
|
66950
|
+
if (sonic.mkdir) fs15.mkdirSync(path22.dirname(file2), { recursive: true });
|
|
66951
|
+
const fd = fs15.openSync(file2, flags, mode);
|
|
66952
66952
|
fileOpened(null, fd);
|
|
66953
66953
|
} catch (err) {
|
|
66954
66954
|
fileOpened(err);
|
|
66955
66955
|
throw err;
|
|
66956
66956
|
}
|
|
66957
66957
|
} else if (sonic.mkdir) {
|
|
66958
|
-
|
|
66958
|
+
fs15.mkdir(path22.dirname(file2), { recursive: true }, (err) => {
|
|
66959
66959
|
if (err) return fileOpened(err);
|
|
66960
|
-
|
|
66960
|
+
fs15.open(file2, flags, mode, fileOpened);
|
|
66961
66961
|
});
|
|
66962
66962
|
} else {
|
|
66963
|
-
|
|
66963
|
+
fs15.open(file2, flags, mode, fileOpened);
|
|
66964
66964
|
}
|
|
66965
66965
|
}
|
|
66966
66966
|
function SonicBoom(opts) {
|
|
@@ -67001,16 +67001,16 @@ var require_sonic_boom = __commonJS({
|
|
|
67001
67001
|
this.flush = flushBuffer;
|
|
67002
67002
|
this.flushSync = flushBufferSync;
|
|
67003
67003
|
this._actualWrite = actualWriteBuffer;
|
|
67004
|
-
fsWriteSync = () =>
|
|
67005
|
-
fsWrite = () =>
|
|
67004
|
+
fsWriteSync = () => fs15.writeSync(this.fd, this._writingBuf);
|
|
67005
|
+
fsWrite = () => fs15.write(this.fd, this._writingBuf, this.release);
|
|
67006
67006
|
} else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
|
|
67007
67007
|
this._writingBuf = "";
|
|
67008
67008
|
this.write = write;
|
|
67009
67009
|
this.flush = flush;
|
|
67010
67010
|
this.flushSync = flushSync;
|
|
67011
67011
|
this._actualWrite = actualWrite;
|
|
67012
|
-
fsWriteSync = () =>
|
|
67013
|
-
fsWrite = () =>
|
|
67012
|
+
fsWriteSync = () => fs15.writeSync(this.fd, this._writingBuf, "utf8");
|
|
67013
|
+
fsWrite = () => fs15.write(this.fd, this._writingBuf, "utf8", this.release);
|
|
67014
67014
|
} else {
|
|
67015
67015
|
throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
|
|
67016
67016
|
}
|
|
@@ -67066,7 +67066,7 @@ var require_sonic_boom = __commonJS({
|
|
|
67066
67066
|
}
|
|
67067
67067
|
}
|
|
67068
67068
|
if (this._fsync) {
|
|
67069
|
-
|
|
67069
|
+
fs15.fsyncSync(this.fd);
|
|
67070
67070
|
}
|
|
67071
67071
|
const len = this._len;
|
|
67072
67072
|
if (this._reopening) {
|
|
@@ -67178,7 +67178,7 @@ var require_sonic_boom = __commonJS({
|
|
|
67178
67178
|
const onDrain = () => {
|
|
67179
67179
|
if (!this._fsync) {
|
|
67180
67180
|
try {
|
|
67181
|
-
|
|
67181
|
+
fs15.fsync(this.fd, (err) => {
|
|
67182
67182
|
this._flushPending = false;
|
|
67183
67183
|
cb(err);
|
|
67184
67184
|
});
|
|
@@ -67280,7 +67280,7 @@ var require_sonic_boom = __commonJS({
|
|
|
67280
67280
|
const fd = this.fd;
|
|
67281
67281
|
this.once("ready", () => {
|
|
67282
67282
|
if (fd !== this.fd) {
|
|
67283
|
-
|
|
67283
|
+
fs15.close(fd, (err) => {
|
|
67284
67284
|
if (err) {
|
|
67285
67285
|
return this.emit("error", err);
|
|
67286
67286
|
}
|
|
@@ -67329,7 +67329,7 @@ var require_sonic_boom = __commonJS({
|
|
|
67329
67329
|
buf = this._bufs[0];
|
|
67330
67330
|
}
|
|
67331
67331
|
try {
|
|
67332
|
-
const n =
|
|
67332
|
+
const n = fs15.writeSync(this.fd, buf, "utf8");
|
|
67333
67333
|
const releasedBufObj = releaseWritingBuf(buf, this._len, n);
|
|
67334
67334
|
buf = releasedBufObj.writingBuf;
|
|
67335
67335
|
this._len = releasedBufObj.len;
|
|
@@ -67345,7 +67345,7 @@ var require_sonic_boom = __commonJS({
|
|
|
67345
67345
|
}
|
|
67346
67346
|
}
|
|
67347
67347
|
try {
|
|
67348
|
-
|
|
67348
|
+
fs15.fsyncSync(this.fd);
|
|
67349
67349
|
} catch {
|
|
67350
67350
|
}
|
|
67351
67351
|
}
|
|
@@ -67366,7 +67366,7 @@ var require_sonic_boom = __commonJS({
|
|
|
67366
67366
|
buf = mergeBuf(this._bufs[0], this._lens[0]);
|
|
67367
67367
|
}
|
|
67368
67368
|
try {
|
|
67369
|
-
const n =
|
|
67369
|
+
const n = fs15.writeSync(this.fd, buf);
|
|
67370
67370
|
buf = buf.subarray(n);
|
|
67371
67371
|
this._len = Math.max(this._len - n, 0);
|
|
67372
67372
|
if (buf.length <= 0) {
|
|
@@ -67394,13 +67394,13 @@ var require_sonic_boom = __commonJS({
|
|
|
67394
67394
|
this._writingBuf = this._writingBuf || this._bufs.shift() || "";
|
|
67395
67395
|
if (this.sync) {
|
|
67396
67396
|
try {
|
|
67397
|
-
const written =
|
|
67397
|
+
const written = fs15.writeSync(this.fd, this._writingBuf, "utf8");
|
|
67398
67398
|
release(null, written);
|
|
67399
67399
|
} catch (err) {
|
|
67400
67400
|
release(err);
|
|
67401
67401
|
}
|
|
67402
67402
|
} else {
|
|
67403
|
-
|
|
67403
|
+
fs15.write(this.fd, this._writingBuf, "utf8", release);
|
|
67404
67404
|
}
|
|
67405
67405
|
}
|
|
67406
67406
|
function actualWriteBuffer() {
|
|
@@ -67409,7 +67409,7 @@ var require_sonic_boom = __commonJS({
|
|
|
67409
67409
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
|
|
67410
67410
|
if (this.sync) {
|
|
67411
67411
|
try {
|
|
67412
|
-
const written =
|
|
67412
|
+
const written = fs15.writeSync(this.fd, this._writingBuf);
|
|
67413
67413
|
release(null, written);
|
|
67414
67414
|
} catch (err) {
|
|
67415
67415
|
release(err);
|
|
@@ -67418,7 +67418,7 @@ var require_sonic_boom = __commonJS({
|
|
|
67418
67418
|
if (kCopyBuffer) {
|
|
67419
67419
|
this._writingBuf = Buffer.from(this._writingBuf);
|
|
67420
67420
|
}
|
|
67421
|
-
|
|
67421
|
+
fs15.write(this.fd, this._writingBuf, release);
|
|
67422
67422
|
}
|
|
67423
67423
|
}
|
|
67424
67424
|
function actualClose(sonic) {
|
|
@@ -67434,12 +67434,12 @@ var require_sonic_boom = __commonJS({
|
|
|
67434
67434
|
sonic._lens = [];
|
|
67435
67435
|
assert2(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
|
|
67436
67436
|
try {
|
|
67437
|
-
|
|
67437
|
+
fs15.fsync(sonic.fd, closeWrapped);
|
|
67438
67438
|
} catch {
|
|
67439
67439
|
}
|
|
67440
67440
|
function closeWrapped() {
|
|
67441
67441
|
if (sonic.fd !== 1 && sonic.fd !== 2) {
|
|
67442
|
-
|
|
67442
|
+
fs15.close(sonic.fd, done);
|
|
67443
67443
|
} else {
|
|
67444
67444
|
done();
|
|
67445
67445
|
}
|
|
@@ -82850,12 +82850,12 @@ var require_dist2 = __commonJS({
|
|
|
82850
82850
|
throw new Error(`Unknown format "${name25}"`);
|
|
82851
82851
|
return f2;
|
|
82852
82852
|
};
|
|
82853
|
-
function addFormats(ajv, list,
|
|
82853
|
+
function addFormats(ajv, list, fs15, exportName) {
|
|
82854
82854
|
var _a26;
|
|
82855
82855
|
var _b18;
|
|
82856
82856
|
(_a26 = (_b18 = ajv.opts.code).formats) !== null && _a26 !== void 0 ? _a26 : _b18.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
82857
82857
|
for (const f2 of list)
|
|
82858
|
-
ajv.addFormat(f2,
|
|
82858
|
+
ajv.addFormat(f2, fs15[f2]);
|
|
82859
82859
|
}
|
|
82860
82860
|
module.exports = exports = formatsPlugin;
|
|
82861
82861
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -101342,8 +101342,8 @@ var require_commonjs6 = __commonJS({
|
|
|
101342
101342
|
*
|
|
101343
101343
|
* @internal
|
|
101344
101344
|
*/
|
|
101345
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
101346
|
-
this.#fs = fsFromOption(
|
|
101345
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs15 = defaultFS } = {}) {
|
|
101346
|
+
this.#fs = fsFromOption(fs15);
|
|
101347
101347
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
101348
101348
|
cwd = (0, node_url_1.fileURLToPath)(cwd);
|
|
101349
101349
|
}
|
|
@@ -101902,8 +101902,8 @@ var require_commonjs6 = __commonJS({
|
|
|
101902
101902
|
/**
|
|
101903
101903
|
* @internal
|
|
101904
101904
|
*/
|
|
101905
|
-
newRoot(
|
|
101906
|
-
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
101905
|
+
newRoot(fs15) {
|
|
101906
|
+
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs15 });
|
|
101907
101907
|
}
|
|
101908
101908
|
/**
|
|
101909
101909
|
* Return true if the provided path string is an absolute path
|
|
@@ -101932,8 +101932,8 @@ var require_commonjs6 = __commonJS({
|
|
|
101932
101932
|
/**
|
|
101933
101933
|
* @internal
|
|
101934
101934
|
*/
|
|
101935
|
-
newRoot(
|
|
101936
|
-
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
101935
|
+
newRoot(fs15) {
|
|
101936
|
+
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs15 });
|
|
101937
101937
|
}
|
|
101938
101938
|
/**
|
|
101939
101939
|
* Return true if the provided path string is an absolute path
|
|
@@ -104288,7 +104288,7 @@ var require_createHttpError = __commonJS({
|
|
|
104288
104288
|
var require_send = __commonJS({
|
|
104289
104289
|
"../../node_modules/.pnpm/@fastify+send@4.1.0/node_modules/@fastify/send/lib/send.js"(exports, module) {
|
|
104290
104290
|
"use strict";
|
|
104291
|
-
var
|
|
104291
|
+
var fs15 = __require("node:fs");
|
|
104292
104292
|
var path22 = __require("node:path");
|
|
104293
104293
|
var stream = __require("node:stream");
|
|
104294
104294
|
var debug = __require("node:util").debuglog("send");
|
|
@@ -104497,7 +104497,7 @@ var require_send = __commonJS({
|
|
|
104497
104497
|
}
|
|
104498
104498
|
function tryStat(path23) {
|
|
104499
104499
|
return new Promise((resolve4) => {
|
|
104500
|
-
|
|
104500
|
+
fs15.stat(path23, function onstat(error48, stat2) {
|
|
104501
104501
|
resolve4({ error: error48, stat: stat2 });
|
|
104502
104502
|
});
|
|
104503
104503
|
});
|
|
@@ -104637,7 +104637,7 @@ var require_send = __commonJS({
|
|
|
104637
104637
|
metadata: { path: path23, stat: stat2 }
|
|
104638
104638
|
};
|
|
104639
104639
|
}
|
|
104640
|
-
const stream2 =
|
|
104640
|
+
const stream2 = fs15.createReadStream(path23, {
|
|
104641
104641
|
highWaterMark: options.highWaterMark,
|
|
104642
104642
|
start: offset,
|
|
104643
104643
|
end: Math.max(offset, offset + len - 1)
|
|
@@ -105135,18 +105135,18 @@ var require_dirList = __commonJS({
|
|
|
105135
105135
|
"use strict";
|
|
105136
105136
|
var os2 = __require("node:os");
|
|
105137
105137
|
var path22 = __require("node:path");
|
|
105138
|
-
var
|
|
105138
|
+
var fs15 = __require("node:fs/promises");
|
|
105139
105139
|
var fastq = require_queue();
|
|
105140
105140
|
var fastqConcurrency = Math.max(1, os2.cpus().length - 1);
|
|
105141
105141
|
var dirList = {
|
|
105142
105142
|
_getExtendedInfo: async function(dir, info) {
|
|
105143
105143
|
const depth = dir.split(path22.sep).length;
|
|
105144
|
-
const files = await
|
|
105144
|
+
const files = await fs15.readdir(dir);
|
|
105145
105145
|
const worker = async (filename) => {
|
|
105146
105146
|
const filePath = path22.join(dir, filename);
|
|
105147
105147
|
let stats;
|
|
105148
105148
|
try {
|
|
105149
|
-
stats = await
|
|
105149
|
+
stats = await fs15.stat(filePath);
|
|
105150
105150
|
} catch {
|
|
105151
105151
|
return;
|
|
105152
105152
|
}
|
|
@@ -105190,7 +105190,7 @@ var require_dirList = __commonJS({
|
|
|
105190
105190
|
*/
|
|
105191
105191
|
list: async function(dir, options, dotfiles) {
|
|
105192
105192
|
const entries = { dirs: [], files: [] };
|
|
105193
|
-
let files = await
|
|
105193
|
+
let files = await fs15.readdir(dir);
|
|
105194
105194
|
if (dotfiles === "deny" || dotfiles === "ignore") {
|
|
105195
105195
|
files = files.filter((file2) => file2.charAt(0) !== ".");
|
|
105196
105196
|
}
|
|
@@ -105200,7 +105200,7 @@ var require_dirList = __commonJS({
|
|
|
105200
105200
|
const worker = async (filename) => {
|
|
105201
105201
|
let stats;
|
|
105202
105202
|
try {
|
|
105203
|
-
stats = await
|
|
105203
|
+
stats = await fs15.stat(path22.join(dir, filename));
|
|
105204
105204
|
} catch {
|
|
105205
105205
|
return;
|
|
105206
105206
|
}
|
|
@@ -115594,7 +115594,7 @@ var require_token_io = __commonJS({
|
|
|
115594
115594
|
});
|
|
115595
115595
|
module.exports = __toCommonJS2(token_io_exports);
|
|
115596
115596
|
var import_path15 = __toESM3(__require("path"));
|
|
115597
|
-
var
|
|
115597
|
+
var import_fs9 = __toESM3(__require("fs"));
|
|
115598
115598
|
var import_os4 = __toESM3(__require("os"));
|
|
115599
115599
|
var import_token_error = require_token_error();
|
|
115600
115600
|
function findRootDir() {
|
|
@@ -115602,7 +115602,7 @@ var require_token_io = __commonJS({
|
|
|
115602
115602
|
let dir = process.cwd();
|
|
115603
115603
|
while (dir !== import_path15.default.dirname(dir)) {
|
|
115604
115604
|
const pkgPath = import_path15.default.join(dir, ".vercel");
|
|
115605
|
-
if (
|
|
115605
|
+
if (import_fs9.default.existsSync(pkgPath)) {
|
|
115606
115606
|
return dir;
|
|
115607
115607
|
}
|
|
115608
115608
|
dir = import_path15.default.dirname(dir);
|
|
@@ -115673,7 +115673,7 @@ var require_auth_config = __commonJS({
|
|
|
115673
115673
|
writeAuthConfig: () => writeAuthConfig
|
|
115674
115674
|
});
|
|
115675
115675
|
module.exports = __toCommonJS2(auth_config_exports);
|
|
115676
|
-
var
|
|
115676
|
+
var fs15 = __toESM3(__require("fs"));
|
|
115677
115677
|
var path22 = __toESM3(__require("path"));
|
|
115678
115678
|
var import_token_util = require_token_util();
|
|
115679
115679
|
function getAuthConfigPath() {
|
|
@@ -115688,10 +115688,10 @@ var require_auth_config = __commonJS({
|
|
|
115688
115688
|
function readAuthConfig() {
|
|
115689
115689
|
try {
|
|
115690
115690
|
const authPath = getAuthConfigPath();
|
|
115691
|
-
if (!
|
|
115691
|
+
if (!fs15.existsSync(authPath)) {
|
|
115692
115692
|
return null;
|
|
115693
115693
|
}
|
|
115694
|
-
const content =
|
|
115694
|
+
const content = fs15.readFileSync(authPath, "utf8");
|
|
115695
115695
|
if (!content) {
|
|
115696
115696
|
return null;
|
|
115697
115697
|
}
|
|
@@ -115703,10 +115703,10 @@ var require_auth_config = __commonJS({
|
|
|
115703
115703
|
function writeAuthConfig(config2) {
|
|
115704
115704
|
const authPath = getAuthConfigPath();
|
|
115705
115705
|
const authDir = path22.dirname(authPath);
|
|
115706
|
-
if (!
|
|
115707
|
-
|
|
115706
|
+
if (!fs15.existsSync(authDir)) {
|
|
115707
|
+
fs15.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
115708
115708
|
}
|
|
115709
|
-
|
|
115709
|
+
fs15.writeFileSync(authPath, JSON.stringify(config2, null, 2), { mode: 384 });
|
|
115710
115710
|
}
|
|
115711
115711
|
function isValidAccessToken(authConfig) {
|
|
115712
115712
|
if (!authConfig.token)
|
|
@@ -115853,7 +115853,7 @@ var require_token_util = __commonJS({
|
|
|
115853
115853
|
});
|
|
115854
115854
|
module.exports = __toCommonJS2(token_util_exports);
|
|
115855
115855
|
var path22 = __toESM3(__require("path"));
|
|
115856
|
-
var
|
|
115856
|
+
var fs15 = __toESM3(__require("fs"));
|
|
115857
115857
|
var import_token_error = require_token_error();
|
|
115858
115858
|
var import_token_io = require_token_io();
|
|
115859
115859
|
var import_auth_config = require_auth_config();
|
|
@@ -115938,12 +115938,12 @@ var require_token_util = __commonJS({
|
|
|
115938
115938
|
);
|
|
115939
115939
|
}
|
|
115940
115940
|
const prjPath = path22.join(dir, ".vercel", "project.json");
|
|
115941
|
-
if (!
|
|
115941
|
+
if (!fs15.existsSync(prjPath)) {
|
|
115942
115942
|
throw new import_token_error.VercelOidcTokenError(
|
|
115943
115943
|
"project.json not found, have you linked your project with `vc link?`"
|
|
115944
115944
|
);
|
|
115945
115945
|
}
|
|
115946
|
-
const prj = JSON.parse(
|
|
115946
|
+
const prj = JSON.parse(fs15.readFileSync(prjPath, "utf8"));
|
|
115947
115947
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
115948
115948
|
throw new TypeError(
|
|
115949
115949
|
"Expected a string-valued projectId property. Try running `vc link` to re-link your project."
|
|
@@ -115960,9 +115960,9 @@ var require_token_util = __commonJS({
|
|
|
115960
115960
|
}
|
|
115961
115961
|
const tokenPath = path22.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
115962
115962
|
const tokenJson = JSON.stringify(token);
|
|
115963
|
-
|
|
115964
|
-
|
|
115965
|
-
|
|
115963
|
+
fs15.mkdirSync(path22.dirname(tokenPath), { mode: 504, recursive: true });
|
|
115964
|
+
fs15.writeFileSync(tokenPath, tokenJson);
|
|
115965
|
+
fs15.chmodSync(tokenPath, 432);
|
|
115966
115966
|
return;
|
|
115967
115967
|
}
|
|
115968
115968
|
function loadToken(projectId) {
|
|
@@ -115973,10 +115973,10 @@ var require_token_util = __commonJS({
|
|
|
115973
115973
|
);
|
|
115974
115974
|
}
|
|
115975
115975
|
const tokenPath = path22.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
115976
|
-
if (!
|
|
115976
|
+
if (!fs15.existsSync(tokenPath)) {
|
|
115977
115977
|
return null;
|
|
115978
115978
|
}
|
|
115979
|
-
const token = JSON.parse(
|
|
115979
|
+
const token = JSON.parse(fs15.readFileSync(tokenPath, "utf8"));
|
|
115980
115980
|
assertVercelOidcTokenResponse(token);
|
|
115981
115981
|
return token;
|
|
115982
115982
|
}
|
|
@@ -152239,9 +152239,9 @@ var require_pump = __commonJS({
|
|
|
152239
152239
|
"../../node_modules/.pnpm/pump@3.0.3/node_modules/pump/index.js"(exports, module) {
|
|
152240
152240
|
var once = require_once();
|
|
152241
152241
|
var eos = require_end_of_stream2();
|
|
152242
|
-
var
|
|
152242
|
+
var fs15;
|
|
152243
152243
|
try {
|
|
152244
|
-
|
|
152244
|
+
fs15 = __require("fs");
|
|
152245
152245
|
} catch (e) {
|
|
152246
152246
|
}
|
|
152247
152247
|
var noop4 = function() {
|
|
@@ -152252,8 +152252,8 @@ var require_pump = __commonJS({
|
|
|
152252
152252
|
};
|
|
152253
152253
|
var isFS = function(stream) {
|
|
152254
152254
|
if (!ancient) return false;
|
|
152255
|
-
if (!
|
|
152256
|
-
return (stream instanceof (
|
|
152255
|
+
if (!fs15) return false;
|
|
152256
|
+
return (stream instanceof (fs15.ReadStream || noop4) || stream instanceof (fs15.WriteStream || noop4)) && isFn(stream.close);
|
|
152257
152257
|
};
|
|
152258
152258
|
var isRequest = function(stream) {
|
|
152259
152259
|
return stream.setHeader && isFn(stream.abort);
|
|
@@ -154377,6 +154377,7 @@ import path from "path";
|
|
|
154377
154377
|
var VIBEDECKX_HOME = path.join(homedir(), ".vibedeckx");
|
|
154378
154378
|
var DB_PATH = path.join(VIBEDECKX_HOME, "data.sqlite");
|
|
154379
154379
|
var DEFAULT_PORT = 5173;
|
|
154380
|
+
var MIN_WORKER_VERSION = "0.0.0";
|
|
154380
154381
|
|
|
154381
154382
|
// src/load-env.ts
|
|
154382
154383
|
function getArg(argv, name25) {
|
|
@@ -169192,7 +169193,7 @@ async function run(app, inputs, context2) {
|
|
|
169192
169193
|
}
|
|
169193
169194
|
|
|
169194
169195
|
// src/command.ts
|
|
169195
|
-
import
|
|
169196
|
+
import fs14 from "node:fs";
|
|
169196
169197
|
import path21 from "node:path";
|
|
169197
169198
|
|
|
169198
169199
|
// src/storage/sqlite.ts
|
|
@@ -186051,9 +186052,21 @@ var mapRemoteServer = (row) => ({
|
|
|
186051
186052
|
status: row.status ?? "unknown",
|
|
186052
186053
|
last_connected_at: row.last_connected_at ?? void 0,
|
|
186053
186054
|
cross_remote_access: row.cross_remote_access ?? "off",
|
|
186055
|
+
worker_version: row.worker_version ?? void 0,
|
|
186056
|
+
worker_capabilities: parseWorkerCapabilities(row.worker_capabilities),
|
|
186057
|
+
worker_version_reported_at: row.worker_version_reported_at ?? void 0,
|
|
186054
186058
|
created_at: row.created_at,
|
|
186055
186059
|
updated_at: row.updated_at
|
|
186056
186060
|
});
|
|
186061
|
+
function parseWorkerCapabilities(raw) {
|
|
186062
|
+
if (!raw) return void 0;
|
|
186063
|
+
try {
|
|
186064
|
+
const parsed = JSON.parse(raw);
|
|
186065
|
+
return Array.isArray(parsed) ? parsed.filter((c) => typeof c === "string") : void 0;
|
|
186066
|
+
} catch {
|
|
186067
|
+
return void 0;
|
|
186068
|
+
}
|
|
186069
|
+
}
|
|
186057
186070
|
var mapProjectRemote = (row) => ({
|
|
186058
186071
|
id: row.id,
|
|
186059
186072
|
project_id: row.project_id,
|
|
@@ -186152,6 +186165,14 @@ var createRemoteServerRepos = (kdb, _h) => ({
|
|
|
186152
186165
|
if (status === "online") sets.last_connected_at = sql`datetime('now')`;
|
|
186153
186166
|
await kdb.updateTable("remote_servers").set(sets).where("id", "=", id).execute();
|
|
186154
186167
|
},
|
|
186168
|
+
updateWorkerVersion: async (id, version2, capabilities) => {
|
|
186169
|
+
await kdb.updateTable("remote_servers").set({
|
|
186170
|
+
worker_version: version2,
|
|
186171
|
+
worker_capabilities: JSON.stringify(capabilities),
|
|
186172
|
+
worker_version_reported_at: sql`datetime('now')`,
|
|
186173
|
+
updated_at: sql`datetime('now')`
|
|
186174
|
+
}).where("id", "=", id).execute();
|
|
186175
|
+
},
|
|
186155
186176
|
generateToken: async (id, userId) => {
|
|
186156
186177
|
const existing = await readRemoteServerRow(kdb, id, userId);
|
|
186157
186178
|
if (!existing) return void 0;
|
|
@@ -186618,20 +186639,6 @@ var createAgentSessionRepos = (kdb, h) => ({
|
|
|
186618
186639
|
const row = await kdb.selectFrom("agent_sessions").select(kdb.fn.countAll().as("count")).where("project_id", "=", projectId).where("status", "=", "running").executeTakeFirstOrThrow();
|
|
186619
186640
|
return Number(row.count);
|
|
186620
186641
|
},
|
|
186621
|
-
countAttentionByProject: async (projectId) => {
|
|
186622
|
-
const row = await kdb.selectFrom("agent_sessions").select(kdb.fn.countAll().as("count")).where("project_id", "=", projectId).where((eb) => eb.or([
|
|
186623
|
-
eb("status", "=", "error"),
|
|
186624
|
-
eb.and([
|
|
186625
|
-
eb("status", "=", "stopped"),
|
|
186626
|
-
eb("last_user_message_at", "is not", null),
|
|
186627
|
-
eb.or([
|
|
186628
|
-
eb("last_completed_at", "is", null),
|
|
186629
|
-
eb("last_completed_at", "<", eb.ref("last_user_message_at"))
|
|
186630
|
-
])
|
|
186631
|
-
])
|
|
186632
|
-
])).executeTakeFirstOrThrow();
|
|
186633
|
-
return Number(row.count);
|
|
186634
|
-
},
|
|
186635
186642
|
getByBranch: async (projectId, branch) => {
|
|
186636
186643
|
const row = await kdb.selectFrom("agent_sessions").selectAll().where("project_id", "=", projectId).where("branch", "=", branch).orderBy("updated_at", "desc").limit(1).executeTakeFirst();
|
|
186637
186644
|
return row ? mapAgentSession(row) : void 0;
|
|
@@ -187159,14 +187166,9 @@ var createSearchCacheRepos = (kdb, _h) => ({
|
|
|
187159
187166
|
},
|
|
187160
187167
|
countRemoteSessionActivityByProject: async (projectId) => {
|
|
187161
187168
|
const row = await remoteSessionScope(kdb, projectId).select([
|
|
187162
|
-
sql`coalesce(sum(case when c.status = 'running' then 1 else 0 end), 0)`.as("running")
|
|
187163
|
-
sql`coalesce(sum(case
|
|
187164
|
-
when c.status = 'error' then 1
|
|
187165
|
-
when c.status = 'stopped' and c.last_user_message_at is not null
|
|
187166
|
-
and (c.last_completed_at is null or c.last_completed_at < c.last_user_message_at) then 1
|
|
187167
|
-
else 0 end), 0)`.as("failed")
|
|
187169
|
+
sql`coalesce(sum(case when c.status = 'running' then 1 else 0 end), 0)`.as("running")
|
|
187168
187170
|
]).executeTakeFirstOrThrow();
|
|
187169
|
-
return { running: Number(row.running)
|
|
187171
|
+
return { running: Number(row.running) };
|
|
187170
187172
|
},
|
|
187171
187173
|
updateRemoteSessionActivity: async (entry) => {
|
|
187172
187174
|
return kdb.transaction().execute(async (trx) => {
|
|
@@ -203407,6 +203409,14 @@ var createDatabase = (dbPath) => {
|
|
|
203407
203409
|
`);
|
|
203408
203410
|
}
|
|
203409
203411
|
}
|
|
203412
|
+
{
|
|
203413
|
+
const workerVersionInfo = db.prepare("PRAGMA table_info(remote_servers)").all();
|
|
203414
|
+
for (const column of ["worker_version", "worker_capabilities", "worker_version_reported_at"]) {
|
|
203415
|
+
if (!workerVersionInfo.some((col) => col.name === column)) {
|
|
203416
|
+
db.exec(`ALTER TABLE remote_servers ADD COLUMN ${column} TEXT`);
|
|
203417
|
+
}
|
|
203418
|
+
}
|
|
203419
|
+
}
|
|
203410
203420
|
db.exec("UPDATE remote_servers SET status = 'offline' WHERE status = 'online'");
|
|
203411
203421
|
{
|
|
203412
203422
|
const oldIndex = db.prepare(
|
|
@@ -234438,7 +234448,8 @@ var ProjectChatManager = class {
|
|
|
234438
234448
|
this.startupReconciliationDeadlineMs = Math.max(10, options.startupReconciliationDeadlineMs ?? 1e3);
|
|
234439
234449
|
this.reconciliationOperationTimeoutMs = Math.max(10, options.reconciliationOperationTimeoutMs ?? 250);
|
|
234440
234450
|
this.recoveryPageSize = Math.max(1, Math.min(100, options.recoveryPageSize ?? 25));
|
|
234441
|
-
this.maxConcurrentTurns = Math.max(1, options.maxConcurrentTurns ??
|
|
234451
|
+
this.maxConcurrentTurns = Math.max(1, options.maxConcurrentTurns ?? 50);
|
|
234452
|
+
this.maxConcurrentTurnsPerUser = Math.max(1, options.maxConcurrentTurnsPerUser ?? 4);
|
|
234442
234453
|
this.reconciliationDelayMs = Math.min(100, this.reconciliationIntervalMs);
|
|
234443
234454
|
this.toolDependencies = options.toolDependencies;
|
|
234444
234455
|
this.unsubscribeEvents = options.eventBus?.subscribe((event) => {
|
|
@@ -234478,6 +234489,7 @@ var ProjectChatManager = class {
|
|
|
234478
234489
|
reconciliationOperationTimeoutMs;
|
|
234479
234490
|
recoveryPageSize;
|
|
234480
234491
|
maxConcurrentTurns;
|
|
234492
|
+
maxConcurrentTurnsPerUser;
|
|
234481
234493
|
toolDependencies;
|
|
234482
234494
|
unsubscribeEvents;
|
|
234483
234495
|
startupReconciliation;
|
|
@@ -234488,6 +234500,7 @@ var ProjectChatManager = class {
|
|
|
234488
234500
|
pendingPumps = [];
|
|
234489
234501
|
pendingPumpIds = /* @__PURE__ */ new Set();
|
|
234490
234502
|
activeTurnCount = 0;
|
|
234503
|
+
activeTurnsByUser = /* @__PURE__ */ new Map();
|
|
234491
234504
|
reconciliationTimer = null;
|
|
234492
234505
|
reconciliationDelayMs = 100;
|
|
234493
234506
|
shuttingDown = false;
|
|
@@ -235361,6 +235374,7 @@ var ProjectChatManager = class {
|
|
|
235361
235374
|
pendingApprovals: /* @__PURE__ */ new Map(),
|
|
235362
235375
|
writeTail: Promise.resolve(),
|
|
235363
235376
|
evictionTimer: null,
|
|
235377
|
+
queuedAt: null,
|
|
235364
235378
|
contextRefreshGeneration: 0,
|
|
235365
235379
|
contextRefreshFlight: null,
|
|
235366
235380
|
contextRefreshBroadcast: false
|
|
@@ -235482,22 +235496,51 @@ var ProjectChatManager = class {
|
|
|
235482
235496
|
pump(live) {
|
|
235483
235497
|
if (live.activeWork || this.shuttingDown || this.closingThreads.has(live.thread.id)) return;
|
|
235484
235498
|
if (live.queue.length === 0) return;
|
|
235485
|
-
if (this.
|
|
235486
|
-
|
|
235487
|
-
this.pendingPumpIds.add(live.thread.id);
|
|
235488
|
-
this.pendingPumps.push(live);
|
|
235489
|
-
}
|
|
235499
|
+
if (!this.canStartTurn(live)) {
|
|
235500
|
+
this.enqueuePump(live);
|
|
235490
235501
|
return;
|
|
235491
235502
|
}
|
|
235492
235503
|
this.startPump(live);
|
|
235493
235504
|
}
|
|
235505
|
+
/**
|
|
235506
|
+
* Park a thread that has work but no slot. Queueing is invisible to the
|
|
235507
|
+
* caller and only shows up as latency, so every entry into this state is
|
|
235508
|
+
* logged once with the cap that caused it.
|
|
235509
|
+
*/
|
|
235510
|
+
enqueuePump(live) {
|
|
235511
|
+
if (!this.pendingPumpIds.has(live.thread.id)) {
|
|
235512
|
+
this.pendingPumpIds.add(live.thread.id);
|
|
235513
|
+
this.pendingPumps.push(live);
|
|
235514
|
+
}
|
|
235515
|
+
if (live.queuedAt === null) {
|
|
235516
|
+
live.queuedAt = Date.now();
|
|
235517
|
+
const reason = this.activeTurnCount >= this.maxConcurrentTurns ? "global" : "per-user";
|
|
235518
|
+
console.warn(`[ProjectChat] turn queued (thread=${live.thread.id} user=${live.thread.user_id} reason=${reason} active=${this.activeTurnCount}/${this.maxConcurrentTurns} userActive=${this.activeTurnsByUser.get(live.thread.user_id) ?? 0}/${this.maxConcurrentTurnsPerUser} waiting=${this.pendingPumps.length})`);
|
|
235519
|
+
}
|
|
235520
|
+
if (live.status !== "queued") {
|
|
235521
|
+
live.status = "queued";
|
|
235522
|
+
this.broadcastStatus(live);
|
|
235523
|
+
}
|
|
235524
|
+
}
|
|
235525
|
+
/** A turn may start only when both the global and the per-user cap allow it. */
|
|
235526
|
+
canStartTurn(live) {
|
|
235527
|
+
if (this.activeTurnCount >= this.maxConcurrentTurns) return false;
|
|
235528
|
+
const active = this.activeTurnsByUser.get(live.thread.user_id) ?? 0;
|
|
235529
|
+
return active < this.maxConcurrentTurnsPerUser;
|
|
235530
|
+
}
|
|
235494
235531
|
startPump(live) {
|
|
235495
235532
|
if (live.activeWork || this.shuttingDown || this.closingThreads.has(live.thread.id)) return;
|
|
235496
235533
|
const queued = live.queue.shift();
|
|
235497
235534
|
if (!queued) return;
|
|
235498
235535
|
this.pendingPumpIds.delete(live.thread.id);
|
|
235499
|
-
const
|
|
235536
|
+
const userId = live.thread.user_id;
|
|
235537
|
+
if (live.queuedAt !== null) {
|
|
235538
|
+
console.warn(`[ProjectChat] queued turn started after ${Date.now() - live.queuedAt}ms (thread=${live.thread.id} user=${userId})`);
|
|
235539
|
+
live.queuedAt = null;
|
|
235540
|
+
}
|
|
235541
|
+
const slot = { released: false, userId };
|
|
235500
235542
|
this.activeTurnCount++;
|
|
235543
|
+
this.activeTurnsByUser.set(userId, (this.activeTurnsByUser.get(userId) ?? 0) + 1);
|
|
235501
235544
|
live.activeSlot = slot;
|
|
235502
235545
|
this.cancelEviction(live);
|
|
235503
235546
|
let work;
|
|
@@ -235510,10 +235553,7 @@ var ProjectChatManager = class {
|
|
|
235510
235553
|
live.abortController = null;
|
|
235511
235554
|
if (live.queue.length > 0 && !this.shuttingDown && !this.closingThreads.has(live.thread.id)) {
|
|
235512
235555
|
if (this.pendingPumps.length > 0) {
|
|
235513
|
-
|
|
235514
|
-
this.pendingPumpIds.add(live.thread.id);
|
|
235515
|
-
this.pendingPumps.push(live);
|
|
235516
|
-
}
|
|
235556
|
+
this.enqueuePump(live);
|
|
235517
235557
|
} else {
|
|
235518
235558
|
this.pump(live);
|
|
235519
235559
|
}
|
|
@@ -235531,14 +235571,23 @@ var ProjectChatManager = class {
|
|
|
235531
235571
|
if (slot.released) return;
|
|
235532
235572
|
slot.released = true;
|
|
235533
235573
|
this.activeTurnCount = Math.max(0, this.activeTurnCount - 1);
|
|
235574
|
+
const remaining = (this.activeTurnsByUser.get(slot.userId) ?? 0) - 1;
|
|
235575
|
+
if (remaining > 0) this.activeTurnsByUser.set(slot.userId, remaining);
|
|
235576
|
+
else this.activeTurnsByUser.delete(slot.userId);
|
|
235534
235577
|
this.drainPendingPumps();
|
|
235535
235578
|
}
|
|
235536
235579
|
drainPendingPumps() {
|
|
235580
|
+
for (let index = this.pendingPumps.length - 1; index >= 0; index -= 1) {
|
|
235581
|
+
const live = this.pendingPumps[index];
|
|
235582
|
+
if (!live.activeWork && live.queue.length > 0 && !this.closingThreads.has(live.thread.id) && this.liveThreads.get(live.thread.id) === live) continue;
|
|
235583
|
+
this.pendingPumps.splice(index, 1);
|
|
235584
|
+
this.pendingPumpIds.delete(live.thread.id);
|
|
235585
|
+
}
|
|
235537
235586
|
while (!this.shuttingDown && this.activeTurnCount < this.maxConcurrentTurns) {
|
|
235538
|
-
const
|
|
235539
|
-
if (
|
|
235587
|
+
const index = this.pendingPumps.findIndex((live2) => this.canStartTurn(live2));
|
|
235588
|
+
if (index < 0) return;
|
|
235589
|
+
const [live] = this.pendingPumps.splice(index, 1);
|
|
235540
235590
|
this.pendingPumpIds.delete(live.thread.id);
|
|
235541
|
-
if (live.activeWork || live.queue.length === 0 || this.closingThreads.has(live.thread.id) || this.liveThreads.get(live.thread.id) !== live) continue;
|
|
235542
235591
|
this.startPump(live);
|
|
235543
235592
|
}
|
|
235544
235593
|
}
|
|
@@ -238823,23 +238872,34 @@ var routes3 = async (fastify2) => {
|
|
|
238823
238872
|
const host = request.headers["x-forwarded-host"] || request.headers.host || "localhost";
|
|
238824
238873
|
return `npx vibedeckx@latest connect --connect-to ${proto}://${host} --token ${token}`;
|
|
238825
238874
|
};
|
|
238826
|
-
|
|
238827
|
-
|
|
238828
|
-
|
|
238829
|
-
|
|
238830
|
-
|
|
238831
|
-
|
|
238832
|
-
|
|
238833
|
-
|
|
238834
|
-
|
|
238835
|
-
|
|
238836
|
-
|
|
238837
|
-
|
|
238838
|
-
|
|
238839
|
-
|
|
238840
|
-
|
|
238841
|
-
|
|
238842
|
-
|
|
238875
|
+
const sendConnectToken = async (request, reply, op, failure) => {
|
|
238876
|
+
const userId = requireUserFacingUserId(request, reply);
|
|
238877
|
+
if (userId === null) return;
|
|
238878
|
+
const { id } = request.params;
|
|
238879
|
+
const server = await fastify2.storage.remoteServers.getById(id, userId);
|
|
238880
|
+
if (!server) return reply.code(404).send({ error: "Server not found" });
|
|
238881
|
+
const token = await op(id, userId);
|
|
238882
|
+
if (!token) return reply.code(500).send({ error: failure });
|
|
238883
|
+
return reply.send({ token, connectCommand: connectCommandFor(request, token) });
|
|
238884
|
+
};
|
|
238885
|
+
fastify2.post(
|
|
238886
|
+
"/api/remote-servers/:id/connect-token",
|
|
238887
|
+
(request, reply) => sendConnectToken(
|
|
238888
|
+
request,
|
|
238889
|
+
reply,
|
|
238890
|
+
(id, userId) => fastify2.storage.remoteServers.generateToken(id, userId),
|
|
238891
|
+
"Failed to read token"
|
|
238892
|
+
)
|
|
238893
|
+
);
|
|
238894
|
+
fastify2.post(
|
|
238895
|
+
"/api/remote-servers/:id/connect-token/rotate",
|
|
238896
|
+
(request, reply) => sendConnectToken(
|
|
238897
|
+
request,
|
|
238898
|
+
reply,
|
|
238899
|
+
(id, userId) => fastify2.storage.remoteServers.rotateToken(id, userId),
|
|
238900
|
+
"Failed to rotate token"
|
|
238901
|
+
)
|
|
238902
|
+
);
|
|
238843
238903
|
fastify2.post(
|
|
238844
238904
|
"/api/remote-servers/:id/browse",
|
|
238845
238905
|
async (request, reply) => {
|
|
@@ -238891,8 +238951,8 @@ var routes3 = async (fastify2) => {
|
|
|
238891
238951
|
}
|
|
238892
238952
|
}
|
|
238893
238953
|
);
|
|
238894
|
-
fastify2.
|
|
238895
|
-
"/api/remote-servers/:id/
|
|
238954
|
+
fastify2.delete(
|
|
238955
|
+
"/api/remote-servers/:id/connect-token",
|
|
238896
238956
|
async (request, reply) => {
|
|
238897
238957
|
const userId = requireUserFacingUserId(request, reply);
|
|
238898
238958
|
if (userId === null) return;
|
|
@@ -242059,6 +242119,14 @@ var routes11 = async (fastify2) => {
|
|
|
242059
242119
|
console.error(`[API] remote activity write-through failed for ${req.params.sessionId}:`, error48);
|
|
242060
242120
|
return false;
|
|
242061
242121
|
});
|
|
242122
|
+
ensureRemoteAgentStream(req.params.sessionId, {
|
|
242123
|
+
remoteSessionMap: fastify2.remoteSessionMap,
|
|
242124
|
+
remotePatchCache: fastify2.remotePatchCache,
|
|
242125
|
+
reverseConnectManager: fastify2.reverseConnectManager,
|
|
242126
|
+
eventBus: fastify2.eventBus,
|
|
242127
|
+
agentSessionManager: fastify2.agentSessionManager,
|
|
242128
|
+
storage: fastify2.storage
|
|
242129
|
+
});
|
|
242062
242130
|
if (activityReady === true) {
|
|
242063
242131
|
fastify2.agentSessionManager.emitBranchActivityIfChanged(
|
|
242064
242132
|
projectId,
|
|
@@ -243464,7 +243532,7 @@ var project_chat_routes_default = (0, import_fastify_plugin16.default)(routes15,
|
|
|
243464
243532
|
var import_fastify_plugin17 = __toESM(require_plugin2(), 1);
|
|
243465
243533
|
|
|
243466
243534
|
// src/project-activity.ts
|
|
243467
|
-
var RECENT_THREAD_LIMIT =
|
|
243535
|
+
var RECENT_THREAD_LIMIT = 5;
|
|
243468
243536
|
var RECENT_SESSION_LIMIT = 8;
|
|
243469
243537
|
var RECENT_RUN_LIMIT = 5;
|
|
243470
243538
|
var PRIORITY_TASK_LIMIT = 5;
|
|
@@ -243518,8 +243586,6 @@ async function getProjectActivity(storage, projectId, userId) {
|
|
|
243518
243586
|
attentionRuns,
|
|
243519
243587
|
runningSessions,
|
|
243520
243588
|
runningRuns,
|
|
243521
|
-
failedSessions,
|
|
243522
|
-
failedRuns,
|
|
243523
243589
|
remoteCounts,
|
|
243524
243590
|
nextScheduleAt
|
|
243525
243591
|
] = await Promise.all([
|
|
@@ -243533,8 +243599,6 @@ async function getProjectActivity(storage, projectId, userId) {
|
|
|
243533
243599
|
storage.scheduledTaskRuns.getAttentionByProject(projectId, ATTENTION_LIMIT),
|
|
243534
243600
|
storage.agentSessions.countRunningByProject(projectId),
|
|
243535
243601
|
storage.scheduledTaskRuns.countByProjectStatuses(projectId, ["starting", "running"]),
|
|
243536
|
-
storage.agentSessions.countAttentionByProject(projectId),
|
|
243537
|
-
storage.scheduledTaskRuns.countByProjectStatuses(projectId, ["failed", "timeout"]),
|
|
243538
243602
|
storage.searchCache.countRemoteSessionActivityByProject(projectId),
|
|
243539
243603
|
storage.scheduledTasks.getEarliestNextRunAt(projectId)
|
|
243540
243604
|
]);
|
|
@@ -243577,7 +243641,6 @@ async function getProjectActivity(storage, projectId, userId) {
|
|
|
243577
243641
|
attention,
|
|
243578
243642
|
summary: {
|
|
243579
243643
|
running: runningSessions + runningRuns + remoteCounts.running,
|
|
243580
|
-
failed: failedSessions + failedRuns + remoteCounts.failed,
|
|
243581
243644
|
nextScheduleAt
|
|
243582
243645
|
}
|
|
243583
243646
|
};
|
|
@@ -245347,6 +245410,9 @@ async function authenticateWs(authEnabled, query, socket) {
|
|
|
245347
245410
|
if (!userId) return reject("Invalid authentication token");
|
|
245348
245411
|
return { userId, kind: "user" };
|
|
245349
245412
|
}
|
|
245413
|
+
function processOwnerScope(principal) {
|
|
245414
|
+
return principal.kind === "user" ? principal.userId : null;
|
|
245415
|
+
}
|
|
245350
245416
|
async function localProcessProjectId(fastify2, processId) {
|
|
245351
245417
|
const live = fastify2.processManager.getProcessProjectId(processId);
|
|
245352
245418
|
if (live) return live;
|
|
@@ -245462,7 +245528,7 @@ var routes23 = async (fastify2) => {
|
|
|
245462
245528
|
console.log(`[WebSocket] Auth rejected for process ${processId}`);
|
|
245463
245529
|
return;
|
|
245464
245530
|
}
|
|
245465
|
-
const ownerUserId = principal
|
|
245531
|
+
const ownerUserId = processOwnerScope(principal);
|
|
245466
245532
|
if (ownerUserId !== null && !await userOwnsProcess(fastify2, processId, ownerUserId)) {
|
|
245467
245533
|
console.log(`[WebSocket] Ownership denied for process ${processId} (user=${ownerUserId})`);
|
|
245468
245534
|
try {
|
|
@@ -245531,7 +245597,7 @@ var routes23 = async (fastify2) => {
|
|
|
245531
245597
|
const handleInputMap = /* @__PURE__ */ new Map();
|
|
245532
245598
|
const subscribeProcess = async (processId) => {
|
|
245533
245599
|
if (subs.has(processId)) return;
|
|
245534
|
-
const ownerUserId = principal
|
|
245600
|
+
const ownerUserId = processOwnerScope(principal);
|
|
245535
245601
|
if (ownerUserId !== null && !await userOwnsProcess(fastify2, processId, ownerUserId)) {
|
|
245536
245602
|
console.log(`[ExecutorMux] Ownership denied for process ${processId} (user=${ownerUserId})`);
|
|
245537
245603
|
try {
|
|
@@ -245836,8 +245902,118 @@ var websocket_routes_default = (0, import_fastify_plugin24.default)(routes23, {
|
|
|
245836
245902
|
// src/routes/reverse-connect-routes.ts
|
|
245837
245903
|
var import_fastify_plugin25 = __toESM(require_plugin2(), 1);
|
|
245838
245904
|
import { randomBytes as randomBytes2, createHash as createHash7, verify as cryptoVerify } from "crypto";
|
|
245905
|
+
|
|
245906
|
+
// src/utils/rate-limited-warn.ts
|
|
245907
|
+
function createRateLimitedWarn(windowMs, maxKeys) {
|
|
245908
|
+
const seen = /* @__PURE__ */ new Map();
|
|
245909
|
+
return function warnRateLimited(key, message) {
|
|
245910
|
+
const now3 = Date.now();
|
|
245911
|
+
const entry = seen.get(key);
|
|
245912
|
+
if (entry && now3 - entry.last < windowMs) {
|
|
245913
|
+
entry.suppressed++;
|
|
245914
|
+
return;
|
|
245915
|
+
}
|
|
245916
|
+
if (!entry && seen.size >= maxKeys) {
|
|
245917
|
+
let oldestKey = null;
|
|
245918
|
+
let oldestAt = Infinity;
|
|
245919
|
+
for (const [k2, v2] of seen) {
|
|
245920
|
+
if (now3 - v2.last > windowMs) {
|
|
245921
|
+
seen.delete(k2);
|
|
245922
|
+
continue;
|
|
245923
|
+
}
|
|
245924
|
+
if (v2.last < oldestAt) {
|
|
245925
|
+
oldestAt = v2.last;
|
|
245926
|
+
oldestKey = k2;
|
|
245927
|
+
}
|
|
245928
|
+
}
|
|
245929
|
+
if (seen.size >= maxKeys && oldestKey !== null) seen.delete(oldestKey);
|
|
245930
|
+
}
|
|
245931
|
+
const suppressed = entry?.suppressed ?? 0;
|
|
245932
|
+
seen.set(key, { last: now3, suppressed: 0 });
|
|
245933
|
+
console.warn(
|
|
245934
|
+
message + (suppressed > 0 ? ` (+${suppressed} more in the last ${Math.round(windowMs / 1e3)}s)` : "")
|
|
245935
|
+
);
|
|
245936
|
+
};
|
|
245937
|
+
}
|
|
245938
|
+
|
|
245939
|
+
// src/update-check.ts
|
|
245940
|
+
var SEMVER_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;
|
|
245941
|
+
async function fetchLatestPublishedVersion(pkg = "vibedeckx", fetchImpl = fetch) {
|
|
245942
|
+
try {
|
|
245943
|
+
const response = await fetchImpl(
|
|
245944
|
+
`https://registry.npmjs.org/${pkg}/latest`,
|
|
245945
|
+
{ signal: AbortSignal.timeout(4e3) }
|
|
245946
|
+
);
|
|
245947
|
+
if (!response.ok) return void 0;
|
|
245948
|
+
const body = await response.json();
|
|
245949
|
+
return typeof body.version === "string" && parseSemver(body.version) ? body.version : void 0;
|
|
245950
|
+
} catch {
|
|
245951
|
+
return void 0;
|
|
245952
|
+
}
|
|
245953
|
+
}
|
|
245954
|
+
function parseSemver(version2) {
|
|
245955
|
+
const match2 = SEMVER_RE.exec(version2);
|
|
245956
|
+
if (!match2) return void 0;
|
|
245957
|
+
return {
|
|
245958
|
+
core: [match2[1], match2[2], match2[3]],
|
|
245959
|
+
prerelease: match2[4]?.split(".")
|
|
245960
|
+
};
|
|
245961
|
+
}
|
|
245962
|
+
function compareNumericStrings(a, b2) {
|
|
245963
|
+
if (a.length !== b2.length) return a.length - b2.length;
|
|
245964
|
+
return a < b2 ? -1 : a > b2 ? 1 : 0;
|
|
245965
|
+
}
|
|
245966
|
+
function comparePrereleaseIdentifiers(a, b2) {
|
|
245967
|
+
const aNumeric = /^\d+$/.test(a);
|
|
245968
|
+
const bNumeric = /^\d+$/.test(b2);
|
|
245969
|
+
if (aNumeric && bNumeric) return compareNumericStrings(a, b2);
|
|
245970
|
+
if (aNumeric !== bNumeric) return aNumeric ? -1 : 1;
|
|
245971
|
+
return a < b2 ? -1 : a > b2 ? 1 : 0;
|
|
245972
|
+
}
|
|
245973
|
+
function compareSemver(a, b2) {
|
|
245974
|
+
for (let i = 0; i < 3; i += 1) {
|
|
245975
|
+
const compared = compareNumericStrings(a.core[i], b2.core[i]);
|
|
245976
|
+
if (compared !== 0) return compared;
|
|
245977
|
+
}
|
|
245978
|
+
if (!a.prerelease && !b2.prerelease) return 0;
|
|
245979
|
+
if (!a.prerelease) return 1;
|
|
245980
|
+
if (!b2.prerelease) return -1;
|
|
245981
|
+
const length = Math.max(a.prerelease.length, b2.prerelease.length);
|
|
245982
|
+
for (let i = 0; i < length; i += 1) {
|
|
245983
|
+
const aId = a.prerelease[i];
|
|
245984
|
+
const bId = b2.prerelease[i];
|
|
245985
|
+
if (aId === void 0) return -1;
|
|
245986
|
+
if (bId === void 0) return 1;
|
|
245987
|
+
const compared = comparePrereleaseIdentifiers(aId, bId);
|
|
245988
|
+
if (compared !== 0) return compared;
|
|
245989
|
+
}
|
|
245990
|
+
return 0;
|
|
245991
|
+
}
|
|
245992
|
+
function compareVersionStrings(a, b2) {
|
|
245993
|
+
const parsedA = parseSemver(a);
|
|
245994
|
+
const parsedB = parseSemver(b2);
|
|
245995
|
+
if (!parsedA || !parsedB) return void 0;
|
|
245996
|
+
return compareSemver(parsedA, parsedB);
|
|
245997
|
+
}
|
|
245998
|
+
function compareUpdateStatus(current, latest) {
|
|
245999
|
+
if (latest === void 0) return "unknown";
|
|
246000
|
+
const currentParsed = parseSemver(current);
|
|
246001
|
+
const latestParsed = parseSemver(latest);
|
|
246002
|
+
if (!currentParsed || !latestParsed) return "unknown";
|
|
246003
|
+
return compareSemver(latestParsed, currentParsed) > 0 ? "update-available" : "up-to-date";
|
|
246004
|
+
}
|
|
246005
|
+
|
|
246006
|
+
// src/routes/reverse-connect-routes.ts
|
|
246007
|
+
function extractReportedVersion(frame) {
|
|
246008
|
+
if (typeof frame.version !== "string" || frame.version.length === 0) return void 0;
|
|
246009
|
+
const capabilities = Array.isArray(frame.capabilities) ? frame.capabilities.filter((c) => typeof c === "string") : [];
|
|
246010
|
+
return { version: frame.version, capabilities };
|
|
246011
|
+
}
|
|
245839
246012
|
var MACHINE_HANDSHAKE_TIMEOUT_MS = 5e3;
|
|
246013
|
+
var REJECT_LOG_WINDOW_MS = 3e4;
|
|
246014
|
+
var REJECT_LOG_MAX_KEYS = 500;
|
|
245840
246015
|
var routes24 = async (fastify2) => {
|
|
246016
|
+
const logRejectedUpgrade = createRateLimitedWarn(REJECT_LOG_WINDOW_MS, REJECT_LOG_MAX_KEYS);
|
|
245841
246017
|
fastify2.get("/api/reverse-connect/identity", async (req, reply) => {
|
|
245842
246018
|
const token = req.headers["x-vibedeckx-connect-token"];
|
|
245843
246019
|
if (typeof token !== "string" || token.length === 0) {
|
|
@@ -245856,12 +246032,17 @@ var routes24 = async (fastify2) => {
|
|
|
245856
246032
|
async (socket, req) => {
|
|
245857
246033
|
const token = req.query.token;
|
|
245858
246034
|
if (!token) {
|
|
246035
|
+
logRejectedUpgrade(`no-token:${req.ip}`, `[ReverseConnect] Rejected upgrade from ${req.ip}: no connect token`);
|
|
245859
246036
|
socket.send(JSON.stringify({ error: "Token required" }));
|
|
245860
246037
|
socket.close(4001, "Token required");
|
|
245861
246038
|
return;
|
|
245862
246039
|
}
|
|
245863
246040
|
const server = await fastify2.storage.remoteServers.getByToken(token);
|
|
245864
246041
|
if (!server) {
|
|
246042
|
+
logRejectedUpgrade(
|
|
246043
|
+
`bad-token:${req.ip}`,
|
|
246044
|
+
`[ReverseConnect] Rejected upgrade from ${req.ip}: connect token not recognized \u2014 the worker needs a current token`
|
|
246045
|
+
);
|
|
245865
246046
|
socket.send(JSON.stringify({ error: "Invalid token" }));
|
|
245866
246047
|
socket.close(4001, "Invalid token");
|
|
245867
246048
|
return;
|
|
@@ -245872,12 +246053,27 @@ var routes24 = async (fastify2) => {
|
|
|
245872
246053
|
const ownerId = await fastify2.storage.remoteServers.getOwnerId(serverId) ?? "";
|
|
245873
246054
|
const nonce = randomBytes2(32);
|
|
245874
246055
|
let settled = false;
|
|
246056
|
+
let stashedVersion;
|
|
246057
|
+
const recordWorkerVersion = async (reported) => {
|
|
246058
|
+
if (!reported) {
|
|
246059
|
+
console.log(`[ReverseConnect] Worker ${serverId} reported no version (pre-reporting release)`);
|
|
246060
|
+
return;
|
|
246061
|
+
}
|
|
246062
|
+
await fastify2.storage.remoteServers.updateWorkerVersion(serverId, reported.version, reported.capabilities);
|
|
246063
|
+
const cmp = compareVersionStrings(reported.version, MIN_WORKER_VERSION);
|
|
246064
|
+
if (cmp !== void 0 && cmp < 0) {
|
|
246065
|
+
console.warn(
|
|
246066
|
+
`[ReverseConnect] Worker ${serverId} runs ${reported.version}, below MIN_WORKER_VERSION ${MIN_WORKER_VERSION} \u2014 advise upgrading`
|
|
246067
|
+
);
|
|
246068
|
+
}
|
|
246069
|
+
};
|
|
245875
246070
|
const registerUnauthenticated = async () => {
|
|
245876
246071
|
if (settled) return;
|
|
245877
246072
|
settled = true;
|
|
245878
246073
|
socket.off("message", onChallengeReply);
|
|
245879
246074
|
fastify2.reverseConnectManager.registerConnection(serverId, ws);
|
|
245880
246075
|
await fastify2.storage.remoteServers.updateStatus(serverId, "online");
|
|
246076
|
+
await recordWorkerVersion(stashedVersion);
|
|
245881
246077
|
};
|
|
245882
246078
|
const timer = setTimeout(() => {
|
|
245883
246079
|
registerUnauthenticated().catch((err) => {
|
|
@@ -245892,6 +246088,10 @@ var routes24 = async (fastify2) => {
|
|
|
245892
246088
|
} catch {
|
|
245893
246089
|
return;
|
|
245894
246090
|
}
|
|
246091
|
+
if (frame?.type === "status") {
|
|
246092
|
+
stashedVersion = extractReportedVersion(frame) ?? stashedVersion;
|
|
246093
|
+
return;
|
|
246094
|
+
}
|
|
245895
246095
|
if (frame?.type !== "machine_auth" || settled) return;
|
|
245896
246096
|
settled = true;
|
|
245897
246097
|
clearTimeout(timer);
|
|
@@ -245899,6 +246099,7 @@ var routes24 = async (fastify2) => {
|
|
|
245899
246099
|
const publicKey = frame.publicKey;
|
|
245900
246100
|
const signature = frame.signature;
|
|
245901
246101
|
if (!publicKey || !signature) {
|
|
246102
|
+
logRejectedUpgrade(`malformed-auth:${serverId}`, `[ReverseConnect] Malformed machine auth from ${serverId}`);
|
|
245902
246103
|
socket.close(4003, "Malformed machine auth");
|
|
245903
246104
|
return;
|
|
245904
246105
|
}
|
|
@@ -245909,6 +246110,7 @@ var routes24 = async (fastify2) => {
|
|
|
245909
246110
|
valid = false;
|
|
245910
246111
|
}
|
|
245911
246112
|
if (!valid) {
|
|
246113
|
+
logRejectedUpgrade(`bad-signature:${serverId}`, `[ReverseConnect] Bad machine signature from ${serverId}`);
|
|
245912
246114
|
socket.close(4003, "Bad machine signature");
|
|
245913
246115
|
return;
|
|
245914
246116
|
}
|
|
@@ -245925,6 +246127,7 @@ var routes24 = async (fastify2) => {
|
|
|
245925
246127
|
console.log(`[ReverseConnect] Machine auth verified ${fingerprint.slice(0, 12)} for ${serverId}`);
|
|
245926
246128
|
fastify2.reverseConnectManager.registerConnection(serverId, ws, fingerprint);
|
|
245927
246129
|
await fastify2.storage.remoteServers.updateStatus(serverId, "online");
|
|
246130
|
+
await recordWorkerVersion(extractReportedVersion(frame) ?? stashedVersion);
|
|
245928
246131
|
} catch (err) {
|
|
245929
246132
|
console.error(`[ReverseConnect] Machine challenge handling failed for ${serverId}:`, err);
|
|
245930
246133
|
try {
|
|
@@ -246013,6 +246216,23 @@ var event_routes_default = (0, import_fastify_plugin26.default)(routes25, { name
|
|
|
246013
246216
|
// src/routes/terminal-routes.ts
|
|
246014
246217
|
var import_fastify_plugin27 = __toESM(require_plugin2(), 1);
|
|
246015
246218
|
import path13 from "path";
|
|
246219
|
+
|
|
246220
|
+
// src/utils/path-project.ts
|
|
246221
|
+
async function ensurePathProjectId(fastify2, projectPath) {
|
|
246222
|
+
const pseudoProjectId = `path:${projectPath}`;
|
|
246223
|
+
if (await fastify2.storage.projects.getById(pseudoProjectId)) return pseudoProjectId;
|
|
246224
|
+
const existingByPath = await fastify2.storage.projects.getByPath(projectPath);
|
|
246225
|
+
if (existingByPath) return existingByPath.id;
|
|
246226
|
+
const name25 = projectPath.split("/").filter(Boolean).pop() || projectPath;
|
|
246227
|
+
try {
|
|
246228
|
+
await fastify2.storage.projects.create({ id: pseudoProjectId, name: name25, path: projectPath });
|
|
246229
|
+
} catch (err) {
|
|
246230
|
+
if (!(err instanceof Error && err.message.includes("UNIQUE constraint failed"))) throw err;
|
|
246231
|
+
}
|
|
246232
|
+
return pseudoProjectId;
|
|
246233
|
+
}
|
|
246234
|
+
|
|
246235
|
+
// src/routes/terminal-routes.ts
|
|
246016
246236
|
async function getRemoteConfig5(fastify2, project, remoteServerId) {
|
|
246017
246237
|
const remotes = await fastify2.storage.projectRemotes.getByProject(project.id);
|
|
246018
246238
|
const target = remoteServerId ? remotes.find((r) => r.remote_server_id === remoteServerId) : remotes[0];
|
|
@@ -246030,7 +246250,8 @@ var routes26 = async (fastify2) => {
|
|
|
246030
246250
|
}
|
|
246031
246251
|
const resolvedPath = resolveWorktreePath(projectPath, branch ?? null);
|
|
246032
246252
|
try {
|
|
246033
|
-
const
|
|
246253
|
+
const projectId = await ensurePathProjectId(fastify2, projectPath);
|
|
246254
|
+
const terminal = fastify2.processManager.startTerminal(projectId, resolvedPath, branch ?? null);
|
|
246034
246255
|
return reply.code(201).send({ terminal: { id: terminal.id, name: terminal.name, cwd: resolvedPath } });
|
|
246035
246256
|
} catch (error48) {
|
|
246036
246257
|
console.error(`[terminal-routes] Failed to start terminal in ${resolvedPath}:`, error48);
|
|
@@ -249430,11 +249651,101 @@ function redactErrorSecret(error48, secret) {
|
|
|
249430
249651
|
return redactSecretForms(message, secret);
|
|
249431
249652
|
}
|
|
249432
249653
|
|
|
249654
|
+
// src/utils/package-version.ts
|
|
249655
|
+
import fs7 from "fs";
|
|
249656
|
+
function readPackageVersion() {
|
|
249657
|
+
for (const candidate of ["../package.json", "../../package.json"]) {
|
|
249658
|
+
try {
|
|
249659
|
+
const parsed = JSON.parse(
|
|
249660
|
+
fs7.readFileSync(new URL(candidate, import.meta.url), "utf8")
|
|
249661
|
+
);
|
|
249662
|
+
if (typeof parsed.version === "string" && parsed.version.length > 0) return parsed.version;
|
|
249663
|
+
} catch {
|
|
249664
|
+
}
|
|
249665
|
+
}
|
|
249666
|
+
return "unknown";
|
|
249667
|
+
}
|
|
249668
|
+
|
|
249669
|
+
// src/reverse-connect-capabilities.ts
|
|
249670
|
+
var WORKER_CAPABILITIES = {
|
|
249671
|
+
// --- Agent sessions ---
|
|
249672
|
+
"http:GET /api/path/agent-sessions": { since: "0.2.0", summary: "\u4F1A\u8BDD\u5217\u8868(\u6309\u8DEF\u5F84)" },
|
|
249673
|
+
"http:POST /api/path/agent-sessions": { since: "0.2.0", summary: "\u521B\u5EFA\u4F1A\u8BDD" },
|
|
249674
|
+
"http:POST /api/path/agent-sessions/new": { since: "0.2.0", summary: "\u521B\u5EFA\u4F1A\u8BDD(\u6307\u5B9A ID)" },
|
|
249675
|
+
"http:GET /api/agent-sessions/:param": { since: "0.2.0", summary: "\u8BFB\u4F1A\u8BDD\u8BE6\u60C5/\u5BF9\u8BDD" },
|
|
249676
|
+
"http:POST /api/agent-sessions/:param/message": { since: "0.2.0", summary: "\u53D1\u6D88\u606F\u7ED9\u4F1A\u8BDD" },
|
|
249677
|
+
"http:POST /api/agent-sessions/:param/paste": { since: "0.2.0", summary: "\u7C98\u8D34\u56FE\u7247/\u957F\u6587\u672C" },
|
|
249678
|
+
"http:POST /api/agent-sessions/:param/stop": { since: "0.2.0", summary: "\u505C\u6B62\u4F1A\u8BDD turn" },
|
|
249679
|
+
"http:POST /api/agent-sessions/:param/restart": { since: "0.2.0", summary: "\u91CD\u542F\u4F1A\u8BDD\u8FDB\u7A0B" },
|
|
249680
|
+
"http:POST /api/agent-sessions/:param/agent-type": { since: "0.2.0", summary: "\u5207\u6362 agent \u7C7B\u578B" },
|
|
249681
|
+
"http:POST /api/agent-sessions/:param/model": { since: "0.2.0", summary: "\u5207\u6362\u4F1A\u8BDD\u6A21\u578B" },
|
|
249682
|
+
"http:POST /api/path/agent-sessions/:param/branch": { since: "0.2.0", summary: "\u4ECE\u5386\u53F2\u5206\u53C9\u4F1A\u8BDD" },
|
|
249683
|
+
"http:POST /api/agent-sessions/:param/switch-mode": { since: "0.2.0", summary: "\u6743\u9650\u6A21\u5F0F\u5207\u6362" },
|
|
249684
|
+
"http:POST /api/agent-sessions/:param/accept-plan": { since: "0.2.0", summary: "\u63A5\u53D7\u8BA1\u5212(\u9000\u51FA plan \u6A21\u5F0F)" },
|
|
249685
|
+
"http:POST /api/agent-sessions/:param/approve": { since: "0.2.0", summary: "\u5DE5\u5177\u5BA1\u6279\u51B3\u5B9A" },
|
|
249686
|
+
"http:DELETE /api/agent-sessions/:param": { since: "0.2.0", summary: "\u5220\u9664\u4F1A\u8BDD" },
|
|
249687
|
+
"http:PATCH /api/agent-sessions/:param/title": { since: "0.2.0", summary: "\u6539\u4F1A\u8BDD\u6807\u9898" },
|
|
249688
|
+
"http:PATCH /api/agent-sessions/:param/favorite": { since: "0.2.0", summary: "\u6536\u85CF\u4F1A\u8BDD" },
|
|
249689
|
+
"ws:/api/agent-sessions/:param/stream": { since: "0.2.0", summary: "\u4F1A\u8BDD\u6D88\u606F\u6D41(JSON Patch)" },
|
|
249690
|
+
// --- Executors / processes / terminals ---
|
|
249691
|
+
"http:POST /api/path/execute": { since: "0.2.0", summary: "\u542F\u52A8 executor \u8FDB\u7A0B" },
|
|
249692
|
+
"http:POST /api/execute-one-shot": { since: "0.2.0", summary: "\u4E00\u6B21\u6027\u547D\u4EE4\u6267\u884C" },
|
|
249693
|
+
"http:POST /api/executor-processes/:param/stop": { since: "0.2.0", summary: "\u505C\u6B62 executor \u8FDB\u7A0B" },
|
|
249694
|
+
"http:GET /api/executor-processes/running": { since: "0.2.0", summary: "\u8FD0\u884C\u4E2D\u8FDB\u7A0B\u5217\u8868" },
|
|
249695
|
+
"http:POST /api/path/terminals": { since: "0.2.0", summary: "\u5F00\u7EC8\u7AEF" },
|
|
249696
|
+
"http:POST /api/path/terminals/:param/send": { since: "0.2.0", summary: "\u7EC8\u7AEF\u8F93\u5165" },
|
|
249697
|
+
"ws:/api/executor-processes/:param/logs": { since: "0.2.0", summary: "\u8FDB\u7A0B\u65E5\u5FD7\u6D41" },
|
|
249698
|
+
// --- Workflow runs ---
|
|
249699
|
+
// Empirically bisected via cross-version e2e: 0.2.4 → 404, 0.2.5 → serves.
|
|
249700
|
+
"http:POST /api/path/workflow-runs": { since: "0.2.5", summary: "\u521B\u5EFA workflow run" },
|
|
249701
|
+
"http:GET /api/path/workflow-runs": { since: "0.2.5", summary: "workflow run \u5217\u8868" },
|
|
249702
|
+
"http:GET /api/path/workflow-runs/reviewer-candidate": { since: "0.2.5", summary: "reviewer \u5019\u9009\u67E5\u8BE2" },
|
|
249703
|
+
"http:GET /api/workflow-runs/:param": { since: "0.2.5", summary: "\u8BFB workflow run" },
|
|
249704
|
+
"http:POST /api/workflow-runs/:param/gate": { since: "0.2.5", summary: "workflow \u7528\u6237\u95F8\u95E8\u51B3\u5B9A" },
|
|
249705
|
+
"http:POST /api/workflow-runs/:param/cancel": { since: "0.2.5", summary: "\u53D6\u6D88 workflow run" },
|
|
249706
|
+
// --- Git / worktrees / diff ---
|
|
249707
|
+
"http:GET /api/path/worktrees": { since: "0.2.0", summary: "worktree \u5217\u8868/\u72B6\u6001" },
|
|
249708
|
+
"http:POST /api/path/worktrees": { since: "0.2.0", summary: "\u5EFA worktree" },
|
|
249709
|
+
"http:DELETE /api/path/worktrees": { since: "0.2.0", summary: "\u5220 worktree" },
|
|
249710
|
+
"http:GET /api/path/branches": { since: "0.2.0", summary: "\u5206\u652F\u5217\u8868" },
|
|
249711
|
+
"http:GET /api/path/branches/activity": { since: "0.2.0", summary: "\u5206\u652F\u6D3B\u52A8\u6982\u89C8" },
|
|
249712
|
+
"http:POST /api/path/branches/merge-status": { since: "0.2.0", summary: "\u5206\u652F\u5408\u5E76\u72B6\u6001\u68C0\u6D4B" },
|
|
249713
|
+
"http:GET /api/path/diff": { since: "0.2.0", summary: "\u5DE5\u4F5C\u533A/\u5206\u652F diff" },
|
|
249714
|
+
"http:GET /api/path/commits": { since: "0.2.0", summary: "\u63D0\u4EA4\u5217\u8868" },
|
|
249715
|
+
// --- Files ---
|
|
249716
|
+
"http:GET /api/browse": { since: "0.2.0", summary: "\u6D4F\u89C8\u8FDC\u7AEF\u76EE\u5F55(server \u7BA1\u7406\u9875)" },
|
|
249717
|
+
"http:POST /api/mkdir": { since: "0.2.0", summary: "\u8FDC\u7AEF\u5EFA\u76EE\u5F55" },
|
|
249718
|
+
"http:GET /api/path/browse": { since: "0.2.0", summary: "\u6D4F\u89C8\u9879\u76EE\u76EE\u5F55" },
|
|
249719
|
+
"http:GET /api/path/list-files": { since: "0.2.0", summary: "\u6587\u4EF6\u6811\u5217\u4E3E" },
|
|
249720
|
+
"http:GET /api/path/file-content": { since: "0.2.0", summary: "\u8BFB\u6587\u4EF6\u5185\u5BB9" },
|
|
249721
|
+
"http:GET /api/path/symbol-search": { since: "0.2.0", summary: "\u7B26\u53F7\u641C\u7D22" },
|
|
249722
|
+
"http:GET /api/path/file-download": { since: "0.2.0", summary: "\u6587\u4EF6\u4E0B\u8F7D(\u53EF\u4E8C\u8FDB\u5236)" },
|
|
249723
|
+
"http:POST /api/path/upload": { since: "0.2.0", summary: "\u6587\u4EF6\u4E0A\u4F20" },
|
|
249724
|
+
"http:DELETE /api/path/delete": { since: "0.2.0", summary: "\u5220\u9664\u6587\u4EF6" },
|
|
249725
|
+
// --- Search / notifications / cross-remote ---
|
|
249726
|
+
"http:GET /api/path/search-catalog": { since: "0.2.0", summary: "\u641C\u7D22\u76EE\u5F55\u5FEB\u7167" },
|
|
249727
|
+
// Empirically probed: 0.2.15 → 404, 0.2.16 → 400 (route exists).
|
|
249728
|
+
"http:POST /api/notification-outbox/query": { since: "0.2.16", summary: "\u62C9\u53D6 worker \u901A\u77E5 outbox" },
|
|
249729
|
+
"http:POST /api/path/cross-remote/exec": { since: "0.2.0", summary: "\u8DE8\u8FDC\u7A0B\u7F51\u5173:\u6267\u884C\u547D\u4EE4" },
|
|
249730
|
+
"http:POST /api/path/cross-remote/read-file": { since: "0.2.0", summary: "\u8DE8\u8FDC\u7A0B\u7F51\u5173:\u8BFB\u6587\u4EF6" },
|
|
249731
|
+
"http:POST /api/path/cross-remote/list-dir": { since: "0.2.0", summary: "\u8DE8\u8FDC\u7A0B\u7F51\u5173:\u5217\u76EE\u5F55" },
|
|
249732
|
+
"http:POST /api/path/cross-remote/stat": { since: "0.2.0", summary: "\u8DE8\u8FDC\u7A0B\u7F51\u5173:stat" },
|
|
249733
|
+
"http:POST /api/path/cross-remote/process-list": { since: "0.2.0", summary: "\u8DE8\u8FDC\u7A0B\u7F51\u5173:\u8FDB\u7A0B\u5217\u8868" },
|
|
249734
|
+
// --- Raw passthrough ---
|
|
249735
|
+
// Browser preview proxies caller-supplied paths (and localhost ports) through
|
|
249736
|
+
// the tunnel; the path set is unbounded by design, so it registers as one
|
|
249737
|
+
// passthrough capability instead of per-route entries.
|
|
249738
|
+
"passthrough:browser-proxy": { since: "0.2.0", summary: "\u6D4F\u89C8\u5668\u9884\u89C8\u900F\u4F20(\u4EFB\u610F path+port)" }
|
|
249739
|
+
};
|
|
249740
|
+
var WORKER_CAPABILITY_KEYS = Object.keys(WORKER_CAPABILITIES);
|
|
249741
|
+
|
|
249433
249742
|
// src/reverse-connect-client.ts
|
|
249434
249743
|
var MACHINE_KEY_SETTING = "reverse_machine_private_key";
|
|
249435
249744
|
var RECONNECT_BASE_DELAY_MS = 1e3;
|
|
249436
249745
|
var RECONNECT_MAX_DELAY_MS = 3e4;
|
|
249437
249746
|
var NO_PING_TIMEOUT_MS = 6e4;
|
|
249747
|
+
var AUTH_REJECT_CODES = /* @__PURE__ */ new Set([4001, 4003]);
|
|
249748
|
+
var HEALTHY_CONNECTION_MS = 5e3;
|
|
249438
249749
|
function isTextualContentType(contentType) {
|
|
249439
249750
|
const t = contentType.toLowerCase();
|
|
249440
249751
|
if (t === "") return true;
|
|
@@ -249448,6 +249759,7 @@ var ReverseConnectClient = class {
|
|
|
249448
249759
|
localPort;
|
|
249449
249760
|
localChannels = /* @__PURE__ */ new Map();
|
|
249450
249761
|
reconnectAttempt = 0;
|
|
249762
|
+
openedAt = null;
|
|
249451
249763
|
reconnectTimer = null;
|
|
249452
249764
|
noPingTimer = null;
|
|
249453
249765
|
shuttingDown = false;
|
|
@@ -249468,10 +249780,15 @@ var ReverseConnectClient = class {
|
|
|
249468
249780
|
maxPayload: 11 * 1024 * 1024
|
|
249469
249781
|
});
|
|
249470
249782
|
this.ws.on("open", () => {
|
|
249471
|
-
console.log("[ReverseClient]
|
|
249472
|
-
this.
|
|
249783
|
+
console.log("[ReverseClient] Socket open, awaiting server handshake");
|
|
249784
|
+
this.openedAt = Date.now();
|
|
249473
249785
|
this.resetNoPingTimer();
|
|
249474
|
-
const frame = {
|
|
249786
|
+
const frame = {
|
|
249787
|
+
type: "status",
|
|
249788
|
+
ready: true,
|
|
249789
|
+
version: readPackageVersion(),
|
|
249790
|
+
capabilities: WORKER_CAPABILITY_KEYS
|
|
249791
|
+
};
|
|
249475
249792
|
this.ws.send(JSON.stringify(frame));
|
|
249476
249793
|
});
|
|
249477
249794
|
this.ws.on("message", (data) => {
|
|
@@ -249484,7 +249801,19 @@ var ReverseConnectClient = class {
|
|
|
249484
249801
|
});
|
|
249485
249802
|
this.ws.on("close", (code, reason) => {
|
|
249486
249803
|
const safeReason = redactSecretForms(reason?.toString() || "", this.token);
|
|
249487
|
-
|
|
249804
|
+
const rejected = AUTH_REJECT_CODES.has(code);
|
|
249805
|
+
const uptime = this.openedAt === null ? 0 : Date.now() - this.openedAt;
|
|
249806
|
+
if (rejected) {
|
|
249807
|
+
console.error(
|
|
249808
|
+
`[ReverseClient] Server rejected this connection (code=${code}, reason=${safeReason}). ` + (code === 4001 ? "The connect token is no longer valid \u2014 open Settings \u2192 Remote Servers, read the current token, and re-run `vibedeckx connect` with it." : "This machine's identity was refused \u2014 the remote record may belong to another machine or another account.") + " Retrying with backoff, but it will not recover on its own."
|
|
249809
|
+
);
|
|
249810
|
+
} else {
|
|
249811
|
+
console.log(`[ReverseClient] Disconnected (code=${code}, reason=${safeReason})`);
|
|
249812
|
+
}
|
|
249813
|
+
if (!rejected && this.openedAt !== null && uptime >= HEALTHY_CONNECTION_MS) {
|
|
249814
|
+
this.reconnectAttempt = 0;
|
|
249815
|
+
}
|
|
249816
|
+
this.openedAt = null;
|
|
249488
249817
|
this.clearNoPingTimer();
|
|
249489
249818
|
this.closeAllLocalChannels();
|
|
249490
249819
|
this.ws = null;
|
|
@@ -249548,7 +249877,9 @@ var ReverseConnectClient = class {
|
|
|
249548
249877
|
const reply = {
|
|
249549
249878
|
type: "machine_auth",
|
|
249550
249879
|
publicKey: publicKeyPem,
|
|
249551
|
-
signature: signature.toString("base64")
|
|
249880
|
+
signature: signature.toString("base64"),
|
|
249881
|
+
version: readPackageVersion(),
|
|
249882
|
+
capabilities: WORKER_CAPABILITY_KEYS
|
|
249552
249883
|
};
|
|
249553
249884
|
this.sendFrame(reply);
|
|
249554
249885
|
} catch (err) {
|
|
@@ -249741,71 +250072,8 @@ var ReverseConnectClient = class {
|
|
|
249741
250072
|
// src/connect-daemon.ts
|
|
249742
250073
|
import { spawn as spawn5 } from "node:child_process";
|
|
249743
250074
|
import { randomUUID as randomUUID23 } from "node:crypto";
|
|
249744
|
-
import
|
|
250075
|
+
import fs8 from "node:fs";
|
|
249745
250076
|
import path19 from "node:path";
|
|
249746
|
-
|
|
249747
|
-
// src/update-check.ts
|
|
249748
|
-
var SEMVER_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;
|
|
249749
|
-
async function fetchLatestPublishedVersion(pkg = "vibedeckx", fetchImpl = fetch) {
|
|
249750
|
-
try {
|
|
249751
|
-
const response = await fetchImpl(
|
|
249752
|
-
`https://registry.npmjs.org/${pkg}/latest`,
|
|
249753
|
-
{ signal: AbortSignal.timeout(4e3) }
|
|
249754
|
-
);
|
|
249755
|
-
if (!response.ok) return void 0;
|
|
249756
|
-
const body = await response.json();
|
|
249757
|
-
return typeof body.version === "string" && parseSemver(body.version) ? body.version : void 0;
|
|
249758
|
-
} catch {
|
|
249759
|
-
return void 0;
|
|
249760
|
-
}
|
|
249761
|
-
}
|
|
249762
|
-
function parseSemver(version2) {
|
|
249763
|
-
const match2 = SEMVER_RE.exec(version2);
|
|
249764
|
-
if (!match2) return void 0;
|
|
249765
|
-
return {
|
|
249766
|
-
core: [match2[1], match2[2], match2[3]],
|
|
249767
|
-
prerelease: match2[4]?.split(".")
|
|
249768
|
-
};
|
|
249769
|
-
}
|
|
249770
|
-
function compareNumericStrings(a, b2) {
|
|
249771
|
-
if (a.length !== b2.length) return a.length - b2.length;
|
|
249772
|
-
return a < b2 ? -1 : a > b2 ? 1 : 0;
|
|
249773
|
-
}
|
|
249774
|
-
function comparePrereleaseIdentifiers(a, b2) {
|
|
249775
|
-
const aNumeric = /^\d+$/.test(a);
|
|
249776
|
-
const bNumeric = /^\d+$/.test(b2);
|
|
249777
|
-
if (aNumeric && bNumeric) return compareNumericStrings(a, b2);
|
|
249778
|
-
if (aNumeric !== bNumeric) return aNumeric ? -1 : 1;
|
|
249779
|
-
return a < b2 ? -1 : a > b2 ? 1 : 0;
|
|
249780
|
-
}
|
|
249781
|
-
function compareSemver(a, b2) {
|
|
249782
|
-
for (let i = 0; i < 3; i += 1) {
|
|
249783
|
-
const compared = compareNumericStrings(a.core[i], b2.core[i]);
|
|
249784
|
-
if (compared !== 0) return compared;
|
|
249785
|
-
}
|
|
249786
|
-
if (!a.prerelease && !b2.prerelease) return 0;
|
|
249787
|
-
if (!a.prerelease) return 1;
|
|
249788
|
-
if (!b2.prerelease) return -1;
|
|
249789
|
-
const length = Math.max(a.prerelease.length, b2.prerelease.length);
|
|
249790
|
-
for (let i = 0; i < length; i += 1) {
|
|
249791
|
-
const aId = a.prerelease[i];
|
|
249792
|
-
const bId = b2.prerelease[i];
|
|
249793
|
-
if (aId === void 0) return -1;
|
|
249794
|
-
if (bId === void 0) return 1;
|
|
249795
|
-
const compared = comparePrereleaseIdentifiers(aId, bId);
|
|
249796
|
-
if (compared !== 0) return compared;
|
|
249797
|
-
}
|
|
249798
|
-
return 0;
|
|
249799
|
-
}
|
|
249800
|
-
function compareUpdateStatus(current, latest) {
|
|
249801
|
-
if (latest === void 0) return "unknown";
|
|
249802
|
-
const currentParsed = parseSemver(current);
|
|
249803
|
-
const latestParsed = parseSemver(latest);
|
|
249804
|
-
if (!currentParsed || !latestParsed) return "unknown";
|
|
249805
|
-
return compareSemver(latestParsed, currentParsed) > 0 ? "update-available" : "up-to-date";
|
|
249806
|
-
}
|
|
249807
|
-
|
|
249808
|
-
// src/connect-daemon.ts
|
|
249809
250077
|
var CONNECT_DAEMON_CHILD_ENV = "VIBEDECKX_INTERNAL_CONNECT_DAEMON";
|
|
249810
250078
|
var CONNECT_DAEMON_TOKEN_ENV = "VIBEDECKX_INTERNAL_CONNECT_TOKEN";
|
|
249811
250079
|
function buildDaemonChildArgs(argv) {
|
|
@@ -250143,7 +250411,7 @@ function parseLinuxProcessStartTicks(stat2) {
|
|
|
250143
250411
|
function readLinuxProcessStartTicks(pid) {
|
|
250144
250412
|
try {
|
|
250145
250413
|
return parseLinuxProcessStartTicks(
|
|
250146
|
-
|
|
250414
|
+
fs8.readFileSync(`/proc/${pid}/stat`, "utf8")
|
|
250147
250415
|
);
|
|
250148
250416
|
} catch (error48) {
|
|
250149
250417
|
if (error48 instanceof Error && "code" in error48 && (error48.code === "ENOENT" || error48.code === "ESRCH")) {
|
|
@@ -250172,7 +250440,7 @@ function daemonStateLockOwnerPath(lockPath) {
|
|
|
250172
250440
|
function readDaemonStateLockOwner(lockPath) {
|
|
250173
250441
|
let contents;
|
|
250174
250442
|
try {
|
|
250175
|
-
contents =
|
|
250443
|
+
contents = fs8.readFileSync(daemonStateLockOwnerPath(lockPath), "utf8");
|
|
250176
250444
|
} catch (error48) {
|
|
250177
250445
|
if (hasErrorCode(error48, "ENOENT") || hasErrorCode(error48, "ENOTDIR")) {
|
|
250178
250446
|
return void 0;
|
|
@@ -250200,26 +250468,26 @@ function createDaemonStateLockCandidate(lockPath) {
|
|
|
250200
250468
|
nonce: randomUUID23()
|
|
250201
250469
|
};
|
|
250202
250470
|
const candidatePath = `${lockPath}.candidate-${process.pid}-${owner.nonce}`;
|
|
250203
|
-
|
|
250471
|
+
fs8.mkdirSync(candidatePath, { mode: 448 });
|
|
250204
250472
|
try {
|
|
250205
|
-
|
|
250473
|
+
fs8.chmodSync(candidatePath, 448);
|
|
250206
250474
|
const ownerPath = daemonStateLockOwnerPath(candidatePath);
|
|
250207
|
-
|
|
250475
|
+
fs8.writeFileSync(ownerPath, `${JSON.stringify(owner)}
|
|
250208
250476
|
`, {
|
|
250209
250477
|
flag: "wx",
|
|
250210
250478
|
mode: 384
|
|
250211
250479
|
});
|
|
250212
|
-
|
|
250480
|
+
fs8.chmodSync(ownerPath, 384);
|
|
250213
250481
|
return { path: candidatePath, owner };
|
|
250214
250482
|
} catch (error48) {
|
|
250215
|
-
|
|
250483
|
+
fs8.rmSync(candidatePath, { recursive: true, force: true });
|
|
250216
250484
|
throw error48;
|
|
250217
250485
|
}
|
|
250218
250486
|
}
|
|
250219
250487
|
function quarantineRecoverableDaemonStateLock(lockPath) {
|
|
250220
250488
|
let stat2;
|
|
250221
250489
|
try {
|
|
250222
|
-
stat2 =
|
|
250490
|
+
stat2 = fs8.lstatSync(lockPath);
|
|
250223
250491
|
} catch (error48) {
|
|
250224
250492
|
if (hasErrorCode(error48, "ENOENT")) return;
|
|
250225
250493
|
throw error48;
|
|
@@ -250232,7 +250500,7 @@ function quarantineRecoverableDaemonStateLock(lockPath) {
|
|
|
250232
250500
|
}
|
|
250233
250501
|
const quarantinePath = `${lockPath}.stale-${stat2.dev}-${stat2.ino}-${String(stat2.ctimeMs).replace(".", "-")}`;
|
|
250234
250502
|
try {
|
|
250235
|
-
|
|
250503
|
+
fs8.renameSync(lockPath, quarantinePath);
|
|
250236
250504
|
} catch (error48) {
|
|
250237
250505
|
if (hasErrorCode(error48, "ENOENT") || hasErrorCode(error48, "EEXIST") || hasErrorCode(error48, "ENOTEMPTY")) {
|
|
250238
250506
|
return;
|
|
@@ -250246,7 +250514,7 @@ function acquireDaemonStateLock(lockPath) {
|
|
|
250246
250514
|
try {
|
|
250247
250515
|
for (let attempt = 0; attempt < 8; attempt += 1) {
|
|
250248
250516
|
try {
|
|
250249
|
-
|
|
250517
|
+
fs8.renameSync(candidate.path, lockPath);
|
|
250250
250518
|
acquired = true;
|
|
250251
250519
|
return candidate.owner;
|
|
250252
250520
|
} catch (error48) {
|
|
@@ -250261,7 +250529,7 @@ function acquireDaemonStateLock(lockPath) {
|
|
|
250261
250529
|
);
|
|
250262
250530
|
} finally {
|
|
250263
250531
|
if (!acquired) {
|
|
250264
|
-
|
|
250532
|
+
fs8.rmSync(candidate.path, { recursive: true, force: true });
|
|
250265
250533
|
}
|
|
250266
250534
|
}
|
|
250267
250535
|
}
|
|
@@ -250272,7 +250540,7 @@ function sweepLockQuarantine(lockPath) {
|
|
|
250272
250540
|
const candidatePrefix = `${base}.candidate-`;
|
|
250273
250541
|
let entries;
|
|
250274
250542
|
try {
|
|
250275
|
-
entries =
|
|
250543
|
+
entries = fs8.readdirSync(runDir);
|
|
250276
250544
|
} catch {
|
|
250277
250545
|
return;
|
|
250278
250546
|
}
|
|
@@ -250286,7 +250554,7 @@ function sweepLockQuarantine(lockPath) {
|
|
|
250286
250554
|
}
|
|
250287
250555
|
if (!removable) continue;
|
|
250288
250556
|
try {
|
|
250289
|
-
|
|
250557
|
+
fs8.rmSync(path19.join(runDir, entry), { recursive: true, force: true });
|
|
250290
250558
|
} catch {
|
|
250291
250559
|
}
|
|
250292
250560
|
}
|
|
@@ -250298,13 +250566,13 @@ function releaseDaemonStateLock(lockPath, expected) {
|
|
|
250298
250566
|
`Cannot release daemon state lock at ${lockPath}: lock ownership changed`
|
|
250299
250567
|
);
|
|
250300
250568
|
}
|
|
250301
|
-
|
|
250569
|
+
fs8.rmSync(lockPath, { recursive: true });
|
|
250302
250570
|
}
|
|
250303
250571
|
function withDaemonStateLock(dataDir, operation) {
|
|
250304
250572
|
const lockPath = daemonStateLockPath(dataDir);
|
|
250305
250573
|
const runDir = path19.dirname(lockPath);
|
|
250306
|
-
|
|
250307
|
-
|
|
250574
|
+
fs8.mkdirSync(runDir, { recursive: true, mode: 448 });
|
|
250575
|
+
fs8.chmodSync(runDir, 448);
|
|
250308
250576
|
const owner = acquireDaemonStateLock(lockPath);
|
|
250309
250577
|
try {
|
|
250310
250578
|
sweepLockQuarantine(lockPath);
|
|
@@ -250322,7 +250590,7 @@ function inspectDaemonState(dataDir) {
|
|
|
250322
250590
|
const statePath = daemonStatePath(dataDir);
|
|
250323
250591
|
let contents;
|
|
250324
250592
|
try {
|
|
250325
|
-
contents =
|
|
250593
|
+
contents = fs8.readFileSync(statePath, "utf8");
|
|
250326
250594
|
} catch (error48) {
|
|
250327
250595
|
if (error48 instanceof Error && "code" in error48 && error48.code === "ENOENT") {
|
|
250328
250596
|
return { kind: "missing" };
|
|
@@ -250534,14 +250802,14 @@ function claimDaemonStateUnlocked(dataDir, connectTo, version2) {
|
|
|
250534
250802
|
version: version2
|
|
250535
250803
|
};
|
|
250536
250804
|
const statePath = daemonStatePath(dataDir);
|
|
250537
|
-
|
|
250538
|
-
|
|
250539
|
-
|
|
250805
|
+
fs8.mkdirSync(path19.dirname(statePath), { recursive: true, mode: 448 });
|
|
250806
|
+
fs8.chmodSync(path19.dirname(statePath), 448);
|
|
250807
|
+
fs8.writeFileSync(statePath, `${JSON.stringify(state)}
|
|
250540
250808
|
`, {
|
|
250541
250809
|
flag: "wx",
|
|
250542
250810
|
mode: 384
|
|
250543
250811
|
});
|
|
250544
|
-
|
|
250812
|
+
fs8.chmodSync(statePath, 384);
|
|
250545
250813
|
return state;
|
|
250546
250814
|
}
|
|
250547
250815
|
function removeDaemonStateIfOwned(dataDir, expected) {
|
|
@@ -250554,7 +250822,7 @@ function removeDaemonStateIfOwnedUnlocked(dataDir, expected) {
|
|
|
250554
250822
|
const statePath = daemonStatePath(dataDir);
|
|
250555
250823
|
let contents;
|
|
250556
250824
|
try {
|
|
250557
|
-
contents =
|
|
250825
|
+
contents = fs8.readFileSync(statePath, "utf8");
|
|
250558
250826
|
} catch (error48) {
|
|
250559
250827
|
if (hasErrorCode(error48, "ENOENT")) return false;
|
|
250560
250828
|
throw error48;
|
|
@@ -250569,7 +250837,7 @@ function removeDaemonStateIfOwnedUnlocked(dataDir, expected) {
|
|
|
250569
250837
|
return false;
|
|
250570
250838
|
}
|
|
250571
250839
|
try {
|
|
250572
|
-
|
|
250840
|
+
fs8.unlinkSync(statePath);
|
|
250573
250841
|
return true;
|
|
250574
250842
|
} catch (error48) {
|
|
250575
250843
|
if (hasErrorCode(error48, "ENOENT")) return false;
|
|
@@ -250679,26 +250947,26 @@ import path20 from "node:path";
|
|
|
250679
250947
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
250680
250948
|
import { promisify as promisify8 } from "node:util";
|
|
250681
250949
|
import childProcess from "node:child_process";
|
|
250682
|
-
import
|
|
250950
|
+
import fs13, { constants as fsConstants4 } from "node:fs/promises";
|
|
250683
250951
|
|
|
250684
250952
|
// ../../node_modules/.pnpm/wsl-utils@0.1.0/node_modules/wsl-utils/index.js
|
|
250685
250953
|
import process4 from "node:process";
|
|
250686
|
-
import
|
|
250954
|
+
import fs12, { constants as fsConstants3 } from "node:fs/promises";
|
|
250687
250955
|
|
|
250688
250956
|
// ../../node_modules/.pnpm/is-wsl@3.1.0/node_modules/is-wsl/index.js
|
|
250689
250957
|
import process3 from "node:process";
|
|
250690
250958
|
import os from "node:os";
|
|
250691
|
-
import
|
|
250959
|
+
import fs11 from "node:fs";
|
|
250692
250960
|
|
|
250693
250961
|
// ../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
|
|
250694
|
-
import
|
|
250962
|
+
import fs10 from "node:fs";
|
|
250695
250963
|
|
|
250696
250964
|
// ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
|
|
250697
|
-
import
|
|
250965
|
+
import fs9 from "node:fs";
|
|
250698
250966
|
var isDockerCached;
|
|
250699
250967
|
function hasDockerEnv() {
|
|
250700
250968
|
try {
|
|
250701
|
-
|
|
250969
|
+
fs9.statSync("/.dockerenv");
|
|
250702
250970
|
return true;
|
|
250703
250971
|
} catch {
|
|
250704
250972
|
return false;
|
|
@@ -250706,7 +250974,7 @@ function hasDockerEnv() {
|
|
|
250706
250974
|
}
|
|
250707
250975
|
function hasDockerCGroup() {
|
|
250708
250976
|
try {
|
|
250709
|
-
return
|
|
250977
|
+
return fs9.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
250710
250978
|
} catch {
|
|
250711
250979
|
return false;
|
|
250712
250980
|
}
|
|
@@ -250722,7 +250990,7 @@ function isDocker() {
|
|
|
250722
250990
|
var cachedResult;
|
|
250723
250991
|
var hasContainerEnv = () => {
|
|
250724
250992
|
try {
|
|
250725
|
-
|
|
250993
|
+
fs10.statSync("/run/.containerenv");
|
|
250726
250994
|
return true;
|
|
250727
250995
|
} catch {
|
|
250728
250996
|
return false;
|
|
@@ -250747,7 +251015,7 @@ var isWsl = () => {
|
|
|
250747
251015
|
return true;
|
|
250748
251016
|
}
|
|
250749
251017
|
try {
|
|
250750
|
-
return
|
|
251018
|
+
return fs11.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isInsideContainer() : false;
|
|
250751
251019
|
} catch {
|
|
250752
251020
|
return false;
|
|
250753
251021
|
}
|
|
@@ -250765,14 +251033,14 @@ var wslDrivesMountPoint = /* @__PURE__ */ (() => {
|
|
|
250765
251033
|
const configFilePath = "/etc/wsl.conf";
|
|
250766
251034
|
let isConfigFileExists = false;
|
|
250767
251035
|
try {
|
|
250768
|
-
await
|
|
251036
|
+
await fs12.access(configFilePath, fsConstants3.F_OK);
|
|
250769
251037
|
isConfigFileExists = true;
|
|
250770
251038
|
} catch {
|
|
250771
251039
|
}
|
|
250772
251040
|
if (!isConfigFileExists) {
|
|
250773
251041
|
return defaultMountPoint;
|
|
250774
251042
|
}
|
|
250775
|
-
const configContent = await
|
|
251043
|
+
const configContent = await fs12.readFile(configFilePath, { encoding: "utf8" });
|
|
250776
251044
|
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
250777
251045
|
if (!configMountPoint) {
|
|
250778
251046
|
return defaultMountPoint;
|
|
@@ -251077,7 +251345,7 @@ var baseOpen = async (options) => {
|
|
|
251077
251345
|
const isBundled = !__dirname2 || __dirname2 === "/";
|
|
251078
251346
|
let exeLocalXdgOpen = false;
|
|
251079
251347
|
try {
|
|
251080
|
-
await
|
|
251348
|
+
await fs13.access(localXdgOpenPath, fsConstants4.X_OK);
|
|
251081
251349
|
exeLocalXdgOpen = true;
|
|
251082
251350
|
} catch {
|
|
251083
251351
|
}
|
|
@@ -251192,21 +251460,11 @@ function loadTLSOptions(flags) {
|
|
|
251192
251460
|
process.exit(1);
|
|
251193
251461
|
}
|
|
251194
251462
|
return {
|
|
251195
|
-
cert:
|
|
251196
|
-
key:
|
|
251197
|
-
...clientCAPath && { clientCA:
|
|
251463
|
+
cert: fs14.readFileSync(certPath),
|
|
251464
|
+
key: fs14.readFileSync(keyPath),
|
|
251465
|
+
...clientCAPath && { clientCA: fs14.readFileSync(clientCAPath) }
|
|
251198
251466
|
};
|
|
251199
251467
|
}
|
|
251200
|
-
function readPackageVersion() {
|
|
251201
|
-
try {
|
|
251202
|
-
const parsed = JSON.parse(
|
|
251203
|
-
fs13.readFileSync(new URL("../package.json", import.meta.url), "utf8")
|
|
251204
|
-
);
|
|
251205
|
-
return typeof parsed.version === "string" && parsed.version.length > 0 ? parsed.version : "unknown";
|
|
251206
|
-
} catch {
|
|
251207
|
-
return "unknown";
|
|
251208
|
-
}
|
|
251209
|
-
}
|
|
251210
251468
|
var startCommand = buildCommand({
|
|
251211
251469
|
parameters: {
|
|
251212
251470
|
flags: {
|