@stalfh233/omc-cli 0.8.2 → 0.8.4
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/bench/call-face-eval.js +1 -1
- package/dist/bench/scenario.js +3 -3
- package/dist/cli-contract.js +55 -2
- package/dist/cli-output.js +59 -8
- package/dist/cli.js +338 -59
- package/dist/field-families.js +19 -9
- package/dist/form-layout.js +19 -4
- package/dist/form-support.js +181 -9
- package/dist/graph.js +151 -29
- package/dist/intent/capabilities/field.js +98 -0
- package/dist/intent/plan-apply.js +9 -0
- package/dist/lanes/app.js +34 -6
- package/dist/lanes/field.js +360 -94
- package/dist/lanes/form.js +27 -5
- package/dist/lanes/model.js +42 -11
- package/dist/lanes/runtime-data.js +93 -4
- package/dist/lanes/workflow-contract.js +1 -1
- package/dist/lanes/workflow.js +30 -14
- package/dist/path-projection.js +25 -14
- package/dist/read.js +132 -3
- package/dist/refusal-guidance.js +14 -0
- package/dist/session.js +30 -2
- package/dist/support.js +3 -1
- package/dist/wire-failure.js +120 -0
- package/dist/wire.js +109 -5
- package/dist/workflow-support.js +41 -0
- package/package.json +3 -3
package/dist/lanes/form.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ENDPOINTS } from "../endpoints.js";
|
|
3
3
|
import { decodeButtonScript } from "./list-view.js";
|
|
4
|
-
import { executeFormDraftWrite, executeFormPublishWrite, executeFormRunButtonWrite, lintFormPublishReadOnly, readFormButtons, readFormOrNull, refuseEmptyCallerLayout, validateHtmlRender, customButtonJsonStoredShape, CUSTOM_BUTTON_JSON_STRING_SHAPE_WARNING } from "../form-support.js";
|
|
4
|
+
import { executeFormDraftWrite, executeFormPublishWrite, executeFormRunButtonWrite, lintFormPublishReadOnly, readFormButtons, readFormOrNull, refuseEmptyCallerLayout, validateHtmlRender, customButtonJsonStoredShape, CUSTOM_BUTTON_JSON_STRING_SHAPE_WARNING, FORM_FLAG_AUTHORITY_NOTE, compareFormFaces, resolveEffectiveFormFace } from "../form-support.js";
|
|
5
5
|
import { capabilityArg, environmentArg } from "../args.js";
|
|
6
6
|
import { governedRead } from "../read.js";
|
|
7
7
|
import { writeTool } from "../write.js";
|
|
@@ -183,21 +183,38 @@ export function registerFormLane(tools) {
|
|
|
183
183
|
const platformPublished = sheet.published === true;
|
|
184
184
|
const platformDraft = sheet.existDraft === true;
|
|
185
185
|
const flagMismatch = platformPublished !== publishedPresent || platformDraft !== draftPresent;
|
|
186
|
+
// B5(issue 2026-11-25):两套口径(旗标 vs faces)并列时调用方还得二次推理
|
|
187
|
+
// 「到底发布没发布」。给单一结论字段(规则与证据见 form-support 的
|
|
188
|
+
// resolveEffectiveFormFace),旗标矛盾时再补一句「以谁为准」。
|
|
189
|
+
// B5-2(真机 2.1.5):inSync 必须比**四对**面(view/attributes/html/actions,
|
|
190
|
+
// 平台 AppIntegrationFacadeImpl:2670 同口径);只比 view 时「草稿改了字段标签」
|
|
191
|
+
// 会误判成 published。比较用规范化语义等值,见 compareFormFaces。
|
|
192
|
+
const faceSync = compareFormFaces(sheet, { draftPresent, publishedPresent });
|
|
193
|
+
const faceVerdict = resolveEffectiveFormFace({
|
|
194
|
+
draftPresent,
|
|
195
|
+
publishedPresent,
|
|
196
|
+
inSync: faceSync.inSync,
|
|
197
|
+
differingFaces: faceSync.differingFaces,
|
|
198
|
+
});
|
|
186
199
|
const base = {
|
|
187
200
|
schemaCode: args.schemaCode,
|
|
188
201
|
sheetCode,
|
|
189
202
|
present: true,
|
|
190
203
|
published: platformPublished,
|
|
191
204
|
existDraft: platformDraft,
|
|
205
|
+
effectiveFace: faceVerdict.effectiveFace,
|
|
206
|
+
effectiveFaceNote: faceVerdict.effectiveFaceNote,
|
|
192
207
|
faces: {
|
|
193
208
|
draft: { present: draftPresent, controlCount: draftCodes.length },
|
|
194
209
|
published: { present: publishedPresent, controlCount: publishedCodes.length },
|
|
195
|
-
inSync:
|
|
210
|
+
inSync: faceSync.inSync,
|
|
211
|
+
...(faceSync.inSync === false ? { differingFaces: faceSync.differingFaces } : {}),
|
|
196
212
|
},
|
|
197
213
|
...(flagMismatch
|
|
198
214
|
? {
|
|
199
215
|
flagMismatch: true,
|
|
200
|
-
flagNote: "平台布尔与内容不一致:published/existDraft 来自 bizsheet/get 的标记位,faces 由 draft/published
|
|
216
|
+
flagNote: "平台布尔与内容不一致:published/existDraft 来自 bizsheet/get 的标记位,faces 由 draft/published 的 view/attributes/html/actions 四份布局面内容规范化比较推导。判「现在有几面」以 faces 为准;判「能否被运行时读到」以 published 为准(平台可能未刷新标记)。" +
|
|
217
|
+
FORM_FLAG_AUTHORITY_NOTE,
|
|
201
218
|
}
|
|
202
219
|
: {}),
|
|
203
220
|
};
|
|
@@ -493,10 +510,14 @@ export function registerFormLane(tools) {
|
|
|
493
510
|
const buttons = readFormButtons(record.options) ?? [];
|
|
494
511
|
const publishedActions = parseActionEntries(record.publishedActionsJson);
|
|
495
512
|
const flagMismatch = (record.published === true) !== publishedPresent || (record.existDraft === true) !== draftPresent;
|
|
513
|
+
// B5-2:与 form.get 同源(四对面语义比较),列表 detail 面不得另有一套判据。
|
|
514
|
+
const faceSync = compareFormFaces(record, { draftPresent, publishedPresent });
|
|
515
|
+
const faceVerdict = resolveEffectiveFormFace({ draftPresent, publishedPresent, inSync: faceSync.inSync, differingFaces: faceSync.differingFaces });
|
|
496
516
|
detailed.push({
|
|
497
517
|
...publicSheet,
|
|
498
518
|
present: true,
|
|
499
519
|
existDraft: record.existDraft === true,
|
|
520
|
+
effectiveFace: faceVerdict.effectiveFace,
|
|
500
521
|
controlCount: draftCodes.length,
|
|
501
522
|
buttonCount: buttons.length,
|
|
502
523
|
...("parseError" in publishedActions ? { publishedActionParseError: true } : { publishedActionCount: publishedActions.count }),
|
|
@@ -504,12 +525,13 @@ export function registerFormLane(tools) {
|
|
|
504
525
|
faces: {
|
|
505
526
|
draft: { present: draftPresent, controlCount: draftCodes.length },
|
|
506
527
|
published: { present: publishedPresent, controlCount: publishedCodes.length },
|
|
507
|
-
inSync:
|
|
528
|
+
inSync: faceSync.inSync,
|
|
529
|
+
...(faceSync.inSync === false ? { differingFaces: faceSync.differingFaces } : {}),
|
|
508
530
|
},
|
|
509
531
|
...(flagMismatch
|
|
510
532
|
? {
|
|
511
533
|
flagMismatch: true,
|
|
512
|
-
flagNote: "平台旗标与内容不一致:published/existDraft 来自 bizsheet/get 的标记位,faces
|
|
534
|
+
flagNote: "平台旗标与内容不一致:published/existDraft 来自 bizsheet/get 的标记位,faces 由 view/attributes/html/actions 四份布局面内容规范化比较推导。判「现在有几面」以 faces 为准;判「运行时能否读到」以 published 为准。" + FORM_FLAG_AUTHORITY_NOTE,
|
|
513
535
|
}
|
|
514
536
|
: {}),
|
|
515
537
|
});
|
package/dist/lanes/model.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ENDPOINTS } from "../endpoints.js";
|
|
3
|
-
import { assertFieldFamilyAllowed, assertSelectionChoicesAllowed, choicesArg, fieldOptionsArg, nameI18nJson, propertyTypeArg, relationTargetOf, relativeCodeArg, SYSTEM_FIELD_CODES, subFieldArg,
|
|
4
|
-
import { modelSchemaCodes } from "./field.js";
|
|
3
|
+
import { assertFieldFamilyAllowed, assertSelectionChoicesAllowed, choicesArg, fieldOptionsArg, nameI18nJson, propertyTypeArg, relationTargetOf, relativeCodeArg, SYSTEM_FIELD_CODES, subFieldArg, } from "../field-families.js";
|
|
4
|
+
import { modelSchemaCodes, lintFieldCreateWrite } from "./field.js";
|
|
5
5
|
import { fieldChangeWireBody, prepareFieldChange, sameFieldChange } from "../field-change.js";
|
|
6
6
|
import { executeFormDraftWrite, executeFormPublishWrite } from "../form-support.js";
|
|
7
7
|
import { mapBounded } from "../support.js";
|
|
@@ -1518,12 +1518,26 @@ export function registerModelLane(tools) {
|
|
|
1518
1518
|
execute: async (session, args) => {
|
|
1519
1519
|
const results = [];
|
|
1520
1520
|
const entries = fieldEntriesOf(args);
|
|
1521
|
-
//
|
|
1522
|
-
//
|
|
1523
|
-
//
|
|
1521
|
+
// 0.8.4 P0(W17 审计):configure_model 的 fields[] 曾只跑
|
|
1522
|
+
// assertRelationTargetExists,于是非法关联 mappings 与自引用/子表聚合
|
|
1523
|
+
// 绕过了 field.create 的语义门,直接写进平台。现在整包在**任何写 wire
|
|
1524
|
+
// 之前**走同一个 lintFieldCreateWrite;同包声明但尚未落库的字段作为
|
|
1525
|
+
// 本模型读面一起参与判定(新模型的发布面此时还是空的)。
|
|
1524
1526
|
const relationCandidates = await modelSchemaCodes(session);
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
+
const gateTargetVersion = session.detectedVersion();
|
|
1528
|
+
const pendingOwnFields = entries.map((entry) => ({ code: entry.code, propertyType: entry.propertyType }));
|
|
1529
|
+
const preparedEntries = [];
|
|
1530
|
+
for (const [index, entry] of entries.entries()) {
|
|
1531
|
+
const input = fieldChangeInputOf(args.code, entry, { targetVersion: gateTargetVersion });
|
|
1532
|
+
try {
|
|
1533
|
+
preparedEntries.push(await lintFieldCreateWrite(session, input, { relationCandidates, pendingOwnFields }));
|
|
1534
|
+
}
|
|
1535
|
+
catch (error) {
|
|
1536
|
+
if (!(error instanceof ToolRefusalError))
|
|
1537
|
+
throw error;
|
|
1538
|
+
throw configureModelFieldGateRefusal(index, entry, error);
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1527
1541
|
const stop = (index, tool, error) => {
|
|
1528
1542
|
const envelope = error instanceof ToolRefusalError
|
|
1529
1543
|
? Object.fromEntries(Object.entries(error.payload).filter(([key]) => key !== "status"))
|
|
@@ -1594,9 +1608,8 @@ export function registerModelLane(tools) {
|
|
|
1594
1608
|
draftFields.set(code, row);
|
|
1595
1609
|
}
|
|
1596
1610
|
}
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1599
|
-
const input = fieldChangeInputOf(args.code, entry, { targetVersion: configureTargetVersion });
|
|
1611
|
+
for (const [index, entry] of entries.entries()) {
|
|
1612
|
+
const input = fieldChangeInputOf(args.code, entry, { targetVersion: gateTargetVersion });
|
|
1600
1613
|
failed = await run(results.length, "field.create", async () => {
|
|
1601
1614
|
const existing = existingFields.get(entry.code);
|
|
1602
1615
|
if (existing !== undefined) {
|
|
@@ -1612,7 +1625,7 @@ export function registerModelLane(tools) {
|
|
|
1612
1625
|
message: `字段 ${args.code}.${entry.code} 已存在且形状与请求不同;configure_model 只创建缺失字段,不改写既有字段。先核对既有形状(omc call field.list --args '{"schemaCode":"${args.code}","published":false,"code":"${entry.code}"}'),要改写走 field.update,要新字段就换 code`,
|
|
1613
1626
|
});
|
|
1614
1627
|
}
|
|
1615
|
-
const prepared =
|
|
1628
|
+
const prepared = preparedEntries[index];
|
|
1616
1629
|
const performed = await wireCall(session, { path: ENDPOINTS.fieldCreate, method: "POST", body: fieldChangeWireBody(input, prepared) });
|
|
1617
1630
|
createdOptions.set(entry.code, prepared.options);
|
|
1618
1631
|
const after = wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: args.code, isPublish: "false" } })).data);
|
|
@@ -1744,4 +1757,22 @@ function fieldChangeInputOf(schemaCode, entry, scope = {}) {
|
|
|
1744
1757
|
...(entry.propertyEmpty !== undefined ? { propertyEmpty: entry.propertyEmpty } : {}),
|
|
1745
1758
|
};
|
|
1746
1759
|
}
|
|
1760
|
+
/**
|
|
1761
|
+
* 0.8.4 P0:`configure_model` 的字段包未过 `field.create` 同一道语义门时,
|
|
1762
|
+
* 回执要能直接定位到包里的哪一项。blocker 与 field.create 完全同形(同门产物,
|
|
1763
|
+
* 不另造一套),另加 `fields[{index,code}]` + `fieldIndex/fieldCode`。
|
|
1764
|
+
*/
|
|
1765
|
+
function configureModelFieldGateRefusal(index, entry, error) {
|
|
1766
|
+
const { status: _status, ...detail } = error.payload;
|
|
1767
|
+
const blocker = String(error.payload.blocker ?? "configure-model-field-gate-refused");
|
|
1768
|
+
return new ToolRefusalError({
|
|
1769
|
+
...detail,
|
|
1770
|
+
status: "refused",
|
|
1771
|
+
blocker,
|
|
1772
|
+
fieldIndex: index,
|
|
1773
|
+
fieldCode: entry.code,
|
|
1774
|
+
fields: [{ index, code: entry.code, blocker }],
|
|
1775
|
+
message: `configure_model fields[${index}](${entry.code})未过 field.create 同一道写前语义门:${String(error.payload.message ?? "")}`,
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1747
1778
|
//# sourceMappingURL=model.js.map
|
|
@@ -11,12 +11,12 @@ import { defineTool } from "../tool-types.js";
|
|
|
11
11
|
import { wireCall, wireRows, WireError } from "../wire.js";
|
|
12
12
|
import { CHILD_TABLE_PROPERTY_TYPE, diagnoseApprovalSubmitIdentity, runtimeWriteWithAppMapping } from "../runtime-support.js";
|
|
13
13
|
import { closestMatch } from "../closest-match.js";
|
|
14
|
-
import { getInstanceBaseInfo, getReplayToken, listInstanceActivities, resolveBizObjectIdByInstance, searchWorkItems, wireString } from "../workflow-support.js";
|
|
14
|
+
import { getInstanceBaseInfo, getReplayToken, isFinishedInstanceStatus, listInstanceActivities, resolveBizObjectIdByInstance, searchWorkItems, wireString } from "../workflow-support.js";
|
|
15
15
|
import { PLATFORM_ADMIN_START_BYPASS, resolvePermissionActor } from "../identity.js";
|
|
16
16
|
import { ENGINE_OWNED_KEYS, RUNTIME_DATA_LANE_CONTRACT, RUNTIME_DATA_WIRE, runtimeFormDataArg, } from "./runtime-data-contract.js";
|
|
17
17
|
import { scanPages } from "./runtime-paging.js";
|
|
18
18
|
import { decodeJsonColumn, JSON_COLUMN_NULL_COALESCE } from "../json-column.js";
|
|
19
|
-
import { SYSTEM_FIELD_CODES, familyName } from "../field-families.js";
|
|
19
|
+
import { FIELD_PROPERTY_TYPES, SYSTEM_FIELD_CODES, familyName } from "../field-families.js";
|
|
20
20
|
import { applicationResolutionOf, resolveApplicationScope } from "../support.js";
|
|
21
21
|
/** r29b F8: keep ids/itemsPreview through governedRead's compact diet. */
|
|
22
22
|
const DATA_LIST_PREVIEW_LIMIT = 20;
|
|
@@ -394,6 +394,65 @@ export function projectionHintFace(items, evidence) {
|
|
|
394
394
|
...(unprojected.length > 0 ? { unprojected } : {}),
|
|
395
395
|
};
|
|
396
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* B2(issue 2026-11-25,真机 `milestone_ledger`):`data.list` 对关联字段静默回
|
|
399
|
+
* null,而同一条记录 `data.load` 有真实值(`{id, displayCode, <显示字段>}`)。
|
|
400
|
+
*
|
|
401
|
+
* 平台事实(两棵树同形,见 B2 证据表):
|
|
402
|
+
* - 列表 SELECT 只取视图列:`BizFilter.toFilter` 只把 displayFields 里
|
|
403
|
+
* `hasRealColumn()` 的列放进 SELECT(8.6.26 `BizFilter.java:62-74` /
|
|
404
|
+
* 2.1.5 `BizFilter.java:60-72`);`display` 缺省 false → 列集 = 视图
|
|
405
|
+
* queryColumns(`BizObjectFacadeImpl.java:4697` → `handleQueryColumn:4155-4185`;
|
|
406
|
+
* 2.1.5 `:2216` → `:1830-1860`;`QueryDataModel.display` 默认 false,`:70/:98-103`)。
|
|
407
|
+
* - 行对象为**每个已发布属性**建 BizField(8.6.26 `BizObject.createBizObject:158-170` /
|
|
408
|
+
* 2.1.5 `:127-145`),关联字段只 setOriginDbValue;没查出来的列 originDbValue=null,
|
|
409
|
+
* 值留在 null → wire 上是「键在、值 null」,**不是键缺席**
|
|
410
|
+
* (`WorkSheetBizField.contentFromRelatedObject:55-73` 只在 originDbValue 非空时由
|
|
411
|
+
* `WorkSheetFieldFiller` 填充:8.6.26 `:77-121` / 2.1.5 `:61-106`)。
|
|
412
|
+
* `BizObject.toObjectMap` 遍历整个 dataMap(8.6.26 `:309-316` / 2.1.5 `:280-288`)。
|
|
413
|
+
*
|
|
414
|
+
* 因此「关联列 null」有两种互斥含义,必须能区分:
|
|
415
|
+
* - 视图列里没有该列 → 平台根本没查 → **未投影**(本回执点名 + 给 data.load);
|
|
416
|
+
* - 视图列里有该列而值为 null → 关联确实没值 → 保留 null,**不算**未投影。
|
|
417
|
+
* 判据只用 queryColumns 清单(或请求列在 wire 行里缺席),不拿 null 猜。
|
|
418
|
+
*/
|
|
419
|
+
const RELATION_PROPERTY_TYPES = new Set([
|
|
420
|
+
FIELD_PROPERTY_TYPES.WORK_SHEET,
|
|
421
|
+
FIELD_PROPERTY_TYPES.MULT_WORK_SHEET,
|
|
422
|
+
FIELD_PROPERTY_TYPES.RELEVANCE_DATA,
|
|
423
|
+
]);
|
|
424
|
+
/**
|
|
425
|
+
* 全 null 且判为「未投影」的列:请求列在 wire 行里整列缺席(键缺席 = 平台没返回),
|
|
426
|
+
* 或(有 queryColumns 证据时)不在视图列清单里。两路证据都没有 → 不列(null 不猜)。
|
|
427
|
+
*/
|
|
428
|
+
export function unprojectedNullColumns(items, projectionMiss, viewColumnCodes) {
|
|
429
|
+
if (items.length === 0)
|
|
430
|
+
return [];
|
|
431
|
+
const codes = new Set();
|
|
432
|
+
for (const item of items)
|
|
433
|
+
for (const code of Object.keys(item.fields))
|
|
434
|
+
codes.add(code);
|
|
435
|
+
const inView = viewColumnCodes === undefined ? undefined : new Set(viewColumnCodes);
|
|
436
|
+
const missed = new Set(projectionMiss);
|
|
437
|
+
return [...codes].filter((code) => {
|
|
438
|
+
if (!items.every((item) => item.fields[code] === null))
|
|
439
|
+
return false;
|
|
440
|
+
if (missed.has(code))
|
|
441
|
+
return true;
|
|
442
|
+
return inView !== undefined && !inView.has(code);
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
/** 未投影列里只保留关联/引用类字段,并给出可复制的 data.load 复核命令。 */
|
|
446
|
+
export function relationColumnsNotProjected(codes, relationCodes, schemaCode, sampleId) {
|
|
447
|
+
const id = typeof sampleId === "string" && sampleId.trim() !== "" ? sampleId : "<bizObjectId>";
|
|
448
|
+
return codes
|
|
449
|
+
.filter((code) => relationCodes.has(code))
|
|
450
|
+
.map((code) => ({
|
|
451
|
+
code,
|
|
452
|
+
reason: "relation-column-not-projected",
|
|
453
|
+
nextCommand: `omc call data.load --env <env> --args '{"schemaCode":"${schemaCode}","bizObjectId":"${id}"}'`,
|
|
454
|
+
}));
|
|
455
|
+
}
|
|
397
456
|
/**
|
|
398
457
|
* data.list 的视图证据读取(query/get 失败/无视图 → undefined = 无证据)。
|
|
399
458
|
* 拿到 queryColumns 数组才算可判定证据;视图对象在但 queryColumns 非数组 →
|
|
@@ -749,8 +808,10 @@ knownBizObjectId = null) {
|
|
|
749
808
|
* ② 必须真读回该实例上一个 PENDING 待办(且唯一);
|
|
750
809
|
* ③ 调用方自己没指定 workItemId(指定了就交回用户决定,工具不替人挑);
|
|
751
810
|
* ④ 读回有一面失败就不动(readback-failed)。
|
|
811
|
+
*
|
|
812
|
+
* 导出供回归测试直接钉住终态判据(0.8.3:APPROVED/TOPPING_OFF 也是「已结束」)。
|
|
752
813
|
*/
|
|
753
|
-
function judgeSubmitLanding(evidence, requestedWorkItemId) {
|
|
814
|
+
export function judgeSubmitLanding(evidence, requestedWorkItemId) {
|
|
754
815
|
if (!evidence.workflowInstanceId)
|
|
755
816
|
return { kind: "unresolved", reason: "no-instance" };
|
|
756
817
|
if (evidence.readbackFailed)
|
|
@@ -760,7 +821,10 @@ function judgeSubmitLanding(evidence, requestedWorkItemId) {
|
|
|
760
821
|
if (!draft) {
|
|
761
822
|
// 只有「运行中/已结束」能支撑「这一笔已经推进」;EXCEPTION/PAUSE 之类的
|
|
762
823
|
// 非 DRAFT 状态不算证据(实例停住和提没提交是两件事),交回人工。
|
|
763
|
-
|
|
824
|
+
// 已结束必须走 isFinishedInstanceStatus:读面终态是 APPROVED/TOPPING_OFF
|
|
825
|
+
// (COMPLETED 只是存储列,见 workflow-support.ts 的投影依据),只比
|
|
826
|
+
// COMPLETED 会把正常终结的实例误判成「instance-not-running」。
|
|
827
|
+
if (/PROCESSING|RUNNING|ACTIVE|FINISHED/i.test(status) || isFinishedInstanceStatus(status))
|
|
764
828
|
return { kind: "already-submitted" };
|
|
765
829
|
return { kind: "unresolved", reason: "instance-not-running" };
|
|
766
830
|
}
|
|
@@ -1584,6 +1648,27 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1584
1648
|
publishedTypes = new Map((await publishedFields()).map((row) => [row.code, row.type]));
|
|
1585
1649
|
return publishedTypes;
|
|
1586
1650
|
};
|
|
1651
|
+
/**
|
|
1652
|
+
* B2(issue 2026-11-25):关联/引用列「未投影」点名。只在确实有全 null 列、
|
|
1653
|
+
* 且已判为未投影(键缺席或不在视图列)时才读一次已发布字段元数据(复用
|
|
1654
|
+
* `publishedFields` 缓存;过滤路径已读过则零新增 wire)。全为 null 但有视图
|
|
1655
|
+
* 列证据 = 关联无值,保留 null、不进本清单。
|
|
1656
|
+
*/
|
|
1657
|
+
const relationNotProjectedOf = async (items, projectionMiss, viewColumnCodes) => {
|
|
1658
|
+
const candidates = unprojectedNullColumns(items, projectionMiss, viewColumnCodes);
|
|
1659
|
+
if (candidates.length === 0)
|
|
1660
|
+
return [];
|
|
1661
|
+
let catalog;
|
|
1662
|
+
try {
|
|
1663
|
+
catalog = await publishedFields();
|
|
1664
|
+
}
|
|
1665
|
+
catch {
|
|
1666
|
+
// 元数据读失败:宁可不说,也不拿 null 猜(读面不能因此失败)。
|
|
1667
|
+
return [];
|
|
1668
|
+
}
|
|
1669
|
+
const relationCodes = new Set(catalog.filter((row) => RELATION_PROPERTY_TYPES.has(row.type)).map((row) => row.code));
|
|
1670
|
+
return relationColumnsNotProjected(candidates, relationCodes, args.schemaCode, items[0]?.id);
|
|
1671
|
+
};
|
|
1587
1672
|
/**
|
|
1588
1673
|
* M2: 平台 301005 是 `BIZ_PROPERTY_NOT_EXIST`(数据项不存在),不天然等于
|
|
1589
1674
|
* 「空模型」。只有**已发布字段数为 0** 才是真空模型(可安全降级 total:0);
|
|
@@ -1848,6 +1933,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1848
1933
|
// 证据链见 projectionHintFace 的源码注释。
|
|
1849
1934
|
const viewEvidence = nullProjection ? await listViewProjectionEvidence(session, args.schemaCode, args.queryCode ?? args.schemaCode) : undefined;
|
|
1850
1935
|
const projectionHintAll = projectionHintWithMiss(projectionHintFace(items, viewEvidence), projectionMissAll);
|
|
1936
|
+
const columnsNotProjected = await relationNotProjectedOf(items, projectionMissAll, viewEvidence?.viewColumnCodes);
|
|
1851
1937
|
return {
|
|
1852
1938
|
schemaCode: args.schemaCode,
|
|
1853
1939
|
...application,
|
|
@@ -1896,6 +1982,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1896
1982
|
: {}),
|
|
1897
1983
|
...(projectionHintAll !== undefined ? { projectionHint: projectionHintAll } : {}),
|
|
1898
1984
|
...(projectionMissAll.length > 0 ? { projectionMiss: projectionMissAll } : {}),
|
|
1985
|
+
...(columnsNotProjected.length > 0 ? { columnsNotProjected } : {}),
|
|
1899
1986
|
items,
|
|
1900
1987
|
};
|
|
1901
1988
|
}
|
|
@@ -2035,6 +2122,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
2035
2122
|
const hasNullValue = items.some((item) => Object.values(item.fields).some((value) => value === null));
|
|
2036
2123
|
const viewEvidence = hasNullValue ? await listViewProjectionEvidence(session, args.schemaCode, args.queryCode ?? args.schemaCode) : undefined;
|
|
2037
2124
|
const projectionHintPaged = projectionHintWithMiss(projectionHintFace(items, viewEvidence), projectionMissPaged);
|
|
2125
|
+
const columnsNotProjected = await relationNotProjectedOf(items, projectionMissPaged, viewEvidence?.viewColumnCodes);
|
|
2038
2126
|
// F6 工单 05b:只有本页行真的内联了子表数组才给一句(否则零字节);
|
|
2039
2127
|
// 取第一条命中行,命令里的 schemaCode/childSchemaCode/bizObjectId 都是真值。
|
|
2040
2128
|
const inlineChild = items
|
|
@@ -2075,6 +2163,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
2075
2163
|
...(choiceFilterFields.length > 0 && Number(total ?? 0) === 0 ? { filterValueHint: choiceFilterValueHint(choiceFilterFields) } : {}),
|
|
2076
2164
|
...(projectionHintPaged !== undefined ? { projectionHint: projectionHintPaged } : {}),
|
|
2077
2165
|
...(projectionMissPaged.length > 0 ? { projectionMiss: projectionMissPaged } : {}),
|
|
2166
|
+
...(columnsNotProjected.length > 0 ? { columnsNotProjected } : {}),
|
|
2078
2167
|
totalPages,
|
|
2079
2168
|
itemsCount: items.length,
|
|
2080
2169
|
itemsReturned: items.length,
|
|
@@ -281,7 +281,7 @@ export const WORKFLOW_LANE_CONTRACT = Object.freeze({
|
|
|
281
281
|
}),
|
|
282
282
|
"workflow.finish": Object.freeze({
|
|
283
283
|
scope: "runtime workflow admin finish instance",
|
|
284
|
-
description: "流程运维·手动结束流程(`POST /api/api/runtime/workflow/finish_instance_by_post
|
|
284
|
+
description: "流程运维·手动结束流程(`POST /api/api/runtime/workflow/finish_instance_by_post`,正常完结语义):实例完结(存储 COMPLETED + endStatus=ABORT_END ⇒ 读面 TOPPING_OFF),workflow.bindRules 的 end handler 规则照常触发(与 abort_instance 终止的本质区别——终止不保证跑规则;验证用 rule.log)。已结束实例(读面 COMPLETED/APPROVED/TOPPING_OFF)幂等拒。测试提速工具:手动结束的实例不能用于真实流程推进/权限验证。",
|
|
285
285
|
}),
|
|
286
286
|
// ── 审批动作(OpenAPI v2 面,与平台内置 MCP 的审批语义对齐)──────────────
|
|
287
287
|
// 描述按 tools/list 字节预算写成一两句:端点 + 最容易踩的那一个坑 +
|
package/dist/lanes/workflow.js
CHANGED
|
@@ -10,7 +10,7 @@ import { writeSummary } from "../human-summary.js";
|
|
|
10
10
|
import { defineTool, ToolInputError } from "../tool-types.js";
|
|
11
11
|
import { DEFAULT_SCAN_CONCURRENCY, mapWithConcurrency } from "../concurrency.js";
|
|
12
12
|
import { wireCall, wireRows, WireError } from "../wire.js";
|
|
13
|
-
import { diagnoseInstanceActivity, getInstanceBaseInfo, listInstanceActivities, listWorkItemsByParticipant, resolveBizObjectIdByInstance, searchWorkItems, wireString } from "../workflow-support.js";
|
|
13
|
+
import { diagnoseInstanceActivity, getInstanceBaseInfo, isCanceledInstanceStatus, isFinishedInstanceStatus, listInstanceActivities, listWorkItemsByParticipant, resolveBizObjectIdByInstance, searchWorkItems, wireString } from "../workflow-support.js";
|
|
14
14
|
import { readSchemaFormButtons } from "../form-support.js";
|
|
15
15
|
import { WORKFLOW_EVENT_HANDLER_FIELDS, WORKFLOW_NODE_EVENT_HANDLER_FIELDS, WORKFLOW_LANE_CONTRACT, workflowTemplateArg } from "./workflow-contract.js";
|
|
16
16
|
import { PLATFORM_TRIGGER_RULE_CODES } from "./rule-graph.js";
|
|
@@ -4898,8 +4898,11 @@ export function registerWorkflowLane(tools) {
|
|
|
4898
4898
|
if (base === null)
|
|
4899
4899
|
throw new ToolRefusalError({ status: "refused", blocker: "workflow-instance-not-found", workflowInstanceId: args.workflowInstanceId, message: `流程实例 ${args.workflowInstanceId} 不存在(get_instance_baseinfo 空)——实例 id 来自 data.submit 读回的 workflowInstanceId` });
|
|
4900
4900
|
const status = wireString(base.status);
|
|
4901
|
-
|
|
4902
|
-
|
|
4901
|
+
// 读面终态含 APPROVED(末级审批通过)/TOPPING_OFF(手动结束/超时)——
|
|
4902
|
+
// 只比 COMPLETED 会漏掉全部正常终结的实例(见 workflow-support.ts
|
|
4903
|
+
// FINISHED_INSTANCE_STATES 的平台投影依据)。
|
|
4904
|
+
if (isFinishedInstanceStatus(status))
|
|
4905
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-instance-completed", workflowInstanceId: args.workflowInstanceId, instanceStatus: status, message: `实例已结束(读面状态 ${status}),没有可换的审批人` });
|
|
4903
4906
|
const active = await activeActivitiesOf(session, args.workflowInstanceId);
|
|
4904
4907
|
if (active.length === 0)
|
|
4905
4908
|
throw new ToolRefusalError({ status: "refused", blocker: "workflow-no-active-activity", workflowInstanceId: args.workflowInstanceId, message: "实例没有任何激活节点(参与者解析失败/引擎异常),无审批人可换——先 workflow.instanceActivity 诊断" });
|
|
@@ -4990,8 +4993,8 @@ export function registerWorkflowLane(tools) {
|
|
|
4990
4993
|
if (base === null)
|
|
4991
4994
|
throw new ToolRefusalError({ status: "refused", blocker: "workflow-instance-not-found", workflowInstanceId: args.workflowInstanceId, message: `流程实例 ${args.workflowInstanceId} 不存在` });
|
|
4992
4995
|
const status = wireString(base.status);
|
|
4993
|
-
if (status
|
|
4994
|
-
throw new ToolRefusalError({ status: "refused", blocker: "workflow-instance-completed", workflowInstanceId: args.workflowInstanceId, message:
|
|
4996
|
+
if (isFinishedInstanceStatus(status))
|
|
4997
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-instance-completed", workflowInstanceId: args.workflowInstanceId, instanceStatus: status, message: `实例已结束(读面状态 ${status}),不能跳转节点` });
|
|
4995
4998
|
const rows = await listInstanceActivities(session, args.workflowInstanceId);
|
|
4996
4999
|
const known = rows.map((row) => wireString(row.activityCode));
|
|
4997
5000
|
if (!known.includes(args.activityCode))
|
|
@@ -5040,7 +5043,7 @@ export function registerWorkflowLane(tools) {
|
|
|
5040
5043
|
search: { intents: ["结束流程", "手动结束", "流程结束", "直接完结"] },
|
|
5041
5044
|
lane: WORKFLOW_LANE,
|
|
5042
5045
|
scope: "runtime workflow admin finish instance",
|
|
5043
|
-
description: "流程运维·手动结束流程(`POST /api/api/runtime/workflow/finish_instance_by_post
|
|
5046
|
+
description: "流程运维·手动结束流程(`POST /api/api/runtime/workflow/finish_instance_by_post`,发起人「结束流程」语义):实例完结(存储 COMPLETED + endStatus=ABORT_END ⇒ 读面 **TOPPING_OFF**,不是 APPROVED),**workflow.bindRules 的 end handler 规则照常触发**(这是 finish 与 abort_instance 终止的本质区别——终止不保证跑规则;验证规则跑了没有用 rule.log 查)。已结束实例(读面 COMPLETED/APPROVED/TOPPING_OFF)幂等拒。**测试提速工具**:手动结束的实例不能用于真实流程推进/权限验证;正常审批走 data.submit。",
|
|
5044
5047
|
inputSchema: {
|
|
5045
5048
|
workflowInstanceId: z.string().min(1).describe("流程实例 id"),
|
|
5046
5049
|
comment: z.string().optional().describe("结束意见(进审批记录)"),
|
|
@@ -5050,8 +5053,16 @@ export function registerWorkflowLane(tools) {
|
|
|
5050
5053
|
if (base === null)
|
|
5051
5054
|
throw new ToolRefusalError({ status: "refused", blocker: "workflow-instance-not-found", workflowInstanceId: args.workflowInstanceId, message: `流程实例 ${args.workflowInstanceId} 不存在` });
|
|
5052
5055
|
const status = wireString(base.status);
|
|
5053
|
-
|
|
5054
|
-
|
|
5056
|
+
// 幂等门(0.8.3 修复):读面终态是 APPROVED / TOPPING_OFF 时存储列也已是
|
|
5057
|
+
// COMPLETED,只比 COMPLETED 会让第二次 finish 穿门、回伪成功 ok。
|
|
5058
|
+
if (isFinishedInstanceStatus(status))
|
|
5059
|
+
throw new ToolRefusalError({
|
|
5060
|
+
status: "refused",
|
|
5061
|
+
blocker: "workflow-instance-completed",
|
|
5062
|
+
workflowInstanceId: args.workflowInstanceId,
|
|
5063
|
+
instanceStatus: status,
|
|
5064
|
+
message: `实例已结束(读面状态 ${status}),无需结束(幂等拒绝;已结束实例不再接受 finish/activate 运维动作——要再走一遍流程请新发起一笔)`,
|
|
5065
|
+
});
|
|
5055
5066
|
const activeBefore = await activeActivitiesOf(session, args.workflowInstanceId);
|
|
5056
5067
|
const performed = await wireCall(session, {
|
|
5057
5068
|
path: ENDPOINTS.workflowFinishInstance,
|
|
@@ -5060,16 +5071,19 @@ export function registerWorkflowLane(tools) {
|
|
|
5060
5071
|
});
|
|
5061
5072
|
const afterBase = await getInstanceBaseInfo(session, args.workflowInstanceId);
|
|
5062
5073
|
const afterStatus = wireString(afterBase?.status);
|
|
5074
|
+
const afterEndStatus = wireString(afterBase?.endStatus);
|
|
5063
5075
|
const afterActive = await activeActivitiesOf(session, args.workflowInstanceId);
|
|
5064
|
-
//
|
|
5065
|
-
//
|
|
5066
|
-
|
|
5076
|
+
// finish 走 finishWorkflowInstance:1066-1072,固定写 endStatus=ABORT_END →
|
|
5077
|
+
// 读面投影 COMPLETED+ABORT_END = TOPPING_OFF(不是「滞后」)。并发下若末级
|
|
5078
|
+
// 审批同时走完则读到 APPROVED——两者都是「已结束」,都算受理。
|
|
5079
|
+
const finished = isFinishedInstanceStatus(afterStatus);
|
|
5067
5080
|
return {
|
|
5068
5081
|
performed: { errcode: performed.errcode, finishedActivities: activeBefore.map((row) => row.activityCode) },
|
|
5069
5082
|
readback: {
|
|
5070
5083
|
instanceStatus: afterStatus,
|
|
5084
|
+
...(afterEndStatus !== null ? { endStatus: afterEndStatus } : {}),
|
|
5071
5085
|
finished,
|
|
5072
|
-
...(afterStatus === "TOPPING_OFF" ? { toppingOffNote: "TOPPING_OFF
|
|
5086
|
+
...(afterStatus === "TOPPING_OFF" ? { toppingOffNote: "TOPPING_OFF=收尾态:存储态 COMPLETED + endStatus=ABORT_END(finish 固定写 ABORT_END),读面按 parseStatusByInstance:459-474 投影成 TOPPING_OFF——这是正常完结,不是失败,勿重试" } : {}),
|
|
5073
5087
|
activeActivities: afterActive,
|
|
5074
5088
|
endRulesNote: "finish=正常完结语义:workflow.bindRules 绑在 end handler 的业务规则照常触发(查 rule.log / rulelog 面);abort 终止不保证跑规则——本工具不走 abort。",
|
|
5075
5089
|
boundaryNote: "测试提速工具:手动结束的实例不能用于真实流程推进/权限验证。",
|
|
@@ -5720,8 +5734,10 @@ export function registerWorkflowLane(tools) {
|
|
|
5720
5734
|
// 实例终态是 CANCELED(WorkflowInstanceStatus.java:15-22 只有
|
|
5721
5735
|
// DRAFT/PROCESSING/COMPLETED/CANCELED/EXCEPTION/APPROVED/TOPPING_OFF/PAUSE
|
|
5722
5736
|
// ——没有 VOIDED 这个实例态,VOIDED_APPROVER 是 endStatus),所以只认
|
|
5723
|
-
// CANCEL 家族;绝不能把 COMPLETED
|
|
5724
|
-
|
|
5737
|
+
// CANCEL 家族;绝不能把 COMPLETED/APPROVED/TOPPING_OFF 也算作废成功——
|
|
5738
|
+
// 那是 workflow.finish 的终态(见 workflow-support.ts 的
|
|
5739
|
+
// isFinishedInstanceStatus / isCanceledInstanceStatus 分工)。
|
|
5740
|
+
voided: isCanceledInstanceStatus(statusAfter),
|
|
5725
5741
|
endRulesNote: "作废走 cancelInstance(WorkflowEndStatus.VOIDED_APPROVER):实例终态 CANCELED,end handler 规则不保证执行;要正常完结(COMPLETED)并触发 end 规则用 workflow.finish(finish_instance_by_post)。",
|
|
5726
5742
|
},
|
|
5727
5743
|
};
|
package/dist/path-projection.js
CHANGED
|
@@ -703,7 +703,7 @@ function projectPathOnSource(source, path) {
|
|
|
703
703
|
}
|
|
704
704
|
return { ...first };
|
|
705
705
|
}
|
|
706
|
-
export function projectResultExtract(result, paths, keysOnly, retry) {
|
|
706
|
+
export function projectResultExtract(result, paths, keysOnly, retry, explain = false) {
|
|
707
707
|
const artifactId = typeof result.detailArtifactId === "string" ? result.detailArtifactId : typeof result.artifactId === "string" ? result.artifactId : undefined;
|
|
708
708
|
// Tools hand an in-process artifact as `detailFile` (a local path);
|
|
709
709
|
// command-transport later swaps it for detailArtifactId. Extraction runs
|
|
@@ -854,15 +854,21 @@ export function projectResultExtract(result, paths, keysOnly, retry) {
|
|
|
854
854
|
content: null,
|
|
855
855
|
pathMiss: true,
|
|
856
856
|
missedAt: fan.at,
|
|
857
|
-
available: fan.available,
|
|
858
|
-
...(fan.availableTruncated !== undefined ? { availableTruncated: fan.availableTruncated } : {}),
|
|
859
|
-
missedEntries: fan.missedEntries,
|
|
860
857
|
...(didYouMean !== undefined ? { didYouMean } : {}),
|
|
861
|
-
...(correction !== undefined ? { correctPath: correction.correctPath } : {}),
|
|
862
858
|
helpRef: PATH_MISS_HELP_REF,
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
859
|
+
// C6(0.8.4):默认只留「在哪断 + 最接近的键 + 教程指针」(≤300B);
|
|
860
|
+
// 整层键表/可复制路径/重跑命令/成因说明是排查载荷,只在 --explain 给。
|
|
861
|
+
...(explain
|
|
862
|
+
? {
|
|
863
|
+
available: fan.available,
|
|
864
|
+
...(fan.availableTruncated !== undefined ? { availableTruncated: fan.availableTruncated } : {}),
|
|
865
|
+
missedEntries: fan.missedEntries,
|
|
866
|
+
...(correction !== undefined ? { correctPath: correction.correctPath } : {}),
|
|
867
|
+
...(nextCommand !== undefined ? { nextCommand } : {}),
|
|
868
|
+
...(readFromArtifact ? resultLayerNote(result, path, projectionSource, fan.at) ?? {} : {}),
|
|
869
|
+
hint: missHintFor(fan.at, fan.available, correction),
|
|
870
|
+
}
|
|
871
|
+
: {}),
|
|
866
872
|
};
|
|
867
873
|
}
|
|
868
874
|
return {
|
|
@@ -898,14 +904,19 @@ export function projectResultExtract(result, paths, keysOnly, retry) {
|
|
|
898
904
|
content: null,
|
|
899
905
|
pathMiss: true,
|
|
900
906
|
missedAt: single.at,
|
|
901
|
-
available: single.available,
|
|
902
|
-
...(single.availableTruncated !== undefined ? { availableTruncated: single.availableTruncated } : {}),
|
|
903
907
|
...(didYouMean !== undefined ? { didYouMean } : {}),
|
|
904
|
-
...(correction !== undefined ? { correctPath: correction.correctPath } : {}),
|
|
905
908
|
helpRef: PATH_MISS_HELP_REF,
|
|
906
|
-
|
|
907
|
-
...(
|
|
908
|
-
|
|
909
|
+
// C6(0.8.4):见 fanout 同款说明——默认只留结论,排查载荷在 --explain。
|
|
910
|
+
...(explain
|
|
911
|
+
? {
|
|
912
|
+
available: single.available,
|
|
913
|
+
...(single.availableTruncated !== undefined ? { availableTruncated: single.availableTruncated } : {}),
|
|
914
|
+
...(correction !== undefined ? { correctPath: correction.correctPath } : {}),
|
|
915
|
+
...(nextCommand !== undefined ? { nextCommand } : {}),
|
|
916
|
+
...(readFromArtifact ? resultLayerNote(result, path, projectionSource, single.at) ?? {} : {}),
|
|
917
|
+
hint: missHintFor(single.at, single.available, correction),
|
|
918
|
+
}
|
|
919
|
+
: {}),
|
|
909
920
|
};
|
|
910
921
|
}
|
|
911
922
|
return {
|