@josephyan/qingflow-app-builder-mcp 0.2.0-beta.7 → 0.2.0-beta.71
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 +5 -3
- package/docs/local-agent-install.md +21 -5
- package/npm/bin/qingflow-app-builder-mcp.mjs +1 -1
- package/npm/lib/runtime.mjs +168 -12
- package/package.json +1 -1
- package/pyproject.toml +4 -1
- package/skills/qingflow-app-builder/SKILL.md +155 -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 +47 -19
- 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/skills/qingflow-app-builder-code-integrations/SKILL.md +137 -0
- package/skills/qingflow-app-builder-code-integrations/agents/openai.yaml +4 -0
- package/skills/qingflow-app-builder-code-integrations/references/code-block.md +66 -0
- package/skills/qingflow-app-builder-code-integrations/references/q-linker.md +77 -0
- package/src/qingflow_mcp/__init__.py +1 -1
- package/src/qingflow_mcp/backend_client.py +210 -0
- package/src/qingflow_mcp/builder_facade/models.py +1252 -3
- package/src/qingflow_mcp/builder_facade/service.py +11367 -2389
- package/src/qingflow_mcp/cli/__init__.py +1 -0
- package/src/qingflow_mcp/cli/commands/__init__.py +15 -0
- package/src/qingflow_mcp/cli/commands/app.py +40 -0
- package/src/qingflow_mcp/cli/commands/auth.py +78 -0
- package/src/qingflow_mcp/cli/commands/builder.py +515 -0
- package/src/qingflow_mcp/cli/commands/common.py +62 -0
- package/src/qingflow_mcp/cli/commands/imports.py +96 -0
- package/src/qingflow_mcp/cli/commands/record.py +304 -0
- package/src/qingflow_mcp/cli/commands/task.py +89 -0
- package/src/qingflow_mcp/cli/commands/workspace.py +33 -0
- package/src/qingflow_mcp/cli/context.py +48 -0
- package/src/qingflow_mcp/cli/formatters.py +355 -0
- package/src/qingflow_mcp/cli/json_io.py +50 -0
- package/src/qingflow_mcp/cli/main.py +149 -0
- 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/response_trim.py +668 -0
- package/src/qingflow_mcp/server.py +160 -18
- package/src/qingflow_mcp/server_app_builder.py +275 -68
- package/src/qingflow_mcp/server_app_user.py +219 -191
- package/src/qingflow_mcp/session_store.py +41 -1
- package/src/qingflow_mcp/solution/compiler/form_compiler.py +43 -4
- package/src/qingflow_mcp/solution/compiler/icon_utils.py +119 -45
- package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +41 -2
- package/src/qingflow_mcp/solution/executor.py +107 -11
- package/src/qingflow_mcp/solution/spec_models.py +2 -0
- package/src/qingflow_mcp/tools/ai_builder_tools.py +2032 -127
- package/src/qingflow_mcp/tools/app_tools.py +419 -12
- package/src/qingflow_mcp/tools/approval_tools.py +571 -72
- package/src/qingflow_mcp/tools/auth_tools.py +398 -2
- package/src/qingflow_mcp/tools/code_block_tools.py +756 -0
- package/src/qingflow_mcp/tools/custom_button_tools.py +179 -0
- 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 +2150 -0
- package/src/qingflow_mcp/tools/package_tools.py +18 -4
- package/src/qingflow_mcp/tools/portal_tools.py +31 -0
- package/src/qingflow_mcp/tools/qingbi_report_tools.py +109 -7
- package/src/qingflow_mcp/tools/record_tools.py +9894 -1104
- package/src/qingflow_mcp/tools/solution_tools.py +115 -3
- package/src/qingflow_mcp/tools/task_context_tools.py +2040 -0
- package/src/qingflow_mcp/tools/task_tools.py +376 -225
- package/src/qingflow_mcp/tools/workspace_tools.py +163 -19
|
@@ -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:
|
|
@@ -4,15 +4,30 @@ Use the smallest v2 builder tool chain that can finish the task.
|
|
|
4
4
|
|
|
5
5
|
## Default path
|
|
6
6
|
|
|
7
|
-
`resolve -> summary read ->
|
|
7
|
+
`resolve -> summary read -> apply -> attach -> publish_verify`
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Public builder `apply` tools already perform server-side planning, normalization, and dependency checks internally. Do not route normal public builder work through explicit `*_plan` tools.
|
|
10
|
+
|
|
11
|
+
## Hierarchy first
|
|
12
|
+
|
|
13
|
+
Before picking tools, decide which layer the request targets:
|
|
14
|
+
|
|
15
|
+
- `package`: a solution/app bundle like “研发项目管理” or “费控管理系统”
|
|
16
|
+
- `app`: one form/app inside that package
|
|
17
|
+
- `field`: one field inside one app
|
|
18
|
+
- `relation`: a field that links two apps
|
|
19
|
+
|
|
20
|
+
If the user asks for multiple forms/modules that relate to each other, this is a package-level multi-app task, not a single-app create.
|
|
10
21
|
|
|
11
22
|
## Resolve
|
|
12
23
|
|
|
24
|
+
- `package_create`: create a new package only after the user confirms package creation; exact-name duplicates return `noop=true`
|
|
13
25
|
- `package_resolve`: exact package lookup by name
|
|
14
26
|
- `package_list`: read-only fallback when package resolution is ambiguous
|
|
15
|
-
- `
|
|
27
|
+
- `member_search`: resolve named people from the directory
|
|
28
|
+
- `role_search`: resolve reusable roles from the directory
|
|
29
|
+
- `role_create`: create a reusable role when the business owner wants role-based routing
|
|
30
|
+
- `app_resolve`: locate an existing app by exactly one selector mode: `app_key`, or `app_name + package_tag_id`
|
|
16
31
|
|
|
17
32
|
## Summary reads
|
|
18
33
|
|
|
@@ -21,15 +36,8 @@ Use `plan` before `apply` unless the patch is trivial and already normalized.
|
|
|
21
36
|
- `app_read_layout_summary`: sections, rows, unplaced fields
|
|
22
37
|
- `app_read_views_summary`: current view names, types, columns, group-by
|
|
23
38
|
- `app_read_flow_summary`: workflow enabled state, nodes, transitions
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Use these when the patch is non-trivial or the model is likely to drift.
|
|
28
|
-
|
|
29
|
-
- `app_schema_plan`: normalize field patches before add/update/remove
|
|
30
|
-
- `app_layout_plan`: preview merge/replace layout changes or layout presets
|
|
31
|
-
- `app_flow_plan`: validate workflow nodes, transitions, and dependencies
|
|
32
|
-
- `app_views_plan`: normalize view aliases and validate referenced fields
|
|
39
|
+
- `app_read_charts_summary`: current chart ids, names, types, order
|
|
40
|
+
- `portal_read_summary`: current draft/live portal metadata and compact section inventory
|
|
33
41
|
|
|
34
42
|
## Apply tools
|
|
35
43
|
|
|
@@ -39,27 +47,47 @@ These execute normalized patches and publish by default unless `publish=false`.
|
|
|
39
47
|
- `app_layout_apply`: merge or replace layout
|
|
40
48
|
- `app_flow_apply`: replace workflow
|
|
41
49
|
- `app_views_apply`: upsert or remove views
|
|
50
|
+
- `app_charts_apply`: upsert/remove/reorder QingBI charts; charts are immediate-live and do not publish; use `chart_id` when names are not unique
|
|
51
|
+
- `portal_apply`: create or replace-update portal pages; use `dash_key` for update mode or `package_tag_id + dash_name` for create mode; sections are replace-only and omission deletes old sections; `publish=false` only guarantees draft/base-info updates
|
|
42
52
|
|
|
43
53
|
## Explicit post-apply tools
|
|
44
54
|
|
|
45
|
-
- `package_attach_app`: attach an app to a package
|
|
55
|
+
- `package_attach_app`: attach an app to a package with `tag_id + app_key`; do not assume create or publish attaches it
|
|
46
56
|
- `app_publish_verify`: explicit final publish verification when the user asks for live confirmation
|
|
47
57
|
|
|
48
58
|
## Decision shortcuts
|
|
49
59
|
|
|
50
60
|
- Create one app inside an existing package:
|
|
51
|
-
`package_resolve -> app_resolve ->
|
|
61
|
+
`package_resolve -> app_resolve -> app_schema_apply -> package_attach_app`
|
|
62
|
+
- Create a brand new package, then create one app in it:
|
|
63
|
+
`package_create -> package_resolve -> app_schema_apply -> package_attach_app`
|
|
64
|
+
- Create a brand new multi-app system/package:
|
|
65
|
+
`package_create/resolve -> per-app app_schema_apply -> package_attach_app per app -> relation field patches`
|
|
52
66
|
- Update fields on an existing app:
|
|
53
|
-
`app_resolve -> app_read_fields ->
|
|
67
|
+
`app_resolve -> app_read_fields -> app_schema_apply`
|
|
54
68
|
- Tidy layout:
|
|
55
|
-
`app_read_layout_summary ->
|
|
69
|
+
`app_read_fields -> app_read_layout_summary -> builder_tool_contract (if shape is unclear) -> app_layout_apply`
|
|
56
70
|
- Add workflow:
|
|
57
|
-
`app_read_fields ->
|
|
71
|
+
`builder_tool_contract -> app_read_fields -> app_read_flow_summary -> role_search/member_search -> app_flow_apply -> app_read_flow_summary`
|
|
58
72
|
- Add views:
|
|
59
|
-
`app_read_fields ->
|
|
73
|
+
`builder_tool_contract -> app_read_fields -> app_read_views_summary -> app_views_apply -> app_read_views_summary`
|
|
74
|
+
- Add QingBI charts:
|
|
75
|
+
`builder_tool_contract -> app_read_fields -> app_read_charts_summary -> app_charts_apply -> app_read_charts_summary`
|
|
76
|
+
- Create or update a portal:
|
|
77
|
+
`builder_tool_contract -> portal_read_summary -> portal_apply -> portal_read_summary`
|
|
60
78
|
|
|
61
79
|
## Avoid
|
|
62
80
|
|
|
63
81
|
- Do not handcraft raw Qingflow schema payloads
|
|
64
82
|
- Do not rely on internal `solution_*` tools in public builder flows
|
|
65
|
-
- Do not create a new package
|
|
83
|
+
- Do not create a new package without first asking the user to confirm package creation
|
|
84
|
+
- Do not treat a package/system name as `app_name` when the user clearly wants multiple apps inside it
|
|
85
|
+
- Do not compress multiple business objects into one app with several text fields
|
|
86
|
+
- Do not skip summary reads before flow or view work
|
|
87
|
+
- Do not emit `column_names`; always use `columns`
|
|
88
|
+
- Do not model layout shape with `fields`, `field_ids`, or top-level `columns`; custom layout sections should be `title + rows`
|
|
89
|
+
- Do not reuse internal flow keys such as `role_entries` or `editable_que_ids` in public builder calls
|
|
90
|
+
- Do not pass natural-language preset guesses such as `default_approval`; map them to canonical preset values first
|
|
91
|
+
- Do not omit assignees on approval/fill/copy nodes
|
|
92
|
+
- Do not patch preset flows with brand new approval/fill node ids unless you are intentionally replacing the skeleton; reuse preset ids like `approve_1` and `fill_1`
|
|
93
|
+
- Do not guess role ids, member ids, or editable field ids; resolve names first
|
|
@@ -4,27 +4,31 @@ Use this when the app already exists and the task is only about workflow.
|
|
|
4
4
|
|
|
5
5
|
## Minimal sequence
|
|
6
6
|
|
|
7
|
-
1. `
|
|
8
|
-
2. `
|
|
9
|
-
3. `
|
|
10
|
-
4. `
|
|
7
|
+
1. `builder_tool_contract(tool_name="app_flow_apply")`
|
|
8
|
+
2. `app_read_fields`
|
|
9
|
+
3. `app_read_flow_summary`
|
|
10
|
+
4. `role_search` or `member_search`
|
|
11
|
+
5. `role_create` if the user wants a reusable directory role and no good role exists
|
|
12
|
+
6. start from a canonical preset when possible
|
|
13
|
+
7. patch the skeleton instead of freehanding a full graph
|
|
14
|
+
8. reuse preset node ids when patching:
|
|
15
|
+
- `basic_approval` -> patch `approve_1`
|
|
16
|
+
- `basic_fill_then_approve` -> patch `fill_1` and `approve_1`
|
|
17
|
+
Do not add a second approval/fill node with a new id unless you are intentionally replacing the skeleton.
|
|
18
|
+
The MCP now auto-aligns the simplest single-node preset overrides, but still prefer explicit preset ids so the merged graph stays predictable.
|
|
19
|
+
9. `app_flow_apply`
|
|
20
|
+
10. `app_read_flow_summary` when apply returns `partial_success` or the user asked for verification
|
|
21
|
+
|
|
22
|
+
If you are unsure about presets or node shapes, call `builder_tool_contract(tool_name="app_flow_apply")` before guessing.
|
|
11
23
|
|
|
12
24
|
## Example
|
|
13
25
|
|
|
14
|
-
|
|
26
|
+
Canonical preset mapping:
|
|
15
27
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"tool_name": "app_flow_plan",
|
|
19
|
-
"arguments": {
|
|
20
|
-
"profile": "default",
|
|
21
|
-
"app_key": "APP_123",
|
|
22
|
-
"preset": "basic_approval"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
```
|
|
28
|
+
- “默认审批/基础审批/普通审批” -> `basic_approval`
|
|
29
|
+
- “先填报再审批/提交后审批” -> `basic_fill_then_approve`
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
Apply a simple approval flow with a role assignee and node-level editable fields:
|
|
28
32
|
|
|
29
33
|
```json
|
|
30
34
|
{
|
|
@@ -32,40 +36,123 @@ Or use explicit nodes:
|
|
|
32
36
|
"arguments": {
|
|
33
37
|
"profile": "default",
|
|
34
38
|
"app_key": "APP_123",
|
|
35
|
-
"
|
|
39
|
+
"preset": "basic_approval",
|
|
36
40
|
"publish": true,
|
|
37
41
|
"nodes": [
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
{
|
|
43
|
+
"id": "approve_1",
|
|
44
|
+
"type": "approve",
|
|
45
|
+
"name": "部门审批",
|
|
46
|
+
"assignees": {
|
|
47
|
+
"role_names": ["项目经理"]
|
|
48
|
+
},
|
|
49
|
+
"permissions": {
|
|
50
|
+
"editable_fields": ["状态", "审批意见"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
45
53
|
]
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
```
|
|
49
57
|
|
|
58
|
+
For flexible business requirements, do not jump straight to a full custom graph. Use this safer pattern:
|
|
59
|
+
|
|
60
|
+
1. build a base skeleton from a preset
|
|
61
|
+
2. identify the business-specific changes
|
|
62
|
+
3. patch nodes/transitions explicitly
|
|
63
|
+
|
|
64
|
+
Public flow building is intentionally limited to linear workflows. Use only:
|
|
65
|
+
|
|
66
|
+
- `start`
|
|
67
|
+
- `approve`
|
|
68
|
+
- `fill`
|
|
69
|
+
- `copy`
|
|
70
|
+
- `webhook`
|
|
71
|
+
- `end`
|
|
72
|
+
|
|
73
|
+
Do not generate `branch` or `condition` nodes through `app_flow_apply`. The backend workflow route is not front-end stable for those node types, and MCP now returns `FLOW_NODE_TYPE_UNSUPPORTED` instead of writing a visually broken flow.
|
|
74
|
+
After `app_flow_apply` returns blocking issues or canonical arguments, prefer reusing its `suggested_next_call.arguments` directly. Do not rewrite the result into internal fields such as `role_entries` or `editable_que_ids`.
|
|
75
|
+
When you patch a preset, patch the preset node itself. Do not leave the preset approval node unassigned while adding a second custom approval node.
|
|
76
|
+
|
|
50
77
|
## Common failures
|
|
51
78
|
|
|
79
|
+
### `FLOW_ASSIGNEE_REQUIRED`
|
|
80
|
+
|
|
81
|
+
Approval, fill, and copy nodes must declare at least one assignee.
|
|
82
|
+
|
|
83
|
+
If this happens after using a preset, check for this specific mistake first:
|
|
84
|
+
|
|
85
|
+
- the preset created `approve_1` or `fill_1`
|
|
86
|
+
- your patch created a different node id instead of patching that preset node
|
|
87
|
+
- the original preset node remained in the graph without assignees
|
|
88
|
+
|
|
89
|
+
Preferred fix order:
|
|
90
|
+
|
|
91
|
+
1. `role_search`
|
|
92
|
+
2. `member_search` only if the user explicitly named members
|
|
93
|
+
3. `role_create` if the business needs a reusable role
|
|
94
|
+
4. patch the preset node id itself with canonical `assignees.*`
|
|
95
|
+
5. retry `app_flow_apply`
|
|
96
|
+
|
|
52
97
|
### `FLOW_DEPENDENCY_MISSING`
|
|
53
98
|
|
|
54
99
|
The workflow depends on fields that do not exist yet, usually `status`. Fix schema first.
|
|
55
100
|
|
|
101
|
+
Preferred recovery:
|
|
102
|
+
|
|
103
|
+
1. use the returned `suggested_next_call`
|
|
104
|
+
2. apply the minimal schema patch
|
|
105
|
+
3. rerun `app_read_fields`
|
|
106
|
+
4. rerun `app_flow_apply`
|
|
107
|
+
|
|
56
108
|
### `INVALID_FLOW_EDGE`
|
|
57
109
|
|
|
58
110
|
One or more transitions reference unknown nodes or create an invalid graph.
|
|
59
111
|
|
|
112
|
+
### `UNKNOWN_FLOW_FIELD`
|
|
113
|
+
|
|
114
|
+
The workflow referenced a field name that does not exist, often in:
|
|
115
|
+
|
|
116
|
+
- `permissions.editable_fields`
|
|
117
|
+
|
|
118
|
+
Call `app_read_fields` and retry with the exact field names returned by the app.
|
|
119
|
+
|
|
120
|
+
### `FLOW_NODE_TYPE_UNSUPPORTED`
|
|
121
|
+
|
|
122
|
+
The public workflow builder only supports linear flows. Remove `branch` and `condition` nodes and redesign the flow with stable sequential nodes instead of retrying the same graph.
|
|
123
|
+
|
|
60
124
|
### `STATUS_FIELD_REQUIRED`
|
|
61
125
|
|
|
62
126
|
The app has no explicit status field recognized by the internal workflow compiler. Add one with `app_schema_apply`, then retry.
|
|
63
127
|
|
|
64
128
|
### `FLOW_STAGE_CONTEXT_MISSING`
|
|
65
129
|
|
|
66
|
-
Internal flow stage context was missing or invalid. Re-run `
|
|
130
|
+
Internal flow stage context was missing or invalid. Re-run `app_flow_apply` with the normalized arguments, and do not switch to hidden `solution_*` tools.
|
|
131
|
+
|
|
132
|
+
### `VALIDATION_ERROR`
|
|
133
|
+
|
|
134
|
+
Do not keep guessing preset names or node shapes. First:
|
|
135
|
+
|
|
136
|
+
1. inspect `suggested_next_call`
|
|
137
|
+
2. reuse `canonical_arguments` if present
|
|
138
|
+
3. check `allowed_values`
|
|
139
|
+
4. retry with canonical preset or canonical node types
|
|
140
|
+
5. for workflow actors and permissions, always convert to:
|
|
141
|
+
- `assignees.role_names`
|
|
142
|
+
- `assignees.member_names`
|
|
143
|
+
- `permissions.editable_fields`
|
|
144
|
+
|
|
145
|
+
Do not copy internal keys from old plan outputs or logs, including:
|
|
146
|
+
|
|
147
|
+
- `role_entries`
|
|
148
|
+
- `editable_que_ids`
|
|
67
149
|
|
|
68
150
|
## Notes
|
|
69
151
|
|
|
70
152
|
- `mode=replace` is the only supported flow apply mode
|
|
71
153
|
- `app_flow_apply` publishes by default
|
|
154
|
+
- Prefer roles over explicit members unless the user explicitly asks for named members
|
|
155
|
+
- `basic_approval` and `basic_fill_then_approve` are skeletons, not complete business workflows
|
|
156
|
+
- Report results precisely:
|
|
157
|
+
- “基础流程骨架已创建” when only the preset landed
|
|
158
|
+
- “业务定制规则已补齐” only after the patch phase is complete
|