@qawolf/cli 2.2.1 → 2.2.2

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
@@ -8450,7 +8450,7 @@ var authErrorMessages = {
8450
8450
  notFound404Record: (noun, id) => `QA Wolf has no ${noun} ${id} (HTTP 404).`,
8451
8451
  notFound404: (noun) => noun === undefined ? "QA Wolf found nothing matching the request (HTTP 404)." : `QA Wolf found nothing matching the ${noun} request (HTTP 404).`,
8452
8452
  failedWithStatus: (status, noun) => `QA Wolf API${noun ? ` ${noun}` : ""} request failed (HTTP ${status}).`,
8453
- networkUnreachable: (baseUrl, noun) => `Could not reach the QA Wolf API at ${baseUrl}${noun ? ` to fetch ${noun}` : ""}. Check your network connection and QAWOLF_HOST_URL.`,
8453
+ networkUnreachable: (options) => `Could not reach the QA Wolf API at ${options.baseUrl}${options.noun ? ` to fetch ${options.noun}` : ""}${options.cause ? ` (${options.cause})` : ""}. Check your network connection and QAWOLF_HOST_URL.`,
8454
8454
  timedOut: (timeoutMs, noun) => `The QA Wolf API${noun ? ` ${noun}` : ""} request timed out after ${formatSeconds(timeoutMs)}. The work may still be finishing on the platform.`,
8455
8455
  unexpectedResponse: (noun) => `Unexpected${noun ? ` ${noun}` : ""} response from the QA Wolf API.`
8456
8456
  },
@@ -8994,6 +8994,7 @@ var runMessages = {
8994
8994
  unknownStream: (stream, known) => `"${stream}" is not a stream QA Wolf writes, so this read has nothing to return. QA Wolf writes ${known.join(", ")}.`,
8995
8995
  unsearchedHistory: (stream) => `This read of ${stream} stopped before searching all of the runner's history, so older entries may exist that it did not look at. Page forwards with --since to reach them.`,
8996
8996
  submitMayHaveStarted: "The runner did not answer, which does not mean the run did not start. Read qawolf runner events run-status before running the flow again, and use the newest run id there if one appeared.",
8997
+ submitLostMayHaveStarted: "The run may have started before the connection failed. Read qawolf runner events run-status before running the flow again, and use the newest run id there if one appeared.",
8997
8998
  targetMismatch: (runnerName, requiredRunnerName) => `This flow needs a ${requiredRunnerName} runner and ${runnerName} is running. Launch one with --name ${requiredRunnerName}.`
8998
8999
  };
8999
9000
 
@@ -15447,6 +15448,37 @@ function applyWorkspaceId(inputSchema, input, workspaceId) {
15447
15448
  return { ...input, workspaceId };
15448
15449
  }
15449
15450
 
15451
+ // src/core/fetchCause.ts
15452
+ var maxCauseDepth = 5;
15453
+ var maxCauseMessageLength = 120;
15454
+ var codePattern = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
15455
+ var urlPattern = /\bhttps?:\/\/\S+/g;
15456
+ function causeChain(options) {
15457
+ const { error, remainingDepth } = options;
15458
+ const { cause } = error;
15459
+ if (!(cause instanceof Error) || remainingDepth === 0)
15460
+ return [error];
15461
+ return [
15462
+ error,
15463
+ ...causeChain({ error: cause, remainingDepth: remainingDepth - 1 })
15464
+ ];
15465
+ }
15466
+ function shortMessage(message) {
15467
+ const withoutUrls = message.replace(urlPattern, "<url>").trim();
15468
+ return withoutUrls.length > maxCauseMessageLength ? `${withoutUrls.slice(0, maxCauseMessageLength)}…` : withoutUrls;
15469
+ }
15470
+ function describeFetchCause(error) {
15471
+ const chain = causeChain({ error, remainingDepth: maxCauseDepth });
15472
+ const root = chain.at(-1);
15473
+ const code = chain.map((link) => errorCode(link)).reverse().find((candidate) => candidate !== undefined && codePattern.test(candidate));
15474
+ const message = root === undefined ? "" : shortMessage(root.message);
15475
+ if (code === undefined)
15476
+ return message || undefined;
15477
+ if (!message || message.includes(code))
15478
+ return message || code;
15479
+ return `${code}: ${message}`;
15480
+ }
15481
+
15450
15482
  // src/core/parseJson.ts
15451
15483
  function parseJson(text) {
15452
15484
  try {
@@ -15579,7 +15611,13 @@ function describeRequestError(err, baseUrl, noun, notFound) {
15579
15611
  return { error: m2.request.failedWithStatus(err.status, noun), ...body };
15580
15612
  }
15581
15613
  if (err.kind === "network") {
15582
- return { error: m2.request.networkUnreachable(baseUrl, noun) };
15614
+ return {
15615
+ error: m2.request.networkUnreachable({
15616
+ baseUrl,
15617
+ cause: describeFetchCause(err.cause),
15618
+ noun
15619
+ })
15620
+ };
15583
15621
  }
15584
15622
  if (err.kind === "timeout") {
15585
15623
  return { error: m2.request.timedOut(err.timeoutMs, noun) };
@@ -23634,7 +23672,7 @@ function startUpdateCheck(deps) {
23634
23672
  // package.json
23635
23673
  var package_default = {
23636
23674
  name: "@qawolf/cli",
23637
- version: "2.2.1",
23675
+ version: "2.2.2",
23638
23676
  description: "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
23639
23677
  keywords: [
23640
23678
  "automation",
@@ -38814,6 +38852,9 @@ function buildRunnerAction(type, flags) {
38814
38852
  if (to !== undefined && !to.ok)
38815
38853
  return to;
38816
38854
  const button = flags.button ?? (type === "click" ? "left" : undefined);
38855
+ const scrollsOneWay = type === "scroll" && flags.scrollX === undefined !== (flags.scrollY === undefined);
38856
+ const scrollX = flags.scrollX ?? (scrollsOneWay ? "0" : undefined);
38857
+ const scrollY = flags.scrollY ?? (scrollsOneWay ? "0" : undefined);
38817
38858
  const candidate = {
38818
38859
  type,
38819
38860
  ...button === undefined ? {} : { button },
@@ -38821,8 +38862,8 @@ function buildRunnerAction(type, flags) {
38821
38862
  ...from === undefined ? {} : { from: from.value },
38822
38863
  ...flags.keys === undefined ? {} : { keys: flags.keys },
38823
38864
  ...parsedPath === undefined ? {} : { path: parsedPath.value },
38824
- ...flags.scrollX === undefined ? {} : { scroll_x: toNumber(flags.scrollX) },
38825
- ...flags.scrollY === undefined ? {} : { scroll_y: toNumber(flags.scrollY) },
38865
+ ...scrollX === undefined ? {} : { scroll_x: toNumber(scrollX) },
38866
+ ...scrollY === undefined ? {} : { scroll_y: toNumber(scrollY) },
38826
38867
  ...flags.selector === undefined ? {} : { selector: flags.selector },
38827
38868
  ...flags.strategy === undefined ? {} : { strategy: flags.strategy },
38828
38869
  ...flags.text === undefined ? {} : { text: flags.text },
@@ -40594,6 +40635,7 @@ Examples:
40594
40635
  $ qawolf runner act click --button left --x 480 --y 260
40595
40636
  $ qawolf runner act type --text "hello@example.com"
40596
40637
  $ qawolf runner act keypress --keys Control a
40638
+ $ qawolf runner act scroll --x 640 --y 400 --scroll-y 600
40597
40639
  $ qawolf runner act navigate --url https://example.com
40598
40640
  $ qawolf runner act drag --path '[{"x":10,"y":20},{"x":80,"y":90}]'
40599
40641
  $ qawolf runner act click --button left --x 480 --y 260 --screenshot step-4.jpg
@@ -40616,7 +40658,7 @@ Examples:
40616
40658
  $ qawolf runner screenshot --out - | my-vision-tool`;
40617
40659
  function registerRunnerInteractCommands(runner, signals) {
40618
40660
  declareCommandKind(runner.command("screenshot"), "read").description("Save a JPEG of an interactive runner's screen to a file, or write it to stdout with --out -").option("--out <path>", "File to write the image to. - writes the JPEG bytes to stdout on their own and moves the confirmation, JSON included, to stderr", defaultScreenshotPath).option("--runner <id>", runnerFlagDescription).addHelpText("after", screenshotExamples).addHelpText("after", runnerGuides.screenshot).action((opts, command) => withAuthContext(signals, (ctx) => handleRunnerScreenshot(ctx, { out: opts.out, runner: opts.runner }, runnerDeps(ctx)))(opts, command));
40619
- declareCommandKind(runner.command("act <action>"), "write").description("Perform one raw action on a runner's screen. A browser runner takes click, double_click, scroll, move, drag, keypress, navigate and type; a mobile runner takes tap, swipe, fill and type. A browser runner answers mobile actions with action-not-supported-on-browser; a mobile runner answers the other browser actions with action-not-supported-on-mobile. Use - to read a whole action as JSON from stdin").option("--button <button>", "click: left (default), right, wheel, back or forward").option("--duration-ms <ms>", "swipe: how long it takes, up to 10000. Slow scrolls, fast flings").option("--from <x,y>", "swipe: the point it starts at").option("--keys <keys...>", "keypress: modifiers and the key, e.g. Control a").option("--path <json>", "drag: JSON array of points to drag through").option("--runner <id>", runnerFlagDescription).option("--screenshot <path>", "Also save a JPEG of the screen, taken after the action, to this file, in place of a separate screenshot. An action that did not take effect answers with one too. - writes it to stdout and moves the confirmation, JSON included, to stderr").option("--scroll-x <delta>", "scroll: horizontal wheel delta").option("--scroll-y <delta>", "scroll: vertical wheel delta").option("--selector <selector>", "tap or fill: the element to act on, as a screen object would find it. tap takes it in place of --x and --y").option("--strategy <strategy>", "how --selector is resolved: xpath (default), ios-predicate or shadow").option("--text <text>", "type: the text to type into what has focus. fill: the field's new value").option("--to <x,y>", "swipe: the point it ends at").option("--url <url>", "navigate: the http or https URL to go to").option("--x <pixels>", "click, tap and the like: x, in screenshot pixels").option("--y <pixels>", "click, tap and the like: y, in screenshot pixels").addHelpText("after", actExamples).addHelpText("after", runnerGuides.act).action((action, opts, command) => withAuthContext(signals, (ctx) => handleRunnerAct(ctx, {
40661
+ declareCommandKind(runner.command("act <action>"), "write").description("Perform one raw action on a runner's screen. A browser runner takes click, double_click, scroll, move, drag, keypress, navigate and type; a mobile runner takes tap, swipe, fill and type. A browser runner answers mobile actions with action-not-supported-on-browser; a mobile runner answers the other browser actions with action-not-supported-on-mobile. Use - to read a whole action as JSON from stdin").option("--button <button>", "click: left (default), right, wheel, back or forward").option("--duration-ms <ms>", "swipe: how long it takes, up to 10000. Slow scrolls, fast flings").option("--from <x,y>", "swipe: the point it starts at").option("--keys <keys...>", "keypress: modifiers and the key, e.g. Control a").option("--path <json>", "drag: JSON array of points to drag through").option("--runner <id>", runnerFlagDescription).option("--screenshot <path>", "Also save a JPEG of the screen, taken after the action, to this file, in place of a separate screenshot. An action that did not take effect answers with one too. - writes it to stdout and moves the confirmation, JSON included, to stderr").option("--scroll-x <delta>", "scroll: horizontal wheel delta, 0 when only --scroll-y is given").option("--scroll-y <delta>", "scroll: vertical wheel delta, 0 when only --scroll-x is given").option("--selector <selector>", "tap or fill: the element to act on, as a screen object would find it. tap takes it in place of --x and --y").option("--strategy <strategy>", "how --selector is resolved: xpath (default), ios-predicate or shadow").option("--text <text>", "type: the text to type into what has focus. fill: the field's new value").option("--to <x,y>", "swipe: the point it ends at").option("--url <url>", "navigate: the http or https URL to go to").option("--x <pixels>", "click, tap and the like: x, in screenshot pixels").option("--y <pixels>", "click, tap and the like: y, in screenshot pixels").addHelpText("after", actExamples).addHelpText("after", runnerGuides.act).action((action, opts, command) => withAuthContext(signals, (ctx) => handleRunnerAct(ctx, {
40620
40662
  flags: {
40621
40663
  button: opts.button,
40622
40664
  durationMs: opts.durationMs,
@@ -41405,8 +41447,12 @@ async function sendRunFlowRequest(ctx, options, delta) {
41405
41447
  ...delta.unchangedFiles === undefined ? {} : { unchangedFiles: delta.unchangedFiles }
41406
41448
  }, runnerCallOptions);
41407
41449
  if (!result.ok) {
41450
+ const failure = runnerRequestFailure(result, options.resolved);
41408
41451
  return {
41409
- failure: runnerRequestFailure(result, options.resolved),
41452
+ failure: result.mayHaveArrived ? {
41453
+ ...failure,
41454
+ error: appendSentence(failure.error, interactiveRunnerMessages.submitLostMayHaveStarted)
41455
+ } : failure,
41410
41456
  type: "failed"
41411
41457
  };
41412
41458
  }
@@ -41572,7 +41618,8 @@ function registerRunCommand(runner, signals) {
41572
41618
  // src/core/messages/interactiveRunner/recording.ts
41573
41619
  var recordingMessages = {
41574
41620
  noRunnerIdForHistory: "Name the runner whose recordings to read with --runner <id> or QAWOLF_RUNNER_ID. History stays readable after the runner terminates.",
41575
- unsupported: "Video recording requires a Playwright runner.",
41621
+ unsupported: "This runner has no screen to record. Launch a browser, mobile, Windows, or Mac runner instead.",
41622
+ screenNotReady: "The runner's screen is not ready to record yet. On a browser runner, retry in a second or two. On a mobile, Windows, or Mac runner, a run must claim the device first. Run code on it, or turn on runner record auto before the next full run.",
41576
41623
  inProgress: "A recording is already in progress. Use runner record status to check its mode and id. Stop a manual recording by id, or wait for the run to finish an automatic recording.",
41577
41624
  notFound: "That recording was not found on the runner. Use runner record status for the active recording or runner list-recordings for published history.",
41578
41625
  idUsed: "That recording id has already been used. Start a new recording with a new UUID.",
@@ -41591,7 +41638,7 @@ function recordingFailure(reason) {
41591
41638
  };
41592
41639
  case "screen-not-ready":
41593
41640
  return {
41594
- error: interactiveRunnerMessages.screenNotReady,
41641
+ error: recordingMessages.screenNotReady,
41595
41642
  exitCode: exitCodes.network
41596
41643
  };
41597
41644
  case "recording-in-progress":
@@ -41743,7 +41790,7 @@ async function handleRunnerRecordings(ctx, options, deps) {
41743
41790
 
41744
41791
  // src/commands/runner/recording.register.ts
41745
41792
  function registerRunnerRecordingCommands(runner, signals) {
41746
- const record = runner.command("record").description("Control video recording on a Playwright runner").addHelpText("after", runnerGuides.record);
41793
+ const record = runner.command("record").description("Control video recording on a browser, mobile, Windows, or Mac runner").addHelpText("after", runnerGuides.record);
41747
41794
  declareCommandKind(record.command("start"), "write").description("Start manual video capture across runs. Requires a ready screen and suppresses automatic capture until stopped").option("--recording-id <uuid>", "Recording UUID. Generated when omitted; reuse it when retrying this start").option("--runner <id>", runnerFlagDescription).action((opts, command) => withAuthContext(signals, (ctx) => handleRunnerRecord(ctx, {
41748
41795
  command: { action: "start", recordingId: opts.recordingId },
41749
41796
  runner: opts.runner
@@ -41816,4 +41863,4 @@ createProgram({ signals }).parseAsync().catch(() => {
41816
41863
  process.exitCode = 1;
41817
41864
  }).finally(() => exitWhenIdle(typeof process.exitCode === "number" ? process.exitCode : 0));
41818
41865
 
41819
- //# debugId=F8E2C24048CC67D764756E2164756E21
41866
+ //# debugId=B8D4928E940289A464756E2164756E21
@@ -9507,7 +9507,21 @@ function inspectExecutionLogs(request) {
9507
9507
  }
9508
9508
  function summarizeExecutionLogs(input) {
9509
9509
  const parsed = parseExecutionLogs(input);
9510
- const selected = parsed.items.filter((record) => record.source === "qawolfTraceCollection" || record.severity === "error").slice(-20);
9510
+ const errors = parsed.items.filter((record) => record.severity === "error").slice(-5);
9511
+ const traceCollection = parsed.items.findLast((record) => record.source === "qawolfTraceCollection");
9512
+ const selectedIds = new Set([
9513
+ ...errors.map((record) => record.evidenceId),
9514
+ ...traceCollection ? [traceCollection.evidenceId] : []
9515
+ ]);
9516
+ const selected = parsed.items.filter((record) => selectedIds.has(record.evidenceId));
9517
+ const summaries = selected.map((record) => {
9518
+ const message = redactAndBoundAttemptEvidenceResult(record.message, 1024);
9519
+ return {
9520
+ ...record,
9521
+ message: message.text,
9522
+ ...message.truncated && { evidenceTruncated: true }
9523
+ };
9524
+ });
9511
9525
  return {
9512
9526
  artifactState: parsed.status,
9513
9527
  evidence: {
@@ -9515,9 +9529,9 @@ function summarizeExecutionLogs(input) {
9515
9529
  ...parsed.coverage,
9516
9530
  returned: selected.length,
9517
9531
  total: parsed.items.length,
9518
- truncated: parsed.coverage.truncated || selected.length < parsed.items.length
9532
+ truncated: parsed.coverage.truncated || selected.length < parsed.items.length || summaries.some((record) => record.evidenceTruncated)
9519
9533
  },
9520
- items: selected
9534
+ items: summaries
9521
9535
  }
9522
9536
  };
9523
9537
  }
@@ -11170,6 +11184,7 @@ function summarizeAttemptWaitingLogs(logs, actionId) {
11170
11184
 
11171
11185
  // src/domains/investigation/parser/projection/summarizeAttemptTrace.ts
11172
11186
  var evidenceLimit3 = 10;
11187
+ var consoleLimit = 5;
11173
11188
  var maxActionEvidenceBytes2 = 512;
11174
11189
  var maxSnapshotReconstructionBytes2 = 256 * 1024;
11175
11190
  function normalizedFailure(value) {
@@ -11185,7 +11200,7 @@ async function summarizeAttemptTrace(trace, attemptError) {
11185
11200
  const traceError = failure?.errorMessage ? normalizedFailure(failure.errorMessage) : undefined;
11186
11201
  const metadataError = attemptError ? normalizedFailure(attemptError) : undefined;
11187
11202
  const errorMatches = Boolean(traceError && metadataError && (metadataError.includes(traceError) || traceError.includes(metadataError)));
11188
- const toAction = (action) => {
11203
+ const toAction = (action, includeDetails) => {
11189
11204
  const stack = action.errorMessage === undefined ? [] : readTraceActionStack(trace, action).map((frame) => `${frame.file}:${frame.compiledLine}`);
11190
11205
  const error = action.errorMessage === undefined ? undefined : redactAndBoundAttemptEvidenceResult(action.errorMessage, maxActionEvidenceBytes2);
11191
11206
  const selector = action.selector === undefined ? undefined : redactAndBoundAttemptEvidenceResult(action.selector, maxActionEvidenceBytes2);
@@ -11203,9 +11218,11 @@ async function summarizeAttemptTrace(trace, attemptError) {
11203
11218
  ...action.startTime !== undefined && {
11204
11219
  startedAtMilliseconds: action.startTime
11205
11220
  },
11206
- stack: stack.slice(0, 20),
11207
- stackTruncated: stack.length > 20,
11208
- ...summarizeAttemptWaitingLogs(logs, action.id)
11221
+ ...includeDetails && {
11222
+ stack: stack.slice(0, 20),
11223
+ stackTruncated: stack.length > 20,
11224
+ ...summarizeAttemptWaitingLogs(logs, action.id)
11225
+ }
11209
11226
  };
11210
11227
  };
11211
11228
  const completed = chronologicallySortActions(actions.items.filter((action) => action.endTime !== undefined));
@@ -11215,10 +11232,10 @@ async function summarizeAttemptTrace(trace, attemptError) {
11215
11232
  limit: Number.MAX_SAFE_INTEGER,
11216
11233
  maxTextBytes: Number.MAX_SAFE_INTEGER
11217
11234
  });
11218
- const consoleItems = allConsoleEntries.items.slice(-evidenceLimit3);
11235
+ const consoleItems = allConsoleEntries.items.slice(-consoleLimit);
11219
11236
  const consoleSummaries = consoleItems.map((entry) => ({
11220
11237
  entry,
11221
- message: redactAndBoundAttemptEvidenceResult(entry.message, 1024)
11238
+ message: redactAndBoundAttemptEvidenceResult(entry.message, 256)
11222
11239
  }));
11223
11240
  const network = await listTraceNetwork(trace, {
11224
11241
  limit: Number.MAX_SAFE_INTEGER
@@ -11239,7 +11256,7 @@ async function summarizeAttemptTrace(trace, attemptError) {
11239
11256
  maxBytes: maxSnapshotReconstructionBytes2
11240
11257
  }) : undefined;
11241
11258
  const screenshot = pageSnapshot ? nearestScreenshotForSnapshot(trace, pageSnapshot.id) : undefined;
11242
- const projectedPage = page?.truncated ? { text: "", truncated: true } : page ? boundAttemptPageText(redactAttemptEvidence(projectToText(resolveSnapshot([page.html], 0), Number.MAX_SAFE_INTEGER))) : undefined;
11259
+ const projectedPage = page?.truncated ? { text: "", truncated: true } : page ? redactAndBoundAttemptEvidenceResult(projectToText(resolveSnapshot([page.html], 0), Number.MAX_SAFE_INTEGER), 2 * 1024) : undefined;
11243
11260
  return {
11244
11261
  actions: {
11245
11262
  coverage: {
@@ -11247,7 +11264,7 @@ async function summarizeAttemptTrace(trace, attemptError) {
11247
11264
  returned: selectedActions.length,
11248
11265
  truncated: actions.coverage.total > selectedActions.length
11249
11266
  },
11250
- items: selectedActions.map(toAction)
11267
+ items: selectedActions.map((action) => toAction(action, false))
11251
11268
  },
11252
11269
  browserConsole: {
11253
11270
  coverage: {
@@ -11258,14 +11275,17 @@ async function summarizeAttemptTrace(trace, attemptError) {
11258
11275
  items: consoleSummaries.map(({ entry, message }) => ({
11259
11276
  evidenceId: entry.id,
11260
11277
  message: message.text,
11278
+ ...message.truncated && { evidenceTruncated: true },
11261
11279
  type: entry.type
11262
11280
  }))
11263
11281
  },
11264
11282
  ...errorMatches && failure && {
11265
- failedBrowserAction: toAction(failure.action)
11283
+ failedBrowserAction: toAction(failure.action, true)
11266
11284
  },
11267
11285
  failedBrowserActionAttribution: errorMatches ? "trace-error-matches-attempt" : "none",
11268
- ...!errorMatches && lastCompleted && { lastCompletedBrowserAction: toAction(lastCompleted) },
11286
+ ...!errorMatches && lastCompleted && {
11287
+ lastCompletedBrowserAction: toAction(lastCompleted, true)
11288
+ },
11269
11289
  networkErrors,
11270
11290
  ...page && projectedPage && pageSnapshot && {
11271
11291
  pageState: {
@@ -11420,4 +11440,4 @@ export {
11420
11440
  investigate
11421
11441
  };
11422
11442
 
11423
- //# debugId=30384783C6AA2E7664756E2164756E21
11443
+ //# debugId=DDB8DC8EF65337B664756E2164756E21
@@ -11459,7 +11459,7 @@ var authErrorMessages = {
11459
11459
  notFound404Record: (noun, id) => `QA Wolf has no ${noun} ${id} (HTTP 404).`,
11460
11460
  notFound404: (noun) => noun === undefined ? "QA Wolf found nothing matching the request (HTTP 404)." : `QA Wolf found nothing matching the ${noun} request (HTTP 404).`,
11461
11461
  failedWithStatus: (status, noun) => `QA Wolf API${noun ? ` ${noun}` : ""} request failed (HTTP ${status}).`,
11462
- networkUnreachable: (baseUrl, noun) => `Could not reach the QA Wolf API at ${baseUrl}${noun ? ` to fetch ${noun}` : ""}. Check your network connection and QAWOLF_HOST_URL.`,
11462
+ networkUnreachable: (options) => `Could not reach the QA Wolf API at ${options.baseUrl}${options.noun ? ` to fetch ${options.noun}` : ""}${options.cause ? ` (${options.cause})` : ""}. Check your network connection and QAWOLF_HOST_URL.`,
11463
11463
  timedOut: (timeoutMs, noun) => `The QA Wolf API${noun ? ` ${noun}` : ""} request timed out after ${formatSeconds(timeoutMs)}. The work may still be finishing on the platform.`,
11464
11464
  unexpectedResponse: (noun) => `Unexpected${noun ? ` ${noun}` : ""} response from the QA Wolf API.`
11465
11465
  },
@@ -11901,6 +11901,7 @@ var runMessages = {
11901
11901
  unknownStream: (stream, known) => `"${stream}" is not a stream QA Wolf writes, so this read has nothing to return. QA Wolf writes ${known.join(", ")}.`,
11902
11902
  unsearchedHistory: (stream) => `This read of ${stream} stopped before searching all of the runner's history, so older entries may exist that it did not look at. Page forwards with --since to reach them.`,
11903
11903
  submitMayHaveStarted: "The runner did not answer, which does not mean the run did not start. Read qawolf runner events run-status before running the flow again, and use the newest run id there if one appeared.",
11904
+ submitLostMayHaveStarted: "The run may have started before the connection failed. Read qawolf runner events run-status before running the flow again, and use the newest run id there if one appeared.",
11904
11905
  targetMismatch: (runnerName, requiredRunnerName) => `This flow needs a ${requiredRunnerName} runner and ${runnerName} is running. Launch one with --name ${requiredRunnerName}.`
11905
11906
  };
11906
11907
 
@@ -13652,6 +13653,37 @@ function applyWorkspaceId(inputSchema, input, workspaceId) {
13652
13653
  return { ...input, workspaceId };
13653
13654
  }
13654
13655
 
13656
+ // src/core/fetchCause.ts
13657
+ var maxCauseDepth = 5;
13658
+ var maxCauseMessageLength = 120;
13659
+ var codePattern = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
13660
+ var urlPattern = /\bhttps?:\/\/\S+/g;
13661
+ function causeChain(options) {
13662
+ const { error, remainingDepth } = options;
13663
+ const { cause } = error;
13664
+ if (!(cause instanceof Error) || remainingDepth === 0)
13665
+ return [error];
13666
+ return [
13667
+ error,
13668
+ ...causeChain({ error: cause, remainingDepth: remainingDepth - 1 })
13669
+ ];
13670
+ }
13671
+ function shortMessage(message) {
13672
+ const withoutUrls = message.replace(urlPattern, "<url>").trim();
13673
+ return withoutUrls.length > maxCauseMessageLength ? `${withoutUrls.slice(0, maxCauseMessageLength)}…` : withoutUrls;
13674
+ }
13675
+ function describeFetchCause(error) {
13676
+ const chain = causeChain({ error, remainingDepth: maxCauseDepth });
13677
+ const root = chain.at(-1);
13678
+ const code = chain.map((link) => errorCode(link)).reverse().find((candidate) => candidate !== undefined && codePattern.test(candidate));
13679
+ const message = root === undefined ? "" : shortMessage(root.message);
13680
+ if (code === undefined)
13681
+ return message || undefined;
13682
+ if (!message || message.includes(code))
13683
+ return message || code;
13684
+ return `${code}: ${message}`;
13685
+ }
13686
+
13655
13687
  // src/shell/platform/describeNotFound.ts
13656
13688
  var m = authMessages.errors.request;
13657
13689
  var saysNothingMore = (reason) => /^(\w+ )*not ?found\.?$/i.test(reason.trim());
@@ -13775,7 +13807,13 @@ function describeRequestError(err, baseUrl, noun, notFound) {
13775
13807
  return { error: m2.request.failedWithStatus(err.status, noun), ...body };
13776
13808
  }
13777
13809
  if (err.kind === "network") {
13778
- return { error: m2.request.networkUnreachable(baseUrl, noun) };
13810
+ return {
13811
+ error: m2.request.networkUnreachable({
13812
+ baseUrl,
13813
+ cause: describeFetchCause(err.cause),
13814
+ noun
13815
+ })
13816
+ };
13779
13817
  }
13780
13818
  if (err.kind === "timeout") {
13781
13819
  return { error: m2.request.timedOut(err.timeoutMs, noun) };
@@ -15830,6 +15868,12 @@ function buildRunFileDelta(options) {
15830
15868
  return Object.keys(unchangedFiles).length === 0 ? { files: options.files, unchangedFiles: undefined } : { files, unchangedFiles };
15831
15869
  }
15832
15870
 
15871
+ // src/core/sentences.ts
15872
+ function appendSentence(text, sentence) {
15873
+ const punctuated = /[.!?]$/.test(text.trimEnd()) ? text.trimEnd() : `${text.trimEnd()}.`;
15874
+ return `${punctuated} ${sentence}`;
15875
+ }
15876
+
15833
15877
  // src/domains/interactiveRunner/runSubmitFailure.ts
15834
15878
  function describeRunSubmitFailure(failure) {
15835
15879
  const { failureReason } = failure;
@@ -15870,8 +15914,12 @@ async function sendRunFlowRequest(ctx, options, delta) {
15870
15914
  ...delta.unchangedFiles === undefined ? {} : { unchangedFiles: delta.unchangedFiles }
15871
15915
  }, runnerCallOptions);
15872
15916
  if (!result.ok) {
15917
+ const failure = runnerRequestFailure(result, options.resolved);
15873
15918
  return {
15874
- failure: runnerRequestFailure(result, options.resolved),
15919
+ failure: result.mayHaveArrived ? {
15920
+ ...failure,
15921
+ error: appendSentence(failure.error, interactiveRunnerMessages.submitLostMayHaveStarted)
15922
+ } : failure,
15875
15923
  type: "failed"
15876
15924
  };
15877
15925
  }
@@ -16075,4 +16123,4 @@ export {
16075
16123
  createRunnerSdk
16076
16124
  };
16077
16125
 
16078
- //# debugId=7D41A06F682D4C5564756E2164756E21
16126
+ //# debugId=549062A3D36EB66B64756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qawolf/cli",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
5
5
  "keywords": [
6
6
  "automation",
@@ -110,7 +110,8 @@ Commands:
110
110
  to clear the highlight
111
111
  promote-snapshot [options] Accept a run's screenshot as the new baseline for an
112
112
  image diff, on the runner that produced it
113
- record Control video recording on a Playwright runner
113
+ record Control video recording on a browser, mobile, Windows, or
114
+ Mac runner
114
115
  list-recordings [options] Read a page of published video recordings, including
115
116
  after the runner terminates. Platform URLs persist; video
116
117
  URLs expire
@@ -591,8 +592,8 @@ Options:
591
592
  place of a separate screenshot. An action that did not take effect answers
592
593
  with one too. - writes it to stdout and moves the confirmation, JSON
593
594
  included, to stderr
594
- --scroll-x <delta> scroll: horizontal wheel delta
595
- --scroll-y <delta> scroll: vertical wheel delta
595
+ --scroll-x <delta> scroll: horizontal wheel delta, 0 when only --scroll-y is given
596
+ --scroll-y <delta> scroll: vertical wheel delta, 0 when only --scroll-x is given
596
597
  --selector <selector> tap or fill: the element to act on, as a screen object would find it. tap
597
598
  takes it in place of --x and --y
598
599
  --strategy <strategy> how --selector is resolved: xpath (default), ios-predicate or shadow
@@ -607,6 +608,7 @@ Examples:
607
608
  $ qawolf runner act click --button left --x 480 --y 260
608
609
  $ qawolf runner act type --text "hello@example.com"
609
610
  $ qawolf runner act keypress --keys Control a
611
+ $ qawolf runner act scroll --x 640 --y 400 --scroll-y 600
610
612
  $ qawolf runner act navigate --url https://example.com
611
613
  $ qawolf runner act drag --path '[{"x":10,"y":20},{"x":80,"y":90}]'
612
614
  $ qawolf runner act click --button left --x 480 --y 260 --screenshot step-4.jpg
@@ -1088,7 +1090,7 @@ Paths:
1088
1090
  ```text
1089
1091
  Usage: qawolf runner record [options] [command]
1090
1092
 
1091
- Control video recording on a Playwright runner
1093
+ Control video recording on a browser, mobile, Windows, or Mac runner
1092
1094
 
1093
1095
  Options:
1094
1096
  -h, --help display help for command