@stalfh233/omc-cli 0.8.13 → 0.8.15
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/artifacts.js +3 -2
- package/dist/call.js +31 -0
- package/dist/cli-output.js +19 -0
- package/dist/cli.js +186 -23
- package/dist/form-support.js +3 -1
- package/dist/human-summary.js +84 -2
- package/dist/intent/capabilities/datarule.js +126 -12
- package/dist/intent/cli.js +35 -2
- package/dist/intent/compare.js +18 -0
- package/dist/intent/plan-apply.js +19 -5
- package/dist/intent/plan-file.js +38 -0
- package/dist/intent/readback.js +3 -0
- package/dist/intent/schema.js +1 -1
- package/dist/lanes/datarule-contract.js +2 -1
- package/dist/lanes/datarule.js +59 -2
- package/dist/lanes/environment.js +43 -3
- package/dist/lanes/field-contract.js +1 -1
- package/dist/lanes/field.js +17 -2
- package/dist/lanes/form.js +1 -1
- package/dist/lanes/model-references.js +29 -1
- package/dist/lanes/runtime-data-contract.js +2 -2
- package/dist/lanes/runtime-data.js +328 -31
- package/dist/lanes/workflow.js +79 -2
- package/dist/model-purge.js +2 -13
- package/dist/mojibake.js +69 -0
- package/dist/read-shapes.js +2 -1
- package/dist/recipes/datarule.js +1 -0
- package/dist/recipes/form.js +2 -2
- package/dist/recipes/runtime-data.js +4 -4
- package/dist/stdout-pipe.js +78 -0
- package/dist/tool-types.js +10 -0
- package/dist/write.js +56 -7
- package/package.json +3 -3
- package/skills/omc-business-configuration.md +1 -1
- package/skills/omc-capabilities.md +1 -1
package/dist/artifacts.js
CHANGED
|
@@ -77,8 +77,9 @@ export function isWithinRoot(root, candidate) {
|
|
|
77
77
|
/**
|
|
78
78
|
* Resolve a WRITE target inside the configuration root (mirrors
|
|
79
79
|
* assertSafeInputPath's containment rule, but the file need not exist yet).
|
|
80
|
-
* `omc intent plan --plan-out` uses it so the written plan is
|
|
81
|
-
*
|
|
80
|
+
* `omc intent plan --plan-out` uses it so the written plan is a normal file in
|
|
81
|
+
* the config root (the plan itself is a CLI product; `intent apply` also accepts
|
|
82
|
+
* plan files from outside the root, e.g. a `--out` envelope in /tmp).
|
|
82
83
|
*
|
|
83
84
|
* Issue 06(retro 2026-11-19):Windows 用户拿系统 temp 被拒后不知道往哪写——
|
|
84
85
|
* ① 越界拒绝时错误直接给出根内**可用的绝对示例路径**(`<root>/artifacts-out/<原名>`),
|
package/dist/call.js
CHANGED
|
@@ -292,10 +292,41 @@ function readDiagnosticLine(result) {
|
|
|
292
292
|
const notes = [];
|
|
293
293
|
if (Array.isArray(result.columnsOutsideView) && result.columnsOutsideView.length > 0)
|
|
294
294
|
notes.push(`columns 只能从视图列里选:${result.columnsOutsideView.map(String).join("、")} 不在视图列里,不会返回值(扩列用 data.load 或把列加进视图)`);
|
|
295
|
+
const unprojectedNote = unprojectedSummaryNote(result);
|
|
296
|
+
if (unprojectedNote !== undefined)
|
|
297
|
+
notes.push(unprojectedNote);
|
|
295
298
|
if (typeof result.dateReadbackNote === "string" && result.dateReadbackNote.length > 0)
|
|
296
299
|
notes.push(result.dateReadbackNote);
|
|
297
300
|
return notes.length > 0 ? notes.join(";") : null;
|
|
298
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* F5(w112 探针 H,P2):`items[].fields` 缺键像「值丢了」。行级
|
|
304
|
+
* `items[].unprojected` 是权威点名,但 compact 外置 items 后行内证据不在信封里,
|
|
305
|
+
* 所以优先用 handler 给的 `unprojectedFieldCount`(同一份行级证据的跨行并集),
|
|
306
|
+
* 内联态再回落到读 `items[].unprojected` / `projectionHint.unprojected`。
|
|
307
|
+
* 人类行只在这个数 >0 时出现,全投影读保持零噪音。
|
|
308
|
+
*/
|
|
309
|
+
function unprojectedSummaryNote(result) {
|
|
310
|
+
let count = typeof result.unprojectedFieldCount === "number" && result.unprojectedFieldCount > 0 ? result.unprojectedFieldCount : 0;
|
|
311
|
+
if (count === 0 && Array.isArray(result.items)) {
|
|
312
|
+
const codes = new Set();
|
|
313
|
+
for (const item of result.items) {
|
|
314
|
+
if (item === null || typeof item !== "object")
|
|
315
|
+
continue;
|
|
316
|
+
const rowCodes = item.unprojected;
|
|
317
|
+
if (Array.isArray(rowCodes))
|
|
318
|
+
for (const code of rowCodes)
|
|
319
|
+
codes.add(String(code));
|
|
320
|
+
}
|
|
321
|
+
count = codes.size;
|
|
322
|
+
}
|
|
323
|
+
if (count === 0) {
|
|
324
|
+
const hint = result.projectionHint;
|
|
325
|
+
if (hint !== undefined && Array.isArray(hint.unprojected))
|
|
326
|
+
count = hint.unprojected.length;
|
|
327
|
+
}
|
|
328
|
+
return count > 0 ? `${count} 个未投影字段已省略(items[].unprojected),真值用 data.load` : undefined;
|
|
329
|
+
}
|
|
299
330
|
export function validateAgentPaths(args) {
|
|
300
331
|
const root = resolve(process.env.OMC_CONFIG_HOME ?? process.cwd());
|
|
301
332
|
const visit = (value, key) => {
|
package/dist/cli-output.js
CHANGED
|
@@ -6,6 +6,21 @@ import { isWithinRoot } from "./artifacts.js";
|
|
|
6
6
|
import { asciiStdout, serializeEnvelope } from "./cli-contract.js";
|
|
7
7
|
import { currentUsageCommand, priorRepeatedFailures, recordUsageOutput } from "./usage-log.js";
|
|
8
8
|
let options = { quiet: false, verbose: false };
|
|
9
|
+
/**
|
|
10
|
+
* Probe I F1/F2(0.8.15):`--out` 是全局的「完整信封落盘」开关,stdout 只回
|
|
11
|
+
* `{out,bytes}` 小回执——调用方看不出落盘文件能不能直接用。由知道产物语义的
|
|
12
|
+
* 命令(如 `intent plan`)挂一句下一步,回执即可自解释。一次性消费(同
|
|
13
|
+
* noteOutProjection),避免同进程多次写回串味。
|
|
14
|
+
*/
|
|
15
|
+
let outReceiptHint;
|
|
16
|
+
export function setOutReceiptHint(hint) {
|
|
17
|
+
outReceiptHint = hint;
|
|
18
|
+
}
|
|
19
|
+
function takeOutReceiptHint() {
|
|
20
|
+
const hint = outReceiptHint;
|
|
21
|
+
outReceiptHint = undefined;
|
|
22
|
+
return hint;
|
|
23
|
+
}
|
|
9
24
|
let outProjectionNote;
|
|
10
25
|
/** 记录一次「`--out` + 投影」的组合;下一个 writeEnvelope 消费它。 */
|
|
11
26
|
export function noteOutProjection(note) {
|
|
@@ -262,6 +277,7 @@ export function writeEnvelope(value) {
|
|
|
262
277
|
// 一次性消费:投影说明只属于**本次**调用,任何后续 writeEnvelope(批量/复合
|
|
263
278
|
// 命令同进程多次写回)都必须回到既有的 `--out` 语义。
|
|
264
279
|
const projection = takeOutProjection();
|
|
280
|
+
const receiptHint = takeOutReceiptHint();
|
|
265
281
|
// `--out-file`(issue 2026-11-18 §08.2):完整信封以 raw UTF-8 原子落盘,
|
|
266
282
|
// stdout 只回小回执。它在 compactForOutput 之前分叉——文件里必须是**完整**
|
|
267
283
|
// 信封(status/requestId/error 都在),stdout 的小回执固定保留 status。
|
|
@@ -330,6 +346,7 @@ export function writeEnvelope(value) {
|
|
|
330
346
|
? {}
|
|
331
347
|
: { jqNote: `投影值 ${inlineBytes}B 超过 stdout 预算 ${projection.budget}B:完整投影已写入 --out 文件(stdout 只回指针),要看值请读该文件或缩小 --jq 路径;要放大回执用 --max-output-bytes` }),
|
|
332
348
|
},
|
|
349
|
+
...(receiptHint !== undefined ? { hint: receiptHint } : {}),
|
|
333
350
|
};
|
|
334
351
|
const receiptText = serializeEnvelope(receipt);
|
|
335
352
|
recordUsageOutput(value, Buffer.byteLength(receiptText, "utf8"), projectedBytes);
|
|
@@ -345,10 +362,12 @@ export function writeEnvelope(value) {
|
|
|
345
362
|
result: { out: options.outFile, bytes: Buffer.byteLength(pretty, "utf8") },
|
|
346
363
|
requestId: envelopeValue.requestId ?? null,
|
|
347
364
|
error: envelopeValue.error ?? null,
|
|
365
|
+
...(receiptHint !== undefined ? { hint: receiptHint } : {}),
|
|
348
366
|
}
|
|
349
367
|
: {
|
|
350
368
|
ok: envelopeValue.ok ?? true,
|
|
351
369
|
result: { out: options.outFile, bytes: Buffer.byteLength(pretty, "utf8") },
|
|
370
|
+
...(receiptHint !== undefined ? { hint: receiptHint } : {}),
|
|
352
371
|
};
|
|
353
372
|
const confirmationText = serializeEnvelope(confirmation);
|
|
354
373
|
recordUsageOutput(value, Buffer.byteLength(confirmationText, "utf8"), Buffer.byteLength(pretty, "utf8"));
|
package/dist/cli.js
CHANGED
|
@@ -24,8 +24,9 @@ import { cmdProgrammingAdopt, cmdProgrammingApply, cmdProgrammingPull, cmdProgra
|
|
|
24
24
|
import { environmentWritable, requiresProductionConfirmation } from "./environment-policy.js";
|
|
25
25
|
import { CLI_EXIT_CODES, asciiStdout, classifyResult, envelope, errorEnvelope, humanUtf8, installCodePageSafeStderr, refusalText, requestId } from "./cli-contract.js";
|
|
26
26
|
import { ownsStdout } from "./cli-stdout.js";
|
|
27
|
+
import { installStdoutPipeGuard } from "./stdout-pipe.js";
|
|
27
28
|
import { formatDoctorHumanSummary, unsupportedCapabilities } from "./version-family-gaps.js";
|
|
28
|
-
import { beginWriteFace, configureOutput, endWriteFace, humanSummary, maybeWarnMergedStreams, noteOutProjection, stripOutputFlags, writeEnvelope } from "./cli-output.js";
|
|
29
|
+
import { beginWriteFace, configureOutput, endWriteFace, humanSummary, maybeWarnMergedStreams, noteOutProjection, outputOptions, setOutReceiptHint, stripOutputFlags, writeEnvelope } from "./cli-output.js";
|
|
29
30
|
import { beginUsage, completeUsage, currentUsageArgsDigest, ensureProjectIgnore, priorIdenticalSuccess, recordUsageOutput, usageReport } from "./usage-log.js";
|
|
30
31
|
import { artifactFetchHint, artifactRoot, boundResult, emitInvalid, emitResult, emitThrown, emitTransportResult, outputBudget, readArtifact, withTransport, } from "./command-transport.js";
|
|
31
32
|
import { CLI_DEFAULT_OUTPUT_BYTES, assertSafeOutputPath, pruneArtifacts } from "./artifacts.js";
|
|
@@ -34,7 +35,7 @@ import { closeWritableWindow, openWritableWindow, parseWritableTtl, sweepWritabl
|
|
|
34
35
|
import { artifactPathMissHint, nullProjectionHint, PATH_MISS_HELP_REF, UNSUPPORTED_JQ_OBJECT_HINT, partialPathMissHint, pathMissCopyableHint, pathMissCopyablePaths, pathMissCrossFaceCorrection, pathMissDidYouMean, projectJsonPath, projectJsonPathFanout, projectResultExtract, shapeOf, SHAPE_MAX_DEPTH, unwrapSinglePathProjection } from "./path-projection.js";
|
|
35
36
|
import { isUncertainWireError } from "./support.js";
|
|
36
37
|
import { containerKeyOf } from "./read.js";
|
|
37
|
-
import {
|
|
38
|
+
import { dirname, join, resolve } from "node:path";
|
|
38
39
|
import { existsSync, readFileSync, writeFileSync, chmodSync, mkdirSync } from "node:fs";
|
|
39
40
|
import { buildToolRegistry } from "./tools.js";
|
|
40
41
|
import { parseDurationMs } from "./duration.js";
|
|
@@ -719,10 +720,12 @@ async function cmdCall(store, args) {
|
|
|
719
720
|
console.error(message);
|
|
720
721
|
// The MACHINE envelope must carry the same actionable text: agents read
|
|
721
722
|
// stdout, and the old envelope only repeated the English detail.
|
|
722
|
-
// Keep the
|
|
723
|
-
//
|
|
724
|
-
|
|
725
|
-
|
|
723
|
+
// Keep the FULL path the caller passed (resolved) in the envelope: the bare
|
|
724
|
+
// file name read like a relative path and sent the caller looking in cwd
|
|
725
|
+
// (F3, 0.8.15 probe I). The resolved path is the caller's own input, not a
|
|
726
|
+
// leaked host layout (ticket 103); it is what they must move into the root.
|
|
727
|
+
const rejectedPath = typeof argsFile === "string" ? resolve(configRoot, argsFile) : "";
|
|
728
|
+
writeEnvelope({ ...envelope("error", {}, request, { code: "invalid-input", message: outOfRoot ? `--args-file 必须位于配置根内(配置根 ${configRoot}${rejectedPath ? `;本次文件 ${rejectedPath}` : ""})。免落盘替代:--args - 从 stdin 读 JSON(echo '<json>' | omc call <tool> --args -),或把文件放进配置根后再引用;限制是为了防参数文件携带凭据被收进会话产物` : argsFile !== undefined && /must be a JSON object/.test(detail) ? `${detail};批量数组请改用 --args-list(最多 200 条,可分批执行)` : detail, retryable: false, ...(outOfRoot ? { configurationRoot: configRoot } : {}) }), resultMeta: accountMeta() });
|
|
726
729
|
return CLI_EXIT_CODES.invalidInput;
|
|
727
730
|
}
|
|
728
731
|
const registry = buildToolRegistry();
|
|
@@ -1843,6 +1846,109 @@ function pageableCommand(query, lane, kind, options) {
|
|
|
1843
1846
|
parts.push("--compact");
|
|
1844
1847
|
return parts.join(" ");
|
|
1845
1848
|
}
|
|
1849
|
+
/**
|
|
1850
|
+
* F6(w114 探针 H,真机):`omc commands --lane data` 曾回 `tools:[]`——
|
|
1851
|
+
* `--lane` 只认完整 lane id(`M2-runtime-data`),而调用方很自然写能力 id
|
|
1852
|
+
* (`data`)或短别名(`list-view`)。`commands` 是发现面,写错名义上该被
|
|
1853
|
+
* 纠正而不是空手而归:先按完整 lane id(大小写不敏感),再按能力 id /
|
|
1854
|
+
* 别名 / lane 尾段 / lane 段 / 能力操作名解析;唯一命中才展开,多候选回
|
|
1855
|
+
* candidates + 可执行命令(不猜),零候选维持原有 availableLanes 提示。
|
|
1856
|
+
*/
|
|
1857
|
+
function resolveLaneQuery(registryInput, request) {
|
|
1858
|
+
const normalize = (value) => value.trim().toLowerCase().replace(/[_\s]+/g, "-");
|
|
1859
|
+
const query = normalize(request);
|
|
1860
|
+
if (query === "")
|
|
1861
|
+
return {};
|
|
1862
|
+
const lanes = [...new Set(registryInput.map((tool) => tool.lane).filter((lane) => typeof lane === "string").map((lane) => String(lane)))].sort();
|
|
1863
|
+
const nodes = buildCapabilityOverview(registryInput);
|
|
1864
|
+
const commandFor = (lane) => `omc commands --lane ${lane}`;
|
|
1865
|
+
const toCandidates = (rows) => {
|
|
1866
|
+
const seen = new Map();
|
|
1867
|
+
for (const row of rows) {
|
|
1868
|
+
if (seen.has(row.lane))
|
|
1869
|
+
continue;
|
|
1870
|
+
seen.set(row.lane, { lane: row.lane, via: row.via, nextCommand: commandFor(row.lane) });
|
|
1871
|
+
}
|
|
1872
|
+
// 候选排序:能力名/别名证据优先于通用操作词,但 lane 段(`list` ∈
|
|
1873
|
+
// W1-list-view、`publish` ∈ form-publish-chain)必须排在能力操作名之前——
|
|
1874
|
+
// 操作名(field/form 都有 publish)会把真正按段命中的 lane 压到最后,
|
|
1875
|
+
// nextCommand 就指错(w114 复审回归)。`rule` 仍由能力名证据排第一(B1)。
|
|
1876
|
+
const rankOf = (via) => via.startsWith("capability-id") ? 1
|
|
1877
|
+
: via.startsWith("capability-alias") ? 2
|
|
1878
|
+
: via.startsWith("capability-name") ? 3
|
|
1879
|
+
: via === "lane-tail" ? 4
|
|
1880
|
+
: via === "lane-segment" ? 5
|
|
1881
|
+
: via.startsWith("capability-operation") ? 6
|
|
1882
|
+
: 7;
|
|
1883
|
+
return [...seen.values()].sort((left, right) => rankOf(left.via) - rankOf(right.via) || left.lane.localeCompare(right.lane));
|
|
1884
|
+
};
|
|
1885
|
+
// 1. Exact lane id(callers copy it from coverage/capabilities; case-insensitive
|
|
1886
|
+
// because the flag value is typed by hand).
|
|
1887
|
+
const exactLane = lanes.find((lane) => lane.toLowerCase() === query);
|
|
1888
|
+
if (exactLane !== undefined)
|
|
1889
|
+
return { lane: exactLane, via: "lane-id" };
|
|
1890
|
+
// 2. Capability id(`data` → M2-runtime-data)and its declared aliases
|
|
1891
|
+
// (`list-view` → W1-list-view, `runtime-data` → M2-runtime-data).
|
|
1892
|
+
const capability = nodes.find((node) => normalize(node.id) === query);
|
|
1893
|
+
if (capability !== undefined)
|
|
1894
|
+
return { lane: capability.lane, via: "capability-id" };
|
|
1895
|
+
const alias = nodes.find((node) => node.aliases.some((entry) => normalize(entry) === query));
|
|
1896
|
+
if (alias !== undefined)
|
|
1897
|
+
return { lane: alias.lane, via: "capability-alias" };
|
|
1898
|
+
// 3. Equality against the lane's tail(M2-runtime-data → runtime-data)、any
|
|
1899
|
+
// lane segment(W1-list-view → list / view)、a capability operation name
|
|
1900
|
+
// (`list`/`aggregate` are task words, not lane ids), or a capability
|
|
1901
|
+
// name that CONTAINS the query(`rule` ∈ businessrule / datarule). All
|
|
1902
|
+
// axes are unioned first: `data` is unique(M2 only, exact id wins
|
|
1903
|
+
// earlier), while `list` legitimately matches W1-list-view AND every
|
|
1904
|
+
// capability whose operations include `list`, and `rule` matches the
|
|
1905
|
+
// rule-lifecycle lane segment plus businessrule/datarule — those
|
|
1906
|
+
// ambiguities must be reported, not silently guessed(旧版把 `rule`
|
|
1907
|
+
// 静默解析到 S25-rule-lifecycle,用户多半要的是 B1 的 rule.save).
|
|
1908
|
+
const tailOf = (lane) => normalize(lane.replace(/^[A-Za-z]+\d+[-_]/, ""));
|
|
1909
|
+
const segmentsOf = (lane) => lane.toLowerCase().split("-").filter(Boolean);
|
|
1910
|
+
const equality = [];
|
|
1911
|
+
for (const lane of lanes) {
|
|
1912
|
+
if (tailOf(lane) === query)
|
|
1913
|
+
equality.push({ lane, via: "lane-tail" });
|
|
1914
|
+
if (segmentsOf(lane).includes(query))
|
|
1915
|
+
equality.push({ lane, via: "lane-segment" });
|
|
1916
|
+
}
|
|
1917
|
+
for (const node of nodes) {
|
|
1918
|
+
if (node.operations.some((operation) => normalize(operation) === query))
|
|
1919
|
+
equality.push({ lane: node.lane, via: `capability-operation:${normalize(query)}` });
|
|
1920
|
+
// 只做「能力名包含查询词」的并入(≥3 字符:2 字符碎片 bi/mo/in 会静默
|
|
1921
|
+
// 命中半个注册表;`rule` 4 字符不受影响,`js` 走 lane 段等值)。
|
|
1922
|
+
if (query.length >= 3 && (normalize(node.id).includes(query) || node.aliases.some((entry) => normalize(entry).includes(query)))) {
|
|
1923
|
+
equality.push({ lane: node.lane, via: `capability-name:${normalize(node.id)}` });
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
const equalityCandidates = toCandidates(equality);
|
|
1927
|
+
if (equalityCandidates.length === 1)
|
|
1928
|
+
return { lane: equalityCandidates[0].lane, via: equalityCandidates[0].via };
|
|
1929
|
+
if (equalityCandidates.length > 1)
|
|
1930
|
+
return { candidates: equalityCandidates };
|
|
1931
|
+
// 4. Prefix fallback for typed shortcuts(≥3 chars; `online` → online-js).
|
|
1932
|
+
if (query.length >= 3) {
|
|
1933
|
+
const prefixed = [];
|
|
1934
|
+
for (const lane of lanes) {
|
|
1935
|
+
if (tailOf(lane).startsWith(query) || segmentsOf(lane).some((segment) => segment.startsWith(query)))
|
|
1936
|
+
prefixed.push({ lane, via: "lane-prefix" });
|
|
1937
|
+
}
|
|
1938
|
+
for (const node of nodes) {
|
|
1939
|
+
if (normalize(node.id).startsWith(query))
|
|
1940
|
+
prefixed.push({ lane: node.lane, via: "capability-id-prefix" });
|
|
1941
|
+
if (node.aliases.some((entry) => normalize(entry).startsWith(query)))
|
|
1942
|
+
prefixed.push({ lane: node.lane, via: "capability-alias-prefix" });
|
|
1943
|
+
}
|
|
1944
|
+
const prefixCandidates = toCandidates(prefixed);
|
|
1945
|
+
if (prefixCandidates.length === 1)
|
|
1946
|
+
return { lane: prefixCandidates[0].lane, via: prefixCandidates[0].via };
|
|
1947
|
+
if (prefixCandidates.length > 1)
|
|
1948
|
+
return { candidates: prefixCandidates };
|
|
1949
|
+
}
|
|
1950
|
+
return {};
|
|
1951
|
+
}
|
|
1846
1952
|
/**
|
|
1847
1953
|
* ambiguous 的出口(issue 03):命中 >10 且头部近平局时,除了「行已按分数排序」
|
|
1848
1954
|
* 还要给一条真能跑的收窄命令。级联:top3 同能力 → --capability;同 kind →
|
|
@@ -1942,6 +2048,11 @@ function cmdDiscovery(kind, transport, value, options = {}) {
|
|
|
1942
2048
|
// 显式分页——三者都能单独触发这个面。
|
|
1943
2049
|
if (options.filter !== undefined || options.lane !== undefined || kindFilter !== undefined || pagingActive) {
|
|
1944
2050
|
const tools = inventory.tools;
|
|
2051
|
+
// F6(w114 探针 H):`--lane` 接受完整 lane id(大小写不敏感)以及能力 id /
|
|
2052
|
+
// 别名 / 尾段 / 段 / 操作名(`data` → M2-runtime-data)。唯一命中才生效;
|
|
2053
|
+
// 多候选下面回 candidates,零候选保留 availableLanes。
|
|
2054
|
+
const laneResolution = options.lane !== undefined ? resolveLaneQuery(registry, options.lane) : undefined;
|
|
2055
|
+
const effectiveLane = laneResolution?.lane;
|
|
1945
2056
|
// r19 ticket 05: semantic filter — capability language(聚合/字典/业务集成)
|
|
1946
2057
|
// must locate tools, not dead-end on a name-substring miss.
|
|
1947
2058
|
const semantic = options.filter !== undefined ? filterTools(registry, options.filter) : undefined;
|
|
@@ -1951,7 +2062,7 @@ function cmdDiscovery(kind, transport, value, options = {}) {
|
|
|
1951
2062
|
const semanticByName = semantic ? new Map(semantic.map((hit) => [hit.name, hit])) : undefined;
|
|
1952
2063
|
const scoreOf = (name) => semanticByName?.get(name)?.score ?? Number.NEGATIVE_INFINITY;
|
|
1953
2064
|
const matched = tools.filter((tool) => {
|
|
1954
|
-
if (options.lane !== undefined && tool.lane !==
|
|
2065
|
+
if (options.lane !== undefined && tool.lane !== effectiveLane)
|
|
1955
2066
|
return false;
|
|
1956
2067
|
if (kindFilter !== undefined && tool.kind !== kindFilter)
|
|
1957
2068
|
return false;
|
|
@@ -1967,7 +2078,13 @@ function cmdDiscovery(kind, transport, value, options = {}) {
|
|
|
1967
2078
|
}
|
|
1968
2079
|
inventory.filtered = {
|
|
1969
2080
|
filter: options.filter ?? null,
|
|
1970
|
-
|
|
2081
|
+
// 多候选时没有唯一 lane:回 null + candidates(不把原始查询伪装成 lane)。
|
|
2082
|
+
lane: effectiveLane ?? (laneResolution?.candidates !== undefined ? null : options.lane ?? null),
|
|
2083
|
+
// 只有「不是完整 lane id」的自动解析才加这一行,`--lane field-families`
|
|
2084
|
+
// 这类既有调用逐字节不变(golden master 钉住)。
|
|
2085
|
+
...(laneResolution?.via !== undefined && laneResolution.via !== "lane-id" && effectiveLane !== undefined
|
|
2086
|
+
? { laneResolution: { query: options.lane, lane: effectiveLane, via: laneResolution.via } }
|
|
2087
|
+
: {}),
|
|
1971
2088
|
// issue 03:只在有 --kind/--read-only 时出现(无 kind 的既有面逐字节不变)。
|
|
1972
2089
|
...(kindFilter !== undefined ? { kind: kindFilter } : {}),
|
|
1973
2090
|
matched: matched.length,
|
|
@@ -2035,13 +2152,32 @@ function cmdDiscovery(kind, transport, value, options = {}) {
|
|
|
2035
2152
|
// match plus governance prose pushed the agent back to the 20 KB face).
|
|
2036
2153
|
// r73 探针01-P2(2026-11-17):`--lane read` 这类不存在的 lane 回
|
|
2037
2154
|
// tools:[] 且没有任何下一步——列合法 lane 清单,别让调用方全量拉再自己汇总。
|
|
2038
|
-
|
|
2155
|
+
// F6(w114 探针 H):多候选(`--lane list` 同时像 list-view 与含 list 操作的
|
|
2156
|
+
// 能力)不猜,回可执行候选;只有一个候选的解析已在上面生效,不落到这里。
|
|
2157
|
+
if (matched.length === 0 && options.lane !== undefined && laneResolution?.candidates !== undefined) {
|
|
2158
|
+
const candidates = laneResolution.candidates;
|
|
2159
|
+
const filtered = inventory.filtered;
|
|
2160
|
+
filtered.candidates = candidates;
|
|
2161
|
+
inventory.note = `--lane "${options.lane}" 不是唯一的 lane:匹配到 ${candidates.length} 个(候选含 lane 与匹配依据)。不猜,先按 nextCommand 选一个完整 lane id 再展开;完整 lane 形如 B1-businessrule / W1-list-view / M2-runtime-data,能力→lane 映射用 omc capabilities`;
|
|
2162
|
+
inventory.nextCommand = candidates[0].nextCommand;
|
|
2163
|
+
}
|
|
2164
|
+
else if (matched.length === 0 && options.lane !== undefined && semantic === undefined) {
|
|
2039
2165
|
const availableLanes = [...new Set(registry.map((tool) => tool.lane).filter((lane) => typeof lane === "string").map((lane) => String(lane)))].sort();
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2166
|
+
const filtered = inventory.filtered;
|
|
2167
|
+
filtered.availableLanes = availableLanes;
|
|
2168
|
+
if (effectiveLane !== undefined) {
|
|
2169
|
+
// lane 本身解析成功却零行:真实原因是 --kind 把该 lane 的工具全滤掉了
|
|
2170
|
+
// (`--lane report --kind meta`)。别让调用方去改 lane 名。
|
|
2171
|
+
inventory.note = `--lane "${options.lane}" 已解析为 ${effectiveLane},但${kindFilter !== undefined ? ` --kind ${kindFilter} ` : "本次筛选"}下没有工具——lane 本身可解析,去掉 --kind 或换 kind 再看`;
|
|
2172
|
+
inventory.nextCommand = `omc commands --lane ${effectiveLane}`;
|
|
2173
|
+
}
|
|
2174
|
+
else {
|
|
2175
|
+
// 零候选:短名也解析不出来。文案不能再说「必须是完整 id」(短名可用)。
|
|
2176
|
+
inventory.note = `--lane "${options.lane}" 没有工具。lane 可用完整 id(大小写不敏感,形如 B1-businessrule / W1-list-view / M2-runtime-data)或能唯一解析的短名(能力 id/别名,如 data、list-view);也可能是 --kind 滤空。合法 lane:${availableLanes.join("、")};能力→lane 映射用 omc capabilities(或 --filter <能力词> 按语义找)`;
|
|
2177
|
+
inventory.nextCommand = "omc capabilities";
|
|
2178
|
+
}
|
|
2043
2179
|
}
|
|
2044
|
-
if (matched.length === 0 && semantic !== undefined) {
|
|
2180
|
+
if (matched.length === 0 && semantic !== undefined && laneResolution?.candidates === undefined) {
|
|
2045
2181
|
delete inventory.governance;
|
|
2046
2182
|
// r59 Step 1: candidates are CAPABILITIES, not tool names. The old
|
|
2047
2183
|
// closest match over tool names answered an unmet business ask with
|
|
@@ -2466,17 +2602,18 @@ async function cmdIntentPlan(file, environment, planOut, transport, summary = fa
|
|
|
2466
2602
|
return emitInvalid(transport, { message: error instanceof Error ? error.message : String(error) });
|
|
2467
2603
|
}
|
|
2468
2604
|
}
|
|
2469
|
-
|
|
2605
|
+
let result = await planIntent(read.intent, environment, planOut);
|
|
2470
2606
|
// a-F12(r60a-F12,r61):--summary 档只回决策字段 + 逐项变更(tool+reason+资源
|
|
2471
2607
|
// 键,去 args/baselineFingerprint)。内联完整 plan 一个真实需求 ~20KB、含基线
|
|
2472
2608
|
// 50–60KB——探针只要「会改什么」时被整块计费。要 apply 仍用完整 plan(不带
|
|
2473
2609
|
// --summary,或 --plan-out 写复核文件)。
|
|
2610
|
+
let summaryProjected = false;
|
|
2474
2611
|
if (summary) {
|
|
2475
2612
|
const plan = result.plan;
|
|
2476
2613
|
if (plan !== undefined && Array.isArray(plan.changes)) {
|
|
2477
2614
|
// r62c-F3(P0-4):resource 用编译器的资源标识(`field:model.code`),不从
|
|
2478
2615
|
// args 猜——猜会降级成模型 code,3 个 field.create 无法区分(探针真机撞上)。
|
|
2479
|
-
|
|
2616
|
+
result = {
|
|
2480
2617
|
...result,
|
|
2481
2618
|
plan: undefined,
|
|
2482
2619
|
changesBrief: plan.changes.map((change) => ({
|
|
@@ -2485,10 +2622,29 @@ async function cmdIntentPlan(file, environment, planOut, transport, summary = fa
|
|
|
2485
2622
|
...(change.resource !== undefined ? { resource: change.resource } : {}),
|
|
2486
2623
|
})),
|
|
2487
2624
|
summaryNote: "--summary 只回变更清单(去 args/基线);apply 用完整 plan(不带 --summary 或 --plan-out <file>)",
|
|
2488
|
-
}
|
|
2625
|
+
};
|
|
2626
|
+
summaryProjected = true;
|
|
2489
2627
|
}
|
|
2490
2628
|
// 已外置/已写文件的分支本就是决策字段面——原样返回。
|
|
2491
2629
|
}
|
|
2630
|
+
// Probe I F1/F2(0.8.15):`--out` 落的是完整 CLI 信封,stdout 只有小回执。
|
|
2631
|
+
// 回执必须自解释——但必须在 summary 投影**之后**看 result:summary 会剥掉
|
|
2632
|
+
// plan(只留 changesBrief),此前分档会把摘要信封误称「自动取 result.plan」。
|
|
2633
|
+
// 大 plan 则只有 planFile/planArtifactId(result.plan 不存在),各成一档。
|
|
2634
|
+
const outFile = outputOptions().outFile;
|
|
2635
|
+
if (outFile !== undefined && result.status === "ok") {
|
|
2636
|
+
const receipt = result;
|
|
2637
|
+
const outPath = resolve(outFile);
|
|
2638
|
+
const planFile = typeof receipt.planFile === "string" ? receipt.planFile : undefined;
|
|
2639
|
+
const planArtifactId = typeof receipt.planArtifactId === "string" ? receipt.planArtifactId : undefined;
|
|
2640
|
+
setOutReceiptHint(summaryProjected
|
|
2641
|
+
? `该信封是 --summary 摘要产物(不含 plan):apply 请去掉 --summary 重跑 intent plan,或用 result.planArtifactId(omc intent apply ${planArtifactId ?? planFile ?? "<planArtifactId>"})`
|
|
2642
|
+
: receipt.plan !== undefined
|
|
2643
|
+
? `该文件是完整 CLI 信封,可直接 omc intent apply ${outPath}(apply 自动取 result.plan);要裸 plan 用 --plan-out`
|
|
2644
|
+
: planFile !== undefined || planArtifactId !== undefined
|
|
2645
|
+
? `该信封里 plan 已外置(result.plan 不存在):直接 omc intent apply ${planFile ?? planArtifactId}${planFile !== undefined ? "(planFile 在 result.planFile)" : "(planArtifactId 在 result.planArtifactId)"}`
|
|
2646
|
+
: "该信封不含 plan:apply 请重跑 intent plan(不要 --summary);要落盘复核用 --plan-out");
|
|
2647
|
+
}
|
|
2492
2648
|
return emitResult(result, transport);
|
|
2493
2649
|
}
|
|
2494
2650
|
/** Ticket 120 — `omc intent readback <file> --env <env>`: decode the live baseline back into intent shape and verify equivalence. */
|
|
@@ -2767,17 +2923,21 @@ async function cmdIntentApply(planPath, options, transport) {
|
|
|
2767
2923
|
emit: (result) => emitResult(result, transport),
|
|
2768
2924
|
invalid: (blocker, message, code = "invalid-input") => emitInvalid(transport, { message, blocker, code }),
|
|
2769
2925
|
readIntent: (file) => {
|
|
2770
|
-
let
|
|
2926
|
+
let text;
|
|
2771
2927
|
try {
|
|
2772
|
-
|
|
2928
|
+
text = readIntentFile(intentConfigRoot(), file);
|
|
2773
2929
|
}
|
|
2774
|
-
catch {
|
|
2775
|
-
|
|
2930
|
+
catch (error) {
|
|
2931
|
+
// Probe I 复核:意图源(YAML)在配置根外时,先给根限制/可执行修法,
|
|
2932
|
+
// 不把 JSON.parse 的 `Unexpected token` 当主因(plan 文件可在根外)。
|
|
2933
|
+
return { kind: "invalid", message: `意图源 YAML 必须在配置根内(plan JSON 文件不受此限):${error instanceof Error ? error.message : String(error)}` };
|
|
2776
2934
|
}
|
|
2935
|
+
const outcome = validateIntentText(text);
|
|
2777
2936
|
if (!outcome.valid || outcome.intent === undefined) {
|
|
2778
2937
|
for (const error of outcome.errors)
|
|
2779
2938
|
console.error(`intent ${file}:${error.line}:${error.column} [${error.code}] ${error.message}`);
|
|
2780
|
-
|
|
2939
|
+
const detail = outcome.errors.map((error) => `${file}:${error.line}:${error.column} [${error.code}] ${error.message}`).join(";");
|
|
2940
|
+
return { kind: "invalid", message: `意图 YAML 校验失败:${detail}` };
|
|
2781
2941
|
}
|
|
2782
2942
|
return { kind: "ok", intent: outcome.intent };
|
|
2783
2943
|
},
|
|
@@ -3921,7 +4081,7 @@ async function main() {
|
|
|
3921
4081
|
// C6(0.8.4):--jq 的 miss 默认只回结论;排查载荷(available/correctPath/
|
|
3922
4082
|
// 成因 hint)统一由 --explain 开关,call/artifact get/发现面同口径。
|
|
3923
4083
|
const explainOption = () => new Option("--explain", "--jq 未命中时给出完整排查载荷(available 该层全部键、correctPath、nextCommand、成因 hint);默认 miss 只回 missedAt/didYouMean/helpRef");
|
|
3924
|
-
command.command("commands").description("路由索引(不是目录):工具计数+展开梯子;--kind read 一屏列全部只读工具与必填参数;--json 才是全量目录").option("--json").option("--compact").option("--inline", "commands --json 超过 32KiB 时仍内联").option("--filter <keyword>").option("--capability <id>").option("--lane <id>").option("--kind <kind>", "按读写维度过滤:read|write|meta(read = 只读工具索引)").option("--read-only", "等价 --kind read(与 --kind 互斥)").option("--limit <n>", "分页:最多 n 行(1..200;给定即关闭宽词分组)").option("--offset <n>", "分页起点(默认 0;未给 --limit 时按 50)").option("--max-output-bytes <bytes>").addOption(jqOption()).addOption(explainOption()).action(async (options) => { commandExitCode = await withTransport(options, request, (transport) => cmdDiscovery("commands", transport, undefined, { json: options.json === true, compact: options.compact === true, inline: options.inline === true, ...(options.filter ? { filter: options.filter } : {}), ...(options.capability ? { capability: options.capability } : {}), ...(options.lane ? { lane: options.lane } : {}), ...(options.kind !== undefined ? { kind: options.kind } : {}), ...(options.readOnly === true ? { readOnly: true } : {}), ...(options.limit !== undefined ? { limit: options.limit } : {}), ...(options.offset !== undefined ? { offset: options.offset } : {}), ...(options.jq !== undefined ? { jq: options.jq } : {}), explain: options.explain === true })); }); // C2(0.8.4):describe 是零环境接触的发现面,但 `--env` 是"人人都以为通用"的
|
|
4084
|
+
command.command("commands").description("路由索引(不是目录):工具计数+展开梯子;--kind read 一屏列全部只读工具与必填参数;--json 才是全量目录").option("--json").option("--compact").option("--inline", "commands --json 超过 32KiB 时仍内联").option("--filter <keyword>").option("--capability <id>").option("--lane <id>", "按 lane 过滤(完整 id 大小写不敏感;也接受能力 id/别名如 data、list-view;多候选会列出)").option("--kind <kind>", "按读写维度过滤:read|write|meta(read = 只读工具索引)").option("--read-only", "等价 --kind read(与 --kind 互斥)").option("--limit <n>", "分页:最多 n 行(1..200;给定即关闭宽词分组)").option("--offset <n>", "分页起点(默认 0;未给 --limit 时按 50)").option("--max-output-bytes <bytes>").addOption(jqOption()).addOption(explainOption()).action(async (options) => { commandExitCode = await withTransport(options, request, (transport) => cmdDiscovery("commands", transport, undefined, { json: options.json === true, compact: options.compact === true, inline: options.inline === true, ...(options.filter ? { filter: options.filter } : {}), ...(options.capability ? { capability: options.capability } : {}), ...(options.lane ? { lane: options.lane } : {}), ...(options.kind !== undefined ? { kind: options.kind } : {}), ...(options.readOnly === true ? { readOnly: true } : {}), ...(options.limit !== undefined ? { limit: options.limit } : {}), ...(options.offset !== undefined ? { offset: options.offset } : {}), ...(options.jq !== undefined ? { jq: options.jq } : {}), explain: options.explain === true })); }); // C2(0.8.4):describe 是零环境接触的发现面,但 `--env` 是"人人都以为通用"的
|
|
3925
4085
|
// flag——与 `next` 同处理:接受并忽略(不因反射性传参被 unknown option 打回)。
|
|
3926
4086
|
command.command("describe <tool>").option("--env <environment>", "接受并忽略:describe 零环境接触(参数表与运行时无关)").option("--environment <environment>", "同 --env(接受并忽略)").option("--full").option("--cache-ok", "允许 --full 在同会话重复读时短路为 artifact 指针(默认每次回全文)").option("--schema-only").option("--param <name>").option("--example [id]").option("--max-output-bytes <bytes>").addOption(jqOption()).addOption(explainOption()).action(async (tool, options) => {
|
|
3927
4087
|
commandExitCode = await withTransport(options, request, (transport) => cmdDiscovery("describe", transport, tool, { full: options.full === true, cacheOk: options.cacheOk === true, schemaOnly: options.schemaOnly === true, ...(options.param ? { param: options.param } : {}), ...(options.example ? { example: options.example } : {}), ...(options.jq !== undefined ? { jq: options.jq } : {}), explain: options.explain === true }));
|
|
@@ -3956,7 +4116,7 @@ async function main() {
|
|
|
3956
4116
|
command.command("capability <id>").option("--executable").option("--max-output-bytes <bytes>").addOption(jqOption()).addOption(explainOption()).action(async (id, options) => {
|
|
3957
4117
|
commandExitCode = await withTransport(options, request, (transport) => cmdCapability(id, transport, options.executable === true, options.jq, options.explain === true));
|
|
3958
4118
|
});
|
|
3959
|
-
const intentCommand = command.command("intent").description("声明式意图面(Spec 107):intent.yaml → validate → plan → apply → readback
|
|
4119
|
+
const intentCommand = command.command("intent").description("声明式意图面(Spec 107):intent.yaml → validate → plan → apply → readback。**意图源文件(validate/plan/readback)必须位于配置根内**(与 --args-file 同规则:根外一律拒绝);**plan 文件(apply 的输入)是 CLI 产物、不含凭据,可在任意路径**(含 /tmp 与 `--out` 落下的完整信封)").addHelpText("after", "\n意图源文件(validate/plan/readback 的 <file>)解析到配置根内——配置根外一律 invalid-input(与 call --args-file 同规则)。plan 文件不走该限制:apply 接受根外路径、裸 plan、以及 `intent plan ... --out <file>` 的完整信封(自动取 result.plan);`intent plan --plan-out` 仍写配置根内。\n");
|
|
3960
4120
|
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); });
|
|
3961
4121
|
intentCommand.command("validate <file>").option("--show-intent").action((file, options) => { commandExitCode = cmdIntentValidate(file, { request, maxOutputBytes: CLI_DEFAULT_OUTPUT_BYTES }, options.showIntent === true); });
|
|
3962
4122
|
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) => {
|
|
@@ -4074,6 +4234,9 @@ function finish(code) {
|
|
|
4074
4234
|
process.exitCode = code;
|
|
4075
4235
|
setTimeout(() => process.exit(code), 1000).unref();
|
|
4076
4236
|
}
|
|
4237
|
+
// F10(0.8.15):下游 `head`/`grep -q` 提前关闭管道时,EPIPE 是消费方叫停,
|
|
4238
|
+
// 不是故障——安静 exit 0,别让未处理的流错误在 `2>&1` 合流里变成假挂起。
|
|
4239
|
+
installStdoutPipeGuard();
|
|
4077
4240
|
const request = requestId();
|
|
4078
4241
|
main().then((code) => {
|
|
4079
4242
|
// Commands that own their stdout never grow a trailing envelope. The list is
|
package/dist/form-support.js
CHANGED
|
@@ -894,7 +894,9 @@ export function assertLayoutRequestConflicts(args) {
|
|
|
894
894
|
schemaCode: String(args.schemaCode ?? ""),
|
|
895
895
|
sheetCode: String(args.sheetCode ?? args.schemaCode ?? ""),
|
|
896
896
|
conflictKeys,
|
|
897
|
-
message: `layout 与 ${conflictKeys.join("、")} 互斥:layout 是增量面(以已发布表单为基线,只改这些控件的行分组与 span),不要同时回传整包 attrs/view
|
|
897
|
+
message: `layout 与 ${conflictKeys.join("、")} 互斥:layout 是增量面(以已发布表单为基线,只改这些控件的行分组与 span),不要同时回传整包 attrs/view、不要重建;二选一。${conflictKeys.includes("childColumns")
|
|
898
|
+
? "子表列要先物化进已发布表单,正确顺序:① 先 `form.publish {rebuild:true}` 把子表列物化进已发布表单;② 再 `form.draft {layout}`(baseline=published);③ 再 `form.publish`。"
|
|
899
|
+
: ""}`,
|
|
898
900
|
});
|
|
899
901
|
}
|
|
900
902
|
/**
|
package/dist/human-summary.js
CHANGED
|
@@ -130,6 +130,16 @@ export function writeSummary(tool, args, outcome, phase = "done") {
|
|
|
130
130
|
const pending = Object.entries(perCode).filter(([, value]) => value?.absent === false).map(([code]) => code);
|
|
131
131
|
return `未删净(级联中)${pending.length > 0 ? pending.join("、") : "部分模型"}:平台异步删除任务未完成,记录面仍查得到——不要当作已删除;按 perCode 逐项复核,稍后重跑 model.deleteMany(幂等)`;
|
|
132
132
|
}
|
|
133
|
+
// P1(探针 I,0.8.15):删前读不到 ≠ 已清理。schemaCode 写错时 id 实际在另一个
|
|
134
|
+
// 模型里,回执曾是 status:ok + already-absent。人类摘要必须同样以否定开头。
|
|
135
|
+
if (phase === "done" && tool === "data.delete" && outcome?.readback?.blocker === "delete-target-not-in-schema") {
|
|
136
|
+
const listed = Array.isArray(outcome.readback.notInSchema) ? outcome.readback.notInSchema.map(String) : [];
|
|
137
|
+
const ids = listed.length > 0
|
|
138
|
+
? listed
|
|
139
|
+
: [(Array.isArray(args.bizObjectIds) ? String(args.bizObjectIds[0]) : undefined) ?? stringArg(args, "bizObjectId") ?? "?"];
|
|
140
|
+
const schema = stringArg(args, "schemaCode") ?? "?";
|
|
141
|
+
return `未确认删除(delete-target-not-in-schema)${ids.length} 条不属于 ${schema}:${ids.join("、")};本工具无法判定归属——先 model.list 取候选模型再逐个 data.list 核对(或问用户),别据此宣称已清理`;
|
|
142
|
+
}
|
|
133
143
|
// r28b F11: data.delete already-absent must NOT read as「已删除…」— humans/CI
|
|
134
144
|
// that skim stderr treat the leading verb as the outcome. Say「未删除」first.
|
|
135
145
|
if (phase === "done" && tool === "data.delete" && outcome?.performed?.skipped === "already-absent") {
|
|
@@ -273,10 +283,36 @@ function phraseOf(tool, args, outcome) {
|
|
|
273
283
|
// submit 被静默吞掉。summary 必须看 outcome:被拒就说被拒。
|
|
274
284
|
{
|
|
275
285
|
const submitRefused = outcome?.readback?.submitRefused;
|
|
286
|
+
// F2(w112 探针 H):普通 save 落在「有已发布流程 + 未带 workflowCode」时,
|
|
287
|
+
// 这行没有流程实例、之后永远提交不了。摘要行必须与 readback.workflowInstanceNote
|
|
288
|
+
// 同源,不能再说「加 submit:true 一调完成态」。
|
|
289
|
+
const workflowInstanceNote = outcome?.readback?.workflowInstanceNote;
|
|
290
|
+
// 更新行有独立键(workflowUpdateNote):对更新行说「重建流程草稿」是错的,
|
|
291
|
+
// 摘要必须分开表达。
|
|
292
|
+
const workflowUpdateNote = outcome?.readback?.workflowUpdateNote;
|
|
293
|
+
const workflowCheckSkipped = outcome?.readback?.workflowCheckSkipped;
|
|
276
294
|
// F8(w63):平台按模型「数据标题」覆盖显式传入的 name,摘要行必须抬头。
|
|
277
295
|
const nameNote = readbackNoteClause(outcome, "nameOverwrittenNote");
|
|
278
296
|
if (args.submit === true && submitRefused !== undefined) {
|
|
279
|
-
|
|
297
|
+
// 更新行不得复用「重建流程草稿」口径(会诱导多建一行)。
|
|
298
|
+
if (workflowUpdateNote !== undefined) {
|
|
299
|
+
return `保存数据(模型 ${schemaCode ?? "?"})——submit:true 被拒(${submitRefused.blocker ?? "?"}):更新既有行,不会创建/改动流程实例;推进用 workitem.list → data.submit 三件套;指引进 readback.workflowUpdateNote${nameNote}`;
|
|
300
|
+
}
|
|
301
|
+
return `保存数据(模型 ${schemaCode ?? "?"})——submit:true 被拒(${submitRefused.blocker ?? "?"}):模型有已发布流程,行保持草稿 DRAFT;重建流程草稿的指引进 readback.submitRefused${nameNote}`;
|
|
302
|
+
}
|
|
303
|
+
if (workflowUpdateNote !== undefined) {
|
|
304
|
+
return `保存数据(模型 ${schemaCode ?? "?"})——更新既有行,不创建/改动流程实例;流程模型上保存的直提标志会被拒,推进该行用 workitem.list → data.submit 三件套(不要为触发规则/推进流程再 data.save)${nameNote}`;
|
|
305
|
+
}
|
|
306
|
+
if (workflowInstanceNote !== undefined) {
|
|
307
|
+
return `保存数据(模型 ${schemaCode ?? "?"})——普通草稿、无流程实例,不能提交;要可提交请用 data.save 带 workflowCode:"${workflowInstanceNote.workflowCode ?? "<wf>"}" 重建流程草稿(formData 不要带 id)${nameNote}`;
|
|
308
|
+
}
|
|
309
|
+
if (workflowCheckSkipped !== undefined) {
|
|
310
|
+
// 更新行不能再劝 data.save workflowCode(会多建一行)——只指复核面 + 现有待办。
|
|
311
|
+
const formDataId = args.formData !== null && typeof args.formData === "object" ? args.formData.id : undefined;
|
|
312
|
+
if (typeof formDataId === "string" && formDataId.length > 0) {
|
|
313
|
+
return `保存数据(模型 ${schemaCode ?? "?"})——本次未能确认是否有已发布流程(见 workflowCheckSkipped);更新既有行请先复核流程面(workflow.get_published / rule.references)+ workitem.list 看现有待办,不要为确认流程再 data.save 一次${nameNote}`;
|
|
314
|
+
}
|
|
315
|
+
return `保存数据(模型 ${schemaCode ?? "?"})——本次未能确认是否有已发布流程(见 workflowCheckSkipped),先复核流程面再决定 submit:true 或 data.save workflowCode${nameNote}`;
|
|
280
316
|
}
|
|
281
317
|
// r68 链2-D1(真机实证):带 workflowCode 存的是**流程草稿**,但通用草稿文案教
|
|
282
318
|
// 「加 submit:true」——流程模型会被拒;正确下一步是 data.submit 三件套。
|
|
@@ -297,7 +333,53 @@ function phraseOf(tool, args, outcome) {
|
|
|
297
333
|
// F4(w71,0.8.10):显式传 name 但被平台「数据标题」覆盖时,摘要行与
|
|
298
334
|
// data.save 同口径抬头(JSON 字段 readback.nameOverwrittenNote)。
|
|
299
335
|
const nameNote = readbackNoteClause(outcome, "nameOverwrittenNote");
|
|
300
|
-
|
|
336
|
+
// F4(w114 探针 H,真机):审批通过后 readback 已给
|
|
337
|
+
// workItemState:"none-flow-completed" / sequenceStatus:"COMPLETED" /
|
|
338
|
+
// decision:"APPROVE",summary 却只看 args.workItemId 就说「审批待办」——
|
|
339
|
+
// 人读到的是「流程走完了还在等审批」。摘要状态必须由回执决定:
|
|
340
|
+
// - none-flow-completed 或 COMPLETED/APPROVED → 流程已完成
|
|
341
|
+
// - 驳回(decision:"REJECT"):完成态说「流程已结束(驳回)」,
|
|
342
|
+
// pending 态说「已驳回(退回 X)」
|
|
343
|
+
// - nextWorkItems 非空 → 审批待办(可点名下一节点)
|
|
344
|
+
// - 回执没有状态字段(plan 阶段/旧回执)→ 保留原口径
|
|
345
|
+
const readback = outcome?.readback;
|
|
346
|
+
const workItemState = typeof readback?.workItemState === "string" ? readback.workItemState : undefined;
|
|
347
|
+
const sequenceStatus = typeof readback?.sequenceStatus === "string" ? readback.sequenceStatus : undefined;
|
|
348
|
+
const nextWorkItems = Array.isArray(readback?.nextWorkItems) ? readback.nextWorkItems : [];
|
|
349
|
+
const finishedStatus = sequenceStatus !== undefined && /^(COMPLETED|APPROVED)$/i.test(sequenceStatus);
|
|
350
|
+
const rejected = typeof readback?.decision === "string" && /^REJECT$/i.test(readback.decision);
|
|
351
|
+
const nextActivity = nextWorkItems.length > 0
|
|
352
|
+
? (() => {
|
|
353
|
+
const first = nextWorkItems[0];
|
|
354
|
+
const name = typeof first?.activityName === "string" ? first.activityName : undefined;
|
|
355
|
+
return name ?? (typeof first?.activityCode === "string" ? first.activityCode : undefined);
|
|
356
|
+
})()
|
|
357
|
+
: undefined;
|
|
358
|
+
// 驳回可能没有 nextWorkItems(退回节点不在当前登录人名下 → pending-elsewhere,
|
|
359
|
+
// 真相在 readback.returnedTo / flowWarning.activityName)。退回目标按这个优先级取。
|
|
360
|
+
const returnedTo = readback?.returnedTo;
|
|
361
|
+
const returnTarget = nextActivity
|
|
362
|
+
?? (typeof returnedTo?.activityName === "string" ? returnedTo.activityName : undefined)
|
|
363
|
+
?? (typeof returnedTo?.activityCode === "string" ? returnedTo.activityCode : undefined)
|
|
364
|
+
?? (typeof flowWarning?.activityName === "string" ? flowWarning.activityName : undefined)
|
|
365
|
+
?? (typeof flowWarning?.activityCode === "string" ? flowWarning.activityCode : undefined)
|
|
366
|
+
?? "上一节点";
|
|
367
|
+
const stateClause = workItemState === "none-flow-completed" || (finishedStatus && workItemState !== "none-no-workflow")
|
|
368
|
+
? rejected ? ",流程已结束(驳回)" : ",流程已完成"
|
|
369
|
+
: finishedStatus
|
|
370
|
+
// 无流程模型直提:完成的是数据提交,别宣称「流程」已走完。
|
|
371
|
+
? ",提交已完成(无流程)"
|
|
372
|
+
// 驳回判定必须在 nextWorkItems 之前:pending-elsewhere/无待办时
|
|
373
|
+
// 退回信息只在 returnedTo/flowWarning,旧顺序会退化成「审批待办」。
|
|
374
|
+
: rejected
|
|
375
|
+
? `,已驳回(退回 ${returnTarget})`
|
|
376
|
+
: nextWorkItems.length > 0
|
|
377
|
+
? `,审批待办${nextActivity !== undefined ? `:下一节点 ${nextActivity}` : ""}`
|
|
378
|
+
// 回执未给状态(plan 阶段/旧回执):保留原有按参数判定的口径。
|
|
379
|
+
: stringArg(args, "workItemId")
|
|
380
|
+
? ",审批待办"
|
|
381
|
+
: "";
|
|
382
|
+
return `提交数据(模型 ${schemaCode ?? "?"}${stateClause})${warnTag}${nameNote}`;
|
|
301
383
|
}
|
|
302
384
|
case "data.delete": {
|
|
303
385
|
const ids = Array.isArray(args.bizObjectIds) ? args.bizObjectIds.map(String) : [];
|