@poe-platform/safe-bash 0.1.770 → 0.1.772
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/safe-bash/chunks/{chunk-FSH7QRIC.js → chunk-Z3HX3ZBA.js} +10 -4
- package/dist/safe-bash/commands/python/host-capabilities.js +15 -6
- package/dist/safe-bash/commands/python/index.browser.js +1 -1
- package/dist/safe-bash/core.browser.js +7 -3
- package/dist/safe-bash/shell/runtime.js +7 -2
- package/package.json +2 -2
|
@@ -1431,7 +1431,6 @@ function createPythonHostBridge(capabilities, options) {
|
|
|
1431
1431
|
const pull = async (handle) => {
|
|
1432
1432
|
const stream = streams.get(handle);
|
|
1433
1433
|
if (!stream) throw new Error("Unknown Python host stream");
|
|
1434
|
-
stream.busy = true;
|
|
1435
1434
|
try {
|
|
1436
1435
|
const result = await stream.iterator.next();
|
|
1437
1436
|
assertLive();
|
|
@@ -1451,8 +1450,6 @@ function createPythonHostBridge(capabilities, options) {
|
|
|
1451
1450
|
} catch (error) {
|
|
1452
1451
|
if (streams.has(handle)) await release(handle);
|
|
1453
1452
|
throw error;
|
|
1454
|
-
} finally {
|
|
1455
|
-
stream.busy = false;
|
|
1456
1453
|
}
|
|
1457
1454
|
};
|
|
1458
1455
|
const request = async (incoming) => {
|
|
@@ -1480,9 +1477,12 @@ function createPythonHostBridge(capabilities, options) {
|
|
|
1480
1477
|
if (payload.operation === "begin" || payload.operation === "begin-next") {
|
|
1481
1478
|
let work;
|
|
1482
1479
|
let child;
|
|
1480
|
+
let reservedStream;
|
|
1483
1481
|
if (payload.operation === "begin-next") {
|
|
1484
1482
|
const stream = typeof payload.handle === "number" ? streams.get(payload.handle) : void 0;
|
|
1485
1483
|
if (!stream || stream.busy) throw new Error("Unknown or busy Python host stream");
|
|
1484
|
+
reservedStream = stream;
|
|
1485
|
+
stream.busy = true;
|
|
1486
1486
|
child = stream.controller;
|
|
1487
1487
|
work = () => pull(payload.handle);
|
|
1488
1488
|
} else {
|
|
@@ -1505,6 +1505,7 @@ function createPythonHostBridge(capabilities, options) {
|
|
|
1505
1505
|
}).catch((error) => {
|
|
1506
1506
|
job.failed = pythonHostFailureCode(error);
|
|
1507
1507
|
}).finally(() => {
|
|
1508
|
+
if (reservedStream) reservedStream.busy = false;
|
|
1508
1509
|
jobWork.delete(task);
|
|
1509
1510
|
});
|
|
1510
1511
|
jobWork.add(task);
|
|
@@ -1520,7 +1521,12 @@ function createPythonHostBridge(capabilities, options) {
|
|
|
1520
1521
|
await release(handle);
|
|
1521
1522
|
return null;
|
|
1522
1523
|
}
|
|
1523
|
-
|
|
1524
|
+
stream.busy = true;
|
|
1525
|
+
try {
|
|
1526
|
+
return await pull(handle);
|
|
1527
|
+
} finally {
|
|
1528
|
+
stream.busy = false;
|
|
1529
|
+
}
|
|
1524
1530
|
}
|
|
1525
1531
|
if (typeof payload.capability !== "string") throw new TypeError("Invalid Python host capability");
|
|
1526
1532
|
const capability = registry.get(payload.capability);
|
|
@@ -108,7 +108,6 @@ export function createPythonHostBridge(capabilities, options) {
|
|
|
108
108
|
const stream = streams.get(handle);
|
|
109
109
|
if (!stream)
|
|
110
110
|
throw new Error('Unknown Python host stream');
|
|
111
|
-
stream.busy = true;
|
|
112
111
|
try {
|
|
113
112
|
const result = await stream.iterator.next();
|
|
114
113
|
assertLive();
|
|
@@ -133,9 +132,6 @@ export function createPythonHostBridge(capabilities, options) {
|
|
|
133
132
|
await release(handle);
|
|
134
133
|
throw error;
|
|
135
134
|
}
|
|
136
|
-
finally {
|
|
137
|
-
stream.busy = false;
|
|
138
|
-
}
|
|
139
135
|
};
|
|
140
136
|
const request = async (incoming) => {
|
|
141
137
|
assertLive();
|
|
@@ -168,10 +164,13 @@ export function createPythonHostBridge(capabilities, options) {
|
|
|
168
164
|
if (payload.operation === 'begin' || payload.operation === 'begin-next') {
|
|
169
165
|
let work;
|
|
170
166
|
let child;
|
|
167
|
+
let reservedStream;
|
|
171
168
|
if (payload.operation === 'begin-next') {
|
|
172
169
|
const stream = typeof payload.handle === 'number' ? streams.get(payload.handle) : undefined;
|
|
173
170
|
if (!stream || stream.busy)
|
|
174
171
|
throw new Error('Unknown or busy Python host stream');
|
|
172
|
+
reservedStream = stream;
|
|
173
|
+
stream.busy = true;
|
|
175
174
|
child = stream.controller;
|
|
176
175
|
work = () => pull(payload.handle);
|
|
177
176
|
}
|
|
@@ -193,7 +192,11 @@ export function createPythonHostBridge(capabilities, options) {
|
|
|
193
192
|
assertLive();
|
|
194
193
|
child.signal.throwIfAborted();
|
|
195
194
|
job.result = data(value);
|
|
196
|
-
}).catch(error => { job.failed = pythonHostFailureCode(error); }).finally(() => {
|
|
195
|
+
}).catch(error => { job.failed = pythonHostFailureCode(error); }).finally(() => {
|
|
196
|
+
if (reservedStream)
|
|
197
|
+
reservedStream.busy = false;
|
|
198
|
+
jobWork.delete(task);
|
|
199
|
+
});
|
|
197
200
|
jobWork.add(task);
|
|
198
201
|
return handle;
|
|
199
202
|
}
|
|
@@ -210,7 +213,13 @@ export function createPythonHostBridge(capabilities, options) {
|
|
|
210
213
|
await release(handle);
|
|
211
214
|
return null;
|
|
212
215
|
}
|
|
213
|
-
|
|
216
|
+
stream.busy = true;
|
|
217
|
+
try {
|
|
218
|
+
return await pull(handle);
|
|
219
|
+
}
|
|
220
|
+
finally {
|
|
221
|
+
stream.busy = false;
|
|
222
|
+
}
|
|
214
223
|
}
|
|
215
224
|
if (typeof payload.capability !== 'string')
|
|
216
225
|
throw new TypeError('Invalid Python host capability');
|
|
@@ -158,7 +158,7 @@ import {
|
|
|
158
158
|
sha256,
|
|
159
159
|
sha384,
|
|
160
160
|
sha512
|
|
161
|
-
} from "./chunks/chunk-
|
|
161
|
+
} from "./chunks/chunk-Z3HX3ZBA.js";
|
|
162
162
|
import {
|
|
163
163
|
PythonFailure,
|
|
164
164
|
inspectPythonCapabilities
|
|
@@ -85666,6 +85666,10 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
85666
85666
|
}
|
|
85667
85667
|
}
|
|
85668
85668
|
if (files.length === 0) files.push("-");
|
|
85669
|
+
if (rawLines === void 0) {
|
|
85670
|
+
if (files.includes("-")) return void 0;
|
|
85671
|
+
rawLines = [];
|
|
85672
|
+
}
|
|
85669
85673
|
if (!files.every((f) => f === "-")) {
|
|
85670
85674
|
if (cwd === void 0) return rawLines.length === 0 ? [] : void 0;
|
|
85671
85675
|
const stdinCount = files.filter((f) => f === "-").length;
|
|
@@ -90450,7 +90454,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
90450
90454
|
let cjLines;
|
|
90451
90455
|
if (w0Plain === "comm") cjLines = this.evalSyncComm(stdinLines, allArgs, rawState.cwd);
|
|
90452
90456
|
else if (w0Plain === "join") cjLines = this.evalSyncJoin(stdinLines, allArgs, rawState.cwd);
|
|
90453
|
-
else if (w0Plain === "paste") cjLines = this.evalSyncPaste(stdinLines
|
|
90457
|
+
else if (w0Plain === "paste") cjLines = this.evalSyncPaste(stdinLines, allArgs, rawState.cwd);
|
|
90454
90458
|
else if (w0Plain === "factor") cjLines = this.evalSyncFactor(stdinLines, allArgs);
|
|
90455
90459
|
else if (w0Plain === "tsort") cjLines = this.evalSyncTsort(stdinLines, allArgs, rawState.cwd);
|
|
90456
90460
|
else if (w0Plain === "jq") cjLines = this.evalSyncJq(void 0, allArgs, rawState.cwd);
|
|
@@ -90607,7 +90611,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
90607
90611
|
const nlRes = !hasSingleHereStringRedir && !hasSingleStdinRedir && opArgs.some((a) => !a.startsWith("-")) ? this.evalSyncNl([], allArgs, rawState.cwd) : this.evalSyncNl(rawLines, opArgs, rawState.cwd);
|
|
90608
90612
|
if (nlRes !== void 0) fileRes = renderLines(nlRes);
|
|
90609
90613
|
} else if (w0Plain === "paste") {
|
|
90610
|
-
const pasteRes = hasSingleHereStringRedir || hasSingleStdinRedir ? this.evalSyncPaste(rawLines, opArgs, rawState.cwd) : this.evalSyncPaste(
|
|
90614
|
+
const pasteRes = hasSingleHereStringRedir || hasSingleStdinRedir ? this.evalSyncPaste(rawLines, opArgs, rawState.cwd) : this.evalSyncPaste(void 0, allArgs, rawState.cwd);
|
|
90611
90615
|
if (pasteRes !== void 0) fileRes = renderLines(pasteRes);
|
|
90612
90616
|
} else if (w0Plain === "comm") {
|
|
90613
90617
|
const commRes = hasSingleHereStringRedir || hasSingleStdinRedir ? this.evalSyncComm(rawLines, opArgs, rawState.cwd) : this.evalSyncComm([], allArgs, rawState.cwd);
|
|
@@ -31988,6 +31988,11 @@ export class Runtime {
|
|
|
31988
31988
|
}
|
|
31989
31989
|
if (files.length === 0)
|
|
31990
31990
|
files.push("-");
|
|
31991
|
+
if (rawLines === undefined) {
|
|
31992
|
+
if (files.includes("-"))
|
|
31993
|
+
return undefined;
|
|
31994
|
+
rawLines = [];
|
|
31995
|
+
}
|
|
31991
31996
|
if (!files.every(f => f === "-")) {
|
|
31992
31997
|
if (cwd === undefined)
|
|
31993
31998
|
return rawLines.length === 0 ? [] : undefined;
|
|
@@ -38414,7 +38419,7 @@ export class Runtime {
|
|
|
38414
38419
|
else if (w0Plain === "join")
|
|
38415
38420
|
cjLines = this.evalSyncJoin(stdinLines, allArgs, rawState.cwd);
|
|
38416
38421
|
else if (w0Plain === "paste")
|
|
38417
|
-
cjLines = this.evalSyncPaste(stdinLines
|
|
38422
|
+
cjLines = this.evalSyncPaste(stdinLines, allArgs, rawState.cwd);
|
|
38418
38423
|
else if (w0Plain === "factor")
|
|
38419
38424
|
cjLines = this.evalSyncFactor(stdinLines, allArgs);
|
|
38420
38425
|
else if (w0Plain === "tsort")
|
|
@@ -38637,7 +38642,7 @@ export class Runtime {
|
|
|
38637
38642
|
fileRes = renderLines(nlRes);
|
|
38638
38643
|
}
|
|
38639
38644
|
else if (w0Plain === "paste") {
|
|
38640
|
-
const pasteRes = (hasSingleHereStringRedir || hasSingleStdinRedir) ? this.evalSyncPaste(rawLines, opArgs, rawState.cwd) : this.evalSyncPaste(
|
|
38645
|
+
const pasteRes = (hasSingleHereStringRedir || hasSingleStdinRedir) ? this.evalSyncPaste(rawLines, opArgs, rawState.cwd) : this.evalSyncPaste(undefined, allArgs, rawState.cwd);
|
|
38641
38646
|
if (pasteRes !== undefined)
|
|
38642
38647
|
fileRes = renderLines(pasteRes);
|
|
38643
38648
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poe-platform/safe-bash",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.772",
|
|
4
4
|
"description": "Extensible virtual shell with pluggable filesystems and streaming commands",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -841,7 +841,7 @@
|
|
|
841
841
|
"access": "public"
|
|
842
842
|
},
|
|
843
843
|
"dependencies": {
|
|
844
|
-
"@poe-platform/safe-fs": "0.1.
|
|
844
|
+
"@poe-platform/safe-fs": "0.1.772",
|
|
845
845
|
"pdf-lib": "1.17.1",
|
|
846
846
|
"@noble/hashes": "2.4.0",
|
|
847
847
|
"pako": "3.0.1",
|