@stalfh233/omc-cli 0.6.50 → 0.6.51
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 +3 -2
- package/dist/cli.js +28 -18
- package/dist/discovery.js +4 -38
- package/dist/goal-plan.js +89 -3
- package/dist/lanes/field.js +17 -0
- package/dist/lanes/list-view.js +18 -1
- package/dist/lanes/runtime-data.js +25 -5
- package/package.json +3 -3
|
@@ -649,7 +649,8 @@ export function executableCapabilityBundle(registry, id) {
|
|
|
649
649
|
* `--compact` keeps the mid-width shape (id/lane/intent/coverage/toolCount) it
|
|
650
650
|
* has had since HANDOFF §三.3-7, so existing callers do not move.
|
|
651
651
|
*
|
|
652
|
-
*
|
|
652
|
+
* (r61)`legacy`(OMC_LEGACY_DISCOVERY)回滚档已按计划移除——M2 面经 R60
|
|
653
|
+
* 三路探针真机验证后退役。
|
|
653
654
|
*/
|
|
654
655
|
export function compactCapabilities(registry, options = {}) {
|
|
655
656
|
const index = capabilityRouteIndex(registry);
|
|
@@ -658,7 +659,7 @@ export function compactCapabilities(registry, options = {}) {
|
|
|
658
659
|
// `omc capability <id>` 按需取。压缩档因此把 tools 换成 toolCount,并**明说**
|
|
659
660
|
// 省略了工具名,不让读者误以为该能力没有工具。
|
|
660
661
|
const compact = options.compact === true;
|
|
661
|
-
const full = options.full === true ||
|
|
662
|
+
const full = options.full === true || compact;
|
|
662
663
|
if (!full) {
|
|
663
664
|
// Lean index. A single `id:toolCount` line instead of 18 objects: the
|
|
664
665
|
// decision this face answers is "which family do I need", and the family's
|
package/dist/cli.js
CHANGED
|
@@ -1297,7 +1297,7 @@ function cmdDiscovery(kind, transport, value, options = {}) {
|
|
|
1297
1297
|
// catalogue must be requested with `commands --json` (round-9 heavy-task: an
|
|
1298
1298
|
// agent paid 4×54 KB on the default face before any hint could land).
|
|
1299
1299
|
if (options.json !== true && options.compact !== true && !scoped) {
|
|
1300
|
-
result = commandIndex(registry
|
|
1300
|
+
result = commandIndex(registry);
|
|
1301
1301
|
return emitProjectedResult({ status: "ok", ...result }, transport, options.jq);
|
|
1302
1302
|
}
|
|
1303
1303
|
const inventory = commandInventory(registry, { compact: options.compact === true });
|
|
@@ -1445,7 +1445,7 @@ function cmdDiscovery(kind, transport, value, options = {}) {
|
|
|
1445
1445
|
}
|
|
1446
1446
|
}
|
|
1447
1447
|
else {
|
|
1448
|
-
result = describeTool(registry, value ?? ""
|
|
1448
|
+
result = describeTool(registry, value ?? "");
|
|
1449
1449
|
// r28b 账本(2026-10-28):describe rule.save×11 / form.publish×9——firstCall 教学后
|
|
1450
1450
|
// 仍反复全量 describe。同参数近期已 ok 时附降载提示,引导 --param/--example 精准取。
|
|
1451
1451
|
// 无项目 ledger(golden/repo 测试/一次性运行)时 priorIdenticalSuccess 返回
|
|
@@ -1629,20 +1629,9 @@ async function cmdPlan(goal, options, transport) {
|
|
|
1629
1629
|
* the tool registry, the coverage manifest, and the intent capability registry.
|
|
1630
1630
|
*/
|
|
1631
1631
|
function cmdCapabilities(transport, options = {}, jq) {
|
|
1632
|
-
const result = compactCapabilities(buildToolRegistry(),
|
|
1632
|
+
const result = compactCapabilities(buildToolRegistry(), options);
|
|
1633
1633
|
return emitProjectedResult({ status: "ok", ...result }, transport, jq);
|
|
1634
1634
|
}
|
|
1635
|
-
/**
|
|
1636
|
-
* `OMC_LEGACY_DISCOVERY=1` — the 0.6.48 rollback switch (EXECUTION-PLAN §十).
|
|
1637
|
-
*
|
|
1638
|
-
* It restores the pre-M2 default faces byte-for-byte: bare `commands` with all
|
|
1639
|
-
* rows, `capabilities` with the full projection, and the wide `describe`. The
|
|
1640
|
-
* explicit flags (`--json`, `--full`, `--capability`) are unaffected — only the
|
|
1641
|
-
* defaults move, so a caller that names what it wants never sees a difference.
|
|
1642
|
-
*/
|
|
1643
|
-
function legacyDiscovery() {
|
|
1644
|
-
return process.env.OMC_LEGACY_DISCOVERY === "1";
|
|
1645
|
-
}
|
|
1646
1635
|
function cmdCapability(id, transport, executable = false, jq) {
|
|
1647
1636
|
const registry = buildToolRegistry();
|
|
1648
1637
|
const resolved = resolveCapabilityId(id);
|
|
@@ -1766,7 +1755,7 @@ function intentDigest(intent) {
|
|
|
1766
1755
|
};
|
|
1767
1756
|
}
|
|
1768
1757
|
/** Ticket 118 — `omc intent plan <file> --env <env>`: read-only baseline -> compile -> immutable plan. */
|
|
1769
|
-
async function cmdIntentPlan(file, environment, planOut, transport) {
|
|
1758
|
+
async function cmdIntentPlan(file, environment, planOut, transport, summary = false) {
|
|
1770
1759
|
const read = readIntentOrInvalid(file, transport);
|
|
1771
1760
|
if (read.kind === "exit")
|
|
1772
1761
|
return read.code;
|
|
@@ -1778,7 +1767,28 @@ async function cmdIntentPlan(file, environment, planOut, transport) {
|
|
|
1778
1767
|
return emitInvalid(transport, { message: error instanceof Error ? error.message : String(error) });
|
|
1779
1768
|
}
|
|
1780
1769
|
}
|
|
1781
|
-
|
|
1770
|
+
const result = await planIntent(read.intent, environment, planOut);
|
|
1771
|
+
// a-F12(r60a-F12,r61):--summary 档只回决策字段 + 逐项变更(tool+reason+资源
|
|
1772
|
+
// 键,去 args/baselineFingerprint)。内联完整 plan 一个真实需求 ~20KB、含基线
|
|
1773
|
+
// 50–60KB——探针只要「会改什么」时被整块计费。要 apply 仍用完整 plan(不带
|
|
1774
|
+
// --summary,或 --plan-out 写复核文件)。
|
|
1775
|
+
if (summary) {
|
|
1776
|
+
const plan = result.plan;
|
|
1777
|
+
if (plan !== undefined && Array.isArray(plan.changes)) {
|
|
1778
|
+
return emitResult({
|
|
1779
|
+
...result,
|
|
1780
|
+
plan: undefined,
|
|
1781
|
+
changesBrief: plan.changes.map((change) => ({
|
|
1782
|
+
tool: change.tool,
|
|
1783
|
+
...(change.reason !== undefined ? { reason: change.reason } : {}),
|
|
1784
|
+
resource: change.args?.schemaCode ?? change.args?.code ?? null,
|
|
1785
|
+
})),
|
|
1786
|
+
summaryNote: "--summary 只回变更清单(去 args/基线);apply 用完整 plan(不带 --summary 或 --plan-out <file>)",
|
|
1787
|
+
}, transport);
|
|
1788
|
+
}
|
|
1789
|
+
// 已外置/已写文件的分支本就是决策字段面——原样返回。
|
|
1790
|
+
}
|
|
1791
|
+
return emitResult(result, transport);
|
|
1782
1792
|
}
|
|
1783
1793
|
/** Ticket 120 — `omc intent readback <file> --env <env>`: decode the live baseline back into intent shape and verify equivalence. */
|
|
1784
1794
|
async function cmdIntentReadback(file, environment, transport) {
|
|
@@ -2858,8 +2868,8 @@ async function main() {
|
|
|
2858
2868
|
const intentCommand = command.command("intent");
|
|
2859
2869
|
intentCommand.command("schema").option("--example [id]").action((options) => { commandExitCode = cmdIntentSchema({ request, maxOutputBytes: CLI_DEFAULT_OUTPUT_BYTES }, typeof options.example === "string" ? options.example : undefined, options.example !== undefined); });
|
|
2860
2870
|
intentCommand.command("validate <file>").option("--show-intent").action((file, options) => { commandExitCode = cmdIntentValidate(file, { request, maxOutputBytes: CLI_DEFAULT_OUTPUT_BYTES }, options.showIntent === true); });
|
|
2861
|
-
intentCommand.command("plan <file>").option("--env <environment>").option("--plan-out <file>").option("--max-output-bytes <bytes>").action(async (file, options) => {
|
|
2862
|
-
commandExitCode = await withTransport(options, request, (transport) => cmdIntentPlan(file, options.env, options.planOut, transport));
|
|
2871
|
+
intentCommand.command("plan <file>").option("--env <environment>").option("--plan-out <file>").option("--summary", "只回变更清单(tool+reason+资源键,去 args/基线)——复核用;apply 仍需完整 plan").option("--max-output-bytes <bytes>").action(async (file, options) => {
|
|
2872
|
+
commandExitCode = await withTransport(options, request, (transport) => cmdIntentPlan(file, options.env, options.planOut, transport, options.summary === true));
|
|
2863
2873
|
});
|
|
2864
2874
|
intentCommand.command("apply <file>").option("--env <environment>").option("--dry-run").option("--no-verify").option("--confirm-production").option("--wait <milliseconds>", "写锁冲突时的有界排队毫秒数(同 `omc call --wait`,默认 0=立刻拒绝)").option("--max-output-bytes <bytes>").action(async (file, options) => {
|
|
2865
2875
|
const waitRaw = options.wait === undefined ? 0 : Number(options.wait);
|
package/dist/discovery.js
CHANGED
|
@@ -111,24 +111,15 @@ export function commandInventory(registry, options = {}) {
|
|
|
111
111
|
export function filterTools(registry, query) {
|
|
112
112
|
return scoreTools(registry, query).map(({ name, via, score }) => ({ name, via, score }));
|
|
113
113
|
}
|
|
114
|
-
export function commandIndex(registry
|
|
114
|
+
export function commandIndex(registry) {
|
|
115
115
|
const byLane = new Map();
|
|
116
116
|
for (const tool of registry) {
|
|
117
117
|
const lane = tool.lane ?? "(unbound)";
|
|
118
118
|
byLane.set(lane, (byLane.get(lane) ?? 0) + 1);
|
|
119
119
|
}
|
|
120
120
|
const lanes = [...byLane.entries()].sort((left, right) => left[0].localeCompare(right[0]));
|
|
121
|
-
//
|
|
122
|
-
//
|
|
123
|
-
if (options.legacy === true) {
|
|
124
|
-
return {
|
|
125
|
-
discovery: { authoritative: DISCOVERY_AUTHORITY.authoritative, route: DISCOVERY_AUTHORITY.route },
|
|
126
|
-
toolCount: registry.length,
|
|
127
|
-
lanes: lanes.map(([lane, tools]) => ({ lane, tools })),
|
|
128
|
-
tools: registry.map((tool) => ({ name: tool.name, lane: tool.lane ?? null, kind: tool.kind })),
|
|
129
|
-
hint: "裸 `commands` 是有界索引(name/lane/kind)。全量行用 `omc commands --json`;单能力用 `omc commands --json --compact --lane <lane>`;关键词用 `--filter <word>`;目标→路线优先 `omc next \"<目标>\"`。",
|
|
130
|
-
};
|
|
131
|
-
}
|
|
121
|
+
// (r61)`OMC_LEGACY_DISCOVERY` 回滚开关已按计划移除——M2 新面经 R60 三路探针
|
|
122
|
+
// 真机验证(plan 第一跳 8 次 / 全量目录 0 次),pre-M2 面不再保留。
|
|
132
123
|
const routeCount = capabilityRouteIndex(registry).routes.length;
|
|
133
124
|
return {
|
|
134
125
|
discovery: { authoritative: DISCOVERY_AUTHORITY.authoritative, route: DISCOVERY_AUTHORITY.route },
|
|
@@ -507,7 +498,7 @@ const DATA_PARAMETER_NAMES = [
|
|
|
507
498
|
* a missing param NAME costs an invalid_input round, and the R2 gate says bytes
|
|
508
499
|
* must never be bought with rounds.
|
|
509
500
|
*/
|
|
510
|
-
export function describeTool(registry, name
|
|
501
|
+
export function describeTool(registry, name) {
|
|
511
502
|
const tool = registry.find((entry) => entry.name === name);
|
|
512
503
|
if (!tool)
|
|
513
504
|
return undefined;
|
|
@@ -515,8 +506,6 @@ export function describeTool(registry, name, options = {}) {
|
|
|
515
506
|
const { required, params } = compactParams(schema);
|
|
516
507
|
const hasRecipe = (tool.executionMetadata?.recipes.length ?? 0) > 0;
|
|
517
508
|
const firstCall = firstCallFor(tool);
|
|
518
|
-
if (options.legacy === true)
|
|
519
|
-
return legacyDescribeTool(tool, required, params, hasRecipe, firstCall);
|
|
520
509
|
const recipes = tool.executionMetadata?.recipes ?? [];
|
|
521
510
|
// Titles are how a caller picks among recipes; keep them while the list is
|
|
522
511
|
// short, because above that the title text alone is the payload.
|
|
@@ -595,29 +584,6 @@ function leanFirstCall(firstCall) {
|
|
|
595
584
|
readMore: firstCall.readMore,
|
|
596
585
|
};
|
|
597
586
|
}
|
|
598
|
-
/** `OMC_LEGACY_DISCOVERY=1`: the pre-M2 default face, byte-for-byte. */
|
|
599
|
-
function legacyDescribeTool(tool, required, params, hasRecipe, firstCall) {
|
|
600
|
-
return {
|
|
601
|
-
name: tool.name,
|
|
602
|
-
lane: tool.lane ?? null,
|
|
603
|
-
kind: tool.kind,
|
|
604
|
-
summary: summarizeDescription(tool.description),
|
|
605
|
-
required,
|
|
606
|
-
params,
|
|
607
|
-
examples: exampleList(tool),
|
|
608
|
-
...(firstCall !== undefined ? { firstCall } : {}),
|
|
609
|
-
...(hasRecipe ? { exampleHint: `可运行参数用 --example <id>(~1–2KB);单参数用 --param <name>;仅当二者都缺形状才 --full` } : {}),
|
|
610
|
-
...(!hasRecipe ? { exampleHint: `无静态 recipe:required + params 已够常规调用;单参数说明用 --param <name>;仅当需要全部参数注释/拒绝形状才 --full(5–20KB)` } : {}),
|
|
611
|
-
...(documentedParamNames(tool).length > 0
|
|
612
|
-
? { paramDocs: { available: documentedParamNames(tool), read: largeParamDocsHint(tool) } }
|
|
613
|
-
: {}),
|
|
614
|
-
...(tool.paramEnums !== undefined ? { paramEnums: tool.paramEnums } : {}),
|
|
615
|
-
...(returnsFace(tool.name) ?? {}),
|
|
616
|
-
...(tool.kind === "write" ? { writeLock: "写锁=环境级:同一环境的并发写,后到的直接回 write-lock-held(不排队)。可带 --wait <ms> 让 CLI 内部排队(CLI 开关,不是本工具参数);不要写 shell 重试循环" } : {}),
|
|
617
|
-
...(tool.name.startsWith("data.") ? { parameterNames: DATA_PARAMETER_NAMES } : {}),
|
|
618
|
-
full: `omc describe ${tool.name} --full(5–20KB;先试 --example/--param)`,
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
587
|
/** Param names whose schema entry carries a `.describe()` (documented params). */
|
|
622
588
|
function documentedParamNames(tool) {
|
|
623
589
|
const shape = (tool.inputSchema ?? {});
|
package/dist/goal-plan.js
CHANGED
|
@@ -82,6 +82,27 @@ async function planReadAsk(registry, goal, environment, options, base, match, ca
|
|
|
82
82
|
});
|
|
83
83
|
continue;
|
|
84
84
|
}
|
|
85
|
+
// c-F12(r60c-F12,r61):点名对象在环境里**不存在**(rows 有但全不匹配)——
|
|
86
|
+
// 这是「替代口径需人裁决」的岔路,不是「从清单里选一个」。非交互 agent
|
|
87
|
+
// 没有提问通道,blocker 必须自带可复制的问句 + 互斥选项,让它能被当
|
|
88
|
+
// 「待裁决项」交回(探针 r60c-Q5 曾被迫两条路都跑:76 次 rule.list)。
|
|
89
|
+
if (hint.trim() !== "") {
|
|
90
|
+
// 问句短语截到「这类/的」为止(「差旅申请这类模型的单据…」→「差旅申请」),
|
|
91
|
+
// 问句要可辨识,不要整句复读。
|
|
92
|
+
const namedPhrase = hint.trim().replace(/(?:这类|这种|这些|一样的).*$/, "").replace(/的.*$/, "").slice(0, 16) || hint.trim().slice(0, 16);
|
|
93
|
+
blockers.push({
|
|
94
|
+
type: "needs-decision",
|
|
95
|
+
param: key,
|
|
96
|
+
reason: `目标句点名的「${namedPhrase}」在本环境不匹配任何模型(现有 ${rows.length} 个)——替代口径需人裁决`,
|
|
97
|
+
question: `「${namedPhrase}」在本环境不存在。要怎么处理?`,
|
|
98
|
+
options: [
|
|
99
|
+
`按最接近的现有模型替代回答(候选:${rows.slice(0, 3).map((row) => row.code).join("、")})`,
|
|
100
|
+
`全量扫 ${rows.length} 个模型的对应面(逐模型调用,输出全集)`,
|
|
101
|
+
`就报「不存在」,不做替代`,
|
|
102
|
+
],
|
|
103
|
+
});
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
85
106
|
ambiguities.push({ param: key, candidates: rows.slice(0, 10), question: "目标句里没有能对上平台的模型,选哪个?" });
|
|
86
107
|
continue;
|
|
87
108
|
}
|
|
@@ -105,7 +126,13 @@ async function planReadAsk(registry, goal, environment, options, base, match, ca
|
|
|
105
126
|
if (statesCondition && !hasFilterValue) {
|
|
106
127
|
const target = ["filter", "filters", "filterGroup"].find((key) => key in tool.inputSchema);
|
|
107
128
|
if (target !== undefined) {
|
|
108
|
-
|
|
129
|
+
// P0-4b(r60c-F5 复验发现):20 字符前置窗口**硬截会把 token 撕裂**——
|
|
130
|
+
// 「crm_contract 里 contract_amount 大于」回显成「t 里 contract_amount 大于」,
|
|
131
|
+
// 谜语回显等于没回显。先试「分隔符定界」形(短语以空白/标点边界开始,
|
|
132
|
+
// 取到完整 token),无分隔符的纯中文短句再回退自由形。尾窗排除「的」,
|
|
133
|
+
// 让「…的单据有哪些」不进窗口(.replace 兜底保留)。
|
|
134
|
+
const conditionWindow = goal.match(/[\s;;,,。、((][^\s;;,,。、((]{1,24}\s*(?:大于|小于|等于|超过|低于|介于|不等|包含|为空|不为空)[^;;,,。的]{0,12}/) ??
|
|
135
|
+
goal.match(/[^;;,,。]{0,20}(?:大于|小于|等于|超过|低于|介于|不等|包含|为空|不为空|>|<|>=|<=|=)[^;;,,。的]{0,12}/);
|
|
109
136
|
const conditionEcho = conditionWindow !== null ? conditionWindow[0].trim().replace(/\s*的.*$/u, "") : "问句里的筛选条件";
|
|
110
137
|
const rangeOp = /大于|超过|>|>=|低于|小于|</.test(conditionEcho);
|
|
111
138
|
missing[target] = {
|
|
@@ -913,6 +940,9 @@ export async function planGoal(registry, goal, options = {}) {
|
|
|
913
940
|
const blockers = [];
|
|
914
941
|
const probes = [];
|
|
915
942
|
let probeFailure;
|
|
943
|
+
// b-F1(r60b-F1):问句点名「建模型 X」而 X 不存在时,建模不是拦路 blocker 而
|
|
944
|
+
// 是计划的第一步——s0 脚手架(model.create + field.publish),后续步骤照常用 X。
|
|
945
|
+
let scaffold;
|
|
916
946
|
// ---- resolve one slot at a time -------------------------------------------------
|
|
917
947
|
for (const [key, value] of Object.entries(rawArgs)) {
|
|
918
948
|
// The environment is never a probe: `--env` already is the answer, and the
|
|
@@ -1021,6 +1051,20 @@ export async function planGoal(registry, goal, options = {}) {
|
|
|
1021
1051
|
if (!needsValue) {
|
|
1022
1052
|
ambiguities.push({ param: key, candidates: rows.slice(0, 10), question: `配方示例值「${hints[0]}」在本环境不存在,选哪个 ${key}?` });
|
|
1023
1053
|
}
|
|
1054
|
+
else if (key === "schemaCode" && outcome.reason === "model-not-found" && scaffold === undefined &&
|
|
1055
|
+
/(?:建|新建|创建|搭建).{0,8}模型/.test(goal) &&
|
|
1056
|
+
scaffoldCodeFrom(goal) !== undefined) {
|
|
1057
|
+
// b-F1:多步链路的发现成本不能全落在人身上——「建 X 并配 Y」被 Y 的配方
|
|
1058
|
+
// 命中而 X 不存在时,老行为只回 blocker(探针被迫另起两轮找建模入口)。
|
|
1059
|
+
// 插 s0 建模脚手架,主步骤照常编译;字段清单是需求本体(needs-authoring
|
|
1060
|
+
// 语义),计划不猜——warning 指路 field.create。code 取问句里的 ASCII
|
|
1061
|
+
// 标识(hintCandidates 只出中文短语,认不出 r60b_leave 这类 code)。
|
|
1062
|
+
const scaffoldCode = scaffoldCodeFrom(goal);
|
|
1063
|
+
scaffold = { code: scaffoldCode };
|
|
1064
|
+
args[key] = scaffoldCode;
|
|
1065
|
+
warnings.push(`schemaCode: 目标模型 ${scaffoldCode} 尚不存在——已排 s0 建模脚手架(model.create + field.publish 模型级一次发布);业务字段清单按需求补 field.create(本计划不猜字段)`);
|
|
1066
|
+
continue;
|
|
1067
|
+
}
|
|
1024
1068
|
else {
|
|
1025
1069
|
blockers.push({ type: "blocked", param: key, reason: outcome.reason ?? "平台无匹配" });
|
|
1026
1070
|
}
|
|
@@ -1082,7 +1126,7 @@ export async function planGoal(registry, goal, options = {}) {
|
|
|
1082
1126
|
kind: tool.kind === "write" ? "write" : "read",
|
|
1083
1127
|
purpose: recipe.title,
|
|
1084
1128
|
args,
|
|
1085
|
-
dependsOn: [...dependencies],
|
|
1129
|
+
dependsOn: scaffold !== undefined ? [...dependencies, "s0p"] : [...dependencies],
|
|
1086
1130
|
validated,
|
|
1087
1131
|
dryRun: dryRunFor(tool.name, args, tool),
|
|
1088
1132
|
...(() => {
|
|
@@ -1098,7 +1142,36 @@ export async function planGoal(registry, goal, options = {}) {
|
|
|
1098
1142
|
const uncertain = probeFailure !== undefined;
|
|
1099
1143
|
// Uncertain ⇒ NOTHING executable. The risk the review called out: a plan that
|
|
1100
1144
|
// half-resolved ids still looks runnable, and a write lands against the wrong model.
|
|
1101
|
-
|
|
1145
|
+
// b-F1(r60b-F1):scaffold 在最前——model.create(命名沿用问句原词)→ field.publish
|
|
1146
|
+
// (模型级一次发布),主步骤与 priors 的 dependsOn 声明指向 s0。
|
|
1147
|
+
const modelCreateTool = registry.find((entry) => entry.name === "model.create");
|
|
1148
|
+
const fieldPublishTool = registry.find((entry) => entry.name === "field.publish");
|
|
1149
|
+
const scaffoldStepCreate = scaffold === undefined || modelCreateTool === undefined
|
|
1150
|
+
? undefined
|
|
1151
|
+
: {
|
|
1152
|
+
id: "s0",
|
|
1153
|
+
tool: "model.create",
|
|
1154
|
+
kind: "write",
|
|
1155
|
+
purpose: "b-F1 前置链:问句点名新建的模型不存在——建模是计划第一步(字段清单按需求补 field.create)",
|
|
1156
|
+
args: { ...(environment !== null ? { environment } : {}), name: scaffold.code, code: scaffold.code },
|
|
1157
|
+
dependsOn: [],
|
|
1158
|
+
validated: { ok: true, issues: [] },
|
|
1159
|
+
dryRun: { supported: true, command: `omc call model.create --dry-run --args '{"name":"${scaffold.code}","code":"${scaffold.code}"}'` },
|
|
1160
|
+
};
|
|
1161
|
+
const scaffoldStepPublish = scaffold === undefined || fieldPublishTool === undefined
|
|
1162
|
+
? undefined
|
|
1163
|
+
: {
|
|
1164
|
+
id: "s0p",
|
|
1165
|
+
tool: "field.publish",
|
|
1166
|
+
kind: "write",
|
|
1167
|
+
purpose: "b-F1 前置链:模型级发布(发布全部草稿字段;流程/视图/规则面依赖已发布字段)",
|
|
1168
|
+
args: { ...(environment !== null ? { environment } : {}), schemaCode: scaffold.code },
|
|
1169
|
+
dependsOn: ["s0"],
|
|
1170
|
+
validated: { ok: true, issues: [] },
|
|
1171
|
+
dryRun: { supported: true, command: `omc call field.publish --dry-run --args '{"schemaCode":"${scaffold.code}"}'` },
|
|
1172
|
+
};
|
|
1173
|
+
const scaffoldSteps = [scaffoldStepCreate, scaffoldStepPublish].filter((step) => step !== undefined);
|
|
1174
|
+
const compiled = uncertain ? [] : [...scaffoldSteps, ...priorCompiled.steps, mainStep];
|
|
1102
1175
|
// M4-2: dependencies are declared, so the order must be PROVEN, not assumed.
|
|
1103
1176
|
const sorted = topoSort(compiled);
|
|
1104
1177
|
if (sorted.cycle !== undefined) {
|
|
@@ -1223,6 +1296,19 @@ function hintFromGoal(goal, rawArgs) {
|
|
|
1223
1296
|
* Several candidates are returned because the ask may name the object loosely;
|
|
1224
1297
|
* the caller tries each against the platform's rows and takes the first unique hit.
|
|
1225
1298
|
*/
|
|
1299
|
+
/**
|
|
1300
|
+
* b-F1(r60b-F1):从问句提取「点名要新建的模型 code」。hintCandidates 只出
|
|
1301
|
+
* 中文短语,认不出 `r60b_leave` 这类 ASCII code——这里取问句里最长的 ASCII
|
|
1302
|
+
* 标识词,排除配方占位(omc_recipe_*)。无 ASCII 标识 → undefined(不成脚手架)。
|
|
1303
|
+
*/
|
|
1304
|
+
export function scaffoldCodeFrom(goal) {
|
|
1305
|
+
const codes = [...goal.matchAll(/[A-Za-z][A-Za-z0-9_]{2,39}/g)]
|
|
1306
|
+
.map((match) => match[0])
|
|
1307
|
+
.filter((code) => !code.startsWith("omc_recipe_"));
|
|
1308
|
+
if (codes.length === 0)
|
|
1309
|
+
return undefined;
|
|
1310
|
+
return codes.reduce((best, code) => (code.length > best.length ? code : best));
|
|
1311
|
+
}
|
|
1226
1312
|
export function hintCandidates(goal) {
|
|
1227
1313
|
const quoted = goal.match(/[「"]([^」"]{2,20})[」"]/);
|
|
1228
1314
|
const out = [];
|
package/dist/lanes/field.js
CHANGED
|
@@ -333,6 +333,12 @@ export function registerFieldLane(tools) {
|
|
|
333
333
|
inputSchema: { environment: environmentArg, schemaCode: z.string(), published: z.boolean().default(false), code: z.string().optional(), fields: z.array(z.string()).optional(), full: z.boolean().optional().describe("行内联完整 options/subSchema;默认清单面只有 code/name/type/typeName(+conditions 信号/shapeWarning),验证 options 用 code/fields 选择器或 full:true;平台读面带回 propertyEmpty 时一并输出(不回则省略,不塞 false)"), all: z.boolean().optional().describe("默认只返业务字段(过滤 SYSTEM_FIELD_CODES 的 13 个平台字段:id/name/sequenceNo/createdTime/creater/sequenceStatus/…);true 连系统字段一起返"), capability: capabilityArg },
|
|
334
334
|
handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
|
|
335
335
|
const rows = wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: args.schemaCode, isPublish: args.published ? "true" : "false" } })).data);
|
|
336
|
+
// r61 a-F9(r60a-F9):draft 面此前不报字段的发布态,行级缺 published 键
|
|
337
|
+
// 被读成「未发布」(null 三态歧义:未发布 vs 本面不返回)。多拉一次发布面
|
|
338
|
+
// code 集做行级双面比对——agent 一次清单就能回答「这个字段发布了吗」,
|
|
339
|
+
// 不必再跑 published:true 交叉核对。
|
|
340
|
+
const publishedCodes = new Set(wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: args.schemaCode, isPublish: "true" } })).data)
|
|
341
|
+
.map((row) => String(row.code ?? row.propertyCode)));
|
|
336
342
|
const mapped = rows.map((row) => {
|
|
337
343
|
const type = Number(row.type ?? row.propertyType);
|
|
338
344
|
const typeLabel = fieldTypeLabel(row.type ?? row.propertyType);
|
|
@@ -345,6 +351,9 @@ export function registerFieldLane(tools) {
|
|
|
345
351
|
return {
|
|
346
352
|
code: fieldCode,
|
|
347
353
|
name: row.name,
|
|
354
|
+
// r61 a-F9:行级发布态(双面比对)——true=已出现在发布面;false=仅草稿。
|
|
355
|
+
// 面级 `face` 是查询面选择器,与此行级键不同义。
|
|
356
|
+
published: publishedCodes.has(String(fieldCode)),
|
|
348
357
|
...(redundantNameI18n(row.name_i18n, row.name) ? {} : typeof row.name_i18n === "string" ? { name_i18n: row.name_i18n } : {}),
|
|
349
358
|
type: row.type ?? row.propertyType,
|
|
350
359
|
...(typeLabel !== undefined ? { typeName: typeLabel } : {}),
|
|
@@ -411,6 +420,9 @@ export function registerFieldLane(tools) {
|
|
|
411
420
|
type: field.type,
|
|
412
421
|
...(field.typeName !== undefined ? { typeName: field.typeName } : {}),
|
|
413
422
|
...(field.name !== undefined ? { name: field.name } : {}),
|
|
423
|
+
// r61 a-F9:inventory 面也带行级发布态(双面比对真值,一次清单
|
|
424
|
+
// 回答「这个字段发布了吗」)。
|
|
425
|
+
...(field.published !== undefined ? { published: field.published } : {}),
|
|
414
426
|
// Inventory answers "which columns did I author?" — system
|
|
415
427
|
// columns are reported as a count, not mixed into the list.
|
|
416
428
|
...(businessCodes !== undefined ? { subColumnCodes: businessCodes } : {}),
|
|
@@ -434,6 +446,9 @@ export function registerFieldLane(tools) {
|
|
|
434
446
|
// r45: 这是"本次查询的面选择器"回显(draft/published),不是字段发布状态——
|
|
435
447
|
// 曾被误读为"字段未发布"。改名 face 消歧义;要查发布态用 field.publish 回读或详情面。
|
|
436
448
|
face: args.published === true ? "published" : "draft",
|
|
449
|
+
// r61 a-F9:行级 `published`(true/false)是双面比对出的**字段发布态**;
|
|
450
|
+
// `face` 只是本次查询的面选择器——两键不同义,别再拿 face 推断发布态。
|
|
451
|
+
publishedNote: "行级 published=该字段是否已出现在发布面(双面比对);face=本次查询面(draft/published),不是字段发布态",
|
|
437
452
|
...(selector.length > 0 ? { selected: selector } : {}),
|
|
438
453
|
...(args.all !== true ? { businessOnly: true } : {}),
|
|
439
454
|
fields: projected,
|
|
@@ -490,6 +505,8 @@ export function registerFieldLane(tools) {
|
|
|
490
505
|
type: field.type,
|
|
491
506
|
...(field.typeName !== undefined ? { typeName: field.typeName } : {}),
|
|
492
507
|
...(field.name !== undefined ? { name: field.name } : {}),
|
|
508
|
+
// r61 a-F9:选择器面同样保留行级发布态(双面比对真值)。
|
|
509
|
+
...(field.published !== undefined ? { published: field.published } : {}),
|
|
493
510
|
...(Array.isArray(field.subColumns) ? { subColumns: field.subColumns } : {}),
|
|
494
511
|
...(conditions.length > 0 ? { conditions } : {}),
|
|
495
512
|
...(field.shapeWarning !== undefined ? { shapeWarning: field.shapeWarning } : {}),
|
package/dist/lanes/list-view.js
CHANGED
|
@@ -814,12 +814,29 @@ export function registerListViewLane(tools) {
|
|
|
814
814
|
}
|
|
815
815
|
const after = await wireCall(session, { path: ENDPOINTS.listQueryGet, query: { schemaCode: args.schemaCode, code, clientType: "PC" } });
|
|
816
816
|
const afterModel = (after.data ?? {});
|
|
817
|
+
// r61 a-F14(r60a-F14 真机定性):`queryColumns` 列树**不回 sumType**(投影恒
|
|
818
|
+
// null),列汇总真值在呈现层 `queryPresentation.columnsJson`——写入面也是它。
|
|
819
|
+
// 两面各说各话曾让探针为对账「合计配上了吗」拉全量 presentation(26KB
|
|
820
|
+
// artifact 的根因)。这里把真值按 propertyCode 合并进列投影,单面即可对账;
|
|
821
|
+
// 仅当呈现层该列无 sumType 时才回退列树值(保持 null=不统计的可读性)。
|
|
822
|
+
const sumTypeByCode = new Map();
|
|
823
|
+
const rawPresentation = afterModel.queryPresentation;
|
|
824
|
+
if (rawPresentation && typeof rawPresentation === "object") {
|
|
825
|
+
const decodedColumns = decodePresentation(rawPresentation).columnsJson;
|
|
826
|
+
if (Array.isArray(decodedColumns)) {
|
|
827
|
+
for (const column of decodedColumns) {
|
|
828
|
+
if (column && typeof column === "object" && typeof column.propertyCode === "string" && typeof column.sumType === "number") {
|
|
829
|
+
sumTypeByCode.set(String(column.propertyCode), column.sumType);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
817
834
|
const afterCols = readArray(afterModel, "queryColumns").map((c) => ({
|
|
818
835
|
propertyCode: c.propertyCode,
|
|
819
836
|
propertyType: c.propertyType,
|
|
820
837
|
displayFormat: c.displayFormat ?? null,
|
|
821
838
|
visible: c.visible ?? null,
|
|
822
|
-
sumType: c.sumType ?? null,
|
|
839
|
+
sumType: sumTypeByCode.get(String(c.propertyCode)) ?? c.sumType ?? null,
|
|
823
840
|
}));
|
|
824
841
|
const sorts = readArray(afterModel, "querySorts")
|
|
825
842
|
.map(decodeSortRow)
|
|
@@ -645,15 +645,20 @@ async function personFieldShapeViolations(session, schemaCode, formData) {
|
|
|
645
645
|
*/
|
|
646
646
|
async function portalRequiredViolations(session, schemaCode, sheetCode, formData) {
|
|
647
647
|
const sheet = ((await wireCall(session, { path: ENDPOINTS.sheetGet, query: { schemaCode, sheetCode } })).data ?? {});
|
|
648
|
-
|
|
648
|
+
// r61 a-F15(r60a-F15):空数组有三态歧义——「表单无必填」「必填面读不到」
|
|
649
|
+
// 「必填但都填了」全回 []。探测面不可得时明说,别让 agent 把「读不到」
|
|
650
|
+
// 当「无必填」而跳过校验。
|
|
651
|
+
const publishedJson = typeof sheet.publishedAttributesJson === "string" ? sheet.publishedAttributesJson : undefined;
|
|
652
|
+
const draftJson = typeof sheet.draftAttributesJson === "string" ? sheet.draftAttributesJson : undefined;
|
|
653
|
+
const face = publishedJson ?? draftJson;
|
|
649
654
|
if (!face)
|
|
650
|
-
return { requiredFields: [], missingRequired: [] };
|
|
655
|
+
return { requiredFields: [], missingRequired: [], requiredFace: "unavailable" };
|
|
651
656
|
let parsed;
|
|
652
657
|
try {
|
|
653
658
|
parsed = JSON.parse(face);
|
|
654
659
|
}
|
|
655
660
|
catch {
|
|
656
|
-
return { requiredFields: [], missingRequired: [] };
|
|
661
|
+
return { requiredFields: [], missingRequired: [], requiredFace: "unavailable" };
|
|
657
662
|
}
|
|
658
663
|
const requiredFields = Object.entries(parsed)
|
|
659
664
|
.filter(([, control]) => control?.options?.required === true || typeof control?.options?.requiredFormula === "string")
|
|
@@ -662,7 +667,7 @@ async function portalRequiredViolations(session, schemaCode, sheetCode, formData
|
|
|
662
667
|
const value = formData[code];
|
|
663
668
|
return value === null || value === undefined || (typeof value === "string" && value.trim() === "");
|
|
664
669
|
});
|
|
665
|
-
return { requiredFields, missingRequired };
|
|
670
|
+
return { requiredFields, missingRequired, requiredFace: publishedJson !== undefined ? "published" : "draft" };
|
|
666
671
|
}
|
|
667
672
|
/** 提交面:formData 里出现任何非空人员字段值即返回(issue#10:两种形状都可能 50000,可靠链路是提交省略)。 */
|
|
668
673
|
async function staffFieldsPresent(session, schemaCode, formData) {
|
|
@@ -2200,7 +2205,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
2200
2205
|
`确要在提交携带人员字段(个别平台构建接受),显式带 allowStaffOnSubmit:true 自担。`,
|
|
2201
2206
|
});
|
|
2202
2207
|
}
|
|
2203
|
-
const validation = await portalRequiredViolations(session, args.schemaCode, sheetCode, args.formData ?? {}).catch(() => ({ requiredFields: [], missingRequired: [] }));
|
|
2208
|
+
const validation = await portalRequiredViolations(session, args.schemaCode, sheetCode, args.formData ?? {}).catch(() => ({ requiredFields: [], missingRequired: [], requiredFace: "unavailable" }));
|
|
2204
2209
|
// Directive: a workflow-backed model's submit must START the workflow, not
|
|
2205
2210
|
// merely save a sheet row. When the caller names no workflow params, detect
|
|
2206
2211
|
// the model's workflow and start it (formType=1 + workflowCode); a model
|
|
@@ -2702,11 +2707,26 @@ export function registerRuntimeDataLane(tools) {
|
|
|
2702
2707
|
portalRulesNote: "portalRulesExecuted 只指门户客户端的必填/控件校验未在 REST 提交时执行;服务端业务规则(含流程 end 规则)照常运行。",
|
|
2703
2708
|
requiredFields: validation.requiredFields,
|
|
2704
2709
|
missingRequired: validation.missingRequired,
|
|
2710
|
+
requiredFace: validation.requiredFace,
|
|
2711
|
+
...(validation.requiredFace === "unavailable"
|
|
2712
|
+
? {
|
|
2713
|
+
requiredFieldsNote: "requiredFields:[] 是「必填面读不到」(sheetGet 未回 published/draftAttributesJson——模型未配自定义表单时常态),**不是「无必填」**:平台门户必填可能仍拦截运行时提交。要真值用 form.get --controls 读表单面。",
|
|
2714
|
+
}
|
|
2715
|
+
: {}),
|
|
2705
2716
|
...(validation.missingRequired.length > 0
|
|
2706
2717
|
? {
|
|
2707
2718
|
portalValidationWarning: `已提交但**未执行门户必填校验**:${validation.missingRequired.join("、")} 在发布表单里是必填,本次 formData 为空/缺省。REST runtime/form/submit 不跑门户客户端校验;如需真正阻断,请在提交前自行校验,或在服务端规则里加必填约束。`,
|
|
2708
2719
|
}
|
|
2709
2720
|
: {}),
|
|
2721
|
+
// r61 a-F16(r60a-F16):无 id 提交=平台隐式 INSERT 新行——回执此前不
|
|
2722
|
+
// 区分「新建了一行」和「推进已有行」,对账(期望 N 条 vs 实际 N+1 条)
|
|
2723
|
+
// 只能靠 data.list 复核。显式点名新建路径,新行 id 就在 readback.objectId。
|
|
2724
|
+
...(!hasWorkItem && args.bizObjectId === undefined
|
|
2725
|
+
? {
|
|
2726
|
+
createdRow: true,
|
|
2727
|
+
createdNote: "无 id/workItem 提交=新建并提交(一调完成):本次 INSERT 了新记录行,readback.objectId 即新行 id。更新已有行用 data.save(带 id)或审批链 data.submit(带 workItemId)。",
|
|
2728
|
+
}
|
|
2729
|
+
: {}),
|
|
2710
2730
|
// Round 16b (dogfood R1-R3): a submit can leave BOTH a draft row and a
|
|
2711
2731
|
// committed row, and deleting only the committed id leaves the draft
|
|
2712
2732
|
// behind (data.list still counts it). Name both ids so cleanup does not
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.51",
|
|
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.51",
|
|
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.51"
|
|
78
78
|
}
|
|
79
79
|
}
|