@poe-platform/safe-bash 0.1.772 → 0.1.774
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/image-ast/index.browser.js +3543 -706
- package/dist/image-ast/index.js +3543 -706
- package/dist/pdf-ast/ast.d.ts +7 -0
- package/dist/pdf-ast/content/evaluator.d.ts +1 -0
- package/dist/pdf-ast/index.js +3587 -718
- package/dist/pdf-ast/render/raster.d.ts +1 -0
- package/dist/pdf-ast/vendor/pdfjs-fonts.d.mts +36 -0
- package/dist/pdf-ast/vendor/pdfjs-fonts.mjs +3323 -0
- package/dist/safe-bash/command-chunks/{chunk-M2XU2YCK.js → chunk-4ZHDCMQX.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-NBENXODJ.js → chunk-HH5QPKIN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-C4AAJTXF.js → chunk-PM63UJE6.js} +3546 -706
- package/dist/safe-bash/core.browser.js +101 -45
- package/dist/safe-bash/core.d.ts +1 -1
- package/dist/safe-bash/plugins/composition.d.ts +2 -0
- package/dist/safe-bash/plugins/composition.js +2 -1
- package/dist/safe-bash/shell/runtime.js +17 -9
- package/dist/safe-bash/shell/sync-posix-regex.d.ts +3 -0
- package/dist/safe-bash/shell/sync-posix-regex.js +48 -0
- package/dist/safe-bash-command-ffmpeg/index.js +11032 -9579
- package/dist/safe-bash-command-gh/index.d.ts +1 -0
- package/dist/safe-bash-command-gh/index.js +43 -13
- package/dist/safe-bash-command-gh/types.d.ts +1 -0
- package/dist/safe-bash-command-git/git_rust.wasm +0 -0
- package/dist/safe-bash-command-git/index.js +22 -15
- package/dist/safe-bash-command-git/wasm.generated.js +1 -1
- package/dist/safe-bash-command-gpg/index.js +28 -7
- package/dist/safe-bash-command-imagemagick/index.js +2 -2
- package/dist/safe-bash-command-openssl/index.js +24 -6
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.js +3542 -660
- package/dist/safe-bash-command-pdfinfo/index.js +3584 -718
- package/dist/safe-bash-command-pdftk/index.js +3542 -660
- package/dist/safe-bash-command-pdftoppm/index.js +3589 -787
- package/dist/safe-bash-command-pdftotext/index.js +3542 -660
- package/dist/safe-bash-command-qpdf/index.js +3542 -660
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +1 -1
- package/dist/safe-bash-command-ssconvert/index.js +3553 -716
- package/dist/safe-bash-command-ssh/index.js +124 -23
- package/dist/safe-bash-command-wkhtmltopdf/index.js +3581 -660
- package/dist/safe-bash-mcp/index.d.ts +8 -2
- package/dist/safe-bash-mcp/index.js +13 -6
- package/package.json +7 -7
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +84 -1
|
@@ -21,6 +21,7 @@ export interface GhCommandOptions {
|
|
|
21
21
|
export interface GhCommandsOptions extends GhCommandOptions {
|
|
22
22
|
readonly replace?: boolean | undefined;
|
|
23
23
|
}
|
|
24
|
+
export declare function settings(options?: GhCommandOptions): GhLimits;
|
|
24
25
|
export declare function createGhCommand(options?: GhCommandOptions): CommandDefinition;
|
|
25
26
|
export declare function evalSyncGh(execFn: CommandDefinition["execute"], rawArgs: readonly string[], env: Readonly<Record<string, string>>, cwd?: string, readFileSync?: (path: string) => Uint8Array | undefined): string | undefined;
|
|
26
27
|
export declare function createGhCommands(options?: GhCommandsOptions): readonly CommandDefinition[];
|
|
@@ -4,9 +4,11 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// packages/safe-bash-command-gh/dist/index.js
|
|
6
6
|
init_buffer();
|
|
7
|
+
import { yieldTurn as yieldTurn2 } from "../safe-bash-contracts/yield.js";
|
|
7
8
|
|
|
8
9
|
// packages/safe-bash-command-gh/dist/input.js
|
|
9
10
|
init_buffer();
|
|
11
|
+
import { yieldTurn } from "../safe-bash-contracts/yield.js";
|
|
10
12
|
import { resolvePath } from "@poe-platform/safe-fs/core";
|
|
11
13
|
import { readBytes } from "../safe-bash-contracts/index.js";
|
|
12
14
|
function createGhInput(context, limits) {
|
|
@@ -55,10 +57,18 @@ function createGhInput(context, limits) {
|
|
|
55
57
|
const readStdinBytes = () => stdin ??= (async () => {
|
|
56
58
|
const chunks = [];
|
|
57
59
|
let size = 0;
|
|
60
|
+
let turnBytes = 0;
|
|
61
|
+
let turnChunks = 0;
|
|
58
62
|
for await (const chunk of readBytes(context.stdin, context.signal)) {
|
|
59
63
|
chargeBytes(chunk.length);
|
|
60
64
|
chunks.push(chunk);
|
|
61
65
|
size += chunk.length;
|
|
66
|
+
turnBytes += chunk.length;
|
|
67
|
+
if (++turnChunks >= 128 || turnBytes >= 16 * 1024) {
|
|
68
|
+
await yieldTurn(context.signal);
|
|
69
|
+
turnBytes = 0;
|
|
70
|
+
turnChunks = 0;
|
|
71
|
+
}
|
|
62
72
|
}
|
|
63
73
|
const bytes = new Uint8Array(size);
|
|
64
74
|
let offset = 0;
|
|
@@ -8110,12 +8120,13 @@ State: ${cs.state}
|
|
|
8110
8120
|
// packages/safe-bash-command-gh/dist/types.js
|
|
8111
8121
|
init_buffer();
|
|
8112
8122
|
var DEFAULT_GH_LIMITS = Object.freeze({
|
|
8113
|
-
maxHttpRequests:
|
|
8114
|
-
maxHttpBytes:
|
|
8115
|
-
maxOutputBytes:
|
|
8116
|
-
maxInputBytes:
|
|
8117
|
-
maxFiles:
|
|
8118
|
-
maxItems:
|
|
8123
|
+
maxHttpRequests: Infinity,
|
|
8124
|
+
maxHttpBytes: Infinity,
|
|
8125
|
+
maxOutputBytes: Infinity,
|
|
8126
|
+
maxInputBytes: Infinity,
|
|
8127
|
+
maxFiles: Infinity,
|
|
8128
|
+
maxItems: Infinity,
|
|
8129
|
+
maxAliasDepth: Infinity
|
|
8119
8130
|
});
|
|
8120
8131
|
|
|
8121
8132
|
// packages/safe-bash-command-gh/dist/index.js
|
|
@@ -8225,8 +8236,17 @@ function normalizeTopLevelArgs(rawArgs) {
|
|
|
8225
8236
|
help: help && !command
|
|
8226
8237
|
};
|
|
8227
8238
|
}
|
|
8228
|
-
function
|
|
8239
|
+
function settings(options = {}) {
|
|
8229
8240
|
const limits = { ...DEFAULT_GH_LIMITS, ...options.limits };
|
|
8241
|
+
for (const [name, value] of Object.entries(limits)) {
|
|
8242
|
+
if (value !== Infinity && (!Number.isSafeInteger(value) || value < 1)) {
|
|
8243
|
+
throw new RangeError(`gh ${name} must be Infinity or a positive safe integer`);
|
|
8244
|
+
}
|
|
8245
|
+
}
|
|
8246
|
+
return limits;
|
|
8247
|
+
}
|
|
8248
|
+
function createGhCommand(options = {}) {
|
|
8249
|
+
const limits = settings(options);
|
|
8230
8250
|
const backends = /* @__PURE__ */ new WeakMap();
|
|
8231
8251
|
const openssl = createDefaultOpenSslProvider(options.openssl);
|
|
8232
8252
|
const def = {
|
|
@@ -8266,11 +8286,9 @@ function createGhCommand(options = {}) {
|
|
|
8266
8286
|
try {
|
|
8267
8287
|
const readStdinBytes = input.readStdinBytes;
|
|
8268
8288
|
const readStdinText = async () => decodeUtf8(await readStdinBytes());
|
|
8289
|
+
const visitedAliases = /* @__PURE__ */ new Set();
|
|
8269
8290
|
const dispatch = async (argsToRun, depth = 0) => {
|
|
8270
|
-
|
|
8271
|
-
await writeErr("gh: alias expansion loop detected\n");
|
|
8272
|
-
return 1;
|
|
8273
|
-
}
|
|
8291
|
+
context.signal.throwIfAborted();
|
|
8274
8292
|
const { command, subArgs, version, help } = normalizeTopLevelArgs(argsToRun);
|
|
8275
8293
|
if (version || command === "version") {
|
|
8276
8294
|
await writeOut(GH_VERSION_OUTPUT);
|
|
@@ -8281,10 +8299,21 @@ function createGhCommand(options = {}) {
|
|
|
8281
8299
|
return 0;
|
|
8282
8300
|
}
|
|
8283
8301
|
if (command === "co" && !(command in backend.config.aliases)) {
|
|
8284
|
-
return dispatch(["pr", "checkout", ...subArgs], depth
|
|
8302
|
+
return dispatch(["pr", "checkout", ...subArgs], depth);
|
|
8285
8303
|
}
|
|
8286
8304
|
const aliasExpansion = backend.config.aliases[command];
|
|
8287
8305
|
if (aliasExpansion) {
|
|
8306
|
+
if (visitedAliases.has(command)) {
|
|
8307
|
+
await writeErr("gh: alias expansion loop detected\n");
|
|
8308
|
+
return 1;
|
|
8309
|
+
}
|
|
8310
|
+
if (depth >= limits.maxAliasDepth) {
|
|
8311
|
+
await writeErr("gh: alias expansion depth limit exceeded\n");
|
|
8312
|
+
return 1;
|
|
8313
|
+
}
|
|
8314
|
+
visitedAliases.add(command);
|
|
8315
|
+
if (visitedAliases.size % 128 === 0)
|
|
8316
|
+
await yieldTurn2(context.signal);
|
|
8288
8317
|
const cleanExpansion = aliasExpansion.startsWith("!") ? aliasExpansion.slice(1).replace(/^gh\s+/u, "") : aliasExpansion;
|
|
8289
8318
|
let expandedText = cleanExpansion;
|
|
8290
8319
|
let usedPositionalPlaceholder = false;
|
|
@@ -9724,5 +9753,6 @@ export {
|
|
|
9724
9753
|
createGitHubBackend,
|
|
9725
9754
|
evalSyncGh,
|
|
9726
9755
|
ghCommands,
|
|
9727
|
-
parseRepoSpec
|
|
9756
|
+
parseRepoSpec,
|
|
9757
|
+
settings
|
|
9728
9758
|
};
|
|
Binary file
|
|
@@ -114,20 +114,7 @@ function createGitCommand(options = {}) {
|
|
|
114
114
|
throw new Error(`${name} must be a positive safe integer or Infinity`);
|
|
115
115
|
const def = { name: "git", runtimeIdentity: commandRuntimeIdentity, description: "Git repositories in the virtual filesystem", async execute(context) {
|
|
116
116
|
try {
|
|
117
|
-
|
|
118
|
-
let stdinSize = 0;
|
|
119
|
-
for await (const chunk of readBytes(context.stdin, context.signal)) {
|
|
120
|
-
stdinSize += chunk.length;
|
|
121
|
-
if (stdinSize > limits.maxBytes)
|
|
122
|
-
throw new Error("Git stdin byte limit exceeded");
|
|
123
|
-
chunks.push(chunk);
|
|
124
|
-
}
|
|
125
|
-
const stdin = new Uint8Array(stdinSize);
|
|
126
|
-
let offset = 0;
|
|
127
|
-
for (const chunk of chunks) {
|
|
128
|
-
stdin.set(chunk, offset);
|
|
129
|
-
offset += chunk.length;
|
|
130
|
-
}
|
|
117
|
+
let stdin;
|
|
131
118
|
const before = await snapshot(context.fs, limits, context.signal);
|
|
132
119
|
const exports = options.wasmModule ? new globalThis.WebAssembly.Instance(options.wasmModule).exports : getDefaultGitExports();
|
|
133
120
|
const responses = [];
|
|
@@ -135,7 +122,7 @@ function createGitCommand(options = {}) {
|
|
|
135
122
|
let result;
|
|
136
123
|
for (; ; ) {
|
|
137
124
|
context.signal.throwIfAborted();
|
|
138
|
-
const input = encoder.encode(JSON.stringify({ cwd: context.cwd, args: context.args, entries: before, responses, stdin
|
|
125
|
+
const input = encoder.encode(JSON.stringify({ cwd: context.cwd, args: context.args, env: context.env, entries: before, responses, stdin }));
|
|
139
126
|
const ptr = exports.git_alloc(input.length);
|
|
140
127
|
try {
|
|
141
128
|
new Uint8Array(exports.memory.buffer, ptr, input.length).set(input);
|
|
@@ -147,6 +134,26 @@ function createGitCommand(options = {}) {
|
|
|
147
134
|
} finally {
|
|
148
135
|
exports.git_free(ptr, input.length);
|
|
149
136
|
}
|
|
137
|
+
if (result.needsStdin) {
|
|
138
|
+
if (stdin !== void 0)
|
|
139
|
+
throw new Error("Git requested stdin more than once");
|
|
140
|
+
const chunks = [];
|
|
141
|
+
let size = 0;
|
|
142
|
+
for await (const chunk of readBytes(context.stdin, context.signal)) {
|
|
143
|
+
size += chunk.length;
|
|
144
|
+
if (size > limits.maxBytes)
|
|
145
|
+
throw new Error("Git stdin byte limit exceeded");
|
|
146
|
+
chunks.push(chunk);
|
|
147
|
+
}
|
|
148
|
+
const bytes = new Uint8Array(size);
|
|
149
|
+
let offset = 0;
|
|
150
|
+
for (const chunk of chunks) {
|
|
151
|
+
bytes.set(chunk, offset);
|
|
152
|
+
offset += chunk.length;
|
|
153
|
+
}
|
|
154
|
+
stdin = encode(bytes);
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
150
157
|
if (!result.request)
|
|
151
158
|
break;
|
|
152
159
|
if (!options.http)
|