@appsys-sas/devtool 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/index.js +612 -112
- package/dist/schema/config.schema.json +20 -1
- package/dist/skills/devtool-files-environment/SKILL.md +5 -0
- package/dist/ui/assets/{Checkbox-D7yQGoEk.js → Checkbox-abQ9sW3H.js} +1 -1
- package/dist/ui/assets/{Collection-Cj-SRE7R.js → Collection-B2NEaZC0.js} +1 -1
- package/dist/ui/assets/{ConfigFileChoice-C5HTIsQC.js → ConfigFileChoice-B5QLzuu8.js} +1 -1
- package/dist/ui/assets/{ConfirmDialog-XlKcsSom.js → ConfirmDialog-1cqQ59xe.js} +1 -1
- package/dist/ui/assets/{DashboardView-e5G8IftI.js → DashboardView-CMPRhwwa.js} +1 -1
- package/dist/ui/assets/{DialogClose-Bm5cPqtw.js → DialogClose-byQzZSfz.js} +1 -1
- package/dist/ui/assets/{DirectoryCommandView-sxkZlLdw.js → DirectoryCommandView-CFI3wzWf.js} +1 -1
- package/dist/ui/assets/{DirectoryFilesView-DY-e-jJX.js → DirectoryFilesView-CPeMq3ov.js} +1 -1
- package/dist/ui/assets/{DirectoryHomeView-C0SNUw30.js → DirectoryHomeView-Ckg9j0Yf.js} +1 -1
- package/dist/ui/assets/{DirectoryIndexView-DJl0vpIK.js → DirectoryIndexView-C619kc9m.js} +1 -1
- package/dist/ui/assets/{DirectoryStreamView-DCmsEbUt.js → DirectoryStreamView-CrROVtou.js} +1 -1
- package/dist/ui/assets/EnvironmentView-D_aegDhM.js +2 -0
- package/dist/ui/assets/{FieldRoot-Ba3ajGnY.js → FieldRoot-sBA1HPei.js} +1 -1
- package/dist/ui/assets/{FileSpaceView-DTt340y3.js → FileSpaceView-BFn4BEBu.js} +1 -1
- package/dist/ui/assets/{Input-BUX81dCB.js → Input-BbwPwVM7.js} +1 -1
- package/dist/ui/assets/{IntegrationLink-WxPu1PS-.js → IntegrationLink-BCF8ZEKM.js} +1 -1
- package/dist/ui/assets/{IntegrationView-6XT1E1h5.js → IntegrationView-CLrb4SQP.js} +1 -1
- package/dist/ui/assets/{MarkdownPreview-qt2DelWz.js → MarkdownPreview-CoOsYZKj.js} +3 -3
- package/dist/ui/assets/{McpDiff-3VSkgfGc.js → McpDiff-D1RNYGUe.js} +1 -1
- package/dist/ui/assets/{McpView-9lShvwe_.js → McpView-Bq_EBsPi.js} +1 -1
- package/dist/ui/assets/{PopperContent-CmOAkcRf.js → PopperContent-B_q63Zyq.js} +1 -1
- package/dist/ui/assets/{ProjectHomeView-ClRdWD9W.js → ProjectHomeView-DfvfFcCP.js} +1 -1
- package/dist/ui/assets/{ProjectStreamView-DHE-_9E4.js → ProjectStreamView-D9mfAwV8.js} +1 -1
- package/dist/ui/assets/{RovingFocusItem-BymPUlxw.js → RovingFocusItem-CBpb16VF.js} +1 -1
- package/dist/ui/assets/StreamView-BBGplV9D.js +28 -0
- package/dist/ui/assets/{TabsTrigger-khYkpwhU.js → TabsTrigger-U_sDAIj-.js} +1 -1
- package/dist/ui/assets/{Teleport-D-Oc12tT.js → Teleport-Bx22f1SH.js} +1 -1
- package/dist/ui/assets/chevron-right-CiUsWgy0.js +1 -0
- package/dist/ui/assets/{file-text-DnA8xow4.js → file-text-C1-cEsSt.js} +1 -1
- package/dist/ui/assets/{format-BC-XQyzO.js → format-xrzFa6vC.js} +1 -1
- package/dist/ui/assets/{index-poLkFtGg.js → index-C3qR5m5H.js} +5 -5
- package/dist/ui/assets/index-DnCcsA7m.css +2 -0
- package/dist/ui/assets/{jsonMode-D_auC3Tv.js → jsonMode-tu2vWqDk.js} +1 -1
- package/dist/ui/assets/{message-square-l8KeR32R.js → message-square-wkY5KdJS.js} +1 -1
- package/dist/ui/assets/{monaco-IsdWhzYV.js → monaco-DiOHp9Q3.js} +3 -3
- package/dist/ui/assets/{play-C3Tx0kFB.js → play-CrBudBv3.js} +1 -1
- package/dist/ui/assets/search-CDf6P_Oq.js +1 -0
- package/dist/ui/assets/{select-CRnMPn6I.js → select-DXkNI7Qq.js} +1 -1
- package/dist/ui/assets/{sparkles-Cu2_kOi4.js → sparkles-C5lNxl-z.js} +1 -1
- package/dist/ui/assets/{triangle-alert-C84qG3jJ.js → triangle-alert-CxEoYPUT.js} +1 -1
- package/dist/ui/assets/{useNonce-DNT86VSl.js → useNonce-DRxmgIHM.js} +1 -1
- package/dist/ui/assets/{ws-B-gwM5Rj.js → ws-B1_qJncx.js} +2 -2
- package/dist/ui/index.html +14 -14
- package/package.json +10 -9
- package/dist/ui/assets/EnvironmentView-XUkVme1D.js +0 -2
- package/dist/ui/assets/StreamView-CaR6s6cC.js +0 -28
- package/dist/ui/assets/chevron-right-rDR2WFWU.js +0 -1
- package/dist/ui/assets/index-Dpy4knpi.css +0 -2
- package/dist/ui/assets/search-wk-YKNcO.js +0 -1
package/dist/lib/index.js
CHANGED
|
@@ -30,6 +30,7 @@ import { parse as parse$1, patch } from "@decimalturn/toml-patch";
|
|
|
30
30
|
import { isMap as isMap$2, isScalar, isSeq, parse as parse$2, parseDocument } from "yaml";
|
|
31
31
|
import { DOMImplementation, DOMParser, XMLSerializer, onErrorStopParsing } from "@xmldom/xmldom";
|
|
32
32
|
import net from "node:net";
|
|
33
|
+
import { GLOBSTAR, Minimatch, braceExpand } from "minimatch";
|
|
33
34
|
import { spawn as spawn$1 } from "@lydell/node-pty";
|
|
34
35
|
import { isUtf8 } from "node:buffer";
|
|
35
36
|
import treeKill from "tree-kill";
|
|
@@ -8002,7 +8003,7 @@ function runProxy({ adtSecurePort = 6731, proxyPort = 443 } = {}) {
|
|
|
8002
8003
|
return server;
|
|
8003
8004
|
}
|
|
8004
8005
|
// ../server/package.json
|
|
8005
|
-
var version$1 = "1.1.
|
|
8006
|
+
var version$1 = "1.1.3";
|
|
8006
8007
|
// ../../packages/certs/lib/certificate.js
|
|
8007
8008
|
const CERTIFICATE_BLOCK = /-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/;
|
|
8008
8009
|
const COMMON_NAME = /(?:^|\n| \+ )CN=((?:\\.|[^\\\n+])+?)(?= \+ |\n|$)/;
|
|
@@ -8198,6 +8199,301 @@ async function install(folder, log) {
|
|
|
8198
8199
|
});
|
|
8199
8200
|
return executable;
|
|
8200
8201
|
}
|
|
8202
|
+
/** The start of the name of an item moved aside next to where it was, until its removal is kept or undone. */
|
|
8203
|
+
const ASIDE_PREFIX = ".devtool-undo-";
|
|
8204
|
+
const MATCH_OPTIONS = {
|
|
8205
|
+
nonegate: true,
|
|
8206
|
+
nocomment: true
|
|
8207
|
+
};
|
|
8208
|
+
/** The most alternatives the braces of a pattern may expand to. */
|
|
8209
|
+
const MAX_BRACE_ALTERNATIVES = 1e3;
|
|
8210
|
+
/** The most characters the alternatives of a pattern may hold in all, well below where the expansion drops some. */
|
|
8211
|
+
const MAX_EXPANDED_LENGTH = 1e6;
|
|
8212
|
+
/**
|
|
8213
|
+
* Tells why a glob pattern cannot choose the files of a folder, checked in the composed Unicode form the filter
|
|
8214
|
+
* matches: a negation, a backslash, a pattern the matcher refuses, braces expanding to too many alternatives or
|
|
8215
|
+
* characters (past which the expansion drops some), braces left in an alternative (an incomplete set, or one the
|
|
8216
|
+
* expansion gave up on), or an absolute path, an empty, `.`
|
|
8217
|
+
* or `..` segment in the pattern or in one of its alternatives, none of which would match the paths of the folder
|
|
8218
|
+
* as written.
|
|
8219
|
+
*
|
|
8220
|
+
* @param written - The pattern.
|
|
8221
|
+
* @returns Why it cannot be used, null when it can.
|
|
8222
|
+
*/
|
|
8223
|
+
function filePatternProblem(written) {
|
|
8224
|
+
const pattern = written.normalize("NFC");
|
|
8225
|
+
if (pattern.startsWith("!")) return "is a negation, which is not supported: list what to hide in exclude";
|
|
8226
|
+
if (pattern.includes("\\")) return "holds a backslash: separate folders with /";
|
|
8227
|
+
let expansions;
|
|
8228
|
+
try {
|
|
8229
|
+
expansions = braceExpand(pattern, { braceExpandMax: 1001 });
|
|
8230
|
+
if (expansions.length <= MAX_BRACE_ALTERNATIVES) new Minimatch(pattern, MATCH_OPTIONS).makeRe();
|
|
8231
|
+
} catch (error) {
|
|
8232
|
+
return `is not a valid glob: ${error instanceof Error ? error.message : String(error)}`;
|
|
8233
|
+
}
|
|
8234
|
+
if (expansions.length > MAX_BRACE_ALTERNATIVES || expansions.reduce((total, expanded) => total + expanded.length, 0) > MAX_EXPANDED_LENGTH) return `expands to more than ${MAX_BRACE_ALTERNATIVES} alternatives or ${MAX_EXPANDED_LENGTH} characters: split it`;
|
|
8235
|
+
if (expansions.some((expanded) => /[{}]/.test(expanded))) return "holds braces that do not expand to alternatives: write complete sets such as {a,b}, or a shorter glob";
|
|
8236
|
+
for (const expanded of [pattern, ...expansions]) {
|
|
8237
|
+
const segments = expanded.split("/");
|
|
8238
|
+
if (expanded.startsWith("/")) return "is absolute: write it relative to the folder of files";
|
|
8239
|
+
if (segments.includes("..")) return "goes up with ..: write it relative to the folder of files";
|
|
8240
|
+
if (segments.some((segment) => segment === "" || segment === ".")) return "holds an empty or . segment: write it such as apps/*/.env, without ./, // nor a trailing /";
|
|
8241
|
+
}
|
|
8242
|
+
return null;
|
|
8243
|
+
}
|
|
8244
|
+
/**
|
|
8245
|
+
* Splits a path relative to a folder into its names, in their composed Unicode form.
|
|
8246
|
+
*
|
|
8247
|
+
* @param relativePath - The path, its names separated by `/`.
|
|
8248
|
+
* @returns The names.
|
|
8249
|
+
*/
|
|
8250
|
+
function namesOf(relativePath) {
|
|
8251
|
+
return relativePath.normalize("NFC").split("/");
|
|
8252
|
+
}
|
|
8253
|
+
/**
|
|
8254
|
+
* Decides which files and folders of a folder of files are shown, every path being relative to the folder with
|
|
8255
|
+
* `/` separators: `.git` and the items moved aside never; names starting with a dot only with `showHidden`, or
|
|
8256
|
+
* with `include`, when a pattern names them; a file only when an `include` pattern matches it, if any; nothing
|
|
8257
|
+
* an `exclude` pattern matches, nor anything in a folder it matches.
|
|
8258
|
+
*/
|
|
8259
|
+
var FileFilter = class {
|
|
8260
|
+
/** Whether `include` or `exclude` patterns choose what is shown. */
|
|
8261
|
+
filtered;
|
|
8262
|
+
/** Whether only the files `include` patterns match are shown. */
|
|
8263
|
+
selective;
|
|
8264
|
+
_showHidden;
|
|
8265
|
+
_include;
|
|
8266
|
+
_exclude;
|
|
8267
|
+
/**
|
|
8268
|
+
* @param settings - The patterns and whether names starting with a dot are shown.
|
|
8269
|
+
*/
|
|
8270
|
+
constructor(settings) {
|
|
8271
|
+
this._showHidden = settings.showHidden;
|
|
8272
|
+
this._include = settings.include?.map((pattern) => {
|
|
8273
|
+
const matcher = new Minimatch(pattern.normalize("NFC"), {
|
|
8274
|
+
...MATCH_OPTIONS,
|
|
8275
|
+
dot: settings.showHidden
|
|
8276
|
+
});
|
|
8277
|
+
return {
|
|
8278
|
+
matcher,
|
|
8279
|
+
namingParts: matcher.globParts.map((parts) => parts.filter((part) => part !== "**").map((part) => new Minimatch(part, {
|
|
8280
|
+
...MATCH_OPTIONS,
|
|
8281
|
+
dot: false
|
|
8282
|
+
})))
|
|
8283
|
+
};
|
|
8284
|
+
}) ?? null;
|
|
8285
|
+
this._exclude = settings.exclude.map((pattern) => new Minimatch(pattern.normalize("NFC"), {
|
|
8286
|
+
...MATCH_OPTIONS,
|
|
8287
|
+
dot: true
|
|
8288
|
+
}));
|
|
8289
|
+
this.selective = this._include !== null;
|
|
8290
|
+
this.filtered = this.selective || this._exclude.length > 0;
|
|
8291
|
+
}
|
|
8292
|
+
/**
|
|
8293
|
+
* Tells whether a file is shown.
|
|
8294
|
+
*
|
|
8295
|
+
* @param relativePath - The path of the file.
|
|
8296
|
+
* @returns True when it is shown.
|
|
8297
|
+
*/
|
|
8298
|
+
showsFile(relativePath) {
|
|
8299
|
+
const names = namesOf(relativePath);
|
|
8300
|
+
return this.reaches(names) && this.included(names, "file");
|
|
8301
|
+
}
|
|
8302
|
+
/**
|
|
8303
|
+
* Tells whether a folder may be shown and looked into: not hidden, and, with `include`, able to lead to a file
|
|
8304
|
+
* a pattern matches.
|
|
8305
|
+
*
|
|
8306
|
+
* @param relativePath - The path of the folder.
|
|
8307
|
+
* @returns True when it may be shown.
|
|
8308
|
+
*/
|
|
8309
|
+
showsFolder(relativePath) {
|
|
8310
|
+
const names = namesOf(relativePath);
|
|
8311
|
+
return this.reaches(names) && this.included(names, "directory");
|
|
8312
|
+
}
|
|
8313
|
+
/**
|
|
8314
|
+
* Tells whether a path is one of those always hidden, `.git` and the items moved aside, or lies in one of them.
|
|
8315
|
+
*
|
|
8316
|
+
* @param relativePath - The path.
|
|
8317
|
+
* @returns True when it is always hidden.
|
|
8318
|
+
*/
|
|
8319
|
+
alwaysHides(relativePath) {
|
|
8320
|
+
return this.alwaysHidden(namesOf(relativePath));
|
|
8321
|
+
}
|
|
8322
|
+
/**
|
|
8323
|
+
* Tells whether the patterns hide a file or folder: one an `exclude` pattern matches or lies in a folder it matches,
|
|
8324
|
+
* or, with `include`, a file no pattern matches or a folder that cannot lead to one, names starting with a dot
|
|
8325
|
+
* included. What is always hidden is not hidden by the patterns.
|
|
8326
|
+
*
|
|
8327
|
+
* @param relativePath - The path.
|
|
8328
|
+
* @param kind - Whether it is a file or a folder.
|
|
8329
|
+
* @returns True when the patterns hide it.
|
|
8330
|
+
*/
|
|
8331
|
+
hidesByPatterns(relativePath, kind) {
|
|
8332
|
+
const names = namesOf(relativePath);
|
|
8333
|
+
return !this.alwaysHidden(names) && (this.excluded(names) || !this.included(names, kind));
|
|
8334
|
+
}
|
|
8335
|
+
/**
|
|
8336
|
+
* Tells whether a path is `.git` or an item moved aside, whatever the case of the name, or lies in one of them.
|
|
8337
|
+
*
|
|
8338
|
+
* @param names - The names of the path.
|
|
8339
|
+
* @returns True when it is always hidden.
|
|
8340
|
+
*/
|
|
8341
|
+
alwaysHidden(names) {
|
|
8342
|
+
return names.some((name) => name.toLowerCase() === ".git" || name.toLowerCase().startsWith(".devtool-undo-"));
|
|
8343
|
+
}
|
|
8344
|
+
/**
|
|
8345
|
+
* Tells whether an `exclude` pattern matches a path or a folder holding it.
|
|
8346
|
+
*
|
|
8347
|
+
* @param names - The names of the path.
|
|
8348
|
+
* @returns True when it is excluded.
|
|
8349
|
+
*/
|
|
8350
|
+
excluded(names) {
|
|
8351
|
+
return names.some((_, index) => {
|
|
8352
|
+
const folder = names.slice(0, index + 1).join("/");
|
|
8353
|
+
return this._exclude.some((matcher) => matcher.match(folder));
|
|
8354
|
+
});
|
|
8355
|
+
}
|
|
8356
|
+
/**
|
|
8357
|
+
* Tells whether `include` lets a path through: always without `include`, else a file an include pattern matches,
|
|
8358
|
+
* or a folder that can lead to one.
|
|
8359
|
+
*
|
|
8360
|
+
* @param names - The names of the path.
|
|
8361
|
+
* @param kind - Whether it is a file or a folder.
|
|
8362
|
+
* @returns True when `include` lets it through.
|
|
8363
|
+
*/
|
|
8364
|
+
included(names, kind) {
|
|
8365
|
+
if (!this._include) return true;
|
|
8366
|
+
return kind === "file" ? this._include.some(({ matcher }) => matcher.match(names.join("/"))) : this._include.some((pattern) => this.leadsTo(pattern, names));
|
|
8367
|
+
}
|
|
8368
|
+
/**
|
|
8369
|
+
* Tells whether a path escapes the names always hidden, the names starting with a dot when no `include` decides,
|
|
8370
|
+
* and every `exclude` pattern.
|
|
8371
|
+
*
|
|
8372
|
+
* @param names - The names of the path.
|
|
8373
|
+
* @returns True when nothing hides it.
|
|
8374
|
+
*/
|
|
8375
|
+
reaches(names) {
|
|
8376
|
+
if (this.alwaysHidden(names) || this.excluded(names)) return false;
|
|
8377
|
+
return Boolean(this._include) || this._showHidden || !names.some((name) => name.startsWith("."));
|
|
8378
|
+
}
|
|
8379
|
+
/**
|
|
8380
|
+
* Tells whether a folder can lead to a file an include pattern matches: the folder matches the start of the
|
|
8381
|
+
* pattern and the pattern goes on after it, with more names or a `**`; unless names starting with a dot are shown,
|
|
8382
|
+
* each such name of the folder must be matched by a part of the pattern other than `**`.
|
|
8383
|
+
*
|
|
8384
|
+
* @param pattern - The include pattern.
|
|
8385
|
+
* @param names - The names of the path of the folder.
|
|
8386
|
+
* @returns True when a file under the folder may match the pattern.
|
|
8387
|
+
*/
|
|
8388
|
+
leadsTo(pattern, names) {
|
|
8389
|
+
return pattern.matcher.set.some((parts, index) => (parts.length > names.length || parts.includes(GLOBSTAR)) && pattern.matcher.matchOne(names, parts, true) && (this._showHidden || names.every((name) => !name.startsWith(".") || (pattern.namingParts[index] ?? []).some((part) => part.match(name)))));
|
|
8390
|
+
}
|
|
8391
|
+
};
|
|
8392
|
+
/**
|
|
8393
|
+
* Gives what lies at a path.
|
|
8394
|
+
*
|
|
8395
|
+
* @param absolutePath - The path.
|
|
8396
|
+
* @returns A folder, a file for anything else, or null when nothing lies there.
|
|
8397
|
+
*/
|
|
8398
|
+
async function fileKindAt(absolutePath) {
|
|
8399
|
+
const stat = await fs.lstat(absolutePath).catch(() => null);
|
|
8400
|
+
return stat ? stat.isDirectory() ? "directory" : "file" : null;
|
|
8401
|
+
}
|
|
8402
|
+
/**
|
|
8403
|
+
* Gives a name with its case and Unicode form left out, as a folder that ignores them compares names, the full
|
|
8404
|
+
* case mappings of Unicode applied (`ß` folds as `ss`).
|
|
8405
|
+
*
|
|
8406
|
+
* @param name - The name.
|
|
8407
|
+
* @returns The name in NFC form, upper-cased then lower-cased.
|
|
8408
|
+
*/
|
|
8409
|
+
function foldedName(name) {
|
|
8410
|
+
return name.normalize("NFC").toUpperCase().toLowerCase();
|
|
8411
|
+
}
|
|
8412
|
+
/**
|
|
8413
|
+
* Gives the name an item of a folder is stored under, which a lookup by another case or Unicode form of the name
|
|
8414
|
+
* may have reached: the one entry of the folder whose name differs from it only by case or Unicode form and which
|
|
8415
|
+
* is the item found.
|
|
8416
|
+
*
|
|
8417
|
+
* @param folder - The absolute path of the folder.
|
|
8418
|
+
* @param name - The name the item was reached by.
|
|
8419
|
+
* @param found - What the lookup by that name found.
|
|
8420
|
+
* @returns The stored name, null when the folder cannot be listed, or holds no such entry or several.
|
|
8421
|
+
*/
|
|
8422
|
+
async function storedNameOf(folder, name, found) {
|
|
8423
|
+
const names = await fs.readdir(folder).catch(() => null);
|
|
8424
|
+
if (!names) return null;
|
|
8425
|
+
if (names.includes(name)) return name;
|
|
8426
|
+
const matches = [];
|
|
8427
|
+
for (const stored of names.filter((entry) => foldedName(entry) === foldedName(name))) {
|
|
8428
|
+
const item = await fs.lstat(path.join(folder, stored)).catch(() => null);
|
|
8429
|
+
if (item?.ino === found.ino && item.dev === found.dev) matches.push(stored);
|
|
8430
|
+
}
|
|
8431
|
+
return matches.length === 1 ? matches[0] ?? null : null;
|
|
8432
|
+
}
|
|
8433
|
+
/**
|
|
8434
|
+
* Gives a path of a folder as it lies on the disk, so that another case, Unicode form or spelling of an existing
|
|
8435
|
+
* file never escapes what is decided for its stored names: each existing name of the path, up to a symbolic link,
|
|
8436
|
+
* is replaced by the name its folder stores it under; the names that do not exist yet are kept as given.
|
|
8437
|
+
*
|
|
8438
|
+
* @param root - The absolute path of the folder.
|
|
8439
|
+
* @param relativePath - The path, relative to the folder with `/` separators.
|
|
8440
|
+
* @returns The path as it lies on the disk, null when it is empty, absolute, holds an empty, `.` or `..` segment, a
|
|
8441
|
+
* backslash or a NUL, or when the stored name of an existing name cannot be found.
|
|
8442
|
+
*/
|
|
8443
|
+
async function realPathOf$1(root, relativePath) {
|
|
8444
|
+
const names = relativePath.split("/");
|
|
8445
|
+
if (!relativePath || path.isAbsolute(relativePath) || names.some((item) => !item || item === "." || item === ".." || item.includes("\\") || item.includes("\0"))) return null;
|
|
8446
|
+
const stored = [];
|
|
8447
|
+
let link = false;
|
|
8448
|
+
let folder = true;
|
|
8449
|
+
for (const item of names) {
|
|
8450
|
+
const parent = path.join(root, ...stored);
|
|
8451
|
+
const stat = await fs.lstat(path.join(parent, item)).catch(() => null);
|
|
8452
|
+
link = stat?.isSymbolicLink() ?? false;
|
|
8453
|
+
if (!stat || link) break;
|
|
8454
|
+
const name = await storedNameOf(parent, item, stat);
|
|
8455
|
+
if (name === null) return null;
|
|
8456
|
+
stored.push(name);
|
|
8457
|
+
folder = stat.isDirectory();
|
|
8458
|
+
}
|
|
8459
|
+
const existingPath = stored.join("/");
|
|
8460
|
+
return {
|
|
8461
|
+
path: [...stored, ...names.slice(stored.length)].join("/"),
|
|
8462
|
+
link,
|
|
8463
|
+
through: stored.length > 0 && !folder && !link && stored.length < names.length ? existingPath : null
|
|
8464
|
+
};
|
|
8465
|
+
}
|
|
8466
|
+
/**
|
|
8467
|
+
* Gives a path of a folder as it lies on the disk when the filter of the folder shows it, deciding on the real path
|
|
8468
|
+
* of its existing part: what lies at the path must be shown as what it is, and as what the path is meant to be, and
|
|
8469
|
+
* an existing file the path goes through must be shown, so that a hidden path gets the same refusal whether or not
|
|
8470
|
+
* something lies there.
|
|
8471
|
+
*
|
|
8472
|
+
* @param root - The absolute path of the folder.
|
|
8473
|
+
* @param relativePath - The path, relative to the folder with `/` separators.
|
|
8474
|
+
* @param filter - The filter of the folder.
|
|
8475
|
+
* @param kind - What the path is meant to be, by default what lies there, or a file when nothing does.
|
|
8476
|
+
* @returns The path relative to the folder, or why it is refused, a hidden path before one through a symbolic link.
|
|
8477
|
+
*/
|
|
8478
|
+
async function resolveShownPath(root, relativePath, filter, kind) {
|
|
8479
|
+
const real = await realPathOf$1(root, relativePath);
|
|
8480
|
+
if (!real) return {
|
|
8481
|
+
path: null,
|
|
8482
|
+
refused: "invalid"
|
|
8483
|
+
};
|
|
8484
|
+
const present = real.link || real.through !== null ? null : await fileKindAt(path.join(root, real.path));
|
|
8485
|
+
if (![.../* @__PURE__ */ new Set([kind ?? present ?? "file", present ?? kind ?? "file"])].every((item) => item === "directory" ? filter.showsFolder(real.path) : filter.showsFile(real.path)) || real.through !== null && !filter.showsFile(real.through)) return {
|
|
8486
|
+
path: null,
|
|
8487
|
+
refused: "hidden"
|
|
8488
|
+
};
|
|
8489
|
+
return real.link ? {
|
|
8490
|
+
path: null,
|
|
8491
|
+
refused: "link"
|
|
8492
|
+
} : {
|
|
8493
|
+
path: real.path,
|
|
8494
|
+
refused: null
|
|
8495
|
+
};
|
|
8496
|
+
}
|
|
8201
8497
|
// ../../packages/git/lib/forge.js
|
|
8202
8498
|
const REQUEST_TIMEOUT = 15e3;
|
|
8203
8499
|
/** A refusal or a failure of a forge. */
|
|
@@ -10760,6 +11056,8 @@ const AGENT_ACTION_SETTINGS = {
|
|
|
10760
11056
|
};
|
|
10761
11057
|
const FORGE_KINDS = ["pullRequests", "issues"];
|
|
10762
11058
|
const DEFAULT_AGENT_ICON = "lucide:bot";
|
|
11059
|
+
/** The most characters of a glob a warning quotes. */
|
|
11060
|
+
const MAX_SHOWN_PATTERN = 80;
|
|
10763
11061
|
const INTEGRATION_TYPES = ["web", ...FORGE_KINDS];
|
|
10764
11062
|
/** The optional parts of the sidebar, each shown or hidden. */
|
|
10765
11063
|
const SIDEBAR_PARTS = [
|
|
@@ -12359,6 +12657,9 @@ var DevtoolConfigure = class {
|
|
|
12359
12657
|
this.addWarning(`${slug}[${filesSlug}].type`, `must be ${FILES_TYPES.join(" or ")}`);
|
|
12360
12658
|
continue;
|
|
12361
12659
|
}
|
|
12660
|
+
const include = this.readFilePatterns(`${slug}[${filesSlug}].include`, entry.include, false);
|
|
12661
|
+
const exclude = this.readFilePatterns(`${slug}[${filesSlug}].exclude`, entry.exclude, true);
|
|
12662
|
+
if (include === false || exclude === false) continue;
|
|
12362
12663
|
files[filesSlug] = {
|
|
12363
12664
|
slug: filesSlug,
|
|
12364
12665
|
name: typeof entry.name === "string" ? entry.name : filesSlug,
|
|
@@ -12380,12 +12681,35 @@ var DevtoolConfigure = class {
|
|
|
12380
12681
|
"mcp"
|
|
12381
12682
|
]),
|
|
12382
12683
|
mcpSkills: this.readMcpSkills(`${slug}[${filesSlug}].mcpSkills`, entry.mcpSkills, type),
|
|
12383
|
-
showHidden: this.readFlag(`${slug}[${filesSlug}].showHidden`, entry.showHidden, false)
|
|
12684
|
+
showHidden: this.readFlag(`${slug}[${filesSlug}].showHidden`, entry.showHidden, false),
|
|
12685
|
+
include,
|
|
12686
|
+
exclude: exclude ?? []
|
|
12384
12687
|
};
|
|
12385
12688
|
}
|
|
12386
12689
|
return files;
|
|
12387
12690
|
}
|
|
12388
12691
|
/**
|
|
12692
|
+
* Reads glob patterns choosing what a folder of files shows, relative to the folder.
|
|
12693
|
+
* @param slug Names the setting in warnings.
|
|
12694
|
+
* @param value The raw setting.
|
|
12695
|
+
* @param allowEmpty Whether an empty list is valid.
|
|
12696
|
+
* @returns The patterns, null when the setting is missing, false when it is invalid.
|
|
12697
|
+
*/
|
|
12698
|
+
readFilePatterns(slug, value, allowEmpty) {
|
|
12699
|
+
if (value === void 0) return null;
|
|
12700
|
+
const patterns = toStringArray(value);
|
|
12701
|
+
if (!patterns || patterns.some((pattern) => !pattern)) return this.addWarning(slug, "must be a list of glob patterns, such as [ \"apps/*/.env\" ], the folder of files is left out");
|
|
12702
|
+
if (!allowEmpty && patterns.length === 0) return this.addWarning(slug, "must list at least one glob pattern, the folder of files is left out");
|
|
12703
|
+
for (const pattern of patterns) {
|
|
12704
|
+
const problem = filePatternProblem(pattern);
|
|
12705
|
+
if (problem) {
|
|
12706
|
+
const shown = pattern.length > MAX_SHOWN_PATTERN ? `${pattern.slice(0, MAX_SHOWN_PATTERN)}...` : pattern;
|
|
12707
|
+
return this.addWarning(slug, `${JSON.stringify(shown)} ${problem}, the folder of files is left out`);
|
|
12708
|
+
}
|
|
12709
|
+
}
|
|
12710
|
+
return patterns;
|
|
12711
|
+
}
|
|
12712
|
+
/**
|
|
12389
12713
|
* Reads a setting being true or false, warning about any other value.
|
|
12390
12714
|
* @param slug Names the setting in warnings.
|
|
12391
12715
|
* @param value The raw setting.
|
|
@@ -13933,6 +14257,15 @@ const STOP_TIMEOUT_MS = 1e4;
|
|
|
13933
14257
|
const SCRUB_IDLE_MS = 50;
|
|
13934
14258
|
const ANSI_RESET = "\x1B[0m";
|
|
13935
14259
|
const ANSI_INFO_PREFIX = "\x1B[38;5;195m\x1B[48;5;27m";
|
|
14260
|
+
/**
|
|
14261
|
+
* Wraps a piece of output the devtool writes itself in the colors of its information, line by line, so that no line
|
|
14262
|
+
* break carries its background color onto the line it opens.
|
|
14263
|
+
* @param content The text.
|
|
14264
|
+
* @returns The text in the colors of the information, its line breaks left uncolored.
|
|
14265
|
+
*/
|
|
14266
|
+
function infoContent(content) {
|
|
14267
|
+
return content.split(/(\r?\n)/).map((part) => part === "" || /^\r?\n$/.test(part) ? part : `${ANSI_INFO_PREFIX}${part}${ANSI_RESET}`).join("");
|
|
14268
|
+
}
|
|
13936
14269
|
function randomSlug() {
|
|
13937
14270
|
const now = Date.now();
|
|
13938
14271
|
return `${Math.random().toString(36).slice(2)}${now.toString(36)}`;
|
|
@@ -14259,6 +14592,17 @@ var DevtoolCommandStream = class DevtoolCommandStream {
|
|
|
14259
14592
|
await this.sendToWsConnections("streamUpdate", payload, wsInstance);
|
|
14260
14593
|
if (!wsInstance) this.events.emit("update");
|
|
14261
14594
|
}
|
|
14595
|
+
/**
|
|
14596
|
+
* Forgets the output kept so far, for every interface and agent: the interfaces are told to clear their terminal,
|
|
14597
|
+
* a reload no longer shows it, and the screen rendered for agents starts again from the output that follows.
|
|
14598
|
+
*/
|
|
14599
|
+
async clearOutput() {
|
|
14600
|
+
this._outputStart += this.output.length;
|
|
14601
|
+
this.output = [];
|
|
14602
|
+
this._screen?.dispose();
|
|
14603
|
+
this._screen = null;
|
|
14604
|
+
await this.sendToWsConnections("streamCleared", { slug: this.slug });
|
|
14605
|
+
}
|
|
14262
14606
|
async sendOutput(output = null, wsInstance = null) {
|
|
14263
14607
|
await this.sendToWsConnections("streamOutput", {
|
|
14264
14608
|
slug: this.slug,
|
|
@@ -14683,7 +15027,7 @@ var DevtoolCommandStream = class DevtoolCommandStream {
|
|
|
14683
15027
|
* @param content The text, information wrapped in its colors.
|
|
14684
15028
|
*/
|
|
14685
15029
|
async addOutput(type, content) {
|
|
14686
|
-
if (type === "info") content =
|
|
15030
|
+
if (type === "info") content = infoContent(content);
|
|
14687
15031
|
const output = {
|
|
14688
15032
|
date: Date.now(),
|
|
14689
15033
|
type,
|
|
@@ -14838,9 +15182,6 @@ async function editConfigFile(file, edit) {
|
|
|
14838
15182
|
/** Identifier of the file space of the configuration files of the development environment. */
|
|
14839
15183
|
const CONFIGS_SPACE = "configs";
|
|
14840
15184
|
const YAML_EXTENSION = /\.ya?ml$/;
|
|
14841
|
-
const GIT_FOLDER = ".git";
|
|
14842
|
-
/** The start of the name of an item moved aside next to where it was, until its removal is kept or undone. */
|
|
14843
|
-
const ASIDE_PREFIX = ".devtool-undo-";
|
|
14844
15185
|
const LOCAL_YAML_EXTENSION = /\.local\.ya?ml$/;
|
|
14845
15186
|
/**
|
|
14846
15187
|
* Gives a new hidden path next to a file or folder, which no listing shows, to move it aside.
|
|
@@ -14928,38 +15269,38 @@ function configFiles(section, includedPaths) {
|
|
|
14928
15269
|
};
|
|
14929
15270
|
}
|
|
14930
15271
|
/**
|
|
14931
|
-
* A folder of files the interface reads and writes, every path relative to its root.
|
|
14932
|
-
* parent segments and symbolic links are out of reach; binary files are
|
|
15272
|
+
* A folder of files the interface reads and writes, every path relative to its root. What its filter hides,
|
|
15273
|
+
* parent segments and symbolic links are out of reach, whatever the spelling of the path; binary files are
|
|
15274
|
+
* reported, never sent.
|
|
14933
15275
|
*/
|
|
14934
15276
|
var FileSpace = class {
|
|
14935
15277
|
id;
|
|
14936
15278
|
root;
|
|
14937
15279
|
editable;
|
|
14938
|
-
|
|
15280
|
+
filter;
|
|
14939
15281
|
afterWrite;
|
|
14940
15282
|
/**
|
|
14941
15283
|
* @param id - Identifier of the space.
|
|
14942
15284
|
* @param root - Absolute path of its root.
|
|
14943
15285
|
* @param editable - Whether files and folders can be created, renamed and removed.
|
|
14944
|
-
* @param
|
|
15286
|
+
* @param filter - Decides which files and folders are reachable.
|
|
14945
15287
|
* @param afterWrite - Runs once a file of the space is written.
|
|
14946
15288
|
*/
|
|
14947
|
-
constructor(id, root, editable,
|
|
15289
|
+
constructor(id, root, editable, filter, afterWrite = null) {
|
|
14948
15290
|
this.id = id;
|
|
14949
15291
|
this.root = root;
|
|
14950
15292
|
this.editable = editable;
|
|
14951
|
-
this.
|
|
15293
|
+
this.filter = filter;
|
|
14952
15294
|
this.afterWrite = afterWrite;
|
|
14953
15295
|
}
|
|
14954
15296
|
/**
|
|
14955
|
-
*
|
|
14956
|
-
* change is kept or undone, and any other dot name unless the space shows them.
|
|
15297
|
+
* Builds the refusal of a path the space does not show.
|
|
14957
15298
|
*
|
|
14958
|
-
* @param
|
|
14959
|
-
* @returns
|
|
15299
|
+
* @param filePath - The path.
|
|
15300
|
+
* @returns The refusal, the same whether or not something lies at the path.
|
|
14960
15301
|
*/
|
|
14961
|
-
|
|
14962
|
-
return
|
|
15302
|
+
hiddenPathError(filePath) {
|
|
15303
|
+
return /* @__PURE__ */ new Error(this.filter.filtered ? `${filePath} is outside the include/exclude of ${this.id}` : `${filePath} is not a path of ${this.id}`);
|
|
14963
15304
|
}
|
|
14964
15305
|
/**
|
|
14965
15306
|
* Describes the files of the space.
|
|
@@ -15011,7 +15352,7 @@ var FileSpace = class {
|
|
|
15011
15352
|
error: null
|
|
15012
15353
|
};
|
|
15013
15354
|
try {
|
|
15014
|
-
const absolutePath = await this.resolve(filePath);
|
|
15355
|
+
const absolutePath = await this.resolve(filePath, "file");
|
|
15015
15356
|
const stat = await fs.lstat(absolutePath).catch((error) => {
|
|
15016
15357
|
if (error.code === "ENOENT") return null;
|
|
15017
15358
|
throw error;
|
|
@@ -15090,7 +15431,7 @@ var FileSpace = class {
|
|
|
15090
15431
|
};
|
|
15091
15432
|
try {
|
|
15092
15433
|
this.validate(filePath, content);
|
|
15093
|
-
await writeLocalFile(await this.resolve(filePath), content);
|
|
15434
|
+
await writeLocalFile(await this.resolve(filePath, "file"), content);
|
|
15094
15435
|
} catch (error) {
|
|
15095
15436
|
return {
|
|
15096
15437
|
...current,
|
|
@@ -15110,7 +15451,7 @@ var FileSpace = class {
|
|
|
15110
15451
|
* @returns The files the creation wrote.
|
|
15111
15452
|
*/
|
|
15112
15453
|
async create(filePath, kind) {
|
|
15113
|
-
const absolutePath = await this.resolveEditable(filePath);
|
|
15454
|
+
const absolutePath = await this.resolveEditable(filePath, kind);
|
|
15114
15455
|
if (kind === "directory") {
|
|
15115
15456
|
await fs.mkdir(absolutePath, {
|
|
15116
15457
|
recursive: true,
|
|
@@ -15137,7 +15478,7 @@ var FileSpace = class {
|
|
|
15137
15478
|
* @param filePath - The path of the file or folder.
|
|
15138
15479
|
*/
|
|
15139
15480
|
async remove(filePath) {
|
|
15140
|
-
await fs.rm(await this.
|
|
15481
|
+
await fs.rm(await this.resolveRemovable(filePath), { recursive: true });
|
|
15141
15482
|
}
|
|
15142
15483
|
/**
|
|
15143
15484
|
* Moves a file or folder aside, to a hidden item of the same folder no listing shows, so that its removal can
|
|
@@ -15147,7 +15488,7 @@ var FileSpace = class {
|
|
|
15147
15488
|
* @returns The absolute paths of the file or folder and of the item it was moved to.
|
|
15148
15489
|
*/
|
|
15149
15490
|
async moveAside(filePath) {
|
|
15150
|
-
const absolutePath = await this.
|
|
15491
|
+
const absolutePath = await this.resolveRemovable(filePath);
|
|
15151
15492
|
const aside = asidePathOf(absolutePath);
|
|
15152
15493
|
await fs.rename(absolutePath, aside);
|
|
15153
15494
|
return {
|
|
@@ -15163,8 +15504,13 @@ var FileSpace = class {
|
|
|
15163
15504
|
*/
|
|
15164
15505
|
async rename(from, to) {
|
|
15165
15506
|
const source = await this.resolveEditable(from);
|
|
15166
|
-
const
|
|
15167
|
-
|
|
15507
|
+
const kind = await fileKindAt(source) ?? "file";
|
|
15508
|
+
const target = await this.resolveEditable(to, kind);
|
|
15509
|
+
if (await fileKindAt(target)) throw new Error(`${to} already exists`);
|
|
15510
|
+
if (kind === "directory") await this.checkFolderChange(from, source, {
|
|
15511
|
+
to,
|
|
15512
|
+
target
|
|
15513
|
+
});
|
|
15168
15514
|
await fs.mkdir(path.dirname(target), {
|
|
15169
15515
|
recursive: true,
|
|
15170
15516
|
mode: 448
|
|
@@ -15175,41 +15521,86 @@ var FileSpace = class {
|
|
|
15175
15521
|
* Gives the absolute path of a file or folder of the space.
|
|
15176
15522
|
*
|
|
15177
15523
|
* @param filePath - The path, relative to the root.
|
|
15524
|
+
* @param kind - What the path is meant to be, the file or folder lying there by default.
|
|
15178
15525
|
* @returns The absolute path.
|
|
15179
|
-
* @throws {Error} When the path is not one
|
|
15526
|
+
* @throws {Error} When the path is not one the space shows.
|
|
15180
15527
|
*/
|
|
15181
|
-
async absolutePathOf(filePath) {
|
|
15182
|
-
return this.resolve(filePath);
|
|
15528
|
+
async absolutePathOf(filePath, kind) {
|
|
15529
|
+
return this.resolve(filePath, kind);
|
|
15183
15530
|
}
|
|
15184
15531
|
/**
|
|
15185
|
-
* Gives the absolute path of a path of the space, refusing anything
|
|
15186
|
-
* parent, current or
|
|
15187
|
-
* existing
|
|
15532
|
+
* Gives the absolute path of a path of the space as it lies on the disk, refusing anything the space does not
|
|
15533
|
+
* show: absolute paths, parent, current or empty segments, symbolic links among the existing names, and what the
|
|
15534
|
+
* filter hides, decided on the real path of the existing part, through an existing file included. In a filtered
|
|
15535
|
+
* space, a path through a symbolic link gets the same refusal as a hidden one.
|
|
15188
15536
|
*
|
|
15189
15537
|
* @param filePath - The path, relative to the root.
|
|
15538
|
+
* @param kind - What the path is meant to be, by default the file or folder lying there, or a file when nothing
|
|
15539
|
+
* does; something lying there of another kind must be shown too.
|
|
15190
15540
|
* @returns The absolute path.
|
|
15191
15541
|
*/
|
|
15192
|
-
async resolve(filePath) {
|
|
15193
|
-
const
|
|
15194
|
-
if (
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
const stat = await fs.lstat(current).catch(() => null);
|
|
15199
|
-
if (!stat) break;
|
|
15200
|
-
if (stat.isSymbolicLink()) throw new Error(`${filePath} goes through a symbolic link`);
|
|
15201
|
-
}
|
|
15202
|
-
return path.join(this.root, filePath);
|
|
15542
|
+
async resolve(filePath, kind) {
|
|
15543
|
+
const shown = await resolveShownPath(this.root, filePath, this.filter, kind);
|
|
15544
|
+
if (shown.refused === null) return path.join(this.root, shown.path);
|
|
15545
|
+
if (shown.refused === "invalid") throw new Error(`${filePath} is not a path of ${this.id}`);
|
|
15546
|
+
if (shown.refused === "link" && !this.filter.filtered) throw new Error(`${filePath} goes through a symbolic link`);
|
|
15547
|
+
throw this.hiddenPathError(filePath);
|
|
15203
15548
|
}
|
|
15204
15549
|
/**
|
|
15205
15550
|
* Gives the absolute path of a path of the space whose files and folders can be changed.
|
|
15206
15551
|
*
|
|
15207
15552
|
* @param filePath - The path, relative to the root.
|
|
15553
|
+
* @param kind - What the path is meant to be, by default the file or folder lying there.
|
|
15208
15554
|
* @returns The absolute path.
|
|
15209
15555
|
*/
|
|
15210
|
-
async resolveEditable(filePath) {
|
|
15556
|
+
async resolveEditable(filePath, kind) {
|
|
15211
15557
|
if (!this.editable) throw new Error(`files of ${this.id} cannot be created, renamed or removed`);
|
|
15212
|
-
return this.resolve(filePath);
|
|
15558
|
+
return this.resolve(filePath, kind);
|
|
15559
|
+
}
|
|
15560
|
+
/**
|
|
15561
|
+
* Gives the absolute path of a file or folder of the space that can be removed with everything it holds.
|
|
15562
|
+
*
|
|
15563
|
+
* @param filePath - The path, relative to the root.
|
|
15564
|
+
* @returns The absolute path.
|
|
15565
|
+
*/
|
|
15566
|
+
async resolveRemovable(filePath) {
|
|
15567
|
+
const absolutePath = await this.resolveEditable(filePath);
|
|
15568
|
+
if (await fileKindAt(absolutePath) === "directory") await this.checkFolderChange(filePath, absolutePath, null);
|
|
15569
|
+
return absolutePath;
|
|
15570
|
+
}
|
|
15571
|
+
/**
|
|
15572
|
+
* Refuses, in a filtered space, to move or remove a folder holding a file or folder its include or exclude hide,
|
|
15573
|
+
* which would go with it unseen, and to move one holding something the space shows that it would no longer show at
|
|
15574
|
+
* its new place. What the space hides without its patterns (names starting with a dot without `showHidden`, `.git`,
|
|
15575
|
+
* symbolic links, special files) goes with the folder as in a space without patterns.
|
|
15576
|
+
*
|
|
15577
|
+
* @param filePath - The path of the folder, as given.
|
|
15578
|
+
* @param folder - Its absolute path.
|
|
15579
|
+
* @param move - Where it moves, as given and as an absolute path, null for a removal.
|
|
15580
|
+
* @param move.to - The new path, as given.
|
|
15581
|
+
* @param move.target - The new absolute path.
|
|
15582
|
+
* @throws {Error} When the change is refused.
|
|
15583
|
+
*/
|
|
15584
|
+
async checkFolderChange(filePath, folder, move) {
|
|
15585
|
+
if (!this.filter.filtered) return;
|
|
15586
|
+
const relativeOf = (absolutePath) => path.relative(this.root, absolutePath).split(path.sep).join("/");
|
|
15587
|
+
const source = relativeOf(folder);
|
|
15588
|
+
const destination = move && {
|
|
15589
|
+
to: move.to,
|
|
15590
|
+
path: relativeOf(move.target)
|
|
15591
|
+
};
|
|
15592
|
+
const visit = async (inner) => {
|
|
15593
|
+
for (const dirent of await fs.readdir(path.join(folder, inner), { withFileTypes: true })) {
|
|
15594
|
+
const entry = inner ? `${inner}/${dirent.name}` : dirent.name;
|
|
15595
|
+
const kind = dirent.isDirectory() ? "directory" : "file";
|
|
15596
|
+
if (!dirent.isDirectory() && !dirent.isFile()) continue;
|
|
15597
|
+
if (this.filter.hidesByPatterns(`${source}/${entry}`, kind)) throw new Error(`${filePath} holds files the include/exclude of ${this.id} hides`);
|
|
15598
|
+
const shown = (base) => kind === "directory" ? this.filter.showsFolder(`${base}/${entry}`) : this.filter.showsFile(`${base}/${entry}`);
|
|
15599
|
+
if (destination && shown(source) && !shown(destination.path)) throw new Error(`${filePath} cannot move to ${destination.to}: ${entry} would be outside the include/exclude of ${this.id}`);
|
|
15600
|
+
if (kind === "directory" && !this.filter.alwaysHides(`${source}/${entry}`)) await visit(entry);
|
|
15601
|
+
}
|
|
15602
|
+
};
|
|
15603
|
+
await visit("");
|
|
15213
15604
|
}
|
|
15214
15605
|
};
|
|
15215
15606
|
/**
|
|
@@ -15227,7 +15618,11 @@ var ListedFileSpace = class extends FileSpace {
|
|
|
15227
15618
|
* path in the root, by their path in the list.
|
|
15228
15619
|
*/
|
|
15229
15620
|
constructor(id, root, _paths, afterWrite = null, _located = /* @__PURE__ */ new Map()) {
|
|
15230
|
-
super(id, root, false,
|
|
15621
|
+
super(id, root, false, new FileFilter({
|
|
15622
|
+
include: null,
|
|
15623
|
+
exclude: [],
|
|
15624
|
+
showHidden: true
|
|
15625
|
+
}), afterWrite);
|
|
15231
15626
|
this._paths = _paths;
|
|
15232
15627
|
this._located = _located;
|
|
15233
15628
|
}
|
|
@@ -15266,52 +15661,65 @@ var ListedFileSpace = class extends FileSpace {
|
|
|
15266
15661
|
* path of the others in the root.
|
|
15267
15662
|
*
|
|
15268
15663
|
* @param filePath - The path of the file.
|
|
15664
|
+
* @param kind - What the path is meant to be.
|
|
15269
15665
|
* @returns The absolute path.
|
|
15270
15666
|
*/
|
|
15271
|
-
async resolve(filePath) {
|
|
15667
|
+
async resolve(filePath, kind) {
|
|
15272
15668
|
if (!this._paths.includes(filePath)) throw new Error(`${filePath} is not a file of ${this.id}`);
|
|
15273
15669
|
const located = this._located.get(filePath);
|
|
15274
15670
|
if (located !== void 0) return fs.realpath(located).catch(() => located);
|
|
15275
|
-
return super.resolve(filePath);
|
|
15671
|
+
return super.resolve(filePath, kind);
|
|
15276
15672
|
}
|
|
15277
15673
|
};
|
|
15278
15674
|
/**
|
|
15279
|
-
* A file space made of everything its root holds, whose files and folders can be changed.
|
|
15675
|
+
* A file space made of everything its root holds that its filter shows, whose files and folders can be changed.
|
|
15280
15676
|
*/
|
|
15281
15677
|
var TreeFileSpace = class extends FileSpace {
|
|
15282
15678
|
/**
|
|
15283
15679
|
* @param id - Identifier of the space.
|
|
15284
15680
|
* @param root - Absolute path of its root.
|
|
15285
15681
|
* @param showHidden - Whether the files and folders whose name starts with a dot are listed.
|
|
15682
|
+
* @param patterns - The glob patterns of the files shown and of the files and folders hidden.
|
|
15286
15683
|
*/
|
|
15287
|
-
constructor(id, root, showHidden = false
|
|
15288
|
-
|
|
15684
|
+
constructor(id, root, showHidden = false, patterns = {
|
|
15685
|
+
include: null,
|
|
15686
|
+
exclude: []
|
|
15687
|
+
}) {
|
|
15688
|
+
super(id, root, true, new FileFilter({
|
|
15689
|
+
include: patterns.include,
|
|
15690
|
+
exclude: patterns.exclude,
|
|
15691
|
+
showHidden
|
|
15692
|
+
}));
|
|
15289
15693
|
}
|
|
15290
15694
|
/**
|
|
15291
|
-
* Lists the files and folders under the root
|
|
15695
|
+
* Lists the files and folders under the root its filter shows, symbolic links left out, never looking into a folder
|
|
15696
|
+
* it hides. With `include`, a folder is listed only when it holds something listed or nothing at all.
|
|
15292
15697
|
*
|
|
15293
15698
|
* @returns The entries, sorted by path.
|
|
15294
15699
|
*/
|
|
15295
15700
|
async entries() {
|
|
15296
|
-
const entries = [];
|
|
15297
15701
|
const visit = async (folder) => {
|
|
15298
|
-
|
|
15299
|
-
|
|
15702
|
+
const dirents = await fs.readdir(path.join(this.root, folder), { withFileTypes: true });
|
|
15703
|
+
const entries = [];
|
|
15704
|
+
for (const dirent of dirents) {
|
|
15300
15705
|
const entryPath = folder ? `${folder}/${dirent.name}` : dirent.name;
|
|
15301
|
-
if (dirent.isDirectory()) {
|
|
15302
|
-
|
|
15706
|
+
if (dirent.isDirectory() && this.filter.showsFolder(entryPath)) {
|
|
15707
|
+
const inner = await visit(entryPath);
|
|
15708
|
+
if (!this.filter.selective || inner.entries.length > 0 || inner.empty) entries.push({
|
|
15303
15709
|
path: entryPath,
|
|
15304
15710
|
kind: "directory"
|
|
15305
|
-
});
|
|
15306
|
-
|
|
15307
|
-
} else if (dirent.isFile()) entries.push({
|
|
15711
|
+
}, ...inner.entries);
|
|
15712
|
+
} else if (dirent.isFile() && this.filter.showsFile(entryPath)) entries.push({
|
|
15308
15713
|
path: entryPath,
|
|
15309
15714
|
kind: "file"
|
|
15310
15715
|
});
|
|
15311
15716
|
}
|
|
15717
|
+
return {
|
|
15718
|
+
entries,
|
|
15719
|
+
empty: dirents.length === 0
|
|
15720
|
+
};
|
|
15312
15721
|
};
|
|
15313
|
-
await visit("");
|
|
15314
|
-
return entries.sort((a, b) => a.path.localeCompare(b.path));
|
|
15722
|
+
return (await visit("")).entries.sort((a, b) => a.path.localeCompare(b.path));
|
|
15315
15723
|
}
|
|
15316
15724
|
/**
|
|
15317
15725
|
* Checks the syntax of a YAML file.
|
|
@@ -15382,19 +15790,18 @@ var AgentSkillsFileSpace = class extends TreeFileSpace {
|
|
|
15382
15790
|
* @returns The files the creation wrote.
|
|
15383
15791
|
*/
|
|
15384
15792
|
async create(filePath, kind) {
|
|
15793
|
+
if (kind !== "directory" || filePath.includes("/")) return super.create(filePath, kind);
|
|
15794
|
+
await this.resolve(filePath, kind);
|
|
15795
|
+
const skill = {
|
|
15796
|
+
path: await this.resolve(`${filePath}/${AGENT_SKILL_FILE}`, "file"),
|
|
15797
|
+
content: newAgentSkill(filePath)
|
|
15798
|
+
};
|
|
15385
15799
|
const created = await super.create(filePath, kind);
|
|
15386
|
-
|
|
15387
|
-
|
|
15388
|
-
|
|
15389
|
-
|
|
15390
|
-
|
|
15391
|
-
await fs.writeFile(skill.path, skill.content, {
|
|
15392
|
-
flag: "wx",
|
|
15393
|
-
mode: 384
|
|
15394
|
-
});
|
|
15395
|
-
return [...created, skill];
|
|
15396
|
-
}
|
|
15397
|
-
return created;
|
|
15800
|
+
await fs.writeFile(skill.path, skill.content, {
|
|
15801
|
+
flag: "wx",
|
|
15802
|
+
mode: 384
|
|
15803
|
+
});
|
|
15804
|
+
return [...created, skill];
|
|
15398
15805
|
}
|
|
15399
15806
|
};
|
|
15400
15807
|
/**
|
|
@@ -15443,7 +15850,7 @@ var DevtoolFileSpaces = class {
|
|
|
15443
15850
|
const agentSpaces = /* @__PURE__ */ new Map([[CONFIGS_SPACE, new ListedFileSpace(CONFIGS_SPACE, agentConfigs.folder, agentConfigs.paths, afterConfigWrite)]]);
|
|
15444
15851
|
for (const project of Object.values(projects)) for (const directory of Object.values(project.directories)) for (const files of Object.values(directory.files)) {
|
|
15445
15852
|
const id = `${project.slug}/${directory.slug}/${files.slug}`;
|
|
15446
|
-
const space = files.type === "agentSkills" ? new AgentSkillsFileSpace(id, files.path, files.showHidden) : new TreeFileSpace(id, files.path, files.showHidden);
|
|
15853
|
+
const space = files.type === "agentSkills" ? new AgentSkillsFileSpace(id, files.path, files.showHidden, files) : new TreeFileSpace(id, files.path, files.showHidden, files);
|
|
15447
15854
|
spaces.set(id, space);
|
|
15448
15855
|
agentSpaces.set(id, space);
|
|
15449
15856
|
}
|
|
@@ -15657,7 +16064,7 @@ async function removeCreatedFiles(files) {
|
|
|
15657
16064
|
* @returns The file as it now stands, and how to keep or undo the write.
|
|
15658
16065
|
*/
|
|
15659
16066
|
async function applyWrite(space, filePath, content, baseUpdatedAt) {
|
|
15660
|
-
const target = await space.absolutePathOf(filePath);
|
|
16067
|
+
const target = await space.absolutePathOf(filePath, "file");
|
|
15661
16068
|
const existed = await exists$1(target);
|
|
15662
16069
|
const mode = (await fs.stat(target).catch(() => null))?.mode ?? 384;
|
|
15663
16070
|
const previous = await fs.readFile(target).catch(() => null);
|
|
@@ -15699,7 +16106,7 @@ async function applyWrite(space, filePath, content, baseUpdatedAt) {
|
|
|
15699
16106
|
* @returns How to keep or undo the creation.
|
|
15700
16107
|
*/
|
|
15701
16108
|
async function applyCreate(space, filePath, kind) {
|
|
15702
|
-
const target = await space.absolutePathOf(filePath);
|
|
16109
|
+
const target = await space.absolutePathOf(filePath, kind);
|
|
15703
16110
|
const folders = [...kind === "directory" && !await exists$1(target) ? [target] : [], ...await missingFolders(target)];
|
|
15704
16111
|
let written;
|
|
15705
16112
|
try {
|
|
@@ -15727,9 +16134,10 @@ async function applyCreate(space, filePath, kind) {
|
|
|
15727
16134
|
*/
|
|
15728
16135
|
async function applyRename(space, from, to) {
|
|
15729
16136
|
const source = await space.absolutePathOf(from);
|
|
15730
|
-
const
|
|
16137
|
+
const stat = await fs.lstat(source).catch(() => null);
|
|
16138
|
+
const target = await space.absolutePathOf(to, stat?.isDirectory() ? "directory" : "file");
|
|
15731
16139
|
const created = await missingFolders(target);
|
|
15732
|
-
const moved =
|
|
16140
|
+
const moved = stat?.isFile() ? await hashOf(source) : null;
|
|
15733
16141
|
try {
|
|
15734
16142
|
await space.rename(from, to);
|
|
15735
16143
|
} catch (error) {
|
|
@@ -16703,7 +17111,7 @@ async function refuseDevtoolConfig(host, space, ...paths) {
|
|
|
16703
17111
|
async function changeAsAgent(host, space, change) {
|
|
16704
17112
|
let outcome;
|
|
16705
17113
|
try {
|
|
16706
|
-
outcome = await host.changeAsAgent(space.id, change);
|
|
17114
|
+
outcome = await host.changeAsAgent(space.id, change, space.space);
|
|
16707
17115
|
} catch (error) {
|
|
16708
17116
|
throw new McpToolError(error instanceof Error ? error.message : String(error));
|
|
16709
17117
|
}
|
|
@@ -17406,23 +17814,97 @@ function serves(source, name) {
|
|
|
17406
17814
|
return source.include.some((glob) => path.matchesGlob(name, glob));
|
|
17407
17815
|
}
|
|
17408
17816
|
/**
|
|
17409
|
-
*
|
|
17410
|
-
* @param
|
|
17411
|
-
* @returns
|
|
17817
|
+
* Gives the filter of a folder of skills when it hides anything.
|
|
17818
|
+
* @param source The folder.
|
|
17819
|
+
* @returns The filter, null when every file of the folder is served.
|
|
17820
|
+
*/
|
|
17821
|
+
function filterOf(source) {
|
|
17822
|
+
return source.filter?.filtered ? source.filter : null;
|
|
17823
|
+
}
|
|
17824
|
+
/**
|
|
17825
|
+
* Tells whether the names of a path of an unfiltered folder of skills are served: `.git` never, and names starting
|
|
17826
|
+
* with a dot only when its folder of files shows hidden files.
|
|
17827
|
+
* @param source The folder of skills.
|
|
17828
|
+
* @param rest The names of the path in the folder.
|
|
17829
|
+
* @param kind Whether the path is a file or a folder.
|
|
17830
|
+
* @returns True when every name of the path is served.
|
|
17831
|
+
*/
|
|
17832
|
+
function namesServed(source, rest, kind) {
|
|
17833
|
+
if (!source.filter) return true;
|
|
17834
|
+
return kind === "directory" ? source.filter.showsFolder(rest.join("/")) : source.filter.showsFile(rest.join("/"));
|
|
17835
|
+
}
|
|
17836
|
+
/**
|
|
17837
|
+
* Tells whether a path of an unfiltered folder of skills is served, symbolic links followed: its names, and those of
|
|
17838
|
+
* what it leads to, relative to the folder when it lies in it, else the name of what it leads to.
|
|
17839
|
+
* @param source The folder of skills.
|
|
17840
|
+
* @param rest The names of the path in the folder.
|
|
17841
|
+
* @param kind Whether the path is a file or a folder.
|
|
17842
|
+
* @returns True when the path and what it leads to are served, false when it leads nowhere.
|
|
17843
|
+
*/
|
|
17844
|
+
async function targetServed(source, rest, kind) {
|
|
17845
|
+
if (!namesServed(source, rest, kind)) return false;
|
|
17846
|
+
if (!source.filter || rest.length === 0) return true;
|
|
17847
|
+
const reals = await Promise.all([fs.realpath(source.folder), fs.realpath(path.join(source.folder, ...rest))]).catch(() => null);
|
|
17848
|
+
if (!reals) return false;
|
|
17849
|
+
const relative = path.relative(reals[0], reals[1]);
|
|
17850
|
+
return namesServed(source, relative !== "" && relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative) ? relative.split(path.sep) : [path.basename(reals[1])], kind);
|
|
17851
|
+
}
|
|
17852
|
+
/**
|
|
17853
|
+
* Lists a folder of an unfiltered folder of skills, symbolic links followed, leaving out the paths it does not serve.
|
|
17854
|
+
* @param source The folder of skills.
|
|
17855
|
+
* @param rest The names of the folder listed in the folder of skills, none for its root.
|
|
17856
|
+
* @returns Its children, none when it does not exist or is not served.
|
|
17412
17857
|
*/
|
|
17413
|
-
async function listFolder(
|
|
17858
|
+
async function listFolder(source, rest) {
|
|
17859
|
+
if (!await targetServed(source, rest, "directory")) return [];
|
|
17860
|
+
const folder = path.join(source.folder, ...rest);
|
|
17414
17861
|
const dirents = await fs.readdir(folder, { withFileTypes: true }).catch(() => []);
|
|
17415
|
-
return Promise.all(dirents.map(async (dirent) => {
|
|
17862
|
+
return (await Promise.all(dirents.map(async (dirent) => {
|
|
17416
17863
|
const stat = dirent.isSymbolicLink() ? await fs.stat(path.join(folder, dirent.name)).catch(() => null) : dirent;
|
|
17417
|
-
|
|
17864
|
+
const entry = {
|
|
17418
17865
|
name: dirent.name,
|
|
17419
17866
|
kind: stat?.isDirectory() ? "directory" : stat?.isFile() ? "file" : "unsupported"
|
|
17420
17867
|
};
|
|
17421
|
-
|
|
17868
|
+
return await targetServed(source, [...rest, entry.name], entry.kind === "directory" ? "directory" : "file") ? entry : null;
|
|
17869
|
+
}))).filter((entry) => entry !== null);
|
|
17870
|
+
}
|
|
17871
|
+
/**
|
|
17872
|
+
* Gives a path of a filtered folder of skills as it lies on the disk, when the filter shows it.
|
|
17873
|
+
* @param source The folder of skills.
|
|
17874
|
+
* @param filter Its filter.
|
|
17875
|
+
* @param rest The names of the path in the folder.
|
|
17876
|
+
* @param kind Whether the path is a file or a folder.
|
|
17877
|
+
* @returns The path relative to the folder, null when it is not a plain relative path, is not shown or goes through
|
|
17878
|
+
* a symbolic link.
|
|
17879
|
+
*/
|
|
17880
|
+
async function shownPath(source, filter, rest, kind) {
|
|
17881
|
+
return (await resolveShownPath(source.folder, rest.join("/"), filter, kind)).path;
|
|
17882
|
+
}
|
|
17883
|
+
/**
|
|
17884
|
+
* Lists what a filtered folder of skills shows in one of its folders, symbolic links left out.
|
|
17885
|
+
* @param source The folder of skills.
|
|
17886
|
+
* @param filter Its filter.
|
|
17887
|
+
* @param rest The names of the folder listed in the folder of skills, none for its root.
|
|
17888
|
+
* @returns The files and folders shown, none when the folder is not shown or does not exist.
|
|
17889
|
+
*/
|
|
17890
|
+
async function listShown(source, filter, rest) {
|
|
17891
|
+
const folder = rest.length > 0 ? await shownPath(source, filter, rest, "directory") : "";
|
|
17892
|
+
if (folder === null) return [];
|
|
17893
|
+
return (await fs.readdir(path.join(source.folder, folder), { withFileTypes: true }).catch(() => [])).flatMap((dirent) => {
|
|
17894
|
+
const entryPath = folder ? `${folder}/${dirent.name}` : dirent.name;
|
|
17895
|
+
if (dirent.isDirectory() && filter.showsFolder(entryPath)) return [{
|
|
17896
|
+
name: dirent.name,
|
|
17897
|
+
kind: "directory"
|
|
17898
|
+
}];
|
|
17899
|
+
return dirent.isFile() && filter.showsFile(entryPath) ? [{
|
|
17900
|
+
name: dirent.name,
|
|
17901
|
+
kind: "file"
|
|
17902
|
+
}] : [];
|
|
17903
|
+
});
|
|
17422
17904
|
}
|
|
17423
17905
|
/**
|
|
17424
17906
|
* Gives the storage of a skills catalog joining folders of skills under their prefixes, each showing
|
|
17425
|
-
* only the skill folders it serves.
|
|
17907
|
+
* only the skill folders it serves and, when it filters, only the files and folders its filter shows.
|
|
17426
17908
|
* @param folders Gives the folders, read again on every access.
|
|
17427
17909
|
* @returns The storage.
|
|
17428
17910
|
*/
|
|
@@ -17451,14 +17933,17 @@ function joinedSkillFiles(folders) {
|
|
|
17451
17933
|
}
|
|
17452
17934
|
for (const { source, rest } of locate(dir)) {
|
|
17453
17935
|
if (rest.length > 0 && !serves(source, rest[0])) continue;
|
|
17454
|
-
|
|
17936
|
+
const filter = filterOf(source);
|
|
17937
|
+
for (const entry of filter ? await listShown(source, filter, rest) : await listFolder(source, rest)) if (rest.length > 0 || entry.kind === "directory" && serves(source, entry.name)) entries.set(entry.name, entry);
|
|
17455
17938
|
}
|
|
17456
17939
|
return [...entries.values()];
|
|
17457
17940
|
},
|
|
17458
17941
|
async read(file) {
|
|
17459
17942
|
const found = locate(file).find(({ source, rest }) => rest.length > 1 && serves(source, rest[0]));
|
|
17460
|
-
|
|
17461
|
-
|
|
17943
|
+
const filter = found ? filterOf(found.source) : null;
|
|
17944
|
+
const shown = found && filter ? await shownPath(found.source, filter, found.rest, "file") : found && await targetServed(found.source, found.rest, "file") ? found.rest.join("/") : null;
|
|
17945
|
+
if (!found || shown === null) throw new Error(`${file} is not a file of a served skill`);
|
|
17946
|
+
return fs.readFile(path.join(found.source.folder, shown));
|
|
17462
17947
|
}
|
|
17463
17948
|
};
|
|
17464
17949
|
}
|
|
@@ -18334,21 +18819,23 @@ var DevtoolMcp = class {
|
|
|
18334
18819
|
setInterval(() => this.closeIdleSessions(), SESSION_SWEEP_MS).unref();
|
|
18335
18820
|
}
|
|
18336
18821
|
/**
|
|
18337
|
-
* Applies the configuration:
|
|
18338
|
-
* is
|
|
18822
|
+
* Applies the configuration: the skills it serves, given their folders and filters before anything is waited
|
|
18823
|
+
* for so that no skill is served under the rules replaced, then its rules, every session closed when the
|
|
18824
|
+
* server is disabled.
|
|
18339
18825
|
*/
|
|
18340
18826
|
async configure() {
|
|
18341
18827
|
const { adt, projects } = this._host.config;
|
|
18342
|
-
|
|
18343
|
-
await this._skills.configure([...adt.mcp.skills ? [{
|
|
18828
|
+
const skills = this._skills.configure([...adt.mcp.skills ? [{
|
|
18344
18829
|
prefix: "devtool",
|
|
18345
18830
|
folder: this._host.skillsFolder,
|
|
18346
18831
|
include: ["*"]
|
|
18347
18832
|
}] : [], ...Object.values(projects).flatMap((project) => Object.values(project.directories).flatMap((directory) => Object.values(directory.files).flatMap((files) => files.mcpSkills ? [{
|
|
18348
18833
|
prefix: `files/${project.slug}/${directory.slug}/${files.slug}`,
|
|
18349
18834
|
folder: files.path,
|
|
18350
|
-
include: files.mcpSkills
|
|
18835
|
+
include: files.mcpSkills,
|
|
18836
|
+
filter: new FileFilter(files)
|
|
18351
18837
|
}] : [])))]);
|
|
18838
|
+
await Promise.all([skills, this.approvals.configure(adt.mcp, adt.cacheDir)]);
|
|
18352
18839
|
if (!adt.mcp.enabled) await Promise.all([...this._sessions.values()].map((session) => session.transport.close()));
|
|
18353
18840
|
}
|
|
18354
18841
|
/**
|
|
@@ -19352,6 +19839,10 @@ var DevtoolServer = class DevtoolServer {
|
|
|
19352
19839
|
this.streamResize(message.data);
|
|
19353
19840
|
return;
|
|
19354
19841
|
}
|
|
19842
|
+
if (message.type === "streamClear") {
|
|
19843
|
+
await this.commandStreams.find((item) => item.slug === message.data.streamSlug)?.clearOutput();
|
|
19844
|
+
return;
|
|
19845
|
+
}
|
|
19355
19846
|
logger.warn("Server", "WS", `Unknown message type ${type}`);
|
|
19356
19847
|
ws.send(JSON.stringify({
|
|
19357
19848
|
type: "error",
|
|
@@ -19389,9 +19880,10 @@ var DevtoolServer = class DevtoolServer {
|
|
|
19389
19880
|
} : tree, ws);
|
|
19390
19881
|
}
|
|
19391
19882
|
/**
|
|
19392
|
-
* Writes a file
|
|
19393
|
-
*
|
|
19394
|
-
*
|
|
19883
|
+
* Writes a file through its space as it stands once the write runs in turn, and reads the configuration again
|
|
19884
|
+
* when the files it is read from changed, applies it, a failure being reported, then sends the new state of the
|
|
19885
|
+
* file to the interface that asked and, once written, the files of its space to every interface before running
|
|
19886
|
+
* what the space does after a write.
|
|
19395
19887
|
* @param spaceId The identifier of the space.
|
|
19396
19888
|
* @param filePath The path of the file.
|
|
19397
19889
|
* @param content Its new content.
|
|
@@ -19399,8 +19891,8 @@ var DevtoolServer = class DevtoolServer {
|
|
|
19399
19891
|
* @param ws The connection of the interface.
|
|
19400
19892
|
*/
|
|
19401
19893
|
async writeFile(spaceId, filePath, content, baseUpdatedAt, ws) {
|
|
19402
|
-
const space = this.fileSpaces.get(spaceId);
|
|
19403
19894
|
const { file, reloaded } = await this.serializeFileChange(async () => {
|
|
19895
|
+
const space = this.fileSpaces.get(spaceId);
|
|
19404
19896
|
const before = await this.fileSpaces.configSnapshot();
|
|
19405
19897
|
const written = space ? await space.write(filePath, content, baseUpdatedAt) : unknownSpaceFile(spaceId, filePath);
|
|
19406
19898
|
return {
|
|
@@ -19470,16 +19962,20 @@ var DevtoolServer = class DevtoolServer {
|
|
|
19470
19962
|
});
|
|
19471
19963
|
}
|
|
19472
19964
|
/**
|
|
19473
|
-
* Changes the files and folders of a space for a person,
|
|
19474
|
-
* is read from changed and applies it, then sends
|
|
19965
|
+
* Changes the files and folders of a space for a person, through the space as it stands once the change runs
|
|
19966
|
+
* in turn, reads the configuration again when the files it is read from changed and applies it, then sends
|
|
19967
|
+
* the files of the space to every interface.
|
|
19475
19968
|
* @param spaceId The identifier of the space.
|
|
19476
19969
|
* @param change Changes the files of the space.
|
|
19477
19970
|
* @returns Why the change was refused, null once done.
|
|
19478
19971
|
*/
|
|
19479
19972
|
async changeFiles(spaceId, change) {
|
|
19480
|
-
const space = this.fileSpaces.get(spaceId);
|
|
19481
|
-
if (!space) return `${spaceId} is not a file space`;
|
|
19482
19973
|
const { error, reloaded } = await this.serializeFileChange(async () => {
|
|
19974
|
+
const space = this.fileSpaces.get(spaceId);
|
|
19975
|
+
if (!space) return {
|
|
19976
|
+
error: `${spaceId} is not a file space`,
|
|
19977
|
+
reloaded: false
|
|
19978
|
+
};
|
|
19483
19979
|
const before = await this.fileSpaces.configSnapshot();
|
|
19484
19980
|
try {
|
|
19485
19981
|
await change(space);
|
|
@@ -19499,20 +19995,24 @@ var DevtoolServer = class DevtoolServer {
|
|
|
19499
19995
|
return error;
|
|
19500
19996
|
}
|
|
19501
19997
|
/**
|
|
19502
|
-
* Makes a change of files of an agent in a space as agents see it,
|
|
19503
|
-
*
|
|
19504
|
-
*
|
|
19505
|
-
* that cannot be fully undone is shown as a warning
|
|
19998
|
+
* Makes a change of files of an agent in a space as agents see it, once the change runs in turn and only while the
|
|
19999
|
+
* space is still the one the change was allowed for, undone and refused when it changes the files the configuration
|
|
20000
|
+
* of the devtool is read from, the configuration then read again when the files restored differ from those read
|
|
20001
|
+
* last, and applied without the answer waiting for it; a change that cannot be fully undone is shown as a warning
|
|
20002
|
+
* of the configuration, naming the paths left.
|
|
19506
20003
|
* @param spaceId The identifier of the space.
|
|
19507
20004
|
* @param change The change.
|
|
20005
|
+
* @param allowed The space as it stood when the change was allowed.
|
|
19508
20006
|
* @returns The file written for a write, or the refusal once the change is undone.
|
|
19509
|
-
* @throws {Error} When the space is unknown, the change fails, or it cannot be
|
|
20007
|
+
* @throws {Error} When the space is unknown or was replaced by a reload since, the change fails, or it cannot be
|
|
20008
|
+
* undone.
|
|
19510
20009
|
*/
|
|
19511
|
-
async changeAsAgent(spaceId, change) {
|
|
19512
|
-
const space = this.fileSpaces.getForAgents(spaceId);
|
|
19513
|
-
if (!space) throw new Error(`${spaceId} is not a file space`);
|
|
20010
|
+
async changeAsAgent(spaceId, change, allowed) {
|
|
19514
20011
|
try {
|
|
19515
20012
|
const { outcome, reloaded } = await this.serializeFileChange(async () => {
|
|
20013
|
+
const space = this.fileSpaces.getForAgents(spaceId);
|
|
20014
|
+
if (!space) throw new Error(`${spaceId} is not a file space`);
|
|
20015
|
+
if (space !== allowed) throw new Error(`${spaceId} changed with the configuration since this change was allowed, ask for it again`);
|
|
19516
20016
|
const changed = await changeUnlessConfigChanges(async () => this.fileSpaces.configSnapshot(), async () => applyAgentChange(space, change));
|
|
19517
20017
|
return {
|
|
19518
20018
|
outcome: changed,
|
|
@@ -20128,7 +20628,7 @@ async function renewCertificates(names, configPaths = []) {
|
|
|
20128
20628
|
}
|
|
20129
20629
|
}
|
|
20130
20630
|
// package.json
|
|
20131
|
-
var version = "1.1.
|
|
20631
|
+
var version = "1.1.3";
|
|
20132
20632
|
// src/skills.ts
|
|
20133
20633
|
const MANIFEST = ".devtool-skills.json";
|
|
20134
20634
|
/**
|