windows-development-sandbox 1.15.0 → 1.17.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/config.example.json +6 -0
- package/dist/app/features/access/access.run.js +1 -1
- package/dist/app/features/accounts/accounts.def.js +4 -3
- package/dist/app/features/defs.d.ts +3 -1
- package/dist/app/features/defs.js +26 -12
- package/dist/app/features/sandbox/sandbox.def.js +9 -5
- package/dist/app/features/sessions/sessions.def.js +1 -1
- package/dist/bin/agent-sandbox.js +2 -2
- package/dist/bin/{chunk-HTQT5SBY.js → chunk-QLGGAG3D.js} +98 -79
- package/dist/bin/{chunk-D7CM63BS.js → chunk-REE3EMHD.js} +105 -41
- package/dist/bin/{chunk-RQ4BWBYX.js → chunk-XYUVIVJT.js} +1 -1
- package/dist/bin/claude-host.js +2 -2
- package/dist/bin/claude-sbx.js +2 -2
- package/dist/bin/codex-sbx.js +2 -2
- package/dist/bin/gemini-sbx.js +2 -2
- package/dist/bin/sandbox.js +2 -2
- package/dist/bin/sbx-hide.js +2 -2
- package/dist/bin/sbx-show.js +2 -2
- package/dist/cli/commands/web.js +1 -1
- package/dist/cli/index.js +4 -1
- package/dist/cli/report.d.ts +7 -0
- package/dist/cli/report.js +31 -0
- package/dist/core/config/defaults.js +1 -0
- package/dist/core/detect/toolchains.d.ts +1 -0
- package/dist/core/detect/toolchains.js +7 -0
- package/dist/core/schema/config.d.ts +21 -0
- package/dist/core/schema/sandbox.js +1 -1
- package/dist/core/schema/toolchains.d.ts +6 -0
- package/dist/core/schema/toolchains.js +10 -0
- package/dist/guest/boot/boot.js +2 -0
- package/dist/guest/setup/browser-gpu.d.ts +1 -0
- package/dist/guest/setup/browser-gpu.js +18 -0
- package/dist/guest/toolchains/native/rust-extras.js +3 -1
- package/dist/guest/toolchains/native/unreal.d.ts +9 -0
- package/dist/guest/toolchains/native/unreal.js +186 -0
- package/dist/guest/toolchains/native/vcruntime.d.ts +3 -0
- package/dist/guest/toolchains/native/vcruntime.js +2 -2
- package/dist/guest/toolchains/plan.js +10 -2
- package/dist/host/engines/hcs/live-folders.js +1 -1
- package/dist/host/github/token.js +1 -1
- package/dist/host/profile/accounts.js +1 -1
- package/dist/host/profile/agent-accounts.js +1 -1
- package/dist/host/profile/plugin-share.d.ts +5 -0
- package/dist/host/profile/plugin-share.js +22 -1
- package/dist/host/secrets/secret-store.d.ts +3 -3
- package/dist/host/secrets/secret-store.js +37 -10
- package/dist/host/vpn/login.js +1 -1
- package/dist/runtime/agent.js +16 -1
- package/dist/runtime/daemon.js +522 -337
- package/dist/runtime/db.js +17 -1
- package/dist/runtime/main.js +669 -472
- package/dist/runtime/netproxy.js +16 -1
- package/dist/runtime/view.js +16 -1
- package/dist/selftest/accounts.test.js +29 -0
- package/dist/selftest/app.test.js +2 -2
- package/dist/selftest/detect.test.js +7 -0
- package/dist/selftest/live-network.test.js +5 -0
- package/dist/selftest/support/fixtures.d.ts +6 -0
- package/dist/shared/channel/schema.d.ts +18 -0
- package/dist/web/index.html +2 -2
- package/dist/web/main-JTH3FT4O.js +221 -0
- package/dist/web/{main-UAQPI5XD.css → main-XT7T6ODM.css} +1 -1
- package/native/csharp/HcsHost/AssemblyInfo.cs +3 -3
- package/native/csharp/HostTools/AssemblyInfo.cs +3 -3
- package/native/csharp/HostTools/Program.cs +6 -1
- package/native/csharp/HostTools/Protect.cs +41 -0
- package/native/csharp/StorageHelper/AssemblyInfo.cs +3 -3
- package/package.json +1 -1
- package/schemas/config.schema.json +34 -1
- package/schemas/sandbox-config.schema.json +34 -1
- package/dist/web/main-7DJZ2M27.js +0 -221
package/dist/runtime/daemon.js
CHANGED
|
@@ -1363,11 +1363,11 @@ var require_lodash = __commonJS({
|
|
|
1363
1363
|
return isFunction(object2[key2]);
|
|
1364
1364
|
});
|
|
1365
1365
|
}
|
|
1366
|
-
function baseGet(object2,
|
|
1367
|
-
|
|
1368
|
-
var index = 0, length =
|
|
1366
|
+
function baseGet(object2, path73) {
|
|
1367
|
+
path73 = castPath(path73, object2);
|
|
1368
|
+
var index = 0, length = path73.length;
|
|
1369
1369
|
while (object2 != null && index < length) {
|
|
1370
|
-
object2 = object2[toKey(
|
|
1370
|
+
object2 = object2[toKey(path73[index++])];
|
|
1371
1371
|
}
|
|
1372
1372
|
return index && index == length ? object2 : undefined2;
|
|
1373
1373
|
}
|
|
@@ -1431,10 +1431,10 @@ var require_lodash = __commonJS({
|
|
|
1431
1431
|
});
|
|
1432
1432
|
return accumulator;
|
|
1433
1433
|
}
|
|
1434
|
-
function baseInvoke(object2,
|
|
1435
|
-
|
|
1436
|
-
object2 = parent(object2,
|
|
1437
|
-
var func = object2 == null ? object2 : object2[toKey(last(
|
|
1434
|
+
function baseInvoke(object2, path73, args) {
|
|
1435
|
+
path73 = castPath(path73, object2);
|
|
1436
|
+
object2 = parent(object2, path73);
|
|
1437
|
+
var func = object2 == null ? object2 : object2[toKey(last(path73))];
|
|
1438
1438
|
return func == null ? undefined2 : apply(func, object2, args);
|
|
1439
1439
|
}
|
|
1440
1440
|
function baseIsArguments(value) {
|
|
@@ -1590,13 +1590,13 @@ var require_lodash = __commonJS({
|
|
|
1590
1590
|
return object2 === source || baseIsMatch(object2, source, matchData);
|
|
1591
1591
|
};
|
|
1592
1592
|
}
|
|
1593
|
-
function baseMatchesProperty(
|
|
1594
|
-
if (isKey(
|
|
1595
|
-
return matchesStrictComparable(toKey(
|
|
1593
|
+
function baseMatchesProperty(path73, srcValue) {
|
|
1594
|
+
if (isKey(path73) && isStrictComparable(srcValue)) {
|
|
1595
|
+
return matchesStrictComparable(toKey(path73), srcValue);
|
|
1596
1596
|
}
|
|
1597
1597
|
return function(object2) {
|
|
1598
|
-
var objValue = get(object2,
|
|
1599
|
-
return objValue === undefined2 && objValue === srcValue ? hasIn(object2,
|
|
1598
|
+
var objValue = get(object2, path73);
|
|
1599
|
+
return objValue === undefined2 && objValue === srcValue ? hasIn(object2, path73) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
1600
1600
|
};
|
|
1601
1601
|
}
|
|
1602
1602
|
function baseMerge(object2, source, srcIndex, customizer, stack) {
|
|
@@ -1693,23 +1693,23 @@ var require_lodash = __commonJS({
|
|
|
1693
1693
|
});
|
|
1694
1694
|
}
|
|
1695
1695
|
function basePick(object2, paths) {
|
|
1696
|
-
return basePickBy(object2, paths, function(value,
|
|
1697
|
-
return hasIn(object2,
|
|
1696
|
+
return basePickBy(object2, paths, function(value, path73) {
|
|
1697
|
+
return hasIn(object2, path73);
|
|
1698
1698
|
});
|
|
1699
1699
|
}
|
|
1700
1700
|
function basePickBy(object2, paths, predicate) {
|
|
1701
1701
|
var index = -1, length = paths.length, result2 = {};
|
|
1702
1702
|
while (++index < length) {
|
|
1703
|
-
var
|
|
1704
|
-
if (predicate(value,
|
|
1705
|
-
baseSet(result2, castPath(
|
|
1703
|
+
var path73 = paths[index], value = baseGet(object2, path73);
|
|
1704
|
+
if (predicate(value, path73)) {
|
|
1705
|
+
baseSet(result2, castPath(path73, object2), value);
|
|
1706
1706
|
}
|
|
1707
1707
|
}
|
|
1708
1708
|
return result2;
|
|
1709
1709
|
}
|
|
1710
|
-
function basePropertyDeep(
|
|
1710
|
+
function basePropertyDeep(path73) {
|
|
1711
1711
|
return function(object2) {
|
|
1712
|
-
return baseGet(object2,
|
|
1712
|
+
return baseGet(object2, path73);
|
|
1713
1713
|
};
|
|
1714
1714
|
}
|
|
1715
1715
|
function basePullAll(array2, values2, iteratee2, comparator) {
|
|
@@ -1783,14 +1783,14 @@ var require_lodash = __commonJS({
|
|
|
1783
1783
|
var array2 = values(collection);
|
|
1784
1784
|
return shuffleSelf(array2, baseClamp(n, 0, array2.length));
|
|
1785
1785
|
}
|
|
1786
|
-
function baseSet(object2,
|
|
1786
|
+
function baseSet(object2, path73, value, customizer) {
|
|
1787
1787
|
if (!isObject2(object2)) {
|
|
1788
1788
|
return object2;
|
|
1789
1789
|
}
|
|
1790
|
-
|
|
1791
|
-
var index = -1, length =
|
|
1790
|
+
path73 = castPath(path73, object2);
|
|
1791
|
+
var index = -1, length = path73.length, lastIndex = length - 1, nested = object2;
|
|
1792
1792
|
while (nested != null && ++index < length) {
|
|
1793
|
-
var key2 = toKey(
|
|
1793
|
+
var key2 = toKey(path73[index]), newValue = value;
|
|
1794
1794
|
if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") {
|
|
1795
1795
|
return object2;
|
|
1796
1796
|
}
|
|
@@ -1798,7 +1798,7 @@ var require_lodash = __commonJS({
|
|
|
1798
1798
|
var objValue = nested[key2];
|
|
1799
1799
|
newValue = customizer ? customizer(objValue, key2, nested) : undefined2;
|
|
1800
1800
|
if (newValue === undefined2) {
|
|
1801
|
-
newValue = isObject2(objValue) ? objValue : isIndex(
|
|
1801
|
+
newValue = isObject2(objValue) ? objValue : isIndex(path73[index + 1]) ? [] : {};
|
|
1802
1802
|
}
|
|
1803
1803
|
}
|
|
1804
1804
|
assignValue(nested, key2, newValue);
|
|
@@ -1964,14 +1964,14 @@ var require_lodash = __commonJS({
|
|
|
1964
1964
|
}
|
|
1965
1965
|
return result2;
|
|
1966
1966
|
}
|
|
1967
|
-
function baseUnset(object2,
|
|
1968
|
-
|
|
1969
|
-
var index = -1, length =
|
|
1967
|
+
function baseUnset(object2, path73) {
|
|
1968
|
+
path73 = castPath(path73, object2);
|
|
1969
|
+
var index = -1, length = path73.length;
|
|
1970
1970
|
if (!length) {
|
|
1971
1971
|
return true;
|
|
1972
1972
|
}
|
|
1973
1973
|
while (++index < length) {
|
|
1974
|
-
var key2 = toKey(
|
|
1974
|
+
var key2 = toKey(path73[index]);
|
|
1975
1975
|
if (key2 === "__proto__" && !hasOwnProperty.call(object2, "__proto__")) {
|
|
1976
1976
|
return false;
|
|
1977
1977
|
}
|
|
@@ -1979,11 +1979,11 @@ var require_lodash = __commonJS({
|
|
|
1979
1979
|
return false;
|
|
1980
1980
|
}
|
|
1981
1981
|
}
|
|
1982
|
-
var obj = parent(object2,
|
|
1983
|
-
return obj == null || delete obj[toKey(last(
|
|
1982
|
+
var obj = parent(object2, path73);
|
|
1983
|
+
return obj == null || delete obj[toKey(last(path73))];
|
|
1984
1984
|
}
|
|
1985
|
-
function baseUpdate(object2,
|
|
1986
|
-
return baseSet(object2,
|
|
1985
|
+
function baseUpdate(object2, path73, updater, customizer) {
|
|
1986
|
+
return baseSet(object2, path73, updater(baseGet(object2, path73)), customizer);
|
|
1987
1987
|
}
|
|
1988
1988
|
function baseWhile(array2, predicate, isDrop, fromRight) {
|
|
1989
1989
|
var length = array2.length, index = fromRight ? length : -1;
|
|
@@ -2866,11 +2866,11 @@ var require_lodash = __commonJS({
|
|
|
2866
2866
|
var match = source.match(reWrapDetails);
|
|
2867
2867
|
return match ? match[1].split(reSplitDetails) : [];
|
|
2868
2868
|
}
|
|
2869
|
-
function hasPath(object2,
|
|
2870
|
-
|
|
2871
|
-
var index = -1, length =
|
|
2869
|
+
function hasPath(object2, path73, hasFunc) {
|
|
2870
|
+
path73 = castPath(path73, object2);
|
|
2871
|
+
var index = -1, length = path73.length, result2 = false;
|
|
2872
2872
|
while (++index < length) {
|
|
2873
|
-
var key2 = toKey(
|
|
2873
|
+
var key2 = toKey(path73[index]);
|
|
2874
2874
|
if (!(result2 = object2 != null && hasFunc(object2, key2))) {
|
|
2875
2875
|
break;
|
|
2876
2876
|
}
|
|
@@ -3072,8 +3072,8 @@ var require_lodash = __commonJS({
|
|
|
3072
3072
|
return apply(func, this, otherArgs);
|
|
3073
3073
|
};
|
|
3074
3074
|
}
|
|
3075
|
-
function parent(object2,
|
|
3076
|
-
return
|
|
3075
|
+
function parent(object2, path73) {
|
|
3076
|
+
return path73.length < 2 ? object2 : baseGet(object2, baseSlice(path73, 0, -1));
|
|
3077
3077
|
}
|
|
3078
3078
|
function reorder(array2, indexes) {
|
|
3079
3079
|
var arrLength = array2.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array2);
|
|
@@ -3708,10 +3708,10 @@ var require_lodash = __commonJS({
|
|
|
3708
3708
|
}
|
|
3709
3709
|
return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
|
|
3710
3710
|
}
|
|
3711
|
-
var invokeMap = baseRest(function(collection,
|
|
3712
|
-
var index = -1, isFunc = typeof
|
|
3711
|
+
var invokeMap = baseRest(function(collection, path73, args) {
|
|
3712
|
+
var index = -1, isFunc = typeof path73 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
|
|
3713
3713
|
baseEach(collection, function(value) {
|
|
3714
|
-
result2[++index] = isFunc ? apply(
|
|
3714
|
+
result2[++index] = isFunc ? apply(path73, value, args) : baseInvoke(value, path73, args);
|
|
3715
3715
|
});
|
|
3716
3716
|
return result2;
|
|
3717
3717
|
});
|
|
@@ -4363,15 +4363,15 @@ var require_lodash = __commonJS({
|
|
|
4363
4363
|
function functionsIn(object2) {
|
|
4364
4364
|
return object2 == null ? [] : baseFunctions(object2, keysIn(object2));
|
|
4365
4365
|
}
|
|
4366
|
-
function get(object2,
|
|
4367
|
-
var result2 = object2 == null ? undefined2 : baseGet(object2,
|
|
4366
|
+
function get(object2, path73, defaultValue) {
|
|
4367
|
+
var result2 = object2 == null ? undefined2 : baseGet(object2, path73);
|
|
4368
4368
|
return result2 === undefined2 ? defaultValue : result2;
|
|
4369
4369
|
}
|
|
4370
|
-
function has(object2,
|
|
4371
|
-
return object2 != null && hasPath(object2,
|
|
4370
|
+
function has(object2, path73) {
|
|
4371
|
+
return object2 != null && hasPath(object2, path73, baseHas);
|
|
4372
4372
|
}
|
|
4373
|
-
function hasIn(object2,
|
|
4374
|
-
return object2 != null && hasPath(object2,
|
|
4373
|
+
function hasIn(object2, path73) {
|
|
4374
|
+
return object2 != null && hasPath(object2, path73, baseHasIn);
|
|
4375
4375
|
}
|
|
4376
4376
|
var invert = createInverter(function(result2, value, key2) {
|
|
4377
4377
|
if (value != null && typeof value.toString != "function") {
|
|
@@ -4424,10 +4424,10 @@ var require_lodash = __commonJS({
|
|
|
4424
4424
|
return result2;
|
|
4425
4425
|
}
|
|
4426
4426
|
var isDeep = false;
|
|
4427
|
-
paths = arrayMap(paths, function(
|
|
4428
|
-
|
|
4429
|
-
isDeep || (isDeep =
|
|
4430
|
-
return
|
|
4427
|
+
paths = arrayMap(paths, function(path73) {
|
|
4428
|
+
path73 = castPath(path73, object2);
|
|
4429
|
+
isDeep || (isDeep = path73.length > 1);
|
|
4430
|
+
return path73;
|
|
4431
4431
|
});
|
|
4432
4432
|
copyObject(object2, getAllKeysIn(object2), result2);
|
|
4433
4433
|
if (isDeep) {
|
|
@@ -4453,19 +4453,19 @@ var require_lodash = __commonJS({
|
|
|
4453
4453
|
return [prop];
|
|
4454
4454
|
});
|
|
4455
4455
|
predicate = getIteratee(predicate);
|
|
4456
|
-
return basePickBy(object2, props, function(value,
|
|
4457
|
-
return predicate(value,
|
|
4456
|
+
return basePickBy(object2, props, function(value, path73) {
|
|
4457
|
+
return predicate(value, path73[0]);
|
|
4458
4458
|
});
|
|
4459
4459
|
}
|
|
4460
|
-
function result(object2,
|
|
4461
|
-
|
|
4462
|
-
var index = -1, length =
|
|
4460
|
+
function result(object2, path73, defaultValue) {
|
|
4461
|
+
path73 = castPath(path73, object2);
|
|
4462
|
+
var index = -1, length = path73.length;
|
|
4463
4463
|
if (!length) {
|
|
4464
4464
|
length = 1;
|
|
4465
4465
|
object2 = undefined2;
|
|
4466
4466
|
}
|
|
4467
4467
|
while (++index < length) {
|
|
4468
|
-
var value = object2 == null ? undefined2 : object2[toKey(
|
|
4468
|
+
var value = object2 == null ? undefined2 : object2[toKey(path73[index])];
|
|
4469
4469
|
if (value === undefined2) {
|
|
4470
4470
|
index = length;
|
|
4471
4471
|
value = defaultValue;
|
|
@@ -4474,12 +4474,12 @@ var require_lodash = __commonJS({
|
|
|
4474
4474
|
}
|
|
4475
4475
|
return object2;
|
|
4476
4476
|
}
|
|
4477
|
-
function set2(object2,
|
|
4478
|
-
return object2 == null ? object2 : baseSet(object2,
|
|
4477
|
+
function set2(object2, path73, value) {
|
|
4478
|
+
return object2 == null ? object2 : baseSet(object2, path73, value);
|
|
4479
4479
|
}
|
|
4480
|
-
function setWith(object2,
|
|
4480
|
+
function setWith(object2, path73, value, customizer) {
|
|
4481
4481
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
4482
|
-
return object2 == null ? object2 : baseSet(object2,
|
|
4482
|
+
return object2 == null ? object2 : baseSet(object2, path73, value, customizer);
|
|
4483
4483
|
}
|
|
4484
4484
|
var toPairs = createToPairs(keys);
|
|
4485
4485
|
var toPairsIn = createToPairs(keysIn);
|
|
@@ -4501,15 +4501,15 @@ var require_lodash = __commonJS({
|
|
|
4501
4501
|
});
|
|
4502
4502
|
return accumulator;
|
|
4503
4503
|
}
|
|
4504
|
-
function unset(object2,
|
|
4505
|
-
return object2 == null ? true : baseUnset(object2,
|
|
4504
|
+
function unset(object2, path73) {
|
|
4505
|
+
return object2 == null ? true : baseUnset(object2, path73);
|
|
4506
4506
|
}
|
|
4507
|
-
function update(object2,
|
|
4508
|
-
return object2 == null ? object2 : baseUpdate(object2,
|
|
4507
|
+
function update(object2, path73, updater) {
|
|
4508
|
+
return object2 == null ? object2 : baseUpdate(object2, path73, castFunction(updater));
|
|
4509
4509
|
}
|
|
4510
|
-
function updateWith(object2,
|
|
4510
|
+
function updateWith(object2, path73, updater, customizer) {
|
|
4511
4511
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
4512
|
-
return object2 == null ? object2 : baseUpdate(object2,
|
|
4512
|
+
return object2 == null ? object2 : baseUpdate(object2, path73, castFunction(updater), customizer);
|
|
4513
4513
|
}
|
|
4514
4514
|
function values(object2) {
|
|
4515
4515
|
return object2 == null ? [] : baseValues(object2, keys(object2));
|
|
@@ -4895,17 +4895,17 @@ var require_lodash = __commonJS({
|
|
|
4895
4895
|
function matches(source) {
|
|
4896
4896
|
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
|
|
4897
4897
|
}
|
|
4898
|
-
function matchesProperty(
|
|
4899
|
-
return baseMatchesProperty(
|
|
4898
|
+
function matchesProperty(path73, srcValue) {
|
|
4899
|
+
return baseMatchesProperty(path73, baseClone(srcValue, CLONE_DEEP_FLAG));
|
|
4900
4900
|
}
|
|
4901
|
-
var method = baseRest(function(
|
|
4901
|
+
var method = baseRest(function(path73, args) {
|
|
4902
4902
|
return function(object2) {
|
|
4903
|
-
return baseInvoke(object2,
|
|
4903
|
+
return baseInvoke(object2, path73, args);
|
|
4904
4904
|
};
|
|
4905
4905
|
});
|
|
4906
4906
|
var methodOf = baseRest(function(object2, args) {
|
|
4907
|
-
return function(
|
|
4908
|
-
return baseInvoke(object2,
|
|
4907
|
+
return function(path73) {
|
|
4908
|
+
return baseInvoke(object2, path73, args);
|
|
4909
4909
|
};
|
|
4910
4910
|
});
|
|
4911
4911
|
function mixin(object2, source, options) {
|
|
@@ -4952,12 +4952,12 @@ var require_lodash = __commonJS({
|
|
|
4952
4952
|
var over = createOver(arrayMap);
|
|
4953
4953
|
var overEvery = createOver(arrayEvery);
|
|
4954
4954
|
var overSome = createOver(arraySome);
|
|
4955
|
-
function property(
|
|
4956
|
-
return isKey(
|
|
4955
|
+
function property(path73) {
|
|
4956
|
+
return isKey(path73) ? baseProperty(toKey(path73)) : basePropertyDeep(path73);
|
|
4957
4957
|
}
|
|
4958
4958
|
function propertyOf(object2) {
|
|
4959
|
-
return function(
|
|
4960
|
-
return object2 == null ? undefined2 : baseGet(object2,
|
|
4959
|
+
return function(path73) {
|
|
4960
|
+
return object2 == null ? undefined2 : baseGet(object2, path73);
|
|
4961
4961
|
};
|
|
4962
4962
|
}
|
|
4963
4963
|
var range = createRange();
|
|
@@ -5410,12 +5410,12 @@ var require_lodash = __commonJS({
|
|
|
5410
5410
|
LazyWrapper.prototype.findLast = function(predicate) {
|
|
5411
5411
|
return this.reverse().find(predicate);
|
|
5412
5412
|
};
|
|
5413
|
-
LazyWrapper.prototype.invokeMap = baseRest(function(
|
|
5414
|
-
if (typeof
|
|
5413
|
+
LazyWrapper.prototype.invokeMap = baseRest(function(path73, args) {
|
|
5414
|
+
if (typeof path73 == "function") {
|
|
5415
5415
|
return new LazyWrapper(this);
|
|
5416
5416
|
}
|
|
5417
5417
|
return this.map(function(value) {
|
|
5418
|
-
return baseInvoke(value,
|
|
5418
|
+
return baseInvoke(value, path73, args);
|
|
5419
5419
|
});
|
|
5420
5420
|
});
|
|
5421
5421
|
LazyWrapper.prototype.reject = function(predicate) {
|
|
@@ -6366,10 +6366,10 @@ function mergeDefs(...defs) {
|
|
|
6366
6366
|
function cloneDef(schema) {
|
|
6367
6367
|
return mergeDefs(schema._zod.def);
|
|
6368
6368
|
}
|
|
6369
|
-
function getElementAtPath(obj,
|
|
6370
|
-
if (!
|
|
6369
|
+
function getElementAtPath(obj, path73) {
|
|
6370
|
+
if (!path73)
|
|
6371
6371
|
return obj;
|
|
6372
|
-
return
|
|
6372
|
+
return path73.reduce((acc, key2) => acc?.[key2], obj);
|
|
6373
6373
|
}
|
|
6374
6374
|
function promiseAllObject(promisesObj) {
|
|
6375
6375
|
const keys = Object.keys(promisesObj);
|
|
@@ -6709,11 +6709,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
6709
6709
|
}
|
|
6710
6710
|
return false;
|
|
6711
6711
|
}
|
|
6712
|
-
function prefixIssues(
|
|
6712
|
+
function prefixIssues(path73, issues) {
|
|
6713
6713
|
return issues.map((iss) => {
|
|
6714
6714
|
var _a3;
|
|
6715
6715
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
6716
|
-
iss.path.unshift(
|
|
6716
|
+
iss.path.unshift(path73);
|
|
6717
6717
|
return iss;
|
|
6718
6718
|
});
|
|
6719
6719
|
}
|
|
@@ -7163,16 +7163,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
7163
7163
|
}
|
|
7164
7164
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
7165
7165
|
const fieldErrors = { _errors: [] };
|
|
7166
|
-
const processError = (error63,
|
|
7166
|
+
const processError = (error63, path73 = []) => {
|
|
7167
7167
|
for (const issue2 of error63.issues) {
|
|
7168
7168
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
7169
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
7169
|
+
issue2.errors.map((issues) => processError({ issues }, [...path73, ...issue2.path]));
|
|
7170
7170
|
} else if (issue2.code === "invalid_key") {
|
|
7171
|
-
processError({ issues: issue2.issues }, [...
|
|
7171
|
+
processError({ issues: issue2.issues }, [...path73, ...issue2.path]);
|
|
7172
7172
|
} else if (issue2.code === "invalid_element") {
|
|
7173
|
-
processError({ issues: issue2.issues }, [...
|
|
7173
|
+
processError({ issues: issue2.issues }, [...path73, ...issue2.path]);
|
|
7174
7174
|
} else {
|
|
7175
|
-
const fullpath = [...
|
|
7175
|
+
const fullpath = [...path73, ...issue2.path];
|
|
7176
7176
|
if (fullpath.length === 0) {
|
|
7177
7177
|
fieldErrors._errors.push(mapper(issue2));
|
|
7178
7178
|
} else {
|
|
@@ -7211,17 +7211,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
7211
7211
|
}
|
|
7212
7212
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
7213
7213
|
const result = { errors: [] };
|
|
7214
|
-
const processError = (error63,
|
|
7214
|
+
const processError = (error63, path73 = []) => {
|
|
7215
7215
|
var _a3;
|
|
7216
7216
|
for (const issue2 of error63.issues) {
|
|
7217
7217
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
7218
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
7218
|
+
issue2.errors.map((issues) => processError({ issues }, [...path73, ...issue2.path]));
|
|
7219
7219
|
} else if (issue2.code === "invalid_key") {
|
|
7220
|
-
processError({ issues: issue2.issues }, [...
|
|
7220
|
+
processError({ issues: issue2.issues }, [...path73, ...issue2.path]);
|
|
7221
7221
|
} else if (issue2.code === "invalid_element") {
|
|
7222
|
-
processError({ issues: issue2.issues }, [...
|
|
7222
|
+
processError({ issues: issue2.issues }, [...path73, ...issue2.path]);
|
|
7223
7223
|
} else {
|
|
7224
|
-
const fullpath = [...
|
|
7224
|
+
const fullpath = [...path73, ...issue2.path];
|
|
7225
7225
|
if (fullpath.length === 0) {
|
|
7226
7226
|
result.errors.push(mapper(issue2));
|
|
7227
7227
|
continue;
|
|
@@ -7260,8 +7260,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
7260
7260
|
}
|
|
7261
7261
|
function toDotPath(_path) {
|
|
7262
7262
|
const segs = [];
|
|
7263
|
-
const
|
|
7264
|
-
for (const seg of
|
|
7263
|
+
const path73 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
7264
|
+
for (const seg of path73) {
|
|
7265
7265
|
if (typeof seg === "number")
|
|
7266
7266
|
segs.push(`[${seg}]`);
|
|
7267
7267
|
else if (typeof seg === "symbol")
|
|
@@ -24363,13 +24363,13 @@ function resolveRef(ref, ctx) {
|
|
|
24363
24363
|
if (!ref.startsWith("#")) {
|
|
24364
24364
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
24365
24365
|
}
|
|
24366
|
-
const
|
|
24367
|
-
if (
|
|
24366
|
+
const path73 = ref.slice(1).split("/").filter(Boolean);
|
|
24367
|
+
if (path73.length === 0) {
|
|
24368
24368
|
return ctx.rootSchema;
|
|
24369
24369
|
}
|
|
24370
24370
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
24371
|
-
if (
|
|
24372
|
-
const key2 =
|
|
24371
|
+
if (path73[0] === defsKey) {
|
|
24372
|
+
const key2 = path73[1] === void 0 ? void 0 : decodeJSONPointerSegment(path73[1]);
|
|
24373
24373
|
if (!key2 || !ctx.defs[key2]) {
|
|
24374
24374
|
throw new Error(`Reference not found: ${ref}`);
|
|
24375
24375
|
}
|
|
@@ -25505,7 +25505,7 @@ var SandboxSchema = external_exports.strictObject({
|
|
|
25505
25505
|
"When the sandbox (or this PC) runs low on memory, slow builds down in steps, like a PC that gets slower instead of failing: build programs get lower CPU and memory priority, then less CPU, then compilers take turns (the waiting ones briefly suspended and trimmed to the paging file). Nothing is stopped or killed, and the agents themselves are never touched. Yours only: a project file cannot change it."
|
|
25506
25506
|
),
|
|
25507
25507
|
vGpu: external_exports.boolean().describe(
|
|
25508
|
-
"Virtual GPU. Off by default: Microsoft notes it widens the sandbox attack surface. The sandbox then uses this PC's graphics card, and with some graphics drivers heavy use can freeze the whole PC: turn it on only when a program in the sandbox needs the GPU (the mesa toolchain gives software OpenGL without it)."
|
|
25508
|
+
"Virtual GPU. Off by default: Microsoft notes it widens the sandbox attack surface. The sandbox then uses this PC's graphics card, and with some graphics drivers heavy use can freeze the whole PC: turn it on only when a program in the sandbox needs the GPU (the mesa toolchain gives software OpenGL without it). Browsers in the sandbox never use it (they draw in software)."
|
|
25509
25509
|
),
|
|
25510
25510
|
networking: external_exports.boolean().describe("Internet access. false is the only hard network isolation Windows Sandbox offers."),
|
|
25511
25511
|
clipboard: external_exports.boolean().describe(
|
|
@@ -25667,6 +25667,21 @@ var ToolchainsSchema = external_exports.strictObject({
|
|
|
25667
25667
|
msvcVersion: external_exports.string().min(1).describe('"latest" or an MSVC tools version prefix, e.g. "14.44".'),
|
|
25668
25668
|
sdkVersion: external_exports.string().min(1).describe('"latest" or a Windows SDK build, e.g. "26100" or "10.0.22621".')
|
|
25669
25669
|
}),
|
|
25670
|
+
unreal: external_exports.strictObject({
|
|
25671
|
+
enabled: enabled(
|
|
25672
|
+
"Unreal Engine development: Visual Studio Community 2022 with the C++ game workload (MSVC, a Windows 11 SDK, .NET Framework targeting packs, Unreal integration and the Epic Games Launcher) and the DirectX End-User Runtime. A real installer: it runs every boot (~10 GB on the sandbox disk). The engine itself comes from the Epic Games Launcher or its source.",
|
|
25673
|
+
"a .uproject or .uplugin"
|
|
25674
|
+
),
|
|
25675
|
+
acceptLicense: external_exports.boolean().describe(
|
|
25676
|
+
"Required to install: you accept the Visual Studio Community licence terms (https://visualstudio.microsoft.com/license-terms/) and the DirectX End-User Runtime licence."
|
|
25677
|
+
),
|
|
25678
|
+
components: StringsSchema.describe(
|
|
25679
|
+
'More Visual Studio workload or component IDs to add, e.g. ["Microsoft.VisualStudio.Component.VC.Llvm.Clang"].'
|
|
25680
|
+
),
|
|
25681
|
+
keepInstallFiles: external_exports.boolean().describe(
|
|
25682
|
+
"Keep an offline copy of the Visual Studio install files in tools\\visualstudio (~10 GB, made once), so later boots install without downloading them again. Skipped while that disk has too little room."
|
|
25683
|
+
)
|
|
25684
|
+
}),
|
|
25670
25685
|
cpp: external_exports.strictObject({
|
|
25671
25686
|
enabled: enabled(
|
|
25672
25687
|
"MinGW-w64 GCC with CMake, Ninja, premake5 and mingw32-make (also Rust's linker).",
|
|
@@ -28041,7 +28056,7 @@ function withRequestSecrets(req) {
|
|
|
28041
28056
|
}
|
|
28042
28057
|
|
|
28043
28058
|
// src/guest/daemon/daemon.ts
|
|
28044
|
-
import
|
|
28059
|
+
import fs58 from "node:fs";
|
|
28045
28060
|
|
|
28046
28061
|
// src/guest/setup/claude-mem.ts
|
|
28047
28062
|
import fs15 from "node:fs";
|
|
@@ -28482,8 +28497,8 @@ function withRegistryPath(env) {
|
|
|
28482
28497
|
}
|
|
28483
28498
|
|
|
28484
28499
|
// src/guest/daemon/project-provisioner.ts
|
|
28485
|
-
import
|
|
28486
|
-
import
|
|
28500
|
+
import fs50 from "node:fs";
|
|
28501
|
+
import path64 from "node:path";
|
|
28487
28502
|
|
|
28488
28503
|
// src/guest/boot/boot-env.ts
|
|
28489
28504
|
import fs17 from "node:fs";
|
|
@@ -29312,6 +29327,7 @@ var MARKERS = {
|
|
|
29312
29327
|
],
|
|
29313
29328
|
rust: ["Cargo.toml", "rust-toolchain", "rust-toolchain.toml"],
|
|
29314
29329
|
msvc: ["*.vcxproj", "CMakePresets.json", "CMakeUserPresets.json"],
|
|
29330
|
+
unreal: ["*.uproject", "*.uplugin"],
|
|
29315
29331
|
cpp: [
|
|
29316
29332
|
"CMakeLists.txt",
|
|
29317
29333
|
"Makefile",
|
|
@@ -30952,25 +30968,221 @@ async function setupMsvc(env, config2) {
|
|
|
30952
30968
|
env.summary.push("msvc: " + done.msvc + ", Windows SDK " + done.sdk + " (cl, link; vcvars64.bat and vswhere work)");
|
|
30953
30969
|
}
|
|
30954
30970
|
|
|
30955
|
-
// src/guest/toolchains/native/
|
|
30971
|
+
// src/guest/toolchains/native/unreal.ts
|
|
30972
|
+
import fs43 from "node:fs";
|
|
30973
|
+
import os7 from "node:os";
|
|
30956
30974
|
import path55 from "node:path";
|
|
30957
30975
|
|
|
30958
|
-
// src/guest/toolchains/native/
|
|
30976
|
+
// src/guest/toolchains/native/vcruntime.ts
|
|
30959
30977
|
import fs42 from "node:fs";
|
|
30960
30978
|
import path54 from "node:path";
|
|
30979
|
+
var VC_REDIST = "https://aka.ms/vs/17/release/vc_redist.x64.exe";
|
|
30980
|
+
var MICROSOFT_SIGNER = "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US";
|
|
30981
|
+
var OK_EXIT_CODES = [0, 1638, 3010];
|
|
30982
|
+
var signerOf = (file3) => scriptOutput("get-signer.ps1", ["-Path", file3]).trim();
|
|
30983
|
+
async function setupVcRuntime(env, summary = true) {
|
|
30984
|
+
if (dryRun) {
|
|
30985
|
+
log("(dry run) would install the Visual C++ runtime");
|
|
30986
|
+
return false;
|
|
30987
|
+
}
|
|
30988
|
+
const system322 = path54.join(process.env.WINDIR ?? "C:\\Windows", "System32");
|
|
30989
|
+
const missing = !exists(path54.join(system322, "vcruntime140.dll")) || !exists(path54.join(system322, "msvcp140.dll"));
|
|
30990
|
+
if (missing) {
|
|
30991
|
+
const installer = tool("vcredist", "vc_redist.x64.exe");
|
|
30992
|
+
if (!exists(installer)) {
|
|
30993
|
+
log("Downloading the Visual C++ runtime (~25 MB once) ...");
|
|
30994
|
+
await downloadFile(VC_REDIST, installer);
|
|
30995
|
+
}
|
|
30996
|
+
if (signerOf(installer) !== MICROSOFT_SIGNER) {
|
|
30997
|
+
fs42.rmSync(installer, { force: true });
|
|
30998
|
+
throw new Error("vc_redist.x64.exe is not signed by Microsoft; deleted it (it is downloaded again next boot)");
|
|
30999
|
+
}
|
|
31000
|
+
log("Installing the Visual C++ runtime ...");
|
|
31001
|
+
const code = await spawnAsync(installer, ["/install", "/quiet", "/norestart"]);
|
|
31002
|
+
if (!OK_EXIT_CODES.includes(code ?? -1) || !exists(path54.join(system322, "vcruntime140.dll")))
|
|
31003
|
+
throw new Error("the Visual C++ runtime installer failed (exit " + code + ")");
|
|
31004
|
+
}
|
|
31005
|
+
if (summary) env.summary.push("vc++ runtime: installed");
|
|
31006
|
+
return missing;
|
|
31007
|
+
}
|
|
31008
|
+
|
|
31009
|
+
// src/guest/toolchains/native/unreal.ts
|
|
31010
|
+
var BOOTSTRAPPER_URL = "https://aka.ms/vs/17/release/vs_community.exe";
|
|
31011
|
+
var DIRECTX_URL = "https://download.microsoft.com/download/8/4/A/84A35BF1-DAFE-4AE8-82AF-AD2AE20B6B14/directx_Jun2010_redist.exe";
|
|
31012
|
+
var UNREAL_COMPONENTS = [
|
|
31013
|
+
"Microsoft.VisualStudio.Workload.NativeGame",
|
|
31014
|
+
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
|
31015
|
+
"Microsoft.VisualStudio.Component.Windows11SDK.22621",
|
|
31016
|
+
"Microsoft.VisualStudio.Component.VC.DiagnosticTools",
|
|
31017
|
+
"Microsoft.Net.Component.4.6.2.TargetingPack",
|
|
31018
|
+
"Microsoft.Net.Component.4.8.SDK",
|
|
31019
|
+
"Component.Unreal.Ide",
|
|
31020
|
+
"Component.Unreal"
|
|
31021
|
+
];
|
|
31022
|
+
var OK_EXIT_CODES2 = [0, 3010];
|
|
31023
|
+
var LAYOUT_ROOM_BYTES = 15 * 1024 ** 3;
|
|
31024
|
+
var ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$/;
|
|
31025
|
+
var VS_DIR = tool("visualstudio");
|
|
31026
|
+
var BOOTSTRAPPER = path55.join(VS_DIR, "vs_community.exe");
|
|
31027
|
+
var LAYOUT = path55.join(VS_DIR, "layout");
|
|
31028
|
+
var LAYOUT_MARKER = path55.join(LAYOUT, ".complete.json");
|
|
31029
|
+
var LayoutSchema = external_exports.object({ components: external_exports.array(external_exports.string()) });
|
|
31030
|
+
var VSWHERE = path55.join(
|
|
31031
|
+
process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)",
|
|
31032
|
+
"Microsoft Visual Studio",
|
|
31033
|
+
"Installer",
|
|
31034
|
+
"vswhere.exe"
|
|
31035
|
+
);
|
|
31036
|
+
function installedVs() {
|
|
31037
|
+
if (!exists(VSWHERE)) return null;
|
|
31038
|
+
const ask = (property) => execOutput(VSWHERE, [
|
|
31039
|
+
"-latest",
|
|
31040
|
+
"-products",
|
|
31041
|
+
"*",
|
|
31042
|
+
"-requires",
|
|
31043
|
+
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
|
31044
|
+
"-property",
|
|
31045
|
+
property
|
|
31046
|
+
]);
|
|
31047
|
+
const at = ask("installationPath");
|
|
31048
|
+
return at ? { path: at, version: ask("installationVersion") || "installed" } : null;
|
|
31049
|
+
}
|
|
31050
|
+
async function signedInstaller(url2, file3, what) {
|
|
31051
|
+
if (!exists(file3)) {
|
|
31052
|
+
log("Downloading " + what + " ...");
|
|
31053
|
+
mkdirp(path55.dirname(file3));
|
|
31054
|
+
await downloadFile(url2, file3);
|
|
31055
|
+
}
|
|
31056
|
+
if (signerOf(file3) !== MICROSOFT_SIGNER) {
|
|
31057
|
+
fs43.rmSync(file3, { force: true });
|
|
31058
|
+
throw new Error(path55.basename(file3) + " is not signed by Microsoft; deleted it (it is downloaded again next boot)");
|
|
31059
|
+
}
|
|
31060
|
+
return file3;
|
|
31061
|
+
}
|
|
31062
|
+
function freeBytes(dir) {
|
|
31063
|
+
try {
|
|
31064
|
+
const s = fs43.statfsSync(dir);
|
|
31065
|
+
return s.bavail * s.bsize;
|
|
31066
|
+
} catch {
|
|
31067
|
+
return 0;
|
|
31068
|
+
}
|
|
31069
|
+
}
|
|
31070
|
+
async function layoutInstaller(bootstrapper, ids) {
|
|
31071
|
+
const installer = path55.join(LAYOUT, "vs_community.exe");
|
|
31072
|
+
const has = () => {
|
|
31073
|
+
if (!exists(LAYOUT_MARKER) || !exists(installer)) return false;
|
|
31074
|
+
try {
|
|
31075
|
+
const done = LayoutSchema.parse(JSON.parse(fs43.readFileSync(LAYOUT_MARKER, "utf8")));
|
|
31076
|
+
return ids.every((id) => done.components.includes(id));
|
|
31077
|
+
} catch {
|
|
31078
|
+
return false;
|
|
31079
|
+
}
|
|
31080
|
+
};
|
|
31081
|
+
if (has()) return installer;
|
|
31082
|
+
if (freeBytes(mkdirp(VS_DIR)) < LAYOUT_ROOM_BYTES) {
|
|
31083
|
+
warn("unreal: not keeping the install files (less than 15 GB free in " + VS_DIR + "); downloading this boot");
|
|
31084
|
+
return null;
|
|
31085
|
+
}
|
|
31086
|
+
log("Saving the Visual Studio install files for later boots (~10 GB, once) ...");
|
|
31087
|
+
fs43.rmSync(LAYOUT_MARKER, { force: true });
|
|
31088
|
+
const code = await spawnAsync(bootstrapper, [
|
|
31089
|
+
"--layout",
|
|
31090
|
+
LAYOUT,
|
|
31091
|
+
"--lang",
|
|
31092
|
+
"en-US",
|
|
31093
|
+
"--quiet",
|
|
31094
|
+
"--wait",
|
|
31095
|
+
...ids.flatMap((id) => ["--add", id])
|
|
31096
|
+
]);
|
|
31097
|
+
if (!OK_EXIT_CODES2.includes(code) || !exists(installer)) {
|
|
31098
|
+
warn("unreal: saving the install files failed (exit " + code + "); downloading this boot");
|
|
31099
|
+
return null;
|
|
31100
|
+
}
|
|
31101
|
+
writeJsonAtomic(LAYOUT_MARKER, { components: [...ids] });
|
|
31102
|
+
return installer;
|
|
31103
|
+
}
|
|
31104
|
+
async function installVisualStudio(config2, ids) {
|
|
31105
|
+
const bootstrapper = await signedInstaller(BOOTSTRAPPER_URL, BOOTSTRAPPER, "the Visual Studio installer");
|
|
31106
|
+
let installer = null;
|
|
31107
|
+
if (config2.keepInstallFiles) {
|
|
31108
|
+
try {
|
|
31109
|
+
installer = await layoutInstaller(bootstrapper, ids);
|
|
31110
|
+
} catch (e) {
|
|
31111
|
+
warn("unreal: the offline copy failed (" + errMsg(e) + "); downloading this boot");
|
|
31112
|
+
}
|
|
31113
|
+
}
|
|
31114
|
+
log(
|
|
31115
|
+
"Installing Visual Studio Community 2022 with the C++ game workload" + (installer ? " from the saved install files" : " (downloads ~5-8 GB)") + " ..."
|
|
31116
|
+
);
|
|
31117
|
+
const code = await spawnAsync(installer ?? bootstrapper, [
|
|
31118
|
+
"--quiet",
|
|
31119
|
+
"--wait",
|
|
31120
|
+
"--norestart",
|
|
31121
|
+
"--nocache",
|
|
31122
|
+
...installer ? ["--noWeb"] : [],
|
|
31123
|
+
...ids.flatMap((id) => ["--add", id])
|
|
31124
|
+
]);
|
|
31125
|
+
if (!OK_EXIT_CODES2.includes(code) || !installedVs())
|
|
31126
|
+
throw new Error(
|
|
31127
|
+
"the Visual Studio installer failed (exit " + code + "); its logs are the dd_*.log files in " + os7.tmpdir()
|
|
31128
|
+
);
|
|
31129
|
+
}
|
|
31130
|
+
async function installDirectX() {
|
|
31131
|
+
const system322 = path55.join(process.env.WINDIR ?? "C:\\Windows", "System32");
|
|
31132
|
+
if (exists(path55.join(system322, "d3dx9_43.dll")) && exists(path55.join(system322, "XAudio2_7.dll"))) return;
|
|
31133
|
+
const redist = await signedInstaller(
|
|
31134
|
+
DIRECTX_URL,
|
|
31135
|
+
path55.join(VS_DIR, "directx_Jun2010_redist.exe"),
|
|
31136
|
+
"the DirectX End-User Runtime (~95 MB once)"
|
|
31137
|
+
);
|
|
31138
|
+
const unpacked = path55.join(os7.tmpdir(), "directx-redist");
|
|
31139
|
+
safeRemove(unpacked, os7.tmpdir());
|
|
31140
|
+
mkdirp(unpacked);
|
|
31141
|
+
if (await spawnAsync(redist, ["/Q", "/T:" + unpacked]) !== 0 || !exists(path55.join(unpacked, "DXSETUP.exe")))
|
|
31142
|
+
throw new Error("could not unpack the DirectX End-User Runtime");
|
|
31143
|
+
const code = await spawnAsync(path55.join(unpacked, "DXSETUP.exe"), ["/silent"]);
|
|
31144
|
+
safeRemove(unpacked, os7.tmpdir());
|
|
31145
|
+
if (code !== 0) throw new Error("the DirectX End-User Runtime installer failed (exit " + code + ")");
|
|
31146
|
+
}
|
|
31147
|
+
async function setupUnreal(env, config2) {
|
|
31148
|
+
if (!config2.acceptLicense)
|
|
31149
|
+
throw new Error(
|
|
31150
|
+
"Unreal tools are installed only with toolchains.unreal.acceptLicense = true: Visual Studio Community and the DirectX End-User Runtime come under Microsoft licence terms (https://visualstudio.microsoft.com/license-terms/)"
|
|
31151
|
+
);
|
|
31152
|
+
const bad = config2.components.find((id) => !ID.test(id));
|
|
31153
|
+
if (bad) throw new Error('toolchains.unreal.components: "' + bad + '" is not a Visual Studio component ID');
|
|
31154
|
+
const ids = [.../* @__PURE__ */ new Set([...UNREAL_COMPONENTS, ...config2.components])];
|
|
31155
|
+
if (dryRun) {
|
|
31156
|
+
log("(dry run) would install Visual Studio Community 2022 with " + ids.join(", ") + " and DirectX");
|
|
31157
|
+
return;
|
|
31158
|
+
}
|
|
31159
|
+
if (!installedVs()) await installVisualStudio(config2, ids);
|
|
31160
|
+
await installDirectX();
|
|
31161
|
+
const vs = installedVs();
|
|
31162
|
+
env.summary.push(
|
|
31163
|
+
"unreal: Visual Studio Community " + vs.version + " (C++ game workload, Windows 11 SDK, Unreal support) at " + vs.path + "; DirectX End-User Runtime; get the engine from the Epic Games Launcher (Start menu)"
|
|
31164
|
+
);
|
|
31165
|
+
}
|
|
31166
|
+
|
|
31167
|
+
// src/guest/toolchains/native/rust.ts
|
|
31168
|
+
import path57 from "node:path";
|
|
31169
|
+
|
|
31170
|
+
// src/guest/toolchains/native/binstall.ts
|
|
31171
|
+
import fs44 from "node:fs";
|
|
31172
|
+
import path56 from "node:path";
|
|
30961
31173
|
var ensureBinstall = async (cargoBin) => {
|
|
30962
|
-
const target =
|
|
31174
|
+
const target = path56.join(cargoBin, "cargo-binstall.exe");
|
|
30963
31175
|
if (exists(target)) return true;
|
|
30964
31176
|
try {
|
|
30965
31177
|
const dir = tool("cargo-binstall");
|
|
30966
|
-
if (!exists(
|
|
31178
|
+
if (!exists(path56.join(dir, "cargo-binstall.exe"))) {
|
|
30967
31179
|
await installFromGithub("cargo-bins/cargo-binstall", binstallAsset(arch), {
|
|
30968
31180
|
dest: dir,
|
|
30969
31181
|
what: "cargo-binstall for prebuilt Rust tools (~10 MB once)",
|
|
30970
31182
|
locate: "cargo-binstall.exe"
|
|
30971
31183
|
});
|
|
30972
31184
|
}
|
|
30973
|
-
|
|
31185
|
+
fs44.copyFileSync(path56.join(dir, "cargo-binstall.exe"), target);
|
|
30974
31186
|
return true;
|
|
30975
31187
|
} catch (e) {
|
|
30976
31188
|
warn("cargo-binstall unavailable, compiling crates with cargo install instead: " + errMsg(e));
|
|
@@ -30978,14 +31190,14 @@ var ensureBinstall = async (cargoBin) => {
|
|
|
30978
31190
|
}
|
|
30979
31191
|
};
|
|
30980
31192
|
function crateInstaller(cargoHome, cargoEnv) {
|
|
30981
|
-
const cargo =
|
|
31193
|
+
const cargo = path56.join(cargoHome, "bin", "cargo.exe");
|
|
30982
31194
|
let binstall = null;
|
|
30983
31195
|
const binstallEnv = {
|
|
30984
31196
|
...cargoEnv,
|
|
30985
31197
|
env: { ...cargoEnv.env ?? process.env, BINSTALL_DISABLE_TELEMETRY: "true" }
|
|
30986
31198
|
};
|
|
30987
31199
|
return async (crate) => {
|
|
30988
|
-
binstall ??= ensureBinstall(
|
|
31200
|
+
binstall ??= ensureBinstall(path56.join(cargoHome, "bin"));
|
|
30989
31201
|
if (await binstall) {
|
|
30990
31202
|
try {
|
|
30991
31203
|
await execAsync(
|
|
@@ -31007,7 +31219,7 @@ async function setupRust(env, config2, refresh) {
|
|
|
31007
31219
|
const RUSTUP_HOME = tool("rust", "rustup");
|
|
31008
31220
|
const CARGO_HOME = tool("rust", "cargo");
|
|
31009
31221
|
const rustEnv = { env: { ...process.env, RUSTUP_HOME, CARGO_HOME } };
|
|
31010
|
-
const rustup =
|
|
31222
|
+
const rustup = path57.join(CARGO_HOME, "bin", "rustup.exe");
|
|
31011
31223
|
if (dryRun) {
|
|
31012
31224
|
log("(dry run) would provision Rust " + config2.toolchain + " (" + config2.host + ")");
|
|
31013
31225
|
return;
|
|
@@ -31043,9 +31255,9 @@ async function setupRust(env, config2, refresh) {
|
|
|
31043
31255
|
if (refresh) await execAsync(rustup, ["update"], rustEnv);
|
|
31044
31256
|
}
|
|
31045
31257
|
Object.assign(env.vars, { RUSTUP_HOME, CARGO_HOME });
|
|
31046
|
-
env.prepend.push(
|
|
31258
|
+
env.prepend.push(path57.join(CARGO_HOME, "bin"));
|
|
31047
31259
|
env.summary.push(
|
|
31048
|
-
"rust: " + versionOf(
|
|
31260
|
+
"rust: " + versionOf(path57.join(CARGO_HOME, "bin", "rustc.exe"), ["--version"], rustEnv) + " [" + config2.host + "]"
|
|
31049
31261
|
);
|
|
31050
31262
|
const toolchainKey = "rustup@" + config2.toolchain;
|
|
31051
31263
|
await installOnce(
|
|
@@ -31066,36 +31278,36 @@ async function setupRust(env, config2, refresh) {
|
|
|
31066
31278
|
env: {
|
|
31067
31279
|
...rustEnv.env,
|
|
31068
31280
|
...msvc.vars,
|
|
31069
|
-
PATH: [
|
|
31281
|
+
PATH: [path57.join(CARGO_HOME, "bin"), ...msvc.path, process.env.PATH ?? ""].join(path57.delimiter)
|
|
31070
31282
|
}
|
|
31071
31283
|
} : {
|
|
31072
31284
|
env: {
|
|
31073
31285
|
...rustEnv.env,
|
|
31074
|
-
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER:
|
|
31075
|
-
PATH: [
|
|
31286
|
+
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: path57.join(mingw, "gcc.exe"),
|
|
31287
|
+
PATH: [path57.join(CARGO_HOME, "bin"), mingw, process.env.PATH ?? ""].join(path57.delimiter)
|
|
31076
31288
|
}
|
|
31077
31289
|
};
|
|
31078
31290
|
await installOnce(env, "cargo", config2.crates, crateInstaller(CARGO_HOME, cargoEnv));
|
|
31079
31291
|
}
|
|
31080
31292
|
|
|
31081
31293
|
// src/guest/toolchains/languages/node.ts
|
|
31082
|
-
import
|
|
31083
|
-
import
|
|
31294
|
+
import fs45 from "node:fs";
|
|
31295
|
+
import path58 from "node:path";
|
|
31084
31296
|
import { spawn as spawn4 } from "node:child_process";
|
|
31085
31297
|
var NVM_HOME = tool("nvm");
|
|
31086
|
-
var NVM_SYMLINK =
|
|
31087
|
-
var HOST_NVM =
|
|
31298
|
+
var NVM_SYMLINK = path58.join(localDir, "nodejs");
|
|
31299
|
+
var HOST_NVM = path58.join(hostToolsDir, "nvm");
|
|
31088
31300
|
var HOST_VERSIONS_MAX = 3;
|
|
31089
|
-
var hostNvmVersions = () => exists(HOST_NVM) ?
|
|
31301
|
+
var hostNvmVersions = () => exists(HOST_NVM) ? fs45.readdirSync(HOST_NVM).filter((d) => /^v\d+\.\d+\.\d+$/.test(d) && exists(path58.join(HOST_NVM, d, "node.exe"))).map((d) => d.slice(1)) : [];
|
|
31090
31302
|
var resolveNode = (spec) => resolveCached("node:" + spec, async () => {
|
|
31091
31303
|
const exact = spec.replace(/^v/, "");
|
|
31092
31304
|
if (/^\d+\.\d+\.\d+$/.test(exact)) return exact;
|
|
31093
31305
|
const releases = await fetchJson("https://nodejs.org/dist/index.json");
|
|
31094
31306
|
return pickNodeVersion(releases, spec) ?? Promise.reject(new Error('No Node.js release matches "' + spec + '"'));
|
|
31095
31307
|
});
|
|
31096
|
-
var NVM_TEMP =
|
|
31308
|
+
var NVM_TEMP = path58.join(NVM_HOME, ".tmp");
|
|
31097
31309
|
var nvm = (args) => new Promise((resolve2) => {
|
|
31098
|
-
const child = spawn4(
|
|
31310
|
+
const child = spawn4(path58.join(NVM_HOME, "nvm.exe"), args, {
|
|
31099
31311
|
windowsHide: true,
|
|
31100
31312
|
env: { ...process.env, NVM_HOME, NVM_SYMLINK, TEMP: NVM_TEMP, TMP: NVM_TEMP }
|
|
31101
31313
|
});
|
|
@@ -31110,12 +31322,12 @@ var nvm = (args) => new Promise((resolve2) => {
|
|
|
31110
31322
|
child.once("close", () => resolve2(out));
|
|
31111
31323
|
});
|
|
31112
31324
|
var ensureNvm = async () => {
|
|
31113
|
-
if (exists(
|
|
31114
|
-
if (exists(
|
|
31325
|
+
if (exists(path58.join(NVM_HOME, "nvm.exe"))) return;
|
|
31326
|
+
if (exists(path58.join(HOST_NVM, "nvm.exe"))) {
|
|
31115
31327
|
log("Copying nvm from this PC ...");
|
|
31116
31328
|
mkdirp(NVM_HOME);
|
|
31117
|
-
const files =
|
|
31118
|
-
for (const file3 of files)
|
|
31329
|
+
const files = fs45.readdirSync(HOST_NVM).filter((f) => /\.(exe|cmd|vbs)$/i.test(f)).sort((a, b) => Number(a.toLowerCase() === "nvm.exe") - Number(b.toLowerCase() === "nvm.exe"));
|
|
31330
|
+
for (const file3 of files) fs45.copyFileSync(path58.join(HOST_NVM, file3), path58.join(NVM_HOME, file3));
|
|
31119
31331
|
return;
|
|
31120
31332
|
}
|
|
31121
31333
|
const asset = await githubAsset("coreybutler/nvm-windows", /^nvm-noinstall\.zip$/, true);
|
|
@@ -31123,14 +31335,14 @@ var ensureNvm = async () => {
|
|
|
31123
31335
|
await downloader.archive(asset.url, NVM_HOME, { sha256: asset.sha256, locate: "nvm.exe", fileName: asset.name });
|
|
31124
31336
|
};
|
|
31125
31337
|
var hostNodeFolder = (version2) => {
|
|
31126
|
-
const dir =
|
|
31127
|
-
return session.hostTools.nodeVersion?.replace(/^v/, "") === version2 && exists(
|
|
31338
|
+
const dir = path58.join(hostToolsDir, "node");
|
|
31339
|
+
return session.hostTools.nodeVersion?.replace(/^v/, "") === version2 && exists(path58.join(dir, "node.exe")) ? dir : null;
|
|
31128
31340
|
};
|
|
31129
31341
|
var installNodeVersion = async (version2) => {
|
|
31130
|
-
const dir =
|
|
31131
|
-
const fromHost =
|
|
31132
|
-
if (exists(
|
|
31133
|
-
if (exists(
|
|
31342
|
+
const dir = path58.join(NVM_HOME, "v" + version2);
|
|
31343
|
+
const fromHost = path58.join(HOST_NVM, "v" + version2);
|
|
31344
|
+
if (exists(path58.join(dir, "node.exe"))) return;
|
|
31345
|
+
if (exists(path58.join(fromHost, "node.exe"))) {
|
|
31134
31346
|
log("Copying Node " + version2 + " from this PC's nvm (without global packages) ...");
|
|
31135
31347
|
copyNode(fromHost, dir);
|
|
31136
31348
|
return;
|
|
@@ -31149,19 +31361,19 @@ var installNodeVersion = async (version2) => {
|
|
|
31149
31361
|
} finally {
|
|
31150
31362
|
safeRemove(NVM_TEMP, NVM_HOME);
|
|
31151
31363
|
}
|
|
31152
|
-
if (!exists(
|
|
31364
|
+
if (!exists(path58.join(dir, "node.exe"))) {
|
|
31153
31365
|
const tail = out.trim().split(/\r?\n/).filter(Boolean).slice(-3).join(" ");
|
|
31154
31366
|
const why = /complete/i.test(out) ? "nvm said it finished, but its move into the data folder did not happen" : "nvm could not download or unpack it: check the internet connection and the free disk space";
|
|
31155
31367
|
throw new Error(
|
|
31156
|
-
"nvm install " + version2 + " did not leave " +
|
|
31368
|
+
"nvm install " + version2 + " did not leave " + path58.join(dir, "node.exe") + " (" + why + ")" + (tail ? ". nvm printed: " + tail : "")
|
|
31157
31369
|
);
|
|
31158
31370
|
}
|
|
31159
31371
|
};
|
|
31160
31372
|
var activate = async (version2) => {
|
|
31161
31373
|
await nvm(["use", version2]);
|
|
31162
|
-
if (exists(
|
|
31163
|
-
|
|
31164
|
-
|
|
31374
|
+
if (exists(path58.join(NVM_SYMLINK, "node.exe"))) return;
|
|
31375
|
+
fs45.rmSync(NVM_SYMLINK, { recursive: true, force: true });
|
|
31376
|
+
fs45.symlinkSync(path58.join(NVM_HOME, "v" + version2), NVM_SYMLINK, "junction");
|
|
31165
31377
|
};
|
|
31166
31378
|
var PLAYWRIGHT_VARS = () => ({
|
|
31167
31379
|
PLAYWRIGHT_BROWSERS_PATH: tool("ms-playwright"),
|
|
@@ -31173,8 +31385,8 @@ async function setupNode(env, versions, config2) {
|
|
|
31173
31385
|
return;
|
|
31174
31386
|
}
|
|
31175
31387
|
await ensureNvm();
|
|
31176
|
-
|
|
31177
|
-
|
|
31388
|
+
fs45.writeFileSync(
|
|
31389
|
+
path58.join(NVM_HOME, "settings.txt"),
|
|
31178
31390
|
[
|
|
31179
31391
|
"root: " + NVM_HOME,
|
|
31180
31392
|
"path: " + NVM_SYMLINK,
|
|
@@ -31201,7 +31413,7 @@ async function setupNode(env, versions, config2) {
|
|
|
31201
31413
|
}
|
|
31202
31414
|
}
|
|
31203
31415
|
Object.assign(env.vars, { NVM_HOME, NVM_SYMLINK, ...PLAYWRIGHT_VARS() });
|
|
31204
|
-
if (duringSession()) env.prepend.push(
|
|
31416
|
+
if (duringSession()) env.prepend.push(path58.join(NVM_HOME, "v" + main), NVM_HOME, NVM_SYMLINK);
|
|
31205
31417
|
else {
|
|
31206
31418
|
await activate(main);
|
|
31207
31419
|
env.prepend.push(NVM_HOME, NVM_SYMLINK);
|
|
@@ -31211,13 +31423,13 @@ async function setupNode(env, versions, config2) {
|
|
|
31211
31423
|
await packageManagers(env, config2, main);
|
|
31212
31424
|
}
|
|
31213
31425
|
var packageManagers = async (env, config2, version2) => {
|
|
31214
|
-
const dir =
|
|
31215
|
-
const nodeEnv = { ...process.env, PATH: dir +
|
|
31216
|
-
const npm = (args) => execAsync(
|
|
31426
|
+
const dir = path58.join(NVM_HOME, "v" + version2);
|
|
31427
|
+
const nodeEnv = { ...process.env, PATH: dir + path58.delimiter + (process.env.PATH ?? "") };
|
|
31428
|
+
const npm = (args) => execAsync(path58.join(dir, "node.exe"), [path58.join(dir, "node_modules", "npm", "bin", "npm-cli.js"), ...args], {
|
|
31217
31429
|
env: nodeEnv,
|
|
31218
31430
|
stdio: "ignore"
|
|
31219
31431
|
});
|
|
31220
|
-
const corepackJs =
|
|
31432
|
+
const corepackJs = path58.join(dir, "node_modules", "corepack", "dist", "corepack.js");
|
|
31221
31433
|
const extra = config2.corepack && !exists(corepackJs) ? ["corepack"] : [];
|
|
31222
31434
|
await installOnce(
|
|
31223
31435
|
env,
|
|
@@ -31238,7 +31450,7 @@ var packageManagers = async (env, config2, version2) => {
|
|
|
31238
31450
|
}
|
|
31239
31451
|
try {
|
|
31240
31452
|
await execAsync(
|
|
31241
|
-
|
|
31453
|
+
path58.join(dir, "node.exe"),
|
|
31242
31454
|
[corepackJs, "enable", "--install-directory", mkdirp(tool("bin")), "pnpm", "yarn"],
|
|
31243
31455
|
{ env: nodeEnv, stdio: "ignore" }
|
|
31244
31456
|
);
|
|
@@ -31263,8 +31475,8 @@ async function setupPwsh(env, refresh = false) {
|
|
|
31263
31475
|
}
|
|
31264
31476
|
|
|
31265
31477
|
// src/guest/toolchains/languages/python.ts
|
|
31266
|
-
import
|
|
31267
|
-
import
|
|
31478
|
+
import fs46 from "node:fs";
|
|
31479
|
+
import path59 from "node:path";
|
|
31268
31480
|
var installPython = async (pkg, spec) => {
|
|
31269
31481
|
const version2 = await resolveCached(pkg + ":" + spec, async () => {
|
|
31270
31482
|
const { versions } = await fetchJson(
|
|
@@ -31273,7 +31485,7 @@ var installPython = async (pkg, spec) => {
|
|
|
31273
31485
|
return pickPackageVersion(versions, spec) ?? Promise.reject(new Error("No " + pkg + ' release matches "' + spec + '"'));
|
|
31274
31486
|
});
|
|
31275
31487
|
const dir = tool("python", pkg + "-" + version2);
|
|
31276
|
-
const exe =
|
|
31488
|
+
const exe = path59.join(dir, "python.exe");
|
|
31277
31489
|
if (!exists(exe)) {
|
|
31278
31490
|
log("Downloading Python " + version2 + (pkg === "python2" ? " (Python 2, " : " (") + "~30 MB once) ...");
|
|
31279
31491
|
await downloader.archive(
|
|
@@ -31282,32 +31494,32 @@ var installPython = async (pkg, spec) => {
|
|
|
31282
31494
|
{ locate: "python.exe", fileName: pkg + "." + version2 + ".zip" }
|
|
31283
31495
|
);
|
|
31284
31496
|
}
|
|
31285
|
-
if (!exists(
|
|
31497
|
+
if (!exists(path59.join(dir, "Scripts", "pip.exe")) && !exists(path59.join(dir, "Scripts", "pip2.exe")))
|
|
31286
31498
|
await execAsync(exe, ["-m", "ensurepip", "--default-pip"], { stdio: "ignore" });
|
|
31287
31499
|
return dir;
|
|
31288
31500
|
};
|
|
31289
|
-
var shimDir = (dir) => duringSession() ? tool("shims",
|
|
31501
|
+
var shimDir = (dir) => duringSession() ? tool("shims", path59.basename(dir)) : tool("shims");
|
|
31290
31502
|
var shim = (folder, name, program, args = []) => {
|
|
31291
31503
|
const fixed = [program, ...args];
|
|
31292
|
-
|
|
31293
|
-
|
|
31504
|
+
fs46.writeFileSync(
|
|
31505
|
+
path59.join(mkdirp(folder), name + ".cmd"),
|
|
31294
31506
|
"@echo off\r\n" + fixed.map((a) => '"' + a + '"').join(" ") + " %*\r\n"
|
|
31295
31507
|
);
|
|
31296
31508
|
const sh = fixed.map((a) => "'" + a.replace(/\\/g, "/").replace(/'/g, "'\\''") + "'").join(" ");
|
|
31297
|
-
|
|
31509
|
+
fs46.writeFileSync(path59.join(folder, name), "#!/bin/sh\nexec " + sh + ' "$@"\n');
|
|
31298
31510
|
};
|
|
31299
31511
|
var shimPair = (folder, version2, dir) => {
|
|
31300
|
-
const python =
|
|
31512
|
+
const python = path59.join(dir, "python.exe");
|
|
31301
31513
|
shim(folder, "python" + version2, python);
|
|
31302
31514
|
shim(folder, "pip" + version2, python, ["-m", "pip"]);
|
|
31303
31515
|
};
|
|
31304
31516
|
var pyLauncher = (folder, py3, py2) => {
|
|
31305
|
-
const script =
|
|
31306
|
-
|
|
31517
|
+
const script = path59.join(mkdirp(folder), "py-launcher.py");
|
|
31518
|
+
fs46.writeFileSync(
|
|
31307
31519
|
script,
|
|
31308
31520
|
[
|
|
31309
31521
|
"import subprocess, sys",
|
|
31310
|
-
"PY3, PY2 = " + JSON.stringify(
|
|
31522
|
+
"PY3, PY2 = " + JSON.stringify(path59.join(py3, "python.exe")) + ", " + JSON.stringify(py2 ? path59.join(py2, "python.exe") : null),
|
|
31311
31523
|
"args = sys.argv[1:]",
|
|
31312
31524
|
"exe = PY3",
|
|
31313
31525
|
"if args and args[0].startswith('-2'):",
|
|
@@ -31319,7 +31531,7 @@ var pyLauncher = (folder, py3, py2) => {
|
|
|
31319
31531
|
""
|
|
31320
31532
|
].join("\n")
|
|
31321
31533
|
);
|
|
31322
|
-
shim(folder, "py",
|
|
31534
|
+
shim(folder, "py", path59.join(py3, "python.exe"), [script]);
|
|
31323
31535
|
};
|
|
31324
31536
|
async function setupPython(env, config2, versions) {
|
|
31325
31537
|
if (dryRun) {
|
|
@@ -31329,10 +31541,10 @@ async function setupPython(env, config2, versions) {
|
|
|
31329
31541
|
const py3 = await installPython("python", versions.python.spec);
|
|
31330
31542
|
const shims = shimDir(py3);
|
|
31331
31543
|
shimPair(shims, "3", py3);
|
|
31332
|
-
env.prepend.push(py3, mkdirp(
|
|
31544
|
+
env.prepend.push(py3, mkdirp(path59.join(py3, "Scripts")), shims);
|
|
31333
31545
|
env.vars.PYTHONIOENCODING = "utf-8";
|
|
31334
31546
|
env.summary.push(
|
|
31335
|
-
"python: " +
|
|
31547
|
+
"python: " + path59.basename(py3).replace("python-", "") + " (from " + versions.python.source + "; py works too)"
|
|
31336
31548
|
);
|
|
31337
31549
|
if (!config2.python2) {
|
|
31338
31550
|
pyLauncher(shims, py3, null);
|
|
@@ -31341,47 +31553,12 @@ async function setupPython(env, config2, versions) {
|
|
|
31341
31553
|
const py2 = await installPython("python2", "2.7");
|
|
31342
31554
|
shimPair(shims, "2", py2);
|
|
31343
31555
|
pyLauncher(shims, py3, py2);
|
|
31344
|
-
env.summary.push("python2: " +
|
|
31345
|
-
}
|
|
31346
|
-
|
|
31347
|
-
// src/guest/toolchains/languages/php.ts
|
|
31348
|
-
import fs46 from "node:fs";
|
|
31349
|
-
import path59 from "node:path";
|
|
31350
|
-
|
|
31351
|
-
// src/guest/toolchains/native/vcruntime.ts
|
|
31352
|
-
import fs45 from "node:fs";
|
|
31353
|
-
import path58 from "node:path";
|
|
31354
|
-
var VC_REDIST = "https://aka.ms/vs/17/release/vc_redist.x64.exe";
|
|
31355
|
-
var MICROSOFT_SIGNER = "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US";
|
|
31356
|
-
var OK_EXIT_CODES = [0, 1638, 3010];
|
|
31357
|
-
var signerOf = (file3) => scriptOutput("get-signer.ps1", ["-Path", file3]).trim();
|
|
31358
|
-
async function setupVcRuntime(env, summary = true) {
|
|
31359
|
-
if (dryRun) {
|
|
31360
|
-
log("(dry run) would install the Visual C++ runtime");
|
|
31361
|
-
return false;
|
|
31362
|
-
}
|
|
31363
|
-
const system322 = path58.join(process.env.WINDIR ?? "C:\\Windows", "System32");
|
|
31364
|
-
const missing = !exists(path58.join(system322, "vcruntime140.dll")) || !exists(path58.join(system322, "msvcp140.dll"));
|
|
31365
|
-
if (missing) {
|
|
31366
|
-
const installer = tool("vcredist", "vc_redist.x64.exe");
|
|
31367
|
-
if (!exists(installer)) {
|
|
31368
|
-
log("Downloading the Visual C++ runtime (~25 MB once) ...");
|
|
31369
|
-
await downloadFile(VC_REDIST, installer);
|
|
31370
|
-
}
|
|
31371
|
-
if (signerOf(installer) !== MICROSOFT_SIGNER) {
|
|
31372
|
-
fs45.rmSync(installer, { force: true });
|
|
31373
|
-
throw new Error("vc_redist.x64.exe is not signed by Microsoft; deleted it (it is downloaded again next boot)");
|
|
31374
|
-
}
|
|
31375
|
-
log("Installing the Visual C++ runtime ...");
|
|
31376
|
-
const code = await spawnAsync(installer, ["/install", "/quiet", "/norestart"]);
|
|
31377
|
-
if (!OK_EXIT_CODES.includes(code ?? -1) || !exists(path58.join(system322, "vcruntime140.dll")))
|
|
31378
|
-
throw new Error("the Visual C++ runtime installer failed (exit " + code + ")");
|
|
31379
|
-
}
|
|
31380
|
-
if (summary) env.summary.push("vc++ runtime: installed");
|
|
31381
|
-
return missing;
|
|
31556
|
+
env.summary.push("python2: " + path59.basename(py2).replace("python2-", ""));
|
|
31382
31557
|
}
|
|
31383
31558
|
|
|
31384
31559
|
// src/guest/toolchains/languages/php.ts
|
|
31560
|
+
import fs47 from "node:fs";
|
|
31561
|
+
import path60 from "node:path";
|
|
31385
31562
|
var PHP_EXTENSIONS = [
|
|
31386
31563
|
"curl",
|
|
31387
31564
|
"fileinfo",
|
|
@@ -31412,16 +31589,16 @@ var phpBuild = async (spec) => {
|
|
|
31412
31589
|
return { version: release.version, ...build.zip };
|
|
31413
31590
|
};
|
|
31414
31591
|
var writePhpIni = (home) => {
|
|
31415
|
-
const ini =
|
|
31416
|
-
if (exists(ini) || !exists(
|
|
31417
|
-
let text =
|
|
31418
|
-
for (const ext of PHP_EXTENSIONS.filter((e) => exists(
|
|
31592
|
+
const ini = path60.join(home, "php.ini");
|
|
31593
|
+
if (exists(ini) || !exists(path60.join(home, "php.ini-development"))) return;
|
|
31594
|
+
let text = fs47.readFileSync(path60.join(home, "php.ini-development"), "utf8").replace(/^;\s*extension_dir\s*=\s*"ext"/m, 'extension_dir = "' + path60.join(home, "ext") + '"');
|
|
31595
|
+
for (const ext of PHP_EXTENSIONS.filter((e) => exists(path60.join(home, "ext", "php_" + e + ".dll"))))
|
|
31419
31596
|
text = text.replace(new RegExp("^;(extension=" + ext + ")\\s*$", "m"), "$1");
|
|
31420
|
-
|
|
31421
|
-
|
|
31597
|
+
fs47.writeFileSync(ini + ".tmp", text);
|
|
31598
|
+
fs47.renameSync(ini + ".tmp", ini);
|
|
31422
31599
|
};
|
|
31423
31600
|
var shim2 = (env, name, command) => {
|
|
31424
|
-
|
|
31601
|
+
fs47.writeFileSync(path60.join(mkdirp(tool("shims")), name + ".cmd"), "@echo off\r\n" + command + " %*\r\n");
|
|
31425
31602
|
env.prepend.push(tool("shims"));
|
|
31426
31603
|
};
|
|
31427
31604
|
var setupComposer = async (env, php) => {
|
|
@@ -31433,7 +31610,7 @@ var setupComposer = async (env, php) => {
|
|
|
31433
31610
|
}
|
|
31434
31611
|
const composerHome = tool("composer-home");
|
|
31435
31612
|
env.vars.COMPOSER_HOME = composerHome;
|
|
31436
|
-
env.prepend.push(
|
|
31613
|
+
env.prepend.push(path60.join(composerHome, "vendor", "bin"));
|
|
31437
31614
|
shim2(env, "composer", '"' + php + '" "' + phar + '"');
|
|
31438
31615
|
env.summary.push(
|
|
31439
31616
|
"composer: " + (/\d+\.\d+\.\d+/.exec(execOutput(php, [phar, "--version", "--no-ansi"]))?.[0] ?? "installed")
|
|
@@ -31448,7 +31625,7 @@ async function setupPhp(env, config2) {
|
|
|
31448
31625
|
await setupVcRuntime(env, false);
|
|
31449
31626
|
const version2 = await resolveCached("php:" + wantedSpec.spec, async () => (await phpBuild(wantedSpec.spec)).version);
|
|
31450
31627
|
const home = tool("php", version2);
|
|
31451
|
-
if (!exists(
|
|
31628
|
+
if (!exists(path60.join(home, "php.exe"))) {
|
|
31452
31629
|
const build = await phpBuild(version2);
|
|
31453
31630
|
log("Downloading PHP " + version2 + " (~30 MB once) ...");
|
|
31454
31631
|
await downloader.archive("https://windows.php.net/downloads/releases/" + build.path, home, {
|
|
@@ -31460,11 +31637,11 @@ async function setupPhp(env, config2) {
|
|
|
31460
31637
|
writePhpIni(home);
|
|
31461
31638
|
env.prepend.push(home);
|
|
31462
31639
|
env.summary.push("php: " + version2 + " (from " + wantedSpec.source + ")");
|
|
31463
|
-
if (config2.composer) await setupComposer(env,
|
|
31640
|
+
if (config2.composer) await setupComposer(env, path60.join(home, "php.exe"));
|
|
31464
31641
|
}
|
|
31465
31642
|
|
|
31466
31643
|
// src/guest/toolchains/languages/ruby.ts
|
|
31467
|
-
import
|
|
31644
|
+
import path61 from "node:path";
|
|
31468
31645
|
var RUBY_ASSET = /^rubyinstaller-(\d+\.\d+\.\d+)-(\d+)-x64\.7z$/;
|
|
31469
31646
|
var buildNumber = (asset) => Number(RUBY_ASSET.exec(asset.name)?.[2] ?? 0);
|
|
31470
31647
|
var rubyBuilds = async () => {
|
|
@@ -31492,7 +31669,7 @@ async function setupRuby(env, config2) {
|
|
|
31492
31669
|
async () => pickPackageVersion([...(await rubyBuilds()).keys()], wantedSpec.spec) ?? Promise.reject(new Error('No RubyInstaller build matches "' + wantedSpec.spec + '"'))
|
|
31493
31670
|
);
|
|
31494
31671
|
const home = tool("ruby", version2);
|
|
31495
|
-
if (!exists(
|
|
31672
|
+
if (!exists(path61.join(home, "bin", "ruby.exe"))) {
|
|
31496
31673
|
const asset = (await rubyBuilds()).get(version2);
|
|
31497
31674
|
if (!asset) throw new Error("RubyInstaller " + version2 + " is no longer published");
|
|
31498
31675
|
log("Downloading Ruby " + version2 + " (~100 MB once) ...");
|
|
@@ -31505,11 +31682,11 @@ async function setupRuby(env, config2) {
|
|
|
31505
31682
|
}
|
|
31506
31683
|
const gems = tool("ruby-gems", version2.split(".").slice(0, 2).join("."));
|
|
31507
31684
|
Object.assign(env.vars, { GEM_HOME: gems, BUNDLE_USER_HOME: tool("bundle-home") });
|
|
31508
|
-
env.prepend.push(
|
|
31685
|
+
env.prepend.push(path61.join(home, "bin"), path61.join(gems, "bin"));
|
|
31509
31686
|
env.summary.push(
|
|
31510
|
-
"ruby: " + versionOf(
|
|
31687
|
+
"ruby: " + versionOf(path61.join(home, "bin", "ruby.exe")) + " (from " + wantedSpec.source + "; gems with C extensions need MSYS2, not included)"
|
|
31511
31688
|
);
|
|
31512
|
-
const gem =
|
|
31689
|
+
const gem = path61.join(home, "bin", "gem.cmd");
|
|
31513
31690
|
await installOnce(
|
|
31514
31691
|
env,
|
|
31515
31692
|
"gem@" + version2,
|
|
@@ -31521,9 +31698,9 @@ async function setupRuby(env, config2) {
|
|
|
31521
31698
|
}
|
|
31522
31699
|
|
|
31523
31700
|
// src/guest/toolchains/tools/vscode.ts
|
|
31524
|
-
import
|
|
31525
|
-
import
|
|
31526
|
-
import
|
|
31701
|
+
import fs48 from "node:fs";
|
|
31702
|
+
import os8 from "node:os";
|
|
31703
|
+
import path62 from "node:path";
|
|
31527
31704
|
|
|
31528
31705
|
// node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
31529
31706
|
var CharacterCodes;
|
|
@@ -31703,14 +31880,14 @@ var ParseErrorCode;
|
|
|
31703
31880
|
var VERSION_MARKER = ".agent-sandbox-version";
|
|
31704
31881
|
var desktopShortcut = (exe) => {
|
|
31705
31882
|
if (!isWin) return;
|
|
31706
|
-
const link =
|
|
31883
|
+
const link = path62.join(os8.homedir(), "Desktop", "Visual Studio Code.lnk");
|
|
31707
31884
|
runScriptWithJson("new-shortcuts.ps1", "ListFile", [
|
|
31708
31885
|
{ link, target: exe, arguments: '"' + (process.env.AGENT_WORKSPACE ?? "") + '"' }
|
|
31709
31886
|
]);
|
|
31710
31887
|
};
|
|
31711
31888
|
async function setupVscode(env, refresh) {
|
|
31712
31889
|
const root = tool("vscode");
|
|
31713
|
-
const exe =
|
|
31890
|
+
const exe = path62.join(root, "Code.exe");
|
|
31714
31891
|
if (dryRun) {
|
|
31715
31892
|
log("(dry run) would provision VS Code");
|
|
31716
31893
|
return;
|
|
@@ -31720,11 +31897,11 @@ async function setupVscode(env, refresh) {
|
|
|
31720
31897
|
"https://update.code.visualstudio.com/api/update/win32-" + (arch === "arm64" ? "arm64" : "x64") + "-archive/stable/latest"
|
|
31721
31898
|
);
|
|
31722
31899
|
log("Downloading VS Code " + release.productVersion + " (~150 MB once) ...");
|
|
31723
|
-
const keep =
|
|
31900
|
+
const keep = path62.join(root, "data");
|
|
31724
31901
|
const parked = root + "-data";
|
|
31725
31902
|
if (exists(keep)) {
|
|
31726
|
-
|
|
31727
|
-
|
|
31903
|
+
fs48.rmSync(parked, { recursive: true, force: true });
|
|
31904
|
+
fs48.renameSync(keep, parked);
|
|
31728
31905
|
}
|
|
31729
31906
|
try {
|
|
31730
31907
|
await downloader.archive(release.url, root, {
|
|
@@ -31732,26 +31909,26 @@ async function setupVscode(env, refresh) {
|
|
|
31732
31909
|
locate: "Code.exe",
|
|
31733
31910
|
fileName: "vscode.zip"
|
|
31734
31911
|
});
|
|
31735
|
-
|
|
31912
|
+
fs48.writeFileSync(path62.join(root, VERSION_MARKER), release.productVersion);
|
|
31736
31913
|
} finally {
|
|
31737
31914
|
if (exists(parked)) {
|
|
31738
31915
|
mkdirp(root);
|
|
31739
|
-
|
|
31740
|
-
|
|
31916
|
+
fs48.rmSync(keep, { recursive: true, force: true });
|
|
31917
|
+
fs48.renameSync(parked, keep);
|
|
31741
31918
|
}
|
|
31742
31919
|
}
|
|
31743
31920
|
}
|
|
31744
|
-
mkdirp(
|
|
31745
|
-
env.prepend.push(
|
|
31921
|
+
mkdirp(path62.join(root, "data"));
|
|
31922
|
+
env.prepend.push(path62.join(root, "bin"));
|
|
31746
31923
|
desktopShortcut(exe);
|
|
31747
|
-
const version2 = exists(
|
|
31924
|
+
const version2 = exists(path62.join(root, VERSION_MARKER)) ? fs48.readFileSync(path62.join(root, VERSION_MARKER), "utf8").trim() : "installed";
|
|
31748
31925
|
env.summary.push("vscode: " + version2 + " (portable; run code . or use the desktop shortcut)");
|
|
31749
31926
|
}
|
|
31750
31927
|
|
|
31751
31928
|
// src/guest/toolchains/native/rust-extras.ts
|
|
31752
|
-
import
|
|
31753
|
-
import
|
|
31754
|
-
import
|
|
31929
|
+
import fs49 from "node:fs";
|
|
31930
|
+
import os9 from "node:os";
|
|
31931
|
+
import path63 from "node:path";
|
|
31755
31932
|
|
|
31756
31933
|
// src/shared/memory/policy.ts
|
|
31757
31934
|
var DIAL_STEPS = {
|
|
@@ -31800,41 +31977,41 @@ function maxCompilers(cpus, profile) {
|
|
|
31800
31977
|
// src/guest/toolchains/native/rust-extras.ts
|
|
31801
31978
|
var cargoTarget = (targetDir) => {
|
|
31802
31979
|
if (targetDir === "shared" || targetDir === "separate") return null;
|
|
31803
|
-
if (targetDir === "local") return
|
|
31980
|
+
if (targetDir === "local") return path63.join(localDir, "cargo-target");
|
|
31804
31981
|
return targetDir;
|
|
31805
31982
|
};
|
|
31806
31983
|
function cargoShim(env, rust) {
|
|
31807
|
-
const real =
|
|
31984
|
+
const real = path63.join(tool("rust", "cargo", "bin"), "cargo.exe");
|
|
31808
31985
|
if (rust.targetDir !== "separate" || !exists(real)) return;
|
|
31809
31986
|
const dir = mkdirp(tool("shims", "cargo"));
|
|
31810
|
-
|
|
31987
|
+
fs49.copyFileSync(ensureCompiled("cargoshim"), path63.join(dir, "cargo.exe"));
|
|
31811
31988
|
env.prepend.unshift(dir);
|
|
31812
31989
|
env.vars.AGENT_REAL_CARGO = real;
|
|
31813
31990
|
}
|
|
31814
31991
|
function linkGate(env, rust, host) {
|
|
31815
31992
|
const gcc = tool("mingw", "mingw64", "bin", "gcc.exe");
|
|
31816
31993
|
if (!host.endsWith("-pc-windows-gnu") || !exists(gcc)) return;
|
|
31817
|
-
const gate =
|
|
31818
|
-
|
|
31819
|
-
const memoryGb =
|
|
31994
|
+
const gate = path63.join(mkdirp(tool("shims")), "linkgate.exe");
|
|
31995
|
+
fs49.copyFileSync(ensureCompiled("linkgate"), gate);
|
|
31996
|
+
const memoryGb = os9.totalmem() / 1024 ** 3;
|
|
31820
31997
|
const slots = rust.linkSlots === "auto" ? linkSlotsFor(memoryGb) : rust.linkSlots;
|
|
31821
31998
|
env.vars.AGENT_LINK_SLOTS = String(slots);
|
|
31822
31999
|
env.vars.AGENT_REAL_LINKER = gcc;
|
|
31823
32000
|
env.vars.CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER = gate;
|
|
31824
32001
|
const rustEnv = { ...process.env, RUSTUP_HOME: tool("rust", "rustup"), CARGO_HOME: tool("rust", "cargo") };
|
|
31825
32002
|
const sysroot = rust.linker === "lld" ? execOutput(tool("rust", "cargo", "bin", "rustc.exe"), ["--print", "sysroot"], { env: rustEnv }) : "";
|
|
31826
|
-
const lld = sysroot ?
|
|
31827
|
-
if (lld && exists(
|
|
32003
|
+
const lld = sysroot ? path63.join(sysroot, "lib", "rustlib", host, "bin", "gcc-ld") : "";
|
|
32004
|
+
if (lld && exists(path63.join(lld, "ld.lld.exe"))) env.vars.AGENT_LLD_DIR = lld;
|
|
31828
32005
|
env.summary.push(
|
|
31829
32006
|
"rust linking: " + (env.vars.AGENT_LLD_DIR ? "lld" : "GNU ld") + ", at most " + env.vars.AGENT_LINK_SLOTS + " at once"
|
|
31830
32007
|
);
|
|
31831
32008
|
}
|
|
31832
32009
|
function cargoDefaults(host) {
|
|
31833
32010
|
const file3 = tool("rust", "cargo", "config.toml");
|
|
31834
|
-
if (exists(file3) || !exists(
|
|
31835
|
-
const jobs = cargoJobs(
|
|
32011
|
+
if (exists(file3) || !exists(path63.dirname(file3))) return;
|
|
32012
|
+
const jobs = cargoJobs(os9.cpus().length, os9.totalmem() / 1024 ** 3, 1);
|
|
31836
32013
|
const gnu = host.endsWith("-gnu");
|
|
31837
|
-
|
|
32014
|
+
fs49.writeFileSync(
|
|
31838
32015
|
file3,
|
|
31839
32016
|
[
|
|
31840
32017
|
"# Written by windows-development-sandbox once; edit freely, it is never overwritten.",
|
|
@@ -31849,13 +32026,14 @@ function rustCaches(rust) {
|
|
|
31849
32026
|
const target = cargoTarget(rust.targetDir);
|
|
31850
32027
|
return {
|
|
31851
32028
|
...target ? { CARGO_TARGET_DIR: target } : {},
|
|
31852
|
-
...process.env.SCCACHE_DIR ? {} : { SCCACHE_DIR:
|
|
32029
|
+
...process.env.SCCACHE_DIR ? {} : { SCCACHE_DIR: path63.join(dataDir, "cache", "sccache") }
|
|
31853
32030
|
};
|
|
31854
32031
|
}
|
|
31855
32032
|
function rustHost(config2) {
|
|
31856
32033
|
if (config2.rust.host !== "auto") return config2.rust.host;
|
|
31857
32034
|
const cpu = arch === "arm64" ? "aarch64" : "x86_64";
|
|
31858
|
-
|
|
32035
|
+
const msvc = wanted(config2.msvc.enabled, "msvc") || wanted(config2.unreal.enabled, "unreal");
|
|
32036
|
+
return cpu + (msvc ? "-pc-windows-msvc" : "-pc-windows-gnu");
|
|
31859
32037
|
}
|
|
31860
32038
|
|
|
31861
32039
|
// src/guest/toolchains/languages/python-tools.ts
|
|
@@ -31875,6 +32053,7 @@ function plan(config2, versions, o) {
|
|
|
31875
32053
|
const apps = Boolean(o.apps && (o.apps.install.length || Object.keys(o.apps.custom).length));
|
|
31876
32054
|
const java = wanted(config2.java.enabled, "java");
|
|
31877
32055
|
const python = wanted(config2.python.enabled, "python");
|
|
32056
|
+
const unreal = wanted(config2.unreal.enabled, "unreal");
|
|
31878
32057
|
return [
|
|
31879
32058
|
{
|
|
31880
32059
|
name: "Git",
|
|
@@ -31892,12 +32071,18 @@ function plan(config2, versions, o) {
|
|
|
31892
32071
|
enabled: wanted(config2.cpp.enabled, "cpp") || wanted(config2.rust.enabled, "rust"),
|
|
31893
32072
|
install: (env) => setupCpp(env, config2.cpp)
|
|
31894
32073
|
},
|
|
31895
|
-
|
|
32074
|
+
// Unreal's Visual Studio brings MSVC and the real vswhere: the portable MSVC (and its stand-in vswhere) stays out.
|
|
32075
|
+
{ name: "Unreal", enabled: unreal, shared: true, install: (env) => setupUnreal(env, config2.unreal) },
|
|
32076
|
+
{
|
|
32077
|
+
name: "MSVC",
|
|
32078
|
+
enabled: wanted(config2.msvc.enabled, "msvc") && !unreal,
|
|
32079
|
+
install: (env) => setupMsvc(env, config2.msvc)
|
|
32080
|
+
},
|
|
31896
32081
|
// Rust links with MSVC (msvc host) or MinGW's gcc (GNU host): whichever it uses goes first.
|
|
31897
32082
|
{
|
|
31898
32083
|
name: "Rust",
|
|
31899
32084
|
enabled: wanted(config2.rust.enabled, "rust"),
|
|
31900
|
-
after: ["C/C++", "MSVC"],
|
|
32085
|
+
after: ["C/C++", "MSVC", "Unreal"],
|
|
31901
32086
|
install: async (env) => {
|
|
31902
32087
|
await setupRust(env, { ...config2.rust, host: rustHost(config2) }, o.refresh);
|
|
31903
32088
|
Object.assign(env.vars, rustCaches(config2.rust));
|
|
@@ -31990,7 +32175,7 @@ function plan(config2, versions, o) {
|
|
|
31990
32175
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
31991
32176
|
|
|
31992
32177
|
// src/guest/runtime/status.ts
|
|
31993
|
-
import
|
|
32178
|
+
import os10 from "node:os";
|
|
31994
32179
|
var progress;
|
|
31995
32180
|
function setSandboxStatus(phase, message, update) {
|
|
31996
32181
|
try {
|
|
@@ -32014,7 +32199,7 @@ function fitProgress(p) {
|
|
|
32014
32199
|
};
|
|
32015
32200
|
}
|
|
32016
32201
|
function ownAddresses() {
|
|
32017
|
-
return Object.values(
|
|
32202
|
+
return Object.values(os10.networkInterfaces()).flat().filter((i) => Boolean(i) && i.family === "IPv4" && !i.internal).map((i) => i.address).slice(0, 8);
|
|
32018
32203
|
}
|
|
32019
32204
|
function writeStatus(phase, message) {
|
|
32020
32205
|
writeJsonAtomic(run.sandboxFile, {
|
|
@@ -32159,21 +32344,21 @@ function cmdSet(env, names) {
|
|
|
32159
32344
|
return names.filter((n) => env[n] !== void 0 && !/[\r\n]/.test(String(env[n]))).map((n) => '@set "' + n + "=" + String(env[n]).replace(/%/g, "%%") + '"');
|
|
32160
32345
|
}
|
|
32161
32346
|
function writeShell(spec, env, names) {
|
|
32162
|
-
const dir = mkdirp(
|
|
32163
|
-
|
|
32164
|
-
|
|
32165
|
-
|
|
32166
|
-
['@call "' +
|
|
32347
|
+
const dir = mkdirp(path64.join(localDir, "projects", spec.name));
|
|
32348
|
+
fs50.writeFileSync(path64.join(dir, "env.cmd"), [...cmdSet(env, [...names, "PATH"]), ""].join("\r\n"));
|
|
32349
|
+
fs50.writeFileSync(
|
|
32350
|
+
path64.join(dir, "shell.cmd"),
|
|
32351
|
+
['@call "' + path64.join(dir, "env.cmd") + '"', '@cd /d "' + spec.workspace + '"', "@title " + spec.name, ""].join(
|
|
32167
32352
|
"\r\n"
|
|
32168
32353
|
)
|
|
32169
32354
|
);
|
|
32170
|
-
const bin = mkdirp(
|
|
32171
|
-
|
|
32172
|
-
|
|
32355
|
+
const bin = mkdirp(path64.join(localDir, "bin"));
|
|
32356
|
+
fs50.writeFileSync(
|
|
32357
|
+
path64.join(bin, "sbx-shell.cmd"),
|
|
32173
32358
|
[
|
|
32174
|
-
'@if "%~1"=="" (echo Usage: sbx-shell ^<project^> ^(a terminal in that project with its tools^) & dir /b "' +
|
|
32175
|
-
'@if not exist "' +
|
|
32176
|
-
'@cmd /k ""' +
|
|
32359
|
+
'@if "%~1"=="" (echo Usage: sbx-shell ^<project^> ^(a terminal in that project with its tools^) & dir /b "' + path64.join(localDir, "projects") + '" & exit /b 2)',
|
|
32360
|
+
'@if not exist "' + path64.join(localDir, "projects") + '\\%~1\\shell.cmd" (echo No project %~1 in this sandbox. & exit /b 2)',
|
|
32361
|
+
'@cmd /k ""' + path64.join(localDir, "projects") + '\\%~1\\shell.cmd""',
|
|
32177
32362
|
""
|
|
32178
32363
|
].join("\r\n")
|
|
32179
32364
|
);
|
|
@@ -32226,10 +32411,10 @@ async function setUp(spec, say) {
|
|
|
32226
32411
|
}
|
|
32227
32412
|
)
|
|
32228
32413
|
);
|
|
32229
|
-
tools.prepend.push(
|
|
32414
|
+
tools.prepend.push(path64.join(localDir, "bin"));
|
|
32230
32415
|
const env = agentEnv(tools, { workspace: spec.workspace, project: spec.name, base });
|
|
32231
|
-
const specFile =
|
|
32232
|
-
|
|
32416
|
+
const specFile = path64.join(mkdirp(path64.join(localDir, "projects", spec.name)), "project.json");
|
|
32417
|
+
fs50.writeFileSync(specFile, JSON.stringify(spec));
|
|
32233
32418
|
env.AGENT_PROJECT_FILE = specFile;
|
|
32234
32419
|
addMachineEnvironment(tools.vars, [...tools.prepend, ...tools.append], true);
|
|
32235
32420
|
try {
|
|
@@ -32346,10 +32531,10 @@ function execCommand(req) {
|
|
|
32346
32531
|
}
|
|
32347
32532
|
|
|
32348
32533
|
// src/guest/daemon/sessions.ts
|
|
32349
|
-
import
|
|
32350
|
-
import
|
|
32534
|
+
import fs54 from "node:fs";
|
|
32535
|
+
import path69 from "node:path";
|
|
32351
32536
|
import crypto4 from "node:crypto";
|
|
32352
|
-
import
|
|
32537
|
+
import os12 from "node:os";
|
|
32353
32538
|
import { spawn as spawn7 } from "node:child_process";
|
|
32354
32539
|
|
|
32355
32540
|
// src/shared/pty/protocol.ts
|
|
@@ -32428,7 +32613,7 @@ async function sendControl(endpoint, type) {
|
|
|
32428
32613
|
var MAX_CLIPBOARD_STRING = 1024 * 1024;
|
|
32429
32614
|
|
|
32430
32615
|
// src/guest/sessions/cmdline.ts
|
|
32431
|
-
import
|
|
32616
|
+
import path65 from "node:path";
|
|
32432
32617
|
var quoted = (arg) => '"' + arg.replace(/(\\*)"/g, '$1$1\\"').replace(/(\\+)$/, "$1$1") + '"';
|
|
32433
32618
|
function quoteArg(arg) {
|
|
32434
32619
|
return arg !== "" && !/[\s"]/.test(arg) ? arg : quoted(arg);
|
|
@@ -32442,7 +32627,7 @@ function cmdArgs(args) {
|
|
|
32442
32627
|
}).join("");
|
|
32443
32628
|
}
|
|
32444
32629
|
function commandLine(file3, args) {
|
|
32445
|
-
return
|
|
32630
|
+
return path65.win32.basename(file3).toLowerCase() === "cmd.exe" ? [quoteArg(file3), cmdArgs(args)].filter(Boolean).join(" ") : [file3, ...args].map(quoteArg).join(" ");
|
|
32446
32631
|
}
|
|
32447
32632
|
function shellLaunch(asked, paths) {
|
|
32448
32633
|
if (asked === "cmd") return { name: "cmd", file: paths.cmd, args: [] };
|
|
@@ -32456,8 +32641,8 @@ function shellLaunch(asked, paths) {
|
|
|
32456
32641
|
}
|
|
32457
32642
|
|
|
32458
32643
|
// src/guest/sessions/pty-host.ts
|
|
32459
|
-
import
|
|
32460
|
-
import
|
|
32644
|
+
import fs51 from "node:fs";
|
|
32645
|
+
import path66 from "node:path";
|
|
32461
32646
|
import { execFile, spawn as spawn6 } from "node:child_process";
|
|
32462
32647
|
function ensurePtyHost() {
|
|
32463
32648
|
return ensureCompiled("ptyhost");
|
|
@@ -32476,21 +32661,21 @@ async function waitForPtyHost(child, port, timeoutMs) {
|
|
|
32476
32661
|
throw new Error("the session host did not start listening on port " + port);
|
|
32477
32662
|
}
|
|
32478
32663
|
function ptyHostLog(id) {
|
|
32479
|
-
return
|
|
32664
|
+
return path66.join(logsDir, "ptyhost-" + id + ".log");
|
|
32480
32665
|
}
|
|
32481
32666
|
function ptyHostLogTail(id, lines = 12) {
|
|
32482
32667
|
try {
|
|
32483
|
-
return
|
|
32668
|
+
return fs51.readFileSync(ptyHostLog(id), "utf8").trim().split(/\r?\n/).slice(-lines).join("\n");
|
|
32484
32669
|
} catch {
|
|
32485
32670
|
return "";
|
|
32486
32671
|
}
|
|
32487
32672
|
}
|
|
32488
32673
|
var conptyDll = () => {
|
|
32489
|
-
const dll =
|
|
32490
|
-
return session.provisioning.conpty?.enabled !== false &&
|
|
32674
|
+
const dll = path66.join(toolsDir, "conpty", "conpty.dll");
|
|
32675
|
+
return session.provisioning.conpty?.enabled !== false && fs51.existsSync(dll) && fs51.existsSync(path66.join(toolsDir, "conpty", "OpenConsole.exe")) ? dll : null;
|
|
32491
32676
|
};
|
|
32492
32677
|
function startPtyHost(o) {
|
|
32493
|
-
|
|
32678
|
+
fs51.mkdirSync(run.treesDir, { recursive: true });
|
|
32494
32679
|
const env = {
|
|
32495
32680
|
...o.env,
|
|
32496
32681
|
PTYHOST_BIND: o.remote ? "any" : "loopback",
|
|
@@ -32508,13 +32693,13 @@ function startPtyHost(o) {
|
|
|
32508
32693
|
var END_TREE_MS = 3e4;
|
|
32509
32694
|
function endLeftoverTree(id, exe = ensurePtyHost()) {
|
|
32510
32695
|
const file3 = run.treeFile(id);
|
|
32511
|
-
if (!
|
|
32696
|
+
if (!fs51.existsSync(file3)) return Promise.resolve(null);
|
|
32512
32697
|
return new Promise((resolve2) => {
|
|
32513
32698
|
execFile(exe, ["--end-tree", file3], { timeout: END_TREE_MS, windowsHide: true }, (error62, stdout) => {
|
|
32514
32699
|
const code = error62 ? typeof error62.code === "number" ? error62.code : -1 : 0;
|
|
32515
32700
|
if (code !== 3)
|
|
32516
32701
|
try {
|
|
32517
|
-
|
|
32702
|
+
fs51.rmSync(file3, { force: true });
|
|
32518
32703
|
} catch {
|
|
32519
32704
|
}
|
|
32520
32705
|
resolve2(code === 0 ? stdout.trim().slice(0, 200) : code === 3 ? null : "could not end them (code " + code + ")");
|
|
@@ -32523,15 +32708,15 @@ function endLeftoverTree(id, exe = ensurePtyHost()) {
|
|
|
32523
32708
|
}
|
|
32524
32709
|
function recordedTrees() {
|
|
32525
32710
|
try {
|
|
32526
|
-
return
|
|
32711
|
+
return fs51.readdirSync(run.treesDir).filter((n) => /^[A-Za-z0-9_-]{1,64}\.json$/.test(n)).map((n) => n.slice(0, -".json".length));
|
|
32527
32712
|
} catch {
|
|
32528
32713
|
return [];
|
|
32529
32714
|
}
|
|
32530
32715
|
}
|
|
32531
32716
|
|
|
32532
32717
|
// src/guest/agents/agent-installer.ts
|
|
32533
|
-
import
|
|
32534
|
-
import
|
|
32718
|
+
import fs52 from "node:fs";
|
|
32719
|
+
import path67 from "node:path";
|
|
32535
32720
|
|
|
32536
32721
|
// src/guest/agents/profile-links.ts
|
|
32537
32722
|
var profileRoot = () => process.env.USERPROFILE ?? "";
|
|
@@ -32557,7 +32742,7 @@ var agentPaths2 = (name, harness) => agentPaths(toolsDir, name, harness);
|
|
|
32557
32742
|
async function installViaNpm(name, harness, dir, env) {
|
|
32558
32743
|
if (!harness.npmPackage)
|
|
32559
32744
|
throw new Error("No npmPackage configured for " + name + " and no host executable was available.");
|
|
32560
|
-
const npmCli =
|
|
32745
|
+
const npmCli = path67.join(path67.dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js");
|
|
32561
32746
|
const args = [npmCli, "install", "--global", "--prefix", dir, harness.npmPackage, "--no-fund", "--no-audit"];
|
|
32562
32747
|
log("Installing " + harness.npmPackage + " (this can take a minute)...");
|
|
32563
32748
|
if (dryRun) {
|
|
@@ -32568,7 +32753,7 @@ async function installViaNpm(name, harness, dir, env) {
|
|
|
32568
32753
|
await execAsync(process.execPath, args, { env });
|
|
32569
32754
|
}
|
|
32570
32755
|
async function installViaUv(name, harness, dir, env) {
|
|
32571
|
-
const uv =
|
|
32756
|
+
const uv = path67.join(toolsDir, "uv", "uv.exe");
|
|
32572
32757
|
log("Installing " + harness.uvPackage + " with uv (this can take a minute)...");
|
|
32573
32758
|
if (dryRun) {
|
|
32574
32759
|
log("(dry run) uv tool install " + harness.uvPackage);
|
|
@@ -32583,8 +32768,8 @@ async function installViaUv(name, harness, dir, env) {
|
|
|
32583
32768
|
});
|
|
32584
32769
|
}
|
|
32585
32770
|
function putOnPath(dir, env) {
|
|
32586
|
-
const parts2 = (env.PATH ?? "").split(
|
|
32587
|
-
if (!parts2.some((p) => p.toLowerCase() === dir.toLowerCase())) env.PATH = [...parts2, dir].join(
|
|
32771
|
+
const parts2 = (env.PATH ?? "").split(path67.delimiter);
|
|
32772
|
+
if (!parts2.some((p) => p.toLowerCase() === dir.toLowerCase())) env.PATH = [...parts2, dir].join(path67.delimiter);
|
|
32588
32773
|
addMachineEnvironment({}, [dir], true);
|
|
32589
32774
|
}
|
|
32590
32775
|
var AgentInstaller = class {
|
|
@@ -32625,9 +32810,9 @@ var AgentInstaller = class {
|
|
|
32625
32810
|
}
|
|
32626
32811
|
mkdirp(p.dir);
|
|
32627
32812
|
if (this.sourceOf(name, harness) === "host") {
|
|
32628
|
-
const source =
|
|
32813
|
+
const source = path67.join(hostToolsDir, "agents", name, harness.hostExecutable);
|
|
32629
32814
|
if (exists(source) && p.exe) {
|
|
32630
|
-
|
|
32815
|
+
fs52.copyFileSync(source, p.exe);
|
|
32631
32816
|
log("Copied " + name + " from this PC: " + source);
|
|
32632
32817
|
return;
|
|
32633
32818
|
}
|
|
@@ -32642,28 +32827,28 @@ var AgentInstaller = class {
|
|
|
32642
32827
|
var agents = new AgentInstaller();
|
|
32643
32828
|
|
|
32644
32829
|
// src/guest/network/addresses.ts
|
|
32645
|
-
import
|
|
32830
|
+
import os11 from "node:os";
|
|
32646
32831
|
function guestAddresses() {
|
|
32647
|
-
return Object.values(
|
|
32832
|
+
return Object.values(os11.networkInterfaces()).flat().filter((i) => Boolean(i) && i.family === "IPv4" && !i.internal).map((i) => i.address);
|
|
32648
32833
|
}
|
|
32649
32834
|
|
|
32650
32835
|
// src/guest/sessions/conversation.ts
|
|
32651
|
-
import
|
|
32652
|
-
import
|
|
32836
|
+
import fs53 from "node:fs";
|
|
32837
|
+
import path68 from "node:path";
|
|
32653
32838
|
var MAX_FILES = 2e3;
|
|
32654
32839
|
function conversationFiles(claudeDir2, cwd) {
|
|
32655
32840
|
const names = /* @__PURE__ */ new Set([projectFolderName(cwd), projectFolderName(sandboxFolder(cwd))]);
|
|
32656
32841
|
return [...names].flatMap((name) => {
|
|
32657
|
-
const dir =
|
|
32842
|
+
const dir = path68.join(claudeDir2, "projects", name);
|
|
32658
32843
|
let entries2;
|
|
32659
32844
|
try {
|
|
32660
|
-
entries2 =
|
|
32845
|
+
entries2 = fs53.readdirSync(dir);
|
|
32661
32846
|
} catch {
|
|
32662
32847
|
return [];
|
|
32663
32848
|
}
|
|
32664
32849
|
return entries2.filter((e) => e.endsWith(".jsonl") && isConversationId(e.slice(0, -".jsonl".length))).slice(0, MAX_FILES).flatMap((e) => {
|
|
32665
32850
|
try {
|
|
32666
|
-
return [{ id: e.slice(0, -".jsonl".length), createdMs:
|
|
32851
|
+
return [{ id: e.slice(0, -".jsonl".length), createdMs: fs53.statSync(path68.join(dir, e)).birthtimeMs }];
|
|
32667
32852
|
} catch {
|
|
32668
32853
|
return [];
|
|
32669
32854
|
}
|
|
@@ -32704,8 +32889,8 @@ var IdleShutdown = class {
|
|
|
32704
32889
|
var CLOSE_WAIT_MS = 8e3;
|
|
32705
32890
|
var ROOTS_KEPT_MS = 10 * 60 * 1e3;
|
|
32706
32891
|
function terminalTab(id, title, cwd) {
|
|
32707
|
-
const view = [process.execPath,
|
|
32708
|
-
const wt =
|
|
32892
|
+
const view = [process.execPath, path69.join(path69.dirname(process.argv[1]), "view.js"), id];
|
|
32893
|
+
const wt = path69.join(toolsDir, "terminal", "wt.exe");
|
|
32709
32894
|
if (exists(wt))
|
|
32710
32895
|
spawn7(wt, ["-w", "0", "nt", "--title", title, "-d", cwd, ...view], { detached: true, stdio: "ignore" }).unref();
|
|
32711
32896
|
else spawn7(SYSTEM.cmd(), ["/d", "/c", "start", title, ...view], { detached: true, stdio: "ignore", cwd }).unref();
|
|
@@ -32721,8 +32906,8 @@ var harnessFor = (req) => {
|
|
|
32721
32906
|
function memoryEnv(env, sessions2) {
|
|
32722
32907
|
const out = {};
|
|
32723
32908
|
out.PTYHOST_BACKSTOP_MB = String(session.agentBackstop ?? "auto");
|
|
32724
|
-
const cpus = usableCpus(
|
|
32725
|
-
const memoryGb =
|
|
32909
|
+
const cpus = usableCpus(os12.cpus().length, session.cpuLimitPercent ?? null);
|
|
32910
|
+
const memoryGb = os12.totalmem() / 1024 ** 3;
|
|
32726
32911
|
const jobs = cargoJobs(cpus, memoryGb, sessions2);
|
|
32727
32912
|
out.NUMBER_OF_PROCESSORS = String(cpus);
|
|
32728
32913
|
if (!env.CARGO_BUILD_JOBS) out.CARGO_BUILD_JOBS = String(jobs);
|
|
@@ -32761,10 +32946,10 @@ var agentProgram = async (req, env, say) => {
|
|
|
32761
32946
|
};
|
|
32762
32947
|
function shellPaths() {
|
|
32763
32948
|
const candidates = [
|
|
32764
|
-
|
|
32765
|
-
|
|
32949
|
+
path69.join(pwshDir(), "pwsh.exe"),
|
|
32950
|
+
path69.join(process.env.ProgramFiles ?? "C:\\Program Files", "PowerShell", "7", "pwsh.exe")
|
|
32766
32951
|
];
|
|
32767
|
-
return { pwsh: candidates.find((f) =>
|
|
32952
|
+
return { pwsh: candidates.find((f) => fs54.existsSync(f)) ?? null, powershell: SYSTEM.powershell(), cmd: SYSTEM.cmd() };
|
|
32768
32953
|
}
|
|
32769
32954
|
var shellProgram = (shell) => {
|
|
32770
32955
|
const line = commandLine(shell.file, shell.args);
|
|
@@ -32798,7 +32983,7 @@ var launchPtyHost = async (req, program, remote, env, sessions2, onSpawn) => {
|
|
|
32798
32983
|
} catch (e) {
|
|
32799
32984
|
const tail = ptyHostLogTail(req.id);
|
|
32800
32985
|
throw new Error(
|
|
32801
|
-
errMsg(e) + (tail ? ". From its log:\n" + tail : "") + "\nLog: " +
|
|
32986
|
+
errMsg(e) + (tail ? ". From its log:\n" + tail : "") + "\nLog: " + path69.join(dataDir, "logs", "ptyhost-" + req.id + ".log")
|
|
32802
32987
|
);
|
|
32803
32988
|
}
|
|
32804
32989
|
return { child, port, token };
|
|
@@ -32912,7 +33097,7 @@ var SessionManager = class {
|
|
|
32912
33097
|
};
|
|
32913
33098
|
this.starting++;
|
|
32914
33099
|
if (req.id !== session.launchId && process.env.AGENT_NO_TABS !== "1")
|
|
32915
|
-
safely("terminal tab", () => terminalTab(req.id, name + " " +
|
|
33100
|
+
safely("terminal tab", () => terminalTab(req.id, name + " " + path69.basename(req.cwd), req.cwd));
|
|
32916
33101
|
try {
|
|
32917
33102
|
if (problem) throw new Error(problem);
|
|
32918
33103
|
const place = await placeFor(req, say);
|
|
@@ -33406,9 +33591,9 @@ var GovernorCore = class {
|
|
|
33406
33591
|
};
|
|
33407
33592
|
|
|
33408
33593
|
// src/guest/governor/governor.ts
|
|
33409
|
-
import
|
|
33410
|
-
import
|
|
33411
|
-
import
|
|
33594
|
+
import fs55 from "node:fs";
|
|
33595
|
+
import os13 from "node:os";
|
|
33596
|
+
import path70 from "node:path";
|
|
33412
33597
|
import { spawn as spawn8 } from "node:child_process";
|
|
33413
33598
|
import { createInterface } from "node:readline";
|
|
33414
33599
|
var SampleSchema = external_exports.object({
|
|
@@ -33478,12 +33663,12 @@ var MemGovProcess = class {
|
|
|
33478
33663
|
};
|
|
33479
33664
|
function appendToMemoryLog(line) {
|
|
33480
33665
|
try {
|
|
33481
|
-
const logs =
|
|
33482
|
-
const newest =
|
|
33666
|
+
const logs = path70.join(dataDir, "logs");
|
|
33667
|
+
const newest = fs55.readdirSync(logs).filter((f) => /^memory-\d{8}-\d{6}\.log$/.test(f)).sort().pop();
|
|
33483
33668
|
if (!newest) return;
|
|
33484
33669
|
const t = /* @__PURE__ */ new Date();
|
|
33485
33670
|
const stamp = [t.getHours(), t.getMinutes(), t.getSeconds()].map((n) => String(n).padStart(2, "0")).join(":");
|
|
33486
|
-
|
|
33671
|
+
fs55.appendFileSync(path70.join(logs, newest), stamp + " | " + line + "\r\n");
|
|
33487
33672
|
} catch {
|
|
33488
33673
|
}
|
|
33489
33674
|
}
|
|
@@ -33501,7 +33686,7 @@ var Governor = class {
|
|
|
33501
33686
|
this.core = new GovernorCore({
|
|
33502
33687
|
port: proc,
|
|
33503
33688
|
profile,
|
|
33504
|
-
maxCompilers: maxCompilers(
|
|
33689
|
+
maxCompilers: maxCompilers(os13.cpus().length, profile),
|
|
33505
33690
|
now: () => Date.now(),
|
|
33506
33691
|
logLine: appendToMemoryLog,
|
|
33507
33692
|
warn,
|
|
@@ -33523,13 +33708,13 @@ var Governor = class {
|
|
|
33523
33708
|
var governor = new Governor();
|
|
33524
33709
|
|
|
33525
33710
|
// src/guest/daemon/live.ts
|
|
33526
|
-
import
|
|
33527
|
-
import
|
|
33711
|
+
import fs57 from "node:fs";
|
|
33712
|
+
import path72 from "node:path";
|
|
33528
33713
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
33529
33714
|
|
|
33530
33715
|
// src/guest/daemon/live-folders.ts
|
|
33531
|
-
import
|
|
33532
|
-
import
|
|
33716
|
+
import fs56 from "node:fs";
|
|
33717
|
+
import path71 from "node:path";
|
|
33533
33718
|
|
|
33534
33719
|
// src/shared/channel/live.ts
|
|
33535
33720
|
import crypto5 from "node:crypto";
|
|
@@ -33622,7 +33807,7 @@ var LiveFolderHandler = class {
|
|
|
33622
33807
|
}
|
|
33623
33808
|
read() {
|
|
33624
33809
|
try {
|
|
33625
|
-
const text =
|
|
33810
|
+
const text = fs56.readFileSync(this.o.stateFile, "utf8");
|
|
33626
33811
|
const parsed = StateSchema.safeParse(JSON.parse(text));
|
|
33627
33812
|
if (parsed.success && parsed.data.launchId === this.o.launchId) return parsed.data;
|
|
33628
33813
|
} catch {
|
|
@@ -33630,7 +33815,7 @@ var LiveFolderHandler = class {
|
|
|
33630
33815
|
return { key: null, launchId: this.o.launchId, seen: [], mappings: [] };
|
|
33631
33816
|
}
|
|
33632
33817
|
save(state) {
|
|
33633
|
-
|
|
33818
|
+
fs56.mkdirSync(path71.dirname(this.o.stateFile), { recursive: true });
|
|
33634
33819
|
writeJsonAtomic(this.o.stateFile, state);
|
|
33635
33820
|
}
|
|
33636
33821
|
/** The key the boot handed over (from the one-shot secrets file). */
|
|
@@ -33641,30 +33826,30 @@ var LiveFolderHandler = class {
|
|
|
33641
33826
|
/** C:\Workspace\<name> from a checked name only. */
|
|
33642
33827
|
folderPath(name) {
|
|
33643
33828
|
if (!LIVE_FOLDER_NAME.test(name)) throw new Error("not a plain folder name");
|
|
33644
|
-
return
|
|
33829
|
+
return path71.win32.join(this.o.workspaces ?? WORKSPACES_GUEST, name);
|
|
33645
33830
|
}
|
|
33646
33831
|
/** One pass over run\live: every file is claimed (deleted) at once; valid ones are handled one after another. */
|
|
33647
33832
|
tick() {
|
|
33648
33833
|
const dir = this.o.run.liveDir;
|
|
33649
33834
|
let names;
|
|
33650
33835
|
try {
|
|
33651
|
-
names =
|
|
33836
|
+
names = fs56.readdirSync(dir);
|
|
33652
33837
|
} catch {
|
|
33653
33838
|
return;
|
|
33654
33839
|
}
|
|
33655
33840
|
for (const name of names.slice(0, 64)) {
|
|
33656
33841
|
if (name.endsWith(".tmp")) continue;
|
|
33657
|
-
const file3 =
|
|
33842
|
+
const file3 = path71.join(dir, name);
|
|
33658
33843
|
let envelope = null;
|
|
33659
33844
|
try {
|
|
33660
|
-
const stat =
|
|
33845
|
+
const stat = fs56.lstatSync(file3);
|
|
33661
33846
|
if (stat.isFile() && stat.size <= MAX_REQUEST_BYTES && /^[A-Za-z0-9_-]{1,64}\.json$/.test(name))
|
|
33662
|
-
envelope = JSON.parse(
|
|
33847
|
+
envelope = JSON.parse(fs56.readFileSync(file3, "utf8"));
|
|
33663
33848
|
} catch {
|
|
33664
33849
|
envelope = null;
|
|
33665
33850
|
} finally {
|
|
33666
33851
|
try {
|
|
33667
|
-
|
|
33852
|
+
fs56.rmSync(file3, { recursive: true, force: true });
|
|
33668
33853
|
} catch {
|
|
33669
33854
|
}
|
|
33670
33855
|
}
|
|
@@ -33701,7 +33886,7 @@ var LiveFolderHandler = class {
|
|
|
33701
33886
|
}
|
|
33702
33887
|
reply(id, r) {
|
|
33703
33888
|
try {
|
|
33704
|
-
|
|
33889
|
+
fs56.mkdirSync(this.o.run.liveRepliesDir, { recursive: true });
|
|
33705
33890
|
writeJsonAtomic(this.o.run.liveReplyFile(id), { id, ...r, finishedAt: new Date(this.now()).toISOString() });
|
|
33706
33891
|
} catch (e) {
|
|
33707
33892
|
this.log("live folder reply not written: " + errMsg(e));
|
|
@@ -33722,14 +33907,14 @@ var LiveFolderHandler = class {
|
|
|
33722
33907
|
assertFree(folder) {
|
|
33723
33908
|
let exists2 = true;
|
|
33724
33909
|
try {
|
|
33725
|
-
|
|
33910
|
+
fs56.lstatSync(folder);
|
|
33726
33911
|
} catch {
|
|
33727
33912
|
exists2 = false;
|
|
33728
33913
|
}
|
|
33729
33914
|
if (exists2) throw new Error(folder + " exists already");
|
|
33730
|
-
const parent =
|
|
33731
|
-
|
|
33732
|
-
if (!
|
|
33915
|
+
const parent = path71.dirname(folder);
|
|
33916
|
+
fs56.mkdirSync(parent, { recursive: true });
|
|
33917
|
+
if (!fs56.lstatSync(parent).isDirectory()) throw new Error(parent + " is not a plain folder");
|
|
33733
33918
|
}
|
|
33734
33919
|
async act(p) {
|
|
33735
33920
|
const folder = this.folderPath(p.folder);
|
|
@@ -33750,9 +33935,9 @@ var LiveFolderHandler = class {
|
|
|
33750
33935
|
const code2 = await this.mapWithRetry(folder, share, true);
|
|
33751
33936
|
if (code2 !== EXIT_OK) return { ok: false, message: "the test share could not be shown (" + code2 + ")" };
|
|
33752
33937
|
try {
|
|
33753
|
-
const file3 =
|
|
33754
|
-
const stat =
|
|
33755
|
-
const token = stat.size <= 64 ?
|
|
33938
|
+
const file3 = path71.join(folder, "token.txt");
|
|
33939
|
+
const stat = fs56.statSync(file3);
|
|
33940
|
+
const token = stat.size <= 64 ? fs56.readFileSync(file3, "utf8").trim() : "";
|
|
33756
33941
|
return LIVE_TOKEN.test(token) ? { ok: true, message: "read the test share", token } : { ok: false, message: "the test share holds no token" };
|
|
33757
33942
|
} finally {
|
|
33758
33943
|
this.o.bind.unmap(folder);
|
|
@@ -33780,7 +33965,7 @@ var LiveFolderHandler = class {
|
|
|
33780
33965
|
for (const m of this.read().mappings) {
|
|
33781
33966
|
const folder = this.folderPath(m.folder);
|
|
33782
33967
|
if (this.o.bind.mapped(folder) === EXIT_OK) continue;
|
|
33783
|
-
|
|
33968
|
+
fs56.mkdirSync(path71.dirname(folder), { recursive: true });
|
|
33784
33969
|
if (this.o.bind.map(folder, m.share, m.readOnly) === EXIT_OK) done++;
|
|
33785
33970
|
else this.log("live folder " + folder + " could not be shown again");
|
|
33786
33971
|
}
|
|
@@ -33791,7 +33976,7 @@ var LiveFolderHandler = class {
|
|
|
33791
33976
|
// src/guest/daemon/live.ts
|
|
33792
33977
|
var BIND_TIMEOUT_MS = 3e4;
|
|
33793
33978
|
var testing = Boolean(process.env.AGENT_DAEMON_STATE_DIR || process.env.AGENT_LOCAL_DIR);
|
|
33794
|
-
var stateDir2 = process.env.AGENT_DAEMON_STATE_DIR ?? (process.env.AGENT_LOCAL_DIR ?
|
|
33979
|
+
var stateDir2 = process.env.AGENT_DAEMON_STATE_DIR ?? (process.env.AGENT_LOCAL_DIR ? path72.join(localDir, "daemon-state") : path72.join(process.env.ProgramData ?? "C:\\ProgramData", "AgentSandboxDaemon"));
|
|
33795
33980
|
function bindMount(args) {
|
|
33796
33981
|
const r = spawnSync7(ensureCompiled("bindmount"), args, {
|
|
33797
33982
|
windowsHide: true,
|
|
@@ -33806,7 +33991,7 @@ var realBind = {
|
|
|
33806
33991
|
mapped: (folder) => bindMount(["mapped", folder])
|
|
33807
33992
|
};
|
|
33808
33993
|
function protectStateDir() {
|
|
33809
|
-
|
|
33994
|
+
fs57.mkdirSync(stateDir2, { recursive: true });
|
|
33810
33995
|
if (!isWin || testMode || testing) return;
|
|
33811
33996
|
spawnSync7(
|
|
33812
33997
|
SYSTEM.icacls(),
|
|
@@ -33819,7 +34004,7 @@ function protectStateDir() {
|
|
|
33819
34004
|
}
|
|
33820
34005
|
var liveFolders = new LiveFolderHandler({
|
|
33821
34006
|
run,
|
|
33822
|
-
stateFile:
|
|
34007
|
+
stateFile: path72.join(stateDir2, "live-folders.json"),
|
|
33823
34008
|
launchId: session.launchId,
|
|
33824
34009
|
bind: realBind,
|
|
33825
34010
|
log: warn
|
|
@@ -33849,9 +34034,9 @@ var Daemon = class {
|
|
|
33849
34034
|
tick() {
|
|
33850
34035
|
const { valid, invalid } = run.scanRequests();
|
|
33851
34036
|
for (const file3 of invalid)
|
|
33852
|
-
safely("removing an invalid request", () =>
|
|
34037
|
+
safely("removing an invalid request", () => fs58.rmSync(file3, { recursive: true, force: true }));
|
|
33853
34038
|
for (const req of valid) {
|
|
33854
|
-
safely("claiming a request", () =>
|
|
34039
|
+
safely("claiming a request", () => fs58.rmSync(run.requestFile(req.id), { force: true }));
|
|
33855
34040
|
if (run.readSession(req.id)) continue;
|
|
33856
34041
|
void Promise.resolve(this.handle(withRequestSecrets(req))).catch(
|
|
33857
34042
|
(e) => respond(req.id, { ok: false, message: errMsg(e) })
|