@qawolf/cli 2.15.0 → 2.17.0

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/README.md CHANGED
@@ -89,6 +89,8 @@ qawolf attempt inspect --attempt-id <attempt-id> --snapshot <snapshot-id> --form
89
89
  qawolf attempt inspect --attempt-id <attempt-id> --screenshot <screenshot-id> --output-file screenshot.jpeg
90
90
  ```
91
91
 
92
+ An iOS attempt has no trace. For it, `networkErrors` and `--network` / `--request` read the device network log (`networkLogsUrl`): request IDs are the log's cursors, times are epoch milliseconds, and each failed request has a `failureReason` (`http-error`, `connection-failed`, `canceled` or `interrupted`). App cancels come last when more than 10 requests failed. For 2 minutes after the attempt ends, a missing log is `pending` and `networkErrors.coverage.incomplete` is `true`. Add `--failed` to `--network` to return only failed requests. When the log cannot be read, `--network` and `--request` answer `unavailable` with its `networkLogStatus` (`pending`, `not-found`, `too-large`, …).
93
+
92
94
  The trace and logs are downloaded from the signed links `qawolf attempt get` returns and parsed on your machine. Downloads, output text, HTML, request bodies, and log retention are bounded; `incomplete`, `truncated`, `malformed`, and artifact status fields describe evidence that could not be read in full.
93
95
 
94
96
  ## Agent integration
package/dist/cli.js CHANGED
@@ -19963,7 +19963,9 @@ var makeTriggerResourceSchema = (ids) => resource({
19963
19963
  pausedAt: exports_iso.datetime().optional().describe("When it was paused."),
19964
19964
  pausedReason: triggerPausedReasonSchema.optional().catch(undefined),
19965
19965
  updatedAt: exports_iso.datetime()
19966
- }, { urlFieldDescription: "Absolute URL of the team's triggers page." });
19966
+ }, {
19967
+ urlFieldDescription: "Absolute URL of this trigger's page in QA Wolf: its loop page where the team has Loops, otherwise the team's triggers page."
19968
+ });
19967
19969
 
19968
19970
  // node_modules/@qawolf/api-contracts/dist/v1/trigger/create.js
19969
19971
  var makeCreateTriggerContract = (ids) => {
@@ -20244,6 +20246,57 @@ var makeTriggerContracts = (ids) => ({
20244
20246
  runNow: makeRunTriggerNowContract(ids),
20245
20247
  update: makeUpdateTriggerContract(ids)
20246
20248
  });
20249
+ // node_modules/@qawolf/api-contracts/dist/v1/slack/post.js
20250
+ var loopSlackPostsPerSession = 5;
20251
+ var makeSlackPostContract = () => {
20252
+ const input = object({
20253
+ channelId: string2().regex(/^[CG][A-Z0-9]+$/, "channelId must be a Slack channel ID").describe("The ID of one of the workspace's own Slack channels, such as C0123ABCD. The QA Wolf agent must be in the channel."),
20254
+ newId: string2().trim().min(1).max(100).describe("Any string that is new for each message. Repeating a call with the same newId posts the message once."),
20255
+ text: string2().trim().min(1).max(4000).describe("The message, in Slack mrkdwn. QA Wolf removes @channel, @here, @everyone and user group mentions, and does not turn names into mentions."),
20256
+ threadTs: string2().regex(/^\d+\.\d+$/, "threadTs must be a Slack message timestamp").optional().describe("The timestamp of a message in the channel, such as 1792000776.456809, to reply in its thread. Omit it to post a new message in the channel.")
20257
+ });
20258
+ const refusal = (outcome) => object({
20259
+ message: string2().describe("Why QA Wolf did not post the message."),
20260
+ outcome: literal(outcome)
20261
+ });
20262
+ const output = discriminatedUnion("outcome", [
20263
+ object({
20264
+ channelId: string2().describe("The channel the message went to."),
20265
+ messageTs: string2().describe("The Slack timestamp of the message."),
20266
+ outcome: literal("posted"),
20267
+ permalink: string2().describe("The link to the message in Slack."),
20268
+ threadTs: string2().optional().describe("The timestamp of the message whose thread the reply went to. Absent for a new message in the channel.")
20269
+ }),
20270
+ refusal("not-a-loop-session"),
20271
+ refusal("loop-deleted"),
20272
+ refusal("channel-not-allowed"),
20273
+ refusal("agent-not-in-channel"),
20274
+ refusal("rate-limited")
20275
+ ]);
20276
+ return {
20277
+ annotationJustifications: {
20278
+ destructiveHint: "Posts a new message and never edits or deletes one.",
20279
+ openWorldHint: "Posts in the workspace's Slack channel.",
20280
+ readOnlyHint: "Posts a message in Slack."
20281
+ },
20282
+ annotations: {
20283
+ destructiveHint: false,
20284
+ openWorldHint: true,
20285
+ readOnlyHint: false
20286
+ },
20287
+ description: "Post a message, or a reply in a message's thread, in one of the workspace's own Slack channels, as the QA Wolf agent. " + `Only a QA Wolf session that a loop started can call it, at most ${loopSlackPostsPerSession} times per session. ` + "posted: the message is in Slack, at permalink. not-a-loop-session, loop-deleted, channel-not-allowed, agent-not-in-channel and rate-limited: QA Wolf posted nothing, and message says why.",
20288
+ input,
20289
+ kind: "write",
20290
+ name: "slack.post",
20291
+ output
20292
+ };
20293
+ };
20294
+
20295
+ // node_modules/@qawolf/api-contracts/dist/v1/slack/index.js
20296
+ var makeSlackContracts = () => ({
20297
+ post: makeSlackPostContract()
20298
+ });
20299
+
20247
20300
  // node_modules/@qawolf/api-contracts/dist/v1/agent/get.js
20248
20301
  var makeAgentGetContract = (ids) => {
20249
20302
  const input = object({
@@ -21877,11 +21930,23 @@ var makeGetIssueContract = (ids) => {
21877
21930
  };
21878
21931
  };
21879
21932
 
21880
- // node_modules/@qawolf/api-contracts/dist/v1/investigation/finding.js
21881
- var investigationFindingStateDescription = 'What the investigation concluded about the cause. Known values: "investigating", "fixed", "fix-proposed", "reported", "report-proposed", "flake", "question", "dismissed" and "superseded". "superseded" means a newer run replaced this run before the investigation concluded. New values can appear.';
21933
+ // node_modules/@qawolf/api-contracts/dist/v1/investigation/offeredQuestion.js
21882
21934
  var investigationQuestionSchema = object({
21883
21935
  answers: array(object({
21884
21936
  description: string2().optional(),
21937
+ label: string2().optional().describe("The behavior the answer accepts, in a few words, when the investigator named it."),
21938
+ picture: object({
21939
+ attemptId: string2().optional().describe("The run attempt the picture shows, when known."),
21940
+ caption: string2().optional(),
21941
+ crop: object({
21942
+ height: number2(),
21943
+ left: number2(),
21944
+ top: number2(),
21945
+ width: number2()
21946
+ }).optional().describe("The area of the full image the picture was cut to, as fractions of its width and height from its top left corner."),
21947
+ originalUrl: string2().optional().describe("A signed URL of the full image a cropped picture was cut from. It expires; read the finding again for a fresh one."),
21948
+ url: string2().describe("A signed URL of the picture of the behavior the answer accepts. It expires; read the finding again for a fresh one.")
21949
+ }).optional().describe("A picture of the behavior the answer accepts, when the investigator attached one."),
21885
21950
  title: string2(),
21886
21951
  value: string2().describe('What choosing this answer means. Known values: "apply", "dismiss", "report", "maintenance", "bug" and "baseline". New values can appear.')
21887
21952
  })),
@@ -21889,6 +21954,9 @@ var investigationQuestionSchema = object({
21889
21954
  comparisonId: string2().optional().describe('The failed screenshot comparison a screenshot question is about, as `run listScreenshotComparisons` names it. Its answers are "bug" (keep the baseline), "maintenance" (allow both) and "baseline" (use the new screenshot).'),
21890
21955
  text: string2()
21891
21956
  });
21957
+
21958
+ // node_modules/@qawolf/api-contracts/dist/v1/investigation/finding.js
21959
+ var investigationFindingStateDescription = 'What the investigation concluded about the cause. Known values: "investigating", "fixed", "fix-proposed", "reported", "report-proposed", "flake", "question", "dismissed" and "superseded". "superseded" means a newer run replaced this run before the investigation concluded. New values can appear.';
21892
21960
  var makeInvestigationFindingSchema = (ids) => object({
21893
21961
  actual: string2().optional(),
21894
21962
  commitHash: string2().optional().describe("The commit of a commit fix. Same as `fix.commitHash`."),
@@ -22364,7 +22432,7 @@ var makeMarkFixReadyForReviewContract = (ids) => {
22364
22432
  id: string2().describe("The fix's ID."),
22365
22433
  pullRequestUrl: url().describe("The fix's pull request, which is now ready for review.")
22366
22434
  }),
22367
- outcome: _enum(["marked-ready", "already-ready"]).describe("marked-ready: this call marked the draft pull request ready for review. already-ready: the pull request was already ready for review.")
22435
+ outcome: _enum(["marked-ready", "already-ready"]).describe("marked-ready: this call marked a draft pull request ready for review. already-ready: the pull request was already ready for review.")
22368
22436
  });
22369
22437
  return {
22370
22438
  annotationJustifications: {
@@ -22377,7 +22445,7 @@ var makeMarkFixReadyForReviewContract = (ids) => {
22377
22445
  openWorldHint: true,
22378
22446
  readOnlyHint: false
22379
22447
  },
22380
- description: "Mark the draft pull request of the bug's fix ready for review, so the code host asks its code owners. " + "The pull request stays a draft unless a loop's instructions ask for this. " + "Only a QA Wolf session that a loop started can call it. " + "Refused as no-fix-pull-request when the bug's fix has no open pull request.",
22448
+ description: "Mark the pull request of the bug's fix ready for review, so the code host asks its code owners. " + "QA Wolf opens its own pull request ready for review. This changes a draft that the team's agent opened, or one that a person converted to a draft. " + "Only a QA Wolf session that a loop started can call it. " + "Refused as no-fix-pull-request when the bug's fix has no open pull request.",
22381
22449
  input,
22382
22450
  kind: "write",
22383
22451
  name: "issue.markFixReadyForReview",
@@ -22476,7 +22544,7 @@ var makeRetryFixForIssueContract = (ids) => {
22476
22544
  openWorldHint: true,
22477
22545
  readOnlyHint: false
22478
22546
  },
22479
- description: "Ask the team's coding agent for one more try at a bug that the check of its fix still shows. " + "QA Wolf sends the same agent the failure of the check's run, as a new fix on the same branch, and checks again. " + "Only a QA Wolf session that a loop started can call it, when the loop's instructions ask for it. " + "A bug gets one extra try at most. " + "Refused as bug-not-still-showing when the check of the bug's fix does not show the bug, and as no-tries-left after the extra try.",
22547
+ description: "Ask the team's coding agent for one more try at a bug that the check of its fix still shows. " + "QA Wolf sends the same agent the failure of the check's run, as a new fix on a new branch, and checks again. " + "Only a QA Wolf session that a loop started can call it, when the loop's instructions ask for it. " + "A bug gets one extra try at most. " + "Refused as bug-not-still-showing when the check of the bug's fix does not show the bug, and as no-tries-left after the extra try.",
22480
22548
  input,
22481
22549
  kind: "write",
22482
22550
  name: "issue.retryFix",
@@ -23520,7 +23588,8 @@ var makeRunFlowOnRunnerContract = (ids) => {
23520
23588
  files: runFilesSchema.describe("Every file the run needs keyed by its path — the flow file, everything it imports, package.json and tsconfig.json. A runner holds no copy of your project, so what runs is exactly what is sent here."),
23521
23589
  flowId: ids.flow.optional().describe("The QA Wolf flow this run is for. The run then sees it as `QAWOLF_WORKFLOW_ID`, the same value a platform run of that flow sees, so fixtures named and cleaned up by it match across both. Omitted, the flow whose file is at `entryPointPath` on the named environment's flow-code branch stands in; a file not in QA Wolf yet, or a run given no environment, leaves the run with no `QAWOLF_WORKFLOW_ID`."),
23522
23590
  id: runnerIdSchema.describe("Id of the runner to run the flow on."),
23523
- selection: runSelectionSchema.optional().describe("Run only these lines, inside the page the runner is already on, instead of running the whole flow from a fresh browser. Omit to run the whole entry point."),
23591
+ selection: runSelectionSchema.optional().describe("Run only these lines, inside the page the runner is already on, instead of running the whole flow from a fresh browser. A different listed target than the last run's starts a fresh browser first, so the lines lose that page and its sign-in. Omit to run the whole entry point."),
23592
+ target: string2().min(1).max(200).optional().describe('The one target to run, for a flow file that lists several, named as the file lists it, such as "macOS - Any Mac (macOS 26)". Omitted, the run takes the first listed target the runner can run. A target the file does not list is refused, and a target the runner cannot run fails with `runner-target-mismatch`.'),
23524
23593
  unchangedFiles: unchangedFilesSchema.optional().describe("Files this runner already holds from an earlier run, keyed by path with a hex SHA-256 of the content it should hold. Send this to make `files` only what changed. The runner refuses with `needs-full-sync` if it holds none of a referenced path, so it never runs something other than what was asked for. Omit it to send every file."),
23525
23594
  workspaceId: ids.workspace.optional().describe(runnerWorkspaceIdDescription)
23526
23595
  }).refine((request) => Object.hasOwn(request.files, request.entryPointPath), {
@@ -23555,7 +23624,7 @@ var makeRunFlowOnRunnerContract = (ids) => {
23555
23624
  ]);
23556
23625
  const output = discriminatedUnion("outcome", [
23557
23626
  object({
23558
- bootstrappedRunner: boolean2().optional().describe("True when the runner had no live browser and one was started before the run, so a `selection` ran against a fresh page rather than the one an earlier run left. Absent means the runner was already warm. Only a request carrying `selection` can bootstrap, because a whole run starts its own browser either way."),
23627
+ bootstrappedRunner: boolean2().optional().describe("True when the runner had no live browser, or its browser was for a different listed target, and a fresh one was started before the run, so a `selection` ran against a fresh page rather than the one an earlier run left. Absent means the runner was already warm. Only a request carrying `selection` can bootstrap, because a whole run starts its own browser either way."),
23559
23628
  outcome: literal("success"),
23560
23629
  runId: string2().describe("Id of the run, to follow it by. Read the `run-status` stream of the runner's journal for its outcome, and `run-logs` and `run-events` for its output.")
23561
23630
  }),
@@ -23572,7 +23641,7 @@ var makeRunFlowOnRunnerContract = (ids) => {
23572
23641
  openWorldHint: true,
23573
23642
  readOnlyHint: false
23574
23643
  },
23575
- description: "Run a flow on an interactive runner. When `selection` is given the lines run against the browser as it stands, so nothing is re-navigated and nothing is signed in again; without it the whole entry point runs from a fresh browser. A runner with no live browser starts one before a selection and says so with `bootstrappedRunner`, which means those lines ran against a fresh page rather than the one an earlier run left. A selection produces no `runStarted` event, so follow it by its run id on `run-status` like any other run. Send `unchangedFiles` to ship only what changed since an earlier run on this runner; a `needs-full-sync` failure names the paths it does not hold, and the way to recover is the same run again with every file in `files`. Answers as soon as the run is accepted, with the id to follow it by — nothing waits for the run to finish. Which browser or device the run needs is read from the flow file's own execution target, so it is not supplied here; when it does not match what the runner is, the call fails with `runner-target-mismatch` rather than failing partway through the run. `runner-unreachable` means the answer did not arrive, which is NOT the same as the run not having started: the runner may have accepted it and been too slow to say so, and resubmitting would start a second run that is billed and journalled alongside the first. Read the runner's `run-status` journal stream before resubmitting, and use the newest run id there if one appeared.",
23644
+ description: "Run a flow on an interactive runner. When `selection` is given the lines run against the browser as it stands, so nothing is re-navigated and nothing is signed in again; without it the whole entry point runs from a fresh browser. A runner with no live browser, or one whose browser is for a different listed target, starts a fresh one before a selection and says so with `bootstrappedRunner`, which means those lines ran against a fresh page rather than the one an earlier run left. A selection produces no `runStarted` event, so follow it by its run id on `run-status` like any other run. Send `unchangedFiles` to ship only what changed since an earlier run on this runner; a `needs-full-sync` failure names the paths it does not hold, and the way to recover is the same run again with every file in `files`. Answers as soon as the run is accepted, with the id to follow it by — nothing waits for the run to finish. Which browser or device the run needs is read from the flow file's own execution target; for a file that lists several, `target` picks one. When it does not match what the runner is, the call fails with `runner-target-mismatch` rather than failing partway through the run. `runner-unreachable` means the answer did not arrive, which is NOT the same as the run not having started: the runner may have accepted it and been too slow to say so, and resubmitting would start a second run that is billed and journalled alongside the first. Read the runner's `run-status` journal stream before resubmitting, and use the newest run id there if one appeared.",
23576
23645
  input,
23577
23646
  kind: "write",
23578
23647
  name: "runner.runFlow",
@@ -23938,6 +24007,7 @@ var makeUsageBreakdownContract = (ids) => {
23938
24007
  workspaces: labels
23939
24008
  }),
23940
24009
  others: totals.optional().describe("The rows after limit, added up. Absent when none was left out."),
24010
+ qaWolfStaff: totals.optional().describe("For QA Wolf staff only: the runs and session time of QA Wolf staff in the same range and workspaces, added up. The customer is not billed for them, so rows, others and totals leave them out. Absent for everyone else."),
23941
24011
  rows: array(totals.extend({ group })).describe("Most credits first."),
23942
24012
  totals: totals.describe("All usage of the range. sessionCredits here are whole credits, counted for each UTC month and platform, so the rows can add up to a little less.")
23943
24013
  });
@@ -24040,6 +24110,7 @@ var makeContractsV1 = (ids) => {
24040
24110
  },
24041
24111
  runner: makeRunnerContracts(resolvedIds),
24042
24112
  skill: makeSkillContracts(),
24113
+ slack: makeSlackContracts(),
24043
24114
  suggestion: makeSuggestionContracts(resolvedIds),
24044
24115
  tag: makeTagContracts(resolvedIds),
24045
24116
  trigger: makeTriggerContracts(resolvedIds),
@@ -26551,7 +26622,7 @@ function startUpdateCheck(deps) {
26551
26622
  // package.json
26552
26623
  var package_default = {
26553
26624
  name: "@qawolf/cli",
26554
- version: "2.15.0",
26625
+ version: "2.17.0",
26555
26626
  description: "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
26556
26627
  keywords: [
26557
26628
  "automation",
@@ -26623,7 +26694,7 @@ var package_default = {
26623
26694
  "@clack/prompts": "1.5.1",
26624
26695
  "@napi-rs/keyring": "1.3.0",
26625
26696
  "@oxc-node/core": "0.1.0",
26626
- "@qawolf/api-contracts": "0.144.0",
26697
+ "@qawolf/api-contracts": "0.147.0",
26627
26698
  "@qawolf/emails": "1.1.1",
26628
26699
  "@qawolf/flow-targets": "2.0.0",
26629
26700
  commander: "14.0.3",
@@ -31785,11 +31856,46 @@ function readStringLiteral(source, start) {
31785
31856
  return;
31786
31857
  }
31787
31858
 
31859
+ // src/core/stringList.ts
31860
+ var listGapRe = /\s*/y;
31861
+ var listSeparatorRe = /\s*,\s*/y;
31862
+ function readStringList(source, start) {
31863
+ const values = [];
31864
+ listGapRe.lastIndex = start + 1;
31865
+ listGapRe.test(source);
31866
+ let i = listGapRe.lastIndex;
31867
+ while (source.charAt(i) !== "]") {
31868
+ const literal = readStringLiteral(source, i);
31869
+ if (!literal)
31870
+ return;
31871
+ values.push(literal.value);
31872
+ listSeparatorRe.lastIndex = literal.end + 1;
31873
+ if (listSeparatorRe.test(source)) {
31874
+ i = listSeparatorRe.lastIndex;
31875
+ continue;
31876
+ }
31877
+ listGapRe.lastIndex = literal.end + 1;
31878
+ listGapRe.test(source);
31879
+ i = listGapRe.lastIndex;
31880
+ if (source.charAt(i) !== "]")
31881
+ return;
31882
+ }
31883
+ return values.length > 0 ? values : undefined;
31884
+ }
31885
+
31788
31886
  // src/core/flowCall.ts
31789
31887
  var flowCallRe = /(?<![#$\p{ID_Continue}])flow\s*\(\s*/gu;
31790
31888
  var argSeparatorRe = /\s*,\s*/y;
31791
31889
  var keyValueRe = /\s*:\s*/y;
31792
31890
  var wordChar = /\w/;
31891
+ function readTargetValue(source, start) {
31892
+ if (source.charAt(start) === "[") {
31893
+ const targets = readStringList(source, start);
31894
+ return targets ? { targets } : undefined;
31895
+ }
31896
+ const target = readStringLiteral(source, start)?.value;
31897
+ return target === undefined ? undefined : { target };
31898
+ }
31793
31899
  function readTargetFromObject(source, start) {
31794
31900
  let depth = 0;
31795
31901
  let i = start;
@@ -31815,7 +31921,7 @@ function readTargetFromObject(source, start) {
31815
31921
  if (depth === 1 && source.startsWith("target", i) && !wordChar.test(source.charAt(i - 1))) {
31816
31922
  keyValueRe.lastIndex = i + "target".length;
31817
31923
  if (keyValueRe.test(source)) {
31818
- return readStringLiteral(source, keyValueRe.lastIndex)?.value;
31924
+ return readTargetValue(source, keyValueRe.lastIndex);
31819
31925
  }
31820
31926
  }
31821
31927
  i++;
@@ -31830,7 +31936,8 @@ function readTarget(source, afterName) {
31830
31936
  if (source.charAt(argStart) === "{") {
31831
31937
  return readTargetFromObject(source, argStart);
31832
31938
  }
31833
- return readStringLiteral(source, argStart)?.value || undefined;
31939
+ const target = readStringLiteral(source, argStart)?.value || undefined;
31940
+ return target === undefined ? undefined : { target };
31834
31941
  }
31835
31942
  function parseFlowCall(source) {
31836
31943
  let name;
@@ -31846,7 +31953,10 @@ function parseFlowCall(source) {
31846
31953
  if (name !== undefined && target !== undefined)
31847
31954
  break;
31848
31955
  }
31849
- return { name, target };
31956
+ if (target !== undefined && "targets" in target) {
31957
+ return { name, target: undefined, targets: target.targets };
31958
+ }
31959
+ return { name, target: target?.target };
31850
31960
  }
31851
31961
 
31852
31962
  // src/core/flowMeta.ts
@@ -32726,14 +32836,21 @@ async function flowsList(ctx, pattern, deps, selectors = { tags: [] }) {
32726
32836
  return notCached;
32727
32837
  const all = [];
32728
32838
  for await (const { file, ...meta } of batchMap(files, async (f) => ({ file: f, ...await deps.peekFlowMeta(f) }), flowBatchSize)) {
32729
- all.push({
32730
- file: path2.relative(deps.cwd, file),
32731
- name: meta.name ?? flowBasename(file),
32732
- env: envLabelFor(file, envLabels),
32733
- tags: cachedTags.get(file),
32734
- target: meta.target,
32735
- browser: meta.target ? targetToBrowser(meta.target) : undefined
32736
- });
32839
+ const name = meta.name ?? flowBasename(file);
32840
+ const entries = meta.targets === undefined ? [{ name, target: meta.target }] : meta.targets.map((target) => ({
32841
+ name: `${name} · ${target}`,
32842
+ target
32843
+ }));
32844
+ for (const entry of entries) {
32845
+ all.push({
32846
+ file: path2.relative(deps.cwd, file),
32847
+ name: entry.name,
32848
+ env: envLabelFor(file, envLabels),
32849
+ tags: cachedTags.get(file),
32850
+ target: entry.target,
32851
+ browser: entry.target ? targetToBrowser(entry.target) : undefined
32852
+ });
32853
+ }
32737
32854
  }
32738
32855
  const items = all.filter((item) => matchesSelectors(item, selectors));
32739
32856
  const empty = await emptySelectionResult(selectors, items.length, undefined);
@@ -41068,6 +41185,7 @@ import { basename as basename9 } from "node:path";
41068
41185
 
41069
41186
  // src/domains/investigation/download.ts
41070
41187
  var traceLimit = 75 * 1024 * 1024;
41188
+ var networkLogLimit = 65 * 1024 * 1024;
41071
41189
  var logTailLimit = 5 * 1024 * 1024;
41072
41190
  var logTransferLimit = 50 * 1024 * 1024;
41073
41191
  var downloadTimeoutMs = 120000;
@@ -41136,19 +41254,25 @@ async function readBounded(response, options) {
41136
41254
  }
41137
41255
  return { bytes, offset, status: "available" };
41138
41256
  }
41139
- async function downloadTrace(url, fetchImpl = globalThis.fetch) {
41257
+ async function downloadWhole(url, limit, fetchImpl) {
41140
41258
  try {
41141
41259
  const signal = AbortSignal.timeout(downloadTimeoutMs);
41142
41260
  const response = await fetchImpl(url, { redirect: "follow", signal });
41143
41261
  return await readBounded(response, {
41144
41262
  keepTail: false,
41145
- retainBytes: traceLimit,
41146
- transferBytes: traceLimit
41263
+ retainBytes: limit,
41264
+ transferBytes: limit
41147
41265
  });
41148
41266
  } catch (error) {
41149
41267
  return downloadFailure(error);
41150
41268
  }
41151
41269
  }
41270
+ function downloadTrace(url, fetchImpl = globalThis.fetch) {
41271
+ return downloadWhole(url, traceLimit, fetchImpl);
41272
+ }
41273
+ function downloadNetworkLog(url, fetchImpl = globalThis.fetch) {
41274
+ return downloadWhole(url, networkLogLimit, fetchImpl);
41275
+ }
41152
41276
  async function downloadLogTail(url, fetchImpl = globalThis.fetch) {
41153
41277
  try {
41154
41278
  const signal = AbortSignal.timeout(downloadTimeoutMs);
@@ -41185,16 +41309,37 @@ function parserSpecifier() {
41185
41309
  function artifactUnavailable(status) {
41186
41310
  return { status };
41187
41311
  }
41188
- async function loadSummaryArtifacts(value) {
41312
+ var networkLogUploadMilliseconds = 2 * 60 * 1000;
41313
+ function networkLogState(log, completedAt, now) {
41314
+ const sinceEnd = now - Date.parse(completedAt ?? "");
41315
+ const uploading = sinceEnd < networkLogUploadMilliseconds;
41316
+ return log.status === "not-found" && uploading ? { status: "pending" } : log;
41317
+ }
41318
+ async function loadSummaryArtifacts(value, now = Date.now()) {
41189
41319
  if (value.artifactStatus !== "signed") {
41190
41320
  const unavailable = artifactUnavailable(value.artifactStatus);
41191
- return { logs: unavailable, trace: unavailable };
41192
- }
41193
- const [logs, trace] = await Promise.all([
41194
- value.artifacts.logsUrl ? downloadLogTail(value.artifacts.logsUrl) : artifactUnavailable("not-captured"),
41195
- value.artifacts.traceUrl ? downloadTrace(value.artifacts.traceUrl) : artifactUnavailable("not-captured")
41321
+ return { logs: unavailable, networkLog: unavailable, trace: unavailable };
41322
+ }
41323
+ const { logsUrl, networkLogsUrl, traceUrl } = value.artifacts;
41324
+ const notCaptured = artifactUnavailable("not-captured");
41325
+ const [logs, trace, networkLog] = await Promise.all([
41326
+ logsUrl ? downloadLogTail(logsUrl) : notCaptured,
41327
+ traceUrl ? downloadTrace(traceUrl) : notCaptured,
41328
+ networkLogsUrl ? downloadNetworkLog(networkLogsUrl) : notCaptured
41196
41329
  ]);
41197
- return { logs, trace };
41330
+ if (trace.status === "available")
41331
+ return { logs, trace };
41332
+ const state = networkLogState(networkLog, value.attempt.completedAt, now);
41333
+ return { logs, networkLog: state, trace };
41334
+ }
41335
+ async function loadNetworkLogFallback(value, type, trace) {
41336
+ const readsRequests = type === "network" || type === "request";
41337
+ const url = value.artifacts.networkLogsUrl;
41338
+ if (!readsRequests || trace.status === "available" || !url)
41339
+ return {};
41340
+ const download = await downloadNetworkLog(url);
41341
+ const { completedAt } = value.attempt;
41342
+ return { networkLog: networkLogState(download, completedAt, Date.now()) };
41198
41343
  }
41199
41344
  async function loadInspectArtifact(value, type) {
41200
41345
  const inactive = artifactUnavailable("not-captured");
@@ -41208,9 +41353,11 @@ async function loadInspectArtifact(value, type) {
41208
41353
  trace: inactive
41209
41354
  };
41210
41355
  }
41356
+ const trace = value.artifacts.traceUrl ? await downloadTrace(value.artifacts.traceUrl) : inactive;
41211
41357
  return {
41212
41358
  logs: inactive,
41213
- trace: value.artifacts.traceUrl ? await downloadTrace(value.artifacts.traceUrl) : inactive
41359
+ ...await loadNetworkLogFallback(value, type, trace),
41360
+ trace
41214
41361
  };
41215
41362
  }
41216
41363
  var defaultInspectLimit = "20";
@@ -41225,7 +41372,8 @@ var filterSelectors = [
41225
41372
  ["source", "--source", ["log"]],
41226
41373
  ["method", "--method", ["network"]],
41227
41374
  ["status", "--status", ["network"]],
41228
- ["urlContains", "--url-contains", ["network"]]
41375
+ ["urlContains", "--url-contains", ["network"]],
41376
+ ["failed", "--failed", ["network"]]
41229
41377
  ];
41230
41378
  function inapplicableFilter(options) {
41231
41379
  for (const [field, flag, selectors] of filterSelectors) {
@@ -41348,6 +41496,7 @@ async function handleInvestigationInspect(ctx, options) {
41348
41496
  endTimeMilliseconds,
41349
41497
  endTimestamp: options.endTimestamp,
41350
41498
  evidenceId: options.evidenceId,
41499
+ failed: options.failed,
41351
41500
  format: options.format,
41352
41501
  limit,
41353
41502
  method: options.method,
@@ -41421,10 +41570,10 @@ function parseFormat(value) {
41421
41570
  function registerAttemptCommand(program, signals) {
41422
41571
  const attempt = program.command("attempt").description("Investigate a finished run attempt from recorded evidence");
41423
41572
  declareCommandKind(attempt.command("investigate"), "read").description("Summarize the evidence for one finished attempt").requiredOption("--attempt-id <id>", "Attempt to summarize").action((options, command) => withAuthContext(signals, (ctx) => handleInvestigationSummary(ctx, options.attemptId))(options, command));
41424
- declareCommandKind(attempt.command("inspect"), "read").description("Inspect one kind of evidence for a finished attempt").requiredOption("--attempt-id <id>", "Attempt to inspect").option("--action <id>", "Inspect one action evidence ID").option("--timeline", "Inspect the action timeline").option("--network", "Inspect network requests").option("--request <id>", "Inspect one network request evidence ID").option("--snapshot <id>", "Inspect one page snapshot evidence ID").option("--screenshot <id>", "Export one screenshot evidence ID").option("--console", "Inspect browser console evidence").option("--log", "Inspect execution log evidence").option("--evidence-id <id>", "Return only this console or log record").option("--limit <number>", "Maximum entries to return, 20 by default and up to 100: the most recent for --timeline, --network and --log, the earliest for --console").option("--start-time-ms <number>", "Earliest trace timestamp in milliseconds").option("--end-time-ms <number>", "Latest trace timestamp in milliseconds").option("--start-timestamp <iso>", "Earliest execution log timestamp").option("--end-timestamp <iso>", "Latest execution log timestamp").addOption(new Option2("--source <source>", "Execution log source").choices([
41573
+ declareCommandKind(attempt.command("inspect"), "read").description("Inspect one kind of evidence for a finished attempt").requiredOption("--attempt-id <id>", "Attempt to inspect").option("--action <id>", "Inspect one action evidence ID").option("--timeline", "Inspect the action timeline").option("--network", "Inspect network requests").option("--request <id>", "Inspect one network request evidence ID").option("--snapshot <id>", "Inspect one page snapshot evidence ID").option("--screenshot <id>", "Export one screenshot evidence ID").option("--console", "Inspect browser console evidence").option("--log", "Inspect execution log evidence").option("--evidence-id <id>", "Return only this console or log record").option("--limit <number>", "Maximum entries to return, 20 by default and up to 100: the most recent for --timeline, --network and --log, the earliest for --console").option("--start-time-ms <number>", "Earliest trace timestamp in milliseconds (epoch milliseconds for an iOS network log)").option("--end-time-ms <number>", "Latest trace timestamp in milliseconds (epoch milliseconds for an iOS network log)").option("--start-timestamp <iso>", "Earliest execution log timestamp").option("--end-timestamp <iso>", "Latest execution log timestamp").addOption(new Option2("--source <source>", "Execution log source").choices([
41425
41574
  "qawolfTraceCollection",
41426
41575
  "serverConsole"
41427
- ])).option("--method <method>", "Network HTTP method").option("--status <code>", "Network HTTP status").option("--url-contains <text>", "Network URL substring").option("--format <format>", "Snapshot format (text or html)", parseFormat, "text").option("--output-file <path>", "Write HTML or screenshot bytes without overwriting").action((options, command) => {
41576
+ ])).option("--method <method>", "Network HTTP method").option("--status <code>", "Network HTTP status").option("--url-contains <text>", "Network URL substring").option("--failed", "Only failed network requests. In a trace: no response, HTTP status 400 or more, or an error. In an iOS network log: requests with a failureReason").option("--format <format>", "Snapshot format (text or html)", parseFormat, "text").option("--output-file <path>", "Write HTML or screenshot bytes without overwriting").action((options, command) => {
41428
41577
  const selection = resolveInspectSelection(options);
41429
41578
  if ("error" in selection)
41430
41579
  return command.error(selection.error);
@@ -41553,7 +41702,7 @@ function buildFlagSpecs(inputSchema) {
41553
41702
  function isContract(value) {
41554
41703
  return "name" in value && typeof value.name === "string";
41555
41704
  }
41556
- function buildSpec(contract, path, skipFlagPaths) {
41705
+ function buildSpec(contract, path, negatedFlagPaths) {
41557
41706
  const dottedPath = path.join(".");
41558
41707
  if (contract.name !== dottedPath) {
41559
41708
  throw new Error(`Contract at "${dottedPath}" declares name "${contract.name}"; names must match their position in the contract tree.`);
@@ -41567,7 +41716,7 @@ function buildSpec(contract, path, skipFlagPaths) {
41567
41716
  trpcPath: `public.${contract.name}`,
41568
41717
  kind: contract.kind,
41569
41718
  description: contract.description,
41570
- flags: flags.flags.filter((flag) => !skipFlagPaths?.has([...path, ...flag.path].join("."))),
41719
+ flags: flags.flags.map((flag) => negatedFlagPaths?.has([...path, ...flag.path].join(".")) ? { ...flag, flag: flag.flag.replace(/^--/, "--no-") } : flag),
41571
41720
  contract
41572
41721
  };
41573
41722
  }
@@ -41579,7 +41728,7 @@ function buildCommandSpecs(tree, options = {}) {
41579
41728
  return walk(value, childPath);
41580
41729
  if (skip?.has(childPath.join(".")))
41581
41730
  return [];
41582
- return [buildSpec(value, childPath, options.skipFlagPaths)];
41731
+ return [buildSpec(value, childPath, options.negatedFlagPaths)];
41583
41732
  });
41584
41733
  return walk(tree, []);
41585
41734
  }
@@ -41820,7 +41969,7 @@ var skippedContractNames = new Set([
41820
41969
  ...handWrittenContractNames,
41821
41970
  ...deprecatedContractNames
41822
41971
  ]);
41823
- var skippedFlagPaths = new Set([
41972
+ var negatedFlagPaths = new Set([
41824
41973
  "run.create.investigateFailures"
41825
41974
  ]);
41826
41975
 
@@ -41856,12 +42005,16 @@ function registerSpec(program, signals, spec, authDeps) {
41856
42005
  command.option(flag.flag, flag.description);
41857
42006
  }
41858
42007
  }
41859
- command.action((options, leaf) => withAuthContext(signals, (ctx) => handlePublicApiCommand(ctx, spec, withoutExclusiveConflict(spec, leaf, options)), authDeps ?? {})(options, leaf));
42008
+ command.action((options, leaf) => withAuthContext(signals, (ctx) => handlePublicApiCommand(ctx, spec, withoutExclusiveConflict(spec, leaf, withoutNegatedDefaults(spec, leaf, options))), authDeps ?? {})(options, leaf));
42009
+ }
42010
+ function withoutNegatedDefaults(spec, command, options) {
42011
+ const defaulted = new Set(spec.flags.filter((flag) => flag.flag.startsWith("--no-") && command.getOptionValueSource(flag.optionKey) === "default").map((flag) => flag.optionKey));
42012
+ return Object.fromEntries(Object.entries(options).filter(([key]) => !defaulted.has(key)));
41860
42013
  }
41861
42014
  function registerPublicApiCommands(program, signals, options = {}) {
41862
42015
  const specs = buildCommandSpecs(options.contracts ?? publicContractsV1, {
41863
42016
  skipContractNames: skippedContractNames,
41864
- skipFlagPaths: skippedFlagPaths
42017
+ negatedFlagPaths
41865
42018
  });
41866
42019
  for (const spec of specs) {
41867
42020
  registerSpec(program, signals, spec, options.authDeps);
@@ -43010,6 +43163,12 @@ The lines-file has to be one of the files that travel, so it lives under the dir
43010
43163
 
43011
43164
  A --lines selection is the one call that does not need a run first. If the runner had no browser, one is started before your lines run, and the command says so on stderr. Those lines then ran against a fresh page rather than the one an earlier run left, which is worth reading before you act on what you see.
43012
43165
 
43166
+ # A flow file with several targets
43167
+
43168
+ A flow file can list several targets, such as \`target: ["macOS - Any Mac (Latest)", "Windows 11 - Desktop"]\`. Each target is its own flow, named \`<name> · <target>\`, and \`qawolf flows list\` shows one row per target.
43169
+
43170
+ run takes the first listed target the runner can run. To run another one, pass --target with its name as the file lists it, on a runner of that target's OS: \`--target "Windows 11 - Desktop"\` on a Windows runner. A name the file does not list is refused, and a runner of another OS fails with a runner-target mismatch.
43171
+
43013
43172
  # Environment variables
43014
43173
 
43015
43174
  A run's variables come from up to three places, each on top of the one before:
@@ -44852,6 +45011,7 @@ async function sendRunFlowRequest(ctx, options, delta) {
44852
45011
  ...options.environment === undefined ? {} : { env: options.environment },
44853
45012
  ...options.environmentId === undefined ? {} : { environmentId: options.environmentId },
44854
45013
  ...options.selection === undefined ? {} : { selection: options.selection },
45014
+ ...options.target === undefined ? {} : { target: options.target },
44855
45015
  ...delta.unchangedFiles === undefined ? {} : { unchangedFiles: delta.unchangedFiles }
44856
45016
  }, runnerCallOptions);
44857
45017
  if (!result.ok) {
@@ -44972,7 +45132,8 @@ async function handleRunnerRun(ctx, options, deps) {
44972
45132
  environmentId: prepared.environmentId,
44973
45133
  files: prepared.files,
44974
45134
  resolved,
44975
- selection: prepared.selection
45135
+ selection: prepared.selection,
45136
+ target: options.target
44976
45137
  }, deps);
44977
45138
  if (!submitted.ok) {
44978
45139
  const { ok: _ok, ...failure } = submitted;
@@ -45011,9 +45172,10 @@ Examples:
45011
45172
  $ qawolf runner run flows/checkout.flow.ts --lines 4-9 --lines-file pages/login.ts
45012
45173
  $ qawolf runner run flows/checkout.flow.ts --env-id staging
45013
45174
  $ qawolf runner run flows/checkout.flow.ts --env-var RUN_INPUT_PATH=uploads/app.apk
45014
- $ qawolf runner run flows/checkout.flow.ts --builds <buildId> <buildId>`;
45175
+ $ qawolf runner run flows/checkout.flow.ts --builds <buildId> <buildId>
45176
+ $ qawolf runner run flows/login.flow.ts --target "macOS - Any Mac (macOS 26)"`;
45015
45177
  function registerRunCommand(runner, signals) {
45016
- declareCommandKind(runner.command("run <flowFile>"), "write").description("Run a flow on an interactive runner, shipping the flow and what it imports").option("--follow", "Report the run's status until it settles: in progress, then passed or failed", false).option("--logs", "Stream every log line the run produces while following. Implies --follow", false).option("--run-events", "Stream the run's progress events as JSON lines while following. Implies --follow", false).option("--recorder-events", "Stream the browser actions the runner records as JSON lines while following, from an anchor taken just before submission: the recorder is runner-wide, not run-scoped. Implies --follow", false).option("--env-id <env>", "QA Wolf environment whose variables the run is given, by id or alias. Defaults to QAWOLF_ENVIRONMENT unless --env-file is passed. QA Wolf reads and decrypts them itself, so they never leave the server and no size limit applies to them").option("--env-file <path>", "Dotenv file on this machine whose variables the run is given. With --env-id, they go on top of that environment's").option("--var, --env-var <name=value>", "One variable for this run only, on top of the environment and --env-file; repeat for several", collectValue, []).option("--builds <ids...>", "Builds to install in this run, from build.create, one per app and platform. Each replaces the environment's latest build of its app and platform. Put the flow file before this flag", []).option("--lines <start-end>", "Run only these 1-indexed lines against the browser as it stands, instead of the whole flow from a fresh one").option("--lines-file <path>", "File the --lines range lives in. Defaults to <flowFile>; pass it only when the lines are in another file, such as a page object").option("--runner <id>", runnerFlagDescription).option("--timeout <seconds>", "Give up following after this long. Following keeps the runner alive, so a run that never settles would otherwise bill until the terminal closed", String(defaultFollowTimeoutSeconds)).addHelpText("after", runExamples2).addHelpText("after", runnerGuides.run).action((flowFile, opts, command) => withRunnerContext(signals, (ctx) => handleRunnerRun(ctx, {
45178
+ declareCommandKind(runner.command("run <flowFile>"), "write").description("Run a flow on an interactive runner, shipping the flow and what it imports").option("--follow", "Report the run's status until it settles: in progress, then passed or failed", false).option("--logs", "Stream every log line the run produces while following. Implies --follow", false).option("--run-events", "Stream the run's progress events as JSON lines while following. Implies --follow", false).option("--recorder-events", "Stream the browser actions the runner records as JSON lines while following, from an anchor taken just before submission: the recorder is runner-wide, not run-scoped. Implies --follow", false).option("--env-id <env>", "QA Wolf environment whose variables the run is given, by id or alias. Defaults to QAWOLF_ENVIRONMENT unless --env-file is passed. QA Wolf reads and decrypts them itself, so they never leave the server and no size limit applies to them").option("--env-file <path>", "Dotenv file on this machine whose variables the run is given. With --env-id, they go on top of that environment's").option("--var, --env-var <name=value>", "One variable for this run only, on top of the environment and --env-file; repeat for several", collectValue, []).option("--builds <ids...>", "Builds to install in this run, from build.create, one per app and platform. Each replaces the environment's latest build of its app and platform. Put the flow file before this flag", []).option("--lines <start-end>", "Run only these 1-indexed lines against the browser as it stands, instead of the whole flow from a fresh one").option("--lines-file <path>", "File the --lines range lives in. Defaults to <flowFile>; pass it only when the lines are in another file, such as a page object").option("--target <preset>", "For a flow file that lists several targets, the one to run, as the file lists it. Defaults to the first listed target the runner can run. Launch a runner of that target's OS first").option("--runner <id>", runnerFlagDescription).option("--timeout <seconds>", "Give up following after this long. Following keeps the runner alive, so a run that never settles would otherwise bill until the terminal closed", String(defaultFollowTimeoutSeconds)).addHelpText("after", runExamples2).addHelpText("after", runnerGuides.run).action((flowFile, opts, command) => withRunnerContext(signals, (ctx) => handleRunnerRun(ctx, {
45017
45179
  builds: opts.builds,
45018
45180
  entryPoint: flowFile,
45019
45181
  envFile: opts.envFile,
@@ -45025,6 +45187,7 @@ function registerRunCommand(runner, signals) {
45025
45187
  recorderEvents: opts.recorderEvents,
45026
45188
  runEvents: opts.runEvents,
45027
45189
  runner: opts.runner,
45190
+ target: opts.target,
45028
45191
  timeout: opts.timeout,
45029
45192
  vars: opts.envVar
45030
45193
  }, runnerDeps(ctx)))(opts, command));
@@ -45279,4 +45442,4 @@ createProgram({ signals }).parseAsync().catch(() => {
45279
45442
  process.exitCode = 1;
45280
45443
  }).finally(() => exitWhenIdle(typeof process.exitCode === "number" ? process.exitCode : 0));
45281
45444
 
45282
- //# debugId=A305E95D82772A0E64756E2164756E21
45445
+ //# debugId=BA29FF221030E77564756E2164756E21
@@ -10597,6 +10597,109 @@ async function inspectAction(trace, common, target) {
10597
10597
  };
10598
10598
  }
10599
10599
 
10600
+ // src/domains/investigation/parser/networkLog/networkLog.ts
10601
+ var requestKinds = new Set([
10602
+ "connection",
10603
+ "connection-failed",
10604
+ "encrypted",
10605
+ "http"
10606
+ ]);
10607
+ var sensitiveHeader = /^(authorization|cookie|set-cookie|proxy-authorization|x-api-key)$/i;
10608
+ var asRow = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
10609
+ var asString = (value) => typeof value === "string" ? value : undefined;
10610
+ var asNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : undefined;
10611
+ function parseLine(line) {
10612
+ try {
10613
+ return asRow(JSON.parse(line));
10614
+ } catch {
10615
+ return;
10616
+ }
10617
+ }
10618
+ function toHeaders(value) {
10619
+ if (!Array.isArray(value))
10620
+ return {};
10621
+ return Object.fromEntries(value.flatMap((header) => {
10622
+ const name = asString(asRow(header)?.["name"]);
10623
+ const headerValue = asString(asRow(header)?.["value"]);
10624
+ if (name === undefined || headerValue === undefined)
10625
+ return [];
10626
+ return [[name, sensitiveHeader.test(name) ? "[REDACTED]" : headerValue]];
10627
+ }));
10628
+ }
10629
+ function networkFailureReason(kind, status, failureText) {
10630
+ if (kind === "connection-failed")
10631
+ return "connection-failed";
10632
+ if (status >= 400)
10633
+ return "http-error";
10634
+ if (failureText === undefined)
10635
+ return;
10636
+ if (failureText === "context canceled")
10637
+ return "canceled";
10638
+ if (kind !== "http" && failureText === "EOF")
10639
+ return;
10640
+ return kind === "connection" ? "connection-failed" : "interrupted";
10641
+ }
10642
+ function toEntry(row, extras, kind) {
10643
+ const request = asRow(row["request"]);
10644
+ const response = asRow(row["response"]);
10645
+ const id = asString(extras["cursor"]);
10646
+ if (!request || !response || id === undefined)
10647
+ return;
10648
+ const status = asNumber(response["status"]) ?? 0;
10649
+ const failureText = asString(extras["err"]);
10650
+ const started = Date.parse(asString(row["startedDateTime"]) ?? "");
10651
+ return {
10652
+ app: asString(extras["app"]),
10653
+ bodyTruncated: extras["bodyTruncated"] === true,
10654
+ durationMilliseconds: asNumber(row["time"]),
10655
+ failureReason: networkFailureReason(kind, status, failureText),
10656
+ failureText,
10657
+ id,
10658
+ kind,
10659
+ method: asString(request["method"]) ?? "",
10660
+ requestBody: asString(asRow(request["postData"])?.["text"]),
10661
+ requestHeaders: toHeaders(request["headers"]),
10662
+ responseBody: asString(asRow(response["content"])?.["text"]),
10663
+ responseHeaders: toHeaders(response["headers"]),
10664
+ startedAtMilliseconds: Number.isNaN(started) ? undefined : started,
10665
+ status,
10666
+ url: asString(request["url"]) ?? ""
10667
+ };
10668
+ }
10669
+ function parseNetworkLog(bytes) {
10670
+ const log = {
10671
+ closed: false,
10672
+ droppedRows: 0,
10673
+ entries: [],
10674
+ malformed: 0
10675
+ };
10676
+ for (const line of Buffer.from(bytes).toString("utf8").split(`
10677
+ `)) {
10678
+ if (!line.trim())
10679
+ continue;
10680
+ const row = parseLine(line);
10681
+ const extras = asRow(row?.["_qawolf"]);
10682
+ const kind = asString(extras?.["kind"]);
10683
+ if (!row || !extras || kind === undefined) {
10684
+ log.malformed += 1;
10685
+ continue;
10686
+ }
10687
+ if (kind === "summary") {
10688
+ log.closed = true;
10689
+ log.droppedRows = asNumber(extras["droppedRows"]) ?? 0;
10690
+ continue;
10691
+ }
10692
+ if (!requestKinds.has(kind))
10693
+ continue;
10694
+ const entry = toEntry(row, extras, kind);
10695
+ if (entry)
10696
+ log.entries.push(entry);
10697
+ else
10698
+ log.malformed += 1;
10699
+ }
10700
+ return log;
10701
+ }
10702
+
10600
10703
  // src/domains/investigation/parser/projection/inspectAttemptNetwork.ts
10601
10704
  var maxNetworkMetadataBytes = 2 * 1024;
10602
10705
  function shapeRequest(request) {
@@ -10620,7 +10723,7 @@ async function inspectNetwork(trace, common, target) {
10620
10723
  const listed = await listTraceNetwork(trace, {
10621
10724
  limit: Number.MAX_SAFE_INTEGER
10622
10725
  });
10623
- const filtered = listed.items.filter((request) => (target.method === undefined || request.method.toLowerCase() === target.method.toLowerCase()) && (target.status === undefined || request.status === target.status) && (target.urlContains === undefined || request.url.includes(target.urlContains)) && (target.startTimeMilliseconds === undefined || (request.startedAtMilliseconds ?? -Infinity) >= target.startTimeMilliseconds) && (target.endTimeMilliseconds === undefined || (request.startedAtMilliseconds ?? Infinity) <= target.endTimeMilliseconds)).toSorted((left, right) => (left.startedAtMilliseconds ?? Infinity) - (right.startedAtMilliseconds ?? Infinity) || left.streamId.localeCompare(right.streamId) || left.id.localeCompare(right.id));
10726
+ const filtered = listed.items.filter((request) => (target.failed !== true || !request.status || request.status >= 400 || request.failureText !== undefined) && (target.method === undefined || request.method.toLowerCase() === target.method.toLowerCase()) && (target.status === undefined || request.status === target.status) && (target.urlContains === undefined || request.url.includes(target.urlContains)) && (target.startTimeMilliseconds === undefined || (request.startedAtMilliseconds ?? -Infinity) >= target.startTimeMilliseconds) && (target.endTimeMilliseconds === undefined || (request.startedAtMilliseconds ?? Infinity) <= target.endTimeMilliseconds)).toSorted((left, right) => (left.startedAtMilliseconds ?? Infinity) - (right.startedAtMilliseconds ?? Infinity) || left.streamId.localeCompare(right.streamId) || left.id.localeCompare(right.id));
10624
10727
  const boundary = target.beforeRequestId ? filtered.findIndex((request) => request.id === target.beforeRequestId) : filtered.length;
10625
10728
  if (boundary === -1) {
10626
10729
  return {
@@ -11135,6 +11238,103 @@ function inspectConsole(trace, common, target) {
11135
11238
  };
11136
11239
  }
11137
11240
 
11241
+ // src/domains/investigation/parser/projection/summarizeNetworkLog.ts
11242
+ var summaryLimit = 10;
11243
+ var maxMetadataBytes = 2 * 1024;
11244
+ function boundNetworkLogText(text, maxBytes) {
11245
+ return text === undefined ? undefined : redactAndBoundAttemptEvidenceResult(text, maxBytes);
11246
+ }
11247
+ function networkLogCoverage(log, returned, total) {
11248
+ return {
11249
+ incomplete: !log.closed || log.droppedRows > 0,
11250
+ malformed: log.malformed,
11251
+ returned,
11252
+ total,
11253
+ truncated: returned < total
11254
+ };
11255
+ }
11256
+ function byNetworkLogStart(entries) {
11257
+ const start = (entry) => entry.startedAtMilliseconds ?? Number.NEGATIVE_INFINITY;
11258
+ return entries.toSorted((left, right) => start(left) - start(right) || 0);
11259
+ }
11260
+ function shapeNetworkLogEntry(entry) {
11261
+ const url = redactAndBoundAttemptEvidenceResult(entry.url, maxMetadataBytes);
11262
+ const failureText = boundNetworkLogText(entry.failureText, maxMetadataBytes);
11263
+ return {
11264
+ ...entry.app !== undefined && { app: entry.app },
11265
+ durationMilliseconds: entry.durationMilliseconds,
11266
+ ...entry.failureReason && { failureReason: entry.failureReason },
11267
+ ...failureText && { failureText: failureText.text },
11268
+ kind: entry.kind,
11269
+ ...(url.truncated || failureText?.truncated === true) && {
11270
+ metadataTruncated: true
11271
+ },
11272
+ method: entry.method,
11273
+ requestId: entry.id,
11274
+ startedAtMilliseconds: entry.startedAtMilliseconds,
11275
+ status: entry.status,
11276
+ url: url.text
11277
+ };
11278
+ }
11279
+ function summarizeNetworkLogErrors(log) {
11280
+ const failed = byNetworkLogStart(log.entries.filter((entry) => entry.failureReason));
11281
+ const isCanceled = (entry) => entry.failureReason === "canceled";
11282
+ const others = failed.filter((entry) => !isCanceled(entry));
11283
+ const places = Math.max(0, summaryLimit - others.length);
11284
+ const kept = new Set([
11285
+ ...others.slice(-summaryLimit),
11286
+ ...places === 0 ? [] : failed.filter(isCanceled).slice(-places)
11287
+ ]);
11288
+ const items = failed.filter((entry) => kept.has(entry));
11289
+ return {
11290
+ coverage: networkLogCoverage(log, items.length, failed.length),
11291
+ items: items.map(shapeNetworkLogEntry)
11292
+ };
11293
+ }
11294
+
11295
+ // src/domains/investigation/parser/projection/inspectNetworkLog.ts
11296
+ var maxBodyBytes = 64 * 1024;
11297
+ function shapeBody(text, cut) {
11298
+ const body = boundNetworkLogText(text, maxBodyBytes);
11299
+ return body ? {
11300
+ status: "available",
11301
+ text: body.text,
11302
+ truncated: cut || body.truncated
11303
+ } : { status: "unavailable" };
11304
+ }
11305
+ function inspectNetworkLog(log, common, target) {
11306
+ const filtered = byNetworkLogStart(log.entries.filter((entry) => (target.failed !== true || entry.failureReason !== undefined) && (target.method === undefined || entry.method.toLowerCase() === target.method.toLowerCase()) && (target.status === undefined || entry.status === target.status) && (target.urlContains === undefined || entry.url.includes(target.urlContains)) && (target.startTimeMilliseconds === undefined || (entry.startedAtMilliseconds ?? -Infinity) >= target.startTimeMilliseconds) && (target.endTimeMilliseconds === undefined || (entry.startedAtMilliseconds ?? Infinity) <= target.endTimeMilliseconds)));
11307
+ const selected = filtered.slice(-target.limit);
11308
+ return {
11309
+ ...common,
11310
+ coverage: networkLogCoverage(log, selected.length, filtered.length),
11311
+ entries: selected.map(shapeNetworkLogEntry),
11312
+ status: "available",
11313
+ type: target.type
11314
+ };
11315
+ }
11316
+ function inspectNetworkLogRequest(log, common, target) {
11317
+ const entry = log.entries.find((item) => item.id === target.requestId);
11318
+ if (!entry)
11319
+ return { ...common, status: "not-found", type: target.type };
11320
+ const requestHeaders = redactInspectionHeaders(entry.requestHeaders);
11321
+ const responseHeaders = redactInspectionHeaders(entry.responseHeaders);
11322
+ const { metadataTruncated, ...shaped } = shapeNetworkLogEntry(entry);
11323
+ return {
11324
+ ...common,
11325
+ body: shapeBody(entry.responseBody, entry.bodyTruncated),
11326
+ request: {
11327
+ ...shaped,
11328
+ ...(metadataTruncated === true || requestHeaders.truncated || responseHeaders.truncated) && { metadataTruncated: true },
11329
+ requestHeaders: requestHeaders.headers,
11330
+ responseHeaders: responseHeaders.headers
11331
+ },
11332
+ requestBody: shapeBody(entry.requestBody, entry.bodyTruncated),
11333
+ status: "available",
11334
+ type: target.type
11335
+ };
11336
+ }
11337
+
11138
11338
  // src/domains/investigation/parser/projection/summarizeAttemptNetwork.ts
11139
11339
  var evidenceLimit = 10;
11140
11340
  var maxNetworkFieldBytes = 2 * 1024;
@@ -11311,8 +11511,10 @@ async function summarizeAttemptTrace(trace, attemptError) {
11311
11511
 
11312
11512
  // src/domains/investigation/parser/index.ts
11313
11513
  function traceUnavailable(request, traceStatus) {
11514
+ const networkLogStatus = request.artifacts.networkLog?.status;
11314
11515
  return {
11315
11516
  attemptId: request.attempt.attemptId,
11517
+ ...networkLogStatus && { networkLogStatus },
11316
11518
  status: "unavailable",
11317
11519
  traceStatus,
11318
11520
  type: request.inspect?.type ?? "summary"
@@ -11322,10 +11524,47 @@ async function parseTrace(request) {
11322
11524
  const input = request.artifacts.trace;
11323
11525
  return input.status === "available" ? parsePlaywrightTraceArchive(Buffer.from(input.bytes)) : undefined;
11324
11526
  }
11527
+ function parseNetworkLogArtifact(request) {
11528
+ const input = request.artifacts.networkLog;
11529
+ return input?.status === "available" ? parseNetworkLog(input.bytes) : undefined;
11530
+ }
11531
+ function networkFilter(target) {
11532
+ return {
11533
+ ...target.endTimeMilliseconds !== undefined && {
11534
+ endTimeMilliseconds: target.endTimeMilliseconds
11535
+ },
11536
+ ...target.failed === true && { failed: true },
11537
+ limit: target.limit,
11538
+ ...target.method !== undefined && { method: target.method },
11539
+ ...target.startTimeMilliseconds !== undefined && {
11540
+ startTimeMilliseconds: target.startTimeMilliseconds
11541
+ },
11542
+ ...target.status !== undefined && { status: target.status },
11543
+ type: "network",
11544
+ ...target.urlContains !== undefined && {
11545
+ urlContains: target.urlContains
11546
+ }
11547
+ };
11548
+ }
11549
+ function inspectFromNetworkLog(request, log) {
11550
+ const target = request.inspect;
11551
+ const common = {
11552
+ attemptId: request.attempt.attemptId,
11553
+ flowId: request.flowId,
11554
+ networkLogStatus: log.closed && log.droppedRows === 0 ? "ready" : "partial",
11555
+ runId: request.runId,
11556
+ traceStatus: "not-applicable"
11557
+ };
11558
+ return target.type === "request" ? inspectNetworkLogRequest(log, common, {
11559
+ requestId: target.requestId,
11560
+ type: target.type
11561
+ }) : inspectNetworkLog(log, common, networkFilter(target));
11562
+ }
11325
11563
  async function summarize(request) {
11326
11564
  const parsed = await parseTrace(request);
11327
11565
  const logs = summarizeExecutionLogs(request.artifacts.logs);
11328
11566
  const traceStatus = parsed?.status ?? request.artifacts.trace.status;
11567
+ const networkLog = parsed && "trace" in parsed ? undefined : parseNetworkLogArtifact(request);
11329
11568
  const emptyCoverage = {
11330
11569
  incomplete: false,
11331
11570
  malformed: 0,
@@ -11333,15 +11572,22 @@ async function summarize(request) {
11333
11572
  total: 0,
11334
11573
  truncated: false
11335
11574
  };
11575
+ const networkLogStatus = request.artifacts.networkLog?.status;
11576
+ const unread = !["not-captured", "not-found", undefined].includes(networkLogStatus);
11577
+ const unreadLogCoverage = { ...emptyCoverage, incomplete: unread };
11336
11578
  const traceEvidence = parsed && "trace" in parsed ? await summarizeAttemptTrace(parsed.trace, request.attempt.error) : {
11337
11579
  actions: { coverage: emptyCoverage, items: [] },
11338
11580
  browserConsole: { coverage: emptyCoverage, items: [] },
11339
11581
  failedBrowserActionAttribution: "none",
11340
- networkErrors: { coverage: emptyCoverage, items: [] }
11582
+ networkErrors: networkLog ? summarizeNetworkLogErrors(networkLog) : { coverage: unreadLogCoverage, items: [] }
11341
11583
  };
11342
11584
  return {
11343
11585
  ...traceEvidence,
11344
- artifactStates: { executionLog: logs.artifactState, trace: traceStatus },
11586
+ artifactStates: {
11587
+ executionLog: logs.artifactState,
11588
+ ...networkLogStatus && { networkLog: networkLogStatus },
11589
+ trace: traceStatus
11590
+ },
11345
11591
  importantExecutionLogs: logs.evidence,
11346
11592
  traceStatus
11347
11593
  };
@@ -11351,8 +11597,12 @@ async function inspect(request) {
11351
11597
  if (target.type === "log")
11352
11598
  return inspectExecutionLogs(request);
11353
11599
  const parsed = await parseTrace(request);
11354
- if (!parsed || !("trace" in parsed))
11600
+ if (!parsed || !("trace" in parsed)) {
11601
+ const networkLog = parseNetworkLogArtifact(request);
11602
+ if (networkLog && (target.type === "network" || target.type === "request"))
11603
+ return inspectFromNetworkLog(request, networkLog);
11355
11604
  return traceUnavailable(request, parsed?.status ?? request.artifacts.trace.status);
11605
+ }
11356
11606
  const common = {
11357
11607
  attemptId: request.attempt.attemptId,
11358
11608
  flowId: request.flowId,
@@ -11371,21 +11621,7 @@ async function inspect(request) {
11371
11621
  type: target.type
11372
11622
  });
11373
11623
  case "network":
11374
- return inspectNetwork(parsed.trace, common, {
11375
- ...target.endTimeMilliseconds !== undefined && {
11376
- endTimeMilliseconds: target.endTimeMilliseconds
11377
- },
11378
- limit: target.limit,
11379
- ...target.method !== undefined && { method: target.method },
11380
- ...target.startTimeMilliseconds !== undefined && {
11381
- startTimeMilliseconds: target.startTimeMilliseconds
11382
- },
11383
- ...target.status !== undefined && { status: target.status },
11384
- type: target.type,
11385
- ...target.urlContains !== undefined && {
11386
- urlContains: target.urlContains
11387
- }
11388
- });
11624
+ return inspectNetwork(parsed.trace, common, networkFilter(target));
11389
11625
  case "request":
11390
11626
  return inspectRequest(parsed.trace, common, {
11391
11627
  requestId: target.requestId,
@@ -11444,4 +11680,4 @@ export {
11444
11680
  investigate
11445
11681
  };
11446
11682
 
11447
- //# debugId=9520A9B8E033746964756E2164756E21
11683
+ //# debugId=6DE199B89352CE8164756E2164756E21
@@ -10135,7 +10135,9 @@ var makeTriggerResourceSchema = (ids) => resource({
10135
10135
  pausedAt: exports_iso.datetime().optional().describe("When it was paused."),
10136
10136
  pausedReason: triggerPausedReasonSchema.optional().catch(undefined),
10137
10137
  updatedAt: exports_iso.datetime()
10138
- }, { urlFieldDescription: "Absolute URL of the team's triggers page." });
10138
+ }, {
10139
+ urlFieldDescription: "Absolute URL of this trigger's page in QA Wolf: its loop page where the team has Loops, otherwise the team's triggers page."
10140
+ });
10139
10141
 
10140
10142
  // node_modules/@qawolf/api-contracts/dist/v1/trigger/create.js
10141
10143
  var makeCreateTriggerContract = (ids) => {
@@ -10416,6 +10418,57 @@ var makeTriggerContracts = (ids) => ({
10416
10418
  runNow: makeRunTriggerNowContract(ids),
10417
10419
  update: makeUpdateTriggerContract(ids)
10418
10420
  });
10421
+ // node_modules/@qawolf/api-contracts/dist/v1/slack/post.js
10422
+ var loopSlackPostsPerSession = 5;
10423
+ var makeSlackPostContract = () => {
10424
+ const input = object({
10425
+ channelId: string2().regex(/^[CG][A-Z0-9]+$/, "channelId must be a Slack channel ID").describe("The ID of one of the workspace's own Slack channels, such as C0123ABCD. The QA Wolf agent must be in the channel."),
10426
+ newId: string2().trim().min(1).max(100).describe("Any string that is new for each message. Repeating a call with the same newId posts the message once."),
10427
+ text: string2().trim().min(1).max(4000).describe("The message, in Slack mrkdwn. QA Wolf removes @channel, @here, @everyone and user group mentions, and does not turn names into mentions."),
10428
+ threadTs: string2().regex(/^\d+\.\d+$/, "threadTs must be a Slack message timestamp").optional().describe("The timestamp of a message in the channel, such as 1792000776.456809, to reply in its thread. Omit it to post a new message in the channel.")
10429
+ });
10430
+ const refusal = (outcome) => object({
10431
+ message: string2().describe("Why QA Wolf did not post the message."),
10432
+ outcome: literal(outcome)
10433
+ });
10434
+ const output = discriminatedUnion("outcome", [
10435
+ object({
10436
+ channelId: string2().describe("The channel the message went to."),
10437
+ messageTs: string2().describe("The Slack timestamp of the message."),
10438
+ outcome: literal("posted"),
10439
+ permalink: string2().describe("The link to the message in Slack."),
10440
+ threadTs: string2().optional().describe("The timestamp of the message whose thread the reply went to. Absent for a new message in the channel.")
10441
+ }),
10442
+ refusal("not-a-loop-session"),
10443
+ refusal("loop-deleted"),
10444
+ refusal("channel-not-allowed"),
10445
+ refusal("agent-not-in-channel"),
10446
+ refusal("rate-limited")
10447
+ ]);
10448
+ return {
10449
+ annotationJustifications: {
10450
+ destructiveHint: "Posts a new message and never edits or deletes one.",
10451
+ openWorldHint: "Posts in the workspace's Slack channel.",
10452
+ readOnlyHint: "Posts a message in Slack."
10453
+ },
10454
+ annotations: {
10455
+ destructiveHint: false,
10456
+ openWorldHint: true,
10457
+ readOnlyHint: false
10458
+ },
10459
+ description: "Post a message, or a reply in a message's thread, in one of the workspace's own Slack channels, as the QA Wolf agent. " + `Only a QA Wolf session that a loop started can call it, at most ${loopSlackPostsPerSession} times per session. ` + "posted: the message is in Slack, at permalink. not-a-loop-session, loop-deleted, channel-not-allowed, agent-not-in-channel and rate-limited: QA Wolf posted nothing, and message says why.",
10460
+ input,
10461
+ kind: "write",
10462
+ name: "slack.post",
10463
+ output
10464
+ };
10465
+ };
10466
+
10467
+ // node_modules/@qawolf/api-contracts/dist/v1/slack/index.js
10468
+ var makeSlackContracts = () => ({
10469
+ post: makeSlackPostContract()
10470
+ });
10471
+
10419
10472
  // node_modules/@qawolf/api-contracts/dist/v1/agent/get.js
10420
10473
  var makeAgentGetContract = (ids) => {
10421
10474
  const input = object({
@@ -12049,11 +12102,23 @@ var makeGetIssueContract = (ids) => {
12049
12102
  };
12050
12103
  };
12051
12104
 
12052
- // node_modules/@qawolf/api-contracts/dist/v1/investigation/finding.js
12053
- var investigationFindingStateDescription = 'What the investigation concluded about the cause. Known values: "investigating", "fixed", "fix-proposed", "reported", "report-proposed", "flake", "question", "dismissed" and "superseded". "superseded" means a newer run replaced this run before the investigation concluded. New values can appear.';
12105
+ // node_modules/@qawolf/api-contracts/dist/v1/investigation/offeredQuestion.js
12054
12106
  var investigationQuestionSchema = object({
12055
12107
  answers: array(object({
12056
12108
  description: string2().optional(),
12109
+ label: string2().optional().describe("The behavior the answer accepts, in a few words, when the investigator named it."),
12110
+ picture: object({
12111
+ attemptId: string2().optional().describe("The run attempt the picture shows, when known."),
12112
+ caption: string2().optional(),
12113
+ crop: object({
12114
+ height: number2(),
12115
+ left: number2(),
12116
+ top: number2(),
12117
+ width: number2()
12118
+ }).optional().describe("The area of the full image the picture was cut to, as fractions of its width and height from its top left corner."),
12119
+ originalUrl: string2().optional().describe("A signed URL of the full image a cropped picture was cut from. It expires; read the finding again for a fresh one."),
12120
+ url: string2().describe("A signed URL of the picture of the behavior the answer accepts. It expires; read the finding again for a fresh one.")
12121
+ }).optional().describe("A picture of the behavior the answer accepts, when the investigator attached one."),
12057
12122
  title: string2(),
12058
12123
  value: string2().describe('What choosing this answer means. Known values: "apply", "dismiss", "report", "maintenance", "bug" and "baseline". New values can appear.')
12059
12124
  })),
@@ -12061,6 +12126,9 @@ var investigationQuestionSchema = object({
12061
12126
  comparisonId: string2().optional().describe('The failed screenshot comparison a screenshot question is about, as `run listScreenshotComparisons` names it. Its answers are "bug" (keep the baseline), "maintenance" (allow both) and "baseline" (use the new screenshot).'),
12062
12127
  text: string2()
12063
12128
  });
12129
+
12130
+ // node_modules/@qawolf/api-contracts/dist/v1/investigation/finding.js
12131
+ var investigationFindingStateDescription = 'What the investigation concluded about the cause. Known values: "investigating", "fixed", "fix-proposed", "reported", "report-proposed", "flake", "question", "dismissed" and "superseded". "superseded" means a newer run replaced this run before the investigation concluded. New values can appear.';
12064
12132
  var makeInvestigationFindingSchema = (ids) => object({
12065
12133
  actual: string2().optional(),
12066
12134
  commitHash: string2().optional().describe("The commit of a commit fix. Same as `fix.commitHash`."),
@@ -12536,7 +12604,7 @@ var makeMarkFixReadyForReviewContract = (ids) => {
12536
12604
  id: string2().describe("The fix's ID."),
12537
12605
  pullRequestUrl: url().describe("The fix's pull request, which is now ready for review.")
12538
12606
  }),
12539
- outcome: _enum(["marked-ready", "already-ready"]).describe("marked-ready: this call marked the draft pull request ready for review. already-ready: the pull request was already ready for review.")
12607
+ outcome: _enum(["marked-ready", "already-ready"]).describe("marked-ready: this call marked a draft pull request ready for review. already-ready: the pull request was already ready for review.")
12540
12608
  });
12541
12609
  return {
12542
12610
  annotationJustifications: {
@@ -12549,7 +12617,7 @@ var makeMarkFixReadyForReviewContract = (ids) => {
12549
12617
  openWorldHint: true,
12550
12618
  readOnlyHint: false
12551
12619
  },
12552
- description: "Mark the draft pull request of the bug's fix ready for review, so the code host asks its code owners. " + "The pull request stays a draft unless a loop's instructions ask for this. " + "Only a QA Wolf session that a loop started can call it. " + "Refused as no-fix-pull-request when the bug's fix has no open pull request.",
12620
+ description: "Mark the pull request of the bug's fix ready for review, so the code host asks its code owners. " + "QA Wolf opens its own pull request ready for review. This changes a draft that the team's agent opened, or one that a person converted to a draft. " + "Only a QA Wolf session that a loop started can call it. " + "Refused as no-fix-pull-request when the bug's fix has no open pull request.",
12553
12621
  input,
12554
12622
  kind: "write",
12555
12623
  name: "issue.markFixReadyForReview",
@@ -12648,7 +12716,7 @@ var makeRetryFixForIssueContract = (ids) => {
12648
12716
  openWorldHint: true,
12649
12717
  readOnlyHint: false
12650
12718
  },
12651
- description: "Ask the team's coding agent for one more try at a bug that the check of its fix still shows. " + "QA Wolf sends the same agent the failure of the check's run, as a new fix on the same branch, and checks again. " + "Only a QA Wolf session that a loop started can call it, when the loop's instructions ask for it. " + "A bug gets one extra try at most. " + "Refused as bug-not-still-showing when the check of the bug's fix does not show the bug, and as no-tries-left after the extra try.",
12719
+ description: "Ask the team's coding agent for one more try at a bug that the check of its fix still shows. " + "QA Wolf sends the same agent the failure of the check's run, as a new fix on a new branch, and checks again. " + "Only a QA Wolf session that a loop started can call it, when the loop's instructions ask for it. " + "A bug gets one extra try at most. " + "Refused as bug-not-still-showing when the check of the bug's fix does not show the bug, and as no-tries-left after the extra try.",
12652
12720
  input,
12653
12721
  kind: "write",
12654
12722
  name: "issue.retryFix",
@@ -13692,7 +13760,8 @@ var makeRunFlowOnRunnerContract = (ids) => {
13692
13760
  files: runFilesSchema.describe("Every file the run needs keyed by its path — the flow file, everything it imports, package.json and tsconfig.json. A runner holds no copy of your project, so what runs is exactly what is sent here."),
13693
13761
  flowId: ids.flow.optional().describe("The QA Wolf flow this run is for. The run then sees it as `QAWOLF_WORKFLOW_ID`, the same value a platform run of that flow sees, so fixtures named and cleaned up by it match across both. Omitted, the flow whose file is at `entryPointPath` on the named environment's flow-code branch stands in; a file not in QA Wolf yet, or a run given no environment, leaves the run with no `QAWOLF_WORKFLOW_ID`."),
13694
13762
  id: runnerIdSchema.describe("Id of the runner to run the flow on."),
13695
- selection: runSelectionSchema.optional().describe("Run only these lines, inside the page the runner is already on, instead of running the whole flow from a fresh browser. Omit to run the whole entry point."),
13763
+ selection: runSelectionSchema.optional().describe("Run only these lines, inside the page the runner is already on, instead of running the whole flow from a fresh browser. A different listed target than the last run's starts a fresh browser first, so the lines lose that page and its sign-in. Omit to run the whole entry point."),
13764
+ target: string2().min(1).max(200).optional().describe('The one target to run, for a flow file that lists several, named as the file lists it, such as "macOS - Any Mac (macOS 26)". Omitted, the run takes the first listed target the runner can run. A target the file does not list is refused, and a target the runner cannot run fails with `runner-target-mismatch`.'),
13696
13765
  unchangedFiles: unchangedFilesSchema.optional().describe("Files this runner already holds from an earlier run, keyed by path with a hex SHA-256 of the content it should hold. Send this to make `files` only what changed. The runner refuses with `needs-full-sync` if it holds none of a referenced path, so it never runs something other than what was asked for. Omit it to send every file."),
13697
13766
  workspaceId: ids.workspace.optional().describe(runnerWorkspaceIdDescription)
13698
13767
  }).refine((request) => Object.hasOwn(request.files, request.entryPointPath), {
@@ -13727,7 +13796,7 @@ var makeRunFlowOnRunnerContract = (ids) => {
13727
13796
  ]);
13728
13797
  const output = discriminatedUnion("outcome", [
13729
13798
  object({
13730
- bootstrappedRunner: boolean2().optional().describe("True when the runner had no live browser and one was started before the run, so a `selection` ran against a fresh page rather than the one an earlier run left. Absent means the runner was already warm. Only a request carrying `selection` can bootstrap, because a whole run starts its own browser either way."),
13799
+ bootstrappedRunner: boolean2().optional().describe("True when the runner had no live browser, or its browser was for a different listed target, and a fresh one was started before the run, so a `selection` ran against a fresh page rather than the one an earlier run left. Absent means the runner was already warm. Only a request carrying `selection` can bootstrap, because a whole run starts its own browser either way."),
13731
13800
  outcome: literal("success"),
13732
13801
  runId: string2().describe("Id of the run, to follow it by. Read the `run-status` stream of the runner's journal for its outcome, and `run-logs` and `run-events` for its output.")
13733
13802
  }),
@@ -13744,7 +13813,7 @@ var makeRunFlowOnRunnerContract = (ids) => {
13744
13813
  openWorldHint: true,
13745
13814
  readOnlyHint: false
13746
13815
  },
13747
- description: "Run a flow on an interactive runner. When `selection` is given the lines run against the browser as it stands, so nothing is re-navigated and nothing is signed in again; without it the whole entry point runs from a fresh browser. A runner with no live browser starts one before a selection and says so with `bootstrappedRunner`, which means those lines ran against a fresh page rather than the one an earlier run left. A selection produces no `runStarted` event, so follow it by its run id on `run-status` like any other run. Send `unchangedFiles` to ship only what changed since an earlier run on this runner; a `needs-full-sync` failure names the paths it does not hold, and the way to recover is the same run again with every file in `files`. Answers as soon as the run is accepted, with the id to follow it by — nothing waits for the run to finish. Which browser or device the run needs is read from the flow file's own execution target, so it is not supplied here; when it does not match what the runner is, the call fails with `runner-target-mismatch` rather than failing partway through the run. `runner-unreachable` means the answer did not arrive, which is NOT the same as the run not having started: the runner may have accepted it and been too slow to say so, and resubmitting would start a second run that is billed and journalled alongside the first. Read the runner's `run-status` journal stream before resubmitting, and use the newest run id there if one appeared.",
13816
+ description: "Run a flow on an interactive runner. When `selection` is given the lines run against the browser as it stands, so nothing is re-navigated and nothing is signed in again; without it the whole entry point runs from a fresh browser. A runner with no live browser, or one whose browser is for a different listed target, starts a fresh one before a selection and says so with `bootstrappedRunner`, which means those lines ran against a fresh page rather than the one an earlier run left. A selection produces no `runStarted` event, so follow it by its run id on `run-status` like any other run. Send `unchangedFiles` to ship only what changed since an earlier run on this runner; a `needs-full-sync` failure names the paths it does not hold, and the way to recover is the same run again with every file in `files`. Answers as soon as the run is accepted, with the id to follow it by — nothing waits for the run to finish. Which browser or device the run needs is read from the flow file's own execution target; for a file that lists several, `target` picks one. When it does not match what the runner is, the call fails with `runner-target-mismatch` rather than failing partway through the run. `runner-unreachable` means the answer did not arrive, which is NOT the same as the run not having started: the runner may have accepted it and been too slow to say so, and resubmitting would start a second run that is billed and journalled alongside the first. Read the runner's `run-status` journal stream before resubmitting, and use the newest run id there if one appeared.",
13748
13817
  input,
13749
13818
  kind: "write",
13750
13819
  name: "runner.runFlow",
@@ -14110,6 +14179,7 @@ var makeUsageBreakdownContract = (ids) => {
14110
14179
  workspaces: labels
14111
14180
  }),
14112
14181
  others: totals.optional().describe("The rows after limit, added up. Absent when none was left out."),
14182
+ qaWolfStaff: totals.optional().describe("For QA Wolf staff only: the runs and session time of QA Wolf staff in the same range and workspaces, added up. The customer is not billed for them, so rows, others and totals leave them out. Absent for everyone else."),
14113
14183
  rows: array(totals.extend({ group })).describe("Most credits first."),
14114
14184
  totals: totals.describe("All usage of the range. sessionCredits here are whole credits, counted for each UTC month and platform, so the rows can add up to a little less.")
14115
14185
  });
@@ -14212,6 +14282,7 @@ var makeContractsV1 = (ids) => {
14212
14282
  },
14213
14283
  runner: makeRunnerContracts(resolvedIds),
14214
14284
  skill: makeSkillContracts(),
14285
+ slack: makeSlackContracts(),
14215
14286
  suggestion: makeSuggestionContracts(resolvedIds),
14216
14287
  tag: makeTagContracts(resolvedIds),
14217
14288
  trigger: makeTriggerContracts(resolvedIds),
@@ -18787,6 +18858,7 @@ async function sendRunFlowRequest(ctx, options, delta) {
18787
18858
  ...options.environment === undefined ? {} : { env: options.environment },
18788
18859
  ...options.environmentId === undefined ? {} : { environmentId: options.environmentId },
18789
18860
  ...options.selection === undefined ? {} : { selection: options.selection },
18861
+ ...options.target === undefined ? {} : { target: options.target },
18790
18862
  ...delta.unchangedFiles === undefined ? {} : { unchangedFiles: delta.unchangedFiles }
18791
18863
  }, runnerCallOptions);
18792
18864
  if (!result.ok) {
@@ -18917,7 +18989,8 @@ function createRunVerbs({ deps, platformClient }) {
18917
18989
  environmentId: prepared.environmentId,
18918
18990
  files: prepared.files,
18919
18991
  resolved: { ...givenRunner(runnerId), type: "resolved" },
18920
- selection: prepared.selection
18992
+ selection: prepared.selection,
18993
+ target: undefined
18921
18994
  }, deps);
18922
18995
  if (!submitted.ok)
18923
18996
  return toSdkFailure(submitted);
@@ -19002,4 +19075,4 @@ export {
19002
19075
  createRunnerSdk
19003
19076
  };
19004
19077
 
19005
- //# debugId=A4292F6B29FCE6D964756E2164756E21
19078
+ //# debugId=E56DCFBAB344A62D64756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qawolf/cli",
3
- "version": "2.15.0",
3
+ "version": "2.17.0",
4
4
  "description": "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
5
5
  "keywords": [
6
6
  "automation",
@@ -72,7 +72,7 @@
72
72
  "@clack/prompts": "1.5.1",
73
73
  "@napi-rs/keyring": "1.3.0",
74
74
  "@oxc-node/core": "0.1.0",
75
- "@qawolf/api-contracts": "0.144.0",
75
+ "@qawolf/api-contracts": "0.147.0",
76
76
  "@qawolf/emails": "1.1.1",
77
77
  "@qawolf/flow-targets": "2.0.0",
78
78
  "commander": "14.0.3",
@@ -200,10 +200,10 @@ that `url`; never guess a route and never send a repository link in its place.
200
200
  | `qawolf issue get` | read | Get an issue by id. |
201
201
  | `qawolf issue listActivity` | read | List an issue's activity, oldest first: creation, status and priority changes, and the flows that started or stopped reproducing it. Use it to measure time to fix or to find issues that came back. |
202
202
  | `qawolf issue listComments` | read | List the comments on a bug report, blocker (issue type `maintenance`), or coverage request, oldest first, with who wrote each one. |
203
- | `qawolf issue markFixReadyForReview` | write | Mark the draft pull request of the bug's fix ready for review, so the code host asks its code owners. The pull request stays a draft unless a loop's instructions ask for this. Only a QA Wolf session that a loop started can call it. Refused as no-fix-pull-request when the bug's fix has no open pull request. |
203
+ | `qawolf issue markFixReadyForReview` | write | Mark the pull request of the bug's fix ready for review, so the code host asks its code owners. QA Wolf opens its own pull request ready for review. This changes a draft that the team's agent opened, or one that a person converted to a draft. Only a QA Wolf session that a loop started can call it. Refused as no-fix-pull-request when the bug's fix has no open pull request. |
204
204
  | `qawolf issue removeFlows` | write | Remove flows from a coverage request or remove bug report or blocker reproductions in an environment. Unlinked flows are left alone. Reports auto-close when no active reproductions remain and auto-close is enabled. For reports, omit environmentId only when each selected flow is linked in at most one environment. |
205
205
  | `qawolf issue requestFix` | write | Hand a bug report to the team's own coding agent, which fixes it in the team's CI. Only a QA Wolf session that a loop started can call it, when the loop's instructions use /coding-agent. A bug has one open fix: a second request returns that fix. |
206
- | `qawolf issue retryFix` | write | Ask the team's coding agent for one more try at a bug that the check of its fix still shows. QA Wolf sends the same agent the failure of the check's run, as a new fix on the same branch, and checks again. Only a QA Wolf session that a loop started can call it, when the loop's instructions ask for it. A bug gets one extra try at most. Refused as bug-not-still-showing when the check of the bug's fix does not show the bug, and as no-tries-left after the extra try. |
206
+ | `qawolf issue retryFix` | write | Ask the team's coding agent for one more try at a bug that the check of its fix still shows. QA Wolf sends the same agent the failure of the check's run, as a new fix on a new branch, and checks again. Only a QA Wolf session that a loop started can call it, when the loop's instructions ask for it. A bug gets one extra try at most. Refused as bug-not-still-showing when the check of the bug's fix does not show the bug, and as no-tries-left after the extra try. |
207
207
  | `qawolf issue update` | write | Update an issue owned by the caller's team. Omitted fields remain unchanged. |
208
208
  | `qawolf legacyTrigger find` | read | List a workspace's legacy per-environment triggers; trigger.find lists the current ones. For migration only; it goes when legacy triggers go. adaptiveFlowSelection becomes a generativeSuite action, which takes no tags. |
209
209
  | `qawolf legacyTrigger pause` | write | Pause one legacy trigger, the older per-environment kind, so it stops firing; use trigger.pause for a current one. Its copies in pull request environments pause too. For migration only; it goes when legacy triggers go. |
@@ -254,6 +254,7 @@ that `url`; never guess a route and never send a repository link in its place.
254
254
  | `qawolf runner terminate` | write | End an interactive runner, and the pod it runs on with it |
255
255
  | `qawolf skill get` | read | Read a QA Wolf skill: the instructions a coding agent follows for one kind of QA Wolf work. The reply carries the skill's SKILL.md and every file under its references directory, so nothing else has to be fetched for it. Read the skill before starting the work it covers and follow it. A link in the reply of the form ../<skill>/SKILL.md names another skill, which this call reads by that name. |
256
256
  | `qawolf skill list` | read | List the QA Wolf skills, each with its name and the description that says when to use it. A skill is the instructions a coding agent follows for one kind of QA Wolf work, such as onboarding an application, creating a flow, repairing a failing flow, or setting up triggers. Call this before any QA Wolf work, pick the skill whose description matches the request, and read it with skill.get. |
257
+ | `qawolf slack post` | write | Post a message, or a reply in a message's thread, in one of the workspace's own Slack channels, as the QA Wolf agent. Only a QA Wolf session that a loop started can call it, at most 5 times per session. posted: the message is in Slack, at permalink. not-a-loop-session, loop-deleted, channel-not-allowed, agent-not-in-channel and rate-limited: QA Wolf posted nothing, and message says why. |
257
258
  | `qawolf suggestion decide` | write | Decide a coverage suggestion QA Wolf made while exploring an environment, as the signed-in person. Add turns on the suggested flow in the environment. Report files the potential bug. Skip declines the suggestion and needs a skipReason. Undo takes back a decision. Activate retries a held suggestion. Only the decisions suggestion.get lists take effect. Use this, not issue.update, to accept or skip a suggestion. |
258
259
  | `qawolf suggestion find` | read | List the coverage QA Wolf suggested for a workspace, newest first: flows it wrote for missing coverage and potential bugs it found while exploring an environment. Use this, not issue.find, for QA Wolf's suggestions, such as the ones a new suggestions notification points to. Filter by state waiting to find the ones that need a decision. |
259
260
  | `qawolf suggestion get` | read | Read one coverage suggestion QA Wolf made while exploring an environment: its state, the flow it proposes, the bug report or coverage request behind it, and the decisions it takes now. Use this, not issue.get, for a suggestion id. A suggestion QA Wolf withdrew reads as not found. |
@@ -383,6 +383,9 @@ Options:
383
383
  instead of the whole flow from a fresh one
384
384
  --lines-file <path> File the --lines range lives in. Defaults to <flowFile>; pass it
385
385
  only when the lines are in another file, such as a page object
386
+ --target <preset> For a flow file that lists several targets, the one to run, as the
387
+ file lists it. Defaults to the first listed target the runner can
388
+ run. Launch a runner of that target's OS first
386
389
  --runner <id> Runner to target. Defaults to QAWOLF_RUNNER_ID, then this
387
390
  directory's stored runner
388
391
  --timeout <seconds> Give up following after this long. Following keeps the runner
@@ -407,6 +410,7 @@ Examples:
407
410
  $ qawolf runner run flows/checkout.flow.ts --env-id staging
408
411
  $ qawolf runner run flows/checkout.flow.ts --env-var RUN_INPUT_PATH=uploads/app.apk
409
412
  $ qawolf runner run flows/checkout.flow.ts --builds <buildId> <buildId>
413
+ $ qawolf runner run flows/login.flow.ts --target "macOS - Any Mac (macOS 26)"
410
414
 
411
415
  What travels:
412
416
  run ships the flow file, everything it imports, and your package.json and
@@ -495,6 +499,17 @@ Running part of a flow:
495
499
  one an earlier run left, which is worth reading before you act on what you
496
500
  see.
497
501
 
502
+ A flow file with several targets:
503
+ A flow file can list several targets, such as `target: ["macOS - Any Mac
504
+ (Latest)", "Windows 11 - Desktop"]`. Each target is its own flow, named
505
+ `<name> · <target>`, and `qawolf flows list` shows one row per target.
506
+
507
+ run takes the first listed target the runner can run. To run another one, pass
508
+ --target with its name as the file lists it, on a runner of that target's OS:
509
+ `--target "Windows 11 - Desktop"` on a Windows runner. A name the file does
510
+ not list is refused, and a runner of another OS fails with a runner-target
511
+ mismatch.
512
+
498
513
  Environment variables:
499
514
  A run's variables come from up to three places, each on top of the one before:
500
515
  - --env-id names a QA Wolf environment by id or alias, the same reference