@qawolf/cli 1.31.0 → 1.33.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
@@ -8873,6 +8873,37 @@ var interactMessages = {
8873
8873
  promoteSnapshotAnsweredUnknown: (failureReason) => `The runner answered "${failureReason}", which this version of the CLI does not know how to report. Upgrade with npm install -g @qawolf/cli.`
8874
8874
  };
8875
8875
 
8876
+ // src/core/messages/interactiveRunner/sequence.ts
8877
+ var sequenceMessages = {
8878
+ actionsEmpty: `The sequence holds no actions. Pass a JSON array of at least one, for example '[{"type":"click","button":"left","x":480,"y":260},{"type":"type","text":"hello"}]'.`,
8879
+ actionsInvalidAt: (index, error) => `Action ${index} in the sequence was refused: ${error}`,
8880
+ stdinEmptySequence: 'Nothing arrived on stdin. Pipe the sequence in, or pass the JSON array as the argument instead of "-".',
8881
+ actionsNotJsonArray: `The sequence must be a JSON array of actions, for example '[{"type":"click","button":"left","x":480,"y":260},{"type":"type","text":"hello"}]'.`,
8882
+ actionsEachNeedsAPath: "--screenshot-mode each writes one frame per action, so it needs --screenshot <path>; each frame goes to that path with the action's index before the extension.",
8883
+ actionsFinalNeedsAPath: "--screenshot-mode final asks the runner for one frame after the last action, so it needs --screenshot <path> to write it to. Leave the mode off to perform the actions without a frame.",
8884
+ actionsScreenshotWithModeNone: "--screenshot-mode none asks the runner for no frame, so --screenshot would have nothing to write. Drop one of the two.",
8885
+ actionsEachToStdout: "--screenshot-mode each writes one frame per action, which stdout cannot carry. Give --screenshot a file path.",
8886
+ actionsFailedFramesWritten: (paths) => `${paths.length === 1 ? "Its screen was" : "Its screens were"} written to ${paths.join(", ")}, so look at ${paths.length === 1 ? "that" : "those"} rather than sending anything again.`,
8887
+ actionsFailedScreenshotToStdout: "Its screen was written to stdout as a JPEG, so look at that rather than sending anything again.",
8888
+ actionsPerformed: (count) => `Performed ${count} ${count === 1 ? "action" : "actions"}.`,
8889
+ actionsPerformedOfTotal: (performed, total) => `Performed ${String(performed)} of ${pluralize(total, "action")}.`,
8890
+ actionsFramesUnwritable: (unwritten) => `The runner answered, but ${pluralize(unwritten.length, "frame")} could not be written: ${unwritten.map(({ detail, path }) => `"${path}" (${detail})`).join(", ")}. Whatever the actions did has already happened, so do not send them again: take the screen with qawolf runner screenshot, giving --out a path this process can write to.`,
8891
+ actionsFramesMissing: (indexes) => `The runner answered without the ${indexes.length === 1 ? "screen" : "screens"} after ${indexes.length === 1 ? "action" : "actions"} ${indexes.join(", ")}, so nothing was written for ${indexes.length === 1 ? "it" : "them"}. Whatever the actions did has already happened, so do not send them again: take the screen with qawolf runner screenshot instead.`,
8892
+ actionsPerformedWithoutScreenshot: (count) => `Performed ${pluralize(count, "action")}, but the runner answered without the screen it was asked for. Whatever the actions did has already happened, so do not send them again: take the screen with qawolf runner screenshot instead. If this keeps happening, the platform or this CLI is behind the other: upgrade with npm install -g @qawolf/cli.`,
8893
+ actionsPerformedFramesWritten: (count, paths) => `Performed ${pluralize(count, "action")} and wrote ${pluralize(paths.length, "screen")} to ${paths.join(", ")}.`,
8894
+ actionsPerformedScreenshotToStdout: (count) => `Performed ${pluralize(count, "action")} and wrote the runner's screen to stdout as a JPEG. Stdout holds the image bytes alone, so this line is on stderr and the per-action results are not printed at all: give --screenshot a file path when you need to read them.`,
8895
+ actionsPerformedScreenshotWritten: (count, path) => `Performed ${count} ${count === 1 ? "action" : "actions"} and wrote the runner's screen to ${path}.`,
8896
+ actionsOverLimit: (sent, limit) => `The sequence holds ${pluralize(sent, "action")}, and one request carries at most ${String(limit)}. Send them in batches, ending each at the action that changes the page.`,
8897
+ actionsNotAllSucceeded: (failed, total) => `${String(failed)} of ${pluralize(total, "action")} did not succeed.`,
8898
+ actionsFailedWithoutAResult: (failureReason) => `did not succeed ("${failureReason}"), and the answer carried no result for it. Take a screenshot before repeating anything from it on.`,
8899
+ actionsFailedAt: (index, type, why) => `Action ${index}${type === undefined ? "" : ` (${type})`} ${why}`,
8900
+ actionsLeftUnperformed: (count) => `${count} ${count === 1 ? "action" : "actions"} after it ${count === 1 ? "was" : "were"} not attempted.`,
8901
+ actionsMayHaveHappened: "It may have taken effect: take a screenshot before repeating anything from it on.",
8902
+ actionsOutOfTime: "was not reached before the sequence ran out of its time.",
8903
+ actionsPartlyApplied: (lastCompletedIndex) => `The sequence was partly applied: action ${String(lastCompletedIndex)} is the last one that took effect. Do not send it again as a whole; send only what still has to happen as a new request.`,
8904
+ actionsUnconfirmed: (errorMessage) => `has an unknown effect: ${errorMessage}`
8905
+ };
8906
+
8876
8907
  // src/core/messages/interactiveRunner/lifecycle.ts
8877
8908
  var pageAt = (url) => `Its runner page is at ${url}`;
8878
8909
  var noRunnerId = "No runner id. Pass --runner, set QAWOLF_RUNNER_ID, or run qawolf runner launch first.";
@@ -8953,7 +8984,8 @@ var interactiveRunnerMessages = {
8953
8984
  ...lifecycleMessages,
8954
8985
  ...listMessages,
8955
8986
  ...runMessages,
8956
- ...interactMessages
8987
+ ...interactMessages,
8988
+ ...sequenceMessages
8957
8989
  };
8958
8990
  // src/core/messages/runner.ts
8959
8991
  var maxListedNames = 5;
@@ -10013,6 +10045,7 @@ var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]
10013
10045
  var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
10014
10046
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
10015
10047
  var base64url = /^[A-Za-z0-9_-]*$/;
10048
+ var domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
10016
10049
  var httpProtocol = /^https?$/;
10017
10050
  var e164 = /^\+[1-9]\d{6,14}$/;
10018
10051
  var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
@@ -10043,6 +10076,7 @@ var bigint = /^-?\d+n?$/;
10043
10076
  var integer = /^-?\d+$/;
10044
10077
  var number = /^-?\d+(?:\.\d+)?$/;
10045
10078
  var boolean = /^(?:true|false)$/i;
10079
+ var _null = /^null$/i;
10046
10080
  var lowercase = /^[^A-Z]*$/;
10047
10081
  var uppercase = /^[^a-z]*$/;
10048
10082
 
@@ -10963,6 +10997,23 @@ var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
10963
10997
  return payload;
10964
10998
  };
10965
10999
  });
11000
+ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
11001
+ $ZodType.init(inst, def);
11002
+ inst._zod.pattern = _null;
11003
+ inst._zod.values = new Set([null]);
11004
+ inst._zod.parse = (payload, _ctx) => {
11005
+ const input = payload.value;
11006
+ if (input === null)
11007
+ return payload;
11008
+ payload.issues.push({
11009
+ expected: "null",
11010
+ code: "invalid_type",
11011
+ input,
11012
+ inst
11013
+ });
11014
+ return payload;
11015
+ };
11016
+ });
10966
11017
  var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
10967
11018
  $ZodType.init(inst, def);
10968
11019
  inst._zod.parse = (payload) => payload;
@@ -12497,6 +12548,12 @@ function _coercedBigint(Class, params) {
12497
12548
  ...normalizeParams(params)
12498
12549
  });
12499
12550
  }
12551
+ function _null2(Class, params) {
12552
+ return new Class({
12553
+ type: "null",
12554
+ ...normalizeParams(params)
12555
+ });
12556
+ }
12500
12557
  function _unknown(Class) {
12501
12558
  return new Class({
12502
12559
  type: "unknown"
@@ -13948,6 +14005,9 @@ var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
13948
14005
  $ZodUUID.init(inst, def);
13949
14006
  ZodStringFormat.init(inst, def);
13950
14007
  });
14008
+ function uuid2(params) {
14009
+ return _uuid(ZodUUID, params);
14010
+ }
13951
14011
  var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
13952
14012
  $ZodURL.init(inst, def);
13953
14013
  ZodStringFormat.init(inst, def);
@@ -13955,6 +14015,13 @@ var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
13955
14015
  function url(params) {
13956
14016
  return _url(ZodURL, params);
13957
14017
  }
14018
+ function httpUrl(params) {
14019
+ return _url(ZodURL, {
14020
+ protocol: httpProtocol,
14021
+ hostname: domain,
14022
+ ...normalizeParams(params)
14023
+ });
14024
+ }
13958
14025
  var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
13959
14026
  $ZodEmoji.init(inst, def);
13960
14027
  ZodStringFormat.init(inst, def);
@@ -14116,6 +14183,14 @@ var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
14116
14183
  inst.maxValue = bag.maximum ?? null;
14117
14184
  inst.format = bag.format ?? null;
14118
14185
  });
14186
+ var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
14187
+ $ZodNull.init(inst, def);
14188
+ ZodType.init(inst, def);
14189
+ inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
14190
+ });
14191
+ function _null3(params) {
14192
+ return _null2(ZodNull, params);
14193
+ }
14119
14194
  var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
14120
14195
  $ZodUnknown.init(inst, def);
14121
14196
  ZodType.init(inst, def);
@@ -14567,6 +14642,12 @@ function refine(fn, _params = {}) {
14567
14642
  function superRefine(fn, params) {
14568
14643
  return _superRefine(fn, params);
14569
14644
  }
14645
+ function json(params) {
14646
+ const jsonSchema = lazy(() => {
14647
+ return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
14648
+ });
14649
+ return jsonSchema;
14650
+ }
14570
14651
  // node_modules/zod/v4/classic/coerce.js
14571
14652
  var exports_coerce = {};
14572
14653
  __export(exports_coerce, {
@@ -16560,6 +16641,10 @@ var agentReplySchema = object({
16560
16641
  text: string2().describe("What the AI said.")
16561
16642
  });
16562
16643
 
16644
+ // node_modules/@qawolf/api-contracts/dist/v1/agent/wait.js
16645
+ var maxAgentWaitSeconds = 45;
16646
+ var agentWakeReasonSchema = _enum(["reply", "status", "timeout"]).describe('Why a held check answered. "reply" means the AI said something new, "status" means the session settled or needs you, "timeout" means the hold ran out with nothing new.');
16647
+
16563
16648
  // node_modules/@qawolf/api-contracts/dist/v1/resource.js
16564
16649
  function resource(fields, { urlFieldDescription = "Absolute URL." } = {}) {
16565
16650
  return object({
@@ -16717,16 +16802,18 @@ var identityOrganizationsResponse = object({
16717
16802
  // node_modules/@qawolf/api-contracts/dist/v1/ids.js
16718
16803
  var defaultIdSchemas = {
16719
16804
  aiTask: string2().min(1).describe("The id of the AI task."),
16720
- automation: string2().min(1).describe("The id of the automation."),
16721
16805
  chatSession: string2().min(1).describe("The id of the chat session."),
16806
+ deployment: string2().min(1).describe("The id of the deployment."),
16722
16807
  environment: string2().min(1).describe("The id of the environment."),
16723
- environmentRef: string2().min(1).describe("The id or alias of the environment. Aliases require a team API key."),
16808
+ environmentRef: string2().min(1).describe("The id or alias of the environment. An organization or user API key must also send workspaceId to use an alias."),
16724
16809
  flow: string2().min(1).describe("The id of the flow."),
16725
16810
  issue: string2().min(1).describe("The id of the issue."),
16811
+ legacyTrigger: string2().min(1).describe("The id of the legacy trigger, from legacyTrigger.find."),
16726
16812
  run: string2().min(1).describe("The id of the run."),
16727
16813
  trigger: string2().min(1).describe("The id of the trigger."),
16728
16814
  workspace: string2().min(1).describe("The id of the workspace.")
16729
16815
  };
16816
+ var workspaceForEnvironmentRef = (workspace) => workspace.optional().describe("The workspace the environment belongs to. Required to reference the environment by alias when authenticating with an organization or user API key.");
16730
16817
 
16731
16818
  // node_modules/@qawolf/api-contracts/dist/v1/run/flowSelection.js
16732
16819
  var makeFlowSelectionSchema = (ids) => object({
@@ -16745,7 +16832,8 @@ var makeCreateRunContract = (ids) => {
16745
16832
  environmentVariables: record(string2(), string2()).optional(),
16746
16833
  ignoreRules: boolean2().describe("Ignore this team's sequencing rules for this run. By default they are honoured: the flows your selection depends on are added to the run, and flows run in the order the rules require. Set this to run exactly what you selected, in any order.").default(false),
16747
16834
  pullRequestNumber: number2().int().positive().describe("The number of the pull request to associate with the run.").optional(),
16748
- repository: string2().min(1).describe('The owner/name of the repository, e.g. "acme/web".').optional()
16835
+ repository: string2().min(1).describe('The owner/name of the repository, e.g. "acme/web".').optional(),
16836
+ workspaceId: workspaceForEnvironmentRef(ids.workspace)
16749
16837
  }).and(makeFlowSelectionSchema(ids)).refine((value) => !(value.aiTaskId && value.chatSessionId), {
16750
16838
  message: "Provide at most one of aiTaskId and chatSessionId: a task already implies its own chat session.",
16751
16839
  path: ["chatSessionId"]
@@ -16773,6 +16861,9 @@ var makeCreateRunContract = (ids) => {
16773
16861
  };
16774
16862
  };
16775
16863
 
16864
+ // node_modules/@qawolf/api-contracts/dist/v1/runner/actionSequence.js
16865
+ var maxActionsPerRequest = 10;
16866
+ var screenshotModes = ["none", "final", "each"];
16776
16867
  // node_modules/@qawolf/api-contracts/dist/v1/runner/browserAction.js
16777
16868
  var maxScreenCoordinate = 20000;
16778
16869
  var screenCoordinateSchema = int().min(0).max(maxScreenCoordinate);
@@ -16899,11 +16990,12 @@ var runnerNameSchema = _enum([
16899
16990
  var runnerWorkspaceRequirement = "Required when the credential is not bound to a single workspace, such as a user API key or an OAuth connection whose organization owns several.";
16900
16991
  var runnerWorkspaceIdDescription = `The workspace the runner belongs to. ${runnerWorkspaceRequirement}`;
16901
16992
  var runnerIdSchema = string2().min(1).max(63).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, "A runner id may contain only lowercase letters, digits and dashes, and must start and end with a letter or digit.");
16993
+ var runnerWatchUrlSchema = url().describe("A QA Wolf page showing what the runner is doing right now, where the person who launched it can watch and take over with their own mouse and keyboard. Opening it requires being signed in to QA Wolf. This link belongs to the user: put it in a normal message as soon as the runner is launched, so they can follow along while the browser is being driven. It is theirs to open, never a page for the caller to fetch or navigate to. The page ends when the runner is terminated, so share it while the runner is alive and report what you found at the end instead of repeating a dead link.");
16902
16994
  var makeRunnerSchema = () => object({
16903
16995
  gpuAccelerated: boolean2().describe("Whether the runner was placed on GPU hardware. Chosen by QA Wolf from the team's configuration and what the fleet can provide, not requested."),
16904
16996
  id: runnerIdSchema.describe("The runner's id, as supplied when launching it."),
16905
16997
  runnerName: runnerNameSchema.describe("The runner family requested when the runner was launched. QA Wolf may place it on faster hardware, reported in gpuAccelerated."),
16906
- url: url().describe("A QA Wolf page showing what the runner is doing right now, where the person who launched it can watch and take over with their own mouse and keyboard. Opening it requires being signed in to QA Wolf.")
16998
+ url: runnerWatchUrlSchema
16907
16999
  });
16908
17000
  // node_modules/@qawolf/api-contracts/dist/v1/runner/unreachable.js
16909
17001
  var runnerUnreachableFailureReason = "runner-unreachable";
@@ -17190,13 +17282,13 @@ var screenshotImageSchema = string2().min(1).describe("The screenshot, as a base
17190
17282
  // node_modules/@qawolf/api-contracts/dist/v1/runner/performAction.js
17191
17283
  var unreachableDescription = "`runner-unreachable` if the runner could not be reached: it may still be starting, it may have terminated after inactivity, or it may have stopped answering mid-action. This does not mean the action was not performed — take a screenshot before repeating it.";
17192
17284
  var notSupportedOnMobileDescription = "`action-not-supported-on-mobile` if the runner is a mobile device and this action has no touchscreen equivalent: `double_click`, `scroll`, `move`, `keypress` and `navigate`, and a `click` whose `button` is not `left`, are all pointer-device concepts a touchscreen has nothing to offer for. `click` taps, `drag` swipes between its path's first and last point, and `type` types into whatever the last tap focused.";
17193
- var withScreenshotDescription = "With `withScreenshot: true`, the answer also carries `imageJpegBase64`: a screenshot taken after the action, once the screen has changed from just before it or half a second has passed, whichever comes first. One call instead of `runner.performAction` followed by `runner.takeScreenshot`, with no fixed wait in between. Anything animating on the page counts as a change. The action itself is performed exactly as without the option; if the screen could serve no frame after it — a display restart, or a `navigate` on a desktop that is still starting — the action's result comes back without `imageJpegBase64`, so take a screenshot separately rather than repeating the action. On a mobile runner the screenshot is the device's own, taken right after a performed action.";
17285
+ var withScreenshotDescription = "With `withScreenshot: true`, the answer also carries `imageJpegBase64`: a screenshot taken after the action. One call instead of `runner.performAction` followed by `runner.takeScreenshot`. The action itself is performed exactly as without the option; if the screen could serve no frame after it — a display restart, or a `navigate` on a desktop that is still starting — the action's result comes back without `imageJpegBase64`, so take a screenshot separately rather than repeating the action. On a mobile runner the screenshot is the device's own, taken right after a performed action.";
17194
17286
  var maxActionErrorMessageLength = 1000;
17195
17287
  var makePerformActionOnRunnerContract = (ids) => {
17196
17288
  const input = object({
17197
- action: browserActionSchema.describe("The action to perform. Coordinates are pixels on the screenshot's own coordinate space."),
17289
+ action: browserActionSchema.describe(`The action to perform. Coordinates are whole pixels on the runner's virtual desktop, in the same space as \`runner.takeScreenshot\`. The action shapes follow the computer-use vocabulary, minus \`screenshot\` (use \`runner.takeScreenshot\`) and \`wait\` (delay on the caller's side). A \`navigate\` does not go through the screen, so a screen that is not ready does not stop it. ${notSupportedOnMobileDescription}`),
17198
17290
  id: runnerIdSchema.describe("Id of the runner to act on."),
17199
- withScreenshot: boolean2().optional().describe("Also answer with a screenshot taken after the action, once the screen has changed or half a second has passed. Saves the separate `runner.takeScreenshot` call and its fixed wait."),
17291
+ withScreenshot: boolean2().optional().describe(withScreenshotDescription),
17200
17292
  workspaceId: ids.workspace.optional().describe(runnerWorkspaceIdDescription)
17201
17293
  });
17202
17294
  const screenshotAfterAction = screenshotImageSchema.optional();
@@ -17226,7 +17318,7 @@ var makePerformActionOnRunnerContract = (ids) => {
17226
17318
  openWorldHint: true,
17227
17319
  readOnlyHint: false
17228
17320
  },
17229
- description: `Perform one raw browser action on an interactive runner: click, double_click, move, drag, scroll, keypress, type, or navigate. Coordinates are whole pixels on the runner's virtual desktop, in the same space as \`runner.takeScreenshot\`. One action per request, and the runner serves one at a time. The action shapes follow the computer-use vocabulary, minus \`screenshot\` (use \`runner.takeScreenshot\`) and \`wait\` (delay on the caller's side). A success means the action took effect. \`action-failed\`, with a reason, if it reached the runner and did not take effect. On a runner image with a browser, the first action on a runner that has never run anything starts its browser and waits for it, so it can take up to a minute to answer — no \`runner.runFlow\` is needed before acting; if the browser is still starting when the wait runs out, the answer is \`screen-not-ready\` and retrying converges. On a mobile runner, the same \`screen-needs-a-run\` and \`screen-not-ready\` outcomes mean no Appium session has started yet, or it did not answer this instant; \`runner.runFlow\` is what starts one, same as a browser. \`screen-needs-a-run\` if the browser could not be started that way — usually a runner whose runs all finished without starting its desktop; call \`runner.runFlow\` with a flow that opens a browser. ${screenNotReadyDescription} A \`navigate\` does not go through the screen, so a screen that is not ready does not stop it. ${runnerHasNoScreenDescription} ${notSupportedOnMobileDescription} ${withScreenshotDescription} ${unreachableDescription}`,
17321
+ description: `Perform one raw browser action on an interactive runner: click, double_click, move, drag, scroll, keypress, type, or navigate. One action per request, and the runner serves one at a time. A success means the action took effect. \`action-failed\`, with a reason, if it reached the runner and did not take effect. On a runner image with a browser, the first action on a runner that has never run anything starts its browser and waits for it, so it can take up to a minute to answer — no \`runner.runFlow\` is needed before acting; if the browser is still starting when the wait runs out, the answer is \`screen-not-ready\` and retrying converges. On a mobile runner, the same \`screen-needs-a-run\` and \`screen-not-ready\` outcomes mean no Appium session has started yet, or it did not answer this instant; \`runner.runFlow\` is what starts one, same as a browser. \`screen-needs-a-run\` if the browser could not be started that way — usually a runner whose runs all finished without starting its desktop; call \`runner.runFlow\` with a flow that opens a browser. ${screenNotReadyDescription} ${runnerHasNoScreenDescription} ${unreachableDescription}`,
17230
17322
  input,
17231
17323
  kind: "write",
17232
17324
  name: "runner.performAction",
@@ -17234,6 +17326,214 @@ var makePerformActionOnRunnerContract = (ids) => {
17234
17326
  };
17235
17327
  };
17236
17328
 
17329
+ // node_modules/@qawolf/api-contracts/dist/v1/runner/performActionsSteps.js
17330
+ var outOfTimeFailureReason = "out-of-time";
17331
+ var unconfirmedFailureReason = "action-unconfirmed";
17332
+ var actionIndexSchema = int().min(0).max(maxActionsPerRequest - 1).describe("Position of the action in the request's `actions`, from 0.");
17333
+ var screenshotAfterStep = screenshotImageSchema.optional();
17334
+ var performedStepSchema = object({
17335
+ effect: literal("performed"),
17336
+ imageJpegBase64: screenshotAfterStep,
17337
+ index: actionIndexSchema,
17338
+ outcome: literal("success")
17339
+ });
17340
+ var failedStepSchema = discriminatedUnion("failureReason", [
17341
+ object({
17342
+ effect: literal("not-performed"),
17343
+ errorMessage: string2().max(maxActionErrorMessageLength).describe("What stopped the action from taking effect."),
17344
+ failureReason: literal("action-failed"),
17345
+ imageJpegBase64: screenshotAfterStep,
17346
+ index: actionIndexSchema,
17347
+ outcome: literal("failure")
17348
+ }),
17349
+ object({
17350
+ effect: literal("unknown"),
17351
+ failureReason: literal(runnerUnreachableFailureReason),
17352
+ index: actionIndexSchema,
17353
+ outcome: literal("failure")
17354
+ }),
17355
+ object({
17356
+ effect: literal("unknown"),
17357
+ errorMessage: string2().max(maxActionErrorMessageLength).describe("How the runner's screen went quiet with the action in flight."),
17358
+ failureReason: literal(unconfirmedFailureReason),
17359
+ index: actionIndexSchema,
17360
+ outcome: literal("failure")
17361
+ }),
17362
+ object({
17363
+ effect: literal("not-performed"),
17364
+ failureReason: _enum([
17365
+ ...screenFailureReasons,
17366
+ "action-not-supported-on-mobile",
17367
+ outOfTimeFailureReason
17368
+ ]),
17369
+ index: actionIndexSchema,
17370
+ outcome: literal("failure")
17371
+ })
17372
+ ]);
17373
+ var stepResultSchema = discriminatedUnion("outcome", [
17374
+ performedStepSchema,
17375
+ failedStepSchema
17376
+ ]);
17377
+ var sequenceFailureReasons = [
17378
+ "action-failed",
17379
+ ...screenFailureReasons,
17380
+ "action-not-supported-on-mobile",
17381
+ outOfTimeFailureReason,
17382
+ unconfirmedFailureReason,
17383
+ runnerUnreachableFailureReason
17384
+ ];
17385
+
17386
+ // node_modules/@qawolf/api-contracts/dist/v1/runner/performActions.js
17387
+ var actionsDescription = `The actions to perform, in order, each exactly what \`runner.performAction\` takes: coordinates are whole pixels on the runner's virtual desktop, in the same space as \`runner.takeScreenshot\`, and the shapes follow the computer-use vocabulary. At most ${maxActionsPerRequest} per request. For when the next several steps are already known — click a field, type into it, press Enter — and one look at the screen at the end is enough. They run back to back on the runner, with no pause between them: put in one request only steps whose targets are all on the screen you last saw and are not moved by the steps before them, and when a step changes the page — a submit, a navigation, opening a menu — make it the last one and read the frame.`;
17388
+ var screenshotModeDescription = "`final`, the default, answers with one screenshot in `imageJpegBase64`: the screen after the last action, or, after a stop, as it stands. `each` puts a screenshot after every action on its entry in `results`, for when each step must be checked; every frame is a full image, so keep such sequences short. `none` sends no screenshot.";
17389
+ var stopOnFailureDescription = "`true`, the default, leaves the remaining actions unperformed once one fails. `false` carries on past an action that reached the runner and did not take effect (`action-failed`, `action-not-supported-on-mobile`), so use it only for actions that do not depend on each other: a `type` after a `click` that failed goes to whatever has focus. A runner that cannot be reached, a screen that cannot serve, or running out of time ends the sequence either way.";
17390
+ var finalImageDescription = "Present with `screenshotMode: final` when the runner still answered: the screen after the last action performed, or, after a stop, as it stands.";
17391
+ var makePerformActionsOnRunnerContract = (ids) => {
17392
+ const input = object({
17393
+ actions: array(browserActionSchema).min(1).max(maxActionsPerRequest).describe(actionsDescription),
17394
+ id: runnerIdSchema.describe("Id of the runner to act on."),
17395
+ screenshotMode: _enum(screenshotModes).optional().describe(screenshotModeDescription),
17396
+ stopOnFailure: boolean2().optional().describe(stopOnFailureDescription),
17397
+ workspaceId: ids.workspace.optional().describe(runnerWorkspaceIdDescription)
17398
+ });
17399
+ const output = discriminatedUnion("outcome", [
17400
+ object({
17401
+ imageJpegBase64: screenshotImageSchema.optional().describe(finalImageDescription),
17402
+ lastCompletedIndex: actionIndexSchema.describe("Index of the last action that took effect: here, the last one sent."),
17403
+ outcome: literal("success"),
17404
+ results: array(performedStepSchema).min(1).max(maxActionsPerRequest).describe("One entry per action, in order.")
17405
+ }),
17406
+ object({
17407
+ errorMessage: string2().max(maxActionErrorMessageLength).optional().describe("What stopped the first failed action, when its reason is `action-failed` or `action-unconfirmed`."),
17408
+ failedIndex: actionIndexSchema.describe("Index of the first action that did not take effect."),
17409
+ failureReason: _enum(sequenceFailureReasons).describe("Why that action did not take effect, the same as on its entry in `results`."),
17410
+ imageJpegBase64: screenshotImageSchema.optional().describe(finalImageDescription),
17411
+ lastCompletedIndex: actionIndexSchema.optional().describe("Index of the last action that took effect. Absent when none did. With `stopOnFailure: false` it can follow a failed action, so `results` says which ones before it took effect."),
17412
+ outcome: literal("failure"),
17413
+ results: array(stepResultSchema).min(1).max(maxActionsPerRequest).describe("One entry per action reached, in order. Actions after a stop have no entry."),
17414
+ stoppedEarly: boolean2().describe("Whether actions after the failure were left unperformed. False when every action was attempted.")
17415
+ })
17416
+ ]);
17417
+ return {
17418
+ annotations: {
17419
+ destructiveHint: true,
17420
+ openWorldHint: true,
17421
+ readOnlyHint: false
17422
+ },
17423
+ description: "Perform a sequence of raw browser actions on an interactive runner in one request, one after another, and answer with what happened to each. A `success` means every action took effect. A `failure` names the first action that did not (`failedIndex`, `failureReason`), the last one that did (`lastCompletedIndex`), and whether actions were left unperformed (`stoppedEarly`); `results` has one entry per action reached, in order. Read `effect` on an entry before sending its action again: `performed` means the runner did it; `not-performed` means the runner answered that it did not take effect, though a `navigate` that timed out may still be loading; `unknown` means the runner stopped answering with the action in flight (`runner-unreachable`), or its screen went quiet mid-action (`action-unconfirmed`), and it may have taken effect — a click that submitted a form, say — so take a screenshot instead of repeating it. A sequence gets about a minute to start its actions; an action it did not reach in time is `out-of-time`, nothing after it was attempted, and the rest can go in a new request. Everything `runner.performAction` says about a runner that has never run anything, a mobile runner, and the `screen-needs-a-run`, `screen-not-ready`, `runner-has-no-screen` and `action-not-supported-on-mobile` reasons holds for each action here.",
17424
+ input,
17425
+ kind: "write",
17426
+ name: "runner.performActions",
17427
+ output
17428
+ };
17429
+ };
17430
+
17431
+ // node_modules/@qawolf/api-contracts/dist/v1/runner/recording.js
17432
+ var recordingIdSchema = uuid2();
17433
+ var runnerRecordingCommandSchema = discriminatedUnion("action", [
17434
+ strictObject({
17435
+ action: literal("start"),
17436
+ recordingId: recordingIdSchema
17437
+ }),
17438
+ strictObject({ action: literal("stop"), recordingId: recordingIdSchema }),
17439
+ strictObject({ action: literal("auto"), enabled: boolean2() }),
17440
+ strictObject({ action: literal("status") })
17441
+ ]);
17442
+ var runnerRecordingSchema = object({
17443
+ endedAt: exports_iso.datetime(),
17444
+ id: recordingIdSchema,
17445
+ mode: _enum(["manual", "automatic"]),
17446
+ runIds: array(string2()),
17447
+ runnerId: runnerIdSchema,
17448
+ runnerInstanceId: uuid2(),
17449
+ startedAt: exports_iso.datetime(),
17450
+ status: _enum(["ready", "failed"]),
17451
+ version: literal(1)
17452
+ });
17453
+ var runnerRecordingStateSchema = object({
17454
+ active: object({
17455
+ id: recordingIdSchema,
17456
+ mode: _enum(["manual", "automatic"]),
17457
+ startedAt: exports_iso.datetime()
17458
+ }).optional(),
17459
+ auto: _enum(["on", "off", "default"])
17460
+ });
17461
+ var runnerRecordingResultSchema = discriminatedUnion("outcome", [
17462
+ object({
17463
+ outcome: literal("success"),
17464
+ recording: runnerRecordingSchema.optional(),
17465
+ state: runnerRecordingStateSchema
17466
+ }),
17467
+ object({
17468
+ failureReason: _enum([
17469
+ "unsupported",
17470
+ "screen-not-ready",
17471
+ "recording-in-progress",
17472
+ "recording-not-found",
17473
+ "recording-id-used",
17474
+ "runner-unreachable",
17475
+ "recording-failed"
17476
+ ]),
17477
+ outcome: literal("failure")
17478
+ })
17479
+ ]);
17480
+ var makeRecordOnRunnerContract = (ids) => {
17481
+ const input = object({
17482
+ command: runnerRecordingCommandSchema,
17483
+ id: runnerIdSchema,
17484
+ workspaceId: ids.workspace.optional().describe(runnerWorkspaceIdDescription)
17485
+ });
17486
+ const output = object({
17487
+ result: runnerRecordingResultSchema,
17488
+ url: url()
17489
+ });
17490
+ return {
17491
+ annotations: {
17492
+ destructiveHint: false,
17493
+ openWorldHint: false,
17494
+ readOnlyHint: false
17495
+ },
17496
+ description: "Control video recording on a Playwright runner. Start requires a caller-generated UUID; stop targets that UUID so retries cannot stop a later recording. Manual capture spans runs and suppresses automatic capture. Auto settings affect subsequent full runs. The URL opens recording history after the runner terminates. Videos may be unavailable after abrupt pod loss.",
17497
+ input,
17498
+ kind: "write",
17499
+ name: "runner.record",
17500
+ output
17501
+ };
17502
+ };
17503
+ var makeRunnerRecordingsContract = (ids) => {
17504
+ const input = object({
17505
+ id: runnerIdSchema,
17506
+ pageToken: string2().max(4096).optional(),
17507
+ recordingId: recordingIdSchema.optional(),
17508
+ workspaceId: ids.workspace.optional().describe(runnerWorkspaceIdDescription)
17509
+ });
17510
+ const output = object({
17511
+ nextPageToken: string2().optional(),
17512
+ recordings: array(runnerRecordingSchema.extend({
17513
+ url: url(),
17514
+ videoUrl: url().optional()
17515
+ }))
17516
+ });
17517
+ return {
17518
+ annotations: {
17519
+ destructiveHint: false,
17520
+ openWorldHint: false,
17521
+ readOnlyHint: true
17522
+ },
17523
+ description: "Read a runner's finalized recordings from workspace storage, including after the runner terminates. Omit recordingId to list recordings in storage-key order; follow nextPageToken for more. An empty list for a specific recording means it is not published or does not exist. Video URLs expire; platform URLs remain stable.",
17524
+ input,
17525
+ kind: "read",
17526
+ name: "runner.recordings",
17527
+ output
17528
+ };
17529
+ };
17530
+ function makeRecordingContracts(ids) {
17531
+ return {
17532
+ record: makeRecordOnRunnerContract(ids),
17533
+ recordings: makeRunnerRecordingsContract(ids)
17534
+ };
17535
+ }
17536
+
17237
17537
  // node_modules/@qawolf/api-contracts/dist/v1/runner/runSelection.js
17238
17538
  var runSelectionSchema = object({
17239
17539
  endLine: int().positive().describe("Last line to run, 1-indexed and inclusive."),
@@ -17252,7 +17552,16 @@ var isTimezone = (value) => {
17252
17552
  return false;
17253
17553
  }
17254
17554
  };
17255
- var triggerCadenceSchema = _enum(["hourly", "daily"]).describe("How often the schedule fires.");
17555
+ var triggerCadenceSchema = _enum(["hourly", "daily", "weekly"]).describe("How often the schedule fires.");
17556
+ var triggerDayOfWeekSchema = _enum([
17557
+ "monday",
17558
+ "tuesday",
17559
+ "wednesday",
17560
+ "thursday",
17561
+ "friday",
17562
+ "saturday",
17563
+ "sunday"
17564
+ ]).describe("A day of the week, named rather than numbered.");
17256
17565
  var triggerActionKindSchema = _enum(["createSuite", "generativeSuite"]).describe("createSuite runs the flows named by flowIds and tagNames. generativeSuite lets QA Wolf choose the flows from the deployment's changes, and is not available to a schedule.");
17257
17566
  var makeTriggerActionSchema = (ids) => object({
17258
17567
  flowIds: array(ids.flow).default([]).describe("Flows to run. Combined with tagNames."),
@@ -17264,10 +17573,11 @@ var makeTriggerActionSchema = (ids) => object({
17264
17573
  var makeTriggerScheduleFields = (ids) => ({
17265
17574
  action: makeTriggerActionSchema(ids),
17266
17575
  cadence: triggerCadenceSchema,
17576
+ dayOfWeek: triggerDayOfWeekSchema.optional().describe("The day a weekly schedule fires on, read in timezoneId. Required when cadence is weekly."),
17267
17577
  environmentId: ids.environmentId.describe("The environment the scheduled runs happen in."),
17268
17578
  minuteOfHour: number2().int().min(0).max(59).optional().describe("Minutes past the hour an hourly schedule fires. Defaults to 0."),
17269
- timeOfDay: string2().regex(/^([01]\d|2[0-3]):[0-5]\d$/).optional().describe('The wall clock time a daily schedule fires, as "HH:mm". Required when cadence is daily.'),
17270
- timezoneId: string2().min(1).refine(isTimezone, "Expected an IANA timezone, such as America/New_York.").optional().describe("The IANA timezone that timeOfDay is read in, such as America/New_York. Required when cadence is daily.")
17579
+ timeOfDay: string2().regex(/^([01]\d|2[0-3]):[0-5]\d$/).optional().describe('The wall clock time a daily or weekly schedule fires, as "HH:mm". Required when cadence is daily or weekly.'),
17580
+ timezoneId: string2().min(1).refine(isTimezone, "Expected an IANA timezone, such as America/New_York.").optional().describe("The IANA timezone that timeOfDay is read in, such as America/New_York. Required when cadence is daily or weekly.")
17271
17581
  });
17272
17582
  var makeTriggerDeploymentFields = (ids) => ({
17273
17583
  action: makeTriggerActionSchema(ids),
@@ -17277,6 +17587,98 @@ var makeTriggerDeploymentFields = (ids) => ({
17277
17587
  environmentPattern: string2().min(1).optional().describe("Only fire for deployments to environments matching this pattern. Mutually exclusive with environmentIds.")
17278
17588
  });
17279
17589
 
17590
+ // node_modules/@qawolf/api-contracts/dist/v1/trigger/configurationRules.js
17591
+ var checkAction = (action, ctx) => {
17592
+ const namesFlows = action.flowIds.length + action.tagNames.length > 0;
17593
+ if (action.kind === "generativeSuite") {
17594
+ if (namesFlows) {
17595
+ ctx.addIssue({
17596
+ code: "custom",
17597
+ message: "flowIds and tagNames do not apply when the action is generativeSuite.",
17598
+ path: ["action", "flowIds"]
17599
+ });
17600
+ }
17601
+ return;
17602
+ }
17603
+ if (action.instructions !== undefined) {
17604
+ ctx.addIssue({
17605
+ code: "custom",
17606
+ message: "instructions apply to a generativeSuite action only.",
17607
+ path: ["action", "instructions"]
17608
+ });
17609
+ }
17610
+ if (!namesFlows) {
17611
+ ctx.addIssue({
17612
+ code: "custom",
17613
+ message: "At least one flow or tag is required.",
17614
+ path: ["action", "flowIds"]
17615
+ });
17616
+ }
17617
+ };
17618
+ var requiredScheduleFields = {
17619
+ daily: ["timeOfDay", "timezoneId"],
17620
+ hourly: [],
17621
+ weekly: ["dayOfWeek", "timeOfDay", "timezoneId"]
17622
+ };
17623
+ var cadencesUsingField = {
17624
+ dayOfWeek: "a weekly cadence",
17625
+ minuteOfHour: "an hourly cadence",
17626
+ timeOfDay: "a daily or weekly cadence",
17627
+ timezoneId: "a daily or weekly cadence"
17628
+ };
17629
+ var scheduleFields = [
17630
+ "dayOfWeek",
17631
+ "minuteOfHour",
17632
+ "timeOfDay",
17633
+ "timezoneId"
17634
+ ];
17635
+ var checkScheduleFields = (value, ctx) => {
17636
+ const required = requiredScheduleFields[value.cadence];
17637
+ for (const field of scheduleFields) {
17638
+ const isSupplied = value[field] !== undefined;
17639
+ if (required.includes(field)) {
17640
+ if (!isSupplied) {
17641
+ ctx.addIssue({
17642
+ code: "custom",
17643
+ message: `${field} is required when cadence is ${value.cadence}.`,
17644
+ path: [field]
17645
+ });
17646
+ }
17647
+ continue;
17648
+ }
17649
+ if (isSupplied && !(value.cadence === "hourly" && field === "minuteOfHour")) {
17650
+ ctx.addIssue({
17651
+ code: "custom",
17652
+ message: `${field} applies to ${cadencesUsingField[field]} only.`,
17653
+ path: [field]
17654
+ });
17655
+ }
17656
+ }
17657
+ };
17658
+ var checkSchedule = (value, ctx) => {
17659
+ checkScheduleFields(value, ctx);
17660
+ if (value.action.kind === "generativeSuite") {
17661
+ ctx.addIssue({
17662
+ code: "custom",
17663
+ message: "A schedule trigger cannot use a generativeSuite action.",
17664
+ path: ["action", "kind"]
17665
+ });
17666
+ return;
17667
+ }
17668
+ checkAction(value.action, ctx);
17669
+ };
17670
+ var checkDeployment = (value, ctx) => {
17671
+ if (value.environmentPattern !== undefined && value.environmentIds.length > 0) {
17672
+ ctx.addIssue({
17673
+ code: "custom",
17674
+ message: "Supply environmentIds or environmentPattern, not both.",
17675
+ path: ["environmentPattern"]
17676
+ });
17677
+ }
17678
+ checkAction(value.action, ctx);
17679
+ };
17680
+ var checkTriggerConfiguration = (value, ctx) => value.kind === "schedule" ? checkSchedule(value, ctx) : checkDeployment(value, ctx);
17681
+
17280
17682
  // node_modules/@qawolf/api-contracts/dist/v1/trigger/resource.js
17281
17683
  var makeTriggerConfigurationSchema = (ids) => discriminatedUnion("kind", [
17282
17684
  object({
@@ -17306,19 +17708,51 @@ var makeTriggerResourceSchema = (ids) => resource({
17306
17708
  pausedAt: exports_iso.datetime().optional().describe("When it was paused."),
17307
17709
  updatedAt: exports_iso.datetime()
17308
17710
  }, { urlFieldDescription: "Absolute URL of the team's triggers page." });
17309
- // node_modules/@qawolf/api-contracts/dist/v1/agent/get.js
17310
- var makeAgentGetContract = (ids) => {
17711
+
17712
+ // node_modules/@qawolf/api-contracts/dist/v1/trigger/create.js
17713
+ var makeCreateTriggerContract = (ids) => {
17714
+ const commonFields = {
17715
+ name: string2().trim().min(1).max(255),
17716
+ workspaceId: ids.workspace.optional().describe("The workspace to create the trigger in. Required when authenticating with an organization or user API key.")
17717
+ };
17718
+ const input = discriminatedUnion("kind", [
17719
+ object({
17720
+ ...commonFields,
17721
+ ...makeTriggerScheduleFields({
17722
+ environmentId: ids.environmentRef,
17723
+ flow: ids.flow
17724
+ }),
17725
+ kind: literal("schedule")
17726
+ }),
17727
+ object({
17728
+ ...commonFields,
17729
+ ...makeTriggerDeploymentFields(ids),
17730
+ kind: literal("deployment")
17731
+ })
17732
+ ]).superRefine(checkTriggerConfiguration);
17733
+ const output = object({ trigger: makeTriggerResourceSchema(ids) });
17734
+ return {
17735
+ annotations: {
17736
+ destructiveHint: true,
17737
+ openWorldHint: true,
17738
+ readOnlyHint: false
17739
+ },
17740
+ description: "Create a trigger. A schedule trigger runs a named set of flows on a cadence; " + "a deployment trigger runs when a matching deployment is reported.",
17741
+ input,
17742
+ kind: "write",
17743
+ name: "trigger.create",
17744
+ output
17745
+ };
17746
+ };
17747
+
17748
+ // node_modules/@qawolf/api-contracts/dist/v1/trigger/find.js
17749
+ var makeFindTriggersContract = (ids) => {
17311
17750
  const input = object({
17312
- cursor: string2().min(1).optional().describe("Opaque cursor copied from this same session's previous nextCursor. Omit to read from its first reply."),
17313
- sessionId: ids.chatSession.describe("The id agent.send answered with.")
17751
+ isPaused: boolean2().optional().describe("Only list paused, or only unpaused, triggers. Omit for both."),
17752
+ workspaceId: ids.workspace.optional().describe("The workspace to list triggers from. Required when authenticating with an organization or user API key.")
17314
17753
  });
17315
- const output = resource({
17316
- 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."),
17317
- replies: array(agentReplySchema).describe("What the AI has said since the cursor, oldest first. A reply still being written returns again, longer. A reply carrying choices is a question the work is blocked on."),
17318
- sessionId: ids.chatSession,
17319
- status: agentSessionStatusSchema
17320
- }, {
17321
- urlFieldDescription: "Absolute URL of the live session in the QA Wolf app."
17754
+ const output = object({
17755
+ triggers: array(makeTriggerResourceSchema(ids)).describe("The team's triggers, newest first.")
17322
17756
  });
17323
17757
  return {
17324
17758
  annotations: {
@@ -17326,22 +17760,171 @@ var makeAgentGetContract = (ids) => {
17326
17760
  openWorldHint: false,
17327
17761
  readOnlyHint: true
17328
17762
  },
17329
- description: 'Monitor a QA Wolf AI session by reading its status and replies. After agent.send, share the returned session URL before monitoring. Wait 30 to 60 seconds between checks; do not call this in a tight loop. Pass the nextCursor from one response as the cursor on the next check; it then reads only what is new, and only for the session that minted it. Continue monitoring silently when the status is unchanged and no replies come back; do not narrate waiting, announce the next check, or ask whether to keep monitoring. Report only substantive new progress, questions, blockers, or the final outcome. A status of "waiting-for-you" means the last reply is a question the work is blocked on, and answering it with agent.send is what unblocks it. Surface an explicit request for user input even if the status still says "working". Include the session URL when reporting a blocker or final outcome. On "completed", stop status checks and verify the requested result before claiming success. For new flows, validation, publication in the target environment, and readiness are separate checks; a Git push or final reply does not prove the flow is active. If every requested result is verified but status remains "working", report the mismatch and stop monitoring. Stop on "failed" or "cancelled" and report any confirmed partial result.',
17763
+ description: "List the team's triggers, newest first.",
17330
17764
  input,
17331
17765
  kind: "read",
17332
- name: "agent.get",
17766
+ name: "trigger.find",
17333
17767
  output
17334
17768
  };
17335
17769
  };
17336
17770
 
17337
- // node_modules/@qawolf/api-contracts/dist/v1/agent/send.js
17338
- var makeAgentSendContract = (ids) => {
17339
- const input = object({
17340
- environmentId: ids.environmentRef.optional().describe("The environment to work in. Omit to use the team's default environment. Ignored when sessionId is given, because a session keeps the environment it opened in."),
17341
- filePaths: array(teamStoragePathSchema).max(20).optional().describe("Paths of files this request is about, from file.requestUpload. The AI reads them from storage rather than the message, so a plan of hundreds of journeys costs nothing to send."),
17342
- message: string2().trim().min(1).max(1e4).describe("What you want QA Wolf to do, in plain language. Name the journey, the part of the app it covers, and anything the AI cannot discover for itself, such as a test account, a feature flag, or how to reach a staging environment. When answering a question from agent.get, send the answer here."),
17343
- sessionId: ids.chatSession.optional().describe("Continue the session with this id instead of opening a new one. Omit to start fresh. Send this to answer a question or to add context to work already running."),
17344
- workspaceId: ids.workspace.optional().describe("The workspace to work in. Required when authenticating with an organization or user API key.")
17771
+ // node_modules/@qawolf/api-contracts/dist/v1/trigger/get.js
17772
+ var makeGetTriggerContract = (ids) => {
17773
+ const input = object({ triggerId: ids.trigger });
17774
+ const output = object({ trigger: makeTriggerResourceSchema(ids) });
17775
+ return {
17776
+ annotations: {
17777
+ destructiveHint: false,
17778
+ openWorldHint: false,
17779
+ readOnlyHint: true
17780
+ },
17781
+ description: "Get one trigger by id.",
17782
+ input,
17783
+ kind: "read",
17784
+ name: "trigger.get",
17785
+ output
17786
+ };
17787
+ };
17788
+
17789
+ // node_modules/@qawolf/api-contracts/dist/v1/trigger/lifecycle.js
17790
+ var makePauseTriggerContract = (ids) => {
17791
+ const input = object({ triggerId: ids.trigger });
17792
+ const output = object({ trigger: makeTriggerResourceSchema(ids) });
17793
+ return {
17794
+ annotations: {
17795
+ destructiveHint: true,
17796
+ openWorldHint: false,
17797
+ readOnlyHint: false
17798
+ },
17799
+ description: "Pause a trigger so it stops firing. Pausing is idempotent. A team whose " + "triggers are all paused reports no trigger activity at all.",
17800
+ input,
17801
+ kind: "write",
17802
+ name: "trigger.pause",
17803
+ output
17804
+ };
17805
+ };
17806
+ var makeResumeTriggerContract = (ids) => {
17807
+ const input = object({ triggerId: ids.trigger });
17808
+ const output = object({ trigger: makeTriggerResourceSchema(ids) });
17809
+ return {
17810
+ annotations: {
17811
+ destructiveHint: true,
17812
+ openWorldHint: true,
17813
+ readOnlyHint: false
17814
+ },
17815
+ description: "Resume a paused trigger. A schedule trigger restarts from the next " + "upcoming slot: the slots it missed while paused do not run.",
17816
+ input,
17817
+ kind: "write",
17818
+ name: "trigger.resume",
17819
+ output
17820
+ };
17821
+ };
17822
+ var makeDeleteTriggerContract = (ids) => {
17823
+ const input = object({ triggerId: ids.trigger });
17824
+ const output = object({
17825
+ triggerId: ids.trigger.describe("The id of the deleted trigger.")
17826
+ });
17827
+ return {
17828
+ annotations: {
17829
+ destructiveHint: true,
17830
+ openWorldHint: false,
17831
+ readOnlyHint: false
17832
+ },
17833
+ description: "Delete a trigger permanently. The runs it already created are kept. " + "To stop a trigger without losing it, use trigger.pause.",
17834
+ input,
17835
+ kind: "write",
17836
+ name: "trigger.delete",
17837
+ output
17838
+ };
17839
+ };
17840
+
17841
+ // node_modules/@qawolf/api-contracts/dist/v1/trigger/update.js
17842
+ var makeUpdateTriggerContract = (ids) => {
17843
+ const commonFields = {
17844
+ name: string2().trim().min(1).max(255),
17845
+ triggerId: ids.trigger
17846
+ };
17847
+ const input = discriminatedUnion("kind", [
17848
+ object({
17849
+ ...commonFields,
17850
+ ...makeTriggerScheduleFields({
17851
+ environmentId: ids.environmentRef,
17852
+ flow: ids.flow
17853
+ }),
17854
+ kind: literal("schedule")
17855
+ }),
17856
+ object({
17857
+ ...commonFields,
17858
+ ...makeTriggerDeploymentFields(ids),
17859
+ kind: literal("deployment")
17860
+ })
17861
+ ]).superRefine(checkTriggerConfiguration);
17862
+ const output = object({ trigger: makeTriggerResourceSchema(ids) });
17863
+ return {
17864
+ annotations: {
17865
+ destructiveHint: true,
17866
+ openWorldHint: true,
17867
+ readOnlyHint: false
17868
+ },
17869
+ description: "Replace a trigger's configuration. Every field is written, so read the " + "trigger first and send its configuration back with your changes applied. " + "Pausing is separate: use trigger.pause and trigger.resume.",
17870
+ input,
17871
+ kind: "write",
17872
+ name: "trigger.update",
17873
+ output
17874
+ };
17875
+ };
17876
+
17877
+ // node_modules/@qawolf/api-contracts/dist/v1/trigger/index.js
17878
+ var makeTriggerContracts = (ids) => ({
17879
+ create: makeCreateTriggerContract(ids),
17880
+ delete: makeDeleteTriggerContract(ids),
17881
+ find: makeFindTriggersContract(ids),
17882
+ get: makeGetTriggerContract(ids),
17883
+ pause: makePauseTriggerContract(ids),
17884
+ resume: makeResumeTriggerContract(ids),
17885
+ update: makeUpdateTriggerContract(ids)
17886
+ });
17887
+ // node_modules/@qawolf/api-contracts/dist/v1/agent/get.js
17888
+ var makeAgentGetContract = (ids) => {
17889
+ const input = object({
17890
+ cursor: string2().min(1).optional().describe("Opaque cursor copied from this same session's previous nextCursor. Omit to read from its first reply."),
17891
+ sessionId: ids.chatSession.describe("The id agent.send answered with."),
17892
+ 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.`)
17893
+ });
17894
+ const output = resource({
17895
+ 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."),
17896
+ replies: array(agentReplySchema).describe("What the AI has said since the cursor, oldest first. A reply still being written returns again, longer. A reply carrying choices is a question the work is blocked on."),
17897
+ sessionId: ids.chatSession,
17898
+ status: agentSessionStatusSchema,
17899
+ waitSeconds: number2().int().optional().describe("The hold this check was allowed, in seconds, after clamping. Absent when the check did not wait."),
17900
+ wokeOn: agentWakeReasonSchema.optional().describe('Why this check answered when it did. Absent when the check did not wait. "timeout" means nothing new: replies is empty and nextCursor unchanged, so check again with the same cursor.')
17901
+ }, {
17902
+ urlFieldDescription: "Absolute URL of the live session in the QA Wolf app."
17903
+ });
17904
+ return {
17905
+ annotations: {
17906
+ destructiveHint: false,
17907
+ openWorldHint: false,
17908
+ readOnlyHint: true
17909
+ },
17910
+ description: 'Monitor a QA Wolf AI session by reading its status and replies. After agent.send, share the returned session URL before monitoring. Pass waitSeconds 45 so the server holds the check open and answers the moment something happens. Check again as soon as it returns; never sleep between checks or loop without waitSeconds. Pass the nextCursor from one response as the cursor on the next check; it then reads only what is new, and only for the session that minted it. Continue monitoring silently when the status is unchanged and no replies come back; do not narrate waiting, announce the next check, or ask whether to keep monitoring. Report only substantive new progress, questions, blockers, or the final outcome. A status of "waiting-for-you" means the last reply is a question the work is blocked on, and answering it with agent.send is what unblocks it. Surface an explicit request for user input even if the status still says "working". Include the session URL when reporting a blocker or final outcome. On "completed", stop status checks and verify the requested result before claiming success. For new flows, validation, publication in the target environment, and readiness are separate checks; a Git push or final reply does not prove the flow is active. If every requested result is verified but status remains "working", report the mismatch and stop monitoring. Stop on "failed" or "cancelled" and report any confirmed partial result.',
17911
+ input,
17912
+ kind: "read",
17913
+ name: "agent.get",
17914
+ output
17915
+ };
17916
+ };
17917
+
17918
+ // node_modules/@qawolf/api-contracts/dist/v1/agent/send.js
17919
+ var makeAgentSendContract = (ids) => {
17920
+ const input = object({
17921
+ environmentId: ids.environmentRef.optional().describe("The environment to work in. Omit to use the team's default environment. Ignored when sessionId is given, because a session keeps the environment it opened in."),
17922
+ filePaths: array(teamStoragePathSchema).max(20).optional().describe("Paths of files this request is about, from file.requestUpload. The AI reads them from storage rather than the message, so a plan of hundreds of journeys costs nothing to send."),
17923
+ message: string2().trim().min(1).max(1e4).describe("What you want QA Wolf to do, in plain language. Name the journey, the part of the app it covers, and anything the AI cannot discover for itself, such as a test account, a feature flag, or how to reach a staging environment. When answering a question from agent.get, send the answer here."),
17924
+ parentSessionId: ids.chatSession.optional().describe("The session that is starting this one. QA Wolf lists the new session underneath it, so whoever is watching that session can open the work it handed out. The session you name must not itself have been started this way, because a sub-session cannot start sub-sessions of its own. Ignored when sessionId is given, since continuing a session does not change what started it."),
17925
+ runnerId: runnerIdSchema.optional().describe("The runner you explored on, from runner.launch. Pass it to hand that browser to QA Wolf instead of having a fresh one started, so the pages you opened and any sign-in the user completed there are carried over. Leave the runner running: QA Wolf takes it over and terminates it when the work is done. Omit this when you have no runner, or when you already terminated it."),
17926
+ sessionId: ids.chatSession.optional().describe("Continue the session with this id instead of opening a new one. Omit to start fresh. Send this to answer a question or to add context to work already running."),
17927
+ workspaceId: ids.workspace.optional().describe("The workspace to work in. Required when authenticating with an organization or user API key.")
17345
17928
  });
17346
17929
  const output = resource({
17347
17930
  sessionId: ids.chatSession.describe("Follow the work by passing this to agent.get."),
@@ -17355,7 +17938,7 @@ var makeAgentSendContract = (ids) => {
17355
17938
  openWorldHint: true,
17356
17939
  readOnlyHint: false
17357
17940
  },
17358
- description: "Start or continue work with the QA Wolf AI and return a live session URL to share with the user. Use it to cover a user journey, investigate a failing run, or fix a broken flow. This is the one verb that starts work from nothing: every other write acts on a flow, run or issue that already exists. Returns sessionId, status, and url as soon as the request is accepted; work can take minutes to tens of minutes. After each send, make the next action a normal user-visible assistant message containing the exact returned url, before any tool call or wait. Tool output and internal reasoning do not count as sharing the link. Do not run a timer or monitoring call alongside this send. Acceptance does not mean the work is complete. Then monitor the session with agent.get, reporting new progress, blockers, and the final outcome rather than unchanged status. Send here again to answer a question or add context to the same session.",
17941
+ description: "Start or continue work with the QA Wolf AI and return a live session URL to share with the user. Use it to cover a user journey, investigate a failing run, or fix a broken flow. This is the one verb that starts work from nothing: every other write acts on a flow, run or issue that already exists. Returns sessionId, status, and url as soon as the request is accepted; work can take minutes to tens of minutes. After each send, put the exact returned url in a normal user-visible assistant message, and repeat it in the last message of the turn: only a turn's trailing message is shown expanded. Tool output and internal reasoning do not count as sharing the link. Do not run a timer or monitoring call alongside this send. Acceptance does not mean the work is complete. Then monitor the session with agent.get, reporting new progress, blockers, and the final outcome rather than unchanged status. Send here again to answer a question or add context to the same session.",
17359
17942
  input,
17360
17943
  kind: "write",
17361
17944
  name: "agent.send",
@@ -17363,25 +17946,40 @@ var makeAgentSendContract = (ids) => {
17363
17946
  };
17364
17947
  };
17365
17948
 
17366
- // node_modules/@qawolf/api-contracts/dist/v1/automate/index.js
17367
- var makeAutomateContract = (ids) => {
17949
+ // node_modules/@qawolf/api-contracts/dist/v1/codeHostIntegration/resource.js
17950
+ var makeCodeHostIntegrationResourceSchema = () => resource({
17951
+ connectedAt: exports_iso.datetime().describe("When the code host was connected to the workspace."),
17952
+ provider: _enum(["github", "gitlab"]).describe("The code host this integration connects."),
17953
+ suspendedAt: exports_iso.datetime().optional().describe("Set while GitHub has the QA Wolf app installation suspended. While suspended, GitHub sends QA Wolf no webhooks.")
17954
+ }, {
17955
+ urlFieldDescription: "Absolute URL of the workspace's integrations settings page."
17956
+ });
17957
+ var makeCodeHostRepositoryResourceSchema = () => resource({
17958
+ fullName: string2().describe(`The repository's full name on the code host, such as "acme/storefront".`),
17959
+ provider: _enum(["github", "gitlab"]).describe("The code host the covering integration connects.")
17960
+ }, {
17961
+ urlFieldDescription: "Absolute URL of the workspace's integrations settings page."
17962
+ });
17963
+
17964
+ // node_modules/@qawolf/api-contracts/dist/v1/codeHostIntegration/find.js
17965
+ var makeFindCodeHostIntegrationsContract = (ids) => {
17368
17966
  const input = object({
17369
- aiTaskId: ids.aiTask.describe("The AI task to build the automation on: drafts are read from and the automation branches off the task's branch instead of the environment's.").optional(),
17370
- environmentId: ids.environmentRef,
17371
- flowIds: array(ids.flow).min(1).max(300).refine((flowIds) => new Set(flowIds).size === flowIds.length, "flowIds must be unique").describe("IDs of every requested draft flow the automation builds. Reuse an existing draft only when its name matches the requested journey; a generic starter or placeholder is not a match. After publishing, resolve the IDs with `qawolf --json flows list --remote --env <environment-id-or-alias> --include-drafts`, adding `--ai-task-id` when the drafts live on an AI task's branch."),
17372
- patch: string2().min(1).max(1e6).optional().describe("Unified diff applied to the automation's working branch before it runs. It cannot create or rename a selected flow; publish selected flows with Git first.")
17967
+ workspaceId: ids.workspace.optional().describe("The workspace to list code host integrations from. Required when authenticating with an organization or user API key.")
17968
+ });
17969
+ const output = object({
17970
+ integrations: array(makeCodeHostIntegrationResourceSchema()).describe("The workspace's code host integrations. Empty when no code host is connected."),
17971
+ settingsUrl: url().describe("Absolute URL of the workspace's integrations settings page.")
17373
17972
  });
17374
- const output = resource({ automationId: ids.automation }, { urlFieldDescription: "Absolute URL of the automation review page." });
17375
17973
  return {
17376
17974
  annotations: {
17377
- destructiveHint: true,
17378
- openWorldHint: true,
17379
- readOnlyHint: false
17975
+ destructiveHint: false,
17976
+ openWorldHint: false,
17977
+ readOnlyHint: true
17380
17978
  },
17381
- description: "Request automation for draft flows. First create a named local .flow.ts draft for every requested journey that does not already have a matching draft; never reuse a generic starter or placeholder. Each new draft must start with a JSDoc Goal: description, import flow from @qawolf/flows/web, and use export default flow(...); a comment-only file or direct test(...) call is not a valid draft. Commit and push all changes with Git to publish them, then list remote drafts to resolve every selected ID. Do not use patch to create or rename a selected flow. Finally make one automation request containing all requested flow IDs.",
17979
+ description: "List the workspace's code host integrations (GitHub or GitLab). A connected integration lets QA Wolf read repositories and receive the code host's webhooks. codeHostIntegration.listRepositories pages the repositories each integration covers.",
17382
17980
  input,
17383
- kind: "write",
17384
- name: "automate",
17981
+ kind: "read",
17982
+ name: "codeHostIntegration.find",
17385
17983
  output
17386
17984
  };
17387
17985
  };
@@ -17393,6 +17991,221 @@ var makePaginationInputFields = (limits) => ({
17393
17991
  });
17394
17992
  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.");
17395
17993
 
17994
+ // node_modules/@qawolf/api-contracts/dist/v1/codeHostIntegration/listRepositories.js
17995
+ var makeListCodeHostRepositoriesContract = (ids) => {
17996
+ const input = object({
17997
+ provider: _enum(["github", "gitlab"]).optional().describe("Only list repositories covered by this code host's integration. Omit for all."),
17998
+ workspaceId: ids.workspace.optional().describe("The workspace to list covered repositories from. Required when authenticating with an organization or user API key."),
17999
+ ...makePaginationInputFields({ defaultLimit: 20, maxLimit: 100 })
18000
+ });
18001
+ const output = object({
18002
+ nextCursor: nextCursorSchema,
18003
+ repositories: array(makeCodeHostRepositoryResourceSchema()).describe("The repositories the workspace's code host integrations cover, alphabetical by full name.")
18004
+ });
18005
+ return {
18006
+ annotations: {
18007
+ destructiveHint: false,
18008
+ openWorldHint: false,
18009
+ readOnlyHint: true
18010
+ },
18011
+ description: "List the repositories the workspace's code host integrations cover, alphabetical by full name. The list reflects the last sync from the code host; codeHostIntegration.find lists the integrations themselves.",
18012
+ input,
18013
+ kind: "read",
18014
+ name: "codeHostIntegration.listRepositories",
18015
+ output
18016
+ };
18017
+ };
18018
+
18019
+ // node_modules/@qawolf/api-contracts/dist/v1/deployment/resource.js
18020
+ var makeDeploymentResourceSchema = (ids) => resource({
18021
+ branch: string2().optional().describe("The git branch the deployed commit is on. Absent when neither the deployer nor the code host declared one."),
18022
+ commitAuthorName: string2().optional().describe("The author of the deployed commit."),
18023
+ commitMessage: string2().optional().describe("The message of the deployed commit."),
18024
+ commitSha: string2().optional().describe("The sha of the deployed commit."),
18025
+ deployedAt: exports_iso.datetime().describe("When QA Wolf first received the deployment."),
18026
+ 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."),
18027
+ environmentId: ids.environment.describe("The QA Wolf environment the deployment reported into."),
18028
+ environmentName: string2().optional().describe("The environment's name. Absent when the environment has since been deleted."),
18029
+ id: ids.deployment,
18030
+ provider: _enum(["github", "gitlab", "api"]).optional().describe("How QA Wolf received the deployment: a GitHub webhook, a GitLab webhook, or the deployment.reportStatus API."),
18031
+ 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.")
18032
+ }, {
18033
+ urlFieldDescription: "Absolute URL of the workspace's deployments page."
18034
+ });
18035
+
18036
+ // node_modules/@qawolf/api-contracts/dist/v1/deployment/find.js
18037
+ var makeFindDeploymentsContract = (ids) => {
18038
+ const input = object({
18039
+ workspaceId: ids.workspace.optional().describe("The workspace to list deployments from. Required when authenticating with an organization or user API key."),
18040
+ ...makePaginationInputFields({ defaultLimit: 20, maxLimit: 100 })
18041
+ });
18042
+ const output = object({
18043
+ deployments: array(makeDeploymentResourceSchema(ids)).describe("The workspace's deployments, newest first."),
18044
+ nextCursor: nextCursorSchema
18045
+ });
18046
+ return {
18047
+ annotations: {
18048
+ destructiveHint: false,
18049
+ openWorldHint: false,
18050
+ readOnlyHint: true
18051
+ },
18052
+ description: "List the deployments QA Wolf has received for the workspace, newest first. A deployment arrives through a code host integration's webhook or through deployment.reportStatus, and is what a deployment trigger evaluates against. deployment.listTriggerEvaluations reports each trigger's verdict for one deployment.",
18053
+ input,
18054
+ kind: "read",
18055
+ name: "deployment.find",
18056
+ output
18057
+ };
18058
+ };
18059
+
18060
+ // node_modules/@qawolf/api-contracts/dist/v1/deployment/listTriggerEvaluations.js
18061
+ var conditionKindSchema = _enum(["environment", "deployTarget", "branch"]).describe("What the condition checks on the deployment: the environment it reported into, the deploy target identifying the deployed app, or the git branch of the deployed commit.");
18062
+ var conditionVerdictSchema = discriminatedUnion("outcome", [
18063
+ object({
18064
+ kind: conditionKindSchema,
18065
+ outcome: literal("matched")
18066
+ }),
18067
+ object({
18068
+ kind: conditionKindSchema,
18069
+ outcome: literal("did-not-match"),
18070
+ reason: string2().describe("Why the condition did not match this deployment, in plain language.")
18071
+ })
18072
+ ]);
18073
+ var conditionSetsField = array(object({
18074
+ conditions: array(conditionVerdictSchema).describe("One verdict per condition. Conditions in a set are ANDed; a set with no conditions matches every deployment."),
18075
+ outcome: _enum(["matched", "did-not-match"]).describe("Whether every condition in the set matched.")
18076
+ })).describe("The trigger's condition sets as they were when the deployment was evaluated, each with per-condition verdicts. Sets are ORed: the trigger matches when any one set matches. Most triggers have exactly one set.");
18077
+ var makeRunOutcomeSchema = (ids) => discriminatedUnion("status", [
18078
+ object({
18079
+ runId: ids.run.describe("The run the trigger created."),
18080
+ status: literal("ran")
18081
+ }),
18082
+ object({ status: literal("starting") }),
18083
+ object({
18084
+ reason: string2().describe("Why the matched trigger created no run, in plain language."),
18085
+ status: literal("did-not-run"),
18086
+ supersededByRunId: ids.run.optional().describe("The run that covered this deployment instead, when an earlier delivery of the same deployment had already created one.")
18087
+ }),
18088
+ object({ status: literal("unknown") })
18089
+ ]).describe("What became of the match. Matching is not running: a matched trigger can still be stopped from creating a run, and did-not-run carries the reason. starting means run creation is still in progress; unknown means QA Wolf has no record of what followed the match.");
18090
+ var makeVerdictSchema = (ids) => discriminatedUnion("outcome", [
18091
+ object({
18092
+ conditionSets: conditionSetsField,
18093
+ outcome: literal("matched"),
18094
+ run: makeRunOutcomeSchema(ids)
18095
+ }),
18096
+ object({
18097
+ conditionSets: conditionSetsField,
18098
+ outcome: literal("did-not-match")
18099
+ }),
18100
+ object({
18101
+ outcome: literal("not-considered"),
18102
+ reason: _enum(["trigger-paused", "not-a-deployment-trigger"]).describe("Why the conditions were never checked. trigger-paused: the trigger was paused when the deployment was evaluated. not-a-deployment-trigger: the trigger has no deployment conditions (a schedule trigger, for example), so no deployment can fire it.")
18103
+ })
18104
+ ]).describe("The trigger's verdict for this deployment: matched, did-not-match with per-condition verdicts, or not-considered when the conditions were never checked at all.");
18105
+ var makeEvaluationSchema = (ids) => object({
18106
+ triggerId: ids.trigger.optional().describe("Absent when the trigger has been deleted since."),
18107
+ triggerName: string2().describe("The trigger's name when the deployment was evaluated."),
18108
+ verdict: makeVerdictSchema(ids)
18109
+ });
18110
+ var makeListDeploymentTriggerEvaluationsContract = (ids) => {
18111
+ const input = object({ deploymentId: ids.deployment });
18112
+ const output = discriminatedUnion("state", [
18113
+ object({
18114
+ evaluations: array(makeEvaluationSchema(ids)).describe("One verdict per trigger that existed when the deployment was evaluated."),
18115
+ state: literal("evaluated")
18116
+ }),
18117
+ object({ state: literal("not-evaluated") }).describe("Triggers were never evaluated for this deployment. Only a deployment's first success report evaluates triggers, so a deployment that never reported success carries no verdicts.")
18118
+ ]);
18119
+ return {
18120
+ annotations: {
18121
+ destructiveHint: false,
18122
+ openWorldHint: false,
18123
+ readOnlyHint: true
18124
+ },
18125
+ description: "List the per-trigger verdicts recorded when a deployment was evaluated against the workspace's triggers. Each verdict says whether the trigger matched, did not match with the reason per condition, or was never considered and why. Verdicts are a snapshot from evaluation time: editing or deleting a trigger later does not change them.",
18126
+ input,
18127
+ kind: "read",
18128
+ name: "deployment.listTriggerEvaluations",
18129
+ output
18130
+ };
18131
+ };
18132
+
18133
+ // node_modules/@qawolf/api-contracts/dist/v1/deployment/reportStatusMetadata.js
18134
+ var deploymentReportMetadata = strictObject({
18135
+ commitAuthorName: string2().trim().min(1).max(255).describe("The display name of the person who authored the deployed commit.").optional(),
18136
+ commitMessage: string2().trim().min(1).max(2048).describe("The message of the deployed commit. The deployments list shows its first line.").optional(),
18137
+ commitSha: string2().trim().min(1).max(255).describe("The commit sha of the deployed application revision.").optional(),
18138
+ pullRequestNumber: number2().int().positive().describe("The number of the pull request the deployment belongs to. Requires repository.").optional(),
18139
+ ref: string2().trim().min(1).max(255).describe("The branch or ref that was deployed.").optional(),
18140
+ repository: string2().trim().min(1).max(255).describe('The owner/name of the repository, e.g. "acme/web".').optional()
18141
+ }).refine((value) => value.pullRequestNumber === undefined || value.repository !== undefined, {
18142
+ message: "repository is required when pullRequestNumber is provided.",
18143
+ path: ["pullRequestNumber"]
18144
+ });
18145
+
18146
+ // node_modules/@qawolf/api-contracts/dist/v1/deployment/reportStatus.js
18147
+ var deploymentStatusSchema = _enum([
18148
+ "pending",
18149
+ "success",
18150
+ "failure",
18151
+ "inactive"
18152
+ ]);
18153
+ var makeReportDeploymentStatusContract = (ids) => {
18154
+ const environment = union([
18155
+ strictObject({
18156
+ id: ids.environment.describe("The id of an existing environment. Never creates an environment. Send an alias through name instead.")
18157
+ }),
18158
+ strictObject({
18159
+ baseEphemeralEnvironment: string2().trim().min(1).max(255).describe("The alias or name of the environment a created ephemeral environment copies from. Only valid with ephemeral. The server uses the team default base environment when no environment matches this value.").optional(),
18160
+ ephemeral: boolean2().describe("Requests an ephemeral environment when the name creates one. A name that matches an existing environment keeps that environment's kind.").optional(),
18161
+ name: string2().trim().min(1).max(255).describe("The provider deploy environment name. Resolves an environment by alias or name; creates one when no match exists.")
18162
+ })
18163
+ ], {
18164
+ error: "Send environment as either { id } or { name }, with optional ephemeral and baseEphemeralEnvironment."
18165
+ });
18166
+ const input = strictObject({
18167
+ deployTarget: httpUrl().max(2048).describe("The URL the deployment serves, e.g. a preview URL.").optional(),
18168
+ environment: environment.describe("Selects the environment the deployment reports into.").optional(),
18169
+ 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(),
18170
+ 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(),
18171
+ providerDeploymentId: string2().trim().min(1).max(255).describe('Your identifier for the deployment, e.g. "vercel_dpl_123". Reports with the same providerDeploymentId update one deployment within this workspace.'),
18172
+ status: deploymentStatusSchema.describe("The deployment lifecycle status. A deployment's first success report evaluates global triggers asynchronously, and it is the only report that does. The response does not include the resulting runs."),
18173
+ workspaceId: ids.workspace.describe("The workspace to report the deployment status into. A team API key must name its own workspace.")
18174
+ }).superRefine((value, context) => {
18175
+ if (value.environment !== undefined && "name" in value.environment && value.environment.baseEphemeralEnvironment !== undefined && value.environment.ephemeral !== true) {
18176
+ context.addIssue({
18177
+ code: "custom",
18178
+ message: "baseEphemeralEnvironment is only valid with ephemeral.",
18179
+ path: ["environment", "baseEphemeralEnvironment"]
18180
+ });
18181
+ }
18182
+ });
18183
+ const deployment = resource({
18184
+ id: ids.deployment,
18185
+ status: deploymentStatusSchema.describe("The status reported in this request.")
18186
+ }, { urlFieldDescription: "Absolute URL of the environment's runs page." });
18187
+ const output = object({ deployment });
18188
+ return {
18189
+ annotations: {
18190
+ destructiveHint: true,
18191
+ openWorldHint: true,
18192
+ readOnlyHint: false
18193
+ },
18194
+ description: "Report a deployment lifecycle status. A deployment's first success report evaluates global triggers asynchronously, and it is the only report that does: a trigger added or unpaused later does not make an already reported deployment evaluate again. Report that deployment under a new providerDeploymentId to evaluate it against the current triggers. The response contains the deployment only, not the resulting runs.",
18195
+ input,
18196
+ kind: "write",
18197
+ name: "deployment.reportStatus",
18198
+ output
18199
+ };
18200
+ };
18201
+
18202
+ // node_modules/@qawolf/api-contracts/dist/v1/deployment/index.js
18203
+ var makeDeploymentContracts = (ids) => ({
18204
+ find: makeFindDeploymentsContract(ids),
18205
+ listTriggerEvaluations: makeListDeploymentTriggerEvaluationsContract(ids),
18206
+ reportStatus: makeReportDeploymentStatusContract(ids)
18207
+ });
18208
+
17396
18209
  // node_modules/@qawolf/api-contracts/dist/v1/email/find.js
17397
18210
  var makeFindEmailsContract = (ids) => {
17398
18211
  const input = object({
@@ -17560,29 +18373,6 @@ var makeSendEmailContract = (ids) => {
17560
18373
  };
17561
18374
  };
17562
18375
 
17563
- // node_modules/@qawolf/api-contracts/dist/v1/environment/deleteVariable.js
17564
- var makeDeleteEnvironmentVariableContract = (ids) => {
17565
- const input = object({
17566
- environmentId: ids.environmentRef,
17567
- name: string2().trim().min(1, "Environment variable name cannot be blank.").max(255).describe("Name of the environment variable to remove. Canonicalized the same way as environment.setVariable, so the name that was set is the name that deletes.")
17568
- });
17569
- const output = object({
17570
- name: string2().describe("The canonicalized name that was removed. Returned even when the environment had no such variable.")
17571
- });
17572
- return {
17573
- annotations: {
17574
- destructiveHint: true,
17575
- openWorldHint: false,
17576
- readOnlyHint: false
17577
- },
17578
- description: "Remove one environment variable by name. Succeeds whether or not the variable existed.",
17579
- input,
17580
- kind: "write",
17581
- name: "environment.deleteVariable",
17582
- output
17583
- };
17584
- };
17585
-
17586
18376
  // node_modules/@qawolf/api-contracts/dist/v1/environment/resource.js
17587
18377
  var makeEnvironmentResourceSchema = (ids) => resource({
17588
18378
  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."),
@@ -17603,9 +18393,55 @@ var makeEnvironmentResourceSchema = (ids) => resource({
17603
18393
  name: string2(),
17604
18394
  runConcurrencyLimit: string2().describe('Maximum number of concurrent runs: a whole number, "unlimited", or a concurrency expression.'),
17605
18395
  status: _enum(["blocked", "needs-investigation", "ready", "running"]).describe("Standing health across the environment's runs, not its Git reconciliation state: blocked (open blocking bugs), needs-investigation (failures awaiting triage), running (flows executing), ready (none of the above — the greenlit state)."),
17606
- terminatedAt: exports_iso.datetime().optional().describe("When the environment was terminated, if it has been.")
18396
+ terminatedAt: exports_iso.datetime().optional().describe("When the environment was terminated, if it has been."),
18397
+ variablesUrl: url().optional().describe("Absolute URL of the page where a person saves this environment's variables. Give it to the user when a login or key is missing, rather than collecting the value yourself. Absent once the environment is terminated, because that page no longer exists.")
17607
18398
  }, { urlFieldDescription: "Absolute URL of the environment page." });
17608
18399
 
18400
+ // node_modules/@qawolf/api-contracts/dist/v1/environment/create.js
18401
+ var makeCreateEnvironmentContract = (ids) => {
18402
+ const input = object({
18403
+ name: string2().min(1).max(255).regex(/\S/, "Environment name cannot be blank.").describe("Display name of the new environment."),
18404
+ workspaceId: ids.workspace.optional().describe("The workspace to create the environment in. Required when authenticating with an organization or user API key.")
18405
+ });
18406
+ const output = makeEnvironmentResourceSchema(ids);
18407
+ return {
18408
+ annotations: {
18409
+ destructiveHint: false,
18410
+ openWorldHint: true,
18411
+ readOnlyHint: false
18412
+ },
18413
+ description: "Create an environment on the caller's team and return it in the environment.get shape. This can also create a branch on the team's connected Git provider.",
18414
+ input,
18415
+ kind: "write",
18416
+ name: "environment.create",
18417
+ output
18418
+ };
18419
+ };
18420
+
18421
+ // node_modules/@qawolf/api-contracts/dist/v1/environment/deleteVariable.js
18422
+ var makeDeleteEnvironmentVariableContract = (ids) => {
18423
+ const input = object({
18424
+ environmentId: ids.environmentRef,
18425
+ name: string2().trim().min(1, "Environment variable name cannot be blank.").max(255).describe("Name of the environment variable to remove. Canonicalized the same way as environment.setVariable, so the name that was set is the name that deletes."),
18426
+ workspaceId: workspaceForEnvironmentRef(ids.workspace)
18427
+ });
18428
+ const output = object({
18429
+ name: string2().describe("The canonicalized name that was removed. Returned even when the environment had no such variable.")
18430
+ });
18431
+ return {
18432
+ annotations: {
18433
+ destructiveHint: true,
18434
+ openWorldHint: false,
18435
+ readOnlyHint: false
18436
+ },
18437
+ description: "Remove one environment variable by name. Succeeds whether or not the variable existed.",
18438
+ input,
18439
+ kind: "write",
18440
+ name: "environment.deleteVariable",
18441
+ output
18442
+ };
18443
+ };
18444
+
17609
18445
  // node_modules/@qawolf/api-contracts/dist/v1/environment/find.js
17610
18446
  var makeFindEnvironmentsContract = (ids) => {
17611
18447
  const input = object({
@@ -17637,7 +18473,8 @@ var makeFindEnvironmentsContract = (ids) => {
17637
18473
  var makeGetEnvironmentVariableContract = (ids) => {
17638
18474
  const input = object({
17639
18475
  environmentId: ids.environmentRef,
17640
- variableNames: array(string2().min(1).max(255)).min(1).max(100).describe("Names of the environment variables to read. Names match exactly as environment.listVariableNames returns them. Request every name you need in a single call, up to 100 names per call.")
18476
+ variableNames: array(string2().min(1).max(255)).min(1).max(100).describe("Names of the environment variables to read. Names match exactly as environment.listVariableNames returns them. Request every name you need in a single call, up to 100 names per call."),
18477
+ workspaceId: workspaceForEnvironmentRef(ids.workspace)
17641
18478
  });
17642
18479
  const output = object({
17643
18480
  missingNames: array(string2()).describe("Requested names the environment does not have, sorted alphabetically."),
@@ -17663,7 +18500,8 @@ var makeGetEnvironmentVariableContract = (ids) => {
17663
18500
  // node_modules/@qawolf/api-contracts/dist/v1/environment/index.js
17664
18501
  var makeGetEnvironmentContract = (ids) => {
17665
18502
  const input = object({
17666
- environmentId: ids.environmentRef
18503
+ environmentId: ids.environmentRef,
18504
+ workspaceId: workspaceForEnvironmentRef(ids.workspace)
17667
18505
  });
17668
18506
  const output = makeEnvironmentResourceSchema(ids);
17669
18507
  return {
@@ -17681,7 +18519,8 @@ var makeGetEnvironmentContract = (ids) => {
17681
18519
  };
17682
18520
  var makeListEnvironmentVariableNamesContract = (ids) => {
17683
18521
  const input = object({
17684
- environmentId: ids.environmentRef
18522
+ environmentId: ids.environmentRef,
18523
+ workspaceId: workspaceForEnvironmentRef(ids.workspace)
17685
18524
  });
17686
18525
  const output = object({
17687
18526
  variableNames: array(string2()).describe("Names of the environment's variables, sorted alphabetically. Values are never returned.")
@@ -17703,7 +18542,8 @@ var makeSetEnvironmentVariableContract = (ids) => {
17703
18542
  const input = object({
17704
18543
  environmentId: ids.environmentRef,
17705
18544
  name: string2().trim().min(1, "Environment variable name cannot be blank.").max(255).describe("Name of the environment variable to create or replace. Leading and trailing whitespace is removed, remaining whitespace is replaced with underscores, and letters are uppercased."),
17706
- value: string2().describe("Value to store. This secret value is accepted but never returned.")
18545
+ value: string2().describe("Value to store. This secret value is accepted but never returned."),
18546
+ workspaceId: workspaceForEnvironmentRef(ids.workspace)
17707
18547
  });
17708
18548
  const output = object({
17709
18549
  name: string2().describe("The stored variable name after whitespace is replaced with underscores and letters are uppercased.")
@@ -17721,25 +18561,6 @@ var makeSetEnvironmentVariableContract = (ids) => {
17721
18561
  output
17722
18562
  };
17723
18563
  };
17724
- var makeCreateEnvironmentContract = (ids) => {
17725
- const input = object({
17726
- name: string2().min(1).max(255).regex(/\S/, "Environment name cannot be blank.").describe("Display name of the new environment."),
17727
- workspaceId: ids.workspace.optional().describe("The workspace to create the environment in. Required when authenticating with an organization or user API key.")
17728
- });
17729
- const output = makeEnvironmentResourceSchema(ids);
17730
- return {
17731
- annotations: {
17732
- destructiveHint: false,
17733
- openWorldHint: true,
17734
- readOnlyHint: false
17735
- },
17736
- description: "Create an environment on the caller's team and return it in the environment.get shape. This can also create a branch on the team's connected Git provider.",
17737
- input,
17738
- kind: "write",
17739
- name: "environment.create",
17740
- output
17741
- };
17742
- };
17743
18564
 
17744
18565
  // node_modules/@qawolf/api-contracts/dist/v1/environment/update.js
17745
18566
  var makeUpdateEnvironmentContract = (ids) => {
@@ -17748,7 +18569,8 @@ var makeUpdateEnvironmentContract = (ids) => {
17748
18569
  const input = object({
17749
18570
  environmentId: ids.environmentRef,
17750
18571
  name: nameSchema.optional(),
17751
- runConcurrencyLimit: runConcurrencyLimitSchema.optional()
18572
+ runConcurrencyLimit: runConcurrencyLimitSchema.optional(),
18573
+ workspaceId: workspaceForEnvironmentRef(ids.workspace)
17752
18574
  }).refine((update) => update.name !== undefined || update.runConcurrencyLimit !== undefined, {
17753
18575
  message: "At least one of name or runConcurrencyLimit is required."
17754
18576
  });
@@ -17835,10 +18657,27 @@ var makeListFlowsContract = (ids) => {
17835
18657
  const input = object({
17836
18658
  aiTaskId: ids.aiTask.describe("List the flows on this AI task's branch, including drafts, instead of the ones in the environment. The task must belong to the environment.").optional(),
17837
18659
  environmentId: ids.environmentRef,
17838
- includeDrafts: boolean2().default(false).describe("Include draft flows in the listing.")
18660
+ includeDrafts: boolean2().default(false).describe("Include draft flows in the listing."),
18661
+ workspaceId: workspaceForEnvironmentRef(ids.workspace)
17839
18662
  });
17840
18663
  const executionTarget = union([string2().min(1), record(string2(), unknown())]).describe("The target the flow executes against, as a preset or object.");
18664
+ const emptyReason = discriminatedUnion("type", [
18665
+ object({
18666
+ type: literal("branch-never-reconciled").describe("The environment's flow code branch has no reconciled commit yet, so there is nothing to list. Read environment.get's flowCodeBranch and list again once syncStatus is reconciled.")
18667
+ }),
18668
+ object({
18669
+ type: literal("commit-has-no-flow-files").describe("The reconciled commit holds no flow file. The branch may never have had one, or a commit removed it: read the branch history at lastSyncedCommitHash before concluding either.")
18670
+ }),
18671
+ object({
18672
+ hiddenDraftCount: number2().int().positive().describe("How many draft flows this listing hid."),
18673
+ type: literal("every-flow-is-a-draft").describe("Every flow this listing matched is a draft, and the listing excluded drafts. Send includeDrafts to see them.")
18674
+ }),
18675
+ object({
18676
+ type: literal("no-flow-matched-the-listing").describe("The reconciled commit contains flow files, but this listing matched none of them: their flows were deleted after the commit reconciled, or a filter excluded every one.")
18677
+ })
18678
+ ]).describe("Why this listing has no flows, present only when flows is empty. Read it before concluding that a flow went missing.");
17841
18679
  const output = object({
18680
+ emptyReason: emptyReason.optional(),
17842
18681
  flows: array(resource({
17843
18682
  executionTarget,
17844
18683
  flowId: ids.flow,
@@ -18112,6 +18951,126 @@ var makeUpdateIssueContract = (ids) => {
18112
18951
  };
18113
18952
  };
18114
18953
 
18954
+ // node_modules/@qawolf/api-contracts/dist/v1/legacyTrigger/resource.js
18955
+ var namedIdentity = object({ id: string2(), name: string2() });
18956
+ var branchScope = union([
18957
+ object({ kind: literal("all-branches") }),
18958
+ object({
18959
+ caseSensitiveGlobs: array(string2()),
18960
+ kind: literal("listed-branches"),
18961
+ negated: boolean2(),
18962
+ raw: string2()
18963
+ })
18964
+ ]);
18965
+ var codeHostingServiceRepository = union([
18966
+ object({ kind: literal("any") }),
18967
+ object({ kind: literal("none") }),
18968
+ object({ id: string2(), kind: literal("by-id") })
18969
+ ]);
18970
+ var makeLegacyTriggerSchema = (ids) => {
18971
+ const base = {
18972
+ environment: object({
18973
+ id: ids.environment,
18974
+ kind: _enum(["static", "preview"]).describe("Whether the environment is static or a preview. A preview environment holds copies of the static deployment triggers."),
18975
+ name: string2(),
18976
+ terminatedAt: exports_iso.datetime().optional().describe("When the environment was terminated, if it has been.")
18977
+ }),
18978
+ id: ids.legacyTrigger,
18979
+ isPaused: boolean2(),
18980
+ name: string2(),
18981
+ pausedAt: exports_iso.datetime().optional(),
18982
+ tags: array(namedIdentity)
18983
+ };
18984
+ return union([
18985
+ object({
18986
+ ...base,
18987
+ nextAt: exports_iso.datetime().optional(),
18988
+ repeatMinutes: number2(),
18989
+ startAt: exports_iso.datetime().optional(),
18990
+ timezoneId: string2().optional(),
18991
+ type: literal("scheduled")
18992
+ }),
18993
+ object({
18994
+ ...base,
18995
+ adaptiveFlowSelection: boolean2().describe("Whether QA Wolf picks the flows to run from the deployment's changes. Such a trigger migrates to a generativeSuite action, which names no flows or tags of its own."),
18996
+ branchScope,
18997
+ codeHostingServiceRepository,
18998
+ deploymentPrLabel: string2().optional(),
18999
+ deploymentType: string2().optional(),
19000
+ type: union([literal("generic"), literal("pr-testing-button")])
19001
+ })
19002
+ ]);
19003
+ };
19004
+
19005
+ // node_modules/@qawolf/api-contracts/dist/v1/legacyTrigger/find.js
19006
+ var makeFindLegacyTriggersContract = (ids) => {
19007
+ const input = object({
19008
+ kind: _enum(["active", "all", "static"]).default("active").describe(`Which environments to list triggers from. "active", the default, covers the static environments plus the pull request environments still in use. "static" covers the static environments only, where every pull request copy's original lives. "all" adds the pull request environments that have already been torn down, whose environment carries a terminatedAt.`),
19009
+ workspaceId: ids.workspace.optional().describe("The workspace to list legacy triggers from. Required when authenticating with an organization or user API key.")
19010
+ });
19011
+ const output = object({
19012
+ legacyTriggers: array(makeLegacyTriggerSchema(ids)).describe("The workspace's legacy triggers, by name.")
19013
+ });
19014
+ return {
19015
+ annotations: {
19016
+ destructiveHint: false,
19017
+ openWorldHint: false,
19018
+ readOnlyHint: true
19019
+ },
19020
+ description: "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.",
19021
+ input,
19022
+ kind: "read",
19023
+ name: "legacyTrigger.find",
19024
+ output
19025
+ };
19026
+ };
19027
+
19028
+ // node_modules/@qawolf/api-contracts/dist/v1/legacyTrigger/lifecycle.js
19029
+ var makeLifecycleShape = (ids) => ({
19030
+ input: object({ legacyTriggerId: ids.legacyTrigger }),
19031
+ output: object({
19032
+ isPaused: boolean2(),
19033
+ legacyTriggerId: ids.legacyTrigger
19034
+ })
19035
+ });
19036
+ var makePauseLegacyTriggerContract = (ids) => {
19037
+ const { input, output } = makeLifecycleShape(ids);
19038
+ return {
19039
+ annotations: {
19040
+ destructiveHint: true,
19041
+ openWorldHint: false,
19042
+ readOnlyHint: false
19043
+ },
19044
+ description: "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.",
19045
+ input,
19046
+ kind: "write",
19047
+ name: "legacyTrigger.pause",
19048
+ output
19049
+ };
19050
+ };
19051
+ var makeResumeLegacyTriggerContract = (ids) => {
19052
+ const { input, output } = makeLifecycleShape(ids);
19053
+ return {
19054
+ annotations: {
19055
+ destructiveHint: true,
19056
+ openWorldHint: true,
19057
+ readOnlyHint: false
19058
+ },
19059
+ description: "Resume one legacy trigger, the older per-environment kind; use " + "trigger.resume for a current one. Its copies in pull request " + "environments resume too, and a scheduled one jumps to the next " + "upcoming slot even if it was not paused. For migration only; it goes " + "when legacy triggers go.",
19060
+ input,
19061
+ kind: "write",
19062
+ name: "legacyTrigger.resume",
19063
+ output
19064
+ };
19065
+ };
19066
+
19067
+ // node_modules/@qawolf/api-contracts/dist/v1/legacyTrigger/index.js
19068
+ var makeLegacyTriggerContracts = (ids) => ({
19069
+ find: makeFindLegacyTriggersContract(ids),
19070
+ pause: makePauseLegacyTriggerContract(ids),
19071
+ resume: makeResumeLegacyTriggerContract(ids)
19072
+ });
19073
+
18115
19074
  // node_modules/@qawolf/api-contracts/dist/v1/run/diagnose.js
18116
19075
  var makeDiagnoseRunContract = (ids) => {
18117
19076
  const input = object({
@@ -18155,7 +19114,8 @@ var makeFindRunsContract = (ids) => {
18155
19114
  const input = object({
18156
19115
  createdAfter: exports_iso.datetime({ offset: true }).optional().describe("Only include runs created after this instant, e.g. the runs since a deploy."),
18157
19116
  ...makePaginationInputFields({ defaultLimit: 20, maxLimit: 100 }),
18158
- environmentId: ids.environmentRef
19117
+ environmentId: ids.environmentRef,
19118
+ workspaceId: workspaceForEnvironmentRef(ids.workspace)
18159
19119
  });
18160
19120
  const output = object({
18161
19121
  nextCursor: nextCursorSchema,
@@ -18303,6 +19263,54 @@ var makeStopRunContract = (ids) => {
18303
19263
  };
18304
19264
  };
18305
19265
 
19266
+ // node_modules/@qawolf/api-contracts/dist/v1/run/triage.js
19267
+ var probability = number2().min(0).max(1);
19268
+ var verdictAnswer = object({
19269
+ choice: _enum(["bug", "maintenance"]),
19270
+ confidence: probability,
19271
+ probabilities: record(string2(), probability),
19272
+ type: literal("choice")
19273
+ });
19274
+ var makeTriageRunContract = (ids) => {
19275
+ const input = object({
19276
+ flowId: ids.flow.describe("The flow that failed in the run."),
19277
+ runId: ids.run
19278
+ });
19279
+ const decision = discriminatedUnion("type", [
19280
+ object({
19281
+ diagnosis: _enum(["bug", "maintenance"]),
19282
+ type: literal("diagnose")
19283
+ }),
19284
+ object({
19285
+ diagnosis: _enum(["bug", "maintenance"]),
19286
+ type: literal("suggest")
19287
+ }),
19288
+ object({
19289
+ type: literal("needsHuman")
19290
+ })
19291
+ ]);
19292
+ const output = object({
19293
+ answers: object({
19294
+ verdict: verdictAnswer
19295
+ }),
19296
+ decision: decision.describe("What the triage would do with the verdict. The prototype records nothing; it only reports."),
19297
+ model: string2(),
19298
+ state: json().describe("The context that was sent to the model, for inspection.")
19299
+ });
19300
+ return {
19301
+ annotations: {
19302
+ destructiveHint: false,
19303
+ openWorldHint: false,
19304
+ readOnlyHint: true
19305
+ },
19306
+ description: "Prototype. Ask Jev, a TypeSafe System One model, whether a flow failure in a run is a bug in the product " + "or a test that needs maintenance. Compares the failing attempt with the flow's last passing run in the " + "same environment. Records nothing.",
19307
+ input,
19308
+ kind: "read",
19309
+ name: "run.triage",
19310
+ output
19311
+ };
19312
+ };
19313
+
18306
19314
  // node_modules/@qawolf/api-contracts/dist/v1/runner/evaluateSnippet.js
18307
19315
  var maxSnippetCodeLength = 64 * 1024;
18308
19316
  var makeEvaluateSnippetOnRunnerContract = (ids) => {
@@ -18347,18 +19355,26 @@ var makeGetRunnerContract = (ids) => {
18347
19355
  id: runnerIdSchema.describe("Id of the runner to look up."),
18348
19356
  workspaceId: ids.workspace.optional().describe(runnerWorkspaceIdDescription)
18349
19357
  });
18350
- const output = object({
19358
+ const addressed = object({
18351
19359
  id: runnerIdSchema.describe("Id of the runner the call addressed."),
18352
- outcome: literal("success"),
18353
- running: boolean2().describe("False when no runner is running under this id: it was never launched, it was terminated, or it terminated on its own after inactivity. These are not distinguished, because the run system keeps no record of a runner once it is gone.")
19360
+ outcome: literal("success")
18354
19361
  });
19362
+ const output = discriminatedUnion("running", [
19363
+ addressed.extend({
19364
+ running: literal(false).describe("No runner is running under this id: it was never launched, it was terminated, or it terminated on its own after inactivity. These are not distinguished, because the run system keeps no record of a runner once it is gone.")
19365
+ }),
19366
+ addressed.extend({
19367
+ running: literal(true).describe("A runner is running under this id and can be addressed."),
19368
+ url: runnerWatchUrlSchema
19369
+ })
19370
+ ]);
18355
19371
  return {
18356
19372
  annotations: {
18357
19373
  destructiveHint: false,
18358
19374
  openWorldHint: false,
18359
19375
  readOnlyHint: true
18360
19376
  },
18361
- description: "Report whether a runner is running under this id on the caller's team. This is a lookup: it never starts a runner, and it does not reset a runner's inactivity clock the way reading its journal does. An id that is not running is a success with `running: false` rather than an error, so this is how to check a runner is still there before addressing it.",
19377
+ description: "Report whether a runner is running under this id on the caller's team. This is a lookup: it never starts a runner, and it does not reset a runner's inactivity clock the way reading its journal does. An id that is not running is a success with `running: false` rather than an error, so this is how to check a runner is still there before addressing it. A running runner also reports the `url` to watch it on, so an id alone is enough to recover the link to give the user.",
18362
19378
  input,
18363
19379
  kind: "read",
18364
19380
  name: "runner.get",
@@ -18459,7 +19475,7 @@ var makeLaunchRunnerContract = (ids) => {
18459
19475
  openWorldHint: false,
18460
19476
  readOnlyHint: false
18461
19477
  },
18462
- description: "Launch an interactive runner on the caller's team under an id the caller chooses. Launching the same id again returns the runner already running rather than starting a second one, and the same id with a different runnerName is refused. A runner is not permanent: it terminates on its own after a period of inactivity, and launching the same id after that starts and bills a new runner — so read `alreadyRunning` to tell which happened.",
19478
+ description: "Launch an interactive runner on the caller's team under an id the caller chooses. Launching the same id again returns the runner already running rather than starting a second one, and the same id with a different runnerName is refused. A runner is not permanent: it terminates on its own after a period of inactivity, and launching the same id after that starts and bills a new runner — so read `alreadyRunning` to tell which happened. A success means the runner is answering: the call waits for the pod it started to come up, so the very next call to the runner reaches it. If the pod does not come up in time the call fails instead, leaving the runner running — launching the same id again attaches to it. After a successful launch, put the exact returned `url` in a normal user-visible assistant message so they can watch while the browser is driven. Tool output and internal reasoning do not count as sharing the link. When `alreadyRunning` is true the `url` is the same page, so share it again instead of assuming the caller still has it.",
18463
19479
  input,
18464
19480
  kind: "write",
18465
19481
  name: "runner.launch",
@@ -18706,6 +19722,75 @@ var makeTakeScreenshotOnRunnerContract = (ids) => {
18706
19722
  };
18707
19723
  };
18708
19724
 
19725
+ // node_modules/@qawolf/api-contracts/dist/v1/runner/catalog.js
19726
+ var makeRunnerContracts = (ids) => ({
19727
+ evaluateSnippet: makeEvaluateSnippetOnRunnerContract(ids),
19728
+ get: makeGetRunnerContract(ids),
19729
+ highlightSelector: makeHighlightSelectorOnRunnerContract(ids),
19730
+ importPackage: makeImportPackageOnRunnerContract(ids),
19731
+ inspect: makeInspectOnRunnerContract(ids),
19732
+ inspectMobile: makeInspectMobileOnRunnerContract(ids),
19733
+ launch: makeLaunchRunnerContract(ids),
19734
+ list: makeListRunnersContract(ids),
19735
+ performAction: makePerformActionOnRunnerContract(ids),
19736
+ performActions: makePerformActionsOnRunnerContract(ids),
19737
+ promoteSnapshot: makePromoteSnapshotOnRunnerContract(ids),
19738
+ readJournal: makeReadRunnerJournalContract(ids),
19739
+ ...makeRecordingContracts(ids),
19740
+ runFlow: makeRunFlowOnRunnerContract(ids),
19741
+ stopRun: makeStopRunOnRunnerContract(ids),
19742
+ takeScreenshot: makeTakeScreenshotOnRunnerContract(ids),
19743
+ terminate: makeTerminateRunnerContract(ids)
19744
+ });
19745
+
19746
+ // node_modules/@qawolf/api-contracts/dist/v1/skill/index.js
19747
+ var skillName = string2().trim().min(1).max(255).describe("The skill's name as skill.list reports it, such as qawolf-onboarding. The qawolf- prefix is optional, so onboarding names the same skill.");
19748
+ var skillSummary = object({
19749
+ description: string2().describe("When to use the skill, in the words the agent routes on."),
19750
+ name: string2().describe("The skill's name. Read it with skill.get.")
19751
+ });
19752
+ var readOnlyAnnotations = {
19753
+ destructiveHint: false,
19754
+ openWorldHint: false,
19755
+ readOnlyHint: true
19756
+ };
19757
+ var makeListSkillsContract = () => {
19758
+ const input = object({});
19759
+ const output = object({
19760
+ skills: array(skillSummary).describe("Every skill the server serves, in catalog order.")
19761
+ });
19762
+ return {
19763
+ annotations: readOnlyAnnotations,
19764
+ description: "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.",
19765
+ input,
19766
+ kind: "read",
19767
+ name: "skill.list",
19768
+ output
19769
+ };
19770
+ };
19771
+ var makeGetSkillContract = () => {
19772
+ const input = object({ name: skillName });
19773
+ const output = skillSummary.extend({
19774
+ instructions: string2().describe("The skill's SKILL.md, frontmatter included."),
19775
+ references: array(object({
19776
+ path: string2().describe("The file's path relative to the skill directory."),
19777
+ text: string2().describe("The file's content.")
19778
+ })).describe("The files the skill links to under its directory.")
19779
+ });
19780
+ return {
19781
+ annotations: readOnlyAnnotations,
19782
+ description: "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.",
19783
+ input,
19784
+ kind: "read",
19785
+ name: "skill.get",
19786
+ output
19787
+ };
19788
+ };
19789
+ var makeSkillContracts = () => ({
19790
+ get: makeGetSkillContract(),
19791
+ list: makeListSkillsContract()
19792
+ });
19793
+
18709
19794
  // node_modules/@qawolf/api-contracts/dist/v1/tag/list.js
18710
19795
  var makeListTagsContract = (ids) => {
18711
19796
  const input = object({
@@ -18734,250 +19819,6 @@ var makeListTagsContract = (ids) => {
18734
19819
  };
18735
19820
  };
18736
19821
 
18737
- // node_modules/@qawolf/api-contracts/dist/v1/trigger/configurationRules.js
18738
- var checkAction = (action, ctx) => {
18739
- const namesFlows = action.flowIds.length + action.tagNames.length > 0;
18740
- if (action.kind === "generativeSuite") {
18741
- if (namesFlows) {
18742
- ctx.addIssue({
18743
- code: "custom",
18744
- message: "flowIds and tagNames do not apply when the action is generativeSuite.",
18745
- path: ["action", "flowIds"]
18746
- });
18747
- }
18748
- return;
18749
- }
18750
- if (action.instructions !== undefined) {
18751
- ctx.addIssue({
18752
- code: "custom",
18753
- message: "instructions apply to a generativeSuite action only.",
18754
- path: ["action", "instructions"]
18755
- });
18756
- }
18757
- if (!namesFlows) {
18758
- ctx.addIssue({
18759
- code: "custom",
18760
- message: "At least one flow or tag is required.",
18761
- path: ["action", "flowIds"]
18762
- });
18763
- }
18764
- };
18765
- var checkSchedule = (value, ctx) => {
18766
- if (value.cadence === "daily") {
18767
- for (const field of ["timeOfDay", "timezoneId"]) {
18768
- if (value[field] === undefined) {
18769
- ctx.addIssue({
18770
- code: "custom",
18771
- message: `${field} is required when cadence is daily.`,
18772
- path: [field]
18773
- });
18774
- }
18775
- }
18776
- if (value.minuteOfHour !== undefined) {
18777
- ctx.addIssue({
18778
- code: "custom",
18779
- message: "minuteOfHour applies to an hourly cadence only.",
18780
- path: ["minuteOfHour"]
18781
- });
18782
- }
18783
- } else {
18784
- for (const field of ["timeOfDay", "timezoneId"]) {
18785
- if (value[field] !== undefined) {
18786
- ctx.addIssue({
18787
- code: "custom",
18788
- message: `${field} applies to a daily cadence only.`,
18789
- path: [field]
18790
- });
18791
- }
18792
- }
18793
- }
18794
- if (value.action.kind === "generativeSuite") {
18795
- ctx.addIssue({
18796
- code: "custom",
18797
- message: "A schedule trigger cannot use a generativeSuite action.",
18798
- path: ["action", "kind"]
18799
- });
18800
- return;
18801
- }
18802
- checkAction(value.action, ctx);
18803
- };
18804
- var checkDeployment = (value, ctx) => {
18805
- if (value.environmentPattern !== undefined && value.environmentIds.length > 0) {
18806
- ctx.addIssue({
18807
- code: "custom",
18808
- message: "Supply environmentIds or environmentPattern, not both.",
18809
- path: ["environmentPattern"]
18810
- });
18811
- }
18812
- checkAction(value.action, ctx);
18813
- };
18814
- var checkTriggerConfiguration = (value, ctx) => value.kind === "schedule" ? checkSchedule(value, ctx) : checkDeployment(value, ctx);
18815
-
18816
- // node_modules/@qawolf/api-contracts/dist/v1/trigger/create.js
18817
- var makeCreateTriggerContract = (ids) => {
18818
- const commonFields = {
18819
- name: string2().trim().min(1).max(255),
18820
- workspaceId: ids.workspace.optional().describe("The workspace to create the trigger in. Required when authenticating with an organization or user API key.")
18821
- };
18822
- const input = discriminatedUnion("kind", [
18823
- object({
18824
- ...commonFields,
18825
- ...makeTriggerScheduleFields({
18826
- environmentId: ids.environmentRef,
18827
- flow: ids.flow
18828
- }),
18829
- kind: literal("schedule")
18830
- }),
18831
- object({
18832
- ...commonFields,
18833
- ...makeTriggerDeploymentFields(ids),
18834
- kind: literal("deployment")
18835
- })
18836
- ]).superRefine(checkTriggerConfiguration);
18837
- const output = object({ trigger: makeTriggerResourceSchema(ids) });
18838
- return {
18839
- annotations: {
18840
- destructiveHint: true,
18841
- openWorldHint: true,
18842
- readOnlyHint: false
18843
- },
18844
- description: "Create a trigger. A schedule trigger runs a named set of flows on a cadence; " + "a deployment trigger runs when a matching deployment is reported.",
18845
- input,
18846
- kind: "write",
18847
- name: "trigger.create",
18848
- output
18849
- };
18850
- };
18851
-
18852
- // node_modules/@qawolf/api-contracts/dist/v1/trigger/find.js
18853
- var makeFindTriggersContract = (ids) => {
18854
- const input = object({
18855
- isPaused: boolean2().optional().describe("Only list paused, or only unpaused, triggers. Omit for both."),
18856
- workspaceId: ids.workspace.optional().describe("The workspace to list triggers from. Required when authenticating with an organization or user API key.")
18857
- });
18858
- const output = object({
18859
- triggers: array(makeTriggerResourceSchema(ids)).describe("The team's triggers, newest first.")
18860
- });
18861
- return {
18862
- annotations: {
18863
- destructiveHint: false,
18864
- openWorldHint: false,
18865
- readOnlyHint: true
18866
- },
18867
- description: "List the team's triggers, newest first.",
18868
- input,
18869
- kind: "read",
18870
- name: "trigger.find",
18871
- output
18872
- };
18873
- };
18874
-
18875
- // node_modules/@qawolf/api-contracts/dist/v1/trigger/get.js
18876
- var makeGetTriggerContract = (ids) => {
18877
- const input = object({ triggerId: ids.trigger });
18878
- const output = object({ trigger: makeTriggerResourceSchema(ids) });
18879
- return {
18880
- annotations: {
18881
- destructiveHint: false,
18882
- openWorldHint: false,
18883
- readOnlyHint: true
18884
- },
18885
- description: "Get one trigger by id.",
18886
- input,
18887
- kind: "read",
18888
- name: "trigger.get",
18889
- output
18890
- };
18891
- };
18892
-
18893
- // node_modules/@qawolf/api-contracts/dist/v1/trigger/lifecycle.js
18894
- var makePauseTriggerContract = (ids) => {
18895
- const input = object({ triggerId: ids.trigger });
18896
- const output = object({ trigger: makeTriggerResourceSchema(ids) });
18897
- return {
18898
- annotations: {
18899
- destructiveHint: true,
18900
- openWorldHint: false,
18901
- readOnlyHint: false
18902
- },
18903
- description: "Pause a trigger so it stops firing. Pausing is idempotent. A team whose " + "triggers are all paused reports no trigger activity at all.",
18904
- input,
18905
- kind: "write",
18906
- name: "trigger.pause",
18907
- output
18908
- };
18909
- };
18910
- var makeResumeTriggerContract = (ids) => {
18911
- const input = object({ triggerId: ids.trigger });
18912
- const output = object({ trigger: makeTriggerResourceSchema(ids) });
18913
- return {
18914
- annotations: {
18915
- destructiveHint: true,
18916
- openWorldHint: true,
18917
- readOnlyHint: false
18918
- },
18919
- description: "Resume a paused trigger. A schedule trigger restarts from the next " + "upcoming slot: the slots it missed while paused do not run.",
18920
- input,
18921
- kind: "write",
18922
- name: "trigger.resume",
18923
- output
18924
- };
18925
- };
18926
- var makeDeleteTriggerContract = (ids) => {
18927
- const input = object({ triggerId: ids.trigger });
18928
- const output = object({
18929
- triggerId: ids.trigger.describe("The id of the deleted trigger.")
18930
- });
18931
- return {
18932
- annotations: {
18933
- destructiveHint: true,
18934
- openWorldHint: false,
18935
- readOnlyHint: false
18936
- },
18937
- description: "Delete a trigger permanently. The runs it already created are kept. " + "To stop a trigger without losing it, use trigger.pause.",
18938
- input,
18939
- kind: "write",
18940
- name: "trigger.delete",
18941
- output
18942
- };
18943
- };
18944
-
18945
- // node_modules/@qawolf/api-contracts/dist/v1/trigger/update.js
18946
- var makeUpdateTriggerContract = (ids) => {
18947
- const commonFields = {
18948
- name: string2().trim().min(1).max(255),
18949
- triggerId: ids.trigger
18950
- };
18951
- const input = discriminatedUnion("kind", [
18952
- object({
18953
- ...commonFields,
18954
- ...makeTriggerScheduleFields({
18955
- environmentId: ids.environmentRef,
18956
- flow: ids.flow
18957
- }),
18958
- kind: literal("schedule")
18959
- }),
18960
- object({
18961
- ...commonFields,
18962
- ...makeTriggerDeploymentFields(ids),
18963
- kind: literal("deployment")
18964
- })
18965
- ]).superRefine(checkTriggerConfiguration);
18966
- const output = object({ trigger: makeTriggerResourceSchema(ids) });
18967
- return {
18968
- annotations: {
18969
- destructiveHint: true,
18970
- openWorldHint: true,
18971
- readOnlyHint: false
18972
- },
18973
- description: "Replace a trigger's configuration. Every field is written, so read the " + "trigger first and send its configuration back with your changes applied. " + "Pausing is separate: use trigger.pause and trigger.resume.",
18974
- input,
18975
- kind: "write",
18976
- name: "trigger.update",
18977
- output
18978
- };
18979
- };
18980
-
18981
19822
  // node_modules/@qawolf/api-contracts/dist/v1/index.js
18982
19823
  var makeContractsV1 = (ids) => {
18983
19824
  const resolvedIds = { ...defaultIdSchemas, ...ids };
@@ -18986,7 +19827,11 @@ var makeContractsV1 = (ids) => {
18986
19827
  get: makeAgentGetContract(resolvedIds),
18987
19828
  send: makeAgentSendContract(resolvedIds)
18988
19829
  },
18989
- automate: makeAutomateContract(resolvedIds),
19830
+ codeHostIntegration: {
19831
+ find: makeFindCodeHostIntegrationsContract(resolvedIds),
19832
+ listRepositories: makeListCodeHostRepositoriesContract(resolvedIds)
19833
+ },
19834
+ deployment: makeDeploymentContracts(resolvedIds),
18990
19835
  email: {
18991
19836
  find: makeFindEmailsContract(resolvedIds),
18992
19837
  get: makeGetEmailContract(resolvedIds),
@@ -19020,44 +19865,23 @@ var makeContractsV1 = (ids) => {
19020
19865
  removeFlows: makeRemoveFlowsFromIssueContract(resolvedIds),
19021
19866
  update: makeUpdateIssueContract(resolvedIds)
19022
19867
  },
19868
+ legacyTrigger: makeLegacyTriggerContracts(resolvedIds),
19023
19869
  run: {
19024
19870
  create: makeCreateRunContract(resolvedIds),
19025
19871
  diagnose: makeDiagnoseRunContract(resolvedIds),
19026
19872
  find: makeFindRunsContract(resolvedIds),
19027
19873
  get: makeGetRunContract(resolvedIds),
19028
19874
  reattempt: makeReattemptRunContract(resolvedIds),
19029
- stop: makeStopRunContract(resolvedIds)
19030
- },
19031
- runner: {
19032
- evaluateSnippet: makeEvaluateSnippetOnRunnerContract(resolvedIds),
19033
- get: makeGetRunnerContract(resolvedIds),
19034
- highlightSelector: makeHighlightSelectorOnRunnerContract(resolvedIds),
19035
- importPackage: makeImportPackageOnRunnerContract(resolvedIds),
19036
- inspect: makeInspectOnRunnerContract(resolvedIds),
19037
- inspectMobile: makeInspectMobileOnRunnerContract(resolvedIds),
19038
- launch: makeLaunchRunnerContract(resolvedIds),
19039
- list: makeListRunnersContract(resolvedIds),
19040
- performAction: makePerformActionOnRunnerContract(resolvedIds),
19041
- promoteSnapshot: makePromoteSnapshotOnRunnerContract(resolvedIds),
19042
- readJournal: makeReadRunnerJournalContract(resolvedIds),
19043
- runFlow: makeRunFlowOnRunnerContract(resolvedIds),
19044
- stopRun: makeStopRunOnRunnerContract(resolvedIds),
19045
- takeScreenshot: makeTakeScreenshotOnRunnerContract(resolvedIds),
19046
- terminate: makeTerminateRunnerContract(resolvedIds)
19875
+ stop: makeStopRunContract(resolvedIds),
19876
+ triage: makeTriageRunContract(resolvedIds)
19047
19877
  },
19878
+ runner: makeRunnerContracts(resolvedIds),
19879
+ skill: makeSkillContracts(),
19048
19880
  tag: {
19049
19881
  create: makeCreateTagContract(resolvedIds),
19050
19882
  list: makeListTagsContract(resolvedIds)
19051
19883
  },
19052
- trigger: {
19053
- create: makeCreateTriggerContract(resolvedIds),
19054
- delete: makeDeleteTriggerContract(resolvedIds),
19055
- find: makeFindTriggersContract(resolvedIds),
19056
- get: makeGetTriggerContract(resolvedIds),
19057
- pause: makePauseTriggerContract(resolvedIds),
19058
- resume: makeResumeTriggerContract(resolvedIds),
19059
- update: makeUpdateTriggerContract(resolvedIds)
19060
- }
19884
+ trigger: makeTriggerContracts(resolvedIds)
19061
19885
  };
19062
19886
  };
19063
19887
  var publicContractsV1 = makeContractsV1(defaultIdSchemas);
@@ -21565,7 +22389,7 @@ function startUpdateCheck(deps) {
21565
22389
  // package.json
21566
22390
  var package_default = {
21567
22391
  name: "@qawolf/cli",
21568
- version: "1.31.0",
22392
+ version: "1.33.0",
21569
22393
  description: "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
21570
22394
  keywords: [
21571
22395
  "automation",
@@ -21636,7 +22460,7 @@ var package_default = {
21636
22460
  "@clack/prompts": "1.5.1",
21637
22461
  "@napi-rs/keyring": "1.3.0",
21638
22462
  "@oxc-node/core": "0.1.0",
21639
- "@qawolf/api-contracts": "0.53.0",
22463
+ "@qawolf/api-contracts": "0.64.0",
21640
22464
  "@qawolf/emails": "1.1.1",
21641
22465
  "@qawolf/flow-targets": "1.0.0",
21642
22466
  "@qawolf/flows": "0.1.4",
@@ -22177,21 +23001,34 @@ function withoutExclusiveConflict(spec, command, options) {
22177
23001
  }
22178
23002
 
22179
23003
  // src/domains/agent/send.ts
23004
+ var chatSessionIdEnvironmentVariable = "QAWOLF_CHAT_SESSION_ID";
22180
23005
  function parseInput(options) {
22181
23006
  return publicContractsV1.agent.send.input.safeParse({
22182
23007
  message: options.message,
22183
23008
  ...options.environmentId === undefined ? {} : { environmentId: options.environmentId },
22184
23009
  ...options.filePaths === undefined ? {} : { filePaths: options.filePaths },
23010
+ ...options.parentSessionId === undefined ? {} : { parentSessionId: options.parentSessionId },
22185
23011
  ...options.session === undefined ? {} : { sessionId: options.session },
22186
23012
  ...options.workspaceId === undefined ? {} : { workspaceId: options.workspaceId }
22187
23013
  });
22188
23014
  }
23015
+ function resolveParentSessionId(options) {
23016
+ if (options.session !== undefined)
23017
+ return;
23018
+ return options.env[chatSessionIdEnvironmentVariable]?.trim() || undefined;
23019
+ }
22189
23020
  async function handleAgentSend(ctx, options, deps) {
22190
23021
  const timeout = parseFollowTimeout(options.timeout, defaultAgentFollowTimeoutSeconds);
22191
23022
  if (!timeout.ok) {
22192
23023
  return { error: timeout.error, exitCode: exitCodes.invalidArgs };
22193
23024
  }
22194
- const input = parseInput(options);
23025
+ const input = parseInput({
23026
+ ...options,
23027
+ parentSessionId: resolveParentSessionId({
23028
+ env: deps.env,
23029
+ session: options.session
23030
+ })
23031
+ });
22195
23032
  if (!input.success) {
22196
23033
  return {
22197
23034
  error: prettifyError(input.error),
@@ -34813,7 +35650,7 @@ async function handlePublicApiCommand(ctx, spec, options) {
34813
35650
  }
34814
35651
 
34815
35652
  // src/domains/publicApi/skippedContracts.ts
34816
- var skippedContractNames = new Set([
35653
+ var handWrittenContractNames = [
34817
35654
  "agent.get",
34818
35655
  "agent.send",
34819
35656
  "flow.list",
@@ -34826,12 +35663,20 @@ var skippedContractNames = new Set([
34826
35663
  "runner.launch",
34827
35664
  "runner.list",
34828
35665
  "runner.performAction",
35666
+ "runner.performActions",
34829
35667
  "runner.promoteSnapshot",
34830
35668
  "runner.readJournal",
35669
+ "runner.record",
35670
+ "runner.recordings",
34831
35671
  "runner.runFlow",
34832
35672
  "runner.stopRun",
34833
35673
  "runner.takeScreenshot",
34834
35674
  "runner.terminate"
35675
+ ];
35676
+ var deprecatedContractNames = ["automate"];
35677
+ var skippedContractNames = new Set([
35678
+ ...handWrittenContractNames,
35679
+ ...deprecatedContractNames
34835
35680
  ]);
34836
35681
 
34837
35682
  // src/commands/publicApi/index.ts
@@ -34877,34 +35722,389 @@ function registerPublicApiCommands(program, signals, options = {}) {
34877
35722
  }
34878
35723
  }
34879
35724
 
34880
- // src/domains/interactiveRunner/evaluateSnippetFailure.ts
34881
- function describeEvaluateSnippetFailure(failure) {
34882
- const { failureReason } = failure;
35725
+ // src/core/sentences.ts
35726
+ function appendSentence(text, sentence) {
35727
+ const punctuated = /[.!?]$/.test(text.trimEnd()) ? text.trimEnd() : `${text.trimEnd()}.`;
35728
+ return `${punctuated} ${sentence}`;
35729
+ }
35730
+
35731
+ // src/shell/interactiveRunner/writeScreenshot.ts
35732
+ import { dirname as dirname15 } from "node:path";
35733
+ var jpegStartOfImage = [255, 216, 255];
35734
+ var stdoutPath = "-";
35735
+ async function writeScreenshot(options) {
35736
+ const bytes = Buffer.from(options.imageJpegBase64, "base64");
35737
+ if (jpegStartOfImage.some((byte, index) => bytes[index] !== byte)) {
35738
+ return { ok: false, reason: "not-a-jpeg" };
35739
+ }
35740
+ try {
35741
+ if (options.path === stdoutPath) {
35742
+ await writeToStdout(options.stdout ?? process.stdout, bytes);
35743
+ } else {
35744
+ await options.fs.mkdir(dirname15(options.path), { recursive: true });
35745
+ await options.fs.writeFile(options.path, bytes);
35746
+ }
35747
+ } catch (error) {
35748
+ return { detail: errorMessage(error), ok: false, reason: "unwritable" };
35749
+ }
35750
+ return { ok: true };
35751
+ }
35752
+ function writeToStdout(stdout, bytes) {
35753
+ return new Promise((resolve, reject) => {
35754
+ const onError = (error) => reject(error);
35755
+ stdout.once("error", onError);
35756
+ stdout.write(bytes, (error) => {
35757
+ if (error) {
35758
+ reject(error);
35759
+ return;
35760
+ }
35761
+ stdout.off("error", onError);
35762
+ resolve();
35763
+ });
35764
+ });
35765
+ }
35766
+
35767
+ // src/domains/interactiveRunner/performActionsReasons.ts
35768
+ var exitCodesWorstFirst = [
35769
+ exitCodes.network,
35770
+ exitCodes.timeout,
35771
+ exitCodes.invalidArgs,
35772
+ exitCodes.testFailure
35773
+ ];
35774
+ function worstExitCode(codes) {
35775
+ return codes.reduce((worst, code) => exitCodesWorstFirst.indexOf(code) < exitCodesWorstFirst.indexOf(worst) ? code : worst);
35776
+ }
35777
+ function describeAnswerWithoutAResult(failureReason) {
35778
+ return {
35779
+ exitCode: exitCodes.network,
35780
+ why: interactiveRunnerMessages.actionsFailedWithoutAResult(failureReason)
35781
+ };
35782
+ }
35783
+ function describeReason(step) {
35784
+ const { failureReason } = step;
34883
35785
  switch (failureReason) {
34884
- case "runner-cannot-evaluate-snippets":
35786
+ case "action-failed":
34885
35787
  return {
34886
- error: interactiveRunnerMessages.runnerCannotEvaluateSnippets,
34887
- exitCode: exitCodes.invalidArgs
35788
+ exitCode: exitCodes.testFailure,
35789
+ why: `reached the runner and did not take effect: ${step.errorMessage}.`
35790
+ };
35791
+ case "action-unconfirmed":
35792
+ return {
35793
+ exitCode: exitCodes.network,
35794
+ why: appendSentence(interactiveRunnerMessages.actionsUnconfirmed(step.errorMessage), interactiveRunnerMessages.actionsMayHaveHappened)
34888
35795
  };
34889
35796
  case "runner-unreachable":
34890
35797
  return {
34891
- error: interactiveRunnerMessages.snippetRunnerUnreachable,
34892
- exitCode: exitCodes.network
35798
+ exitCode: exitCodes.network,
35799
+ why: appendSentence("could not be confirmed: the runner stopped answering.", interactiveRunnerMessages.actionsMayHaveHappened)
34893
35800
  };
34894
- default:
35801
+ case "out-of-time":
34895
35802
  return {
34896
- error: interactiveRunnerMessages.snippetAnsweredUnknown(failureReason),
34897
- exitCode: exitCodes.network
35803
+ exitCode: exitCodes.timeout,
35804
+ why: interactiveRunnerMessages.actionsOutOfTime
34898
35805
  };
34899
- }
34900
- }
34901
-
34902
- // src/domains/interactiveRunner/runnerCallOptions.ts
34903
- var runnerCallOptions = { timeoutMs: 90000 };
34904
-
34905
- // src/domains/interactiveRunner/launchAndRemember.ts
34906
- async function launchRunner(ctx, options) {
34907
- const result = await ctx.platformClient.callPublicApi(publicContractsV1.runner.launch, {
35806
+ case "action-not-supported-on-mobile":
35807
+ return {
35808
+ exitCode: exitCodes.invalidArgs,
35809
+ why: "has no touchscreen equivalent on a mobile runner."
35810
+ };
35811
+ case "screen-needs-a-run":
35812
+ return {
35813
+ exitCode: exitCodes.invalidArgs,
35814
+ why: `was refused: ${interactiveRunnerMessages.screenNeedsARun}`
35815
+ };
35816
+ case "runner-has-no-screen":
35817
+ return {
35818
+ exitCode: exitCodes.invalidArgs,
35819
+ why: `was refused: ${interactiveRunnerMessages.runnerHasNoScreen}`
35820
+ };
35821
+ case "screen-not-ready":
35822
+ return {
35823
+ exitCode: exitCodes.network,
35824
+ why: `was refused: ${interactiveRunnerMessages.screenNotReady}`
35825
+ };
35826
+ default: {
35827
+ return {
35828
+ exitCode: exitCodes.network,
35829
+ why: interactiveRunnerMessages.actionAnsweredUnknown(failureReason)
35830
+ };
35831
+ }
35832
+ }
35833
+ }
35834
+
35835
+ // src/domains/interactiveRunner/performActionsFailure.ts
35836
+ function describeSequenceFailure(options) {
35837
+ const { actions, answer } = options;
35838
+ const failed = answer.results.flatMap((step) => step.outcome === "failure" ? [step] : []);
35839
+ const described = failed.length > 0 ? failed.map((step) => ({ index: step.index, ...describeReason(step) })) : [
35840
+ {
35841
+ index: answer.failedIndex,
35842
+ ...describeAnswerWithoutAResult(answer.failureReason)
35843
+ }
35844
+ ];
35845
+ const sentences = [
35846
+ ...described.length > 1 ? [
35847
+ interactiveRunnerMessages.actionsNotAllSucceeded(described.length, actions.length)
35848
+ ] : [],
35849
+ ...described.map(({ index, why }) => interactiveRunnerMessages.actionsFailedAt(index, actions[index]?.type, why)),
35850
+ ...answer.stoppedEarly ? [
35851
+ interactiveRunnerMessages.actionsLeftUnperformed(actions.length - answer.results.length)
35852
+ ] : [],
35853
+ ...answer.lastCompletedIndex === undefined ? [] : [
35854
+ interactiveRunnerMessages.actionsPartlyApplied(answer.lastCompletedIndex)
35855
+ ]
35856
+ ];
35857
+ return {
35858
+ error: sentences.reduce((text, sentence) => appendSentence(text, sentence)),
35859
+ exitCode: worstExitCode(described.map(({ exitCode }) => exitCode))
35860
+ };
35861
+ }
35862
+
35863
+ // src/domains/interactiveRunner/performActionsOutput.ts
35864
+ function withoutFrames(answer, frames) {
35865
+ const { imageJpegBase64: _final, results, ...rest } = answer;
35866
+ return {
35867
+ ...rest,
35868
+ results: results.map((step) => {
35869
+ if (!("imageJpegBase64" in step))
35870
+ return step;
35871
+ const { imageJpegBase64: _frame, ...stepRest } = step;
35872
+ const path = frames.byAction.get(step.index);
35873
+ return path === undefined ? stepRest : { ...stepRest, screenshotPath: path };
35874
+ }),
35875
+ ...frames.final === undefined ? {} : { screenshotPath: frames.final }
35876
+ };
35877
+ }
35878
+ function describePerformed(count, frames) {
35879
+ if (frames.final === stdoutPath) {
35880
+ return interactiveRunnerMessages.actionsPerformedScreenshotToStdout(count);
35881
+ }
35882
+ if (frames.final !== undefined) {
35883
+ return interactiveRunnerMessages.actionsPerformedScreenshotWritten(count, frames.final);
35884
+ }
35885
+ if (frames.byAction.size > 0) {
35886
+ return interactiveRunnerMessages.actionsPerformedFramesWritten(count, [
35887
+ ...frames.byAction.values()
35888
+ ]);
35889
+ }
35890
+ return interactiveRunnerMessages.actionsPerformed(count);
35891
+ }
35892
+ function describeFailureFrames(frames) {
35893
+ if (frames.problem !== undefined)
35894
+ return frames.problem.error;
35895
+ if (frames.final === stdoutPath) {
35896
+ return interactiveRunnerMessages.actionsFailedScreenshotToStdout;
35897
+ }
35898
+ const paths = [
35899
+ ...frames.final === undefined ? [] : [frames.final],
35900
+ ...frames.byAction.values()
35901
+ ];
35902
+ return paths.length === 0 ? undefined : interactiveRunnerMessages.actionsFailedFramesWritten(paths);
35903
+ }
35904
+ function reportSequence(ctx, options) {
35905
+ const { answer, frames } = options;
35906
+ const message = options.failed ? interactiveRunnerMessages.actionsPerformedOfTotal(answer.results.filter((step) => step.effect === "performed").length, options.actionCount) : describePerformed(answer.results.length, frames);
35907
+ if (!options.toStdout) {
35908
+ ctx.ui.output(withoutFrames(answer, frames), message);
35909
+ return;
35910
+ }
35911
+ if (!options.failed)
35912
+ ctx.ui.success(message);
35913
+ }
35914
+
35915
+ // src/domains/interactiveRunner/performActionsFramePlan.ts
35916
+ import { extname } from "node:path";
35917
+ function indexedFramePath(out, index) {
35918
+ const extension = extname(out);
35919
+ const stem = extension === "" ? out : out.slice(0, -extension.length);
35920
+ return `${stem}-${index}${extension}`;
35921
+ }
35922
+ function isOwedAFinalFrame(answer) {
35923
+ const somethingTookEffect = answer.results.some((step) => step.effect === "performed");
35924
+ const runnerWentQuiet = "failureReason" in answer && answer.failureReason === "runner-unreachable";
35925
+ return somethingTookEffect && !runnerWentQuiet;
35926
+ }
35927
+ function framesAskedFor(answer, out, screenshotMode) {
35928
+ if (screenshotMode === "final") {
35929
+ const frame = {
35930
+ imageJpegBase64: answer.imageJpegBase64,
35931
+ index: undefined,
35932
+ path: out
35933
+ };
35934
+ return frame.imageJpegBase64 === undefined && !isOwedAFinalFrame(answer) ? [] : [frame];
35935
+ }
35936
+ return answer.results.flatMap((step) => {
35937
+ const imageJpegBase64 = "imageJpegBase64" in step ? step.imageJpegBase64 : undefined;
35938
+ return imageJpegBase64 === undefined && step.effect !== "performed" ? [] : [
35939
+ {
35940
+ imageJpegBase64,
35941
+ index: step.index,
35942
+ path: indexedFramePath(out, step.index)
35943
+ }
35944
+ ];
35945
+ });
35946
+ }
35947
+ function describeShortfall(options) {
35948
+ const { missing, performedCount, unwritten } = options;
35949
+ const missingIndexes = missing.flatMap((frame) => frame.index === undefined ? [] : [frame.index]);
35950
+ const sentences = [
35951
+ ...missingIndexes.length > 0 ? [interactiveRunnerMessages.actionsFramesMissing(missingIndexes)] : [],
35952
+ ...missing.some((frame) => frame.index === undefined) ? [
35953
+ interactiveRunnerMessages.actionsPerformedWithoutScreenshot(performedCount)
35954
+ ] : [],
35955
+ ...unwritten.length > 0 ? [interactiveRunnerMessages.actionsFramesUnwritable(unwritten)] : []
35956
+ ];
35957
+ return sentences.length === 0 ? undefined : sentences.reduce((text, sentence) => appendSentence(text, sentence));
35958
+ }
35959
+
35960
+ // src/domains/interactiveRunner/performActionsScreenshots.ts
35961
+ async function writeSequenceFrames(options, deps) {
35962
+ const { answer, out, screenshotMode } = options;
35963
+ if (out === undefined || screenshotMode === "none")
35964
+ return { byAction: new Map, final: undefined, problem: undefined };
35965
+ const asked = framesAskedFor(answer, out, screenshotMode);
35966
+ const arrived = asked.flatMap(({ imageJpegBase64, index, path }) => imageJpegBase64 === undefined ? [] : [{ imageJpegBase64, index, path }]);
35967
+ const writes = await Promise.all(arrived.map(async (frame) => ({
35968
+ frame,
35969
+ written: await deps.writeScreenshot({
35970
+ imageJpegBase64: frame.imageJpegBase64,
35971
+ path: frame.path
35972
+ })
35973
+ })));
35974
+ const unwritten = writes.flatMap(({ frame, written }) => written.ok ? [] : [
35975
+ {
35976
+ detail: written.reason === "not-a-jpeg" ? "it did not arrive as a JPEG" : written.detail,
35977
+ path: frame.path
35978
+ }
35979
+ ]);
35980
+ const onDisk = writes.filter(({ written }) => written.ok).map(({ frame }) => frame);
35981
+ const shortfall = describeShortfall({
35982
+ missing: asked.filter((frame) => frame.imageJpegBase64 === undefined),
35983
+ performedCount: answer.results.filter((step) => step.effect === "performed").length,
35984
+ unwritten
35985
+ });
35986
+ return {
35987
+ byAction: new Map(onDisk.flatMap((frame) => frame.index === undefined ? [] : [[frame.index, frame.path]])),
35988
+ final: onDisk.find((frame) => frame.index === undefined)?.path,
35989
+ problem: shortfall === undefined ? undefined : { error: shortfall, exitCode: exitCodes.network }
35990
+ };
35991
+ }
35992
+
35993
+ // src/core/interactiveRunner/browserAction.ts
35994
+ function parseJsonPath(path) {
35995
+ try {
35996
+ return { ok: true, value: JSON.parse(path) };
35997
+ } catch {
35998
+ return {
35999
+ error: `--path must be a JSON array of points, for example '[{"x":10,"y":20},{"x":80,"y":90}]'.`,
36000
+ ok: false
36001
+ };
36002
+ }
36003
+ }
36004
+ function toNumber(value) {
36005
+ return value.trim() === "" ? Number.NaN : Number(value);
36006
+ }
36007
+ function buildBrowserAction(type, flags) {
36008
+ const parsedPath = flags.path === undefined ? undefined : parseJsonPath(flags.path);
36009
+ if (parsedPath !== undefined && !parsedPath.ok)
36010
+ return parsedPath;
36011
+ const candidate = {
36012
+ type,
36013
+ ...flags.button === undefined ? {} : { button: flags.button },
36014
+ ...flags.keys === undefined ? {} : { keys: flags.keys },
36015
+ ...parsedPath === undefined ? {} : { path: parsedPath.value },
36016
+ ...flags.scrollX === undefined ? {} : { scroll_x: toNumber(flags.scrollX) },
36017
+ ...flags.scrollY === undefined ? {} : { scroll_y: toNumber(flags.scrollY) },
36018
+ ...flags.text === undefined ? {} : { text: flags.text },
36019
+ ...flags.url === undefined ? {} : { url: flags.url },
36020
+ ...flags.x === undefined ? {} : { x: toNumber(flags.x) },
36021
+ ...flags.y === undefined ? {} : { y: toNumber(flags.y) }
36022
+ };
36023
+ return parseBrowserAction(candidate);
36024
+ }
36025
+ function parseBrowserAction(candidate) {
36026
+ const parsed = browserActionSchema.safeParse(candidate);
36027
+ if (!parsed.success) {
36028
+ return { error: prettifyError(parsed.error), ok: false };
36029
+ }
36030
+ return { action: parsed.data, ok: true };
36031
+ }
36032
+
36033
+ // src/domains/interactiveRunner/readActions.ts
36034
+ var stdinArgument = "-";
36035
+ async function readActions(argument, deps) {
36036
+ const raw = argument === stdinArgument ? (await deps.readStdin()).trim() : argument;
36037
+ if (argument === stdinArgument && raw === "") {
36038
+ return { error: interactiveRunnerMessages.stdinEmptySequence, ok: false };
36039
+ }
36040
+ const parsed = parseJsonArray(raw);
36041
+ if (!parsed.ok)
36042
+ return parsed;
36043
+ if (parsed.items.length === 0)
36044
+ return { error: interactiveRunnerMessages.actionsEmpty, ok: false };
36045
+ if (parsed.items.length > maxActionsPerRequest) {
36046
+ return {
36047
+ error: interactiveRunnerMessages.actionsOverLimit(parsed.items.length, maxActionsPerRequest),
36048
+ ok: false
36049
+ };
36050
+ }
36051
+ const built = parsed.items.map(parseBrowserAction);
36052
+ const firstRefused = built.findIndex((action) => !action.ok);
36053
+ const refused = built[firstRefused];
36054
+ if (refused !== undefined && !refused.ok) {
36055
+ return {
36056
+ error: interactiveRunnerMessages.actionsInvalidAt(firstRefused, refused.error),
36057
+ ok: false
36058
+ };
36059
+ }
36060
+ return {
36061
+ actions: built.flatMap((action) => action.ok ? [action.action] : []),
36062
+ ok: true
36063
+ };
36064
+ }
36065
+ function parseJsonArray(raw) {
36066
+ try {
36067
+ const value = JSON.parse(raw);
36068
+ return Array.isArray(value) ? { items: value, ok: true } : { error: interactiveRunnerMessages.actionsNotJsonArray, ok: false };
36069
+ } catch {
36070
+ return { error: interactiveRunnerMessages.actionsNotJsonArray, ok: false };
36071
+ }
36072
+ }
36073
+ function refuseUnwritableFrames(ctx, screenshotMode, options) {
36074
+ if (screenshotMode === "none" && options.screenshot !== undefined) {
36075
+ return {
36076
+ error: interactiveRunnerMessages.actionsScreenshotWithModeNone,
36077
+ exitCode: exitCodes.invalidArgs
36078
+ };
36079
+ }
36080
+ if (screenshotMode !== "none" && options.screenshot === undefined) {
36081
+ return {
36082
+ error: screenshotMode === "each" ? interactiveRunnerMessages.actionsEachNeedsAPath : interactiveRunnerMessages.actionsFinalNeedsAPath,
36083
+ exitCode: exitCodes.invalidArgs
36084
+ };
36085
+ }
36086
+ if (screenshotMode === "each" && options.screenshot === stdoutPath) {
36087
+ return {
36088
+ error: interactiveRunnerMessages.actionsEachToStdout,
36089
+ exitCode: exitCodes.invalidArgs
36090
+ };
36091
+ }
36092
+ if (options.screenshot === stdoutPath && ctx.outputMode === "human") {
36093
+ return {
36094
+ error: interactiveRunnerMessages.stdoutIsATerminal("--screenshot"),
36095
+ exitCode: exitCodes.invalidArgs
36096
+ };
36097
+ }
36098
+ return;
36099
+ }
36100
+
36101
+ // src/domains/interactiveRunner/runnerCallOptions.ts
36102
+ var runnerCallOptions = { timeoutMs: 90000 };
36103
+ var sequenceCallOptions = { timeoutMs: 180000 };
36104
+
36105
+ // src/domains/interactiveRunner/launchAndRemember.ts
36106
+ async function launchRunner(ctx, options) {
36107
+ const result = await ctx.platformClient.callPublicApi(publicContractsV1.runner.launch, {
34908
36108
  id: options.id,
34909
36109
  ...options.runnerName ? { runnerName: options.runnerName } : {}
34910
36110
  }, runnerCallOptions);
@@ -35029,137 +36229,46 @@ ${cameFrom}` : cameFrom,
35029
36229
  };
35030
36230
  }
35031
36231
 
35032
- // src/core/interactiveRunner/runFiles.ts
35033
- import { isAbsolute as isAbsolute5, relative as relative10, resolve as resolve11, sep as sep5 } from "node:path";
35034
- function toCollectedPath(cwd, path) {
35035
- const absolute = isAbsolute5(path) ? path : resolve11(cwd, path);
35036
- return relative10(cwd, absolute).split(sep5).join("/");
35037
- }
35038
- var namedLargestFileCount = 3;
35039
- function largestFiles(files) {
35040
- return Object.entries(files).map(([path, content]) => ({
35041
- byteLength: runFilesByteLength({ [path]: content }),
35042
- path
35043
- })).sort((a, b) => b.byteLength - a.byteLength).slice(0, namedLargestFileCount);
35044
- }
35045
- function checkPresenceAndSize(files, requiredPath) {
35046
- if (!Object.hasOwn(files, requiredPath)) {
35047
- return { path: requiredPath, type: "missing-file" };
35048
- }
35049
- const byteLength = runFilesByteLength(files);
35050
- if (byteLength > maxRunFilesByteLength) {
35051
- return {
35052
- byteLength,
35053
- largest: largestFiles(files),
35054
- maxByteLength: maxRunFilesByteLength,
35055
- type: "too-large"
35056
- };
35057
- }
35058
- const encodedByteLength = Buffer.byteLength(JSON.stringify({ files, path: requiredPath }), "utf8");
35059
- if (encodedByteLength > maxRunnerRequestEncodedByteLength) {
35060
- return {
35061
- byteLength: encodedByteLength,
35062
- maxByteLength: maxRunnerRequestEncodedByteLength,
35063
- type: "request-too-large"
35064
- };
35065
- }
35066
- return { type: "ok" };
35067
- }
35068
- function checkRunFiles(files, entryPointPath) {
35069
- const present = checkPresenceAndSize(files, entryPointPath);
35070
- if (present.type !== "ok")
35071
- return present;
35072
- if (!Object.hasOwn(files, runPackageJsonPath)) {
35073
- return { type: "missing-package-json" };
35074
- }
35075
- return { type: "ok" };
35076
- }
35077
- function checkSnippetFiles(files, contextFilePath) {
35078
- return checkPresenceAndSize(files, contextFilePath);
35079
- }
35080
- function describeRunFilesCheck(check) {
35081
- switch (check.type) {
35082
- case "missing-file":
35083
- return interactiveRunnerMessages.fileNotCollected(check.path);
35084
- case "missing-package-json":
35085
- return interactiveRunnerMessages.missingPackageJson;
35086
- case "too-large":
35087
- return interactiveRunnerMessages.filesTooLarge(check.byteLength, check.maxByteLength, check.largest);
35088
- case "request-too-large":
35089
- return interactiveRunnerMessages.requestTooLarge(check.byteLength, check.maxByteLength);
35090
- }
35091
- }
35092
-
35093
- // src/domains/interactiveRunner/snippetScope.ts
35094
- async function resolveSnippetScope(contextFile, deps) {
35095
- if (contextFile === undefined) {
35096
- return { filePath: undefined, files: undefined, ok: true };
35097
- }
35098
- const filePath = toCollectedPath(deps.cwd, contextFile);
35099
- const { files } = await deps.collectRunFiles([filePath]);
35100
- const check = checkSnippetFiles(files, filePath);
35101
- if (check.type !== "ok") {
35102
- return { error: describeRunFilesCheck(check), ok: false };
35103
- }
35104
- return { filePath, files, ok: true };
35105
- }
35106
-
35107
- // src/domains/interactiveRunner/evaluateSnippet.ts
35108
- var stdinArgument = "-";
35109
- async function readCode(source, deps) {
35110
- const code = source === stdinArgument ? await deps.readStdin() : await deps.readFile(source).catch(() => {
35111
- return;
35112
- });
35113
- if (code === undefined) {
35114
- return {
35115
- error: interactiveRunnerMessages.snippetFileUnreadable(source),
35116
- ok: false
35117
- };
35118
- }
35119
- if (code.trim() === "") {
35120
- return source === stdinArgument ? { error: interactiveRunnerMessages.stdinEmptySnippet, ok: false } : { error: interactiveRunnerMessages.snippetEmpty(source), ok: false };
35121
- }
35122
- return { code, ok: true };
35123
- }
35124
- async function handleRunnerExec(ctx, options, deps) {
35125
- const code = await readCode(options.source, deps);
35126
- if (!code.ok)
35127
- return { error: code.error, exitCode: exitCodes.invalidArgs };
35128
- const scope = await resolveSnippetScope(options.contextFile, deps);
35129
- if (!scope.ok)
35130
- return { error: scope.error, exitCode: exitCodes.invalidArgs };
35131
- const resolved = await resolveRunner(ctx, { autoLaunch: true, runner: options.runner }, deps);
35132
- if (resolved.type === "failed") {
35133
- return { ...failureFields(resolved), exitCode: resolved.exitCode };
35134
- }
35135
- announceRunner(ctx, resolved);
35136
- const result = await ctx.platformClient.callPublicApi(publicContractsV1.runner.evaluateSnippet, {
35137
- code: code.code,
35138
- id: resolved.runnerId,
35139
- ...scope.filePath === undefined ? {} : { filePath: scope.filePath },
35140
- ...scope.files === undefined ? {} : { files: scope.files }
35141
- }, runnerCallOptions);
35142
- if (!result.ok) {
35143
- return runnerRequestFailure(result, resolved);
35144
- }
35145
- if (result.value.outcome === "failure") {
35146
- return describeEvaluateSnippetFailure(result.value);
35147
- }
35148
- switch (result.value.result) {
35149
- case "success":
35150
- ctx.ui.output({ outcome: "evaluated", result: "success" }, interactiveRunnerMessages.snippetRan);
35151
- return;
35152
- case "stopped":
35153
- return {
35154
- error: interactiveRunnerMessages.snippetStopped,
35155
- exitCode: exitCodes.testFailure
35156
- };
35157
- case "error":
35158
- return {
35159
- error: interactiveRunnerMessages.snippetErrored(result.value.errorMessage),
35160
- exitCode: exitCodes.testFailure
35161
- };
36232
+ // src/domains/interactiveRunner/performActions.ts
36233
+ async function handleRunnerActions(ctx, options, deps) {
36234
+ const read = await readActions(options.actions, deps);
36235
+ if (!read.ok)
36236
+ return { error: read.error, exitCode: exitCodes.invalidArgs };
36237
+ const screenshotMode = options.screenshotMode ?? (options.screenshot === undefined ? "none" : "final");
36238
+ const refusedLocally = refuseUnwritableFrames(ctx, screenshotMode, options);
36239
+ if (refusedLocally !== undefined)
36240
+ return refusedLocally;
36241
+ const resolved = await resolveRunner(ctx, { autoLaunch: true, runner: options.runner }, deps);
36242
+ if (resolved.type === "failed")
36243
+ return { ...failureFields(resolved), exitCode: resolved.exitCode };
36244
+ announceRunner(ctx, resolved);
36245
+ const result = await ctx.platformClient.callPublicApi(publicContractsV1.runner.performActions, {
36246
+ actions: read.actions,
36247
+ id: resolved.runnerId,
36248
+ screenshotMode,
36249
+ stopOnFailure: !options.continueOnFailure
36250
+ }, sequenceCallOptions);
36251
+ if (!result.ok) {
36252
+ const fields = runnerRequestFailure(result, resolved);
36253
+ return result.mayHaveArrived ? {
36254
+ ...fields,
36255
+ error: appendSentence(fields.error, interactiveRunnerMessages.actionsMayHaveHappened)
36256
+ } : fields;
35162
36257
  }
36258
+ const answer = result.value;
36259
+ const frames = await writeSequenceFrames({ answer, out: options.screenshot, screenshotMode }, deps);
36260
+ const failure = answer.outcome === "success" ? undefined : describeSequenceFailure({ actions: read.actions, answer });
36261
+ reportSequence(ctx, {
36262
+ actionCount: read.actions.length,
36263
+ answer,
36264
+ failed: failure !== undefined,
36265
+ frames,
36266
+ toStdout: screenshotMode !== "none" && options.screenshot === stdoutPath
36267
+ });
36268
+ if (failure === undefined)
36269
+ return frames.problem;
36270
+ const framesNote = describeFailureFrames(frames);
36271
+ return framesNote === undefined ? failure : { ...failure, error: appendSentence(failure.error, framesNote) };
35163
36272
  }
35164
36273
 
35165
36274
  // src/shell/interactiveRunner/collectRunFiles.ts
@@ -35202,7 +36311,7 @@ function isPathAlias(importPath, paths) {
35202
36311
  }
35203
36312
 
35204
36313
  // src/core/interactiveRunner/resolveImportPath.ts
35205
- import { dirname as dirname15, join as join52, normalize as normalize3 } from "node:path/posix";
36314
+ import { dirname as dirname16, join as join52, normalize as normalize3 } from "node:path/posix";
35206
36315
  var supportedExtensions = [".ts", ".js"];
35207
36316
  function candidatesForExplicitExtension(options) {
35208
36317
  const matching = supportedExtensions.find((extension) => options.importPath.endsWith(extension));
@@ -35216,7 +36325,7 @@ function candidatesForExplicitExtension(options) {
35216
36325
  }
35217
36326
  function resolveImportPath(options) {
35218
36327
  const aliasTarget = resolvePathAlias(options.importPath, options.tsconfigPaths);
35219
- const resolvedPath = aliasTarget === undefined ? normalize3(join52(dirname15(options.importingFilePath), options.importPath)) : normalize3(aliasTarget);
36328
+ const resolvedPath = aliasTarget === undefined ? normalize3(join52(dirname16(options.importingFilePath), options.importPath)) : normalize3(aliasTarget);
35220
36329
  const hasExplicitExtension = supportedExtensions.some((extension) => options.importPath.endsWith(extension));
35221
36330
  const candidates = hasExplicitExtension ? candidatesForExplicitExtension({
35222
36331
  importPath: options.importPath,
@@ -35412,42 +36521,6 @@ function makeRunnerStore(options) {
35412
36521
  };
35413
36522
  }
35414
36523
 
35415
- // src/shell/interactiveRunner/writeScreenshot.ts
35416
- import { dirname as dirname16 } from "node:path";
35417
- var jpegStartOfImage = [255, 216, 255];
35418
- var stdoutPath = "-";
35419
- async function writeScreenshot(options) {
35420
- const bytes = Buffer.from(options.imageJpegBase64, "base64");
35421
- if (jpegStartOfImage.some((byte, index) => bytes[index] !== byte)) {
35422
- return { ok: false, reason: "not-a-jpeg" };
35423
- }
35424
- try {
35425
- if (options.path === stdoutPath) {
35426
- await writeToStdout(options.stdout ?? process.stdout, bytes);
35427
- } else {
35428
- await options.fs.mkdir(dirname16(options.path), { recursive: true });
35429
- await options.fs.writeFile(options.path, bytes);
35430
- }
35431
- } catch (error) {
35432
- return { detail: errorMessage(error), ok: false, reason: "unwritable" };
35433
- }
35434
- return { ok: true };
35435
- }
35436
- function writeToStdout(stdout, bytes) {
35437
- return new Promise((resolve, reject) => {
35438
- const onError = (error) => reject(error);
35439
- stdout.once("error", onError);
35440
- stdout.write(bytes, (error) => {
35441
- if (error) {
35442
- reject(error);
35443
- return;
35444
- }
35445
- stdout.off("error", onError);
35446
- resolve();
35447
- });
35448
- });
35449
- }
35450
-
35451
36524
  // src/shell/stdin.ts
35452
36525
  async function readStdin2() {
35453
36526
  if (process.stdin.isTTY === true)
@@ -35487,6 +36560,178 @@ function runnerDeps(ctx) {
35487
36560
  });
35488
36561
  }
35489
36562
 
36563
+ // src/commands/runner/actions.register.ts
36564
+ var actionsExamples = `
36565
+ Examples:
36566
+ $ qawolf runner actions '[{"type":"click","button":"left","x":480,"y":260},{"type":"type","text":"hello@example.com"},{"type":"keypress","keys":["Enter"]}]' --screenshot after-login.jpg
36567
+ $ echo '[{"type":"click","button":"left","x":1,"y":2},{"type":"type","text":"hi"}]' | qawolf runner actions -
36568
+ $ qawolf runner actions '[{"type":"click","button":"left","x":480,"y":260},{"type":"type","text":"hello"}]' --screenshot-mode each --screenshot step.jpg
36569
+ $ qawolf runner actions '[{"type":"scroll","x":480,"y":260,"scroll_x":0,"scroll_y":600},{"type":"click","button":"left","x":120,"y":700}]' --continue-on-failure`;
36570
+ function registerRunnerActionsCommand(runner, signals) {
36571
+ declareCommandKind(runner.command("actions <sequence>"), "write").description("Perform a sequence of up to ten raw actions on a runner's screen in one request, as a JSON array of the same actions `runner act` takes. Use - to read the array from stdin. Actions run back to back, so batch only steps whose targets are on the screen you last saw, and end the sequence at the step that changes the page. Each result carries an effect: performed, not-performed, or unknown when the runner stopped answering and the action may have landed").option("--continue-on-failure", "Carry on past an action that reached the runner and did not take effect; a runner that cannot be reached or a screen that cannot serve still ends the sequence").option("--runner <id>", runnerFlagDescription).option("--screenshot <path>", "Save a JPEG of the screen after the last action to this file. With --screenshot-mode each, one file per action, with the action's index before the extension. - writes the final frame to stdout and moves the confirmation to stderr").addOption(new Option2("--screenshot-mode <mode>", "Defaults to final when --screenshot is given, none otherwise").choices([...screenshotModes])).addHelpText("after", actionsExamples).action((sequence, opts, command) => withAuthContext(signals, (ctx) => handleRunnerActions(ctx, {
36572
+ actions: sequence,
36573
+ continueOnFailure: opts.continueOnFailure === true,
36574
+ runner: opts.runner,
36575
+ screenshot: opts.screenshot,
36576
+ screenshotMode: opts.screenshotMode
36577
+ }, runnerDeps(ctx)))(opts, command));
36578
+ }
36579
+
36580
+ // src/domains/interactiveRunner/evaluateSnippetFailure.ts
36581
+ function describeEvaluateSnippetFailure(failure) {
36582
+ const { failureReason } = failure;
36583
+ switch (failureReason) {
36584
+ case "runner-cannot-evaluate-snippets":
36585
+ return {
36586
+ error: interactiveRunnerMessages.runnerCannotEvaluateSnippets,
36587
+ exitCode: exitCodes.invalidArgs
36588
+ };
36589
+ case "runner-unreachable":
36590
+ return {
36591
+ error: interactiveRunnerMessages.snippetRunnerUnreachable,
36592
+ exitCode: exitCodes.network
36593
+ };
36594
+ default:
36595
+ return {
36596
+ error: interactiveRunnerMessages.snippetAnsweredUnknown(failureReason),
36597
+ exitCode: exitCodes.network
36598
+ };
36599
+ }
36600
+ }
36601
+
36602
+ // src/core/interactiveRunner/runFiles.ts
36603
+ import { isAbsolute as isAbsolute5, relative as relative10, resolve as resolve11, sep as sep5 } from "node:path";
36604
+ function toCollectedPath(cwd, path) {
36605
+ const absolute = isAbsolute5(path) ? path : resolve11(cwd, path);
36606
+ return relative10(cwd, absolute).split(sep5).join("/");
36607
+ }
36608
+ var namedLargestFileCount = 3;
36609
+ function largestFiles(files) {
36610
+ return Object.entries(files).map(([path, content]) => ({
36611
+ byteLength: runFilesByteLength({ [path]: content }),
36612
+ path
36613
+ })).sort((a, b) => b.byteLength - a.byteLength).slice(0, namedLargestFileCount);
36614
+ }
36615
+ function checkPresenceAndSize(files, requiredPath) {
36616
+ if (!Object.hasOwn(files, requiredPath)) {
36617
+ return { path: requiredPath, type: "missing-file" };
36618
+ }
36619
+ const byteLength = runFilesByteLength(files);
36620
+ if (byteLength > maxRunFilesByteLength) {
36621
+ return {
36622
+ byteLength,
36623
+ largest: largestFiles(files),
36624
+ maxByteLength: maxRunFilesByteLength,
36625
+ type: "too-large"
36626
+ };
36627
+ }
36628
+ const encodedByteLength = Buffer.byteLength(JSON.stringify({ files, path: requiredPath }), "utf8");
36629
+ if (encodedByteLength > maxRunnerRequestEncodedByteLength) {
36630
+ return {
36631
+ byteLength: encodedByteLength,
36632
+ maxByteLength: maxRunnerRequestEncodedByteLength,
36633
+ type: "request-too-large"
36634
+ };
36635
+ }
36636
+ return { type: "ok" };
36637
+ }
36638
+ function checkRunFiles(files, entryPointPath) {
36639
+ const present = checkPresenceAndSize(files, entryPointPath);
36640
+ if (present.type !== "ok")
36641
+ return present;
36642
+ if (!Object.hasOwn(files, runPackageJsonPath)) {
36643
+ return { type: "missing-package-json" };
36644
+ }
36645
+ return { type: "ok" };
36646
+ }
36647
+ function checkSnippetFiles(files, contextFilePath) {
36648
+ return checkPresenceAndSize(files, contextFilePath);
36649
+ }
36650
+ function describeRunFilesCheck(check) {
36651
+ switch (check.type) {
36652
+ case "missing-file":
36653
+ return interactiveRunnerMessages.fileNotCollected(check.path);
36654
+ case "missing-package-json":
36655
+ return interactiveRunnerMessages.missingPackageJson;
36656
+ case "too-large":
36657
+ return interactiveRunnerMessages.filesTooLarge(check.byteLength, check.maxByteLength, check.largest);
36658
+ case "request-too-large":
36659
+ return interactiveRunnerMessages.requestTooLarge(check.byteLength, check.maxByteLength);
36660
+ }
36661
+ }
36662
+
36663
+ // src/domains/interactiveRunner/snippetScope.ts
36664
+ async function resolveSnippetScope(contextFile, deps) {
36665
+ if (contextFile === undefined) {
36666
+ return { filePath: undefined, files: undefined, ok: true };
36667
+ }
36668
+ const filePath = toCollectedPath(deps.cwd, contextFile);
36669
+ const { files } = await deps.collectRunFiles([filePath]);
36670
+ const check = checkSnippetFiles(files, filePath);
36671
+ if (check.type !== "ok") {
36672
+ return { error: describeRunFilesCheck(check), ok: false };
36673
+ }
36674
+ return { filePath, files, ok: true };
36675
+ }
36676
+
36677
+ // src/domains/interactiveRunner/evaluateSnippet.ts
36678
+ var stdinArgument2 = "-";
36679
+ async function readCode(source, deps) {
36680
+ const code = source === stdinArgument2 ? await deps.readStdin() : await deps.readFile(source).catch(() => {
36681
+ return;
36682
+ });
36683
+ if (code === undefined) {
36684
+ return {
36685
+ error: interactiveRunnerMessages.snippetFileUnreadable(source),
36686
+ ok: false
36687
+ };
36688
+ }
36689
+ if (code.trim() === "") {
36690
+ return source === stdinArgument2 ? { error: interactiveRunnerMessages.stdinEmptySnippet, ok: false } : { error: interactiveRunnerMessages.snippetEmpty(source), ok: false };
36691
+ }
36692
+ return { code, ok: true };
36693
+ }
36694
+ async function handleRunnerExec(ctx, options, deps) {
36695
+ const code = await readCode(options.source, deps);
36696
+ if (!code.ok)
36697
+ return { error: code.error, exitCode: exitCodes.invalidArgs };
36698
+ const scope = await resolveSnippetScope(options.contextFile, deps);
36699
+ if (!scope.ok)
36700
+ return { error: scope.error, exitCode: exitCodes.invalidArgs };
36701
+ const resolved = await resolveRunner(ctx, { autoLaunch: true, runner: options.runner }, deps);
36702
+ if (resolved.type === "failed") {
36703
+ return { ...failureFields(resolved), exitCode: resolved.exitCode };
36704
+ }
36705
+ announceRunner(ctx, resolved);
36706
+ const result = await ctx.platformClient.callPublicApi(publicContractsV1.runner.evaluateSnippet, {
36707
+ code: code.code,
36708
+ id: resolved.runnerId,
36709
+ ...scope.filePath === undefined ? {} : { filePath: scope.filePath },
36710
+ ...scope.files === undefined ? {} : { files: scope.files }
36711
+ }, runnerCallOptions);
36712
+ if (!result.ok) {
36713
+ return runnerRequestFailure(result, resolved);
36714
+ }
36715
+ if (result.value.outcome === "failure") {
36716
+ return describeEvaluateSnippetFailure(result.value);
36717
+ }
36718
+ switch (result.value.result) {
36719
+ case "success":
36720
+ ctx.ui.output({ outcome: "evaluated", result: "success" }, interactiveRunnerMessages.snippetRan);
36721
+ return;
36722
+ case "stopped":
36723
+ return {
36724
+ error: interactiveRunnerMessages.snippetStopped,
36725
+ exitCode: exitCodes.testFailure
36726
+ };
36727
+ case "error":
36728
+ return {
36729
+ error: interactiveRunnerMessages.snippetErrored(result.value.errorMessage),
36730
+ exitCode: exitCodes.testFailure
36731
+ };
36732
+ }
36733
+ }
36734
+
35490
36735
  // src/commands/runner/exec.register.ts
35491
36736
  var execExamples = `
35492
36737
  Examples:
@@ -35756,7 +37001,7 @@ var blankInspectMobileFlags = {
35756
37001
  x: undefined,
35757
37002
  y: undefined
35758
37003
  };
35759
- function toNumber(value) {
37004
+ function toNumber2(value) {
35760
37005
  return value.trim() === "" ? Number.NaN : Number(value);
35761
37006
  }
35762
37007
  var groupsOf = (flags) => ({
@@ -35792,8 +37037,8 @@ function buildInspectMobileRequest(what, flags) {
35792
37037
  ...flags.selector === undefined ? {} : { selector: flags.selector },
35793
37038
  ...flags.strategy === undefined ? {} : { strategy: flags.strategy },
35794
37039
  ...flags.text === undefined ? {} : { text: flags.text },
35795
- ...flags.x === undefined ? {} : { x: toNumber(flags.x) },
35796
- ...flags.y === undefined ? {} : { y: toNumber(flags.y) }
37040
+ ...flags.x === undefined ? {} : { x: toNumber2(flags.x) },
37041
+ ...flags.y === undefined ? {} : { y: toNumber2(flags.y) }
35797
37042
  };
35798
37043
  const parsed = inspectMobileRequestSchema.safeParse(candidate);
35799
37044
  if (!parsed.success) {
@@ -35959,12 +37204,6 @@ function registerRunnerInspectCommands(runner, signals) {
35959
37204
  registerRunnerInspectMobileCommands(inspect, signals);
35960
37205
  }
35961
37206
 
35962
- // src/core/sentences.ts
35963
- function appendSentence(text, sentence) {
35964
- const punctuated = /[.!?]$/.test(text.trimEnd()) ? text.trimEnd() : `${text.trimEnd()}.`;
35965
- return `${punctuated} ${sentence}`;
35966
- }
35967
-
35968
37207
  // src/domains/interactiveRunner/performActionFailure.ts
35969
37208
  function describePerformActionFailure(options) {
35970
37209
  const { actionType, failure } = options;
@@ -36059,50 +37298,10 @@ async function describeFailureScreenshot(options, deps) {
36059
37298
  return options.out === stdoutPath ? interactiveRunnerMessages.actionFailedScreenshotToStdout : interactiveRunnerMessages.actionFailedScreenshotWritten(options.out);
36060
37299
  }
36061
37300
 
36062
- // src/core/interactiveRunner/browserAction.ts
36063
- function parseJsonPath(path) {
36064
- try {
36065
- return { ok: true, value: JSON.parse(path) };
36066
- } catch {
36067
- return {
36068
- error: `--path must be a JSON array of points, for example '[{"x":10,"y":20},{"x":80,"y":90}]'.`,
36069
- ok: false
36070
- };
36071
- }
36072
- }
36073
- function toNumber2(value) {
36074
- return value.trim() === "" ? Number.NaN : Number(value);
36075
- }
36076
- function buildBrowserAction(type, flags) {
36077
- const parsedPath = flags.path === undefined ? undefined : parseJsonPath(flags.path);
36078
- if (parsedPath !== undefined && !parsedPath.ok)
36079
- return parsedPath;
36080
- const candidate = {
36081
- type,
36082
- ...flags.button === undefined ? {} : { button: flags.button },
36083
- ...flags.keys === undefined ? {} : { keys: flags.keys },
36084
- ...parsedPath === undefined ? {} : { path: parsedPath.value },
36085
- ...flags.scrollX === undefined ? {} : { scroll_x: toNumber2(flags.scrollX) },
36086
- ...flags.scrollY === undefined ? {} : { scroll_y: toNumber2(flags.scrollY) },
36087
- ...flags.text === undefined ? {} : { text: flags.text },
36088
- ...flags.url === undefined ? {} : { url: flags.url },
36089
- ...flags.x === undefined ? {} : { x: toNumber2(flags.x) },
36090
- ...flags.y === undefined ? {} : { y: toNumber2(flags.y) }
36091
- };
36092
- return parseBrowserAction(candidate);
36093
- }
36094
- function parseBrowserAction(candidate) {
36095
- const parsed = browserActionSchema.safeParse(candidate);
36096
- if (!parsed.success) {
36097
- return { error: prettifyError(parsed.error), ok: false };
36098
- }
36099
- return { action: parsed.data, ok: true };
36100
- }
36101
-
36102
37301
  // src/domains/interactiveRunner/readAction.ts
36103
- var stdinArgument2 = "-";
37302
+ var stdinArgument3 = "-";
36104
37303
  async function readAction(type, flags, deps) {
36105
- if (type !== stdinArgument2)
37304
+ if (type !== stdinArgument3)
36106
37305
  return buildBrowserAction(type, flags);
36107
37306
  if (Object.values(flags).some((value) => value !== undefined)) {
36108
37307
  return { error: interactiveRunnerMessages.actionFlagsWithStdin, ok: false };
@@ -37223,6 +38422,7 @@ function registerRunnerCommand(program, signals) {
37223
38422
  registerRunCommand(runner, signals);
37224
38423
  registerRunnerEventsCommand(runner, signals);
37225
38424
  registerRunnerInteractCommands(runner, signals);
38425
+ registerRunnerActionsCommand(runner, signals);
37226
38426
  registerRunnerExecCommand(runner, signals);
37227
38427
  registerRunnerInspectCommands(runner, signals);
37228
38428
  registerRunnerImportPackageCommand(runner, signals);
@@ -37258,4 +38458,4 @@ createProgram({ signals }).parseAsync().catch(() => {
37258
38458
  process.exitCode = 1;
37259
38459
  }).finally(() => exitWhenIdle(typeof process.exitCode === "number" ? process.exitCode : 0));
37260
38460
 
37261
- //# debugId=59D2DE48FE68917864756E2164756E21
38461
+ //# debugId=3E71BA5C9A67947964756E2164756E21