@stalfh233/omc-cli 0.6.87 → 0.6.89

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.
@@ -239,16 +239,16 @@ export function projectJsonPathFanout(value, path) {
239
239
  if (marker < 0) {
240
240
  const projected = projectJsonPath(value, path);
241
241
  return projected.missed
242
- ? { values: [], missed: true, ...(projected.at !== undefined ? { at: projected.at } : {}), ...(projected.available !== undefined ? { available: projected.available } : {}), ...(projected.availableAll !== undefined ? { availableAll: projected.availableAll } : {}), ...(projected.availableTruncated !== undefined ? { availableTruncated: projected.availableTruncated } : {}), missedEntries: 0, nullEntries: 0 }
243
- : { values: [projected.value], missed: false, missedEntries: 0, nullEntries: projected.value === null ? 1 : 0 };
242
+ ? { values: [], missed: true, ...(projected.at !== undefined ? { at: projected.at } : {}), ...(projected.available !== undefined ? { available: projected.available } : {}), ...(projected.availableAll !== undefined ? { availableAll: projected.availableAll } : {}), ...(projected.availableTruncated !== undefined ? { availableTruncated: projected.availableTruncated } : {}), missedEntries: 0, nullEntries: 0, nonNullEntries: 0 }
243
+ : { values: [projected.value], missed: false, missedEntries: 0, nullEntries: projected.value === null ? 1 : 0, nonNullEntries: projected.value === null ? 0 : 1 };
244
244
  }
245
245
  const before = path.slice(0, marker);
246
246
  const after = path.slice(marker + 2).replace(/^[./]+/, "");
247
247
  const base = projectJsonPath(value, before);
248
248
  if (base.missed)
249
- return { values: [], missed: true, ...(base.at !== undefined ? { at: base.at } : {}), ...(base.available !== undefined ? { available: base.available } : {}), ...(base.availableAll !== undefined ? { availableAll: base.availableAll } : {}), ...(base.availableTruncated !== undefined ? { availableTruncated: base.availableTruncated } : {}), missedEntries: 0, nullEntries: 0 };
249
+ return { values: [], missed: true, ...(base.at !== undefined ? { at: base.at } : {}), ...(base.available !== undefined ? { available: base.available } : {}), ...(base.availableAll !== undefined ? { availableAll: base.availableAll } : {}), ...(base.availableTruncated !== undefined ? { availableTruncated: base.availableTruncated } : {}), missedEntries: 0, nullEntries: 0, nonNullEntries: 0 };
250
250
  if (!Array.isArray(base.value))
251
- return { values: [], missed: true, at: before || "$", available: `该层不是数组(是 ${base.value === null ? "null" : typeof base.value});[] 只能映射数组,如 items[].fields.planNo`, missedEntries: 0, nullEntries: 0 };
251
+ return { values: [], missed: true, at: before || "$", available: `该层不是数组(是 ${base.value === null ? "null" : typeof base.value});[] 只能映射数组,如 items[].fields.planNo`, missedEntries: 0, nullEntries: 0, nonNullEntries: 0 };
252
252
  const values = [];
253
253
  let missedEntries = 0;
254
254
  let nullEntries = 0;
@@ -263,9 +263,9 @@ export function projectJsonPathFanout(value, path) {
263
263
  // array) — report the miss so the caller does not read an empty list as data.
264
264
  if (values.length === 0 && missedEntries > 0) {
265
265
  const first = projectJsonPathFanout(base.value[0], after);
266
- return { values: [], missed: true, ...(first.at !== undefined ? { at: `${before}[].${first.at}` } : {}), ...(first.available !== undefined ? { available: first.available } : {}), ...(first.availableAll !== undefined ? { availableAll: first.availableAll } : {}), ...(first.availableTruncated !== undefined ? { availableTruncated: first.availableTruncated } : {}), missedEntries, nullEntries: 0 };
266
+ return { values: [], missed: true, ...(first.at !== undefined ? { at: `${before}[].${first.at}` } : {}), ...(first.available !== undefined ? { available: first.available } : {}), ...(first.availableAll !== undefined ? { availableAll: first.availableAll } : {}), ...(first.availableTruncated !== undefined ? { availableTruncated: first.availableTruncated } : {}), missedEntries, nullEntries: 0, nonNullEntries: 0 };
267
267
  }
268
- return { values, missed: false, ...(missedEntries > 0 ? { missedEntries } : { missedEntries: 0 }), nullEntries };
268
+ return { values, missed: false, ...(missedEntries > 0 ? { missedEntries } : { missedEntries: 0 }), nullEntries, nonNullEntries: values.length - nullEntries };
269
269
  }
270
270
  /** Collect every value of a repeatable flag (`--extract a --extract b`). */
271
271
  function argvValues(args, name) {
@@ -284,9 +284,13 @@ function argvValues(args, name) {
284
284
  * (`projectResultExtract` 的 miss、`artifact get --summary --jq`、artifact 裸
285
285
  * `--jq`、逗号多路径部分 miss、以及 `artifact get` 的 fetch 提示),改一处忘一处
286
286
  * 就会出现"同一个错误两种说法"。现在语法句子只在这里定义,其余地方拼装。
287
+ *
288
+ * F1(retro 22,ticket 138):语法长句**不再内联**进任何 miss 回执——一次
289
+ * pathMiss 曾带 766–870B 教程、一个会话 6+ 次吃掉几 KB 上下文。回执只给
290
+ * `helpRef`(机器可读指针)+ ≤200B 的行动句;完整教程读 help 的权威一节。
287
291
  */
288
292
  export const JQ_PATH_SYNTAX = "可用写法:点式 a.b、下标 a[0]、切片 a[0:6]、数组映射 items[].fields.x、按键选择 rules[code=Create] 或 data.activities[code=A1](数组与 index→条目对象都支持;键名可省 activityCode/nodeCode 等别名;返回第一个匹配项)。";
289
- /** 非 jq 语言 + 一次取多列的写法。每一处 miss 提示都以它收尾。 */
293
+ /** 非 jq 语言 + 一次取多列的写法。只在 help 教程里出现,不进回执。 */
290
294
  export const JQ_PATH_RULES = "注意:本参数是路径选择器、不是 jq 语言(不支持 | 管道与对象构造);一次取多列用逗号分隔(--jq \"a.b,c.d\")或重复传 --jq。";
291
295
  /**
292
296
  * `call --extract/--jq` 专有的位置语义:路径相对 **result**,不是整个信封。
@@ -299,30 +303,37 @@ export const RESULT_RELATIVE_PATH_NOTE = "路径相对 **result**(不要写 re
299
303
  export const JQ_PATH_TOPIC = "omc-refusals";
300
304
  export const JQ_PATH_SECTION = "10. 投影路径(--jq / --extract)";
301
305
  export const JQ_PATH_HELP_POINTER = `语法详解:omc help ${JQ_PATH_TOPIC} --section 10(投影路径)。`;
306
+ /**
307
+ * F1(retro 22,ticket 138):miss 回执的**机器可读**教程指针。回执不再内联
308
+ * 766B+ 的语法长句(一次会话 6+ 次 miss 就是几 KB 噪声);要看教程的人/agent
309
+ * 按这个字段取 help 的权威一节。值为可直接执行的命令字符串。
310
+ */
311
+ export const PATH_MISS_HELP_REF = `omc help ${JQ_PATH_TOPIC} --section 10`;
302
312
  /** Shared wording for every projection miss, so every face teaches the same syntax. */
303
313
  // r66 ① readbackKeys(c-F2):R65 探针 3 次投影 miss 全靠 available 救回——键名
304
314
  // 无处可查。裸 --jq(不带路径)= 键清单这个姿势一直在(cli.ts extractKeys 分支),
305
315
  // 但没有任何一面教过它。miss 正是教学时机:撞过一次的人最听得进「先看全键再投影」。
306
316
  // r67-03(触达失败复检):R67 探针 4 次 pathMiss 无一注意这句教学——它此前被夹在
307
- // 语法长句(JQ_PATH_SYNTAX)之后的中段,读 hint 的人早被 available/语法淹没。
308
- // 行动句提前到 available 说明之后、JQ_PATH_SYNTAX 之前,并改成「下一步先列键」
309
- // 的动作式措辞:下一跳排在语法课前面,才会在注意力耗尽前被读到。
310
- export const PATH_MISS_HINT = `路径未命中(这一层没有该段)。${RESULT_RELATIVE_PATH_NOTE}available 是该层真实存在的键。下一步先列键:--jq 不带路径重跑 = 全部顶层键一览。${JQ_PATH_SYNTAX}${JQ_PATH_RULES}${JQ_PATH_HELP_POINTER}`;
317
+ // 语法长句(JQ_PATH_SYNTAX)之后的中段。行动句排在最前。
318
+ // F1(retro 22,ticket 138):压到 ≤200B——结论 + available 判读 + 一条下一步 +
319
+ // helpRef 指针,语法全集只在 help(旧版 766B → 新版 ≤200B,测试钉死上限)。
320
+ export const PATH_MISS_HINT = `路径未命中。available 是该层真实存在的键;下一步先列键:--jq 不带路径重跑 = 全部顶层键一览。语法教程:${PATH_MISS_HELP_REF}。`;
311
321
  /**
312
322
  * `artifact get` 面:产物内容的投影。区别只在开头——它已经把 miss 落在哪一段
313
323
  * (`missedAt`)和可用的键/范围一并返回,所以不必重复「这一层没有该段」。
324
+ * F1(retro 22):语法长句不内联,压成 定位 + 可复制路径 + --keys 教学 + helpRef。
314
325
  */
315
326
  export function artifactPathMissHint(at, copyable) {
316
327
  const lead = `路径未命中${at !== undefined ? `段 "${at}"` : "(这一层没有该段)"}`;
317
328
  // issue 19:命中同名键时先给可整段复制的完整路径(相对产物正文)。
318
329
  if (copyable !== undefined) {
319
- return `${lead}。${copyable}。想一次拿全部顶层键:--keys(或裸 --jq)。${JQ_PATH_SYNTAX}${JQ_PATH_RULES}${JQ_PATH_HELP_POINTER}`;
330
+ return `${lead}。${copyable}。想一次拿全部顶层键:--keys(或裸 --jq)。语法教程:${PATH_MISS_HELP_REF}。`;
320
331
  }
321
- return `${lead}——available 是该层真实存在的键/范围;方括号下标(a[0])与点式(a.0)等价;想一次拿全部顶层键:--keys(或裸 --jq)。${JQ_PATH_SYNTAX}${JQ_PATH_RULES}${JQ_PATH_HELP_POINTER}`;
332
+ return `${lead}——available 是该层真实存在的键/范围;想一次拿全部顶层键:--keys(或裸 --jq)。语法教程:${PATH_MISS_HELP_REF}。`;
322
333
  }
323
- /** 逗号多路径里只有部分 miss:给出定位方式 + 同一套语法。 */
334
+ /** 逗号多路径里只有部分 miss:给出定位方式 + helpRef(语法长句不内联)。 */
324
335
  export function partialPathMissHint() {
325
- return `逗号多路径中部分路径未命中(见各 projection.pathMiss/missedAt/available)。${JQ_PATH_SYNTAX}${JQ_PATH_HELP_POINTER}`;
336
+ return `逗号多路径中部分路径未命中(见各 projection.pathMiss/missedAt/available)。语法教程:${PATH_MISS_HELP_REF}。`;
326
337
  }
327
338
  /**
328
339
  * 逐条 miss 的**短**提示。r27 真机(2026-11-05)实证:一段 695 B 的完整语法在
@@ -481,12 +492,53 @@ export function pathMissCopyableHint(source, path, at, limit = 3) {
481
492
  return `这段的完整路径是 ${shown[0]}——可直接复制:${quoted}`;
482
493
  return `这段有多个位置——可直接复制其一:${quoted}`;
483
494
  }
495
+ const CROSS_FACE_LOAD_REASON = "data.load 平铺在 data.<code>,不套 fields";
496
+ const CROSS_FACE_LIST_REASON = "data.list 列在 items[].fields.<code>";
497
+ export function pathMissCrossFaceCorrection(source, path, at) {
498
+ if (at === undefined || at.length === 0)
499
+ return undefined;
500
+ const clean = path.replace(/^\$\.?/, "").replace(/^[.\/]+/, "");
501
+ // 只处理「首段就 miss」的 retro 21 形态(fields.x / data.x 写到对面根上);
502
+ // 更深层的 miss 由 didYouMean/同名键扫描接手。
503
+ const headMatch = /^([A-Za-z_][\w]*)((?:[.\[\/]).*)?$/.exec(clean);
504
+ if (headMatch === null)
505
+ return undefined;
506
+ const head = headMatch[1];
507
+ if (head !== at)
508
+ return undefined;
509
+ const rest = headMatch[2] ?? "";
510
+ if (head === "fields") {
511
+ const candidate = `data${rest}`;
512
+ if (copyableCandidateResolves(source, candidate))
513
+ return { correctPath: candidate, reason: CROSS_FACE_LOAD_REASON };
514
+ }
515
+ if (head === "data") {
516
+ const candidate = `items[].fields${rest}`;
517
+ if (copyableCandidateResolves(source, candidate))
518
+ return { correctPath: candidate, reason: CROSS_FACE_LIST_REASON };
519
+ }
520
+ return undefined;
521
+ }
522
+ const RETRY_ARGS_MAX_BYTES = 500;
523
+ const shellQuote = (value) => `'${value.replace(/'/g, "'\\''")}'`;
524
+ export function projectionRetryCommand(context, path) {
525
+ if (context === undefined || context.tool === undefined || context.tool.length === 0)
526
+ return undefined;
527
+ if (context.argsJson !== undefined && Buffer.byteLength(context.argsJson, "utf8") > RETRY_ARGS_MAX_BYTES)
528
+ return undefined;
529
+ return [
530
+ `omc call ${context.tool}`,
531
+ ...(context.environment !== undefined && context.environment.length > 0 ? [`--env ${context.environment}`] : []),
532
+ ...(context.argsJson !== undefined ? [`--args ${shellQuote(context.argsJson)}`] : []),
533
+ `--jq ${shellQuote(path)}`,
534
+ ].join(" ");
535
+ }
484
536
  /**
485
- * 多路径一次投影时的**唯一一份**语法说明(放结果顶层,不再逐条复制)。
486
- * 只给最要紧的三条:位置语义、映射写法、help 指针。
537
+ * 多路径一次投影时的**唯一一份**顶层说明。只给位置语义 + helpRef——
538
+ * F1(retro 22):语法长句不内联(教程只在 help)。
487
539
  */
488
540
  export function multiPathMissHint() {
489
- return `${RESULT_RELATIVE_PATH_NOTE}${JQ_PATH_SYNTAX}${JQ_PATH_HELP_POINTER}`;
541
+ return `${RESULT_RELATIVE_PATH_NOTE}语法教程:${PATH_MISS_HELP_REF}。`;
490
542
  }
491
543
  /**
492
544
  * T6(GitLab #17):`mapped` 只是"路径命中的条目数",值为 null 也算命中。
@@ -651,7 +703,7 @@ function projectPathOnSource(source, path) {
651
703
  }
652
704
  return { ...first };
653
705
  }
654
- export function projectResultExtract(result, paths, keysOnly) {
706
+ export function projectResultExtract(result, paths, keysOnly, retry) {
655
707
  const artifactId = typeof result.detailArtifactId === "string" ? result.detailArtifactId : typeof result.artifactId === "string" ? result.artifactId : undefined;
656
708
  // Tools hand an in-process artifact as `detailFile` (a local path);
657
709
  // command-transport later swaps it for detailArtifactId. Extraction runs
@@ -723,10 +775,18 @@ export function projectResultExtract(result, paths, keysOnly) {
723
775
  // r27 真机:多路径时每条 miss 都带 695 B 完整语法 → 3 条 2 KB 说同一件事。
724
776
  // 单路径照旧带完整提示(只出现一次,最有用);多路径逐条只给定位,语法放顶层一次。
725
777
  const multiPath = paths.length > 1;
726
- const missHintFor = (path, at, available, availableAll) => {
727
- const fallback = multiPath ? pathMissEntryHint(at, available) : PATH_MISS_HINT;
728
- const candidate = pathMissDidYouMean(at, available, availableAll);
729
- if (candidate !== undefined && at !== undefined) {
778
+ /**
779
+ * F1(retro 22,ticket 138):miss 的**结论优先**。能推导出已验证的正确路径就
780
+ * 给 `correctPath`(机器字段)+ 首行人话;推导不出才落回 PATH_MISS_HINT。
781
+ * 候选按优先级:①拼写近似(didYouMean,改写后必须真的可解析)②跨面形状
782
+ * 改写(fields↔data,retro 21)③真实结果树里的同名键(issue 19)。
783
+ * 三者都在**真实结果树**上验证过才返回——绝不编造可达路径。
784
+ */
785
+ const missCorrectionFor = (path, at, available, availableAll) => {
786
+ if (at === undefined)
787
+ return undefined;
788
+ const didYouMean = pathMissDidYouMean(at, available, availableAll);
789
+ if (didYouMean !== undefined) {
730
790
  // Replace only the missed segment, retaining array mapping and suffixes.
731
791
  const leaf = at.split(/[./\[]/).filter(Boolean).pop();
732
792
  if (leaf !== undefined) {
@@ -736,22 +796,32 @@ export function projectResultExtract(result, paths, keysOnly) {
736
796
  if (replaced || segment !== leaf || (at !== leaf && prefix !== at))
737
797
  return segment;
738
798
  replaced = true;
739
- return candidate;
799
+ return didYouMean;
740
800
  });
741
801
  // A similar key is useful only if the complete proposed path resolves.
742
802
  if (corrected !== path && !projectPathOnSource(projectionSource, corrected).projected.missed) {
743
- const quoted = corrected.replace(/'/g, "'\\''");
744
- return `路径未命中:在 "${at}" 断开;最接近的是 ${candidate}。可试:--jq '${quoted}'`;
803
+ return { correctPath: corrected };
745
804
  }
746
805
  }
747
806
  }
748
- // issue 19:没有拼写近似时,在真实结果树里找同名键,直接给可复制的完整
749
- // 路径(如 data.activities[].bizActions)——不再只描述「它在哪一层」。
750
- const copyable = pathMissCopyableHint(projectionSource, path, at);
751
- if (copyable !== undefined) {
752
- return multiPath ? `${copyable}。${pathMissEntryHint(at, available)}` : `${copyable}。${RESULT_RELATIVE_PATH_NOTE}`;
807
+ const crossFace = pathMissCrossFaceCorrection(projectionSource, path, at);
808
+ if (crossFace !== undefined)
809
+ return crossFace;
810
+ const copyable = pathMissCopyablePaths(projectionSource, path, at, 3);
811
+ if (copyable.length === 1)
812
+ return { correctPath: copyable[0] };
813
+ if (copyable.length > 1) {
814
+ return { correctPath: copyable[0], reason: `同名键另有 ${copyable.length - 1} 处:${copyable.slice(1).join("、")}` };
815
+ }
816
+ return undefined;
817
+ };
818
+ const missHintFor = (at, available, correction) => {
819
+ if (correction !== undefined) {
820
+ const quoted = correction.correctPath.replace(/'/g, "'\\''");
821
+ const lead = `正确路径:${correction.correctPath}${correction.reason !== undefined ? `(${correction.reason})` : ""}——可直接复制:--jq '${quoted}'。语法教程:${PATH_MISS_HELP_REF}。`;
822
+ return multiPath ? `${lead}${pathMissEntryHint(at, available)}` : lead;
753
823
  }
754
- return fallback;
824
+ return multiPath ? pathMissEntryHint(at, available) : PATH_MISS_HINT;
755
825
  };
756
826
  out.extract = paths.map((path) => {
757
827
  // r28f F2:对象构造 / 函数调用不是 pathMiss——先识别,别伪装成键缺失。
@@ -777,6 +847,8 @@ export function projectResultExtract(result, paths, keysOnly) {
777
847
  const fan = projected;
778
848
  if (fan.missed) {
779
849
  const didYouMean = pathMissDidYouMean(fan.at, fan.available, fan.availableAll);
850
+ const correction = missCorrectionFor(path, fan.at, fan.available, fan.availableAll);
851
+ const nextCommand = correction !== undefined ? projectionRetryCommand(retry, correction.correctPath) : undefined;
780
852
  return {
781
853
  path,
782
854
  content: null,
@@ -786,14 +858,18 @@ export function projectResultExtract(result, paths, keysOnly) {
786
858
  ...(fan.availableTruncated !== undefined ? { availableTruncated: fan.availableTruncated } : {}),
787
859
  missedEntries: fan.missedEntries,
788
860
  ...(didYouMean !== undefined ? { didYouMean } : {}),
861
+ ...(correction !== undefined ? { correctPath: correction.correctPath } : {}),
862
+ helpRef: PATH_MISS_HELP_REF,
863
+ ...(nextCommand !== undefined ? { nextCommand } : {}),
789
864
  ...(readFromArtifact ? resultLayerNote(result, path, projectionSource, fan.at) ?? {} : {}),
790
- hint: missHintFor(path, fan.at, fan.available, fan.availableAll),
865
+ hint: missHintFor(fan.at, fan.available, correction),
791
866
  };
792
867
  }
793
868
  return {
794
869
  path,
795
870
  content: fan.values,
796
871
  mapped: fan.values.length,
872
+ nonNullEntries: fan.nonNullEntries,
797
873
  ...(autoStripped !== undefined ? { autoStripped } : {}),
798
874
  ...(preferResult ? { from: "result" } : {}),
799
875
  ...(fan.nullEntries > 0 ? { nullEntries: fan.nullEntries } : {}),
@@ -815,6 +891,8 @@ export function projectResultExtract(result, paths, keysOnly) {
815
891
  };
816
892
  }
817
893
  const didYouMean = pathMissDidYouMean(single.at, single.available, single.availableAll);
894
+ const correction = missCorrectionFor(path, single.at, single.available, single.availableAll);
895
+ const nextCommand = correction !== undefined ? projectionRetryCommand(retry, correction.correctPath) : undefined;
818
896
  return {
819
897
  path,
820
898
  content: null,
@@ -823,8 +901,11 @@ export function projectResultExtract(result, paths, keysOnly) {
823
901
  available: single.available,
824
902
  ...(single.availableTruncated !== undefined ? { availableTruncated: single.availableTruncated } : {}),
825
903
  ...(didYouMean !== undefined ? { didYouMean } : {}),
904
+ ...(correction !== undefined ? { correctPath: correction.correctPath } : {}),
905
+ helpRef: PATH_MISS_HELP_REF,
906
+ ...(nextCommand !== undefined ? { nextCommand } : {}),
826
907
  ...(readFromArtifact ? resultLayerNote(result, path, projectionSource, single.at) ?? {} : {}),
827
- hint: missHintFor(path, single.at, single.available, single.availableAll),
908
+ hint: missHintFor(single.at, single.available, correction),
828
909
  };
829
910
  }
830
911
  return {
@@ -873,19 +954,21 @@ export function projectResultExtract(result, paths, keysOnly) {
873
954
  // change the exit contract), but the envelope now says so out loud.
874
955
  if (extracts.some((entry) => entry.pathMiss === true || entry.unsupportedSyntax === true)) {
875
956
  out.unanswered = true;
876
- // 多路径:语法说明给一次,不再逐条复制。不支持语法优先于 pathMiss 语法课。
957
+ // 多路径:说明给一次,不再逐条复制。不支持语法优先于 pathMiss 说明。
958
+ // F1(retro 22):语法长句不内联——顶层只留位置语义 + helpRef。
877
959
  if (extracts.some((entry) => entry.unsupportedSyntax === true)) {
878
960
  out.hint = UNSUPPORTED_JQ_OBJECT_HINT;
879
961
  }
880
962
  else if (multiPath) {
881
- out.hint = `${RESULT_RELATIVE_PATH_NOTE}${JQ_PATH_SYNTAX}多路径时用 extract[](逐条)或 rows[](列对齐);不再重复 content 映射。${JQ_PATH_HELP_POINTER}`;
963
+ out.helpRef = PATH_MISS_HELP_REF;
964
+ out.hint = `${RESULT_RELATIVE_PATH_NOTE}逐条定位见 extract[](或 rows[] 列对齐);语法教程:${PATH_MISS_HELP_REF}。`;
882
965
  }
883
966
  }
884
967
  }
885
968
  return out;
886
969
  }
887
970
  const SINGLE_PATH_META_KEYS = ["from", "artifactId", "sha256", "truncated", "truncatedKeys", "itemsCount", "total", "projectionHint"];
888
- const SINGLE_PATH_ENTRY_META_KEYS = ["mapped", "nullEntries", "missedEntries", "from", "autoStripped", "hint"];
971
+ const SINGLE_PATH_ENTRY_META_KEYS = ["mapped", "nullEntries", "nonNullEntries", "missedEntries", "from", "autoStripped", "hint"];
889
972
  export function unwrapSinglePathProjection(projected) {
890
973
  const extracts = projected.extract;
891
974
  if (!Array.isArray(extracts) || extracts.length !== 1)
@@ -42,6 +42,19 @@ const READ_SHAPES = {
42
42
  },
43
43
  "data.list": {
44
44
  // items are {id, fields:{<code>: value}} — business columns live under fields.
45
+ // F2(retro 21,ticket 138)locator:同一行业务列在 data.list 是 items[].fields.<code>,
46
+ // 在 data.load 是平铺 data.<code>;行标识在 data.load 的入参叫 bizObjectId。
47
+ // rides resultMeta.locator(信封侧),result 本体与 --jq 路径零改动。
48
+ // 平台证据:列 code 两面同名(list 行本体 BizObjectModel.data.<code>,CLI 包装成
49
+ // fields;load 面 FormDataVO.bizObject.data.<code> 平铺,见 path-projection.ts
50
+ // pathMissCrossFaceCorrection 注释的 file:line)。
51
+ locator: {
52
+ rowIdKey: "items[].id",
53
+ rowIdArg: "bizObjectId",
54
+ columnKey: "items[].fields.<code>",
55
+ peerTool: "data.load",
56
+ peerColumnKey: "data.<code>",
57
+ },
45
58
  keys: ["items:array<{id,fields:{<code>:value}}>", "total", "totalPages", "page", "size"],
46
59
  // r28i F4: agents try rows[] / items[].sku first; pin the real shape here too.
47
60
  notes: [
@@ -69,6 +82,19 @@ const READ_SHAPES = {
69
82
  notes: ["page.parentId 常为 null(/custom/get 不回 AppFunction 父节点);看 parentIdNote,落点用 folder.tree 按 code 核对"],
70
83
  },
71
84
  "data.load": {
85
+ // F2(retro 21,ticket 138)locator:本面业务列平铺在 data.<code>(不套 fields),
86
+ // 与 data.list 的 items[].fields.<code> 是同一事实两种包装;行定位入参 bizObjectId
87
+ // = data.list 的 items[].id。rides resultMeta.locator,result 本体零改动。
88
+ // 平台证据:FormRuntimeController.java:364-365(GET /api/runtime/form/load →
89
+ // FormDataVO)+ FormDataVO.java:27,62(bizObject.data 平铺业务列;CLI
90
+ // normalizeLoadedRecord 只解开 bizObject 包装,键名原样)。
91
+ locator: {
92
+ rowIdArg: "bizObjectId",
93
+ columnKey: "data.<code>",
94
+ peerTool: "data.list",
95
+ peerColumnKey: "items[].fields.<code>",
96
+ peerRowIdKey: "items[].id",
97
+ },
72
98
  keys: ["bizObjectId", "exists", "data:{...}"],
73
99
  // A1(同义事实对照):同一行业务列在两面包装不同——列表面套 fields,本面平铺。
74
100
  // 平台证据:行本体是 FormDataVO.data(GET /runtime/form_data/get_by_id 平铺业务列)。
@@ -76,8 +102,8 @@ const READ_SHAPES = {
76
102
  },
77
103
  // r80:计数/分组统计的读回面。notes 只显首条——把陷阱并进第一句。
78
104
  "data.aggregate": {
79
- keys: ["schemaCode", "metric", "field?", "value?", "count", "nonNullCount?", "nullCount?", "groupBy?", "total", "buckets:array<{key,count,nonNullCount?,value?}>", "nullBucket:{count,nonNullCount?,value?}", "truncatedBuckets", "bucketsTruncatedCount", "unaccountedCount?", "shapeWarnings?", "strategyFallback?", "coverage:{mode:server-total|paged-local-scan|local-scan|server-aggregate,rowsScanned,cap:number|null,complete,missingCount?}", "filter:{draftPolicy,hint}", "wire:{calls,plan,concurrency?}", "capNotice?", "note?", "environmentFingerprint"],
80
- notes: ["计数用 total(totalElements);分组=值域×count,key 是存储值/code,null 单列 nullBucket;分桶 count 并发窗口 4,桶序稳定;数值指标(sum/avg/min/max+field)本地折叠(cap 1000,null 不进聚合、avg 分母排除 null);coverage.mode=server-total/paged-local-scan/local-scan/server-aggregate,/sum 不可用或形状不符回退本地(strategyFallback);complete:false 只覆盖已扫行,勿外推"],
105
+ keys: ["schemaCode", "metric", "field?", "value?", "count", "nonNullCount?", "nullCount?", "groupBy?", "total", "buckets:array<{key,count,nonNullCount?,value?}>", "nullBucket:{count,nonNullCount?,value?}", "truncatedBuckets", "bucketsTruncatedCount", "unaccountedCount?", "shapeWarnings?", "strategyFallback?", "coverage:{mode:server-total|paged-local-scan|local-scan|server-aggregate,rowsScanned,cap,complete,missingCount?}", "filter:{draftPolicy,hint}", "wire:{calls,plan,concurrency?}", "capNotice?", "note?", "environmentFingerprint"],
106
+ notes: ["计数用 total(totalElements);分组=值域×count,key 是存储值/code,null 单列 nullBucket;分桶 count 并发窗口 4;数值指标(sum/avg/min/max+field)本地折叠(cap 1000,null 不进聚合、avg 分母排除 null);coverage.mode=server-total/paged-local-scan/local-scan/server-aggregate,/sum 不可用或形状不符回退本地(strategyFallback);complete:false 只覆盖已扫行,勿外推"],
81
107
  },
82
108
  "app.list": {
83
109
  keys: ["applications:array<{code,name,groupId?,modelCount}>", "applicationsCount", "omitted"],
@@ -362,6 +362,11 @@ export function parseToolInput(tool, input) {
362
362
  status: "error",
363
363
  blocker: "tool-input-unknown-keys",
364
364
  tool: tool.name,
365
+ // F1(retro 22,ticket 138):机器字段先行——被拒键与合法键全集成对给出,
366
+ // 脚本不必再从 message 里解析中文句子。issues[] 仍是逐键 diff 的单一
367
+ // 真相源(path/code/message),这里只是它的汇总面,不是第二套结构。
368
+ unknownKeys: unknown,
369
+ expectedKeys: [...schemaKeys],
365
370
  message: `写面工具不接受未知键(会被静默丢弃):${unknown.join("、")}。${twoStep.length > 0 ? twoStep.join(" ") : siblingHints.length > 0 ? siblingHints.join(";") : `${guidanceLines.length > 0 ? guidanceLines.join(";") : `最接近的合法键:${suggestions.join(";")}`}。参数表:${paramCommand}`}`,
366
371
  ...(twoStep.length > 0 || guidanceLines.length > 0 || siblingHints.length > 0 ? { nextCommand: `omc describe ${tool.name}` } : { nextCommand: paramCommand }),
367
372
  issues: unknown.map((key) => ({ path: [key], code: "unrecognized_key", message: issueHintFor(key) })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.6.87",
3
+ "version": "0.6.89",
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.87",
59
+ "omc-core": "0.6.89",
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.87"
77
+ "@stalfh233/omc-fake-platform": "0.6.89"
78
78
  }
79
79
  }
@@ -199,3 +199,4 @@ concurrency, not approval.
199
199
  - 多列:`--jq "a.b,c.d"` 或重复 `--jq`(结果在 `projections[]`);**不支持** `|` 与对象构造
200
200
  - miss 回 `pathMiss`+`missedAt`+`available`(`--extract` 另置 `unanswered`):未命中≠空值
201
201
  - `mapped`=命中数,`nullEntries`=其中 null 数;相等时看同次 `data.list` 的 `projectionHint` 或 `data.load`
202
+ - miss 机器字段:`correctPath`+`nextCommand`(能验证才给)、`helpRef`;`resultMeta.locator` 给 `items[].fields.<code>`↔`data.<code>`(行键↔`bizObjectId`)对照;`nonNullEntries`=mapped 中非 null 数;`projectionHint` 有 `queryColumns` 证据才给 `projectedFields`/`unprojected`,否则 `projectionKnown:false`