@stalfh233/omc-cli 0.6.78 → 0.6.80

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.
@@ -13,7 +13,7 @@ import { closestMatch } from "../closest-match.js";
13
13
  import { getInstanceBaseInfo, getReplayToken, listInstanceActivities, searchWorkItems, wireString } from "../workflow-support.js";
14
14
  import { PLATFORM_ADMIN_START_BYPASS, resolvePermissionActor } from "../identity.js";
15
15
  import { ENGINE_OWNED_KEYS, RUNTIME_DATA_LANE_CONTRACT, RUNTIME_DATA_WIRE, runtimeFormDataArg, } from "./runtime-data-contract.js";
16
- import { SYSTEM_FIELD_CODES } from "../field-families.js";
16
+ import { SYSTEM_FIELD_CODES, familyName } from "../field-families.js";
17
17
  import { applicationResolutionOf, resolveApplicationScope } from "../support.js";
18
18
  /** r29b F8: keep ids/itemsPreview through governedRead's compact diet. */
19
19
  const DATA_LIST_PREVIEW_LIMIT = 20;
@@ -1064,6 +1064,38 @@ async function diagnoseDbException(session, schemaCode, error) {
1064
1064
  /** `data.aggregate` caps: server-total counts are exact; the local-scan fallback shares data.list's row cap. */
1065
1065
  const AGGREGATE_CAP = 1000;
1066
1066
  const AGGREGATE_PAGE_SIZE = 200;
1067
+ /** 数值聚合的字段拒绝面:publishedFields 只列前 N 个(与 data.list 的过滤目录同口径)。 */
1068
+ const AGGREGATE_FIELD_SAMPLE_LIMIT = 20;
1069
+ /**
1070
+ * 数值列的 wire 值 → number。null/undefined/非数值字符串 → null(null 行**不进**
1071
+ * sum/avg/min/max,也不进 min/max 初值比较)。平台数值列通常回 number,兼容回
1072
+ * 数字字符串的形状(历史读回见过)。
1073
+ */
1074
+ function aggregateNumeric(value) {
1075
+ if (typeof value === "number")
1076
+ return Number.isFinite(value) ? value : null;
1077
+ if (typeof value === "string" && value.trim() !== "") {
1078
+ const parsed = Number(value);
1079
+ return Number.isFinite(parsed) ? parsed : null;
1080
+ }
1081
+ return null;
1082
+ }
1083
+ /**
1084
+ * sum/avg 是**派生值**:12 位有效数字去掉二进制求和噪声(0.1+0.2),不做外推精度、
1085
+ * 不改存储值。min/max 是存储值本身,原样返回(tidy 会改掉长整数尾部)。
1086
+ */
1087
+ function aggregateTidy(value) {
1088
+ return Number.isFinite(value) ? Number(value.toPrecision(12)) : value;
1089
+ }
1090
+ function aggregateValue(metric, sum, nonNullCount, min, max) {
1091
+ if (nonNullCount === 0)
1092
+ return null;
1093
+ if (metric === "sum")
1094
+ return aggregateTidy(sum);
1095
+ if (metric === "avg")
1096
+ return aggregateTidy(sum / nonNullCount);
1097
+ return metric === "min" ? min : max;
1098
+ }
1067
1099
  /**
1068
1100
  * One property leaf as a level-1 AND group, so it can be appended to ANY base
1069
1101
  * condition (leaf / filters / filterGroup) without re-shaping the existing
@@ -1079,13 +1111,19 @@ function withAggregateLeaf(condition, leafGroup) {
1079
1111
  /**
1080
1112
  * Draft口径(继承 data.list r26/r28b 的键名,调用方同一套分支)。
1081
1113
  *
1082
- * - `includeDrafts:false`(含 groupBy 的默认)→ 注入 sequenceStatus≠DRAFT(excluded);
1114
+ * - `includeDrafts:false`(含 count+groupBy 的默认)→ 注入 sequenceStatus≠DRAFT(excluded);
1083
1115
  * - count 省略 → 平台默认:无条件时含草稿(included),带条件时平台自己排草稿(excluded);
1084
1116
  * - `includeDrafts:true` → 不注入;无条件时含草稿(included),带条件时平台仍排草稿。
1117
+ * - 数值指标(numeric)**不做默认排除**:本地折叠只反映平台返回行,要排除须显式 false。
1085
1118
  */
1086
- function aggregateDraftFilter(excludedByRequest, includeDrafts, hasUserCondition) {
1119
+ function aggregateDraftFilter(excludedByRequest, includeDrafts, hasUserCondition, numeric = false) {
1087
1120
  if (excludedByRequest)
1088
- return { draftPolicy: "excluded", hint: "includeDrafts:false(groupBy 默认)——已注入 sequenceStatus≠DRAFT;total/桶只计非草稿" };
1121
+ return { draftPolicy: "excluded", hint: numeric ? "includeDrafts:false——已注入 sequenceStatus≠DRAFT;扫描行与桶只计非草稿" : "includeDrafts:false(groupBy 默认)——已注入 sequenceStatus≠DRAFT;total/桶只计非草稿" };
1122
+ if (numeric)
1123
+ return {
1124
+ draftPolicy: "included",
1125
+ hint: `数值指标本地折叠不做默认排除:结果反映平台返回行${hasUserCondition ? "(带条件时平台自身排草稿,r26/r28b)" : ""};要排除草稿显式传 includeDrafts:false`,
1126
+ };
1089
1127
  if (includeDrafts && hasUserCondition)
1090
1128
  return { draftPolicy: "excluded", hint: "带条件计数时平台排除草稿(r26/r28b);includeDrafts:true 无法强制包含" };
1091
1129
  if (hasUserCondition)
@@ -1607,7 +1645,7 @@ export function registerRuntimeDataLane(tools) {
1607
1645
  }));
1608
1646
  tools.push(defineTool({
1609
1647
  name: "data.aggregate",
1610
- search: { intents: ["分组计数", "聚合计数", "计数汇总", "按状态分组", "值域分布", "分组分布", "每类几个", "分桶计数"] },
1648
+ search: { intents: ["分组计数", "聚合计数", "计数汇总", "按状态分组", "值域分布", "分组分布", "每类几个", "分桶计数", "求和", "合计", "总额", "平均值", "最大值", "最小值"] },
1611
1649
  layer: "low",
1612
1650
  kind: "read",
1613
1651
  lane: RUNTIME_LANE,
@@ -1620,16 +1658,36 @@ export function registerRuntimeDataLane(tools) {
1620
1658
  filter: z.union([z.record(z.string(), z.unknown()), z.array(z.record(z.string(), z.unknown()))]).optional().describe('单子句 {op,field,value?}(或子句数组=AND);op 同 data.list(eq/neq/gt/lt/gte/lte/like/in/notin/isnull/isnotnull 等)'),
1621
1659
  filters: z.array(z.record(z.string(), z.unknown())).optional().describe("子句数组=AND"),
1622
1660
  filterGroup: z.record(z.string(), z.unknown()).optional().describe('嵌套组 {op:"and"|"or",clauses:[…]}'),
1623
- metric: z.enum(["count"]).describe("首片仅 count(服务端 totalElements 精确);sum/avg/min/max 第二批"),
1624
- groupBy: z.string().min(1).optional().describe("单列分组:值域可枚举走「值域×count」;不可枚举(自由文本/高基数)退化为本地扫描(cap 1000,截断时 complete:false+capNotice)"),
1625
- topN: z.number().int().min(1).max(20).default(10).describe("分组桶上限,默认 10、上限 20(按 count 降序)"),
1626
- includeDrafts: z.boolean().optional().describe("groupBy 默认 false(注入 sequenceStatus≠DRAFT 统一双口径);count 省略=平台默认(无条件含草稿、带条件排草稿);显式 false 可强制排除——口径看 filter.draftPolicy"),
1661
+ metric: z.enum(["count", "sum", "avg", "min", "max"]).describe("count=服务端 totalElements 精确计数(不读行,不需要 field);sum/avg/min/max=数值列本地折叠(需 field,翻页 cap 1000)。null 行不进聚合,avg 分母=已扫非 null 行数"),
1662
+ field: z.string().min(1).optional().describe("metric≠count 时必填:已发布且 propertyType=2(NUMERICAL)的字段 code。未发布→aggregate-field-unresolved(带 publishedFields/didYouMean);非数值→aggregate-field-not-numerical(计数请用 metric:count)"),
1663
+ groupBy: z.string().min(1).optional().describe("单列分组:count 值域可枚举走「值域×count」,不可枚举降级本地扫描;数值指标一律本地双列扫描(cap 1000,截断时 complete:false+capNotice)"),
1664
+ topN: z.number().int().min(1).max(20).default(10).describe("分组桶上限,默认 10、上限 20(count 按 count 降序;数值指标按 value 降序、并列按 key)"),
1665
+ includeDrafts: z.boolean().optional().describe("count+groupBy 默认 false(注入 sequenceStatus≠DRAFT 统一双口径);数值指标不默认排除(反映平台返回行);count 省略=平台默认(无条件含草稿、带条件排草稿);显式 false 可强制排除——口径看 filter.draftPolicy"),
1627
1666
  capability: capabilityArg,
1628
1667
  },
1629
1668
  handler: async (ctx, args, self) => {
1630
- // groupBy 要统一 base 与各桶的口径,省略时默认排除草稿;count 省略时保留
1631
- // 平台默认(无条件含草稿),只有显式 false 才注入排除条件。
1632
- const excludedByRequest = args.includeDrafts === false || (args.includeDrafts === undefined && args.groupBy !== undefined);
1669
+ const metric = args.metric;
1670
+ const numeric = metric !== "count";
1671
+ // 参数面 fail-closed(零 wire、零写入):metric 与 field 的组合只有两种合法形状。
1672
+ if (metric === "count" && args.field !== undefined)
1673
+ throw new ToolInputError({
1674
+ status: "error",
1675
+ blocker: "invalid-input",
1676
+ tool: "data.aggregate",
1677
+ message: "metric=count 只回 total(服务端 totalElements 精确计数),不接受 field——count 的草稿口径已在 filter.draftPolicy 标注。要按数值列聚合请用 metric:sum/avg/min/max + field",
1678
+ });
1679
+ if (numeric && (args.field === undefined || args.field.trim() === ""))
1680
+ throw new ToolInputError({
1681
+ status: "error",
1682
+ blocker: "invalid-input",
1683
+ tool: "data.aggregate",
1684
+ message: `metric=${metric} 需要 field(已发布且 propertyType=2/NUMERICAL 的字段 code)——不给 field 无法知道聚合哪一列`,
1685
+ nextCommand: `omc call field.list --env <env> --args '{"schemaCode":"${args.schemaCode}","published":true}'`,
1686
+ });
1687
+ // count+groupBy 要统一 base 与各桶的口径,省略时默认排除草稿;count 省略时保留
1688
+ // 平台默认(无条件含草稿),只有显式 false 才注入排除条件。数值指标(本地折叠)
1689
+ // 不做默认注入——结果如实反映平台返回行,要排除须显式 false。
1690
+ const excludedByRequest = args.includeDrafts === false || (args.includeDrafts === undefined && args.groupBy !== undefined && !numeric);
1633
1691
  const includeDrafts = args.includeDrafts === true;
1634
1692
  // 用户条件与草稿注入分开构造:filterGroup 会把 filters 覆盖掉(toQueryCondition
1635
1693
  // 的既有语义),所以草稿条件统一按「level1 AND 追加一组」合并,任何 DSL 形状都不丢。
@@ -1657,10 +1715,11 @@ export function registerRuntimeDataLane(tools) {
1657
1715
  const hasUserCondition = userCondition !== undefined;
1658
1716
  let condition = excludedByRequest ? withAggregateLeaf(userCondition, aggregateLeafGroup("sequenceStatus", 0, "NotEq", "DRAFT")) : userCondition;
1659
1717
  return governedRead(ctx, self, args, async (session) => {
1660
- const draftFilter = aggregateDraftFilter(excludedByRequest, includeDrafts, hasUserCondition);
1718
+ const draftFilter = aggregateDraftFilter(excludedByRequest, includeDrafts, hasUserCondition, numeric);
1661
1719
  let metaCalls = 0;
1662
1720
  let published;
1663
- // field.list 至多一跳:同时服务 filter 的 propertyType 注入与 groupBy 值域解析。
1721
+ // field.list 至多一跳:同时服务 filter 的 propertyType 注入、groupBy 值域解析
1722
+ // 与数值字段的类型校验(数值指标至少 1 次;有 filter 时同一跳兼注入)。
1664
1723
  const fieldMeta = async () => {
1665
1724
  if (published !== undefined)
1666
1725
  return published;
@@ -1672,9 +1731,12 @@ export function registerRuntimeDataLane(tools) {
1672
1731
  const code = String(row.code ?? row.propertyCode ?? "");
1673
1732
  if (!code)
1674
1733
  continue;
1734
+ const rawName = row.name ?? row.propertyName;
1735
+ const name = typeof rawName === "string" && rawName.length > 0 && rawName !== code ? rawName : undefined;
1675
1736
  map.set(code, {
1676
1737
  type: Number(row.propertyType ?? row.type),
1677
1738
  choiceCodes: choiceCodesFromFieldOptions(row, parseOptions(row.options)),
1739
+ ...(name !== undefined ? { name } : {}),
1678
1740
  });
1679
1741
  }
1680
1742
  published = map;
@@ -1684,6 +1746,62 @@ export function registerRuntimeDataLane(tools) {
1684
1746
  }
1685
1747
  return published;
1686
1748
  };
1749
+ const fieldListNext = `omc call field.list --env <env> --args '{"schemaCode":"${args.schemaCode}","published":true}'`;
1750
+ // 数值指标:field 必须已发布且 NUMERICAL(2)——fail closed,不做类型猜测。
1751
+ if (numeric) {
1752
+ const target = args.field;
1753
+ const meta = await fieldMeta();
1754
+ if (meta === null)
1755
+ return {
1756
+ status: "refused",
1757
+ blocker: "aggregate-field-unresolved",
1758
+ reason: "metadata-unavailable",
1759
+ schemaCode: args.schemaCode,
1760
+ field: target,
1761
+ message: `读不到已发布字段元数据(field.list),无法确认 ${target} 是 NUMERICAL(2)——数值聚合不做类型猜测`,
1762
+ nextCommand: fieldListNext,
1763
+ };
1764
+ const targetMeta = meta.get(target);
1765
+ if (targetMeta === undefined) {
1766
+ const catalog = [...meta].map(([code, info]) => ({ code, ...(info.name !== undefined ? { name: info.name } : {}), type: info.type }));
1767
+ const sample = catalog.slice(0, AGGREGATE_FIELD_SAMPLE_LIMIT);
1768
+ const numericCodes = catalog.filter((row) => row.type === 2).map((row) => row.code);
1769
+ // 名字最像但类型不对时改推 NUMERICAL 字段(同 data.list 的数值算子判例)。
1770
+ const suggestion = closestMatch(target, catalog.map((row) => row.code));
1771
+ const numericSuggestion = suggestion !== undefined && meta.get(suggestion)?.type !== 2
1772
+ ? numericCodes.find((code) => closestMatch(target, [code]) === code)
1773
+ : undefined;
1774
+ const didYouMean = numericSuggestion ?? suggestion;
1775
+ return {
1776
+ status: "refused",
1777
+ blocker: "aggregate-field-unresolved",
1778
+ schemaCode: args.schemaCode,
1779
+ field: target,
1780
+ publishedFields: sample,
1781
+ publishedFieldsTotal: catalog.length,
1782
+ ...(didYouMean !== undefined ? { didYouMean: { [target]: didYouMean } } : {}),
1783
+ message: `field 不在已发布元数据里:${target}(数值聚合要用已发布且 propertyType=2 的字段 code,不做猜测)` +
1784
+ (didYouMean !== undefined ? `;是否想写 ${didYouMean}` : "") +
1785
+ (catalog.length === 0 ? ";该模型当前没有已发布字段" : `;已发布字段共 ${catalog.length} 个,code/名称见 publishedFields(仅列前 ${sample.length} 个,其余用 field.list 查)`),
1786
+ nextCommand: fieldListNext,
1787
+ };
1788
+ }
1789
+ if (targetMeta.type !== 2) {
1790
+ const numericFields = [...meta].filter(([, info]) => info.type === 2).map(([code]) => code);
1791
+ return {
1792
+ status: "refused",
1793
+ blocker: "aggregate-field-not-numerical",
1794
+ schemaCode: args.schemaCode,
1795
+ field: target,
1796
+ propertyType: targetMeta.type,
1797
+ ...(numericFields.length > 0 ? { numericFields: numericFields.slice(0, AGGREGATE_FIELD_SAMPLE_LIMIT) } : {}),
1798
+ message: `字段 ${target} 是 ${familyName(targetMeta.type)}(propertyType=${targetMeta.type}),不是 NUMERICAL(2)——sum/avg/min/max 只对数值列有意义;该字段是文本/选项,要条数用 metric:count(只回 total,不需要 field)`,
1799
+ ...(numericFields.length > 0
1800
+ ? { nextCommand: `omc call data.aggregate --env <env> --args '${JSON.stringify({ schemaCode: args.schemaCode, metric, field: numericFields[0] })}'(同模型第一个 NUMERICAL 字段)` }
1801
+ : {}),
1802
+ };
1803
+ }
1804
+ }
1687
1805
  // Only a USER DSL filter needs published metadata; the injected draft
1688
1806
  // leaf (sequenceStatus) has a platform-fixed propertyType.
1689
1807
  if (hasUserCondition) {
@@ -1699,7 +1817,7 @@ export function registerRuntimeDataLane(tools) {
1699
1817
  schemaCode: args.schemaCode,
1700
1818
  missing: injected.missing,
1701
1819
  message: `filter 字段不在已发布元数据里:${injected.missing.join("、")}(聚合复用 data.list 的 propertyType 注入,不做猜测)`,
1702
- nextCommand: `omc call field.list --env <env> --args '{"schemaCode":"${args.schemaCode}","published":true}'`,
1820
+ nextCommand: fieldListNext,
1703
1821
  };
1704
1822
  condition = injected.condition;
1705
1823
  }
@@ -1722,6 +1840,116 @@ export function registerRuntimeDataLane(tools) {
1722
1840
  return extractBizObjectPage(response.data).total;
1723
1841
  };
1724
1842
  const topN = args.topN ?? 10;
1843
+ // 数值指标(sum/avg/min/max):平台无服务端聚合面 → 列投影 + size:200 翻页
1844
+ // 本地折叠至 cap 1000。null 行不进聚合;扫不完就给 complete:false + capNotice,
1845
+ // 绝不按扫描比例外推(与 count 的自由文本路径同一诚实口径)。
1846
+ if (numeric) {
1847
+ const target = args.field;
1848
+ const groupBy = args.groupBy;
1849
+ const emptyAcc = () => ({ count: 0, nonNullCount: 0, sum: 0, min: Number.POSITIVE_INFINITY, max: Number.NEGATIVE_INFINITY });
1850
+ const overall = emptyAcc();
1851
+ const nullBucket = emptyAcc();
1852
+ const buckets = new Map();
1853
+ let rowsScanned = 0;
1854
+ let total = 0;
1855
+ let pages = 0;
1856
+ for (let pageIndex = 0; rowsScanned < AGGREGATE_CAP; pageIndex += 1) {
1857
+ const response = await wireCall(session, { path: ENDPOINTS.runtimeQueryList, method: "POST", body: queryBody(AGGREGATE_PAGE_SIZE, pageIndex) });
1858
+ pages += 1;
1859
+ const pageData = extractBizObjectPage(response.data);
1860
+ if (pages === 1)
1861
+ total = pageData.total;
1862
+ if (pageData.content.length === 0)
1863
+ break;
1864
+ for (const row of pageData.content) {
1865
+ // 平台 query/list 无服务端列投影面:投影在本地做(只读这两列,其余不落内存)。
1866
+ const data = row.data && typeof row.data === "object" ? row.data : row;
1867
+ const value = aggregateNumeric(data[target]);
1868
+ let bucket;
1869
+ if (groupBy !== undefined) {
1870
+ const raw = data[groupBy];
1871
+ if (raw === null || raw === undefined)
1872
+ bucket = nullBucket;
1873
+ else {
1874
+ const key = String(raw);
1875
+ bucket = buckets.get(key);
1876
+ if (bucket === undefined) {
1877
+ bucket = emptyAcc();
1878
+ buckets.set(key, bucket);
1879
+ }
1880
+ }
1881
+ }
1882
+ for (const acc of bucket === undefined ? [overall] : [overall, bucket]) {
1883
+ acc.count += 1;
1884
+ if (value === null)
1885
+ continue;
1886
+ acc.nonNullCount += 1;
1887
+ acc.sum += value;
1888
+ if (value < acc.min)
1889
+ acc.min = value;
1890
+ if (value > acc.max)
1891
+ acc.max = value;
1892
+ }
1893
+ }
1894
+ rowsScanned += pageData.content.length;
1895
+ if (rowsScanned >= total)
1896
+ break;
1897
+ }
1898
+ const complete = rowsScanned >= total;
1899
+ const numericMetric = metric;
1900
+ const scanValue = (acc) => aggregateValue(numericMetric, acc.sum, acc.nonNullCount, acc.min, acc.max);
1901
+ const coverage = {
1902
+ mode: "local-scan",
1903
+ rowsScanned,
1904
+ cap: AGGREGATE_CAP,
1905
+ complete,
1906
+ ...(complete ? {} : { missingCount: Math.max(0, total - rowsScanned) }),
1907
+ };
1908
+ const capNotice = `数值列本地折叠:已扫前 ${rowsScanned}/${total} 行,${metric} 只覆盖已扫部分(complete:false,非全集)。要全集:filters 按日期/业务键 gte/lt 分片重跑,或 page/size 手动翻页。`;
1909
+ const wire = { calls: metaCalls + pages, plan: `1 metadata + ${pages} pages` };
1910
+ if (groupBy === undefined) {
1911
+ const value = scanValue(overall);
1912
+ return {
1913
+ schemaCode: args.schemaCode,
1914
+ metric,
1915
+ field: target,
1916
+ value,
1917
+ count: overall.count,
1918
+ nonNullCount: overall.nonNullCount,
1919
+ nullCount: overall.count - overall.nonNullCount,
1920
+ ...(value === null ? { note: "no numeric values in scanned rows" } : {}),
1921
+ coverage,
1922
+ filter: draftFilter,
1923
+ ...(complete ? {} : { capNotice }),
1924
+ wire,
1925
+ };
1926
+ }
1927
+ // 降序按 value(并列按 key);value:null(整桶无数值)排在最后,不参与排名。
1928
+ const ranked = [...buckets].map(([key, acc]) => ({ key, count: acc.count, nonNullCount: acc.nonNullCount, value: scanValue(acc) })).sort((left, right) => {
1929
+ if (left.value === null || right.value === null) {
1930
+ if (left.value === null && right.value === null)
1931
+ return left.key.localeCompare(right.key);
1932
+ return left.value === null ? 1 : -1;
1933
+ }
1934
+ return right.value - left.value || left.key.localeCompare(right.key);
1935
+ });
1936
+ const shown = ranked.slice(0, topN);
1937
+ return {
1938
+ schemaCode: args.schemaCode,
1939
+ metric,
1940
+ field: target,
1941
+ groupBy,
1942
+ total,
1943
+ buckets: shown,
1944
+ nullBucket: { count: nullBucket.count, nonNullCount: nullBucket.nonNullCount, value: scanValue(nullBucket) },
1945
+ truncatedBuckets: ranked.length > shown.length,
1946
+ bucketsTruncatedCount: ranked.length - shown.length,
1947
+ coverage,
1948
+ filter: draftFilter,
1949
+ ...(complete ? {} : { capNotice }),
1950
+ wire,
1951
+ };
1952
+ }
1725
1953
  // 1) 无 groupBy:service-total 精确计数(1 wire;带用户 filter 时 +1 元数据)。
1726
1954
  if (args.groupBy === undefined) {
1727
1955
  const total = await countAt();
@@ -1812,7 +2040,7 @@ export function registerRuntimeDataLane(tools) {
1812
2040
  }),
1813
2041
  wire: { calls: metaCalls + pages, plan: `${metaCalls > 0 ? "1 metadata + " : ""}${pages} pages` },
1814
2042
  };
1815
- }, { target: `data.aggregate:${JSON.stringify({ schemaCode: args.schemaCode, metric: args.metric, filter: args.filter, filters: args.filters, filterGroup: args.filterGroup, groupBy: args.groupBy, topN: args.topN ?? 10, includeDrafts: args.includeDrafts ?? null })}` });
2043
+ }, { target: `data.aggregate:${JSON.stringify({ schemaCode: args.schemaCode, metric: args.metric, field: args.field, filter: args.filter, filters: args.filters, filterGroup: args.filterGroup, groupBy: args.groupBy, topN: args.topN ?? 10, includeDrafts: args.includeDrafts ?? null })}` });
1816
2044
  },
1817
2045
  }));
1818
2046
  tools.push(defineTool({
@@ -80,6 +80,7 @@ export const WORKFLOW_WIRE = Object.freeze({
80
80
  mutuallyExclusiveBinding: "同一处理器绑定多条规则时它们**全部执行、无互斥**:审批通过/驳回这类互斥结果不要用两条各自 FIXED 赋值都绑 end(bench22 病灶)——通过绑 end(endEventHandler)或规则 Available,驳回绑 cancel(cancelEventHandler)或规则 Cancel,或用一条多分支图(生产 case_info_update 只在 endEventHandler 绑一条 updateData 多分支图);workflow.bindRule 回读在 bizActions.length>1 时给 advisory",
81
81
  participantRoleValidation: "写前参与人校验:PARTICIPANT 的 FindUserByRole(<org>,\"<roleCode>\",\"<order>\") 会与 org.role.list 的真实角色 code 比对;缺失即拒绝 workflow-participant-role-not-found,并给 activityCode/activityName/roleCode、最多 5 个 candidates 与 nextCommand。org.role.list 读取失败时 fail-open,不阻断写入。{Originator} 是发起人关键字,不按角色校验;所有 PARTICIPANT 都是 {Originator} 时给 approval-by-originator warning。",
82
82
  userSearch: "POST /api/api/organization/user/search,@RequestBody {wd (关键字,必填), page, size, filterType?} → PageVO<UserVO>{totalElements,totalPages,content[{id,name,username,userId,departmentId,corpId,status}]}(UserController.search:337-341;缺 wd 报 10005 关键字不能为空)。用于把姓名解析成真实用户,构造参与者对象 type 3=用户(type 2=角色)",
83
+ organizationWrite: "org 写面不变式(1.1.25 真机;tools/list 只留紧凑契约句,案卷在这里):① org.role.create 的 roleGroupId **平台静默接受**——不是真实组 id 时角色变成看不见的孤儿(r70 实测:行在库里、role/users 查得到,role/list 永不返回、role/get 回 50000);优先 roleGroupCode,工具归一成真实 id 并回读可见性。② org.roleGroup.create 的 parentId 必填:根级组传 \"0\"(1.1.25 实测可建根级,path=组名、不挂在既有组下),挂到既有组下传该组 id。③ org.role.addUsers 底层的 add_role_user 收 ouScope 但**忽略它**(1.1.25 实测回读仍为空)——范围必须逐人 update_ouscope 单独写,工具已按序完成。④ org.role.removeUsers 要求 JSON body {roleId,userIds:[...]}:用 query 或 `ids` 报 10009 Required request body is missing(1.1.25 实测)。⑤ org.role.delete 对仍有成员的角色被平台拒绝:`-1 角色下已经包含用户数据!`(1.1.25 实测);force:true 是先逐人移出再删,不是绕过平台校验。⑥ org.user.create 的 dealUserLabel 与 org.user.update 的 modified 对 null 数组直接 NPE(50000,1.1.25 真机)——工具自动补 userLabelIds/userManagerConfigList/roleIds/deptIds 的 []。⑦ org.role.list 的关键字过滤在 CLI 本地做(服务端无关键字面):r9 C2 实测 113 个角色的全量清单 34KB,只为找一个 code,用 search 收窄。",
83
84
  });
84
85
  /** Workflow template object (workflow/update|publish raw body). */
85
86
  export const workflowTemplateArg = z
@@ -118,6 +119,7 @@ export const WORKFLOW_LANE_CONTRACT = Object.freeze({
118
119
  bizObjectResolution: WORKFLOW_WIRE.bizObjectResolution,
119
120
  mutuallyExclusiveBinding: WORKFLOW_WIRE.mutuallyExclusiveBinding,
120
121
  userSearch: WORKFLOW_WIRE.userSearch,
122
+ organizationWrite: WORKFLOW_WIRE.organizationWrite,
121
123
  participantRoleValidation: WORKFLOW_WIRE.participantRoleValidation,
122
124
  }),
123
125
  wireBindings: Object.freeze({
@@ -137,6 +139,7 @@ export const WORKFLOW_LANE_CONTRACT = Object.freeze({
137
139
  bizObjectResolution: Object.freeze([emitterBinding("workflow-support.resolveBizObjectIdByInstance", assertWorkflowContract)]),
138
140
  mutuallyExclusiveBinding: Object.freeze([behaviorBinding("test/issue-14-workflow-bind-rule.test.ts#workflow.bindRule merges endEventHandler", assertWorkflowContract)]),
139
141
  userSearch: Object.freeze([behaviorBinding("test/round4-org-user-search.test.ts#org.user.search resolves a user by name into participant fields", assertWorkflowContract)]),
142
+ organizationWrite: Object.freeze([behaviorBinding("test/organization-write.test.ts#org.role.create resolves a role group CODE to the real id (no orphan role)", assertWorkflowContract)]),
140
143
  participantRoleValidation: Object.freeze([behaviorBinding("test/workflow-participant-role.test.ts#workflow.update refuses an unknown FindUserByRole role before the wire", assertWorkflowContract)]),
141
144
  }),
142
145
  evidence: Object.freeze([
@@ -199,7 +202,7 @@ export const WORKFLOW_LANE_CONTRACT = Object.freeze({
199
202
  }),
200
203
  "org.role.list": Object.freeze({
201
204
  scope: "workflow participant resolution",
202
- description: "列出组织角色(`GET /api/api/organization/role/list`),递归展开角色组,返回 {count, roleCount, groupCount, roles[{id,name,code,roleType,corpId,group,groupId,groupCode,groupName}], groups[{id,name,code,parentId,path,childCount}]}。**`count` 只数角色,不含角色组**——角色组是容器(平台行标记 `group:true`),旧版把空组当角色列出,曾让调用方把「19 个角色组」误读成「目标角色未创建」;`groups[].childCount` 才说明组内是否真的没有角色。`roles[].group` 是组名(兼容旧读法),写角色请用 `groupId`/`groupCode`。用于把审批节点的参与者解析成平台认识的引用。**真实参与者语法**(2026-09-23 生产观察):`participant` 只能是 (a) 关键字 `{Originator}`;(b) 参与者对象数组 JSON `[{\"code\":\"<roleCode>\",\"corpId\":\"<corpId|other>\",\"id\":\"<roleId>\",\"name\":\"<角色名>\",\"type\":2}]`(type 2=角色,3=用户;多个用 `+` 连接);(c) 函数表达式如 `FindUserByRole({Originator.OU},\"<roleCode>\",\"random\")`。**自由文本角色名(如 `部门负责人`)能 publish 但解析不到人、不生成待办**——先用本工具拿到 `code`/`id` 再构造对象数组。",
205
+ description: "列出组织角色(`GET /api/api/organization/role/list`),递归展开角色组,返回 {count, roleCount, groupCount, roles[{id,name,code,roleType,corpId,group,groupId,groupCode,groupName}], groups[{id,name,code,parentId,path,childCount}]}。**`count` 只数角色,不含角色组**——角色组是容器(平台行标记 `group:true`),旧版把空组当角色列出,曾让调用方把「19 个角色组」误读成「目标角色未创建」;`groups[].childCount` 才说明组内是否真的没有角色。`roles[].group` 是组名(兼容旧读法),写角色请用 `groupId`/`groupCode`。用于把审批节点的参与者解析成平台认识的引用。**参与者写法**:`participant` 的三形态(`{Originator}` / 角色对象数组(`type` 2=角色、3=用户) / 函数表达式)与自由文本名不生成待办的陷阱,见 `omc describe workflow.update --example workflow-approval-template-update`。",
203
206
  }),
204
207
  "org.department.list": Object.freeze({
205
208
  scope: "workflow participant resolution",
@@ -3957,7 +3957,7 @@ export function registerWorkflowLane(tools) {
3957
3957
  lane: WORKFLOW_LANE,
3958
3958
  scope: WORKFLOW_TOOLS["org.role.list"].scope,
3959
3959
  description: WORKFLOW_TOOLS["org.role.list"].description,
3960
- inputSchema: { environment: environmentArg, search: z.string().min(1).optional().describe("关键字过滤(CLI 侧,按 code/name 不区分大小写子串)——issue#9 C2:113 角色全量 dump 34KB 只为找一个角色 code 的实测痛点;服务端无关键字面,过滤在本地做"), expandAll: z.boolean().optional().describe("默认 true:展开所有角色组并带回角色。平台的 /role/list 只有 expandAll=true 才填 children(RoleController.list,1.1.25);传 false 只回角色组、roles 恒为空,别据此判断「角色未创建」"), capability: capabilityArg },
3960
+ inputSchema: { environment: environmentArg, search: z.string().min(1).optional().describe("关键字过滤(CLI 侧,按 code/name 不区分大小写子串);服务端无关键字面,过滤在本地做——避免为找一个 code 全量 dump"), expandAll: z.boolean().optional().describe("默认 true:展开所有角色组并带回角色。平台的 /role/list 只有 expandAll=true 才填 children(RoleController.list,1.1.25);传 false 只回角色组、roles 恒为空,别据此判断「角色未创建」"), capability: capabilityArg },
3961
3961
  handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
3962
3962
  // `/role/list` without `expandAll=true` only expands the FIRST group's
3963
3963
  // children (RoleController.list, 1.1.25), so a role created under any
@@ -72,8 +72,8 @@ const READ_SHAPES = {
72
72
  },
73
73
  // r80:计数/分组统计的读回面。notes 只显首条——把陷阱并进第一句。
74
74
  "data.aggregate": {
75
- keys: ["schemaCode", "metric", "groupBy?", "total", "buckets:array<{key,count}>", "nullBucket:{count}", "truncatedBuckets", "bucketsTruncatedCount", "unaccountedCount?", "coverage:{mode,rowsScanned,cap,complete,missingCount?}", "filter:{draftPolicy,hint}", "wire:{calls,plan}", "capNotice?", "environmentFingerprint"],
76
- notes: ["计数用 total(服务端 totalElements,精确);分组是「值域×count」——buckets[].key 是字段存储值/code,null 单列 nullBucket;coverage.complete:false 时只覆盖已扫行,勿外推"],
75
+ keys: ["schemaCode", "metric", "field?", "value?", "count", "nonNullCount?", "nullCount?", "groupBy?", "total", "buckets:array<{key,count,nonNullCount?,value?}>", "nullBucket:{count,nonNullCount?,value?}", "truncatedBuckets", "bucketsTruncatedCount", "unaccountedCount?", "coverage:{mode,rowsScanned,cap,complete,missingCount?}", "filter:{draftPolicy,hint}", "wire:{calls,plan}", "capNotice?", "note?", "environmentFingerprint"],
76
+ notes: ["计数用 total(服务端 totalElements,精确);分组是「值域×count」——buckets[].key 是字段存储值/code,null 单列 nullBucket;数值指标(metric=sum/avg/min/max+field)是本地折叠(cap 1000,null 行不进聚合、avg 分母排除 null),coverage.complete:false 时只覆盖已扫行,勿外推"],
77
77
  },
78
78
  "app.list": {
79
79
  keys: ["applications:array<{code,name,groupId?,modelCount}>", "applicationsCount", "omitted"],
@@ -131,11 +131,13 @@ const READ_SHAPES = {
131
131
  notes: ["与 workflow.get_published 同形(少了 published 键);节点绑定看 activities[].bizActions;templateType=DRAFT;深层字段投影写到叶子,完整模板在 data/detailArtifactId"],
132
132
  },
133
133
  "rule.list": {
134
- keys: ["rules:array<{code,name,enabled,status}>", "modelPresent", "source", "executableHint"],
134
+ keys: ["rules:array<{code,name,enabled,status,ruleVersion,defaultRule,preset,mappings?,mappingsUnavailable?}>", "rulesCount", "modelPresent", "source", "executableHint", "mappingsWireNote?", "schemaCodes?/modelsCount?/models?:array<每模型同单模型回执>/partial?/failed?:array<{schemaCode,code,message}>/absentModels?"],
135
135
  notes: [
136
136
  "入参/他面叫 ruleCode,本面返回 rules[].code",
137
137
  "source=published-list:enabled/status 来自 PUBLISH 投影;可执行性看 rule.get / rule.enable.verified",
138
138
  "modelPresent:false 时未发 list(避免幻影 schema 补建 7 条预置)",
139
+ "withMappings:true 时每行带 mappings[]={nodeCode,serviceCode,serviceMethodCode,inputCount,outputCount}(摘要,正文 inputMappings/outputMappings 用 rule.get);行里读不到图 → mappingsUnavailable:true(≠没有映射)",
140
+ "schemaCodes[] 跨模型清单:models[] 每元素与单模型回执同形(含 modelPresent:false/rulesCount;三句提示抬到顶层 crossModelNotes,逐模型相同不重复),失败汇总在 failed[](partial:true);上限 20 个模型",
139
141
  ],
140
142
  },
141
143
  // r72g(2026-11-17 探针):`rule.references`(在线,仅 businessrule)与
@@ -155,10 +157,10 @@ const READ_SHAPES = {
155
157
  // service.get,分插各自族附近);键集全部来自真机回执采样(非手写发明),
156
158
  // returnsFace 只显 notes[0],高频陷阱并进首条。
157
159
  "rule.get": {
158
- keys: ["status", "id", "absent", "code", "name", "schemaCode", "bizRuleType", "enabled", "executable", "executableBasis", "ruleStatus", "defaultRule", "developmentMode", "ruleVersion", "templateType", "nodes:array<{nodeCode,nodeName,nodeType,nodeCategory?,inputParam?,methodMapping:{schemaCode,serviceCode,serviceMethodCode,inputMappings[],outputMappings[],serviceName,serviceMethodName},serviceType?}>", "routes:array<{preNode,postNode,routeCondition,matchType}>", "schedulerSetting?", "renderCompat", "semanticFindings?", "roundTrip", "nodeDigests?:array<{nodeCode,nodeType,methodMapping:{serviceCode,serviceMethodCode}}>(summary)", "methodMappingCount?(summary)", "bytesOmitted?(summary)", "rules?:array<摘要体>(ruleCodes 批量)", "rulesCount?/requestedCount?/partial?/failed?:array<{code,reason}>(批量)", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
160
+ keys: ["status", "id", "absent", "code", "name", "schemaCode", "bizRuleType", "enabled", "executable", "executableBasis", "ruleStatus", "defaultRule", "developmentMode", "ruleVersion", "templateType", "nodes:array<{nodeCode,nodeName,nodeType,nodeCategory?,inputParam?,methodMapping:{schemaCode,serviceCode,serviceMethodCode,inputMappings[],outputMappings[],serviceName,serviceMethodName},serviceType?}>", "routes:array<{preNode,postNode,routeCondition,matchType}>", "schedulerSetting?", "renderCompat", "semanticFindings?", "roundTrip", "nodeDigests?:array<{nodeCode,nodeType,methodMapping:{serviceCode,serviceMethodCode}}>(summary)", "methodMappingCount?(summary)", "bytesOmitted?(summary)", "rules?:array<摘要体>(ruleCodes 批量)", "rulesCount?/requestedCount?/partial?/failed?:array<{code,reason}>(批量;跨模型 failed 每条带 schemaCode)", "models?:array<{schemaCode,modelPresent,rulesCount,failedCount}>(跨模型)", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
159
161
  notes: [
160
- "绑定方法:默认面看 nodes[].methodMapping.serviceCode/serviceMethodCode(三层深);扫多规则/多模型用 summary:true + ruleCodes[](同 schemaCode,1 次 list/wire 模型)——摘要键是 nodeDigests,不是 nodes(nodes 只在默认面)",
161
- "入参 ruleCode 对应本面返回的 code;enabled 是开关推断,可执行性看 executable/executableBasis;批量面的 failed 是**数组**,所以信封仍是 status:ok + partial:true(不是 partial 状态)",
162
+ "绑定方法:默认面看 nodes[].methodMapping.serviceCode/serviceMethodCode(三层深);扫多规则用 summary:true + ruleCodes[](同 schemaCode,1 次 list),扫多模型再配 schemaCodes[](≤20,逐模型 1 探针 + 1 list)——摘要键是 nodeDigests,不是 nodes(nodes 只在默认面)",
163
+ "入参 ruleCode 对应本面返回的 code;enabled 是开关推断,可执行性看 executable/executableBasis;批量面的 failed 是**数组**,所以信封仍是 status:ok + partial:true(不是 partial 状态);跨模型 failed[] 每条带 schemaCode(模型不存在 → modelPresent:false,不发规则面请求)",
162
164
  ],
163
165
  },
164
166
  "datarule.list": {
package/dist/read.js CHANGED
@@ -148,7 +148,33 @@ function compactReadback(result) {
148
148
  // 变成死代码——`models` 同时在 BULKY_READ_KEYS 里,而那个分支排在最前,于是
149
149
  // 永远只回 `modelsCount:30` + `models:[]`,调用方拿不到任何 schemaCode,被迫
150
150
  // 再花一次 `--jq`/artifact(997 B + 一整轮)。保形分支必须先于折叠分支。
151
- if (CODE_NAME_LIST_KEYS.has(key) && Array.isArray(value)) {
151
+ // r83:rule.list --schemaCodes[] 的 models[] 是**回执对象数组**(元素带
152
+ // modelPresent),不是码表——CODE_NAME_LIST_KEYS 会把它折成字符串数组,
153
+ // 跨模型回执不可用。保形:每元素留 schemaCode/modelPresent/rulesCount/
154
+ // customCount + rules 瘦身行(≤12,同顶层 rules 口径);三句提示已抬到
155
+ // crossModelNotes,不逐模型重复。
156
+ if (key === "models" && Array.isArray(value) && value.length > 0 &&
157
+ typeof value[0] === "object" && value[0] !== null &&
158
+ "modelPresent" in value[0]) {
159
+ compact[key] = value.map((model) => {
160
+ const rules = Array.isArray(model.rules) ? model.rules : [];
161
+ return {
162
+ schemaCode: model.schemaCode ?? null,
163
+ modelPresent: model.modelPresent ?? null,
164
+ rulesCount: typeof model.rulesCount === "number" ? model.rulesCount : rules.length,
165
+ ...(model.customCount !== undefined ? { customCount: model.customCount } : {}),
166
+ rules: rules.slice(0, 12).map((rule) => ({
167
+ code: typeof rule.code === "string" ? rule.code : null,
168
+ name: typeof rule.name === "string" ? rule.name : null,
169
+ ...(rule.enabled !== undefined ? { enabled: rule.enabled } : {}),
170
+ ...(Array.isArray(rule.mappings) ? { mappings: rule.mappings } : {}),
171
+ ...(rule.mappingsUnavailable === true ? { mappingsUnavailable: true } : {}),
172
+ })),
173
+ };
174
+ });
175
+ compact[`${key}Count`] = value.length;
176
+ }
177
+ else if (CODE_NAME_LIST_KEYS.has(key) && Array.isArray(value)) {
152
178
  const pairs = value.map(codeNameOfEntry).filter((entry) => entry !== undefined);
153
179
  // 40 对上限(~1-2KB):更大的清单回退 count+artifact,保冷启动可扫又不失控
154
180
  if (pairs.length <= 40)
@@ -158,6 +184,11 @@ function compactReadback(result) {
158
184
  if (!compact[`${key}Count`])
159
185
  compact[`${key}Count`] = value.length;
160
186
  }
187
+ else if (key === "crossModelNotes" && value !== null && typeof value === "object" && !Array.isArray(value)) {
188
+ // r83:跨模型面抬上来的三句提示(逐模型相同,只存一份)——原样保留,
189
+ // 不被通用对象分支摘要成 {keys}(否则默认面丢教学)。
190
+ compact[key] = value;
191
+ }
161
192
  else if (CODE_LIST_KEYS.has(key) && Array.isArray(value)) {
162
193
  // 2026-11-01 预算批 v2:读门 4096→2048 后,中结果(r38 实测 model.inspect
163
194
  // 17 次 51KB 全部卡旧门下全内联)走 compact——配置清单类数组保形为码表
@@ -181,6 +212,11 @@ function compactReadback(result) {
181
212
  name: typeof rule.name === "string" ? rule.name : null,
182
213
  ...(rule.enabled !== undefined ? { enabled: rule.enabled } : {}),
183
214
  ...(rule.defaultRule !== undefined ? { defaultRule: rule.defaultRule } : {}),
215
+ // r83:rule.list --withMappings 的映射摘要随行保留(否则 >2048B 的
216
+ // 常见 7 条预置规则会「开了 withMappings 却在默认面看不到映射」);
217
+ // 只有显式开启该参数的行才有这个键,其余工具的 rules 不受影响。
218
+ ...(Array.isArray(rule.mappings) ? { mappings: rule.mappings } : {}),
219
+ ...(rule.mappingsUnavailable === true ? { mappingsUnavailable: true } : {}),
184
220
  }));
185
221
  compact[key] = slim;
186
222
  }
@@ -379,7 +379,7 @@ const formulaExpressionSameModel = Object.freeze({
379
379
  const externalLookupModel = Object.freeze({
380
380
  id: "external-lookup-model",
381
381
  title: "外部数据映射模型:接口数据落表 + 关联单选下拉带出(填表时即映射)",
382
- aliases: ["外部数据源", "接口映射模型", "企查查下拉", "关联带出", "映射模型", "外部数据带出"],
382
+ aliases: ["外部数据源", "接口映射模型", "企查查下拉", "关联带出", "映射模型", "外部数据带出", "关联映射", "改关联映射"],
383
383
  status: "requires-prior-readback",
384
384
  tool: "field.create",
385
385
  args: {
@@ -403,6 +403,7 @@ const externalLookupModel = Object.freeze({
403
403
  "**数据段首选(平台标准模式,2026-10-29 playwright 门户实证定案)**:映射模型的 GetList/Load 规则挂 BIZ_ACTION 实时调接口(接口方法配 frontEndExtensionEnable:true)——门户关联控件**打开即触发**前端查询链→GetList 规则→BIZ_ACTION 实时调外部接口(引擎日志 bizBusService.invoke + 外部网关日志双侧铁证)。**验证必须走门户填表;data.list 后端查询不反映此链,别用它判死**(r29 曾据此误判不成立)。配置侧三个收尾点:① WORK_SHEET 字段必须带 relativeCode(仅 options.schemaCode 发布表单会 301015 关联业务模型为空);② GetList 规则的 BIZ_ACTION 入参映射要接前端搜索词(实测未配词时 invoke 参数为空 {});③ 出参→列表行的映射配完候选才回显(未配时弹窗 Total 0 但接口已调)。「下拉框形态(输关键字回车查询)」是表单 attributes 层的控件形态设置,默认弹窗形态。备选(不需要实时时):预置 Create/Update 规则落映射表 / TIMING 定时同步。图内「BIZ_ACTION→CREATE 落表→再查」回环在 1.1.25 不可表达,不要走这条岔路。",
404
404
  "**表单段是平台原生能力**:关联单选指向映射模型后,门户上输入关键字回车即查映射表、选中即 mappings 带出——前台填表时映射自然出现,无需按钮/脚本。",
405
405
  "下拉框形态在 form.draft 控件层配置;映射表要有数据下拉才有选项。",
406
+ "**关联填充映射的事实源是字段行 `options.mappings`**:改表单控件属性里的 mappings 会被平台按字段重算覆盖、回读不生效(真机 2026-10-14 中冶实证)。改映射走 `field.update` 按完整 options 提交(只改 mappings,其余键 queryCode/displayField/schemaCode/conditions… 原值保留)→ `field.publish` → `form.draft`(**rebuild:false**,保留现有布局与已挂在线JS)重存 → `form.publish` → 回读核对。**不要用 field.update 的 cascadeRepublish 刷已带自定义布局/在线JS 的表单**——它会 rebuild 脚手架(rebuild:false 手动链才安全)。",
406
407
  ],
407
408
  priorToolReferences: [
408
409
  { tool: "model.create", args: { environment }, purpose: "建映射模型(字段与接口返回一一对应;mappings 的 source/target 只填裸字段 code,不带模型前缀)" },
@@ -7,9 +7,10 @@ const listViewConfigure = Object.freeze({
7
7
  args: { environment, schemaCode: model, fieldCodes: ["applyNo", "applyAmount", "applyNote"] },
8
8
  preconditions: ["字段已 field.publish(视图与表单脚手架都依赖已发布字段)", "默认视图在 model.create 时由平台自动生成,code = schemaCode"],
9
9
  conditionalRequirements: [
10
- "**省略 `code` 即配置默认视图(code = schemaCode);不要先 listview.create——那会多出一个自定义视图。** 只有确实需要第二个视图时才 listview.create。",
10
+ "**省略 `code` 即配置默认视图(code = schemaCode);不要先 listview.create——那会多出一个自定义视图。** 只有确实需要第二个视图时才 listview.create。案卷:r60a-F13 真机对齐 2026-11-13;r73 #6 真机对齐 2026-11-17;8.6.41 实测默认视图同样可 configure(改默认视图影响所有用户)。",
11
11
  "`fieldCodes` 只列业务字段,可给 propertyCode 或字段显示名;系统列由平台决定。未知引用被拒(listview-columns-unknown-field)。",
12
- "数值列 displayFormat 由字段 0 基 `options.scale` 推导(0=整数,1=1位,2=2位…);本工具会原地修正既有列的 displayFormat。",
12
+ "数值列 displayFormat 由字段 0 基 `options.scale` 推导(0=整数,1=1位,2=2位…;真机:scale 2 → displayFormat 3 = 两位小数);本工具会原地修正既有列的 displayFormat。",
13
+ "**列汇总**:数值列 `sumType` wire 为整数——0=不统计/1=求和/2=平均/3=最小/4=最大/5=计数,写进 `presentation.columnsJson` 的列对象(8.6.26 反编译 SumType 实证)。",
13
14
  "`query/update` 自动 publish=TRUE——视图无草稿/发布两态,无需独立发布步骤。",
14
15
  ],
15
16
  priorToolReferences: [
@@ -218,10 +218,13 @@ export function toolSearchMetaReport(registry) {
218
218
  */
219
219
  const TOOL_PARENTS = Object.freeze({
220
220
  "field.create": ["model"], "field.update": ["model"], "field.delete": ["model"], "field.list": ["model"], "field.publish": ["model"],
221
- "form.publish": ["model"], "form.get": ["model"], "form.draft": ["model"],
221
+ "form.publish": ["model"], "form.get": ["model"], "form.draft": ["model"], "form.list": ["model"],
222
222
  "listview.configure": ["model"], "listview.create": ["model"], "listview.get": ["model"], "listview.list": ["model"], "listview.delete": ["model"],
223
223
  "datarule.create": ["model", "field"], "datarule.update": ["model", "field"], "datarule.list": ["model", "field"], "datarule.delete": ["model", "field"],
224
- "method.create": ["service"], "method.update": ["service"], "method.get": ["service"], "method.delete": ["service"], "method.test": ["service"],
224
+ "method.create": ["service"], "method.update": ["service"], "method.get": ["service"], "method.delete": ["service"], "method.test": ["service"], "method.list": ["service"],
225
+ // r83(R79 二期):data.aggregate 是「模型数据的聚合」——句子里点模型时
226
+ // 与 data.list/data.load 同族给出父对象信号(此前只有 data 段命中)。
227
+ "data.aggregate": ["model"],
225
228
  "org.role.addUsers": ["user"], "org.role.removeUsers": ["user"],
226
229
  });
227
230
  /** 反向约束:句子里出现这些词时,该工具**直接出局**(它不是干这个的)。见 scoreTools 内的一票否决注释。 */