@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.
@@ -533,6 +533,123 @@ export function projectionRetryCommand(context, path) {
533
533
  `--jq ${shellQuote(path)}`,
534
534
  ].join(" ");
535
535
  }
536
+ /**
537
+ * 0.8.12 F7(探针 G 真机 2.1.5):`form.get` 的 `full:true` 独占键。紧凑面只回
538
+ * 控件码/计数/按钮计数,六份布局 JSON、`options`、按钮定义正文只在 full 面
539
+ * (见 `lanes/form.ts` 的 full 分支)。`--jq publishedAttributesJson` 在紧凑面
540
+ * pathMiss,而 C6(0.8.4)的紧凑回执默认不带 available/nextCommand——读起来就是
541
+ * 「这个字段不存在」。已知键直接指路 `full:true`,不要让调用方再猜一轮。
542
+ *
543
+ * `draftRows`/`publishedRows` 是行分组:紧凑面**能解析 viewJson 时**也给
544
+ * (r28e F4),解析不出时只剩 full 面的小布局摘要——所以它们在这里,但
545
+ * nextCommand 只在整路径就是该键时给(带后缀的话 full 面也解析不了字符串)。
546
+ */
547
+ export const FORM_FULL_ONLY_KEYS = Object.freeze([
548
+ "draftViewJson",
549
+ "draftAttributesJson",
550
+ "draftHtmlJson",
551
+ "draftActionsJson",
552
+ "publishedViewJson",
553
+ "publishedAttributesJson",
554
+ "publishedHtmlJson",
555
+ "publishedActionsJson",
556
+ "options",
557
+ "customButtonJson",
558
+ "htmlRenderCompat",
559
+ "draftRows",
560
+ "publishedRows",
561
+ ]);
562
+ /**
563
+ * 把 `{...原参数, full:true}` 重建成一条可复制命令。参数 >500B 或不是合法对象
564
+ * 就放弃(宁可不给,不截断造假)——与 `projectionRetryCommand` 同一纪律。
565
+ */
566
+ function fullFaceRetryCommand(context, path) {
567
+ if (context === undefined || context.tool === undefined || context.tool.length === 0 || context.argsJson === undefined)
568
+ return undefined;
569
+ let parsed;
570
+ try {
571
+ parsed = JSON.parse(context.argsJson);
572
+ }
573
+ catch {
574
+ return undefined;
575
+ }
576
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
577
+ return undefined;
578
+ const args = parsed;
579
+ // 中间态:已带 full:true 就不再拼第二遍(真正的外置指引在 fullFaceGuidance)。
580
+ if (args.full === true)
581
+ return undefined;
582
+ const json = JSON.stringify({ ...args, full: true });
583
+ if (Buffer.byteLength(json, "utf8") > RETRY_ARGS_MAX_BYTES)
584
+ return undefined;
585
+ return [
586
+ `omc call ${context.tool}`,
587
+ ...(context.environment !== undefined && context.environment.length > 0 ? [`--env ${context.environment}`] : []),
588
+ `--args ${shellQuote(json)}`,
589
+ `--jq ${shellQuote(path)}`,
590
+ ].join(" ");
591
+ }
592
+ /**
593
+ * F7:仅当 miss 的**顶层段**就是某个 full 面独占键时指路。带后缀(`x.y`)的 miss
594
+ * 落点更深,`head !== at`,这里不接管——否则给的命令重跑仍会 miss。
595
+ */
596
+ export function fullFaceGuidance(path, at, retry) {
597
+ if (retry === undefined || retry.tool !== "form.get")
598
+ return undefined;
599
+ if (at === undefined || at.length === 0)
600
+ return undefined;
601
+ const head = path.replace(/^\$\.?/, "").replace(/^[.\/]+/, "").split(/[.\[]/)[0] ?? "";
602
+ if (head !== at || !FORM_FULL_ONLY_KEYS.includes(head))
603
+ return undefined;
604
+ // 已经是 full 面还 miss:正文 >32KB 时 full 面会外置(`<key>Omitted` + artifact),
605
+ // 再让调用方加 full:true 是死循环——直接指 artifact。
606
+ if (retry.argsJson !== undefined) {
607
+ try {
608
+ const parsed = JSON.parse(retry.argsJson);
609
+ if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) && parsed.full === true) {
610
+ const key = head.replace(/'/g, "'\\''");
611
+ return {
612
+ key: head,
613
+ fullOnlyKeys: FORM_FULL_ONLY_KEYS,
614
+ hint: `${head} 在 full 面;本次 full:true 已外置(>32KB)——正文用 artifact get <id> --jq '${key}' 取(或看 ${head}Omitted)。`,
615
+ };
616
+ }
617
+ }
618
+ catch {
619
+ // 参数不是合法 JSON:退回「重跑 full:true」的行动句(不编造命令)。
620
+ }
621
+ }
622
+ const nextCommand = fullFaceRetryCommand(retry, path);
623
+ const hint = `${head} 只在 full:true 面(紧凑面只给控件码/计数)——${nextCommand !== undefined ? "按 nextCommand 重跑" : "加 \"full\":true 重跑"};fullOnlyKeys 是同组键。`;
624
+ return { key: head, fullOnlyKeys: FORM_FULL_ONLY_KEYS, ...(nextCommand !== undefined ? { nextCommand } : {}), hint };
625
+ }
626
+ /** F7:紧凑回执的 hint 字节纪律(与既有 pathMiss hint 同口径)。 */
627
+ /**
628
+ * F7:pathMiss 的通用教学——「这一层到底有什么」。默认面受 C6 的 300B 预算约束
629
+ * 不内联(完整键表进 `--explain` 的 `available`);此函数供 `--explain` 面与
630
+ * 需要显式教学文案的调用方复用。
631
+ */
632
+ export function pathMissAvailableHint(at, available, availableAll) {
633
+ const list = availableAll ?? available;
634
+ if (!Array.isArray(list))
635
+ return undefined;
636
+ const keys = list.map((entry) => String(entry)).filter((entry) => entry.length > 0);
637
+ if (keys.length === 0)
638
+ return undefined;
639
+ const head = `${at !== undefined && at.length > 0 ? at : "该层"} 未命中;该层键:`;
640
+ const suffix = "(--explain 看全部;裸 --jq 列键)";
641
+ const budget = 200 - Buffer.byteLength(head + suffix, "utf8") - 12;
642
+ const shown = [];
643
+ for (const key of keys.slice(0, 5)) {
644
+ if (Buffer.byteLength([...shown, key].join("、"), "utf8") > budget)
645
+ break;
646
+ shown.push(key);
647
+ }
648
+ if (shown.length < Math.min(5, keys.length))
649
+ return undefined;
650
+ const rest = keys.length > shown.length ? ` 等 ${keys.length} 个` : "";
651
+ return `${head}${shown.join("、")}${rest}${suffix}`;
652
+ }
536
653
  /**
537
654
  * 多路径一次投影时的**唯一一份**顶层说明。只给位置语义 + helpRef——
538
655
  * F1(retro 22):语法长句不内联(教程只在 help)。
@@ -823,6 +940,17 @@ export function projectResultExtract(result, paths, keysOnly, retry, explain = f
823
940
  }
824
941
  return multiPath ? pathMissEntryHint(at, available) : PATH_MISS_HINT;
825
942
  };
943
+ /**
944
+ * F7(0.8.12)与 C6(0.8.4)的边界:默认 pathMiss 仍只留「在哪断 + 最接近的键 +
945
+ * 教程指针」(≤300B,无 available/hint);full 面独占键只允许带一条**能装进
946
+ * 300B** 的 `nextCommand`,装不下就留给 `--explain`。
947
+ */
948
+ const compactMissExtra = (_path, _at, entry, fullFace) => {
949
+ if (fullFace?.nextCommand === undefined)
950
+ return {};
951
+ const candidate = { ...entry, nextCommand: fullFace.nextCommand };
952
+ return Buffer.byteLength(JSON.stringify(candidate), "utf8") <= 300 ? { nextCommand: fullFace.nextCommand } : {};
953
+ };
826
954
  out.extract = paths.map((path) => {
827
955
  // r28f F2:对象构造 / 函数调用不是 pathMiss——先识别,别伪装成键缺失。
828
956
  const unsupported = detectUnsupportedJqSyntax(path);
@@ -849,26 +977,30 @@ export function projectResultExtract(result, paths, keysOnly, retry, explain = f
849
977
  const didYouMean = pathMissDidYouMean(fan.at, fan.available, fan.availableAll);
850
978
  const correction = missCorrectionFor(path, fan.at, fan.available, fan.availableAll);
851
979
  const nextCommand = correction !== undefined ? projectionRetryCommand(retry, correction.correctPath) : undefined;
852
- return {
980
+ // F7(0.8.12):与单路径面同口径(full 面独占键 / 可用键 hint)。
981
+ const fullFace = fullFaceGuidance(path, fan.at, retry);
982
+ const baseMiss = {
853
983
  path,
854
984
  content: null,
855
985
  pathMiss: true,
856
986
  missedAt: fan.at,
857
987
  ...(didYouMean !== undefined ? { didYouMean } : {}),
858
988
  helpRef: PATH_MISS_HELP_REF,
859
- // C6(0.8.4):默认只留「在哪断 + 最接近的键 + 教程指针」(≤300B);
860
- // 整层键表/可复制路径/重跑命令/成因说明是排查载荷,只在 --explain 给。
989
+ };
990
+ return {
991
+ ...baseMiss,
861
992
  ...(explain
862
993
  ? {
994
+ ...(fullFace !== undefined ? { fullOnlyKeys: fullFace.fullOnlyKeys } : {}),
863
995
  available: fan.available,
864
996
  ...(fan.availableTruncated !== undefined ? { availableTruncated: fan.availableTruncated } : {}),
865
997
  missedEntries: fan.missedEntries,
866
998
  ...(correction !== undefined ? { correctPath: correction.correctPath } : {}),
867
- ...(nextCommand !== undefined ? { nextCommand } : {}),
999
+ ...(fullFace !== undefined ? {} : nextCommand !== undefined ? { nextCommand } : {}),
868
1000
  ...(readFromArtifact ? resultLayerNote(result, path, projectionSource, fan.at) ?? {} : {}),
869
- hint: missHintFor(fan.at, fan.available, correction),
1001
+ hint: fullFace?.hint ?? missHintFor(fan.at, fan.available, correction),
870
1002
  }
871
- : {}),
1003
+ : compactMissExtra(path, fan.at, baseMiss, fullFace)),
872
1004
  };
873
1005
  }
874
1006
  return {
@@ -899,24 +1031,31 @@ export function projectResultExtract(result, paths, keysOnly, retry, explain = f
899
1031
  const didYouMean = pathMissDidYouMean(single.at, single.available, single.availableAll);
900
1032
  const correction = missCorrectionFor(path, single.at, single.available, single.availableAll);
901
1033
  const nextCommand = correction !== undefined ? projectionRetryCommand(retry, correction.correctPath) : undefined;
902
- return {
1034
+ // F7(0.8.12):full 面独占键直接指路;否则紧凑面也要给「这层有什么」。
1035
+ const fullFace = fullFaceGuidance(path, single.at, retry);
1036
+ const baseMiss = {
903
1037
  path,
904
1038
  content: null,
905
1039
  pathMiss: true,
906
1040
  missedAt: single.at,
907
1041
  ...(didYouMean !== undefined ? { didYouMean } : {}),
908
1042
  helpRef: PATH_MISS_HELP_REF,
909
- // C6(0.8.4):见 fanout 同款说明——默认只留结论,排查载荷在 --explain。
1043
+ };
1044
+ // C6(0.8.4):整层键表/可复制路径/重跑命令/成因说明是排查载荷,只在
1045
+ // --explain 给;默认只允许一条装得进 300B 的 full 面重试命令(F7)。
1046
+ return {
1047
+ ...baseMiss,
910
1048
  ...(explain
911
1049
  ? {
1050
+ ...(fullFace !== undefined ? { fullOnlyKeys: fullFace.fullOnlyKeys } : {}),
912
1051
  available: single.available,
913
1052
  ...(single.availableTruncated !== undefined ? { availableTruncated: single.availableTruncated } : {}),
914
1053
  ...(correction !== undefined ? { correctPath: correction.correctPath } : {}),
915
- ...(nextCommand !== undefined ? { nextCommand } : {}),
1054
+ ...(fullFace !== undefined ? {} : nextCommand !== undefined ? { nextCommand } : {}),
916
1055
  ...(readFromArtifact ? resultLayerNote(result, path, projectionSource, single.at) ?? {} : {}),
917
- hint: missHintFor(single.at, single.available, correction),
1056
+ hint: fullFace?.hint ?? missHintFor(single.at, single.available, correction),
918
1057
  }
919
- : {}),
1058
+ : compactMissExtra(path, single.at, baseMiss, fullFace)),
920
1059
  };
921
1060
  }
922
1061
  return {
@@ -124,7 +124,7 @@ const dataruleChildColumn = Object.freeze({
124
124
  tool: "datarule.create",
125
125
  args: {
126
126
  environment,
127
- schemaCode: "<childSchemaCode e.g. <model>_items>",
127
+ schemaCode: "<子表父字段 code,如 items>",
128
128
  propertyCode: "amount",
129
129
  dataRuleType: 2,
130
130
  options: {
@@ -215,15 +215,15 @@ const childTable = Object.freeze({
215
215
  },
216
216
  preconditions: ["目标模型已存在;父字段 code 和子列 codes 尚未存在;父模型字段发布后再配置表单"],
217
217
  conditionalRequirements: [
218
- "**子表 `code` 会成为全局子 schema code——必须模型作用域唯一(如 `<model>_items`),不要用通用名如 `items`/`purchase_items`,否则撞名时平台只回 errcode 40000「调用数据库发生异常」(实测)**;",
218
+ "**父字段 `code` = 子 schema code = 子列 field.create/update 的 schemaCode(同一个值)**;平台要求全局唯一,跨模型撞名就加前缀(如 `<model>_items`),撞名时只回 errcode 40000「调用数据库发生异常」(实测);",
219
219
  "子表列不得是 CHILD_TABLE、OCR、ELECTRONIC_SIGN、RELEVANCE_DATA 或 FORMULA;关系列必须另带 relativeCode 与 options;子列 NUMERICAL 同样必须带 options.scale",
220
220
  ],
221
221
  priorToolReferences: [],
222
222
  dryRun: { supported: true, command: `omc call field.create --env ${environment} --dry-run --args '<recipe.args>'`, notes: "dry-run 验证 subFields 并跳过环境写入" },
223
- expectedReadback: { readback: { field: { code: "items", propertyType: "CHILD_TABLE", subSchema: { properties: ["itemName", "itemQty"] } } }, next: ["field.publish", "form.draft", "form.publish"] },
223
+ expectedReadback: { readback: { field: { code: "<model>_items", propertyType: "CHILD_TABLE", subSchema: { properties: ["itemName", "itemQty"] } } }, next: ["field.publish", "form.draft", "form.publish"] },
224
224
  refusalRecovery: [
225
225
  { code: "capability-out-of-coverage", action: "补齐 subFields,并移除不支持的嵌套/高级子列族" },
226
- { code: "child-table-update-unsupported", action: "子列用 schemaCode=items 的 field.create/update;不要向父字段 update 传 options/choices/subFields" },
226
+ { code: "child-table-update-unsupported", action: "子列用 schemaCode=<父字段 code>(本配方即 <model>_items)的 field.create/update;不要向父字段 update 传 options/choices/subFields" },
227
227
  ...commonRecovery,
228
228
  ],
229
229
  requiresEnvironmentDerivedIds: false,
@@ -241,6 +241,11 @@ const childTable = Object.freeze({
241
241
  * `BizPropertyController.java:1138-1146` 用 `getAppFunctionByCodeIgnoreDelete`
242
242
  * 取顶层 app function,子表没有该行);F9 映射正确性读面在 `field.get` 的
243
243
  * `options.mappings` 与 `mappingRuntimeNote`,不必等到 `data.save`。
244
+ *
245
+ * 探针 F(0.8.11):`schemaCode` 曾经写 `<model>_items` 约定名,真机 2.1.5 上
246
+ * 子表子 schema code 就是**父模型 CHILD_TABLE(8) 字段的 code**(父字段叫 `items`
247
+ * 就是 `items`;`BizPropertyManagerImpl.java:197` 用 `bizProperty.getCode()` 建子
248
+ * schema),按约定名建列 → 300004「数据模型不存在!」。
244
249
  */
245
250
  const childTableParentFieldFill = Object.freeze({
246
251
  id: "child-map-fill",
@@ -250,7 +255,7 @@ const childTableParentFieldFill = Object.freeze({
250
255
  tool: "field.create",
251
256
  args: {
252
257
  environment,
253
- schemaCode: "<model>_items",
258
+ schemaCode: "<子表父字段 code>",
254
259
  code: "refParent",
255
260
  name: "关联",
256
261
  propertyType: "WORK_SHEET",
@@ -263,11 +268,13 @@ const childTableParentFieldFill = Object.freeze({
263
268
  },
264
269
  },
265
270
  preconditions: [
271
+ "**子表子 schema code = 父模型 CHILD_TABLE(8) 字段的 code**(父字段 code 为 `items` 时 schemaCode 就是 `items`),不是 `<model>_items` 约定名:`omc call field.list --args '{\"schemaCode\":\"<父模型>\"}'` 找 type:8 字段的 code;同一口径见 `omc contract field-families` 的 `childTableSubSchema`。",
266
272
  "子表 code 全局唯一;先建并发布快照标量列,再建关联列。",
267
273
  "**发布用父模型 code**:`field.publish {\"schemaCode\":\"<父模型>\"}`——子表 code 会被拒(300004 → `field-publish-child-schema`);模型级一次发全部草稿字段,子表列随父模型发。",
268
274
  ],
269
275
  conditionalRequirements: [
270
276
  "映射只在门户选值时回填:CLI data.save(/api/runtime/form/save)不跑 options.mappings,快照列需调用方自填;配置正确性以字段行 options.mappings 为准。",
277
+ "schemaCode 填子表(=父字段 code),发布填父模型 code——两者不是同一个 code,别互相套用。",
271
278
  "关联列必须带 relativeCode(=options.schemaCode=主模型);source=主模型字段、target=本子表列,均裸 code。",
272
279
  "关联列不能是 CHILD_TABLE/OCR/ELECTRONIC_SIGN/MULT_WORK_SHEET/RELEVANCE_DATA/FORMULA。",
273
280
  ],
@@ -50,9 +50,10 @@ const formDraftTwoColumn = Object.freeze({
50
50
  preconditions: [
51
51
  "visitNo/customer/remark 三个字段已 field.publish(布局只能引用已发布字段)",
52
52
  "两段 JSON 都是**字符串**(tool 参数是 string,不是对象)",
53
- "**改既有表单**:先 `form.get full:true` 取 `publishedAttributesJson` 作基线(含 Title/Group/creater/createdTime/sequenceNo 系统控件),只改行分组与 span,不要把本配方的三字段最小布局直接盖上去。判据:`form.get full:true` 返回非空 publishedAttributesJson(或 published:true)→ 既有表单,受 form-publish-degrade 约束;无表单行 / publishedAttributesJson 为空或 \"{}\" → 新建表单,本配方可直接用。",
53
+ "**改既有表单**:优先用 `layout:{rows,...}`(见下,增量改行分组/span、不必回传整包 attrs);若要手写整包,先 `form.get full:true` 取 `publishedAttributesJson` 作基线(含 Title/Group/creater/createdTime/sequenceNo 系统控件),只改行分组与 span,不要把本配方的三字段最小布局直接盖上去。判据:`form.get full:true` 返回非空 publishedAttributesJson(或 published:true)→ 既有表单,受 form-publish-degrade 约束;无表单行 / publishedAttributesJson 为空或 \"{}\" → 新建表单,本配方可直接用。",
54
54
  ],
55
55
  conditionalRequirements: [
56
+ "**改既有表单可用增量布局(不必回传整包 attrs)**:`form.draft {layout:{rows:[[\"visitNo\",\"customer\"],[\"remark\"]], spans:{visitNo:12,customer:12,remark:24}}}` 以已发布(无则草稿)表单为基线,只改这些控件的行分组与 span——其它控件/属性/HTML 逐键保留;未列入 rows 的控件(含 Title/Group/creater/createdTime/sequenceNo 等系统控件)保留原行,系统控件要移动须显式 `includeSystem:true`。layout 与 draftViewJson/draftAttributesJson/rebuild 互斥。列数仍由行分组决定,spans 省略时按行均分 24",
56
57
  "**列数由行分组决定,不由 span 决定**:一行放几个 code 就是几列;span 只控制控件在行内的 24 栅格宽度,且必须与行分组自洽(两列 span:12+12,整宽 span:24)",
57
58
  "draftAttributesJson 的每个控件的 `options` 必须是**对象**,不能是 JSON 字符串(否则运行时写 options.name_i18n 抛错、整页空白)",
58
59
  "**控件 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。错枚举默认拒 `form-control-type-mismatch`(逃生 allowTypeMismatch:true)",
@@ -78,6 +79,14 @@ const formDraftTwoColumn = Object.freeze({
78
79
  action: "按回执 mismatches 的 expectedType 改控件 type(关联单选=80、子表=201、单行文本=1…);或改既有表单时先 `form.get full:true` 取 publishedAttributesJson 作基线只改 rows/span,不要手拼控件 type。确属平台模板要求的特殊控件才传 allowTypeMismatch:true",
79
80
  },
80
81
  { code: "form-field-not-published", action: "先 field.publish 再排布局" },
82
+ {
83
+ code: "layout-system-control-locked",
84
+ action: "layout.rows 只摆业务控件;系统控件(Title/Group/creater/createdTime/sequenceNo)默认保留原行。确要移动它们再加 includeSystem:true(同一行几个 code 仍是几列)",
85
+ },
86
+ {
87
+ code: "form-layout-param-conflict",
88
+ action: "layout 与 draftViewJson/draftAttributesJson/rebuild/fieldCodes 互斥:只改行分组与 span 用 layout;整表重搭或整包回写才用 draft*Json/rebuild",
89
+ },
81
90
  {
82
91
  code: "form-publish-degrade",
83
92
  action: "本配方只有业务字段,覆盖既有表单会丢系统控件。恢复:① `omc call form.get --args '{\"schemaCode\":\"<model>\",\"full\":true}'` 取 publishedAttributesJson;② 以它为基线只改 rows/span(保留 Title/Group/creater/createdTime/sequenceNo 与其它控件)重写草稿;③ 再 form.publish。纯新建表单(publishedAttributesJson 为空)不触发此门。不要把 allowDegrade:true 当默认解法",
@@ -11,6 +11,7 @@ const workflowSave = Object.freeze({
11
11
  preconditions: ["模型默认表单/字段和 workflow 已发布;应用可用;formData 不带已存在 id"],
12
12
  conditionalRequirements: [
13
13
  "workflow draft-save 总是 INSERT;不要把已存在记录 id 放进 formData",
14
+ "子表新建行缺 sortKey 时工具按数组下标补 1..n(平台读回固定 sortKey ASC;更新既有记录请显式带 sortKey)",
14
15
  "**50000 疑应用未发布**:某些环境里模型所在应用未发布时运行时写稳定 50000(工具反推拒 app-not-published;同调用在已发布应用成功);非普遍规律——另有一类环境未发布也能写(2026-09-19 实测,案卷 docs/issues/omc-cli-findings-2026-09-19.md B17)。遇 50000 先只读核对,别仅凭「应用未发布」放弃运行时验证。",
15
16
  ],
16
17
  priorToolReferences: [
@@ -26,6 +27,36 @@ const workflowSave = Object.freeze({
26
27
  requiresEnvironmentDerivedIds: true,
27
28
  prerequisiteData: { source: "workflow.get_published; data.save authoritative readback", fields: ["workflow.code", "bizObjectId", "workflowInstanceId", "workItemId"] },
28
29
  });
30
+ // F6(0.8.11 探针 F):`describe data.save --example basic` 此前 not-found——
31
+ // 唯一的配方是 workflow-backed-data-save,纯草稿保存的调用者得先猜 id 再改。
32
+ // 这里给最小可抄形状:标量字段草稿落库,不推进流程、不带 workflowCode/子表;
33
+ // 子表/关联映射的注意事项指回 workflow-backed-data-save(不复制正文)。
34
+ const basicDraftSave = Object.freeze({
35
+ id: "basic",
36
+ title: "最小草稿保存(无流程、纯标量字段)",
37
+ status: "offline-valid",
38
+ tool: "data.save",
39
+ args: { environment, schemaCode: model, formData: { name: "草稿示例" } },
40
+ preconditions: [
41
+ "模型与默认表单已发布;schemaCode 换成你自己的模型 code(formData 的键=已发布字段 code)",
42
+ "formData 只放标量字段,不带 id(带 id 是更新既有记录的语义)",
43
+ ],
44
+ conditionalRequirements: [
45
+ "纯草稿保存:不带 workflowCode / submit——行落为 DRAFT,不推进流程,也不触发 Create/Update 规则(DRAFT 行跳过规则分发)",
46
+ "子表数组、关联/人员字段形状、流程草稿走 `omc describe data.save --example workflow-backed-data-save`;正式数据一调完成态用 data.submit",
47
+ ],
48
+ priorToolReferences: [
49
+ { tool: "model.list", args: { environment }, purpose: "确认 schemaCode(models[].schemaCode)" },
50
+ { tool: "field.list", args: { environment, schemaCode: model, published: true }, purpose: "确认 formData 里的字段 code 已发布" },
51
+ ],
52
+ dryRun: { supported: true, command: `omc call data.save --env ${environment} --dry-run --args '<recipe.args>'`, notes: "dry-run 只校验输入与治理;落库与读回要真写后才权威" },
53
+ expectedReadback: { performed: { bizObjectId: "<data.save.performed.bizObjectId>" }, readback: { authoritative: { sequenceStatus: "DRAFT" }, next: "data.load 核对字段值 / data.submit 提交为正式数据" } },
54
+ refusalRecovery: [
55
+ { code: "save-update-target-absent", action: "formData.id 指向不存在的行——新建请省略 id" },
56
+ ...commonRecovery,
57
+ ],
58
+ requiresEnvironmentDerivedIds: false,
59
+ });
29
60
  const plainSubmit = Object.freeze({
30
61
  id: "plain-data-submit",
31
62
  title: "无流程模型:新建并提交一调完成(COMPLETED,触发 Create 规则)——正式数据的标准路径",
@@ -56,6 +87,8 @@ const workflowSubmit = Object.freeze({
56
87
  preconditions: ["同一 recipe 的 data.save 已成功并读回 DRAFT;workflowInstanceId/workItemId/bizObjectId 均非空"],
57
88
  conditionalRequirements: [
58
89
  "workItemId 或 workflowInstanceId 出现时必须传 bizObjectId;身份只能复制 data.save 的 authoritative readback",
90
+ "**审批提交(workItemId/workflowInstanceId)只传主表字段**:formData 里不要带子表数组——平台按「追加行」再插一份(真机 2→6 行),CLI 默认拒 `submit-approval-child-rows`。子表数组只在保存/首次提交时带;确要在审批中追加子行才显式传 allowChildRowAppend:true",
91
+ "子表读回顺序按 sortKey ASC(平台固定排序):**新建**保存/提交时 CLI 会给缺 sortKey 的子行按数组下标补 1..n(显式值保留);更新既有记录请显式带 sortKey,否则 null 排序不保证",
59
92
  ],
60
93
  priorToolReferences: [
61
94
  { tool: "data.save", args: { environment, schemaCode: model, workflowCode: "<workflow.code>", formData: { name: "recipe draft" } }, purpose: "提供三个环境生成的提交身份" },
@@ -123,7 +156,7 @@ const childRowsUpsert = Object.freeze({
123
156
  refusalRecovery: [
124
157
  { code: "child-rows-missing-id", action: "无 id 的行补 id 或改 rowStatus:Added" },
125
158
  ],
126
- notes: "data.save 新建时子行可不带 id(工具 stamp Added);本配方指 update/既有记录",
159
+ notes: "data.save 新建时子行可不带 id(工具 stamp Added,并按数组下标补缺省 sortKey 1..n);本配方指 update/既有记录——更新既有行请显式带 sortKey(平台读回按 sortKey ASC,null 顺序不保证)",
127
160
  requiresEnvironmentDerivedIds: true,
128
161
  });
129
162
  const dataDeleteSweep = Object.freeze({
@@ -167,7 +200,7 @@ const dataDeleteSweep = Object.freeze({
167
200
  requiresEnvironmentDerivedIds: false,
168
201
  });
169
202
  export const RUNTIME_DATA_METADATA = Object.freeze({
170
- "data.save": Object.freeze({ recipes: [workflowSave], relatedTools: ["workflow.get_published", "data.submit", "workitem.list", "data.update"] }),
203
+ "data.save": Object.freeze({ recipes: [workflowSave, basicDraftSave], relatedTools: ["workflow.get_published", "data.submit", "workitem.list", "data.update"] }),
171
204
  "data.update": Object.freeze({ recipes: [childRowsUpsert], relatedTools: ["data.load", "data.save", "data.submit"] }),
172
205
  "data.submit": Object.freeze({ recipes: [plainSubmit, workflowSubmit], relatedTools: ["data.save", "workitem.list", "data.load"] }),
173
206
  "data.list": Object.freeze({ recipes: [dataListFilter, reportChartVerifyNumericRecipe], relatedTools: ["data.load", "data.delete", "listview.configure", "field.list"] }),
package/dist/write.js CHANGED
@@ -169,8 +169,13 @@ lintDeclaration = { lintScope: "partial", lintUnchecked: [] }) {
169
169
  status: "refused",
170
170
  blocker: `wire-${error.kind}`,
171
171
  errcode: 300004,
172
- message: `${error.message}——若 modelPresent:true 且 form 已发布,这个 300004 大概率是业务规则节点运行时异常,不是模型缺失;先查 rulelog 的 EXCEPTION/ROLLBACK,再看最近改动的规则。`,
173
- nextCommand: "omc help omc-refusals",
172
+ // 探针 F(0.8.11):真机 2.1.5 上子表子 schema code = 父模型的
173
+ // CHILD_TABLE(8) 字段 code(`BizPropertyManagerImpl.java:197` 用
174
+ // `bizProperty.getCode()` 建子 schema),不是 `<model>_items`
175
+ // 约定名。先分叉再查 rulelog,否则 agent 会去翻不存在的规则。
176
+ message: `${error.message}——先分叉:① 若 schemaCode 是子表列,子表的子 schema code = 父模型的 CHILD_TABLE(8) 字段 code(不是 \`<model>_items\`),先 field.list 父模型找 type:8 字段的 code;② 若 modelPresent:true 且 form 已发布,这个 300004 大概率是业务规则节点运行时异常,不是模型缺失;先查 rulelog 的 EXCEPTION/ROLLBACK,再看最近改动的规则。`,
177
+ nextCommand: "omc call field.list --args '{\"schemaCode\":\"<父模型>\"}'",
178
+ nextAction: "在回执里找 type:8(CHILD_TABLE)字段的 code——父字段 code 就是子 schema code;用它对子列重试。确认不是子表问题后,再按 diagnostic 查 rulelog 的 EXCEPTION/ROLLBACK",
174
179
  diagnostic: "omc call rulelog.search --args '{\"schemaCode\":\"<model>\",\"includeNodes\":true}';再用 rule.get 检查最近改动规则,隔离法是暂时删/禁规则后重试",
175
180
  };
176
181
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.8.10",
3
+ "version": "0.8.12",
4
4
  "description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "commander": "14.0.3",
61
- "omc-core": "0.8.10",
61
+ "omc-core": "0.8.12",
62
62
  "proper-lockfile": "4.1.2",
63
63
  "write-file-atomic": "6.0.0",
64
64
  "zod": "^3.23.8",
@@ -76,6 +76,6 @@
76
76
  "directory": "packages/omc-cli"
77
77
  },
78
78
  "optionalDependencies": {
79
- "@stalfh233/omc-fake-platform": "0.8.10"
79
+ "@stalfh233/omc-fake-platform": "0.8.12"
80
80
  }
81
81
  }
@@ -75,6 +75,9 @@ Model present + form published yet submit says `300004 数据模型不存在`? O
75
75
  rule-node exception in disguise (r44b): `rulelog.search {schemaCode,includeNodes:true}`
76
76
  → `EXCEPTION`/`ROLLBACK` nodes → `rule.get` the changed rule; disable/delete it to
77
77
  isolate. Never recreate a healthy model.
78
+ Rule out the child-schema case first: a child column's `schemaCode` is the parent
79
+ model's CHILD_TABLE(8) **field code** (`items`, never `<model>_items`);
80
+ `field.list <父模型>` → `type:8` field's code. Then the rulelog branch below.
78
81
  Line up the model's field-level config first: an `AGGREGATION` FORMULA field whose
79
82
  `aggregation.schemaCode` points at a **child-table schema** publishes fine and then
80
83
  makes every `data.submit`/`data.update` on that model 40000 (r18 2026-10-26 live;
@@ -45,7 +45,8 @@ capability's coverage/tools/boundaries from `omc-capabilities`.
45
45
 
46
46
  1. 先在子表 schema 建快照标量列(如 `repairNoSnapshot` SHORT_TEXT)并发布。
47
47
  2. 再建关联列,形状照抄配方 `omc describe field.create --example child-map-fill`:
48
- `field.create {schemaCode:"<model>_items", code:"refParent", propertyType:"WORK_SHEET", relativeCode:"<model>", options:{schemaCode:"<model>", queryCode:"<model>", displayField:"<父字段>", mappings:[{source:"<父字段>",target:"<快照列>"}]}}`。
48
+ `field.create {schemaCode:"<子表父字段 code>", code:"refParent", propertyType:"WORK_SHEET", relativeCode:"<model>", options:{schemaCode:"<model>", queryCode:"<model>", displayField:"<父字段>", mappings:[{source:"<父字段>",target:"<快照列>"}]}}`。
49
+ 子表子 schema code **就是父模型的 CHILD_TABLE(8) 字段 code**(父字段叫 `items` 就是 `items`,不是 `<model>_items`);`omc call field.list --args '{"schemaCode":"<父模型>"}'` 找 type:8 字段的 code。
49
50
  3. `field.publish`(整模型一次)→ `field.get` 读回核对 `options.mappings`。
50
51
 
51
52
  - **字段映射**的事实源是字段行 `options.mappings`(`source`=关联目标/父模型字段,`target`=本子表列,都是裸 code);改表单控件属性里的映射会被平台按字段重算覆盖。
@@ -35,7 +35,7 @@ be treated as a second source. Read this, then follow the topics it names.
35
35
  5. 键名按对象不同:模型 `schemaCode`、默认表单 `sheetCode`(可省略,默认 == 模型 code)、流程 `workflowCode`/`code`——报错会提示同义键;字段族名认不出会给「最接近的族」。
36
36
  6. **写操作串行**:同一环境不要并发写(含多个 `omc call` 并行进程——环境写锁互斥,r31 实证并行 field.create 2/3 被拒);多个写合并为一条 `omc script` 逐行跑(进程内自动串行);`write-lock-held` 是瞬态:**优先在发起时就排队**——`omc call <tool> --wait 5000`(或 `omc intent apply ... --wait 5000`)让 CLI 内部有界重试,不必自己再花一轮。
37
37
  7. **单个对象优先高阶编排工具**:模型+字段用 `configure_model`(一次含全部字段),表单用 `configure_form`,列表用 `listview.configure`(**默认视图已存在,省略 code 即配置它,不要 `listview.create`**)。原子工具留给单点修改。
38
- 8. 拿到 `detailArtifactId` 先 `artifact get <id> --summary` 看结构,再 `--keys/--jq` 取所需;**读面要某一列时直接 `omc call <tool> … --jq 'items[].fields.xxx'`(`[]` 映射数组,一次调用拿整列;裸 `--jq` 列键),不要再落 artifact 二次取**;`field.list`/`workflow.*` 默认面已给清单与节点摘要;`workflow.get_draft` 默认面已含 `edges`,改流程只需传 `activities`+`routes`。**注意**:`form.get --full`、`workflow.get_draft` 的 `full:true` 大结果返回的是 `{length, sha256}` 摘要桩——真身走 `artifact get <id>`,勿把桩误判为「子表/控件没配」(用户实测陷阱)。
38
+ 8. 拿到 `detailArtifactId` 先 `artifact get <id> --summary` 看结构,再 `--keys/--jq` 取所需;**读面要某一列时直接 `omc call <tool> … --jq 'items[].fields.xxx'`(`[]` 映射数组,一次调用拿整列;裸 `--jq` 列键),不要再落 artifact 二次取**;`field.list`/`workflow.*` 默认面已给清单与节点摘要;`workflow.get_draft` 默认面已含 `edges`,改流程只需传 `activities`+`routes`。**注意**:`form.get` / `workflow.get_draft` 的 `full:true` 在 2.1.5 实测**全文内联**(`form.get --full` 约 19KB,要落盘加 `--out-file <路径>`);只有原生正文超过内联上限(当前 32KB)才外置,回执带 `fullOmitted:true` + `fullArtifactHint`,正文用 `artifact get <id>` 取。看到 `omitted:true` 才是摘要:默认(非 full)面的通用降载会把超长字符串/大对象/数组折成 `{length|keys|count, sha256, omitted}`——别把 `full:true` 的全文误判成桩(用户实测陷阱)。
39
39
  9. **Windows/PowerShell 乱码**:CLI 输出是 UTF-8,PowerShell 管道默认按 GBK(936) 解码会全屏乱码——根因在终端不在 CLI。消费端先 `chcp 65001` + `[Console]::OutputEncoding=[Text.Encoding]::UTF8` 再读 CLI 输出。
40
40
  9. 每个 section 读一次即可;同一 topic 不要反复读。
41
41
  10. **复杂流程先预检角色**:读 `org.role.list`/`org.user.search`,用真实可解析对象;缺独立角色就报告阻塞,不伪造。主子表条件按规则行 `schemaCode` 回所属子模型验证。