@stalfh233/omc-cli 0.8.10 → 0.8.12

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.
@@ -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 } : {}),
@@ -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",
@@ -2043,6 +2056,52 @@ async function assertFieldPublishRelations(session, schemaCode) {
2043
2056
  throw new ToolRefusalError({ status: "refused", blocker: "relation-target-not-found", schemaCode, message: relationFailure, candidates: relationCandidates.slice(0, 5) });
2044
2057
  return relationCandidates;
2045
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
+ }
2046
2105
  export async function executeFieldPublish(session, args) {
2047
2106
  // bizproperty/publish is MODEL-SCOPED: one call publishes every draft
2048
2107
  // field of the schema. `code`/`codes` only select which fields to verify
@@ -2211,9 +2270,23 @@ export async function executeFieldPublish(session, args) {
2211
2270
  }
2212
2271
  const publishOutcome = performed;
2213
2272
  const readback = await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: args.schemaCode, isPublish: "true" } });
2214
- 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);
2215
2275
  const requested = [...(args.code ? [args.code] : []), ...(args.codes ?? [])];
2216
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))]);
2217
2290
  // r32(真机复现 0.6.13):`codes:["g1","notExist"]` 回 ok + DELIVERED +
2218
2291
  // allRequestedPresent:false + verification.ok:true —— 三个成功标记与「有请求的
2219
2292
  // 字段不在发布面」同真。不在发布面的 code 分两类,报法不同:
@@ -2223,9 +2296,9 @@ export async function executeFieldPublish(session, args) {
2223
2296
  // 判失败;但既有的 verified/ok、allRequestedPresent、verification.ok 都不能
2224
2297
  // 再报 true(派生的 readback.present=false 会让共享写门把 deliveryState 降为
2225
2298
  // 既有枚举值 WRITE_UNVERIFIED——刻意不新增枚举外的值)。
2226
- const missingRequested = requested.filter((code) => !present.includes(code));
2227
- const nonexistentCodes = missingRequested.filter((code) => !draftCodesBefore.has(code));
2228
- 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));
2229
2302
  const allRequestedPresent = missingRequested.length === 0;
2230
2303
  const targets = (requested.length > 0 ? requested : [...draftSnapshot.keys()]).filter((code) => publishedCodes.includes(code));
2231
2304
  const verificationRun = await verifyFieldDetails(targets);
@@ -2263,8 +2336,11 @@ export async function executeFieldPublish(session, args) {
2263
2336
  "平台无「单独发布」也无「取消发布」端点,这一步不可撤销;如需让它们不生效只能用 field.delete(会丢该列数据)。",
2264
2337
  }
2265
2338
  : {}),
2266
- ...(args.code ? { publishedFieldPresent: publishedCodes.includes(args.code) } : {}),
2267
- ...(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 } : {}),
2268
2344
  ...(requested.length > 0
2269
2345
  ? {
2270
2346
  allRequestedPresent,
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { ENDPOINTS } from "../endpoints.js";
3
3
  import { decodeButtonScript } from "./list-view.js";
4
- import { executeFormDraftWrite, executeFormPublishWrite, executeFormRunButtonWrite, lintFormPublishReadOnly, lintFormControlTypes, readFormButtons, readFormOrNull, refuseEmptyCallerLayout, validateHtmlRender, customButtonJsonStoredShape, CUSTOM_BUTTON_JSON_STRING_SHAPE_WARNING, FORM_FLAG_AUTHORITY_NOTE, compareFormFaces, resolveEffectiveFormFace } from "../form-support.js";
4
+ import { executeFormDraftWrite, executeFormPublishWrite, executeFormRunButtonWrite, lintFormPublishReadOnly, lintFormControlTypes, readFormButtons, readFormOrNull, refuseEmptyCallerLayout, validateHtmlRender, customButtonJsonStoredShape, CUSTOM_BUTTON_JSON_STRING_SHAPE_WARNING, FORM_FLAG_AUTHORITY_NOTE, compareFormFaces, resolveEffectiveFormFace, composeFormLayoutDraft, assertLayoutRequestConflicts } from "../form-support.js";
5
5
  import { capabilityArg, environmentArg } from "../args.js";
6
6
  import { governedRead } from "../read.js";
7
7
  import { writeTool } from "../write.js";
@@ -573,6 +573,14 @@ export function registerFormLane(tools) {
573
573
  sheetCode: z.string().min(1).optional().describe("表单槽位码;省略时默认 = schemaCode(模型码即默认表单槽位)"),
574
574
  draftViewJson: z.string().optional().describe("行分组:JSON 二维字符串数组 `[[\"codeA\",\"codeB\"],[\"codeC\"]]`——**一行几个 code 就是几列**(不是改 span 来改列数);末行只放一个 code 即整宽。每个 code 必须同时出现在 draftAttributesJson 里。现成样例:`omc describe form.draft --example two-column-layout`"),
575
575
  draftAttributesJson: z.string().optional().describe("控件表:JSON 对象 `{ \"codeA\": { key:\"codeA\", type: <表单控件类型号>, options:{ name:\"显示名\", span: 12 } } }`。**控件 type 是表单控件枚举,不是字段 propertyType**(80=关联单选/201=子表…);错枚举拒 `form-control-type-mismatch`。`span` 是 24 栅格宽度:两列各 span:12、整宽 span:24(须与 draftViewJson 行分组自洽)。样例:`omc describe form.draft --example two-column-layout`"),
576
+ layout: z
577
+ .object({
578
+ rows: z.array(z.array(z.string().min(1)).min(1)).min(1),
579
+ spans: z.record(z.string(), z.number().int().positive()).optional(),
580
+ includeSystem: z.boolean().optional(),
581
+ })
582
+ .optional()
583
+ .describe("增量布局(推荐):{rows:[[\"a\",\"b\"],[\"c\"]],spans?:{a:12},includeSystem?}。以已发布(无则草稿)表单为基线,只改 rows 行分组与这些控件 span,**不必回传整包 attrs**;未列入 rows 的控件保留原行,系统控件须 includeSystem:true 才动。与 draftViewJson/draftAttributesJson/rebuild 互斥"),
576
584
  allowTypeMismatch: z.boolean().optional().describe("放行控件 type 与字段 propertyType 不匹配(默认拒 form-control-type-mismatch;仅平台模板明确要求特殊控件时用)"),
577
585
  draftHtmlJson: z.string().optional(),
578
586
  fieldCodes: z.array(z.string().min(1)).optional().describe("脚手架绑定的已发布字段(按此顺序);由 configure_form/intent 显式传入。子表列写「父字段.子列」等价于 childColumns"),
@@ -597,13 +605,26 @@ export function registerFormLane(tools) {
597
605
  preflight: (args) => {
598
606
  // Zero-wire refusal (ticket 74): fires in semanticGate BEFORE the
599
607
  // governed pipeline — including the rollback before-capture read.
600
- refuseEmptyCallerLayout({ ...args, sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode) });
608
+ const resolved = { ...args, sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode) };
609
+ // layout 是增量面,与整包布局/重建参数互斥:纯参数门,零 wire。
610
+ assertLayoutRequestConflicts(resolved);
611
+ refuseEmptyCallerLayout(resolved);
601
612
  },
602
613
  // R75-B seam: dry-run 与真写共用这一个 session 只读 lint(dry-run 直接跑它)。
603
614
  // 控件 type 交叉校验需要 field.list(propertyType 是另一套枚举),纯参数门
604
615
  // 拿不到;放进这里才能让 `--dry-run` 与真写同答案。executeFormDraftWrite 里
605
616
  // 再跑同一函数,直调执行器的路径也绕不过去。
606
617
  writeLint: async (session, args) => {
618
+ // layout 面:dry-run 直接跑与真写同一个 composeFormLayoutDraft(读基线 →
619
+ // 重排 rows/span → 过布局门),预览里的 layout 回执即真写会写下的形状。
620
+ if (args.layout !== undefined) {
621
+ const composed = await composeFormLayoutDraft(session, {
622
+ schemaCode: args.schemaCode,
623
+ sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode),
624
+ layout: args.layout,
625
+ });
626
+ return { layout: composed.receipt, ...(composed.warnings.length > 0 ? { layoutWarnings: composed.warnings } : {}) };
627
+ }
607
628
  if (args.fromReadback === true)
608
629
  return { controlTypeCheck: "skipped-fromReadback" };
609
630
  const lint = await lintFormControlTypes(session, {
@@ -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],