@stalfh233/omc-cli 0.8.15 → 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 +50 -14
- package/dist/discovery.js +2 -0
- package/dist/field-add.js +1 -1
- package/dist/form-support.js +213 -19
- package/dist/goal-plan.js +23 -2
- package/dist/goal-routes.js +94 -18
- package/dist/human-summary.js +24 -4
- package/dist/lanes/datarule.js +3 -0
- package/dist/lanes/field-contract.js +10 -1
- package/dist/lanes/field.js +10 -2
- package/dist/lanes/form.js +3 -1
- package/dist/lanes/list-view-contract.js +1 -1
- package/dist/lanes/list-view.js +56 -0
- package/dist/lanes/model-references.js +22 -3
- package/dist/lanes/runtime-data.js +97 -17
- package/dist/lanes/workflow.js +97 -14
- package/dist/model-purge.js +112 -37
- package/dist/model-scaffold.js +11 -3
- package/dist/path-projection.js +151 -4
- package/dist/recipes/datarule.js +39 -1
- package/dist/recipes/form.js +2 -2
- package/dist/residue.js +13 -2
- package/dist/tool-types.js +19 -0
- package/dist/wire-refusal.js +171 -0
- package/dist/write.js +27 -174
- package/package.json +3 -3
- package/skills/omc-glossary.md +22 -0
- package/skills/omc-start-here.md +1 -1
package/dist/cli.js
CHANGED
|
@@ -59,7 +59,7 @@ import { SEARCH_MARGIN_THRESHOLD } from "./tool-search.js";
|
|
|
59
59
|
import { commandCapabilitySlice, commandIndex, commandInventory, commandKindIndex, describeContract, describeContractFull, describeContractTool, describeExample, describeParam, describeSchemaOnly, describeTool, describeToolFull, filterTools } from "./discovery.js";
|
|
60
60
|
import { locatorMetaFor } from "./read-shapes.js";
|
|
61
61
|
import { surfaceRefFor } from "./surface-ref.js";
|
|
62
|
-
import { KEY_ALIAS_HINTS, inputAliasSynonymKeys } from "./tool-types.js";
|
|
62
|
+
import { KEY_ALIAS_HINTS, TOOL_KEY_ALTERNATIVES, inputAliasSynonymKeys } from "./tool-types.js";
|
|
63
63
|
import { repeatFullDescribe } from "./describe-cache.js";
|
|
64
64
|
import { buildCapabilityOverview, capabilityCandidatesFor, capabilityDetail, capabilityRouteForTool, capabilityRouteIndex, compactCapabilities, executableCapabilityBundle, resolveCapabilityId, DISCOVERY_AUTHORITY } from "./capability-overview.js";
|
|
65
65
|
import { goalRoute } from "./goal-routes.js";
|
|
@@ -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
|
-
|
|
575
|
-
|
|
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)。
|
|
@@ -806,8 +826,13 @@ async function cmdCall(store, args) {
|
|
|
806
826
|
const otherUnknown = unknownKeys.filter((key) => !APP_SCOPE_ARG_KEYS.has(key));
|
|
807
827
|
if (tool.kind !== "write" && otherUnknown.length > 0) {
|
|
808
828
|
if (!lenientArgs) {
|
|
829
|
+
// 探针 J F4/F5:可执行替代由 TOOL_KEY_ALTERNATIVES 提供(tool+key 显式
|
|
830
|
+
// 登记),替代出现在 suggestions[].replaceWith/hint/nextCommand;没有
|
|
831
|
+
// 登记的键沿用旧口径({key} 只表「被拒」,不编造改名——见 0.8.4 C1)。
|
|
809
832
|
const suggestions = otherUnknown.map((key) => ({ key, ...suggestArgumentKey(key, [...schemaKeys], toolName) }));
|
|
810
833
|
const pairs = suggestions.map((entry) => {
|
|
834
|
+
if (entry.replaceWith !== undefined)
|
|
835
|
+
return `${entry.key}→${entry.replaceWith}${entry.hint !== undefined ? `(${entry.hint})` : ""}`;
|
|
811
836
|
if (entry.hint)
|
|
812
837
|
return `${entry.key}(${entry.hint})`;
|
|
813
838
|
if (entry.closest)
|
|
@@ -816,6 +841,7 @@ async function cmdCall(store, args) {
|
|
|
816
841
|
return `${entry.key}(本工具没有 ${entry.absentInTool})`;
|
|
817
842
|
return entry.key;
|
|
818
843
|
});
|
|
844
|
+
const explicitNext = suggestions.find((entry) => entry.nextCommand !== undefined)?.nextCommand;
|
|
819
845
|
const result = {
|
|
820
846
|
status: "error",
|
|
821
847
|
blocker: "tool-input-unknown-keys",
|
|
@@ -826,14 +852,18 @@ async function cmdCall(store, args) {
|
|
|
826
852
|
// describe),脚本可零解析消费。
|
|
827
853
|
expectedKeys: [...schemaKeys],
|
|
828
854
|
suggestions,
|
|
829
|
-
//
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
855
|
+
// 显式替代(探针 J)优先给可复制命令;其次有拼写近邻时直达该参数的
|
|
856
|
+
// describe;否则退回整份参数表。
|
|
857
|
+
...(explicitNext !== undefined
|
|
858
|
+
? { nextCommand: explicitNext }
|
|
859
|
+
: suggestions.some((entry) => entry.closest !== undefined)
|
|
860
|
+
? { nextCommand: `omc describe ${toolName} --param ${suggestions.find((entry) => entry.closest !== undefined).closest}` }
|
|
861
|
+
: { nextCommand: `omc describe ${toolName}` }),
|
|
833
862
|
message: `读面不接受未知键(与写面对齐):${pairs.join("、")}。` +
|
|
834
863
|
// C1(0.8.4):没有可信的改写建议时,不编造改名——直接把该工具的
|
|
835
|
-
//
|
|
836
|
-
|
|
864
|
+
// 真实参数名列出来,让人按名字挑。探针 J:混合键里只要有一个键
|
|
865
|
+
// 没拿到替代(如 all 有 replaceWith、zzz 没有),仍要列真实参数。
|
|
866
|
+
`${suggestions.some((entry) => entry.closest === undefined && entry.hint === undefined && entry.absentInTool === undefined && entry.replaceWith === undefined) ? `本工具的真实参数:${[...schemaKeys].join("、")}。` : ""}` +
|
|
837
867
|
`改用合法键后重试;确需宽松忽略传 lenientArgs:true。参数表:omc describe ${toolName}`,
|
|
838
868
|
};
|
|
839
869
|
return emit("error", result, CLI_EXIT_CODES.invalidInput);
|
|
@@ -1153,6 +1183,12 @@ function applyReadArgAliases(toolName, schemaKeys, input) {
|
|
|
1153
1183
|
* 「改名建议」表达——建议无法携带方向/换算信息。
|
|
1154
1184
|
*/
|
|
1155
1185
|
export function suggestArgumentKey(key, schemaKeys, toolName) {
|
|
1186
|
+
// 探针 J F4/F5:按 tool+key 的显式替代优先于拼写猜测(见
|
|
1187
|
+
// TOOL_KEY_ALTERNATIVES)。命中的是「语义改写」而不是「拼错」,所以
|
|
1188
|
+
// closest/编辑距离不参与,避免把原键再建议一次。
|
|
1189
|
+
const alternative = toolName !== undefined ? TOOL_KEY_ALTERNATIVES[toolName]?.[key] : undefined;
|
|
1190
|
+
if (alternative !== undefined)
|
|
1191
|
+
return { ...alternative };
|
|
1156
1192
|
const known = new Set(schemaKeys);
|
|
1157
1193
|
const paginationKeys = new Set(["page", "pagesize", "size", "pageindex", "pagenumber", "pageno", "offset", "limit"]);
|
|
1158
1194
|
if (paginationKeys.has(key.toLowerCase()) && !schemaKeys.some((name) => paginationKeys.has(name.toLowerCase()))) {
|
|
@@ -3025,7 +3061,7 @@ function cmdHelpSearch(topic, query, transport, searchMode, limit) {
|
|
|
3025
3061
|
returnedMatches: entries.length,
|
|
3026
3062
|
truncated: truncated || entries.some((entry) => entry.sectionComplete === false),
|
|
3027
3063
|
matches: entries,
|
|
3028
|
-
...(result.total === 0 ? { message: "没有匹配章节;换更短的字面词(错误码、字段名、命令名)或加 --search-mode any" } : {}),
|
|
3064
|
+
...(result.total === 0 ? { message: "没有匹配章节;换更短的字面词(错误码、字段名、命令名)或加 --search-mode any。格式常量/参数用 `omc describe <tool> --param <name>` 或 `omc contract <lane>` 查(例:omc describe field.create --param options)" } : {}),
|
|
3029
3065
|
...(result.total > 0 && entries.length === 0 ? { message: "命中存在但连指针都放不进预算;加 --limit 1 或换更短的查询" } : {}),
|
|
3030
3066
|
});
|
|
3031
3067
|
let truncating = false;
|
|
@@ -3779,7 +3815,7 @@ async function main() {
|
|
|
3779
3815
|
.option("--env <environment>")
|
|
3780
3816
|
.option("--environment <environment>")
|
|
3781
3817
|
.option("--apply")
|
|
3782
|
-
.addHelpText("after", "\n一条命令按依赖倒序清掉一个模型:列表视图 → 业务规则 → 计算规则 → 流程实例 → 流程 → 模型(字段/表单随模型级联,并级联删除流程模板 <code>_wf 及其发起权限绑定)。默认 dry-run。\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")
|
|
3783
3819
|
.action(async (options) => {
|
|
3784
3820
|
const rest = ["model-purge",
|
|
3785
3821
|
...(options.code ? ["--code", options.code] : []),
|
|
@@ -3897,7 +3933,7 @@ async function main() {
|
|
|
3897
3933
|
.option("--name <name>", "模型名")
|
|
3898
3934
|
.option("--fields <json>", "JSON 数组,每条是一个 field.create 参数;子表加 subFields")
|
|
3899
3935
|
.option("--fields-json <json>")
|
|
3900
|
-
.option("--fields-file <path>", "
|
|
3936
|
+
.option("--fields-file <path>", "从文件读字段 JSON 数组。**必须位于配置根内**(根 = `$OMC_CONFIG_HOME` 或当前工作目录;根外一律拒绝);免落盘用 `--fields -`(stdin);与 --fields 互斥")
|
|
3901
3937
|
.option("--folder <folderId>", "建在哪个应用目录(省略=默认目录)")
|
|
3902
3938
|
.option("--app <applicationCode>")
|
|
3903
3939
|
.option("--env <environment>")
|
|
@@ -3944,7 +3980,7 @@ async function main() {
|
|
|
3944
3980
|
.option("--code <schemaCode>")
|
|
3945
3981
|
.option("--fields <json>", "JSON 数组,每条是一个 field.create 参数(choices/字典 options 原样透传)")
|
|
3946
3982
|
.option("--fields-json <json>")
|
|
3947
|
-
.option("--fields-file <path>", "
|
|
3983
|
+
.option("--fields-file <path>", "从文件读字段 JSON 数组。**必须位于配置根内**(根 = `$OMC_CONFIG_HOME` 或当前工作目录;根外一律拒绝);免落盘用 `--fields -`(stdin);与 --fields 互斥")
|
|
3948
3984
|
.option("--env <environment>")
|
|
3949
3985
|
.option("--environment <environment>")
|
|
3950
3986
|
.option("--no-form", "跳过表单重建")
|
|
@@ -4075,7 +4111,7 @@ async function main() {
|
|
|
4075
4111
|
}));
|
|
4076
4112
|
});
|
|
4077
4113
|
command.command("bench").option("--live-sample").option("--env <environment>").action(async (options) => { commandExitCode = await cmdBench([...(options.liveSample ? ["--live-sample"] : []), ...(options.env ? ["--env", options.env] : [])]); });
|
|
4078
|
-
command.command("residue <prefix>").description("跨面前缀残留扫描(model 全租户/folder/custompage;默认 deep 再查命中模型的 rule/datarule/onlinejs)——收尾「删净」一次证明,clean:true
|
|
4114
|
+
command.command("residue <prefix>").description("跨面前缀残留扫描(model 全租户/folder/custompage;默认 deep 再查命中模型的 rule/datarule/onlinejs)——收尾「删净」一次证明,clean:true 仅指已扫描面零残留(cleanScope:\"scanned-faces\";report 面未扫描,用 report.tree 复核)。清理入口:omc model-purge --code <schemaCode>(按依赖倒序,默认 dry-run)。只读零写入;report 面暂停维护未扫描").option("--env <environment>", "环境名(默认按 cwd 的 .omc-env 解析)").option("--apps <codes>", "all(默认,全租户)或逗号分隔应用码").option("--no-deep", "只扫 model/folder/custompage,不深查命中模型").option("--all-faces", "列出全部应用×面(含 count:0;默认只回非零面+byFace/userResidues 紧凑形)").option("--max-output-bytes <bytes>").addOption(new Option("--jq [path]", "--jq 不是 jq,仅路径选择器(与 call --jq 同 DSL;可逗号多路径;裸 --jq 列顶层键)").argParser((value, previous = []) => [...previous, value]).default([])).action(async (prefix, options) => { commandExitCode = await withTransport(options, request, (transport) => cmdResidue(prefix, { env: options.env, apps: options.apps, ...(options.deep === false ? { noDeep: true } : {}), ...(options.allFaces ? { allFaces: true } : {}), ...(options.jq !== undefined ? { jq: options.jq } : {}) }, transport)); });
|
|
4079
4115
|
command.command("track <schemaCode> <bizObjectId>").description("读取单条业务数据的行级变更留痕(只读;平台来源枚举含 BUSINESS_RULE 时原样回传)").option("--env <environment>").option("--property-code <code>").option("--max-output-bytes <bytes>").action(async (schemaCode, bizObjectId, options) => { commandExitCode = await withTransport(options, request, (transport) => cmdTrack(schemaCode, bizObjectId, { env: options.env, propertyCode: options.propertyCode }, transport)); });
|
|
4080
4116
|
const jqOption = () => new Option("--jq [path]", "--jq 不是 jq,仅路径选择器(与 call --jq 同 DSL;可逗号多路径;裸 --jq 列顶层键)").argParser((value, previous = []) => [...previous, value]).default([]);
|
|
4081
4117
|
// C6(0.8.4):--jq 的 miss 默认只回结论;排查载荷(available/correctPath/
|
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
|
|
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 }));
|
package/dist/form-support.js
CHANGED
|
@@ -894,8 +894,8 @@ export function assertLayoutRequestConflicts(args) {
|
|
|
894
894
|
schemaCode: String(args.schemaCode ?? ""),
|
|
895
895
|
sheetCode: String(args.sheetCode ?? args.schemaCode ?? ""),
|
|
896
896
|
conflictKeys,
|
|
897
|
-
message: `layout 与 ${conflictKeys.join("、")} 互斥:layout
|
|
898
|
-
? "
|
|
897
|
+
message: `layout 与 ${conflictKeys.join("、")} 互斥:layout 是增量面(以草稿为基线,只改这些控件的行分组与 span),不要同时回传整包 attrs/view、不要重建;二选一。${conflictKeys.includes("childColumns")
|
|
898
|
+
? "子表列走的是另一个只写草稿的增量面,正确顺序:① 先 `form.draft {childColumns}` 把子表列绑进草稿;② 再 `form.draft {layout}`(以草稿为基线,不动刚绑的列);③ 再 `form.publish`。"
|
|
899
899
|
: ""}`,
|
|
900
900
|
});
|
|
901
901
|
}
|
|
@@ -910,11 +910,17 @@ export async function composeFormLayoutDraft(session, args) {
|
|
|
910
910
|
const decode = (value) => decodeJsonObjectColumn(value, { invalid: "undefined", array: "reject", object: "accept" });
|
|
911
911
|
const publishedAttrs = sheet === null ? undefined : decode(sheet.publishedAttributesJson);
|
|
912
912
|
const draftAttrs = sheet === null ? undefined : decode(sheet.draftAttributesJson);
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
913
|
+
const usable = (face) => face !== undefined && Object.keys(face).length > 0;
|
|
914
|
+
const publishedUsable = usable(publishedAttrs);
|
|
915
|
+
const draftUsable = usable(draftAttrs);
|
|
916
|
+
// 探针 J P1(0.8.16):草稿是下一次发布的对象,`childColumns` 只写草稿——layout
|
|
917
|
+
// 必须以草稿为基线,否则第二次写会把第一次写进草稿的子表列/新控件整包覆盖掉。
|
|
918
|
+
// 草稿为空(设计器 Save 会清成 "{}")或与已发布面逐字相同(刚发布完,内容等价)
|
|
919
|
+
// 时退回 published,保持「无草稿 → published」的老行为不变。
|
|
920
|
+
const draftDifferences = sheet !== null &&
|
|
921
|
+
(sheet.draftAttributesJson !== sheet.publishedAttributesJson ||
|
|
922
|
+
(typeof sheet.draftViewJson === "string" && sheet.draftViewJson !== sheet.publishedViewJson));
|
|
923
|
+
const baseline = draftUsable && (!publishedUsable || draftDifferences) ? "draft" : publishedUsable ? "published" : draftUsable ? "draft" : undefined;
|
|
918
924
|
if (sheet === null || baseline === undefined) {
|
|
919
925
|
throw new ToolRefusalError({
|
|
920
926
|
status: "refused",
|
|
@@ -1068,7 +1074,12 @@ export async function composeFormLayoutDraft(session, args) {
|
|
|
1068
1074
|
});
|
|
1069
1075
|
}
|
|
1070
1076
|
// 基线行分组(保留未点名控件):去非法 cell/重复 cell,空行丢弃。
|
|
1071
|
-
|
|
1077
|
+
// 草稿 attrs 有控件但草稿 view 是空/"[]"(只写过 draftAttributesJson)时,
|
|
1078
|
+
// 行分组退回已发布 view:attrs 以草稿为准(新控件不丢),行分组沿用发布面。
|
|
1079
|
+
const draftRows = layoutRowsOf(sheet.draftViewJson);
|
|
1080
|
+
const publishedRows = layoutRowsOf(sheet.publishedViewJson);
|
|
1081
|
+
const rowsFace = baseline === "published" ? "published" : draftRows !== undefined && draftRows.length > 0 ? "draft" : publishedRows !== undefined && publishedRows.length > 0 ? "published" : "draft";
|
|
1082
|
+
const parsedBaseline = layoutRowsOf(rowsFace === "published" ? sheet.publishedViewJson : sheet.draftViewJson) ?? [];
|
|
1072
1083
|
const seenCell = new Set();
|
|
1073
1084
|
const baselineRows = [];
|
|
1074
1085
|
const droppedCells = [];
|
|
@@ -1155,13 +1166,53 @@ export async function composeFormLayoutDraft(session, args) {
|
|
|
1155
1166
|
}
|
|
1156
1167
|
const warnings = violations.filter((violation) => !touchesCaller(violation));
|
|
1157
1168
|
const preserved = attrCodes.filter((code) => !namedSet.has(code));
|
|
1169
|
+
// 草稿基线可能比已发布面**少**控件或**少子表列**(设计器 Save 非无损 / 历史
|
|
1170
|
+
// layout 已被整包覆盖 / 草稿来自陈旧读面)。这时不静默:如实点名,说明发布会
|
|
1171
|
+
// 撞 form-publish-degrade 或 childColumnsNotInForm 与恢复路径。
|
|
1172
|
+
const draftMissingPublishedControls = baseline === "draft" && publishedUsable ? Object.keys(publishedAttrs).filter((code) => !attrSet.has(code)) : [];
|
|
1173
|
+
// 子表列不在顶层控件面:它们在父 Sheet201 控件的 columns[] 里(childTableColumns
|
|
1174
|
+
// 注释)。layout 只重排不改列,所以「草稿比发布面少列」会原样被带去发布面。
|
|
1175
|
+
const columnKeysOf = (control) => {
|
|
1176
|
+
if (control === null || typeof control !== "object")
|
|
1177
|
+
return [];
|
|
1178
|
+
const columns = control.columns;
|
|
1179
|
+
return Array.isArray(columns) ? columns.map((column) => String(column?.key ?? "")).filter((key) => key.length > 0) : [];
|
|
1180
|
+
};
|
|
1181
|
+
const draftMissingPublishedChildColumns = [];
|
|
1182
|
+
if (baseline === "draft" && publishedUsable) {
|
|
1183
|
+
for (const [parent, publishedControl] of Object.entries(publishedAttrs)) {
|
|
1184
|
+
const publishedColumns = columnKeysOf(publishedControl);
|
|
1185
|
+
if (publishedColumns.length === 0)
|
|
1186
|
+
continue;
|
|
1187
|
+
// 父控件整体缺失已由 draftMissingPublishedControls 点名(列跟着控件走)。
|
|
1188
|
+
if (attrs[parent] === undefined)
|
|
1189
|
+
continue;
|
|
1190
|
+
const bound = new Set(columnKeysOf(attrs[parent]));
|
|
1191
|
+
const absent = publishedColumns.filter((key) => !bound.has(key));
|
|
1192
|
+
if (absent.length > 0)
|
|
1193
|
+
draftMissingPublishedChildColumns.push({ parent, fieldCodes: absent });
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1158
1196
|
const receipt = {
|
|
1159
1197
|
baseline,
|
|
1198
|
+
...(rowsFace !== baseline ? { rowsBaseline: rowsFace } : {}),
|
|
1160
1199
|
rows: finalRows.length,
|
|
1161
1200
|
named,
|
|
1162
1201
|
preserved,
|
|
1163
1202
|
...(appended.length > 0 ? { appended } : {}),
|
|
1164
1203
|
...(droppedCells.length > 0 ? { droppedCells: [...new Set(droppedCells)] } : {}),
|
|
1204
|
+
...(draftMissingPublishedControls.length > 0
|
|
1205
|
+
? {
|
|
1206
|
+
draftMissingPublishedControls,
|
|
1207
|
+
draftShortfallNote: `草稿控件面比已发布面少 ${draftMissingPublishedControls.length} 个(${draftMissingPublishedControls.join("、")}):本次写入以草稿为基线,这些控件不会回到草稿;发布会被 form-publish-degrade 拒。恢复路径:表单版本历史 /api/api/app/bizsheet/history/list 取回完好草稿,或 form.draft {rebuild:true}。`,
|
|
1208
|
+
}
|
|
1209
|
+
: {}),
|
|
1210
|
+
...(draftMissingPublishedChildColumns.length > 0
|
|
1211
|
+
? {
|
|
1212
|
+
draftMissingPublishedChildColumns,
|
|
1213
|
+
draftChildColumnsShortfallNote: `草稿比发布面少这些子表列(${draftMissingPublishedChildColumns.map((entry) => `${entry.parent}.${entry.fieldCodes.join("/")}`).join("、")}):layout 只重排行/span、不改 Sheet201 的 columns,发布面会因此缺列(form.publish 回执会点名 childColumnsNotInForm)——要补就 form.draft {childColumns} 后重跑 publish,或从版本历史取回完好草稿。`,
|
|
1214
|
+
}
|
|
1215
|
+
: {}),
|
|
1165
1216
|
spans,
|
|
1166
1217
|
includeSystem: layout.includeSystem === true,
|
|
1167
1218
|
note: "只改 rows 分组与这些控件的 span;其它控件属性/HTML 逐键保留,未列入 rows 的控件保留基线行(锚定在被点名控件周围)",
|
|
@@ -1242,6 +1293,80 @@ export function assertPublishNotDegrading(draftAttributesJson, publishedAttribut
|
|
|
1242
1293
|
message: `草稿面控件数(${draftControls})少于已发布面(${publishedControls})——拒绝降级提拔。平台设计器 Save 会清空草稿(非无损);恢复路径是表单版本历史 /api/api/app/bizsheet/history/list 取回完好版本的 view/attributes 原文重写草稿后再发布。确要减少控件请显式传 allowDegrade:true`,
|
|
1243
1294
|
});
|
|
1244
1295
|
}
|
|
1296
|
+
/**
|
|
1297
|
+
* 探针 J P1(0.8.16):发布面「子表列缺失」诊断(只读、尽力而为)。
|
|
1298
|
+
*
|
|
1299
|
+
* 子表列不在顶层控件面也不在 viewJson:它们是父 Sheet201 控件的 `columns`
|
|
1300
|
+
* (见 childTableColumns 的注释)。子表字段已发布但父控件 columns 里没有它时,
|
|
1301
|
+
* 业务页面看不到——`field.publish` 的 formBinding 早就按此判
|
|
1302
|
+
* (src/lanes/field.ts formBindingAdvisory),`form.publish` 过去只看控件数,
|
|
1303
|
+
* 于是「历史 layout 整包覆盖了子表列」也能报 published:true。
|
|
1304
|
+
*
|
|
1305
|
+
* 判据来源与 formBindingAdvisory / insertChildColumnsIntoLayout 同源:
|
|
1306
|
+
* `field.list(isPublish=true)` 的 CHILD_TABLE 行 `subSchema.properties`。
|
|
1307
|
+
* 读不到字段面 → undefined(不做诊断,也不编造「没有缺失」)。
|
|
1308
|
+
*
|
|
1309
|
+
* 登记(未抽公共函数):`src/lanes/field.ts:2095-2102`(formBindingAdvisory)是同一
|
|
1310
|
+
* 判据的**另一份内联实现**——差别有两点且都是刻意的:① field.publish 的清单按
|
|
1311
|
+
* 「模型里有哪些子表列」判(父控件缺席时也算缺列,用于提示先绑父字段);本函数
|
|
1312
|
+
* 只看**表单里存在**的父控件(父控件缺席已由顶层控件缺失面覆盖)。② 本函数多一次
|
|
1313
|
+
* `field.list` wire,只在 publish/layout 回执里跑。两点语义差异让「一行抽取」反而
|
|
1314
|
+
* 需要参数化「父控件缺席时是否算缺列」,收益不抵改动面;若后续两处要再收敛,
|
|
1315
|
+
* 目标签名是 `childColumnsMissing(rows, attributes, {includeAbsentParents})`。
|
|
1316
|
+
*/
|
|
1317
|
+
export async function childColumnsMissingFromForm(session, args) {
|
|
1318
|
+
if (typeof args.attributesJson !== "string")
|
|
1319
|
+
return undefined;
|
|
1320
|
+
let attributes;
|
|
1321
|
+
try {
|
|
1322
|
+
const parsed = JSON.parse(args.attributesJson);
|
|
1323
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
1324
|
+
return undefined;
|
|
1325
|
+
attributes = parsed;
|
|
1326
|
+
}
|
|
1327
|
+
catch {
|
|
1328
|
+
return undefined;
|
|
1329
|
+
}
|
|
1330
|
+
let rows;
|
|
1331
|
+
try {
|
|
1332
|
+
rows = wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: args.schemaCode, isPublish: "true" } })).data);
|
|
1333
|
+
}
|
|
1334
|
+
catch {
|
|
1335
|
+
return undefined;
|
|
1336
|
+
}
|
|
1337
|
+
const missing = [];
|
|
1338
|
+
for (const row of rows) {
|
|
1339
|
+
if (Number(row.type ?? row.propertyType) !== 8)
|
|
1340
|
+
continue;
|
|
1341
|
+
const parent = String(row.code ?? row.propertyCode ?? "");
|
|
1342
|
+
const control = attributes[parent];
|
|
1343
|
+
// 父控件本身不在表单里 = 顶层控件缺失(field.publish 的 notInFormLayout),
|
|
1344
|
+
// 不是子表列问题;在这里点名会误导成「绑 childColumns 就好」。
|
|
1345
|
+
if (control === undefined || control === null || typeof control !== "object")
|
|
1346
|
+
continue;
|
|
1347
|
+
const columns = Array.isArray(control.columns) ? control.columns : [];
|
|
1348
|
+
const bound = new Set(columns.map((column) => String(column.key ?? "")).filter((key) => key.length > 0));
|
|
1349
|
+
const absent = childColumnsOf(row.subSchema)
|
|
1350
|
+
.filter((column) => column.system !== true)
|
|
1351
|
+
.map((column) => column.code)
|
|
1352
|
+
.filter((code) => !bound.has(code));
|
|
1353
|
+
if (absent.length > 0)
|
|
1354
|
+
missing.push({ parent, fieldCodes: absent });
|
|
1355
|
+
}
|
|
1356
|
+
return missing;
|
|
1357
|
+
}
|
|
1358
|
+
/** 发布面缺子表列时的一句诊断(write 与 dry-run 同一句)。 */
|
|
1359
|
+
export const CHILD_COLUMNS_NOT_IN_FORM_NOTE = "子表字段已发布,但表单 Sheet201 控件的 columns 里没有它——业务页面看不到(发布照常成功,不等于可见)。用 configure_form 的 childColumns 增量绑定(不动其它控件/布局)后重跑发布";
|
|
1360
|
+
/** 发布面缺子表列时的回执片段(写路径 / already-published 短路 / dry-run 共用一份形状)。 */
|
|
1361
|
+
function childColumnsGapReadback(gaps, schemaCode, sheetCode) {
|
|
1362
|
+
if (gaps === undefined || gaps.length === 0)
|
|
1363
|
+
return {};
|
|
1364
|
+
return {
|
|
1365
|
+
childColumnsNotInForm: gaps,
|
|
1366
|
+
childColumnsNote: CHILD_COLUMNS_NOT_IN_FORM_NOTE,
|
|
1367
|
+
nextCommand: `omc call configure_form --args '${JSON.stringify({ schemaCode, ...(sheetCode !== schemaCode ? { sheetCode } : {}), childColumns: gaps })}'`,
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1245
1370
|
/**
|
|
1246
1371
|
* `form.publish --dry-run` 的只读预览:不建草稿、不提拔,只回答两件事——
|
|
1247
1372
|
* ① 当前草稿会不会被降级门拒(与真写同一函数);② 这次发布是否真的会改东西。
|
|
@@ -1265,18 +1390,37 @@ export async function lintFormPublishReadOnly(session, args) {
|
|
|
1265
1390
|
if (!hasDraft)
|
|
1266
1391
|
return { wouldChange: true, sheetPresent: true, draftPresent: false, publishedControlCount: publishedControls, note: "当前无草稿:真写会先按已发布字段造草稿再提拔(预览不建草稿)" };
|
|
1267
1392
|
assertPublishNotDegrading(sheet.draftAttributesJson, sheet.publishedAttributesJson, { schemaCode: args.schemaCode, sheetCode, ...(args.allowDegrade !== undefined ? { allowDegrade: args.allowDegrade } : {}) });
|
|
1393
|
+
// 提拔是逐字复制草稿 → 发布面,所以「发布面缺子表列」=「草稿面缺子表列」,
|
|
1394
|
+
// 预览用草稿面算同一份清单(真写用发布后的回读面复核)。
|
|
1395
|
+
const childColumnGaps = await childColumnsMissingFromForm(session, { schemaCode: args.schemaCode, attributesJson: sheet.draftAttributesJson });
|
|
1396
|
+
const willBindChildColumns = args.bindNewChildColumns === true && (childColumnGaps?.length ?? 0) > 0;
|
|
1268
1397
|
const draftEqualsPublished = sheet.draftViewJson === sheet.publishedViewJson &&
|
|
1269
1398
|
sheet.draftAttributesJson === sheet.publishedAttributesJson &&
|
|
1270
1399
|
(sheet.draftHtmlJson === undefined || sheet.draftHtmlJson === sheet.publishedHtmlJson);
|
|
1400
|
+
const alreadyPublished = sheet.published === true && draftEqualsPublished && !willBindChildColumns;
|
|
1271
1401
|
return {
|
|
1272
|
-
wouldChange: !(sheet.published === true && draftEqualsPublished && args.force !== true),
|
|
1402
|
+
wouldChange: willBindChildColumns || !(sheet.published === true && draftEqualsPublished && args.force !== true),
|
|
1273
1403
|
sheetPresent: true,
|
|
1274
1404
|
draftPresent: true,
|
|
1275
1405
|
draftControlCount: controlCount(sheet.draftAttributesJson),
|
|
1276
1406
|
publishedControlCount: publishedControls,
|
|
1277
1407
|
draftEqualsPublished,
|
|
1278
|
-
alreadyPublished
|
|
1279
|
-
|
|
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
|
+
: {}),
|
|
1420
|
+
...childColumnsGapReadback(childColumnGaps, args.schemaCode, sheetCode),
|
|
1421
|
+
note: willBindChildColumns
|
|
1422
|
+
? "降级门与真写同一函数;bindNewChildColumns 会先增量绑定这些子表列,因此真写不会短路(会改发布面)"
|
|
1423
|
+
: "降级门与真写同一函数;alreadyPublished:true 时真写会短路(不改发布面)",
|
|
1280
1424
|
};
|
|
1281
1425
|
}
|
|
1282
1426
|
/** A3 (issue 2026-11-25): the non-layout args that make a no-layout write an explicit, bounded intent. */
|
|
@@ -1821,9 +1965,10 @@ export async function executeFormDraftWrite(session, args) {
|
|
|
1821
1965
|
if (args.draftHtmlJson !== undefined) {
|
|
1822
1966
|
assertHtmlRender(args.draftHtmlJson, { schemaCode: args.schemaCode, sheetCode: args.sheetCode, face: "draftHtmlJson" });
|
|
1823
1967
|
}
|
|
1824
|
-
//
|
|
1825
|
-
//
|
|
1826
|
-
//
|
|
1968
|
+
// 增量布局面:以草稿(空/与发布面逐字相同则已发布)控件面为基线组合出完整
|
|
1969
|
+
// viewJson/attributesJson。组合失败(无基线/未知控件/系统控件/span 不自洽)就在
|
|
1970
|
+
// 任何 wire 之前拒;dry-run 走同一个 composeFormLayoutDraft(见 form.draft 的
|
|
1971
|
+
// writeLint),两边答案逐字相同。
|
|
1827
1972
|
let layoutReceipt;
|
|
1828
1973
|
let composedLayoutWarnings = [];
|
|
1829
1974
|
if (layoutRequest !== undefined) {
|
|
@@ -2375,6 +2520,12 @@ export async function executeFormPublishWrite(session, args) {
|
|
|
2375
2520
|
await executeFormDraftWrite(session, { schemaCode: args.schemaCode, sheetCode: args.sheetCode });
|
|
2376
2521
|
pre = await readFormOrNull(session, args.schemaCode, args.sheetCode);
|
|
2377
2522
|
}
|
|
2523
|
+
// F5(探针 K,0.8.17):两次写回执各给一条 childColumnsNotInForm 同义警告 +
|
|
2524
|
+
// 同一条 configure_form 命令。bindNewChildColumns:true 把「绑定 + 发布」收成
|
|
2525
|
+
// 一次调用(增量改草稿,不动其它控件/布局);默认 false 仍只告警。
|
|
2526
|
+
//
|
|
2527
|
+
// P2(复核驳回):绑定是**写**,必须排在 HTML/降级门之后——拒绝 = 零写入。
|
|
2528
|
+
// 所以先只读算缺列(决定是否会短路),过完门再真正写草稿。
|
|
2378
2529
|
if (!pre)
|
|
2379
2530
|
throw new WireError("business", `form ${args.sheetCode} not found`, 302024);
|
|
2380
2531
|
if (pre.draftHtmlJson !== "[]")
|
|
@@ -2394,27 +2545,55 @@ export async function executeFormPublishWrite(session, args) {
|
|
|
2394
2545
|
const draftEqualsPublished = typeof pre.draftViewJson === "string" && pre.draftViewJson === pre.publishedViewJson &&
|
|
2395
2546
|
typeof pre.draftAttributesJson === "string" && pre.draftAttributesJson === pre.publishedAttributesJson &&
|
|
2396
2547
|
(pre.draftHtmlJson === undefined || pre.draftHtmlJson === pre.publishedHtmlJson);
|
|
2397
|
-
|
|
2398
|
-
|
|
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) {
|
|
2553
|
+
// 短路也是回执:已发布 ≠ 页面可见。历史 layout 覆盖掉的子表列要在这里点名,
|
|
2554
|
+
// 否则重跑 form.publish 会得到「published:true」的假确认。
|
|
2555
|
+
const publishedGaps = await childColumnsMissingFromForm(session, { schemaCode: args.schemaCode, attributesJson: pre.publishedAttributesJson });
|
|
2556
|
+
return {
|
|
2557
|
+
performed: { skipped: "already-published" },
|
|
2558
|
+
readback: {
|
|
2559
|
+
published: true,
|
|
2560
|
+
draftMatchesPublished: true,
|
|
2561
|
+
...(args.bindNewChildColumns === true
|
|
2562
|
+
? { bindChildColumnsNote: pendingChildColumns === undefined ? "无法核对(field.list 读失败),未执行绑定" : "没有待绑定的子表列" }
|
|
2563
|
+
: {}),
|
|
2564
|
+
...childColumnsGapReadback(publishedGaps, args.schemaCode, args.sheetCode),
|
|
2565
|
+
},
|
|
2566
|
+
};
|
|
2567
|
+
}
|
|
2399
2568
|
if (!hasDraft(pre))
|
|
2400
2569
|
throw new WireError("business", "form publish requires a saved draft (draftViewJson/draftAttributesJson)", 302020);
|
|
2401
|
-
if (pre.draftHtmlJson !== "[]")
|
|
2402
|
-
assertHtmlRender(pre.draftHtmlJson, { schemaCode: args.schemaCode, sheetCode: args.sheetCode, face: "draftHtmlJson" });
|
|
2403
2570
|
// Ticket 74 — degrade guard: refuse to promote a draft that carries FEWER
|
|
2404
2571
|
// controls than the already-published face. The platform designer's Save
|
|
2405
2572
|
// clears the draft faces to "[]"/"{}" (non-lossless); promoting that empty
|
|
2406
2573
|
// draft is exactly how the 13-control loss happened. Escape: allowDegrade:true.
|
|
2574
|
+
// 必须在 bind 之前:否则「绑定写草稿 → 降级门拒绝」留下半截写入。
|
|
2407
2575
|
assertPublishNotDegrading(pre.draftAttributesJson, pre.publishedAttributesJson, { schemaCode: args.schemaCode, sheetCode: args.sheetCode, ...(args.allowDegrade !== undefined ? { allowDegrade: args.allowDegrade } : {}) });
|
|
2408
2576
|
// Buttons ride `options.customButtonJson`; the platform converts them into
|
|
2409
2577
|
// h_biz_button(triggerType=FORM) rows during THIS publish call
|
|
2410
2578
|
// (ModelManagementFacadeImpl.publishBizForm:1022). Passing them here is the
|
|
2411
2579
|
// only way to create form buttons without the designer.
|
|
2580
|
+
//
|
|
2581
|
+
// 按钮语法/语义校验(validateFormButtons / 互斥 / 未知 buttonScripts)是纯本地
|
|
2582
|
+
// 拒绝,且不依赖 childColumns 绑定结果——必须在**绑定写之前**跑完:否则
|
|
2583
|
+
// `bindNewChildColumns + 非法 buttons` 会先写草稿再拒(拒绝 ≠ 零写入)。
|
|
2412
2584
|
const mergedOptions = mergeFormOptionsWithButtons(pre.options, { buttons: args.buttons, customButtonJson: args.customButtonJson, buttonsMode: args.buttonsMode, removeButtonCodes: args.removeButtonCodes, buttonScripts: args.buttonScripts }, "form.publish");
|
|
2413
2585
|
// 2.1.5 设计器发布时恒清空 options.dataItemTypeChangeList(edit-property.ts:199-203)。
|
|
2414
2586
|
// 清空必须作用在**最终** options 上:按钮合并优先(mergedOptions 是字符串),
|
|
2415
2587
|
// 没有按钮增量时才回落到 pre.options;键不存在则原样透传,不新增。
|
|
2416
2588
|
const pendingCleared = clearPendingTypeChangeList(mergedOptions ?? pre.options);
|
|
2417
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
|
+
}
|
|
2418
2597
|
const payload = {
|
|
2419
2598
|
...pre,
|
|
2420
2599
|
...(finalOptions !== undefined ? { options: finalOptions } : {}),
|
|
@@ -2439,11 +2618,26 @@ export async function executeFormPublishWrite(session, args) {
|
|
|
2439
2618
|
const readback = await wireCall(session, { path: ENDPOINTS.sheetGet, query: { schemaCode: args.schemaCode, sheetCode: args.sheetCode } });
|
|
2440
2619
|
const sheet = (readback.data ?? {});
|
|
2441
2620
|
const formButtons = readFormButtons(sheet.options);
|
|
2621
|
+
// 探针 J P1(0.8.16):发布成功 ≠ 页面可见。子表列不在顶层控件面/viewJson,
|
|
2622
|
+
// 只在父 Sheet201 控件的 columns 里;历史 layout 覆盖掉的列、或子表字段新发布
|
|
2623
|
+
// 而没绑进表单时,这里逐条点名(读不到字段面则不诊断)。
|
|
2624
|
+
const childColumnGaps = await childColumnsMissingFromForm(session, { schemaCode: args.schemaCode, attributesJson: sheet.publishedAttributesJson });
|
|
2442
2625
|
return {
|
|
2443
|
-
performed: {
|
|
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
|
+
},
|
|
2444
2632
|
readback: {
|
|
2445
2633
|
published: sheet.published === true,
|
|
2446
2634
|
publishedHtmlJsonPresent: typeof sheet.publishedHtmlJson === "string",
|
|
2635
|
+
...(boundChildColumns.length > 0
|
|
2636
|
+
? { boundChildColumns, boundChildColumnsNote: "发布前已把这些子表列增量绑进草稿(只追加列,不动其它控件/布局),因此本次发布面不再缺列" }
|
|
2637
|
+
: args.bindNewChildColumns === true
|
|
2638
|
+
? { bindChildColumnsNote: pendingChildColumns === undefined ? "无法核对(field.list 读失败),未执行绑定" : "没有待绑定的子表列" }
|
|
2639
|
+
: {}),
|
|
2640
|
+
...childColumnsGapReadback(childColumnGaps, args.schemaCode, args.sheetCode),
|
|
2447
2641
|
...(formButtons !== null
|
|
2448
2642
|
? {
|
|
2449
2643
|
formButtons,
|
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: [{
|
|
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:
|
|
809
|
+
next: hybrid
|
|
810
|
+
? [...intentLifecycle, ...routeFirstCommands.filter((command) => !intentLifecycle.includes(command))]
|
|
811
|
+
: intentLifecycle,
|
|
791
812
|
};
|
|
792
813
|
}
|
|
793
814
|
const match = route.match;
|