@stalfh233/omc-cli 0.6.69 → 0.6.70
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 +69 -22
- package/dist/command-transport.js +9 -8
- package/dist/discovery.js +6 -0
- package/dist/graph.js +200 -23
- package/dist/lanes/apply-changes.js +4 -0
- package/dist/lanes/b2-registration.js +47 -21
- package/dist/lanes/businessrule.js +25 -3
- package/dist/lanes/datarule.js +36 -25
- package/dist/lanes/field.js +35 -26
- package/dist/lanes/list-view.js +10 -0
- package/dist/lanes/model.js +4 -0
- package/dist/lanes/online-js.js +44 -21
- package/dist/lanes/perm.js +7 -0
- package/dist/lanes/programming.js +2 -0
- package/dist/lanes/rule-lifecycle.js +21 -8
- package/dist/lanes/workflow.js +25 -0
- package/dist/mcp-graph.js +5 -3
- package/dist/package-tool.js +4 -0
- package/dist/path-projection.js +100 -16
- package/dist/read-shapes.js +37 -2
- package/dist/rule-support.js +36 -7
- package/dist/write.js +55 -5
- package/package.json +3 -3
|
@@ -1191,6 +1191,31 @@ export function registerB2Lane(tools) {
|
|
|
1191
1191
|
}
|
|
1192
1192
|
},
|
|
1193
1193
|
});
|
|
1194
|
+
// R75-B:service.update 的只读前置门(id 解析、分类悬空、adapter 白名单/必需键、
|
|
1195
|
+
// 连接池解析)。dry-run 与真写共用同一个函数,杜绝「dry-run 绿、真写拒」。
|
|
1196
|
+
const lintServiceUpdate = async (session, args) => {
|
|
1197
|
+
const found = await wireCall(session, { path: ENDPOINTS.bizServiceGetByCode, query: { serviceCode: args.serviceCode } });
|
|
1198
|
+
const row = found.data;
|
|
1199
|
+
const id = row?.id;
|
|
1200
|
+
if (typeof id !== "string" || !id)
|
|
1201
|
+
return { row, id, adapterCode: "", serviceConfigJson: undefined };
|
|
1202
|
+
const adapterCode = typeof row.adapterCode === "string" ? String(row.adapterCode) : "";
|
|
1203
|
+
// Ticket 103: a NEW serviceCategoryId must resolve before the update
|
|
1204
|
+
// write (the platform writes it verbatim without validation).
|
|
1205
|
+
if (args.serviceCategoryId !== undefined)
|
|
1206
|
+
await assertCategoryResolves(session, args.serviceCategoryId);
|
|
1207
|
+
// A structured serviceConfig targets the designer write face: the same
|
|
1208
|
+
// adapter whitelist + required-key preflight as register (ticket 92).
|
|
1209
|
+
const serviceConfigJson = args.serviceConfig !== undefined ? compileServiceConfig(assertBizServiceAdapterWhitelisted(adapterCode), args.serviceConfig) : undefined;
|
|
1210
|
+
// Ticket 104: a DATA_SQL/DATA_TABLE binding must reference an existing
|
|
1211
|
+
// connection pool before the update write.
|
|
1212
|
+
if (serviceConfigJson !== undefined && (adapterCode === "DATA_SQL" || adapterCode === "DATA_TABLE")) {
|
|
1213
|
+
const poolCode = dbConnPoolCodeOf(args.serviceConfig);
|
|
1214
|
+
if (poolCode !== undefined)
|
|
1215
|
+
await assertDbConnPoolResolves(session, poolCode);
|
|
1216
|
+
}
|
|
1217
|
+
return { row, id, adapterCode, serviceConfigJson };
|
|
1218
|
+
};
|
|
1194
1219
|
writeTool({
|
|
1195
1220
|
tools,
|
|
1196
1221
|
name: "service.update",
|
|
@@ -1212,28 +1237,13 @@ export function registerB2Lane(tools) {
|
|
|
1212
1237
|
// Ticket 93 — patch an existing service without delete/recreate. The id
|
|
1213
1238
|
// is resolved via get_by_code first (BizServiceController update path
|
|
1214
1239
|
// requires it); metadata keys pass through verbatim.
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1240
|
+
// R75-B(2026-11-18):与 dryRunPayload 共用 lintServiceUpdate —— 此前这四道
|
|
1241
|
+
// 读面门只在 execute,`service.update --dry-run` 绿灯、真写拒(investigate-B
|
|
1242
|
+
// E4:分类悬空)。现在 dry-run 与真写逐字同源。
|
|
1243
|
+
const linted = await lintServiceUpdate(session, args);
|
|
1244
|
+
const { row, id, adapterCode, serviceConfigJson } = linted;
|
|
1245
|
+
if (!row || typeof id !== "string" || !id)
|
|
1219
1246
|
return { performed: { errcode: 500001 }, readback: { absent: true }, summary: `业务服务不存在:${args.serviceCode}` };
|
|
1220
|
-
const adapterCode = typeof row.adapterCode === "string" ? row.adapterCode : "";
|
|
1221
|
-
// Ticket 103: a NEW serviceCategoryId must resolve before the update
|
|
1222
|
-
// write (the platform writes it verbatim without validation).
|
|
1223
|
-
if (args.serviceCategoryId !== undefined)
|
|
1224
|
-
await assertCategoryResolves(session, args.serviceCategoryId);
|
|
1225
|
-
// A structured serviceConfig targets the designer write face: the same
|
|
1226
|
-
// adapter whitelist + required-key preflight as register (ticket 92).
|
|
1227
|
-
// Refusal here precedes the update WRITE (only the read-only id
|
|
1228
|
-
// resolution may have preceded it).
|
|
1229
|
-
const serviceConfigJson = args.serviceConfig !== undefined ? compileServiceConfig(assertBizServiceAdapterWhitelisted(adapterCode), args.serviceConfig) : undefined;
|
|
1230
|
-
// Ticket 104: a DATA_SQL/DATA_TABLE binding must reference an existing
|
|
1231
|
-
// connection pool before the update write.
|
|
1232
|
-
if (serviceConfigJson !== undefined && (adapterCode === "DATA_SQL" || adapterCode === "DATA_TABLE")) {
|
|
1233
|
-
const poolCode = dbConnPoolCodeOf(args.serviceConfig);
|
|
1234
|
-
if (poolCode !== undefined)
|
|
1235
|
-
await assertDbConnPoolResolves(session, poolCode);
|
|
1236
|
-
}
|
|
1237
1247
|
// Live incident 2026-09-14 (user-visible): the platform update path is a
|
|
1238
1248
|
// FULL-ROW overwrite (ModelUtility.toEntity → save/update) — a body that
|
|
1239
1249
|
// omits configJson/serviceCategoryId wipes them to NULL on the platform
|
|
@@ -1277,6 +1287,22 @@ export function registerB2Lane(tools) {
|
|
|
1277
1287
|
// any update write (see the execute body).
|
|
1278
1288
|
assertStructuredConfig(args.serviceConfig, "serviceConfig");
|
|
1279
1289
|
},
|
|
1290
|
+
dryRunPayload: async (session, args) => {
|
|
1291
|
+
const { id, adapterCode, serviceConfigJson } = await lintServiceUpdate(session, args);
|
|
1292
|
+
if (typeof id !== "string" || !id)
|
|
1293
|
+
return { wouldChange: false, servicePresent: false, summary: `业务服务不存在:${args.serviceCode}——真写会回 absent(零写入)` };
|
|
1294
|
+
return {
|
|
1295
|
+
wouldChange: true,
|
|
1296
|
+
serviceCode: args.serviceCode,
|
|
1297
|
+
adapterCode,
|
|
1298
|
+
summary: `即将更新业务服务 ${args.serviceCode}(adapter=${adapterCode || "?"});分类/连接池/配置必需键已按真写同门校验`,
|
|
1299
|
+
...(args.name !== undefined ? { name: args.name } : {}),
|
|
1300
|
+
...(args.serviceCategoryId !== undefined ? { serviceCategoryId: args.serviceCategoryId } : {}),
|
|
1301
|
+
...(serviceConfigJson !== undefined ? { configJsonBytes: Buffer.byteLength(serviceConfigJson, "utf8") } : {}),
|
|
1302
|
+
};
|
|
1303
|
+
},
|
|
1304
|
+
lintScope: "full",
|
|
1305
|
+
lintUnchecked: ["platform-side-validation", "post-write-readback"],
|
|
1280
1306
|
rollback: b2ServiceRollbackSpec("service.update"),
|
|
1281
1307
|
});
|
|
1282
1308
|
writeTool({
|
|
@@ -5,7 +5,7 @@ import { governedRead } from "../read.js";
|
|
|
5
5
|
import { writeTool } from "../write.js";
|
|
6
6
|
import { decodeJsonColumn, JSON_COLUMN_NULL_COALESCE } from "../json-column.js";
|
|
7
7
|
import { applicationResolutionOf, applicationScopeHint, flattenTreeRows, resolveApplicationScope, suggestModelNames } from "../support.js";
|
|
8
|
-
import { assertRuleNamePlatformAcceptable, executeRuleSaveWrite, lintRuleGraphForWrite, ruleNodeGraphArg } from "../rule-support.js";
|
|
8
|
+
import { assertRuleNamePlatformAcceptable, executeRuleSaveWrite, lintRuleGraphForWrite, lintRuleSaveWrite, ruleNodeGraphArg } from "../rule-support.js";
|
|
9
9
|
import { defineTool, ToolInputError, ToolRefusalError } from "../tool-types.js";
|
|
10
10
|
import { resolveRuleRowId } from "../identity.js";
|
|
11
11
|
import { wireCall, wireCallWith404Fallback, wireRows } from "../wire.js";
|
|
@@ -665,6 +665,27 @@ export function registerBusinessRuleLane(tools) {
|
|
|
665
665
|
customTrigger: z.boolean().optional().describe("默认开:自定义 ruleCode + bizRuleType 0(非平台触发码 Create/Update/Delete/GetList/Load/Available/Cancel)即按钮/流程规则,工具在 START 后合成平台标准 CUSTOM_NODE「自定义按钮/流程触发」系统触发节点(nodeCode=ruleCode,live 布局 x558/y233);调用方已写 CUSTOM_NODE 则原样保留;显式 false 退回"),
|
|
666
666
|
},
|
|
667
667
|
execute: async (session, args) => executeRuleSaveWrite(session, args),
|
|
668
|
+
// R75-B(2026-11-18):dry-run 与真写共用 lintRuleSaveWrite(同一套只读门:
|
|
669
|
+
// 图 lint / 公式 fail-closed / 字段归属 / schema 存在 / BizMethod wire /
|
|
670
|
+
// 调度映射)。此前 semanticGate 只跑图形状(relaxEnums),formula-lint 等
|
|
671
|
+
// 门只在 execute —— `rule.save --dry-run` 绿灯、真写 refused(E1 实证)。
|
|
672
|
+
dryRunPayload: async (session, args) => {
|
|
673
|
+
const linted = await lintRuleSaveWrite(session, args);
|
|
674
|
+
return {
|
|
675
|
+
ruleCode: args.ruleCode,
|
|
676
|
+
mode: linted.existing?.id ? "update" : "create",
|
|
677
|
+
nodeCount: linted.nodes.length,
|
|
678
|
+
routeCount: linted.routes.length,
|
|
679
|
+
publish: args.publish === true,
|
|
680
|
+
customTrigger: linted.customTriggerApplied,
|
|
681
|
+
...(linted.bizMethodChecks > 0 ? { bizMethodChecks: linted.bizMethodChecks } : {}),
|
|
682
|
+
...(linted.lintWarnings.length > 0 ? { lintWarnings: linted.lintWarnings } : {}),
|
|
683
|
+
...(linted.lintHazards.length > 0 ? { lintHazards: linted.lintHazards } : {}),
|
|
684
|
+
summary: `rule.save 只读门全过:${args.schemaCode}.${args.ruleCode} ${linted.existing?.id ? "更新" : "新建"},${linted.nodes.length} 节点/${linted.routes.length} 路由${args.publish === true ? ",并发布" : ""};真写只差平台侧规则自检与写后回读`,
|
|
685
|
+
};
|
|
686
|
+
},
|
|
687
|
+
lintScope: "full",
|
|
688
|
+
lintUnchecked: ["platform-rule-self-check", "post-write-readback"],
|
|
668
689
|
rollback: businessRuleRollbackSpec("rule.save"),
|
|
669
690
|
});
|
|
670
691
|
// Round 10 (issue 04) — precise modify. `rule.save` replaces the WHOLE nodeGraph,
|
|
@@ -733,8 +754,9 @@ export function registerBusinessRuleLane(tools) {
|
|
|
733
754
|
nodeCode: args.nodeCode,
|
|
734
755
|
patchedKeys: Object.keys(args.patch),
|
|
735
756
|
// 本次 dry-run 覆盖的是**全图** lint(patch 合并进存量图后整图过门),
|
|
736
|
-
// 不是只验 patch
|
|
737
|
-
|
|
757
|
+
// 不是只验 patch 本身。`lintScope` 现在是 R75-B 的契约字段
|
|
758
|
+
// (full/partial/plan,由 writeTool 声明)——图谱细节用独立键,避免同名双义。
|
|
759
|
+
lintGraphScope: "fullGraph",
|
|
738
760
|
validation: linted.blockers,
|
|
739
761
|
};
|
|
740
762
|
},
|
package/dist/lanes/datarule.js
CHANGED
|
@@ -871,6 +871,32 @@ export function registerDataRuleLane(tools) {
|
|
|
871
871
|
},
|
|
872
872
|
}),
|
|
873
873
|
}));
|
|
874
|
+
// R75-B:datarule.create 的只读前置门(发布面字段、子表公式引用、重复规则)。
|
|
875
|
+
// dry-run 与真写共用同一个函数;只读 + 拒绝。
|
|
876
|
+
const lintDataRuleCreate = async (session, args) => {
|
|
877
|
+
const codes = dataRuleTargetCodes(args);
|
|
878
|
+
const published = await readPublishedFieldCodesOrNull(session, args.schemaCode);
|
|
879
|
+
await assertChildFormulaRefs(session, args, published);
|
|
880
|
+
if (published !== null) {
|
|
881
|
+
const missing = codes.filter((code) => !published.has(code));
|
|
882
|
+
if (missing.length > 0)
|
|
883
|
+
throw new ToolRefusalError({ status: "refused", blocker: "datarule-property-not-published", schemaCode: args.schemaCode, propertyCodes: codes, missing, message: `字段 ${args.schemaCode}.${missing.join(",")} 不在发布面上;拒绝 datarule.create POST。子表列规则请随 field.create 生成/发布;datarule.create 的发布面校验不含子表列(childRule 不改变此行为,r34a-F12 真机三形态全拒)` });
|
|
884
|
+
}
|
|
885
|
+
const existingRules = await listDataRules(session, args.schemaCode);
|
|
886
|
+
// dataRuleType 1 (CHECK_RULE) fans out into 5 checkTypes that COEXIST on one
|
|
887
|
+
// field (the platform auto-creates a checkType 4 maxLength row per text
|
|
888
|
+
// field), so the clash key there is field + `checkType`, not field + type.
|
|
889
|
+
const duplicate = existingRules.find((row) => {
|
|
890
|
+
if (Number(row.dataRuleType) !== args.dataRuleType)
|
|
891
|
+
return false;
|
|
892
|
+
if (!storedTargetCodes(row).some((code) => codes.includes(code)))
|
|
893
|
+
return false;
|
|
894
|
+
return args.dataRuleType === 1 ? (row.checkType ?? null) === (args.checkType ?? null) : true;
|
|
895
|
+
});
|
|
896
|
+
if (duplicate)
|
|
897
|
+
throw new ToolRefusalError({ status: "refused", blocker: "datarule-duplicate-property-type", schemaCode: args.schemaCode, propertyCodes: codes, dataRuleType: args.dataRuleType, ...(args.dataRuleType === 1 ? { checkType: args.checkType } : {}), nextCommand: `omc call datarule.update --args '${JSON.stringify({ id: String(duplicate.id ?? "<existingId>"), schemaCode: args.schemaCode, propertyCode: codes.length === 1 ? codes[0] : undefined, propertyCodes: codes.length > 1 ? codes : undefined, dataRuleType: args.dataRuleType, checkType: args.checkType, options: args.options })}'`, message: `字段 ${args.schemaCode}.${codes.join(",")} 已存在同类型数据规则${args.dataRuleType === 1 ? `(checkType ${args.checkType})` : ""};拒绝重复 POST;如需修改请使用该规则 id 更新` });
|
|
898
|
+
return { codes };
|
|
899
|
+
};
|
|
874
900
|
writeTool({
|
|
875
901
|
tools,
|
|
876
902
|
name: "datarule.create",
|
|
@@ -895,27 +921,7 @@ export function registerDataRuleLane(tools) {
|
|
|
895
921
|
assertDataRuleFormulaLint(args.dataRuleType, args.options, args.allowAdvisory);
|
|
896
922
|
assertDataRuleCheckType(args.dataRuleType, args.checkType);
|
|
897
923
|
assertDataRuleTarget(args);
|
|
898
|
-
const codes =
|
|
899
|
-
const published = await readPublishedFieldCodesOrNull(session, args.schemaCode);
|
|
900
|
-
await assertChildFormulaRefs(session, args, published);
|
|
901
|
-
if (published !== null) {
|
|
902
|
-
const missing = codes.filter((code) => !published.has(code));
|
|
903
|
-
if (missing.length > 0)
|
|
904
|
-
throw new ToolRefusalError({ status: "refused", blocker: "datarule-property-not-published", schemaCode: args.schemaCode, propertyCodes: codes, missing, message: `字段 ${args.schemaCode}.${missing.join(",")} 不在发布面上;拒绝 datarule.create POST。子表列规则请随 field.create 生成/发布;datarule.create 的发布面校验不含子表列(childRule 不改变此行为,r34a-F12 真机三形态全拒)` });
|
|
905
|
-
}
|
|
906
|
-
const existingRules = await listDataRules(session, args.schemaCode);
|
|
907
|
-
// dataRuleType 1 (CHECK_RULE) fans out into 5 checkTypes that COEXIST on one
|
|
908
|
-
// field (the platform auto-creates a checkType 4 maxLength row per text
|
|
909
|
-
// field), so the clash key there is field + `checkType`, not field + type.
|
|
910
|
-
const duplicate = existingRules.find((row) => {
|
|
911
|
-
if (Number(row.dataRuleType) !== args.dataRuleType)
|
|
912
|
-
return false;
|
|
913
|
-
if (!storedTargetCodes(row).some((code) => codes.includes(code)))
|
|
914
|
-
return false;
|
|
915
|
-
return args.dataRuleType === 1 ? (row.checkType ?? null) === (args.checkType ?? null) : true;
|
|
916
|
-
});
|
|
917
|
-
if (duplicate)
|
|
918
|
-
throw new ToolRefusalError({ status: "refused", blocker: "datarule-duplicate-property-type", schemaCode: args.schemaCode, propertyCodes: codes, dataRuleType: args.dataRuleType, ...(args.dataRuleType === 1 ? { checkType: args.checkType } : {}), nextCommand: `omc call datarule.update --args '${JSON.stringify({ id: String(duplicate.id ?? "<existingId>"), schemaCode: args.schemaCode, propertyCode: codes.length === 1 ? codes[0] : undefined, propertyCodes: codes.length > 1 ? codes : undefined, dataRuleType: args.dataRuleType, checkType: args.checkType, options: args.options })}'`, message: `字段 ${args.schemaCode}.${codes.join(",")} 已存在同类型数据规则${args.dataRuleType === 1 ? `(checkType ${args.checkType})` : ""};拒绝重复 POST;如需修改请使用该规则 id 更新` });
|
|
924
|
+
const { codes } = await lintDataRuleCreate(session, args);
|
|
919
925
|
const createRule = () => wireCall(session, {
|
|
920
926
|
path: ENDPOINTS.dataRuleCreate,
|
|
921
927
|
method: "POST",
|
|
@@ -954,12 +960,17 @@ export function registerDataRuleLane(tools) {
|
|
|
954
960
|
assertDataRuleOptions(args.dataRuleType, args.options, args.checkType);
|
|
955
961
|
assertDataRuleCheckType(args.dataRuleType, args.checkType);
|
|
956
962
|
},
|
|
957
|
-
dryRunPayload: //
|
|
958
|
-
//
|
|
959
|
-
|
|
963
|
+
dryRunPayload: // R75-B(2026-11-18):dry-run 与真写同门——发布面校验、重复规则、
|
|
964
|
+
// 公式 fail-closed 都此前只在 execute(investigate-B E5:字段未发布 dry-run 绿、
|
|
965
|
+
// 真写拒)。公式 lint 也从 advisory 升为与真写同门的 fail-closed 预览。
|
|
966
|
+
async (session, args) => {
|
|
967
|
+
assertDataRuleFormulaLint(args.dataRuleType, args.options, args.allowAdvisory);
|
|
968
|
+
const { codes } = await lintDataRuleCreate(session, args);
|
|
960
969
|
const lintWarnings = dataRuleFormulaWarnings(args.dataRuleType, args.options);
|
|
961
|
-
return lintWarnings.length ? { lintWarnings } : {};
|
|
970
|
+
return { wouldChange: true, schemaCode: args.schemaCode, propertyCodes: codes, dataRuleType: args.dataRuleType, ...(args.dataRuleType === 1 ? { checkType: args.checkType } : {}), ...(lintWarnings.length ? { lintWarnings } : {}) };
|
|
962
971
|
},
|
|
972
|
+
lintScope: "full",
|
|
973
|
+
lintUnchecked: ["platform-side-validation", "post-write-readback"],
|
|
963
974
|
rollback: dataruleRollbackSpec("datarule.create"),
|
|
964
975
|
});
|
|
965
976
|
writeTool({
|
package/dist/lanes/field.js
CHANGED
|
@@ -755,6 +755,8 @@ export function registerFieldLane(tools) {
|
|
|
755
755
|
const impact = await collectFieldDeleteImpact(session, args, { full: true });
|
|
756
756
|
return { wouldChange: true, impact, schemaCode: args.schemaCode, code: args.code };
|
|
757
757
|
},
|
|
758
|
+
lintScope: "full",
|
|
759
|
+
lintUnchecked: ["platform-side-validation", "post-write-readback"],
|
|
758
760
|
rollback: fieldRollbackSpec("field.delete"),
|
|
759
761
|
});
|
|
760
762
|
}
|
|
@@ -895,6 +897,36 @@ async function countModelDataRows(session, schemaCode) {
|
|
|
895
897
|
};
|
|
896
898
|
}
|
|
897
899
|
}
|
|
900
|
+
/**
|
|
901
|
+
* field.update 的 options 可改白名单(tickets 60/61、条件配对轮、r64b format)。
|
|
902
|
+
* 其余键 fail-closed:平台接受很多键但会静默丢弃。R75-B:同一清单同时供
|
|
903
|
+
* 真写(runFieldUpdate)与 dry-run(fieldUpdateDryRun)使用——此前只在 execute,
|
|
904
|
+
* `--dry-run` 绿灯、真写 field-options-immutable(investigate-B E7 实证)。
|
|
905
|
+
*/
|
|
906
|
+
const MUTABLE_FIELD_OPTION_KEYS = new Set([
|
|
907
|
+
"dictionaryData", "optionsSet", "mappings", "schemaCode", "queryCode", "displayField", "displayFieldType", "displayFieldFormat",
|
|
908
|
+
"relativePropertyMatchCode", "relativePropertyCode", "linkMode", "showStyle", "searchFormula", "conditions",
|
|
909
|
+
"requiredFormula", "readonlyCondition", "displayFormula", "readonlyFormula", "scale",
|
|
910
|
+
// r64b (live 2026-11-14): the numeric DISPLAY FORMAT. The designer writes it
|
|
911
|
+
// to this very row (数据项 Edit → Default Format → bizproperty/update
|
|
912
|
+
// options.format="ratio.percentile"), and the portal form reads it with
|
|
913
|
+
// priority over the form control's own format. Canonicalised before the wire.
|
|
914
|
+
"format",
|
|
915
|
+
]);
|
|
916
|
+
function assertNoImmutableOptionChanges(schemaCode, code, changedOptionKeys) {
|
|
917
|
+
const immutable = changedOptionKeys.filter((key) => !MUTABLE_FIELD_OPTION_KEYS.has(key));
|
|
918
|
+
if (immutable.length === 0)
|
|
919
|
+
return;
|
|
920
|
+
throw new ToolRefusalError({
|
|
921
|
+
status: "refused",
|
|
922
|
+
blocker: "field-options-immutable",
|
|
923
|
+
schemaCode,
|
|
924
|
+
code,
|
|
925
|
+
fields: immutable.map((key) => `options.${key}`),
|
|
926
|
+
mutableFields: [...MUTABLE_FIELD_OPTION_KEYS].map((key) => `options.${key}`),
|
|
927
|
+
message: `field.update 不允许经此面修改 options.${immutable.join("、")};这类字段配置会被平台静默丢弃。可改白名单:${[...MUTABLE_FIELD_OPTION_KEYS].map((key) => `options.${key}`).join("、")}。关联结构(schemaCode/queryCode/displayField 等)请 field.delete + field.create 重建;条件请用字段条件配置。`,
|
|
928
|
+
});
|
|
929
|
+
}
|
|
898
930
|
/**
|
|
899
931
|
* Session-aware dry-run for field.update: structured from→to changes (only real
|
|
900
932
|
* diffs), plus an honest dataImpact note when storage-shape keys move.
|
|
@@ -953,6 +985,8 @@ async function fieldUpdateDryRun(session, args) {
|
|
|
953
985
|
pushChange("choices", fromChoices, [...args.choices]);
|
|
954
986
|
}
|
|
955
987
|
}
|
|
988
|
+
// 与真写同答案:真实 diff 的 options.* 里,不在白名单的键直接拒绝。
|
|
989
|
+
assertNoImmutableOptionChanges(args.schemaCode, args.code, changes.filter((change) => change.field.startsWith("options.")).map((change) => change.field.slice("options.".length)));
|
|
956
990
|
const shapeTouched = changes.some((change) => {
|
|
957
991
|
if (change.field === "propertyEmpty" || change.field === "choices")
|
|
958
992
|
return true;
|
|
@@ -1288,32 +1322,7 @@ async function runFieldUpdate(session, args) {
|
|
|
1288
1322
|
if (!same(currentOptions[key] ?? null, prepared.options[key] ?? null))
|
|
1289
1323
|
requestedChanges.push(`options.${key}`);
|
|
1290
1324
|
}
|
|
1291
|
-
|
|
1292
|
-
// These are established field-row update surfaces (tickets 60/61 and the
|
|
1293
|
-
// condition pairing round). Everything else stays fail-closed: the
|
|
1294
|
-
// platform accepts many keys and silently drops them.
|
|
1295
|
-
"dictionaryData", "optionsSet", "mappings", "schemaCode", "queryCode", "displayField", "displayFieldType", "displayFieldFormat",
|
|
1296
|
-
"relativePropertyMatchCode", "relativePropertyCode", "linkMode", "showStyle", "searchFormula", "conditions",
|
|
1297
|
-
"requiredFormula", "readonlyCondition", "displayFormula", "readonlyFormula", "scale",
|
|
1298
|
-
// r64b (live 2026-11-14): the numeric DISPLAY FORMAT. The designer writes it
|
|
1299
|
-
// to this very row (数据项 Edit → Default Format → bizproperty/update
|
|
1300
|
-
// options.format="ratio.percentile"), and the portal form reads it with
|
|
1301
|
-
// priority over the form control's own format. Canonicalised before the wire.
|
|
1302
|
-
"format",
|
|
1303
|
-
]);
|
|
1304
|
-
const changedOptionKeys = requestedChanges.filter((field) => field.startsWith("options.")).map((field) => field.slice("options.".length));
|
|
1305
|
-
const immutableOptionKeys = changedOptionKeys.filter((key) => !mutableOptionKeys.has(key));
|
|
1306
|
-
if (immutableOptionKeys.length > 0) {
|
|
1307
|
-
throw new ToolRefusalError({
|
|
1308
|
-
status: "refused",
|
|
1309
|
-
blocker: "field-options-immutable",
|
|
1310
|
-
schemaCode: args.schemaCode,
|
|
1311
|
-
code: args.code,
|
|
1312
|
-
fields: immutableOptionKeys.map((key) => `options.${key}`),
|
|
1313
|
-
mutableFields: [...mutableOptionKeys].map((key) => `options.${key}`),
|
|
1314
|
-
message: `field.update 不允许经此面修改 options.${immutableOptionKeys.join("、")};这类字段配置会被平台静默丢弃。可改白名单:${[...mutableOptionKeys].map((key) => `options.${key}`).join("、")}。关联结构(schemaCode/queryCode/displayField 等)请 field.delete + field.create 重建;条件请用字段条件配置。`,
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1325
|
+
assertNoImmutableOptionChanges(args.schemaCode, args.code, requestedChanges.filter((field) => field.startsWith("options.")).map((field) => field.slice("options.".length)));
|
|
1317
1326
|
if (args.choices !== undefined && !same(choiceCodesOf(currentOptions) ?? [], [...args.choices]))
|
|
1318
1327
|
requestedChanges.push("choices");
|
|
1319
1328
|
if (requestedChanges.length === 0) {
|
package/dist/lanes/list-view.js
CHANGED
|
@@ -1041,6 +1041,16 @@ export function registerListViewLane(tools) {
|
|
|
1041
1041
|
dryRunPayload: async (session, args) => {
|
|
1042
1042
|
const code = args.code ?? args.schemaCode;
|
|
1043
1043
|
const fieldRows = wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: args.schemaCode, isPublish: "true" } })).data);
|
|
1044
|
+
// R75-B(2026-11-18):未知列此前 dry-run 只在 fieldCodes 回显、真写才拒
|
|
1045
|
+
// (investigate-B E3 实证)。同一判定提前到这里——dry-run 与真写同答案。
|
|
1046
|
+
const unknownRefs = args.fieldCodes.filter((ref) => resolveFieldRef(fieldRows, ref) === undefined);
|
|
1047
|
+
if (unknownRefs.length > 0)
|
|
1048
|
+
throw new ToolRefusalError({
|
|
1049
|
+
status: "refused",
|
|
1050
|
+
blocker: "listview-columns-unknown-field",
|
|
1051
|
+
unknown: unknownRefs,
|
|
1052
|
+
message: `fieldCodes 引用了模型 ${args.schemaCode} 发布面上不存在的字段(可给 propertyCode 或字段名):${unknownRefs.join("、")};先 field.create + field.publish,或修正引用`,
|
|
1053
|
+
});
|
|
1044
1054
|
const childTableRefs = args.fieldCodes
|
|
1045
1055
|
.map((ref) => {
|
|
1046
1056
|
const resolved = resolveFieldRef(fieldRows, ref);
|
package/dist/lanes/model.js
CHANGED
|
@@ -927,6 +927,8 @@ export function registerModelLane(tools) {
|
|
|
927
927
|
};
|
|
928
928
|
},
|
|
929
929
|
dryRunPayload: modelDeleteDryRun,
|
|
930
|
+
lintScope: "full",
|
|
931
|
+
lintUnchecked: ["platform-side-validation", "post-write-readback"],
|
|
930
932
|
rollback: modelRollbackSpec("model.delete"),
|
|
931
933
|
});
|
|
932
934
|
writeTool({
|
|
@@ -1114,6 +1116,8 @@ export function registerModelLane(tools) {
|
|
|
1114
1116
|
throw new ToolRefusalError({ status: "refused", blocker: "model-summary-empty", message: "数据标题 summary 不允许为空(平台 validateNotEmpty 同语义)" });
|
|
1115
1117
|
normalizeSummaryInput(args.summary);
|
|
1116
1118
|
},
|
|
1119
|
+
lintScope: "full",
|
|
1120
|
+
lintUnchecked: ["platform-side-validation"],
|
|
1117
1121
|
});
|
|
1118
1122
|
writeTool({
|
|
1119
1123
|
tools,
|
package/dist/lanes/online-js.js
CHANGED
|
@@ -55,6 +55,41 @@ function readCustomScriptSource(rawHtml) {
|
|
|
55
55
|
? { present: true, script, sha256: createHash("sha256").update(script, "utf8").digest("hex"), elementCount: elements.length }
|
|
56
56
|
: { present: false, script: null, sha256: "", elementCount: elements.length, notCollected: true, notCollectedReason: "customScript 不存在,无法计算脚本哈希" };
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* R75-B(2026-11-18):compose 的两道门都是「读面可判、但在 execute 里」——
|
|
60
|
+
* dry-run 绿灯、真写拒(investigate-B E2 实证)。抽成共享函数,dry-run 与真写
|
|
61
|
+
* 逐字同源;只读 + 拒绝,不引入第二写路径。
|
|
62
|
+
*/
|
|
63
|
+
function assertComposeArgs(args) {
|
|
64
|
+
const removing = args.remove === true || args.source === "";
|
|
65
|
+
if (!removing && args.source === undefined)
|
|
66
|
+
throw new ToolRefusalError({
|
|
67
|
+
status: "refused",
|
|
68
|
+
blocker: "onlinejs-source-required",
|
|
69
|
+
message: "必须提供 source(在线 JS 代码),或显式传 remove:true(移除 customScript)",
|
|
70
|
+
});
|
|
71
|
+
if (args.remove === true && args.source !== undefined && args.source !== "")
|
|
72
|
+
throw new ToolRefusalError({
|
|
73
|
+
status: "refused",
|
|
74
|
+
blocker: "onlinejs-remove-source-conflict",
|
|
75
|
+
message: "remove:true 与非空 source 互斥——要移除就只传 remove:true;要写脚本就传 source(增量并入)或 source+replace:true(整段替换)",
|
|
76
|
+
});
|
|
77
|
+
return removing;
|
|
78
|
+
}
|
|
79
|
+
function assertReplaceConfirmed(args, targetSheetCode, existingScriptState) {
|
|
80
|
+
if (args.replace !== true || !existingScriptState.present || args.confirmReplaceSha256 === existingScriptState.sha256)
|
|
81
|
+
return;
|
|
82
|
+
throw new ToolRefusalError({
|
|
83
|
+
status: "refused",
|
|
84
|
+
blocker: "onlinejs-replace-confirmation-required",
|
|
85
|
+
schemaCode: args.schemaCode,
|
|
86
|
+
sheetCode: targetSheetCode,
|
|
87
|
+
previousSha256: existingScriptState.sha256,
|
|
88
|
+
...(args.confirmReplaceSha256 !== undefined ? { providedSha256: args.confirmReplaceSha256 } : {}),
|
|
89
|
+
message: "replace:true 将覆盖已有线上脚本;必须传 confirmReplaceSha256 且与当前脚本 SHA-256 完全一致。未写入任何内容。",
|
|
90
|
+
nextCommand: `omc call onlinejs.get --args '${JSON.stringify({ schemaCode: args.schemaCode, sheetCode: targetSheetCode })}'`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
58
93
|
export function registerOnlineJsLane(tools) {
|
|
59
94
|
tools.push(defineTool({
|
|
60
95
|
name: "onlinejs.get",
|
|
@@ -121,11 +156,7 @@ export function registerOnlineJsLane(tools) {
|
|
|
121
156
|
},
|
|
122
157
|
execute: async (session, args) => {
|
|
123
158
|
const shouldPublish = args.publish !== false;
|
|
124
|
-
const removing = args
|
|
125
|
-
if (!removing && args.source === undefined)
|
|
126
|
-
throw new Error("必须提供 source,或显式传 remove:true");
|
|
127
|
-
if (args.remove === true && args.source !== undefined && args.source !== "")
|
|
128
|
-
throw new Error("remove:true 不能与非空 source 同时传入");
|
|
159
|
+
const removing = assertComposeArgs(args);
|
|
129
160
|
// r28e F9:和同 lane 其它工具一致——省略 sheetCode 即模型码槽位。
|
|
130
161
|
const targetSheetCode = args.sheetCode ?? args.schemaCode;
|
|
131
162
|
// Keep the human summary truthful when the caller relies on the documented
|
|
@@ -136,18 +167,7 @@ export function registerOnlineJsLane(tools) {
|
|
|
136
167
|
const existingRaw = typeof existingSheet?.draftHtmlJson === "string" ? existingSheet.draftHtmlJson : undefined;
|
|
137
168
|
const existingPublishedRaw = typeof existingSheet?.publishedHtmlJson === "string" ? existingSheet.publishedHtmlJson : undefined;
|
|
138
169
|
const existingScriptState = readCustomScriptSource(existingRaw ?? existingPublishedRaw);
|
|
139
|
-
|
|
140
|
-
throw new ToolRefusalError({
|
|
141
|
-
status: "refused",
|
|
142
|
-
blocker: "onlinejs-replace-confirmation-required",
|
|
143
|
-
schemaCode: args.schemaCode,
|
|
144
|
-
sheetCode: targetSheetCode,
|
|
145
|
-
previousSha256: existingScriptState.sha256,
|
|
146
|
-
...(args.confirmReplaceSha256 !== undefined ? { providedSha256: args.confirmReplaceSha256 } : {}),
|
|
147
|
-
message: "replace:true 将覆盖已有线上脚本;必须传 confirmReplaceSha256 且与当前脚本 SHA-256 完全一致。未写入任何内容。",
|
|
148
|
-
nextCommand: `omc call onlinejs.get --args '${JSON.stringify({ schemaCode: args.schemaCode, sheetCode: targetSheetCode })}'`,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
170
|
+
assertReplaceConfirmed(args, targetSheetCode, existingScriptState);
|
|
151
171
|
const existingCompat = validateHtmlRender(existingRaw);
|
|
152
172
|
// A persisted legacy face may contain an object or malformed elements.
|
|
153
173
|
// Do not pass any of it through: discard the unproven face and rebuild
|
|
@@ -281,15 +301,18 @@ export function registerOnlineJsLane(tools) {
|
|
|
281
301
|
dryRunPayload: // r23 F4:dry-run 必须走与真写相同的 compose 校验路径(含 replace/merge 的
|
|
282
302
|
// wrapper 判定),否则 dry-run 过、真写拒——探针按 dry-run 绿灯写正式调用被拒。
|
|
283
303
|
async (session, args) => {
|
|
284
|
-
const
|
|
304
|
+
const targetSheetCode = args.sheetCode ?? args.schemaCode;
|
|
305
|
+
const current = await wireCall(session, { path: ENDPOINTS.sheetGet, query: { schemaCode: args.schemaCode, sheetCode: targetSheetCode } });
|
|
285
306
|
const sheet = (current.data ?? null);
|
|
286
307
|
const raw = typeof sheet?.draftHtmlJson === "string" ? sheet.draftHtmlJson : "";
|
|
308
|
+
const publishedRaw = typeof sheet?.publishedHtmlJson === "string" ? sheet.publishedHtmlJson : undefined;
|
|
309
|
+
const removing = assertComposeArgs(args);
|
|
310
|
+
// 与 execute 同源:replace 覆盖确认读 draft ?? published(此前 dry-run 只看
|
|
311
|
+
// draft,已有的发布面脚本在 dry-run 里看不见 → 真写拒)。
|
|
312
|
+
assertReplaceConfirmed(args, targetSheetCode, readCustomScriptSource(raw !== "" ? raw : publishedRaw));
|
|
287
313
|
const compat = validateHtmlRender(raw);
|
|
288
314
|
const elements = compat.ok ? parseLayoutElements(raw) : [];
|
|
289
315
|
const existingScript = String(elements.find((element) => element.id === "customScript")?.innerHTML ?? "");
|
|
290
|
-
const removing = args.remove === true || args.source === "";
|
|
291
|
-
if (!removing && args.source === undefined)
|
|
292
|
-
throw new Error("必须提供 source,或显式传 remove:true");
|
|
293
316
|
const composed = removing ? "" : composeCustomScript(existingScript, args.source, args.replace === true ? "replace" : "merge");
|
|
294
317
|
const composedBytes = Buffer.byteLength(composed, "utf8");
|
|
295
318
|
const previewSize = 200;
|
package/dist/lanes/perm.js
CHANGED
|
@@ -273,6 +273,13 @@ export function registerPermLane(tools) {
|
|
|
273
273
|
const performed = await wireCall(session, { path: ENDPOINTS.permissionGroupUpdate, method: action === "update" ? "PUT" : "POST", body });
|
|
274
274
|
const result = (performed.data && typeof performed.data === "object" ? performed.data : body);
|
|
275
275
|
return { performed: { errcode: performed.errcode, action }, readback: (await read(String(result.id ?? id ?? ""))) };
|
|
276
|
+
}, preflight: (args) => {
|
|
277
|
+
// R75-B(2026-11-18):id/enabled 是纯参数门——必须在 preflight,dry-run 与
|
|
278
|
+
// 真写同答案(此前只躺在 execute 里,--dry-run 绿灯、真写 refused)。
|
|
279
|
+
if (args.action === "delete" && !args.id)
|
|
280
|
+
throw new ToolRefusalError({ status: "refused", blocker: "permission-group-id-required", message: "delete 需要 id" });
|
|
281
|
+
if (args.action === "status" && (!args.id || args.enabled === undefined))
|
|
282
|
+
throw new ToolRefusalError({ status: "refused", blocker: "permission-group-status-shape", message: "status 需要 id 与 enabled" });
|
|
276
283
|
} });
|
|
277
284
|
tools.push(defineTool({ name: "perm.user", layer: "low", kind: "read", lane: PERM_LANE, scope: PERM_TOOLS["perm.user"].scope, description: PERM_TOOLS["perm.user"].description, search: { intents: ["某人有哪些权限", "查用户权限", "看这个人的权限"] }, inputSchema: { environment: environmentArg, capability: capabilityArg, userId: z.string().min(1), appCode: z.string().min(1), schemaCode: z.string().optional() }, handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
|
|
278
285
|
let data;
|
|
@@ -277,6 +277,14 @@ export function registerRuleLifecycleLane(tools) {
|
|
|
277
277
|
},
|
|
278
278
|
rollback: lifecycleRollbackSpec("rule.disable"),
|
|
279
279
|
});
|
|
280
|
+
const assertRuleDeletable = (ruleCode) => {
|
|
281
|
+
if (PLATFORM_TRIGGER_RULE_CODES.has(ruleCode))
|
|
282
|
+
throw new ToolRefusalError({
|
|
283
|
+
status: "refused",
|
|
284
|
+
blocker: "rule-preset-delete-unreachable",
|
|
285
|
+
message: `ruleCode "${ruleCode}" 是平台预置触发规则——list_by_schemacode 会自动重灌缺失预置(BusinessRuleFacadeImpl.listViewsBySchemaCode:179-185),API 删除不可达且会增殖版本行;预置规则请用 rule.save 覆盖图或 rule.disable 停用`,
|
|
286
|
+
});
|
|
287
|
+
};
|
|
280
288
|
writeTool({
|
|
281
289
|
tools,
|
|
282
290
|
name: "rule.delete",
|
|
@@ -290,12 +298,8 @@ export function registerRuleLifecycleLane(tools) {
|
|
|
290
298
|
// listViewsBySchemaCode re-fills any missing preset for the schema, so
|
|
291
299
|
// deleting one via the API is unreachable (it resurrects on the next
|
|
292
300
|
// list). Refuse up front instead of "succeeding" and multiplying rows.
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
status: "refused",
|
|
296
|
-
blocker: "rule-preset-delete-unreachable",
|
|
297
|
-
message: `ruleCode "${args.ruleCode}" 是平台预置触发规则——list_by_schemacode 会自动重灌缺失预置(BusinessRuleFacadeImpl.listViewsBySchemaCode:179-185),API 删除不可达且会增殖版本行;预置规则请用 rule.save 覆盖图或 rule.disable 停用`,
|
|
298
|
-
});
|
|
301
|
+
// R75-B:同一道门同时放进 preflight(纯参数、零 wire)——dry-run 与真写同答案。
|
|
302
|
+
assertRuleDeletable(args.ruleCode);
|
|
299
303
|
await assertRuleSchemaExists(session, args.schemaCode);
|
|
300
304
|
const list = await wireCall(session, { path: ENDPOINTS.businessRuleListBySchemaCode, query: { schemaCode: args.schemaCode } });
|
|
301
305
|
const row = wireRows(list.data).find((item) => item.code === args.ruleCode);
|
|
@@ -305,12 +309,21 @@ export function registerRuleLifecycleLane(tools) {
|
|
|
305
309
|
const readback = await wireCall(session, { path: ENDPOINTS.businessRuleListBySchemaCode, query: { schemaCode: args.schemaCode } });
|
|
306
310
|
return { performed: { errcode: performed.errcode }, readback: { absent: !wireRows(readback.data).some((item) => item.code === args.ruleCode) } };
|
|
307
311
|
},
|
|
312
|
+
preflight: (args) => assertRuleDeletable(args.ruleCode),
|
|
308
313
|
rollback: lifecycleRollbackSpec("rule.delete"),
|
|
309
314
|
});
|
|
310
315
|
// Round 10 issue 05 — lifecycle batch. Disabling a model's rules one by one was
|
|
311
316
|
// N calls; this flips `enabled:false` on every matching rule in one tool. Only
|
|
312
317
|
// CUSTOM rules by default (platform preset trigger rows must not be disabled —
|
|
313
318
|
// they are platform-managed); `includePresets:true` opts in explicitly.
|
|
319
|
+
// R75-B(2026-11-18):只依赖参数的门必须在 preflight —— dry-run 与真写同答案。
|
|
320
|
+
// 此前 `ids` 重复检查在 execute 里:`--dry-run` 绿灯、真写 refused
|
|
321
|
+
// (investigate-B E6 实证)。同一个函数两处调用,语义逐字一致。
|
|
322
|
+
const assertRuleRunIdsNotDuplicated = (ids) => {
|
|
323
|
+
const unique = [...new Set(ids.map(String))];
|
|
324
|
+
if (unique.length !== ids.length)
|
|
325
|
+
throw new ToolRefusalError({ status: "refused", blocker: "rule-run-ids-duplicated", message: "ids 有重复项——按去重后的列表执行,别让同一行在一条规则里被执行两次" });
|
|
326
|
+
};
|
|
314
327
|
writeTool({
|
|
315
328
|
tools,
|
|
316
329
|
name: "rule.run",
|
|
@@ -326,9 +339,8 @@ export function registerRuleLifecycleLane(tools) {
|
|
|
326
339
|
},
|
|
327
340
|
execute: async (session, args) => {
|
|
328
341
|
await assertRuleSchemaExists(session, args.schemaCode);
|
|
342
|
+
assertRuleRunIdsNotDuplicated(args.ids);
|
|
329
343
|
const ids = [...new Set(args.ids.map(String))];
|
|
330
|
-
if (ids.length !== args.ids.length)
|
|
331
|
-
throw new ToolRefusalError({ status: "refused", blocker: "rule-run-ids-duplicated", message: "ids 有重复项——按去重后的列表执行,别让同一行在一条规则里被执行两次" });
|
|
332
344
|
const list = await wireCall(session, { path: ENDPOINTS.businessRuleListBySchemaCode, query: { schemaCode: args.schemaCode } });
|
|
333
345
|
const row = wireRows(list.data).find((item) => String(item.code) === args.ruleCode);
|
|
334
346
|
if (!row)
|
|
@@ -421,6 +433,7 @@ export function registerRuleLifecycleLane(tools) {
|
|
|
421
433
|
},
|
|
422
434
|
};
|
|
423
435
|
},
|
|
436
|
+
preflight: (args) => assertRuleRunIdsNotDuplicated(args.ids),
|
|
424
437
|
});
|
|
425
438
|
writeTool({
|
|
426
439
|
tools,
|
package/dist/lanes/workflow.js
CHANGED
|
@@ -2684,6 +2684,14 @@ export function registerWorkflowLane(tools) {
|
|
|
2684
2684
|
// only) and reports the edge delta; the contraction refusal fires here too.
|
|
2685
2685
|
async (session, args) => {
|
|
2686
2686
|
const template = args.template ?? {};
|
|
2687
|
+
// R75-B(2026-11-18):dry-run 逐个补上真写的本地门——此前只跑 merge +
|
|
2688
|
+
// render + 条件枚举,validateCallerActivities / lintWorkflowTemplate /
|
|
2689
|
+
// 子表必填 / 首活动发起人 / 参与人 scope 都只在 execute(investigate-B E8:
|
|
2690
|
+
// 首活动非 Originator 的 dry-run 与真写给出不同 blocker)。
|
|
2691
|
+
validateCallerActivities(template, "workflow.update");
|
|
2692
|
+
validateWorkflowRouteConditions(template, "workflow.update");
|
|
2693
|
+
lintWorkflowTemplate(template, "workflow.update");
|
|
2694
|
+
await refuseRequiredOnChildTableFields(session, args.schemaCode, template, "workflow.update");
|
|
2687
2695
|
const merge = args.merge === true || (args.merge !== false && activitiesLackBoundaries(template));
|
|
2688
2696
|
const draft = await getWorkflowDraftOrNull(session, args.code);
|
|
2689
2697
|
if (draft === null)
|
|
@@ -2694,7 +2702,11 @@ export function registerWorkflowLane(tools) {
|
|
|
2694
2702
|
message: `流程 ${args.code} 不存在(get_draft 401001 缺席)——先 workflow.create 再 update/publish`,
|
|
2695
2703
|
});
|
|
2696
2704
|
const body = await mergedTemplateBody(session, args.schemaCode, args.code, template, merge);
|
|
2705
|
+
await backfillDesignerDefaults(session, args.schemaCode, body, template);
|
|
2706
|
+
// 与 execute 同序:首活动发起人 → render → 参与人 scope。
|
|
2707
|
+
assertFirstActivityIsOriginator(template, "workflow.update", body);
|
|
2697
2708
|
validateWorkflowRender(body, "workflow.update");
|
|
2709
|
+
await assertRoleParticipantScopes(session, body);
|
|
2698
2710
|
// r62a-F2(P1-6):条件枚举校验必须在 dry-run 同门跑——GE/GT= 这类直觉
|
|
2699
2711
|
// 缩写此前只有真写才拒,dry-run 假绿(wouldChange:true 无 issues)。
|
|
2700
2712
|
validateWorkflowRouteConditions(body, "workflow.update");
|
|
@@ -2740,6 +2752,8 @@ export function registerWorkflowLane(tools) {
|
|
|
2740
2752
|
: "本次未给 routes/edges/rules:草稿连线原样沿用(新增节点才会自动接链)",
|
|
2741
2753
|
};
|
|
2742
2754
|
},
|
|
2755
|
+
lintScope: "full",
|
|
2756
|
+
lintUnchecked: ["platform-side-validation", "post-write-readback"],
|
|
2743
2757
|
rollback: workflowRollbackSpec("workflow.update"),
|
|
2744
2758
|
});
|
|
2745
2759
|
writeTool({
|
|
@@ -3841,6 +3855,17 @@ export function registerWorkflowLane(tools) {
|
|
|
3841
3855
|
},
|
|
3842
3856
|
};
|
|
3843
3857
|
},
|
|
3858
|
+
preflight: (args) => {
|
|
3859
|
+
// R75-B(2026-11-18):目标形状是纯参数门——此前只在 execute 里,dry-run
|
|
3860
|
+
// 绿灯、真写 tool-input-invalid。schemaCode→workflowCode 的解析仍留给
|
|
3861
|
+
// execute(需要 session),这里只拒绝「怎么补都缺」的形状。
|
|
3862
|
+
if (args.permissionId !== undefined && typeof args.permissionId === "string" && args.permissionId !== "")
|
|
3863
|
+
return;
|
|
3864
|
+
if (args.workflowCode === undefined && args.schemaCode === undefined)
|
|
3865
|
+
throw new ToolInputError({ status: "error", blocker: "tool-input-invalid", tool: "workflow.removePermission", message: "需要 permissionId(推荐),或 workflowCode(/schemaCode)+ unitId + unitType(缺流程定位)" });
|
|
3866
|
+
if (args.unitId === undefined || args.unitType === undefined)
|
|
3867
|
+
throw new ToolInputError({ status: "error", blocker: "tool-input-invalid", tool: "workflow.removePermission", message: "需要 permissionId(推荐),或 workflowCode(/schemaCode)+ unitId + unitType(缺主体定位)" });
|
|
3868
|
+
},
|
|
3844
3869
|
rollback: {
|
|
3845
3870
|
target: (args) => `workflow-permission:${String(args.workflowCode ?? args.schemaCode ?? args.permissionId ?? "")}`,
|
|
3846
3871
|
read: async (session, args) => {
|