@flowriki/agent 0.1.0-beta.17 → 0.1.0-beta.18

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.
@@ -6,7 +6,7 @@ import os from "os";
6
6
  import path from "path";
7
7
  import { createRequire } from "module";
8
8
  import { spawnSync } from "child_process";
9
- var AGENT_VERSION = "0.1.0-beta.17";
9
+ var AGENT_VERSION = "0.1.0-beta.18";
10
10
  async function prepareBrowsers() {
11
11
  if (browsersReady()) {
12
12
  return { ok: true, already: true, message: "chromium is already installed" };
@@ -458,7 +458,7 @@ import path7 from "path";
458
458
  // ../engine-playwright/dist/index.js
459
459
  import path3 from "path";
460
460
 
461
- // ../test-model/dist/chunk-T76NYOOM.js
461
+ // ../test-model/dist/chunk-ZRUZU4TI.js
462
462
  import { z as z3 } from "zod";
463
463
  var LocatorOverrideSchema = z3.object({
464
464
  strategy: z3.enum(["css", "xpath", "id", "testId", "text", "label", "placeholder", "altText", "title"]),
@@ -758,6 +758,20 @@ var FlowDocumentSchema = z3.object({
758
758
  updatedAt: z3.string(),
759
759
  steps: z3.array(RecordedStepSchema),
760
760
  environment: ExecutionEnvironmentSchema.optional(),
761
+ /** WHICH DEPLOYMENT THIS WAS RECORDED AGAINST, by name — "staging",
762
+ * "production", whatever the project calls them.
763
+ *
764
+ * A record of fact, not a constraint: the flow can still be run against any
765
+ * environment, which is the point of naming them. What it answers is the
766
+ * question somebody asks of a test that fails only in one place — "where
767
+ * was this made?" — which was previously unanswerable, because the address
768
+ * it used belonged to a setting that had since moved on.
769
+ *
770
+ * Deliberately NOT the address. An origin in a git-tracked file is the
771
+ * mistake documented on `baseUrl` above; a name survives the deployment
772
+ * moving. Absent on everything recorded before this, and on a project that
773
+ * has never named its environments. */
774
+ recordedIn: z3.string().min(1).optional(),
761
775
  path: z3.string().optional(),
762
776
  actors: z3.array(ActorDefinitionSchema).optional(),
763
777
  defaultActorId: z3.string().optional(),
@@ -1134,17 +1148,25 @@ var AuthProfileSchema = z32.object({
1134
1148
  updatedAt: z32.string(),
1135
1149
  revision: z32.number().int().nonnegative().default(0)
1136
1150
  }).strict();
1137
- var ACCOUNT_BINDING_SCHEMA_VERSION = 2;
1151
+ var ACCOUNT_BINDING_SCHEMA_VERSION = 3;
1138
1152
  var AccountBindingSchema = z32.object({
1139
1153
  schemaVersion: z32.literal(ACCOUNT_BINDING_SCHEMA_VERSION),
1140
1154
  id: z32.string().min(1),
1141
1155
  slug: z32.string().regex(/^[a-z0-9][a-z0-9-]*$/),
1142
1156
  name: z32.string().min(1),
1143
1157
  profileId: z32.string().min(1),
1144
- /** Which environment of the APPLICATION UNDER TEST these credentials belong
1145
- * to — never Flowriki's own dev or staging. Null means every environment,
1146
- * which is what a project with one environment wants. */
1147
- environment: z32.string().min(1).nullable().default(null),
1158
+ /** Which environments of the APPLICATION UNDER TEST these credentials work
1159
+ * in — never Flowriki's own dev or staging.
1160
+ *
1161
+ * EMPTY MEANS EVERY ONE, which is what a project with a single deployment
1162
+ * wants and what most accounts will always say.
1163
+ *
1164
+ * A LIST because the same person usually exists in more than one place. One
1165
+ * environment per account was the shape until version 3, and it forced a
1166
+ * duplicate account — same name, same password, same everything — for each
1167
+ * deployment the identity existed in, or a blank "works anywhere" that also
1168
+ * claimed environments it had never been created in. Neither was true. */
1169
+ environments: z32.array(z32.string().min(1)).default([]),
1148
1170
  /** Step id → what this identity types there. Ordinary values: a username is
1149
1171
  * not a credential, and keeping it here is what lets somebody read an
1150
1172
  * account and know who it is. */
@@ -2125,6 +2147,20 @@ function installRecorder() {
2125
2147
  },
2126
2148
  true
2127
2149
  );
2150
+ const SECRET_WORDS = /password|passwd|pass[-_\s]?code|pwd|secret|otp|one[-_\s]?time[-_\s]?(code|pass)|security[-_\s]?(code|answer)|cvv|cvc|\bpin\b/i;
2151
+ const looksSecret = (el, type, name) => {
2152
+ if (type === "password") return true;
2153
+ const auto = String(el.autocomplete || el.getAttribute?.("autocomplete") || "").toLowerCase();
2154
+ if (/current-password|new-password|one-time-code/.test(auto)) return true;
2155
+ try {
2156
+ const masked = getComputedStyle(el).webkitTextSecurity;
2157
+ if (masked && masked !== "none") return true;
2158
+ } catch {
2159
+ }
2160
+ return SECRET_WORDS.test(
2161
+ [name, el.name, el.id, el.getAttribute?.("aria-label"), el.placeholder].filter(Boolean).join(" ")
2162
+ );
2163
+ };
2128
2164
  const editedValues = /* @__PURE__ */ new WeakMap();
2129
2165
  const onEdit = (e) => {
2130
2166
  if (e.isComposing) return;
@@ -2155,15 +2191,16 @@ function installRecorder() {
2155
2191
  const signature = JSON.stringify(values ?? value);
2156
2192
  if (editedValues.get(el) === signature) return;
2157
2193
  editedValues.set(el, signature);
2194
+ const identity = identify(el);
2158
2195
  send({
2159
2196
  type: type === "range" ? "setRange" : tag === "select" ? "select" : "fill",
2160
2197
  role: roleOf(el),
2161
- ...identify(el),
2162
- ...scoping(el, roleOf(el), identify(el).name),
2198
+ ...identity,
2199
+ ...scoping(el, roleOf(el), identity.name),
2163
2200
  legacySelector: cssPath(el),
2164
2201
  value,
2165
2202
  ...values ? { values } : {},
2166
- secret: type === "password"
2203
+ secret: looksSecret(el, type, identity.name)
2167
2204
  });
2168
2205
  };
2169
2206
  document.addEventListener("input", onEdit, true);
@@ -6310,7 +6347,7 @@ function toSummary(row) {
6310
6347
  };
6311
6348
  }
6312
6349
 
6313
- // ../repository-store/dist/chunk-QSTSWM2T.js
6350
+ // ../repository-store/dist/chunk-A4JZPKZT.js
6314
6351
  var FLOWRIKI_DIR = ".flowriki";
6315
6352
  var FEATURES_DIR = `${FLOWRIKI_DIR}/features`;
6316
6353
  var CONFIG_PATH = `${FLOWRIKI_DIR}/config.json`;
@@ -6351,6 +6388,7 @@ function parseConfig(raw) {
6351
6388
  return {
6352
6389
  baseUrl: typeof source["baseUrl"] === "string" ? source["baseUrl"] : "",
6353
6390
  ...typeof source["applicationEnvironment"] === "string" ? { applicationEnvironment: source["applicationEnvironment"] } : {},
6391
+ ...Array.isArray(source["environments"]) ? { environments: readEnvironments(source["environments"]) } : {},
6354
6392
  reuseAuthentication: source["reuseAuthentication"] === true,
6355
6393
  headless: source["headless"] === true,
6356
6394
  environment: ExecutionEnvironmentSchema.parse(source["environment"] ?? {}),
@@ -6358,6 +6396,20 @@ function parseConfig(raw) {
6358
6396
  flakinessRepeat: clampRepeat(source["flakinessRepeat"])
6359
6397
  };
6360
6398
  }
6399
+ function readEnvironments(raw) {
6400
+ const out = [];
6401
+ const seen = /* @__PURE__ */ new Set();
6402
+ for (const entry of raw) {
6403
+ if (!entry || typeof entry !== "object") continue;
6404
+ const { name, baseUrl } = entry;
6405
+ if (typeof name !== "string" || !name.trim()) continue;
6406
+ const key = name.trim().toLowerCase();
6407
+ if (seen.has(key)) continue;
6408
+ seen.add(key);
6409
+ out.push({ name: name.trim(), baseUrl: typeof baseUrl === "string" ? baseUrl : "" });
6410
+ }
6411
+ return out;
6412
+ }
6361
6413
  var FlowNotFound = class extends Error {
6362
6414
  constructor(message) {
6363
6415
  super(message);
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  resolveCheckouts,
9
9
  start,
10
10
  status
11
- } from "./chunk-NTARVVKX.js";
11
+ } from "./chunk-ZGXVQ2QA.js";
12
12
 
13
13
  // src/cli.ts
14
14
  import { parseArgs } from "util";
package/dist/engine.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  resolveCheckouts,
10
10
  start,
11
11
  status
12
- } from "./chunk-NTARVVKX.js";
12
+ } from "./chunk-ZGXVQ2QA.js";
13
13
  export {
14
14
  AGENT_VERSION,
15
15
  browsersReady,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowriki/agent",
3
- "version": "0.1.0-beta.17",
3
+ "version": "0.1.0-beta.18",
4
4
  "description": "Run Flowriki UI tests on your own computer. Connects this machine to your Flowriki account.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",