@stalfh233/omc-cli 0.8.9 → 0.8.11
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 +8 -1
- package/dist/goal-routes.js +59 -3
- package/dist/human-summary.js +30 -7
- package/dist/intent/capabilities/field.js +77 -3
- package/dist/intent/plan-apply.js +13 -1
- package/dist/lanes/field-contract.js +1 -1
- package/dist/lanes/field.js +92 -9
- package/dist/lanes/list-view-contract.js +2 -2
- package/dist/lanes/list-view-shapes.js +46 -0
- package/dist/lanes/list-view.js +179 -123
- package/dist/lanes/model-references.js +22 -6
- package/dist/lanes/model.js +6 -3
- package/dist/lanes/runtime-data.js +43 -19
- package/dist/model-purge.js +2 -2
- package/dist/read.js +12 -1
- package/dist/recipes/datarule.js +1 -1
- package/dist/recipes/field.js +11 -4
- package/dist/recipes/online-js.js +2 -2
- package/dist/recipes/runtime-data.js +31 -1
- package/dist/write.js +7 -2
- package/package.json +3 -3
- package/skills/omc-backend-online-coding.md +3 -0
- package/skills/omc-refusals.md +3 -0
- package/skills/omc-requirement-vocabulary.md +2 -1
package/dist/lanes/list-view.js
CHANGED
|
@@ -692,7 +692,14 @@ export function registerListViewLane(tools) {
|
|
|
692
692
|
// byte-compare. Columns project to the authorable identity (sortKey/id
|
|
693
693
|
// are re-minted by every configure). Actions are therefore OUT of the
|
|
694
694
|
// rollback snapshot (and out of the restore) by design.
|
|
695
|
-
|
|
695
|
+
// 0.8.10(探针 E / round17):系统列(name/creater/createdTime/sequenceNo…)
|
|
696
|
+
// 与动作同属平台托管面:默认视图由平台种下、每次 configure 重铸 sortKey/id,
|
|
697
|
+
// 且回滚恢复它们需要把它们当 fieldCodes 提交(会与业务字段混淆)。回滚快照
|
|
698
|
+
// 因此只保留**业务列**;恢复时 replaceColumns 只重建业务列,系统列由平台
|
|
699
|
+
// 按缺省行为处理。口径与 queryActions 出快照一致。
|
|
700
|
+
const columns = (Array.isArray(model.queryColumns) ? model.queryColumns : [])
|
|
701
|
+
.filter((column) => !SYSTEM_FIELD_CODES.has(String(column.propertyCode ?? "")))
|
|
702
|
+
.map((column) => ({ propertyCode: column.propertyCode, name: column.name, visible: column.visible }));
|
|
696
703
|
return { ...model, queryColumns: columns, queryActions: undefined };
|
|
697
704
|
},
|
|
698
705
|
inverse: ({ before, args }) => {
|
|
@@ -814,9 +821,9 @@ export function registerListViewLane(tools) {
|
|
|
814
821
|
inputSchema: {
|
|
815
822
|
schemaCode: z.string().min(1),
|
|
816
823
|
code: z.string().optional(),
|
|
817
|
-
fieldCodes: z.array(z.string()).min(1).describe("要展示的字段:可给 propertyCode
|
|
824
|
+
fieldCodes: z.array(z.string()).min(1).optional().describe("要展示的字段:可给 propertyCode 或字段显示名(唯一匹配时自动解析,歧义或不存在则拒绝,不静默跳过)。**省略 = 不动列**(只改排序/筛选/动作时可省)"),
|
|
818
825
|
hideDefaultSystemFields: z.boolean().optional().describe("是否隐藏平台默认系统列(createdTime/creater/name/sequenceNo 等);平台 update 按提交列集合决定,不能靠 visible:false"),
|
|
819
|
-
replaceColumns: z.boolean().optional().describe("把 fieldCodes 当作列集合的权威全集:未列出的已有列(含系统列)全部移除,最终列 = fieldCodes
|
|
826
|
+
replaceColumns: z.boolean().optional().describe("把 fieldCodes 当作列集合的权威全集:未列出的已有列(含系统列)全部移除,最终列 = fieldCodes(按给定顺序)。**必须同时给 fieldCodes**,只传 replaceColumns 会被拒(listview-fieldcodes-required-for-replace)。默认 false 为增量(保留已有列,省略 fieldCodes 时列完全不动)。系统列与业务列一视同仁——想要 createdTime/sequenceNo 就把它写进 fieldCodes"),
|
|
820
827
|
sorts: z.array(listViewSortArg).optional().describe("querySorts; omitted leaves the existing sorts untouched, provided replaces them。成员键:propertyCode + direction(ASC/DESC),其余可省"),
|
|
821
828
|
conditions: z.array(listViewConditionArg).optional().describe("queryConditions; omitted leaves the existing conditions untouched, provided replaces them(2.1.5 树视图三键原样带回;值变化默认拒 listview-tree-conditions-changed)"),
|
|
822
829
|
allowTreeConditionChange: z.boolean().optional().describe("仅当确认要改写树过滤组时传 true:允许提交值与基线的 treeLimitScopeType/treeLimitConditionGroup/treeDefaultConditionGroup 不同(新值原样写入);默认 false 时值不同即拒 listview-tree-conditions-changed。本参数只放行值差异,不放行缺键——基线有值而提交行没带仍拒 listview-tree-conditions-would-be-lost。"),
|
|
@@ -911,72 +918,79 @@ export function registerListViewLane(tools) {
|
|
|
911
918
|
let sortKey = columns.reduce((max, c) => Math.max(max, Number(c.sortKey) || 0), 0);
|
|
912
919
|
const added = [];
|
|
913
920
|
const updated = [];
|
|
914
|
-
//
|
|
915
|
-
//
|
|
916
|
-
//
|
|
917
|
-
//
|
|
918
|
-
const
|
|
919
|
-
if (
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
})
|
|
937
|
-
.filter((code) => typeof code === "string");
|
|
938
|
-
if (childTableRefs.length > 0) {
|
|
939
|
-
const alternatives = args.fieldCodes.filter((ref) => {
|
|
921
|
+
// F4(probe F / 0.8.11):fieldCodes 可选。省略时**不动列**——columns 是
|
|
922
|
+
// query/get 的读面回声,下面原样提交(平台 query/update 是整体保存,
|
|
923
|
+
// 必须带回既有 queryColumns,不能用空集合重建,也不触碰 replaceColumns)。
|
|
924
|
+
// 只改 sorts/conditions/actions 的调用因此不再需要重发整份列集合。
|
|
925
|
+
const fieldRefs = args.fieldCodes;
|
|
926
|
+
if (fieldRefs !== undefined) {
|
|
927
|
+
// A `fieldCodes` entry may be a propertyCode OR a display name (cpdocs
|
|
928
|
+
// base3.0 parity); an unresolvable reference is REFUSED, never silently
|
|
929
|
+
// skipped — a silently dropped column reported as success is the
|
|
930
|
+
// "declared a column, nothing appeared" trap.
|
|
931
|
+
const unknownRefs = fieldRefs.filter((ref) => resolveFieldRef(fieldRows, ref) === undefined);
|
|
932
|
+
if (unknownRefs.length > 0)
|
|
933
|
+
throw new ToolRefusalError({
|
|
934
|
+
status: "refused",
|
|
935
|
+
blocker: "listview-columns-unknown-field",
|
|
936
|
+
unknown: unknownRefs,
|
|
937
|
+
message: `fieldCodes 引用了模型 ${args.schemaCode} 发布面上不存在的字段(可给 propertyCode 或字段名):${unknownRefs.join("、")};先 field.create + field.publish,或修正引用`,
|
|
938
|
+
});
|
|
939
|
+
// r29b F5b: 列表视图不支持整列展示子表——平台会 50000「服务异常」,dry-run
|
|
940
|
+
// 以前也不拦。写前按 propertyType=CHILD_TABLE(8) 拒绝并给替代。
|
|
941
|
+
const childTableRefs = fieldRefs
|
|
942
|
+
.map((ref) => {
|
|
940
943
|
const resolved = resolveFieldRef(fieldRows, ref);
|
|
941
944
|
if (!resolved)
|
|
942
|
-
return
|
|
945
|
+
return null;
|
|
943
946
|
const field = fieldRows.find((row) => (row.code ?? row.propertyCode) === resolved.code);
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
947
|
+
const type = Number(field.type ?? field.propertyType);
|
|
948
|
+
return type === 8 ? resolved.code : null;
|
|
949
|
+
})
|
|
950
|
+
.filter((code) => typeof code === "string");
|
|
951
|
+
if (childTableRefs.length > 0) {
|
|
952
|
+
const alternatives = fieldRefs.filter((ref) => {
|
|
953
|
+
const resolved = resolveFieldRef(fieldRows, ref);
|
|
954
|
+
if (!resolved)
|
|
955
|
+
return false;
|
|
956
|
+
const field = fieldRows.find((row) => (row.code ?? row.propertyCode) === resolved.code);
|
|
957
|
+
return Number(field.type ?? field.propertyType) !== 8;
|
|
958
|
+
});
|
|
959
|
+
throw new ToolInputError({
|
|
960
|
+
status: "error",
|
|
961
|
+
blocker: "tool-input-invalid",
|
|
962
|
+
tool: "listview.configure",
|
|
963
|
+
message: `列表视图不支持整列展示子表(propertyType=CHILD_TABLE):${childTableRefs.join("、")}。` +
|
|
964
|
+
"平台会回 50000 服务异常。请改用子表首列/展开列,或在详情页(form)看子表;列表只放主表标量列。",
|
|
965
|
+
nextCommand: alternatives.length > 0
|
|
966
|
+
? `omc call listview.configure --args '${JSON.stringify({ schemaCode: args.schemaCode, code, fieldCodes: alternatives })}'`
|
|
967
|
+
: `omc call field.list --args '${JSON.stringify({ schemaCode: args.schemaCode, published: true })}'`,
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
// replaceColumns: the caller's fieldCodes ARE the view. Start from an
|
|
971
|
+
// empty set so system columns fall away unless listed — a system field
|
|
972
|
+
// can still be shown by naming its code in fieldCodes (createdTime etc.
|
|
973
|
+
// are published fields too), so the caller controls the exact set.
|
|
974
|
+
if (args.replaceColumns === true)
|
|
975
|
+
columns.length = 0;
|
|
976
|
+
for (const ref of fieldRefs) {
|
|
977
|
+
const fieldCode = resolveFieldRef(fieldRows, ref).code;
|
|
978
|
+
const field = fieldRows.find((row) => (row.code ?? row.propertyCode) === fieldCode);
|
|
979
|
+
const type = Number(field.type ?? field.propertyType);
|
|
980
|
+
const displayFormat = columnDisplayFormat(type, field.options);
|
|
981
|
+
const existing = columns.find((c) => c.propertyCode === fieldCode);
|
|
982
|
+
if (existing) {
|
|
983
|
+
existing.name = field.name;
|
|
984
|
+
existing.propertyType = type;
|
|
985
|
+
existing.displayFormat = displayFormat;
|
|
986
|
+
existing.visible = true;
|
|
987
|
+
updated.push(fieldCode);
|
|
988
|
+
continue;
|
|
989
|
+
}
|
|
990
|
+
sortKey += 1;
|
|
991
|
+
columns.push({ name: field.name, propertyCode: fieldCode, propertyType: type, isDefaultProperty: false, displayFormat, width: "160", sortKey, sumType: null, relativeSchemaCode: null, childColumns: null, clientType: "PC", schemaAlias: "a_1", propertyAlias: fieldCode, syncDefaultFormat: false, displayFields: null, queryLevel: 1, options: null, visible: true, virtualField: false, enableEncrypt: false, autoFilled: false });
|
|
992
|
+
added.push(fieldCode);
|
|
976
993
|
}
|
|
977
|
-
sortKey += 1;
|
|
978
|
-
columns.push({ name: field.name, propertyCode: fieldCode, propertyType: type, isDefaultProperty: false, displayFormat, width: "160", sortKey, sumType: null, relativeSchemaCode: null, childColumns: null, clientType: "PC", schemaAlias: "a_1", propertyAlias: fieldCode, syncDefaultFormat: false, displayFields: null, queryLevel: 1, options: null, visible: true, virtualField: false, enableEncrypt: false, autoFilled: false });
|
|
979
|
-
added.push(fieldCode);
|
|
980
994
|
}
|
|
981
995
|
// replaceColumns already reduced the set to fieldCodes; hideDefaultSystemFields
|
|
982
996
|
// additionally drops any system column that slipped in (an echoed system
|
|
@@ -985,6 +999,10 @@ export function registerListViewLane(tools) {
|
|
|
985
999
|
// the platform forces every submitted column visible=true
|
|
986
1000
|
// (BizQueryController.reSetQueryColumns:1000-1027), so visible:false is
|
|
987
1001
|
// not an option.
|
|
1002
|
+
// F4:fieldCodes 省略时 configuredColumns 就是 query/get 的原样列集合。
|
|
1003
|
+
// 平台 query/update 是整体保存(saveBizQueryDetail),所以必须带回既有
|
|
1004
|
+
// queryColumns;这不是 replaceColumns(不做重建/增删),除非调用方显式
|
|
1005
|
+
// hideDefaultSystemFields:true 才滤掉系统列。
|
|
988
1006
|
const configuredColumns = filterDefaultSystemColumns(columns, args.hideDefaultSystemFields === true);
|
|
989
1007
|
const body = { ...model, queryColumns: configuredColumns };
|
|
990
1008
|
if (args.presentation !== undefined)
|
|
@@ -1177,6 +1195,25 @@ export function registerListViewLane(tools) {
|
|
|
1177
1195
|
.map(decodeConditionRow)
|
|
1178
1196
|
.sort((a, b) => String(a.propertyCode ?? "").localeCompare(String(b.propertyCode ?? "")));
|
|
1179
1197
|
const readback = { code, added, updated, columns: afterCols, sorts, conditions };
|
|
1198
|
+
// F2(0.8.10 探针 E):平台在建视图时就给默认视图种了 4 个系统列
|
|
1199
|
+
// name/creater/createdTime/sequenceNo(BizQueryServiceImpl.createDefaultBizQuery
|
|
1200
|
+
// :209-226),增量 configure(未传 replaceColumns/hideDefaultSystemFields)会
|
|
1201
|
+
// 把它们原样保留——真机 4 列请求回读 8 列,调用方会以为 fieldCodes 写错了。
|
|
1202
|
+
// 只报告不改变写入语义;权威列集合 = 调用方 fieldCodes + 平台既有列。
|
|
1203
|
+
// F4:省略 fieldCodes 时列本来就不动,不存在「平台额外保留」的可疑差集——
|
|
1204
|
+
// 这个提示只在调用方点名了列、且没要求权威全集时才出现。
|
|
1205
|
+
if (fieldRefs !== undefined && args.replaceColumns !== true && args.hideDefaultSystemFields !== true) {
|
|
1206
|
+
const requestedCodes = new Set(fieldRefs.map((ref) => resolveFieldRef(fieldRows, ref)?.code ?? ref));
|
|
1207
|
+
const systemColumnsAdded = [
|
|
1208
|
+
...new Set(afterCols
|
|
1209
|
+
.map((column) => String(column.propertyCode ?? ""))
|
|
1210
|
+
.filter((columnCode) => columnCode.length > 0 && SYSTEM_FIELD_CODES.has(columnCode) && !requestedCodes.has(columnCode))),
|
|
1211
|
+
];
|
|
1212
|
+
if (systemColumnsAdded.length > 0) {
|
|
1213
|
+
readback.systemColumnsAdded = systemColumnsAdded;
|
|
1214
|
+
readback.systemColumnsNote = `平台额外保留系统列 ${systemColumnsAdded.join("、")};要精确 ${requestedCodes.size} 列请同时传 replaceColumns:true + hideDefaultSystemFields:true(系统列与业务列一视同仁,想保留哪个就写进 fieldCodes)`;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1180
1217
|
// r35(2026-10-31 真机):视图固定条件读回正确,但 `data.list --queryCode <视图>`
|
|
1181
1218
|
// 不应用该过滤(4 条未过滤返回)——视图条件的运行时过滤语义未取证(门户 vs
|
|
1182
1219
|
// REST queryCode),coverage 已声明 "filtering … not probed"。前置声明省 3 轮排查。
|
|
@@ -1246,34 +1283,39 @@ export function registerListViewLane(tools) {
|
|
|
1246
1283
|
.map(decodeActionRow)
|
|
1247
1284
|
.sort((a, b) => Number(a.sortKey ?? 0) - Number(b.sortKey ?? 0));
|
|
1248
1285
|
readback.actions = afterActions;
|
|
1249
|
-
// F14(0.8.9 探针 D):actions:[] + replaceActions:true
|
|
1250
|
-
//
|
|
1251
|
-
// 在 query/get 读面强制补齐 qr_code/batch_print/batch_update/
|
|
1286
|
+
// F14(0.8.9 探针 D)/ F8(0.8.10 探针 E):actions:[] + replaceActions:true
|
|
1287
|
+
// 之后 `actions` 仍列 6 条平台注入动作(BizQueryController.dealHistoryDataOfButton
|
|
1288
|
+
// :482-575 在 query/get 读面强制补齐 qr_code/batch_print/batch_update/
|
|
1252
1289
|
// import_attachment/export_attachment/batch_submit),使用者会怀疑 replace
|
|
1253
|
-
// 没生效。区分三层:平台真值 actions
|
|
1254
|
-
//
|
|
1255
|
-
//
|
|
1256
|
-
//
|
|
1290
|
+
// 没生效。区分三层:平台真值 actions 原样保留;本次被清掉的(写入前权威
|
|
1291
|
+
// 读回集减去回读集)进 removedActionCodes;回读里由平台注入且不是调用方
|
|
1292
|
+
// 显式提交的 code 进 platformDefaultActions。**只要按权威全集替换且传了
|
|
1293
|
+
// actions(含空数组)就必给 platformDefaultActions + actionsNote**——0.8.9
|
|
1294
|
+
// 只在两个差集非空时写 note,差集同时为空就静默,探针把它读成「replace
|
|
1295
|
+
// 没生效」。差集为空时 note 明说「本次没有移除非默认动作」,不伪装。
|
|
1257
1296
|
if (args.replaceActions === true) {
|
|
1258
1297
|
const afterCodes = new Set(afterActions.map((action) => String(action.actionCode ?? "")).filter(Boolean));
|
|
1259
1298
|
const submittedCodes = new Set(args.actions.map((action) => String(action.actionCode ?? "")).filter(Boolean));
|
|
1260
|
-
const platformDefaultActions =
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1299
|
+
const platformDefaultActions = [
|
|
1300
|
+
...new Set(afterActions
|
|
1301
|
+
.map((action) => String(action.actionCode ?? ""))
|
|
1302
|
+
.filter((code) => PLATFORM_INJECTED_READ_ACTIONS.includes(code) && !submittedCodes.has(code))),
|
|
1303
|
+
];
|
|
1304
|
+
const removedActionCodes = [
|
|
1305
|
+
...new Set(readArray(model, "queryActions")
|
|
1306
|
+
.map((action) => String(action.actionCode ?? ""))
|
|
1307
|
+
.filter((code) => code.length > 0 && !afterCodes.has(code) && !submittedCodes.has(code))),
|
|
1308
|
+
];
|
|
1266
1309
|
if (removedActionCodes.length > 0)
|
|
1267
|
-
readback.removedActionCodes =
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
}
|
|
1310
|
+
readback.removedActionCodes = removedActionCodes;
|
|
1311
|
+
readback.platformDefaultActions = platformDefaultActions;
|
|
1312
|
+
readback.actionsNote =
|
|
1313
|
+
(removedActionCodes.length > 0
|
|
1314
|
+
? `本次移除 ${removedActionCodes.join("、")}(权威读回差集);`
|
|
1315
|
+
: "本次没有移除非默认动作(权威读回差集为空);") +
|
|
1316
|
+
(platformDefaultActions.length > 0
|
|
1317
|
+
? `流程/自定义动作已清空;剩余为平台默认动作(${platformDefaultActions.join("、")},query/get 注入,不是 replaceActions 未生效)。`
|
|
1318
|
+
: "流程/自定义动作已清空;回读里没有平台注入的默认动作(剩余动作均来自本次提交或平台保留),不是 replaceActions 未生效。");
|
|
1277
1319
|
}
|
|
1278
1320
|
}
|
|
1279
1321
|
if (afterModel.queryPresentation && typeof afterModel.queryPresentation === "object") {
|
|
@@ -1338,45 +1380,59 @@ export function registerListViewLane(tools) {
|
|
|
1338
1380
|
dryRunPayload: async (session, args) => {
|
|
1339
1381
|
const code = args.code ?? args.schemaCode;
|
|
1340
1382
|
const fieldRows = wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: args.schemaCode, isPublish: "true" } })).data);
|
|
1341
|
-
//
|
|
1342
|
-
//
|
|
1343
|
-
const
|
|
1344
|
-
if (
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
return Number(field.type ?? field.propertyType) === 8 ? resolved.code : null;
|
|
1358
|
-
})
|
|
1359
|
-
.filter((value) => typeof value === "string");
|
|
1360
|
-
if (childTableRefs.length > 0) {
|
|
1361
|
-
const alternatives = args.fieldCodes.filter((ref) => {
|
|
1383
|
+
// F4(probe F / 0.8.11):fieldCodes 可选——只改排序/筛选/动作时不校验列,
|
|
1384
|
+
// 预览也不再谎称「配置列」。
|
|
1385
|
+
const fieldRefs = args.fieldCodes;
|
|
1386
|
+
if (fieldRefs !== undefined) {
|
|
1387
|
+
// R75-B(2026-11-18):未知列此前 dry-run 只在 fieldCodes 回显、真写才拒
|
|
1388
|
+
// (investigate-B E3 实证)。同一判定提前到这里——dry-run 与真写同答案。
|
|
1389
|
+
const unknownRefs = fieldRefs.filter((ref) => resolveFieldRef(fieldRows, ref) === undefined);
|
|
1390
|
+
if (unknownRefs.length > 0)
|
|
1391
|
+
throw new ToolRefusalError({
|
|
1392
|
+
status: "refused",
|
|
1393
|
+
blocker: "listview-columns-unknown-field",
|
|
1394
|
+
unknown: unknownRefs,
|
|
1395
|
+
message: `fieldCodes 引用了模型 ${args.schemaCode} 发布面上不存在的字段(可给 propertyCode 或字段名):${unknownRefs.join("、")};先 field.create + field.publish,或修正引用`,
|
|
1396
|
+
});
|
|
1397
|
+
const childTableRefs = fieldRefs
|
|
1398
|
+
.map((ref) => {
|
|
1362
1399
|
const resolved = resolveFieldRef(fieldRows, ref);
|
|
1363
1400
|
if (!resolved)
|
|
1364
|
-
return
|
|
1401
|
+
return null;
|
|
1365
1402
|
const field = fieldRows.find((row) => (row.code ?? row.propertyCode) === resolved.code);
|
|
1366
|
-
return Number(field.type ?? field.propertyType)
|
|
1367
|
-
})
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1403
|
+
return Number(field.type ?? field.propertyType) === 8 ? resolved.code : null;
|
|
1404
|
+
})
|
|
1405
|
+
.filter((value) => typeof value === "string");
|
|
1406
|
+
if (childTableRefs.length > 0) {
|
|
1407
|
+
const alternatives = fieldRefs.filter((ref) => {
|
|
1408
|
+
const resolved = resolveFieldRef(fieldRows, ref);
|
|
1409
|
+
if (!resolved)
|
|
1410
|
+
return false;
|
|
1411
|
+
const field = fieldRows.find((row) => (row.code ?? row.propertyCode) === resolved.code);
|
|
1412
|
+
return Number(field.type ?? field.propertyType) !== 8;
|
|
1413
|
+
});
|
|
1414
|
+
throw new ToolInputError({
|
|
1415
|
+
status: "error",
|
|
1416
|
+
blocker: "tool-input-invalid",
|
|
1417
|
+
tool: "listview.configure",
|
|
1418
|
+
message: `列表视图不支持整列展示子表(propertyType=CHILD_TABLE):${childTableRefs.join("、")}。` +
|
|
1419
|
+
"平台会回 50000 服务异常。请改用子表首列/展开列,或在详情页(form)看子表;列表只放主表标量列。",
|
|
1420
|
+
nextCommand: alternatives.length > 0
|
|
1421
|
+
? `omc call listview.configure --args '${JSON.stringify({ schemaCode: args.schemaCode, code, fieldCodes: alternatives })}'`
|
|
1422
|
+
: `omc call field.list --args '${JSON.stringify({ schemaCode: args.schemaCode, published: true })}'`,
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
const changedFaces = ["sorts", "conditions", "actions", "buttons", "presentation", "options", "presentationType", "gantt", "queryLayer", "multiTableHeaderConfig"].filter((key) => args[key] !== undefined);
|
|
1427
|
+
if (fieldRefs === undefined) {
|
|
1428
|
+
return {
|
|
1429
|
+
wouldChange: true,
|
|
1430
|
+
summary: `即将配置列表视图 ${args.schemaCode}/${code}:列不变${changedFaces.length > 0 ? `;改 ${changedFaces.join("、")}` : ""}`,
|
|
1431
|
+
columnsUnchanged: true,
|
|
1432
|
+
...(args.conditions !== undefined ? { conditions: args.conditions } : {}),
|
|
1433
|
+
};
|
|
1378
1434
|
}
|
|
1379
|
-
const normalizedFieldCodes =
|
|
1435
|
+
const normalizedFieldCodes = fieldRefs.map((ref) => resolveFieldRef(fieldRows, ref)?.code ?? ref);
|
|
1380
1436
|
return {
|
|
1381
1437
|
wouldChange: true,
|
|
1382
1438
|
summary: `即将配置列表视图 ${args.schemaCode}/${code} 的列`,
|
|
@@ -113,12 +113,21 @@ export async function inboundModelReferences(session, targets, treeRows, options
|
|
|
113
113
|
left.via.localeCompare(right.via) ||
|
|
114
114
|
(left.childTable?.code ?? "").localeCompare(right.childTable?.code ?? ""));
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* `omc model-purge --unbind-references --apply` — the ONE command that executes
|
|
118
|
+
* the same `field.delete → field.publish` unlink steps and then lets
|
|
119
|
+
* model.delete cascade (0.8.9 F7; `UNBIND_STEP_TOOLS` in model-purge.ts is the
|
|
120
|
+
* allow-list). Shared here so the refusal and the purge receipt cannot drift.
|
|
121
|
+
*/
|
|
122
|
+
export function modelPurgeUnbindCommand(schemaCode, options = {}) {
|
|
123
|
+
return `omc model-purge --code ${schemaCode} --unbind-references${options.purgeInstances === true ? " --purge-instances" : ""} --apply`;
|
|
124
|
+
}
|
|
116
125
|
/**
|
|
117
126
|
* Build the refusal payload shared by the three delete entry points
|
|
118
127
|
* (model.delete dry-run, model.delete, model.deleteMany). The message names the
|
|
119
128
|
* real platform cause and the exact commands that remove the reference.
|
|
120
129
|
*/
|
|
121
|
-
export function inboundReferenceRefusal(target, references) {
|
|
130
|
+
export function inboundReferenceRefusal(target, references, options = {}) {
|
|
122
131
|
const referencingModels = [];
|
|
123
132
|
for (const reference of references) {
|
|
124
133
|
const existing = referencingModels.find((model) => model.schemaCode === reference.schemaCode);
|
|
@@ -145,6 +154,9 @@ export function inboundReferenceRefusal(target, references) {
|
|
|
145
154
|
step("model.delete", { schemaCode: target });
|
|
146
155
|
const selfReferences = references.filter((reference) => reference.selfReference);
|
|
147
156
|
const externalReferences = references.filter((reference) => !reference.selfReference);
|
|
157
|
+
// F6(0.8.10):自引用才走「一条命令删净」;普通兄弟模型引用的 nextCommand
|
|
158
|
+
// 仍是 deletionSteps[0](既有路径不变)。
|
|
159
|
+
const selfPurgeCommand = selfReferences.length > 0 ? options.selfReferencePurgeCommand : undefined;
|
|
148
160
|
const selfText = selfReferences.map((reference) => `${reference.childTable.code}.${reference.fields.map((field) => field.code).join("/")}`);
|
|
149
161
|
const externalText = [...new Set(externalReferences.map((reference) => reference.schemaCode))];
|
|
150
162
|
const parts = [];
|
|
@@ -160,12 +172,16 @@ export function inboundReferenceRefusal(target, references) {
|
|
|
160
172
|
inboundReferences: [...references],
|
|
161
173
|
deletionOrder: [...new Set([...references.map((reference) => reference.schemaCode), target])],
|
|
162
174
|
deletionSteps: steps,
|
|
163
|
-
nextCommand: steps[0]?.command ?? `omc call model.delete --args '${JSON.stringify({ schemaCode: target })}'`,
|
|
164
|
-
nextAction:
|
|
165
|
-
? "
|
|
166
|
-
:
|
|
175
|
+
nextCommand: selfPurgeCommand ?? steps[0]?.command ?? `omc call model.delete --args '${JSON.stringify({ schemaCode: target })}'`,
|
|
176
|
+
nextAction: selfPurgeCommand !== undefined
|
|
177
|
+
? "一条命令删净(破坏性):nextCommand 会先按 deletionSteps 删除指向自身的子表关联列(及其它引用列),再让 model.delete 级联删本模型;被删列数据不可恢复。逐条手工审计命令仍见 deletionSteps"
|
|
178
|
+
: selfText.length > 0
|
|
179
|
+
? "按 deletionSteps 依赖倒序逐条执行:先 field.delete 删掉指向自身的子表关联列(及其它引用列),再 field.publish 发布所属模型,最后 model.delete(本工具已零写入拒绝,不会启动平台删除任务)"
|
|
180
|
+
: "按 deletionSteps 依赖倒序执行:先删引用方模型的关联字段(或整体删掉引用方模型),再删本模型",
|
|
167
181
|
message: `${target} 不能删除(零写入拒绝,未调用 physically_delete)。${parts.join(" ")}` +
|
|
168
|
-
|
|
182
|
+
(selfPurgeCommand !== undefined
|
|
183
|
+
? `一条命令删净:nextCommand = \`${selfPurgeCommand}\` —— 破坏性:它先删除上述引用列(子表关联列/兄弟模型关联列),再删除 ${target} 模型;被删列的数据不可恢复。逐条可审计的依赖倒序命令仍见 deletionSteps:先删关联列 → 发布所属模型 → 再删本模型。`
|
|
184
|
+
: `依赖倒序(逐条可执行命令见 deletionSteps / nextCommand):先删关联列 → 发布所属模型 → 再删本模型。`) +
|
|
169
185
|
`不要在未拆引用时重试 model.delete——平台只会再次回 taskId 并把真因留在删除历史里(模型引用失败时 taskStatus=FAIL,子表自引用时任务永远 RUN)。`,
|
|
170
186
|
};
|
|
171
187
|
}
|
package/dist/lanes/model.js
CHANGED
|
@@ -18,7 +18,7 @@ import { defineTool, ToolInputError, ToolRefusalError } from "../tool-types.js";
|
|
|
18
18
|
import { wireCall, wireRows, WireError } from "../wire.js";
|
|
19
19
|
import { assertTreeSelectionOptions } from "../field-tree-options.js";
|
|
20
20
|
import { readModelRecord } from "../model-record.js";
|
|
21
|
-
import { inboundModelReferences, inboundReferenceRefusal } from "./model-references.js";
|
|
21
|
+
import { inboundModelReferences, inboundReferenceRefusal, modelPurgeUnbindCommand } from "./model-references.js";
|
|
22
22
|
import { MODEL_CREATE_BODY_DEFAULTS, MODEL_LANE_CONTRACT } from "./model-contract.js";
|
|
23
23
|
import { flattenFolders } from "./folder.js";
|
|
24
24
|
const MODEL_LANE = MODEL_LANE_CONTRACT.lane;
|
|
@@ -911,7 +911,7 @@ export function registerModelLane(tools) {
|
|
|
911
911
|
// (dogfood R3). `mayBeReferenced` is the honest preview.
|
|
912
912
|
wouldChange: !nodeResolved || references.length === 0,
|
|
913
913
|
mayBeReferenced: references.length > 0,
|
|
914
|
-
...(references.length > 0 ? inboundReferenceRefusal(args.schemaCode, references) : {}),
|
|
914
|
+
...(references.length > 0 ? inboundReferenceRefusal(args.schemaCode, references, { selfReferencePurgeCommand: modelPurgeUnbindCommand(args.schemaCode) }) : {}),
|
|
915
915
|
referencingModels: referencing,
|
|
916
916
|
inboundReferences: references,
|
|
917
917
|
treeNodeResolved: nodeResolved,
|
|
@@ -1015,7 +1015,10 @@ export function registerModelLane(tools) {
|
|
|
1015
1015
|
throw new ToolRefusalError({
|
|
1016
1016
|
status: "refused",
|
|
1017
1017
|
schemaCode: args.schemaCode,
|
|
1018
|
-
|
|
1018
|
+
// F6(0.8.10):自引用子表列的三步手工链(0.8.7 起)仍保留在
|
|
1019
|
+
// deletionSteps,但 nextCommand 改为 0.8.9 就有的
|
|
1020
|
+
// `model-purge --unbind-references`——一条命令拆引用再删模型。
|
|
1021
|
+
...inboundReferenceRefusal(args.schemaCode, inboundReferences, { selfReferencePurgeCommand: modelPurgeUnbindCommand(args.schemaCode) }),
|
|
1019
1022
|
});
|
|
1020
1023
|
}
|
|
1021
1024
|
// Model deletion CASCADES the workflow template away but leaves
|
|
@@ -683,6 +683,24 @@ export function nameOverwrittenNoteOf(suppliedName, authoritativeName) {
|
|
|
683
683
|
return undefined;
|
|
684
684
|
return `平台按模型「数据标题」表达式自动覆盖了 name:传入“${shortReadbackValue(suppliedName)}”→读回“${shortReadbackValue(authoritativeName)}”;业务标识(单号/编码)请用自建字段,不要依赖 name。`;
|
|
685
685
|
}
|
|
686
|
+
/**
|
|
687
|
+
* 权威读回里的 name——`data.load` 的行形状可能是平铺 name,也可能在 fields.name
|
|
688
|
+
* 下(ticket 17 的扁平契约与旧 VO 嵌套并存)。两形都认,空串当缺席。
|
|
689
|
+
*/
|
|
690
|
+
function readbackRecordNameOf(record) {
|
|
691
|
+
if (record === null || typeof record !== "object" || Array.isArray(record))
|
|
692
|
+
return undefined;
|
|
693
|
+
const flat = record.name;
|
|
694
|
+
if (typeof flat === "string" && flat.trim() !== "")
|
|
695
|
+
return flat;
|
|
696
|
+
const fields = record.fields;
|
|
697
|
+
if (fields !== null && typeof fields === "object" && !Array.isArray(fields)) {
|
|
698
|
+
const nested = fields.name;
|
|
699
|
+
if (typeof nested === "string" && nested.trim() !== "")
|
|
700
|
+
return nested;
|
|
701
|
+
}
|
|
702
|
+
return undefined;
|
|
703
|
+
}
|
|
686
704
|
/**
|
|
687
705
|
* data.list 的视图证据读取(query/get 失败/无视图 → undefined = 无证据)。
|
|
688
706
|
* 拿到 queryColumns 数组才算可判定证据;视图对象在但 queryColumns 非数组 →
|
|
@@ -4321,18 +4339,21 @@ export function registerRuntimeDataLane(tools) {
|
|
|
4321
4339
|
submittedData: projectReadbackRecord(record, args),
|
|
4322
4340
|
// r62a-F10(P1-9):无流程分支的 name 覆盖检测(与 approval 分支同款)——
|
|
4323
4341
|
// 真机实证无流程模型也会把传入 name 换成「发起人+模型名+时间」标题。
|
|
4342
|
+
// F4(w71,0.8.10):与 data.save 同口径——复用 nameOverwrittenNoteOf,
|
|
4343
|
+
// 回执顶层给 nameOverwrittenNote(人类摘要行同源)。nameOverridden 保留
|
|
4344
|
+
// 结构化 wanted/landed,兼容既有调用方。
|
|
4324
4345
|
...(() => {
|
|
4325
|
-
const
|
|
4326
|
-
const
|
|
4327
|
-
const
|
|
4328
|
-
|
|
4329
|
-
: typeof (record.fields ?? {}).name === "string"
|
|
4330
|
-
? String(record.fields.name)
|
|
4331
|
-
: null;
|
|
4332
|
-
const landedName = landedNameRaw !== null && landedNameRaw.trim() !== "" ? landedNameRaw : null;
|
|
4333
|
-
if (wantedName === null || landedName === null || landedName === wantedName)
|
|
4346
|
+
const wantedName = typeof formData.name === "string" && formData.name.trim() !== "" ? formData.name : null;
|
|
4347
|
+
const landedName = readbackRecordNameOf(record);
|
|
4348
|
+
const note = nameOverwrittenNoteOf(wantedName, landedName);
|
|
4349
|
+
if (wantedName === null || landedName === undefined)
|
|
4334
4350
|
return {};
|
|
4335
|
-
return {
|
|
4351
|
+
return {
|
|
4352
|
+
...(note !== undefined ? { nameOverwrittenNote: note } : {}),
|
|
4353
|
+
...(landedName !== wantedName
|
|
4354
|
+
? { nameOverridden: { wanted: wantedName, landed: landedName, note: "name 是平台数据标题(自动生成优先):传入值被覆盖,业务字段请用自有 code(如 title/subject)" } }
|
|
4355
|
+
: {}),
|
|
4356
|
+
};
|
|
4336
4357
|
})(),
|
|
4337
4358
|
...(serialGenerationFailed.length > 0
|
|
4338
4359
|
? { serialGenerationFailed, serialGenerationWarning: SERIAL_GENERATION_FAILURE_NOTE }
|
|
@@ -4396,18 +4417,21 @@ export function registerRuntimeDataLane(tools) {
|
|
|
4396
4417
|
// 「发起人+模型名+时间」生成标题时,传的 name 被静默替换且无告警(探针
|
|
4397
4418
|
// 传「r62a_差旅-短程」得到「付文彬的差旅申请 2026-11-13 …」)。检测
|
|
4398
4419
|
// 覆盖并点名,别让调用方以为标题没生效是 bug。
|
|
4420
|
+
// F4(w71,0.8.10):与 data.save 同口径——复用 nameOverwrittenNoteOf,
|
|
4421
|
+
// 审批/发起提交(同一条 else 路径)也回 nameOverwrittenNote + 人类摘要行。
|
|
4399
4422
|
...(() => {
|
|
4400
|
-
const
|
|
4401
|
-
const
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
const wantedName = typeof wanted.name === "string" && wanted.name.trim() !== "" ? wanted.name : null;
|
|
4405
|
-
const landedNameRaw = typeof landed.name === "string" ? landed.name : typeof landedFields.name === "string" ? landedFields.name : null;
|
|
4406
|
-
const landedName = landedNameRaw !== null && landedNameRaw.trim() !== "" ? landedNameRaw : null;
|
|
4407
|
-
if (wantedName === null || landedName === null || landedName === wantedName)
|
|
4423
|
+
const wantedName = typeof formData.name === "string" && formData.name.trim() !== "" ? formData.name : null;
|
|
4424
|
+
const landedName = readbackRecordNameOf(loadedRecord);
|
|
4425
|
+
const note = nameOverwrittenNoteOf(wantedName, landedName);
|
|
4426
|
+
if (wantedName === null || landedName === undefined)
|
|
4408
4427
|
return {};
|
|
4409
4428
|
return {
|
|
4410
|
-
|
|
4429
|
+
...(note !== undefined ? { nameOverwrittenNote: note } : {}),
|
|
4430
|
+
...(landedName !== wantedName
|
|
4431
|
+
? {
|
|
4432
|
+
nameOverridden: { wanted: wantedName, landed: landedName, note: "name 是平台数据标题(自动生成优先):传入值被覆盖,业务字段请用自有 code(如 title/subject),不要用 name 承载业务语义" },
|
|
4433
|
+
}
|
|
4434
|
+
: {}),
|
|
4411
4435
|
};
|
|
4412
4436
|
})(),
|
|
4413
4437
|
...(approvalDelta
|
package/dist/model-purge.js
CHANGED
|
@@ -28,7 +28,7 @@ import { writeEnvelope } from "./cli-output.js";
|
|
|
28
28
|
import { ENDPOINTS } from "./endpoints.js";
|
|
29
29
|
import { wireCall, wireRows } from "./wire.js";
|
|
30
30
|
import { readModelRecord } from "./model-record.js";
|
|
31
|
-
import { inboundModelReferences, inboundReferenceRefusal } from "./lanes/model-references.js";
|
|
31
|
+
import { inboundModelReferences, inboundReferenceRefusal, modelPurgeUnbindCommand } from "./lanes/model-references.js";
|
|
32
32
|
import { resolveModelTreeNode } from "./lanes/model.js";
|
|
33
33
|
import { SessionManager } from "./session-manager.js";
|
|
34
34
|
import { ConfigStore, defaultPaths } from "./config-store.js";
|
|
@@ -47,7 +47,7 @@ export function unbindDeletionSteps(steps) {
|
|
|
47
47
|
* One purge command does instances → unbind → model cascade.
|
|
48
48
|
*/
|
|
49
49
|
export function unbindPurgeCommand(schemaCode, options = {}) {
|
|
50
|
-
return
|
|
50
|
+
return modelPurgeUnbindCommand(schemaCode, options);
|
|
51
51
|
}
|
|
52
52
|
async function sessionFor(environment) {
|
|
53
53
|
const store = new ConfigStore(defaultPaths());
|
package/dist/read.js
CHANGED
|
@@ -84,6 +84,14 @@ function transportDiagnostics(toolName, error, environment, retried, facts = des
|
|
|
84
84
|
* onlinejs.compose, service.update/method.update all self-read).
|
|
85
85
|
*/
|
|
86
86
|
const FULL_INLINE_CEILING_BYTES = 8192;
|
|
87
|
+
/**
|
|
88
|
+
* F3(w71,2026-11-26 真机):`data.load` 的语义就是「读这一条」——14 个业务
|
|
89
|
+
* 字段 + 2 行子表(约 2–3KB)却被通用读面 diet 外置成 `data:null`,调用方必须
|
|
90
|
+
* 再跑一次 `omc artifact get`。单条记录不是「大列表」,与 items/logs/triggers
|
|
91
|
+
* 同列为小行集;只保留上限保护(与 `artifact get` 的内联上限同为 8192B),
|
|
92
|
+
* 超过仍外置。`data.list` 及其它工具的 2048 门不变。
|
|
93
|
+
*/
|
|
94
|
+
const LOAD_RECORD_INLINE_CEILING_BYTES = FULL_INLINE_CEILING_BYTES;
|
|
87
95
|
/**
|
|
88
96
|
* Run composed sibling reads without the `unchanged` short-circuit, so a
|
|
89
97
|
* composite tool (model.inspect) receives their real payloads even after an
|
|
@@ -155,7 +163,10 @@ export async function governedRead(ctx, tool, args, execute, options = {}) {
|
|
|
155
163
|
// 6 条就超 2048B 被折叠到 artifact,agent 还得再取一次。与 items/logs 同口径。
|
|
156
164
|
// 2026-11-23(0.6.97):数据规则纳入后单模型可达 30+ 行(1 条计算/校验规则
|
|
157
165
|
// 各一行)——30→60,仍是有界的小行集(长度规则已聚合,不会无限长)。
|
|
158
|
-
|| (Array.isArray(result.triggers) && result.triggers.length <= 60)
|
|
166
|
+
|| (Array.isArray(result.triggers) && result.triggers.length <= 60)
|
|
167
|
+
// F3(w71):单条记录(data.load)在 8192B 内联上限内不外置;缺席
|
|
168
|
+
// (exists:false)没有记录可外置,保持既有形状。
|
|
169
|
+
|| (tool.name === "data.load" && result.exists !== false && jsonBytes(result) <= LOAD_RECORD_INLINE_CEILING_BYTES);
|
|
159
170
|
const large = !smallRowSet && jsonBytes(result) > 2048;
|
|
160
171
|
const fileName = `${tool.name.replace(/[^a-zA-Z0-9._-]/g, "_")}-${sha256(target).slice(0, 16)}.json`;
|
|
161
172
|
const artifactRef = writeArtifact(ctx, fileName, detail);
|