@demicodes/shell 0.16.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +32 -28
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1313,32 +1313,34 @@ var BashEnvironment = class {
|
|
|
1313
1313
|
for (const clear of timers) clear();
|
|
1314
1314
|
for (const remove of listeners) remove();
|
|
1315
1315
|
};
|
|
1316
|
-
if (!foreground)
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1316
|
+
if (!foreground) {
|
|
1317
|
+
if (session.foreground) foreground = session.foreground;
|
|
1318
|
+
else return {
|
|
1319
|
+
promise: new Promise((resolve) => {
|
|
1320
|
+
if (externalSignal?.aborted) {
|
|
1321
|
+
resolve({ kind: "aborted" });
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
const timeoutIn = Math.max(0, timeoutMs - (Date.now() - operationStartedAt));
|
|
1325
|
+
const t = setTimeout(() => resolve({ kind: "timeout" }), timeoutIn);
|
|
1326
|
+
timers.push(() => clearTimeout(t));
|
|
1327
|
+
const onForeground = (nextForeground) => {
|
|
1328
|
+
resolve({
|
|
1329
|
+
kind: "foreground_appeared",
|
|
1330
|
+
foreground: nextForeground
|
|
1331
|
+
});
|
|
1332
|
+
};
|
|
1333
|
+
session.foregroundWaiters.add(onForeground);
|
|
1334
|
+
listeners.push(() => session.foregroundWaiters.delete(onForeground));
|
|
1335
|
+
if (externalSignal) {
|
|
1336
|
+
const onExternal = () => resolve({ kind: "aborted" });
|
|
1337
|
+
externalSignal.addEventListener("abort", onExternal, { once: true });
|
|
1338
|
+
listeners.push(() => externalSignal.removeEventListener("abort", onExternal));
|
|
1339
|
+
}
|
|
1340
|
+
}),
|
|
1341
|
+
cancel
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1342
1344
|
const fg = foreground;
|
|
1343
1345
|
return {
|
|
1344
1346
|
promise: new Promise((resolve) => {
|
|
@@ -1659,8 +1661,10 @@ function streamView(record, stream, explicitOffset, maxOutputBytes) {
|
|
|
1659
1661
|
const delta = utf8Slice(text, boundedOffset, boundedOffset + (byteLimit === 0 ? available : Math.min(available, byteLimit)));
|
|
1660
1662
|
const nextOffset = boundedOffset + utf8Bytes(delta);
|
|
1661
1663
|
const truncated = nextOffset < totalBytes;
|
|
1662
|
-
if (explicitOffset === void 0)
|
|
1663
|
-
|
|
1664
|
+
if (explicitOffset === void 0) {
|
|
1665
|
+
if (stream === "stdout") record.stdoutOffset = nextOffset;
|
|
1666
|
+
else record.stderrOffset = nextOffset;
|
|
1667
|
+
}
|
|
1664
1668
|
return {
|
|
1665
1669
|
path: `${record.artifactDir}/${stream}.txt`,
|
|
1666
1670
|
offset: nextOffset,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@demicodes/shell",
|
|
3
3
|
"description": "Sandboxable bash engine and Host contract for Demi.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.17.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@demicodes/just-bash": "^3.1.0-demi.3",
|
|
23
|
-
"@demicodes/utils": "^0.
|
|
23
|
+
"@demicodes/utils": "^0.17.1",
|
|
24
24
|
"zod": "^4.0.0"
|
|
25
25
|
},
|
|
26
26
|
"license": "Apache-2.0",
|