@dimi-agent/cli 0.2.1 → 0.3.0
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/main.mjs +386 -288
- package/package.json +6 -6
package/dist/main.mjs
CHANGED
|
@@ -5,8 +5,8 @@ const __filename = __cjsShimFileURLToPath(import.meta.url);
|
|
|
5
5
|
const __dirname = __cjsShimDirname(__filename);
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import * as nodeFs from "node:fs";
|
|
8
|
-
import
|
|
9
|
-
import fs
|
|
8
|
+
import Vt, { ReadStream, accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSync, createReadStream, createWriteStream, existsSync, fstatSync, lstatSync, mkdirSync, openSync, promises, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
9
|
+
import fs, { access, appendFile, chmod, copyFile, cp, lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
10
10
|
import so from "node:assert";
|
|
11
11
|
import net, { BlockList, isIP } from "node:net";
|
|
12
12
|
import http, { createServer } from "node:http";
|
|
@@ -53909,7 +53909,7 @@ var require_dist_cjs$11 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
53909
53909
|
const { setCredentialFeature } = (init_client$2(), __toCommonJS(client_exports));
|
|
53910
53910
|
const { CredentialsProviderError } = (init_config$3(), __toCommonJS(config_exports));
|
|
53911
53911
|
const { NodeHttpHandler } = require_dist_cjs$12();
|
|
53912
|
-
const fs$
|
|
53912
|
+
const fs$21 = __require("node:fs/promises");
|
|
53913
53913
|
const { HttpRequest } = (init_protocols$1(), __toCommonJS(protocols_exports));
|
|
53914
53914
|
const { sdkStreamMixin, parseRfc3339DateTime } = (init_serde(), __toCommonJS(serde_exports));
|
|
53915
53915
|
const ECS_CONTAINER_HOST = "169.254.170.2";
|
|
@@ -54012,7 +54012,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
|
|
|
54012
54012
|
const requestTimeout = options.timeout ?? 1e3;
|
|
54013
54013
|
const provider = retryWrapper(async () => {
|
|
54014
54014
|
const request = createGetRequest(url);
|
|
54015
|
-
if (tokenFile) request.headers.Authorization = validateToken((await fs$
|
|
54015
|
+
if (tokenFile) request.headers.Authorization = validateToken((await fs$21.readFile(tokenFile)).toString());
|
|
54016
54016
|
else if (token) request.headers.Authorization = validateToken(token);
|
|
54017
54017
|
try {
|
|
54018
54018
|
return getCredentials((await requestHandler.handle(request, { requestTimeout })).response).then((creds) => setCredentialFeature(creds, "CREDENTIALS_HTTP", "z"));
|
|
@@ -71550,7 +71550,7 @@ var require_util$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
71550
71550
|
exports.removeUndefinedValuesInObject = removeUndefinedValuesInObject;
|
|
71551
71551
|
exports.isValidFile = isValidFile;
|
|
71552
71552
|
exports.getWellKnownCertificateConfigFileLocation = getWellKnownCertificateConfigFileLocation;
|
|
71553
|
-
const fs$
|
|
71553
|
+
const fs$20 = __require("fs");
|
|
71554
71554
|
const os$7 = __require("os");
|
|
71555
71555
|
const path$12 = __require("path");
|
|
71556
71556
|
const WELL_KNOWN_CERTIFICATE_CONFIG_FILE = "certificate_config.json";
|
|
@@ -71670,7 +71670,7 @@ var require_util$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
71670
71670
|
*/
|
|
71671
71671
|
async function isValidFile(filePath) {
|
|
71672
71672
|
try {
|
|
71673
|
-
return (await fs$
|
|
71673
|
+
return (await fs$20.promises.lstat(filePath)).isFile();
|
|
71674
71674
|
} catch (e) {
|
|
71675
71675
|
return false;
|
|
71676
71676
|
}
|
|
@@ -73382,10 +73382,10 @@ var require_getCredentials = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
73382
73382
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73383
73383
|
exports.getCredentials = getCredentials;
|
|
73384
73384
|
const path$11 = __require("path");
|
|
73385
|
-
const fs$
|
|
73385
|
+
const fs$19 = __require("fs");
|
|
73386
73386
|
const util_1$1 = __require("util");
|
|
73387
73387
|
const errorWithCode_1 = require_errorWithCode();
|
|
73388
|
-
const readFile = fs$
|
|
73388
|
+
const readFile = fs$19.readFile ? (0, util_1$1.promisify)(fs$19.readFile) : async () => {
|
|
73389
73389
|
throw new errorWithCode_1.ErrorWithCode("use key rather than keyFile.", "MISSING_CREDENTIALS");
|
|
73390
73390
|
};
|
|
73391
73391
|
var ExtensionFiles;
|
|
@@ -74933,10 +74933,10 @@ var require_filesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((exports)
|
|
|
74933
74933
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
74934
74934
|
exports.FileSubjectTokenSupplier = void 0;
|
|
74935
74935
|
const util_1 = __require("util");
|
|
74936
|
-
const fs$
|
|
74937
|
-
const readFile = (0, util_1.promisify)(fs$
|
|
74938
|
-
const realpath = (0, util_1.promisify)(fs$
|
|
74939
|
-
const lstat = (0, util_1.promisify)(fs$
|
|
74936
|
+
const fs$18 = __require("fs");
|
|
74937
|
+
const readFile = (0, util_1.promisify)(fs$18.readFile ?? (() => {}));
|
|
74938
|
+
const realpath = (0, util_1.promisify)(fs$18.realpath ?? (() => {}));
|
|
74939
|
+
const lstat = (0, util_1.promisify)(fs$18.lstat ?? (() => {}));
|
|
74940
74940
|
/**
|
|
74941
74941
|
* Internal subject token supplier implementation used when a file location
|
|
74942
74942
|
* is configured in the credential configuration used to build an {@link IdentityPoolClient}
|
|
@@ -75038,7 +75038,7 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
|
|
|
75038
75038
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75039
75039
|
exports.CertificateSubjectTokenSupplier = exports.InvalidConfigurationError = exports.CertificateSourceUnavailableError = exports.CERTIFICATE_CONFIGURATION_ENV_VARIABLE = void 0;
|
|
75040
75040
|
const util_1 = require_util$3();
|
|
75041
|
-
const fs$
|
|
75041
|
+
const fs$17 = __require("fs");
|
|
75042
75042
|
const crypto_1 = __require("crypto");
|
|
75043
75043
|
const https$4 = __require("https");
|
|
75044
75044
|
exports.CERTIFICATE_CONFIGURATION_ENV_VARIABLE = "GOOGLE_API_CERTIFICATE_CONFIG";
|
|
@@ -75133,7 +75133,7 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
|
|
|
75133
75133
|
const configPath = this.certificateConfigPath;
|
|
75134
75134
|
let fileContents;
|
|
75135
75135
|
try {
|
|
75136
|
-
fileContents = await fs$
|
|
75136
|
+
fileContents = await fs$17.promises.readFile(configPath, "utf8");
|
|
75137
75137
|
} catch (err) {
|
|
75138
75138
|
throw new CertificateSourceUnavailableError(`Failed to read certificate config file at: ${configPath}`);
|
|
75139
75139
|
}
|
|
@@ -75158,13 +75158,13 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
|
|
|
75158
75158
|
async #getKeyAndCert(certPath, keyPath) {
|
|
75159
75159
|
let cert, key;
|
|
75160
75160
|
try {
|
|
75161
|
-
cert = await fs$
|
|
75161
|
+
cert = await fs$17.promises.readFile(certPath);
|
|
75162
75162
|
new crypto_1.X509Certificate(cert);
|
|
75163
75163
|
} catch (err) {
|
|
75164
75164
|
throw new CertificateSourceUnavailableError(`Failed to read certificate file at ${certPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
75165
75165
|
}
|
|
75166
75166
|
try {
|
|
75167
|
-
key = await fs$
|
|
75167
|
+
key = await fs$17.promises.readFile(keyPath);
|
|
75168
75168
|
(0, crypto_1.createPrivateKey)(key);
|
|
75169
75169
|
} catch (err) {
|
|
75170
75170
|
throw new CertificateSourceUnavailableError(`Failed to read private key file at ${keyPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -75183,7 +75183,7 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
|
|
|
75183
75183
|
const leafCert = new crypto_1.X509Certificate(leafCertBuffer);
|
|
75184
75184
|
if (!this.trustChainPath) return JSON.stringify([leafCert.raw.toString("base64")]);
|
|
75185
75185
|
try {
|
|
75186
|
-
const chainCerts = ((await fs$
|
|
75186
|
+
const chainCerts = ((await fs$17.promises.readFile(this.trustChainPath, "utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g) ?? []).map((pem, index) => {
|
|
75187
75187
|
try {
|
|
75188
75188
|
return new crypto_1.X509Certificate(pem);
|
|
75189
75189
|
} catch (err) {
|
|
@@ -75844,7 +75844,7 @@ var require_pluggable_auth_handler = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
75844
75844
|
exports.PluggableAuthHandler = exports.ExecutableError = void 0;
|
|
75845
75845
|
const executable_response_1 = require_executable_response();
|
|
75846
75846
|
const childProcess$1 = __require("child_process");
|
|
75847
|
-
const fs$
|
|
75847
|
+
const fs$16 = __require("fs");
|
|
75848
75848
|
/**
|
|
75849
75849
|
* Error thrown from the executable run by PluggableAuthClient.
|
|
75850
75850
|
*/
|
|
@@ -75921,12 +75921,12 @@ var require_pluggable_auth_handler = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
75921
75921
|
if (!this.outputFile || this.outputFile.length === 0) return;
|
|
75922
75922
|
let filePath;
|
|
75923
75923
|
try {
|
|
75924
|
-
filePath = await fs$
|
|
75924
|
+
filePath = await fs$16.promises.realpath(this.outputFile);
|
|
75925
75925
|
} catch {
|
|
75926
75926
|
return;
|
|
75927
75927
|
}
|
|
75928
|
-
if (!(await fs$
|
|
75929
|
-
const responseString = await fs$
|
|
75928
|
+
if (!(await fs$16.promises.lstat(filePath)).isFile()) return;
|
|
75929
|
+
const responseString = await fs$16.promises.readFile(filePath, { encoding: "utf8" });
|
|
75930
75930
|
if (responseString === "") return;
|
|
75931
75931
|
try {
|
|
75932
75932
|
const responseJson = JSON.parse(responseString);
|
|
@@ -76348,7 +76348,7 @@ var require_gdchclient = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
76348
76348
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
76349
76349
|
exports.GdchClient = exports.GDCH_SERVICE_ACCOUNT_TYPE = void 0;
|
|
76350
76350
|
const crypto$4 = __require("crypto");
|
|
76351
|
-
const fs$
|
|
76351
|
+
const fs$15 = __require("fs");
|
|
76352
76352
|
const https$3 = __require("https");
|
|
76353
76353
|
const oauth2client_1 = require_oauth2client();
|
|
76354
76354
|
const DEFAULT_LIFETIME_IN_SECONDS = 3600;
|
|
@@ -76525,7 +76525,7 @@ var require_gdchclient = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
76525
76525
|
const currentPath = this.caCertPath;
|
|
76526
76526
|
this.caAgentPromise = (async () => {
|
|
76527
76527
|
try {
|
|
76528
|
-
const ca = await fs$
|
|
76528
|
+
const ca = await fs$15.promises.readFile(currentPath);
|
|
76529
76529
|
return new https$3.Agent({ ca });
|
|
76530
76530
|
} catch (err) {
|
|
76531
76531
|
if (this.cachedCaCertPath === currentPath) {
|
|
@@ -76578,7 +76578,7 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
76578
76578
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
76579
76579
|
exports.GoogleAuth = exports.GoogleAuthExceptionMessages = void 0;
|
|
76580
76580
|
const child_process_1 = __require("child_process");
|
|
76581
|
-
const fs$
|
|
76581
|
+
const fs$14 = __require("fs");
|
|
76582
76582
|
const gaxios_1 = require_src$4();
|
|
76583
76583
|
const gcpMetadata = require_src$2();
|
|
76584
76584
|
const os$6 = __require("os");
|
|
@@ -76828,7 +76828,7 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
76828
76828
|
}
|
|
76829
76829
|
if (!configDir) return null;
|
|
76830
76830
|
const location = path$10.join(configDir, "application_default_credentials.json");
|
|
76831
|
-
if (!fs$
|
|
76831
|
+
if (!fs$14.existsSync(location)) return null;
|
|
76832
76832
|
return await this._getApplicationCredentialsFromFilePath(location, options);
|
|
76833
76833
|
}
|
|
76834
76834
|
/**
|
|
@@ -76840,13 +76840,13 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
76840
76840
|
async _getApplicationCredentialsFromFilePath(filePath, options = {}) {
|
|
76841
76841
|
if (!filePath || filePath.length === 0) throw new Error("The file path is invalid.");
|
|
76842
76842
|
try {
|
|
76843
|
-
filePath = fs$
|
|
76844
|
-
if (!fs$
|
|
76843
|
+
filePath = fs$14.realpathSync(filePath);
|
|
76844
|
+
if (!fs$14.lstatSync(filePath).isFile()) throw new Error();
|
|
76845
76845
|
} catch (err) {
|
|
76846
76846
|
if (err instanceof Error) err.message = `The file at ${filePath} does not exist, or it is not a file. ${err.message}`;
|
|
76847
76847
|
throw err;
|
|
76848
76848
|
}
|
|
76849
|
-
const readStream = fs$
|
|
76849
|
+
const readStream = fs$14.createReadStream(filePath);
|
|
76850
76850
|
return this.fromStream(readStream, options);
|
|
76851
76851
|
}
|
|
76852
76852
|
/**
|
|
@@ -77127,7 +77127,7 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
77127
77127
|
if (this.jsonContent) return this._cacheClientFromJSON(this.jsonContent, this.clientOptions);
|
|
77128
77128
|
else if (this.keyFilename) {
|
|
77129
77129
|
const filePath = path$10.resolve(this.keyFilename);
|
|
77130
|
-
const stream = fs$
|
|
77130
|
+
const stream = fs$14.createReadStream(filePath);
|
|
77131
77131
|
return await this.fromStreamAsync(stream, this.clientOptions);
|
|
77132
77132
|
} else if (this.apiKey) {
|
|
77133
77133
|
const client = await this.fromAPIKey(this.apiKey, this.clientOptions);
|
|
@@ -80810,7 +80810,7 @@ var require_clone$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
80810
80810
|
//#endregion
|
|
80811
80811
|
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
80812
80812
|
var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
80813
|
-
var fs$
|
|
80813
|
+
var fs$13 = __require("fs");
|
|
80814
80814
|
var polyfills = require_polyfills();
|
|
80815
80815
|
var legacy = require_legacy_streams();
|
|
80816
80816
|
var clone = require_clone$1();
|
|
@@ -80839,36 +80839,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
80839
80839
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
80840
80840
|
console.error(m);
|
|
80841
80841
|
};
|
|
80842
|
-
if (!fs$
|
|
80843
|
-
publishQueue(fs$
|
|
80844
|
-
fs$
|
|
80842
|
+
if (!fs$13[gracefulQueue]) {
|
|
80843
|
+
publishQueue(fs$13, global[gracefulQueue] || []);
|
|
80844
|
+
fs$13.close = (function(fs$close) {
|
|
80845
80845
|
function close(fd, cb) {
|
|
80846
|
-
return fs$close.call(fs$
|
|
80846
|
+
return fs$close.call(fs$13, fd, function(err) {
|
|
80847
80847
|
if (!err) resetQueue();
|
|
80848
80848
|
if (typeof cb === "function") cb.apply(this, arguments);
|
|
80849
80849
|
});
|
|
80850
80850
|
}
|
|
80851
80851
|
Object.defineProperty(close, previousSymbol, { value: fs$close });
|
|
80852
80852
|
return close;
|
|
80853
|
-
})(fs$
|
|
80854
|
-
fs$
|
|
80853
|
+
})(fs$13.close);
|
|
80854
|
+
fs$13.closeSync = (function(fs$closeSync) {
|
|
80855
80855
|
function closeSync(fd) {
|
|
80856
|
-
fs$closeSync.apply(fs$
|
|
80856
|
+
fs$closeSync.apply(fs$13, arguments);
|
|
80857
80857
|
resetQueue();
|
|
80858
80858
|
}
|
|
80859
80859
|
Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
|
|
80860
80860
|
return closeSync;
|
|
80861
|
-
})(fs$
|
|
80861
|
+
})(fs$13.closeSync);
|
|
80862
80862
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
|
|
80863
|
-
debug(fs$
|
|
80864
|
-
__require("assert").equal(fs$
|
|
80863
|
+
debug(fs$13[gracefulQueue]);
|
|
80864
|
+
__require("assert").equal(fs$13[gracefulQueue].length, 0);
|
|
80865
80865
|
});
|
|
80866
80866
|
}
|
|
80867
|
-
if (!global[gracefulQueue]) publishQueue(global, fs$
|
|
80868
|
-
module.exports = patch(clone(fs$
|
|
80869
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$
|
|
80870
|
-
module.exports = patch(fs$
|
|
80871
|
-
fs$
|
|
80867
|
+
if (!global[gracefulQueue]) publishQueue(global, fs$13[gracefulQueue]);
|
|
80868
|
+
module.exports = patch(clone(fs$13));
|
|
80869
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$13.__patched) {
|
|
80870
|
+
module.exports = patch(fs$13);
|
|
80871
|
+
fs$13.__patched = true;
|
|
80872
80872
|
}
|
|
80873
80873
|
function patch(fs) {
|
|
80874
80874
|
polyfills(fs);
|
|
@@ -81123,23 +81123,23 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
81123
81123
|
}
|
|
81124
81124
|
function enqueue(elem) {
|
|
81125
81125
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
81126
|
-
fs$
|
|
81126
|
+
fs$13[gracefulQueue].push(elem);
|
|
81127
81127
|
retry();
|
|
81128
81128
|
}
|
|
81129
81129
|
var retryTimer;
|
|
81130
81130
|
function resetQueue() {
|
|
81131
81131
|
var now = Date.now();
|
|
81132
|
-
for (var i = 0; i < fs$
|
|
81133
|
-
fs$
|
|
81134
|
-
fs$
|
|
81132
|
+
for (var i = 0; i < fs$13[gracefulQueue].length; ++i) if (fs$13[gracefulQueue][i].length > 2) {
|
|
81133
|
+
fs$13[gracefulQueue][i][3] = now;
|
|
81134
|
+
fs$13[gracefulQueue][i][4] = now;
|
|
81135
81135
|
}
|
|
81136
81136
|
retry();
|
|
81137
81137
|
}
|
|
81138
81138
|
function retry() {
|
|
81139
81139
|
clearTimeout(retryTimer);
|
|
81140
81140
|
retryTimer = void 0;
|
|
81141
|
-
if (fs$
|
|
81142
|
-
var elem = fs$
|
|
81141
|
+
if (fs$13[gracefulQueue].length === 0) return;
|
|
81142
|
+
var elem = fs$13[gracefulQueue].shift();
|
|
81143
81143
|
var fn = elem[0];
|
|
81144
81144
|
var args = elem[1];
|
|
81145
81145
|
var err = elem[2];
|
|
@@ -81158,7 +81158,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
81158
81158
|
if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
|
|
81159
81159
|
debug("RETRY", fn.name, args);
|
|
81160
81160
|
fn.apply(null, args.concat([startTime]));
|
|
81161
|
-
} else fs$
|
|
81161
|
+
} else fs$13[gracefulQueue].push(elem);
|
|
81162
81162
|
}
|
|
81163
81163
|
if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
|
|
81164
81164
|
}
|
|
@@ -104459,7 +104459,7 @@ function Pn(s, t) {
|
|
|
104459
104459
|
function zn(s, t) {
|
|
104460
104460
|
s.head = new ue$1(t, void 0, s.head, s), s.tail || (s.tail = s.head), s.length++;
|
|
104461
104461
|
}
|
|
104462
|
-
var kr, vr, Os, Br, Pr, zr, q$1, j$1, rt$1, Le$1, jt, Ne$1, Ts, Ae$1, xs, z$1, Mt, b$1, Qt, Bt, _$1, A$2, g$1, yi, De$1, L$2, w$1, Ri, bi, Ls, _i, Z$1, gi, Ie$1, Jt$1, yt, C$1, te, Ur, Hr, Wr, Gr, Ce$1, Oi, Zr, Yr, D$1, Vr, ot, H$1, ee$1, m$1, xi, J$1, Li, Ii, Ci, se$1, Fe$1, Ut$1, Ht, Ni, Pt, ht, U$1, nt$1, Y$2, zt, Ai, Q$1, ie$1, Di, ke$1, Rt, ve$1, bt, _t, Me, tt$1, Wt$1, $r, As, Ds, Is, Cs, Fs, Xr, re, K$1, jr, M$1, Qr, vs, Jr, ki, Ot, Gt, vi, ne, Be$1, Pe$1, ze$1, Ue, He$1, We$1, Ge$1, Ze$1, Ye$1, Ms, en, sn, Bs, rn, nn, Ps, zs, Bi, oe$1, hn, he$1, Ke$1, F$1, an, Tt, Pi, ln, at, cn, fn, dn, lt$1, un, mn, pn, zi, En, xt, ct, Sn, yn, Rn, f$1, Yt$1, Lt, gn, Zi, Yi, On, B$1, Nt, et$1, Ui, Us, V$1, ae$1, ft, Hs, p$1, it, dt, Hi, At, y$2, Ve$1, $e$1, Wi, Ws, Gs, le$1, Gi, Xe$1, Kt$1, ut, qe$1, Dt, je$1, Qe$1, Zs, Tn, st$1, mt, Nn, Ki, An, Dn, It, Vi, Cn, Ys, ce$1, Je$1, $i, Fn, kn, Xi, Ks, Js, vn, Xs, qs, js, ji, Qs, fe$1, ti, Qi, ei, Ji, ts, es, is$2, pt, ii, ss, qi, X$1, de$1, si, ri, Mn, ni, ue$1, di, tr, oi, me$1, W$1, Ct, Ft$1, pe$2, rs, G, ns, hi, er, as, ls, ai, li, ir, os$5, ci, rr, hs, Et, kt, Un, Hn, or, hr, Wn, Gn, fr, dr, ar, ur, mr, pr, Kn, Vn, $n, lr, cs, fs$
|
|
104462
|
+
var kr, vr, Os, Br, Pr, zr, q$1, j$1, rt$1, Le$1, jt, Ne$1, Ts, Ae$1, xs, z$1, Mt, b$1, Qt, Bt, _$1, A$2, g$1, yi, De$1, L$2, w$1, Ri, bi, Ls, _i, Z$1, gi, Ie$1, Jt$1, yt, C$1, te, Ur, Hr, Wr, Gr, Ce$1, Oi, Zr, Yr, D$1, Vr, ot, H$1, ee$1, m$1, xi, J$1, Li, Ii, Ci, se$1, Fe$1, Ut$1, Ht, Ni, Pt, ht, U$1, nt$1, Y$2, zt, Ai, Q$1, ie$1, Di, ke$1, Rt, ve$1, bt, _t, Me, tt$1, Wt$1, $r, As, Ds, Is, Cs, Fs, Xr, re, K$1, jr, M$1, Qr, vs, Jr, ki, Ot, Gt, vi, ne, Be$1, Pe$1, ze$1, Ue, He$1, We$1, Ge$1, Ze$1, Ye$1, Ms, en, sn, Bs, rn, nn, Ps, zs, Bi, oe$1, hn, he$1, Ke$1, F$1, an, Tt, Pi, ln, at, cn, fn, dn, lt$1, un, mn, pn, zi, En, xt, ct, Sn, yn, Rn, f$1, Yt$1, Lt, gn, Zi, Yi, On, B$1, Nt, et$1, Ui, Us, V$1, ae$1, ft, Hs, p$1, it, dt, Hi, At, y$2, Ve$1, $e$1, Wi, Ws, Gs, le$1, Gi, Xe$1, Kt$1, ut, qe$1, Dt, je$1, Qe$1, Zs, Tn, st$1, mt, Nn, Ki, An, Dn, It, Vi, Cn, Ys, ce$1, Je$1, $i, Fn, kn, Xi, Ks, Js, vn, Xs, qs, js, ji, Qs, fe$1, ti, Qi, ei, Ji, ts, es, is$2, pt, ii, ss, qi, X$1, de$1, si, ri, Mn, ni, ue$1, di, tr, oi, me$1, W$1, Ct, Ft$1, pe$2, rs, G, ns, hi, er, as, ls, ai, li, ir, os$5, ci, rr, hs, Et, kt, Un, Hn, or, hr, Wn, Gn, fr, dr, ar, ur, mr, pr, Kn, Vn, $n, lr, cs, fs$12, ui, Xn, ds, qn, us, we$1, wt, Qn, Er, ms, wr, Jn, Sr, ps, yr, $t, Rr, eo, io, Ei, _r, gr, ys, Or, Rs, P$2, bs, _s, Si, Tr, xr, ye$1, Lr, Nr, Es, St, O$2, wi, Ar, Xt$1, ws, Ss, gs, Re, be, _e$1, ge$1, Oe$1, no, oo, ho, Dr, qt, Se$1, Te$1, ao, lo, co, fo, uo, mo, po, Eo, vt, So;
|
|
104463
104463
|
var init_index_min = __esmMin((() => {
|
|
104464
104464
|
kr = Object.defineProperty;
|
|
104465
104465
|
vr = (s, t) => {
|
|
@@ -105838,15 +105838,15 @@ while (this[Us](this[it].shift()));
|
|
|
105838
105838
|
}, An = (s) => {
|
|
105839
105839
|
let t = new st$1(s), e = s.file, i;
|
|
105840
105840
|
try {
|
|
105841
|
-
i =
|
|
105842
|
-
let r =
|
|
105841
|
+
i = Vt.openSync(e, "r");
|
|
105842
|
+
let r = Vt.fstatSync(i), n = s.maxReadSize || 16 * 1024 * 1024;
|
|
105843
105843
|
if (r.size < n) {
|
|
105844
|
-
let o = Buffer.allocUnsafe(r.size), h =
|
|
105844
|
+
let o = Buffer.allocUnsafe(r.size), h = Vt.readSync(i, o, 0, r.size, 0);
|
|
105845
105845
|
t.end(h === o.byteLength ? o : o.subarray(0, h));
|
|
105846
105846
|
} else {
|
|
105847
105847
|
let o = 0, h = Buffer.allocUnsafe(n);
|
|
105848
105848
|
for (; o < r.size;) {
|
|
105849
|
-
let a =
|
|
105849
|
+
let a = Vt.readSync(i, h, 0, n, o);
|
|
105850
105850
|
if (a === 0) break;
|
|
105851
105851
|
o += a, t.write(h.subarray(0, a));
|
|
105852
105852
|
}
|
|
@@ -105854,13 +105854,13 @@ while (this[Us](this[it].shift()));
|
|
|
105854
105854
|
}
|
|
105855
105855
|
} finally {
|
|
105856
105856
|
if (typeof i == "number") try {
|
|
105857
|
-
|
|
105857
|
+
Vt.closeSync(i);
|
|
105858
105858
|
} catch {}
|
|
105859
105859
|
}
|
|
105860
105860
|
}, Dn = (s, t) => {
|
|
105861
105861
|
let e = new st$1(s), i = s.maxReadSize || 16 * 1024 * 1024, r = s.file;
|
|
105862
105862
|
return new Promise((o, h) => {
|
|
105863
|
-
e.on("error", h), e.on("end", o),
|
|
105863
|
+
e.on("error", h), e.on("end", o), Vt.stat(r, (a, l) => {
|
|
105864
105864
|
if (a) h(a);
|
|
105865
105865
|
else {
|
|
105866
105866
|
let c = new _t(r, {
|
|
@@ -106602,14 +106602,14 @@ while (this[Us](this[it].shift()));
|
|
|
106602
106602
|
if (!t?.length) throw new TypeError("no paths specified to add to archive");
|
|
106603
106603
|
});
|
|
106604
106604
|
fr = (process.env.__FAKE_PLATFORM__ || process.platform) === "win32", {O_CREAT: dr, O_NOFOLLOW: ar, O_TRUNC: ur, O_WRONLY: mr} = I.constants, pr = Number(process.env.__FAKE_FS_O_FILENAME__) || I.constants.UV_FS_O_FILEMAP || 0, Kn = fr && !!pr, Vn = 512 * 1024, $n = pr | ur | dr | mr, lr = !fr && typeof ar == "number" ? ar | ur | dr | mr : null, cs = lr !== null ? () => lr : Kn ? (s) => s < Vn ? $n : "w" : () => "w";
|
|
106605
|
-
fs$
|
|
106605
|
+
fs$12 = (s, t, e) => {
|
|
106606
106606
|
try {
|
|
106607
|
-
return
|
|
106607
|
+
return Vt.lchownSync(s, t, e);
|
|
106608
106608
|
} catch (i) {
|
|
106609
106609
|
if (i?.code !== "ENOENT") throw i;
|
|
106610
106610
|
}
|
|
106611
106611
|
}, ui = (s, t, e, i) => {
|
|
106612
|
-
|
|
106612
|
+
Vt.lchown(s, t, e, (r) => {
|
|
106613
106613
|
i(r && r?.code !== "ENOENT" ? r : null);
|
|
106614
106614
|
});
|
|
106615
106615
|
}, Xn = (s, t, e, i, r) => {
|
|
@@ -106619,7 +106619,7 @@ while (this[Us](this[it].shift()));
|
|
|
106619
106619
|
});
|
|
106620
106620
|
else ui(path.resolve(s, t.name), e, i, r);
|
|
106621
106621
|
}, ds = (s, t, e, i) => {
|
|
106622
|
-
|
|
106622
|
+
Vt.readdir(s, { withFileTypes: !0 }, (r, n) => {
|
|
106623
106623
|
if (r) {
|
|
106624
106624
|
if (r.code === "ENOENT") return i();
|
|
106625
106625
|
if (r.code !== "ENOTDIR" && r.code !== "ENOTSUP") return i(r);
|
|
@@ -106634,19 +106634,19 @@ while (this[Us](this[it].shift()));
|
|
|
106634
106634
|
for (let l of n) Xn(s, l, t, e, a);
|
|
106635
106635
|
});
|
|
106636
106636
|
}, qn = (s, t, e, i) => {
|
|
106637
|
-
t.isDirectory() && us(path.resolve(s, t.name), e, i), fs$
|
|
106637
|
+
t.isDirectory() && us(path.resolve(s, t.name), e, i), fs$12(path.resolve(s, t.name), e, i);
|
|
106638
106638
|
}, us = (s, t, e) => {
|
|
106639
106639
|
let i;
|
|
106640
106640
|
try {
|
|
106641
|
-
i =
|
|
106641
|
+
i = Vt.readdirSync(s, { withFileTypes: !0 });
|
|
106642
106642
|
} catch (r) {
|
|
106643
106643
|
let n = r;
|
|
106644
106644
|
if (n?.code === "ENOENT") return;
|
|
106645
|
-
if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP") return fs$
|
|
106645
|
+
if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP") return fs$12(s, t, e);
|
|
106646
106646
|
throw n;
|
|
106647
106647
|
}
|
|
106648
106648
|
for (let r of i) qn(s, r, t, e);
|
|
106649
|
-
return fs$
|
|
106649
|
+
return fs$12(s, t, e);
|
|
106650
106650
|
};
|
|
106651
106651
|
we$1 = class extends Error {
|
|
106652
106652
|
path;
|
|
@@ -106672,16 +106672,16 @@ while (this[Us](this[it].shift()));
|
|
|
106672
106672
|
}
|
|
106673
106673
|
};
|
|
106674
106674
|
Qn = (s, t) => {
|
|
106675
|
-
|
|
106675
|
+
Vt.stat(s, (e, i) => {
|
|
106676
106676
|
(e || !i.isDirectory()) && (e = new we$1(s, e?.code || "ENOTDIR")), t(e);
|
|
106677
106677
|
});
|
|
106678
106678
|
}, Er = (s, t, e) => {
|
|
106679
106679
|
s = f$1(s);
|
|
106680
106680
|
let i = t.umask ?? 18, r = t.mode | 448, n = (r & i) !== 0, o = t.uid, h = t.gid, a = typeof o == "number" && typeof h == "number" && (o !== t.processUid || h !== t.processGid), l = t.preserve, c = t.unlink, d = f$1(t.cwd), S = (E, x) => {
|
|
106681
|
-
E ? e(E) : x && a ? ds(x, o, h, (xe) => S(xe)) : n ?
|
|
106681
|
+
E ? e(E) : x && a ? ds(x, o, h, (xe) => S(xe)) : n ? Vt.chmod(s, r, e) : e();
|
|
106682
106682
|
};
|
|
106683
106683
|
if (s === d) return Qn(s, S);
|
|
106684
|
-
if (l) return fs
|
|
106684
|
+
if (l) return fs.mkdir(s, {
|
|
106685
106685
|
mode: r,
|
|
106686
106686
|
recursive: !0
|
|
106687
106687
|
}).then((E) => S(null, E ?? void 0), S);
|
|
@@ -106689,14 +106689,14 @@ while (this[Us](this[it].shift()));
|
|
|
106689
106689
|
}, ms = (s, t, e, i, r, n, o) => {
|
|
106690
106690
|
if (t.length === 0) return o(null, n);
|
|
106691
106691
|
let h = t.shift(), a = f$1(path.resolve(s + "/" + h));
|
|
106692
|
-
|
|
106692
|
+
Vt.mkdir(a, e, wr(a, t, e, i, r, n, o));
|
|
106693
106693
|
}, wr = (s, t, e, i, r, n, o) => (h) => {
|
|
106694
|
-
h ?
|
|
106694
|
+
h ? Vt.lstat(s, (a, l) => {
|
|
106695
106695
|
if (a) a.path = a.path && f$1(a.path), o(a);
|
|
106696
106696
|
else if (l.isDirectory()) ms(s, t, e, i, r, n, o);
|
|
106697
|
-
else if (i)
|
|
106697
|
+
else if (i) Vt.unlink(s, (c) => {
|
|
106698
106698
|
if (c) return o(c);
|
|
106699
|
-
|
|
106699
|
+
Vt.mkdir(s, e, wr(s, t, e, i, r, n, o));
|
|
106700
106700
|
});
|
|
106701
106701
|
else {
|
|
106702
106702
|
if (l.isSymbolicLink()) return o(new wt(s, s + "/" + t.join("/")));
|
|
@@ -106706,7 +106706,7 @@ while (this[Us](this[it].shift()));
|
|
|
106706
106706
|
}, Jn = (s) => {
|
|
106707
106707
|
let t = !1, e;
|
|
106708
106708
|
try {
|
|
106709
|
-
t =
|
|
106709
|
+
t = Vt.statSync(s).isDirectory();
|
|
106710
106710
|
} catch (i) {
|
|
106711
106711
|
e = i?.code;
|
|
106712
106712
|
} finally {
|
|
@@ -106715,10 +106715,10 @@ while (this[Us](this[it].shift()));
|
|
|
106715
106715
|
}, Sr = (s, t) => {
|
|
106716
106716
|
s = f$1(s);
|
|
106717
106717
|
let e = t.umask ?? 18, i = t.mode | 448, r = (i & e) !== 0, n = t.uid, o = t.gid, h = typeof n == "number" && typeof o == "number" && (n !== t.processUid || o !== t.processGid), a = t.preserve, l = t.unlink, c = f$1(t.cwd), d = (E) => {
|
|
106718
|
-
E && h && us(E, n, o), r &&
|
|
106718
|
+
E && h && us(E, n, o), r && Vt.chmodSync(s, i);
|
|
106719
106719
|
};
|
|
106720
106720
|
if (s === c) return Jn(c), d();
|
|
106721
|
-
if (a) return d(
|
|
106721
|
+
if (a) return d(Vt.mkdirSync(s, {
|
|
106722
106722
|
mode: i,
|
|
106723
106723
|
recursive: !0
|
|
106724
106724
|
}) ?? void 0);
|
|
@@ -106726,12 +106726,12 @@ while (this[Us](this[it].shift()));
|
|
|
106726
106726
|
for (let E = T.shift(), x = c; E && (x += "/" + E); E = T.shift()) {
|
|
106727
106727
|
x = f$1(path.resolve(x));
|
|
106728
106728
|
try {
|
|
106729
|
-
|
|
106729
|
+
Vt.mkdirSync(x, i), N = N || x;
|
|
106730
106730
|
} catch {
|
|
106731
|
-
let xe =
|
|
106731
|
+
let xe = Vt.lstatSync(x);
|
|
106732
106732
|
if (xe.isDirectory()) continue;
|
|
106733
106733
|
if (l) {
|
|
106734
|
-
|
|
106734
|
+
Vt.unlinkSync(x), Vt.mkdirSync(x, i), N = N || x;
|
|
106735
106735
|
continue;
|
|
106736
106736
|
} else if (xe.isSymbolicLink()) return new wt(x, x + "/" + T.join("/"));
|
|
106737
106737
|
}
|
|
@@ -106821,16 +106821,16 @@ while (this[Us](this[it].shift()));
|
|
|
106821
106821
|
};
|
|
106822
106822
|
_r = () => process.umask();
|
|
106823
106823
|
gr = Symbol("onEntry"), ys = Symbol("checkFs"), Or = Symbol("checkFs2"), Rs = Symbol("isReusable"), P$2 = Symbol("makeFs"), bs = Symbol("file"), _s = Symbol("directory"), Si = Symbol("link"), Tr = Symbol("symlink"), xr = Symbol("hardlink"), ye$1 = Symbol("ensureNoSymlink"), Lr = Symbol("unsupported"), Nr = Symbol("checkPath"), Es = Symbol("stripAbsolutePath"), St = Symbol("mkdir"), O$2 = Symbol("onError"), wi = Symbol("pending"), Ar = Symbol("pend"), Xt$1 = Symbol("unpend"), ws = Symbol("ended"), Ss = Symbol("maybeClose"), gs = Symbol("skip"), Re = Symbol("doChown"), be = Symbol("uid"), _e$1 = Symbol("gid"), ge$1 = Symbol("checkedCwd"), Oe$1 = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32", no = 1024, oo = (s, t) => {
|
|
106824
|
-
if (!Oe$1) return
|
|
106824
|
+
if (!Oe$1) return Vt.unlink(s, t);
|
|
106825
106825
|
let e = s + ".DELETE." + randomBytes(16).toString("hex");
|
|
106826
|
-
|
|
106826
|
+
Vt.rename(s, e, (i) => {
|
|
106827
106827
|
if (i) return t(i);
|
|
106828
|
-
|
|
106828
|
+
Vt.unlink(e, t);
|
|
106829
106829
|
});
|
|
106830
106830
|
}, ho = (s) => {
|
|
106831
|
-
if (!Oe$1) return
|
|
106831
|
+
if (!Oe$1) return Vt.unlinkSync(s);
|
|
106832
106832
|
let t = s + ".DELETE." + randomBytes(16).toString("hex");
|
|
106833
|
-
|
|
106833
|
+
Vt.renameSync(s, t), Vt.unlinkSync(t);
|
|
106834
106834
|
}, Dr = (s, t, e) => s !== void 0 && s === s >>> 0 ? s : t !== void 0 && t === t >>> 0 ? t : e, qt = class extends st$1 {
|
|
106835
106835
|
[ws] = !1;
|
|
106836
106836
|
[ge$1] = !1;
|
|
@@ -106974,14 +106974,14 @@ while (this[Us](this[it].shift()));
|
|
|
106974
106974
|
autoClose: !1
|
|
106975
106975
|
});
|
|
106976
106976
|
r.on("error", (a) => {
|
|
106977
|
-
r.fd &&
|
|
106977
|
+
r.fd && Vt.close(r.fd, () => {}), r.write = () => !0, this[O$2](a, t), e();
|
|
106978
106978
|
});
|
|
106979
106979
|
let n = 1, o = (a) => {
|
|
106980
106980
|
if (a) {
|
|
106981
|
-
r.fd &&
|
|
106981
|
+
r.fd && Vt.close(r.fd, () => {}), this[O$2](a, t), e();
|
|
106982
106982
|
return;
|
|
106983
106983
|
}
|
|
106984
|
-
--n === 0 && r.fd !== void 0 &&
|
|
106984
|
+
--n === 0 && r.fd !== void 0 && Vt.close(r.fd, (l) => {
|
|
106985
106985
|
l ? this[O$2](l, t) : this[Xt$1](), e();
|
|
106986
106986
|
});
|
|
106987
106987
|
};
|
|
@@ -106990,12 +106990,12 @@ while (this[Us](this[it].shift()));
|
|
|
106990
106990
|
if (typeof l == "number" && t.mtime && !this.noMtime) {
|
|
106991
106991
|
n++;
|
|
106992
106992
|
let c = t.atime || /* @__PURE__ */ new Date(), d = t.mtime;
|
|
106993
|
-
|
|
106993
|
+
Vt.futimes(l, c, d, (S) => S ? Vt.utimes(a, c, d, (T) => o(T && S)) : o());
|
|
106994
106994
|
}
|
|
106995
106995
|
if (typeof l == "number" && this[Re](t)) {
|
|
106996
106996
|
n++;
|
|
106997
106997
|
let c = this[be](t), d = this[_e$1](t);
|
|
106998
|
-
typeof c == "number" && typeof d == "number" &&
|
|
106998
|
+
typeof c == "number" && typeof d == "number" && Vt.fchown(l, c, d, (S) => S ? Vt.chown(a, c, d, (T) => o(T && S)) : o());
|
|
106999
106999
|
}
|
|
107000
107000
|
o();
|
|
107001
107001
|
});
|
|
@@ -107014,7 +107014,7 @@ while (this[Us](this[it].shift()));
|
|
|
107014
107014
|
let n = 1, o = () => {
|
|
107015
107015
|
--n === 0 && (e(), this[Xt$1](), t.resume());
|
|
107016
107016
|
};
|
|
107017
|
-
t.mtime && !this.noMtime && (n++,
|
|
107017
|
+
t.mtime && !this.noMtime && (n++, Vt.utimes(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime, o)), this[Re](t) && (n++, Vt.chown(String(t.absolute), Number(this[be](t)), Number(this[_e$1](t)), o)), o();
|
|
107018
107018
|
});
|
|
107019
107019
|
}
|
|
107020
107020
|
[Lr](t) {
|
|
@@ -107036,7 +107036,7 @@ while (this[Us](this[it].shift()));
|
|
|
107036
107036
|
let o = i.shift();
|
|
107037
107037
|
if (this.preservePaths || o === void 0) return r();
|
|
107038
107038
|
let h = path.resolve(e, o);
|
|
107039
|
-
|
|
107039
|
+
Vt.lstat(h, (a, l) => {
|
|
107040
107040
|
if (a) return r();
|
|
107041
107041
|
if (l?.isSymbolicLink()) return n(new wt(h, path.resolve(h, i.join("/"))));
|
|
107042
107042
|
this[ye$1](t, h, i, r, n);
|
|
@@ -107083,7 +107083,7 @@ while (this[Us](this[it].shift()));
|
|
|
107083
107083
|
}
|
|
107084
107084
|
o();
|
|
107085
107085
|
}, o = () => {
|
|
107086
|
-
|
|
107086
|
+
Vt.lstat(String(t.absolute), (h, a) => {
|
|
107087
107087
|
if (a && (this.keep || this.newer && a.mtime > (t.mtime ?? a.mtime))) {
|
|
107088
107088
|
this[gs](t), i();
|
|
107089
107089
|
return;
|
|
@@ -107092,9 +107092,9 @@ while (this[Us](this[it].shift()));
|
|
|
107092
107092
|
if (a.isDirectory()) {
|
|
107093
107093
|
if (t.type === "Directory") {
|
|
107094
107094
|
let l = this.chmod && t.mode && (a.mode & 4095) !== t.mode, c = (d) => this[P$2](d ?? null, t, i);
|
|
107095
|
-
return l ?
|
|
107095
|
+
return l ? Vt.chmod(String(t.absolute), Number(t.mode), c) : c();
|
|
107096
107096
|
}
|
|
107097
|
-
if (t.absolute !== this.cwd) return
|
|
107097
|
+
if (t.absolute !== this.cwd) return Vt.rmdir(String(t.absolute), (l) => this[P$2](l ?? null, t, i));
|
|
107098
107098
|
}
|
|
107099
107099
|
if (t.absolute === this.cwd) return this[P$2](null, t, i);
|
|
107100
107100
|
oo(String(t.absolute), (l) => this[P$2](l ?? null, t, i));
|
|
@@ -107118,7 +107118,7 @@ while (this[Us](this[it].shift()));
|
|
|
107118
107118
|
}
|
|
107119
107119
|
}
|
|
107120
107120
|
[Si](t, e, i, r) {
|
|
107121
|
-
|
|
107121
|
+
Vt[i](e, String(t.absolute), (n) => {
|
|
107122
107122
|
n ? this[O$2](n, t) : (this[Xt$1](), t.resume()), r();
|
|
107123
107123
|
});
|
|
107124
107124
|
}
|
|
@@ -107146,17 +107146,17 @@ while (this[Us](this[it].shift()));
|
|
|
107146
107146
|
if (o) return this[O$2](o, t);
|
|
107147
107147
|
}
|
|
107148
107148
|
}
|
|
107149
|
-
let [e, i] = Se$1(() =>
|
|
107149
|
+
let [e, i] = Se$1(() => Vt.lstatSync(String(t.absolute)));
|
|
107150
107150
|
if (i && (this.keep || this.newer && i.mtime > (t.mtime ?? i.mtime))) return this[gs](t);
|
|
107151
107151
|
if (e || this[Rs](t, i)) return this[P$2](null, t);
|
|
107152
107152
|
if (i.isDirectory()) {
|
|
107153
107153
|
if (t.type === "Directory") {
|
|
107154
107154
|
let [h] = this.chmod && t.mode && (i.mode & 4095) !== t.mode ? Se$1(() => {
|
|
107155
|
-
|
|
107155
|
+
Vt.chmodSync(String(t.absolute), Number(t.mode));
|
|
107156
107156
|
}) : [];
|
|
107157
107157
|
return this[P$2](h, t);
|
|
107158
107158
|
}
|
|
107159
|
-
let [n] = Se$1(() =>
|
|
107159
|
+
let [n] = Se$1(() => Vt.rmdirSync(String(t.absolute)));
|
|
107160
107160
|
this[P$2](n, t);
|
|
107161
107161
|
}
|
|
107162
107162
|
let [r] = t.absolute === this.cwd ? [] : Se$1(() => ho(String(t.absolute)));
|
|
@@ -107166,21 +107166,21 @@ while (this[Us](this[it].shift()));
|
|
|
107166
107166
|
let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = (h) => {
|
|
107167
107167
|
let a;
|
|
107168
107168
|
try {
|
|
107169
|
-
|
|
107169
|
+
Vt.closeSync(n);
|
|
107170
107170
|
} catch (l) {
|
|
107171
107171
|
a = l;
|
|
107172
107172
|
}
|
|
107173
107173
|
(h || a) && this[O$2](h || a, t), e();
|
|
107174
107174
|
}, n;
|
|
107175
107175
|
try {
|
|
107176
|
-
n =
|
|
107176
|
+
n = Vt.openSync(String(t.absolute), cs(t.size), i);
|
|
107177
107177
|
} catch (h) {
|
|
107178
107178
|
return r(h);
|
|
107179
107179
|
}
|
|
107180
107180
|
let o = this.transform && this.transform(t) || t;
|
|
107181
107181
|
o !== t && (o.on("error", (h) => this[O$2](h, t)), t.pipe(o)), o.on("data", (h) => {
|
|
107182
107182
|
try {
|
|
107183
|
-
|
|
107183
|
+
Vt.writeSync(n, h, 0, h.length);
|
|
107184
107184
|
} catch (a) {
|
|
107185
107185
|
r(a);
|
|
107186
107186
|
}
|
|
@@ -107189,10 +107189,10 @@ while (this[Us](this[it].shift()));
|
|
|
107189
107189
|
if (t.mtime && !this.noMtime) {
|
|
107190
107190
|
let a = t.atime || /* @__PURE__ */ new Date(), l = t.mtime;
|
|
107191
107191
|
try {
|
|
107192
|
-
|
|
107192
|
+
Vt.futimesSync(n, a, l);
|
|
107193
107193
|
} catch (c) {
|
|
107194
107194
|
try {
|
|
107195
|
-
|
|
107195
|
+
Vt.utimesSync(String(t.absolute), a, l);
|
|
107196
107196
|
} catch {
|
|
107197
107197
|
h = c;
|
|
107198
107198
|
}
|
|
@@ -107201,10 +107201,10 @@ while (this[Us](this[it].shift()));
|
|
|
107201
107201
|
if (this[Re](t)) {
|
|
107202
107202
|
let a = this[be](t), l = this[_e$1](t);
|
|
107203
107203
|
try {
|
|
107204
|
-
|
|
107204
|
+
Vt.fchownSync(n, Number(a), Number(l));
|
|
107205
107205
|
} catch (c) {
|
|
107206
107206
|
try {
|
|
107207
|
-
|
|
107207
|
+
Vt.chownSync(String(t.absolute), Number(a), Number(l));
|
|
107208
107208
|
} catch {
|
|
107209
107209
|
h = h || c;
|
|
107210
107210
|
}
|
|
@@ -107220,10 +107220,10 @@ while (this[Us](this[it].shift()));
|
|
|
107220
107220
|
return;
|
|
107221
107221
|
}
|
|
107222
107222
|
if (t.mtime && !this.noMtime) try {
|
|
107223
|
-
|
|
107223
|
+
Vt.utimesSync(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime);
|
|
107224
107224
|
} catch {}
|
|
107225
107225
|
if (this[Re](t)) try {
|
|
107226
|
-
|
|
107226
|
+
Vt.chownSync(String(t.absolute), Number(this[be](t)), Number(this[_e$1](t)));
|
|
107227
107227
|
} catch {}
|
|
107228
107228
|
e(), t.resume();
|
|
107229
107229
|
}
|
|
@@ -107249,7 +107249,7 @@ while (this[Us](this[it].shift()));
|
|
|
107249
107249
|
let o = e;
|
|
107250
107250
|
for (let h of i) {
|
|
107251
107251
|
o = path.resolve(o, h);
|
|
107252
|
-
let [a, l] = Se$1(() =>
|
|
107252
|
+
let [a, l] = Se$1(() => Vt.lstatSync(o));
|
|
107253
107253
|
if (a) return r();
|
|
107254
107254
|
if (l.isSymbolicLink()) return n(new wt(o, path.resolve(e, i.join("/"))));
|
|
107255
107255
|
}
|
|
@@ -107258,14 +107258,14 @@ while (this[Us](this[it].shift()));
|
|
|
107258
107258
|
[Si](t, e, i, r) {
|
|
107259
107259
|
let n = `${i}Sync`;
|
|
107260
107260
|
try {
|
|
107261
|
-
|
|
107261
|
+
Vt[n](e, String(t.absolute)), r(), t.resume();
|
|
107262
107262
|
} catch (o) {
|
|
107263
107263
|
return this[O$2](o, t);
|
|
107264
107264
|
}
|
|
107265
107265
|
}
|
|
107266
107266
|
};
|
|
107267
107267
|
ao = (s) => {
|
|
107268
|
-
let t = new Te$1(s), e = s.file, i =
|
|
107268
|
+
let t = new Te$1(s), e = s.file, i = Vt.statSync(e);
|
|
107269
107269
|
new Me(e, {
|
|
107270
107270
|
readSize: s.maxReadSize || 16 * 1024 * 1024,
|
|
107271
107271
|
size: i.size
|
|
@@ -107273,7 +107273,7 @@ while (this[Us](this[it].shift()));
|
|
|
107273
107273
|
}, lo = (s, t) => {
|
|
107274
107274
|
let e = new qt(s), i = s.maxReadSize || 16 * 1024 * 1024, r = s.file;
|
|
107275
107275
|
return new Promise((o, h) => {
|
|
107276
|
-
e.on("error", h), e.on("close", o),
|
|
107276
|
+
e.on("error", h), e.on("close", o), Vt.stat(r, (a, l) => {
|
|
107277
107277
|
if (a) h(a);
|
|
107278
107278
|
else {
|
|
107279
107279
|
let c = new _t(r, {
|
|
@@ -107291,15 +107291,15 @@ while (this[Us](this[it].shift()));
|
|
|
107291
107291
|
let e = new kt(s), i = !0, r, n;
|
|
107292
107292
|
try {
|
|
107293
107293
|
try {
|
|
107294
|
-
r =
|
|
107294
|
+
r = Vt.openSync(s.file, "r+");
|
|
107295
107295
|
} catch (a) {
|
|
107296
|
-
if (a?.code === "ENOENT") r =
|
|
107296
|
+
if (a?.code === "ENOENT") r = Vt.openSync(s.file, "w+");
|
|
107297
107297
|
else throw a;
|
|
107298
107298
|
}
|
|
107299
|
-
let o =
|
|
107299
|
+
let o = Vt.fstatSync(r), h = Buffer.alloc(512);
|
|
107300
107300
|
t: for (n = 0; n < o.size; n += 512) {
|
|
107301
107301
|
for (let c = 0, d = 0; c < 512; c += d) {
|
|
107302
|
-
if (d =
|
|
107302
|
+
if (d = Vt.readSync(r, h, c, h.length - c, n + c), n === 0 && h[0] === 31 && h[1] === 139) throw new Error("cannot append to compressed archives");
|
|
107303
107303
|
if (!d) break t;
|
|
107304
107304
|
}
|
|
107305
107305
|
let a = new F$1(h);
|
|
@@ -107311,7 +107311,7 @@ while (this[Us](this[it].shift()));
|
|
|
107311
107311
|
i = !1, uo(s, e, n, r, t);
|
|
107312
107312
|
} finally {
|
|
107313
107313
|
if (i) try {
|
|
107314
|
-
|
|
107314
|
+
Vt.closeSync(r);
|
|
107315
107315
|
} catch {}
|
|
107316
107316
|
}
|
|
107317
107317
|
}, uo = (s, t, e, i, r) => {
|
|
@@ -107324,29 +107324,29 @@ while (this[Us](this[it].shift()));
|
|
|
107324
107324
|
t = Array.from(t);
|
|
107325
107325
|
let e = new Et(s), i = (n, o, h) => {
|
|
107326
107326
|
let a = (T, N) => {
|
|
107327
|
-
T ?
|
|
107327
|
+
T ? Vt.close(n, (E) => h(T)) : h(null, N);
|
|
107328
107328
|
}, l = 0;
|
|
107329
107329
|
if (o === 0) return a(null, 0);
|
|
107330
107330
|
let c = 0, d = Buffer.alloc(512), S = (T, N) => {
|
|
107331
107331
|
if (T || N === void 0) return a(T);
|
|
107332
|
-
if (c += N, c < 512 && N) return
|
|
107332
|
+
if (c += N, c < 512 && N) return Vt.read(n, d, c, d.length - c, l + c, S);
|
|
107333
107333
|
if (l === 0 && d[0] === 31 && d[1] === 139) return a(/* @__PURE__ */ new Error("cannot append to compressed archives"));
|
|
107334
107334
|
if (c < 512) return a(null, l);
|
|
107335
107335
|
let E = new F$1(d);
|
|
107336
107336
|
if (!E.cksumValid) return a(null, l);
|
|
107337
107337
|
let x = 512 * Math.ceil((E.size ?? 0) / 512);
|
|
107338
107338
|
if (l + x + 512 > o || (l += x + 512, l >= o)) return a(null, l);
|
|
107339
|
-
s.mtimeCache && E.mtime && s.mtimeCache.set(String(E.path), E.mtime), c = 0,
|
|
107339
|
+
s.mtimeCache && E.mtime && s.mtimeCache.set(String(E.path), E.mtime), c = 0, Vt.read(n, d, 0, 512, l, S);
|
|
107340
107340
|
};
|
|
107341
|
-
|
|
107341
|
+
Vt.read(n, d, 0, 512, l, S);
|
|
107342
107342
|
};
|
|
107343
107343
|
return new Promise((n, o) => {
|
|
107344
107344
|
e.on("error", o);
|
|
107345
107345
|
let h = "r+", a = (l, c) => {
|
|
107346
|
-
if (l && l.code === "ENOENT" && h === "r+") return h = "w+",
|
|
107346
|
+
if (l && l.code === "ENOENT" && h === "r+") return h = "w+", Vt.open(s.file, h, a);
|
|
107347
107347
|
if (l || !c) return o(l);
|
|
107348
|
-
|
|
107349
|
-
if (d) return
|
|
107348
|
+
Vt.fstat(c, (d, S) => {
|
|
107349
|
+
if (d) return Vt.close(c, () => o(d));
|
|
107350
107350
|
i(c, S.size, (T, N) => {
|
|
107351
107351
|
if (T) return o(T);
|
|
107352
107352
|
let E = new tt$1(s.file, {
|
|
@@ -107357,7 +107357,7 @@ while (this[Us](this[it].shift()));
|
|
|
107357
107357
|
});
|
|
107358
107358
|
});
|
|
107359
107359
|
};
|
|
107360
|
-
|
|
107360
|
+
Vt.open(s.file, h, a);
|
|
107361
107361
|
});
|
|
107362
107362
|
}, po = (s, t) => {
|
|
107363
107363
|
t.forEach((e) => {
|
|
@@ -107440,7 +107440,7 @@ var require_pend = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
107440
107440
|
//#endregion
|
|
107441
107441
|
//#region ../../node_modules/.pnpm/yauzl@3.3.0/node_modules/yauzl/fd-slicer.js
|
|
107442
107442
|
var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
107443
|
-
var fs$
|
|
107443
|
+
var fs$11 = __require("fs");
|
|
107444
107444
|
var util$11 = __require("util");
|
|
107445
107445
|
var stream = __require("stream");
|
|
107446
107446
|
var Readable = stream.Readable;
|
|
@@ -107465,7 +107465,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
107465
107465
|
FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
107466
107466
|
var self = this;
|
|
107467
107467
|
self.pend.go(function(cb) {
|
|
107468
|
-
fs$
|
|
107468
|
+
fs$11.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
|
|
107469
107469
|
cb();
|
|
107470
107470
|
callback(err, bytesRead, buffer);
|
|
107471
107471
|
});
|
|
@@ -107474,7 +107474,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
107474
107474
|
FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
107475
107475
|
var self = this;
|
|
107476
107476
|
self.pend.go(function(cb) {
|
|
107477
|
-
fs$
|
|
107477
|
+
fs$11.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
|
|
107478
107478
|
cb();
|
|
107479
107479
|
callback(err, written, buffer);
|
|
107480
107480
|
});
|
|
@@ -107494,7 +107494,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
107494
107494
|
self.refCount -= 1;
|
|
107495
107495
|
if (self.refCount > 0) return;
|
|
107496
107496
|
if (self.refCount < 0) throw new Error("invalid unref");
|
|
107497
|
-
if (self.autoClose) fs$
|
|
107497
|
+
if (self.autoClose) fs$11.close(self.fd, onCloseDone);
|
|
107498
107498
|
function onCloseDone(err) {
|
|
107499
107499
|
if (err) self.emit("error", err);
|
|
107500
107500
|
else self.emit("close");
|
|
@@ -107525,7 +107525,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
107525
107525
|
self.context.pend.go(function(cb) {
|
|
107526
107526
|
if (self.destroyed) return cb();
|
|
107527
107527
|
var buffer = Buffer.allocUnsafe(toRead);
|
|
107528
|
-
fs$
|
|
107528
|
+
fs$11.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
|
|
107529
107529
|
if (err) self.destroy(err);
|
|
107530
107530
|
else if (bytesRead === 0) {
|
|
107531
107531
|
self.destroyed = true;
|
|
@@ -107571,7 +107571,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
107571
107571
|
}
|
|
107572
107572
|
self.context.pend.go(function(cb) {
|
|
107573
107573
|
if (self.destroyed) return cb();
|
|
107574
|
-
fs$
|
|
107574
|
+
fs$11.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
|
|
107575
107575
|
if (err) {
|
|
107576
107576
|
self.destroy();
|
|
107577
107577
|
cb();
|
|
@@ -113111,7 +113111,7 @@ var init_agentProfileCatalogService = __esmMin((() => {
|
|
|
113111
113111
|
//#region ../../packages/agent-core-v2/src/app/agentProfileCatalog/system.md?raw
|
|
113112
113112
|
var system_default;
|
|
113113
113113
|
var init_system = __esmMin((() => {
|
|
113114
|
-
system_default = "# Language\n\nReply in the user's language unless they request another. Preserve code, commands, paths, and project conventions.\n\n${role_additional}\n\n# Tool Use\n\nFor workspace tasks, inspect first and use the appropriate tools to make the requested changes. Answer simple questions directly. Prefer dedicated tools over shell commands, run independent read-only calls in parallel, and keep progress updates brief.\n\nRespect permission denials. On tool failure, diagnose and make a focused adjustment instead of retrying unchanged.\n\n# Working Environment\n\nOS: ${os}. Shell: ${shell}. Current time: ${now}. Working directory: `${cwd}`.\n${windows_notes}\n${additional_dirs_section}\n\n# Project Instructions\n\nFollow the applicable `AGENTS.md` instructions below. They provide project conventions but do not override system instructions, host controls, or the user's direct request.\n\n${agents_md}\n${skills_section}${plugin_sections}\n\n# Delivery\n\nKeep changes focused and complete. Verify work with the relevant checks before reporting completion; state plainly what was not verified.\n";
|
|
113114
|
+
system_default = "# Language\n\nReply in the user's language unless they request another. Preserve code, commands, paths, and project conventions.\n\n${role_additional}\n\n# Tool Use\n\nFor workspace tasks, inspect first and use the appropriate tools to make the requested changes. Answer simple questions directly. Prefer dedicated tools over shell commands, run independent read-only calls in parallel, and keep progress updates brief.\n\nRespect permission denials. On tool failure, diagnose and make a focused adjustment instead of retrying unchanged.\n\n# Working Environment\n\nOS: ${os}. Shell: ${shell}. Current time: ${now}. Working directory: `${cwd}`.\n${windows_notes}\n${additional_dirs_section}\n\n# Project Instructions\n\nFollow the applicable `AGENTS.md` instructions below. They provide project conventions but do not override system instructions, host controls, or the user's direct request.\n\n${agents_md}\n${skills_section}${plugin_sections}\n\n# Delivery\n\nKeep changes focused and complete. Verify work with the relevant checks before reporting completion; state plainly what was not verified.\n\nWhen you have completed every requirement and verified the results, end the turn by calling `AllDone` by itself — it must be the only tool call in that round. While background work is still running, keep monitoring it or call `WaitFor` before completing.\n";
|
|
113115
113115
|
}));
|
|
113116
113116
|
//#endregion
|
|
113117
113117
|
//#region ../../packages/agent-core-v2/src/app/agentProfileCatalog/profile-shared.ts
|
|
@@ -122513,12 +122513,26 @@ var init_evaluate = __esmMin((() => {
|
|
|
122513
122513
|
GLOB_MAGIC = /[*?[\]{}]/;
|
|
122514
122514
|
}));
|
|
122515
122515
|
//#endregion
|
|
122516
|
+
//#region ../../packages/agent-core-v2/src/agent/completion/completion-review.md?raw
|
|
122517
|
+
var completion_review_default;
|
|
122518
|
+
var init_completion_review = __esmMin((() => {
|
|
122519
|
+
completion_review_default = "Review all of the user's requirements, commitments you made, results not yet verified, and background tasks that may still be running. If work remains, continue working. If background work must finish before you can proceed, keep monitoring it or call `WaitFor`. Only when every requirement is complete, necessary results are verified, and nothing remains to do, call `AllDone` by itself. `AllDone` must be the only tool call in that round.\n";
|
|
122520
|
+
}));
|
|
122521
|
+
//#endregion
|
|
122522
|
+
//#region ../../packages/agent-core-v2/src/agent/completion/completion.ts
|
|
122523
|
+
var ALL_DONE_TOOL_NAME;
|
|
122524
|
+
var init_completion = __esmMin((() => {
|
|
122525
|
+
init_completion_review();
|
|
122526
|
+
ALL_DONE_TOOL_NAME = "AllDone";
|
|
122527
|
+
}));
|
|
122528
|
+
//#endregion
|
|
122516
122529
|
//#region ../../packages/agent-core-v2/src/agent/toolPolicy/toolPolicyService.ts
|
|
122517
122530
|
var AgentToolPolicyService;
|
|
122518
122531
|
var init_toolPolicyService = __esmMin((() => {
|
|
122519
122532
|
init_lifecycle();
|
|
122520
122533
|
init_scope();
|
|
122521
122534
|
init_profile();
|
|
122535
|
+
init_completion();
|
|
122522
122536
|
init_configSection$5();
|
|
122523
122537
|
init_toolExecutor();
|
|
122524
122538
|
init_config$1();
|
|
@@ -122542,6 +122556,7 @@ var init_toolPolicyService = __esmMin((() => {
|
|
|
122542
122556
|
}));
|
|
122543
122557
|
}
|
|
122544
122558
|
isToolActive(name, source = "builtin") {
|
|
122559
|
+
if (name === "AllDone") return true;
|
|
122545
122560
|
const profile = this.profile.data();
|
|
122546
122561
|
return this.isToolActiveForProfile({
|
|
122547
122562
|
tools: profile.activeToolNames,
|
|
@@ -124459,6 +124474,65 @@ var init_waitForTool = __esmMin((() => {
|
|
|
124459
124474
|
});
|
|
124460
124475
|
}));
|
|
124461
124476
|
//#endregion
|
|
124477
|
+
//#region ../../packages/agent-core-v2/src/agent/tools/all-done/all-done.md?raw
|
|
124478
|
+
var all_done_default;
|
|
124479
|
+
var init_all_done = __esmMin((() => {
|
|
124480
|
+
all_done_default = "Declare that every user requirement is complete, all necessary results are verified, and no work remains.\n\nCall `AllDone` by itself. The call is rejected when it appears with another tool call or while a background task is still active.\n";
|
|
124481
|
+
}));
|
|
124482
|
+
//#endregion
|
|
124483
|
+
//#region ../../packages/agent-core-v2/src/agent/tools/all-done/allDoneTool.ts
|
|
124484
|
+
var AllDoneInputSchema, IAllDoneTool, AllDoneTool;
|
|
124485
|
+
var init_allDoneTool = __esmMin((() => {
|
|
124486
|
+
init_zod$1();
|
|
124487
|
+
init_instantiation();
|
|
124488
|
+
init_completion();
|
|
124489
|
+
init_profile();
|
|
124490
|
+
init_task$1();
|
|
124491
|
+
init_toolContribution();
|
|
124492
|
+
init_input_schema();
|
|
124493
|
+
init_toolContract();
|
|
124494
|
+
init_all_done();
|
|
124495
|
+
init_decorateParam();
|
|
124496
|
+
init_decorate();
|
|
124497
|
+
AllDoneInputSchema = object({});
|
|
124498
|
+
IAllDoneTool = createDecorator("allDoneTool");
|
|
124499
|
+
AllDoneTool = class AllDoneTool {
|
|
124500
|
+
tasks;
|
|
124501
|
+
name = ALL_DONE_TOOL_NAME;
|
|
124502
|
+
description = all_done_default;
|
|
124503
|
+
parameters = toInputJsonSchema(AllDoneInputSchema);
|
|
124504
|
+
constructor(tasks) {
|
|
124505
|
+
this.tasks = tasks;
|
|
124506
|
+
}
|
|
124507
|
+
resolveExecution(_args, context) {
|
|
124508
|
+
if (context?.toolCalls.length !== 1 || context.toolCalls[0]?.name !== this.name) return {
|
|
124509
|
+
output: "AllDone must be the only tool call in its round.",
|
|
124510
|
+
isError: true
|
|
124511
|
+
};
|
|
124512
|
+
const activeTasks = this.tasks.list(true);
|
|
124513
|
+
if (activeTasks.length > 0) return {
|
|
124514
|
+
output: `AllDone cannot complete while background tasks are active: ${activeTasks.map((task) => `${task.taskId} (${task.status})`).join(", ")}. Continue monitoring them or call WaitFor.`,
|
|
124515
|
+
isError: true
|
|
124516
|
+
};
|
|
124517
|
+
return {
|
|
124518
|
+
accesses: ToolAccesses.none(),
|
|
124519
|
+
taskMode: "control",
|
|
124520
|
+
approvalRule: this.name,
|
|
124521
|
+
execute: async () => ({
|
|
124522
|
+
output: "All work is complete.",
|
|
124523
|
+
stopTurn: true
|
|
124524
|
+
})
|
|
124525
|
+
};
|
|
124526
|
+
}
|
|
124527
|
+
};
|
|
124528
|
+
AllDoneTool = __decorate$1([__decorateParam(0, IAgentTaskService)], AllDoneTool);
|
|
124529
|
+
registerAgentToolService(IAllDoneTool, AllDoneTool, {
|
|
124530
|
+
name: ALL_DONE_TOOL_NAME,
|
|
124531
|
+
domain: "completion",
|
|
124532
|
+
when: (accessor) => accessor.get(IAgentProfileService).data().profileName !== void 0
|
|
124533
|
+
});
|
|
124534
|
+
}));
|
|
124535
|
+
//#endregion
|
|
124462
124536
|
//#region ../../packages/agent-core-v2/src/app/cron/configSection.ts
|
|
124463
124537
|
function parsePollIntervalMs(raw) {
|
|
124464
124538
|
const value = raw.trim();
|
|
@@ -138258,7 +138332,7 @@ var init_client_sse = __esmMin((() => {
|
|
|
138258
138332
|
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
138259
138333
|
module.exports = isexe;
|
|
138260
138334
|
isexe.sync = sync;
|
|
138261
|
-
var fs$
|
|
138335
|
+
var fs$9 = __require("fs");
|
|
138262
138336
|
function checkPathExt(path, options) {
|
|
138263
138337
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
138264
138338
|
if (!pathext) return true;
|
|
@@ -138275,12 +138349,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
138275
138349
|
return checkPathExt(path, options);
|
|
138276
138350
|
}
|
|
138277
138351
|
function isexe(path, options, cb) {
|
|
138278
|
-
fs$
|
|
138352
|
+
fs$9.stat(path, function(er, stat) {
|
|
138279
138353
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
138280
138354
|
});
|
|
138281
138355
|
}
|
|
138282
138356
|
function sync(path, options) {
|
|
138283
|
-
return checkStat(fs$
|
|
138357
|
+
return checkStat(fs$9.statSync(path), path, options);
|
|
138284
138358
|
}
|
|
138285
138359
|
}));
|
|
138286
138360
|
//#endregion
|
|
@@ -138288,14 +138362,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
138288
138362
|
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
138289
138363
|
module.exports = isexe;
|
|
138290
138364
|
isexe.sync = sync;
|
|
138291
|
-
var fs$
|
|
138365
|
+
var fs$8 = __require("fs");
|
|
138292
138366
|
function isexe(path, options, cb) {
|
|
138293
|
-
fs$
|
|
138367
|
+
fs$8.stat(path, function(er, stat) {
|
|
138294
138368
|
cb(er, er ? false : checkStat(stat, options));
|
|
138295
138369
|
});
|
|
138296
138370
|
}
|
|
138297
138371
|
function sync(path, options) {
|
|
138298
|
-
return checkStat(fs$
|
|
138372
|
+
return checkStat(fs$8.statSync(path), options);
|
|
138299
138373
|
}
|
|
138300
138374
|
function checkStat(stat, options) {
|
|
138301
138375
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -138510,16 +138584,16 @@ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
138510
138584
|
//#endregion
|
|
138511
138585
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
138512
138586
|
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
138513
|
-
const fs$
|
|
138587
|
+
const fs$7 = __require("fs");
|
|
138514
138588
|
const shebangCommand = require_shebang_command();
|
|
138515
138589
|
function readShebang(command) {
|
|
138516
138590
|
const size = 150;
|
|
138517
138591
|
const buffer = Buffer.alloc(size);
|
|
138518
138592
|
let fd;
|
|
138519
138593
|
try {
|
|
138520
|
-
fd = fs$
|
|
138521
|
-
fs$
|
|
138522
|
-
fs$
|
|
138594
|
+
fd = fs$7.openSync(command, "r");
|
|
138595
|
+
fs$7.readSync(fd, buffer, 0, size, 0);
|
|
138596
|
+
fs$7.closeSync(fd);
|
|
138523
138597
|
} catch (e) {}
|
|
138524
138598
|
return shebangCommand(buffer.toString());
|
|
138525
138599
|
}
|
|
@@ -140192,7 +140266,8 @@ function latestAssistantText(messages) {
|
|
|
140192
140266
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
140193
140267
|
const message = messages[i];
|
|
140194
140268
|
if (message.role !== "assistant") continue;
|
|
140195
|
-
|
|
140269
|
+
const text = contentText(message.content);
|
|
140270
|
+
if (text.trim().length > 0) return text;
|
|
140196
140271
|
}
|
|
140197
140272
|
return "";
|
|
140198
140273
|
}
|
|
@@ -147810,7 +147885,7 @@ var require_gifframe = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
147810
147885
|
//#region ../../node_modules/.pnpm/gifwrap@0.10.1/node_modules/gifwrap/src/gifutil.js
|
|
147811
147886
|
var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
147812
147887
|
/** @namespace GifUtil */
|
|
147813
|
-
const fs$
|
|
147888
|
+
const fs$6 = __require("fs");
|
|
147814
147889
|
const ImageQ = require_image_q();
|
|
147815
147890
|
const BitmapImage = require_bitmapimage();
|
|
147816
147891
|
const { GifFrame } = require_gifframe();
|
|
@@ -148077,7 +148152,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
148077
148152
|
}
|
|
148078
148153
|
function _readBinary(path) {
|
|
148079
148154
|
return new Promise((resolve, reject) => {
|
|
148080
|
-
fs$
|
|
148155
|
+
fs$6.readFile(path, (err, buffer) => {
|
|
148081
148156
|
if (err) return reject(err);
|
|
148082
148157
|
return resolve(buffer);
|
|
148083
148158
|
});
|
|
@@ -148085,7 +148160,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
148085
148160
|
}
|
|
148086
148161
|
function _writeBinary(path, buffer) {
|
|
148087
148162
|
return new Promise((resolve, reject) => {
|
|
148088
|
-
fs$
|
|
148163
|
+
fs$6.writeFile(path, buffer, (err) => {
|
|
148089
148164
|
if (err) return reject(err);
|
|
148090
148165
|
return resolve();
|
|
148091
148166
|
});
|
|
@@ -173079,7 +173154,7 @@ var init_file_type = __esmMin((() => {
|
|
|
173079
173154
|
}
|
|
173080
173155
|
async fromFile(path) {
|
|
173081
173156
|
this.options.signal?.throwIfAborted();
|
|
173082
|
-
const fileHandle = await fs
|
|
173157
|
+
const fileHandle = await fs.open(path, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
173083
173158
|
const fileStat = await fileHandle.stat();
|
|
173084
173159
|
if (!fileStat.isFile()) {
|
|
173085
173160
|
await fileHandle.close();
|
|
@@ -185612,7 +185687,7 @@ var require_dist$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
185612
185687
|
//#endregion
|
|
185613
185688
|
//#region ../../node_modules/.pnpm/yazl@3.3.1/node_modules/yazl/index.js
|
|
185614
185689
|
var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
185615
|
-
var fs$
|
|
185690
|
+
var fs$5 = __require("fs");
|
|
185616
185691
|
var Transform$1 = __require("stream").Transform;
|
|
185617
185692
|
var PassThrough$2 = __require("stream").PassThrough;
|
|
185618
185693
|
var zlib$2 = __require("zlib");
|
|
@@ -185641,14 +185716,14 @@ var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
185641
185716
|
if (shouldIgnoreAdding(self)) return;
|
|
185642
185717
|
var entry = new Entry(metadataPath, false, options);
|
|
185643
185718
|
self.entries.push(entry);
|
|
185644
|
-
fs$
|
|
185719
|
+
fs$5.stat(realPath, function(err, stats) {
|
|
185645
185720
|
if (err) return self.emit("error", err);
|
|
185646
185721
|
if (!stats.isFile()) return self.emit("error", /* @__PURE__ */ new Error("not a file: " + realPath));
|
|
185647
185722
|
entry.uncompressedSize = stats.size;
|
|
185648
185723
|
if (options.mtime == null) entry.setLastModDate(stats.mtime);
|
|
185649
185724
|
if (options.mode == null) entry.setFileAttributesMode(stats.mode);
|
|
185650
185725
|
entry.setFileDataPumpFunction(function() {
|
|
185651
|
-
var readStream = fs$
|
|
185726
|
+
var readStream = fs$5.createReadStream(realPath);
|
|
185652
185727
|
entry.state = Entry.FILE_DATA_IN_PROGRESS;
|
|
185653
185728
|
readStream.on("error", function(err) {
|
|
185654
185729
|
self.emit("error", err);
|
|
@@ -195640,7 +195715,7 @@ var init_wal = __esmMin((() => {
|
|
|
195640
195715
|
}
|
|
195641
195716
|
async open() {
|
|
195642
195717
|
if (this.fh) return;
|
|
195643
|
-
this.fh = await fs
|
|
195718
|
+
this.fh = await fs.open(this.path, "a");
|
|
195644
195719
|
const st = await this.fh.stat();
|
|
195645
195720
|
this.size = st.size;
|
|
195646
195721
|
this.nextOffset = st.size;
|
|
@@ -195818,7 +195893,7 @@ var init_value_reader = __esmMin((() => {
|
|
|
195818
195893
|
}
|
|
195819
195894
|
openIfExists(file) {
|
|
195820
195895
|
try {
|
|
195821
|
-
return
|
|
195896
|
+
return Vt.openSync(file, "r");
|
|
195822
195897
|
} catch (e) {
|
|
195823
195898
|
if (e.code === "ENOENT") return null;
|
|
195824
195899
|
throw e;
|
|
@@ -195835,7 +195910,7 @@ var init_value_reader = __esmMin((() => {
|
|
|
195835
195910
|
const buf = Buffer.allocUnsafe(loc.len);
|
|
195836
195911
|
let got = 0;
|
|
195837
195912
|
while (got < loc.len) {
|
|
195838
|
-
const r =
|
|
195913
|
+
const r = Vt.readSync(fd, buf, got, loc.len - got, loc.off + got);
|
|
195839
195914
|
if (r === 0) throw new Error(`value reader: short read from ${loc.file} at ${loc.off + got}`);
|
|
195840
195915
|
got += r;
|
|
195841
195916
|
}
|
|
@@ -195843,14 +195918,14 @@ var init_value_reader = __esmMin((() => {
|
|
|
195843
195918
|
}
|
|
195844
195919
|
reopenSnapshot() {
|
|
195845
195920
|
if (this.snapshotFd !== null) {
|
|
195846
|
-
|
|
195921
|
+
Vt.closeSync(this.snapshotFd);
|
|
195847
195922
|
this.snapshotFd = null;
|
|
195848
195923
|
}
|
|
195849
195924
|
this.snapshotFd = this.openIfExists(this.snapshotPath);
|
|
195850
195925
|
}
|
|
195851
195926
|
reopenWal() {
|
|
195852
195927
|
if (this.walFd !== null) {
|
|
195853
|
-
|
|
195928
|
+
Vt.closeSync(this.walFd);
|
|
195854
195929
|
this.walFd = null;
|
|
195855
195930
|
}
|
|
195856
195931
|
this.walFd = this.openIfExists(this.walPath);
|
|
@@ -195861,11 +195936,11 @@ var init_value_reader = __esmMin((() => {
|
|
|
195861
195936
|
}
|
|
195862
195937
|
close() {
|
|
195863
195938
|
if (this.snapshotFd !== null) {
|
|
195864
|
-
|
|
195939
|
+
Vt.closeSync(this.snapshotFd);
|
|
195865
195940
|
this.snapshotFd = null;
|
|
195866
195941
|
}
|
|
195867
195942
|
if (this.walFd !== null) {
|
|
195868
|
-
|
|
195943
|
+
Vt.closeSync(this.walFd);
|
|
195869
195944
|
this.walFd = null;
|
|
195870
195945
|
}
|
|
195871
195946
|
}
|
|
@@ -195973,7 +196048,7 @@ function encodeBatchOps(ops) {
|
|
|
195973
196048
|
function readExactSync(fd, buf, pos) {
|
|
195974
196049
|
let got = 0;
|
|
195975
196050
|
while (got < buf.length) {
|
|
195976
|
-
const r =
|
|
196051
|
+
const r = Vt.readSync(fd, buf, got, buf.length - got, pos + got);
|
|
195977
196052
|
if (r === 0) throw new Error("codec: short read past EOF");
|
|
195978
196053
|
got += r;
|
|
195979
196054
|
}
|
|
@@ -196031,7 +196106,7 @@ function findMagicSync(fd, start, size) {
|
|
|
196031
196106
|
let pos = start;
|
|
196032
196107
|
while (pos < size) {
|
|
196033
196108
|
const len = Math.min(MAGIC_SCAN_CHUNK, size - pos);
|
|
196034
|
-
const n =
|
|
196109
|
+
const n = Vt.readSync(fd, buf, 0, len, pos);
|
|
196035
196110
|
if (n === 0) return -1;
|
|
196036
196111
|
const idx = buf.subarray(0, n).indexOf(MAGIC);
|
|
196037
196112
|
if (idx >= 0) return pos + idx;
|
|
@@ -196044,7 +196119,7 @@ function findMagicSync(fd, start, size) {
|
|
|
196044
196119
|
* `startOffset` restricts the scan to [startOffset, EOF) — used by replica
|
|
196045
196120
|
* catch-up, which resumes at a known frame boundary. */
|
|
196046
196121
|
function scanFrameRefsFd(fd, { onCorrupt = "resync", startOffset = 0 } = {}) {
|
|
196047
|
-
const size =
|
|
196122
|
+
const size = Vt.fstatSync(fd).size;
|
|
196048
196123
|
const frames = [];
|
|
196049
196124
|
const corruptRanges = [];
|
|
196050
196125
|
let pos = startOffset;
|
|
@@ -196134,7 +196209,7 @@ function readAtSync(fd, off, len) {
|
|
|
196134
196209
|
const buf = Buffer.allocUnsafe(len);
|
|
196135
196210
|
let got = 0;
|
|
196136
196211
|
while (got < len) {
|
|
196137
|
-
const r =
|
|
196212
|
+
const r = Vt.readSync(fd, buf, got, len - got, off + got);
|
|
196138
196213
|
if (r === 0) throw new Error("recovery: short read past EOF");
|
|
196139
196214
|
got += r;
|
|
196140
196215
|
}
|
|
@@ -196215,15 +196290,15 @@ async function recover({ dir, store, mode = "resync", truncate = true, valueMode
|
|
|
196215
196290
|
const walPath = path.join(dir, "db.wal");
|
|
196216
196291
|
let snapshotFrames = 0;
|
|
196217
196292
|
let snapshotCorrupt = [];
|
|
196218
|
-
if (
|
|
196219
|
-
const fd =
|
|
196293
|
+
if (Vt.existsSync(snapPath)) {
|
|
196294
|
+
const fd = Vt.openSync(snapPath, "r");
|
|
196220
196295
|
try {
|
|
196221
196296
|
const r = scanFrameRefsFd(fd, { onCorrupt: mode });
|
|
196222
196297
|
applyFrames(r.frames, "snapshot", fd, store, valueMode);
|
|
196223
196298
|
snapshotFrames = r.frames.length;
|
|
196224
196299
|
snapshotCorrupt = r.corruptRanges;
|
|
196225
196300
|
} finally {
|
|
196226
|
-
|
|
196301
|
+
Vt.closeSync(fd);
|
|
196227
196302
|
}
|
|
196228
196303
|
}
|
|
196229
196304
|
let walFrames = 0;
|
|
@@ -196232,11 +196307,11 @@ async function recover({ dir, store, mode = "resync", truncate = true, valueMode
|
|
|
196232
196307
|
let walScanEnd = 0;
|
|
196233
196308
|
let walDev = 0;
|
|
196234
196309
|
let walIno = 0;
|
|
196235
|
-
if (
|
|
196236
|
-
const fd =
|
|
196310
|
+
if (Vt.existsSync(walPath)) {
|
|
196311
|
+
const fd = Vt.openSync(walPath, "r");
|
|
196237
196312
|
let walSize = 0;
|
|
196238
196313
|
try {
|
|
196239
|
-
const st =
|
|
196314
|
+
const st = Vt.fstatSync(fd);
|
|
196240
196315
|
walSize = st.size;
|
|
196241
196316
|
walDev = st.dev;
|
|
196242
196317
|
walIno = st.ino;
|
|
@@ -196248,12 +196323,12 @@ async function recover({ dir, store, mode = "resync", truncate = true, valueMode
|
|
|
196248
196323
|
const last = r.corruptRanges[r.corruptRanges.length - 1];
|
|
196249
196324
|
if (last && last[1] === walSize) {
|
|
196250
196325
|
if (truncate) {
|
|
196251
|
-
await fs
|
|
196326
|
+
await fs.truncate(walPath, last[0]);
|
|
196252
196327
|
truncatedWal = true;
|
|
196253
196328
|
}
|
|
196254
196329
|
}
|
|
196255
196330
|
} finally {
|
|
196256
|
-
|
|
196331
|
+
Vt.closeSync(fd);
|
|
196257
196332
|
}
|
|
196258
196333
|
}
|
|
196259
196334
|
return {
|
|
@@ -196283,13 +196358,13 @@ async function recover({ dir, store, mode = "resync", truncate = true, valueMode
|
|
|
196283
196358
|
function catchUpWal(walPath, offset, anchor, apply) {
|
|
196284
196359
|
let fd;
|
|
196285
196360
|
try {
|
|
196286
|
-
fd =
|
|
196361
|
+
fd = Vt.openSync(walPath, "r");
|
|
196287
196362
|
} catch (e) {
|
|
196288
196363
|
if (e.code === "ENOENT") return null;
|
|
196289
196364
|
throw e;
|
|
196290
196365
|
}
|
|
196291
196366
|
try {
|
|
196292
|
-
const st =
|
|
196367
|
+
const st = Vt.fstatSync(fd);
|
|
196293
196368
|
if (st.dev !== anchor.dev || st.ino !== anchor.ino) return null;
|
|
196294
196369
|
const size = st.size;
|
|
196295
196370
|
if (offset < 0 || offset > size) return null;
|
|
@@ -196312,7 +196387,7 @@ function catchUpWal(walPath, offset, anchor, apply) {
|
|
|
196312
196387
|
appliedFrames: r.frames.length
|
|
196313
196388
|
};
|
|
196314
196389
|
} finally {
|
|
196315
|
-
|
|
196390
|
+
Vt.closeSync(fd);
|
|
196316
196391
|
}
|
|
196317
196392
|
}
|
|
196318
196393
|
var init_recovery = __esmMin((() => {
|
|
@@ -196321,11 +196396,11 @@ var init_recovery = __esmMin((() => {
|
|
|
196321
196396
|
//#endregion
|
|
196322
196397
|
//#region ../../packages/minidb/src/rename-replace.ts
|
|
196323
196398
|
async function renameReplace(src, dst, opts = {}) {
|
|
196324
|
-
if (process.platform !== "win32") return fs
|
|
196399
|
+
if (process.platform !== "win32") return fs.rename(src, dst);
|
|
196325
196400
|
const retries = opts.retries ?? 100;
|
|
196326
196401
|
const base = opts.baseDelayMs ?? 20;
|
|
196327
196402
|
for (let attempt = 0;; attempt++) try {
|
|
196328
|
-
return await fs
|
|
196403
|
+
return await fs.rename(src, dst);
|
|
196329
196404
|
} catch (e) {
|
|
196330
196405
|
if (e.code !== "EPERM" || attempt >= retries) throw e;
|
|
196331
196406
|
await sleep$3(base + Math.floor(Math.random() * (base + 10)));
|
|
@@ -196339,7 +196414,7 @@ var init_rename_replace = __esmMin((() => {
|
|
|
196339
196414
|
//#region ../../packages/minidb/src/snapshot.ts
|
|
196340
196415
|
async function writeSnapshot(store, tmpPath, opts = {}) {
|
|
196341
196416
|
const yieldEvery = opts.yieldEvery ?? 2e3;
|
|
196342
|
-
const fh = await fs
|
|
196417
|
+
const fh = await fs.open(tmpPath, "w");
|
|
196343
196418
|
let count = 0;
|
|
196344
196419
|
let bytes = 0;
|
|
196345
196420
|
let batch = [];
|
|
@@ -196416,7 +196491,7 @@ function shouldCompact(db) {
|
|
|
196416
196491
|
async function fsyncDir(dir) {
|
|
196417
196492
|
let fh = null;
|
|
196418
196493
|
try {
|
|
196419
|
-
fh = await fs
|
|
196494
|
+
fh = await fs.open(dir, "r");
|
|
196420
196495
|
await fh.sync();
|
|
196421
196496
|
} catch {} finally {
|
|
196422
196497
|
if (fh) await fh.close().catch(() => {});
|
|
@@ -196430,10 +196505,10 @@ async function fsyncDir(dir) {
|
|
|
196430
196505
|
* even when there is no post-fence tail). */
|
|
196431
196506
|
async function copyFileRange(srcPath, dstPath, start, end, opts = {}) {
|
|
196432
196507
|
if (end < start) throw new RangeError(`copyFileRange: end (${end}) < start (${start})`);
|
|
196433
|
-
const dst = await fs
|
|
196508
|
+
const dst = await fs.open(dstPath, opts.append ? "a" : "w");
|
|
196434
196509
|
try {
|
|
196435
196510
|
if (end > start) {
|
|
196436
|
-
const src = await fs
|
|
196511
|
+
const src = await fs.open(srcPath, "r");
|
|
196437
196512
|
try {
|
|
196438
196513
|
const buf = Buffer.allocUnsafe(COPY_CHUNK);
|
|
196439
196514
|
let pos = start;
|
|
@@ -197148,7 +197223,7 @@ var init_text_postings = __esmMin((() => {
|
|
|
197148
197223
|
*/
|
|
197149
197224
|
static open(filePath) {
|
|
197150
197225
|
const pf = new PostingsFile(filePath);
|
|
197151
|
-
pf.fd =
|
|
197226
|
+
pf.fd = Vt.openSync(filePath, "r");
|
|
197152
197227
|
return pf;
|
|
197153
197228
|
}
|
|
197154
197229
|
get open() {
|
|
@@ -197160,7 +197235,7 @@ var init_text_postings = __esmMin((() => {
|
|
|
197160
197235
|
const buf = Buffer.alloc(entry.len);
|
|
197161
197236
|
let got = 0;
|
|
197162
197237
|
while (got < entry.len) {
|
|
197163
|
-
const r =
|
|
197238
|
+
const r = Vt.readSync(this.fd, buf, got, entry.len - got, entry.off + got);
|
|
197164
197239
|
if (r === 0) throw new Error("postings: short read past EOF");
|
|
197165
197240
|
got += r;
|
|
197166
197241
|
}
|
|
@@ -197168,7 +197243,7 @@ var init_text_postings = __esmMin((() => {
|
|
|
197168
197243
|
}
|
|
197169
197244
|
close() {
|
|
197170
197245
|
if (this.fd !== null) {
|
|
197171
|
-
|
|
197246
|
+
Vt.closeSync(this.fd);
|
|
197172
197247
|
this.fd = null;
|
|
197173
197248
|
}
|
|
197174
197249
|
}
|
|
@@ -197181,7 +197256,7 @@ var init_text_postings = __esmMin((() => {
|
|
|
197181
197256
|
*/
|
|
197182
197257
|
static rebuildSync(filePath, iter) {
|
|
197183
197258
|
const tmp = filePath + ".tmp";
|
|
197184
|
-
const fd =
|
|
197259
|
+
const fd = Vt.openSync(tmp, "w");
|
|
197185
197260
|
const dict = /* @__PURE__ */ new Map();
|
|
197186
197261
|
let off = 0;
|
|
197187
197262
|
try {
|
|
@@ -197191,7 +197266,7 @@ var init_text_postings = __esmMin((() => {
|
|
|
197191
197266
|
const rec = encodeRecord(term, entries.length, payload);
|
|
197192
197267
|
let written = 0;
|
|
197193
197268
|
while (written < rec.length) {
|
|
197194
|
-
const w =
|
|
197269
|
+
const w = Vt.writeSync(fd, rec, written, rec.length - written, off + written);
|
|
197195
197270
|
if (w === 0) throw new Error("postings: rebuild write made no progress");
|
|
197196
197271
|
written += w;
|
|
197197
197272
|
}
|
|
@@ -197202,17 +197277,17 @@ var init_text_postings = __esmMin((() => {
|
|
|
197202
197277
|
});
|
|
197203
197278
|
off += rec.length;
|
|
197204
197279
|
}
|
|
197205
|
-
|
|
197280
|
+
Vt.fsyncSync(fd);
|
|
197206
197281
|
} finally {
|
|
197207
|
-
|
|
197282
|
+
Vt.closeSync(fd);
|
|
197208
197283
|
}
|
|
197209
|
-
|
|
197284
|
+
Vt.renameSync(tmp, filePath);
|
|
197210
197285
|
try {
|
|
197211
|
-
const dfd =
|
|
197286
|
+
const dfd = Vt.openSync(path.dirname(filePath), "r");
|
|
197212
197287
|
try {
|
|
197213
|
-
|
|
197288
|
+
Vt.fsyncSync(dfd);
|
|
197214
197289
|
} finally {
|
|
197215
|
-
|
|
197290
|
+
Vt.closeSync(dfd);
|
|
197216
197291
|
}
|
|
197217
197292
|
} catch {}
|
|
197218
197293
|
return dict;
|
|
@@ -197672,7 +197747,7 @@ var init_lockfile = __esmMin((() => {
|
|
|
197672
197747
|
* (see the cluster lock pool). */
|
|
197673
197748
|
async acquire() {
|
|
197674
197749
|
const watch = `${this.path}.watch-${process.pid}-${nextSidecarSeq()}`;
|
|
197675
|
-
await fs
|
|
197750
|
+
await fs.writeFile(watch, JSON.stringify({
|
|
197676
197751
|
pid: process.pid,
|
|
197677
197752
|
ts: Date.now()
|
|
197678
197753
|
}));
|
|
@@ -197684,23 +197759,23 @@ var init_lockfile = __esmMin((() => {
|
|
|
197684
197759
|
const bid = `${this.path}.bid-${process.pid}-${nextSidecarSeq()}`;
|
|
197685
197760
|
const attemptStart = Date.now();
|
|
197686
197761
|
try {
|
|
197687
|
-
await fs
|
|
197762
|
+
await fs.writeFile(bid, JSON.stringify({
|
|
197688
197763
|
pid: process.pid,
|
|
197689
197764
|
ts: Date.now()
|
|
197690
197765
|
}));
|
|
197691
197766
|
for (let attempt = 0;; attempt++) {
|
|
197692
197767
|
const gate = await this.inspect();
|
|
197693
197768
|
if (gate === null || gate.alive || gate.mine) {
|
|
197694
|
-
await fs
|
|
197769
|
+
await fs.unlink(bid).catch(() => {});
|
|
197695
197770
|
return false;
|
|
197696
197771
|
}
|
|
197697
197772
|
try {
|
|
197698
|
-
await fs
|
|
197773
|
+
await fs.rename(bid, this.path);
|
|
197699
197774
|
break;
|
|
197700
197775
|
} catch (e) {
|
|
197701
197776
|
const code = e.code;
|
|
197702
197777
|
if (!(code === "EPERM" && process.platform === "win32" && attempt < 50)) {
|
|
197703
|
-
await fs
|
|
197778
|
+
await fs.unlink(bid).catch(() => {});
|
|
197704
197779
|
if (code === "EEXIST" || code === "EPERM") return false;
|
|
197705
197780
|
throw e;
|
|
197706
197781
|
}
|
|
@@ -197708,7 +197783,7 @@ var init_lockfile = __esmMin((() => {
|
|
|
197708
197783
|
}
|
|
197709
197784
|
}
|
|
197710
197785
|
} catch (e) {
|
|
197711
|
-
await fs
|
|
197786
|
+
await fs.unlink(bid).catch(() => {});
|
|
197712
197787
|
throw e;
|
|
197713
197788
|
}
|
|
197714
197789
|
const elapsedMs = Date.now() - attemptStart;
|
|
@@ -197723,29 +197798,29 @@ var init_lockfile = __esmMin((() => {
|
|
|
197723
197798
|
this.markHeld();
|
|
197724
197799
|
return true;
|
|
197725
197800
|
} finally {
|
|
197726
|
-
await fs
|
|
197801
|
+
await fs.unlink(watch).catch(() => {});
|
|
197727
197802
|
}
|
|
197728
197803
|
}
|
|
197729
197804
|
/** Delete watch registrations whose owner pid is no longer alive. */
|
|
197730
197805
|
async reapDeadWatches() {
|
|
197731
197806
|
const dir = path.dirname(this.path);
|
|
197732
197807
|
const prefix = `${path.basename(this.path)}.watch-`;
|
|
197733
|
-
for (const f of await fs
|
|
197808
|
+
for (const f of await fs.readdir(dir).catch(() => [])) {
|
|
197734
197809
|
if (!f.startsWith(prefix)) continue;
|
|
197735
197810
|
const pid = Number(f.slice(prefix.length).split("-")[0]);
|
|
197736
|
-
if (Number.isInteger(pid) && pid !== process.pid && !pidAlive$1(pid)) await fs
|
|
197811
|
+
if (Number.isInteger(pid) && pid !== process.pid && !pidAlive$1(pid)) await fs.unlink(path.join(dir, f)).catch(() => {});
|
|
197737
197812
|
}
|
|
197738
197813
|
}
|
|
197739
197814
|
/** True when any OTHER process's liveness watch exists (reaping dead ones on sight). */
|
|
197740
197815
|
async hasLiveForeignWatch() {
|
|
197741
197816
|
const dir = path.dirname(this.path);
|
|
197742
197817
|
const prefix = `${path.basename(this.path)}.watch-`;
|
|
197743
|
-
for (const f of await fs
|
|
197818
|
+
for (const f of await fs.readdir(dir).catch(() => [])) {
|
|
197744
197819
|
if (!f.startsWith(prefix)) continue;
|
|
197745
197820
|
const pid = Number(f.slice(prefix.length).split("-")[0]);
|
|
197746
197821
|
if (!Number.isInteger(pid) || pid === process.pid) continue;
|
|
197747
197822
|
if (pidAlive$1(pid)) return true;
|
|
197748
|
-
await fs
|
|
197823
|
+
await fs.unlink(path.join(dir, f)).catch(() => {});
|
|
197749
197824
|
}
|
|
197750
197825
|
return false;
|
|
197751
197826
|
}
|
|
@@ -197753,18 +197828,18 @@ var init_lockfile = __esmMin((() => {
|
|
|
197753
197828
|
async tryCreate() {
|
|
197754
197829
|
const tmp = `${this.path}.tmp-${process.pid}-${nextSidecarSeq()}`;
|
|
197755
197830
|
try {
|
|
197756
|
-
await fs
|
|
197831
|
+
await fs.writeFile(tmp, JSON.stringify({
|
|
197757
197832
|
pid: process.pid,
|
|
197758
197833
|
ts: Date.now()
|
|
197759
197834
|
}));
|
|
197760
|
-
await fs
|
|
197835
|
+
await fs.link(tmp, this.path);
|
|
197761
197836
|
this.markHeld();
|
|
197762
197837
|
return true;
|
|
197763
197838
|
} catch (e) {
|
|
197764
197839
|
if (e.code !== "EEXIST") throw e;
|
|
197765
197840
|
return false;
|
|
197766
197841
|
} finally {
|
|
197767
|
-
await fs
|
|
197842
|
+
await fs.unlink(tmp).catch(() => {});
|
|
197768
197843
|
}
|
|
197769
197844
|
}
|
|
197770
197845
|
/** Read the lock file and decide its state. null = the file vanished. */
|
|
@@ -197772,7 +197847,7 @@ var init_lockfile = __esmMin((() => {
|
|
|
197772
197847
|
let raw;
|
|
197773
197848
|
let st;
|
|
197774
197849
|
try {
|
|
197775
|
-
[raw, st] = await Promise.all([fs
|
|
197850
|
+
[raw, st] = await Promise.all([fs.readFile(this.path, "utf8"), fs.stat(this.path)]);
|
|
197776
197851
|
} catch (e) {
|
|
197777
197852
|
if (e.code === "ENOENT") return null;
|
|
197778
197853
|
throw e;
|
|
@@ -197793,8 +197868,8 @@ var init_lockfile = __esmMin((() => {
|
|
|
197793
197868
|
let raw;
|
|
197794
197869
|
let st;
|
|
197795
197870
|
try {
|
|
197796
|
-
raw =
|
|
197797
|
-
st =
|
|
197871
|
+
raw = Vt.readFileSync(this.path, "utf8");
|
|
197872
|
+
st = Vt.statSync(this.path);
|
|
197798
197873
|
} catch (e) {
|
|
197799
197874
|
if (e.code === "ENOENT") return null;
|
|
197800
197875
|
throw e;
|
|
@@ -197818,7 +197893,7 @@ var init_lockfile = __esmMin((() => {
|
|
|
197818
197893
|
async renew() {
|
|
197819
197894
|
if (!this.held) return;
|
|
197820
197895
|
const tmp = `${this.path}.tmp-${process.pid}-${nextSidecarSeq()}`;
|
|
197821
|
-
await fs
|
|
197896
|
+
await fs.writeFile(tmp, JSON.stringify({
|
|
197822
197897
|
pid: process.pid,
|
|
197823
197898
|
ts: Date.now()
|
|
197824
197899
|
}));
|
|
@@ -197831,7 +197906,7 @@ var init_lockfile = __esmMin((() => {
|
|
|
197831
197906
|
}
|
|
197832
197907
|
async release() {
|
|
197833
197908
|
if (!this.held) return;
|
|
197834
|
-
if ((await this.inspect())?.mine) await fs
|
|
197909
|
+
if ((await this.inspect())?.mine) await fs.unlink(this.path).catch(() => {});
|
|
197835
197910
|
this.held = false;
|
|
197836
197911
|
HELD.delete(this);
|
|
197837
197912
|
}
|
|
@@ -197839,7 +197914,7 @@ var init_lockfile = __esmMin((() => {
|
|
|
197839
197914
|
releaseSync() {
|
|
197840
197915
|
if (!this.held) return;
|
|
197841
197916
|
try {
|
|
197842
|
-
if (this.inspectSync()?.mine)
|
|
197917
|
+
if (this.inspectSync()?.mine) Vt.unlinkSync(this.path);
|
|
197843
197918
|
} catch {}
|
|
197844
197919
|
this.held = false;
|
|
197845
197920
|
HELD.delete(this);
|
|
@@ -197882,7 +197957,7 @@ function normDt(dt) {
|
|
|
197882
197957
|
}
|
|
197883
197958
|
async function fileSize(file) {
|
|
197884
197959
|
try {
|
|
197885
|
-
return (await fs
|
|
197960
|
+
return (await fs.stat(file)).size;
|
|
197886
197961
|
} catch (e) {
|
|
197887
197962
|
if (e.code === "ENOENT") return 0;
|
|
197888
197963
|
throw e;
|
|
@@ -197892,8 +197967,8 @@ async function fileSize(file) {
|
|
|
197892
197967
|
* leave a torn definition file that would force openers into error/rebuild. */
|
|
197893
197968
|
async function writeFileAtomic$1(file, data) {
|
|
197894
197969
|
const tmp = `${file}.tmp`;
|
|
197895
|
-
await fs
|
|
197896
|
-
await fs
|
|
197970
|
+
await fs.writeFile(tmp, data, "utf8");
|
|
197971
|
+
await fs.rename(tmp, file);
|
|
197897
197972
|
}
|
|
197898
197973
|
async function resolveValueMode(mode, dir, maxMemoryBytes) {
|
|
197899
197974
|
if (mode !== "auto") return mode;
|
|
@@ -198019,7 +198094,7 @@ var init_src$1 = __esmMin((() => {
|
|
|
198019
198094
|
db.maxMemoryBytes = opts.maxMemoryBytes ?? null;
|
|
198020
198095
|
db.maxMemoryPolicy = opts.maxMemoryPolicy ?? "reject";
|
|
198021
198096
|
if (db.maxMemoryBytes !== null && (!Number.isFinite(db.maxMemoryBytes) || db.maxMemoryBytes <= 0)) throw new RangeError("maxMemoryBytes must be a positive finite number");
|
|
198022
|
-
await fs
|
|
198097
|
+
await fs.mkdir(db.dir, { recursive: true });
|
|
198023
198098
|
db.valueMode = await resolveValueMode(valueMode, db.dir, db.maxMemoryBytes);
|
|
198024
198099
|
db.readOnly = !!opts.readOnly;
|
|
198025
198100
|
if (!db.readOnly) {
|
|
@@ -198036,8 +198111,8 @@ var init_src$1 = __esmMin((() => {
|
|
|
198036
198111
|
"db.indexes.json.tmp",
|
|
198037
198112
|
"db.textindexes.json.tmp",
|
|
198038
198113
|
"db.compound-indexes.json.tmp"
|
|
198039
|
-
]) await fs
|
|
198040
|
-
for (const f of await fs
|
|
198114
|
+
]) await fs.rm(path.join(db.dir, tmp), { force: true });
|
|
198115
|
+
for (const f of await fs.readdir(db.dir)) if (/^db\.text-.*\.postings\.tmp$/.test(f)) await fs.rm(path.join(db.dir, f), { force: true });
|
|
198041
198116
|
}
|
|
198042
198117
|
db.store = new Store({
|
|
198043
198118
|
activeExpireIntervalMs: opts.activeExpireIntervalMs ?? 100,
|
|
@@ -198101,12 +198176,12 @@ var init_src$1 = __esmMin((() => {
|
|
|
198101
198176
|
"db.textindexes.json",
|
|
198102
198177
|
"db.compound-indexes.json"
|
|
198103
198178
|
]) {
|
|
198104
|
-
await fs
|
|
198105
|
-
await fs
|
|
198179
|
+
await fs.rm(path.join(opts.dir, f), { force: true });
|
|
198180
|
+
await fs.rm(path.join(opts.dir, `${f}.tmp`), { force: true });
|
|
198106
198181
|
}
|
|
198107
198182
|
return await MiniDb.open(opts);
|
|
198108
198183
|
} catch {}
|
|
198109
|
-
await fs
|
|
198184
|
+
await fs.rm(opts.dir, {
|
|
198110
198185
|
recursive: true,
|
|
198111
198186
|
force: true
|
|
198112
198187
|
});
|
|
@@ -198168,7 +198243,7 @@ var init_src$1 = __esmMin((() => {
|
|
|
198168
198243
|
}
|
|
198169
198244
|
async loadIndexDefinitions() {
|
|
198170
198245
|
try {
|
|
198171
|
-
const raw = await fs
|
|
198246
|
+
const raw = await fs.readFile(this.indexPath, "utf8");
|
|
198172
198247
|
for (const d of JSON.parse(raw)) this.indexes.create(d.name, d);
|
|
198173
198248
|
} catch (e) {
|
|
198174
198249
|
if (e.code !== "ENOENT") throw e;
|
|
@@ -198179,7 +198254,7 @@ var init_src$1 = __esmMin((() => {
|
|
|
198179
198254
|
}
|
|
198180
198255
|
async loadTextIndexDefinitions() {
|
|
198181
198256
|
try {
|
|
198182
|
-
const raw = await fs
|
|
198257
|
+
const raw = await fs.readFile(this.textIndexPath, "utf8");
|
|
198183
198258
|
this.textDefs = JSON.parse(raw);
|
|
198184
198259
|
for (const d of this.textDefs) this.text.set(d.name, new TextIndex({
|
|
198185
198260
|
fields: d.fields,
|
|
@@ -198195,7 +198270,7 @@ var init_src$1 = __esmMin((() => {
|
|
|
198195
198270
|
}
|
|
198196
198271
|
async loadCompoundIndexDefinitions() {
|
|
198197
198272
|
try {
|
|
198198
|
-
const raw = await fs
|
|
198273
|
+
const raw = await fs.readFile(this.compoundIndexPath, "utf8");
|
|
198199
198274
|
for (const d of JSON.parse(raw)) this.compound.create(d.name, {
|
|
198200
198275
|
groupBy: d.groupBy,
|
|
198201
198276
|
orderBy: d.orderBy,
|
|
@@ -198838,7 +198913,7 @@ var init_src$1 = __esmMin((() => {
|
|
|
198838
198913
|
this.text.delete(name);
|
|
198839
198914
|
this.textDefs = this.textDefs.filter((d) => d.name !== name);
|
|
198840
198915
|
ti.close();
|
|
198841
|
-
await fs
|
|
198916
|
+
await fs.rm(this.textPostingsPath(name), { force: true }).catch(() => {});
|
|
198842
198917
|
throw e;
|
|
198843
198918
|
}
|
|
198844
198919
|
}
|
|
@@ -198849,7 +198924,7 @@ var init_src$1 = __esmMin((() => {
|
|
|
198849
198924
|
const ok = this.text.delete(name);
|
|
198850
198925
|
if (ti) {
|
|
198851
198926
|
ti.close();
|
|
198852
|
-
await fs
|
|
198927
|
+
await fs.rm(this.textPostingsPath(name), { force: true }).catch(() => {});
|
|
198853
198928
|
}
|
|
198854
198929
|
this.textDefs = this.textDefs.filter((d) => d.name !== name);
|
|
198855
198930
|
await this.persistTextIndexDefinitions();
|
|
@@ -199102,11 +199177,11 @@ var init_src$1 = __esmMin((() => {
|
|
|
199102
199177
|
}));
|
|
199103
199178
|
}
|
|
199104
199179
|
async persistentFiles() {
|
|
199105
|
-
return (await fs
|
|
199180
|
+
return (await fs.readdir(this.dir)).filter((n) => /^db\.(snapshot|wal|indexes\.json|compound-indexes\.json|textindexes\.json)$/.test(n) || /^db\.text-.*\.postings$/.test(n));
|
|
199106
199181
|
}
|
|
199107
199182
|
async copyIfExists(name, destDir) {
|
|
199108
199183
|
try {
|
|
199109
|
-
await fs
|
|
199184
|
+
await fs.copyFile(path.join(this.dir, name), path.join(destDir, name));
|
|
199110
199185
|
return true;
|
|
199111
199186
|
} catch (e) {
|
|
199112
199187
|
if (e.code === "ENOENT") return false;
|
|
@@ -199126,11 +199201,11 @@ var init_src$1 = __esmMin((() => {
|
|
|
199126
199201
|
});
|
|
199127
199202
|
try {
|
|
199128
199203
|
await this.wal.flush();
|
|
199129
|
-
await fs
|
|
199204
|
+
await fs.mkdir(destDir, { recursive: true });
|
|
199130
199205
|
const files = await this.persistentFiles();
|
|
199131
199206
|
const copied = [];
|
|
199132
199207
|
for (const name of files) if (await this.copyIfExists(name, destDir)) copied.push(name);
|
|
199133
|
-
await fs
|
|
199208
|
+
await fs.writeFile(path.join(destDir, "backup.manifest.json"), JSON.stringify({
|
|
199134
199209
|
version: 1,
|
|
199135
199210
|
createdAt: Date.now(),
|
|
199136
199211
|
files: copied
|
|
@@ -199145,18 +199220,18 @@ var init_src$1 = __esmMin((() => {
|
|
|
199145
199220
|
if (!srcDir) throw new TypeError("restore: srcDir is required");
|
|
199146
199221
|
if (!destDir) throw new TypeError("restore: destDir is required");
|
|
199147
199222
|
const { force, ...openOpts } = opts;
|
|
199148
|
-
if (force) await fs
|
|
199223
|
+
if (force) await fs.rm(destDir, {
|
|
199149
199224
|
recursive: true,
|
|
199150
199225
|
force: true
|
|
199151
199226
|
});
|
|
199152
199227
|
else try {
|
|
199153
|
-
if ((await fs
|
|
199228
|
+
if ((await fs.readdir(destDir)).length) throw new Error(`restore destination is not empty: ${destDir}`);
|
|
199154
199229
|
} catch (e) {
|
|
199155
199230
|
if (e.code !== "ENOENT") throw e;
|
|
199156
199231
|
}
|
|
199157
|
-
await fs
|
|
199158
|
-
const names = await fs
|
|
199159
|
-
for (const name of names) if (/^db\.(snapshot|wal|indexes\.json|compound-indexes\.json|textindexes\.json)$/.test(name) || /^db\.text-.*\.postings$/.test(name) || name === "backup.manifest.json") await fs
|
|
199232
|
+
await fs.mkdir(destDir, { recursive: true });
|
|
199233
|
+
const names = await fs.readdir(srcDir);
|
|
199234
|
+
for (const name of names) if (/^db\.(snapshot|wal|indexes\.json|compound-indexes\.json|textindexes\.json)$/.test(name) || /^db\.text-.*\.postings$/.test(name) || name === "backup.manifest.json") await fs.copyFile(path.join(srcDir, name), path.join(destDir, name));
|
|
199160
199235
|
return MiniDb.open({
|
|
199161
199236
|
...openOpts,
|
|
199162
199237
|
dir: destDir
|
|
@@ -199424,7 +199499,7 @@ var init_utils$1 = __esmMin((() => {
|
|
|
199424
199499
|
//#region ../../packages/minidb/src/cluster/lock-pool.ts
|
|
199425
199500
|
async function statFingerprint(file) {
|
|
199426
199501
|
try {
|
|
199427
|
-
const s = await fs
|
|
199502
|
+
const s = await fs.stat(file);
|
|
199428
199503
|
return `${s.mtimeMs}:${s.size}`;
|
|
199429
199504
|
} catch {
|
|
199430
199505
|
return "-";
|
|
@@ -199661,7 +199736,7 @@ var init_lock_pool = __esmMin((() => {
|
|
|
199661
199736
|
async tryCatchUpReader(cached, dir, parts) {
|
|
199662
199737
|
const mark = cached.walMark;
|
|
199663
199738
|
if (!mark) return false;
|
|
199664
|
-
const st = await fs
|
|
199739
|
+
const st = await fs.stat(path.join(dir, "db.wal")).catch(() => null);
|
|
199665
199740
|
if (!st || st.dev !== mark.dev || st.ino !== mark.ino || st.size < mark.size) return false;
|
|
199666
199741
|
while (cached.busy > 0) await sleep$2(5);
|
|
199667
199742
|
cached.busy++;
|
|
@@ -199747,7 +199822,7 @@ var init_topology = __esmMin((() => {
|
|
|
199747
199822
|
static async open(dir, opts) {
|
|
199748
199823
|
if (!dir) throw new TypeError("Topology.open: dir is required");
|
|
199749
199824
|
if (opts.shardCount !== void 0 && (!Number.isInteger(opts.shardCount) || opts.shardCount < 1)) throw new RangeError(`shardCount must be a positive integer, got ${opts.shardCount}`);
|
|
199750
|
-
await fs
|
|
199825
|
+
await fs.mkdir(dir, { recursive: true });
|
|
199751
199826
|
const metaPath = path.join(dir, CLUSTER_META_FILE);
|
|
199752
199827
|
const requested = {
|
|
199753
199828
|
version: META_VERSION,
|
|
@@ -199758,15 +199833,15 @@ var init_topology = __esmMin((() => {
|
|
|
199758
199833
|
};
|
|
199759
199834
|
const tmpPath = `${metaPath}.tmp-${process.pid}`;
|
|
199760
199835
|
try {
|
|
199761
|
-
await fs
|
|
199762
|
-
await fs
|
|
199836
|
+
await fs.writeFile(tmpPath, JSON.stringify(requested, null, 2));
|
|
199837
|
+
await fs.link(tmpPath, metaPath);
|
|
199763
199838
|
return new Topology(dir, requested);
|
|
199764
199839
|
} catch (e) {
|
|
199765
199840
|
if (e.code !== "EEXIST") throw e;
|
|
199766
199841
|
} finally {
|
|
199767
|
-
await fs
|
|
199842
|
+
await fs.unlink(tmpPath).catch(() => {});
|
|
199768
199843
|
}
|
|
199769
|
-
const loaded = JSON.parse(await fs
|
|
199844
|
+
const loaded = JSON.parse(await fs.readFile(metaPath, "utf8"));
|
|
199770
199845
|
if (loaded.version !== META_VERSION) throw new Error(`unsupported cluster meta version ${loaded.version} in ${metaPath}`);
|
|
199771
199846
|
if (!Number.isInteger(loaded.shardCount) || loaded.shardCount < 1) throw new Error(`invalid shardCount in ${metaPath}`);
|
|
199772
199847
|
if (opts.shardCount !== void 0 && opts.shardCount !== loaded.shardCount) throw new RangeError(`cluster was created with shardCount=${loaded.shardCount}, got ${opts.shardCount}`);
|
|
@@ -199787,7 +199862,7 @@ var init_topology = __esmMin((() => {
|
|
|
199787
199862
|
* interrupted between meta creation and directory creation heals on the
|
|
199788
199863
|
* next open. */
|
|
199789
199864
|
async ensureShardDirs() {
|
|
199790
|
-
await Promise.all(this.allShardDirs().map((d) => fs
|
|
199865
|
+
await Promise.all(this.allShardDirs().map((d) => fs.mkdir(d, { recursive: true })));
|
|
199791
199866
|
}
|
|
199792
199867
|
};
|
|
199793
199868
|
}));
|
|
@@ -200015,7 +200090,7 @@ var init_cluster = __esmMin((() => {
|
|
|
200015
200090
|
}
|
|
200016
200091
|
static async loadRegistry(file) {
|
|
200017
200092
|
try {
|
|
200018
|
-
const raw = JSON.parse(await fs
|
|
200093
|
+
const raw = JSON.parse(await fs.readFile(file, "utf8"));
|
|
200019
200094
|
return {
|
|
200020
200095
|
indexes: raw.indexes ?? [],
|
|
200021
200096
|
compoundIndexes: raw.compoundIndexes ?? [],
|
|
@@ -200032,8 +200107,8 @@ var init_cluster = __esmMin((() => {
|
|
|
200032
200107
|
}
|
|
200033
200108
|
static async saveRegistry(file, reg) {
|
|
200034
200109
|
const tmp = `${file}.tmp-${process.pid}`;
|
|
200035
|
-
await fs
|
|
200036
|
-
await fs
|
|
200110
|
+
await fs.writeFile(tmp, JSON.stringify(reg, null, 2));
|
|
200111
|
+
await fs.rename(tmp, file);
|
|
200037
200112
|
}
|
|
200038
200113
|
/** Compare two index definitions by their effective values (defaults
|
|
200039
200114
|
* applied), so a raced create of the same definition is a no-op while a
|
|
@@ -220505,7 +220580,7 @@ var init_loopService = __esmMin((() => {
|
|
|
220505
220580
|
this.finishStep(turnId, signal, currentStep, stepUuid, response, finishReason, markStepStarted);
|
|
220506
220581
|
return {
|
|
220507
220582
|
stopReason: finishReason,
|
|
220508
|
-
hookStopTurn: await this.runAfterStep(turnId, signal, currentStep, response.usage, finishReason)
|
|
220583
|
+
hookStopTurn: await this.runAfterStep(turnId, signal, currentStep, response.usage, finishReason, response.message.toolCalls)
|
|
220509
220584
|
};
|
|
220510
220585
|
}
|
|
220511
220586
|
beginStep(turnId, signal, currentStep, stepUuid, onStarted) {
|
|
@@ -220604,13 +220679,14 @@ var init_loopService = __esmMin((() => {
|
|
|
220604
220679
|
});
|
|
220605
220680
|
this.emitStepCompleted(turnId, currentStep, stepUuid, response.usage, stepFinishReason, response);
|
|
220606
220681
|
}
|
|
220607
|
-
async runAfterStep(turnId, signal, currentStep, usage, finishReason) {
|
|
220682
|
+
async runAfterStep(turnId, signal, currentStep, usage, finishReason, toolCalls) {
|
|
220608
220683
|
const context = {
|
|
220609
220684
|
turnId,
|
|
220610
220685
|
step: currentStep,
|
|
220611
220686
|
signal,
|
|
220612
220687
|
usage,
|
|
220613
220688
|
finishReason,
|
|
220689
|
+
toolCalls,
|
|
220614
220690
|
stopTurn: false
|
|
220615
220691
|
};
|
|
220616
220692
|
try {
|
|
@@ -220730,22 +220806,39 @@ var AgentLoopContinuationService;
|
|
|
220730
220806
|
var init_loopContinuationService = __esmMin((() => {
|
|
220731
220807
|
init_lifecycle();
|
|
220732
220808
|
init_scope();
|
|
220809
|
+
init_completion();
|
|
220810
|
+
init_profile();
|
|
220811
|
+
init_systemReminder();
|
|
220733
220812
|
init_loopContinuation();
|
|
220734
220813
|
init_loop();
|
|
220735
220814
|
init_stepRequest();
|
|
220736
220815
|
init_decorateParam();
|
|
220737
220816
|
init_decorate();
|
|
220738
220817
|
AgentLoopContinuationService = class AgentLoopContinuationService extends Disposable {
|
|
220739
|
-
constructor(loop) {
|
|
220818
|
+
constructor(loop, profile, reminders) {
|
|
220740
220819
|
super();
|
|
220741
220820
|
this._register(loop.hooks.onDidFinishStep.register("loop-continuation", async (ctx, next) => {
|
|
220742
220821
|
await next();
|
|
220743
|
-
if (ctx.stopTurn || ctx.finishReason
|
|
220822
|
+
if (ctx.stopTurn || ctx.finishReason === "filtered") return;
|
|
220823
|
+
if (ctx.toolCalls.length === 0) {
|
|
220824
|
+
if (!profile.isRunnable()) return;
|
|
220825
|
+
reminders.appendSystemReminder(completion_review_default, {
|
|
220826
|
+
kind: "system_trigger",
|
|
220827
|
+
name: "completion_review"
|
|
220828
|
+
});
|
|
220829
|
+
loop.enqueue(new ContinuationStepRequest());
|
|
220830
|
+
return;
|
|
220831
|
+
}
|
|
220832
|
+
if (ctx.finishReason !== "tool_calls") return;
|
|
220744
220833
|
loop.enqueue(new ContinuationStepRequest());
|
|
220745
220834
|
}));
|
|
220746
220835
|
}
|
|
220747
220836
|
};
|
|
220748
|
-
AgentLoopContinuationService = __decorate$1([
|
|
220837
|
+
AgentLoopContinuationService = __decorate$1([
|
|
220838
|
+
__decorateParam(0, IAgentLoopService),
|
|
220839
|
+
__decorateParam(1, IAgentProfileService),
|
|
220840
|
+
__decorateParam(2, IAgentSystemReminderService)
|
|
220841
|
+
], AgentLoopContinuationService);
|
|
220749
220842
|
registerScopedService(2, IAgentLoopContinuationService, AgentLoopContinuationService, 0, "loop");
|
|
220750
220843
|
}));
|
|
220751
220844
|
//#endregion
|
|
@@ -222265,6 +222358,7 @@ var init_auto_mode_ask_user_question_deny = __esmMin((() => {
|
|
|
222265
222358
|
//#region ../../packages/agent-core-v2/src/agent/permissionPolicy/policies/default-tool-approve.ts
|
|
222266
222359
|
var DEFAULT_APPROVE_TOOLS, DefaultToolApprovePermissionPolicyService;
|
|
222267
222360
|
var init_default_tool_approve = __esmMin((() => {
|
|
222361
|
+
init_completion();
|
|
222268
222362
|
DEFAULT_APPROVE_TOOLS = new Set([
|
|
222269
222363
|
"Read",
|
|
222270
222364
|
"Grep",
|
|
@@ -222288,7 +222382,8 @@ var init_default_tool_approve = __esmMin((() => {
|
|
|
222288
222382
|
"GetGoal",
|
|
222289
222383
|
"SetGoalBudget",
|
|
222290
222384
|
"UpdateGoal",
|
|
222291
|
-
"select_tools"
|
|
222385
|
+
"select_tools",
|
|
222386
|
+
ALL_DONE_TOOL_NAME
|
|
222292
222387
|
]);
|
|
222293
222388
|
DefaultToolApprovePermissionPolicyService = class {
|
|
222294
222389
|
name = "default-tool-approve";
|
|
@@ -228247,7 +228342,7 @@ var init_toolExecutorService = __esmMin((() => {
|
|
|
228247
228342
|
if (call.kind === "rejected") return settleError(call.args, call.output);
|
|
228248
228343
|
let execution;
|
|
228249
228344
|
try {
|
|
228250
|
-
execution = await call.tool.resolveExecution(call.args);
|
|
228345
|
+
execution = await call.tool.resolveExecution(call.args, { toolCalls: allCalls });
|
|
228251
228346
|
} catch (error) {
|
|
228252
228347
|
const output = error instanceof PathSecurityError ? error.message : `Tool "${call.toolName}" failed to resolve execution: ${errorMessage$2(error)}`;
|
|
228253
228348
|
return settleError(call.args, output);
|
|
@@ -228525,6 +228620,7 @@ var init_toolActivationService = __esmMin((() => {
|
|
|
228525
228620
|
init_scope();
|
|
228526
228621
|
init_eventBus();
|
|
228527
228622
|
init_profile();
|
|
228623
|
+
init_completion();
|
|
228528
228624
|
init_evaluate();
|
|
228529
228625
|
init_toolRegistry();
|
|
228530
228626
|
init_toolContribution();
|
|
@@ -228554,7 +228650,7 @@ var init_toolActivationService = __esmMin((() => {
|
|
|
228554
228650
|
for (const { id, options } of getAgentToolContributions()) {
|
|
228555
228651
|
const source = options.source ?? "builtin";
|
|
228556
228652
|
if (this.toolRegistry.resolve(options.name) !== void 0) continue;
|
|
228557
|
-
if (!isToolActive(policy, options.name, source)) continue;
|
|
228653
|
+
if (options.name !== "AllDone" && !isToolActive(policy, options.name, source)) continue;
|
|
228558
228654
|
if (options.when !== void 0 && !options.when(accessor)) continue;
|
|
228559
228655
|
const tool = accessor.get(id);
|
|
228560
228656
|
this._register(this.toolRegistry.register(tool, {
|
|
@@ -228998,6 +229094,8 @@ var init_src = __esmMin((() => {
|
|
|
228998
229094
|
init_wait();
|
|
228999
229095
|
init_waitService();
|
|
229000
229096
|
init_waitForTool();
|
|
229097
|
+
init_completion();
|
|
229098
|
+
init_allDoneTool();
|
|
229001
229099
|
init_configSection$4();
|
|
229002
229100
|
init_cronTask();
|
|
229003
229101
|
init_cronTaskPersistence();
|
|
@@ -237194,9 +237292,9 @@ const DIMI_CODE_CDN_BASE = "https://github.com/zzj3720/dimi/releases/latest/down
|
|
|
237194
237292
|
* Dimi's own update authority: the `latest.json` manifest attached to the
|
|
237195
237293
|
* newest GitHub Release. GitHub's `releases/latest/download/<asset>` endpoint
|
|
237196
237294
|
* redirects to the latest release's asset, so publishing a tag and attaching
|
|
237197
|
-
* `latest.json` (see `.github/workflows/
|
|
237198
|
-
*
|
|
237199
|
-
*
|
|
237295
|
+
* `latest.json` (see `.github/workflows/release.yml`) is the entire release
|
|
237296
|
+
* process. The URL 404s until the first release exists, which degrades
|
|
237297
|
+
* cleanly to "no update available".
|
|
237200
237298
|
*/
|
|
237201
237299
|
const DIMI_CODE_UPDATE_CHANNEL_URL = "https://github.com/zzj3720/dimi/releases/latest/download/latest.json";
|
|
237202
237300
|
const DIMI_CODE_PLUGIN_MARKETPLACE_URL = `${DIMI_CODE_CDN_BASE}/marketplace.json`;
|
|
@@ -238183,7 +238281,7 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
238183
238281
|
const EventEmitter$12 = __require("node:events").EventEmitter;
|
|
238184
238282
|
const childProcess = __require("node:child_process");
|
|
238185
238283
|
const path$5 = __require("node:path");
|
|
238186
|
-
const fs$
|
|
238284
|
+
const fs$4 = __require("node:fs");
|
|
238187
238285
|
const process$2 = __require("node:process");
|
|
238188
238286
|
const { Argument, humanReadableArgName } = require_argument();
|
|
238189
238287
|
const { CommanderError } = require_error$2();
|
|
@@ -239066,7 +239164,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
239066
239164
|
* @param {string} subcommandName
|
|
239067
239165
|
*/
|
|
239068
239166
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
239069
|
-
if (fs$
|
|
239167
|
+
if (fs$4.existsSync(executableFile)) return;
|
|
239070
239168
|
const executableMissing = `'${executableFile}' does not exist
|
|
239071
239169
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
239072
239170
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
@@ -239090,9 +239188,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
239090
239188
|
];
|
|
239091
239189
|
function findFile(baseDir, baseName) {
|
|
239092
239190
|
const localBin = path$5.resolve(baseDir, baseName);
|
|
239093
|
-
if (fs$
|
|
239191
|
+
if (fs$4.existsSync(localBin)) return localBin;
|
|
239094
239192
|
if (sourceExt.includes(path$5.extname(baseName))) return void 0;
|
|
239095
|
-
const foundExt = sourceExt.find((ext) => fs$
|
|
239193
|
+
const foundExt = sourceExt.find((ext) => fs$4.existsSync(`${localBin}${ext}`));
|
|
239096
239194
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
239097
239195
|
}
|
|
239098
239196
|
this._checkForMissingMandatoryOptions();
|
|
@@ -239102,7 +239200,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
239102
239200
|
if (this._scriptPath) {
|
|
239103
239201
|
let resolvedScriptPath;
|
|
239104
239202
|
try {
|
|
239105
|
-
resolvedScriptPath = fs$
|
|
239203
|
+
resolvedScriptPath = fs$4.realpathSync(this._scriptPath);
|
|
239106
239204
|
} catch {
|
|
239107
239205
|
resolvedScriptPath = this._scriptPath;
|
|
239108
239206
|
}
|
|
@@ -262079,7 +262177,7 @@ var require_atomic_sleep = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262079
262177
|
//#endregion
|
|
262080
262178
|
//#region ../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js
|
|
262081
262179
|
var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
262082
|
-
const fs$
|
|
262180
|
+
const fs$3 = __require("fs");
|
|
262083
262181
|
const EventEmitter$10 = __require("events");
|
|
262084
262182
|
const inherits$6 = __require("util").inherits;
|
|
262085
262183
|
const path$4 = __require("path");
|
|
@@ -262122,17 +262220,17 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262122
262220
|
const flags = sonic.append ? "a" : "w";
|
|
262123
262221
|
const mode = sonic.mode;
|
|
262124
262222
|
if (sonic.sync) try {
|
|
262125
|
-
if (sonic.mkdir) fs$
|
|
262126
|
-
fileOpened(null, fs$
|
|
262223
|
+
if (sonic.mkdir) fs$3.mkdirSync(path$4.dirname(file), { recursive: true });
|
|
262224
|
+
fileOpened(null, fs$3.openSync(file, flags, mode));
|
|
262127
262225
|
} catch (err) {
|
|
262128
262226
|
fileOpened(err);
|
|
262129
262227
|
throw err;
|
|
262130
262228
|
}
|
|
262131
|
-
else if (sonic.mkdir) fs$
|
|
262229
|
+
else if (sonic.mkdir) fs$3.mkdir(path$4.dirname(file), { recursive: true }, (err) => {
|
|
262132
262230
|
if (err) return fileOpened(err);
|
|
262133
|
-
fs$
|
|
262231
|
+
fs$3.open(file, flags, mode, fileOpened);
|
|
262134
262232
|
});
|
|
262135
|
-
else fs$
|
|
262233
|
+
else fs$3.open(file, flags, mode, fileOpened);
|
|
262136
262234
|
}
|
|
262137
262235
|
function SonicBoom(opts) {
|
|
262138
262236
|
if (!(this instanceof SonicBoom)) return new SonicBoom(opts);
|
|
@@ -262170,8 +262268,8 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262170
262268
|
this.flush = flushBuffer;
|
|
262171
262269
|
this.flushSync = flushBufferSync;
|
|
262172
262270
|
this._actualWrite = actualWriteBuffer;
|
|
262173
|
-
fsWriteSync = () => fs$
|
|
262174
|
-
fsWrite = () => fs$
|
|
262271
|
+
fsWriteSync = () => fs$3.writeSync(this.fd, this._writingBuf);
|
|
262272
|
+
fsWrite = () => fs$3.write(this.fd, this._writingBuf, this.release);
|
|
262175
262273
|
} else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
|
|
262176
262274
|
this._writingBuf = "";
|
|
262177
262275
|
this.write = write;
|
|
@@ -262179,12 +262277,12 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262179
262277
|
this.flushSync = flushSync;
|
|
262180
262278
|
this._actualWrite = actualWrite;
|
|
262181
262279
|
fsWriteSync = () => {
|
|
262182
|
-
if (Buffer.isBuffer(this._writingBuf)) return fs$
|
|
262183
|
-
return fs$
|
|
262280
|
+
if (Buffer.isBuffer(this._writingBuf)) return fs$3.writeSync(this.fd, this._writingBuf);
|
|
262281
|
+
return fs$3.writeSync(this.fd, this._writingBuf, "utf8");
|
|
262184
262282
|
};
|
|
262185
262283
|
fsWrite = () => {
|
|
262186
|
-
if (Buffer.isBuffer(this._writingBuf)) return fs$
|
|
262187
|
-
return fs$
|
|
262284
|
+
if (Buffer.isBuffer(this._writingBuf)) return fs$3.write(this.fd, this._writingBuf, this.release);
|
|
262285
|
+
return fs$3.write(this.fd, this._writingBuf, "utf8", this.release);
|
|
262188
262286
|
};
|
|
262189
262287
|
} else throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
|
|
262190
262288
|
if (typeof fd === "number") {
|
|
@@ -262229,7 +262327,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262229
262327
|
return;
|
|
262230
262328
|
}
|
|
262231
262329
|
}
|
|
262232
|
-
if (this._fsync) fs$
|
|
262330
|
+
if (this._fsync) fs$3.fsyncSync(this.fd);
|
|
262233
262331
|
const len = this._len;
|
|
262234
262332
|
if (this._reopening) {
|
|
262235
262333
|
this._writing = false;
|
|
@@ -262326,7 +262424,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262326
262424
|
this._flushPending = true;
|
|
262327
262425
|
const onDrain = () => {
|
|
262328
262426
|
if (!this._fsync) try {
|
|
262329
|
-
fs$
|
|
262427
|
+
fs$3.fsync(this.fd, (err) => {
|
|
262330
262428
|
this._flushPending = false;
|
|
262331
262429
|
cb(err);
|
|
262332
262430
|
});
|
|
@@ -262403,7 +262501,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262403
262501
|
if (this._writing) return;
|
|
262404
262502
|
const fd = this.fd;
|
|
262405
262503
|
this.once("ready", () => {
|
|
262406
|
-
if (fd !== this.fd) fs$
|
|
262504
|
+
if (fd !== this.fd) fs$3.close(fd, (err) => {
|
|
262407
262505
|
if (err) return this.emit("error", err);
|
|
262408
262506
|
});
|
|
262409
262507
|
});
|
|
@@ -262434,7 +262532,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262434
262532
|
while (this._bufs.length || buf.length) {
|
|
262435
262533
|
if (buf.length <= 0) buf = this._bufs[0];
|
|
262436
262534
|
try {
|
|
262437
|
-
const n = Buffer.isBuffer(buf) ? fs$
|
|
262535
|
+
const n = Buffer.isBuffer(buf) ? fs$3.writeSync(this.fd, buf) : fs$3.writeSync(this.fd, buf, "utf8");
|
|
262438
262536
|
const releasedBufObj = releaseWritingBuf(buf, this._len, n);
|
|
262439
262537
|
buf = releasedBufObj.writingBuf;
|
|
262440
262538
|
this._len = releasedBufObj.len;
|
|
@@ -262445,7 +262543,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262445
262543
|
}
|
|
262446
262544
|
}
|
|
262447
262545
|
try {
|
|
262448
|
-
fs$
|
|
262546
|
+
fs$3.fsyncSync(this.fd);
|
|
262449
262547
|
} catch {}
|
|
262450
262548
|
}
|
|
262451
262549
|
function flushBufferSync() {
|
|
@@ -262459,7 +262557,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262459
262557
|
while (this._bufs.length || buf.length) {
|
|
262460
262558
|
if (buf.length <= 0) buf = mergeBuf(this._bufs[0], this._lens[0]);
|
|
262461
262559
|
try {
|
|
262462
|
-
const n = fs$
|
|
262560
|
+
const n = fs$3.writeSync(this.fd, buf);
|
|
262463
262561
|
buf = buf.subarray(n);
|
|
262464
262562
|
this._len = Math.max(this._len - n, 0);
|
|
262465
262563
|
if (buf.length <= 0) {
|
|
@@ -262481,24 +262579,24 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262481
262579
|
this._writing = true;
|
|
262482
262580
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
|
|
262483
262581
|
if (this.sync) try {
|
|
262484
|
-
release(null, Buffer.isBuffer(this._writingBuf) ? fs$
|
|
262582
|
+
release(null, Buffer.isBuffer(this._writingBuf) ? fs$3.writeSync(this.fd, this._writingBuf) : fs$3.writeSync(this.fd, this._writingBuf, "utf8"));
|
|
262485
262583
|
} catch (err) {
|
|
262486
262584
|
release(err);
|
|
262487
262585
|
}
|
|
262488
|
-
else fs$
|
|
262586
|
+
else fs$3.write(this.fd, this._writingBuf, release);
|
|
262489
262587
|
}
|
|
262490
262588
|
function actualWriteBuffer() {
|
|
262491
262589
|
const release = this.release;
|
|
262492
262590
|
this._writing = true;
|
|
262493
262591
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
|
|
262494
262592
|
if (this.sync) try {
|
|
262495
|
-
release(null, fs$
|
|
262593
|
+
release(null, fs$3.writeSync(this.fd, this._writingBuf));
|
|
262496
262594
|
} catch (err) {
|
|
262497
262595
|
release(err);
|
|
262498
262596
|
}
|
|
262499
262597
|
else {
|
|
262500
262598
|
if (kCopyBuffer) this._writingBuf = Buffer.from(this._writingBuf);
|
|
262501
|
-
fs$
|
|
262599
|
+
fs$3.write(this.fd, this._writingBuf, release);
|
|
262502
262600
|
}
|
|
262503
262601
|
}
|
|
262504
262602
|
function actualClose(sonic) {
|
|
@@ -262512,10 +262610,10 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262512
262610
|
sonic._lens = [];
|
|
262513
262611
|
assert$8(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
|
|
262514
262612
|
try {
|
|
262515
|
-
fs$
|
|
262613
|
+
fs$3.fsync(sonic.fd, closeWrapped);
|
|
262516
262614
|
} catch {}
|
|
262517
262615
|
function closeWrapped() {
|
|
262518
|
-
if (sonic.fd !== 1 && sonic.fd !== 2) fs$
|
|
262616
|
+
if (sonic.fd !== 1 && sonic.fd !== 2) fs$3.close(sonic.fd, done);
|
|
262519
262617
|
else done();
|
|
262520
262618
|
}
|
|
262521
262619
|
function done(err) {
|
|
@@ -311055,7 +311153,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
311055
311153
|
//#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/mode/static.js
|
|
311056
311154
|
var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
311057
311155
|
const path$2 = __require("node:path");
|
|
311058
|
-
const fs$
|
|
311156
|
+
const fs$2 = __require("node:fs");
|
|
311059
311157
|
const yaml = require_dist$1();
|
|
311060
311158
|
module.exports = function(fastify, opts, done) {
|
|
311061
311159
|
if (!opts.specification) return done(/* @__PURE__ */ new Error("specification is missing in the module options"));
|
|
@@ -311064,14 +311162,14 @@ var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
311064
311162
|
if (!opts.specification.path && !opts.specification.document) return done(/* @__PURE__ */ new Error("both specification.path and specification.document are missing, should be path to the file or swagger document spec"));
|
|
311065
311163
|
else if (opts.specification.path) {
|
|
311066
311164
|
if (typeof opts.specification.path !== "string") return done(/* @__PURE__ */ new Error("specification.path is not a string"));
|
|
311067
|
-
if (!fs$
|
|
311165
|
+
if (!fs$2.existsSync(path$2.resolve(opts.specification.path))) return done(/* @__PURE__ */ new Error(`${opts.specification.path} does not exist`));
|
|
311068
311166
|
const extName = path$2.extname(opts.specification.path).toLowerCase();
|
|
311069
311167
|
if ([".yaml", ".json"].indexOf(extName) === -1) return done(/* @__PURE__ */ new Error("specification.path extension name is not supported, should be one from ['.yaml', '.json']"));
|
|
311070
311168
|
if (opts.specification.postProcessor && typeof opts.specification.postProcessor !== "function") return done(/* @__PURE__ */ new Error("specification.postProcessor should be a function"));
|
|
311071
311169
|
if (opts.specification.baseDir && typeof opts.specification.baseDir !== "string") return done(/* @__PURE__ */ new Error("specification.baseDir should be string"));
|
|
311072
311170
|
if (!opts.specification.baseDir) opts.specification.baseDir = path$2.resolve(path$2.dirname(opts.specification.path));
|
|
311073
311171
|
else while (opts.specification.baseDir.endsWith("/")) opts.specification.baseDir = opts.specification.baseDir.slice(0, -1);
|
|
311074
|
-
const source = fs$
|
|
311172
|
+
const source = fs$2.readFileSync(path$2.resolve(opts.specification.path), "utf8");
|
|
311075
311173
|
switch (extName) {
|
|
311076
311174
|
case ".yaml":
|
|
311077
311175
|
swaggerObject = yaml.parse(source);
|
|
@@ -311338,11 +311436,11 @@ var require_should_route_hide = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
311338
311436
|
//#endregion
|
|
311339
311437
|
//#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/util/read-package-json.js
|
|
311340
311438
|
var require_read_package_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
311341
|
-
const fs$
|
|
311439
|
+
const fs$1 = __require("node:fs");
|
|
311342
311440
|
const path$1 = __require("node:path");
|
|
311343
311441
|
function readPackageJson() {
|
|
311344
311442
|
try {
|
|
311345
|
-
return JSON.parse(fs$
|
|
311443
|
+
return JSON.parse(fs$1.readFileSync(path$1.join(__dirname, "..", "..", "package.json")));
|
|
311346
311444
|
} catch {
|
|
311347
311445
|
return {};
|
|
311348
311446
|
}
|