@stalfh233/omc-cli 0.6.53 → 0.6.55
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/coverage/m1-coverage-manifest-v1.json +64 -2
- package/dist/capability-overview.js +4 -4
- package/dist/endpoints.js +41 -0
- package/dist/field-change.js +27 -3
- package/dist/field-families.js +130 -13
- package/dist/lanes/app-contract.js +32 -0
- package/dist/lanes/app-coverage.js +5 -0
- package/dist/lanes/app.js +396 -1
- package/dist/lanes/datarule.js +1 -1
- package/dist/lanes/dictionary.js +2 -2
- package/dist/lanes/field-contract.js +31 -2
- package/dist/lanes/field.js +9 -3
- package/dist/lanes/form.js +1 -1
- package/dist/lanes/list-view.js +23 -3
- package/dist/lanes/model.js +1 -1
- package/dist/lanes/report.js +2 -2
- package/dist/lanes/runtime-data.js +3 -3
- package/dist/lanes/workflow-contract.js +17 -0
- package/dist/lanes/workflow-coverage.js +16 -0
- package/dist/lanes/workflow.js +203 -2
- package/dist/recipes/field.js +33 -3
- package/dist/tool-search.js +7 -4
- package/dist/wire.js +57 -0
- package/package.json +3 -3
- package/skills/omc-capabilities.md +6 -5
package/dist/lanes/list-view.js
CHANGED
|
@@ -9,7 +9,7 @@ import { defineTool, ToolInputError, ToolRefusalError } from "../tool-types.js";
|
|
|
9
9
|
import { wireCall, wireRows, WireError } from "../wire.js";
|
|
10
10
|
import { QUERY_ACTION_TYPE } from "omc-core/list-view-wire";
|
|
11
11
|
import { resolveModelTreeNode } from "./model.js";
|
|
12
|
-
import { SYSTEM_FIELD_CODES } from "../field-families.js";
|
|
12
|
+
import { NUMERICAL_FORMAT_DECIMALS, SYSTEM_FIELD_CODES, canonicalNumericalFormat } from "../field-families.js";
|
|
13
13
|
import { LIST_VIEW_LANE_CONTRACT } from "./list-view-contract.js";
|
|
14
14
|
import { assertListViewConfigureShape, decodeActionRow, decodeButtonRow, decodeConditionRow, decodeGantt, decodePresentation, decodeSortRow, listViewActionArg, listViewButtonArg, listViewConditionArg, listViewGanttArg, listViewMultiTableHeaderArg, listViewOptionsArg, listViewPresentationArg, listViewQueryLayerArg, listViewSortArg, mergeActions, PLATFORM_DEFAULT_LIST_ACTIONS, normalizeActions, normalizeButtons, normalizeConditions, normalizeGantt, normalizePresentation, normalizeSorts, parseConditionOptions, presentationTypeArg, readArray, resolveFieldRef, buttonsRenderCompat, columnsRenderCompat, } from "./list-view-shapes.js";
|
|
15
15
|
// Ticket 53: every shape (enum/zod/encode/decode/lint) lives once in
|
|
@@ -73,11 +73,31 @@ function conditionValueEqual(left, right) {
|
|
|
73
73
|
*/
|
|
74
74
|
export function numericDisplayFormat(options) {
|
|
75
75
|
const opts = fieldOptions(options);
|
|
76
|
-
const format = String(opts.format ?? "decimal");
|
|
77
76
|
const scale = Number(opts.scale ?? 0) || 0;
|
|
78
77
|
const decimalByScale = { 0: 1, 1: 2, 2: 3, 3: 11, 4: 12, 5: 27, 6: 28, 7: 29, 8: 30 };
|
|
79
78
|
const currencyByScale = { 2: 7, 3: 15, 4: 16, 5: 31, 6: 32, 7: 33, 8: 34 };
|
|
80
79
|
const percentByScale = { 0: 4, 1: 5, 2: 6, 3: 13, 4: 14 };
|
|
80
|
+
// r64b (live 2026-11-14): the field row may carry the designer's canonical
|
|
81
|
+
// constant (`ratio.percentile`, `RMB.percentile`, …) instead of a semantic
|
|
82
|
+
// word — the designer writes exactly that. Resolve the family + decimals from
|
|
83
|
+
// the constant before the legacy alias checks.
|
|
84
|
+
const canonical = canonicalNumericalFormat(opts.format, scale);
|
|
85
|
+
if (canonical !== undefined && canonical !== "none") {
|
|
86
|
+
const dot = canonical.indexOf(".");
|
|
87
|
+
const family = dot > 0 ? canonical.slice(0, dot).toLowerCase() : canonical === "ratio" ? "ratio" : "";
|
|
88
|
+
const word = dot > 0 ? canonical.slice(dot + 1) : canonical;
|
|
89
|
+
const decimals = NUMERICAL_FORMAT_DECIMALS[word];
|
|
90
|
+
const effective = decimals ?? (canonical === "ratio" ? 0 : scale);
|
|
91
|
+
if (family === "ratio")
|
|
92
|
+
return percentByScale[effective] ?? 6;
|
|
93
|
+
if (family === "rmb")
|
|
94
|
+
return currencyByScale[effective] ?? 7;
|
|
95
|
+
if (family === "dollar")
|
|
96
|
+
return 8;
|
|
97
|
+
if (family === "")
|
|
98
|
+
return decimalByScale[effective] ?? 3;
|
|
99
|
+
}
|
|
100
|
+
const format = String(opts.format ?? "decimal");
|
|
81
101
|
if (format === "currency" || format === "rmb" || format === "¥")
|
|
82
102
|
return currencyByScale[scale] ?? 7;
|
|
83
103
|
if (format === "percent" || format === "percentage")
|
|
@@ -570,7 +590,7 @@ export function registerListViewLane(tools) {
|
|
|
570
590
|
writeTool({
|
|
571
591
|
tools,
|
|
572
592
|
name: "listview.configure",
|
|
573
|
-
search: { intents: ["配置列表列", "配列表", "列表列", "只显示", "不显示哪些列"] },
|
|
593
|
+
search: { intents: ["配置列表列", "配列表", "列表列", "只显示", "不显示哪些列", "合计数", "列合计", "底部合计", "排个序", "排序", "放前面", "就留"] },
|
|
574
594
|
lane: LIST_VIEW_LANE,
|
|
575
595
|
scope: LIST_VIEW_TOOLS["listview.configure"].scope,
|
|
576
596
|
description: LIST_VIEW_TOOLS["listview.configure"].description,
|
package/dist/lanes/model.js
CHANGED
|
@@ -530,7 +530,7 @@ export function registerModelLane(tools) {
|
|
|
530
530
|
writeTool({
|
|
531
531
|
tools,
|
|
532
532
|
name: "model.create",
|
|
533
|
-
search: { intents: ["新建模型", "建模型", "创建模型", "建模"] },
|
|
533
|
+
search: { intents: ["新建模型", "建模型", "创建模型", "建模", "做个新表", "做个表", "建个表"] },
|
|
534
534
|
lane: MODEL_LANE,
|
|
535
535
|
scope: MODEL_TOOLS["model.create"].scope,
|
|
536
536
|
description: MODEL_TOOLS["model.create"].description,
|
package/dist/lanes/report.js
CHANGED
|
@@ -415,7 +415,7 @@ export function registerReportLane(tools) {
|
|
|
415
415
|
}));
|
|
416
416
|
tools.push(defineTool({
|
|
417
417
|
name: "report.chartdata",
|
|
418
|
-
search: { intents: ["查报表数据", "报表数据", "图表数据"] },
|
|
418
|
+
search: { intents: ["查报表数据", "报表数据", "图表数据", "趋势图"] },
|
|
419
419
|
layer: "low",
|
|
420
420
|
kind: "read",
|
|
421
421
|
lane: LANE,
|
|
@@ -538,7 +538,7 @@ export function registerReportLane(tools) {
|
|
|
538
538
|
writeTool({
|
|
539
539
|
tools,
|
|
540
540
|
name: "report.create",
|
|
541
|
-
search: { intents: ["建报表", "新建报表", "创建报表", "建图表"] },
|
|
541
|
+
search: { intents: ["建报表", "新建报表", "创建报表", "建图表", "一份报表"] },
|
|
542
542
|
lane: LANE,
|
|
543
543
|
scope: TOOLS["report.create"].scope,
|
|
544
544
|
description: TOOLS["report.create"].description,
|
|
@@ -1065,7 +1065,7 @@ async function diagnoseDbException(session, schemaCode, error) {
|
|
|
1065
1065
|
export function registerRuntimeDataLane(tools) {
|
|
1066
1066
|
tools.push(defineTool({
|
|
1067
1067
|
name: "data.list",
|
|
1068
|
-
search: { intents: ["查业务数据", "查询数据", "查数据", "查记录", "查单据", "统计数据", "汇总数据", "分组统计", "数条数", "总条数", "导出数据", "多少条", "有几条", "统计", "导出", "查合同列表", "查单据列表"] },
|
|
1068
|
+
search: { intents: ["查业务数据", "查询数据", "查数据", "查记录", "查单据", "统计数据", "汇总数据", "分组统计", "数条数", "总条数", "导出数据", "多少条", "有几条", "统计", "导出", "查合同列表", "查单据列表", "名单", "拉个名单"] },
|
|
1069
1069
|
layer: "low",
|
|
1070
1070
|
kind: "read",
|
|
1071
1071
|
lane: RUNTIME_LANE,
|
|
@@ -1871,7 +1871,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
1871
1871
|
writeTool({
|
|
1872
1872
|
tools,
|
|
1873
1873
|
name: "data.update",
|
|
1874
|
-
search: { intents: ["改一条记录", "编辑单据", "更新业务数据", "改数据", "录错了改回来", "修正数据", "改成", "改为"] },
|
|
1874
|
+
search: { intents: ["改一条记录", "编辑单据", "更新业务数据", "改数据", "录错了改回来", "修正数据", "改成", "改为", "录错了", "改回来"] },
|
|
1875
1875
|
lane: RUNTIME_LANE,
|
|
1876
1876
|
scope: RUNTIME_TOOLS["data.update"].scope,
|
|
1877
1877
|
description: RUNTIME_TOOLS["data.update"].description,
|
|
@@ -2083,7 +2083,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
2083
2083
|
writeTool({
|
|
2084
2084
|
tools,
|
|
2085
2085
|
name: "data.submit",
|
|
2086
|
-
search: { intents: ["造测试数据", "造数据", "录数据", "造单据", "提交数据"] },
|
|
2086
|
+
search: { intents: ["造测试数据", "造数据", "录数据", "造单据", "提交数据", "撤回", "提错了", "手滑"] },
|
|
2087
2087
|
lane: RUNTIME_LANE,
|
|
2088
2088
|
scope: RUNTIME_TOOLS["data.submit"].scope,
|
|
2089
2089
|
description: RUNTIME_TOOLS["data.submit"].description,
|
|
@@ -217,6 +217,19 @@ export const WORKFLOW_LANE_CONTRACT = Object.freeze({
|
|
|
217
217
|
scope: "runtime workflow instance node-state diagnosis",
|
|
218
218
|
description: "按实例查全部节点状态(`activities[].status` 数字枚举:`1=当前激活/持有待办`、`0=已完成或尚未到达`,别与实例级 `instanceStatus:\"PROCESSING\"` 混用——后者只表示流程仍在运行)。返回每个节点 `{activityCode,activityName,activityType,status,participantCount,participants:[{name,id}],sheetTrigger?}`(`GET /api/api/runtime/workflow/list_workflow_instance_activity`,WorkflowMaintenanceAssembler.listActivateActivity)。用于「data.submit 回 PROCESSING 但没有下一待办」的自诊断:例子 `omc call workflow.instanceActivity --args '{\"workflowInstanceId\":\"<id>\"}'`。当没有任何节点 status=1 时,readback 的 diagnosis.code=no-active-activity 并列出排查顺序(参与人为空的审批节点 → 参与人写法 → 容器日志 GetParticipantInfo error)。审批推进正常时该工具不需要——data.submit 的 readback.nextSubmit 已给出下一级参数。",
|
|
219
219
|
}),
|
|
220
|
+
// r64 流程运维三件套(测试提速定位,真机实证形状)。
|
|
221
|
+
"workflow.transfer": Object.freeze({
|
|
222
|
+
scope: "runtime workflow admin adjust participant",
|
|
223
|
+
description: "流程运维·换当前审批人(`POST /api/api/runtime/workflow/workflow_operation`,operationType=ADJUST_PARTICIPANT;approval 是对象 {activityCode,commonSet,deleted,resources,content}——传字符串 10009;adjust_workItem_participators 是加签面 402512 不是换人)。测试提速工具:换过审批人的实例权限语义已变,不能用于真实流程/权限验证;正常审批链走 data.submit。参与者收 userId 或姓名(user/search 精确解析)。",
|
|
224
|
+
}),
|
|
225
|
+
"workflow.activate": Object.freeze({
|
|
226
|
+
scope: "runtime workflow admin activate activity",
|
|
227
|
+
description: "流程运维·跳转到指定节点(workflow_operation operationType=ACTIVATE_ACTIVITY:激活目标节点并取消当前待办,可带 participants 指定新节点审批人)。测试提速工具:跳过节点的实例不能用于真实流程/权限验证——正常审批走 data.submit。目标节点须在实例活动清单里(status:0 的未到达节点也能跳)。",
|
|
228
|
+
}),
|
|
229
|
+
"workflow.finish": Object.freeze({
|
|
230
|
+
scope: "runtime workflow admin finish instance",
|
|
231
|
+
description: "流程运维·手动结束流程(`POST /api/api/runtime/workflow/finish_instance_by_post`,正常完结语义):实例到 COMPLETED,workflow.bindRules 的 end handler 规则照常触发(与 abort_instance 终止的本质区别——终止不保证跑规则;验证用 rule.log)。测试提速工具:手动结束的实例不能用于真实流程推进/权限验证。",
|
|
232
|
+
}),
|
|
220
233
|
}),
|
|
221
234
|
});
|
|
222
235
|
export function assertWorkflowContract() {
|
|
@@ -262,6 +275,10 @@ export function assertWorkflowContract() {
|
|
|
262
275
|
assertDescriptionCarries(WORKFLOW_LANE_CONTRACT, "configure_workflow", ["workflow.create", "workflow.update", "workflow.publish", "workflow.bindRule", "bindRules"]);
|
|
263
276
|
assertDescriptionCarries(WORKFLOW_LANE_CONTRACT, "workitem.list", ["search_workitems", "workItemId", "workflowInstanceId", "bizObjectId", "getBizObjectByWfInstanceId", "filterWorkflowInstanceId"]);
|
|
264
277
|
assertDescriptionCarries(WORKFLOW_LANE_CONTRACT, "workflow.instanceActivity", ["list_workflow_instance_activity", "status", "participants", "no-active-activity"]);
|
|
278
|
+
// r64:运维三件套的端点/语义钉子(含「测试提速」定位)。
|
|
279
|
+
assertDescriptionCarries(WORKFLOW_LANE_CONTRACT, "workflow.transfer", ["workflow_operation", "ADJUST_PARTICIPANT", "data.submit"]);
|
|
280
|
+
assertDescriptionCarries(WORKFLOW_LANE_CONTRACT, "workflow.activate", ["ACTIVATE_ACTIVITY", "data.submit"]);
|
|
281
|
+
assertDescriptionCarries(WORKFLOW_LANE_CONTRACT, "workflow.finish", ["finish_instance_by_post", "end handler", "abort"]);
|
|
265
282
|
if (!workflowTemplateArg.description?.includes("routes"))
|
|
266
283
|
throw new Error("workflow template arg must document the routes->rules mapping");
|
|
267
284
|
if (workflowTemplateArg.description?.includes('\\"templateType\\":\\"BusinessProcess\\"') || workflowTemplateArg.description?.includes('"templateType":"BusinessProcess"'))
|
|
@@ -55,6 +55,22 @@ export const WORKFLOW_COVERAGE = declareLaneCoverage(WORKFLOW_LANE_CONTRACT.lane
|
|
|
55
55
|
],
|
|
56
56
|
tools: [claim("workitem.list", T["workitem.list"].scope), claim("workflow.instanceActivity", T["workflow.instanceActivity"].scope)],
|
|
57
57
|
},
|
|
58
|
+
{
|
|
59
|
+
// r64 流程运维三件套(用户需求 2026-11-14;测试提速定位)。端点形状真机
|
|
60
|
+
// 实证:workflow_operation approval 必须是对象(字符串 10009)、
|
|
61
|
+
// adjust_workItem_participators 是加签面(402512)、finish_instance_by_post
|
|
62
|
+
// 正常完结语义(end 规则照常触发)。回执档案见 r64 TASK-RESULT。
|
|
63
|
+
capability: "r64 runtime workflow admin operations (transfer/activate/finish)",
|
|
64
|
+
evidence: [
|
|
65
|
+
"packages/omc-cli/src/lanes/workflow.ts",
|
|
66
|
+
"r64 2026-11-14 (8.6 真机): ADJUST_PARTICIPANT 换审批人(A2 付文彬→赵财务 回执)、ACTIVATE_ACTIVITY 跳转 A2→A3、finish_instance_by_post COMPLETED——全链沙盒 r64ops_wfo 实证",
|
|
67
|
+
],
|
|
68
|
+
tools: [
|
|
69
|
+
claim("workflow.transfer", T["workflow.transfer"].scope),
|
|
70
|
+
claim("workflow.activate", T["workflow.activate"].scope),
|
|
71
|
+
claim("workflow.finish", T["workflow.finish"].scope),
|
|
72
|
+
],
|
|
73
|
+
},
|
|
58
74
|
{
|
|
59
75
|
capability: "workflow participant resolution (org roles/departments)",
|
|
60
76
|
evidence: [
|
package/dist/lanes/workflow.js
CHANGED
|
@@ -2617,7 +2617,7 @@ export function registerWorkflowLane(tools) {
|
|
|
2617
2617
|
writeTool({
|
|
2618
2618
|
tools,
|
|
2619
2619
|
name: "workflow.update",
|
|
2620
|
-
search: { intents: ["更新流程", "修改流程", "改流程", "加审批节点", "退回给", "退回到"] },
|
|
2620
|
+
search: { intents: ["更新流程", "修改流程", "改流程", "加审批节点", "退回给", "退回到", "签一下", "自己批"] },
|
|
2621
2621
|
lane: WORKFLOW_LANE,
|
|
2622
2622
|
scope: WORKFLOW_TOOLS["workflow.update"].scope,
|
|
2623
2623
|
description: WORKFLOW_TOOLS["workflow.update"].description,
|
|
@@ -3272,7 +3272,7 @@ export function registerWorkflowLane(tools) {
|
|
|
3272
3272
|
});
|
|
3273
3273
|
tools.push(defineTool({
|
|
3274
3274
|
name: "workitem.list",
|
|
3275
|
-
search: { intents: ["查我的待办", "我的待办", "待办列表", "查待办"] },
|
|
3275
|
+
search: { intents: ["查我的待办", "我的待办", "待办列表", "查待办", "等审批"] },
|
|
3276
3276
|
layer: "low",
|
|
3277
3277
|
kind: "read",
|
|
3278
3278
|
lane: WORKFLOW_LANE,
|
|
@@ -4075,6 +4075,207 @@ export function registerWorkflowLane(tools) {
|
|
|
4075
4075
|
}, { compact: userSearchCompact });
|
|
4076
4076
|
},
|
|
4077
4077
|
}));
|
|
4078
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
4079
|
+
// r64 流程运维三件套(用户需求 2026-11-14:「流程运维把当前审批人换成我自己 /
|
|
4080
|
+
// 手动结束流程触发规则 / 运维到指定节点」)。**定位:测试提速工具**——快速
|
|
4081
|
+
// 造/推测试数据用;真实流程与权限验证必须走 data.submit 正常链(换过审批人/
|
|
4082
|
+
// 跳过节点的实例,权限语义已变)。端点形状全部真机实证(详见 r64 TASK-RESULT)。
|
|
4083
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
4084
|
+
/** 把 participants(userId 或姓名,混收)解析成 userId 列表;姓名走 user/search。 */
|
|
4085
|
+
const resolveOpsParticipants = async (session, participants) => {
|
|
4086
|
+
const ids = [];
|
|
4087
|
+
const resolved = [];
|
|
4088
|
+
const unresolved = [];
|
|
4089
|
+
for (const entry of participants) {
|
|
4090
|
+
if (/^[0-9a-f]{16,}$/i.test(entry)) {
|
|
4091
|
+
ids.push(entry);
|
|
4092
|
+
resolved.push({ name: entry, id: entry });
|
|
4093
|
+
continue;
|
|
4094
|
+
}
|
|
4095
|
+
const data = (await wireCall(session, { path: ENDPOINTS.organizationUserSearch, method: "POST", body: { wd: entry, page: 0, size: 5 } })).data;
|
|
4096
|
+
const rows = Array.isArray(data?.content) ? data.content : [];
|
|
4097
|
+
const exact = rows.find((row) => String(row.name ?? "") === entry) ?? rows[0];
|
|
4098
|
+
if (exact && typeof exact.id === "string") {
|
|
4099
|
+
ids.push(exact.id);
|
|
4100
|
+
resolved.push({ name: String(exact.name ?? entry), id: exact.id });
|
|
4101
|
+
}
|
|
4102
|
+
else {
|
|
4103
|
+
unresolved.push(entry);
|
|
4104
|
+
}
|
|
4105
|
+
}
|
|
4106
|
+
return { ids, resolved, unresolved };
|
|
4107
|
+
};
|
|
4108
|
+
const opsApproval = (activityCode, comment) => ({
|
|
4109
|
+
activityCode,
|
|
4110
|
+
commonSet: false,
|
|
4111
|
+
deleted: false,
|
|
4112
|
+
resources: [],
|
|
4113
|
+
content: comment ?? null,
|
|
4114
|
+
});
|
|
4115
|
+
const activeActivitiesOf = async (session, instanceId) => {
|
|
4116
|
+
const rows = await listInstanceActivities(session, instanceId);
|
|
4117
|
+
return rows
|
|
4118
|
+
.filter((row) => Number(row.status) === 1)
|
|
4119
|
+
.map((row) => ({
|
|
4120
|
+
activityCode: wireString(row.activityCode),
|
|
4121
|
+
activityName: wireString(row.activityName),
|
|
4122
|
+
participants: (Array.isArray(row.participantors) ? row.participantors : []).map((person) => ({ id: wireString(person.id), name: wireString(person.name) })),
|
|
4123
|
+
}));
|
|
4124
|
+
};
|
|
4125
|
+
writeTool({
|
|
4126
|
+
tools,
|
|
4127
|
+
name: "workflow.transfer",
|
|
4128
|
+
search: { intents: ["换审批人", "转办", "改审批人", "调整审批人", "审批人换成"] },
|
|
4129
|
+
lane: WORKFLOW_LANE,
|
|
4130
|
+
scope: "runtime workflow admin adjust participant",
|
|
4131
|
+
description: "流程运维·换当前审批人(`POST /api/api/runtime/workflow/workflow_operation`,operationType=ADJUST_PARTICIPANT;真机实证 approval 是**对象** {activityCode,commonSet,deleted,resources,content},传字符串 10009;adjust_workItem_participators 是加签面不是换人)。**测试提速工具**:换过审批人的实例权限语义已变,不能用于真实流程/权限验证——正常审批链走 data.submit。实例必须在途且有激活节点;默认取第一个激活节点,也可显式 activityCode。",
|
|
4132
|
+
inputSchema: {
|
|
4133
|
+
workflowInstanceId: z.string().min(1).describe("流程实例 id(data.submit 读回 / workflow.instanceActivity)"),
|
|
4134
|
+
participants: z.array(z.string().min(1)).min(1).describe("目标审批人:userId 或姓名(混收;姓名按 organization/user/search 精确匹配解析)"),
|
|
4135
|
+
activityCode: z.string().optional().describe("目标节点 code;省略=当前第一个激活节点"),
|
|
4136
|
+
comment: z.string().optional().describe("运维意见(进审批记录)"),
|
|
4137
|
+
},
|
|
4138
|
+
execute: async (session, args) => {
|
|
4139
|
+
const base = await getInstanceBaseInfo(session, args.workflowInstanceId);
|
|
4140
|
+
if (base === null)
|
|
4141
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-instance-not-found", workflowInstanceId: args.workflowInstanceId, message: `流程实例 ${args.workflowInstanceId} 不存在(get_instance_baseinfo 空)——实例 id 来自 data.submit 读回的 workflowInstanceId` });
|
|
4142
|
+
const status = wireString(base.status);
|
|
4143
|
+
if (status === "COMPLETED")
|
|
4144
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-instance-completed", workflowInstanceId: args.workflowInstanceId, message: `实例已 COMPLETED,没有可换的审批人` });
|
|
4145
|
+
const active = await activeActivitiesOf(session, args.workflowInstanceId);
|
|
4146
|
+
if (active.length === 0)
|
|
4147
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-no-active-activity", workflowInstanceId: args.workflowInstanceId, message: "实例没有任何激活节点(参与者解析失败/引擎异常),无审批人可换——先 workflow.instanceActivity 诊断" });
|
|
4148
|
+
const target = args.activityCode !== undefined ? active.find((row) => row.activityCode === args.activityCode) : active[0];
|
|
4149
|
+
if (target === undefined)
|
|
4150
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-activity-not-active", activityCode: args.activityCode, activeActivities: active.map((row) => row.activityCode), message: `节点 ${args.activityCode} 不是当前激活节点;激活中的是 ${active.map((row) => row.activityCode).join("、")}` });
|
|
4151
|
+
const { ids, resolved, unresolved } = await resolveOpsParticipants(session, args.participants);
|
|
4152
|
+
if (unresolved.length > 0 || ids.length === 0)
|
|
4153
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-participant-unresolved", unresolved, message: `participants 里 ${unresolved.join("、")} 在 organization/user/search 解析不到(精确姓名优先);直接传 userId 可跳过解析` });
|
|
4154
|
+
const currentIds = new Set(target.participants.map((person) => person.id));
|
|
4155
|
+
if (ids.every((id) => currentIds.has(id)))
|
|
4156
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-transfer-noop", message: `目标审批人与当前完全相同(${[...currentIds].join("、")})——换成同一批人是 no-op,平台可能拒绝;要真实换人请给不同的用户` });
|
|
4157
|
+
const performed = await wireCall(session, {
|
|
4158
|
+
path: ENDPOINTS.workflowOperation,
|
|
4159
|
+
method: "POST",
|
|
4160
|
+
body: {
|
|
4161
|
+
workflowInstanceId: args.workflowInstanceId,
|
|
4162
|
+
activityCode: target.activityCode,
|
|
4163
|
+
approval: opsApproval(target.activityCode, args.comment),
|
|
4164
|
+
batchOperation: false,
|
|
4165
|
+
operationType: "ADJUST_PARTICIPANT",
|
|
4166
|
+
participantors: ids,
|
|
4167
|
+
},
|
|
4168
|
+
});
|
|
4169
|
+
const after = await activeActivitiesOf(session, args.workflowInstanceId);
|
|
4170
|
+
return {
|
|
4171
|
+
performed: { errcode: performed.errcode, operationType: "ADJUST_PARTICIPANT", activityCode: target.activityCode, participantors: ids },
|
|
4172
|
+
readback: {
|
|
4173
|
+
activeActivities: after,
|
|
4174
|
+
transferred: after.some((row) => row.activityCode === target.activityCode && row.participants.some((person) => ids.includes(person.id ?? ""))),
|
|
4175
|
+
boundaryNote: "测试提速工具:换过审批人的实例权限语义已变,勿用于真实流程/权限验证;正常审批链走 data.submit(workItemId)。",
|
|
4176
|
+
},
|
|
4177
|
+
};
|
|
4178
|
+
},
|
|
4179
|
+
});
|
|
4180
|
+
writeTool({
|
|
4181
|
+
tools,
|
|
4182
|
+
name: "workflow.activate",
|
|
4183
|
+
search: { intents: ["跳转节点", "运维到节点", "指定节点", "调整节点", "流程跳转"] },
|
|
4184
|
+
lane: WORKFLOW_LANE,
|
|
4185
|
+
scope: "runtime workflow admin activate activity",
|
|
4186
|
+
description: "流程运维·跳转到指定节点(`POST /api/api/runtime/workflow/workflow_operation`,operationType=ACTIVATE_ACTIVITY:激活目标节点并取消当前待办,可带 participantors 指定新节点审批人)。**测试提速工具**——跳过节点的实例不能用于真实流程/权限验证;正常审批走 data.submit。目标节点必须在实例的活动清单里(workflow.instanceActivity 可查全部节点,status:0 的未到达节点也能跳)。",
|
|
4187
|
+
inputSchema: {
|
|
4188
|
+
workflowInstanceId: z.string().min(1).describe("流程实例 id"),
|
|
4189
|
+
activityCode: z.string().min(1).describe("目标节点 code(如回到 A2 或直跳 A3;全部节点用 workflow.instanceActivity 查)"),
|
|
4190
|
+
participants: z.array(z.string().min(1)).optional().describe("新节点的审批人(userId 或姓名);省略则用节点模板自身的参与者解析"),
|
|
4191
|
+
comment: z.string().optional().describe("运维意见"),
|
|
4192
|
+
},
|
|
4193
|
+
execute: async (session, args) => {
|
|
4194
|
+
const base = await getInstanceBaseInfo(session, args.workflowInstanceId);
|
|
4195
|
+
if (base === null)
|
|
4196
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-instance-not-found", workflowInstanceId: args.workflowInstanceId, message: `流程实例 ${args.workflowInstanceId} 不存在` });
|
|
4197
|
+
const status = wireString(base.status);
|
|
4198
|
+
if (status === "COMPLETED")
|
|
4199
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-instance-completed", workflowInstanceId: args.workflowInstanceId, message: `实例已 COMPLETED,不能跳转节点` });
|
|
4200
|
+
const rows = await listInstanceActivities(session, args.workflowInstanceId);
|
|
4201
|
+
const known = rows.map((row) => wireString(row.activityCode));
|
|
4202
|
+
if (!known.includes(args.activityCode))
|
|
4203
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-activity-unknown", activityCode: args.activityCode, knownActivities: known, message: `节点 ${args.activityCode} 不在实例活动清单里;清单:${known.join("、")}` });
|
|
4204
|
+
const activeBefore = rows.filter((row) => Number(row.status) === 1).map((row) => wireString(row.activityCode));
|
|
4205
|
+
let participantIds;
|
|
4206
|
+
if (args.participants !== undefined) {
|
|
4207
|
+
const { ids, unresolved } = await resolveOpsParticipants(session, args.participants);
|
|
4208
|
+
if (unresolved.length > 0)
|
|
4209
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-participant-unresolved", unresolved, message: `participants 里 ${unresolved.join("、")} 解析不到(精确姓名优先);直接传 userId 可跳过解析` });
|
|
4210
|
+
participantIds = ids;
|
|
4211
|
+
}
|
|
4212
|
+
const activeRow = rows.find((row) => Number(row.status) === 1);
|
|
4213
|
+
const performed = await wireCall(session, {
|
|
4214
|
+
path: ENDPOINTS.workflowOperation,
|
|
4215
|
+
method: "POST",
|
|
4216
|
+
body: {
|
|
4217
|
+
workflowInstanceId: args.workflowInstanceId,
|
|
4218
|
+
activityCode: args.activityCode,
|
|
4219
|
+
approval: opsApproval(wireString(activeRow?.activityCode) ?? args.activityCode, args.comment),
|
|
4220
|
+
batchOperation: false,
|
|
4221
|
+
operationType: "ACTIVATE_ACTIVITY",
|
|
4222
|
+
...(participantIds !== undefined ? { participantors: participantIds } : {}),
|
|
4223
|
+
},
|
|
4224
|
+
});
|
|
4225
|
+
const after = await activeActivitiesOf(session, args.workflowInstanceId);
|
|
4226
|
+
return {
|
|
4227
|
+
performed: { errcode: performed.errcode, operationType: "ACTIVATE_ACTIVITY", activityCode: args.activityCode, activatedFrom: activeBefore },
|
|
4228
|
+
readback: {
|
|
4229
|
+
activeActivities: after,
|
|
4230
|
+
activated: after.some((row) => row.activityCode === args.activityCode),
|
|
4231
|
+
boundaryNote: "测试提速工具:跳过节点的实例不能用于真实流程/权限验证。",
|
|
4232
|
+
},
|
|
4233
|
+
};
|
|
4234
|
+
},
|
|
4235
|
+
});
|
|
4236
|
+
writeTool({
|
|
4237
|
+
tools,
|
|
4238
|
+
name: "workflow.finish",
|
|
4239
|
+
search: { intents: ["结束流程", "手动结束", "流程结束", "直接完结"] },
|
|
4240
|
+
lane: WORKFLOW_LANE,
|
|
4241
|
+
scope: "runtime workflow admin finish instance",
|
|
4242
|
+
description: "流程运维·手动结束流程(`POST /api/api/runtime/workflow/finish_instance_by_post`,发起人「结束流程」语义):实例直接到 COMPLETED,**workflow.bindRules 的 end handler 规则照常触发**(这是 finish 与 abort_instance 终止的本质区别——终止不保证跑规则;验证规则跑了没有用 rule.log 查)。**测试提速工具**:手动结束的实例不能用于真实流程推进/权限验证;正常审批走 data.submit。",
|
|
4243
|
+
inputSchema: {
|
|
4244
|
+
workflowInstanceId: z.string().min(1).describe("流程实例 id"),
|
|
4245
|
+
comment: z.string().optional().describe("结束意见(进审批记录)"),
|
|
4246
|
+
},
|
|
4247
|
+
execute: async (session, args) => {
|
|
4248
|
+
const base = await getInstanceBaseInfo(session, args.workflowInstanceId);
|
|
4249
|
+
if (base === null)
|
|
4250
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-instance-not-found", workflowInstanceId: args.workflowInstanceId, message: `流程实例 ${args.workflowInstanceId} 不存在` });
|
|
4251
|
+
const status = wireString(base.status);
|
|
4252
|
+
if (status === "COMPLETED")
|
|
4253
|
+
throw new ToolRefusalError({ status: "refused", blocker: "workflow-instance-completed", workflowInstanceId: args.workflowInstanceId, message: "实例已 COMPLETED,无需结束(幂等拒绝;如需重开走 workflow.activate 回指定节点)" });
|
|
4254
|
+
const activeBefore = await activeActivitiesOf(session, args.workflowInstanceId);
|
|
4255
|
+
const performed = await wireCall(session, {
|
|
4256
|
+
path: ENDPOINTS.workflowFinishInstance,
|
|
4257
|
+
method: "POST",
|
|
4258
|
+
body: { workflowInstanceId: args.workflowInstanceId, comment: args.comment ?? null, resources: [] },
|
|
4259
|
+
});
|
|
4260
|
+
const afterBase = await getInstanceBaseInfo(session, args.workflowInstanceId);
|
|
4261
|
+
const afterStatus = wireString(afterBase?.status);
|
|
4262
|
+
const afterActive = await activeActivitiesOf(session, args.workflowInstanceId);
|
|
4263
|
+
// r64 真机:finish 受理后 baseinfo 投影可能停在 TOPPING_OFF(收尾态)而
|
|
4264
|
+
// DB 终态已是 COMPLETED——两态都算「结束已受理」,别当成失败重试。
|
|
4265
|
+
const finished = afterStatus === "COMPLETED" || afterStatus === "TOPPING_OFF";
|
|
4266
|
+
return {
|
|
4267
|
+
performed: { errcode: performed.errcode, finishedActivities: activeBefore.map((row) => row.activityCode) },
|
|
4268
|
+
readback: {
|
|
4269
|
+
instanceStatus: afterStatus,
|
|
4270
|
+
finished,
|
|
4271
|
+
...(afterStatus === "TOPPING_OFF" ? { toppingOffNote: "TOPPING_OFF=收尾态(真机实证:DB 终态此时已是 COMPLETED,baseinfo 投影滞后)——end 规则在收尾时触发,勿当失败重试" } : {}),
|
|
4272
|
+
activeActivities: afterActive,
|
|
4273
|
+
endRulesNote: "finish=正常完结语义:workflow.bindRules 绑在 end handler 的业务规则照常触发(查 rule.log / rulelog 面);abort 终止不保证跑规则——本工具不走 abort。",
|
|
4274
|
+
boundaryNote: "测试提速工具:手动结束的实例不能用于真实流程推进/权限验证。",
|
|
4275
|
+
},
|
|
4276
|
+
};
|
|
4277
|
+
},
|
|
4278
|
+
});
|
|
4078
4279
|
}
|
|
4079
4280
|
/** Flatten a role-group/role row into the participant-construction fields. */
|
|
4080
4281
|
/**
|
package/dist/recipes/field.js
CHANGED
|
@@ -108,11 +108,41 @@ const numericTwoDecimals = Object.freeze({
|
|
|
108
108
|
tool: "field.create",
|
|
109
109
|
args: { environment, schemaCode: model, code: "applyAmount", name: "申请金额", propertyType: "NUMERICAL", options: { scale: 2 } },
|
|
110
110
|
preconditions: ["模型已存在"],
|
|
111
|
-
conditionalRequirements: [
|
|
111
|
+
conditionalRequirements: [
|
|
112
|
+
"NUMERICAL 必须显式 options.scale:scale = 小数位数(0=整数, 1=1位, 2=2位 … 8=8位);缺 scale 门户显示裸 decimal 且工具会拒绝。",
|
|
113
|
+
"要**千分位/百分比/货币符号**再加 `options.format`(平台常量:普通数字 `tenths/percentile/…`、百分比 `ratio.*`、货币 `RMB.*`);百分比见 recipe `numeric-percent`。注意 `percentile` 是「两位小数」不是百分比。",
|
|
114
|
+
],
|
|
112
115
|
priorToolReferences: [{ tool: "discover_environment", args: { environment }, purpose: "确认目标模型已存在" }],
|
|
113
116
|
dryRun: { supported: true, command: `omc call field.create --env ${environment} --dry-run --args '<recipe.args>'`, notes: "dry-run 校验 propertyType/scale/治理,不创建" },
|
|
114
117
|
expectedReadback: { readback: { draftFieldPresent: true }, next: ["field.publish"] },
|
|
115
|
-
refusalRecovery: [{ code: "field-options-shape", action: "NUMERICAL 必须带 options.scale;金额两位小数用 scale:2,整数用 scale:0" }, ...commonRecovery],
|
|
118
|
+
refusalRecovery: [{ code: "field-options-shape", action: "NUMERICAL 必须带 options.scale;金额两位小数用 scale:2,整数用 scale:0。要百分比/千分位/货币加 options.format(见 recipe numeric-percent)" }, ...commonRecovery],
|
|
119
|
+
requiresEnvironmentDerivedIds: false,
|
|
120
|
+
});
|
|
121
|
+
const numericPercent = Object.freeze({
|
|
122
|
+
id: "numeric-percent",
|
|
123
|
+
title: "数值字段:百分比(存比值 0.5=50.00%,format 用 ratio.<小数位>)",
|
|
124
|
+
status: "offline-valid",
|
|
125
|
+
aliases: ["百分位", "百分比", "按百分号显示", "占比字段", "百分比字段", "百分之", "比率字段", "percent"],
|
|
126
|
+
tool: "field.create",
|
|
127
|
+
args: { environment, schemaCode: model, code: "completionRate", name: "完成率", propertyType: "NUMERICAL", options: { scale: 2, format: "ratio.percentile" } },
|
|
128
|
+
preconditions: [
|
|
129
|
+
"普通数值字段 + 显示格式(不是公式字段/文字字段)。",
|
|
130
|
+
"**存比值不存百分数**:真机门户 0.5→`50.00%`、50→`5000.00%`;来源给百分数先 ÷100。",
|
|
131
|
+
],
|
|
132
|
+
conditionalRequirements: [
|
|
133
|
+
"`options.format` 必须是平台常量:百分比 `ratio`(20%)/`ratio.tenths`(20.0%)/`ratio.percentile`(20.00%),普通数字 `integer/tenths/percentile…`,货币 `RMB./dollar./euro./HK.` 前缀,`none`=裸值;`percentile` 是两位小数**不是**百分比。全表见 `omc contract field-families` 的 numericalFormat。",
|
|
134
|
+
"`scale` 与小数据对齐(两位百分比 = `scale:2`+`ratio.percentile`);只写 scale 门户显示 `2,000.00` 普通数字。别名 percent/currency/¥ 由 CLI 归一为常量再落库;**别绕过 CLI 把 `percent` 写进字段行**——平台字面读不懂,门户跌回裸值(真机 r64b:format:\"percent\" → `0.5`)。",
|
|
135
|
+
"生效:字段行 format 优先于表单控件 format,`field.publish` 后即生效(无需重建表单);列表是另一套列枚举,配完看一眼列表列。",
|
|
136
|
+
],
|
|
137
|
+
priorToolReferences: [
|
|
138
|
+
{ tool: "field.list", args: { environment, schemaCode: model, code: "completionRate", full: true }, purpose: "确认 code 未占用(默认清单面不回 options)" },
|
|
139
|
+
],
|
|
140
|
+
dryRun: { supported: true, command: `omc call field.create --env ${environment} --dry-run --args '<recipe.args>'`, notes: "dry-run 校验 propertyType/scale/format 归一化,不创建" },
|
|
141
|
+
expectedReadback: { performed: { errcode: 0 }, readback: { draftFieldPresent: true, normalized: { format: { from: "percent", to: "ratio.percentile" } } }, verification: "field.list {full:true} 回读 options.format=ratio.percentile;门户 0.5 → 50.00%", next: ["field.publish", "门户表单核对 0.5→50.00%"] },
|
|
142
|
+
refusalRecovery: [
|
|
143
|
+
{ code: "field-options-shape", action: "百分比用 `options:{scale:2,format:\"ratio.percentile\"}`;只写 scale 只得到 2,000.00 的普通数字" },
|
|
144
|
+
...commonRecovery,
|
|
145
|
+
],
|
|
116
146
|
requiresEnvironmentDerivedIds: false,
|
|
117
147
|
});
|
|
118
148
|
const dictionarySelection = Object.freeze({
|
|
@@ -389,6 +419,6 @@ const externalLookupModel = Object.freeze({
|
|
|
389
419
|
});
|
|
390
420
|
export const FIELD_METADATA = Object.freeze({
|
|
391
421
|
"field.update": Object.freeze({ recipes: [formConditionalRequired, formAlwaysReadonly, formConditionalReadonly], relatedTools: ["field.list", "field.publish", "form.draft", "form.publish"] }),
|
|
392
|
-
"field.create": Object.freeze({ recipes: [fieldSerialNumber, numericTwoDecimals, dictionarySelection, dictionaryMultiSelection, childTable, businessModelDropdown, formulaAggregationCrossModel, formulaExpressionSameModel, externalLookupModel], relatedTools: ["dictionary.names", "dictionary.records", "discover_environment", "field.list", "field.publish", "form.draft", "configure_form", "form.publish"] }),
|
|
422
|
+
"field.create": Object.freeze({ recipes: [fieldSerialNumber, numericTwoDecimals, numericPercent, dictionarySelection, dictionaryMultiSelection, childTable, businessModelDropdown, formulaAggregationCrossModel, formulaExpressionSameModel, externalLookupModel], relatedTools: ["dictionary.names", "dictionary.records", "discover_environment", "field.list", "field.publish", "form.draft", "configure_form", "form.publish"] }),
|
|
393
423
|
});
|
|
394
424
|
//# sourceMappingURL=field.js.map
|
package/dist/tool-search.js
CHANGED
|
@@ -141,7 +141,7 @@ const READ_LEADING_VERBS = Object.freeze(["读", "看", "查", "列出", "列",
|
|
|
141
141
|
*/
|
|
142
142
|
const OBJECT_LEXICON = Object.freeze({
|
|
143
143
|
model: ["模型", "业务模型", "登记表", "申请单", "申请表", "台账", "单表"],
|
|
144
|
-
field: ["字段"],
|
|
144
|
+
field: ["字段", "栏"],
|
|
145
145
|
form: ["表单"],
|
|
146
146
|
listview: ["列表视图", "列表", "视图", "查询列"],
|
|
147
147
|
datarule: ["字段级规则", "数据规则", "校验规则", "控件规则", "字段校验", "字段级校验"],
|
|
@@ -154,8 +154,8 @@ const OBJECT_LEXICON = Object.freeze({
|
|
|
154
154
|
department: ["部门"],
|
|
155
155
|
user: ["用户", "员工", "账号", "成员"],
|
|
156
156
|
dictionary: ["数据字典", "字典", "选项"],
|
|
157
|
-
report: ["报表", "图表", "看板"],
|
|
158
|
-
data: ["业务数据", "运行数据", "记录", "单据"],
|
|
157
|
+
report: ["报表", "图表", "看板", "趋势图"],
|
|
158
|
+
data: ["业务数据", "运行数据", "记录", "单据", "单子", "单号"],
|
|
159
159
|
service: ["集成服务", "业务服务", "服务"],
|
|
160
160
|
method: ["接口方法", "接口", "方法"],
|
|
161
161
|
category: ["所属目录", "分类", "类别"],
|
|
@@ -445,7 +445,10 @@ export function scoreTools(registry, query) {
|
|
|
445
445
|
&& others.some(([, word]) => posText.indexOf(word, aliasEnd + 1) >= 0));
|
|
446
446
|
if (yields)
|
|
447
447
|
break;
|
|
448
|
-
|
|
448
|
+
// 词表三批(原话档):同分裁决曾退化成名字序——「小数点太多位…改成两位」
|
|
449
|
+
// 里 field.update(小数点)与 data.update(改成)同为 55+18。M1-2a 同哲学:
|
|
450
|
+
// 更长的命中短语是更特指的证据,按别名长度给有界加成(≤6)。
|
|
451
|
+
signals.push({ key: "toolAlias", weight: SEARCH_WEIGHTS.toolAlias + Math.min(alias.length, 6), via: `别名「${alias}」` });
|
|
449
452
|
aliasHit = true;
|
|
450
453
|
break;
|
|
451
454
|
}
|
package/dist/wire.js
CHANGED
|
@@ -313,6 +313,63 @@ export async function wireDownloadBuffer(session, call) {
|
|
|
313
313
|
throw new WireError("malformed-envelope", `empty or non-buffer body for ${call.path} (POST)`);
|
|
314
314
|
return response.body;
|
|
315
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* r64b — binary POST download whose refusals stay ENVELOPES.
|
|
318
|
+
*
|
|
319
|
+
* The app-package exporters (`/app/apppackage/export`,
|
|
320
|
+
* `/lifeCycle/apppackage/lifeCycleExport`) stream a ZIP on success, but every
|
|
321
|
+
* business refusal is still `HTTP 200 + application/json` with
|
|
322
|
+
* `{errcode, errmsg}` (live 1.1.25: 10005 应用编码不能为空, 600005 应用不存在!,
|
|
323
|
+
* 40007 请求方法不正确 — the admin UI re-parses the arraybuffer as JSON for
|
|
324
|
+
* exactly this reason). Treating any 200 body as a package would hand back a
|
|
325
|
+
* "successful" 100-byte artifact that is not a zip, so the JSON-envelope face
|
|
326
|
+
* is classified FIRST: errcode≠0 → business refusal (definitive, no retry);
|
|
327
|
+
* errcode=0 JSON → malformed (an exporter must not answer an envelope).
|
|
328
|
+
*/
|
|
329
|
+
export async function wireDownloadPackageStream(session, call) {
|
|
330
|
+
const response = await session
|
|
331
|
+
.request({ path: call.path, method: "POST", ...(call.body === undefined ? {} : { body: call.body }), responseType: "buffer" })
|
|
332
|
+
.catch((error) => {
|
|
333
|
+
if (error instanceof CloudPivotRequestTimeoutError)
|
|
334
|
+
throw new WireError("transport", error.message);
|
|
335
|
+
throw error;
|
|
336
|
+
});
|
|
337
|
+
if (response.status < 200 || response.status >= 300)
|
|
338
|
+
throw new WireError("http-status", `HTTP ${response.status} for ${call.path} (POST)`, undefined, { httpStatus: response.status });
|
|
339
|
+
const classifyEnvelope = (value) => {
|
|
340
|
+
if (typeof value.errcode !== "number")
|
|
341
|
+
throw new WireError("malformed-envelope", `${call.path} (POST) answered a JSON body without a numeric errcode`);
|
|
342
|
+
const message = typeof value.errmsg === "string" ? value.errmsg : "CloudPivot refused the export";
|
|
343
|
+
if (value.errcode !== 0)
|
|
344
|
+
throw new WireError("business", `errcode ${value.errcode} for ${call.path}: ${message}`, value.errcode);
|
|
345
|
+
throw new WireError("malformed-envelope", `${call.path} (POST) answered a JSON envelope (errcode 0) instead of a ZIP stream`);
|
|
346
|
+
};
|
|
347
|
+
// An in-process transport (tests, MCP shims) may hand back the decoded
|
|
348
|
+
// envelope object instead of bytes; classify it exactly like the JSON body
|
|
349
|
+
// an HTTP transport would deliver.
|
|
350
|
+
if (!Buffer.isBuffer(response.body)) {
|
|
351
|
+
if (response.body && typeof response.body === "object")
|
|
352
|
+
return classifyEnvelope(response.body);
|
|
353
|
+
throw new WireError("malformed-envelope", `empty or non-buffer body for ${call.path} (POST)`);
|
|
354
|
+
}
|
|
355
|
+
if (response.body.length === 0)
|
|
356
|
+
throw new WireError("malformed-envelope", `empty or non-buffer body for ${call.path} (POST)`);
|
|
357
|
+
if (response.body[0] === 0x7b) {
|
|
358
|
+
const text = response.body.toString("utf8");
|
|
359
|
+
let envelope;
|
|
360
|
+
try {
|
|
361
|
+
envelope = JSON.parse(text);
|
|
362
|
+
}
|
|
363
|
+
catch {
|
|
364
|
+
// A body that merely starts with `{` (never a valid zip either) keeps the
|
|
365
|
+
// malformed classification below; do not guess a business errcode.
|
|
366
|
+
envelope = undefined;
|
|
367
|
+
}
|
|
368
|
+
if (envelope && typeof envelope === "object")
|
|
369
|
+
return classifyEnvelope(envelope);
|
|
370
|
+
}
|
|
371
|
+
return response.body;
|
|
372
|
+
}
|
|
316
373
|
/**
|
|
317
374
|
* Ticket 106 — multipart file upload (POST /runtime/query/upload_file). The
|
|
318
375
|
* endpoint answers a PLAIN STRING refId (not an envelope;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.55",
|
|
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.55",
|
|
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.55"
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -25,7 +25,7 @@ only the section for the capability you need —
|
|
|
25
25
|
| 能力 | 一句话 | 能做哪些事(需求线索) | 读哪节 |
|
|
26
26
|
| --- | --- | --- | --- |
|
|
27
27
|
| 环境治理 `environment` | 环境发现/指纹/就绪 | 环境、指纹、版本、连接、登录、就绪、发现 | [环境治理](#环境治理-environment) |
|
|
28
|
-
| 应用 `app` | 应用包生命周期 | 应用、门户、分组、app
|
|
28
|
+
| 应用 `app` | 应用包生命周期 + 导出备份 | 应用、门户、分组、app 建删移、**导出应用/导出应用包/环境备份/迁移** | [应用](#应用-app) |
|
|
29
29
|
| 应用目录(分组)`folder` | 应用树目录/分组 | 目录、分组、文件夹、应用树、移动模型到目录 | [应用目录](#应用目录分组-folder) |
|
|
30
30
|
| 数据字典 `dictionary` | 字典与字典记录 | 字典、选项来源、树型、键值、字段下拉来源 | [数据字典](#数据字典-dictionary) |
|
|
31
31
|
| 业务模型 `model` | 模型生命周期 | 模型、对象、表、主数据、改名、物理删除 | [业务模型](#业务模型-model) |
|
|
@@ -56,8 +56,9 @@ only the section for the capability you need —
|
|
|
56
56
|
|
|
57
57
|
## 应用 `app`
|
|
58
58
|
|
|
59
|
-
-
|
|
60
|
-
- **工具**:`app.list`、`app.create`、`app.update`、`app.delete`、`folder.tree`、`folder.create`、`folder.update`、`folder.delete`
|
|
59
|
+
- **能做哪些事**:列出应用包、创建、改名/分组移动、删除(删除级联其模型);**导出配置包做备份/迁移**(单应用包或整环境生命周期包);**应用树目录(分组)的建/改名/挂载/删**,以及把模型放进目录。
|
|
60
|
+
- **工具**:`app.list`、`app.create`、`app.update`、`app.delete`、`app.export`、`folder.tree`、`folder.create`、`folder.update`、`folder.delete`
|
|
61
|
+
- **导出(r64b)**:`app.export` 省略 `applicationCode` = **整环境**(平台 lifeCycleExport:全部应用包 + 应用分组 + 业务集成服务 + 数据源,`metadata/…` 结构);指定 `applicationCode` = 单个应用包(`meta/{dm,form,view,workflow,report}` + `dependencies/platform/*`)。`includeDependencies:true` 只对单应用有效,把该应用引用的字典/角色/业务集成/数据源一并打进包;环境包平台固定空引用(所以环境范围传 true 会被拒)。ZIP 同步返回,工具核 `PK` 头与条目数后才落盘(默认会话 artifacts,`out` 指定配置根内路径,0600),回执给 `outPath/bytes/sha256/条目清单/资产计数`。平台**没有按资产类型筛选**的参数(不收 `assetTypes`);环境级数据字典/组织/角色/用户不在环境包里。
|
|
61
62
|
- **边界 / 陷阱**:**目录(分组)是应用树节点**:`folder.create` 省略 `parentId` 建的是顶层目录(平台默认挂应用根)、平台**不校验重名**(工具默认按同父同名拒绝)、`folder.delete` **非递归**(有子节点回 `DIRECTORY_NOT_EMPTY`)、树是嵌套 `children`(`folder.tree` 已递归展平给 `path/depth`,只看顶层会误判“没建成”)。模型进目录用 `model.move`。环境已带默认 `applicationCode`,建模**不必**先建应用;`app` 未进 intent 声明式面。**要把 intent 落到新应用**:`omc call app.create`(原子面)→ 把该环境的 `applicationCode` 指向新应用(`omc setup` 重配或改 `~/.config/omc/` 环境配置)→ 再 `intent plan/apply`,模型即落在新应用(用户实测摩擦:曾误以为应用能进 intent)。
|
|
62
63
|
|
|
63
64
|
## 应用目录(分组)`folder`
|
|
@@ -166,8 +167,8 @@ only the section for the capability you need —
|
|
|
166
167
|
|
|
167
168
|
## 流程模板 `workflow`
|
|
168
169
|
|
|
169
|
-
- **能做哪些事**:流程模板 get_draft/get_published、create、update、publish、bindRule(事件处理器规则绑定)、delete、workitem.list、workflow.instanceActivity
|
|
170
|
-
- **工具**:`workflow.get_draft`、`workflow.setButtons`(节点「表单操作」按钮勾选)、`workflow.get_published`、`workflow.validate`、`workflow.create`、`workflow.update`、`workflow.publish`、`workflow.bindRule`、`workflow.delete`、`workflow.permissions`、`workflow.addPermission`、`workflow.removePermission`(发起权限:发布流程不会自动建这一行,缺它一律 40009)、`configure_workflow`、`workitem.list`、`workflow.instanceActivity`、`org.role.list`、`org.department.list`、`org.user.search`、`org.role.users`、`org.role.userScope`、`org.roleGroup.create`、`org.role.create`、`org.role.update`、`org.role.addUsers`、`org.role.removeUsers`、`org.role.setUserScope`、`org.department.create`、`org.department.update`、`org.department.delete`、`org.department.users`、`org.user.create`、`org.user.update`、`org.user.delete`、`org.user.info`、`org.user.departments`、`org.role.delete`、`org.roleGroup.delete`、`org.user.transferDepartment`
|
|
170
|
+
- **能做哪些事**:流程模板 get_draft/get_published、create、update、publish、bindRule(事件处理器规则绑定)、delete、workitem.list、workflow.instanceActivity(实例节点状态诊断);参与人用组织对象。**流程运维三件套**(r64,测试提速定位):workflow.transfer 换审批人 / workflow.activate 跳转节点 / workflow.finish 手动结束(end 规则照常触发)——运维过的实例不能用于真实流程/权限验证。
|
|
171
|
+
- **工具**:`workflow.get_draft`、`workflow.setButtons`(节点「表单操作」按钮勾选)、`workflow.get_published`、`workflow.validate`、`workflow.create`、`workflow.update`、`workflow.publish`、`workflow.bindRule`、`workflow.delete`、`workflow.permissions`、`workflow.addPermission`、`workflow.removePermission`(发起权限:发布流程不会自动建这一行,缺它一律 40009)、`configure_workflow`、`workitem.list`、`workflow.instanceActivity`、`workflow.transfer`、`workflow.activate`、`workflow.finish`、`org.role.list`、`org.department.list`、`org.user.search`、`org.role.users`、`org.role.userScope`、`org.roleGroup.create`、`org.role.create`、`org.role.update`、`org.role.addUsers`、`org.role.removeUsers`、`org.role.setUserScope`、`org.department.create`、`org.department.update`、`org.department.delete`、`org.department.users`、`org.user.create`、`org.user.update`、`org.user.delete`、`org.user.info`、`org.user.departments`、`org.role.delete`、`org.roleGroup.delete`、`org.user.transferDepartment`
|
|
171
172
|
- **recipe**:`omc describe workflow.bindRule --example workflow-handler-binding`;条件两级/一级:`omc describe workflow.update --example workflow-conditional-two-level-approval`
|
|
172
173
|
- **边界 / 陷阱**:greenfield 首版;`publish`/`bindRule` 不得在 `ValidateMessage[]` 拒绝时报告成功。运行时 workitem(提交/审批)走 `data.submit`;想知道实例停在哪/是否错派,用 `workflow.instanceActivity`(无 status=1=真停,参与人全是发起人=解析为空退回)。**发起权限**(`workflow.permissions` / `addPermission`)只有部门/角色/用户三种白名单,**没有「全员」选项**——缺权限行时非管理员通常不能发起(40009),想放开只能授一个够宽的部门/角色,不是「不建行=全员」。**行级数据权限 / 可见范围 / 申请人只看自己的单据不在工具覆盖内**(没有按登录人动态过滤的读面/写面);`org.role.setUserScope` 是角色成员的部门管理范围,不是单据行级可见范围。
|
|
173
174
|
|