@flowriki/agent 0.1.0-beta.44 → 0.1.0-beta.45

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.44";
9
+ var AGENT_VERSION = "0.1.0-beta.45";
10
10
  async function prepareBrowsers() {
11
11
  if (browsersReady()) {
12
12
  return { ok: true, already: true, message: "chromium is already installed" };
@@ -1202,6 +1202,10 @@ var TestCaseSchema = z32.object({
1202
1202
  businessSteps: z32.array(BusinessStepSchema).optional(),
1203
1203
  /** Where it came from, when not recorded here. */
1204
1204
  origin: TestCaseOriginSchema.optional(),
1205
+ /** WHEN ITS STEPS CHANGED AFTER IT WAS AUTOMATED: the automation may no
1206
+ * longer check what the words now say. Cleared when its flows are saved
1207
+ * again, or somebody confirms the automation still matches. */
1208
+ stepsChangedAt: z32.string().optional(),
1205
1209
  createdAt: z32.string(),
1206
1210
  createdBy: z32.string().default(""),
1207
1211
  updatedAt: z32.string(),
@@ -2070,6 +2074,27 @@ var ImportDraftSchema = z9.object({
2070
2074
  createdAt: z9.string(),
2071
2075
  updatedAt: z9.string()
2072
2076
  }).strict();
2077
+ var CaseUpdateRequestSchema = z9.object({
2078
+ id: z9.string().regex(/^upd_[A-Za-z0-9]+$/),
2079
+ projectId: z9.string().min(1),
2080
+ userId: z9.string().min(1),
2081
+ instruction: z9.string().min(1).max(4e3),
2082
+ cases: z9.array(z9.object({
2083
+ id: z9.string().min(1),
2084
+ name: z9.string(),
2085
+ feature: z9.string(),
2086
+ businessSteps: z9.array(BusinessStepSchema)
2087
+ }).strict()).min(1).max(500),
2088
+ status: z9.enum(["waiting", "working", "done", "failed"]).default("waiting"),
2089
+ proposals: z9.array(z9.object({
2090
+ caseId: z9.string().min(1),
2091
+ businessSteps: z9.array(BusinessStepSchema).max(200),
2092
+ note: z9.string().max(2e3).default("")
2093
+ }).strict()).default([]),
2094
+ note: z9.string().max(4e3).default(""),
2095
+ createdAt: z9.string(),
2096
+ updatedAt: z9.string()
2097
+ }).strict();
2073
2098
 
2074
2099
  // ../engine-playwright/dist/index.js
2075
2100
  import { createHmac, randomBytes as randomBytes2 } from "crypto";
package/dist/cli.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  runtimeValue,
24
24
  start,
25
25
  status
26
- } from "./chunk-E24RRF2Q.js";
26
+ } from "./chunk-JJB45ZTL.js";
27
27
 
28
28
  // src/cli.ts
29
29
  import { parseArgs } from "util";
@@ -230,6 +230,17 @@ var ServiceClient = class {
230
230
  { method: "POST", body: JSON.stringify(body) }
231
231
  );
232
232
  }
233
+ updateRequest(projectId, id) {
234
+ return this.call(
235
+ `/api/agent/update-requests/${encodeURIComponent(id)}?projectId=${encodeURIComponent(projectId)}`
236
+ );
237
+ }
238
+ proposeUpdates(projectId, id, body) {
239
+ return this.call(
240
+ `/api/agent/update-requests/${encodeURIComponent(id)}/proposals?projectId=${encodeURIComponent(projectId)}`,
241
+ { method: "POST", body: JSON.stringify(body) }
242
+ );
243
+ }
233
244
  readCases(projectId, refs) {
234
245
  const ids = refs.filter((r) => /^tc_/.test(r.trim()));
235
246
  const names = refs.filter((r) => !/^tc_/.test(r.trim()));
@@ -905,14 +916,23 @@ as learned. Keep what you learn with write_knowledge (features/<name>.md,
905
916
  memory/decisions.md, a session summary), on Claude's branch for review \u2014
906
917
  never a password, key or token.
907
918
 
919
+ UPDATING TEST CASES: when asked to update test cases (upd_\u2026), read the
920
+ request with read_update_request, then propose_case_updates with each changed
921
+ case's complete new steps \u2014 keep what the change does not touch word for
922
+ word, so the person sees exactly what moved. Leave out cases that need no
923
+ change. You never change a test case yourself; the person accepts.
924
+
908
925
  CONVERTING A SPREADSHEET: when asked to convert an import (imp_\u2026), read
909
926
  every part with read_import_file, then save_import_cases in batches. Group
910
927
  cases into features by product area (a sheet or section usually is one). Each
911
928
  case is one scenario: name it after what it proves. Steps: preconditions and
912
929
  setup as Given; ONE action per When / And \u2014 split steps that do several
913
930
  things; each expected result as Then / And, after the action it follows.
914
- Keep every case and every step's meaning, and its id from the file in row;
915
- never invent a step or drop one. Rows that are not test cases (titles,
931
+ Keep every case and every step's meaning, and its id from the file in row \u2014
932
+ that id is how a later import of the same file knows the case is already
933
+ there; never invent a step or drop one. A case found in several sheets is
934
+ converted once. Use the project's existing feature names (project_catalog)
935
+ when a case belongs in one, rather than a new look-alike. Rows that are not test cases (titles,
916
936
  notes, empty) are left out. Say in note what you could not convert.
917
937
 
918
938
  HOW TO WORK:
@@ -1401,6 +1421,53 @@ ${got.text}`);
1401
1421
  return text(`Saved ${saved.added} more \u2014 ${saved.total} test cases so far.${saved.done ? " Done: the person can now look them over and import them." : " Keep going, and pass done: true with the last batch."}`);
1402
1422
  }
1403
1423
  },
1424
+ {
1425
+ name: "read_update_request",
1426
+ title: "Read what should change in some test cases",
1427
+ description: "Read a request to update test cases (its id is upd_\u2026): what the person wants changed, and each test case as it is now \u2014 its id, feature, name and business steps.",
1428
+ inputSchema: { type: "object", properties: { projectId: { type: "string" }, request: { type: "string", description: "upd_\u2026" } }, required: ["request"], additionalProperties: false },
1429
+ annotations: { readOnlyHint: true },
1430
+ run: async (args) => {
1431
+ const projectId = await projectFor(args["projectId"]);
1432
+ const r = await service.updateRequest(projectId, str(args["request"]) ?? "");
1433
+ return text([
1434
+ `What should change: ${r.instruction}`,
1435
+ ...r.cases.map((c) => [`
1436
+ ${c.feature} \u203A ${c.name} (${c.id})`, ...c.businessSteps.length ? c.businessSteps.map((s) => ` ${s.keyword} ${s.text}`) : [" (no steps written)"]].join("\n"))
1437
+ ].join("\n"));
1438
+ }
1439
+ },
1440
+ {
1441
+ name: "propose_case_updates",
1442
+ title: "Propose new steps for test cases",
1443
+ description: "Propose the new business steps for test cases in an update request (upd_\u2026): for each case changed, its id and ALL its steps as Given / When / Then / And lines (the whole case, not only what changed). Cases that need no change are left out. The person sees each before and after and accepts the ones they want; nothing changes until they do. done: true with the last batch; note: anything you could not do.",
1444
+ inputSchema: {
1445
+ type: "object",
1446
+ properties: {
1447
+ projectId: { type: "string" },
1448
+ request: { type: "string", description: "upd_\u2026" },
1449
+ updates: {
1450
+ type: "array",
1451
+ items: {
1452
+ type: "object",
1453
+ properties: { case: { type: "string", description: "The test case's id, tc_\u2026" }, steps: { type: "array", items: { type: "string" } }, note: { type: "string", description: "Why, in a few words." } },
1454
+ required: ["case", "steps"],
1455
+ additionalProperties: false
1456
+ }
1457
+ },
1458
+ done: { type: "boolean" },
1459
+ note: { type: "string" }
1460
+ },
1461
+ required: ["request", "updates"],
1462
+ additionalProperties: false
1463
+ },
1464
+ run: async (args) => {
1465
+ const projectId = await projectFor(args["projectId"]);
1466
+ const updates = Array.isArray(args["updates"]) ? args["updates"] : [];
1467
+ const r = await service.proposeUpdates(projectId, str(args["request"]) ?? "", { updates, ...args["done"] === true ? { done: true } : {}, ...typeof args["note"] === "string" ? { note: args["note"] } : {} });
1468
+ return text(`Proposed new steps for ${r.proposed} of ${r.of} test cases.${r.done ? " Done: the person can now accept them." : " Pass done: true with the last batch."}`);
1469
+ }
1470
+ },
1404
1471
  {
1405
1472
  name: "read_test_cases",
1406
1473
  title: "Read test cases",
package/dist/engine.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  resolveCheckouts,
10
10
  start,
11
11
  status
12
- } from "./chunk-E24RRF2Q.js";
12
+ } from "./chunk-JJB45ZTL.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.44",
3
+ "version": "0.1.0-beta.45",
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",