@stalfh233/omc-cli 0.6.89 → 0.6.91
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/goal-routes.js +31 -2
- package/dist/lanes/b2-registration.js +6 -7
- package/dist/lanes/businessrule.js +83 -10
- package/dist/lanes/runtime-data.js +35 -1
- package/dist/method-references.js +32 -1
- package/dist/read-shapes.js +2 -2
- package/dist/rule-support.js +40 -2
- package/package.json +3 -3
package/dist/goal-routes.js
CHANGED
|
@@ -805,6 +805,33 @@ function triageHintFor(goal) {
|
|
|
805
805
|
note: "config.diff 只读零写:changed:null=一面缺失(看 verdict,draft-only 即草稿全未发布),不是空 diff;差异全量与双面快照在 diffArtifactId。双面一致时症状不来自草稿/发布差——再查运行面(rulelog.search / workitem.list)或节点 buttonPermission。",
|
|
806
806
|
};
|
|
807
807
|
}
|
|
808
|
+
/**
|
|
809
|
+
* F6 工单 05a(2026-11-21):触发面指路。
|
|
810
|
+
*
|
|
811
|
+
* F6 实证:「模型有哪些触发点」→ agent 枚举了全平台服务(kind:"service"),
|
|
812
|
+
* 始终没找到 `rule.references kind:"trigger"`——触发面是**一个模型**的全部
|
|
813
|
+
* 自动化入口(流程三面/表单按钮/规则/预置事件/在线 JS),但不在 CAPABILITY_CUES
|
|
814
|
+
* 里,只能在这里补入口。保守触发:只认触发点/触发器/自动化/定时规则类的
|
|
815
|
+
* 盘点措辞;没有唯一 schemaCode 时给占位符命令(与 graphHint 同款处理),
|
|
816
|
+
* 不改原路由。
|
|
817
|
+
*/
|
|
818
|
+
const TRIGGER_HINT_RE = /触发点|触发器|有哪些自动化|的自动化|(?:模型|数据|业务).{0,6}自动化|定时(?:规则|任务)/;
|
|
819
|
+
function triggerHintFor(goal) {
|
|
820
|
+
if (!TRIGGER_HINT_RE.test(goal))
|
|
821
|
+
return undefined;
|
|
822
|
+
const codes = [...new Set(goal.match(GRAPH_OBJECT_RE) ?? [])];
|
|
823
|
+
const code = codes.length === 1 ? codes[0] : "<schemaCode>";
|
|
824
|
+
const firstCommand = `omc call rule.references --args '{"kind":"trigger","code":"${code}"}'`;
|
|
825
|
+
return {
|
|
826
|
+
why: codes.length === 1 ? `问到「${codes[0]}」的触发点/自动化` : "问到触发点/自动化(未给出唯一 schemaCode)",
|
|
827
|
+
firstCommand,
|
|
828
|
+
commands: [
|
|
829
|
+
`${firstCommand}(一个模型的全部触发点:流程三面/表单按钮/规则/预置事件/在线 JS)`,
|
|
830
|
+
`omc call rule.references --args '{"kind":"trigger","code":"${code}","action":"create"}'(只看 create/update/delete/flow 某一动作)`,
|
|
831
|
+
],
|
|
832
|
+
note: "触发面不在能力注册表里,入口是 rule.references 的 kind:\"trigger\"(code 是 schemaCode,不是规则码);只读零写。action/activityCode/sheetCode/mode 只对该 kind 有效。",
|
|
833
|
+
};
|
|
834
|
+
}
|
|
808
835
|
function goalRouteInner(registry, goal) {
|
|
809
836
|
const index = capabilityRouteIndex(registry);
|
|
810
837
|
// r49 F1(探针复现):whole-package 主推 intent 前必须确认命中能力的 intent 覆盖——
|
|
@@ -1484,16 +1511,18 @@ export function goalRoute(registry, goal) {
|
|
|
1484
1511
|
const base = goalRouteInner(registry, goal);
|
|
1485
1512
|
const hint = graphHintFor(goal);
|
|
1486
1513
|
const triage = triageHintFor(goal);
|
|
1514
|
+
const trigger = triggerHintFor(goal);
|
|
1487
1515
|
const withGraph = hint === undefined ? base : { ...base, graphHint: hint };
|
|
1488
1516
|
const withTriage = triage === undefined ? withGraph : { ...withGraph, triageHint: triage };
|
|
1517
|
+
const withTrigger = trigger === undefined ? withTriage : { ...withTriage, triggerHint: trigger };
|
|
1489
1518
|
// A3:firstAnswer 的 action 指向 registry 工具(omc call <tool> / omc describe
|
|
1490
1519
|
// <tool> --example)时附 surfaceRef——读 ladder 的起手工具、配方命中与
|
|
1491
1520
|
// needs-input 的 resolver 都能一次拿到 firstCall/needs/returns/onRefusal。
|
|
1492
|
-
const action =
|
|
1521
|
+
const action = withTrigger.firstAnswer?.action;
|
|
1493
1522
|
const surfaceRef = action === undefined
|
|
1494
1523
|
? undefined
|
|
1495
1524
|
: surfaceRefFor(registry, toolOfAction(action), { via: "firstAnswer.action" });
|
|
1496
|
-
return surfaceRef === undefined ?
|
|
1525
|
+
return surfaceRef === undefined ? withTrigger : { ...withTrigger, surfaceRef };
|
|
1497
1526
|
}
|
|
1498
1527
|
/** `omc call <tool> …` / `omc describe <tool> --example <id>` 里的工具名;其它形态返回空串(查不到即零字节)。 */
|
|
1499
1528
|
function toolOfAction(action) {
|
|
@@ -896,13 +896,12 @@ export function registerB2Lane(tools) {
|
|
|
896
896
|
requiresConfirmation: true,
|
|
897
897
|
summary: "先解绑引用规则里的 BIZ_ACTION 节点,再删方法(需用户明确确认)",
|
|
898
898
|
readFirst,
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
note: "本工具不会自动解绑;解绑是独立的高危写入,必须由用户确认后另行执行",
|
|
899
|
+
// Ticket 04(2026-11-21,F6 实证):这里**不再给解绑步骤**。F6 自主
|
|
900
|
+
// agent 把 steps 当操作手册逐步照做(rule.save 去 BIZ_ACTION →
|
|
901
|
+
// method.delete),`requiresConfirmation:true` 只是文档不是门。解绑
|
|
902
|
+
// 现在由 rule.save 的 confirmUnlink 硬门兜底:每一步怎么拼图不再由
|
|
903
|
+
// 拒绝回执教学,必须用户决策后另行执行。
|
|
904
|
+
note: "本工具不会自动解绑,也不提供解绑步骤;解绑是独立的高危写入(rule.save 需 confirmUnlink:true),必须由用户决策后另行执行",
|
|
906
905
|
},
|
|
907
906
|
],
|
|
908
907
|
nextCommand: `omc call rule.references --args '{"kind":"service","code":"${args.serviceCode}"}'`,
|
|
@@ -750,7 +750,11 @@ async function readRuleListBody(session, schemaCode, options) {
|
|
|
750
750
|
createdTime: row.createdTime,
|
|
751
751
|
creator: row.creater ?? row.creator,
|
|
752
752
|
}
|
|
753
|
-
|
|
753
|
+
// 内部面(T02b 调度摘要):行 id 让调用方直接读 businessrule/get,
|
|
754
|
+
// 省掉逐条 `resolveRuleRowId` 的二次 list。对外读面形状不变。
|
|
755
|
+
: options.withRowIds === true && typeof row.id === "string" && row.id !== ""
|
|
756
|
+
? { id: row.id }
|
|
757
|
+
: {}),
|
|
754
758
|
...mappingOf(row),
|
|
755
759
|
})),
|
|
756
760
|
};
|
|
@@ -762,12 +766,30 @@ async function readRuleListBody(session, schemaCode, options) {
|
|
|
762
766
|
* 调用。零新工具、零新写面;只做一层清单(不做触发链路传递闭包)。
|
|
763
767
|
*
|
|
764
768
|
* wire 受控:应用树 1(出处 + 存在性)+ 流程面(isworkflow→getWorkflow→
|
|
765
|
-
* get_published,复用 scanModelWorkflowBindings)+ 规则清单 1
|
|
766
|
-
*
|
|
769
|
+
* get_published,复用 scanModelWorkflowBindings)+ 规则清单 1 + **调度摘要**
|
|
770
|
+
* (自定义规则逐条 keys 瘦身读,≤20 条,只取 bizRuleType/schedulerSetting;
|
|
771
|
+
* TIMING 行只投影 7 个调度键,filterConditionGroups 等大块不外泄)+ 表单 1
|
|
767
772
|
* (按钮与在线 JS 共用一次 bizsheet/get)。activityCode 过滤只读流程面,其余
|
|
768
773
|
* 面逐条记 notScanned。
|
|
769
774
|
*/
|
|
770
775
|
const TRIGGER_PRESET_CODES = ["Create", "Update", "Delete"];
|
|
776
|
+
/**
|
|
777
|
+
* T02b(2026-11-20):调度摘要扫描的预算。
|
|
778
|
+
*
|
|
779
|
+
* 触发器视图此前刻意不逐条 rule.get(wire 会随规则数线性爆),代价是
|
|
780
|
+
* via:rule 行看不见定时规则。折中:只对自定义规则读一次 keys 瘦身面
|
|
781
|
+
* (bizRuleType/schedulerSetting),硬上限 20 条;超出部分与读取失败都记账
|
|
782
|
+
* (notScanned / scanned.schedulerReadFailed),不静默。
|
|
783
|
+
*/
|
|
784
|
+
const TRIGGER_SCHEDULER_MAX_RULES = 20;
|
|
785
|
+
/** TIMING(定时任务)的规则行 bizRuleType。 */
|
|
786
|
+
const RULE_BIZ_TYPE_TIMING = 2;
|
|
787
|
+
/**
|
|
788
|
+
* 调度摘要投影:只这 7 个键。`filterConditionGroups`(二维过滤条件)、
|
|
789
|
+
* `second`/`endType`/`triggerTime` 等大块留给 rule.get 整读——清单面只需要
|
|
790
|
+
* 「多久跑一次、从哪取数」。
|
|
791
|
+
*/
|
|
792
|
+
const TRIGGER_SCHEDULER_KEYS = ["triggerTimeType", "cycleType", "execCycle", "hour", "minute", "startTime", "dataSourceType"];
|
|
771
793
|
/**
|
|
772
794
|
* 在线 JS 触发点的**文本**匹配:每行至多一条(优先级 axios → fetch( → /api/)。
|
|
773
795
|
* 可能漏动态拼 URL、可能命中注释——这是协议局限,回执标 scanMode:"text"。
|
|
@@ -894,13 +916,19 @@ async function scanSchemaTriggers(session, args) {
|
|
|
894
916
|
}
|
|
895
917
|
}
|
|
896
918
|
// 4. 规则清单:一次 list,自建行进 via:rule,预置 Create/Update/Delete 行进
|
|
897
|
-
// via:preset
|
|
898
|
-
//
|
|
919
|
+
// via:preset。bizRuleType 不在 list 行上——分类留给第 4b 步的 keys 瘦身读
|
|
920
|
+
// (只取 bizRuleType/schedulerSetting,逐条整图才是会打爆 wire 的读法)。
|
|
899
921
|
let scannedRules = 0;
|
|
922
|
+
let schedulerReads = 0;
|
|
923
|
+
let schedulerReadFailed = 0;
|
|
900
924
|
const ruleRows = [];
|
|
925
|
+
// 第 4b 步的读面清单:每行只留 (ruleCode, 行 id)。id 来自 list 行
|
|
926
|
+
// (withRowIds),让调度摘要每条只付 1 wire(businessrule/get),
|
|
927
|
+
// 不再走 resolveRuleRowId 的二次 list。
|
|
928
|
+
const customRuleRows = [];
|
|
901
929
|
const presetRows = [];
|
|
902
930
|
if (activityCodeFilter === undefined) {
|
|
903
|
-
const body = await readRuleListBody(session, schemaCode, { onlyCustom: false, full: false, withMappings: false });
|
|
931
|
+
const body = await readRuleListBody(session, schemaCode, { onlyCustom: false, full: false, withMappings: false, withRowIds: true });
|
|
904
932
|
if (body.modelPresent === false)
|
|
905
933
|
throw appScopeRefusal(`模型 ${schemaCode} 不存在(模型读面为空)——本次没有扫描任何东西,空 triggers 不代表「没有触发」`, 0);
|
|
906
934
|
const rows = Array.isArray(body.rules) ? body.rules : [];
|
|
@@ -913,7 +941,49 @@ async function scanSchemaTriggers(session, args) {
|
|
|
913
941
|
presetRows.push({ via: "preset", trigger, ruleCode, enabled: row.enabled === true, note: "REST 写入面不派发数据事件——预置行只对平台内部写入生效" });
|
|
914
942
|
continue;
|
|
915
943
|
}
|
|
916
|
-
|
|
944
|
+
const ruleRow = { via: "rule", ruleCode, name: row.name ?? null, defaultRule: false, enabled: row.enabled === true, status: row.status ?? null };
|
|
945
|
+
ruleRows.push(ruleRow);
|
|
946
|
+
customRuleRows.push({ row: ruleRow, id: typeof row.id === "string" && row.id !== "" ? row.id : null });
|
|
947
|
+
}
|
|
948
|
+
// 4b. 调度摘要:自定义规则逐条 keys 瘦身读(rule.get 的
|
|
949
|
+
// {keys:["bizRuleType","schedulerSetting"]} 同一读面),≤20 条。
|
|
950
|
+
// 所有命中行回填 bizRuleType;TIMING(===2)行再回投影后的 scheduler
|
|
951
|
+
// (7 键)——filterConditionGroups/second/endType 等大块留给 rule.get。
|
|
952
|
+
// 单条失败不连坐:该行两个键都不回,失败计数进 scanned。
|
|
953
|
+
// 必须在 action 过滤**之前**回填,否则 action 视图看不到调度。
|
|
954
|
+
const readTargets = customRuleRows.slice(0, TRIGGER_SCHEDULER_MAX_RULES);
|
|
955
|
+
if (customRuleRows.length > TRIGGER_SCHEDULER_MAX_RULES)
|
|
956
|
+
notScanned.push(`自定义规则 ${customRuleRows.length} 条 > ${TRIGGER_SCHEDULER_MAX_RULES}:第 ${TRIGGER_SCHEDULER_MAX_RULES + 1} 条起未读调度摘要(用 rule.get keys:["bizRuleType","schedulerSetting"])`);
|
|
957
|
+
for (const target of readTargets) {
|
|
958
|
+
const id = target.id ?? (await resolveRuleRowId(session, schemaCode, target.row.ruleCode));
|
|
959
|
+
if (id === null) {
|
|
960
|
+
schedulerReadFailed += 1;
|
|
961
|
+
continue;
|
|
962
|
+
}
|
|
963
|
+
try {
|
|
964
|
+
const record = (await wireCall(session, { path: ENDPOINTS.businessRuleGet, query: { id } })).data;
|
|
965
|
+
if (record === null) {
|
|
966
|
+
schedulerReadFailed += 1;
|
|
967
|
+
continue;
|
|
968
|
+
}
|
|
969
|
+
schedulerReads += 1;
|
|
970
|
+
if (typeof record.bizRuleType === "number")
|
|
971
|
+
target.row.bizRuleType = record.bizRuleType;
|
|
972
|
+
if (record.bizRuleType === RULE_BIZ_TYPE_TIMING) {
|
|
973
|
+
const settings = parseRuleColumn(record.schedulerSetting);
|
|
974
|
+
if (settings !== null && typeof settings === "object" && !Array.isArray(settings)) {
|
|
975
|
+
const source = settings;
|
|
976
|
+
const projected = {};
|
|
977
|
+
for (const key of TRIGGER_SCHEDULER_KEYS)
|
|
978
|
+
if (source[key] !== undefined)
|
|
979
|
+
projected[key] = source[key];
|
|
980
|
+
target.row.scheduler = projected;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
catch {
|
|
985
|
+
schedulerReadFailed += 1;
|
|
986
|
+
}
|
|
917
987
|
}
|
|
918
988
|
}
|
|
919
989
|
// 5. 在线 JS 文本匹配(零 wire;无脚本时第 3 步已记 notScanned)。
|
|
@@ -944,15 +1014,17 @@ async function scanSchemaTriggers(session, args) {
|
|
|
944
1014
|
const filterNote = action !== undefined && action !== "flow"
|
|
945
1015
|
? `;action:"${action}" 的规则绑定判据=workflow 行的 activityCode/nodeEvent/handler 或按钮的 buttonCode/targetCode 含「${action}」,或规则 code 就是 ${action}(不区分大小写,启发式;完整清单去掉 action)`
|
|
946
1016
|
: "";
|
|
1017
|
+
// T02b:调度摘要的 wire 说明。本 kind 没有 wire.plan 键,就按既有形状进 note。
|
|
1018
|
+
const schedulerNote = activityCodeFilter === undefined ? ";调度摘要另 +≤20 次 rule.get keys 瘦身读(bizRuleType/schedulerSetting)" : "";
|
|
947
1019
|
return {
|
|
948
1020
|
schemaCode,
|
|
949
1021
|
action: action ?? null,
|
|
950
1022
|
mode,
|
|
951
1023
|
triggers,
|
|
952
|
-
scanned: { workflows, rules: scannedRules, buttons: scannedButtons, onlinejsBytes },
|
|
1024
|
+
scanned: { workflows, rules: scannedRules, buttons: scannedButtons, onlinejsBytes, schedulerReads, schedulerReadFailed },
|
|
953
1025
|
notScanned,
|
|
954
1026
|
scanMode: "source",
|
|
955
|
-
note: "零命中=本次扫描未命中触发点,不代表没有触发;在线 JS 是文本匹配,可能漏动态拼 URL" + filterNote,
|
|
1027
|
+
note: "零命中=本次扫描未命中触发点,不代表没有触发;在线 JS 是文本匹配,可能漏动态拼 URL" + schedulerNote + filterNote,
|
|
956
1028
|
...(activityCodeFilter !== undefined ? { activityCode: activityCodeFilter } : {}),
|
|
957
1029
|
applicationResolution: { ...applicationResolutionOf(scope), mode: "trigger", models: 1 },
|
|
958
1030
|
};
|
|
@@ -1034,7 +1106,7 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1034
1106
|
}));
|
|
1035
1107
|
tools.push(defineTool({
|
|
1036
1108
|
name: "rule.references",
|
|
1037
|
-
search: { intents: ["规则引用", "查规则引用", "谁用了规则"] },
|
|
1109
|
+
search: { intents: ["规则引用", "查规则引用", "谁用了规则", "触发点", "有哪些触发", "触发器清单", "模型的自动化", "定时规则在哪"] },
|
|
1038
1110
|
layer: "low",
|
|
1039
1111
|
kind: "read",
|
|
1040
1112
|
lane: RULE_LANE,
|
|
@@ -1697,6 +1769,7 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1697
1769
|
allowAdvisory: z.boolean().optional().describe("调查逃生口;默认 false"),
|
|
1698
1770
|
allowAbsentMappingFields: z.boolean().optional().describe("逃生阀:codeType:1 映射 bizCode 不在来源模型已发布字段时仍保存(回执 absentMappingFieldsAllowed 点名);默认拒 rule-mapping-field-absent(平台侧不保证拦,运行时静默 null→10005)"),
|
|
1699
1771
|
allowDesignerTextOverwrite: z.boolean().optional().describe("逃生阀:覆盖映射现存的设计器公式文本(editorText/editorMark);默认保留现存设计器文本只更新 formula(回执 preservedDesignerText 点名)"),
|
|
1772
|
+
confirmUnlink: z.boolean().optional().describe("确认解绑:本次保存会让现存图里的方法映射引用消失(BIZ_ACTION 节点被删或 methodMapping 被移除/改指向)。默认拒绝;解绑会降低对应方法的 count_mapping,可能让被引用方法变得可删——应由用户决策"),
|
|
1700
1773
|
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 退回"),
|
|
1701
1774
|
},
|
|
1702
1775
|
execute: async (session, args) => executeRuleSaveWrite(session, args),
|
|
@@ -410,6 +410,29 @@ function compactRuntimeRecord(record) {
|
|
|
410
410
|
}
|
|
411
411
|
return compact;
|
|
412
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* F6 工单 05b(2026-11-21):`data.list` 内联子表行后,agent 不知道有
|
|
415
|
+
* `data.aggregate child`,只能拉全量子行、再也不会想到计数/合计可以一次服务端
|
|
416
|
+
* 完成。检测「值是对象数组」的字段(子表字段 code 就是 childSchemaCode——与
|
|
417
|
+
* data.aggregate 的 child.childSchemaCode 同义),给出按需读取数面的指路。
|
|
418
|
+
* 只探测、不加 wire;每次回执至多一句。
|
|
419
|
+
*/
|
|
420
|
+
function inlineChildRowsOf(fields, bizObjectId) {
|
|
421
|
+
const id = String(bizObjectId ?? "").trim();
|
|
422
|
+
if (id === "")
|
|
423
|
+
return undefined;
|
|
424
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
425
|
+
if (key === "" || !Array.isArray(value) || value.length === 0)
|
|
426
|
+
continue;
|
|
427
|
+
if (!value.every((entry) => entry !== null && typeof entry === "object" && !Array.isArray(entry)))
|
|
428
|
+
continue;
|
|
429
|
+
return { childSchemaCode: key, bizObjectId: id };
|
|
430
|
+
}
|
|
431
|
+
return undefined;
|
|
432
|
+
}
|
|
433
|
+
function childRowsAggregateHint(hit, schemaCode, lead) {
|
|
434
|
+
return `${lead};只要子表**计数/合计**:omc call data.aggregate --args '{"schemaCode":"${schemaCode}","metric":"count","child":{"childSchemaCode":"${hit.childSchemaCode}","bizObjectId":"${hit.bizObjectId}"}}'(服务端计数零行内联,数值只拉目标列)`;
|
|
435
|
+
}
|
|
413
436
|
/**
|
|
414
437
|
* Round 3 (issue §D5): the write readback inlined the whole `authoritative`
|
|
415
438
|
* record (owner/creater objects included), ~4 KB a row. Default is now the
|
|
@@ -1877,9 +1900,15 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1877
1900
|
const hasNullValue = items.some((item) => Object.values(item.fields).some((value) => value === null));
|
|
1878
1901
|
const viewEvidence = hasNullValue ? await listViewProjectionEvidence(session, args.schemaCode, args.queryCode ?? args.schemaCode) : undefined;
|
|
1879
1902
|
const projectionHintPaged = projectionHintFace(items, viewEvidence);
|
|
1903
|
+
// F6 工单 05b:只有本页行真的内联了子表数组才给一句(否则零字节);
|
|
1904
|
+
// 取第一条命中行,命令里的 schemaCode/childSchemaCode/bizObjectId 都是真值。
|
|
1905
|
+
const inlineChild = items
|
|
1906
|
+
.map((item) => inlineChildRowsOf(item.fields, item.id))
|
|
1907
|
+
.find((hit) => hit !== undefined);
|
|
1880
1908
|
const readback = {
|
|
1881
1909
|
schemaCode: args.schemaCode,
|
|
1882
1910
|
...application,
|
|
1911
|
+
...(inlineChild !== undefined ? { childRowsHint: childRowsAggregateHint(inlineChild, args.schemaCode, "本页内联了子表行") } : {}),
|
|
1883
1912
|
...(projectionEmpty ? { projectionWarning: { reason: "business-columns-null", hint: "模型可能未配置列表视图:data.list 只投影列表列,业务列会全为 null;核对写入结果请用 data.load(或先建列表视图)" } } : {}),
|
|
1884
1913
|
...(projectionEmpty ? { viewProjectionOnly: true, hint: VIEW_PROJECTION_HINT } : {}),
|
|
1885
1914
|
...(args.queryCode !== undefined ? { queryCode: args.queryCode } : {}),
|
|
@@ -2660,7 +2689,12 @@ export function registerRuntimeDataLane(tools) {
|
|
|
2660
2689
|
missingFields = missing;
|
|
2661
2690
|
}
|
|
2662
2691
|
}
|
|
2663
|
-
|
|
2692
|
+
// F6 工单 05b:读回记录里内联子表数组时给同一句指路(命令填真值);
|
|
2693
|
+
// 没有子表数组就零字节,不改变任何既有回执字段。
|
|
2694
|
+
const inlineChild = data && typeof data === "object" && !Array.isArray(data)
|
|
2695
|
+
? inlineChildRowsOf(data, args.bizObjectId)
|
|
2696
|
+
: undefined;
|
|
2697
|
+
return { schemaCode: args.schemaCode, bizObjectId: args.bizObjectId, exists: data != null, ...(missingFields ? { missingFields, availableFields: data && typeof data === "object" ? Object.keys(data) : [] } : {}), ...(includeSchema ? {} : { schemaCached: true }), ...(inlineChild !== undefined ? { childRowsHint: childRowsAggregateHint(inlineChild, args.schemaCode, "本记录内联了子表行") } : {}), data };
|
|
2664
2698
|
}, { full: args.full === true, target: `data.load:${args.schemaCode}:${args.bizObjectId}` });
|
|
2665
2699
|
},
|
|
2666
2700
|
}));
|
|
@@ -40,6 +40,37 @@ function mappedMethodNodeCodes(nodeColumn, serviceCode, methodCode) {
|
|
|
40
40
|
}
|
|
41
41
|
return nodeCodes;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Ticket 04 (2026-11-21, F6) — every method mapping carried by one rule graph,
|
|
45
|
+
* as a deduped `"serviceCode/serviceMethodCode"` set. Accepts the `node` column
|
|
46
|
+
* shape directly (JSON string or array; same tolerance as
|
|
47
|
+
* `mappedMethodNodeCodes`). A mapping with a blank service or method code is
|
|
48
|
+
* not a reference (the platform maps nothing), so it is dropped.
|
|
49
|
+
*
|
|
50
|
+
* This is the single source for "which methods does this graph point at?" —
|
|
51
|
+
* `rule.save`'s unlink gate compares the live row's set with the new graph's
|
|
52
|
+
* set instead of re-walking nodes on its own.
|
|
53
|
+
*/
|
|
54
|
+
export function methodMappingRefsOf(nodes) {
|
|
55
|
+
const decoded = decodeJsonColumn(nodes, JSON_COLUMN_NULL_COALESCE);
|
|
56
|
+
if (!Array.isArray(decoded))
|
|
57
|
+
return [];
|
|
58
|
+
const refs = [];
|
|
59
|
+
for (const entry of decoded) {
|
|
60
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
61
|
+
continue;
|
|
62
|
+
const mapping = entry.methodMapping;
|
|
63
|
+
if (!mapping || typeof mapping !== "object" || Array.isArray(mapping))
|
|
64
|
+
continue;
|
|
65
|
+
const mapped = mapping;
|
|
66
|
+
const serviceCode = String(mapped.serviceCode ?? "").trim();
|
|
67
|
+
const methodCode = String(mapped.serviceMethodCode ?? "").trim();
|
|
68
|
+
if (serviceCode === "" || methodCode === "")
|
|
69
|
+
continue;
|
|
70
|
+
refs.push(`${serviceCode}/${methodCode}`);
|
|
71
|
+
}
|
|
72
|
+
return [...new Set(refs)];
|
|
73
|
+
}
|
|
43
74
|
/**
|
|
44
75
|
* Best-effort reference identity: viewReference → schemaCodes (≤25) → per-model
|
|
45
76
|
* rule list (≤50 rules) → per-rule graph read → methodMapping match
|
|
@@ -122,7 +153,7 @@ export async function scanMethodReferenceSites(session, serviceCode, methodCode)
|
|
|
122
153
|
* `method.delete` and the intent warning append `methodReferenceIdentity`.
|
|
123
154
|
*/
|
|
124
155
|
export function methodReferencedCoreMessage(serviceCode, methodCode, count) {
|
|
125
|
-
return `业务方法 ${serviceCode}/${methodCode} 被 ${count} 条规则映射引用——平台删除会回 500108「业务方法已绑定默认方法,不可删除」(BizServiceMethodController.java:248-281),本次零写入:方法、规则与绑定保持原状。要删必须先解绑引用规则(rule.save
|
|
156
|
+
return `业务方法 ${serviceCode}/${methodCode} 被 ${count} 条规则映射引用——平台删除会回 500108「业务方法已绑定默认方法,不可删除」(BizServiceMethodController.java:248-281),本次零写入:方法、规则与绑定保持原状。要删必须先解绑引用规则(rule.save(需 confirmUnlink:true)去掉对应 BIZ_ACTION 节点、保留其余节点/routes/schedulerSetting,重新发布)再删方法。不要自行解绑规则、不要改调度生效时间后再删方法——解绑属于高危写入,必须用户确认`;
|
|
126
157
|
}
|
|
127
158
|
/** Readable suffix for the reference scan: site identities, or a pointer when the scan hit nothing. */
|
|
128
159
|
export function methodReferenceIdentity(sites, serviceCode) {
|
package/dist/read-shapes.js
CHANGED
|
@@ -102,8 +102,8 @@ const READ_SHAPES = {
|
|
|
102
102
|
},
|
|
103
103
|
// r80:计数/分组统计的读回面。notes 只显首条——把陷阱并进第一句。
|
|
104
104
|
"data.aggregate": {
|
|
105
|
-
keys: ["schemaCode", "metric", "field?", "value?", "count", "nonNullCount?", "nullCount?", "groupBy?", "total", "buckets:array<{key,count,nonNullCount?,value?}>", "nullBucket:{count,nonNullCount?,value?}", "truncatedBuckets", "bucketsTruncatedCount", "unaccountedCount?", "shapeWarnings?", "strategyFallback?", "coverage:{mode:server-total|paged-local-scan|local-scan|server-aggregate,rowsScanned,cap,complete,missingCount?}", "filter:{draftPolicy,hint}", "wire:{calls,plan,concurrency?}", "capNotice?", "note?", "environmentFingerprint"],
|
|
106
|
-
notes: ["计数用 total(totalElements);分组=值域×count,key 是存储值/code,null 单列 nullBucket;分桶 count 并发窗口 4;数值指标(sum/avg/min/max+field)本地折叠(cap 1000,null 不进聚合、avg 分母排除 null);coverage.mode=server-total/paged-local-scan/local-scan/server-aggregate,/sum 不可用或形状不符回退本地(strategyFallback);complete:false 只覆盖已扫行,勿外推"],
|
|
105
|
+
keys: ["schemaCode", "metric", "field?", "value?", "count", "nonNullCount?", "nullCount?", "groupBy?", "total", "buckets:array<{key,count,nonNullCount?,value?}>", "nullBucket:{count,nonNullCount?,value?}", "truncatedBuckets", "bucketsTruncatedCount", "unaccountedCount?", "shapeWarnings?", "strategyFallback?", "coverage:{mode:server-total|paged-local-scan|local-scan|server-aggregate|server-child|local-scan-child,rowsScanned,cap,complete,missingCount?}", "child:{childSchemaCode,bizObjectId}?", "pages?", "partial?", "readFailure:{page,code?,message}?", "filter:{draftPolicy,hint}", "wire:{calls,plan,concurrency?}", "capNotice?", "note?", "environmentFingerprint"],
|
|
106
|
+
notes: ["计数用 total(totalElements);分组=值域×count,key 是存储值/code,null 单列 nullBucket;分桶 count 并发窗口 4;数值指标(sum/avg/min/max+field)本地折叠(cap 1000,null 不进聚合、avg 分母排除 null);coverage.mode=server-total/paged-local-scan/local-scan/server-aggregate,/sum 不可用或形状不符回退本地(strategyFallback);complete:false 只覆盖已扫行,勿外推", "child=子表目标:count 走 list_child totalElements,数值列只拉目标列分页折叠"],
|
|
107
107
|
},
|
|
108
108
|
"app.list": {
|
|
109
109
|
keys: ["applications:array<{code,name,groupId?,modelCount}>", "applicationsCount", "omitted"],
|
package/dist/rule-support.js
CHANGED
|
@@ -8,6 +8,7 @@ import { RULE_BIZ_RULE_TYPE_DESCRIPTION, RULE_CREATE_BODY, RULE_ROUTES_DESCRIPTI
|
|
|
8
8
|
import { validateRuleNodeGraph, prepareRuleGraph, PLATFORM_TRIGGER_RULE_CODES, DEFAULT_SYSTEM_NODE_BY_RULE_CODE } from "./lanes/rule-graph.js";
|
|
9
9
|
import { FORMULA_LINT_CODES } from "./formula-lint.js";
|
|
10
10
|
import { compileMethodConfigPlain } from "./bizservice-config.js";
|
|
11
|
+
import { methodMappingRefsOf } from "./method-references.js";
|
|
11
12
|
import { closestMatches } from "./closest-match.js";
|
|
12
13
|
import { RESERVED_CODES } from "./code-rules.js";
|
|
13
14
|
import { SYSTEM_FIELD_CODES } from "./field-families.js";
|
|
@@ -1188,7 +1189,7 @@ function collectEmptyMappings(nodes) {
|
|
|
1188
1189
|
}
|
|
1189
1190
|
return empty;
|
|
1190
1191
|
}
|
|
1191
|
-
export async function lintRuleSaveWrite(session, args) {
|
|
1192
|
+
export async function lintRuleSaveWrite(session, args, options = {}) {
|
|
1192
1193
|
// r85(issue 03/08):幻影 schema 门提前到一切规则面 wire 之前(原在图 lint 后,
|
|
1193
1194
|
// 而 computeCarriedNodeCodes 已会 list——提前只收紧不放松;后续 routes 沿用
|
|
1194
1195
|
// 读取/设计器保读都以 schema 已证存在为前提)。
|
|
@@ -1233,6 +1234,43 @@ export async function lintRuleSaveWrite(session, args) {
|
|
|
1233
1234
|
// the SAME lint now serves the real write AND `rule.node.update`'s
|
|
1234
1235
|
// dryRunPayload, so a dry-run answers the same 能写/不能写 question.
|
|
1235
1236
|
const { preparedGraph, blockers, lintWarnings, lintHazards, nodes, routes } = await lintRuleGraphForWrite(session, { ...args, nodeGraph: graph });
|
|
1237
|
+
// ── Ticket 04(2026-11-21,F6 实证):rule.save 解绑硬门 ──
|
|
1238
|
+
//
|
|
1239
|
+
// F6:0.6.90 的 `method.delete` 预检正确拒绝了被引用方法的删除,但拒绝回执里
|
|
1240
|
+
// 的 `options.unlink.steps` 被自主 agent 当操作手册逐步执行(rule.save 去掉
|
|
1241
|
+
// BIZ_ACTION 节点 → method.delete 成功)。`requiresConfirmation:true` 是文档,
|
|
1242
|
+
// 不是门。解绑本身是高风险写入(降低 count_mapping、打开方法删除门),必须由用户
|
|
1243
|
+
// 决策——所以 `rule.save` 在**保存 wire 之前**对比活行图与本图的方法映射引用:
|
|
1244
|
+
// 只**消失**的引用会拒绝(新增/改动映射参数/挪节点/只加绑定全部放行),除非
|
|
1245
|
+
// 调用方显式 `confirmUnlink:true`。零写入:本门在图 lint 之后、任何写 wire 之前。
|
|
1246
|
+
//
|
|
1247
|
+
// 已知边界:`rule.node.update` 的节点级 patch(含整组替换 methodMapping)不在
|
|
1248
|
+
// 本门覆盖范围——它是「单节点 patch」不是整图重画,mapping patch 本身不删节点;
|
|
1249
|
+
// 其 execute 以 origin.operation:"patch" 显式跳过本门(lintRuleSaveWrite options)。
|
|
1250
|
+
// 活行读不到(读面故障)时不做有罪推定:无法比较引用集合即放行,不新增一条
|
|
1251
|
+
// 「读不到就不让保存」的硬失败面。
|
|
1252
|
+
if (options.unlinkGate !== false && existing?.id) {
|
|
1253
|
+
const liveRow = await loadCurrentRow();
|
|
1254
|
+
if (liveRow) {
|
|
1255
|
+
const liveRefs = methodMappingRefsOf(liveRow.node);
|
|
1256
|
+
if (liveRefs.length > 0) {
|
|
1257
|
+
const nextRefs = new Set(methodMappingRefsOf(nodes));
|
|
1258
|
+
const disappearingRefs = liveRefs.filter((ref) => !nextRefs.has(ref));
|
|
1259
|
+
if (disappearingRefs.length > 0 && args.confirmUnlink !== true) {
|
|
1260
|
+
throw new ToolRefusalError({
|
|
1261
|
+
status: "refused",
|
|
1262
|
+
blocker: "rule-unbind-requires-confirmation",
|
|
1263
|
+
schemaCode: args.schemaCode,
|
|
1264
|
+
ruleCode: args.ruleCode,
|
|
1265
|
+
disappearingRefs,
|
|
1266
|
+
doNot: "不要为了删方法而解绑规则;这是影响生产行为的高危写入,必须用户决策",
|
|
1267
|
+
nextCommand: `omc call rule.save --args '{"schemaCode":"${args.schemaCode}","ruleCode":"${args.ruleCode}","name":"${args.name}","nodeGraph":<本次 nodeGraph 原样>,"confirmUnlink":true}'(确要解绑就带本次同参 + confirmUnlink:true 重发)`,
|
|
1268
|
+
message: `本次保存会让方法映射引用 ${disappearingRefs.join("、")} 从规则 ${args.schemaCode}.${args.ruleCode} 的图里消失(BIZ_ACTION 节点被删或 methodMapping 被移除/改指向)——保存后这些方法的 count_mapping 会下降,对应方法的删除门会因此打开。默认拒绝、零写入;确要解绑就带 confirmUnlink:true 重发(高危,必须用户决策)。`,
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1236
1274
|
await assertCreateSelectionCompatibility(session, args.schemaCode, Array.isArray(nodes) ? nodes : []);
|
|
1237
1275
|
// r85(issue 08):codeType:1 映射字段预检(QUERY 上游模型解析 + did-you-mean
|
|
1238
1276
|
// + allowAbsentMappingFields 逃生阀)。r21 的同模型门已并入本门。
|
|
@@ -1517,7 +1555,7 @@ export function ruleStatusSegment(input) {
|
|
|
1517
1555
|
}
|
|
1518
1556
|
export async function executeRuleSaveWrite(session, args, origin = { operation: "save" }) {
|
|
1519
1557
|
// 与 dry-run 同源:同一套只读门先跑,然后才写。
|
|
1520
|
-
const { lintWarnings, lintHazards, bizMethodChecks, existing, customTriggerApplied, isPresetRule, bizRuleType, nodeJson, routeJson, schedulerField, schedulerSetting, nodes, routesSource, emptyMappings, preservedDesignerText, designerTextOverwritten, mappingFieldChecks, absentMappingFields, } = await lintRuleSaveWrite(session, args);
|
|
1558
|
+
const { lintWarnings, lintHazards, bizMethodChecks, existing, customTriggerApplied, isPresetRule, bizRuleType, nodeJson, routeJson, schedulerField, schedulerSetting, nodes, routesSource, emptyMappings, preservedDesignerText, designerTextOverwritten, mappingFieldChecks, absentMappingFields, } = await lintRuleSaveWrite(session, args, { unlinkGate: origin.operation !== "patch" });
|
|
1521
1559
|
// r85(retro 2026-11-19):dry-run 与真写共用的回执增量(routes 沿用 / 空映射 /
|
|
1522
1560
|
// 设计器文本保读 / 映射字段预检)。
|
|
1523
1561
|
const r85Readback = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.91",
|
|
4
4
|
"description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"commander": "14.0.3",
|
|
59
|
-
"omc-core": "0.6.
|
|
59
|
+
"omc-core": "0.6.91",
|
|
60
60
|
"proper-lockfile": "4.1.2",
|
|
61
61
|
"write-file-atomic": "6.0.0",
|
|
62
62
|
"zod": "^3.23.8",
|
|
@@ -74,6 +74,6 @@
|
|
|
74
74
|
"directory": "packages/omc-cli"
|
|
75
75
|
},
|
|
76
76
|
"optionalDependencies": {
|
|
77
|
-
"@stalfh233/omc-fake-platform": "0.6.
|
|
77
|
+
"@stalfh233/omc-fake-platform": "0.6.91"
|
|
78
78
|
}
|
|
79
79
|
}
|