@poe-platform/safe-bash 0.1.745 → 0.1.747
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 +5 -1
- package/dist/image-ast/browser/sharp.d.ts +1 -1
- package/dist/image-ast/index.js +133 -35
- package/dist/image-ast/sharp.d.ts +1 -1
- package/dist/safe-bash/chunks/{chunk-2F7Q532M.js → chunk-4GK4FAT6.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-EAUCLWEZ.js → chunk-55AGFLG5.js} +540 -284
- package/dist/safe-bash/chunks/{chunk-WCNFCN2G.js → chunk-BS6QFRNX.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-IZZ7KX4E.js → chunk-JCXAGOEK.js} +40 -3
- package/dist/safe-bash/chunks/{chunk-I3DOFJSJ.js → chunk-MUWJPSGN.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-7RP6WOWK.js → chunk-OF2PDE3W.js} +2 -2
- package/dist/safe-bash/chunks/{src-FTMTU65U.js → src-T672TQJC.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-DRCPJVZF.js → chunk-44N2IRVP.js} +17 -5
- package/dist/safe-bash/command-chunks/{chunk-LYKC7WJB.js → chunk-6742OVAC.js} +37 -3
- package/dist/safe-bash/command-chunks/{chunk-BMBXSLVX.js → chunk-6QU5OLPJ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-YHANNN7I.js → chunk-S3BO2NJT.js} +7 -0
- package/dist/safe-bash/commands/basic.d.ts +2 -0
- package/dist/safe-bash/commands/basic.js +236 -9
- package/dist/safe-bash/commands/pr/index.browser.js +1 -1
- package/dist/safe-bash/commands/streams.js +9 -56
- package/dist/safe-bash/commands/table-text/index.js +5 -1
- package/dist/safe-bash/commands/text.js +13 -2
- package/dist/safe-bash/commands/time-env/shared.js +2 -2
- package/dist/safe-bash/commands/time-env/sleep.js +6 -4
- package/dist/safe-bash/commands/timeout/index.d.ts +7 -0
- package/dist/safe-bash/commands/timeout/index.js +52 -32
- package/dist/safe-bash/commands/timeout/scheduler.js +7 -6
- package/dist/safe-bash/core.browser.js +2698 -543
- package/dist/safe-bash/opt-in/commands/shuf/random.js +2 -3
- package/dist/safe-bash/opt-in/shell/extensions/read/index.js +1 -1
- package/dist/safe-bash/opt-in/shell/extensions/trap/index.d.ts +1 -2
- package/dist/safe-bash/opt-in/shell/extensions/trap/index.js +1 -8
- package/dist/safe-bash/playwright/adapter.d.ts +2 -0
- package/dist/safe-bash/playwright/private-target-transport.d.ts +1 -0
- package/dist/safe-bash/playwright/private-target-transport.js +21 -21
- package/dist/safe-bash/shell/runtime.d.ts +20 -1
- package/dist/safe-bash/shell/runtime.js +3021 -532
- package/dist/safe-bash/shell/sync-jq-expression.d.ts +6 -0
- package/dist/safe-bash/shell/sync-jq-expression.js +46 -0
- package/dist/safe-bash-command-cal/index.js +32 -12
- package/dist/safe-bash-command-hostname/index.js +22 -7
- package/dist/safe-bash-command-id/index.js +28 -9
- package/dist/safe-bash-command-pandoc/command.js +1 -1
- package/dist/safe-bash-command-pandoc/index.js +1 -1
- package/dist/safe-bash-command-ssconvert/command.d.ts +2 -2
- package/dist/safe-bash-command-ssconvert/contracts.d.ts +4 -0
- package/dist/safe-bash-command-ssconvert/engine.d.ts +2 -2
- package/dist/safe-bash-command-ssconvert/index.js +524 -276
- package/dist/safe-bash-command-whoami/index.js +26 -12
- package/dist/safe-bash-query-engine/index.js +3 -3
- package/dist/safe-bash-query-engine/interpreter.js +1 -1
- package/dist/safe-bash-query-engine/parser.js +1 -1
- package/dist/safe-bash-query-engine/query-core.js +3 -3
- package/dist/safe-playwright-cloudflare/browser-private-transport.js +8 -13
- package/dist/safe-playwright-cloudflare/browser-storage-control.js +13 -4
- package/dist/safe-playwright-cloudflare/browser-trace-archive.js +1 -1
- package/package.json +18 -14
- package/dist/image-ast/streams/node.d.ts +0 -10
- package/dist/image-ast/streams/node.js +0 -5
- package/dist/image-ast/streams/web.js +0 -94
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { randomFillSync } from "node:crypto";
|
|
2
1
|
import { yieldTurn } from "@poe-platform/safe-bash/contracts/yield";
|
|
3
2
|
import { Diagnostic, quote, wordMax } from "./args.js";
|
|
4
3
|
import { ownedBytes, virtualPath } from "./input.js";
|
|
@@ -74,7 +73,7 @@ export class RandomIntegers {
|
|
|
74
73
|
this.bytes = new Uint8Array(next.value);
|
|
75
74
|
}
|
|
76
75
|
else {
|
|
77
|
-
this.bytes =
|
|
76
|
+
this.bytes = globalThis.crypto.getRandomValues(new Uint8Array(4096));
|
|
78
77
|
}
|
|
79
78
|
this.offset = 0;
|
|
80
79
|
this.signal.throwIfAborted();
|
|
@@ -91,7 +90,7 @@ export class RandomIntegers {
|
|
|
91
90
|
throw new Error("shuf random source is closed");
|
|
92
91
|
while (this.maximum < target) {
|
|
93
92
|
if (this.offset === this.bytes.length) {
|
|
94
|
-
this.bytes =
|
|
93
|
+
this.bytes = globalThis.crypto.getRandomValues(this.bytes.length === 4096 ? this.bytes : new Uint8Array(4096));
|
|
95
94
|
this.offset = 0;
|
|
96
95
|
}
|
|
97
96
|
this.value = ((this.value << 8n) + BigInt(this.bytes[this.offset++])) & wordMax;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { portableTrapExtension as trapExtension } from "@poe-platform/safe-bash/optional-host";
|
|
2
2
|
export type { TrapExtensionOptions, TrapSignalHost } from "@poe-platform/safe-bash/optional-host";
|
|
3
|
-
export declare function trapExtension(configuration?: TrapExtensionOptions): import("@poe-platform/safe-bash/optional-host").ShellExtension;
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { portableTrapExtension } from "@poe-platform/safe-bash/optional-host";
|
|
3
|
-
export function trapExtension(configuration = {}) {
|
|
4
|
-
return portableTrapExtension({
|
|
5
|
-
...configuration,
|
|
6
|
-
signalNames: configuration.signalNames ?? { ...constants.signals, ...(platform() === "darwin" ? { SIGEMT: 7 } : {}) },
|
|
7
|
-
});
|
|
8
|
-
}
|
|
1
|
+
export { portableTrapExtension as trapExtension } from "@poe-platform/safe-bash/optional-host";
|
|
@@ -108,6 +108,7 @@ export interface PlaywrightFrame {
|
|
|
108
108
|
evaluate?<Result, Argument>(callback: (argument: Argument) => Result, argument: Argument): Promise<Result>;
|
|
109
109
|
evaluateHandle?(callback: (input: FrameSnapshotInput) => FrameSnapshotCapsule, input: FrameSnapshotInput): Promise<PlaywrightSnapshotHandle>;
|
|
110
110
|
locator(selector: string): {
|
|
111
|
+
click?(options?: PlaywrightActionOptions): Promise<void>;
|
|
111
112
|
elementHandles?: () => Promise<PlaywrightElementHandle[]>;
|
|
112
113
|
evaluate?: (callback: (node: SnapshotNode) => string) => Promise<string>;
|
|
113
114
|
};
|
|
@@ -172,6 +173,7 @@ export interface PlaywrightPage {
|
|
|
172
173
|
timeout?: number;
|
|
173
174
|
}): Promise<unknown>;
|
|
174
175
|
title?(): Promise<string>;
|
|
176
|
+
content?(): Promise<string>;
|
|
175
177
|
hideHighlight?(): Promise<void>;
|
|
176
178
|
waitForTimeout?(milliseconds: number): Promise<void>;
|
|
177
179
|
setViewportSize?(size: {
|
|
@@ -5,6 +5,7 @@ export interface PlaywrightCDPTransport {
|
|
|
5
5
|
onmessage?: ((message: object) => void) | undefined;
|
|
6
6
|
onclose?: ((reason?: string) => void) | undefined;
|
|
7
7
|
}
|
|
8
|
+
/** Omitted limits and Infinity are unlimited; positive finite values opt into budgets. */
|
|
8
9
|
export interface PlaywrightPrivateTargetTransportLimits {
|
|
9
10
|
maxMessageBytes?: number;
|
|
10
11
|
maxGraphNodes?: number;
|
|
@@ -5,7 +5,7 @@ function identity(value) {
|
|
|
5
5
|
return typeof value === 'string' && value.length > 0 && value.length <= 1024 && !value.includes('\0');
|
|
6
6
|
}
|
|
7
7
|
const admittedGraphs = new WeakMap();
|
|
8
|
-
function preflightProtocolJson(text, maxBytes, maxNodes =
|
|
8
|
+
function preflightProtocolJson(text, maxBytes, maxNodes = Infinity, maxDepth = Infinity, byteErrorMessage = 'CDP message byte limit exceeded') {
|
|
9
9
|
let bytes = 0;
|
|
10
10
|
let nodes = 0;
|
|
11
11
|
let depth = 0;
|
|
@@ -110,8 +110,8 @@ function freezeProtocolGraph(root) {
|
|
|
110
110
|
}
|
|
111
111
|
export function admitPlaywrightProtocolFrame(data, options = {}) {
|
|
112
112
|
const maxBytes = options.maxBytes ?? Infinity;
|
|
113
|
-
const maxGraphNodes = options.maxGraphNodes ??
|
|
114
|
-
const maxGraphDepth = options.maxGraphDepth ??
|
|
113
|
+
const maxGraphNodes = options.maxGraphNodes ?? Infinity;
|
|
114
|
+
const maxGraphDepth = options.maxGraphDepth ?? Infinity;
|
|
115
115
|
if (typeof data !== 'string')
|
|
116
116
|
throw new Error('Private browser frame limit or type violation');
|
|
117
117
|
const stats = preflightProtocolJson(data, maxBytes, maxGraphNodes, maxGraphDepth, 'Private browser frame limit or type violation');
|
|
@@ -123,29 +123,25 @@ export function admitPlaywrightProtocolFrame(data, options = {}) {
|
|
|
123
123
|
return value;
|
|
124
124
|
}
|
|
125
125
|
export function createPlaywrightPrivateTargetTransport(upstream, options = {}) {
|
|
126
|
+
for (const [name, value] of Object.entries(options)) {
|
|
127
|
+
if (value !== undefined && value !== Infinity && (!Number.isSafeInteger(value) || value <= 0 || (name.endsWith('TimeoutMs') && value > 2147483647))) {
|
|
128
|
+
throw new TypeError(`Invalid private transport limit: ${name}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
126
131
|
const limits = {
|
|
127
|
-
maxGraphNodes:
|
|
128
|
-
maxGraphDepth:
|
|
129
|
-
maxQueuedCommands:
|
|
130
|
-
maxBufferedMessages:
|
|
131
|
-
maxPrivateTargets:
|
|
132
|
-
maxPrivateSessions:
|
|
133
|
-
creationTimeoutMs:
|
|
134
|
-
commandTimeoutMs:
|
|
135
|
-
...options,
|
|
132
|
+
maxGraphNodes: options.maxGraphNodes ?? Infinity,
|
|
133
|
+
maxGraphDepth: options.maxGraphDepth ?? Infinity,
|
|
134
|
+
maxQueuedCommands: options.maxQueuedCommands ?? Infinity,
|
|
135
|
+
maxBufferedMessages: options.maxBufferedMessages ?? Infinity,
|
|
136
|
+
maxPrivateTargets: options.maxPrivateTargets ?? Infinity,
|
|
137
|
+
maxPrivateSessions: options.maxPrivateSessions ?? Infinity,
|
|
138
|
+
creationTimeoutMs: options.creationTimeoutMs ?? Infinity,
|
|
139
|
+
commandTimeoutMs: options.commandTimeoutMs ?? Infinity,
|
|
136
140
|
maxMessageBytes: options.maxMessageBytes ?? Infinity,
|
|
137
141
|
maxPendingBytes: options.maxPendingBytes ?? Infinity,
|
|
138
142
|
maxBufferedBytes: options.maxBufferedBytes ?? Infinity,
|
|
139
143
|
maxPendingCommands: options.maxPendingCommands ?? Infinity,
|
|
140
144
|
};
|
|
141
|
-
for (const [name, value] of Object.entries(limits)) {
|
|
142
|
-
if (['maxPendingCommands', 'maxMessageBytes', 'maxPendingBytes', 'maxBufferedBytes'].includes(name) && options[name] === undefined)
|
|
143
|
-
continue;
|
|
144
|
-
if (!Number.isSafeInteger(value) || value <= 0 || (name.endsWith('TimeoutMs') && value > 2147483647)) {
|
|
145
|
-
throw new TypeError(`Invalid private transport limit: ${name}`);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const encoder = new TextEncoder();
|
|
149
145
|
const targets = new Set();
|
|
150
146
|
const sessions = new Map();
|
|
151
147
|
const retiredTargets = new Set();
|
|
@@ -166,6 +162,8 @@ export function createPlaywrightPrivateTargetTransport(upstream, options = {}) {
|
|
|
166
162
|
let commandTimer;
|
|
167
163
|
let timedCommandId;
|
|
168
164
|
function scheduleCommandDeadline() {
|
|
165
|
+
if (!Number.isFinite(limits.commandTimeoutMs))
|
|
166
|
+
return;
|
|
169
167
|
// Uniform deadlines and monotonic insertion order keep the oldest command
|
|
170
168
|
// first, even when replies arrive out of order. Only that command needs a timer.
|
|
171
169
|
const first = pending.entries().next().value;
|
|
@@ -550,7 +548,9 @@ export function createPlaywrightPrivateTargetTransport(upstream, options = {}) {
|
|
|
550
548
|
if (targets.size >= limits.maxPrivateTargets)
|
|
551
549
|
throw new Error('Private target identity capacity exceeded');
|
|
552
550
|
const entry = { active: true, failed: false,
|
|
553
|
-
timer:
|
|
551
|
+
timer: Number.isFinite(limits.creationTimeoutMs)
|
|
552
|
+
? setTimeout(() => retire(new Error('Native target creation identity timed out')), limits.creationTimeoutMs)
|
|
553
|
+
: undefined };
|
|
554
554
|
creation = entry;
|
|
555
555
|
return {
|
|
556
556
|
commit(targetId) { finish(entry, true, targetId); },
|
|
@@ -322,7 +322,6 @@ interface InvokeOutcomeRecord {
|
|
|
322
322
|
consumed: boolean;
|
|
323
323
|
selection?: CancellationSelection<CommandResult> | undefined;
|
|
324
324
|
}
|
|
325
|
-
/** Internal to the shell/runtime pair; it is not exported by the package root. */
|
|
326
325
|
export declare class RuntimeCancellationState {
|
|
327
326
|
private _records;
|
|
328
327
|
private _diagnostics;
|
|
@@ -526,9 +525,18 @@ export declare class Runtime {
|
|
|
526
525
|
private evalSyncRedirectWord;
|
|
527
526
|
private evalSyncRedirectSuffix;
|
|
528
527
|
private encodeSyncRedirectWordsToScratch;
|
|
528
|
+
private _activePrintfInductionName;
|
|
529
|
+
private _activeLoopBodyScript;
|
|
530
|
+
private _activeLoopCondScript;
|
|
531
|
+
private _activeLoopVarName;
|
|
532
|
+
private isVarUnmutatedInScript;
|
|
533
|
+
private isVarUnmutatedInActiveLoop;
|
|
534
|
+
private isFileReadOnlyScript;
|
|
535
|
+
private extractLoopInvariantJqInput;
|
|
529
536
|
private canSyncPrintfInductionBody;
|
|
530
537
|
private isSyncPrintfCallOk;
|
|
531
538
|
private isSimpleRedirectEchoWord;
|
|
539
|
+
private syncStringLength;
|
|
532
540
|
private execSyncReadHereStringStep;
|
|
533
541
|
private splitSyncReadLine;
|
|
534
542
|
private execSyncLocalDeclStep;
|
|
@@ -670,13 +678,24 @@ export declare class Runtime {
|
|
|
670
678
|
private fastValueWord;
|
|
671
679
|
private expandSyncTrCharArray;
|
|
672
680
|
private evalSyncTr;
|
|
681
|
+
private evalSyncJqPathOps;
|
|
673
682
|
private evalSyncJq;
|
|
683
|
+
private evalSyncDirname;
|
|
684
|
+
private evalSyncBasename;
|
|
674
685
|
private parseSyncCutSpec;
|
|
675
686
|
private evalSyncCut;
|
|
676
687
|
private evalSyncSed;
|
|
677
688
|
private evalSyncGrep;
|
|
678
689
|
private evalSyncAwk;
|
|
679
690
|
private formatSyncTransformQ;
|
|
691
|
+
private wcMaxLineWidth;
|
|
692
|
+
private compareSyncVersion;
|
|
693
|
+
private evalSyncNl;
|
|
694
|
+
private evalSyncPaste;
|
|
695
|
+
private evalSyncNumfmt;
|
|
696
|
+
private evalSyncSort;
|
|
697
|
+
private normalizeSyncWcFlag;
|
|
698
|
+
private evalSyncUniq;
|
|
680
699
|
private sortSyncLines;
|
|
681
700
|
private translateSyncTr;
|
|
682
701
|
private expandSyncTrCharSet;
|