@stalfh233/omc-cli 0.6.37 → 0.6.38
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 +2 -1
- package/dist/cli.js +16 -4
- package/dist/discovery.js +7 -0
- package/dist/field-add.js +44 -3
- package/dist/goal-routes.js +17 -0
- package/dist/lanes/businessrule.js +3 -0
- package/dist/lanes/environment.js +7 -0
- package/dist/lanes/field.js +20 -0
- package/dist/lanes/meta.js +4 -2
- package/dist/lanes/model.js +3 -1
- package/dist/lanes/programming-contract.js +1 -1
- package/dist/lanes/programming.js +11 -2
- package/dist/lanes/rule-lifecycle-contract.js +1 -1
- package/dist/lanes/rulelog.js +21 -3
- package/dist/lanes/runtime-data.js +50 -11
- package/dist/model-scaffold.js +1 -1
- package/dist/path-projection.js +28 -6
- package/dist/tool-types.js +3 -0
- package/package.json +3 -3
- package/skills/omc-backend-online-coding.md +104 -4
|
@@ -6,9 +6,10 @@ export const DISCOVERY_AUTHORITY = Object.freeze({
|
|
|
6
6
|
authoritative: "package",
|
|
7
7
|
route: "omc help omc-start-here",
|
|
8
8
|
readiness: "omc call discover_environment --env <env> --args '{}'",
|
|
9
|
-
distributedMirror: "
|
|
9
|
+
distributedMirror: "cpdocs mirror: manifest commit/hashes",
|
|
10
10
|
capabilityProjection: "omc capabilities",
|
|
11
11
|
executableBundle: "omc capability <id> --executable",
|
|
12
|
+
appScope: "appCode/applicationCode: same scope, NOT interchangeable; use schema.",
|
|
12
13
|
});
|
|
13
14
|
/**
|
|
14
15
|
* The 13 Configuration capabilities. Declaration order is presentation order.
|
package/dist/cli.js
CHANGED
|
@@ -706,6 +706,8 @@ async function cmdCall(store, args) {
|
|
|
706
706
|
if (!lenientArgs) {
|
|
707
707
|
const suggestions = otherUnknown.map((key) => ({ key, ...suggestArgumentKey(key, [...schemaKeys], toolName) }));
|
|
708
708
|
const pairs = suggestions.map((entry) => {
|
|
709
|
+
if (entry.hint)
|
|
710
|
+
return `${entry.key}(${entry.hint})`;
|
|
709
711
|
if (entry.closest)
|
|
710
712
|
return `${entry.key}→${entry.closest}`;
|
|
711
713
|
if (entry.absentInTool)
|
|
@@ -826,6 +828,8 @@ async function cmdCall(store, args) {
|
|
|
826
828
|
// 读面未知键的非阻断回显:放在投影**之后**,否则会被 --jq 的窄投影吞掉。
|
|
827
829
|
if (ignoredReadKeys.length > 0 && typeof result === "object" && result !== null) {
|
|
828
830
|
const pairs = ignoredReadKeys.map((entry) => {
|
|
831
|
+
if (entry.hint)
|
|
832
|
+
return `${entry.key}(${entry.hint})`;
|
|
829
833
|
if (entry.closest)
|
|
830
834
|
return `${entry.key}→${entry.closest}`;
|
|
831
835
|
if (entry.absentInTool)
|
|
@@ -871,11 +875,19 @@ const APP_SCOPE_ARG_KEYS = new Set(["appCode", "applicationCode", "application"]
|
|
|
871
875
|
*/
|
|
872
876
|
export function suggestArgumentKey(key, schemaKeys, toolName) {
|
|
873
877
|
const known = new Set(schemaKeys);
|
|
878
|
+
const paginationKeys = new Set(["page", "pagesize", "size", "pageindex", "pagenumber", "pageno", "offset", "limit"]);
|
|
879
|
+
if (paginationKeys.has(key.toLowerCase()) && !schemaKeys.some((name) => paginationKeys.has(name.toLowerCase()))) {
|
|
880
|
+
return { hint: "本工具不支持分页(返回全量/受限于应用范围);省略该键即可" };
|
|
881
|
+
}
|
|
874
882
|
const normalizedTool = toolName?.toLowerCase() ?? "";
|
|
875
883
|
if ((normalizedTool.startsWith("workflow.") || normalizedTool.startsWith("workitem.")) && key === "code" && known.has("workflowCode"))
|
|
876
884
|
return { closest: "workflowCode" };
|
|
877
885
|
if (normalizedTool.startsWith("data.") && key === "id" && known.has("bizObjectId"))
|
|
878
886
|
return { closest: "bizObjectId" };
|
|
887
|
+
// r53 场景03 F8:rule.run 的记录标识叫 ids(数组),与 data.* 族的 bizObjectId
|
|
888
|
+
// 完全不共享字符串相似度——最近匹配回不出建议,只能报「无相近键」。
|
|
889
|
+
if (normalizedTool.startsWith("rule.") && key === "bizObjectId" && known.has("ids"))
|
|
890
|
+
return { closest: "ids", hint: "rule.run 的记录标识是 ids(字符串数组)" };
|
|
879
891
|
if (normalizedTool.startsWith("data.") && key === "ids" && known.has("bizObjectIds"))
|
|
880
892
|
return { closest: "bizObjectIds" };
|
|
881
893
|
const aliases = KEY_ALIAS_HINTS[key.toLowerCase()] ?? [];
|
|
@@ -1306,7 +1318,7 @@ function cmdDiscovery(kind, transport, value, options = {}) {
|
|
|
1306
1318
|
delete inventory.intent;
|
|
1307
1319
|
const discovery = inventory.discovery;
|
|
1308
1320
|
if (discovery)
|
|
1309
|
-
inventory.discovery = { authoritative: discovery.authoritative, route: discovery.route };
|
|
1321
|
+
inventory.discovery = { authoritative: discovery.authoritative, route: discovery.route, appScope: DISCOVERY_AUTHORITY.appScope };
|
|
1310
1322
|
// Zero hits: minimal envelope + up to three nearest candidates with an
|
|
1311
1323
|
// exact next command — NOT the full catalogue to re-read (r18: the empty
|
|
1312
1324
|
// match plus governance prose pushed the agent back to the 20 KB face).
|
|
@@ -2067,7 +2079,7 @@ function onboardingHelp() {
|
|
|
2067
2079
|
"目标→工具一步定位:omc next \"<你要做什么>\"(离线、只读,给能力/说明/首批命令;不确定会明说并回退到 omc-requirement-analysis)。",
|
|
2068
2080
|
// r30f F20:写清两道门——读面 diet(~2048) 与 stdout 预算(--max-output-bytes,默认 64KiB) 不是一回事。
|
|
2069
2081
|
"输出预算:`--max-output-bytes` 默认 65536(64KiB;超则回 artifact 指针 + sha256),只约束最终 stdout 信封(投影/--jq 之后);`artifact get` 内联上限 8192。读面另有独立 diet 门(~2048)会先外置 detailArtifactId——抬高 --max-output-bytes 不会把已 diet 的大表重新内联。",
|
|
2070
|
-
"
|
|
2082
|
+
"投影:--jq 是路径选择器(非 jq 表达式)。读面回 detailArtifactId 时,用 omc call <tool> … --jq <path>(可重复;`[]` 映射数组,如 items[].fields.planNo)或 --extract/--extract-keys,省掉再跑一次 omc artifact get。commands/capabilities/describe 也支持 --jq。批量形状预检用 --args-list … --preflight(零 wire、零写入,一次报全)。",
|
|
2071
2083
|
// r25 真机(2026-11-04):探针连跑同一读面 2–3 次想验证「第二次是否 unchanged」,
|
|
2072
2084
|
// 结果三次都是全量,还去 describe 找 dedupe 参数(多花 3 轮)。读面确实不做跨调用
|
|
2073
2085
|
// 结果去重——**明说**比留白强,省掉一次探索。
|
|
@@ -2277,7 +2289,7 @@ async function main() {
|
|
|
2277
2289
|
commandExitCode = CLI_EXIT_CODES.ok;
|
|
2278
2290
|
});
|
|
2279
2291
|
command.command("doctor").option("--environment <environment>").option("--env <environment>").option("--service <serviceCode>", "可选:体检单个业务集成服务的鉴权参数形状(掩码/占位/全 0 检出,WARN 非致命)").action(async (options) => { commandExitCode = await cmdDoctor(new ConfigStore(defaultPaths()), options.environment ?? options.env, options.service); });
|
|
2280
|
-
command.command("call <tool>").option("--env <environment>", "环境名;项目白名单按当前 cwd 解析,须在含 .omc-env 的目录内运行").option("--environment <environment>").option("--args <json>").option("--args-file <path>", "从文件读参数 JSON。**必须位于配置根内**(数组批量请改用 --args-list;跨目录/系统临时文件会被拒);免落盘用 `--args -`(stdin)").option("--args-list <json-array>", '同一工具跑 N 次(JSON 数组,每条一个 args 对象,最多 200 条);超过上限请分批,或用 omc script 读文件。逐条执行、默认不中断,最后回 succeeded/failed 汇总。适合批量建字段等').option("--preflight", "与 --args-list 一起用:只跑参数校验 + 写前语义闸(零 wire、零写入),一次报全所有形状问题").option("--keys", "与 artifact get 的 --keys 同义(= --extract-keys):列出本次结果 artifact 的顶层键与体积").addOption(new Option("--extract <path>", "在本次结果的 artifact 内取一个路径的值(可重复;省掉一次 artifact get)").argParser((value, previous = []) => [...previous, value]).default([])).addOption(new Option("--jq [path]", "
|
|
2292
|
+
command.command("call <tool>").option("--env <environment>", "环境名;项目白名单按当前 cwd 解析,须在含 .omc-env 的目录内运行").option("--environment <environment>").option("--args <json>").option("--args-file <path>", "从文件读参数 JSON。**必须位于配置根内**(数组批量请改用 --args-list;跨目录/系统临时文件会被拒);免落盘用 `--args -`(stdin)").option("--args-list <json-array>", '同一工具跑 N 次(JSON 数组,每条一个 args 对象,最多 200 条);超过上限请分批,或用 omc script 读文件。逐条执行、默认不中断,最后回 succeeded/failed 汇总。适合批量建字段等').option("--preflight", "与 --args-list 一起用:只跑参数校验 + 写前语义闸(零 wire、零写入),一次报全所有形状问题").option("--keys", "与 artifact get 的 --keys 同义(= --extract-keys):列出本次结果 artifact 的顶层键与体积").addOption(new Option("--extract <path>", "在本次结果的 artifact 内取一个路径的值(可重复;省掉一次 artifact get)").argParser((value, previous = []) => [...previous, value]).default([])).addOption(new Option("--jq [path]", "路径选择器(非 jq),同 --extract;[] 映射如 items[].fields.planNo;裸 --jq 列顶层键").argParser((value, previous = []) => [...previous, value]).default([])).option("--extract-keys", "列出本次结果 artifact 的顶层键与体积(省掉一次 artifact get --keys)").option("--max-output-bytes <bytes>", "最终 stdout 信封预算;默认 65536(投影/--jq 之后再判);读面 diet(~2048) 独立外置 detailArtifactId,抬高本参数不会把已 diet 的大表重新内联;artifact get 内联上限 8192").option("--request-id <requestId>").option("--timeout-ms <milliseconds>").option("--wait <milliseconds>", "仅 `omc call` / `omc intent apply` 支持;写锁冲突时有界排队(0=立刻拒绝)").option("--dry-run").addHelpText("after", `\n${onboardingHelp()}\n`).action(async (tool, options) => {
|
|
2281
2293
|
const rest = [tool, ...(options.env ? ["--env", options.env] : []), ...(options.environment ? ["--environment", options.environment] : []), ...(options.args !== undefined ? ["--args", options.args] : []), ...(options.argsFile !== undefined ? ["--args-file", options.argsFile] : []), ...(options.argsList !== undefined ? ["--args-list", options.argsList] : []), ...(options.preflight ? ["--preflight"] : []), ...(Array.isArray(options.extract) ? options.extract.flatMap((path) => ["--extract", path]) : []), ...(Array.isArray(options.jq) ? options.jq.flatMap((path) => path === true ? ["--jq"] : ["--jq", path]) : []), ...(options.extractKeys ? ["--extract-keys"] : []),
|
|
2282
2294
|
...(options.keys ? ["--keys"] : []), ...(options.maxOutputBytes !== undefined ? ["--max-output-bytes", options.maxOutputBytes] : []), ...(options.requestId ? ["--request-id", options.requestId] : []), ...(options.timeoutMs !== undefined ? ["--timeout-ms", options.timeoutMs] : []), ...(options.wait !== undefined ? ["--wait", options.wait] : []), ...(options.dryRun ? ["--dry-run"] : [])];
|
|
2283
2295
|
commandExitCode = await cmdCall(new ConfigStore(defaultPaths()), rest);
|
|
@@ -2570,7 +2582,7 @@ async function main() {
|
|
|
2570
2582
|
console.error(`已清理 ${result.removed} 个读回产物,释放 ${formatBytes(result.freedBytes)};保留 ${result.kept} 个(${formatBytes(result.keptBytes)})`);
|
|
2571
2583
|
commandExitCode = CLI_EXIT_CODES.ok;
|
|
2572
2584
|
});
|
|
2573
|
-
artifactCommand.command("get <id>").addOption(new Option("--jq [path]").argParser((value, previous = []) => [...previous, value]).default([])).option("--extract <path>", "同 --jq(与 omc call 的 --extract 同名,省一次命名切换)").option("--path-only").option("--summary").option("--keys [a,b]").option("--full", "整包返回正文(默认:正文超过 8KB 时只回形状 outline + fetch,按需 --jq/--keys 定向取值)").option("--max-output-bytes <bytes>").action(async (id, options) => {
|
|
2585
|
+
artifactCommand.command("get <id>").addOption(new Option("--jq [path]", "路径选择器(非 jq);支持 [] 映射与逗号多路径;裸 --jq 列顶层键").argParser((value, previous = []) => [...previous, value]).default([])).option("--extract <path>", "同 --jq(与 omc call 的 --extract 同名,省一次命名切换)").option("--path-only").option("--summary").option("--keys [a,b]").option("--full", "整包返回正文(默认:正文超过 8KB 时只回形状 outline + fetch,按需 --jq/--keys 定向取值)").option("--max-output-bytes <bytes>").action(async (id, options) => {
|
|
2574
2586
|
// A bare `--jq`/`--keys` is a key-inventory request, not a missing argument:
|
|
2575
2587
|
// commander's "argument missing" (invalid-input + retry) is a dead end the
|
|
2576
2588
|
// caller cannot fix without already knowing the flag takes a value (r11
|
package/dist/discovery.js
CHANGED
|
@@ -444,6 +444,11 @@ function returnsFace(toolName) {
|
|
|
444
444
|
},
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
|
+
const DATA_PARAMETER_NAMES = [
|
|
448
|
+
{ concept: "业务数据载荷", parameters: "data.save / data.update = formData;其它无" },
|
|
449
|
+
{ concept: "记录标识", parameters: "data.load / data.delete / data.submit = bizObjectId" },
|
|
450
|
+
{ concept: "流程三件套", parameters: "data.submit 专用:bizObjectId + workItemId + workflowInstanceId" },
|
|
451
|
+
];
|
|
447
452
|
/** Default `omc describe`: the compact contract projection. */
|
|
448
453
|
export function describeTool(registry, name) {
|
|
449
454
|
const tool = registry.find((entry) => entry.name === name);
|
|
@@ -489,6 +494,7 @@ export function describeTool(registry, name) {
|
|
|
489
494
|
// 撞上之前没有任何发现面说过"写是环境级串行"——describe 的 params 里没有 wait
|
|
490
495
|
// (它是 omc call 的 CLI 开关,不在工具 schema),capability notes 是空的。
|
|
491
496
|
...(tool.kind === "write" ? { writeLock: "写锁=环境级:同一环境的并发写,后到的直接回 write-lock-held(不排队)。可带 --wait <ms> 让 CLI 内部排队(CLI 开关,不是本工具参数);不要写 shell 重试循环" } : {}),
|
|
497
|
+
...(tool.name.startsWith("data.") ? { parameterNames: DATA_PARAMETER_NAMES } : {}),
|
|
492
498
|
// Keep the cost salient at the decision point: agents reached for --full even
|
|
493
499
|
// when --example/--param existed (sandbox22: 8 --full calls, one 19 KB).
|
|
494
500
|
full: `omc describe ${tool.name} --full(5–20KB;先试 --example/--param)`,
|
|
@@ -640,6 +646,7 @@ export function describeToolFull(registry, name) {
|
|
|
640
646
|
lane: tool.lane ?? null,
|
|
641
647
|
kind: tool.kind,
|
|
642
648
|
description: tool.description,
|
|
649
|
+
...(tool.name.startsWith("data.") ? { parameterNames: DATA_PARAMETER_NAMES } : {}),
|
|
643
650
|
...(capability ? { capability } : {}),
|
|
644
651
|
inputSchema: schema,
|
|
645
652
|
// Recipe ids only — the args live behind `--example <id>` (round 13). This
|
package/dist/field-add.js
CHANGED
|
@@ -20,6 +20,33 @@ import { writeEnvelope } from "./cli-output.js";
|
|
|
20
20
|
import { assertSafeInputPath } from "./artifacts.js";
|
|
21
21
|
import { readFileSync } from "node:fs";
|
|
22
22
|
import { resolve } from "node:path";
|
|
23
|
+
/**
|
|
24
|
+
* 模型级发布的爆炸半径:读出该模型草稿面里「不是本次要建的」字段。
|
|
25
|
+
*
|
|
26
|
+
* `omc field-add` 内部走 `field.publish`,而平台该端点是**模型级**的——一次发布会把
|
|
27
|
+
* 模型上所有草稿字段一起发布,且没有「取消发布」端点。r53 真机事故就是:探针据
|
|
28
|
+
* `model.inspect` 的字段面(只含已发布)判断「模型只有 10 个字段」,走 field-add 时
|
|
29
|
+
* 把一条与本次无关的历史草稿字段一起发布了,无法撤销。
|
|
30
|
+
*
|
|
31
|
+
* 只读一次;失败不阻断(爆炸半径是提示不是门)。
|
|
32
|
+
*/
|
|
33
|
+
async function listOtherDraftFields(schemaCode, ownCodes, opts) {
|
|
34
|
+
const outcome = await runToolCall("field.list", {
|
|
35
|
+
args: { schemaCode, published: false },
|
|
36
|
+
requestId: opts.requestId,
|
|
37
|
+
...(opts.environment !== undefined ? { environment: opts.environment } : {}),
|
|
38
|
+
...(opts.context !== undefined ? { context: opts.context } : {}),
|
|
39
|
+
print: () => undefined,
|
|
40
|
+
});
|
|
41
|
+
if (outcome.exitCode !== 0)
|
|
42
|
+
return [];
|
|
43
|
+
const result = outcome.result;
|
|
44
|
+
const rows = Array.isArray(result.fields) ? result.fields : [];
|
|
45
|
+
const own = new Set(ownCodes);
|
|
46
|
+
return rows
|
|
47
|
+
.map((row) => String(row.code ?? row.propertyCode ?? ""))
|
|
48
|
+
.filter((code) => code.length > 0 && !own.has(code));
|
|
49
|
+
}
|
|
23
50
|
/**
|
|
24
51
|
* 字典简写展开(r30/r36 实证:字典字段要先 names 查 id、records 取记录、
|
|
25
52
|
* 再拼 optionsSet.dictionary 三段 4–5 调;`dictCode` 把它折进 field-add 一步):
|
|
@@ -237,21 +264,35 @@ export async function cmdFieldAdd(args, contextForTest) {
|
|
|
237
264
|
return CLI_EXIT_CODES.policyRefused;
|
|
238
265
|
}
|
|
239
266
|
if (!apply) {
|
|
267
|
+
// 模型级发布的爆炸半径:field.publish 会把该模型上**所有**草稿字段一起发布
|
|
268
|
+
// (平台没有「只发布指定字段」的端点,也没有「取消发布」)。这里先把「本次要建的
|
|
269
|
+
// 字段之外还有哪些草稿字段」读出来(一次只读),否则用户只看到 field.create ×N,
|
|
270
|
+
// 不知道自己顺带发布了别人的东西——r53 真机事故。
|
|
271
|
+
const otherDraftFields = await listOtherDraftFields(schemaCode, fields.map((field) => String(field.code)), {
|
|
272
|
+
...(environment !== undefined ? { environment } : {}),
|
|
273
|
+
...(contextForTest !== undefined ? { context: contextForTest } : {}),
|
|
274
|
+
requestId: request,
|
|
275
|
+
});
|
|
240
276
|
writeEnvelope(envelope("ok", {
|
|
241
277
|
status: "dry-run",
|
|
242
278
|
schema: schemaCode,
|
|
243
279
|
fields: fields.map((field) => String(field.code)),
|
|
244
280
|
...(dictExpanded > 0 ? { dictExpanded } : {}),
|
|
281
|
+
...(otherDraftFields.length > 0 ? { otherDraftFields } : {}),
|
|
245
282
|
steps: [
|
|
246
283
|
`field.create ×${fields.length}`,
|
|
247
|
-
|
|
248
|
-
...(publishForm ? [`form.publish ${schemaCode} --rebuild
|
|
284
|
+
`field.publish(模型级:会一并发布**该模型上所有草稿字段**${otherDraftFields.length > 0 ? `,含本次之外的 ${otherDraftFields.join("、")}` : ""};不可撤销,平台无取消发布端点)`,
|
|
285
|
+
...(publishForm ? [`form.publish ${schemaCode} --rebuild(重建让新字段进默认表单;**会重发 Group/Title 等布局控件 id,回不到原 id**)`] : []),
|
|
249
286
|
...(addToList ? [`listview.configure ${schemaCode} 增量追加列(列保留;固定条件整体替换)`] : []),
|
|
250
287
|
...(conditions !== undefined ? [`listview.configure 附带固定过滤条件 ×${conditions.length}`] : []),
|
|
251
288
|
...(demoRows !== undefined ? [`data.submit 演示行 ×${demoRows.length}(非幂等)`] : []),
|
|
252
289
|
],
|
|
253
290
|
preflight: { checked: fields.length, passed: true },
|
|
254
|
-
note: "dry-run 只列计划;已对每个字段跑过本地形状预检(零 wire
|
|
291
|
+
note: "dry-run 只列计划;已对每个字段跑过本地形状预检(零 wire),`otherDraftFields` 是一次只读查询的结果。" +
|
|
292
|
+
(otherDraftFields.length > 0
|
|
293
|
+
? ` ⚠ 该模型草稿面还有 ${otherDraftFields.join("、")} 不是本次要建的,上述 field.publish 会把它们一起发布且无法撤销。`
|
|
294
|
+
: "") +
|
|
295
|
+
" --apply 依次执行全部步骤。",
|
|
255
296
|
}, request));
|
|
256
297
|
return CLI_EXIT_CODES.ok;
|
|
257
298
|
}
|
package/dist/goal-routes.js
CHANGED
|
@@ -669,6 +669,23 @@ export function goalRoute(registry, goal) {
|
|
|
669
669
|
const availableTopics = new Set(listSkills().map((topic) => topic.name));
|
|
670
670
|
const mode = detectMode(goal);
|
|
671
671
|
const readish = mode === "read" || mode === "scout";
|
|
672
|
+
// Known absence only: field-families exposes list/create/update/publish/delete,
|
|
673
|
+
// with no unpublish endpoint or update status bit (local 1.1.25 probe, 2026-11-11).
|
|
674
|
+
// Do not infer other absences from tool names: rollback is a top-level command,
|
|
675
|
+
// and other reverse operations may live in arguments rather than separate tools.
|
|
676
|
+
// Keep publication reversal distinct from e.g. “取消字段必填并发布”.
|
|
677
|
+
const fieldUnpublish = /(字段|\bfield(?:s)?\b)/i.test(goal)
|
|
678
|
+
&& /(?:取消|撤销|撤下|撤回|回滚)(?:字段的?|已)?发布|(?:退回|回滚|恢复)(?:到|为)?(?:之前的?|原来的?)?未发布|恢复到(?:之前|原来)的?(?:发布前|未发布)状态|\bunpublish\b|\b(?:revert|rollback|undo|cancel|withdraw)\s+(?:(?:the\s+)?field\s+)?(?:publish(?:ing)?|publication)\b/i.test(goal);
|
|
679
|
+
if (fieldUnpublish && !registryTools.has("field.unpublish")) {
|
|
680
|
+
const reason = "本版本没有字段取消发布(退回未发布状态)的能力;field.update 不能翻转发布状态,field.delete 是删除而非撤销发布,可能丢失数据。";
|
|
681
|
+
return {
|
|
682
|
+
status: "ok", goal, confident: false, mode: "modify", write: false,
|
|
683
|
+
match: { kind: "absence", ref: "field.unpublish" },
|
|
684
|
+
absent: { capability: "field", intent: "unpublish", reason },
|
|
685
|
+
route: null,
|
|
686
|
+
firstAnswer: { state: "blocked", why: reason },
|
|
687
|
+
};
|
|
688
|
+
}
|
|
672
689
|
// Boundary FIRST. An ask that names an out-of-coverage face (OCR, release/
|
|
673
690
|
// prod, inline coding, nested child, cross-model aggregation) must not be
|
|
674
691
|
// matched to a nearby capability and handed the write ladder — that is the
|
|
@@ -422,6 +422,8 @@ export function registerBusinessRuleLane(tools) {
|
|
|
422
422
|
schemaCode: record.schemaCode,
|
|
423
423
|
bizRuleType: record.bizRuleType,
|
|
424
424
|
enabled: record.enabled,
|
|
425
|
+
executable: record.enabled === true,
|
|
426
|
+
executableBasis: `依据 app/businessrule/get.enabled=${String(record.enabled)} 判启用开关(developmentMode=${String(record.developmentMode ?? "unknown")});ruleStatus 是同一 get 面的 status 列,可能滞后,不据此否决运行;此为开关推断,不保证触发条件满足或执行成功,未逐版本真机验证`,
|
|
425
427
|
// The platform's `status` column lags behind the enable switch: r10
|
|
426
428
|
// saw `enabled:true` with `ruleStatus:"DISABLED"` while rule.list said
|
|
427
429
|
// ENABLED. `enabled` is the dispatch truth; flag the disagreement
|
|
@@ -449,6 +451,7 @@ export function registerBusinessRuleLane(tools) {
|
|
|
449
451
|
return {
|
|
450
452
|
id: payload.id, code: payload.code, name: payload.name, schemaCode: payload.schemaCode,
|
|
451
453
|
bizRuleType: payload.bizRuleType, enabled: payload.enabled, ruleStatus: payload.ruleStatus,
|
|
454
|
+
executable: payload.executable, executableBasis: payload.executableBasis,
|
|
452
455
|
defaultRule: payload.defaultRule, ruleVersion: payload.ruleVersion,
|
|
453
456
|
nodeCount: Array.isArray(payload.nodes) ? payload.nodes.length : 0,
|
|
454
457
|
routeCount: Array.isArray(payload.routes) ? payload.routes.length : 0,
|
|
@@ -59,6 +59,9 @@ export function registerEnvironmentLane(tools) {
|
|
|
59
59
|
const versionEvidence = versionEvidenceFor(ctx, session);
|
|
60
60
|
return {
|
|
61
61
|
status: "ok",
|
|
62
|
+
// r53 场景03 F2:缓存命中与冷路径同面给出 baseUrl(非密)。
|
|
63
|
+
baseUrl: session.profile.baseUrl,
|
|
64
|
+
baseUrlHint: "非密运行参数(环境配置的 baseUrl)。拼平台端点用它 + 路径;鉴权凭据不在此面。",
|
|
62
65
|
applications: apps,
|
|
63
66
|
applicationsCount: apps.length,
|
|
64
67
|
groups,
|
|
@@ -258,6 +261,10 @@ export function registerEnvironmentLane(tools) {
|
|
|
258
261
|
const versionEvidence = versionEvidenceFor(ctx, session);
|
|
259
262
|
return {
|
|
260
263
|
...discovered,
|
|
264
|
+
// r53 场景03 F2:agent 要拼「端点 = baseUrl + path」(比如外部 invoke 面)时
|
|
265
|
+
// 只能伸手进凭据目录附近自制过滤读取。baseUrl 是非密运行参数,在这里给掉。
|
|
266
|
+
baseUrl: session.profile.baseUrl,
|
|
267
|
+
baseUrlHint: "非密运行参数(环境配置的 baseUrl)。拼平台端点用它 + 路径;鉴权凭据不在此面。",
|
|
261
268
|
// r28k F3:裸 hex 不解自用。指纹是 (env, origin, application, enterprise)
|
|
262
269
|
// 的规范 sha256——绑定写计划 / intent plan 漂移门 / draft 写前复核 /
|
|
263
270
|
// 读回缓存键;它不是审批令牌。
|
package/dist/lanes/field.js
CHANGED
|
@@ -1719,10 +1719,30 @@ export async function executeFieldPublish(session, args) {
|
|
|
1719
1719
|
mismatches,
|
|
1720
1720
|
message: `字段已发布,但发布后详情回读与草稿面不一致(${mismatches.map((item) => String(item.code)).join("、")}):这是元数据与预期形状相异的信号,先核对再决定后续;不要当作成功`,
|
|
1721
1721
|
});
|
|
1722
|
+
// bizproperty/publish 是**模型级**的:一次发布会把该模型上所有草稿字段一起发布,
|
|
1723
|
+
// 平台没有「只发布某一个」的端点,也没有「取消发布」。所以「顺带发布了别人的草稿字段」
|
|
1724
|
+
// 是这条端点的固有副作用,回执必须说出来——r53 真机事故:探针据 model.inspect 的
|
|
1725
|
+
// 已发布字段面判断「模型只有 10 个字段」,走 field-add 时把某条历史草稿字段一起发布了,
|
|
1726
|
+
// 无法撤销,只能在交付报告里解释,且该字段的 mapping 会覆盖业务字段。
|
|
1727
|
+
// 只在调用方**点名**了某些字段时才谈「附带发布」:不点名 = 意图就是整模型批量发布,
|
|
1728
|
+
// 没有「本次之外的」概念,不要制造噪音。
|
|
1729
|
+
const collateralPublishedCodes = requested.length > 0
|
|
1730
|
+
? [...draftCodesBefore].filter((code) => !requested.includes(code) && publishedCodes.includes(code))
|
|
1731
|
+
: [];
|
|
1722
1732
|
return {
|
|
1723
1733
|
performed: { errcode: publishOutcome.errcode, scope: "model" },
|
|
1724
1734
|
readback: {
|
|
1725
1735
|
publishedCodes,
|
|
1736
|
+
// 作用域声明:本次发布覆盖整个模型,不是只覆盖 requested。
|
|
1737
|
+
publishedScope: "model",
|
|
1738
|
+
...(collateralPublishedCodes.length > 0
|
|
1739
|
+
? {
|
|
1740
|
+
collateralPublishedCodes,
|
|
1741
|
+
collateralNote: `本次发布是模型级:除请求的 ${requested.length > 0 ? requested.join("、") : "全部草稿字段"} 外,` +
|
|
1742
|
+
`还一并发布了模型上原本就在草稿面的 ${collateralPublishedCodes.join("、")}。` +
|
|
1743
|
+
"平台无「单独发布」也无「取消发布」端点,这一步不可撤销;如需让它们不生效只能用 field.delete(会丢该列数据)。",
|
|
1744
|
+
}
|
|
1745
|
+
: {}),
|
|
1726
1746
|
...(args.code ? { publishedFieldPresent: publishedCodes.includes(args.code) } : {}),
|
|
1727
1747
|
...(args.codes ? { publishedFieldsPresent: Object.fromEntries(args.codes.map((code) => [code, publishedCodes.includes(code)])) } : {}),
|
|
1728
1748
|
...(requested.length > 0
|
package/dist/lanes/meta.js
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { environmentArg } from "../args.js";
|
|
3
3
|
import { environmentNotice, environmentWritable, requiresProductionConfirmation } from "../environment-policy.js";
|
|
4
4
|
import { removedProfileKeys } from "../config-store.js";
|
|
5
|
+
import { versionFamilyNotice } from "../coverage.js";
|
|
5
6
|
import { defineTool } from "../tool-types.js";
|
|
6
7
|
import { unsupportedCapabilities } from "../version-family-gaps.js";
|
|
7
8
|
import { META_LANE_CONTRACT } from "./meta-contract.js";
|
|
@@ -299,11 +300,12 @@ export function registerMetaLane(tools) {
|
|
|
299
300
|
const familyOk = version ? version.startsWith(ctx.manifest.version_family + ".") : null;
|
|
300
301
|
steps.push({
|
|
301
302
|
step: "版本族",
|
|
302
|
-
|
|
303
|
+
// Outside the anchor family is advisory (WARN), not a failed write gate.
|
|
304
|
+
ok: familyOk === null ? false : familyOk ? true : null,
|
|
303
305
|
version: version ?? null,
|
|
304
306
|
expectedFamily: ctx.manifest.version_family,
|
|
305
307
|
anchor: ctx.manifest.anchor_version,
|
|
306
|
-
note: familyOk === null ? "缺少版本证据;写入将保守拒绝" :
|
|
308
|
+
note: familyOk === null ? "缺少版本证据;写入将保守拒绝" : versionFamilyNotice(ctx.manifest, version) ?? "兼容",
|
|
307
309
|
});
|
|
308
310
|
steps.push({ step: "环境指纹", ok: true, fingerprint: session.environmentFingerprint() });
|
|
309
311
|
// T09 — optional per-service credential shape probe (non-fatal).
|
package/dist/lanes/model.js
CHANGED
|
@@ -467,6 +467,7 @@ export function registerModelLane(tools) {
|
|
|
467
467
|
}
|
|
468
468
|
: {}),
|
|
469
469
|
fields,
|
|
470
|
+
fieldsScope: "published",
|
|
470
471
|
form,
|
|
471
472
|
listview,
|
|
472
473
|
rules,
|
|
@@ -474,7 +475,7 @@ export function registerModelLane(tools) {
|
|
|
474
475
|
rulesCustom: rules.filter((rule) => rule.defaultRule !== true).map((rule) => rule.code),
|
|
475
476
|
datarules,
|
|
476
477
|
workflow,
|
|
477
|
-
hint: "model.inspect 聚合设计时六面(fields/form/listview/rules/datarules/workflow,摘要);name 是模型显示名(业务方的中文菜单名),与 schemaCode 一一对应,不必再用 listview.list 反推。modelPresent 是存在性判据(field 面 300004=false);字段 options 细节用 field.list --code;规则图用 rule.get schemaCode+ruleCode;运行数据用 data.list(不在此面)。",
|
|
478
|
+
hint: "model.inspect 聚合设计时六面(fields/form/listview/rules/datarules/workflow,摘要);fields 只含已发布字段,草稿字段不在此列;all:true 仅恢复系统字段,不含草稿。查草稿用 field.list {schemaCode,published:false}(all:true 可含系统字段);field.publish 是模型级发布,会一并发布所有草稿字段。name 是模型显示名(业务方的中文菜单名),与 schemaCode 一一对应,不必再用 listview.list 反推。modelPresent 是存在性判据(field 面 300004=false);字段 options 细节用 field.list --code;规则图用 rule.get schemaCode+ruleCode;运行数据用 data.list(不在此面)。",
|
|
478
479
|
};
|
|
479
480
|
};
|
|
480
481
|
const one = await inspectOne(codes[0]);
|
|
@@ -493,6 +494,7 @@ export function registerModelLane(tools) {
|
|
|
493
494
|
return result;
|
|
494
495
|
return {
|
|
495
496
|
schemaCode: result.schemaCode,
|
|
497
|
+
fieldsScope: result.fieldsScope,
|
|
496
498
|
...(result.applicationCode !== undefined ? { applicationCode: result.applicationCode } : {}),
|
|
497
499
|
// r35a-F3:compact 投影必须保留 code(model.list 有 code,inspect 此前
|
|
498
500
|
// 只剩 schemaCode,`--jq '[].code'` 必 pathMiss 白跑一轮)。
|
|
@@ -84,7 +84,7 @@ export const PROGRAMMING_LANE_CONTRACT = Object.freeze({
|
|
|
84
84
|
}),
|
|
85
85
|
"programming.publish": Object.freeze({
|
|
86
86
|
scope: PROGRAMMING_SCOPE,
|
|
87
|
-
description: "发布源码(POST publish):内部 saveDraftSource→**强制 compile**(失败回 PROGRAMMING_COMPILE_FAILED)→插 published 新版本行→BUSINESS_RULE 规则自动置 DevelopmentMode.CODING+enabled
|
|
87
|
+
description: "发布源码(POST publish):内部 saveDraftSource→**强制 compile**(失败回 PROGRAMMING_COMPILE_FAILED)→插 published 新版本行→BUSINESS_RULE 规则自动置 DevelopmentMode.CODING+enabled+发布。发布不可逆:永久切在线编码、平台无法退回图形化(删除=连源码删)。先 dry-run 看后果。载荷必须带 businessRule 整模型(工具内按 ruleCode 从 businessrule/list_by_schemacode 补齐;规则不存在则拒绝)。发布后运行时才执行该源码。content 省略时用远端草稿。",
|
|
88
88
|
}),
|
|
89
89
|
}),
|
|
90
90
|
});
|
|
@@ -10,6 +10,8 @@ import { PROGRAMMING_LANE_CONTRACT, PROGRAMMING_WIRE } from "./programming-contr
|
|
|
10
10
|
import { readModelRecord } from "../model-record.js";
|
|
11
11
|
const LANE = PROGRAMMING_LANE_CONTRACT.lane;
|
|
12
12
|
const TOOLS = PROGRAMMING_LANE_CONTRACT.tools;
|
|
13
|
+
const PUBLISH_WARNING = "发布不可逆:首次发布将把该规则永久切到在线编码模式,平台不提供退回图形化的端点,无法退回图形化;删除规则会连源码一起删,不是还原。";
|
|
14
|
+
const PUBLISH_RECOVERY = "如需退回默认行为:把源码改为仅调用 super.<method>(...) 并重新 publish(保留规则记录);平台无删除即还原的能力。这只是恢复默认行为,不会恢复图形化模式。";
|
|
13
15
|
/** metadata.app.CodeType is the NUMERIC index on the wire (8.6.26 source). */
|
|
14
16
|
const CODE_TYPE_BUSINESS_RULE = 0;
|
|
15
17
|
/**
|
|
@@ -572,7 +574,7 @@ export function registerProgrammingLane(tools) {
|
|
|
572
574
|
const publishStatusRaw = readbackRule?.publishStatus;
|
|
573
575
|
return {
|
|
574
576
|
performed: { errcode: 0, code, contentSha256: sha256(content), contentBytes: Buffer.byteLength(content, "utf8"), compiled: true },
|
|
575
|
-
rollbackReceipt: { supported: false, reason: "无图形化回退端点;rollback plan 亦标 irreversible" },
|
|
577
|
+
rollbackReceipt: { supported: false, reason: "无图形化回退端点;rollback plan 亦标 irreversible", recovery: PUBLISH_RECOVERY },
|
|
576
578
|
runtimeVerification: { note: "自定义规则无调用响应体读面;验证须写副作用后用 data.load 读取" },
|
|
577
579
|
readback: {
|
|
578
580
|
present: readbackSource.present,
|
|
@@ -617,7 +619,14 @@ export function registerProgrammingLane(tools) {
|
|
|
617
619
|
const compiled = await compileSource(session, code, content);
|
|
618
620
|
if (!compiled.success)
|
|
619
621
|
throw new ToolRefusalError({ status: "refused", blocker: "programming-compile-failed", message: "编译失败,拒绝 dry-run(真写也会拒绝发布)。", errors: compiled.presented.errors ?? compiled.errors, userErrors: compiled.presented.userErrors, platformErrors: compiled.presented.platformErrors });
|
|
620
|
-
return {
|
|
622
|
+
return {
|
|
623
|
+
code,
|
|
624
|
+
contentSha256: sha256(content),
|
|
625
|
+
contentBytes: Buffer.byteLength(content, "utf8"),
|
|
626
|
+
warning: PUBLISH_WARNING,
|
|
627
|
+
rollback: { supported: false, reason: "无图形化回退端点;删除规则才会连源码一起删", recovery: PUBLISH_RECOVERY },
|
|
628
|
+
note: "dry-run 与真写执行相同的规则存在、模板形状、编译 preflight;不会写入或切 CODING。",
|
|
629
|
+
};
|
|
621
630
|
},
|
|
622
631
|
rollback: publishRollback(),
|
|
623
632
|
});
|
|
@@ -40,7 +40,7 @@ export function ruleDisableDescription() {
|
|
|
40
40
|
* and the rule's UPDATE node really rewrote the row's field.
|
|
41
41
|
*/
|
|
42
42
|
export function ruleRunDescription() {
|
|
43
|
-
return `手动执行一条【自定义触发】业务规则(平台按钮同款面:\`POST /api/api/launcher/domain_service_runtime/<schemaCode>/<ruleCode>\`,body \`{schemaCode, ids:[bizObjectId…], ruleCode, consolidation}\`)。用于端到端验证按钮/自定义规则——**列表或表单按钮(\`listview.configure\` 的 \`buttons\` + \`bindAction:BUSINESS_RULE\`)点击时发给平台的就是这笔请求**(Playwright 抓包 + 容器日志双证,1.1.25)。前提:规则必须是**自定义 code**(\`defaultRule:false\`,图里有 CUSTOM_NODE 触发节点)且 **enabled:true**——禁用规则按钮不可用,工具回 \`rule-run-disabled\` 并指向 \`rule.enable\`;预置触发码(Create/Update/…)由数据事件分发,按钮选择器不提供,工具回 \`rule-run-preset-rule\`。**返回的 data 是执行前快照**(前端发 reacquireDataFromDb:false),规则的副作用要用 \`data.load\`/\`data.list\`
|
|
43
|
+
return `手动执行一条【自定义触发】业务规则(平台按钮同款面:\`POST /api/api/launcher/domain_service_runtime/<schemaCode>/<ruleCode>\`,body \`{schemaCode, ids:[bizObjectId…], ruleCode, consolidation}\`)。用于端到端验证按钮/自定义规则——**列表或表单按钮(\`listview.configure\` 的 \`buttons\` + \`bindAction:BUSINESS_RULE\`)点击时发给平台的就是这笔请求**(Playwright 抓包 + 容器日志双证,1.1.25)。前提:规则必须是**自定义 code**(\`defaultRule:false\`,图里有 CUSTOM_NODE 触发节点)且 **enabled:true**——禁用规则按钮不可用,工具回 \`rule-run-disabled\` 并指向 \`rule.enable\`;预置触发码(Create/Update/…)由数据事件分发,按钮选择器不提供,工具回 \`rule-run-preset-rule\`。**返回的 data 是执行前快照**(前端发 reacquireDataFromDb:false),规则的副作用要用 \`data.load\`/\`data.list\` 另行读回;本面不回 handle 的返回值,要拿返回值走 v2 invoke(/api/api/v2/businessRule/invoke)。\`302045\` = 数据被占用(有人正在编辑该行),稍后重试。`;
|
|
44
44
|
}
|
|
45
45
|
export const RULE_LIFECYCLE_LANE_CONTRACT = Object.freeze({
|
|
46
46
|
lane: LANES.ruleLifecycle,
|
package/dist/lanes/rulelog.js
CHANGED
|
@@ -3,10 +3,11 @@ import { ENDPOINTS } from "../endpoints.js";
|
|
|
3
3
|
import { capabilityArg, environmentArg } from "../args.js";
|
|
4
4
|
import { governedRead } from "../read.js";
|
|
5
5
|
import { defineTool } from "../tool-types.js";
|
|
6
|
-
import { wireCall } from "../wire.js";
|
|
6
|
+
import { wireCall, wireRows } from "../wire.js";
|
|
7
7
|
import { RULELOG_LANE_CONTRACT } from "./rulelog-contract.js";
|
|
8
8
|
const path = (template, schemaCode) => template.replace("{schemaCode}", encodeURIComponent(schemaCode));
|
|
9
|
-
const
|
|
9
|
+
const codingNote = "CODING 模式在线开发 Java 规则不记日志";
|
|
10
|
+
const notes = [codingNote, "日志异步落库约 5 秒,未见不等于未触发", "成功/失败日志按平台配置天数清理,历史有限"];
|
|
10
11
|
export function registerRuleLogLane(tools) {
|
|
11
12
|
tools.push(defineTool({
|
|
12
13
|
name: "rulelog.search", layer: "low", kind: "read", lane: RULELOG_LANE_CONTRACT.lane,
|
|
@@ -19,6 +20,23 @@ export function registerRuleLogLane(tools) {
|
|
|
19
20
|
},
|
|
20
21
|
handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
|
|
21
22
|
const requestedPage = args.page ?? 0, requestedSize = args.size ?? 20;
|
|
23
|
+
let coding = false;
|
|
24
|
+
if (args.ruleCode) {
|
|
25
|
+
try {
|
|
26
|
+
const rules = wireRows((await wireCall(session, { path: ENDPOINTS.businessRuleListBySchemaCode, query: { schemaCode: args.schemaCode } })).data);
|
|
27
|
+
const rule = rules.find((row) => row.code === args.ruleCode);
|
|
28
|
+
// The list face can omit mode; read the same detail face as rule.get.
|
|
29
|
+
const detail = rule?.developmentMode === undefined && rule?.id
|
|
30
|
+
? (await wireCall(session, { path: ENDPOINTS.businessRuleGet, query: { id: String(rule.id) } })).data
|
|
31
|
+
: rule;
|
|
32
|
+
const mode = detail?.developmentMode;
|
|
33
|
+
coding = mode === 1 || mode === "1" || mode === "CODING";
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Metadata failure must not hide available logs; the first note warns
|
|
37
|
+
// about the CODING blind spot without claiming this rule is CODING.
|
|
38
|
+
}
|
|
39
|
+
}
|
|
22
40
|
const fetch = async (page, size) => {
|
|
23
41
|
const body = { page, size };
|
|
24
42
|
for (const [key, value] of [["startTime", args.since], ["endTime", args.until], ["ruleCode", args.ruleCode], ["status", args.status]])
|
|
@@ -68,7 +86,7 @@ export function registerRuleLogLane(tools) {
|
|
|
68
86
|
}
|
|
69
87
|
return log;
|
|
70
88
|
}));
|
|
71
|
-
return { index: { schemaCode: args.schemaCode, page: requestedPage, size: requestedSize, totalElements: data.totalElements ?? logs.length, totalPages: data.totalPages ?? 0, ...(rowFilter ? { rowFilter } : {}) }, logs, notes: ["status=true 表示成功,status=false 表示失败", ...
|
|
89
|
+
return { ...(coding ? { traceable: false, traceNote: "该规则为 CODING 模式,平台不记规则日志;执行痕迹用 data.load 比对业务字段或看容器日志" } : {}), index: { schemaCode: args.schemaCode, page: requestedPage, size: requestedSize, totalElements: data.totalElements ?? logs.length, totalPages: data.totalPages ?? 0, ...(rowFilter ? { rowFilter } : {}) }, logs, notes: [...notes, "status=true 表示成功,status=false 表示失败", ...(args.includeNodes === true ? ["节点 VO 不提供 targetBizObjectId,节点行级 id 不可得;仅前 3 条命中日志拉取节点链", "QUERY 节点日志不记录命中数:matchedUnknown=true;0 行与成功同形,请用 data.load 比对目标行"] : [])] };
|
|
72
90
|
}, { target: `rulelog.search:${args.schemaCode}:${JSON.stringify(args)}` }),
|
|
73
91
|
}));
|
|
74
92
|
}
|
|
@@ -13,6 +13,7 @@ import { closestMatch } from "../closest-match.js";
|
|
|
13
13
|
import { getReplayToken, listInstanceActivities, searchWorkItems, wireString } from "../workflow-support.js";
|
|
14
14
|
import { PLATFORM_ADMIN_START_BYPASS, resolvePermissionActor } from "../identity.js";
|
|
15
15
|
import { ENGINE_OWNED_KEYS, RUNTIME_DATA_LANE_CONTRACT, RUNTIME_DATA_WIRE, runtimeFormDataArg, } from "./runtime-data-contract.js";
|
|
16
|
+
import { SYSTEM_FIELD_CODES } from "../field-families.js";
|
|
16
17
|
import { applicationResolutionOf, resolveApplicationScope } from "../support.js";
|
|
17
18
|
/** r29b F8: keep ids/itemsPreview through governedRead's compact diet. */
|
|
18
19
|
const DATA_LIST_PREVIEW_LIMIT = 20;
|
|
@@ -288,6 +289,26 @@ const RUNTIME_ENGINE_RECORD_KEYS = new Set([
|
|
|
288
289
|
"owner", "creater", "modifier", "createdDeptId", "ownerDeptId", "ownerDeptQueryCode",
|
|
289
290
|
"createdBy", "modifiedBy",
|
|
290
291
|
]);
|
|
292
|
+
// Same reserved catalogue as field.list, plus runtime identity/time aliases
|
|
293
|
+
// and staff/dept keys removed by compactRuntimeRecord. Flow internals end in _.
|
|
294
|
+
const RUNTIME_SYSTEM_FIELD_CODES = new Set([
|
|
295
|
+
...SYSTEM_FIELD_CODES, ...RUNTIME_ENGINE_RECORD_KEYS,
|
|
296
|
+
"bizObjectId", "schemaCode", "updatedTime", "creator", "updater", "parentId", "sortKey",
|
|
297
|
+
]);
|
|
298
|
+
function emptyBusinessProjection(items) {
|
|
299
|
+
let businessColumns = 0;
|
|
300
|
+
for (const item of items) {
|
|
301
|
+
for (const [key, value] of Object.entries(item.fields)) {
|
|
302
|
+
if (RUNTIME_SYSTEM_FIELD_CODES.has(key) || key.endsWith("_"))
|
|
303
|
+
continue;
|
|
304
|
+
businessColumns += 1;
|
|
305
|
+
if (value !== null && value !== undefined)
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return items.length > 0 && businessColumns > 0;
|
|
310
|
+
}
|
|
311
|
+
const VIEW_PROJECTION_HINT = "该面仅回视图投影列;业务字段全 null 不代表未写入,真值用 data.load,或用 listview.configure 配列。";
|
|
291
312
|
/**
|
|
292
313
|
* Default-compact a runtime record: drop only KNOWN engine noise — `*_` keys are
|
|
293
314
|
* flow-engine internals (`activityName_`, `participants_`, …) and the staff/dept
|
|
@@ -367,9 +388,19 @@ function projectReadbackRecord(record, args) {
|
|
|
367
388
|
* while `data.load` a moment later had every business field). Without a note the
|
|
368
389
|
* caller reads that as "the write dropped my data" and writes again.
|
|
369
390
|
*/
|
|
391
|
+
function submittedBusinessFields(formData) {
|
|
392
|
+
return Object.entries(formData).filter(([key]) => !RUNTIME_SYSTEM_FIELD_CODES.has(key) && !key.endsWith("_"));
|
|
393
|
+
}
|
|
394
|
+
function ignoredNullDiagnostic(formData) {
|
|
395
|
+
const ignoredNull = submittedBusinessFields(formData).filter(([, value]) => value === null).map(([key]) => key);
|
|
396
|
+
return ignoredNull.length > 0 ? {
|
|
397
|
+
ignoredNull,
|
|
398
|
+
ignoredNullNote: "这些字段传了 null:平台写面把 null 当「未提交」,不会清空;当前版本无已验证的通用清空语义,不要把成功回执当作清空成功(r53 真机复现)",
|
|
399
|
+
} : {};
|
|
400
|
+
}
|
|
370
401
|
function readbackEmptyFields(formData, record) {
|
|
371
402
|
const source = record !== null && typeof record === "object" && !Array.isArray(record) ? record : {};
|
|
372
|
-
return
|
|
403
|
+
return submittedBusinessFields(formData)
|
|
373
404
|
.filter(([key, value]) => value !== null && value !== undefined && (source[key] === null || source[key] === undefined))
|
|
374
405
|
.map(([key]) => key);
|
|
375
406
|
}
|
|
@@ -1042,8 +1073,8 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1042
1073
|
orders: z.array(z.object({ field: z.string().min(1), dir: z.enum(["ASC", "DESC"]) })).optional().describe("运行面 query/list 不支持服务端排序;排序请用 listview.configure 的 sorts(视图级)或在本地对 items 排序"),
|
|
1043
1074
|
mobile: z.boolean().optional(),
|
|
1044
1075
|
showTotal: z.boolean().default(true),
|
|
1045
|
-
page: z.number().int().min(0).default(0),
|
|
1046
|
-
size: z.number().int().min(1).max(200).default(10),
|
|
1076
|
+
page: z.number().int().min(0).default(0).describe("页码,从 0 开始(不是每页条数);每页条数用 size"),
|
|
1077
|
+
size: z.number().int().min(1).max(200).default(10).describe("每页条数,默认 10、上限 200;页码用 page(从 0 开始)"),
|
|
1047
1078
|
all: z.boolean().optional().describe("true 时自动翻页聚合全部结果(size=200 逐页,上限 1000 行,超出 resultTruncated:true);与 page 互斥;默认 size=10,视图 pagingSetting.pageSize 不生效"),
|
|
1048
1079
|
full: z.boolean().optional().describe("内联完整列表结果;默认大结果只返回计数与 detailFile"),
|
|
1049
1080
|
// r31 (2026-10-31 real machine): agents pass `query: {field: value}` as a
|
|
@@ -1286,6 +1317,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1286
1317
|
itemsReturned: collected.length,
|
|
1287
1318
|
resultTruncated: truncatedByCap,
|
|
1288
1319
|
itemsExternalized: false,
|
|
1320
|
+
...(emptyBusinessProjection(items) ? { viewProjectionOnly: true, hint: VIEW_PROJECTION_HINT } : {}),
|
|
1289
1321
|
// r29b F8 的 ids/itemsPreview 由 compact(外置时)现算,不在这里内联——
|
|
1290
1322
|
// 内联会让小结果越过 2048B 外置阈值,反而把 items 挤成 []。
|
|
1291
1323
|
...(truncatedByCap
|
|
@@ -1378,8 +1410,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1378
1410
|
// back null while `data.load` shows the real values. That reads as
|
|
1379
1411
|
// "the write failed". Detect an all-null business projection (items
|
|
1380
1412
|
// present, zero non-null business values) and say so.
|
|
1381
|
-
const
|
|
1382
|
-
const projectionEmpty = items.length > 0 && businessKeys.length > 0 && items.every((item) => businessKeys.every((key) => item.fields[key] === null || item.fields[key] === undefined));
|
|
1413
|
+
const projectionEmpty = emptyBusinessProjection(items);
|
|
1383
1414
|
const preview = dataListItemPreview(items);
|
|
1384
1415
|
const requestedPage = args.page ?? 0;
|
|
1385
1416
|
// r31b F9: an out-of-range page can answer total:0 / totalPages:1 (platform),
|
|
@@ -1399,7 +1430,8 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1399
1430
|
});
|
|
1400
1431
|
const probePage = extractBizObjectPage(probe.data);
|
|
1401
1432
|
total = probePage.total;
|
|
1402
|
-
totalPages
|
|
1433
|
+
// Probe uses size:1; its totalPages is NOT the requested page size.
|
|
1434
|
+
totalPages = Math.ceil(Number(total ?? 0) / (args.size ?? 10));
|
|
1403
1435
|
pageOutOfRange = Number(probePage.total ?? 0) > 0 || (probePage.totalPages > 0 && requestedPage >= probePage.totalPages);
|
|
1404
1436
|
}
|
|
1405
1437
|
else if (totalPages > 0 && requestedPage >= totalPages) {
|
|
@@ -1424,6 +1456,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1424
1456
|
schemaCode: args.schemaCode,
|
|
1425
1457
|
...application,
|
|
1426
1458
|
...(projectionEmpty ? { projectionWarning: { reason: "business-columns-null", hint: "模型可能未配置列表视图:data.list 只投影列表列,业务列会全为 null;核对写入结果请用 data.load(或先建列表视图)" } } : {}),
|
|
1459
|
+
...(projectionEmpty ? { viewProjectionOnly: true, hint: VIEW_PROJECTION_HINT } : {}),
|
|
1427
1460
|
...(args.queryCode !== undefined ? { queryCode: args.queryCode } : {}),
|
|
1428
1461
|
total,
|
|
1429
1462
|
// This branch is the non-`all` read. `excludedDraft` used to be
|
|
@@ -1457,7 +1490,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1457
1490
|
itemsExternalized: false,
|
|
1458
1491
|
page: page.page ?? requestedPage,
|
|
1459
1492
|
size: page.size ?? args.size ?? 20,
|
|
1460
|
-
...(pageOutOfRange ? { pageOutOfRange: true, emptyPage: true } : {}),
|
|
1493
|
+
...(pageOutOfRange ? { pageOutOfRange: true, emptyPage: true, hint: `page 从 0 开始,当前传了 ${requestedPage};合法范围 0..${Math.max(0, totalPages - 1)}。` } : {}),
|
|
1461
1494
|
// r29b F8 的 ids/itemsPreview 由 compact(外置时)现算,见 dataListCompactProjection。
|
|
1462
1495
|
items,
|
|
1463
1496
|
};
|
|
@@ -1675,7 +1708,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1675
1708
|
sequenceStatus = extractSequenceStatus((readbackData ?? {}));
|
|
1676
1709
|
return {
|
|
1677
1710
|
performed: { errcode: performed.errcode, ...application, bizObjectId: returnedId, workflowInstanceId, workItemId, workItemSource, sheetCode, resolvedFrom, formType: "save-draft-workflow" },
|
|
1678
|
-
readback: { ...application, authoritative: projectReadbackRecord(normalizeLoadedRecord((readbackData ?? {})), args), sequenceStatus, expectedSequenceStatus: "DRAFT" },
|
|
1711
|
+
readback: { ...application, ...ignoredNullDiagnostic(formData), authoritative: projectReadbackRecord(normalizeLoadedRecord((readbackData ?? {})), args), sequenceStatus, expectedSequenceStatus: "DRAFT" },
|
|
1679
1712
|
};
|
|
1680
1713
|
}
|
|
1681
1714
|
let performed;
|
|
@@ -1704,12 +1737,17 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1704
1737
|
const savedRecord = normalizeLoadedRecord((readbackData ?? {}));
|
|
1705
1738
|
const savedEmptyFields = readbackEmptyFields(formData, savedRecord);
|
|
1706
1739
|
const dataWarnings = await runtimeDataWarnings(session, args.schemaCode, sheetCode, formData, 1);
|
|
1740
|
+
const publishedWorkflow = await resolvePublishedWorkflowCode(session, args.schemaCode);
|
|
1741
|
+
const workflowDraftHint = publishedWorkflow
|
|
1742
|
+
? `本模型有已发布流程 ${publishedWorkflow},不能用 submit:true 一调完成态;要走三段:① data.save {schemaCode:"${args.schemaCode}", workflowCode:"${publishedWorkflow}", formData:{...}} 新建流程草稿 → ② 从回执 performed 取 bizObjectId / workItemId / workflowInstanceId → ③ data.submit {schemaCode:"${args.schemaCode}", bizObjectId:"<bizObjectId>", workItemId:"<workItemId>", workflowInstanceId:"<workflowInstanceId>"} 提交起始待办(后续审批用 workitem 面;不保证立即完成态);本次无实例草稿不能原地起流程`
|
|
1743
|
+
: null;
|
|
1707
1744
|
const plainReadback = {
|
|
1708
1745
|
...application,
|
|
1746
|
+
...ignoredNullDiagnostic(formData),
|
|
1709
1747
|
authoritative: projectReadbackRecord(savedRecord, args),
|
|
1710
1748
|
...(savedEmptyFields.length > 0 ? { readbackWarning: readbackWarningFor(savedEmptyFields, "data.save") } : {}),
|
|
1711
1749
|
...(dataWarnings.length > 0 ? { warnings: dataWarnings } : {}),
|
|
1712
|
-
draftRuleHint: "草稿态(DRAFT)保存不触发业务规则——DRAFT 行跳过 Create/Update 分发(DomainServiceImpl.java:240-248);要一调完成态本调用加 submit:true;已存草稿直提形状:data.submit {schemaCode, bizObjectId: 本读回的 bizObjectId, formData}(submit 自持久化)",
|
|
1750
|
+
draftRuleHint: workflowDraftHint ?? "草稿态(DRAFT)保存不触发业务规则——DRAFT 行跳过 Create/Update 分发(DomainServiceImpl.java:240-248);要一调完成态本调用加 submit:true;已存草稿直提形状:data.submit {schemaCode, bizObjectId: 本读回的 bizObjectId, formData}(submit 自持久化)",
|
|
1713
1751
|
};
|
|
1714
1752
|
// r18 retro (G3): one-call COMPLETED creation — the agent goal is usually
|
|
1715
1753
|
// "record AND rule effect", not "a draft". Chain the no-flow submit in
|
|
@@ -1719,7 +1757,6 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1719
1757
|
// (resolvePublishedWorkflowCode → formType 1 → PROCESSING, not
|
|
1720
1758
|
// COMPLETED) — the one-call chain's ruleHint would lie. Workflow-
|
|
1721
1759
|
// backed models keep the two-phase chain.
|
|
1722
|
-
const publishedWorkflow = await resolvePublishedWorkflowCode(session, args.schemaCode);
|
|
1723
1760
|
if (publishedWorkflow) {
|
|
1724
1761
|
return {
|
|
1725
1762
|
performed: { errcode: performed.errcode, bizObjectId, sheetCode, resolvedFrom, submitted: false },
|
|
@@ -1728,7 +1765,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1728
1765
|
submitRefused: {
|
|
1729
1766
|
blocker: "submit-model-has-workflow",
|
|
1730
1767
|
workflowCode: publishedWorkflow,
|
|
1731
|
-
message:
|
|
1768
|
+
message: `草稿已保存;${workflowDraftHint}(见 describe data.submit --example workflow-backed-data-submit)`,
|
|
1732
1769
|
},
|
|
1733
1770
|
},
|
|
1734
1771
|
};
|
|
@@ -1751,6 +1788,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1751
1788
|
performed: { errcode: performed.errcode, bizObjectId, sheetCode, resolvedFrom, submitted: true },
|
|
1752
1789
|
readback: {
|
|
1753
1790
|
...okOutcome.readback,
|
|
1791
|
+
...ignoredNullDiagnostic(formData),
|
|
1754
1792
|
submitted: true,
|
|
1755
1793
|
ruleHint: "已直提 COMPLETED——Create 业务规则本次已分发;规则效果以本读回字段值为准",
|
|
1756
1794
|
},
|
|
@@ -1826,6 +1864,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1826
1864
|
// both faces.
|
|
1827
1865
|
readback: {
|
|
1828
1866
|
authoritative: projectReadbackRecord(updatedRecord, args),
|
|
1867
|
+
...ignoredNullDiagnostic(formData),
|
|
1829
1868
|
sequenceStatus,
|
|
1830
1869
|
...(updatedEmptyFields.length > 0 ? { readbackWarning: readbackWarningFor(updatedEmptyFields, "data.update") } : {}),
|
|
1831
1870
|
...(omitWarnings.length > 0 ? { warnings: omitWarnings } : {}),
|
package/dist/model-scaffold.js
CHANGED
|
@@ -372,7 +372,7 @@ function describeScaffoldPlan(options) {
|
|
|
372
372
|
`field.create ×${options.fields.length}(含子表挂载)`,
|
|
373
373
|
...childTables.map((field) => `child field.create ×${scaffoldChildrenOf(field).length} on ${field.code}`),
|
|
374
374
|
"field.publish(主模型;子表列随主模型一起校验)",
|
|
375
|
-
...(options.publishForm ? [`form.publish ${options.code} --rebuild
|
|
375
|
+
...(options.publishForm ? [`form.publish ${options.code} --rebuild(会重发布单控件 id,回不到原 id)`] : []),
|
|
376
376
|
],
|
|
377
377
|
};
|
|
378
378
|
}
|
package/dist/path-projection.js
CHANGED
|
@@ -232,6 +232,7 @@ const PATH_KEY_ALIASES = Object.freeze({
|
|
|
232
232
|
application: "applications",
|
|
233
233
|
app: "applications",
|
|
234
234
|
models: "items",
|
|
235
|
+
items: "models",
|
|
235
236
|
rows: "items",
|
|
236
237
|
list: "items",
|
|
237
238
|
content: "publishedContent",
|
|
@@ -468,7 +469,29 @@ export function projectResultExtract(result, paths, keysOnly) {
|
|
|
468
469
|
// r27 真机:多路径时每条 miss 都带 695 B 完整语法 → 3 条 2 KB 说同一件事。
|
|
469
470
|
// 单路径照旧带完整提示(只出现一次,最有用);多路径逐条只给定位,语法放顶层一次。
|
|
470
471
|
const multiPath = paths.length > 1;
|
|
471
|
-
const missHintFor = (
|
|
472
|
+
const missHintFor = (path, at, available) => {
|
|
473
|
+
const fallback = multiPath ? pathMissEntryHint(at, available) : PATH_MISS_HINT;
|
|
474
|
+
const candidate = pathMissDidYouMean(at, available);
|
|
475
|
+
if (candidate === undefined || at === undefined)
|
|
476
|
+
return fallback;
|
|
477
|
+
// Replace only the missed segment, retaining array mapping and suffixes.
|
|
478
|
+
const leaf = at.split(/[./\[]/).filter(Boolean).pop();
|
|
479
|
+
if (leaf === undefined)
|
|
480
|
+
return fallback;
|
|
481
|
+
let replaced = false;
|
|
482
|
+
const corrected = path.replace(/[^.[\]/]+/g, (segment, offset) => {
|
|
483
|
+
const prefix = path.slice(0, offset + segment.length).replace(/^[.$/]+/, "");
|
|
484
|
+
if (replaced || segment !== leaf || (at !== leaf && prefix !== at))
|
|
485
|
+
return segment;
|
|
486
|
+
replaced = true;
|
|
487
|
+
return candidate;
|
|
488
|
+
});
|
|
489
|
+
// A similar key is useful only if the complete proposed path resolves.
|
|
490
|
+
if (corrected === path || projectPathOnSource(projectionSource, corrected).projected.missed)
|
|
491
|
+
return fallback;
|
|
492
|
+
const quoted = corrected.replace(/'/g, "'\\''");
|
|
493
|
+
return `路径未命中:在 "${at}" 断开;最接近的是 ${candidate}。可试:--jq '${quoted}'`;
|
|
494
|
+
};
|
|
472
495
|
out.extract = paths.map((path) => {
|
|
473
496
|
// r28f F2:对象构造 / 函数调用不是 pathMiss——先识别,别伪装成键缺失。
|
|
474
497
|
const unsupported = detectUnsupportedJqSyntax(path);
|
|
@@ -502,7 +525,7 @@ export function projectResultExtract(result, paths, keysOnly) {
|
|
|
502
525
|
missedEntries: fan.missedEntries,
|
|
503
526
|
...(didYouMean !== undefined ? { didYouMean } : {}),
|
|
504
527
|
...(readFromArtifact ? resultLayerNote(result, path) ?? {} : {}),
|
|
505
|
-
hint: missHintFor(fan.at, fan.available),
|
|
528
|
+
hint: missHintFor(path, fan.at, fan.available),
|
|
506
529
|
};
|
|
507
530
|
}
|
|
508
531
|
return {
|
|
@@ -538,7 +561,7 @@ export function projectResultExtract(result, paths, keysOnly) {
|
|
|
538
561
|
available: single.available,
|
|
539
562
|
...(didYouMean !== undefined ? { didYouMean } : {}),
|
|
540
563
|
...(readFromArtifact ? resultLayerNote(result, path) ?? {} : {}),
|
|
541
|
-
hint: missHintFor(single.at, single.available),
|
|
564
|
+
hint: missHintFor(path, single.at, single.available),
|
|
542
565
|
};
|
|
543
566
|
}
|
|
544
567
|
return {
|
|
@@ -580,9 +603,8 @@ export function projectResultExtract(result, paths, keysOnly) {
|
|
|
580
603
|
out.rowCount = rowCount;
|
|
581
604
|
// Deliberately NO top-level `content` on multi-path — that was the duplicate.
|
|
582
605
|
}
|
|
583
|
-
//
|
|
584
|
-
//
|
|
585
|
-
out.projections = extracts;
|
|
606
|
+
// extract[] is canonical for call projections. Artifact get retains its
|
|
607
|
+
// projections[] face; do not inline the same values twice here.
|
|
586
608
|
// A projection that missed is not an answer. `status` stays `ok` (adding a
|
|
587
609
|
// new status value would fall through classifyResult to error/exit 15 and
|
|
588
610
|
// change the exit contract), but the envelope now says so out loud.
|
package/dist/tool-types.js
CHANGED
|
@@ -194,6 +194,9 @@ const CONTEXTUAL_KEY_GUIDANCE = Object.freeze({
|
|
|
194
194
|
const SIBLING_TOOL_KEY_HINTS = Object.freeze({
|
|
195
195
|
"app.update": Object.freeze({ name: '"name" 是 app.create 的入参;app.update 不收它' }),
|
|
196
196
|
"model.create": Object.freeze({ fields: '"fields" 是 configure_model 的入参;model.create 不收它' }),
|
|
197
|
+
// r53 场景03 F8:记录标识在 data.* 族叫 bizObjectId、在 rule.run 叫 ids(数组)——
|
|
198
|
+
// 两边零字符串相似度,最近匹配只能报「无相近键」。
|
|
199
|
+
"rule.run": Object.freeze({ bizObjectId: "rule.run 的记录标识是 ids(字符串数组,如 ids:[\"<bizObjectId>\"])" }),
|
|
197
200
|
});
|
|
198
201
|
function closestSchemaKey(key, schemaKeys) {
|
|
199
202
|
if (schemaKeys.has(key))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.38",
|
|
4
4
|
"description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"commander": "14.0.3",
|
|
58
|
-
"omc-core": "0.6.
|
|
58
|
+
"omc-core": "0.6.38",
|
|
59
59
|
"proper-lockfile": "4.1.2",
|
|
60
60
|
"write-file-atomic": "6.0.0",
|
|
61
61
|
"zod": "^3.23.8",
|
|
@@ -73,6 +73,6 @@
|
|
|
73
73
|
"directory": "packages/omc-cli"
|
|
74
74
|
},
|
|
75
75
|
"optionalDependencies": {
|
|
76
|
-
"@stalfh233/omc-fake-platform": "0.6.
|
|
76
|
+
"@stalfh233/omc-fake-platform": "0.6.38"
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -132,10 +132,39 @@ webapi = Spring Boot `PropertiesLauncher`,真机启动参数
|
|
|
132
132
|
import;但 launcher 自身的嵌套 BOOT-INF lib 对直接 import 仍不可见(`jakarta.*` 编不过的
|
|
133
133
|
边界不变)。
|
|
134
134
|
|
|
135
|
+
#### 两种 `extension` 是两个东西,别混
|
|
136
|
+
|
|
137
|
+
- `extension/`(**单数**):你项目里的 **Maven 源码工程**(脚手架)——写代码、`mvn package` 出 jar,是**你的活**。
|
|
138
|
+
- `extensions/`(**复数**):launcher 的**运行时扩展目录**——jar 放进去平台才认,是**运维的活**。
|
|
139
|
+
|
|
140
|
+
**关键边界:二开扩展包需要「部署」才算交付,而部署不在本 CLI 里。**
|
|
141
|
+
一个扩展包从代码到生效要三步:构建 jar → **部署到 launcher 的扩展目录** → **重启 launcher**
|
|
142
|
+
(新 jar 不做热加载,重启期间整个平台中断)。这三步里只有第一步是开发动作。
|
|
143
|
+
|
|
144
|
+
所以:
|
|
145
|
+
|
|
146
|
+
- 你负责**产出可部署的 jar + 源码 + 单测**,并说清「这个类已经在代码里、但需要部署后才可用」。
|
|
147
|
+
- **部署与重启不要自己做**:这是运维动作,会让别人正在用的系统中断。停下来,向需求方/运维说明
|
|
148
|
+
「需要部署这个 jar 并重启 launcher 才生效」,等他们给窗口。
|
|
149
|
+
- 判断某个扩展类当前是否**已生效**,别猜:写进 handler 走一次 `programming.compile`
|
|
135
150
|
**你没法列举已部署的类**:CLI 没有「列出 extensions 内容」的读面(`extensions/` 在远端容器里,
|
|
136
151
|
agent 侧看不到)。判断某个类能不能用只有一条路——写进 handler,`programming.compile` 试一次
|
|
137
152
|
(只读、不落库):成功即可用,`errors[]` 里报 `package ... does not exist` 即不可用。
|
|
138
153
|
|
|
154
|
+
**类路径是启动时快照,不是「目录里有就能用」**(真机对照实验 2026-11-11,r53):
|
|
155
|
+
`loader.path` 在 webapi 进程**启动时**解析成类路径快照,之后新放进目录的 jar **连编译都看不见**——
|
|
156
|
+
不是「编译绿、运行时红」,而是编译直接报 `package … does not exist`。三份对照回执(同一分钟连跑):
|
|
157
|
+
|
|
158
|
+
| 组 | 状态 | 回执 |
|
|
159
|
+
|---|---|---|
|
|
160
|
+
| A | 新 jar 已放进 `extensions/common`,**未重启** | `success:false`,`package app.modules.r53probe does not exist` |
|
|
161
|
+
| B | 对照:启动时已在的 jar(`app.modules.mcc.*`) | `success:true` |
|
|
162
|
+
| C | 重启后,A 的同一份源码原样重编 | `success:true` |
|
|
163
|
+
|
|
164
|
+
所以**部署后必须重启;编译验证也要重启后才准**(拿 `programming.compile` 探测「jar 到没到位」
|
|
165
|
+
在未重启时会得到假阴性)。另注:`platformErrors` 的 lombok 噪音在同一进程内时有时无,
|
|
166
|
+
`platformCompilerDegraded` 只当噪音提示,不当环境判据。
|
|
167
|
+
|
|
139
168
|
## 1. 两种用法:单条 vs 工作区
|
|
140
169
|
|
|
141
170
|
### 单条(快速改一条规则)
|
|
@@ -289,7 +318,7 @@ public class <schema><rule>Handler extends BaseHandler {
|
|
|
289
318
|
`DefaultBusinessRuleType`:**Create / Update / Delete / Load / Cancel(流程作废)/
|
|
290
319
|
Available(流程生效)/ GetList** + 自定义。签名分两档:
|
|
291
320
|
|
|
292
|
-
| 规则 |
|
|
321
|
+
| 规则 | 覆写签名(`handle()` 已把 Request 存进 `protected Request request`) |
|
|
293
322
|
|---|---|
|
|
294
323
|
| Create | `protected BizObject create(BizObject)` |
|
|
295
324
|
| Update | `protected Object update(BizObject, BizObjectOptions)` |
|
|
@@ -298,6 +327,21 @@ Available(流程生效)/ GetList** + 自定义。签名分两档:
|
|
|
298
327
|
| GetList | `protected Page<Map<String,Object>> getList(BizObjectQueryObject)` |
|
|
299
328
|
| Cancel / Available | 空壳——直接覆写 `handle(Request)`,无固定签名 |
|
|
300
329
|
|
|
330
|
+
**覆写签名里怎么拿 OpenEngine**(真机 2026-11-11 实测,Create/Update 双证 `compile success`):
|
|
331
|
+
|
|
332
|
+
```java
|
|
333
|
+
// 覆写方法里没有 request 局部变量,但有父类字段 this.request
|
|
334
|
+
OpenEngine engine = this.getOpenEngine(this.request);
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
反编译依据:`CreateHandler`/`UpdateHandler` 等类都声明 `protected Request request;`
|
|
338
|
+
并在 `handle(Request)` 里赋值后再回调 `create()/update()`;`BaseHandler.getOpenEngine(Request)`
|
|
339
|
+
是**唯一**签名(`protected OpenEngine getOpenEngine(Request)`,内部已封装当前用户)。
|
|
340
|
+
|
|
341
|
+
这几个写法**都编不过**,别试:`this.getOpenEngine()`(缺参)、`this.getRequest()`
|
|
342
|
+
(无此方法)、`this.getUserId()`(在 Handler 上不存在,`getUserId()` 是 `OpenEngine` 的)。
|
|
343
|
+
Cancel / Available 覆写 `handle(Request)` 时,直接用入参即可:`this.getOpenEngine(request)`。
|
|
344
|
+
|
|
301
345
|
另有 `TIMING_TASK`(定时任务)规则载体与 `DECISION`(决策表)模式。照 `programming.get`
|
|
302
346
|
返回的模板写最稳。
|
|
303
347
|
|
|
@@ -323,7 +367,18 @@ owner/creater/modifier/部门/时间字段才从请求上下文回填(显式
|
|
|
323
367
|
`OpenEngineContext(currentUserId)` 再调模型/流程 API(引擎内部 20+ 处依赖 getUserId)。
|
|
324
368
|
- 规则间调用:`engine.executeCustomBizRule(schemaCode, bizRuleCode, request)`——可视化规则
|
|
325
369
|
第三参必须是 BizObject(否则 `PARAMETER_SHOULD_BE_BIZOBJECT_FOR_VISUAL`);编码规则不访问
|
|
326
|
-
入参时可传 null
|
|
370
|
+
入参时可传 null。
|
|
371
|
+
**返回值是 `List`(真机 2026-11-11,r53):编码模式 size=1,首元素才是对方 handle 返回的 Map。**
|
|
372
|
+
按 `instanceof Map` 判断不会报错——只会静默走防御分支,字段一直 null(容器日志才能看到
|
|
373
|
+
`actualType=java.util.ArrayList`)。取值写法:
|
|
374
|
+
```java
|
|
375
|
+
Object result = engine.executeCustomBizRule("schema", "rule", bizObject);
|
|
376
|
+
Map<String, Object> map = result instanceof Map
|
|
377
|
+
? (Map<String, Object>) result // 可视化形态兜底
|
|
378
|
+
: (result instanceof List && !((List<?>) result).isEmpty()
|
|
379
|
+
&& ((List<?>) result).get(0) instanceof Map
|
|
380
|
+
? (Map<String, Object>) ((List<?>) result).get(0) : null); // 编码形态取首元素
|
|
381
|
+
```
|
|
327
382
|
|
|
328
383
|
## 5.1 调用面:自定义规则怎么被外部调用(8.6.26 反编译 2026-11-10)
|
|
329
384
|
|
|
@@ -333,8 +388,22 @@ owner/creater/modifier/部门/时间字段才从请求上下文回填(显式
|
|
|
333
388
|
| 面 | 端点 | 身份 | 返回值形状 |
|
|
334
389
|
|---|---|---|---|
|
|
335
390
|
| 平台按钮 / CLI | `POST /api/api/launcher/domain_service_runtime/<schema>/<rule>`(`omc call rule.run` 即此面) | 会话 | 按钮语义 |
|
|
336
|
-
| 前端 / 站内 | `POST /api/v2/businessRule/invoke
|
|
337
|
-
| 第三方 | `POST /api/openapi/v3/bo/invokeBizRule`,body 带 `userId` | OAuth2 client_credentials
|
|
391
|
+
| 前端 / 站内 | `POST /api/api/v2/businessRule/invoke`(**双层 /api 前缀**,与按钮面一致),body `{appCode,schemaCode,businessRuleCode,data}`;**必带租户头 `X-LowCode-Corpid: <企业ID>`**(缺了 50000,容器日志 `corpId can not be blank`;头名多一个连字符都无效) | Bearer 用户会话 token(RequestContext,无 userId 参数) | **handle 返回值原样 = `ResponseResult.data`(全部键,无白名单)** |
|
|
392
|
+
| 第三方 | `POST /api/openapi/v3/bo/invokeBizRule`,body 带 `userId` | OAuth2 client_credentials(token 端点**按部署路由不同**,见下) | handle 返回值**包在 `returnObject` 里**(不是直接 data) |
|
|
393
|
+
|
|
394
|
+
**v3 的 token 端点三处口径不一,以真机为准(2026-11-11 实测 1.1.25)**:
|
|
395
|
+
|
|
396
|
+
| 来源 | 写的路径 | 实测 |
|
|
397
|
+
|---|---|---|
|
|
398
|
+
| 反编译注释(`RegisterModelSubscribeRequest` 的 ApiModelProperty) | `/api/oauth/token` | **404** |
|
|
399
|
+
| 本技能旧版本文案 | `/oauth/token` | **nginx 405**(根路径不代理) |
|
|
400
|
+
| **真机可用** | `POST /user/oauth/token` | **200**,回 `access_token`(JWT,3599s) |
|
|
401
|
+
|
|
402
|
+
原因:token 端点在 **user 服务**里,nginx 只把 `/user/` 前缀代理到它(`/api/` 去 launcher、
|
|
403
|
+
根路径是前端静态)。「端点在哪个前缀下」由部署的网关路由决定,**别按文档路径直接猜——
|
|
404
|
+
先看网关配置或逐前缀探测**。凭据:`base_security_client` 表的 `clientId/clientSecret`
|
|
405
|
+
(secret 存库带 `{noop}` 前缀,用前剥掉;grant_type 固定 `client_credentials`)。
|
|
406
|
+
客户端注册不在 OMC 能力面内(要平台侧/DB 办),CLI 办不了。
|
|
338
407
|
|
|
339
408
|
**两个易混点**:
|
|
340
409
|
- `omc call rule.run` 走的是**第一个面(平台按钮)**,它**不回 handle 的返回 Map**——回执里只有执行结果信封(`effectHint` 明说返回的是执行前快照)。要拿 handle 返回值必须走 v2/v3 的 invoke 端点。
|
|
@@ -377,4 +446,35 @@ mkdir -p "$LAUNCHER/inject_code_dir" && chown <容器用户uid>:<gid> "$LAUNCHER
|
|
|
377
446
|
| `programming.schemas` 空 | 平台只列**已有编码规则**的模型 | 用 `rule.list` 找规则,`adopt`/`get` 起模板 |
|
|
378
447
|
| `list_source_by_schemacode` 报源码不存在 | 任一规则缺草稿会整列失败 | 用 `programming.get` 逐条读(未落库回模板) |
|
|
379
448
|
| apply 报 `remote-ahead` | 别人改过远端草稿 | 先 `pull`,再改再 apply |
|
|
449
|
+
| publish 回执说 `runtimeEffective:"published"` 但紧接着执行仍跑旧逻辑 | **发布有刷新延迟**(真机实测 30–60s 或再打一次才切新版) | 验证前等一会儿或连打两次;别急着改本来正确的代码(r53 场景03 曾因此误判两次) |
|
|
450
|
+
| 规则跑了、字段却一直 null(无报错) | `executeCustomBizRule` 返回 `List` 不是 `Map`,`instanceof Map` 静默走防御分支 | 按上面「取首元素」写法取值;容器日志 `actualType=` 一眼定案 |
|
|
380
451
|
| 默认视图查不到字段值 | 列表视图未配置列(投影 null) | 用 `data.load` 读真值,或 `listview.configure` 配列 |
|
|
452
|
+
| 覆写 `create/update` 里报 `cannot find symbol`(`request`/`getRequest`/`getUserId`) | 覆写方法没有 `request` 局部变量;`getUserId` 在 `OpenEngine` 上不在 Handler 上 | 用 `this.getOpenEngine(this.request)`,见 §5「默认规则是七种」 |
|
|
453
|
+
| 机械扫描(checkstyle / cloudpivot-lint)报「无法识别 Java 版本 / 找不到 pom」 | 在线编码源码是平台库里的**一段字符串**,天生不属于任何 Maven 工程 | 扫描时显式指定 Java 8 目标(或把源码落到带 `maven.compiler.release=8` 的临时工程再扫),不要指望 `.omc-programming/` 下有 `pom.xml` |
|
|
454
|
+
| 日期差恒为正数(过期算成「还剩 41 天」) | hutool `DateUtil.betweenDay(begin, end, isAbs)` 的 `isAbs=false` **实际仍返回正数**,方向信息丢失 | 方向用 `DateUtil.compare(begin, end)` 判(>0 已过期),差值按比较结果取负;别信参数名直觉(r53 真机实测) |
|
|
455
|
+
|
|
456
|
+
## 8. 清理与回退(发布不可逆,验收看这三个面)
|
|
457
|
+
|
|
458
|
+
在线编码**没有「退回图形化规则」的端点**。`programming.publish` 的
|
|
459
|
+
`rollback.supported=false` 是这个意思:一旦某条规则被发布成编码模式,
|
|
460
|
+
**规则记录 + 源码就永久绑在一起**——平台的「删除规则」会连源码一起删,不是还原成图形化。
|
|
461
|
+
|
|
462
|
+
所以「清理干净」有三种成色,交付时要说清是哪一种:
|
|
463
|
+
|
|
464
|
+
| 成色 | 做法 | 残留 |
|
|
465
|
+
|---|---|---|
|
|
466
|
+
| **A. 清理到开工前** | 只删你新建的模型/字段/数据/自定义规则 | 无(`omc residue <前缀>` clean) |
|
|
467
|
+
| **B. 改写成 no-op**(动过默认规则时唯一可选) | 源码改成仅调用 `super.create/update/delete/load/getList` 再 publish | `developmentMode` 仍是 1、`programming.sources.count` 仍计入 |
|
|
468
|
+
| **C. 在平台界面手工处理** | 需人工在门户操作 | 需客户决定 |
|
|
469
|
+
|
|
470
|
+
**验收要读的面**(缺一即未收尾):
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
omc call rule.get --args '{"schemaCode":"<code>","ruleCode":"Create"}' # developmentMode(1=CODING) / enabled
|
|
474
|
+
omc call programming.sources --args '{"schemaCode":"<code>"}' # count>0 说明仍有编码规则挂着
|
|
475
|
+
omc residue <前缀> --env <env> # clean:true 才算 A
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
**发布前必须知道**:`programming.publish` 不可逆。真要动某条**正在生产使用的默认规则**,
|
|
479
|
+
先确认它当前是不是图形化模式(`developmentMode=0`),并把「发布后只能改写成 no-op」
|
|
480
|
+
这件事告知需求方——这不是可回滚的技术动作,是**一次性切换**。
|