@stalfh233/omc-cli 0.8.5 → 0.8.7

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.
Files changed (46) hide show
  1. package/coverage/m1-coverage-manifest-v1.json +1 -0
  2. package/dist/approval-flow.js +49 -4
  3. package/dist/batch-call.js +21 -4
  4. package/dist/bench/scenario.js +1 -1
  5. package/dist/cli-stdout.js +1 -0
  6. package/dist/cli.js +84 -3
  7. package/dist/code-rules.js +144 -8
  8. package/dist/config-store.js +15 -1
  9. package/dist/coverage.js +2 -1
  10. package/dist/discovery.js +8 -2
  11. package/dist/endpoints.js +10 -0
  12. package/dist/form-layout.js +79 -0
  13. package/dist/form-support.js +65 -1
  14. package/dist/goal-routes.js +35 -5
  15. package/dist/graph.js +38 -3
  16. package/dist/human-summary.js +38 -2
  17. package/dist/intent/capabilities/field.js +1 -1
  18. package/dist/lanes/field-contract.js +4 -0
  19. package/dist/lanes/field-coverage.js +1 -0
  20. package/dist/lanes/field.js +20 -2
  21. package/dist/lanes/form-contract.js +1 -1
  22. package/dist/lanes/form.js +25 -3
  23. package/dist/lanes/list-view.js +21 -11
  24. package/dist/lanes/model-contract.js +2 -2
  25. package/dist/lanes/model-references.js +172 -0
  26. package/dist/lanes/model.js +226 -129
  27. package/dist/lanes/runtime-data-contract.js +3 -3
  28. package/dist/lanes/runtime-data.js +64 -8
  29. package/dist/lanes/workflow.js +91 -1
  30. package/dist/model-purge.js +1 -1
  31. package/dist/model-scaffold.js +6 -3
  32. package/dist/recipes/form.js +33 -6
  33. package/dist/recipes/runtime-data.js +1 -1
  34. package/dist/reserved.js +28 -0
  35. package/dist/residue.js +1 -1
  36. package/dist/tool-types.js +1 -0
  37. package/dist/version-family-gaps.js +33 -6
  38. package/dist/write.js +46 -8
  39. package/package.json +3 -3
  40. package/skills/omc-business-configuration.md +7 -0
  41. package/skills/omc-capabilities.md +1 -1
  42. package/skills/omc-playbook.md +5 -0
  43. package/skills/omc-refusals.md +4 -2
  44. package/skills/omc-start-here.md +1 -1
  45. package/skills/omc-tool-selection.md +2 -0
  46. package/skills/omc-write-hazards.md +3 -0
@@ -11,7 +11,15 @@
11
11
  * 3. a full-width control (span 24) occupies its row alone;
12
12
  * 4. every attribute control appears in `rows` exactly once — nothing extra,
13
13
  * nothing missing, no duplicates.
14
+ *
15
+ * ALSO: the control `type` inside attributes JSON is the FORM-CONTROL enum, NOT
16
+ * the field `propertyType`. See `controlTypeMismatches` below — the two are
17
+ * different numeric enums (2.1.5 probe B: published `customer` is 80 while the
18
+ * field is WORK_SHEET=9; writing 9 stores fine and reads back silently wrong).
14
19
  */
20
+ import { CAPABILITY_CONTROL_TYPES } from "./capability-shape.js";
21
+ import { FIELD_CONTROL_CODES } from "./lanes/field-contract.js";
22
+ import { SYSTEM_FIELD_CODES, familyName } from "./field-families.js";
15
23
  export const ALLOWED_SPANS = new Set([6, 8, 12, 16, 18, 24]);
16
24
  export const FULL_SPAN = 24;
17
25
  /**
@@ -146,4 +154,75 @@ export function validateFormLayout(rows, attributes) {
146
154
  });
147
155
  return violations;
148
156
  }
157
+ /**
158
+ * The one-line enum reminder attached to every `form-control-type-mismatch`
159
+ * refusal. Names come from `BizFormPropertyType` (backend, 2.1.5/8.6.26) and the
160
+ * designer's BPM type table (frontend `admin/src/template/template.ts:22-200`).
161
+ */
162
+ export const FORM_CONTROL_TYPE_HINT = "表单控件 type 与字段 propertyType 是**两套枚举**:控件 1=单行文本 2=多行文本 3=日期 4=数值 5=单选 6=复选 7=下拉 8=逻辑 80=关联单选 81=关联多选 201=子表 …(对应 propertyType 0/1/3/2/12/13/14/4/9/11/8)。";
163
+ /**
164
+ * Cross-check `attributes[code].type` (form-control enum) against the published
165
+ * field's `propertyType` (BizPropertyType enum). Both sides are required before
166
+ * anything is refused:
167
+ * - only codes resolvable on the published `field.list` face are checked;
168
+ * - system fields / layout widgets are skipped (`skipCodes`, plus Title/Group
169
+ * never resolve on field.list);
170
+ * - a missing/unknown control `type` is never guessed (custom designer codes
171
+ * such as 1001/1201 stay untouched);
172
+ * - a propertyType with no evidenced control mapping is skipped (COMMENT=7…).
173
+ *
174
+ * Evidence — backend: BizFormPropertyType.java:13-51 (1/2/3/4/5/6/7/8/9/19/80/
175
+ * 81/82/89/90/100-106/201…), BizPropertyType.java:27-54 (0/1/2/3/4/…/9/11/14).
176
+ * Frontend: admin/src/template/template.ts:22-200 (a-text=1, a-textarea=2,
177
+ * a-date=3, a-number=4, a-dropdown=7, a-logic=8, a-association-form=80,
178
+ * a-sheet=201). The mapping itself is the shared CAPABILITY_CONTROL_TYPES table
179
+ * (`field-families.ts` FIELD_CONTROL_TYPES is its public alias).
180
+ */
181
+ export function controlTypeMismatches(attributes, fields, skipCodes = SYSTEM_FIELD_CODES) {
182
+ const attrs = attributes && typeof attributes === "object" && !Array.isArray(attributes) ? attributes : undefined;
183
+ if (attrs === undefined)
184
+ return [];
185
+ const skipped = new Set(skipCodes);
186
+ const propertyTypes = new Map();
187
+ for (const field of fields) {
188
+ if (typeof field.code !== "string" || field.code === "")
189
+ continue;
190
+ // Serial-number fields are SHORT_TEXT(0) on the field face but carry the
191
+ // SequenceNo control (100) — the mapping table would read 0 → 1. Their
192
+ // control face is field-options-owned (`formPropertyType:100` /
193
+ // `seqNoSetting`, field-families.ts:193), so skip instead of guessing.
194
+ if (typeof field.options === "string" && /"(formPropertyType|seqNoSetting)"\s*:/.test(field.options))
195
+ skipped.add(field.code);
196
+ const propertyType = Number(field.propertyType ?? field.type);
197
+ if (Number.isInteger(propertyType))
198
+ propertyTypes.set(field.code, propertyType);
199
+ }
200
+ const mismatches = [];
201
+ for (const [code, control] of Object.entries(attrs)) {
202
+ if (skipped.has(code))
203
+ continue;
204
+ if (!control || typeof control !== "object")
205
+ continue;
206
+ const rawType = control.type;
207
+ if (rawType === undefined || rawType === null || rawType === "")
208
+ continue;
209
+ const givenType = Number(rawType);
210
+ if (!Number.isInteger(givenType))
211
+ continue;
212
+ // Unknown/custom control codes are NOT guessed.
213
+ const known = FIELD_CONTROL_CODES[givenType];
214
+ if (known === undefined || (known.status !== "known" && known.status !== "designer"))
215
+ continue;
216
+ const propertyType = propertyTypes.get(code);
217
+ if (propertyType === undefined)
218
+ continue;
219
+ const expectedType = CAPABILITY_CONTROL_TYPES[propertyType];
220
+ if (expectedType === undefined)
221
+ continue;
222
+ if (givenType === expectedType)
223
+ continue;
224
+ mismatches.push({ code, givenType, expectedType, propertyType, fieldTypeName: familyName(propertyType) });
225
+ }
226
+ return mismatches;
227
+ }
149
228
  //# sourceMappingURL=form-layout.js.map
@@ -4,7 +4,7 @@ import { decodeJsonObjectColumn } from "./json-column.js";
4
4
  import { ToolRefusalError } from "./tool-types.js";
5
5
  import { FIELD_CONTROL_TYPES, childColumnsOf, SYSTEM_FIELD_CODES, fieldControlOptions, relationDisplayField, relationMappings, } from "./field-families.js";
6
6
  import { deriveControlOptions } from "./capability-shape.js";
7
- import { hardLayoutViolations, validateFormLayoutShape } from "./form-layout.js";
7
+ import { hardLayoutViolations, validateFormLayoutShape, controlTypeMismatches, FORM_CONTROL_TYPE_HINT } from "./form-layout.js";
8
8
  /**
9
9
  * Propagate each relation field's `options.mappings` into its form control so
10
10
  * the form-fill carry is configured where the form renderer reads it. The
@@ -805,6 +805,46 @@ export function assertCallerFormLayout(args) {
805
805
  });
806
806
  }
807
807
  }
808
+ export async function lintFormControlTypes(session, args) {
809
+ if (typeof args.draftAttributesJson !== "string")
810
+ return undefined;
811
+ let attributes;
812
+ try {
813
+ attributes = JSON.parse(args.draftAttributesJson);
814
+ }
815
+ catch {
816
+ return undefined; // JSON errors are the caller's layout gate's business.
817
+ }
818
+ if (!attributes || typeof attributes !== "object" || Array.isArray(attributes))
819
+ return undefined;
820
+ let rows;
821
+ try {
822
+ rows = wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: args.schemaCode, isPublish: "true" } })).data);
823
+ }
824
+ catch {
825
+ // No published field face (absent schema / no fields yet): nothing to
826
+ // resolve against — do NOT guess and do NOT invent a new refusal.
827
+ return { mismatches: [], allowed: false, fieldListRead: false };
828
+ }
829
+ const mismatches = controlTypeMismatches(attributes, rows);
830
+ if (mismatches.length === 0)
831
+ return { mismatches, allowed: false, fieldListRead: true };
832
+ if (args.allowTypeMismatch === true)
833
+ return { mismatches, allowed: true, fieldListRead: true };
834
+ throw new ToolRefusalError({
835
+ status: "refused",
836
+ blocker: "form-control-type-mismatch",
837
+ schemaCode: args.schemaCode,
838
+ sheetCode: args.sheetCode,
839
+ mismatches,
840
+ hint: FORM_CONTROL_TYPE_HINT,
841
+ nextCommand: `omc call form.get --args '${JSON.stringify({ schemaCode: args.schemaCode, full: true })}'`,
842
+ message: `控件 type 用错了枚举:${mismatches.map((item) => `${item.code} 给了 ${item.givenType},按字段 ${item.fieldTypeName}(propertyType=${item.propertyType}) 应为 ${item.expectedType}`).join(";")}。` +
843
+ `${FORM_CONTROL_TYPE_HINT}改既有表单必须先 ` +
844
+ `\`form.get full:true\` 取 publishedAttributesJson 作基线(只改 rows/span,不手拼控件 type);` +
845
+ `确属平台模板要求的特殊控件才传 allowTypeMismatch:true。`,
846
+ });
847
+ }
808
848
  /** Ticket 74 — control count on an attributes JSON face (0 when unparsable/absent). */
809
849
  function controlCount(face) {
810
850
  if (typeof face !== "string")
@@ -1480,6 +1520,23 @@ export async function executeFormDraftWrite(session, args) {
1480
1520
  : `fieldCodes 引用了模型 ${args.schemaCode} 发布面上不存在的字段:${selectionUnknown.join("、")};先 field.create + field.publish 这些字段,或修正 fieldCodes`,
1481
1521
  });
1482
1522
  }
1523
+ // 控件 type 是**表单控件枚举**(BizFormPropertyType),不是字段 propertyType
1524
+ // (probe B F1,2.1.5 真机:已发布 customer=80 而字段 WORK_SHEET=9)。这条
1525
+ // 交叉校验放在创建/写入任何 wire 之前:错枚举的布局平台照存、回读不报错,
1526
+ // 只有渲染时才坏。`fromReadback:true` 是逐字回写平台面、`amendChildColumns`
1527
+ // 是工具从已存平台布局追加子表列——两者都不是手写布局,跳过;调用方显式
1528
+ // allowTypeMismatch:true 时降级为回执 warning(不偷偷改用户输入)。
1529
+ let controlTypeWarnings;
1530
+ if (args.draftAttributesJson !== undefined && args.fromReadback !== true && args.amendChildColumns !== true) {
1531
+ const typeLint = await lintFormControlTypes(session, {
1532
+ schemaCode: args.schemaCode,
1533
+ sheetCode: args.sheetCode,
1534
+ draftAttributesJson: args.draftAttributesJson,
1535
+ ...(args.allowTypeMismatch !== undefined ? { allowTypeMismatch: args.allowTypeMismatch } : {}),
1536
+ });
1537
+ if (typeLint !== undefined && typeLint.mismatches.length > 0)
1538
+ controlTypeWarnings = typeLint.mismatches;
1539
+ }
1483
1540
  // The default form may not exist yet on a freshly created model
1484
1541
  // (bizmodels/create seeds no form) — create it, then scaffold into it.
1485
1542
  let pre = await readFormOrNull(session, args.schemaCode, args.sheetCode);
@@ -1774,6 +1831,13 @@ export async function executeFormDraftWrite(session, args) {
1774
1831
  // stored column is the stringified form the form page refuses to render.
1775
1832
  ...(customButtonJsonStoredShape(sheet.options) === "string" ? { formButtonsShapeWarning: CUSTOM_BUTTON_JSON_STRING_SHAPE_WARNING } : {}),
1776
1833
  ...(mergedOptions !== undefined ? { customButtonJsonWritten: true } : {}),
1834
+ ...(controlTypeWarnings !== undefined
1835
+ ? {
1836
+ controlTypeMismatchAllowed: true,
1837
+ controlTypeMismatches: controlTypeWarnings,
1838
+ controlTypeNote: `allowTypeMismatch:true 显式放行;${FORM_CONTROL_TYPE_HINT}本工具不替你改控件 type。`,
1839
+ }
1840
+ : {}),
1777
1841
  ...(roundTripFaces.size > 0
1778
1842
  ? {
1779
1843
  layoutGate: "platform-roundtrip",
@@ -13,10 +13,19 @@ import { surfaceRefFor } from "./surface-ref.js";
13
13
  */
14
14
  const SCOUT_CUES = ["能不能", "能不能够", "能否", "是否支持", "支持吗", "支持不支持", "可不可以", "有没有办法", "有没有可能", "怎么实现", "如何实现", "怎么写", "怎么配置"];
15
15
  const MODIFY_CUES = ["修改", "调整", "更新", "重命名", "改名", "编辑", "删除", "去掉", "移除", "改为", "改成"];
16
- const READ_CUES = ["查看", "读回", "盘点", "现状", "列出", "有哪些", "有没有", "检查", "审计", "导出", "只读", "看看", "看下", "查一下", "查询一下", "查一查", "梳理", "清点", "给我一份", "哪些", "是什么", "是否", "是否正确", "现有", "已有", "条数", "多少条", "数一下", "有几条", "几条", "有几个", "几个", "几笔", "多少个", "名单", "分布", "排查", "日志", "执行记录", "触发了吗", "触发失败", "调用记录"];
16
+ const READ_CUES = ["查看", "读回", "盘点", "现状", "列出", "有哪些", "有没有", "检查", "审计", "导出", "只读", "看看", "看下", "查一下", "查询一下", "查一查", "梳理", "清点", "给我一份", "哪些", "是什么", "是否", "是否正确", "现有", "已有", "多少条", "数一下", "有几条", "几条", "有几个", "几个", "几笔", "多少个", "名单", "分布", "排查", "日志", "执行记录", "触发了吗", "触发失败", "调用记录"];
17
17
  // r67a:「排查/日志/执行记录/触发了吗/触发失败/调用记录」——运行面排障问句全是读意图
18
18
  // (r67a 真机调查:「规则触发失败了怎么排查」被写阶梯抢走,next 不消费工具级 intents,
19
- // 只能在 READ_CUES 层修)。裸「查」仍不进(见下条注释的匹配方向)。
19
+ // 只能在 READ_CUES 层修)。裸「查」仍不进(见注释的匹配方向)。
20
+ //
21
+ // 0.8.6 P1(探针复现,P1 原句):「…两节点审批流并跑通一条实例、2 条数据」判成
22
+ // mode:"read" + write:false 的只读清单。归因是裸「条数」按 includes 匹配到
23
+ // 「2 条**数**据」的子串——与同文件的 AGGREGATE_ASK / GRAPH_AGGREGATE_RE
24
+ // 的 r70 教训同源,那两处早已写成 `条数(?!据)`。所以这里不能简单删词,改为
25
+ // 同一否定前瞻的独立词表:
26
+ // 正例(必须仍 read)「查一下订单有多少条数」——条数后不是「据」,命中;
27
+ // 反例(必须不因它判 read)「保存并启用一条数据事件规则」「…2 条数据」。
28
+ const READ_CUE_PATTERNS = [/条数(?!据)/];
20
29
  const BUILD_CUES = ["新建", "创建", "搭建", "从零", "从无到有", "做", "建", "加", "实现", "生成", "新增", "保存", "启用", "录入", "添加", "造", "填报", "打卡"];
21
30
  // r67a:删裸单字「录」——「录入」已在列,「录」单字会误吃「查看调用记**录**/执行记**录**」这类
22
31
  // 读问句(真机调查:「业务方法调用记录在哪看」被 build 抢走)。
@@ -103,6 +112,20 @@ const WRITE_DESTINATION = /(写入|写到|写进|回写|落到|存到|更新到|
103
112
  // 前导的「应用目录树看一下」)。
104
113
  const READ_INVENTORY_VERBS = /(查|看|列|盘点|清点|梳理|导出|搜)/;
105
114
  const READ_INVENTORY_NOUNS = /(应用|目录|树|清单|列表|环境)/;
115
+ /**
116
+ * 复合名词剥离(0.8.6 P1,探针复现):`列表` 是 **列表视图**(listview 能力面)
117
+ * 的子串——整包写需求「…表单发布、列表视图、金额数据规则、两节点审批流…」没有
118
+ * 任何裸写词(「交付/发布」都不在 BUILD/MODIFY/裸写词表),于是名词「列表」+
119
+ * 动词「列」同时命中,被误判成读盘点(mode:"read"、write:false)。
120
+ *
121
+ * 判据:做动词×名词匹配前,先把平台面**复合名词**从句子里抹掉。这样连
122
+ * 复合词内部的「列」也不会冒充读动词(例如「…列表视图、还有一个应用」)。
123
+ * 这不是删名词——真盘点问句不含「视图」,照旧命中:
124
+ * 反例(必须仍 read)「列出用户列表」「查应用列表和目录树」「应用目录树看一下」;
125
+ * 正例(必须不被本判定改判 read)「配一个列表视图」「建模型 + 列表视图 + 审批流」
126
+ * (二者另由写词否决兜住)以及 P1 整包原句(无裸写词,只能靠剥离复合词放行)。
127
+ */
128
+ const READ_INVENTORY_COMPOUNDS = /列表视图/g;
106
129
  /** 裸单字写词:不在 BUILD/MODIFY cues 里、但出现在写问句中的高频字(含「配」)。 */
107
130
  const READ_INVENTORY_WRITE_WORDS = /(建|加|搭|配|删|改|造|写|做)/;
108
131
  /** r67-01-F1/F2:whole-package 门前的读盘点判定(词面与理由见上方注释)。 */
@@ -114,7 +137,8 @@ function looksReadInventoryAsk(goal) {
114
137
  return false;
115
138
  if (MODIFY_CUES.some((cue) => goal.includes(cue)))
116
139
  return false;
117
- return READ_INVENTORY_VERBS.test(goal) && READ_INVENTORY_NOUNS.test(goal);
140
+ const scoped = goal.replace(READ_INVENTORY_COMPOUNDS, "");
141
+ return READ_INVENTORY_VERBS.test(scoped) && READ_INVENTORY_NOUNS.test(scoped);
118
142
  }
119
143
  function detectMode(goal) {
120
144
  if (SCOUT_CUES.some((cue) => goal.includes(cue)))
@@ -125,7 +149,7 @@ function detectMode(goal) {
125
149
  return "modify";
126
150
  if (build)
127
151
  return "build";
128
- if (READ_CUES.some((cue) => goal.includes(cue)))
152
+ if (READ_CUES.some((cue) => goal.includes(cue)) || READ_CUE_PATTERNS.some((pattern) => pattern.test(goal)))
129
153
  return "read";
130
154
  const lead = goal.trimStart();
131
155
  if (LEADING_READ_VERBS.some((verb) => lead.startsWith(verb)) && !/^(查重|查错)/.test(lead))
@@ -427,8 +451,14 @@ const FIRST_SECTION_INLINE_BUDGET_BYTES = 2048;
427
451
  * recipes, so its inline section budget is tighter — the 4096B `next` ceiling
428
452
  * must survive a ladder + a 2.5KB section (r18: "工作流审批流程" would have
429
453
  * been 4729B). Single-capability routes keep the fuller budget (F9).
454
+ *
455
+ * w30: 1200 → 1600. skills 增长后最常用的小节(模型与字段)实测 1276B(工单记录
456
+ * 1443B 来自另一 skills 快照;本轮 HEAD 复测 1276B),已越过 1200B,内联对每个
457
+ * ladder 任务全线失效(每次多一跳 `help --section`,约 0.5s)。
458
+ * 1600 覆盖最常见小节(模型与字段),仍不内联 2473B(表单与视图)/2540B
459
+ * (流程字段权限)这类大节。代价:ladder 回执最多 +1.6KB。
430
460
  */
431
- const LADDER_INLINE_BUDGET_BYTES = 1200;
461
+ const LADDER_INLINE_BUDGET_BYTES = 1600;
432
462
  function routeReads(readSections, recipeMatched = false, inlineBudget = FIRST_SECTION_INLINE_BUDGET_BYTES) {
433
463
  const budgeted = pickSectionPointer(readSections, recipeMatched).map((pointer) => ({ ...pointer, bytes: sectionBytes(pointer) }));
434
464
  // Inline the ONE pointer's content when it fits the budget: the agent then
package/dist/graph.js CHANGED
@@ -1262,6 +1262,28 @@ function openGraphIndex(selector = {}) {
1262
1262
  throw error instanceof GraphIndexError ? error : new GraphIndexUnreadableError(`索引不可读(schema 不匹配或文件损坏):${error instanceof Error ? error.message : String(error)};重跑 omc graph pull`);
1263
1263
  }
1264
1264
  }
1265
+ /**
1266
+ * issue 07(2026-11-18 真机摩擦)CLI 面补齐:零命中 ≠ 无引用。
1267
+ *
1268
+ * 索引只到服务 code,业务规则里的 `methodMapping.serviceMethodCode`
1269
+ *(`addOrderLedger` 之流)不建边——探针曾据 `matches:[]` 差点判「没人调用、可删」。
1270
+ * MCP 面已在 `src/mcp-graph.ts:502` 给出 `granularityUnsupported`;本函数是 CLI
1271
+ * 面(references / impact)的**同源**构造:文案直接取自
1272
+ * `GRAPH_NOT_INDEXED_GRANULARITIES` 的 `service.method` 条目,不另起一套措辞。
1273
+ *
1274
+ * 只在 `kind === "service"` 时返回;调用方再叠加「零命中」条件,有命中时不出
1275
+ *(不给正常答案加噪声)。
1276
+ */
1277
+ export function serviceMethodGranularityUnsupported(kind) {
1278
+ if (kind !== "service")
1279
+ return undefined;
1280
+ const methodGranularity = GRAPH_NOT_INDEXED_GRANULARITIES.find((item) => item.face === "service.method");
1281
+ return {
1282
+ methodLevelIndexed: false,
1283
+ reason: `0 ≠ 无引用:${methodGranularity?.zh ?? "索引不覆盖服务方法级(methodMapping.serviceMethodCode)"}`,
1284
+ suggestion: methodGranularity?.how ?? "先 omc call rule.list 拿规则清单,再逐条 omc call rule.get 查 methodMapping.serviceMethodCode",
1285
+ };
1286
+ }
1265
1287
  export const GRAPH_NOT_INDEXED_GRANULARITIES = Object.freeze([
1266
1288
  Object.freeze({
1267
1289
  face: "service.method",
@@ -1534,6 +1556,8 @@ export function queryGraphReferences(kind, rawCode, selector = {}) {
1534
1556
  const unscopedFieldNote = kind === "field" && scoped === null && otherSchemas.length > 0
1535
1557
  ? `裸字段 code 会跨模型合并同名:本次命中来自 ${otherSchemas.join("、")}(各自的同名字段)。要只查某一个模型的该字段,写 <schemaCode>.<字段code>(如 crm_contract.${code})——datarule/listview 只能引用本模型字段,所以按宿主模型过滤是精确的。`
1536
1558
  : undefined;
1559
+ // issue 07(CLI 面):只在 service 零命中时出现(有命中 / 非 service 都不加)。
1560
+ const granularityUnsupported = matches.length === 0 ? serviceMethodGranularityUnsupported(kind) : undefined;
1537
1561
  return {
1538
1562
  kind,
1539
1563
  code: rawCode,
@@ -1544,13 +1568,17 @@ export function queryGraphReferences(kind, rawCode, selector = {}) {
1544
1568
  index: summary,
1545
1569
  ...(matches.length === 0
1546
1570
  ? {
1571
+ // issue 07(CLI 面):零命中≠无引用。service 方法级未索引,note 不再给
1572
+ // 「没有引用它」这种结论句;粒度边界由 granularityUnsupported 承接。
1547
1573
  note: (gapped
1548
1574
  ? "零命中,但索引存在扫描缺口——不可作为「无引用」证明;先 omc graph pull 重建再查"
1549
- : `零命中=scanned 面(规则/数据规则/视图/表单/流程)没有引用它;本索引覆盖应用:${summary.coverage.applicationCodes.join("、") || "(未知)"},不代表其他应用没有引用;workflow.bindings 与 onlinejs 未扫描,见 coverage.notScanned——不可据此判定可安全删除`) +
1575
+ : `零命中=scanned 面(规则/数据规则/视图/表单/流程)零命中;本索引覆盖应用:${summary.coverage.applicationCodes.join("、") || "(未知)"},不代表其他应用没有引用;workflow.bindings 与 onlinejs 未扫描,见 coverage.notScanned——不可据此判定可安全删除`) +
1576
+ (kind === "service" ? ";service 方法级未索引,见 granularityUnsupported" : "") +
1550
1577
  (zeroHitKindHint(db, kind, code, "references") ?? "") +
1551
1578
  (kind === "field" && scoped === null ? unresolvedScopedCodeNote(rawCode) ?? "" : ""),
1552
1579
  }
1553
1580
  : {}),
1581
+ ...(granularityUnsupported !== undefined ? { granularityUnsupported } : {}),
1554
1582
  ...(gapped
1555
1583
  ? { gapWarning: `索引有 ${summary.gaps.count} 个扫描缺口(${Object.entries(summary.gaps.byKind).map(([k, v]) => `${k}:${v}`).join(", ")});命中列表可能不完整` }
1556
1584
  : {}),
@@ -1809,6 +1837,9 @@ export function impactGraph(kind, rawCode, selector = {}) {
1809
1837
  return { schemaCode: row.schema_code, ruleCode: row.rule_code, name, matchedVia: via, touches };
1810
1838
  });
1811
1839
  const gapped = summary.gaps.count > 0;
1840
+ const zeroHit = hop1.length === 0 && dataruleHits.length === 0 && listViewHits.length === 0 && workflowHits.length === 0 && formHits.length === 0;
1841
+ // issue 07(CLI 面):只在 service 零命中时出现(有命中 / 非 service 都不加)。
1842
+ const granularityUnsupported = zeroHit ? serviceMethodGranularityUnsupported(kind) : undefined;
1812
1843
  return {
1813
1844
  kind,
1814
1845
  code: rawCode,
@@ -1821,15 +1852,19 @@ export function impactGraph(kind, rawCode, selector = {}) {
1821
1852
  index: summary,
1822
1853
  coverage: GRAPH_COVERAGE,
1823
1854
  ...(scoped !== null ? { resolvedScope: { schemaCode: scoped.schemaCode, code: scoped.code } } : {}),
1824
- ...(hop1.length === 0 && dataruleHits.length === 0 && listViewHits.length === 0 && workflowHits.length === 0 && formHits.length === 0
1855
+ ...(zeroHit
1825
1856
  ? {
1857
+ // issue 07(CLI 面):零命中≠无影响。service 方法级未索引,note 不再给
1858
+ // 「没有影响」这种结论句;粒度边界由 granularityUnsupported 承接。
1826
1859
  note: (gapped
1827
1860
  ? "零命中,但索引存在扫描缺口——不可作为「无影响」证明;先 omc graph pull 重建再查"
1828
- : "零命中=scanned 面(规则/数据规则/视图/表单/流程)没有影响;workflow.bindings 与 onlinejs 未扫描,见 coverage.notScanned——不可据此判定「删除无影响」") +
1861
+ : "零命中=scanned 面(规则/数据规则/视图/表单/流程)零命中;workflow.bindings 与 onlinejs 未扫描,见 coverage.notScanned——不可据此判定「删除无影响」") +
1862
+ (kind === "service" ? ";service 方法级未索引,见 granularityUnsupported" : "") +
1829
1863
  (zeroHitKindHint(db, kind, code, "impact") ?? "") +
1830
1864
  (kind === "field" && scoped === null ? unresolvedScopedCodeNote(rawCode) ?? "" : ""),
1831
1865
  }
1832
1866
  : {}),
1867
+ ...(granularityUnsupported !== undefined ? { granularityUnsupported } : {}),
1833
1868
  ...(capped || dataruleHits.length > 20 || listViewHits.length > 20 || workflowHits.length > 20 || formHits.length > 20
1834
1869
  ? { truncated: true, note: `命中超过上限已截断(规则 50/实际 ${hop1.length},数据规则 20/实际 ${dataruleHits.length},视图 20/实际 ${listViewHits.length},流程 20/实际 ${workflowHits.length},表单 20/实际 ${formHits.length});完整规则清单用 references` }
1835
1870
  : {}),
@@ -103,6 +103,28 @@ export function writeSummary(tool, args, outcome, phase = "done") {
103
103
  const schema = stringArg(args, "schemaCode");
104
104
  return `未删除(batch-delete-ineffective)${ids.length} 条回读仍在${schema ? `(${schema})` : ""}:${ids.join("、")};改用单条 data.delete 重试`;
105
105
  }
106
+ // F7(0.8.6):physically_delete 是平台异步任务(建删除历史后立即返回)。回执
107
+ // `readback.absent=false` 表示级联仍在跑、记录面还查得到目标——zh 行首词必须是
108
+ // 否定,照 data.delete 的既有先例;否则人/CI 把「已删除模型 X」当成已生效。
109
+ if (phase === "done" && tool === "model.delete" && outcome?.readback?.deleteTask?.taskStatus === "FAIL") {
110
+ const code = stringArg(args, "schemaCode") ?? stringArg(args, "code") ?? "?";
111
+ const message = (outcome?.readback?.deleteTask).message;
112
+ const waited = (outcome?.readback?.deleteTask).waitedMs;
113
+ return `未删除(平台删除任务失败)模型 ${code}:${typeof message === "string" && message.length > 0 ? message : "平台未返回 message"}${typeof waited === "number" ? `(已等 ${Math.round(waited / 1000)}s)` : ""}——这不是「级联中」,任务已以 FAIL 结束;按平台原文拆引用/清残留后重试`;
114
+ }
115
+ if (phase === "done" && tool === "model.delete" && outcome?.readback?.absent === false) {
116
+ const code = stringArg(args, "schemaCode") ?? stringArg(args, "code") ?? "?";
117
+ return `未删净(级联中)模型 ${code}:平台异步删除任务未完成,记录面仍查得到——不要当作已删除;以 readback.absent=true 且应用树无该节点为准,稍后重跑 model.delete(幂等)复核`;
118
+ }
119
+ if (phase === "done" && tool === "model.deleteMany" && outcome?.readback?.deleteTask?.taskStatus === "FAIL") {
120
+ const message = (outcome?.readback?.deleteTask).message;
121
+ return `未删除(平台删除任务失败)批量模型:${typeof message === "string" && message.length > 0 ? message : "平台未返回 message"}——任务已以 FAIL 结束,本批未删;按平台原文拆引用/清残留后重试 model.deleteMany`;
122
+ }
123
+ if (phase === "done" && tool === "model.deleteMany" && outcome?.readback?.allAbsent === false) {
124
+ const perCode = (outcome.readback.perCode ?? {});
125
+ const pending = Object.entries(perCode).filter(([, value]) => value?.absent === false).map(([code]) => code);
126
+ return `未删净(级联中)${pending.length > 0 ? pending.join("、") : "部分模型"}:平台异步删除任务未完成,记录面仍查得到——不要当作已删除;按 perCode 逐项复核,稍后重跑 model.deleteMany(幂等)`;
127
+ }
106
128
  // r28b F11: data.delete already-absent must NOT read as「已删除…」— humans/CI
107
129
  // that skim stderr treat the leading verb as the outcome. Say「未删除」first.
108
130
  if (phase === "done" && tool === "data.delete" && outcome?.performed?.skipped === "already-absent") {
@@ -158,7 +180,13 @@ function phraseOf(tool, args, outcome) {
158
180
  }
159
181
  case "configure_form": {
160
182
  const codes = args.fieldCodes;
161
- return `配置并发布表单 ${stringArg(args, "sheetCode") ?? "?"}(模型 ${schemaCode ?? "?"})${Array.isArray(codes) && codes.length > 0 ? `,绑定字段 ${codes.map(String).join("、")}` : "(绑定全部已发布字段)"}`;
183
+ // F9(0.8.6):结果行曾恒为「配置并发布表单 ?」——summarize 把 outcome 写死
184
+ // undefined。回落链按「最能标识对象」排序:显式 sheetCode → 回执里的真实
185
+ // 表单名 readback.formName(sheetGet 的 name)→ 模型 code(默认表单槽位)
186
+ // → 未知才是 ?。plan 阶段没有回执,落到 schemaCode。
187
+ const readbackFormName = typeof outcome?.readback?.formName === "string" && outcome.readback.formName.length > 0 ? outcome.readback.formName : undefined;
188
+ const shownForm = stringArg(args, "sheetCode") ?? readbackFormName ?? (schemaCode !== undefined ? String(schemaCode) : "?");
189
+ return `配置并发布表单 ${shownForm}(模型 ${schemaCode ?? "?"})${Array.isArray(codes) && codes.length > 0 ? `,绑定字段 ${codes.map(String).join("、")}` : "(绑定全部已发布字段)"}`;
162
190
  }
163
191
  case "configure_rule":
164
192
  return `保存并启用业务规则 ${stringArg(args, "name") ?? ""}(${stringArg(args, "ruleCode") ?? "?"},模型 ${schemaCode ?? "?"})`;
@@ -256,7 +284,15 @@ function phraseOf(tool, args, outcome) {
256
284
  case "listview.configure": {
257
285
  const codes = Array.isArray(args.fieldCodes) ? args.fieldCodes.map(String).join("、") : "";
258
286
  const sections = ["sorts", "conditions", "actions", "buttons", "presentation", "options", "presentationType", "gantt", "queryLayer", "multiTableHeaderConfig"].filter((key) => args[key] !== undefined);
259
- return `配置列表视图 ${stringArg(args, "code") ?? schemaCode ?? "?"}(模型 ${schemaCode ?? "?"}):列 ${codes || "(未变)"}${sections.length > 0 ? `;同时配置 ${sections.join("、")}` : ""}`;
287
+ // F9(w44,2026-11-26 真机):视图固定条件只在门户运行面生效,REST 的
288
+ // data.list --queryCode 不应用。此前只有 JSON 回执尾部的
289
+ // conditionRuntimeNote/viewConditionsAppliedRest:false 说这件事,人类摘要
290
+ // 行不提,验收要读完整回执才知道。摘要行(stderr)与 plan 卡同源,这里
291
+ // 只加一句,不改 JSON 回执字段。
292
+ const conditionRuntimeLine = Array.isArray(args.conditions) && args.conditions.length > 0
293
+ ? ";视图固定条件只在门户运行面生效,REST `data.list --queryCode` 不应用——要在 API 侧过滤请显式传 `filter`"
294
+ : "";
295
+ return `配置列表视图 ${stringArg(args, "code") ?? schemaCode ?? "?"}(模型 ${schemaCode ?? "?"}):列 ${codes || "(未变)"}${sections.length > 0 ? `;同时配置 ${sections.join("、")}` : ""}${conditionRuntimeLine}`;
260
296
  }
261
297
  case "listview.delete":
262
298
  return `删除列表视图 ${stringArg(args, "code") ?? "?"}(${schemaCode ?? "?"})`;
@@ -399,7 +399,7 @@ export const fieldCapability = {
399
399
  pushError(ctx, "intent-subfield-code-invalid", "子列 code 必须是非空字符串", `${subBase}.code`, "value");
400
400
  else {
401
401
  subCode = subCodeNode.value.trim();
402
- const violations = validateBusinessCode(subCode, { kind: "field" });
402
+ const violations = validateBusinessCode(subCode, { kind: "field", subTable: true });
403
403
  if (violations.length > 0)
404
404
  pushError(ctx, "intent-subfield-code-invalid", `子列 code 未过出门前校验:${violations.map((violation) => violation.message).join(";")}`, `${subBase}.code`, "value", { validation: violations });
405
405
  if (seenSubCodes.has(subCode))
@@ -309,6 +309,10 @@ export const FIELD_LANE_CONTRACT = Object.freeze({
309
309
  scope: "create publish readback",
310
310
  description: "List draft/published fields of a model. 默认面紧凑(整包 choices 不内联);验证 options/subSchema 用 code/fields 选择器或 full:true。",
311
311
  }),
312
+ "field.get": Object.freeze({
313
+ scope: "create publish readback",
314
+ description: "单字段读(= field.list + code 选择器,含 options/subSchema)。",
315
+ }),
312
316
  "field.create": Object.freeze({
313
317
  scope: "create publish readback",
314
318
  description: describeTool("Create a draft field on a model (bizproperty/create).", [
@@ -12,6 +12,7 @@ export const FIELD_COVERAGE = declareLaneCoverage(FIELD_LANE_CONTRACT.lane, [
12
12
  // assertToolSurfaceConsistent — exactly the duplicate that guard exists to
13
13
  // catch, so don't introduce one.
14
14
  claim("field.list", T["field.list"].scope),
15
+ claim("field.get", T["field.get"].scope),
15
16
  claim("field.create", T["field.create"].scope),
16
17
  claim("field.update", T["field.update"].scope),
17
18
  claim("field.publish", T["field.publish"].scope),
@@ -563,7 +563,7 @@ export async function lintFieldCreateWrite(session, input, options = {}) {
563
563
  return prepared;
564
564
  }
565
565
  export function registerFieldLane(tools) {
566
- tools.push(defineTool({
566
+ const fieldListTool = defineTool({
567
567
  name: "field.list",
568
568
  search: { intents: ["看字段", "查字段", "字段清单", "模型有哪些字段", "字段列表", "跳号"] },
569
569
  layer: "low",
@@ -786,7 +786,25 @@ export function registerFieldLane(tools) {
786
786
  };
787
787
  },
788
788
  }),
789
- }));
789
+ });
790
+ tools.push(fieldListTool);
791
+ // F10(0.8.7 探针 B):`field.get` 不存在时 `omc call field.get` 只回 unknown-tool
792
+ // + candidates,多一往返;单字段读的真身就是 field.list 的 code 选择器。这里
793
+ // 注册**薄别名**(同一 handler、同一栏/覆盖声明),不复制读取逻辑,也不改
794
+ // field.list 行为。
795
+ tools.push({
796
+ ...fieldListTool,
797
+ name: "field.get",
798
+ search: { intents: ["读一个字段", "单个字段", "字段详情", "这个字段配置", "字段 options", "查字段详情"] },
799
+ description: "单字段读(field.list 的 code 选择器)。返回该字段 options/subSchema 等详情。",
800
+ inputSchema: {
801
+ environment: environmentArg,
802
+ schemaCode: z.string(),
803
+ code: z.string(),
804
+ published: z.boolean().default(false),
805
+ capability: capabilityArg,
806
+ },
807
+ });
790
808
  writeTool({
791
809
  tools,
792
810
  name: "field.create",
@@ -20,7 +20,7 @@ export const FORM_WIRE = Object.freeze({
20
20
  sheetListFace: "form.list: GET /api/api/app/bizsheet/list?schemaCode= (BizFormController.java:137-152 → ModelManagementFacadeImpl.getBizForms:481-488) answers the BizFormHeaderModel HEADER projection only — code, name, schemaCode, published, formType, sortKey, icon. formType is the INTEGER index (@JsonValue getIndex(), BizFormType.java:45-48): 0 DEFAULT_SHEET / 1 CUSTOMIZE_SHEET / 2 PRINT_TEMPLATE — decoded to the name with formTypeIndex kept (ADR 0002). existDraft/buttonCount/hasCustomScript are NOT on this face, so the default read never fabricates them: detail:true pays 1+N bizsheet/get for the content-derived faces. published is the same platform flag bit (r79-04): publish→draft leaves it false while the content is intact — the flag is reported as-is, content judgement needs detail:true. HTTP 404 means the version family has no /list endpoint: the tool answers sheetListUnavailable:true + the default slot only, never a fabricated list; a 601003 业务模型不存在 refusal is modelPresent:false (zero retries)",
21
21
  });
22
22
  const FORM_GET_DESCRIPTION = '读取默认表单(bizsheet/get)的发布状态与控件清单(紧凑默认)。**发布态以返回的 `published` / `existDraft` 布尔为准**(`published:true`=已发布;`published:false,existDraft:true`=只有草稿,**未发布**)——不要用 `publishedControlCodes` 是否非空来推断(草稿字段会让它非空,误判为已发布)。**每个模型交付前其默认表单必须 `published:true`**:用 `configure_form` 或 `form.draft(rebuild:true)`+`form.publish` 发布,并逐模型 `form.get` 核对。`full:true` 还返回 `options` 与 `customButtonJson`(表单工具栏按钮,数组原样;库里是字符串脏形时附 `customButtonJsonShapeWarning`——线上 #38 前端按钮不渲染)。传 `controls:["code",…]` 只取指定控件的 options(如关联控件的 mappings);传 `full:true` 才返回 draft/published 的完整 view/attributes/html/actions JSON(actions 列为设计器保存/发布的表单级按钮动作)。体积大,仅在需要整体布局时用。';
23
- const FORM_DRAFT_DESCRIPTION = "Save the default-form DRAFT (bizsheet/update). Reads the current sheet, merges the caller's explicit draftViewJson/draftAttributesJson (or preserves the existing draft); when both are absent on a fresh default form, composes the designer-standard scaffold from the model's published fields. A redundant field (relation-mapping carry-through target) always stays bound; with no workflow it is hidden in the design (options.visible=false), with a workflow it stays visible for per-node propertyPermissions. Pass `draftHtmlJson` to thread custom online-script HTML through. Empty-layout guard: explicitly passing \"[]\"/\"{}\" view/attributes is refused (form-empty-layout) — the platform designer's Save is NOT lossless and clears drafts to exactly that shape; escape with allowEmptyLayout:true, and recover cleared drafts from the form version history (/api/api/app/bizsheet/history/list). **读回原样回写**:从 `form.get` 取回的 view/attributes 直接回传时加 `fromReadback:true`——工具会与已存草稿/发布面逐字比对,一致才放行(平台自身布局可能含子表列行/系统行默认宽度),被改动过的面照常按 validation 拒绝。**表单工具栏按钮**:`buttons`(数组)或 `customButtonJson`(原样字符串)写进 `biz_sheet.options.customButtonJson`(**数组+actionConfig 对象**,设计器同形——线上 #38:字符串形=双重编码,前端按钮不渲染,重写即自愈);**要到 form.publish 才生成 h_biz_button(triggerType=FORM)**,且表单页是否显示还取决于流程节点 `buttonPermission.customBtns[].enabled`(设计器「表单操作」勾选)。`useLocation` 用 FORM/ROW/LIST,表单工具栏按钮用 FORM。字段发布后如需刷新已发布表单的控件映射,用本工具 rebuild:false 重存(保留现有布局与在线JS)再 form.publish。";
23
+ const FORM_DRAFT_DESCRIPTION = "Save the default-form DRAFT (bizsheet/update). Reads the current sheet, merges the caller's explicit draftViewJson/draftAttributesJson (or preserves the existing draft); when both are absent on a fresh default form, composes the designer-standard scaffold from the model's published fields. A redundant field (relation-mapping carry-through target) always stays bound; with no workflow it is hidden in the design (options.visible=false), with a workflow it stays visible for per-node propertyPermissions. Pass `draftHtmlJson` to thread custom online-script HTML through. Empty-layout guard: explicitly passing \"[]\"/\"{}\" view/attributes is refused (form-empty-layout) — the platform designer's Save is NOT lossless and clears drafts to exactly that shape; escape with allowEmptyLayout:true, and recover cleared drafts from the form version history (/api/api/app/bizsheet/history/list). **读回原样回写**:从 `form.get` 取回的 view/attributes 直接回传时加 `fromReadback:true`——工具会与已存草稿/发布面逐字比对,一致才放行(平台自身布局可能含子表列行/系统行默认宽度),被改动过的面照常按 validation 拒绝。**表单工具栏按钮**:`buttons`(数组)或 `customButtonJson`(原样字符串)写进 `biz_sheet.options.customButtonJson`(**数组+actionConfig 对象**,设计器同形——线上 #38:字符串形=双重编码,前端按钮不渲染,重写即自愈);**要到 form.publish 才生成 h_biz_button(triggerType=FORM)**,且表单页是否显示还取决于流程节点 `buttonPermission.customBtns[].enabled`(设计器「表单操作」勾选)。`useLocation` 用 FORM/ROW/LIST,表单工具栏按钮用 FORM。字段发布后如需刷新已发布表单的控件映射,用本工具 rebuild:false 重存(保留现有布局与在线JS)再 form.publish。**改既有表单勿整表重写**:先 `form.get full:true` 取 `publishedAttributesJson` 作基线、只改 rows/span;只写业务字段会丢系统控件并撞 form-publish-degrade。";
24
24
  const FORM_PUBLISH_DESCRIPTION = "Publish the default form (bizsheet/publish, proven shape: draft*Json promoted to published*Json verbatim) with published-face readback. **不影响在线 JS**:本工具只提拔布局草稿;改 JS 请用 onlinejs.compose(它自己会连同整张表单一起发布,不必再调本工具)。 Degrade guard: refuses to promote a draft carrying FEWER controls than the published face (form-publish-degrade) — the designer's Save clears drafts non-losslessly; recover via the form version history (/api/api/app/bizsheet/history/list) and rewrite the draft first, or pass allowDegrade:true to force the reduction. rebuild:true is the one-call refresh: discard the existing draft, re-scaffold from the published fields (non-structural control options preserved), then force-promote — use it after a field shape change. **表单工具栏按钮**:传 `buttons`(或 `customButtonJson`)→ 写进 `options.customButtonJson` 并在本次 publish 生成 `h_biz_button(triggerType=FORM, triggerCode=<formCode>)`(平台 `publishBizForm:1022`);`options.customButtonJson` 以**数组**写入(条目 `actionConfig` 为对象,设计器同形——线上 #38:字符串形=双重编码,前端按钮不渲染,回执给 formButtonsShapeWarning);表单页是否显示再由流程节点 `buttonPermission.customBtns[].enabled` 过滤。";
25
25
  const FORM_RUN_BUTTON_DESCRIPTION = "执行表单工具栏按钮(平台同款面:`POST /api/api/runtime/form/executeCustomButton`,body `{bizButtonModel, bizObjectList:[<完整业务对象>], reacquireDataFromDb:true}`)。**与列表行按钮不同**:列表按钮发 `launcher/domain_service_runtime/<schema>/<rule>` + `ids[]`(用 `rule.run`),表单按钮带**整条记录**,不能互换。按钮来源 `GET /api/api/system/getCustomButtons`(只列 triggerType=FORM 的 h_biz_button)。前提:按钮已由 `form.publish` 的 `buttons`/`customButtonJson` 生成。返回是执行结果信封,规则副作用用 `data.load` 另读;被规则 UPDATE 的目标行须是 COMPLETED(引擎查不到 DRAFT)。`302045` = 数据被占用。**`10005` 换等价面 `rule.run`(见 contract form),勿反复重试。**";
26
26
  const CONFIGURE_FORM_DESCRIPTION = "High-level: bind fields into the default form and publish it (form.draft → form.publish), subject to the write permission gate. Delegates to the proven form.draft scaffold + form.publish paths so the real empty-form layout (and any caller-supplied draftHtmlJson) is persisted and promoted — never bypasses with a shortcut body. `sheetCode` is optional: omitted means the model's default sheet (sheetCode = schemaCode).";
@@ -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, 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 } 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";
@@ -572,7 +572,8 @@ export function registerFormLane(tools) {
572
572
  schemaCode: z.string().min(1),
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
- draftAttributesJson: z.string().optional().describe("控件表:JSON 对象 `{ \"codeA\": { key:\"codeA\", type: <控件类型号>, options:{ name:\"显示名\", span: 12 } } }`。`span` 是 24 栅格宽度:两列各 span:12、整宽 span:24(必须与 draftViewJson 的行分组一致,否则 layout_coverage_mismatch)。现成样例:`omc describe form.draft --example two-column-layout`"),
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
+ allowTypeMismatch: z.boolean().optional().describe("放行控件 type 与字段 propertyType 不匹配(默认拒 form-control-type-mismatch;仅平台模板明确要求特殊控件时用)"),
576
577
  draftHtmlJson: z.string().optional(),
577
578
  fieldCodes: z.array(z.string().min(1)).optional().describe("脚手架绑定的已发布字段(按此顺序);由 configure_form/intent 显式传入。子表列写「父字段.子列」等价于 childColumns"),
578
579
  childColumns: z
@@ -598,6 +599,27 @@ export function registerFormLane(tools) {
598
599
  // governed pipeline — including the rollback before-capture read.
599
600
  refuseEmptyCallerLayout({ ...args, sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode) });
600
601
  },
602
+ // R75-B seam: dry-run 与真写共用这一个 session 只读 lint(dry-run 直接跑它)。
603
+ // 控件 type 交叉校验需要 field.list(propertyType 是另一套枚举),纯参数门
604
+ // 拿不到;放进这里才能让 `--dry-run` 与真写同答案。executeFormDraftWrite 里
605
+ // 再跑同一函数,直调执行器的路径也绕不过去。
606
+ writeLint: async (session, args) => {
607
+ if (args.fromReadback === true)
608
+ return { controlTypeCheck: "skipped-fromReadback" };
609
+ const lint = await lintFormControlTypes(session, {
610
+ schemaCode: args.schemaCode,
611
+ sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode),
612
+ ...(typeof args.draftAttributesJson === "string" ? { draftAttributesJson: args.draftAttributesJson } : {}),
613
+ ...(args.allowTypeMismatch !== undefined ? { allowTypeMismatch: args.allowTypeMismatch } : {}),
614
+ });
615
+ if (lint === undefined || lint.mismatches.length === 0)
616
+ return {};
617
+ return {
618
+ controlTypeMismatchAllowed: true,
619
+ controlTypeMismatches: lint.mismatches,
620
+ controlTypeNote: "allowTypeMismatch:true 显式放行;本工具不替你改控件 type。",
621
+ };
622
+ },
601
623
  rollback: {
602
624
  target: (args) => `form:${String(args.schemaCode ?? "")}/${String(args.sheetCode ?? args.schemaCode ?? "")}`,
603
625
  read: (session, args) => readFormOrNull(session, String(args.schemaCode), resolveSheetCode(String(args.schemaCode), args.sheetCode)),
@@ -763,7 +785,7 @@ export function registerFormLane(tools) {
763
785
  },
764
786
  };
765
787
  },
766
- summarize: (args, _outcome, phase) => writeSummary("configure_form", args, undefined, phase),
788
+ summarize: (args, outcome, phase) => writeSummary("configure_form", args, outcome, phase),
767
789
  });
768
790
  writeTool({
769
791
  tools,