@stalfh233/omc-cli 0.8.16 → 0.8.17

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.
package/dist/cli.js CHANGED
@@ -571,8 +571,28 @@ async function cmdCall(store, args) {
571
571
  const emit = (status, result, exitCode, extra) => {
572
572
  if (status === "uncertain" && result !== null && typeof result === "object" && !Array.isArray(result) && result.nextAction === undefined)
573
573
  result = { ...result, nextAction: "read back the requestId before retrying; retry only after the outcome is established" };
574
- const classified = classifyResult(result);
575
- const envelopeValue = envelope(status, boundResult(result, maxOutputBytes), request, classified.error);
574
+ // F7(0.8.17 真机 P1):`result` 可能是 --jq 单路径解包后的**叶子**(null /
575
+ // 标量 / 数组),不是工具结果。此处再 classifyResult 会走 `.status`:
576
+ // discover_environment 缓存命中 `models:null` 时 `--jq models` 直接 internal
577
+ // (Cannot read properties of null);标量叶子则把 refused 翻成 ok:true。
578
+ // 结论以**投影前**的分类为准——单路径解包时由调用方放进 extra.error。
579
+ const carriedError = extra !== undefined && Object.prototype.hasOwnProperty.call(extra, "error")
580
+ ? extra.error
581
+ : undefined;
582
+ const classifiedError = carriedError !== undefined
583
+ ? carriedError
584
+ : result !== null && typeof result === "object" && !Array.isArray(result)
585
+ ? classifyResult(result).error
586
+ : null;
587
+ // 回归(0.8.17 复核):字符串叶子仍必须受 stdout 预算约束——否则 `--jq` 取
588
+ // 一个 >64KiB 的字符串会整段内联,破「大读回不内联」。number/boolean/null
589
+ // 有界,原样返回。
590
+ const bounded = result !== null && typeof result === "object"
591
+ ? boundResult(result, maxOutputBytes)
592
+ : typeof result === "string"
593
+ ? boundResult(result, maxOutputBytes)
594
+ : result;
595
+ const envelopeValue = envelope(status, bounded, request, classifiedError);
576
596
  // issue 2026-11-18 §05:单路径 --jq 解包后,`result` 是目标节点本体(可能是
577
597
  // 数组/标量,装不进结果对象),路径来源等元信息放信封旁的 `resultMeta`。
578
598
  // issue 07:sessionAccount 恒在 resultMeta(瘦身影封保留 resultMeta)。
@@ -3795,7 +3815,7 @@ async function main() {
3795
3815
  .option("--env <environment>")
3796
3816
  .option("--environment <environment>")
3797
3817
  .option("--apply")
3798
- .addHelpText("after", "\n一条命令按依赖倒序清掉一个模型:列表视图 → 业务规则 → 计算规则 → 流程实例 → 流程 → 模型(字段/表单随模型级联,并级联删除流程模板 <code>_wf 及其发起权限绑定)。默认 dry-run。\n入站引用(被其它模型关联字段引用,或子表关联列指向自身):dry-run 回 status:\"dry-run\" + blocker:\"model-referenced-by\" 并预置 unbindSteps/wouldRequireFlags(一条完整计划,零写入);--apply 未带 --unbind-references 时回 blocked/partial 并给 deletionSteps;加 --unbind-references --apply 让本命令先拆引用(破坏性:会删除引用列/子表关联列,列数据不可恢复),任一步失败即停且不删模型。\n业务数据:--purge-instances 删流程实例;普通业务行(无流程)不会自动带走——先 data.delete 清(sweep-all-readback 配方),再 purge,否则留孤儿数据。\n")
3818
+ .addHelpText("after", "\n一条命令按依赖倒序清掉一个模型:列表视图 → 业务规则 → 计算规则 → 流程实例 → 流程 → 模型(字段/表单随模型级联,并级联删除流程模板 <code>_wf 及其发起权限绑定)。默认 dry-run。\n入站引用:dry-run 预置 unbindSteps(一条完整计划,零写入);跨模型引用(被其它模型关联字段引用)另回 blocker:\"model-referenced-by\" + wouldRequireFlags,纯自引用(本模型子表关联列指向自身)只回 warnings:[{code:\"self-reference-auto-unbind\"}],因为 --apply 会自动拆;--apply 未带 --unbind-references 时回 blocked/partial 并给 deletionSteps;加 --unbind-references --apply 让本命令先拆引用(破坏性:会删除引用列/子表关联列,列数据不可恢复),任一步失败即停且不删模型。\n业务数据:--purge-instances 删流程实例;普通业务行(无流程)不会自动带走——先 data.delete 清(sweep-all-readback 配方),再 purge,否则留孤儿数据。\n")
3799
3819
  .action(async (options) => {
3800
3820
  const rest = ["model-purge",
3801
3821
  ...(options.code ? ["--code", options.code] : []),
@@ -3913,7 +3933,7 @@ async function main() {
3913
3933
  .option("--name <name>", "模型名")
3914
3934
  .option("--fields <json>", "JSON 数组,每条是一个 field.create 参数;子表加 subFields")
3915
3935
  .option("--fields-json <json>")
3916
- .option("--fields-file <path>", "从配置根内文件读字段 JSON 数组;与 --fields 互斥")
3936
+ .option("--fields-file <path>", "从文件读字段 JSON 数组。**必须位于配置根内**(根 = `$OMC_CONFIG_HOME` 或当前工作目录;根外一律拒绝);免落盘用 `--fields -`(stdin);与 --fields 互斥")
3917
3937
  .option("--folder <folderId>", "建在哪个应用目录(省略=默认目录)")
3918
3938
  .option("--app <applicationCode>")
3919
3939
  .option("--env <environment>")
@@ -3960,7 +3980,7 @@ async function main() {
3960
3980
  .option("--code <schemaCode>")
3961
3981
  .option("--fields <json>", "JSON 数组,每条是一个 field.create 参数(choices/字典 options 原样透传)")
3962
3982
  .option("--fields-json <json>")
3963
- .option("--fields-file <path>", "从配置根内文件读字段 JSON 数组;与 --fields 互斥")
3983
+ .option("--fields-file <path>", "从文件读字段 JSON 数组。**必须位于配置根内**(根 = `$OMC_CONFIG_HOME` 或当前工作目录;根外一律拒绝);免落盘用 `--fields -`(stdin);与 --fields 互斥")
3964
3984
  .option("--env <environment>")
3965
3985
  .option("--environment <environment>")
3966
3986
  .option("--no-form", "跳过表单重建")
package/dist/discovery.js CHANGED
@@ -826,6 +826,7 @@ export function describeParam(registry, name, param) {
826
826
  const nested = nestedParamHits(tool, param);
827
827
  if (nested.length > 0) {
828
828
  const first = nested[0];
829
+ const hint = tool.nestedParamHints?.[param];
829
830
  return {
830
831
  name: tool.name,
831
832
  param,
@@ -833,6 +834,7 @@ export function describeParam(registry, name, param) {
833
834
  path: first.path,
834
835
  nestedIn: `${first.recipeId} 的 ${first.container}`,
835
836
  ...(nested.length > 1 ? { nestedAlso: nested.slice(1).map((hit) => `${hit.recipeId} 的 ${hit.container}`) } : {}),
837
+ ...(hint !== undefined ? { description: hint } : {}),
836
838
  message: `"${param}" 是嵌套参数(${first.path}),顶层参数见 available;形状看 omc describe ${tool.name} --example ${first.recipeId}`,
837
839
  available: Object.keys(schema.properties ?? {}),
838
840
  };
package/dist/field-add.js CHANGED
@@ -168,7 +168,7 @@ export async function cmdFieldAdd(args, contextForTest) {
168
168
  " --no-form 跳过表单重建;--no-list 跳过列表加列(默认两者都做)。",
169
169
  " --conditions '<JSON 数组>' 列表固定过滤条件(listview.configure 契约;**整体替换**既有固定条件——要保留旧的须一并带上;不传则不动);需 --list(默认开)。",
170
170
  " --demo-rows '<JSON 数组>' 演示数据行(每项一份 formData,逐行 data.submit);非幂等——重复执行会重复插行。",
171
- " --fields-file 从配置根内文件读 JSON 数组;--fields - 从 stdin 读 JSON 数组。",
171
+ " --fields-file 从配置根内文件读 JSON 数组(根 = $OMC_CONFIG_HOME 或当前工作目录,根外拒绝;免落盘用 --fields - 读 stdin);--fields - 从 stdin 读 JSON 数组。",
172
172
  ].join("\n");
173
173
  const invalid = (message) => {
174
174
  writeEnvelope(envelope("error", {}, request, { code: "invalid-input", message: `${message}\n${usage}`, retryable: false }));
@@ -1393,19 +1393,34 @@ export async function lintFormPublishReadOnly(session, args) {
1393
1393
  // 提拔是逐字复制草稿 → 发布面,所以「发布面缺子表列」=「草稿面缺子表列」,
1394
1394
  // 预览用草稿面算同一份清单(真写用发布后的回读面复核)。
1395
1395
  const childColumnGaps = await childColumnsMissingFromForm(session, { schemaCode: args.schemaCode, attributesJson: sheet.draftAttributesJson });
1396
+ const willBindChildColumns = args.bindNewChildColumns === true && (childColumnGaps?.length ?? 0) > 0;
1396
1397
  const draftEqualsPublished = sheet.draftViewJson === sheet.publishedViewJson &&
1397
1398
  sheet.draftAttributesJson === sheet.publishedAttributesJson &&
1398
1399
  (sheet.draftHtmlJson === undefined || sheet.draftHtmlJson === sheet.publishedHtmlJson);
1400
+ const alreadyPublished = sheet.published === true && draftEqualsPublished && !willBindChildColumns;
1399
1401
  return {
1400
- wouldChange: !(sheet.published === true && draftEqualsPublished && args.force !== true),
1402
+ wouldChange: willBindChildColumns || !(sheet.published === true && draftEqualsPublished && args.force !== true),
1401
1403
  sheetPresent: true,
1402
1404
  draftPresent: true,
1403
1405
  draftControlCount: controlCount(sheet.draftAttributesJson),
1404
1406
  publishedControlCount: publishedControls,
1405
1407
  draftEqualsPublished,
1406
- alreadyPublished: sheet.published === true && draftEqualsPublished,
1408
+ alreadyPublished,
1409
+ ...(args.bindNewChildColumns === true
1410
+ ? {
1411
+ bindNewChildColumns: true,
1412
+ bindChildColumnsPlanned: childColumnGaps ?? [],
1413
+ bindChildColumnsNote: childColumnGaps === undefined
1414
+ ? "无法核对(field.list 读失败),真写也不会绑列——先重试或修好读面"
1415
+ : willBindChildColumns
1416
+ ? "真写会先增量绑定这些子表列再发布"
1417
+ : "没有待绑定的子表列",
1418
+ }
1419
+ : {}),
1407
1420
  ...childColumnsGapReadback(childColumnGaps, args.schemaCode, sheetCode),
1408
- note: "降级门与真写同一函数;alreadyPublished:true 时真写会短路(不改发布面)",
1421
+ note: willBindChildColumns
1422
+ ? "降级门与真写同一函数;bindNewChildColumns 会先增量绑定这些子表列,因此真写不会短路(会改发布面)"
1423
+ : "降级门与真写同一函数;alreadyPublished:true 时真写会短路(不改发布面)",
1409
1424
  };
1410
1425
  }
1411
1426
  /** A3 (issue 2026-11-25): the non-layout args that make a no-layout write an explicit, bounded intent. */
@@ -2505,6 +2520,12 @@ export async function executeFormPublishWrite(session, args) {
2505
2520
  await executeFormDraftWrite(session, { schemaCode: args.schemaCode, sheetCode: args.sheetCode });
2506
2521
  pre = await readFormOrNull(session, args.schemaCode, args.sheetCode);
2507
2522
  }
2523
+ // F5(探针 K,0.8.17):两次写回执各给一条 childColumnsNotInForm 同义警告 +
2524
+ // 同一条 configure_form 命令。bindNewChildColumns:true 把「绑定 + 发布」收成
2525
+ // 一次调用(增量改草稿,不动其它控件/布局);默认 false 仍只告警。
2526
+ //
2527
+ // P2(复核驳回):绑定是**写**,必须排在 HTML/降级门之后——拒绝 = 零写入。
2528
+ // 所以先只读算缺列(决定是否会短路),过完门再真正写草稿。
2508
2529
  if (!pre)
2509
2530
  throw new WireError("business", `form ${args.sheetCode} not found`, 302024);
2510
2531
  if (pre.draftHtmlJson !== "[]")
@@ -2524,7 +2545,11 @@ export async function executeFormPublishWrite(session, args) {
2524
2545
  const draftEqualsPublished = typeof pre.draftViewJson === "string" && pre.draftViewJson === pre.publishedViewJson &&
2525
2546
  typeof pre.draftAttributesJson === "string" && pre.draftAttributesJson === pre.publishedAttributesJson &&
2526
2547
  (pre.draftHtmlJson === undefined || pre.draftHtmlJson === pre.publishedHtmlJson);
2527
- if (pre.published === true && draftEqualsPublished && !forcePromote) {
2548
+ const pendingChildColumns = args.bindNewChildColumns === true
2549
+ ? await childColumnsMissingFromForm(session, { schemaCode: args.schemaCode, attributesJson: pre.draftAttributesJson })
2550
+ : undefined;
2551
+ const willBindChildColumns = (pendingChildColumns?.length ?? 0) > 0;
2552
+ if (pre.published === true && draftEqualsPublished && !forcePromote && !willBindChildColumns) {
2528
2553
  // 短路也是回执:已发布 ≠ 页面可见。历史 layout 覆盖掉的子表列要在这里点名,
2529
2554
  // 否则重跑 form.publish 会得到「published:true」的假确认。
2530
2555
  const publishedGaps = await childColumnsMissingFromForm(session, { schemaCode: args.schemaCode, attributesJson: pre.publishedAttributesJson });
@@ -2533,29 +2558,42 @@ export async function executeFormPublishWrite(session, args) {
2533
2558
  readback: {
2534
2559
  published: true,
2535
2560
  draftMatchesPublished: true,
2561
+ ...(args.bindNewChildColumns === true
2562
+ ? { bindChildColumnsNote: pendingChildColumns === undefined ? "无法核对(field.list 读失败),未执行绑定" : "没有待绑定的子表列" }
2563
+ : {}),
2536
2564
  ...childColumnsGapReadback(publishedGaps, args.schemaCode, args.sheetCode),
2537
2565
  },
2538
2566
  };
2539
2567
  }
2540
2568
  if (!hasDraft(pre))
2541
2569
  throw new WireError("business", "form publish requires a saved draft (draftViewJson/draftAttributesJson)", 302020);
2542
- if (pre.draftHtmlJson !== "[]")
2543
- assertHtmlRender(pre.draftHtmlJson, { schemaCode: args.schemaCode, sheetCode: args.sheetCode, face: "draftHtmlJson" });
2544
2570
  // Ticket 74 — degrade guard: refuse to promote a draft that carries FEWER
2545
2571
  // controls than the already-published face. The platform designer's Save
2546
2572
  // clears the draft faces to "[]"/"{}" (non-lossless); promoting that empty
2547
2573
  // draft is exactly how the 13-control loss happened. Escape: allowDegrade:true.
2574
+ // 必须在 bind 之前:否则「绑定写草稿 → 降级门拒绝」留下半截写入。
2548
2575
  assertPublishNotDegrading(pre.draftAttributesJson, pre.publishedAttributesJson, { schemaCode: args.schemaCode, sheetCode: args.sheetCode, ...(args.allowDegrade !== undefined ? { allowDegrade: args.allowDegrade } : {}) });
2549
2576
  // Buttons ride `options.customButtonJson`; the platform converts them into
2550
2577
  // h_biz_button(triggerType=FORM) rows during THIS publish call
2551
2578
  // (ModelManagementFacadeImpl.publishBizForm:1022). Passing them here is the
2552
2579
  // only way to create form buttons without the designer.
2580
+ //
2581
+ // 按钮语法/语义校验(validateFormButtons / 互斥 / 未知 buttonScripts)是纯本地
2582
+ // 拒绝,且不依赖 childColumns 绑定结果——必须在**绑定写之前**跑完:否则
2583
+ // `bindNewChildColumns + 非法 buttons` 会先写草稿再拒(拒绝 ≠ 零写入)。
2553
2584
  const mergedOptions = mergeFormOptionsWithButtons(pre.options, { buttons: args.buttons, customButtonJson: args.customButtonJson, buttonsMode: args.buttonsMode, removeButtonCodes: args.removeButtonCodes, buttonScripts: args.buttonScripts }, "form.publish");
2554
2585
  // 2.1.5 设计器发布时恒清空 options.dataItemTypeChangeList(edit-property.ts:199-203)。
2555
2586
  // 清空必须作用在**最终** options 上:按钮合并优先(mergedOptions 是字符串),
2556
2587
  // 没有按钮增量时才回落到 pre.options;键不存在则原样透传,不新增。
2557
2588
  const pendingCleared = clearPendingTypeChangeList(mergedOptions ?? pre.options);
2558
2589
  const finalOptions = mergedOptions !== undefined ? pendingCleared ?? mergedOptions : pendingCleared;
2590
+ const boundChildColumns = willBindChildColumns ? pendingChildColumns : [];
2591
+ if (boundChildColumns.length > 0) {
2592
+ await executeFormDraftWrite(session, { schemaCode: args.schemaCode, sheetCode: args.sheetCode, childColumns: boundChildColumns });
2593
+ pre = await readFormOrNull(session, args.schemaCode, args.sheetCode);
2594
+ if (!pre)
2595
+ throw new WireError("business", `form ${args.sheetCode} not found after childColumns bind`, 302024);
2596
+ }
2559
2597
  const payload = {
2560
2598
  ...pre,
2561
2599
  ...(finalOptions !== undefined ? { options: finalOptions } : {}),
@@ -2585,10 +2623,20 @@ export async function executeFormPublishWrite(session, args) {
2585
2623
  // 而没绑进表单时,这里逐条点名(读不到字段面则不诊断)。
2586
2624
  const childColumnGaps = await childColumnsMissingFromForm(session, { schemaCode: args.schemaCode, attributesJson: sheet.publishedAttributesJson });
2587
2625
  return {
2588
- performed: { errcode: performed.errcode },
2626
+ performed: {
2627
+ errcode: performed.errcode,
2628
+ ...(boundChildColumns.length > 0
2629
+ ? { steps: [{ step: "form.draft", childColumns: boundChildColumns }, { step: "form.publish", errcode: performed.errcode }] }
2630
+ : {}),
2631
+ },
2589
2632
  readback: {
2590
2633
  published: sheet.published === true,
2591
2634
  publishedHtmlJsonPresent: typeof sheet.publishedHtmlJson === "string",
2635
+ ...(boundChildColumns.length > 0
2636
+ ? { boundChildColumns, boundChildColumnsNote: "发布前已把这些子表列增量绑进草稿(只追加列,不动其它控件/布局),因此本次发布面不再缺列" }
2637
+ : args.bindNewChildColumns === true
2638
+ ? { bindChildColumnsNote: pendingChildColumns === undefined ? "无法核对(field.list 读失败),未执行绑定" : "没有待绑定的子表列" }
2639
+ : {}),
2592
2640
  ...childColumnsGapReadback(childColumnGaps, args.schemaCode, args.sheetCode),
2593
2641
  ...(formButtons !== null
2594
2642
  ? {
package/dist/goal-plan.js CHANGED
@@ -774,10 +774,20 @@ async function planGoalInner(registry, goal, options = {}) {
774
774
  }
775
775
  const lane = typeof route.route.lane === "string" ? route.route.lane : undefined;
776
776
  const capability = typeof route.route.capability === "string" ? route.route.capability : undefined;
777
+ // F9(0.8.17 复核):`omc next` 已把「4/7 面要原子补齐」判成 primary=hybrid
778
+ // (goal-routes 的 needsHybridRoute)。plan 不能再只发纯 intent 叙事——否则
779
+ // agent 照 plan 跑完 validate/plan/apply,仍会在布局/排序/运行面上撞墙。
780
+ const hybrid = route.route.primary === "hybrid";
777
781
  const intentPrimary = route.route.primary === "intent" || route.mode === "whole-package";
778
782
  // Level 5: the ask is a whole configuration package. The declarative intent
779
783
  // compiler owns that; an atomic call chain would be strictly worse.
780
784
  if (intentPrimary) {
785
+ const coverage = route.route.intentCoverage;
786
+ const needsCall = hybrid ? (coverage?.needsCall ?? []) : [];
787
+ const routeFirstCommands = Array.isArray(route.route.firstCommands)
788
+ ? route.route.firstCommands.filter((command) => typeof command === "string")
789
+ : [];
790
+ const intentLifecycle = ["omc intent schema", "omc intent validate <file>", "omc intent plan <file> --env <env>"];
781
791
  return {
782
792
  ...base,
783
793
  ready: false,
@@ -785,9 +795,20 @@ async function planGoalInner(registry, goal, options = {}) {
785
795
  ...(route.match !== undefined ? { match: route.match } : {}),
786
796
  ...(capability !== undefined ? { capability } : {}),
787
797
  ...(lane !== undefined ? { lane } : {}),
788
- blockers: [{ type: "declarative-face", reason: "整包需求由 intent 编译器承接(模型/字段/规则/流程按依赖排序、可 readback 对账)", why: "原子 call 链无法保证顺序与幂等" }],
798
+ blockers: [{
799
+ type: "declarative-face",
800
+ ...(hybrid ? { hybrid: true, needsCall } : {}),
801
+ reason: hybrid
802
+ ? `整包需求主要由 intent 编译器承接(模型/字段/规则/流程模板),但本任务 ${needsCall.length} 面 intent 不覆盖(${needsCall.map((entry) => entry.id).join("、") || "见 intentCoverage"}):intent validate/plan/apply 之后按 needsCall 的命令用原子面补齐`
803
+ : "整包需求由 intent 编译器承接(模型/字段/规则/流程按依赖排序、可 readback 对账)",
804
+ why: hybrid
805
+ ? "只给 intent 命令会让调用方在布局/排序/运行面撞墙;混合起手见 next(intent 键位 + model-scaffold + needsCall)"
806
+ : "原子 call 链无法保证顺序与幂等",
807
+ }],
789
808
  planHash: planHash({ goal, environment, level: 5 }),
790
- next: ["omc intent schema", "omc intent validate <file>", "omc intent plan <file> --env <env>"],
809
+ next: hybrid
810
+ ? [...intentLifecycle, ...routeFirstCommands.filter((command) => !intentLifecycle.includes(command))]
811
+ : intentLifecycle,
791
812
  };
792
813
  }
793
814
  const match = route.match;
@@ -569,7 +569,7 @@ const WHOLE_PACKAGE_CAPABILITIES = ["model", "field", "form", "listview", "datar
569
569
  * 声明式路径)。
570
570
  */
571
571
  const INTENT_COVERAGE = Object.freeze({
572
- note: "intent 覆盖面(与 `omc intent schema` 同源):covered 由 validate/plan/apply 声明式生成;needsCall 是 intent 不声明(或运行语义/精确 patch 不在声明面)的部分,apply 后用 command 走原子面补齐。",
572
+ note: "intent 覆盖面(与 `omc intent schema` 同源):covered 由 validate/plan/apply 声明式生成;needsCall 是本次需求里 intent 不声明(或运行语义/精确 patch 不在声明面)的部分,apply 后用 command 走原子面补齐。",
573
573
  covered: [
574
574
  "模型 model(含 absent 删除)",
575
575
  "标量字段与子表标量列(CHILD_TABLE subFields)",
@@ -586,24 +586,77 @@ const INTENT_COVERAGE = Object.freeze({
586
586
  id: "child-map-fill",
587
587
  what: "子表取主表字段:WORK_SHEET 关联列 + options.mappings(intent 子列可声明 relativeCode/options;映射回填只在门户表单执行、REST 不回填,精确改映射与读回以 child-map-fill 配方为准)",
588
588
  command: "omc describe field.create --example child-map-fill",
589
+ cues: ["子表", "明细", "主子表", "映射", "mapping", "关联字段"],
589
590
  },
590
591
  {
591
592
  id: "form-two-column-layout",
592
593
  what: "表单两列布局(intent 的 form 只有 publish/fieldCodes,不含行分组/控件 span)",
593
594
  command: "omc describe form.draft --example two-column-layout",
595
+ cues: ["两列", "布局"],
594
596
  },
595
597
  {
596
598
  id: "listview-sorts-conditions",
597
599
  what: "列表视图业务排序/筛选条件(intent 的 listview 只声明列,排序/条件/按钮 apply 后用 listview.configure 补)",
598
600
  command: "omc describe listview.configure --param sorts",
601
+ cues: ["排序", "筛选", "过滤", "查询条件"],
599
602
  },
600
603
  {
601
604
  id: "workflow-runtime",
602
605
  what: "审批运行操作:提交/审批/待办/流转(intent 的 workflow 只到模板+发布+绑规则,运行实例走 data.save/data.submit/workitem.list)",
603
606
  command: "omc describe data.submit --example workflow-backed-data-submit",
607
+ // F9 收紧(0.8.17 复核):裸「审批」「提交」会误伤字段名与模板面——
608
+ // 「提交人/提交时间/提交日期」是字段,不是运行动作;
609
+ // 「审批流程/审批流/审批节点/审批模板」是 intent 覆盖的模板面。
610
+ // 运行面只认动作/对象:提交(非字段后缀)、审批(非模板后缀)、待办、流转、跑通、实例。
611
+ cues: [
612
+ "re:提交(?!人|时间|日期|者|方|单位|部门|按钮|字段|记录|说明|备注|项)",
613
+ "re:审批(?!流程|流|模板|节点|权限|规则|人|时间|日期)",
614
+ "待办",
615
+ "流转",
616
+ "跑通",
617
+ "实例",
618
+ ],
604
619
  },
605
620
  ],
606
621
  });
622
+ /**
623
+ * F9(0.8.17,探针 K):needsCall 必须按「这次需求点名了哪几面」来算,不能整份
624
+ * 静态清单全贴上。探针原句 4 个未覆盖面(子表映射/两列布局/排序筛选/流程运行)
625
+ * 全部命中,route 却仍回 `primary:"intent"` + `confident:true`——等于宣称声明式
626
+ * 一条路走完,agent 照做后在 4 个面上撞墙。现在:
627
+ * - needsCall 只列本句真实点名的面;
628
+ * - 命中 ≥3 面,或面数 ≥4 且占比 ≥1/2 → `primary:"hybrid"`,并给混合起手命令。
629
+ * 单面句(「给表单加两列布局」「配好列表视图」)与 2/3 面的小任务仍不降级,
630
+ * 仍是 intent 主推(「报销单带提交人和提交时间,明细子表,两列布局」不得翻 hybrid)。
631
+ */
632
+ export function intentNeedsCallFor(goal) {
633
+ return INTENT_COVERAGE.needsCall
634
+ .filter((entry) => entry.cues.some((cue) => cueMatches(goal, cue)))
635
+ .map(({ id, what, command }) => ({ id, what, command }));
636
+ }
637
+ /** `re:`-prefixed cues are regexes (negative lookaheads keep field names out); others are literals. */
638
+ function cueMatches(goal, cue) {
639
+ return cue.startsWith("re:") ? new RegExp(cue.slice(3)).test(goal) : goal.includes(cue);
640
+ }
641
+ export function intentCoverageFor(goal) {
642
+ return { note: INTENT_COVERAGE.note, covered: INTENT_COVERAGE.covered, needsCall: intentNeedsCallFor(goal) };
643
+ }
644
+ /** Hybrid trigger: ≥3 atomic-fill faces, or ≥half of ≥4 named faces. */
645
+ function needsHybridRoute(needsCallCount, faceCount) {
646
+ return needsCallCount >= 3 || (faceCount >= 4 && needsCallCount / faceCount >= 0.5);
647
+ }
648
+ function hybridRouteNote(needsCall, faceCount) {
649
+ return (`本任务 ${needsCall.length}/${faceCount} 面需原子工具补齐(${needsCall.map((entry) => entry.id).join("、")}):` +
650
+ "intent 只声明可覆盖面(模型/字段/规则/流程模板);先按 intent schema 写 YAML,apply 后按 intentCoverage.needsCall 的命令逐面补;" +
651
+ "模型/字段也可先用 model-scaffold 一步建(见 firstCommands / atomicSupplement)。");
652
+ }
653
+ /** Hybrid first moves: intent shape + the model-scaffold door + the first two atomic faces. */
654
+ function hybridFirstCommands(needsCall) {
655
+ // 命令骨架不在此另写一份:model-scaffold 的单命令门来自 composer 注册表
656
+ // (与 next 的 composer 路由同一真相源),改模板只改注册表。
657
+ const scaffold = COMPOSER_ROUTES.find((entry) => entry.id === "model-scaffold")?.command ?? "omc model-scaffold --help";
658
+ return ["omc intent schema", scaffold, ...needsCall.slice(0, 2).map((entry) => entry.command)];
659
+ }
607
660
  const COMPOSER_ROUTES = Object.freeze([
608
661
  {
609
662
  id: "model-purge",
@@ -800,6 +853,10 @@ function wholePackageRoute(registry, goal, index, hitCapabilities) {
800
853
  // 运行数据是 intent 的**已知**未覆盖面(coverageNote 明说),不能因此把整包的
801
854
  // 主路径翻成 atomic-only——它本就归 atomicSupplement 管。
802
855
  const intentCovered = ordered.every((id) => id === "data" || (index.nodeById.get(id)?.intent.level ?? "none") !== "none");
856
+ // F9(0.8.17,探针 K):按本句点名的面算 needsCall;4/7 面要原子补齐时不再
857
+ // 宣称 intent 单主路径,降为 hybrid 并给混合起手。
858
+ const coverageNeedsCall = intentNeedsCallFor(goal);
859
+ const hybrid = intentCovered && needsHybridRoute(coverageNeedsCall.length, faces.length);
803
860
  const atomicLadder = ordered.map((id) => {
804
861
  const capability = routeById.get(id);
805
862
  const recipe = bestRecipe(registry, id, capability.lane, goal) ?? defaultRecipeFor(registry, id, capability.lane);
@@ -819,7 +876,8 @@ function wholePackageRoute(registry, goal, index, hitCapabilities) {
819
876
  mode: "whole-package",
820
877
  match: { kind: "whole-package", ref: ordered.join("→"), capabilities: ordered },
821
878
  route: {
822
- primary: intentCovered ? "intent" : "atomic",
879
+ primary: intentCovered ? (hybrid ? "hybrid" : "intent") : "atomic",
880
+ ...(intentCovered && hybrid ? { note: hybridRouteNote(coverageNeedsCall, faces.length) } : {}),
823
881
  ...(intentCovered ? {} : {
824
882
  note: "命中能力中有 intent.level=none 的面,声明式 intent 不覆盖全部需求,走原子工具阶梯;intent 仅作可用能力补充提示",
825
883
  ladder: atomicLadder,
@@ -828,7 +886,8 @@ function wholePackageRoute(registry, goal, index, hitCapabilities) {
828
886
  // F5(0.8.11):主推 intent 时先交代「能/不能覆盖什么」,别让 agent 写完
829
887
  // YAML 才发现半边需求要回落 omc call。atomic 主路径(intent.level=none)
830
888
  // 不加——它没有推荐 intent,说明覆盖面只会误导。
831
- ...(intentCovered ? { intentCoverage: INTENT_COVERAGE } : {}),
889
+ // F9(0.8.17,探针 K):needsCall 只列本句点名的面(intentCoverageFor)。
890
+ ...(intentCovered ? { intentCoverage: intentCoverageFor(goal) } : {}),
832
891
  atomicSupplement: {
833
892
  note: intentCovered
834
893
  ? "intent 已覆盖下列能力的创建;原子工具只用于 intent 未覆盖面(删除/生命周期/运行数据/精确 patch)——逐项见 intentCoverage.needsCall"
@@ -843,30 +902,38 @@ function wholePackageRoute(registry, goal, index, hitCapabilities) {
843
902
  // the probe executed it 0 times in 184 calls; it rides its own field now.
844
903
  readiness: DISCOVERY_AUTHORITY.readiness,
845
904
  firstCommands: intentCovered
846
- ? ["omc intent schema", "omc help omc-playbook --section 采购申请"]
905
+ ? hybrid
906
+ ? hybridFirstCommands(coverageNeedsCall)
907
+ : ["omc intent schema", "omc help omc-playbook --section 采购申请"]
847
908
  : atomicLadder.flatMap((step) => "firstCommand" in step ? [step.firstCommand] : step.recipe ? [step.recipe.command] : []).slice(0, 3),
848
909
  write: true,
849
910
  },
850
911
  write: true,
851
912
  intent: intentGuidance(),
852
- firstAnswer: intentCovered && greenfield
913
+ firstAnswer: intentCovered && hybrid
853
914
  ? {
854
915
  state: "ready",
855
916
  action: "omc intent schema",
856
- why: "从零整包:模型还不存在——先看 intent 键位/示例,再按 starter 写 YAML(validate → plan → apply);不要先问已有 schemaCode",
917
+ why: `整包但有 ${coverageNeedsCall.length}/${faces.length} 面 intent 不覆盖:先用 intent 声明模型/字段/规则/流程模板(可覆盖面),模型/字段可直接用 model-scaffold 一步建;apply 后按 intentCoverage.needsCall 的命令补齐布局/排序/运行面`,
857
918
  }
858
- : intentCovered
919
+ : intentCovered && greenfield
859
920
  ? {
860
921
  state: "ready",
861
922
  action: "omc intent schema",
862
- why: "整包需求走声明式意图:先看 intent YAML 的键位与可运行示例,再按 starter 写文件(validate → plan → apply)",
923
+ why: "从零整包:模型还不存在——先看 intent 键位/示例,再按 starter 写 YAML(validate → plan → apply);不要先问已有 schemaCode",
863
924
  }
864
- : {
865
- state: "needs-input",
866
- action: atomicLadder.find((step) => "firstCommand" in step)?.firstCommand,
867
- question: "第一步要操作哪个对象?给我 schemaCode(或模型业务名,我列清单核对)",
868
- why: "命中能力包含 intent 未覆盖面,不能把整包需求主推到声明式 intent;先按原子工具阶梯执行",
869
- },
925
+ : intentCovered
926
+ ? {
927
+ state: "ready",
928
+ action: "omc intent schema",
929
+ why: "整包需求走声明式意图:先看 intent YAML 的键位与可运行示例,再按 starter 写文件(validate → plan → apply)",
930
+ }
931
+ : {
932
+ state: "needs-input",
933
+ action: atomicLadder.find((step) => "firstCommand" in step)?.firstCommand,
934
+ question: "第一步要操作哪个对象?给我 schemaCode(或模型业务名,我列清单核对)",
935
+ why: "命中能力包含 intent 未覆盖面,不能把整包需求主推到声明式 intent;先按原子工具阶梯执行",
936
+ },
870
937
  };
871
938
  }
872
939
  /** A configuration read-back ask that names no capability ("给我一份现状说明"). */
@@ -1565,6 +1632,9 @@ function goalRouteInner(registry, goal) {
1565
1632
  // 0.8.9 F1:指针里的 firstCommand 以前只看 `step.firstCommand`,命中配方时
1566
1633
  // 仍给 `commands --lane`(正是探针被绕回发现面的那条路)。有配方就用配方命令。
1567
1634
  const atomicSupplement = { note: "intent 已覆盖这些能力的创建;原子工具只用于 intent 未覆盖面:", ladder: ladder.map((step) => ({ capability: step.capability, lane: step.lane, firstCommand: step.recipe?.command ?? step.firstCommand ?? `omc commands --json --compact --lane ${step.lane}` })) };
1635
+ // F9(0.8.17,探针 K):整包阶梯同样按本句点名的未覆盖面判 hybrid。
1636
+ const coverageNeedsCall = intentNeedsCallFor(goal);
1637
+ const hybrid = whole && intentCoveredOf(ordered) && needsHybridRoute(coverageNeedsCall.length, ordered.length);
1568
1638
  return {
1569
1639
  status: "ok",
1570
1640
  goal,
@@ -1573,7 +1643,9 @@ function goalRouteInner(registry, goal) {
1573
1643
  match: { kind: readish ? "read-ladder" : "ladder", ref: `${routeOrder.join("→")}${routeOrder.includes("businessrule") && /累加|联动|审计|规则触发|自动累加|自动回写/.test(goal) ? "(规则面不在本阶梯)" : ""}`, capabilities: routeOrder },
1574
1644
  route: {
1575
1645
  ...(whole ? (intentCoveredOf(ordered)
1576
- ? { primary: "intent", intentCoverage: INTENT_COVERAGE, atomicSupplement }
1646
+ ? hybrid
1647
+ ? { primary: "hybrid", note: hybridRouteNote(coverageNeedsCall, ordered.length), intentCoverage: intentCoverageFor(goal), atomicSupplement }
1648
+ : { primary: "intent", intentCoverage: intentCoverageFor(goal), atomicSupplement }
1577
1649
  : { primary: "atomic", note: "命中能力中有 intent.level=none 的面,声明式 intent 不覆盖全部需求,走原子工具阶梯", ladder }) : { ladder }),
1578
1650
  // r28e F2(真机复现 2026-11-05):`next "建表单布局、在线JS、表单按钮"`
1579
1651
  // 命中的是 model→form→listview→businessrule→onlinejs 的整包 ladder,
@@ -1601,7 +1673,9 @@ function goalRouteInner(registry, goal) {
1601
1673
  // `omc intent schema`。此前这里只挑 ladder 里**任意一条**配方贴上来;
1602
1674
  // 当只有 businessrule 有配方时,表单/视图目标会收到 rule.save 的样例,
1603
1675
  // 与首答自相矛盾(且必然跑题)。整包就统一给 intent。
1604
- ...(whole ? ["omc intent schema"] : recipeCommands),
1676
+ // F9(0.8.17,探针 K):hybrid 起手 = intent 键位 + model-scaffold 门 +
1677
+ // 前两个未覆盖面的原子命令(不再只给 intent schema 让你一条路走到黑)。
1678
+ ...(whole ? (hybrid ? hybridFirstCommands(coverageNeedsCall) : ["omc intent schema"]) : recipeCommands),
1605
1679
  // r13 #3: `capability workflow --executable` is 23 KB and still did not
1606
1680
  // answer "how do I submit an approval" — the answer is a data.submit
1607
1681
  // recipe, which lives in a DIFFERENT capability. When the goal is about
@@ -1615,7 +1689,9 @@ function goalRouteInner(registry, goal) {
1615
1689
  },
1616
1690
  write,
1617
1691
  ...(whole
1618
- ? { intent: intentGuidance(), firstAnswer: { state: "ready", action: "omc intent schema", why: "整包需求走声明式意图:先看 intent 的键位与示例,再按 starter 写文件" } }
1692
+ ? hybrid
1693
+ ? { intent: intentGuidance(), firstAnswer: { state: "ready", action: "omc intent schema", why: `整包但有 ${coverageNeedsCall.length}/${ordered.length} 面 intent 不覆盖:先用 intent 声明可覆盖面(模型/字段/规则/流程模板),模型/字段也可用 model-scaffold 一步建;apply 后按 intentCoverage.needsCall 逐面补布局/排序/运行` } }
1694
+ : { intent: intentGuidance(), firstAnswer: { state: "ready", action: "omc intent schema", why: "整包需求走声明式意图:先看 intent 的键位与示例,再按 starter 写文件" } }
1619
1695
  : readish
1620
1696
  // A read ask about the model inventory itself is answered BY the
1621
1697
  // inventory call; any other read needs the target object code first.
@@ -1671,7 +1747,7 @@ function goalRouteInner(registry, goal) {
1671
1747
  capability: capabilityId,
1672
1748
  lane: route.lane,
1673
1749
  ...(whole ? (intentCoveredOf([capabilityId])
1674
- ? { primary: "intent", intentCoverage: INTENT_COVERAGE }
1750
+ ? { primary: "intent", intentCoverage: intentCoverageFor(goal) }
1675
1751
  : { primary: "atomic", note: "该能力无声明式面(intent.level=none),走原子工具" }) : {}),
1676
1752
  ...(readish ? { readTools: readToolsInLane(registry, route.lane) } : { tools: route.tools }),
1677
1753
  // r66 ②(c-F4):有依赖顺序的能力(report)显式给 order,修掉 tools 键序
@@ -391,7 +391,9 @@ function phraseOf(tool, args, outcome) {
391
391
  case "listview.create":
392
392
  return `创建列表视图 ${stringArg(args, "name") ?? ""}(${stringArg(args, "code") ?? schemaCode ?? "?"},模型 ${schemaCode ?? "?"})`;
393
393
  case "listview.configure": {
394
- const codes = Array.isArray(args.fieldCodes) ? args.fieldCodes.map(String).join("、") : "";
394
+ // F2(0.8.17 探针 K 复核):同一请求列去重后再展示,`d1,d1` 只列一次。
395
+ const requestedCodes = Array.isArray(args.fieldCodes) ? [...new Set(args.fieldCodes.map(String))] : [];
396
+ const codes = requestedCodes.join("、");
395
397
  const sections = ["sorts", "conditions", "actions", "buttons", "presentation", "options", "presentationType", "gantt", "queryLayer", "multiTableHeaderConfig"].filter((key) => args[key] !== undefined);
396
398
  // F9(w44,2026-11-26 真机):视图固定条件只在门户运行面生效,REST 的
397
399
  // data.list --queryCode 不应用。此前只有 JSON 回执尾部的
@@ -427,8 +429,24 @@ function phraseOf(tool, args, outcome) {
427
429
  const systemColumnsAdded = Array.isArray(outcome?.readback?.systemColumnsAdded)
428
430
  ? (outcome.readback.systemColumnsAdded.map(String))
429
431
  : [];
432
+ // F2(0.8.17 探针 K):真机 4 列请求回读 8 列(4 业务 + 4 平台系统列),
433
+ // 旧摘要只写「列 repairNo、device、amount、status」再追加系统列,人读起来
434
+ // 仍像 4 列。这里把实际列数点明:总列 = 业务列 + 平台系统列。
435
+ const readbackColumnCount = Array.isArray(outcome?.readback?.columns)
436
+ ? outcome.readback.columns.length
437
+ : undefined;
438
+ const requestedColumnCount = requestedCodes.length;
439
+ const businessColumnCount = readbackColumnCount !== undefined ? Math.max(0, readbackColumnCount - systemColumnsAdded.length) : requestedColumnCount;
440
+ const totalColumnCount = readbackColumnCount ?? businessColumnCount + systemColumnsAdded.length;
441
+ // 只有「回读里的非系统列」恰好等于本次请求列时才敢写「业务 N 列:请求列」;
442
+ // 增量配置会保留既有业务列(a1,a2 后再配 b1,b2,b3),此时收益句若沿用
443
+ // business 计数会建议「要精确 5 列」——照做就丢 a1/a2。指引必须用本次请求
444
+ // 列数(replaceColumns+fieldCodes 的真实结果),并如实标「本次请求 N 列」。
445
+ const requestedColumnClause = businessColumnCount === requestedColumnCount && codes
446
+ ? `业务 ${businessColumnCount} 列:${codes}`
447
+ : `本次请求 ${requestedColumnCount} 列${codes ? `:${codes}` : ""}`;
430
448
  const systemColumnsLine = systemColumnsAdded.length > 0
431
- ? `;平台额外保留系统列 ${systemColumnsAdded.join("、")}(未传 replaceColumns/hideDefaultSystemFields);要精确列集合请加 replaceColumns:true + hideDefaultSystemFields:true`
449
+ ? `;当前实际 ${totalColumnCount} 列(${requestedColumnClause} + 平台系统 ${systemColumnsAdded.length} 列):平台额外保留系统列 ${systemColumnsAdded.join("、")}(未传 replaceColumns/hideDefaultSystemFields);要精确 ${requestedColumnCount} 列请加 replaceColumns:true + hideDefaultSystemFields:true`
432
450
  : "";
433
451
  return `配置列表视图 ${stringArg(args, "code") ?? schemaCode ?? "?"}(模型 ${schemaCode ?? "?"}):列 ${codes || "(未变)"}${sections.length > 0 ? `;同时配置 ${sections.join("、")}` : ""}${systemColumnsLine}${actionsClearedLine}${conditionRuntimeLine}`;
434
452
  }
@@ -980,6 +980,9 @@ export function registerDataRuleLane(tools) {
980
980
  tools,
981
981
  name: "datarule.create",
982
982
  search: { intents: ["字段级校验", "给字段加校验", "给金额字段加校验", "校验规则", "提交校验", "字段校验", "金额校验", "必填才能提交", "必须填", "不填不让提交", "必须附件", "不然就提交不了"] },
983
+ nestedParamHints: {
984
+ conditions: 'checkType:2 提交校验的条件串:`{字段} 操作符 右值`。常量右值用 `{"valueType":"custom","value":0}`(JSON 值对象;平台也接受裸字面量,如 `{qty} 大于 100`;例 `{amount} 大于 {"valueType":"custom","value":0}`);跨字段右值才用 `{"valueType":"currentModel","value":"<字段code>"}`。完整最小例见 --example submit-field-vs-constant',
985
+ },
983
986
  lane: DATARULE_LANE,
984
987
  scope: DATARULE_TOOLS["datarule.create"].scope,
985
988
  description: DATARULE_TOOLS["datarule.create"].description,
@@ -258,6 +258,11 @@ export const FIELD_LANE_CONTRACT = Object.freeze({
258
258
  childTableSubSchema: '{"code":"<父字段 code>","properties":[{"code","name","schemaCode":"<父字段 code>","propertyType","propertyEmpty","sortKey"}]}',
259
259
  childTableFormControl: "Sheet(201) with columns[{type,width,key,parentKey,options}]; child column keys never enter viewJson",
260
260
  dateDefaultOptions: JSON.stringify(FIELD_DATE_DEFAULT_OPTIONS),
261
+ dateFormat: JSON.stringify({
262
+ default: FIELD_DATE_DEFAULT_OPTIONS.format,
263
+ formats: FIELD_DATE_FORMATS_EVIDENCED,
264
+ valueSemantics: "DATE(3) options.format 逐字比较、区分大小写;Java 写法 yyyy-MM-dd 不在任何族(字段能建,首次运行时 save 报 50000)。这是跨版本并集(8.6 的 19 项 ⊂ 2.1.5/8.7/8.8 的 55 项),平台是最终门",
265
+ }, null, 2),
261
266
  formulaOptions: FIELD_FORMULA_WIRE.outerOptions,
262
267
  formulaConfig: FIELD_FORMULA_WIRE.innerConfig,
263
268
  formulaRuntimeVerification: FIELD_FORMULA_WIRE.runtimeVerification,
@@ -277,6 +282,7 @@ export const FIELD_LANE_CONTRACT = Object.freeze({
277
282
  childTableSubSchema: Object.freeze([behaviorBinding("test/child-table.test.ts#field.create CHILD_TABLE sends a subSchema (not options) with parent-coded child columns", assertFieldContract)]),
278
283
  childTableFormControl: Object.freeze([behaviorBinding("test/child-table.test.ts#form.draft scaffolds a Sheet201 control with columns and keeps child keys out of viewJson", assertFieldContract)]),
279
284
  dateDefaultOptions: Object.freeze([emitterBinding("lanes/field-contract.FIELD_DATE_DEFAULT_OPTIONS", assertFieldContract)]),
285
+ dateFormat: Object.freeze([emitterBinding("lanes/field-contract.FIELD_DATE_FORMATS_EVIDENCED", assertFieldContract)]),
280
286
  formulaOptions: Object.freeze([behaviorBinding("test/formula-resultformat.test.ts#validateFormulaOptions accepts the fwb", assertFieldContract)]),
281
287
  formulaConfig: Object.freeze([behaviorBinding("test/field-families.test.ts#field.create FORMULA persists formulaConfig + persistent", assertFieldContract)]),
282
288
  formulaRuntimeVerification: Object.freeze([behaviorBinding("test/field-families.test.ts#field.create FORMULA ACCEPTS aggregation written as an EXPRESSION (form 计算控件 subtable SUM; UI+runtime-verified 2026-10-07)", assertFieldContract)]),
@@ -322,7 +328,7 @@ export const FIELD_LANE_CONTRACT = Object.freeze({
322
328
  "For single/multi-select pass `choices` (e.g. [\"A\",\"B\",\"C\"]) or `options.optionsSet` with optionsType custom/dictionary/businessModel; dictionary uses checkedDictionary/checkedDictionaryCode, businessModel uses schemaCode/sheetDataItem.",
323
329
  "For a relation pass `relativeCode` and `options` (schemaCode/displayField/...). `searchFormula` and `conditions` are JSON strings for the relation data restriction/query conditions.",
324
330
  "For a relation display field the tool writes the field-row top-level `relativePropertyCode` = options.displayField (the runtime reads THAT key, not options.displayField — QueryRuntimeController.java:1214-1226) and defaults options.displayFieldType:0 + displayFieldFormat:\"\".",
325
- "For FORMULA pass `options.formulaConfig` (nested JSON string) + `options.persistent:true`; for RELEVANCE_DATA pass `options.relevanceField` + `options.referenceField` + `options.referenceFieldPropertyType`. 数值字段的小数位写 `options.scale`;顶层 `precision` 不被读取,若误传请改为 `precision→options.scale(数值小数位)`。数值显示格式写 `options.format`(`ratio.percentile`=20.00%、`RMB.percentile`=¥2,000.00、`percentile`=2,000.00;**百分比存比值** 0.5→50.00%;别名 percent/currency 归一;全表见 contract 的 numericalFormat)。",
331
+ "For FORMULA pass `options.formulaConfig` (nested JSON string) + `options.persistent:true`; for RELEVANCE_DATA pass `options.relevanceField` + `options.referenceField` + `options.referenceFieldPropertyType`. 数值字段的小数位写 `options.scale`;顶层 `precision` 不被读取,若误传请改为 `precision→options.scale(数值小数位)`。数值显示格式写 `options.format`(`ratio.percentile`=20.00%、`RMB.percentile`=¥2,000.00、`percentile`=2,000.00;**百分比存比值** 0.5→50.00%;别名 percent/currency 归一;全表见 contract 的 numericalFormat);DATE 用日期枚举 `YYYY-MM-DD`/`YYYY-MM-DD HH:mm:ss`/`YYYY年MM月DD日`。",
326
332
  "org 选人族(STAFF_SELECTOR 等 5/50/51/60/61)字段行 options 由工具写成发布安全形状(形状与读面键见 contract field 的 orgSelectorFieldRowOptions)。deptVisible/multi 是**表单控件面**判别键(disposeUpdateType/updateSelectionType 读 control.options,票 69 已由表单脚手架写入控件面),不出现在字段行。",
327
333
  ]),
328
334
  }),
@@ -360,6 +366,9 @@ export function assertFieldContract() {
360
366
  throw new Error("field contract must carry the RELEVANCE_DATA referenceField wire facts");
361
367
  if (!String(FIELD_LANE_CONTRACT.wire.numericalFormat).includes("ratio.percentile") || !String(FIELD_LANE_CONTRACT.wire.numericalFormat).includes("0.5 renders 50.00%"))
362
368
  throw new Error("field contract must carry the NUMERICAL display-format enum and the ratio value semantics");
369
+ const dateFormatWire = String(FIELD_LANE_CONTRACT.wire.dateFormat);
370
+ if (FIELD_DATE_FORMATS_EVIDENCED.length !== 55 || !dateFormatWire.includes("YYYY-MM-DD HH:mm:ss") || !dateFormatWire.includes("YYYY年MM月DD日"))
371
+ throw new Error("field contract must carry the full 55-item DATE options.format enum (dateFormat)");
363
372
  if (!String(FIELD_LANE_CONTRACT.wire.controlEmissionPolicy).includes("BizPropertyType.java:27-54"))
364
373
  throw new Error("field contract must carry the ticket-101 control-emission policy with its enum evidence");
365
374
  if (!String(FIELD_LANE_CONTRACT.wire.fieldRowDefaultPolicy).includes("MUST-FIXED"))
@@ -862,6 +862,9 @@ export function registerFieldLane(tools) {
862
862
  tools,
863
863
  name: "field.create",
864
864
  search: { intents: ["加字段", "新增字段", "添加字段", "加一个字段", "单据号字段", "序列号字段", "编号规则字段", "百分比字段", "占比字段", "百分号显示"] },
865
+ nestedParamHints: {
866
+ format: "NUMERICAL 用平台常量(全表见 contract 的 numericalFormat;**百分比存比值** 0.5→50.00%);DATE 用日期枚举(`YYYY-MM-DD` / `YYYY-MM-DD HH:mm:ss` / `YYYY年MM月DD日`,共 55 项、区分大小写;全表见 contract 的 dateFormat),不是数值常量。",
867
+ },
865
868
  lane: FIELD_LANE,
866
869
  scope: FIELD_TOOLS["field.create"].scope,
867
870
  description: FIELD_TOOLS["field.create"].description,
@@ -2029,12 +2032,17 @@ async function formBindingAdvisory(session, schemaCode, publishedRows) {
2029
2032
  const fix = missingChildColumns.length > 0
2030
2033
  ? { schemaCode, ...(missingTopLevel.length > 0 ? { fieldCodes: missingTopLevel } : {}), childColumns: missingChildColumns }
2031
2034
  : { schemaCode, fieldCodes: missingTopLevel, rebuild: true };
2035
+ // F5(探针 K):两个写回执各报一条同义告警时,不要给同一条命令。子表列专用
2036
+ // form.publish 的一步绑定参数(field.publish 自身不改表单布局)。
2037
+ const nextCommand = missingChildColumns.length > 0 && missingTopLevel.length === 0
2038
+ ? `omc call form.publish --args '${JSON.stringify({ schemaCode, bindNewChildColumns: true })}'`
2039
+ : `omc call configure_form --args '${JSON.stringify(fix)}'`;
2032
2040
  return {
2033
2041
  formPresent: true,
2034
2042
  ...(missingTopLevel.length > 0 ? { notInFormLayout: missingTopLevel } : {}),
2035
2043
  ...(missingChildColumns.length > 0 ? { childColumnsNotInForm: missingChildColumns } : {}),
2036
- note: "字段已发布但**表单布局里没有**,业务页面看不到。子表列用 childColumns 增量绑进 Sheet201(不动其它控件);顶层缺字段用 rebuild:true(会重建布局)",
2037
- nextCommand: `omc call configure_form --args '${JSON.stringify(fix)}'`,
2044
+ note: "字段已发布但**表单布局里没有**,业务页面看不到。子表列用 form.publish {bindNewChildColumns:true}(或 configure_form childColumns)增量绑进 Sheet201,不动其它控件;顶层缺字段用 rebuild:true(会重建布局)",
2045
+ nextCommand,
2038
2046
  ...extras,
2039
2047
  };
2040
2048
  }
@@ -671,6 +671,7 @@ export function registerFormLane(tools) {
671
671
  // 实测 form.draft 改布局后直接 form.publish **不带 force 也正常提拔**
672
672
  // (errcode 0 / published true)。误导会让人多传一个没必要的护栏。
673
673
  force: z.boolean().optional().describe("仅在回执 already-published(同一份草稿重复发布被短路)且你确认要重推时使用;正常流程(改草稿→publish)不需要它"),
674
+ bindNewChildColumns: z.boolean().optional().describe("true=发布前先把已发布但不在表单 Sheet201 columns 里的子表列增量绑定(同 configure_form childColumns),再一次发布;默认 false 只告警"),
674
675
  allowDegrade: z.boolean().optional().describe("显式放行降级提拔(草稿控件数 < 已发布面);默认拒绝(form-publish-degrade),防把空/残草稿提拔成发布版"),
675
676
  rebuild: z
676
677
  .boolean()
@@ -694,6 +695,7 @@ export function registerFormLane(tools) {
694
695
  sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode),
695
696
  ...(args.allowDegrade !== undefined ? { allowDegrade: args.allowDegrade } : {}),
696
697
  ...(args.rebuild !== undefined ? { rebuild: args.rebuild } : {}),
698
+ ...(args.bindNewChildColumns !== undefined ? { bindNewChildColumns: args.bindNewChildColumns } : {}),
697
699
  ...(args.force !== undefined ? { force: args.force } : {}),
698
700
  }),
699
701
  lintScope: "partial",
@@ -1260,6 +1260,11 @@ export function registerListViewLane(tools) {
1260
1260
  readback.conditionVerification = {
1261
1261
  configFace: "配置面验收:listview.get 回读 conditions(propertyCode/filterType/defaultValue);本次提交了 conditions 时 conditionReadback 已比对",
1262
1262
  command: `omc call listview.get --env <env> --args '${JSON.stringify({ schemaCode: args.schemaCode, code })}'`,
1263
+ // F10(0.8.17 探针 K):验收口径集中一处写明,别让探针去找不存在的
1264
+ // REST 运行面验证入口。配置面 = conditionReadback.equivalent;运行面
1265
+ // 只有门户点验,平台没有 REST 入口。
1266
+ acceptance: "配置面验收 = conditionReadback.equivalent;运行面 = 门户点验(REST 无入口)",
1267
+ portalCheck: `需人工在门户打开视图 ${code}(模型 ${args.schemaCode}),按固定条件筛选一次并核对返回行——平台不提供 REST 运行面验证入口,本工具不提供假验证`,
1263
1268
  runtimeRunnable: false,
1264
1269
  runtimeNote: "视图固定条件只在门户运行时生效;平台没有 REST 验证入口(REST data.list --queryCode 不应用固定条件)。不要用 data.list --queryCode 断言过滤生效。",
1265
1270
  ...(dataListOp !== undefined
@@ -379,15 +379,35 @@ export async function cmdModelPurge(args, injected) {
379
379
  const referenced = plan.inboundReferences !== undefined && plan.inboundReferences.length > 0;
380
380
  const unbindEnabled = plan.unbindReferences === true;
381
381
  const blocked = plan.blockers.length > 0;
382
+ // F6(0.8.17,探针 K):只有跨模型引用才是 blocker。自引用(本模型自己的
383
+ // 子表关联列指回自身)从 0.8.16 起由 --apply 自动拆,dry-run 却仍回
384
+ // blocker:"model-referenced-by"——调用方会把它读成「必须先 --unbind-references,
385
+ // 否则跑不动」,与 apply 的实际行为相反。自引用改为 warning(带 step 清单),
386
+ // 顶层 blocker 只在真有跨模型引用(需要用户决策删别人模型的列)时出现。
387
+ const crossModelReferenced = (plan.crossModelUnbindSteps?.length ?? 0) > 0;
388
+ const selfReferenced = !crossModelReferenced && (plan.selfUnbindSteps?.length ?? 0) > 0;
382
389
  writeEnvelope(envelope("ok", {
383
390
  // F4(0.8.12,探针 G):入站引用是「删模型必然要拆的内部列」,是计划里的
384
391
  // 一步,不是执行失败——dry-run 只有真 blocker(活流程实例)才 blocked。
385
- // 未带 --unbind-references 时保留 blocker:"model-referenced-by"(与
386
- // model.delete dry-run 同名同义),并给出预置的 unbindSteps /
392
+ // 未带 --unbind-references 时,跨模型引用保留 blocker:"model-referenced-by"
393
+ // (与 model.delete dry-run 同名同义),并给出预置的 unbindSteps /
387
394
  // wouldRequireFlags,让调用方无需先加破坏性开关就能看完整计划。
388
395
  status: blocked ? "blocked" : "dry-run",
389
396
  ...plan,
390
- ...(referenced && !unbindEnabled ? { blocker: "model-referenced-by" } : {}),
397
+ ...(referenced && !unbindEnabled && crossModelReferenced ? { blocker: "model-referenced-by" } : {}),
398
+ ...(referenced && !unbindEnabled && selfReferenced
399
+ ? {
400
+ warnings: [
401
+ {
402
+ code: "self-reference-auto-unbind",
403
+ autoUnbindSteps: plan.selfUnbindSteps,
404
+ message: `${plan.schemaCode} 只有自引用(本模型子表关联列指回自身):` +
405
+ `--apply 会自动拆(${(plan.selfUnbindSteps ?? []).join(" → ")}),无需 --unbind-references;跨模型引用:无。` +
406
+ `破坏性:被删列数据不可恢复。`,
407
+ },
408
+ ],
409
+ }
410
+ : {}),
391
411
  ...(blocked
392
412
  ? {}
393
413
  : {
@@ -84,7 +84,7 @@ export async function cmdModelScaffold(args) {
84
84
  " 默认 dry-run(列出将要做什么);--apply 依次执行 建模型→建字段→建子列→发布字段→发布表单。",
85
85
  " 幂等:模型/字段已存在记为 skipped 继续;有真失败时默认不发布(--force-publish 可强发)。",
86
86
  " 每个子调用使用独立 requestId(避免同 id 不同参数被幂等门拒绝);重入已存在字段记 skipped。",
87
- " --fields-file 从配置根内文件读 JSON 数组;--fields - 从 stdin 读 JSON 数组。",
87
+ " --fields-file 从配置根内文件读 JSON 数组(根 = $OMC_CONFIG_HOME 或当前工作目录,根外拒绝;免落盘用 --fields - 读 stdin);--fields - 从 stdin 读 JSON 数组。",
88
88
  ].join("\n");
89
89
  const invalid = (message) => {
90
90
  writeEnvelope(envelope("error", {}, request, { code: "invalid-input", message: `${message}\n${usage}`, retryable: false }));
@@ -402,15 +402,23 @@ export async function cmdModelScaffold(args) {
402
402
  }
403
403
  function describeScaffoldPlan(options) {
404
404
  const childTables = options.fields.filter((field) => scaffoldChildrenOf(field).length > 0);
405
+ const declaredFieldCount = options.fields.length;
406
+ const childColumnCount = options.fields.reduce((sum, field) => sum + scaffoldChildrenOf(field).length, 0);
407
+ // F11(0.8.17,探针 K):dry-run 与 --apply 必须同键同值。旧 dry-run 只给
408
+ // `fields`(顶层数)和一个错的 `childFieldCount`(子表数 + 子列数 = 6,而真实
409
+ // 子列是 5),apply 却给 declaredFieldCount/childColumnCount/fieldCount——同一
410
+ // 份计划两套计数,探针对不上。现在统用 apply 的键名与算法。
405
411
  return {
406
412
  model: options.code,
407
413
  name: options.name,
408
- fields: options.fields.length,
414
+ declaredFieldCount,
415
+ childColumnCount,
416
+ fieldCount: declaredFieldCount + childColumnCount,
409
417
  childTables: childTables.map((field) => ({
410
418
  code: field.code,
411
419
  childFields: scaffoldChildrenOf(field).map((entry) => entry.code),
412
420
  })),
413
- childFieldCount: childTables.reduce((sum, field) => sum + 1 + scaffoldChildrenOf(field).length, 0),
421
+ countsNote: "dry-run 与 --apply 同键同义:declaredFieldCount = --fields 声明的顶层字段数;childColumnCount = 子列总数(子表自身不计数);fieldCount = 最终业务字段总数(declaredFieldCount + childColumnCount)。",
414
422
  publishForm: options.publishForm,
415
423
  steps: [
416
424
  `model.create ${options.code}`,
@@ -820,6 +820,107 @@ function projectPathOnSource(source, path) {
820
820
  }
821
821
  return { ...first };
822
822
  }
823
+ /**
824
+ * F8(0.8.17 真机 P1):拒绝态投影会把「没有值」伪装成成功值。`data.list` 对不存在的
825
+ * 模型回 `{status:"refused", blocker:"schema-not-found", total:0}`,`--jq total` 于是
826
+ * 回 `0`——与「模型存在但没有行」同形,调用方会把「模型没了」读成「0 条数据」。
827
+ *
828
+ * 拒绝不是答案:非诊断路径不投影,回拒绝摘要(blocker/message/nextCommand 原样保留)。
829
+ * **不**笼统禁止 refused 的所有投影——`--jq blocker` / `--jq message` 正是排查入口,
830
+ * 挡掉它们等于让防护挡住自己的逃生门。只挡「会伪装成功值」的载荷字段。
831
+ */
832
+ const REFUSAL_DIAGNOSTIC_KEYS = new Set([
833
+ // 结论与排查入口
834
+ "status",
835
+ "blocker",
836
+ "message",
837
+ "nextCommand",
838
+ "nextAction",
839
+ "errcode",
840
+ "platformErrcode",
841
+ "reason",
842
+ "citation",
843
+ "detail",
844
+ "diagnostic",
845
+ "environmentFingerprint",
846
+ // 证据面:引用点、校验失败、可用候选、恢复选项、存在性与读回
847
+ "references",
848
+ "validation",
849
+ "issues",
850
+ "available",
851
+ "options",
852
+ "coverage",
853
+ "exists",
854
+ "schemaCode",
855
+ "schemaCodes",
856
+ "readback",
857
+ // 身份键(拒绝回执用它们点名对象;不是结果集)
858
+ "ruleCode",
859
+ "serviceCode",
860
+ "methodCode",
861
+ "serviceMethodCode",
862
+ "fieldCode",
863
+ "propertyCode",
864
+ "schema",
865
+ "code",
866
+ "path",
867
+ // 证据计数与扫描自述(不是「结果有 N 行」的载荷 total/count)
868
+ "referenceCount",
869
+ "referenceCountNote",
870
+ "scanNote",
871
+ "methods",
872
+ "disappearingRefs",
873
+ // 恢复指引
874
+ "doNot",
875
+ "note",
876
+ "retryable",
877
+ "environment",
878
+ "owner",
879
+ "lockOwner",
880
+ "recovery",
881
+ "steps",
882
+ "causes",
883
+ ]);
884
+ /**
885
+ * 拒绝态投影闸门的**唯一真相源**(测试直接引用它钉住键集:新增 evidence 键
886
+ * 必须显式登记,否则会被当成载荷挡掉)。
887
+ */
888
+ export function refusalDiagnosticKeys() {
889
+ return REFUSAL_DIAGNOSTIC_KEYS;
890
+ }
891
+ /**
892
+ * 该路径读的是「拒绝回执怎么说的」而不是「平台数据」。首段是信封键
893
+ * (result./ok.)时看下一段;`--jq result`(整包拒绝回执)本身允许——
894
+ * status/blocker 都在里面,不会被读成成功值。
895
+ */
896
+ export function isRefusalDiagnosticPath(path) {
897
+ const segments = path.replace(/^\$\.?/, "").replace(/^[.\/]+/, "").split(/[.\/[]/).filter(Boolean);
898
+ const head = segments[0] === "result" || segments[0] === "ok" ? segments[1] : segments[0];
899
+ if (head === undefined)
900
+ return true;
901
+ return REFUSAL_DIAGNOSTIC_KEYS.has(head);
902
+ }
903
+ /**
904
+ * F7(0.8.17 真机 P1)配套:单路径命中 null 时,若源回执用 `<key>Omitted:true`
905
+ * 显式声明「这段正文已外置」,把这句话带进回执——否则 `--jq models` 回
906
+ * `result:null`,与「真的没有模型」同形(discover_environment 缓存命中就是
907
+ * models:null + modelsOmitted:true)。只给提示,不改值:投影仍是纯投影。
908
+ *
909
+ * 复核修正(0.8.17):这里**不能**引用本回执里的 tablesHint/fetch/artifactId——
910
+ * `detailFile → detailArtifactId` 的替换发生在投影之后,`--jq` 面拿不到它们。
911
+ * 只给一定能执行的下一步:去掉 --jq 重取同一条命令。
912
+ */
913
+ function omittedNullHint(path, source) {
914
+ if (source === null || typeof source !== "object" || Array.isArray(source))
915
+ return undefined;
916
+ const head = path.replace(/^\$\.?/, "").replace(/^[.\/]+/, "").split(/[.\/[]/).filter(Boolean)[0];
917
+ if (head === undefined)
918
+ return undefined;
919
+ const record = source;
920
+ if (record[head] !== null || record[`${head}Omitted`] !== true)
921
+ return undefined;
922
+ return `「${head}」本次为 null 且 ${head}Omitted:true——是「正文已外置」的声明,不是空表(空表是 [])。去掉 --jq 重取同一条命令:未投影回执里有 tablesHint / fetch(含取回该段正文的命令);别把 null 读成「没有数据」。`;
923
+ }
823
924
  export function projectResultExtract(result, paths, keysOnly, retry, explain = false) {
824
925
  const artifactId = typeof result.detailArtifactId === "string" ? result.detailArtifactId : typeof result.artifactId === "string" ? result.artifactId : undefined;
825
926
  // Tools hand an in-process artifact as `detailFile` (a local path);
@@ -857,6 +958,11 @@ export function projectResultExtract(result, paths, keysOnly, retry, explain = f
857
958
  // exist on the result but would silently resolve to a wrong-shaped value on
858
959
  // the artifact (or miss entirely). Never fall back to "parent object".
859
960
  const projectionSource = source;
961
+ // F8:拒绝态非诊断路径一律不投影(见 REFUSAL_DIAGNOSTIC_KEYS)。放在 artifact
962
+ // 合流之后:无论值来自回执还是外置正文,拒绝态的载荷字段都不是答案。
963
+ const refusalSuppressedPaths = result.status === "refused"
964
+ ? new Set(paths.filter((path) => !isRefusalDiagnosticPath(path)))
965
+ : undefined;
860
966
  const out = {
861
967
  status: result.status ?? "ok",
862
968
  ...(artifactId !== undefined ? { artifactId, sha256: artifact?.sha256 } : {}),
@@ -865,10 +971,15 @@ export function projectResultExtract(result, paths, keysOnly, retry, explain = f
865
971
  // 投影只改变取值路径,不改变源结果的完整性事实。尤其是外置 artifact
866
972
  // 场景,调用方仍必须能判断 items 是否被折叠,以及源侧 total/itemsCount。
867
973
  // 只透传源中实际存在的键;未截断结果不要凭空写 truncated:false。
974
+ // 拒绝态例外:total/itemsCount 是拒绝回执的默认 0——透传出去 `--jq total`
975
+ // 又变回「0 行」,与「存在但 0 行」同形(F8)。诊断路径也不透传:它们读的是
976
+ // 拒绝事实,不是结果集规模。
868
977
  const sourceRecord = source && typeof source === "object" && !Array.isArray(source)
869
978
  ? source
870
979
  : undefined;
871
980
  for (const key of ["truncated", "truncatedKeys", "itemsCount", "total"]) {
981
+ if (result.status === "refused" && (key === "total" || key === "itemsCount"))
982
+ continue;
872
983
  if (sourceRecord !== undefined && Object.prototype.hasOwnProperty.call(sourceRecord, key))
873
984
  out[key] = sourceRecord[key];
874
985
  }
@@ -952,6 +1063,21 @@ export function projectResultExtract(result, paths, keysOnly, retry, explain = f
952
1063
  return Buffer.byteLength(JSON.stringify(candidate), "utf8") <= 300 ? { nextCommand: fullFace.nextCommand } : {};
953
1064
  };
954
1065
  out.extract = paths.map((path) => {
1066
+ // F8:拒绝态下载荷字段不是值——回拒绝摘要而不是默认 0/[]/null。
1067
+ // 键本身不存在(`--jq blokcer`)时不吞成拒绝摘要:落回正常 pathMiss,
1068
+ // 保留 didYouMean / correctPath 的自愈提示。
1069
+ if (refusalSuppressedPaths?.has(path) === true && !projectPathOnSource(projectionSource, path).projected.missed) {
1070
+ const blocker = typeof result.blocker === "string" ? result.blocker : "refused";
1071
+ return {
1072
+ path,
1073
+ content: null,
1074
+ refused: true,
1075
+ blocker,
1076
+ ...(typeof result.message === "string" ? { message: result.message } : {}),
1077
+ ...(typeof result.nextCommand === "string" ? { nextCommand: result.nextCommand } : {}),
1078
+ hint: `本次调用被拒绝(${blocker}):「${path}」是拒绝回执的默认字段,不代表「有 0 条 / 空列表」。诊断值用 --jq blocker / message / nextCommand。`,
1079
+ };
1080
+ }
955
1081
  // r28f F2:对象构造 / 函数调用不是 pathMiss——先识别,别伪装成键缺失。
956
1082
  const unsupported = detectUnsupportedJqSyntax(path);
957
1083
  if (unsupported !== undefined) {
@@ -1058,11 +1184,14 @@ export function projectResultExtract(result, paths, keysOnly, retry, explain = f
1058
1184
  : compactMissExtra(path, single.at, baseMiss, fullFace)),
1059
1185
  };
1060
1186
  }
1187
+ const singleValue = single.value ?? null;
1188
+ const nullHint = singleValue === null ? omittedNullHint(path, projectionSource) : undefined;
1061
1189
  return {
1062
1190
  path,
1063
- content: single.value ?? null,
1191
+ content: singleValue,
1064
1192
  ...(autoStripped !== undefined ? { autoStripped } : {}),
1065
1193
  ...(preferResult ? { from: "result" } : {}),
1194
+ ...(nullHint !== undefined ? { hint: nullHint } : {}),
1066
1195
  };
1067
1196
  });
1068
1197
  // r30a F21 / r31c F7: single path keeps top-level `content`. Multi-path used
@@ -1072,12 +1201,14 @@ export function projectResultExtract(result, paths, keysOnly, retry, explain = f
1072
1201
  // projections so two columns align without a second round trip.
1073
1202
  const extracts = out.extract;
1074
1203
  if (paths.length === 1) {
1075
- out.content = extracts[0]?.content ?? null;
1204
+ // 拒绝态条目不是值——不写顶层 content(否则 `content:null` 又成了「值就是 null」)。
1205
+ if (extracts[0]?.refused !== true)
1206
+ out.content = extracts[0]?.content ?? null;
1076
1207
  }
1077
1208
  else {
1078
1209
  const columns = extracts.map((entry) => ({
1079
1210
  path: entry.path,
1080
- values: entry.pathMiss === true || entry.unsupportedSyntax === true
1211
+ values: entry.pathMiss === true || entry.unsupportedSyntax === true || entry.refused === true
1081
1212
  ? []
1082
1213
  : Array.isArray(entry.content)
1083
1214
  ? entry.content
@@ -1114,6 +1245,21 @@ export function projectResultExtract(result, paths, keysOnly, retry, explain = f
1114
1245
  out.hint = `${RESULT_RELATIVE_PATH_NOTE}逐条定位见 extract[](或 rows[] 列对齐);语法教程:${PATH_MISS_HELP_REF}。`;
1115
1246
  }
1116
1247
  }
1248
+ // F8:拒绝态的结论与排查载荷原样保留(不论本路径是否被挡下)——`--jq blocker`
1249
+ // 的信封 error 也要是**这条**拒绝,不是笼统的 "operation refused"。
1250
+ if (result.status === "refused" && paths.length > 0) {
1251
+ if (typeof result.blocker === "string")
1252
+ out.blocker = result.blocker;
1253
+ if (typeof result.message === "string")
1254
+ out.message = result.message;
1255
+ if (typeof result.nextCommand === "string")
1256
+ out.nextCommand = result.nextCommand;
1257
+ // 只有被挡下的载荷路径才是「没回答」;诊断路径(blocker 等)是回答了。
1258
+ if (extracts.some((entry) => entry.refused === true)) {
1259
+ out.unanswered = true;
1260
+ out.hint = `拒绝态不投影载荷字段:本次调用被拒绝(${String(out.blocker)}),被挡下的路径读到的是拒绝回执的默认值(0 / [] / null),与「有 0 条」同形。排查用 --jq blocker / message / nextCommand;要数据先解除拒绝。`;
1261
+ }
1262
+ }
1117
1263
  }
1118
1264
  return out;
1119
1265
  }
@@ -1124,7 +1270,8 @@ export function unwrapSinglePathProjection(projected) {
1124
1270
  if (!Array.isArray(extracts) || extracts.length !== 1)
1125
1271
  return undefined;
1126
1272
  const entry = extracts[0];
1127
- if (entry.pathMiss === true || entry.unsupportedSyntax === true)
1273
+ // refused:拒绝摘要不是值,不能解包成 `result:<默认值>`。
1274
+ if (entry.pathMiss === true || entry.unsupportedSyntax === true || entry.refused === true)
1128
1275
  return undefined;
1129
1276
  const resultMeta = { path: entry.path };
1130
1277
  for (const key of SINGLE_PATH_META_KEYS) {
@@ -37,6 +37,44 @@ const submitCrossFieldCheck = Object.freeze({
37
37
  ],
38
38
  requiresEnvironmentDerivedIds: false,
39
39
  });
40
+ const submitFieldVsConstant = Object.freeze({
41
+ id: "submit-field-vs-constant",
42
+ aliases: ["金额必须大于0", "提交校验 常量比较"],
43
+ title: "提交校验最小例:字段 vs 常量(dataRuleType:1 + checkType:2)——checkType:2=提交校验、dataRuleType:1=校验类;右值 valueType:\"custom\" 是 JSON 值对象(平台也接受裸字面量)",
44
+ status: "offline-valid",
45
+ tool: "datarule.create",
46
+ args: {
47
+ environment,
48
+ schemaCode: model,
49
+ propertyCode: "amount",
50
+ dataRuleType: 1,
51
+ checkType: 2,
52
+ name: "金额必须大于 0",
53
+ options: {
54
+ conditions: '{amount} 大于 {"valueType":"custom","value":0}',
55
+ prompt: "金额必须大于 0",
56
+ },
57
+ },
58
+ preconditions: [
59
+ "目标字段(示例 `amount`)已发布。",
60
+ "**判型一句话**:`dataRuleType:1` 是校验类规则,`checkType:2` 是其中的提交校验;两者一起才是「提交时按条件校验」。",
61
+ ],
62
+ conditionalRequirements: [
63
+ '**右值 `{"valueType":"custom","value":0}` 是 JSON 值对象**;平台也接受裸字面量(如 `{qty} 大于 100`)。只有跨字段比较才用 `{"valueType":"currentModel","value":"<字段code>"}`。',
64
+ "条件串是 `{字段code} 操作符 右值` 三段单空格(中文操作符优先,如 大于/大于等于/等于);多条件用 ` && `、多组用 ` || `。",
65
+ "`prompt` 存纯文本(门户原样显示,URL 编码会弹 %E5.. 乱码)。",
66
+ "执行面:该规则默认只在门户表单提交时由前端执行,CLI `data.submit` 对非空值不跑条件校验——配置面用 `datarule.list` 核对,行为在门户点验。",
67
+ ],
68
+ priorToolReferences: [{ tool: "field.list", args: { environment, schemaCode: model, published: true }, purpose: "确认目标字段已发布" }],
69
+ dryRun: { supported: true, command: `omc call datarule.create --env ${environment} --dry-run --args '<recipe.args>'`, notes: "dry-run 过条件协议校验(裸右值/prompt 编码当场拒),零 wire" },
70
+ expectedReadback: { performed: { errcode: 0 }, readback: { dataRuleType: 1, checkType: 2, rulePresent: true } },
71
+ refusalRecovery: [
72
+ { code: "datarule-submit-prompt-encoded", action: "prompt 存纯文本,别 URL 编码" },
73
+ { code: "datarule-options-invalid", action: `复制 recipe 的三段条件串;常量右值用 {"valueType":"custom","value":<值>},跨字段才用 currentModel` },
74
+ ...commonRecovery,
75
+ ],
76
+ requiresEnvironmentDerivedIds: false,
77
+ });
40
78
  const dataruleCalcRule = Object.freeze({
41
79
  id: "field-compute-rule",
42
80
  title: "字段计算规则:普通字段 + 计算规则(type2,勿用「计算公式」字段类型)",
@@ -218,6 +256,6 @@ const dataruleDisplay = Object.freeze({
218
256
  requiresEnvironmentDerivedIds: false,
219
257
  });
220
258
  export const DATARULE_METADATA = Object.freeze({
221
- "datarule.create": Object.freeze({ recipes: [submitCrossFieldCheck, dataruleCalcRule, dataruleSubtableSum, dataruleChildColumn, dataruleRequired, dataruleReadonly, dataruleDisplay], relatedTools: ["field.list", "datarule.list"] }),
259
+ "datarule.create": Object.freeze({ recipes: [submitFieldVsConstant, submitCrossFieldCheck, dataruleCalcRule, dataruleSubtableSum, dataruleChildColumn, dataruleRequired, dataruleReadonly, dataruleDisplay], relatedTools: ["field.list", "datarule.list"] }),
222
260
  });
223
261
  //# sourceMappingURL=datarule.js.map
package/dist/write.js CHANGED
@@ -472,7 +472,7 @@ function findCompleted(root, requestId, tool, environment, requestFingerprint) {
472
472
  }
473
473
  /** Low-level write registration factory: shared by every lane adapter. */
474
474
  export function writeTool(definition) {
475
- const { tools, name, lane, scope, description, inputSchema, search, execute, preflight, dryRunPayload, writeLint, rollback, readOnlyEscape } = definition;
475
+ const { tools, name, lane, scope, description, inputSchema, search, nestedParamHints, execute, preflight, dryRunPayload, writeLint, rollback, readOnlyEscape } = definition;
476
476
  const rawExecute = execute;
477
477
  // R75-B:未显式声明时按实际能力推导——有 session 只读 lint(writeLint 或
478
478
  // dryRunPayload)→ partial;两者都没有 → plan(dry-run 只回 plan,最容易被
@@ -559,6 +559,7 @@ export function writeTool(definition) {
559
559
  scope,
560
560
  description: `${description} ${WRITE_PROTOCOL}`,
561
561
  ...(search === undefined ? {} : { search }),
562
+ ...(nestedParamHints === undefined ? {} : { nestedParamHints }),
562
563
  inputSchema: { environment: environmentArg, capability: capabilityArg, confirmProduction: confirmProductionArg, requestId: z.string().min(1).optional(), dryRun: z.boolean().optional(), ...inputSchema },
563
564
  handler: async (ctx, args, self) => {
564
565
  semanticGate(args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.8.16",
3
+ "version": "0.8.17",
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.16",
61
+ "omc-core": "0.8.17",
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.16"
79
+ "@stalfh233/omc-fake-platform": "0.8.17"
80
80
  }
81
81
  }
@@ -12,7 +12,7 @@ be treated as a second source. Read this, then follow the topics it names.
12
12
 
13
13
  ## 最小路径(先读这段就能开始)
14
14
 
15
- 0. **调用与检索(跨平台)**:`omc call ... --args '<json>'` 的内联 JSON 在 Windows PowerShell 下因引号转义不可靠——**PS 环境优先 `--args-file <path>`**(把 JSON 写临时文件再引用;解析失败的报错里也有此提示)。长 JSON、含引号或中文换行的负载统一可走 stdin:`echo '<json>' | omc call <tool> --args -`;`--args-file <path>` 则必须位于项目配置根内。读命令输出默认把中文转义为 `\uXXXX`(防乱码)——**这是有意为之**:stdout 恒为「恰好一个合法 JSON envelope」,在任何代码页下都能被 `JSON.parse`/`ConvertFrom-Json` 还原(GitLab #17 T2 实证:曾让 `--utf8` 关掉转义,GBK 管道把信封结构解码坏、`ConvertFrom-Json` 中途失败)。`--utf8` 只让**人类诊断文本**(stderr/散文)按 UTF-8 原文输出;要连 stdout 也是中文明文,必须先让管道按 UTF-8 解码(`chcp 65001`)——只设 `OMC_ASCII_STDOUT=0` 是关写出端转义、不改管道解码,在 cp936 管道下会把信封解码坏。对输出做内容检索时**先解 JSON 再检索**(或 `--jq` 取值),"grep 搜不到中文"≠"没有配置"(静默假阴性坑)。stdout 恒为纯 JSON、人读进度在 stderr——脚本解析勿 `2>&1` 合流。
15
+ 0. **调用与检索(跨平台)**:`omc call ... --args '<json>'` 的内联 JSON 在 Windows PowerShell 下因引号转义不可靠——**PS 环境优先 `--args-file <path>`**(把 JSON 写临时文件再引用;解析失败的报错里也有此提示)。长 JSON、含引号或中文换行的负载统一可走 stdin:`echo '<json>' | omc call <tool> --args -`;`--args-file <path>` 则必须位于项目配置根内(worktree 下回退主检出);`model-scaffold`/`field-add` 的 `--fields-file` 必须位于 `$OMC_CONFIG_HOME` 或当前工作目录(根外一律拒绝),这两条命令免落盘用 `--fields -` 从 stdin 读。读命令输出默认把中文转义为 `\uXXXX`(防乱码)——**这是有意为之**:stdout 恒为「恰好一个合法 JSON envelope」,在任何代码页下都能被 `JSON.parse`/`ConvertFrom-Json` 还原(GitLab #17 T2 实证:曾让 `--utf8` 关掉转义,GBK 管道把信封结构解码坏、`ConvertFrom-Json` 中途失败)。`--utf8` 只让**人类诊断文本**(stderr/散文)按 UTF-8 原文输出;要连 stdout 也是中文明文,必须先让管道按 UTF-8 解码(`chcp 65001`)——只设 `OMC_ASCII_STDOUT=0` 是关写出端转义、不改管道解码,在 cp936 管道下会把信封解码坏。对输出做内容检索时**先解 JSON 再检索**(或 `--jq` 取值),"grep 搜不到中文"≠"没有配置"(静默假阴性坑)。stdout 恒为纯 JSON、人读进度在 stderr——脚本解析勿 `2>&1` 合流。
16
16
 
17
17
  0. **拼装器优先(高频写面一条命令)**:整模型建模(模型+N 字段+子表+发布+表单)`omc model-scaffold`;**存量模型加字段(建→发布→重建表单→列表加列)`omc field-add`**;字段计算 `omc compute`;条件→动作 `omc rule-when`;线性审批流 `omc approval-flow`;表单默认值 `omc form-default`;存量盘点 `data.list all:true`;收尾清理 `omc model-purge --code <schema>`(依赖倒序,默认 dry-run)+ `omc residue <prefix>` 证删净——命中这些形态先看 `--help`,比 recipe 手拼省 10+ 轮。
18
18