@qawolf/cli 2.8.0 → 2.8.1

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.js CHANGED
@@ -8404,6 +8404,7 @@ var agentMessages = {
8404
8404
  answerPrompt: "Your answer",
8405
8405
  conflictingSessionList: "Pass --sessions alone, without --session or a session argument.",
8406
8406
  emptySessionList: "Pass at least one session id with --sessions.",
8407
+ tooManySessions: (limit) => `Pass at most ${limit} session ids with --sessions.`,
8407
8408
  sessionListNeedsFollow: "Pass --follow when using --sessions.",
8408
8409
  answerSendFailed: (reason) => `The answer could not be sent: ${reason.replace(/\.$/, "")}. The session is still waiting, so try again.`,
8409
8410
  blocked: (sessionId) => `QA Wolf asked a question and cannot continue until it is answered. Answer it with qawolf agent send "<your answer>" --session ${sessionId}.`,
@@ -15327,6 +15328,24 @@ function flagKind(schema) {
15327
15328
  reason: `type ${schema.type ?? "unknown"} cannot be expressed as a flag`
15328
15329
  };
15329
15330
  }
15331
+ var isObjectSchema = (schema) => {
15332
+ const members = schema.allOf ?? schema.oneOf ?? schema.anyOf;
15333
+ if (members)
15334
+ return members.every(isObjectSchema);
15335
+ return schema.type === "object";
15336
+ };
15337
+ var isObjectList = (schema) => schema.type === "array" && !!schema.items && isObjectSchema(schema.items);
15338
+ var withoutNull = (schema) => {
15339
+ const members = schema.anyOf?.filter((member) => member.type !== "null");
15340
+ if (!members?.length || members.length === schema.anyOf?.length) {
15341
+ return schema;
15342
+ }
15343
+ return members.length === 1 && members[0] ? members[0] : { anyOf: members };
15344
+ };
15345
+ var holdsObjects = (schema) => {
15346
+ const value = withoutNull(schema);
15347
+ return isObjectSchema(value) || isObjectList(value);
15348
+ };
15330
15349
 
15331
15350
  // src/core/publicApi/objectShape.ts
15332
15351
  var asObjectShape = (schema) => schema.type === "object" && schema.properties ? { properties: schema.properties, required: new Set(schema.required) } : undefined;
@@ -15685,20 +15704,24 @@ async function requestWithRetry(args) {
15685
15704
  if (result.ok)
15686
15705
  return { ok: true, value: result.data };
15687
15706
  const backoff = args.backoffMs[attempt];
15688
- const retryable = result.error.kind === "network" || result.error.kind === "timeout";
15689
- if (backoff === undefined || !retryable) {
15707
+ const retryable = (args.retryable ?? isTransient)(result.error);
15708
+ if (backoff === undefined || !retryable || args.canRetry?.() === false) {
15690
15709
  const mayHaveArrived = result.error.kind !== "http";
15691
15710
  const unreachable = result.error.kind === "network" || result.error.kind === "timeout";
15692
15711
  return {
15693
15712
  ok: false,
15694
15713
  ...mayHaveArrived ? { mayHaveArrived } : {},
15695
15714
  ...unreachable ? { unreachable } : {},
15715
+ ...result.error.kind === "timeout" ? { timedOut: true } : {},
15696
15716
  ...args.describe(result.error)
15697
15717
  };
15698
15718
  }
15699
15719
  await sleep2(backoff);
15700
15720
  }
15701
15721
  }
15722
+ function isTransient(err) {
15723
+ return err.kind === "network" || err.kind === "timeout";
15724
+ }
15702
15725
 
15703
15726
  // src/shell/platform/callPublicApi.ts
15704
15727
  function callPublicApi(trpc, contract, input, options) {
@@ -15715,17 +15738,24 @@ var notSentCodes = new Set([
15715
15738
  "ENOTFOUND",
15716
15739
  "UND_ERR_CONNECT_TIMEOUT"
15717
15740
  ]);
15718
- function makeCallPublicApiMethod(trpc, deps, readBackoffMs) {
15741
+ function wasNeverSent(err) {
15742
+ if (err.kind !== "network")
15743
+ return false;
15744
+ const code = errorCode(err.cause.cause) ?? errorCode(err.cause);
15745
+ return code !== undefined && notSentCodes.has(code);
15746
+ }
15747
+ function makeCallPublicApiMethod(trpc, deps, backoffMs) {
15719
15748
  return async (contract, input, options) => {
15720
15749
  const sent = applyWorkspaceId(contract.input, input, deps.workspaceId);
15721
15750
  const subject = notFoundSubject(contract.name, sent);
15722
15751
  return requestWithRetry({
15723
15752
  call: () => callPublicApi(trpc, contract, sent, options),
15724
- backoffMs: contract.kind === "read" ? readBackoffMs : [],
15753
+ backoffMs,
15754
+ canRetry: () => options?.signal?.aborted !== true && options?.canRetry?.() !== false,
15755
+ ...contract.kind === "write" ? { retryable: wasNeverSent } : {},
15725
15756
  describe: (err) => {
15726
15757
  const failure = describeRequestError(err, deps.baseUrl, contract.name, subject);
15727
- const code = err.kind === "network" ? errorCode(err.cause.cause) ?? errorCode(err.cause) : undefined;
15728
- if (contract.kind !== "write" || !code || !notSentCodes.has(code))
15758
+ if (contract.kind !== "write" || !wasNeverSent(err))
15729
15759
  return failure;
15730
15760
  return {
15731
15761
  ...failure,
@@ -16540,7 +16570,7 @@ async function sendWireRequest(fetchFn, url, init, schema, timeoutMs) {
16540
16570
  try {
16541
16571
  response = await fetchFn(url, {
16542
16572
  ...init,
16543
- signal: AbortSignal.timeout(timeoutMs)
16573
+ signal: init.signal ? AbortSignal.any([AbortSignal.timeout(timeoutMs), init.signal]) : AbortSignal.timeout(timeoutMs)
16544
16574
  });
16545
16575
  } catch (error) {
16546
16576
  if (isTimeoutError(error)) {
@@ -16607,7 +16637,11 @@ function createTrpcClient(apiKey, deps) {
16607
16637
  query: (path, input, schema, options) => {
16608
16638
  const encoded = encodeURIComponent(JSON.stringify(dist_default.serialize(input)));
16609
16639
  const url = `${deps.baseUrl}/api/trpc/${path}?input=${encoded}`;
16610
- return withLogging(path, () => sendWireRequest(deps.fetch, url, { headers: authHeader, method: "GET" }, schema, options?.timeoutMs ?? defaultTimeoutMs));
16640
+ return withLogging(path, () => sendWireRequest(deps.fetch, url, {
16641
+ headers: authHeader,
16642
+ method: "GET",
16643
+ ...options?.signal ? { signal: options.signal } : {}
16644
+ }, schema, options?.timeoutMs ?? defaultTimeoutMs));
16611
16645
  },
16612
16646
  mutation: (path, input, schema, options) => {
16613
16647
  const url = `${deps.baseUrl}/api/trpc/${path}`;
@@ -16616,7 +16650,8 @@ function createTrpcClient(apiKey, deps) {
16616
16650
  body,
16617
16651
  headers: { ...authHeader, "content-type": "application/json" },
16618
16652
  method: "POST",
16619
- redirect: "error"
16653
+ redirect: "error",
16654
+ ...options?.signal ? { signal: options.signal } : {}
16620
16655
  }, schema, options?.timeoutMs ?? defaultTimeoutMs));
16621
16656
  }
16622
16657
  };
@@ -16970,7 +17005,6 @@ var makeActivityWaitContract = (ids) => {
16970
17005
  output
16971
17006
  };
16972
17007
  };
16973
-
16974
17008
  // node_modules/@qawolf/api-contracts/dist/v1/deployment/didNotRunReason.js
16975
17009
  var didNotRunReasonSchema = _enum([
16976
17010
  "billing-prevented",
@@ -24409,7 +24443,7 @@ function startUpdateCheck(deps) {
24409
24443
  // package.json
24410
24444
  var package_default = {
24411
24445
  name: "@qawolf/cli",
24412
- version: "2.8.0",
24446
+ version: "2.8.1",
24413
24447
  description: "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
24414
24448
  keywords: [
24415
24449
  "automation",
@@ -24484,14 +24518,11 @@ var package_default = {
24484
24518
  "@qawolf/api-contracts": "0.116.0",
24485
24519
  "@qawolf/emails": "1.1.1",
24486
24520
  "@qawolf/flow-targets": "2.0.0",
24487
- "@qawolf/flows": "0.3.0",
24488
- "@qawolf/testkit": "1.2.1",
24489
24521
  commander: "14.0.3",
24490
24522
  "env-paths": "4.0.0",
24491
24523
  jszip: "3.10.1",
24492
24524
  picomatch: "4.0.4",
24493
24525
  pino: "10.3.1",
24494
- playwright: "1.62.0",
24495
24526
  superjson: "2.2.6",
24496
24527
  tar: "7.5.21",
24497
24528
  tinyglobby: "0.2.17",
@@ -24500,6 +24531,8 @@ var package_default = {
24500
24531
  },
24501
24532
  devDependencies: {
24502
24533
  "@changesets/cli": "2.31.0",
24534
+ "@qawolf/flows": "0.3.0",
24535
+ "@qawolf/testkit": "1.2.1",
24503
24536
  "@tsconfig/bun": "1.0.10",
24504
24537
  "@tsconfig/strictest": "2.0.8",
24505
24538
  "@types/bun": "1.4.1",
@@ -24513,6 +24546,7 @@ var package_default = {
24513
24546
  oxfmt: "0.54.0",
24514
24547
  oxlint: "1.69.0",
24515
24548
  "oxlint-tsgolint": "0.23.0",
24549
+ playwright: "1.62.0",
24516
24550
  webdriverio: "9.27.1"
24517
24551
  },
24518
24552
  engines: {
@@ -24739,14 +24773,91 @@ async function handleQuestion(ctx, options) {
24739
24773
  return outcome;
24740
24774
  }
24741
24775
 
24776
+ // src/domains/agent/withinDeadline.ts
24777
+ var answerMarginMs = 15000;
24778
+ var readTimeoutMs = 15000;
24779
+ var retryBackoffMs = [500, 1500];
24780
+ var maxConsecutiveTimeouts = 3;
24781
+ function planAttempt(remainingMs, holds, signal) {
24782
+ const waitSeconds = holds ? Math.min(maxAgentWaitSeconds, Math.max(1, Math.ceil(remainingMs / 1000))) : 0;
24783
+ const timeoutMs = Math.min(holds ? waitSeconds * 1000 + answerMarginMs : readTimeoutMs, remainingMs);
24784
+ return {
24785
+ requestOptions: {
24786
+ canRetry: () => false,
24787
+ timeoutMs,
24788
+ ...signal ? { signal } : {}
24789
+ },
24790
+ waitSeconds
24791
+ };
24792
+ }
24793
+ async function callWithinDeadline(deadline, holds, send) {
24794
+ for (let retry = 0;; retry++) {
24795
+ const remainingMs = deadline.remainingMs();
24796
+ if (remainingMs <= 0)
24797
+ return { type: "deadline" };
24798
+ const result = await send(planAttempt(remainingMs, holds, deadline.signal));
24799
+ if (result.ok)
24800
+ return { type: "answered", value: result.value };
24801
+ if (deadline.remainingMs() <= 0)
24802
+ return { type: "deadline" };
24803
+ const backoffMs = retryBackoffMs[retry];
24804
+ const retryable = result.unreachable === true && !(holds && result.timedOut === true);
24805
+ if (backoffMs === undefined || !retryable || deadline.signal?.aborted)
24806
+ return { failure: result, type: "failed" };
24807
+ await deadline.sleep(Math.min(backoffMs, deadline.remainingMs()));
24808
+ if (deadline.signal?.aborted)
24809
+ return { failure: result, type: "failed" };
24810
+ }
24811
+ }
24812
+ function readWithinDeadline(deadline, send) {
24813
+ return callWithinDeadline(deadline, false, send);
24814
+ }
24815
+ async function holdWithinDeadline(deadline, send) {
24816
+ for (let timeouts = 1;; timeouts++) {
24817
+ const held = await callWithinDeadline(deadline, true, send);
24818
+ if (held.type !== "failed" || held.failure.timedOut !== true || timeouts >= maxConsecutiveTimeouts)
24819
+ return held;
24820
+ }
24821
+ }
24822
+ function endedBy(ended, timedOut) {
24823
+ if (ended.type === "deadline")
24824
+ return timedOut;
24825
+ return { exitCode: exitCodes.network, ...failureFields(ended.failure) };
24826
+ }
24827
+
24828
+ // src/domains/agent/hold.ts
24829
+ function readSession(ctx, deadline, sessionId) {
24830
+ return readWithinDeadline(deadline, (plan) => ctx.platformClient.callPublicApi(publicContractsV1.agent.get, { sessionId, waitSeconds: 0 }, plan.requestOptions));
24831
+ }
24832
+ async function waitForActivity(ctx, deadline, options) {
24833
+ for (;; ) {
24834
+ const held = await holdWithinDeadline(deadline, (plan) => ctx.platformClient.callPublicApi(publicContractsV1.agent.get, {
24835
+ cursor: options.cursor,
24836
+ sessionId: options.sessionId,
24837
+ waitSeconds: plan.waitSeconds
24838
+ }, plan.requestOptions));
24839
+ if (held.type !== "answered")
24840
+ return held;
24841
+ if (held.value.wokeOn !== "timeout")
24842
+ return { type: "activity" };
24843
+ }
24844
+ }
24845
+
24742
24846
  // src/domains/agent/followSession.ts
24743
- var pollIntervalMs = 5000;
24744
24847
  async function followSession(ctx, options, deps) {
24745
24848
  const { sessionId, workspaceId } = options;
24746
24849
  const canPrompt = ctx.ui.mode === "human" && ctx.isInteractive;
24747
24850
  const startedAt = deps.now();
24748
24851
  let promptedMs = 0;
24749
- const timedOut = () => deps.now() - startedAt - promptedMs >= options.timeoutSeconds * 1000;
24852
+ const deadline = {
24853
+ remainingMs: () => options.timeoutSeconds * 1000 - (deps.now() - startedAt - promptedMs),
24854
+ signal: undefined,
24855
+ sleep: deps.sleep
24856
+ };
24857
+ const timedOut = () => ({
24858
+ error: agentMessages.followTimedOut(sessionId, options.timeoutSeconds),
24859
+ exitCode: exitCodes.timeout
24860
+ });
24750
24861
  let pending = options.initial;
24751
24862
  let printed = 0;
24752
24863
  let { repliesAtAnswer } = options;
@@ -24767,10 +24878,9 @@ async function followSession(ctx, options, deps) {
24767
24878
  session = pending;
24768
24879
  pending = undefined;
24769
24880
  } else {
24770
- const read = await ctx.platformClient.callPublicApi(publicContractsV1.agent.get, { sessionId });
24771
- if (!read.ok) {
24772
- return { exitCode: exitCodes.network, ...failureFields(read) };
24773
- }
24881
+ const read = await readSession(ctx, deadline, sessionId);
24882
+ if (read.type !== "answered")
24883
+ return endedBy(read, timedOut());
24774
24884
  session = read.value;
24775
24885
  }
24776
24886
  const { replies, status } = session;
@@ -24813,13 +24923,12 @@ async function followSession(ctx, options, deps) {
24813
24923
  ctx.ui.info(agentMessages.detachHint);
24814
24924
  }
24815
24925
  waiting ??= ctx.ui.wait(agentMessages.waiting);
24816
- await deps.sleep(pollIntervalMs);
24817
- if (timedOut()) {
24818
- return {
24819
- error: agentMessages.followTimedOut(sessionId, options.timeoutSeconds),
24820
- exitCode: exitCodes.timeout
24821
- };
24822
- }
24926
+ const wake = await waitForActivity(ctx, deadline, {
24927
+ cursor: session.nextCursor,
24928
+ sessionId
24929
+ });
24930
+ if (wake.type !== "activity")
24931
+ return endedBy(wake, timedOut());
24823
24932
  }
24824
24933
  } finally {
24825
24934
  stopWaiting();
@@ -24828,9 +24937,16 @@ async function followSession(ctx, options, deps) {
24828
24937
  }
24829
24938
 
24830
24939
  // src/domains/agent/followSessions.ts
24940
+ var maxSessionsPerWait = 20;
24941
+ function splitIntoWaits(sessionIds) {
24942
+ return [
24943
+ ...Array(Math.ceil(sessionIds.length / maxSessionsPerWait)).keys()
24944
+ ].map((index) => sessionIds.slice(index * maxSessionsPerWait, (index + 1) * maxSessionsPerWait));
24945
+ }
24831
24946
  async function followSessions(options) {
24832
24947
  const { ctx, deps, sessionIds, timeoutSeconds } = options;
24833
- const deadline = deps.now() + timeoutSeconds * 1000;
24948
+ const deadlineAt = deps.now() + timeoutSeconds * 1000;
24949
+ const remainingMs = () => deadlineAt - deps.now();
24834
24950
  const timedOut = () => ({
24835
24951
  error: agentMessages.followSessionsTimedOut({
24836
24952
  seconds: timeoutSeconds,
@@ -24840,18 +24956,41 @@ async function followSessions(options) {
24840
24956
  });
24841
24957
  const waiting = ctx.ui.wait(agentMessages.waiting);
24842
24958
  const detach = ctx.signals.register(() => waiting.stop());
24959
+ const abort = new AbortController;
24960
+ const deadline = {
24961
+ remainingMs,
24962
+ signal: abort.signal,
24963
+ sleep: deps.sleep
24964
+ };
24965
+ const waits = splitIntoWaits(sessionIds);
24966
+ const cursorsByWait = new Map;
24967
+ const holdWait = (index, waitSessionIds) => holdWithinDeadline(deadline, (plan) => ctx.platformClient.callPublicApi(publicContractsV1.activity.wait, {
24968
+ cursors: cursorsByWait.get(index) ?? {},
24969
+ sessionIds: waitSessionIds,
24970
+ waitSeconds: plan.waitSeconds
24971
+ }, plan.requestOptions)).then((held) => ({ held, index }));
24972
+ const holds = new Map;
24843
24973
  try {
24844
24974
  for (;; ) {
24845
- for (const sessionId of sessionIds) {
24846
- const remainingMs = deadline - deps.now();
24847
- if (remainingMs <= 0)
24848
- return timedOut();
24849
- const read = await ctx.platformClient.callPublicApi(publicContractsV1.agent.get, { sessionId, waitSeconds: 0 }, { timeoutMs: Math.min(15000, remainingMs) });
24850
- if (!read.ok) {
24851
- if (deps.now() >= deadline)
24852
- return timedOut();
24853
- return { exitCode: exitCodes.network, ...failureFields(read) };
24854
- }
24975
+ if (remainingMs() <= 0)
24976
+ return timedOut();
24977
+ waits.forEach((waitSessionIds, index) => {
24978
+ if (!holds.has(index))
24979
+ holds.set(index, holdWait(index, waitSessionIds));
24980
+ });
24981
+ const { held, index } = await Promise.race(holds.values());
24982
+ holds.delete(index);
24983
+ if (held.type !== "answered")
24984
+ return endedBy(held, timedOut());
24985
+ cursorsByWait.set(index, Object.fromEntries(held.value.sessions.map((watched) => [
24986
+ watched.sessionId,
24987
+ watched.nextCursor
24988
+ ])));
24989
+ const stirred = held.value.sessions.filter((watched) => watched.status !== "working");
24990
+ for (const { sessionId } of stirred) {
24991
+ const read = await readSession(ctx, deadline, sessionId);
24992
+ if (read.type !== "answered")
24993
+ return endedBy(read, timedOut());
24855
24994
  const session = read.value;
24856
24995
  const question = pendingQuestion(session.status, session.replies);
24857
24996
  if (!isSettled(session.status) && question === undefined)
@@ -24880,12 +25019,9 @@ async function followSessions(options) {
24880
25019
  return result.result;
24881
25020
  }
24882
25021
  }
24883
- const remainingMs = deadline - deps.now();
24884
- if (remainingMs <= 0)
24885
- return timedOut();
24886
- await deps.sleep(Math.min(5000, remainingMs));
24887
25022
  }
24888
25023
  } finally {
25024
+ abort.abort();
24889
25025
  waiting.stop();
24890
25026
  detach();
24891
25027
  }
@@ -24953,10 +25089,16 @@ async function handleAgentGet(ctx, options, deps) {
24953
25089
  error: agentMessages.emptySessionList,
24954
25090
  exitCode: exitCodes.invalidArgs
24955
25091
  };
25092
+ const sessionIds = [...new Set(options.sessions)];
25093
+ if (sessionIds.length > maxActivityWaitItems)
25094
+ return {
25095
+ error: agentMessages.tooManySessions(maxActivityWaitItems),
25096
+ exitCode: exitCodes.invalidArgs
25097
+ };
24956
25098
  return followSessions({
24957
25099
  ctx,
24958
25100
  deps,
24959
- sessionIds: [...new Set(options.sessions)],
25101
+ sessionIds,
24960
25102
  timeoutSeconds: timeout.seconds
24961
25103
  });
24962
25104
  }
@@ -24971,7 +25113,7 @@ async function handleAgentGet(ctx, options, deps) {
24971
25113
  if (sessionId === undefined) {
24972
25114
  return { error: agentMessages.noSession, exitCode: exitCodes.invalidArgs };
24973
25115
  }
24974
- const read = await ctx.platformClient.callPublicApi(publicContractsV1.agent.get, { sessionId });
25116
+ const read = await ctx.platformClient.callPublicApi(publicContractsV1.agent.get, { sessionId, waitSeconds: 0 });
24975
25117
  if (!read.ok)
24976
25118
  return { exitCode: exitCodes.network, ...failureFields(read) };
24977
25119
  if (!options.follow) {
@@ -25140,7 +25282,7 @@ async function handleAgentSend(ctx, options, deps) {
25140
25282
  }
25141
25283
  let repliesAtAnswer;
25142
25284
  if (options.follow && options.session !== undefined) {
25143
- const before = await ctx.platformClient.callPublicApi(publicContractsV1.agent.get, { sessionId: options.session });
25285
+ const before = await ctx.platformClient.callPublicApi(publicContractsV1.agent.get, { sessionId: options.session, waitSeconds: 0 });
25144
25286
  if (before.ok)
25145
25287
  repliesAtAnswer = before.value.replies.length;
25146
25288
  }
@@ -34454,7 +34596,7 @@ async function carriedTags(envDir, fs) {
34454
34596
  // src/domains/flows/pull/handler.ts
34455
34597
  async function handleFlowsPull(ctx, opts, deps) {
34456
34598
  const resolvedDeps = deps ?? {
34457
- flowsVersion: package_default.dependencies["@qawolf/flows"],
34599
+ flowsVersion,
34458
34600
  fs: ctx.fs
34459
34601
  };
34460
34602
  const validation = validateEnvId(opts.env);
@@ -36232,7 +36374,7 @@ var defaultAdb = async (args) => {
36232
36374
 
36233
36375
  // src/shell/appium/createAndroidEmulator.ts
36234
36376
  var defaultBootTimeoutMs = 120000;
36235
- var pollIntervalMs2 = 2000;
36377
+ var pollIntervalMs = 2000;
36236
36378
  var defaultSpawnEmulator = (bin, args) => {
36237
36379
  const child = spawn3(bin, args, { stdio: "ignore" });
36238
36380
  child.unref();
@@ -36250,7 +36392,7 @@ async function bootSequence(adb, serial, cancelled) {
36250
36392
  ]).catch(() => ({ stdout: "" }));
36251
36393
  if (stdout.trim() === "1")
36252
36394
  return;
36253
- await new Promise((r) => setTimeout(r, pollIntervalMs2));
36395
+ await new Promise((r) => setTimeout(r, pollIntervalMs));
36254
36396
  }
36255
36397
  }
36256
36398
  function waitForBoot(adb, serial, timeoutMs) {
@@ -39193,6 +39335,19 @@ function registerAttemptCommand(program, signals) {
39193
39335
  });
39194
39336
  }
39195
39337
 
39338
+ // src/core/publicApi/flagDescription.ts
39339
+ var jsonSources = "Takes JSON inline, @<path> to read it from a file, or - to read it from stdin.";
39340
+ var joinSentences = (sentences) => sentences.filter((sentence) => sentence !== "").join(" ");
39341
+ function describeFlag(schema, kind) {
39342
+ const description = schema.description ?? "";
39343
+ if (kind === "json")
39344
+ return joinSentences([description, jsonSources]);
39345
+ const values = schema.enum ?? schema.items?.enum;
39346
+ if (!values?.length)
39347
+ return description;
39348
+ return joinSentences([description, `One of: ${values.join(", ")}`]);
39349
+ }
39350
+
39196
39351
  // src/core/publicApi/flagNames.ts
39197
39352
  var kebabCase = (segment) => segment.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);
39198
39353
  var capitalize = (segment) => `${segment.slice(0, 1).toUpperCase()}${segment.slice(1)}`;
@@ -39208,18 +39363,12 @@ function flagUsage(path, kind) {
39208
39363
  return `${name} <values...>`;
39209
39364
  if (kind === "key-value-record")
39210
39365
  return `${name} <KEY=VALUE...>`;
39366
+ if (kind === "json")
39367
+ return `${name} <json>`;
39211
39368
  return `${name} <value>`;
39212
39369
  }
39213
39370
 
39214
39371
  // src/core/publicApi/flagSpecs.ts
39215
- function describeFlag(schema) {
39216
- const description = schema.description ?? "";
39217
- const values = schema.enum ?? schema.items?.enum;
39218
- if (!values?.length)
39219
- return description;
39220
- const choices = `One of: ${values.join(", ")}`;
39221
- return description ? `${description} ${choices}` : choices;
39222
- }
39223
39372
  function walkableShape(schema) {
39224
39373
  const isCombinator = Boolean(schema.allOf ?? schema.oneOf ?? schema.anyOf);
39225
39374
  if (!schema.properties && !isCombinator)
@@ -39227,31 +39376,38 @@ function walkableShape(schema) {
39227
39376
  const result = toObjectShape(schema);
39228
39377
  return result.ok ? result.shape : undefined;
39229
39378
  }
39379
+ function fieldFlags(fieldSchema, fieldPath, required) {
39380
+ const nested = walkableShape(fieldSchema);
39381
+ if (nested)
39382
+ return collectFlags(nested, fieldPath, required);
39383
+ const kind = flagKind(fieldSchema);
39384
+ if (!kind.ok)
39385
+ return { ok: false, field: fieldPath.join("."), reason: kind.reason };
39386
+ return {
39387
+ ok: true,
39388
+ flags: [leafFlag(fieldSchema, fieldPath, required, kind.kind)]
39389
+ };
39390
+ }
39391
+ function leafFlag(fieldSchema, fieldPath, required, kind) {
39392
+ return {
39393
+ path: fieldPath,
39394
+ optionKey: optionKeyOf(fieldPath),
39395
+ flag: flagUsage(fieldPath, kind),
39396
+ description: describeFlag(fieldSchema, kind),
39397
+ required,
39398
+ kind
39399
+ };
39400
+ }
39230
39401
  function collectFlags(shape, path, parentRequired) {
39231
39402
  const flags = [];
39232
39403
  for (const [field, fieldSchema] of Object.entries(shape.properties)) {
39233
39404
  const fieldPath = [...path, field];
39234
39405
  const required = parentRequired && shape.required.has(field);
39235
- const nested = walkableShape(fieldSchema);
39236
- if (nested) {
39237
- const result = collectFlags(nested, fieldPath, required);
39238
- if (!result.ok)
39239
- return result;
39240
- flags.push(...result.flags);
39241
- continue;
39242
- }
39243
- const kind = flagKind(fieldSchema);
39244
- if (!kind.ok) {
39245
- return { ok: false, field: fieldPath.join("."), reason: kind.reason };
39246
- }
39247
- flags.push({
39248
- path: fieldPath,
39249
- optionKey: optionKeyOf(fieldPath),
39250
- flag: flagUsage(fieldPath, kind.kind),
39251
- description: describeFlag(fieldSchema),
39252
- required,
39253
- kind: kind.kind
39254
- });
39406
+ const result = fieldFlags(fieldSchema, fieldPath, required);
39407
+ const json = path.length === 0 && holdsObjects(fieldSchema);
39408
+ if (!result.ok && !json)
39409
+ return result;
39410
+ flags.push(...result.ok ? result.flags : [leafFlag(fieldSchema, fieldPath, required, "json")]);
39255
39411
  }
39256
39412
  return { ok: true, flags };
39257
39413
  }
@@ -39319,7 +39475,17 @@ function buildCommandSpecs(tree, options = {}) {
39319
39475
  return walk(tree, []);
39320
39476
  }
39321
39477
 
39322
- // src/domains/publicApi/handle.ts
39478
+ // src/shell/stdin.ts
39479
+ async function readStdin2() {
39480
+ if (process.stdin.isTTY === true)
39481
+ return "";
39482
+ const chunks = [];
39483
+ for await (const chunk of process.stdin)
39484
+ chunks.push(chunk);
39485
+ return Buffer.concat(chunks).toString("utf8");
39486
+ }
39487
+
39488
+ // src/domains/publicApi/flagValues.ts
39323
39489
  var flagName = (flag) => flag.flag.split(" ", 1)[0] ?? flag.flag;
39324
39490
  var isStringArray = (value) => Array.isArray(value) && value.every((item) => typeof item === "string");
39325
39491
  function parseKeyValueRecord(flag, pairs) {
@@ -39336,6 +39502,75 @@ function parseKeyValueRecord(flag, pairs) {
39336
39502
  }
39337
39503
  return { ok: true, record };
39338
39504
  }
39505
+ function parseJson2(flag, value) {
39506
+ if (typeof value !== "string") {
39507
+ return {
39508
+ ok: false,
39509
+ error: `Invalid ${flagName(flag)} value: expected a JSON value.`
39510
+ };
39511
+ }
39512
+ try {
39513
+ return { ok: true, value: JSON.parse(value) };
39514
+ } catch {
39515
+ return {
39516
+ ok: false,
39517
+ error: `Invalid ${flagName(flag)} value: expected a JSON value.`
39518
+ };
39519
+ }
39520
+ }
39521
+
39522
+ // src/domains/publicApi/jsonFlagSources.ts
39523
+ var stdinSource = "-";
39524
+ var fileSourcePrefix = "@";
39525
+ async function readFileSource(flag, path, deps) {
39526
+ try {
39527
+ return { ok: true, text: await deps.readFile(path) };
39528
+ } catch (error) {
39529
+ const reason = isNoEntError(error) ? "does not exist" : `could not be read (${errorMessage(error)})`;
39530
+ return {
39531
+ ok: false,
39532
+ error: `Invalid ${flagName(flag)} value: file "${path}" ${reason}.`
39533
+ };
39534
+ }
39535
+ }
39536
+ async function readSource(flag, value, deps) {
39537
+ if (value.startsWith(fileSourcePrefix)) {
39538
+ return readFileSource(flag, value.slice(fileSourcePrefix.length), deps);
39539
+ }
39540
+ if (value !== stdinSource)
39541
+ return { ok: true, text: value };
39542
+ const text = await deps.readStdin();
39543
+ if (text.trim() === "") {
39544
+ return {
39545
+ ok: false,
39546
+ error: `Invalid ${flagName(flag)} value: nothing was piped to stdin.`
39547
+ };
39548
+ }
39549
+ return { ok: true, text };
39550
+ }
39551
+ async function readJsonFlagSources(flags, options, deps) {
39552
+ const jsonFlags = flags.filter((flag) => flag.kind === "json");
39553
+ const stdinFlags = jsonFlags.filter((flag) => options[flag.optionKey] === stdinSource);
39554
+ if (stdinFlags.length > 1) {
39555
+ return {
39556
+ ok: false,
39557
+ error: `Only one flag can read stdin, but ${stdinFlags.map(flagName).join(" and ")} are each set to -.`
39558
+ };
39559
+ }
39560
+ const resolved = { ...options };
39561
+ for (const flag of jsonFlags) {
39562
+ const value = options[flag.optionKey];
39563
+ if (typeof value !== "string")
39564
+ continue;
39565
+ const read = await readSource(flag, value, deps);
39566
+ if (!read.ok)
39567
+ return read;
39568
+ resolved[flag.optionKey] = read.text;
39569
+ }
39570
+ return { ok: true, options: resolved };
39571
+ }
39572
+
39573
+ // src/domains/publicApi/handle.ts
39339
39574
  var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
39340
39575
  function setAtPath(input, path, value) {
39341
39576
  const leaf = path[path.length - 1];
@@ -39366,6 +39601,11 @@ function assembleInput(flags, options) {
39366
39601
  if (!parsed.ok)
39367
39602
  return parsed;
39368
39603
  setAtPath(input, flag.path, parsed.record);
39604
+ } else if (flag.kind === "json") {
39605
+ const parsed = parseJson2(flag, value);
39606
+ if (!parsed.ok)
39607
+ return parsed;
39608
+ setAtPath(input, flag.path, parsed.value);
39369
39609
  } else if (flag.kind === "number") {
39370
39610
  setAtPath(input, flag.path, Number(value));
39371
39611
  } else {
@@ -39381,8 +39621,14 @@ function renderHuman(value) {
39381
39621
  }
39382
39622
  return JSON.stringify(value);
39383
39623
  }
39384
- async function handlePublicApiCommand(ctx, spec, options) {
39385
- const assembled = assembleInput(spec.flags, options);
39624
+ async function handlePublicApiCommand(ctx, spec, options, stdin = { readStdin: readStdin2 }) {
39625
+ const sourced = await readJsonFlagSources(spec.flags, options, {
39626
+ readFile: (path) => ctx.fs.readFile(path),
39627
+ readStdin: stdin.readStdin
39628
+ });
39629
+ if (!sourced.ok)
39630
+ return { error: sourced.error };
39631
+ const assembled = assembleInput(spec.flags, sourced.options);
39386
39632
  if (!assembled.ok)
39387
39633
  return { error: assembled.error };
39388
39634
  const parsed = spec.contract.input.safeParse(assembled.input);
@@ -40302,16 +40548,6 @@ function makeRunnerStore(options) {
40302
40548
  };
40303
40549
  }
40304
40550
 
40305
- // src/shell/stdin.ts
40306
- async function readStdin2() {
40307
- if (process.stdin.isTTY === true)
40308
- return "";
40309
- const chunks = [];
40310
- for await (const chunk of process.stdin)
40311
- chunks.push(chunk);
40312
- return Buffer.concat(chunks).toString("utf8");
40313
- }
40314
-
40315
40551
  // src/domains/interactiveRunner/deps.ts
40316
40552
  function makeInteractiveRunnerDeps(options) {
40317
40553
  return {
@@ -41964,6 +42200,27 @@ function parseEventsOptions(options) {
41964
42200
  };
41965
42201
  }
41966
42202
 
42203
+ // src/domains/interactiveRunner/followPace.ts
42204
+ var firstDelayMs = 1000;
42205
+ var longestDelayMs = 5000;
42206
+ function createFollowPace(options) {
42207
+ let idleReads = 0;
42208
+ let waitedMs = 0;
42209
+ return {
42210
+ wait: async (sawEntries) => {
42211
+ idleReads = sawEntries ? 0 : idleReads + 1;
42212
+ const remainingMs = options.timeoutMs - waitedMs;
42213
+ if (remainingMs <= 0)
42214
+ return "timed-out";
42215
+ const delayMs = Math.min(longestDelayMs, firstDelayMs * (idleReads + 1), remainingMs);
42216
+ await options.sleep(delayMs);
42217
+ waitedMs += delayMs;
42218
+ return "waited";
42219
+ },
42220
+ waitedMs: () => waitedMs
42221
+ };
42222
+ }
42223
+
41967
42224
  // src/domains/interactiveRunner/journalCursor.ts
41968
42225
  function createJournalCursor(ctx, runner, request) {
41969
42226
  let sinceSequence = request.sinceSequence;
@@ -42005,19 +42262,20 @@ function createPrintingCursor(ctx, runner, request, format) {
42005
42262
  };
42006
42263
  }
42007
42264
  var unreachableGraceMs = 60000;
42008
- function createUnreachableBudget(pollIntervalMs) {
42009
- const limit = Math.ceil(unreachableGraceMs / pollIntervalMs);
42010
- let consecutive = 0;
42265
+ function createUnreachableBudget() {
42266
+ let outageStartedAtMs;
42011
42267
  return {
42012
- exhausted: () => ++consecutive >= limit,
42268
+ exhausted: (waitedMs) => {
42269
+ outageStartedAtMs ??= waitedMs;
42270
+ return waitedMs - outageStartedAtMs >= unreachableGraceMs;
42271
+ },
42013
42272
  reset: () => {
42014
- consecutive = 0;
42273
+ outageStartedAtMs = undefined;
42015
42274
  }
42016
42275
  };
42017
42276
  }
42018
42277
 
42019
42278
  // src/domains/interactiveRunner/events.ts
42020
- var pollIntervalMs3 = 1000;
42021
42279
  async function handleRunnerEvents(ctx, options, deps) {
42022
42280
  const parsed = parseEventsOptions(options);
42023
42281
  if (!parsed.ok)
@@ -42035,14 +42293,17 @@ async function handleRunnerEvents(ctx, options, deps) {
42035
42293
  ctx.ui.warn(interactiveRunnerMessages.unknownStream(parsed.value.stream, known));
42036
42294
  }
42037
42295
  const read = createJournalCursor(ctx, resolved, parsed.value);
42038
- const unreachable = createUnreachableBudget(pollIntervalMs3);
42039
- const maxPolls = Math.max(1, Math.ceil(timeout.seconds * 1000 / pollIntervalMs3));
42040
- for (let poll = 1;; poll++) {
42296
+ const unreachable = createUnreachableBudget();
42297
+ const pace = createFollowPace({
42298
+ sleep: deps.sleep,
42299
+ timeoutMs: timeout.seconds * 1000
42300
+ });
42301
+ for (;; ) {
42041
42302
  const window = await read();
42042
42303
  if (window.type === "failed")
42043
42304
  return journalReadFailure(window);
42044
42305
  if (window.type === "unreachable") {
42045
- if (!options.follow || unreachable.exhausted()) {
42306
+ if (!options.follow || unreachable.exhausted(pace.waitedMs())) {
42046
42307
  return { ...unreachableFailure };
42047
42308
  }
42048
42309
  } else {
@@ -42056,13 +42317,13 @@ async function handleRunnerEvents(ctx, options, deps) {
42056
42317
  if (!options.follow)
42057
42318
  return;
42058
42319
  }
42059
- if (poll >= maxPolls) {
42320
+ const sawEntries = window.type === "entries" && window.entries.length > 0;
42321
+ if (await pace.wait(sawEntries) === "timed-out") {
42060
42322
  return {
42061
42323
  error: interactiveRunnerMessages.followEventsTimedOut(parsed.value.stream, timeout.seconds),
42062
42324
  exitCode: exitCodes.timeout
42063
42325
  };
42064
42326
  }
42065
- await deps.sleep(pollIntervalMs3);
42066
42327
  }
42067
42328
  }
42068
42329
 
@@ -42093,8 +42354,8 @@ async function resolveRecorderAnchor(ctx, resolved, deps) {
42093
42354
  return anchorRecorderCursor(ctx, resolved, deps);
42094
42355
  }
42095
42356
  async function anchorRecorderCursor(ctx, runner, deps) {
42096
- const unreachable = createUnreachableBudget(anchorPollIntervalMs);
42097
- for (;; ) {
42357
+ const unreachable = createUnreachableBudget();
42358
+ for (let waitedMs = 0;; waitedMs += anchorPollIntervalMs) {
42098
42359
  const anchor = await readJournal(ctx, runner, {
42099
42360
  stream: "recorder",
42100
42361
  tail: 1
@@ -42105,7 +42366,7 @@ async function anchorRecorderCursor(ctx, runner, deps) {
42105
42366
  if (anchor.type === "failed") {
42106
42367
  return { failure: journalReadFailure(anchor), ok: false };
42107
42368
  }
42108
- if (unreachable.exhausted()) {
42369
+ if (unreachable.exhausted(waitedMs)) {
42109
42370
  return { failure: { ...unreachableFailure }, ok: false };
42110
42371
  }
42111
42372
  await deps.sleep(anchorPollIntervalMs);
@@ -42125,9 +42386,18 @@ function createFollowPrinters(ctx, options) {
42125
42386
  }
42126
42387
  return printers;
42127
42388
  }
42389
+ async function printEach(printers) {
42390
+ let sawEntries = false;
42391
+ for (const print of printers) {
42392
+ const window = await print();
42393
+ if (window.type !== "entries")
42394
+ return { interrupted: window, sawEntries };
42395
+ sawEntries ||= window.entries.length > 0;
42396
+ }
42397
+ return { interrupted: undefined, sawEntries };
42398
+ }
42128
42399
 
42129
42400
  // src/domains/interactiveRunner/followRun.ts
42130
- var pollIntervalMs4 = 1000;
42131
42401
  function reportSettlement2(ctx, settlement) {
42132
42402
  if (settlement.type === "passed") {
42133
42403
  ctx.ui.success(interactiveRunnerMessages.runPassed);
@@ -42144,15 +42414,11 @@ async function followRun(ctx, options, deps) {
42144
42414
  runId: options.runId,
42145
42415
  stream: "run-status"
42146
42416
  });
42147
- const unreachable = createUnreachableBudget(pollIntervalMs4);
42148
- const printAll = async () => {
42149
- for (const print of printers) {
42150
- const window = await print();
42151
- if (window.type !== "entries")
42152
- return window;
42153
- }
42154
- return;
42155
- };
42417
+ const unreachable = createUnreachableBudget();
42418
+ const pace = createFollowPace({
42419
+ sleep: deps.sleep,
42420
+ timeoutMs: options.timeoutSeconds * 1000
42421
+ });
42156
42422
  let progressReported = false;
42157
42423
  const printProgress = (entries) => {
42158
42424
  if (printers.length > 0 || progressReported)
@@ -42163,35 +42429,36 @@ async function followRun(ctx, options, deps) {
42163
42429
  progressReported = true;
42164
42430
  ctx.ui.stream(entry, interactiveRunnerMessages.runInProgress);
42165
42431
  };
42166
- const maxPolls = Math.max(1, Math.ceil(options.timeoutSeconds * 1000 / pollIntervalMs4));
42167
- for (let poll = 1;; poll++) {
42168
- const interrupted = await printAll();
42432
+ for (;; ) {
42433
+ const printed = await printEach(printers);
42434
+ const { interrupted } = printed;
42169
42435
  if (interrupted?.type === "failed")
42170
42436
  return journalReadFailure(interrupted);
42171
42437
  const status = interrupted?.type === "unreachable" ? interrupted : await readStatus();
42172
42438
  if (status.type === "failed")
42173
42439
  return journalReadFailure(status);
42174
42440
  if (status.type === "unreachable") {
42175
- if (unreachable.exhausted())
42441
+ if (unreachable.exhausted(pace.waitedMs())) {
42176
42442
  return { ...unreachableFailure };
42443
+ }
42177
42444
  } else {
42178
42445
  unreachable.reset();
42179
42446
  printProgress(status.entries);
42180
42447
  const settlement = findSettlement(status.entries);
42181
42448
  if (settlement !== undefined) {
42182
- if (await printAll() !== undefined) {
42449
+ if ((await printEach(printers)).interrupted !== undefined) {
42183
42450
  ctx.ui.warn(interactiveRunnerMessages.followEndCutShort);
42184
42451
  }
42185
42452
  return reportSettlement2(ctx, settlement);
42186
42453
  }
42187
42454
  }
42188
- if (poll >= maxPolls) {
42455
+ const sawEntries = printed.sawEntries || status.type === "entries" && status.entries.length > 0;
42456
+ if (await pace.wait(sawEntries) === "timed-out") {
42189
42457
  return {
42190
42458
  error: interactiveRunnerMessages.followTimedOut(options.runId, options.runner.runnerId, options.timeoutSeconds),
42191
42459
  exitCode: exitCodes.timeout
42192
42460
  };
42193
42461
  }
42194
- await deps.sleep(pollIntervalMs4);
42195
42462
  }
42196
42463
  }
42197
42464
 
@@ -42858,4 +43125,4 @@ createProgram({ signals }).parseAsync().catch(() => {
42858
43125
  process.exitCode = 1;
42859
43126
  }).finally(() => exitWhenIdle(typeof process.exitCode === "number" ? process.exitCode : 0));
42860
43127
 
42861
- //# debugId=EBF23B37C763425B64756E2164756E21
43128
+ //# debugId=CAB39E5AAA5540DA64756E2164756E21
@@ -12703,20 +12703,24 @@ async function requestWithRetry(args) {
12703
12703
  if (result.ok)
12704
12704
  return { ok: true, value: result.data };
12705
12705
  const backoff = args.backoffMs[attempt];
12706
- const retryable = result.error.kind === "network" || result.error.kind === "timeout";
12707
- if (backoff === undefined || !retryable) {
12706
+ const retryable = (args.retryable ?? isTransient)(result.error);
12707
+ if (backoff === undefined || !retryable || args.canRetry?.() === false) {
12708
12708
  const mayHaveArrived = result.error.kind !== "http";
12709
12709
  const unreachable = result.error.kind === "network" || result.error.kind === "timeout";
12710
12710
  return {
12711
12711
  ok: false,
12712
12712
  ...mayHaveArrived ? { mayHaveArrived } : {},
12713
12713
  ...unreachable ? { unreachable } : {},
12714
+ ...result.error.kind === "timeout" ? { timedOut: true } : {},
12714
12715
  ...args.describe(result.error)
12715
12716
  };
12716
12717
  }
12717
12718
  await sleep2(backoff);
12718
12719
  }
12719
12720
  }
12721
+ function isTransient(err) {
12722
+ return err.kind === "network" || err.kind === "timeout";
12723
+ }
12720
12724
 
12721
12725
  // src/domains/interactiveRunner/runnerCallOptions.ts
12722
12726
  var runnerCallOptions = { timeoutMs: 90000 };
@@ -14570,17 +14574,24 @@ var notSentCodes = new Set([
14570
14574
  "ENOTFOUND",
14571
14575
  "UND_ERR_CONNECT_TIMEOUT"
14572
14576
  ]);
14573
- function makeCallPublicApiMethod(trpc, deps, readBackoffMs) {
14577
+ function wasNeverSent(err) {
14578
+ if (err.kind !== "network")
14579
+ return false;
14580
+ const code = errorCode(err.cause.cause) ?? errorCode(err.cause);
14581
+ return code !== undefined && notSentCodes.has(code);
14582
+ }
14583
+ function makeCallPublicApiMethod(trpc, deps, backoffMs) {
14574
14584
  return async (contract, input, options) => {
14575
14585
  const sent = applyWorkspaceId(contract.input, input, deps.workspaceId);
14576
14586
  const subject = notFoundSubject(contract.name, sent);
14577
14587
  return requestWithRetry({
14578
14588
  call: () => callPublicApi(trpc, contract, sent, options),
14579
- backoffMs: contract.kind === "read" ? readBackoffMs : [],
14589
+ backoffMs,
14590
+ canRetry: () => options?.signal?.aborted !== true && options?.canRetry?.() !== false,
14591
+ ...contract.kind === "write" ? { retryable: wasNeverSent } : {},
14580
14592
  describe: (err) => {
14581
14593
  const failure = describeRequestError(err, deps.baseUrl, contract.name, subject);
14582
- const code = err.kind === "network" ? errorCode(err.cause.cause) ?? errorCode(err.cause) : undefined;
14583
- if (contract.kind !== "write" || !code || !notSentCodes.has(code))
14594
+ if (contract.kind !== "write" || !wasNeverSent(err))
14584
14595
  return failure;
14585
14596
  return {
14586
14597
  ...failure,
@@ -15395,7 +15406,7 @@ async function sendWireRequest(fetchFn, url, init, schema, timeoutMs) {
15395
15406
  try {
15396
15407
  response = await fetchFn(url, {
15397
15408
  ...init,
15398
- signal: AbortSignal.timeout(timeoutMs)
15409
+ signal: init.signal ? AbortSignal.any([AbortSignal.timeout(timeoutMs), init.signal]) : AbortSignal.timeout(timeoutMs)
15399
15410
  });
15400
15411
  } catch (error) {
15401
15412
  if (isTimeoutError(error)) {
@@ -15462,7 +15473,11 @@ function createTrpcClient(apiKey, deps) {
15462
15473
  query: (path, input, schema, options) => {
15463
15474
  const encoded = encodeURIComponent(JSON.stringify(dist_default.serialize(input)));
15464
15475
  const url = `${deps.baseUrl}/api/trpc/${path}?input=${encoded}`;
15465
- return withLogging(path, () => sendWireRequest(deps.fetch, url, { headers: authHeader, method: "GET" }, schema, options?.timeoutMs ?? defaultTimeoutMs));
15476
+ return withLogging(path, () => sendWireRequest(deps.fetch, url, {
15477
+ headers: authHeader,
15478
+ method: "GET",
15479
+ ...options?.signal ? { signal: options.signal } : {}
15480
+ }, schema, options?.timeoutMs ?? defaultTimeoutMs));
15466
15481
  },
15467
15482
  mutation: (path, input, schema, options) => {
15468
15483
  const url = `${deps.baseUrl}/api/trpc/${path}`;
@@ -15471,7 +15486,8 @@ function createTrpcClient(apiKey, deps) {
15471
15486
  body,
15472
15487
  headers: { ...authHeader, "content-type": "application/json" },
15473
15488
  method: "POST",
15474
- redirect: "error"
15489
+ redirect: "error",
15490
+ ...options?.signal ? { signal: options.signal } : {}
15475
15491
  }, schema, options?.timeoutMs ?? defaultTimeoutMs));
15476
15492
  }
15477
15493
  };
@@ -16891,4 +16907,4 @@ export {
16891
16907
  createRunnerSdk
16892
16908
  };
16893
16909
 
16894
- //# debugId=4A6642BCD70C79AB64756E2164756E21
16910
+ //# debugId=75B94572A8D87AA864756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qawolf/cli",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
5
5
  "keywords": [
6
6
  "automation",
@@ -75,14 +75,11 @@
75
75
  "@qawolf/api-contracts": "0.116.0",
76
76
  "@qawolf/emails": "1.1.1",
77
77
  "@qawolf/flow-targets": "2.0.0",
78
- "@qawolf/flows": "0.3.0",
79
- "@qawolf/testkit": "1.2.1",
80
78
  "commander": "14.0.3",
81
79
  "env-paths": "4.0.0",
82
80
  "jszip": "3.10.1",
83
81
  "picomatch": "4.0.4",
84
82
  "pino": "10.3.1",
85
- "playwright": "1.62.0",
86
83
  "superjson": "2.2.6",
87
84
  "tar": "7.5.21",
88
85
  "tinyglobby": "0.2.17",
@@ -91,6 +88,8 @@
91
88
  },
92
89
  "devDependencies": {
93
90
  "@changesets/cli": "2.31.0",
91
+ "@qawolf/flows": "0.3.0",
92
+ "@qawolf/testkit": "1.2.1",
94
93
  "@tsconfig/bun": "1.0.10",
95
94
  "@tsconfig/strictest": "2.0.8",
96
95
  "@types/bun": "1.4.1",
@@ -104,6 +103,7 @@
104
103
  "oxfmt": "0.54.0",
105
104
  "oxlint": "1.69.0",
106
105
  "oxlint-tsgolint": "0.23.0",
106
+ "playwright": "1.62.0",
107
107
  "webdriverio": "9.27.1"
108
108
  },
109
109
  "engines": {