@stalfh233/omc-cli 0.4.25 → 0.4.27

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.
@@ -178,9 +178,13 @@ function phraseOf(tool, args, outcome) {
178
178
  case "method.delete":
179
179
  return `删除业务集成方法 ${stringArg(args, "methodCode") ?? "?"}(服务 ${stringArg(args, "serviceCode") ?? "?"})`;
180
180
  case "data.save":
181
+ // r19 opencode-run finding: a stale r5-crm-era summary (written for an
182
+ // abandoned submit-flag design) contradicted the REAL one-call chain —
183
+ // the agent read "规则不派发" next to a COMPLETED readback with the rule
184
+ // fired. The summary must match the delivered semantics.
181
185
  return args.submit === true
182
- ? `保存数据(模型 ${schemaCode ?? "?"})——submit:true 不走表单提交管线:行落 DRAFT、预置 Create/Update 规则不派发。要建行并触发规则:直接调 data.submit(不带 bizObjectId=新建并提交,行 COMPLETED、规则派发,r5-crm 实证 2026-10-09);data.save 仅用于存草稿`
183
- : `保存数据(模型 ${schemaCode ?? "?"})`;
186
+ ? `保存并直提数据(模型 ${schemaCode ?? "?"})——一调完成态:DRAFT→COMPLETED,Create 规则已派发(无流程模型;流程模型会拒绝并指路两段式)`
187
+ : `保存数据(模型 ${schemaCode ?? "?"})——草稿 DRAFT;要一调完成态加 submit:true`;
184
188
  case "data.update":
185
189
  return `更新数据 ${stringArg(args, "bizObjectId") ?? "?"}(${schemaCode ?? "?"})`;
186
190
  case "data.submit":
@@ -551,6 +551,15 @@ export function registerRuntimeDataLane(tools) {
551
551
  submit: z.boolean().optional().describe("r18 retro:true=一调完成态——保存后立即直提(无流程模型 DRAFT→COMPLETED,触发 Create 业务规则);与 workflowCode 互斥(流程草稿须走 data.submit 两段式)。默认 false 仅存草稿"),
552
552
  ...readbackProjectionArgs,
553
553
  }, async (session, args) => {
554
+ // F-A (self-audit): the combo used to be silently ignored (the workflow
555
+ // draft branch returns without honoring submit). Refuse before any wire.
556
+ if (args.submit === true && typeof args.workflowCode === "string" && args.workflowCode.trim())
557
+ throw new ToolRefusalError({
558
+ status: "refused",
559
+ blocker: "submit-workflow-code-conflict",
560
+ schemaCode: args.schemaCode,
561
+ message: "submit:true 与 workflowCode 互斥——workflowCode 是流程草稿两段式的第一段(返回 workItemId 后用 data.submit 提交);无流程模型的一调完成态用 submit:true 且不带 workflowCode",
562
+ });
554
563
  const { sheetCode, resolvedFrom } = await resolveFormSheetCode(session, { schemaCode: args.schemaCode, sheetCode: args.sheetCode });
555
564
  const formData = await stampChildRowStatuses(session, args.schemaCode, args.formData);
556
565
  if (typeof args.workflowCode === "string" && args.workflowCode.trim()) {
@@ -645,6 +654,24 @@ export function registerRuntimeDataLane(tools) {
645
654
  // "record AND rule effect", not "a draft". Chain the no-flow submit in
646
655
  // the same governed write (the same sibling execute apply_changes uses).
647
656
  if (args.submit === true) {
657
+ // F-B (self-audit): data.submit AUTO-STARTS a published workflow
658
+ // (resolvePublishedWorkflowCode → formType 1 → PROCESSING, not
659
+ // COMPLETED) — the one-call chain's ruleHint would lie. Workflow-
660
+ // backed models keep the two-phase chain.
661
+ const publishedWorkflow = await resolvePublishedWorkflowCode(session, args.schemaCode);
662
+ if (publishedWorkflow) {
663
+ return {
664
+ performed: { errcode: performed.errcode, bizObjectId, sheetCode, resolvedFrom, submitted: false },
665
+ readback: {
666
+ ...plainReadback,
667
+ submitRefused: {
668
+ blocker: "submit-model-has-workflow",
669
+ workflowCode: publishedWorkflow,
670
+ message: `本模型有已发布流程 ${publishedWorkflow}:submit:true 的直提只适用无流程模型(流程模型会自动起流程得到 PROCESSING 而非完成态,Create 规则语义也不同)。草稿已保存;正确链路 = data.save {workflowCode} 建流程草稿(返回 workItemId)→ data.submit {bizObjectId, workflowInstanceId, workItemId}(见 describe data.submit --example workflow-backed-data-submit)`,
671
+ },
672
+ },
673
+ };
674
+ }
648
675
  const submitTool = tools.find((entry) => entry.name === "data.submit");
649
676
  const submitOutcome = submitTool?.writeExecute
650
677
  ? await submitTool.writeExecute(session, { schemaCode: args.schemaCode, bizObjectId, formData: args.formData })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.4.25",
3
+ "version": "0.4.27",
4
4
  "description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "commander": "14.0.3",
54
- "omc-core": "0.4.25",
54
+ "omc-core": "0.4.27",
55
55
  "proper-lockfile": "4.1.2",
56
56
  "write-file-atomic": "6.0.0",
57
57
  "zod": "^3.23.8",
@@ -171,7 +171,10 @@ only the section for the capability you need —
171
171
  - **recipe**:
172
172
  - `omc describe data.save --example workflow-backed-data-save`
173
173
  - `omc describe data.submit --example workflow-backed-data-submit`(有流程)
174
- - 无流程模型的规则验证路径:`data.save`(DRAFT,不触发规则)→ `data.submit {schemaCode, bizObjectId, formData}` 直提(COMPLETED,触发 Create 规则)——示例 `omc describe data.submit --example plain-data-submit`
174
+ - 无流程模型的规则验证路径(两选):
175
+ - 一调:`data.save {schemaCode, formData, submit:true}` ——保存+直提 COMPLETED,触发 Create 规则(模型有已发布流程时会拒绝并指路两段式)
176
+ - 两步:`data.save`(DRAFT)→ `data.submit {schemaCode, bizObjectId, formData}` ——示例 `omc describe data.submit --example plain-data-submit`
177
+ - 流程模型:`data.save {workflowCode}`(返回 workItemId)→ `data.submit {bizObjectId, workflowInstanceId, workItemId}`(workflow-backed-data-submit)
175
178
  - **边界 / 陷阱**:读实际业务记录是 OMC 独有能力。**计算字段(FORMULA/子表计算)不由 API 回填**——写测试数据带预算值,公式正确性人工前台确认;带子表计算字段的模型 API 写可能 50000(服务端重算 NPE),前台正常。
176
179
 
177
180
  ---