@stalfh233/omc-cli 0.4.61 → 0.4.62

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.
@@ -570,6 +570,7 @@ export function registerRuntimeDataLane(tools) {
570
570
  schemaCode: z.string(),
571
571
  bizObjectId: z.string({ required_error: "bizObjectId 必填(参数名就是 bizObjectId——不是 id 也不是 objectId,r44 两个 agent 都猜了 objectId;取值来自 data.submit 读回的 objectId/sequenceNo 或 data.list 的 row.bizObjectId)" }),
572
572
  full: z.boolean().optional().describe("返回未裁剪的完整业务对象(含 owner/creater 等系统字段;默认返回业务字段+身份的精简记录)"),
573
+ fields: z.array(z.string().min(1)).optional().describe("只保留列出的字段——核验状态时传 [\"sequenceStatus\",\"<业务状态字段>\"],别整条 data.load(r4-training 2026-10-20:同一对象被读 74 次);缺失字段回在 missingFields"),
573
574
  capability: capabilityArg,
574
575
  },
575
576
  handler: async (ctx, args, self) => {
@@ -603,7 +604,27 @@ export function registerRuntimeDataLane(tools) {
603
604
  }
604
605
  if (includeSchema)
605
606
  ctx.schemaCache.add(args.schemaCode);
606
- return { schemaCode: args.schemaCode, bizObjectId: args.bizObjectId, exists: data != null, ...(includeSchema ? {} : { schemaCached: true }), data };
607
+ // r4-training 2026-10-20: most repeat loads only ask "did it move?".
608
+ // Trim on the CLI side so the caller pays for the state bits, not the
609
+ // whole record (74 reads of one object in the r4 session).
610
+ let missingFields;
611
+ if (Array.isArray(args.fields) && args.fields.length > 0) {
612
+ if (data && typeof data === "object" && !Array.isArray(data)) {
613
+ const source = data;
614
+ const projected = {};
615
+ const missing = [];
616
+ for (const field of args.fields) {
617
+ if (field in source)
618
+ projected[field] = source[field];
619
+ else
620
+ missing.push(field);
621
+ }
622
+ data = projected;
623
+ if (missing.length > 0)
624
+ missingFields = missing;
625
+ }
626
+ }
627
+ return { schemaCode: args.schemaCode, bizObjectId: args.bizObjectId, exists: data != null, ...(missingFields ? { missingFields, availableFields: data && typeof data === "object" ? Object.keys(data) : [] } : {}), ...(includeSchema ? {} : { schemaCached: true }), data };
607
628
  }, { full: args.full === true, target: `data.load:${args.schemaCode}:${args.bizObjectId}` });
608
629
  },
609
630
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.4.61",
3
+ "version": "0.4.62",
4
4
  "description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -50,9 +50,9 @@
50
50
  "access": "public"
51
51
  },
52
52
  "dependencies": {
53
- "@stalfh233/omc-fake-platform": "0.4.61",
53
+ "@stalfh233/omc-fake-platform": "0.4.62",
54
54
  "commander": "14.0.3",
55
- "omc-core": "0.4.61",
55
+ "omc-core": "0.4.62",
56
56
  "proper-lockfile": "4.1.2",
57
57
  "write-file-atomic": "6.0.0",
58
58
  "zod": "^3.23.8",
@@ -150,6 +150,7 @@ rules:
150
150
 
151
151
  - **两条路**:模型+表单+流程一揽子交付走**意图**(`intent` 的 `workflow` 能力,声明式一次 apply);只动流程或想逐步控制走**低层链** `workflow.create → workflow.update(权限/节点)→ workflow.publish`,标准链配方见 `omc describe workflow.update`(含多级审批/participant 三形态/自动回填说明)。流程权限细节见下节。
152
152
  - 一个模型只能有一个流程;已有流程的模型直接 `workflow.update`,不要另建。
153
+ - **核验状态用投影,别重复整条读**:`data.load --args '{"schemaCode":..,"bizObjectId":..,"fields":["sequenceStatus","<业务状态字段>"]}'` 只回指定字段(缺失项在 `missingFields`)——r4 实测同一对象被整条读 74 次;大结果先 `artifact get <id> --summary` → `--keys/--jq`,别整包内联进推理。
153
154
  - **参与人解析失败分两种,别当成同一种(1.1.25 实测)**:① **解析为空**(角色零成员、成员未挂部门、自由文本、角色码不存在)→ 引擎把任务**退回发起人**,流程继续,症状是「审批人显示成我自己」,`data.submit` 与 `workitem.list` 都正常;② **参与人函数未注册**(`FindUsersByRoleFunction` / `FindUsersSpecByRoleFunction`,1.1.25 未内置)→ `FunctionNotFoundException`、不生成待办、实例卡 PROCESSING 而接口仍回 `errCode 0`。区分用 `omc call workflow.instanceActivity --args '{"workflowInstanceId":"<id>"}'`:无 `status:1` 节点=卡住;`status:1` 且参与人全是发起人=`diagnosis.warnings` 给 `participant-fallback-to-originator`。不要从 `workflow.get_published` 的摘要回抄函数式参与人;内置写法只有 `FindUserByRole(org, roleCode[, order])`,跨部门/全局角色优先用参与者对象数组(角色 id)。
154
155
 
155
156
  ## 流程字段权限