create-windy 0.6.12 → 0.6.15

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 (654) hide show
  1. package/dist/cli.js +785 -291
  2. package/package.json +1 -1
  3. package/template/.agents/skills/windy-business-module/SKILL.md +148 -70
  4. package/template/.windy-template.json +3 -3
  5. package/template/AGENTS.md +3 -6
  6. package/template/apps/agent-server/Dockerfile +2 -3
  7. package/template/apps/agent-server/README.md +38 -54
  8. package/template/apps/agent-server/pyproject.toml +0 -1
  9. package/template/apps/agent-server/src/southwind_agent_server/app.py +4 -2
  10. package/template/apps/agent-server/src/southwind_agent_server/attempt_context.py +191 -0
  11. package/template/apps/agent-server/src/southwind_agent_server/attempt_context_projection.py +203 -0
  12. package/template/apps/agent-server/src/southwind_agent_server/client_completion_contracts.py +61 -0
  13. package/template/apps/agent-server/src/southwind_agent_server/client_completion_governance.py +82 -0
  14. package/template/apps/agent-server/src/southwind_agent_server/client_completion_routes.py +121 -0
  15. package/template/apps/agent-server/src/southwind_agent_server/client_completion_runtime.py +158 -0
  16. package/template/apps/agent-server/src/southwind_agent_server/context_message_digest.py +24 -0
  17. package/template/apps/agent-server/src/southwind_agent_server/context_version_contracts.py +71 -0
  18. package/template/apps/agent-server/src/southwind_agent_server/context_version_port.py +307 -0
  19. package/template/apps/agent-server/src/southwind_agent_server/contracts.py +39 -0
  20. package/template/apps/agent-server/src/southwind_agent_server/deterministic.py +2 -0
  21. package/template/apps/agent-server/src/southwind_agent_server/engine.py +9 -1
  22. package/template/apps/agent-server/src/southwind_agent_server/engine_identity.py +2 -0
  23. package/template/apps/agent-server/src/southwind_agent_server/fingerprint.py +15 -0
  24. package/template/apps/agent-server/src/southwind_agent_server/health_routes.py +37 -3
  25. package/template/apps/agent-server/src/southwind_agent_server/openai_engine.py +46 -26
  26. package/template/apps/agent-server/src/southwind_agent_server/openai_engine_validation.py +32 -0
  27. package/template/apps/agent-server/src/southwind_agent_server/openai_provider.py +7 -0
  28. package/template/apps/agent-server/src/southwind_agent_server/postgres_report_insert.py +5 -2
  29. package/template/apps/agent-server/src/southwind_agent_server/postgres_report_queries.py +1 -0
  30. package/template/apps/agent-server/src/southwind_agent_server/postgres_report_store.py +6 -1
  31. package/template/apps/agent-server/src/southwind_agent_server/postgres_store.py +3 -2
  32. package/template/apps/agent-server/src/southwind_agent_server/postgres_store_backend.py +1 -0
  33. package/template/apps/agent-server/src/southwind_agent_server/provider_governance.py +21 -0
  34. package/template/apps/agent-server/src/southwind_agent_server/report_lifecycle.py +2 -1
  35. package/template/apps/agent-server/src/southwind_agent_server/report_presenter.py +1 -0
  36. package/template/apps/agent-server/src/southwind_agent_server/report_routes.py +7 -1
  37. package/template/apps/agent-server/src/southwind_agent_server/report_store.py +10 -56
  38. package/template/apps/agent-server/src/southwind_agent_server/report_store_protocol.py +75 -0
  39. package/template/apps/agent-server/src/southwind_agent_server/report_types.py +9 -2
  40. package/template/apps/agent-server/src/southwind_agent_server/runtime_budget.py +74 -0
  41. package/template/apps/agent-server/src/southwind_agent_server/runtime_factory.py +11 -3
  42. package/template/apps/agent-server/src/southwind_agent_server/service.py +41 -65
  43. package/template/apps/agent-server/src/southwind_agent_server/service_control.py +64 -0
  44. package/template/apps/agent-server/src/southwind_agent_server/service_execution.py +3 -0
  45. package/template/apps/agent-server/src/southwind_agent_server/sqlite_errors.py +2 -0
  46. package/template/apps/agent-server/src/southwind_agent_server/sqlite_schema.py +9 -1
  47. package/template/apps/agent-server/src/southwind_agent_server/sqlite_store.py +6 -5
  48. package/template/apps/agent-server/src/southwind_agent_server/store.py +2 -0
  49. package/template/apps/agent-server/src/southwind_agent_server/trajectory.py +137 -0
  50. package/template/apps/agent-server/src/southwind_agent_server/unavailable_engine.py +58 -0
  51. package/template/apps/agent-server/tests/test_api.py +30 -11
  52. package/template/apps/agent-server/tests/test_client_completion.py +230 -0
  53. package/template/apps/agent-server/tests/test_provider_attempt_reporting.py +12 -24
  54. package/template/apps/agent-server/tests/test_report_resilience.py +2 -0
  55. package/template/apps/agent-server/tests/test_report_routes.py +58 -1
  56. package/template/apps/agent-server/tests/test_report_summary_parity.py +1 -0
  57. package/template/apps/agent-server/tests/test_run_capacity.py +2 -0
  58. package/template/apps/agent-server/tests/test_runtime_factory_readiness.py +18 -3
  59. package/template/apps/agent-server/tests/test_trajectory.py +91 -0
  60. package/template/apps/agent-server/uv.lock +0 -259
  61. package/template/apps/server/Dockerfile +9 -4
  62. package/template/apps/server/src/agent/actor-projection-audit.ts +6 -0
  63. package/template/apps/server/src/agent/agent-run-delegation-policy.ts +115 -0
  64. package/template/apps/server/src/agent/agent-session-bootstrap.ts +23 -0
  65. package/template/apps/server/src/agent/{debug-session-facade-provider-failure.test.ts → agent-session-facade-provider-failure.test.ts} +24 -33
  66. package/template/apps/server/src/agent/{debug-session-facade.test.ts → agent-session-facade.test.ts} +34 -45
  67. package/template/apps/server/src/agent/{debug-session-facade.ts → agent-session-facade.ts} +50 -57
  68. package/template/apps/server/src/agent/{debug-session-id.test.ts → agent-session-id.test.ts} +5 -5
  69. package/template/apps/server/src/agent/{debug-session-id.ts → agent-session-id.ts} +7 -7
  70. package/template/apps/server/src/agent/{debug-session-provider-reader.ts → agent-session-provider-reader.ts} +18 -15
  71. package/template/apps/server/src/agent/{debug-session-routes.test.ts → agent-session-routes.test.ts} +16 -16
  72. package/template/apps/server/src/agent/{debug-session-routes.ts → agent-session-routes.ts} +12 -12
  73. package/template/apps/server/src/agent/{debug-session-validation.ts → agent-session-validation.ts} +13 -11
  74. package/template/apps/server/src/agent/client-session/attempt-authority.test.ts +162 -0
  75. package/template/apps/server/src/agent/client-session/attempt-authority.ts +191 -0
  76. package/template/apps/server/src/agent/client-session/authorization.ts +47 -0
  77. package/template/apps/server/src/agent/client-session/bootstrap.ts +112 -0
  78. package/template/apps/server/src/agent/client-session/capabilities.ts +19 -0
  79. package/template/apps/server/src/agent/client-session/completion.ts +350 -0
  80. package/template/apps/server/src/agent/client-session/contracts.ts +159 -0
  81. package/template/apps/server/src/agent/client-session/creation.ts +103 -0
  82. package/template/apps/server/src/agent/client-session/digest.ts +49 -0
  83. package/template/apps/server/src/agent/client-session/drizzle-records.ts +150 -0
  84. package/template/apps/server/src/agent/client-session/drizzle-repository.integration.test.ts +197 -0
  85. package/template/apps/server/src/agent/client-session/drizzle-repository.ts +236 -0
  86. package/template/apps/server/src/agent/client-session/errors.ts +28 -0
  87. package/template/apps/server/src/agent/client-session/finalization.ts +99 -0
  88. package/template/apps/server/src/agent/client-session/fixtures/page-agent-1.12.2-request.json +52 -0
  89. package/template/apps/server/src/agent/client-session/host-auth.test.ts +144 -0
  90. package/template/apps/server/src/agent/client-session/host-auth.ts +122 -0
  91. package/template/apps/server/src/agent/client-session/host-revocation-composition.test.ts +77 -0
  92. package/template/apps/server/src/agent/client-session/host-revocation-composition.ts +28 -0
  93. package/template/apps/server/src/agent/client-session/launch-authority.contract.test.ts +21 -0
  94. package/template/apps/server/src/agent/client-session/manifest-admission.ts +251 -0
  95. package/template/apps/server/src/agent/client-session/openai-stream.ts +123 -0
  96. package/template/apps/server/src/agent/client-session/presentation.ts +46 -0
  97. package/template/apps/server/src/agent/client-session/remote-provider.test.ts +144 -0
  98. package/template/apps/server/src/agent/client-session/remote-provider.ts +216 -0
  99. package/template/apps/server/src/agent/client-session/repository.ts +225 -0
  100. package/template/apps/server/src/agent/client-session/request.test.ts +69 -0
  101. package/template/apps/server/src/agent/client-session/request.ts +289 -0
  102. package/template/apps/server/src/agent/client-session/revocation.ts +23 -0
  103. package/template/apps/server/src/agent/client-session/routes.ts +315 -0
  104. package/template/apps/server/src/agent/client-session/runtime-audit.ts +42 -0
  105. package/template/apps/server/src/agent/client-session/service.test-support.ts +248 -0
  106. package/template/apps/server/src/agent/client-session/service.test.ts +268 -0
  107. package/template/apps/server/src/agent/client-session/service.ts +316 -0
  108. package/template/apps/server/src/agent/client-session/terminal-digest.test.ts +23 -0
  109. package/template/apps/server/src/agent/client-workflow-artifact/active-blob-references.ts +8 -0
  110. package/template/apps/server/src/agent/client-workflow-artifact/artifact-builder.ts +60 -0
  111. package/template/apps/server/src/agent/client-workflow-artifact/authority-current.ts +59 -0
  112. package/template/apps/server/src/agent/client-workflow-artifact/binding-registry.test.ts +189 -0
  113. package/template/apps/server/src/agent/client-workflow-artifact/binding-registry.ts +153 -0
  114. package/template/apps/server/src/agent/client-workflow-artifact/bootstrap.ts +77 -0
  115. package/template/apps/server/src/agent/client-workflow-artifact/cancellation.ts +47 -0
  116. package/template/apps/server/src/agent/client-workflow-artifact/completed-recovery.ts +31 -0
  117. package/template/apps/server/src/agent/client-workflow-artifact/contracts.ts +104 -0
  118. package/template/apps/server/src/agent/client-workflow-artifact/drizzle-locks.ts +30 -0
  119. package/template/apps/server/src/agent/client-workflow-artifact/drizzle-mapper.ts +138 -0
  120. package/template/apps/server/src/agent/client-workflow-artifact/drizzle-repository.ts +346 -0
  121. package/template/apps/server/src/agent/client-workflow-artifact/error.ts +21 -0
  122. package/template/apps/server/src/agent/client-workflow-artifact/handler.ts +167 -0
  123. package/template/apps/server/src/agent/client-workflow-artifact/host-revocation.ts +29 -0
  124. package/template/apps/server/src/agent/client-workflow-artifact/in-memory-repository.ts +232 -0
  125. package/template/apps/server/src/agent/client-workflow-artifact/job-port.ts +101 -0
  126. package/template/apps/server/src/agent/client-workflow-artifact/presentation.ts +41 -0
  127. package/template/apps/server/src/agent/client-workflow-artifact/recovery.contract.test.ts +253 -0
  128. package/template/apps/server/src/agent/client-workflow-artifact/release-binding.ts +85 -0
  129. package/template/apps/server/src/agent/client-workflow-artifact/repository.test.ts +204 -0
  130. package/template/apps/server/src/agent/client-workflow-artifact/repository.ts +97 -0
  131. package/template/apps/server/src/agent/client-workflow-artifact/routes-handler.contract.test.ts +201 -0
  132. package/template/apps/server/src/agent/client-workflow-artifact/routes.ts +161 -0
  133. package/template/apps/server/src/agent/client-workflow-artifact/runtime-composition.ts +101 -0
  134. package/template/apps/server/src/agent/client-workflow-artifact/scope-authority.ts +39 -0
  135. package/template/apps/server/src/agent/client-workflow-artifact/service-authorization.ts +117 -0
  136. package/template/apps/server/src/agent/client-workflow-artifact/service-support.ts +28 -0
  137. package/template/apps/server/src/agent/client-workflow-artifact/service.contract.test.ts +345 -0
  138. package/template/apps/server/src/agent/client-workflow-artifact/service.ts +350 -0
  139. package/template/apps/server/src/agent/client-workflow-artifact/session-boundary.ts +39 -0
  140. package/template/apps/server/src/agent/client-workflow-artifact/source-access.contract.test.ts +98 -0
  141. package/template/apps/server/src/agent/client-workflow-artifact/source-access.ts +80 -0
  142. package/template/apps/server/src/agent/client-workflow-artifact/takeover.ts +122 -0
  143. package/template/apps/server/src/agent/client-workflow-artifact/task-authority.contract.test.ts +97 -0
  144. package/template/apps/server/src/agent/client-workflow-artifact/task-authority.ts +147 -0
  145. package/template/apps/server/src/agent/client-workflow-artifact/terminal-authority.contract.test.ts +100 -0
  146. package/template/apps/server/src/agent/client-workflow-artifact/terminal-replay.ts +31 -0
  147. package/template/apps/server/src/agent/client-workflow-artifact/terminal-seal.ts +211 -0
  148. package/template/apps/server/src/agent/client-workflow-artifact/workflow-artifact.test-support.ts +173 -0
  149. package/template/apps/server/src/agent/client-workflow-artifact/workflow-loader.contract.test.ts +254 -0
  150. package/template/apps/server/src/agent/client-workflow-artifact/workflow-loader.ts +285 -0
  151. package/template/apps/server/src/agent/context-memory/attempt-context-contracts.ts +60 -0
  152. package/template/apps/server/src/agent/context-memory/authoritative-source-registry.ts +127 -0
  153. package/template/apps/server/src/agent/context-memory/context-builder.test.ts +160 -0
  154. package/template/apps/server/src/agent/context-memory/context-builder.ts +184 -0
  155. package/template/apps/server/src/agent/context-memory/contracts.ts +284 -0
  156. package/template/apps/server/src/agent/context-memory/digest.ts +22 -0
  157. package/template/apps/server/src/agent/context-memory/memory-authorization.ts +82 -0
  158. package/template/apps/server/src/agent/context-memory/memory-content.ts +69 -0
  159. package/template/apps/server/src/agent/context-memory/memory-object-registry.ts +87 -0
  160. package/template/apps/server/src/agent/context-memory/memory-projector-contracts.ts +121 -0
  161. package/template/apps/server/src/agent/context-memory/memory-projector-validation.ts +155 -0
  162. package/template/apps/server/src/agent/context-memory/memory-projector.test.ts +19 -0
  163. package/template/apps/server/src/agent/context-memory/memory-projector.ts +259 -0
  164. package/template/apps/server/src/agent/context-memory/memory-retrieval-policy.ts +195 -0
  165. package/template/apps/server/src/agent/context-memory/memory-retriever.test.ts +339 -0
  166. package/template/apps/server/src/agent/context-memory/memory-retriever.ts +184 -0
  167. package/template/apps/server/src/agent/context-memory/search-provider-port.test.ts +62 -0
  168. package/template/apps/server/src/agent/context-memory/search-provider-port.ts +75 -0
  169. package/template/apps/server/src/agent/context-memory/working-context-expiry.ts +95 -0
  170. package/template/apps/server/src/agent/context-message-recovery.ts +23 -0
  171. package/template/apps/server/src/agent/context-version-routes.ts +241 -0
  172. package/template/apps/server/src/agent/context-version-runtime.ts +332 -0
  173. package/template/apps/server/src/agent/context-version-support.ts +93 -0
  174. package/template/apps/server/src/agent/context-version-validation.ts +118 -0
  175. package/template/apps/server/src/agent/drizzle-run-binding-repository.ts +11 -0
  176. package/template/apps/server/src/agent/idempotency-key.ts +9 -1
  177. package/template/apps/server/src/agent/memory-runtime-adapters.ts +266 -0
  178. package/template/apps/server/src/agent/memory-scope-binding.ts +14 -0
  179. package/template/apps/server/src/agent/module-ai-port-factory.ts +41 -0
  180. package/template/apps/server/src/agent/provider-input-governance.ts +19 -0
  181. package/template/apps/server/src/agent/remote-runtime-response.ts +162 -0
  182. package/template/apps/server/src/agent/remote-runtime.ts +53 -153
  183. package/template/apps/server/src/agent/run-audit.ts +2 -2
  184. package/template/apps/server/src/agent/run-authorization.test.ts +27 -0
  185. package/template/apps/server/src/agent/run-authorization.ts +60 -1
  186. package/template/apps/server/src/agent/run-binding-repository.ts +9 -0
  187. package/template/apps/server/src/agent/run-browser-authorization.ts +79 -0
  188. package/template/apps/server/src/agent/run-contracts.ts +23 -0
  189. package/template/apps/server/src/agent/run-facade.test-support.ts +17 -4
  190. package/template/apps/server/src/agent/run-facade.test.ts +16 -0
  191. package/template/apps/server/src/agent/run-facade.ts +139 -139
  192. package/template/apps/server/src/agent/run-failure-cleanup.ts +58 -0
  193. package/template/apps/server/src/agent/run-operation-policy.ts +20 -0
  194. package/template/apps/server/src/agent/run-route-input.ts +19 -1
  195. package/template/apps/server/src/agent/run-routes.ts +133 -5
  196. package/template/apps/server/src/agent/run-runtime-request.ts +89 -0
  197. package/template/apps/server/src/agent/run-session-authorization.ts +97 -0
  198. package/template/apps/server/src/agent/run-start-preparation.ts +71 -0
  199. package/template/apps/server/src/agent/runtime-bootstrap-input.ts +46 -0
  200. package/template/apps/server/src/agent/runtime-bootstrap-report.test.ts +53 -1
  201. package/template/apps/server/src/agent/runtime-bootstrap.ts +115 -112
  202. package/template/apps/server/src/agent/runtime-public-ports.ts +40 -0
  203. package/template/apps/server/src/agent/runtime-tool-composition.ts +38 -0
  204. package/template/apps/server/src/agent/session-context-source-support.ts +38 -0
  205. package/template/apps/server/src/agent/session-context-source.ts +346 -0
  206. package/template/apps/server/src/agent/session-invalidation/contracts.ts +216 -0
  207. package/template/apps/server/src/agent/session-invalidation/dispatcher.contract.test.ts +333 -0
  208. package/template/apps/server/src/agent/session-invalidation/dispatcher.ts +205 -0
  209. package/template/apps/server/src/agent/session-invalidation/module-authoritative-producer.test.ts +127 -0
  210. package/template/apps/server/src/agent/session-invalidation/module-authoritative-producer.ts +202 -0
  211. package/template/apps/server/src/agent/session-invalidation/read-guard.ts +39 -0
  212. package/template/apps/server/src/agent/session-invalidation/runtime.ts +69 -0
  213. package/template/apps/server/src/agent/session-invalidation/test-envelopes.ts +24 -0
  214. package/template/apps/server/src/agent/session-invalidation/worker.contract.test.ts +135 -0
  215. package/template/apps/server/src/agent/session-invalidation/worker.ts +76 -0
  216. package/template/apps/server/src/agent/session-log/checkpoint-digest.ts +36 -0
  217. package/template/apps/server/src/agent/session-log/domain.ts +123 -0
  218. package/template/apps/server/src/agent/session-log/events.ts +229 -0
  219. package/template/apps/server/src/agent/session-log/history.ts +143 -0
  220. package/template/apps/server/src/agent/session-log/in-memory-repository.ts +340 -0
  221. package/template/apps/server/src/agent/session-log/lifecycle.ts +67 -0
  222. package/template/apps/server/src/agent/session-log/replay-policy.ts +76 -0
  223. package/template/apps/server/src/agent/session-log/repository.ts +103 -0
  224. package/template/apps/server/src/agent/session-log/service.ts +349 -0
  225. package/template/apps/server/src/agent/session-log/session-log.test.ts +282 -0
  226. package/template/apps/server/src/agent/session-persistence/drizzle-context-memory.ts +348 -0
  227. package/template/apps/server/src/agent/session-persistence/drizzle-governed-context.ts +328 -0
  228. package/template/apps/server/src/agent/session-persistence/drizzle-invalidation-outbox.ts +260 -0
  229. package/template/apps/server/src/agent/session-persistence/drizzle-memory-projection-deletion.ts +56 -0
  230. package/template/apps/server/src/agent/session-persistence/drizzle-run-projection-receipt.ts +80 -0
  231. package/template/apps/server/src/agent/session-persistence/drizzle-session-fork.ts +147 -0
  232. package/template/apps/server/src/agent/session-persistence/drizzle-session-list.ts +24 -0
  233. package/template/apps/server/src/agent/session-persistence/drizzle-session-mapping.ts +154 -0
  234. package/template/apps/server/src/agent/session-persistence/drizzle-session-mutations.ts +64 -0
  235. package/template/apps/server/src/agent/session-persistence/drizzle-session-repository.ts +335 -0
  236. package/template/apps/server/src/agent/session-persistence/invalidation-projections.ts +229 -0
  237. package/template/apps/server/src/agent/session-persistence/payload-codec.ts +90 -0
  238. package/template/apps/server/src/agent/session-projection-access.ts +167 -0
  239. package/template/apps/server/src/agent/session-projection-bootstrap.ts +87 -0
  240. package/template/apps/server/src/agent/session-projection-errors.ts +22 -0
  241. package/template/apps/server/src/agent/session-projection-facade.ts +349 -0
  242. package/template/apps/server/src/agent/session-projection-routes.ts +215 -0
  243. package/template/apps/server/src/agent/session-projection-view.ts +137 -0
  244. package/template/apps/server/src/agent/session-result-memory.ts +228 -0
  245. package/template/apps/server/src/agent/session-run-lifecycle.ts +85 -0
  246. package/template/apps/server/src/agent/session-run-link-contracts.ts +56 -0
  247. package/template/apps/server/src/agent/session-run-link.ts +343 -0
  248. package/template/apps/server/src/agent/session-run-recovery.ts +16 -0
  249. package/template/apps/server/src/agent/session-runtime-composition.ts +265 -0
  250. package/template/apps/server/src/agent/session-source-chain-authorizer.ts +141 -0
  251. package/template/apps/server/src/agent/session-terminal-reconciler.ts +100 -0
  252. package/template/apps/server/src/agent/session-turn-state.ts +49 -0
  253. package/template/apps/server/src/agent/tool-audit.ts +3 -3
  254. package/template/apps/server/src/agent/tool-execution-receipt.ts +13 -0
  255. package/template/apps/server/src/agent/tool-host.ts +41 -4
  256. package/template/apps/server/src/agent/tool-registry-composition.ts +52 -0
  257. package/template/apps/server/src/agent/tool-registry.test.ts +5 -5
  258. package/template/apps/server/src/agent/tool-registry.ts +53 -59
  259. package/template/apps/server/src/agent/unavailable-routes.ts +70 -5
  260. package/template/apps/server/src/agent/workflow-durable-runtime-input.ts +32 -0
  261. package/template/apps/server/src/agent/workflow-runtime-bootstrap.ts +61 -0
  262. package/template/apps/server/src/agent-workflow/adapter-dispatch.ts +148 -0
  263. package/template/apps/server/src/agent-workflow/approval-node-adapter.ts +77 -0
  264. package/template/apps/server/src/agent-workflow/artifact-access-error.ts +9 -0
  265. package/template/apps/server/src/agent-workflow/artifact-node-adapter.ts +67 -0
  266. package/template/apps/server/src/agent-workflow/artifact-policy.ts +71 -0
  267. package/template/apps/server/src/agent-workflow/artifact-source-authorization.ts +91 -0
  268. package/template/apps/server/src/agent-workflow/authorization.ts +238 -0
  269. package/template/apps/server/src/agent-workflow/budget-ledger.ts +118 -0
  270. package/template/apps/server/src/agent-workflow/budget-validation.ts +305 -0
  271. package/template/apps/server/src/agent-workflow/canonical-agent-run-binding.ts +17 -0
  272. package/template/apps/server/src/agent-workflow/canonical-agent-run-evidence.ts +142 -0
  273. package/template/apps/server/src/agent-workflow/canonical-agent-run-port.ts +304 -0
  274. package/template/apps/server/src/agent-workflow/canonical-agent-run-remote.ts +64 -0
  275. package/template/apps/server/src/agent-workflow/canonical-json.ts +16 -0
  276. package/template/apps/server/src/agent-workflow/command-drive.ts +195 -0
  277. package/template/apps/server/src/agent-workflow/command-error.ts +9 -0
  278. package/template/apps/server/src/agent-workflow/command-facade.ts +349 -0
  279. package/template/apps/server/src/agent-workflow/command-input.ts +133 -0
  280. package/template/apps/server/src/agent-workflow/condition-node-adapter.ts +69 -0
  281. package/template/apps/server/src/agent-workflow/definition-budget-validation.ts +41 -0
  282. package/template/apps/server/src/agent-workflow/definition-node-validation.ts +197 -0
  283. package/template/apps/server/src/agent-workflow/definition-validation.ts +198 -0
  284. package/template/apps/server/src/agent-workflow/delegated-tool-authorization.ts +15 -0
  285. package/template/apps/server/src/agent-workflow/delegation-child-delivery.ts +129 -0
  286. package/template/apps/server/src/agent-workflow/delegation-execution-authorization.ts +218 -0
  287. package/template/apps/server/src/agent-workflow/delegation-policy-validation.ts +253 -0
  288. package/template/apps/server/src/agent-workflow/delegation-policy.ts +179 -0
  289. package/template/apps/server/src/agent-workflow/drizzle-artifact-port.ts +211 -0
  290. package/template/apps/server/src/agent-workflow/drizzle-artifact-support.ts +152 -0
  291. package/template/apps/server/src/agent-workflow/drizzle-budget-ledger-settlement.ts +271 -0
  292. package/template/apps/server/src/agent-workflow/drizzle-budget-ledger-support.ts +226 -0
  293. package/template/apps/server/src/agent-workflow/drizzle-budget-ledger.ts +189 -0
  294. package/template/apps/server/src/agent-workflow/drizzle-cancellation-reconcile.ts +177 -0
  295. package/template/apps/server/src/agent-workflow/drizzle-delegated-tool-authorization.ts +155 -0
  296. package/template/apps/server/src/agent-workflow/drizzle-delegation-completion.ts +84 -0
  297. package/template/apps/server/src/agent-workflow/drizzle-delegation-lifecycle.ts +139 -0
  298. package/template/apps/server/src/agent-workflow/drizzle-delegation-port.ts +288 -0
  299. package/template/apps/server/src/agent-workflow/drizzle-effect-command-fence.ts +333 -0
  300. package/template/apps/server/src/agent-workflow/drizzle-evaluation-repository.ts +214 -0
  301. package/template/apps/server/src/agent-workflow/drizzle-event-validation.ts +43 -0
  302. package/template/apps/server/src/agent-workflow/drizzle-recovery-admission.ts +115 -0
  303. package/template/apps/server/src/agent-workflow/drizzle-repository-lineage.ts +103 -0
  304. package/template/apps/server/src/agent-workflow/drizzle-repository-mappers.ts +317 -0
  305. package/template/apps/server/src/agent-workflow/drizzle-repository-write.ts +311 -0
  306. package/template/apps/server/src/agent-workflow/drizzle-repository.ts +285 -0
  307. package/template/apps/server/src/agent-workflow/drizzle-side-effect-repository.ts +83 -0
  308. package/template/apps/server/src/agent-workflow/drizzle-write-support.ts +101 -0
  309. package/template/apps/server/src/agent-workflow/durable-continuation-authorization.ts +109 -0
  310. package/template/apps/server/src/agent-workflow/durable-continuation-driver.ts +97 -0
  311. package/template/apps/server/src/agent-workflow/durable-continuation-runtime.ts +173 -0
  312. package/template/apps/server/src/agent-workflow/durable-job-node-adapter.ts +106 -0
  313. package/template/apps/server/src/agent-workflow/effect-command-fence.ts +250 -0
  314. package/template/apps/server/src/agent-workflow/evaluation-evidence-coordinates.ts +225 -0
  315. package/template/apps/server/src/agent-workflow/evaluation-evidence-metrics.ts +280 -0
  316. package/template/apps/server/src/agent-workflow/evaluation-evidence-reader.ts +326 -0
  317. package/template/apps/server/src/agent-workflow/evaluation-metrics-validation.ts +85 -0
  318. package/template/apps/server/src/agent-workflow/evaluation-projection.ts +70 -0
  319. package/template/apps/server/src/agent-workflow/evaluation-repository.ts +134 -0
  320. package/template/apps/server/src/agent-workflow/evaluation-service.ts +292 -0
  321. package/template/apps/server/src/agent-workflow/evaluation-tool-registration.ts +95 -0
  322. package/template/apps/server/src/agent-workflow/evaluation-validation.ts +331 -0
  323. package/template/apps/server/src/agent-workflow/event-validation.ts +277 -0
  324. package/template/apps/server/src/agent-workflow/governed-tool-schema.ts +55 -0
  325. package/template/apps/server/src/agent-workflow/in-memory-evaluation-repository.ts +123 -0
  326. package/template/apps/server/src/agent-workflow/in-memory-mutation-validation.ts +154 -0
  327. package/template/apps/server/src/agent-workflow/in-memory-repository-support.ts +277 -0
  328. package/template/apps/server/src/agent-workflow/in-memory-repository.ts +339 -0
  329. package/template/apps/server/src/agent-workflow/in-memory-side-effect-store.ts +78 -0
  330. package/template/apps/server/src/agent-workflow/input-receipt.ts +55 -0
  331. package/template/apps/server/src/agent-workflow/model-node-adapter.ts +86 -0
  332. package/template/apps/server/src/agent-workflow/model-pricing-catalog.ts +215 -0
  333. package/template/apps/server/src/agent-workflow/node-adapter-factory.ts +83 -0
  334. package/template/apps/server/src/agent-workflow/node-adapters.ts +50 -0
  335. package/template/apps/server/src/agent-workflow/node-execution-ports.ts +185 -0
  336. package/template/apps/server/src/agent-workflow/node-input-receipt-port.ts +42 -0
  337. package/template/apps/server/src/agent-workflow/node-result-receipt.ts +50 -0
  338. package/template/apps/server/src/agent-workflow/platform-node-adapter-support.ts +185 -0
  339. package/template/apps/server/src/agent-workflow/platform-node-adapters.ts +264 -0
  340. package/template/apps/server/src/agent-workflow/platform-node-approval.ts +146 -0
  341. package/template/apps/server/src/agent-workflow/platform-node-direct-adapters.ts +65 -0
  342. package/template/apps/server/src/agent-workflow/production-delegation-scope.ts +58 -0
  343. package/template/apps/server/src/agent-workflow/production-node-policies.ts +62 -0
  344. package/template/apps/server/src/agent-workflow/project-launch-authority.contract.test.ts +53 -0
  345. package/template/apps/server/src/agent-workflow/project-launch-authority.ts +92 -0
  346. package/template/apps/server/src/agent-workflow/query-service.ts +198 -0
  347. package/template/apps/server/src/agent-workflow/release.ts +96 -0
  348. package/template/apps/server/src/agent-workflow/repository.ts +157 -0
  349. package/template/apps/server/src/agent-workflow/routes.ts +307 -0
  350. package/template/apps/server/src/agent-workflow/runtime-composition.ts +324 -0
  351. package/template/apps/server/src/agent-workflow/scheduler-cancellation-reconcile.ts +253 -0
  352. package/template/apps/server/src/agent-workflow/scheduler-cancellation-support.ts +145 -0
  353. package/template/apps/server/src/agent-workflow/scheduler-cancellation.ts +2 -0
  354. package/template/apps/server/src/agent-workflow/scheduler-context.ts +85 -0
  355. package/template/apps/server/src/agent-workflow/scheduler-deadline.ts +65 -0
  356. package/template/apps/server/src/agent-workflow/scheduler-effect-result.ts +205 -0
  357. package/template/apps/server/src/agent-workflow/scheduler-execution-convergence.ts +174 -0
  358. package/template/apps/server/src/agent-workflow/scheduler-execution.ts +211 -0
  359. package/template/apps/server/src/agent-workflow/scheduler-failure.ts +102 -0
  360. package/template/apps/server/src/agent-workflow/scheduler-join-cancellation.ts +282 -0
  361. package/template/apps/server/src/agent-workflow/scheduler-mutation-queue.ts +13 -0
  362. package/template/apps/server/src/agent-workflow/scheduler-node-timeout.ts +139 -0
  363. package/template/apps/server/src/agent-workflow/scheduler-parallel-dispatch.ts +99 -0
  364. package/template/apps/server/src/agent-workflow/scheduler-recovery-activation.ts +63 -0
  365. package/template/apps/server/src/agent-workflow/scheduler-recovery-budget.ts +41 -0
  366. package/template/apps/server/src/agent-workflow/scheduler-recovery-effect.ts +331 -0
  367. package/template/apps/server/src/agent-workflow/scheduler-recovery-event-time.ts +26 -0
  368. package/template/apps/server/src/agent-workflow/scheduler-recovery-failed-policy.ts +129 -0
  369. package/template/apps/server/src/agent-workflow/scheduler-recovery-node.ts +208 -0
  370. package/template/apps/server/src/agent-workflow/scheduler-recovery-policy-convergence.ts +140 -0
  371. package/template/apps/server/src/agent-workflow/scheduler-reservation-convergence.ts +40 -0
  372. package/template/apps/server/src/agent-workflow/scheduler-side-effect-execution.ts +249 -0
  373. package/template/apps/server/src/agent-workflow/scheduler-support.ts +235 -0
  374. package/template/apps/server/src/agent-workflow/scheduler-workflow-cancellation.ts +296 -0
  375. package/template/apps/server/src/agent-workflow/scheduler.ts +289 -0
  376. package/template/apps/server/src/agent-workflow/service-completion.ts +102 -0
  377. package/template/apps/server/src/agent-workflow/service-mutation-identity.ts +94 -0
  378. package/template/apps/server/src/agent-workflow/service-node-admission.ts +36 -0
  379. package/template/apps/server/src/agent-workflow/service-node-run-update.ts +55 -0
  380. package/template/apps/server/src/agent-workflow/service-recovery-events.ts +38 -0
  381. package/template/apps/server/src/agent-workflow/service-recovery.ts +264 -0
  382. package/template/apps/server/src/agent-workflow/service-retry.ts +86 -0
  383. package/template/apps/server/src/agent-workflow/service-run-command.ts +131 -0
  384. package/template/apps/server/src/agent-workflow/service-state-error.ts +21 -0
  385. package/template/apps/server/src/agent-workflow/service-state-invariants.ts +44 -0
  386. package/template/apps/server/src/agent-workflow/service-support.ts +152 -0
  387. package/template/apps/server/src/agent-workflow/service.ts +307 -0
  388. package/template/apps/server/src/agent-workflow/side-effect-state.ts +226 -0
  389. package/template/apps/server/src/agent-workflow/state-machine.ts +321 -0
  390. package/template/apps/server/src/agent-workflow/subagent-node-adapter.ts +229 -0
  391. package/template/apps/server/src/agent-workflow/tool-node-adapter.ts +259 -0
  392. package/template/apps/server/src/agent-workflow/usage.ts +149 -0
  393. package/template/apps/server/src/agent-workflow/wait-signal-service.ts +147 -0
  394. package/template/apps/server/src/agent-workflow/workflow-artifact-token.ts +109 -0
  395. package/template/apps/server/src/agent-workflow/workflow-value-validation.ts +101 -0
  396. package/template/apps/server/src/agent-workflow/workspace-policy.ts +109 -0
  397. package/template/apps/server/src/ai-runtime-report/remote-parser.ts +41 -0
  398. package/template/apps/server/src/ai-runtime-report/service.test.ts +2 -0
  399. package/template/apps/server/src/app/agent-runtime-composition.ts +43 -0
  400. package/template/apps/server/src/app/client-agent-host-auth-binding.ts +10 -0
  401. package/template/apps/server/src/app/client-agent-workflow-artifact-binding.ts +14 -0
  402. package/template/apps/server/src/application-services.ts +6 -0
  403. package/template/apps/server/src/auth/actor-resolver.test.ts +33 -0
  404. package/template/apps/server/src/auth/actor-resolver.ts +6 -1
  405. package/template/apps/server/src/auth/composition.ts +36 -0
  406. package/template/apps/server/src/auth/routes.test-support.ts +2 -0
  407. package/template/apps/server/src/auth/routes.test.ts +18 -0
  408. package/template/apps/server/src/auth/runtime.ts +2 -0
  409. package/template/apps/server/src/auth/service-options.ts +16 -0
  410. package/template/apps/server/src/auth/service.ts +7 -12
  411. package/template/apps/server/src/data-access/scope-containment.test.ts +31 -0
  412. package/template/apps/server/src/data-access/scope-containment.ts +48 -0
  413. package/template/apps/server/src/index.ts +35 -37
  414. package/template/apps/server/src/jobs/artifact-publication.test.ts +192 -0
  415. package/template/apps/server/src/jobs/artifact-publication.ts +56 -0
  416. package/template/apps/server/src/jobs/artifact-publisher.ts +101 -0
  417. package/template/apps/server/src/jobs/drizzle-artifact.ts +73 -1
  418. package/template/apps/server/src/jobs/drizzle-execution-repository.ts +14 -1
  419. package/template/apps/server/src/jobs/drizzle-execution.integration.test.ts +65 -0
  420. package/template/apps/server/src/jobs/drizzle-repository.integration.test.ts +1 -0
  421. package/template/apps/server/src/jobs/execution-repository.ts +28 -0
  422. package/template/apps/server/src/jobs/execution.test.ts +3 -1
  423. package/template/apps/server/src/jobs/in-memory-execution.ts +16 -0
  424. package/template/apps/server/src/jobs/in-memory-lease.ts +45 -1
  425. package/template/apps/server/src/jobs/legacy-adapter.integration.test.ts +2 -0
  426. package/template/apps/server/src/jobs/postgres-cleanup-contract.test.ts +58 -0
  427. package/template/apps/server/src/jobs/worker.ts +8 -14
  428. package/template/apps/server/src/license/pairing-service.test.ts +1 -1
  429. package/template/apps/server/src/module-host/agent-session-memory-port.ts +91 -0
  430. package/template/apps/server/src/module-host/{debug-session-provider-registration.test.ts → agent-session-provider-registration.test.ts} +42 -17
  431. package/template/apps/server/src/module-host/{debug-session-provider-registration.ts → agent-session-provider-registration.ts} +18 -18
  432. package/template/apps/server/src/module-host/agent-source-invalidation-port.ts +53 -0
  433. package/template/apps/server/src/module-host/background-ai-unavailable.ts +18 -0
  434. package/template/apps/server/src/module-host/durable-context.ts +19 -22
  435. package/template/apps/server/src/module-host/http-runtime.ts +14 -0
  436. package/template/apps/server/src/module-host/implementation-completeness.test.ts +80 -1
  437. package/template/apps/server/src/module-host/implementation-completeness.ts +28 -1
  438. package/template/apps/server/src/module-host/initialize-contracts.ts +4 -5
  439. package/template/apps/server/src/module-host/initialize.ts +4 -4
  440. package/template/apps/server/src/module-host/request-context.test.ts +5 -5
  441. package/template/apps/server/src/module-host/request-context.ts +40 -8
  442. package/template/apps/server/src/module-host/route-install-context.ts +65 -0
  443. package/template/apps/server/src/module-host/route-installer.ts +11 -56
  444. package/template/apps/server/src/module-host/scoped-host.ts +17 -12
  445. package/template/apps/server/src/module-host/storage-authorization-binding.test.ts +3 -3
  446. package/template/apps/server/src/module-host/storage-port.ts +3 -0
  447. package/template/apps/server/src/module-host/workflow-input-artifact-port.test.ts +104 -0
  448. package/template/apps/server/src/module-host/workflow-input-artifact-port.ts +229 -0
  449. package/template/apps/server/src/module-host/workflow-input-materialization.test.ts +163 -0
  450. package/template/apps/server/src/module-host/workflow-input-materialization.ts +161 -0
  451. package/template/apps/server/src/module-host.ts +3 -5
  452. package/template/apps/server/src/runtime.ts +3 -36
  453. package/template/apps/server/src/storage/routes-stream-cancellation.test.ts +19 -0
  454. package/template/apps/server/src/storage/routes.ts +3 -1
  455. package/template/apps/server/src/system/actor.ts +15 -2
  456. package/template/apps/server/src/system/authorization-invalidation-bridge.ts +30 -0
  457. package/template/apps/server/src/system/authorization-invalidation-composition.ts +36 -0
  458. package/template/apps/server/src/system/drizzle-system.ts +8 -1
  459. package/template/apps/server/src/system/identity-route-config.ts +9 -1
  460. package/template/apps/server/src/system/routes.ts +3 -0
  461. package/template/apps/server/src/system/seed.ts +3 -0
  462. package/template/apps/server/src/system/user-account-policy.ts +91 -0
  463. package/template/apps/server/src/workflow/drizzle-repository.integration.test.ts +1 -0
  464. package/template/apps/web/package.json +1 -0
  465. package/template/apps/web/src/layout/AppSidebar.vue +2 -0
  466. package/template/apps/web/src/pages/system/AgentSessionPage.vue +73 -0
  467. package/template/apps/web/src/pages/system/AgentSessionPage.webtest.ts +66 -0
  468. package/template/apps/web/src/pages/system/AgentWorkflowPage.vue +69 -0
  469. package/template/apps/web/src/pages/system/components/agent-session/AgentSessionDetail.vue +114 -0
  470. package/template/apps/web/src/pages/system/components/agent-session/AgentSessionList.vue +84 -0
  471. package/template/apps/web/src/pages/system/components/agent-session/ContextVersionPanel.vue +119 -0
  472. package/template/apps/web/src/pages/system/components/agent-session/ContextVersionPanel.webtest.ts +46 -0
  473. package/template/apps/web/src/pages/system/components/agent-session/MemoryProjectionPanel.vue +163 -0
  474. package/template/apps/web/src/pages/system/components/agent-session/MemoryProjectionPanel.webtest.ts +62 -0
  475. package/template/apps/web/src/pages/system/components/agent-session/SessionTimeline.vue +71 -0
  476. package/template/apps/web/src/pages/system/components/agent-session/SessionTimeline.webtest.ts +34 -0
  477. package/template/apps/web/src/pages/system/components/agent-session/agent-session-presenter.ts +56 -0
  478. package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowNodeCard.vue +39 -0
  479. package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowNodeDetail.vue +172 -0
  480. package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowRunDetail.vue +151 -0
  481. package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowRunGraph.vue +96 -0
  482. package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowRunList.vue +100 -0
  483. package/template/apps/web/src/pages/system/components/agent-workflow/WorkflowRunSummary.vue +148 -0
  484. package/template/apps/web/src/pages/system/components/agent-workflow/agent-workflow-presenter.ts +74 -0
  485. package/template/apps/web/src/pages/system/components/agent-workflow/workflow-graph-layout.ts +108 -0
  486. package/template/apps/web/src/pages/system/components/ai-runtime/AiRuntimeRunDetailDialog.vue +9 -0
  487. package/template/apps/web/src/pages/system/components/ai-runtime/AiRuntimeRunDetailDialog.webtest.ts +22 -0
  488. package/template/apps/web/src/pages/system/components/ai-runtime/AiRuntimeRunTable.webtest.ts +2 -0
  489. package/template/apps/web/src/pages/system/components/ai-runtime/AiRuntimeTrajectory.vue +118 -0
  490. package/template/apps/web/src/pages/system/composables/useAgentSessions.ts +209 -0
  491. package/template/apps/web/src/pages/system/composables/useAgentSessions.webtest.ts +138 -0
  492. package/template/apps/web/src/pages/system/composables/useAgentWorkflowRuns.ts +173 -0
  493. package/template/apps/web/src/router/index.ts +4 -0
  494. package/template/apps/web/src/router/platform-admin-route-bindings.ts +6 -0
  495. package/template/apps/web/src/services/agent-session-api.ts +159 -0
  496. package/template/apps/web/src/services/agent-session-api.webtest.ts +65 -0
  497. package/template/apps/web/src/services/agent-workflow-api.ts +181 -0
  498. package/template/apps/web/src/services/ai-runtime-api.ts +4 -0
  499. package/template/docker-compose.yml +11 -8
  500. package/template/docs/adr/0003-agent-session-event-source.md +3 -0
  501. package/template/docs/architecture/agent-harness.md +464 -0
  502. package/template/docs/architecture/agent-workflow.md +110 -0
  503. package/template/docs/architecture/ai-runtime.md +55 -47
  504. package/template/docs/architecture/durable-jobs.md +7 -0
  505. package/template/docs/architecture/module-host.md +4 -3
  506. package/template/docs/operations/adk-retirement.md +98 -0
  507. package/template/docs/operations/agent-session-memory.md +163 -0
  508. package/template/docs/operations/agent-session-troubleshooting.md +281 -0
  509. package/template/docs/operations/agent-workflow-recovery.md +85 -0
  510. package/template/docs/operations/incremental-delivery.md +1 -1
  511. package/template/docs/platform/agent-production-store.md +82 -0
  512. package/template/docs/platform/agent-run-reattachment.md +52 -0
  513. package/template/docs/platform/agent-runtime-observability.md +4 -3
  514. package/template/docs/platform/agent-runtime.md +116 -281
  515. package/template/docs/platform/agent-tool-approval.md +61 -0
  516. package/template/docs/platform/background-ai-operations.md +50 -0
  517. package/template/docs/platform/client-agent-session.md +319 -0
  518. package/template/docs/platform/embedding-ai-runtime.md +94 -0
  519. package/template/docs/platform/platform-authentication.md +5 -8
  520. package/template/package.json +0 -1
  521. package/template/packages/ai-client/index.ts +1 -0
  522. package/template/packages/ai-client/package.json +3 -1
  523. package/template/packages/ai-client/src/agent/client/client.ts +15 -2
  524. package/template/packages/ai-client/src/agent/client/run-protocol.test.ts +39 -25
  525. package/template/packages/ai-client/src/agent/client/types.ts +4 -0
  526. package/template/packages/ai-client/src/agent/contracts/contracts.test.ts +49 -7
  527. package/template/packages/ai-client/src/agent/contracts/events.ts +61 -0
  528. package/template/packages/ai-client/src/agent/contracts/runs.ts +1 -0
  529. package/template/packages/ai-client/src/client-agent/contracts.ts +131 -0
  530. package/template/packages/ai-client/src/client-agent/http.test.ts +60 -0
  531. package/template/packages/ai-client/src/client-agent/http.ts +66 -0
  532. package/template/packages/ai-client/src/client-agent/index.ts +4 -0
  533. package/template/packages/ai-client/src/client-agent/validation.test.ts +57 -0
  534. package/template/packages/ai-client/src/client-agent/validation.ts +152 -0
  535. package/template/packages/ai-client/src/client-agent/workflow-artifact/contracts.ts +85 -0
  536. package/template/packages/ai-client/src/client-agent/workflow-artifact/http.test.ts +49 -0
  537. package/template/packages/ai-client/src/client-agent/workflow-artifact/http.ts +82 -0
  538. package/template/packages/ai-client/src/client-agent/workflow-artifact/index.ts +3 -0
  539. package/template/packages/ai-client/src/client-agent/workflow-artifact/validation.test.ts +154 -0
  540. package/template/packages/ai-client/src/client-agent/workflow-artifact/validation.ts +332 -0
  541. package/template/packages/config/index.test.ts +18 -0
  542. package/template/packages/config/package.json +1 -1
  543. package/template/packages/config/src/platform-validation.ts +8 -0
  544. package/template/packages/config/src/platform.ts +22 -9
  545. package/template/packages/database/drizzle/0055_square_yellowjacket.sql +47 -0
  546. package/template/packages/database/drizzle/0056_tricky_living_mummy.sql +2 -0
  547. package/template/packages/database/drizzle/0057_mature_doomsday.sql +4 -0
  548. package/template/packages/database/drizzle/0058_agent_session_memory.sql +159 -0
  549. package/template/packages/database/drizzle/0059_agent_source_module_key.sql +16 -0
  550. package/template/packages/database/drizzle/0060_slimy_rocket_raccoon.sql +43 -0
  551. package/template/packages/database/drizzle/0061_agent_workflow.sql +303 -0
  552. package/template/packages/database/drizzle/0062_client_agent_workflow_artifact.sql +63 -0
  553. package/template/packages/database/drizzle/meta/0055_snapshot.json +11071 -0
  554. package/template/packages/database/drizzle/meta/0056_snapshot.json +11098 -0
  555. package/template/packages/database/drizzle/meta/0057_snapshot.json +10878 -0
  556. package/template/packages/database/drizzle/meta/0058_snapshot.json +12294 -0
  557. package/template/packages/database/drizzle/meta/0059_snapshot.json +12344 -0
  558. package/template/packages/database/drizzle/meta/0060_snapshot.json +12326 -0
  559. package/template/packages/database/drizzle/meta/0061_snapshot.json +14395 -0
  560. package/template/packages/database/drizzle/meta/0062_snapshot.json +14839 -0
  561. package/template/packages/database/drizzle/meta/_journal.json +56 -0
  562. package/template/packages/database/package.json +1 -1
  563. package/template/packages/database/src/agent-runtime-schema.test.ts +203 -0
  564. package/template/packages/database/src/schema/agent-context-message.ts +38 -0
  565. package/template/packages/database/src/schema/agent-runtime.ts +7 -0
  566. package/template/packages/database/src/schema/agent-session-receipt.ts +36 -0
  567. package/template/packages/database/src/schema/agent-session.ts +344 -0
  568. package/template/packages/database/src/schema/agent-workflow-delegation.ts +126 -0
  569. package/template/packages/database/src/schema/agent-workflow-effects.ts +213 -0
  570. package/template/packages/database/src/schema/agent-workflow-evaluation.ts +67 -0
  571. package/template/packages/database/src/schema/agent-workflow.ts +270 -0
  572. package/template/packages/database/src/schema/client-agent-workflow-artifact.ts +158 -0
  573. package/template/packages/database/src/schema/client-agent.ts +95 -0
  574. package/template/packages/database/src/schema/index.ts +9 -0
  575. package/template/packages/jobs/package.json +1 -1
  576. package/template/packages/jobs/src/handlers.test.ts +10 -0
  577. package/template/packages/jobs/src/handlers.ts +28 -11
  578. package/template/packages/modules/index.ts +2 -0
  579. package/template/packages/modules/package.json +1 -1
  580. package/template/packages/modules/src/ai-client-execution-composition.test.ts +98 -0
  581. package/template/packages/modules/src/ai-client-execution-policy.ts +60 -0
  582. package/template/packages/modules/src/ai-operation-composition.ts +2 -0
  583. package/template/packages/modules/src/manifest.ts +17 -0
  584. package/template/packages/modules/src/system-admin-routes.ts +16 -0
  585. package/template/packages/modules/src/system-admin-ui-catalog.ts +4 -1
  586. package/template/packages/modules/src/system-agent-audit-actions.ts +29 -0
  587. package/template/packages/modules/src/system-ai-api-bindings.ts +277 -0
  588. package/template/packages/modules/src/system-api-control-plane.ts +4 -78
  589. package/template/packages/modules/src/system-audit-actions.ts +128 -0
  590. package/template/packages/modules/src/system-features.ts +17 -0
  591. package/template/packages/modules/src/system-module-catalog.ts +21 -11
  592. package/template/packages/modules/src/system-modules.ts +22 -0
  593. package/template/packages/modules/src/system-permissions.ts +8 -0
  594. package/template/packages/server-sdk/index.ts +95 -0
  595. package/template/packages/server-sdk/package.json +9 -1
  596. package/template/packages/server-sdk/src/agent-session-memory-port.ts +64 -0
  597. package/template/packages/server-sdk/src/agent-session-provider.ts +63 -0
  598. package/template/packages/server-sdk/src/agent-source-invalidation-port.ts +54 -0
  599. package/template/packages/server-sdk/src/ai-operation-registration.ts +2 -0
  600. package/template/packages/server-sdk/src/client-agent-session.ts +107 -0
  601. package/template/packages/server-sdk/src/client-agent-workflow-artifact.contract.test.ts +113 -0
  602. package/template/packages/server-sdk/src/client-agent-workflow-artifact.ts +183 -0
  603. package/template/packages/server-sdk/src/debug-session-provider.ts +14 -63
  604. package/template/packages/server-sdk/src/durable-handler.ts +7 -0
  605. package/template/packages/server-sdk/src/module-host.ts +7 -3
  606. package/template/packages/server-sdk/src/request-context.ts +13 -0
  607. package/template/packages/server-sdk/src/workflow-input-artifact-port.ts +104 -0
  608. package/template/packages/server-sdk/src/workflow-input-artifact-validation.contract.test.ts +124 -0
  609. package/template/packages/server-sdk/src/workflow-input-artifact-validation.ts +347 -0
  610. package/template/packages/server-sdk/src/workflow-input-materialization-handler.ts +43 -0
  611. package/template/packages/shared/index.ts +3 -0
  612. package/template/packages/shared/package.json +1 -1
  613. package/template/packages/shared/src/agent-workflow-definition.ts +113 -0
  614. package/template/packages/shared/src/agent-workflow-delegation.ts +123 -0
  615. package/template/packages/shared/src/agent-workflow-evaluation.ts +159 -0
  616. package/template/packages/shared/src/agent-workflow-events.ts +99 -0
  617. package/template/packages/shared/src/agent-workflow-run.ts +259 -0
  618. package/template/packages/shared/src/agent-workflow.ts +3 -0
  619. package/template/packages/shared/src/ai-runtime-report.ts +25 -0
  620. package/template/packages/shared/src/rbac.ts +24 -0
  621. package/template/packages/storage/package.json +1 -1
  622. package/template/packages/storage/src/blob-store-put-once.test.ts +70 -0
  623. package/template/packages/storage/src/blob-store.ts +9 -0
  624. package/template/packages/storage/src/local-file-blob-put-once.ts +120 -0
  625. package/template/packages/storage/src/local-file-blob-store.ts +53 -1
  626. package/template/packages/storage/src/memory-blob-store.ts +73 -33
  627. package/template/packages/storage/src/upload-streams.test.ts +31 -0
  628. package/template/packages/storage/src/upload-streams.ts +20 -6
  629. package/template/apps/agent-server/adk_web_agents/__init__.py +0 -1
  630. package/template/apps/agent-server/adk_web_agents/canonical_debug/__init__.py +0 -1
  631. package/template/apps/agent-server/adk_web_agents/canonical_debug/agent.py +0 -145
  632. package/template/apps/agent-server/adk_web_agents/safe_debug/__init__.py +0 -3
  633. package/template/apps/agent-server/adk_web_agents/safe_debug/agent.py +0 -40
  634. package/template/apps/agent-server/adk_web_agents/services.py +0 -25
  635. package/template/apps/agent-server/project/adk-web-debug.json +0 -4
  636. package/template/apps/agent-server/src/southwind_agent_server/adk_adapter.py +0 -333
  637. package/template/apps/agent-server/src/southwind_agent_server/adk_debug.py +0 -348
  638. package/template/apps/agent-server/src/southwind_agent_server/adk_debug_sessions.py +0 -325
  639. package/template/apps/agent-server/src/southwind_agent_server/adk_failure.py +0 -13
  640. package/template/apps/agent-server/src/southwind_agent_server/adk_model.py +0 -304
  641. package/template/apps/agent-server/src/southwind_agent_server/adk_tools.py +0 -143
  642. package/template/apps/agent-server/tests/test_adk_adapter.py +0 -307
  643. package/template/apps/agent-server/tests/test_adk_debug_result_polling.py +0 -139
  644. package/template/apps/agent-server/tests/test_adk_debug_sessions.py +0 -215
  645. package/template/apps/agent-server/tests/test_adk_web_agent.py +0 -12
  646. package/template/apps/agent-server/tests/test_adk_web_canonical_debug.py +0 -282
  647. package/template/apps/server/src/agent/run-debug-authorization.ts +0 -27
  648. package/template/apps/server/src/agent/run-facade-adk-debug.test.ts +0 -95
  649. package/template/apps/server/src/runtime-adk-debug.test.ts +0 -270
  650. package/template/apps/server/src/runtime-adk-debug.ts +0 -164
  651. package/template/apps/server/src/runtime-request-actor.test.ts +0 -55
  652. package/template/apps/server/src/runtime-request-actor.ts +0 -22
  653. package/template/docker-compose.agent-debug.yml +0 -58
  654. package/template/scripts/dev-adk-web.ts +0 -107
package/dist/cli.js CHANGED
@@ -271,6 +271,193 @@ function optionalModule(name, label, description, dependencies) {
271
271
  };
272
272
  }
273
273
 
274
+ // src/optional-module-agent.ts
275
+ var agentOptionalModule = {
276
+ ...optionalModule("system.agent", "Agent Tool", "\u53D7\u63A7 Agent \u5DE5\u5177\u5BBF\u4E3B\u3002", [
277
+ "system",
278
+ "system.audit",
279
+ "system.storage",
280
+ "system.scheduler",
281
+ "system.workflow"
282
+ ]),
283
+ registryDependencies: [
284
+ {
285
+ sourceName: "@modelcontextprotocol/sdk",
286
+ name: "@modelcontextprotocol/sdk",
287
+ version: "^1.29.0"
288
+ },
289
+ {
290
+ sourceName: "ajv",
291
+ name: "ajv",
292
+ version: "^8.20.0"
293
+ }
294
+ ],
295
+ fileRoots: [
296
+ "apps/agent-server",
297
+ "apps/document-server",
298
+ "apps/speech-server",
299
+ "apps/embedding-server",
300
+ "apps/server/src/agent",
301
+ "apps/server/src/agent-workflow",
302
+ "apps/server/src/ai-runtime-report",
303
+ "apps/server/src/ai-runtime-readiness",
304
+ "apps/server/src/app/ai-screenshot-intake-binding.ts",
305
+ "apps/server/src/app/agent-runtime-composition.ts",
306
+ "apps/server/src/app/client-agent-host-auth-binding.ts",
307
+ "apps/server/src/app/client-agent-workflow-artifact-binding.ts",
308
+ "apps/server/src/app/document-output-artifact-bindings.ts",
309
+ "apps/server/src/app/speech-output-artifact-bindings.ts",
310
+ "apps/server/src/ai-artifact",
311
+ "apps/server/src/ai-output-artifact",
312
+ "apps/server/src/document",
313
+ "apps/server/src/speech",
314
+ "apps/server/src/embedding",
315
+ "apps/server/src/mcp",
316
+ "apps/server/src/module-host/ai-operation-port.ts",
317
+ "apps/server/src/module-host/ai-operation-port.test.ts",
318
+ "apps/server/src/module-host/agent-session-memory-port.ts",
319
+ "apps/server/src/module-host/agent-source-invalidation-port.ts",
320
+ "apps/server/src/module-host/workflow-input-artifact-port.ts",
321
+ "apps/server/src/module-host/workflow-input-artifact-port.test.ts",
322
+ "apps/server/src/module-host/workflow-input-materialization.ts",
323
+ "apps/server/src/module-host/workflow-input-materialization.test.ts",
324
+ "apps/server/src/module-host/tool-handlers.ts",
325
+ "apps/server/src/module-host/tool-handlers.test.ts",
326
+ "apps/server/src/module-host/module-secret-tool-boundary.test.ts",
327
+ "apps/web/src/pages/system/AiRuntimePage.vue",
328
+ "apps/web/src/pages/system/AgentSessionPage.vue",
329
+ "apps/web/src/pages/system/AgentSessionPage.webtest.ts",
330
+ "apps/web/src/pages/system/AgentWorkflowPage.vue",
331
+ "apps/web/src/pages/system/ai-runtime-presenter.ts",
332
+ "apps/web/src/pages/system/ai-runtime-presenter.webtest.ts",
333
+ "apps/web/src/pages/system/components/ai-runtime",
334
+ "apps/web/src/pages/system/components/agent-session",
335
+ "apps/web/src/pages/system/components/agent-workflow",
336
+ "apps/web/src/pages/system/composables/useAgentWorkflowRuns.ts",
337
+ "apps/web/src/pages/system/composables/useAgentSessions.ts",
338
+ "apps/web/src/pages/system/composables/useAgentSessions.webtest.ts",
339
+ "apps/web/src/pages/system/composables/useAiRuntimeReport.ts",
340
+ "apps/web/src/pages/system/composables/useAiRuntimeReport.webtest.ts",
341
+ "apps/web/src/services/agent-workflow-api.ts",
342
+ "apps/web/src/services/agent-session-api.ts",
343
+ "apps/web/src/services/agent-session-api.webtest.ts",
344
+ "apps/web/src/services/ai-runtime-api.ts",
345
+ "apps/web/src/services/ai-runtime-api.webtest.ts",
346
+ "scripts/provision-speech-readiness.ts",
347
+ "packages/modules/src/system-agent-audit-actions.ts",
348
+ "packages/modules/src/system-agent-tools.ts",
349
+ "packages/modules/src/system-agent-supervisor.ts",
350
+ "packages/modules/src/system-agent-supervisor.test.ts",
351
+ "packages/modules/src/system-ai-api-bindings.ts",
352
+ "packages/server-sdk/src/system-agent-supervisor.ts",
353
+ "packages/server-sdk/src/system-agent-supervisor.test.ts",
354
+ "packages/server-sdk/src/client-agent-workflow-artifact.ts",
355
+ "packages/server-sdk/src/client-agent-workflow-artifact.contract.test.ts",
356
+ "packages/server-sdk/src/workflow-input-artifact-port.ts",
357
+ "packages/server-sdk/src/workflow-input-artifact-validation.ts",
358
+ "packages/server-sdk/src/workflow-input-artifact-validation.contract.test.ts",
359
+ "packages/server-sdk/src/workflow-input-materialization-handler.ts",
360
+ "packages/database/src/agent-runtime-schema.test.ts",
361
+ "packages/database/src/ai-output-artifacts.test.ts",
362
+ "packages/shared/src/agent-workflow-definition.ts",
363
+ "packages/shared/src/agent-workflow-delegation.ts",
364
+ "packages/shared/src/agent-workflow-evaluation.ts",
365
+ "packages/shared/src/agent-workflow-events.ts",
366
+ "packages/shared/src/agent-workflow-run.ts",
367
+ "packages/shared/src/agent-workflow.ts",
368
+ "packages/shared/src/ai-runtime-report.ts",
369
+ "packages/shared/src/screenshot-context-digest.ts",
370
+ "packages/shared/src/screenshot-context-digest.test.ts"
371
+ ],
372
+ documentation: [
373
+ "docs/adr/0003-agent-session-event-source.md",
374
+ "docs/architecture/agent-harness.md",
375
+ "docs/architecture/agent-workflow.md",
376
+ "docs/architecture/durable-jobs.md",
377
+ "docs/architecture/ai-egress.md",
378
+ "docs/architecture/ai-runtime-readiness.md",
379
+ "docs/architecture/ai-runtime.md",
380
+ "docs/architecture/mcp-business-capabilities.md",
381
+ "docs/operations/agent-session-memory.md",
382
+ "docs/operations/agent-session-troubleshooting.md",
383
+ "docs/operations/agent-workflow-recovery.md",
384
+ "docs/operations/adk-retirement.md",
385
+ "docs/platform/agent-run-attestation.md",
386
+ "docs/platform/client-agent-session.md",
387
+ "docs/platform/vision-ai-runtime.md",
388
+ "docs/platform/agent-runtime.md",
389
+ "docs/platform/agent-runtime-observability.md",
390
+ "docs/platform/agent-supervisor-output-contract.md",
391
+ "docs/platform/agent-tools.md",
392
+ "docs/platform/agent-tool-approval.md",
393
+ "docs/platform/agent-tool-sandbox.md",
394
+ "docs/platform/agent-production-store.md",
395
+ "docs/platform/agent-run-reattachment.md",
396
+ "docs/platform/background-ai-operations.md",
397
+ "docs/platform/document-ai-runtime.md",
398
+ "docs/platform/speech-ai-runtime.md",
399
+ "docs/platform/embedding-ai-runtime.md"
400
+ ],
401
+ schemaFiles: [
402
+ "packages/database/src/schema/agent-runtime.ts",
403
+ "packages/database/src/schema/agent-context-message.ts",
404
+ "packages/database/src/schema/agent-session-receipt.ts",
405
+ "packages/database/src/schema/agent-session.ts",
406
+ "packages/database/src/schema/agent-workflow.ts",
407
+ "packages/database/src/schema/agent-workflow-delegation.ts",
408
+ "packages/database/src/schema/agent-workflow-effects.ts",
409
+ "packages/database/src/schema/agent-workflow-evaluation.ts",
410
+ "packages/database/src/schema/client-agent.ts",
411
+ "packages/database/src/schema/client-agent-workflow-artifact.ts",
412
+ "packages/database/src/schema/embedding-runtime.ts",
413
+ "packages/database/src/schema/ai-output-artifacts.ts"
414
+ ],
415
+ databaseTables: [
416
+ "agent_operation_releases",
417
+ "agent_runtime_runs",
418
+ "agent_runtime_events",
419
+ "agent_evaluation_results",
420
+ "agent_run_bindings",
421
+ "agent_screenshot_intakes",
422
+ "agent_runtime_report_runs",
423
+ "agent_runtime_report_attempts",
424
+ "client_agent_sessions",
425
+ "client_agent_receipts",
426
+ "client_agent_workflow_artifacts",
427
+ "embedding_run_bindings",
428
+ "ai_output_artifact_scopes",
429
+ "ai_output_artifacts",
430
+ "agent_sessions",
431
+ "agent_session_events",
432
+ "agent_session_checkpoints",
433
+ "agent_context_versions",
434
+ "agent_context_sources",
435
+ "agent_context_messages",
436
+ "agent_memory_projections",
437
+ "agent_memory_sources",
438
+ "agent_source_invalidations",
439
+ "agent_source_invalidation_deliveries",
440
+ "agent_session_run_projection_receipts",
441
+ "agent_workflow_definitions",
442
+ "agent_workflow_releases",
443
+ "agent_workflow_runs",
444
+ "agent_workflow_node_runs",
445
+ "agent_workflow_events",
446
+ "agent_workflow_delegations",
447
+ "agent_workflow_budget_reservations",
448
+ "agent_workflow_side_effect_commands",
449
+ "agent_workflow_side_effect_receipts",
450
+ "agent_workflow_evaluations"
451
+ ],
452
+ databaseStatementTokens: [
453
+ "idx_agent_context_sources_origin",
454
+ "idx_agent_memory_sources_origin",
455
+ "uk_agent_source_invalidations_sequence",
456
+ "agent_workflow_",
457
+ "client_agent_workflow_"
458
+ ]
459
+ };
460
+
274
461
  // src/optional-module-storage.ts
275
462
  var storageOptionalModule = {
276
463
  ...optionalModule("system.storage", "\u6587\u4EF6\u5B58\u50A8", "\u4E0A\u4F20\u3001\u4E0B\u8F7D\u548C\u5BF9\u8C61\u751F\u547D\u5468\u671F\u3002", ["system", "system.settings", "system.scheduler"]),
@@ -320,104 +507,7 @@ var storageOptionalModule = {
320
507
  // src/optional-module-distribution.ts
321
508
  var optionalModuleManifests = [
322
509
  storageOptionalModule,
323
- {
324
- ...optionalModule("system.agent", "Agent Tool", "\u53D7\u63A7 Agent \u5DE5\u5177\u5BBF\u4E3B\u3002", [
325
- "system",
326
- "system.audit",
327
- "system.storage",
328
- "system.scheduler",
329
- "system.workflow"
330
- ]),
331
- registryDependencies: [
332
- {
333
- sourceName: "@modelcontextprotocol/sdk",
334
- name: "@modelcontextprotocol/sdk",
335
- version: "^1.29.0"
336
- },
337
- {
338
- sourceName: "ajv",
339
- name: "ajv",
340
- version: "^8.20.0"
341
- }
342
- ],
343
- fileRoots: [
344
- "apps/agent-server",
345
- "apps/document-server",
346
- "apps/speech-server",
347
- "apps/embedding-server",
348
- "apps/server/src/agent",
349
- "apps/server/src/ai-runtime-report",
350
- "apps/server/src/ai-runtime-readiness",
351
- "apps/server/src/app/ai-screenshot-intake-binding.ts",
352
- "apps/server/src/app/document-output-artifact-bindings.ts",
353
- "apps/server/src/app/speech-output-artifact-bindings.ts",
354
- "apps/server/src/ai-artifact",
355
- "apps/server/src/ai-output-artifact",
356
- "apps/server/src/document",
357
- "apps/server/src/speech",
358
- "apps/server/src/embedding",
359
- "apps/server/src/mcp",
360
- "apps/server/src/runtime-adk-debug.ts",
361
- "apps/server/src/runtime-adk-debug.test.ts",
362
- "apps/server/src/module-host/ai-operation-port.ts",
363
- "apps/server/src/module-host/ai-operation-port.test.ts",
364
- "apps/server/src/module-host/tool-handlers.ts",
365
- "apps/server/src/module-host/tool-handlers.test.ts",
366
- "apps/server/src/module-host/module-secret-tool-boundary.test.ts",
367
- "apps/web/src/pages/system/AiRuntimePage.vue",
368
- "apps/web/src/pages/system/ai-runtime-presenter.ts",
369
- "apps/web/src/pages/system/ai-runtime-presenter.webtest.ts",
370
- "apps/web/src/pages/system/components/ai-runtime",
371
- "apps/web/src/pages/system/composables/useAiRuntimeReport.ts",
372
- "apps/web/src/pages/system/composables/useAiRuntimeReport.webtest.ts",
373
- "apps/web/src/services/ai-runtime-api.ts",
374
- "apps/web/src/services/ai-runtime-api.webtest.ts",
375
- "docker-compose.agent-debug.yml",
376
- "scripts/dev-adk-web.ts",
377
- "scripts/provision-speech-readiness.ts",
378
- "packages/modules/src/system-agent-tools.ts",
379
- "packages/database/src/agent-runtime-schema.test.ts",
380
- "packages/database/src/ai-output-artifacts.test.ts",
381
- "packages/shared/src/ai-runtime-report.ts",
382
- "packages/shared/src/screenshot-context-digest.ts",
383
- "packages/shared/src/screenshot-context-digest.test.ts"
384
- ],
385
- documentation: [
386
- "docs/architecture/ai-runtime.md",
387
- "docs/architecture/mcp-business-capabilities.md",
388
- "docs/platform/agent-run-attestation.md",
389
- "docs/platform/agent-runtime.md",
390
- "docs/platform/agent-runtime-observability.md",
391
- "docs/platform/agent-supervisor-output-contract.md",
392
- "docs/platform/agent-tools.md",
393
- "docs/platform/agent-tool-approval.md",
394
- "docs/platform/agent-tool-sandbox.md",
395
- "docs/platform/agent-production-store.md",
396
- "docs/platform/agent-run-reattachment.md",
397
- "docs/platform/background-ai-operations.md",
398
- "docs/platform/document-ai-runtime.md",
399
- "docs/platform/speech-ai-runtime.md",
400
- "docs/platform/embedding-ai-runtime.md"
401
- ],
402
- schemaFiles: [
403
- "packages/database/src/schema/agent-runtime.ts",
404
- "packages/database/src/schema/embedding-runtime.ts",
405
- "packages/database/src/schema/ai-output-artifacts.ts"
406
- ],
407
- databaseTables: [
408
- "agent_operation_releases",
409
- "agent_runtime_runs",
410
- "agent_runtime_events",
411
- "agent_evaluation_results",
412
- "agent_run_bindings",
413
- "agent_screenshot_intakes",
414
- "agent_runtime_report_runs",
415
- "agent_runtime_report_attempts",
416
- "embedding_run_bindings",
417
- "ai_output_artifact_scopes",
418
- "ai_output_artifacts"
419
- ]
420
- },
510
+ agentOptionalModule,
421
511
  {
422
512
  ...optionalModule("system.scheduler", "\u4EFB\u52A1\u8C03\u5EA6", "\u4EFB\u52A1\u3001\u91CD\u8BD5\u3001\u5386\u53F2\u548C\u6062\u590D\u3002", ["system", "system.audit"]),
423
513
  fileRoots: [
@@ -1109,7 +1199,6 @@ import { lstat, open, readFile, rename, rm } from "fs/promises";
1109
1199
  import { join } from "path";
1110
1200
  var managedSecretKeys = [
1111
1201
  "AGENT_SERVER_INTERNAL_TOKEN",
1112
- "ADK_DEBUG_PLATFORM_TOKEN",
1113
1202
  "AGENT_RUN_ENCRYPTION_SECRET",
1114
1203
  "AI_ARTIFACT_ENCRYPTION_SECRET",
1115
1204
  "EMBEDDING_RUN_ENCRYPTION_SECRET",
@@ -1128,9 +1217,6 @@ async function initializeLocalEnvironment(projectRoot, generateSecret = defaultS
1128
1217
  if (/^AGENT_SERVER_INTERNAL_TOKEN=[ \t\r]*$/m.test(content)) {
1129
1218
  content = setEmptyVariable(content, "AGENT_SERVER_INTERNAL_TOKEN", generateSecret());
1130
1219
  }
1131
- if (/^ADK_DEBUG_PLATFORM_TOKEN=[ \t\r]*$/m.test(content)) {
1132
- content = setEmptyVariable(content, "ADK_DEBUG_PLATFORM_TOKEN", generateSecret());
1133
- }
1134
1220
  if (/^AGENT_RUN_ENCRYPTION_SECRET=[ \t\r]*$/m.test(content)) {
1135
1221
  content = setEmptyVariable(content, "AGENT_RUN_ENCRYPTION_SECRET", generateSecret());
1136
1222
  }
@@ -2710,11 +2796,8 @@ function dockerManifestCopyLines(directories) {
2710
2796
  return directories.map((directory) => `COPY ${directory}/package.json ${directory}/package.json`);
2711
2797
  }
2712
2798
  function rewriteAnchoredSection(source, anchor, lines) {
2713
- const { begin, end } = locateAnchoredSection(source, anchor);
2714
- const all = source.split(`
2715
- `);
2716
- return [...all.slice(0, begin + 1), ...lines, ...all.slice(end)].join(`
2717
- `);
2799
+ const { begin, end, eol, lines: all } = locateAnchoredSection(source, anchor);
2800
+ return [...all.slice(0, begin + 1), ...lines, ...all.slice(end)].join(eol);
2718
2801
  }
2719
2802
  function hasDockerfileCopyAnchors(source, target) {
2720
2803
  return source.includes(`# ${depsCopyAnchor} begin`) && source.includes(`# ${depsCopyAnchor} end`) && (!target.includeBuildClosure || source.includes(`# ${buildCopyAnchor} begin`) && source.includes(`# ${buildCopyAnchor} end`));
@@ -2764,8 +2847,11 @@ async function planDockerfileInProject(root, target, options = {}) {
2764
2847
  function locateAnchoredSection(source, anchor) {
2765
2848
  const beginMarker = `# ${anchor} begin`;
2766
2849
  const endMarker = `# ${anchor} end`;
2767
- const lines = source.split(`
2768
- `);
2850
+ const eol = source.includes(`\r
2851
+ `) ? `\r
2852
+ ` : `
2853
+ `;
2854
+ const lines = source.split(eol);
2769
2855
  const begin = lines.indexOf(beginMarker);
2770
2856
  const end = lines.indexOf(endMarker);
2771
2857
  if (begin === -1 || end === -1 || end <= begin) {
@@ -2774,7 +2860,7 @@ function locateAnchoredSection(source, anchor) {
2774
2860
  if (lines.indexOf(beginMarker, begin + 1) !== -1 || lines.indexOf(endMarker, end + 1) !== -1) {
2775
2861
  throw new Error(`Dockerfile \u951A\u70B9\u6BB5 ${anchor} \u91CD\u590D\uFF0C\u8BF7\u4FDD\u7559\u552F\u4E00\u4E00\u6BB5`);
2776
2862
  }
2777
- return { begin, end };
2863
+ return { begin, end, eol, lines };
2778
2864
  }
2779
2865
  function parseManifest(content) {
2780
2866
  return JSON.parse(new TextDecoder().decode(content));
@@ -3163,8 +3249,25 @@ var starterServerBuild = ` build:
3163
3249
  context: .
3164
3250
  dockerfile: apps/server/Dockerfile
3165
3251
  args:
3166
- WINDY_DEBIAN_MIRROR: \${WINDY_DEBIAN_MIRROR:-http://mirrors.aliyun.com/debian}
3167
- WINDY_DEBIAN_SECURITY_MIRROR: \${WINDY_DEBIAN_SECURITY_MIRROR:-http://mirrors.aliyun.com/debian-security}`;
3252
+ WINDY_DEBIAN_MIRROR: \${WINDY_DEBIAN_MIRROR:-http://deb.debian.org/debian}
3253
+ WINDY_DEBIAN_SECURITY_MIRROR: \${WINDY_DEBIAN_SECURITY_MIRROR:-http://deb.debian.org/debian-security}`;
3254
+ function agentWorkflowServerEnvironment(includeAgent) {
3255
+ return includeAgent ? " WINDY_AGENT_WORKFLOW_MODEL_PRICING_JSON: ${WINDY_AGENT_WORKFLOW_MODEL_PRICING_JSON:-}" : "";
3256
+ }
3257
+ function optionalComposeVolumes(includeAgent, includeSearch, includeStorage) {
3258
+ return [
3259
+ ...includeAgent ? [
3260
+ " agent-run-data:",
3261
+ " tool-sandbox-ipc:",
3262
+ " document-run-data:",
3263
+ " speech-run-data:",
3264
+ " embedding-run-data:"
3265
+ ] : [],
3266
+ ...includeSearch ? [" opensearch-data:"] : [],
3267
+ ...includeStorage ? [" server-storage-data:"] : []
3268
+ ].join(`
3269
+ `);
3270
+ }
3168
3271
 
3169
3272
  // src/runtime-profile-files.ts
3170
3273
  var starterComposeBase = `services:
@@ -3210,9 +3313,11 @@ __STORAGE_SERVER_ENV__
3210
3313
  WINDY_SYSTEM_USAGE_PATHS: /app/data/audit
3211
3314
  PLATFORM_ENABLE_AI: \${PLATFORM_ENABLE_AI:-false}
3212
3315
  AGENT_SERVER_URL: http://agent-server:8080
3316
+ WINDY_PUBLIC_BASE_URL: \${WINDY_PUBLIC_BASE_URL:-http://localhost:9747}
3213
3317
  AGENT_TOOL_HOST_URL: http://server:9747
3214
3318
  __TOOL_SANDBOX_SERVER_ENV__
3215
3319
  AGENT_SERVER_INTERNAL_TOKEN: \${AGENT_SERVER_INTERNAL_TOKEN:-}
3320
+ __AGENT_WORKFLOW_SERVER_ENV__
3216
3321
  AI_ARTIFACT_URL: http://server:9747/api/internal/ai/artifacts
3217
3322
  AI_ARTIFACT_ENCRYPTION_SECRET: \${AI_ARTIFACT_ENCRYPTION_SECRET:-}
3218
3323
  DOCUMENT_SERVER_URL: \${DOCUMENT_SERVER_URL:-}
@@ -3321,6 +3426,7 @@ ${starterServerBuild}
3321
3426
  WINDY_PYPI_INDEX_URL: \${WINDY_PYPI_INDEX_URL:-http://mirrors.cloud.tencent.com/pypi/simple}
3322
3427
  environment:
3323
3428
  AGENT_SERVER_INTERNAL_TOKEN: \${AGENT_SERVER_INTERNAL_TOKEN:-}
3429
+ AGENT_CONTEXT_HOST_URL: http://server:9747
3324
3430
  AGENT_RUN_STORE_PATH: /app/data/agent/runs.sqlite3
3325
3431
  AGENT_DATABASE_URL: postgresql://windy:\${POSTGRES_PASSWORD}@postgres:5432/windy
3326
3432
  AGENT_RUN_ENCRYPTION_SECRET: \${AGENT_RUN_ENCRYPTION_SECRET:-}
@@ -3453,19 +3559,10 @@ ${starterServerBuild}
3453
3559
  function starterComposeFor(includeAgent, includeSearch = true, includeStorage = true) {
3454
3560
  return starterComposeBase.replace(` web:
3455
3561
  `, `${includeAgent ? agentComposeService : ""} web:
3456
- `).replace("__TOOL_SANDBOX_SERVER_ENV__", includeAgent ? " TOOL_SANDBOX_SOCKET: /run/windy-tool-sandbox/worker.sock" : "").replace("__TOOL_SANDBOX_SERVER_VOLUME__", includeAgent ? " - tool-sandbox-ipc:/run/windy-tool-sandbox" : "").replace("__STORAGE_SERVER_ENV__", includeStorage ? " WINDY_STORAGE_ROOT: /app/data/storage" : "").replace("__STORAGE_SERVER_VOLUME__", includeStorage ? " - server-storage-data:/app/data/storage" : "").replace("__OPENSEARCH_SERVER_ENV__", includeSearch ? ` OPENSEARCH_URL: \${OPENSEARCH_URL:-}
3562
+ `).replace("__TOOL_SANDBOX_SERVER_ENV__", includeAgent ? " TOOL_SANDBOX_SOCKET: /run/windy-tool-sandbox/worker.sock" : "").replace("__AGENT_WORKFLOW_SERVER_ENV__", agentWorkflowServerEnvironment(includeAgent)).replace("__TOOL_SANDBOX_SERVER_VOLUME__", includeAgent ? " - tool-sandbox-ipc:/run/windy-tool-sandbox" : "").replace("__STORAGE_SERVER_ENV__", includeStorage ? " WINDY_STORAGE_ROOT: /app/data/storage" : "").replace("__STORAGE_SERVER_VOLUME__", includeStorage ? " - server-storage-data:/app/data/storage" : "").replace("__OPENSEARCH_SERVER_ENV__", includeSearch ? ` OPENSEARCH_URL: \${OPENSEARCH_URL:-}
3457
3563
  OPENSEARCH_USERNAME: \${OPENSEARCH_USERNAME:-}
3458
3564
  OPENSEARCH_PASSWORD: \${OPENSEARCH_PASSWORD:-}
3459
- OPENSEARCH_WORK_ORDER_INDEX: \${OPENSEARCH_WORK_ORDER_INDEX:-windy-work-orders-v1}` : "").replace("__OPENSEARCH_SERVICE__", includeSearch ? openSearchComposeService : "").replace("__OPTIONAL_VOLUMES__", [
3460
- includeAgent ? " agent-run-data:" : "",
3461
- includeAgent ? " tool-sandbox-ipc:" : "",
3462
- includeAgent ? " document-run-data:" : "",
3463
- includeAgent ? " speech-run-data:" : "",
3464
- includeAgent ? " embedding-run-data:" : "",
3465
- includeSearch ? " opensearch-data:" : "",
3466
- includeStorage ? " server-storage-data:" : ""
3467
- ].filter(Boolean).join(`
3468
- `));
3565
+ OPENSEARCH_WORK_ORDER_INDEX: \${OPENSEARCH_WORK_ORDER_INDEX:-windy-work-orders-v1}` : "").replace("__OPENSEARCH_SERVICE__", includeSearch ? openSearchComposeService : "").replace("__OPTIONAL_VOLUMES__", optionalComposeVolumes(includeAgent, includeSearch, includeStorage));
3469
3566
  }
3470
3567
  var starterCompose = starterComposeFor(true);
3471
3568
  // src/runtime-environment-example.ts
@@ -3480,18 +3577,20 @@ ${includeStorage ? `
3480
3577
  ` : ""}
3481
3578
  ${includeAgent ? `
3482
3579
  # Agent profile \u4EC5\u7531\u670D\u52A1\u7AEF Agent Runtime \u8BFB\u53D6\uFF1B\u4E0D\u8981\u4F7F\u7528 VITE_ \u524D\u7F00\u3002
3483
- # ADK Web \u901A\u8FC7 canonical Run API \u8C03\u8BD5\u9879\u76EE\u9009\u62E9\u7684\u771F\u5B9E\u6587\u672C Operation\uFF1B\u8C03\u8BD5 Token
3484
- # \u7531 create-windy \u81EA\u52A8\u751F\u6210\uFF0C\u53EA\u6CE8\u5165 Server \u4E0E localhost-only ADK Web\u3002
3485
3580
  PLATFORM_ENABLE_AI=false
3486
3581
  AGENT_SERVER_INTERNAL_TOKEN=
3487
- ADK_DEBUG_PLATFORM_TOKEN=
3488
3582
  AGENT_RUN_ENCRYPTION_SECRET=
3583
+ # Model \u8282\u70B9\u542F\u7528\u524D\u5FC5\u987B\u586B\u5165\u7531\u8FD0\u7EF4\u51BB\u7ED3\u7684 deployment/model \u4EF7\u683C\u76EE\u5F55\uFF1B\u7F3A\u5931\u65F6 readiness \u660E\u786E unavailable\u3002
3584
+ WINDY_AGENT_WORKFLOW_MODEL_PRICING_JSON=
3585
+ # \u975E Compose \u90E8\u7F72\u9700\u6307\u5411 Windy Server\uFF1B\u957F\u671F Session \u7684\u6A21\u578B\u8C03\u7528\u4F1A fail closed\u3002
3586
+ # AGENT_CONTEXT_HOST_URL=http://server:9747
3489
3587
  # \u591A\u526F\u672C\u751F\u4EA7\u9ED8\u8BA4\u4F7F\u7528 Compose \u6CE8\u5165\u7684 PostgreSQL\uFF1B\u7559\u7A7A\u624D\u56DE\u9000\u5355\u526F\u672C SQLite\u3002
3490
3588
  AGENT_DATABASE_URL=
3491
3589
  # \u53EF\u9009\uFF1A\u53EA\u53D1\u9001\u65E0 Prompt/\u8F93\u5165/\u8F93\u51FA\u7684 Agent Run \u5143\u6570\u636E Span\u3002
3492
3590
  OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=
3493
3591
  OTEL_EXPORTER_OTLP_HEADERS=
3494
3592
  AI_ARTIFACT_ENCRYPTION_SECRET=
3593
+ WINDY_PUBLIC_BASE_URL=http://localhost:9747
3495
3594
  DOCUMENT_SERVER_URL=
3496
3595
  DOCUMENT_ARTIFACT_URL=
3497
3596
  DOCUMENT_OUTPUT_ARTIFACT_URL=
@@ -3609,7 +3708,7 @@ ${includeStorage ? "- \u5927\u62A5\u544A\u5BFC\u5165\uFF1A[\u53D7\u6CBB\u7406\u7
3609
3708
  ${includeOfflineLicense ? "- License \u6D88\u8D39\u7AEF\uFF1A[\u79BB\u7EBF\u6FC0\u6D3B\u4E0E\u5B89\u88C5\u534F\u8BAE](./license/license-offline-activation-code.md)\u4E0E[\u624B\u673A\u626B\u7801\u914D\u5BF9\u6FC0\u6D3B](./license/license-pairing-activation.md)\uFF1B\u8FD0\u884C\u65F6\u80FD\u529B\u7531 npm \u4F9D\u8D56 `@southwind-ai/license` \u63D0\u4F9B\u3002" : ""}
3610
3709
  - \u8FD0\u7EF4\uFF1A[\u53EF\u89C2\u6D4B\u6027](./operations/observability.md)${includeOperations ? " \u4E0E [\u8FD0\u7EF4\u603B\u89C8](./platform/operations-overview.md)" : ""}\u3002
3611
3710
  - \u4EA4\u4ED8\uFF1A[\u6309 registry digest \u4E0E OCI blob \u5DEE\u91CF\u53D1\u5E03](./operations/incremental-delivery.md)\u3002
3612
- ${includeAgent ? "- Agent\u3001\u591A\u6A21\u6001 Runtime \u4E0E MCP\uFF1A[Agent Runtime \u63A5\u5165](./platform/agent-runtime.md)\u3001[Document AI Runtime](./platform/document-ai-runtime.md)\u3001[Speech AI Runtime](./platform/speech-ai-runtime.md)\u3001[\u53D7\u63A7\u5DE5\u5177](./platform/agent-tools.md)\u4E0E[MCP \u4E1A\u52A1\u80FD\u529B](./architecture/mcp-business-capabilities.md)\u3002" : ""}
3711
+ ${includeAgent ? "- Agent\u3001\u591A\u6A21\u6001 Runtime \u4E0E MCP\uFF1A[Agent Harness](./architecture/agent-harness.md)\u3001[Agent Runtime \u63A5\u5165](./platform/agent-runtime.md)\u3001[Session/Memory \u8FD0\u7EF4](./operations/agent-session-memory.md)\u3001[Session \u6545\u969C\u901F\u67E5](./operations/agent-session-troubleshooting.md)\u3001[Agent Workflow](./architecture/agent-workflow.md)\u3001[Workflow \u6062\u590D\u8FD0\u7EF4](./operations/agent-workflow-recovery.md)\u3001[Document AI Runtime](./platform/document-ai-runtime.md)\u3001[Speech AI Runtime](./platform/speech-ai-runtime.md)\u3001[\u53D7\u63A7\u5DE5\u5177](./platform/agent-tools.md)\u4E0E[MCP \u4E1A\u52A1\u80FD\u529B](./architecture/mcp-business-capabilities.md)\u3002" : ""}
3613
3712
  - \u517C\u5BB9\uFF1A[RuoYi-Vue Adapter](./adapters/ruoyi-vue-compatibility.md)\u3002
3614
3713
  `;
3615
3714
  }
@@ -3729,22 +3828,10 @@ Speech Runtime \u53EA\u63A5\u6536\u6388\u6743 Artifact\uFF0C\u8D1F\u8D23\u683C\u
3729
3828
  Artifact\uFF1B\u5B9E\u65F6 ASR\u3001TTS \u548C Dictation \u5C1A\u672A\u5F00\u653E\u3002\u8BE6\u89C1
3730
3829
  [Speech AI Runtime](./docs/platform/speech-ai-runtime.md)\u3002
3731
3830
 
3732
- \u5728 project-owned \u7684
3733
- \`apps/agent-server/project/adk-web-debug.json\` \u7ED1\u5B9A\u4E00\u4E2A\u6EE1\u8DB3
3734
- \`{ question: string } -> { text: string }\` \u7684\u771F\u5B9E Agent Operation \u4E0E\u5F53\u524D\u542F\u7528\u7684\u5F00\u53D1
3735
- \u6570\u636E\u7528\u6237\u540E\uFF0C\u53EF\u5728\u672C\u673A\u8C03\u8BD5\uFF1A
3736
-
3737
- \`\`\`bash
3738
- bun run dev:adk-web
3739
- \`\`\`
3740
-
3741
- \u8BBF\u95EE \`http://127.0.0.1:8000\` \u5E76\u9009\u62E9 \`canonical_debug\`\u3002\u8BE5\u547D\u4EE4\u4F1A\u540C\u65F6\u542F\u52A8\u5B8C\u6574
3742
- Agent Runtime\uFF1BWindy \u542F\u52A8\u811A\u672C\u8BFB\u53D6\u9879\u76EE\u9009\u62E9\u7684 Operation\uFF0CADK Web \u4F7F\u7528 create-windy
3743
- \u81EA\u52A8\u751F\u6210\u7684\u968F\u673A\u8C03\u8BD5 Token\uFF0C\u7ECF canonical HTTP/SSE \u6267\u884C\u771F\u5B9E Operation\u3002Server \u4E13\u7528\u8EAB\u4EFD
3744
- \u5411\u4E1A\u52A1 Module \u6295\u5F71\u8BE5\u7528\u6237\u7684\u771F\u5B9E\u6210\u5458 ID \u4E0E\u5F53\u524D Scope\uFF0C\u5E76\u628A\u6743\u9650\u6536\u7A84\u5230\u7528\u6237\u5DF2\u6709\u6743\u9650\u548C
3745
- Operation/allowed Tools \u95ED\u5305\uFF1B\u6838\u5FC3\u5BA1\u8BA1\u4E3B\u4F53\u4ECD\u4E3A ADK Debug Service\u3002\u666E\u901A \`dev\`\u3001
3746
- \`agent\` profile \u548C\u751F\u4EA7\u90E8\u7F72\u5747\u4E0D\u4F1A\u542F\u52A8\u6216\u66B4\u9732 ADK Web\uFF1B\u9875\u9762\u663E\u793A\u7684\u662F canonical Run
3747
- \u6458\u8981\uFF0C\u4E0D\u662F\u5185\u90E8\u5B8C\u6574 Workflow \u56FE\u3002
3831
+ \u5F00\u53D1\u4E0E\u5BA1\u8BA1\u7EDF\u4E00\u4F7F\u7528 Windy \u4E3B\u7AD9\uFF1A\`/admin/system/ai-runtime\` \u63D0\u4F9B\u53D7\u6743\u9650\u4FDD\u62A4\u7684 Run\u3001
3832
+ Provider Attempt \u4E0E\u8131\u654F Trajectory\uFF1B\u4E1A\u52A1\u6A21\u5757\u53EF\u901A\u8FC7 \`registerAgentSessionProviders()\`
3833
+ \u6CE8\u518C\u5386\u53F2\u4F1A\u8BDD\u53EA\u8BFB\u6295\u5F71\u3002\u4E24\u8005\u5747\u590D\u7528\u5F53\u524D\u767B\u5F55\u8EAB\u4EFD\u3001Manifest Feature/RBAC \u4E0E Audit\uFF0C\u4E0D\u521B\u5EFA
3834
+ \u7B2C\u4E8C\u79CD\u8C03\u8BD5 Token\uFF0C\u4E5F\u4E0D\u4F1A\u5C55\u793A\u8F93\u5165\u8F93\u51FA\u6B63\u6587\u3001Tool \u53C2\u6570\u6216 Provider \u539F\u59CB\u54CD\u5E94\u3002
3748
3835
  ` : ""}
3749
3836
  ${includeSearch ? `
3750
3837
  ## OpenSearch \u641C\u7D22 profile
@@ -3912,7 +3999,7 @@ function createStarterPackage(source, projectName, includeOxc = true, projectLic
3912
3999
  ...includeOxc ? { "lint-staged": sourceLintStaged ?? defaultLintStaged } : {},
3913
4000
  scripts: {
3914
4001
  ...includeOxc ? {
3915
- prepare: "git rev-parse --git-dir >/dev/null 2>&1 || exit 0; husky"
4002
+ prepare: "husky"
3916
4003
  } : {},
3917
4004
  dev: "docker compose up",
3918
4005
  "docker:sync": "create-windy sync-docker",
@@ -3923,8 +4010,7 @@ function createStarterPackage(source, projectName, includeOxc = true, projectLic
3923
4010
  ...selectedModules.includes("system.agent") ? {
3924
4011
  "dev:agent": "docker compose --profile agent up --build",
3925
4012
  "dev:speech": "PLATFORM_ENABLE_AI=true SPEECH_SERVER_URL=http://speech-server:8091 docker compose --profile agent --profile speech up --build",
3926
- "speech:pins": "bun run scripts/provision-speech-readiness.ts",
3927
- "dev:adk-web": "bun run scripts/dev-adk-web.ts"
4013
+ "speech:pins": "bun run scripts/provision-speech-readiness.ts"
3928
4014
  } : {},
3929
4015
  ...generatorVersion ? { windy: "create-windy" } : {},
3930
4016
  "dev:web": "bun run --cwd apps/web dev",
@@ -3970,13 +4056,11 @@ var templateRootFiles = [
3970
4056
  "README.md",
3971
4057
  "bunfig.toml",
3972
4058
  "docker-compose.yml",
3973
- "docker-compose.agent-debug.yml",
3974
4059
  "drizzle.config.ts",
3975
4060
  "module-schema.lineages.json",
3976
4061
  "package.json",
3977
4062
  "scripts/notification-postgres-regression.ts",
3978
4063
  "scripts/lib/postgres-regression.ts",
3979
- "scripts/dev-adk-web.ts",
3980
4064
  "scripts/provision-speech-readiness.ts"
3981
4065
  ];
3982
4066
  var templateDirectories = [
@@ -4002,7 +4086,10 @@ var templateDirectories = [
4002
4086
  ];
4003
4087
  var templateDocumentationFiles = [
4004
4088
  "docs/adapters/ruoyi-vue-compatibility.md",
4089
+ "docs/adr/0003-agent-session-event-source.md",
4005
4090
  "docs/architecture/admin-surface-boundary.md",
4091
+ "docs/architecture/agent-harness.md",
4092
+ "docs/architecture/agent-workflow.md",
4006
4093
  "docs/architecture/ai-egress.md",
4007
4094
  "docs/architecture/ai-runtime.md",
4008
4095
  "docs/architecture/ai-runtime-readiness.md",
@@ -4029,19 +4116,29 @@ var templateDocumentationFiles = [
4029
4116
  "docs/development/ui-component-gallery.md",
4030
4117
  "docs/license/license-offline-activation-code.md",
4031
4118
  "docs/license/license-pairing-activation.md",
4119
+ "docs/operations/agent-session-memory.md",
4120
+ "docs/operations/agent-session-troubleshooting.md",
4121
+ "docs/operations/adk-retirement.md",
4032
4122
  "docs/operations/observability.md",
4123
+ "docs/operations/agent-workflow-recovery.md",
4033
4124
  "docs/operations/incremental-delivery.md",
4034
4125
  "docs/platform/agent-run-attestation.md",
4035
- "docs/platform/agent-supervisor-output-contract.md",
4036
- "docs/platform/agent-tools.md",
4126
+ "docs/platform/client-agent-session.md",
4037
4127
  "docs/platform/agent-runtime.md",
4038
4128
  "docs/platform/agent-runtime-observability.md",
4129
+ "docs/platform/agent-supervisor-output-contract.md",
4130
+ "docs/platform/agent-tools.md",
4131
+ "docs/platform/agent-tool-approval.md",
4039
4132
  "docs/platform/agent-tool-sandbox.md",
4133
+ "docs/platform/agent-production-store.md",
4134
+ "docs/platform/agent-run-reattachment.md",
4135
+ "docs/platform/background-ai-operations.md",
4040
4136
  "docs/platform/audit-reliability.md",
4041
4137
  "docs/platform/bulk-data-jobs.md",
4042
4138
  "docs/platform/business-user-directory.md",
4043
4139
  "docs/platform/data-access-control.md",
4044
4140
  "docs/platform/document-ai-runtime.md",
4141
+ "docs/platform/embedding-ai-runtime.md",
4045
4142
  "docs/platform/governed-export-renderers.md",
4046
4143
  "docs/platform/module-configuration.md",
4047
4144
  "docs/platform/navigation-registry.md",
@@ -6309,8 +6406,8 @@ import { rm as rm10 } from "fs/promises";
6309
6406
  import { resolve as resolve8 } from "path";
6310
6407
 
6311
6408
  // src/update/doctor.ts
6312
- import { readFile as readFile11 } from "fs/promises";
6313
- import { join as join16 } from "path";
6409
+ import { readFile as readFile12 } from "fs/promises";
6410
+ import { join as join17 } from "path";
6314
6411
 
6315
6412
  // src/update/process.ts
6316
6413
  import { spawn as spawn2 } from "child_process";
@@ -8205,6 +8302,64 @@ async function applyTransaction(plan) {
8205
8302
  };
8206
8303
  }
8207
8304
 
8305
+ // src/update/legacy-adk-retirement.ts
8306
+ import { lstat as lstat6, readFile as readFile11 } from "fs/promises";
8307
+ import { join as join16 } from "path";
8308
+ var projectOwnedDebugConfig = "apps/agent-server/project/adk-web-debug.json";
8309
+ var deprecatedEnvironmentKeys = [
8310
+ "ADK_DEBUG_PLATFORM_TOKEN",
8311
+ "WINDY_ADK_DEBUG_TOKEN",
8312
+ "WINDY_ADK_DEBUG_OPERATION_KEY",
8313
+ "WINDY_ADK_DEBUG_DATA_ACTOR_ID"
8314
+ ];
8315
+ async function inspectAdkRetirement(projectDirectory) {
8316
+ const findings = [];
8317
+ if (await pathExists(join16(projectDirectory, projectOwnedDebugConfig))) {
8318
+ findings.push({
8319
+ kind: "project-owned-file",
8320
+ path: projectOwnedDebugConfig,
8321
+ message: `${projectOwnedDebugConfig} \u5C5E\u4E8E project-owned\uFF1BADK Web \u5DF2\u79FB\u9664\uFF0C\u4F46 Windy \u4E0D\u4F1A\u731C\u6D4B\u5220\u9664\uFF0C\u8BF7\u786E\u8BA4\u65E0\u5BA2\u6237\u7528\u9014\u540E\u4EBA\u5DE5\u6E05\u7406\u3002`
8322
+ });
8323
+ }
8324
+ const environmentPath = join16(projectDirectory, ".env");
8325
+ const metadata = await metadataOf(environmentPath);
8326
+ if (!metadata)
8327
+ return findings;
8328
+ if (metadata.isSymbolicLink()) {
8329
+ findings.push({
8330
+ kind: "external-environment",
8331
+ path: ".env",
8332
+ message: "\u5916\u90E8\u6258\u7BA1\u7684 .env \u672A\u8BFB\u53D6\u6216\u6539\u5199\uFF1B\u8BF7\u4EBA\u5DE5\u786E\u8BA4\u5E76\u79FB\u9664\u5176\u4E2D\u5DF2\u5F03\u7528\u7684 ADK Debug \u914D\u7F6E\u3002"
8333
+ });
8334
+ return findings;
8335
+ }
8336
+ const content = await readFile11(environmentPath, "utf8");
8337
+ for (const key of deprecatedEnvironmentKeys) {
8338
+ if (!new RegExp(`^${key}=`, "m").test(content))
8339
+ continue;
8340
+ findings.push({
8341
+ kind: "environment-key",
8342
+ path: ".env",
8343
+ key,
8344
+ message: `${key} \u5DF2\u5F03\u7528\uFF1B\u4E3A\u907F\u514D\u8BEF\u5220\u5BA2\u6237 Secret\uFF0CWindy \u4E0D\u4F1A\u81EA\u52A8\u6539\u5199\u6216\u5220\u9664\u8BE5\u503C\u3002`
8345
+ });
8346
+ }
8347
+ return findings;
8348
+ }
8349
+ async function pathExists(path2) {
8350
+ return Boolean(await metadataOf(path2));
8351
+ }
8352
+ async function metadataOf(path2) {
8353
+ try {
8354
+ return await lstat6(path2);
8355
+ } catch (error) {
8356
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
8357
+ return;
8358
+ }
8359
+ throw error;
8360
+ }
8361
+ }
8362
+
8208
8363
  // src/update/doctor.ts
8209
8364
  var oxcPaths = new Set([
8210
8365
  ".oxfmtrc.json",
@@ -8222,11 +8377,12 @@ async function diagnoseProject(projectDirectory, repair = false) {
8222
8377
  }
8223
8378
  const mayRepairEnvironment = repair && recoveryAction !== "recovery-conflicts";
8224
8379
  const environmentRepair = mayRepairEnvironment ? await repairLocalEnvironment(projectDirectory) : undefined;
8225
- const [provenance, manifest, git, environment] = await Promise.all([
8380
+ const [provenance, manifest, git, environment, manualCleanup] = await Promise.all([
8226
8381
  readGenerationProvenance(projectDirectory),
8227
8382
  readManagedFilesManifest(projectDirectory),
8228
8383
  captureProcess("git", ["status", "--porcelain"], projectDirectory),
8229
- environmentRepair ? Promise.resolve(environmentRepair) : inspectLocalEnvironment(projectDirectory)
8384
+ environmentRepair ? Promise.resolve(environmentRepair) : inspectLocalEnvironment(projectDirectory),
8385
+ inspectAdkRetirement(projectDirectory)
8230
8386
  ]);
8231
8387
  const modifiedManagedFiles = [];
8232
8388
  const missingManagedFiles = [];
@@ -8235,7 +8391,7 @@ async function diagnoseProject(projectDirectory, repair = false) {
8235
8391
  if (file.ownership === "project-owned")
8236
8392
  continue;
8237
8393
  try {
8238
- const changed = hashContent(await readFile11(join16(projectDirectory, file.path))) !== file.hash;
8394
+ const changed = hashContent(await readFile12(join17(projectDirectory, file.path))) !== file.hash;
8239
8395
  if (!changed)
8240
8396
  continue;
8241
8397
  modifiedManagedFiles.push(file.path);
@@ -8264,6 +8420,7 @@ async function diagnoseProject(projectDirectory, repair = false) {
8264
8420
  localEnvironmentExternal: environment.externalFile,
8265
8421
  missingLocalEnvironmentKeys: environment.missingKeys,
8266
8422
  duplicateLocalEnvironmentKeys: environment.duplicateKeys,
8423
+ manualCleanup,
8267
8424
  recoveryAction
8268
8425
  };
8269
8426
  }
@@ -8300,6 +8457,21 @@ var recipes = [
8300
8457
  id: "starter-0.6.11-to-0.6.12",
8301
8458
  from: "0.6.11",
8302
8459
  to: "0.6.12"
8460
+ },
8461
+ {
8462
+ id: "starter-0.6.12-to-0.6.13",
8463
+ from: "0.6.12",
8464
+ to: "0.6.13"
8465
+ },
8466
+ {
8467
+ id: "starter-0.6.13-to-0.6.14",
8468
+ from: "0.6.13",
8469
+ to: "0.6.14"
8470
+ },
8471
+ {
8472
+ id: "starter-0.6.14-to-0.6.15",
8473
+ from: "0.6.14",
8474
+ to: "0.6.15"
8303
8475
  }
8304
8476
  ];
8305
8477
  function resolveRecipeChain(sourceVersion, targetVersion) {
@@ -8345,18 +8517,18 @@ function parseVersion2(version) {
8345
8517
  }
8346
8518
 
8347
8519
  // src/update/updater.ts
8348
- import { readFile as readFile23, rm as rm8 } from "fs/promises";
8349
- import { join as join28 } from "path";
8520
+ import { readFile as readFile24, rm as rm8 } from "fs/promises";
8521
+ import { join as join29 } from "path";
8350
8522
 
8351
8523
  // src/update/artifacts.ts
8352
- import { mkdtemp, readFile as readFile14 } from "fs/promises";
8524
+ import { mkdtemp, readFile as readFile15 } from "fs/promises";
8353
8525
  import { tmpdir } from "os";
8354
- import { basename as basename10, join as join19 } from "path";
8526
+ import { basename as basename10, join as join20 } from "path";
8355
8527
 
8356
8528
  // src/update/published-artifacts.ts
8357
8529
  import { createHash as createHash4 } from "crypto";
8358
- import { mkdir as mkdir6, readFile as readFile12, writeFile as writeFile10 } from "fs/promises";
8359
- import { basename as basename9, join as join17 } from "path";
8530
+ import { mkdir as mkdir6, readFile as readFile13, writeFile as writeFile10 } from "fs/promises";
8531
+ import { basename as basename9, join as join18 } from "path";
8360
8532
 
8361
8533
  // src/update/safe-archive.ts
8362
8534
  import { mkdir as mkdir5 } from "fs/promises";
@@ -8408,17 +8580,17 @@ async function downloadPublicArtifact(temporaryRoot, label, version, expectedInt
8408
8580
  }
8409
8581
  const archive = await readBoundedResponse(response, `create-windy@${version} artifact `);
8410
8582
  verifyArchive(metadata, archive);
8411
- const destination = join17(temporaryRoot, `${label}-artifact`);
8412
- const archivePath = join17(temporaryRoot, `${label}.tgz`);
8583
+ const destination = join18(temporaryRoot, `${label}-artifact`);
8584
+ const archivePath = join18(temporaryRoot, `${label}.tgz`);
8413
8585
  await writeFile10(archivePath, archive);
8414
8586
  await extractSafeTarArchive({
8415
8587
  archivePath,
8416
8588
  destination,
8417
8589
  cwd: temporaryRoot
8418
8590
  });
8419
- const packageRoot2 = join17(destination, "package");
8420
- const packageJson = JSON.parse(await readFile12(join17(packageRoot2, "package.json"), "utf8"));
8421
- const template = await readTemplateMetadata(join17(packageRoot2, "template"));
8591
+ const packageRoot2 = join18(destination, "package");
8592
+ const packageJson = JSON.parse(await readFile13(join18(packageRoot2, "package.json"), "utf8"));
8593
+ const template = await readTemplateMetadata(join18(packageRoot2, "template"));
8422
8594
  if (packageJson.name !== "create-windy" || packageJson.version !== version || template.generatorVersion !== version) {
8423
8595
  throw new Error(`create-windy@${version} \u5305\u8EAB\u4EFD\u6216\u6A21\u677F\u5143\u6570\u636E\u4E0D\u4E00\u81F4`);
8424
8596
  }
@@ -8550,10 +8722,10 @@ function verifyArchive(metadata, archive) {
8550
8722
  }
8551
8723
  }
8552
8724
  async function generatePublicArtifactProject(temporaryRoot, label, projectName, packageRoot2, provenance) {
8553
- const parent = join17(temporaryRoot, label);
8725
+ const parent = join18(temporaryRoot, label);
8554
8726
  await mkdir6(parent, { recursive: true });
8555
8727
  const args = [
8556
- join17(packageRoot2, "dist/cli.js"),
8728
+ join18(packageRoot2, "dist/cli.js"),
8557
8729
  projectName,
8558
8730
  "--yes",
8559
8731
  "--skip-install",
@@ -8573,26 +8745,26 @@ async function generatePublicArtifactProject(temporaryRoot, label, projectName,
8573
8745
  }
8574
8746
  }
8575
8747
  await assertProcess("bun", args, parent);
8576
- return join17(parent, projectName);
8748
+ return join18(parent, projectName);
8577
8749
  }
8578
8750
 
8579
8751
  // src/module-history.ts
8580
8752
  import {
8581
- lstat as lstat6,
8753
+ lstat as lstat7,
8582
8754
  mkdir as mkdir7,
8583
8755
  readdir as readdir8,
8584
- readFile as readFile13,
8756
+ readFile as readFile14,
8585
8757
  writeFile as writeFile11
8586
8758
  } from "fs/promises";
8587
- import { dirname as dirname8, join as join18, relative as relative5, sep as sep4 } from "path";
8759
+ import { dirname as dirname8, join as join19, relative as relative5, sep as sep4 } from "path";
8588
8760
  async function archiveRemovedModuleMigrations(input) {
8589
8761
  await assertExistingHistoryIntegrity(input.projectDirectory);
8590
- let changed = await copyMigrationTree(input.projectDirectory, ".windy/module-history", join18(input.targetDirectory, ".windy/module-history"));
8762
+ let changed = await copyMigrationTree(input.projectDirectory, ".windy/module-history", join19(input.targetDirectory, ".windy/module-history"));
8591
8763
  const target = new Set(input.targetModules);
8592
8764
  const removed = moduleDistributionCatalog.filter(({ name }) => input.sourceModules.includes(name) && !target.has(name));
8593
8765
  for (const manifest of removed) {
8594
8766
  for (const root of manifest.migrationRoots) {
8595
- changed = await copyMigrationTree(input.projectDirectory, root, join18(input.targetDirectory, ".windy/module-history", manifest.name, root)) || changed;
8767
+ changed = await copyMigrationTree(input.projectDirectory, root, join19(input.targetDirectory, ".windy/module-history", manifest.name, root)) || changed;
8596
8768
  }
8597
8769
  }
8598
8770
  if (changed) {
@@ -8600,7 +8772,7 @@ async function archiveRemovedModuleMigrations(input) {
8600
8772
  }
8601
8773
  }
8602
8774
  async function assertExistingHistoryIntegrity(projectDirectory) {
8603
- const historyRoot = join18(projectDirectory, ".windy/module-history");
8775
+ const historyRoot = join19(projectDirectory, ".windy/module-history");
8604
8776
  const metadata = await readOptionalMetadata(historyRoot);
8605
8777
  if (!metadata)
8606
8778
  return;
@@ -8615,13 +8787,13 @@ async function assertExistingHistoryIntegrity(projectDirectory) {
8615
8787
  if (!entry || isMissingManagedFile(entry)) {
8616
8788
  throw new Error(`\u6A21\u5757 migration \u5386\u53F2\u672A\u767B\u8BB0\u5230\u53D7\u7BA1\u6E05\u5355\uFF1A${relativePath2}`);
8617
8789
  }
8618
- if (hashContent(await readFile13(path2)) !== entry.hash) {
8790
+ if (hashContent(await readFile14(path2)) !== entry.hash) {
8619
8791
  throw new Error(`\u6A21\u5757 migration \u5386\u53F2\u5DF2\u88AB\u4FEE\u6539\uFF1A${relativePath2}`);
8620
8792
  }
8621
8793
  }
8622
8794
  }
8623
8795
  async function copyMigrationTree(projectRoot, relativeRoot, targetRoot) {
8624
- const sourceRoot = join18(projectRoot, relativeRoot);
8796
+ const sourceRoot = join19(projectRoot, relativeRoot);
8625
8797
  const rootMetadata = await readOptionalMetadata(sourceRoot);
8626
8798
  if (!rootMetadata)
8627
8799
  return false;
@@ -8629,9 +8801,9 @@ async function copyMigrationTree(projectRoot, relativeRoot, targetRoot) {
8629
8801
  throw new Error(`\u6A21\u5757 migration \u6839\u76EE\u5F55\u65E0\u6548\uFF1A${relativeRoot}`);
8630
8802
  }
8631
8803
  for (const source of await collectRegularFiles(sourceRoot)) {
8632
- const target = join18(targetRoot, relative5(sourceRoot, source).split(sep4).join("/"));
8804
+ const target = join19(targetRoot, relative5(sourceRoot, source).split(sep4).join("/"));
8633
8805
  await mkdir7(dirname8(target), { recursive: true });
8634
- await writeFile11(target, await readFile13(source));
8806
+ await writeFile11(target, await readFile14(source));
8635
8807
  }
8636
8808
  return true;
8637
8809
  }
@@ -8641,8 +8813,8 @@ async function collectRegularFiles(root) {
8641
8813
  return files.sort();
8642
8814
  async function visit(directory) {
8643
8815
  for (const name of (await readdir8(directory)).sort()) {
8644
- const path2 = join18(directory, name);
8645
- const metadata = await lstat6(path2);
8816
+ const path2 = join19(directory, name);
8817
+ const metadata = await lstat7(path2);
8646
8818
  if (metadata.isSymbolicLink()) {
8647
8819
  throw new Error(`\u6A21\u5757 migration \u4E0D\u5141\u8BB8\u7B26\u53F7\u94FE\u63A5\uFF1A${path2}`);
8648
8820
  }
@@ -8655,7 +8827,7 @@ async function collectRegularFiles(root) {
8655
8827
  }
8656
8828
  async function readOptionalMetadata(path2) {
8657
8829
  try {
8658
- return await lstat6(path2);
8830
+ return await lstat7(path2);
8659
8831
  } catch (error) {
8660
8832
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
8661
8833
  return;
@@ -8671,10 +8843,10 @@ class PublishedArtifactProvider {
8671
8843
  this.#fetch = fetcher;
8672
8844
  }
8673
8845
  async prepare(projectDirectory, provenance, targetModules) {
8674
- const temporaryRoot = await mkdtemp(join19(tmpdir(), "windy-update-"));
8846
+ const temporaryRoot = await mkdtemp(join20(tmpdir(), "windy-update-"));
8675
8847
  const projectName = await readProjectName2(projectDirectory);
8676
- const baseDirectory = join19(temporaryRoot, "base", projectName);
8677
- const targetDirectory = join19(temporaryRoot, "target", projectName);
8848
+ const baseDirectory = join20(temporaryRoot, "base", projectName);
8849
+ const targetDirectory = join20(temporaryRoot, "target", projectName);
8678
8850
  const baseArtifact = await downloadPublicArtifact(temporaryRoot, "base", provenance.generatorVersion, undefined, this.#fetch);
8679
8851
  if (baseArtifact.identity.templateCommit !== provenance.templateCommit) {
8680
8852
  throw new Error("Project Lock \u4E0E\u6765\u6E90 registry artifact \u7684 template commit \u4E0D\u4E00\u81F4");
@@ -8702,13 +8874,13 @@ class PublishedArtifactProvider {
8702
8874
  }
8703
8875
  }
8704
8876
  async function readProjectName2(projectDirectory) {
8705
- const source = JSON.parse(await readFile14(join19(projectDirectory, "package.json"), "utf8"));
8877
+ const source = JSON.parse(await readFile15(join20(projectDirectory, "package.json"), "utf8"));
8706
8878
  return source.name || basename10(projectDirectory);
8707
8879
  }
8708
8880
 
8709
8881
  // src/update/planner.ts
8710
- import { readFile as readFile21 } from "fs/promises";
8711
- import { dirname as dirname9, join as join26 } from "path";
8882
+ import { readFile as readFile22 } from "fs/promises";
8883
+ import { dirname as dirname9, join as join27 } from "path";
8712
8884
 
8713
8885
  // src/update/docker-copy-update-plan.ts
8714
8886
  async function deriveDockerfilePlans(files, snapshots, paths, targetWorkspaceManifests) {
@@ -8796,16 +8968,16 @@ function matchesWorkspace(pattern, directory) {
8796
8968
  }
8797
8969
 
8798
8970
  // src/update/migration-reconciler.ts
8799
- import { readFile as readFile18 } from "fs/promises";
8800
- import { join as join22 } from "path";
8971
+ import { readFile as readFile19 } from "fs/promises";
8972
+ import { join as join23 } from "path";
8801
8973
 
8802
8974
  // src/update/migration-adoption.ts
8803
- import { readFile as readFile17 } from "fs/promises";
8804
- import { join as join21 } from "path";
8975
+ import { readFile as readFile18 } from "fs/promises";
8976
+ import { join as join22 } from "path";
8805
8977
 
8806
8978
  // src/update/migration-project-file.ts
8807
- import { readFile as readFile15 } from "fs/promises";
8808
- import { join as join20 } from "path";
8979
+ import { readFile as readFile16 } from "fs/promises";
8980
+ import { join as join21 } from "path";
8809
8981
  async function readProjectJson(input, path2) {
8810
8982
  const content = await readProjectFile(input, path2);
8811
8983
  if (!content) {
@@ -8821,7 +8993,7 @@ async function readProjectFile(input, path2) {
8821
8993
  }
8822
8994
  let content;
8823
8995
  try {
8824
- content = await readFile15(join20(input.projectDirectory, path2));
8996
+ content = await readFile16(join21(input.projectDirectory, path2));
8825
8997
  } catch (error) {
8826
8998
  if (!isMissingFileError(error))
8827
8999
  throw error;
@@ -8836,7 +9008,7 @@ function isMissingFileError(error) {
8836
9008
  }
8837
9009
 
8838
9010
  // src/update/migration-history.ts
8839
- import { readFile as readFile16 } from "fs/promises";
9011
+ import { readFile as readFile17 } from "fs/promises";
8840
9012
  var drizzleRoot = "packages/database/drizzle";
8841
9013
  var journalPath = `${drizzleRoot}/meta/_journal.json`;
8842
9014
  var migrationPattern = /^(\d{4})_(.+)$/;
@@ -8886,7 +9058,7 @@ function encodeJson(value) {
8886
9058
  `);
8887
9059
  }
8888
9060
  async function readJson(path2) {
8889
- return JSON.parse(await readFile16(path2, "utf8"));
9061
+ return JSON.parse(await readFile17(path2, "utf8"));
8890
9062
  }
8891
9063
 
8892
9064
  // src/update/snapshot-delta.ts
@@ -8962,10 +9134,10 @@ async function inspectPreexistingMigrationAdoptions(input) {
8962
9134
  projectBeforeBytes,
8963
9135
  projectAfterBytes
8964
9136
  ] = await Promise.all([
8965
- readFile17(join21(input.targetDirectory, `${drizzleRoot}/${candidate.tag}.sql`)),
9137
+ readFile18(join22(input.targetDirectory, `${drizzleRoot}/${candidate.tag}.sql`)),
8966
9138
  readProjectFile(input, projectSqlPath),
8967
- readJson(join21(input.targetDirectory, snapshotPath(previousTarget.tag))),
8968
- readJson(join21(input.targetDirectory, snapshotPath(candidate.tag))),
9139
+ readJson(join22(input.targetDirectory, snapshotPath(previousTarget.tag))),
9140
+ readJson(join22(input.targetDirectory, snapshotPath(candidate.tag))),
8969
9141
  readProjectFile(input, snapshotPath(previousProject.tag)),
8970
9142
  readProjectFile(input, projectSnapshotPath)
8971
9143
  ]);
@@ -9092,7 +9264,7 @@ async function reconcileDrizzleMigrations(input) {
9092
9264
  const tag = `${prefix}_${name}`;
9093
9265
  const sqlPath = `${drizzleRoot}/${tag}.sql`;
9094
9266
  const snapshotPath2 = `${drizzleRoot}/meta/${prefix}_snapshot.json`;
9095
- const sql = await readFile18(join22(input.targetDirectory, `${drizzleRoot}/${addition.tag}.sql`));
9267
+ const sql = await readFile19(join23(input.targetDirectory, `${drizzleRoot}/${addition.tag}.sql`));
9096
9268
  merged.id = targetAfter.id;
9097
9269
  merged.prevId = currentSnapshot.id;
9098
9270
  const snapshot2 = encodeJson(merged);
@@ -9139,9 +9311,9 @@ function unchanged(targetManifest) {
9139
9311
  async function readJournals(input) {
9140
9312
  try {
9141
9313
  const [base, project, target] = await Promise.all([
9142
- readJson(join22(input.baseDirectory, journalPath)),
9314
+ readJson(join23(input.baseDirectory, journalPath)),
9143
9315
  readProjectJson(input, journalPath),
9144
- readJson(join22(input.targetDirectory, journalPath))
9316
+ readJson(join23(input.targetDirectory, journalPath))
9145
9317
  ]);
9146
9318
  return { base, project, target };
9147
9319
  } catch (error) {
@@ -9172,17 +9344,17 @@ async function readLatestSnapshot(input, journal) {
9172
9344
  return JSON.parse(new TextDecoder().decode(content));
9173
9345
  }
9174
9346
  async function readSnapshot(root, tag) {
9175
- return await readJson(join22(root, snapshotPath(tag)));
9347
+ return await readJson(join23(root, snapshotPath(tag)));
9176
9348
  }
9177
9349
 
9178
9350
  // src/update/planner-file.ts
9179
- import { readFile as readFile19 } from "fs/promises";
9180
- import { join as join24 } from "path";
9351
+ import { readFile as readFile20 } from "fs/promises";
9352
+ import { join as join25 } from "path";
9181
9353
 
9182
9354
  // src/update/merge.ts
9183
9355
  import { mkdtemp as mkdtemp2, rm as rm6, writeFile as writeFile12 } from "fs/promises";
9184
9356
  import { tmpdir as tmpdir2 } from "os";
9185
- import { join as join23 } from "path";
9357
+ import { join as join24 } from "path";
9186
9358
 
9187
9359
  // src/update/merge-convergent-additions.ts
9188
9360
  async function reconcileConvergentAdditions(input) {
@@ -9324,11 +9496,11 @@ function sameLines(left, right) {
9324
9496
 
9325
9497
  // src/update/merge.ts
9326
9498
  async function mergeTextFile(base, ours, theirs) {
9327
- const root = await mkdtemp2(join23(tmpdir2(), "windy-merge-"));
9499
+ const root = await mkdtemp2(join24(tmpdir2(), "windy-merge-"));
9328
9500
  try {
9329
- const oursPath = join23(root, "ours");
9330
- const basePath = join23(root, "base");
9331
- const theirsPath = join23(root, "theirs");
9501
+ const oursPath = join24(root, "ours");
9502
+ const basePath = join24(root, "base");
9503
+ const theirsPath = join24(root, "theirs");
9332
9504
  await Promise.all([
9333
9505
  writeFile12(oursPath, ours),
9334
9506
  writeFile12(basePath, base),
@@ -9661,40 +9833,327 @@ function conflict(path2, reason, expectedProjectContent) {
9661
9833
  };
9662
9834
  }
9663
9835
 
9836
+ // src/update/recipe-project-owned-client-workflow.ts
9837
+ var clientWorkflowCompositionPath = "apps/server/src/app/agent-runtime-composition.ts";
9838
+ var clientWorkflowBindingPath = "apps/server/src/app/client-agent-workflow-artifact-binding.ts";
9839
+ var legacyDefaultBinding = `import type { ModuleClientAgentWorkflowArtifactProjectBinding } from "@southwind-ai/server-sdk";
9840
+
9841
+ /**
9842
+ * Project-owned Workflow -> PageAgent \u7ED1\u5B9A\u3002Starter \u9ED8\u8BA4\u7A7A\u6570\u7EC4\u5E76 fail closed\uFF1B
9843
+ * \u4EA7\u54C1\u53EA\u4E3A\u5DF2\u5BA1\u6838\u3001\u5DF2\u53D1\u5E03\u7684\u56FA\u5B9A Workflow Job node \u589E\u52A0\u9759\u6001\u7ED1\u5B9A\u3002
9844
+ */
9845
+ export const projectClientAgentWorkflowArtifactBindings: readonly ModuleClientAgentWorkflowArtifactProjectBinding[] =
9846
+ [];
9847
+ `;
9848
+ var immutableReleaseDefaultBinding = `import type { ModuleClientAgentWorkflowArtifactProjectBinding } from "@southwind-ai/server-sdk";
9849
+
9850
+ /**
9851
+ * Project-owned Workflow -> PageAgent \u7ED1\u5B9A\u3002Starter \u9ED8\u8BA4\u7A7A\u6570\u7EC4\u5E76 fail closed\uFF1B
9852
+ * \u4EA7\u54C1\u53EA\u4E3A\u5DF2\u5BA1\u6838\u3001\u5DF2\u53D1\u5E03\u7684\u56FA\u5B9A Workflow Job node \u589E\u52A0\u9759\u6001\u7ED1\u5B9A\u3002Operation \u5FC5\u987B\u58F0\u660E
9853
+ * \`clientExecution.launchAuthority="workflow-artifact"\`\uFF1Bbinding \u5FC5\u987B\u767B\u8BB0 Immutable
9854
+ * canonical \`releaseDigest\`\u3001scope containment contract v1\uFF0C\u4EE5\u53CA project launch\u3001client task\u3001terminal
9855
+ * authority version/digest\u3002launch authority \u4ECE Host \u5F53\u524D scope \u663E\u5F0F\u6536\u7A84\uFF1Bterminal authority
9856
+ * \u540C\u65F6\u590D\u9A8C Host \u91CD\u6388\u6743\u5E76\u6253\u5F00\u7684 canonical input artifacts\u3002project preset \u4F7F\u7528
9857
+ * runtime.agentWorkflowProjects\uFF1B\u666E\u901A routes \u6C38\u8FDC\u4E0D\u80FD\u53D1\u5E03/\u542F\u52A8\u53D7\u4FDD\u62A4 Workflow\u3002
9858
+ * \u53D1\u5E03 Release \u6216 authority contract \u540E\u5FC5\u987B\u91CD\u65B0\u5BA1\u6838\u5E76\u663E\u5F0F\u66F4\u65B0\u3002
9859
+ */
9860
+ export const projectClientAgentWorkflowArtifactBindings: readonly ModuleClientAgentWorkflowArtifactProjectBinding[] =
9861
+ [];
9862
+ `;
9863
+ var immutableReleaseCompositionHash = "98c23266799311cf26c160374aad738456888f3c04f40f3667122e28b3e8e188";
9864
+ var hostAuthImport = 'import { projectClientAgentHostAuthAdapter } from "./client-agent-host-auth-binding.js";';
9865
+ var workflowArtifactImport = 'import { projectClientAgentWorkflowArtifactBindings } from "./client-agent-workflow-artifact-binding.js";';
9866
+ var oldOmit = ' "clientAgentHostAuth" | "screenshotPageRegistry"';
9867
+ var newOmit = ` | "clientAgentHostAuth"
9868
+ | "clientAgentWorkflowArtifactBindings"
9869
+ | "screenshotPageRegistry"`;
9870
+ var hostAuthProperty = " clientAgentHostAuth: projectClientAgentHostAuthAdapter,";
9871
+ var workflowArtifactProperty = ` clientAgentWorkflowArtifactBindings:
9872
+ projectClientAgentWorkflowArtifactBindings,`;
9873
+ function planClientWorkflowProjectOwned(input) {
9874
+ return input.path === clientWorkflowBindingPath ? planBinding(input) : planComposition(input);
9875
+ }
9876
+ function planBinding(input) {
9877
+ if (!input.target)
9878
+ return conflict2(input, "\u76EE\u6807\u7248\u672C\u7F3A\u5C11 Workflow binding seam");
9879
+ const target = decode(input.target);
9880
+ if (target !== immutableReleaseDefaultBinding) {
9881
+ return conflict2(input, "\u76EE\u6807\u7248\u672C Workflow binding seam \u5951\u7EA6\u65E0\u6548");
9882
+ }
9883
+ if (!input.ours) {
9884
+ return ready2(input, "create", "\u65B0\u589E\u9ED8\u8BA4\u5173\u95ED\u7684 Workflow binding seam", input.target);
9885
+ }
9886
+ const source = decode(input.ours);
9887
+ if (source === target) {
9888
+ return ready2(input, "preserve", "\u5DF2\u5305\u542B immutable release binding seam");
9889
+ }
9890
+ if (source !== legacyDefaultBinding) {
9891
+ return conflict2(input, "Workflow binding seam \u4E0D\u662F 0.6.14 \u9ED8\u8BA4\u7A7A\u7248\u672C");
9892
+ }
9893
+ return ready2(input, "update", "\u5347\u7EA7\u9ED8\u8BA4\u7A7A Workflow binding seam", input.target);
9894
+ }
9895
+ function planComposition(input) {
9896
+ if (!input.target) {
9897
+ return conflict2(input, "\u76EE\u6807\u7248\u672C\u7F3A\u5C11 Agent Runtime Composition");
9898
+ }
9899
+ const target = decode(input.target);
9900
+ if (hashContent(target) !== immutableReleaseCompositionHash) {
9901
+ return conflict2(input, "\u76EE\u6807\u7248\u672C Agent Runtime Composition \u5951\u7EA6\u65E0\u6548");
9902
+ }
9903
+ if (!input.ours) {
9904
+ return ready2(input, "create", "\u65B0\u589E Agent Runtime Composition", input.target);
9905
+ }
9906
+ const source = decode(input.ours);
9907
+ if (source === target) {
9908
+ return ready2(input, "preserve", "\u5DF2\u88C5\u914D Workflow Artifact binding");
9909
+ }
9910
+ if ([workflowArtifactImport, newOmit, workflowArtifactProperty].some((value) => source.includes(value))) {
9911
+ return conflict2(input, "Agent Runtime Composition \u53EA\u5305\u542B\u90E8\u5206\u76EE\u6807\u88C5\u914D");
9912
+ }
9913
+ const runtimeConflict = validateLegacyRuntimeObject(source);
9914
+ if (runtimeConflict)
9915
+ return conflict2(input, runtimeConflict);
9916
+ const replacements2 = [
9917
+ {
9918
+ anchor: hostAuthImport,
9919
+ value: `${hostAuthImport}
9920
+ ${workflowArtifactImport}`
9921
+ },
9922
+ {
9923
+ anchor: oldOmit,
9924
+ value: newOmit
9925
+ },
9926
+ {
9927
+ anchor: hostAuthProperty,
9928
+ value: `${hostAuthProperty}
9929
+ ${workflowArtifactProperty}`
9930
+ }
9931
+ ];
9932
+ let content = source;
9933
+ for (const replacement of replacements2) {
9934
+ if (occurrences(content, replacement.anchor) !== 1) {
9935
+ return conflict2(input, `Agent Runtime Composition \u951A\u70B9\u4E0D\u552F\u4E00\uFF1A${replacement.anchor}`);
9936
+ }
9937
+ content = content.replace(replacement.anchor, replacement.value);
9938
+ }
9939
+ return ready2(input, "update", "\u88C5\u914D Workflow Artifact project binding", new TextEncoder().encode(content));
9940
+ }
9941
+ function ready2(input, action, reason, content) {
9942
+ return {
9943
+ path: input.path,
9944
+ ownership: "project-owned",
9945
+ action,
9946
+ reason,
9947
+ expectedProjectContent: input.expected,
9948
+ content
9949
+ };
9950
+ }
9951
+ function conflict2(input, message) {
9952
+ return {
9953
+ path: input.path,
9954
+ ownership: "project-owned",
9955
+ action: "preserve",
9956
+ reason: "\u5BA2\u6237\u5DF2\u4FEE\u6539",
9957
+ expectedProjectContent: input.expected,
9958
+ conflict: message
9959
+ };
9960
+ }
9961
+ function decode(content) {
9962
+ return new TextDecoder().decode(content);
9963
+ }
9964
+ function occurrences(source, value) {
9965
+ return source.split(value).length - 1;
9966
+ }
9967
+ function validateLegacyRuntimeObject(source) {
9968
+ const startAnchor = ` const runtime = registerAgentPlatformRuntime({
9969
+ ...input,`;
9970
+ const endAnchor = `
9971
+ });`;
9972
+ if (occurrences(source, startAnchor) !== 1 || occurrences(source, endAnchor) !== 1) {
9973
+ return "Agent Runtime register object \u951A\u70B9\u4E0D\u552F\u4E00";
9974
+ }
9975
+ const start = source.indexOf(startAnchor);
9976
+ const end = source.indexOf(endAnchor, start + startAnchor.length);
9977
+ if (end < 0)
9978
+ return "Agent Runtime register object \u7ED3\u675F\u951A\u70B9\u7F3A\u5931";
9979
+ const object = source.slice(start, end);
9980
+ const host = object.indexOf(hostAuthProperty);
9981
+ if (host < 0)
9982
+ return "Agent Runtime Host Auth property \u951A\u70B9\u7F3A\u5931";
9983
+ const tail = object.slice(host + hostAuthProperty.length);
9984
+ if (/^\s*\.\.\./m.test(tail)) {
9985
+ return "Workflow binding \u63D2\u5165\u70B9\u540E\u5B58\u5728\u53EF\u8986\u76D6\u5B83\u7684 spread";
9986
+ }
9987
+ if (/["']clientAgentWorkflowArtifactBindings["']\s*:/.test(object) || /\[\s*["']clientAgentWorkflowArtifactBindings["']\s*\]/.test(object)) {
9988
+ return "Agent Runtime \u5DF2\u5B58\u5728\u52A8\u6001 Workflow binding property";
9989
+ }
9990
+ return;
9991
+ }
9992
+
9993
+ // src/update/recipe-project-owned-trajectory-test.ts
9994
+ var legacyAnchor = /^(\s*)traceId: "trace_1",\n\1attemptItems: \[$/gm;
9995
+ var migratedAnchor = /^(\s*)traceId: "trace_1",\n\1trajectory: \{\n\1 {2}available: true,\n\1 {2}events: \[\],\n\1\},\n\1attemptItems: \[$/gm;
9996
+ function addAiRuntimeTrajectoryTestFixture(source) {
9997
+ const migrated = [...source.matchAll(migratedAnchor)];
9998
+ if (migrated.length === 1)
9999
+ return { content: source };
10000
+ if (migrated.length > 1) {
10001
+ return { error: "AI Runtime trajectory \u6D4B\u8BD5 fixture \u5DF2\u8FC1\u79FB\u951A\u70B9\u4E0D\u552F\u4E00" };
10002
+ }
10003
+ const legacy = [...source.matchAll(legacyAnchor)];
10004
+ if (legacy.length !== 1) {
10005
+ return { error: "AI Runtime trajectory \u6D4B\u8BD5 fixture \u951A\u70B9\u4E0D\u552F\u4E00" };
10006
+ }
10007
+ const anchor = legacy[0];
10008
+ const indent = anchor[1];
10009
+ return {
10010
+ content: source.replace(anchor[0], [
10011
+ `${indent}traceId: "trace_1",`,
10012
+ `${indent}trajectory: {`,
10013
+ `${indent} available: true,`,
10014
+ `${indent} events: [],`,
10015
+ `${indent}},`,
10016
+ `${indent}attemptItems: [`
10017
+ ].join(`
10018
+ `))
10019
+ };
10020
+ }
10021
+
9664
10022
  // src/update/recipe-project-owned.ts
9665
10023
  var managedPathsByRecipe = {
9666
10024
  "starter-0.6.8-to-0.6.9": [
9667
10025
  "apps/web/src/router/index.ts",
9668
10026
  "apps/web/src/router/platform-admin-route-bindings.ts"
10027
+ ],
10028
+ "starter-0.6.13-to-0.6.14": [
10029
+ "apps/web/src/pages/system/components/ai-runtime/AiRuntimeRunDetailDialog.webtest.ts",
10030
+ "apps/web/src/pages/system/components/ai-runtime/AiRuntimeRunDetailDialog.vue",
10031
+ "apps/web/src/router/index.ts",
10032
+ "apps/web/src/router/platform-admin-route-bindings.ts",
10033
+ "apps/web/src/services/ai-runtime-api.ts"
10034
+ ],
10035
+ "starter-0.6.14-to-0.6.15": [
10036
+ clientWorkflowCompositionPath,
10037
+ clientWorkflowBindingPath
9669
10038
  ]
9670
10039
  };
9671
10040
  function recipeManagedProjectOwnedPaths(recipes2) {
9672
10041
  return new Set(recipes2.flatMap((recipe) => managedPathsByRecipe[recipe] ?? []));
9673
10042
  }
10043
+ function recipeCanManageMissingProjectOwnedPath(path2) {
10044
+ return path2 === clientWorkflowCompositionPath || path2 === clientWorkflowBindingPath;
10045
+ }
9674
10046
  async function planRecipeProjectOwned(input) {
10047
+ if (input.path === clientWorkflowCompositionPath || input.path === clientWorkflowBindingPath) {
10048
+ if (!input.target) {
10049
+ return conflict3(input, "\u7248\u672C recipe \u6240\u9700\u7684\u76EE\u6807\u6587\u4EF6\u7F3A\u5931");
10050
+ }
10051
+ return planClientWorkflowProjectOwned({ ...input, target: input.target });
10052
+ }
9675
10053
  if (!input.ours) {
9676
- return conflict2(input, "\u7248\u672C recipe \u6240\u9700\u7684\u9879\u76EE\u951A\u70B9\u7F3A\u5931");
10054
+ return conflict3(input, "\u7248\u672C recipe \u6240\u9700\u7684\u9879\u76EE\u951A\u70B9\u7F3A\u5931");
9677
10055
  }
9678
10056
  const source = new TextDecoder().decode(input.ours);
9679
- const transformed = transformProjectAdminAnchor(input.path, source);
10057
+ const target = input.target ? new TextDecoder().decode(input.target) : undefined;
10058
+ const transformed = transformProjectOwnedAnchor(input.path, source, target);
9680
10059
  if ("error" in transformed)
9681
- return conflict2(input, transformed.error);
10060
+ return conflict3(input, transformed.error);
9682
10061
  if (transformed.content === source) {
9683
10062
  return preserve(input, "\u5DF2\u5305\u542B\u7248\u672C recipe \u76EE\u6807\u5185\u5BB9");
9684
10063
  }
9685
10064
  return update(input, new TextEncoder().encode(transformed.content));
9686
10065
  }
9687
- function transformProjectAdminAnchor(path2, source) {
10066
+ function transformProjectOwnedAnchor(path2, source, target) {
9688
10067
  if (path2 === "apps/web/src/router/index.ts") {
9689
- return addComponentPageLoader(source);
10068
+ return addComponentPageLoader(source, target);
9690
10069
  }
9691
10070
  if (path2 === "apps/web/src/router/platform-admin-route-bindings.ts") {
9692
- return addComponentRouteBinding(source);
10071
+ return addComponentRouteBinding(source, target);
10072
+ }
10073
+ if (path2 === "apps/web/src/pages/system/components/ai-runtime/AiRuntimeRunDetailDialog.webtest.ts") {
10074
+ return addAiRuntimeTrajectoryTestFixture(source);
10075
+ }
10076
+ if (path2 === "apps/web/src/pages/system/components/ai-runtime/AiRuntimeRunDetailDialog.vue") {
10077
+ return addAiRuntimeTrajectoryView(source);
10078
+ }
10079
+ if (path2 === "apps/web/src/services/ai-runtime-api.ts") {
10080
+ return addAiRuntimeTrajectoryContract(source);
9693
10081
  }
9694
10082
  return { error: `\u7248\u672C recipe \u672A\u767B\u8BB0\u9879\u76EE\u951A\u70B9\uFF1A${path2}` };
9695
10083
  }
9696
- function addComponentPageLoader(source) {
9697
- if (/^\s*"ui-components"\s*:/m.test(source))
10084
+ function addAiRuntimeTrajectoryContract(source) {
10085
+ let content = source;
10086
+ const typeField = ' readonly trajectory: RuntimeRunDetail["trajectory"];';
10087
+ if (!content.includes(typeField)) {
10088
+ const anchors = [
10089
+ ...content.matchAll(/^(\s*)readonly attemptItems: readonly AiRuntimeAttempt\[\];$/gm)
10090
+ ];
10091
+ if (anchors.length !== 1) {
10092
+ return { error: "AiRuntimeRunDetail attemptItems \u951A\u70B9\u4E0D\u552F\u4E00" };
10093
+ }
10094
+ content = content.replace(anchors[0][0], `${anchors[0][0]}
10095
+ ${anchors[0][1]}readonly trajectory: RuntimeRunDetail["trajectory"];`);
10096
+ }
10097
+ const mapperField = " trajectory: value.trajectory,";
10098
+ if (!content.includes(mapperField)) {
10099
+ const anchors = [
10100
+ ...content.matchAll(/^(\s*)attemptItems: value\.attempts\.map\(attemptItem\),$/gm)
10101
+ ];
10102
+ if (anchors.length !== 1) {
10103
+ return { error: "runDetail attemptItems mapper \u951A\u70B9\u4E0D\u552F\u4E00" };
10104
+ }
10105
+ content = content.replace(anchors[0][0], `${anchors[0][0]}
10106
+ ${anchors[0][1]}trajectory: value.trajectory,`);
10107
+ }
10108
+ return { content };
10109
+ }
10110
+ function addAiRuntimeTrajectoryView(source) {
10111
+ let content = source;
10112
+ const componentImport = 'import AiRuntimeTrajectory from "./AiRuntimeTrajectory.vue";';
10113
+ if (!content.includes(componentImport)) {
10114
+ const anchors = [
10115
+ ...content.matchAll(/^} from "\.\.\/\.\.\/ai-runtime-presenter";$/gm)
10116
+ ];
10117
+ if (anchors.length !== 1) {
10118
+ return { error: "AI Runtime presenter import \u951A\u70B9\u4E0D\u552F\u4E00" };
10119
+ }
10120
+ content = content.replace(anchors[0][0], `${anchors[0][0]}
10121
+ ${componentImport}`);
10122
+ }
10123
+ const componentUsage = '<AiRuntimeTrajectory :trajectory="detail.trajectory" />';
10124
+ if (!content.includes(componentUsage)) {
10125
+ const providerSections = [
10126
+ ...content.matchAll(/^(\s*)<section class="space-y-3">\n\s*<h3 class="text-sm font-medium">Provider Attempts<\/h3>$/gm)
10127
+ ];
10128
+ if (providerSections.length !== 1) {
10129
+ return { error: "Provider Attempts section \u951A\u70B9\u4E0D\u552F\u4E00" };
10130
+ }
10131
+ const providerSection = providerSections[0];
10132
+ content = content.replace(providerSection[0], `${providerSection[1]}${componentUsage}
10133
+
10134
+ ${providerSection[0]}`);
10135
+ }
10136
+ return { content };
10137
+ }
10138
+ function addComponentPageLoader(source, target) {
10139
+ const desired = [
10140
+ {
10141
+ key: "ui-components",
10142
+ value: '() => import("@/pages/ui/UiComponentPage.vue")'
10143
+ },
10144
+ ...target?.includes('"agent-session": AgentSessionPage') ? [
10145
+ {
10146
+ key: "agent-session",
10147
+ value: '() => import("@/pages/system/AgentSessionPage.vue")'
10148
+ },
10149
+ {
10150
+ key: "agent-workflow",
10151
+ value: '() => import("@/pages/system/AgentWorkflowPage.vue")'
10152
+ }
10153
+ ] : []
10154
+ ];
10155
+ const missing = desired.filter(({ key }) => !new RegExp(`^\\s*"${key}"\\s*:`, "m").test(source));
10156
+ if (!missing.length)
9698
10157
  return { content: source };
9699
10158
  const declaration = source.indexOf("const platformAdminPageComponents");
9700
10159
  const start = source.indexOf("= {", declaration);
@@ -9709,31 +10168,47 @@ function addComponentPageLoader(source) {
9709
10168
  return { error: "platformAdminPageComponents profile \u951A\u70B9\u4E0D\u552F\u4E00" };
9710
10169
  }
9711
10170
  const profile = profiles[0];
9712
- const insertion = `${profile[0]}
9713
- ${profile[1]}"ui-components": () => import("@/pages/ui/UiComponentPage.vue"),`;
10171
+ const insertion = [
10172
+ profile[0],
10173
+ ...missing.map(({ key, value }) => `${profile[1]}"${key}": ${value},`)
10174
+ ].join(`
10175
+ `);
9714
10176
  return {
9715
10177
  content: source.slice(0, start) + block.replace(profile[0], insertion) + source.slice(end)
9716
10178
  };
9717
10179
  }
9718
- function addComponentRouteBinding(source) {
10180
+ function addComponentRouteBinding(source, target) {
9719
10181
  const unionStart = source.indexOf("export type PlatformAdminPageKey =");
9720
10182
  const interfaceStart = source.indexOf("export interface PlatformAdminRouteBinding", unionStart);
9721
10183
  if (unionStart < 0 || interfaceStart < 0) {
9722
10184
  return { error: "\u627E\u4E0D\u5230 PlatformAdminPageKey \u9879\u76EE\u951A\u70B9" };
9723
10185
  }
10186
+ const desiredPages = [
10187
+ "ui-components",
10188
+ ...target?.includes('routeKey: "system.agent-session"') ? ["agent-session", "agent-workflow"] : []
10189
+ ];
9724
10190
  let content = source;
9725
10191
  const union = content.slice(unionStart, interfaceStart);
9726
- if (!union.includes('"ui-components"')) {
10192
+ const missingPages = desiredPages.filter((page) => !union.includes(`"${page}"`));
10193
+ if (missingPages.length) {
9727
10194
  const semicolon = content.lastIndexOf(";", interfaceStart);
9728
10195
  if (semicolon < unionStart) {
9729
10196
  return { error: "PlatformAdminPageKey \u7ED3\u675F\u951A\u70B9\u7F3A\u5931" };
9730
10197
  }
9731
10198
  content = `${content.slice(0, semicolon)}
9732
- | "ui-components"${content.slice(semicolon)}`;
9733
- }
9734
- if (content.includes('routeKey: "system.ui-components"')) {
10199
+ ${missingPages.map((page) => ` | "${page}"`).join(`
10200
+ `)}${content.slice(semicolon)}`;
10201
+ }
10202
+ const desiredBindings = [
10203
+ { routeKey: "system.ui-components", page: "ui-components" },
10204
+ ...target?.includes('routeKey: "system.agent-session"') ? [
10205
+ { routeKey: "system.agent-session", page: "agent-session" },
10206
+ { routeKey: "system.agent-workflow", page: "agent-workflow" }
10207
+ ] : []
10208
+ ];
10209
+ const missingBindings = desiredBindings.filter(({ routeKey }) => !content.includes(`routeKey: "${routeKey}"`));
10210
+ if (!missingBindings.length)
9735
10211
  return { content };
9736
- }
9737
10212
  const features = [
9738
10213
  ...content.matchAll(/^(\s*)\{ routeKey: "system\.feature", page: "resource", resourceKey: "features" \},$/gm)
9739
10214
  ];
@@ -9742,8 +10217,11 @@ function addComponentRouteBinding(source) {
9742
10217
  }
9743
10218
  const feature = features[0];
9744
10219
  return {
9745
- content: content.replace(feature[0], `${feature[0]}
9746
- ${feature[1]}{ routeKey: "system.ui-components", page: "ui-components" },`)
10220
+ content: content.replace(feature[0], [
10221
+ feature[0],
10222
+ ...missingBindings.map(({ routeKey, page }) => `${feature[1]}{ routeKey: "${routeKey}", page: "${page}" },`)
10223
+ ].join(`
10224
+ `))
9747
10225
  };
9748
10226
  }
9749
10227
  function preserve(input, reason) {
@@ -9760,12 +10238,12 @@ function update(input, content) {
9760
10238
  path: input.path,
9761
10239
  ownership: "project-owned",
9762
10240
  action: "update",
9763
- reason: "\u7248\u672C recipe \u66F4\u65B0\u9879\u76EE Admin \u6269\u5C55\u951A\u70B9",
10241
+ reason: "\u7248\u672C recipe \u66F4\u65B0\u9879\u76EE\u6269\u5C55\u951A\u70B9",
9764
10242
  expectedProjectContent: input.expected,
9765
10243
  content
9766
10244
  };
9767
10245
  }
9768
- function conflict2(input, message) {
10246
+ function conflict3(input, message) {
9769
10247
  return {
9770
10248
  path: input.path,
9771
10249
  ownership: "project-owned",
@@ -9779,14 +10257,15 @@ function conflict2(input, message) {
9779
10257
  // src/update/planner-file.ts
9780
10258
  async function planFile(path2, baseRoot, targetRoot, source, target, ours, provenance, targetContentOverride, manageGeneratedProjectOwned = false, forcePlatformBaseline = false, manageRecipeProjectOwned = false) {
9781
10259
  const [base, theirs] = await Promise.all([
9782
- readOptional(join24(baseRoot, path2)),
9783
- targetContentOverride ? Promise.resolve(targetContentOverride) : readOptional(join24(targetRoot, path2))
10260
+ readOptional(join25(baseRoot, path2)),
10261
+ targetContentOverride ? Promise.resolve(targetContentOverride) : readOptional(join25(targetRoot, path2))
9784
10262
  ]);
9785
10263
  const ownership = source?.ownership ?? target?.ownership ?? classifyOwnership(path2);
9786
10264
  const expected = expectationForSnapshot(ours);
9787
10265
  if (ownership === "project-owned") {
9788
- if (manageRecipeProjectOwned) {
9789
- return planRecipeProjectOwned({ path: path2, ours, expected });
10266
+ const hasExistingRecipeSource = source !== undefined && source.state !== "missing" && ours !== undefined;
10267
+ if (manageRecipeProjectOwned && target && (hasExistingRecipeSource || recipeCanManageMissingProjectOwnedPath(path2))) {
10268
+ return planRecipeProjectOwned({ path: path2, ours, target: theirs, expected });
9790
10269
  }
9791
10270
  if (manageGeneratedProjectOwned) {
9792
10271
  return planGeneratedProjectOwned(path2, source, target, ours, theirs, expected);
@@ -9795,29 +10274,29 @@ async function planFile(path2, baseRoot, targetRoot, source, target, ours, prove
9795
10274
  }
9796
10275
  if (path2.startsWith("packages/database/drizzle/") && path2.endsWith(".sql")) {
9797
10276
  if (source && !target) {
9798
- return conflict3(path2, ownership, "\u5DF2\u53D1\u5E03 migration \u4E0D\u53EF\u5220\u9664", expected);
10277
+ return conflict4(path2, ownership, "\u5DF2\u53D1\u5E03 migration \u4E0D\u53EF\u5220\u9664", expected);
9799
10278
  }
9800
10279
  if (source && target && source.hash !== target.hash) {
9801
- return conflict3(path2, ownership, "\u5DF2\u53D1\u5E03 migration \u4E0D\u53EF\u6539\u5199\uFF0C\u53EA\u80FD\u8FFD\u52A0\u65B0\u6587\u4EF6", expected);
10280
+ return conflict4(path2, ownership, "\u5DF2\u53D1\u5E03 migration \u4E0D\u53EF\u6539\u5199\uFF0C\u53EA\u80FD\u8FFD\u52A0\u65B0\u6587\u4EF6", expected);
9802
10281
  }
9803
10282
  }
9804
10283
  if (!source && target) {
9805
10284
  if (!ours) {
9806
10285
  return readyPlannedFile(path2, ownership, "create", "\u76EE\u6807\u7248\u672C\u65B0\u589E", expected, theirs);
9807
10286
  }
9808
- return theirs && hashContent(ours) === target.hash ? readyPlannedFile(path2, ownership, "preserve", "\u5DF2\u5305\u542B\u76EE\u6807\u5185\u5BB9", expected) : conflict3(path2, ownership, "\u76EE\u6807\u7248\u672C\u65B0\u589E\u8DEF\u5F84\u5DF2\u88AB\u9879\u76EE\u5360\u7528", expected);
10287
+ return theirs && hashContent(ours) === target.hash ? readyPlannedFile(path2, ownership, "preserve", "\u5DF2\u5305\u542B\u76EE\u6807\u5185\u5BB9", expected) : conflict4(path2, ownership, "\u76EE\u6807\u7248\u672C\u65B0\u589E\u8DEF\u5F84\u5DF2\u88AB\u9879\u76EE\u5360\u7528", expected);
9809
10288
  }
9810
10289
  if (source && !target) {
9811
10290
  if (!ours) {
9812
10291
  return readyPlannedFile(path2, ownership, "preserve", "\u9879\u76EE\u5DF2\u5220\u9664", expected);
9813
10292
  }
9814
- return hashContent(ours) === source.hash ? readyPlannedFile(path2, ownership, "delete", "\u76EE\u6807\u7248\u672C\u5220\u9664", expected) : conflict3(path2, ownership, "\u5BA2\u6237\u4FEE\u6539\u540E Windy \u53C8\u5220\u9664", expected);
10293
+ return hashContent(ours) === source.hash ? readyPlannedFile(path2, ownership, "delete", "\u76EE\u6807\u7248\u672C\u5220\u9664", expected) : conflict4(path2, ownership, "\u5BA2\u6237\u4FEE\u6539\u540E Windy \u53C8\u5220\u9664", expected);
9815
10294
  }
9816
10295
  if (source && target && !ours) {
9817
10296
  return readyPlannedFile(path2, "project-owned", "preserve", "\u9879\u76EE\u5DF2\u5220\u9664", expected);
9818
10297
  }
9819
10298
  if (!source || !target || !ours || !theirs) {
9820
- return conflict3(path2, ownership, "\u6587\u4EF6\u72B6\u6001\u4E0D\u5B8C\u6574\uFF0C\u4E0D\u80FD\u5B89\u5168\u63A8\u65AD", expected);
10299
+ return conflict4(path2, ownership, "\u6587\u4EF6\u72B6\u6001\u4E0D\u5B8C\u6574\uFF0C\u4E0D\u80FD\u5B89\u5168\u63A8\u65AD", expected);
9821
10300
  }
9822
10301
  const oursChanged = hashContent(ours) !== source.hash;
9823
10302
  const sourceArtifactHash = artifactHashOf(source);
@@ -9831,7 +10310,7 @@ async function planFile(path2, baseRoot, targetRoot, source, target, ours, prove
9831
10310
  });
9832
10311
  if (forceTargetBaseline && path2.endsWith("package.json") && base) {
9833
10312
  const merged = mergePackageJson(base, ours, theirs);
9834
- return merged.content ? readyPlannedFile(path2, ownership, "update", "package.json \u5B57\u6BB5\u7EA7\u5408\u5E76", expected, merged.content) : conflict3(path2, ownership, `\u5B57\u6BB5\u51B2\u7A81\uFF1A${merged.conflicts.join("\u3001")}`, expected);
10313
+ return merged.content ? readyPlannedFile(path2, ownership, "update", "package.json \u5B57\u6BB5\u7EA7\u5408\u5E76", expected, merged.content) : conflict4(path2, ownership, `\u5B57\u6BB5\u51B2\u7A81\uFF1A${merged.conflicts.join("\u3001")}`, expected);
9835
10314
  }
9836
10315
  if (forceTargetBaseline) {
9837
10316
  return readyPlannedFile(path2, ownership, "update", "\u5F3A\u5236\u91C7\u7528\u76EE\u6807\u5E73\u53F0\u57FA\u7EBF", expected, theirs);
@@ -9841,11 +10320,11 @@ async function planFile(path2, baseRoot, targetRoot, source, target, ours, prove
9841
10320
  }
9842
10321
  if (targetChanged && path2.endsWith("package.json") && base) {
9843
10322
  const merged = mergePackageJson(base, ours, theirs);
9844
- return merged.content ? readyPlannedFile(path2, ownership, "update", "package.json \u5B57\u6BB5\u7EA7\u5408\u5E76", expected, merged.content) : conflict3(path2, ownership, `\u5B57\u6BB5\u51B2\u7A81\uFF1A${merged.conflicts.join("\u3001")}`, expected);
10323
+ return merged.content ? readyPlannedFile(path2, ownership, "update", "package.json \u5B57\u6BB5\u7EA7\u5408\u5E76", expected, merged.content) : conflict4(path2, ownership, `\u5B57\u6BB5\u51B2\u7A81\uFF1A${merged.conflicts.join("\u3001")}`, expected);
9845
10324
  }
9846
10325
  if (!oursChanged && targetChanged && adoptedProjectDelta && base) {
9847
10326
  const merged = await mergeTextFile(base, ours, theirs);
9848
- return merged.content ? readyPlannedFile(path2, ownership, "update", "\u4E09\u65B9\u5408\u5E76\u5DF2\u91C7\u7EB3\u9879\u76EE\u589E\u91CF", expected, merged.content) : conflict3(path2, ownership, merged.conflict || "\u4E09\u65B9\u5408\u5E76\u5931\u8D25", expected);
10327
+ return merged.content ? readyPlannedFile(path2, ownership, "update", "\u4E09\u65B9\u5408\u5E76\u5DF2\u91C7\u7EB3\u9879\u76EE\u589E\u91CF", expected, merged.content) : conflict4(path2, ownership, merged.conflict || "\u4E09\u65B9\u5408\u5E76\u5931\u8D25", expected);
9849
10328
  }
9850
10329
  if (!oursChanged) {
9851
10330
  return readyPlannedFile(path2, ownership, "update", "\u4EC5 Windy \u4FEE\u6539", expected, theirs);
@@ -9858,9 +10337,9 @@ async function planFile(path2, baseRoot, targetRoot, source, target, ours, prove
9858
10337
  }
9859
10338
  if (base) {
9860
10339
  const merged = await mergeTextFile(base, ours, theirs);
9861
- return merged.content ? readyPlannedFile(path2, ownership, "update", "\u4E09\u65B9\u5408\u5E76", expected, merged.content) : conflict3(path2, ownership, merged.conflict || "\u4E09\u65B9\u5408\u5E76\u5931\u8D25", expected);
10340
+ return merged.content ? readyPlannedFile(path2, ownership, "update", "\u4E09\u65B9\u5408\u5E76", expected, merged.content) : conflict4(path2, ownership, merged.conflict || "\u4E09\u65B9\u5408\u5E76\u5931\u8D25", expected);
9862
10341
  }
9863
- return conflict3(path2, ownership, "\u5BA2\u6237\u548C Windy \u5747\u5DF2\u4FEE\u6539", expected);
10342
+ return conflict4(path2, ownership, "\u5BA2\u6237\u548C Windy \u5747\u5DF2\u4FEE\u6539", expected);
9864
10343
  }
9865
10344
  function shouldForcePlatformBaseline(input) {
9866
10345
  return input.forcePlatformBaseline && !input.oursChanged && input.base !== undefined && hashContent(input.base) !== input.sourceArtifactHash;
@@ -9881,7 +10360,7 @@ function readyPlannedFile(path2, ownership, action, reason, expectedProjectConte
9881
10360
  function expectationForSnapshot(content) {
9882
10361
  return content ? { kind: "hash", value: hashContent(content) } : { kind: "missing" };
9883
10362
  }
9884
- function conflict3(path2, ownership, reason, expectedProjectContent) {
10363
+ function conflict4(path2, ownership, reason, expectedProjectContent) {
9885
10364
  return {
9886
10365
  path: path2,
9887
10366
  ownership,
@@ -9893,7 +10372,7 @@ function conflict3(path2, ownership, reason, expectedProjectContent) {
9893
10372
  }
9894
10373
  async function readOptional(path2) {
9895
10374
  try {
9896
- return await readFile19(path2);
10375
+ return await readFile20(path2);
9897
10376
  } catch (error) {
9898
10377
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
9899
10378
  return;
@@ -9945,27 +10424,27 @@ function hasExistingSourceForTest(path2, sourcePaths) {
9945
10424
  }
9946
10425
 
9947
10426
  // src/update/planner-snapshots.ts
9948
- import { readFile as readFile20, stat as stat2 } from "fs/promises";
9949
- import { join as join25 } from "path";
10427
+ import { readFile as readFile21, stat as stat2 } from "fs/promises";
10428
+ import { join as join26 } from "path";
9950
10429
  async function snapshotProjectFiles(project, paths, seed) {
9951
10430
  const snapshots = new Map(seed);
9952
10431
  await Promise.all([...paths].filter((path2) => !snapshots.has(path2)).map(async (path2) => {
9953
- snapshots.set(path2, await readOptional2(join25(project, path2)));
10432
+ snapshots.set(path2, await readOptional2(join26(project, path2)));
9954
10433
  }));
9955
10434
  return snapshots;
9956
10435
  }
9957
10436
  async function snapshotProjectModes(project, paths) {
9958
- return new Map(await Promise.all([...paths].map(async (path2) => [path2, await readModeOptional(join25(project, path2))])));
10437
+ return new Map(await Promise.all([...paths].map(async (path2) => [path2, await readModeOptional(join26(project, path2))])));
9959
10438
  }
9960
10439
  async function assertPlanSnapshots(project, expectations) {
9961
10440
  const changed = [];
9962
10441
  for (const expectation2 of expectations) {
9963
- const actual = expectationForSnapshot(await readOptional2(join25(project, expectation2.path)));
10442
+ const actual = expectationForSnapshot(await readOptional2(join26(project, expectation2.path)));
9964
10443
  if (JSON.stringify(actual) !== JSON.stringify(expectation2.expected)) {
9965
10444
  changed.push(expectation2.path);
9966
10445
  continue;
9967
10446
  }
9968
- if ("mode" in expectation2 && await readModeOptional(join25(project, expectation2.path)) !== expectation2.mode) {
10447
+ if ("mode" in expectation2 && await readModeOptional(join26(project, expectation2.path)) !== expectation2.mode) {
9969
10448
  changed.push(expectation2.path);
9970
10449
  }
9971
10450
  }
@@ -9997,7 +10476,7 @@ async function readSourceParentMode(path2) {
9997
10476
  }
9998
10477
  async function readOptional2(path2) {
9999
10478
  try {
10000
- return await readFile20(path2);
10479
+ return await readFile21(path2);
10001
10480
  } catch (error) {
10002
10481
  if (isMissing7(error))
10003
10482
  return;
@@ -10041,8 +10520,8 @@ var oxcManagedPaths = new Set([
10041
10520
  ]);
10042
10521
  async function createUpdatePlan(request, artifacts, dependencies = {}) {
10043
10522
  await assertProjectReadyForUpdate(request.projectDirectory);
10044
- const manifestPath = join26(request.projectDirectory, ".windy/files.json");
10045
- const expectedManifestHash = hashContent(await readFile21(manifestPath));
10523
+ const manifestPath = join27(request.projectDirectory, ".windy/files.json");
10524
+ const expectedManifestHash = hashContent(await readFile22(manifestPath));
10046
10525
  const generationSnapshot = await readGenerationProvenanceSnapshot(request.projectDirectory);
10047
10526
  const provenance = generationSnapshot.provenance;
10048
10527
  const targetModules = resolveUpdateTargetModules(provenance.modules.map(({ name }) => name), request.targetModules);
@@ -10089,8 +10568,8 @@ async function createUpdatePlan(request, artifacts, dependencies = {}) {
10089
10568
  const paths = new Set([...sourceEntries.keys(), ...targetEntries.keys()]);
10090
10569
  for (const path2 of paths) {
10091
10570
  if (!projectSnapshots.has(path2)) {
10092
- projectSnapshots.set(path2, await readOptional2(join26(request.projectDirectory, path2)));
10093
- projectModes.set(path2, await readModeOptional(join26(request.projectDirectory, path2)));
10571
+ projectSnapshots.set(path2, await readOptional2(join27(request.projectDirectory, path2)));
10572
+ projectModes.set(path2, await readModeOptional(join27(request.projectDirectory, path2)));
10094
10573
  }
10095
10574
  }
10096
10575
  const files = await planFiles({
@@ -10114,10 +10593,10 @@ async function createUpdatePlan(request, artifacts, dependencies = {}) {
10114
10593
  for (const file of files) {
10115
10594
  file.expectedProjectMode = projectModes.get(file.path);
10116
10595
  if (file.action === "create" || file.action === "update") {
10117
- file.mode = file.expectedProjectMode ?? await readModeOptional(join26(artifactSet.targetDirectory, file.path));
10596
+ file.mode = file.expectedProjectMode ?? await readModeOptional(join27(artifactSet.targetDirectory, file.path));
10118
10597
  }
10119
10598
  if (file.action === "create") {
10120
- file.parentMode = await readSourceParentMode(join26(artifactSet.targetDirectory, dirname9(file.path)));
10599
+ file.parentMode = await readSourceParentMode(join27(artifactSet.targetDirectory, dirname9(file.path)));
10121
10600
  }
10122
10601
  }
10123
10602
  const plannedPaths = new Set(files.map(({ path: path2 }) => path2));
@@ -10137,7 +10616,8 @@ async function createUpdatePlan(request, artifacts, dependencies = {}) {
10137
10616
  ...migrations.conflicts,
10138
10617
  ...files.flatMap((file) => file.conflict ? [`${file.path}\uFF1A${file.conflict}`] : [])
10139
10618
  ];
10140
- if (hashContent(await readFile21(manifestPath)) !== expectedManifestHash) {
10619
+ const manualCleanup = await inspectAdkRetirement(request.projectDirectory);
10620
+ if (hashContent(await readFile22(manifestPath)) !== expectedManifestHash) {
10141
10621
  throw new Error("\u751F\u6210\u66F4\u65B0\u8BA1\u5212\u671F\u95F4\u53D7\u7BA1\u6E05\u5355\u53D1\u751F\u53D8\u5316");
10142
10622
  }
10143
10623
  await assertPlanSnapshots(request.projectDirectory, [
@@ -10161,6 +10641,7 @@ async function createUpdatePlan(request, artifacts, dependencies = {}) {
10161
10641
  workspaceMembershipExpectations: workspaceSnapshot.membershipExpectations,
10162
10642
  finalWorkspaceMembershipExpectations: deriveFinalWorkspaceMembership(workspaceSnapshot.membershipExpectations, targetWorkspaceSnapshot.membershipExpectations, files),
10163
10643
  conflicts,
10644
+ manualCleanup,
10164
10645
  detachedToolchain,
10165
10646
  targetProvenance,
10166
10647
  sourceManifest,
@@ -10262,9 +10743,9 @@ function frozenManifestHash(file, finalizedHashes) {
10262
10743
  }
10263
10744
 
10264
10745
  // src/update/format-stabilizer.ts
10265
- import { mkdir as mkdir8, mkdtemp as mkdtemp3, readFile as readFile22, rm as rm7, writeFile as writeFile13 } from "fs/promises";
10746
+ import { mkdir as mkdir8, mkdtemp as mkdtemp3, readFile as readFile23, rm as rm7, writeFile as writeFile13 } from "fs/promises";
10266
10747
  import { tmpdir as tmpdir3 } from "os";
10267
- import { dirname as dirname10, extname as extname4, join as join27, resolve as resolve6, sep as sep5 } from "path";
10748
+ import { dirname as dirname10, extname as extname4, join as join28, resolve as resolve6, sep as sep5 } from "path";
10268
10749
  var formattedExtensions = new Set([
10269
10750
  ".cjs",
10270
10751
  ".css",
@@ -10303,7 +10784,7 @@ async function stabilizeManagedContent(result2, execute, writeProjectFile) {
10303
10784
  }
10304
10785
  }
10305
10786
  inputs.set(".windy/generation.json", new TextEncoder().encode(generationContent));
10306
- const temporaryRoot = await mkdtemp3(join27(tmpdir3(), "windy-update-format-"));
10787
+ const temporaryRoot = await mkdtemp3(join28(tmpdir3(), "windy-update-format-"));
10307
10788
  try {
10308
10789
  const stagedPaths = await stageInputs(temporaryRoot, inputs);
10309
10790
  for (let offset = 0;offset < stagedPaths.length; offset += 80) {
@@ -10311,14 +10792,14 @@ async function stabilizeManagedContent(result2, execute, writeProjectFile) {
10311
10792
  "x",
10312
10793
  "oxfmt",
10313
10794
  "--write",
10314
- `--config=${join27(result2.plan.projectDirectory, ".oxfmtrc.json")}`,
10795
+ `--config=${join28(result2.plan.projectDirectory, ".oxfmtrc.json")}`,
10315
10796
  ...stagedPaths.slice(offset, offset + 80)
10316
10797
  ], result2.plan.projectDirectory);
10317
10798
  }
10318
10799
  const hashes = plannedContentHashes(result2);
10319
10800
  let formattedGeneration = generationContent;
10320
10801
  for (const [path2, original] of inputs) {
10321
- const formatted = await readFile22(safeTemporaryPath(temporaryRoot, path2));
10802
+ const formatted = await readFile23(safeTemporaryPath(temporaryRoot, path2));
10322
10803
  if (path2 === ".windy/generation.json") {
10323
10804
  formattedGeneration = formatted.toString();
10324
10805
  continue;
@@ -10375,6 +10856,12 @@ async function writeUpdateReport(result2, steps, relativePath2, expected) {
10375
10856
  ] : [],
10376
10857
  `- \u4FEE\u6539\u6587\u4EF6\uFF1A${result2.changedFiles.length}`,
10377
10858
  `- Oxc \u4EE3\u7BA1\uFF1A${result2.plan.detachedToolchain ? "\u5DF2\u68C0\u6D4B\u5230\u5BA2\u6237\u63A5\u7BA1\u5E76\u4FDD\u7559" : "\u4FDD\u6301"}`,
10859
+ ...result2.plan.manualCleanup?.length ? [
10860
+ "",
10861
+ "## \u4EBA\u5DE5\u6E05\u7406",
10862
+ "",
10863
+ ...result2.plan.manualCleanup.map(({ message }) => `- ${message}`)
10864
+ ] : [],
10378
10865
  "",
10379
10866
  "## \u9A8C\u8BC1",
10380
10867
  "",
@@ -10472,7 +10959,7 @@ class DefaultStarterUpdater {
10472
10959
  const plannedPaths = new Set(result2.plan.files.map(({ path: path2 }) => path2));
10473
10960
  replaceExpectations(result2, verificationSnapshot.filter(({ path: path2 }) => !metadataPaths2.has(path2) && !plannedPaths.has(path2)));
10474
10961
  verificationExpectationsFrozen = true;
10475
- const packageJson = JSON.parse(await readFile23(join28(result2.plan.projectDirectory, "package.json"), "utf8"));
10962
+ const packageJson = JSON.parse(await readFile24(join29(result2.plan.projectDirectory, "package.json"), "utf8"));
10476
10963
  for (const name of ["lint", "typecheck", "test", "build"]) {
10477
10964
  if (!packageJson.scripts?.[name]) {
10478
10965
  steps.push({ name: `bun run ${name}`, status: "skipped" });
@@ -10500,7 +10987,8 @@ class DefaultStarterUpdater {
10500
10987
  throw error;
10501
10988
  }
10502
10989
  if (error instanceof TransactionCasError) {
10503
- throw new Error("\u66F4\u65B0\u6700\u7EC8\u63D0\u4EA4\u53D1\u751F\u5E76\u53D1\u51B2\u7A81\uFF0C\u4E8B\u52A1\u73B0\u573A\u5DF2\u4FDD\u7559\uFF1B\u8BF7\u8FD0\u884C bun run windy doctor --repair", { cause: error });
10990
+ const conflictDetail = error.paths.length ? `\uFF1A${error.paths.join("\u3001")}` : "";
10991
+ throw new Error(`\u66F4\u65B0\u6700\u7EC8\u63D0\u4EA4\u53D1\u751F\u5E76\u53D1\u51B2\u7A81${conflictDetail}\uFF0C\u4E8B\u52A1\u73B0\u573A\u5DF2\u4FDD\u7559\uFF1B\u8BF7\u8FD0\u884C bun run windy doctor --repair`, { cause: error });
10504
10992
  }
10505
10993
  if (verificationExpectationsFrozen) {
10506
10994
  const conflicts = await retainOwnedTransactionExpectationConflicts(result2.plan.projectDirectory, result2.transactionOwnerToken, result2.finalizationExpectations);
@@ -10703,9 +11191,9 @@ function assertEnabledConflicts(target, catalog) {
10703
11191
  for (const [name, enabled] of target) {
10704
11192
  if (!enabled)
10705
11193
  continue;
10706
- const conflict4 = catalog.get(name).conflicts.find((candidate) => target.get(candidate));
10707
- if (conflict4)
10708
- throw new Error(`\u6A21\u5757\u51B2\u7A81\uFF1A${name} \u4E0E ${conflict4}`);
11194
+ const conflict5 = catalog.get(name).conflicts.find((candidate) => target.get(candidate));
11195
+ if (conflict5)
11196
+ throw new Error(`\u6A21\u5757\u51B2\u7A81\uFF1A${name} \u4E0E ${conflict5}`);
10709
11197
  }
10710
11198
  }
10711
11199
  function assertCompatible(version, range, name) {
@@ -10720,7 +11208,7 @@ function reconcileProjectModuleRegistryPlan(plan, current, lifecycle) {
10720
11208
  if (!registryFile) {
10721
11209
  throw new Error("\u6A21\u5757\u751F\u547D\u5468\u671F\u8BA1\u5212\u7F3A\u5C11 project-owned \u88C5\u914D\u9009\u62E9");
10722
11210
  }
10723
- plan.conflicts = plan.conflicts.filter((conflict4) => !conflict4.startsWith(`${projectModuleRegistryPath}\uFF1A`));
11211
+ plan.conflicts = plan.conflicts.filter((conflict5) => !conflict5.startsWith(`${projectModuleRegistryPath}\uFF1A`));
10724
11212
  delete registryFile.conflict;
10725
11213
  if (lifecycle.action === "update") {
10726
11214
  registryFile.action = "preserve";
@@ -11150,8 +11638,8 @@ function printModulePlan(plan, log) {
11150
11638
  for (const file of changed) {
11151
11639
  log(` ${file.action.padEnd(6)} ${file.path}\uFF08${file.reason}\uFF09`);
11152
11640
  }
11153
- for (const conflict4 of plan.conflicts)
11154
- log(` conflict ${conflict4}`);
11641
+ for (const conflict5 of plan.conflicts)
11642
+ log(` conflict ${conflict5}`);
11155
11643
  }
11156
11644
  function hasChanges(lifecycle) {
11157
11645
  return lifecycle.addedModules.length > 0 || lifecycle.updatedModules.length > 0 || lifecycle.removedModules.length > 0;
@@ -11323,8 +11811,11 @@ function printPlan(plan) {
11323
11811
  console.log(`\u8BA1\u5212\u6539\u52A8\uFF1A${changed.length} \u4E2A\u6587\u4EF6\uFF1B\u51B2\u7A81\uFF1A${plan.conflicts.length}`);
11324
11812
  for (const file of changed)
11325
11813
  console.log(` ${file.action.padEnd(6)} ${file.path}\uFF08${file.reason}\uFF09`);
11326
- for (const conflict4 of plan.conflicts)
11327
- console.log(` conflict ${conflict4}`);
11814
+ for (const conflict5 of plan.conflicts)
11815
+ console.log(` conflict ${conflict5}`);
11816
+ for (const finding of plan.manualCleanup ?? []) {
11817
+ console.log(` manual ${finding.message}`);
11818
+ }
11328
11819
  if (plan.detachedToolchain)
11329
11820
  console.log("Oxc\uFF1A\u68C0\u6D4B\u5230\u5BA2\u6237\u63A5\u7BA1\uFF0C\u76F8\u5173\u914D\u7F6E\u4FDD\u6301\u4E0D\u53D8");
11330
11821
  }
@@ -11347,6 +11838,9 @@ function printDoctor(report) {
11347
11838
  if (report.duplicateLocalEnvironmentKeys.length) {
11348
11839
  console.log(`\u672C\u5730 .env \u91CD\u590D\u5B9A\u4E49\uFF1A${report.duplicateLocalEnvironmentKeys.join("\u3001")}\uFF08\u8BF7\u4EBA\u5DE5\u5904\u7406\uFF09`);
11349
11840
  }
11841
+ for (const finding of report.manualCleanup) {
11842
+ console.log(`\u4EBA\u5DE5\u6E05\u7406\uFF1A${finding.message}`);
11843
+ }
11350
11844
  if (report.recoveryRequired)
11351
11845
  console.log("\u6062\u590D\uFF1A\u68C0\u6D4B\u5230\u4E2D\u65AD\u66F4\u65B0\uFF0C\u8BF7\u8FD0\u884C doctor --repair");
11352
11846
  if (report.recoveryAction === "recovery-conflicts") {
@@ -11405,20 +11899,20 @@ import {
11405
11899
  cp,
11406
11900
  mkdir as mkdir9,
11407
11901
  mkdtemp as mkdtemp4,
11408
- readFile as readFile25,
11902
+ readFile as readFile26,
11409
11903
  readdir as readdir9,
11410
11904
  rename as rename2,
11411
11905
  rm as rm11,
11412
11906
  writeFile as writeFile14
11413
11907
  } from "fs/promises";
11414
- import { dirname as dirname11, join as join29, relative as relative7 } from "path";
11908
+ import { dirname as dirname11, join as join30, relative as relative7 } from "path";
11415
11909
 
11416
11910
  // src/module-schema/config.ts
11417
- import { readFile as readFile24 } from "fs/promises";
11911
+ import { readFile as readFile25 } from "fs/promises";
11418
11912
  import { isAbsolute as isAbsolute2, relative as relative6, resolve as resolve9 } from "path";
11419
11913
  async function readModuleSchemaLineageConfig(projectDirectory, configPath) {
11420
11914
  const absolutePath = resolveProjectPath(projectDirectory, configPath);
11421
- const parsed = JSON.parse(await readFile24(absolutePath, "utf8"));
11915
+ const parsed = JSON.parse(await readFile25(absolutePath, "utf8"));
11422
11916
  if (!isConfig(parsed)) {
11423
11917
  throw new Error("Module schema lineage \u914D\u7F6E\u65E0\u6548");
11424
11918
  }
@@ -11552,17 +12046,17 @@ async function handoffModuleSchemaLineages(options) {
11552
12046
  async function stageModuleLineages(project, temporaryRoot, config, execute) {
11553
12047
  const outputs = [];
11554
12048
  for (const [index, module2] of config.modules.entries()) {
11555
- const output = join29(temporaryRoot, `module-${index}`);
12049
+ const output = join30(temporaryRoot, `module-${index}`);
11556
12050
  await mkdir9(output, { recursive: true });
11557
- const generatedConfig = join29(temporaryRoot, `module-${index}.config.ts`);
12051
+ const generatedConfig = join30(temporaryRoot, `module-${index}.config.ts`);
11558
12052
  await writeDrizzleConfig(generatedConfig, project, module2.schema, relative7(temporaryRoot, output));
11559
12053
  await execute(generatedConfig, temporaryRoot);
11560
12054
  const sqlFiles = await listSqlFiles(output);
11561
12055
  if (sqlFiles.length !== 1) {
11562
12056
  throw new Error(`${module2.key} baseline \u5FC5\u987B\u6070\u597D\u751F\u6210\u4E00\u4E2A migration`);
11563
12057
  }
11564
- await writeFile14(join29(output, sqlFiles[0]), metadataOnlySql("module"));
11565
- await writeFile14(join29(output, "lineage.json"), `${JSON.stringify({
12058
+ await writeFile14(join30(output, sqlFiles[0]), metadataOnlySql("module"));
12059
+ await writeFile14(join30(output, "lineage.json"), `${JSON.stringify({
11566
12060
  schemaVersion: 1,
11567
12061
  moduleKey: module2.key,
11568
12062
  schema: module2.schema,
@@ -11576,25 +12070,25 @@ async function stageModuleLineages(project, temporaryRoot, config, execute) {
11576
12070
  }
11577
12071
  async function stagePlatformLineage(project, temporaryRoot, config, execute) {
11578
12072
  const source = resolveProjectPath(project, config.platform.out);
11579
- const output = join29(temporaryRoot, "platform");
12073
+ const output = join30(temporaryRoot, "platform");
11580
12074
  await cp(source, output, { recursive: true });
11581
12075
  const before = new Set(await listSqlFiles(output));
11582
- const generatedConfig = join29(temporaryRoot, "platform.config.ts");
12076
+ const generatedConfig = join30(temporaryRoot, "platform.config.ts");
11583
12077
  await writeDrizzleConfig(generatedConfig, project, config.platform.schema, relative7(temporaryRoot, output));
11584
12078
  await execute(generatedConfig, temporaryRoot);
11585
12079
  const created = (await listSqlFiles(output)).filter((path2) => !before.has(path2));
11586
12080
  if (created.length !== 1) {
11587
12081
  throw new Error("\u5E73\u53F0 lineage handoff \u5FC5\u987B\u6070\u597D\u751F\u6210\u4E00\u4E2A migration");
11588
12082
  }
11589
- const sqlPath = join29(output, created[0]);
12083
+ const sqlPath = join30(output, created[0]);
11590
12084
  const allowed = config.modules.flatMap(({ legacyPlatformTables }) => legacyPlatformTables);
11591
- validatePlatformHandoffSql(await readFile25(sqlPath, "utf8"), allowed);
12085
+ validatePlatformHandoffSql(await readFile26(sqlPath, "utf8"), allowed);
11592
12086
  await writeFile14(sqlPath, metadataOnlySql("platform"));
11593
12087
  return output;
11594
12088
  }
11595
12089
  async function installStagedLineages(project, temporaryRoot, config, stagedModules, stagedPlatform) {
11596
12090
  const platform = resolveProjectPath(project, config.platform.out);
11597
- const backup = join29(temporaryRoot, "platform-backup");
12091
+ const backup = join30(temporaryRoot, "platform-backup");
11598
12092
  const installed = [];
11599
12093
  await rename2(platform, backup);
11600
12094
  try {
@@ -11641,9 +12135,9 @@ async function validateSchemaSources(project, config) {
11641
12135
  }
11642
12136
  }
11643
12137
  async function createTemporaryRoot(project) {
11644
- const windy = join29(project, ".windy");
12138
+ const windy = join30(project, ".windy");
11645
12139
  await mkdir9(windy, { recursive: true });
11646
- return await mkdtemp4(join29(windy, "module-schema-handoff-"));
12140
+ return await mkdtemp4(join30(windy, "module-schema-handoff-"));
11647
12141
  }
11648
12142
  async function listSqlFiles(root) {
11649
12143
  return (await readdir9(root)).filter((path2) => path2.endsWith(".sql")).sort();