@poe-platform/safe-bash 0.1.798 → 0.1.799
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/README.md +2 -1
- package/dist/safe-bash/chunks/{chunk-XH26YVGW.js → chunk-AZAJJVFX.js} +1 -11
- package/dist/safe-bash/chunks/{chunk-CSNXID73.js → chunk-SPYL72GN.js} +1 -25
- package/dist/safe-bash/chunks/{chunk-AMTCC256.js → chunk-TRVGCN3U.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-V3VEATEA.js → chunk-WUNK5NXJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JG5W2ENK.js → chunk-43GSSUAY.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-OAJUAAWH.js → chunk-464RVBGB.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-25BLI6S6.js → chunk-4Y3WVMK4.js} +1 -14
- package/dist/safe-bash/command-chunks/{chunk-SSBFTMVI.js → chunk-4ZALPDBV.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-YMQKVEIF.js → chunk-52PCQXD2.js} +2 -13
- package/dist/safe-bash/command-chunks/{chunk-ZCKDQGKY.js → chunk-5HDSFHGW.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JHVZYB4R.js → chunk-5MPOQ6V3.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AUAF5YBT.js → chunk-5WPI42ZW.js} +0 -7
- package/dist/safe-bash/command-chunks/{chunk-PPOIPMY4.js → chunk-5ZSM4UFN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-RECJB2BO.js → chunk-7BS66BXN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GRWOVSFK.js → chunk-7D7JRRML.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-E6IYUYVA.js → chunk-7L24L4UO.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-HBXQWTJR.js → chunk-A5ZAV6DO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-LW34AKDM.js → chunk-AB4MXHVS.js} +4 -14
- package/dist/safe-bash/command-chunks/{chunk-EELNLEEP.js → chunk-AXK3H4PX.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Y55OCH37.js → chunk-AYUTO323.js} +3 -10
- package/dist/safe-bash/command-chunks/{chunk-DY36FDDC.js → chunk-B5BKA5WH.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-YB6KVU6H.js → chunk-BDBVVZY6.js} +4 -14
- package/dist/safe-bash/command-chunks/{chunk-QAN7KKDZ.js → chunk-BZDDAPSV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-HZCPWYWA.js → chunk-BZPAWTUL.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-RT2J5ATD.js → chunk-CPPGTBZF.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JEPY4UY4.js → chunk-EIVW3X3N.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-QGVOS3EY.js → chunk-HFII3QYO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-5EWTQJSC.js → chunk-HHP343KT.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-5UA3BEGA.js → chunk-I3K5RYU4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4MS5WZJC.js → chunk-IKS2YXZQ.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-CZVBYCB5.js → chunk-IL53SJL4.js} +2 -12
- package/dist/safe-bash/command-chunks/{chunk-HLMUPSM6.js → chunk-JCNNOMBV.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-2LLZBNLL.js → chunk-JWE54GHQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QLDIP3OP.js → chunk-JZSNU2MY.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-2HOESGFJ.js → chunk-KMCZ6P4O.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-U3ONEICA.js → chunk-KVFCSLKK.js} +1 -11
- package/dist/safe-bash/command-chunks/{chunk-THS4YAKG.js → chunk-LLCXZKZ6.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-3TANKHBX.js → chunk-MRW5HD2D.js} +1 -6
- package/dist/safe-bash/command-chunks/{chunk-3WKA57FA.js → chunk-N5FGCXQJ.js} +1 -9
- package/dist/safe-bash/command-chunks/{chunk-ULZ7HIZP.js → chunk-NETECMOF.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2Q7UQ7R4.js → chunk-OPUJSTHS.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-HVI6ALJF.js → chunk-PFAADCB5.js} +2 -4
- package/dist/safe-bash/command-chunks/{chunk-JXU2N6GN.js → chunk-Q7Q5GM5S.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-Z5TFSVNU.js → chunk-QAKKSRNV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KAHH4XOU.js → chunk-QNXI2UP6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WYOL5JNT.js → chunk-SX2X3IH4.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-WBJKOTSP.js → chunk-UI32HWGS.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AC6X7Q4I.js → chunk-VVI4Z73I.js} +1 -8
- package/dist/safe-bash/command-chunks/{chunk-JCVXAX2G.js → chunk-XWZBMJ5B.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-23XLM73P.js → chunk-YEOPI5SK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-PRCT7FKJ.js → chunk-YZ5SVZFD.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-OGUMMTTD.js → chunk-ZJBR5Q5I.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-VZ64JXHC.js → chunk-ZS3QPNUL.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-VKQCNX32.js → chunk-ZT4KSS2V.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-6N5V4VBN.js → chunk-ZXKW7SJ2.js} +2 -2
- package/dist/safe-bash/commands/diff-patch/shared.d.ts +0 -2
- package/dist/safe-bash/commands/diff-patch/shared.js +2 -11
- package/dist/safe-bash/commands/text.js +1 -25
- package/dist/safe-bash/full-core.browser.js +4 -4
- package/dist/safe-bash/opt-in/commands/dd/index.js +4 -13
- package/dist/safe-bash/opt-in/commands/yq/native-work.js +2 -1
- package/dist/safe-bash/opt-in/optional/commands/shuf/input.js +3 -21
- package/dist/safe-bash/opt-in/optional/commands/shuf/shuf.js +4 -27
- package/dist/safe-bash/plugins/index.browser.js +3 -3
- package/dist/safe-bash/registry-entry.browser.js +2 -2
- package/dist/safe-bash/shell-entry.browser.js +2 -2
- package/dist/safe-bash-command-dd/index.js +4 -13
- package/dist/safe-bash-command-du/budget.d.ts +0 -2
- package/dist/safe-bash-command-du/budget.js +1 -1
- package/dist/safe-bash-command-du/du.js +2 -2
- package/dist/safe-bash-command-du/index.js +2 -2
- package/dist/safe-bash-command-file/index.js +1 -1
- package/dist/safe-bash-command-file/shared.d.ts +0 -2
- package/dist/safe-bash-command-file/shared.js +1 -1
- package/dist/safe-bash-command-fmt/index.js +3 -15
- package/dist/safe-bash-command-html-to-markdown/budget.d.ts +0 -3
- package/dist/safe-bash-command-html-to-markdown/budget.js +1 -1
- package/dist/safe-bash-command-html-to-markdown/entities.js +3 -3
- package/dist/safe-bash-command-html-to-markdown/index.js +6 -6
- package/dist/safe-bash-command-html-to-markdown/input.js +5 -5
- package/dist/safe-bash-command-html-to-markdown/parser.js +4 -4
- package/dist/safe-bash-command-html-to-markdown/render.js +5 -5
- package/dist/safe-bash-command-html-to-markdown/text.js +2 -2
- package/dist/safe-bash-command-iconv/command.js +5 -5
- package/dist/safe-bash-command-iconv/index.js +5 -5
- package/dist/safe-bash-command-iconv/internal.d.ts +0 -2
- package/dist/safe-bash-command-iconv/internal.js +1 -1
- package/dist/safe-bash-command-iconv/lifecycle.js +2 -2
- package/dist/safe-bash-command-iconv/options.js +2 -2
- package/dist/safe-bash-command-iconv/reader.js +2 -2
- package/dist/safe-bash-command-numfmt/index.js +4 -18
- package/dist/safe-bash-command-pr/command.js +5 -5
- package/dist/safe-bash-command-pr/format.js +2 -2
- package/dist/safe-bash-command-pr/index.js +5 -5
- package/dist/safe-bash-command-pr/internal.d.ts +0 -2
- package/dist/safe-bash-command-pr/internal.js +1 -1
- package/dist/safe-bash-command-pr/io.js +2 -2
- package/dist/safe-bash-command-pr/options.js +2 -2
- package/dist/safe-bash-command-shuf/input.js +3 -21
- package/dist/safe-bash-command-shuf/shuf.js +4 -27
- package/dist/safe-bash-command-split/index.js +3 -3
- package/dist/safe-bash-command-split/io.d.ts +0 -2
- package/dist/safe-bash-command-split/io.js +1 -1
- package/dist/safe-bash-command-split/outputs.js +2 -2
- package/dist/safe-bash-command-split/split.js +3 -3
- package/dist/safe-bash-command-tree/arguments.js +3 -3
- package/dist/safe-bash-command-tree/charset.js +1 -1
- package/dist/safe-bash-command-tree/index.js +4 -4
- package/dist/safe-bash-command-tree/io.d.ts +0 -1
- package/dist/safe-bash-command-tree/io.js +1 -1
- package/dist/safe-bash-command-tree/pattern.js +2 -2
- package/dist/safe-bash-command-tree/tree.js +4 -4
- package/dist/safe-bash-command-tsort/command.js +4 -4
- package/dist/safe-bash-command-tsort/graph.js +2 -2
- package/dist/safe-bash-command-tsort/index.js +4 -4
- package/dist/safe-bash-command-tsort/internal.d.ts +0 -2
- package/dist/safe-bash-command-tsort/internal.js +1 -1
- package/dist/safe-bash-command-tsort/io.js +2 -2
- package/dist/safe-bash-command-yq/native-work.js +2 -1
- package/dist/safe-bash-io-engine/commands/archive/internal.d.ts +0 -1
- package/dist/safe-bash-io-engine/commands/archive/internal.js +3 -7
- package/dist/safe-bash-io-engine/shell/pattern.js +1 -1
- package/dist/safe-bash-io-engine/shell/string-operations.d.ts +0 -2
- package/dist/safe-bash-io-engine/shell/string-operations.js +1 -1
- package/dist/safe-bash-line-ending-engine/internal.d.ts +0 -2
- package/dist/safe-bash-line-ending-engine/internal.js +1 -9
- package/dist/safe-bash-query-engine/capture.js +5 -5
- package/dist/safe-bash-query-engine/dates.js +2 -2
- package/dist/safe-bash-query-engine/delpaths.js +5 -5
- package/dist/safe-bash-query-engine/formats.js +3 -3
- package/dist/safe-bash-query-engine/index.js +15 -15
- package/dist/safe-bash-query-engine/indices.js +5 -5
- package/dist/safe-bash-query-engine/input.js +2 -2
- package/dist/safe-bash-query-engine/interpreter.js +13 -13
- package/dist/safe-bash-query-engine/limits.js +1 -1
- package/dist/safe-bash-query-engine/parser.js +2 -2
- package/dist/safe-bash-query-engine/query-core.js +15 -15
- package/dist/safe-bash-query-engine/recurse.js +2 -2
- package/dist/safe-bash-query-engine/regex.js +5 -5
- package/dist/safe-bash-query-engine/split.js +2 -2
- package/dist/safe-bash-query-engine/splits.js +6 -6
- package/dist/safe-bash-query-engine/values.js +4 -4
- package/dist/safe-bash-regex-engine/ere/limits.d.ts +0 -1
- package/dist/safe-bash-regex-engine/ere/limits.js +1 -1
- package/dist/safe-bash-regex-engine/ere/matcher.js +5 -5
- package/dist/safe-bash-regex-engine/ere/syntax.js +2 -2
- package/dist/safe-bash-regex-engine/execution/bounded-provider.js +2 -4
- package/dist/safe-bash-text-stream-engine/stream-format/shared.d.ts +0 -2
- package/dist/safe-bash-text-stream-engine/stream-format/shared.js +1 -9
- package/dist/safe-bash-xml-engine/document.js +2 -2
- package/dist/safe-bash-xml-engine/index.js +3 -3
- package/dist/safe-bash-xml-engine/io.js +1 -1
- package/dist/safe-bash-xml-engine/limits.d.ts +0 -2
- package/dist/safe-bash-xml-engine/limits.js +1 -1
- package/dist/safe-bash-xml-engine/query.js +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -704,7 +704,8 @@ through `maxArguments`, `maxArgumentBytes`, and `maxOutputBytes`.
|
|
|
704
704
|
`timeEnv.maxTimerMilliseconds` and `timeout.maxTimerMilliseconds` accept `Infinity`;
|
|
705
705
|
host timer calls remain capped at 2147483647 ms and progress with frozen clocks.
|
|
706
706
|
Use the [typed options and linked family interfaces](src/plugins/index.ts) for
|
|
707
|
-
their individual limits and hooks, including clocks and schedulers.
|
|
707
|
+
their individual limits and hooks, including clocks and schedulers. Command and
|
|
708
|
+
shell work quanta yield to the host even when its clock is frozen. Family budgets
|
|
708
709
|
are separate from shell counters; `limits.commandLimits.archive` supplies
|
|
709
710
|
invocation ceilings. Per-execution family overrides merge with the shell's
|
|
710
711
|
profile, and non-Worker hosts can configure larger limits. `replace` applies
|
|
@@ -53,7 +53,6 @@ import {
|
|
|
53
53
|
dirname,
|
|
54
54
|
isPathWithin,
|
|
55
55
|
joinPath,
|
|
56
|
-
monotonicNow,
|
|
57
56
|
normalizePath,
|
|
58
57
|
relativePath,
|
|
59
58
|
resolvePath,
|
|
@@ -188,8 +187,6 @@ var Budget = class _Budget {
|
|
|
188
187
|
lines = 0;
|
|
189
188
|
work = 0;
|
|
190
189
|
nextYield = 4096;
|
|
191
|
-
yieldChecks = 0;
|
|
192
|
-
nextYieldTime = monotonicNow() + 8;
|
|
193
190
|
files = 0;
|
|
194
191
|
hunks = 0;
|
|
195
192
|
signalAborted;
|
|
@@ -211,15 +208,8 @@ var Budget = class _Budget {
|
|
|
211
208
|
checkpoint() {
|
|
212
209
|
if (this.pollSignal ? this.context.signal.aborted : this.signalAborted) this.context.signal.throwIfAborted();
|
|
213
210
|
if (this.work >= this.nextYield) {
|
|
214
|
-
const firstYield = this.nextYield === 4096;
|
|
215
211
|
this.nextYield = this.work + 4096;
|
|
216
|
-
|
|
217
|
-
if (++this.yieldChecks % 16 === 0 || firstYield || now >= this.nextYieldTime) {
|
|
218
|
-
this.nextYieldTime = now + 16;
|
|
219
|
-
return yieldTurn(this.context.signal).then(() => {
|
|
220
|
-
this.nextYieldTime = monotonicNow() + 16;
|
|
221
|
-
});
|
|
222
|
-
}
|
|
212
|
+
return yieldTurn(this.context.signal);
|
|
223
213
|
}
|
|
224
214
|
}
|
|
225
215
|
file() {
|
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
virtualPath,
|
|
87
87
|
wcDisplayWidth,
|
|
88
88
|
write
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-AZAJJVFX.js";
|
|
90
90
|
import {
|
|
91
91
|
createGetoptCommands
|
|
92
92
|
} from "./chunk-3L3T6LYV.js";
|
|
@@ -166,7 +166,6 @@ import {
|
|
|
166
166
|
dirname,
|
|
167
167
|
hasYieldCheckpoint,
|
|
168
168
|
monotonicNow,
|
|
169
|
-
runYieldCheckpoint,
|
|
170
169
|
yieldTurn
|
|
171
170
|
} from "./chunk-VYZTG3GV.js";
|
|
172
171
|
import {
|
|
@@ -9028,35 +9027,12 @@ var SortWork = class {
|
|
|
9028
9027
|
}
|
|
9029
9028
|
signal;
|
|
9030
9029
|
#pending = 0;
|
|
9031
|
-
#syncTurns = 0;
|
|
9032
|
-
#lastYield = monotonicNow();
|
|
9033
9030
|
charge(units = 1) {
|
|
9034
9031
|
this.#pending += units;
|
|
9035
9032
|
if (this.#pending >= 4096) {
|
|
9036
|
-
if (!hasYieldCheckpoint(this.signal)) {
|
|
9037
|
-
while (this.#pending >= 4096) {
|
|
9038
|
-
this.#pending -= 4096;
|
|
9039
|
-
runYieldCheckpoint(this.signal);
|
|
9040
|
-
this.signal.throwIfAborted();
|
|
9041
|
-
if (++this.#syncTurns % 8 === 0) {
|
|
9042
|
-
const now = monotonicNow();
|
|
9043
|
-
if (this.#syncTurns >= 256 || now - this.#lastYield >= 16) {
|
|
9044
|
-
this.#syncTurns = 0;
|
|
9045
|
-
this.#lastYield = now;
|
|
9046
|
-
return this.#checkpointOnce();
|
|
9047
|
-
}
|
|
9048
|
-
}
|
|
9049
|
-
}
|
|
9050
|
-
return void 0;
|
|
9051
|
-
}
|
|
9052
9033
|
return this.#checkpoint();
|
|
9053
9034
|
}
|
|
9054
9035
|
}
|
|
9055
|
-
async #checkpointOnce() {
|
|
9056
|
-
await yieldTurn(this.signal);
|
|
9057
|
-
this.#lastYield = monotonicNow();
|
|
9058
|
-
this.signal.throwIfAborted();
|
|
9059
|
-
}
|
|
9060
9036
|
async #checkpoint() {
|
|
9061
9037
|
while (this.#pending >= 4096) {
|
|
9062
9038
|
this.#pending -= 4096;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parse
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-I3K5RYU4.js";
|
|
4
4
|
import {
|
|
5
5
|
Interpreter
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OPUJSTHS.js";
|
|
7
7
|
import {
|
|
8
8
|
Budget,
|
|
9
9
|
JqLimitError,
|
|
10
10
|
objectKeys,
|
|
11
11
|
wellFormed
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VVI4Z73I.js";
|
|
13
13
|
import {
|
|
14
14
|
utf8ByteLength
|
|
15
15
|
} from "./chunk-PDKXAR4Y.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sort
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7BS66BXN.js";
|
|
4
4
|
import {
|
|
5
5
|
Lifecycle,
|
|
6
6
|
Reader
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-A5ZAV6DO.js";
|
|
8
8
|
import {
|
|
9
9
|
Budget,
|
|
10
10
|
TsortError,
|
|
11
11
|
quote,
|
|
12
12
|
settings
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-IL53SJL4.js";
|
|
14
14
|
import {
|
|
15
15
|
init_buffer
|
|
16
16
|
} from "./chunk-HX3SHTCE.js";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
// packages/safe-bash-command-html-to-markdown/src/budget.ts
|
|
6
6
|
init_buffer();
|
|
7
7
|
import { utf8ByteLength, bytesFrom } from "../../safe-bash-byte-engine/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { yieldTurn } from "../../safe-bash-contracts/yield.js";
|
|
9
9
|
import { FsError, writeBytes } from "../../safe-bash-contracts/index.js";
|
|
10
10
|
function asciiOrUtf8ByteLength(text) {
|
|
11
11
|
const len = text.length;
|
|
@@ -19,7 +19,6 @@ var Budget = class {
|
|
|
19
19
|
this.context = context;
|
|
20
20
|
this.limits = limits;
|
|
21
21
|
const signal = context.signal;
|
|
22
|
-
this.hasExtYield = hasYieldCheckpoint(signal);
|
|
23
22
|
this.aborted = Boolean(signal.aborted);
|
|
24
23
|
this.pollSignal = typeof signal.addEventListener !== "function" || Object.prototype.hasOwnProperty.call(signal, "aborted");
|
|
25
24
|
if (!this.aborted && !this.pollSignal) {
|
|
@@ -37,9 +36,6 @@ var Budget = class {
|
|
|
37
36
|
cells = 0;
|
|
38
37
|
workUsed = 0;
|
|
39
38
|
sinceYield = 0;
|
|
40
|
-
checkpoints = 0;
|
|
41
|
-
lastYieldTime = monotonicNow();
|
|
42
|
-
hasExtYield;
|
|
43
39
|
aborted;
|
|
44
40
|
pollSignal;
|
|
45
41
|
check(amount, remaining, name) {
|
|
@@ -57,18 +53,9 @@ var Budget = class {
|
|
|
57
53
|
if (this.aborted || this.pollSignal && this.context.signal.aborted) this.context.signal.throwIfAborted();
|
|
58
54
|
if (this.sinceYield >= 4096) {
|
|
59
55
|
this.sinceYield = 0;
|
|
60
|
-
const count = ++this.checkpoints;
|
|
61
|
-
const now = monotonicNow();
|
|
62
|
-
if (!this.hasExtYield && count > 1 && count % 16 !== 0 && now - this.lastYieldTime < 16) {
|
|
63
|
-
runYieldCheckpoint(this.context.signal);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
this.lastYieldTime = now;
|
|
67
56
|
return yieldTurn(this.context.signal).then(() => {
|
|
68
|
-
this.lastYieldTime = monotonicNow();
|
|
69
57
|
if (this.aborted || this.pollSignal && this.context.signal.aborted) this.context.signal.throwIfAborted();
|
|
70
58
|
}, (error) => {
|
|
71
|
-
this.lastYieldTime = monotonicNow();
|
|
72
59
|
if (this.aborted || this.pollSignal && this.context.signal.aborted) this.context.signal.throwIfAborted();
|
|
73
60
|
throw error;
|
|
74
61
|
});
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// packages/safe-bash-io-engine/src/shell/string-operations.ts
|
|
6
6
|
init_buffer();
|
|
7
|
-
import {
|
|
7
|
+
import { yieldTurn } from "../../safe-bash-contracts/yield.js";
|
|
8
8
|
function stringCheckpoint(work, units = 1) {
|
|
9
9
|
work.signal.throwIfAborted();
|
|
10
10
|
work.remaining -= units;
|
|
@@ -12,18 +12,7 @@ function stringCheckpoint(work, units = 1) {
|
|
|
12
12
|
work.steps = (work.steps ?? 0) + units;
|
|
13
13
|
if (work.steps < 128) return void 0;
|
|
14
14
|
work.steps %= 128;
|
|
15
|
-
|
|
16
|
-
const firstYield = work.lastYield === void 0;
|
|
17
|
-
const lastYield = work.lastYield ??= now;
|
|
18
|
-
work.yieldChecks = (work.yieldChecks ?? 0) + 1;
|
|
19
|
-
if (work.yieldChecks % 16 === 0 || firstYield || hasYieldCheckpoint(work.signal) || now - lastYield >= 1) {
|
|
20
|
-
work.lastYield = now;
|
|
21
|
-
return yieldTurn(work.signal).then(() => {
|
|
22
|
-
work.lastYield = monotonicNow();
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
runYieldCheckpoint(work.signal);
|
|
26
|
-
return void 0;
|
|
15
|
+
return yieldTurn(work.signal);
|
|
27
16
|
}
|
|
28
17
|
function nextCodePointOffset(value, offset) {
|
|
29
18
|
if (offset >= value.length) return value.length;
|
|
@@ -168,13 +168,6 @@ var EreLedger = class _EreLedger {
|
|
|
168
168
|
const min = untilLimit < untilYield ? untilLimit : untilYield;
|
|
169
169
|
return min > 0 ? min : 0;
|
|
170
170
|
}
|
|
171
|
-
advanceSyncCheckpointIfNoExternalYield(signal) {
|
|
172
|
-
if (hasYieldCheckpoint(signal)) return false;
|
|
173
|
-
if (signal?.aborted) throw signal.reason;
|
|
174
|
-
if (this.poison) throw this.poison;
|
|
175
|
-
this.lastYield = this.uWork;
|
|
176
|
-
return true;
|
|
177
|
-
}
|
|
178
171
|
admitInput(resource, length, signal) {
|
|
179
172
|
this.check(signal);
|
|
180
173
|
integer(length);
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
init_buffer();
|
|
7
7
|
import { getCommandArguments } from "../../safe-bash-contracts/index.js";
|
|
8
8
|
import { shellValueByteLength, shellValueBytes } from "../../safe-bash-contracts/value.js";
|
|
9
|
-
import {
|
|
9
|
+
import { yieldTurn } from "../../safe-bash-contracts/yield.js";
|
|
10
10
|
import { PublicDiagnostic } from "../../safe-bash-contracts/diagnostics.js";
|
|
11
11
|
function settings(options) {
|
|
12
12
|
const limits = {
|
|
@@ -67,8 +67,6 @@ var Budget = class {
|
|
|
67
67
|
admission;
|
|
68
68
|
work = 0;
|
|
69
69
|
checkpoint = 0;
|
|
70
|
-
checkpointCount = 0;
|
|
71
|
-
lastYield = monotonicNow();
|
|
72
70
|
retained = 0;
|
|
73
71
|
input = 0;
|
|
74
72
|
output = 0;
|
|
@@ -93,17 +91,9 @@ var Budget = class {
|
|
|
93
91
|
this.assertOpen();
|
|
94
92
|
if (this.work - this.checkpoint < 4096) return;
|
|
95
93
|
this.checkpoint = this.work;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
this.lastYield = now;
|
|
100
|
-
return yieldTurn(this.callerSignal).then(() => {
|
|
101
|
-
this.lastYield = monotonicNow();
|
|
102
|
-
this.assertOpen();
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
runYieldCheckpoint(this.callerSignal);
|
|
106
|
-
this.assertOpen();
|
|
94
|
+
return yieldTurn(this.callerSignal).then(() => {
|
|
95
|
+
this.assertOpen();
|
|
96
|
+
});
|
|
107
97
|
}
|
|
108
98
|
retain(amount) {
|
|
109
99
|
this.check(this.retained + amount, this.limits.maxBufferedBytes, "buffered bytes");
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
// packages/safe-bash-command-file/src/shared.ts
|
|
6
6
|
init_buffer();
|
|
7
7
|
import { utf8ByteLength } from "../../safe-bash-byte-engine/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { inheritYieldCheckpoint, yieldTurn } from "../../safe-bash-contracts/yield.js";
|
|
9
9
|
import { writeBytes } from "../../safe-bash-contracts/index.js";
|
|
10
10
|
function settings(options) {
|
|
11
11
|
const limits = {
|
|
@@ -55,6 +55,7 @@ var SharedBudget = class {
|
|
|
55
55
|
this.context = context;
|
|
56
56
|
this.limits = limits;
|
|
57
57
|
this.signal = AbortSignal.any([context.signal, this.controller.signal]);
|
|
58
|
+
inheritYieldCheckpoint(context.signal, this.signal);
|
|
58
59
|
this.deadline = performance.now() + limits.maxDurationMs;
|
|
59
60
|
if (Number.isFinite(limits.maxDurationMs)) {
|
|
60
61
|
const expire = () => {
|
|
@@ -72,8 +73,6 @@ var SharedBudget = class {
|
|
|
72
73
|
steps = 0;
|
|
73
74
|
failureUnits = 64;
|
|
74
75
|
untilYield = 128;
|
|
75
|
-
yieldChecks = 0;
|
|
76
|
-
lastYield = monotonicNow();
|
|
77
76
|
controller = new AbortController();
|
|
78
77
|
timer;
|
|
79
78
|
deadline;
|
|
@@ -100,13 +99,7 @@ var SharedBudget = class {
|
|
|
100
99
|
this.work(count);
|
|
101
100
|
if (--this.untilYield <= 0) {
|
|
102
101
|
this.untilYield = 128;
|
|
103
|
-
|
|
104
|
-
if (++this.yieldChecks % 16 === 0 || hasYieldCheckpoint(this.signal) || now - this.lastYield >= 16) {
|
|
105
|
-
await yieldTurn(this.signal);
|
|
106
|
-
this.lastYield = monotonicNow();
|
|
107
|
-
} else {
|
|
108
|
-
runYieldCheckpoint(this.signal);
|
|
109
|
-
}
|
|
102
|
+
await yieldTurn(this.signal);
|
|
110
103
|
this.checkTime();
|
|
111
104
|
}
|
|
112
105
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Formatter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QAKKSRNV.js";
|
|
4
4
|
import {
|
|
5
5
|
Lifecycle,
|
|
6
6
|
Reader,
|
|
7
7
|
fsDetail
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QNXI2UP6.js";
|
|
9
9
|
import {
|
|
10
10
|
parseOptions
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-CPPGTBZF.js";
|
|
12
12
|
import {
|
|
13
13
|
Budget,
|
|
14
14
|
PrError,
|
|
15
15
|
fileQuote,
|
|
16
16
|
quote,
|
|
17
17
|
settings
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-N5FGCXQJ.js";
|
|
19
19
|
import {
|
|
20
20
|
init_buffer
|
|
21
21
|
} from "./chunk-HX3SHTCE.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
init_buffer();
|
|
10
10
|
import { utf8ByteLength } from "../../safe-bash-byte-engine/index.js";
|
|
11
11
|
import { publicDiagnosticMessage } from "../../safe-bash-contracts/diagnostics.js";
|
|
12
|
-
import {
|
|
12
|
+
import { inheritYieldCheckpoint, yieldTurn } from "../../safe-bash-contracts/yield.js";
|
|
13
13
|
import { escapeText } from "../../safe-bash-contracts/escaping.js";
|
|
14
14
|
import { FsError, writeBytes } from "../../safe-bash-contracts/index.js";
|
|
15
15
|
var utf8Encoder = new TextEncoder();
|
|
@@ -24,6 +24,7 @@ var Budget = class {
|
|
|
24
24
|
this.limits = limits;
|
|
25
25
|
this.caller = caller;
|
|
26
26
|
this.ioSignal = AbortSignal.any([caller.signal, this.cancellation.signal]);
|
|
27
|
+
inheritYieldCheckpoint(context.signal, this.ioSignal);
|
|
27
28
|
}
|
|
28
29
|
context;
|
|
29
30
|
limits;
|
|
@@ -33,7 +34,6 @@ var Budget = class {
|
|
|
33
34
|
metadata = 0;
|
|
34
35
|
output = 0;
|
|
35
36
|
operations = 0;
|
|
36
|
-
lastYield = monotonicNow();
|
|
37
37
|
closed = false;
|
|
38
38
|
completion;
|
|
39
39
|
cancellation = new AbortController();
|
|
@@ -41,7 +41,6 @@ var Budget = class {
|
|
|
41
41
|
outputSignal;
|
|
42
42
|
work = /* @__PURE__ */ new Set();
|
|
43
43
|
pending = /* @__PURE__ */ new Set();
|
|
44
|
-
timers = /* @__PURE__ */ new Set();
|
|
45
44
|
boundSignal;
|
|
46
45
|
onSignalAbort = () => {
|
|
47
46
|
const callbacks = [...this.pending];
|
|
@@ -60,8 +59,6 @@ var Budget = class {
|
|
|
60
59
|
this.boundSignal?.removeEventListener("abort", this.onSignalAbort);
|
|
61
60
|
this.boundSignal = void 0;
|
|
62
61
|
this.cancellation.abort(this.context.signal.aborted ? this.context.signal.reason : new Error("du invocation closed"));
|
|
63
|
-
for (const timer of this.timers) cancelTurn(timer);
|
|
64
|
-
this.timers.clear();
|
|
65
62
|
for (const cancel of this.pending) {
|
|
66
63
|
cancel();
|
|
67
64
|
}
|
|
@@ -127,15 +124,8 @@ var Budget = class {
|
|
|
127
124
|
}
|
|
128
125
|
async fs(operation) {
|
|
129
126
|
this.step();
|
|
130
|
-
if (++this.operations % 64 === 0
|
|
131
|
-
await this.wait(() =>
|
|
132
|
-
const timer = scheduleTurn(() => {
|
|
133
|
-
this.timers.delete(timer);
|
|
134
|
-
resolve();
|
|
135
|
-
});
|
|
136
|
-
this.timers.add(timer);
|
|
137
|
-
}));
|
|
138
|
-
this.lastYield = monotonicNow();
|
|
127
|
+
if (++this.operations % 64 === 0) {
|
|
128
|
+
await this.wait(() => yieldTurn(this.ioSignal));
|
|
139
129
|
}
|
|
140
130
|
return this.wait(operation);
|
|
141
131
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
regexError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KMCZ6P4O.js";
|
|
4
4
|
import {
|
|
5
5
|
describe
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YZ5SVZFD.js";
|
|
7
7
|
import {
|
|
8
8
|
JqError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VVI4Z73I.js";
|
|
10
10
|
import {
|
|
11
11
|
utf8ByteLength
|
|
12
12
|
} from "./chunk-PDKXAR4Y.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
help,
|
|
3
3
|
parse
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Q7Q5GM5S.js";
|
|
5
5
|
import {
|
|
6
6
|
settings
|
|
7
7
|
} from "./chunk-EHVMZ2NP.js";
|
|
8
8
|
import {
|
|
9
9
|
matches
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BZPAWTUL.js";
|
|
11
11
|
import {
|
|
12
12
|
TreeLimitError,
|
|
13
13
|
UsageError,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
escaped,
|
|
16
16
|
escapedName,
|
|
17
17
|
message
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PFAADCB5.js";
|
|
19
19
|
import {
|
|
20
20
|
compareVersions
|
|
21
21
|
} from "./chunk-N6TXEPXL.js";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
init_buffer();
|
|
7
7
|
import { getCommandArguments } from "../../safe-bash-contracts/index.js";
|
|
8
8
|
import { shellValueByteLength, shellValueBytes } from "../../safe-bash-contracts/value.js";
|
|
9
|
-
import {
|
|
9
|
+
import { yieldTurn } from "../../safe-bash-contracts/yield.js";
|
|
10
10
|
import { PublicDiagnostic } from "../../safe-bash-contracts/diagnostics.js";
|
|
11
11
|
function settings(options) {
|
|
12
12
|
const limits = {
|
|
@@ -114,8 +114,6 @@ var Budget = class {
|
|
|
114
114
|
signal;
|
|
115
115
|
work = 0;
|
|
116
116
|
checkpoint = 0;
|
|
117
|
-
checkpointCount = 0;
|
|
118
|
-
lastYield = monotonicNow();
|
|
119
117
|
retained = 0;
|
|
120
118
|
input = 0;
|
|
121
119
|
output = 0;
|
|
@@ -137,15 +135,7 @@ var Budget = class {
|
|
|
137
135
|
this.assertSignalOpen();
|
|
138
136
|
if (this.work - this.checkpoint < 4096) return;
|
|
139
137
|
this.checkpoint = this.work;
|
|
140
|
-
|
|
141
|
-
const now = monotonicNow();
|
|
142
|
-
if (count === 1 || count % 16 === 0 || now - this.lastYield >= 16 || hasYieldCheckpoint(this.signal)) {
|
|
143
|
-
this.lastYield = now;
|
|
144
|
-
return yieldTurn(this.signal).then(() => {
|
|
145
|
-
this.lastYield = monotonicNow();
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
return runYieldCheckpoint(this.signal);
|
|
138
|
+
return yieldTurn(this.signal);
|
|
149
139
|
}
|
|
150
140
|
retain(amount) {
|
|
151
141
|
this.check(this.retained + amount, this.limits.maxBufferedBytes, "buffered bytes");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
describe
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YZ5SVZFD.js";
|
|
4
4
|
import {
|
|
5
5
|
JqError,
|
|
6
6
|
JqLimitError,
|
|
7
7
|
object,
|
|
8
8
|
put
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VVI4Z73I.js";
|
|
10
10
|
import {
|
|
11
11
|
init_buffer
|
|
12
12
|
} from "./chunk-HX3SHTCE.js";
|