simplify3x-connect 0.31.8 → 0.31.10

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.
Files changed (167) hide show
  1. package/assets/tessdata/eng.traineddata +0 -0
  2. package/dist/adapters/remoteMcp/adapter.d.ts +1 -1
  3. package/dist/adapters/remoteMcp/adapter.d.ts.map +1 -1
  4. package/dist/adapters/remoteMcp/adapter.js +6 -5
  5. package/dist/adapters/remoteMcp/adapter.js.map +1 -1
  6. package/dist/adapters/simplifyqa/adapter.d.ts +30 -1
  7. package/dist/adapters/simplifyqa/adapter.d.ts.map +1 -1
  8. package/dist/adapters/simplifyqa/adapter.js +199 -21
  9. package/dist/adapters/simplifyqa/adapter.js.map +1 -1
  10. package/dist/adapters/simplifyqa/appProfile.d.ts +25 -0
  11. package/dist/adapters/simplifyqa/appProfile.d.ts.map +1 -0
  12. package/dist/adapters/simplifyqa/appProfile.js +137 -0
  13. package/dist/adapters/simplifyqa/appProfile.js.map +1 -0
  14. package/dist/adapters/simplifyqa/executionFailures.d.ts +53 -11
  15. package/dist/adapters/simplifyqa/executionFailures.d.ts.map +1 -1
  16. package/dist/adapters/simplifyqa/executionFailures.js +289 -46
  17. package/dist/adapters/simplifyqa/executionFailures.js.map +1 -1
  18. package/dist/adapters/simplifyqa/executionSources.d.ts +64 -0
  19. package/dist/adapters/simplifyqa/executionSources.d.ts.map +1 -0
  20. package/dist/adapters/simplifyqa/executionSources.js +138 -0
  21. package/dist/adapters/simplifyqa/executionSources.js.map +1 -0
  22. package/dist/adapters/simplifyqa/failureAnalysis.d.ts +18 -1
  23. package/dist/adapters/simplifyqa/failureAnalysis.d.ts.map +1 -1
  24. package/dist/adapters/simplifyqa/failureAnalysis.js +182 -10
  25. package/dist/adapters/simplifyqa/failureAnalysis.js.map +1 -1
  26. package/dist/adapters/simplifyqa/failureAnalysisCard.d.ts.map +1 -1
  27. package/dist/adapters/simplifyqa/failureAnalysisCard.js +45 -19
  28. package/dist/adapters/simplifyqa/failureAnalysisCard.js.map +1 -1
  29. package/dist/adapters/simplifyqa/failureAnalysisRun.d.ts +8 -1
  30. package/dist/adapters/simplifyqa/failureAnalysisRun.d.ts.map +1 -1
  31. package/dist/adapters/simplifyqa/failureAnalysisRun.js +108 -4
  32. package/dist/adapters/simplifyqa/failureAnalysisRun.js.map +1 -1
  33. package/dist/adapters/simplifyqa/failureAnalysisTypes.d.ts +65 -1
  34. package/dist/adapters/simplifyqa/failureAnalysisTypes.d.ts.map +1 -1
  35. package/dist/adapters/simplifyqa/failureAnalysisTypes.js +12 -1
  36. package/dist/adapters/simplifyqa/failureAnalysisTypes.js.map +1 -1
  37. package/dist/adapters/simplifyqa/failureHistory.d.ts +64 -20
  38. package/dist/adapters/simplifyqa/failureHistory.d.ts.map +1 -1
  39. package/dist/adapters/simplifyqa/failureHistory.js +88 -30
  40. package/dist/adapters/simplifyqa/failureHistory.js.map +1 -1
  41. package/dist/adapters/simplifyqa/failurePatterns.d.ts +11 -0
  42. package/dist/adapters/simplifyqa/failurePatterns.d.ts.map +1 -1
  43. package/dist/adapters/simplifyqa/failurePatterns.js +4 -3
  44. package/dist/adapters/simplifyqa/failurePatterns.js.map +1 -1
  45. package/dist/adapters/simplifyqa/failureReport.d.ts.map +1 -1
  46. package/dist/adapters/simplifyqa/failureReport.js +8 -0
  47. package/dist/adapters/simplifyqa/failureReport.js.map +1 -1
  48. package/dist/adapters/simplifyqa/failureReportModel.d.ts +125 -1
  49. package/dist/adapters/simplifyqa/failureReportModel.d.ts.map +1 -1
  50. package/dist/adapters/simplifyqa/failureReportModel.js +324 -4
  51. package/dist/adapters/simplifyqa/failureReportModel.js.map +1 -1
  52. package/dist/adapters/simplifyqa/failureReview.d.ts +1 -1
  53. package/dist/adapters/simplifyqa/failureReview.d.ts.map +1 -1
  54. package/dist/adapters/simplifyqa/failureReview.js +44 -8
  55. package/dist/adapters/simplifyqa/failureReview.js.map +1 -1
  56. package/dist/adapters/simplifyqa/failureSuggest.d.ts +4 -2
  57. package/dist/adapters/simplifyqa/failureSuggest.d.ts.map +1 -1
  58. package/dist/adapters/simplifyqa/failureSuggest.js +44 -14
  59. package/dist/adapters/simplifyqa/failureSuggest.js.map +1 -1
  60. package/dist/adapters/simplifyqa/failureTypes.d.ts +19 -0
  61. package/dist/adapters/simplifyqa/failureTypes.d.ts.map +1 -1
  62. package/dist/adapters/simplifyqa/heal/apply.d.ts +3 -1
  63. package/dist/adapters/simplifyqa/heal/apply.d.ts.map +1 -1
  64. package/dist/adapters/simplifyqa/heal/apply.js +5 -1
  65. package/dist/adapters/simplifyqa/heal/apply.js.map +1 -1
  66. package/dist/adapters/simplifyqa/heal/diagnose.d.ts.map +1 -1
  67. package/dist/adapters/simplifyqa/heal/diagnose.js +14 -0
  68. package/dist/adapters/simplifyqa/heal/diagnose.js.map +1 -1
  69. package/dist/adapters/simplifyqa/heal/plan.d.ts +2 -0
  70. package/dist/adapters/simplifyqa/heal/plan.d.ts.map +1 -1
  71. package/dist/adapters/simplifyqa/heal/plan.js +43 -0
  72. package/dist/adapters/simplifyqa/heal/plan.js.map +1 -1
  73. package/dist/adapters/simplifyqa/networkErrors.d.ts +11 -0
  74. package/dist/adapters/simplifyqa/networkErrors.d.ts.map +1 -0
  75. package/dist/adapters/simplifyqa/networkErrors.js +108 -0
  76. package/dist/adapters/simplifyqa/networkErrors.js.map +1 -0
  77. package/dist/adapters/simplifyqa/outage.d.ts +41 -0
  78. package/dist/adapters/simplifyqa/outage.d.ts.map +1 -0
  79. package/dist/adapters/simplifyqa/outage.js +108 -0
  80. package/dist/adapters/simplifyqa/outage.js.map +1 -0
  81. package/dist/adapters/simplifyqa/patternSplit.d.ts +32 -0
  82. package/dist/adapters/simplifyqa/patternSplit.d.ts.map +1 -0
  83. package/dist/adapters/simplifyqa/patternSplit.js +79 -0
  84. package/dist/adapters/simplifyqa/patternSplit.js.map +1 -0
  85. package/dist/adapters/simplifyqa/screenText.d.ts +84 -0
  86. package/dist/adapters/simplifyqa/screenText.d.ts.map +1 -0
  87. package/dist/adapters/simplifyqa/screenText.js +497 -0
  88. package/dist/adapters/simplifyqa/screenText.js.map +1 -0
  89. package/dist/domain/heal.d.ts +10 -0
  90. package/dist/domain/heal.d.ts.map +1 -1
  91. package/dist/domain/heal.js.map +1 -1
  92. package/dist/export/html.d.ts +26 -0
  93. package/dist/export/html.d.ts.map +1 -0
  94. package/dist/export/html.js +842 -0
  95. package/dist/export/html.js.map +1 -0
  96. package/dist/export/labelCompare.d.ts +36 -0
  97. package/dist/export/labelCompare.d.ts.map +1 -0
  98. package/dist/export/labelCompare.js +96 -0
  99. package/dist/export/labelCompare.js.map +1 -0
  100. package/dist/export/layout.d.ts +19 -10
  101. package/dist/export/layout.d.ts.map +1 -1
  102. package/dist/export/layout.js +40 -9
  103. package/dist/export/layout.js.map +1 -1
  104. package/dist/export/pdf.d.ts +31 -1
  105. package/dist/export/pdf.d.ts.map +1 -1
  106. package/dist/export/pdf.js +170 -34
  107. package/dist/export/pdf.js.map +1 -1
  108. package/dist/export/xlsx.d.ts +1 -1
  109. package/dist/export/xlsx.js +2 -2
  110. package/dist/export/xlsx.js.map +1 -1
  111. package/dist/initAgents.d.ts.map +1 -1
  112. package/dist/initAgents.js +11 -5
  113. package/dist/initAgents.js.map +1 -1
  114. package/dist/server.d.ts.map +1 -1
  115. package/dist/server.js +11 -2
  116. package/dist/server.js.map +1 -1
  117. package/dist/tools/autoObjectParams.d.ts +18 -0
  118. package/dist/tools/autoObjectParams.d.ts.map +1 -0
  119. package/dist/tools/autoObjectParams.js +93 -0
  120. package/dist/tools/autoObjectParams.js.map +1 -0
  121. package/dist/tools/desktopRecordingMode.d.ts +27 -0
  122. package/dist/tools/desktopRecordingMode.d.ts.map +1 -0
  123. package/dist/tools/desktopRecordingMode.js +40 -0
  124. package/dist/tools/desktopRecordingMode.js.map +1 -0
  125. package/dist/tools/discovery.tools.d.ts.map +1 -1
  126. package/dist/tools/discovery.tools.js +89 -16
  127. package/dist/tools/discovery.tools.js.map +1 -1
  128. package/dist/tools/executionPlan.tools.d.ts.map +1 -1
  129. package/dist/tools/executionPlan.tools.js +9 -6
  130. package/dist/tools/executionPlan.tools.js.map +1 -1
  131. package/dist/tools/failure.tools.d.ts +10 -0
  132. package/dist/tools/failure.tools.d.ts.map +1 -1
  133. package/dist/tools/failure.tools.js +140 -18
  134. package/dist/tools/failure.tools.js.map +1 -1
  135. package/dist/tools/failureExport.tools.d.ts +1 -1
  136. package/dist/tools/failureExport.tools.d.ts.map +1 -1
  137. package/dist/tools/failureExport.tools.js +69 -26
  138. package/dist/tools/failureExport.tools.js.map +1 -1
  139. package/dist/tools/heal.tools.js +1 -1
  140. package/dist/tools/heal.tools.js.map +1 -1
  141. package/dist/tools/recordedValues.d.ts +4 -0
  142. package/dist/tools/recordedValues.d.ts.map +1 -1
  143. package/dist/tools/recordedValues.js +44 -5
  144. package/dist/tools/recordedValues.js.map +1 -1
  145. package/dist/tools/recording.tools.d.ts.map +1 -1
  146. package/dist/tools/recording.tools.js +12 -4
  147. package/dist/tools/recording.tools.js.map +1 -1
  148. package/dist/tools/recordingNames.d.ts +16 -0
  149. package/dist/tools/recordingNames.d.ts.map +1 -1
  150. package/dist/tools/recordingNames.js +31 -0
  151. package/dist/tools/recordingNames.js.map +1 -1
  152. package/dist/tools/storySync.tools.d.ts.map +1 -1
  153. package/dist/tools/storySync.tools.js +2 -1
  154. package/dist/tools/storySync.tools.js.map +1 -1
  155. package/dist/tools/testcase.tools.d.ts +13 -1
  156. package/dist/tools/testcase.tools.d.ts.map +1 -1
  157. package/dist/tools/testcase.tools.js +89 -15
  158. package/dist/tools/testcase.tools.js.map +1 -1
  159. package/dist/tools/verdictMemory.d.ts +55 -0
  160. package/dist/tools/verdictMemory.d.ts.map +1 -0
  161. package/dist/tools/verdictMemory.js +117 -0
  162. package/dist/tools/verdictMemory.js.map +1 -0
  163. package/dist/version.d.ts +1 -1
  164. package/dist/version.d.ts.map +1 -1
  165. package/dist/version.js +1 -1
  166. package/dist/version.js.map +1 -1
  167. package/package.json +6 -2
@@ -553,6 +553,20 @@ const PLAN_RUN_DROP_KEYS = [
553
553
  '_id', 'id', 'customerId', 'deleted', 'createdAt', 'createdBy', 'authkey', 'code', 'childExecutions', 'exception',
554
554
  'agentStartTime', 'agentEndTime', 'executionDuration', 'executionFlow', 'updatedAt', 'updatedBy', 'childExecution',
555
555
  ];
556
+ /** The NEWEST version row of a test case: the highest `vMAJOR.MINOR`. Names that are not plain `vN.M` (a hand-named "Baseline")
557
+ * never win over one that is; with none parseable there is no "latest" to speak of. */
558
+ export function latestVersionRow(versions) {
559
+ let best;
560
+ for (const v of versions) {
561
+ const m = /^v(\d+)\.(\d+)$/i.exec((str(v, 'name', 'versionName') ?? '').trim());
562
+ if (!m)
563
+ continue;
564
+ const [major, minor] = [Number(m[1]), Number(m[2])];
565
+ if (!best || major > best.major || (major === best.major && minor > best.minor))
566
+ best = { major, minor, row: v };
567
+ }
568
+ return best?.row;
569
+ }
556
570
  /** A test case's version for a plan entry. The entry validator requires a real `tcVersionId`, so a
557
571
  * missing one is refused, never guessed (unlike suite entries, which tolerate a default). With
558
572
  * `optional`, return what exists and let the caller decide. */
@@ -570,20 +584,44 @@ function testcaseVersion(raw, optional = false) {
570
584
  /** Reject a planned end date that is before the planned start date. The SQA web form blocks this, but
571
585
  * the backend happily saves it (US-2564 saved 2026-12-10 → 2026-12-01), so the MCP must enforce it on
572
586
  * every backlog write that takes planned dates. Only checks when both are present in the same call. */
573
- export function assertPlannedDates(start, end) {
574
- const s = (start ?? '').trim();
575
- const e = (end ?? '').trim();
576
- if (!s || !e)
587
+ export function assertPlannedDates(start, end, stored) {
588
+ const clean = (v) => (v == null ? '' : String(v).trim());
589
+ const wellFormed = (v) => /^\d{4}-\d{2}-\d{2}/.test(v);
590
+ // an impossible day (2026-02-30) is refused for every date that is SENT, even when the other one is not; a malformed one is
591
+ // left to the calling module's own wording unless both dates have to be compared
592
+ const real = (v, label) => {
593
+ if (wellFormed(v) && !isRealDay(v))
594
+ throw new Error(`${label} "${v.slice(0, 10)}" is not a real calendar day.`);
595
+ };
596
+ const s = clean(start);
597
+ const e = clean(end);
598
+ if (s)
599
+ real(s, 'Planned start date');
600
+ if (e)
601
+ real(e, 'Planned end date');
602
+ // A date that is not being changed still counts: when only one is sent, the other is the one already stored on the item.
603
+ const effStart = start === undefined && stored ? clean(stored.start) : s;
604
+ const effEnd = end === undefined && stored ? clean(stored.end) : e;
605
+ if (!effStart || !effEnd)
577
606
  return;
578
- const day = (v) => {
579
- if (!/^\d{4}-\d{2}-\d{2}/.test(v) || Number.isNaN(new Date(v).getTime())) {
607
+ for (const v of [effStart, effEnd])
608
+ if (!wellFormed(v))
580
609
  throw new Error(`Planned dates must look like 2026-12-10 (got "${v}").`);
581
- }
582
- return v.slice(0, 10);
583
- };
584
- const [ds, de] = [day(s), day(e)];
585
- if (de <= ds)
586
- throw new Error(`Planned end date (${de}) must be after the planned start date (${ds}).`);
610
+ const [ds, de] = [effStart.slice(0, 10), effEnd.slice(0, 10)];
611
+ if (de <= ds) {
612
+ const kept = start === undefined && stored ? ` — the item's start date is already ${ds}` : end === undefined && stored ? ` — the item's end date is already ${de}` : '';
613
+ throw new Error(`Planned end date (${de}) must be after the planned start date (${ds})${kept}.`);
614
+ }
615
+ }
616
+ /** `2026-02-30` is not a day: `new Date()` quietly rolls it to 2 March, which is how an impossible date was saved as another one. */
617
+ export function isRealDay(v) {
618
+ const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(v);
619
+ if (!m)
620
+ return false;
621
+ const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];
622
+ if (mo < 1 || mo > 12 || d < 1)
623
+ return false;
624
+ return d <= new Date(Date.UTC(y, mo, 0)).getUTCDate();
587
625
  }
588
626
  /** Version for a plan/suite entry: the requested one (id or name), else the test case's current one.
589
627
  * A requested version that does not exist FAILS — silently falling back to v1.0 turned a request for
@@ -594,6 +632,12 @@ export function pickTestcaseVersion(raw, wantId, wantName) {
594
632
  if (!id && !name)
595
633
  return testcaseVersion(raw);
596
634
  const versions = Array.isArray(raw?.versions) ? raw.versions : [];
635
+ if (!id && name.toLowerCase() === 'latest') {
636
+ const row = latestVersionRow(versions);
637
+ if (!row)
638
+ throw new Error(`${str(raw, 'code') ?? `TC-${raw?.id}`} has no vMAJOR.MINOR version to pick the latest from. Name the version instead (version:"v2.0").`);
639
+ return { versionId: str(row, 'id', '_id', 'versionId') ?? '', versionName: str(row, 'name', 'versionName') ?? '' };
640
+ }
597
641
  const hit = versions.find((v) => {
598
642
  const vid = str(v, 'id', '_id', 'versionId') ?? '';
599
643
  const vname = str(v, 'name', 'versionName') ?? '';
@@ -883,6 +927,9 @@ export class SimplifyQaAdapter {
883
927
  /** Gather every identifier this process can claim: bare hostname, non-loopback MAC addresses,
884
928
  * non-loopback IPs. Cached per-adapter — network interfaces do not change mid-session. */
885
929
  this.localIdsCache = null;
930
+ /** DESKTOP heal verify: how often the run is read, and how long it may wait for the agent to pick it up. */
931
+ this.desktopHealPollMs = 5000;
932
+ this.desktopHealPickupMs = 5 * 60000;
886
933
  if (!cfg.baseUrl) {
887
934
  throw new Error('SimplifyQaAdapter requires a baseUrl — set QA_BASE_URL or use a JWT with a `url` claim.');
888
935
  }
@@ -2120,6 +2167,8 @@ export class SimplifyQaAdapter {
2120
2167
  continue;
2121
2168
  if (!/^\d{4}-\d{2}-\d{2}/.test(want) || Number.isNaN(new Date(want).getTime()))
2122
2169
  throw new Error(`${key} must be a date like 2026-11-17 (got "${want}").`);
2170
+ if (!isRealDay(want))
2171
+ throw new Error(`${key} "${want.slice(0, 10)}" is not a real calendar day.`);
2123
2172
  if (day(doc[key]) !== day(want))
2124
2173
  change(field, key, want, day(doc[key]), day(want));
2125
2174
  }
@@ -2282,6 +2331,8 @@ export class SimplifyQaAdapter {
2282
2331
  for (const [k, v] of [['plannedStartDate', start], ['plannedEndDate', end]]) {
2283
2332
  if (!/^\d{4}-\d{2}-\d{2}/.test(v) || Number.isNaN(new Date(v).getTime()))
2284
2333
  throw new Error(`${k} must be a date like 2026-11-17 (got "${v}").`);
2334
+ if (!isRealDay(v))
2335
+ throw new Error(`${k} "${v.slice(0, 10)}" is not a real calendar day.`);
2285
2336
  }
2286
2337
  if (new Date(end) < new Date(start))
2287
2338
  throw new Error(`plannedEndDate (${dayOf(end)}) must be on or after plannedStartDate (${dayOf(start)}).`);
@@ -2498,6 +2549,8 @@ export class SimplifyQaAdapter {
2498
2549
  if (!/^\d{4}-\d{2}-\d{2}$/.test(day) || Number.isNaN(new Date(`${day}T00:00:00Z`).getTime())) {
2499
2550
  throw new Error(`${label} must be a date like 2026-11-20 (got "${v}").`);
2500
2551
  }
2552
+ if (!isRealDay(day))
2553
+ throw new Error(`${label} "${day}" is not a real calendar day.`);
2501
2554
  return `${day}T00:00:00.000Z`;
2502
2555
  }
2503
2556
  /** The form's Feature field: a feature of THIS project, by id, business key (FT-248) or exact name. */
@@ -3328,9 +3381,29 @@ export class SimplifyQaAdapter {
3328
3381
  const raw = await this.http.postJson('/pm/userstory', body);
3329
3382
  return toSavedRef(raw, true);
3330
3383
  }
3384
+ /** Date check for an EDIT of a story / epic / feature. Sending only one date used to skip the check (the other one is not in
3385
+ * the patch), so a story could be left ending before it started. When exactly one is sent, the stored other one is read and
3386
+ * compared; a stored item that cannot be read refuses the edit instead of letting it through unchecked. */
3387
+ async assertEditedDates(entity, numericId, patch) {
3388
+ assertPlannedDates(patch.plannedStartDate, patch.plannedEndDate);
3389
+ const oneSent = (patch.plannedStartDate === undefined) !== (patch.plannedEndDate === undefined);
3390
+ if (!oneSent)
3391
+ return;
3392
+ let doc;
3393
+ try {
3394
+ const raw = await this.http.getJson(`${BACKLOG_ATTACHMENT_SPECS[entity].path}/${numericId}`);
3395
+ doc = Array.isArray(raw) ? raw[0] : (raw?.data && typeof raw.data === 'object' && !Array.isArray(raw.data) ? raw.data : raw);
3396
+ }
3397
+ catch (e) {
3398
+ throw new Error(`Could not read the ${entity === 'userstory' ? 'story' : entity}'s current dates to check the new one against them (${e instanceof Error ? e.message : String(e)}), so nothing was changed.`);
3399
+ }
3400
+ if (!doc || typeof doc !== 'object')
3401
+ throw new Error(`The ${entity === 'userstory' ? 'story' : entity} was not found, so its dates could not be checked.`);
3402
+ assertPlannedDates(patch.plannedStartDate, patch.plannedEndDate, { start: doc.plannedStartDate, end: doc.plannedEndDate });
3403
+ }
3331
3404
  async updateStory(id, patch) {
3332
3405
  const resolvedId = await this.resolveStoryNumericId(id);
3333
- assertPlannedDates(patch.plannedStartDate, patch.plannedEndDate);
3406
+ await this.assertEditedDates('userstory', resolvedId, patch);
3334
3407
  // The backend's update controller runs its privilege check with `req.body.projectId`; a partial
3335
3408
  // patch that omits it makes that call throw (HTTP 500), which is why a story edit has to carry the
3336
3409
  // project. Default to the connected project — the story being edited belongs to it.
@@ -3625,8 +3698,8 @@ export class SimplifyQaAdapter {
3625
3698
  return toSavedRef(raw, true);
3626
3699
  }
3627
3700
  async updateEpic(id, patch) {
3628
- assertPlannedDates(patch.plannedStartDate, patch.plannedEndDate);
3629
3701
  const resolvedId = await this.resolveEpicNumericId(id);
3702
+ await this.assertEditedDates('epic', resolvedId, patch);
3630
3703
  const raw = await this.http.putJson(`/pm/epic/${resolvedId}`, patch);
3631
3704
  return toSavedRef(raw ?? { id: resolvedId }, false);
3632
3705
  }
@@ -3697,8 +3770,8 @@ export class SimplifyQaAdapter {
3697
3770
  return toSavedRef(raw, true);
3698
3771
  }
3699
3772
  async updateFeature(id, patch) {
3700
- assertPlannedDates(patch.plannedStartDate, patch.plannedEndDate);
3701
3773
  const resolvedId = await this.resolveFeatureNumericId(id);
3774
+ await this.assertEditedDates('feature', resolvedId, patch);
3702
3775
  const raw = await this.http.putJson(`/pm/feature/${resolvedId}`, patch);
3703
3776
  return toSavedRef(raw ?? { id: resolvedId }, false);
3704
3777
  }
@@ -4194,6 +4267,12 @@ export class SimplifyQaAdapter {
4194
4267
  delete body[k];
4195
4268
  body['updateVersion'] = typeof row.updateVersion === 'number' ? row.updateVersion : 0;
4196
4269
  const changes = [];
4270
+ // an impossible day is refused for every date that is sent (Date quietly rolls 2026-02-30 to 2 March)
4271
+ for (const k of ['plannedStartDate', 'plannedEndDate', 'actualStartDate', 'actualEndDate']) {
4272
+ const v = patch[k];
4273
+ if (typeof v === 'string' && v.trim() && /^\d{4}-\d{2}-\d{2}/.test(v) && !isRealDay(v))
4274
+ throw new Error(`${k} "${v.slice(0, 10)}" is not a real calendar day.`);
4275
+ }
4197
4276
  const set = (k, v) => { if (v !== undefined && JSON.stringify(body[k]) !== JSON.stringify(v)) {
4198
4277
  body[k] = v;
4199
4278
  changes.push(k);
@@ -4215,6 +4294,9 @@ export class SimplifyQaAdapter {
4215
4294
  if (body['plannedStartDate'] && body['plannedEndDate'] && new Date(String(body['plannedEndDate'])) < new Date(String(body['plannedStartDate']))) {
4216
4295
  throw new Error('plannedEndDate must be on or after plannedStartDate.');
4217
4296
  }
4297
+ if (body['actualStartDate'] && body['actualEndDate'] && new Date(String(body['actualEndDate'])) < new Date(String(body['actualStartDate']))) {
4298
+ throw new Error(`actualEndDate (${String(body['actualEndDate']).slice(0, 10)}) must be on or after actualStartDate (${String(body['actualStartDate']).slice(0, 10)}).`);
4299
+ }
4218
4300
  const stateBefore = String(row.state ?? '');
4219
4301
  const id = String(row.id);
4220
4302
  const code = String(row.code ?? `#${id}`);
@@ -4322,6 +4404,8 @@ export class SimplifyQaAdapter {
4322
4404
  throw new Error(`${kind}_create needs ${k} (YYYY-MM-DD).`);
4323
4405
  if (!/^\d{4}-\d{2}-\d{2}/.test(v) || Number.isNaN(new Date(v).getTime()))
4324
4406
  throw new Error(`${k} must be a date like 2026-11-16 (got "${v}").`);
4407
+ if (!isRealDay(v))
4408
+ throw new Error(`${k} "${v.slice(0, 10)}" is not a real calendar day.`);
4325
4409
  }
4326
4410
  if (new Date(input.plannedEndDate) < new Date(input.plannedStartDate))
4327
4411
  throw new Error('plannedEndDate must be on or after plannedStartDate.');
@@ -6202,6 +6286,21 @@ export class SimplifyQaAdapter {
6202
6286
  s.actionType = name;
6203
6287
  }
6204
6288
  }
6289
+ /** Display names for numeric action ids (a saved step carries `actionType = String(actionId)`), e.g. { "184": "Click" }.
6290
+ * Best effort: an id the catalog does not know is left out. */
6291
+ async actionNamesById(ids) {
6292
+ const out = {};
6293
+ const catalog = await this.actionCatalog();
6294
+ for (const raw of ids) {
6295
+ if (!/^\d+$/.test(raw.trim()))
6296
+ continue;
6297
+ const meta = catalog.get(`id::${Number.parseInt(raw, 10)}`);
6298
+ const name = meta?.displayName ?? meta?.name;
6299
+ if (name)
6300
+ out[raw] = name;
6301
+ }
6302
+ return out;
6303
+ }
6205
6304
  /** Steps for one FN version. Unlike TC docs, the FN doc from `/tm/function/:id/:projectId`
6206
6305
  * doesn't carry a versionId inline — callers resolve the target versionId (usually the newest,
6207
6306
  * from `fetchFunctionVersionRows`) and pass it here. */
@@ -7658,16 +7757,17 @@ export class SimplifyQaAdapter {
7658
7757
  throw new Error(`assignTo "${input.assignTo}" is not a user id.`);
7659
7758
  }
7660
7759
  }
7760
+ // `defaulted`: no version was asked for, so the test case's current one was taken (the caller is told if a newer one exists)
7661
7761
  const candidates = [];
7662
7762
  for (const tcId of input.tcIds ?? []) {
7663
7763
  const raw = await this.readOwnTestcase(tcId);
7664
7764
  const v = pickTestcaseVersion(raw, input.versionId, input.version);
7665
- candidates.push({ raw, ...v, platform: entryPlatform(raw.executionPlatform), source: { sourceType: 'testcase', sourceId: 0 } });
7765
+ candidates.push({ raw, ...v, platform: entryPlatform(raw.executionPlatform), source: { sourceType: 'testcase', sourceId: 0 }, defaulted: !input.versionId && !input.version });
7666
7766
  }
7667
7767
  for (const spec of input.testCases ?? []) {
7668
7768
  const raw = await this.readOwnTestcase(spec.tcId);
7669
7769
  const v = pickTestcaseVersion(raw, spec.versionId, spec.version);
7670
- candidates.push({ raw, ...v, platform: entryPlatform(raw.executionPlatform), source: { sourceType: 'testcase', sourceId: 0 } });
7770
+ candidates.push({ raw, ...v, platform: entryPlatform(raw.executionPlatform), source: { sourceType: 'testcase', sourceId: 0 }, defaulted: !spec.versionId && !spec.version });
7671
7771
  }
7672
7772
  for (const suiteId of input.suiteIds ?? []) {
7673
7773
  const suite = await this.readOwnSuite(suiteId);
@@ -7699,6 +7799,8 @@ export class SimplifyQaAdapter {
7699
7799
  const added = [];
7700
7800
  const skipped = [];
7701
7801
  const rows = [];
7802
+ const addedVersions = [];
7803
+ const notes = [];
7702
7804
  for (const c of candidates) {
7703
7805
  const code = str(c.raw, 'code') ?? `TC-${c.raw.id}`;
7704
7806
  const key = `${Number(c.raw.id)}|${String(c.versionId ?? '')}|${assignee}`;
@@ -7707,7 +7809,15 @@ export class SimplifyQaAdapter {
7707
7809
  continue;
7708
7810
  }
7709
7811
  if (seenExact.has(key)) {
7710
- skipped.push({ code, reason: `already in the plan (${c.versionName || c.versionId})` });
7812
+ // Tell the caller HOW to add the other version — a plain "already in the plan" reads like the plan can only ever hold one.
7813
+ const tcNum = Number(c.raw.id);
7814
+ const others = (Array.isArray(c.raw.versions) ? c.raw.versions : [])
7815
+ .map((v) => ({ id: str(v, 'id', '_id'), name: str(v, 'name', 'versionName') }))
7816
+ .filter((v) => v.id && v.name && v.id !== c.versionId && !seenExact.has(`${tcNum}|${v.id}|${assignee}`));
7817
+ const hint = others.length
7818
+ ? ` — other version${others.length > 1 ? 's' : ''} you can add: ${others.map((v) => v.name).join(', ')}; pass version:"${others[0].name}" (or testCases:[{ tcId, version }])`
7819
+ : '';
7820
+ skipped.push({ code, reason: `already in the plan (${c.versionName || c.versionId})${hint}` });
7711
7821
  continue;
7712
7822
  }
7713
7823
  seenExact.add(key);
@@ -7724,10 +7834,19 @@ export class SimplifyQaAdapter {
7724
7834
  ...(input.assignDate ? { expAssignedDate: input.assignDate } : {}),
7725
7835
  });
7726
7836
  added.push(code);
7837
+ addedVersions.push(`${code} (${c.versionName || c.versionId})`);
7838
+ // No version was asked for and a NEWER one exists: the plan got the older one — say so instead of staying silent.
7839
+ if (c.defaulted) {
7840
+ const latest = latestVersionRow(Array.isArray(c.raw.versions) ? c.raw.versions : []);
7841
+ const latestId = latest ? str(latest, 'id', '_id', 'versionId') : undefined;
7842
+ if (latest && latestId && latestId !== c.versionId) {
7843
+ notes.push(`${code}: added ${c.versionName || c.versionId}, but ${str(latest, 'name', 'versionName')} is newer — pass version:"latest" (or version:"${str(latest, 'name', 'versionName')}") to add that one.`);
7844
+ }
7845
+ }
7727
7846
  }
7728
7847
  if (rows.length)
7729
7848
  await this.http.postJson('/tm/execplantestcases', rows);
7730
- return { added, skipped };
7849
+ return { added, skipped, addedVersions, notes };
7731
7850
  }
7732
7851
  /** The plan's entries for these test cases — what removing them would delete. No write. */
7733
7852
  async planEntriesRemovePreview(planId, tcIds) {
@@ -8902,11 +9021,15 @@ export class SimplifyQaAdapter {
8902
9021
  const wantId = (requested?.versionId ?? '').trim();
8903
9022
  const wantName = (requested?.version ?? '').trim();
8904
9023
  if (wantId || wantName) {
8905
- const hit = versions.find((v) => {
9024
+ const wantsLatest = !wantId && wantName.toLowerCase() === 'latest';
9025
+ const hit = wantsLatest ? latestVersionRow(versions) : versions.find((v) => {
8906
9026
  const id = str(v, 'id', '_id', 'versionId') ?? '';
8907
9027
  const name = str(v, 'name', 'versionName') ?? '';
8908
9028
  return (wantId && id === wantId) || (wantName && name.trim().toLowerCase() === wantName.toLowerCase());
8909
9029
  });
9030
+ if (wantsLatest && !hit) {
9031
+ throw new Error(`${code} has no vMAJOR.MINOR version to pick the latest from. Name the version instead (version:"v2.0").`);
9032
+ }
8910
9033
  if (!hit) {
8911
9034
  const available = versions.map((v) => `${str(v, 'name') ?? '?'} (${str(v, 'id', '_id', 'versionId') ?? '?'})`).join(', ');
8912
9035
  throw new Error(`${code} has no version ${wantId ? `"${wantId}"` : `"${wantName}"`}. ` +
@@ -9195,6 +9318,13 @@ export class SimplifyQaAdapter {
9195
9318
  else
9196
9319
  attributes.push(merged);
9197
9320
  }
9321
+ // DESKTOP heal (plan.md P13): drop the stale XPaths the plan names; only heal_apply passes them, for DESKTOP objects.
9322
+ if (changes.removeLocators?.length) {
9323
+ const drop = new Set(changes.removeLocators);
9324
+ for (let i = attributes.length - 1; i >= 0; i--)
9325
+ if (drop.has(attributes[i].name))
9326
+ attributes.splice(i, 1);
9327
+ }
9198
9328
  // The UI treats `unique` (the default locator) as exclusive — setting one clears it on the rest.
9199
9329
  const defaultLoc = (changes.locators ?? []).filter((l) => l.unique === true).pop();
9200
9330
  if (defaultLoc) {
@@ -12031,10 +12161,19 @@ export class SimplifyQaAdapter {
12031
12161
  if (!h) {
12032
12162
  throw new Error("Healing needs a local SimplifyQA agent — set QA_MCP_URL to the agent's /mcp endpoint, then retry.");
12033
12163
  }
12034
- const res = (await h.callRaw('heal_propose', input));
12164
+ // DESKTOP (plan.md P13): a DESKTOP test case is proposed by the recorder's DESKTOP healer; every other test case asks
12165
+ // heal_propose, exactly as before (after this one read of the test case).
12166
+ let desktopHeal = false;
12167
+ try {
12168
+ desktopHeal = (await this.getTestCase(input.tcId)).technologyType?.toUpperCase() === 'DESKTOP';
12169
+ }
12170
+ catch { /* as before */ }
12171
+ const res = (await h.callRaw(desktopHeal ? 'desktop_heal_propose' : 'heal_propose', input, desktopHeal ? 10 * 60000 : undefined));
12035
12172
  if (res?.structuredContent && typeof res.structuredContent === 'object')
12036
12173
  return res.structuredContent;
12037
12174
  const text = res?.content?.find((c) => c?.type === 'text')?.text ?? '';
12175
+ if (desktopHeal && res?.isError)
12176
+ throw new Error(text.trim() || 'desktop_heal_propose failed');
12038
12177
  if (!text.trim())
12039
12178
  throw new Error('heal_propose returned an empty response');
12040
12179
  try {
@@ -12167,6 +12306,7 @@ export class SimplifyQaAdapter {
12167
12306
  }
12168
12307
  return {
12169
12308
  tcId,
12309
+ ...(tc.technologyType ? { technologyType: tc.technologyType } : {}), // DESKTOP object rules (plan.md P13)
12170
12310
  ...(tc.currentVersionId ? { currentVersionId: tc.currentVersionId } : {}),
12171
12311
  steps: stepFacts,
12172
12312
  objects,
@@ -12178,15 +12318,53 @@ export class SimplifyQaAdapter {
12178
12318
  };
12179
12319
  }
12180
12320
  async applyHealPlan(plan, opts) {
12321
+ // DESKTOP (plan.md P13): apply_and_verify runs the healed version for a DESKTOP test case; every other technology
12322
+ // keeps "verification is not available" (in that mode only, one read of the test case decides).
12323
+ let desktopVerify = false;
12324
+ if (opts?.mode === 'apply_and_verify') {
12325
+ try {
12326
+ desktopVerify = (await this.getTestCase(plan.tcId)).technologyType?.toUpperCase() === 'DESKTOP';
12327
+ }
12328
+ catch { /* as before */ }
12329
+ }
12181
12330
  const deps = {
12182
12331
  getTestCase: (id) => this.getTestCase(id),
12183
12332
  getObject: (id) => this.getObject(id),
12184
12333
  updateObject: (id, changes) => this.updateObject(id, changes),
12185
12334
  saveAsNewVersion: (id, o) => this.saveAsNewVersion(id, o),
12186
12335
  patchTestDataCells: (input) => this.patchHealTestData(input),
12336
+ ...(desktopVerify ? { verify: (tcId, p, versionId) => this.verifyDesktopHeal(tcId, p, versionId) } : {}),
12187
12337
  };
12188
12338
  return applyHealPlanCore(deps, plan, opts ?? {});
12189
12339
  }
12340
+ /** DESKTOP heal (plan.md P13): runs the version heal_apply just saved ("healed-<plan>") on this machine's agent and
12341
+ * waits for it, as any DESKTOP run (the real application, mouse and keyboard). Verified when the run passes. A run
12342
+ * reads "notExecuted" until the agent picks it up, so that state means "waiting" here; a run no agent picks up
12343
+ * within 5 minutes (for example an agent whose token the backend refuses) ends the wait with that reason. The run
12344
+ * names the saved version by its id when the save returned one: applying the same plan again saves another version
12345
+ * with the same name, and a run by name would take the first of them. */
12346
+ async verifyDesktopHeal(tcId, plan, savedVersionId) {
12347
+ const versionName = `healed-${plan.planId.slice(0, 8)}`;
12348
+ const ref = await this.startRun({ tcId }, { mode: 'local', versionId: savedVersionId || versionName });
12349
+ const start = Date.now();
12350
+ const deadline = start + 15 * 60000;
12351
+ for (;;) {
12352
+ await new Promise((r) => setTimeout(r, this.desktopHealPollMs));
12353
+ const st = await this.getRun(ref.runId);
12354
+ if (st.state === 'passed')
12355
+ return { verified: true, runId: ref.runId };
12356
+ if (['failed', 'error', 'stopped', 'skipped'].includes(st.state)) {
12357
+ return { verified: false, runId: ref.runId, reason: `the run of ${versionName} ended ${st.state}` };
12358
+ }
12359
+ const waiting = st.state === 'notExecuted' || st.state === 'queued';
12360
+ if (waiting && Date.now() - start > this.desktopHealPickupMs) {
12361
+ return { verified: false, runId: ref.runId, reason: `no agent picked up the run of ${versionName} within ${Math.round(this.desktopHealPickupMs / 60000)} minutes (it is still ${st.state}); check that the agent is online, then run that version` };
12362
+ }
12363
+ if (Date.now() > deadline) {
12364
+ return { verified: false, runId: ref.runId, reason: `the run of ${versionName} did not finish within 15 minutes` };
12365
+ }
12366
+ }
12367
+ }
12190
12368
  /** Patch cells of the FAILING iterations only, via the existing test-data endpoints:
12191
12369
  * POST /tm/testdata/searchItr (read) → POST /tm/testdata/updateItr (write that one row). */
12192
12370
  async patchHealTestData(input) {