@qablehq/atto 0.0.36 → 0.0.38

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.
@@ -17733,6 +17733,89 @@ const DEFAULT_GATE_POLICY = {
17733
17733
  severityOverrides: {},
17734
17734
  custom: []
17735
17735
  };
17736
+ function emptyGateReport(attempt = 1) {
17737
+ return { outcomes: [], passed: 0, failed: 0, warned: 0, disabled: 0, notApplicable: 0, bypassed: 0, attempt };
17738
+ }
17739
+ function summariseGateReport(outcomes, attempt) {
17740
+ const count2 = (status) => outcomes.filter((outcome) => outcome.status === status).length;
17741
+ return {
17742
+ outcomes,
17743
+ passed: count2("passed"),
17744
+ failed: outcomes.filter((outcome) => outcome.status === "failed" && outcome.severity === "error").length,
17745
+ warned: outcomes.filter((outcome) => outcome.status === "failed" && outcome.severity === "warning").length,
17746
+ disabled: count2("disabled"),
17747
+ notApplicable: count2("not-applicable"),
17748
+ bypassed: count2("bypassed"),
17749
+ attempt
17750
+ };
17751
+ }
17752
+ function applyBypass(report, bypassedIds) {
17753
+ const ids = new Set(bypassedIds);
17754
+ return summariseGateReport(
17755
+ report.outcomes.map(
17756
+ (outcome) => outcome.status === "failed" && ids.has(outcome.id) ? { ...outcome, status: "bypassed" } : outcome
17757
+ ),
17758
+ report.attempt
17759
+ );
17760
+ }
17761
+ const LOCKED_GATE_IDS = [
17762
+ "test-required",
17763
+ "assertions-required",
17764
+ "pom-dangling-import",
17765
+ "import-tokens"
17766
+ ];
17767
+ function isLockedGate(id) {
17768
+ return LOCKED_GATE_IDS.includes(id);
17769
+ }
17770
+ function normalizeGatePolicy(raw2) {
17771
+ if (typeof raw2 !== "object" || raw2 === null) return DEFAULT_GATE_POLICY;
17772
+ const record = raw2;
17773
+ const disabled = Array.isArray(record.disabled) ? record.disabled.filter((id) => typeof id === "string" && !isLockedGate(id)) : [];
17774
+ const severityOverrides = {};
17775
+ if (typeof record.severityOverrides === "object" && record.severityOverrides !== null) {
17776
+ for (const [id, severity] of Object.entries(record.severityOverrides)) {
17777
+ if (severity === "error" || severity === "warning") severityOverrides[id] = severity;
17778
+ }
17779
+ }
17780
+ const custom = Array.isArray(record.custom) ? record.custom.map(normalizeCustomGate).filter((gate) => gate !== null) : [];
17781
+ return { version: 1, disabled, severityOverrides, custom };
17782
+ }
17783
+ function normalizeCustomGate(raw2) {
17784
+ if (typeof raw2 !== "object" || raw2 === null) return null;
17785
+ const record = raw2;
17786
+ const id = typeof record.id === "string" && record.id.trim() ? record.id : null;
17787
+ const name = typeof record.name === "string" && record.name.trim() ? record.name.trim() : null;
17788
+ if (!id || !name) return null;
17789
+ const severity = record.severity === "warning" ? "warning" : "error";
17790
+ const enabled = record.enabled !== false;
17791
+ if (record.kind === "ai") {
17792
+ const prompt = typeof record.prompt === "string" ? record.prompt.trim() : "";
17793
+ if (!prompt) return null;
17794
+ return { id, kind: "ai", name, prompt, severity, enabled };
17795
+ }
17796
+ const matcher = record.matcher;
17797
+ const value = typeof matcher?.value === "string" ? matcher.value : "";
17798
+ if (!value.trim()) return null;
17799
+ return {
17800
+ id,
17801
+ kind: "pattern",
17802
+ name,
17803
+ description: typeof record.description === "string" ? record.description : "",
17804
+ scope: isGateScope(record.scope) ? record.scope : "all",
17805
+ condition: record.condition === "must_contain" ? "must_contain" : "must_not_contain",
17806
+ matcher: {
17807
+ type: matcher?.type === "regex" ? "regex" : "literal",
17808
+ value,
17809
+ caseInsensitive: matcher?.caseInsensitive === true
17810
+ },
17811
+ severity,
17812
+ hint: typeof record.hint === "string" && record.hint.trim() ? record.hint.trim() : void 0,
17813
+ enabled
17814
+ };
17815
+ }
17816
+ function isGateScope(value) {
17817
+ return value === "spec" || value === "page-objects" || value === "fixtures" || value === "all";
17818
+ }
17736
17819
  function compileMatcher(gate) {
17737
17820
  const flags = gate.matcher.caseInsensitive ? "i" : "";
17738
17821
  try {
@@ -17742,6 +17825,19 @@ function compileMatcher(gate) {
17742
17825
  return null;
17743
17826
  }
17744
17827
  }
17828
+ const qualityGates = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
17829
+ __proto__: null,
17830
+ DEFAULT_GATE_POLICY,
17831
+ GATE_CATEGORY_LABELS,
17832
+ GATE_SCOPE_LABELS,
17833
+ LOCKED_GATE_IDS,
17834
+ applyBypass,
17835
+ compileMatcher,
17836
+ emptyGateReport,
17837
+ isLockedGate,
17838
+ normalizeGatePolicy,
17839
+ summariseGateReport
17840
+ }, Symbol.toStringTag, { value: "Module" }));
17745
17841
  const STATUS = {
17746
17842
  passed: { icon: CircleCheck, tone: "text-success", label: "Met" },
17747
17843
  failed: { icon: CircleX, tone: "text-destructive", label: "Not met" },
@@ -33298,23 +33394,42 @@ function ProjectList() {
33298
33394
  let cancelled = false;
33299
33395
  const syncRemote = async (remote) => {
33300
33396
  const id = tesboProjectId$1(remote.projectId);
33397
+ const remoteUrl = String(remote.targetUrl || "").trim();
33398
+ const remoteFolder = String(remote.scriptSavePath || "").trim();
33399
+ const remoteName = String(remote.projectName || remote.userName || "Tesbo project").trim();
33400
+ const remoteDescription = String(remote.description || "").trim();
33301
33401
  ensureProject(id, {
33302
- name: remote.projectName || remote.userName || "Tesbo project",
33303
- targetUrl: remote.targetUrl || void 0,
33304
- description: remote.description || void 0
33402
+ name: remoteName || "Tesbo project",
33403
+ // Website Test Environments / Agents → Atto Target URL overwrite local placeholders.
33404
+ ...remoteUrl ? { targetUrl: remoteUrl } : {},
33405
+ ...remoteDescription ? { description: remoteDescription } : { description: void 0 }
33305
33406
  });
33306
- if (remote.scriptSavePath) setFolderPath(id, remote.scriptSavePath);
33307
- setBrowserMode(id, remote.browserMode);
33407
+ if (remoteFolder) setFolderPath(id, remoteFolder);
33408
+ setBrowserMode(id, remote.browserMode === "headless" ? "headless" : "headed");
33308
33409
  setMemories(
33309
33410
  id,
33310
33411
  (remote.memories || []).map((memory) => ({
33311
- id: memory.id,
33412
+ id: memory.id || `mem-${Math.random().toString(36).slice(2, 8)}`,
33312
33413
  kind: "note",
33313
33414
  content: memory.content,
33314
33415
  createdAt: memory.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
33315
33416
  source: "manual"
33316
33417
  }))
33317
33418
  );
33419
+ const folderForGates = remoteFolder || useAppStore.getState().projectsById[id]?.folderPath || "";
33420
+ if (folderForGates && remote.qualityGates && typeof remote.qualityGates === "object") {
33421
+ try {
33422
+ const { normalizeGatePolicy: normalizeGatePolicy2 } = await __vitePreload(async () => {
33423
+ const { normalizeGatePolicy: normalizeGatePolicy3 } = await Promise.resolve().then(() => qualityGates);
33424
+ return { normalizeGatePolicy: normalizeGatePolicy3 };
33425
+ }, true ? void 0 : void 0, import.meta.url);
33426
+ await window.taa.projects.setQualityGates({
33427
+ folderPath: folderForGates,
33428
+ policy: normalizeGatePolicy2(remote.qualityGates)
33429
+ });
33430
+ } catch {
33431
+ }
33432
+ }
33318
33433
  if (remote.aiSynced) {
33319
33434
  const bindings = await window.taa.ai.listBindings().catch(() => ({}));
33320
33435
  if (bindings[id]) setProjectAiBinding2(id, bindings[id]);
@@ -35001,16 +35116,17 @@ async function startRemoteSession(job) {
35001
35116
  setStreamingSession
35002
35117
  } = useAppStore.getState();
35003
35118
  const id = tesboProjectId(job.projectId || "project");
35119
+ const jobUrl = String(job.targetUrl || "").trim();
35004
35120
  ensureProject(id, {
35005
35121
  name: job.projectName || "Tesbo project",
35006
- targetUrl: job.targetUrl || void 0
35122
+ ...jobUrl ? { targetUrl: jobUrl } : {}
35007
35123
  });
35008
35124
  setProjectFolderPath2(id, job.folderPath);
35009
35125
  setProjectBrowserMode2(id, job.browserMode);
35010
- if (job.targetUrl) {
35126
+ if (jobUrl) {
35011
35127
  ensureProject(id, {
35012
35128
  name: useAppStore.getState().projectsById[id]?.name || job.projectName || "Tesbo project",
35013
- targetUrl: job.targetUrl
35129
+ targetUrl: jobUrl
35014
35130
  });
35015
35131
  }
35016
35132
  setActiveProject(id, { force: true });
@@ -8,7 +8,7 @@
8
8
  />
9
9
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
10
10
  <title>Tesbo Automate</title>
11
- <script type="module" crossorigin src="./assets/index-DahmD4CZ.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-fTT2MunA.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="./assets/index-DyJdhPcb.css">
13
13
  </head>
14
14
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qablehq/atto",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "description": "Atto \u2014 AI-assisted desktop test automation",
5
5
  "homepage": "https://github.com/QAbleHQ/Atto",
6
6
  "author": {