@stalfh233/omc-cli 0.8.34 → 0.8.36

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.
@@ -299,6 +299,10 @@ function phraseOf(tool, args, outcome) {
299
299
  const workflowCheckSkipped = outcome?.readback?.workflowCheckSkipped;
300
300
  // F8(w63):平台按模型「数据标题」覆盖显式传入的 name,摘要行必须抬头。
301
301
  const nameNote = readbackNoteClause(outcome, "nameOverwrittenNote");
302
+ // F1(探针 Z):普通保存/更新不执行门户条件数据规则——摘要行与
303
+ // readback.dataRulesNotExecuted 同源,别让人只看人话就当校验跑过了。
304
+ const notExecuted = outcome?.readback?.dataRulesNotExecuted;
305
+ const rulesNote = typeof notExecuted?.count === "number" && notExecuted.count > 0 ? `;数据规则未执行(${notExecuted.count} 条,条件校验只在门户/OpenAPI 面)` : "";
302
306
  if (args.submit === true && submitRefused !== undefined) {
303
307
  // P1(w132 探针 J):这是**部分完成**——草稿已落库、提交未完成。摘要
304
308
  // 必须先说清这个事实,再说被拒原因,避免调用方读成「已提交」。
@@ -309,30 +313,34 @@ function phraseOf(tool, args, outcome) {
309
313
  return `保存数据(模型 ${schemaCode ?? "?"})——草稿已保存,提交未完成:submit:true 被拒(${submitRefused.blocker ?? "?"});模型有已发布流程,行保持草稿 DRAFT;重建流程草稿的指引进 readback.submitRefused${nameNote}`;
310
314
  }
311
315
  if (workflowUpdateNote !== undefined) {
312
- return `保存数据(模型 ${schemaCode ?? "?"})——更新既有行,不创建/改动流程实例;流程模型上保存的直提标志会被拒,推进该行用 workitem.list → data.submit 三件套(不要为触发规则/推进流程再 data.save)${nameNote}`;
316
+ return `保存数据(模型 ${schemaCode ?? "?"})——更新既有行,不创建/改动流程实例;流程模型上保存的直提标志会被拒,推进该行用 workitem.list → data.submit 三件套(不要为触发规则/推进流程再 data.save)${nameNote}${rulesNote}`;
313
317
  }
314
318
  if (workflowInstanceNote !== undefined) {
315
- return `保存数据(模型 ${schemaCode ?? "?"})——普通草稿、无流程实例,不能提交;要可提交请用 data.save 带 workflowCode:"${workflowInstanceNote.workflowCode ?? "<wf>"}" 重建流程草稿(formData 不要带 id)${nameNote}`;
319
+ return `保存数据(模型 ${schemaCode ?? "?"})——普通草稿、无流程实例,不能提交;要可提交请用 data.save 带 workflowCode:"${workflowInstanceNote.workflowCode ?? "<wf>"}" 重建流程草稿(formData 不要带 id)${nameNote}${rulesNote}`;
316
320
  }
317
321
  if (workflowCheckSkipped !== undefined) {
318
322
  // 更新行不能再劝 data.save workflowCode(会多建一行)——只指复核面 + 现有待办。
319
323
  const formDataId = args.formData !== null && typeof args.formData === "object" ? args.formData.id : undefined;
320
324
  if (typeof formDataId === "string" && formDataId.length > 0) {
321
- return `保存数据(模型 ${schemaCode ?? "?"})——本次未能确认是否有已发布流程(见 workflowCheckSkipped);更新既有行请先复核流程面(workflow.get_published / rule.references)+ workitem.list 看现有待办,不要为确认流程再 data.save 一次${nameNote}`;
325
+ return `保存数据(模型 ${schemaCode ?? "?"})——本次未能确认是否有已发布流程(见 workflowCheckSkipped);更新既有行请先复核流程面(workflow.get_published / rule.references)+ workitem.list 看现有待办,不要为确认流程再 data.save 一次${nameNote}${rulesNote}`;
322
326
  }
323
- return `保存数据(模型 ${schemaCode ?? "?"})——本次未能确认是否有已发布流程(见 workflowCheckSkipped),先复核流程面再决定 submit:true 或 data.save workflowCode${nameNote}`;
327
+ return `保存数据(模型 ${schemaCode ?? "?"})——本次未能确认是否有已发布流程(见 workflowCheckSkipped),先复核流程面再决定 submit:true 或 data.save workflowCode${nameNote}${rulesNote}`;
324
328
  }
325
329
  // r68 链2-D1(真机实证):带 workflowCode 存的是**流程草稿**,但通用草稿文案教
326
330
  // 「加 submit:true」——流程模型会被拒;正确下一步是 data.submit 三件套。
327
331
  if (stringArg(args, "workflowCode")) {
328
- return `保存流程草稿(模型 ${schemaCode ?? "?"},流程 ${stringArg(args, "workflowCode")})——行 DRAFT;下一步:从回执 performed 取 bizObjectId/workItemId/workflowInstanceId,调 data.submit 三件套提交起始待办(配方 workflow-backed-data-submit)${nameNote}`;
332
+ return `保存流程草稿(模型 ${schemaCode ?? "?"},流程 ${stringArg(args, "workflowCode")})——行 DRAFT;下一步:从回执 performed 取 bizObjectId/workItemId/workflowInstanceId,调 data.submit 三件套提交起始待办(配方 workflow-backed-data-submit)${nameNote}${rulesNote}`;
329
333
  }
330
334
  return args.submit === true
331
335
  ? `保存并直提数据(模型 ${schemaCode ?? "?"})——一调完成态:DRAFT→COMPLETED,Create 规则已派发(无流程模型;流程模型会拒绝并指路两段式)${nameNote}`
332
- : `保存数据(模型 ${schemaCode ?? "?"})——草稿 DRAFT;要一调完成态加 **data.save 自己的** submit:true(data.submit 无此参数,两段式改调 data.submit)${nameNote}`;
336
+ : `保存数据(模型 ${schemaCode ?? "?"})——草稿 DRAFT;要一调完成态加 **data.save 自己的** submit:true(data.submit 无此参数,两段式改调 data.submit)${nameNote}${rulesNote}`;
333
337
  }
334
338
  case "data.update":
335
- return `更新数据 ${stringArg(args, "bizObjectId") ?? "?"}(${schemaCode ?? "?"})`;
339
+ {
340
+ const updatedNotExecuted = outcome?.readback?.dataRulesNotExecuted;
341
+ const updatedRulesNote = typeof updatedNotExecuted?.count === "number" && updatedNotExecuted.count > 0 ? `——数据规则未执行(${updatedNotExecuted.count} 条,条件校验只在门户/OpenAPI 面)` : "";
342
+ return `更新数据 ${stringArg(args, "bizObjectId") ?? "?"}(${schemaCode ?? "?"})${updatedRulesNote}`;
343
+ }
336
344
  case "data.submit": {
337
345
  // r68 链2-D2(真机实证):提交回 ok + 行状态 PROCESSING(绿),但实例可能异常
338
346
  // 停滞(readback.flowWarning 有真相)——summary 全绿会掩盖。有警告必须抬头。
package/dist/lanes/app.js CHANGED
@@ -288,6 +288,22 @@ function appRollbackSpec(toolName) {
288
288
  function isFallbackGroup(group) {
289
289
  return String(group?.code ?? "").toLowerCase() === "all";
290
290
  }
291
+ /**
292
+ * issue #65:`app.list` 的内联投影只回 20 条,且外置档没有「怎么取全」的指路。
293
+ *
294
+ * 平台端点没有分页参数:`GET /api/app/apppackage/list` 一次返回该用户可见的
295
+ * **全部**应用(8.6.26 `AppPackageController.list:725-738`,只接 `getUserId()`,
296
+ * 无 Pageable;`list_all` 也是全量)。所以「全量」不是服务端翻页,而是
297
+ * **客户端内联上限**:`all:true` 抬到 500 条,仍超出时用 offset 续取。
298
+ * `applicationsCount` 始终是租户全集条数,截断多少由 `omittedCount` 说明。
299
+ */
300
+ const APP_LIST_INLINE_LIMIT = 20;
301
+ const APP_LIST_ALL_LIMIT = 500;
302
+ /** 回执里的可复制命令:环境名安全时用真名,否则用 `<env>` 占位。 */
303
+ function appListNextCommand(args, next) {
304
+ const environment = typeof args.environment === "string" && /^[^\s'"]+$/.test(args.environment) ? args.environment : "<env>";
305
+ return `omc call app.list --env ${environment} --args '${JSON.stringify(next)}'`;
306
+ }
291
307
  export function registerAppLane(tools) {
292
308
  tools.push(defineTool({
293
309
  name: "app.list",
@@ -297,7 +313,13 @@ export function registerAppLane(tools) {
297
313
  lane: APP_LANE,
298
314
  scope: APP_TOOLS["app.list"].scope,
299
315
  description: APP_TOOLS["app.list"].description,
300
- inputSchema: { environment: environmentArg, capability: capabilityArg },
316
+ inputSchema: {
317
+ environment: environmentArg,
318
+ capability: capabilityArg,
319
+ all: z.boolean().optional().describe("true = 内联整个清单(客户端上限 500;平台无分页,一次全量)。默认档仍只回 20 条;超出给 omittedCount+nextCommand"),
320
+ limit: z.number().int().min(1).max(APP_LIST_ALL_LIMIT).optional().describe("内联条数 1..500(默认 20;all:true 默认 500),不是平台分页"),
321
+ offset: z.number().int().min(0).optional().describe("内联起点(默认 0),配合 limit 翻页;applicationsCount 仍是全集"),
322
+ },
301
323
  handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
302
324
  const rows = wireRows((await wireCall(session, { path: ENDPOINTS.applicationList, query: {} })).data);
303
325
  // B3(0.8.4 真机):旧实现是 `Promise.all` **无界**扇出——每个应用一条
@@ -340,16 +362,35 @@ export function registerAppLane(tools) {
340
362
  : {}),
341
363
  };
342
364
  }, {
343
- target: "app.list",
344
- compact: (result) => {
365
+ // issue #65:调用参数现在会改变回执(all/limit/offset),读回缓存键必须跟着变,
366
+ // 否则同一环境先跑默认档再跑 all:true 会命中 `unchanged:true` 拿到旧的 20 条。
367
+ // 无参数时键仍是旧的 "app.list"(产物哈希/黄金样本不动)。
368
+ target: `app.list${args.all === true ? ":all" : ""}${args.limit !== undefined ? `:limit=${args.limit}` : ""}${args.offset !== undefined ? `:offset=${args.offset}` : ""}`,
369
+ compact: (result, _session, args) => {
345
370
  const apps = Array.isArray(result.applications) ? result.applications : [];
371
+ const offset = typeof args.offset === "number" ? args.offset : 0;
372
+ const limit = typeof args.limit === "number" ? args.limit : args.all === true ? APP_LIST_ALL_LIMIT : APP_LIST_INLINE_LIMIT;
373
+ const page = apps.slice(offset, offset + limit);
374
+ const omittedCount = apps.length - page.length;
375
+ const hasMoreAfterPage = offset + page.length < apps.length;
376
+ // 还有未内联的行时给可复制的续取命令:默认档先建议 all:true;
377
+ // 显式 all/limit/offset 档则用 offset 续页。
378
+ const nextArgs = args.all === true || args.limit !== undefined || offset > 0
379
+ ? { offset: offset + page.length, limit }
380
+ : { all: true };
346
381
  return {
347
382
  applicationsCount: apps.length,
348
- omitted: true,
349
- applications: apps.slice(0, 20),
383
+ omitted: omittedCount > 0,
384
+ applications: page,
385
+ ...(omittedCount > 0
386
+ ? {
387
+ omittedCount,
388
+ ...(hasMoreAfterPage ? { nextCommand: appListNextCommand(args, nextArgs) } : {}),
389
+ tablesHint: `applications 只内联了 ${page.length}/${apps.length} 条(omittedCount=${omittedCount});全集仍可用 --jq applications[].code 或 artifact get 取回${hasMoreAfterPage ? ",或按 nextCommand 续取" : ""}。`,
390
+ }
391
+ : {}),
350
392
  // B3:部分失败是结论本身(哪个应用读不到),diet 不得吞掉。
351
393
  ...(result.applicationsFailed !== undefined ? { applicationsFailed: result.applicationsFailed, failed: result.failed, partial: true, hint: result.hint } : {}),
352
- tablesHint: "applications 已截断内联前 20 条(omitted:true);全集在 detailArtifactId,用 --jq applications[].code 或 artifact get 取回。",
353
394
  };
354
395
  },
355
396
  }),
@@ -724,7 +724,12 @@ async function readRuleListBody(session, schemaCode, options) {
724
724
  ? {}
725
725
  : {
726
726
  customCount: rows.filter((row) => row.defaultRule !== true).length,
727
- presetHint: "默认含平台预置触发行(preset:true,如 Available/Cancel/Create/Delete/GetList/Load/Update);判定「有没有人写过规则」看 customCount(=0 即全是预置),或直接 onlyCustom:true",
727
+ // F5(探针 AA,0.8.36):2.1.5 新建模型本面 **0 行**(预置行尚未物化/
728
+ // 发布;8.6 建模即建)。旧文案无条件说「默认含平台预置触发行」,在 0
729
+ // 行面上自相矛盾,会被读成「没有触发器」。
730
+ presetHint: visible.length === 0
731
+ ? "本面 0 条:平台尚未物化/发布预置行(2.1.5 新建模型为空,8.6 建模即建);不要据此判定没有触发器——用 rule.references kind:\"trigger\" 看真实触发点"
732
+ : "默认含平台预置触发行(preset:true,如 Available/Cancel/Create/Delete/GetList/Load/Update);判定「有没有人写过规则」看 customCount(=0 即全是预置),或直接 onlyCustom:true",
728
733
  }),
729
734
  ...(endpointFamily ? { endpointFamily } : {}),
730
735
  ...(mappingFace
@@ -1231,18 +1236,16 @@ export function registerBusinessRuleLane(tools) {
1231
1236
  // r83:三句提示(executableHint/statusNote/presetHint)逐模型逐字相同,
1232
1237
  // 跨模型面把它们抬到顶层一次(crossModelNotes),否则 3 模型就顶破 2048
1233
1238
  // 内联上限、整面被 compact(models 退码表)。statusLag 旗标仍逐模型保留。
1239
+ // F5(探针 AA,0.8.36):presetHint 现在随「本面是否 0 行」而变——**只有
1240
+ // 所有模型都存在且内容全等才抬**;否则保留逐模型(否则 0 行模型的「0 条」
1241
+ // 文案会被 8.6 模型抬走的通用文案覆盖,结论错)。
1234
1242
  const hoisted = {};
1235
1243
  const HOIST_KEYS = ["executableHint", "statusNote", "presetHint"];
1244
+ const bodies = [];
1236
1245
  for (const schemaCode of schemaCodes) {
1237
1246
  try {
1238
1247
  const body = await readRuleListBody(session, schemaCode, options);
1239
- for (const key of HOIST_KEYS) {
1240
- if (body[key] !== undefined) {
1241
- hoisted[key] = body[key];
1242
- delete body[key];
1243
- }
1244
- }
1245
- models.push(body);
1248
+ bodies.push(body);
1246
1249
  rulesCount += Array.isArray(body.rules) ? body.rules.length : 0;
1247
1250
  }
1248
1251
  catch (error) {
@@ -1250,6 +1253,19 @@ export function registerBusinessRuleLane(tools) {
1250
1253
  failed.push({ schemaCode, code: null, message: error.message });
1251
1254
  }
1252
1255
  }
1256
+ if (bodies.length > 0) {
1257
+ for (const key of HOIST_KEYS) {
1258
+ if (!bodies.every((body) => body[key] !== undefined))
1259
+ continue;
1260
+ const first = JSON.stringify(bodies[0][key]);
1261
+ if (!bodies.every((body) => JSON.stringify(body[key]) === first))
1262
+ continue;
1263
+ hoisted[key] = bodies[0][key];
1264
+ for (const body of bodies)
1265
+ delete body[key];
1266
+ }
1267
+ models.push(...bodies);
1268
+ }
1253
1269
  // 全部模型都读失败 → 上抛首个错误:auth/网络问题不能被读成「部分成功」。
1254
1270
  if (models.length === 0 && firstError !== undefined)
1255
1271
  throw firstError;
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { ENDPOINTS } from "../endpoints.js";
3
3
  import { fieldChangeWireBody, fieldUpdateWireBody, prepareFieldChange, prepareFieldUpdate } from "../field-change.js";
4
- import { aggregationSelfSchemaMessage, aggregationTargetsOwnSchema, choicesArg, childColumnsOf, FIELD_PROPERTY_TYPES, fieldOptionsArg, fieldTypeLabel, numericalScaleWarning, propertyTypeArg, relativeCodeArg, stripAggregationPrefix, subFieldArg, SYSTEM_FIELD_CODES, assertFieldFamilyAllowed, assertSelectionChoicesAllowed, assertRelationTargetExists, relationPublishFailureMessage, lintSequenceNoSetting, } from "../field-families.js";
4
+ import { aggregationSelfSchemaMessage, aggregationTargetsOwnSchema, choicesArg, childColumnsOf, FIELD_PROPERTY_TYPES, fieldOptionsArg, fieldTypeLabel, hasUnpublishedCustomOptions, numericalScaleWarning, propertyTypeArg, relativeCodeArg, stripAggregationPrefix, subFieldArg, SYSTEM_FIELD_CODES, assertFieldFamilyAllowed, assertSelectionChoicesAllowed, assertRelationTargetExists, relationPublishFailureMessage, lintSequenceNoSetting, } from "../field-families.js";
5
5
  import { capabilityArg, environmentArg } from "../args.js";
6
6
  import { governedRead } from "../read.js";
7
7
  import { writeTool } from "../write.js";
@@ -9,6 +9,7 @@ import { verificationConfigOnly } from "../verification.js";
9
9
  import { decodeJsonColumn, decodeJsonObjectColumn, JSON_COLUMN_NULL_COALESCE, JSON_COLUMN_PASSTHROUGH } from "../json-column.js";
10
10
  import { syncFormConditionDataRules } from "./datarule.js";
11
11
  import { FORM_CONDITION_OPTION_KEYS } from "./datarule-protocol.js";
12
+ import { DATE_READBACK_NOTE } from "./runtime-data/shapes.js";
12
13
  import { defineTool, isRequiredAlternativePlaceholder, ToolRefusalError } from "../tool-types.js";
13
14
  import { wireCall, wireRows, WireError, optionPublishMessages } from "../wire.js";
14
15
  import { assertTreeSelectionOptions } from "../field-tree-options.js";
@@ -434,29 +435,6 @@ function decodeSubSchemaForReadback(subSchema) {
434
435
  shell: String(record.code ?? "").trim() === "",
435
436
  };
436
437
  }
437
- /**
438
- * F4(探针 Y,0.8.34):字段行 published:true 但选项级 `published:false`。
439
- * `field-families` 生成 custom 选项时固定 `published:false`(8.1 兼容形态),
440
- * 字段/表单发布不会重写这个标记;运行时 REST 按 code/value 接受。门户 UI 是否
441
- * 使用该标记未验证——只给读数与边界,不断言门户也忽略。
442
- */
443
- function hasUnpublishedCustomOptions(options) {
444
- if (options === null || typeof options !== "object" || Array.isArray(options))
445
- return false;
446
- let optionsSet = options.optionsSet;
447
- if (typeof optionsSet === "string") {
448
- try {
449
- optionsSet = JSON.parse(optionsSet);
450
- }
451
- catch {
452
- return false;
453
- }
454
- }
455
- if (optionsSet === null || typeof optionsSet !== "object" || Array.isArray(optionsSet))
456
- return false;
457
- const custom = optionsSet.custom;
458
- return Array.isArray(custom) && custom.some((entry) => entry !== null && typeof entry === "object" && entry.published === false);
459
- }
460
438
  /**
461
439
  * 探针 D F9(0.8.9):字段行 `options.mappings` 存在 = 关联填充配置。
462
440
  * 平台存储形态是 options.mappings 的 **JSON 字符串**(`WorkSheetPropertyMapping[]`,
@@ -851,6 +829,23 @@ export function registerFieldLane(tools) {
851
829
  .map((field) => String(field.code))
852
830
  .filter((code) => code !== "")
853
831
  : [];
832
+ // F10(探针 Z):详细面把 DATE 行+options.format 一起送到调用方时,点明
833
+ // format 只是门户显示格式——API 读回固定秒级,与 data.load 的
834
+ // dateReadbackNote 同源。只在真的返回选项时才说,默认清单面不新增字节。
835
+ const dateFormatFields = detailed
836
+ ? visible
837
+ .filter((field) => {
838
+ if (Number(field.type) !== FIELD_PROPERTY_TYPES.DATE)
839
+ return false;
840
+ const options = field.options;
841
+ if (options === null || typeof options !== "object" || Array.isArray(options))
842
+ return false;
843
+ const format = options.format;
844
+ return typeof format === "string" && format.trim() !== "";
845
+ })
846
+ .map((field) => String(field.code))
847
+ .filter((code) => code !== "")
848
+ : [];
854
849
  const projected = detailed
855
850
  ? visible
856
851
  : visible.map((field) => {
@@ -929,6 +924,9 @@ export function registerFieldLane(tools) {
929
924
  optionPublishedNote: "这些字段行 published:true,但 custom 选项带 published:false:字段/表单发布不重写选项级标记;2.1.5 REST 按 code/value 接受该选项(运行期 data.save/data.load 可用);字段是否生效看行级 published。门户 UI 是否使用该选项标记未验证——不要据此断言门户会/不会显示。",
930
925
  }
931
926
  : {}),
927
+ // F10(探针 Z):DATE 的 options.format 只影响门户显示;API 读回固定
928
+ // `YYYY-MM-DD HH:mm:ss`(与 data.load 的 dateReadbackNote 同源)。
929
+ ...(dateFormatFields.length > 0 ? { dateFormatNote: DATE_READBACK_NOTE } : {}),
932
930
  ...(mappingRuntimeNote !== undefined
933
931
  ? {
934
932
  verification: verificationConfigOnly("portal", "仅证明字段映射配置已读回(字段行 options.mappings),未证明 REST 写会回填——data.save(/api/runtime/form/save)不跑 options.mappings,快照列需调用方自填。", { manual: "门户表单选择关联值,核对映射是否回填;REST data.save 不跑 options.mappings" }),
@@ -19,9 +19,9 @@ export const FORM_WIRE = Object.freeze({
19
19
  actionsColumns: "ticket 100: draftActionsJson/publishedActionsJson are REAL bizsheet columns (BizForm.java:95-100 @SerializableField; BizFormModel.java:59-62 serialized by bizsheet/get) — the designer writes draftActionsJson on save and both faces on publish (frontend-dist/admin/js/4280.cfa75764.js offsets 193538/185347); form.get full:true surfaces them; publish promotes draftActionsJson → publishedActionsJson",
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
- const FORM_GET_DESCRIPTION = '读取默认表单(bizsheet/get)的发布状态与控件清单(紧凑默认)。**`published`/`existDraft` 是内容面结论**(`published:true`=已发布;`published:false,existDraft:true`=只有草稿,**未发布**);平台 `bizsheet/get` 标记位见 `platformFlags`。`form.list` 的 `published` 仍为平台旗标,两者语义不同。不要用 `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。**改既有表单勿整表重写**:先 `form.get full:true` 取 `publishedAttributesJson` 作基线、只改 rows/span;只写业务字段会丢系统控件并撞 form-publish-degrade。";
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` 过滤。";
22
+ const FORM_GET_DESCRIPTION = '读取默认表单(bizsheet/get)的发布状态与控件清单(紧凑默认)。**`published`/`existDraft` 是内容面结论**(`published:true`=已发布;`published:false,existDraft:true`=只有草稿,**未发布**);平台 `bizsheet/get` 标记位见 `platformFlags`。`form.list` 的 `published` 仍为平台旗标,两者语义不同。不要用 `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 列为设计器保存/发布的表单级按钮动作)。体积大,仅在需要整体布局时用。非字段控件(200/202/203)见 `decorations`(2.1.5 验存储/发布/读回;门户渲染未验,需 8.1.108/真页采样)。';
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 对象**;字符串形=双重编码,前端按钮不渲染);`h_biz_button(triggerType=FORM)` 要到 form.publish 才生成,表单页显示还看流程节点 `buttonPermission.customBtns[].enabled`。`useLocation` 用 FORM/ROW/LIST。字段发布后如需刷新已发布表单的控件映射,用本工具 rebuild:false 重存(保留现有布局与在线JS)再 form.publish。**改既有表单勿整表重写**:先 `form.get full:true` 取 `publishedAttributesJson` 作基线、只改 rows/span;只写业务字段会丢系统控件并撞 form-publish-degrade。**描述块/分组标题**(控件 200/202/203,非字段)用 `decorations` 增量加(202 的 `html` 写 options.name;2.1.5 验存储/发布/读回;门户渲染未验,需 8.1.108/真页采样);rebuild 保留 202 描述块,额外 200/203 实例 fail-closed 列 `losing`。";
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; 202 描述块原样保留,额外 200/203 实例 fail-closed 列于 losing), 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).";
27
27
  const FORM_LIST_DESCRIPTION = "列出模型的多张表单(`/api/api/app/bizsheet/list?schemaCode=`,header-only 投影):每行 `sheetCode`/`name`/`formType`(整数索引解码为名字,另带 formTypeIndex)/`published`。默认只发 1 次 wire;`detail:true` 才逐面 `bizsheet/get`(上限 maxSheets=12,超出回 partial+omittedSheets)补 existDraft/controlCount/buttonCount/publishedActionCount/hasCustomScript/faces。**默认面不伪造这些内容推导键,也不改旗标**:`published` 是平台旗标位(publish→draft 后它为 false 而内容俱在),判「有没有发布面内容」用 detail:true 的 faces。业务模型不存在 → modelPresent:false;该版本族无 /list 端点(HTTP 404)→ sheetListUnavailable:true + 只回默认槽(明确标注是推断,不是清单)。`defaultSheetCode` 由清单推导(formType=DEFAULT_SHEET 且 sheetCode===schemaCode),权威仍是 form.get 的显式 sheetCode。";
@@ -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, composeFormLayoutDraft, assertLayoutRequestConflicts } 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, composeFormDecorationsDraft, assertLayoutRequestConflicts, assertDecorationRequestConflicts, summarizeFormDecorations } 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";
@@ -229,6 +229,12 @@ export function registerFormLane(tools) {
229
229
  // F5(0.8.20):子表列 locator(发布面优先,草稿面兜底)。
230
230
  const childColumnLocator = childColumnLocatorOf(sheet.publishedAttributesJson, "publishedAttributesJson")
231
231
  ?? childColumnLocatorOf(sheet.draftAttributesJson, "draftAttributesJson");
232
+ // issue #57:非字段控件(200 分组标题 / 202 描述说明 / 203 表单标题)单列,
233
+ // 免掉「整包 diff 才能看出用户在设计器加了什么」。优先草稿面(正在编辑的
234
+ // 那一面),草稿为空才退回发布面;正文(HTML)有界内联,超预算只给
235
+ // htmlPresent + htmlBytes。
236
+ const decorationFace = draftPresent ? "draft" : "published";
237
+ const decorationSummary = summarizeFormDecorations(decorationFace === "draft" ? sheet.draftAttributesJson : sheet.publishedAttributesJson, decorationFace === "draft" ? sheet.draftViewJson : sheet.publishedViewJson);
232
238
  const faceSync = compareFormFaces(sheet, { draftPresent, publishedPresent });
233
239
  const faceVerdict = resolveEffectiveFormFace({
234
240
  draftPresent,
@@ -256,6 +262,11 @@ export function registerFormLane(tools) {
256
262
  ...(faceSync.inSync === false ? { differingFaces: faceSync.differingFaces } : {}),
257
263
  },
258
264
  ...(childColumnLocator !== undefined ? { childColumnLocator } : {}),
265
+ // 非字段控件摘要(恒回数组,0 也给):空数组 = 这面确实没有布局控件,
266
+ // 不是「没读到」。写面是 form.draft {decorations}。
267
+ decorations: decorationSummary.decorations,
268
+ decorationsFace: decorationFace,
269
+ ...(decorationSummary.note !== undefined ? { decorationsNote: decorationSummary.note } : {}),
259
270
  ...(flagMismatch
260
271
  ? {
261
272
  flagMismatch: true,
@@ -381,7 +392,9 @@ export function registerFormLane(tools) {
381
392
  compact: (result) => {
382
393
  // 探针 L F7:platformFlags 只有两个布尔,compact 若不保留会被压成
383
394
  // `platformFlagsCount:2`,平台原文恰好在降载时丢失。
384
- const KEEP = new Set(["draftControls", "publishedControls", "customButtonJson", "options", "formButtons", "formButtonCodes", "platformFlags", "childColumnLocator"]);
395
+ // issue #57:decorations 是**证据行集**(key/type/html/row),压成码表就
396
+ // 丢掉了「用户加了什么描述块」这个答案;payload 已按 1800B 自限。
397
+ const KEEP = new Set(["draftControls", "publishedControls", "customButtonJson", "options", "formButtons", "formButtonCodes", "platformFlags", "childColumnLocator", "decorations"]);
385
398
  // r28e F4 暴露的潜在 bug:handler 已经交过 `*Codes`/`*Count`/`*Omitted`
386
399
  // 这类**已压缩**的键,若再走数组分支会被二次加后缀
387
400
  // (`publishedControlCodes` → `publishedControlCodesCodes`),字段直接消失。
@@ -611,15 +624,26 @@ export function registerFormLane(tools) {
611
624
  writeTool({
612
625
  tools,
613
626
  name: "form.draft",
614
- search: { intents: ["改表单布局", "调表单布局", "表单拖字段", "存表单草稿", "表单加控件"] },
627
+ search: { intents: ["改表单布局", "调表单布局", "表单拖字段", "存表单草稿", "表单加控件", "表单描述块", "描述说明", "富文本说明", "红色提示文字"] },
615
628
  lane: FORM_LANE,
616
629
  scope: FORM_TOOLS["form.draft"].scope,
617
630
  description: FORM_TOOLS["form.draft"].description,
618
631
  inputSchema: {
619
632
  schemaCode: z.string().min(1),
620
633
  sheetCode: z.string().min(1).optional().describe("表单槽位码;省略时默认 = schemaCode(模型码即默认表单槽位)"),
621
- draftViewJson: z.string().optional().describe("行分组:JSON 二维字符串数组 `[[\"codeA\",\"codeB\"],[\"codeC\"]]`——**一行几个 code 就是几列**(不是改 span 来改列数);末行只放一个 code 即整宽。每个 code 必须同时出现在 draftAttributesJson 里。现成样例:`omc describe form.draft --example two-column-layout`"),
622
- 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`"),
634
+ draftViewJson: z.string().optional().describe("行分组:JSON 二维字符串数组 `[[\"a\",\"b\"],[\"c\"]]`——**一行几个 code 就是几列**(不是靠 span);每个 code 必须同时出现在 draftAttributesJson。样例 `omc describe form.draft --example two-column-layout`"),
635
+ draftAttributesJson: z.string().optional().describe("控件表 `{code:{key,type,options:{name,span}}}`。**type 是表单控件枚举,不是字段 propertyType**(80=关联单选/201=子表…),错枚举拒 `form-control-type-mismatch`;span 是 24 栅格(两列 12/整宽 24,须与行分组自洽)。非字段控件 200/202/203 勿手拼,用 decorations"),
636
+ decorations: z
637
+ .array(z.object({
638
+ key: z.string().min(1).optional().describe("省略=自动生成 Description<序号>;带 key 命中既有布局控件=改它(其余 options 原样保留)"),
639
+ type: z.number().int().optional().describe("200 分组标题 / 202 描述说明(默认)/ 203 表单标题;已有控件不可原地改类型"),
640
+ html: z.string().optional().describe("202 的正文 HTML,写进 options.name(设计器同形,按 innerHTML 渲染)"),
641
+ name: z.string().optional().describe("200/203 的纯文本名;202 也可用它代替 html"),
642
+ span: z.number().int().positive().optional().describe("24 栅格宽度,∈6/8/12/16/18/24;插入已有行省略时用剩余宽度"),
643
+ row: z.number().int().positive().optional().describe("插入行,1-based;省略=末尾追加一行(span 默认 24)"),
644
+ }))
645
+ .optional()
646
+ .describe("增量加/改布局控件 200/202/203(202 的 html 写 options.name);与 draftViewJson/draftAttributesJson/layout/rebuild/fieldCodes/childColumns 互斥。样例 `omc describe form.draft --example form-description-block`"),
623
647
  layout: z
624
648
  .object({
625
649
  rows: z.array(z.array(z.string().min(1)).min(1)).min(1),
@@ -627,34 +651,35 @@ export function registerFormLane(tools) {
627
651
  includeSystem: z.boolean().optional(),
628
652
  })
629
653
  .optional()
630
- .describe("增量布局(推荐):{rows:[[\"a\",\"b\"],[\"c\"]],spans?:{a:12},includeSystem?}。以当前草稿为基线(草稿为空时退回已发布),只改 rows 行分组与这些控件 span,**不必回传整包 attrs**;未列入 rows 的控件保留原行,系统控件须 includeSystem:true 才动。与 draftViewJson/draftAttributesJson/rebuild/fieldCodes/childColumns/refreshFromFields/fromReadback 互斥"),
631
- allowTypeMismatch: z.boolean().optional().describe("放行控件 type 与字段 propertyType 不匹配(默认拒 form-control-type-mismatch;仅平台模板明确要求特殊控件时用)"),
654
+ .describe("增量布局(推荐):{rows:[[\"a\",\"b\"],[\"c\"]],spans?:{a:12},includeSystem?}。以当前草稿为基线(空则退回已发布),只改行分组与 span,**不必回传整包 attrs**;未列入 rows 的控件保留原行,系统控件须 includeSystem:true。与 draftViewJson/draftAttributesJson/rebuild/fieldCodes/childColumns/refreshFromFields/fromReadback/decorations 互斥"),
655
+ allowTypeMismatch: z.boolean().optional().describe("放行控件 type 与 propertyType 不匹配(默认拒 form-control-type-mismatch;仅平台模板要求时用)"),
632
656
  draftHtmlJson: z.string().optional(),
633
657
  fieldCodes: z.array(z.string().min(1)).optional().describe("脚手架绑定的已发布字段(按此顺序);由 configure_form/intent 显式传入。子表列写「父字段.子列」等价于 childColumns"),
634
658
  childColumns: z
635
659
  .array(z.object({ parent: z.string().min(1), fieldCodes: z.array(z.string().min(1)) }))
636
660
  .optional()
637
- .describe("把子表列绑进**已有** Sheet201 控件的 columns(issue #24):[{parent:\"items\",fieldCodes:[\"category\"]}]。只追加列,不动其它控件/布局行;无已存布局时退回 scaffold"),
661
+ .describe("把子表列绑进**已有** Sheet201 控件的 columns:`[{parent:\"items\",fieldCodes:[\"category\"]}]`。只追加列,不动其它控件/布局行;无已存布局时退回 scaffold"),
638
662
  rebuild: z.boolean().optional().describe("true 时丢弃现有草稿布局,按已发布字段重新生成(新增字段/子表要用它;默认保留现有草稿)"),
639
663
  refreshFromFields: z.boolean().optional().describe("true 时不重建布局,仅按当前已发布字段 options 刷新现有控件派生配置"),
640
- fromReadback: z.boolean().optional().describe("true = 本次 draftViewJson/draftAttributesJson 来自 form.get 的**逐字未改动**原文(平台自身布局可能含子表列行/系统行超宽,逐字回写放行)。语义是「回写」不是「我读过」:读过之后改过一个字符就不再是回读,会被拒(去掉本参数按普通写面校验)。只加子表列请用 configure_form 的 childColumns"),
664
+ fromReadback: z.boolean().optional().describe("true = draftViewJson/draftAttributesJson 是 form.get 的**逐字未改动**原文(平台自身布局的超宽行放行)。改过一字符就不是回读,会被拒;只加子表列用 childColumns"),
641
665
  allowEmptyLayout: z.boolean().optional().describe("显式放行空布局(\"[]\"/\"{}\")写入;默认拒绝(form-empty-layout),防设计器 Save 清空后照写丢控件"),
642
666
  buttons: z
643
667
  .array(z.record(z.unknown()))
644
668
  .optional()
645
- .describe("表单工具栏按钮(写进 biz_sheet.options.customButtonJson;publish 时才生成 h_biz_button(triggerType=FORM))。每条必填键见 contract form 的 formButtons;code 语义化"),
669
+ .describe("表单工具栏按钮(写进 options.customButtonJson;publish 时才生成 h_biz_button(triggerType=FORM))。必填键见 contract form 的 formButtons"),
646
670
  customButtonJson: z.string().optional().describe("buttons 的原样 JSON 数组字符串(与 buttons 互斥;用于把 form.get 读回值直接回写)"),
647
- buttonsMode: z.enum(["merge", "replace"]).optional().describe("默认 merge:按 code 增量 upsert(改一个按钮不必重发全表);replace:整表替换"),
671
+ buttonsMode: z.enum(["merge", "replace"]).optional().describe("默认 merge:按 code 增量 upsert;replace:整表替换"),
648
672
  removeButtonCodes: z.array(z.string().min(1)).optional().describe("要删除的按钮 code(仅 merge 模式)"),
649
- buttonScripts: z.array(z.object({ code: z.string().min(1), script: z.string() })).optional().describe("直接改已有表单按钮的脚本(actionConfig.scriptData),按 code 逐字替换;未知 code 拒绝。不必重发整表"),
673
+ buttonScripts: z.array(z.object({ code: z.string().min(1), script: z.string() })).optional().describe("直接改已有按钮脚本(actionConfig.scriptData),按 code 逐字替换;未知 code 拒绝"),
650
674
  },
651
675
  execute: async (session, args) => executeFormDraftWrite(session, { ...args, sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode) }),
652
676
  preflight: (args) => {
653
677
  // Zero-wire refusal (ticket 74): fires in semanticGate BEFORE the
654
678
  // governed pipeline — including the rollback before-capture read.
655
679
  const resolved = { ...args, sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode) };
656
- // layout 是增量面,与整包布局/重建参数互斥:纯参数门,零 wire。
680
+ // layout / decorations 是增量面,与整包布局/重建参数互斥:纯参数门,零 wire。
657
681
  assertLayoutRequestConflicts(resolved);
682
+ assertDecorationRequestConflicts(resolved);
658
683
  refuseEmptyCallerLayout(resolved);
659
684
  },
660
685
  // R75-B seam: dry-run 与真写共用这一个 session 只读 lint(dry-run 直接跑它)。
@@ -672,6 +697,14 @@ export function registerFormLane(tools) {
672
697
  });
673
698
  return { layout: composed.receipt, ...(composed.warnings.length > 0 ? { layoutWarnings: composed.warnings } : {}) };
674
699
  }
700
+ if (args.decorations !== undefined) {
701
+ const composed = await composeFormDecorationsDraft(session, {
702
+ schemaCode: args.schemaCode,
703
+ sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode),
704
+ decorations: args.decorations,
705
+ });
706
+ return { decorations: composed.receipt, ...(composed.warnings.length > 0 ? { decorationWarnings: composed.warnings } : {}) };
707
+ }
675
708
  if (args.fromReadback === true)
676
709
  return { controlTypeCheck: "skipped-fromReadback" };
677
710
  const lint = await lintFormControlTypes(session, {
@@ -731,7 +764,7 @@ export function registerFormLane(tools) {
731
764
  customButtonJson: z.string().optional().describe("buttons 的原样 JSON 数组字符串(与 buttons 互斥)"),
732
765
  buttonsMode: z.enum(["merge", "replace"]).optional().describe("默认 merge:按 code 增量 upsert;replace:整表替换"),
733
766
  removeButtonCodes: z.array(z.string().min(1)).optional().describe("要删除的按钮 code(仅 merge 模式)"),
734
- buttonScripts: z.array(z.object({ code: z.string().min(1), script: z.string() })).optional().describe("直接改已有表单按钮的脚本(actionConfig.scriptData),按 code 逐字替换;未知 code 拒绝。不必重发整表"),
767
+ buttonScripts: z.array(z.object({ code: z.string().min(1), script: z.string() })).optional().describe("直接改已有按钮脚本(actionConfig.scriptData),按 code 逐字替换;未知 code 拒绝"),
735
768
  },
736
769
  execute: async (session, args) => executeFormPublishWrite(session, { ...args, sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode) }),
737
770
  // R75-B 续:降级守卫(草稿控件数 < 发布面)此前只在真写里——空/残草稿的
@@ -12,7 +12,7 @@ import { jsonBytes } from "../support.js";
12
12
  import { READ_DIET_INLINE_BYTES } from "../read-projection.js";
13
13
  import { QUERY_ACTION_TYPE } from "omc-core/list-view-wire";
14
14
  import { resolveModelTreeNode } from "./model.js";
15
- import { NUMERICAL_FORMAT_DECIMALS, SYSTEM_FIELD_CODES, canonicalNumericalFormat } from "../field-families.js";
15
+ import { NUMERICAL_FORMAT_DECIMALS, SYSTEM_FIELD_CODES, canonicalNumericalFormat, hasUnpublishedCustomOptions } from "../field-families.js";
16
16
  import { LIST_VIEW_LANE_CONTRACT } from "./list-view-contract.js";
17
17
  import { assertListViewConfigureShape, decodeActionRow, decodeButtonRow, decodeConditionRow, decodeGantt, decodePresentation, decodeSortRow, diffTreeConditionKeys, LISTVIEW_TREE_CONDITION_KEYS, listViewActionArg, listViewButtonArg, listViewConditionArg, listViewGanttArg, listViewMultiTableHeaderArg, listViewOptionsArg, listViewPresentationArg, listViewQueryLayerArg, listViewSortArg, mergeActions, PLATFORM_DEFAULT_LIST_ACTIONS, PLATFORM_INJECTED_READ_ACTIONS, normalizeActions, normalizeButtons, normalizeConditions, normalizeGantt, normalizePresentation, normalizeSorts, parseConditionOptions, presentationTypeArg, queryLayerSummary, readArray, resolveFieldRef, treeConditionKeysPresent, treeConditionValueEqual, buttonsRenderCompat, columnsRenderCompat, } from "./list-view-shapes.js";
18
18
  // Ticket 53: every shape (enum/zod/encode/decode/lint) lives once in
@@ -178,6 +178,19 @@ function conditionOptionsWithOperator(condition) {
178
178
  function conditionValueEqual(left, right) {
179
179
  return JSON.stringify(left) === JSON.stringify(right);
180
180
  }
181
+ /**
182
+ * F7(探针 Z,0.8.34):条件行读面的 `options` 是**字段自身 options** 的回填
183
+ * (8.6.26 `BizQueryFacadeImpl.getBizQuery` 在回读前覆盖条件 options)。条件引用
184
+ * 了「行级 published:true、custom 选项 published:false」的字段时,与 field 面
185
+ * 同口径点名——门户 UI 是否使用选项级标记未验证,不据此断言筛选会/不会显示。
186
+ */
187
+ const CONDITION_OPTION_PUBLISHED_NOTE = "这些条件引用的字段行 published:true,但 custom 选项带 published:false:字段/表单发布不重写选项级标记;2.1.5 REST 按 code/value 接受该选项(运行期 data.save/data.load 可用);字段是否生效看行级 published。门户 UI 是否使用该选项标记未验证——不要据此断言门户会/不会显示。";
188
+ function conditionOptionPublishedFieldsOf(conditions) {
189
+ return [...new Set(conditions
190
+ .filter((condition) => hasUnpublishedCustomOptions(condition.options))
191
+ .map((condition) => String(condition.propertyCode ?? ""))
192
+ .filter((code) => code.length > 0))];
193
+ }
181
194
  /**
182
195
  * QueryRuntimeController.parseNumber keys its formatting off displayFormat with
183
196
  * no case 0 (valid values start at 1): 1=integer, 2=1dp, 3=2dp, 11=3dp,
@@ -605,6 +618,7 @@ export function registerListViewLane(tools) {
605
618
  const conditions = readArray(model, "queryConditions")
606
619
  .map(decodeConditionRow)
607
620
  .sort((a, b) => String(a.propertyCode ?? "").localeCompare(String(b.propertyCode ?? "")));
621
+ const conditionOptionPublishedFields = conditionOptionPublishedFieldsOf(conditions);
608
622
  // T14:2.1.5 的 queryDataRangeRestriction 不在精简面的任何既有投影里,
609
623
  // 调用方无法验收它「还在」。键存在(非 undefined/null)才回摘要;8.6 没有
610
624
  // 这个键 → 一个字节都不新增(键缺席 = 该版本族无此配置面)。full:true
@@ -643,6 +657,9 @@ export function registerListViewLane(tools) {
643
657
  conditionCount: conditions.length,
644
658
  conditions,
645
659
  conditionsDetailed: conditions.map(({ options: _options, ...rest }) => rest),
660
+ ...(conditionOptionPublishedFields.length > 0
661
+ ? { conditionOptionPublishedFields, conditionOptionPublishedNote: CONDITION_OPTION_PUBLISHED_NOTE }
662
+ : {}),
646
663
  actionCodes: readArray(model, "queryActions").map((action) => action.actionCode).filter((value) => value !== undefined),
647
664
  buttonCount: readArray(model, "customButtons").length,
648
665
  // r14 F5 / r11 #6: the default face exposed only `buttonCount`, so a
@@ -720,6 +737,12 @@ export function registerListViewLane(tools) {
720
737
  const codeOf = (entry) => typeof entry === "string" ? entry : entry && typeof entry === "object" ? String(entry.propertyCode ?? "") : "";
721
738
  return {
722
739
  ...base,
740
+ ...(Array.isArray(result.conditionOptionPublishedFields)
741
+ ? {
742
+ conditionOptionPublishedFields: result.conditionOptionPublishedFields,
743
+ ...(typeof result.conditionOptionPublishedNote === "string" ? { conditionOptionPublishedNote: result.conditionOptionPublishedNote } : {}),
744
+ }
745
+ : {}),
723
746
  ...(detailedColumns.length > 0 ? { columnsDetailed: detailedColumns } : {}),
724
747
  ...(detailedSorts.length > 0
725
748
  ? { sorts: detailedSorts.map(codeOf).filter(Boolean), sortsDetailed: detailedSorts }
@@ -1300,6 +1323,7 @@ export function registerListViewLane(tools) {
1300
1323
  const conditions = readArray(afterModel, "queryConditions")
1301
1324
  .map(decodeConditionRow)
1302
1325
  .sort((a, b) => String(a.propertyCode ?? "").localeCompare(String(b.propertyCode ?? "")));
1326
+ const conditionOptionPublishedFields = conditionOptionPublishedFieldsOf(conditions);
1303
1327
  const readback = {
1304
1328
  code,
1305
1329
  ...(storedViewName !== null ? { name: storedViewName } : {}),
@@ -1318,6 +1342,9 @@ export function registerListViewLane(tools) {
1318
1342
  columns: afterCols,
1319
1343
  sorts,
1320
1344
  conditions,
1345
+ ...(conditionOptionPublishedFields.length > 0
1346
+ ? { conditionOptionPublishedFields, conditionOptionPublishedNote: CONDITION_OPTION_PUBLISHED_NOTE }
1347
+ : {}),
1321
1348
  };
1322
1349
  // F2(0.8.10 探针 E):平台在建视图时就给默认视图种了 4 个系统列
1323
1350
  // name/creater/createdTime/sequenceNo(BizQueryServiceImpl.createDefaultBizQuery
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { ENDPOINTS } from "../endpoints.js";
3
- import { assertFieldFamilyAllowed, assertSelectionChoicesAllowed, choicesArg, fieldOptionsArg, nameI18nJson, propertyTypeArg, relativeCodeArg, SYSTEM_FIELD_CODES, subFieldArg, } from "../field-families.js";
3
+ import { assertFieldFamilyAllowed, assertSelectionChoicesAllowed, choicesArg, FIELD_PROPERTY_TYPES, fieldOptionsArg, nameI18nJson, propertyTypeArg, relativeCodeArg, SYSTEM_FIELD_CODES, subFieldArg, } from "../field-families.js";
4
4
  import { modelSchemaCodes, lintFieldCreateWrite } from "./field.js";
5
5
  import { fieldChangeWireBody, prepareFieldChange, sameFieldChange } from "../field-change.js";
6
6
  import { executeFormDraftWrite, executeFormPublishWrite } from "../form-support.js";
@@ -470,6 +470,16 @@ export function registerModelLane(tools) {
470
470
  const fields = fieldRows
471
471
  .filter((field) => all || !SYSTEM_FIELD_CODES.has(String(field.code)))
472
472
  .map((field) => ({ code: field.code, type: field.type, ...(field.typeName !== undefined ? { typeName: field.typeName } : {}), name: field.name, ...(field.conditions ? { conditions: field.conditions } : {}), ...(all && field.options !== undefined ? { options: field.options } : {}) }));
473
+ // F8(探针 Z):fieldCodes/fields 只计**父模型业务字段**(`all:true` 也不把
474
+ // 系统字段算进来)。子表列住在子表 schema(code = 父 CHILD_TABLE 字段 code),
475
+ // 与 model-scaffold 的 fieldCount(父字段 + 子列)是两个口径——分开给读数,
476
+ // 别让调用方按 fieldCodes.length 对账 scaffold 的 fieldCount。
477
+ const businessFieldRows = fieldRows.filter((field) => !SYSTEM_FIELD_CODES.has(String(field.code ?? "")));
478
+ const publishedParentFieldCount = businessFieldRows.length;
479
+ const childTableCodes = businessFieldRows
480
+ .filter((field) => Number(field.type) === FIELD_PROPERTY_TYPES.CHILD_TABLE)
481
+ .map((field) => String(field.code))
482
+ .filter((code) => code.length > 0);
473
483
  const form = formFace && formFace.present !== undefined
474
484
  ? { present: formFace.present === true, published: formFace.published === true, controlCount: Array.isArray(formFace.draftControlCodes) ? formFace.draftControlCodes.length : 0 }
475
485
  : undefined;
@@ -559,6 +569,13 @@ export function registerModelLane(tools) {
559
569
  : {}),
560
570
  fields,
561
571
  fieldsScope: "published",
572
+ publishedParentFieldCount,
573
+ ...(childTableCodes.length > 0
574
+ ? {
575
+ childTableCodes,
576
+ fieldsCountNote: "fieldCodes/fields 只计父模型业务字段(系统字段不计,all:true 也不计);子表列在子表 schema(schemaCode = 父 CHILD_TABLE 字段 code),不在本清单。model-scaffold 的 fieldCount = 父字段 + 子列,两者口径不同——别按 fieldCodes.length 对账 fieldCount。",
577
+ }
578
+ : {}),
562
579
  form,
563
580
  listview,
564
581
  rules,
@@ -591,6 +608,13 @@ export function registerModelLane(tools) {
591
608
  // 只剩 schemaCode,`--jq '[].code'` 必 pathMiss 白跑一轮)。
592
609
  ...(result.code !== undefined ? { code: result.code } : {}),
593
610
  fieldCodes: (result.fields ?? []).map((field) => field.code),
611
+ ...(result.publishedParentFieldCount !== undefined ? { publishedParentFieldCount: result.publishedParentFieldCount } : {}),
612
+ ...(Array.isArray(result.childTableCodes)
613
+ ? {
614
+ childTableCodes: result.childTableCodes,
615
+ ...(typeof result.fieldsCountNote === "string" ? { fieldsCountNote: result.fieldsCountNote } : {}),
616
+ }
617
+ : {}),
594
618
  ...(Array.isArray(result.fields) && result.fields.some((field) => field.options !== undefined)
595
619
  ? { fields: result.fields }
596
620
  : {}),