create-windy 0.9.1 → 0.10.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 (253) hide show
  1. package/dist/cli.js +1691 -1151
  2. package/package.json +2 -2
  3. package/template/.agents/skills/windy-business-module/SKILL.md +33 -1
  4. package/template/.windy-template.json +6 -2
  5. package/template/AGENTS.md +4 -0
  6. package/template/README.md +2 -0
  7. package/template/apps/agent-server/Dockerfile +1 -1
  8. package/template/apps/agent-server/README.md +1 -1
  9. package/template/apps/agent-server/native/EXTENSIONS.md +2 -2
  10. package/template/apps/agent-server/native/parallel-harness.ts +2 -0
  11. package/template/apps/agent-server/native/storage-lifecycle.test.ts +2 -1
  12. package/template/apps/agent-server/package.json +42 -41
  13. package/template/apps/agent-server/plugins/downloads/README.md +1 -1
  14. package/template/apps/agent-server/plugins/drop-overlay/README.md +1 -1
  15. package/template/apps/agent-server/plugins/settings/README.md +1 -1
  16. package/template/apps/agent-server/plugins/skill-library/client-chunks.test.ts +4 -1
  17. package/template/apps/agent-server/plugins/theme/README.md +5 -1
  18. package/template/apps/agent-server/plugins/theme/source-tokens.ts +0 -1
  19. package/template/apps/agent-server/plugins/theme/tokens.json +0 -4
  20. package/template/apps/agent-server/plugins/tool-catalog/README.md +6 -3
  21. package/template/apps/agent-server/plugins/tool-catalog/discovery.mjs +13 -10
  22. package/template/apps/agent-server/plugins/tool-catalog/discovery.test.ts +68 -6
  23. package/template/apps/agent-server/runtime/compatibility.ts +7 -1
  24. package/template/apps/agent-server/runtime/dsh-engine.ts +2 -0
  25. package/template/apps/agent-server/runtime/questions-workflow.nodecheck.ts +2 -0
  26. package/template/apps/server/Dockerfile +2 -1
  27. package/template/apps/server/package.json +11 -11
  28. package/template/apps/server/scripts/validate-module-composition-once.ts +2 -0
  29. package/template/apps/server/scripts/validate-module-composition.ts +8 -4
  30. package/template/apps/server/src/admin/routes.test.ts +29 -1
  31. package/template/apps/server/src/admin/routes.ts +20 -2
  32. package/template/apps/server/src/agent/client-session/completion.ts +1 -1
  33. package/template/apps/server/src/agent/client-session/manifest-admission.ts +1 -1
  34. package/template/apps/server/src/agent/client-session/request.ts +1 -1
  35. package/template/apps/server/src/agent/context-version-routes.ts +37 -13
  36. package/template/apps/server/src/agent/run-facade.ts +1 -1
  37. package/template/apps/server/src/agent/run-input-verification.ts +1 -1
  38. package/template/apps/server/src/agent/run-routes.ts +1 -14
  39. package/template/apps/server/src/agent/run-start-preparation.ts +1 -1
  40. package/template/apps/server/src/agent/runtime-bootstrap-input.ts +2 -0
  41. package/template/apps/server/src/agent/runtime-bootstrap.ts +49 -157
  42. package/template/apps/server/src/agent/runtime-disabled-composition.ts +2 -1
  43. package/template/apps/server/src/agent/session-invalidation/authorization-revocation.ts +54 -0
  44. package/template/apps/server/src/agent/session-runtime-composition.ts +1 -51
  45. package/template/apps/server/src/agent/unavailable-routes.ts +13 -2
  46. package/template/apps/server/src/agent-workflow/runtime-composition.ts +3 -0
  47. package/template/apps/server/src/agent-workflow/service.ts +17 -1
  48. package/template/apps/server/src/ai-artifact/media-resource-route.test.ts +134 -0
  49. package/template/apps/server/src/ai-artifact/routes.ts +1 -1
  50. package/template/apps/server/src/ai-artifact/runtime.ts +12 -0
  51. package/template/apps/server/src/ai-runtime-readiness/operation-port.test-support.ts +1 -1
  52. package/template/apps/server/src/ai-runtime-readiness/operation-port.ts +8 -0
  53. package/template/apps/server/src/ai-runtime-security/internal-token.ts +14 -0
  54. package/template/apps/server/src/app/antivirus-composition.test.ts +63 -0
  55. package/template/apps/server/src/app/antivirus-composition.ts +29 -0
  56. package/template/apps/server/src/app/dsh-workbench-socket-audit.test.ts +2 -1
  57. package/template/apps/server/src/configuration/definition.ts +15 -11
  58. package/template/apps/server/src/document/facade-support.ts +2 -2
  59. package/template/apps/server/src/document/facade.ts +2 -2
  60. package/template/apps/server/src/document/output-artifact-composition.ts +9 -5
  61. package/template/apps/server/src/document/output-artifact.test-support.ts +1 -1
  62. package/template/apps/server/src/embedding/facade.ts +1 -1
  63. package/template/apps/server/src/embedding/input.ts +1 -1
  64. package/template/apps/server/src/embedding/routes.ts +1 -1
  65. package/template/apps/server/src/index.ts +60 -60
  66. package/template/apps/server/src/license/routes.ts +4 -1
  67. package/template/apps/server/src/license/runtime-business-access.test.ts +261 -0
  68. package/template/apps/server/src/media-runtime/composition.ts +157 -0
  69. package/template/apps/server/src/media-runtime/media-only-composition.ts +44 -0
  70. package/template/apps/server/src/media-runtime/module-ai-port-factory.test.ts +69 -0
  71. package/template/apps/server/src/media-runtime/module-ai-port-factory.ts +72 -0
  72. package/template/apps/server/src/{agent → media-runtime}/runtime-readiness-sources.ts +14 -6
  73. package/template/apps/server/src/media-runtime/shared-composition.ts +104 -0
  74. package/template/apps/server/src/module-composition.test.ts +22 -0
  75. package/template/apps/server/src/module-composition.ts +48 -0
  76. package/template/apps/server/src/module-host/ai-operation-port.ts +97 -30
  77. package/template/apps/server/src/module-host/ai-operation-speech-normalize.test.ts +1 -1
  78. package/template/apps/server/src/module-host/http-runtime.ts +9 -3
  79. package/template/apps/server/src/module-host/static-route-authorization.test.ts +6 -3
  80. package/template/apps/server/src/module-host/storage-authorization-binding.test.ts +4 -0
  81. package/template/apps/server/src/module-runtime-validation.ts +2 -0
  82. package/template/apps/server/src/observability/diagnostic-index.ts +26 -1
  83. package/template/apps/server/src/observability/diagnostic-repository.ts +40 -11
  84. package/template/apps/server/src/platform-http-runtime.ts +1 -1
  85. package/template/apps/server/src/runtime-feature.ts +5 -1
  86. package/template/apps/server/src/runtime.ts +3 -0
  87. package/template/apps/server/src/settings/drizzle-watermark-repository.ts +35 -4
  88. package/template/apps/server/src/settings/watermark-repository.ts +14 -0
  89. package/template/apps/server/src/settings/watermark-routes.test.ts +84 -2
  90. package/template/apps/server/src/settings/watermark-routes.ts +109 -0
  91. package/template/apps/server/src/settings/watermark-transfer.ts +79 -0
  92. package/template/apps/server/src/speech/facade-validation.ts +1 -1
  93. package/template/apps/server/src/speech/facade.ts +2 -2
  94. package/template/apps/server/src/startup-composition-validation.test.ts +32 -0
  95. package/template/apps/server/src/startup-finalization.ts +2 -0
  96. package/template/apps/server/src/startup-runtime.ts +77 -0
  97. package/template/apps/server/src/system/ai-runtime-build.ts +3 -0
  98. package/template/apps/server/src/system/ai-runtime-configuration.test.ts +36 -0
  99. package/template/apps/server/src/system/ai-runtime-configuration.ts +58 -0
  100. package/template/apps/server/src/system/diagnostic-routes.test.ts +45 -0
  101. package/template/apps/server/src/system/diagnostic-routes.ts +35 -0
  102. package/template/apps/server/src/system/environment-policy-reader.test.ts +74 -0
  103. package/template/apps/server/src/system/environment-policy-reader.ts +62 -0
  104. package/template/apps/server/src/system/feature-environment-assessment.test.ts +148 -0
  105. package/template/apps/server/src/system/feature-environment-assessment.ts +179 -0
  106. package/template/apps/server/src/system/host-diagnostics.test.ts +155 -0
  107. package/template/apps/server/src/system/host-diagnostics.ts +225 -0
  108. package/template/apps/server/src/system/menu-registry.test.ts +26 -0
  109. package/template/apps/server/src/system/menu-registry.ts +9 -7
  110. package/template/apps/server/src/system/operations.test.ts +5 -0
  111. package/template/apps/server/src/system/operations.ts +36 -12
  112. package/template/apps/server/src/system/role-authorization-postgres.integration.test.ts +181 -0
  113. package/template/apps/web/Dockerfile +7 -3
  114. package/template/apps/web/dev/dev-port.test.ts +6 -6
  115. package/template/apps/web/dev/dev-port.ts +1 -1
  116. package/template/apps/web/dev/start.ts +6 -1
  117. package/template/apps/web/index.html +1 -0
  118. package/template/apps/web/package.json +16 -16
  119. package/template/apps/web/runtime-server.test.ts +22 -1
  120. package/template/apps/web/runtime-server.ts +6 -0
  121. package/template/apps/web/src/App.vue +6 -3
  122. package/template/apps/web/src/assets/windy.svg +4 -0
  123. package/template/apps/web/src/components/auth/LoginForm.vue +2 -2
  124. package/template/apps/web/src/components/auth/PasswordChangeForm.vue +14 -3
  125. package/template/apps/web/src/components/common/FormDialog.vue +1 -1
  126. package/template/apps/web/src/components/license/LicenseFlow.webtest.ts +3 -0
  127. package/template/apps/web/src/components/license/LicenseMachineCodeQr.vue +99 -0
  128. package/template/apps/web/src/components/license/LicenseMachineCodeQr.webtest.ts +83 -0
  129. package/template/apps/web/src/components/license/LicensePairingCard.vue +1 -1
  130. package/template/apps/web/src/components/license/LicenseStatusCard.vue +14 -2
  131. package/template/apps/web/src/composables/useLoginFlow.ts +2 -2
  132. package/template/apps/web/src/composables/usePlatformSettings.ts +1 -1
  133. package/template/apps/web/src/composables/useWatermarkSettings.ts +1 -0
  134. package/template/apps/web/src/layout/AppSidebar.vue +5 -9
  135. package/template/apps/web/src/layout/AppSidebar.webtest.ts +4 -1
  136. package/template/apps/web/src/pages/auth/ChangePasswordPage.vue +67 -6
  137. package/template/apps/web/src/pages/auth/LoginPage.vue +3 -12
  138. package/template/apps/web/src/pages/configuration/components/ModuleConfigurationEditor.vue +30 -0
  139. package/template/apps/web/src/pages/configuration/components/ModuleConfigurationWorkbench.vue +25 -14
  140. package/template/apps/web/src/pages/configuration/components/TimeZoneSelect.vue +55 -0
  141. package/template/apps/web/src/pages/profile/PersonalSettingsPage.vue +64 -11
  142. package/template/apps/web/src/pages/profile/PersonalSettingsPage.webtest.ts +21 -1
  143. package/template/apps/web/src/pages/settings/BrandingSettingsSection.vue +7 -18
  144. package/template/apps/web/src/pages/settings/BrandingSettingsSection.webtest.ts +9 -4
  145. package/template/apps/web/src/pages/settings/GlobalSettingsPage.vue +51 -6
  146. package/template/apps/web/src/pages/settings/GlobalSettingsPage.webtest.ts +19 -3
  147. package/template/apps/web/src/pages/settings/WatermarkSettingsSection.vue +1 -0
  148. package/template/apps/web/src/pages/settings/WatermarkYamlTransfer.vue +211 -0
  149. package/template/apps/web/src/pages/system/DiagnosticLookupPage.vue +18 -3
  150. package/template/apps/web/src/pages/system/DiagnosticLookupPage.webtest.ts +4 -1
  151. package/template/apps/web/src/pages/system/SystemOperationsPage.vue +23 -0
  152. package/template/apps/web/src/pages/system/components/DiagnosticLogList.vue +120 -0
  153. package/template/apps/web/src/pages/system/components/OperationEnvironmentPanel.vue +237 -0
  154. package/template/apps/web/src/pages/system/components/OperationFeatureAssessmentPanel.vue +131 -0
  155. package/template/apps/web/src/pages/system/components/PagedSelectionList.vue +31 -24
  156. package/template/apps/web/src/pages/system/components/SystemResourceActions.vue +2 -1
  157. package/template/apps/web/src/pages/system/components/SystemResourceEditor.vue +11 -2
  158. package/template/apps/web/src/pages/system/components/SystemResourcePage.vue +1 -0
  159. package/template/apps/web/src/pages/system/components/SystemResourcePage.webtest.ts +6 -2
  160. package/template/apps/web/src/pages/system/components/agent-skills/AgentSkillImportDialog.vue +18 -9
  161. package/template/apps/web/src/pages/system/components/agent-workbench/SessionReplayTimeline.vue +18 -9
  162. package/template/apps/web/src/pages/system/components/agent-workbench/TestRunComposer.vue +66 -34
  163. package/template/apps/web/src/pages/system/components/agent-workbench/ToolCatalogPanel.vue +48 -33
  164. package/template/apps/web/src/pages/system/components/agent-workbench/ToolCatalogPanel.webtest.ts +9 -2
  165. package/template/apps/web/src/pages/system/components/agent-workbench/ToolRuleDetail.vue +23 -16
  166. package/template/apps/web/src/pages/system/components/dictionary-bulk/DictionaryBulkJobDetail.vue +10 -7
  167. package/template/apps/web/src/pages/system/components/user-account/RolePermissionSummary.vue +81 -57
  168. package/template/apps/web/src/pages/system/components/user-account/UserRoleSelector.vue +6 -4
  169. package/template/apps/web/src/pages/system/components/user-account/UserRoleSelector.webtest.ts +20 -4
  170. package/template/apps/web/src/pages/system/resource-config.ts +9 -0
  171. package/template/apps/web/src/pages/work-orders/WorkOrderListPage.vue +1 -1
  172. package/template/apps/web/src/router/disabled-feature-loading.webtest.ts +78 -0
  173. package/template/apps/web/src/router/index.ts +3 -6
  174. package/template/apps/web/src/router/manifest-routes.ts +2 -3
  175. package/template/apps/web/src/router/platform-admin-pages.ts +21 -62
  176. package/template/apps/web/src/router/platform-admin-route-bindings.ts +4 -4
  177. package/template/apps/web/src/services/diagnostics-api.ts +13 -1
  178. package/template/apps/web/src/services/operations-api.ts +4 -0
  179. package/template/apps/web/src/services/platform-settings-api.ts +35 -1
  180. package/template/apps/web/vite.config.ts +9 -3
  181. package/template/deploy/environment/windy.environment.example.yaml +53 -0
  182. package/template/docker-compose.yml +4 -2
  183. package/template/docs/architecture/agent-admin-workbench-implementation.md +1 -1
  184. package/template/docs/architecture/agent-admin-workbench-plan.md +1 -1
  185. package/template/docs/architecture/agent-workflow.md +8 -0
  186. package/template/docs/architecture/durable-jobs.md +17 -0
  187. package/template/docs/architecture/embedded-dsh-integration.md +1 -1
  188. package/template/docs/development/dsh-plugins.md +1 -1
  189. package/template/docs/development/performance-engineering.md +24 -0
  190. package/template/docs/operations/admin-settings-yaml.md +29 -0
  191. package/template/docs/operations/dsh-agent-migration.md +2 -2
  192. package/template/docs/operations/environment-capabilities.md +185 -0
  193. package/template/docs/platform/module-configuration.md +18 -3
  194. package/template/docs/platform/platform-authentication.md +1 -1
  195. package/template/package.json +10 -8
  196. package/template/packages/config/package.json +2 -2
  197. package/template/packages/config/src/definition.ts +14 -4
  198. package/template/packages/config/src/environment-loader.ts +27 -3
  199. package/template/packages/config/src/platform-ai-runtime.test.ts +94 -0
  200. package/template/packages/config/src/platform.ts +5 -2
  201. package/template/packages/database/drizzle/0065_durable_job_lease_snapshot_lookup.sql +1 -0
  202. package/template/packages/database/drizzle/0066_agent_source_sequence_bigint.sql +3 -0
  203. package/template/packages/database/drizzle/0067_media_runtime_access.sql +46 -0
  204. package/template/packages/database/drizzle/meta/0065_snapshot.json +15370 -0
  205. package/template/packages/database/drizzle/meta/0066_snapshot.json +15370 -0
  206. package/template/packages/database/drizzle/meta/0067_snapshot.json +15370 -0
  207. package/template/packages/database/drizzle/meta/_journal.json +21 -0
  208. package/template/packages/database/package.json +3 -3
  209. package/template/packages/database/src/schema/agent-session.ts +4 -3
  210. package/template/packages/database/src/schema/durable-jobs.ts +4 -0
  211. package/template/packages/database/src/schema/index.ts +3 -1
  212. package/template/packages/database/src/schema-durable-recovery.test.ts +21 -1
  213. package/template/packages/database/src/schema-source-sequence.test.ts +24 -0
  214. package/template/packages/example-work-order/package.json +2 -2
  215. package/template/packages/modules/package.json +1 -1
  216. package/template/packages/modules/src/admin-ui-boundary.test.ts +33 -0
  217. package/template/packages/modules/src/composition.ts +11 -28
  218. package/template/packages/modules/src/manifest.ts +2 -0
  219. package/template/packages/modules/src/menu-composition.ts +24 -0
  220. package/template/packages/modules/src/system-admin-routes.ts +2 -2
  221. package/template/packages/modules/src/system-admin-ui-catalog.ts +6 -1
  222. package/template/packages/modules/src/system-ai-api-bindings.ts +0 -16
  223. package/template/packages/modules/src/system-api-control-plane.ts +9 -1
  224. package/template/packages/modules/src/system-api-permissions.ts +7 -0
  225. package/template/packages/modules/src/system-api-watermark.ts +21 -0
  226. package/template/packages/modules/src/system-audit-actions.ts +3 -1
  227. package/template/packages/modules/src/system-features.ts +21 -3
  228. package/template/packages/modules/src/system-media-api-bindings.ts +97 -0
  229. package/template/packages/modules/src/system-module-audit-selection.ts +2 -0
  230. package/template/packages/modules/src/system-module-catalog.test.ts +13 -6
  231. package/template/packages/modules/src/system-module-catalog.ts +6 -241
  232. package/template/packages/modules/src/system-module-definitions.ts +260 -0
  233. package/template/packages/modules/src/system-modules-access.test.ts +2 -0
  234. package/template/packages/modules/src/system-modules.test.ts +7 -1
  235. package/template/packages/modules/src/system-modules.ts +25 -13
  236. package/template/packages/modules/src/system-permissions.ts +12 -0
  237. package/template/packages/server-sdk/package.json +1 -1
  238. package/template/packages/shared/index.ts +3 -0
  239. package/template/packages/shared/package.json +1 -1
  240. package/template/packages/shared/src/environment-assessment.ts +68 -0
  241. package/template/packages/shared/src/environment-policy.ts +205 -0
  242. package/template/packages/shared/src/license-console-capabilities.ts +7 -0
  243. package/template/packages/shared/src/license.ts +1 -0
  244. package/template/packages/shared/src/module-configuration.ts +2 -1
  245. package/template/scripts/operations/collect-device-info.py +230 -0
  246. package/template/apps/server/src/agent/module-ai-port-factory.ts +0 -41
  247. /package/template/apps/server/src/{agent → ai-runtime-security}/execution-grants.ts +0 -0
  248. /package/template/apps/server/src/{agent → ai-runtime-security}/idempotency-key.test.ts +0 -0
  249. /package/template/apps/server/src/{agent → ai-runtime-security}/idempotency-key.ts +0 -0
  250. /package/template/apps/server/src/{agent → ai-runtime-security}/provider-input-governance.test.ts +0 -0
  251. /package/template/apps/server/src/{agent → ai-runtime-security}/provider-input-governance.ts +0 -0
  252. /package/template/apps/server/src/{agent → media-runtime}/required-environment.ts +0 -0
  253. /package/template/apps/server/src/{agent → media-runtime}/runtime-readiness-sources.test.ts +0 -0
@@ -1,10 +1,19 @@
1
1
  <script setup lang="ts">
2
+ import { useTemplateRef } from "vue";
2
3
  import { Button } from "@/components/ui/button";
3
4
  import { Input } from "@/components/ui/input";
5
+ import DiagnosticLogList from "./components/DiagnosticLogList.vue";
4
6
  import DiagnosticRecordDetails from "./components/DiagnosticRecordDetails.vue";
5
7
  import { useDiagnosticLookup } from "./composables/useDiagnosticLookup";
6
8
 
9
+ const lookupForm = useTemplateRef<HTMLFormElement>("lookupForm");
7
10
  const { input, record, error, loading, lookup } = useDiagnosticLookup();
11
+
12
+ function selectDiagnostic(id: string) {
13
+ input.value = id;
14
+ lookupForm.value?.querySelector("input")?.focus();
15
+ void lookup();
16
+ }
8
17
  </script>
9
18
 
10
19
  <template>
@@ -12,12 +21,17 @@ const { input, record, error, loading, lookup } = useDiagnosticLookup();
12
21
  <header class="space-y-2">
13
22
  <h1 class="text-2xl font-semibold text-foreground">错误诊断</h1>
14
23
  <p class="text-sm text-muted-foreground">
15
- 粘贴错误页面的诊断编号,查询当前部署最近 30
16
- 天的失败索引。每次有效编号查询都会留下审计记录。
24
+ 分页浏览当前部署最近 30
25
+ 天的服务端失败日志,也可按诊断编号定位。查询会留下审计记录。
17
26
  </p>
18
27
  </header>
19
28
  <section class="rounded-xl border bg-card p-4">
20
- <form class="space-y-3" :aria-busy="loading" @submit.prevent="lookup">
29
+ <form
30
+ ref="lookupForm"
31
+ class="space-y-3"
32
+ :aria-busy="loading"
33
+ @submit.prevent="lookup"
34
+ >
21
35
  <label for="diagnostic-id" class="text-sm font-medium">诊断编号</label>
22
36
  <div class="flex flex-col gap-2 sm:flex-row">
23
37
  <Input
@@ -52,5 +66,6 @@ const { input, record, error, loading, lookup } = useDiagnosticLookup();
52
66
  </form>
53
67
  </section>
54
68
  <DiagnosticRecordDetails v-if="record" :record="record" />
69
+ <DiagnosticLogList @select="selectDiagnostic" />
55
70
  </div>
56
71
  </template>
@@ -4,7 +4,10 @@ import DiagnosticLookupPage from "./DiagnosticLookupPage.vue";
4
4
  import { ApiError } from "@/services/http";
5
5
 
6
6
  const mocks = vi.hoisted(() => ({ request: vi.fn() }));
7
- vi.mock("@/services/diagnostics-api", () => ({ getDiagnostic: mocks.request }));
7
+ vi.mock("@/services/diagnostics-api", () => ({
8
+ getDiagnostic: mocks.request,
9
+ listDiagnostics: async () => ({ items: [], total: 0, page: 1, pageSize: 20 }),
10
+ }));
8
11
  const id = "diag-0199e82a-abcd-7000-8000-000000000000";
9
12
  const record = {
10
13
  diagnosticId: id,
@@ -14,6 +14,8 @@ import {
14
14
  getOperationSnapshot,
15
15
  type OperationSnapshot,
16
16
  } from "@/services/operations-api";
17
+ import OperationFeatureAssessmentPanel from "./components/OperationFeatureAssessmentPanel.vue";
18
+ import OperationEnvironmentPanel from "./components/OperationEnvironmentPanel.vue";
17
19
  import OperationCacheMonitor from "./components/OperationCacheMonitor.vue";
18
20
  import OperationOnlineUsers from "./components/OperationOnlineUsers.vue";
19
21
  import OperationServiceMonitor from "./components/OperationServiceMonitor.vue";
@@ -45,6 +47,18 @@ const schedulerAllowed = computed(() => {
45
47
  return allowed;
46
48
  });
47
49
 
50
+ const featureManagementAllowed = computed(() => {
51
+ const current = access.snapshot.value;
52
+ return Boolean(
53
+ current &&
54
+ evaluateWebAccess(current, {
55
+ permissionKey: "system.feature.manage",
56
+ featureKey: "system.feature",
57
+ }).allowed &&
58
+ current.actor.permissionKeys.includes("system.feature.read"),
59
+ );
60
+ });
61
+
48
62
  const refreshing = computed(() => {
49
63
  let active = loading.value;
50
64
  // @windy-module system.scheduler begin
@@ -119,6 +133,15 @@ async function reload() {
119
133
  :disk="snapshot.diskMonitor"
120
134
  :gpu="snapshot.gpuMonitor"
121
135
  />
136
+ <OperationEnvironmentPanel
137
+ v-if="snapshot.environment"
138
+ :environment="snapshot.environment"
139
+ />
140
+ <OperationFeatureAssessmentPanel
141
+ v-if="snapshot.featureAssessment"
142
+ :assessment="snapshot.featureAssessment"
143
+ :management-allowed="featureManagementAllowed"
144
+ />
122
145
  <OperationOnlineUsers :users="snapshot.onlineUsers" />
123
146
  <OperationCacheMonitor :cache="snapshot.cacheMonitor" />
124
147
  </template>
@@ -0,0 +1,120 @@
1
+ <script setup lang="ts">
2
+ import { onBeforeUnmount, onMounted, shallowRef } from "vue";
3
+ import { DEFAULT_PAGE_SIZE, type PageResult } from "@southwind-ai/shared";
4
+ import DataPagination from "@/components/common/DataPagination.vue";
5
+ import { Button } from "@/components/ui/button";
6
+ import {
7
+ listDiagnostics,
8
+ type DiagnosticRecord,
9
+ } from "@/services/diagnostics-api";
10
+
11
+ defineEmits<{ select: [id: string] }>();
12
+
13
+ const result = shallowRef<PageResult<DiagnosticRecord>>();
14
+ const loading = shallowRef(false);
15
+ const error = shallowRef("");
16
+ let controller: AbortController | undefined;
17
+
18
+ async function load(
19
+ page = result.value?.page ?? 1,
20
+ pageSize = result.value?.pageSize ?? DEFAULT_PAGE_SIZE,
21
+ ) {
22
+ controller?.abort();
23
+ const request = new AbortController();
24
+ controller = request;
25
+ loading.value = true;
26
+ error.value = "";
27
+ try {
28
+ const next = await listDiagnostics(page, pageSize, request.signal);
29
+ if (request.signal.aborted) return;
30
+ const lastPage = Math.max(1, Math.ceil(next.total / pageSize));
31
+ if (page > lastPage) {
32
+ await load(lastPage, pageSize);
33
+ return;
34
+ }
35
+ result.value = next;
36
+ } catch {
37
+ if (!request.signal.aborted) error.value = "错误日志暂时无法加载,请重试。";
38
+ } finally {
39
+ if (!request.signal.aborted) loading.value = false;
40
+ }
41
+ }
42
+
43
+ onMounted(() => void load());
44
+ onBeforeUnmount(() => controller?.abort());
45
+ </script>
46
+
47
+ <template>
48
+ <section class="space-y-4 rounded-xl border bg-card p-4" :aria-busy="loading">
49
+ <div class="flex items-center justify-between gap-3">
50
+ <h2 class="font-semibold">错误日志</h2>
51
+ <Button
52
+ type="button"
53
+ size="sm"
54
+ variant="outline"
55
+ :disabled="loading"
56
+ @click="load()"
57
+ >
58
+ 刷新日志
59
+ </Button>
60
+ </div>
61
+ <p v-if="error" role="status" class="text-sm text-destructive">
62
+ {{ error }}
63
+ </p>
64
+ <p v-if="loading" role="status" class="text-sm text-muted-foreground">
65
+ 正在加载错误日志…
66
+ </p>
67
+ <p
68
+ v-else-if="result && !result.items.length"
69
+ class="text-sm text-muted-foreground"
70
+ >
71
+ 最近 30 天暂无失败记录。
72
+ </p>
73
+ <div v-if="result?.items.length" class="overflow-x-auto">
74
+ <table class="w-full text-left text-sm">
75
+ <thead class="border-b text-muted-foreground">
76
+ <tr>
77
+ <th scope="col" class="px-2 py-2">发生时间(UTC)</th>
78
+ <th scope="col" class="px-2 py-2">请求路由</th>
79
+ <th scope="col" class="px-2 py-2">HTTP</th>
80
+ <th scope="col" class="px-2 py-2">错误码</th>
81
+ <th scope="col" class="px-2 py-2">诊断编号</th>
82
+ </tr>
83
+ </thead>
84
+ <tbody>
85
+ <tr
86
+ v-for="item in result.items"
87
+ :key="item.diagnosticId"
88
+ class="border-b last:border-0"
89
+ >
90
+ <td class="px-2 py-2 whitespace-nowrap">{{ item.occurredAt }}</td>
91
+ <td class="px-2 py-2 font-mono">
92
+ {{ item.method }} {{ item.route }}
93
+ </td>
94
+ <td class="px-2 py-2">{{ item.statusCode }}</td>
95
+ <td class="px-2 py-2 font-mono">{{ item.errorCode }}</td>
96
+ <td class="px-2 py-2">
97
+ <Button
98
+ type="button"
99
+ variant="link"
100
+ size="sm"
101
+ class="h-auto p-0 font-mono"
102
+ @click="$emit('select', item.diagnosticId)"
103
+ >
104
+ {{ item.diagnosticId }}
105
+ </Button>
106
+ </td>
107
+ </tr>
108
+ </tbody>
109
+ </table>
110
+ </div>
111
+ <DataPagination
112
+ v-if="result"
113
+ :page="result.page"
114
+ :page-size="result.pageSize"
115
+ :total="result.total"
116
+ @update:page="load($event)"
117
+ @update:page-size="load(1, $event)"
118
+ />
119
+ </section>
120
+ </template>
@@ -0,0 +1,237 @@
1
+ <script setup lang="ts">
2
+ import { computed } from "vue";
3
+ import type { EnvironmentSnapshot, HostProbeKey } from "@southwind-ai/shared";
4
+ import { Badge } from "@/components/ui/badge";
5
+ import {
6
+ Card,
7
+ CardContent,
8
+ CardDescription,
9
+ CardHeader,
10
+ CardTitle,
11
+ } from "@/components/ui/card";
12
+ import { formatDateTime } from "@/lib/date-time";
13
+
14
+ const props = defineProps<{ environment: EnvironmentSnapshot }>();
15
+ const probeLabels: Record<HostProbeKey, string> = {
16
+ cpu: "CPU",
17
+ memory: "内存",
18
+ blockDevices: "块设备",
19
+ disks: "磁盘空间",
20
+ mounts: "挂载点",
21
+ network: "网络",
22
+ systemd: "系统服务",
23
+ docker: "Docker",
24
+ compose: "Compose",
25
+ containers: "容器",
26
+ gpu: "GPU",
27
+ };
28
+ const probeStatuses = {
29
+ ok: "已采集",
30
+ missing: "命令未安装",
31
+ "permission-denied": "权限不足",
32
+ timeout: "采集超时",
33
+ failed: "采集失败",
34
+ unsupported: "不支持",
35
+ } as const;
36
+ const hostStatuses = {
37
+ available: "报告可用",
38
+ "not-configured": "未配置主机报告",
39
+ invalid: "报告无效",
40
+ stale: "报告已过期",
41
+ unreadable: "报告不可读",
42
+ } as const;
43
+ const probes = computed(() =>
44
+ Object.entries(probeLabels).map(([key, label]) => ({
45
+ key,
46
+ label,
47
+ probe: props.environment.host.report?.probes[key as HostProbeKey],
48
+ })),
49
+ );
50
+ function memory(value: number | null | undefined) {
51
+ return value == null ? "未知" : `${(value / 1024 ** 3).toFixed(1)} GiB`;
52
+ }
53
+ </script>
54
+
55
+ <template>
56
+ <Card>
57
+ <CardHeader>
58
+ <CardTitle>运行环境证据</CardTitle>
59
+ <CardDescription
60
+ >应用进程与宿主机分别展示;未采集到的信息保持未知。</CardDescription
61
+ >
62
+ </CardHeader>
63
+ <CardContent class="space-y-5">
64
+ <section class="space-y-2" aria-label="应用进程环境">
65
+ <div class="flex flex-wrap items-center gap-2">
66
+ <h3 class="text-sm font-medium">应用进程</h3>
67
+ <Badge variant="secondary">{{
68
+ environment.process.containerized ? "容器内进程" : "应用进程"
69
+ }}</Badge>
70
+ <span class="text-xs text-muted-foreground"
71
+ >快照时间 {{ formatDateTime(environment.generatedAt) }}</span
72
+ >
73
+ </div>
74
+ <dl class="grid gap-2 text-sm sm:grid-cols-2 lg:grid-cols-4">
75
+ <div>
76
+ <dt class="text-muted-foreground">操作系统 / 架构</dt>
77
+ <dd>
78
+ {{ environment.process.platform }} /
79
+ {{ environment.process.architecture }}
80
+ </dd>
81
+ </div>
82
+ <div>
83
+ <dt class="text-muted-foreground">运行时</dt>
84
+ <dd>
85
+ Node {{ environment.process.nodeVersion
86
+ }}<template v-if="environment.process.bunVersion">
87
+ · Bun {{ environment.process.bunVersion }}</template
88
+ >
89
+ </dd>
90
+ </div>
91
+ <div>
92
+ <dt class="text-muted-foreground">进程可见逻辑 CPU</dt>
93
+ <dd>{{ environment.process.logicalCpuCount }}</dd>
94
+ </div>
95
+ <div>
96
+ <dt class="text-muted-foreground">进程可见总内存</dt>
97
+ <dd>{{ memory(environment.process.memoryTotalBytes) }}</dd>
98
+ </div>
99
+ </dl>
100
+ <p class="text-xs text-muted-foreground">
101
+ 来源:应用运行时。容器可见资源不等于宿主机配置或容器配额。
102
+ </p>
103
+ </section>
104
+ <section class="space-y-3 border-t pt-4" aria-label="宿主机环境">
105
+ <div class="flex flex-wrap items-center gap-2">
106
+ <h3 class="text-sm font-medium">宿主机</h3>
107
+ <Badge
108
+ :variant="
109
+ environment.host.status === 'available' ? 'secondary' : 'outline'
110
+ "
111
+ >{{ hostStatuses[environment.host.status] }}</Badge
112
+ >
113
+ <span
114
+ v-if="environment.host.report"
115
+ class="text-xs text-muted-foreground"
116
+ >采集时间
117
+ {{ formatDateTime(environment.host.report.collectedAt) }}</span
118
+ >
119
+ </div>
120
+ <p class="text-sm text-muted-foreground" role="status">
121
+ {{ environment.host.message }}
122
+ </p>
123
+ <template v-if="environment.host.report">
124
+ <dl class="grid gap-2 text-sm sm:grid-cols-2 lg:grid-cols-4">
125
+ <div>
126
+ <dt class="text-muted-foreground">操作系统 / 内核</dt>
127
+ <dd>
128
+ {{
129
+ environment.host.report.facts.distribution ||
130
+ environment.host.report.facts.os ||
131
+ "未知"
132
+ }}
133
+ /
134
+ {{ environment.host.report.facts.kernel || "未知" }}
135
+ </dd>
136
+ </div>
137
+ <div>
138
+ <dt class="text-muted-foreground">架构</dt>
139
+ <dd>
140
+ {{ environment.host.report.facts.architecture || "未知" }}
141
+ </dd>
142
+ </div>
143
+ <div>
144
+ <dt class="text-muted-foreground">逻辑 CPU</dt>
145
+ <dd>
146
+ {{ environment.host.report.facts.cpuLogicalCount || "未知" }}
147
+ </dd>
148
+ </div>
149
+ <div>
150
+ <dt class="text-muted-foreground">总内存</dt>
151
+ <dd>
152
+ {{ memory(environment.host.report.facts.memoryTotalBytes) }}
153
+ </dd>
154
+ </div>
155
+ </dl>
156
+ <dl
157
+ aria-label="报告记录的交付信息"
158
+ class="grid gap-2 text-sm sm:grid-cols-3"
159
+ >
160
+ <div>
161
+ <dt class="text-muted-foreground">交付版本</dt>
162
+ <dd class="break-all">
163
+ {{ environment.host.report.deployment?.releaseId || "未知" }}
164
+ </dd>
165
+ </div>
166
+ <div>
167
+ <dt class="text-muted-foreground">源码提交</dt>
168
+ <dd class="break-all">
169
+ {{ environment.host.report.deployment?.gitSha || "未知" }}
170
+ </dd>
171
+ </div>
172
+ <div>
173
+ <dt class="text-muted-foreground">交付架构</dt>
174
+ <dd>
175
+ {{ environment.host.report.deployment?.platform || "未知" }}
176
+ </dd>
177
+ </div>
178
+ </dl>
179
+ <p
180
+ v-if="
181
+ environment.host.report.deployment?.status &&
182
+ environment.host.report.deployment.status !== 'available'
183
+ "
184
+ class="text-xs text-muted-foreground"
185
+ >
186
+ {{
187
+ environment.host.report.deployment.status === "invalid"
188
+ ? "交付信息格式无效,版本信息保持未知。"
189
+ : "交付信息不可读,版本信息保持未知。"
190
+ }}
191
+ </p>
192
+ <p class="text-xs text-muted-foreground">
193
+ 来源:宿主机诊断脚本
194
+ {{
195
+ environment.host.report.collector
196
+ }}。刷新页面只读取报告,不会重新执行主机命令。
197
+ </p>
198
+ </template>
199
+ <div class="grid items-start gap-2 md:grid-cols-2">
200
+ <details
201
+ v-for="item in probes"
202
+ :key="item.key"
203
+ class="min-w-0 rounded-md border p-3"
204
+ >
205
+ <summary
206
+ class="cursor-pointer text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
207
+ >
208
+ {{ item.label }}
209
+ <span class="ml-2 text-xs text-muted-foreground">{{
210
+ item.probe ? probeStatuses[item.probe.status] : "未知 · 未采集"
211
+ }}</span>
212
+ </summary>
213
+ <div class="mt-3 space-y-2">
214
+ <p class="text-xs text-muted-foreground">
215
+ 来源:宿主机诊断脚本 ·
216
+ {{
217
+ environment.host.report
218
+ ? formatDateTime(environment.host.report.collectedAt)
219
+ : "无采集时间"
220
+ }}<template v-if="item.probe?.truncated">
221
+ · 输出已截断</template
222
+ >
223
+ </p>
224
+ <pre
225
+ v-if="item.probe?.output"
226
+ class="max-h-60 overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs"
227
+ >{{ item.probe.output }}</pre>
228
+ <p v-else class="text-xs text-muted-foreground">
229
+ 无可用输出;不能据此判断硬件或软件不存在。
230
+ </p>
231
+ </div>
232
+ </details>
233
+ </div>
234
+ </section>
235
+ </CardContent>
236
+ </Card>
237
+ </template>
@@ -0,0 +1,131 @@
1
+ <script setup lang="ts">
2
+ import type {
3
+ EnvironmentAssessmentSnapshot,
4
+ FeatureEnvironmentAssessment,
5
+ } from "@southwind-ai/shared";
6
+ import { RouterLink } from "vue-router";
7
+ import { Badge } from "@/components/ui/badge";
8
+ import { Button } from "@/components/ui/button";
9
+ import {
10
+ Card,
11
+ CardContent,
12
+ CardDescription,
13
+ CardHeader,
14
+ CardTitle,
15
+ } from "@/components/ui/card";
16
+ import {
17
+ Table,
18
+ TableBody,
19
+ TableCell,
20
+ TableHead,
21
+ TableHeader,
22
+ TableRow,
23
+ } from "@/components/ui/table";
24
+
25
+ defineProps<{
26
+ assessment: EnvironmentAssessmentSnapshot;
27
+ managementAllowed: boolean;
28
+ }>();
29
+ const statusLabels: Record<FeatureEnvironmentAssessment["status"], string> = {
30
+ hardware: "硬件条件不满足",
31
+ software: "软件条件不满足",
32
+ "not-packaged": "未包含在安装包",
33
+ configuration: "配置未完成",
34
+ unknown: "待确认",
35
+ available: "声明条件满足",
36
+ disabled: "已关闭",
37
+ };
38
+ function recommendation(feature: FeatureEnvironmentAssessment) {
39
+ if (feature.status === "disabled") return "保持现状,按需复核";
40
+ if (feature.recommendedEnabled === false) return "建议复核后关闭";
41
+ if (feature.recommendedEnabled === true) return "可按需启用,仍需业务验收";
42
+ return "补充证据后再决定";
43
+ }
44
+ </script>
45
+
46
+ <template>
47
+ <Card>
48
+ <CardHeader class="gap-3 sm:flex-row sm:items-start sm:justify-between">
49
+ <div class="space-y-2">
50
+ <CardTitle>功能环境评估</CardTitle>
51
+ <CardDescription
52
+ >评估仅提供建议,不会自动启用或停用功能。声明条件满足不代表模型已就绪或业务验收通过。</CardDescription
53
+ >
54
+ </div>
55
+ <Button
56
+ v-if="managementAllowed"
57
+ variant="outline"
58
+ as-child
59
+ class="shrink-0"
60
+ >
61
+ <RouterLink to="/admin/system/features">管理功能开关</RouterLink>
62
+ </Button>
63
+ </CardHeader>
64
+ <CardContent class="space-y-3">
65
+ <p class="text-sm text-muted-foreground" role="status">
66
+ {{ assessment.message }}
67
+ </p>
68
+ <p
69
+ v-if="assessment.features.length"
70
+ class="text-xs text-muted-foreground"
71
+ >
72
+ 管理员复核下方依据后,可前往功能管理页编辑并保存关闭。关闭功能不会卸载已交付代码;未打包的能力需要重新交付。
73
+ </p>
74
+ <div v-if="assessment.features.length" class="rounded-md border">
75
+ <Table
76
+ role="region"
77
+ aria-label="功能环境评估结果"
78
+ tabindex="0"
79
+ class="min-w-[640px]"
80
+ >
81
+ <TableHeader>
82
+ <TableRow>
83
+ <TableHead scope="col">功能</TableHead>
84
+ <TableHead scope="col">评估分类</TableHead>
85
+ <TableHead scope="col">依据</TableHead>
86
+ <TableHead scope="col">建议</TableHead>
87
+ </TableRow>
88
+ </TableHeader>
89
+ <TableBody>
90
+ <TableRow v-for="feature in assessment.features" :key="feature.key">
91
+ <TableCell class="align-top">
92
+ <div class="font-medium">{{ feature.title }}</div>
93
+ <div class="mt-1 text-xs text-muted-foreground">
94
+ {{ feature.key }}
95
+ </div>
96
+ </TableCell>
97
+ <TableCell class="align-top"
98
+ ><Badge variant="outline">{{
99
+ statusLabels[feature.status]
100
+ }}</Badge></TableCell
101
+ >
102
+ <TableCell class="max-w-lg whitespace-normal align-top">
103
+ <p>{{ feature.message }}</p>
104
+ <ul
105
+ v-if="feature.evidence.length"
106
+ class="mt-2 list-disc space-y-1 pl-4 text-xs text-muted-foreground"
107
+ >
108
+ <li
109
+ v-for="(evidence, index) in feature.evidence"
110
+ :key="index"
111
+ >
112
+ {{ evidence }}
113
+ </li>
114
+ </ul>
115
+ <p v-else class="mt-2 text-xs text-muted-foreground">
116
+ 暂无补充证据。
117
+ </p>
118
+ </TableCell>
119
+ <TableCell class="whitespace-normal align-top">{{
120
+ recommendation(feature)
121
+ }}</TableCell>
122
+ </TableRow>
123
+ </TableBody>
124
+ </Table>
125
+ </div>
126
+ <p v-else class="text-sm text-muted-foreground">
127
+ 暂无可评估功能。请先配置功能环境策略,不会依据缺失信息自动停用。
128
+ </p>
129
+ </CardContent>
130
+ </Card>
131
+ </template>
@@ -8,6 +8,7 @@ const props = defineProps<{
8
8
  modelValue: string[];
9
9
  label: string;
10
10
  multiple?: boolean;
11
+ grid?: boolean;
11
12
  disabled?: boolean;
12
13
  clearable?: boolean;
13
14
  }>();
@@ -76,31 +77,37 @@ function select(id: string, checked: boolean) {
76
77
  >:{{ selectedNames }}</span
77
78
  >
78
79
  </p>
79
- <div v-for="item in visible" :key="item.id" class="rounded-md border p-3">
80
- <label class="flex cursor-pointer items-start gap-3 text-sm">
81
- <input
82
- :type="multiple ? 'checkbox' : 'radio'"
83
- :name="multiple ? undefined : selectionName"
84
- :checked="modelValue.includes(item.id)"
85
- :disabled="disabled"
86
- :aria-label="item.label"
87
- class="mt-1 accent-primary"
88
- @change="select(item.id, ($event.target as HTMLInputElement).checked)"
89
- />
90
- <span class="grid gap-1"
91
- ><span class="font-medium">{{ item.label }}</span
92
- ><span
93
- v-if="item.description"
94
- class="break-all text-xs text-muted-foreground"
95
- >{{ item.description }}</span
96
- ></span
97
- >
98
- </label>
99
- <slot name="detail" :id="item.id" />
80
+ <div
81
+ v-if="visible.length"
82
+ class="grid gap-3"
83
+ :class="{ 'sm:grid-cols-2': grid }"
84
+ >
85
+ <div v-for="item in visible" :key="item.id" class="rounded-md border p-3">
86
+ <label class="flex cursor-pointer items-start gap-3 text-sm">
87
+ <input
88
+ :type="multiple ? 'checkbox' : 'radio'"
89
+ :name="multiple ? undefined : selectionName"
90
+ :checked="modelValue.includes(item.id)"
91
+ :disabled="disabled"
92
+ :aria-label="item.label"
93
+ class="mt-1 accent-primary"
94
+ @change="
95
+ select(item.id, ($event.target as HTMLInputElement).checked)
96
+ "
97
+ />
98
+ <span class="grid gap-1"
99
+ ><span class="font-medium">{{ item.label }}</span
100
+ ><span
101
+ v-if="item.description"
102
+ class="break-all text-xs text-muted-foreground"
103
+ >{{ item.description }}</span
104
+ ></span
105
+ >
106
+ </label>
107
+ <slot name="detail" :id="item.id" />
108
+ </div>
100
109
  </div>
101
- <p v-if="!visible.length" class="text-sm text-muted-foreground">
102
- 暂无匹配选项。
103
- </p>
110
+ <p v-else class="text-sm text-muted-foreground">暂无匹配选项。</p>
104
111
  <div
105
112
  class="flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground"
106
113
  >
@@ -5,6 +5,7 @@ import { DownloadIcon, PlusIcon, RefreshCwIcon, UploadIcon } from "@lucide/vue";
5
5
 
6
6
  defineProps<{
7
7
  canCreate: boolean;
8
+ createLabel?: string;
8
9
  canImport: boolean;
9
10
  replacesNativeTransfer?: boolean;
10
11
  }>();
@@ -54,7 +55,7 @@ function selectImport(event: Event) {
54
55
  </Button>
55
56
  <Button v-if="canCreate" @click="emit('create')">
56
57
  <PlusIcon data-icon="inline-start" />
57
- 新增
58
+ {{ createLabel ?? "新增" }}
58
59
  </Button>
59
60
  <input
60
61
  v-if="!replacesNativeTransfer"