@qawolf/cli 1.41.0 → 1.43.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/dist/cli.js CHANGED
@@ -8402,11 +8402,15 @@ var sessionGivenTwice = (argument, flag) => `Two different sessions were named:
8402
8402
  var agentMessages = {
8403
8403
  answerCancelled: "No answer sent, so QA Wolf is still waiting on one. The session keeps its place: answer it whenever you like.",
8404
8404
  answerPrompt: "Your answer",
8405
+ conflictingSessionList: "Pass --sessions alone, without --session or a session argument.",
8406
+ emptySessionList: "Pass at least one session id with --sessions.",
8407
+ sessionListNeedsFollow: "Pass --follow when using --sessions.",
8405
8408
  answerSendFailed: (reason) => `The answer could not be sent: ${reason}. The session is still waiting, so try again.`,
8406
8409
  blocked: (sessionId) => `QA Wolf asked a question and cannot continue until it is answered. Answer it with qawolf agent send "<your answer>" --session ${sessionId}.`,
8407
8410
  detachHint: "Press Ctrl-C to stop following. The session keeps running in the background.",
8408
8411
  detached: (sessionId) => `Stopped following. The session is still running — pick it back up with ${followAgain(sessionId)}.`,
8409
8412
  followTimedOut: (sessionId, seconds) => `Stopped following after ${formatSeconds(seconds * 1000)}. The session may still be going: pick it back up with ${followAgain(sessionId)}, or pass --timeout to wait longer.`,
8413
+ followSessionsTimedOut: (options) => `Stopped following ${options.sessionIds.length} sessions after ${formatSeconds(options.seconds * 1000)}. No session completed or asked a question. Continue with qawolf agent get --sessions ${options.sessionIds.join(" ")} --follow, or pass --timeout to wait longer.`,
8410
8414
  noSession: "No session named. Pass --session, set QAWOLF_SESSION_ID, or start one with qawolf agent send.",
8411
8415
  sessionNotRemembered: (sessionId) => `The session id could not be saved to .qawolf/agent.json, so pass --session ${sessionId} to pick it up later.`,
8412
8416
  sessionCancelled: (url) => `The session was cancelled before it finished. Read how far it got at ${url}.`,
@@ -16604,6 +16608,146 @@ async function downloadBundle(signedUrl, deps) {
16604
16608
  return { ok: true, value: { tmpArchive } };
16605
16609
  }
16606
16610
 
16611
+ // node_modules/@qawolf/api-contracts/dist/v1/pagination.js
16612
+ var makePaginationInputFields = (limits) => ({
16613
+ cursor: string2().min(1).optional().describe("Opaque cursor copied from the previous response's nextCursor. Omit to fetch the first page."),
16614
+ limit: number2().int().min(1).max(limits.maxLimit).default(limits.defaultLimit).describe(`Maximum rows per page. Defaults to ${limits.defaultLimit}, capped at ${limits.maxLimit}.`)
16615
+ });
16616
+ var nextCursorSchema = string2().min(1).optional().describe("Repeat the request with this value as cursor to fetch the next page. Absent when there are no further results.");
16617
+
16618
+ // node_modules/@qawolf/api-contracts/dist/v1/resource.js
16619
+ function resource(fields, { urlFieldDescription = "Absolute URL." } = {}) {
16620
+ return object({
16621
+ ...fields,
16622
+ url: url().describe(urlFieldDescription)
16623
+ });
16624
+ }
16625
+
16626
+ // node_modules/@qawolf/api-contracts/dist/v1/promotion/resource.js
16627
+ var promotionStatusSchema = _enum([
16628
+ "pending",
16629
+ "conflicted",
16630
+ "resolving",
16631
+ "promoted",
16632
+ "no-changes",
16633
+ "abandoned"
16634
+ ]).describe("pending (requested, the merge has not run yet), conflicted (the head's flow changes clash with the base and await a resolution), resolving (a submitted resolution is being applied), promoted (merged into the base and the head environment terminated), no-changes (the head had nothing to promote and was terminated), abandoned (the head environment was terminated before the promotion settled).");
16635
+ var conflictSchema = object({
16636
+ paths: array(string2()).describe("Every path that conflicts between the head and the base. A resolution must cover exactly these paths."),
16637
+ sourceCommitHash: string2().describe("The head environment's flow code commit the conflict was computed against."),
16638
+ targetCommitHash: string2().describe("The base environment's flow code commit the conflict was computed against.")
16639
+ });
16640
+ var makePromotionResourceSchema = (ids) => resource({
16641
+ aiTaskId: ids.aiTask.optional().describe("The AI task dispatched to resolve this promotion's conflicts. Absent until the agent is dispatched. A promotion that stays conflicted after this is set means the agent could not resolve it."),
16642
+ baseEnvironmentId: ids.environment.describe("The environment the flow changes promote into."),
16643
+ conflict: conflictSchema.optional().describe("The conflict awaiting resolution. Present while status is conflicted or resolving. A resolution must name both commit hashes and cover exactly these paths; if either branch moves, the conflict is recomputed and this changes."),
16644
+ createdAt: exports_iso.datetime().describe("When the promotion was requested."),
16645
+ headEnvironmentId: ids.environment.describe("The environment whose flow changes are promoted."),
16646
+ id: ids.promotion,
16647
+ promotedCommitHash: string2().optional().describe("The commit the promotion landed on the base environment's flow code branch. Present when status is promoted."),
16648
+ settledAt: exports_iso.datetime().optional().describe("When the promotion reached promoted, no-changes or abandoned. Absent while it is open."),
16649
+ status: promotionStatusSchema
16650
+ }, { urlFieldDescription: "Absolute URL of the head environment's page." });
16651
+
16652
+ // node_modules/@qawolf/api-contracts/dist/v1/promotion/find.js
16653
+ var makeFindPromotionsContract = (ids) => {
16654
+ const input = object({
16655
+ environmentId: ids.environmentRef.optional().describe("Only list promotions out of this head environment, by id or alias. Omit to list the whole workspace's promotions."),
16656
+ status: promotionStatusSchema.optional().describe("Only list promotions in this status. Use conflicted to see the promotions that need attention."),
16657
+ workspaceId: ids.workspace.optional().describe("The workspace to list promotions from, which an environment alias resolves in. Required when authenticating with an organization or user API key."),
16658
+ ...makePaginationInputFields({ defaultLimit: 20, maxLimit: 100 })
16659
+ });
16660
+ const output = object({
16661
+ nextCursor: nextCursorSchema,
16662
+ promotions: array(makePromotionResourceSchema(ids)).describe("The workspace's promotions, newest first.")
16663
+ });
16664
+ return {
16665
+ annotationJustifications: {
16666
+ destructiveHint: "Does not change promotions, environments or flow code branches.",
16667
+ openWorldHint: "Reads private QA Wolf promotion records without changing external systems.",
16668
+ readOnlyHint: "Lists promotions in the authorized workspace without changing them."
16669
+ },
16670
+ annotations: {
16671
+ destructiveHint: false,
16672
+ openWorldHint: false,
16673
+ readOnlyHint: true
16674
+ },
16675
+ description: "List environment promotions, newest first. A promotion moves the flow changes made in a head environment into its base environment. Filter by status conflicted to find the promotions whose conflicts still need a resolution.",
16676
+ input,
16677
+ kind: "read",
16678
+ name: "promotion.find",
16679
+ output
16680
+ };
16681
+ };
16682
+
16683
+ // node_modules/@qawolf/api-contracts/dist/v1/promotion/get.js
16684
+ var makeGetPromotionContract = (ids) => {
16685
+ const input = object({ promotionId: ids.promotion });
16686
+ const output = makePromotionResourceSchema(ids);
16687
+ return {
16688
+ annotationJustifications: {
16689
+ destructiveHint: "Does not change the promotion, its environments or flow code branches.",
16690
+ openWorldHint: "Reads a private QA Wolf promotion record without changing external systems.",
16691
+ readOnlyHint: "Retrieves one authorized promotion's status and conflict without changing it."
16692
+ },
16693
+ annotations: {
16694
+ destructiveHint: false,
16695
+ openWorldHint: false,
16696
+ readOnlyHint: true
16697
+ },
16698
+ description: "Read one environment promotion: its status, the conflicting paths and commit hashes while it is conflicted or resolving, the commit it landed when promoted, and the AI task resolving it. Poll it after environment.promote to learn how the promotion settled. It does not serve file contents; a resolver reads both branches from the flow code repository.",
16699
+ input,
16700
+ kind: "read",
16701
+ name: "promotion.get",
16702
+ output
16703
+ };
16704
+ };
16705
+
16706
+ // node_modules/@qawolf/api-contracts/dist/v1/promotion/resolve.js
16707
+ var maxResolvedFileBytes = 1e6;
16708
+ var utf8ByteLength = (content) => new TextEncoder().encode(content).byteLength;
16709
+ var keptFileSizeIssues = (writes) => Object.entries(writes).map(([path, content]) => ({ bytes: utf8ByteLength(content), path })).filter(({ bytes }) => bytes >= maxResolvedFileBytes).map(({ bytes, path }) => ({
16710
+ code: "custom",
16711
+ message: `Each kept file must be under ${maxResolvedFileBytes} bytes of UTF-8; ${path} is ${bytes} bytes.`,
16712
+ path: [path]
16713
+ }));
16714
+ var makeResolvePromotionContract = (ids) => {
16715
+ const input = object({
16716
+ deletes: array(string2().min(1)).optional().describe("Conflicting paths to remove from the base environment. Repeat the flag once per path."),
16717
+ expectedSourceCommitHash: string2().min(1).describe("The head environment's commit the conflict was computed against: conflict.sourceCommitHash from promotion.get. A different current commit means the branch moved and the call is refused."),
16718
+ expectedTargetCommitHash: string2().min(1).describe("The base environment's commit the conflict was computed against: conflict.targetCommitHash from promotion.get. A different current commit means the branch moved and the call is refused."),
16719
+ promotionId: ids.promotion,
16720
+ writes: record(string2().min(1), string2()).superRefine((writes, refinement) => {
16721
+ keptFileSizeIssues(writes).forEach((issue) => refinement.addIssue(issue));
16722
+ }).optional().describe("The resolved full contents of each conflicting path to keep, keyed by path. Repeat the flag once per path as PATH=CONTENT. Each file must be under 1 MB of UTF-8.")
16723
+ });
16724
+ const output = makePromotionResourceSchema(ids);
16725
+ return {
16726
+ annotationJustifications: {
16727
+ destructiveHint: "Lands the resolved files on the base environment's flow code branch and terminates the head environment once they land.",
16728
+ openWorldHint: "Changes QA Wolf flow code branches only, not the customer's own repository or deployments.",
16729
+ readOnlyHint: "Records a resolution that a background executor applies to the base branch."
16730
+ },
16731
+ annotations: {
16732
+ destructiveHint: true,
16733
+ openWorldHint: false,
16734
+ readOnlyHint: false
16735
+ },
16736
+ description: "Submit the resolution of a conflicted promotion: the full resolved contents of every conflicting path to keep, and every conflicting path to delete. Together they must cover exactly the paths in the promotion's conflict, and both commit hashes must match the conflict's; if a branch moved since, the call is refused as stale-conflict and promotion.get has the current conflict. Returns the promotion in resolving; poll promotion.get until it is promoted, or conflicted again if the branches moved while it applied.",
16737
+ input,
16738
+ kind: "write",
16739
+ name: "promotion.resolve",
16740
+ output
16741
+ };
16742
+ };
16743
+
16744
+ // node_modules/@qawolf/api-contracts/dist/v1/promotion/index.js
16745
+ var makePromotionContracts = (ids) => ({
16746
+ find: makeFindPromotionsContract(ids),
16747
+ get: makeGetPromotionContract(ids),
16748
+ resolve: makeResolvePromotionContract(ids)
16749
+ });
16750
+
16607
16751
  // node_modules/@qawolf/api-contracts/dist/v1/agent/status.js
16608
16752
  var agentSessionStatuses = [
16609
16753
  "working",
@@ -16700,14 +16844,6 @@ var didNotRunReasonSchema = _enum([
16700
16844
  ].join(`
16701
16845
  `));
16702
16846
 
16703
- // node_modules/@qawolf/api-contracts/dist/v1/resource.js
16704
- function resource(fields, { urlFieldDescription = "Absolute URL." } = {}) {
16705
- return object({
16706
- ...fields,
16707
- url: url().describe(urlFieldDescription)
16708
- });
16709
- }
16710
-
16711
16847
  // node_modules/@qawolf/api-contracts/dist/v1/email/resource.js
16712
16848
  var emailDirectionSchema = _enum(["inbound", "outbound"]);
16713
16849
  var namedAddressSchema = object({
@@ -17409,9 +17545,9 @@ var readJournalResponseSchema = object({
17409
17545
  var maxRunFilesByteLength = 30 * 1024 * 1024;
17410
17546
  var maxRunnerRequestEncodedByteLength = 30 * 1024 * 1024;
17411
17547
  function runFilesByteLength(files) {
17412
- return Object.entries(files).reduce((total, [path, content]) => total + utf8ByteLength(content) + utf8ByteLength(path), 0);
17548
+ return Object.entries(files).reduce((total, [path, content]) => total + utf8ByteLength2(content) + utf8ByteLength2(path), 0);
17413
17549
  }
17414
- function utf8ByteLength(text) {
17550
+ function utf8ByteLength2(text) {
17415
17551
  return Buffer.byteLength(text, "utf8");
17416
17552
  }
17417
17553
  var runFilesSchema = record(string2(), string2()).superRefine((files, refinementContext) => {
@@ -17828,7 +17964,7 @@ var makeTriggerScheduleFields = (ids) => ({
17828
17964
  var makeTriggerDeploymentFields = (ids) => ({
17829
17965
  action: makeTriggerActionSchema(ids),
17830
17966
  branchPattern: string2().min(1).optional().describe("Only fire for deployments of a branch matching this pattern."),
17831
- deployTargetPattern: string2().min(1).optional().describe("Only fire for deployments whose deploy target matches this pattern. A deploy target is the URL or label the deploy reported, which many deployments do not carry."),
17967
+ deployTargetPattern: string2().min(1).optional().describe("Only fire for deployments whose deploy target matches this pattern. A deploy target is the URL the deploy reported, which many deployments do not carry."),
17832
17968
  environmentIds: array(ids.environment).default([]).describe("Only fire for deployments to these environments. Mutually exclusive with environmentPattern."),
17833
17969
  environmentPattern: string2().min(1).optional().describe("Only fire for deployments to environments matching this pattern. Mutually exclusive with environmentIds."),
17834
17970
  servicePattern: string2().min(1).optional().describe("Only fire for deployments whose service matches this pattern. A deployment that names no service never matches it.")
@@ -18179,7 +18315,7 @@ var makeAgentGetContract = (ids) => {
18179
18315
  const input = object({
18180
18316
  cursor: string2().min(1).optional().describe("Opaque cursor copied from this same session's previous nextCursor. Omit to read from its first reply."),
18181
18317
  sessionId: ids.chatSession.describe("The id agent.send answered with."),
18182
- waitSeconds: number2().int().min(0).optional().describe(`How long the server may hold this check open, in seconds. Omit or pass 0 to answer at once. A larger value clamps to ${maxAgentWaitSeconds}. Check again as soon as a held check returns.`)
18318
+ waitSeconds: number2().int().min(0).optional().describe(`How long the server may hold this check open, in seconds. Defaults to ${maxAgentWaitSeconds}, the longest hold, and a larger value clamps to it. Pass 0 to answer at once. Check again as soon as a held check returns.`)
18183
18319
  });
18184
18320
  const output = resource({
18185
18321
  nextCursor: string2().min(1).describe("Send back as cursor on the next check to read only what follows. Always present, even with no replies. Belongs to this session alone."),
@@ -18371,13 +18507,6 @@ var makeFindCodeHostIntegrationsContract = (ids) => {
18371
18507
  };
18372
18508
  };
18373
18509
 
18374
- // node_modules/@qawolf/api-contracts/dist/v1/pagination.js
18375
- var makePaginationInputFields = (limits) => ({
18376
- cursor: string2().min(1).optional().describe("Opaque cursor copied from the previous response's nextCursor. Omit to fetch the first page."),
18377
- limit: number2().int().min(1).max(limits.maxLimit).default(limits.defaultLimit).describe(`Maximum rows per page. Defaults to ${limits.defaultLimit}, capped at ${limits.maxLimit}.`)
18378
- });
18379
- var nextCursorSchema = string2().min(1).optional().describe("Repeat the request with this value as cursor to fetch the next page. Absent when there are no further results.");
18380
-
18381
18510
  // node_modules/@qawolf/api-contracts/dist/v1/codeHostIntegration/listRepositories.js
18382
18511
  var makeListCodeHostRepositoriesContract = (ids) => {
18383
18512
  const input = object({
@@ -18416,11 +18545,12 @@ var makeDeploymentResourceSchema = (ids) => resource({
18416
18545
  commitSha: string2().optional().describe("The sha of the deployed commit."),
18417
18546
  commitUrl: string2().optional().describe("A link to the deployed commit, as declared by the deployment report."),
18418
18547
  deployedAt: exports_iso.datetime().describe("When QA Wolf first received the deployment."),
18419
- deployTarget: string2().optional().describe("Identifies the deployed app within the environment: the URL it serves, or the build path of a mobile build. A trigger's deployTargetPattern matches against it."),
18548
+ deployTarget: string2().optional().describe("The URL the deployment serves. A trigger's deployTargetPattern matches against it."),
18420
18549
  environmentId: ids.environment.describe("The QA Wolf environment the deployment reported into."),
18421
18550
  environmentName: string2().optional().describe("The environment's name. Absent when the environment has since been deleted."),
18422
18551
  id: ids.deployment,
18423
18552
  provider: _enum(["github", "gitlab", "api"]).optional().describe("How QA Wolf received the deployment: a GitHub webhook, a GitLab webhook, or the deployment.reportStatus API."),
18553
+ repository: string2().optional().describe('The repository the deployment came from, as "owner/name". Absent when neither the code host nor the deployment report named one.'),
18424
18554
  service: string2().optional().describe("Which application was deployed, as the deployer named it. Absent when the deployer named none."),
18425
18555
  status: _enum(["pending", "success", "failure", "inactive"]).optional().describe("The deployment's lifecycle status, in the vocabulary deployment.reportStatus accepts. Absent when no status was ever reported.")
18426
18556
  }, {
@@ -18570,7 +18700,7 @@ var makeReportDeploymentStatusContract = (ids) => {
18570
18700
  error: "Send environment as either { id } or { name }, with optional ephemeral and baseEphemeralEnvironment."
18571
18701
  });
18572
18702
  const input = strictObject({
18573
- deployTarget: httpUrl().max(2048).describe("The URL the deployment serves, e.g. a preview URL.").optional(),
18703
+ deployTarget: httpUrl().max(2048).describe("The URL the deployment serves, e.g. a preview URL. A mobile pipeline leaves it unset and reports a service instead.").optional(),
18574
18704
  environment: environment.describe("Selects the environment the deployment reports into.").optional(),
18575
18705
  environmentVariables: record(string2(), string2()).describe("Environment variable overrides for the runs this deployment requests. A report that omits this field keeps the stored values. A report that sends it replaces them.").optional(),
18576
18706
  metadata: deploymentReportMetadata.describe("Details the deployer declares about the deployed revision; a code host integration's own record of the same commit is shown in preference to the message and author declared here.").optional(),
@@ -18818,6 +18948,7 @@ var makeSendEmailContract = (ids) => {
18818
18948
  // node_modules/@qawolf/api-contracts/dist/v1/environment/resource.js
18819
18949
  var makeEnvironmentResourceSchema = (ids) => resource({
18820
18950
  alias: string2().optional().describe("The environment's alias: a team-unique slug that team API keys can use in place of the id. Terminated environments have none."),
18951
+ baseEnvironmentId: ids.environment.optional().describe("The environment this one promotes its flow changes into, if it has a base."),
18821
18952
  flowCodeBranch: discriminatedUnion("syncStatus", [
18822
18953
  object({
18823
18954
  lastSyncedCommitHash: string2().describe("Hash of the latest reconciled commit."),
@@ -18831,6 +18962,7 @@ var makeEnvironmentResourceSchema = (ids) => resource({
18831
18962
  ]).optional().describe("The environment's flow code branch and its git reconciliation state, if it has one."),
18832
18963
  id: ids.environment,
18833
18964
  isDefault: boolean2().describe("Whether this is the workspace's default environment."),
18965
+ isDefaultBase: boolean2().describe("Whether this is the workspace's default base environment."),
18834
18966
  kind: _enum(["static", "preview"]).describe("Whether the environment is static or a preview."),
18835
18967
  name: string2(),
18836
18968
  runConcurrencyLimit: string2().describe('Maximum number of concurrent runs: a whole number, "unlimited", or a concurrency expression.'),
@@ -18894,32 +19026,6 @@ var makeDeleteEnvironmentVariableContract = (ids) => {
18894
19026
  };
18895
19027
  };
18896
19028
 
18897
- // node_modules/@qawolf/api-contracts/dist/v1/environment/discard.js
18898
- var makeDiscardEnvironmentContract = (ids) => {
18899
- const input = object({
18900
- environmentId: ids.environmentRef,
18901
- workspaceId: workspaceForEnvironmentRef(ids.workspace)
18902
- });
18903
- const output = makeEnvironmentResourceSchema(ids);
18904
- return {
18905
- annotationJustifications: {
18906
- destructiveHint: "Terminates the environment for good: its runs are canceled and its flow changes are never promoted.",
18907
- openWorldHint: "Changes QA Wolf environments only, not the customer's own repository or deployments.",
18908
- readOnlyHint: "Terminates an environment and returns it terminated."
18909
- },
18910
- annotations: {
18911
- destructiveHint: true,
18912
- openWorldHint: false,
18913
- readOnlyHint: false
18914
- },
18915
- description: "Declare a preview environment's work discarded, typically when its pull request closes without merging: the environment is terminated and its flow changes are not promoted into its base. Returns the environment, now terminated. A terminated environment cannot be discarded again. Use environment.promote instead when the work is accepted.",
18916
- input,
18917
- kind: "write",
18918
- name: "environment.discard",
18919
- output
18920
- };
18921
- };
18922
-
18923
19029
  // node_modules/@qawolf/api-contracts/dist/v1/environment/find.js
18924
19030
  var makeFindEnvironmentsContract = (ids) => {
18925
19031
  const input = object({
@@ -19065,32 +19171,6 @@ var makeSetEnvironmentVariableContract = (ids) => {
19065
19171
  };
19066
19172
  };
19067
19173
 
19068
- // node_modules/@qawolf/api-contracts/dist/v1/promotion/resource.js
19069
- var promotionStatusSchema = _enum([
19070
- "pending",
19071
- "conflicted",
19072
- "resolving",
19073
- "promoted",
19074
- "no-changes",
19075
- "abandoned"
19076
- ]).describe("pending (requested, the merge has not run yet), conflicted (the head's flow changes clash with the base and await a resolution), resolving (a submitted resolution is being applied), promoted (merged into the base and the head environment terminated), no-changes (the head had nothing to promote and was terminated), abandoned (the head environment was discarded or terminated before the promotion settled).");
19077
- var conflictSchema = object({
19078
- paths: array(string2()).describe("Every path that conflicts between the head and the base. A resolution must cover exactly these paths."),
19079
- sourceCommitHash: string2().describe("The head environment's flow code commit the conflict was computed against."),
19080
- targetCommitHash: string2().describe("The base environment's flow code commit the conflict was computed against.")
19081
- });
19082
- var makePromotionResourceSchema = (ids) => resource({
19083
- aiTaskId: ids.aiTask.optional().describe("The AI task dispatched to resolve this promotion's conflicts. Absent until the agent is dispatched. A promotion that stays conflicted after this is set means the agent could not resolve it."),
19084
- baseEnvironmentId: ids.environment.describe("The environment the flow changes promote into."),
19085
- conflict: conflictSchema.optional().describe("The conflict awaiting resolution. Present while status is conflicted or resolving. A resolution must name both commit hashes and cover exactly these paths; if either branch moves, the conflict is recomputed and this changes."),
19086
- createdAt: exports_iso.datetime().describe("When the promotion was requested."),
19087
- headEnvironmentId: ids.environment.describe("The environment whose flow changes are promoted."),
19088
- id: ids.promotion,
19089
- promotedCommitHash: string2().optional().describe("The commit the promotion landed on the base environment's flow code branch. Present when status is promoted."),
19090
- settledAt: exports_iso.datetime().optional().describe("When the promotion reached promoted, no-changes or abandoned. Absent while it is open."),
19091
- status: promotionStatusSchema
19092
- }, { urlFieldDescription: "Absolute URL of the head environment's page." });
19093
-
19094
19174
  // node_modules/@qawolf/api-contracts/dist/v1/environment/promote.js
19095
19175
  var makePromoteEnvironmentContract = (ids) => {
19096
19176
  const input = object({
@@ -19109,7 +19189,7 @@ var makePromoteEnvironmentContract = (ids) => {
19109
19189
  openWorldHint: false,
19110
19190
  readOnlyHint: false
19111
19191
  },
19112
- description: "Declare a preview environment's work accepted, typically when its pull request merges: its flow changes are promoted into its base environment and the environment is terminated once they land. Returns the promotion in pending; poll promotion.get to learn how it settled. Calling again while a promotion is open returns that promotion. A conflict settles the promotion conflicted and cancels the environment's in-progress runs; promotion.get names the conflicting paths. Use environment.discard instead when the work is abandoned.",
19192
+ description: "Declare a preview environment's work accepted, typically when its pull request merges: its flow changes are promoted into its base environment and the environment is terminated once they land. Returns the promotion in pending; poll promotion.get to learn how it settled. Calling again while a promotion is open returns that promotion. A conflict settles the promotion conflicted and cancels the environment's in-progress runs; promotion.get names the conflicting paths. Use environment.terminate instead when the work is abandoned.",
19113
19193
  input,
19114
19194
  kind: "write",
19115
19195
  name: "environment.promote",
@@ -19117,6 +19197,32 @@ var makePromoteEnvironmentContract = (ids) => {
19117
19197
  };
19118
19198
  };
19119
19199
 
19200
+ // node_modules/@qawolf/api-contracts/dist/v1/environment/terminate.js
19201
+ var makeTerminateEnvironmentContract = (ids) => {
19202
+ const input = object({
19203
+ environmentId: ids.environmentRef,
19204
+ workspaceId: workspaceForEnvironmentRef(ids.workspace)
19205
+ });
19206
+ const output = makeEnvironmentResourceSchema(ids);
19207
+ return {
19208
+ annotationJustifications: {
19209
+ destructiveHint: "Terminates the environment for good: its runs are canceled and its flow changes are never promoted.",
19210
+ openWorldHint: "Changes QA Wolf environments only, not the customer's own repository or deployments.",
19211
+ readOnlyHint: "Terminates an environment and returns it terminated."
19212
+ },
19213
+ annotations: {
19214
+ destructiveHint: true,
19215
+ openWorldHint: false,
19216
+ readOnlyHint: false
19217
+ },
19218
+ description: "Terminate a preview environment, typically when its pull request closes without merging: its flow changes are not promoted into its base. Returns the environment, now terminated. A terminated environment cannot be terminated again. Use environment.promote instead when the work is accepted.",
19219
+ input,
19220
+ kind: "write",
19221
+ name: "environment.terminate",
19222
+ output
19223
+ };
19224
+ };
19225
+
19120
19226
  // node_modules/@qawolf/api-contracts/dist/v1/environment/update.js
19121
19227
  var makeUpdateEnvironmentContract = (ids) => {
19122
19228
  const nameSchema = string2().trim().min(1).max(255).describe("New display name. Must be unique within the team.");
@@ -19219,6 +19325,52 @@ var makeAddTagToFlowsContract = (ids) => {
19219
19325
  };
19220
19326
  };
19221
19327
 
19328
+ // node_modules/@qawolf/api-contracts/dist/v1/flow/getHistory.js
19329
+ var makeGetFlowHistoryContract = (ids) => {
19330
+ const input = object({
19331
+ createdAfter: exports_iso.datetime({ offset: true }).optional().describe("Only include results of runs created strictly after this instant."),
19332
+ createdBefore: exports_iso.datetime({ offset: true }).optional().describe("Only include results of runs created strictly before this instant."),
19333
+ ...makePaginationInputFields({ defaultLimit: 20, maxLimit: 100 }),
19334
+ environmentId: ids.environmentRef,
19335
+ flowId: ids.flow.describe("The flow whose results to list. It must belong to the environment's workspace."),
19336
+ workspaceId: workspaceForEnvironmentRef(ids.workspace)
19337
+ });
19338
+ const result = resource({
19339
+ attemptCount: number2().int().nonnegative().describe("How many automated attempts the flow made in this run."),
19340
+ completedAt: exports_iso.datetime().optional().describe("When the flow finished. Absent until it does."),
19341
+ createdAt: exports_iso.datetime(),
19342
+ diagnosis: object({
19343
+ issueId: ids.issue,
19344
+ type: _enum(["bug", "maintenance"])
19345
+ }).optional().describe("QA Wolf's investigation verdict for a failed result: `bug` means the application is broken, `maintenance` means the test needed an update. Absent until the investigation reaches a verdict, and for results that did not fail."),
19346
+ durationMs: number2().int().nonnegative().optional().describe("Milliseconds from the flow's start to its completion. Absent when either is unknown."),
19347
+ passedAfterRetry: boolean2().describe("The flow passed, but only after at least one earlier attempt in the same run. A signal of flakiness."),
19348
+ runId: ids.run.describe("The run this result belongs to."),
19349
+ status: _enum(publicRunStatusValues)
19350
+ }, { urlFieldDescription: "Absolute URL of the run page." });
19351
+ const output = object({
19352
+ nextCursor: nextCursorSchema,
19353
+ results: array(result).describe("The flow's results in the environment, newest first.")
19354
+ });
19355
+ return {
19356
+ annotationJustifications: {
19357
+ destructiveHint: "Does not rerun, edit or remove the flow or its runs.",
19358
+ openWorldHint: "Reads recorded QA Wolf results without changing the application under test.",
19359
+ readOnlyHint: "Lists one flow's past results across runs."
19360
+ },
19361
+ annotations: {
19362
+ destructiveHint: false,
19363
+ openWorldHint: false,
19364
+ readOnlyHint: true
19365
+ },
19366
+ description: "List one flow's results across runs in an environment, newest first, with status, attempts, duration, and diagnosis. Use it to spot flakiness, failure streaks, and duration trends.",
19367
+ input,
19368
+ kind: "read",
19369
+ name: "flow.getHistory",
19370
+ output
19371
+ };
19372
+ };
19373
+
19222
19374
  // node_modules/@qawolf/api-contracts/dist/v1/flow/readiness.js
19223
19375
  var flowReadinessSchema = _enum(["draft", "active"]);
19224
19376
 
@@ -19455,6 +19607,7 @@ var makeInvestigationFindingSchema = (ids) => object({
19455
19607
  type: literal("commit")
19456
19608
  }),
19457
19609
  object({
19610
+ applyOn: string2().optional().describe(`When the new baseline applies. Known values: "now" (once a person applies the proposal) and "merge" (when the run's pull request merges, because every environment of the workspace shares baselines). Absent means "now". New values can appear.`),
19458
19611
  baselineChangeId: string2().optional().describe('The baseline change that made the new screenshot the baseline, on a "fixed" finding. `run restoreScreenshotBaseline` undoes it.'),
19459
19612
  comparisonId: string2().describe("The failed screenshot comparison whose new screenshot becomes the baseline, as `run listScreenshotComparisons` names it."),
19460
19613
  type: literal("baseline")
@@ -19466,6 +19619,12 @@ var makeInvestigationFindingSchema = (ids) => object({
19466
19619
  kind: string2().describe('What the failure is. Known values: "maintenance", "bug", "flake" and "unknown". New values can appear.'),
19467
19620
  matchReason: string2().optional(),
19468
19621
  priority: issuePrioritySchema.optional(),
19622
+ pullRequest: object({
19623
+ file: string2().optional().describe("The changed file that explains the verdict."),
19624
+ line: number2().int().optional().describe("The line in `file` that explains the verdict."),
19625
+ reason: string2().describe("Why the investigation reached the verdict."),
19626
+ verdict: string2().describe('Whether the pull request caused the failure. Known values: "caused", "not-caused" and "unclear". New values can appear.')
19627
+ }).optional().describe("Whether the pull request the run tested caused this finding. Absent on a run that didn't test a pull request, and when the investigation didn't say."),
19469
19628
  question: object({
19470
19629
  answers: array(object({
19471
19630
  description: string2().optional(),
@@ -19497,7 +19656,7 @@ var makeGetInvestigationContract = (ids) => {
19497
19656
  findings: array(makeInvestigationFindingSchema(ids)),
19498
19657
  runId: ids.run,
19499
19658
  sessionId: ids.chatSession.optional().describe("The investigation session. Absent when the run has none."),
19500
- status: _enum(["investigating", "finished", "not-investigated"]).describe('Whether the lead or any child investigator is still working. "not-investigated" when the run has no investigation.'),
19659
+ status: _enum(["investigating", "finished", "not-investigated", "not-enabled"]).describe('Whether the lead or any child investigator is still working. "not-investigated" when the run has no investigation. ' + '"not-enabled" when automatic investigation does not cover this run, because its workspace has it off or investigates only pull request runs: read its failures with run.get and attempt.get instead.'),
19501
19660
  subSessions: array(object({
19502
19661
  sessionId: ids.chatSession,
19503
19662
  status: agentSessionStatusSchema
@@ -19514,7 +19673,7 @@ var makeGetInvestigationContract = (ids) => {
19514
19673
  openWorldHint: false,
19515
19674
  readOnlyHint: true
19516
19675
  },
19517
- description: "Read what the QA Wolf AI investigating a run has concluded: one finding per cause of its failures, " + "with the question waiting for a person and any answer or dispute the investigation hasn't acted on yet.",
19676
+ description: "Read what the QA Wolf AI investigating a run has concluded: one finding per cause of its failures, " + "with the question waiting for a person and any answer or dispute the investigation hasn't acted on yet. " + 'A run that automatic investigation does not cover answers status "not-enabled".',
19518
19677
  input,
19519
19678
  kind: "read",
19520
19679
  name: "investigation.get",
@@ -19603,6 +19762,60 @@ var makeCreateIssueContract = (ids) => {
19603
19762
  };
19604
19763
  };
19605
19764
 
19765
+ // node_modules/@qawolf/api-contracts/dist/v1/issue/listActivity.js
19766
+ var issueActivityTypeSchema = _enum([
19767
+ "created",
19768
+ "status-changed",
19769
+ "priority-changed",
19770
+ "resolved",
19771
+ "auto-resolved",
19772
+ "reopened",
19773
+ "flow-started-reproducing",
19774
+ "flow-stopped-reproducing",
19775
+ "flow-removed",
19776
+ "maintenance-reason-changed",
19777
+ "due-date-changed",
19778
+ "other"
19779
+ ]).describe("What happened. resolved is a person resolving the issue, auto-resolved is QA Wolf resolving it once no flow reproduces it. flow-stopped-reproducing means a run of the flow passed. flow-removed means the flow was detached from the issue, deleted, or its environment ended. other covers edits such as the name or description.");
19780
+ var issueActivityActorKindSchema = _enum(["qa-wolf", "user", "api-key"]).optional().describe("Who caused the event: QA Wolf automation, a person, or an API key. Absent on older events.");
19781
+ var makeListIssueActivityContract = (ids) => {
19782
+ const input = object({
19783
+ issueId: ids.issue,
19784
+ ...makePaginationInputFields({ defaultLimit: 50, maxLimit: 200 })
19785
+ });
19786
+ const output = object({
19787
+ events: array(object({
19788
+ actorKind: issueActivityActorKindSchema,
19789
+ environmentId: ids.environment.optional(),
19790
+ flowId: ids.flow.optional(),
19791
+ fromPriority: issuePrioritySchema.optional(),
19792
+ occurredAt: exports_iso.datetime(),
19793
+ runId: ids.run.optional().describe("The run whose result caused the event."),
19794
+ toPriority: issuePrioritySchema.optional(),
19795
+ toStatus: issueStatusSchema.optional().describe("The issue status after the event."),
19796
+ type: issueActivityTypeSchema
19797
+ })).describe("The issue's activity, oldest first."),
19798
+ nextCursor: nextCursorSchema
19799
+ });
19800
+ return {
19801
+ annotationJustifications: {
19802
+ destructiveHint: "Does not edit the issue or its activity.",
19803
+ openWorldHint: "Reads QA Wolf issue history without publishing updates to linked trackers.",
19804
+ readOnlyHint: "Lists the recorded activity of one issue."
19805
+ },
19806
+ annotations: {
19807
+ destructiveHint: false,
19808
+ openWorldHint: false,
19809
+ readOnlyHint: true
19810
+ },
19811
+ description: "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.",
19812
+ input,
19813
+ kind: "read",
19814
+ name: "issue.listActivity",
19815
+ output
19816
+ };
19817
+ };
19818
+
19606
19819
  // node_modules/@qawolf/api-contracts/dist/v1/issue/removeFlows.js
19607
19820
  var makeRemoveFlowsFromIssueContract = (ids) => {
19608
19821
  const input = object({
@@ -19804,66 +20017,6 @@ var makeLegacyTriggerContracts = (ids) => ({
19804
20017
  resume: makeResumeLegacyTriggerContract(ids)
19805
20018
  });
19806
20019
 
19807
- // node_modules/@qawolf/api-contracts/dist/v1/promotion/find.js
19808
- var makeFindPromotionsContract = (ids) => {
19809
- const input = object({
19810
- environmentId: ids.environmentRef.optional().describe("Only list promotions out of this head environment, by id or alias. Omit to list the whole workspace's promotions."),
19811
- status: promotionStatusSchema.optional().describe("Only list promotions in this status. Use conflicted to see the promotions that need attention."),
19812
- workspaceId: ids.workspace.optional().describe("The workspace to list promotions from, which an environment alias resolves in. Required when authenticating with an organization or user API key."),
19813
- ...makePaginationInputFields({ defaultLimit: 20, maxLimit: 100 })
19814
- });
19815
- const output = object({
19816
- nextCursor: nextCursorSchema,
19817
- promotions: array(makePromotionResourceSchema(ids)).describe("The workspace's promotions, newest first.")
19818
- });
19819
- return {
19820
- annotationJustifications: {
19821
- destructiveHint: "Does not change promotions, environments or flow code branches.",
19822
- openWorldHint: "Reads private QA Wolf promotion records without changing external systems.",
19823
- readOnlyHint: "Lists promotions in the authorized workspace without changing them."
19824
- },
19825
- annotations: {
19826
- destructiveHint: false,
19827
- openWorldHint: false,
19828
- readOnlyHint: true
19829
- },
19830
- description: "List environment promotions, newest first. A promotion moves the flow changes made in a head environment into its base environment. Filter by status conflicted to find the promotions whose conflicts still need a resolution.",
19831
- input,
19832
- kind: "read",
19833
- name: "promotion.find",
19834
- output
19835
- };
19836
- };
19837
-
19838
- // node_modules/@qawolf/api-contracts/dist/v1/promotion/get.js
19839
- var makeGetPromotionContract = (ids) => {
19840
- const input = object({ promotionId: ids.promotion });
19841
- const output = makePromotionResourceSchema(ids);
19842
- return {
19843
- annotationJustifications: {
19844
- destructiveHint: "Does not change the promotion, its environments or flow code branches.",
19845
- openWorldHint: "Reads a private QA Wolf promotion record without changing external systems.",
19846
- readOnlyHint: "Retrieves one authorized promotion's status and conflict without changing it."
19847
- },
19848
- annotations: {
19849
- destructiveHint: false,
19850
- openWorldHint: false,
19851
- readOnlyHint: true
19852
- },
19853
- description: "Read one environment promotion: its status, the conflicting paths and commit hashes while it is conflicted or resolving, the commit it landed when promoted, and the AI task resolving it. Poll it after environment.promote to learn how the promotion settled. It does not serve file contents; a resolver reads both branches from the flow code repository.",
19854
- input,
19855
- kind: "read",
19856
- name: "promotion.get",
19857
- output
19858
- };
19859
- };
19860
-
19861
- // node_modules/@qawolf/api-contracts/dist/v1/promotion/index.js
19862
- var makePromotionContracts = (ids) => ({
19863
- find: makeFindPromotionsContract(ids),
19864
- get: makeGetPromotionContract(ids)
19865
- });
19866
-
19867
20020
  // node_modules/@qawolf/api-contracts/dist/v1/run/investigationSessionId.js
19868
20021
  var investigationSessionId = string2().trim().min(1).max(100).optional();
19869
20022
 
@@ -19889,6 +20042,9 @@ var makeAcceptScreenshotBaselineContract = (ids) => {
19889
20042
  object({
19890
20043
  outcome: literal("not-investigation-session").describe("An API key that is not a person's can change a baseline only as the investigation of the run, and chatSessionId is missing or is not the session that investigates the run. Nothing changed.")
19891
20044
  }),
20045
+ object({
20046
+ outcome: literal("waits-for-merge").describe("The investigation proposed this baseline to apply when the run's pull request merges, and it hasn't merged. Nothing changed. QA Wolf applies the approved baseline on merge.")
20047
+ }),
19892
20048
  object({
19893
20049
  outcome: literal("nothing-to-accept").describe("The comparison did not fail, or has no new screenshot to accept. Nothing changed.")
19894
20050
  })
@@ -20116,6 +20272,7 @@ var makeReattemptRunContract = (ids) => {
20116
20272
  });
20117
20273
  const output = resource({
20118
20274
  reattemptedFlowIds: array(ids.flow).describe("The flows a new attempt was requested for."),
20275
+ reattemptedInRunIds: array(ids.run).describe("The runs the new attempts were added to, which is where to poll " + "for their results. It is this run alone unless a flow had kept " + "failing in later runs, because the attempt then goes to the " + "latest of them."),
20119
20276
  runId: ids.run
20120
20277
  }, { urlFieldDescription: "Absolute URL of the run page." });
20121
20278
  return {
@@ -20129,7 +20286,7 @@ var makeReattemptRunContract = (ids) => {
20129
20286
  openWorldHint: true,
20130
20287
  readOnlyHint: false
20131
20288
  },
20132
- description: "Request new attempts for a run's flows, in the same run. " + "A flow is eligible once its result is failed or canceled and QA Wolf's " + "automatic retries have finished. " + "A fully investigated run no longer accepts reattempts. " + "Attempts run with the latest flow code. Poll run.get for results.",
20289
+ description: "Request new attempts for a run's flows. " + "A flow is eligible once its result is failed or canceled and QA Wolf's " + "automatic retries have finished. " + "A flow that kept failing in later runs is attempted in the latest of " + "them, because that is the run carrying the failure, so read " + "reattemptedInRunIds for where each attempt landed. " + "A fully investigated run no longer accepts reattempts. " + "Attempts run with the latest flow code. Poll run.get for results.",
20133
20290
  input,
20134
20291
  kind: "write",
20135
20292
  name: "run.reattempt",
@@ -20549,7 +20706,7 @@ var makeRunFlowOnRunnerContract = (ids) => {
20549
20706
  const input = object({
20550
20707
  entryPointPath: runFilePathSchema.describe("Path of the flow file to run, as it appears in `files`."),
20551
20708
  env: runEnvironmentSchema.optional().describe("Environment variables to make available to the run."),
20552
- environmentId: ids.environmentRef.optional().describe("A QA Wolf environment whose variables the run is given, by id or alias. QA Wolf reads and decrypts them itself, so they never travel in the request and the count and length limits on `env` do not apply to them. Send this or `env`, not both."),
20709
+ environmentId: ids.environmentRef.optional().describe("A QA Wolf environment whose variables the run is given, by id or alias. QA Wolf reads and decrypts them itself, so they never travel in the request and the count and length limits on `env` do not apply to them. The run also gets `QAWOLF_ENVIRONMENT_ID`, `QAWOLF_ENVIRONMENT_NAME` and `QAWOLF_TEAM_API_KEY`, as a cloud run on that environment does, so a flow can save environment variables with `@qawolf/testkit`. Send this or `env`, not both."),
20553
20710
  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."),
20554
20711
  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`."),
20555
20712
  id: runnerIdSchema.describe("Id of the runner to run the flow on."),
@@ -20826,18 +20983,19 @@ var makeContractsV1 = (ids) => {
20826
20983
  environment: {
20827
20984
  create: makeCreateEnvironmentContract(resolvedIds),
20828
20985
  deleteVariable: makeDeleteEnvironmentVariableContract(resolvedIds),
20829
- discard: makeDiscardEnvironmentContract(resolvedIds),
20830
20986
  find: makeFindEnvironmentsContract(resolvedIds),
20831
20987
  get: makeGetEnvironmentContract(resolvedIds),
20832
20988
  getVariable: makeGetEnvironmentVariableContract(resolvedIds),
20833
20989
  listVariableNames: makeListEnvironmentVariableNamesContract(resolvedIds),
20834
20990
  promote: makePromoteEnvironmentContract(resolvedIds),
20835
20991
  setVariable: makeSetEnvironmentVariableContract(resolvedIds),
20992
+ terminate: makeTerminateEnvironmentContract(resolvedIds),
20836
20993
  update: makeUpdateEnvironmentContract(resolvedIds)
20837
20994
  },
20838
20995
  file: makeFileContracts(resolvedIds),
20839
20996
  flow: {
20840
20997
  addTag: makeAddTagToFlowsContract(resolvedIds),
20998
+ getHistory: makeGetFlowHistoryContract(resolvedIds),
20841
20999
  list: makeListFlowsContract(resolvedIds),
20842
21000
  removeTag: makeRemoveTagFromFlowsContract(resolvedIds),
20843
21001
  update: makeUpdateFlowContract(resolvedIds)
@@ -20848,6 +21006,7 @@ var makeContractsV1 = (ids) => {
20848
21006
  create: makeCreateIssueContract(resolvedIds),
20849
21007
  find: makeFindIssuesContract(resolvedIds),
20850
21008
  get: makeGetIssueContract(resolvedIds),
21009
+ listActivity: makeListIssueActivityContract(resolvedIds),
20851
21010
  removeFlows: makeRemoveFlowsFromIssueContract(resolvedIds),
20852
21011
  update: makeUpdateIssueContract(resolvedIds)
20853
21012
  },
@@ -23379,7 +23538,7 @@ function startUpdateCheck(deps) {
23379
23538
  // package.json
23380
23539
  var package_default = {
23381
23540
  name: "@qawolf/cli",
23382
- version: "1.41.0",
23541
+ version: "1.43.0",
23383
23542
  description: "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
23384
23543
  keywords: [
23385
23544
  "automation",
@@ -23451,7 +23610,7 @@ var package_default = {
23451
23610
  "@clack/prompts": "1.5.1",
23452
23611
  "@napi-rs/keyring": "1.3.0",
23453
23612
  "@oxc-node/core": "0.1.0",
23454
- "@qawolf/api-contracts": "0.83.0",
23613
+ "@qawolf/api-contracts": "0.91.0",
23455
23614
  "@qawolf/emails": "1.1.1",
23456
23615
  "@qawolf/flow-targets": "1.0.0",
23457
23616
  "@qawolf/flows": "0.1.4",
@@ -23797,6 +23956,70 @@ async function followSession(ctx, options, deps) {
23797
23956
  }
23798
23957
  }
23799
23958
 
23959
+ // src/domains/agent/followSessions.ts
23960
+ async function followSessions(options) {
23961
+ const { ctx, deps, sessionIds, timeoutSeconds } = options;
23962
+ const deadline = deps.now() + timeoutSeconds * 1000;
23963
+ const timedOut = () => ({
23964
+ error: agentMessages.followSessionsTimedOut({
23965
+ seconds: timeoutSeconds,
23966
+ sessionIds
23967
+ }),
23968
+ exitCode: exitCodes.timeout
23969
+ });
23970
+ const waiting = ctx.ui.wait(agentMessages.waiting);
23971
+ const detach = ctx.signals.register(() => waiting.stop());
23972
+ try {
23973
+ for (;; ) {
23974
+ for (const sessionId of sessionIds) {
23975
+ const remainingMs = deadline - deps.now();
23976
+ if (remainingMs <= 0)
23977
+ return timedOut();
23978
+ const read = await ctx.platformClient.callPublicApi(publicContractsV1.agent.get, { sessionId, waitSeconds: 0 }, { timeoutMs: Math.min(15000, remainingMs) });
23979
+ if (!read.ok) {
23980
+ if (deps.now() >= deadline)
23981
+ return timedOut();
23982
+ return { exitCode: exitCodes.network, ...failureFields(read) };
23983
+ }
23984
+ const session = read.value;
23985
+ const question = pendingQuestion(session.status, session.replies);
23986
+ if (!isSettled(session.status) && question === undefined)
23987
+ continue;
23988
+ waiting.stop();
23989
+ ctx.ui.info(agentMessages.sessionAt(session.url));
23990
+ if (ctx.ui.mode !== "json") {
23991
+ for (const reply of session.replies) {
23992
+ ctx.ui.transcript({
23993
+ ...replyParts(reply, { listChoices: true }),
23994
+ data: reply
23995
+ });
23996
+ }
23997
+ }
23998
+ if (isSettled(session.status))
23999
+ return reportSettlement(ctx, session);
24000
+ if (question !== undefined) {
24001
+ const result = await handleQuestion(ctx, {
24002
+ canPrompt: false,
24003
+ question,
24004
+ session,
24005
+ sessionId,
24006
+ workspaceId: undefined
24007
+ });
24008
+ if (result.type === "ended")
24009
+ return result.result;
24010
+ }
24011
+ }
24012
+ const remainingMs = deadline - deps.now();
24013
+ if (remainingMs <= 0)
24014
+ return timedOut();
24015
+ await deps.sleep(Math.min(5000, remainingMs));
24016
+ }
24017
+ } finally {
24018
+ waiting.stop();
24019
+ detach();
24020
+ }
24021
+ }
24022
+
23800
24023
  // src/core/resolveId.ts
23801
24024
  async function resolveIdFrom(options) {
23802
24025
  if (options.given !== undefined) {
@@ -23843,6 +24066,29 @@ async function handleAgentGet(ctx, options, deps) {
23843
24066
  if (!timeout.ok) {
23844
24067
  return { error: timeout.error, exitCode: exitCodes.invalidArgs };
23845
24068
  }
24069
+ if (options.sessions !== undefined) {
24070
+ if (options.session !== undefined || options.sessionArgument !== undefined)
24071
+ return {
24072
+ error: agentMessages.conflictingSessionList,
24073
+ exitCode: exitCodes.invalidArgs
24074
+ };
24075
+ if (!options.follow)
24076
+ return {
24077
+ error: agentMessages.sessionListNeedsFollow,
24078
+ exitCode: exitCodes.invalidArgs
24079
+ };
24080
+ if (options.sessions.length === 0)
24081
+ return {
24082
+ error: agentMessages.emptySessionList,
24083
+ exitCode: exitCodes.invalidArgs
24084
+ };
24085
+ return followSessions({
24086
+ ctx,
24087
+ deps,
24088
+ sessionIds: [...new Set(options.sessions)],
24089
+ timeoutSeconds: timeout.seconds
24090
+ });
24091
+ }
23846
24092
  const given = chooseGivenSessionId({
23847
24093
  argument: options.sessionArgument,
23848
24094
  flag: options.session
@@ -23952,12 +24198,14 @@ Examples:
23952
24198
  $ qawolf agent get
23953
24199
  $ qawolf agent get --follow
23954
24200
  $ qawolf agent get <sessionId> --follow
23955
- $ qawolf agent get --session <sessionId>`;
24201
+ $ qawolf agent get --session <sessionId>
24202
+ $ qawolf --json agent get --sessions <id1> <id2> --follow --timeout 120`;
23956
24203
  function registerAgentGetCommand(agent, signals) {
23957
- declareCommandKind(agent.command("get [session]"), "read").description("Read what the QA Wolf AI has said and whether it is still working").option("--follow", "Stay and report what QA Wolf says until the session settles, answering its questions as they come", false).option("--session <id>", sessionFlagDescription).option("--workspace-id <id>", "The workspace an answer given during --follow is sent to. Required when authenticating with an organization or user API key").option("--timeout <seconds>", timeoutFlagDescription, String(defaultAgentFollowTimeoutSeconds)).addHelpText("after", getExamples).action((session, opts, command) => withAuthContext(signals, (ctx) => handleAgentGet(ctx, {
24204
+ declareCommandKind(agent.command("get [session]"), "read").description("Read what the QA Wolf AI has said and whether it is still working").option("--follow", "Stay and report what QA Wolf says until the session settles, answering its questions as they come", false).option("--session <id>", sessionFlagDescription).option("--sessions <ids...>", "Follow these sessions in one process and return the first completion, failure, cancellation or question. Requires --follow").option("--workspace-id <id>", "The workspace an answer given during --follow is sent to. Required when authenticating with an organization or user API key").option("--timeout <seconds>", timeoutFlagDescription, String(defaultAgentFollowTimeoutSeconds)).addHelpText("after", getExamples).action((session, opts, command) => withAuthContext(signals, (ctx) => handleAgentGet(ctx, {
23958
24205
  follow: opts.follow,
23959
24206
  session: opts.session,
23960
24207
  sessionArgument: session,
24208
+ sessions: opts.sessions,
23961
24209
  timeout: opts.timeout,
23962
24210
  workspaceId: opts.workspaceId
23963
24211
  }, agentDeps(ctx)))(opts, command));
@@ -40521,4 +40769,4 @@ createProgram({ signals }).parseAsync().catch(() => {
40521
40769
  process.exitCode = 1;
40522
40770
  }).finally(() => exitWhenIdle(typeof process.exitCode === "number" ? process.exitCode : 0));
40523
40771
 
40524
- //# debugId=60ABEEB099A36FAE64756E2164756E21
40772
+ //# debugId=85DD700D9EF8EB3B64756E2164756E21