@josephyan/qingflow-app-builder-mcp 1.1.25 → 1.1.27

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.
Files changed (100) hide show
  1. package/README.md +6 -6
  2. package/docs/local-agent-install.md +6 -57
  3. package/entry_point.py +1 -1
  4. package/npm/bin/qingflow-app-builder-mcp.mjs +33 -2
  5. package/npm/lib/runtime.mjs +101 -21
  6. package/npm/scripts/postinstall.mjs +10 -1
  7. package/package.json +2 -3
  8. package/pyproject.toml +1 -1
  9. package/skills/qingflow-app-builder/SKILL.md +51 -164
  10. package/skills/qingflow-app-builder/references/build-complete-system.md +234 -0
  11. package/skills/qingflow-app-builder/references/build-single-app.md +138 -0
  12. package/skills/qingflow-app-builder/references/create-app.md +24 -31
  13. package/skills/qingflow-app-builder/references/environments.md +1 -1
  14. package/skills/qingflow-app-builder/references/gotchas.md +13 -39
  15. package/skills/qingflow-app-builder/references/match-rules.md +18 -29
  16. package/skills/qingflow-app-builder/references/public-surface-sync.md +2 -2
  17. package/skills/qingflow-app-builder/references/solution-playbooks.md +0 -10
  18. package/skills/qingflow-app-builder/references/tool-selection.md +25 -42
  19. package/skills/qingflow-app-builder/references/update-flow.md +38 -22
  20. package/skills/qingflow-app-builder/references/update-schema.md +0 -14
  21. package/skills/qingflow-app-builder/references/update-views.md +14 -83
  22. package/skills/qingflow-app-builder-code-integrations/SKILL.md +3 -5
  23. package/skills/qingflow-app-builder-code-integrations/references/code-block.md +1 -1
  24. package/skills/qingflow-app-builder-code-integrations/references/q-linker.md +1 -1
  25. package/skills/qingflow-mcp-setup/SKILL.md +111 -0
  26. package/skills/qingflow-mcp-setup/agents/openai.yaml +4 -0
  27. package/skills/qingflow-mcp-setup/references/claude-desktop.md +34 -0
  28. package/skills/qingflow-mcp-setup/references/environments.md +61 -0
  29. package/skills/qingflow-mcp-setup/references/generic-stdio.md +31 -0
  30. package/skills/qingflow-mcp-setup/scripts/check_local_server.sh +38 -0
  31. package/skills/qingflow-workflow-builder/SKILL.md +96 -0
  32. package/skills/qingflow-workflow-builder/manifest.yaml +8 -0
  33. package/skills/qingflow-workflow-builder/references/01-overview.md +45 -0
  34. package/skills/qingflow-workflow-builder/references/02-update-mode.md +53 -0
  35. package/skills/qingflow-workflow-builder/references/03-flow-patterns.md +57 -0
  36. package/skills/qingflow-workflow-builder/references/04-stage1-business-modeling.md +131 -0
  37. package/skills/qingflow-workflow-builder/references/05-stage2-members-roles.md +29 -0
  38. package/skills/qingflow-workflow-builder/references/06-stage3-build-spec.md +165 -0
  39. package/skills/qingflow-workflow-builder/references/07-stage4-validate-spec.md +33 -0
  40. package/skills/qingflow-workflow-builder/references/08-stage5-apply-verify.md +51 -0
  41. package/skills/qingflow-workflow-builder/references/09-stage6-summary.md +88 -0
  42. package/skills/qingflow-workflow-builder/references/10-node-config-reference.md +93 -0
  43. package/skills/qingflow-workflow-builder/references/11-troubleshooting.md +15 -0
  44. package/skills/qingflow-workflow-builder/scripts/diff_flow_spec.py +275 -0
  45. package/skills/qingflow-workflow-builder/scripts/validate_flow_spec.py +605 -0
  46. package/src/qingflow_mcp/__init__.py +1 -1
  47. package/src/qingflow_mcp/__main__.py +2 -6
  48. package/src/qingflow_mcp/builder_facade/models.py +49 -330
  49. package/src/qingflow_mcp/builder_facade/service.py +1621 -6149
  50. package/src/qingflow_mcp/cli/commands/builder.py +366 -322
  51. package/src/qingflow_mcp/cli/commands/chart.py +1 -1
  52. package/src/qingflow_mcp/cli/commands/common.py +3 -12
  53. package/src/qingflow_mcp/cli/commands/exports.py +2 -2
  54. package/src/qingflow_mcp/cli/commands/imports.py +3 -3
  55. package/src/qingflow_mcp/cli/commands/portal.py +2 -2
  56. package/src/qingflow_mcp/cli/commands/record.py +27 -101
  57. package/src/qingflow_mcp/cli/commands/task.py +47 -28
  58. package/src/qingflow_mcp/cli/commands/view.py +1 -1
  59. package/src/qingflow_mcp/cli/context.py +3 -0
  60. package/src/qingflow_mcp/cli/formatters.py +16 -784
  61. package/src/qingflow_mcp/cli/main.py +41 -120
  62. package/src/qingflow_mcp/errors.py +2 -43
  63. package/src/qingflow_mcp/public_surface.py +17 -26
  64. package/src/qingflow_mcp/response_trim.py +17 -81
  65. package/src/qingflow_mcp/server.py +12 -14
  66. package/src/qingflow_mcp/server_app_builder.py +39 -81
  67. package/src/qingflow_mcp/server_app_user.py +16 -22
  68. package/src/qingflow_mcp/session_store.py +7 -11
  69. package/src/qingflow_mcp/solution/compiler/__init__.py +1 -3
  70. package/src/qingflow_mcp/solution/executor.py +18 -245
  71. package/src/qingflow_mcp/tools/ai_builder_tools.py +1483 -3139
  72. package/src/qingflow_mcp/tools/app_tools.py +43 -184
  73. package/src/qingflow_mcp/tools/approval_tools.py +35 -197
  74. package/src/qingflow_mcp/tools/auth_tools.py +16 -92
  75. package/src/qingflow_mcp/tools/code_block_tools.py +40 -298
  76. package/src/qingflow_mcp/tools/custom_button_tools.py +10 -64
  77. package/src/qingflow_mcp/tools/directory_tools.py +72 -236
  78. package/src/qingflow_mcp/tools/export_tools.py +34 -244
  79. package/src/qingflow_mcp/tools/feedback_tools.py +0 -9
  80. package/src/qingflow_mcp/tools/file_tools.py +3 -9
  81. package/src/qingflow_mcp/tools/import_tools.py +49 -336
  82. package/src/qingflow_mcp/tools/navigation_tools.py +12 -91
  83. package/src/qingflow_mcp/tools/package_tools.py +6 -118
  84. package/src/qingflow_mcp/tools/portal_tools.py +3 -39
  85. package/src/qingflow_mcp/tools/qingbi_report_tools.py +7 -116
  86. package/src/qingflow_mcp/tools/record_tools.py +360 -1145
  87. package/src/qingflow_mcp/tools/resource_read_tools.py +39 -188
  88. package/src/qingflow_mcp/tools/role_tools.py +9 -80
  89. package/src/qingflow_mcp/tools/solution_tools.py +45 -59
  90. package/src/qingflow_mcp/tools/task_context_tools.py +158 -662
  91. package/src/qingflow_mcp/tools/task_tools.py +29 -113
  92. package/src/qingflow_mcp/tools/view_tools.py +3 -106
  93. package/src/qingflow_mcp/tools/workflow_tools.py +4 -48
  94. package/src/qingflow_mcp/tools/workspace_tools.py +3 -71
  95. package/src/qingflow_mcp/version.py +2 -0
  96. package/npm/bin/qingflow-skills.mjs +0 -5
  97. package/skills/qingflow-app-builder/references/complete-system-development-guide.md +0 -172
  98. package/skills/qingflow-app-builder/references/single-app-development-guide.md +0 -87
  99. package/skills/qingflow-app-builder/scripts/validate_system_build_summary.py +0 -124
  100. package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +0 -173
@@ -1,23 +1,22 @@
1
1
  ---
2
2
  name: qingflow-app-builder
3
- description: Build, configure, and modify Qingflow apps and systems using the current Wingent Momo runtime MCP session. Use when the user wants to apply or repair an existing SolutionSpec, modify an existing package with app, view, workflow, portal, navigation, or reporting tools, verify builder-side results, or troubleshoot system-building behavior. Do not use this skill to install the MCP or to author a brand new SolutionSpec from scratch.
3
+ description: Build, configure, and modify Qingflow apps and systems after the MCP is already connected and authenticated. Use when the user wants to apply or repair an existing SolutionSpec, modify an existing package with app, view, workflow, portal, navigation, or reporting tools, verify builder-side results, or troubleshoot system-building behavior. Do not use this skill to install the MCP or to author a brand new SolutionSpec from scratch.
4
4
  metadata:
5
5
  short-description: Build and modify Qingflow apps and systems
6
6
  ---
7
7
 
8
8
  # Qingflow App Builder
9
9
 
10
- > **Skill 版本**:`qingflow-skills-2026.06.28.3`(入口文档版本;CLI 实际执行包以 `qingflow --json version` 返回的 `package / version / package_root / skill_version` 为准)。
10
+ > **Skill 版本**:`qingflow-skills-2026.06.30.1`
11
11
 
12
12
  ## Overview
13
13
 
14
14
  This skill is for the current **public builder surface**, not for legacy low-level builder writes.
15
- In Wingent Momo runtime, trust the injected MCP session, credentials, workspace, and route context until a tool explicitly reports otherwise.
15
+ Assumes MCP is already connected, authenticated, and on the correct workspace.
16
16
 
17
17
  Before any write or verification flow, identify whether the task targets `test` or `prod` and read [references/environments.md](references/environments.md). If the user did not specify one, default to `prod`.
18
18
 
19
19
  Before choosing a route, skim the shared maintenance baseline: [public-surface-sync.md](references/public-surface-sync.md).
20
- Then pick the matching development guide: [single-app-development-guide.md](references/single-app-development-guide.md) for one app, or [complete-system-development-guide.md](references/complete-system-development-guide.md) for app packages/systems.
21
20
 
22
21
  ## Current Public Mental Model
23
22
 
@@ -35,45 +34,13 @@ Default modeling rules:
35
34
  - Another business object -> a separate app, not a text field
36
35
  - Cross-object links -> relation fields, not text fields
37
36
 
38
- ## Route First
39
-
40
- Before any builder write, classify the request:
41
-
42
- - **Complete system / app package**: the user asks for a system, package, workspace module set, or several related forms/apps. Use `package_apply` for the package, then one `app_schema_apply(package_id=..., apps=[...])` for the app shells and fields. This is the main path for complete systems, not a bulk shortcut to abandon after the first slow response. Do not squeeze several business objects into one app.
43
- - **Single app**: the user names one form/app or gives one `app_key`. Use `app_resolve`/`app_get`, then `app_schema_apply` and the app-scoped apply tools.
44
- - **Record/user operation**: the user wants to add, edit, delete, approve, or analyze data. Route to the record/task skills instead of builder tools.
45
-
46
- For complete systems, `apps[]` should use stable `client_key` values. Same-call relation fields should use `target_app_ref` for another `apps[].client_key`; use `target_app_key` only when the target app already exists or has been confirmed by readback. Create the related apps with one multi-app schema apply; do not create each app separately just to collect app keys and then patch relations afterward.
47
-
48
- If a complete-system `app_schema_apply` times out, returns `partial_success`, returns `write_executed=true`, has `safe_to_retry=false`, or has incomplete readback, treat it as an uncertain write, not as a failed create. The next action is always `readback_before_retry`: read the package/app/fields first, compare intended `client_key`/`app_name`/relations against reality, and only then repair the missing slice. Do not retry the whole multi-app create, create `V2`/`测试`/random-suffix apps, or split the system into single-app rebuilds to bypass a duplicate/conflict.
49
-
50
- Before any write, apply this decision gate:
51
-
52
- | Evidence | Action |
53
- | --- | --- |
54
- | Exact `app_key`, `view_key`, `chart_id`, `dash_key`, or `package_id` is provided | Update that existing target unless the user explicitly asks for a new one |
55
- | Several forms/modules or a “system/package” are requested | Use the complete-system path; do not compress them into one app |
56
- | Same/similar package or app already exists and user did not say extend/replace/new | Stop and ask which target strategy to use |
57
- | Readback already contains part of the requested build | Patch only verified missing or incorrect slices |
58
- | Write state is uncertain | Read back before retrying; do not create duplicate names with suffixes |
59
-
60
- Builder schema inputs should follow agent-intuitive semantics:
61
-
62
- - choose field type by business intent first: title/short text -> `text`; notes/description -> `multiline`; status/type/stage -> `select` with `options`; labels/multiple choices -> `multi_select`; quantities/ratios/scores/durations -> `number`; money -> `amount`; cross-app link -> `relation`
63
- - field types in drafts may use intuitive aliases: `multiline -> long_text`, `select -> single_select`, `multi_select -> multi_select`, `amount -> amount`, `phone -> phone`; readback returns canonical types and that is not a schema mismatch
64
- - primary icon syntax is `icon + color`, for example `icon: "table", color: "blue"`; `icon_name/icon_color`, `icon_config`, and `icon: {name, color}` are compatibility aliases only
65
- - select-style field `options` may be strings or objects such as `{label, value}`; tools normalize to option labels
66
- - relation fields need a target plus object selectors: same-batch `target_app_ref`, existing app `target_app_key`, `display_field: {"name": "..."}`, and `visible_fields: [{"name": "..."}]`
67
- - do not impose an artificial one-relation-field-per-app limit; create the relation fields the business model needs, then rely on backend validation and readback
68
- - do not create built-in system fields as form fields: `数据ID`, `编号`, `申请人`, `申请时间`, `创建人`, `创建时间`, `提交人`, `提交时间`, `更新时间`, `更新人`, `当前流程状态`, `当前处理人`, `当前处理节点`, `流程标题`. They are platform-generated; only reference supported system fields where a tool explicitly says so, such as button `source_field: "数据ID"`
69
-
70
37
  ## Public Tools You Should Think In
71
38
 
72
39
  - Package: `package_get`, `package_apply`
73
- - App reads: `app_resolve`, `app_get`, `app_get_fields`, `app_get_layout`, `app_get_views`, `app_get_flow`, `app_get_charts`
40
+ - App reads: `app_resolve`, `app_get`, `app_get_fields`, `app_get_layout`, `app_get_views`, `app_get_flow`, `app_get_charts`, `app_get_associated_resources`
74
41
  - Builder reads: `portal_list`, `portal_get`, `view_get`, `chart_get`, `builder_tool_contract`
75
42
  - Directory: `member_search`, `role_search`, `role_create`
76
- - Writes: `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, `app_views_apply`, `app_custom_buttons_apply`, `app_associated_resources_apply`, `app_charts_apply`, `portal_apply`, `app_release_edit_lock_if_mine`
43
+ - Writes: `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, `app_views_apply`, `app_associated_resources_apply`, `app_charts_apply`, `portal_apply`, `app_release_edit_lock_if_mine`
77
44
  - Verification: `app_publish_verify`
78
45
  - Cross-cutting escalation: `feedback_submit` after explicit user confirmation when the public builder surface still cannot satisfy the user's need
79
46
 
@@ -85,137 +52,98 @@ Treat these as the official surface. Do not default to `package_create`, `packag
85
52
  - use `package_get(package_id=...)` to read one known package
86
53
  - use `package_apply(...)` for package creation, rename, icon, visibility, grouping, ordering, and app/portal layout
87
54
  - Multi-app schema work:
88
- - use one `app_schema_apply(package_id=..., apps=[...])` / CLI `builder schema apply --apps-file` when creating several apps in one package
89
- - every `apps[]` item should carry its own `client_key`, `app_name`, `icon`, `color`, and `add_fields`
90
- - same-call relation fields should use `target_app_ref` to point at another `apps[].client_key`; use `target_app` only when the app name is unique and stable, and use `target_app_key` only after the target app already exists or readback has confirmed it
91
- - timeout / `partial_success` / `write_executed=true` / `safe_to_retry=false` means `readback_before_retry`; do not directly downgrade to single-app creation
55
+ - use one `app_schema_apply(apps=[...])` / CLI `builder schema apply --apps-file` when creating several apps in one package
56
+ - put form layout directly in `apps[].form.sections`; the CLI writes it in the same schema save as fields and relations
57
+ - same-call relation fields may use `target_app_ref` to point at another `apps[].client_key`
92
58
  - App base permissions:
93
59
  - trust `app_get.editability.can_edit_app_base` for app base-info writes like app name, icon, and visibility
94
60
  - `can_edit_form` only means schema/form-route capability; it no longer implies app base-info write capability
95
61
  - Partial update rule:
96
- - for existing views, custom buttons, associated resources, and charts, prefer `patch_views` / `patch_buttons` / `patch_resources` / `patch_charts`
97
- - each patch item uses the object's real selector field (`view_key` / `button_id` / `associated_item_id` / `chart_id`, or unique name where supported) plus `set` and optional `unset`; do not send a literal `selector` key for these tools
62
+ - for existing views, associated resources, and charts, prefer `patch_views` / `patch_resources` / `patch_charts`
63
+ - each patch item uses the object's real selector field (`view_key` / `associated_item_id` / `chart_id`, or unique name where supported) plus `set` and optional `unset`; do not send a literal `selector` key for these tools
98
64
  - use `upsert_*` for creation or full target configuration; do not send a partial `upsert_*` and expect the backend to merge missing required fields
99
65
  - Portal work:
100
66
  - `portal_apply` is the public write path
67
+ - complete-system portals create QingBI charts inline through `sections[].chart`; do not pre-create charts as the standard route
101
68
  - in edit mode, omitting `sections` means “preserve existing layout and update base info only”
102
69
  - supplying `sections` means full replace semantics for sections
103
- - `patch_sections[]` is the preferred path for changing one existing portal block
104
- - do not confuse form layout with portal layout: form layout uses field-name `rows`; portal layout uses component `position.pc.x/y/cols/rows`
105
- - portal PC layout uses a 24-column grid; components with the same `y` must share the same `rows`, and their `cols` should sum to 24 unless the user explicitly wants blank space
106
- - standard workbench heights: metric cards `rows=5`, BI charts `rows=7`, data views `rows=11`
107
- - business-entry grid sections must include real `config.items[]`; do not submit an empty grid container
108
- - build portals only after referenced apps, raw `view_key`s, and chart ids/keys are known by readback
109
- - standard order is business entry -> metric cards -> BI charts -> concrete data views
110
- - do not use platform default views such as `全部数据` / `我的数据` as the main portal views
111
- - do not use `source_type: "filter"` as the normal automation path; portal filter is raw/unstable and not part of the unified filter DSL
112
- - Chart work:
70
+ - portal sections use a 24-column PC grid; all components sharing the same `y` coordinate must have identical `rows` values and their `cols` must sum to exactly 24; mixing `rows` in the same row causes height misalignment, and a `cols` sum under 24 leaves blank space at the row end; the next row's `y` must equal the previous row's `y` + `rows`
71
+ - Standalone chart maintenance:
113
72
  - `app_charts_apply` is the public write path for app-source QingBI report bodies/configs; it creates/updates reports with `dataSourceType=qingflow`
73
+ - do not use it as the standard complete-system route; complete-system portals should inline QingBI charts through `portal_apply sections[].chart`
114
74
  - dataset BI reports are not created or edited by `app_charts_apply` yet; create them in QingBI first, then attach the existing report with `app_associated_resources_apply` and `report_source="dataset"`
115
75
  - it does not attach the report to the Qingflow app associated-resource display; use `app_associated_resources_apply` for that
116
- - use `app_get_fields.chart_fields` as the source for dimensions, metrics, and filters; normal record/form fields are not enough
117
- - choose chart type by goal: `target/indicator` for one KPI, `bar/columnar/pie` for distribution, `line/area` for trend, `table/detail/summary` for tabular summaries, `dualaxes` for two-metric comparison
118
- - use semantic metrics: `count(*)`, `sum(金额)`, `avg(工时)`, `group_by`, `where`; do not handwrite raw `indicator_field_ids`, `selectedMetrics`, or QingBI filter matrices on the main path
119
- - do not use `summary` for a single metric card; use `target` / `indicator`
120
76
  - supported `chart_type` values include legacy public aliases `target`, `table` and QingBI types such as `summary`, `columnar`, `area`, `stacked_area`, `funnel`, `waterfall`, `gauge`, `heatmap`, `histogram`, `treemap`, `radar`, `stacked_bar`, `stacked_column`, `scatter`, `ring`, `rose`, `dualaxes`, `map`, and `timeline`
121
- - chart `filters` use the unified fixed-filter DSL: `field_name + operator + value/values`; the tool compiles them to QingBI string judge types
122
- - for complete systems, keep chart payloads business-scoped, commonly 4-8 `upsert_charts` by app or topic. Larger calls are accepted; if `CHART_UPSERT_BATCH_SIZE_RECOMMENDED` appears, read back before retrying and only repair failed items.
123
77
  - use `patch_charts` for changing a chart name, visibility, filters, or one config fragment on an existing chart
124
78
  - `visibility` is a public capability and should be treated as a base-only permission update
125
79
  - do not model chart visibility changes as raw config rewrites
126
- - Button work:
127
- - for normal view-specific business buttons, prefer `app_views_apply.upsert_views[].action_buttons` or `patch_views[].set.action_buttons`; design the view and its actions together
128
- - use `app_custom_buttons_apply` for advanced button maintenance: style/icon changes, cross-view reuse, deleting button bodies, bulk reordering view bindings, or exact qRobot/wings configs
129
- - use `patch_buttons` for changing a single existing button parameter such as URL, text, icon, style, or add-data mapping
130
- - choose by user intent first: current record -> downstream record uses `add_data`; global independent entry uses `header`; URL/SOP/help uses `link`; approval/status transition/close task is workflow/task/automation, not a fake normal button
131
- - action choice:
132
- - current record -> downstream/child record: use `add_data` in view `action_buttons`, or `addData` in standalone buttons, with `target_app_key + field_mappings`
133
- - global independent create: use `add_data`/`addData` on `header` without current-record `source_field`
134
- - SOP/external/fixed page: use `link` with `url`
135
- - existing automation only: use `qRobot`/`wings` only when the user provides exact config
136
- - approval/status transition/close task is not a generic button action; model workflow/task action first, or use existing automation. Do not fake it with `link`
137
- - for add-data buttons, use `trigger_add_data_config.target_app_key + field_mappings/default_values`; do not handwrite raw `que_relation`
138
- - use `field_mappings` for dynamic current-record values, including system fields such as `数据ID` (`field_id=-17`) and `编号` (`field_id=0`)
139
- - to prefill a target relation field with the current source record, map `{"source_field": "数据ID", "target_field": "目标引用字段"}`; use `default_values` only for static constants
80
+ - View action work:
81
+ - declare button configuration only inside `app_views_apply` view items with `action_buttons`
82
+ - design the view and its available actions together
83
+ - use `field_mappings` for dynamic current-record values, including system fields such as `数据ID` and `编号`
140
84
  - if field type compatibility is unclear, read [references/match-rules.md](references/match-rules.md)
141
- - placement choice: `header` is global and has no current-row context; `list` is row/list action and maps to backend `INSIDE`; `detail` is the safest current-record context action. Do not use current-record `field_mappings` on `header`
142
- - bind advanced standalone buttons to views through `view_configs[].buttons[]`; default to `placement`: `header` or `detail`
143
- - builder `view_configs[].view_key` uses the raw key from `app_get.views[].view_key`, without a `custom:` prefix
144
- - `buttons` is required in merge mode; do not send a view config with only `view_key`
145
- - `view_configs[].mode` defaults to `merge`; use `mode: "replace"` or an explicit empty `buttons: []` to clear a view's custom button bindings
146
- - `placement=list` configures row/list buttons and maps to the backend `INSIDE` button position
147
- - advanced bindings may use `button_limit`, `button_formula`, `button_formula_type`, and `print_tpls` only when visibility or print-template behavior is required
148
85
  - Associated resources:
149
86
  - `app_associated_resources_apply` is the public write path for the Qingflow app-level associated report/view pool and per-view display config
87
+ - for multi-app systems, use `apps[]` to batch associated-resource writes; each item carries its own `app_key` plus `upsert_resources` / `patch_resources` / `view_configs`
150
88
  - it attaches existing BI reports/views for in-app display; it does not create or edit QingBI report bodies/configs, including dataset reports
151
89
  - use `patch_resources` for changing match rules or other existing associated-resource parameters; the tool preserves backend-required raw fields internally
152
90
  - `associated_item_id` is the backend internal associated-resource id; for `view_configs`, `remove_associated_item_ids`, and `reorder_associated_item_ids`, you may pass `associated_item_id` or an existing resource's `chart_id`/`chart_key`/`view_key`, and the tool resolves it to the internal id
153
91
  - before creating a resource, check `app_get.associated_resources` for the same `target_app_key + view_key/chart_key`; if it already exists, use `patch_resources` with that `associated_item_id`
154
92
  - `client_key` is only a same-call reference for `view_configs[].associated_item_refs`; it is not saved and cannot deduplicate later calls
155
93
  - do not pass backend raw `sourceType`; view resources infer the internal Qingflow view source, report/chart resources default to BI app reports, and existing dataset reports use `report_source="dataset"`
156
- - use `match_mappings` for associated view/report filters; dynamic context matches use `source_field`, static filters use `value`; do not handwrite raw `matchRules`
94
+ - use `match_mappings` for associated view/report filters; dynamic conditions use `source_field`, static conditions use `value`
157
95
  - if field type compatibility is unclear, read [references/match-rules.md](references/match-rules.md)
158
96
  - Views and flows:
159
97
  - stay on `app_views_apply` / `app_flow_apply`
160
- - before building approval/fill/copy flows, make sure the app schema has an explicit business status `select` field such as `状态` / `处理状态` / `审批状态`; do not create platform workflow system fields such as `当前流程状态`
98
+ - new views use top-level `views[]`; the same batch may mix same-app and cross-app views
99
+ - buttons belong in view `action_buttons`
161
100
  - use `patch_views` for existing-view parameter changes such as `query_conditions`, `filters`, `columns`, or visibility
162
101
  - builder view writes use raw `view_key` values from `app_get.views`; `custom:<viewKey>` is a record-data `view_id` form, not a builder `view_key`
163
- - do not create platform default/system views named `全部数据`, `我的数据`, `我发起的`, `待办`, `已办`, or `抄送`; they are built in. New views must use business-specific names. To change a built-in view, patch by its existing raw `view_key`
164
102
  - use `builder_tool_contract` whenever the minimal legal shape is unclear
165
- - keep view `filters` and `query_conditions` separate: `filters` use `field_name + operator + value/values` and are fixed saved filters; `query_conditions` configure the frontend query panel fields and only take effect after users enter query values
166
- - choose condition/matching surface by intent: fixed saved filters -> `filters`; frontend query panel -> `query_conditions.rows`; current-record associated report/view filtering -> `match_mappings`; current-record add-data prefill -> `field_mappings`; button visibility -> `visible_when` / `button_limit`
167
- - keep relation/attachment/subtable/address/Q-Linker/code-block fields out of `query_conditions`; member/department fields may be used as query-panel fields when readback supports them. Use `filters` for fixed filters or associated-resource `match_mappings` for current-record related report/view matching
103
+ - keep view `filters` and `query_conditions` separate: `filters` are fixed saved filters; `query_conditions` configure the frontend query panel fields and only take effect after users enter query values
104
+ - when creating any new table or card view, always include `query_conditions` with `enabled: true`; populate `rows` with the fields most useful for searching — typically the data-title field, any status/type select fields, date fields, and member fields; do not omit `query_conditions` or leave `rows` empty on a new view
168
105
  - new views default the associated report/view display area to visible with `limit_type="all"`; existing views preserve their current associated-resource display unless `associated_resources` is explicitly patched
169
106
  - configure associated reports/views through `app_associated_resources_apply`, not through `app_views_apply`
170
107
 
171
108
  ## Standard Operating Order
172
109
 
173
- 1. Trust the current MCP/session when it is already injected by the runtime; only run auth/workspace recovery after a tool explicitly reports an auth, credential, or workspace error
174
- 2. Confirm whether the task is read-only or write-impacting
175
- 3. Classify the build scope:
176
- - complete system/package -> `package_apply` or `package_get`, then one `app_schema_apply(package_id=..., apps=[...])`
177
- - single app -> `app_resolve` / `app_get`, then app-scoped apply tools
178
- - record/task/data request -> leave builder and use the matching record/task skill
110
+ 1. Ensure auth exists
111
+ 2. Ensure workspace is selected
112
+ 3. Confirm whether the task is read-only or write-impacting
179
113
  4. Resolve the smallest stable target:
180
114
  - app-scoped work -> `app_resolve`
181
115
  - package-scoped work with known id -> `package_get`
182
116
  - portal inventory -> `portal_list`
183
117
  5. Read only the smallest config slice needed:
184
- - app map -> `app_get` (default entry; includes compact views, charts, custom buttons, and associated resource pool)
118
+ - app map -> `app_get` (default entry; includes compact views, charts, and associated resource pool)
185
119
  - fields -> `app_get_fields`
186
120
  - layout -> `app_get_layout`
187
121
  - views -> `app_get_views` only when the app_get compact list is not enough
188
- - flow -> `app_get_flow` only when the task involves approval, fill/copy, reminders, process routing, task handling, or flow repair
122
+ - flow -> `app_get_flow`
189
123
  - charts -> `app_get_charts` only when the app_get compact list is not enough
190
124
  - portal -> `portal_get`
191
125
  6. If the public shape is unclear, call `builder_tool_contract`
192
126
  7. Apply the smallest patch tool that fits:
193
- - fields -> `app_schema_apply`
194
- - layout -> `app_layout_apply`
195
- - flow -> `app_flow_apply` only when workflow is requested or clearly required
127
+ - fields and form layout -> `app_schema_apply`
128
+ - layout-only maintenance -> `app_layout_apply`
129
+ - flow -> `app_flow_apply`
196
130
  - existing views -> `app_views_apply.patch_views`; new/full views -> `app_views_apply.upsert_views`
197
- - existing buttons -> `app_custom_buttons_apply.patch_buttons`; new/full buttons -> `app_custom_buttons_apply.upsert_buttons`
198
131
  - existing associated resources -> `app_associated_resources_apply.patch_resources`; new/full resources -> `app_associated_resources_apply.upsert_resources`
199
132
  - existing charts -> `app_charts_apply.patch_charts`; new/full charts -> `app_charts_apply.upsert_charts`
200
133
  - portal -> `portal_apply`
201
134
  - package metadata/layout -> `package_apply`
202
135
  8. Use `app_publish_verify` only when the user explicitly wants final publish/live verification or you need a dedicated verification pass
203
- 9. For complete-system builds, write `tmp/qingflow_system_build_summary.json` before the final response and make the final report match that file
204
136
 
205
137
  ## Safe Usage Rules
206
138
 
207
139
  - Do not guess package identity from a loose name. Public package work assumes a known `package_id`, or an explicit create/update intent through `package_apply`.
208
- - Do not perform routine auth probes before every builder action in runtime contexts with injected MCP credentials; recover auth only after an actual auth/workspace failure.
209
140
  - If `package_id` is unknown, derive it from related app/portal readback when possible; otherwise ask the user instead of falling back to hidden package lookup tools.
210
- - Do not bypass package/app-name conflicts by inventing `V2`, `测试`, timestamp, or random suffix apps in a real business package. Read back and decide whether to update the existing app, create only a truly missing app, or ask the user.
211
- - After any uncertain schema write, do `readback_before_retry` with `package_get` / `app_resolve` / `app_get_fields`; retry only the verified missing or failed slice.
212
141
  - Do not use `package_create` or `package_attach_app` as a public default path. If they still appear in low-level code, treat them as internal/legacy implementation details.
213
142
  - Do not use raw `portal_*` writes or raw `qingbi_report_*` writes as the default builder strategy.
214
- - `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, and `app_views_apply` publish by default; `app_custom_buttons_apply` and `app_associated_resources_apply` publish after at least one write succeeds and do not accept a draft-only `publish` parameter; `app_charts_apply` is immediate-live without publish.
143
+ - Always pass `publish: true` (or CLI `--publish`) explicitly on `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, `app_views_apply`, and `portal_apply` when those tools are used directly. `app_associated_resources_apply` publishes automatically after at least one write succeeds and does not accept a `publish` parameter. `app_charts_apply` is immediate-live without a publish step.
215
144
  - When creating or updating fields, configure the app data title/cover directly in field JSON: `as_data_title: true` is required on exactly one readable top-level title field; `as_data_cover: true` is optional and only valid on one top-level `attachment` field.
216
- - Do not add platform system fields to `add_fields`; if the user asks for record id, number, applicant, creation/update time, or workflow status, use the built-in data/list/readback fields instead of creating duplicate controls.
145
+ - When any tool returns `error_code` or `VALIDATION_ERROR`, read the `message` field verbatim first before guessing at parameter or CLI parsing issues. A clear `message` like "relation field requires visible_fields" is the root cause do not redirect to unrelated hypotheses such as `create_if_missing` parsing or flag conflicts.
217
146
  - If the same validation error repeats twice, stop guessing and re-read `builder_tool_contract`.
218
- - Do not create workflows just to make a build look complete. If no approval/fill/copy/reminder/process-routing requirement exists, report workflow as not requested/not configured.
219
147
  - For workflow assignees, prefer `role_search` over explicit members unless the user explicitly wants named members.
220
148
  - Public flow building is still intentionally limited to stable linear workflows. If a requirement sounds like branches/conditions, explain the limitation instead of freehanding unsupported graph shapes.
221
149
  - Respect collaborative edit locks. Only use `app_release_edit_lock_if_mine` when the lock owner is the current authenticated user.
@@ -228,18 +156,10 @@ Treat these as the official surface. Do not default to `package_create`, `packag
228
156
  - For UI cards or quick narration, read `resources[]` first. Each resource has `resource_type`, `operation`, `status`, `id`, `key`, `name`, typed `ids`, and `parent`.
229
157
  - Use legacy fields such as `field_diff`, `views_diff`, `chart_results`, `created/updated/removed`, and `verification` only for compatibility and troubleshooting.
230
158
  - Treat post-write readback as the source of truth, not just write status codes.
231
- - `success` means write and verification completed; `partial_success` means the write landed or may have landed but verification is incomplete. If `write_executed=true`, `safe_to_retry=false`, or readback is unavailable, do `readback_before_retry` before any create retry.
232
- - Final status rule:
233
- - write result answers whether the write was attempted
234
- - readback answers what actually exists
235
- - publish/portal verification answers whether it is front-end visible
236
- - validation/contract error with `write_executed=false` is a real failure and can be fixed/retried
237
- - `partial_success`, timeout, post-write 40002/404, or readback unavailable is not enough to call the write failed; read back first and patch only proven gaps
159
+ - `success` means write and verification completed; `partial_success` means the write landed but verification is incomplete.
238
160
  - For portals, distinguish clearly between:
239
161
  - base-info-only update with layout preserved
240
162
  - full sections replace
241
- - patching one section with `patch_sections[]`
242
- - layout validity: same-row `rows`, same-row `cols` sum, and non-empty grid `items`
243
163
  - For object apply tools, distinguish clearly between:
244
164
  - `patch_*`: public partial parameter replacement; the tool hydrates current config and full-saves internally
245
165
  - `upsert_*`: create or full target configuration; omitted fields may mean default/clear depending on that object
@@ -263,63 +183,30 @@ Treat these as the official surface. Do not default to `package_create`, `packag
263
183
  - Search members or roles: `member_search`, `role_search`
264
184
  - Create reusable role: `role_create`
265
185
  - Add/update/remove fields: `app_schema_apply`
266
- - Merge or replace layout: `app_layout_apply`
186
+ - Merge or replace layout-only changes on an existing app: `app_layout_apply`
267
187
  - Replace workflow: `app_flow_apply`
268
- - Upsert/patch/remove views, including ordinary view-specific `action_buttons`: `app_views_apply`
269
- - Advanced custom button maintenance and cross-view binding: `app_custom_buttons_apply`
188
+ - Upsert/patch/remove views: `app_views_apply`
270
189
  - Upsert/patch/remove app associated reports/views and per-view display: `app_associated_resources_apply`
271
190
  - Upsert/patch/remove/reorder charts: `app_charts_apply`
272
191
  - Create or update portal pages: `portal_apply`
273
192
  - Release your own stale edit lock: `app_release_edit_lock_if_mine`
274
193
  - Final publish verification: `app_publish_verify`
275
194
 
276
- ## Advanced Button Pattern
277
-
278
- For ordinary view-specific buttons, prefer `app_views_apply` with `action_buttons`; see [references/update-views.md](references/update-views.md). Use `app_custom_buttons_apply` only when you need standalone/advanced maintenance: custom style or icon, cross-view reuse, deleting button bodies, bulk binding reorder, or exact qRobot/wings config.
195
+ ## Playbook Selection
279
196
 
280
- ```json
281
- {
282
- "tool_name": "app_custom_buttons_apply",
283
- "arguments": {
284
- "app_key": "EMPLOYEE_APP",
285
- "upsert_buttons": [
286
- {
287
- "client_key": "add_worklog",
288
- "button_text": "快捷添加工时",
289
- "style_preset": "primary_blue",
290
- "button_icon": "ex-plus-circle",
291
- "trigger_action": "addData",
292
- "trigger_add_data_config": {
293
- "target_app_key": "WORKLOG_APP",
294
- "field_mappings": [
295
- {"source_field": "数据ID", "target_field": "关联员工"},
296
- {"source_field": "员工名称", "target_field": "员工姓名"},
297
- {"source_field": "所属部门", "target_field": "部门名称"}
298
- ],
299
- "default_values": {
300
- "工时类型": "日常工作",
301
- "状态": "待提交"
302
- }
303
- }
304
- }
305
- ],
306
- "remove_buttons": [],
307
- "view_configs": [
308
- {
309
- "view_key": "EMPLOYEE_VIEW",
310
- "mode": "merge",
311
- "buttons": [
312
- {"button_ref": "add_worklog", "placement": "detail", "primary": true}
313
- ]
314
- }
315
- ]
316
- }
317
- }
318
- ```
197
+ Before starting any build or create task, route to the right reference first:
319
198
 
320
- `button_ref` may be a same-call `client_key` or an existing `button_id`. Supported placements are `header`, `detail`, and `list`; `list` maps to the backend `INSIDE` row/list button position.
199
+ | User intent | Signal phrases | Playbook |
200
+ |-------------|---------------|---------|
201
+ | Multi-app business system with cross-app relations and a portal workbench | "建一套系统"、"包含 N 个模块"、"这几个表单之间建立关联"、"完整的业务系统" | [build-complete-system.md](references/build-complete-system.md) |
202
+ | Single app end-to-end: schema, form layout, views, view actions, optional workflow, and verification | "建一个应用"、"帮我搭一个XX管理"、"从零开始建一个XX"、"我需要一个管理XX的应用" | [build-single-app.md](references/build-single-app.md) |
203
+ | Add one new app inside an existing package | "在这个包里加一个表单"、"现有系统里新增一个模块" | [create-app.md](references/create-app.md) |
204
+ | Update fields or schema only | "加一个字段"、"改字段名"、"删除字段" | [update-schema.md](references/update-schema.md) |
205
+ | Update layout only | "调整分组"、"改排列顺序" | [update-layout.md](references/update-layout.md) |
206
+ | Update workflow only | "修改审批流"、"加一个审批节点" | [update-flow.md](references/update-flow.md) |
207
+ | Update views only | "加一个看板"、"改筛选条件"、"新增视图" | [update-views.md](references/update-views.md) |
321
208
 
322
- For add-data buttons that create a child record linked back to the current record, map `source_field: "数据ID"` to the target relation field. Do not use raw `que_relation` unless maintaining an existing backend config.
209
+ Decision rule: if the user mentions **multiple related apps or a portal**, use `build-complete-system.md`. If it is **one app** with a from-scratch setup request, use `build-single-app.md`. If the target app already exists and the user only wants to change one layer, use the matching single-layer playbook.
323
210
 
324
211
  ## Resources
325
212
 
@@ -328,8 +215,6 @@ For add-data buttons that create a child record linked back to the current recor
328
215
  - Tool choice and sequencing: [references/tool-selection.md](references/tool-selection.md)
329
216
  - Field matching rules: [references/match-rules.md](references/match-rules.md)
330
217
  - Result semantics and gotchas: [references/gotchas.md](references/gotchas.md)
331
- - Single app development guide: [references/single-app-development-guide.md](references/single-app-development-guide.md)
332
- - Complete system development guide: [references/complete-system-development-guide.md](references/complete-system-development-guide.md)
333
218
  - Create one app in an existing package: [references/create-app.md](references/create-app.md)
334
219
  - Update fields only: [references/update-schema.md](references/update-schema.md)
335
220
  - Update layout only: [references/update-layout.md](references/update-layout.md)
@@ -337,3 +222,5 @@ For add-data buttons that create a child record linked back to the current recor
337
222
  - Workflow assignees and node permissions: [references/flow-actors-and-permissions.md](references/flow-actors-and-permissions.md)
338
223
  - Update views only: [references/update-views.md](references/update-views.md)
339
224
  - Standard end-to-end builder sequences: [references/solution-playbooks.md](references/solution-playbooks.md)
225
+ - Build a complete multi-app system from scratch: [references/build-complete-system.md](references/build-complete-system.md)
226
+ - Build a single app end-to-end (schema + form layout + views + view actions + optional workflow + verification): [references/build-single-app.md](references/build-single-app.md)
@@ -0,0 +1,234 @@
1
+ # Build Complete System
2
+
3
+ Use this when the user asks for a system, app package, workspace module set, or several related apps/forms.
4
+ Do not compress several business objects into one app.
5
+
6
+ ## Main Chain
7
+
8
+ ```text
9
+ package_apply
10
+ -> app_schema_apply(apps[] with fields, relations, form.sections)
11
+ -> app_views_apply(views[])
12
+ -> portal_apply(sections[] with inline QingBI chart)
13
+ -> workflow / associated resources only when requested or required
14
+ -> readback + publish/visibility summary
15
+ ```
16
+
17
+ This is the only recommended chain for a new complete system. Do not split it into separate app creates, separate layout writes, or separate chart creation before portal.
18
+
19
+ ## Required Shape
20
+
21
+ - Create or resolve the package with `package_apply` / `package_get`.
22
+ - Create all related apps in one `app_schema_apply(package_id=..., apps=[...])`.
23
+ - Every app item must include stable `client_key`, `app_name`, `icon`, `color`, `add_fields`, and exactly one readable `as_data_title: true`.
24
+ - Put form layout directly in `apps[].form.sections`. Do not make `app_layout_apply` a standard second step for new apps.
25
+ - Same-call relations must use `target_app_ref` pointing to another `apps[].client_key`.
26
+ - Use `target_app_key` only for an app that already exists and has been confirmed by readback.
27
+ - Do not create platform fields: `数据ID`, `编号`, `申请人`, `申请时间`, `创建人`, `创建时间`, `提交人`, `提交时间`, `更新时间`, `更新人`, `当前流程状态`, `当前处理人`, `当前处理节点`, `流程标题`.
28
+
29
+ ## Schema Payload Pattern
30
+
31
+ ```json
32
+ {
33
+ "package_id": 123,
34
+ "apps": [
35
+ {
36
+ "client_key": "customer",
37
+ "app_name": "客户",
38
+ "icon": "user-group",
39
+ "color": "blue",
40
+ "add_fields": [
41
+ {"name": "客户名称", "type": "text", "as_data_title": true},
42
+ {"name": "客户状态", "type": "select", "options": ["潜在", "跟进中", "已成交"]},
43
+ {"name": "负责人", "type": "member"}
44
+ ],
45
+ "form": {
46
+ "sections": [
47
+ {"title": "基础信息", "rows": [["客户名称", "客户状态"], ["负责人"]]}
48
+ ]
49
+ }
50
+ },
51
+ {
52
+ "client_key": "opportunity",
53
+ "app_name": "商机",
54
+ "icon": "business-trend-up",
55
+ "color": "green",
56
+ "add_fields": [
57
+ {"name": "商机名称", "type": "text", "as_data_title": true},
58
+ {
59
+ "name": "关联客户",
60
+ "type": "relation",
61
+ "target_app_ref": "customer",
62
+ "display_field": {"name": "客户名称"},
63
+ "visible_fields": [{"name": "客户名称"}, {"name": "客户状态"}]
64
+ },
65
+ {"name": "商机阶段", "type": "select", "options": ["初步接触", "方案报价", "赢单", "输单"]},
66
+ {"name": "预计金额", "type": "amount"}
67
+ ],
68
+ "form": {
69
+ "sections": [
70
+ {"title": "基础信息", "rows": [["商机名称", "关联客户"], ["商机阶段", "预计金额"]]}
71
+ ]
72
+ }
73
+ }
74
+ ]
75
+ }
76
+ ```
77
+
78
+ Agent-friendly field type aliases are allowed: `multiline -> long_text`, `select -> single_select`, `amount -> amount`. Readback may show canonical types; do not treat that as a mismatch.
79
+
80
+ ## Views
81
+
82
+ - Use one `app_views_apply(views=[...])` batch for same-app and cross-app views.
83
+ - Do not create platform default views named `全部数据`, `我的数据`, `我发起的`, `待办`, `已办`, or `抄送`.
84
+ - Use business-specific view names.
85
+ - If a view needs business actions, put them directly inside that view item with `action_buttons`.
86
+ - Keep `filters` and `query_conditions` separate:
87
+ - `filters`: fixed saved filters.
88
+ - `query_conditions`: frontend query panel fields.
89
+
90
+ ```json
91
+ {
92
+ "views": [
93
+ {
94
+ "operation": "upsert",
95
+ "app_key": "CUSTOMER_APP_KEY",
96
+ "name": "客户跟进视图",
97
+ "type": "table",
98
+ "columns": ["客户名称", "客户状态", "负责人"],
99
+ "query_conditions": {
100
+ "enabled": true,
101
+ "rows": [["客户名称", "客户状态"], ["负责人"]]
102
+ },
103
+ "action_buttons": [
104
+ {
105
+ "text": "新建商机",
106
+ "action": "add_data",
107
+ "target_app_key": "OPPORTUNITY_APP_KEY",
108
+ "placement": "detail",
109
+ "field_mappings": [
110
+ {"source_field": "数据ID", "target_field": "关联客户"}
111
+ ]
112
+ }
113
+ ]
114
+ }
115
+ ]
116
+ }
117
+ ```
118
+
119
+ ## Portal
120
+
121
+ Use `portal_apply` only after apps and view keys are read back. QingBI charts for the portal are created inline in `sections[].chart`; do not pre-create charts as a separate standard step.
122
+
123
+ Portal layout rules:
124
+
125
+ - PC grid has 24 columns.
126
+ - Components in the same row must share the same `y` and `rows`.
127
+ - Same-row `cols` should sum to 24.
128
+ - Recommended order: business entry -> metric cards -> BI charts -> concrete data views.
129
+ - Business entry `grid` must contain real `config.items[]`; never submit an empty grid container.
130
+ - Metric cards: `rows=5`.
131
+ - BI charts: `rows=7`.
132
+ - Data views: `rows=11`.
133
+ - Do not use platform default views such as `全部数据` / `我的数据` as main portal data views.
134
+
135
+ ```json
136
+ [
137
+ {
138
+ "title": "业务入口",
139
+ "source_type": "grid",
140
+ "position": {
141
+ "pc": {"x": 0, "y": 0, "cols": 24, "rows": 4},
142
+ "mobile": {"x": 0, "y": 0, "cols": 6, "rows": 4}
143
+ },
144
+ "config": {
145
+ "items": [
146
+ {"type": 1, "jumpMode": 1, "linkAppKey": "CUSTOMER_APP_KEY", "linkFormType": 1, "title": "客户"},
147
+ {"type": 1, "jumpMode": 1, "linkAppKey": "OPPORTUNITY_APP_KEY", "linkFormType": 1, "title": "商机"}
148
+ ]
149
+ }
150
+ },
151
+ {
152
+ "title": "客户总数",
153
+ "source_type": "chart",
154
+ "role": "metric",
155
+ "position": {
156
+ "pc": {"x": 0, "y": 4, "cols": 6, "rows": 5},
157
+ "mobile": {"x": 0, "y": 4, "cols": 6, "rows": 5}
158
+ },
159
+ "chart": {
160
+ "app_key": "CUSTOMER_APP_KEY",
161
+ "name": "客户总数",
162
+ "chart_type": "target",
163
+ "metric": "count(*)"
164
+ }
165
+ },
166
+ {
167
+ "title": "客户状态分布",
168
+ "source_type": "chart",
169
+ "position": {
170
+ "pc": {"x": 0, "y": 9, "cols": 8, "rows": 7},
171
+ "mobile": {"x": 0, "y": 9, "cols": 6, "rows": 7}
172
+ },
173
+ "chart": {
174
+ "app_key": "CUSTOMER_APP_KEY",
175
+ "name": "客户状态分布",
176
+ "chart_type": "bar",
177
+ "group_by": ["客户状态"],
178
+ "metric": "count(*)"
179
+ }
180
+ },
181
+ {
182
+ "title": "客户跟进视图",
183
+ "source_type": "view",
184
+ "position": {
185
+ "pc": {"x": 0, "y": 16, "cols": 12, "rows": 11},
186
+ "mobile": {"x": 0, "y": 16, "cols": 6, "rows": 11}
187
+ },
188
+ "view_ref": {"app_key": "CUSTOMER_APP_KEY", "view_key": "CUSTOMER_VIEW_KEY"}
189
+ }
190
+ ]
191
+ ```
192
+
193
+ ## Optional Resources
194
+
195
+ Only add workflow or associated resources when the user asks for them or the business process cannot work without them.
196
+
197
+ - Workflow: use `app_flow_apply` after schema fields exist.
198
+ - Associated resources: use `app_associated_resources_apply` after target views/charts exist.
199
+
200
+ Do not create workflow just to make the system look complete.
201
+
202
+ ## Recovery
203
+
204
+ - Timeout, `partial_success`, `write_executed=true`, `safe_to_retry=false`, or incomplete readback means write state is uncertain, not definitely failed.
205
+ - Next action is always readback: package -> app resolve -> fields/views/portal as needed.
206
+ - Retry only verified missing or incorrect slices.
207
+ - Do not create `V2`, `测试`, timestamp, or random-suffix apps to bypass conflicts.
208
+
209
+ ## Final Summary
210
+
211
+ Before final response, write `tmp/qingflow_system_build_summary.json` and make the response match it:
212
+
213
+ ```json
214
+ {
215
+ "package_id": 0,
216
+ "package_name": "",
217
+ "portal_dash_key": "",
218
+ "portal_live_status": "verified | unverified | not_created",
219
+ "front_end_visible": true,
220
+ "apps": [],
221
+ "warnings": [],
222
+ "partial_items": [],
223
+ "needs_followup": []
224
+ }
225
+ ```
226
+
227
+ Final response must state:
228
+
229
+ ```text
230
+ 已完成:...
231
+ 未完成/未验证:...
232
+ 前端可见:是/否/未确认
233
+ 需要继续修复:是/否;原因...
234
+ ```