gipity 1.1.31 → 1.1.32

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.
@@ -130,7 +130,9 @@ function parseViewportString(s) {
130
130
  const height = parseInt(m[2], 10);
131
131
  const dpr = m[3] ? parseFloat(m[3]) : undefined;
132
132
  if (width < 200 || width > 3840 || height < 200 || height > 2160) {
133
- throw new Error(`Viewport out of range: ${s} (200-3840 x 200-2160)`);
133
+ // A tall viewport is nearly always "show me the whole page": name the flag for that.
134
+ const tall = height > 2160 ? ` To capture a page taller than the window, keep a normal viewport and add --full (e.g. --viewport ${Math.min(Math.max(width, 200), 3840)}x900 --full).` : '';
135
+ throw new Error(`Viewport out of range: ${s} (200-3840 x 200-2160).${tall}`);
134
136
  }
135
137
  return dpr ? { width, height, deviceScaleFactor: dpr } : { width, height };
136
138
  }
@@ -52,6 +52,9 @@ const CODE_OPENERS = new Set([
52
52
  * not an assignment (`x = 1` is Python-or-bash-ambiguous). Anything that
53
53
  * fails these checks still goes through the explicit-pin error below.
54
54
  */
55
+ /** Longest --timeout one sandbox run accepts: the request has to finish
56
+ * inside the load balancer's 300s idle limit, output upload included. */
57
+ export const SANDBOX_MAX_TIMEOUT_S = 280;
55
58
  export function looksLikeShellCommand(code) {
56
59
  if (code.includes('\n'))
57
60
  return false;
@@ -253,7 +256,7 @@ sandboxCommand
253
256
  // `node` token still pins the language (so `python -c '...'` runs as python).
254
257
  .addOption(new Option('-c, --cmd <code>', 'Inline code (bash idiom: `sandbox run bash -c "<code>"`)').hideHelp())
255
258
  .addOption(new Option('-e, --eval <code>', 'Inline code (node idiom: `sandbox run node -e "<code>"`)').hideHelp())
256
- .option('--timeout <seconds>', 'Execution timeout. Bare number = seconds; or pass an explicit unit that means the same on both this and `page eval --timeout`, e.g. --timeout 90s.', '30')
259
+ .option('--timeout <seconds>', 'Execution timeout, max 280s (longer work: a Gipity Job). Bare number = seconds; or pass an explicit unit that means the same on both this and `page eval --timeout`, e.g. --timeout 90s.', '30')
257
260
  .option('--input <path>', 'Narrow to specific project files instead of auto-mirroring the whole tree (repeatable). Use this only for >1 GB projects or when you want surgical control.', (v, prev) => [...(prev ?? []), v])
258
261
  // Named "discard", not "no-sync": in Gipity vocabulary "sync" means the
259
262
  // local<->cloud file sync, so a no-sync spelling reads as "give me the file
@@ -405,12 +408,19 @@ GCC/Rust).
405
408
  console.error(clrError('--discard-output requires a non-empty glob (e.g. --discard-output "*.ppm")'));
406
409
  process.exit(1);
407
410
  }
408
- // Args are good - now it's worth resolving (and announcing) the project.
409
- const { config } = await resolveProjectContext();
410
411
  // A bare number is native SECONDS; an explicit suffix (90s / 1500ms / 2m) is
411
412
  // portable with `page eval --timeout` and converted to seconds here.
412
413
  const durOpt = parseDuration(opts.timeout, 's');
413
414
  const timeout = durOpt ? Math.max(1, Math.round(durOpt.value)) : parseInt(opts.timeout, 10);
415
+ // The run is one HTTP request, and the connection is cut at the load
416
+ // balancer's 300s idle limit however long --timeout is: refuse what can't work.
417
+ if (timeout > SANDBOX_MAX_TIMEOUT_S) {
418
+ console.error(clrError(`--timeout ${timeout}s is over the ${SANDBOX_MAX_TIMEOUT_S}s limit for one sandbox run (it is a single HTTP call).`));
419
+ console.error(dim(' Split the work into shorter runs, or run it as a Gipity Job (`gipity skill read jobs`), which has no such limit.'));
420
+ process.exit(1);
421
+ }
422
+ // Args are good - now it's worth resolving (and announcing) the project.
423
+ const { config } = await resolveProjectContext();
414
424
  const cwd = resolveRelativeCwd();
415
425
  // A scratch path is never synced, so it can never reach the VFS the sandbox
416
426
  // mirrors from - `--input tmp/frame.png` would fail inside the container with
@@ -481,7 +491,9 @@ GCC/Rust).
481
491
  // make every later sync propose deleting them. (`noSyncOutput` is the
482
492
  // wire name for --discard-output.)
483
493
  noSyncOutput: discardOutput.length ? discardOutput : undefined,
484
- });
494
+ // Wait as long as the run may take, plus room for the mirror and output
495
+ // upload. The 60s default cut off any run asking for more than that.
496
+ }, { timeoutMs: (isNaN(timeout) ? 30 : timeout) * 1000 + 30_000 });
485
497
  const res = opts.json
486
498
  ? await doRun()
487
499
  : await withSpinner('Running in sandbox...', doRun, { done: null });
package/dist/index.js CHANGED
@@ -38679,7 +38679,8 @@ function parseViewportString(s) {
38679
38679
  const height = parseInt(m[2], 10);
38680
38680
  const dpr = m[3] ? parseFloat(m[3]) : void 0;
38681
38681
  if (width < 200 || width > 3840 || height < 200 || height > 2160) {
38682
- throw new Error(`Viewport out of range: ${s} (200-3840 x 200-2160)`);
38682
+ const tall = height > 2160 ? ` To capture a page taller than the window, keep a normal viewport and add --full (e.g. --viewport ${Math.min(Math.max(width, 200), 3840)}x900 --full).` : "";
38683
+ throw new Error(`Viewport out of range: ${s} (200-3840 x 200-2160).${tall}`);
38683
38684
  }
38684
38685
  return dpr ? { width, height, deviceScaleFactor: dpr } : { width, height };
38685
38686
  }
@@ -39742,6 +39743,7 @@ var CODE_OPENERS = /* @__PURE__ */ new Set([
39742
39743
  "try",
39743
39744
  "with"
39744
39745
  ]);
39746
+ var SANDBOX_MAX_TIMEOUT_S = 280;
39745
39747
  function looksLikeShellCommand(code) {
39746
39748
  if (code.includes("\n")) return false;
39747
39749
  const m = /^([A-Za-z0-9_.~/-]+)(\s|$)/.exec(code.trim());
@@ -39839,7 +39841,7 @@ function resolveRelativeCwd() {
39839
39841
  return rel2.split(/[\\/]/).filter(Boolean).join("/");
39840
39842
  }
39841
39843
  var sandboxCommand = new Command("sandbox").description("Run code in a sandbox");
39842
- sandboxCommand.command("run [args...]").description("Run code").option("--language <language>", "Language: js, py, or bash (required unless pinned by an interpreter token or --file extension)").option("--file <path>", "Read the code body from a file instead of the inline <code> arg; --language is inferred from the extension when not given").addOption(new Option("--code <code>", "Alias for the positional inline <code> arg").hideHelp()).addOption(new Option("-c, --cmd <code>", 'Inline code (bash idiom: `sandbox run bash -c "<code>"`)').hideHelp()).addOption(new Option("-e, --eval <code>", 'Inline code (node idiom: `sandbox run node -e "<code>"`)').hideHelp()).option("--timeout <seconds>", "Execution timeout. Bare number = seconds; or pass an explicit unit that means the same on both this and `page eval --timeout`, e.g. --timeout 90s.", "30").option(
39844
+ sandboxCommand.command("run [args...]").description("Run code").option("--language <language>", "Language: js, py, or bash (required unless pinned by an interpreter token or --file extension)").option("--file <path>", "Read the code body from a file instead of the inline <code> arg; --language is inferred from the extension when not given").addOption(new Option("--code <code>", "Alias for the positional inline <code> arg").hideHelp()).addOption(new Option("-c, --cmd <code>", 'Inline code (bash idiom: `sandbox run bash -c "<code>"`)').hideHelp()).addOption(new Option("-e, --eval <code>", 'Inline code (node idiom: `sandbox run node -e "<code>"`)').hideHelp()).option("--timeout <seconds>", "Execution timeout, max 280s (longer work: a Gipity Job). Bare number = seconds; or pass an explicit unit that means the same on both this and `page eval --timeout`, e.g. --timeout 90s.", "30").option(
39843
39845
  "--input <path>",
39844
39846
  "Narrow to specific project files instead of auto-mirroring the whole tree (repeatable). Use this only for >1 GB projects or when you want surgical control.",
39845
39847
  (v7, prev) => [...prev ?? [], v7]
@@ -39952,9 +39954,14 @@ GCC/Rust).
39952
39954
  console.error(error('--discard-output requires a non-empty glob (e.g. --discard-output "*.ppm")'));
39953
39955
  process.exit(1);
39954
39956
  }
39955
- const { config } = await resolveProjectContext();
39956
39957
  const durOpt = parseDuration(opts.timeout, "s");
39957
39958
  const timeout = durOpt ? Math.max(1, Math.round(durOpt.value)) : parseInt(opts.timeout, 10);
39959
+ if (timeout > SANDBOX_MAX_TIMEOUT_S) {
39960
+ console.error(error(`--timeout ${timeout}s is over the ${SANDBOX_MAX_TIMEOUT_S}s limit for one sandbox run (it is a single HTTP call).`));
39961
+ console.error(dim(" Split the work into shorter runs, or run it as a Gipity Job (`gipity skill read jobs`), which has no such limit."));
39962
+ process.exit(1);
39963
+ }
39964
+ const { config } = await resolveProjectContext();
39958
39965
  const cwd = resolveRelativeCwd();
39959
39966
  const scratchInputs = (opts.input ?? []).filter(
39960
39967
  (p) => shouldIgnore(p.replace(/\\/g, "/").replace(/^\.\//, ""), SCRATCH_IGNORE)
@@ -39996,7 +40003,9 @@ GCC/Rust).
39996
40003
  // make every later sync propose deleting them. (`noSyncOutput` is the
39997
40004
  // wire name for --discard-output.)
39998
40005
  noSyncOutput: discardOutput.length ? discardOutput : void 0
39999
- });
40006
+ // Wait as long as the run may take, plus room for the mirror and output
40007
+ // upload. The 60s default cut off any run asking for more than that.
40008
+ }, { timeoutMs: (isNaN(timeout) ? 30 : timeout) * 1e3 + 3e4 });
40000
40009
  const res = opts.json ? await doRun() : await withSpinner("Running in sandbox...", doRun, { done: null });
40001
40010
  const pulledLocal = !!(res.data.outputFiles?.length && getConfigPath());
40002
40011
  if (pulledLocal) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gipity",
3
- "version": "1.1.31",
3
+ "version": "1.1.32",
4
4
  "description": "The full-stack platform tuned for AI agents. Database, storage, auth, functions, deploy, and drop-in kits - all agent-tuned. Pair with Claude Code or use standalone.",
5
5
  "bin": {
6
6
  "gipity": "dist/updater/shim.js",