@stalfh233/omc-cli 0.6.68 → 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/capability-overview.js +4 -1
- package/dist/cli.js +77 -22
- package/dist/command-transport.js +9 -8
- package/dist/discovery.js +9 -0
- package/dist/goal-routes.js +7 -2
- package/dist/graph.js +216 -25
- package/dist/lanes/apply-changes.js +4 -0
- package/dist/lanes/b2-registration.js +47 -21
- package/dist/lanes/businessrule.js +55 -9
- package/dist/lanes/datarule.js +36 -25
- package/dist/lanes/field.js +35 -26
- package/dist/lanes/list-view-contract.js +1 -1
- package/dist/lanes/list-view-shapes.js +28 -19
- package/dist/lanes/list-view.js +20 -4
- 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/tool-types.js +2 -0
- package/dist/write.js +55 -5
- package/package.json +3 -3
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) {
|
|
@@ -17,7 +17,7 @@ export const LIST_VIEW_WIRE = Object.freeze({
|
|
|
17
17
|
configureActions: "actions -> queryActions [{actionCode,name,icon,queryActionType,systemAction,serviceCode,serviceMethod,customService,associationCode,associationType,sortKey}]; queryActionType QueryActionType numeric QUERY(1)/ADD(2)/.../BATCH_SUBMIT(23); associationType QueryActionRelativeType numeric BIZSHEET(0)/WORKFLOW(1); associationCode/associationType are the JSON names of the DTO fields relativeCode/queryActionRelativeType (@JsonProperty); omitted leaves the existing actions untouched, provided MERGES into the effective set by actionCode (live 2026-09-17: query/update replaces-then-re-adds the submitted list, so a merge keeps the platform's built-in 新增/删除/导入/导出 and updates a matching actionCode — replaceActions:true restores the authoritative full set, defaultActions:true re-seeds the platform default set); query/get auto-injects default actions (qr_code/batch_print/batch_update/import_attachment/export_attachment/batch_submit) and query/update resets sortKey to i+1",
|
|
18
18
|
configurePresentation: "presentation -> queryPresentation {clientType,htmlJson,actionsJson,columnsJson,queryViewDataSource,schemaRelations,options}; htmlJson/actionsJson/columnsJson JSON strings are decoded once before render-shape validation (html element tagName+attrs, action actionCode/name/icon, column propertyCode/propertyType); invalid input refuses with listview-presentation-render-invalid before wire and is never double-encoded; clientType is forced to PC by query/update; schemaRelations is platform-derived from the queryColumns tree (resolveRelations) and overwrites your input; a non-empty htmlJson updates the environment record, which query/delete cleans up; omitted leaves the existing presentation untouched (the read-face object must be echoed, because saveBizQueryDetail removes every presentation whose clientType matches before re-adding), provided replaces it",
|
|
19
19
|
configureButtons: "buttons -> customButtons [{code,name,useLocation,bindAction,operateType,showPermCode,showPermType,hint,targetCode,targetObjCode,description,actionConfig}]; actionConfig is fail-closed for rendering: SCRIPT requires scriptData, BUSINESS_RULE/FLOW requires targetCode, ADD_DATA/FORM requires expanded schemaCodeVal/formListData/configureList; invalid input refuses before wire; readback includes buttonsRenderCompat; sent as the query/update body customButtonJson JSON array string; BizButtonFacadeImpl.addBizButtonList(String,...) runs only when customButtonJson is a JSON array, then batchDeleteByTrigger over the schema and its published child-table codes and re-adds (so provided replaces every button under the QUERY trigger, while omitted/absent customButtonJson changes nothing); triggerType is forced to QUERY, triggerCode to the view code, schemaCode backfilled, sortKey reset to the array index; name/code/useLocation/bindAction/operateType are required; bindAction ButtonBindAction name LIST(1)/FORM(2)/ADD_DATA(3)/FLOW(4)/BUSINESS_RULE(5)/SCRIPT(6)/CUSTOM_PAGE(7)/WORKFLOW_CENTER_PAGE(8)/FRONT_EVENT(9)/AGENT(10); useLocation ButtonUseLocation name LIST(1)/FORM(2)/ROW(3); operateType ButtonOperateType name WITH_VIEW(1)/WITH_OUT_VIEW(2); showPermType ButtonShowPermType name BIND_SYS_BUTTON(1)/BIND_BUSINESS_RULE(2)/BIND_FRONT_EVENT_BUTTON(3); duplicate code fails BIZ_QUERY_ACTION_CODE_EXIST; query/get returns customButtons[] (non-admin users are filtered by the permission combination); ModelManagementFacadeImpl.removeBizQuery deletes QUERY buttons for the schema and its child tables on query/delete",
|
|
20
|
-
buttonsActionConfig: "ticket 75: an ADD_DATA/FORM button's model/form target binding lives in actionConfig — schemaCodeVal (target model object {code,id:<app-tree node id>,name,type:'BizModel',appCode,appName,published}) + formListData[] (target forms, sheetType 0 默认表单 only evidenced) + configureList[] (data assignments; isConst is STRING 'true'/'false', operator key is OptionType capital O,
|
|
20
|
+
buttonsActionConfig: "ticket 75: an ADD_DATA/FORM button's model/form target binding lives in actionConfig — schemaCodeVal (target model object {code,id:<app-tree node id>,name,type:'BizModel',appCode,appName,published}) + formListData[] (target forms, sheetType 0 默认表单 only evidenced) + configureList[] (data assignments; isConst is STRING 'true'/'false'; constant assignment uses isConst:'true' + currentDataInput:<value> — r73 live 8.6.41 evidence, dynamic row reads currentDataInput:null; operator key is OptionType capital O, 'Eq' evidences both kinds; currentDataItem/targetDataItem are array-wrapped inline field copies and may be passed back as-is on round-trip) — while targetCode/targetObjCode are measured always-null and NOT consumed for these bind actions (refused as listview-button-target-ineffective; FLOW keeps them); high-level button params targetModel/targetForm/configureList expand into that shape from authoritative readback (app tree node, bizsheet/get, published field rows) and fail closed (listview-button-target-unresolved) before any query/update",
|
|
21
21
|
configureOptions: "options -> the query header BizQueryModel.options String column (h_biz_query.options TEXT), parsed by the platform as BizQueryOption {pagingSetting:{pageSize,showTotal}, listViewModeSetting:{mode,canSwitch}} (8.6.26 defaultOption = pageSize 20 / showTotal true / mode \"spreadsheet\" / canSwitch false); a raw JSON string is sent verbatim, an object is JSON-stringified; rowColorSetting has no 8.6.26 class so the object form refuses unknown keys; BizQueryController.update sets publish=TRUE before updateBizQuery, so after the first configure only the name/options-diff branch (ModelManagementFacadeImpl:1966-1973) persists options: an omitted body key (null) would overwrite a non-null stored value, so omitted must echo the read-face options (the tool spreads query/get) while provided replaces the whole string; BizQueryFacadeImpl.getBizQuery copies options from the entity on readback (no controller parse); BizObjectFacadeImpl.getShowTotal reads pagingSetting.showTotal (so pagingSetting must not be null)",
|
|
22
22
|
configurePresentationType: "presentationType -> the query header BizQueryHeaderModel.queryPresentationType QueryPresentationType enum; sent as the name LIST/BOARD/CALENDAR/GANTT (@JsonValue getIndex() whose index equals the name, @JsonCreator get(String) parses); updateBizQuery always assigns it (:1955, not gated by publish or any diff), so an omitted body key (null) would overwrite a stored type and the tool must echo the read-face value (query/get inherits it via BeanUtils.copyProperties at BizQueryFacadeImpl:346); gantt -> queryGanttModel BizQueryGanttModel {queryId,schemaCode,startTimePropertyCode,endTimePropertyCode,progressPropertyCode,titlePropertyCode,preDependencyPropertyCode,endDependencyPropertyCode,levelPropertyCode,milepostCode,sortKey,configJson,liableManCode,statusCode,defaultPrecision}; saveBizQueryDetail only swaps the gantt when the submitted model is non-null (:178-183), so an omitted gantt leaves the stored one untouched; when presentationType is GANTT the controller requires the gantt with non-null startTimePropertyCode/endTimePropertyCode/titlePropertyCode (validateNotEmptyGantt :1121-1136); updateBizQuery forces levelPropertyCode=parentId for TREE models (:1999-2001) and saveBizQueryDetail backfills queryId (:179-181); addBizQuery allows at most one GANTT view per schema (BIZ_QUERY_GANTT_EXIST :1787)",
|
|
23
23
|
configureLayer: "queryLayer -> BizQueryModel.queryLayer List<BizQueryLayer> (name,layerType,fieldCode,displayField[],layerFieldList[{schemaCode,schemaName,fieldCode,fieldName,displayField[],children[]}]); a real JSON array (not a String column), sent as an array; multiTableHeaderConfig -> BizQueryModel.multiTableHeaderConfig String (HeaderConfig[] JSON {type,name,field,propertyType,children[]} parsed by EasyExcelUtils/DefaultDataIEFileOperateServiceImpl via JSONObject.parseArray); a raw JSON string is sent verbatim, an array is JSON-stringified; saveBizQueryDetail assigns both unconditionally (:184-186, unlike the gantt non-null guard), so an omitted key would overwrite the stored value and the tool must echo the read-face values (BizQueryFacadeImpl.getBizQuery always carries them: queryLayer from the detail config or null, multiTableHeaderConfig from the config or \"\", :283-293/344-345); provided replaces the whole value. NOTE: \"按字段分组\" (field grouping) is NOT a proven capability on this surface — queryLayer is a passthrough (no schema/enum validation) and every real 8.6.26 view read back an empty queryLayer, so layerType semantics/grouping behavior are UNVERIFIED; do not guess-write queryLayer to satisfy a grouping requirement (2026-10-06 sandbox: agent correctly refused to fabricate it).",
|
|
@@ -208,10 +208,16 @@ const buttonConfigureListArg = z
|
|
|
208
208
|
.object({
|
|
209
209
|
currentDataItemId: z.string().min(1).optional().describe("源字段 code(当前视图模型上的字段);缺失由 dry-lint 拒绝(listview-buttons-invalid)"),
|
|
210
210
|
targetDataItemId: z.string().min(1).optional().describe("目标字段 code(targetModel 上的字段);缺失由 dry-lint 拒绝(listview-buttons-invalid)"),
|
|
211
|
-
isConst: z.string().optional().describe('
|
|
212
|
-
OptionType: z.string().optional().describe("赋值算子(注意大写 O
|
|
211
|
+
isConst: z.string().optional().describe('常量开关(字符串 "true"/"false"):"true" 表示常量赋值,必须同时给 currentDataInput'),
|
|
212
|
+
OptionType: z.string().optional().describe("赋值算子(注意大写 O);缺省 Eq"),
|
|
213
|
+
currentDataInput: z.string().optional().describe('常量赋值的值(isConst:"true" 时必填;读面同名字段,r73 真机取证)'),
|
|
214
|
+
// 读→写回灌(线上 #40 #5):listview.get 的条目带 targetDataItem/currentDataItem
|
|
215
|
+
// 内联副本。原样回传时这两个键在此显式声明(工具不消费,只避免 schema 面把
|
|
216
|
+
// 它们标成 additionalProperties:false 诱导调用方手工裁剪丢掉 currentDataInput)。
|
|
217
|
+
targetDataItem: z.unknown().optional().describe("读面内联副本;回灌原样带回即可"),
|
|
218
|
+
currentDataItem: z.unknown().optional().describe("读面内联副本;回灌原样带回即可"),
|
|
213
219
|
})
|
|
214
|
-
.describe("actionConfig.configureList[]
|
|
220
|
+
.describe("actionConfig.configureList[] 数据赋值条目。读→写映射:currentDataItemId/targetDataItemId(字段 code,必填)、isConst(\"true\"=常量赋值)、currentDataInput(常量值,isConst=true 必填)、OptionType(缺省 Eq);targetDataItem/currentDataItem 是读面内联副本,回灌时原样带回即可");
|
|
215
221
|
export const listViewButtonArg = z
|
|
216
222
|
.object({
|
|
217
223
|
code: z.string().min(1),
|
|
@@ -219,12 +225,12 @@ export const listViewButtonArg = z
|
|
|
219
225
|
useLocation: buttonUseLocationArg,
|
|
220
226
|
bindAction: buttonBindActionArg,
|
|
221
227
|
operateType: buttonOperateTypeArg,
|
|
222
|
-
showPermCode: z.string().optional(),
|
|
223
|
-
showPermType: buttonShowPermTypeArg.optional(),
|
|
224
|
-
hint: z.string().optional(),
|
|
225
|
-
targetCode: z.string().optional(),
|
|
226
|
-
targetObjCode: z.string().optional(),
|
|
227
|
-
description: z.string().optional(),
|
|
228
|
+
showPermCode: z.string().nullable().optional().describe("读面 null 可回灌"),
|
|
229
|
+
showPermType: buttonShowPermTypeArg.nullable().optional(),
|
|
230
|
+
hint: z.string().nullable().optional(),
|
|
231
|
+
targetCode: z.string().nullable().optional().describe("FLOW=流程 code;ADD_DATA/FORM 读面 null(可回灌)"),
|
|
232
|
+
targetObjCode: z.string().nullable().optional(),
|
|
233
|
+
description: z.string().nullable().optional(),
|
|
228
234
|
targetModel: z.string().min(1).optional().describe("ADD_DATA/FORM 目标模型 code;工具读回应用树节点内联展开成 actionConfig.schemaCodeVal(targetCode/targetObjCode 对这两类按钮无效——实测恒 null 不参与)"),
|
|
229
235
|
targetForm: z.string().min(1).optional().describe("ADD_DATA/FORM 目标表单 code;缺省用目标模型的默认表单;展开成 actionConfig.formListData"),
|
|
230
236
|
configureList: z.array(buttonConfigureListArg).optional().describe("ADD_DATA 数据赋值;展开成 actionConfig.configureList(含 isConst:\"false\"、OptionType:\"Eq\" 与字段内联副本)"),
|
|
@@ -564,7 +570,7 @@ export function assertListViewConfigureShape(args) {
|
|
|
564
570
|
if (typeof entry.operateType !== "string" || !(entry.operateType in BUTTON_OPERATE_TYPE.index)) {
|
|
565
571
|
throw new ToolRefusalError({ status: "refused", blocker: "listview-buttons-invalid", message: `buttons operateType must be WITH_VIEW or WITH_OUT_VIEW (got ${String(entry.operateType)})` });
|
|
566
572
|
}
|
|
567
|
-
if (entry.showPermType !== undefined && (typeof entry.showPermType !== "string" || !(entry.showPermType in BUTTON_SHOW_PERM_TYPE.index))) {
|
|
573
|
+
if (entry.showPermType !== undefined && entry.showPermType !== null && (typeof entry.showPermType !== "string" || !(entry.showPermType in BUTTON_SHOW_PERM_TYPE.index))) {
|
|
568
574
|
throw new ToolRefusalError({ status: "refused", blocker: "listview-buttons-invalid", message: `buttons showPermType must be a ButtonShowPermType name (got ${String(entry.showPermType)})` });
|
|
569
575
|
}
|
|
570
576
|
if (entry.actionConfig !== undefined && typeof entry.actionConfig !== "string" && (typeof entry.actionConfig !== "object" || entry.actionConfig === null || Array.isArray(entry.actionConfig))) {
|
|
@@ -574,7 +580,7 @@ export function assertListViewConfigureShape(args) {
|
|
|
574
580
|
// (schemaCodeVal + formListData + configureList); targetCode/targetObjCode
|
|
575
581
|
// are measured always-null and NOT consumed for these bind actions.
|
|
576
582
|
if (entry.bindAction === "ADD_DATA" || entry.bindAction === "FORM") {
|
|
577
|
-
if (entry.targetCode !== undefined || entry.targetObjCode !== undefined) {
|
|
583
|
+
if ((entry.targetCode !== undefined && entry.targetCode !== null) || (entry.targetObjCode !== undefined && entry.targetObjCode !== null)) {
|
|
578
584
|
throw new ToolRefusalError({
|
|
579
585
|
status: "refused",
|
|
580
586
|
blocker: "listview-button-target-ineffective",
|
|
@@ -630,8 +636,11 @@ export function assertListViewConfigureShape(args) {
|
|
|
630
636
|
if (typeof assignment.currentDataItemId !== "string" || assignment.currentDataItemId.length === 0 || typeof assignment.targetDataItemId !== "string" || assignment.targetDataItemId.length === 0) {
|
|
631
637
|
throw new ToolRefusalError({ status: "refused", blocker: "listview-buttons-invalid", message: `buttons ${String(entry.code)}:configureList 每条需要 currentDataItemId + targetDataItemId(字段 code)` });
|
|
632
638
|
}
|
|
633
|
-
if (assignment.isConst !== undefined && assignment.isConst !== "false") {
|
|
634
|
-
throw new ToolRefusalError({ status: "refused", blocker: "listview-buttons-invalid", message: `buttons ${String(entry.code)}:configureList.isConst
|
|
639
|
+
if (assignment.isConst !== undefined && assignment.isConst !== "true" && assignment.isConst !== "false") {
|
|
640
|
+
throw new ToolRefusalError({ status: "refused", blocker: "listview-buttons-invalid", message: `buttons ${String(entry.code)}:configureList.isConst 只接受字符串 "true"/"false"` });
|
|
641
|
+
}
|
|
642
|
+
if (assignment.isConst === "true" && (typeof assignment.currentDataInput !== "string" || assignment.currentDataInput === "")) {
|
|
643
|
+
throw new ToolRefusalError({ status: "refused", blocker: "listview-buttons-invalid", message: `buttons ${String(entry.code)}:configureList 常量赋值(isConst:"true")必须给 currentDataInput(常量值)` });
|
|
635
644
|
}
|
|
636
645
|
if (assignment.OptionType !== undefined && assignment.OptionType !== "Eq") {
|
|
637
646
|
throw new ToolRefusalError({ status: "refused", blocker: "listview-buttons-invalid", message: `buttons ${String(entry.code)}:configureList.OptionType(注意大写 O)仅 "Eq" 已取证` });
|
|
@@ -989,17 +998,17 @@ export function normalizeButtons(buttons, schemaCode, triggerCode) {
|
|
|
989
998
|
operateType: button.operateType,
|
|
990
999
|
sortKey: index,
|
|
991
1000
|
};
|
|
992
|
-
if (button.showPermCode !== undefined)
|
|
1001
|
+
if (button.showPermCode !== undefined && button.showPermCode !== null)
|
|
993
1002
|
row.showPermCode = button.showPermCode;
|
|
994
|
-
if (button.showPermType !== undefined)
|
|
1003
|
+
if (button.showPermType !== undefined && button.showPermType !== null)
|
|
995
1004
|
row.showPermType = button.showPermType;
|
|
996
|
-
if (button.hint !== undefined)
|
|
1005
|
+
if (button.hint !== undefined && button.hint !== null)
|
|
997
1006
|
row.hint = button.hint;
|
|
998
|
-
if (button.targetCode !== undefined)
|
|
1007
|
+
if (button.targetCode !== undefined && button.targetCode !== null)
|
|
999
1008
|
row.targetCode = button.targetCode;
|
|
1000
|
-
if (button.targetObjCode !== undefined)
|
|
1009
|
+
if (button.targetObjCode !== undefined && button.targetObjCode !== null)
|
|
1001
1010
|
row.targetObjCode = button.targetObjCode;
|
|
1002
|
-
if (button.description !== undefined)
|
|
1011
|
+
if (button.description !== undefined && button.description !== null)
|
|
1003
1012
|
row.description = button.description;
|
|
1004
1013
|
// BizButtonModel.actionConfig is a non-null String on the render path. The
|
|
1005
1014
|
// list runtime does `"string"==typeof a ? JSON.parse(a) : a`, then for
|
package/dist/lanes/list-view.js
CHANGED
|
@@ -234,14 +234,20 @@ async function expandButtonActionConfigs(session, viewSchemaCode, buttons) {
|
|
|
234
234
|
const targetRow = targetFieldRows.find((row) => String(row.code ?? row.propertyCode ?? "") === assignment.targetDataItemId);
|
|
235
235
|
if (!targetRow)
|
|
236
236
|
unresolved(`赋值目标字段 ${targetModel}.${assignment.targetDataItemId} 不在发布面上`);
|
|
237
|
-
|
|
237
|
+
const entry = {
|
|
238
238
|
currentDataItemId: assignment.currentDataItemId,
|
|
239
239
|
targetDataItemId: assignment.targetDataItemId,
|
|
240
240
|
targetDataItem: [{ ...targetRow, schemaCode: targetModel }],
|
|
241
241
|
currentDataItem: [{ ...sourceRow, schemaCode: viewSchemaCode }],
|
|
242
|
-
isConst: "false",
|
|
243
|
-
OptionType: "Eq",
|
|
244
|
-
}
|
|
242
|
+
isConst: assignment.isConst === "true" ? "true" : "false",
|
|
243
|
+
OptionType: typeof assignment.OptionType === "string" && assignment.OptionType ? assignment.OptionType : "Eq",
|
|
244
|
+
};
|
|
245
|
+
// r73 #5 后半(线上 #40):常量赋值(isConst:"true")→ 平台读面对的键名是
|
|
246
|
+
// currentDataInput(issue 8.6.41 实测读回该键);写面此前硬编码 isConst:"false"
|
|
247
|
+
// 并把该参数丢掉,导致「读面有常量值、写面表达不了」。现在原样透传。
|
|
248
|
+
if (entry.isConst === "true")
|
|
249
|
+
entry.currentDataInput = assignment.currentDataInput;
|
|
250
|
+
configureList.push(entry);
|
|
245
251
|
}
|
|
246
252
|
}
|
|
247
253
|
const { targetModel: _tm, targetForm: _tf, configureList: _cl, ...rest } = button;
|
|
@@ -1035,6 +1041,16 @@ export function registerListViewLane(tools) {
|
|
|
1035
1041
|
dryRunPayload: async (session, args) => {
|
|
1036
1042
|
const code = args.code ?? args.schemaCode;
|
|
1037
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
|
+
});
|
|
1038
1054
|
const childTableRefs = args.fieldCodes
|
|
1039
1055
|
.map((ref) => {
|
|
1040
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) => {
|