@stalfh233/omc-cli 0.6.56 → 0.6.58

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/discovery.js CHANGED
@@ -522,7 +522,7 @@ export function describeTool(registry, name) {
522
522
  name: tool.name,
523
523
  lane: tool.lane ?? null,
524
524
  kind: tool.kind,
525
- summary: clampText(summarizeDescription(tool.description), 110),
525
+ summary: clampText(summarizeDescription(tool.description), 240),
526
526
  required,
527
527
  params,
528
528
  examples,
@@ -544,6 +544,10 @@ export function describeTool(registry, name) {
544
544
  // High-frequency read faces: declare the RESULT keys so `--jq` does not
545
545
  // have to learn them from a pathMiss. Zero bytes when undeclared.
546
546
  ...(returnsFace(tool.name) ?? {}),
547
+ // r66 ① readbackKeys(c-F2):没有 authored read-shape 的工具也别说「键名无处
548
+ // 可查」——裸 --jq(不带路径)就是键清单(与 artifact get --keys 同语义)。
549
+ // 只在无 returns 声明时出现,避免与 returns.keys 重复。
550
+ ...(readShapeFor(tool.name) === undefined ? { returnsHint: "回执键清单:omc call 本工具 --jq(裸,不带路径)= 顶层键一览" } : {}),
547
551
  // r32 F1(真机):探针并发发两条 app.create,第二条回 write-lock-held。
548
552
  // 撞上之前没有任何发现面说过"写是环境级串行"——describe 的 params 里没有 wait
549
553
  // (它是 omc call 的 CLI 开关,不在工具 schema),capability notes 是空的。
@@ -552,7 +556,16 @@ export function describeTool(registry, name) {
552
556
  }
553
557
  /** Clamp to `limit` characters, ellipsis included — never cut mid-grapheme. */
554
558
  function clampText(text, limit) {
555
- return text.length <= limit ? text : `${text.slice(0, limit - 1)}…`;
559
+ if (text.length <= limit)
560
+ return text;
561
+ const head = text.slice(0, limit - 1);
562
+ // r65 a-F5(探针复现):workflow.finish 的 summary 恰好在「end 规则照常触发 vs
563
+ // abort 区别」的半句处被硬切——判据被裁掉,探针被迫多读 4KB --full。截断优先落
564
+ // 在句边界(。;;),半句内没有边界才硬切。
565
+ const boundary = Math.max(head.lastIndexOf("。"), head.lastIndexOf(";"), head.lastIndexOf(";"));
566
+ if (boundary >= Math.floor(limit * 0.5))
567
+ return `${text.slice(0, boundary + 1)}…`;
568
+ return `${head}…`;
556
569
  }
557
570
  /**
558
571
  * The default `firstCall` keeps the decision-relevant facts — which recipe, can
@@ -13,7 +13,8 @@ import { B2_METADATA } from "./recipes/b2-registration.js";
13
13
  import { ONLINEJS_METADATA } from "./recipes/online-js.js";
14
14
  import { LISTVIEW_METADATA } from "./recipes/list-view.js";
15
15
  import { DICTIONARY_METADATA } from "./recipes/dictionary.js";
16
- const SOURCES = [MODEL_METADATA, FORM_METADATA, FIELD_METADATA, DATARULE_METADATA, BUSINESSRULE_METADATA, WORKFLOW_METADATA, RUNTIME_DATA_METADATA, B2_METADATA, ONLINEJS_METADATA, LISTVIEW_METADATA, DICTIONARY_METADATA];
16
+ import { REPORT_METADATA } from "./recipes/report.js";
17
+ const SOURCES = [MODEL_METADATA, FORM_METADATA, FIELD_METADATA, DATARULE_METADATA, BUSINESSRULE_METADATA, WORKFLOW_METADATA, RUNTIME_DATA_METADATA, B2_METADATA, ONLINEJS_METADATA, LISTVIEW_METADATA, DICTIONARY_METADATA, REPORT_METADATA];
17
18
  const merged = {};
18
19
  for (const source of SOURCES) {
19
20
  for (const [tool, metadata] of Object.entries(source)) {
@@ -780,6 +780,39 @@ function goalRouteInner(registry, goal) {
780
780
  };
781
781
  }
782
782
  }
783
+ // r65 b-F1(探针复现):「把当前环境的全部配置导出成一个包(整环境配置备份)」被
784
+ // READ_CUES 的「导出」吸进环境读梯子,反问「要查看哪个对象?给我 schemaCode」——
785
+ // 方向全错,探针多花 2 轮自救。导出**成备份包**是 app.export 动作(落盘产物),
786
+ // 不是「查某个模型」。放在能力打分前直指。注意裸「迁移」不进(模型跨应用移动另有路由)。
787
+ if (/(导出|备份|export|backup).{0,12}(包|配置|环境|应用包)|(整环境|全量|整个环境).{0,8}(备份|导出|迁移)|(备份|导出).{0,8}迁移/.test(goal)) {
788
+ const appRoute = routeById.get("app");
789
+ if (appRoute !== undefined && registryTools.has("app.export")) {
790
+ return {
791
+ status: "ok",
792
+ goal,
793
+ confident: true,
794
+ mode: "read",
795
+ write: false,
796
+ match: { kind: "capability", ref: "app", title: "应用包导出(备份)", capabilities: ["app"] },
797
+ route: {
798
+ capability: "app",
799
+ lane: appRoute.lane,
800
+ note: "配置备份走 app.export:省略 applicationCode 导整环境生命周期包(不含字典/组织/角色/用户,回执 notIncluded 明示);指定 applicationCode 导单应用。导出≠迁移:CLI 不提供 import,导入走平台控制台。",
801
+ readTools: ["app.export"],
802
+ readiness: DISCOVERY_AUTHORITY.readiness,
803
+ firstCommands: ["omc call app.export --args '{\"out\":\".omc/backups/\"}'", "omc call app.export --args '{\"applicationCode\":\"<应用code>\",\"out\":\".omc/backups/\"}'"],
804
+ write: false,
805
+ readback: true,
806
+ },
807
+ firstAnswer: {
808
+ state: "needs-input",
809
+ question: "整环境备份还是单应用?单应用给 applicationCode;产物目录可直接回车用默认 .omc/backups/。",
810
+ action: "omc call app.export --args '{\"out\":\".omc/backups/\"}'",
811
+ why: "导出/备份成包 = app.export(落盘产物 + sha256 + 条目清单);环境包边界(不含字典/组织/角色)在回执 notIncluded 里。",
812
+ },
813
+ };
814
+ }
815
+ }
783
816
  // Known absence only: field-families exposes list/create/update/publish/delete,
784
817
  // with no unpublish endpoint or update status bit (local 1.1.25 probe, 2026-11-11).
785
818
  // Do not infer other absences from tool names: rollback is a top-level command,
@@ -1148,6 +1181,10 @@ function goalRouteInner(registry, goal) {
1148
1181
  capability: id,
1149
1182
  lane: capability.lane,
1150
1183
  tools: stepTools(registry, capability.lane),
1184
+ // r66 ②(c-F4):有依赖顺序的能力(report)在阶梯步骤里也带 order。
1185
+ ...(capabilityOrder(id) ?? {}),
1186
+ // r65 a-F6:多能力阶梯不内联 notes(字节),给一步指针。
1187
+ notesCommand: `omc capability ${id} --executable`,
1151
1188
  ...(recipe
1152
1189
  ? { recipe: { tool: recipe.tool, id: recipe.recipe, command: `omc describe ${recipe.tool} --example ${recipe.recipe}` } }
1153
1190
  : { firstCommand: `omc commands --json --compact --lane ${capability.lane}` }),
@@ -1278,6 +1315,15 @@ function goalRouteInner(registry, goal) {
1278
1315
  ? { primary: "intent" }
1279
1316
  : { primary: "atomic", note: "该能力无声明式面(intent.level=none),走原子工具" }) : {}),
1280
1317
  ...(readish ? { readTools: readToolsInLane(registry, route.lane) } : { tools: route.tools }),
1318
+ // r66 ②(c-F4):有依赖顺序的能力(report)显式给 order,修掉 tools 键序
1319
+ // (注册序 link<create)对步骤顺序的误导。
1320
+ ...(readish ? {} : (capabilityOrder(capabilityId) ?? {})),
1321
+ // r65 a-F6(探针复现):定位语(workflow 的「测试提速三件套/运维过的实例权限
1322
+ // 语义已变」)只活在 capability notes 里,next 不带——探针靠 ladder 回包顺带
1323
+ // 瞥见才知道有这条路。单能力路由把 notes 直接内联(各能力 notes ≤ ~400B)。
1324
+ ...(index.nodeById.get(capabilityId)?.notes !== undefined
1325
+ ? { capabilityNotes: index.nodeById.get(capabilityId).notes }
1326
+ : {}),
1281
1327
  ...routeReads(sectionPointersFor([capabilityId], goal), recipe !== undefined),
1282
1328
  readiness: DISCOVERY_AUTHORITY.readiness,
1283
1329
  firstCommands,
@@ -1297,6 +1343,27 @@ function goalRouteInner(registry, goal) {
1297
1343
  : { firstAnswer: { state: "needs-input", question: "要操作哪个对象?给我 schemaCode(或模型业务名,我列清单核对)", action: LIST_MODELS_ACTION, why: "未命中配方:需要目标对象 code 才能给出一步可跑的写命令" } }),
1298
1344
  };
1299
1345
  }
1346
+ /**
1347
+ * r66 ②(c-F4 真机复现):`next` 报表链回执的 `tools` 对象按 lane 注册序排列——
1348
+ * `report.datasource.link` 排在 `report.create` 前,探针照键序先 link 被拒
1349
+ * (dashboard 不存在)。tools map 是注册投影,键序不该被读成语义;有依赖顺序的
1350
+ * 能力在此声明 `order`,路由原样透出。未列的能力不输出(零字节)。
1351
+ */
1352
+ const CAPABILITY_ORDERS = Object.freeze({
1353
+ report: ["report.create", "report.datasource.link", "report.configure", "report.update", "report.delete"],
1354
+ });
1355
+ /** 取能力的执行序(含 chartdata 取数边界注记),未声明返回 undefined。 */
1356
+ function capabilityOrder(capabilityId) {
1357
+ const order = CAPABILITY_ORDERS[capabilityId];
1358
+ if (order === undefined)
1359
+ return undefined;
1360
+ // chartdata 是取数一跳(环境边界:reporter 版本族须对齐主应用,8.6 环境见
1361
+ // r63 教学信封)——单列注记而不是塞进 order(它不是配置链的一环)。
1362
+ if (capabilityId === "report") {
1363
+ return { order, orderNote: "执行顺序见 order(tools 的键序是注册序,勿按它排步骤);chartdata 是取数一跳:需 reporter 版本族对齐主应用,环境边界,换参数/重试无用" };
1364
+ }
1365
+ return { order };
1366
+ }
1300
1367
  /**
1301
1368
  * `next` 的对外入口:原有路由结果原样返回,只在「引用/影响面」类提问上追加
1302
1369
  * `graphHint`(不改 route、不改 confident、不改 firstAnswer)。理由见
@@ -214,7 +214,7 @@ function phraseOf(tool, args, outcome) {
214
214
  }
215
215
  return args.submit === true
216
216
  ? `保存并直提数据(模型 ${schemaCode ?? "?"})——一调完成态:DRAFT→COMPLETED,Create 规则已派发(无流程模型;流程模型会拒绝并指路两段式)`
217
- : `保存数据(模型 ${schemaCode ?? "?"})——草稿 DRAFT;要一调完成态加 submit:true`;
217
+ : `保存数据(模型 ${schemaCode ?? "?"})——草稿 DRAFT;要一调完成态加 **data.save 自己的** submit:true(data.submit 无此参数,两段式改调 data.submit)`;
218
218
  }
219
219
  case "data.update":
220
220
  return `更新数据 ${stringArg(args, "bizObjectId") ?? "?"}(${schemaCode ?? "?"})`;
@@ -87,7 +87,7 @@ export const APP_LANE_CONTRACT = Object.freeze({
87
87
  }),
88
88
  "app.export": Object.freeze({
89
89
  scope: "app package export",
90
- description: "导出配置包(备份/迁移):applicationCode 省略 → 环境级生命周期包(/lifeCycle/apppackage/lifeCycleExport,全部应用包+应用分组+业务集成服务+数据源,metadata/…)。指定 applicationCode → 单应用包(apppackage/export,body {appCode,references},meta/{dm,form,view,workflow,report}+dependencies/platform/*)。includeDependencies 仅单应用有效:先读 apppackage/dependencies,把引用全选后传 references;环境包平台固定空引用,故环境范围传 true 直接拒。ZIP 同步返回(实测 1–3s;超时回 uncertain,勿当成功)。产物落盘:默认会话 artifacts,out 指定配置根内路径(0600)。回执只给 outPath/bytes/sha256/条目清单/资产计数,永不内联包内容。平台没有按资产类型筛选的参数,不收 assetTypes。",
90
+ description: "导出配置包(备份用;导出≠迁移——CLI 不提供 import,导入走平台控制台/应用导入向导):applicationCode 省略 → 环境级生命周期包(/lifeCycle/apppackage/lifeCycleExport,全部应用包+应用分组+业务集成服务+数据源,metadata/…)。指定 applicationCode → 单应用包(apppackage/export,body {appCode,references},meta/{dm,form,view,workflow,report}+dependencies/platform/*)。includeDependencies 仅单应用有效:先读 apppackage/dependencies,把引用全选后传 references;环境包平台固定空引用,故环境范围传 true 直接拒。ZIP 同步返回(实测 1–3s;超时回 uncertain,勿当成功)。产物落盘:默认会话 artifacts,out 指定配置根内路径(0600)。回执只给 outPath/bytes/sha256/条目清单/资产计数,永不内联包内容。环境包完整性由回执 packageIntegrity/warnings 交叉核(应用被平台跳过会显式告警,勿用于迁移)。平台没有按资产类型筛选的参数,不收 assetTypes。",
91
91
  }),
92
92
  }),
93
93
  });
package/dist/lanes/app.js CHANGED
@@ -666,12 +666,29 @@ export function registerAppLane(tools) {
666
666
  const referenceCounts = references === undefined
667
667
  ? undefined
668
668
  : Object.fromEntries(Object.entries(references).map(([key, value]) => [key, arrayLength(value)]));
669
+ // r65 b-F6(真机回执在档):平台在并发修改期可能瞬时跳过整个应用——回执里
670
+ // environment.applicationCount=7 与 assets.applicationCount=6 并存而 status 仍 ok,
671
+ // 客户拿这种包迁移会静默丢应用。CLI 侧无条件交叉核两个清单,不一致必告警。
672
+ const envApplicationCodes = applications.map((row) => row.code);
673
+ const environmentAssets = scope === "environment" ? assets : undefined;
674
+ const environmentSkipped = environmentAssets !== undefined
675
+ ? envApplicationCodes.filter((code) => !environmentAssets.applicationCodes.includes(code))
676
+ : [];
677
+ const environmentWarnings = environmentSkipped.length > 0
678
+ ? [
679
+ `app-skipped:${environmentSkipped.join(",")}——平台在导出瞬间跳过了这些应用(并发修改期可发生,如删除级联进行中)。**包不完整,禁止用于迁移**;稍后重导,或对每个被跳过应用单独 app.export {applicationCode}`,
680
+ ]
681
+ : undefined;
669
682
  return {
670
683
  scope,
671
684
  endpoint,
672
685
  ...(selected !== undefined
673
686
  ? { application: { code: selected.code, name: selected.name } }
674
- : { environment: { applicationCount: applications.length, applicationCodes: applications.map((row) => row.code) } }),
687
+ : { environment: { applicationCount: applications.length, applicationCodes: envApplicationCodes } }),
688
+ ...(scope === "environment" ? { snapshotAt: new Date().toISOString(), snapshotClock: "cli" } : {}),
689
+ ...(environmentWarnings !== undefined
690
+ ? { warnings: environmentWarnings, packageIntegrity: "incomplete-apps-skipped" }
691
+ : { packageIntegrity: "complete" }),
675
692
  ...(referenceCounts !== undefined ? { includeDependencies: args.includeDependencies === true, references: referenceCounts } : {}),
676
693
  outPath,
677
694
  // CLI stdout sanitises local paths (ticket 103: the machine envelope
@@ -209,6 +209,43 @@ function parentMismatchFields(requestedParentId, treeNode) {
209
209
  function reportVerifyCommand(code, appCode) {
210
210
  return `omc call folder.tree --args '{"applicationCode":"${appCode}"}' --jq 'nodes' | 按 code=${code} 查 type=Report 的 parentId/path(BI 不可用时 report.get/report.tree 不可信)`;
211
211
  }
212
+ function summarizeChartEntry(entry) {
213
+ if (entry !== null && typeof entry === "object") {
214
+ const row = entry;
215
+ const field = row.field ?? row.name ?? row.code ?? row.alias ?? row.caption ?? row.id;
216
+ // r66 ②:真机报文(reporter 日志 @AfterThrowing args,2026-11-14 01:48)实证聚合键是
217
+ // `agg`(小写):{"field":"name","alias":"合同数","agg":"count"}。枚举来自 reporter
218
+ // AggregateTypeEnum:sum/avg/count/max/min/countDistinct/…(报文小写)。
219
+ const agg = row.agg ?? row.aggregation ?? row.aggFunc ?? row.aggregate ?? row.type;
220
+ return agg !== undefined ? `${String(field)}(${String(agg)})` : String(field);
221
+ }
222
+ return String(entry);
223
+ }
224
+ /**
225
+ * r65 c-F8(探针复现):readback 只投影 uuid/title/type/dataSourceId/mainTable/position,
226
+ * 「按什么汇总」全在 data 里却不投影——回执只能证「图行存在」不能证「图配对」。
227
+ * 维度/度量做最佳努力摘要;解析不出结构时至少回 dataKeys 让调用方知道下一步取什么。
228
+ *
229
+ * r66 ② 纠偏(真机取证):data 内键是**单数** dimension/metric/filter/sort——r65 写的
230
+ * 复数 dimensions/measures 在真机形状下永远解析不出(fake 当时 dataAbsent 未暴露)。
231
+ * 真机报文:{"dimension":[],"metric":[{"field":"name","alias":"合同数","agg":"count"}],
232
+ * "filter":[],"sort":[],"limit":{"value":10,"showOthers":false},"options":{}}
233
+ * (reporter 日志 2026-11-14 01:48,r63_probe_chart;枚举=AggregateTypeEnum)。
234
+ */
235
+ function chartDataSummary(raw) {
236
+ const data = parseJsonText(raw);
237
+ if (data === undefined || data === null)
238
+ return { dataAbsent: true };
239
+ if (typeof data !== "object" || Array.isArray(data))
240
+ return { dataPresent: true };
241
+ const out = {};
242
+ for (const key of ["dimension", "metric", "filter", "sort", "dimensions", "measures", "filters", "rows", "columns"]) {
243
+ const value = data[key];
244
+ if (Array.isArray(value) && value.length > 0 && out[key] === undefined)
245
+ out[key] = value.slice(0, 6).map(summarizeChartEntry);
246
+ }
247
+ return Object.keys(out).length > 0 ? out : { dataKeys: Object.keys(data).slice(0, 10) };
248
+ }
212
249
  function chartView(chart) {
213
250
  return {
214
251
  uuid: chart.uuid,
@@ -217,6 +254,7 @@ function chartView(chart) {
217
254
  dataSourceId: chart.dataSourceId,
218
255
  mainTable: chart.mainTable,
219
256
  position: parseJsonText(chart.position),
257
+ dataSummary: chartDataSummary(chart.data),
220
258
  };
221
259
  }
222
260
  /** Read the BI config, treating a missing dashboard as present:false rather than an error. */
@@ -484,12 +522,18 @@ export function registerReportLane(tools) {
484
522
  return true;
485
523
  });
486
524
  const modelCount = merged.filter((row) => Number(row.nodeType) === 1).length;
525
+ // r65 c-F9:行数据常被外置到 artifact,artifact get --jq 只回裸行——模型行的
526
+ // dataSourceId 恒 null 极易读成「没有数据源可连」。真键 objectId 直接以
527
+ // linkObjectId 别名随行携带,裸行自解释。
528
+ const rows = merged.map((row) => Number(row.nodeType) === 1 && row.objectId !== undefined && row.objectId !== null
529
+ ? { ...row, linkObjectId: String(row.objectId) }
530
+ : row);
487
531
  return {
488
532
  kind: args.kind,
489
533
  parentObjectId: args.parentObjectId ?? null,
490
534
  count: merged.length,
491
535
  modelCount,
492
- datasources: merged,
536
+ datasources: rows,
493
537
  note: "link 只认**模型行**(nodeType:1)的 objectId(当 dataSourceId 用;模型行的 dataSourceId 字段恒 null)。顶层(不传 parentObjectId)没有模型行——先下钻:应用 id 从 folder.tree 取(应用包节点 id),或用本面 nodeType:0 行的 objectId。nodeType:0=应用/分组容器,200=系统数据源。",
494
538
  ...(modelCount === 0 && args.parentObjectId === undefined
495
539
  ? { nextCommand: `omc call report.datasource.list --args '{"reportCode":"${args.reportCode}","appCode":"${args.appCode}","parentObjectId":"<分组或应用 id>"}'` }
@@ -1815,7 +1815,7 @@ export function registerRuntimeDataLane(tools) {
1815
1815
  authoritative: projectReadbackRecord(savedRecord, args),
1816
1816
  ...(savedEmptyFields.length > 0 ? { readbackWarning: readbackWarningFor(savedEmptyFields, "data.save") } : {}),
1817
1817
  ...(dataWarnings.length > 0 ? { warnings: dataWarnings } : {}),
1818
- draftRuleHint: workflowDraftHint ?? "草稿态(DRAFT)保存不触发业务规则——DRAFT 行跳过 Create/Update 分发(DomainServiceImpl.java:240-248);要一调完成态本调用加 submit:true;已存草稿直提形状:data.submit {schemaCode, bizObjectId: 本读回的 bizObjectId, formData}(submit 自持久化)",
1818
+ draftRuleHint: workflowDraftHint ?? "草稿态(DRAFT)保存不触发业务规则——DRAFT 行跳过 Create/Update 分发(DomainServiceImpl.java:240-248);要一调完成态本调用加 submit:true(仅 data.save 有此参数;data.submit 不收);已存草稿直提形状:data.submit {schemaCode, bizObjectId: 本读回的 bizObjectId, formData}(submit 自持久化)",
1819
1819
  };
1820
1820
  // r18 retro (G3): one-call COMPLETED creation — the agent goal is usually
1821
1821
  // "record AND rule effect", not "a draft". Chain the no-flow submit in
@@ -3404,6 +3404,12 @@ export function registerWorkflowLane(tools) {
3404
3404
  const othersScopeNote = scopedToInstance && page.total === 0 && typeof unfiltered === "number" && unfiltered > 0
3405
3405
  ? `total:0 是当前登录人口径——查询范围(unfilteredTotal=${unfiltered})内存在他人的待办。若该实例应有待办:待办按持有人过滤,用 participant:<持有人id> 复查(持有人见 data.submit 回执 flowWarning);不要据此判定「流程未生成」。`
3406
3406
  : undefined;
3407
+ // r65 a-F8(探针复现):不带过滤时 total=11 与 itemsCount=0 并存且无任何口径说明
3408
+ // ——清理验收差点把他人待办当自己残留。total 与 items 恒为「当前登录人可见」
3409
+ // 口径,unfiltered(若平台回)才是范围全量;无过滤时同样要说清。
3410
+ const unscopedScopeNote = !scopedToInstance
3411
+ ? `total/items 是**当前登录人可见**口径${typeof unfiltered === "number" ? `(unfilteredTotal=${unfiltered} 为查询范围全量,含他人)` : "(他人待办不在其中)"};清点残留请按此口径解读,勿把范围全量当自己的。`
3412
+ : undefined;
3407
3413
  return {
3408
3414
  total: page.total,
3409
3415
  // The JPA-spec path reports no page count; only emit it when known.
@@ -3411,6 +3417,7 @@ export function registerWorkflowLane(tools) {
3411
3417
  itemsCount: items.length,
3412
3418
  ...(purposeHint ? { purposeHint } : {}),
3413
3419
  ...(othersScopeNote ? { scopeNote: othersScopeNote } : {}),
3420
+ ...(othersScopeNote === undefined && unscopedScopeNote !== undefined ? { scopeNote: unscopedScopeNote } : {}),
3414
3421
  ...(args.participant !== undefined ? { participant: args.participant, state: args.state ?? "PENDING", source: "list_workitems" } : {}),
3415
3422
  ...("unfilteredTotal" in page && page.unfilteredTotal !== undefined ? { unfilteredTotal: page.unfilteredTotal } : {}),
3416
3423
  items,
@@ -192,13 +192,16 @@ export const JQ_PATH_TOPIC = "omc-refusals";
192
192
  export const JQ_PATH_SECTION = "10. 投影路径(--jq / --extract)";
193
193
  export const JQ_PATH_HELP_POINTER = `语法详解:omc help ${JQ_PATH_TOPIC} --section 10(投影路径)。`;
194
194
  /** Shared wording for every projection miss, so every face teaches the same syntax. */
195
- export const PATH_MISS_HINT = `路径未命中(这一层没有该段)。${RESULT_RELATIVE_PATH_NOTE}${JQ_PATH_SYNTAX}available 是该层真实存在的键。${JQ_PATH_RULES}${JQ_PATH_HELP_POINTER}`;
195
+ // r66 ① readbackKeys(c-F2):R65 探针 3 次投影 miss 全靠 available 救回——键名
196
+ // 无处可查。裸 --jq(不带路径)= 键清单这个姿势一直在(cli.ts extractKeys 分支),
197
+ // 但没有任何一面教过它。miss 正是教学时机:撞过一次的人最听得进「先看全键再投影」。
198
+ export const PATH_MISS_HINT = `路径未命中(这一层没有该段)。${RESULT_RELATIVE_PATH_NOTE}${JQ_PATH_SYNTAX}available 是该层真实存在的键。想一次拿全部顶层键:--jq 不带路径重跑。${JQ_PATH_RULES}${JQ_PATH_HELP_POINTER}`;
196
199
  /**
197
200
  * `artifact get` 面:产物内容的投影。区别只在开头——它已经把 miss 落在哪一段
198
201
  * (`missedAt`)和可用的键/范围一并返回,所以不必重复「这一层没有该段」。
199
202
  */
200
203
  export function artifactPathMissHint(at) {
201
- return `路径未命中${at !== undefined ? `段 "${at}"` : "(这一层没有该段)"}——available 是该层真实存在的键/范围;方括号下标(a[0])与点式(a.0)等价。${JQ_PATH_SYNTAX}${JQ_PATH_RULES}${JQ_PATH_HELP_POINTER}`;
204
+ return `路径未命中${at !== undefined ? `段 "${at}"` : "(这一层没有该段)"}——available 是该层真实存在的键/范围;方括号下标(a[0])与点式(a.0)等价;想一次拿全部顶层键:--keys(或裸 --jq)。${JQ_PATH_SYNTAX}${JQ_PATH_RULES}${JQ_PATH_HELP_POINTER}`;
202
205
  }
203
206
  /** 逗号多路径里只有部分 miss:给出定位方式 + 同一套语法。 */
204
207
  export function partialPathMissHint() {
@@ -161,6 +161,47 @@ const READ_SHAPES = {
161
161
  keys: ["roleId", "userId", "count", "scopes:array<{id,deptId,name,type,deptPath,includeChildren,source}>", "actor?", "readback"],
162
162
  notes: ["不是枚举档位:scopes 是部门节点列表;roleId 与 roleCode 二者其一;includeChildren 平台不返回(unknown);source:configured;空结果是合法空集"],
163
163
  },
164
+ // r66 ① readbackKeys(c-F2):R65 探针 3 次投影 miss(items→applications 类)靠 pathMiss
165
+ // 救回;报表面当时整族零声明。以下 9 条全部从 fake 真实回执采样生成
166
+ // (node --import tsx 采样脚本:create→link→configure→get/chartdata 全链),非手写。
167
+ // 写面条目列 readback 内层键(回执壳 performed/deliveryState/summary/detailFile 等
168
+ // 是所有写工具共同结构,见 --full);returnsFace 只取 notes[0]。
169
+ "report.tree": {
170
+ keys: ["status", "appCode", "reportCount", "reports:array<{code,name,treeNodeId,parentId,path,charts}>", "chartTreeCount", "note"],
171
+ notes: ["列表键是 reports[](不是 items/folders);行内 charts 是图表计数"],
172
+ },
173
+ "report.datasource.list": {
174
+ keys: ["status", "kind", "parentObjectId?", "count", "modelCount", "datasources:array<{dataSourceId,displayName,nodeType,useType,objectId,corpId,linkObjectId?}>", "note", "nextCommand"],
175
+ notes: ["行名是 displayName(不是 name);模型行 nodeType:1 的 objectId 才是 link 用的 id(dataSourceId 恒 null);顶层无模型行时按 nextCommand 传 parentObjectId 下钻"],
176
+ },
177
+ "report.get": {
178
+ keys: ["status", "report:{id,code,name,appCode,parentId,path,...}", "bi:{present,corpId,chartCount,charts,globalPresent,attributesPresent}", "global", "attributes", "charts:array<{uuid,chartCode,chartName,chartType,dimensions,measures}>", "environmentFingerprint"],
179
+ notes: ["入参叫 code(不是 reportCode);bi.charts[].uuid 是 configure/chartdata 的图表标识"],
180
+ },
181
+ "report.chartdata": {
182
+ keys: ["status", "data:{series,total,metricFields}", "environmentFingerprint"],
183
+ notes: ["入参 reportCode + chart:{uuid}(对象非字符串);数据由 reporter 服务出,环境缺 reporter 时回教学信封"],
184
+ },
185
+ "report.create": {
186
+ keys: ["status", "readback:{present,report,biInitialized,treeNodeId,actualParentId,actualPath}", "rollback"],
187
+ notes: ["parentId 必须是目录 treeNodeId(非目录拒并给 folderCandidates);建完要 datasource.link + configure 才有内容"],
188
+ },
189
+ "report.update": {
190
+ keys: ["status", "readback:{present,report}", "rollback"],
191
+ notes: ["入参只认 code(reportCode/appCode 是未知键,会被拒)"],
192
+ },
193
+ "report.configure": {
194
+ keys: ["status", "readback:{chartCount,charts:array<{uuid,title,type,dataSourceId,mainTable,position,dataSummary}>,globalPresent,attributesPresent}", "rollback"],
195
+ notes: ["charts[].uuid 必带(既有图表=更新,新图表自带 uuid),缺 uuid 整批拒;先 datasource.link 否则图表无数据源"],
196
+ },
197
+ "report.datasource.link": {
198
+ keys: ["status", "readback:{linkedCount,models:array<{dataSourceId,displayName,tableName}>}", "rollback"],
199
+ notes: ["dataSourceInfos[].dataSourceId 用模型行 objectId(datasource.list 下钻 nodeType:1 行);应用级 id 会被拒"],
200
+ },
201
+ "report.delete": {
202
+ keys: ["status", "readback:{absent,remainingInTree,biRemoved,platformRemoved}", "rollback"],
203
+ notes: ["三面删除确认(dashboard/bi/platform);remainingInTree:false 才是真删净"],
204
+ },
164
205
  };
165
206
  /** Lookup the authored return shape for a tool, if any. */
166
207
  export function readShapeFor(toolName) {
@@ -0,0 +1,114 @@
1
+ import { environment, commonRecovery } from "./shared.js";
2
+ const reportChartSumRecipe = Object.freeze({
3
+ id: "report-chart-sum",
4
+ title: "报表配图:按维度汇总度量(如按供应商汇总金额 SUM / 按状态计数)",
5
+ aliases: ["汇总图", "统计图", "柱状图", "饼图", "分组统计", "按维度汇总", "配图"],
6
+ status: "offline-valid",
7
+ tool: "report.configure",
8
+ args: {
9
+ environment,
10
+ reportCode: "vendor_cost_report",
11
+ appCode: "<appCode>",
12
+ charts: [
13
+ {
14
+ uuid: "chart-vendor-amount-sum",
15
+ title: "各供应商费用金额汇总",
16
+ type: "bar",
17
+ dataSourceId: "<模型行 objectId:report.datasource.list 下钻 nodeType:1 行的 objectId>",
18
+ mainTable: "<模型物理表名:t_ 前缀,如 t_ia38g_crm_contract>",
19
+ position: { x: 0, y: 0, w: 8, h: 6 },
20
+ data: {
21
+ dimension: [{ field: "vendor", alias: "供应商" }],
22
+ metric: [{ field: "amount", alias: "金额合计", agg: "sum" }],
23
+ filter: [],
24
+ sort: [],
25
+ limit: { value: 20, showOthers: false },
26
+ options: {},
27
+ },
28
+ },
29
+ ],
30
+ },
31
+ preconditions: [
32
+ "报表页已创建(report.create)且 BI dashboard present(report.get bi.present=true)",
33
+ "数据源已连接(report.datasource.link 用模型行 objectId)",
34
+ ],
35
+ conditionalRequirements: [
36
+ "charts[].uuid 必带且自造(如 chart-<业务名>)——既有 uuid=更新,新 uuid=新增,缺 uuid 整批拒",
37
+ "data.dimension=维度(分组键,条目 {field,alias?});data.metric=度量(条目 {field,alias?,agg})——键是**单数** dimension/metric",
38
+ "agg 枚举(reporter AggregateTypeEnum,报文小写):sum/avg/count/max/min/countDistinct/groupConcat",
39
+ "dataSourceId 用**模型行 objectId**(datasource.list 下钻 nodeType:1 行);应用级 id 会被拒",
40
+ "data/position 对象或 JSON 字符串都可(工具层统一序列化)",
41
+ "type 常见:bar(柱)/ card(指标卡)/ pie(饼)/ table(明细)",
42
+ ],
43
+ priorToolReferences: [
44
+ { tool: "report.create", args: { environment, code: "vendor_cost_report", name: "供应商费用", appCode: "<appCode>", parentId: "<目录 treeNodeId>" }, purpose: "建报表页(parentId 必须是应用树 type=Folder 目录 id)" },
45
+ { tool: "report.datasource.list", args: { environment, reportCode: "vendor_cost_report", appCode: "<appCode>", parentObjectId: "<顶层行的 objectId>" }, purpose: "下钻找 nodeType:1 模型行,取 objectId 当 dataSourceId" },
46
+ { tool: "report.datasource.link", args: { environment, reportCode: "vendor_cost_report", appCode: "<appCode>", dataSourceInfos: [{ dataSourceId: "<模型行 objectId>", useType: 1 }] }, purpose: "连数据源(不连则图表无数据)" },
47
+ ],
48
+ dryRun: { supported: true, command: `omc call report.configure --env ${environment} --dry-run --args '<recipe.args>'`, notes: "dry-run 走 schema/语义/治理预检,不写 BI" },
49
+ expectedReadback: {
50
+ readback: {
51
+ chartCount: 1,
52
+ charts: [{ uuid: "chart-vendor-amount-sum", dataSummary: { dimension: ["vendor(供应商)"], metric: ["amount(sum)"] } }],
53
+ },
54
+ next: ["report.get(读回全量 charts 维度/度量)", "report.chartdata(取数:需 reporter 版本族对齐主应用,环境边界)"],
55
+ },
56
+ refusalRecovery: [
57
+ { code: "report-chart-uuid-required", action: "每个 charts[] 条目补自造 uuid(chart-<业务名>)" },
58
+ { code: "report-dashboard-absent", action: "先 report.create 初始化 BI dashboard,再 configure" },
59
+ { code: "report-datasource-link-not-synced", action: "dataSourceId 用模型行 objectId(datasource.list 下钻 nodeType:1),不是应用级 id" },
60
+ ...commonRecovery,
61
+ ],
62
+ requiresEnvironmentDerivedIds: true,
63
+ prerequisiteData: { source: "report.datasource.list", fields: ["objectId(模型行)"] },
64
+ });
65
+ const reportBarChartExample = Object.freeze({
66
+ id: "report-bar-chart",
67
+ title: "charts[] 已知键速查(真机报文取证的字段清单)",
68
+ status: "offline-valid",
69
+ tool: "report.configure",
70
+ args: {
71
+ environment,
72
+ reportCode: "<reportCode>",
73
+ appCode: "<appCode>",
74
+ charts: [
75
+ {
76
+ uuid: "<必带,自造>",
77
+ title: "图表标题",
78
+ type: "bar",
79
+ content: " ",
80
+ dataSourceId: "<模型行 objectId>",
81
+ mainTable: "<t_ 前缀物理表名>",
82
+ position: { x: 0, y: 0, w: 4, h: 4 },
83
+ styles: null,
84
+ useType: 1,
85
+ authorization: null,
86
+ data: { dimension: [], metric: [{ field: "name", alias: "合同数", agg: "count" }], filter: [], sort: [], limit: { value: 10, showOthers: false }, options: {} },
87
+ mobileOptions: null,
88
+ customSort: null,
89
+ deleteStatus: 0,
90
+ jumpingRules: null,
91
+ relations: null,
92
+ parentId: null,
93
+ formulas: null,
94
+ conditionFormats: null,
95
+ },
96
+ ],
97
+ removeUnlistedCharts: false,
98
+ corpId: "<corpId,默认 a>",
99
+ },
100
+ preconditions: ["同 report-chart-sum(先 create + link)"],
101
+ conditionalRequirements: [
102
+ "本例是 BI 前端保存图表的**完整字段清单**(真机 addChart 报文逐字段);常规配图只填 uuid/title/type/dataSourceId/mainTable/data,其余保持默认",
103
+ "data 内键:dimension/metric/filter/sort/limit/options(全单数);limit 是 {value,showOthers} 对象",
104
+ ],
105
+ priorToolReferences: [],
106
+ dryRun: { supported: true, command: `omc call report.configure --env ${environment} --dry-run --args '<recipe.args>'`, notes: "dry-run 预检" },
107
+ expectedReadback: { readback: { charts: [{ dataSummary: { metric: ["name(count)"] } }] } },
108
+ refusalRecovery: [...commonRecovery],
109
+ requiresEnvironmentDerivedIds: true,
110
+ });
111
+ export const REPORT_METADATA = Object.freeze({
112
+ "report.configure": Object.freeze({ recipes: [reportChartSumRecipe, reportBarChartExample], relatedTools: ["report.create", "report.datasource.list", "report.datasource.link", "report.get", "report.chartdata"] }),
113
+ });
114
+ //# sourceMappingURL=report.js.map
@@ -297,11 +297,20 @@ export async function diagnoseApprovalSubmitIdentity(session, args) {
297
297
  const awaiting = known
298
298
  .map((row) => ({ activityName: wireString(row.activityName) ?? null, activityCode: wireString(row.activityCode) ?? null, participants: participantIds(row) }))
299
299
  .filter((row) => row.participants.length > 0);
300
- throw new ToolRefusalError({
300
+ throw buildSubmitWorkitemNotMineRefusal({ instanceId, workItemId: typeof args.workItemId === "string" ? args.workItemId : undefined, myId, myName, awaiting });
301
+ }
302
+ /**
303
+ * r65 a-F7 抽出为纯构造(可单测):非本人待办的拒绝信封。③「临时改参与人再改回」
304
+ * 与项目规范冲突(漏还原=假权限交付),必须带沙盒限制;并给 workflow.transfer
305
+ * 替代路径(转过的实例勿再用于权限验证)。
306
+ */
307
+ export function buildSubmitWorkitemNotMineRefusal(input) {
308
+ const { instanceId, workItemId, myId, myName, awaiting } = input;
309
+ return new ToolRefusalError({
301
310
  status: "refused",
302
311
  blocker: "submit-workitem-not-mine",
303
312
  workflowInstanceId: instanceId,
304
- ...(typeof args.workItemId === "string" ? { workItemId: args.workItemId } : {}),
313
+ ...(workItemId !== undefined ? { workItemId } : {}),
305
314
  currentUser: { id: myId, name: myName },
306
315
  awaiting,
307
316
  nextCommand: `omc call workflow.instanceActivity --args '${JSON.stringify({ workflowInstanceId: instanceId })}'`,
@@ -310,7 +319,9 @@ export async function diagnoseApprovalSubmitIdentity(session, args) {
310
319
  `**这是 OMC 的能力边界**:平台按登录态鉴权,而 OMC 一次只持有一个会话(一份 token 缓存),` +
311
320
  `因此「非发起人身份的审批」无法在 CLI 内推进。可选做法:① 由该参与人自己在门户审批;` +
312
321
  `② 用该参与人的账号另建一个环境(omc env add)再执行同一条 data.submit;` +
313
- `③ 若只是为了验证流程能走通,把该节点参与人临时改为发起人(org.role.addUsers / workflow.update),验证后改回。` +
322
+ `③ 若只是为了验证流程能走通,把该节点参与人临时改为发起人(org.role.addUsers / workflow.update),验证后改回——` +
323
+ `**仅限本地沙盒且必须当场还原;生产/客户环境禁用**(漏还原=把假权限交付给客户)。` +
324
+ `或改用 workflow.transfer 把待办转给当前登录人再 data.submit(会写 ADJUST_PARTICIPANT 审计记录,且转过的实例勿再用于权限验证)。` +
314
325
  `不要重复盲试——同一个 workItemId 会一直回 40005。`,
315
326
  });
316
327
  }
@@ -31,6 +31,12 @@ const KEY_RULES = Object.freeze({
31
31
  serviceCode: { cls: "registry", source: "service.list → serviceCode" },
32
32
  methodCode: { cls: "registry", source: "method.get / service.get → methodCode" },
33
33
  serviceCategoryId: { cls: "registry", source: "service.category.list → id(「全部」空 id 不可用)" },
34
+ // r66 ②:report.configure 两配方(report-chart-sum / report-bar-chart)的参数面
35
+ reportCode: { cls: "registry", source: "report.tree → reports[].code(已存在报表)" },
36
+ appCode: { cls: "registry", source: "discover_environment → applications[].code" },
37
+ charts: { cls: "user", source: "配图清单(维度/度量/聚合)是需求本体", user: "utterance" },
38
+ removeUnlistedCharts: { cls: "auto", source: "步骤开关(默认 false=只增改不删)" },
39
+ corpId: { cls: "auto", source: "BI 租户 id(默认 a;report.get bi.corpId 可核对)" },
34
40
  fieldCodes: {
35
41
  cls: "user",
36
42
  source: "列的候选由 field.list 提供,但「列表要显示哪几列」是业务选择",
@@ -33,13 +33,19 @@ const FAMILY_GAPS = [
33
33
  // r27 真机(2026-11-05,1.1.25):BI 模块未部署,`/dashboard/v1/report/*` 全部
34
34
  // 502。探针为此在**三个面**各收一次税:report.create 回 present:true 但
35
35
  // report.tree 读回 0(读回矛盾)、report.delete 卡死导致应用删不掉(清理死结)、
36
- // folder.delete 指引错方向(使用摩擦),合计 9 轮。这条必须进 doctor,
37
- // 否则每个新 agent 都要重新踩一遍。
36
+ // folder.delete 指引错方向(使用摩擦),合计 9 轮。
37
+ //
38
+ // r65 c-F5 修正(2026-11-15):这条的根因是 **reporter 服务未运行**,不是版本族
39
+ // 固有缺席——r63 起 reporter 容器(:6061)运行后,同一 1.1.25 环境 report.create
40
+ // 回 biInitialized:true、report.get 回 bi.present:true(r65 探针再次真机确认)。
41
+ // 曾有探针按本条旧文案准备劝退整条报表路线。族级缺席结论一律标 needsReconfirm,
42
+ // 以实测为准。
38
43
  id: "report / BI (/dashboard/v1/report/*)",
39
44
  kind: "endpoint-absent-on-family",
40
45
  families: ["1.0", "1.1"],
41
- fallback: "报表页在平台侧可建(report.tree/report.get 走平台面),但 BI 初始化/详情/删除会 502:改用 listview 汇总列或 data.list 统计替代;report.delete 已降级为「BI 摘除失败仍执行平台侧删除」",
42
- evidence: "r27 真机 2026-11-05(1.1.25):report.create → biInit:failed;report.tree → reportCount:0;report.delete → /dashboard/v1/report/removeReport HTTP 502",
46
+ needsReconfirm: true,
47
+ fallback: "条件性缺口(reporter 服务未运行时):报表页在平台侧可建(report.tree/report.get 走平台面),BI 初始化/详情/删除会 502。reporter 运行时全链可用(r63 真机)。遇 502 先确认 reporter 服务状态,再决定是否改用 listview 汇总列/data.list 统计;report.delete 已降级为「BI 摘除失败仍执行平台侧删除」",
48
+ evidence: "r27 真机 2026-11-05(1.1.25,reporter 未起):biInit:failed;r63/r65 真机(同 1.1.25,reporter 已起):biInitialized:true、bi.present:true——族级结论已被实测推翻,needsReconfirm",
43
49
  },
44
50
  ];
45
51
  /** r28k F9 — 固定文案,doctor / get_status 共用,避免两义。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.6.56",
3
+ "version": "0.6.58",
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.56",
59
+ "omc-core": "0.6.58",
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.56"
77
+ "@stalfh233/omc-fake-platform": "0.6.58"
78
78
  }
79
79
  }
@@ -150,6 +150,12 @@ rules:
150
150
  - 筛选条件默认显示:`conditions[].visible` 不传也应为 true。
151
151
  - 配置默认视图后即可用 `data.list`;否则部分 8.6.26 读面业务列可能为 null,单行用 `data.load` 核对。
152
152
  - 读回视图用 `listview.get`(默认回列/排序/条件/动作紧凑清单)与 `listview.list`。
153
+ - **model.create 不自动发布表单页**(r65 真机):模型建好 ≠ 门户有页面——直接打开会回「form is unpublished」。要 `form.publish` + `listview.configure`(默认视图)后门户才有页面可看。
154
+ - **门户页面 URL 模式**(r65 真机取证,验收/取证用):
155
+ - 表单详情页 `/form/detail?schemaCode=<模型code>&objectId=<数据id>`
156
+ - 列表页 `/application/<appCode>/application-list/<schemaCode>`
157
+ - 应用列表 `/app-list/applications`
158
+ - 渲染取证必须打开真实页面看(存储回读 ≠ 门户认,如百分比 `ratio.*` 格式族)。
153
159
 
154
160
  ## 流程
155
161