@finebi/finebi-cli 1.5.0 → 1.6.1

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 (152) hide show
  1. package/README.md +17 -3
  2. package/package.json +4 -3
  3. package/skills/finebi-cli-agent/SKILL.md +8 -4
  4. package/skills/finebi-cli-agent/references/command-workflows.md +8 -4
  5. package/skills/finebi-cli-agent/references/dashboard-data-result.md +191 -191
  6. package/skills/finebi-cli-agent/references/dashboard-dsl-api.md +8 -1018
  7. package/skills/finebi-cli-agent/references/dashboard-dsl-core.md +194 -0
  8. package/skills/finebi-cli-agent/references/dashboard-dsl-examples.md +378 -0
  9. package/skills/finebi-cli-agent/references/dashboard-dsl-items.md +456 -0
  10. package/skills/finebi-cli-agent/references/mapping-rules.md +14 -14
  11. package/skills/finebi-cli-agent/references/scenario-workflows.md +1 -1
  12. package/skills/finebi-cli-agent/references/web-app.md +17 -0
  13. package/skills/finebi-cli-agent/references/widget-dsl-api-examples.md +3 -4
  14. package/skills/finebi-cli-agent/references/widget-dsl-api.md +10 -1374
  15. package/skills/finebi-cli-agent/references/widget-dsl-contexts.md +142 -0
  16. package/skills/finebi-cli-agent/references/widget-dsl-core.md +374 -0
  17. package/skills/finebi-cli-agent/references/widget-dsl-encodings.md +457 -0
  18. package/skills/finebi-cli-agent/references/widget-dsl-styles.md +413 -0
  19. package/skills/finebi-cli-agent/scripts/finebi-cli/package.json +1 -1
  20. package/skills/finebi-cli-agent/scripts/finebi-cli/src/app.js +148 -0
  21. package/skills/finebi-cli-agent/scripts/finebi-cli/src/config.js +27 -27
  22. package/skills/finebi-cli-agent/scripts/finebi-cli/src/help.js +79 -55
  23. package/skills/finebi-cli-agent/scripts/finebi-cli/src/index.js +5 -0
  24. package/skills/finebi-cli-agent/scripts/finebi-cli/src/install-skill.js +89 -89
  25. package/skills/finebi-cli-agent/scripts/finebi-cli/src/profiles.js +158 -158
  26. package/skills/finebi-cli-agent/scripts/finebi-cli/src/skill-files.js +94 -94
  27. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/AGENTS.md +30 -0
  28. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/README.md +36 -0
  29. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/docs/acceptance.md +67 -0
  30. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/docs/auth-and-deploy.md +17 -0
  31. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/docs/data-contract.md +38 -0
  32. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/docs/design.md +54 -0
  33. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/docs/filters.md +93 -0
  34. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/examples/cockpit.config.json +22 -0
  35. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/examples/retail.config.json +185 -0
  36. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/index.html +2 -0
  37. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/package-lock.json +2191 -0
  38. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/package.json +16 -0
  39. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/public/app-config.json +11 -0
  40. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/scripts/dev-proxy.mjs +57 -0
  41. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/App.tsx +56 -0
  42. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/cockpit.css +3 -0
  43. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/Chart.tsx +40 -0
  44. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/DataTable.tsx +21 -0
  45. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/FilterBar.tsx +48 -0
  46. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/Insights.tsx +17 -0
  47. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/MonthPicker.tsx +32 -0
  48. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/OptionFilter.tsx +7 -0
  49. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/RangeFilter.tsx +9 -0
  50. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/Widget.tsx +39 -0
  51. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/calendar-locales.ts +3 -0
  52. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/calendar.ts +14 -0
  53. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/charts/Bar.tsx +6 -0
  54. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/charts/Line.tsx +6 -0
  55. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/charts/Pie.tsx +6 -0
  56. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/components/month-picker.css +1 -0
  57. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/finebi/client.ts +42 -0
  58. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/finebi/config.d.ts +1 -0
  59. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/finebi/config.js +44 -0
  60. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/finebi/date.d.ts +1 -0
  61. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/finebi/date.js +5 -0
  62. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/finebi/filters.d.ts +4 -0
  63. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/finebi/filters.js +106 -0
  64. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/finebi/normalize.ts +77 -0
  65. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/finebi/types.ts +18 -0
  66. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/main.tsx +5 -0
  67. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/retail.css +13 -0
  68. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/services/presentation.ts +36 -0
  69. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/services/table-data.ts +47 -0
  70. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/services/view-data.ts +18 -0
  71. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/services/widget-queries.ts +18 -0
  72. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/src/styles.css +8 -0
  73. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/tests/browser/fixtures.mjs +28 -0
  74. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/tests/browser/index.html +16 -0
  75. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/tests/browser/main.tsx +149 -0
  76. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/tests/browser/test-page.css +4 -0
  77. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/tests/browser/vite.config.mjs +13 -0
  78. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/tests/bundle.test.mjs +19 -0
  79. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/tests/calendar.test.mjs +25 -0
  80. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/tests/cockpit.test.mjs +73 -0
  81. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/tests/proxy.test.mjs +96 -0
  82. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/tests/retail.test.mjs +31 -0
  83. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/tests/runtime.test.mjs +136 -0
  84. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/tsconfig.json +4 -0
  85. package/skills/finebi-cli-agent/scripts/finebi-cli/templates/web-app/vite.config.ts +15 -0
  86. package/skills/finebi-cli-agent/scripts/finebi-cli-runner.mjs +4 -4
  87. package/src/app.js +148 -0
  88. package/src/config.js +27 -27
  89. package/src/help.js +79 -55
  90. package/src/index.js +5 -0
  91. package/src/install-skill.js +89 -89
  92. package/src/profiles.js +158 -158
  93. package/src/skill-files.js +94 -94
  94. package/templates/web-app/AGENTS.md +30 -0
  95. package/templates/web-app/README.md +36 -0
  96. package/templates/web-app/docs/acceptance.md +67 -0
  97. package/templates/web-app/docs/auth-and-deploy.md +17 -0
  98. package/templates/web-app/docs/data-contract.md +38 -0
  99. package/templates/web-app/docs/design.md +54 -0
  100. package/templates/web-app/docs/filters.md +93 -0
  101. package/templates/web-app/examples/cockpit.config.json +22 -0
  102. package/templates/web-app/examples/retail.config.json +185 -0
  103. package/templates/web-app/index.html +2 -0
  104. package/templates/web-app/package-lock.json +2191 -0
  105. package/templates/web-app/package.json +16 -0
  106. package/templates/web-app/public/app-config.json +11 -0
  107. package/templates/web-app/scripts/dev-proxy.mjs +57 -0
  108. package/templates/web-app/src/App.tsx +56 -0
  109. package/templates/web-app/src/cockpit.css +3 -0
  110. package/templates/web-app/src/components/Chart.tsx +40 -0
  111. package/templates/web-app/src/components/DataTable.tsx +21 -0
  112. package/templates/web-app/src/components/FilterBar.tsx +48 -0
  113. package/templates/web-app/src/components/Insights.tsx +17 -0
  114. package/templates/web-app/src/components/MonthPicker.tsx +32 -0
  115. package/templates/web-app/src/components/OptionFilter.tsx +7 -0
  116. package/templates/web-app/src/components/RangeFilter.tsx +9 -0
  117. package/templates/web-app/src/components/Widget.tsx +39 -0
  118. package/templates/web-app/src/components/calendar-locales.ts +3 -0
  119. package/templates/web-app/src/components/calendar.ts +14 -0
  120. package/templates/web-app/src/components/charts/Bar.tsx +6 -0
  121. package/templates/web-app/src/components/charts/Line.tsx +6 -0
  122. package/templates/web-app/src/components/charts/Pie.tsx +6 -0
  123. package/templates/web-app/src/components/month-picker.css +1 -0
  124. package/templates/web-app/src/finebi/client.ts +42 -0
  125. package/templates/web-app/src/finebi/config.d.ts +1 -0
  126. package/templates/web-app/src/finebi/config.js +44 -0
  127. package/templates/web-app/src/finebi/date.d.ts +1 -0
  128. package/templates/web-app/src/finebi/date.js +5 -0
  129. package/templates/web-app/src/finebi/filters.d.ts +4 -0
  130. package/templates/web-app/src/finebi/filters.js +106 -0
  131. package/templates/web-app/src/finebi/normalize.ts +77 -0
  132. package/templates/web-app/src/finebi/types.ts +18 -0
  133. package/templates/web-app/src/main.tsx +5 -0
  134. package/templates/web-app/src/retail.css +13 -0
  135. package/templates/web-app/src/services/presentation.ts +36 -0
  136. package/templates/web-app/src/services/table-data.ts +47 -0
  137. package/templates/web-app/src/services/view-data.ts +18 -0
  138. package/templates/web-app/src/services/widget-queries.ts +18 -0
  139. package/templates/web-app/src/styles.css +8 -0
  140. package/templates/web-app/tests/browser/fixtures.mjs +28 -0
  141. package/templates/web-app/tests/browser/index.html +16 -0
  142. package/templates/web-app/tests/browser/main.tsx +149 -0
  143. package/templates/web-app/tests/browser/test-page.css +4 -0
  144. package/templates/web-app/tests/browser/vite.config.mjs +13 -0
  145. package/templates/web-app/tests/bundle.test.mjs +19 -0
  146. package/templates/web-app/tests/calendar.test.mjs +25 -0
  147. package/templates/web-app/tests/cockpit.test.mjs +73 -0
  148. package/templates/web-app/tests/proxy.test.mjs +96 -0
  149. package/templates/web-app/tests/retail.test.mjs +31 -0
  150. package/templates/web-app/tests/runtime.test.mjs +136 -0
  151. package/templates/web-app/tsconfig.json +4 -0
  152. package/templates/web-app/vite.config.ts +15 -0
package/README.md CHANGED
@@ -27,6 +27,7 @@ finebi-cli capabilities --help
27
27
  finebi-cli config --help
28
28
  finebi-cli auth --help
29
29
  finebi-cli capability --help
30
+ finebi-cli app --help
30
31
  ```
31
32
 
32
33
  Dynamic resource help, such as `finebi-cli <resource> --help`, is loaded from the FineBI capability cache. Login refreshes this cache automatically:
@@ -40,6 +41,19 @@ finebi-cli <resource> --help
40
41
  finebi-cli <resource> <command> [options]
41
42
  ```
42
43
 
44
+ Create and inspect a local dynamic web app project without connecting to FineBI:
45
+
46
+ ```powershell
47
+ finebi-cli app create --name sales-dashboard --path D:\work --layout cockpit
48
+ finebi-cli app inspect --path D:\work\sales-dashboard
49
+ ```
50
+
51
+ `app create` copies the bundled `web-app` template, sets the project npm name, and records the template version in `public/app-config.json`. It rejects an existing destination and does not install dependencies or run project scripts. `app inspect` checks the local configuration and reports `remoteValidated: false`; use the generated project to perform the real login and data request checks in a browser.
52
+
53
+ `--layout` accepts `overview` (default), `workbench`, or the green `cockpit` layout. Cockpit shares the existing Cookie query and authentication flow, with configurable KPI/chart/table bindings, independent retries, and a custom month picker. The generated README and `examples/cockpit.config.json` describe the placeholder bindings; no business data or credentials are bundled. Published sources require `directoryEntryId` and a platform HTTP endpoint that supports directory permissions; failed queries never switch sources.
54
+
55
+ Use `--layout retail` for a warm paper-style retail brief with horizontal navigation, a KPI strip, and blue/orange charts. `examples/retail.config.json` contains placeholder retail bindings; see the generated design guide for explicit KPI and month-label formats. Creation leaves the project unbound and does not query a server.
56
+
43
57
  Run `finebi-cli capability refresh` manually when backend commands changed, the cache expired, or you want to force a reload.
44
58
 
45
59
  For dashboard component queries, use repeatable inline filters or a JSON file (mutually exclusive):
@@ -55,13 +69,13 @@ For temporary field selection, first read the target instance's field directory:
55
69
 
56
70
  ```powershell
57
71
  finebi-cli dashboard info --id <dashboardId>
58
- finebi-cli dashboard data --id <dashboardId> --entry-id <entryId> --dimension-ids '["<dId>"]' --filter "合同付款类型=分期付款"
72
+ finebi-cli dashboard data --id <dashboardId> --entry-id <entryId> --dimension-ids '["<dimensionDId>","<measureDId>"]' --filter "合同付款类型=分期付款"
59
73
  finebi-cli dashboard data --id <dashboardId> --entry-id <entryId> --dimension-ids '[]'
60
74
  ```
61
75
 
62
- Use `entries[].queryFields[].dId` where `selectable=true`; this is a component-local key, not a dataset `fieldId` or field name. `queryFields` includes disabled fields and reports their saved `used` flag. Omit `--dimension-ids` to keep the saved selection. An explicit `[]` removes selectable dimensions while retaining summary/chart metrics; a detail table returns no columns or rows. Existing filters remain effective. Empty output columns do not imply that native pagination totals are zero.
76
+ Use `entries[].queryFields[].dId` where `selectable=true`; this is a component-local key, not a dataset `fieldId` or field name. `queryFields` includes disabled fields and reports their saved `used` flag. Omit `--dimension-ids` to keep the saved selection. The list is a complete whitelist of dimensions and measures: unlisted selectable fields are disabled. Include measure dIds explicitly to keep their output; selecting only measures disables selectable dimensions. An explicit `[]` disables all selectable dimensions and measures; a detail table returns no columns or rows. Existing filters remain effective. Empty output columns do not imply that native pagination totals are zero.
63
77
 
64
- For a published dashboard, pass the same `--directory-entry-id` to `dashboard info` and `dashboard data`, and use dIds from that source. Installing this npm package updates only the client and bundled Skill. These commands require a compatible server plugin and platform Provider; the plugin directly depends on the dimension-selection and published-source APIs. Refresh capabilities after the server update.
78
+ For a published dashboard, pass the same `--directory-entry-id` to `dashboard info` and `dashboard data`, and use dIds from that source. Installing this npm package updates only the client and bundled Skill. These commands require a server plugin and platform Provider supporting the complete dimension-and-measure whitelist; the plugin directly depends on the dimension-selection and published-source APIs. Refresh capabilities after the server update.
65
79
 
66
80
  ### Multiple environments
67
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finebi/finebi-cli",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
4
4
  "description": "FineBI dynamic capability command line client.",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -14,7 +14,8 @@
14
14
  "files": [
15
15
  "src",
16
16
  "skills",
17
- "README.md"
17
+ "README.md",
18
+ "templates"
18
19
  ],
19
20
  "engines": {
20
21
  "node": ">=18.17"
@@ -23,7 +24,7 @@
23
24
  "prepack": "node ../scripts/build-finebi-cli-agent.mjs",
24
25
  "test:pack": "node ../scripts/test-cli-package.mjs",
25
26
  "test": "npm run test:unit && npm run test:process && npm run test:contract && npm run test:integration:stub",
26
- "test:unit": "node --test tests/unit/access-key.test.js tests/unit/auth.test.js tests/unit/capability.test.js tests/unit/config-permissions.test.js tests/unit/config.test.js tests/unit/dynamic-command-forwarding.test.js tests/unit/dynamic-command-multipart.test.js tests/unit/dynamic-command-preflight.test.js tests/unit/error-catalog-loader.test.js tests/unit/error-catalog.test.js tests/unit/error-construction-guard.test.js tests/unit/help.test.js tests/unit/http-stub.test.js tests/unit/index-auth-login.test.js tests/unit/index-auth-session.test.js tests/unit/index-browser-auth.test.js tests/unit/index-config.test.js tests/unit/index-dynamic-errors.test.js tests/unit/index-dynamic-render.test.js tests/unit/index-help.test.js tests/unit/index-profiles.test.js tests/unit/install-skill.test.js tests/unit/output-limits.test.js tests/unit/output.test.js tests/unit/package.test.js tests/unit/schema-options-capability.test.js tests/unit/schema-options-file-input.test.js tests/unit/schema-options-scalar.test.js",
27
+ "test:unit": "node --test tests/unit/access-key.test.js tests/unit/app.test.js tests/unit/auth.test.js tests/unit/capability.test.js tests/unit/config-permissions.test.js tests/unit/config.test.js tests/unit/dynamic-command-forwarding.test.js tests/unit/dynamic-command-multipart.test.js tests/unit/dynamic-command-preflight.test.js tests/unit/error-catalog-loader.test.js tests/unit/error-catalog.test.js tests/unit/error-construction-guard.test.js tests/unit/help.test.js tests/unit/http-stub.test.js tests/unit/index-auth-login.test.js tests/unit/index-auth-session.test.js tests/unit/index-browser-auth.test.js tests/unit/index-config.test.js tests/unit/index-dynamic-errors.test.js tests/unit/index-dynamic-render.test.js tests/unit/index-help.test.js tests/unit/index-profiles.test.js tests/unit/install-skill.test.js tests/unit/output-limits.test.js tests/unit/output.test.js tests/unit/package.test.js tests/unit/schema-options-capability.test.js tests/unit/schema-options-file-input.test.js tests/unit/schema-options-scalar.test.js",
27
28
  "test:process": "node --test tests/process/bench-cli-runner.test.js tests/process/process-cli.test.js tests/process/profiles-cli.test.js",
28
29
  "test:contract": "node --test tests/contract/capability-contract.test.js tests/contract/dashboard-data.test.js tests/contract/subject-publication.test.js",
29
30
  "test:integration:stub": "node --test tests/integration/analysis-ds-workflows.test.js tests/integration/assertions.test.js tests/integration/auth-system.test.js tests/integration/case-loader.test.js tests/integration/cli-process.test.js tests/integration/config.test.js tests/integration/dashboard-workflows.test.js tests/integration/entry.test.js tests/integration/failure-security.test.js tests/integration/file-template.test.js tests/integration/mutating-file-input.test.js tests/integration/mutating-resource-ledger.test.js tests/integration/mutating-workflow-guards.test.js tests/integration/readonly-assertions.test.js tests/integration/readonly-file-input.test.js tests/integration/readonly-workflow-contract.test.js tests/integration/report-directory.test.js tests/integration/report-entry.test.js tests/integration/report-secrets.test.js tests/integration/report-summary-artifacts.test.js tests/integration/runner.test.js",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: finebi-cli-agent
3
- description: 使用 FineBI CLI 查询和管理 FineBI 资源,生成并应用组件(Widget)和仪表板(Dashboard)DSL,优先使用内置 CLI,也支持已安装的全局 @finebi/finebi-cli。用户需要查看或操作分析主题、数据集、计算字段、图表组件、仪表板,或配置 FineBI CLI 连接与认证时使用。
3
+ description: 使用 FineBI CLI 查询和管理 FineBI 资源,生成并应用组件(Widget)和仪表板(Dashboard)DSL,优先使用内置 CLI,也支持已安装的全局 @finebi/finebi-cli。用户需要查看或操作分析主题、数据集、计算字段、图表组件、仪表板,配置 FineBI CLI 连接与认证,或生成动态 HTML 看板、数据 Web 应用时使用。
4
4
  ---
5
5
 
6
6
  # FineBI CLI Agent
@@ -18,12 +18,14 @@ description: 使用 FineBI CLI 查询和管理 FineBI 资源,生成并应用
18
18
 
19
19
  ## 按需读取参考
20
20
 
21
+ - 生成动态 HTML 页面或数据 Web 应用时,读取 [应用模板工作流](references/web-app.md),通过本地 app create 创建工程,再遵循项目 AGENTS.md。
22
+
21
23
  - 首次处理业务命令时,读取 [命令工作流](references/command-workflows.md) 的公共约束和目标命令族章节。
22
24
  - 包含非只读动作时,读取 [变更计划与删除确认契约](references/mutation-confirmation-contract.md) 的计划、复检和验证规则;包含 `delete` 或失败清理时再读对应章节。
23
25
  - 规划 Widget/Dashboard 时按当前场景读取 [场景工作流](references/scenario-workflows.md);构造或消费交接对象时读取 [语义交接契约](references/handoff-contract.md) 和 [DSL 输入契约](references/dsl-handoff-contract.md) 的公共结构及当前场景字段。
24
- - 生成 Widget DSL 时,读取 [映射规则](references/mapping-rules.md) 和 [Widget DSL API](references/widget-dsl-api.md) 的公共约束及所用组件、字段类型和 API 章节。
26
+ - 生成 Widget DSL 时,读取 [映射规则](references/mapping-rules.md),并按需读取 [Widget DSL API](references/widget-dsl-api.md) 导航的拆分文件,不一次加载全部:写组件前读 [widget-dsl-core.md](references/widget-dsl-core.md)(根入口/字段工厂/Builder);配置图表类型与通道编码读 [widget-dsl-encodings.md](references/widget-dsl-encodings.md);调整样式、视觉通道、轴或排序读 [widget-dsl-styles.md](references/widget-dsl-styles.md);配置过滤、配色、数值格式或查枚举读 [widget-dsl-contexts.md](references/widget-dsl-contexts.md)。
25
27
  - 需要可运行的推荐写法示例(分区折线/双轴/表格属性等)时,读取 [Widget DSL 写法示例](references/widget-dsl-api-examples.md)。
26
- - 生成 Dashboard DSL 时,读取 [Dashboard DSL API](references/dashboard-dsl-api.md) 的公共约束和所用布局、引用及 API 章节;仅引用已有组件时无需加载 Widget API。产物顺序不清楚时读取 [产物顺序](references/artifact-ordering.md)。
28
+ - 生成 Dashboard DSL 时,按需读取 [Dashboard DSL API](references/dashboard-dsl-api.md) 导航的拆分文件,不一次加载全部:写板前读 [dashboard-dsl-core.md](references/dashboard-dsl-core.md)(根入口/布局/移动端/字段写法);挂载或配置具体条目类型读 [dashboard-dsl-items.md](references/dashboard-dsl-items.md);需要可抄写法或场景模板读 [dashboard-dsl-examples.md](references/dashboard-dsl-examples.md)。仅引用已有组件时无需加载 Widget API。产物顺序不清楚时读取 [产物顺序](references/artifact-ordering.md)。
27
29
  - 解释或生成公式时,先用 `formula functions` 查询当前 FineBI 公式面板;绑定真实字段后,用 `calculated-field validate` 执行原生校验。
28
30
  - 同一连续任务内复用未变化的已读内容;只有文件变化、进入未读能力,或上下文压缩后所需规则已不可用时,才补读相关部分。实时 capability、目标和文件摘要校验仍按变更契约执行,不以文档复用代替。
29
31
 
@@ -89,7 +91,9 @@ node "<skill-dir>/scripts/finebi-cli-runner.mjs" run <resource> <command> ... --
89
91
 
90
92
  需要生成 JSON Definition 时,先 `inspect` 对应的 `template` 命令;实时 capability 为 `mutation:false` 时执行它,并以返回的 `definitionSchema`、`definitionTemplate` 和填写指引生成文件。不得凭经验猜测 Definition 结构。
91
93
 
92
- 模型指标集不走分析表或公共数据集搜索。先调用 `subject info` 查看 `resources.models` 主题模型摘要,再用 `model search --subject-id <subjectId>` 消歧主题内模型,并用 `model info --subject-id <subjectId> --id <modelId>` 获取具体指标、数据集字段和模型计算字段。若用户要求的指标集尚未属于主题,单独以 `public-ds search` 确认唯一的 `type=METRIC_SET` 来源和可编辑目标主题;`model add` 返回的主题内模型 ID 才可用于 `model info/delete` 和字段回查,来源 ID 不得写进 DSL。模型目录命令未出现在实时 capability 时,既有 `widget dsl` 输出中的 `model(...)` 仍可作为只读证据;两类证据都不存在时进入 `BLOCKED`。不得把同名分析表改写成模型指标集。
94
+ 模型来源探查先用 `public-ds search` 确认 `type=METRIC_SET` 来源,再调用 `model source-info --id <sourceId>` 获取字段目录和来源展示提示,无需主题。字段状态、来源文本与后续命名空间确认按 [Model 工作流](references/command-workflows.md#76-model-metric-set) 判读。
95
+
96
+ 生成制品时,先调用 `subject info` 查看 `resources.models` 主题模型摘要,再用 `model search --subject-id <subjectId>` 消歧主题内模型,并用 `model info --subject-id <subjectId> --id <modelId>` 获取具体指标、数据集字段和模型计算字段。若用户要求的指标集尚未属于主题,确认唯一来源和可编辑目标主题;`model add` 返回的主题内模型 ID 才可用于 `model info/delete` 和字段回查,来源探查不能替代该确认,来源 ID 不得写进 DSL。模型目录命令未出现在实时 capability 时,既有 `widget dsl` 输出中的 `model(...)` 仍可作为只读证据;两类证据都不存在时进入 `BLOCKED`。不得把同名分析表改写成模型指标集。
93
97
 
94
98
  ### 4. 生成 Widget/Dashboard DSL
95
99
 
@@ -16,6 +16,8 @@
16
16
 
17
17
  ## 2. 当前命令矩阵
18
18
 
19
+ 动态 HTML 看板与数据 Web 应用使用本地 `app create/inspect`,不属于远端 capability;具体开发流程见[应用模板工作流](web-app.md)。
20
+
19
21
  以下矩阵仅列出常见资源命令示例;实际可执行范围以实时 capability 为准。
20
22
 
21
23
  | 资源 | 只读(`mutation:false`) | 非只读(`mutation:true`) |
@@ -24,7 +26,7 @@
24
26
  | `calculated-field` | `context`, `dsl`, `info`, `validate` | `add`, `delete`, `update` |
25
27
  | `dashboard` | `search`, `info`, `preview` | `add`, `delete`, `update` |
26
28
  | `data-connection` | `search`, `tables` | — |
27
- | `model` | `info`, `search` | `add`, `delete` |
29
+ | `model` | `info`, `search`, `source-info` | `add`, `delete` |
28
30
  | `metric-condition` | `dsl` | `update` |
29
31
  | `measure` | `info`, `search` | `copy`, `transform`, `delete` |
30
32
  | `geographic-role` | `info`、`dsl`、`catalog`、`match`(显式输入值) | `set`、`clear` |
@@ -77,7 +79,7 @@
77
79
  - `operator-schema`:返回分析数据集 DSL 语句面(可写步骤类型 + 表级声明 + 签名 + 约束;`--type` 过滤单个类型)。
78
80
  - `validate`:编译并验证计算字段 JavaScript,不执行保存。
79
81
  - `data-connection.tables`:仅在数据集层没有合理候选后,列出指定数据连接下的表。
80
- - `model.search`:在已确认主题内定位当前用户可查询的模型指标集;`model.info`:展开选定模型的指标、数据集字段和模型计算字段目录;`model.add`:将 `public-ds.search` 中已确认的 `type=METRIC_SET` 来源 ID 挂入可编辑主题,返回的主题内模型 ID 才可用于 `model.info/delete`;`model.delete`:移除该主题内模型并保留来源指标集。
82
+ - `model.source-info`:使用 `public-ds.search` 的 `type=METRIC_SET` 来源 ID,无主题探查来源字段目录和来源展示提示;`model.search`:在已确认主题内定位当前用户可查询的模型指标集;`model.info`:展开选定模型的指标、数据集字段和模型计算字段目录;`model.add`:将已确认来源挂入可编辑主题,返回的主题内模型 ID 才可用于 `model.info/delete`;`model.delete`:移除该主题内模型并保留来源指标集。
81
83
  - `metric-condition.dsl`:按 `--field-id` 回读主题共享指标条件的可编辑 `MetricConditionModel` DSL;字段无条件时返回 `clear()` 形态,写回即幂等。
82
84
  - `public-ds-folder.search`:定位公共数据目录。
83
85
  - `relationship.info`:确认当前关系;执行 add/delete 前必须调用。
@@ -116,7 +118,7 @@
116
118
 
117
119
  ### 7.3 Dashboard 与 Widget
118
120
 
119
- 查询仪表板组件时,先从同一来源的 `dashboard info` 读取目标条目的 `queryFields`,用 `selectable=true` 的 `dId` 构造 `dashboard data --dimension-ids '["<dId>"]'`。这些 ID 是组件内部键,不是数据集 fieldId;目录包含关闭的字段,`used` 表示保存状态。省略参数沿用配置,`[]` 关闭全部可选维度;汇总组件的指标保留,明细表按列选择。可同时传 `--filter` 或 `--filters-file`;选择不清除过滤、不保存配置。插件直接依赖支持维度选择和发布来源查询的 Provider;编译构件与部署平台需具备相同接口契约。字段目录、空列表与兼容语义见 `docs/dashboard-command-design.md` 的查询契约。
121
+ 查询仪表板组件时,先从同一来源的 `dashboard info` 读取目标条目的 `queryFields`,用 `selectable=true` 的 `dId` 构造 `dashboard data --dimension-ids '["<dimensionDId>","<measureDId>"]'`。这些 ID 是组件内部键,不是数据集 fieldId;目录包含关闭的字段,`used` 表示保存状态。省略参数沿用配置;列表是维度和指标的完整白名单,未列出的可选字段全部关闭。只传维度会关闭未选指标,只传指标会关闭全部可选维度;`[]` 关闭全部可选维度和指标,明细表无列及数据行。可同时传 `--filter` 或 `--filters-file`;选择不清除过滤、不保存配置。插件直接依赖支持维度与指标完整白名单选择和发布来源查询的 Provider;编译构件与部署平台需具备相同接口契约。字段目录、空列表与兼容语义见 `docs/dashboard-command-design.md` 的查询契约。
120
122
 
121
123
  查询目录发布版时,从 `dashboard search` 的候选位置选定 `locations[].entryId`,对 `dashboard info` 和 `dashboard data` 都携带同一 `--directory-entry-id <directoryEntryId>`。先从该来源的 `info` 获取组件实例 `entries[].entryId` 和控件实际 `filterName`,再查询该组件。检查响应 `source=PUBLISHED_DIRECTORY` 及 `directoryEntryId`;普通来源为 `MY_ANALYSIS`。目录入口不能当作组件实例 ID,平台不支持或目录授权失败时不得丢弃入口参数后重试普通看板。
122
124
 
@@ -150,7 +152,9 @@ DSL 语句面与 `widget template` / `dashboard template` 一致(见 handoff-d
150
152
 
151
153
  ### 7.6 Model Metric Set
152
154
 
153
- 先用 `subject.info` 或 `model.search` 确认目标主题中的既有模型。需要将公共来源指标集加入主题时,先用 `public-ds.search` 确认唯一的 `type=METRIC_SET` 候选和来源 ID,再确认目标主题可编辑;`model.add --subject-id <subjectId> --id <sourceId>` 成功后必须使用响应中的主题内模型 ID 调用 `model.info` 回查名称、归属与字段目录。来源 ID 不能用于 `model.info` 或 `model.delete`,也不能写入 DSL。
155
+ 仅探查来源或尚无主题时,先用 `public-ds.search` 确认 `type=METRIC_SET` 候选和来源 ID,再执行 `model.source-info --id <sourceId>`。它只读返回 `fields` 字段目录、来源展示提示与原生已报告的无效/缺失项,不返回数据行,也不自动创建或修改主题。读取字段时检查 `valid`、`invalidFieldIds` 和 `missingFieldIds`;缺失清单不保证穷尽所有断链。`sourceName` 是原生来源展示文本,可能是表名、维度来源或本地化分组;不能据此推断 DSL 命名空间或数据集 ID。`aggregate` 仅表示已经聚合,不能据此选择 `SUM`/`AVG` 等函数。
156
+
157
+ 需要生成组件或仪表板 DSL 时,先用 `subject.info` 或 `model.search` 确认目标主题中的既有模型。需要将公共来源指标集加入主题时,先确认唯一来源和目标主题可编辑;`model.add --subject-id <subjectId> --id <sourceId>` 成功后必须使用响应中的主题内模型 ID 调用 `model.info` 回查名称、归属与字段目录,取得最终命名空间和真实 ID。只有来源探查结果时尚不能构建主题内模型交接对象。来源 ID 不能用于 `model.info` 或 `model.delete`,也不能写入 DSL。
154
158
 
155
159
  `model.delete` 前重新用 `model.search` 或 `model.info` 确认主题内模型 ID、名称和归属。它只移除主题关联,保留来源指标集;因此必须按删除确认流程执行。模型字段生成 DSL 时,根级指标使用 `model(name).metrics()`,模型表字段使用 `model(name).dataset(datasetName)`,模型计算字段使用 `model(name).calculated()`;模型根级维度和记录数不支持。
156
160
 
@@ -1,13 +1,13 @@
1
- # 仪表板组件查询结果契约
2
-
1
+ # 仪表板组件查询结果契约
2
+
3
3
  ## 1. 适用范围
4
4
 
5
5
  `result` 是插件根据本次 Provider 的预览结果及返回的组件配置生成的独立契约,`schemaVersion` 为 `"1"`。现有顶层字段保持原语义,`dashboard preview` 不使用此契约。未增加过滤生效回显。值表示组件查询结果(可能经过聚合、计算、分组、权限和脱敏处理),不承诺是数据库原始值。
6
-
7
- 响应中的 `fields/rows` 是兼容投影:交叉表仅左侧分区、复杂图表仅首个模型,不能代替标准化结果。类型专属结构保留在原生 `previewResult` 中,由 `resultType=DETAIL/BIGROUP/BICROSS/CHART` 区分;不要与本契约的 resultType 枚举混用,也不能用旧 rows 猜测填补不可用值。
8
6
 
9
- ## 2. 返回结构与完整性
10
-
7
+ 响应中的 `fields/rows` 是兼容投影:交叉表仅左侧分区、复杂图表仅首个模型,不能代替标准化结果。类型专属结构保留在原生 `previewResult` 中,由 `resultType=DETAIL/BIGROUP/BICROSS/CHART` 区分;不要与本契约的 resultType 枚举混用,也不能用旧 rows 猜测填补不可用值。
8
+
9
+ ## 2. 返回结构与完整性
10
+
11
11
  | 字段 | 语义 |
12
12
  | --- | --- |
13
13
  | `resultType` | `DETAIL_TABLE / GROUP_TABLE / CROSS_TABLE / CHART / UNKNOWN` |
@@ -16,17 +16,17 @@
16
16
  | `datasets[]` | 独立数据模型,含 `id/columns/rows/returnedRowCount`;图表共用同一模型对象时去重,不同模型不能直接拼接求和 |
17
17
  | `warnings[]` | 稳定原因码;结构未完整转换时必须检查原生 `previewResult`,不能把空 datasets 解释为业务无数据 |
18
18
 
19
- ## 3. 分页与数量
20
-
21
- 命令仅返回首页或初始视图,支持 `--page-size` 控制有分页器表格的首页大小,不支持指定页码或续页。`range.mode` 为 `PAGE / INITIAL_VIEW / UNPAGED / UNKNOWN`;PAGE 描述本次返回的是表格首页(page=1),不声明续页能力。明细表 pageUnit 为 ROW,普通分组表为 GROUP,展开后的 `returnedRowCount` 不必等于 pageSize。表头展开模式为 INITIAL_VIEW,不暴露普通页码和续页标志;图表为 UNPAGED。交叉表标准化范围为 UNKNOWN,原生纵向状态由现有顶层字段表达,横向状态需读取 previewResult。
22
-
23
- 原生 `hasNext=true` 保持真实值,仅表示仍有后续数据;此时 `warnings` 包含 `NEXT_PAGE_UNSUPPORTED`,不得尝试续页或将当前结果宣称为全量。交叉表任一方向有后续数据也返回该警告;表头展开模式的 range 不提供续页标志,但原生结果标记仍有下一页时同样警告。该警告不改变 normalization:COMPLETE 只说明本次结构完整转换。
24
-
25
- `total` 结构为 `{value,unit}`,仅明细表采用有效的原生总数(unit=DETAIL_ROW);普通分组总数未知(value=null、unit=GROUP),INITIAL_VIEW 的 total.value/unit 均为 null,图表不把模型行数当作查询总数。没有下一页不代表取得底层明细全集,也不排除组件自身 Top N、聚合等限制。
19
+ ## 3. 分页与数量
20
+
21
+ 命令仅返回首页或初始视图,支持 `--page-size` 控制有分页器表格的首页大小,不支持指定页码或续页。`range.mode` 为 `PAGE / INITIAL_VIEW / UNPAGED / UNKNOWN`;PAGE 描述本次返回的是表格首页(page=1),不声明续页能力。明细表 pageUnit 为 ROW,普通分组表为 GROUP,展开后的 `returnedRowCount` 不必等于 pageSize。表头展开模式为 INITIAL_VIEW,不暴露普通页码和续页标志;图表为 UNPAGED。交叉表标准化范围为 UNKNOWN,原生纵向状态由现有顶层字段表达,横向状态需读取 previewResult。
22
+
23
+ 原生 `hasNext=true` 保持真实值,仅表示仍有后续数据;此时 `warnings` 包含 `NEXT_PAGE_UNSUPPORTED`,不得尝试续页或将当前结果宣称为全量。交叉表任一方向有后续数据也返回该警告;表头展开模式的 range 不提供续页标志,但原生结果标记仍有下一页时同样警告。该警告不改变 normalization:COMPLETE 只说明本次结构完整转换。
24
+
25
+ `total` 结构为 `{value,unit}`,仅明细表采用有效的原生总数(unit=DETAIL_ROW);普通分组总数未知(value=null、unit=GROUP),INITIAL_VIEW 的 total.value/unit 均为 null,图表不把模型行数当作查询总数。没有下一页不代表取得底层明细全集,也不排除组件自身 Top N、聚合等限制。
26
26
 
27
- ## 4. 列、行与单元格
28
-
29
- 列包含 `key/fieldId/name/type/encoding`。key 是当前 dataset 内唯一位置键(c0、c1…),不承诺跨查询稳定;fieldId 是结果字段 ID,不是底层数据集列 ID。类型仅采用可核实的结果/组件元数据:STRING 使用 STRING 编码,数值统一 DECIMAL + DECIMAL_STRING(支持规范科学计数法),明细表日期使用 DATE + EPOCH_MILLIS_STRING,未知类型为 UNKNOWN、encoding=null。不根据样例猜类型。数值字符串保留上游已有精度,不能恢复上游浮点误差。
27
+ ## 4. 列、行与单元格
28
+
29
+ 列包含 `key/fieldId/name/type/encoding`。key 是当前 dataset 内唯一位置键(c0、c1…),不承诺跨查询稳定;fieldId 是结果字段 ID,不是底层数据集列 ID。类型仅采用可核实的结果/组件元数据:STRING 使用 STRING 编码,数值统一 DECIMAL + DECIMAL_STRING(支持规范科学计数法),明细表日期使用 DATE + EPOCH_MILLIS_STRING,未知类型为 UNKNOWN、encoding=null。不根据样例猜类型。数值字符串保留上游已有精度,不能恢复上游浮点误差。
30
30
 
31
31
  行结构为 `{kind,cells}`,cells 与 columns 位置对应。`kind` 为 DATA、SUBTOTAL、GRAND_TOTAL、UNKNOWN;正常聚合分组仍为 DATA,额外小计/总计用独立类型。明细行是 DATA,分组行依据原生 rowSumInfo;缺失或冲突为 UNKNOWN,不按“合计”等文本猜测。父节点的合计与子节点都保留,汇总时必须区分 kind;图表行没有统一的合计标记时为 UNKNOWN。
32
32
 
@@ -39,181 +39,181 @@
39
39
  | UNAVAILABLE | 无法可靠取得值;展示文本独立保留,reason 指出原因 |
40
40
  | RESTRICTED | 原生权限标记或明确权限占位表明值受限,value=null;不区分无权限与脱敏的具体原因 |
41
41
 
42
- ## 5. 各类型的值来源与限制
43
-
44
- 明细表使用 value 通道,authority=false 时不暴露加密值。日期元数据明确为 DATE、DATE_DIMENSION、DATE_CREATED_BY_CALC 或 DATE_FROM_AGG_CALC 时,value 保留平台返回的 Unix epoch 毫秒整数文本(有符号 64 位范围),display 保留 formatText,缺失时采用 text。插件不转换时区,不从展示文本反推时间戳,也不承诺展示日期对应 UTC 零点。消费者应保留时间戳字符串或使用支持 64 位整数的解析方式,避免 JavaScript Number 精度损失;浮点数、日期标签、小数、科学计数法、空白及越界值标为 UNAVAILABLE / INVALID_TIMESTAMP_VALUE。此规则仅适用于明细表,不能套用到分组或图表的日期标签。
45
-
46
- 分组指标使用 value,缺失时使用主工程保留的规范数值 text,绝不解析 formatText 的千分位、百分号、单位。分组字符串维度提供查询分组键;数值/日期分组键语义不能确认时为 UNAVAILABLE。字符串达到当前平台 cellCharLimit 时保守标记 POSSIBLY_TRUNCATED,不能声称它一定截断。类型缺失、展示专用值、缺少单元格分别标记不可用,不填造业务空值;日期也遵循这些规则及权限、空值规则。
42
+ ## 5. 各类型的值来源与限制
43
+
44
+ 明细表使用 value 通道,authority=false 时不暴露加密值。日期元数据明确为 DATE、DATE_DIMENSION、DATE_CREATED_BY_CALC 或 DATE_FROM_AGG_CALC 时,value 保留平台返回的 Unix epoch 毫秒整数文本(有符号 64 位范围),display 保留 formatText,缺失时采用 text。插件不转换时区,不从展示文本反推时间戳,也不承诺展示日期对应 UTC 零点。消费者应保留时间戳字符串或使用支持 64 位整数的解析方式,避免 JavaScript Number 精度损失;浮点数、日期标签、小数、科学计数法、空白及越界值标为 UNAVAILABLE / INVALID_TIMESTAMP_VALUE。此规则仅适用于明细表,不能套用到分组或图表的日期标签。
45
+
46
+ 分组指标使用 value,缺失时使用主工程保留的规范数值 text,绝不解析 formatText 的千分位、百分号、单位。分组字符串维度提供查询分组键;数值/日期分组键语义不能确认时为 UNAVAILABLE。字符串达到当前平台 cellCharLimit 时保守标记 POSSIBLY_TRUNCATED,不能声称它一定截断。类型缺失、展示专用值、缺少单元格分别标记不可用,不填造业务空值;日期也遵循这些规则及权限、空值规则。
47
47
 
48
48
  图表遍历 geom 模型和 shared 模型;已由平台处理的数值型指标可计算,字符串指标不反解析;维度字符串作为分组键,不能当作原始字段值。图表没有可直接采用的指标展示文本时 display=null。计算/缓存态未覆盖时为 PARTIAL,无内联模型时为 UNSUPPORTED。交叉表 v1 标记 UNSUPPORTED、warnings 包含 CROSS_TABLE_NORMALIZATION_UNSUPPORTED,完整原生数据继续保存在 previewResult。
49
49
 
50
- ## 6. Agent 消费顺序
51
-
52
- 消费顺序:检查 schemaVersion 和 normalization → 选择 dataset → 按列解释 AVAILABLE 单元格 → 根据 kind 区分汇总行 → 检查 range 与 warnings 并说明取数范围。出现 NEXT_PAGE_UNSUPPORTED 时必须说明仍有数据且命令不支持获取后续页。UNKNOWN 行不能自动当作明细累加。存在 PARTIAL、UNSUPPORTED 或 UNAVAILABLE 时应说明缺口,不能转用旧 rows 猜测填补。
53
-
54
- KPI 的单个 AVAILABLE 指标可以直接读取;其 kind=UNKNOWN 表示缺少统一的行分类依据,不表示指标值不可用。不要因为 kind 未知而自动丢弃这个指标,也不要把它与其他未知行直接累加。
55
-
56
- 命令参数、实例发现和过滤方式见[命令工作流](command-workflows.md)。此参考文档随 Skill 分发,无需访问工程源码即可解释结果。
57
-
58
- ## 7. 脱敏返回示例
59
-
60
- 以下只展示 `data.result`,不是整个响应 envelope。示例沿用实际查询的结构和状态,字段 ID、业务 ID、日期及统计数值均已替换为虚构内容,业务分类使用通用示例值,不可作为真实业务结论。三个示例代表同一示例看板:共 10 份合同、金额 50,000、购买数量 12;明细仅取前 2 行。
61
-
62
- ### 7.1 明细表
63
-
64
- PAGE 模式,第 1 页共 2 行,hasNext=true,NEXT_PAGE_UNSUPPORTED 表明仍有数据且无法续页。合同编号保留字符串语义;金额的 value 与带千分位的 display 分离。签约时间的 value 为毫秒时间戳字符串,display 为平台日期文本,state=AVAILABLE。COMPLETE 不代表拿到了全部 10 行或每个单元格都有可计算值。
65
-
66
- ```json
67
- {
68
- "schemaVersion": "1",
69
- "resultType": "DETAIL_TABLE",
70
- "normalization": "COMPLETE",
71
- "range": {
72
- "mode": "PAGE",
73
- "page": 1,
74
- "pageSize": 2,
75
- "pageUnit": "ROW",
76
- "hasNext": true,
77
- "hasPrevious": false,
78
- "total": {"value":10,"unit":"DETAIL_ROW"}
79
- },
80
- "datasets": [
81
- {
82
- "id": "main",
83
- "columns": [
84
- {"key":"c0","fieldId":"example_detail_c0","name":"合同ID","type":"STRING","encoding":"STRING"},
85
- {"key":"c1","fieldId":"example_detail_c1","name":"客户ID","type":"STRING","encoding":"STRING"},
86
- {"key":"c2","fieldId":"example_detail_c2","name":"合同类型","type":"STRING","encoding":"STRING"},
87
- {"key":"c3","fieldId":"example_detail_c3","name":"合同付款类型","type":"STRING","encoding":"STRING"},
88
- {"key":"c4","fieldId":"example_detail_c4","name":"合同金额","type":"DECIMAL","encoding":"DECIMAL_STRING"},
89
- {"key":"c5","fieldId":"example_detail_c5","name":"购买数量","type":"DECIMAL","encoding":"DECIMAL_STRING"},
90
- {"key":"c6","fieldId":"example_detail_c6","name":"合同签约时间","type":"DATE","encoding":"EPOCH_MILLIS_STRING"},
91
- {"key":"c7","fieldId":"example_detail_c7","name":"是否已经交货","type":"STRING","encoding":"STRING"}
92
- ],
93
- "rows": [
94
- {
95
- "kind": "DATA",
96
- "cells": [
97
- {"value":"CONTRACT-001","display":"CONTRACT-001","state":"AVAILABLE","reason":null},
98
- {"value":"CUSTOMER-001","display":"CUSTOMER-001","state":"AVAILABLE","reason":null},
99
- {"value":"示例合同","display":"示例合同","state":"AVAILABLE","reason":null},
100
- {"value":"一次性付款","display":"一次性付款","state":"AVAILABLE","reason":null},
101
- {"value":"1000.0","display":"1,000","state":"AVAILABLE","reason":null},
102
- {"value":"1.0","display":"1","state":"AVAILABLE","reason":null},
103
- {"value":"1767571200000","display":"2026-01-05","state":"AVAILABLE","reason":null},
104
- {"value":"否","display":"否","state":"AVAILABLE","reason":null}
105
- ]
106
- },
107
- {
108
- "kind": "DATA",
109
- "cells": [
110
- {"value":"CONTRACT-002","display":"CONTRACT-002","state":"AVAILABLE","reason":null},
111
- {"value":"CUSTOMER-002","display":"CUSTOMER-002","state":"AVAILABLE","reason":null},
112
- {"value":"示例合同","display":"示例合同","state":"AVAILABLE","reason":null},
113
- {"value":"一次性付款","display":"一次性付款","state":"AVAILABLE","reason":null},
114
- {"value":"2000.0","display":"2,000","state":"AVAILABLE","reason":null},
115
- {"value":"2.0","display":"2","state":"AVAILABLE","reason":null},
116
- {"value":"1767657600000","display":"2026-01-06","state":"AVAILABLE","reason":null},
117
- {"value":"是","display":"是","state":"AVAILABLE","reason":null}
118
- ]
119
- }
120
- ],
121
- "returnedRowCount": 2
122
- }
123
- ],
124
- "warnings": ["NEXT_PAGE_UNSUPPORTED"]
125
- }
126
- ```
127
-
128
- ### 7.2 分组表
129
-
130
- 表头展开模式为 INITIAL_VIEW,page/hasNext/total 不提供普通分页含义。GRAND_TOTAL 与 DATA 都包含 50,000,不能相加成 100,000;总计行的分类单元格为 MISSING_CELL,不应把它当作业务 NULL 分组。
131
-
132
- ```json
133
- {
134
- "schemaVersion": "1",
135
- "resultType": "GROUP_TABLE",
136
- "normalization": "COMPLETE",
137
- "range": {
138
- "mode": "INITIAL_VIEW",
139
- "page": null,
140
- "pageSize": null,
141
- "pageUnit": null,
142
- "hasNext": null,
143
- "hasPrevious": null,
144
- "total": {"value":null,"unit":null}
145
- },
146
- "datasets": [
147
- {
148
- "id": "main",
149
- "columns": [
150
- {"key":"c0","fieldId":"example_group_c0","name":"合同类型","type":"STRING","encoding":"STRING"},
151
- {"key":"c1","fieldId":"example_group_c1","name":"合同数","type":"DECIMAL","encoding":"DECIMAL_STRING"},
152
- {"key":"c2","fieldId":"example_group_c2","name":"合同金额","type":"DECIMAL","encoding":"DECIMAL_STRING"},
153
- {"key":"c3","fieldId":"example_group_c3","name":"购买数量","type":"DECIMAL","encoding":"DECIMAL_STRING"}
154
- ],
155
- "rows": [
156
- {
157
- "kind": "GRAND_TOTAL",
158
- "cells": [
159
- {"value":null,"display":null,"state":"UNAVAILABLE","reason":"MISSING_CELL"},
160
- {"value":"10.0","display":"10","state":"AVAILABLE","reason":null},
161
- {"value":"5.0E+4","display":"50,000","state":"AVAILABLE","reason":null},
162
- {"value":"12.0","display":"12","state":"AVAILABLE","reason":null}
163
- ]
164
- },
165
- {
166
- "kind": "DATA",
167
- "cells": [
168
- {"value":"示例合同","display":"示例合同","state":"AVAILABLE","reason":null},
169
- {"value":"10.0","display":"10","state":"AVAILABLE","reason":null},
170
- {"value":"5.0E+4","display":"50,000","state":"AVAILABLE","reason":null},
171
- {"value":"12.0","display":"12","state":"AVAILABLE","reason":null}
172
- ]
173
- }
174
- ],
175
- "returnedRowCount": 2
176
- }
177
- ],
178
- "warnings": []
179
- }
180
- ```
181
-
182
- ### 7.3 KPI
183
-
184
- KPI 使用 CHART 结果,UNPAGED 不提供查询总行数。5.0E+4 是十进制字符串,表示 50,000;display=null 表示没有可直接采用的展示文本。kind=UNKNOWN 不妨碍读取单个 AVAILABLE 指标,但不能据此跨行自动累加。
185
-
186
- ```json
187
- {
188
- "schemaVersion": "1",
189
- "resultType": "CHART",
190
- "normalization": "COMPLETE",
191
- "range": {
192
- "mode": "UNPAGED",
193
- "page": null,
194
- "pageSize": null,
195
- "pageUnit": null,
196
- "hasNext": null,
197
- "hasPrevious": null,
198
- "total": {"value":null,"unit":null}
199
- },
200
- "datasets": [
201
- {
202
- "id": "model0",
203
- "columns": [
204
- {"key":"c0","fieldId":"example_kpi_c0","name":"合同总金额","type":"DECIMAL","encoding":"DECIMAL_STRING"}
205
- ],
206
- "rows": [
207
- {
208
- "kind": "UNKNOWN",
209
- "cells": [
210
- {"value":"5.0E+4","display":null,"state":"AVAILABLE","reason":null}
211
- ]
212
- }
213
- ],
214
- "returnedRowCount": 1
215
- }
216
- ],
217
- "warnings": []
218
- }
219
- ```
50
+ ## 6. Agent 消费顺序
51
+
52
+ 消费顺序:检查 schemaVersion 和 normalization → 选择 dataset → 按列解释 AVAILABLE 单元格 → 根据 kind 区分汇总行 → 检查 range 与 warnings 并说明取数范围。出现 NEXT_PAGE_UNSUPPORTED 时必须说明仍有数据且命令不支持获取后续页。UNKNOWN 行不能自动当作明细累加。存在 PARTIAL、UNSUPPORTED 或 UNAVAILABLE 时应说明缺口,不能转用旧 rows 猜测填补。
53
+
54
+ KPI 的单个 AVAILABLE 指标可以直接读取;其 kind=UNKNOWN 表示缺少统一的行分类依据,不表示指标值不可用。不要因为 kind 未知而自动丢弃这个指标,也不要把它与其他未知行直接累加。
55
+
56
+ 命令参数、实例发现和过滤方式见[命令工作流](command-workflows.md)。此参考文档随 Skill 分发,无需访问工程源码即可解释结果。
57
+
58
+ ## 7. 脱敏返回示例
59
+
60
+ 以下只展示 `data.result`,不是整个响应 envelope。示例沿用实际查询的结构和状态,字段 ID、业务 ID、日期及统计数值均已替换为虚构内容,业务分类使用通用示例值,不可作为真实业务结论。三个示例代表同一示例看板:共 10 份合同、金额 50,000、购买数量 12;明细仅取前 2 行。
61
+
62
+ ### 7.1 明细表
63
+
64
+ PAGE 模式,第 1 页共 2 行,hasNext=true,NEXT_PAGE_UNSUPPORTED 表明仍有数据且无法续页。合同编号保留字符串语义;金额的 value 与带千分位的 display 分离。签约时间的 value 为毫秒时间戳字符串,display 为平台日期文本,state=AVAILABLE。COMPLETE 不代表拿到了全部 10 行或每个单元格都有可计算值。
65
+
66
+ ```json
67
+ {
68
+ "schemaVersion": "1",
69
+ "resultType": "DETAIL_TABLE",
70
+ "normalization": "COMPLETE",
71
+ "range": {
72
+ "mode": "PAGE",
73
+ "page": 1,
74
+ "pageSize": 2,
75
+ "pageUnit": "ROW",
76
+ "hasNext": true,
77
+ "hasPrevious": false,
78
+ "total": {"value":10,"unit":"DETAIL_ROW"}
79
+ },
80
+ "datasets": [
81
+ {
82
+ "id": "main",
83
+ "columns": [
84
+ {"key":"c0","fieldId":"example_detail_c0","name":"合同ID","type":"STRING","encoding":"STRING"},
85
+ {"key":"c1","fieldId":"example_detail_c1","name":"客户ID","type":"STRING","encoding":"STRING"},
86
+ {"key":"c2","fieldId":"example_detail_c2","name":"合同类型","type":"STRING","encoding":"STRING"},
87
+ {"key":"c3","fieldId":"example_detail_c3","name":"合同付款类型","type":"STRING","encoding":"STRING"},
88
+ {"key":"c4","fieldId":"example_detail_c4","name":"合同金额","type":"DECIMAL","encoding":"DECIMAL_STRING"},
89
+ {"key":"c5","fieldId":"example_detail_c5","name":"购买数量","type":"DECIMAL","encoding":"DECIMAL_STRING"},
90
+ {"key":"c6","fieldId":"example_detail_c6","name":"合同签约时间","type":"DATE","encoding":"EPOCH_MILLIS_STRING"},
91
+ {"key":"c7","fieldId":"example_detail_c7","name":"是否已经交货","type":"STRING","encoding":"STRING"}
92
+ ],
93
+ "rows": [
94
+ {
95
+ "kind": "DATA",
96
+ "cells": [
97
+ {"value":"CONTRACT-001","display":"CONTRACT-001","state":"AVAILABLE","reason":null},
98
+ {"value":"CUSTOMER-001","display":"CUSTOMER-001","state":"AVAILABLE","reason":null},
99
+ {"value":"示例合同","display":"示例合同","state":"AVAILABLE","reason":null},
100
+ {"value":"一次性付款","display":"一次性付款","state":"AVAILABLE","reason":null},
101
+ {"value":"1000.0","display":"1,000","state":"AVAILABLE","reason":null},
102
+ {"value":"1.0","display":"1","state":"AVAILABLE","reason":null},
103
+ {"value":"1767571200000","display":"2026-01-05","state":"AVAILABLE","reason":null},
104
+ {"value":"否","display":"否","state":"AVAILABLE","reason":null}
105
+ ]
106
+ },
107
+ {
108
+ "kind": "DATA",
109
+ "cells": [
110
+ {"value":"CONTRACT-002","display":"CONTRACT-002","state":"AVAILABLE","reason":null},
111
+ {"value":"CUSTOMER-002","display":"CUSTOMER-002","state":"AVAILABLE","reason":null},
112
+ {"value":"示例合同","display":"示例合同","state":"AVAILABLE","reason":null},
113
+ {"value":"一次性付款","display":"一次性付款","state":"AVAILABLE","reason":null},
114
+ {"value":"2000.0","display":"2,000","state":"AVAILABLE","reason":null},
115
+ {"value":"2.0","display":"2","state":"AVAILABLE","reason":null},
116
+ {"value":"1767657600000","display":"2026-01-06","state":"AVAILABLE","reason":null},
117
+ {"value":"是","display":"是","state":"AVAILABLE","reason":null}
118
+ ]
119
+ }
120
+ ],
121
+ "returnedRowCount": 2
122
+ }
123
+ ],
124
+ "warnings": ["NEXT_PAGE_UNSUPPORTED"]
125
+ }
126
+ ```
127
+
128
+ ### 7.2 分组表
129
+
130
+ 表头展开模式为 INITIAL_VIEW,page/hasNext/total 不提供普通分页含义。GRAND_TOTAL 与 DATA 都包含 50,000,不能相加成 100,000;总计行的分类单元格为 MISSING_CELL,不应把它当作业务 NULL 分组。
131
+
132
+ ```json
133
+ {
134
+ "schemaVersion": "1",
135
+ "resultType": "GROUP_TABLE",
136
+ "normalization": "COMPLETE",
137
+ "range": {
138
+ "mode": "INITIAL_VIEW",
139
+ "page": null,
140
+ "pageSize": null,
141
+ "pageUnit": null,
142
+ "hasNext": null,
143
+ "hasPrevious": null,
144
+ "total": {"value":null,"unit":null}
145
+ },
146
+ "datasets": [
147
+ {
148
+ "id": "main",
149
+ "columns": [
150
+ {"key":"c0","fieldId":"example_group_c0","name":"合同类型","type":"STRING","encoding":"STRING"},
151
+ {"key":"c1","fieldId":"example_group_c1","name":"合同数","type":"DECIMAL","encoding":"DECIMAL_STRING"},
152
+ {"key":"c2","fieldId":"example_group_c2","name":"合同金额","type":"DECIMAL","encoding":"DECIMAL_STRING"},
153
+ {"key":"c3","fieldId":"example_group_c3","name":"购买数量","type":"DECIMAL","encoding":"DECIMAL_STRING"}
154
+ ],
155
+ "rows": [
156
+ {
157
+ "kind": "GRAND_TOTAL",
158
+ "cells": [
159
+ {"value":null,"display":null,"state":"UNAVAILABLE","reason":"MISSING_CELL"},
160
+ {"value":"10.0","display":"10","state":"AVAILABLE","reason":null},
161
+ {"value":"5.0E+4","display":"50,000","state":"AVAILABLE","reason":null},
162
+ {"value":"12.0","display":"12","state":"AVAILABLE","reason":null}
163
+ ]
164
+ },
165
+ {
166
+ "kind": "DATA",
167
+ "cells": [
168
+ {"value":"示例合同","display":"示例合同","state":"AVAILABLE","reason":null},
169
+ {"value":"10.0","display":"10","state":"AVAILABLE","reason":null},
170
+ {"value":"5.0E+4","display":"50,000","state":"AVAILABLE","reason":null},
171
+ {"value":"12.0","display":"12","state":"AVAILABLE","reason":null}
172
+ ]
173
+ }
174
+ ],
175
+ "returnedRowCount": 2
176
+ }
177
+ ],
178
+ "warnings": []
179
+ }
180
+ ```
181
+
182
+ ### 7.3 KPI
183
+
184
+ KPI 使用 CHART 结果,UNPAGED 不提供查询总行数。5.0E+4 是十进制字符串,表示 50,000;display=null 表示没有可直接采用的展示文本。kind=UNKNOWN 不妨碍读取单个 AVAILABLE 指标,但不能据此跨行自动累加。
185
+
186
+ ```json
187
+ {
188
+ "schemaVersion": "1",
189
+ "resultType": "CHART",
190
+ "normalization": "COMPLETE",
191
+ "range": {
192
+ "mode": "UNPAGED",
193
+ "page": null,
194
+ "pageSize": null,
195
+ "pageUnit": null,
196
+ "hasNext": null,
197
+ "hasPrevious": null,
198
+ "total": {"value":null,"unit":null}
199
+ },
200
+ "datasets": [
201
+ {
202
+ "id": "model0",
203
+ "columns": [
204
+ {"key":"c0","fieldId":"example_kpi_c0","name":"合同总金额","type":"DECIMAL","encoding":"DECIMAL_STRING"}
205
+ ],
206
+ "rows": [
207
+ {
208
+ "kind": "UNKNOWN",
209
+ "cells": [
210
+ {"value":"5.0E+4","display":null,"state":"AVAILABLE","reason":null}
211
+ ]
212
+ }
213
+ ],
214
+ "returnedRowCount": 1
215
+ }
216
+ ],
217
+ "warnings": []
218
+ }
219
+ ```