@josephyan/qingflow-app-builder-mcp 0.2.0-beta.4 → 0.2.0-beta.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +1 -1
- package/pyproject.toml +3 -1
- package/skills/qingflow-app-builder/SKILL.md +154 -22
- package/skills/qingflow-app-builder/references/create-app.md +51 -21
- package/skills/qingflow-app-builder/references/environments.md +1 -1
- package/skills/qingflow-app-builder/references/flow-actors-and-permissions.md +123 -0
- package/skills/qingflow-app-builder/references/gotchas.md +28 -1
- package/skills/qingflow-app-builder/references/solution-playbooks.md +14 -12
- package/skills/qingflow-app-builder/references/tool-selection.md +45 -17
- package/skills/qingflow-app-builder/references/update-flow.md +112 -25
- package/skills/qingflow-app-builder/references/update-layout.md +11 -24
- package/skills/qingflow-app-builder/references/update-schema.md +1 -23
- package/skills/qingflow-app-builder/references/update-views.md +87 -21
- package/src/qingflow_mcp/__init__.py +1 -1
- package/src/qingflow_mcp/backend_client.py +189 -0
- package/src/qingflow_mcp/builder_facade/models.py +584 -1
- package/src/qingflow_mcp/builder_facade/service.py +4698 -262
- package/src/qingflow_mcp/config.py +39 -0
- package/src/qingflow_mcp/import_store.py +121 -0
- package/src/qingflow_mcp/list_type_labels.py +24 -0
- package/src/qingflow_mcp/server.py +131 -16
- package/src/qingflow_mcp/server_app_builder.py +132 -72
- package/src/qingflow_mcp/server_app_user.py +143 -187
- package/src/qingflow_mcp/solution/compiler/form_compiler.py +14 -4
- package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +41 -2
- package/src/qingflow_mcp/solution/executor.py +44 -7
- package/src/qingflow_mcp/tools/ai_builder_tools.py +1567 -144
- package/src/qingflow_mcp/tools/app_tools.py +243 -14
- package/src/qingflow_mcp/tools/approval_tools.py +411 -76
- package/src/qingflow_mcp/tools/directory_tools.py +203 -31
- package/src/qingflow_mcp/tools/feedback_tools.py +230 -0
- package/src/qingflow_mcp/tools/file_tools.py +1 -0
- package/src/qingflow_mcp/tools/import_tools.py +1164 -0
- package/src/qingflow_mcp/tools/portal_tools.py +31 -0
- package/src/qingflow_mcp/tools/record_tools.py +4943 -1025
- package/src/qingflow_mcp/tools/task_context_tools.py +1335 -0
- package/src/qingflow_mcp/tools/task_tools.py +376 -225
- package/src/qingflow_mcp/tools/workflow_tools.py +78 -4
package/README.md
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Install:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install @josephyan/qingflow-app-builder-mcp@0.2.0-beta.
|
|
6
|
+
npm install @josephyan/qingflow-app-builder-mcp@0.2.0-beta.41
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
Run:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npx -y -p @josephyan/qingflow-app-builder-mcp@0.2.0-beta.
|
|
12
|
+
npx -y -p @josephyan/qingflow-app-builder-mcp@0.2.0-beta.41 qingflow-app-builder-mcp
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Environment:
|
|
@@ -20,7 +20,7 @@ Environment:
|
|
|
20
20
|
|
|
21
21
|
This package bootstraps a local Python runtime on first install and then starts the `qingflow-app-builder-mcp` stdio MCP server.
|
|
22
22
|
|
|
23
|
-
Bundled
|
|
23
|
+
Bundled skills:
|
|
24
24
|
|
|
25
25
|
- `skills/qingflow-app-builder`
|
|
26
26
|
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "qingflow-mcp"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.0b41"
|
|
8
8
|
description = "User-authenticated MCP server for Qingflow"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -26,8 +26,10 @@ dependencies = [
|
|
|
26
26
|
"mcp>=1.9.4,<2.0.0",
|
|
27
27
|
"httpx>=0.27,<1.0",
|
|
28
28
|
"keyring>=25.5,<26.0",
|
|
29
|
+
"openpyxl>=3.1,<4.0",
|
|
29
30
|
"pydantic>=2.8,<3.0",
|
|
30
31
|
"pycryptodome>=3.20,<4.0",
|
|
32
|
+
"python-socketio[client]>=5.11,<6.0",
|
|
31
33
|
]
|
|
32
34
|
|
|
33
35
|
[project.optional-dependencies]
|
|
@@ -17,23 +17,77 @@ Before any write or verification flow, identify whether the task targets `test`
|
|
|
17
17
|
|
|
18
18
|
Pick the smallest tool layer that can finish the task.
|
|
19
19
|
|
|
20
|
+
## Shared Helper
|
|
21
|
+
|
|
22
|
+
- `feedback_submit` is a cross-cutting helper for product feedback submission
|
|
23
|
+
- It does not require Qingflow login or workspace selection
|
|
24
|
+
- If builder capability is unsupported or still cannot satisfy the need after reasonable use, summarize the gap, ask whether to submit feedback, and call `feedback_submit` only after explicit user confirmation.
|
|
25
|
+
|
|
26
|
+
## Mental Model
|
|
27
|
+
|
|
28
|
+
Model builder requests in four layers. Do not flatten them.
|
|
29
|
+
|
|
30
|
+
- `package`: the solution container or app bundle, for example “研发项目管理” or “费控管理系统”
|
|
31
|
+
- `app`: one form/app inside that package, for example “项目”, “需求”, “任务”, “缺陷”, “团队”
|
|
32
|
+
- `field`: one field inside one app
|
|
33
|
+
- `relation`: a field that links one app to another app
|
|
34
|
+
|
|
35
|
+
Interpret user intent with this hierarchy:
|
|
36
|
+
|
|
37
|
+
- If the user says “应用包”, “系统”, “包含多个表单”, “多个模块”, or asks for several named forms that relate to each other, treat it as a `package` with multiple `apps`
|
|
38
|
+
- Do not compress a multi-app system into one app with several text fields
|
|
39
|
+
- Names like “项目/需求/任务/缺陷/团队” or “费用申请/预算管理/报销审批” are usually separate apps, not text fields
|
|
40
|
+
- Build the apps first, then add `relation` fields to connect them
|
|
41
|
+
|
|
42
|
+
Default modeling rules:
|
|
43
|
+
|
|
44
|
+
- One business object -> one app
|
|
45
|
+
- Attributes of that object -> fields inside that app
|
|
46
|
+
- Another business object -> a separate app, not a text field
|
|
47
|
+
- Cross-object links -> relation fields, not text fields
|
|
48
|
+
|
|
20
49
|
- Authentication and workspace: `auth_*`, `workspace_*`
|
|
21
50
|
- File upload: `file_upload_local`
|
|
22
|
-
- Resource resolve/read: `package_list`, `package_resolve`, `app_resolve`, `app_read_summary`, `app_read_fields`, `app_read_layout_summary`, `app_read_views_summary`, `app_read_flow_summary`
|
|
23
|
-
- Resource
|
|
24
|
-
- Resource patch: `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, `app_views_apply`, `package_attach_app`
|
|
51
|
+
- Resource resolve/read: `package_list`, `package_resolve`, `package_create`, `builder_tool_contract`, `member_search`, `role_search`, `app_resolve`, `app_read_summary`, `app_read_fields`, `app_read_layout_summary`, `app_read_views_summary`, `app_read_flow_summary`, `app_read_charts_summary`, `portal_read_summary`
|
|
52
|
+
- Resource patch: `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, `app_views_apply`, `app_charts_apply`, `portal_apply`, `package_attach_app`, `app_release_edit_lock_if_mine`, `role_create`
|
|
25
53
|
- Publish and verify: `app_publish_verify`
|
|
26
54
|
|
|
27
55
|
Note:
|
|
28
56
|
- Do not try to handcraft raw Qingflow schema or internal solution payloads.
|
|
29
|
-
- Do not rely on low-level `view_*`, `workflow_*`, or `
|
|
30
|
-
- Public builder work should stay on the resource path: `resolve -> summary read ->
|
|
57
|
+
- Do not rely on low-level `view_*`, `workflow_*`, `qingbi_report_*`, or `portal_*` write payloads from public builder flows.
|
|
58
|
+
- Public builder work should stay on the resource path: `resolve -> summary read -> apply -> attach -> publish_verify`.
|
|
31
59
|
- `app_schema_apply` / `app_layout_apply` / `app_flow_apply` / `app_views_apply` publish by default; pass `publish=false` only when you intentionally want to leave changes in draft.
|
|
60
|
+
- `app_charts_apply` is immediate-live and does not publish; it resolves targets by `chart_id` first and then exact unique chart name.
|
|
61
|
+
- `portal_apply` uses replace semantics for sections; remove a section by omitting it from the next full sections list. `publish=false` only guarantees draft/base-info updates, and `chart_ref/view_ref` resolve by `id/key` first and exact unique name second.
|
|
62
|
+
- `app_read_charts_summary` is the compact discovery path for current chart inventory; use it before `app_charts_apply` when you need exact `chart_id` values.
|
|
63
|
+
- `portal_read_summary` is the compact discovery path for portal draft/live summaries; it returns section summaries, not the raw dash payload.
|
|
64
|
+
- `app_schema_apply` / `app_layout_apply` / `app_flow_apply` / `app_views_apply` now perform planning, normalization, and dependency checks internally; when prechecks block, read the returned blocking issues and `suggested_next_call` directly from the apply result.
|
|
65
|
+
- If you are unsure about a public builder tool's keys, aliases, presets, or minimal legal shape, call `builder_tool_contract` instead of guessing.
|
|
66
|
+
- For views, always write the canonical key `columns`. Do not emit `column_names`; treat `fields` only as a tolerated legacy alias, not the preferred shape.
|
|
67
|
+
- For flow presets, map natural language to canonical values before calling MCP:
|
|
68
|
+
- “默认审批/基础审批/普通审批” -> `basic_approval`
|
|
69
|
+
- “先填报再审批/提交后审批” -> `basic_fill_then_approve`
|
|
70
|
+
- Public flow building is intentionally limited to linear workflows:
|
|
71
|
+
- `start`
|
|
72
|
+
- `approve`
|
|
73
|
+
- `fill`
|
|
74
|
+
- `copy`
|
|
75
|
+
- `webhook`
|
|
76
|
+
- `end`
|
|
77
|
+
Do not generate `branch` or `condition` nodes in the public builder surface. The backend workflow route is not front-end stable for those node types.
|
|
78
|
+
- For first-time flow or view work in a session, read `builder_tool_contract` before planning so keys, aliases, presets, and minimal examples come from MCP instead of memory.
|
|
79
|
+
- For workflow assignees, prefer roles over explicit members:
|
|
80
|
+
- use `role_search` first
|
|
81
|
+
- use `member_search` only when the user explicitly names members or no stable role exists
|
|
82
|
+
- use `role_create` when the business owner wants a reusable directory role instead of hard-coded members
|
|
83
|
+
- On any `VALIDATION_ERROR`, inspect `suggested_next_call` first and prefer reusing the MCP-normalized arguments over re-guessing from the original natural language.
|
|
84
|
+
- If the current MCP capability is unsupported, the workflow is awkward, or the user's need still cannot be satisfied after reasonable use, summarize the gap, ask whether to submit feedback, and call `feedback_submit` only after explicit user confirmation.
|
|
32
85
|
|
|
33
86
|
Default policy:
|
|
34
87
|
|
|
35
|
-
- Creating or updating one app inside an existing package: resolve the package/app, read compact state,
|
|
36
|
-
-
|
|
88
|
+
- Creating or updating one app inside an existing package: resolve the package/app, read compact state, then apply schema/layout/flow/views patches explicitly.
|
|
89
|
+
- If package creation looks necessary or beneficial, ask the user to confirm before calling `package_create`.
|
|
90
|
+
- If the user describes a system/package with multiple forms or modules, do not start with `app_schema_apply` on the package name. Resolve or create the package first, then create each app separately.
|
|
37
91
|
|
|
38
92
|
## Standard Operating Order
|
|
39
93
|
|
|
@@ -45,18 +99,51 @@ Before any business tool:
|
|
|
45
99
|
|
|
46
100
|
For builder work:
|
|
47
101
|
|
|
48
|
-
1. Resolve the target package with `package_resolve
|
|
49
|
-
2.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
102
|
+
1. Resolve the target package with `package_resolve`; if resolution is ambiguous or you need a read-only fallback, use `package_list`. If you believe a new package should be created, ask the user to confirm before calling `package_create`.
|
|
103
|
+
2. Decide whether the target is one app or a multi-app package:
|
|
104
|
+
- one app: continue with `app_resolve`
|
|
105
|
+
- multi-app package/system: create or resolve the package, then create each app separately before adding relations
|
|
106
|
+
3. Resolve the target app with `app_resolve` if the request is an update.
|
|
107
|
+
4. Read only the smallest summary you need: `app_read_summary`, `app_read_fields`, `app_read_layout_summary`, `app_read_views_summary`, `app_read_flow_summary`, `app_read_charts_summary`, `portal_read_summary`.
|
|
108
|
+
5. Use `app_schema_apply` for create/upsert/remove field work. It publishes by default after the patch lands; noop schema requests do not publish.
|
|
53
109
|
6. If the app must belong to a package, use `package_attach_app` explicitly after schema work unless readback already shows the target `tag_id`.
|
|
54
|
-
7. Use `app_layout_apply` only when the user is explicitly changing layout. Prefer the default `mode=merge`; use `mode=replace` only when you intend to place every field explicitly. It publishes by default.
|
|
55
|
-
8. Use `app_flow_apply` after schema exists. It publishes by default.
|
|
56
|
-
9. Use `app_views_apply` when the user wants explicit
|
|
110
|
+
7. Use `app_layout_apply` only when the user is explicitly changing layout. Prefer the default `mode=merge`; use `mode=replace` only when you intend to place every field explicitly. It publishes by default after the patch lands; noop layout requests do not publish.
|
|
111
|
+
8. Use `app_flow_apply` after schema exists. It publishes by default; pass `publish=false` when you only want draft/precheck behavior.
|
|
112
|
+
9. Use `app_views_apply` when the user wants explicit table/card/board/gantt views. It publishes by default after the patch lands; noop view requests do not publish.
|
|
57
113
|
10. Use `app_publish_verify` only when the user explicitly wants final publish/live verification or you need an explicit verification pass.
|
|
58
|
-
|
|
59
|
-
|
|
114
|
+
11. If a write fails with `APP_EDIT_LOCKED`, stop normal writes. Only use `app_release_edit_lock_if_mine` when the failed result shows the lock owner is the current logged-in user.
|
|
115
|
+
|
|
116
|
+
For view work, keep the order strict:
|
|
117
|
+
|
|
118
|
+
1. `builder_tool_contract`
|
|
119
|
+
2. `app_read_fields`
|
|
120
|
+
3. `app_read_views_summary`
|
|
121
|
+
4. `app_views_apply`
|
|
122
|
+
5. `app_read_views_summary` again whenever `app_views_apply` returns `failed` or `partial_success`
|
|
123
|
+
|
|
124
|
+
For flow work, keep the order strict:
|
|
125
|
+
|
|
126
|
+
1. `builder_tool_contract`
|
|
127
|
+
2. `app_read_fields`
|
|
128
|
+
3. `app_read_flow_summary`
|
|
129
|
+
4. `role_search` or `member_search` if assignees need to come from the directory
|
|
130
|
+
5. `role_create` if the user wants a reusable role and no suitable role exists yet
|
|
131
|
+
6. Start from a canonical preset when possible
|
|
132
|
+
7. Use patch-style edits to that skeleton instead of freehand full-graph generation
|
|
133
|
+
8. When patching a preset skeleton, reuse the preset node ids:
|
|
134
|
+
- `basic_approval` -> patch `approve_1`
|
|
135
|
+
- `basic_fill_then_approve` -> patch `fill_1` and `approve_1`
|
|
136
|
+
Do not invent a second approval/fill node id unless you are intentionally replacing the skeleton and removing the preset node.
|
|
137
|
+
9. Declare approver/fill/copy assignees explicitly:
|
|
138
|
+
- prefer `assignees.role_names`
|
|
139
|
+
- support `assignees.member_names` / `assignees.member_emails` / `assignees.member_uids`
|
|
140
|
+
10. When a node must edit specific fields, declare `permissions.editable_fields`
|
|
141
|
+
11. `app_flow_apply`
|
|
142
|
+
12. `app_read_flow_summary` after apply whenever the user asked for verification or apply returns `partial_success`
|
|
143
|
+
13. Use `app_read_charts_summary` before chart work whenever exact current `chart_id` values matter
|
|
144
|
+
14. Use `app_charts_apply` for QingBI chart creation and updates, not raw `qingbi_report_*` writes
|
|
145
|
+
15. Use `portal_read_summary` before portal work whenever exact current draft/live section inventory matters
|
|
146
|
+
16. Use `portal_apply` for builder-side portal work; treat sections as a full replacement list
|
|
60
147
|
|
|
61
148
|
For additive work on existing systems:
|
|
62
149
|
|
|
@@ -69,38 +156,82 @@ For additive work on existing systems:
|
|
|
69
156
|
|
|
70
157
|
- When using `package_name`, expect deterministic resolution only on a unique exact package name match; if multiple packages match, stop and resolve the ambiguity instead of guessing
|
|
71
158
|
- `app_schema_apply` is the only public patch tool allowed to create an app shell; `app_layout_apply`, `app_flow_apply`, and `app_views_apply` require an existing app.
|
|
72
|
-
- Prefer
|
|
159
|
+
- Prefer reading compact state plus `builder_tool_contract` before `*_apply`; apply already performs server-side normalization and returns blocking issues or the next executable call shape when needed.
|
|
160
|
+
- For abstract requests like “默认视图”, “基础审批流”, “灵活流程”, or “美观布局”, first translate the intent into a stable preset or explicit patch. Do not send those phrases to MCP unchanged.
|
|
161
|
+
- If the user asks for a business system or package that contains several forms, do not use the system/package name as `app_name` and do not try to store the child app names as text fields.
|
|
162
|
+
- For flexible workflow requests, split the work into two steps:
|
|
163
|
+
1. create a base skeleton with a preset
|
|
164
|
+
2. apply explicit business-specific changes as patchable nodes/transitions
|
|
165
|
+
- For preset-based flows, treat preset node ids as part of the public contract. Patch the skeleton nodes by the same ids instead of creating a parallel node with a new id and leaving the preset node unassigned.
|
|
166
|
+
- Approval, fill, and copy nodes must declare at least one assignee. Treat this as a hard requirement, not an optional detail.
|
|
167
|
+
- For workflow nodes, use the canonical public shape:
|
|
168
|
+
- `assignees.role_names`
|
|
169
|
+
- `assignees.member_names`
|
|
170
|
+
- `permissions.editable_fields`
|
|
171
|
+
- For layout work, keep the public section shape canonical:
|
|
172
|
+
- `title`
|
|
173
|
+
- `rows`
|
|
174
|
+
Do not invent top-level layout `columns`, and do not prefer `fields` or `field_ids` once `rows` is known.
|
|
175
|
+
- Translate natural language like “一行四个字段 / 四列布局 / 每行放四个” into `rows` matrices, not guessed layout parameters.
|
|
176
|
+
- If the same layout-shape `VALIDATION_ERROR` repeats twice, stop guessing and re-read `builder_tool_contract(app_layout_apply)` or the layout reference before trying again.
|
|
177
|
+
- Do not guess role ids or member ids. Resolve them from the directory first.
|
|
73
178
|
- `app_schema_apply` does not treat package attachment as success criteria; if package ownership matters, verify `tag_ids_after` and call `package_attach_app` explicitly.
|
|
74
179
|
- `package_attach_app` is the source of truth for package ownership; do not assume app creation or publish implicitly attaches the app.
|
|
75
180
|
- `relation` and `subtable` must be explicit; do not infer them from vague natural language.
|
|
181
|
+
- Another app is not a field. If two business objects should both have their own records, build two apps and connect them with relation fields.
|
|
76
182
|
- In `prod`, prefer explicit patch tools and avoid any speculative create flow.
|
|
183
|
+
- Never try to bypass collaborative edit locks. `app_release_edit_lock_if_mine` is only for the case where the lock owner is the current authenticated user.
|
|
77
184
|
|
|
78
185
|
## Response Interpretation
|
|
79
186
|
|
|
80
187
|
- low-level list totals from the backend may report `0` while rows are present; prefer summary or aggregate readbacks for final conclusions
|
|
81
188
|
- `app_publish_verify` is the publish source of truth.
|
|
189
|
+
- All public builder tools expose top-level `warnings`, `verification`, and `verified`. Read them before deciding whether a run is fully done.
|
|
190
|
+
- For read tools, `status=success` can still pair with `verified=false` when some optional readback is unavailable; in that case prefer `warnings` and `verification` over the bare status code.
|
|
191
|
+
- For `app_charts_apply`, `portal_apply`, and `app_publish_verify`, treat `success` as “write and verification completed” and `partial_success` as “write executed but verification is incomplete”.
|
|
192
|
+
- For `app_schema_apply`, multiple relation fields are a known high-risk backend area. If you see `RELATION_FIELD_LIMIT_RISK` or `verification.relation_field_limit_verified=false`, do not describe the schema as fully safe.
|
|
193
|
+
- For `app_layout_apply`, trust `verification.layout_verified` first and `verification.layout_summary_verified` second. `LAYOUT_SUMMARY_UNVERIFIED` means the raw form readback is more trustworthy than the compact summary.
|
|
194
|
+
- For `app_views_apply`, treat `verification.views_verified` and `verification.view_filters_verified` separately. A created view with unverified filters is not a finished business view.
|
|
195
|
+
- For `app_flow_apply`, treat only linear node structure as publicly supported. If you see `FLOW_NODE_TYPE_UNSUPPORTED`, redesign the workflow as a stable linear flow instead of retrying branch/condition nodes.
|
|
82
196
|
- If readback mismatches the UI, compare `request_route` and do not assume the builder hit the same `qf_version` as the browser
|
|
83
197
|
- Treat post-write readback as the source of truth, not just write status codes
|
|
198
|
+
- For views, a top-level `VIEW_APPLY_FAILED` does not prove all requested views failed. Read back the view list and verify which views actually landed.
|
|
199
|
+
- For views, “view exists” is not the same as “filters are active”. If `app_views_apply` returns `partial_success`, `views_verified=false`, or `details.filter_mismatches`, report the view as created but the filters as unverified until readback confirms them.
|
|
200
|
+
- If multiple views share the same name, do not guess which one to update. Read `view_key` from `app_read_views_summary` and pass it explicitly in `upsert_views[]`.
|
|
201
|
+
- In final user-facing summaries, distinguish clearly between:
|
|
202
|
+
- contract is visible / canonical shape is known
|
|
203
|
+
- apply precheck succeeded
|
|
204
|
+
- apply landed and readback verified it
|
|
205
|
+
- base template/skeleton applied
|
|
206
|
+
- business-specific rules completed
|
|
207
|
+
- remaining gaps or follow-up patches
|
|
208
|
+
- Do not report “流程已满足业务需求” when only a preset skeleton has landed.
|
|
84
209
|
|
|
85
210
|
## Practical Patterns
|
|
86
211
|
|
|
87
212
|
- List packages: `package_list`
|
|
88
213
|
- Resolve one package: `package_resolve`
|
|
214
|
+
- Create one package: `package_create`
|
|
215
|
+
- Read one public tool contract: `builder_tool_contract`
|
|
89
216
|
- Resolve one app: `app_resolve`
|
|
90
217
|
- Read one app summary: `app_read_summary`
|
|
91
218
|
- Read fields only: `app_read_fields`
|
|
92
219
|
- Read layout summary: `app_read_layout_summary`
|
|
93
220
|
- Read views summary: `app_read_views_summary`
|
|
94
221
|
- Read flow summary: `app_read_flow_summary`
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
222
|
+
- Read chart summary: `app_read_charts_summary`
|
|
223
|
+
- Read portal summary: `portal_read_summary`
|
|
224
|
+
- Search members for workflow assignees: `member_search`
|
|
225
|
+
- Search roles for workflow assignees: `role_search`
|
|
226
|
+
- Create reusable workflow role: `role_create`
|
|
99
227
|
- Add/update/remove fields: `app_schema_apply`
|
|
100
228
|
- Merge or replace layout: `app_layout_apply`
|
|
101
229
|
- Replace workflow: `app_flow_apply`
|
|
102
230
|
- Upsert/remove views: `app_views_apply`
|
|
231
|
+
- Upsert/remove/reorder QingBI charts: `app_charts_apply`
|
|
232
|
+
- Create or replace-update portal pages: `portal_apply`
|
|
103
233
|
- Attach one app to a package: `package_attach_app`
|
|
234
|
+
- Release your own stale edit lock: `app_release_edit_lock_if_mine`
|
|
104
235
|
- Publish and verify: `app_publish_verify` when you need a separate verification pass beyond the default auto-publish behavior in apply tools
|
|
105
236
|
|
|
106
237
|
Detailed playbooks:
|
|
@@ -112,5 +243,6 @@ Detailed playbooks:
|
|
|
112
243
|
- Update fields only: [references/update-schema.md](references/update-schema.md)
|
|
113
244
|
- Update layout only: [references/update-layout.md](references/update-layout.md)
|
|
114
245
|
- Update workflow only: [references/update-flow.md](references/update-flow.md)
|
|
246
|
+
- Workflow assignees and node permissions: [references/flow-actors-and-permissions.md](references/flow-actors-and-permissions.md)
|
|
115
247
|
- Update views only: [references/update-views.md](references/update-views.md)
|
|
116
248
|
- Standard end-to-end builder sequences: [references/solution-playbooks.md](references/solution-playbooks.md)
|
|
@@ -2,52 +2,71 @@
|
|
|
2
2
|
|
|
3
3
|
Use this when the user wants one new app inside an existing package.
|
|
4
4
|
|
|
5
|
+
Do not use this playbook when the user is really asking for a system/package with multiple forms or modules. In that case:
|
|
6
|
+
|
|
7
|
+
1. resolve or create the package
|
|
8
|
+
2. create each app separately
|
|
9
|
+
3. attach each app to the package
|
|
10
|
+
4. add relation fields between apps
|
|
11
|
+
|
|
12
|
+
Hierarchy reminder:
|
|
13
|
+
|
|
14
|
+
- package -> app -> field -> relation
|
|
15
|
+
- another business object is another app, not a text field
|
|
16
|
+
|
|
17
|
+
If creating a brand new package would help, ask the user to confirm package creation first. After confirmation, call `package_create` before this sequence.
|
|
18
|
+
|
|
5
19
|
## Minimal sequence
|
|
6
20
|
|
|
7
21
|
1. `package_resolve`
|
|
8
22
|
2. `app_resolve`
|
|
9
|
-
3. `
|
|
10
|
-
4. `
|
|
11
|
-
5. `
|
|
12
|
-
|
|
23
|
+
3. `app_schema_apply`
|
|
24
|
+
4. `package_attach_app`
|
|
25
|
+
5. `app_publish_verify` only when the user asks for explicit final verification
|
|
26
|
+
|
|
27
|
+
## Multi-app systems are different
|
|
28
|
+
|
|
29
|
+
If the user says things like:
|
|
30
|
+
|
|
31
|
+
- “创建一个完整应用包”
|
|
32
|
+
- “包含项目、需求、任务、缺陷、团队这几个表单”
|
|
33
|
+
- “这些表单之间建立关联关系”
|
|
34
|
+
|
|
35
|
+
then do not treat that as one app.
|
|
36
|
+
|
|
37
|
+
Use this pattern instead:
|
|
38
|
+
|
|
39
|
+
1. `package_resolve` or `package_create`
|
|
40
|
+
2. for each app name, run `app_schema_apply -> package_attach_app`
|
|
41
|
+
3. once the apps exist, add `relation` fields between them
|
|
13
42
|
|
|
14
43
|
## Example
|
|
15
44
|
|
|
16
|
-
|
|
45
|
+
Create a new package only after the user confirms package creation:
|
|
17
46
|
|
|
18
47
|
```json
|
|
19
48
|
{
|
|
20
|
-
"tool_name": "
|
|
49
|
+
"tool_name": "package_create",
|
|
21
50
|
"arguments": {
|
|
22
51
|
"profile": "default",
|
|
23
|
-
"package_name": "
|
|
52
|
+
"package_name": "研发项目管理"
|
|
24
53
|
}
|
|
25
54
|
}
|
|
26
55
|
```
|
|
27
56
|
|
|
28
|
-
|
|
57
|
+
Resolve the package:
|
|
29
58
|
|
|
30
59
|
```json
|
|
31
60
|
{
|
|
32
|
-
"tool_name": "
|
|
61
|
+
"tool_name": "package_resolve",
|
|
33
62
|
"arguments": {
|
|
34
63
|
"profile": "default",
|
|
35
|
-
"
|
|
36
|
-
"package_tag_id": 1218950,
|
|
37
|
-
"create_if_missing": true,
|
|
38
|
-
"add_fields": [
|
|
39
|
-
{"name": "订单编号", "type": "text", "required": true},
|
|
40
|
-
{"name": "客户名称", "type": "text", "required": true},
|
|
41
|
-
{"name": "订单金额", "type": "amount"},
|
|
42
|
-
{"name": "状态", "type": "single_select", "options": ["草稿", "进行中", "已完成"], "required": true}
|
|
43
|
-
],
|
|
44
|
-
"update_fields": [],
|
|
45
|
-
"remove_fields": []
|
|
64
|
+
"package_name": "测试应用包"
|
|
46
65
|
}
|
|
47
66
|
}
|
|
48
67
|
```
|
|
49
68
|
|
|
50
|
-
Apply schema
|
|
69
|
+
Apply schema for a new app:
|
|
51
70
|
|
|
52
71
|
```json
|
|
53
72
|
{
|
|
@@ -68,6 +87,9 @@ Apply schema. This publishes by default:
|
|
|
68
87
|
"remove_fields": []
|
|
69
88
|
}
|
|
70
89
|
}
|
|
90
|
+
```
|
|
91
|
+
}
|
|
92
|
+
}
|
|
71
93
|
```
|
|
72
94
|
|
|
73
95
|
Attach explicitly if `tag_ids_after` does not yet contain the package:
|
|
@@ -96,3 +118,11 @@ The create route did not resolve in the current backend route context. Re-run `w
|
|
|
96
118
|
### `PACKAGE_ATTACH_FAILED`
|
|
97
119
|
|
|
98
120
|
Do not retry schema creation. Re-run only `package_attach_app`, then verify with `app_read_summary`.
|
|
121
|
+
|
|
122
|
+
### Hierarchy modeling mistake
|
|
123
|
+
|
|
124
|
+
If the user asked for several named forms/apps but the draft patch turns them into text fields inside one app, stop and remodel the task as:
|
|
125
|
+
|
|
126
|
+
- one package
|
|
127
|
+
- many apps
|
|
128
|
+
- relation fields between those apps
|
|
@@ -43,7 +43,7 @@ Builder behavior in prod:
|
|
|
43
43
|
- always identify the target package or app set before changing anything
|
|
44
44
|
- default to `preflight` or `plan` before any `apply`
|
|
45
45
|
- additive requirements should modify the existing package with ordinary tools by default
|
|
46
|
-
-
|
|
46
|
+
- if creating a new package seems necessary in prod, ask the user to confirm package creation first
|
|
47
47
|
- do not seed mock data unless the user explicitly approves it for production
|
|
48
48
|
- verify is mandatory after writes
|
|
49
49
|
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Flow Actors And Permissions
|
|
2
|
+
|
|
3
|
+
Use this when the workflow needs real assignees or node-level editable field permissions.
|
|
4
|
+
|
|
5
|
+
## Canonical policy
|
|
6
|
+
|
|
7
|
+
- Approval, fill, and copy nodes must declare at least one assignee.
|
|
8
|
+
- Prefer roles over explicit members.
|
|
9
|
+
- Resolve directory actors before calling `app_flow_apply`.
|
|
10
|
+
- Use canonical keys only:
|
|
11
|
+
- `assignees.role_names`
|
|
12
|
+
- `assignees.role_ids`
|
|
13
|
+
- `assignees.member_names`
|
|
14
|
+
- `assignees.member_emails`
|
|
15
|
+
- `assignees.member_uids`
|
|
16
|
+
- `permissions.editable_fields`
|
|
17
|
+
|
|
18
|
+
## Recommended order
|
|
19
|
+
|
|
20
|
+
1. `app_read_fields`
|
|
21
|
+
2. `app_read_flow_summary`
|
|
22
|
+
3. `role_search`
|
|
23
|
+
4. `member_search` when the user explicitly names people
|
|
24
|
+
5. `role_create` when no reusable role exists and the user wants role-based routing
|
|
25
|
+
6. `app_flow_apply`
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
### Route an approval node to a reusable role
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"tool_name": "app_flow_apply",
|
|
34
|
+
"arguments": {
|
|
35
|
+
"profile": "default",
|
|
36
|
+
"app_key": "APP_123",
|
|
37
|
+
"preset": "basic_approval",
|
|
38
|
+
"nodes": [
|
|
39
|
+
{
|
|
40
|
+
"id": "approve_1",
|
|
41
|
+
"type": "approve",
|
|
42
|
+
"name": "部门审批",
|
|
43
|
+
"assignees": {
|
|
44
|
+
"role_names": ["项目经理"]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Route to explicit members when the user names people
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"tool_name": "app_flow_apply",
|
|
57
|
+
"arguments": {
|
|
58
|
+
"profile": "default",
|
|
59
|
+
"app_key": "APP_123",
|
|
60
|
+
"preset": "basic_approval",
|
|
61
|
+
"nodes": [
|
|
62
|
+
{
|
|
63
|
+
"id": "approve_1",
|
|
64
|
+
"type": "approve",
|
|
65
|
+
"name": "部门审批",
|
|
66
|
+
"assignees": {
|
|
67
|
+
"member_names": ["严琪东", "张三"]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Let one node edit selected fields only
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"tool_name": "app_flow_apply",
|
|
80
|
+
"arguments": {
|
|
81
|
+
"profile": "default",
|
|
82
|
+
"app_key": "APP_123",
|
|
83
|
+
"mode": "replace",
|
|
84
|
+
"publish": true,
|
|
85
|
+
"nodes": [
|
|
86
|
+
{"id": "start", "type": "start", "name": "发起"},
|
|
87
|
+
{
|
|
88
|
+
"id": "approve_1",
|
|
89
|
+
"type": "approve",
|
|
90
|
+
"name": "部门审批",
|
|
91
|
+
"assignees": {
|
|
92
|
+
"role_names": ["项目经理"]
|
|
93
|
+
},
|
|
94
|
+
"permissions": {
|
|
95
|
+
"editable_fields": ["状态", "审批意见", "项目负责人"]
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{"id": "end", "type": "end", "name": "结束"}
|
|
99
|
+
],
|
|
100
|
+
"transitions": [
|
|
101
|
+
{"from": "start", "to": "approve_1"},
|
|
102
|
+
{"from": "approve_1", "to": "end"}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Common recovery
|
|
109
|
+
|
|
110
|
+
### `ROLE_NOT_FOUND` / `AMBIGUOUS_ROLE`
|
|
111
|
+
|
|
112
|
+
- retry with `role_search`
|
|
113
|
+
- if the business wants a reusable route and no exact role exists, create one with `role_create`
|
|
114
|
+
|
|
115
|
+
### `MEMBER_NOT_FOUND` / `AMBIGUOUS_MEMBER`
|
|
116
|
+
|
|
117
|
+
- retry with `member_search`
|
|
118
|
+
- do not guess user ids
|
|
119
|
+
|
|
120
|
+
### `UNKNOWN_FLOW_FIELD`
|
|
121
|
+
|
|
122
|
+
- reread fields with `app_read_fields`
|
|
123
|
+
- only pass real current field names to `permissions.editable_fields`
|
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
- Treat `package_attach_app` as the source of truth for package ownership
|
|
12
12
|
- Check `tag_ids_after` after schema writes
|
|
13
13
|
|
|
14
|
+
## Package vs app vs field
|
|
15
|
+
|
|
16
|
+
- A package/system is not an app
|
|
17
|
+
- Another app is not a field
|
|
18
|
+
- If the user names multiple forms/modules that relate to each other, create multiple apps and connect them with relation fields
|
|
19
|
+
- Do not use child app names like “项目/需求/任务/缺陷/团队” as plain text fields inside one app
|
|
20
|
+
|
|
14
21
|
## Auto publish
|
|
15
22
|
|
|
16
23
|
- `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, and `app_views_apply` publish by default
|
|
@@ -23,11 +30,17 @@
|
|
|
23
30
|
- Use `app_read_fields` before schema or view work
|
|
24
31
|
- Use `app_read_layout_summary` before layout work
|
|
25
32
|
- Use `app_read_flow_summary` before workflow work
|
|
33
|
+
- Use `app_read_views_summary` before view work
|
|
26
34
|
|
|
27
35
|
## Workflow dependencies
|
|
28
36
|
|
|
29
37
|
- Approval-style flows usually require an explicit status field
|
|
30
|
-
-
|
|
38
|
+
- Approval, fill, and copy nodes also require at least one assignee
|
|
39
|
+
- Prefer roles over explicit members unless the user explicitly names people
|
|
40
|
+
- Resolve assignees with `role_search` / `member_search` before flow apply
|
|
41
|
+
- Use `permissions.editable_fields` for node-level editable field permissions; do not guess field ids
|
|
42
|
+
- Preset node ids matter. When patching `basic_approval` or `basic_fill_then_approve`, reuse `approve_1` and `fill_1` unless you are explicitly replacing the skeleton.
|
|
43
|
+
- If `app_flow_apply` reports `FLOW_DEPENDENCY_MISSING`, fix schema first
|
|
31
44
|
- Do not switch to hidden `solution_*` tools from public builder flows
|
|
32
45
|
|
|
33
46
|
## Retry discipline
|
|
@@ -35,3 +48,17 @@
|
|
|
35
48
|
- If a write returns `partial_success`, read back before retrying
|
|
36
49
|
- Do not repeat create steps after `app_key` already exists
|
|
37
50
|
- For backend rejects, keep the retry narrow: retry only the failed tool, not the whole chain
|
|
51
|
+
- For `VALIDATION_ERROR`, do not keep guessing. Reuse `suggested_next_call`, `canonical_arguments`, `allowed_keys`, and `allowed_values` first.
|
|
52
|
+
- For layout `VALIDATION_ERROR`, also inspect `section_allowed_keys`, `section_aliases`, and `minimal_section_example`. If the same layout-shape error repeats twice, stop free-form retries and re-read `builder_tool_contract(app_layout_apply)`.
|
|
53
|
+
- For flow work, do not replay internal keys from old logs or plan outputs. Public builder calls should stay on:
|
|
54
|
+
- `assignees.role_ids` / `assignees.member_uids` / `assignees.member_emails`
|
|
55
|
+
- `permissions.editable_fields`
|
|
56
|
+
- For view work, treat `columns` as the only canonical public key. `app_read_views_summary` and `app_views_apply` should all be read and written in that shape.
|
|
57
|
+
- For layout work, treat `title + rows` as the only canonical public section shape. `fields`, `field_ids`, and `columns` may appear in legacy/internal shapes, but they are not the preferred public write shape.
|
|
58
|
+
- A created view is not enough to claim a filter succeeded. When `app_views_apply` returns `partial_success`, `views_verified=false`, or `details.filter_mismatches`, treat the view as present but the filter as unverified.
|
|
59
|
+
- If duplicate view names exist, do not retry by name. Read the exact `view_key` and target that one.
|
|
60
|
+
- If a view or flow write fails, report the smallest next action:
|
|
61
|
+
- wrong key -> switch to canonical key
|
|
62
|
+
- unsupported preset -> switch to allowed canonical preset
|
|
63
|
+
- backend reject -> re-read summary and retry only the failed patch
|
|
64
|
+
- Do not translate abstract user phrases like “灵活流程” or “默认视图” directly into MCP arguments. First convert them to a preset or explicit patch plan.
|
|
@@ -6,40 +6,42 @@ Use these when you need a quick reminder of the standard v2 builder sequences.
|
|
|
6
6
|
|
|
7
7
|
1. `package_resolve`
|
|
8
8
|
2. `app_resolve`
|
|
9
|
-
3. `
|
|
10
|
-
4. `
|
|
11
|
-
5. `
|
|
12
|
-
6. `app_publish_verify` only if the user asks for explicit live verification
|
|
9
|
+
3. `app_schema_apply`
|
|
10
|
+
4. `package_attach_app`
|
|
11
|
+
5. `app_publish_verify` only if the user asks for explicit live verification
|
|
13
12
|
|
|
14
13
|
## Update fields on an existing app
|
|
15
14
|
|
|
16
15
|
1. `app_resolve`
|
|
17
16
|
2. `app_read_fields`
|
|
18
|
-
3. `
|
|
19
|
-
4. `app_schema_apply`
|
|
17
|
+
3. `app_schema_apply`
|
|
20
18
|
|
|
21
19
|
## Rework layout
|
|
22
20
|
|
|
23
21
|
1. `app_read_layout_summary`
|
|
24
|
-
2. `
|
|
25
|
-
3. `app_layout_apply`
|
|
22
|
+
2. `app_layout_apply`
|
|
26
23
|
|
|
27
24
|
Prefer `mode=merge`. Use `mode=replace` only when every field placement is intentional.
|
|
28
25
|
|
|
29
26
|
## Add or update workflow
|
|
30
27
|
|
|
31
28
|
1. `app_read_fields`
|
|
32
|
-
2. `
|
|
33
|
-
3. `
|
|
29
|
+
2. `app_read_flow_summary`
|
|
30
|
+
3. `role_search` or `member_search`
|
|
31
|
+
4. `role_create` if the business wants a reusable role and no good exact role exists
|
|
32
|
+
5. `app_flow_apply`
|
|
34
33
|
|
|
35
|
-
If `
|
|
34
|
+
If `app_flow_apply` reports `FLOW_DEPENDENCY_MISSING`, fix schema first.
|
|
35
|
+
If it reports `FLOW_ASSIGNEE_REQUIRED`, resolve roles or members first and retry with canonical `assignees.*`.
|
|
36
36
|
|
|
37
37
|
## Add or update views
|
|
38
38
|
|
|
39
39
|
1. `app_read_fields`
|
|
40
|
-
2. `
|
|
40
|
+
2. `app_read_views_summary`
|
|
41
41
|
3. `app_views_apply`
|
|
42
42
|
|
|
43
|
+
For both workflow and view work, prefer `suggested_next_call` over re-guessing arguments after a validation failure.
|
|
44
|
+
|
|
43
45
|
## Final readback
|
|
44
46
|
|
|
45
47
|
Prefer these fields after writes:
|