@stalfh233/omc-cli 0.8.19 → 0.8.21

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.
@@ -88,6 +88,50 @@ export function parseStep(raw) {
88
88
  const detail = parseStepDetail(raw);
89
89
  return { name: detail.name, participant: detail.participant };
90
90
  }
91
+ /**
92
+ * 默认查询:读 `org.role.users`(只读)。测试可注入替身(CLI 级嵌套调用无法共享
93
+ * harness 的进程内 session)。
94
+ */
95
+ const roleMemberLookup = async (roleCode, environment, request) => runToolCall("org.role.users", { args: { roleCode, ...(environment ? { environment } : {}) }, requestId: request, environment, print: () => undefined });
96
+ export async function roleMemberChecks(steps, environment, request, lookup = roleMemberLookup, schemaCode = "<schema>",
97
+ /** apply 路径:未给 --env 时 runToolCall 会落到默认环境,仍可预检。dry-run 不碰环境。 */
98
+ probeDefaultEnv = false) {
99
+ const checks = [];
100
+ // 没有 --env 时 dry-run 不访问环境(既有契约);apply 走默认环境仍预检。
101
+ if (environment === undefined && !probeDefaultEnv)
102
+ return checks;
103
+ for (const raw of steps) {
104
+ const detail = parseStepDetail(raw);
105
+ if (detail.kind !== "role")
106
+ continue;
107
+ const outcome = await lookup(detail.code, environment, request);
108
+ const result = (outcome.result ?? {});
109
+ const count = typeof result.count === "number" ? result.count : Array.isArray(result.members) ? result.members.length : undefined;
110
+ if (outcome.exitCode !== 0 || count === undefined) {
111
+ checks.push({
112
+ activity: detail.name,
113
+ kind: "role",
114
+ roleCode: detail.code,
115
+ memberCount: "unknown",
116
+ warning: `@role:${detail.code} 的成员数读取失败(${String(result.blocker ?? result.status ?? "unknown")}):发布后审批人能否解析未知;可用 org.role.users 复核,或改用 名称@user:<userId>。`,
117
+ });
118
+ continue;
119
+ }
120
+ checks.push({
121
+ activity: detail.name,
122
+ kind: "role",
123
+ roleCode: detail.code,
124
+ memberCount: count,
125
+ ...(count === 0
126
+ ? {
127
+ warning: `@role:${detail.code} 当前 0 个成员:FindUserByRole 解析不出审批人——流程可以发布,但没人能审(回执看起来是「已发布=可用」)。改用 名称@user:<userId> 绑定具体审批人(org.user.search / org.role.users 取 id)。`,
128
+ nextCommand: `omc approval-flow --schema ${schemaCode} --steps "${detail.name}@user:<userId>" --env ${environment ?? "<env>"}`,
129
+ }
130
+ : {}),
131
+ });
132
+ }
133
+ return checks;
134
+ }
91
135
  /**
92
136
  * F11(0.8.7 探针 B):dry-run 回执里 user 参与者的 `corpId:"other"` 是 **CLI
93
137
  * 自己**为 `--steps 名称@user:<id>` 生成的占位(见 parseStepDetail),不是平台
@@ -219,6 +263,7 @@ export async function cmdApprovalFlow(args) {
219
263
  "workflow.permissions 只设谁能发起,不是行级可见范围(行级数据权限当前工具面不支持)。";
220
264
  if (!apply) {
221
265
  const compiledParticipantNotes = participantNotes(steps, environment);
266
+ const roleChecks = await roleMemberChecks(steps, environment, request, roleMemberLookup, schema);
222
267
  writeEnvelope(envelope("ok", {
223
268
  // 等同于 `omc call` 契约:结果顶层必须有 status。预览未写环境 → dry-run
224
269
  // (与 model-scaffold/field-add 的预览口径一致),信封仍是 ok/exit 0。
@@ -229,6 +274,7 @@ export async function cmdApprovalFlow(args) {
229
274
  dryRun: true,
230
275
  crossAccountApproval,
231
276
  ...(compiledParticipantNotes.length > 0 ? { participantNotes: compiledParticipantNotes } : {}),
277
+ ...(roleChecks.length > 0 ? { participantChecks: roleChecks } : {}),
232
278
  linearOnly: true,
233
279
  rowLevelDataPermission: "unsupported",
234
280
  note: `dry-run 仅编译预览;--apply 执行 workflow.create(无流程时)→update(模板+字段权限)→publish。边界:非发起人身份的审批无法在单会话 CLI 内推进(单 token);若要验跨账号审批,用第二账号另建环境,或把参与人设为 {Originator}。${linearOnlyNote}`,
@@ -287,13 +333,25 @@ export async function cmdApprovalFlow(args) {
287
333
  return updateOutcome.exitCode;
288
334
  }
289
335
  // 4) publish
336
+ const roleChecks = await roleMemberChecks(steps, environment, request, roleMemberLookup, schema, true);
290
337
  const publishOutcome = await runToolCall("workflow.publish", { args: { schemaCode: schema, code: compiled.workflowCode, ...(environment ? { environment } : {}) }, requestId: request, environment, print: () => undefined });
291
338
  const classified = classifyResult(publishOutcome.result);
292
339
  // 与 `omc call` 一致:结果顶层带生产者 status(成功 ok / 被拒 refused / 部分
293
340
  // partial…),publish 的原始回执继续留在 publish 下。ok 与 status 因此不会
294
341
  // 出现「ok:false + status:ok」。
295
342
  const publishStatus = String(publishOutcome.result?.status ?? "ok");
296
- writeEnvelope(envelope(classified.status, { status: publishStatus, schemaCode: schema, workflowCode: compiled.workflowCode, steps: steps.length, ...(originatorName !== undefined ? { originatorName, originatorNameNote: ORIGINATOR_NAME_NOTE } : {}), crossAccountApproval, ...preexistingSection, publish: publishOutcome.result }, request, classified.error));
343
+ writeEnvelope(envelope(classified.status, {
344
+ status: publishStatus,
345
+ schemaCode: schema,
346
+ workflowCode: compiled.workflowCode,
347
+ steps: steps.length,
348
+ // 探针 O F7(0.8.21):apply 回执直接给本次提交的节点显示名,并给一条读回命令;
349
+ // 显示名是否被平台改写以 workflow.get_published 为准(不在写回执里假装已验)。
350
+ activities: compiled.activities.map((activity) => ({ code: activity.activityCode, name: activity.activityName, type: activity.activityType })),
351
+ activityNamesNote: `name 是本次提交的编译值;apply 后以 workflow.get_published 的 activities[].name 为准(平台可能把发起节点钉回首建名${originatorName !== undefined ? ",见 originatorNameNote" : ""})。`,
352
+ verifyCommand: `omc call workflow.get_published --env ${environment ?? "<env>"} --args '${JSON.stringify({ schemaCode: schema, workflowCode: compiled.workflowCode })}'`,
353
+ ...(originatorName !== undefined ? { originatorName, originatorNameNote: ORIGINATOR_NAME_NOTE } : {}), ...(roleChecks.length > 0 ? { participantChecks: roleChecks } : {}), crossAccountApproval, ...preexistingSection, publish: publishOutcome.result
354
+ }, request, classified.error));
297
355
  if (publishOutcome.exitCode === 0)
298
356
  process.stderr.write("[omc] 前台生效验证清单:1) 造一条数据提交走流程;2) 每级审批人在门户有待办(角色用 FindUserByRole 需审批人挂在发起人同部门,否则 PENDING 不来);3) 审批节点字段只读(不可改单);4) 驳回退发起人核对;5) 设计器打开流程确认节点链显示正常。边界:非发起人身份的审批无法在单会话 CLI 内推进(单 token);跨账号请另建环境或把参与人设为 {Originator}。\n");
299
357
  return publishOutcome.exitCode;
@@ -899,7 +899,10 @@ export function buildFieldOptions(args) {
899
899
  refuseFieldOptions("selection field options carry no optionsSet source", `rejected: ${choiceError}`);
900
900
  }
901
901
  normalizeBusinessModelOrderBy(explicit);
902
- return normalizeMappingsOption(explicit).options;
902
+ // `mappingsRaw` 是读面元数据(平台存储原文);读回→写回的 round-trip 不能把它
903
+ // 带上平台(fieldOptionsArg 是 passthrough,不 strip 会被原样上行)。
904
+ const { mappingsRaw: _readOnlyMappingsRaw, ...writeOptions } = explicit;
905
+ return normalizeMappingsOption(writeOptions).options;
903
906
  }
904
907
  const choices = args.choices;
905
908
  if (Array.isArray(choices) && choices.length > 0) {
@@ -1114,12 +1114,22 @@ function dataruleHintFor(goal) {
1114
1114
  const codes = [...new Set(goal.match(GRAPH_OBJECT_RE) ?? [])];
1115
1115
  const schemaCode = codes.length === 1 ? codes[0] : "<schemaCode>";
1116
1116
  const firstCommand = `omc call datarule.list --args '{"schemaCode":"${schemaCode}"}'`;
1117
+ // 计算/汇总类词优先:`金额大于0时自动计算汇总` 是 type2,不是提交校验;
1118
+ // 只有「计算词缺席 + 校验词/阈值词在场」才判校验(阈值词本身两类都常见)。
1119
+ const computeAsk = /(计算|汇总|求和|赋值|公式|联动|自动填|带出|算总|平均|占比|合计)/.test(goal);
1120
+ const validateAsk = /(校验|必填|重复|正则|长度|不早于|不晚于|不能|不得)/.test(goal);
1121
+ const comparisonAsk = /(大于|小于|超过|低于|>=?|<=?)/.test(goal);
1122
+ const validationAsk = !computeAsk && (validateAsk || comparisonAsk);
1117
1123
  return {
1118
1124
  why: codes.length === 1 ? `问到「${codes[0]}」的数据规则` : "问到数据规则(未给出唯一 schemaCode)",
1119
1125
  firstCommand,
1120
1126
  commands: [
1121
1127
  `${firstCommand} # 只读:该模型全部数据规则(type/字段/条件/启用状态)`,
1122
- `omc describe datarule.create --example field-compute-rule # 字段计算/赋值/校验的创建形状`,
1128
+ // 探针 O F13(0.8.21):校验类需求(金额>0/必填/重复…)给 type1 示例;
1129
+ // 计算/赋值才给 type2——原先一律给 field-compute-rule,方向反了。
1130
+ validationAsk
1131
+ ? `omc describe datarule.create --example submit-field-vs-constant # 提交校验(type1+checkType2)的创建形状`
1132
+ : `omc describe datarule.create --example field-compute-rule # 字段计算/赋值(type2)的创建形状`,
1123
1133
  ],
1124
1134
  note: "数据规则按字段/记录条件触发,与业务规则(rule)和流程绑定是不同面;入口是 datarule.list(只读),写入走 datarule.create/update/delete。",
1125
1135
  };
@@ -1032,6 +1032,11 @@ export function registerDataRuleLane(tools) {
1032
1032
  // 提交管线执行,REST 不拦。先告知执行面,省掉「先实测两轮才发现不生效」。
1033
1033
  ...(args.dataRuleType === 1
1034
1034
  ? {
1035
+ // 探针 N F7(0.8.20):DELIVERED 只代表配置写成功;执行面给结构键,
1036
+ // 别让调用方从文字推断「已生效」。
1037
+ runtimeScope: args.checkType === 5 ? "server" : args.checkType !== undefined ? "portal-only" : "unknown",
1038
+ // 缺 checkType 时执行面未知:不要假装 enforcedServerSide:false。
1039
+ ...(args.checkType !== undefined ? { enforcedServerSide: args.checkType === 5 } : {}),
1035
1040
  executionWarning: dataRuleExecutionWarning(args.checkType),
1036
1041
  // P1(探针 H F3,复核 2026-11-27):声明 validateHiddenProperties
1037
1042
  // 的行**不抑制**提示——该键 2.1.5 独有,8.6.26/8.7 不执行;只按
@@ -1125,7 +1130,22 @@ export function registerDataRuleLane(tools) {
1125
1130
  const proof = dataRuleChanges(beforeDecoded, afterDecoded);
1126
1131
  return {
1127
1132
  performed: { errcode: performed.errcode },
1128
- readback: { id, present: true, before: beforeDecoded, after: afterDecoded, changedFields: proof.changedFields, unexpectedChanges: proof.unexpectedChanges, rule: afterDecoded },
1133
+ readback: {
1134
+ id, present: true, before: beforeDecoded, after: afterDecoded, changedFields: proof.changedFields, unexpectedChanges: proof.unexpectedChanges, rule: afterDecoded,
1135
+ // 探针 N F7 复核:update 与 create 同一执行面口径(改了 checkType 也能读到)。
1136
+ ...(args.dataRuleType === 1
1137
+ ? (() => {
1138
+ // 参数缺省时平台保留存量 checkType(fullDataRuleBody),执行面按**生效值**报。
1139
+ const storedCheckType = typeof afterDecoded.checkType === "number" ? afterDecoded.checkType : undefined;
1140
+ const effectiveCheckType = args.checkType ?? storedCheckType;
1141
+ return {
1142
+ runtimeScope: effectiveCheckType === 5 ? "server" : effectiveCheckType !== undefined ? "portal-only" : "unknown",
1143
+ ...(effectiveCheckType !== undefined ? { enforcedServerSide: effectiveCheckType === 5 } : {}),
1144
+ executionWarning: dataRuleExecutionWarning(effectiveCheckType),
1145
+ };
1146
+ })()
1147
+ : {}),
1148
+ },
1129
1149
  };
1130
1150
  },
1131
1151
  preflight: (args) => {
@@ -367,7 +367,24 @@ function fieldRollbackSpec(toolName) {
367
367
  }
368
368
  /** Parse a raw options JSON string for readback; policy: non-strings and unparseable strings pass through verbatim. */
369
369
  function parseFieldOptionsForReadback(options) {
370
- return decodeJsonColumn(options, JSON_COLUMN_PASSTHROUGH);
370
+ const decoded = decodeJsonColumn(options, JSON_COLUMN_PASSTHROUGH);
371
+ if (decoded === null || typeof decoded !== "object" || Array.isArray(decoded))
372
+ return decoded;
373
+ // 探针 N F2(0.8.20):写面收数组、平台存 JSON 字符串;读面把 mappings 解回数组,
374
+ // 否则「写入 == 读回」的深比较会误判。解不开就保留原值(不猜、不丢)。
375
+ const record = decoded;
376
+ const raw = record.mappings;
377
+ if (typeof raw !== "string" || raw.trim() === "")
378
+ return decoded;
379
+ try {
380
+ const parsed = JSON.parse(raw);
381
+ // 数组给「写入同形」,原文留在 mappingsRaw:平台存储形态仍是 JSON 字符串,
382
+ // 读面两者都不丢(探针 N F2;A1 的存储形态断言改读 mappingsRaw)。
383
+ return Array.isArray(parsed) ? { ...record, mappings: parsed, mappingsRaw: raw } : decoded;
384
+ }
385
+ catch {
386
+ return decoded;
387
+ }
371
388
  }
372
389
  /**
373
390
  * 探针 D F9(0.8.9):字段行 `options.mappings` 存在 = 关联填充配置。
@@ -1863,7 +1880,32 @@ async function runFieldUpdate(session, args) {
1863
1880
  // options are the form-interaction contract (ADR 0005), so read them back.
1864
1881
  const storedOptions = after !== undefined ? parseFieldOptionsForReadback(after.options) : undefined;
1865
1882
  if (args.options !== undefined && storedOptions && typeof storedOptions === "object" && !Array.isArray(storedOptions)) {
1866
- const missed = Object.keys(args.options).filter((key) => !same(storedOptions[key] ?? null, prepared.options[key] ?? null));
1883
+ // 探针 N F2 复核(P1):读面把 mappings 解成数组,写面归一化后是紧凑 JSON 字符串;
1884
+ // 直接 same() 恒不等,会让「改 name + 原样回传 mappings」被假拒(且写入已发生)。
1885
+ // mappings 两侧都先解成结构化值再比;其它键保持严格等值。
1886
+ const parseMappings = (value) => {
1887
+ if (typeof value !== "string")
1888
+ return value;
1889
+ try {
1890
+ return JSON.parse(value);
1891
+ }
1892
+ catch {
1893
+ return value;
1894
+ }
1895
+ };
1896
+ const storedValueFor = (key) => {
1897
+ const stored = storedOptions[key] ?? null;
1898
+ return key === "mappings" ? parseMappings(stored) : stored;
1899
+ };
1900
+ const writtenValueFor = (key) => {
1901
+ const written = prepared.options[key] ?? null;
1902
+ return key === "mappings" ? parseMappings(written) : written;
1903
+ };
1904
+ // 只读元数据(mappingsRaw)不参与「是否落地」判定:它是读面派生的,写面会剥离,
1905
+ // 否则读回→改→写会被假拒(写已发生却回 field-options-immutable)。
1906
+ const missed = Object.keys(args.options)
1907
+ .filter((key) => key !== "mappingsRaw")
1908
+ .filter((key) => !same(storedValueFor(key), writtenValueFor(key)));
1867
1909
  if (missed.length > 0) {
1868
1910
  throw new ToolRefusalError({
1869
1911
  status: "refused",
@@ -81,6 +81,43 @@ export function parseControlCodes(face) {
81
81
  return [];
82
82
  }
83
83
  }
84
+ /**
85
+ * 探针 N F5(0.8.20):子表列在 attributes 里的位置是**控件顶层 `columns`**,
86
+ * 不是 `options.columns`(平台 BizForm 属性行)。写入用 `childColumns` 参数、
87
+ * 读回却是另一条路径——给一个结构化 locator,省掉三次 jq 探测。
88
+ */
89
+ function childColumnLocatorOf(face, faceName) {
90
+ if (typeof face !== "string" || face.trim() === "")
91
+ return undefined;
92
+ let parsed;
93
+ try {
94
+ parsed = JSON.parse(face);
95
+ }
96
+ catch {
97
+ return undefined;
98
+ }
99
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
100
+ return undefined;
101
+ const children = [];
102
+ for (const [code, value] of Object.entries(parsed)) {
103
+ if (value === null || typeof value !== "object" || Array.isArray(value))
104
+ continue;
105
+ // 只认子表控件(BizFormPropertyType.Sheet = 201);容器/Tab(499/500)用 children。
106
+ if (Number(value.type) !== 201)
107
+ continue;
108
+ const columns = value.columns;
109
+ if (!Array.isArray(columns) || columns.length === 0)
110
+ continue;
111
+ const columnCodes = columns
112
+ .map((column) => (column !== null && typeof column === "object" ? String(column.key ?? "") : ""))
113
+ .filter((key) => key.length > 0);
114
+ if (columnCodes.length > 0)
115
+ children.push({ code, columnCodes });
116
+ }
117
+ return children.length > 0
118
+ ? { path: `${faceName}[<childCode>].columns(不是 options.columns)`, children: children.slice(0, 10) }
119
+ : undefined;
120
+ }
84
121
  /**
85
122
  * issue 04:`publishedActionsJson` 是真实的 bizsheet 列(ticket 100),默认面
86
123
  * 此前整列不可见 ⇒ 读成「没有表单按钮动作」。默认面只给计数 + 编码(不给正文);
@@ -189,6 +226,9 @@ export function registerFormLane(tools) {
189
226
  // B5-2(真机 2.1.5):inSync 必须比**四对**面(view/attributes/html/actions,
190
227
  // 平台 AppIntegrationFacadeImpl:2670 同口径);只比 view 时「草稿改了字段标签」
191
228
  // 会误判成 published。比较用规范化语义等值,见 compareFormFaces。
229
+ // F5(0.8.20):子表列 locator(发布面优先,草稿面兜底)。
230
+ const childColumnLocator = childColumnLocatorOf(sheet.publishedAttributesJson, "publishedAttributesJson")
231
+ ?? childColumnLocatorOf(sheet.draftAttributesJson, "draftAttributesJson");
192
232
  const faceSync = compareFormFaces(sheet, { draftPresent, publishedPresent });
193
233
  const faceVerdict = resolveEffectiveFormFace({
194
234
  draftPresent,
@@ -215,6 +255,7 @@ export function registerFormLane(tools) {
215
255
  inSync: faceSync.inSync,
216
256
  ...(faceSync.inSync === false ? { differingFaces: faceSync.differingFaces } : {}),
217
257
  },
258
+ ...(childColumnLocator !== undefined ? { childColumnLocator } : {}),
218
259
  ...(flagMismatch
219
260
  ? {
220
261
  flagMismatch: true,
@@ -340,7 +381,7 @@ export function registerFormLane(tools) {
340
381
  compact: (result) => {
341
382
  // 探针 L F7:platformFlags 只有两个布尔,compact 若不保留会被压成
342
383
  // `platformFlagsCount:2`,平台原文恰好在降载时丢失。
343
- const KEEP = new Set(["draftControls", "publishedControls", "customButtonJson", "options", "formButtons", "formButtonCodes", "platformFlags"]);
384
+ const KEEP = new Set(["draftControls", "publishedControls", "customButtonJson", "options", "formButtons", "formButtonCodes", "platformFlags", "childColumnLocator"]);
344
385
  // r28e F4 暴露的潜在 bug:handler 已经交过 `*Codes`/`*Count`/`*Omitted`
345
386
  // 这类**已压缩**的键,若再走数组分支会被二次加后缀
346
387
  // (`publishedControlCodes` → `publishedControlCodesCodes`),字段直接消失。
@@ -1273,6 +1273,12 @@ export function registerListViewLane(tools) {
1273
1273
  "视图条件的运行时过滤语义未取证:REST `data.list --queryCode <本视图>` 实测不应用固定条件(r35:读回 Gte/5000 正确、返回未过滤 4 条)。别用 queryCode 断言过滤生效;REST 侧过滤用 `data.list` 显式 `filter`。";
1274
1274
  if (conditions.length > 0)
1275
1275
  readback.viewConditionsAppliedRest = false;
1276
+ // 探针 N F8(0.8.20):配置写成功 ≠ 运行面已验证。结构键与 viewConditionsAppliedRest
1277
+ // 同层(writeTool 只透传 readback),别只埋在 conditionVerification 的文字里。
1278
+ if (conditions.length > 0) {
1279
+ readback.acceptance = "config-only";
1280
+ readback.runtimeVerified = false;
1281
+ }
1276
1282
  // F6(0.8.16 探针 J):conditionRuntimeNote 只说「不行」,探针要一个可执行
1277
1283
  // 的验收入口。配置面验收 = listview.get 回读 conditions(propertyCode/
1278
1284
  // filterType/defaultValue);运行时面没有 REST 验证入口(固定条件只在门户
@@ -2609,7 +2609,21 @@ export function registerRuntimeDataLane(tools) {
2609
2609
  // 口径 = 行级证据(items[].unprojected 的跨行并集)。模型目录点名
2610
2610
  // (projectionWarning.unprojected)只进 warning.hint,不计入本数——
2611
2611
  // 否则人类行会指向该场景里并不存在的 `items[].unprojected`。
2612
- ...(unprojectedCodes.length > 0 ? { unprojectedFieldCount: unprojectedCodes.length } : {}),
2612
+ // 探针 N F6(0.8.20):顶层给 rowsProjected + 点名,别让调用方把
2613
+ // data.list 当「全字段」对照(行级 unprojected 是设计行为)。
2614
+ // 只在**小行集**(≤10 行,读门保证内联)加这个旗标:大行集会外置,
2615
+ // `unprojected` 已随 artifact/行级给出;给 25 行的临界载荷再加键会把它
2616
+ // 顶过 2048B 读门,反而让 items 外置(w53 F5 的回归)。
2617
+ ...(unprojectedCodes.length > 0 && items.length <= 10
2618
+ ? { rowsProjected: true, unprojectedFieldCount: unprojectedCodes.length }
2619
+ : {}),
2620
+ // 探针 O F5(0.8.21,P1):`full:true` 只展开行/子表载荷,**不改变**
2621
+ // 列表的视图列投影;未投影列仍不在 items[].fields(不是值为空)。
2622
+ ...(args.full === true && unprojectedCodes.length > 0
2623
+ ? {
2624
+ fullProjectionNote: `full:true 只展开行/子表载荷,不改变列表的视图列投影:未投影列(${unprojectedCodes.slice(0, 10).join("、")})不会出现在 items[].fields,不代表未落库。整行真值用 data.load {schemaCode,bizObjectId}(路径见 items[].id)。`,
2625
+ }
2626
+ : {}),
2613
2627
  ...(projectionMissAll.length > 0 ? { projectionMiss: projectionMissAll } : {}),
2614
2628
  ...(columnsNotProjected.length > 0 ? { columnsNotProjected } : {}),
2615
2629
  ...(columnsOutsideView.length > 0 ? { columnsOutsideView, columnsNarrowingOnly: true, columnsNote: DATA_LIST_COLUMNS_NARROWING_NOTE } : {}),
@@ -2821,7 +2835,15 @@ export function registerRuntimeDataLane(tools) {
2821
2835
  ...(projectionHintPaged !== undefined ? { projectionHint: projectionHintPaged } : {}),
2822
2836
  ...(anyNullField ? { nullSemantics: DATA_LIST_NULL_SEMANTICS } : {}),
2823
2837
  // 同 all 路径:只数行级证据,模型目录点名留在 warning.hint。
2824
- ...(unprojectedCodes.length > 0 ? { unprojectedFieldCount: unprojectedCodes.length } : {}),
2838
+ // 同 all 路径:小行集才加旗标(临界载荷不再多付字节)。
2839
+ ...(unprojectedCodes.length > 0 && items.length <= 10
2840
+ ? { rowsProjected: true, unprojectedFieldCount: unprojectedCodes.length }
2841
+ : {}),
2842
+ ...(args.full === true && unprojectedCodes.length > 0
2843
+ ? {
2844
+ fullProjectionNote: `full:true 只展开行/子表载荷,不改变列表的视图列投影:未投影列(${unprojectedCodes.slice(0, 10).join("、")})不会出现在 items[].fields,不代表未落库。整行真值用 data.load {schemaCode,bizObjectId}(路径见 items[].id)。`,
2845
+ }
2846
+ : {}),
2825
2847
  ...(projectionMissPaged.length > 0 ? { projectionMiss: projectionMissPaged } : {}),
2826
2848
  ...(columnsNotProjected.length > 0 ? { columnsNotProjected } : {}),
2827
2849
  ...(columnsOutsideView.length > 0 ? { columnsOutsideView, columnsNarrowingOnly: true, columnsNote: DATA_LIST_COLUMNS_NARROWING_NOTE } : {}),
@@ -3971,7 +3971,7 @@ export function registerWorkflowLane(tools) {
3971
3971
  code,
3972
3972
  name,
3973
3973
  ...(fieldCodes.length > 0 ? { fieldCodes } : {}),
3974
- action: "移除指向本流程的 add 绑定(其余动作原样保留)",
3974
+ action: "移除指向本流程的 add 动作(add 的语义就是发起本流程,整条会消失,不是只删关联);其余动作原样保留。需要恢复新增按钮时用 listview.configure {actions:[], defaultActions:true} 重建(defaultActions 需要 actions 意图才生效)。",
3975
3975
  })),
3976
3976
  }
3977
3977
  : {}),
@@ -634,7 +634,17 @@ export async function executePurge(plan, session, call) {
634
634
  ...(plan.unbindReferences === true
635
635
  ? { unbindReferences: true }
636
636
  : autoUnbindSelfReferences
637
- ? { autoUnbindSelfReferences: true }
637
+ ? {
638
+ autoUnbindSelfReferences: true,
639
+ // 探针 N F9(0.8.20):自引用列被删是不可恢复的破坏性动作,回执里要有
640
+ // 结构标记;但解绑中途失败时不得宣称「列已删除」——只在全部步骤成功后给。
641
+ ...(unbindOutcome !== undefined && unbindOutcome.failed !== true
642
+ ? {
643
+ destructive: true,
644
+ destructiveNote: "自引用子表列已被删除并重新发布(列数据不可恢复)。跨模型引用仍需显式 --unbind-references;自引用为一条命令清场默认自动拆——先跑 dry-run 看 warnings/步骤再用 --apply。",
645
+ }
646
+ : {}),
647
+ }
638
648
  : {}),
639
649
  ...(unbindOutcome !== undefined ? { unboundSteps: unbindOutcome.executed, unbindFailed: unbindOutcome.failed } : {}),
640
650
  deletedInstances: steps.filter((step) => step.step.startsWith("workflow.delete_instance:") && step.status === "ok").length,
@@ -51,7 +51,20 @@ export function validateScaffoldFields(fields) {
51
51
  walk(fields, "fields");
52
52
  return problems;
53
53
  }
54
- /** The child-table columns of a field, from either spelling. */
54
+ /**
55
+ * 0.8.20(探针 N F1):`publishedFields` 曾放「发布动作次数」(常=1),与字段数
56
+ * 量级不符。现在按名字给**模型当前已发布业务字段数**(发布是模型级一次提交);
57
+ * 动作次数只在 `publishActions`,本次新建并随发布覆盖的字段数在
58
+ * `fieldsPublishedEstimate`。精确清单仍以 `field.list --published` 为准。
59
+ */
60
+ export function scaffoldPublishCounts(publishActions, fieldCount, createdFieldCount, publishBlocked) {
61
+ // `field.publish` 是**模型级**一次提交:没有被拦时,模型当前业务字段全部在发布面
62
+ // (幂等重跑时本次新建 0 个,但既有字段仍是已发布态 → 不能回 0)。
63
+ const publishedFields = publishBlocked ? 0 : fieldCount;
64
+ const fieldsPublishedEstimate = publishBlocked ? 0 : createdFieldCount;
65
+ return { publishActions, publishedFields, fieldsPublishedEstimate };
66
+ }
67
+ /** The child-table columns of a field (top-level `subFields[]`). */
55
68
  export function scaffoldChildrenOf(field) {
56
69
  const raw = field.subFields ?? field.childFields;
57
70
  return Array.isArray(raw) ? raw : [];
@@ -367,9 +380,11 @@ export async function cmdModelScaffold(args) {
367
380
  // 以「本次真的写入」为准,不再把 attach 一起建出的子列记成 skipped。
368
381
  const fieldCount = fields.length + childColumnCount;
369
382
  const publishActions = publishFieldSteps.filter((step) => step.status === "ok").length;
370
- // r28g F5:旧键 publishedFields 实际是「发布动作次数/目标 schema 数」(常=1),
371
- // 与 fieldCount 量级不符。保留旧键作兼容别名,同时给 publishActions + 字段计数。
372
- const fieldsPublishedEstimate = publishingBlocked || fieldPublishFailed ? 0 : createdFieldCount;
383
+ // r28g F5:旧键 publishedFields 曾是「发布动作次数/目标 schema 数」(常=1),
384
+ // 与 fieldCount 量级不符。0.8.20(探针 N F1):把 publishedFields 改成**字段数**
385
+ // 语义(=fieldsPublishedEstimate),发布动作次数保留在 publishActions;精确清单
386
+ // 仍以 field.list --published 为准。
387
+ const publishCounts = scaffoldPublishCounts(publishActions, fieldCount, createdFieldCount, publishingBlocked || fieldPublishFailed);
373
388
  const result = {
374
389
  status,
375
390
  model: code,
@@ -385,12 +400,10 @@ export async function cmdModelScaffold(args) {
385
400
  created: createdFieldCount,
386
401
  skipped: alreadyPresentFieldCount,
387
402
  failed: failedFields.length,
388
- publishActions,
389
- publishedFields: publishActions,
390
- fieldsPublishedEstimate,
391
- publishNote: publishActions > 0
392
- ? `已执行 ${publishActions} 次模型级 field.publish(覆盖本次创建的约 ${fieldsPublishedEstimate}/${fieldCount} 个字段;精确清单用 field.list --published)`
393
- : "未发布字段(有失败或被跳过);精确状态用 field.list",
403
+ ...publishCounts,
404
+ publishNote: publishingBlocked || fieldPublishFailed
405
+ ? "未发布字段(有失败或被跳过);精确状态用 field.list"
406
+ : `已执行 ${publishActions} 次模型级 field.publish(本次新建 ${publishCounts.fieldsPublishedEstimate} 个字段随发布覆盖;模型当前业务字段 ${fieldCount} 个都在发布面;精确清单用 field.list --published)`,
394
407
  ...(failedFields.length > 0 ? { failedFields } : {}),
395
408
  ...(failedSteps.length > 0 ? { failedSteps } : {}),
396
409
  ...(lastSummaries.length > 0 ? { summaries: lastSummaries } : {}),
package/dist/plan.js CHANGED
@@ -62,8 +62,29 @@ function summarizedArgs(tool, args) {
62
62
  else if (Array.isArray(value) || (value && typeof value === "object") || typeof value === "string") {
63
63
  summary[`${key}Summary`] = summarizeValue(value);
64
64
  const preview = smallStringPreview(value);
65
- if (preview !== undefined)
65
+ if (preview !== undefined) {
66
+ // 探针 O F4(0.8.21):关联映射的方向是「写反即配置错」的核心,dry-run 的
67
+ // optionsPreview 必须能自查 source→target(原先只给 sha256 + 标量键)。
68
+ if (key === "options" && value !== null && typeof value === "object" && !Array.isArray(value)) {
69
+ const rawMappings = value.mappings;
70
+ let mappings = rawMappings;
71
+ if (typeof rawMappings === "string" && rawMappings.trim() !== "") {
72
+ try {
73
+ mappings = JSON.parse(rawMappings);
74
+ }
75
+ catch {
76
+ mappings = undefined;
77
+ }
78
+ }
79
+ if (Array.isArray(mappings) && mappings.length > 0) {
80
+ const pairs = mappings.slice(0, 5).map((entry) => entry !== null && typeof entry === "object"
81
+ ? `${String(entry.source ?? "?")}→${String(entry.target ?? "?")}`
82
+ : String(entry));
83
+ preview.mappings = mappings.length > pairs.length ? `${pairs.join(", ")} …(共 ${mappings.length} 对)` : pairs.join(", ");
84
+ }
85
+ }
66
86
  summary[`${key}Preview`] = preview;
87
+ }
67
88
  }
68
89
  else {
69
90
  summary[key] = value;
@@ -56,7 +56,7 @@ const READ_SHAPES = {
56
56
  peerTool: "data.load",
57
57
  peerColumnKey: "data.<code>",
58
58
  },
59
- keys: ["items:array<{id,fields:{<code>:value}}>", "total", "totalPages", "page", "size"],
59
+ keys: ["items:array<{id,fields:{<code>:value}}>", "total", "totalPages", "page", "size", "rowsProjected?", "unprojectedFields?", "unprojectedFieldCount?"],
60
60
  // r28i F4: agents try rows[] / items[].sku first; pin the real shape here too.
61
61
  notes: [
62
62
  "业务列在 items[].fields.<code>(--jq 用 items[].fields.sku);计数=size:1+filter 只读 total(不拉行);分组=值域×count",
@@ -126,7 +126,7 @@ const READ_SHAPES = {
126
126
  },
127
127
  "field.list": {
128
128
  keys: ["fields:array<{code,name,type,...}>", "modelPresent?"],
129
- notes: ["字段行键=fields[].code(带 name/type 明细);model.inspect 的 fieldCodes 是同一清单的纯 code 投影——跨面对照别拿错键", "模型不存在时平台可能 refused(300004);存在性判据优先 model.inspect.modelPresent / rule.list.modelPresent"],
129
+ notes: ["字段行键=fields[].code(带 name/type 明细);model.inspect 的 fieldCodes 是同一清单的纯 code 投影——跨面对照别拿错键", "字段选项 options.mappings 读回为数组(写入同形),平台存储原文在 options.mappingsRaw", "模型不存在时平台可能 refused(300004);存在性判据优先 model.inspect.modelPresent / rule.list.modelPresent"],
130
130
  },
131
131
  "workitem.list": {
132
132
  // Flat rows — no fields bag. Wire id is projected as workItemId.
@@ -221,7 +221,7 @@ const READ_SHAPES = {
221
221
  // A2 locator:控件清单键 ↔ config.diff 的逐控件差异路径(BizFormModel.java:26-32
222
222
  // 六列分面存储,diff 按控件 key 对齐,前缀 view/attributes/html/actions)。
223
223
  locator: { controlCodes: "publishedControlCodes|draftControlCodes", diffPath: "changes[].path" },
224
- keys: ["present", "published", "publishedControlCodes", "draftControlCodes", "formButtonCodes?", "formButtons?", "customButtonJson?(full)", "customButtonJsonShapeWarning?"],
224
+ keys: ["present", "published", "publishedControlCodes", "draftControlCodes", "childColumnLocator?:{path,children[]}", "formButtonCodes?", "formButtons?", "customButtonJson?(full)", "customButtonJsonShapeWarning?"],
225
225
  notes: [
226
226
  "控件清单键是 publishedControlCodes/draftControlCodes,不是 controls;两面差异的逐控件路径在 config.diff changes[].path(前缀 view/attributes/html/actions,按控件 key 对齐)",
227
227
  "表单按钮读 formButtonCodes/formButtons;full:true 另带 customButtonJson 数组原样(库里是字符串脏形时给 customButtonJsonShapeWarning——线上 #38 前端按钮不渲染,重写 buttons 自愈)",
package/dist/residue.js CHANGED
@@ -141,6 +141,11 @@ export async function scanResidues(session, prefix, options = {}) {
141
141
  // 探针 L F9:clean 的覆盖面结论单独出键。clean 语义不变(不改成 false),
142
142
  // 但 complete:false 明说「这次扫描没覆盖全部面」,读者不能只看 clean。
143
143
  complete,
144
+ // 0.8.20(探针 N F3):一个词回答「到底删净没有」,别让调用方在
145
+ // clean / complete 两个布尔之间推理。clean 语义不变。
146
+ verdict: userResidues === 0 && !pendingCascade
147
+ ? complete ? "clean" : "clean-with-unscanned-faces"
148
+ : "residues",
144
149
  // r70 探针01-F7:真残留存在时顶层 clean:true 仍误导(coverage 在深处,首屏只看
145
150
  // clean)——caveat 常驻顶层,紧贴 clean 键。
146
151
  cleanCaveat: "clean 仅指已扫描面(scanned faces only);report 面未扫描(报表资源残留用 report.tree + report.get 判)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.8.19",
3
+ "version": "0.8.21",
4
4
  "description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "commander": "14.0.3",
61
- "omc-core": "0.8.19",
61
+ "omc-core": "0.8.21",
62
62
  "proper-lockfile": "4.1.2",
63
63
  "write-file-atomic": "6.0.0",
64
64
  "zod": "^3.23.8",
@@ -76,6 +76,6 @@
76
76
  "directory": "packages/omc-cli"
77
77
  },
78
78
  "optionalDependencies": {
79
- "@stalfh233/omc-fake-platform": "0.8.19"
79
+ "@stalfh233/omc-fake-platform": "0.8.21"
80
80
  }
81
81
  }