create-windy 0.5.2 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (589) hide show
  1. package/dist/cli.js +370 -156
  2. package/package.json +2 -1
  3. package/template/.windy-template.json +2 -2
  4. package/template/apps/agent-server/README.md +25 -6
  5. package/template/apps/agent-server/src/southwind_agent_server/adk_adapter.py +15 -2
  6. package/template/apps/agent-server/src/southwind_agent_server/app.py +13 -34
  7. package/template/apps/agent-server/src/southwind_agent_server/config.py +49 -0
  8. package/template/apps/agent-server/src/southwind_agent_server/contracts.py +13 -0
  9. package/template/apps/agent-server/src/southwind_agent_server/engine_capacity.py +31 -0
  10. package/template/apps/agent-server/src/southwind_agent_server/fingerprint.py +5 -0
  11. package/template/apps/agent-server/src/southwind_agent_server/health_routes.py +50 -0
  12. package/template/apps/agent-server/src/southwind_agent_server/openai_engine.py +11 -2
  13. package/template/apps/agent-server/src/southwind_agent_server/openai_provider.py +3 -9
  14. package/template/apps/agent-server/src/southwind_agent_server/postgres_store.py +5 -0
  15. package/template/apps/agent-server/src/southwind_agent_server/readiness_pin.py +37 -0
  16. package/template/apps/agent-server/src/southwind_agent_server/run_admission.py +64 -0
  17. package/template/apps/agent-server/src/southwind_agent_server/run_capacity.py +59 -0
  18. package/template/apps/agent-server/src/southwind_agent_server/service.py +42 -43
  19. package/template/apps/agent-server/src/southwind_agent_server/service_errors.py +4 -0
  20. package/template/apps/agent-server/src/southwind_agent_server/service_execution.py +31 -0
  21. package/template/apps/agent-server/src/southwind_agent_server/service_tasks.py +34 -0
  22. package/template/apps/agent-server/src/southwind_agent_server/sqlite_catalog.py +11 -0
  23. package/template/apps/agent-server/src/southwind_agent_server/store.py +6 -0
  24. package/template/apps/agent-server/src/southwind_agent_server/vision_probe.py +87 -0
  25. package/template/apps/agent-server/src/southwind_agent_server/vision_requirement.py +28 -0
  26. package/template/apps/agent-server/src/southwind_agent_server/vlm_readiness.py +247 -0
  27. package/template/apps/agent-server/tests/test_api.py +16 -3
  28. package/template/apps/agent-server/tests/test_openai_provider.py +21 -4
  29. package/template/apps/agent-server/tests/test_postgres_store.py +3 -0
  30. package/template/apps/agent-server/tests/test_run_capacity.py +110 -0
  31. package/template/apps/agent-server/tests/test_runtime_factory_readiness.py +37 -0
  32. package/template/apps/agent-server/tests/test_sqlite_store.py +3 -0
  33. package/template/apps/agent-server/tests/test_vision_readiness_enforcement.py +72 -0
  34. package/template/apps/agent-server/tests/test_vlm_readiness.py +106 -0
  35. package/template/apps/document-server/src/southwind_document_server/adapter.py +117 -205
  36. package/template/apps/document-server/src/southwind_document_server/adapter_errors.py +13 -0
  37. package/template/apps/document-server/src/southwind_document_server/app.py +62 -14
  38. package/template/apps/document-server/src/southwind_document_server/artifacts.py +27 -0
  39. package/template/apps/document-server/src/southwind_document_server/config.py +96 -2
  40. package/template/apps/document-server/src/southwind_document_server/contracts.py +168 -13
  41. package/template/apps/document-server/src/southwind_document_server/fingerprint.py +128 -0
  42. package/template/apps/document-server/src/southwind_document_server/grants.py +81 -0
  43. package/template/apps/document-server/src/southwind_document_server/multipart_output.py +265 -0
  44. package/template/apps/document-server/src/southwind_document_server/output_validation.py +202 -0
  45. package/template/apps/document-server/src/southwind_document_server/progress.py +27 -0
  46. package/template/apps/document-server/src/southwind_document_server/readiness.py +280 -0
  47. package/template/apps/document-server/src/southwind_document_server/readiness_contracts.py +280 -0
  48. package/template/apps/document-server/src/southwind_document_server/readiness_http.py +87 -0
  49. package/template/apps/document-server/src/southwind_document_server/readiness_support.py +120 -0
  50. package/template/apps/document-server/src/southwind_document_server/request_validation.py +48 -0
  51. package/template/apps/document-server/src/southwind_document_server/service.py +297 -96
  52. package/template/apps/document-server/src/southwind_document_server/service_recovery.py +183 -0
  53. package/template/apps/document-server/src/southwind_document_server/sink.py +316 -0
  54. package/template/apps/document-server/src/southwind_document_server/store.py +301 -141
  55. package/template/apps/document-server/src/southwind_document_server/store_events.py +40 -0
  56. package/template/apps/document-server/src/southwind_document_server/store_models.py +62 -0
  57. package/template/apps/document-server/src/southwind_document_server/store_recovery.py +247 -0
  58. package/template/apps/document-server/src/southwind_document_server/store_schema.py +50 -0
  59. package/template/apps/document-server/tests/recovery_support.py +230 -0
  60. package/template/apps/document-server/tests/support.py +210 -0
  61. package/template/apps/document-server/tests/test_adapter.py +251 -0
  62. package/template/apps/document-server/tests/test_config.py +43 -0
  63. package/template/apps/document-server/tests/test_contracts.py +80 -0
  64. package/template/apps/document-server/tests/test_fingerprint.py +125 -0
  65. package/template/apps/document-server/tests/test_grants.py +46 -0
  66. package/template/apps/document-server/tests/test_handshake.py +154 -0
  67. package/template/apps/document-server/tests/test_integration.py +192 -0
  68. package/template/apps/document-server/tests/test_multipart_security.py +259 -0
  69. package/template/apps/document-server/tests/test_readiness.py +311 -0
  70. package/template/apps/document-server/tests/test_readiness_contracts.py +131 -0
  71. package/template/apps/document-server/tests/test_recovery.py +222 -0
  72. package/template/apps/document-server/tests/test_recovery_faults.py +101 -0
  73. package/template/apps/document-server/tests/test_recovery_races.py +283 -0
  74. package/template/apps/document-server/tests/test_service.py +16 -13
  75. package/template/apps/document-server/tests/test_service_artifacts.py +296 -0
  76. package/template/apps/document-server/tests/test_sink.py +253 -0
  77. package/template/apps/document-server/tests/test_store.py +199 -0
  78. package/template/apps/embedding-server/pyproject.toml +5 -0
  79. package/template/apps/embedding-server/src/southwind_embedding_server/adapter.py +38 -2
  80. package/template/apps/embedding-server/src/southwind_embedding_server/app.py +135 -20
  81. package/template/apps/embedding-server/src/southwind_embedding_server/config.py +138 -4
  82. package/template/apps/embedding-server/src/southwind_embedding_server/contracts.py +13 -0
  83. package/template/apps/embedding-server/src/southwind_embedding_server/image_input.py +16 -5
  84. package/template/apps/embedding-server/src/southwind_embedding_server/pin_cli.py +62 -0
  85. package/template/apps/embedding-server/src/southwind_embedding_server/readiness.py +259 -0
  86. package/template/apps/embedding-server/src/southwind_embedding_server/readiness_contracts.py +221 -0
  87. package/template/apps/embedding-server/src/southwind_embedding_server/readiness_http.py +91 -0
  88. package/template/apps/embedding-server/src/southwind_embedding_server/run_cipher.py +31 -0
  89. package/template/apps/embedding-server/src/southwind_embedding_server/run_service.py +150 -0
  90. package/template/apps/embedding-server/src/southwind_embedding_server/run_store.py +250 -0
  91. package/template/apps/embedding-server/tests/test_adapter.py +25 -0
  92. package/template/apps/embedding-server/tests/test_config.py +13 -0
  93. package/template/apps/embedding-server/tests/test_readiness.py +202 -0
  94. package/template/apps/embedding-server/tests/test_run_http.py +257 -0
  95. package/template/apps/embedding-server/tests/test_run_service.py +202 -0
  96. package/template/apps/embedding-server/uv.lock +71 -0
  97. package/template/apps/server/Dockerfile +13 -0
  98. package/template/apps/server/package.json +1 -0
  99. package/template/apps/server/src/agent/drizzle-screenshot-intake-repository.integration.test.ts +286 -0
  100. package/template/apps/server/src/agent/drizzle-screenshot-intake-repository.ts +175 -0
  101. package/template/apps/server/src/agent/persistent-screenshot-intake-producer.ts +320 -0
  102. package/template/apps/server/src/agent/remote-runtime.ts +8 -1
  103. package/template/apps/server/src/agent/required-environment.ts +5 -0
  104. package/template/apps/server/src/agent/run-attach.ts +41 -0
  105. package/template/apps/server/src/agent/run-audit.ts +49 -0
  106. package/template/apps/server/src/agent/run-contracts.ts +6 -1
  107. package/template/apps/server/src/agent/run-facade.ts +67 -68
  108. package/template/apps/server/src/agent/run-route-input.ts +26 -1
  109. package/template/apps/server/src/agent/run-route-screenshot-context.test.ts +13 -0
  110. package/template/apps/server/src/agent/run-routes.ts +1 -0
  111. package/template/apps/server/src/agent/runtime-bootstrap-report.test.ts +1 -1
  112. package/template/apps/server/src/agent/runtime-bootstrap.ts +112 -60
  113. package/template/apps/server/src/agent/runtime-readiness-sources.test.ts +27 -0
  114. package/template/apps/server/src/agent/runtime-readiness-sources.ts +31 -0
  115. package/template/apps/server/src/agent/runtime-reporting-bootstrap.ts +40 -0
  116. package/template/apps/server/src/agent/screenshot-context-admission.test.ts +249 -0
  117. package/template/apps/server/src/agent/screenshot-context-attestation.ts +60 -0
  118. package/template/apps/server/src/agent/screenshot-intake-authorization.ts +29 -0
  119. package/template/apps/server/src/agent/screenshot-intake-bootstrap.ts +59 -0
  120. package/template/apps/server/src/agent/screenshot-intake-durable.ts +53 -0
  121. package/template/apps/server/src/agent/screenshot-intake-errors.ts +9 -0
  122. package/template/apps/server/src/agent/screenshot-intake-producer.ts +41 -0
  123. package/template/apps/server/src/agent/screenshot-intake-record.ts +44 -0
  124. package/template/apps/server/src/agent/screenshot-intake-recovery.ts +106 -0
  125. package/template/apps/server/src/agent/screenshot-intake-repository.ts +64 -0
  126. package/template/apps/server/src/agent/screenshot-intake-reservation.ts +24 -0
  127. package/template/apps/server/src/agent/screenshot-intake-routes.ts +171 -0
  128. package/template/apps/server/src/agent/screenshot-intake-runtime-types.ts +6 -0
  129. package/template/apps/server/src/agent/screenshot-intake-sweep.ts +26 -0
  130. package/template/apps/server/src/agent/screenshot-intake-test-support.ts +91 -0
  131. package/template/apps/server/src/agent/screenshot-intake-v2-validation.ts +176 -0
  132. package/template/apps/server/src/agent/screenshot-intake-v2.test.ts +345 -0
  133. package/template/apps/server/src/agent/screenshot-intake-v2.ts +348 -0
  134. package/template/apps/server/src/agent/screenshot-png.ts +15 -0
  135. package/template/apps/server/src/agent/screenshot-run-binding.ts +49 -0
  136. package/template/apps/server/src/agent/unavailable-routes.ts +9 -0
  137. package/template/apps/server/src/agent/vision-facade.test.ts +98 -8
  138. package/template/apps/server/src/agent/vision-input.ts +5 -2
  139. package/template/apps/server/src/agent/vision-readiness-pin.ts +32 -0
  140. package/template/apps/server/src/agent/vision-readiness.ts +58 -0
  141. package/template/apps/server/src/ai-artifact/runtime-reference.test.ts +135 -0
  142. package/template/apps/server/src/ai-artifact/runtime.ts +134 -5
  143. package/template/apps/server/src/ai-output-artifact/cleanup.ts +214 -0
  144. package/template/apps/server/src/ai-output-artifact/contracts.ts +152 -0
  145. package/template/apps/server/src/ai-output-artifact/drizzle-cleanup.ts +37 -0
  146. package/template/apps/server/src/ai-output-artifact/drizzle-complete.ts +71 -0
  147. package/template/apps/server/src/ai-output-artifact/drizzle-grant-cleanup.ts +45 -0
  148. package/template/apps/server/src/ai-output-artifact/drizzle-grants.ts +109 -0
  149. package/template/apps/server/src/ai-output-artifact/drizzle-mapping.ts +77 -0
  150. package/template/apps/server/src/ai-output-artifact/drizzle-readiness.ts +46 -0
  151. package/template/apps/server/src/ai-output-artifact/drizzle-repository.ts +350 -0
  152. package/template/apps/server/src/ai-output-artifact/drizzle-seal.ts +64 -0
  153. package/template/apps/server/src/ai-output-artifact/grant.ts +30 -0
  154. package/template/apps/server/src/ai-output-artifact/host-registry.ts +53 -0
  155. package/template/apps/server/src/ai-output-artifact/memory-cleanup.ts +47 -0
  156. package/template/apps/server/src/ai-output-artifact/memory-grants.ts +98 -0
  157. package/template/apps/server/src/ai-output-artifact/memory-readiness.ts +26 -0
  158. package/template/apps/server/src/ai-output-artifact/memory-repository.ts +348 -0
  159. package/template/apps/server/src/ai-output-artifact/policy.test.ts +67 -0
  160. package/template/apps/server/src/ai-output-artifact/policy.ts +125 -0
  161. package/template/apps/server/src/ai-output-artifact/postgres-test-support.ts +147 -0
  162. package/template/apps/server/src/ai-output-artifact/postgres.integration.test.ts +349 -0
  163. package/template/apps/server/src/ai-output-artifact/reference-codec.ts +128 -0
  164. package/template/apps/server/src/ai-output-artifact/repository-grant-invariants.test-support.ts +165 -0
  165. package/template/apps/server/src/ai-output-artifact/repository-invariants.test-support.ts +239 -0
  166. package/template/apps/server/src/ai-output-artifact/repository-invariants.test.ts +18 -0
  167. package/template/apps/server/src/ai-output-artifact/repository.ts +107 -0
  168. package/template/apps/server/src/ai-output-artifact/route-input.ts +173 -0
  169. package/template/apps/server/src/ai-output-artifact/routes-delete.test.ts +287 -0
  170. package/template/apps/server/src/ai-output-artifact/routes-grant.test.ts +116 -0
  171. package/template/apps/server/src/ai-output-artifact/routes-nonblocking-body.test.ts +136 -0
  172. package/template/apps/server/src/ai-output-artifact/routes-security.test.ts +176 -0
  173. package/template/apps/server/src/ai-output-artifact/routes-storage-error.test.ts +105 -0
  174. package/template/apps/server/src/ai-output-artifact/routes.test-support.ts +84 -0
  175. package/template/apps/server/src/ai-output-artifact/routes.test.ts +198 -0
  176. package/template/apps/server/src/ai-output-artifact/routes.ts +280 -0
  177. package/template/apps/server/src/ai-output-artifact/service-completion.ts +60 -0
  178. package/template/apps/server/src/ai-output-artifact/service-grants.test.ts +169 -0
  179. package/template/apps/server/src/ai-output-artifact/service-grants.ts +217 -0
  180. package/template/apps/server/src/ai-output-artifact/service-input.ts +175 -0
  181. package/template/apps/server/src/ai-output-artifact/service-read.ts +89 -0
  182. package/template/apps/server/src/ai-output-artifact/service-recovery.test.ts +238 -0
  183. package/template/apps/server/src/ai-output-artifact/service-support.ts +240 -0
  184. package/template/apps/server/src/ai-output-artifact/service.test.ts +283 -0
  185. package/template/apps/server/src/ai-output-artifact/service.ts +334 -0
  186. package/template/apps/server/src/ai-output-artifact/storage-recovery.ts +33 -0
  187. package/template/apps/server/src/ai-output-artifact/storage-writer.ts +103 -0
  188. package/template/apps/server/src/ai-output-artifact/test-support.ts +161 -0
  189. package/template/apps/server/src/ai-runtime-readiness/deployment-pin.ts +69 -0
  190. package/template/apps/server/src/ai-runtime-readiness/health-response.ts +92 -0
  191. package/template/apps/server/src/ai-runtime-readiness/operation-port-trust.test.ts +66 -0
  192. package/template/apps/server/src/ai-runtime-readiness/operation-port.test-support.ts +143 -0
  193. package/template/apps/server/src/ai-runtime-readiness/operation-port.test.ts +193 -0
  194. package/template/apps/server/src/ai-runtime-readiness/operation-port.ts +172 -0
  195. package/template/apps/server/src/ai-runtime-readiness/trust-store.ts +61 -0
  196. package/template/apps/server/src/app/ai-screenshot-intake-binding.ts +22 -0
  197. package/template/apps/server/src/app/document-output-artifact-bindings.ts +5 -0
  198. package/template/apps/server/src/app/speech-output-artifact-bindings.ts +5 -0
  199. package/template/apps/server/src/application-services.ts +9 -3
  200. package/template/apps/server/src/audit/redaction.ts +1 -0
  201. package/template/apps/server/src/audit/reliable-writer.test.ts +8 -0
  202. package/template/apps/server/src/auth/password-change-license-restriction.test.ts +156 -0
  203. package/template/apps/server/src/document/cancel-response.ts +33 -0
  204. package/template/apps/server/src/document/contracts.ts +6 -0
  205. package/template/apps/server/src/document/errors.ts +11 -0
  206. package/template/apps/server/src/document/facade-cancel.test.ts +226 -0
  207. package/template/apps/server/src/document/facade-cancel.ts +110 -0
  208. package/template/apps/server/src/document/facade-grant-handoff.test.ts +113 -0
  209. package/template/apps/server/src/document/facade-idempotency.test.ts +195 -0
  210. package/template/apps/server/src/document/facade-invocation.ts +46 -0
  211. package/template/apps/server/src/document/facade-output-artifact.test.ts +310 -0
  212. package/template/apps/server/src/document/facade-read-response.ts +116 -0
  213. package/template/apps/server/src/document/facade-readiness.test.ts +95 -0
  214. package/template/apps/server/src/document/facade-support.ts +297 -0
  215. package/template/apps/server/src/document/facade.ts +164 -173
  216. package/template/apps/server/src/document/output-artifact-composition.test.ts +64 -0
  217. package/template/apps/server/src/document/output-artifact-composition.ts +78 -0
  218. package/template/apps/server/src/document/output-artifact-fingerprint.contract.test.ts +110 -0
  219. package/template/apps/server/src/document/output-artifact-fingerprint.ts +150 -0
  220. package/template/apps/server/src/document/output-artifact-host-registry.ts +44 -0
  221. package/template/apps/server/src/document/output-artifact-host.test.ts +332 -0
  222. package/template/apps/server/src/document/output-artifact-host.ts +331 -0
  223. package/template/apps/server/src/document/output-artifact-manifest.test-support.ts +71 -0
  224. package/template/apps/server/src/document/output-artifact-publish.test-support.ts +48 -0
  225. package/template/apps/server/src/document/output-artifact-readiness-probe.ts +347 -0
  226. package/template/apps/server/src/document/output-artifact-readiness-timeout.ts +30 -0
  227. package/template/apps/server/src/document/output-artifact-readiness.test.ts +264 -0
  228. package/template/apps/server/src/document/output-artifact-readiness.ts +87 -0
  229. package/template/apps/server/src/document/output-artifact-route-composition.test.ts +27 -0
  230. package/template/apps/server/src/document/output-artifact-route-composition.ts +14 -0
  231. package/template/apps/server/src/document/output-artifact-runtime.test-support.ts +8 -0
  232. package/template/apps/server/src/document/output-artifact-runtime.test.ts +124 -0
  233. package/template/apps/server/src/document/output-artifact-runtime.ts +275 -0
  234. package/template/apps/server/src/document/output-artifact.test-support.ts +350 -0
  235. package/template/apps/server/src/document/remote-response.ts +162 -0
  236. package/template/apps/server/src/document/remote-runtime.test.ts +100 -4
  237. package/template/apps/server/src/document/remote-runtime.ts +37 -85
  238. package/template/apps/server/src/document/routes-read-response.test.ts +267 -0
  239. package/template/apps/server/src/document/routes.test.ts +109 -0
  240. package/template/apps/server/src/document/routes.ts +23 -14
  241. package/template/apps/server/src/embedding/audit.ts +46 -0
  242. package/template/apps/server/src/embedding/contracts.ts +19 -1
  243. package/template/apps/server/src/embedding/drizzle-run-binding-repository.integration.test.ts +100 -0
  244. package/template/apps/server/src/embedding/drizzle-run-binding-repository.ts +102 -0
  245. package/template/apps/server/src/embedding/facade-readiness.test.ts +307 -0
  246. package/template/apps/server/src/embedding/facade-types.ts +18 -0
  247. package/template/apps/server/src/embedding/facade.ts +248 -115
  248. package/template/apps/server/src/embedding/operation-authorization.ts +23 -0
  249. package/template/apps/server/src/embedding/readiness-admission.ts +26 -0
  250. package/template/apps/server/src/embedding/remote-runtime.test.ts +103 -0
  251. package/template/apps/server/src/embedding/remote-runtime.ts +98 -0
  252. package/template/apps/server/src/embedding/routes.test.ts +118 -0
  253. package/template/apps/server/src/embedding/routes.ts +98 -0
  254. package/template/apps/server/src/embedding/run-artifact.ts +18 -0
  255. package/template/apps/server/src/embedding/run-authorization.test.ts +133 -0
  256. package/template/apps/server/src/embedding/run-authorization.ts +91 -0
  257. package/template/apps/server/src/embedding/run-binding-repository.ts +75 -0
  258. package/template/apps/server/src/embedding/run-fingerprint.test.ts +78 -0
  259. package/template/apps/server/src/embedding/run-fingerprint.ts +48 -0
  260. package/template/apps/server/src/embedding/terminal-observer.test.ts +26 -0
  261. package/template/apps/server/src/embedding/terminal-observer.ts +44 -0
  262. package/template/apps/server/src/index.ts +38 -31
  263. package/template/apps/server/src/module-host/ai-operation-port.test.ts +72 -0
  264. package/template/apps/server/src/module-host/ai-operation-port.ts +46 -3
  265. package/template/apps/server/src/module-host/ai-operation-speech-normalize.test.ts +186 -0
  266. package/template/apps/server/src/module-host/durable-context.ts +194 -16
  267. package/template/apps/server/src/module-host/durable-handler-registration.ts +1 -0
  268. package/template/apps/server/src/module-host/durable-storage-filesystem-restart.test.ts +265 -0
  269. package/template/apps/server/src/module-host/durable-storage-write.test.ts +345 -0
  270. package/template/apps/server/src/module-host/http-runtime.ts +25 -0
  271. package/template/apps/server/src/module-host/initialize-contracts.ts +18 -1
  272. package/template/apps/server/src/module-host/initialize.test.ts +18 -0
  273. package/template/apps/server/src/module-host/initialize.ts +42 -2
  274. package/template/apps/server/src/module-host/module-secret-audit-version.test.ts +73 -0
  275. package/template/apps/server/src/module-host/module-secret-binding-resolution.ts +60 -0
  276. package/template/apps/server/src/module-host/module-secret-durable.test.ts +206 -0
  277. package/template/apps/server/src/module-host/module-secret-port.test-support.ts +125 -0
  278. package/template/apps/server/src/module-host/module-secret-port.test.ts +161 -0
  279. package/template/apps/server/src/module-host/module-secret-port.ts +249 -0
  280. package/template/apps/server/src/module-host/module-secret-result.test.ts +324 -0
  281. package/template/apps/server/src/module-host/module-secret-result.ts +274 -0
  282. package/template/apps/server/src/module-host/module-secret-tool-boundary.test.ts +143 -0
  283. package/template/apps/server/src/module-host/project-composition.ts +1 -0
  284. package/template/apps/server/src/module-host/report-staging-port.ts +55 -0
  285. package/template/apps/server/src/module-host/report-staging-registration.test.ts +104 -0
  286. package/template/apps/server/src/module-host/request-context.ts +58 -1
  287. package/template/apps/server/src/module-host/route-declaration.ts +11 -4
  288. package/template/apps/server/src/module-host/route-installer.test-fixture.ts +246 -0
  289. package/template/apps/server/src/module-host/route-installer.test.ts +47 -211
  290. package/template/apps/server/src/module-host/route-installer.ts +192 -21
  291. package/template/apps/server/src/module-host/route-registration.test.ts +44 -4
  292. package/template/apps/server/src/module-host/runtime-composition.ts +2 -0
  293. package/template/apps/server/src/module-host/scoped-host.ts +84 -0
  294. package/template/apps/server/src/module-host/screenshot-artifact-ref.ts +91 -0
  295. package/template/apps/server/src/module-host/screenshot-intake-composition.test.ts +292 -0
  296. package/template/apps/server/src/module-host/screenshot-intake-deadline.ts +38 -0
  297. package/template/apps/server/src/module-host/screenshot-intake-plan.ts +75 -0
  298. package/template/apps/server/src/module-host/screenshot-intake-port.ts +297 -0
  299. package/template/apps/server/src/module-host/screenshot-intake-security.test.ts +311 -0
  300. package/template/apps/server/src/module-host/screenshot-intake-store.ts +76 -0
  301. package/template/apps/server/src/module-host/screenshot-intake-test-support.ts +68 -0
  302. package/template/apps/server/src/module-host/secret-bindings.test.ts +167 -0
  303. package/template/apps/server/src/module-host/secret-bindings.ts +184 -0
  304. package/template/apps/server/src/module-host/storage-authorization-binding.test.ts +242 -0
  305. package/template/apps/server/src/module-host/storage-port.test.ts +8 -1
  306. package/template/apps/server/src/module-host/storage-port.ts +84 -8
  307. package/template/apps/server/src/module-host/storage-restart-fixture.test-support.ts +242 -0
  308. package/template/apps/server/src/module-host/storage-restart-postgres.integration.test.ts +280 -0
  309. package/template/apps/server/src/module-host/storage-scope-drift-http.test.ts +68 -0
  310. package/template/apps/server/src/module-host/storage-scope.ts +52 -1
  311. package/template/apps/server/src/module-host/storage-stream-route.test.ts +282 -0
  312. package/template/apps/server/src/module-host/storage-write-error.test.ts +174 -0
  313. package/template/apps/server/src/module-host/storage-write-error.ts +62 -0
  314. package/template/apps/server/src/module-host/storage-write-port.test.ts +323 -0
  315. package/template/apps/server/src/module-host/storage-write-port.ts +320 -0
  316. package/template/apps/server/src/module-host/storage-write-unavailable.ts +21 -0
  317. package/template/apps/server/src/module-host/storage-writer-retention.test.ts +109 -0
  318. package/template/apps/server/src/module-host/user-directory-composition.test.ts +1 -0
  319. package/template/apps/server/src/module-preflight-secret.test.ts +79 -0
  320. package/template/apps/server/src/module-preflight.ts +5 -0
  321. package/template/apps/server/src/platform-http-runtime.ts +16 -4
  322. package/template/apps/server/src/report-staging/archive-frame-stream.test.ts +209 -0
  323. package/template/apps/server/src/report-staging/archive-frame-stream.ts +341 -0
  324. package/template/apps/server/src/report-staging/archive-process.test.ts +302 -0
  325. package/template/apps/server/src/report-staging/archive-process.ts +257 -0
  326. package/template/apps/server/src/report-staging/archive-volumes.ts +30 -0
  327. package/template/apps/server/src/report-staging/cancellation.ts +13 -0
  328. package/template/apps/server/src/report-staging/contracts.ts +94 -0
  329. package/template/apps/server/src/report-staging/drizzle-lifecycle.ts +278 -0
  330. package/template/apps/server/src/report-staging/drizzle-mapping.ts +140 -0
  331. package/template/apps/server/src/report-staging/drizzle-repository.integration.test.ts +346 -0
  332. package/template/apps/server/src/report-staging/drizzle-repository.ts +255 -0
  333. package/template/apps/server/src/report-staging/drizzle-seal.integration.test.ts +267 -0
  334. package/template/apps/server/src/report-staging/drizzle-seal.ts +177 -0
  335. package/template/apps/server/src/report-staging/filesystem-cleanup.test.ts +68 -0
  336. package/template/apps/server/src/report-staging/filesystem-cleanup.ts +102 -0
  337. package/template/apps/server/src/report-staging/filesystem-errors.ts +15 -0
  338. package/template/apps/server/src/report-staging/filesystem-identifiers.ts +19 -0
  339. package/template/apps/server/src/report-staging/filesystem-io.test.ts +85 -0
  340. package/template/apps/server/src/report-staging/filesystem-io.ts +206 -0
  341. package/template/apps/server/src/report-staging/filesystem-scan.ts +85 -0
  342. package/template/apps/server/src/report-staging/filesystem-store.ts +346 -0
  343. package/template/apps/server/src/report-staging/heartbeat.test.ts +47 -0
  344. package/template/apps/server/src/report-staging/heartbeat.ts +53 -0
  345. package/template/apps/server/src/report-staging/manifest-stream.ts +46 -0
  346. package/template/apps/server/src/report-staging/memory-repository.ts +256 -0
  347. package/template/apps/server/src/report-staging/metadata-catalog.ts +89 -0
  348. package/template/apps/server/src/report-staging/metadata-spool-paths.ts +195 -0
  349. package/template/apps/server/src/report-staging/metadata-spool-schema.ts +54 -0
  350. package/template/apps/server/src/report-staging/metadata-spool.test.ts +214 -0
  351. package/template/apps/server/src/report-staging/metadata-spool.ts +305 -0
  352. package/template/apps/server/src/report-staging/native/archive-frame-helper.c +309 -0
  353. package/template/apps/server/src/report-staging/path-policy.test.ts +127 -0
  354. package/template/apps/server/src/report-staging/path-policy.ts +263 -0
  355. package/template/apps/server/src/report-staging/repository-fence.test.ts +114 -0
  356. package/template/apps/server/src/report-staging/repository.ts +75 -0
  357. package/template/apps/server/src/report-staging/runtime.ts +31 -0
  358. package/template/apps/server/src/report-staging/sealed-file.test.ts +34 -0
  359. package/template/apps/server/src/report-staging/sealed-file.ts +137 -0
  360. package/template/apps/server/src/report-staging/service-input-limits.test.ts +62 -0
  361. package/template/apps/server/src/report-staging/service-input.ts +204 -0
  362. package/template/apps/server/src/report-staging/service-lifecycle.test.ts +132 -0
  363. package/template/apps/server/src/report-staging/service-read-fence.test.ts +37 -0
  364. package/template/apps/server/src/report-staging/service-read.ts +172 -0
  365. package/template/apps/server/src/report-staging/service-support.ts +149 -0
  366. package/template/apps/server/src/report-staging/service.test-fixture.ts +226 -0
  367. package/template/apps/server/src/report-staging/service.test.ts +314 -0
  368. package/template/apps/server/src/report-staging/service.ts +255 -0
  369. package/template/apps/server/src/report-staging/supervised-process.ts +194 -0
  370. package/template/apps/server/src/speech/contracts.ts +8 -0
  371. package/template/apps/server/src/speech/errors.ts +10 -0
  372. package/template/apps/server/src/speech/facade-contract.ts +49 -0
  373. package/template/apps/server/src/speech/facade-output.test.ts +299 -0
  374. package/template/apps/server/src/speech/facade-output.ts +298 -0
  375. package/template/apps/server/src/speech/facade-validation.ts +127 -0
  376. package/template/apps/server/src/speech/facade.ts +185 -151
  377. package/template/apps/server/src/speech/fingerprint.test.ts +42 -0
  378. package/template/apps/server/src/speech/fingerprint.ts +28 -0
  379. package/template/apps/server/src/speech/output-artifact-binding.test.ts +11 -0
  380. package/template/apps/server/src/speech/output-artifact-binding.ts +30 -0
  381. package/template/apps/server/src/speech/output-artifact-error.ts +9 -0
  382. package/template/apps/server/src/speech/output-artifact-host.test-support.ts +73 -0
  383. package/template/apps/server/src/speech/output-artifact-host.test.ts +302 -0
  384. package/template/apps/server/src/speech/output-artifact-host.ts +279 -0
  385. package/template/apps/server/src/speech/output-artifact-policy.ts +114 -0
  386. package/template/apps/server/src/speech/output-artifact-replay.ts +91 -0
  387. package/template/apps/server/src/speech/remote-response.ts +158 -0
  388. package/template/apps/server/src/speech/remote-runtime.test.ts +90 -0
  389. package/template/apps/server/src/speech/remote-runtime.ts +36 -78
  390. package/template/apps/server/src/speech/routes.ts +60 -16
  391. package/template/apps/server/src/startup-finalization.ts +52 -0
  392. package/template/apps/server/src/startup-preflight.ts +2 -0
  393. package/template/apps/server/src/startup-shutdown.test.ts +69 -0
  394. package/template/apps/server/src/startup-shutdown.ts +61 -0
  395. package/template/apps/server/src/storage/drizzle-upload-purge.ts +61 -0
  396. package/template/apps/server/src/storage/drizzle-upload-references.ts +23 -0
  397. package/template/apps/server/src/storage/drizzle-upload-repository.integration.test.ts +103 -0
  398. package/template/apps/server/src/storage/drizzle-upload-repository.ts +109 -14
  399. package/template/apps/server/src/storage/host-runtime.ts +15 -0
  400. package/template/apps/server/src/storage/routes-stream-cancellation.test.ts +154 -0
  401. package/template/apps/server/src/storage/routes.test.ts +13 -2
  402. package/template/apps/server/src/storage/routes.ts +57 -18
  403. package/template/apps/server/src/storage/runtime.ts +17 -4
  404. package/template/apps/server/src/system/route-types.ts +5 -1
  405. package/template/apps/server/src/system/system-resource-monitoring.test.ts +47 -0
  406. package/template/apps/server/src/system/system-resource-monitoring.ts +60 -10
  407. package/template/apps/server/src/work-order/routes.test.ts +1 -0
  408. package/template/apps/speech-server/src/southwind_speech_server/adapter.py +58 -17
  409. package/template/apps/speech-server/src/southwind_speech_server/app.py +24 -17
  410. package/template/apps/speech-server/src/southwind_speech_server/bounded_json.py +60 -0
  411. package/template/apps/speech-server/src/southwind_speech_server/config.py +122 -2
  412. package/template/apps/speech-server/src/southwind_speech_server/contracts.py +58 -0
  413. package/template/apps/speech-server/src/southwind_speech_server/errors.py +8 -0
  414. package/template/apps/speech-server/src/southwind_speech_server/normalizer.py +14 -0
  415. package/template/apps/speech-server/src/southwind_speech_server/output_artifact.py +190 -0
  416. package/template/apps/speech-server/src/southwind_speech_server/output_validation.py +54 -0
  417. package/template/apps/speech-server/src/southwind_speech_server/pin_cli.py +83 -0
  418. package/template/apps/speech-server/src/southwind_speech_server/readiness.py +266 -0
  419. package/template/apps/speech-server/src/southwind_speech_server/readiness_contracts.py +268 -0
  420. package/template/apps/speech-server/src/southwind_speech_server/readiness_http.py +91 -0
  421. package/template/apps/speech-server/src/southwind_speech_server/readiness_local.py +161 -0
  422. package/template/apps/speech-server/src/southwind_speech_server/readiness_support.py +106 -0
  423. package/template/apps/speech-server/src/southwind_speech_server/service.py +118 -13
  424. package/template/apps/speech-server/src/southwind_speech_server/store.py +7 -0
  425. package/template/apps/speech-server/tests/test_bounded_json.py +55 -0
  426. package/template/apps/speech-server/tests/test_config.py +22 -0
  427. package/template/apps/speech-server/tests/test_output_artifact.py +60 -0
  428. package/template/apps/speech-server/tests/test_output_validation.py +44 -0
  429. package/template/apps/speech-server/tests/test_readiness.py +315 -0
  430. package/template/apps/speech-server/tests/test_readiness_http.py +48 -0
  431. package/template/apps/speech-server/tests/test_readiness_local.py +43 -0
  432. package/template/apps/speech-server/tests/test_service.py +211 -36
  433. package/template/apps/web/src/pages/system/components/OperationGpuMonitor.vue +2 -1
  434. package/template/apps/web/src/pages/system/components/OperationGpuMonitor.webtest.ts +29 -0
  435. package/template/apps/web/src/pages/system/components/OperationServiceMonitor.vue +2 -1
  436. package/template/apps/web/src/pages/system/components/OperationServiceMonitor.webtest.ts +4 -1
  437. package/template/docker-compose.yml +49 -1
  438. package/template/docs/architecture/ai-runtime-readiness.md +504 -0
  439. package/template/docs/architecture/ai-runtime.md +20 -4
  440. package/template/docs/architecture/durable-jobs.md +54 -5
  441. package/template/docs/architecture/module-host.md +72 -9
  442. package/template/docs/architecture/module-manifest-composition.md +5 -2
  443. package/template/docs/architecture/module-secret-resolution.md +250 -0
  444. package/template/docs/architecture/object-storage.md +144 -3
  445. package/template/docs/architecture/report-staging.md +158 -0
  446. package/template/docs/architecture/server-module-interface.md +29 -0
  447. package/template/docs/architecture/speech-variants.md +45 -0
  448. package/template/docs/platform/agent-tools.md +16 -0
  449. package/template/docs/platform/document-ai-runtime.md +199 -17
  450. package/template/docs/platform/module-configuration.md +5 -0
  451. package/template/docs/platform/speech-ai-runtime.md +34 -5
  452. package/template/docs/platform/vision-ai-runtime.md +46 -1
  453. package/template/package.json +4 -1
  454. package/template/packages/ai-client/package.json +1 -1
  455. package/template/packages/ai-client/src/agent/client/client.ts +3 -0
  456. package/template/packages/ai-client/src/agent/client/index.ts +1 -0
  457. package/template/packages/ai-client/src/agent/client/screenshot.test.ts +40 -0
  458. package/template/packages/ai-client/src/agent/client/screenshot.ts +146 -0
  459. package/template/packages/ai-client/src/agent/client/types.ts +2 -0
  460. package/template/packages/ai-client/src/agent/contracts/runs.ts +1 -0
  461. package/template/packages/ai-client/src/embedding/client.test.ts +52 -0
  462. package/template/packages/ai-client/src/embedding/client.ts +69 -0
  463. package/template/packages/ai-client/src/embedding/contracts.ts +47 -0
  464. package/template/packages/ai-client/src/embedding/index.ts +1 -0
  465. package/template/packages/ai-client/src/embedding/run.ts +130 -0
  466. package/template/packages/ai-client/src/speech/client.test.ts +26 -0
  467. package/template/packages/ai-client/src/speech/client.ts +25 -1
  468. package/template/packages/ai-client/src/speech/contracts.ts +19 -0
  469. package/template/packages/config/package.json +2 -2
  470. package/template/packages/database/drizzle/0048_illegal_magneto.sql +11 -0
  471. package/template/packages/database/drizzle/0049_right_lenny_balinger.sql +79 -0
  472. package/template/packages/database/drizzle/0050_greedy_sister_grimm.sql +92 -0
  473. package/template/packages/database/drizzle/0051_lame_shockwave.sql +19 -0
  474. package/template/packages/database/drizzle/0052_tiresome_komodo.sql +1 -0
  475. package/template/packages/database/drizzle/0053_calm_victor_mancha.sql +1 -0
  476. package/template/packages/database/drizzle/0054_tough_thanos.sql +29 -0
  477. package/template/packages/database/drizzle/meta/0048_snapshot.json +8852 -0
  478. package/template/packages/database/drizzle/meta/0049_snapshot.json +9410 -0
  479. package/template/packages/database/drizzle/meta/0050_snapshot.json +10115 -0
  480. package/template/packages/database/drizzle/meta/0051_snapshot.json +10257 -0
  481. package/template/packages/database/drizzle/meta/0052_snapshot.json +10263 -0
  482. package/template/packages/database/drizzle/meta/0053_snapshot.json +10270 -0
  483. package/template/packages/database/drizzle/meta/0054_snapshot.json +10468 -0
  484. package/template/packages/database/drizzle/meta/_journal.json +49 -0
  485. package/template/packages/database/package.json +2 -2
  486. package/template/packages/database/src/agent-runtime-schema.test.ts +15 -0
  487. package/template/packages/database/src/ai-output-artifacts.test.ts +57 -0
  488. package/template/packages/database/src/schema/agent-runtime.ts +43 -0
  489. package/template/packages/database/src/schema/ai-output-artifacts.ts +182 -0
  490. package/template/packages/database/src/schema/embedding-runtime.ts +62 -0
  491. package/template/packages/database/src/schema/file-storage.ts +18 -0
  492. package/template/packages/database/src/schema/index.ts +3 -0
  493. package/template/packages/database/src/schema/report-staging.ts +212 -0
  494. package/template/packages/database/src/schema.test.ts +19 -0
  495. package/template/packages/jobs/package.json +2 -2
  496. package/template/packages/modules/index.ts +2 -0
  497. package/template/packages/modules/package.json +1 -1
  498. package/template/packages/modules/src/ai-operation-composition.test.ts +37 -0
  499. package/template/packages/modules/src/ai-operation-composition.ts +4 -0
  500. package/template/packages/modules/src/ai-operation-readiness-contract.test.ts +38 -0
  501. package/template/packages/modules/src/ai-operation-readiness-contract.ts +34 -0
  502. package/template/packages/modules/src/ai-screenshot-context.test.ts +72 -0
  503. package/template/packages/modules/src/ai-screenshot-context.ts +50 -0
  504. package/template/packages/modules/src/capability-audit-validation.ts +20 -0
  505. package/template/packages/modules/src/capability-guard-validation.ts +41 -0
  506. package/template/packages/modules/src/composition.ts +11 -0
  507. package/template/packages/modules/src/manifest.ts +48 -0
  508. package/template/packages/modules/src/secret-composition.test.ts +308 -0
  509. package/template/packages/modules/src/secret-composition.ts +176 -0
  510. package/template/packages/modules/src/system-api-control-plane.ts +17 -1
  511. package/template/packages/modules/src/system-module-catalog.test.ts +52 -0
  512. package/template/packages/modules/src/system-module-catalog.ts +1 -1
  513. package/template/packages/server-sdk/contracts/ai-runtime-readiness/v1/document-python-parity.json +12 -0
  514. package/template/packages/server-sdk/contracts/ai-runtime-readiness/v1/document.json +70 -0
  515. package/template/packages/server-sdk/contracts/ai-runtime-readiness/v1/embedding.json +68 -0
  516. package/template/packages/server-sdk/contracts/ai-runtime-readiness/v1/speech.json +80 -0
  517. package/template/packages/server-sdk/contracts/ai-runtime-readiness/v1/vlm.json +70 -0
  518. package/template/packages/server-sdk/contracts/document-runtime/v1/fingerprint-fixture.json +101 -0
  519. package/template/packages/server-sdk/index.ts +109 -0
  520. package/template/packages/server-sdk/package.json +23 -4
  521. package/template/packages/server-sdk/src/ai-runtime-readiness-capture.ts +168 -0
  522. package/template/packages/server-sdk/src/ai-runtime-readiness-digest.ts +49 -0
  523. package/template/packages/server-sdk/src/ai-runtime-readiness-identity.ts +16 -0
  524. package/template/packages/server-sdk/src/ai-runtime-readiness-keys.ts +23 -0
  525. package/template/packages/server-sdk/src/ai-runtime-readiness-limits.ts +141 -0
  526. package/template/packages/server-sdk/src/ai-runtime-readiness-projection.ts +326 -0
  527. package/template/packages/server-sdk/src/ai-runtime-readiness-requirement.ts +31 -0
  528. package/template/packages/server-sdk/src/ai-runtime-readiness-time.ts +16 -0
  529. package/template/packages/server-sdk/src/ai-runtime-readiness-trust.ts +84 -0
  530. package/template/packages/server-sdk/src/ai-runtime-readiness-validation-values.ts +147 -0
  531. package/template/packages/server-sdk/src/ai-runtime-readiness-validation.ts +299 -0
  532. package/template/packages/server-sdk/src/ai-runtime-readiness-values.ts +42 -0
  533. package/template/packages/server-sdk/src/ai-runtime-readiness.adversarial-input.contract.test.ts +146 -0
  534. package/template/packages/server-sdk/src/ai-runtime-readiness.contract-support.ts +139 -0
  535. package/template/packages/server-sdk/src/ai-runtime-readiness.contract.test.ts +314 -0
  536. package/template/packages/server-sdk/src/ai-runtime-readiness.digest-safety.contract.test.ts +131 -0
  537. package/template/packages/server-sdk/src/ai-runtime-readiness.fail-closed.contract.test.ts +215 -0
  538. package/template/packages/server-sdk/src/ai-runtime-readiness.identity.contract.test.ts +138 -0
  539. package/template/packages/server-sdk/src/ai-runtime-readiness.input-safety.contract.test.ts +314 -0
  540. package/template/packages/server-sdk/src/ai-runtime-readiness.public-api.test.ts +18 -0
  541. package/template/packages/server-sdk/src/ai-runtime-readiness.python-parity.contract.test.ts +160 -0
  542. package/template/packages/server-sdk/src/ai-runtime-readiness.trust.contract.test.ts +135 -0
  543. package/template/packages/server-sdk/src/ai-runtime-readiness.ts +198 -0
  544. package/template/packages/server-sdk/src/ai-screenshot-intake-port.ts +58 -0
  545. package/template/packages/server-sdk/src/data-governance-registration.ts +1 -3
  546. package/template/packages/server-sdk/src/durable-handler.ts +12 -0
  547. package/template/packages/server-sdk/src/module-adapter.test.ts +10 -0
  548. package/template/packages/server-sdk/src/module-adapter.ts +3 -0
  549. package/template/packages/server-sdk/src/module-host.ts +8 -0
  550. package/template/packages/server-sdk/src/report-staging-context-compatibility.test.ts +25 -0
  551. package/template/packages/server-sdk/src/report-staging-port.ts +190 -0
  552. package/template/packages/server-sdk/src/request-context.ts +27 -1
  553. package/template/packages/server-sdk/src/route-definition.ts +6 -0
  554. package/template/packages/server-sdk/src/secret-binding.test.ts +66 -0
  555. package/template/packages/server-sdk/src/secret-binding.ts +54 -0
  556. package/template/packages/server-sdk/src/secret-context-compatibility.test.ts +77 -0
  557. package/template/packages/server-sdk/src/secret-port.ts +80 -0
  558. package/template/packages/server-sdk/src/storage-port.ts +129 -9
  559. package/template/packages/server-sdk/src/storage-v052-source-compatibility.test.ts +61 -0
  560. package/template/packages/shared/index.ts +5 -0
  561. package/template/packages/shared/package.json +4 -1
  562. package/template/packages/shared/src/ai-operation-readiness.test.ts +75 -0
  563. package/template/packages/shared/src/ai-operation-readiness.ts +170 -0
  564. package/template/packages/shared/src/license-catalog.ts +14 -9
  565. package/template/packages/shared/src/screenshot-context-digest.test.ts +46 -0
  566. package/template/packages/shared/src/screenshot-context-digest.ts +72 -0
  567. package/template/packages/shared/src/stable-key.ts +26 -0
  568. package/template/packages/shared/tsconfig.json +16 -0
  569. package/template/packages/storage/index.ts +2 -0
  570. package/template/packages/storage/package.json +1 -1
  571. package/template/packages/storage/src/in-memory-upload-repository.ts +105 -2
  572. package/template/packages/storage/src/local-file-blob-store.test.ts +58 -0
  573. package/template/packages/storage/src/local-file-blob-store.ts +5 -71
  574. package/template/packages/storage/src/local-file-blob-writer.ts +96 -0
  575. package/template/packages/storage/src/upload-abort-recovery.test.ts +234 -0
  576. package/template/packages/storage/src/upload-abort.ts +130 -0
  577. package/template/packages/storage/src/upload-cleanup-race.test.ts +207 -0
  578. package/template/packages/storage/src/upload-cleanup.ts +85 -0
  579. package/template/packages/storage/src/upload-completion.ts +52 -0
  580. package/template/packages/storage/src/upload-purge.test.ts +163 -0
  581. package/template/packages/storage/src/upload-purge.ts +261 -0
  582. package/template/packages/storage/src/upload-repository-v052-compatibility.test.ts +31 -0
  583. package/template/packages/storage/src/upload-repository.ts +61 -0
  584. package/template/packages/storage/src/upload-service-recovery.test.ts +296 -0
  585. package/template/packages/storage/src/upload-service.ts +138 -150
  586. package/template/packages/storage/src/upload-streams.ts +126 -30
  587. package/template/packages/storage/src/upload-types.ts +13 -0
  588. package/template/packages/storage/src/upload-validation.ts +127 -0
  589. package/template/scripts/provision-speech-readiness.ts +147 -0
@@ -132,4 +132,30 @@ describe("Speech AI Client", () => {
132
132
  ),
133
133
  ).rejects.toBeInstanceOf(SpeechClientError);
134
134
  });
135
+
136
+ test("V2 显式传输固定 variant,且不改写无版本 V1", async () => {
137
+ let body: unknown;
138
+ const client = createSpeechAiClient({
139
+ baseUrl: "https://windy.example",
140
+ fetch: async (_input, init) => {
141
+ body = JSON.parse(String(init?.body));
142
+ return Response.json({
143
+ runId: "speech-v2",
144
+ status: "accepted",
145
+ eventsUrl: "/api/speech/runs/speech-v2/events",
146
+ });
147
+ },
148
+ });
149
+ await client.run(
150
+ { key: "speech.translate", parseOutput: (value) => value },
151
+ {
152
+ contractVersion: 2,
153
+ variant: "translate",
154
+ source,
155
+ options: { targetLanguage: "en", timestamps: "segment" },
156
+ },
157
+ { idempotencyKey: "speech-v2" },
158
+ );
159
+ expect(body).toMatchObject({ contractVersion: 2, variant: "translate" });
160
+ });
135
161
  });
@@ -3,6 +3,7 @@ import type {
3
3
  SpeechFetch,
4
4
  SpeechOperation,
5
5
  SpeechRun,
6
+ SubmitSpeechInput,
6
7
  SubmitTranscriptionInput,
7
8
  } from "./contracts.js";
8
9
  import { SpeechClientError, speechHttpError } from "./error.js";
@@ -37,6 +38,22 @@ export class HttpSpeechAiClient implements SpeechAiClient {
37
38
  operation: SpeechOperation<Options, Output>,
38
39
  input: SubmitTranscriptionInput<Options>,
39
40
  context: { idempotencyKey: string; signal?: AbortSignal },
41
+ ): Promise<SpeechRun<Output>> {
42
+ return this.submit(operation, input, context);
43
+ }
44
+
45
+ async run<Options, Output>(
46
+ operation: SpeechOperation<Options, Output>,
47
+ input: SubmitSpeechInput<Options>,
48
+ context: { idempotencyKey: string; signal?: AbortSignal },
49
+ ): Promise<SpeechRun<Output>> {
50
+ return this.submit(operation, input, context);
51
+ }
52
+
53
+ private async submit<Options, Output>(
54
+ operation: SpeechOperation<Options, Output>,
55
+ input: SubmitTranscriptionInput<Options> | SubmitSpeechInput<Options>,
56
+ context: { idempotencyKey: string; signal?: AbortSignal },
40
57
  ): Promise<SpeechRun<Output>> {
41
58
  if (!operation.key.trim() || !context.idempotencyKey.trim()) {
42
59
  throw new SpeechClientError(
@@ -57,7 +74,14 @@ export class HttpSpeechAiClient implements SpeechAiClient {
57
74
  "content-type": "application/json",
58
75
  "idempotency-key": context.idempotencyKey,
59
76
  },
60
- body: JSON.stringify({ operationKey: operation.key, source, options }),
77
+ body: JSON.stringify({
78
+ operationKey: operation.key,
79
+ source,
80
+ options,
81
+ ...("contractVersion" in input
82
+ ? { contractVersion: input.contractVersion, variant: input.variant }
83
+ : {}),
84
+ }),
61
85
  signal: context.signal,
62
86
  });
63
87
  } catch (error) {
@@ -15,6 +15,20 @@ export interface BatchTranscriptionOptions {
15
15
  readonly timestamps?: "segment" | "word";
16
16
  }
17
17
 
18
+ export type SpeechVariant = "normalize" | "transcribe" | "translate";
19
+
20
+ export interface SpeechTranslationOptions extends BatchTranscriptionOptions {
21
+ readonly targetLanguage: string;
22
+ }
23
+
24
+ /** V2 is explicit; absent version remains the compatible V1 transcribe form. */
25
+ export interface SubmitSpeechInput<Options> {
26
+ readonly source: ArtifactRef;
27
+ readonly options?: Options;
28
+ readonly contractVersion: 2;
29
+ readonly variant: SpeechVariant;
30
+ }
31
+
18
32
  export interface SpeechOperation<Options, Output> {
19
33
  readonly key: string;
20
34
  parseOutput(value: unknown): Output;
@@ -126,4 +140,9 @@ export interface SpeechAiClient {
126
140
  input: SubmitTranscriptionInput<Options>,
127
141
  context: { idempotencyKey: string; signal?: AbortSignal },
128
142
  ): Promise<SpeechRun<Output>>;
143
+ run<Options, Output>(
144
+ operation: SpeechOperation<Options, Output>,
145
+ input: SubmitSpeechInput<Options>,
146
+ context: { idempotencyKey: string; signal?: AbortSignal },
147
+ ): Promise<SpeechRun<Output>>;
129
148
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@southwind-ai/config",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "engines": {
@@ -13,7 +13,7 @@
13
13
  "!src/**/*.test.ts"
14
14
  ],
15
15
  "dependencies": {
16
- "@southwind-ai/shared": "workspace:^",
16
+ "@southwind-ai/shared": "workspace:^0.2.5",
17
17
  "zod": "^4.4.3"
18
18
  },
19
19
  "exports": {
@@ -0,0 +1,11 @@
1
+ ALTER TABLE "file_upload_sessions" ADD COLUMN "module_name" varchar(80);--> statement-breakpoint
2
+ ALTER TABLE "file_upload_sessions" ADD COLUMN "authorization_scope_hash" varchar(64);--> statement-breakpoint
3
+ ALTER TABLE "file_upload_sessions" ADD CONSTRAINT "ck_file_upload_sessions_authorization_binding" CHECK ((
4
+ ("file_upload_sessions"."module_name" is null and "file_upload_sessions"."authorization_scope_hash" is null)
5
+ or (
6
+ "file_upload_sessions"."module_name" is not null
7
+ and "file_upload_sessions"."authorization_scope_hash" is not null
8
+ and "file_upload_sessions"."module_name" ~ '^[a-z0-9][a-z0-9._-]{0,79}$'
9
+ and "file_upload_sessions"."authorization_scope_hash" ~ '^[0-9a-f]{64}$'
10
+ )
11
+ ));
@@ -0,0 +1,79 @@
1
+ CREATE TABLE "ai_output_artifact_scopes" (
2
+ "scope_id" varchar(80) PRIMARY KEY NOT NULL,
3
+ "run_id" varchar(80) NOT NULL,
4
+ "request_id" varchar(128) NOT NULL,
5
+ "actor_id" varchar(64) NOT NULL,
6
+ "tenant_id" varchar(64) NOT NULL,
7
+ "module_name" varchar(80) NOT NULL,
8
+ "operation_key" varchar(200) NOT NULL,
9
+ "runtime_kind" varchar(24) NOT NULL,
10
+ "output_kind" varchar(80) NOT NULL,
11
+ "purpose" varchar(80) NOT NULL,
12
+ "data_classification" varchar(16) NOT NULL,
13
+ "idempotency_hash" varchar(64) NOT NULL,
14
+ "fingerprint" varchar(64) NOT NULL,
15
+ "scope_hash" varchar(64) NOT NULL,
16
+ "scope_snapshot" jsonb NOT NULL,
17
+ "deployment_identity" varchar(96) NOT NULL,
18
+ "release_digest" varchar(71) NOT NULL,
19
+ "offers_digest" varchar(71) NOT NULL,
20
+ "policy_digest" varchar(64) NOT NULL,
21
+ "revision" integer DEFAULT 1 NOT NULL,
22
+ "grant_sequence" integer DEFAULT 1 NOT NULL,
23
+ "grant_hash" varchar(64),
24
+ "active_grant_generation" integer,
25
+ "pending_grant_hash" varchar(64),
26
+ "pending_grant_generation" integer,
27
+ "pending_grant_expires_at" timestamp with time zone,
28
+ "status" varchar(24) NOT NULL,
29
+ "allowed_media_types" jsonb NOT NULL,
30
+ "max_artifact_bytes" bigint NOT NULL,
31
+ "max_artifacts" integer NOT NULL,
32
+ "max_total_bytes" bigint NOT NULL,
33
+ "artifact_count" integer DEFAULT 0 NOT NULL,
34
+ "completed_byte_size" bigint DEFAULT 0 NOT NULL,
35
+ "scope_expires_at" timestamp with time zone NOT NULL,
36
+ "file_expires_at" timestamp with time zone NOT NULL,
37
+ "ref_expires_at" timestamp with time zone NOT NULL,
38
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
39
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
40
+ CONSTRAINT "ck_ai_output_scopes_status" CHECK ("ai_output_artifact_scopes"."status" in ('open', 'sealed', 'aborting', 'cleanup-pending', 'aborted', 'cleaned')),
41
+ CONSTRAINT "ck_ai_output_scopes_runtime" CHECK ("ai_output_artifact_scopes"."runtime_kind" in ('agent', 'document', 'speech', 'embedding')),
42
+ CONSTRAINT "ck_ai_output_scopes_classification" CHECK ("ai_output_artifact_scopes"."data_classification" in ('public', 'internal', 'sensitive')),
43
+ CONSTRAINT "ck_ai_output_scopes_limits" CHECK ("ai_output_artifact_scopes"."max_artifact_bytes" > 0 and "ai_output_artifact_scopes"."max_artifact_bytes" <= "ai_output_artifact_scopes"."max_total_bytes" and "ai_output_artifact_scopes"."max_artifacts" > 0 and "ai_output_artifact_scopes"."max_total_bytes" > 0 and "ai_output_artifact_scopes"."artifact_count" >= 0 and "ai_output_artifact_scopes"."completed_byte_size" >= 0 and "ai_output_artifact_scopes"."artifact_count" <= "ai_output_artifact_scopes"."max_artifacts" and "ai_output_artifact_scopes"."completed_byte_size" <= "ai_output_artifact_scopes"."max_total_bytes"),
44
+ CONSTRAINT "ck_ai_output_scopes_digests" CHECK ("ai_output_artifact_scopes"."idempotency_hash" ~ '^[0-9a-f]{64}$' and "ai_output_artifact_scopes"."fingerprint" ~ '^[0-9a-f]{64}$' and "ai_output_artifact_scopes"."scope_hash" ~ '^[0-9a-f]{64}$' and "ai_output_artifact_scopes"."release_digest" ~ '^sha256:[0-9a-f]{64}$' and "ai_output_artifact_scopes"."offers_digest" ~ '^sha256:[0-9a-f]{64}$' and "ai_output_artifact_scopes"."policy_digest" ~ '^[0-9a-f]{64}$' and ("ai_output_artifact_scopes"."grant_hash" is null or "ai_output_artifact_scopes"."grant_hash" ~ '^[0-9a-f]{64}$') and ("ai_output_artifact_scopes"."pending_grant_hash" is null or "ai_output_artifact_scopes"."pending_grant_hash" ~ '^[0-9a-f]{64}$')),
45
+ CONSTRAINT "ck_ai_output_scopes_grant" CHECK ("ai_output_artifact_scopes"."revision" > 0 and "ai_output_artifact_scopes"."grant_sequence" > 0 and (("ai_output_artifact_scopes"."grant_hash" is null and "ai_output_artifact_scopes"."active_grant_generation" is null) or ("ai_output_artifact_scopes"."grant_hash" is not null and "ai_output_artifact_scopes"."active_grant_generation" > 0 and "ai_output_artifact_scopes"."active_grant_generation" <= "ai_output_artifact_scopes"."grant_sequence")) and (("ai_output_artifact_scopes"."pending_grant_hash" is null and "ai_output_artifact_scopes"."pending_grant_generation" is null and "ai_output_artifact_scopes"."pending_grant_expires_at" is null) or ("ai_output_artifact_scopes"."status" = 'open' and "ai_output_artifact_scopes"."pending_grant_hash" is not null and "ai_output_artifact_scopes"."pending_grant_generation" = "ai_output_artifact_scopes"."grant_sequence" and ("ai_output_artifact_scopes"."active_grant_generation" is null or "ai_output_artifact_scopes"."pending_grant_generation" > "ai_output_artifact_scopes"."active_grant_generation") and "ai_output_artifact_scopes"."pending_grant_expires_at" <= "ai_output_artifact_scopes"."scope_expires_at")) and ("ai_output_artifact_scopes"."status" <> 'cleaned' or ("ai_output_artifact_scopes"."grant_hash" is null and "ai_output_artifact_scopes"."active_grant_generation" is null and "ai_output_artifact_scopes"."pending_grant_hash" is null))),
46
+ CONSTRAINT "ck_ai_output_scopes_ttl" CHECK ("ai_output_artifact_scopes"."created_at" < "ai_output_artifact_scopes"."scope_expires_at" and "ai_output_artifact_scopes"."scope_expires_at" < "ai_output_artifact_scopes"."ref_expires_at" and "ai_output_artifact_scopes"."ref_expires_at" <= "ai_output_artifact_scopes"."file_expires_at")
47
+ );
48
+ --> statement-breakpoint
49
+ CREATE TABLE "ai_output_artifacts" (
50
+ "artifact_id" varchar(80) PRIMARY KEY NOT NULL,
51
+ "scope_id" varchar(80) NOT NULL,
52
+ "output_key" varchar(80) NOT NULL,
53
+ "fingerprint" varchar(64) NOT NULL,
54
+ "generation" integer DEFAULT 1 NOT NULL,
55
+ "status" varchar(24) NOT NULL,
56
+ "upload_session_id" varchar(40),
57
+ "file_id" varchar(40),
58
+ "filename" varchar(240) NOT NULL,
59
+ "mime_type" varchar(120) NOT NULL,
60
+ "expected_byte_size" bigint NOT NULL,
61
+ "expected_sha256" varchar(64) NOT NULL,
62
+ "byte_size" bigint,
63
+ "sha256" varchar(64),
64
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
65
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
66
+ CONSTRAINT "ck_ai_output_artifacts_status" CHECK ("ai_output_artifacts"."status" in ('creating', 'uploading', 'completed', 'aborting', 'cleanup-pending', 'aborted')),
67
+ CONSTRAINT "ck_ai_output_artifacts_expected" CHECK ("ai_output_artifacts"."expected_byte_size" >= 0 and "ai_output_artifacts"."expected_sha256" ~ '^[0-9a-f]{64}$' and "ai_output_artifacts"."fingerprint" ~ '^[0-9a-f]{64}$'),
68
+ CONSTRAINT "ck_ai_output_artifacts_actual" CHECK (("ai_output_artifacts"."byte_size" is null and "ai_output_artifacts"."sha256" is null) or ("ai_output_artifacts"."byte_size" >= 0 and "ai_output_artifacts"."sha256" ~ '^[0-9a-f]{64}$')),
69
+ CONSTRAINT "ck_ai_output_artifacts_completed" CHECK ("ai_output_artifacts"."status" <> 'completed' or ("ai_output_artifacts"."upload_session_id" is not null and "ai_output_artifacts"."file_id" is not null and "ai_output_artifacts"."byte_size" is not null and "ai_output_artifacts"."sha256" is not null))
70
+ );
71
+ --> statement-breakpoint
72
+ ALTER TABLE "ai_output_artifacts" ADD CONSTRAINT "ai_output_artifacts_scope_id_ai_output_artifact_scopes_scope_id_fk" FOREIGN KEY ("scope_id") REFERENCES "public"."ai_output_artifact_scopes"("scope_id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
73
+ CREATE UNIQUE INDEX "uk_ai_output_scopes_run_kind" ON "ai_output_artifact_scopes" USING btree ("run_id","output_kind");--> statement-breakpoint
74
+ CREATE UNIQUE INDEX "uk_ai_output_scopes_idempotency" ON "ai_output_artifact_scopes" USING btree ("idempotency_hash");--> statement-breakpoint
75
+ CREATE INDEX "idx_ai_output_scopes_cleanup" ON "ai_output_artifact_scopes" USING btree ("status","updated_at","scope_expires_at","file_expires_at");--> statement-breakpoint
76
+ CREATE UNIQUE INDEX "uk_ai_output_artifacts_key" ON "ai_output_artifacts" USING btree ("scope_id","output_key");--> statement-breakpoint
77
+ CREATE UNIQUE INDEX "uk_ai_output_artifacts_session" ON "ai_output_artifacts" USING btree ("upload_session_id");--> statement-breakpoint
78
+ CREATE UNIQUE INDEX "uk_ai_output_artifacts_file" ON "ai_output_artifacts" USING btree ("file_id");--> statement-breakpoint
79
+ CREATE INDEX "idx_ai_output_artifacts_scope_status" ON "ai_output_artifacts" USING btree ("scope_id","status");
@@ -0,0 +1,92 @@
1
+ CREATE TABLE "report_staging_claims" (
2
+ "group_id" varchar(80) PRIMARY KEY NOT NULL,
3
+ "token_hash" varchar(64) NOT NULL,
4
+ "generation" integer NOT NULL,
5
+ "expires_at" timestamp with time zone NOT NULL,
6
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
7
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
8
+ CONSTRAINT "ck_report_staging_claim" CHECK ("report_staging_claims"."token_hash" ~ '^[0-9a-f]{64}$' and "report_staging_claims"."generation" > 0)
9
+ );
10
+ --> statement-breakpoint
11
+ CREATE TABLE "report_staging_entries" (
12
+ "entry_id" varchar(80) PRIMARY KEY NOT NULL,
13
+ "group_id" varchar(80) NOT NULL,
14
+ "ordinal" integer NOT NULL,
15
+ "relative_path" varchar(4096) NOT NULL,
16
+ "path_key" varchar(64) NOT NULL,
17
+ "byte_size" bigint NOT NULL,
18
+ "sha256" varchar(64) NOT NULL,
19
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
20
+ CONSTRAINT "ck_report_staging_entry_hash" CHECK ("report_staging_entries"."byte_size" >= 0 and "report_staging_entries"."sha256" ~ '^[0-9a-f]{64}$' and "report_staging_entries"."path_key" ~ '^[0-9a-f]{64}$')
21
+ );
22
+ --> statement-breakpoint
23
+ CREATE TABLE "report_staging_groups" (
24
+ "group_id" varchar(80) PRIMARY KEY NOT NULL,
25
+ "module_name" varchar(80) NOT NULL,
26
+ "owner_id" varchar(80) NOT NULL,
27
+ "scope_hash" varchar(64) NOT NULL,
28
+ "purpose" varchar(160) NOT NULL,
29
+ "source_mode" varchar(24) NOT NULL,
30
+ "idempotency_hash" varchar(64) NOT NULL,
31
+ "fingerprint" varchar(64) NOT NULL,
32
+ "policy_digest" varchar(64) NOT NULL,
33
+ "entrypoint" varchar(4096) NOT NULL,
34
+ "status" varchar(24) NOT NULL,
35
+ "source_count" integer NOT NULL,
36
+ "entry_count" integer DEFAULT 0 NOT NULL,
37
+ "archive_byte_size" bigint DEFAULT 0 NOT NULL,
38
+ "expanded_byte_size" bigint DEFAULT 0 NOT NULL,
39
+ "seal_id" varchar(64),
40
+ "manifest_sha256" varchar(64),
41
+ "failure_code" varchar(80),
42
+ "revision" integer DEFAULT 1 NOT NULL,
43
+ "expires_at" timestamp with time zone NOT NULL,
44
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
45
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
46
+ CONSTRAINT "ck_report_staging_group_status" CHECK ("report_staging_groups"."status" in ('indexing', 'ready', 'failed', 'discarding', 'discarded', 'expired')),
47
+ CONSTRAINT "ck_report_staging_source_mode" CHECK ("report_staging_groups"."source_mode" in ('archive', 'expanded')),
48
+ CONSTRAINT "ck_report_staging_group_hashes" CHECK ("report_staging_groups"."scope_hash" ~ '^[0-9a-f]{64}$' and "report_staging_groups"."idempotency_hash" ~ '^[0-9a-f]{64}$' and "report_staging_groups"."fingerprint" ~ '^[0-9a-f]{64}$' and "report_staging_groups"."policy_digest" ~ '^[0-9a-f]{64}$' and ("report_staging_groups"."seal_id" is null or "report_staging_groups"."seal_id" ~ '^[0-9a-f]{64}$') and ("report_staging_groups"."manifest_sha256" is null or "report_staging_groups"."manifest_sha256" ~ '^[0-9a-f]{64}$')),
49
+ CONSTRAINT "ck_report_staging_group_seal" CHECK (("report_staging_groups"."status" = 'ready' and "report_staging_groups"."seal_id" is not null and "report_staging_groups"."manifest_sha256" is not null) or ("report_staging_groups"."status" in ('indexing', 'failed') and "report_staging_groups"."seal_id" is null and "report_staging_groups"."manifest_sha256" is null) or ("report_staging_groups"."status" in ('discarding', 'discarded', 'expired') and (("report_staging_groups"."seal_id" is null and "report_staging_groups"."manifest_sha256" is null) or ("report_staging_groups"."seal_id" is not null and "report_staging_groups"."manifest_sha256" is not null)))),
50
+ CONSTRAINT "ck_report_staging_group_counts" CHECK ("report_staging_groups"."source_count" > 0 and "report_staging_groups"."entry_count" >= 0 and "report_staging_groups"."archive_byte_size" >= 0 and "report_staging_groups"."expanded_byte_size" >= 0 and "report_staging_groups"."revision" > 0)
51
+ );
52
+ --> statement-breakpoint
53
+ CREATE TABLE "report_staging_read_leases" (
54
+ "lease_id" varchar(80) PRIMARY KEY NOT NULL,
55
+ "group_id" varchar(80) NOT NULL,
56
+ "module_name" varchar(80) NOT NULL,
57
+ "owner_id" varchar(80) NOT NULL,
58
+ "scope_hash" varchar(64) NOT NULL,
59
+ "expires_at" timestamp with time zone NOT NULL,
60
+ "closed_at" timestamp with time zone,
61
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
62
+ CONSTRAINT "ck_report_staging_lease_scope" CHECK ("report_staging_read_leases"."scope_hash" ~ '^[0-9a-f]{64}$')
63
+ );
64
+ --> statement-breakpoint
65
+ CREATE TABLE "report_staging_sources" (
66
+ "source_id" varchar(80) PRIMARY KEY NOT NULL,
67
+ "group_id" varchar(80) NOT NULL,
68
+ "ordinal" integer NOT NULL,
69
+ "file_id" varchar(80) NOT NULL,
70
+ "file_purpose" varchar(160) NOT NULL,
71
+ "resource_type" varchar(160) NOT NULL,
72
+ "resource_id" varchar(160) NOT NULL,
73
+ "relative_path" varchar(4096) NOT NULL,
74
+ "byte_size" bigint,
75
+ "sha256" varchar(64),
76
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
77
+ CONSTRAINT "ck_report_staging_source_actual" CHECK (("report_staging_sources"."byte_size" is null and "report_staging_sources"."sha256" is null) or ("report_staging_sources"."byte_size" >= 0 and "report_staging_sources"."sha256" ~ '^[0-9a-f]{64}$'))
78
+ );
79
+ --> statement-breakpoint
80
+ ALTER TABLE "report_staging_claims" ADD CONSTRAINT "report_staging_claims_group_id_report_staging_groups_group_id_fk" FOREIGN KEY ("group_id") REFERENCES "public"."report_staging_groups"("group_id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
81
+ ALTER TABLE "report_staging_entries" ADD CONSTRAINT "report_staging_entries_group_id_report_staging_groups_group_id_fk" FOREIGN KEY ("group_id") REFERENCES "public"."report_staging_groups"("group_id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
82
+ ALTER TABLE "report_staging_read_leases" ADD CONSTRAINT "report_staging_read_leases_group_id_report_staging_groups_group_id_fk" FOREIGN KEY ("group_id") REFERENCES "public"."report_staging_groups"("group_id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
83
+ ALTER TABLE "report_staging_sources" ADD CONSTRAINT "report_staging_sources_group_id_report_staging_groups_group_id_fk" FOREIGN KEY ("group_id") REFERENCES "public"."report_staging_groups"("group_id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
84
+ CREATE INDEX "idx_report_staging_claim_expiry" ON "report_staging_claims" USING btree ("expires_at");--> statement-breakpoint
85
+ CREATE UNIQUE INDEX "uk_report_staging_entry_ordinal" ON "report_staging_entries" USING btree ("group_id","ordinal");--> statement-breakpoint
86
+ CREATE UNIQUE INDEX "uk_report_staging_entry_path_key" ON "report_staging_entries" USING btree ("group_id","path_key");--> statement-breakpoint
87
+ CREATE INDEX "idx_report_staging_entry_page" ON "report_staging_entries" USING btree ("group_id","ordinal");--> statement-breakpoint
88
+ CREATE UNIQUE INDEX "uk_report_staging_idempotency" ON "report_staging_groups" USING btree ("module_name","owner_id","scope_hash","purpose","idempotency_hash");--> statement-breakpoint
89
+ CREATE INDEX "idx_report_staging_cleanup" ON "report_staging_groups" USING btree ("status","expires_at","updated_at");--> statement-breakpoint
90
+ CREATE INDEX "idx_report_staging_lease_active" ON "report_staging_read_leases" USING btree ("group_id","closed_at","expires_at");--> statement-breakpoint
91
+ CREATE UNIQUE INDEX "uk_report_staging_source_ordinal" ON "report_staging_sources" USING btree ("group_id","ordinal");--> statement-breakpoint
92
+ CREATE UNIQUE INDEX "uk_report_staging_source_path" ON "report_staging_sources" USING btree ("group_id","relative_path");
@@ -0,0 +1,19 @@
1
+ CREATE TABLE "embedding_run_bindings" (
2
+ "binding_id" varchar(80) PRIMARY KEY NOT NULL,
3
+ "run_id" varchar(80),
4
+ "operation_key" varchar(200) NOT NULL,
5
+ "module_name" varchar(80) NOT NULL,
6
+ "actor_id" varchar(64) NOT NULL,
7
+ "idempotency_hash" varchar(64) NOT NULL,
8
+ "fingerprint" varchar(64) NOT NULL,
9
+ "scope_hash" varchar(64) NOT NULL,
10
+ "scope_snapshot" jsonb NOT NULL,
11
+ "deployment_pin" jsonb,
12
+ "created_at" double precision NOT NULL,
13
+ "expires_at" double precision NOT NULL,
14
+ CONSTRAINT "ck_embedding_run_binding_hashes" CHECK ("embedding_run_bindings"."idempotency_hash" ~ '^[0-9a-f]{64}$' and "embedding_run_bindings"."fingerprint" ~ '^[0-9a-f]{64}$' and "embedding_run_bindings"."scope_hash" ~ '^[0-9a-f]{64}$')
15
+ );
16
+ --> statement-breakpoint
17
+ CREATE UNIQUE INDEX "uk_embedding_run_bindings_run" ON "embedding_run_bindings" USING btree ("run_id");--> statement-breakpoint
18
+ CREATE UNIQUE INDEX "uk_embedding_run_bindings_idempotency" ON "embedding_run_bindings" USING btree ("idempotency_hash");--> statement-breakpoint
19
+ CREATE INDEX "idx_embedding_run_bindings_actor" ON "embedding_run_bindings" USING btree ("actor_id","expires_at");
@@ -0,0 +1 @@
1
+ ALTER TABLE "embedding_run_bindings" ADD COLUMN "terminal_audit_at" double precision;
@@ -0,0 +1 @@
1
+ ALTER TABLE "embedding_run_bindings" ADD COLUMN "artifact_refs" jsonb DEFAULT '[]'::jsonb NOT NULL;
@@ -0,0 +1,29 @@
1
+ CREATE TABLE "agent_screenshot_intakes" (
2
+ "intake_id" varchar(80) PRIMARY KEY NOT NULL,
3
+ "token_hash" varchar(64) NOT NULL,
4
+ "actor_id" varchar(64) NOT NULL,
5
+ "actor_type" varchar(32) NOT NULL,
6
+ "scope_hash" varchar(64) NOT NULL,
7
+ "module_name" varchar(160) NOT NULL,
8
+ "operation_key" varchar(200) NOT NULL,
9
+ "purpose" varchar(260) NOT NULL,
10
+ "page_id" varchar(256) NOT NULL,
11
+ "context_digest" varchar(72) NOT NULL,
12
+ "deployment_pin" jsonb NOT NULL,
13
+ "media_type" varchar(80) NOT NULL,
14
+ "byte_size" integer NOT NULL,
15
+ "pixels" integer NOT NULL,
16
+ "status" varchar(24) NOT NULL,
17
+ "upload_id" varchar(80),
18
+ "file_id" varchar(80),
19
+ "run_id" varchar(80),
20
+ "created_at" double precision NOT NULL,
21
+ "expires_at" double precision NOT NULL,
22
+ CONSTRAINT "ck_agent_screenshot_intakes_status" CHECK ("agent_screenshot_intakes"."status" in ('created', 'uploading', 'uploaded', 'reserving', 'bound', 'cancelled')),
23
+ CONSTRAINT "ck_agent_screenshot_intakes_bytes" CHECK ("agent_screenshot_intakes"."byte_size" > 0),
24
+ CONSTRAINT "ck_agent_screenshot_intakes_pixels" CHECK ("agent_screenshot_intakes"."pixels" > 0)
25
+ );
26
+ --> statement-breakpoint
27
+ CREATE UNIQUE INDEX "uk_agent_screenshot_intakes_token" ON "agent_screenshot_intakes" USING btree ("token_hash");--> statement-breakpoint
28
+ CREATE UNIQUE INDEX "uk_agent_screenshot_intakes_run" ON "agent_screenshot_intakes" USING btree ("run_id");--> statement-breakpoint
29
+ CREATE INDEX "idx_agent_screenshot_intakes_expiry" ON "agent_screenshot_intakes" USING btree ("status","expires_at");