@stalfh233/omc-cli 0.8.35 → 0.8.37
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/approval-flow.js +1 -1
- package/dist/cli.js +12 -0
- package/dist/endpoints.js +16 -0
- package/dist/form-support.js +692 -13
- package/dist/lanes/app.js +47 -6
- package/dist/lanes/businessrule.js +167 -51
- package/dist/lanes/form-contract.js +3 -3
- package/dist/lanes/form.js +47 -14
- package/dist/lanes/rule-lifecycle-contract.js +5 -4
- package/dist/lanes/rule-lifecycle.js +136 -3
- package/dist/lanes/runtime-data/date-format.js +47 -0
- package/dist/lanes/runtime-data/field-options.js +58 -0
- package/dist/lanes/runtime-data/record-write.js +47 -6
- package/dist/lanes/runtime-data/shapes.js +23 -0
- package/dist/lanes/runtime-data/submission.js +277 -66
- package/dist/lanes/runtime-data/write-support.js +237 -46
- package/dist/lanes/workflow/template-fetch.js +94 -11
- package/dist/lanes/workflow/template-read.js +30 -11
- package/dist/lanes/workflow-contract.js +1 -1
- package/dist/model-purge.js +62 -26
- package/dist/plan.js +63 -5
- package/dist/read-projection.js +59 -0
- package/dist/read-shapes.js +8 -6
- package/dist/read.js +12 -2
- package/dist/recipes/field.js +7 -3
- package/dist/recipes/form.js +51 -1
- package/dist/recipes/runtime-data.js +5 -4
- package/dist/runtime-support.js +98 -20
- package/dist/search-index.js +4 -0
- package/dist/tools.js +18 -0
- package/dist/wire.js +119 -11
- package/dist/write-outcome.js +14 -0
- package/dist/write.js +66 -5
- package/package.json +3 -3
- package/skills/omc-business-configuration.md +7 -6
- package/skills/omc-capabilities.md +1 -0
package/dist/lanes/app.js
CHANGED
|
@@ -288,6 +288,22 @@ function appRollbackSpec(toolName) {
|
|
|
288
288
|
function isFallbackGroup(group) {
|
|
289
289
|
return String(group?.code ?? "").toLowerCase() === "all";
|
|
290
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* issue #65:`app.list` 的内联投影只回 20 条,且外置档没有「怎么取全」的指路。
|
|
293
|
+
*
|
|
294
|
+
* 平台端点没有分页参数:`GET /api/app/apppackage/list` 一次返回该用户可见的
|
|
295
|
+
* **全部**应用(8.6.26 `AppPackageController.list:725-738`,只接 `getUserId()`,
|
|
296
|
+
* 无 Pageable;`list_all` 也是全量)。所以「全量」不是服务端翻页,而是
|
|
297
|
+
* **客户端内联上限**:`all:true` 抬到 500 条,仍超出时用 offset 续取。
|
|
298
|
+
* `applicationsCount` 始终是租户全集条数,截断多少由 `omittedCount` 说明。
|
|
299
|
+
*/
|
|
300
|
+
const APP_LIST_INLINE_LIMIT = 20;
|
|
301
|
+
const APP_LIST_ALL_LIMIT = 500;
|
|
302
|
+
/** 回执里的可复制命令:环境名安全时用真名,否则用 `<env>` 占位。 */
|
|
303
|
+
function appListNextCommand(args, next) {
|
|
304
|
+
const environment = typeof args.environment === "string" && /^[^\s'"]+$/.test(args.environment) ? args.environment : "<env>";
|
|
305
|
+
return `omc call app.list --env ${environment} --args '${JSON.stringify(next)}'`;
|
|
306
|
+
}
|
|
291
307
|
export function registerAppLane(tools) {
|
|
292
308
|
tools.push(defineTool({
|
|
293
309
|
name: "app.list",
|
|
@@ -297,7 +313,13 @@ export function registerAppLane(tools) {
|
|
|
297
313
|
lane: APP_LANE,
|
|
298
314
|
scope: APP_TOOLS["app.list"].scope,
|
|
299
315
|
description: APP_TOOLS["app.list"].description,
|
|
300
|
-
inputSchema: {
|
|
316
|
+
inputSchema: {
|
|
317
|
+
environment: environmentArg,
|
|
318
|
+
capability: capabilityArg,
|
|
319
|
+
all: z.boolean().optional().describe("true = 内联整个清单(客户端上限 500;平台无分页,一次全量)。默认档仍只回 20 条;超出给 omittedCount+nextCommand"),
|
|
320
|
+
limit: z.number().int().min(1).max(APP_LIST_ALL_LIMIT).optional().describe("内联条数 1..500(默认 20;all:true 默认 500),不是平台分页"),
|
|
321
|
+
offset: z.number().int().min(0).optional().describe("内联起点(默认 0),配合 limit 翻页;applicationsCount 仍是全集"),
|
|
322
|
+
},
|
|
301
323
|
handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
|
|
302
324
|
const rows = wireRows((await wireCall(session, { path: ENDPOINTS.applicationList, query: {} })).data);
|
|
303
325
|
// B3(0.8.4 真机):旧实现是 `Promise.all` **无界**扇出——每个应用一条
|
|
@@ -340,16 +362,35 @@ export function registerAppLane(tools) {
|
|
|
340
362
|
: {}),
|
|
341
363
|
};
|
|
342
364
|
}, {
|
|
343
|
-
|
|
344
|
-
|
|
365
|
+
// issue #65:调用参数现在会改变回执(all/limit/offset),读回缓存键必须跟着变,
|
|
366
|
+
// 否则同一环境先跑默认档再跑 all:true 会命中 `unchanged:true` 拿到旧的 20 条。
|
|
367
|
+
// 无参数时键仍是旧的 "app.list"(产物哈希/黄金样本不动)。
|
|
368
|
+
target: `app.list${args.all === true ? ":all" : ""}${args.limit !== undefined ? `:limit=${args.limit}` : ""}${args.offset !== undefined ? `:offset=${args.offset}` : ""}`,
|
|
369
|
+
compact: (result, _session, args) => {
|
|
345
370
|
const apps = Array.isArray(result.applications) ? result.applications : [];
|
|
371
|
+
const offset = typeof args.offset === "number" ? args.offset : 0;
|
|
372
|
+
const limit = typeof args.limit === "number" ? args.limit : args.all === true ? APP_LIST_ALL_LIMIT : APP_LIST_INLINE_LIMIT;
|
|
373
|
+
const page = apps.slice(offset, offset + limit);
|
|
374
|
+
const omittedCount = apps.length - page.length;
|
|
375
|
+
const hasMoreAfterPage = offset + page.length < apps.length;
|
|
376
|
+
// 还有未内联的行时给可复制的续取命令:默认档先建议 all:true;
|
|
377
|
+
// 显式 all/limit/offset 档则用 offset 续页。
|
|
378
|
+
const nextArgs = args.all === true || args.limit !== undefined || offset > 0
|
|
379
|
+
? { offset: offset + page.length, limit }
|
|
380
|
+
: { all: true };
|
|
346
381
|
return {
|
|
347
382
|
applicationsCount: apps.length,
|
|
348
|
-
omitted:
|
|
349
|
-
applications:
|
|
383
|
+
omitted: omittedCount > 0,
|
|
384
|
+
applications: page,
|
|
385
|
+
...(omittedCount > 0
|
|
386
|
+
? {
|
|
387
|
+
omittedCount,
|
|
388
|
+
...(hasMoreAfterPage ? { nextCommand: appListNextCommand(args, nextArgs) } : {}),
|
|
389
|
+
tablesHint: `applications 只内联了 ${page.length}/${apps.length} 条(omittedCount=${omittedCount});全集仍可用 --jq applications[].code 或 artifact get 取回${hasMoreAfterPage ? ",或按 nextCommand 续取" : ""}。`,
|
|
390
|
+
}
|
|
391
|
+
: {}),
|
|
350
392
|
// B3:部分失败是结论本身(哪个应用读不到),diet 不得吞掉。
|
|
351
393
|
...(result.applicationsFailed !== undefined ? { applicationsFailed: result.applicationsFailed, failed: result.failed, partial: true, hint: result.hint } : {}),
|
|
352
|
-
tablesHint: "applications 已截断内联前 20 条(omitted:true);全集在 detailArtifactId,用 --jq applications[].code 或 artifact get 取回。",
|
|
353
394
|
};
|
|
354
395
|
},
|
|
355
396
|
}),
|
|
@@ -634,6 +634,48 @@ async function readRuleBatchAcrossModels(session, args) {
|
|
|
634
634
|
};
|
|
635
635
|
return body;
|
|
636
636
|
}
|
|
637
|
+
/** 平台 DevelopmentMode:DEFAULT=0(图形编排)、CODING=1、DECISION=2(其余按非 DEFAULT 处理)。 */
|
|
638
|
+
function isDefaultDevelopmentMode(value) {
|
|
639
|
+
if (value === undefined || value === null)
|
|
640
|
+
return true;
|
|
641
|
+
if (typeof value === "number")
|
|
642
|
+
return value === 0;
|
|
643
|
+
const text = String(value).trim().toUpperCase();
|
|
644
|
+
return text === "" || text === "0" || text === "DEFAULT";
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* #77.2:与平台 `BusinessRuleTableImpl.getExecutableBySchemaCodeAndCode:83-103`
|
|
648
|
+
* 同口径——DRAFT 缺失不可执行;非 DEFAULT(CODING/DECISION)平台直接返回 DRAFT
|
|
649
|
+
* (不再看 enabled/status/PUBLISH);DEFAULT 需 DRAFT enabled=true、status 非
|
|
650
|
+
* DISABLED,且至少一条 latestPublished。
|
|
651
|
+
*/
|
|
652
|
+
function ruleExecutableOf(draft, hasPublished) {
|
|
653
|
+
if (draft === undefined)
|
|
654
|
+
return false;
|
|
655
|
+
if (!isDefaultDevelopmentMode(draft.developmentMode))
|
|
656
|
+
return true;
|
|
657
|
+
return draft.enabled === true && String(draft.status ?? "") !== "DISABLED" && hasPublished;
|
|
658
|
+
}
|
|
659
|
+
function ruleExecutableBasisOf(draft, hasPublished) {
|
|
660
|
+
if (draft === undefined)
|
|
661
|
+
return "draft-absent";
|
|
662
|
+
if (!isDefaultDevelopmentMode(draft.developmentMode))
|
|
663
|
+
return "non-default:draft-exists";
|
|
664
|
+
if (draft.enabled !== true)
|
|
665
|
+
return "default:draft-enabled=false";
|
|
666
|
+
if (String(draft.status ?? "") === "DISABLED")
|
|
667
|
+
return "default:draft-status=DISABLED";
|
|
668
|
+
if (!hasPublished)
|
|
669
|
+
return "default:no-latest-published";
|
|
670
|
+
return "default:draft-enabled+status+published";
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* #77.2:显式 withDraft 才读 app 面 DRAFT 行。该面是
|
|
674
|
+
* `BusinessRuleFacadeImpl.listViewsBySchemaCode:179-186` → `listDraftBySchemaCode`,
|
|
675
|
+
* 与 rule.get 的 id 解析同源;**DRAFT 规则数 < 7 时平台会补建 7 条预置**
|
|
676
|
+
* (同方法 `checkAndFillDefaultBusinessRule`),所以只在显式开关下触发。
|
|
677
|
+
*/
|
|
678
|
+
const RULE_WITH_DRAFT_NOTE = "withDraft 额外读 app/businessrule/list_by_schemacode(DRAFT 行,与 rule.get 同源)。注意:该面在 DRAFT 规则数 <7 时会补建 7 条预置(BusinessRuleFacadeImpl.listViewsBySchemaCode:179-186 → checkAndFillDefaultBusinessRule);显式 withDraft 才触发。executable 按 BusinessRuleTableImpl.getExecutableBySchemaCodeAndCode:83-103:DEFAULT 需 DRAFT enabled=true、status≠DISABLED 且有 latestPublished;CODING/DECISION 只要求 DRAFT 存在。";
|
|
637
679
|
/**
|
|
638
680
|
* r83:单个模型的规则清单体——单模型路径与 `schemaCodes[]` 跨模型路径共用。
|
|
639
681
|
*
|
|
@@ -682,27 +724,77 @@ async function readRuleListBody(session, schemaCode, options) {
|
|
|
682
724
|
// with full:true (the old 14-key row). rule.get resolves by business
|
|
683
725
|
// key (schemaCode+ruleCode), so the row id is rarely needed.
|
|
684
726
|
const fullRows = options.full;
|
|
685
|
-
|
|
686
|
-
|
|
727
|
+
// #77.2:显式 withDraft 才额外读 app 面 DRAFT 行(与 rule.get 同源);
|
|
728
|
+
// 默认路径零额外 wire、零新增键。DRAFT 面在规则数 <7 时会补建预置——见
|
|
729
|
+
// RULE_WITH_DRAFT_NOTE,只有显式开关才付出这个代价。
|
|
730
|
+
const draftRows = options.withDraft
|
|
731
|
+
? wireRows((await wireCall(session, { path: ENDPOINTS.businessRuleListBySchemaCode, query: { schemaCode } })).data)
|
|
732
|
+
: undefined;
|
|
733
|
+
const draftByCode = new Map();
|
|
734
|
+
for (const draft of draftRows ?? [])
|
|
735
|
+
if (typeof draft.code === "string" && draft.code !== "")
|
|
736
|
+
draftByCode.set(draft.code, draft);
|
|
737
|
+
const visiblePublished = options.onlyCustom ? rows.filter((row) => row.defaultRule !== true) : rows;
|
|
738
|
+
const statusLag = visiblePublished.some((row) => row.enabled === true && String(row.status ?? "") !== "ENABLED");
|
|
739
|
+
const publishedCodes = new Set(rows.map((row) => String(row.code ?? "")));
|
|
740
|
+
const entries = visiblePublished.map((row) => {
|
|
741
|
+
const draft = draftByCode.get(String(row.code ?? ""));
|
|
742
|
+
return draft ? { row, draft } : { row };
|
|
743
|
+
});
|
|
744
|
+
for (const draft of draftRows ?? []) {
|
|
745
|
+
const code = String(draft.code ?? "");
|
|
746
|
+
if (code === "" || publishedCodes.has(code))
|
|
747
|
+
continue;
|
|
748
|
+
if (options.onlyCustom && draft.defaultRule === true)
|
|
749
|
+
continue;
|
|
750
|
+
entries.push({ draft });
|
|
751
|
+
}
|
|
752
|
+
const visible = entries.map((entry) => entry.row).filter((row) => row !== undefined);
|
|
687
753
|
// r83:withMappings 只在显式开启时读;默认路径零额外 wire、零新增键。
|
|
688
754
|
const mappingFace = options.withMappings ? await readRuleListMappings(session, visible) : undefined;
|
|
689
|
-
const mappingOf = (
|
|
755
|
+
const mappingOf = (entry) => {
|
|
690
756
|
if (mappingFace === undefined)
|
|
691
757
|
return {};
|
|
692
|
-
|
|
758
|
+
if (entry.row === undefined)
|
|
759
|
+
return { mappingsUnavailable: true };
|
|
760
|
+
const found = mappingFace.byCode.get(typeof entry.row.code === "string" ? entry.row.code : "");
|
|
693
761
|
// 读不到 ≠ 没有映射:显式标注不可用,避免把读取失败当成空映射。
|
|
694
762
|
if (found === undefined || found === null)
|
|
695
763
|
return { mappingsUnavailable: true };
|
|
696
764
|
return { mappings: found };
|
|
697
765
|
};
|
|
766
|
+
const draftFaceOf = (entry) => {
|
|
767
|
+
const { row, draft } = entry;
|
|
768
|
+
if (row === undefined) {
|
|
769
|
+
// 无 PUBLISH 投影:enabled/status 在两个面上都读不到,保持 null(不编造)。
|
|
770
|
+
return {
|
|
771
|
+
publishEnabled: null,
|
|
772
|
+
draftEnabled: draft?.enabled === true,
|
|
773
|
+
draftStatus: draft?.status == null ? null : String(draft.status),
|
|
774
|
+
executable: ruleExecutableOf(draft, false),
|
|
775
|
+
executableBasis: ruleExecutableBasisOf(draft, false),
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
const hasPublished = row.latestPublished === true;
|
|
779
|
+
return {
|
|
780
|
+
publishEnabled: row.enabled === true,
|
|
781
|
+
draftEnabled: draft === undefined ? null : draft.enabled === true,
|
|
782
|
+
draftStatus: draft === undefined ? null : draft.status == null ? null : String(draft.status),
|
|
783
|
+
executable: ruleExecutableOf(draft, hasPublished),
|
|
784
|
+
executableBasis: ruleExecutableBasisOf(draft, hasPublished),
|
|
785
|
+
};
|
|
786
|
+
};
|
|
698
787
|
return {
|
|
699
788
|
schemaCode,
|
|
700
789
|
modelPresent: true,
|
|
701
790
|
// r83:rulesCount 在 handler 层回(此前只有 compact 投影从 rules 派生,导致
|
|
702
791
|
// schemaCodes[] 跨模型面的 models[] 元素缺该键,与 read-shapes「同形」承诺不符)。
|
|
703
|
-
rulesCount:
|
|
792
|
+
rulesCount: entries.length,
|
|
704
793
|
// r28g F18:list 投影的是 PUBLISH 行;运行时可执行性以 rule.get / rule.enable.verified 为准。
|
|
705
|
-
source: "published-list",
|
|
794
|
+
source: options.withDraft ? "published-list+draft" : "published-list",
|
|
795
|
+
...(options.withDraft
|
|
796
|
+
? { draftFace: "app/businessrule/list_by_schemacode", draftRowsCount: draftRows?.length ?? 0, draftNote: RULE_WITH_DRAFT_NOTE }
|
|
797
|
+
: {}),
|
|
706
798
|
executableHint: "rules[].enabled/status 来自 PUBLISH 投影;运行时判定读 DRAFT(rule.get 的 enabled+ruleStatus,或 rule.enable 回执的 executable/verified)。不要仅凭本面判定可 rule.run。",
|
|
707
799
|
...(statusLag
|
|
708
800
|
? {
|
|
@@ -716,49 +808,61 @@ async function readRuleListBody(session, schemaCode, options) {
|
|
|
716
808
|
// 常态化给一句短注(~90B/次),避免把本面 status 当运行时真相。
|
|
717
809
|
statusNote: "本面 status 是 PUBLISH 投影列,与 rule.get 的 ruleStatus 可不同;运行时是否生效以 rule.get/enable 为准",
|
|
718
810
|
}),
|
|
719
|
-
...(options.onlyCustom ? { filtered: { onlyCustom: true, total: rows.length, returned:
|
|
811
|
+
...(options.onlyCustom ? { filtered: { onlyCustom: true, total: rows.length + (entries.length - visiblePublished.length), returned: entries.length } } : {}),
|
|
720
812
|
// r60c-F7(真机复现):默认面把 7 条平台预置触发行一起返回——任何模型都
|
|
721
813
|
// 「有规则」,「哪些模型配了业务规则」会误判成全都有。默认面带上
|
|
722
814
|
// customCount + 一句判定口径;判定自建规则直接 onlyCustom:true。
|
|
723
815
|
...(options.onlyCustom
|
|
724
816
|
? {}
|
|
725
817
|
: {
|
|
726
|
-
customCount:
|
|
727
|
-
|
|
818
|
+
customCount: entries.filter((entry) => (entry.row?.defaultRule ?? entry.draft?.defaultRule) !== true).length,
|
|
819
|
+
// F5(探针 AA,0.8.36):2.1.5 新建模型本面 **0 行**(预置行尚未物化/
|
|
820
|
+
// 发布;8.6 建模即建)。旧文案无条件说「默认含平台预置触发行」,在 0
|
|
821
|
+
// 行面上自相矛盾,会被读成「没有触发器」。
|
|
822
|
+
presetHint: entries.length === 0
|
|
823
|
+
? "本面 0 条:平台尚未物化/发布预置行(2.1.5 新建模型为空,8.6 建模即建);不要据此判定没有触发器——用 rule.references kind:\"trigger\" 看真实触发点"
|
|
824
|
+
: "默认含平台预置触发行(preset:true,如 Available/Cancel/Create/Delete/GetList/Load/Update);判定「有没有人写过规则」看 customCount(=0 即全是预置),或直接 onlyCustom:true",
|
|
728
825
|
}),
|
|
729
826
|
...(endpointFamily ? { endpointFamily } : {}),
|
|
730
827
|
...(mappingFace
|
|
731
828
|
? { mappingsWireNote: `mappings 来自规则行 node(摘要:服务/方法/入出参计数;正文在 rule.get)${mappingFace.fallbackReads > 0 ? `;${mappingFace.fallbackReads} 条 list 行缺 node 已回落 businessrule/get(+${mappingFace.fallbackReads} wire)` : ";无回落 get"}` }
|
|
732
829
|
: {}),
|
|
733
|
-
rules:
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
830
|
+
rules: entries.map((entry) => {
|
|
831
|
+
const { row, draft } = entry;
|
|
832
|
+
const record = row ?? draft ?? {};
|
|
833
|
+
const defaultRule = row?.defaultRule ?? draft?.defaultRule;
|
|
834
|
+
return {
|
|
835
|
+
code: record.code,
|
|
836
|
+
name: record.name,
|
|
837
|
+
enabled: row === undefined ? null : row.enabled,
|
|
838
|
+
status: row === undefined ? null : row.status,
|
|
839
|
+
...(row?.enabled === true && String(row.status ?? "") !== "ENABLED" ? { statusLag: true } : {}),
|
|
840
|
+
...(record.ruleVersion !== undefined ? { ruleVersion: record.ruleVersion } : {}),
|
|
841
|
+
...(defaultRule !== undefined ? { defaultRule, preset: defaultRule === true } : {}),
|
|
842
|
+
// ticket-80's update-mode readback teaches following the same-code
|
|
843
|
+
// latestPublished row — keep the flag on the default face (5 B).
|
|
844
|
+
...(row?.latestPublished !== undefined ? { latestPublished: row.latestPublished } : {}),
|
|
845
|
+
...(options.withDraft ? draftFaceOf(entry) : {}),
|
|
846
|
+
...(options.withDraft && row === undefined ? { draftOnly: true } : {}),
|
|
847
|
+
...(fullRows
|
|
848
|
+
? {
|
|
849
|
+
id: record.id,
|
|
850
|
+
schemaCode: record.schemaCode,
|
|
851
|
+
bizRuleType: record.bizRuleType,
|
|
852
|
+
developmentMode: record.developmentMode,
|
|
853
|
+
latestPublished: record.latestPublished,
|
|
854
|
+
templateType: record.templateType,
|
|
855
|
+
createdTime: record.createdTime,
|
|
856
|
+
creator: record.creater ?? record.creator,
|
|
857
|
+
}
|
|
858
|
+
// 内部面(T02b 调度摘要):行 id 让调用方直接读 businessrule/get,
|
|
859
|
+
// 省掉逐条 `resolveRuleRowId` 的二次 list。对外读面形状不变。
|
|
860
|
+
: options.withRowIds === true && typeof record.id === "string" && record.id !== ""
|
|
861
|
+
? { id: record.id }
|
|
862
|
+
: {}),
|
|
863
|
+
...mappingOf(entry),
|
|
864
|
+
};
|
|
865
|
+
}),
|
|
762
866
|
};
|
|
763
867
|
}
|
|
764
868
|
/**
|
|
@@ -1208,9 +1312,10 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1208
1312
|
environment: environmentArg,
|
|
1209
1313
|
schemaCode: z.string().min(1),
|
|
1210
1314
|
schemaCodes: z.array(z.string()).optional().describe("跨模型清单(≤20;失败回 partial+failed)"),
|
|
1211
|
-
onlyCustom: z.boolean().optional().describe("只回自建规则(defaultRule!==true
|
|
1212
|
-
full: z.boolean().optional().describe("行内联完整字段(id/createdTime/creator
|
|
1315
|
+
onlyCustom: z.boolean().optional().describe("只回自建规则(defaultRule!==true)——读面收窄,省 token"),
|
|
1316
|
+
full: z.boolean().optional().describe("行内联完整字段(id/createdTime/creator/…)并跳过 detailFile 外置"),
|
|
1213
1317
|
withMappings: z.boolean().optional().describe("true=规则附 mappings 摘要(服务/方法/入出参计数)"),
|
|
1318
|
+
withDraft: z.boolean().optional().describe("true=额外读 DRAFT 面(app/businessrule/list_by_schemacode,+1 wire)并按 code 合并:逐行 publishEnabled/draftEnabled/draftStatus/executable/executableBasis,含禁用/未发布草稿行;规则<7 条时平台可能补建 7 条预置(回执 draftNote 披露)。默认 false 不变"),
|
|
1214
1319
|
capability: capabilityArg,
|
|
1215
1320
|
},
|
|
1216
1321
|
handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
|
|
@@ -1225,24 +1330,22 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1225
1330
|
const schemaCodes = ruleSchemaCodesOf(args.schemaCodes, "rule.list");
|
|
1226
1331
|
const models = [];
|
|
1227
1332
|
const failed = [];
|
|
1228
|
-
const options = { onlyCustom: args.onlyCustom === true, full: args.full === true, withMappings: args.withMappings === true };
|
|
1333
|
+
const options = { onlyCustom: args.onlyCustom === true, full: args.full === true, withMappings: args.withMappings === true, withDraft: args.withDraft === true };
|
|
1229
1334
|
let firstError;
|
|
1230
1335
|
let rulesCount = 0;
|
|
1231
1336
|
// r83:三句提示(executableHint/statusNote/presetHint)逐模型逐字相同,
|
|
1232
1337
|
// 跨模型面把它们抬到顶层一次(crossModelNotes),否则 3 模型就顶破 2048
|
|
1233
1338
|
// 内联上限、整面被 compact(models 退码表)。statusLag 旗标仍逐模型保留。
|
|
1339
|
+
// F5(探针 AA,0.8.36):presetHint 现在随「本面是否 0 行」而变——**只有
|
|
1340
|
+
// 所有模型都存在且内容全等才抬**;否则保留逐模型(否则 0 行模型的「0 条」
|
|
1341
|
+
// 文案会被 8.6 模型抬走的通用文案覆盖,结论错)。
|
|
1234
1342
|
const hoisted = {};
|
|
1235
|
-
const HOIST_KEYS = ["executableHint", "statusNote", "presetHint"];
|
|
1343
|
+
const HOIST_KEYS = ["executableHint", "statusNote", "presetHint", "draftNote"];
|
|
1344
|
+
const bodies = [];
|
|
1236
1345
|
for (const schemaCode of schemaCodes) {
|
|
1237
1346
|
try {
|
|
1238
1347
|
const body = await readRuleListBody(session, schemaCode, options);
|
|
1239
|
-
|
|
1240
|
-
if (body[key] !== undefined) {
|
|
1241
|
-
hoisted[key] = body[key];
|
|
1242
|
-
delete body[key];
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
models.push(body);
|
|
1348
|
+
bodies.push(body);
|
|
1246
1349
|
rulesCount += Array.isArray(body.rules) ? body.rules.length : 0;
|
|
1247
1350
|
}
|
|
1248
1351
|
catch (error) {
|
|
@@ -1250,6 +1353,19 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1250
1353
|
failed.push({ schemaCode, code: null, message: error.message });
|
|
1251
1354
|
}
|
|
1252
1355
|
}
|
|
1356
|
+
if (bodies.length > 0) {
|
|
1357
|
+
for (const key of HOIST_KEYS) {
|
|
1358
|
+
if (!bodies.every((body) => body[key] !== undefined))
|
|
1359
|
+
continue;
|
|
1360
|
+
const first = JSON.stringify(bodies[0][key]);
|
|
1361
|
+
if (!bodies.every((body) => JSON.stringify(body[key]) === first))
|
|
1362
|
+
continue;
|
|
1363
|
+
hoisted[key] = bodies[0][key];
|
|
1364
|
+
for (const body of bodies)
|
|
1365
|
+
delete body[key];
|
|
1366
|
+
}
|
|
1367
|
+
models.push(...bodies);
|
|
1368
|
+
}
|
|
1253
1369
|
// 全部模型都读失败 → 上抛首个错误:auth/网络问题不能被读成「部分成功」。
|
|
1254
1370
|
if (models.length === 0 && firstError !== undefined)
|
|
1255
1371
|
throw firstError;
|
|
@@ -1267,7 +1383,7 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1267
1383
|
}
|
|
1268
1384
|
if (singleSchemaCode === undefined)
|
|
1269
1385
|
throw new ToolInputError({ status: "error", blocker: "tool-input-invalid", tool: "rule.list", message: "需要 schemaCode(单个模型)或 schemaCodes(跨模型清单)" });
|
|
1270
|
-
return readRuleListBody(session, singleSchemaCode, { onlyCustom: args.onlyCustom === true, full: args.full === true, withMappings: args.withMappings === true });
|
|
1386
|
+
return readRuleListBody(session, singleSchemaCode, { onlyCustom: args.onlyCustom === true, full: args.full === true, withMappings: args.withMappings === true, withDraft: args.withDraft === true });
|
|
1271
1387
|
}, { full: args.full === true, target: `rule.list:${args.schemaCodes !== undefined ? `schemaCodes:${args.schemaCodes.join(",")}` : args.schemaCode}` }),
|
|
1272
1388
|
}));
|
|
1273
1389
|
tools.push(defineTool({
|
|
@@ -1441,7 +1557,7 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1441
1557
|
scanned: { models: scoped.length, workflows: scannedWorkflows, withoutWorkflow, ...(readFailures > 0 ? { readFailures } : {}) },
|
|
1442
1558
|
matches: ruleHits,
|
|
1443
1559
|
wire: {
|
|
1444
|
-
plan: "1 模型清单 + 每模型
|
|
1560
|
+
plan: "1 模型清单 + 每模型 workflow/list(header 含草稿/多流程)→ 有流程再 get_published",
|
|
1445
1561
|
concurrency: scan.stats,
|
|
1446
1562
|
},
|
|
1447
1563
|
coverage: {
|
|
@@ -19,9 +19,9 @@ export const FORM_WIRE = Object.freeze({
|
|
|
19
19
|
actionsColumns: "ticket 100: draftActionsJson/publishedActionsJson are REAL bizsheet columns (BizForm.java:95-100 @SerializableField; BizFormModel.java:59-62 serialized by bizsheet/get) — the designer writes draftActionsJson on save and both faces on publish (frontend-dist/admin/js/4280.cfa75764.js offsets 193538/185347); form.get full:true surfaces them; publish promotes draftActionsJson → publishedActionsJson",
|
|
20
20
|
sheetListFace: "form.list: GET /api/api/app/bizsheet/list?schemaCode= (BizFormController.java:137-152 → ModelManagementFacadeImpl.getBizForms:481-488) answers the BizFormHeaderModel HEADER projection only — code, name, schemaCode, published, formType, sortKey, icon. formType is the INTEGER index (@JsonValue getIndex(), BizFormType.java:45-48): 0 DEFAULT_SHEET / 1 CUSTOMIZE_SHEET / 2 PRINT_TEMPLATE — decoded to the name with formTypeIndex kept (ADR 0002). existDraft/buttonCount/hasCustomScript are NOT on this face, so the default read never fabricates them: detail:true pays 1+N bizsheet/get for the content-derived faces. published is the same platform flag bit (r79-04): publish→draft leaves it false while the content is intact — the flag is reported as-is, content judgement needs detail:true. HTTP 404 means the version family has no /list endpoint: the tool answers sheetListUnavailable:true + the default slot only, never a fabricated list; a 601003 业务模型不存在 refusal is modelPresent:false (zero retries)",
|
|
21
21
|
});
|
|
22
|
-
const FORM_GET_DESCRIPTION = '读取默认表单(bizsheet/get)的发布状态与控件清单(紧凑默认)。**`published`/`existDraft` 是内容面结论**(`published:true`=已发布;`published:false,existDraft:true`=只有草稿,**未发布**);平台 `bizsheet/get` 标记位见 `platformFlags`。`form.list` 的 `published` 仍为平台旗标,两者语义不同。不要用 `publishedControlCodes` 是否非空来推断(草稿字段会让它非空,误判为已发布)。**每个模型交付前其默认表单必须 `published:true`**:用 `configure_form` 或 `form.draft(rebuild:true)`+`form.publish` 发布,并逐模型 `form.get` 核对。`full:true` 还返回 `options` 与 `customButtonJson
|
|
23
|
-
const FORM_DRAFT_DESCRIPTION = "Save the default-form DRAFT (bizsheet/update). Reads the current sheet, merges the caller's explicit draftViewJson/draftAttributesJson (or preserves the existing draft); when both are absent on a fresh default form, composes the designer-standard scaffold from the model's published fields. A redundant field (relation-mapping carry-through target) always stays bound; with no workflow it is hidden in the design (options.visible=false), with a workflow it stays visible for per-node propertyPermissions. Pass `draftHtmlJson` to thread custom online-script HTML through. Empty-layout guard: explicitly passing \"[]\"/\"{}\" view/attributes is refused (form-empty-layout) — the platform designer's Save is NOT lossless and clears drafts to exactly that shape; escape with allowEmptyLayout:true, and recover cleared drafts from the form version history (/api/api/app/bizsheet/history/list). **读回原样回写**:从 `form.get` 取回的 view/attributes 直接回传时加 `fromReadback:true`——工具会与已存草稿/发布面逐字比对,一致才放行(平台自身布局可能含子表列行/系统行默认宽度),被改动过的面照常按 validation 拒绝。**表单工具栏按钮**:`buttons`(数组)或 `customButtonJson`(原样字符串)写进 `biz_sheet.options.customButtonJson`(**数组+actionConfig
|
|
24
|
-
const FORM_PUBLISH_DESCRIPTION = "Publish the default form (bizsheet/publish, proven shape: draft*Json promoted to published*Json verbatim) with published-face readback. **不影响在线 JS**:本工具只提拔布局草稿;改 JS 请用 onlinejs.compose(它自己会连同整张表单一起发布,不必再调本工具)。 Degrade guard: refuses to promote a draft carrying FEWER controls than the published face (form-publish-degrade) — the designer's Save clears drafts non-losslessly; recover via the form version history (/api/api/app/bizsheet/history/list) and rewrite the draft first, or pass allowDegrade:true to force the reduction. rebuild:true is the one-call refresh: discard the existing draft, re-scaffold from the published fields (non-structural control options preserved), then force-promote — use it after a field shape change. **表单工具栏按钮**:传 `buttons`(或 `customButtonJson`)→ 写进 `options.customButtonJson` 并在本次 publish 生成 `h_biz_button(triggerType=FORM, triggerCode=<formCode>)`(平台 `publishBizForm:1022`);`options.customButtonJson` 以**数组**写入(条目 `actionConfig` 为对象,设计器同形——线上 #38:字符串形=双重编码,前端按钮不渲染,回执给 formButtonsShapeWarning);表单页是否显示再由流程节点 `buttonPermission.customBtns[].enabled` 过滤。";
|
|
22
|
+
const FORM_GET_DESCRIPTION = '读取默认表单(bizsheet/get)的发布状态与控件清单(紧凑默认)。**`published`/`existDraft` 是内容面结论**(`published:true`=已发布;`published:false,existDraft:true`=只有草稿,**未发布**);平台 `bizsheet/get` 标记位见 `platformFlags`。`form.list` 的 `published` 仍为平台旗标,两者语义不同。不要用 `publishedControlCodes` 是否非空来推断(草稿字段会让它非空,误判为已发布)。**每个模型交付前其默认表单必须 `published:true`**:用 `configure_form` 或 `form.draft(rebuild:true)`+`form.publish` 发布,并逐模型 `form.get` 核对。`full:true` 还返回 `options` 与 `customButtonJson`(表单工具栏按钮,数组原样;字符串脏形附 `customButtonJsonShapeWarning`——#38 前端不渲染)。传 `controls:["code",…]` 只取指定控件的 options(如关联控件的 mappings);传 `full:true` 才返回 draft/published 的完整 view/attributes/html/actions JSON(actions 列为设计器保存/发布的表单级按钮动作)。体积大,仅在需要整体布局时用。非字段控件(200/202/203)见 `decorations`(2.1.5 验存储/发布/读回;门户渲染未验,需 8.1.108/真页采样)。';
|
|
23
|
+
const FORM_DRAFT_DESCRIPTION = "Save the default-form DRAFT (bizsheet/update). Reads the current sheet, merges the caller's explicit draftViewJson/draftAttributesJson (or preserves the existing draft); when both are absent on a fresh default form, composes the designer-standard scaffold from the model's published fields. A redundant field (relation-mapping carry-through target) always stays bound; with no workflow it is hidden in the design (options.visible=false), with a workflow it stays visible for per-node propertyPermissions. Pass `draftHtmlJson` to thread custom online-script HTML through. Empty-layout guard: explicitly passing \"[]\"/\"{}\" view/attributes is refused (form-empty-layout) — the platform designer's Save is NOT lossless and clears drafts to exactly that shape; escape with allowEmptyLayout:true, and recover cleared drafts from the form version history (/api/api/app/bizsheet/history/list). **读回原样回写**:从 `form.get` 取回的 view/attributes 直接回传时加 `fromReadback:true`——工具会与已存草稿/发布面逐字比对,一致才放行(平台自身布局可能含子表列行/系统行默认宽度),被改动过的面照常按 validation 拒绝。**表单工具栏按钮**:`buttons`(数组)或 `customButtonJson`(原样字符串)写进 `biz_sheet.options.customButtonJson`(**数组+actionConfig 对象**;字符串形=双重编码,前端按钮不渲染);`h_biz_button(triggerType=FORM)` 要到 form.publish 才生成,表单页显示还看流程节点 `buttonPermission.customBtns[].enabled`。`useLocation` 用 FORM/ROW/LIST。字段发布后如需刷新已发布表单的控件映射,用本工具 rebuild:false 重存(保留现有布局与在线JS)再 form.publish。**改既有表单勿整表重写**:先 `form.get full:true` 取 `publishedAttributesJson` 作基线、只改 rows/span;只写业务字段会丢系统控件并撞 form-publish-degrade。**描述块/分组标题**(控件 200/202/203,非字段)用 `decorations` 增量加(202 的 `html` 写 options.name;2.1.5 验存储/发布/读回;门户渲染未验,需 8.1.108/真页采样);rebuild 保留 202 描述块,额外 200/203 实例 fail-closed 列 `losing`。";
|
|
24
|
+
const FORM_PUBLISH_DESCRIPTION = "Publish the default form (bizsheet/publish, proven shape: draft*Json promoted to published*Json verbatim) with published-face readback. **不影响在线 JS**:本工具只提拔布局草稿;改 JS 请用 onlinejs.compose(它自己会连同整张表单一起发布,不必再调本工具)。 Degrade guard: refuses to promote a draft carrying FEWER controls than the published face (form-publish-degrade) — the designer's Save clears drafts non-losslessly; recover via the form version history (/api/api/app/bizsheet/history/list) and rewrite the draft first, or pass allowDegrade:true to force the reduction. rebuild:true is the one-call refresh: discard the existing draft, re-scaffold from the published fields (non-structural control options preserved; 202 描述块原样保留,额外 200/203 实例 fail-closed 列于 losing), then force-promote — use it after a field shape change. **表单工具栏按钮**:传 `buttons`(或 `customButtonJson`)→ 写进 `options.customButtonJson` 并在本次 publish 生成 `h_biz_button(triggerType=FORM, triggerCode=<formCode>)`(平台 `publishBizForm:1022`);`options.customButtonJson` 以**数组**写入(条目 `actionConfig` 为对象,设计器同形——线上 #38:字符串形=双重编码,前端按钮不渲染,回执给 formButtonsShapeWarning);表单页是否显示再由流程节点 `buttonPermission.customBtns[].enabled` 过滤。";
|
|
25
25
|
const FORM_RUN_BUTTON_DESCRIPTION = "执行表单工具栏按钮(平台同款面:`POST /api/api/runtime/form/executeCustomButton`,body `{bizButtonModel, bizObjectList:[<完整业务对象>], reacquireDataFromDb:true}`)。**与列表行按钮不同**:列表按钮发 `launcher/domain_service_runtime/<schema>/<rule>` + `ids[]`(用 `rule.run`),表单按钮带**整条记录**,不能互换。按钮来源 `GET /api/api/system/getCustomButtons`(只列 triggerType=FORM 的 h_biz_button)。前提:按钮已由 `form.publish` 的 `buttons`/`customButtonJson` 生成。返回是执行结果信封,规则副作用用 `data.load` 另读;被规则 UPDATE 的目标行须是 COMPLETED(引擎查不到 DRAFT)。`302045` = 数据被占用。**`10005` 换等价面 `rule.run`(见 contract form),勿反复重试。**";
|
|
26
26
|
const CONFIGURE_FORM_DESCRIPTION = "High-level: bind fields into the default form and publish it (form.draft → form.publish), subject to the write permission gate. Delegates to the proven form.draft scaffold + form.publish paths so the real empty-form layout (and any caller-supplied draftHtmlJson) is persisted and promoted — never bypasses with a shortcut body. `sheetCode` is optional: omitted means the model's default sheet (sheetCode = schemaCode).";
|
|
27
27
|
const FORM_LIST_DESCRIPTION = "列出模型的多张表单(`/api/api/app/bizsheet/list?schemaCode=`,header-only 投影):每行 `sheetCode`/`name`/`formType`(整数索引解码为名字,另带 formTypeIndex)/`published`。默认只发 1 次 wire;`detail:true` 才逐面 `bizsheet/get`(上限 maxSheets=12,超出回 partial+omittedSheets)补 existDraft/controlCount/buttonCount/publishedActionCount/hasCustomScript/faces。**默认面不伪造这些内容推导键,也不改旗标**:`published` 是平台旗标位(publish→draft 后它为 false 而内容俱在),判「有没有发布面内容」用 detail:true 的 faces。业务模型不存在 → modelPresent:false;该版本族无 /list 端点(HTTP 404)→ sheetListUnavailable:true + 只回默认槽(明确标注是推断,不是清单)。`defaultSheetCode` 由清单推导(formType=DEFAULT_SHEET 且 sheetCode===schemaCode),权威仍是 form.get 的显式 sheetCode。";
|
package/dist/lanes/form.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ENDPOINTS } from "../endpoints.js";
|
|
3
3
|
import { decodeButtonScript } from "./list-view.js";
|
|
4
|
-
import { executeFormDraftWrite, executeFormPublishWrite, executeFormRunButtonWrite, lintFormPublishReadOnly, lintFormControlTypes, readFormButtons, readFormOrNull, refuseEmptyCallerLayout, validateHtmlRender, customButtonJsonStoredShape, CUSTOM_BUTTON_JSON_STRING_SHAPE_WARNING, FORM_FLAG_AUTHORITY_NOTE, compareFormFaces, resolveEffectiveFormFace, composeFormLayoutDraft, assertLayoutRequestConflicts } from "../form-support.js";
|
|
4
|
+
import { executeFormDraftWrite, executeFormPublishWrite, executeFormRunButtonWrite, lintFormPublishReadOnly, lintFormControlTypes, readFormButtons, readFormOrNull, refuseEmptyCallerLayout, validateHtmlRender, customButtonJsonStoredShape, CUSTOM_BUTTON_JSON_STRING_SHAPE_WARNING, FORM_FLAG_AUTHORITY_NOTE, compareFormFaces, resolveEffectiveFormFace, composeFormLayoutDraft, composeFormDecorationsDraft, assertLayoutRequestConflicts, assertDecorationRequestConflicts, summarizeFormDecorations } from "../form-support.js";
|
|
5
5
|
import { capabilityArg, environmentArg } from "../args.js";
|
|
6
6
|
import { governedRead } from "../read.js";
|
|
7
7
|
import { writeTool } from "../write.js";
|
|
@@ -229,6 +229,12 @@ export function registerFormLane(tools) {
|
|
|
229
229
|
// F5(0.8.20):子表列 locator(发布面优先,草稿面兜底)。
|
|
230
230
|
const childColumnLocator = childColumnLocatorOf(sheet.publishedAttributesJson, "publishedAttributesJson")
|
|
231
231
|
?? childColumnLocatorOf(sheet.draftAttributesJson, "draftAttributesJson");
|
|
232
|
+
// issue #57:非字段控件(200 分组标题 / 202 描述说明 / 203 表单标题)单列,
|
|
233
|
+
// 免掉「整包 diff 才能看出用户在设计器加了什么」。优先草稿面(正在编辑的
|
|
234
|
+
// 那一面),草稿为空才退回发布面;正文(HTML)有界内联,超预算只给
|
|
235
|
+
// htmlPresent + htmlBytes。
|
|
236
|
+
const decorationFace = draftPresent ? "draft" : "published";
|
|
237
|
+
const decorationSummary = summarizeFormDecorations(decorationFace === "draft" ? sheet.draftAttributesJson : sheet.publishedAttributesJson, decorationFace === "draft" ? sheet.draftViewJson : sheet.publishedViewJson);
|
|
232
238
|
const faceSync = compareFormFaces(sheet, { draftPresent, publishedPresent });
|
|
233
239
|
const faceVerdict = resolveEffectiveFormFace({
|
|
234
240
|
draftPresent,
|
|
@@ -256,6 +262,11 @@ export function registerFormLane(tools) {
|
|
|
256
262
|
...(faceSync.inSync === false ? { differingFaces: faceSync.differingFaces } : {}),
|
|
257
263
|
},
|
|
258
264
|
...(childColumnLocator !== undefined ? { childColumnLocator } : {}),
|
|
265
|
+
// 非字段控件摘要(恒回数组,0 也给):空数组 = 这面确实没有布局控件,
|
|
266
|
+
// 不是「没读到」。写面是 form.draft {decorations}。
|
|
267
|
+
decorations: decorationSummary.decorations,
|
|
268
|
+
decorationsFace: decorationFace,
|
|
269
|
+
...(decorationSummary.note !== undefined ? { decorationsNote: decorationSummary.note } : {}),
|
|
259
270
|
...(flagMismatch
|
|
260
271
|
? {
|
|
261
272
|
flagMismatch: true,
|
|
@@ -381,7 +392,9 @@ export function registerFormLane(tools) {
|
|
|
381
392
|
compact: (result) => {
|
|
382
393
|
// 探针 L F7:platformFlags 只有两个布尔,compact 若不保留会被压成
|
|
383
394
|
// `platformFlagsCount:2`,平台原文恰好在降载时丢失。
|
|
384
|
-
|
|
395
|
+
// issue #57:decorations 是**证据行集**(key/type/html/row),压成码表就
|
|
396
|
+
// 丢掉了「用户加了什么描述块」这个答案;payload 已按 1800B 自限。
|
|
397
|
+
const KEEP = new Set(["draftControls", "publishedControls", "customButtonJson", "options", "formButtons", "formButtonCodes", "platformFlags", "childColumnLocator", "decorations"]);
|
|
385
398
|
// r28e F4 暴露的潜在 bug:handler 已经交过 `*Codes`/`*Count`/`*Omitted`
|
|
386
399
|
// 这类**已压缩**的键,若再走数组分支会被二次加后缀
|
|
387
400
|
// (`publishedControlCodes` → `publishedControlCodesCodes`),字段直接消失。
|
|
@@ -611,15 +624,26 @@ export function registerFormLane(tools) {
|
|
|
611
624
|
writeTool({
|
|
612
625
|
tools,
|
|
613
626
|
name: "form.draft",
|
|
614
|
-
search: { intents: ["改表单布局", "调表单布局", "表单拖字段", "存表单草稿", "表单加控件"] },
|
|
627
|
+
search: { intents: ["改表单布局", "调表单布局", "表单拖字段", "存表单草稿", "表单加控件", "表单描述块", "描述说明", "富文本说明", "红色提示文字"] },
|
|
615
628
|
lane: FORM_LANE,
|
|
616
629
|
scope: FORM_TOOLS["form.draft"].scope,
|
|
617
630
|
description: FORM_TOOLS["form.draft"].description,
|
|
618
631
|
inputSchema: {
|
|
619
632
|
schemaCode: z.string().min(1),
|
|
620
633
|
sheetCode: z.string().min(1).optional().describe("表单槽位码;省略时默认 = schemaCode(模型码即默认表单槽位)"),
|
|
621
|
-
draftViewJson: z.string().optional().describe("行分组:JSON 二维字符串数组 `[[\"
|
|
622
|
-
draftAttributesJson: z.string().optional().describe("
|
|
634
|
+
draftViewJson: z.string().optional().describe("行分组:JSON 二维字符串数组 `[[\"a\",\"b\"],[\"c\"]]`——**一行几个 code 就是几列**(不是靠 span);每个 code 必须同时出现在 draftAttributesJson。样例 `omc describe form.draft --example two-column-layout`"),
|
|
635
|
+
draftAttributesJson: z.string().optional().describe("控件表 `{code:{key,type,options:{name,span}}}`。**type 是表单控件枚举,不是字段 propertyType**(80=关联单选/201=子表…),错枚举拒 `form-control-type-mismatch`;span 是 24 栅格(两列 12/整宽 24,须与行分组自洽)。非字段控件 200/202/203 勿手拼,用 decorations"),
|
|
636
|
+
decorations: z
|
|
637
|
+
.array(z.object({
|
|
638
|
+
key: z.string().min(1).optional().describe("省略=自动生成 Description<序号>;带 key 命中既有布局控件=改它(其余 options 原样保留)"),
|
|
639
|
+
type: z.number().int().optional().describe("200 分组标题 / 202 描述说明(默认)/ 203 表单标题;已有控件不可原地改类型"),
|
|
640
|
+
html: z.string().optional().describe("202 的正文 HTML,写进 options.name(设计器同形,按 innerHTML 渲染)"),
|
|
641
|
+
name: z.string().optional().describe("200/203 的纯文本名;202 也可用它代替 html"),
|
|
642
|
+
span: z.number().int().positive().optional().describe("24 栅格宽度,∈6/8/12/16/18/24;插入已有行省略时用剩余宽度"),
|
|
643
|
+
row: z.number().int().positive().optional().describe("插入行,1-based;省略=末尾追加一行(span 默认 24)"),
|
|
644
|
+
}))
|
|
645
|
+
.optional()
|
|
646
|
+
.describe("增量加/改布局控件 200/202/203(202 的 html 写 options.name);与 draftViewJson/draftAttributesJson/layout/rebuild/fieldCodes/childColumns 互斥。样例 `omc describe form.draft --example form-description-block`"),
|
|
623
647
|
layout: z
|
|
624
648
|
.object({
|
|
625
649
|
rows: z.array(z.array(z.string().min(1)).min(1)).min(1),
|
|
@@ -627,34 +651,35 @@ export function registerFormLane(tools) {
|
|
|
627
651
|
includeSystem: z.boolean().optional(),
|
|
628
652
|
})
|
|
629
653
|
.optional()
|
|
630
|
-
.describe("增量布局(推荐):{rows:[[\"a\",\"b\"],[\"c\"]],spans?:{a:12},includeSystem?}
|
|
631
|
-
allowTypeMismatch: z.boolean().optional().describe("放行控件 type
|
|
654
|
+
.describe("增量布局(推荐):{rows:[[\"a\",\"b\"],[\"c\"]],spans?:{a:12},includeSystem?}。以当前草稿为基线(空则退回已发布),只改行分组与 span,**不必回传整包 attrs**;未列入 rows 的控件保留原行,系统控件须 includeSystem:true。与 draftViewJson/draftAttributesJson/rebuild/fieldCodes/childColumns/refreshFromFields/fromReadback/decorations 互斥"),
|
|
655
|
+
allowTypeMismatch: z.boolean().optional().describe("放行控件 type 与 propertyType 不匹配(默认拒 form-control-type-mismatch;仅平台模板要求时用)"),
|
|
632
656
|
draftHtmlJson: z.string().optional(),
|
|
633
657
|
fieldCodes: z.array(z.string().min(1)).optional().describe("脚手架绑定的已发布字段(按此顺序);由 configure_form/intent 显式传入。子表列写「父字段.子列」等价于 childColumns"),
|
|
634
658
|
childColumns: z
|
|
635
659
|
.array(z.object({ parent: z.string().min(1), fieldCodes: z.array(z.string().min(1)) }))
|
|
636
660
|
.optional()
|
|
637
|
-
.describe("把子表列绑进**已有** Sheet201 控件的 columns
|
|
661
|
+
.describe("把子表列绑进**已有** Sheet201 控件的 columns:`[{parent:\"items\",fieldCodes:[\"category\"]}]`。只追加列,不动其它控件/布局行;无已存布局时退回 scaffold"),
|
|
638
662
|
rebuild: z.boolean().optional().describe("true 时丢弃现有草稿布局,按已发布字段重新生成(新增字段/子表要用它;默认保留现有草稿)"),
|
|
639
663
|
refreshFromFields: z.boolean().optional().describe("true 时不重建布局,仅按当前已发布字段 options 刷新现有控件派生配置"),
|
|
640
|
-
fromReadback: z.boolean().optional().describe("true =
|
|
664
|
+
fromReadback: z.boolean().optional().describe("true = draftViewJson/draftAttributesJson 是 form.get 的**逐字未改动**原文(平台自身布局的超宽行放行)。改过一字符就不是回读,会被拒;只加子表列用 childColumns"),
|
|
641
665
|
allowEmptyLayout: z.boolean().optional().describe("显式放行空布局(\"[]\"/\"{}\")写入;默认拒绝(form-empty-layout),防设计器 Save 清空后照写丢控件"),
|
|
642
666
|
buttons: z
|
|
643
667
|
.array(z.record(z.unknown()))
|
|
644
668
|
.optional()
|
|
645
|
-
.describe("表单工具栏按钮(写进
|
|
669
|
+
.describe("表单工具栏按钮(写进 options.customButtonJson;publish 时才生成 h_biz_button(triggerType=FORM))。必填键见 contract form 的 formButtons"),
|
|
646
670
|
customButtonJson: z.string().optional().describe("buttons 的原样 JSON 数组字符串(与 buttons 互斥;用于把 form.get 读回值直接回写)"),
|
|
647
|
-
buttonsMode: z.enum(["merge", "replace"]).optional().describe("默认 merge:按 code 增量 upsert
|
|
671
|
+
buttonsMode: z.enum(["merge", "replace"]).optional().describe("默认 merge:按 code 增量 upsert;replace:整表替换"),
|
|
648
672
|
removeButtonCodes: z.array(z.string().min(1)).optional().describe("要删除的按钮 code(仅 merge 模式)"),
|
|
649
|
-
buttonScripts: z.array(z.object({ code: z.string().min(1), script: z.string() })).optional().describe("
|
|
673
|
+
buttonScripts: z.array(z.object({ code: z.string().min(1), script: z.string() })).optional().describe("直接改已有按钮脚本(actionConfig.scriptData),按 code 逐字替换;未知 code 拒绝"),
|
|
650
674
|
},
|
|
651
675
|
execute: async (session, args) => executeFormDraftWrite(session, { ...args, sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode) }),
|
|
652
676
|
preflight: (args) => {
|
|
653
677
|
// Zero-wire refusal (ticket 74): fires in semanticGate BEFORE the
|
|
654
678
|
// governed pipeline — including the rollback before-capture read.
|
|
655
679
|
const resolved = { ...args, sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode) };
|
|
656
|
-
// layout 是增量面,与整包布局/重建参数互斥:纯参数门,零 wire。
|
|
680
|
+
// layout / decorations 是增量面,与整包布局/重建参数互斥:纯参数门,零 wire。
|
|
657
681
|
assertLayoutRequestConflicts(resolved);
|
|
682
|
+
assertDecorationRequestConflicts(resolved);
|
|
658
683
|
refuseEmptyCallerLayout(resolved);
|
|
659
684
|
},
|
|
660
685
|
// R75-B seam: dry-run 与真写共用这一个 session 只读 lint(dry-run 直接跑它)。
|
|
@@ -672,6 +697,14 @@ export function registerFormLane(tools) {
|
|
|
672
697
|
});
|
|
673
698
|
return { layout: composed.receipt, ...(composed.warnings.length > 0 ? { layoutWarnings: composed.warnings } : {}) };
|
|
674
699
|
}
|
|
700
|
+
if (args.decorations !== undefined) {
|
|
701
|
+
const composed = await composeFormDecorationsDraft(session, {
|
|
702
|
+
schemaCode: args.schemaCode,
|
|
703
|
+
sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode),
|
|
704
|
+
decorations: args.decorations,
|
|
705
|
+
});
|
|
706
|
+
return { decorations: composed.receipt, ...(composed.warnings.length > 0 ? { decorationWarnings: composed.warnings } : {}) };
|
|
707
|
+
}
|
|
675
708
|
if (args.fromReadback === true)
|
|
676
709
|
return { controlTypeCheck: "skipped-fromReadback" };
|
|
677
710
|
const lint = await lintFormControlTypes(session, {
|
|
@@ -731,7 +764,7 @@ export function registerFormLane(tools) {
|
|
|
731
764
|
customButtonJson: z.string().optional().describe("buttons 的原样 JSON 数组字符串(与 buttons 互斥)"),
|
|
732
765
|
buttonsMode: z.enum(["merge", "replace"]).optional().describe("默认 merge:按 code 增量 upsert;replace:整表替换"),
|
|
733
766
|
removeButtonCodes: z.array(z.string().min(1)).optional().describe("要删除的按钮 code(仅 merge 模式)"),
|
|
734
|
-
buttonScripts: z.array(z.object({ code: z.string().min(1), script: z.string() })).optional().describe("
|
|
767
|
+
buttonScripts: z.array(z.object({ code: z.string().min(1), script: z.string() })).optional().describe("直接改已有按钮脚本(actionConfig.scriptData),按 code 逐字替换;未知 code 拒绝"),
|
|
735
768
|
},
|
|
736
769
|
execute: async (session, args) => executeFormPublishWrite(session, { ...args, sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode) }),
|
|
737
770
|
// R75-B 续:降级守卫(草稿控件数 < 发布面)此前只在真写里——空/残草稿的
|