bpmax-cli 0.2.1-beta.77 → 0.2.1-beta.78

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/bin.js CHANGED
@@ -326,6 +326,14 @@ function capabilityForRequest(method, path29) {
326
326
  if (normalizedMethod === "GET" && /^\/page_composition_asset\/\d+$/.test(normalizedPath)) return "config.page_template.asset.list";
327
327
  if (normalizedMethod === "POST" && /^\/page_composition_asset\/\d+$/.test(normalizedPath)) return "config.page_template.asset.upload";
328
328
  if (normalizedMethod === "DELETE" && /^\/page_composition_asset\/\d+$/.test(normalizedPath)) return "config.page_template.asset.delete";
329
+ if (normalizedMethod === "GET" && normalizedPath === "/home_portal") return "config.home_portal.export";
330
+ if (normalizedMethod === "GET" && normalizedPath === "/home_portal/flows") return "config.home_portal.flows";
331
+ if (normalizedMethod === "GET" && normalizedPath === "/home_portal/nav_preview") return "config.home_portal.preview";
332
+ if (normalizedMethod === "GET" && normalizedPath === "/home_portal/workspaces") return "config.home_portal.preview";
333
+ if (normalizedMethod === "GET" && normalizedPath === "/home_portal/copy_preview") return "config.home_portal.preview";
334
+ if (normalizedMethod === "PUT" && normalizedPath === "/home_portal") return "config.home_portal.submit";
335
+ if (normalizedMethod === "POST" && normalizedPath === "/home_portal/nav_import") return "config.home_portal.nav_import";
336
+ if (normalizedMethod === "POST" && normalizedPath === "/home_portal/copy") return "config.home_portal.copy";
329
337
  if (normalizedMethod === "GET" && normalizedPath === "/flow_page_template/generate_report") return "config.flow_detail_template.render";
330
338
  if (normalizedMethod === "POST" && normalizedPath === "/flow_page_template") return `${pageTemplatePrefix}.create`;
331
339
  if (normalizedMethod === "GET" && normalizedPath === "/flow_page_template") return `${pageTemplatePrefix}.export`;
@@ -514,7 +522,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
514
522
  // package.json
515
523
  var package_default = {
516
524
  name: "bpmax-cli",
517
- version: "0.2.1-beta.77",
525
+ version: "0.2.1-beta.78",
518
526
  description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
519
527
  type: "module",
520
528
  bin: {
@@ -1368,7 +1376,7 @@ function parseQuery(path29) {
1368
1376
  }
1369
1377
  function isRawConfigPath(method, path29) {
1370
1378
  const normalizedPath = normalizeApiPath2(path29);
1371
- if (/^\/(configuration|form_template|flow_page_template|data_set|data_set_field|api_platform|api_platform_instance|api_proxy|api_proxy_entity_binding|entity|entity_field|role|point|user_role|workspace|group|config_repository)(\/|$)/.test(normalizedPath)) {
1379
+ if (/^\/(configuration|home_portal|form_template|flow_page_template|data_set|data_set_field|api_platform|api_platform_instance|api_proxy|api_proxy_entity_binding|entity|entity_field|role|point|user_role|workspace|group|config_repository)(\/|$)/.test(normalizedPath)) {
1372
1380
  return true;
1373
1381
  }
1374
1382
  if (normalizedPath === "/flow/list/lightweight" || normalizedPath.startsWith("/flow/configuration/")) {
@@ -4929,6 +4937,48 @@ function textOf(value) {
4929
4937
  if (isRecord4(value)) return Object.values(value).map(textOf).join(" ");
4930
4938
  return "";
4931
4939
  }
4940
+ function changedTextFragment(before, after) {
4941
+ if (before === after) return "";
4942
+ let prefix = 0;
4943
+ while (prefix < before.length && prefix < after.length && before[prefix] === after[prefix]) prefix += 1;
4944
+ let suffix = 0;
4945
+ while (suffix < before.length - prefix && suffix < after.length - prefix && before[before.length - 1 - suffix] === after[after.length - 1 - suffix]) suffix += 1;
4946
+ const changedExpression = (text5, offset, endOffset) => {
4947
+ const boundary = Math.max(
4948
+ text5.lastIndexOf("\n", Math.max(0, offset - 1)),
4949
+ text5.lastIndexOf(";", Math.max(0, offset - 1)),
4950
+ text5.lastIndexOf("{", Math.max(0, offset - 1)),
4951
+ text5.lastIndexOf("}", Math.max(0, offset - 1))
4952
+ ) + 1;
4953
+ const end = text5.indexOf(";", endOffset);
4954
+ return text5.slice(boundary, end === -1 ? text5.length : end);
4955
+ };
4956
+ const enclosingFunction = (text5, offset) => {
4957
+ const starts = [...text5.matchAll(/\bfunction\s+[A-Za-z_$][\w$]*\s*\([^)]*\)\s*\{/g)].map((match) => match.index ?? -1).filter((index) => index >= 0 && index < offset);
4958
+ const start = starts.at(-1);
4959
+ if (start === void 0) return "";
4960
+ let depth = 0;
4961
+ let opened = false;
4962
+ for (let index = start; index < text5.length; index += 1) {
4963
+ if (text5[index] === "{") {
4964
+ depth += 1;
4965
+ opened = true;
4966
+ } else if (text5[index] === "}" && opened) {
4967
+ depth -= 1;
4968
+ if (depth === 0) return offset <= index ? text5.slice(start, index + 1) : "";
4969
+ }
4970
+ }
4971
+ return "";
4972
+ };
4973
+ return [
4974
+ changedExpression(before, prefix, before.length - suffix),
4975
+ before.slice(prefix, before.length - suffix),
4976
+ changedExpression(after, prefix, after.length - suffix),
4977
+ after.slice(prefix, after.length - suffix),
4978
+ enclosingFunction(before, prefix),
4979
+ enclosingFunction(after, prefix)
4980
+ ].join("\n");
4981
+ }
4932
4982
  function containsPermissionIdentifier(value) {
4933
4983
  return /(?:^|[^A-Za-z0-9])(?:permission|permissions|role|roles|scope|organization|product|gtm|authorize|authorization)(?:$|[^A-Za-z0-9])|\$CAN_|\$canInFlow|__owner_id|project\.(?:view|delete)/i.test(value);
4934
4984
  }
@@ -4952,7 +5002,10 @@ function matchesBoundary(path29, declared) {
4952
5002
  }
4953
5003
  function analyzeListTemplatePermissionBoundary(raw, work, manifest) {
4954
5004
  const changedPaths = changedJsonPaths(raw, work);
4955
- const permissionRelated = changedPaths.some((path29) => containsPermissionIdentifier(path29) || containsPermissionIdentifier(textOf(valueAtPointer(raw, path29))) || containsPermissionIdentifier(textOf(valueAtPointer(work, path29))));
5005
+ const permissionRelated = changedPaths.some((path29) => containsPermissionIdentifier(path29) || containsPermissionIdentifier(changedTextFragment(
5006
+ textOf(valueAtPointer(raw, path29)),
5007
+ textOf(valueAtPointer(work, path29))
5008
+ )));
4956
5009
  if (!permissionRelated) {
4957
5010
  return { permission_related: false, changed_paths: changedPaths, boundary: null };
4958
5011
  }
@@ -5559,6 +5612,18 @@ var CONFIG_DOMAINS = {
5559
5612
  readEndpoints: ["GET /api/configuration?q_type=:type&is_default_action=1&page=1&page_size=10000", "GET /api/point/point_list", "GET /api/group/sub_groups"],
5560
5613
  writeEndpoints: ["PUT /api/configuration/:id?is_default_action=1", "POST /api/configuration?is_default_action=1", "DELETE /api/configuration/:id?is_default_action=1"],
5561
5614
  notes: ["Nav config is four configuration records (navmenu/shortcut/navmenu_mobile/shortcut_mobile). Export id is the workspace key. Submit writes all four records as an operation plan."]
5615
+ },
5616
+ "home-portal": {
5617
+ capability: "config.home_portal",
5618
+ exportPath: () => "/home_portal",
5619
+ exportStatus: "supported",
5620
+ buildStatus: "supported",
5621
+ submitStatus: "supported",
5622
+ submitPath: () => "/home_portal",
5623
+ submitMethod: "PUT",
5624
+ readEndpoints: ["GET /api/home_portal", "GET /api/home_portal/flows", "GET /api/home_portal/nav_preview", "GET /api/home_portal/workspaces", "GET /api/home_portal/copy_preview"],
5625
+ writeEndpoints: ["PUT /api/home_portal", "POST /api/home_portal/nav_import", "POST /api/home_portal/copy"],
5626
+ notes: ["Workspace-scoped flow portal bundle. Export/submit uses the workspace profile and optimistic version CAS; use nav/copy specialized APIs for preview-token imports."]
5562
5627
  }
5563
5628
  };
5564
5629
  var CONFIG_SUBMIT_UNSUPPORTED_MESSAGE = "Typed config build/submit adapters are not implemented for this domain yet. Stop before remote writes and use the matching editor Skill verified scripts until bpmax-cli adds a domain-specific adapter.";
@@ -5684,6 +5749,53 @@ function normalizeWorkspaceKey(workspace) {
5684
5749
  const nextWorkspace = workspace.trim().replace(/^\/+|\/+$/g, "");
5685
5750
  return nextWorkspace.startsWith("w:") ? nextWorkspace.slice(2) : nextWorkspace;
5686
5751
  }
5752
+ function normalizeHomePortalPayload(work) {
5753
+ const version = Number(work.version);
5754
+ if (!Number.isSafeInteger(version) || version < 0) throw new Error("home-portal version must be a non-negative integer.");
5755
+ const categories = Array.isArray(work.categories) ? work.categories : [];
5756
+ const entries = Array.isArray(work.entries) ? work.entries : [];
5757
+ const categoryIds = new Set(categories.map((item) => isRecord5(item) ? String(item.id ?? "") : ""));
5758
+ if (categories.some((item) => !isRecord5(item) || !String(item.id ?? "").trim())) throw new Error("home-portal categories require string ids.");
5759
+ const clean = (value, max) => String(value ?? "").trim().slice(0, max);
5760
+ const normalizedEntries = entries.map((item, index) => {
5761
+ if (!isRecord5(item)) throw new Error(`home-portal entry ${index} must be an object.`);
5762
+ const categoryId = clean(item.categoryId ?? item.category_id, 120);
5763
+ const pathValue2 = clean(item.path, 2e3);
5764
+ if (!categoryIds.has(categoryId) || !pathValue2) throw new Error(`home-portal entry ${index} requires a valid categoryId and path.`);
5765
+ return {
5766
+ id: clean(item.id, 120) || `entry-${index + 1}`,
5767
+ categoryId,
5768
+ name: clean(item.name, 120) || `\u5165\u53E3 ${index + 1}`,
5769
+ description: clean(item.description, 500),
5770
+ path: pathValue2,
5771
+ linkLabel: clean(item.linkLabel ?? item.link_label, 120),
5772
+ secondPath: clean(item.secondPath ?? item.second_path, 2e3),
5773
+ secondLinkLabel: clean(item.secondLinkLabel ?? item.second_link_label, 120),
5774
+ icon: clean(item.icon, 120),
5775
+ color: clean(item.color, 30) || "#4C86F7",
5776
+ openInWindow: Boolean(item.openInWindow ?? item.open_in_window),
5777
+ common: Boolean(item.common),
5778
+ enabled: item.enabled !== false,
5779
+ order: Number(item.order ?? index),
5780
+ flowType: clean(item.flowType ?? item.flow_type, 120),
5781
+ flowKey: clean(item.flowKey ?? item.flow_key, 120),
5782
+ permissionType: clean(item.permissionType ?? item.permission_type, 40),
5783
+ permission: clean(item.permission, 255),
5784
+ visibility: clean(item.visibility, 40) || "public",
5785
+ visibility_scope: item.visibility_scope ?? "",
5786
+ sourceNavId: clean(item.sourceNavId ?? item.source_nav_id, 120)
5787
+ };
5788
+ });
5789
+ return {
5790
+ workspace: normalizeWorkspaceKey(clean(work.workspace, 120)),
5791
+ version,
5792
+ categories: categories.map((item, index) => {
5793
+ if (!isRecord5(item)) throw new Error(`home-portal category ${index} must be an object.`);
5794
+ return { id: clean(item.id, 120), name: clean(item.name, 120) || `\u5206\u7C7B ${index + 1}`, icon: clean(item.icon, 120), color: clean(item.color, 30), order: Number(item.order ?? index), enabled: item.enabled !== false, permissionType: clean(item.permissionType ?? item.permission_type, 40), permission: clean(item.permission, 255), visibility: clean(item.visibility, 40) || "public", visibility_scope: item.visibility_scope ?? "", sourceNavId: clean(item.sourceNavId ?? item.source_nav_id, 120) };
5795
+ }),
5796
+ entries: normalizedEntries
5797
+ };
5798
+ }
5687
5799
  function numericId(value) {
5688
5800
  if (typeof value === "number" && Number.isFinite(value)) {
5689
5801
  return value;
@@ -14752,6 +14864,9 @@ function buildDomainSubmitPayload(domain, work, options = {}, raw) {
14752
14864
  if (domain === "page-template") {
14753
14865
  return normalizePageCompositionTemplatePayload(work);
14754
14866
  }
14867
+ if (domain === "home-portal") {
14868
+ return normalizeHomePortalPayload(work);
14869
+ }
14755
14870
  throw new Error(`${CONFIG_SUBMIT_UNSUPPORTED_MESSAGE} Domain: ${domain}.`);
14756
14871
  }
14757
14872
  function responseDataId(response) {
@@ -16929,6 +17044,7 @@ function validatePageTemplatePreviewManifest(manifest, payload) {
16929
17044
  }
16930
17045
  async function exportConfigDomain(config, profile, domain, id, outDir, options = {}) {
16931
17046
  void config;
17047
+ const definition = CONFIG_DOMAINS[domain];
16932
17048
  assertNotLocalUuidConfigId(domain, id, "export");
16933
17049
  if (domain === "api-platform") {
16934
17050
  const { raw, work: work2 } = await collectApiPlatformAggregate(profile, id);
@@ -16975,7 +17091,21 @@ async function exportConfigDomain(config, profile, domain, id, outDir, options =
16975
17091
  });
16976
17092
  return { domain, id, raw_file: rawFile2, work_file: workFile2, meta_file: metaFile2, base_hash: baseHash2 };
16977
17093
  }
16978
- const definition = CONFIG_DOMAINS[domain];
17094
+ if (domain === "home-portal") {
17095
+ const workspace = normalizeWorkspaceKey(id || profile.config.workspace);
17096
+ await ensureConfigCapability(profile, `${definition.capability}.export`);
17097
+ const data2 = await apiRequest(createApiClient(profile), "GET", "/home_portal", { params: { workspace }, capability: `${definition.capability}.export` });
17098
+ const payload = isRecord5(data2) ? { workspace, ...data2 } : { workspace, version: 0, categories: [], entries: [] };
17099
+ const baseHash2 = hashJson(payload);
17100
+ const stem2 = `${domain}-${workspace.replace(/[^a-zA-Z0-9._-]+/g, "-")}`;
17101
+ const rawFile2 = path6.join(outDir, "raw", `${stem2}.json`);
17102
+ const workFile2 = path6.join(outDir, "work", `${stem2}.json`);
17103
+ const metaFile2 = path6.join(outDir, "meta", `${stem2}.meta.json`);
17104
+ await writeJsonFile(rawFile2, payload);
17105
+ await writeJsonFile(workFile2, payload);
17106
+ await writeJsonFile(metaFile2, { domain, id: workspace, profile: profile.name, workspace: profile.config.workspace, exported_at: (/* @__PURE__ */ new Date()).toISOString(), base_hash: baseHash2, raw_file: rawFile2, work_file: workFile2 });
17107
+ return { domain, id: workspace, raw_file: rawFile2, work_file: workFile2, meta_file: metaFile2, base_hash: baseHash2 };
17108
+ }
16979
17109
  if (!definition.exportPath) {
16980
17110
  throw new Error(definition.unsupportedExportReason || `Config export is not implemented for ${domain}.`);
16981
17111
  }
@@ -17825,6 +17955,24 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
17825
17955
  readback_hash: hashJson(readback2)
17826
17956
  };
17827
17957
  }
17958
+ if (domain === "home-portal") {
17959
+ const submit2 = await readJsonFile(submitFile);
17960
+ if (!isRecord5(submit2) || submit2.domain !== domain || !isRecord5(submit2.payload) || !isRecord5(submit2.meta)) throw new Error("Config submit requires a payload produced by `config home-portal build`.");
17961
+ const workspace = normalizeWorkspaceKey(String(submit2.payload.workspace || id || profile.config.workspace));
17962
+ if (String(submit2.meta.id || workspace) !== workspace) throw new Error(`Config submit metadata id mismatch. Expected ${workspace}.`);
17963
+ if (typeof submit2.base_hash !== "string") throw new Error("home-portal submit requires base_hash from export/build.");
17964
+ await ensureConfigCapability(profile, `${definition.capability}.export`);
17965
+ await ensureConfigCapability(profile, `${definition.capability}.submit`);
17966
+ const currentRaw = await apiRequest(createApiClient(profile), "GET", "/home_portal", { params: { workspace }, capability: `${definition.capability}.export` });
17967
+ const current2 = isRecord5(currentRaw) ? { workspace, ...currentRaw } : { workspace, version: 0, categories: [], entries: [] };
17968
+ if (hashJson(current2) !== submit2.base_hash) throw new Error("Remote config changed after export. Re-export before submitting.");
17969
+ const expectedConfirm2 = `submit ${domain} ${workspace}`;
17970
+ if (confirm3 !== expectedConfirm2) return { ...dryRunFields(expectedConfirm2), domain, id: workspace, endpoint: "/home_portal", method: "PUT", payload: submit2.payload, current_hash: hashJson(current2), next: `Run again with --confirm "${expectedConfirm2}" to submit.` };
17971
+ const response2 = await apiRequest(createApiClient(profile), "PUT", "/home_portal", { data: { version: submit2.payload.version, categories: submit2.payload.categories, entries: submit2.payload.entries }, params: { workspace }, capability: `${definition.capability}.submit` });
17972
+ const readbackRaw = await apiRequest(createApiClient(profile), "GET", "/home_portal", { params: { workspace }, capability: `${definition.capability}.export` });
17973
+ const readback2 = isRecord5(readbackRaw) ? { workspace, ...readbackRaw } : readbackRaw;
17974
+ return { ...executedFields(), domain, id: workspace, endpoint: "/home_portal", method: "PUT", response: response2, readback_hash: hashJson(readback2) };
17975
+ }
17828
17976
  if (domain === "role" || domain === "api-platform" || domain === "nav-config") {
17829
17977
  if (definition.submitStatus !== "supported") {
17830
17978
  throw new Error(`${CONFIG_SUBMIT_UNSUPPORTED_MESSAGE} Domain: ${domain}.`);
@@ -21980,6 +22128,16 @@ function registerConfigCommands(program2) {
21980
22128
  printResult(options.format, result);
21981
22129
  });
21982
22130
  }
22131
+ if (domain === "home-portal") {
22132
+ domainCommand.command("flows").description("List flow options available to portal entries").option("--profile <profile>").option("--format <format>", "Output format", "json").action(async (options) => {
22133
+ const profile2 = resolveProfile(await loadConfig(), options.profile);
22134
+ printResult(options.format, await apiRequest(createApiClient(profile2), "GET", "/home_portal/flows", { capability: "config.home_portal.flows" }));
22135
+ });
22136
+ domainCommand.command("nav-preview").description("Preview importing PC navigation into the portal").option("--profile <profile>").option("--format <format>", "Output format", "json").action(async (options) => {
22137
+ const profile2 = resolveProfile(await loadConfig(), options.profile);
22138
+ printResult(options.format, await apiRequest(createApiClient(profile2), "GET", "/home_portal/nav_preview", { capability: "config.home_portal.preview" }));
22139
+ });
22140
+ }
21983
22141
  const createCommand = domainCommand.command("create").description(domain === "flow-template" ? "Create a new main flow template through the typed adapter" : domain === "page-template" ? "Create a page-template config object through the typed adapter; a verified preview manifest authorizes the write" : `Create a ${domain} config object through a verified typed adapter; dry-run unless --confirm is exact`).option("--profile <profile>", "Profile name").option("--confirm <text>", "Exact confirmation text").option("--publish-live", "For flow-template, publish the created flow to live after saving draft").option("--response-out <file>", "Write the full JSON response to a file").option("--format <format>", "Output format", "pretty");
21984
22142
  if (domain === "flow-template") {
21985
22143
  createCommand.requiredOption("--work <file>", "Flow-template work JSON file").option("--agent <agent>", "Agent adapter for installed plugin lint discovery", "codex");
@@ -22491,6 +22649,12 @@ var schemaEntries = [
22491
22649
  { name: "config.page_template.asset.list", description: "List static resources registered for an independent page-composition template.", method: "GET", path: "/api/page_composition_asset/:templateId" },
22492
22650
  { name: "config.page_template.asset.upload", description: "Upload and register a static resource for an independent page-composition template.", method: "POST", path: "/api/page_composition_asset/:templateId" },
22493
22651
  { name: "config.page_template.asset.delete", description: "Delete an unreferenced static resource from an independent page-composition template.", method: "DELETE", path: "/api/page_composition_asset/:assetId" },
22652
+ { name: "config.home_portal.export", description: "Export the workspace-scoped flow portal bundle.", method: "GET", path: "/api/home_portal" },
22653
+ { name: "config.home_portal.submit", description: "Replace the workspace flow portal bundle with optimistic version checking.", method: "PUT", path: "/api/home_portal" },
22654
+ { name: "config.home_portal.flows", description: "List flow options available to flow portal editors.", method: "GET", path: "/api/home_portal/flows" },
22655
+ { name: "config.home_portal.preview", description: "Preview navigation, workspaces, or portal copy operations.", method: "GET", path: "/api/home_portal/nav_preview + /api/home_portal/workspaces + /api/home_portal/copy_preview" },
22656
+ { name: "config.home_portal.import", description: "Import navigation into the flow portal using a preview token.", method: "POST", path: "/api/home_portal/nav_import" },
22657
+ { name: "config.home_portal.copy", description: "Copy a flow portal from another workspace using a preview token.", method: "POST", path: "/api/home_portal/copy" },
22494
22658
  { name: "config.step_detail_template.export", description: "Export type=6 flow-step detail template config.", method: "GET", path: "/api/flow_page_template/:id?type=6&skip_i18n=true" },
22495
22659
  { name: "config.step_detail_template.create", description: "Create a type=6 flow-step detail template through a verified typed adapter.", method: "POST", path: "/api/flow_page_template?type=6" },
22496
22660
  { name: "config.step_detail_template.delete", description: "Delete a type=6 flow-step detail template through a verified typed adapter.", method: "DELETE", path: "/api/flow_page_template/:id?type=6" },
@@ -23120,7 +23284,7 @@ function hasDynamicRuntimeId(value) {
23120
23284
  if (!value || value.includes("{{")) return false;
23121
23285
  return /(?:[?&](?:id|project_id|step_id|trace_id)=\d+)|(?:\/project(?:Continue|_detail)?\/\d+)/i.test(value);
23122
23286
  }
23123
- function targetIssues(target, stepKey, actionIndex) {
23287
+ function targetIssues(target, stepKey, actionIndex, actionType = "") {
23124
23288
  if (!isRecord9(target)) {
23125
23289
  return [{
23126
23290
  rule_id: "test_suite.automation.target_missing",
@@ -23160,7 +23324,8 @@ function targetIssues(target, stepKey, actionIndex) {
23160
23324
  }];
23161
23325
  }
23162
23326
  const css = stringValue2(target.css);
23163
- if (css && !/^(?:\[(?:data-[\w-]+|name|aria-label)=|#[A-Za-z][\w:-]*$)/.test(css)) {
23327
+ const knownListContainerCss = actionType === "list.assert_record" && css === ".project-table-container";
23328
+ if (css && !knownListContainerCss && !/^(?:\[(?:data-[\w-]+|name|aria-label)=|#[A-Za-z][\w:-]*$)/.test(css)) {
23164
23329
  return [{
23165
23330
  rule_id: "test_suite.automation.selector_unstable",
23166
23331
  step_key: stepKey,
@@ -23248,7 +23413,7 @@ function actionIssues(action, stepKey, index, check, resolutionOutcome) {
23248
23413
  "file.download",
23249
23414
  "wait.visible"
23250
23415
  ].includes(type)) {
23251
- issues.push(...targetIssues(action.target ?? (action.field ? { field: action.field } : void 0), stepKey, index));
23416
+ issues.push(...targetIssues(action.target ?? (action.field ? { field: action.field } : void 0), stepKey, index, type));
23252
23417
  }
23253
23418
  if (type === "page.assert_text_sequence") {
23254
23419
  const target = isRecord9(action.target) ? action.target : {};
@@ -31848,7 +32013,10 @@ function browserPageStepMatches(expected, bodyText, textVisible, runtimeUrl = ""
31848
32013
  return normalizedActiveSteps.includes(normalizedExpected);
31849
32014
  }
31850
32015
  if (handledCurrentStep) return expected === "\u64CD\u4F5C\u6210\u529F";
31851
- return textVisible;
32016
+ if (normalizedExpected === "\u5F52\u6863" && textVisible && /归档[\s\S]{0,80}(?:完成|已完成|已归档)/.test(bodyText)) {
32017
+ return true;
32018
+ }
32019
+ return false;
31852
32020
  }
31853
32021
  function browserEvidenceStatusIsVerified(status) {
31854
32022
  return status !== "submitted_outcome_unknown";
@@ -32616,7 +32784,7 @@ function browserListContainerKind(descriptor) {
32616
32784
  if (classes.has("el-table")) return "element_table";
32617
32785
  if (descriptor.tag === "table") return "table";
32618
32786
  if (descriptor.role === "rowgroup") return "rowgroup";
32619
- if (/(?:^|[-_])(list|table|records)(?:$|[-_])/i.test(descriptor.test_id) || classes.has("project-list") || classes.has("list-container")) return "known_list";
32787
+ if (/(?:^|[-_])(list|table|records)(?:$|[-_])/i.test(descriptor.test_id) || classes.has("project-list") || classes.has("list-container") || classes.has("project-table-container")) return "known_list";
32620
32788
  return void 0;
32621
32789
  }
32622
32790
  async function visibleBrowserRecords(records) {
@@ -33060,7 +33228,13 @@ async function executeAction(page, action, variables, runtime) {
33060
33228
  }
33061
33229
  case "detail.assert_rows": {
33062
33230
  const table = await tableLocator(page, String(next.table));
33063
- const count = await table.locator(".el-table__body-wrapper tbody tr, .el-table__body tr, tbody tr").count();
33231
+ const rowGroups = [
33232
+ table.locator(".el-table__body-wrapper:not(.el-table__fixed-body-wrapper) > table.el-table__body > tbody > tr"),
33233
+ table.locator("table:not(.el-table__fixed) > tbody > tr"),
33234
+ table.locator('[role="rowgroup"] > [role="row"]')
33235
+ ];
33236
+ const rows2 = await firstVisibleBrowserRecordGroup(rowGroups);
33237
+ const count = rows2.length;
33064
33238
  const passed = count === Number(next.count);
33065
33239
  if (!passed) throw new Error(`detail row count mismatch: expected ${next.count}, got ${count}`);
33066
33240
  return { assertion: { type: next.type, passed, table: next.table, count } };
@@ -36753,40 +36927,74 @@ function mergeField(existing, incoming) {
36753
36927
  ...children?.length ? { children } : {}
36754
36928
  };
36755
36929
  }
36756
- function collectFieldCandidates(value, fields, depth = 0) {
36930
+ function fieldRecords(value) {
36931
+ if (Array.isArray(value)) return value.flatMap((item) => fieldRecords(item));
36932
+ if (!isRecord14(value)) return [];
36933
+ if (pickString(value, FIELD_KEY_NAMES)) return [value];
36934
+ return Object.values(value).flatMap((item) => fieldRecords(item));
36935
+ }
36936
+ function fieldLabel(value) {
36937
+ return pickString(value, FIELD_LABEL_NAMES)?.toLowerCase() ?? "";
36938
+ }
36939
+ function collectFieldCandidates(value, fields, aliases = /* @__PURE__ */ new Map(), depth = 0) {
36757
36940
  if (depth > 8) {
36758
36941
  return;
36759
36942
  }
36760
36943
  if (Array.isArray(value)) {
36761
36944
  for (const item of value) {
36762
- collectFieldCandidates(item, fields, depth + 1);
36945
+ collectFieldCandidates(item, fields, new Map(aliases), depth + 1);
36763
36946
  }
36764
36947
  return;
36765
36948
  }
36766
36949
  if (!isRecord14(value)) {
36767
36950
  return;
36768
36951
  }
36952
+ const localAliases = new Map(aliases);
36953
+ for (const [ruleName, valueName] of [["rule", "value"], ["rules", "values"]]) {
36954
+ const rules = fieldRecords(value[ruleName]);
36955
+ const values = fieldRecords(value[valueName]);
36956
+ if (rules.length === 0 || values.length === 0) continue;
36957
+ const usedValues = /* @__PURE__ */ new Set();
36958
+ for (let index = 0; index < rules.length; index += 1) {
36959
+ const rule = rules[index];
36960
+ const ruleKey = pickString(rule, FIELD_KEY_NAMES);
36961
+ if (!ruleKey) continue;
36962
+ let valueIndex = values.findIndex((candidate, candidateIndex) => !usedValues.has(candidateIndex) && fieldLabel(rule) !== "" && fieldLabel(rule) === fieldLabel(candidate));
36963
+ const positionalCandidate = index < values.length ? values[index] : void 0;
36964
+ const labelsCompatible = !fieldLabel(rule) || !positionalCandidate || !fieldLabel(positionalCandidate) || fieldLabel(rule) === fieldLabel(positionalCandidate);
36965
+ if (valueIndex < 0 && labelsCompatible && index < values.length && !usedValues.has(index)) valueIndex = index;
36966
+ if (valueIndex < 0) continue;
36967
+ const persisted = values[valueIndex];
36968
+ const persistedKey = pickString(persisted, FIELD_KEY_NAMES);
36969
+ if (!ruleKey || !persistedKey || ruleKey === persistedKey) continue;
36970
+ usedValues.add(valueIndex);
36971
+ localAliases.set(ruleKey, persistedKey);
36972
+ localAliases.set(persistedKey, persistedKey);
36973
+ }
36974
+ }
36769
36975
  const field = fieldFromRecord(value);
36770
36976
  if (field) {
36771
- if (isSubFormField(field)) {
36977
+ const canonicalKey = localAliases.get(field.key) ?? field.key;
36978
+ const canonicalField = canonicalKey === field.key ? field : { ...field, key: canonicalKey };
36979
+ if (isSubFormField(canonicalField)) {
36772
36980
  const childFields = /* @__PURE__ */ new Map();
36773
36981
  for (const child of Object.values(value)) {
36774
36982
  if (isRecord14(child) || Array.isArray(child)) {
36775
- collectFieldCandidates(child, childFields, depth + 1);
36983
+ collectFieldCandidates(child, childFields, localAliases, depth + 1);
36776
36984
  }
36777
36985
  }
36778
36986
  const children = [...childFields.values()].sort((left, right) => left.key.localeCompare(right.key));
36779
36987
  fields.set(
36780
- field.key,
36781
- mergeField(fields.get(field.key), { ...field, ...children.length ? { children } : {} })
36988
+ canonicalKey,
36989
+ mergeField(fields.get(canonicalKey), { ...canonicalField, ...children.length ? { children } : {} })
36782
36990
  );
36783
36991
  return;
36784
36992
  }
36785
- fields.set(field.key, mergeField(fields.get(field.key), field));
36993
+ fields.set(canonicalKey, mergeField(fields.get(canonicalKey), canonicalField));
36786
36994
  }
36787
36995
  for (const child of Object.values(value)) {
36788
36996
  if (isRecord14(child) || Array.isArray(child)) {
36789
- collectFieldCandidates(child, fields, depth + 1);
36997
+ collectFieldCandidates(child, fields, localAliases, depth + 1);
36790
36998
  }
36791
36999
  }
36792
37000
  }
@@ -41622,7 +41830,7 @@ function cancelIfNeeded(value) {
41622
41830
  throw new Error("Interactive project creation cancelled.");
41623
41831
  }
41624
41832
  }
41625
- function fieldLabel(field) {
41833
+ function fieldLabel2(field) {
41626
41834
  return field.label ? `${field.label} (${field.key})` : field.key;
41627
41835
  }
41628
41836
  function isArrayField(field) {
@@ -41648,7 +41856,7 @@ function subFormHint(field) {
41648
41856
  return `JSON array rows: ${children}`;
41649
41857
  }
41650
41858
  async function promptField(field, currentValue) {
41651
- const message = field.required ? `${fieldLabel(field)} *` : fieldLabel(field);
41859
+ const message = field.required ? `${fieldLabel2(field)} *` : fieldLabel2(field);
41652
41860
  if (isSubFormField(field)) {
41653
41861
  const value2 = await text3({
41654
41862
  message,