@stalfh233/omc-cli 0.8.9 → 0.8.11

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.
@@ -220,6 +220,9 @@ export async function cmdApprovalFlow(args) {
220
220
  if (!apply) {
221
221
  const compiledParticipantNotes = participantNotes(steps, environment);
222
222
  writeEnvelope(envelope("ok", {
223
+ // 等同于 `omc call` 契约:结果顶层必须有 status。预览未写环境 → dry-run
224
+ // (与 model-scaffold/field-add 的预览口径一致),信封仍是 ok/exit 0。
225
+ status: "dry-run",
223
226
  schemaCode: schema,
224
227
  ...compiled,
225
228
  ...(originatorName !== undefined ? { originatorName, originatorNameNote: ORIGINATOR_NAME_NOTE } : {}),
@@ -286,7 +289,11 @@ export async function cmdApprovalFlow(args) {
286
289
  // 4) publish
287
290
  const publishOutcome = await runToolCall("workflow.publish", { args: { schemaCode: schema, code: compiled.workflowCode, ...(environment ? { environment } : {}) }, requestId: request, environment, print: () => undefined });
288
291
  const classified = classifyResult(publishOutcome.result);
289
- writeEnvelope(envelope(classified.status, { schemaCode: schema, workflowCode: compiled.workflowCode, steps: steps.length, ...(originatorName !== undefined ? { originatorName, originatorNameNote: ORIGINATOR_NAME_NOTE } : {}), crossAccountApproval, ...preexistingSection, publish: publishOutcome.result }, request, classified.error));
292
+ // 与 `omc call` 一致:结果顶层带生产者 status(成功 ok / 被拒 refused / 部分
293
+ // partial…),publish 的原始回执继续留在 publish 下。ok 与 status 因此不会
294
+ // 出现「ok:false + status:ok」。
295
+ 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));
290
297
  if (publishOutcome.exitCode === 0)
291
298
  process.stderr.write("[omc] 前台生效验证清单:1) 造一条数据提交走流程;2) 每级审批人在门户有待办(角色用 FindUserByRole 需审批人挂在发起人同部门,否则 PENDING 不来);3) 审批节点字段只读(不可改单);4) 驳回退发起人核对;5) 设计器打开流程确认节点链显示正常。边界:非发起人身份的审批无法在单会话 CLI 内推进(单 token);跨账号请另建环境或把参与人设为 {Originator}。\n");
292
299
  return publishOutcome.exitCode;
@@ -552,6 +552,58 @@ function orderedCapabilities(ids, index) {
552
552
  * runtime/exact patches), not a second main path.
553
553
  */
554
554
  const WHOLE_PACKAGE_CAPABILITIES = ["model", "field", "form", "listview", "datarule", "businessrule", "workflow", "onlinejs"];
555
+ /**
556
+ * F5(0.8.11,探针 F):整包路线推荐 intent 时,必须同时说清**intent 能/不能
557
+ * 覆盖什么**。
558
+ *
559
+ * 真机现象(0.8.10):`next "整包…"` 只给 `route.primary:"intent"` + 7 步
560
+ * `atomicSupplement.ladder`,没有一句解释覆盖面。agent 按推荐写完 YAML、apply
561
+ * 之后才发现:表单只有 publish/fieldCodes(两列布局要 `form.draft`)、listview
562
+ * 只声明列(排序/筛选要 `listview.configure`)、workflow 只到模板+发布(提交/
563
+ * 审批是 runtime 操作)、子表取主表字段的映射回填与精确 patch 以 `child-map-fill`
564
+ * 原子配方为事实源——一半需求要回落 `omc call`,而这些本可以在第一答里说清。
565
+ *
566
+ * 覆盖面文案与 `omc intent schema` 同源(schema.ts 的 form/listview/fields/
567
+ * workflow 节),改 schema 时同步本块。只挂在**整包且 primary=intent** 的
568
+ * route 上:单面 recipe/read/composer 路线不加(那是噪音,且它们本来就不是
569
+ * 声明式路径)。
570
+ */
571
+ const INTENT_COVERAGE = Object.freeze({
572
+ note: "intent 覆盖面(与 `omc intent schema` 同源):covered 由 validate/plan/apply 声明式生成;needsCall 是 intent 不声明(或运行语义/精确 patch 不在声明面)的部分,apply 后用 command 走原子面补齐。",
573
+ covered: [
574
+ "模型 model(含 absent 删除)",
575
+ "标量字段与子表标量列(CHILD_TABLE subFields)",
576
+ "字段发布 field.publish",
577
+ "表单发布 form.publish + 绑定字段 form.fieldCodes",
578
+ "列表视图列 listview.fieldCodes",
579
+ "业务规则 rules(actions 紧凑 / nodeGraph 透传)",
580
+ "字段级数据规则 datarules",
581
+ "流程模板 + 发布 + 规则绑定 workflow(template/publish/bindRules)",
582
+ "在线 JS onlinejs、业务服务/方法 services",
583
+ ],
584
+ needsCall: [
585
+ {
586
+ id: "child-map-fill",
587
+ what: "子表取主表字段:WORK_SHEET 关联列 + options.mappings(intent 子列可声明 relativeCode/options;映射回填只在门户表单执行、REST 不回填,精确改映射与读回以 child-map-fill 配方为准)",
588
+ command: "omc describe field.create --example child-map-fill",
589
+ },
590
+ {
591
+ id: "form-two-column-layout",
592
+ what: "表单两列布局(intent 的 form 只有 publish/fieldCodes,不含行分组/控件 span)",
593
+ command: "omc describe form.draft --example two-column-layout",
594
+ },
595
+ {
596
+ id: "listview-sorts-conditions",
597
+ what: "列表视图业务排序/筛选条件(intent 的 listview 只声明列,排序/条件/按钮 apply 后用 listview.configure 补)",
598
+ command: "omc describe listview.configure --param sorts",
599
+ },
600
+ {
601
+ id: "workflow-runtime",
602
+ what: "审批运行操作:提交/审批/待办/流转(intent 的 workflow 只到模板+发布+绑规则,运行实例走 data.save/data.submit/workitem.list)",
603
+ command: "omc describe data.submit --example workflow-backed-data-submit",
604
+ },
605
+ ],
606
+ });
555
607
  const COMPOSER_ROUTES = Object.freeze([
556
608
  {
557
609
  id: "model-purge",
@@ -773,9 +825,13 @@ function wholePackageRoute(registry, goal, index, hitCapabilities) {
773
825
  ladder: atomicLadder,
774
826
  }),
775
827
  faceCount: faces.length,
828
+ // F5(0.8.11):主推 intent 时先交代「能/不能覆盖什么」,别让 agent 写完
829
+ // YAML 才发现半边需求要回落 omc call。atomic 主路径(intent.level=none)
830
+ // 不加——它没有推荐 intent,说明覆盖面只会误导。
831
+ ...(intentCovered ? { intentCoverage: INTENT_COVERAGE } : {}),
776
832
  atomicSupplement: {
777
833
  note: intentCovered
778
- ? "intent 已覆盖下列能力的创建;原子工具只用于 intent 未覆盖面(删除/生命周期/运行数据/精确 patch)"
834
+ ? "intent 已覆盖下列能力的创建;原子工具只用于 intent 未覆盖面(删除/生命周期/运行数据/精确 patch)——逐项见 intentCoverage.needsCall"
779
835
  : "intent 仅覆盖下列能力中的部分面;未覆盖能力必须走原子工具",
780
836
  capabilities: ordered,
781
837
  // round16b: 这是**指针**(capability + why),不是第二套执行阶梯——
@@ -1517,7 +1573,7 @@ function goalRouteInner(registry, goal) {
1517
1573
  match: { kind: readish ? "read-ladder" : "ladder", ref: `${routeOrder.join("→")}${routeOrder.includes("businessrule") && /累加|联动|审计|规则触发|自动累加|自动回写/.test(goal) ? "(规则面不在本阶梯)" : ""}`, capabilities: routeOrder },
1518
1574
  route: {
1519
1575
  ...(whole ? (intentCoveredOf(ordered)
1520
- ? { primary: "intent", atomicSupplement }
1576
+ ? { primary: "intent", intentCoverage: INTENT_COVERAGE, atomicSupplement }
1521
1577
  : { primary: "atomic", note: "命中能力中有 intent.level=none 的面,声明式 intent 不覆盖全部需求,走原子工具阶梯", ladder }) : { ladder }),
1522
1578
  // r28e F2(真机复现 2026-11-05):`next "建表单布局、在线JS、表单按钮"`
1523
1579
  // 命中的是 model→form→listview→businessrule→onlinejs 的整包 ladder,
@@ -1615,7 +1671,7 @@ function goalRouteInner(registry, goal) {
1615
1671
  capability: capabilityId,
1616
1672
  lane: route.lane,
1617
1673
  ...(whole ? (intentCoveredOf([capabilityId])
1618
- ? { primary: "intent" }
1674
+ ? { primary: "intent", intentCoverage: INTENT_COVERAGE }
1619
1675
  : { primary: "atomic", note: "该能力无声明式面(intent.level=none),走原子工具" }) : {}),
1620
1676
  ...(readish ? { readTools: readToolsInLane(registry, route.lane) } : { tools: route.tools }),
1621
1677
  // r66 ②(c-F4):有依赖顺序的能力(report)显式给 order,修掉 tools 键序
@@ -294,7 +294,10 @@ function phraseOf(tool, args, outcome) {
294
294
  // 停滞(readback.flowWarning 有真相)——summary 全绿会掩盖。有警告必须抬头。
295
295
  const flowWarning = outcome?.readback?.flowWarning;
296
296
  const warnTag = flowWarning ? `——⚠ ${flowWarning.code === "flow-instance-exception" ? "实例异常停滞(见 readback.flowWarning)" : "流程未续走(见 readback.flowWarning)"}` : "";
297
- return `提交数据(模型 ${schemaCode ?? "?"}${stringArg(args, "workItemId") ? ",审批待办" : ""})${warnTag}`;
297
+ // F4(w71,0.8.10):显式传 name 但被平台「数据标题」覆盖时,摘要行与
298
+ // data.save 同口径抬头(JSON 字段 readback.nameOverwrittenNote)。
299
+ const nameNote = readbackNoteClause(outcome, "nameOverwrittenNote");
300
+ return `提交数据(模型 ${schemaCode ?? "?"}${stringArg(args, "workItemId") ? ",审批待办" : ""})${warnTag}${nameNote}`;
298
301
  }
299
302
  case "data.delete": {
300
303
  const ids = Array.isArray(args.bizObjectIds) ? args.bizObjectIds.map(String) : [];
@@ -314,16 +317,36 @@ function phraseOf(tool, args, outcome) {
314
317
  const conditionRuntimeLine = Array.isArray(args.conditions) && args.conditions.length > 0
315
318
  ? ";视图固定条件只在门户运行面生效,REST `data.list --queryCode` 不应用——要在 API 侧过滤请显式传 `filter`"
316
319
  : "";
317
- // F14(0.8.9 探针 D):清空 actions 后回执仍列平台注入的 6 条默认动作,
318
- // 人读摘要要说清「清的是流程/自定义动作,剩下的是平台默认动作」,否则
319
- // 会被读成 replaceActions 没生效。
320
+ // F14(0.8.9 探针 D)/ F8(0.8.10 探针 E):清空 actions 后回执仍列平台注入的
321
+ // 6 条默认动作,人读摘要要说清「清的是流程/自定义动作,剩下的是平台默认动作」,
322
+ // 否则会被读成 replaceActions 没生效。只要 replaceActions:true 且传了 actions
323
+ // (含空数组)就说;差集为空时明说「本次没有移除非默认动作」。
320
324
  const readbackRemoved = Array.isArray(outcome?.readback?.removedActionCodes)
321
325
  ? (outcome.readback.removedActionCodes.map(String))
322
326
  : [];
323
- const actionsClearedLine = args.replaceActions === true && Array.isArray(args.actions) && args.actions.length === 0
324
- ? `;流程/自定义动作已清空${readbackRemoved.length > 0 ? `(移除 ${readbackRemoved.join("、")})` : ""};剩余为平台默认动作(query/get 注入,不是 replaceActions 未生效)`
327
+ const readbackHasPlatformDefaults = Array.isArray(outcome?.readback?.platformDefaultActions);
328
+ const readbackPlatformDefaults = readbackHasPlatformDefaults
329
+ ? (outcome.readback.platformDefaultActions.map(String))
330
+ : [];
331
+ // plan 阶段没有回读,不能断言「本次没有移除」或「回读里没有默认动作」——只说教学句。
332
+ const actionsRemovedClause = readbackRemoved.length > 0 ? `(移除 ${readbackRemoved.join("、")})` : readbackHasPlatformDefaults ? "(本次没有移除非默认动作)" : "";
333
+ const actionsDefaultsClause = !readbackHasPlatformDefaults
334
+ ? "剩余为平台默认动作(query/get 注入)"
335
+ : readbackPlatformDefaults.length > 0
336
+ ? `剩余为平台默认动作(${readbackPlatformDefaults.join("、")},query/get 注入)`
337
+ : "回读里没有平台注入的默认动作(剩余动作均来自本次提交或平台保留)";
338
+ const actionsClearedLine = args.replaceActions === true && Array.isArray(args.actions)
339
+ ? `;流程/自定义动作已清空${actionsRemovedClause};${actionsDefaultsClause},不是 replaceActions 未生效`
340
+ : "";
341
+ // F2(0.8.10 探针 E):增量 configure 保留了平台默认系统列,摘要行必须说出来,
342
+ // 否则人只看到列名里多了 createdTime 等,不知道是平台既有列而非 fieldCodes 写错。
343
+ const systemColumnsAdded = Array.isArray(outcome?.readback?.systemColumnsAdded)
344
+ ? (outcome.readback.systemColumnsAdded.map(String))
345
+ : [];
346
+ const systemColumnsLine = systemColumnsAdded.length > 0
347
+ ? `;平台额外保留系统列 ${systemColumnsAdded.join("、")}(未传 replaceColumns/hideDefaultSystemFields);要精确列集合请加 replaceColumns:true + hideDefaultSystemFields:true`
325
348
  : "";
326
- return `配置列表视图 ${stringArg(args, "code") ?? schemaCode ?? "?"}(模型 ${schemaCode ?? "?"}):列 ${codes || "(未变)"}${sections.length > 0 ? `;同时配置 ${sections.join("、")}` : ""}${actionsClearedLine}${conditionRuntimeLine}`;
349
+ return `配置列表视图 ${stringArg(args, "code") ?? schemaCode ?? "?"}(模型 ${schemaCode ?? "?"}):列 ${codes || "(未变)"}${sections.length > 0 ? `;同时配置 ${sections.join("、")}` : ""}${systemColumnsLine}${actionsClearedLine}${conditionRuntimeLine}`;
327
350
  }
328
351
  case "listview.delete":
329
352
  return `删除列表视图 ${stringArg(args, "code") ?? "?"}(${schemaCode ?? "?"})`;
@@ -45,6 +45,50 @@ function relationCodeOf(field) {
45
45
  const raw = field.options?.relativeCode ?? field.options?.schemaCode;
46
46
  return typeof raw === "string" && raw.trim() ? raw.trim() : undefined;
47
47
  }
48
+ /**
49
+ * 0.8.11 P0(探针 F):同一意图里既新建模型 A、又在模型 B 的关联字段(或子表关联列)
50
+ * 指向 A 时,plan 曾通过而 apply 在写前门被 `relation-target-not-found` 全量拒绝——
51
+ * 门的候选集只来自**基线**模型清单,不含本 plan 声明并即将创建的模型。
52
+ *
53
+ * `relationTargetsFromPlan` 列出「本包会提供的关联目标」:意图声明为存在、基线里还
54
+ * 不存在(本次 apply 会先 model.create)。plan 回执用它让调用方在 plan 阶段就能确认
55
+ * 同包引用可解析;apply 的写前门另按 changes 里**实际先于该字段**的 `model.create`
56
+ * 判,顺序被改坏时不会误放行。
57
+ */
58
+ export function relationTargetsFromPlan(intent, baseline) {
59
+ const present = new Set(baseline.models.filter((model) => model.present).map((model) => model.code));
60
+ const declared = new Set(intent.models.filter((model) => model.absent !== true).map((model) => model.code));
61
+ const targets = new Set();
62
+ const collect = (target) => {
63
+ if (target && declared.has(target) && !present.has(target))
64
+ targets.add(target);
65
+ };
66
+ for (const model of intent.models) {
67
+ if (model.absent === true)
68
+ continue;
69
+ for (const field of model.fields) {
70
+ if (field.absent === true)
71
+ continue;
72
+ collect(relationCodeOf(field));
73
+ for (const sub of field.subFields ?? [])
74
+ collect(sub.relativeCode?.trim());
75
+ }
76
+ }
77
+ return [...targets].sort();
78
+ }
79
+ /** The relation target a `field.create` payload names (top-level relativeCode wins, then options). */
80
+ function relationTargetOfPayload(args) {
81
+ const relative = typeof args.relativeCode === "string" ? args.relativeCode.trim() : "";
82
+ if (relative)
83
+ return relative;
84
+ const options = args.options;
85
+ if (options !== null && typeof options === "object" && !Array.isArray(options)) {
86
+ const schemaCode = options.schemaCode;
87
+ if (typeof schemaCode === "string")
88
+ return schemaCode.trim();
89
+ }
90
+ return "";
91
+ }
48
92
  const familyOf = (wireType) => Object.entries(FIELD_PROPERTY_TYPES).find(([, value]) => value === wireType)?.[0];
49
93
  /** Explicit option keys the intent declares (relations lift `relativeCode` to the row). */
50
94
  function declaredOptionKeys(field) {
@@ -236,17 +280,33 @@ export async function lintIntentFieldCreateChanges(session, intent, changes) {
236
280
  const overlays = intentOwnFieldOverlays(intent);
237
281
  if (overlays.size === 0)
238
282
  return undefined;
239
- const relevant = changes.filter((change) => change.tool === "field.create" && overlays.has(String(change.args.schemaCode ?? "")));
283
+ const relevant = changes
284
+ .map((change, index) => ({ change, index }))
285
+ .filter(({ change }) => change.tool === "field.create" && overlays.has(String(change.args.schemaCode ?? "")));
240
286
  if (relevant.length === 0)
241
287
  return undefined;
288
+ // 0.8.11 P0(探针 F):候选集必须含**本 plan 里在该字段之前 model.create 的模型**。
289
+ // 能力分级排序把 model 全部排在 field 之前,所以同包目标在写入时确实已存在;
290
+ // 只认「先于该字段」的创建(不按意图声明整包放行),顺序若被改坏仍会拒绝。
291
+ const createIndex = new Map();
292
+ changes.forEach((change, index) => {
293
+ if (change.tool !== "model.create")
294
+ return;
295
+ const code = String(change.args.code ?? "").trim();
296
+ if (code && !createIndex.has(code))
297
+ createIndex.set(code, index);
298
+ });
299
+ const declaredPresent = new Set(intent.models.filter((model) => model.absent !== true).map((model) => model.code));
242
300
  // One model-list read for the whole plan (field.create would read it per field).
243
301
  const relationCandidates = await modelSchemaCodes(session);
244
302
  const targetVersion = session.detectedVersion();
245
- for (const change of relevant) {
303
+ for (const { change, index } of relevant) {
246
304
  const schemaCode = String(change.args.schemaCode ?? "");
305
+ const createdBefore = [...createIndex.entries()].filter(([, at]) => at < index).map(([code]) => code);
306
+ const candidates = createdBefore.length > 0 ? [...new Set([...relationCandidates, ...createdBefore])] : relationCandidates;
247
307
  try {
248
308
  await lintFieldCreateWrite(session, gateInputOf(schemaCode, change.args, targetVersion), {
249
- relationCandidates,
309
+ relationCandidates: candidates,
250
310
  pendingOwnFields: overlays.get(schemaCode),
251
311
  });
252
312
  }
@@ -254,14 +314,28 @@ export async function lintIntentFieldCreateChanges(session, intent, changes) {
254
314
  if (!(error instanceof ToolRefusalError))
255
315
  throw error;
256
316
  const { status: _status, ...detail } = error.payload;
317
+ const target = relationTargetOfPayload(change.args);
318
+ const declaredButCreatedLater = target.length > 0
319
+ && declaredPresent.has(target)
320
+ && !createdBefore.includes(target)
321
+ && !relationCandidates.includes(target);
257
322
  return {
258
323
  status: "refused",
259
324
  ...detail,
325
+ ...(createdBefore.length > 0 ? { relationTargetsFromPlan: createdBefore } : {}),
260
326
  intentField: {
261
327
  schemaCode,
262
328
  code: String(change.args.code ?? ""),
263
329
  ...(change.resource !== undefined ? { resource: change.resource } : {}),
264
330
  },
331
+ ...(declaredButCreatedLater
332
+ ? {
333
+ relationTargetOrdering: {
334
+ target,
335
+ message: `关联目标 ${target} 是本意图声明的模型,但 plan 里没有在该字段之前创建它——重新 intent plan(模型创建由能力排序排在全部字段创建之前),不要手工调整 plan 顺序`,
336
+ },
337
+ }
338
+ : {}),
265
339
  message: `${String(detail.message ?? "字段写前语义门拒绝")};intent apply 在任何写 wire 之前按整包字段面判定,本次零写入——修正意图后重新 intent plan`,
266
340
  nextAction: "fix the declared fields/mappings in the intent, then re-run intent plan + apply",
267
341
  };
@@ -21,7 +21,7 @@ import { jsonBytes, sha256, writeArtifact } from "../support.js";
21
21
  import { INTENT_COMPILER_VERSION, intentConfigRoot, readIntentFile } from "./cli.js";
22
22
  import { validateRuleNodeGraph, PLATFORM_TRIGGER_RULE_CODES, walkConditionLeaves } from "../lanes/rule-graph.js";
23
23
  import { expectedRuleGraph } from "./capabilities/businessrule.js";
24
- import { lintIntentFieldCreateChanges } from "./capabilities/field.js";
24
+ import { lintIntentFieldCreateChanges, relationTargetsFromPlan } from "./capabilities/field.js";
25
25
  import { readBaseline, baselineFingerprintOf } from "./baseline.js";
26
26
  import { compileIntent } from "./compiler.js";
27
27
  import { buildPlan, verifyPlan } from "./plan-file.js";
@@ -205,6 +205,15 @@ export async function planIntent(intent, environment, planOut) {
205
205
  const session = await context.sessions.session(environment);
206
206
  const baseline = await readBaseline(session, intent);
207
207
  const compiled = compileIntent(intent, baseline);
208
+ // 0.8.11 P0(探针 F):plan 回执点名「本包提供的关联目标」——同一次 apply 会
209
+ // 先 model.create 它们,所以同包 relation 引用在 plan 阶段即可确认可解析。
210
+ const relationTargets = relationTargetsFromPlan(intent, baseline);
211
+ const relationTargetsReceipt = relationTargets.length > 0
212
+ ? {
213
+ relationTargetsFromPlan: relationTargets,
214
+ relationTargetsFromPlanNote: `本包提供的关联目标:同一次 apply 会先创建这些模型,指向它们的关联字段可解析(包外目标仍需已存在)`,
215
+ }
216
+ : {};
208
217
  const plan = buildPlan({
209
218
  environment: session.environmentName,
210
219
  environmentFingerprint: session.environmentFingerprint(),
@@ -262,6 +271,7 @@ export async function planIntent(intent, environment, planOut) {
262
271
  skippedCount: compiled.skipped.length,
263
272
  riskClass: compiled.riskClass,
264
273
  changeSummary,
274
+ ...relationTargetsReceipt,
265
275
  planArtifactId: artifact.artifactId,
266
276
  planArtifactSha256: artifact.sha256,
267
277
  ...(warnings.length > 0 ? { warnings } : {}),
@@ -303,6 +313,7 @@ export async function planIntent(intent, environment, planOut) {
303
313
  skippedCount: compiled.skipped.length,
304
314
  riskClass: compiled.riskClass,
305
315
  changeSummary,
316
+ ...relationTargetsReceipt,
306
317
  planArtifactId: artifact.artifactId,
307
318
  planArtifactSha256: artifact.sha256,
308
319
  planExternalized: true,
@@ -320,6 +331,7 @@ export async function planIntent(intent, environment, planOut) {
320
331
  skippedCount: compiled.skipped.length,
321
332
  riskClass: compiled.riskClass,
322
333
  plan,
334
+ ...relationTargetsReceipt,
323
335
  planArtifactId: artifact.artifactId,
324
336
  planArtifactSha256: artifact.sha256,
325
337
  ...(warnings.length > 0 ? { warnings } : {}),
@@ -341,7 +341,7 @@ export const FIELD_LANE_CONTRACT = Object.freeze({
341
341
  }),
342
342
  "field.publish": Object.freeze({
343
343
  scope: "create publish readback",
344
- description: "Publish the model's draft fields (bizproperty/publish). **Model-scoped**: one call publishes every draft field — never once per field. Optional `code`/`codes` verify published face; readback 回 `publishedCodes`。`codes` 短路须草稿/发布 options 一致,否则真发布。formBinding 可含 dictionaryStale / relation-mappings-empty。瞬态重试:DDL 中间态自动重试≤3(退避 2s/5s);仍失败等≥30s 再发,勿重复建字段。**部分交付口径**:有请求的 code 不在发布面时 `allRequestedPresent:false` + `verified:false` + `readback.present:false`(共享写门据此把 deliveryState 降为 WRITE_UNVERIFIED)+ `unpublishedRequested`,并区分 `nonexistentCodes`(草稿面都没有——先 field.list 核对)与 `stillDraftCodes`(模型里有、发布后仍不在发布面)——已发布的字段仍然算发布了,但不要只看 ok/DELIVERED。",
344
+ description: "Publish the model's draft fields (bizproperty/publish). **Model-scoped**: one call publishes every draft field — never once per field. Optional `code`/`codes` verify published face; readback 回 `publishedCodes`。`codes` 短路须草稿/发布 options 一致,否则真发布。formBinding 含 dictionaryStale / relation-mappings-empty(显式空键)。瞬态重试:DDL 中间态自动重试≤3(退避 2s/5s);仍失败等≥30s 再发,勿重复建字段。**部分交付口径**:有请求的 code 不在发布面时 `allRequestedPresent:false` + `verified:false` + `readback.present:false`(共享写门据此把 deliveryState 降为 WRITE_UNVERIFIED)+ `unpublishedRequested`,并区分 `nonexistentCodes`(草稿面都没有——先 field.list 核对)与 `stillDraftCodes`(模型里有、发布后仍不在发布面)——已发布的字段仍然算发布了,但不要只看 ok/DELIVERED。",
345
345
  }),
346
346
  "field.delete": Object.freeze({
347
347
  scope: "create publish readback",
@@ -1016,13 +1016,26 @@ export function registerFieldLane(tools) {
1016
1016
  const requested = [...(args.code ? [args.code] : []), ...(args.codes ?? [])];
1017
1017
  const publishedRows = wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: args.schemaCode, isPublish: "true" } })).data);
1018
1018
  const published = publishedRows.map((row) => String(row.code ?? row.propertyCode ?? "")).filter((code) => code !== "");
1019
+ // F3:与真写同门——父面缺失的 code 再看本模型 CHILD_TABLE 子 schema 的
1020
+ // 发布面(父模型级发布已覆盖子表列)。只在有缺失时读,正常路径零额外 wire。
1021
+ const parentMissing = requested.filter((code) => !published.includes(code));
1022
+ const childSchemas = [...new Set(publishedRows
1023
+ .filter((row) => Number(row.type ?? row.propertyType) === FIELD_PROPERTY_TYPES.CHILD_TABLE)
1024
+ .map((row) => String(row.code ?? row.propertyCode ?? ""))
1025
+ .filter((code) => code.length > 0))];
1026
+ const childFaces = parentMissing.length > 0 && childSchemas.length > 0
1027
+ ? await readChildSchemaFieldFaces(session, childSchemas, parentMissing)
1028
+ : { published: new Map(), draft: new Map(), resolved: [] };
1029
+ const childPublished = new Set([...childFaces.published.values()].flatMap((codes) => [...codes]));
1030
+ const publishedAnywhere = (code) => published.includes(code) || childPublished.has(code);
1019
1031
  return {
1020
- wouldChange: requested.length === 0 || !requested.every((code) => published.includes(code)),
1032
+ wouldChange: requested.length === 0 || !requested.every((code) => publishedAnywhere(code)),
1021
1033
  schemaCode: args.schemaCode,
1022
1034
  ...(requested.length > 0 ? { requested } : {}),
1023
- alreadyPublished: requested.length > 0 ? requested.filter((code) => published.includes(code)) : undefined,
1035
+ alreadyPublished: requested.length > 0 ? requested.filter((code) => publishedAnywhere(code)) : undefined,
1036
+ ...(childFaces.resolved.length > 0 ? { resolvedFromChildSchemas: childFaces.resolved } : {}),
1024
1037
  relationTargetsChecked: candidates.length,
1025
- note: "关系目标悬空已按真写同门检查;发布是模型级(一次发布该模型全部草稿字段),alreadyPublished 只说明这些 code 已在发布面。",
1038
+ note: "关系目标悬空已按真写同门检查;发布是模型级(一次发布该模型全部草稿字段),alreadyPublished 只说明这些 code 已在发布面(含本模型子表 schema 的列)。",
1026
1039
  };
1027
1040
  },
1028
1041
  lintScope: "full",
@@ -1913,6 +1926,13 @@ function relationMappingsEmptyWarnings(publishedRows) {
1913
1926
  if (type !== FIELD_PROPERTY_TYPES.WORK_SHEET)
1914
1927
  return false;
1915
1928
  const options = optionsObjectOf(row.options);
1929
+ // 普通关联本来就不需要副本列:`mappings` 键缺席是**合法常态**,不是空配置。
1930
+ // 平台证据:BizFormJsonResolveServiceImpl.getRelationMappingByCode 对空/缺
1931
+ // mappings 直接回 null(无映射即合法,无报错),DataModelInitUtils.disposeOptions
1932
+ // 也只在键存在时搬运 mappings。只有调用方**显式声明了 mappings 键却留空**
1933
+ // ("" / "[]" / [] / null)才是配置错误——那会在设计器里显示「已设置」但无映射行。
1934
+ if (!Object.prototype.hasOwnProperty.call(options, "mappings"))
1935
+ return false;
1916
1936
  const mappings = options.mappings;
1917
1937
  if (mappings === undefined || mappings === null)
1918
1938
  return true;
@@ -2036,6 +2056,52 @@ async function assertFieldPublishRelations(session, schemaCode) {
2036
2056
  throw new ToolRefusalError({ status: "refused", blocker: "relation-target-not-found", schemaCode, message: relationFailure, candidates: relationCandidates.slice(0, 5) });
2037
2057
  return relationCandidates;
2038
2058
  }
2059
+ /**
2060
+ * 0.8.11 / 探针 F3:模型级发布覆盖子表 schema——父模型上 CHILD_TABLE(8) 字段的
2061
+ * code **就是**子 schema code,`bizproperty/publish` 一次把子表列一起发布
2062
+ * (父 CHILD_TABLE 字段的 subSchema 承载列;8.6.26 ModelManagementFacadeImpl
2063
+ * .assembleSchemaModel 把 CHILD_TABLE 的 code 解析成真实 schema,field.list 可读)。
2064
+ * 但 `bizproperty/list` 只列**传入 schemaCode** 的字段:拿子表列 code 问父模型
2065
+ * 发布面必然 miss。旧校验据此报 WRITE_UNVERIFIED + nonexistentCodes,诱导 agent
2066
+ * 重复 field.create(真机 2.1.5:refRepair 是 items 的列,父面 miss,实际已发布)。
2067
+ *
2068
+ * 只有请求 codes 在父面缺失时才读子 schema(正常发布零额外 wire)。子 schema 读
2069
+ * 失败按「本次未解释」处理——不能把版本差异变成误拒/误绿。
2070
+ */
2071
+ async function readChildSchemaFieldFaces(session, childSchemas, missing) {
2072
+ const published = new Map();
2073
+ const draft = new Map();
2074
+ const resolved = [];
2075
+ const codeSet = (rows) => new Set(rows.map((row) => String(row.code ?? row.propertyCode ?? "")).filter((code) => code.length > 0));
2076
+ for (const childSchema of childSchemas) {
2077
+ let codes;
2078
+ try {
2079
+ codes = codeSet(wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: childSchema, isPublish: "true" } })).data));
2080
+ }
2081
+ catch {
2082
+ // 版本不对称(issue §1.4:部分构建对子 schema 的 bizproperty/list 回
2083
+ // 601003)。子面读不到就不解释,保持原有诚实降级,不因此整单拒绝。
2084
+ continue;
2085
+ }
2086
+ published.set(childSchema, codes);
2087
+ if (missing.some((code) => codes.has(code)))
2088
+ resolved.push(childSchema);
2089
+ }
2090
+ // 草稿面只在「所有子发布面都解释不了」时读:那是唯一需要区分
2091
+ // stillDraftCodes(存在但没发布)与 nonexistentCodes(不存在)的场景。
2092
+ const unexplained = missing.filter((code) => ![...published.values()].some((codes) => codes.has(code)));
2093
+ if (unexplained.length > 0) {
2094
+ for (const childSchema of published.keys()) {
2095
+ try {
2096
+ draft.set(childSchema, codeSet(wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: childSchema, isPublish: "false" } })).data)));
2097
+ }
2098
+ catch {
2099
+ // 同上的版本不对称:草稿面读不到就只报「本次未命中」。
2100
+ }
2101
+ }
2102
+ }
2103
+ return { published, draft, resolved };
2104
+ }
2039
2105
  export async function executeFieldPublish(session, args) {
2040
2106
  // bizproperty/publish is MODEL-SCOPED: one call publishes every draft
2041
2107
  // field of the schema. `code`/`codes` only select which fields to verify
@@ -2204,9 +2270,23 @@ export async function executeFieldPublish(session, args) {
2204
2270
  }
2205
2271
  const publishOutcome = performed;
2206
2272
  const readback = await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: args.schemaCode, isPublish: "true" } });
2207
- const publishedCodes = wireRows(readback.data).map(codeOf).filter((code) => code.length > 0);
2273
+ const readbackRows = wireRows(readback.data);
2274
+ const publishedCodes = readbackRows.map(codeOf).filter((code) => code.length > 0);
2208
2275
  const requested = [...(args.code ? [args.code] : []), ...(args.codes ?? [])];
2209
2276
  const present = requested.filter((code) => publishedCodes.includes(code));
2277
+ // F3:父面缺失的 code 可能属于本模型的 CHILD_TABLE 子 schema(父模型级发布
2278
+ // 已把子表列一起发布)。只在有缺失时才读子面,正常发布零额外 wire。
2279
+ const childSchemaCandidates = [...new Set([...readbackRows, ...draftRows]
2280
+ .filter((row) => Number(row.type ?? row.propertyType) === FIELD_PROPERTY_TYPES.CHILD_TABLE)
2281
+ .map(codeOf)
2282
+ .filter((code) => code.length > 0))];
2283
+ const parentMissing = requested.filter((code) => !publishedCodes.includes(code));
2284
+ const childFaces = parentMissing.length > 0 && childSchemaCandidates.length > 0
2285
+ ? await readChildSchemaFieldFaces(session, childSchemaCandidates, parentMissing)
2286
+ : { published: new Map(), draft: new Map(), resolved: [] };
2287
+ const childPublishedCodes = new Set([...childFaces.published.values()].flatMap((codes) => [...codes]));
2288
+ const childDraftCodes = new Set([...childFaces.draft.values()].flatMap((codes) => [...codes]));
2289
+ const presentCodes = new Set([...present, ...requested.filter((code) => childPublishedCodes.has(code))]);
2210
2290
  // r32(真机复现 0.6.13):`codes:["g1","notExist"]` 回 ok + DELIVERED +
2211
2291
  // allRequestedPresent:false + verification.ok:true —— 三个成功标记与「有请求的
2212
2292
  // 字段不在发布面」同真。不在发布面的 code 分两类,报法不同:
@@ -2216,9 +2296,9 @@ export async function executeFieldPublish(session, args) {
2216
2296
  // 判失败;但既有的 verified/ok、allRequestedPresent、verification.ok 都不能
2217
2297
  // 再报 true(派生的 readback.present=false 会让共享写门把 deliveryState 降为
2218
2298
  // 既有枚举值 WRITE_UNVERIFIED——刻意不新增枚举外的值)。
2219
- const missingRequested = requested.filter((code) => !present.includes(code));
2220
- const nonexistentCodes = missingRequested.filter((code) => !draftCodesBefore.has(code));
2221
- const stillDraftCodes = missingRequested.filter((code) => draftCodesBefore.has(code));
2299
+ const missingRequested = requested.filter((code) => !presentCodes.has(code));
2300
+ const nonexistentCodes = missingRequested.filter((code) => !draftCodesBefore.has(code) && !childDraftCodes.has(code));
2301
+ const stillDraftCodes = missingRequested.filter((code) => draftCodesBefore.has(code) || childDraftCodes.has(code));
2222
2302
  const allRequestedPresent = missingRequested.length === 0;
2223
2303
  const targets = (requested.length > 0 ? requested : [...draftSnapshot.keys()]).filter((code) => publishedCodes.includes(code));
2224
2304
  const verificationRun = await verifyFieldDetails(targets);
@@ -2256,8 +2336,11 @@ export async function executeFieldPublish(session, args) {
2256
2336
  "平台无「单独发布」也无「取消发布」端点,这一步不可撤销;如需让它们不生效只能用 field.delete(会丢该列数据)。",
2257
2337
  }
2258
2338
  : {}),
2259
- ...(args.code ? { publishedFieldPresent: publishedCodes.includes(args.code) } : {}),
2260
- ...(args.codes ? { publishedFieldsPresent: Object.fromEntries(args.codes.map((code) => [code, publishedCodes.includes(code)])) } : {}),
2339
+ ...(args.code ? { publishedFieldPresent: presentCodes.has(args.code) } : {}),
2340
+ ...(args.codes ? { publishedFieldsPresent: Object.fromEntries(args.codes.map((code) => [code, presentCodes.has(code)])) } : {}),
2341
+ // F3:这些 code 不在父模型字段面,但在其 CHILD_TABLE 子 schema 的发布面
2342
+ // (父模型级发布覆盖子表列)。只增语义,成功回执形状不变。
2343
+ ...(childFaces.resolved.length > 0 ? { resolvedFromChildSchemas: childFaces.resolved } : {}),
2261
2344
  ...(requested.length > 0
2262
2345
  ? {
2263
2346
  allRequestedPresent,
@@ -10,7 +10,7 @@ export const LIST_VIEW_WIRE = Object.freeze({
10
10
  createBody: "query/create body {schemaCode, name, code, type:'LIST', showOnPc:false, published:false} (forced design-time defaults); code is required by the platform — a missing code is refused with errcode 10005 「编码不能为空」 on a wasted live round trip (r26 live), so the tool fills schemaCode when code is omitted",
11
11
  createReadback: "query/get_header readback",
12
12
  configureDefault: "code omitted means the default view (code=schemaCode)",
13
- configureColumns: "query/get then query/update: for each fieldCodes entry, append a missing column as visible, or repair an existing column's name/propertyType/displayFormat/visible in place (never skip an already-present column), then query/get readback; propertyType comes from published field metadata; NUMERICAL displayFormat is derived from the field's 0-based `options.scale` (0=integer,1=1dp,2=2dp,3=3dp…8=8dp) through the platform parseNumber table ({0:1,1:2,2:3,3:11,4:12,23:…, percent 0..:4/5/6/13/14/27..30, currency ¥ 2dp..:7/15/16/31..34} — verified live: scale 2 → displayFormat 3 = 2 decimals) and DATE displayFormat from options.format (1=yyyy-MM-dd,2=datetime,3=minute,4=yyyy-MM); the readback columns array carries {propertyCode,propertyType,displayFormat,visible,sumType} and added/updated name the fieldCodes touched",
13
+ configureColumns: "query/get then query/update: fieldCodes is OPTIONAL — omitted means the column set is NOT touched (the query/get queryColumns are echoed verbatim because saveBizQueryDetail saves the whole detail), which is the path for sorts/conditions/actions-only updates; replaceColumns:true without fieldCodes refuses listview-fieldcodes-required-for-replace and a call with no configurable key at all refuses listview-configure-no-intent (both zero-write); for each provided fieldCodes entry, append a missing column as visible, or repair an existing column's name/propertyType/displayFormat/visible in place (never skip an already-present column), then query/get readback; propertyType comes from published field metadata; NUMERICAL displayFormat is derived from the field's 0-based `options.scale` (0=integer,1=1dp,2=2dp,3=3dp…8=8dp) through the platform parseNumber table ({0:1,1:2,2:3,3:11,4:12,23:…, percent 0..:4/5/6/13/14/27..30, currency ¥ 2dp..:7/15/16/31..34} — verified live: scale 2 → displayFormat 3 = 2 decimals) and DATE displayFormat from options.format (1=yyyy-MM-dd,2=datetime,3=minute,4=yyyy-MM); the readback columns array carries {propertyCode,propertyType,displayFormat,visible,sumType} and added/updated name the fieldCodes touched",
14
14
  configureSorts: "sorts -> querySorts [{propertyCode,propertyType,direction,sortKey,clientType}]; direction SortDirectionType numeric ASC(1)/DESC(2); omitted leaves the existing sorts untouched, provided replaces them",
15
15
  configureConditions: "conditions -> queryConditions [{propertyCode,propertyType,displayType,filterType,defaultValue,options,startValue,endValue,shortcutFilter,choiceType,dateType,accurateSearch,showNull,includeSubData,buildTreeBy,visible,treeLimitScopeType,treeLimitConditionGroup,treeDefaultConditionGroup}]; minimum --param shape: {\"conditions\":[{\"propertyCode\":\"<code>\",\"filterType\":\"Eq\",\"defaultValue\":<value>}]}; filterType is the comparison OPERATOR (QueryFilterType STRING enum: Eq/NotEq/Gt/Lt/Gte/Lte/Like/NotLike/IsNull/IsNotNull/In/NotIn/Between/NotBetween/Of/NotOf/…; omitted → the platform default for the propertyType; aliases operator/op and legacy options.op); displayType INPUT(0)/RADIO(1)/CHECKBOX(2)/SELECT(3)/RANGE(4); choiceType SELECT(1)/POPUP(2)/TREE_LEFT(3); options is a JSON string (decoded on readback); the 2.1.5 tree-view triple treeLimitScopeType/treeLimitConditionGroup/treeDefaultConditionGroup is read as List<List<BizQueryDataRangeCondition>> [[{propertyCode,propertyType,operatorType,valueType,value,dynamicValue}]] and passed through verbatim: a baseline key with a DIFFERENT value refuses with listview-tree-conditions-changed (nextAction allowTreeConditionChange:true) and a baseline key omitted from the submitted row refuses with listview-tree-conditions-would-be-lost; value equality canonicalises JSON text vs object, object key order, and numeric propertyType/operatorType (\"1\"==1) but keeps value/dynamicValue string-strict; readback compares all three keys whenever either side carries one and reports the drift as a coercion; conditionReadback is equivalent only for field-by-field equality, otherwise coerced with from/to details; viewConditionsAppliedRest:false records that REST data.list --queryCode does not apply fixed conditions",
16
16
  configureConditionMap: "queryConditionMap {<schemaCode>: queryConditions[]} is read-derived (query/get with a formCode child-table filter); BizQueryDetailConfig persists queryConditions/querySorts only, so the map is not a configure input",
@@ -126,7 +126,7 @@ export const LIST_VIEW_LANE_CONTRACT = Object.freeze({
126
126
  }),
127
127
  "listview.configure": Object.freeze({
128
128
  scope: LIST_VIEW_SCOPE,
129
- description: "配置列表视图(列、排序、查询条件、行/列表按钮、呈现、自定义按钮、视图头扩展选项与视图类型)。**code 语义**:省略 `code`(或 code=schemaCode)= 配置**默认视图**(code = 模型 code,8.6.41 起默认视图同样可 configure),日常配列就用它,**不要先 listview.create**(会多一个视图);改默认视图影响所有用户;仅需第二个视图时才 listview.create(configure 带 code 指向它)。读回 query,按 `fieldCodes` 追加缺失列或**原地修正**已存在列的 name/propertyType/displayFormat/visible(不再跳过既有列),置为可见;数值列 displayFormat 由字段 0 基 `options.scale` 推导(0=整数,1=1位,2=2位,3=3位…8=8位)、日期列由 `options.format` 推导(1/2/3/4),回显 `columns` 为完整列对象并给出 `added`/`updated`;`sorts`→querySorts(direction ASC/DESC)、`conditions`→queryConditions(**比较符是 `filterType`(QueryFilterType 字符串枚举 Eq/NotEq/…;别名 operator/op;省略时按 propertyType 取平台默认)**、displayType/choiceType/options 字符串解码;2.1.5 树视图过滤组三键 `treeLimitScopeType`/`treeLimitConditionGroup`/`treeDefaultConditionGroup` 原样透传(值不同默认拒 `listview-tree-conditions-changed`,确认改写传 `allowTreeConditionChange:true`;缺键拒 `listview-tree-conditions-would-be-lost`);写后条件回读等价校验给出 conditionReadback)、`actions`→queryActions(queryActionType QUERY(1)…BATCH_SUBMIT(23)、associationType BIZSHEET(0)/WORKFLOW(1))、`presentation`→queryPresentation(htmlJson/actionsJson/columnsJson/queryViewDataSource/schemaRelations/options 均为 JSON 字符串,合法 JSON 读回解码)、`buttons`→customButtons(写面 customButtonJson JSON 数组字符串;bindAction/useLocation/operateType/showPermType 以枚举名发送;triggerType 强制 QUERY、triggerCode=视图 code、sortKey 按数组位,缺省回传读面 customButtons 有效集;ADD_DATA/FORM 目标绑定走 actionConfig——schemaCodeVal+formListData+configureList,targetCode/targetObjCode 对其无效会被拒;高层参数 targetModel/targetForm/configureList 从读回元数据展开,未解析即 listview-button-target-unresolved 零副作用拒)、`options`→视图头 BizQueryOption(`pagingSetting`{pageSize,showTotal} 分页、`listViewModeSetting`{mode,canSwitch} 列表模式,缺省回传读面有效 options、提供时整体替换,rowColorSetting 无 8.6.26 类证据故对象形态拒绝)与 `presentationType`→QueryPresentationType(LIST/BOARD/CALENDAR/GANTT,缺省回传读面有效值;GANTT 必须同时提供 `gantt`→queryGanttModel 且 startTimePropertyCode/endTimePropertyCode/titlePropertyCode 非空,缺省不触碰既有 gantt)与 `queryLayer`→层级展示(BizQueryLayer[] 数组原样发送)及 `multiTableHeaderConfig`→多级表头(HeaderConfig[] JSON 字符串;缺省回传读面有效值、提供时整体替换)省略时不触碰既有值,提供时整体替换并经出门前 dry-lint;`query/update` 后回读。`queryConditionMap` 为只读派生(query/get 带 formCode 子表条件时才出现),非配置输入。**发布语义**:`query/update` 自动置 publish=TRUE——视图无草稿/发布两态、无需独立发布步骤。**依赖顺序**:视图与表单脚手架都依赖**已发布字段**,规范顺序 model.create → field.create → field.publish(模型级)→ form.draft → form.publish →(需要第二视图时 listview.create)→ listview.configure → rule.save → rule.enable → workflow。",
129
+ description: "配置列表视图(列、排序、查询条件、行/列表按钮、呈现、自定义按钮、视图头扩展选项与视图类型)。**code 语义**:省略 `code`(或 code=schemaCode)= 配置**默认视图**(code = 模型 code,8.6.41 起默认视图同样可 configure),日常配列就用它,**不要先 listview.create**(会多一个视图);改默认视图影响所有用户;仅需第二个视图时才 listview.create(configure 带 code 指向它)。`fieldCodes` 可省略——**省略=不动列**(只改排序/筛选/动作时不必重发列集合;`replaceColumns:true` 仍必须带 fieldCodes,全空参数零写入拒)。读回 query,按 `fieldCodes` 追加缺失列或**原地修正**已存在列的 name/propertyType/displayFormat/visible(不再跳过既有列),置为可见;数值列 displayFormat 由字段 0 基 `options.scale` 推导(0=整数,1=1位,2=2位,3=3位…8=8位)、日期列由 `options.format` 推导(1/2/3/4),回显 `columns` 为完整列对象并给出 `added`/`updated`;`sorts`→querySorts(direction ASC/DESC)、`conditions`→queryConditions(**比较符是 `filterType`(QueryFilterType 字符串枚举 Eq/NotEq/…;别名 operator/op;省略时按 propertyType 取平台默认)**、displayType/choiceType/options 字符串解码;2.1.5 树视图过滤组三键 `treeLimitScopeType`/`treeLimitConditionGroup`/`treeDefaultConditionGroup` 原样透传(值不同默认拒 `listview-tree-conditions-changed`,确认改写传 `allowTreeConditionChange:true`;缺键拒 `listview-tree-conditions-would-be-lost`);写后条件回读等价校验给出 conditionReadback)、`actions`→queryActions(queryActionType QUERY(1)…BATCH_SUBMIT(23)、associationType BIZSHEET(0)/WORKFLOW(1))、`presentation`→queryPresentation(htmlJson/actionsJson/columnsJson/queryViewDataSource/schemaRelations/options 均为 JSON 字符串,合法 JSON 读回解码)、`buttons`→customButtons(写面 customButtonJson JSON 数组字符串;bindAction/useLocation/operateType/showPermType 以枚举名发送;triggerType 强制 QUERY、triggerCode=视图 code、sortKey 按数组位,缺省回传读面 customButtons 有效集;ADD_DATA/FORM 目标绑定走 actionConfig——schemaCodeVal+formListData+configureList,targetCode/targetObjCode 对其无效会被拒;高层参数 targetModel/targetForm/configureList 从读回元数据展开,未解析即 listview-button-target-unresolved 零副作用拒)、`options`→视图头 BizQueryOption(`pagingSetting`{pageSize,showTotal} 分页、`listViewModeSetting`{mode,canSwitch} 列表模式,缺省回传读面有效 options、提供时整体替换,rowColorSetting 无 8.6.26 类证据故对象形态拒绝)与 `presentationType`→QueryPresentationType(LIST/BOARD/CALENDAR/GANTT,缺省回传读面有效值;GANTT 必须同时提供 `gantt`→queryGanttModel 且 startTimePropertyCode/endTimePropertyCode/titlePropertyCode 非空,缺省不触碰既有 gantt)与 `queryLayer`→层级展示(BizQueryLayer[] 数组原样发送)及 `multiTableHeaderConfig`→多级表头(HeaderConfig[] JSON 字符串;缺省回传读面有效值、提供时整体替换)省略时不触碰既有值,提供时整体替换并经出门前 dry-lint;`query/update` 后回读。`queryConditionMap` 为只读派生(query/get 带 formCode 子表条件时才出现),非配置输入。**发布语义**:`query/update` 自动置 publish=TRUE——视图无草稿/发布两态、无需独立发布步骤。**依赖顺序**:视图与表单脚手架都依赖**已发布字段**,规范顺序 model.create → field.create → field.publish(模型级)→ form.draft → form.publish →(需要第二视图时 listview.create)→ listview.configure → rule.save → rule.enable → workflow。",
130
130
  }),
131
131
  "listview.delete": Object.freeze({
132
132
  scope: LIST_VIEW_SCOPE,
@@ -515,6 +515,32 @@ const LISTVIEW_CONDITION_KEYS = new Set([
515
515
  // listview-condition-unknown-key 会把「原样带回」的路堵死),值原样透传。
516
516
  ...LISTVIEW_TREE_CONDITION_KEYS,
517
517
  ]);
518
+ /**
519
+ * F4(probe F / 0.8.11):`fieldCodes` 从必填转可选——只改排序/筛选/动作时不必
520
+ * 重发整份列集合(`sorts`/`conditions` 的文档语义本来就是「省略=不动」)。
521
+ * 但两种写仍然是零意图或自相矛盾的,必须在 preflight 零副作用拒收:
522
+ * - 一个可改项都没传 → 平台会照常 200 保存一份没有变化的视图(也会把
523
+ * `{...model}` 的读面回声写回),调用方白拿绿灯;
524
+ * - `replaceColumns:true` 却省略 `fieldCodes` → 「fieldCodes 即权威列全集」
525
+ * 没有全集可依,语义矛盾。
526
+ * 本清单是「传了就算有意图」的键面:`replaceColumns` 只是 `fieldCodes` 的修饰,
527
+ * `replaceActions`/`defaultActions` 只是 `actions` 的修饰,单传它们不算改配置。
528
+ */
529
+ export const LISTVIEW_CONFIGURE_INTENT_KEYS = Object.freeze([
530
+ "fieldCodes",
531
+ "hideDefaultSystemFields",
532
+ "sorts",
533
+ "conditions",
534
+ "actions",
535
+ "presentation",
536
+ "buttons",
537
+ "buttonScripts",
538
+ "options",
539
+ "presentationType",
540
+ "gantt",
541
+ "queryLayer",
542
+ "multiTableHeaderConfig",
543
+ ]);
518
544
  /**
519
545
  * Out-the-door dry lint for `sorts`/`conditions`/`actions`/`presentation`/
520
546
  * `buttons`/`options`. `omc call` bypasses zod, so this refuses a malformed list
@@ -524,6 +550,26 @@ const LISTVIEW_CONDITION_KEYS = new Set([
524
550
  * `listViewModeSetting` (rowColorSetting has no class).
525
551
  */
526
552
  export function assertListViewConfigureShape(args) {
553
+ // F4:replaceColumns 与「不动列」互斥——先报更具体的那条。
554
+ if (args.replaceColumns === true && (args.fieldCodes === undefined || args.fieldCodes.length === 0)) {
555
+ throw new ToolRefusalError({
556
+ status: "refused",
557
+ blocker: "listview-fieldcodes-required-for-replace",
558
+ nextAction: "replaceColumns:true 表示 fieldCodes 是权威列全集(未列出的列全部移除):请同时给出 fieldCodes(想保留的业务列/系统列都写进去),只想改排序/筛选/动作就省略 replaceColumns。本次零写入。",
559
+ message: "replaceColumns:true 必须同时提供 fieldCodes——没有权威列集合可依(缺 fieldCodes 时本工具不动列,与「按 fieldCodes 重建列」自相矛盾)。本次零写入,视图未被修改。",
560
+ });
561
+ }
562
+ const provided = args;
563
+ if (!LISTVIEW_CONFIGURE_INTENT_KEYS.some((key) => provided[key] !== undefined)) {
564
+ throw new ToolRefusalError({
565
+ status: "refused",
566
+ blocker: "listview-configure-no-intent",
567
+ nextAction: `至少传一个要改的项(${LISTVIEW_CONFIGURE_INTENT_KEYS.join(" / ")})再调用;` +
568
+ "只读盘点用 listview.get。本次零写入。",
569
+ message: "listview.configure 没有收到任何要修改的项:这是一次零意图的写(平台会照常保存并回 200)。" +
570
+ `至少传一个:${LISTVIEW_CONFIGURE_INTENT_KEYS.join(" / ")}。`,
571
+ });
572
+ }
527
573
  const lists = [
528
574
  ["sorts", args.sorts],
529
575
  ["conditions", args.conditions],