@stalfh233/omc-cli 0.6.79 → 0.6.81

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.
@@ -155,6 +155,10 @@ export const FIELD_LANE_CONTRACT = Object.freeze({
155
155
  publishScope: "model",
156
156
  controlEmissionPolicy: "ticket 101: controls PHONE(24)/PHOTO(10) are blocked for creation (no BizPropertyType maps to them — BizPropertyType.java:27-54); Tab(500) is a layout container (DataModelInitUtils.java:61-75 recurses panels, never a field); CreatedDeptId(102) is a system-field projection (DefaultPropertyType.java:18-21 → DEPARTMENT_SELECTOR 60, BizMainSystemPropertyRegistry.java:88-101); the scaffold SKIPS any field type without a control mapping — unknown/blocked control types are never auto-created (fail-closed)",
157
157
  fieldRowDefaultPolicy: "ticket 108 determination (live 8.6.26 write+read 2026-09-15 + fwb 8.6.39 readback): the 2026-09-14 key unions are MULTI-FIELD UNIONS of designer rows, not per-field required keys — the platform accepts-and-persists minimal rows, so the minimal default + caller passthrough is the INTENTIONAL boundary. Selection families 12/13/14/15 MUST-FIXED to omit dictionaryData (designer rows carry none; live proves the platform merely accepts the extra key — omc_mcp_t108dd readback carried it only because we sent it). Families 0/1/2/9/11/17 keep the designer-carried {dictionaryData:\"\"}; DATE(3) keeps required format (BizObjectFacadeImpl.java:2949); ATTACHMENT(6) stays intentionally empty (system rows often have no options)",
158
+ orgSelectorFieldRowOptions: "org-selector families STAFF_SELECTOR / STAFF_MULTI_SELECTOR / DEPARTMENT_SELECTOR / DEPARTMENT_MULTI_SELECTOR (5/50/51/60/61): the field-row options are a publish-safe shape observed on the yst/fwb publish face (2656 rows) — null or {defaultValue, mappings, virtualField[, noRepeat]}; single-select defaultValue \"\" and multi-select []; deptVisible/multi are FORM-CONTROL discriminator keys (read from control.options via disposeUpdateType/updateSelectionType) and never appear on the field row",
159
+ relationMappingsSource: "the field row's options.mappings is the source of truth for relation carry-through; editing a form control's mappings is recomputed from the field and does not survive readback (live 2026-10-14 中冶). Update chain: field.update with the full options (change only mappings, keep queryCode/displayField/schemaCode/conditions… as-is) → field.publish → form.draft rebuild:false (keeps the existing layout and any online JS) → form.publish → readback. Do NOT use cascadeRepublish on a form that already carries a custom layout or online JS — it re-scaffolds the default form",
160
+ propertyEmptyReadback: "propertyEmpty overrides the data-model not-null declaration; false reopens a field the platform previously created wrongly (required/readonly belong to the form and workflow nodes). bizproperty/list rows do NOT carry propertyEmpty, so readback.propertyEmpty appears only when the draft face returns it — the CLI never fabricates it; readback.committed lists what actually went on the wire",
161
+ listFace: "field.list default face inlines code/name/type(+typeName)/conditions signal/shapeWarning only; the whole choices package is not inlined (a selection field measured ~500B/row) — verify options/subSchema with the code/fields selectors or full:true",
158
162
  }),
159
163
  wireBindings: Object.freeze({
160
164
  acceptedFamilies: Object.freeze([emitterBinding("lanes/field-contract.FIELD_FAMILY_LIST", assertFieldContract)]),
@@ -170,6 +174,10 @@ export const FIELD_LANE_CONTRACT = Object.freeze({
170
174
  publishScope: Object.freeze([behaviorBinding("test/field-publish-batch.test.ts#field.publish batch: a single call publishes every draft field", assertFieldContract)]),
171
175
  controlEmissionPolicy: Object.freeze([behaviorBinding("test/ticket-101-control-coverage.test.ts#controls 24 (PHONE) and 10 (PHOTO) are declared blocked", assertFieldContract)]),
172
176
  fieldRowDefaultPolicy: Object.freeze([behaviorBinding("test/ticket-108-field-row-defaults.test.ts#intentional minimal defaults are pinned per the determination table", assertFieldContract)]),
177
+ orgSelectorFieldRowOptions: Object.freeze([behaviorBinding("test/ticket-79-staff-selector-publish.test.ts#ticket 79: field.create STAFF_SELECTOR emits the observed publish-safe field-row shape", assertFieldContract)]),
178
+ relationMappingsSource: Object.freeze([behaviorBinding("test/form-scaffold.test.ts#form.draft propagates relation mappings into an existing draft", assertFieldContract)]),
179
+ propertyEmptyReadback: Object.freeze([behaviorBinding("test/field-property-empty-readback.test.ts#field.update reports committed and unverifiable write-only propertyEmpty", assertFieldContract)]),
180
+ listFace: Object.freeze([behaviorBinding("test/field-property-empty-readback.test.ts#field.list --full omits propertyEmpty when the platform row omits it", assertFieldContract)]),
173
181
  }),
174
182
  evidence: Object.freeze([
175
183
  "ticket 01-3 (2026-09-11): a DATE(3) field created without options.format 50000s on the first runtime save",
@@ -183,41 +191,42 @@ export const FIELD_LANE_CONTRACT = Object.freeze({
183
191
  "ticket 24 live (2026-09-12): FORMULA options readback + RELEVANCE_DATA create/publish/form-binding readback",
184
192
  "ticket 61 source (8.6.26): the runtime list face resolves a relation's displayed value from the field ROW's top-level relativePropertyCode, not options.displayField — QueryRuntimeController.java:1214-1226 (getRelativePropertyCode; empty → \"name\" data title); BizPropertyController create/update :851/:987 never auto-fill it, so every relation create/update must carry it",
185
193
  "capability-shape-spec.md: field-row and form-control options are declared once with required keys, defaults, and evidence; LOGICAL/ATTACHMENT/ADDRESS/HYPER_LINK/TIME are completed",
194
+ "ticket 79: DDL-intermediate transient retries (≤3, backoff 2s/5s) on a small-resource environment; after a failure wait ≥30s before retrying and never re-create the field",
186
195
  ]),
187
196
  tools: Object.freeze({
188
197
  "field.list": Object.freeze({
189
198
  scope: "create publish readback",
190
- description: "List draft/published fields of a model. 默认清单面:code/name/type(+typeName)/conditions 信号/shapeWarning——选项族整包 choices 不内联(实测选择字段 ~500B/行);验证 options/subSchema 用 code/fields 选择器或 full:true(readback face of the field family chain)。",
199
+ description: "List draft/published fields of a model. 默认面紧凑(整包 choices 不内联);验证 options/subSchema 用 code/fields 选择器或 full:true。",
191
200
  }),
192
201
  "field.create": Object.freeze({
193
202
  scope: "create publish readback",
194
203
  description: describeTool("Create a draft field on a model (bizproperty/create).", [
195
204
  "Field type must be one of the live-accepted families; nested child tables and OCR/ELECTRONIC_SIGN are out of coverage.",
196
205
  `Reserved/system codes are refused (code_reserved): ${[...RESERVED_CODES].join(", ")} — pick a business code (e.g. owner → taskOwner).`,
197
- "**mapping 类型兼容**(三层口径 r52):①拦截依据=设计器 `filterCondition`:长文本←长文本/短文本(单向);短文本/下拉/单选←同族;复选框/下拉多选←同族;**其余必须同型**。违反→`mapping-type-incompatible`。②设计器只过滤下拉:保存不复核、平台 `checkOptions` 缺 WORK_SHEET、运行期直接 put——绕过设计器可写违规组合。③后果:50000 或**静默损坏**(`→LOGICAL` 恒 false、`NUMERICAL→DATE` 丢 null、文本→人员/关联=悬空 id、多值→单选串进单值列、`→COMMENT/OCR/SIGN/RELEVANCE_DATA` 不落库)。④映射只在关联单选建记录时生效;`data.save/submit` 不跑映射。",
206
+ "**mapping 类型兼容**(三层口径):①拦截依据=设计器 `filterCondition`:长文本←长文本/短文本(单向);短文本/下拉/单选←同族;复选框/下拉多选←同族;**其余必须同型**。违反→`mapping-type-incompatible`。②设计器只过滤下拉:保存不复核、平台 `checkOptions` 缺 WORK_SHEET、运行期直接 put——绕过设计器可写违规组合。③后果:50000 或**静默损坏**(`→LOGICAL` 恒 false、`NUMERICAL→DATE` 丢 null、文本→人员/关联=悬空 id、多值→单选串进单值列、`→COMMENT/OCR/SIGN/RELEVANCE_DATA` 不落库)。④映射只在关联单选建记录时生效;`data.save/submit` 不跑映射。",
198
207
  "For single/multi-select pass `choices` (e.g. [\"A\",\"B\",\"C\"]) or `options.optionsSet` with optionsType custom/dictionary/businessModel; dictionary uses checkedDictionary/checkedDictionaryCode, businessModel uses schemaCode/sheetDataItem.",
199
208
  "For a relation pass `relativeCode` and `options` (schemaCode/displayField/...). `searchFormula` and `conditions` are JSON strings for the relation data restriction/query conditions.",
200
209
  "For a relation display field the tool writes the field-row top-level `relativePropertyCode` = options.displayField (the runtime reads THAT key, not options.displayField — QueryRuntimeController.java:1214-1226) and defaults options.displayFieldType:0 + displayFieldFormat:\"\".",
201
210
  "For FORMULA pass `options.formulaConfig` (nested JSON string) + `options.persistent:true`; for RELEVANCE_DATA pass `options.relevanceField` + `options.referenceField` + `options.referenceFieldPropertyType`. 数值字段的小数位写 `options.scale`;顶层 `precision` 不被读取,若误传请改为 `precision→options.scale(数值小数位)`。数值显示格式写 `options.format`(`ratio.percentile`=20.00%、`RMB.percentile`=¥2,000.00、`percentile`=2,000.00;**百分比存比值** 0.5→50.00%;别名 percent/currency 归一;全表见 contract 的 numericalFormat)。",
202
- "org 选人族(STAFF_SELECTOR 等 5/50/51/60/61)字段行 options 自动写成实例观测的发布安全形状(yst/fwb 发布面 2656 行:null 或 {defaultValue, mappings, virtualField[, noRepeat]};单选 defaultValue \"\",多选 [])。deptVisible/multi 是**表单控件面**判别键(disposeUpdateType/updateSelectionType 读 control.options,票 69 已由表单脚手架写入控件面),不出现在字段行。",
211
+ "org 选人族(STAFF_SELECTOR 等 5/50/51/60/61)字段行 options 由工具写成发布安全形状(形状与读面键见 contract field 的 orgSelectorFieldRowOptions)。deptVisible/multi 是**表单控件面**判别键(disposeUpdateType/updateSelectionType 读 control.options,票 69 已由表单脚手架写入控件面),不出现在字段行。",
203
212
  ]),
204
213
  }),
205
214
  "field.update": Object.freeze({
206
215
  scope: "create publish readback",
207
216
  description: describeTool("Update an existing field (bizproperty/update) — merges `options` (and optional `choices`/`relativeCode`) onto the current draft/published record.", [
208
- "**不切换 propertyType**:field.update 传 propertyType 会被静默忽略(errcode 0 但类型不变,r6 实证 2026-10-10)——已发布字段改类型只能 field.delete + field.create 重建(mapping 类型兼容见 field.create 的 mappings 说明)。choices 只对文本单选族(RADIO/DROPDOWN_BOX 等)合法,传给其它类型会被出门校验拒。",
217
+ "**不切换 propertyType**:field.update 传 propertyType 会被静默忽略(errcode 0 但类型不变)——已发布字段改类型只能 field.delete + field.create 重建(mapping 兼容见 field.create)。choices 只对文本单选族(RADIO/DROPDOWN_BOX 等)合法,传给其它类型会被出门校验拒。",
209
218
  "字典-backed 可用 `syncDictionary:true` 重填 useDictionariesData;readback 带 face:\"draft\"。",
210
- "Use it to add relation `mappings` (source/target carry-through) or change field options. **关联填充映射的事实源是字段行 `options.mappings`**(真机 2026-10-14 中冶实证:改表单控件属性里的 mappings 会被平台按字段重算覆盖、回读不生效)。改映射的正确链:`field.update` 按完整 options 提交(只改 mappings,其余键 queryCode/displayField/schemaCode/conditions… 原值保留)→ `field.publish` → 已发布表单重派生一次:`form.draft`(**rebuild:false**,保留现有布局与已挂在线JS)重存 → `form.publish` → 回读核对。**不要用 field.update 的 cascadeRepublish 刷已带自定义布局/在线JS 的表单**——它会 rebuild 脚手架,可能动到现有自定义布局(rebuild:false 手动链才安全)。",
219
+ "**关联填充映射的事实源是字段行 `options.mappings`**(改控件映射会被重算覆盖)。改映射的正确链:`field.update` 按完整 options 提交(只改 mappings,其余键 queryCode/displayField/schemaCode/conditions… 原值保留)→ `field.publish` → 已发布表单重派生一次:`form.draft`(**rebuild:false**,保留现有布局与已挂在线JS)重存 → `form.publish` → 回读核对。**不要用 field.update 的 cascadeRepublish 刷已带自定义布局/在线JS 的表单**——它会 rebuild 脚手架,可能动到现有自定义布局(rebuild:false 手动链才安全)。",
211
220
  "A relation's display field is the field-row top-level `relativePropertyCode` (options.displayField is mirrored but not what the runtime reads); the tool rewrites it when you pass a new displayField.",
212
- "数值显示格式可改:`options.format`(白名单)用平台常量 `ratio.percentile`=20.00%、`RMB.percentile`=¥2,000.00、`integer/percentile`=普通数字,别名 percent/currency 会归一。字段行 format 优先于表单控件,改完 `field.publish` 即生效(真机 r64b 无需重建表单)。",
221
+ "数值显示格式可改:`options.format`(白名单)用平台常量(全表见 contract 的 numericalFormat),别名 percent/currency 会归一。字段行 format 优先于表单控件,改完 `field.publish` 即生效(无需重建表单)。",
213
222
  "表单条件(`options.requiredFormula`(必填)/`readonlyCondition`(只读)/`displayFormula`(显示))会**自动配对**一条 `bizdatarule` type3/4/5 行:门户**运行时**读字段 options,表单设计器**设计态** Set/Unset 读 `bizdatarule/list`——只写 options 会让设计器显示 Unset。readback.formConditionSync 报 created/updated/deleted/skipped;清空条件传空串(如 requiredFormula:\"\")会同时删规则行;字段未发布时只写 options 并在 skipped 说明原因。",
214
223
  "Re-publish with field.publish for the change to take effect — or pass `cascadeRepublish:true` for the one-call chain: field.update → field.publish → form.draft(rebuild) → form.publish(force). The cascade re-scaffolds the default form from the published fields (non-structural control options are preserved); there is no cross-endpoint transaction, so a mid-chain failure is reported honestly as partial (status:partial) with steps/failedStep/envelope (the completed prefix stays).",
215
- "form.publish(rebuild:true) is the same form-side refresh without re-touching the field: it discards the existing draft, re-scaffolds from the published face, and force-promotes.",
224
+ "form.publish(rebuild:true) 可不重碰字段地做同样的表单侧刷新。",
216
225
  ]),
217
226
  }),
218
227
  "field.publish": Object.freeze({
219
228
  scope: "create publish readback",
220
- description: "Publish the model's draft fields (bizproperty/publish). **Model-scoped**: one call publishes every draft field — never once per field. Optional `code`/`codes` verify published face; readback 回 `publishedCodes`。`codes` 短路须草稿/发布 options 一致,否则真发布。formBinding 可含 dictionaryStale / relation-mappings-empty。瞬态重试(ticket 79):异常小资源下 DDL 中间态自动重试≤3(退避 2s/5s);仍失败等≥30s 再发,勿重复建字段。**部分交付口径**:有请求的 code 不在发布面时 `allRequestedPresent:false` + `verified:false` + `readback.present:false`(共享写门据此把 deliveryState 降为 WRITE_UNVERIFIED)+ `unpublishedRequested`,并区分 `nonexistentCodes`(草稿面都没有——先 field.list 核对)与 `stillDraftCodes`(模型里有、发布后仍不在发布面)——已发布的字段仍然算发布了,但不要只看 ok/DELIVERED。",
229
+ description: "Publish the model's draft fields (bizproperty/publish). **Model-scoped**: one call publishes every draft field — never once per field. Optional `code`/`codes` verify published face; readback 回 `publishedCodes`。`codes` 短路须草稿/发布 options 一致,否则真发布。formBinding 可含 dictionaryStale / relation-mappings-empty。瞬态重试:DDL 中间态自动重试≤3(退避 2s/5s);仍失败等≥30s 再发,勿重复建字段。**部分交付口径**:有请求的 code 不在发布面时 `allRequestedPresent:false` + `verified:false` + `readback.present:false`(共享写门据此把 deliveryState 降为 WRITE_UNVERIFIED)+ `unpublishedRequested`,并区分 `nonexistentCodes`(草稿面都没有——先 field.list 核对)与 `stillDraftCodes`(模型里有、发布后仍不在发布面)——已发布的字段仍然算发布了,但不要只看 ok/DELIVERED。",
221
230
  }),
222
231
  "field.delete": Object.freeze({
223
232
  scope: "create publish readback",
@@ -692,7 +692,7 @@ export function registerFieldLane(tools) {
692
692
  choices: choicesArg,
693
693
  relativeCode: relativeCodeArg,
694
694
  subFields: subFieldArg,
695
- propertyEmpty: z.boolean().optional().describe("覆盖数据模型层的不可为空声明;传 false 可把历史误建的字段改回可为空(必填/只读应在表单与流程节点配置)。readback.committed 列出本次实际提交到线缆的键,readback.propertyEmpty 只在草稿面回读到该值时才出现(r32 真机:bizproperty/list 行不带 propertyEmpty,读不到即不编造,用 committed 确认本次提交)"),
695
+ propertyEmpty: z.boolean().optional().describe("覆盖数据模型层的不可为空声明;传 false 可把历史误建的字段改回可为空。读面不回该键,确认看 readback.committed(见 contract field 的 propertyEmptyReadback)"),
696
696
  syncDictionary: z
697
697
  .boolean()
698
698
  .optional()
@@ -13,7 +13,7 @@ export const FOLDER_WIRE = Object.freeze({
13
13
  delete: "POST /api/api/app/folders/delete?folderId=",
14
14
  }),
15
15
  defaults: "createFolder forces type=Folder, defaults parentId to the app package id (root) and does NOT reject duplicate names; updateFolder refuses parentId===id and only writes parentId when non-empty; deleteFolder refuses a non-empty folder (DIRECTORY_NOT_EMPTY) — delete is NOT recursive",
16
- tree: "apppackage/trees?appCode= returns a NESTED tree (folders carry children[]); reading only the top-level array makes a freshly created child folder look absent — flatten recursively and report path/depth; missing app → applicationExists:false + empty nodes (still ok); default folder marked isDefault via name_i18n.en=defaultGroup; BizModel gets displayPath",
16
+ tree: "apppackage/trees?appCode= returns a NESTED tree (folders carry children[]); reading only the top-level array makes a freshly created child folder look absent — flatten recursively and report path/depth (issue 2026-10-23: a create that answered errcode 0 looked like 'folder not created' when read from the top level); missing app → applicationExists:false + empty nodes (still ok); default folder marked isDefault via name_i18n.en=defaultGroup; BizModel gets displayPath",
17
17
  live: "2026-10-23 customer HAR replay: folders/create answered errcode 0 成功创建目录; after the token was attached apppackage/trees returned the full tree",
18
18
  customPage: "CustomPageController(8.6.26, @RequestMapping \"/api/custom\"): POST /create takes AppFunctionVO and requires parentId + a non-null menuPointType (getMenuPointType().toString() NPEs to 50000 otherwise) and forces type=Page; POST /page/content/update writes draftContent (existDraft=true) and /page/content/publish writes publishedContent (published=true); BOTH first do getAppFunctionByCode(code) and throw BIZ_SCHEMA_NOT_EXIST when the tree node is missing — node first, then body",
19
19
  });
@@ -198,7 +198,7 @@ function folderTools(tools) {
198
198
  kind: "read",
199
199
  lane: LANE,
200
200
  scope: T["folder.tree"].scope,
201
- description: "读取**应用树**(应用**内**目录/分组 + 模型节点;不是应用包本身——应用包用 app.*)。**递归展平**并给出每个节点的 `path`/`depth`(平台 `apppackage/trees?appCode=` 返回嵌套 children,只看顶层会误判“目录没建成”——issue 2026-10-23)。`foldersOnly:true` 只回目录(type=Folder)。目录 id 就是 folder.update/delete 与 model.move/model.create 的 `folderId/parentId`。不存在的应用回 `applicationExists:false` + 空树(仍 ok,不拒——与「存在但空」可区分)。平台自动建的默认分组节点带 `isDefault:true`(判据:name_i18n.en=defaultGroup)。",
201
+ description: "读取**应用树**(应用**内**目录/分组 + 模型节点;不是应用包本身——应用包用 app.*)。**递归展平**并给出每个节点的 `path`/`depth`(平台 `apppackage/trees?appCode=` 返回嵌套 children,只看顶层会误判“目录没建成”)。`foldersOnly:true` 只回目录(type=Folder)。目录 id 就是 folder.update/delete 与 model.move/model.create 的 `folderId/parentId`。不存在的应用回 `applicationExists:false` + 空树(仍 ok,不拒——与「存在但空」可区分)。平台自动建的默认分组节点带 `isDefault:true`(判据:name_i18n.en=defaultGroup)。",
202
202
  inputSchema: {
203
203
  environment: environmentArg,
204
204
  applicationCode: z.string().optional().describe("应用 code;省略用配置默认应用(别名:appCode)"),
@@ -15,14 +15,14 @@ export const FORM_WIRE = Object.freeze({
15
15
  publishAlreadyPublished: "published:true with force!==true skips as already-published",
16
16
  forceRepublish: "onlinejs.compose passes force:true so it can re-promote after a prior publish",
17
17
  emptyLayoutGuard: "ticket 74: the platform designer's Save is NOT lossless — it clears draftViewJson to \"[]\" and draftAttributesJson to \"{}\"; form.draft refuses CALLER-PROVIDED empty layouts (blocker form-empty-layout, zero wire, escape allowEmptyLayout:true) and form.publish refuses to promote a draft with fewer controls than the published face (blocker form-publish-degrade, escape allowDegrade:true); the recovery path is the form version history (/api/api/app/bizsheet/history/list) — fetch the intact version's view/attributes originals and rewrite the draft before publishing",
18
- formButtons: "form toolbar buttons are a three-layer configuration (live 2026-10-23, 1.1.25; shape corrected by GitLab #38 live 8.6.26 2026-11-16): (1) bizsheet.options.customButtonJson — a JSON ARRAY with each entry's actionConfig as an OBJECT (the designer's save shape; a STRINGIFIED array is double encoding the platform stores verbatim and the form page then silently drops every button — the pre-r72 CLI form, now unwrapped+healed on every write and linted via shapeWarning in readbacks) — is the authoring face; ModelManagementFacadeImpl.publishBizForm:1022 turns it into h_biz_button rows with triggerType=FORM, triggerCode=<formCode> at publish; (2) those rows are what ActionPermissionHandler.getByTriggerTypeAndCode(FORM, bizCode) reads; (3) whether a button shows at a node is filtered by the workflow activity's buttonPermission.customBtns[].enabled (the designer 表单操作 checkboxes) plus showPermCode; the execute face is POST /api/api/runtime/form/executeCustomButton {bizButtonModel, bizObjectList:[<full bizObject>], reacquireDataFromDb:true} — NOT the list-button launcher path with ids[]",
18
+ formButtons: "form toolbar buttons are a three-layer configuration (live 2026-10-23, 1.1.25; shape corrected by GitLab #38 live 8.6.26 2026-11-16): (1) bizsheet.options.customButtonJson — a JSON ARRAY with each entry's actionConfig as an OBJECT (the designer's save shape; a STRINGIFIED array is double encoding the platform stores verbatim and the form page then silently drops every button — the pre-r72 CLI form, now unwrapped+healed on every write and linted via shapeWarning in readbacks) — is the authoring face; ModelManagementFacadeImpl.publishBizForm:1022 turns it into h_biz_button rows with triggerType=FORM, triggerCode=<formCode> at publish; (2) those rows are what ActionPermissionHandler.getByTriggerTypeAndCode(FORM, bizCode) reads; (3) whether a button shows at a node is filtered by the workflow activity's buttonPermission.customBtns[].enabled (the designer 表单操作 checkboxes) plus showPermCode; the execute face is POST /api/api/runtime/form/executeCustomButton {bizButtonModel, bizObjectList:[<full bizObject>], reacquireDataFromDb:true} — NOT the list-button launcher path with ids[]; when executeCustomButton answers 10005, retry through the equivalent face rule.run (launcher/domain_service_runtime/<schema>/<rule> + ids[]) — the same bound rule is proven usable there (r28b live), so never loop on executeCustomButton; a newly authored button needs code/name/bindAction/operateType plus triggerCode/triggerType/showPermCode/showPermType + name_i18n (JSON string form) + addviewType (useLocation defaults to FORM; missing keys answer platform 40000)",
19
19
  actionsColumns: "ticket 100: draftActionsJson/publishedActionsJson are REAL bizsheet columns (BizForm.java:95-100 @SerializableField; BizFormModel.java:59-62 serialized by bizsheet/get) — the designer writes draftActionsJson on save and both faces on publish (frontend-dist/admin/js/4280.cfa75764.js offsets 193538/185347); form.get full:true surfaces them; publish promotes draftActionsJson → publishedActionsJson",
20
20
  sheetListFace: "form.list: GET /api/api/app/bizsheet/list?schemaCode= (BizFormController.java:137-152 → ModelManagementFacadeImpl.getBizForms:481-488) answers the BizFormHeaderModel HEADER projection only — code, name, schemaCode, published, formType, sortKey, icon. formType is the INTEGER index (@JsonValue getIndex(), BizFormType.java:45-48): 0 DEFAULT_SHEET / 1 CUSTOMIZE_SHEET / 2 PRINT_TEMPLATE — decoded to the name with formTypeIndex kept (ADR 0002). existDraft/buttonCount/hasCustomScript are NOT on this face, so the default read never fabricates them: detail:true pays 1+N bizsheet/get for the content-derived faces. published is the same platform flag bit (r79-04): publish→draft leaves it false while the content is intact — the flag is reported as-is, content judgement needs detail:true. HTTP 404 means the version family has no /list endpoint: the tool answers sheetListUnavailable:true + the default slot only, never a fabricated list; a 601003 业务模型不存在 refusal is modelPresent:false (zero retries)",
21
21
  });
22
22
  const FORM_GET_DESCRIPTION = '读取默认表单(bizsheet/get)的发布状态与控件清单(紧凑默认)。**发布态以返回的 `published` / `existDraft` 布尔为准**(`published:true`=已发布;`published:false,existDraft:true`=只有草稿,**未发布**)——不要用 `publishedControlCodes` 是否非空来推断(草稿字段会让它非空,误判为已发布)。**每个模型交付前其默认表单必须 `published:true`**:用 `configure_form` 或 `form.draft(rebuild:true)`+`form.publish` 发布,并逐模型 `form.get` 核对。`full:true` 还返回 `options` 与 `customButtonJson`(表单工具栏按钮,数组原样;库里是字符串脏形时附 `customButtonJsonShapeWarning`——线上 #38 前端按钮不渲染)。传 `controls:["code",…]` 只取指定控件的 options(如关联控件的 mappings);传 `full:true` 才返回 draft/published 的完整 view/attributes/html/actions JSON(actions 列为设计器保存/发布的表单级按钮动作)。体积大,仅在需要整体布局时用。';
23
- const FORM_DRAFT_DESCRIPTION = "Save the default-form DRAFT (bizsheet/update). Reads the current sheet, merges the caller's explicit draftViewJson/draftAttributesJson (or preserves the existing draft); when both are absent on a fresh default form, composes the designer-standard scaffold from the model's published fields. A redundant field (relation-mapping carry-through target) always stays bound; with no workflow it is hidden in the design (options.visible=false), with a workflow it stays visible for per-node propertyPermissions. Pass `draftHtmlJson` to thread custom online-script HTML through. Empty-layout guard: explicitly passing \"[]\"/\"{}\" view/attributes is refused (form-empty-layout) — the platform designer's Save is NOT lossless and clears drafts to exactly that shape; escape with allowEmptyLayout:true, and recover cleared drafts from the form version history (/api/api/app/bizsheet/history/list). **读回原样回写**:从 `form.get` 取回的 view/attributes 直接回传时加 `fromReadback:true`——工具会与已存草稿/发布面逐字比对,一致才放行(平台自身布局可能含子表列行/系统行默认宽度),被改动过的面照常按 validation 拒绝。**表单工具栏按钮**:`buttons`(数组)或 `customButtonJson`(原样字符串)写进 `biz_sheet.options.customButtonJson`(**数组+actionConfig 对象**,设计器同形——线上 #38:字符串形=双重编码,前端按钮不渲染,重写即自愈);**要到 form.publish 才生成 h_biz_button(triggerType=FORM)**,且表单页是否显示还取决于流程节点 `buttonPermission.customBtns[].enabled`(设计器「表单操作」勾选)。`useLocation` 用 FORM/ROW/LIST,表单工具栏按钮用 FORM。 **表单控件属性(含关联填充 mappings)从字段行派生**:改关联映射的事实源在字段 options.mappings(field.update → field.publish),直接改这里的控件映射会被平台按字段重算覆盖(真机 2026-10-14 实证);字段发布后如需刷新已发布表单的控件映射,用本工具 rebuild:false 重存(保留现有布局与在线JS)再 form.publish。";
23
+ const FORM_DRAFT_DESCRIPTION = "Save the default-form DRAFT (bizsheet/update). Reads the current sheet, merges the caller's explicit draftViewJson/draftAttributesJson (or preserves the existing draft); when both are absent on a fresh default form, composes the designer-standard scaffold from the model's published fields. A redundant field (relation-mapping carry-through target) always stays bound; with no workflow it is hidden in the design (options.visible=false), with a workflow it stays visible for per-node propertyPermissions. Pass `draftHtmlJson` to thread custom online-script HTML through. Empty-layout guard: explicitly passing \"[]\"/\"{}\" view/attributes is refused (form-empty-layout) — the platform designer's Save is NOT lossless and clears drafts to exactly that shape; escape with allowEmptyLayout:true, and recover cleared drafts from the form version history (/api/api/app/bizsheet/history/list). **读回原样回写**:从 `form.get` 取回的 view/attributes 直接回传时加 `fromReadback:true`——工具会与已存草稿/发布面逐字比对,一致才放行(平台自身布局可能含子表列行/系统行默认宽度),被改动过的面照常按 validation 拒绝。**表单工具栏按钮**:`buttons`(数组)或 `customButtonJson`(原样字符串)写进 `biz_sheet.options.customButtonJson`(**数组+actionConfig 对象**,设计器同形——线上 #38:字符串形=双重编码,前端按钮不渲染,重写即自愈);**要到 form.publish 才生成 h_biz_button(triggerType=FORM)**,且表单页是否显示还取决于流程节点 `buttonPermission.customBtns[].enabled`(设计器「表单操作」勾选)。`useLocation` 用 FORM/ROW/LIST,表单工具栏按钮用 FORM。字段发布后如需刷新已发布表单的控件映射,用本工具 rebuild:false 重存(保留现有布局与在线JS)再 form.publish。";
24
24
  const FORM_PUBLISH_DESCRIPTION = "Publish the default form (bizsheet/publish, proven shape: draft*Json promoted to published*Json verbatim) with published-face readback. **不影响在线 JS**:本工具只提拔布局草稿;改 JS 请用 onlinejs.compose(它自己会连同整张表单一起发布,不必再调本工具)。 Degrade guard: refuses to promote a draft carrying FEWER controls than the published face (form-publish-degrade) — the designer's Save clears drafts non-losslessly; recover via the form version history (/api/api/app/bizsheet/history/list) and rewrite the draft first, or pass allowDegrade:true to force the reduction. rebuild:true is the one-call refresh: discard the existing draft, re-scaffold from the published fields (non-structural control options preserved), then force-promote — use it after a field shape change. **表单工具栏按钮**:传 `buttons`(或 `customButtonJson`)→ 写进 `options.customButtonJson` 并在本次 publish 生成 `h_biz_button(triggerType=FORM, triggerCode=<formCode>)`(平台 `publishBizForm:1022`);`options.customButtonJson` 以**数组**写入(条目 `actionConfig` 为对象,设计器同形——线上 #38:字符串形=双重编码,前端按钮不渲染,回执给 formButtonsShapeWarning);表单页是否显示再由流程节点 `buttonPermission.customBtns[].enabled` 过滤。";
25
- const FORM_RUN_BUTTON_DESCRIPTION = "执行表单工具栏按钮(平台同款面:`POST /api/api/runtime/form/executeCustomButton`,body `{bizButtonModel, bizObjectList:[<完整业务对象>], reacquireDataFromDb:true}`)。**与列表行按钮不同**:列表按钮发 `launcher/domain_service_runtime/<schema>/<rule>` + `ids[]`(用 `rule.run`),表单按钮带**整条记录**,不能互换。按钮来源 `GET /api/api/system/getCustomButtons`(只列 triggerType=FORM 的 h_biz_button)。前提:按钮已由 `form.publish` 的 `buttons`/`customButtonJson` 生成。返回是执行结果信封,规则副作用用 `data.load` 另读;被规则 UPDATE 的目标行须是 COMPLETED(引擎查不到 DRAFT)。`302045` = 数据被占用。**`10005` 执行失败时优先换等价面 `rule.run`(launcher/domain_service_runtime/<schema>/<rule> + ids[])**——同一绑定规则在 rule.run 面已验证可用(r28b 实证),不要在 executeCustomButton 上反复重试。";
25
+ const FORM_RUN_BUTTON_DESCRIPTION = "执行表单工具栏按钮(平台同款面:`POST /api/api/runtime/form/executeCustomButton`,body `{bizButtonModel, bizObjectList:[<完整业务对象>], reacquireDataFromDb:true}`)。**与列表行按钮不同**:列表按钮发 `launcher/domain_service_runtime/<schema>/<rule>` + `ids[]`(用 `rule.run`),表单按钮带**整条记录**,不能互换。按钮来源 `GET /api/api/system/getCustomButtons`(只列 triggerType=FORM 的 h_biz_button)。前提:按钮已由 `form.publish` 的 `buttons`/`customButtonJson` 生成。返回是执行结果信封,规则副作用用 `data.load` 另读;被规则 UPDATE 的目标行须是 COMPLETED(引擎查不到 DRAFT)。`302045` = 数据被占用。**`10005` 换等价面 `rule.run`(见 contract form),勿反复重试。**";
26
26
  const CONFIGURE_FORM_DESCRIPTION = "High-level: bind fields into the default form and publish it (form.draft → form.publish), subject to the write permission gate. Delegates to the proven form.draft scaffold + form.publish paths so the real empty-form layout (and any caller-supplied draftHtmlJson) is persisted and promoted — never bypasses with a shortcut body. `sheetCode` is optional: omitted means the model's default sheet (sheetCode = schemaCode).";
27
27
  const FORM_LIST_DESCRIPTION = "列出模型的多张表单(`/api/api/app/bizsheet/list?schemaCode=`,header-only 投影):每行 `sheetCode`/`name`/`formType`(整数索引解码为名字,另带 formTypeIndex)/`published`。默认只发 1 次 wire;`detail:true` 才逐面 `bizsheet/get`(上限 maxSheets=12,超出回 partial+omittedSheets)补 existDraft/controlCount/buttonCount/publishedActionCount/hasCustomScript/faces。**默认面不伪造这些内容推导键,也不改旗标**:`published` 是平台旗标位(publish→draft 后它为 false 而内容俱在),判「有没有发布面内容」用 detail:true 的 faces。业务模型不存在 → modelPresent:false;该版本族无 /list 端点(HTTP 404)→ sheetListUnavailable:true + 只回默认槽(明确标注是推断,不是清单)。`defaultSheetCode` 由清单推导(formType=DEFAULT_SHEET 且 sheetCode===schemaCode),权威仍是 form.get 的显式 sheetCode。";
28
28
  export const FORM_LANE_CONTRACT = Object.freeze({
@@ -564,7 +564,7 @@ export function registerFormLane(tools) {
564
564
  buttons: z
565
565
  .array(z.record(z.unknown()))
566
566
  .optional()
567
- .describe("表单工具栏按钮(写进 biz_sheet.options.customButtonJson;publish 时才生成 h_biz_button(triggerType=FORM))。每条至少 code/name/bindAction/operateType,useLocation 默认 FORM;新建还需 triggerCode/triggerType/showPermCode/showPermType + name_i18n(JSON 串形)+ addviewType,缺则平台 40000(#38 实证);code 语义化"),
567
+ .describe("表单工具栏按钮(写进 biz_sheet.options.customButtonJson;publish 时才生成 h_biz_button(triggerType=FORM))。每条必填键见 contract form 的 formButtons;code 语义化"),
568
568
  customButtonJson: z.string().optional().describe("buttons 的原样 JSON 数组字符串(与 buttons 互斥;用于把 form.get 读回值直接回写)"),
569
569
  buttonsMode: z.enum(["merge", "replace"]).optional().describe("默认 merge:按 code 增量 upsert(改一个按钮不必重发全表);replace:整表替换"),
570
570
  removeButtonCodes: z.array(z.string().min(1)).optional().describe("要删除的按钮 code(仅 merge 模式)"),
@@ -7,7 +7,7 @@ import { mergeActions, PLATFORM_DEFAULT_LIST_ACTIONS } from "./list-view-shapes.
7
7
  * single source for the handler descriptions and the coverage declarations.
8
8
  */
9
9
  export const LIST_VIEW_WIRE = Object.freeze({
10
- createBody: "query/create body {schemaCode, name, code, type:'LIST', showOnPc:false, published:false} (forced design-time defaults)",
10
+ createBody: "query/create body {schemaCode, name, code, type:'LIST', showOnPc:false, published:false} (forced design-time defaults); code is required by the platform — a missing code is refused with errcode 10005 「编码不能为空」 on a wasted live round trip (r26 live), so the tool fills schemaCode when code is omitted",
11
11
  createReadback: "query/get_header readback",
12
12
  configureDefault: "code omitted means the default view (code=schemaCode)",
13
13
  configureColumns: "query/get then query/update: for each fieldCodes entry, append a missing column as visible, or repair an existing column's name/propertyType/displayFormat/visible in place (never skip an already-present column), then query/get readback; propertyType comes from published field metadata; NUMERICAL displayFormat is derived from the field's 0-based `options.scale` (0=integer,1=1dp,2=2dp,3=3dp…8=8dp) through the platform parseNumber table ({0:1,1:2,2:3,3:11,4:12,23:…, percent 0..:4/5/6/13/14/27..30, currency ¥ 2dp..:7/15/16/31..34} — verified live: scale 2 → displayFormat 3 = 2 decimals) and DATE displayFormat from options.format (1=yyyy-MM-dd,2=datetime,3=minute,4=yyyy-MM); the readback columns array carries {propertyCode,propertyType,displayFormat,visible,sumType} and added/updated name the fieldCodes touched",
@@ -126,7 +126,7 @@ export const LIST_VIEW_LANE_CONTRACT = Object.freeze({
126
126
  }),
127
127
  "listview.configure": Object.freeze({
128
128
  scope: LIST_VIEW_SCOPE,
129
- description: "(**列汇总**:数值列 `sumType` wire 为整数——0=不统计/1=求和/2=平均/3=最小/4=最大/5=计数,写进 presentation.columnsJson 的列对象,8.6.26 反编译 SumType 实证)配置列表视图。**code 语义(与配方 configure-default-list 同口径,r60a-F13 真机对齐 2026-11-13;r73 #6 真机对齐 2026-11-17)**:省略 `code`(或 code=schemaCode)= 配置**默认视图**——默认视图 code = 模型 code,同样可 configure(8.6.41 实测),日常配列就用它,**不要先 listview.create**(会多一个视图);改默认视图影响所有用户`listview.create` 只在确实需要**第二个**视图时使用,此时 listview.configure 带 code 指向它。在既有(默认)列表视图上配置列、排序、查询条件、行/列表按钮、呈现、自定义按钮、视图头扩展选项与视图类型:读回 query,按 `fieldCodes` 追加缺失列或**原地修正**已存在列的 name/propertyType/displayFormat/visible(不再跳过既有列),置为可见;数值列 displayFormat 由字段 0 基 `options.scale` 推导(0=整数,1=1位,2=2位,3=3位…8=8位;实测 scale 2 → displayFormat 3 = 两位小数)、日期列由 `options.format` 推导(1/2/3/4),回显 `columns` 为完整列对象并给出 `added`/`updated`;`sorts`→querySorts(direction ASC/DESC)、`conditions`→queryConditions(**比较符是 `filterType`(QueryFilterType 字符串枚举 Eq/NotEq/…;别名 operator/op;省略时按 propertyType 取平台默认)**、displayType/choiceType/options 字符串解码;写后条件回读等价校验给出 conditionReadback)、`actions`→queryActions(queryActionType QUERY(1)…BATCH_SUBMIT(23)、associationType BIZSHEET(0)/WORKFLOW(1))、`presentation`→queryPresentation(htmlJson/actionsJson/columnsJson/queryViewDataSource/schemaRelations/options 均为 JSON 字符串,合法 JSON 读回解码)、`buttons`→customButtons(写面 customButtonJson JSON 数组字符串;bindAction/useLocation/operateType/showPermType 以枚举名发送;triggerType 强制 QUERY、triggerCode=视图 code、sortKey 按数组位,缺省回传读面 customButtons 有效集;ADD_DATA/FORM 目标绑定走 actionConfig——schemaCodeVal+formListData+configureList,targetCode/targetObjCode 对其无效会被拒;高层参数 targetModel/targetForm/configureList 从读回元数据展开,未解析即 listview-button-target-unresolved 零副作用拒)、`options`→视图头 BizQueryOption(`pagingSetting`{pageSize,showTotal} 分页、`listViewModeSetting`{mode,canSwitch} 列表模式,缺省回传读面有效 options、提供时整体替换,rowColorSetting 无 8.6.26 类证据故对象形态拒绝)与 `presentationType`→QueryPresentationType(LIST/BOARD/CALENDAR/GANTT,缺省回传读面有效值;GANTT 必须同时提供 `gantt`→queryGanttModel 且 startTimePropertyCode/endTimePropertyCode/titlePropertyCode 非空,缺省不触碰既有 gantt)与 `queryLayer`→层级展示(BizQueryLayer[] 数组原样发送)及 `multiTableHeaderConfig`→多级表头(HeaderConfig[] JSON 字符串;缺省回传读面有效值、提供时整体替换)省略时不触碰既有值,提供时整体替换并经出门前 dry-lint;`query/update` 后回读(`query/get` 自动注入的默认动作、平台 sortKey 重排与 schemaRelations 派生需还原)。`code` 省略时用默认视图(=schemaCode)。`queryConditionMap` 为只读派生(query/get 带 formCode 子表条件时才出现),非配置输入。**发布语义**:`query/update` 自动置 publish=TRUE——视图无草稿/发布两态、无需独立发布步骤(与表单/规则的 draft→publish 不同)。**依赖顺序**:视图与表单脚手架都依赖**已发布字段**,规范顺序 model.create → field.create → field.publish(模型级)→ form.draft → form.publish →(需要第二视图时 listview.create)→ listview.configure → rule.save → rule.enable → workflow。",
129
+ description: "配置列表视图(列、排序、查询条件、行/列表按钮、呈现、自定义按钮、视图头扩展选项与视图类型)。**code 语义**:省略 `code`(或 code=schemaCode)= 配置**默认视图**(code = 模型 code,8.6.41 起默认视图同样可 configure),日常配列就用它,**不要先 listview.create**(会多一个视图);改默认视图影响所有用户;仅需第二个视图时才 listview.create(configure 带 code 指向它)。读回 query,按 `fieldCodes` 追加缺失列或**原地修正**已存在列的 name/propertyType/displayFormat/visible(不再跳过既有列),置为可见;数值列 displayFormat 由字段 0 基 `options.scale` 推导(0=整数,1=1位,2=2位,3=3位…8=8位)、日期列由 `options.format` 推导(1/2/3/4),回显 `columns` 为完整列对象并给出 `added`/`updated`;`sorts`→querySorts(direction ASC/DESC)、`conditions`→queryConditions(**比较符是 `filterType`(QueryFilterType 字符串枚举 Eq/NotEq/…;别名 operator/op;省略时按 propertyType 取平台默认)**、displayType/choiceType/options 字符串解码;写后条件回读等价校验给出 conditionReadback)、`actions`→queryActions(queryActionType QUERY(1)…BATCH_SUBMIT(23)、associationType BIZSHEET(0)/WORKFLOW(1))、`presentation`→queryPresentation(htmlJson/actionsJson/columnsJson/queryViewDataSource/schemaRelations/options 均为 JSON 字符串,合法 JSON 读回解码)、`buttons`→customButtons(写面 customButtonJson JSON 数组字符串;bindAction/useLocation/operateType/showPermType 以枚举名发送;triggerType 强制 QUERY、triggerCode=视图 code、sortKey 按数组位,缺省回传读面 customButtons 有效集;ADD_DATA/FORM 目标绑定走 actionConfig——schemaCodeVal+formListData+configureList,targetCode/targetObjCode 对其无效会被拒;高层参数 targetModel/targetForm/configureList 从读回元数据展开,未解析即 listview-button-target-unresolved 零副作用拒)、`options`→视图头 BizQueryOption(`pagingSetting`{pageSize,showTotal} 分页、`listViewModeSetting`{mode,canSwitch} 列表模式,缺省回传读面有效 options、提供时整体替换,rowColorSetting 无 8.6.26 类证据故对象形态拒绝)与 `presentationType`→QueryPresentationType(LIST/BOARD/CALENDAR/GANTT,缺省回传读面有效值;GANTT 必须同时提供 `gantt`→queryGanttModel 且 startTimePropertyCode/endTimePropertyCode/titlePropertyCode 非空,缺省不触碰既有 gantt)与 `queryLayer`→层级展示(BizQueryLayer[] 数组原样发送)及 `multiTableHeaderConfig`→多级表头(HeaderConfig[] JSON 字符串;缺省回传读面有效值、提供时整体替换)省略时不触碰既有值,提供时整体替换并经出门前 dry-lint;`query/update` 后回读。`queryConditionMap` 为只读派生(query/get 带 formCode 子表条件时才出现),非配置输入。**发布语义**:`query/update` 自动置 publish=TRUE——视图无草稿/发布两态、无需独立发布步骤。**依赖顺序**:视图与表单脚手架都依赖**已发布字段**,规范顺序 model.create → field.create → field.publish(模型级)→ form.draft → form.publish →(需要第二视图时 listview.create)→ listview.configure → rule.save → rule.enable → workflow。",
130
130
  }),
131
131
  "listview.delete": Object.freeze({
132
132
  scope: LIST_VIEW_SCOPE,
@@ -612,7 +612,7 @@ export function registerListViewLane(tools) {
612
612
  inputSchema: {
613
613
  schemaCode: z.string().min(1),
614
614
  name: z.string().min(1),
615
- code: z.string().optional().describe("视图 code;省略时**默认取 schemaCode**(与 listview.get / listview.list / rollback 的默认视图口径一致)。平台侧 code 必填,本工具会替你填,不要再依赖不回执的猜测(r26 真机:不传直接被 errcode 10005「编码不能为空」拒绝,白跑一轮线上往返)"),
615
+ code: z.string().optional().describe("视图 code;省略时默认取 schemaCode。平台必填,由本工具代填(案卷见 contract list-view 的 createBody)"),
616
616
  },
617
617
  execute: async (session, args) => {
618
618
  // r26 真机:`code` 在 schema 里可选,但三处读面/rollback 都用
@@ -475,7 +475,7 @@ export function registerOrganizationLane(tools) {
475
475
  search: { intents: ["新建角色组", "建一个角色组", "创建角色分组"] },
476
476
  lane: LANE,
477
477
  scope: SCOPES.groupCreate,
478
- description: "创建角色组(`POST organization/role/add_role_group`)。返回 roleGroupId,角色挂在它下面。**corpId 默认写当前企业**(`session.enterpriseId()`):平台的 `corpId` 只从 body 取,body 缺省时才按 parentId 反查企业设置,查不到就 NPE(被吞成 errcode 0);`corpId=\"other\"` 是平台合法的「非组织分组」语义,只有明确要建非组织分组时才传。**parentId 必填**:空值会 50000;根级组请传 `\"0\"`(真机 1.1.25 实测可建根级,path=组名、不挂在既有组下);挂到既有组下则传该组 id(`org.role.list` 的 groups[].id)。创建回执会再读一次 role/list,补上真实 `code`/`parentId`/`path`(平台 add 瞬间 code 常为 null)。",
478
+ description: "创建角色组(`POST organization/role/add_role_group`)。返回 roleGroupId,角色挂在它下面。**corpId 默认写当前企业**(`session.enterpriseId()`):平台的 `corpId` 只从 body 取,body 缺省时才按 parentId 反查企业设置,查不到就 NPE(被吞成 errcode 0);`corpId=\"other\"` 是平台合法的「非组织分组」语义,只有明确要建非组织分组时才传。**parentId 必填**:空值会 50000;根级组请传 `\"0\"`(path=组名);挂到既有组下则传该组 id(`org.role.list` 的 groups[].id)。创建回执会再读一次 role/list,补上真实 `code`/`parentId`/`path`(平台 add 瞬间 code 常为 null)。",
479
479
  inputSchema: {
480
480
  roleGroupName: z.string().min(1).describe("角色组名称(界面显示的分组名)"),
481
481
  parentId: z.string().min(1).describe("上级角色组 id。**必填**:空值直接 50000 parentIds cannot be empty。根级组传 \"0\";挂到既有组下传该组 id(如「默认」组)。挂到既有组=给该组添子节点(会改既有组的层级语义)"),
@@ -524,7 +524,7 @@ export function registerOrganizationLane(tools) {
524
524
  search: { intents: ["建角色", "新建角色", "创建角色"] },
525
525
  lane: LANE,
526
526
  scope: SCOPES.roleCreate,
527
- description: "创建角色(界面「分组」;`POST organization/role/add_role`)。返回 roleId;code 创建时 null、随后补 SYS<时间戳>,要稳定编码就传 code。**所属角色组推荐用 `roleGroupCode`(如 SYS_1000000)**:`org.role.list` 的紧凑码表只给 `code|name`、不显示组 id,而平台对错的 roleGroupId **静默接受**——存进去的值不是真实组 id 时角色会变成看不见的孤儿(r70 实测:在库里、role/users 查得到,role/list 永不返回、role/get 50000)。工具会把 code 归一成真实 id,并在创建后回读可见性。",
527
+ description: "创建角色(界面「分组」;`POST organization/role/add_role`)。返回 roleId;code 创建时 null、随后补 SYS<时间戳>,要稳定编码就传 code。**所属角色组推荐用 `roleGroupCode`(如 SYS_1000000)**:`org.role.list` 的紧凑码表只给 `code|name`、不显示组 id,而平台对错的 roleGroupId **静默接受**——会变成看不见的孤儿角色。工具会把 code 归一成真实 id,并在创建后回读可见性。",
528
528
  inputSchema: {
529
529
  roleName: z.string().min(1),
530
530
  roleGroupCode: z.string().min(1).optional().describe("所属角色组的 code(org.role.list 的 groups 码表,如 SYS_1000000)或名称。**推荐**;与 roleGroupId 二选一"),
@@ -867,7 +867,7 @@ export function registerOrganizationLane(tools) {
867
867
  search: { intents: ["新建员工", "加一个用户", "创建员工账号", "加人"] },
868
868
  lane: LANE,
869
869
  scope: SCOPES.userCreate,
870
- description: "新建员工账号(`POST organization/user/add`)。必填 name/username/departmentId;工具自动补 `userLabelIds:[]`、`userManagerConfigList:[]`、`roleIds:[]` —— 平台 dealUserLabel 对 null 直接 NPE(50000,真机 1.1.25)。返回 userId(recId);初始密码由平台默认策略生成。",
870
+ description: "新建员工账号(`POST organization/user/add`)。必填 name/username/departmentId;返回 userId(recId);平台不接受的 null 数组由工具补齐,初始密码由平台默认策略生成。",
871
871
  inputSchema: {
872
872
  name: z.string().min(1),
873
873
  username: z.string().min(1).describe("登录账号"),
@@ -923,7 +923,7 @@ export function registerOrganizationLane(tools) {
923
923
  search: { intents: ["改员工信息", "修改用户资料", "更新员工"] },
924
924
  lane: LANE,
925
925
  scope: SCOPES.userUpdate,
926
- description: "改员工(`POST organization/user/modify`)。先 user/info 读现状再合并;工具强制补 `deptIds:[]` 等四个数组——平台 modified 对 null 的 deptIds 直接 NPE(50000,真机 1.1.25)。可改姓名/部门/手机/邮箱/角色/启停。",
926
+ description: "改员工(`POST organization/user/modify`)。先 user/info 读现状再合并;平台不接受的 null 数组由工具补齐。可改姓名/部门/手机/邮箱/角色/启停。",
927
927
  inputSchema: {
928
928
  userId: z.string().min(1),
929
929
  name: z.string().optional(),
@@ -1059,7 +1059,7 @@ export function registerOrganizationLane(tools) {
1059
1059
  search: { intents: ["删除角色", "删掉这个角色"] },
1060
1060
  lane: LANE,
1061
1061
  scope: SCOPES.roleDelete,
1062
- description: "删除角色(`GET organization/role/strike_out_role?ids=`)。平台**拒绝删除仍有成员的角色**(`-1 角色下已经包含用户数据!`,实测 1.1.25):默认先读成员并拒绝;拒绝回执带可直接粘贴的 `org.role.removeUsers` 命令。`force:true` 的语义是**先逐人移出全部成员,再删除角色**(不是强行绕过平台校验)。**可用 roleCode 代替 roleId**(org.role.list 的码表只有 code)。",
1062
+ description: "删除角色(`GET organization/role/strike_out_role?ids=`)。平台**拒绝删除仍有成员的角色**:默认先读成员并拒绝;拒绝回执带可直接粘贴的 `org.role.removeUsers` 命令。`force:true` 的语义是**先逐人移出全部成员,再删除角色**(不是强行绕过平台校验)。**可用 roleCode 代替 roleId**(org.role.list 的码表只有 code)。",
1063
1063
  inputSchema: {
1064
1064
  roleId: z.string().min(1).optional().describe("角色 id(32 位 hex);与 roleCode 二选一"),
1065
1065
  roleCode: z.string().min(1).optional().describe("角色 code(org.role.list 的 roles 码表,如 qc_manager)或名称"),
@@ -1192,7 +1192,7 @@ export function registerOrganizationLane(tools) {
1192
1192
  search: { intents: ["给角色加用户", "角色加成员", "给角色加人"] },
1193
1193
  lane: LANE,
1194
1194
  scope: SCOPES.addUsers,
1195
- description: "加成员并(可选)一次设好管理范围(`add_role_user` + 逐人 `update_ouscope`,一个工具调用)。users[].id 必须是 recId(org.user.search 的 id);传 `scopes` 会应用到本次新增的每个人。**平台的 add_role_user 虽然收 `ouScope` 但会忽略它**(实测 1.1.25,回读仍为空),所以范围必须单独写——工具内部已按顺序完成。加完回读成员与范围。",
1195
+ description: "加成员并(可选)一次设好管理范围(`add_role_user` + 逐人 `update_ouscope`,一个工具调用)。users[].id 必须是 recId(org.user.search 的 id);传 `scopes` 会应用到本次新增的每个人。加完回读成员与范围(`add_role_user` 不写 `ouScope`,范围由工具另写)。",
1196
1196
  inputSchema: {
1197
1197
  roleId: z.string().min(1).optional().describe("角色 id(32 位 hex);与 roleCode 二选一"),
1198
1198
  roleCode: z.string().min(1).optional().describe("角色 code(org.role.list 的 roles 码表)或名称——省掉取 artifact 找 id"),
@@ -1275,7 +1275,7 @@ export function registerOrganizationLane(tools) {
1275
1275
  search: { intents: ["把角色里的用户移掉", "角色移除用户"] },
1276
1276
  lane: LANE,
1277
1277
  scope: SCOPES.removeUsers,
1278
- description: "把成员移出角色(`POST organization/role/strike_out_role_user`)。**平台要求 JSON body `{roleId,userIds:[...]}`**——用 query 或 `ids` 会报 10009 `Required request body is missing`(实测 1.1.25)。只移出角色,不删用户。",
1278
+ description: "把成员移出角色(`POST organization/role/strike_out_role_user`)。工具按平台要求的 JSON body `{roleId,userIds:[...]}` 发送。只移出角色,不删用户。",
1279
1279
  inputSchema: {
1280
1280
  roleId: z.string().min(1).optional().describe("角色 id(32 位 hex);与 roleCode 二选一"),
1281
1281
  roleCode: z.string().min(1).optional().describe("角色 code(org.role.list 的 roles 码表)或名称"),
@@ -11,7 +11,7 @@ import { LANES } from "./lane-ids.js";
11
11
  export const REPORT_WIRE = Object.freeze({
12
12
  surface: "报表是两层:平台通道 /api/api/report/* 维护报表页(app 功能树 type=Report,errcode 信封);BI 通道 /dashboard/v1/* 维护 dashboard 配置与图表(成功 {data},失败 {errorCode,errorMessage,errorType:BIZ},HTTP 仍 200)。BI 的 objectId = report/get 的 data.id(首次保存后 reportObjectId 同值)。",
13
13
  authConfig: "BI 每个请求 body 必须带 config:{token,reportCode,appCode} 与外层 corpId(实测缺 config 的写会返回 {data:true} 但不生效——静默 no-op);token 取会话登录 token,corpId 为该部署 BI corp id(aozhe 实测 \"a\")。平台通道照旧 Authorization + X-LowCode-Corpid。",
14
- reportPage: "report/create body {code,name,name_i18n:'{\"zh\":\"...\"}',parentId:<folder id>,icon,pcAble,mobileAble,appCode}(parentId 必填,否则断言失败);report/update 同形再加 id;report/logical_delete?code=。",
14
+ reportPage: "report/create body {code,name,name_i18n:'{\"zh\":\"...\"}',parentId:<folder id>,icon,pcAble,mobileAble,appCode}(parentId 必填,否则断言失败);report/update 同形再加 id;report/logical_delete?code=。code 上限 28 字符:超长由平台 10005 拒(r33 实证),工具按 max(28) 在提交前本地拒绝。",
15
15
  reportPageSave: "report/v2/reportpage body {report:{objectId,title,attributes:'<json字符串>',global:'<json字符串>'},corpId,config} → {data:'<objectId>'};用于首次创建 BI dashboard(全新报表页在 BI 侧不存在,需先 save 再读写图表)。",
16
16
  chartWrite: "chart/addChart body {charts:[...]}、chart/updateChart body {charts:[...]}、chart/removeCharts body {objectIds:[<chart uuid>...]}、chart/removeChart body {objectId:<uuid>}(均需 corpId+config)。图表字段 uuid/type/position/dataSourceId/mainTable/data 等,position/data/styles 多为 JSON 字符串。",
17
17
  globalAttributes: "report/saveGlobal body {objectId,global}、report/saveAttributes body {attributes,objectId}(均需 corpId+config);global/attributes 自身是 JSON 字符串。",
@@ -592,7 +592,7 @@ export function registerReportLane(tools) {
592
592
  inputSchema: {
593
593
  // r33: the platform refuses report codes longer than 28 chars (errcode
594
594
  // 10005) — enforce offline so the shape never costs a wire round trip.
595
- code: z.string().min(1).max(28).describe("报表 code;平台上限 28 字符(10005 实证 r33)——超长在提交前直接被拒"),
595
+ code: z.string().min(1).max(28).describe("报表 code;平台上限 28 字符,超长提交前即拒(errcode 10005)"),
596
596
  name: z.string().min(1).max(60),
597
597
  appCode: z.string().min(1),
598
598
  parentId: z
@@ -80,6 +80,7 @@ export const WORKFLOW_WIRE = Object.freeze({
80
80
  mutuallyExclusiveBinding: "同一处理器绑定多条规则时它们**全部执行、无互斥**:审批通过/驳回这类互斥结果不要用两条各自 FIXED 赋值都绑 end(bench22 病灶)——通过绑 end(endEventHandler)或规则 Available,驳回绑 cancel(cancelEventHandler)或规则 Cancel,或用一条多分支图(生产 case_info_update 只在 endEventHandler 绑一条 updateData 多分支图);workflow.bindRule 回读在 bizActions.length>1 时给 advisory",
81
81
  participantRoleValidation: "写前参与人校验:PARTICIPANT 的 FindUserByRole(<org>,\"<roleCode>\",\"<order>\") 会与 org.role.list 的真实角色 code 比对;缺失即拒绝 workflow-participant-role-not-found,并给 activityCode/activityName/roleCode、最多 5 个 candidates 与 nextCommand。org.role.list 读取失败时 fail-open,不阻断写入。{Originator} 是发起人关键字,不按角色校验;所有 PARTICIPANT 都是 {Originator} 时给 approval-by-originator warning。",
82
82
  userSearch: "POST /api/api/organization/user/search,@RequestBody {wd (关键字,必填), page, size, filterType?} → PageVO<UserVO>{totalElements,totalPages,content[{id,name,username,userId,departmentId,corpId,status}]}(UserController.search:337-341;缺 wd 报 10005 关键字不能为空)。用于把姓名解析成真实用户,构造参与者对象 type 3=用户(type 2=角色)",
83
+ organizationWrite: "org 写面不变式(1.1.25 真机;tools/list 只留紧凑契约句,案卷在这里):① org.role.create 的 roleGroupId **平台静默接受**——不是真实组 id 时角色变成看不见的孤儿(r70 实测:行在库里、role/users 查得到,role/list 永不返回、role/get 回 50000);优先 roleGroupCode,工具归一成真实 id 并回读可见性。② org.roleGroup.create 的 parentId 必填:根级组传 \"0\"(1.1.25 实测可建根级,path=组名、不挂在既有组下),挂到既有组下传该组 id。③ org.role.addUsers 底层的 add_role_user 收 ouScope 但**忽略它**(1.1.25 实测回读仍为空)——范围必须逐人 update_ouscope 单独写,工具已按序完成。④ org.role.removeUsers 要求 JSON body {roleId,userIds:[...]}:用 query 或 `ids` 报 10009 Required request body is missing(1.1.25 实测)。⑤ org.role.delete 对仍有成员的角色被平台拒绝:`-1 角色下已经包含用户数据!`(1.1.25 实测);force:true 是先逐人移出再删,不是绕过平台校验。⑥ org.user.create 的 dealUserLabel 与 org.user.update 的 modified 对 null 数组直接 NPE(50000,1.1.25 真机)——工具自动补 userLabelIds/userManagerConfigList/roleIds/deptIds 的 []。⑦ org.role.list 的关键字过滤在 CLI 本地做(服务端无关键字面):r9 C2 实测 113 个角色的全量清单 34KB,只为找一个 code,用 search 收窄。",
83
84
  });
84
85
  /** Workflow template object (workflow/update|publish raw body). */
85
86
  export const workflowTemplateArg = z
@@ -118,6 +119,7 @@ export const WORKFLOW_LANE_CONTRACT = Object.freeze({
118
119
  bizObjectResolution: WORKFLOW_WIRE.bizObjectResolution,
119
120
  mutuallyExclusiveBinding: WORKFLOW_WIRE.mutuallyExclusiveBinding,
120
121
  userSearch: WORKFLOW_WIRE.userSearch,
122
+ organizationWrite: WORKFLOW_WIRE.organizationWrite,
121
123
  participantRoleValidation: WORKFLOW_WIRE.participantRoleValidation,
122
124
  }),
123
125
  wireBindings: Object.freeze({
@@ -137,6 +139,7 @@ export const WORKFLOW_LANE_CONTRACT = Object.freeze({
137
139
  bizObjectResolution: Object.freeze([emitterBinding("workflow-support.resolveBizObjectIdByInstance", assertWorkflowContract)]),
138
140
  mutuallyExclusiveBinding: Object.freeze([behaviorBinding("test/issue-14-workflow-bind-rule.test.ts#workflow.bindRule merges endEventHandler", assertWorkflowContract)]),
139
141
  userSearch: Object.freeze([behaviorBinding("test/round4-org-user-search.test.ts#org.user.search resolves a user by name into participant fields", assertWorkflowContract)]),
142
+ organizationWrite: Object.freeze([behaviorBinding("test/organization-write.test.ts#org.role.create resolves a role group CODE to the real id (no orphan role)", assertWorkflowContract)]),
140
143
  participantRoleValidation: Object.freeze([behaviorBinding("test/workflow-participant-role.test.ts#workflow.update refuses an unknown FindUserByRole role before the wire", assertWorkflowContract)]),
141
144
  }),
142
145
  evidence: Object.freeze([
@@ -153,6 +156,13 @@ export const WORKFLOW_LANE_CONTRACT = Object.freeze({
153
156
  scope: WORKFLOW_SCOPE,
154
157
  description: "Read the current PUBLISHED workflow template (`/api/api/workflow/get_published`). **默认返回 workflowSummary(activities + ruleBindings),不是整份正文**;节点级规则绑定按活动投影在 `workflowSummary.activities[].bizActions`({节点事件:[规则码]};流程级看 ruleBindings)。完整正文加 --full,或 `--jq 'data.activities[code=<活动>].<节点事件>.bizActions'` 这类**叶子**路径——对父节点 data.activities 取值会再次被折叠。在 workflow.publish / workflow.bindRule 之后用它确认发布后的绑定点。",
155
158
  }),
159
+ // R79 三期 T-A:应用内流程清单(注意:不能放在 tools 的首位——
160
+ // lane-contracts 的 assertDescriptionsDerive 用首个 tool 的 scope 匹配契约
161
+ // markdown,首位必须是 workflow.get_draft 的 WORKFLOW_SCOPE)。
162
+ "workflow.list": Object.freeze({
163
+ scope: "application workflow inventory (model-indexed)",
164
+ description: "应用内流程清单。平台**没有**流程模板清单端点——本面以模型为索引(平台惯例每模型至多一条流程;workflowCode 通常是 `<模型code>_flow`,以逐模型解析为准):应用树取模型 → 逐模型解析流程(isworkflow→getWorkflow)→ 读 get_published 摘要。行 `{modelCode,workflowCode,exists,published,ruleBindingCount}`;无流程的模型如实列 exists:false(不是错误),ruleBindingCount 含 flow 级 handler 与节点级事件绑定的规则码总数。上限 50 模型:超出回 partial + omittedModels,点查用 workflow.get_published {schemaCode}。查某条规则被哪些流程绑定用 rule.references kind=rule。",
165
+ }),
156
166
  "workflow.create": Object.freeze({
157
167
  scope: WORKFLOW_SCOPE,
158
168
  description: "创建工作流模板头(`/api/api/workflow/create`)。随后用 `workflow.update` 写入模板 JSON,再 `workflow.publish` 发布。**平台会自动生成含发起节点的草稿**(START → PARTICIPANT「填写申请单」participant={Originator} → PARTICIPANT「审批」participant 空 → END)——审批参与人必须显式补平台关键字(如 `{Originator}`=发起人),留空行为未知;get_draft 可核对自动草稿形状。",
@@ -199,7 +209,7 @@ export const WORKFLOW_LANE_CONTRACT = Object.freeze({
199
209
  }),
200
210
  "org.role.list": Object.freeze({
201
211
  scope: "workflow participant resolution",
202
- description: "列出组织角色(`GET /api/api/organization/role/list`),递归展开角色组,返回 {count, roleCount, groupCount, roles[{id,name,code,roleType,corpId,group,groupId,groupCode,groupName}], groups[{id,name,code,parentId,path,childCount}]}。**`count` 只数角色,不含角色组**——角色组是容器(平台行标记 `group:true`),旧版把空组当角色列出,曾让调用方把「19 个角色组」误读成「目标角色未创建」;`groups[].childCount` 才说明组内是否真的没有角色。`roles[].group` 是组名(兼容旧读法),写角色请用 `groupId`/`groupCode`。用于把审批节点的参与者解析成平台认识的引用。**真实参与者语法**(2026-09-23 生产观察):`participant` 只能是 (a) 关键字 `{Originator}`;(b) 参与者对象数组 JSON `[{\"code\":\"<roleCode>\",\"corpId\":\"<corpId|other>\",\"id\":\"<roleId>\",\"name\":\"<角色名>\",\"type\":2}]`(type 2=角色,3=用户;多个用 `+` 连接);(c) 函数表达式如 `FindUserByRole({Originator.OU},\"<roleCode>\",\"random\")`。**自由文本角色名(如 `部门负责人`)能 publish 但解析不到人、不生成待办**——先用本工具拿到 `code`/`id` 再构造对象数组。",
212
+ description: "列出组织角色(`GET /api/api/organization/role/list`),递归展开角色组,返回 {count, roleCount, groupCount, roles[{id,name,code,roleType,corpId,group,groupId,groupCode,groupName}], groups[{id,name,code,parentId,path,childCount}]}。**`count` 只数角色,不含角色组**——角色组是容器(平台行标记 `group:true`),旧版把空组当角色列出,曾让调用方把「19 个角色组」误读成「目标角色未创建」;`groups[].childCount` 才说明组内是否真的没有角色。`roles[].group` 是组名(兼容旧读法),写角色请用 `groupId`/`groupCode`。用于把审批节点的参与者解析成平台认识的引用。**参与者写法**:`participant` 的三形态(`{Originator}` / 角色对象数组(`type` 2=角色、3=用户) / 函数表达式)与自由文本名不生成待办的陷阱,见 `omc describe workflow.update --example workflow-approval-template-update`。",
203
213
  }),
204
214
  "org.department.list": Object.freeze({
205
215
  scope: "workflow participant resolution",
@@ -245,6 +255,7 @@ export function assertWorkflowContract() {
245
255
  if (!WORKFLOW_WIRE.renderCompat.includes("workflowRenderCompat"))
246
256
  throw new Error("workflow contract must pin workflow render compatibility readback");
247
257
  assertDescriptionCarries(WORKFLOW_LANE_CONTRACT, "workflow.get_draft", ["get_draft", "endEventHandler"]);
258
+ assertDescriptionCarries(WORKFLOW_LANE_CONTRACT, "workflow.list", ["模型为索引", "exists:false", "ruleBindingCount", "50", "kind=rule", "partial"]);
248
259
  assertDescriptionCarries(WORKFLOW_LANE_CONTRACT, "workflow.get_published", ["get_published", "workflow.publish"]);
249
260
  assertDescriptionCarries(WORKFLOW_LANE_CONTRACT, "workflow.create", ["workflow/create", "workflow.update", "workflow.publish"]);
250
261
  assertDescriptionCarries(WORKFLOW_LANE_CONTRACT, "workflow.update", ["workflow/update", "template", "rules", "activityType", "propertyPermissions", "CLI_ARGS_MAX_BYTES", "workflow-merge-would-drop-routes"]);
@@ -10,6 +10,7 @@ export const WORKFLOW_COVERAGE = declareLaneCoverage(WORKFLOW_LANE_CONTRACT.lane
10
10
  "r11 2026-10-23 (1.1.25): node form-button visibility = activity.buttonPermission.customBtns[].enabled; ActionPermissionHandler.setProcessButtonPermission filters FORM buttons by it (Playwright + backend source)",
11
11
  ],
12
12
  tools: [
13
+ claim("workflow.list", T["workflow.list"].scope),
13
14
  claim("workflow.get_draft", T["workflow.get_draft"].scope),
14
15
  claim("workflow.get_published", T["workflow.get_published"].scope),
15
16
  claim("workflow.create", T["workflow.create"].scope),
@@ -15,10 +15,13 @@ import { WORKFLOW_EVENT_HANDLER_FIELDS, WORKFLOW_NODE_EVENT_HANDLER_FIELDS, WORK
15
15
  import { PLATFORM_TRIGGER_RULE_CODES } from "./rule-graph.js";
16
16
  import { executeRuleEnableWrite } from "./rule-lifecycle.js";
17
17
  import { PLATFORM_ADMIN_START_BYPASS, resolvePermissionActor } from "../identity.js";
18
+ import { applicationResolutionOf, flattenTreeRows, resolveApplicationScope } from "../support.js";
18
19
  const WORKFLOW_LANE = WORKFLOW_LANE_CONTRACT.lane;
19
20
  const WORKFLOW_TOOLS = WORKFLOW_LANE_CONTRACT.tools;
20
21
  const WORKFLOW_ACTIVITY_TYPES = new Set(["START", "END", "CONNECTION", "PARTICIPANT", "SUB_INSTANCE", "CIRCULATE", "SYSTEM_ACTIVITY", "AGENT_ACTIVITY"]);
21
22
  const WORKFLOW_POINT = /^-?\d+(?:\.\d+)?,\s-?\d+(?:\.\d+)?$/;
23
+ /** workflow.list 的模型枚举上限:超出截断(partial + omittedModels + 点查指引)。 */
24
+ const WORKFLOW_LIST_MODEL_CAP = 50;
22
25
  /** Keep workitem.list's external envelope aligned with data.list. */
23
26
  export function workItemListCompactProjection(result) {
24
27
  const compact = {};
@@ -2152,6 +2155,28 @@ async function resolveWorkflowArg(session, args) {
2152
2155
  const workflowCode = code && typeof code.workflowCode === "string" && code.workflowCode ? code.workflowCode : null;
2153
2156
  return workflowCode;
2154
2157
  }
2158
+ export async function scanModelWorkflowBindings(session, schemaCode) {
2159
+ const workflowCode = await resolveWorkflowArg(session, { schemaCode });
2160
+ if (!workflowCode)
2161
+ return null;
2162
+ let pub;
2163
+ try {
2164
+ pub = await wireCall(session, { path: ENDPOINTS.workflowGetPublished, query: { workflowCode } });
2165
+ }
2166
+ catch (error) {
2167
+ if (isWorkflowAbsent(error))
2168
+ return null;
2169
+ throw error;
2170
+ }
2171
+ const data = (pub.data ?? null);
2172
+ const published = data !== null && (data.templateType === "PUBLISH" || data.published === true);
2173
+ const summary = workflowCompactProjection({ data: pub.data }).workflowSummary;
2174
+ const ruleBindings = summary?.ruleBindings ?? [];
2175
+ const nodeRuleBindings = summary?.nodeRuleBindings ?? [];
2176
+ const ruleBindingCount = ruleBindings.reduce((sum, binding) => sum + binding.ruleCodes.length, 0) +
2177
+ nodeRuleBindings.reduce((sum, binding) => sum + binding.ruleCodes.length, 0);
2178
+ return { workflowCode, published, ruleBindings, nodeRuleBindings, ruleBindingCount };
2179
+ }
2155
2180
  async function getWorkflowHeaderOrNull(session, workflowCode) {
2156
2181
  try {
2157
2182
  return ((await wireCall(session, { path: ENDPOINTS.workflowGetHeader, query: { workflowCode } })).data ?? null);
@@ -2454,6 +2479,104 @@ export function registerWorkflowLane(tools) {
2454
2479
  : { workflowCode, exists: true, data: draft };
2455
2480
  }, { full: args.full === true, compact: workflowCompactProjection, target: `workflow.get_draft:${args.workflowCode ?? args.schemaCode}` }),
2456
2481
  }));
2482
+ tools.push(defineTool({
2483
+ name: "workflow.list",
2484
+ search: { intents: ["流程清单", "应用有哪些流程", "列出流程", "查流程列表"] },
2485
+ layer: "low",
2486
+ kind: "read",
2487
+ lane: WORKFLOW_LANE,
2488
+ scope: WORKFLOW_TOOLS["workflow.list"].scope,
2489
+ description: WORKFLOW_TOOLS["workflow.list"].description,
2490
+ inputSchema: {
2491
+ environment: environmentArg,
2492
+ applicationCode: z.string().min(1).optional().describe("应用 code;省略按环境 profile / 租户首应用解析,回执 applicationResolution 回显实际扫了哪个应用"),
2493
+ capability: capabilityArg,
2494
+ },
2495
+ handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
2496
+ // R79 三期 T-A:应用内流程清单。平台没有流程模板清单端点(只有
2497
+ // list_permission/search_workitems/list_instances 运行时面),流程发现
2498
+ // 只能以模型为索引:应用树取模型 → 逐模型解析流程(isworkflow →
2499
+ // getWorkflow)→ 读 get_published 摘要。模型枚举沿 rule.references 的
2500
+ // 应用解析骨架(裸 bizmodels/list 在部分平台回空行,必须走应用树)。
2501
+ const scope = await resolveApplicationScope(session, args.applicationCode);
2502
+ const tree = wireRows((await wireCall(session, { path: ENDPOINTS.applicationTree, query: { appCode: scope.code } })).data);
2503
+ const modelRows = flattenTreeRows(tree).filter((row) => row.type === "BizModel" && typeof row.code === "string" && row.code !== "");
2504
+ const totalModels = modelRows.length;
2505
+ if (totalModels === 0) {
2506
+ // 空扫描 fail closed(同 references-scan-empty 判例):空 workflows 会被
2507
+ // 读成「应用没有流程」,必须拒绝并回显应用解析出处。
2508
+ throw new ToolRefusalError({
2509
+ status: "refused",
2510
+ blocker: "workflow-list-scan-empty",
2511
+ message: `应用 ${scope.code} 的模型树为空(0 个 BizModel)——本次没有枚举任何模型,空清单不代表「应用没有流程」;通常是 applicationCode 传错或该应用尚未发布模型`,
2512
+ applicationResolution: { ...applicationResolutionOf(scope), models: 0 },
2513
+ nextCommand: `omc call workflow.list --args '{"applicationCode":"<应用code>"}'(换应用重试)`,
2514
+ });
2515
+ }
2516
+ const capped = totalModels > WORKFLOW_LIST_MODEL_CAP;
2517
+ const scanRows = capped ? modelRows.slice(0, WORKFLOW_LIST_MODEL_CAP) : modelRows;
2518
+ const workflows = [];
2519
+ let withWorkflow = 0;
2520
+ let publishedCount = 0;
2521
+ let absentCount = 0;
2522
+ let readFailures = 0;
2523
+ for (const row of scanRows) {
2524
+ const modelCode = String(row.code);
2525
+ try {
2526
+ const face = await scanModelWorkflowBindings(session, modelCode);
2527
+ if (face === null) {
2528
+ absentCount += 1;
2529
+ workflows.push({ modelCode, workflowCode: null, exists: false, published: false, ruleBindingCount: 0 });
2530
+ continue;
2531
+ }
2532
+ withWorkflow += 1;
2533
+ if (face.published)
2534
+ publishedCount += 1;
2535
+ workflows.push({ modelCode, workflowCode: face.workflowCode, exists: true, published: face.published, ruleBindingCount: face.ruleBindingCount });
2536
+ }
2537
+ catch {
2538
+ // 单模型读失败不中断整轮清单;行级 readFailed 标注,不让一次失败
2539
+ // 变成整面错误(同 participantSearch 的容错口径)。
2540
+ readFailures += 1;
2541
+ workflows.push({ modelCode, workflowCode: null, exists: null, published: null, ruleBindingCount: null, readFailed: true });
2542
+ }
2543
+ }
2544
+ return {
2545
+ applicationResolution: { ...applicationResolutionOf(scope), models: totalModels },
2546
+ modelsCount: totalModels,
2547
+ scannedModels: scanRows.length,
2548
+ withWorkflow,
2549
+ publishedCount,
2550
+ absentCount,
2551
+ ...(readFailures > 0 ? { readFailures } : {}),
2552
+ workflows,
2553
+ wire: { plan: "1 应用树 + 每模型 isworkflow(无流程即止,1 wire)→ 有流程再 getWorkflow + get_published(共 3 wire)" },
2554
+ ...(capped
2555
+ ? {
2556
+ partial: true,
2557
+ omittedModels: totalModels - scanRows.length,
2558
+ note: `应用 ${scope.code} 共 ${totalModels} 个模型,超过 ${WORKFLOW_LIST_MODEL_CAP} 上限只扫前 ${WORKFLOW_LIST_MODEL_CAP} 个(按应用树序)——本清单不是全集`,
2559
+ nextCommand: `omc call workflow.get_published --args '{"schemaCode":"<模型code>"}'(点查未扫到的具体模型)`,
2560
+ }
2561
+ : {}),
2562
+ indexNote: "平台没有流程模板清单端点;本面以模型为索引(流程-模型一对一惯例,workflowCode 通常是 <模型code>_flow,以逐模型解析结果为准)——不在任何模型名下的流程不在本清单内",
2563
+ };
2564
+ }, {
2565
+ target: `workflow.list:${args.applicationCode ?? "*"}`,
2566
+ // 50 行 ≈ 4-5KB,超 2048B 通用读门会被折叠成 count+artifact——清单面恰恰
2567
+ // 要行内可扫(同 method.list 判例)。自带 compact 保整行;行数/体积超预算
2568
+ // 时显式 workflowsOmitted(不静默截断),正文在 detailArtifactId。
2569
+ compact: (result) => {
2570
+ const rows = Array.isArray(result.workflows) ? result.workflows : [];
2571
+ const keep = rows.length <= 50 && Buffer.byteLength(JSON.stringify(rows), "utf8") <= 8192;
2572
+ return {
2573
+ ...result,
2574
+ ...(keep ? {} : { workflowsOmitted: true, omittedWorkflows: rows.length, workflowsNote: "流程行超过内联预算(50 行 / 8KB)——完整行在 detailArtifactId" }),
2575
+ workflows: keep ? rows : [],
2576
+ };
2577
+ },
2578
+ }),
2579
+ }));
2457
2580
  tools.push(defineTool({
2458
2581
  name: "workflow.get_published",
2459
2582
  search: { intents: ["查看流程模板", "看流程", "查流程"] },
@@ -3957,7 +4080,7 @@ export function registerWorkflowLane(tools) {
3957
4080
  lane: WORKFLOW_LANE,
3958
4081
  scope: WORKFLOW_TOOLS["org.role.list"].scope,
3959
4082
  description: WORKFLOW_TOOLS["org.role.list"].description,
3960
- inputSchema: { environment: environmentArg, search: z.string().min(1).optional().describe("关键字过滤(CLI 侧,按 code/name 不区分大小写子串)——issue#9 C2:113 角色全量 dump 34KB 只为找一个角色 code 的实测痛点;服务端无关键字面,过滤在本地做"), expandAll: z.boolean().optional().describe("默认 true:展开所有角色组并带回角色。平台的 /role/list 只有 expandAll=true 才填 children(RoleController.list,1.1.25);传 false 只回角色组、roles 恒为空,别据此判断「角色未创建」"), capability: capabilityArg },
4083
+ inputSchema: { environment: environmentArg, search: z.string().min(1).optional().describe("关键字过滤(CLI 侧,按 code/name 不区分大小写子串);服务端无关键字面,过滤在本地做——避免为找一个 code 全量 dump"), expandAll: z.boolean().optional().describe("默认 true:展开所有角色组并带回角色。平台的 /role/list 只有 expandAll=true 才填 children(RoleController.list,1.1.25);传 false 只回角色组、roles 恒为空,别据此判断「角色未创建」"), capability: capabilityArg },
3961
4084
  handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
3962
4085
  // `/role/list` without `expandAll=true` only expands the FIRST group's
3963
4086
  // children (RoleController.list, 1.1.25), so a role created under any