@poe-platform/safe-bash 0.1.763 → 0.1.764

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.
Files changed (31) hide show
  1. package/dist/image-ast/index.browser.js +268 -153
  2. package/dist/image-ast/index.js +268 -153
  3. package/dist/pdf-ast/index.js +270 -153
  4. package/dist/safe-bash/chunks/{chunk-CRQDMBQA.js → chunk-FSH7QRIC.js} +10 -1
  5. package/dist/safe-bash/command-chunks/{chunk-4XHONGIU.js → chunk-B7YLGJRF.js} +2 -2
  6. package/dist/safe-bash/command-chunks/{chunk-S3G2B4OX.js → chunk-G3IIEU2N.js} +271 -153
  7. package/dist/safe-bash/command-chunks/{chunk-S5EX6UP5.js → chunk-RDPJGIQF.js} +1 -1
  8. package/dist/safe-bash/commands/python/index.browser.js +1 -1
  9. package/dist/safe-bash/commands/python/llm-module.js +3 -1
  10. package/dist/safe-bash/commands/python/shell-module.js +7 -0
  11. package/dist/safe-bash/core.browser.js +32 -12
  12. package/dist/safe-bash/shell/runtime.js +43 -11
  13. package/dist/safe-bash-command-ffmpeg/index.js +5649 -5565
  14. package/dist/safe-bash-command-imagemagick/index.js +2 -2
  15. package/dist/safe-bash-command-pandoc/command.js +3 -3
  16. package/dist/safe-bash-command-pandoc/index.js +3 -3
  17. package/dist/safe-bash-command-pdfimages/index.js +268 -153
  18. package/dist/safe-bash-command-pdfinfo/index.js +268 -153
  19. package/dist/safe-bash-command-pdftk/index.js +268 -153
  20. package/dist/safe-bash-command-pdftoppm/index.js +268 -153
  21. package/dist/safe-bash-command-pdftotext/index.js +268 -153
  22. package/dist/safe-bash-command-qpdf/index.js +268 -153
  23. package/dist/safe-bash-command-sips/index.js +2 -2
  24. package/dist/safe-bash-command-soffice/index.js +1 -1
  25. package/dist/safe-bash-command-ssconvert/index.js +265 -150
  26. package/dist/safe-bash-command-wkhtmltopdf/index.js +269 -153
  27. package/dist/safe-playwright-cloudflare/browser-snapshot-labels.d.ts +14 -0
  28. package/dist/safe-playwright-cloudflare/browser-snapshot-labels.js +62 -0
  29. package/dist/safe-playwright-cloudflare/browser-snapshot-scheduler.js +8 -1
  30. package/package.json +2 -2
  31. package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +14 -0
@@ -31701,6 +31701,7 @@ export class Runtime {
31701
31701
  let inc = 1;
31702
31702
  let noRenumber = false;
31703
31703
  let joinBlanks = 1;
31704
+ let hasFileOperand = false;
31704
31705
  const parseSecSpec = (v) => {
31705
31706
  if (v === "a" || v === "t" || v === "n")
31706
31707
  return { style: v };
@@ -31835,10 +31836,13 @@ export class Runtime {
31835
31836
  }
31836
31837
  else if (!a.startsWith("-")) {
31837
31838
  if (cwd === undefined)
31838
- return [];
31839
+ return undefined;
31839
31840
  const fl = this.readSyncMemoryLines(resolvePath(cwd, a));
31840
31841
  if (!fl)
31841
31842
  return undefined;
31843
+ if (!hasFileOperand)
31844
+ rawLines = [];
31845
+ hasFileOperand = true;
31842
31846
  rawLines = [...rawLines, ...fl];
31843
31847
  }
31844
31848
  else {
@@ -33937,12 +33941,12 @@ export class Runtime {
33937
33941
  return undefined;
33938
33942
  if (getEnv("ID_EUID") !== undefined || getEnv("EUID") !== undefined || getEnv("ID_UID") !== undefined || getEnv("UID") !== undefined)
33939
33943
  return undefined;
33940
- return getEnv("WHOAMI_USER") ?? getEnv("USER") ?? getEnv("LOGNAME") ?? "sandbox";
33944
+ return getEnv("WHOAMI") ?? getEnv("USER") ?? getEnv("LOGNAME") ?? "sandbox";
33941
33945
  }
33942
33946
  if (cmdName === "id") {
33943
33947
  if (this.tryReadMemoryFileViewSync("/etc/passwd", false) !== undefined || this.tryReadMemoryFileViewSync("/etc/group", false) !== undefined)
33944
33948
  return undefined;
33945
- for (const k of ["ID_UID", "UID", "ID_EUID", "EUID", "ID_GID", "GID", "ID_EGID", "EGID", "ID_USER", "USER", "LOGNAME", "ID_GROUP", "ID_GROUPS", "ID_CONTEXT"]) {
33949
+ for (const k of ["ID_UID", "UID", "ID_EUID", "EUID", "ID_GID", "GID", "ID_EGID", "EGID", "ID_USER", "USER", "LOGNAME", "GROUP", "ID_GROUPS", "SELINUX_CONTEXT"]) {
33946
33950
  if (getEnv(k) !== undefined)
33947
33951
  return undefined;
33948
33952
  }
@@ -33960,13 +33964,17 @@ export class Runtime {
33960
33964
  if (cmdName === "hostname") {
33961
33965
  if (this.tryReadMemoryFileViewSync("/etc/hostname", false) !== undefined || getEnv("HOSTNAME_DOMAIN") !== undefined || getEnv("HOSTNAME_IP") !== undefined)
33962
33966
  return undefined;
33963
- const host = getEnv("HOSTNAME") ?? "sandbox";
33964
- if (opArgs.length === 0 || (opArgs.length === 1 && (opArgs[0] === "-f" || opArgs[0] === "--fqdn" || opArgs[0] === "--long")))
33967
+ const host = getEnv("HOSTNAME") || "sandbox";
33968
+ if (opArgs.length === 0)
33965
33969
  return host;
33970
+ if (opArgs.length === 1 && (opArgs[0] === "-f" || opArgs[0] === "--fqdn" || opArgs[0] === "--long"))
33971
+ return host.includes(".") ? host : `${host}.vfs.local`;
33966
33972
  if (opArgs.length === 1 && (opArgs[0] === "-s" || opArgs[0] === "--short"))
33967
33973
  return host.split(".")[0];
33968
- if (opArgs.length === 1 && (opArgs[0] === "-i" || opArgs[0] === "--ip-address" || opArgs[0] === "-I" || opArgs[0] === "--all-ip-addresses"))
33974
+ if (opArgs.length === 1 && (opArgs[0] === "-i" || opArgs[0] === "--ip-address"))
33969
33975
  return "127.0.0.1";
33976
+ if (opArgs.length === 1 && (opArgs[0] === "-I" || opArgs[0] === "--all-ip-addresses"))
33977
+ return "127.0.0.1 ";
33970
33978
  return undefined;
33971
33979
  }
33972
33980
  if (cmdName === "nproc") {
@@ -34153,6 +34161,8 @@ export class Runtime {
34153
34161
  tokens.push(op);
34154
34162
  }
34155
34163
  else {
34164
+ if (rawLines === undefined)
34165
+ return undefined;
34156
34166
  for (const line of rawLines) {
34157
34167
  for (const t of line.split(/[ \t\r\n\f\v]+/)) {
34158
34168
  if (t.length > 0)
@@ -34226,6 +34236,8 @@ export class Runtime {
34226
34236
  return undefined;
34227
34237
  linesToRead = memLines;
34228
34238
  }
34239
+ if (linesToRead === undefined)
34240
+ return undefined;
34229
34241
  const tokens = [];
34230
34242
  for (const line of linesToRead) {
34231
34243
  for (const t of line.split(/[ \t\r\n\f\v]+/)) {
@@ -34314,6 +34326,8 @@ export class Runtime {
34314
34326
  const vars = extractVars(operands[0]);
34315
34327
  return vars.length > 0 ? vars.join("\n") + "\n" : "";
34316
34328
  }
34329
+ if (inStr === undefined)
34330
+ return undefined;
34317
34331
  const allowedVars = operands.length === 1 ? new Set(extractVars(operands[0])) : undefined;
34318
34332
  const raw = (stateMonitor(rawState)?.raw ?? rawState);
34319
34333
  const isRestrictedEnv = raw._exported === undefined && "_exported" in raw;
@@ -35866,8 +35880,24 @@ export class Runtime {
35866
35880
  if (list.terminator || list.pipelines.length !== 1)
35867
35881
  return undefined;
35868
35882
  const pipeline = list.pipelines[0];
35869
- if (pipeline.negate)
35883
+ if (pipeline.negate || customRegisteredRegistries.has(this.commands))
35870
35884
  return undefined;
35885
+ for (const command of pipeline.commands) {
35886
+ if (command.kind !== "simple")
35887
+ continue;
35888
+ const name = command.words[0]?.plain;
35889
+ if (!name)
35890
+ continue;
35891
+ if (name === "fmt" && command === pipeline.commands[0] && command.redirects.length === 0 && !io.stdinIsDefault)
35892
+ return undefined;
35893
+ const definition = this.getExternalCommand(name);
35894
+ if (definition && customRegisteredCommands.has(definition.execute))
35895
+ return undefined;
35896
+ if (name === "uname" || name === "nproc" || name === "hostname" || name === "id" || name === "whoami") {
35897
+ if (!definition || !builtInDirectContextExecutors.has(definition.execute))
35898
+ return undefined;
35899
+ }
35900
+ }
35871
35901
  // Range-aware tr and Buffer-free 76-col base64 are supported below.
35872
35902
  if (pipeline.commands.length >= 2 && pipeline.commands.length <= 5) {
35873
35903
  if (syncPurePipelineSlotInUse ||
@@ -37493,7 +37523,9 @@ export class Runtime {
37493
37523
  let w0Plain = cmd.words[0].plain;
37494
37524
  if (!w0Plain || rawState.extensions?.builtins.has(w0Plain))
37495
37525
  return undefined;
37496
- if (w0Plain === "xxd" || w0Plain === "od" || w0Plain === "mktemp" || w0Plain === "chmod") {
37526
+ if (w0Plain === "fmt" && !hasSingleStdinRedir && !hasSingleHereStringRedir && !io.stdinIsDefault)
37527
+ return undefined;
37528
+ if (w0Plain === "xxd" || w0Plain === "od" || w0Plain === "mktemp" || w0Plain === "chmod" || w0Plain === "uname" || w0Plain === "nproc" || w0Plain === "hostname" || w0Plain === "id" || w0Plain === "whoami") {
37497
37529
  const definition = this.getExternalCommand(w0Plain);
37498
37530
  if (!definition || !builtInDirectContextExecutors.has(definition.execute))
37499
37531
  return undefined;
@@ -38376,13 +38408,13 @@ export class Runtime {
38376
38408
  else if (w0Plain === "paste")
38377
38409
  cjLines = this.evalSyncPaste(stdinLines ?? [], allArgs, rawState.cwd);
38378
38410
  else if (w0Plain === "factor")
38379
- cjLines = this.evalSyncFactor(stdinLines ?? [], allArgs);
38411
+ cjLines = this.evalSyncFactor(stdinLines, allArgs);
38380
38412
  else if (w0Plain === "tsort")
38381
- cjLines = this.evalSyncTsort(stdinLines ?? [], allArgs, rawState.cwd);
38413
+ cjLines = this.evalSyncTsort(stdinLines, allArgs, rawState.cwd);
38382
38414
  else if (w0Plain === "jq")
38383
38415
  cjLines = this.evalSyncJq(undefined, allArgs, rawState.cwd);
38384
38416
  else if (w0Plain === "envsubst") {
38385
- const esOut = this.evalSyncEnvsubst("", allArgs, rawState);
38417
+ const esOut = this.evalSyncEnvsubst(undefined, allArgs, rawState);
38386
38418
  if (esOut !== undefined)
38387
38419
  cjLines = esOut.endsWith("\n") ? esOut.slice(0, -1).split("\n") : (esOut ? [esOut] : []);
38388
38420
  }