@stalfh233/omc-cli 0.6.49 → 0.6.50
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 +1 -1
- package/dist/cli.js +73 -8
- package/dist/closest-match.js +22 -3
- package/dist/goal-plan.js +55 -3
- package/dist/goal-routes.js +59 -3
- package/dist/intent/capabilities/field.js +24 -0
- package/dist/intent/plan-apply.js +10 -3
- package/dist/intent/schema.js +24 -1
- package/dist/lanes/businessrule.js +9 -0
- package/dist/lanes/list-view-contract.js +1 -1
- package/dist/lanes/runtime-data.js +33 -1
- package/dist/recipes/workflow.js +1 -1
- package/dist/tool-types.js +6 -0
- package/package.json +3 -3
- package/skills/omc-capabilities.md +1 -0
- package/skills/omc-write-hazards.md +1 -1
|
@@ -259,7 +259,7 @@ export const CAPABILITY_SCENARIOS = Object.freeze({
|
|
|
259
259
|
*/
|
|
260
260
|
export const CAPABILITY_CUES = Object.freeze({
|
|
261
261
|
environment: ["环境", "指纹", "版本", "连接", "登录", "就绪", "发现"],
|
|
262
|
-
app: ["应用", "门户"
|
|
262
|
+
app: ["应用", "门户"],
|
|
263
263
|
dictionary: ["字典", "选项来源", "选项", "键值", "树型"],
|
|
264
264
|
model: ["模型", "对象", "主数据", "物理删除", "汇总表", "统计表", "汇总对象", "月度汇总表", "汇总模型"],
|
|
265
265
|
field: ["字段", "属性", "子表", "明细", "下拉", "单选", "多选", "附件", "人员", "部门", "日期", "数值", "文本", "关联", "公式", "计算", "计算字段", "求和", "汇总", "合计", "回主表", "超链接", "地址", "单据号", "流水号", "编号自动生成", "表单层", "必填", "只读", "条件必填", "恒必填", "条件只读", "恒只读", "表单必填", "表单只读"],
|
package/dist/cli.js
CHANGED
|
@@ -26,7 +26,7 @@ import { artifactFetchHint, artifactRoot, boundResult, emitInvalid, emitResult,
|
|
|
26
26
|
import { CLI_DEFAULT_OUTPUT_BYTES, assertSafeOutputPath, pruneArtifacts } from "./artifacts.js";
|
|
27
27
|
import { artifactPathMissHint, nullProjectionHint, partialPathMissHint, projectJsonPath, projectJsonPathFanout, projectResultExtract } from "./path-projection.js";
|
|
28
28
|
import { basename, join, resolve } from "node:path";
|
|
29
|
-
import { writeFileSync } from "node:fs";
|
|
29
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
30
30
|
import { buildToolRegistry } from "./tools.js";
|
|
31
31
|
import { acquireWriteLock, writeLockHeldFace } from "./write-lock.js";
|
|
32
32
|
import { cmdCompute } from "./compute.js";
|
|
@@ -1522,10 +1522,40 @@ function cmdNext(goal, transport) {
|
|
|
1522
1522
|
* every other shape stays one envelope.
|
|
1523
1523
|
*/
|
|
1524
1524
|
async function cmdPlan(goal, options, transport) {
|
|
1525
|
+
// r60c-F4(真机复现):`call`/`doctor` 都能从 .omc-env 自解环境,唯独 plan 缺
|
|
1526
|
+
// --env 直接报错——同项目内一次纯粹的错误往返。缺省时按**项目绑定面**解析
|
|
1527
|
+
// (OMC_ENV > cwd 的 .omc-env);刻意不落全局 default——plan 会解析平台 id,
|
|
1528
|
+
// 对错环境规划比多问一次 --env 更糟(沙盒纪律是 .omc-env 作用域)。
|
|
1529
|
+
let environmentSource;
|
|
1530
|
+
let environment;
|
|
1525
1531
|
if (options.env === undefined || options.env.trim() === "") {
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1532
|
+
const bound = process.env.OMC_ENV?.trim() || (() => {
|
|
1533
|
+
try {
|
|
1534
|
+
const path = defaultPaths().projectEnvPath;
|
|
1535
|
+
return existsSync(path) ? readFileSync(path, "utf8").trim() : "";
|
|
1536
|
+
}
|
|
1537
|
+
catch {
|
|
1538
|
+
return "";
|
|
1539
|
+
}
|
|
1540
|
+
})();
|
|
1541
|
+
if (!bound) {
|
|
1542
|
+
return emitInvalid(transport, {
|
|
1543
|
+
message: "`omc plan` 必须指定 --env <环境>:规划要读平台解析 schemaCode/字段 code,没有环境只能给路线(那正是 omc next)。本目录没有可用的 .omc-env/OMC_ENV 绑定(刻意不落全局 default——对错环境规划更糟)。离线形状用 --env <env> --offline(零 wire)",
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
environment = bound;
|
|
1547
|
+
environmentSource = process.env.OMC_ENV ? "OMC_ENV" : ".omc-env";
|
|
1548
|
+
// 与 call 同一道治理:显式名过 known/scope 校验(unknown environment 在这里
|
|
1549
|
+
// 就拒,而不是等探针阶段回 uncertain)。
|
|
1550
|
+
try {
|
|
1551
|
+
new ConfigStore(defaultPaths()).resolveEnvironment(bound);
|
|
1552
|
+
}
|
|
1553
|
+
catch (error) {
|
|
1554
|
+
return emitInvalid(transport, { message: error instanceof Error ? error.message : String(error) });
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
else {
|
|
1558
|
+
environment = options.env;
|
|
1529
1559
|
}
|
|
1530
1560
|
if (options.planOut !== undefined) {
|
|
1531
1561
|
try {
|
|
@@ -1535,7 +1565,6 @@ async function cmdPlan(goal, options, transport) {
|
|
|
1535
1565
|
return emitInvalid(transport, { message: error instanceof Error ? error.message : String(error) });
|
|
1536
1566
|
}
|
|
1537
1567
|
}
|
|
1538
|
-
const environment = options.env;
|
|
1539
1568
|
let target;
|
|
1540
1569
|
if (options.recipe !== undefined) {
|
|
1541
1570
|
const [toolName, recipeId, ...rest] = options.recipe.split("/");
|
|
@@ -1592,7 +1621,7 @@ async function cmdPlan(goal, options, transport) {
|
|
|
1592
1621
|
console.log(line);
|
|
1593
1622
|
return 0;
|
|
1594
1623
|
}
|
|
1595
|
-
return emitResult(plan, transport);
|
|
1624
|
+
return emitResult({ ...plan, ...(environmentSource !== undefined ? { environmentSource } : {}) }, transport);
|
|
1596
1625
|
}
|
|
1597
1626
|
/**
|
|
1598
1627
|
* Ticket 125 — `omc capabilities` / `omc capability <id>`: the Configuration
|
|
@@ -2305,6 +2334,8 @@ function joinSplitFlagValues(raw, flags) {
|
|
|
2305
2334
|
}
|
|
2306
2335
|
return out;
|
|
2307
2336
|
}
|
|
2337
|
+
/** r60b-F7:最近一次 commander 帮助输出(configureOutput 的写通道暂存)。 */
|
|
2338
|
+
let lastHelpChunk = "";
|
|
2308
2339
|
async function main() {
|
|
2309
2340
|
let commandExitCode = 0;
|
|
2310
2341
|
// stderr is the diagnostics stream: apply the same Windows code-page policy
|
|
@@ -2312,6 +2343,13 @@ async function main() {
|
|
|
2312
2343
|
installCodePageSafeStderr();
|
|
2313
2344
|
beginUsage(argv);
|
|
2314
2345
|
const command = new Command();
|
|
2346
|
+
// r60b-F7:helpDisplayed 不区分「根帮助」与「子命令帮助」——两者都走同一个
|
|
2347
|
+
// exitOverride 回调。暂存**累计**帮助输出(addHelpText 的 after 块晚于主帮助
|
|
2348
|
+
// 块单独写出,覆盖式暂存会把含 Usage 行的主块冲掉),用 Usage 行区分:
|
|
2349
|
+
// 子命令帮助的 Usage 是 `omc <子命令> …`,根帮助是 `omc [options] [command]`。
|
|
2350
|
+
const stashHelp = (text) => {
|
|
2351
|
+
lastHelpChunk = (lastHelpChunk + text).slice(-8000);
|
|
2352
|
+
};
|
|
2315
2353
|
const ownPackageVersion = () => {
|
|
2316
2354
|
try {
|
|
2317
2355
|
// ESM 下读自身包根的 package.json(安装形态与源码形态都成立)
|
|
@@ -2330,7 +2368,7 @@ async function main() {
|
|
|
2330
2368
|
return CLI_EXIT_CODES.invalidInput;
|
|
2331
2369
|
}
|
|
2332
2370
|
command.exitOverride();
|
|
2333
|
-
command.configureOutput({ writeOut: (text) => process.stderr.write(text), writeErr: (text) => process.stderr.write(text) });
|
|
2371
|
+
command.configureOutput({ writeOut: (text) => { stashHelp(text); process.stderr.write(text); }, writeErr: (text) => { stashHelp(text); process.stderr.write(text); } });
|
|
2334
2372
|
command.name("omc").showHelpAfterError().showSuggestionAfterError(true);
|
|
2335
2373
|
// --version 短路:commander 的 version 走 process.exit,会被 exitOverride 包成
|
|
2336
2374
|
// invalid-input 信封(exit 10);cpdocs --omc-global 的探测要干净的 exit 0。
|
|
@@ -2962,7 +3000,34 @@ main().then((code) => {
|
|
|
2962
3000
|
}, (error) => {
|
|
2963
3001
|
// commander prints `--help` / `-h` usage to stderr and signals success with
|
|
2964
3002
|
// this code; it is not an error and must not grow a spurious error envelope.
|
|
2965
|
-
|
|
3003
|
+
// `commander.help`(commander 14):showHelpAfterError 的错误上下文路径——
|
|
3004
|
+
// 未知命令 + `--help` 时 unknownCommand 错误被帮助输出替换成这个 code,
|
|
3005
|
+
// 原有 unknownCommand 分支因此永远接不到(r60b-F7 真机)。
|
|
3006
|
+
if (error instanceof CommanderError && (error.code === "commander.helpDisplayed" || error.code === "commander.help")) {
|
|
3007
|
+
// r60b-F7(真机复现):`omc configure_workflow --help` 里 commander 先短路
|
|
3008
|
+
// --help、后校验子命令,未知命令吃到了根帮助 + exit 0——探针一度以为
|
|
3009
|
+
// 命令存在只是参数没显示。根帮助(Usage: omc [options] [command])+ 非
|
|
3010
|
+
// help 的位置参数 = 未知命令;子命令帮助(Usage: omc <子命令>)正常 exit 0。
|
|
3011
|
+
const usageLine = (/^Usage:\s*omc[^\n]*/m.exec(lastHelpChunk) ?? [""])[0];
|
|
3012
|
+
const isRootHelp = /^Usage:\s*omc\s+\[options\]\s*\[command\]/.test(usageLine);
|
|
3013
|
+
const positional = argv.slice(2).filter((entry) => entry !== "--").find((entry) => !entry.startsWith("-"));
|
|
3014
|
+
if (isRootHelp && positional !== undefined && positional !== "help") {
|
|
3015
|
+
let isTool = false;
|
|
3016
|
+
try {
|
|
3017
|
+
isTool = buildToolRegistry().some((tool) => tool.name === positional);
|
|
3018
|
+
}
|
|
3019
|
+
catch {
|
|
3020
|
+
isTool = false;
|
|
3021
|
+
}
|
|
3022
|
+
const message = isTool
|
|
3023
|
+
? `未知顶层命令 "${positional}"——它是工具名不是 CLI 子命令:形状用 omc describe ${positional}(含可运行示例),执行用 omc call ${positional} --env <env> --args '<json>'(顶层命令见 omc help commands)`
|
|
3024
|
+
: `未知顶层命令 "${positional}"(顶层命令见 omc help commands;工具清单 omc commands;工具形状 omc describe <tool>)`;
|
|
3025
|
+
const parsed = errorEnvelope(new Error(message), "invalid-input", CLI_EXIT_CODES.invalidInput, request);
|
|
3026
|
+
writeEnvelope(parsed.envelope);
|
|
3027
|
+
completeUsage(parsed.exitCode);
|
|
3028
|
+
finish(parsed.exitCode);
|
|
3029
|
+
return;
|
|
3030
|
+
}
|
|
2966
3031
|
completeUsage(0);
|
|
2967
3032
|
finish(0);
|
|
2968
3033
|
return;
|
package/dist/closest-match.js
CHANGED
|
@@ -11,20 +11,39 @@ export function closestMatch(input, candidates) {
|
|
|
11
11
|
const wanted = input.toUpperCase().replace(/[\s_-]/g, "");
|
|
12
12
|
if (wanted.length < 2)
|
|
13
13
|
return undefined;
|
|
14
|
+
// r60c-F6(真机复现):`contract_amount` 拼错时建议了 `contract_name`(比例距离
|
|
15
|
+
// 达标)而真目标是 `amount`——它是输入的**尾部 token**,三个接受形都不认。
|
|
16
|
+
// 加第四形:分隔符 token 相等(≥4 字符)按强信号计(距离 0),并补后缀包含。
|
|
17
|
+
// r60c-F6(真机复现):`contract_amount` 拼错时建议了 `contract_name`(比例距离
|
|
18
|
+
// 达标)而真目标是 `amount`——它是输入的**尾部 token**,三个接受形都不认。
|
|
19
|
+
// 加 token 覆盖形:候选的 token 全部被输入 token 解释(amount ⊆ contract_amount)
|
|
20
|
+
// 按强信号计(距离 0)。**只对 ≥2 个 token 的输入启用**——TEXT/DATETIME 这类
|
|
21
|
+
// 单 token 短输入的歧义语义(故意不猜、DATETIME→DATE 而非 TIME)保持不变。
|
|
22
|
+
const inputTokens = input.toUpperCase().split(/[\s_-]+/u).filter((token) => token.length >= 4);
|
|
23
|
+
const wantedTokens = new Set(inputTokens);
|
|
24
|
+
const multiTokenInput = inputTokens.length >= 2;
|
|
14
25
|
let best;
|
|
15
26
|
for (const name of candidates) {
|
|
16
27
|
const candidate = name.toUpperCase().replace(/[\s_-]/g, "");
|
|
17
28
|
// 1. prefix containment (STAFF→STAFF_SELECTOR, DATETIME→DATE)
|
|
18
29
|
const contained = (candidate.startsWith(wanted) || wanted.startsWith(candidate)) && Math.min(wanted.length, candidate.length) >= 4;
|
|
30
|
+
// token 覆盖:候选的 token(≥4 字)全部出现在输入 token 里。部分命中
|
|
31
|
+
// (contract_name 只共享 CONTRACT)弱于全覆盖——平局会让先出现的候选赢。
|
|
32
|
+
const candidateTokens = name.toUpperCase().split(/[\s_-]+/u).filter((token) => token.length >= 4);
|
|
33
|
+
const matchedTokens = candidateTokens.filter((token) => wantedTokens.has(token));
|
|
34
|
+
const fullTokenCoverage = multiTokenInput && candidateTokens.length > 0 && matchedTokens.length === candidateTokens.length;
|
|
35
|
+
const partialTokenHit = multiTokenInput && matchedTokens.length > 0;
|
|
19
36
|
// 2. small edit distance (NUMERIC→NUMERICAL, SHORTTEXT→SHORT_TEXT)
|
|
20
37
|
const distance = editDistance(wanted, candidate);
|
|
21
38
|
const nearMiss = distance <= 2;
|
|
22
39
|
// 3. shared prefix + proportional distance (NUMBER→NUMERICAL, the live-measured case)
|
|
23
40
|
const sharedPrefix = commonPrefixLength(wanted, candidate);
|
|
24
41
|
const proportional = sharedPrefix >= 3 && wanted.length >= 5 && distance / Math.max(wanted.length, candidate.length) <= 0.58;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
42
|
+
// 全 token 覆盖 0 < 部分 token 2 < 常规距离。
|
|
43
|
+
const effectiveDistance = fullTokenCoverage ? 0 : partialTokenHit ? 2 : distance;
|
|
44
|
+
const accepted = contained || fullTokenCoverage || partialTokenHit || nearMiss || proportional;
|
|
45
|
+
if (accepted && (!best || effectiveDistance < best.distance))
|
|
46
|
+
best = { name, distance: effectiveDistance };
|
|
28
47
|
}
|
|
29
48
|
return best?.name;
|
|
30
49
|
}
|
package/dist/goal-plan.js
CHANGED
|
@@ -98,14 +98,19 @@ async function planReadAsk(registry, goal, environment, options, base, match, ca
|
|
|
98
98
|
// Query SEMANTICS: `data.list {schemaCode}` is schema-valid and would run, but it
|
|
99
99
|
// returns the whole table — not what 「金额大于一万」 asked for. `ready=true` must
|
|
100
100
|
// not overclaim, so a stated condition with no filter set is a missing input.
|
|
101
|
+
// r60c-F5:reason 回显**问句原文里的条件短语**(≤24 字窗口),不再硬编码
|
|
102
|
+
// 「金额大于一万」——问 10 万回一万,agent 只能再跑一次真调用验证语义。
|
|
101
103
|
const statesCondition = /大于|小于|等于|超过|低于|介于|不等|包含|开头|结尾|为空|不为空|等于|是\s|不是|>|<|>=|<=|=/.test(goal);
|
|
102
104
|
const hasFilterValue = ["filter", "filters", "filterGroup", "query", "rawCondition"].some((key) => args[key] !== undefined);
|
|
103
105
|
if (statesCondition && !hasFilterValue) {
|
|
104
106
|
const target = ["filter", "filters", "filterGroup"].find((key) => key in tool.inputSchema);
|
|
105
107
|
if (target !== undefined) {
|
|
108
|
+
const conditionWindow = goal.match(/[^;;,,。]{0,20}(大于|小于|等于|超过|低于|介于|不等|包含|为空|不为空|>|<|>=|<=|=)[^;;,,。]{0,12}/);
|
|
109
|
+
const conditionEcho = conditionWindow !== null ? conditionWindow[0].trim().replace(/\s*的.*$/u, "") : "问句里的筛选条件";
|
|
110
|
+
const rangeOp = /大于|超过|>|>=|低于|小于|</.test(conditionEcho);
|
|
106
111
|
missing[target] = {
|
|
107
|
-
reason:
|
|
108
|
-
source: `omc describe ${tool.name} --example ${tool.executionMetadata?.recipes[0]?.id ?? "<recipe>"}`,
|
|
112
|
+
reason: `问句里有筛选条件,但 filter DSL 需要把「${conditionEcho}」翻译成 {op,field,value}(${rangeOp ? "大于/超过→gt、大于等于→gte、低于/小于→lt" : "等值→eq、包含→like、为空→isnull"},op 全表:eq/neq/gt/lt/gte/lte/like/notlike/in/notin/between/notbetween/isnull/isnotnull);本计划不替你猜字段 code 与取值语义`,
|
|
113
|
+
source: `omc describe ${tool.name} --example ${rangeOp ? "list-filter-equality(等值示例;op 换成上面对应的比较符即可)" : tool.executionMetadata?.recipes[0]?.id ?? "<recipe>"}`,
|
|
109
114
|
};
|
|
110
115
|
}
|
|
111
116
|
}
|
|
@@ -199,6 +204,50 @@ function collectPlaceholders(value, path = "") {
|
|
|
199
204
|
walk(value, path);
|
|
200
205
|
return out;
|
|
201
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* r60b-F4/F5(真机复现):配方示例值不是 `<...>` 模板,collectPlaceholders 认不出,
|
|
209
|
+
* 于是以**具体值**混进 steps 且 validated.ok=true——「给模型 r60b_leave 配两级审批流」
|
|
210
|
+
* 的 plan 里 s1 get_draft 拿着占位 workflowCode "purchaseWorkflow"、s3 的
|
|
211
|
+
* schemaCode 是 "omc_recipe_model"、participant.corpId 写死 "other"(真实 corpId 是
|
|
212
|
+
* 租户 id,照抄会写进已发布流程且 get_published 肉眼难发现)。扫描已编译步骤,
|
|
213
|
+
* 命中残留的 step 标 needsSubstitution:true 并产 warnings;不拦截 ready(有些
|
|
214
|
+
* 残留对存量环境恰好成立),但绝不静默放行。
|
|
215
|
+
*/
|
|
216
|
+
const RECIPE_EXAMPLE_RESIDUE = Object.freeze([
|
|
217
|
+
{ pattern: /purchaseWorkflow/, note: "purchaseWorkflow 是配方示例流程 code,本环境需换成真实/新建的流程 code" },
|
|
218
|
+
{ pattern: /^SYS_1000000$/, note: "SYS_1000000 是配方示例角色 code,用 org.role.list 取真实角色" },
|
|
219
|
+
{ pattern: /"corpId"\s*:\s*"other"/, note: "participant.corpId 写死 \"other\"——真实 corpId 取自 org.role.list 回执(照抄会写入错误 corpId)" },
|
|
220
|
+
{ pattern: /<[a-zA-Z][^<>]{2,60}>/, note: "串内占位符 <…>(如 <roleId-from-org.role.list>)——执行前用真实值替换" },
|
|
221
|
+
{ pattern: /omc_recipe_/, note: "omc_recipe_* 是配方占位模型 code,需先建模型再替换" },
|
|
222
|
+
]);
|
|
223
|
+
function markRecipeResidue(steps) {
|
|
224
|
+
const warnings = [];
|
|
225
|
+
const marked = steps.map((step) => {
|
|
226
|
+
const hits = [];
|
|
227
|
+
const walk = (node, at) => {
|
|
228
|
+
if (typeof node === "string") {
|
|
229
|
+
for (const residue of RECIPE_EXAMPLE_RESIDUE)
|
|
230
|
+
if (residue.pattern.test(node))
|
|
231
|
+
hits.push(`${at || "(root)"}=${node.length > 40 ? `${node.slice(0, 40)}…` : node}(${residue.note})`);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (Array.isArray(node)) {
|
|
235
|
+
node.forEach((entry, index) => walk(entry, `${at}[${index}]`));
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (node !== null && typeof node === "object") {
|
|
239
|
+
for (const [key, entry] of Object.entries(node))
|
|
240
|
+
walk(entry, at === "" ? key : `${at}.${key}`);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
walk(step.args, "");
|
|
244
|
+
if (hits.length === 0)
|
|
245
|
+
return step;
|
|
246
|
+
warnings.push(`${step.id} ${step.tool} 含配方示例值残留(执行前必须替换):${hits.slice(0, 4).join(";")}${hits.length > 4 ? `;等 ${hits.length} 处` : ""}`);
|
|
247
|
+
return { ...step, needsSubstitution: true };
|
|
248
|
+
});
|
|
249
|
+
return [marked, warnings];
|
|
250
|
+
}
|
|
202
251
|
/**
|
|
203
252
|
* Type-appropriate sample for a placeholder, used ONLY to run the local schema
|
|
204
253
|
* gate: the plan must prove the shape is otherwise valid, without pretending the
|
|
@@ -1066,6 +1115,9 @@ export async function planGoal(registry, goal, options = {}) {
|
|
|
1066
1115
|
};
|
|
1067
1116
|
}
|
|
1068
1117
|
const steps = attachCaptures(sorted.ordered);
|
|
1118
|
+
// r60b-F4/F5:配方示例值残留标认(详见 PlanStep.needsSubstitution 注释)。
|
|
1119
|
+
const [markedSteps, residueWarnings] = markRecipeResidue(steps);
|
|
1120
|
+
warnings.push(...residueWarnings);
|
|
1069
1121
|
const ready = !uncertain
|
|
1070
1122
|
&& Object.keys(missing).length === 0
|
|
1071
1123
|
&& Object.keys(unverified).length === 0
|
|
@@ -1095,7 +1147,7 @@ export async function planGoal(registry, goal, options = {}) {
|
|
|
1095
1147
|
...(capability !== undefined ? { capability } : {}),
|
|
1096
1148
|
...(lane !== undefined ? { lane } : {}),
|
|
1097
1149
|
...(intentAlternative !== undefined ? { intentAlternative } : {}),
|
|
1098
|
-
steps,
|
|
1150
|
+
steps: markedSteps,
|
|
1099
1151
|
missing,
|
|
1100
1152
|
unverified,
|
|
1101
1153
|
warnings,
|
package/dist/goal-routes.js
CHANGED
|
@@ -12,7 +12,7 @@ import { listSkills, readSkillSection } from "./skills.js";
|
|
|
12
12
|
*/
|
|
13
13
|
const SCOUT_CUES = ["能不能", "能不能够", "能否", "是否支持", "支持吗", "支持不支持", "可不可以", "有没有办法", "有没有可能", "怎么实现", "如何实现", "怎么写", "怎么配置"];
|
|
14
14
|
const MODIFY_CUES = ["修改", "调整", "更新", "重命名", "改名", "编辑", "删除", "去掉", "移除", "改为", "改成"];
|
|
15
|
-
const READ_CUES = ["查看", "读回", "盘点", "现状", "列出", "有哪些", "有没有", "检查", "审计", "导出", "只读", "看看", "看下", "查一下", "查询一下", "查一查", "梳理", "清点", "给我一份", "哪些", "是什么", "是否", "是否正确", "现有", "已有"];
|
|
15
|
+
const READ_CUES = ["查看", "读回", "盘点", "现状", "列出", "有哪些", "有没有", "检查", "审计", "导出", "只读", "看看", "看下", "查一下", "查询一下", "查一查", "梳理", "清点", "给我一份", "哪些", "是什么", "是否", "是否正确", "现有", "已有", "条数", "多少条", "数一下"];
|
|
16
16
|
const BUILD_CUES = ["新建", "创建", "搭建", "从零", "从无到有", "做", "建", "加", "实现", "生成", "新增", "保存", "启用", "录入", "添加", "造", "填报", "打卡", "录"];
|
|
17
17
|
/** Whole-application asks — a single-model atom is the wrong shape for these. */
|
|
18
18
|
const WHOLE_APP_CUES = ["应用", "系统", "整套", "从零", "从无到有", "端到端", "一条龙", "一整套", "业务应用", "平台"];
|
|
@@ -744,6 +744,42 @@ function goalRouteInner(registry, goal) {
|
|
|
744
744
|
const availableTopics = new Set(listSkills().map((topic) => topic.name));
|
|
745
745
|
const mode = detectMode(goal);
|
|
746
746
|
const readish = mode === "read" || mode === "scout";
|
|
747
|
+
// r60c-F8(真机复现):「按状态分组统计单据条数」被 cue「分组」误路由到 app
|
|
748
|
+
// 写面(app.create/update/delete,write:true)——纯读问句拿到写工具是危险误路由。
|
|
749
|
+
// 聚合/计数问句的正确答案:data 能力**没有 group-by 工具**,诚实指路
|
|
750
|
+
// data.list 拉全量 + `--jq` 投影自行计数;跨模型/大结果集才涉及报表章节。
|
|
751
|
+
// 放在能力打分前,聚合词不再落进任何写阶梯(cue「分组」已从 app 移除)。
|
|
752
|
+
if (readish && /(统计|分组|汇总|聚合|计数|条数|多少条|数一下)/.test(goal) && !WRITE_DESTINATION.test(goal)) {
|
|
753
|
+
const dataRoute = routeById.get("data");
|
|
754
|
+
if (dataRoute !== undefined) {
|
|
755
|
+
const readTools = readToolsInLane(registry, dataRoute.lane);
|
|
756
|
+
const action = readTools.includes("data.list") ? "omc call data.list --args '{\"schemaCode\":\"<模型code>\",\"size\":200}' --jq '.result.items[]'" : "omc commands --capability data";
|
|
757
|
+
return {
|
|
758
|
+
status: "ok",
|
|
759
|
+
goal,
|
|
760
|
+
confident: true,
|
|
761
|
+
mode: "read",
|
|
762
|
+
write: false,
|
|
763
|
+
match: { kind: "capability", ref: "data", title: "运行数据(聚合/计数读路径)", capabilities: ["data"] },
|
|
764
|
+
route: {
|
|
765
|
+
capability: "data",
|
|
766
|
+
lane: dataRoute.lane,
|
|
767
|
+
note: "平台没有 group-by/聚合工具:小结果集用 data.list 拉全量(filter 收窄 + --jq 投影取分组列)后自行计数;跨模型汇总/定时聚合才涉及 report 章节或字段计算(datarule type2)。本路由只读。",
|
|
768
|
+
readTools,
|
|
769
|
+
readiness: DISCOVERY_AUTHORITY.readiness,
|
|
770
|
+
firstCommands: [action],
|
|
771
|
+
write: false,
|
|
772
|
+
readback: true,
|
|
773
|
+
},
|
|
774
|
+
firstAnswer: {
|
|
775
|
+
state: "needs-input",
|
|
776
|
+
question: "要统计哪个模型(schemaCode 或业务名)?按哪个字段分组?",
|
|
777
|
+
action,
|
|
778
|
+
why: "聚合/计数是纯读问句:data 能力无 group-by 工具,data.list 拉全量 + --jq 投影后本地计数是正路(大结果集见 report 章节)",
|
|
779
|
+
},
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
}
|
|
747
783
|
// Known absence only: field-families exposes list/create/update/publish/delete,
|
|
748
784
|
// with no unpublish endpoint or update status bit (local 1.1.25 probe, 2026-11-11).
|
|
749
785
|
// Do not infer other absences from tool names: rollback is a top-level command,
|
|
@@ -832,7 +868,20 @@ function goalRouteInner(registry, goal) {
|
|
|
832
868
|
// 触发词面:条件必填/必填条件/条件显隐/显示条件/隐藏条件/条件只读/只读条件 +
|
|
833
869
|
// 配置/设置/改成/修改/加上 等写动词,或直接点名 requiredFormula/displayFormula/
|
|
834
870
|
// readonlyCondition。不提「子表/控件」(那是上一条表单 attributes 的专项路由)。
|
|
871
|
+
// r60a-F1/F2(真机复现):这些 modify 专项路由此前会劫持**整包 build** 问句——
|
|
872
|
+
// 「建模型 …detail 子表(item/qty/price);…列表视图显示…;建字段级规则…」里
|
|
873
|
+
// 「子表…显示…规则」跨三个子句被 /子表.*显示.*规则/ 串成一次命中,整包需求
|
|
874
|
+
// 被当成「改已有表单控件」路由(steps:[],还要一个不存在的 schemaCode)。
|
|
875
|
+
// 护栏一:绿地/整包 build 问句(建模型/新建应用/从零…)不进 modify 专项。
|
|
876
|
+
// 护栏二:关键词必须**同子句**出现(子句内无分隔符、跨度 ≤30 字),
|
|
877
|
+
// 不允许跨「;/,/。」把不同需求缝到一起。
|
|
878
|
+
const greenfieldBuildAsk = /建模型|新建模型|创建模型|搭建|从零|从无到有|一条龙|端到端/.test(goal);
|
|
879
|
+
const clauseLocal = (pattern) => {
|
|
880
|
+
const source = pattern.replace(/\.\*/g, "[^;;,,。]{0,30}");
|
|
881
|
+
return new RegExp(source);
|
|
882
|
+
};
|
|
835
883
|
if (!/子表/.test(goal)
|
|
884
|
+
&& !greenfieldBuildAsk
|
|
836
885
|
&& !/查看|有哪些|是什么|怎么|列出|看看|查询|检查|确认/.test(goal)
|
|
837
886
|
&& (/条件必填|必填条件|条件显隐|显隐条件|显示条件|条件显示|隐藏条件|条件隐藏|条件只读|只读条件|requiredFormula|displayFormula|readonlyCondition/.test(goal))
|
|
838
887
|
&& /配置|设置|改成|修改|加上|加一个|做个|做一|变必填|控制|当.*时/.test(goal)) {
|
|
@@ -863,7 +912,7 @@ function goalRouteInner(registry, goal) {
|
|
|
863
912
|
},
|
|
864
913
|
};
|
|
865
914
|
}
|
|
866
|
-
if (/子表|控件/.test(goal) &&
|
|
915
|
+
if (!greenfieldBuildAsk && /子表|控件/.test(goal) && (clauseLocal("子表.*(显示|隐藏|只读|显隐).*(条件|公式|规则)").test(goal) || /displayFormula|readonlyFormula/.test(goal))) {
|
|
867
916
|
return {
|
|
868
917
|
status: "ok",
|
|
869
918
|
goal,
|
|
@@ -893,7 +942,14 @@ function goalRouteInner(registry, goal) {
|
|
|
893
942
|
// r28c F2: authored recipe aliases beat composers. A short goal like
|
|
894
943
|
// "按比例赋值" has no capability cue and would otherwise fall through;
|
|
895
944
|
// "条件成立时按公式赋值" would be stolen by the rule-when composer.
|
|
896
|
-
|
|
945
|
+
// "按比例赋值" has no capability cue and would otherwise fall through;
|
|
946
|
+
// "条件成立时按公式赋值" would be stolen by the rule-when composer.
|
|
947
|
+
// r31c-F27 回归护栏(r60 P1-11 引入):**显式整包措辞**(从零/一条龙/一整套…)
|
|
948
|
+
// 的问句不能被单配方别名抢走——一条配方代表不了其余能力面。只看
|
|
949
|
+
// WHOLE_APP_CUES 而不用「≥4 能力面」:单配方措辞(「配一条 Create 规则:
|
|
950
|
+
// 调服务按客户名查信用回写」)天然扫过 模型/规则/服务 多个能力面,按面数拦
|
|
951
|
+
// 会把真别名路由也拦掉(bizservice-recipes 别名测试实证)。
|
|
952
|
+
if (!readish && !WHOLE_APP_CUES.some((cue) => goal.includes(cue))) {
|
|
897
953
|
const aliasHit = bestAliasRecipe(registry, goal);
|
|
898
954
|
if (aliasHit) {
|
|
899
955
|
const action = `omc describe ${aliasHit.tool} --example ${aliasHit.recipe}`;
|
|
@@ -74,6 +74,12 @@ function expectedFieldOptions(schemaCode, field) {
|
|
|
74
74
|
* (observed 2026-09-27: `field.list` briefly reported options:null for a row
|
|
75
75
|
* that had them, and the final readback called the intent equivalent) is
|
|
76
76
|
* reported as converged — the agent then discovers it at runtime instead.
|
|
77
|
+
*
|
|
78
|
+
* r60a-F8 guard: the expected side is what the WRITE SEAM would send. When a
|
|
79
|
+
* declared key is absent from that projection (seam drops it — e.g. the
|
|
80
|
+
* CHILD_TABLE parent row carries no options at all) the old null==null
|
|
81
|
+
* comparison called the intent equivalent while nothing landed. Such keys now
|
|
82
|
+
* emit `field-option-unwritable` instead of comparing two nulls.
|
|
77
83
|
*/
|
|
78
84
|
function compareFieldOptions(schemaCode, field, live, emit) {
|
|
79
85
|
const keys = declaredOptionKeys(field);
|
|
@@ -82,6 +88,13 @@ function compareFieldOptions(schemaCode, field, live, emit) {
|
|
|
82
88
|
const resource = `field:${schemaCode}.${field.code}`;
|
|
83
89
|
const expected = expectedFieldOptions(schemaCode, field);
|
|
84
90
|
const liveOptions = (live.options ?? {});
|
|
91
|
+
// r60a-F8 防假等价:声明的 options 键若写入缝根本不会发送(expected 缺该键,
|
|
92
|
+
// 或整形状被写缝拒绝 → expected undefined),「声明了但没落地」不能判等价——
|
|
93
|
+
// 此前 expected/live 双 null 相等,把静默丢键当成了已达标。
|
|
94
|
+
if (expected === undefined) {
|
|
95
|
+
emit.difference("field-option-unwritable", resource, `字段 ${resource} 声明了 options(${keys.join("、")}),但写入缝拒绝该形状(族形状校验未过)——声明不会落地,readback 不判等价`);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
85
98
|
for (const key of keys) {
|
|
86
99
|
if (key === "optionsSet") {
|
|
87
100
|
const customCodes = (value) => {
|
|
@@ -94,6 +107,10 @@ function compareFieldOptions(schemaCode, field, live, emit) {
|
|
|
94
107
|
emit.difference("field-options-mismatch", resource, `字段 ${resource} 的 choices 与 live 不一致(live=${canonicalJson(got)} intent=${canonicalJson(want)})`);
|
|
95
108
|
continue;
|
|
96
109
|
}
|
|
110
|
+
if (!(key in expected)) {
|
|
111
|
+
emit.difference("field-option-unwritable", resource, `字段 ${resource} 声明了 options.${key},但写入缝不会发送该键(子表父行/族形状不接受)——声明不会落地;门户条件走表单面(form.draft 改控件 attributes 后 form.publish)`);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
97
114
|
if (canonicalJson(expected?.[key] ?? null) !== canonicalJson(liveOptions[key] ?? null))
|
|
98
115
|
emit.difference("field-options-mismatch", resource, `字段 ${resource} 的 options.${key} 与 live 不一致(live=${canonicalJson(liveOptions[key] ?? null)} intent=${canonicalJson(expected?.[key] ?? null)})`);
|
|
99
116
|
}
|
|
@@ -365,6 +382,13 @@ export const fieldCapability = {
|
|
|
365
382
|
if (relationField && relativeValue === undefined && !(optionsNode?.kind === "map" && toPlain(optionsNode).relativeCode !== undefined))
|
|
366
383
|
pushError(ctx, "intent-field-relativecode-required", `关联字段(${fieldType})必须给 relativeCode(目标模型 code);可写在字段顶层或 options.relativeCode`, `${fieldBase}.relativeCode`, "value");
|
|
367
384
|
const explicitOptions = optionsNode?.kind === "map" ? toPlain(optionsNode) : {};
|
|
385
|
+
// r60a-F8(真机实测):CHILD_TABLE 父行的 options 在写入缝被整体丢弃
|
|
386
|
+
// (prepareFieldChange 子表分支返回 options:{},wire body 不带 options 键),
|
|
387
|
+
// 而 readback 的 expected 同样为空 → null==null 假等价。离线拒绝,
|
|
388
|
+
// 并把真正可行的通道(表单 attributes 面)写进消息。
|
|
389
|
+
if (fieldType === "CHILD_TABLE" && Object.keys(explicitOptions).length > 0) {
|
|
390
|
+
pushError(ctx, "intent-field-option-unsupported", `子表字段(CHILD_TABLE)父行不接受 options(声明了 ${Object.keys(explicitOptions).join("、")})——平台建列时整体丢弃,且 readback 判等会漏检(r60a-F8)。门户条件(requiredFormula/readonlyFormula/displayFormula)走表单面:form.get --controls 读 draftAttributesJson 定位控件 → form.draft 改该控件 → form.publish;子表**列级** options 写在各子列的 options`, `${fieldBase}.options`, "value");
|
|
391
|
+
}
|
|
368
392
|
// A choice family's allowed values live in TOP-LEVEL `choices` (the
|
|
369
393
|
// compiler synthesizes the platform's optionsSet). Callers habitually
|
|
370
394
|
// try `options.items` / `options.choices`, which the option passthrough
|
|
@@ -43,16 +43,23 @@ export function intentWarnings(intent) {
|
|
|
43
43
|
// control had no requiredFormula; the live portal did not require it). The
|
|
44
44
|
// portal-facing condition must be declared in `fields[].options`.
|
|
45
45
|
for (const datarule of model.datarules ?? []) {
|
|
46
|
-
|
|
46
|
+
const field = model.fields.find((candidate) => candidate.code === datarule.propertyCode);
|
|
47
|
+
if ([3, 4, 5].includes(datarule.dataRuleType)) {
|
|
48
|
+
// r60a-F11(真机复现):propertyCode 是 CHILD_TABLE 父字段时,下面那句
|
|
49
|
+
// 「写到 fields[].options」是死路——子表父行不接受 options(写入缝整体
|
|
50
|
+
// 丢弃,readback 还会假等价,r60a-F8)。按字段类型分叉给真通道。
|
|
51
|
+
const childTableTarget = field?.type === "CHILD_TABLE";
|
|
47
52
|
warnings.push({
|
|
48
53
|
resource: `datarule:${model.code}.${datarule.propertyCode}`,
|
|
49
54
|
code: "datarule-not-portal-facing",
|
|
50
|
-
message:
|
|
55
|
+
message: childTableTarget
|
|
56
|
+
? `字段级数据规则 type ${datarule.dataRuleType}(${datarule.dataRuleType === 4 ? "条件必填" : datarule.dataRuleType === 5 ? "条件只读" : "文本拼接"})不驱动门户表单控件;且 ${datarule.propertyCode} 是子表(CHILD_TABLE)父字段——fields[].options 对子表父行**不生效**(写入缝丢弃,真机 r60a-F8)。门户条件走表单 attributes 面:form.get --controls 读 draftAttributesJson 定位控件 → form.draft 改该控件的 requiredFormula/readonlyFormula/displayFormula → form.publish。`
|
|
57
|
+
: `字段级数据规则 type ${datarule.dataRuleType}(${datarule.dataRuleType === 4 ? "条件必填" : datarule.dataRuleType === 5 ? "条件只读" : "文本拼接"})不驱动门户表单控件:平台把它存成 bizdatarule、只镜像进控件 historyOpt,而运行时门户读控件 options(真机复核:规则已存但发布控件无该字段、门户不拦)。要让门户生效,把条件写到字段的 options 里(fields[].options.requiredFormula / readonlyCondition / shortTextStitch)——这条路径已真机验证可穿透到发布控件;datarule 只留给服务端字段级引擎(校验/计算)。`,
|
|
51
58
|
});
|
|
59
|
+
}
|
|
52
60
|
// Dual-write advisory (dogfood R1): when the SAME field already declares
|
|
53
61
|
// the portal-facing condition in `fields[].options`, the datarule row is
|
|
54
62
|
// redundant. Surface it rather than silently writing both.
|
|
55
|
-
const field = model.fields.find((candidate) => candidate.code === datarule.propertyCode);
|
|
56
63
|
const fieldOptions = field?.options ?? {};
|
|
57
64
|
const duplicateKey = datarule.dataRuleType === 4 ? "requiredFormula" : datarule.dataRuleType === 5 ? "readonlyCondition" : undefined;
|
|
58
65
|
if (duplicateKey !== undefined && fieldOptions[duplicateKey] !== undefined)
|
package/dist/intent/schema.js
CHANGED
|
@@ -64,6 +64,29 @@ export const RUNNABLE_EXAMPLES = Object.freeze([
|
|
|
64
64
|
"",
|
|
65
65
|
].join("\n"),
|
|
66
66
|
},
|
|
67
|
+
{
|
|
68
|
+
id: "child-table-subfields",
|
|
69
|
+
title: "子表 CHILD_TABLE(subFields 声明子列;父字段不接受 options——r60a-F8 真机,控件条件走 form.draft)",
|
|
70
|
+
yaml: [
|
|
71
|
+
"intentVersion: 1",
|
|
72
|
+
"models:",
|
|
73
|
+
" - code: exClaim",
|
|
74
|
+
" name: 报销单",
|
|
75
|
+
" fields:",
|
|
76
|
+
" - { code: claimNo, name: 单号, type: SHORT_TEXT }",
|
|
77
|
+
" - { code: amount, name: 金额, type: NUMERICAL, options: { scale: 2 } }",
|
|
78
|
+
" - code: detail # 子表父字段:只声明 code/name/type/subFields",
|
|
79
|
+
" name: 明细",
|
|
80
|
+
" type: CHILD_TABLE",
|
|
81
|
+
" subFields:",
|
|
82
|
+
" - { code: item, name: 项目, type: SHORT_TEXT }",
|
|
83
|
+
" - { code: qty, name: 数量, type: NUMERICAL, options: { scale: 0 } }",
|
|
84
|
+
" - { code: price, name: 单价, type: NUMERICAL, options: { scale: 2 } }",
|
|
85
|
+
" form: { publish: true }",
|
|
86
|
+
" listview: { fieldCodes: [claimNo, amount] } # 子表列不进列表视图",
|
|
87
|
+
"",
|
|
88
|
+
].join("\n"),
|
|
89
|
+
},
|
|
67
90
|
{
|
|
68
91
|
id: "rule-actions-when-filter",
|
|
69
92
|
title: "规则紧凑 actions:一条规则可挂多个异构 action;when=执行门(满足才执行,只支持字面量比较),filter=定位要改的行(省略则默认当前行 id=id),跨模型回写用 filter from",
|
|
@@ -120,7 +143,7 @@ export function intentSchemaBlock() {
|
|
|
120
143
|
"choices 只用于选择族 RADIO / CHECKBOX / DROPDOWN_BOX / DROPDOWN_MULTI_BOX(顶层 choices,不是 options.items/choices)",
|
|
121
144
|
"WORK_SHEET / MULT_WORK_SHEET 用顶层 relativeCode=<目标模型 code>;显示列用 options.displayField",
|
|
122
145
|
"CHILD_TABLE 用 subFields[{code,name,type[,choices]}]; 子列族仅标量",
|
|
123
|
-
"门户层条件(必填/只读/显示)写在 options:options.requiredFormula / readonlyFormula / readonlyCondition / displayFormula",
|
|
146
|
+
"门户层条件(必填/只读/显示)写在 options:options.requiredFormula / readonlyFormula / readonlyCondition / displayFormula;**子表(CHILD_TABLE)父字段例外**——不接受 options(写入缝丢弃,r60a-F8 真机),子表控件的条件走 form.get --controls → form.draft → form.publish",
|
|
124
147
|
],
|
|
125
148
|
},
|
|
126
149
|
form: { required: ["publish"], optional: ["fieldCodes"] },
|
|
@@ -162,6 +162,15 @@ export function registerBusinessRuleLane(tools) {
|
|
|
162
162
|
statusNote: "本面 status 是 PUBLISH 投影列,与 rule.get 的 ruleStatus 可不同;运行时是否生效以 rule.get/enable 为准",
|
|
163
163
|
}),
|
|
164
164
|
...(args.onlyCustom === true ? { filtered: { onlyCustom: true, total: rows.length, returned: visible.length } } : {}),
|
|
165
|
+
// r60c-F7(真机复现):默认面把 7 条平台预置触发行一起返回——任何模型都
|
|
166
|
+
// 「有规则」,「哪些模型配了业务规则」会误判成全都有。默认面带上
|
|
167
|
+
// customCount + 一句判定口径;判定自建规则直接 onlyCustom:true。
|
|
168
|
+
...(args.onlyCustom !== true
|
|
169
|
+
? {
|
|
170
|
+
customCount: rows.filter((row) => row.defaultRule !== true).length,
|
|
171
|
+
presetHint: "默认含平台预置触发行(preset:true,如 Available/Cancel/Create/Delete/GetList/Load/Update);判定「有没有人写过规则」看 customCount(=0 即全是预置),或直接 onlyCustom:true",
|
|
172
|
+
}
|
|
173
|
+
: {}),
|
|
165
174
|
...(endpointFamily ? { endpointFamily } : {}),
|
|
166
175
|
rules: visible.map((row) => ({
|
|
167
176
|
code: row.code,
|
|
@@ -126,7 +126,7 @@ export const LIST_VIEW_LANE_CONTRACT = Object.freeze({
|
|
|
126
126
|
}),
|
|
127
127
|
"listview.configure": Object.freeze({
|
|
128
128
|
scope: LIST_VIEW_SCOPE,
|
|
129
|
-
description: "(**列汇总**:数值列 `sumType` wire 为整数——0=不统计/1=求和/2=平均/3=最小/4=最大/5=计数,写进 presentation.columnsJson 的列对象,8.6.26 反编译 SumType
|
|
129
|
+
description: "(**列汇总**:数值列 `sumType` wire 为整数——0=不统计/1=求和/2=平均/3=最小/4=最大/5=计数,写进 presentation.columnsJson 的列对象,8.6.26 反编译 SumType 实证)配置列表视图。**code 语义(与配方 configure-default-list 同口径,r60a-F13 真机对齐 2026-11-13)**:省略 `code`(或 code=schemaCode)= 配置**默认视图**——默认视图在 model.create 时由平台自动生成、是正规的配置对象,日常配列/排序就用它,**不要先 listview.create**(那会多出一个自定义视图);`listview.create` 只在确实需要**第二个**视图时使用,此时 listview.configure 带 code 指向它。在既有(默认)列表视图上配置列、排序、查询条件、行/列表按钮、呈现、自定义按钮、视图头扩展选项与视图类型:读回 query,按 `fieldCodes` 追加缺失列或**原地修正**已存在列的 name/propertyType/displayFormat/visible(不再跳过既有列),置为可见;数值列 displayFormat 由字段 0 基 `options.scale` 推导(0=整数,1=1位,2=2位,3=3位…8=8位;实测 scale 2 → displayFormat 3 = 两位小数)、日期列由 `options.format` 推导(1/2/3/4),回显 `columns` 为完整列对象并给出 `added`/`updated`;`sorts`→querySorts(direction ASC/DESC)、`conditions`→queryConditions(**比较符是 `filterType`(QueryFilterType 字符串枚举 Eq/NotEq/…;别名 operator/op;省略时按 propertyType 取平台默认)**、displayType/choiceType/options 字符串解码;写后条件回读等价校验给出 conditionReadback)、`actions`→queryActions(queryActionType QUERY(1)…BATCH_SUBMIT(23)、associationType BIZSHEET(0)/WORKFLOW(1))、`presentation`→queryPresentation(htmlJson/actionsJson/columnsJson/queryViewDataSource/schemaRelations/options 均为 JSON 字符串,合法 JSON 读回解码)、`buttons`→customButtons(写面 customButtonJson JSON 数组字符串;bindAction/useLocation/operateType/showPermType 以枚举名发送;triggerType 强制 QUERY、triggerCode=视图 code、sortKey 按数组位,缺省回传读面 customButtons 有效集;ADD_DATA/FORM 目标绑定走 actionConfig——schemaCodeVal+formListData+configureList,targetCode/targetObjCode 对其无效会被拒;高层参数 targetModel/targetForm/configureList 从读回元数据展开,未解析即 listview-button-target-unresolved 零副作用拒)、`options`→视图头 BizQueryOption(`pagingSetting`{pageSize,showTotal} 分页、`listViewModeSetting`{mode,canSwitch} 列表模式,缺省回传读面有效 options、提供时整体替换,rowColorSetting 无 8.6.26 类证据故对象形态拒绝)与 `presentationType`→QueryPresentationType(LIST/BOARD/CALENDAR/GANTT,缺省回传读面有效值;GANTT 必须同时提供 `gantt`→queryGanttModel 且 startTimePropertyCode/endTimePropertyCode/titlePropertyCode 非空,缺省不触碰既有 gantt)与 `queryLayer`→层级展示(BizQueryLayer[] 数组原样发送)及 `multiTableHeaderConfig`→多级表头(HeaderConfig[] JSON 字符串;缺省回传读面有效值、提供时整体替换)省略时不触碰既有值,提供时整体替换并经出门前 dry-lint;`query/update` 后回读(`query/get` 自动注入的默认动作、平台 sortKey 重排与 schemaRelations 派生需还原)。`code` 省略时用默认视图(=schemaCode)。`queryConditionMap` 为只读派生(query/get 带 formCode 子表条件时才出现),非配置输入。**发布语义**:`query/update` 自动置 publish=TRUE——视图无草稿/发布两态、无需独立发布步骤(与表单/规则的 draft→publish 不同)。**依赖顺序**:视图与表单脚手架都依赖**已发布字段**,规范顺序 model.create → field.create → field.publish(模型级)→ form.draft → form.publish →(需要第二视图时 listview.create)→ listview.configure → rule.save → rule.enable → workflow。",
|
|
130
130
|
}),
|
|
131
131
|
"listview.delete": Object.freeze({
|
|
132
132
|
scope: LIST_VIEW_SCOPE,
|
|
@@ -1188,8 +1188,40 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1188
1188
|
const catalog = await publishedFields();
|
|
1189
1189
|
const codes = catalog.map((row) => row.code);
|
|
1190
1190
|
const sample = catalog.slice(0, FILTER_FIELD_SAMPLE_LIMIT);
|
|
1191
|
+
// r60c-F6(真机复现):`contract_amount` 拼错 + `gt` 过滤时建议了
|
|
1192
|
+
// `contract_name`(SHORT_TEXT)——名字最像,类型全错,照抄得到类型错
|
|
1193
|
+
// 或空结果。didYouMean 按「名字相似 × 类型匹配」重排:数值比较族
|
|
1194
|
+
// op(gt/lt/gte/lte/between)优先推 NUMERICAL/DATE 字段。
|
|
1195
|
+
const opByField = new Map();
|
|
1196
|
+
const walkLeaves = (node) => {
|
|
1197
|
+
if (Array.isArray(node)) {
|
|
1198
|
+
node.forEach(walkLeaves);
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
if (node === null || typeof node !== "object")
|
|
1202
|
+
return;
|
|
1203
|
+
const leaf = node;
|
|
1204
|
+
if (typeof leaf.field === "string" && leaf.field && typeof leaf.op === "string")
|
|
1205
|
+
opByField.set(leaf.field, String(leaf.op).toLowerCase());
|
|
1206
|
+
Object.values(leaf).forEach(walkLeaves);
|
|
1207
|
+
};
|
|
1208
|
+
walkLeaves(condition);
|
|
1209
|
+
const NUMERIC_OPS = new Set(["gt", "lt", "gte", "lte", "between", "notbetween"]);
|
|
1210
|
+
const NUMERICISH_TYPES = new Set([2, 3]); // NUMERICAL, DATE
|
|
1191
1211
|
const didYouMean = Object.fromEntries(injected.missing
|
|
1192
|
-
.map((code) =>
|
|
1212
|
+
.map((code) => {
|
|
1213
|
+
let suggestion = closestMatch(code, codes);
|
|
1214
|
+
const op = opByField.get(code);
|
|
1215
|
+
if (suggestion !== undefined && op !== undefined && NUMERIC_OPS.has(op)) {
|
|
1216
|
+
const suggestedType = catalog.find((row) => row.code === suggestion)?.type;
|
|
1217
|
+
if (suggestedType !== undefined && !NUMERICISH_TYPES.has(suggestedType)) {
|
|
1218
|
+
const typeMatched = catalog.find((row) => NUMERICISH_TYPES.has(row.type) && closestMatch(code, [row.code]) === row.code);
|
|
1219
|
+
if (typeMatched !== undefined)
|
|
1220
|
+
suggestion = typeMatched.code;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
return [code, suggestion];
|
|
1224
|
+
})
|
|
1193
1225
|
.filter((entry) => entry[1] !== undefined));
|
|
1194
1226
|
const didYouMeanHint = Object.entries(didYouMean).map(([from, to]) => `;${from} 是否想写 ${to}`).join("");
|
|
1195
1227
|
// r26b 读回体积审计(2026-11-05):目录此前在**同一个信封里被写三遍**
|
package/dist/recipes/workflow.js
CHANGED
|
@@ -108,7 +108,7 @@ const workflowConditionalTwoLevel = Object.freeze({
|
|
|
108
108
|
id: "workflow-conditional-two-level-approval",
|
|
109
109
|
title: "金额>阈值走两级审批,否则一级(分叉再汇合)",
|
|
110
110
|
status: "requires-prior-readback",
|
|
111
|
-
aliases: ["两级审批", "条件两级", "金额大于", "一级或两级", "分叉再汇合"],
|
|
111
|
+
aliases: ["两级审批", "条件两级", "金额大于", "一级或两级", "分叉再汇合", "条件审批", "条件分支", "按条件审批", "条件流程"],
|
|
112
112
|
tool: "workflow.update",
|
|
113
113
|
args: {
|
|
114
114
|
environment,
|
package/dist/tool-types.js
CHANGED
|
@@ -85,6 +85,12 @@ const TOOL_INPUT_ALIASES = Object.freeze({
|
|
|
85
85
|
"workflow.update": Object.freeze({ code: ["workflowCode"] }),
|
|
86
86
|
"workflow.publish": Object.freeze({ code: ["workflowCode"] }),
|
|
87
87
|
"workflow.delete": Object.freeze({ code: ["workflowCode"] }),
|
|
88
|
+
// r60b-F6(真机复现):同一个流程 code 写面叫 `code`、读面叫 `workflowCode`——
|
|
89
|
+
// `workflow.update` 刚成功,紧随的 `workflow.get_published` 就把同一字段名拒了
|
|
90
|
+
// (tool-input-unknown-keys)。读面把 `code` 归一成 `workflowCode`(这两个读面
|
|
91
|
+
// 没有自己的 `code` 参数,无歧义)。
|
|
92
|
+
"workflow.get_draft": Object.freeze({ workflowCode: ["code"] }),
|
|
93
|
+
"workflow.get_published": Object.freeze({ workflowCode: ["code"] }),
|
|
88
94
|
// field family: the platform's own column key is `propertyCode`; the tool's is
|
|
89
95
|
// `code`. Same field, so the alias is safe either direction.
|
|
90
96
|
"field.create": Object.freeze({ code: ["propertyCode"] }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.50",
|
|
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.50",
|
|
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.50"
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -206,6 +206,7 @@ only the section for the capability you need —
|
|
|
206
206
|
|
|
207
207
|
- **能做哪些事**:业务记录列出、加载、保存、更新、删除、提交(工作流)。
|
|
208
208
|
- **工具**:`data.list`、`data.load`、`data.save`、`data.update`、`data.delete`、`data.submit`
|
|
209
|
+
- **聚合/分组/计数(10 秒答案)**:`data.*` **没有 group-by/聚合工具**——小结果集(≤几百条)用 `data.list` 拉 filter 收窄后的全量 + `--jq '.result.items[].fields.<分组列>'` 投影,本地计数即可;跨模型汇总/大结果集/定时聚合才涉及 report 章节或字段计算(datarule type2 / formula 聚合),**不要**为「数一下条数」引入 report(r60c-F11 真机 2026-11-13:统计问句的正路一句话就该给全)。
|
|
209
210
|
- **recipe**:
|
|
210
211
|
- `omc describe data.save --example workflow-backed-data-save`
|
|
211
212
|
- `omc describe data.submit --example workflow-backed-data-submit`(有流程)
|
|
@@ -94,7 +94,7 @@ omc help omc-write-hazards
|
|
|
94
94
|
## 子表
|
|
95
95
|
|
|
96
96
|
- 一个主表可以有多个 `CHILD_TABLE`,子表不能嵌套 `CHILD_TABLE`。
|
|
97
|
-
- **子表控件(type 201
|
|
97
|
+
- **子表控件(type 201)的显示/只读/必填条件(displayFormula/readonlyFormula/requiredFormula)不在字段面**:`field.update` 对子表父控件必拒(只管子表**列**);intent 的 `fields[].options` 对子表父行同样**不生效**(写入缝整体丢弃且 readback 曾假等价,r60a-F8 真机 2026-11-13)。可行路径是表单 attributes:`form.get --controls` 读 `draftAttributesJson` 定位控件(attributes 形如 `{控件code:{key,type,options}}`)→ `form.draft` 改该控件 `options` 里的条件键(三个键名:`requiredFormula`/`readonlyFormula`/`displayFormula`)→ `form.publish`(`omc next "子表控件显示条件"` 已路由到该链)。改 attributes 用 `--args-file` 落完整 JSON 后整串传入,不要在 shell 里内联转义。
|
|
98
98
|
- **直调 `runtime/form/save` 更新既有记录时主键放 `data.id`**:`bizObject.bizObjectId` 不被保存逻辑识别——接口仍回 `errcode:0` 但 `objectId` 是**新 id**(静默新增孤儿数据,券商 issue 2026-10-27 实证 2 条)。用 `omc call data.update` 则无此坑(`bizObjectId` 在顶层参数位)。
|
|
99
99
|
- 子列是子表字段 code 对应 schema 上的普通字段:
|
|
100
100
|
|