create-windy 0.8.3 → 0.10.0

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 (691) hide show
  1. package/dist/cli.js +2714 -1944
  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 +92 -22
  8. package/template/apps/agent-server/README.md +47 -85
  9. package/template/apps/agent-server/documents/office.py +216 -0
  10. package/template/apps/agent-server/documents/query_report.py +136 -0
  11. package/template/apps/agent-server/documents/smoke.py +177 -0
  12. package/template/apps/agent-server/documents/test_boundaries.py +185 -0
  13. package/template/apps/agent-server/host-contracts.ts +56 -0
  14. package/template/apps/agent-server/install-native.ts +167 -0
  15. package/template/apps/agent-server/main.ts +179 -0
  16. package/template/apps/agent-server/native/EXTENSIONS.md +46 -0
  17. package/template/apps/agent-server/native/admission.ts +73 -0
  18. package/template/apps/agent-server/native/authorization.test.ts +176 -0
  19. package/template/apps/agent-server/native/authorization.ts +118 -0
  20. package/template/apps/agent-server/native/boundary-io.ts +93 -0
  21. package/template/apps/agent-server/native/boundary-product.ts +107 -0
  22. package/template/apps/agent-server/native/boundary-project.test.ts +247 -0
  23. package/template/apps/agent-server/native/boundary-project.ts +188 -0
  24. package/template/apps/agent-server/native/boundary.ts +188 -0
  25. package/template/apps/agent-server/native/compaction-policy.test.ts +175 -0
  26. package/template/apps/agent-server/native/config.ts +95 -0
  27. package/template/apps/agent-server/native/conversation-instructions.ts +9 -0
  28. package/template/apps/agent-server/native/extensions.test.ts +190 -0
  29. package/template/apps/agent-server/native/extensions.ts +31 -0
  30. package/template/apps/agent-server/native/host-profile.test.ts +91 -0
  31. package/template/apps/agent-server/native/host-profile.ts +33 -0
  32. package/template/apps/agent-server/native/host-test-fixture.ts +13 -0
  33. package/template/apps/agent-server/native/http.ts +129 -0
  34. package/template/apps/agent-server/native/lifecycle.test.ts +285 -0
  35. package/template/apps/agent-server/native/lifecycle.ts +136 -0
  36. package/template/apps/agent-server/native/manager.ts +292 -0
  37. package/template/apps/agent-server/native/native.test.ts +207 -0
  38. package/template/apps/agent-server/native/office-preview.test.ts +50 -0
  39. package/template/apps/agent-server/native/office-preview.ts +25 -0
  40. package/template/apps/agent-server/native/parallel-harness.ts +244 -0
  41. package/template/apps/agent-server/native/parallel-mcp-fixture.ts +97 -0
  42. package/template/apps/agent-server/native/parallel.test.ts +256 -0
  43. package/template/apps/agent-server/native/profile-composition.test.ts +147 -0
  44. package/template/apps/agent-server/native/profile.ts +307 -0
  45. package/template/apps/agent-server/native/request.ts +61 -0
  46. package/template/apps/agent-server/native/session-conflict.test.ts +235 -0
  47. package/template/apps/agent-server/native/session-conflict.ts +21 -0
  48. package/template/apps/agent-server/native/shared-skills.test.ts +128 -0
  49. package/template/apps/agent-server/native/shared-skills.ts +240 -0
  50. package/template/apps/agent-server/native/socket-lifecycle.test.ts +48 -0
  51. package/template/apps/agent-server/native/socket.ts +130 -0
  52. package/template/apps/agent-server/native/storage-lifecycle.test.ts +218 -0
  53. package/template/apps/agent-server/native/storage.ts +188 -0
  54. package/template/apps/agent-server/native/stream-authorization.test.ts +89 -0
  55. package/template/apps/agent-server/native/worker.ts +77 -0
  56. package/template/apps/agent-server/native-download.test.ts +119 -0
  57. package/template/apps/agent-server/native-download.ts +145 -0
  58. package/template/apps/agent-server/package.json +64 -0
  59. package/template/apps/agent-server/plugins/access.mjs +126 -0
  60. package/template/apps/agent-server/plugins/branding/README.md +9 -0
  61. package/template/apps/agent-server/plugins/branding/brand.css +85 -0
  62. package/template/apps/agent-server/plugins/branding/client.js +338 -0
  63. package/template/apps/agent-server/plugins/branding/index.mjs +35 -0
  64. package/template/apps/agent-server/plugins/branding/loading.d.mts +2 -0
  65. package/template/apps/agent-server/plugins/branding/loading.mjs +66 -0
  66. package/template/apps/agent-server/plugins/branding/loading.test.ts +89 -0
  67. package/template/apps/agent-server/plugins/branding/package.json +21 -0
  68. package/template/apps/agent-server/plugins/branding.test.ts +294 -0
  69. package/template/apps/agent-server/plugins/compaction.mjs +83 -0
  70. package/template/apps/agent-server/plugins/compaction.test.ts +91 -0
  71. package/template/apps/agent-server/plugins/confine-network.py +57 -0
  72. package/template/apps/agent-server/plugins/default-skills.test.ts +62 -0
  73. package/template/apps/agent-server/plugins/downloads/README.md +28 -0
  74. package/template/apps/agent-server/plugins/downloads/client.js +126 -0
  75. package/template/apps/agent-server/plugins/downloads/downloads.test.ts +222 -0
  76. package/template/apps/agent-server/plugins/downloads/index.d.mts +19 -0
  77. package/template/apps/agent-server/plugins/downloads/index.mjs +180 -0
  78. package/template/apps/agent-server/plugins/downloads/package.json +20 -0
  79. package/template/apps/agent-server/plugins/drop-overlay/README.md +24 -0
  80. package/template/apps/agent-server/plugins/drop-overlay/drop-overlay.test.ts +199 -0
  81. package/template/apps/agent-server/plugins/drop-overlay/index.d.mts +8 -0
  82. package/template/apps/agent-server/plugins/drop-overlay/index.mjs +12 -0
  83. package/template/apps/agent-server/plugins/drop-overlay/style.css +102 -0
  84. package/template/apps/agent-server/plugins/locale/client.js +61 -0
  85. package/template/apps/agent-server/plugins/locale/index.d.mts +9 -0
  86. package/template/apps/agent-server/plugins/locale/index.mjs +16 -0
  87. package/template/apps/agent-server/plugins/locale/locale.test.ts +217 -0
  88. package/template/apps/agent-server/plugins/locale/package.json +19 -0
  89. package/template/apps/agent-server/plugins/parallel.mjs +146 -0
  90. package/template/apps/agent-server/plugins/preset-registry.d.mts +2 -0
  91. package/template/apps/agent-server/plugins/preset-registry.mjs +41 -0
  92. package/template/apps/agent-server/plugins/preset-registry.test.ts +46 -0
  93. package/template/apps/agent-server/plugins/questions.d.mts +25 -0
  94. package/template/apps/agent-server/plugins/questions.mjs +142 -0
  95. package/template/apps/agent-server/plugins/questions.test.ts +105 -0
  96. package/template/apps/agent-server/plugins/settings/README.md +17 -0
  97. package/template/apps/agent-server/plugins/settings/client.js +102 -0
  98. package/template/apps/agent-server/plugins/settings/index.mjs +17 -0
  99. package/template/apps/agent-server/plugins/settings/package.json +19 -0
  100. package/template/apps/agent-server/plugins/settings/settings.test.ts +129 -0
  101. package/template/apps/agent-server/plugins/settings-controller.d.mts +4 -0
  102. package/template/apps/agent-server/plugins/settings-controller.mjs +31 -0
  103. package/template/apps/agent-server/plugins/settings-controller.test.ts +17 -0
  104. package/template/apps/agent-server/plugins/settings-dispatch.test.ts +34 -0
  105. package/template/apps/agent-server/plugins/shared-skills.d.mts +15 -0
  106. package/template/apps/agent-server/plugins/shared-skills.mjs +82 -0
  107. package/template/apps/agent-server/plugins/shared-skills.test.ts +51 -0
  108. package/template/apps/agent-server/plugins/skill-library/README.md +11 -0
  109. package/template/apps/agent-server/plugins/skill-library/archive.test.ts +43 -0
  110. package/template/apps/agent-server/plugins/skill-library/bundle.mjs +234 -0
  111. package/template/apps/agent-server/plugins/skill-library/client-chunks.test.ts +110 -0
  112. package/template/apps/agent-server/plugins/skill-library/client-form-mount.test.ts +139 -0
  113. package/template/apps/agent-server/plugins/skill-library/client-form.test.ts +261 -0
  114. package/template/apps/agent-server/plugins/skill-library/client-ui.test.ts +268 -0
  115. package/template/apps/agent-server/plugins/skill-library/client-use.test.ts +158 -0
  116. package/template/apps/agent-server/plugins/skill-library/client.editor.js +93 -0
  117. package/template/apps/agent-server/plugins/skill-library/client.form.js +316 -0
  118. package/template/apps/agent-server/plugins/skill-library/client.js +348 -0
  119. package/template/apps/agent-server/plugins/skill-library/client.request.js +52 -0
  120. package/template/apps/agent-server/plugins/skill-library/client.transfer.js +48 -0
  121. package/template/apps/agent-server/plugins/skill-library/client.use.js +46 -0
  122. package/template/apps/agent-server/plugins/skill-library/default-roots.test.ts +84 -0
  123. package/template/apps/agent-server/plugins/skill-library/draft.d.mts +17 -0
  124. package/template/apps/agent-server/plugins/skill-library/draft.mjs +152 -0
  125. package/template/apps/agent-server/plugins/skill-library/draft.test.ts +287 -0
  126. package/template/apps/agent-server/plugins/skill-library/index.d.mts +49 -0
  127. package/template/apps/agent-server/plugins/skill-library/index.mjs +226 -0
  128. package/template/apps/agent-server/plugins/skill-library/package.json +24 -0
  129. package/template/apps/agent-server/plugins/skill-library/presentation/README.md +27 -0
  130. package/template/apps/agent-server/plugins/skill-library/presentation/UPSTREAM.md +54 -0
  131. package/template/apps/agent-server/plugins/skill-library/presentation/boot.test.ts +150 -0
  132. package/template/apps/agent-server/plugins/skill-library/presentation/client.js +146 -0
  133. package/template/apps/agent-server/plugins/skill-library/presentation/client.test.ts +195 -0
  134. package/template/apps/agent-server/plugins/skill-library/presentation/index.d.mts +9 -0
  135. package/template/apps/agent-server/plugins/skill-library/presentation/index.mjs +30 -0
  136. package/template/apps/agent-server/plugins/skill-library/presentation/metadata.test.ts +82 -0
  137. package/template/apps/agent-server/plugins/skill-library/presentation/package.json +21 -0
  138. package/template/apps/agent-server/plugins/skill-library/presentation/react-boot.test.ts +162 -0
  139. package/template/apps/agent-server/plugins/skill-library/skills.test.ts +342 -0
  140. package/template/apps/agent-server/plugins/skill-library/storage.mjs +293 -0
  141. package/template/apps/agent-server/plugins/skill-library/style.css +229 -0
  142. package/template/apps/agent-server/plugins/skill-library/test-fixture.ts +77 -0
  143. package/template/apps/agent-server/plugins/skill-library/workflow.d.mts +18 -0
  144. package/template/apps/agent-server/plugins/skill-library/workflow.mjs +189 -0
  145. package/template/apps/agent-server/plugins/skill-library/workflow.test.ts +164 -0
  146. package/template/apps/agent-server/plugins/skills/README.md +5 -0
  147. package/template/apps/agent-server/plugins/skills/windy-data-summary/SKILL.md +14 -0
  148. package/template/apps/agent-server/plugins/skills/windy-extension-guide/SKILL.md +14 -0
  149. package/template/apps/agent-server/plugins/skills/windy-office/SKILL.md +14 -0
  150. package/template/apps/agent-server/plugins/skills/windy-skill-capture/SKILL.md +14 -0
  151. package/template/apps/agent-server/plugins/skills/windy-source-compare/SKILL.md +14 -0
  152. package/template/apps/agent-server/plugins/subprocess.mjs +40 -0
  153. package/template/apps/agent-server/plugins/theme/README.md +22 -0
  154. package/template/apps/agent-server/plugins/theme/client.js +18 -0
  155. package/template/apps/agent-server/plugins/theme/index.d.mts +9 -0
  156. package/template/apps/agent-server/plugins/theme/index.mjs +18 -0
  157. package/template/apps/agent-server/plugins/theme/package.json +19 -0
  158. package/template/apps/agent-server/plugins/theme/source-tokens.ts +81 -0
  159. package/template/apps/agent-server/plugins/theme/sync-tokens.ts +12 -0
  160. package/template/apps/agent-server/plugins/theme/theme.test.ts +193 -0
  161. package/template/apps/agent-server/plugins/theme/tokens.json +162 -0
  162. package/template/apps/agent-server/plugins/tool-catalog/README.md +82 -0
  163. package/template/apps/agent-server/plugins/tool-catalog/categories.mjs +111 -0
  164. package/template/apps/agent-server/plugins/tool-catalog/categories.test.ts +118 -0
  165. package/template/apps/agent-server/plugins/tool-catalog/client-cache.test.ts +264 -0
  166. package/template/apps/agent-server/plugins/tool-catalog/client.js +333 -0
  167. package/template/apps/agent-server/plugins/tool-catalog/client.test.ts +136 -0
  168. package/template/apps/agent-server/plugins/tool-catalog/discovery.d.mts +42 -0
  169. package/template/apps/agent-server/plugins/tool-catalog/discovery.mjs +245 -0
  170. package/template/apps/agent-server/plugins/tool-catalog/discovery.test.ts +291 -0
  171. package/template/apps/agent-server/plugins/tool-catalog/index.d.mts +5 -0
  172. package/template/apps/agent-server/plugins/tool-catalog/index.mjs +91 -0
  173. package/template/apps/agent-server/plugins/tool-catalog/package.json +23 -0
  174. package/template/apps/agent-server/plugins/tool-catalog/presentation.d.mts +21 -0
  175. package/template/apps/agent-server/plugins/tool-catalog/presentation.mjs +153 -0
  176. package/template/apps/agent-server/plugins/tool-catalog/presentation.test.ts +166 -0
  177. package/template/apps/agent-server/plugins/tool-catalog/routes.test.ts +209 -0
  178. package/template/apps/agent-server/plugins/tool-catalog/style.css +155 -0
  179. package/template/apps/agent-server/plugins/tool-catalog/use-tool.test.ts +160 -0
  180. package/template/apps/agent-server/plugins/tool-presentation/README.md +7 -0
  181. package/template/apps/agent-server/plugins/tool-presentation/build-client.ts +29 -0
  182. package/template/apps/agent-server/plugins/tool-presentation/client.js +312 -0
  183. package/template/apps/agent-server/plugins/tool-presentation/client.results.js +9 -0
  184. package/template/apps/agent-server/plugins/tool-presentation/client.test.ts +178 -0
  185. package/template/apps/agent-server/plugins/tool-presentation/index.mjs +10 -0
  186. package/template/apps/agent-server/plugins/tool-presentation/package.json +24 -0
  187. package/template/apps/agent-server/plugins/tool-presentation/result-discovery.mjs +43 -0
  188. package/template/apps/agent-server/plugins/tool-presentation/result-model.d.mts +51 -0
  189. package/template/apps/agent-server/plugins/tool-presentation/result-model.mjs +96 -0
  190. package/template/apps/agent-server/plugins/workspace/README.md +5 -0
  191. package/template/apps/agent-server/plugins/workspace/index.mjs +8 -0
  192. package/template/apps/agent-server/plugins/workspace/package.json +10 -0
  193. package/template/apps/agent-server/plugins/workspace/style.css +124 -0
  194. package/template/apps/agent-server/project/host.ts +13 -0
  195. package/template/apps/agent-server/runtime/artifacts.ts +115 -0
  196. package/template/apps/agent-server/runtime/audit.nodecheck.ts +60 -0
  197. package/template/apps/agent-server/runtime/capacity.ts +61 -0
  198. package/template/apps/agent-server/runtime/client-completion-budget.nodecheck.ts +92 -0
  199. package/template/apps/agent-server/runtime/compatibility.ts +39 -0
  200. package/template/apps/agent-server/runtime/completions.ts +320 -0
  201. package/template/apps/agent-server/runtime/config.ts +246 -0
  202. package/template/apps/agent-server/runtime/context-budget.ts +70 -0
  203. package/template/apps/agent-server/runtime/context-plugin.ts +306 -0
  204. package/template/apps/agent-server/runtime/context.nodecheck.ts +241 -0
  205. package/template/apps/agent-server/runtime/contracts.ts +201 -0
  206. package/template/apps/agent-server/runtime/dsh-engine.ts +198 -0
  207. package/template/apps/agent-server/runtime/evaluation-plugin.ts +115 -0
  208. package/template/apps/agent-server/runtime/evaluation.nodecheck.ts +194 -0
  209. package/template/apps/agent-server/runtime/events.ts +71 -0
  210. package/template/apps/agent-server/runtime/governance.ts +194 -0
  211. package/template/apps/agent-server/runtime/index.ts +339 -0
  212. package/template/apps/agent-server/runtime/internal-output.ts +37 -0
  213. package/template/apps/agent-server/runtime/isolation.nodecheck.ts +287 -0
  214. package/template/apps/agent-server/runtime/model-payload.ts +97 -0
  215. package/template/apps/agent-server/runtime/model-plugin.ts +308 -0
  216. package/template/apps/agent-server/runtime/model-route.ts +34 -0
  217. package/template/apps/agent-server/runtime/model-usage.ts +51 -0
  218. package/template/apps/agent-server/runtime/model-wire.ts +45 -0
  219. package/template/apps/agent-server/runtime/native-authorization.nodecheck.ts +126 -0
  220. package/template/apps/agent-server/runtime/native-completion.nodecheck.ts +81 -0
  221. package/template/apps/agent-server/runtime/output-validation.ts +66 -0
  222. package/template/apps/agent-server/runtime/production-capacity.nodecheck.ts +121 -0
  223. package/template/apps/agent-server/runtime/questions-workflow.nodecheck.ts +251 -0
  224. package/template/apps/agent-server/runtime/report-breakdown.ts +79 -0
  225. package/template/apps/agent-server/runtime/reporting.ts +219 -0
  226. package/template/apps/agent-server/runtime/run-completion.ts +39 -0
  227. package/template/apps/agent-server/runtime/run-request-digest.ts +18 -0
  228. package/template/apps/agent-server/runtime/runtime-test-fixtures.ts +264 -0
  229. package/template/apps/agent-server/runtime/runtime.nodecheck.ts +150 -0
  230. package/template/apps/agent-server/runtime/store-idempotency.nodecheck.ts +74 -0
  231. package/template/apps/agent-server/runtime/store.ts +324 -0
  232. package/template/apps/agent-server/runtime/structured-output-mode.nodecheck.ts +51 -0
  233. package/template/apps/agent-server/runtime/tool-name.ts +6 -0
  234. package/template/apps/agent-server/runtime/tool-plugin.ts +201 -0
  235. package/template/apps/agent-server/runtime/vision-readiness.ts +200 -0
  236. package/template/apps/agent-server/scripts/confinement-check.mjs +103 -0
  237. package/template/apps/agent-server/scripts/coordinator-check.mjs +344 -0
  238. package/template/apps/agent-server/scripts/documents-delivery-check.mjs +309 -0
  239. package/template/apps/agent-server/scripts/office-preview-check.mjs +92 -0
  240. package/template/apps/agent-server/scripts/test-confinement.ts +58 -0
  241. package/template/apps/agent-server/scripts/test-coordinator.ts +36 -0
  242. package/template/apps/agent-server/scripts/test-runtime.ts +46 -0
  243. package/template/apps/agent-server/tsconfig.json +21 -0
  244. package/template/apps/server/Dockerfile +5 -1
  245. package/template/apps/server/package.json +14 -10
  246. package/template/apps/server/scripts/check-dsh-platform-example.ts +251 -0
  247. package/template/apps/server/scripts/validate-module-composition-once.ts +2 -0
  248. package/template/apps/server/scripts/validate-module-composition.ts +8 -4
  249. package/template/apps/server/src/admin/routes.test.ts +29 -1
  250. package/template/apps/server/src/admin/routes.ts +20 -2
  251. package/template/apps/server/src/agent/client-session/completion.ts +1 -1
  252. package/template/apps/server/src/agent/client-session/manifest-admission.ts +1 -1
  253. package/template/apps/server/src/agent/client-session/request.ts +1 -1
  254. package/template/apps/server/src/agent/context-version-routes.ts +37 -13
  255. package/template/apps/server/src/agent/dsh-runtime-wire.test.ts +33 -0
  256. package/template/apps/server/src/agent/governance-runtime.ts +41 -0
  257. package/template/apps/server/src/agent/remote-runtime-response.ts +1 -1
  258. package/template/apps/server/src/agent/run-contracts.ts +1 -0
  259. package/template/apps/server/src/agent/run-definition-support.ts +9 -0
  260. package/template/apps/server/src/agent/run-facade.ts +1 -1
  261. package/template/apps/server/src/agent/run-input-verification.ts +1 -1
  262. package/template/apps/server/src/agent/run-routes.ts +1 -14
  263. package/template/apps/server/src/agent/run-start-preparation.ts +1 -1
  264. package/template/apps/server/src/agent/runtime-bootstrap-input.ts +2 -0
  265. package/template/apps/server/src/agent/runtime-bootstrap.ts +49 -157
  266. package/template/apps/server/src/agent/runtime-disabled-composition.ts +2 -1
  267. package/template/apps/server/src/agent/runtime-tool-composition.ts +2 -0
  268. package/template/apps/server/src/agent/session-invalidation/authorization-revocation.ts +54 -0
  269. package/template/apps/server/src/agent/session-runtime-composition.ts +1 -51
  270. package/template/apps/server/src/agent/unavailable-routes.ts +13 -2
  271. package/template/apps/server/src/agent/workflow-runtime-bootstrap.ts +9 -0
  272. package/template/apps/server/src/agent-skills/access.ts +88 -0
  273. package/template/apps/server/src/agent-skills/bootstrap.ts +49 -0
  274. package/template/apps/server/src/agent-skills/builtin-registration.ts +83 -0
  275. package/template/apps/server/src/agent-skills/builtins.ts +19 -0
  276. package/template/apps/server/src/agent-skills/bundle-zip.ts +163 -0
  277. package/template/apps/server/src/agent-skills/bundle.test.ts +79 -0
  278. package/template/apps/server/src/agent-skills/bundle.ts +133 -0
  279. package/template/apps/server/src/agent-skills/contracts.ts +46 -0
  280. package/template/apps/server/src/agent-skills/drizzle-repository.ts +125 -0
  281. package/template/apps/server/src/agent-skills/input.ts +29 -0
  282. package/template/apps/server/src/agent-skills/postgres.integration.test.ts +348 -0
  283. package/template/apps/server/src/agent-skills/read-routes.test.ts +116 -0
  284. package/template/apps/server/src/agent-skills/reader.ts +108 -0
  285. package/template/apps/server/src/agent-skills/repository.ts +105 -0
  286. package/template/apps/server/src/agent-skills/routes.ts +176 -0
  287. package/template/apps/server/src/agent-skills/service.test.ts +295 -0
  288. package/template/apps/server/src/agent-skills/service.ts +301 -0
  289. package/template/apps/server/src/agent-workflow/preset-registry.test.ts +137 -0
  290. package/template/apps/server/src/agent-workflow/preset-registry.ts +191 -0
  291. package/template/apps/server/src/agent-workflow/preset-routes.test.ts +94 -0
  292. package/template/apps/server/src/agent-workflow/preset-routes.ts +45 -0
  293. package/template/apps/server/src/agent-workflow/runtime-composition.ts +3 -0
  294. package/template/apps/server/src/agent-workflow/service.ts +17 -1
  295. package/template/apps/server/src/ai-artifact/media-resource-route.test.ts +134 -0
  296. package/template/apps/server/src/ai-artifact/routes.ts +1 -1
  297. package/template/apps/server/src/ai-artifact/runtime.ts +12 -0
  298. package/template/apps/server/src/ai-runtime-readiness/operation-port.test-support.ts +1 -1
  299. package/template/apps/server/src/ai-runtime-readiness/operation-port.ts +8 -0
  300. package/template/apps/server/src/ai-runtime-report/service.test.ts +10 -7
  301. package/template/apps/server/src/ai-runtime-report/service.ts +1 -1
  302. package/template/apps/server/src/ai-runtime-security/internal-token.ts +14 -0
  303. package/template/apps/server/src/app/agent-workflow-presets.ts +4 -0
  304. package/template/apps/server/src/app/antivirus-composition.test.ts +63 -0
  305. package/template/apps/server/src/app/antivirus-composition.ts +29 -0
  306. package/template/apps/server/src/app/dsh-skill-draft-audit.test.ts +195 -0
  307. package/template/apps/server/src/app/dsh-skill-draft-audit.ts +115 -0
  308. package/template/apps/server/src/app/dsh-workbench-audit.test.ts +71 -0
  309. package/template/apps/server/src/app/dsh-workbench-audit.ts +34 -0
  310. package/template/apps/server/src/app/dsh-workbench-handshake.test.ts +63 -0
  311. package/template/apps/server/src/app/dsh-workbench-handshake.ts +48 -0
  312. package/template/apps/server/src/app/dsh-workbench-http.test.ts +96 -0
  313. package/template/apps/server/src/app/dsh-workbench-lan-origin.test.ts +114 -0
  314. package/template/apps/server/src/app/dsh-workbench-launch.test.ts +70 -0
  315. package/template/apps/server/src/app/dsh-workbench-origin.test.ts +54 -0
  316. package/template/apps/server/src/app/dsh-workbench-proxy.ts +205 -0
  317. package/template/apps/server/src/app/dsh-workbench-session-conflict.test.ts +61 -0
  318. package/template/apps/server/src/app/dsh-workbench-session.ts +59 -0
  319. package/template/apps/server/src/app/dsh-workbench-socket-audit.test.ts +116 -0
  320. package/template/apps/server/src/app/dsh-workbench-socket.test.ts +246 -0
  321. package/template/apps/server/src/app/dsh-workbench-socket.ts +272 -0
  322. package/template/apps/server/src/app/dsh-workbench-test-support.ts +158 -0
  323. package/template/apps/server/src/app/dsh-workbench.test.ts +213 -0
  324. package/template/apps/server/src/app/dsh-workbench.ts +279 -0
  325. package/template/apps/server/src/app/workbench-public-origin.ts +16 -0
  326. package/template/apps/server/src/configuration/definition.ts +15 -11
  327. package/template/apps/server/src/data-governance/user-plaintext-routes.test.ts +3 -0
  328. package/template/apps/server/src/document/facade-support.ts +2 -2
  329. package/template/apps/server/src/document/facade.ts +2 -2
  330. package/template/apps/server/src/document/output-artifact-composition.ts +9 -5
  331. package/template/apps/server/src/document/output-artifact.test-support.ts +1 -1
  332. package/template/apps/server/src/embedding/facade.ts +1 -1
  333. package/template/apps/server/src/embedding/input.ts +1 -1
  334. package/template/apps/server/src/embedding/routes.ts +1 -1
  335. package/template/apps/server/src/http-app.ts +31 -0
  336. package/template/apps/server/src/index.ts +60 -60
  337. package/template/apps/server/src/license/routes.ts +4 -1
  338. package/template/apps/server/src/license/runtime-business-access.test.ts +261 -0
  339. package/template/apps/server/src/mcp/adapter.ts +1 -0
  340. package/template/apps/server/src/media-runtime/composition.ts +157 -0
  341. package/template/apps/server/src/media-runtime/media-only-composition.ts +44 -0
  342. package/template/apps/server/src/media-runtime/module-ai-port-factory.test.ts +69 -0
  343. package/template/apps/server/src/media-runtime/module-ai-port-factory.ts +72 -0
  344. package/template/apps/server/src/{agent → media-runtime}/runtime-readiness-sources.ts +14 -6
  345. package/template/apps/server/src/media-runtime/shared-composition.ts +104 -0
  346. package/template/apps/server/src/module-composition.test.ts +45 -0
  347. package/template/apps/server/src/module-composition.ts +57 -2
  348. package/template/apps/server/src/module-host/ai-operation-port.ts +97 -30
  349. package/template/apps/server/src/module-host/ai-operation-speech-normalize.test.ts +1 -1
  350. package/template/apps/server/src/module-host/http-runtime.ts +9 -3
  351. package/template/apps/server/src/module-host/static-route-authorization.test.ts +6 -3
  352. package/template/apps/server/src/module-host/storage-authorization-binding.test.ts +4 -0
  353. package/template/apps/server/src/module-runtime-validation.ts +2 -0
  354. package/template/apps/server/src/observability/bootstrap.ts +12 -0
  355. package/template/apps/server/src/observability/diagnostic-failure-recorder.ts +94 -0
  356. package/template/apps/server/src/observability/diagnostic-http-contract.test.ts +42 -0
  357. package/template/apps/server/src/observability/diagnostic-index.test.ts +89 -0
  358. package/template/apps/server/src/observability/diagnostic-index.ts +113 -0
  359. package/template/apps/server/src/observability/diagnostic-repository.ts +96 -0
  360. package/template/apps/server/src/platform-app-bootstrap.ts +42 -0
  361. package/template/apps/server/src/platform-http-runtime.ts +7 -1
  362. package/template/apps/server/src/runtime-development.test.ts +25 -0
  363. package/template/apps/server/src/runtime-development.ts +6 -44
  364. package/template/apps/server/src/runtime-feature.ts +5 -1
  365. package/template/apps/server/src/runtime.ts +3 -0
  366. package/template/apps/server/src/settings/drizzle-watermark-repository.ts +35 -4
  367. package/template/apps/server/src/settings/watermark-repository.ts +14 -0
  368. package/template/apps/server/src/settings/watermark-routes.test.ts +84 -2
  369. package/template/apps/server/src/settings/watermark-routes.ts +109 -0
  370. package/template/apps/server/src/settings/watermark-transfer.ts +79 -0
  371. package/template/apps/server/src/speech/facade-validation.ts +1 -1
  372. package/template/apps/server/src/speech/facade.ts +2 -2
  373. package/template/apps/server/src/startup-composition-validation.test.ts +32 -0
  374. package/template/apps/server/src/startup-finalization.ts +2 -0
  375. package/template/apps/server/src/startup-runtime.ts +77 -0
  376. package/template/apps/server/src/system/ai-runtime-build.ts +3 -0
  377. package/template/apps/server/src/system/ai-runtime-configuration.test.ts +36 -0
  378. package/template/apps/server/src/system/ai-runtime-configuration.ts +58 -0
  379. package/template/apps/server/src/system/diagnostic-routes.test.ts +123 -0
  380. package/template/apps/server/src/system/diagnostic-routes.ts +101 -0
  381. package/template/apps/server/src/system/environment-policy-reader.test.ts +74 -0
  382. package/template/apps/server/src/system/environment-policy-reader.ts +62 -0
  383. package/template/apps/server/src/system/feature-environment-assessment.test.ts +148 -0
  384. package/template/apps/server/src/system/feature-environment-assessment.ts +179 -0
  385. package/template/apps/server/src/system/host-diagnostics.test.ts +155 -0
  386. package/template/apps/server/src/system/host-diagnostics.ts +225 -0
  387. package/template/apps/server/src/system/menu-registry.test.ts +26 -0
  388. package/template/apps/server/src/system/menu-registry.ts +9 -7
  389. package/template/apps/server/src/system/operations.test.ts +5 -0
  390. package/template/apps/server/src/system/operations.ts +36 -12
  391. package/template/apps/server/src/system/role-authorization-postgres.integration.test.ts +181 -0
  392. package/template/apps/web/Dockerfile +15 -3
  393. package/template/apps/web/dev/dev-port.test.ts +6 -6
  394. package/template/apps/web/dev/dev-port.ts +1 -1
  395. package/template/apps/web/dev/start.ts +27 -11
  396. package/template/apps/web/dsh-workbench-location.ts +21 -0
  397. package/template/apps/web/dsh-workbench-proxy.test.ts +121 -0
  398. package/template/apps/web/dsh-workbench-proxy.ts +194 -0
  399. package/template/apps/web/index.html +1 -0
  400. package/template/apps/web/package.json +18 -16
  401. package/template/apps/web/runtime-server.test.ts +22 -1
  402. package/template/apps/web/runtime-server.ts +6 -0
  403. package/template/apps/web/server.ts +27 -6
  404. package/template/apps/web/src/App.vue +6 -3
  405. package/template/apps/web/src/assets/windy.svg +4 -0
  406. package/template/apps/web/src/components/auth/LoginForm.vue +2 -2
  407. package/template/apps/web/src/components/auth/PasswordChangeForm.vue +14 -3
  408. package/template/apps/web/src/components/common/FormDialog.vue +1 -1
  409. package/template/apps/web/src/components/license/LicenseFlow.webtest.ts +3 -0
  410. package/template/apps/web/src/components/license/LicenseMachineCodeQr.vue +99 -0
  411. package/template/apps/web/src/components/license/LicenseMachineCodeQr.webtest.ts +83 -0
  412. package/template/apps/web/src/components/license/LicensePairingCard.vue +1 -1
  413. package/template/apps/web/src/components/license/LicenseStatusCard.vue +14 -2
  414. package/template/apps/web/src/composables/useLoginFlow.ts +13 -1
  415. package/template/apps/web/src/composables/usePlatformSettings.ts +1 -1
  416. package/template/apps/web/src/composables/useWatermarkSettings.ts +1 -0
  417. package/template/apps/web/src/layout/AppSidebar.vue +5 -9
  418. package/template/apps/web/src/layout/AppSidebar.webtest.ts +4 -1
  419. package/template/apps/web/src/pages/auth/ChangePasswordPage.vue +67 -6
  420. package/template/apps/web/src/pages/auth/LoginPage.vue +3 -12
  421. package/template/apps/web/src/pages/configuration/components/ModuleConfigurationEditor.vue +30 -0
  422. package/template/apps/web/src/pages/configuration/components/ModuleConfigurationWorkbench.vue +25 -14
  423. package/template/apps/web/src/pages/configuration/components/TimeZoneSelect.vue +55 -0
  424. package/template/apps/web/src/pages/errors/PlatformErrorPage.vue +6 -0
  425. package/template/apps/web/src/pages/errors/PlatformErrorPage.webtest.ts +14 -1
  426. package/template/apps/web/src/pages/errors/error-page-extension.ts +1 -0
  427. package/template/apps/web/src/pages/profile/PersonalSettingsPage.vue +64 -11
  428. package/template/apps/web/src/pages/profile/PersonalSettingsPage.webtest.ts +21 -1
  429. package/template/apps/web/src/pages/settings/BrandingSettingsSection.vue +7 -18
  430. package/template/apps/web/src/pages/settings/BrandingSettingsSection.webtest.ts +9 -4
  431. package/template/apps/web/src/pages/settings/GlobalSettingsPage.vue +51 -6
  432. package/template/apps/web/src/pages/settings/GlobalSettingsPage.webtest.ts +19 -3
  433. package/template/apps/web/src/pages/settings/WatermarkSettingsSection.vue +1 -0
  434. package/template/apps/web/src/pages/settings/WatermarkYamlTransfer.vue +211 -0
  435. package/template/apps/web/src/pages/system/AgentNativePage.vue +44 -0
  436. package/template/apps/web/src/pages/system/AgentWorkflowPage.vue +20 -7
  437. package/template/apps/web/src/pages/system/DiagnosticLookupPage.vue +71 -0
  438. package/template/apps/web/src/pages/system/DiagnosticLookupPage.webtest.ts +102 -0
  439. package/template/apps/web/src/pages/system/SystemAgentSkillsPage.vue +88 -0
  440. package/template/apps/web/src/pages/system/SystemOperationsPage.vue +23 -0
  441. package/template/apps/web/src/pages/system/components/DiagnosticLogList.vue +120 -0
  442. package/template/apps/web/src/pages/system/components/DiagnosticRecordDetails.vue +52 -0
  443. package/template/apps/web/src/pages/system/components/OperationEnvironmentPanel.vue +237 -0
  444. package/template/apps/web/src/pages/system/components/OperationFeatureAssessmentPanel.vue +131 -0
  445. package/template/apps/web/src/pages/system/components/PagedSelectionList.vue +31 -24
  446. package/template/apps/web/src/pages/system/components/SystemResourceActions.vue +2 -1
  447. package/template/apps/web/src/pages/system/components/SystemResourceEditor.vue +11 -2
  448. package/template/apps/web/src/pages/system/components/SystemResourcePage.vue +1 -0
  449. package/template/apps/web/src/pages/system/components/SystemResourcePage.webtest.ts +6 -2
  450. package/template/apps/web/src/pages/system/components/agent-skills/AgentSkillDetailDialog.vue +166 -0
  451. package/template/apps/web/src/pages/system/components/agent-skills/AgentSkillGovernanceActionDialog.vue +51 -0
  452. package/template/apps/web/src/pages/system/components/agent-skills/AgentSkillImportDialog.vue +329 -0
  453. package/template/apps/web/src/pages/system/components/agent-skills/AgentSkillImportDialog.webtest.ts +96 -0
  454. package/template/apps/web/src/pages/system/components/agent-skills/AgentSkillsTable.vue +69 -0
  455. package/template/apps/web/src/pages/system/components/agent-workbench/SessionReplayTimeline.vue +18 -9
  456. package/template/apps/web/src/pages/system/components/agent-workbench/TestRunComposer.vue +66 -34
  457. package/template/apps/web/src/pages/system/components/agent-workbench/ToolCatalogPanel.vue +48 -33
  458. package/template/apps/web/src/pages/system/components/agent-workbench/ToolCatalogPanel.webtest.ts +9 -2
  459. package/template/apps/web/src/pages/system/components/agent-workbench/ToolRuleDetail.vue +23 -16
  460. package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowPresetCatalog.vue +82 -0
  461. package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowPresetCatalog.webtest.ts +57 -0
  462. package/template/apps/web/src/pages/system/components/dictionary-bulk/DictionaryBulkJobDetail.vue +10 -7
  463. package/template/apps/web/src/pages/system/components/user-account/RolePermissionSummary.vue +81 -57
  464. package/template/apps/web/src/pages/system/components/user-account/UserRoleSelector.vue +6 -4
  465. package/template/apps/web/src/pages/system/components/user-account/UserRoleSelector.webtest.ts +20 -4
  466. package/template/apps/web/src/pages/system/composables/useAgentSkillsGovernance.ts +105 -0
  467. package/template/apps/web/src/pages/system/composables/useAgentWorkflowPresets.ts +44 -0
  468. package/template/apps/web/src/pages/system/composables/useDiagnosticLookup.ts +64 -0
  469. package/template/apps/web/src/pages/system/resource-config.ts +9 -0
  470. package/template/apps/web/src/pages/work-orders/WorkOrderListPage.vue +1 -1
  471. package/template/apps/web/src/router/disabled-feature-loading.webtest.ts +78 -0
  472. package/template/apps/web/src/router/error-navigation.ts +3 -1
  473. package/template/apps/web/src/router/error-navigation.webtest.ts +14 -2
  474. package/template/apps/web/src/router/index.ts +11 -55
  475. package/template/apps/web/src/router/manifest-routes.ts +2 -3
  476. package/template/apps/web/src/router/platform-admin-pages.ts +38 -0
  477. package/template/apps/web/src/router/platform-admin-route-bindings.ts +12 -4
  478. package/template/apps/web/src/services/agent-skills-api.ts +55 -0
  479. package/template/apps/web/src/services/agent-workflow-api.ts +12 -0
  480. package/template/apps/web/src/services/diagnostics-api.ts +24 -0
  481. package/template/apps/web/src/services/http.ts +18 -0
  482. package/template/apps/web/src/services/http.webtest.ts +51 -0
  483. package/template/apps/web/src/services/operations-api.ts +4 -0
  484. package/template/apps/web/src/services/platform-settings-api.ts +35 -1
  485. package/template/apps/web/vite.config.ts +47 -2
  486. package/template/deploy/dsh/README.md +5 -0
  487. package/template/deploy/dsh/documents/README.md +9 -0
  488. package/template/deploy/dsh/documents/requirements.in +6 -0
  489. package/template/deploy/dsh/documents/requirements.lock +72 -0
  490. package/template/deploy/environment/windy.environment.example.yaml +53 -0
  491. package/template/docker-compose.yml +27 -11
  492. package/template/docs/adr/0004-embedded-dsh-runtime.md +9 -0
  493. package/template/docs/architecture/agent-admin-workbench-implementation.md +73 -0
  494. package/template/docs/architecture/agent-admin-workbench-plan.md +41 -0
  495. package/template/docs/architecture/agent-harness.md +2 -0
  496. package/template/docs/architecture/agent-runtime-compatibility.md +2 -0
  497. package/template/docs/architecture/agent-workflow.md +8 -0
  498. package/template/docs/architecture/durable-jobs.md +17 -0
  499. package/template/docs/architecture/embedded-dsh-integration.md +44 -0
  500. package/template/docs/development/dsh-plugins.md +55 -0
  501. package/template/docs/development/performance-engineering.md +24 -0
  502. package/template/docs/operations/admin-settings-yaml.md +29 -0
  503. package/template/docs/operations/dsh-agent-migration.md +98 -0
  504. package/template/docs/operations/environment-capabilities.md +185 -0
  505. package/template/docs/platform/agent-production-store.md +5 -78
  506. package/template/docs/platform/agent-runtime-observability.md +2 -0
  507. package/template/docs/platform/agent-runtime.md +2 -0
  508. package/template/docs/platform/agent-skills.md +25 -0
  509. package/template/docs/platform/module-configuration.md +18 -3
  510. package/template/docs/platform/platform-authentication.md +1 -1
  511. package/template/package.json +13 -10
  512. package/template/packages/config/package.json +2 -2
  513. package/template/packages/config/src/definition.ts +14 -4
  514. package/template/packages/config/src/environment-loader.ts +27 -3
  515. package/template/packages/config/src/platform-ai-runtime.test.ts +94 -0
  516. package/template/packages/config/src/platform.ts +5 -2
  517. package/template/packages/database/drizzle/0064_dsh_skills_diagnostics.sql +42 -0
  518. package/template/packages/database/drizzle/0065_durable_job_lease_snapshot_lookup.sql +1 -0
  519. package/template/packages/database/drizzle/0066_agent_source_sequence_bigint.sql +3 -0
  520. package/template/packages/database/drizzle/0067_media_runtime_access.sql +46 -0
  521. package/template/packages/database/drizzle/meta/0064_snapshot.json +15349 -0
  522. package/template/packages/database/drizzle/meta/0065_snapshot.json +15370 -0
  523. package/template/packages/database/drizzle/meta/0066_snapshot.json +15370 -0
  524. package/template/packages/database/drizzle/meta/0067_snapshot.json +15370 -0
  525. package/template/packages/database/drizzle/meta/_journal.json +28 -0
  526. package/template/packages/database/package.json +4 -4
  527. package/template/packages/database/src/schema/agent-session.ts +4 -3
  528. package/template/packages/database/src/schema/agent-skills.ts +65 -0
  529. package/template/packages/database/src/schema/diagnostics.ts +27 -0
  530. package/template/packages/database/src/schema/durable-jobs.ts +4 -0
  531. package/template/packages/database/src/schema/index.ts +10 -0
  532. package/template/packages/database/src/schema-durable-recovery.test.ts +21 -1
  533. package/template/packages/database/src/schema-source-sequence.test.ts +24 -0
  534. package/template/packages/example-work-order/package.json +2 -2
  535. package/template/packages/modules/package.json +1 -1
  536. package/template/packages/modules/src/admin-ui-boundary.test.ts +33 -0
  537. package/template/packages/modules/src/composition.ts +11 -28
  538. package/template/packages/modules/src/manifest.ts +2 -0
  539. package/template/packages/modules/src/menu-composition.ts +24 -0
  540. package/template/packages/modules/src/system-admin-routes.ts +26 -2
  541. package/template/packages/modules/src/system-admin-ui-catalog.ts +23 -11
  542. package/template/packages/modules/src/system-agent-admin-bindings.ts +2 -0
  543. package/template/packages/modules/src/system-agent-admin-menus.ts +20 -0
  544. package/template/packages/modules/src/system-agent-audit-actions.ts +3 -0
  545. package/template/packages/modules/src/system-agent-dsh.ts +119 -0
  546. package/template/packages/modules/src/system-ai-api-bindings.ts +0 -16
  547. package/template/packages/modules/src/system-api-control-plane.ts +9 -1
  548. package/template/packages/modules/src/system-api-permissions.ts +16 -0
  549. package/template/packages/modules/src/system-api-watermark.ts +21 -0
  550. package/template/packages/modules/src/system-audit-actions.ts +14 -1
  551. package/template/packages/modules/src/system-features.ts +25 -2
  552. package/template/packages/modules/src/system-media-api-bindings.ts +97 -0
  553. package/template/packages/modules/src/system-module-audit-selection.ts +27 -0
  554. package/template/packages/modules/src/system-module-catalog.test.ts +13 -6
  555. package/template/packages/modules/src/system-module-catalog.ts +12 -267
  556. package/template/packages/modules/src/system-module-definitions.ts +260 -0
  557. package/template/packages/modules/src/system-modules-access.test.ts +2 -0
  558. package/template/packages/modules/src/system-modules.test.ts +7 -1
  559. package/template/packages/modules/src/system-modules.ts +39 -16
  560. package/template/packages/modules/src/system-permissions.ts +22 -0
  561. package/template/packages/server-sdk/package.json +2 -2
  562. package/template/packages/shared/index.ts +15 -0
  563. package/template/packages/shared/package.json +1 -1
  564. package/template/packages/shared/src/agent-skills.ts +68 -0
  565. package/template/packages/shared/src/agent-workflow-presets.ts +26 -0
  566. package/template/packages/shared/src/diagnostics.ts +13 -0
  567. package/template/packages/shared/src/environment-assessment.ts +68 -0
  568. package/template/packages/shared/src/environment-policy.ts +205 -0
  569. package/template/packages/shared/src/license-console-capabilities.ts +7 -0
  570. package/template/packages/shared/src/license.ts +1 -0
  571. package/template/packages/shared/src/module-configuration.ts +2 -1
  572. package/template/packages/shared/src/rbac.ts +1 -0
  573. package/template/scripts/operations/collect-device-info.py +230 -0
  574. package/template/apps/agent-server/install-python-dependencies.sh +0 -92
  575. package/template/apps/agent-server/pyproject.toml +0 -51
  576. package/template/apps/agent-server/src/southwind_agent_server/__init__.py +0 -5
  577. package/template/apps/agent-server/src/southwind_agent_server/app.py +0 -344
  578. package/template/apps/agent-server/src/southwind_agent_server/approval_resolution.py +0 -30
  579. package/template/apps/agent-server/src/southwind_agent_server/artifact_input.py +0 -153
  580. package/template/apps/agent-server/src/southwind_agent_server/asgi.py +0 -8
  581. package/template/apps/agent-server/src/southwind_agent_server/attempt_context.py +0 -199
  582. package/template/apps/agent-server/src/southwind_agent_server/attempt_context_projection.py +0 -203
  583. package/template/apps/agent-server/src/southwind_agent_server/client_completion_contracts.py +0 -61
  584. package/template/apps/agent-server/src/southwind_agent_server/client_completion_governance.py +0 -82
  585. package/template/apps/agent-server/src/southwind_agent_server/client_completion_routes.py +0 -121
  586. package/template/apps/agent-server/src/southwind_agent_server/client_completion_runtime.py +0 -158
  587. package/template/apps/agent-server/src/southwind_agent_server/config.py +0 -267
  588. package/template/apps/agent-server/src/southwind_agent_server/context_message_digest.py +0 -24
  589. package/template/apps/agent-server/src/southwind_agent_server/context_version_contracts.py +0 -71
  590. package/template/apps/agent-server/src/southwind_agent_server/context_version_port.py +0 -307
  591. package/template/apps/agent-server/src/southwind_agent_server/contracts.py +0 -297
  592. package/template/apps/agent-server/src/southwind_agent_server/deterministic.py +0 -63
  593. package/template/apps/agent-server/src/southwind_agent_server/engine.py +0 -134
  594. package/template/apps/agent-server/src/southwind_agent_server/engine_capacity.py +0 -31
  595. package/template/apps/agent-server/src/southwind_agent_server/engine_identity.py +0 -2
  596. package/template/apps/agent-server/src/southwind_agent_server/fingerprint.py +0 -61
  597. package/template/apps/agent-server/src/southwind_agent_server/health_routes.py +0 -93
  598. package/template/apps/agent-server/src/southwind_agent_server/http_helpers.py +0 -62
  599. package/template/apps/agent-server/src/southwind_agent_server/lease.py +0 -15
  600. package/template/apps/agent-server/src/southwind_agent_server/multimodal.py +0 -76
  601. package/template/apps/agent-server/src/southwind_agent_server/openai_engine.py +0 -329
  602. package/template/apps/agent-server/src/southwind_agent_server/openai_engine_validation.py +0 -165
  603. package/template/apps/agent-server/src/southwind_agent_server/openai_provider.py +0 -345
  604. package/template/apps/agent-server/src/southwind_agent_server/postgres_report_insert.py +0 -37
  605. package/template/apps/agent-server/src/southwind_agent_server/postgres_report_queries.py +0 -235
  606. package/template/apps/agent-server/src/southwind_agent_server/postgres_report_replay.py +0 -44
  607. package/template/apps/agent-server/src/southwind_agent_server/postgres_report_status.py +0 -83
  608. package/template/apps/agent-server/src/southwind_agent_server/postgres_report_store.py +0 -336
  609. package/template/apps/agent-server/src/southwind_agent_server/postgres_report_summary.py +0 -304
  610. package/template/apps/agent-server/src/southwind_agent_server/postgres_store.py +0 -335
  611. package/template/apps/agent-server/src/southwind_agent_server/postgres_store_backend.py +0 -333
  612. package/template/apps/agent-server/src/southwind_agent_server/provider_audit.py +0 -144
  613. package/template/apps/agent-server/src/southwind_agent_server/provider_governance.py +0 -309
  614. package/template/apps/agent-server/src/southwind_agent_server/provider_output_guidance.py +0 -34
  615. package/template/apps/agent-server/src/southwind_agent_server/readiness_pin.py +0 -37
  616. package/template/apps/agent-server/src/southwind_agent_server/report_lifecycle.py +0 -218
  617. package/template/apps/agent-server/src/southwind_agent_server/report_metrics.py +0 -149
  618. package/template/apps/agent-server/src/southwind_agent_server/report_presenter.py +0 -300
  619. package/template/apps/agent-server/src/southwind_agent_server/report_routes.py +0 -132
  620. package/template/apps/agent-server/src/southwind_agent_server/report_store.py +0 -298
  621. package/template/apps/agent-server/src/southwind_agent_server/report_store_protocol.py +0 -75
  622. package/template/apps/agent-server/src/southwind_agent_server/report_types.py +0 -118
  623. package/template/apps/agent-server/src/southwind_agent_server/run_admission.py +0 -64
  624. package/template/apps/agent-server/src/southwind_agent_server/run_capacity.py +0 -59
  625. package/template/apps/agent-server/src/southwind_agent_server/runtime_budget.py +0 -74
  626. package/template/apps/agent-server/src/southwind_agent_server/runtime_compatibility.py +0 -89
  627. package/template/apps/agent-server/src/southwind_agent_server/runtime_factory.py +0 -105
  628. package/template/apps/agent-server/src/southwind_agent_server/runtime_logging.py +0 -57
  629. package/template/apps/agent-server/src/southwind_agent_server/service.py +0 -325
  630. package/template/apps/agent-server/src/southwind_agent_server/service_control.py +0 -64
  631. package/template/apps/agent-server/src/southwind_agent_server/service_errors.py +0 -4
  632. package/template/apps/agent-server/src/southwind_agent_server/service_execution.py +0 -34
  633. package/template/apps/agent-server/src/southwind_agent_server/service_tasks.py +0 -34
  634. package/template/apps/agent-server/src/southwind_agent_server/signal_events.py +0 -53
  635. package/template/apps/agent-server/src/southwind_agent_server/sqlite_catalog.py +0 -118
  636. package/template/apps/agent-server/src/southwind_agent_server/sqlite_errors.py +0 -2
  637. package/template/apps/agent-server/src/southwind_agent_server/sqlite_schema.py +0 -73
  638. package/template/apps/agent-server/src/southwind_agent_server/sqlite_serialization.py +0 -16
  639. package/template/apps/agent-server/src/southwind_agent_server/sqlite_store.py +0 -350
  640. package/template/apps/agent-server/src/southwind_agent_server/sse.py +0 -41
  641. package/template/apps/agent-server/src/southwind_agent_server/store.py +0 -255
  642. package/template/apps/agent-server/src/southwind_agent_server/store_cipher.py +0 -40
  643. package/template/apps/agent-server/src/southwind_agent_server/structured_logging.py +0 -145
  644. package/template/apps/agent-server/src/southwind_agent_server/telemetry.py +0 -93
  645. package/template/apps/agent-server/src/southwind_agent_server/tool_host.py +0 -152
  646. package/template/apps/agent-server/src/southwind_agent_server/trajectory.py +0 -137
  647. package/template/apps/agent-server/src/southwind_agent_server/unavailable_engine.py +0 -58
  648. package/template/apps/agent-server/src/southwind_agent_server/vision_probe.py +0 -87
  649. package/template/apps/agent-server/src/southwind_agent_server/vision_requirement.py +0 -28
  650. package/template/apps/agent-server/src/southwind_agent_server/vlm_readiness.py +0 -247
  651. package/template/apps/agent-server/tests/__init__.py +0 -1
  652. package/template/apps/agent-server/tests/openai_provider_test_support.py +0 -131
  653. package/template/apps/agent-server/tests/test_api.py +0 -305
  654. package/template/apps/agent-server/tests/test_artifact_input.py +0 -110
  655. package/template/apps/agent-server/tests/test_client_completion.py +0 -230
  656. package/template/apps/agent-server/tests/test_config.py +0 -106
  657. package/template/apps/agent-server/tests/test_fingerprint.py +0 -10
  658. package/template/apps/agent-server/tests/test_multimodal.py +0 -81
  659. package/template/apps/agent-server/tests/test_openai_provider.py +0 -320
  660. package/template/apps/agent-server/tests/test_postgres_report_status.py +0 -59
  661. package/template/apps/agent-server/tests/test_postgres_report_summary.py +0 -298
  662. package/template/apps/agent-server/tests/test_postgres_store.py +0 -135
  663. package/template/apps/agent-server/tests/test_provider_attempt_reporting.py +0 -140
  664. package/template/apps/agent-server/tests/test_provider_governance.py +0 -276
  665. package/template/apps/agent-server/tests/test_report_attempt_lifecycle.py +0 -126
  666. package/template/apps/agent-server/tests/test_report_resilience.py +0 -183
  667. package/template/apps/agent-server/tests/test_report_routes.py +0 -143
  668. package/template/apps/agent-server/tests/test_report_store.py +0 -347
  669. package/template/apps/agent-server/tests/test_report_summary_parity.py +0 -116
  670. package/template/apps/agent-server/tests/test_report_terminal_sync.py +0 -177
  671. package/template/apps/agent-server/tests/test_run_capacity.py +0 -112
  672. package/template/apps/agent-server/tests/test_run_operational_logging.py +0 -114
  673. package/template/apps/agent-server/tests/test_runtime_compatibility.py +0 -119
  674. package/template/apps/agent-server/tests/test_runtime_factory_readiness.py +0 -52
  675. package/template/apps/agent-server/tests/test_sqlite_store.py +0 -182
  676. package/template/apps/agent-server/tests/test_structured_logging.py +0 -142
  677. package/template/apps/agent-server/tests/test_telemetry.py +0 -25
  678. package/template/apps/agent-server/tests/test_tool_approval.py +0 -28
  679. package/template/apps/agent-server/tests/test_tool_structured_output.py +0 -347
  680. package/template/apps/agent-server/tests/test_trajectory.py +0 -91
  681. package/template/apps/agent-server/tests/test_vision_readiness_enforcement.py +0 -72
  682. package/template/apps/agent-server/tests/test_vlm_readiness.py +0 -106
  683. package/template/apps/agent-server/uv.lock +0 -831
  684. package/template/apps/server/src/agent/module-ai-port-factory.ts +0 -41
  685. /package/template/apps/server/src/{agent → ai-runtime-security}/execution-grants.ts +0 -0
  686. /package/template/apps/server/src/{agent → ai-runtime-security}/idempotency-key.test.ts +0 -0
  687. /package/template/apps/server/src/{agent → ai-runtime-security}/idempotency-key.ts +0 -0
  688. /package/template/apps/server/src/{agent → ai-runtime-security}/provider-input-governance.test.ts +0 -0
  689. /package/template/apps/server/src/{agent → ai-runtime-security}/provider-input-governance.ts +0 -0
  690. /package/template/apps/server/src/{agent → media-runtime}/required-environment.ts +0 -0
  691. /package/template/apps/server/src/{agent → media-runtime}/runtime-readiness-sources.test.ts +0 -0
@@ -0,0 +1,185 @@
1
+ # 环境能力评估与构建预设
2
+
3
+ Windy 将交付内容、运行时功能开关和设备能力分开处理。没有 GPU 时,普通业务功能与 CPU
4
+ 可执行的任务仍可保留;模型或 Adapter 是否支持 CPU,需要检查实际实现与验收证据。
5
+ 环境评估只给出建议,不替管理员自动关闭功能。评估状态 `available` 只表示声明条件
6
+ 满足,不表示模型、Provider 或业务已实测可用。
7
+
8
+ 可直接复制[中文环境预设模板](../../deploy/environment/windy.environment.example.yaml),
9
+ 按实际模块与业务能力修改;模板保留共享 Runtime 的当前依赖边界。
10
+
11
+ ## 首次生成的 YAML / JSON 入口
12
+
13
+ ```sh
14
+ bunx create-windy my-app --environment-profile ./windy.environment.yaml --yes
15
+ ```
16
+
17
+ `--environment-profile` 同时接受 YAML 与 JSON,严格校验结构与模块名;输入及生成后的策略
18
+ 均不超过 128 KiB,与 Server 读取上限一致。不与 `--module`、
19
+ `--all-modules`、`--no-optional-modules` 混用。它不改变原有 `--profile private-enterprise`
20
+ 的部署档位语义。`build.modules` 走现有模块依赖解析与生成裁剪流程:必需模块及依赖自动
21
+ 补齐,未选择模块按分发清单裁剪源码、依赖、路由绑定与数据库对象。
22
+
23
+ 以下示例生成不需要 Agent 或 Document Runtime 的基础项目;它不是“带 CPU OCR”预设:
24
+
25
+ ```yaml
26
+ schemaVersion: 1
27
+ build:
28
+ modules:
29
+ - system
30
+ - system.identity
31
+ - system.configuration
32
+ - system.operations
33
+ # 环境建议单独维护,不参与模块裁剪,也不自动开关 Feature。
34
+ features: []
35
+ ```
36
+
37
+ 生成器始终发放带中文注释的 `windy.environment.yaml`,其中 `build.modules` 记录实际解析后的
38
+ 模块集合。它由项目所有者维护,后续模板升级保留客户文件;原有生成版本与选项仍由
39
+ `.windy/generation.json` 记录。修改已有项目的 YAML 不会删除已经构建的模块或安装中的
40
+ 数据库对象;需按该项目正式的生成、升级或交付流程处理。
41
+
42
+ ## 启动运行时
43
+
44
+ 配置 `runtime.agent`、`runtime.document`、`runtime.speech` 和 `runtime.embedding` 可分别
45
+ 启停 Server 装配,修改文件后重启 Server 生效。省略的开关保留现有装配行为。
46
+ `PLATFORM_ENABLE_AI_RUNTIME` 仍是总开关,`runtime.*: false` 对应的 Feature 会在 Access
47
+ Snapshot 中关闭,即使数据库 Feature 配置为开启。格式无效的环境文件会阻止 Server 启动。若总开关关闭,YAML 显式启用任一运行时也会阻止启动,避免容器正常启动但业务能力静默不可用。
48
+
49
+ 纯 CPU OCR 的 Server 配置为 `agent: false`、`document: true`,并分别选择 Speech 和
50
+ Embedding。仍须交付包含媒体代码的模块,配置 Document 端点和共享 Artifact 凭据。
51
+ 生成时可通过 `build.runtimes` 分别省去独立运行时应用源码、Compose 服务、镜像构建入口与专用卷。
52
+ `build.runtimes.*: false` 与 `runtime.*: true` 冲突时拒绝配置。显式启用且已交付的运行时
53
+ 会进入默认 Compose 启动集合,并默认开启共享运行时总开关。生成的 Compose 默认以只读方式挂载环境文件,即使首次生成
54
+ 未显式提供预设。生成后修改 YAML
55
+ 会影响 Server 重启后的装配,Compose 服务集合则由生成时的配置决定。生成时写入的 Server
56
+ 交付上限会拒绝 YAML 尝试启用已裁剪的运行时。裁掉 Agent 时,生成器也会移除 Agent 专属 Admin
57
+ 页面源码、路由和菜单声明。媒体和公共 Server 装配由 `system.media-runtime` 提供。
58
+
59
+ 使用环境预设生成项目时,初始预设写入 Project Lock。后续升级用该快照重建来源和目标模板,
60
+ 保留已裁剪的运行时应用,客户可继续维护自己的运行时 YAML。旧版 Agent 项目在解析目标模块
61
+ 依赖时会补齐 `system.media-runtime`。迁移会一次性复制原来能调用媒体 API 的角色授权,
62
+ 并沿用旧 Agent Feature 的启用、可见性和许可版本限制。已有媒体 Feature 记录优先;
63
+ 升级完成后可分别管理三个媒体 Feature 和对应角色授权。
64
+
65
+ ## 运行时评估建议
66
+
67
+ Server 通过 `WINDY_ENVIRONMENT_PROFILE_FILE` 显式指定策略文件。容器部署需将文件只读
68
+ 挂载到容器中,并配置容器内路径;只修改宿主机路径或生成文件,不会自动接通容器。
69
+ 宿主诊断报告由 `WINDY_HOST_DIAGNOSTICS_FILE` 指定,同样只读挂载;服务端读取报告,
70
+ 不会自行提权执行宿主命令。报告缺失或过期时相关环境结论保持 `unknown`,不能假定宿主
71
+ 没有 GPU,亦不能用容器自身的资源信息冒充宿主实况。
72
+
73
+ `build.modules` 在运行时仅是交付记录,不能用它替代当前 Manifest、安装清单或权限判断。
74
+
75
+ `features` 的每项针对一个真实 Manifest Feature,使用以下字段:
76
+
77
+ | 字段 | 中文语义 |
78
+ | ---------------------------------------------- | ------------------------------------------------------------------------------ |
79
+ | `key`、`title` | 正式 Feature Key 与说明名称 |
80
+ | `execution` | `none` 无执行资源要求、`cpu` CPU 执行、`local-gpu` 本地 GPU、`remote` 远程服务 |
81
+ | `recommendedEnabled` | 管理员可评估的启停建议,不直接改写已有开关 |
82
+ | `supportedPlatforms`、`supportedArchitectures` | 该实现实际支持的操作系统/架构范围;应依据软件适配证据填写 |
83
+ | `minMemoryGiB` | 已知最低内存要求;不能用它承诺延迟或吞吐 |
84
+ | `requiredEnvironmentKeys` | 必需配置的变量名,仅检查配置条件,不在报告中公开值 |
85
+
86
+ 填写 `features` 前核对当前模块是否已交付、Feature 是否真实注册、软件是否适配以及服务是否
87
+ 就绪。设备探测结果不能替代模型初始化、端点鉴权、业务输出或质量验证;未知状态应保留
88
+ 为待确认。报告与建议供管理员判断,既有 RBAC、License、Scope 和业务 Guard 继续生效。
89
+
90
+ ## 宿主诊断报告
91
+
92
+ 在需要评估的宿主机运行随模板交付的采集脚本,报告只包含有界诊断结果:
93
+
94
+ ```sh
95
+ umask 077
96
+ mkdir -p .local/diagnostics
97
+ python3 scripts/operations/collect-device-info.py > .local/diagnostics/host.json
98
+ # 可选:补充具体服务状态与已安装发布标识
99
+ python3 scripts/operations/collect-device-info.py \
100
+ --systemd-unit windy.service --manifest /opt/windy/manifest.json \
101
+ > .local/diagnostics/host.json
102
+ ```
103
+
104
+ 报告采用新的结构化 JSON 协议,不直接导入历史 TXT 诊断文本。可选 manifest 只读取
105
+ `releaseId`、`gitSha`、`platform` 白名单字段。采集器不安装软件、不重启服务、不读取应用
106
+ 凭据;缺少工具会记录缺失状态。报告可能包含
107
+ 主机名、网络地址、磁盘挂载和容器名称,应保存在运维可控目录,不纳入 Git 或公开附件。
108
+ 服务端评估和页面展示仍受运维权限控制。
109
+
110
+ 以下为添加到现有 Server 服务的只读挂载示例,路径与文件名由部署方确认:
111
+
112
+ ```yaml
113
+ services:
114
+ server:
115
+ environment:
116
+ WINDY_ENVIRONMENT_PROFILE_FILE: /app/diagnostics/windy.environment.yaml
117
+ WINDY_HOST_DIAGNOSTICS_FILE: /app/diagnostics/host.json
118
+ volumes:
119
+ - ./windy.environment.yaml:/app/diagnostics/windy.environment.yaml:ro
120
+ - ./.local/diagnostics/host.json:/app/diagnostics/host.json:ro
121
+ ```
122
+
123
+ 先生成报告再启动容器,避免 Docker 把缺失文件路径创建为目录。后续刷新报告后重新读取
124
+ 运维快照;报告是否新鲜由服务端校验,旧报告不能当作当前设备状态。
125
+
126
+ ## CPU OCR、Agent 与病毒扫描的边界
127
+
128
+ Agent、Document、Speech 与 Embedding 共用的 Provider 输入治理、执行凭据、内部令牌校验
129
+ 和幂等键位于 `apps/server/src/ai-runtime-security/`。Document、Speech 与 Embedding 的远端连接和
130
+ 路由装配位于 `apps/server/src/media-runtime/composition.ts`。这两部分当前仍随现有模块交付,
131
+ 共享 Artifact、媒体 readiness 与业务端口通过 `media-runtime/shared-composition.ts` 装配,
132
+ 当 YAML 关闭 Agent 时,Server 直接装配媒体和共享端口,跳过 Agent Host、工具注册与 MCP。
133
+
134
+ `system.media-runtime` 可单独选择,为 Document、Speech、Embedding 与公共 Artifact 提供
135
+ Manifest、Server 装配和数据库归属。选择 `system.agent` 时,生成器会自动补齐这个依赖。
136
+ 媒体直接 API 使用各自的 Feature。公共文件入口使用
137
+ `system.ai-artifact`,仍要求内部令牌、文件引用和当前对象授权。读取 Agent 截图另需启用
138
+ `system.agent`。
139
+
140
+ 病毒扫描通过独立的 `antivirus.packaged` 和 `antivirus.enabled` 声明,与 AI 运行时和 GPU
141
+ 无关。Windy 通用模板默认两项均为 `false`,也允许省略此段以沿用项目原有配置。
142
+ 通用生成器只交付平台能力,若请求 `packaged: true` 会明确拒绝。
143
+
144
+ 需要扫描的项目负责打包扫描器、病毒库及更新服务,并在项目拥有的
145
+ `apps/server/src/app/antivirus-composition.ts` 中装配 `ProjectAntivirusBinding`。
146
+ 该绑定须接入项目实际的入库流程。Server 启动时,`enabled: true` 传递 `required`,
147
+ 扫描器必须完成就绪检查并返回 `ready`,否则拒绝启动。交付声明必须与项目实际装配一致。
148
+ 已打包扫描器、但暂时停用时使用 `packaged: true`、`enabled: false`,Server 传递
149
+ `disabled`,项目应停止扫描并保留原有文件解析流程。只改 YAML 无法安装扫描器或病毒库。
150
+
151
+ 若扫描器是独立 Worker,项目的启动器须用同一份环境预设选择 Worker 模式,并在 Worker
152
+ 重启后再启动 Server。对于只在启动时读取扫描模式的 Worker,项目绑定应核对 Worker 实际
153
+ 行为和就绪状态;修改 Server 自身的环境变量不会切换已经运行的 Worker。
154
+ 验收时通过实际入库接口送入干净文件与匹配测试签名的合成文件,核对启用时的拦截结果和
155
+ 停用时的跳过记录,并确认停用扫描后仍可正常解析。
156
+
157
+ 管理员确认启停时,记录受影响的业务功能、当前证据和选择;已有用户授权可直接沿用。
158
+ 因未知设备、暂时探测失败或未验证性能而自动全局停用 AI,会误伤 CPU 或远程服务能力。
159
+ 回滚通过恢复此前经过确认的功能设置完成;构建时移除的能力需要重新交付,运行时开关
160
+ 无法补回缺失代码。
161
+
162
+ ## Skill 分发与验证层级
163
+
164
+ 开发约定由根目录 `.agents/skills/windy-business-module/SKILL.md` 维护。create-windy 的
165
+ `template-manifest.ts` 将该目录纳入模板,`template:sync` 从已提交的 Git HEAD 生成发布副本;
166
+ 不维护第二份容易漂移的手写 Skill。本次新增的环境适配约定随正式模板分发。
167
+
168
+ 普通本地修改只运行项目允许的静态检查。参数、YAML/JSON 校验、依赖闭包、裁剪结果和
169
+ 客户文件保留由合并候选测试覆盖,完整生成、构建与 pack consumer 属于发版门禁。
170
+ 模板被发放不代表目标主机或业务质量已通过验收。
171
+
172
+ ### 业务能力开关
173
+
174
+ 业务页面和服务入口使用 Access Snapshot 中对应的 Feature Key。拥有业务权限的调用方仍须通过目标
175
+ Operation 自身的权限和数据范围校验。
176
+
177
+ | 能力 | Feature Key | 平台直接 API 权限 |
178
+ | -------------- | ------------------ | ----------------------- |
179
+ | Agent | `system.agent` | `system.agent.read` |
180
+ | Document / OCR | `system.document` | `system.document.read` |
181
+ | Speech | `system.speech` | `system.speech.read` |
182
+ | Embedding | `system.embedding` | `system.embedding.read` |
183
+
184
+ 自定义角色调用媒体直接 API 时需要对应的新权限。当前 Feature 控制业务入口和 API 访问,
185
+ 生成裁剪仍需独立模块边界。
@@ -1,82 +1,9 @@
1
- # Agent 生产 Store、不可变 Release 与评估追踪
1
+ # Agent 运行存储
2
2
 
3
- ## 目标与边界
3
+ 2026-10-29。Agent Server 已由Node/DSH接管。canonical运行、SSE事件、Provider审计与原生用户工作区使用Agent专用本地存储;默认数据库为`AGENT_RUNTIME_DATABASE_PATH=/app/data/agent/embedded-dsh.sqlite`。
4
4
 
5
- Agent Runtime 的 PostgreSQL Store 是多副本生产默认实现。它只保存 Run
6
- 执行事实、加密后的调用/事件/结果、Release 快照和评估结果,不保存业务会话、消息、
7
- 标题、案件范围或归档策略。业务事实仍由业务模块持久化。
5
+ 当前只支持单副本,不承诺旧Python PostgreSQL Store模式或跨副本容量/HA。旧`AGENT_RUN_STORE_PATH`、`AGENT_DATABASE_URL`、`AI_PROVIDER_AUDIT_STORE_PATH`不能作为新实现已启用的证据。
8
6
 
9
- SQLite Store 只用于单副本本地开发和确定性验证;未配置
10
- `AGENT_DATABASE_URL` 且配置了 `AGENT_RUN_STORE_PATH` 时才启用。生产部署不得用
11
- 共享文件系统模拟多副本 SQLite。
7
+ 产品PostgreSQL继续保存业务长期Session/Memory/Workflow、授权、运行绑定与报表治理事实;DSH存储不替代这些职责。内部结果仍使用Host声明的加密策略,普通历史读取不泄露internal输出。
12
8
 
13
- ## 状态与反馈闭环
14
-
15
- 同一个 `Idempotency-Key` 只能对应同一请求指纹。Run 的 canonical event 使用
16
- `run_id + sequence` 唯一键,读取接口按 cursor 重放;终态后追加、完成和取消都是
17
- 幂等操作。事件或输出超过上限时,Store 写入唯一的 `run.failed`,避免运行态无限
18
- 增长。
19
-
20
- 每个工作副本领取 30 秒租约,并每 10 秒续租。租约丢失会中止当前执行,保留加密
21
- 调用快照供其他副本接管;恢复轮询使用行锁和 `skip locked` 防止重复领取。终态数据
22
- 按 TTL 清理,运行中数据不会被 TTL 清理。
23
-
24
- ## 不可变 Release 与回滚
25
-
26
- 每次 Run 固定以下坐标:
27
-
28
- - Operation 与模块版本;
29
- - Workflow、Prompt 和模型 Route 版本;
30
- - Tool/输出 Schema 摘要;
31
- - Manifest 摘要。
32
-
33
- 这些坐标生成稳定的 `releaseId`。同一 `releaseId` 只能对应同一快照,冲突时
34
- fail closed,不能原地修改。业务模块通过
35
- `ModuleAiOperationHandlerRegistration.release` 显式声明 Workflow、Prompt 和
36
- Route 版本;未声明时使用模块版本。
37
-
38
- 回滚不是修改历史 Release,而是重新部署此前的模块/注册版本。旧 Release 仍保留,
39
- 新 Run 会固定到回滚后的旧坐标,历史 Run、评估和审计关联不会被改写。
40
-
41
- ## 评估、用量、Attempt、审计和 Trace
42
-
43
- `POST /api/agent/evaluations` 仅接受内部 Token,可按 Release、评估集 Key 和评估集
44
- 版本幂等记录指标;同一坐标提交不同结果会拒绝。`usage.reported` 作为加密 canonical
45
- event 保存。Provider attempt 审计以 `runId + attempt` 唯一保存,并可通过 Run 关联
46
- Release、usage 和平台 Audit。
47
-
48
- 平台将请求关联值哈希为 128 位 Trace ID。Agent Runtime 用它建立 OTel 父 Trace,
49
- Span 只包含 Run ID、Operation Key、Release ID 和终态,不写 Prompt、业务输入、
50
- 模型输出、Tool 参数、Actor 或 Secret。配置
51
- `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` 后启用 OTLP/HTTP 导出,认证头由
52
- `OTEL_EXPORTER_OTLP_HEADERS` 注入。
53
-
54
- ## 运维配置
55
-
56
- 生产 Agent profile 必须配置:
57
-
58
- ```dotenv
59
- AGENT_DATABASE_URL=postgresql://...
60
- AGENT_RUN_ENCRYPTION_SECRET=至少32字节随机值
61
- AGENT_SERVER_INTERNAL_TOKEN=随机内部令牌
62
- ```
63
-
64
- 可选配置:
65
-
66
- ```dotenv
67
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://collector.example/v1/traces
68
- OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer%20...
69
- ```
70
-
71
- 加密密钥缺失或不足 32 字节时 Runtime 拒绝启动。数据库迁移必须先于 Agent Server
72
- 启动。Provider attempt 的独立审计 Store 仍按
73
- `AI_PROVIDER_AUDIT_RETENTION_DAYS` 执行留存;不可把它与业务日志混用。
74
-
75
- ## 故障与恢复
76
-
77
- - PostgreSQL 不可用:启动 fail closed;运行中的副本停止续租,不继续产生副作用。
78
- - 副本退出:租约过期后由其他副本恢复加密调用,不创建新 Run。
79
- - OTLP 不可用:BatchSpanProcessor 按 OTel 导出策略处理,不向业务响应暴露 Collector
80
- 细节;Run Store 与平台 Audit 仍是业务审计事实。
81
- - Release 快照冲突、评估结果漂移或幂等键漂移:稳定拒绝,要求修正发布输入。
82
- - 超过容量、事件数或输出大小:写入或返回有界失败,不允许无界降级。
9
+ 备份时协调停止Agent写入,保存SQLite主文件及WAL一致边界和原生HOME。采用新数据路径并允许旧Agent专用数据重置;业务数据库和文件必须保留。具体切换与回退见[迁移运维](../operations/dsh-agent-migration.md)。
@@ -1,5 +1,7 @@
1
1
  # AI Runtime 用量与运行报表
2
2
 
3
+ > 2026-10-29:执行层现由[内置DSH](../architecture/embedded-dsh-integration.md)接管。下文涉及Python Direct Engine、旧安装/存储及OTEL配置的内容属于历史实现;当前启动、配置与限制以[迁移运维](../operations/dsh-agent-migration.md)为准。canonical API、业务长期Session和治理契约继续有效。
4
+
3
5
  `system.ai-runtime` 为 `system.agent` 提供运行事实、模型用量和缓存覆盖的管理面。它读取
4
6
  canonical Agent Run 与每次 Provider Attempt 的独立报表投影,不把管理报表变成新的
5
7
  执行入口,也不以报表写入结果改写 canonical Run 终态。
@@ -1,5 +1,7 @@
1
1
  # Agent Runtime 接入
2
2
 
3
+ > 2026-10-29:执行层现由[内置DSH](../architecture/embedded-dsh-integration.md)接管。下文涉及Python Direct Engine、旧安装/存储及OTEL配置的内容属于历史实现;当前启动、配置与限制以[迁移运维](../operations/dsh-agent-migration.md)为准。canonical API、业务长期Session和治理契约继续有效。
4
+
3
5
  ## 当前基线
4
6
 
5
7
  Windy 的服务端 Agent Runtime 由独立 Python Agent Server 承载,生产默认 Engine 是
@@ -0,0 +1,25 @@
1
+ # DSH 技能与治理
2
+
3
+ 技能是可审查的工作方法和文件包,不授予工具、身份或数据权限。Windy后台治理DSH `SKILL.md`/ZIP,不依赖旧Agent Code任务或脚本执行器。
4
+
5
+ ## 管理与运行
6
+
7
+ 后台支持目录、详情、全部版本、共享范围、依赖、导入发布、停用和回滚。范围包括本人、部门和租户;读写均由Host构造的当前Scope约束。平台内置“平台工具查询”提供非案件示例;启动初始化不会覆盖已治理的后续版本或停用状态。
8
+
9
+ - `GET /api/agent/skills`、`/:key`、`/:key/versions`:当前可读目录、正文及历史。
10
+ - `POST /api/agent/skills`:导入SKILL.md或ZIP并发布新版本。
11
+ - `POST /api/agent/skills/:key/disable|rollback`:停用或发布恢复历史内容的新版本。
12
+ - 写请求必须携带`idempotency-key`和`expectedVersion`;回滚另携带目标`version`。正文类型由共享DTO约束。
13
+ - `GET /api/agent/workbench/skills`:仅供当前原生身份读取可执行的已发布包;不授予管理权限。
14
+
15
+ Feature是`system.agent-skill`,权限是`.read`、`.manage`、`.execute`。工具依赖必须与已注册工具的Feature/Permission一致,并逐次检查当前可用性。
16
+
17
+ 版本、包内容和幂等回执使用Repository+Drizzle持久化。变更先形成待审计回执,关键审计成功后才向运行时公开;重复请求复用回执,摘要漂移或版本竞争返回冲突。启动恢复未完成审计,避免崩溃后把未审计版本暴露给模型。读取审计只保存种类、Key、版本或数量,不保存技能正文。
18
+
19
+ ## 文件包与编辑
20
+
21
+ SKILL.md必须是有效UTF-8,包含唯一YAML头的name、description和非空正文。ZIP有归档大小、展开大小、文件数和单文件上限;拒绝目录穿越、重复路径、链接、特殊文件、多个技能根和不受控YAML引用。具体上限以共享校验器和界面反馈为准。
22
+
23
+ 导入失败保留当前输入,保存期间阻止重复提交。关闭编辑容器、切换路由与刷新前按真实编辑基线确认,成功后才清理未保存状态。
24
+
25
+ 原生工作台的个人技能继续保存在当前工作区`.dsh/skills`。个人导入不产生组织发布身份。平台发布技能通过DSH公开Provider提供;每次发现/读取重新授权、比较版本摘要,附件按用户只读物化,停用或回滚撤下旧目录。已经发送给模型的历史上下文不能据此追溯消除。
@@ -25,6 +25,21 @@
25
25
 
26
26
  unknown 检查只作用于 Definition 明确拥有的 prefix 或 exact key,避免把操作系统、Bun、测试工具或其它服务环境变量误判为平台配置。
27
27
 
28
+ ## 共享 AI Runtime 开关
29
+
30
+ 推荐环境变量为 `PLATFORM_ENABLE_AI_RUNTIME`,控制共享 AI Runtime 基础设施,包含 CPU OCR
31
+ 所需的 Document Runtime;它不代表已提供 GPU、大模型或 Copilot,也不是构建功能预设。
32
+ 内部逻辑字段保持 `enableAI`,不迁移已有配置版本。
33
+
34
+ 旧变量 `PLATFORM_ENABLE_AI` 作为兼容别名继续读取。只配置其中之一即可;进程环境同时包含两者时必须
35
+ 解析为相同布尔值,否则启动返回 `CONFIG_INVALID_VALUE`(字段 `enableAI`),不静默选择
36
+ 优先级。两者均未配置时仍默认 `false`;空值、非法值和拼错的变量名仍拒绝。Compose
37
+ 先读取新名称,未设置时回退旧名称,只向容器传新名称;迁移 `.env` 时删除旧名称以避免歧义。已有只配置旧名的安装不因模板升级被关闭。
38
+
39
+ 环境别名显式登记在 Definition,严格白名单同时识别新旧名;当前别名仅支持非 Secret
40
+ 字段,避免改变 SecretResolver 的引用边界。该开关保留共享基础设施,具体业务功能仍由
41
+ 模块装配、Manifest Feature、RBAC、License 与 Scope 判定。
42
+
28
43
  ## SecretRef 与 SecretResolver
29
44
 
30
45
  Secret 配置分成引用和运行时值两层:
@@ -66,12 +81,12 @@ handle/connection/purpose,业务模块看不到物理 locator。
66
81
 
67
82
  当前 `platform.runtime` 白名单包括:
68
83
 
69
- - `enableAI`:更新 foundation 平台能力投影;
84
+ - `enableAI`:重启后装配或停用 AI 与 Agent Runtime,并同步管理面「AI 与 Agent」分组与页面准入;
70
85
  - `cache.healthTimeoutMs`:后续 Redis 探活按最新值创建 probe。
71
86
  - `security.sessionTtlSeconds`:即时影响新签发会话,已有会话保持原过期时间;
72
87
  - `security.passwordMinLength/passwordMaxLength`:即时影响 Argon2 密码修改、重置校验和密码页服务端策略;
73
- - `storage.bulkDataMaxByteSize/storage.brandingLogoMaxByteSize`:即时影响后续上传会话;
74
- - `regional.timeZone`:即时影响公共平台设置投影和 Web 后续日期格式化;
88
+ - `storage.bulkDataMaxByteSize/storage.brandingLogoMaxByteSize`:即时影响后续上传会话。Logo 上限以字节保存,界面同时显示易读的换算值,默认 5 MiB(5,242,880 字节);
89
+ - `regional.timeZone`:即时影响公共平台设置投影和 Web 后续日期格式化。界面通过下拉选择 IANA 时区,显示其标识和当前 UTC 偏移;
75
90
  - `mail.enabled/host/port/secure/fromAddress/connectTimeoutMs`:保存为
76
91
  `pending-restart`,下次 Server 启动后进入 typed runtime config。
77
92
 
@@ -36,7 +36,7 @@ POST /api/auth/users/:id/password
36
36
  - `POST /auth/sessions/revoke-all` 默认只吊销本人其它会话并保留当前会话,响应返回吊销数量以及当前会话是否保留。只有显式提交 `{ "includeCurrent": true }` 才会吊销包括当前会话在内的全部本人会话并清除 Cookie;客户端不能提交目标用户 ID。
37
37
  - `GET /auth/login-events` 返回当前 Session Actor 最近 20 条登录成功/失败事件。查询条件固定为服务端 Actor,客户端即使提交 `actorId` 也不能读取他人的事件;响应只保留结果、时间、IP、User-Agent 和稳定失败原因,不暴露审计 Actor 或目标账号字段。未知账号登录失败继续归属匿名 Actor,不能借该接口探测账号是否存在。
38
38
  - 只有具备 `system.user.manage` 权限的用户可以重置密码。接口接收 `password`,服务端生成 Argon2id hash;通用用户 CRUD 不读写或返回 `password_hash`。重置后账号进入 `must-change-password`,`password_changed_at` 保持空值,并立即吊销该用户全部活跃会话。
39
- - 已认证用户通过 `POST /api/auth/password/change` 提交当前密码和新密码。服务端固定使用 Session Actor 作为目标用户,不接受客户端 `userId`;校验当前密码、拒绝复用当前密码,并在成功后把状态恢复为 `active`、记录 `password_changed_at`。成功改密会吊销包括当前会话在内的全部会话、清除 Cookie,用户必须用新密码重新登录。
39
+ - 用户可从「个人设置 → 登录密码 → 修改密码」发起改密。已认证用户通过 `POST /api/auth/password/change` 提交当前密码和新密码。服务端固定使用 Session Actor 作为目标用户,不接受客户端 `userId`;校验当前密码、拒绝复用当前密码,并在成功后把状态恢复为 `active`、记录 `password_changed_at`。成功改密会吊销包括当前会话在内的全部会话、清除 Cookie,用户必须用新密码重新登录。
40
40
 
41
41
  登录成功、登录失败、退出、会话吊销、密码更新和越权拒绝都会写入审计。审计只记录用户、Session ID、结果和稳定原因,不记录明文密码、Bearer Token 或 Cookie。
42
42
 
@@ -21,6 +21,7 @@
21
21
  "speech:pins": "bun run scripts/provision-speech-readiness.ts",
22
22
  "dev:embedding": "PLATFORM_ENABLE_AI=true EMBEDDING_SERVER_URL=http://embedding-server:8092 docker compose --profile agent --profile embedding up --build",
23
23
  "dev:search": "OPENSEARCH_URL=http://opensearch:9200 docker compose --profile search up --build",
24
+ "dev:gateway": "bun run --cwd apps/windy-gateway start",
24
25
  "dev:license": "bun run --cwd apps/license dev",
25
26
  "dev:license:docker": "docker compose --profile license up license",
26
27
  "dev:signing": "bun run --cwd apps/signing-service dev",
@@ -58,15 +59,17 @@
58
59
  "release:candidate": "bun run scripts/release-candidate.ts",
59
60
  "release:verify:full": "bun run scripts/release-verify.ts --full",
60
61
  "test:packages:pack": "bun run scripts/platform-package-release.ts",
61
- "test:agent": "uv run --directory apps/agent-server pytest",
62
+ "test:agent": "bun run --cwd apps/agent-server test",
62
63
  "test:document": "uv run --directory apps/document-server pytest",
63
64
  "test:speech": "uv run --directory apps/speech-server pytest",
64
65
  "test:embedding": "uv run --directory apps/embedding-server pytest",
65
- "check:agent": "uv run --directory apps/agent-server ruff check . && uv run --directory apps/agent-server ruff format --check . && uv run --directory apps/agent-server mypy",
66
+ "check:agent": "bun run --cwd apps/agent-server typecheck",
66
67
  "check:document": "uv run --directory apps/document-server ruff check . && uv run --directory apps/document-server ruff format --check . && uv run --directory apps/document-server mypy",
67
68
  "check:speech": "uv run --directory apps/speech-server ruff check . && uv run --directory apps/speech-server ruff format --check . && uv run --directory apps/speech-server mypy",
68
69
  "check:embedding": "uv run --directory apps/embedding-server ruff check . && uv run --directory apps/embedding-server ruff format --check . && uv run --directory apps/embedding-server mypy",
69
- "typecheck": "bun run --cwd apps/web typecheck && bun run --cwd apps/server typecheck && bun run --cwd apps/license typecheck && bun run --cwd apps/signing-service typecheck && bun run --cwd packages/ai-client typecheck && bun run --cwd packages/license-sdk typecheck && bun run --cwd packages/jobs typecheck && bun run --cwd packages/server-sdk typecheck && bun run --cwd packages/storage typecheck && bun run --cwd packages/database typecheck && bun run --cwd packages/crud-generator typecheck && bun run --cwd packages/delivery typecheck && bun run --cwd packages/create-windy typecheck",
70
+ "typecheck:quality": "tsc --noEmit --project scripts/quality/tsconfig.json",
71
+ "typecheck:affected": "bun run scripts/typecheck-affected.ts",
72
+ "typecheck": "bun run --cwd apps/web typecheck && bun run --cwd apps/server typecheck && bun run --cwd apps/license typecheck && bun run --cwd apps/signing-service typecheck && bun run --cwd packages/ai-client typecheck && bun run --cwd packages/license-sdk typecheck && bun run --cwd packages/jobs typecheck && bun run --cwd packages/server-sdk typecheck && bun run --cwd packages/storage typecheck && bun run --cwd packages/database typecheck && bun run --cwd packages/crud-generator typecheck && bun run --cwd packages/delivery typecheck && bun run --cwd packages/create-windy typecheck && bun run --cwd apps/agent-server typecheck && bun run --cwd apps/windy-gateway typecheck && bun run --cwd packages/model-gateway typecheck && bun run typecheck:quality",
70
73
  "lint": "oxlint .",
71
74
  "format": "oxfmt",
72
75
  "check:static": "bun run lint && bun run typecheck && bun run check:agent && bun run check:document && bun run check:speech && bun run check:embedding",
@@ -81,15 +84,15 @@
81
84
  ]
82
85
  },
83
86
  "devDependencies": {
84
- "@types/bun": "^1.3.14",
85
- "@types/pg": "^8.20.0",
86
- "drizzle-kit": "^0.31.10",
87
- "drizzle-orm": "^0.45.2",
87
+ "@types/bun": "~1.3.14",
88
+ "@types/pg": "^8.23.1",
89
+ "drizzle-kit": "^0.31.11",
90
+ "drizzle-orm": "^0.45.4",
88
91
  "husky": "^9.1.7",
89
- "lint-staged": "^17.1.1",
92
+ "lint-staged": "^17.6.0",
90
93
  "oxfmt": "^0.59.0",
91
- "oxlint": "^1.74.0",
92
- "pg": "^8.22.0",
94
+ "oxlint": "^1.92.0",
95
+ "pg": "^8.23.1",
93
96
  "typescript": "5.9.3"
94
97
  },
95
98
  "dependencies": {}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@southwind-ai/config",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "engines": {
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "dependencies": {
16
16
  "@southwind-ai/shared": "workspace:^0.3.0",
17
- "zod": "^4.4.3"
17
+ "zod": "^4.6.7"
18
18
  },
19
19
  "exports": {
20
20
  ".": "./index.ts"
@@ -5,6 +5,8 @@ export type EnvironmentValueDecoder = (value: string) => unknown;
5
5
 
6
6
  export interface ModuleConfigEnvironmentField {
7
7
  key: string;
8
+ /** Legacy environment names; conflicting values are rejected. */
9
+ aliases?: readonly string[];
8
10
  path: string;
9
11
  defaultValue?: unknown;
10
12
  decode?: EnvironmentValueDecoder;
@@ -94,16 +96,24 @@ function validateDefinition<T>(definition: ModuleConfigDefinition<T>): void {
94
96
  const environmentKeys = new Set<string>();
95
97
  const paths = new Set<string>();
96
98
  for (const field of definition.environment) {
97
- if (!/^[A-Z][A-Z0-9_]*$/.test(field.key)) {
98
- throw new Error(`配置模块 ${definition.key} 包含无效环境变量名`);
99
+ if (field.secret && field.aliases?.length) {
100
+ throw new Error(`配置模块 ${definition.key} 的 Secret 不支持环境别名`);
101
+ }
102
+ for (const key of [field.key, ...(field.aliases ?? [])]) {
103
+ if (!/^[A-Z][A-Z0-9_]*$/.test(key)) {
104
+ throw new Error(`配置模块 ${definition.key} 包含无效环境变量名`);
105
+ }
106
+ if (environmentKeys.has(key)) {
107
+ throw new Error(`配置模块 ${definition.key} 包含重复字段`);
108
+ }
109
+ environmentKeys.add(key);
99
110
  }
100
111
  if (!/^[a-z][A-Za-z0-9]*(\.[a-z][A-Za-z0-9]*)*$/.test(field.path)) {
101
112
  throw new Error(`配置模块 ${definition.key} 包含无效字段路径`);
102
113
  }
103
- if (environmentKeys.has(field.key) || paths.has(field.path)) {
114
+ if (paths.has(field.path)) {
104
115
  throw new Error(`配置模块 ${definition.key} 包含重复字段`);
105
116
  }
106
- environmentKeys.add(field.key);
107
117
  paths.add(field.path);
108
118
  }
109
119
  }
@@ -78,7 +78,7 @@ async function readField(
78
78
  environment: ConfigEnvironment,
79
79
  resolver: SecretResolver,
80
80
  ): Promise<unknown> {
81
- const raw = environment[field.key];
81
+ const raw = readEnvironmentValue(moduleKey, field, environment);
82
82
  if (!field.secret) return decodeField(moduleKey, field, raw);
83
83
  const ref = createSecretRef(field, raw);
84
84
  if (!ref) return missingSecret(moduleKey, field);
@@ -101,7 +101,7 @@ function readFieldSync(
101
101
  environment: ConfigEnvironment,
102
102
  resolver: SecretResolver,
103
103
  ): unknown {
104
- const raw = environment[field.key];
104
+ const raw = readEnvironmentValue(moduleKey, field, environment);
105
105
  if (!field.secret) return decodeField(moduleKey, field, raw);
106
106
  const ref = createSecretRef(field, raw);
107
107
  if (!ref) return missingSecret(moduleKey, field);
@@ -126,6 +126,25 @@ function readFieldSync(
126
126
  }
127
127
  }
128
128
 
129
+ function readEnvironmentValue(
130
+ moduleKey: string,
131
+ field: ModuleConfigEnvironmentField,
132
+ environment: ConfigEnvironment,
133
+ ): string | undefined {
134
+ if (!field.aliases?.length) return environment[field.key];
135
+ const values = [field.key, ...field.aliases]
136
+ .map((key) => environment[key])
137
+ .filter((value): value is string => value !== undefined);
138
+ const first = values[0];
139
+ if (first === undefined || values.length < 2) return first;
140
+ const decode = (raw: string) => decodeField(moduleKey, field, raw);
141
+ const selected = decode(first);
142
+ if (values.slice(1).some((raw) => !Object.is(decode(raw), selected))) {
143
+ throw new ConfigLoadError("CONFIG_INVALID_VALUE", moduleKey, field.path);
144
+ }
145
+ return first;
146
+ }
147
+
129
148
  function createSecretRef(
130
149
  field: ModuleConfigEnvironmentField,
131
150
  raw: string | undefined,
@@ -181,7 +200,12 @@ function assertKnownEnvironment<T>(
181
200
  definition: ModuleConfigDefinition<T>,
182
201
  environment: ConfigEnvironment,
183
202
  ): void {
184
- const known = new Set(definition.environment.map((field) => field.key));
203
+ const known = new Set(
204
+ definition.environment.flatMap((field) => [
205
+ field.key,
206
+ ...(field.aliases ?? []),
207
+ ]),
208
+ );
185
209
  const exact = new Set(definition.ownedEnvironmentKeys || []);
186
210
  const prefixes = definition.ownedEnvironmentPrefixes || [];
187
211
  const unknown = Object.keys(environment).filter(
@@ -0,0 +1,94 @@
1
+ import { expect, test } from "bun:test";
2
+ import { z } from "zod";
3
+ import { defineModuleConfig } from "./definition.js";
4
+ import { ConfigLoadError, loadModuleConfig } from "./environment-loader.js";
5
+ import { loadPlatformConfig, platformConfigDefinition } from "./platform.js";
6
+ import { EnvironmentSecretResolver } from "./secrets.js";
7
+
8
+ test("共享 AI Runtime 使用明确新名,兼容旧名与缺省关闭", () => {
9
+ expect(loadPlatformConfig({}).enableAI).toBe(false);
10
+ for (const key of ["PLATFORM_ENABLE_AI_RUNTIME", "PLATFORM_ENABLE_AI"]) {
11
+ expect(loadPlatformConfig({ [key]: "true" }).enableAI).toBe(true);
12
+ expect(loadPlatformConfig({ [key]: "false" }).enableAI).toBe(false);
13
+ }
14
+ expect(
15
+ loadPlatformConfig({
16
+ PLATFORM_ENABLE_AI_RUNTIME: "true",
17
+ PLATFORM_ENABLE_AI: "1",
18
+ }).enableAI,
19
+ ).toBe(true);
20
+ });
21
+
22
+ test("新旧变量冲突、空值或非法值均 fail closed 且不回显输入", () => {
23
+ for (const legacy of ["false", "", "DO-NOT-LEAK"]) {
24
+ try {
25
+ loadPlatformConfig({
26
+ PLATFORM_ENABLE_AI_RUNTIME: "true",
27
+ PLATFORM_ENABLE_AI: legacy,
28
+ });
29
+ throw new Error("Expected configuration rejection");
30
+ } catch (error) {
31
+ expect(error).toBeInstanceOf(ConfigLoadError);
32
+ expect(error).toMatchObject({
33
+ code: "CONFIG_INVALID_VALUE",
34
+ fieldPath: "enableAI",
35
+ });
36
+ expect(String(error)).not.toContain("DO-NOT-LEAK");
37
+ }
38
+ }
39
+ expect(() => loadPlatformConfig({ PLATFORM_ENABLE_AI_RUNTIME: "" })).toThrow(
40
+ ConfigLoadError,
41
+ );
42
+ expect(() =>
43
+ loadPlatformConfig({ PLATFORM_ENABLE_AI_RUNTIM: "true" }),
44
+ ).toThrow(expect.objectContaining({ code: "CONFIG_UNKNOWN_ENV" }));
45
+ });
46
+
47
+ test("异步 Definition Loader 也读取旧名而不绕过冲突校验", async () => {
48
+ const environment = { PLATFORM_ENABLE_AI: "true" };
49
+ expect(
50
+ (
51
+ await loadModuleConfig(
52
+ platformConfigDefinition,
53
+ environment,
54
+ new EnvironmentSecretResolver(environment),
55
+ )
56
+ ).enableAI,
57
+ ).toBe(true);
58
+ await expect(
59
+ loadModuleConfig(
60
+ platformConfigDefinition,
61
+ {
62
+ PLATFORM_ENABLE_AI: "false",
63
+ PLATFORM_ENABLE_AI_RUNTIME: "true",
64
+ },
65
+ new EnvironmentSecretResolver({}),
66
+ ),
67
+ ).rejects.toMatchObject({ code: "CONFIG_INVALID_VALUE" });
68
+ });
69
+
70
+ test("别名不能与其他字段重复,也不能用于 Secret 引用", () => {
71
+ const definition = {
72
+ key: "test.alias",
73
+ label: "Alias",
74
+ schema: z.object({ first: z.string(), second: z.string() }),
75
+ environment: [
76
+ { key: "FIRST", aliases: ["SECOND"], path: "first" },
77
+ { key: "SECOND", path: "second" },
78
+ ],
79
+ };
80
+ expect(() => defineModuleConfig(definition)).toThrow("重复字段");
81
+ expect(() =>
82
+ defineModuleConfig({
83
+ ...definition,
84
+ environment: [
85
+ {
86
+ key: "TOKEN",
87
+ aliases: ["OLD_TOKEN"],
88
+ path: "first",
89
+ secret: { provider: "env" },
90
+ },
91
+ ],
92
+ }),
93
+ ).toThrow("Secret 不支持环境别名");
94
+ });