@swmansion/argent 0.34.1-next.27 → 0.34.1-next.29

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/cli-cmds.mjs CHANGED
@@ -30959,7 +30959,7 @@ async function sniffFormat(archivePath) {
30959
30959
  }
30960
30960
  }
30961
30961
  var ZSTD_FRAME_MAGIC = 4247762216;
30962
- async function assertSingleCompleteZstdFrame(archivePath) {
30962
+ async function assertSingleCompleteZstdFrame(archivePath, signal) {
30963
30963
  const fh = await open2(archivePath, "r");
30964
30964
  try {
30965
30965
  const { size } = await fh.stat();
@@ -30969,6 +30969,7 @@ async function assertSingleCompleteZstdFrame(archivePath) {
30969
30969
  let pos = 0;
30970
30970
  const read = async (n3) => {
30971
30971
  if (pos < windowStart || pos + n3 > windowEnd) {
30972
+ signal?.throwIfAborted();
30972
30973
  const { bytesRead } = await fh.read(window2, 0, window2.length, pos);
30973
30974
  windowStart = pos;
30974
30975
  windowEnd = pos + bytesRead;
@@ -31006,14 +31007,16 @@ function tarEnv(env) {
31006
31007
  const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
31007
31008
  return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
31008
31009
  }
31009
- async function runTar(archive, args) {
31010
+ async function runTar(archive, args, signal) {
31010
31011
  const child = spawn2("tar", [...args, "-f", "-"], {
31012
+ signal,
31011
31013
  env: tarEnv(process.env)
31012
31014
  });
31013
- const exited = new Promise((res, rej) => {
31014
- child.on("error", rej);
31015
- child.on("close", res);
31015
+ let childError;
31016
+ child.on("error", (err) => {
31017
+ childError = err;
31016
31018
  });
31019
+ const closed = new Promise((resolve13) => child.once("close", resolve13));
31017
31020
  const stdout2 = collect(child.stdout, MAX_LISTING_BYTES, {
31018
31021
  maxLines: MAX_LISTING_LINES,
31019
31022
  onOverflow: () => child.kill()
@@ -31040,12 +31043,15 @@ async function runTar(archive, args) {
31040
31043
  if (err) child.stdin?.destroy();
31041
31044
  done(err);
31042
31045
  }
31043
- })
31046
+ }),
31047
+ { signal }
31044
31048
  ).then(
31045
31049
  () => null,
31046
31050
  (err) => err
31047
31051
  );
31048
- const [code, feedError] = await Promise.all([exited, fed]);
31052
+ const [code, feedError] = await Promise.all([closed, fed]);
31053
+ signal?.throwIfAborted();
31054
+ if (childError) throw childError;
31049
31055
  if (stdout2.overflowed()) {
31050
31056
  throw new Error(
31051
31057
  `tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
@@ -31070,21 +31076,22 @@ function isSafeTarMember(memberPath, destDir) {
31070
31076
  const root = resolve6(destDir);
31071
31077
  return resolve6(destDir, normalized).startsWith(root + sep2);
31072
31078
  }
31073
- async function readListing(archive, args) {
31079
+ async function readListing(archive, args, signal) {
31074
31080
  try {
31075
- return await runTar(archive, args);
31081
+ return await runTar(archive, args, signal);
31076
31082
  } catch (err) {
31083
+ signal?.throwIfAborted();
31077
31084
  throw new ArchiveError(
31078
31085
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
31079
31086
  );
31080
31087
  }
31081
31088
  }
31082
- async function listTarMembers(archive) {
31083
- const stdout2 = await readListing(archive, ["-t"]);
31089
+ async function listTarMembers(archive, signal) {
31090
+ const stdout2 = await readListing(archive, ["-t"], signal);
31084
31091
  return stdout2.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
31085
31092
  }
31086
- async function assertSafeMemberTypes(archive) {
31087
- const stdout2 = await readListing(archive, ["-tv"]);
31093
+ async function assertSafeMemberTypes(archive, signal) {
31094
+ const stdout2 = await readListing(archive, ["-tv"], signal);
31088
31095
  for (const line of stdout2.split("\n")) {
31089
31096
  if (!line.trim()) continue;
31090
31097
  const type = line[0];
@@ -31104,8 +31111,8 @@ async function assertSafeMemberTypes(archive) {
31104
31111
  );
31105
31112
  }
31106
31113
  }
31107
- async function assertSafeArchive(archive, destDir) {
31108
- const members2 = await listTarMembers(archive);
31114
+ async function assertSafeArchive(archive, destDir, signal) {
31115
+ const members2 = await listTarMembers(archive, signal);
31109
31116
  if (members2.length === 0) {
31110
31117
  throw new ArchiveError("Archive is empty.");
31111
31118
  }
@@ -31114,7 +31121,7 @@ async function assertSafeArchive(archive, destDir) {
31114
31121
  throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
31115
31122
  }
31116
31123
  }
31117
- await assertSafeMemberTypes(archive);
31124
+ await assertSafeMemberTypes(archive, signal);
31118
31125
  }
31119
31126
  async function resolveMember(destDir, expectedName) {
31120
31127
  const entries = await readdir3(destDir);
@@ -31129,19 +31136,24 @@ async function resolveMember(destDir, expectedName) {
31129
31136
  }
31130
31137
  return join9(destDir, real[0]);
31131
31138
  }
31132
- async function safeExtractArchive(archivePath, destDir, expectedName) {
31139
+ async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
31140
+ signal?.throwIfAborted();
31133
31141
  let archive;
31134
31142
  try {
31135
31143
  archive = { path: archivePath, format: await sniffFormat(archivePath) };
31136
- if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
31144
+ if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath, signal);
31137
31145
  } catch (err) {
31146
+ signal?.throwIfAborted();
31138
31147
  throw new ArchiveError(
31139
31148
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
31140
31149
  );
31141
31150
  }
31142
- await assertSafeArchive(archive, destDir);
31143
- await runTar(archive, ["-x", "-C", destDir]);
31144
- return resolveMember(destDir, expectedName);
31151
+ await assertSafeArchive(archive, destDir, signal);
31152
+ signal?.throwIfAborted();
31153
+ await runTar(archive, ["-x", "-C", destDir], signal);
31154
+ const member = await resolveMember(destDir, expectedName);
31155
+ signal?.throwIfAborted();
31156
+ return member;
31145
31157
  }
31146
31158
 
31147
31159
  // ../argent-tools-client/src/errors.ts
@@ -32327,7 +32339,16 @@ function createToolsClient(options = {}) {
32327
32339
  }
32328
32340
 
32329
32341
  // ../argent-tools-client/src/artifacts.ts
32330
- import { copyFile, mkdir as mkdir4, readFile as readFile6, realpath as realpath4, rm as rm3, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
32342
+ import {
32343
+ copyFile,
32344
+ mkdir as mkdir4,
32345
+ mkdtemp,
32346
+ readFile as readFile6,
32347
+ realpath as realpath4,
32348
+ rm as rm3,
32349
+ stat as stat5,
32350
+ writeFile as writeFile4
32351
+ } from "node:fs/promises";
32331
32352
  import { constants as fsConstants } from "node:fs";
32332
32353
  import { tmpdir as tmpdir2 } from "node:os";
32333
32354
  import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve8, sep as sep4 } from "node:path";
@@ -32471,16 +32492,22 @@ async function resolveLocalFile(handle) {
32471
32492
  return null;
32472
32493
  }
32473
32494
  }
32474
- async function downloadAndExtractArchive(handle, data, dir) {
32475
- const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
32495
+ async function downloadAndExtractArchive(handle, data, dir, signal) {
32496
+ signal?.throwIfAborted();
32497
+ const attemptDir = await mkdtemp(join13(dir, "bundle-"));
32498
+ const tarball = join13(attemptDir, "download.tar");
32499
+ const extractDir = join13(attemptDir, "files");
32476
32500
  try {
32477
- await writeFile4(tarball, data);
32478
- return await safeExtractArchive(tarball, dir, handle.filename);
32501
+ await writeFile4(tarball, data, { signal });
32502
+ await mkdir4(extractDir);
32503
+ const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
32504
+ await rm3(tarball);
32505
+ signal?.throwIfAborted();
32506
+ return member;
32479
32507
  } catch {
32480
- return null;
32481
- } finally {
32482
- await rm3(tarball, { force: true }).catch(() => {
32508
+ await rm3(attemptDir, { recursive: true, force: true }).catch(() => {
32483
32509
  });
32510
+ return null;
32484
32511
  }
32485
32512
  }
32486
32513
  async function materializeArtifacts(result, ctx) {
@@ -32566,7 +32593,7 @@ async function materializeArtifacts(result, ctx) {
32566
32593
  if (!data) return null;
32567
32594
  await ensureDir();
32568
32595
  if (value.archive === "tar.gz") {
32569
- return await downloadAndExtractArchive(value, data, dir);
32596
+ return await downloadAndExtractArchive(value, data, dir, ctx.signal);
32570
32597
  }
32571
32598
  if (value.size > 0 && data.length !== value.size) return null;
32572
32599
  const downloadedPath = join13(dir, sanitizeSegment(value.filename));
@@ -36145,7 +36172,7 @@ function isCi(env = process.env) {
36145
36172
  var SESSION_ID2 = randomUUID5();
36146
36173
  function readCliVersion() {
36147
36174
  if (true) {
36148
- return "0.34.1-next.27";
36175
+ return "0.34.1-next.29";
36149
36176
  }
36150
36177
  return "0.0.0";
36151
36178
  }
package/dist/client.js CHANGED
@@ -9699,7 +9699,7 @@ async function sniffFormat(archivePath) {
9699
9699
  }
9700
9700
  }
9701
9701
  var ZSTD_FRAME_MAGIC = 4247762216;
9702
- async function assertSingleCompleteZstdFrame(archivePath) {
9702
+ async function assertSingleCompleteZstdFrame(archivePath, signal) {
9703
9703
  const fh = await open(archivePath, "r");
9704
9704
  try {
9705
9705
  const { size } = await fh.stat();
@@ -9709,6 +9709,7 @@ async function assertSingleCompleteZstdFrame(archivePath) {
9709
9709
  let pos = 0;
9710
9710
  const read = async (n) => {
9711
9711
  if (pos < windowStart || pos + n > windowEnd) {
9712
+ signal?.throwIfAborted();
9712
9713
  const { bytesRead } = await fh.read(window, 0, window.length, pos);
9713
9714
  windowStart = pos;
9714
9715
  windowEnd = pos + bytesRead;
@@ -9746,14 +9747,16 @@ function tarEnv(env) {
9746
9747
  const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
9747
9748
  return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
9748
9749
  }
9749
- async function runTar(archive, args) {
9750
+ async function runTar(archive, args, signal) {
9750
9751
  const child = spawn2("tar", [...args, "-f", "-"], {
9752
+ signal,
9751
9753
  env: tarEnv(process.env)
9752
9754
  });
9753
- const exited = new Promise((res, rej) => {
9754
- child.on("error", rej);
9755
- child.on("close", res);
9755
+ let childError;
9756
+ child.on("error", (err) => {
9757
+ childError = err;
9756
9758
  });
9759
+ const closed = new Promise((resolve9) => child.once("close", resolve9));
9757
9760
  const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
9758
9761
  maxLines: MAX_LISTING_LINES,
9759
9762
  onOverflow: () => child.kill()
@@ -9780,12 +9783,15 @@ async function runTar(archive, args) {
9780
9783
  if (err) child.stdin?.destroy();
9781
9784
  done(err);
9782
9785
  }
9783
- })
9786
+ }),
9787
+ { signal }
9784
9788
  ).then(
9785
9789
  () => null,
9786
9790
  (err) => err
9787
9791
  );
9788
- const [code, feedError] = await Promise.all([exited, fed]);
9792
+ const [code, feedError] = await Promise.all([closed, fed]);
9793
+ signal?.throwIfAborted();
9794
+ if (childError) throw childError;
9789
9795
  if (stdout.overflowed()) {
9790
9796
  throw new Error(
9791
9797
  `tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
@@ -9810,21 +9816,22 @@ function isSafeTarMember(memberPath, destDir) {
9810
9816
  const root = resolve6(destDir);
9811
9817
  return resolve6(destDir, normalized).startsWith(root + sep2);
9812
9818
  }
9813
- async function readListing(archive, args) {
9819
+ async function readListing(archive, args, signal) {
9814
9820
  try {
9815
- return await runTar(archive, args);
9821
+ return await runTar(archive, args, signal);
9816
9822
  } catch (err) {
9823
+ signal?.throwIfAborted();
9817
9824
  throw new ArchiveError(
9818
9825
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
9819
9826
  );
9820
9827
  }
9821
9828
  }
9822
- async function listTarMembers(archive) {
9823
- const stdout = await readListing(archive, ["-t"]);
9829
+ async function listTarMembers(archive, signal) {
9830
+ const stdout = await readListing(archive, ["-t"], signal);
9824
9831
  return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
9825
9832
  }
9826
- async function assertSafeMemberTypes(archive) {
9827
- const stdout = await readListing(archive, ["-tv"]);
9833
+ async function assertSafeMemberTypes(archive, signal) {
9834
+ const stdout = await readListing(archive, ["-tv"], signal);
9828
9835
  for (const line of stdout.split("\n")) {
9829
9836
  if (!line.trim()) continue;
9830
9837
  const type = line[0];
@@ -9844,8 +9851,8 @@ async function assertSafeMemberTypes(archive) {
9844
9851
  );
9845
9852
  }
9846
9853
  }
9847
- async function assertSafeArchive(archive, destDir) {
9848
- const members = await listTarMembers(archive);
9854
+ async function assertSafeArchive(archive, destDir, signal) {
9855
+ const members = await listTarMembers(archive, signal);
9849
9856
  if (members.length === 0) {
9850
9857
  throw new ArchiveError("Archive is empty.");
9851
9858
  }
@@ -9854,7 +9861,7 @@ async function assertSafeArchive(archive, destDir) {
9854
9861
  throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
9855
9862
  }
9856
9863
  }
9857
- await assertSafeMemberTypes(archive);
9864
+ await assertSafeMemberTypes(archive, signal);
9858
9865
  }
9859
9866
  async function resolveMember(destDir, expectedName) {
9860
9867
  const entries = await readdir3(destDir);
@@ -9869,19 +9876,24 @@ async function resolveMember(destDir, expectedName) {
9869
9876
  }
9870
9877
  return join9(destDir, real[0]);
9871
9878
  }
9872
- async function safeExtractArchive(archivePath, destDir, expectedName) {
9879
+ async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
9880
+ signal?.throwIfAborted();
9873
9881
  let archive;
9874
9882
  try {
9875
9883
  archive = { path: archivePath, format: await sniffFormat(archivePath) };
9876
- if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
9884
+ if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath, signal);
9877
9885
  } catch (err) {
9886
+ signal?.throwIfAborted();
9878
9887
  throw new ArchiveError(
9879
9888
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
9880
9889
  );
9881
9890
  }
9882
- await assertSafeArchive(archive, destDir);
9883
- await runTar(archive, ["-x", "-C", destDir]);
9884
- return resolveMember(destDir, expectedName);
9891
+ await assertSafeArchive(archive, destDir, signal);
9892
+ signal?.throwIfAborted();
9893
+ await runTar(archive, ["-x", "-C", destDir], signal);
9894
+ const member = await resolveMember(destDir, expectedName);
9895
+ signal?.throwIfAborted();
9896
+ return member;
9885
9897
  }
9886
9898
 
9887
9899
  // ../argent-tools-client/src/errors.ts
@@ -11067,7 +11079,16 @@ function createToolsClient(options = {}) {
11067
11079
  }
11068
11080
 
11069
11081
  // ../argent-tools-client/src/artifacts.ts
11070
- import { copyFile, mkdir as mkdir4, readFile as readFile6, realpath as realpath4, rm as rm3, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
11082
+ import {
11083
+ copyFile,
11084
+ mkdir as mkdir4,
11085
+ mkdtemp,
11086
+ readFile as readFile6,
11087
+ realpath as realpath4,
11088
+ rm as rm3,
11089
+ stat as stat5,
11090
+ writeFile as writeFile4
11091
+ } from "node:fs/promises";
11071
11092
  import { constants as fsConstants } from "node:fs";
11072
11093
  import { tmpdir as tmpdir2 } from "node:os";
11073
11094
  import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve8, sep as sep4 } from "node:path";
@@ -11211,16 +11232,22 @@ async function resolveLocalFile(handle) {
11211
11232
  return null;
11212
11233
  }
11213
11234
  }
11214
- async function downloadAndExtractArchive(handle, data, dir) {
11215
- const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
11235
+ async function downloadAndExtractArchive(handle, data, dir, signal) {
11236
+ signal?.throwIfAborted();
11237
+ const attemptDir = await mkdtemp(join13(dir, "bundle-"));
11238
+ const tarball = join13(attemptDir, "download.tar");
11239
+ const extractDir = join13(attemptDir, "files");
11216
11240
  try {
11217
- await writeFile4(tarball, data);
11218
- return await safeExtractArchive(tarball, dir, handle.filename);
11241
+ await writeFile4(tarball, data, { signal });
11242
+ await mkdir4(extractDir);
11243
+ const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
11244
+ await rm3(tarball);
11245
+ signal?.throwIfAborted();
11246
+ return member;
11219
11247
  } catch {
11220
- return null;
11221
- } finally {
11222
- await rm3(tarball, { force: true }).catch(() => {
11248
+ await rm3(attemptDir, { recursive: true, force: true }).catch(() => {
11223
11249
  });
11250
+ return null;
11224
11251
  }
11225
11252
  }
11226
11253
  async function materializeArtifacts(result, ctx) {
@@ -11306,7 +11333,7 @@ async function materializeArtifacts(result, ctx) {
11306
11333
  if (!data) return null;
11307
11334
  await ensureDir();
11308
11335
  if (value.archive === "tar.gz") {
11309
- return await downloadAndExtractArchive(value, data, dir);
11336
+ return await downloadAndExtractArchive(value, data, dir, ctx.signal);
11310
11337
  }
11311
11338
  if (value.size > 0 && data.length !== value.size) return null;
11312
11339
  const downloadedPath = join13(dir, sanitizeSegment(value.filename));
@@ -16925,7 +16925,7 @@ function isCi(env = process.env) {
16925
16925
  var SESSION_ID = randomUUID4();
16926
16926
  function readCliVersion() {
16927
16927
  if (true) {
16928
- return "0.34.1-next.27";
16928
+ return "0.34.1-next.29";
16929
16929
  }
16930
16930
  return "0.0.0";
16931
16931
  }
@@ -24301,7 +24301,16 @@ import * as path26 from "node:path";
24301
24301
  var INLINE_MEMBERS_BYTES = 256 * 1024;
24302
24302
 
24303
24303
  // ../argent-tools-client/src/artifacts.ts
24304
- import { copyFile, mkdir as mkdir4, readFile as readFile6, realpath as realpath4, rm as rm3, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
24304
+ import {
24305
+ copyFile,
24306
+ mkdir as mkdir4,
24307
+ mkdtemp,
24308
+ readFile as readFile6,
24309
+ realpath as realpath4,
24310
+ rm as rm3,
24311
+ stat as stat5,
24312
+ writeFile as writeFile4
24313
+ } from "node:fs/promises";
24305
24314
  import { constants as fsConstants } from "node:fs";
24306
24315
  import { tmpdir as tmpdir2 } from "node:os";
24307
24316
  import { basename as basename7, dirname as dirname17, extname as extname2, isAbsolute as isAbsolute8, join as join28, normalize as normalize2, resolve as resolve15, sep as sep6 } from "node:path";
@@ -26459,7 +26459,7 @@ async function sniffFormat(archivePath) {
26459
26459
  }
26460
26460
  }
26461
26461
  var ZSTD_FRAME_MAGIC = 4247762216;
26462
- async function assertSingleCompleteZstdFrame(archivePath) {
26462
+ async function assertSingleCompleteZstdFrame(archivePath, signal) {
26463
26463
  const fh = await open2(archivePath, "r");
26464
26464
  try {
26465
26465
  const { size } = await fh.stat();
@@ -26469,6 +26469,7 @@ async function assertSingleCompleteZstdFrame(archivePath) {
26469
26469
  let pos = 0;
26470
26470
  const read = async (n) => {
26471
26471
  if (pos < windowStart || pos + n > windowEnd) {
26472
+ signal?.throwIfAborted();
26472
26473
  const { bytesRead } = await fh.read(window, 0, window.length, pos);
26473
26474
  windowStart = pos;
26474
26475
  windowEnd = pos + bytesRead;
@@ -26506,14 +26507,16 @@ function tarEnv(env) {
26506
26507
  const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
26507
26508
  return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
26508
26509
  }
26509
- async function runTar(archive, args) {
26510
+ async function runTar(archive, args, signal) {
26510
26511
  const child = spawn2("tar", [...args, "-f", "-"], {
26512
+ signal,
26511
26513
  env: tarEnv(process.env)
26512
26514
  });
26513
- const exited = new Promise((res, rej) => {
26514
- child.on("error", rej);
26515
- child.on("close", res);
26515
+ let childError;
26516
+ child.on("error", (err) => {
26517
+ childError = err;
26516
26518
  });
26519
+ const closed = new Promise((resolve10) => child.once("close", resolve10));
26517
26520
  const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
26518
26521
  maxLines: MAX_LISTING_LINES,
26519
26522
  onOverflow: () => child.kill()
@@ -26540,12 +26543,15 @@ async function runTar(archive, args) {
26540
26543
  if (err) child.stdin?.destroy();
26541
26544
  done(err);
26542
26545
  }
26543
- })
26546
+ }),
26547
+ { signal }
26544
26548
  ).then(
26545
26549
  () => null,
26546
26550
  (err) => err
26547
26551
  );
26548
- const [code, feedError] = await Promise.all([exited, fed]);
26552
+ const [code, feedError] = await Promise.all([closed, fed]);
26553
+ signal?.throwIfAborted();
26554
+ if (childError) throw childError;
26549
26555
  if (stdout.overflowed()) {
26550
26556
  throw new Error(
26551
26557
  `tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
@@ -26570,21 +26576,22 @@ function isSafeTarMember(memberPath, destDir) {
26570
26576
  const root = resolve6(destDir);
26571
26577
  return resolve6(destDir, normalized).startsWith(root + sep2);
26572
26578
  }
26573
- async function readListing(archive, args) {
26579
+ async function readListing(archive, args, signal) {
26574
26580
  try {
26575
- return await runTar(archive, args);
26581
+ return await runTar(archive, args, signal);
26576
26582
  } catch (err) {
26583
+ signal?.throwIfAborted();
26577
26584
  throw new ArchiveError(
26578
26585
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
26579
26586
  );
26580
26587
  }
26581
26588
  }
26582
- async function listTarMembers(archive) {
26583
- const stdout = await readListing(archive, ["-t"]);
26589
+ async function listTarMembers(archive, signal) {
26590
+ const stdout = await readListing(archive, ["-t"], signal);
26584
26591
  return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
26585
26592
  }
26586
- async function assertSafeMemberTypes(archive) {
26587
- const stdout = await readListing(archive, ["-tv"]);
26593
+ async function assertSafeMemberTypes(archive, signal) {
26594
+ const stdout = await readListing(archive, ["-tv"], signal);
26588
26595
  for (const line of stdout.split("\n")) {
26589
26596
  if (!line.trim()) continue;
26590
26597
  const type = line[0];
@@ -26604,8 +26611,8 @@ async function assertSafeMemberTypes(archive) {
26604
26611
  );
26605
26612
  }
26606
26613
  }
26607
- async function assertSafeArchive(archive, destDir) {
26608
- const members2 = await listTarMembers(archive);
26614
+ async function assertSafeArchive(archive, destDir, signal) {
26615
+ const members2 = await listTarMembers(archive, signal);
26609
26616
  if (members2.length === 0) {
26610
26617
  throw new ArchiveError("Archive is empty.");
26611
26618
  }
@@ -26614,7 +26621,7 @@ async function assertSafeArchive(archive, destDir) {
26614
26621
  throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
26615
26622
  }
26616
26623
  }
26617
- await assertSafeMemberTypes(archive);
26624
+ await assertSafeMemberTypes(archive, signal);
26618
26625
  }
26619
26626
  async function resolveMember(destDir, expectedName) {
26620
26627
  const entries = await readdir3(destDir);
@@ -26629,19 +26636,24 @@ async function resolveMember(destDir, expectedName) {
26629
26636
  }
26630
26637
  return join9(destDir, real[0]);
26631
26638
  }
26632
- async function safeExtractArchive(archivePath, destDir, expectedName) {
26639
+ async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
26640
+ signal?.throwIfAborted();
26633
26641
  let archive;
26634
26642
  try {
26635
26643
  archive = { path: archivePath, format: await sniffFormat(archivePath) };
26636
- if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
26644
+ if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath, signal);
26637
26645
  } catch (err) {
26646
+ signal?.throwIfAborted();
26638
26647
  throw new ArchiveError(
26639
26648
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
26640
26649
  );
26641
26650
  }
26642
- await assertSafeArchive(archive, destDir);
26643
- await runTar(archive, ["-x", "-C", destDir]);
26644
- return resolveMember(destDir, expectedName);
26651
+ await assertSafeArchive(archive, destDir, signal);
26652
+ signal?.throwIfAborted();
26653
+ await runTar(archive, ["-x", "-C", destDir], signal);
26654
+ const member = await resolveMember(destDir, expectedName);
26655
+ signal?.throwIfAborted();
26656
+ return member;
26645
26657
  }
26646
26658
 
26647
26659
  // ../argent-tools-client/src/errors.ts
@@ -27827,7 +27839,16 @@ function createToolsClient(options = {}) {
27827
27839
  }
27828
27840
 
27829
27841
  // ../argent-tools-client/src/artifacts.ts
27830
- import { copyFile, mkdir as mkdir4, readFile as readFile6, realpath as realpath4, rm as rm3, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
27842
+ import {
27843
+ copyFile,
27844
+ mkdir as mkdir4,
27845
+ mkdtemp,
27846
+ readFile as readFile6,
27847
+ realpath as realpath4,
27848
+ rm as rm3,
27849
+ stat as stat5,
27850
+ writeFile as writeFile4
27851
+ } from "node:fs/promises";
27831
27852
  import { constants as fsConstants } from "node:fs";
27832
27853
  import { tmpdir as tmpdir2 } from "node:os";
27833
27854
  import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve8, sep as sep4 } from "node:path";
@@ -27971,16 +27992,22 @@ async function resolveLocalFile(handle) {
27971
27992
  return null;
27972
27993
  }
27973
27994
  }
27974
- async function downloadAndExtractArchive(handle, data, dir) {
27975
- const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
27995
+ async function downloadAndExtractArchive(handle, data, dir, signal) {
27996
+ signal?.throwIfAborted();
27997
+ const attemptDir = await mkdtemp(join13(dir, "bundle-"));
27998
+ const tarball = join13(attemptDir, "download.tar");
27999
+ const extractDir = join13(attemptDir, "files");
27976
28000
  try {
27977
- await writeFile4(tarball, data);
27978
- return await safeExtractArchive(tarball, dir, handle.filename);
28001
+ await writeFile4(tarball, data, { signal });
28002
+ await mkdir4(extractDir);
28003
+ const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
28004
+ await rm3(tarball);
28005
+ signal?.throwIfAborted();
28006
+ return member;
27979
28007
  } catch {
27980
- return null;
27981
- } finally {
27982
- await rm3(tarball, { force: true }).catch(() => {
28008
+ await rm3(attemptDir, { recursive: true, force: true }).catch(() => {
27983
28009
  });
28010
+ return null;
27984
28011
  }
27985
28012
  }
27986
28013
  async function materializeArtifacts(result, ctx) {
@@ -28066,7 +28093,7 @@ async function materializeArtifacts(result, ctx) {
28066
28093
  if (!data) return null;
28067
28094
  await ensureDir();
28068
28095
  if (value.archive === "tar.gz") {
28069
- return await downloadAndExtractArchive(value, data, dir);
28096
+ return await downloadAndExtractArchive(value, data, dir, ctx.signal);
28070
28097
  }
28071
28098
  if (value.size > 0 && data.length !== value.size) return null;
28072
28099
  const downloadedPath = join13(dir, sanitizeSegment(value.filename));
@@ -338,6 +338,8 @@ export interface ArgentToolArgs {
338
338
  "gesture-custom": {
339
339
  /** Target device id from `list-devices` (iOS UDID or Android serial). */
340
340
  udid: string;
341
+ /** Starting edge in upright screen coordinates for a single-finger system gesture on a local iOS simulator. */
342
+ edge?: "top" | "right" | "bottom" | "left";
341
343
  /** Touch events, dispatched in order. */
342
344
  events: Array<{
343
345
  /** Touch event type */
@@ -101405,7 +101405,7 @@ function isCi(env = process.env) {
101405
101405
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
101406
101406
  function readCliVersion() {
101407
101407
  if (true) {
101408
- return "0.34.1-next.27";
101408
+ return "0.34.1-next.29";
101409
101409
  }
101410
101410
  return "0.0.0";
101411
101411
  }
@@ -102329,7 +102329,7 @@ async function sniffFormat(archivePath) {
102329
102329
  }
102330
102330
  }
102331
102331
  var ZSTD_FRAME_MAGIC = 4247762216;
102332
- async function assertSingleCompleteZstdFrame(archivePath) {
102332
+ async function assertSingleCompleteZstdFrame(archivePath, signal) {
102333
102333
  const fh = await (0, import_promises2.open)(archivePath, "r");
102334
102334
  try {
102335
102335
  const { size } = await fh.stat();
@@ -102339,6 +102339,7 @@ async function assertSingleCompleteZstdFrame(archivePath) {
102339
102339
  let pos = 0;
102340
102340
  const read = async (n) => {
102341
102341
  if (pos < windowStart || pos + n > windowEnd) {
102342
+ signal?.throwIfAborted();
102342
102343
  const { bytesRead } = await fh.read(window2, 0, window2.length, pos);
102343
102344
  windowStart = pos;
102344
102345
  windowEnd = pos + bytesRead;
@@ -102376,14 +102377,16 @@ function tarEnv(env) {
102376
102377
  const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
102377
102378
  return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
102378
102379
  }
102379
- async function runTar(archive, args) {
102380
+ async function runTar(archive, args, signal) {
102380
102381
  const child = (0, import_node_child_process2.spawn)("tar", [...args, "-f", "-"], {
102382
+ signal,
102381
102383
  env: tarEnv(process.env)
102382
102384
  });
102383
- const exited = new Promise((res, rej) => {
102384
- child.on("error", rej);
102385
- child.on("close", res);
102385
+ let childError;
102386
+ child.on("error", (err) => {
102387
+ childError = err;
102386
102388
  });
102389
+ const closed = new Promise((resolve20) => child.once("close", resolve20));
102387
102390
  const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
102388
102391
  maxLines: MAX_LISTING_LINES,
102389
102392
  onOverflow: () => child.kill()
@@ -102410,12 +102413,15 @@ async function runTar(archive, args) {
102410
102413
  if (err) child.stdin?.destroy();
102411
102414
  done(err);
102412
102415
  }
102413
- })
102416
+ }),
102417
+ { signal }
102414
102418
  ).then(
102415
102419
  () => null,
102416
102420
  (err) => err
102417
102421
  );
102418
- const [code, feedError] = await Promise.all([exited, fed]);
102422
+ const [code, feedError] = await Promise.all([closed, fed]);
102423
+ signal?.throwIfAborted();
102424
+ if (childError) throw childError;
102419
102425
  if (stdout.overflowed()) {
102420
102426
  throw new Error(
102421
102427
  `tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
@@ -102440,21 +102446,22 @@ function isSafeTarMember(memberPath2, destDir) {
102440
102446
  const root = (0, import_node_path3.resolve)(destDir);
102441
102447
  return (0, import_node_path3.resolve)(destDir, normalized).startsWith(root + import_node_path3.sep);
102442
102448
  }
102443
- async function readListing(archive, args) {
102449
+ async function readListing(archive, args, signal) {
102444
102450
  try {
102445
- return await runTar(archive, args);
102451
+ return await runTar(archive, args, signal);
102446
102452
  } catch (err) {
102453
+ signal?.throwIfAborted();
102447
102454
  throw new ArchiveError(
102448
102455
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
102449
102456
  );
102450
102457
  }
102451
102458
  }
102452
- async function listTarMembers(archive) {
102453
- const stdout = await readListing(archive, ["-t"]);
102459
+ async function listTarMembers(archive, signal) {
102460
+ const stdout = await readListing(archive, ["-t"], signal);
102454
102461
  return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
102455
102462
  }
102456
- async function assertSafeMemberTypes(archive) {
102457
- const stdout = await readListing(archive, ["-tv"]);
102463
+ async function assertSafeMemberTypes(archive, signal) {
102464
+ const stdout = await readListing(archive, ["-tv"], signal);
102458
102465
  for (const line of stdout.split("\n")) {
102459
102466
  if (!line.trim()) continue;
102460
102467
  const type = line[0];
@@ -102474,8 +102481,8 @@ async function assertSafeMemberTypes(archive) {
102474
102481
  );
102475
102482
  }
102476
102483
  }
102477
- async function assertSafeArchive(archive, destDir) {
102478
- const members2 = await listTarMembers(archive);
102484
+ async function assertSafeArchive(archive, destDir, signal) {
102485
+ const members2 = await listTarMembers(archive, signal);
102479
102486
  if (members2.length === 0) {
102480
102487
  throw new ArchiveError("Archive is empty.");
102481
102488
  }
@@ -102484,7 +102491,7 @@ async function assertSafeArchive(archive, destDir) {
102484
102491
  throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
102485
102492
  }
102486
102493
  }
102487
- await assertSafeMemberTypes(archive);
102494
+ await assertSafeMemberTypes(archive, signal);
102488
102495
  }
102489
102496
  async function resolveMember(destDir, expectedName) {
102490
102497
  const entries = await (0, import_promises2.readdir)(destDir);
@@ -102499,19 +102506,24 @@ async function resolveMember(destDir, expectedName) {
102499
102506
  }
102500
102507
  return (0, import_node_path3.join)(destDir, real[0]);
102501
102508
  }
102502
- async function safeExtractArchive(archivePath, destDir, expectedName) {
102509
+ async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
102510
+ signal?.throwIfAborted();
102503
102511
  let archive;
102504
102512
  try {
102505
102513
  archive = { path: archivePath, format: await sniffFormat(archivePath) };
102506
- if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
102514
+ if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath, signal);
102507
102515
  } catch (err) {
102516
+ signal?.throwIfAborted();
102508
102517
  throw new ArchiveError(
102509
102518
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
102510
102519
  );
102511
102520
  }
102512
- await assertSafeArchive(archive, destDir);
102513
- await runTar(archive, ["-x", "-C", destDir]);
102514
- return resolveMember(destDir, expectedName);
102521
+ await assertSafeArchive(archive, destDir, signal);
102522
+ signal?.throwIfAborted();
102523
+ await runTar(archive, ["-x", "-C", destDir], signal);
102524
+ const member = await resolveMember(destDir, expectedName);
102525
+ signal?.throwIfAborted();
102526
+ return member;
102515
102527
  }
102516
102528
 
102517
102529
  // ../tool-server/src/http.ts
@@ -124433,6 +124445,11 @@ function inNativeCoordinates() {
124433
124445
  }
124434
124446
 
124435
124447
  // ../tool-server/src/utils/ui-orientation.ts
124448
+ var screenEdges = ["top", "right", "bottom", "left"];
124449
+ function uiEdgeToNative(edge, orientation) {
124450
+ const turns = { portrait: 0, landscapeRight: 1, portraitUpsideDown: 2, landscapeLeft: 3 };
124451
+ return screenEdges[(screenEdges.indexOf(edge) + turns[orientation]) % 4];
124452
+ }
124436
124453
  function uiPointToNative(p, orientation) {
124437
124454
  switch (orientation) {
124438
124455
  case "landscapeRight":
@@ -124515,6 +124532,7 @@ var NO_IMAGE_ERROR = /no image to export/i;
124515
124532
  var FIRST_FRAME_WAIT_MS = 6e3;
124516
124533
  var FIRST_FRAME_POLL_MS = 250;
124517
124534
  var COMMAND_ACK_TIMEOUT_MS = 5e3;
124535
+ var EDGE_DOWN_ACK_TIMEOUT_MS = 35e3;
124518
124536
  var connections = /* @__PURE__ */ new Map();
124519
124537
  var cmdId = 0;
124520
124538
  function pendingIdNamedBy(conn, message) {
@@ -124620,6 +124638,7 @@ async function sendCommand(api, cmd) {
124620
124638
  const warning = turnWarning !== void 0 && screenWarning !== void 0 ? `${screenWarning} ${turnWarning}` : screenWarning ?? turnWarning;
124621
124639
  const id = String(++cmdId);
124622
124640
  const payload = JSON.stringify({ id, ...targeted });
124641
+ const ackTimeoutMs = cmdName === "edgeTouch" && cmd.type === "Down" ? EDGE_DOWN_ACK_TIMEOUT_MS : COMMAND_ACK_TIMEOUT_MS;
124623
124642
  await new Promise((resolve20, reject) => {
124624
124643
  let done = false;
124625
124644
  const settle3 = (err) => {
@@ -124633,7 +124652,7 @@ async function sendCommand(api, cmd) {
124633
124652
  const timer = setTimeout(
124634
124653
  () => settleAndDropConnection(
124635
124654
  new FailureError(
124636
- `simulator-server did not acknowledge the '${cmdName}' command within ${COMMAND_ACK_TIMEOUT_MS}ms. The command may not have reached the device \u2014 the simulator may be wedged or the simulator-server unresponsive.`,
124655
+ `simulator-server did not acknowledge the '${cmdName}' command within ${ackTimeoutMs}ms. The command may not have reached the device \u2014 the simulator may be wedged or the simulator-server unresponsive.`,
124637
124656
  {
124638
124657
  error_code: FAILURE_CODES.SIMULATOR_COMMAND_ACK_TIMEOUT,
124639
124658
  failure_stage: "simulator_command_ack",
@@ -124644,7 +124663,7 @@ async function sendCommand(api, cmd) {
124644
124663
  }
124645
124664
  )
124646
124665
  ),
124647
- COMMAND_ACK_TIMEOUT_MS
124666
+ ackTimeoutMs
124648
124667
  );
124649
124668
  timer.unref?.();
124650
124669
  const settleAndDropConnection = (err) => {
@@ -124663,7 +124682,7 @@ async function sendCommand(api, cmd) {
124663
124682
  }
124664
124683
  var gestureTurns = /* @__PURE__ */ new WeakMap();
124665
124684
  async function withNativeTouchSpace(api, cmd) {
124666
- if (cmd.cmd !== "touch" || !api.deviceId || inNativeCoordinates() || !isIosSimulator(resolveDevice(api.deviceId))) {
124685
+ if (cmd.cmd !== "touch" && cmd.cmd !== "edgeTouch" || !api.deviceId || inNativeCoordinates() || !isIosSimulator(resolveDevice(api.deviceId))) {
124667
124686
  return { cmd };
124668
124687
  }
124669
124688
  let orientation;
@@ -124682,6 +124701,7 @@ async function withNativeTouchSpace(api, cmd) {
124682
124701
  if (!isTurned(orientation)) return { cmd, ...warning !== void 0 ? { warning } : {} };
124683
124702
  const turned = { ...cmd };
124684
124703
  const first = uiPointToNative({ x: cmd.x, y: cmd.y }, orientation);
124704
+ if (cmd.cmd === "edgeTouch") turned.edge = uiEdgeToNative(cmd.edge, orientation);
124685
124705
  turned.x = first.x;
124686
124706
  turned.y = first.y;
124687
124707
  const sx = cmd.second_x;
@@ -124696,7 +124716,7 @@ async function withNativeTouchSpace(api, cmd) {
124696
124716
  var gestureScreens = /* @__PURE__ */ new WeakMap();
124697
124717
  async function withActiveScreen(api, cmd) {
124698
124718
  if (!api.display?.foldable || cmd.screen !== void 0) return { cmd };
124699
- if (cmd.cmd !== "touch") return { cmd };
124719
+ if (cmd.cmd !== "touch" && cmd.cmd !== "edgeTouch") return { cmd };
124700
124720
  const udid = api.deviceId ?? "";
124701
124721
  let screen = cmd.type !== "Down" ? gestureScreens.get(api) : void 0;
124702
124722
  let warning;
@@ -157240,17 +157260,33 @@ var eventSchema = external_exports.object({
157240
157260
  });
157241
157261
  var zodSchema22 = external_exports.object({
157242
157262
  udid: external_exports.string().describe("Target device id from `list-devices` (iOS UDID or Android serial)."),
157263
+ edge: external_exports.enum(screenEdges).optional().describe(
157264
+ "Starting edge in upright screen coordinates for a single-finger system gesture on a local iOS simulator."
157265
+ ),
157243
157266
  events: external_exports.array(eventSchema).describe("Touch events, dispatched in order."),
157244
157267
  interpolate: external_exports.number().optional().describe(
157245
157268
  "Number of Move events to insert between each pair of consecutive events, linearly interpolating both x,y and x2,y2 and splitting the delay evenly, for a smooth gesture. Default: no interpolation."
157246
157269
  )
157247
157270
  });
157271
+ function validateEdge(params, device) {
157272
+ if (params.edge === void 0) return;
157273
+ if (device.platform !== "ios" || device.kind !== "simulator") {
157274
+ throw new InvalidToolInputError("System-edge gestures require a local iOS simulator.");
157275
+ }
157276
+ const events = params.events;
157277
+ if (events[0]?.type !== "Down" || events.at(-1)?.type !== "Up" || events.slice(1, -1).some((e) => e.type !== "Move") || events.some((e) => e.x2 !== void 0 || e.y2 !== void 0)) {
157278
+ throw new InvalidToolInputError(
157279
+ "A system-edge gesture takes one finger: Down, any Moves, then Up."
157280
+ );
157281
+ }
157282
+ }
157248
157283
  var gestureCustomTool = {
157249
157284
  id: "gesture-custom",
157250
157285
  description: `Send a sequence of touch events for complex gestures.
157251
157286
  Use for: long press, drag-and-drop, custom scroll, pinch (second touch point).
157252
157287
  For simple taps use the gesture-tap tool. For straight-line scrolling use the gesture-swipe tool.<flag:macos-apps> Not supported on a Mac app: use gesture-tap, gesture-drag and gesture-scroll there.</flag:macos-apps>
157253
157288
  For pinch gestures use gesture-pinch. For rotation gestures use gesture-rotate.
157289
+ On a local iOS simulator, set edge to the starting side for a system gesture. To move a full-screen app into Split View on an open Duo, set edge:"bottom". In one continuous contact move from bottom center to center, pause there, drag to the requested side, and release. See the device-interact foldables reference for coordinates and timing.
157254
157290
  All x/y values are fractions of the screen width/height (not pixels).
157255
157291
  Physical iOS: a Down, any Moves, then an Up; x2/y2 adds a second finger. A plain Down then Up: same point = press-hold, other point = drag (Up delayMs = rest before the move); one Move at the Down point between them = long-press pickup (Move delayMs = hold, Up delayMs = move time). Any other train plays as timed paths, each event waiting its delayMs, and needs the app drawn in portrait.
157256
157292
  Returns { events: number } with the total count of events dispatched. On physical iOS, reactivated: true = app was re-fronted; re-describe. Fails if the target device is not booted or an event type is invalid.
@@ -157283,6 +157319,7 @@ Example pinch-to-zoom (with interpolate:10 for smoothness):
157283
157319
  // Declare the runner only for a train execute can play. A rejected train must not pay a runner cold start.
157284
157320
  services: (params) => {
157285
157321
  const device = resolveDevice(params.udid);
157322
+ validateEdge(params, device);
157286
157323
  if (isIosPhysicalDevice(device)) {
157287
157324
  return planIosDeviceGesture(params.events).kind !== "unsupported" ? { iosDeviceRunner: iosDeviceRunnerRef(device) } : {};
157288
157325
  }
@@ -157290,6 +157327,7 @@ Example pinch-to-zoom (with interpolate:10 for smoothness):
157290
157327
  },
157291
157328
  async execute(services, params) {
157292
157329
  const device = resolveDevice(params.udid);
157330
+ validateEdge(params, device);
157293
157331
  if (isIosPhysicalDevice(device)) {
157294
157332
  return runOnIosDevice(
157295
157333
  services.iosDeviceRunner,
@@ -157301,17 +157339,31 @@ Example pinch-to-zoom (with interpolate:10 for smoothness):
157301
157339
  const api = services.simulatorServer;
157302
157340
  const events = params.interpolate && params.interpolate > 0 ? interpolateEvents(params.events, params.interpolate) : params.events;
157303
157341
  let warning;
157304
- for (const event2 of events) {
157305
- await sleep8(event2.delayMs ?? 16);
157306
- const sent = await sendCommand(api, {
157307
- cmd: "touch",
157308
- type: event2.type,
157309
- x: event2.x,
157310
- y: event2.y,
157311
- second_x: event2.x2 ?? null,
157312
- second_y: event2.y2 ?? null
157313
- });
157314
- warning ??= sent.warning;
157342
+ let edgeContact;
157343
+ try {
157344
+ for (const event2 of events) {
157345
+ await sleep8(event2.delayMs ?? 16);
157346
+ const sent = await sendCommand(api, {
157347
+ ...params.edge ? { cmd: "edgeTouch", edge: params.edge } : { cmd: "touch", second_x: event2.x2 ?? null, second_y: event2.y2 ?? null },
157348
+ type: event2.type,
157349
+ x: event2.x,
157350
+ y: event2.y
157351
+ });
157352
+ if (params.edge) edgeContact = event2.type === "Up" ? void 0 : event2;
157353
+ warning ??= sent.warning;
157354
+ }
157355
+ } catch (error63) {
157356
+ if (edgeContact) {
157357
+ await sendCommand(api, {
157358
+ cmd: "edgeTouch",
157359
+ edge: params.edge,
157360
+ type: "Up",
157361
+ x: edgeContact.x,
157362
+ y: edgeContact.y
157363
+ }).catch(() => {
157364
+ });
157365
+ }
157366
+ throw error63;
157315
157367
  }
157316
157368
  return { events: events.length, ...warning !== void 0 ? { warning } : {} };
157317
157369
  }
@@ -159580,11 +159632,12 @@ var foldTool = {
159580
159632
  Use when you must see or test an app in a different posture. \`list-devices\` marks foldable devices with \`foldable: true\`. To turn a device without a fold, use \`rotate\`.
159581
159633
  All tools use the active panel (the panel that shows the UI), also after a fold made outside argent. The coordinates and the screenshot size change with the panel. Before you tap, read the element tree in this result or run \`describe\` again.
159582
159634
  iOS: unfolded, the UI is landscape, as on a rotated iPhone. A fold between two angles that are not closed or open can keep the current panel. To change panels, fold to closed or open.
159635
+ To move a full-screen app onto either half of the open iPhone Duo, use \`gesture-custom\` with \`edge: "bottom"\`. Drag up, pause at center, then drag sideways and release in one contact.
159583
159636
  iOS returns { activeScreen, screen: { id, panel, width, height }, posture?, hingeAngle, warning? }. screen names the active panel and gives its size in pixels. posture is set only at 0\xB0, 120\xB0 and 180\xB0. warning is set when argent cannot find the active panel, or when the device did not change to the expected panel.
159584
159637
  Android returns { posture?, deviceState, hingeAngle?, warning? }. deviceState is the state Android committed (CLOSED, HALF_OPENED, OPENED), and posture is the matching preset. A lock screen the fold raises is dismissed; warning is set when it cannot be, or when a lock screen is showing or the screen is off after the fold. On a generic foldable AVD, closed shows only the left part of the display and describe frames do not match tap coordinates; use a Pixel Fold AVD to test the cover panel.
159585
159638
  Fails if the device is not foldable, is a remote simulator or a physical Android device.`,
159586
159639
  zodSchema: zodSchema28,
159587
- searchHint: "fold unfold hinge foldable duo posture open closed half-open panel screen",
159640
+ searchHint: "fold unfold hinge foldable duo posture open closed half-open panel screen split view",
159588
159641
  interaction: {
159589
159642
  startedMsg: ({ params }) => `Folding device to ${targetLabel2(params)}`,
159590
159643
  completedMsg: ({ params, result }) => "activeScreen" in result ? `Folded device to ${targetLabel2(params)}; it renders to screen ${result.activeScreen} (${result.screen.panel})` : `Folded device to ${targetLabel2(params)}; it is in device state ${result.deviceState}`,
@@ -159848,7 +159901,7 @@ Allowed tools, their args (? = optional) and targets. Positions and distances ar
159848
159901
  gesture-swipe: fromX, fromY, toX, toY, durationMs?, momentum? [ios/android<flag:harmonyos>/harmony</flag:harmonyos>]
159849
159902
  gesture-scroll: x, y, deltaX?, deltaY? (signed; positive scrolls down), durationMs? [chromium<flag:macos-apps>/macos</flag:macos-apps>]
159850
159903
  gesture-drag: fromX, fromY, toX, toY, durationMs?, momentum? [chromium<flag:macos-apps>/macos</flag:macos-apps>]
159851
- gesture-custom: events: [{ type: "Down"|"Move"|"Up", x, y, x2?, y2?, delayMs? }], interpolate? [ios/android]
159904
+ gesture-custom: events: [{ type: "Down"|"Move"|"Up", x, y, x2?, y2?, delayMs? }], interpolate?, edge? (local iOS simulator system gesture) [ios/android]
159852
159905
  gesture-pinch: centerX, centerY, startDistance, endDistance, endCenterX?, endCenterY?, angle?, durationMs? [ios/android<flag:harmonyos>/harmony</flag:harmonyos>]
159853
159906
  gesture-rotate: centerX, centerY, startAngle, endAngle, radius (or radiusX + radiusY), durationMs? [ios/android]
159854
159907
  button: button: "home"|"back"|"power"|"volumeUp"|"volumeDown"|"appSwitch"|"actionButton" [ios/android<flag:harmonyos>; harmony: home/back/power</flag:harmonyos>]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.27",
3
+ "version": "0.34.1-next.29",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
6
6
  "license": "Apache-2.0",
@@ -6,3 +6,25 @@ Read this for a device `list-devices` marks `foldable: true`: a foldable iOS sim
6
6
  - Fold between gestures, not during one. A gesture stays on the panel where it started.
7
7
  - iOS: if argent cannot find the active panel, it uses the cover panel and sets `warning` (a screenshot-diff summary gets a `panel:` line). Take a screenshot to see what the device shows, then do the check the warning names.
8
8
  - Android: on a closed generic foldable AVD, tap only full-width rows; test the cover panel on a Pixel Fold AVD.
9
+
10
+ ## Move a full-screen app into Split View on iPhone Duo
11
+
12
+ Start with the Duo open in landscape and the app full screen. If needed, use `fold` to open the Duo and `launch-app` to open the app.
13
+
14
+ Call `gesture-custom` once with the Duo UDID and these parameters to move the app to the **left**. The `edge` field tells iOS that the touch starts a system gesture. Keep the finger down through the pause and the sideways drag.
15
+
16
+ ```json
17
+ {
18
+ "edge": "bottom",
19
+ "interpolate": 12,
20
+ "events": [
21
+ { "type": "Down", "x": 0.5, "y": 1 },
22
+ { "type": "Move", "x": 0.5, "y": 0.5, "delayMs": 280 },
23
+ { "type": "Move", "x": 0.5, "y": 0.5, "delayMs": 300 },
24
+ { "type": "Move", "x": 0.14, "y": 0.5, "delayMs": 320 },
25
+ { "type": "Up", "x": 0.14, "y": 0.5, "delayMs": 200 }
26
+ ]
27
+ }
28
+ ```
29
+
30
+ For the **right**, change both final x coordinates to `0.86`. Check the screenshot for the app on the requested side and the Home Screen on the other. Stop here if the user asked for one app at half width.