agent-web-os 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +105 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -9
- package/dist/index.d.ts +0 -9
- package/dist/index.js +105 -54
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42349,19 +42349,6 @@ function assertObservableInMemoryFs(value) {
|
|
|
42349
42349
|
}
|
|
42350
42350
|
return value;
|
|
42351
42351
|
}
|
|
42352
|
-
function formatChangeEventForLog(event) {
|
|
42353
|
-
const previousPathSuffix = event.previousPath ? ` (from ${event.previousPath})` : "";
|
|
42354
|
-
return `[ObservableInMemoryFs] ${event.event} ${event.entryType} ${event.path}${previousPathSuffix}`;
|
|
42355
|
-
}
|
|
42356
|
-
function normalizeEntryType(stat) {
|
|
42357
|
-
if (stat.isDirectory) {
|
|
42358
|
-
return "directory";
|
|
42359
|
-
}
|
|
42360
|
-
if (stat.isSymbolicLink) {
|
|
42361
|
-
return "symlink";
|
|
42362
|
-
}
|
|
42363
|
-
return "file";
|
|
42364
|
-
}
|
|
42365
42352
|
async function readPathState(fs, path2) {
|
|
42366
42353
|
const exists = await fs.exists(path2);
|
|
42367
42354
|
if (!exists) {
|
|
@@ -42374,35 +42361,19 @@ async function readPathState(fs, path2) {
|
|
|
42374
42361
|
};
|
|
42375
42362
|
}
|
|
42376
42363
|
const stat = await fs.lstat(path2);
|
|
42364
|
+
const entryType = stat.isDirectory ? "directory" : stat.isSymbolicLink ? "symlink" : "file";
|
|
42377
42365
|
return {
|
|
42378
42366
|
exists: true,
|
|
42379
|
-
entryType
|
|
42367
|
+
entryType
|
|
42380
42368
|
};
|
|
42381
42369
|
}
|
|
42382
42370
|
function mapAddEvent(entryType) {
|
|
42383
42371
|
return entryType === "directory" ? "addDir" : "add";
|
|
42384
42372
|
}
|
|
42385
|
-
function mapUnlinkEvent(entryType) {
|
|
42386
|
-
return entryType === "directory" ? "unlinkDir" : "unlink";
|
|
42387
|
-
}
|
|
42388
42373
|
function normalizeFsPathForLogScope(fsPath) {
|
|
42389
42374
|
const normalized = posixPath.normalize(fsPath);
|
|
42390
42375
|
return normalized === "." ? "/" : normalized;
|
|
42391
42376
|
}
|
|
42392
|
-
function createWorkspacePathFilter(workspaceRoot) {
|
|
42393
|
-
const normalizedWorkspaceRoot = normalizeFsPathForLogScope(workspaceRoot);
|
|
42394
|
-
return (fsPath) => {
|
|
42395
|
-
const normalizedPath = normalizeFsPathForLogScope(fsPath);
|
|
42396
|
-
if (normalizedPath !== normalizedWorkspaceRoot && !normalizedPath.startsWith(`${normalizedWorkspaceRoot}/`)) {
|
|
42397
|
-
return false;
|
|
42398
|
-
}
|
|
42399
|
-
const relativePath = posixPath.relative(normalizedWorkspaceRoot, normalizedPath);
|
|
42400
|
-
if (!relativePath || relativePath === ".") {
|
|
42401
|
-
return true;
|
|
42402
|
-
}
|
|
42403
|
-
return relativePath.split("/").every((segment) => segment.length > 0 && !segment.startsWith("."));
|
|
42404
|
-
};
|
|
42405
|
-
}
|
|
42406
42377
|
var ObservableInMemoryFs = class extends Ir {
|
|
42407
42378
|
listeners;
|
|
42408
42379
|
lazyPaths = /* @__PURE__ */ new Set();
|
|
@@ -42414,7 +42385,18 @@ var ObservableInMemoryFs = class extends Ir {
|
|
|
42414
42385
|
constructor(options2) {
|
|
42415
42386
|
super();
|
|
42416
42387
|
this.consoleLogChanges = options2?.consoleLogChanges ?? false;
|
|
42417
|
-
|
|
42388
|
+
const normalizedWorkspaceRoot = normalizeFsPathForLogScope(options2?.workspaceRoot ?? "/");
|
|
42389
|
+
this.isLoggableWorkspacePath = (fsPath) => {
|
|
42390
|
+
const normalizedPath = normalizeFsPathForLogScope(fsPath);
|
|
42391
|
+
if (normalizedPath !== normalizedWorkspaceRoot && !normalizedPath.startsWith(`${normalizedWorkspaceRoot}/`)) {
|
|
42392
|
+
return false;
|
|
42393
|
+
}
|
|
42394
|
+
const relativePath = posixPath.relative(normalizedWorkspaceRoot, normalizedPath);
|
|
42395
|
+
if (!relativePath || relativePath === ".") {
|
|
42396
|
+
return true;
|
|
42397
|
+
}
|
|
42398
|
+
return relativePath.split("/").every((segment) => segment.length > 0 && !segment.startsWith("."));
|
|
42399
|
+
};
|
|
42418
42400
|
}
|
|
42419
42401
|
isPathLazy(filePath) {
|
|
42420
42402
|
return this.lazyPaths.has(normalizeFsPathForLogScope(filePath));
|
|
@@ -42486,7 +42468,7 @@ var ObservableInMemoryFs = class extends Ir {
|
|
|
42486
42468
|
emit(event, options2) {
|
|
42487
42469
|
const shouldConsoleLog = options2?.shouldConsoleLog ?? this.shouldConsoleLogChangeEvent(event);
|
|
42488
42470
|
if (this.consoleLogChanges && shouldConsoleLog && !this.areConsoleLogsSuppressed()) {
|
|
42489
|
-
console.log(
|
|
42471
|
+
console.log(`[ObservableInMemoryFs] ${event.event} ${event.entryType} ${event.path}${event.previousPath ? ` (from ${event.previousPath})` : ""}`);
|
|
42490
42472
|
}
|
|
42491
42473
|
if (!this.listeners) {
|
|
42492
42474
|
return;
|
|
@@ -42563,7 +42545,7 @@ var ObservableInMemoryFs = class extends Ir {
|
|
|
42563
42545
|
return;
|
|
42564
42546
|
}
|
|
42565
42547
|
this.emit({
|
|
42566
|
-
event:
|
|
42548
|
+
event: previous.entryType === "directory" ? "unlinkDir" : "unlink",
|
|
42567
42549
|
path: path2,
|
|
42568
42550
|
entryType: previous.entryType
|
|
42569
42551
|
}, options2);
|
|
@@ -60589,6 +60571,86 @@ var AlmostNodeSession = class {
|
|
|
60589
60571
|
constructor(fs) {
|
|
60590
60572
|
this.fs = fs;
|
|
60591
60573
|
this._vfs.mkdirSync(ALMOSTNODE_INTERNAL_ROOT, { recursive: true });
|
|
60574
|
+
this._vfs.mkdirSync("/node_modules/constants", { recursive: true });
|
|
60575
|
+
this._vfs.writeFileSync("/node_modules/constants/package.json", JSON.stringify({
|
|
60576
|
+
name: "constants",
|
|
60577
|
+
version: "0.0.1",
|
|
60578
|
+
main: "index.js"
|
|
60579
|
+
}));
|
|
60580
|
+
this._vfs.writeFileSync("/node_modules/constants/index.js", [
|
|
60581
|
+
"// Node.js `constants` shim (os.constants + fs.constants)",
|
|
60582
|
+
"var os = require('os');",
|
|
60583
|
+
"var constants = {};",
|
|
60584
|
+
"if (os.constants) {",
|
|
60585
|
+
" if (os.constants.signals) Object.assign(constants, os.constants.signals);",
|
|
60586
|
+
" if (os.constants.errno) Object.assign(constants, os.constants.errno);",
|
|
60587
|
+
" if (os.constants.priority) Object.assign(constants, os.constants.priority);",
|
|
60588
|
+
"}",
|
|
60589
|
+
"// Common fs.constants used by npm packages",
|
|
60590
|
+
"constants.O_RDONLY = 0;",
|
|
60591
|
+
"constants.O_WRONLY = 1;",
|
|
60592
|
+
"constants.O_RDWR = 2;",
|
|
60593
|
+
"constants.O_CREAT = 64;",
|
|
60594
|
+
"constants.O_EXCL = 128;",
|
|
60595
|
+
"constants.O_TRUNC = 512;",
|
|
60596
|
+
"constants.O_APPEND = 1024;",
|
|
60597
|
+
"constants.O_DIRECTORY = 65536;",
|
|
60598
|
+
"constants.O_NOFOLLOW = 131072;",
|
|
60599
|
+
"constants.O_SYNC = 1052672;",
|
|
60600
|
+
"constants.O_SYMLINK = 2097152;",
|
|
60601
|
+
"constants.O_NONBLOCK = 2048;",
|
|
60602
|
+
"constants.S_IFMT = 61440;",
|
|
60603
|
+
"constants.S_IFREG = 32768;",
|
|
60604
|
+
"constants.S_IFDIR = 16384;",
|
|
60605
|
+
"constants.S_IFCHR = 8192;",
|
|
60606
|
+
"constants.S_IFBLK = 24576;",
|
|
60607
|
+
"constants.S_IFIFO = 4096;",
|
|
60608
|
+
"constants.S_IFLNK = 40960;",
|
|
60609
|
+
"constants.S_IFSOCK = 49152;",
|
|
60610
|
+
"constants.S_IRWXU = 448;",
|
|
60611
|
+
"constants.S_IRUSR = 256;",
|
|
60612
|
+
"constants.S_IWUSR = 128;",
|
|
60613
|
+
"constants.S_IXUSR = 64;",
|
|
60614
|
+
"constants.S_IRWXG = 56;",
|
|
60615
|
+
"constants.S_IRGRP = 32;",
|
|
60616
|
+
"constants.S_IWGRP = 16;",
|
|
60617
|
+
"constants.S_IXGRP = 8;",
|
|
60618
|
+
"constants.S_IRWXO = 7;",
|
|
60619
|
+
"constants.S_IROTH = 4;",
|
|
60620
|
+
"constants.S_IWOTH = 2;",
|
|
60621
|
+
"constants.S_IXOTH = 1;",
|
|
60622
|
+
"constants.F_OK = 0;",
|
|
60623
|
+
"constants.R_OK = 4;",
|
|
60624
|
+
"constants.W_OK = 2;",
|
|
60625
|
+
"constants.X_OK = 1;",
|
|
60626
|
+
"constants.COPYFILE_EXCL = 1;",
|
|
60627
|
+
"constants.COPYFILE_FICLONE = 2;",
|
|
60628
|
+
"constants.COPYFILE_FICLONE_FORCE = 4;",
|
|
60629
|
+
"constants.UV_FS_COPYFILE_EXCL = 1;",
|
|
60630
|
+
"constants.UV_FS_COPYFILE_FICLONE = 2;",
|
|
60631
|
+
"constants.UV_FS_COPYFILE_FICLONE_FORCE = 4;",
|
|
60632
|
+
"module.exports = constants;"
|
|
60633
|
+
].join("\n"));
|
|
60634
|
+
this._vfs.mkdirSync("/node_modules/stream", { recursive: true });
|
|
60635
|
+
this._vfs.writeFileSync("/node_modules/stream/package.json", JSON.stringify({
|
|
60636
|
+
name: "stream",
|
|
60637
|
+
version: "0.0.1",
|
|
60638
|
+
main: "index.js"
|
|
60639
|
+
}));
|
|
60640
|
+
this._vfs.writeFileSync(
|
|
60641
|
+
"/node_modules/stream/index.js",
|
|
60642
|
+
"module.exports = require('stream');"
|
|
60643
|
+
);
|
|
60644
|
+
this._vfs.mkdirSync("/node_modules/stream/promises", { recursive: true });
|
|
60645
|
+
this._vfs.writeFileSync("/node_modules/stream/promises/package.json", JSON.stringify({
|
|
60646
|
+
name: "stream-promises",
|
|
60647
|
+
version: "0.0.1",
|
|
60648
|
+
main: "index.js"
|
|
60649
|
+
}));
|
|
60650
|
+
this._vfs.writeFileSync(
|
|
60651
|
+
"/node_modules/stream/promises/index.js",
|
|
60652
|
+
"var stream = require('stream');\nmodule.exports = stream.promises || {};"
|
|
60653
|
+
);
|
|
60592
60654
|
this.disposeObservableSubscription = this.fs.subscribe((event) => {
|
|
60593
60655
|
void this.trackOperation((async () => {
|
|
60594
60656
|
if (!this.initialized || this.suppressObservableMirrorCount > 0) {
|
|
@@ -60661,14 +60723,6 @@ var AlmostNodeSession = class {
|
|
|
60661
60723
|
* package directory directly.
|
|
60662
60724
|
*/
|
|
60663
60725
|
resolveBarePkgEntryCache = /* @__PURE__ */ new Map();
|
|
60664
|
-
/**
|
|
60665
|
-
* Packages whose imports are handled by the browser import map.
|
|
60666
|
-
* These are NOT rewritten to /node_modules/... paths.
|
|
60667
|
-
* Now empty: react/react-dom are served from node_modules via our
|
|
60668
|
-
* CJS→ESM shim, which supports the actual installed version rather
|
|
60669
|
-
* than the outdated esm.sh CDN pinned in almostnode's import map.
|
|
60670
|
-
*/
|
|
60671
|
-
importMapPackages = /* @__PURE__ */ new Set();
|
|
60672
60726
|
parseCachedPackageJson(packageJsonPath, raw) {
|
|
60673
60727
|
const cached = this.parsedPackageJsonCache.get(packageJsonPath);
|
|
60674
60728
|
if (cached && cached.raw === raw) {
|
|
@@ -60717,7 +60771,6 @@ var AlmostNodeSession = class {
|
|
|
60717
60771
|
subPath = specifier.slice(slashIdx + 1);
|
|
60718
60772
|
}
|
|
60719
60773
|
}
|
|
60720
|
-
if (this.importMapPackages.has(pkgName)) return null;
|
|
60721
60774
|
const nodeModulesPath = `${root2}/node_modules/${pkgName}`;
|
|
60722
60775
|
const pkgJsonPath = `${nodeModulesPath}/package.json`;
|
|
60723
60776
|
let pkgJson = null;
|
|
@@ -61024,16 +61077,6 @@ var AlmostNodeSession = class {
|
|
|
61024
61077
|
}
|
|
61025
61078
|
return null;
|
|
61026
61079
|
}
|
|
61027
|
-
extractBinNames(pkgJson) {
|
|
61028
|
-
if (typeof pkgJson.bin === "string") {
|
|
61029
|
-
const name = typeof pkgJson.name === "string" ? pkgJson.name.split("/").pop() ?? "" : "";
|
|
61030
|
-
return name ? [name] : [];
|
|
61031
|
-
}
|
|
61032
|
-
if (typeof pkgJson.bin === "object" && pkgJson.bin !== null) {
|
|
61033
|
-
return Object.keys(pkgJson.bin);
|
|
61034
|
-
}
|
|
61035
|
-
return [];
|
|
61036
|
-
}
|
|
61037
61080
|
async registerGlobalBinCommands(packageName) {
|
|
61038
61081
|
if (!this.binCommandRegistrar) return;
|
|
61039
61082
|
const pkgJsonPath = normalizePath(posixPath.join(GLOBAL_NODE_MODULES_ROOT, packageName, "package.json"));
|
|
@@ -61042,7 +61085,15 @@ var AlmostNodeSession = class {
|
|
|
61042
61085
|
const raw = this._vfs.readFileSync(pkgJsonPath, "utf8");
|
|
61043
61086
|
const pkgJson = this.parseCachedPackageJson(pkgJsonPath, raw);
|
|
61044
61087
|
if (!pkgJson) return;
|
|
61045
|
-
|
|
61088
|
+
let binNames;
|
|
61089
|
+
if (typeof pkgJson.bin === "string") {
|
|
61090
|
+
const name = typeof pkgJson.name === "string" ? pkgJson.name.split("/").pop() ?? "" : "";
|
|
61091
|
+
binNames = name ? [name] : [];
|
|
61092
|
+
} else if (typeof pkgJson.bin === "object" && pkgJson.bin !== null) {
|
|
61093
|
+
binNames = Object.keys(pkgJson.bin);
|
|
61094
|
+
} else {
|
|
61095
|
+
binNames = [];
|
|
61096
|
+
}
|
|
61046
61097
|
for (const binName of binNames) {
|
|
61047
61098
|
if (this.registeredBinCommands.has(binName)) continue;
|
|
61048
61099
|
this.registeredBinCommands.add(binName);
|