@stalfh233/omc-cli 0.8.29 → 0.8.30

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/cli.js CHANGED
@@ -1160,6 +1160,39 @@ function applyReadArgAliases(toolName, schemaKeys, input) {
1160
1160
  applied[alias] = describe(next);
1161
1161
  return { args, applied };
1162
1162
  };
1163
+ // 探针 V F2(0.8.30):filter/filters/filterGroup 里的 `operator` 是 `op` 的
1164
+ // 同义别名(CloudPivot 习惯键)。在此换算并回执 aliasesApplied;两者同给且
1165
+ // 不一致 → 走既有 read-arg-alias-conflict。
1166
+ if (schemaKeys.has("filter") || schemaKeys.has("filters")) {
1167
+ const fixClause = (clause, path) => {
1168
+ if (!clause || typeof clause !== "object" || Array.isArray(clause))
1169
+ return clause;
1170
+ const row = clause;
1171
+ if (Array.isArray(row.clauses))
1172
+ return { ...row, clauses: row.clauses.map((entry, index) => fixClause(entry, `${path}.clauses[${index}]`)) };
1173
+ if (row.operator === undefined)
1174
+ return row;
1175
+ if (row.op !== undefined && row.op !== row.operator)
1176
+ return { __aliasConflict: true, path };
1177
+ const { operator, ...rest } = row;
1178
+ applied[`${path}.operator`] = `op=${String(operator)}`;
1179
+ return { ...rest, op: operator };
1180
+ };
1181
+ const fixedFilter = fixClause(args.filter, "filter");
1182
+ const fixedFilters = Array.isArray(args.filters) ? args.filters.map((entry, index) => fixClause(entry, `filters[${index}]`)) : args.filters;
1183
+ const fixedGroup = fixClause(args.filterGroup, "filterGroup");
1184
+ const hasConflict = (value) => Array.isArray(value)
1185
+ ? value.some(hasConflict)
1186
+ : !!value && typeof value === "object" && (value.__aliasConflict === true || (Array.isArray(value.clauses) && (value.clauses).some(hasConflict)));
1187
+ if ([fixedFilter, fixedGroup, ...(Array.isArray(fixedFilters) ? fixedFilters : [])].some(hasConflict))
1188
+ return { args, applied, conflict: { alias: "operator", canonical: "op" } };
1189
+ if ("filter" in args)
1190
+ args.filter = fixedFilter;
1191
+ if ("filters" in args)
1192
+ args.filters = fixedFilters;
1193
+ if ("filterGroup" in args)
1194
+ args.filterGroup = fixedGroup;
1195
+ }
1163
1196
  const pageSize = move("pageSize", "size", (value) => (typeof value === "number" && Number.isFinite(value) ? value : undefined), (next) => `size=${String(next)}`);
1164
1197
  if (pageSize !== undefined)
1165
1198
  return pageSize;
@@ -3527,6 +3560,18 @@ async function main() {
3527
3560
  // stderr is the diagnostics stream: apply the same Windows code-page policy
3528
3561
  // as stdout before ANY message is written (banner, doctor, refusals).
3529
3562
  installCodePageSafeStderr();
3563
+ // 探针 V F6(0.8.30,P1):`--quiet` 机器模式——抑制 stderr 人类诊断行
3564
+ // (stdout 信封/退出码/artifact 不变)。在解析前从 argv 摘掉,任意子命令位置都可用。
3565
+ const quietRequested = process.argv.includes("--quiet");
3566
+ const helpRequested = process.argv.includes("--help") || process.argv.includes("-h");
3567
+ if (quietRequested) {
3568
+ for (let index = process.argv.length - 1; index >= 0; index -= 1)
3569
+ if (process.argv[index] === "--quiet")
3570
+ process.argv.splice(index, 1);
3571
+ // `--help` 豁免:帮助文本本身走 stderr 时不能被吞掉。
3572
+ if (!helpRequested)
3573
+ process.stderr.write = (() => true);
3574
+ }
3530
3575
  // issue 13:临时期限窗口的懒恢复——任意命令启动时检查所有环境的
3531
3576
  // writableWindow,过期即恢复只读(无后台进程),当次 stderr 提示一句。
3532
3577
  // 用与命令相同的配置根(OMC_CONFIG_HOME / homedir),失败静默交给命令自身。
@@ -3817,7 +3862,7 @@ async function main() {
3817
3862
  commandExitCode = CLI_EXIT_CODES.ok;
3818
3863
  });
3819
3864
  command.command("doctor").option("--environment <environment>").option("--env <environment>").option("--service <serviceCode>", "可选:体检单个业务集成服务的鉴权参数形状(掩码/占位/全 0 检出,WARN 非致命)").option("--fresh-login", "忽略 token 缓存,做一次完整登录握手(默认复用缓存,登录请求 0 次;回执 loginSource 标明来源)").addOption(new Option("--jq [path]", "--jq 不是 jq,仅路径选择器(与 call --jq 同 DSL;可逗号多路径;裸 --jq 列顶层键),相对回执 result(checks/anchor/unsupportedCapabilities)").argParser((value, previous = []) => [...previous, value]).default([])).option("--explain", "--jq 未命中时给出完整排查载荷(available/correctPath/成因 hint);默认 miss 只回 missedAt/didYouMean/helpRef").action(async (options) => { commandExitCode = await cmdDoctor(new ConfigStore(defaultPaths()), options.environment ?? options.env, options.service, options.freshLogin === true, Array.isArray(options.jq) ? options.jq : [], options.explain === true); });
3820
- command.command("call <tool>").option("--env <environment>", "环境名;项目白名单按当前 cwd 解析,须在含 .omc-env 的目录内运行").option("--environment <environment>").option("--args <json>").option("--args-file <path>", "从文件读参数 JSON。**必须位于配置根内**(数组批量请改用 --args-list;跨目录/系统临时文件会被拒);免落盘用 `--args -`(stdin)").option("--args-list <json-array>", '同一工具跑 N 次(JSON 数组,每条一个 args 对象,最多 200 条);超过上限请分批,或用 omc script 读文件。逐条执行、默认不中断,最后回 succeeded/failed 汇总。**只回汇总(succeeded/failed + 每行 ok),不内联各条 result**;读批量请用 `omc script -`(逐行带 result)或工具的 schemaCodes/ruleCodes 批参数。适合批量建字段等').option("--preflight", "与 --args-list 一起用:只跑参数校验 + 写前语义闸(零 wire、零写入),一次报全所有形状问题").option("--keys", "与 artifact get 的 --keys 同义(= --extract-keys):列出本次结果 artifact 的顶层键与体积").addOption(new Option("--extract <path>", "在本次结果的 artifact 内取一个路径的值(可重复;省掉一次 artifact get)").argParser((value, previous = []) => [...previous, value]).default([])).addOption(new Option("--jq [path]", "仅路径选择器,不是 jq(不支持 {a,b} 对象构造)——不是 jq 表达式,不支持管道;[] 映射如 items[].fields.planNo;裸 --jq 列顶层键。单路径命中时 result 直接是节点本体。示例:omc call model.list --env e --jq models · omc call rule.list --env e --args '{\"schemaCode\":\"m\"}' --jq rules[].code · omc call workflow.get_published --env e --args '{\"code\":\"f\"}' --jq activities[].bizActions").argParser((value, previous = []) => [...previous, value]).default([])).option("--extract-keys", "列出本次结果 artifact 的顶层键与体积(省掉一次 artifact get --keys)").option("--max-output-bytes <bytes>", "最终 stdout 信封预算;默认 65536(投影/--jq 之后再判);读面 diet(~2048) 独立外置 detailArtifactId,抬高本参数不会把已 diet 的大表重新内联;artifact get 内联上限 8192").option("--request-id <requestId>").option("--reason <text>", "写入原因(审计面,仅写操作):记入本次写 journal 行的 reason;不是工具参数(写 schema 拒未知键),也不参与任何门禁").option("--timeout-ms <milliseconds>").option("--wait <milliseconds>", "仅 `omc call` / `omc intent apply` 支持;写锁冲突时有界排队(0=立刻拒绝)").option("--dry-run").option("--explain", "--jq 未命中时给出完整排查载荷(available 该层全部键、correctPath、nextCommand、成因 hint);默认 miss 只回 missedAt/didYouMean/helpRef(≤300B)").addHelpText("after", `\n${onboardingHelp()}\n`).action(async (tool, options) => {
3865
+ command.command("call <tool>").option("--env <environment>", "环境名;项目白名单按当前 cwd 解析,须在含 .omc-env 的目录内运行").option("--environment <environment>").option("--args <json>").option("--args-file <path>", "从文件读参数 JSON。**必须位于配置根内**(数组批量请改用 --args-list;跨目录/系统临时文件会被拒);免落盘用 `--args -`(stdin)").option("--args-list <json-array>", '同一工具跑 N 次(JSON 数组,每条一个 args 对象,最多 200 条);超过上限请分批,或用 omc script 读文件。逐条执行、默认不中断,最后回 succeeded/failed 汇总。**只回汇总(succeeded/failed + 每行 ok),不内联各条 result**;读批量请用 `omc script -`(逐行带 result)或工具的 schemaCodes/ruleCodes 批参数。适合批量建字段等').option("--preflight", "与 --args-list 一起用:只跑参数校验 + 写前语义闸(零 wire、零写入),一次报全所有形状问题").option("--keys", "与 artifact get 的 --keys 同义(= --extract-keys):列出本次结果 artifact 的顶层键与体积").addOption(new Option("--extract <path>", "在本次结果的 artifact 内取一个路径的值(可重复;省掉一次 artifact get)").argParser((value, previous = []) => [...previous, value]).default([])).addOption(new Option("--jq [path]", "仅路径选择器,不是 jq(不支持 {a,b} 对象构造)——不是 jq 表达式,不支持管道;[] 映射如 items[].fields.planNo;裸 --jq 列顶层键。单路径命中时 result 直接是节点本体。示例:omc call model.list --env e --jq models · omc call rule.list --env e --args '{\"schemaCode\":\"m\"}' --jq rules[].code · omc call workflow.get_published --env e --args '{\"code\":\"f\"}' --jq activities[].bizActions").argParser((value, previous = []) => [...previous, value]).default([])).option("--extract-keys", "列出本次结果 artifact 的顶层键与体积(省掉一次 artifact get --keys)").option("--max-output-bytes <bytes>", "最终 stdout 信封预算;默认 65536(投影/--jq 之后再判);读面 diet(~2048) 独立外置 detailArtifactId,抬高本参数不会把已 diet 的大表重新内联;artifact get 内联上限 8192").option("--request-id <requestId>").option("--reason <text>", "写入原因(审计面,仅写操作):记入本次写 journal 行的 reason;不是工具参数(写 schema 拒未知键),也不参与任何门禁").option("--timeout-ms <milliseconds>").option("--wait <milliseconds>", "仅 `omc call` / `omc intent apply` 支持;写锁冲突时有界排队(0=立刻拒绝)").option("--dry-run").option("--quiet", "机器模式:抑制 stderr 人类诊断行(stdout 信封/退出码/artifact 不变;管道里不要 2>&1)").option("--explain", "--jq 未命中时给出完整排查载荷(available 该层全部键、correctPath、nextCommand、成因 hint);默认 miss 只回 missedAt/didYouMean/helpRef(≤300B)").addHelpText("after", `\n${onboardingHelp()}\n`).action(async (tool, options) => {
3821
3866
  const rest = [tool, ...(options.env ? ["--env", options.env] : []), ...(options.environment ? ["--environment", options.environment] : []), ...(options.args !== undefined ? ["--args", options.args] : []), ...(options.argsFile !== undefined ? ["--args-file", options.argsFile] : []), ...(options.argsList !== undefined ? ["--args-list", options.argsList] : []), ...(options.preflight ? ["--preflight"] : []), ...(Array.isArray(options.extract) ? options.extract.flatMap((path) => ["--extract", path]) : []), ...(options.jq === true ? ["--jq"] : Array.isArray(options.jq) ? options.jq.flatMap((path) => path === true ? ["--jq"] : ["--jq", path]) : []), ...(options.extractKeys ? ["--extract-keys"] : []),
3822
3867
  ...(options.keys ? ["--keys"] : []), ...(options.maxOutputBytes !== undefined ? ["--max-output-bytes", options.maxOutputBytes] : []), ...(options.requestId ? ["--request-id", options.requestId] : []), ...(options.reason !== undefined ? ["--reason", options.reason] : []), ...(options.timeoutMs !== undefined ? ["--timeout-ms", options.timeoutMs] : []), ...(options.wait !== undefined ? ["--wait", options.wait] : []), ...(options.dryRun ? ["--dry-run"] : []), ...(options.explain ? ["--explain"] : [])];
3823
3868
  commandExitCode = await cmdCall(new ConfigStore(defaultPaths()), rest);
@@ -83,9 +83,15 @@ function resolveSimpleOp(raw) {
83
83
  return Object.keys(SIMPLE_OP_MAP).find((key) => key.toLowerCase() === lower);
84
84
  }
85
85
  function translateClause(clause) {
86
- const op = clause && typeof clause === "object" ? resolveSimpleOp(clause.op) : undefined;
86
+ // 探针 V F2(0.8.30):CloudPivot 习惯键 `operator` 作为 `op` 的同义别名;
87
+ // 两者同给且不一致时报 alias-conflict(不静默覆盖)。
88
+ const source = clause && typeof clause === "object" ? clause : undefined;
89
+ const rawOp = source?.op ?? source?.operator;
90
+ if (source?.op !== undefined && source?.operator !== undefined && source.op !== source.operator)
91
+ throw new FilterDslError("alias-conflict", "filter 同时给 op 与 operator 且不一致:二者是同一比较符的别名,只能留一个");
92
+ const op = resolveSimpleOp(rawOp);
87
93
  if (op === undefined)
88
- throw new FilterDslError("invalid-op", `unsupported filter op '${String(clause?.op)}'(accepted: ${Object.keys(SIMPLE_OP_MAP).join("/")};op 大小写不敏感,Eq/EQ→eq)`);
94
+ throw new FilterDslError("invalid-op", `unsupported filter op '${String(rawOp)}'(accepted: ${Object.keys(SIMPLE_OP_MAP).join("/")};op 大小写不敏感,Eq/EQ→eq;operator 是 op 的别名)`);
89
95
  const field = String(clause.field ?? "").trim();
90
96
  if (!field)
91
97
  throw new FilterDslError("missing-field", "filter field is required");
@@ -140,6 +140,12 @@ export function writeSummary(tool, args, outcome, phase = "done") {
140
140
  const schema = stringArg(args, "schemaCode") ?? "?";
141
141
  return `未确认删除(delete-target-not-in-schema)${ids.length} 条不属于 ${schema}:${ids.join("、")};本工具无法判定归属——先 model.list 取候选模型再逐个 data.list 核对(或问用户),别据此宣称已清理`;
142
142
  }
143
+ if (phase === "done" && tool === "data.delete" && (outcome?.readback?.blocker === "delete-target-absent" || outcome?.readback?.deleteTargetAbsent === true)) {
144
+ const listed = Array.isArray(outcome.readback.deleteTargetAbsentIds)
145
+ ? outcome.readback.deleteTargetAbsentIds.map(String)
146
+ : [(Array.isArray(args.bizObjectIds) ? String(args.bizObjectIds[0]) : undefined) ?? stringArg(args, "bizObjectId") ?? "?"];
147
+ return `未确认删除(delete-target-absent)${listed.join("、")}:平台回 50000 但删后读回已不存在;默认不把「读不到」当成功,确认幂等重发带 allowAlreadyAbsent:true`;
148
+ }
143
149
  // r28b F11: data.delete already-absent must NOT read as「已删除…」— humans/CI
144
150
  // that skim stderr treat the leading verb as the outcome. Say「未删除」first.
145
151
  if (phase === "done" && tool === "data.delete" && outcome?.performed?.skipped === "already-absent") {
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
2
2
  import { z } from "zod";
3
3
  import { ENDPOINTS } from "../endpoints.js";
4
4
  import { capabilityArg, environmentArg } from "../args.js";
5
- import { governedRead } from "../read.js";
5
+ import { governedRead, compactReadback } from "../read.js";
6
6
  import { writeTool } from "../write.js";
7
7
  import { encodeJsonColumn } from "../json-column.js";
8
8
  import { defineTool, ToolInputError, ToolRefusalError } from "../tool-types.js";
@@ -594,8 +594,13 @@ export function registerListViewLane(tools) {
594
594
  columnCount: columns.length,
595
595
  columns,
596
596
  sorts,
597
+ // 探针 V F3(0.8.30):通用读面 diet 会把 `sorts`/`conditions`(CODE_LIST_KEYS)
598
+ // 折成字段名,配方却要用默认面验收方向/筛选值。给不折叠的详细键(无 options,
599
+ // 大载荷仍走 full:true/artifact)。
600
+ sortsDetailed: sorts,
597
601
  conditionCount: conditions.length,
598
602
  conditions,
603
+ conditionsDetailed: conditions.map(({ options: _options, ...rest }) => rest),
599
604
  actionCodes: readArray(model, "queryActions").map((action) => action.actionCode).filter((value) => value !== undefined),
600
605
  buttonCount: readArray(model, "customButtons").length,
601
606
  // r14 F5 / r11 #6: the default face exposed only `buttonCount`, so a
@@ -651,6 +656,27 @@ export function registerListViewLane(tools) {
651
656
  // live as soon as it is saved. Say so, so the flag is not misread.
652
657
  hint: "published 是设计态占位(列表视图无草稿/发布生命周期),false 不代表视图未生效;列/排序/条件/动作/按钮是否落成以 columns/sorts/conditionCount/actionCodes 与 field.list 为准。完整报文加 full:true。NUMERICAL 列的 displayFormat 是平台数值格式枚举(decimal scale2→3、currency→7、percent→6…),不是字段 scale;列的小数位以字段 options.scale 为准(用 field.list 读回)",
653
658
  };
659
+ }, {
660
+ compact: (result) => {
661
+ const base = compactReadback(result);
662
+ const detailedSorts = (result.sortsDetailed ?? result.sorts ?? []);
663
+ const detailedConditions = (result.conditionsDetailed ?? result.conditions ?? []);
664
+ // 空 detailed 不能留下 compactReadback 的 {count:0,sha256,omitted:true} 占位。
665
+ if (detailedSorts.length === 0)
666
+ delete base.sortsDetailed;
667
+ if (detailedConditions.length === 0)
668
+ delete base.conditionsDetailed;
669
+ const codeOf = (entry) => typeof entry === "string" ? entry : entry && typeof entry === "object" ? String(entry.propertyCode ?? "") : "";
670
+ return {
671
+ ...base,
672
+ ...(detailedSorts.length > 0
673
+ ? { sorts: detailedSorts.map(codeOf).filter(Boolean), sortsDetailed: detailedSorts }
674
+ : {}),
675
+ ...(detailedConditions.length > 0
676
+ ? { conditions: detailedConditions.map(codeOf).filter(Boolean), conditionsDetailed: detailedConditions }
677
+ : {}),
678
+ };
679
+ },
654
680
  }),
655
681
  }));
656
682
  /**
@@ -540,7 +540,19 @@ export function projectionHintFace(items, evidence) {
540
540
  ...base,
541
541
  projectionKnown: true,
542
542
  ...(projectedFields.length > 0 ? { projectedFields } : {}),
543
- ...(unprojected.length > 0 ? { unprojected } : {}),
543
+ ...(unprojected.length > 0
544
+ ? {
545
+ unprojected,
546
+ // 探针 V F5(0.8.30):大行集(>10)保持既有字节形状(读门预算),
547
+ // 小行集给口径说明;items[].unprojected 始终是行内全部缺席键。
548
+ ...(items.length <= 10
549
+ ? {
550
+ unprojectedScope: "view-columns",
551
+ unprojectedNote: "顶层只列视图列缺口;items[].unprojected 含系统列",
552
+ }
553
+ : {}),
554
+ }
555
+ : {}),
544
556
  };
545
557
  }
546
558
  /**
@@ -4332,6 +4344,33 @@ export function registerRuntimeDataLane(tools) {
4332
4344
  });
4333
4345
  }
4334
4346
  catch (error) {
4347
+ if (error instanceof WireError && error.kind === "business" && error.errcode === 50000) {
4348
+ // 探针 V F8(0.8.30,P1):已删除行重跑删除,平台回 50000 服务异常。
4349
+ // 先删后读确认行是否真的不存在:是 → 明确的 delete-target-absent
4350
+ // (不是 wire-business);否 → 保留原错误(真实平台故障)。
4351
+ let absentAfter50000 = false;
4352
+ try {
4353
+ const readback = await wireCall(session, { path: ENDPOINTS.runtimeFormLoad, query: { schemaCode: args.schemaCode, sheetCode, objectId: bizObjectId } });
4354
+ const value = readback.data;
4355
+ absentAfter50000 = value == null || value === false;
4356
+ }
4357
+ catch (readError) {
4358
+ if (readError instanceof WireError && readError.kind === "business" && readError.errcode === 304001)
4359
+ absentAfter50000 = true;
4360
+ }
4361
+ if (absentAfter50000)
4362
+ return {
4363
+ bizObjectId,
4364
+ skipped: allowAlreadyAbsent ? "already-absent" : "delete-target-absent",
4365
+ absent: true,
4366
+ noop: true,
4367
+ deleted: false,
4368
+ alreadyAbsent: true,
4369
+ wire50000: true,
4370
+ precheck: pre.state,
4371
+ ...(pre.state === "unknown" ? { precheckError: pre.error } : {}),
4372
+ };
4373
+ }
4335
4374
  // L6: 删除调用本身回 304001(业务对象不存在)。删前读到过 → 真并发
4336
4375
  // already-absent;删前读失败(unknown)→ 仍无法区分「并发删」与
4337
4376
  // 「schemaCode 写错」,默认按 uncertain 处理。
@@ -4379,6 +4418,7 @@ export function registerRuntimeDataLane(tools) {
4379
4418
  noop: true,
4380
4419
  alreadyAbsent: true,
4381
4420
  notInSchema: [id],
4421
+ absentBeforeDelete: true,
4382
4422
  precheck: String(one.precheck ?? "absent"),
4383
4423
  ...(one.precheckError !== undefined ? { precheckError: one.precheckError } : {}),
4384
4424
  status: "uncertain",
@@ -4390,6 +4430,32 @@ export function registerRuntimeDataLane(tools) {
4390
4430
  },
4391
4431
  };
4392
4432
  }
4433
+ if (one.skipped === "delete-target-absent") {
4434
+ const id = ids[0];
4435
+ const idempotentCommand = `omc call data.delete --args '${JSON.stringify({ schemaCode: args.schemaCode, bizObjectId: id, allowAlreadyAbsent: true })}'`;
4436
+ return {
4437
+ status: "uncertain",
4438
+ blocker: "delete-target-absent",
4439
+ retryable: false,
4440
+ nextCommand: idempotentCommand,
4441
+ message: `平台对删除 ${id} 回 50000 服务异常,但删后 data.load 已读不到该行:行已不存在(可能已被删除/并发删除)。本工具默认不把「读不到」当成功;确认幂等重发请带 allowAlreadyAbsent:true。`,
4442
+ performed: { skipped: "delete-target-absent", absent: true, noop: true, deleted: false, alreadyAbsent: true, sheetCode, resolvedFrom },
4443
+ readback: {
4444
+ absent: true,
4445
+ deleted: false,
4446
+ noop: true,
4447
+ alreadyAbsent: true,
4448
+ deleteTargetAbsent: true,
4449
+ wire50000: true,
4450
+ ...(one.precheck !== undefined ? { precheck: one.precheck } : {}),
4451
+ ...(one.precheckError !== undefined ? { precheckError: one.precheckError } : {}),
4452
+ recoveryHint: "行已不存在;清理脚本要幂等重入就带 allowAlreadyAbsent:true(本回执默认零成功结论)。",
4453
+ thisRow: { absent: true, deleted: false },
4454
+ thisRowDeleted: true,
4455
+ ...(await remainingRows(session, args.schemaCode, sheetCode)),
4456
+ },
4457
+ };
4458
+ }
4393
4459
  if (one.skipped === "already-absent") {
4394
4460
  return {
4395
4461
  performed: { skipped: "already-absent", noop: true, deleted: false, sheetCode, resolvedFrom },
@@ -4428,13 +4494,16 @@ export function registerRuntimeDataLane(tools) {
4428
4494
  // form/load 按 schemaCode 分表,读不到只说明「不属于 <schemaCode>」,可能是
4429
4495
  // 并发已删,也可能 schemaCode 写错(id 实际在另一个模型)。
4430
4496
  const notInSchema = deleted.filter((entry) => entry.skipped === "target-not-in-schema").map((entry) => String(entry.bizObjectId));
4497
+ // 探针 V F8 复核(0.8.30):50000 且删后已不存在的条目单独成列;它们不是
4498
+ // 「回读仍在」,不能进 undeletedIds 触发假诊断。
4499
+ const deleteTargetAbsentIds = deleted.filter((entry) => entry.skipped === "delete-target-absent").map((entry) => String(entry.bizObjectId));
4431
4500
  // 运行时兜底(主防线,取代版本门槛):平台回「成功」不算数,删后按 id
4432
4501
  // 集合回读才算数。`deleted:false` 且不是 already-absent/not-in-schema = 平台
4433
4502
  // 说删了但行还在(1.1.25 已知假成功)。代价:每条 id 一次 form/load 回读
4434
4503
  // (deleteOne 内),这是识别假成功的唯一可靠方式——平台批量返回恒为
4435
4504
  // Boolean.TRUE / 计数。
4436
4505
  const undeletedIds = deleted
4437
- .filter((entry) => entry.deleted !== true && entry.skipped !== "already-absent" && entry.skipped !== "target-not-in-schema")
4506
+ .filter((entry) => entry.deleted !== true && entry.skipped !== "already-absent" && entry.skipped !== "target-not-in-schema" && entry.skipped !== "delete-target-absent")
4438
4507
  .map((entry) => String(entry.bizObjectId));
4439
4508
  const batchDeleteIneffective = undeletedIds.length > 0
4440
4509
  ? {
@@ -4456,28 +4525,35 @@ export function registerRuntimeDataLane(tools) {
4456
4525
  // 默认口径(P1):有 notInSchema 就不回 ok——未见过的 id 不能算已删,也不能
4457
4526
  // 让 absent/deletionVerified 只凭「读不到」为 true。allowAlreadyAbsent:true
4458
4527
  // 时这些条目走 old already-absent 分支,notInSchema 为空、整批照旧可 ok。
4459
- const uncertain = notInSchema.length > 0;
4528
+ const uncertain = notInSchema.length > 0 || deleteTargetAbsentIds.length > 0;
4529
+ const uncertainBlocker = notInSchema.length > 0 ? "delete-target-not-in-schema" : "delete-target-absent";
4530
+ const idempotentCommand = `omc call data.delete --args '${JSON.stringify({ schemaCode: args.schemaCode, bizObjectIds: deleteTargetAbsentIds.length > 0 ? deleteTargetAbsentIds : undefined, ...(deleteTargetAbsentIds.length === 0 ? { bizObjectId: ids[0] } : {}), allowAlreadyAbsent: true })}'`;
4460
4531
  return {
4461
4532
  ...(uncertain
4462
4533
  ? {
4463
4534
  status: "uncertain",
4464
- blocker: "delete-target-not-in-schema",
4535
+ blocker: uncertainBlocker,
4465
4536
  retryable: false,
4466
- nextCommand: `omc call model.list --args '{"allApplications":true}'`,
4467
- nextAction: "本工具无法判定这些 id 属于哪个模型。先 model.list 枚举租户全部模型(默认只扫当前应用,跨应用 owner 会漏),再对候选逐个 `data.list {schemaCode:\"<候选>\",all:true}` 后本地按 `items[].id` 匹配(all:true 上限 1000 行,超出会回 resultTruncated:true,需收窄范围或改到门户核对),或到门户/向用户确认。命中哪个模型就用那个 schemaCode 重发;只有确认是并发已删且需要旧幂等语义时才带 allowAlreadyAbsent:true。已 deleted 的条目不要重发;不要用当前 schemaCode 的 data.list 未命中来推断已删。",
4468
- message: `批量删除里有 ${notInSchema.length} 个 id 当前不属于 ${args.schemaCode}:${notInSchema.join("、")}。本工具**没有对它们发删除**,也不把它们算作 deleted。` +
4469
- `其余 ${deletedCount} 条已真删并回读缺席。「读不到」只证明这些 id 不属于此模型——本工具无法判定其真实归属,也无法判定是并发删除还是 schemaCode 写错;` +
4470
- "先 model.list 取候选模型,再逐个 data.list(或 all:true 本地匹配 id)核对,或到门户/向用户确认。命中另一个模型就用该 schemaCode 重发;确认是并发已删且需要旧幂等语义时重发带 allowAlreadyAbsent:true。",
4537
+ nextCommand: deleteTargetAbsentIds.length > 0 && notInSchema.length === 0 ? idempotentCommand : `omc call model.list --args '{"allApplications":true}'`,
4538
+ nextAction: deleteTargetAbsentIds.length > 0 && notInSchema.length === 0
4539
+ ? `平台对 ${deleteTargetAbsentIds.join("、")} 回 50000 且删后读不到行:它们多半已不存在。确认幂等重发带 allowAlreadyAbsent:true(命令见 nextCommand)。不要把这些 id 当「回读仍在」重试。`
4540
+ : "本工具无法判定这些 id 属于哪个模型。先 model.list 枚举租户全部模型(默认只扫当前应用,跨应用 owner 会漏),再对候选逐个 `data.list {schemaCode:\"<候选>\",all:true}` 后本地按 `items[].id` 匹配(all:true 上限 1000 行,超出会回 resultTruncated:true,需收窄范围或改到门户核对),或到门户/向用户确认。命中哪个模型就用那个 schemaCode 重发;只有确认是并发已删且需要旧幂等语义时才带 allowAlreadyAbsent:true。已 deleted 的条目不要重发;不要用当前 schemaCode 的 data.list 未命中来推断已删。",
4541
+ message: deleteTargetAbsentIds.length > 0 && notInSchema.length === 0
4542
+ ? `批量删除里有 ${deleteTargetAbsentIds.length} 个 id 平台回 50000,但删后读回已不存在(可能已删):${deleteTargetAbsentIds.join("、")}。默认不把「读不到」当成功;确认幂等重发带 allowAlreadyAbsent:true。`
4543
+ : `批量删除里有 ${notInSchema.length} 个 id 当前不属于 ${args.schemaCode}:${notInSchema.join("、")}。本工具**没有对它们发删除**,也不把它们算作 deleted。` +
4544
+ `其余 ${deletedCount} 条已真删并回读缺席。「读不到」只证明这些 id 不属于此模型——本工具无法判定其真实归属,也无法判定是并发删除还是 schemaCode 写错;` +
4545
+ "先 model.list 取候选模型,再逐个 data.list(或 all:true 本地匹配 id)核对,或到门户/向用户确认。命中另一个模型就用该 schemaCode 重发;确认是并发已删且需要旧幂等语义时重发带 allowAlreadyAbsent:true。",
4471
4546
  }
4472
4547
  : {}),
4473
4548
  performed: { sheetCode, resolvedFrom },
4474
4549
  readback: {
4475
4550
  // absent 是「整批目标都属于该 schema 且都不在了」的结论;notInSchema
4476
4551
  // 让这个结论无法建立,所以不能再只凭读不到就 true。
4477
- absent: batchDeleteIneffective === undefined && notInSchema.length === 0 && deleted.every((entry) => entry.absent === true),
4552
+ absent: batchDeleteIneffective === undefined && notInSchema.length === 0 && deleteTargetAbsentIds.length === 0 && deleted.every((entry) => entry.absent === true),
4478
4553
  count: deleted.length,
4479
4554
  deletedCount,
4480
4555
  alreadyAbsentCount,
4556
+ ...(deleteTargetAbsentIds.length > 0 ? { deleteTargetAbsentCount: deleteTargetAbsentIds.length, deleteTargetAbsentIds } : {}),
4481
4557
  ...(allowAlreadyAbsent
4482
4558
  ? {
4483
4559
  allowAlreadyAbsent: true,
@@ -4492,9 +4568,9 @@ export function registerRuntimeDataLane(tools) {
4492
4568
  // remainingRows/clean 是整表状态(为「清空模型」场景保留),删一部分时
4493
4569
  // clean:false 很常见,不能读成删除失败。新键 modelRowsRemaining/modelClean
4494
4570
  // 同值,旧键标 deprecated。
4495
- deletionVerified: batchDeleteIneffective === undefined && notInSchema.length === 0,
4496
- ...(uncertain ? { status: "uncertain", blocker: "delete-target-not-in-schema" } : {}),
4497
- successCriterion: "undeletedIds 与 notInSchema 均为空且 deletionVerified:true(逐条 form/load 回读);remainingRows/clean 只表示整表是否已空,不用于判批量删除成败",
4571
+ deletionVerified: batchDeleteIneffective === undefined && notInSchema.length === 0 && deleteTargetAbsentIds.length === 0,
4572
+ ...(uncertain ? { status: "uncertain", blocker: uncertainBlocker } : {}),
4573
+ successCriterion: "undeletedIds、notInSchema 与 deleteTargetAbsentIds 均为空且 deletionVerified:true(逐条 form/load 回读);remainingRows/clean 只表示整表是否已空,不用于判批量删除成败",
4498
4574
  ...residue,
4499
4575
  ...(typeof residue.remainingRows === "number" ? { modelRowsRemaining: residue.remainingRows } : {}),
4500
4576
  ...(typeof residue.clean === "boolean" ? { modelClean: residue.clean } : {}),
package/dist/read.js CHANGED
@@ -263,7 +263,7 @@ function externalizedShapePlaceholders(result, dropped) {
263
263
  function droppedShapeKeys(result, payload) {
264
264
  return Object.keys(result).filter((key) => BULKY_READ_KEYS.has(key) && !(key in payload));
265
265
  }
266
- function compactReadback(result) {
266
+ export function compactReadback(result) {
267
267
  const compact = {};
268
268
  for (const [key, value] of Object.entries(result)) {
269
269
  // r26b 读回体积审计(2026-11-05):分支顺序曾让 CODE_NAME_LIST_KEYS 对 `models`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.8.29",
3
+ "version": "0.8.30",
4
4
  "description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "commander": "14.0.3",
61
- "omc-core": "0.8.29",
61
+ "omc-core": "0.8.30",
62
62
  "proper-lockfile": "4.1.2",
63
63
  "write-file-atomic": "6.0.0",
64
64
  "zod": "^3.23.8",
@@ -76,6 +76,6 @@
76
76
  "directory": "packages/omc-cli"
77
77
  },
78
78
  "optionalDependencies": {
79
- "@stalfh233/omc-fake-platform": "0.8.29"
79
+ "@stalfh233/omc-fake-platform": "0.8.30"
80
80
  }
81
81
  }
@@ -12,7 +12,7 @@ be treated as a second source. Read this, then follow the topics it names.
12
12
 
13
13
  ## 最小路径(先读这段就能开始)
14
14
 
15
- 0. **调用与检索(跨平台)**:`omc call ... --args '<json>'` 的内联 JSON 在 Windows PowerShell 下因引号转义不可靠——**PS 环境优先 `--args-file <path>`**(把 JSON 写临时文件再引用;解析失败的报错里也有此提示)。长 JSON、含引号或中文换行的负载统一可走 stdin:`echo '<json>' | omc call <tool> --args -`;`--args-file <path>` 则必须位于项目配置根内(worktree 下回退主检出);`model-scaffold`/`field-add` 的 `--fields-file` 必须位于 `$OMC_CONFIG_HOME` 或当前工作目录(根外一律拒绝),这两条命令免落盘用 `--fields -` 从 stdin 读。读命令输出默认把中文转义为 `\uXXXX`(防乱码)——**这是有意为之**:stdout 恒为「恰好一个合法 JSON envelope」,在任何代码页下都能被 `JSON.parse`/`ConvertFrom-Json` 还原(GitLab #17 T2 实证:曾让 `--utf8` 关掉转义,GBK 管道把信封结构解码坏、`ConvertFrom-Json` 中途失败)。`--utf8` 只让**人类诊断文本**(stderr/散文)按 UTF-8 原文输出;要连 stdout 也是中文明文,必须先让管道按 UTF-8 解码(`chcp 65001`)——只设 `OMC_ASCII_STDOUT=0` 是关写出端转义、不改管道解码,在 cp936 管道下会把信封解码坏。对输出做内容检索时**先解 JSON 再检索**(或 `--jq` 取值),"grep 搜不到中文"≠"没有配置"(静默假阴性坑)。stdout 恒为纯 JSON、人读进度在 stderr——脚本解析勿 `2>&1` 合流。
15
+ 0. **调用与检索(跨平台)**:`omc call ... --args '<json>'` 的内联 JSON 在 Windows PowerShell 下因引号转义不可靠——**PS 环境优先 `--args-file <path>`**(把 JSON 写临时文件再引用;解析失败的报错里也有此提示)。长 JSON、含引号或中文换行的负载统一可走 stdin:`echo '<json>' | omc call <tool> --args -`;`--args-file <path>` 则必须位于项目配置根内(worktree 下回退主检出);`model-scaffold`/`field-add` 的 `--fields-file` 必须位于 `$OMC_CONFIG_HOME` 或当前工作目录(根外一律拒绝),这两条命令免落盘用 `--fields -` 从 stdin 读。读命令输出默认把中文转义为 `\uXXXX`(防乱码)——**这是有意为之**:stdout 恒为「恰好一个合法 JSON envelope」,在任何代码页下都能被 `JSON.parse`/`ConvertFrom-Json` 还原(GitLab #17 T2 实证:曾让 `--utf8` 关掉转义,GBK 管道把信封结构解码坏、`ConvertFrom-Json` 中途失败)。`--utf8` 只让**人类诊断文本**(stderr/散文)按 UTF-8 原文输出;要连 stdout 也是中文明文,必须先让管道按 UTF-8 解码(`chcp 65001`)——只设 `OMC_ASCII_STDOUT=0` 是关写出端转义、不改管道解码,在 cp936 管道下会把信封解码坏。对输出做内容检索时**先解 JSON 再检索**(或 `--jq` 取值),"grep 搜不到中文"≠"没有配置"(静默假阴性坑)。stdout 恒为纯 JSON、人读进度在 stderr——脚本解析勿 `2>&1` 合流(确需合流/想少噪声时加 `--quiet`:抑制 stderr 人类诊断行,stdout 信封与退出码不变)。
16
16
 
17
17
  0. **拼装器优先(高频写面一条命令)**:整模型建模(模型+N 字段+子表+发布+表单)`omc model-scaffold`;**存量模型加字段(建→发布→重建表单→列表加列)`omc field-add`**;字段计算 `omc compute`;条件→动作 `omc rule-when`;线性审批流 `omc approval-flow`;表单默认值 `omc form-default`;存量盘点 `data.list all:true`;收尾清理 `omc model-purge --code <schema>`(依赖倒序,默认 dry-run)+ `omc residue <prefix>` 证删净——命中这些形态先看 `--help`,比 recipe 手拼省 10+ 轮。
18
18