@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/mcp-graph.js
CHANGED
|
@@ -126,7 +126,7 @@ function respondError(id, code, message) {
|
|
|
126
126
|
export const INSTRUCTIONS_INDEXED = [
|
|
127
127
|
"规则/配置图检索——回答关系型配置问题的第一入口(本地索引,先于逐平台扫描):谁用到 X / 关于 X 配了哪些规则 / 改动 X 影响什么,毫秒级一次答全,替代逐模型 model.inspect/rule.list 枚举(N 次调用 → 1 次)。",
|
|
128
128
|
"- 改名/删除/重构一个 字段(field)/模型(model)/服务(service) 前,必先用 omc_graph_explore 查引用与影响面;查\"谁引用了 X\"也走它。",
|
|
129
|
-
"- 覆盖对照(先验):在线面 `omc call rule.references`(实时,仅 businessrule,不含条件叶子);本索引(离线快照,businessrule+datarule+listview
|
|
129
|
+
"- 覆盖对照(先验):在线面 `omc call rule.references`(实时,仅 businessrule,不含条件叶子);本索引(离线快照,businessrule+datarule+listview+form+workflow(条件+字段权限),且含规则条件叶子 rule.condition 边)——条件/表单控件/流程权限里的字段引用离线一次可答;在线面对 workflow/form 没有快查工具,离线索引是这两个面的唯一快查面(workflow.bindings 与 onlinejs 仍未扫,见 coverage.notScanned)。",
|
|
130
130
|
"- 不确定查哪个库时先调 omc_graph_projects(零参数):列出所有项目根 + 各自可查的环境名。",
|
|
131
131
|
"- 每个索引的身份是「项目根 + 环境名」这一对:同一个项目可以同时建了 test/prod 等多份,同一环境也可以被多个项目各自 pull。所以 explore/status 用 project(目录名或绝对路径)+ env 指定;只给 env 时不唯一就会报歧义并列出可用环境。",
|
|
132
132
|
"- query 可为业务名(实体 name+code 子串)、字段/模型/服务 code,或 `<schemaCode>.<字段code>`(同名字段精确消歧,如 crm_contract.contract_no)。",
|
|
@@ -145,7 +145,7 @@ const EXPLORE_TOOL = {
|
|
|
145
145
|
"输入 query 可为业务名(实体 name+code 子串)、规则 code+name 词首、字段/模型/服务 code,或 `<schemaCode>.<字段code>`(同名字段精确消歧,如 crm_contract.contract_no)。kind 可选 field|model|service,不给则三种都查。",
|
|
146
146
|
"返回 {index(freshness), references:{kind:[{schemaCode,ruleCode,nodeCode,nodeType,via,referrer,isSelf}]}, impact:{kind:totals}, search:{matches:{model,field,service},rules}}。",
|
|
147
147
|
"references/impact 支持 offset+limit 分页;truncated 时按返回的 nextOffset 继续调用。实体分页结果带 nextCall;分页不会改变 resolved。字段同名时用 schemaCode 参数或 <schemaCode>.<字段code> 写法消歧。",
|
|
148
|
-
"覆盖对照(先验):在线面 `omc call rule.references` 实时但仅 businessrule、不含条件叶子;本索引是离线快照(businessrule 含条件叶子 rule.condition 边 + datarule + listview
|
|
148
|
+
"覆盖对照(先验):在线面 `omc call rule.references` 实时但仅 businessrule、不含条件叶子;本索引是离线快照(businessrule 含条件叶子 rule.condition 边 + datarule + listview + form 控件 + workflow 条件/字段权限)——条件/表单/流程权限里的字段引用离线一次可答(workflow.bindings 与 onlinejs 仍未扫);freshness=partial 时命中可能不完整(答案里有 gapWarning)。",
|
|
149
149
|
"改/删/重命名任何字段、模型、服务之前必查;找\"关于 X 的规则\"拿 code 也走这里。",
|
|
150
150
|
].join(" "),
|
|
151
151
|
inputSchema: {
|
|
@@ -404,6 +404,8 @@ export async function executeGraphTool(name, rawArgs, context) {
|
|
|
404
404
|
rules: cap(scopedRules, offset, limit),
|
|
405
405
|
datarules: cap(imp.datarules, offset, limit),
|
|
406
406
|
listviews: cap(imp.listviews, offset, limit),
|
|
407
|
+
workflows: cap(imp.workflows, offset, limit),
|
|
408
|
+
forms: cap(imp.forms, offset, limit),
|
|
407
409
|
...(one === "model" ? {
|
|
408
410
|
fieldsReferenced: [...imp.rules.flatMap((r) => r.touches.field.map((code) => ({ code, ruleCode: r.ruleCode }))).reduce((m, x) => {
|
|
409
411
|
const item = m.get(x.code) ?? { code: x.code, touchedByRules: [] };
|
|
@@ -450,7 +452,7 @@ export async function executeGraphTool(name, rawArgs, context) {
|
|
|
450
452
|
// 手抄版已经漂过一次(mustCheckManually/note/crossFace 全丢)。这里直接
|
|
451
453
|
// 展开,新增字段自动透传。
|
|
452
454
|
coverage: { ...index.coverage, ...GRAPH_COVERAGE },
|
|
453
|
-
note: `零命中只代表 references[].coverage.scanned 面没有命中;字段面覆盖应用:${index.coverage.fields?.coveredApplications.join("、") || "(未知)"};notScanned
|
|
455
|
+
note: `零命中只代表 references[].coverage.scanned 面没有命中;字段面覆盖应用:${index.coverage.fields?.coveredApplications.join("、") || "(未知)"};notScanned 面(workflow.bindings 与 onlinejs)未扫描,不可据此判定可安全删除或无影响`,
|
|
454
456
|
});
|
|
455
457
|
}
|
|
456
458
|
return toolError(`未知工具:${name}`);
|
package/dist/package-tool.js
CHANGED
|
@@ -27,6 +27,10 @@ export function registerPackageTool(tools, spec) {
|
|
|
27
27
|
lane: spec.lane,
|
|
28
28
|
scope: spec.scope,
|
|
29
29
|
description: `${spec.description} ${WRITE_PROTOCOL}`,
|
|
30
|
+
// R75-B:包工具的 dry-run 是 plan-only + 可选 preflight;execute 里的各步
|
|
31
|
+
// session 门不会在预览里跑。诚实标注 partial,别让 dry-run 变成绿灯承诺。
|
|
32
|
+
lintScope: "partial",
|
|
33
|
+
lintUnchecked: ["batch-step-session-lint", "local-write-gates", "platform-side-validation", "post-write-readback"],
|
|
30
34
|
inputSchema: { environment: environmentArg, ...spec.inputSchema, confirmProduction: confirmProductionArg, dryRun: z.boolean().optional(), capability: capabilityArg },
|
|
31
35
|
handler: async (ctx, args, self) => {
|
|
32
36
|
spec.preflight?.(args);
|
package/dist/path-projection.js
CHANGED
|
@@ -116,7 +116,11 @@ export function projectJsonPath(value, path) {
|
|
|
116
116
|
const record = current;
|
|
117
117
|
if (!Object.prototype.hasOwnProperty.call(record, segment)) {
|
|
118
118
|
const keys = Object.keys(record);
|
|
119
|
-
|
|
119
|
+
if (keys.length === 0)
|
|
120
|
+
return { missed: true, at: segment, available: "(该层是空对象)" };
|
|
121
|
+
// r75:available 截断保持(回执字节纪律),完整键表走 layerAvailable()
|
|
122
|
+
// 的 availableAll——didYouMean 不许被 12 键窗口毒化。
|
|
123
|
+
return { missed: true, at: segment, ...layerAvailable(keys) };
|
|
120
124
|
}
|
|
121
125
|
current = record[segment];
|
|
122
126
|
}
|
|
@@ -126,19 +130,90 @@ export function projectJsonPath(value, path) {
|
|
|
126
130
|
}
|
|
127
131
|
return { missed: false, value: current };
|
|
128
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* r75 调查C(bug 修复):pathMiss 的 available 只内联前 12 键(回执字节纪律),
|
|
135
|
+
* 但 didYouMean 必须对**完整键表**计算——真机(r75)实证 `--jq nodez` 在 22 键
|
|
136
|
+
* 层上建议了 `code` 而非 `nodes`:真目标在第 16 位,被 12 键窗口切掉后
|
|
137
|
+
* closestMatch 只能对残表挑最近。截断数以 availableTruncated(该层键总数)
|
|
138
|
+
* 随回执同行,调用方据此知道 available 不是全集。
|
|
139
|
+
*/
|
|
140
|
+
function layerAvailable(keys) {
|
|
141
|
+
const shown = keys.slice(0, 12);
|
|
142
|
+
if (keys.length > shown.length)
|
|
143
|
+
return { available: shown, availableAll: keys, availableTruncated: keys.length };
|
|
144
|
+
return { available: shown };
|
|
145
|
+
}
|
|
146
|
+
/** `--depth` 的硬顶:深度 4 已足够导航,再深就成了正文复刻(字节失控)。 */
|
|
147
|
+
export const SHAPE_MAX_DEPTH = 4;
|
|
148
|
+
const SHAPE_DEFAULT_DEPTH = 2;
|
|
149
|
+
const SHAPE_MAX_KEYS_PER_LEVEL = 24;
|
|
150
|
+
const SHAPE_SAMPLE_MAX_CHARS = 40;
|
|
151
|
+
/** 嵌套数组的链深防御(JSON 无环,但 [[[[…]]]] 会沿首元素无限下钻)。 */
|
|
152
|
+
const SHAPE_MAX_ARRAY_CHAIN = 3;
|
|
153
|
+
/** 总节点预算:深度 × 键上限的理论最坏(24³)远超回执预算,到顶即收敛为键名层。 */
|
|
154
|
+
const SHAPE_MAX_NODES = 400;
|
|
155
|
+
export function shapeOf(value, depth = SHAPE_DEFAULT_DEPTH) {
|
|
156
|
+
const clamped = Number.isFinite(depth) ? Math.min(Math.max(Math.trunc(depth), 1), SHAPE_MAX_DEPTH) : SHAPE_DEFAULT_DEPTH;
|
|
157
|
+
return shapeNode(value, clamped, SHAPE_MAX_ARRAY_CHAIN, { count: 0 });
|
|
158
|
+
}
|
|
159
|
+
function shapeNode(value, depth, arrayChain, nodes) {
|
|
160
|
+
nodes.count += 1;
|
|
161
|
+
if (value === null)
|
|
162
|
+
return { kind: "null" };
|
|
163
|
+
if (Array.isArray(value)) {
|
|
164
|
+
const base = { kind: "array", length: value.length };
|
|
165
|
+
if (value.length === 0 || arrayChain <= 0 || nodes.count > SHAPE_MAX_NODES)
|
|
166
|
+
return base;
|
|
167
|
+
return { ...base, items: shapeNode(value[0], depth, arrayChain - 1, nodes) };
|
|
168
|
+
}
|
|
169
|
+
if (typeof value === "object") {
|
|
170
|
+
const entries = Object.entries(value);
|
|
171
|
+
if (entries.length === 0)
|
|
172
|
+
return { kind: "object" };
|
|
173
|
+
const shown = entries.slice(0, SHAPE_MAX_KEYS_PER_LEVEL);
|
|
174
|
+
const moreKeys = entries.length - shown.length;
|
|
175
|
+
// 深度用尽(或节点预算到顶):键名照给(导航价值所在),只是不再展开
|
|
176
|
+
// 下一层。键标签也计入节点预算——病态宽对象不得绕过总预算。
|
|
177
|
+
if (depth <= 0 || nodes.count > SHAPE_MAX_NODES) {
|
|
178
|
+
nodes.count += shown.length;
|
|
179
|
+
const keys = {};
|
|
180
|
+
for (const [key, child] of shown)
|
|
181
|
+
keys[key] = leafKind(child);
|
|
182
|
+
return { kind: "object", keys, ...(moreKeys > 0 ? { moreKeys } : {}) };
|
|
183
|
+
}
|
|
184
|
+
const children = {};
|
|
185
|
+
for (const [key, child] of shown)
|
|
186
|
+
children[key] = shapeNode(child, depth - 1, arrayChain, nodes);
|
|
187
|
+
return { kind: "object", children, ...(moreKeys > 0 ? { moreKeys } : {}) };
|
|
188
|
+
}
|
|
189
|
+
return { kind: typeof value, sample: sampleOf(value) };
|
|
190
|
+
}
|
|
191
|
+
function leafKind(value) {
|
|
192
|
+
if (value === null)
|
|
193
|
+
return "null";
|
|
194
|
+
if (Array.isArray(value))
|
|
195
|
+
return `array[${value.length}]`;
|
|
196
|
+
if (typeof value === "object")
|
|
197
|
+
return "object";
|
|
198
|
+
return typeof value;
|
|
199
|
+
}
|
|
200
|
+
function sampleOf(value) {
|
|
201
|
+
const text = typeof value === "string" ? value : String(value);
|
|
202
|
+
return text.length > SHAPE_SAMPLE_MAX_CHARS ? `${text.slice(0, SHAPE_SAMPLE_MAX_CHARS - 1)}…` : text;
|
|
203
|
+
}
|
|
129
204
|
export function projectJsonPathFanout(value, path) {
|
|
130
205
|
const marker = path.indexOf("[]");
|
|
131
206
|
if (marker < 0) {
|
|
132
207
|
const projected = projectJsonPath(value, path);
|
|
133
208
|
return projected.missed
|
|
134
|
-
? { values: [], missed: true, ...(projected.at !== undefined ? { at: projected.at } : {}), ...(projected.available !== undefined ? { available: projected.available } : {}), missedEntries: 0, nullEntries: 0 }
|
|
209
|
+
? { values: [], missed: true, ...(projected.at !== undefined ? { at: projected.at } : {}), ...(projected.available !== undefined ? { available: projected.available } : {}), ...(projected.availableAll !== undefined ? { availableAll: projected.availableAll } : {}), ...(projected.availableTruncated !== undefined ? { availableTruncated: projected.availableTruncated } : {}), missedEntries: 0, nullEntries: 0 }
|
|
135
210
|
: { values: [projected.value], missed: false, missedEntries: 0, nullEntries: projected.value === null ? 1 : 0 };
|
|
136
211
|
}
|
|
137
212
|
const before = path.slice(0, marker);
|
|
138
213
|
const after = path.slice(marker + 2).replace(/^[./]+/, "");
|
|
139
214
|
const base = projectJsonPath(value, before);
|
|
140
215
|
if (base.missed)
|
|
141
|
-
return { values: [], missed: true, ...(base.at !== undefined ? { at: base.at } : {}), ...(base.available !== undefined ? { available: base.available } : {}), missedEntries: 0, nullEntries: 0 };
|
|
216
|
+
return { values: [], missed: true, ...(base.at !== undefined ? { at: base.at } : {}), ...(base.available !== undefined ? { available: base.available } : {}), ...(base.availableAll !== undefined ? { availableAll: base.availableAll } : {}), ...(base.availableTruncated !== undefined ? { availableTruncated: base.availableTruncated } : {}), missedEntries: 0, nullEntries: 0 };
|
|
142
217
|
if (!Array.isArray(base.value))
|
|
143
218
|
return { values: [], missed: true, at: before || "$", available: `该层不是数组(是 ${base.value === null ? "null" : typeof base.value});[] 只能映射数组,如 items[].fields.planNo`, missedEntries: 0, nullEntries: 0 };
|
|
144
219
|
const values = [];
|
|
@@ -155,7 +230,7 @@ export function projectJsonPathFanout(value, path) {
|
|
|
155
230
|
// array) — report the miss so the caller does not read an empty list as data.
|
|
156
231
|
if (values.length === 0 && missedEntries > 0) {
|
|
157
232
|
const first = projectJsonPathFanout(base.value[0], after);
|
|
158
|
-
return { values: [], missed: true, ...(first.at !== undefined ? { at: `${before}[].${first.at}` } : {}), ...(first.available !== undefined ? { available: first.available } : {}), missedEntries, nullEntries: 0 };
|
|
233
|
+
return { values: [], missed: true, ...(first.at !== undefined ? { at: `${before}[].${first.at}` } : {}), ...(first.available !== undefined ? { available: first.available } : {}), ...(first.availableAll !== undefined ? { availableAll: first.availableAll } : {}), ...(first.availableTruncated !== undefined ? { availableTruncated: first.availableTruncated } : {}), missedEntries, nullEntries: 0 };
|
|
159
234
|
}
|
|
160
235
|
return { values, missed: false, ...(missedEntries > 0 ? { missedEntries } : { missedEntries: 0 }), nullEntries };
|
|
161
236
|
}
|
|
@@ -246,12 +321,14 @@ const PATH_KEY_ALIASES = Object.freeze({
|
|
|
246
321
|
data: "fields",
|
|
247
322
|
props: "properties",
|
|
248
323
|
});
|
|
249
|
-
export function pathMissDidYouMean(at, available) {
|
|
324
|
+
export function pathMissDidYouMean(at, available, availableAll) {
|
|
250
325
|
if (at === undefined || at.length === 0)
|
|
251
326
|
return undefined;
|
|
252
|
-
|
|
327
|
+
// r75:优先完整键表——available 是 12 键截断视图,真建议常在窗口外。
|
|
328
|
+
const list = availableAll ?? available;
|
|
329
|
+
if (!Array.isArray(list) || list.length === 0)
|
|
253
330
|
return undefined;
|
|
254
|
-
const keys =
|
|
331
|
+
const keys = list.map((entry) => String(entry)).filter((entry) => entry.length > 0);
|
|
255
332
|
if (keys.length === 0)
|
|
256
333
|
return undefined;
|
|
257
334
|
// Missed segment may be `items[].workItemId` / `fields.repairNo` — match the
|
|
@@ -381,13 +458,18 @@ function projectPathOnSource(source, path) {
|
|
|
381
458
|
},
|
|
382
459
|
};
|
|
383
460
|
}
|
|
461
|
+
const objectKeys = source !== null && typeof source === "object" && !Array.isArray(source)
|
|
462
|
+
? layerAvailable(Object.keys(source))
|
|
463
|
+
: undefined;
|
|
384
464
|
return {
|
|
385
465
|
projected: {
|
|
386
466
|
missed: true,
|
|
387
467
|
at: stripped.stripped,
|
|
388
|
-
available:
|
|
389
|
-
?
|
|
390
|
-
:
|
|
468
|
+
available: objectKeys !== undefined
|
|
469
|
+
? objectKeys.available
|
|
470
|
+
: `「${stripped.stripped}」是信封顶层键;投影相对 result,剥掉后路径为空——不要用 --jq ${stripped.stripped} 取信封字段`,
|
|
471
|
+
...(objectKeys?.availableAll !== undefined ? { availableAll: objectKeys.availableAll } : {}),
|
|
472
|
+
...(objectKeys?.availableTruncated !== undefined ? { availableTruncated: objectKeys.availableTruncated } : {}),
|
|
391
473
|
},
|
|
392
474
|
fanout: false,
|
|
393
475
|
};
|
|
@@ -476,9 +558,9 @@ export function projectResultExtract(result, paths, keysOnly) {
|
|
|
476
558
|
// r27 真机:多路径时每条 miss 都带 695 B 完整语法 → 3 条 2 KB 说同一件事。
|
|
477
559
|
// 单路径照旧带完整提示(只出现一次,最有用);多路径逐条只给定位,语法放顶层一次。
|
|
478
560
|
const multiPath = paths.length > 1;
|
|
479
|
-
const missHintFor = (path, at, available) => {
|
|
561
|
+
const missHintFor = (path, at, available, availableAll) => {
|
|
480
562
|
const fallback = multiPath ? pathMissEntryHint(at, available) : PATH_MISS_HINT;
|
|
481
|
-
const candidate = pathMissDidYouMean(at, available);
|
|
563
|
+
const candidate = pathMissDidYouMean(at, available, availableAll);
|
|
482
564
|
if (candidate === undefined || at === undefined)
|
|
483
565
|
return fallback;
|
|
484
566
|
// Replace only the missed segment, retaining array mapping and suffixes.
|
|
@@ -522,17 +604,18 @@ export function projectResultExtract(result, paths, keysOnly) {
|
|
|
522
604
|
if (fanout) {
|
|
523
605
|
const fan = projected;
|
|
524
606
|
if (fan.missed) {
|
|
525
|
-
const didYouMean = pathMissDidYouMean(fan.at, fan.available);
|
|
607
|
+
const didYouMean = pathMissDidYouMean(fan.at, fan.available, fan.availableAll);
|
|
526
608
|
return {
|
|
527
609
|
path,
|
|
528
610
|
content: null,
|
|
529
611
|
pathMiss: true,
|
|
530
612
|
missedAt: fan.at,
|
|
531
613
|
available: fan.available,
|
|
614
|
+
...(fan.availableTruncated !== undefined ? { availableTruncated: fan.availableTruncated } : {}),
|
|
532
615
|
missedEntries: fan.missedEntries,
|
|
533
616
|
...(didYouMean !== undefined ? { didYouMean } : {}),
|
|
534
617
|
...(readFromArtifact ? resultLayerNote(result, path) ?? {} : {}),
|
|
535
|
-
hint: missHintFor(path, fan.at, fan.available),
|
|
618
|
+
hint: missHintFor(path, fan.at, fan.available, fan.availableAll),
|
|
536
619
|
};
|
|
537
620
|
}
|
|
538
621
|
return {
|
|
@@ -559,16 +642,17 @@ export function projectResultExtract(result, paths, keysOnly) {
|
|
|
559
642
|
hint: typeof single.available === "string" ? single.available : UNSUPPORTED_JQ_OBJECT_HINT,
|
|
560
643
|
};
|
|
561
644
|
}
|
|
562
|
-
const didYouMean = pathMissDidYouMean(single.at, single.available);
|
|
645
|
+
const didYouMean = pathMissDidYouMean(single.at, single.available, single.availableAll);
|
|
563
646
|
return {
|
|
564
647
|
path,
|
|
565
648
|
content: null,
|
|
566
649
|
pathMiss: true,
|
|
567
650
|
missedAt: single.at,
|
|
568
651
|
available: single.available,
|
|
652
|
+
...(single.availableTruncated !== undefined ? { availableTruncated: single.availableTruncated } : {}),
|
|
569
653
|
...(didYouMean !== undefined ? { didYouMean } : {}),
|
|
570
654
|
...(readFromArtifact ? resultLayerNote(result, path) ?? {} : {}),
|
|
571
|
-
hint: missHintFor(path, single.at, single.available),
|
|
655
|
+
hint: missHintFor(path, single.at, single.available, single.availableAll),
|
|
572
656
|
};
|
|
573
657
|
}
|
|
574
658
|
return {
|
package/dist/read-shapes.js
CHANGED
|
@@ -106,14 +106,25 @@ const READ_SHAPES = {
|
|
|
106
106
|
notes: ["本面=当前登录人待办:按实例过滤回 0 ≠ 没待办(在别人名下,用 participant 查别人);看实例全活动链用 workflow.instanceActivity", "待办 id 键是 workItemId(平铺,不套 fields)"],
|
|
107
107
|
},
|
|
108
108
|
// r68 链2-D5(真机实证 2026-11-15):同一个「活动」概念两个面键名不同——
|
|
109
|
-
// workflow.get_published 的 activities[] 用 code/name/type
|
|
110
|
-
// read-shapes 条目,不在此重复声明),本面与 workitem 回执用
|
|
109
|
+
// workflow.get_published 的 activities[] 用 code/name/type,本面与 workitem 回执用
|
|
111
110
|
// activityCode/activityName。平台回执原样,不统一;探针跨面对照(模板节点 vs
|
|
112
111
|
// 实例节点)时会拿错键,故在 instanceActivity 侧一次教两个名字。
|
|
113
112
|
"workflow.instanceActivity": {
|
|
114
113
|
keys: ["workflowInstanceId", "instanceStatus?", "endStatus?", "activityCount", "activeCount", "reachedCount", "activities:array<{activityCode,activityName,activityType,status,participantCount,participants:[{name,id}],sheetTrigger?}>", "participantFallback?", "diagnosis"],
|
|
115
114
|
notes: ["activities[] 键名是 activityCode/activityName(本面/workitem 面);workflow.get_published 的 activities[] 同一概念叫 code/name/type——两面键名不统一(平台回执原样),跨面对照别拿错键"],
|
|
116
115
|
},
|
|
116
|
+
// r75 调查C(真机采样 2026-11-18):r74 深层定位空转的主战场(96KB 模板)。顶层
|
|
117
|
+
// activities[] 只是投影;完整模板在 data(>8KB 外置 detailArtifactId,配合
|
|
118
|
+
// artifact get --shape 先看骨架再 --jq)。published/draft 两面同形,仅 templateType
|
|
119
|
+
// 与 published 键不同。
|
|
120
|
+
"workflow.get_published": {
|
|
121
|
+
keys: ["status", "workflowCode", "exists", "published", "workflowSummary:{workflowCode,templateType,activities:array<{index,code,type,name}>,edges:array<{from,to}>,ruleBindings:array<{...}>,ruleBindingCount,originateActivity:{code,type,name,participant}}", "activities:array<{code,name,type}>(投影)", "propertyPermissionsCount", "version", "summaryHint", "truncatedKeys?", "omittedKeys?", "truncated?", "data?(外置时 null,完整模板在 detailArtifactId)", "omittedShape?", "omittedNote?", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
|
|
122
|
+
notes: ["顶层 activities[] 是投影 {code,name,type};完整模板在 data(外置 detailArtifactId),深层活动名是 data.activities[].activityName(与顶层投影的 name 同义、键名不同)"],
|
|
123
|
+
},
|
|
124
|
+
"workflow.get_draft": {
|
|
125
|
+
keys: ["status", "workflowCode", "exists", "workflowSummary:{workflowCode,templateType,activities:array<{index,code,type,name}>,edges:array<{from,to}>,ruleBindings:array<{...}>,ruleBindingCount,originateActivity:{code,type,name,participant}}", "activities:array<{code,name,type}>(投影)", "propertyPermissionsCount", "version", "summaryHint", "truncatedKeys?", "omittedKeys?", "truncated?", "data?(外置时 null,完整模板在 detailArtifactId)", "omittedShape?", "omittedNote?", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
|
|
126
|
+
notes: ["与 workflow.get_published 同形(少了 published 键);templateType=DRAFT;完整模板同样在 data/detailArtifactId"],
|
|
127
|
+
},
|
|
117
128
|
"rule.list": {
|
|
118
129
|
keys: ["rules:array<{code,name,enabled,status}>", "modelPresent", "source", "executableHint"],
|
|
119
130
|
notes: [
|
|
@@ -133,6 +144,15 @@ const READ_SHAPES = {
|
|
|
133
144
|
"matches:[] 只代表已扫面零命中(coverage.notScanned 是权威,勿当可安全删除);字段 code 跨模型不唯一,建议配 schemaCodes 限范围",
|
|
134
145
|
],
|
|
135
146
|
},
|
|
147
|
+
// r75 调查C(真机采样 2026-11-18,local 兼容模式 1.1.25):r74 探针 9 次投影
|
|
148
|
+
// 空转里 8 次发生在这批未声明工具上。本批补 6 条真机采样条目(rule.get /
|
|
149
|
+
// workflow.get_published / workflow.get_draft / onlinejs.get / listview.list /
|
|
150
|
+
// service.get,分插各自族附近);键集全部来自真机回执采样(非手写发明),
|
|
151
|
+
// returnsFace 只显 notes[0],高频陷阱并进首条。
|
|
152
|
+
"rule.get": {
|
|
153
|
+
keys: ["status", "id", "absent", "code", "name", "schemaCode", "bizRuleType", "enabled", "executable", "executableBasis", "ruleStatus", "defaultRule", "developmentMode", "ruleVersion", "templateType", "nodes:array<{nodeCode,nodeName,nodeType,nodeCategory?,inputParam?,methodMapping:{schemaCode,serviceCode,serviceMethodCode,inputMappings[],outputMappings[],serviceName,serviceMethodName},serviceType?}>", "routes:array<{preNode,postNode,routeCondition,matchType}>", "schedulerSetting?", "renderCompat", "semanticFindings?", "roundTrip", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
|
|
154
|
+
notes: ["绑定的服务方法在 nodes[].methodMapping.serviceCode/serviceMethodCode(三层深,不在顶层;BIZ_ACTION 节点才有 methodMapping)", "入参 ruleCode 对应本面返回的 code;enabled 是开关推断,可执行性看 executable/executableBasis"],
|
|
155
|
+
},
|
|
136
156
|
"datarule.list": {
|
|
137
157
|
keys: ["rules:array<{id,propertyCode,dataRuleType,checkType,optionsKeys?}>", "rulesCount", "modelPresent", "rulesOmitted?"],
|
|
138
158
|
notes: [
|
|
@@ -147,12 +167,22 @@ const READ_SHAPES = {
|
|
|
147
167
|
"表单按钮读 formButtonCodes/formButtons;full:true 另带 customButtonJson 数组原样(库里是字符串脏形时给 customButtonJsonShapeWarning——线上 #38 前端按钮不渲染,重写 buttons 自愈)",
|
|
148
168
|
],
|
|
149
169
|
},
|
|
170
|
+
// r75 调查C(真机采样 2026-11-18):r74 探针在同一循环里猜 sourceCode miss ×5。
|
|
171
|
+
"onlinejs.get": {
|
|
172
|
+
keys: ["status", "schemaCode", "sheetCode", "present", "sheetPublished", "draftPublishedInSync", "scriptSha256", "hint", "draft:{present,script,sha256,elementCount,scriptSha256}", "published:{present,script,sha256,elementCount,scriptSha256}", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
|
|
173
|
+
notes: ["脚本原文在 draft.script / published.script(不是 sourceCode);scriptSha256 是内容指纹,判「草稿=发布」用 draftPublishedInSync"],
|
|
174
|
+
},
|
|
150
175
|
"listview.get": {
|
|
151
176
|
keys: ["present", "published", "lifecycle", "columns[]"],
|
|
152
177
|
// r73 #5(GitLab #40 P1,8.6.41 实测):FLOW 按钮读写不对称的对照表。
|
|
153
178
|
// returnsFace 只显 notes[0],教学并进首条。
|
|
154
179
|
notes: ["FLOW:读面 targetCode 回填自 actionConfig.WorkflowListData[0].workflowCode(targetCodeSource 标注;可能≠模型 code)↔ 写面 buttons[].targetCode 必填"],
|
|
155
180
|
},
|
|
181
|
+
// r75 调查C(真机采样 2026-11-18)。
|
|
182
|
+
"listview.list": {
|
|
183
|
+
keys: ["status", "schemaCode", "count", "views:array<{code,name,type,published}>", "hint", "publishedNote", "environmentFingerprint"],
|
|
184
|
+
notes: ["views[].published 恒为 null(list 面不投影该列,判断发布状态用 listview.get——见 publishedNote);默认视图 code = schemaCode"],
|
|
185
|
+
},
|
|
156
186
|
"service.list": {
|
|
157
187
|
// r28f F1:行内带 adapterCode;顶栏 adapterDistribution 是选型聚合。
|
|
158
188
|
keys: ["services:array<{code,name,adapterCode}>", "codes", "adapterDistribution", "servicesCount"],
|
|
@@ -163,6 +193,11 @@ const READ_SHAPES = {
|
|
|
163
193
|
keys: ["serviceCode", "methodCode", "present", "method:{code,name,configJson,inputParameters,outputParameters}"],
|
|
164
194
|
notes: ["单条读:method.inputParameters/outputParameters/configJson 内联;其余大字段在 detailArtifactId"],
|
|
165
195
|
},
|
|
196
|
+
// r75 调查C(真机采样 2026-11-18)。
|
|
197
|
+
"service.get": {
|
|
198
|
+
keys: ["status", "serviceCode", "present", "adapterCode", "methodsError?", "service:{keys[],sha256?,omitted?}", "methods:array<{code,name,serviceCode,configJson,inputParameters,outputParameters}>", "methodsCount", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
|
|
199
|
+
notes: ["方法参数面在 methods[].inputParameters/outputParameters(内联);service.keys 只是服务记录的键名表,服务本体在 detailArtifactId"],
|
|
200
|
+
},
|
|
166
201
|
"service.adapter_config": {
|
|
167
202
|
// r28f F5:顶栏 adapterCodes 摘要;compact:true 只回 code/name/description。
|
|
168
203
|
keys: ["adapterCodes", "adapters:array<{code,name,config?...}>", "rawPresent"],
|
package/dist/rule-support.js
CHANGED
|
@@ -955,7 +955,22 @@ export async function modelWorkflowDispatchWarning(session, schemaCode) {
|
|
|
955
955
|
return {};
|
|
956
956
|
}
|
|
957
957
|
}
|
|
958
|
-
|
|
958
|
+
/**
|
|
959
|
+
* R75-B(2026-11-18):rule.save 的全部**只读前置门**(图 lint / 公式 fail-closed /
|
|
960
|
+
* 字段归属 / schema 存在 / ASSIGN 版本 / BizMethod wire 存在性 / 调度映射 /
|
|
961
|
+
* 预置行系统节点镜像)。dry-run 与真写共用本函数——此前 semanticGate 只跑
|
|
962
|
+
* prepareRuleGraph+validateRuleNodeGraph,formula-lint 等门只在 execute,
|
|
963
|
+
* `rule.save --dry-run` 绿灯、真写 refused(investigate-B E1 实证)。
|
|
964
|
+
*/
|
|
965
|
+
/** A8 写前归一:空串/缺席补平台默认结构(设计器保存行为);dry-run 与真写共用。 */
|
|
966
|
+
function normalizeRuleJsonColumn(value, fallback) {
|
|
967
|
+
if (typeof value === "string" && value.trim())
|
|
968
|
+
return value;
|
|
969
|
+
if (value !== null && typeof value === "object")
|
|
970
|
+
return JSON.stringify(value);
|
|
971
|
+
return fallback;
|
|
972
|
+
}
|
|
973
|
+
export async function lintRuleSaveWrite(session, args) {
|
|
959
974
|
// Pre-flight dry lint (ticket 14) lives in lintRuleGraphForWrite (r73 #1):
|
|
960
975
|
// the SAME lint now serves the real write AND `rule.node.update`'s
|
|
961
976
|
// dryRunPayload, so a dry-run answers the same 能写/不能写 question.
|
|
@@ -1106,13 +1121,27 @@ export async function executeRuleSaveWrite(session, args) {
|
|
|
1106
1121
|
// A8(2026-11-03 issue,8.1.108 实测):`options` / `extensionSetting` 缺席或空串
|
|
1107
1122
|
// 时平台落 "",8.1 族实体校验要求结构化的默认值——update 回无明细 50000。写前
|
|
1108
1123
|
// 归一:空串/缺席补平台默认结构(与设计器保存行为一致)。
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1124
|
+
return {
|
|
1125
|
+
preparedGraph,
|
|
1126
|
+
blockers,
|
|
1127
|
+
lintWarnings,
|
|
1128
|
+
lintHazards,
|
|
1129
|
+
nodes,
|
|
1130
|
+
routes,
|
|
1131
|
+
bizMethodChecks,
|
|
1132
|
+
schedulerSetting,
|
|
1133
|
+
existing,
|
|
1134
|
+
customTriggerApplied,
|
|
1135
|
+
isPresetRule,
|
|
1136
|
+
bizRuleType,
|
|
1137
|
+
nodeJson,
|
|
1138
|
+
routeJson,
|
|
1139
|
+
schedulerField,
|
|
1115
1140
|
};
|
|
1141
|
+
}
|
|
1142
|
+
export async function executeRuleSaveWrite(session, args) {
|
|
1143
|
+
// 与 dry-run 同源:同一套只读门先跑,然后才写。
|
|
1144
|
+
const { lintWarnings, lintHazards, bizMethodChecks, existing, customTriggerApplied, isPresetRule, bizRuleType, nodeJson, routeJson, schedulerField, schedulerSetting, nodes, } = await lintRuleSaveWrite(session, args);
|
|
1116
1145
|
const performed = existing?.id
|
|
1117
1146
|
? await wireCall(session, { path: ENDPOINTS.businessRuleUpdate, method: "POST", body: {
|
|
1118
1147
|
...existing,
|
package/dist/tool-types.js
CHANGED
|
@@ -125,6 +125,8 @@ const TOOL_INPUT_ALIASES = Object.freeze({
|
|
|
125
125
|
// 注意 schemaCode→schemaCodes 是「扫描范围」语义(不是被查对象)——只在
|
|
126
126
|
// 调用方没给 code 时生效;kind=model 想按模型查请显式用 code。
|
|
127
127
|
"rule.references": Object.freeze({ code: ["ruleCode"], schemaCodes: ["schemaCode"] }),
|
|
128
|
+
// r73 探针02-P2:分页条数在 data.list 叫 size,调用方习惯 limit(SQL/REST 肌肉记忆)。
|
|
129
|
+
"data.list": Object.freeze({ size: ["limit"] }),
|
|
128
130
|
});
|
|
129
131
|
/**
|
|
130
132
|
* r54 C② F2:该工具在 TOOL_INPUT_ALIASES 里声明的**同义词键**(调用方可能拿来
|
package/dist/write.js
CHANGED
|
@@ -35,7 +35,11 @@ import { WireError } from "./wire.js";
|
|
|
35
35
|
* → session → version-family gate (fail closed without evidence) → production
|
|
36
36
|
* confirmation → write lease → execute with authoritative readback.
|
|
37
37
|
*/
|
|
38
|
-
async function governedWrite(ctx, tool, args, execute, dryRunPayload, readOnlyEscape
|
|
38
|
+
async function governedWrite(ctx, tool, args, execute, dryRunPayload, readOnlyEscape,
|
|
39
|
+
// R75-B:dry-run 回执必须诚实声明覆盖范围(full/partial/plan)与未跑的门。
|
|
40
|
+
// 此前所有「只回 plan」的写工具都长成一样的绿灯,调用方据此误报「可以执行」
|
|
41
|
+
// (8/10 实验复现)。声明随每份 dry-run 回执一起返回,payload 可覆盖细节。
|
|
42
|
+
lintDeclaration = { lintScope: "partial", lintUnchecked: [] }) {
|
|
39
43
|
const requestFingerprint = args.requestId ? sha256({ requestId: args.requestId, args: plannableArgsRaw(args) }) : undefined;
|
|
40
44
|
// The shared admission owns the gate sequence; this face only supplies its
|
|
41
45
|
// plan and its dry-run / replay payload shapes.
|
|
@@ -53,7 +57,29 @@ async function governedWrite(ctx, tool, args, execute, dryRunPayload, readOnlyEs
|
|
|
53
57
|
// establish — never a second write path.
|
|
54
58
|
// First-write / dry-run receipts use replay:"none" — the duplicate tag only
|
|
55
59
|
// appears on a true same-fingerprint replay (r30a F1).
|
|
56
|
-
|
|
60
|
+
// R75-B: every dry-run receipt carries the honest `lintScope` declaration;
|
|
61
|
+
// a tool's own payload may add finer detail (`lintScopeDetail`) but the
|
|
62
|
+
// declaration lands first so a plan-only receipt can never look green.
|
|
63
|
+
dryRunResult: dryRunPayload
|
|
64
|
+
? (plan, session) => dryRunPayload(session, args).then((payload) => ({
|
|
65
|
+
status: "dry-run",
|
|
66
|
+
wouldChange: true,
|
|
67
|
+
plan,
|
|
68
|
+
idempotency: idempotencyDeclaration(tool.name, "none"),
|
|
69
|
+
lintScope: lintDeclaration.lintScope,
|
|
70
|
+
...(lintDeclaration.lintUnchecked.length > 0 ? { unchecked: [...lintDeclaration.lintUnchecked] } : {}),
|
|
71
|
+
...payload,
|
|
72
|
+
...(args.requestId ? { requestId: args.requestId } : {}),
|
|
73
|
+
}))
|
|
74
|
+
: (plan) => ({
|
|
75
|
+
status: "dry-run",
|
|
76
|
+
wouldChange: true,
|
|
77
|
+
plan,
|
|
78
|
+
idempotency: idempotencyDeclaration(tool.name, "none"),
|
|
79
|
+
lintScope: lintDeclaration.lintScope,
|
|
80
|
+
...(lintDeclaration.lintUnchecked.length > 0 ? { unchecked: [...lintDeclaration.lintUnchecked] } : {}),
|
|
81
|
+
...(args.requestId ? { requestId: args.requestId } : {}),
|
|
82
|
+
}),
|
|
57
83
|
replay: (plan) => (requestFingerprint ? findCompleted(ctx.artifactsDir, args.requestId, tool.name, plan.environment, requestFingerprint) : undefined),
|
|
58
84
|
});
|
|
59
85
|
if (outcome.kind === "settled")
|
|
@@ -360,8 +386,30 @@ function findCompleted(root, requestId, tool, environment, requestFingerprint) {
|
|
|
360
386
|
}
|
|
361
387
|
/** Low-level write registration factory: shared by every lane adapter. */
|
|
362
388
|
export function writeTool(definition) {
|
|
363
|
-
const { tools, name, lane, scope, description, inputSchema, search, execute, preflight, dryRunPayload, rollback, readOnlyEscape } = definition;
|
|
389
|
+
const { tools, name, lane, scope, description, inputSchema, search, execute, preflight, dryRunPayload, writeLint, rollback, readOnlyEscape } = definition;
|
|
364
390
|
const rawExecute = execute;
|
|
391
|
+
// R75-B:未显式声明时按实际能力推导——有 session 只读 lint(writeLint 或
|
|
392
|
+
// dryRunPayload)→ partial;两者都没有 → plan(dry-run 只回 plan,最容易被
|
|
393
|
+
// 读成「可以执行」)。`full` 必须由作者显式声明(意味着两边确实同门禁)。
|
|
394
|
+
// 有 preflight 也是 partial:那层纯参数门 dry-run 会跑,但 execute 的 session 门仍在。
|
|
395
|
+
const hasAnyLint = writeLint !== undefined || dryRunPayload !== undefined || preflight !== undefined;
|
|
396
|
+
const declaredLintScope = definition.lintScope ?? (hasAnyLint ? "partial" : "plan");
|
|
397
|
+
const declaredLintUnchecked = definition.lintUnchecked ?? (declaredLintScope === "full"
|
|
398
|
+
? []
|
|
399
|
+
: ["local-write-gates", "platform-side-validation", "post-write-readback"]);
|
|
400
|
+
// 没有 dryRunPayload 但有 writeLint:dry-run 直接跑同一 lint(预览即真写前门)。
|
|
401
|
+
const effectiveDryRunPayload = dryRunPayload !== undefined
|
|
402
|
+
? dryRunPayload
|
|
403
|
+
: writeLint === undefined
|
|
404
|
+
? undefined
|
|
405
|
+
: async (session, args) => ((await writeLint(session, args)) ?? {});
|
|
406
|
+
// 真写:writeLint 在 lease 内、写 wire 之前跑(与 dry-run 同一函数)。
|
|
407
|
+
const executeWithLint = writeLint === undefined
|
|
408
|
+
? rawExecute
|
|
409
|
+
: async (session, args) => {
|
|
410
|
+
await writeLint(session, args);
|
|
411
|
+
return rawExecute(session, args);
|
|
412
|
+
};
|
|
365
413
|
const semanticGate = (args) => {
|
|
366
414
|
if (name === "field.create")
|
|
367
415
|
assertFieldFamilyAllowed(args);
|
|
@@ -423,13 +471,15 @@ export function writeTool(definition) {
|
|
|
423
471
|
inputSchema: { environment: environmentArg, capability: capabilityArg, confirmProduction: confirmProductionArg, requestId: z.string().min(1).optional(), dryRun: z.boolean().optional(), ...inputSchema },
|
|
424
472
|
handler: async (ctx, args, self) => {
|
|
425
473
|
semanticGate(args);
|
|
426
|
-
return governedWrite(ctx, self, args, (session) =>
|
|
474
|
+
return governedWrite(ctx, self, args, (session) => executeWithLint(session, args), effectiveDryRunPayload, readOnlyEscape, { lintScope: declaredLintScope, lintUnchecked: declaredLintUnchecked });
|
|
427
475
|
},
|
|
428
476
|
}),
|
|
429
477
|
// Ticket 46: the batch entry drives the SAME executor/gates, so a batch
|
|
430
478
|
// step can never bypass its lane's readback or semantic refusal.
|
|
431
|
-
writeExecute:
|
|
479
|
+
writeExecute: executeWithLint,
|
|
432
480
|
writePreflight: semanticGate,
|
|
481
|
+
lintScope: declaredLintScope,
|
|
482
|
+
...(declaredLintUnchecked.length > 0 ? { lintUnchecked: declaredLintUnchecked } : {}),
|
|
433
483
|
...(rollback ? { rollback } : {}),
|
|
434
484
|
});
|
|
435
485
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.70",
|
|
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.70",
|
|
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.70"
|
|
78
78
|
}
|
|
79
79
|
}
|