@stalfh233/omc-cli 0.6.74 → 0.6.75

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.
@@ -427,8 +427,17 @@ function lintWorkflowTemplate(template, tool) {
427
427
  }
428
428
  }
429
429
  }
430
- /** Caller-side Activity aliases (input + workflowSummary spelling) that must never ride the wire. */
431
- const ACTIVITY_INPUT_ALIAS_KEYS = ["id", "type", "name", "code", "index"];
430
+ /**
431
+ * Caller-side Activity aliases (input + the readback-only workflowSummary
432
+ * spelling) that must never ride the wire.
433
+ *
434
+ * r79-09: `permissions`/`formButtons`/`bizActions` are summary projections, not
435
+ * platform Activity fields (the wire uses `propertyPermissions` /
436
+ * `buttonPermission.customBtns` / per-event `ActivityEventHandler.bizActions`).
437
+ * ticket-112's contract is that `workflowSummary.activities` can be fed back to
438
+ * `workflow.update` verbatim, so every readback-only key must be stripped here.
439
+ */
440
+ const ACTIVITY_INPUT_ALIAS_KEYS = ["id", "type", "name", "code", "index", "permissions", "formButtons", "bizActions"];
432
441
  /**
433
442
  * Ticket 112 — normalize the caller template onto the platform DTO:
434
443
  * - `routes[]` is NOT a WorkflowTemplateModel field (WorkflowTemplateModel
@@ -2189,6 +2198,29 @@ function activityPermissions(activity) {
2189
2198
  .filter((row) => row.visible || row.editable || row.required);
2190
2199
  return permissions.length > 0 ? { permissions } : undefined;
2191
2200
  }
2201
+ /**
2202
+ * r79-09: node-level rule bindings come from the eight per-activity
2203
+ * ActivityEventHandler fields (`{bizActions:[ruleCode], bizActionType:"BIZ_RULE"}`),
2204
+ * **not** from a `bizActions` key on the activity row. The summary therefore
2205
+ * projects `bizActions: {<nodeEvent>: [ruleCode]}` — the shape callers guessed
2206
+ * as `activities[].bizActions` (issue 09) and the in-node version of the
2207
+ * artifact face's `data.activities[code=X].<nodeEvent>.bizActions`.
2208
+ *
2209
+ * Single source of truth: `nodeRuleBindings` (the flat scan, kept) is derived
2210
+ * from this helper too, so "which event counts as a binding" has one predicate.
2211
+ * Unbound nodes carry no key (`--jq 'activities[].bizActions'` lists only bound
2212
+ * nodes; the fan-out receipt's missedEntries explains the rest).
2213
+ */
2214
+ function activityBizActions(activity) {
2215
+ const map = {};
2216
+ for (const nodeEvent of Object.keys(WORKFLOW_NODE_EVENT_HANDLER_FIELDS)) {
2217
+ const config = activity[nodeEvent];
2218
+ const codes = Array.isArray(config?.bizActions) ? config.bizActions.filter((value) => typeof value === "string") : [];
2219
+ if (codes.length > 0 && config?.bizActionType === "BIZ_RULE")
2220
+ map[nodeEvent] = codes;
2221
+ }
2222
+ return Object.keys(map).length > 0 ? map : undefined;
2223
+ }
2192
2224
  export function workflowCompactProjection(result) {
2193
2225
  const data = (result.data ?? null);
2194
2226
  if (data === null)
@@ -2218,6 +2250,12 @@ export function workflowCompactProjection(result) {
2218
2250
  const disabled = btns.filter((button) => button.enabled !== true).map((button) => String(button.code ?? ""));
2219
2251
  return { formButtons: { ...(enabled.length ? { enabled } : {}), ...(disabled.length ? { disabled } : {}) } };
2220
2252
  })(),
2253
+ // r79-09: node-level rule bindings, projected as bizActions:
2254
+ // {<nodeEvent>: [ruleCode]} (same helper that drives nodeRuleBindings below).
2255
+ ...(() => {
2256
+ const bizActions = activityBizActions(activity);
2257
+ return bizActions !== undefined ? { bizActions } : {};
2258
+ })(),
2221
2259
  }));
2222
2260
  const rules = data.rules;
2223
2261
  const edges = Array.isArray(rules)
@@ -2241,17 +2279,16 @@ export function workflowCompactProjection(result) {
2241
2279
  // Node-level bindings are invisible in the flow-level list above; surface the
2242
2280
  // non-empty ones so a `get_draft`/`get_published` readback can confirm a
2243
2281
  // `workflow.bindRule {activityCode,nodeEvent}` landing without `--full`.
2282
+ // r79-09: flat scan VIEW of activities[].bizActions (same helper/predicate) —
2283
+ // kept for "scan every node at once"; per-node reads should prefer the
2284
+ // projected `activities[].bizActions`.
2244
2285
  const nodeRuleBindings = [];
2245
2286
  for (const row of Object.values(activities)) {
2246
2287
  const activityCode = String(row?.activityCode ?? "");
2247
2288
  if (activityCode === "")
2248
2289
  continue;
2249
- for (const nodeEvent of Object.keys(WORKFLOW_NODE_EVENT_HANDLER_FIELDS)) {
2250
- const config = row[nodeEvent];
2251
- const codes = Array.isArray(config?.bizActions) ? config.bizActions.filter((value) => typeof value === "string") : [];
2252
- if (codes.length > 0 && config?.bizActionType === "BIZ_RULE")
2253
- nodeRuleBindings.push({ activityCode, nodeEvent, ruleCodes: codes });
2254
- }
2290
+ for (const [nodeEvent, ruleCodes] of Object.entries(activityBizActions(row) ?? {}))
2291
+ nodeRuleBindings.push({ activityCode, nodeEvent, ruleCodes });
2255
2292
  }
2256
2293
  const originate = data.originateActivity;
2257
2294
  // Count ALL propertyPermissions rows on the native template (including
@@ -2270,6 +2307,9 @@ export function workflowCompactProjection(result) {
2270
2307
  type: node.type,
2271
2308
  ...(node.participant !== undefined ? { participants: node.participant } : {}),
2272
2309
  ...(node.permissions !== undefined ? { propertyPermissions: node.permissions } : {}),
2310
+ // r79-09: mirror the same node-level bindings on the top-level projection —
2311
+ // `activities[].bizActions` is the literal path callers reach for (issue 09).
2312
+ ...(node.bizActions !== undefined ? { bizActions: node.bizActions } : {}),
2273
2313
  }));
2274
2314
  return {
2275
2315
  workflowSummary: {
package/dist/mcp-graph.js CHANGED
@@ -3,7 +3,7 @@ import { DatabaseSync } from "node:sqlite";
3
3
  import { readdirSync } from "node:fs";
4
4
  import { basename, join, resolve, sep } from "node:path";
5
5
  import { createInterface } from "node:readline";
6
- import { GRAPH_COVERAGE, GraphIndexError, graphRoot, impactGraph, listGraphIndexes, parseScopedFieldQuery, queryGraphReferences, readGraphStatus, resolveGraphDbPath, searchGraphRules, } from "./graph.js";
6
+ import { GRAPH_COVERAGE, GRAPH_NOT_INDEXED_GRANULARITIES, GraphIndexError, gapAffectsQuery, graphGapGuide, graphRoot, impactGraph, listGraphIndexes, parseScopedFieldQuery, queryGraphReferences, readGraphStatus, resolveGraphDbPath, searchGraphRules, } from "./graph.js";
7
7
  /**
8
8
  * Stdio MCP server for the local rule-graph index (ADR-0008).
9
9
  *
@@ -131,6 +131,7 @@ export const INSTRUCTIONS_INDEXED = [
131
131
  "- 每个索引的身份是「项目根 + 环境名」这一对:同一个项目可以同时建了 test/prod 等多份,同一环境也可以被多个项目各自 pull。所以 explore/status 用 project(目录名或绝对路径)+ env 指定;只给 env 时不唯一就会报歧义并列出可用环境。",
132
132
  "- query 可为业务名(实体 name+code 子串)、字段/模型/服务 code,或 `<schemaCode>.<字段code>`(同名字段精确消歧,如 crm_contract.contract_no)。",
133
133
  "- search 语义:只匹配规则 code+name 的**词首**(中文子串不命中:搜「预算」匹配不到「增加预算」)。",
134
+ "- 粒度边界:索引到 服务 code / 模型 / 字段,**不索引服务方法级**——按方法名/方法码查 0 命中≠没人调用(这种零命中答案带 granularityUnsupported,按 suggestion 逐条 rule.get 查 methodMapping);freshness=partial 时看 indexGaps 逐项的 affectsCurrentQuery(true=可能不完整,false=与本次查询面无关,null=无法判定,按保守解释视为可能影响)。",
134
135
  "答案带 environmentName/projectPath/dbId 与 freshness/pulledAtIso——索引是快照(平台侧改动后需 CLI 重建:omc graph pull --path <项目根> --env <env>,只读远端约 1 分钟),且多库并存时靠这三个字段自证归属。",
135
136
  ].join("\n");
136
137
  const INSTRUCTIONS_NO_INDEX = [
@@ -145,7 +146,9 @@ const EXPLORE_TOOL = {
145
146
  "输入 query 可为业务名(实体 name+code 子串)、规则 code+name 词首、字段/模型/服务 code,或 `<schemaCode>.<字段code>`(同名字段精确消歧,如 crm_contract.contract_no)。kind 可选 field|model|service,不给则三种都查。",
146
147
  "返回 {index(freshness), references:{kind:[{schemaCode,ruleCode,nodeCode,nodeType,via,referrer,isSelf}]}, impact:{kind:totals}, search:{matches:{model,field,service},rules}}。",
147
148
  "references/impact 支持 offset+limit 分页;truncated 时按返回的 nextOffset 继续调用。实体分页结果带 nextCall;分页不会改变 resolved。字段同名时用 schemaCode 参数或 <schemaCode>.<字段code> 写法消歧。",
148
- "覆盖对照(先验):在线面 `omc call rule.references` 实时但仅 businessrule、不含条件叶子;本索引是离线快照(businessrule 含条件叶子 rule.condition 边 + datarule + listview + form 控件 + workflow 条件/字段权限)——条件/表单/流程权限里的字段引用离线一次可答(workflow.bindings 与 onlinejs 仍未扫);freshness=partial 时命中可能不完整(答案里有 gapWarning)。",
149
+ "覆盖对照(先验):在线面 `omc call rule.references` 实时但仅 businessrule、不含条件叶子;本索引是离线快照(businessrule 含条件叶子 rule.condition 边 + datarule + listview + form 控件 + workflow 条件/字段权限)——条件/表单/流程权限里的字段引用离线一次可答(workflow.bindings 与 onlinejs 仍未扫);freshness=partial 时命中可能不完整(答案里有 gapWarning / indexGaps)。",
150
+ "粒度边界:索引只到 服务 code / 模型 / 字段(不索引服务**方法**级)。按方法名/方法码查 kind=service 时 0 命中只是「这一粒度没索引」,不是「没人调用」——这种零命中答案会带 granularityUnsupported(替代做法见其 suggestion),coverage.notIndexedGranularities 列出全部未索引粒度。",
151
+ "freshness=partial 时 indexGaps 逐项给中文说明、影响面与 affectsCurrentQuery(true=可能不完整;false=与本次查询面无关;null=无法判定,按保守解释视为可能影响)。",
149
152
  "改/删/重命名任何字段、模型、服务之前必查;找\"关于 X 的规则\"拿 code 也走这里。",
150
153
  ].join(" "),
151
154
  inputSchema: {
@@ -167,7 +170,7 @@ const EXPLORE_TOOL = {
167
170
  };
168
171
  const STATUS_TOOL = {
169
172
  name: "omc_graph_status",
170
- description: "索引完整性与新鲜度(所有身份与新鲜度字段同层):environmentName、projectPath、freshness(complete|partial)、模型/规则计数、pulledAtIso、ageMinutes、staleAfterMinutes、dbId、dbPath、otherIndexes(同项目其它环境)、coverage、gaps。超过阈值会给 warning;索引缺失/多份未指定会给出 pull 或选库指引。",
173
+ description: "索引完整性与新鲜度(所有身份与新鲜度字段同层):environmentName、projectPath、freshness(complete|partial)、模型/规则计数、pulledAtIso、ageMinutes、staleAfterMinutes、dbId、dbPath、otherIndexes(同项目其它环境)、coverage、gaps、gapDetails(逐条缺口的中文说明/影响面/重建命令)、notIndexedGranularities(未索引的查询粒度,如服务方法级——0 命中≠不存在)。超过阈值会给 warning;索引缺失/多份未指定会给出 pull 或选库指引。",
171
174
  inputSchema: {
172
175
  type: "object",
173
176
  properties: {
@@ -286,7 +289,9 @@ export async function executeGraphTool(name, rawArgs, context) {
286
289
  roots: registeredRoots(),
287
290
  count: projects.reduce((sum, project) => sum + project.indexes.length, 0),
288
291
  projects,
289
- note: "查询时把 project(项目根或目录名)与 env(环境名)一起传给 omc_graph_explore / omc_graph_status;省略 env 要求该项目根下只有一份索引。",
292
+ // issue 07 验收:项目清单也要能读到粒度边界(不是只有 explore/status 才说)。
293
+ methodLevelIndexed: false,
294
+ note: "查询时把 project(项目根或目录名)与 env(环境名)一起传给 omc_graph_explore / omc_graph_status;省略 env 要求该项目根下只有一份索引。索引不覆盖服务方法级(methodLevelIndexed:false)——按方法名 0 命中≠没人调用,用 omc_graph_status 的 notIndexedGranularities 看替代做法。",
290
295
  ...(projects.length === 0 ? { nextCommand: "omc graph pull --path <项目根> --env <环境名>" } : {}),
291
296
  });
292
297
  }
@@ -426,6 +431,38 @@ export async function executeGraphTool(name, rawArgs, context) {
426
431
  const entityTruncated = Object.values(search.matches).some((match) => match.truncated === true);
427
432
  const nextCall = entityTruncated ? Object.fromEntries(Object.entries(search.matches).filter(([, m]) => m.truncated).map(([k, m]) => [k, { query, kind: k, offset: m.nextOffset, limit }])) : undefined;
428
433
  const paginationNote = entityTruncated ? `\n结果已截断:请使用 nextCall 中对应调用继续。` : "";
434
+ // issue 07(2026-11-18 真机摩擦):零命中 ≠ 无引用。索引只到服务 code,
435
+ // 业务规则里的 methodMapping.serviceMethodCode(addOrderLedger 之流)不建边——
436
+ // 探针曾据 0 命中差点判「没人调用、可删」。零实体命中时显式说清粒度边界,
437
+ // 有实体命中时不出现(不污染正常答案)。
438
+ const methodGranularity = GRAPH_NOT_INDEXED_GRANULARITIES.find((item) => item.face === "service.method");
439
+ const granularityUnsupported = noEntityHit
440
+ ? {
441
+ methodLevelIndexed: false,
442
+ reason: `0 ≠ 无引用:${methodGranularity?.zh ?? "索引不覆盖服务方法级(methodMapping.serviceMethodCode)"}`,
443
+ suggestion: methodGranularity?.how ?? "先 omc call rule.list 拿规则清单,再逐条 omc call rule.get 查 methodMapping.serviceMethodCode",
444
+ }
445
+ : undefined;
446
+ // issue 10(2026-11-18 真机摩擦):partial 索引只给 { "datarule-list": 1 } 时,
447
+ // agent 无法判断「这次答案是否受影响」,只能保守放弃图谱。逐项给中文说明 +
448
+ // 影响面 + affectsCurrentQuery(三值:true/false/null=无法判定,保守视为可能影响)。
449
+ const gapKinds = Object.entries(index.gaps.byKind).sort(([a], [b]) => a.localeCompare(b));
450
+ const relevanceKinds = [...new Set([...kinds, ...(resolvedEntity ? [resolvedEntity.kind] : [])])];
451
+ const indexGaps = gapKinds.map(([kind, count]) => {
452
+ const guide = graphGapGuide(kind);
453
+ const refs = [...new Set(status.gapDetails.filter((row) => row.kind === kind).map((row) => row.ref))];
454
+ return {
455
+ kind,
456
+ count,
457
+ ...(refs.length > 0 ? { refs: refs.slice(0, 5) } : {}),
458
+ zh: guide.zh,
459
+ affects: guide.affects,
460
+ affectsCurrentQuery: gapAffectsQuery(kind, relevanceKinds),
461
+ };
462
+ });
463
+ const indexGapsNote = indexGaps.length === 0
464
+ ? undefined
465
+ : `索引 freshness:"${index.freshness}",有 ${index.gaps.count} 个扫描缺口(${gapKinds.map(([kind, count]) => `${kind}:${count}`).join(", ")})。affectsCurrentQuery 是对本次 references/impact 命中面的判定:true=可能让本次答案不完整;false=与本次查询面无关(仍如实列出,不隐藏);null=无法判定,按保守解释视为可能影响——给结论加完整性限定,或 \`omc graph pull --path <项目根> --env <env>\` 重建后重查。gapDetails/indexGaps 的中文说明就是判定依据;search 的实体候选面另见 gapDetails.affects。`;
429
466
  return toolResult({
430
467
  status: "ok",
431
468
  query,
@@ -445,6 +482,8 @@ export async function executeGraphTool(name, rawArgs, context) {
445
482
  ...(nextCall ? { nextCall } : {}),
446
483
  ...(noEntityHit && composite ? { unsupportedQuerySyntax: true, hint: "组合检索暂不支持,请拆词单查后求交" } : {}),
447
484
  ...(noEntityHit ? { suggestions: suggestions(query, selector), hint: "可尝试 suggestions 中的实体 code/name;引用明细请使用匹配 code 查 references/impact" } : {}),
485
+ ...(granularityUnsupported ? { granularityUnsupported } : {}),
486
+ ...(indexGapsNote ? { indexGaps, indexGapsNote } : {}),
448
487
  searchNote: `${searchNote}${paginationNote}${queries.length > 1 ? " 规则面(词首匹配)不参与 queries[] 的实体求交。" : ""}`,
449
488
  ...(search.note ? { searchNote: `${searchNote}\n${search.note}` } : {}),
450
489
  // r72g:不再手抄 scanned/notScanned 清单——三个消费面(CLI references /
@@ -8,6 +8,32 @@ import { closestMatch } from "./closest-match.js";
8
8
  * 报「不支持」——别让调用方以为键不存在。
9
9
  */
10
10
  export const UNSUPPORTED_JQ_OBJECT_HINT = "--jq 不是 jq:投影 DSL 不支持对象构造 `{a,b}`;单列请写 `.x[].a`,多列用逗号分隔(--jq \".x[].a,.x[].b\")或重复传 --jq";
11
+ /**
12
+ * `|` 只在路径层才是 jq 管道;选择器值里的竖线(`rules[name=A|B]`)是数据。
13
+ * 手写扫描而非正则:需要跳过引号与方括号内的内容。
14
+ */
15
+ function hasTopLevelPipe(path) {
16
+ let depth = 0;
17
+ let quote;
18
+ for (const char of path) {
19
+ if (quote !== undefined) {
20
+ if (char === quote)
21
+ quote = undefined;
22
+ continue;
23
+ }
24
+ if (char === '"' || char === "'") {
25
+ quote = char;
26
+ continue;
27
+ }
28
+ if (char === "[")
29
+ depth += 1;
30
+ else if (char === "]")
31
+ depth = Math.max(0, depth - 1);
32
+ else if (char === "|" && depth === 0)
33
+ return true;
34
+ }
35
+ return false;
36
+ }
11
37
  export function detectUnsupportedJqSyntax(path) {
12
38
  if (/[{}]/.test(path))
13
39
  return UNSUPPORTED_JQ_OBJECT_HINT;
@@ -17,6 +43,13 @@ export function detectUnsupportedJqSyntax(path) {
17
43
  if (/\[\s*\?/.test(path)) {
18
44
  return "投影 DSL 不支持 jq 过滤表达式 `[?(@...)]`;等价写法是按字段选择 `rules[code=Create]`(返回第一个匹配项),或先 `--jq rules[]` 全取再由脚本筛";
19
45
  }
46
+ // issue 2026-11-18 §05:`|` 是 jq 的管道,不是路径段。此前它被当成键名的一部分
47
+ // 去行走,最后报 pathMiss(available=键列表)——读起来像「键写错了」,实际是
48
+ // 「这个参数不支持管道」。明确说清,并给本 DSL 的等价写法。
49
+ // 只认**路径层**的 `|`:`rules[name=A|B]` 里选择器值内出现竖线不算管道。
50
+ if (hasTopLevelPipe(path)) {
51
+ return "投影 DSL 不支持管道 `|`;--jq 是路径选择器,不是 jq 表达式(`--jq '.result | keys'` 这类写法无效)。等价写法:一次取多列用逗号分隔 `--jq 'a.b,c.d'`,或重复传 --jq;按键选择用 `rules[code=Create]`";
52
+ }
20
53
  // 函数调用:`map(` / `select(` 等(选择器 `[code=X]` 不含 `(`)。
21
54
  if (/\w+\s*\(/.test(path))
22
55
  return "投影 DSL 不支持函数调用;只做路径选择(点式 / [] 映射 / [key=value]),详见 omc help omc-refusals --section 10";
@@ -712,4 +745,24 @@ export function projectResultExtract(result, paths, keysOnly) {
712
745
  }
713
746
  return out;
714
747
  }
748
+ const SINGLE_PATH_META_KEYS = ["from", "artifactId", "sha256", "truncated", "truncatedKeys", "itemsCount", "total", "projectionHint"];
749
+ const SINGLE_PATH_ENTRY_META_KEYS = ["mapped", "nullEntries", "missedEntries", "from", "autoStripped", "hint"];
750
+ export function unwrapSinglePathProjection(projected) {
751
+ const extracts = projected.extract;
752
+ if (!Array.isArray(extracts) || extracts.length !== 1)
753
+ return undefined;
754
+ const entry = extracts[0];
755
+ if (entry.pathMiss === true || entry.unsupportedSyntax === true)
756
+ return undefined;
757
+ const resultMeta = { path: entry.path };
758
+ for (const key of SINGLE_PATH_META_KEYS) {
759
+ if (projected[key] !== undefined)
760
+ resultMeta[key] = projected[key];
761
+ }
762
+ for (const key of SINGLE_PATH_ENTRY_META_KEYS) {
763
+ if (entry[key] !== undefined)
764
+ resultMeta[key] = entry[key];
765
+ }
766
+ return { result: entry.content ?? null, resultMeta };
767
+ }
715
768
  //# sourceMappingURL=path-projection.js.map
@@ -118,12 +118,12 @@ const READ_SHAPES = {
118
118
  // artifact get --shape 先看骨架再 --jq)。published/draft 两面同形,仅 templateType
119
119
  // 与 published 键不同。
120
120
  "workflow.get_published": {
121
- keys: ["status", "workflowCode", "exists", "published", "workflowSummary:{workflowCode,templateType,activities:array<{index,code,type,name}>,edges:array<{from,to}>,ruleBindings:array<{...}>,ruleBindingCount,originateActivity:{code,type,name,participant}}", "activities:array<{code,name,type}>(投影)", "propertyPermissionsCount", "version", "summaryHint", "truncatedKeys?", "omittedKeys?", "truncated?", "data?(外置时 null,完整模板在 detailArtifactId)", "omittedShape?", "omittedNote?", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
122
- notes: ["顶层 activities[] 是投影 {code,name,type};完整模板在 data(外置 detailArtifactId),深层活动名是 data.activities[].activityName(与顶层投影的 name 同义、键名不同)"],
121
+ keys: ["status", "workflowCode", "exists", "published", "workflowSummary:{workflowCode,templateType,activities:array<{index,code,type,name,bizActions?:{<nodeEvent>:[ruleCode]}}>,edges:array<{from,to}>,ruleBindings:array<{...}>,ruleBindingCount,originateActivity:{code,type,name,participant}}", "activities:array<{code,name,type,bizActions?}>(投影)", "propertyPermissionsCount", "version", "summaryHint", "truncatedKeys?", "omittedKeys?", "truncated?", "data?(外置时 null,完整模板在 detailArtifactId)", "omittedShape?", "omittedNote?", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
122
+ notes: ["节点绑定看 activities[].bizActions(默认 summary 已含,无绑定则键缺席);完整模板在 data(外置 detailArtifactId),要深层字段时投影写到叶子(如 --jq 'data.activities[].bizActions')——写整棵父节点会因总量超限再次被外置"],
123
123
  },
124
124
  "workflow.get_draft": {
125
- keys: ["status", "workflowCode", "exists", "workflowSummary:{workflowCode,templateType,activities:array<{index,code,type,name}>,edges:array<{from,to}>,ruleBindings:array<{...}>,ruleBindingCount,originateActivity:{code,type,name,participant}}", "activities:array<{code,name,type}>(投影)", "propertyPermissionsCount", "version", "summaryHint", "truncatedKeys?", "omittedKeys?", "truncated?", "data?(外置时 null,完整模板在 detailArtifactId)", "omittedShape?", "omittedNote?", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
126
- notes: ["与 workflow.get_published 同形(少了 published 键);templateType=DRAFT;完整模板同样在 data/detailArtifactId"],
125
+ keys: ["status", "workflowCode", "exists", "workflowSummary:{workflowCode,templateType,activities:array<{index,code,type,name,bizActions?:{<nodeEvent>:[ruleCode]}}>,edges:array<{from,to}>,ruleBindings:array<{...}>,ruleBindingCount,originateActivity:{code,type,name,participant}}", "activities:array<{code,name,type,bizActions?}>(投影)", "propertyPermissionsCount", "version", "summaryHint", "truncatedKeys?", "omittedKeys?", "truncated?", "data?(外置时 null,完整模板在 detailArtifactId)", "omittedShape?", "omittedNote?", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
126
+ notes: ["与 workflow.get_published 同形(少了 published 键);节点绑定看 activities[].bizActions;templateType=DRAFT;深层字段投影写到叶子,完整模板在 data/detailArtifactId"],
127
127
  },
128
128
  "rule.list": {
129
129
  keys: ["rules:array<{code,name,enabled,status}>", "modelPresent", "source", "executableHint"],
@@ -150,8 +150,11 @@ const READ_SHAPES = {
150
150
  // service.get,分插各自族附近);键集全部来自真机回执采样(非手写发明),
151
151
  // returnsFace 只显 notes[0],高频陷阱并进首条。
152
152
  "rule.get": {
153
- keys: ["status", "id", "absent", "code", "name", "schemaCode", "bizRuleType", "enabled", "executable", "executableBasis", "ruleStatus", "defaultRule", "developmentMode", "ruleVersion", "templateType", "nodes:array<{nodeCode,nodeName,nodeType,nodeCategory?,inputParam?,methodMapping:{schemaCode,serviceCode,serviceMethodCode,inputMappings[],outputMappings[],serviceName,serviceMethodName},serviceType?}>", "routes:array<{preNode,postNode,routeCondition,matchType}>", "schedulerSetting?", "renderCompat", "semanticFindings?", "roundTrip", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
154
- notes: ["绑定的服务方法在 nodes[].methodMapping.serviceCode/serviceMethodCode(三层深,不在顶层;BIZ_ACTION 节点才有 methodMapping)", "入参 ruleCode 对应本面返回的 code;enabled 是开关推断,可执行性看 executable/executableBasis"],
153
+ keys: ["status", "id", "absent", "code", "name", "schemaCode", "bizRuleType", "enabled", "executable", "executableBasis", "ruleStatus", "defaultRule", "developmentMode", "ruleVersion", "templateType", "nodes:array<{nodeCode,nodeName,nodeType,nodeCategory?,inputParam?,methodMapping:{schemaCode,serviceCode,serviceMethodCode,inputMappings[],outputMappings[],serviceName,serviceMethodName},serviceType?}>", "routes:array<{preNode,postNode,routeCondition,matchType}>", "schedulerSetting?", "renderCompat", "semanticFindings?", "roundTrip", "nodeDigests?:array<{nodeCode,nodeType,methodMapping:{serviceCode,serviceMethodCode}}>(summary)", "methodMappingCount?(summary)", "bytesOmitted?(summary)", "rules?:array<摘要体>(ruleCodes 批量)", "rulesCount?/requestedCount?/partial?/failed?:array<{code,reason}>(批量)", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
154
+ notes: [
155
+ "绑定方法:默认面看 nodes[].methodMapping.serviceCode/serviceMethodCode(三层深);扫多规则/多模型用 summary:true + ruleCodes[](同 schemaCode,1 次 list/wire 模型)——摘要键是 nodeDigests,不是 nodes(nodes 只在默认面)",
156
+ "入参 ruleCode 对应本面返回的 code;enabled 是开关推断,可执行性看 executable/executableBasis;批量面的 failed 是**数组**,所以信封仍是 status:ok + partial:true(不是 partial 状态)",
157
+ ],
155
158
  },
156
159
  "datarule.list": {
157
160
  keys: ["rules:array<{id,propertyCode,dataRuleType,checkType,optionsKeys?}>", "rulesCount", "modelPresent", "rulesOmitted?"],
@@ -167,6 +170,13 @@ const READ_SHAPES = {
167
170
  "表单按钮读 formButtonCodes/formButtons;full:true 另带 customButtonJson 数组原样(库里是字符串脏形时给 customButtonJsonShapeWarning——线上 #38 前端按钮不渲染,重写 buttons 自愈)",
168
171
  ],
169
172
  },
173
+ // r79-w2b(issue 06):多表单模型的 sheetCode 清单面。
174
+ "form.list": {
175
+ keys: ["status", "schemaCode", "modelPresent", "count", "sheets:array<{sheetCode,name,formType,formTypeIndex,published}>", "defaultSheetCode", "defaultSheetBasis", "facesNote", "emptyNote", "sheetListUnavailable?", "duplicateRows?/duplicateSheetCodes?", "partial?/omittedSheets?/readFailures?", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
176
+ notes: [
177
+ "入参 schemaCode,出参 sheets[].sheetCode——多表单模型的 sheetCode 从这里取;默认面只有平台旗标 published(不改写),判「有没有发布面内容」用 detail:true 的 faces(+N wire,默认 1 wire 不伪造 existDraft/buttonCount)",
178
+ ],
179
+ },
170
180
  // r75 调查C(真机采样 2026-11-18):r74 探针在同一循环里猜 sourceCode miss ×5。
171
181
  "onlinejs.get": {
172
182
  keys: ["status", "schemaCode", "sheetCode", "present", "sheetPublished", "draftPublishedInSync", "scriptSha256", "hint", "draft:{present,script,sha256,elementCount,scriptSha256}", "published:{present,script,sha256,elementCount,scriptSha256}", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
@@ -198,6 +208,11 @@ const READ_SHAPES = {
198
208
  keys: ["status", "serviceCode", "present", "adapterCode", "methodsError?", "service:{keys[],sha256?,omitted?}", "methods:array<{code,name,serviceCode,configJson,inputParameters,outputParameters}>", "methodsCount", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
199
209
  notes: ["方法参数面在 methods[].inputParameters/outputParameters(内联);service.keys 只是服务记录的键名表,服务本体在 detailArtifactId"],
200
210
  },
211
+ // r79-w2b(issue 06):方法清单面——一次 list 拿全部 url(不再 N 次 method.get)。
212
+ "method.list": {
213
+ keys: ["status", "serviceCode", "adapterCode", "present", "methodsCount", "columnNote", "referencedNote", "methods:array<{code,name,url,httpType,requestBodyType,inParams,outParams,configKeys}>", "keyword?/totalBeforeFilter?", "methodsOmitted?/omittedMethods?", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
214
+ notes: ["url 恒在(configJson.url;DATA_SQL/DATA_TABLE/SAP/KAFKA/INTERNAL 回 null,不是缺键)——name 是人工显示名,语义可能与 url 相反,判「打到哪个接口」只认 url;detail:true 把 inParams/outParams 从计数换成参数 code 数组(0 额外 wire)"],
215
+ },
201
216
  "service.adapter_config": {
202
217
  // r28f F5:顶栏 adapterCodes 摘要;compact:true 只回 code/name/description。
203
218
  keys: ["adapterCodes", "adapters:array<{code,name,config?...}>", "rawPresent"],
@@ -483,7 +483,7 @@ const ruleBizactionInvokeService = Object.freeze({
483
483
  "**系统节点由工具注入**——本 recipe 只写 Start→BIZ_ACTION→End;工具注入 SYSTEM_CREATE 并排在 BIZ_ACTION 之后(ASSIGN/BIZ_ACTION 必须在系统节点前)。",
484
484
  "methodMapping 必带 serviceName/serviceMethodName/methodCode(缺则 40000,#38 实证)",
485
485
  "**出参回写三前提(r28b 8 组实验定案,缺一出参恒 null 且节点日志仍 successful)**:① 响应 JSON 根级平铺出参键(信封嵌套如 {data:{...}} 静默不回写)② 挂预置 Create/Update 规则上下文(自定义规则/rule.run 不回写业务字段)③ 用 data.submit/data.update 触发(data.save 存草稿不触发)。回写是否成功只认 data.load 读字段,不认调用日志。",
486
- "codeType:1 = 映射模型字段(bizCode=字段 code);codeType:0 = 常量(bizCode=常量值);serviceMethodParameterCode 必须与方法声明的参数 code 逐字一致",
486
+ "**入参三选一**:常量 `codeType:0`(bizCode=字面量)/字段 `codeType:1`(bizCode=源字段 code)/**计算规则 `codeType:7`**(bizCode=JSON 字符串 `{\"formula\":\"{amount}*0.13\"}`,按 JSON.parse(bizCode).formula 求值;**不是 expressionValue**——写成独立字段真机 BIZ_ACTION 必 EXCEPTION,r79 1.1.25 echo 实证 qty=3/price=7→21.00;缺/空/非 JSON/无 formula 拒 `rule-graph-bizaction-expression-missing`);serviceMethodParameterCode 必须与方法声明的参数 code 逐字一致",
487
487
  "**接口响应必须在 JSON 根级**返回与出参 code 同名的键——嵌套在信封里(如 {data:{level}})会静默映射不上(p7 实测;r28b 8 组实验全因信封端点失败,换平铺端点后 4 组一次全过)",
488
488
  "**平台自调自己(127.0.0.1)会被运行时鉴权拦**:errcode 500012「绑定的API需要提供正确的身份验证或凭据」——需要带出站凭据的真实外部服务,或服务端配置鉴权放行;这不是 BIZ_ACTION 不支持(p7 定案)",
489
489
  "BIZ_ACTION 放在 SYSTEM_CREATE **之前**(与自更新 UPDATE 相反:ASSIGN/BIZ_ACTION 在系统节点前,UPDATE 在系统节点后)",
@@ -496,6 +496,7 @@ const ruleBizactionInvokeService = Object.freeze({
496
496
  refusalRecovery: [
497
497
  { code: "rule-graph-bizmethod-unresolved", action: "serviceCode/serviceMethodCode 必须是已注册服务(service.list);方法级详情 service.get" },
498
498
  { code: "rule-graph-bizaction-mapping-field-missing", action: "inputMappings 的 bizCode 必须是本模型已发布字段 code(field.list 核对)" },
499
+ { code: "rule-graph-bizaction-expression-missing", action: "codeType:7(EXPRESSION) 入参的计算规则放 bizCode(JSON 字符串,如 '{\"formula\":\"{amount}*0.13\"}'),不是 expressionValue" },
499
500
  ...commonRecovery,
500
501
  ],
501
502
  notes: "p7 实测链(sandbox-r19/.scratch/report-p7.md §4):注册查询服务 → 本配方建 Create 规则 → rule.enable → 提交触发。运行期若 500012 见 conditionalRequirements 第 3 条(出站凭据边界)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.6.74",
3
+ "version": "0.6.75",
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.74",
59
+ "omc-core": "0.6.75",
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.74"
77
+ "@stalfh233/omc-fake-platform": "0.6.75"
78
78
  }
79
79
  }
@@ -108,7 +108,7 @@ only the section for the capability you need —
108
108
  ## 默认表单 `form`
109
109
 
110
110
  - **能做哪些事**:表单 draft-first 布局、发布、`publishedHtmlJson` 绑定读回;把已发布字段绑进默认表单;**表单工具栏按钮**(`options.customButtonJson` → publish 生成 FORM 按钮)与按钮执行。
111
- - **工具**:`form.get`、`form.draft`、`form.publish`、`configure_form`、`form.runButton`
111
+ - **工具**:`form.list`、`form.get`、`form.draft`、`form.publish`、`configure_form`、`form.runButton`
112
112
  - **按钮脚本(JS)读写**:`form.get --buttonScripts` 回 `scriptData`/sha;写用 `form.publish --buttonScripts [{code,script}]`(只改已有按钮脚本),或在 `buttons[]` 里给 `script`。**视图(列表)本身没有 JS 面**(`h_biz_query` 无脚本列);脚本只有三处:表单在线JS、按钮JS、自定义页面 JS。
113
113
  - **recipe**:`omc describe configure_form --example publish-default-form`
114
114
  - **边界 / 陷阱**:默认表单已存在,用 `configure_form`/`form.draft(rebuild)`/`form.publish(rebuild:true)` 改它,不要新建;改字段形状后刷新表单一调用 `form.publish rebuild:true`。
@@ -189,7 +189,7 @@ only the section for the capability you need —
189
189
  ## 业务集成 `bizservice`
190
190
 
191
191
  - **能做哪些事**:业务服务与方法注册(RESTFUL/DATA_SQL/DATA_TABLE/SAP/KAFKA/SOAP)、服务清单(按分类/关键词,凭据不回显)、方法增改删、分类/连接池、导入导出、设计器测试。
192
- - **工具**:`service.list`、`service.get`、`method.get`、`method.update`、`method.create`、`method.delete`、`service.category.list`、`service.category.create`、`service.category.update`、`service.category.delete`、`service.dbconnpool.list`、`service.dbconnpool.create`、`service.dbconnpool.update`、`service.dbconnpool.delete`、`service.adapter_config`、`service.table_list`、`service.table_sql`、`service.register`、`service.update`、`service.delete`、`service.export`、`service.check`、`service.import`、`method.test`
192
+ - **工具**:`service.list`、`service.get`、`method.list`、`method.get`、`method.update`、`method.create`、`method.delete`、`service.category.list`、`service.category.create`、`service.category.update`、`service.category.delete`、`service.dbconnpool.list`、`service.dbconnpool.create`、`service.dbconnpool.update`、`service.dbconnpool.delete`、`service.adapter_config`、`service.table_list`、`service.table_sql`、`service.register`、`service.update`、`service.delete`、`service.export`、`service.check`、`service.import`、`method.test`
193
193
  - **recipe**:`omc describe service.register --example restful-query-service`
194
194
  - **边界 / 陷阱**:方法 `configJson` 走 AES-128-ECB;**二开接口 = 扩展模块写 REST 接口 + RESTFUL 服务指向它**(页面/规则引用);RESTFUL/DATA_SQL 绑定前须带适配器必需配置(否则是注册壳)。
195
195
 
@@ -113,7 +113,9 @@ omc call field.publish --env local --args '{"schemaCode":"expense"}'
113
113
 
114
114
  ## 写调用纪律
115
115
 
116
- - **同一 `<env>` 的写调用必须串行发起**:`write-lock-held` 不只在"并行重放失败请求"时出现,也会在**并行发起两个无关写**时触发(实测:并行两条 `dictionary.save`、并行 `field.update`+`field.publish` 各失败一次)。读可并行,写不要。确实要并发进程时用 `--wait <ms>`(`omc call` / `omc intent apply` 都支持)让 CLI 内部排队,别把重试循环写在 shell 里。并发语义总表(写锁 / 同记录 patch / `version` 非乐观锁 / 翻页无快照 / 删除幂等)见 `omc help concurrency`。
116
+ - **PowerShell 的 `--args`**:不能照抄 POSIX 单引号;非法 JSON = exit 10、零请求。改用 `--args-file '<配置根>/args.json'` 或 `--args -`(stdin)。
117
+
118
+ - **同一 `<env>` 的写调用必须串行发起**:`write-lock-held` 不只在"并行重放失败请求"时出现,也会在**并行发起两个无关写**时触发(实测:并行两条无关写各失败一次)。读可并行,写不要。并发用 `--wait <ms>` 让 CLI 排队,别在 shell 里重试。并发语义(写锁/patch/翻页/删除幂等)见 `omc help concurrency`。
117
119
  - **`data.delete` 批量形态 1.1.25 假成功**(r30 2026-10-31 真机):`bizObjectIds` 数组回 `DELIVERED`+`absent:true`+`modelResidue.total` 递减但行仍在——OMC 已写前拒绝 `data-delete-batch-fake-success`。纪律不变:删除后用 `data.load exists:false`(或重查 `total`)复核,`absent:true` 不是删除成功的证明。
118
120
 
119
121
  ## 审批提交的真实形状(r18b 2026-10-26 真机,1.1.25)