@marinoscar/platform-contract 0.1.0-next.3 → 0.1.0-next.4

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 (673) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/README.md +23 -1
  3. package/dist/cjs/ai/capabilities.d.ts +85 -0
  4. package/dist/cjs/ai/capabilities.d.ts.map +1 -0
  5. package/dist/cjs/ai/capabilities.js +93 -0
  6. package/dist/cjs/ai/capabilities.js.map +1 -0
  7. package/dist/cjs/ai/constants.d.ts +239 -0
  8. package/dist/cjs/ai/constants.d.ts.map +1 -0
  9. package/dist/cjs/ai/constants.js +233 -0
  10. package/dist/cjs/ai/constants.js.map +1 -0
  11. package/dist/cjs/ai/features.d.ts +24 -0
  12. package/dist/cjs/ai/features.d.ts.map +1 -0
  13. package/dist/cjs/ai/features.js +33 -0
  14. package/dist/cjs/ai/features.js.map +1 -0
  15. package/dist/cjs/ai/index.d.ts +11 -0
  16. package/dist/cjs/ai/index.d.ts.map +1 -0
  17. package/dist/cjs/ai/index.js +81 -0
  18. package/dist/cjs/ai/index.js.map +1 -0
  19. package/dist/cjs/ai/org-keys.d.ts +50 -0
  20. package/dist/cjs/ai/org-keys.d.ts.map +1 -0
  21. package/dist/cjs/ai/org-keys.js +43 -0
  22. package/dist/cjs/ai/org-keys.js.map +1 -0
  23. package/dist/cjs/ai/schemas.d.ts +642 -0
  24. package/dist/cjs/ai/schemas.d.ts.map +1 -0
  25. package/dist/cjs/ai/schemas.js +894 -0
  26. package/dist/cjs/ai/schemas.js.map +1 -0
  27. package/dist/cjs/android-app/constants.d.ts +337 -0
  28. package/dist/cjs/android-app/constants.d.ts.map +1 -0
  29. package/dist/cjs/android-app/constants.js +312 -0
  30. package/dist/cjs/android-app/constants.js.map +1 -0
  31. package/dist/cjs/android-app/index.d.ts +5 -0
  32. package/dist/cjs/android-app/index.d.ts.map +1 -0
  33. package/dist/cjs/android-app/index.js +57 -0
  34. package/dist/cjs/android-app/index.js.map +1 -0
  35. package/dist/cjs/android-app/schemas.d.ts +358 -0
  36. package/dist/cjs/android-app/schemas.d.ts.map +1 -0
  37. package/dist/cjs/android-app/schemas.js +310 -0
  38. package/dist/cjs/android-app/schemas.js.map +1 -0
  39. package/dist/cjs/credentials/constants.d.ts +35 -0
  40. package/dist/cjs/credentials/constants.d.ts.map +1 -0
  41. package/dist/cjs/credentials/constants.js +39 -0
  42. package/dist/cjs/credentials/constants.js.map +1 -0
  43. package/dist/cjs/credentials/index.d.ts +5 -0
  44. package/dist/cjs/credentials/index.d.ts.map +1 -0
  45. package/dist/cjs/credentials/index.js +17 -0
  46. package/dist/cjs/credentials/index.js.map +1 -0
  47. package/dist/cjs/credentials/schemas.d.ts +64 -0
  48. package/dist/cjs/credentials/schemas.d.ts.map +1 -0
  49. package/dist/cjs/credentials/schemas.js +82 -0
  50. package/dist/cjs/credentials/schemas.js.map +1 -0
  51. package/dist/cjs/db-backup/config.d.ts +76 -0
  52. package/dist/cjs/db-backup/config.d.ts.map +1 -0
  53. package/dist/cjs/db-backup/config.js +115 -0
  54. package/dist/cjs/db-backup/config.js.map +1 -0
  55. package/dist/cjs/db-backup/constants.d.ts +314 -0
  56. package/dist/cjs/db-backup/constants.d.ts.map +1 -0
  57. package/dist/cjs/db-backup/constants.js +243 -0
  58. package/dist/cjs/db-backup/constants.js.map +1 -0
  59. package/dist/cjs/db-backup/index.d.ts +19 -0
  60. package/dist/cjs/db-backup/index.d.ts.map +1 -0
  61. package/dist/cjs/db-backup/index.js +81 -0
  62. package/dist/cjs/db-backup/index.js.map +1 -0
  63. package/dist/cjs/db-backup/node-credential.d.ts +37 -0
  64. package/dist/cjs/db-backup/node-credential.d.ts.map +1 -0
  65. package/dist/cjs/db-backup/node-credential.js +107 -0
  66. package/dist/cjs/db-backup/node-credential.js.map +1 -0
  67. package/dist/cjs/db-backup/node-result.d.ts +34 -0
  68. package/dist/cjs/db-backup/node-result.d.ts.map +1 -0
  69. package/dist/cjs/db-backup/node-result.js +168 -0
  70. package/dist/cjs/db-backup/node-result.js.map +1 -0
  71. package/dist/cjs/db-backup/restore.d.ts +405 -0
  72. package/dist/cjs/db-backup/restore.d.ts.map +1 -0
  73. package/dist/cjs/db-backup/restore.js +497 -0
  74. package/dist/cjs/db-backup/restore.js.map +1 -0
  75. package/dist/cjs/db-backup/run-actions.d.ts +49 -0
  76. package/dist/cjs/db-backup/run-actions.d.ts.map +1 -0
  77. package/dist/cjs/db-backup/run-actions.js +121 -0
  78. package/dist/cjs/db-backup/run-actions.js.map +1 -0
  79. package/dist/cjs/db-backup/runs-list-query.d.ts +20 -0
  80. package/dist/cjs/db-backup/runs-list-query.d.ts.map +1 -0
  81. package/dist/cjs/db-backup/runs-list-query.js +53 -0
  82. package/dist/cjs/db-backup/runs-list-query.js.map +1 -0
  83. package/dist/cjs/db-backup/runs.d.ts +46 -0
  84. package/dist/cjs/db-backup/runs.d.ts.map +1 -0
  85. package/dist/cjs/db-backup/runs.js +232 -0
  86. package/dist/cjs/db-backup/runs.js.map +1 -0
  87. package/dist/cjs/db-backup/schemas.d.ts +9 -0
  88. package/dist/cjs/db-backup/schemas.d.ts.map +1 -0
  89. package/dist/cjs/db-backup/schemas.js +31 -0
  90. package/dist/cjs/db-backup/schemas.js.map +1 -0
  91. package/dist/cjs/db-backup/settings-schemas.d.ts +217 -0
  92. package/dist/cjs/db-backup/settings-schemas.d.ts.map +1 -0
  93. package/dist/cjs/db-backup/settings-schemas.js +319 -0
  94. package/dist/cjs/db-backup/settings-schemas.js.map +1 -0
  95. package/dist/cjs/email/constants.d.ts +82 -0
  96. package/dist/cjs/email/constants.d.ts.map +1 -0
  97. package/dist/cjs/email/constants.js +82 -0
  98. package/dist/cjs/email/constants.js.map +1 -0
  99. package/dist/cjs/email/index.d.ts +5 -0
  100. package/dist/cjs/email/index.d.ts.map +1 -0
  101. package/dist/cjs/email/index.js +30 -0
  102. package/dist/cjs/email/index.js.map +1 -0
  103. package/dist/cjs/email/schemas.d.ts +276 -0
  104. package/dist/cjs/email/schemas.d.ts.map +1 -0
  105. package/dist/cjs/email/schemas.js +280 -0
  106. package/dist/cjs/email/schemas.js.map +1 -0
  107. package/dist/cjs/exports/constants.d.ts +123 -0
  108. package/dist/cjs/exports/constants.d.ts.map +1 -0
  109. package/dist/cjs/exports/constants.js +109 -0
  110. package/dist/cjs/exports/constants.js.map +1 -0
  111. package/dist/cjs/exports/index.d.ts +5 -0
  112. package/dist/cjs/exports/index.d.ts.map +1 -0
  113. package/dist/cjs/exports/index.js +42 -0
  114. package/dist/cjs/exports/index.js.map +1 -0
  115. package/dist/cjs/exports/schemas.d.ts +386 -0
  116. package/dist/cjs/exports/schemas.d.ts.map +1 -0
  117. package/dist/cjs/exports/schemas.js +288 -0
  118. package/dist/cjs/exports/schemas.js.map +1 -0
  119. package/dist/cjs/identity/constants.d.ts +273 -0
  120. package/dist/cjs/identity/constants.d.ts.map +1 -0
  121. package/dist/cjs/identity/constants.js +248 -0
  122. package/dist/cjs/identity/constants.js.map +1 -0
  123. package/dist/cjs/identity/index.d.ts +5 -0
  124. package/dist/cjs/identity/index.d.ts.map +1 -0
  125. package/dist/cjs/identity/index.js +73 -0
  126. package/dist/cjs/identity/index.js.map +1 -0
  127. package/dist/cjs/identity/schemas.d.ts +784 -0
  128. package/dist/cjs/identity/schemas.d.ts.map +1 -0
  129. package/dist/cjs/identity/schemas.js +684 -0
  130. package/dist/cjs/identity/schemas.js.map +1 -0
  131. package/dist/cjs/jobs/constants.d.ts +135 -0
  132. package/dist/cjs/jobs/constants.d.ts.map +1 -0
  133. package/dist/cjs/jobs/constants.js +130 -0
  134. package/dist/cjs/jobs/constants.js.map +1 -0
  135. package/dist/cjs/jobs/index.d.ts +9 -0
  136. package/dist/cjs/jobs/index.d.ts.map +1 -0
  137. package/dist/cjs/jobs/index.js +59 -0
  138. package/dist/cjs/jobs/index.js.map +1 -0
  139. package/dist/cjs/jobs/retention-schemas.d.ts +252 -0
  140. package/dist/cjs/jobs/retention-schemas.d.ts.map +1 -0
  141. package/dist/cjs/jobs/retention-schemas.js +233 -0
  142. package/dist/cjs/jobs/retention-schemas.js.map +1 -0
  143. package/dist/cjs/jobs/schemas.d.ts +361 -0
  144. package/dist/cjs/jobs/schemas.d.ts.map +1 -0
  145. package/dist/cjs/jobs/schemas.js +706 -0
  146. package/dist/cjs/jobs/schemas.js.map +1 -0
  147. package/dist/cjs/jobs/settings-schemas.d.ts +84 -0
  148. package/dist/cjs/jobs/settings-schemas.d.ts.map +1 -0
  149. package/dist/cjs/jobs/settings-schemas.js +116 -0
  150. package/dist/cjs/jobs/settings-schemas.js.map +1 -0
  151. package/dist/cjs/nodes/admin-schemas.d.ts +204 -0
  152. package/dist/cjs/nodes/admin-schemas.d.ts.map +1 -0
  153. package/dist/cjs/nodes/admin-schemas.js +153 -0
  154. package/dist/cjs/nodes/admin-schemas.js.map +1 -0
  155. package/dist/cjs/nodes/constants.d.ts +86 -0
  156. package/dist/cjs/nodes/constants.d.ts.map +1 -0
  157. package/dist/cjs/nodes/constants.js +102 -0
  158. package/dist/cjs/nodes/constants.js.map +1 -0
  159. package/dist/cjs/nodes/index.d.ts +8 -0
  160. package/dist/cjs/nodes/index.d.ts.map +1 -0
  161. package/dist/cjs/nodes/index.js +50 -0
  162. package/dist/cjs/nodes/index.js.map +1 -0
  163. package/dist/cjs/nodes/schemas.d.ts +332 -0
  164. package/dist/cjs/nodes/schemas.d.ts.map +1 -0
  165. package/dist/cjs/nodes/schemas.js +937 -0
  166. package/dist/cjs/nodes/schemas.js.map +1 -0
  167. package/dist/cjs/nodes/settings-schemas.d.ts +82 -0
  168. package/dist/cjs/nodes/settings-schemas.d.ts.map +1 -0
  169. package/dist/cjs/nodes/settings-schemas.js +106 -0
  170. package/dist/cjs/nodes/settings-schemas.js.map +1 -0
  171. package/dist/cjs/notifications/constants.d.ts +197 -0
  172. package/dist/cjs/notifications/constants.d.ts.map +1 -0
  173. package/dist/cjs/notifications/constants.js +181 -0
  174. package/dist/cjs/notifications/constants.js.map +1 -0
  175. package/dist/cjs/notifications/index.d.ts +5 -0
  176. package/dist/cjs/notifications/index.d.ts.map +1 -0
  177. package/dist/cjs/notifications/index.js +86 -0
  178. package/dist/cjs/notifications/index.js.map +1 -0
  179. package/dist/cjs/notifications/schemas.d.ts +1016 -0
  180. package/dist/cjs/notifications/schemas.d.ts.map +1 -0
  181. package/dist/cjs/notifications/schemas.js +851 -0
  182. package/dist/cjs/notifications/schemas.js.map +1 -0
  183. package/dist/cjs/onboarding/constants.d.ts +138 -0
  184. package/dist/cjs/onboarding/constants.d.ts.map +1 -0
  185. package/dist/cjs/onboarding/constants.js +123 -0
  186. package/dist/cjs/onboarding/constants.js.map +1 -0
  187. package/dist/cjs/onboarding/index.d.ts +5 -0
  188. package/dist/cjs/onboarding/index.d.ts.map +1 -0
  189. package/dist/cjs/onboarding/index.js +42 -0
  190. package/dist/cjs/onboarding/index.js.map +1 -0
  191. package/dist/cjs/onboarding/schemas.d.ts +360 -0
  192. package/dist/cjs/onboarding/schemas.d.ts.map +1 -0
  193. package/dist/cjs/onboarding/schemas.js +260 -0
  194. package/dist/cjs/onboarding/schemas.js.map +1 -0
  195. package/dist/cjs/settings/constants.d.ts +206 -0
  196. package/dist/cjs/settings/constants.d.ts.map +1 -0
  197. package/dist/cjs/settings/constants.js +200 -0
  198. package/dist/cjs/settings/constants.js.map +1 -0
  199. package/dist/cjs/settings/index.d.ts +6 -0
  200. package/dist/cjs/settings/index.d.ts.map +1 -0
  201. package/dist/cjs/settings/index.js +62 -0
  202. package/dist/cjs/settings/index.js.map +1 -0
  203. package/dist/cjs/settings/schemas.d.ts +574 -0
  204. package/dist/cjs/settings/schemas.d.ts.map +1 -0
  205. package/dist/cjs/settings/schemas.js +437 -0
  206. package/dist/cjs/settings/schemas.js.map +1 -0
  207. package/dist/cjs/settings/types.d.ts +79 -0
  208. package/dist/cjs/settings/types.d.ts.map +1 -0
  209. package/dist/cjs/settings/types.js +6 -0
  210. package/dist/cjs/settings/types.js.map +1 -0
  211. package/dist/cjs/sharing/constants.d.ts +216 -0
  212. package/dist/cjs/sharing/constants.d.ts.map +1 -0
  213. package/dist/cjs/sharing/constants.js +163 -0
  214. package/dist/cjs/sharing/constants.js.map +1 -0
  215. package/dist/cjs/sharing/enum.d.ts +5 -0
  216. package/dist/cjs/sharing/enum.d.ts.map +1 -0
  217. package/dist/cjs/sharing/enum.js +9 -0
  218. package/dist/cjs/sharing/enum.js.map +1 -0
  219. package/dist/cjs/sharing/grants.d.ts +490 -0
  220. package/dist/cjs/sharing/grants.d.ts.map +1 -0
  221. package/dist/cjs/sharing/grants.js +447 -0
  222. package/dist/cjs/sharing/grants.js.map +1 -0
  223. package/dist/cjs/sharing/groups.d.ts +410 -0
  224. package/dist/cjs/sharing/groups.d.ts.map +1 -0
  225. package/dist/cjs/sharing/groups.js +375 -0
  226. package/dist/cjs/sharing/groups.js.map +1 -0
  227. package/dist/cjs/sharing/index.d.ts +5 -0
  228. package/dist/cjs/sharing/index.d.ts.map +1 -0
  229. package/dist/cjs/sharing/index.js +77 -0
  230. package/dist/cjs/sharing/index.js.map +1 -0
  231. package/dist/cjs/sharing/schemas.d.ts +3 -0
  232. package/dist/cjs/sharing/schemas.d.ts.map +1 -0
  233. package/dist/cjs/sharing/schemas.js +21 -0
  234. package/dist/cjs/sharing/schemas.js.map +1 -0
  235. package/dist/cjs/storage/constants.d.ts +111 -0
  236. package/dist/cjs/storage/constants.d.ts.map +1 -0
  237. package/dist/cjs/storage/constants.js +107 -0
  238. package/dist/cjs/storage/constants.js.map +1 -0
  239. package/dist/cjs/storage/index.d.ts +27 -0
  240. package/dist/cjs/storage/index.d.ts.map +1 -0
  241. package/dist/cjs/storage/index.js +69 -0
  242. package/dist/cjs/storage/index.js.map +1 -0
  243. package/dist/cjs/storage/objects-complete-upload.d.ts +19 -0
  244. package/dist/cjs/storage/objects-complete-upload.d.ts.map +1 -0
  245. package/dist/cjs/storage/objects-complete-upload.js +19 -0
  246. package/dist/cjs/storage/objects-complete-upload.js.map +1 -0
  247. package/dist/cjs/storage/objects-download-url.d.ts +17 -0
  248. package/dist/cjs/storage/objects-download-url.d.ts.map +1 -0
  249. package/dist/cjs/storage/objects-download-url.js +16 -0
  250. package/dist/cjs/storage/objects-download-url.js.map +1 -0
  251. package/dist/cjs/storage/objects-init-upload.d.ts +39 -0
  252. package/dist/cjs/storage/objects-init-upload.d.ts.map +1 -0
  253. package/dist/cjs/storage/objects-init-upload.js +40 -0
  254. package/dist/cjs/storage/objects-init-upload.js.map +1 -0
  255. package/dist/cjs/storage/objects-list-query.d.ts +50 -0
  256. package/dist/cjs/storage/objects-list-query.d.ts.map +1 -0
  257. package/dist/cjs/storage/objects-list-query.js +23 -0
  258. package/dist/cjs/storage/objects-list-query.js.map +1 -0
  259. package/dist/cjs/storage/objects-object-response.d.ts +49 -0
  260. package/dist/cjs/storage/objects-object-response.d.ts.map +1 -0
  261. package/dist/cjs/storage/objects-object-response.js +54 -0
  262. package/dist/cjs/storage/objects-object-response.js.map +1 -0
  263. package/dist/cjs/storage/objects-update-metadata.d.ts +16 -0
  264. package/dist/cjs/storage/objects-update-metadata.d.ts.map +1 -0
  265. package/dist/cjs/storage/objects-update-metadata.js +14 -0
  266. package/dist/cjs/storage/objects-update-metadata.js.map +1 -0
  267. package/dist/cjs/storage/schemas.d.ts +13 -0
  268. package/dist/cjs/storage/schemas.d.ts.map +1 -0
  269. package/dist/cjs/storage/schemas.js +35 -0
  270. package/dist/cjs/storage/schemas.js.map +1 -0
  271. package/dist/cjs/storage/settings-schemas.d.ts +188 -0
  272. package/dist/cjs/storage/settings-schemas.d.ts.map +1 -0
  273. package/dist/cjs/storage/settings-schemas.js +223 -0
  274. package/dist/cjs/storage/settings-schemas.js.map +1 -0
  275. package/dist/cjs/storage/storage-bucket-provision.d.ts +152 -0
  276. package/dist/cjs/storage/storage-bucket-provision.d.ts.map +1 -0
  277. package/dist/cjs/storage/storage-bucket-provision.js +216 -0
  278. package/dist/cjs/storage/storage-bucket-provision.js.map +1 -0
  279. package/dist/cjs/storage/storage-config-response.d.ts +99 -0
  280. package/dist/cjs/storage/storage-config-response.d.ts.map +1 -0
  281. package/dist/cjs/storage/storage-config-response.js +173 -0
  282. package/dist/cjs/storage/storage-config-response.js.map +1 -0
  283. package/dist/cjs/storage/storage-config-update.d.ts +46 -0
  284. package/dist/cjs/storage/storage-config-update.d.ts.map +1 -0
  285. package/dist/cjs/storage/storage-config-update.js +133 -0
  286. package/dist/cjs/storage/storage-config-update.js.map +1 -0
  287. package/dist/cjs/storage/storage-connection-test.d.ts +129 -0
  288. package/dist/cjs/storage/storage-connection-test.d.ts.map +1 -0
  289. package/dist/cjs/storage/storage-connection-test.js +244 -0
  290. package/dist/cjs/storage/storage-connection-test.js.map +1 -0
  291. package/dist/cjs/storage/storage-status.d.ts +16 -0
  292. package/dist/cjs/storage/storage-status.d.ts.map +1 -0
  293. package/dist/cjs/storage/storage-status.js +23 -0
  294. package/dist/cjs/storage/storage-status.js.map +1 -0
  295. package/dist/cjs/telemetry/config.d.ts +4 -0
  296. package/dist/cjs/telemetry/config.d.ts.map +1 -1
  297. package/dist/cjs/telemetry/config.js +16 -2
  298. package/dist/cjs/telemetry/config.js.map +1 -1
  299. package/dist/cjs/telemetry/connection.d.ts +1 -1
  300. package/dist/cjs/telemetry/constants.d.ts +378 -6
  301. package/dist/cjs/telemetry/constants.d.ts.map +1 -1
  302. package/dist/cjs/telemetry/constants.js +290 -5
  303. package/dist/cjs/telemetry/constants.js.map +1 -1
  304. package/dist/cjs/telemetry/dashboard.d.ts +188 -17
  305. package/dist/cjs/telemetry/dashboard.d.ts.map +1 -1
  306. package/dist/cjs/telemetry/dashboard.js +61 -3
  307. package/dist/cjs/telemetry/dashboard.js.map +1 -1
  308. package/dist/cjs/telemetry/index.d.ts +4 -4
  309. package/dist/cjs/telemetry/index.d.ts.map +1 -1
  310. package/dist/cjs/telemetry/index.js +35 -3
  311. package/dist/cjs/telemetry/index.js.map +1 -1
  312. package/dist/cjs/telemetry/presentation.d.ts +243 -0
  313. package/dist/cjs/telemetry/presentation.d.ts.map +1 -0
  314. package/dist/cjs/telemetry/presentation.js +300 -0
  315. package/dist/cjs/telemetry/presentation.js.map +1 -0
  316. package/dist/cjs/telemetry/query.d.ts +2 -2
  317. package/dist/cjs/telemetry/schemas.d.ts +5 -2
  318. package/dist/cjs/telemetry/schemas.d.ts.map +1 -1
  319. package/dist/cjs/telemetry/schemas.js +21 -1
  320. package/dist/cjs/telemetry/schemas.js.map +1 -1
  321. package/dist/cjs/telemetry/stack.d.ts +5 -5
  322. package/dist/cjs/telemetry/store.d.ts +111 -0
  323. package/dist/cjs/telemetry/store.d.ts.map +1 -0
  324. package/dist/cjs/telemetry/store.js +83 -0
  325. package/dist/cjs/telemetry/store.js.map +1 -0
  326. package/dist/cjs/user-data/constants.d.ts +157 -0
  327. package/dist/cjs/user-data/constants.d.ts.map +1 -0
  328. package/dist/cjs/user-data/constants.js +137 -0
  329. package/dist/cjs/user-data/constants.js.map +1 -0
  330. package/dist/cjs/user-data/index.d.ts +5 -0
  331. package/dist/cjs/user-data/index.d.ts.map +1 -0
  332. package/dist/cjs/user-data/index.js +46 -0
  333. package/dist/cjs/user-data/index.js.map +1 -0
  334. package/dist/cjs/user-data/schemas.d.ts +306 -0
  335. package/dist/cjs/user-data/schemas.d.ts.map +1 -0
  336. package/dist/cjs/user-data/schemas.js +333 -0
  337. package/dist/cjs/user-data/schemas.js.map +1 -0
  338. package/dist/esm/ai/capabilities.d.ts +85 -0
  339. package/dist/esm/ai/capabilities.d.ts.map +1 -0
  340. package/dist/esm/ai/capabilities.js +90 -0
  341. package/dist/esm/ai/capabilities.js.map +1 -0
  342. package/dist/esm/ai/constants.d.ts +239 -0
  343. package/dist/esm/ai/constants.d.ts.map +1 -0
  344. package/dist/esm/ai/constants.js +229 -0
  345. package/dist/esm/ai/constants.js.map +1 -0
  346. package/dist/esm/ai/features.d.ts +24 -0
  347. package/dist/esm/ai/features.d.ts.map +1 -0
  348. package/dist/esm/ai/features.js +30 -0
  349. package/dist/esm/ai/features.js.map +1 -0
  350. package/dist/esm/ai/index.d.ts +11 -0
  351. package/dist/esm/ai/index.d.ts.map +1 -0
  352. package/dist/esm/ai/index.js +16 -0
  353. package/dist/esm/ai/index.js.map +1 -0
  354. package/dist/esm/ai/org-keys.d.ts +50 -0
  355. package/dist/esm/ai/org-keys.d.ts.map +1 -0
  356. package/dist/esm/ai/org-keys.js +40 -0
  357. package/dist/esm/ai/org-keys.js.map +1 -0
  358. package/dist/esm/ai/schemas.d.ts +642 -0
  359. package/dist/esm/ai/schemas.d.ts.map +1 -0
  360. package/dist/esm/ai/schemas.js +889 -0
  361. package/dist/esm/ai/schemas.js.map +1 -0
  362. package/dist/esm/android-app/constants.d.ts +337 -0
  363. package/dist/esm/android-app/constants.d.ts.map +1 -0
  364. package/dist/esm/android-app/constants.js +306 -0
  365. package/dist/esm/android-app/constants.js.map +1 -0
  366. package/dist/esm/android-app/index.d.ts +5 -0
  367. package/dist/esm/android-app/index.d.ts.map +1 -0
  368. package/dist/esm/android-app/index.js +8 -0
  369. package/dist/esm/android-app/index.js.map +1 -0
  370. package/dist/esm/android-app/schemas.d.ts +358 -0
  371. package/dist/esm/android-app/schemas.d.ts.map +1 -0
  372. package/dist/esm/android-app/schemas.js +306 -0
  373. package/dist/esm/android-app/schemas.js.map +1 -0
  374. package/dist/esm/credentials/constants.d.ts +35 -0
  375. package/dist/esm/credentials/constants.d.ts.map +1 -0
  376. package/dist/esm/credentials/constants.js +36 -0
  377. package/dist/esm/credentials/constants.js.map +1 -0
  378. package/dist/esm/credentials/index.d.ts +5 -0
  379. package/dist/esm/credentials/index.d.ts.map +1 -0
  380. package/dist/esm/credentials/index.js +8 -0
  381. package/dist/esm/credentials/index.js.map +1 -0
  382. package/dist/esm/credentials/schemas.d.ts +64 -0
  383. package/dist/esm/credentials/schemas.d.ts.map +1 -0
  384. package/dist/esm/credentials/schemas.js +79 -0
  385. package/dist/esm/credentials/schemas.js.map +1 -0
  386. package/dist/esm/db-backup/config.d.ts +76 -0
  387. package/dist/esm/db-backup/config.d.ts.map +1 -0
  388. package/dist/esm/db-backup/config.js +112 -0
  389. package/dist/esm/db-backup/config.js.map +1 -0
  390. package/dist/esm/db-backup/constants.d.ts +314 -0
  391. package/dist/esm/db-backup/constants.d.ts.map +1 -0
  392. package/dist/esm/db-backup/constants.js +240 -0
  393. package/dist/esm/db-backup/constants.js.map +1 -0
  394. package/dist/esm/db-backup/index.d.ts +19 -0
  395. package/dist/esm/db-backup/index.d.ts.map +1 -0
  396. package/dist/esm/db-backup/index.js +25 -0
  397. package/dist/esm/db-backup/index.js.map +1 -0
  398. package/dist/esm/db-backup/node-credential.d.ts +37 -0
  399. package/dist/esm/db-backup/node-credential.d.ts.map +1 -0
  400. package/dist/esm/db-backup/node-credential.js +104 -0
  401. package/dist/esm/db-backup/node-credential.js.map +1 -0
  402. package/dist/esm/db-backup/node-result.d.ts +34 -0
  403. package/dist/esm/db-backup/node-result.d.ts.map +1 -0
  404. package/dist/esm/db-backup/node-result.js +165 -0
  405. package/dist/esm/db-backup/node-result.js.map +1 -0
  406. package/dist/esm/db-backup/restore.d.ts +405 -0
  407. package/dist/esm/db-backup/restore.d.ts.map +1 -0
  408. package/dist/esm/db-backup/restore.js +494 -0
  409. package/dist/esm/db-backup/restore.js.map +1 -0
  410. package/dist/esm/db-backup/run-actions.d.ts +49 -0
  411. package/dist/esm/db-backup/run-actions.d.ts.map +1 -0
  412. package/dist/esm/db-backup/run-actions.js +118 -0
  413. package/dist/esm/db-backup/run-actions.js.map +1 -0
  414. package/dist/esm/db-backup/runs-list-query.d.ts +20 -0
  415. package/dist/esm/db-backup/runs-list-query.d.ts.map +1 -0
  416. package/dist/esm/db-backup/runs-list-query.js +50 -0
  417. package/dist/esm/db-backup/runs-list-query.js.map +1 -0
  418. package/dist/esm/db-backup/runs.d.ts +46 -0
  419. package/dist/esm/db-backup/runs.d.ts.map +1 -0
  420. package/dist/esm/db-backup/runs.js +229 -0
  421. package/dist/esm/db-backup/runs.js.map +1 -0
  422. package/dist/esm/db-backup/schemas.d.ts +9 -0
  423. package/dist/esm/db-backup/schemas.d.ts.map +1 -0
  424. package/dist/esm/db-backup/schemas.js +15 -0
  425. package/dist/esm/db-backup/schemas.js.map +1 -0
  426. package/dist/esm/db-backup/settings-schemas.d.ts +217 -0
  427. package/dist/esm/db-backup/settings-schemas.d.ts.map +1 -0
  428. package/dist/esm/db-backup/settings-schemas.js +316 -0
  429. package/dist/esm/db-backup/settings-schemas.js.map +1 -0
  430. package/dist/esm/email/constants.d.ts +82 -0
  431. package/dist/esm/email/constants.d.ts.map +1 -0
  432. package/dist/esm/email/constants.js +79 -0
  433. package/dist/esm/email/constants.js.map +1 -0
  434. package/dist/esm/email/index.d.ts +5 -0
  435. package/dist/esm/email/index.d.ts.map +1 -0
  436. package/dist/esm/email/index.js +8 -0
  437. package/dist/esm/email/index.js.map +1 -0
  438. package/dist/esm/email/schemas.d.ts +276 -0
  439. package/dist/esm/email/schemas.d.ts.map +1 -0
  440. package/dist/esm/email/schemas.js +277 -0
  441. package/dist/esm/email/schemas.js.map +1 -0
  442. package/dist/esm/exports/constants.d.ts +123 -0
  443. package/dist/esm/exports/constants.d.ts.map +1 -0
  444. package/dist/esm/exports/constants.js +106 -0
  445. package/dist/esm/exports/constants.js.map +1 -0
  446. package/dist/esm/exports/index.d.ts +5 -0
  447. package/dist/esm/exports/index.d.ts.map +1 -0
  448. package/dist/esm/exports/index.js +7 -0
  449. package/dist/esm/exports/index.js.map +1 -0
  450. package/dist/esm/exports/schemas.d.ts +386 -0
  451. package/dist/esm/exports/schemas.d.ts.map +1 -0
  452. package/dist/esm/exports/schemas.js +285 -0
  453. package/dist/esm/exports/schemas.js.map +1 -0
  454. package/dist/esm/identity/constants.d.ts +273 -0
  455. package/dist/esm/identity/constants.d.ts.map +1 -0
  456. package/dist/esm/identity/constants.js +244 -0
  457. package/dist/esm/identity/constants.js.map +1 -0
  458. package/dist/esm/identity/index.d.ts +5 -0
  459. package/dist/esm/identity/index.d.ts.map +1 -0
  460. package/dist/esm/identity/index.js +10 -0
  461. package/dist/esm/identity/index.js.map +1 -0
  462. package/dist/esm/identity/schemas.d.ts +784 -0
  463. package/dist/esm/identity/schemas.d.ts.map +1 -0
  464. package/dist/esm/identity/schemas.js +681 -0
  465. package/dist/esm/identity/schemas.js.map +1 -0
  466. package/dist/esm/jobs/constants.d.ts +135 -0
  467. package/dist/esm/jobs/constants.d.ts.map +1 -0
  468. package/dist/esm/jobs/constants.js +127 -0
  469. package/dist/esm/jobs/constants.js.map +1 -0
  470. package/dist/esm/jobs/index.d.ts +9 -0
  471. package/dist/esm/jobs/index.d.ts.map +1 -0
  472. package/dist/esm/jobs/index.js +11 -0
  473. package/dist/esm/jobs/index.js.map +1 -0
  474. package/dist/esm/jobs/retention-schemas.d.ts +252 -0
  475. package/dist/esm/jobs/retention-schemas.d.ts.map +1 -0
  476. package/dist/esm/jobs/retention-schemas.js +229 -0
  477. package/dist/esm/jobs/retention-schemas.js.map +1 -0
  478. package/dist/esm/jobs/schemas.d.ts +361 -0
  479. package/dist/esm/jobs/schemas.d.ts.map +1 -0
  480. package/dist/esm/jobs/schemas.js +703 -0
  481. package/dist/esm/jobs/schemas.js.map +1 -0
  482. package/dist/esm/jobs/settings-schemas.d.ts +84 -0
  483. package/dist/esm/jobs/settings-schemas.d.ts.map +1 -0
  484. package/dist/esm/jobs/settings-schemas.js +113 -0
  485. package/dist/esm/jobs/settings-schemas.js.map +1 -0
  486. package/dist/esm/nodes/admin-schemas.d.ts +204 -0
  487. package/dist/esm/nodes/admin-schemas.d.ts.map +1 -0
  488. package/dist/esm/nodes/admin-schemas.js +150 -0
  489. package/dist/esm/nodes/admin-schemas.js.map +1 -0
  490. package/dist/esm/nodes/constants.d.ts +86 -0
  491. package/dist/esm/nodes/constants.d.ts.map +1 -0
  492. package/dist/esm/nodes/constants.js +99 -0
  493. package/dist/esm/nodes/constants.js.map +1 -0
  494. package/dist/esm/nodes/index.d.ts +8 -0
  495. package/dist/esm/nodes/index.d.ts.map +1 -0
  496. package/dist/esm/nodes/index.js +11 -0
  497. package/dist/esm/nodes/index.js.map +1 -0
  498. package/dist/esm/nodes/schemas.d.ts +332 -0
  499. package/dist/esm/nodes/schemas.d.ts.map +1 -0
  500. package/dist/esm/nodes/schemas.js +934 -0
  501. package/dist/esm/nodes/schemas.js.map +1 -0
  502. package/dist/esm/nodes/settings-schemas.d.ts +82 -0
  503. package/dist/esm/nodes/settings-schemas.d.ts.map +1 -0
  504. package/dist/esm/nodes/settings-schemas.js +103 -0
  505. package/dist/esm/nodes/settings-schemas.js.map +1 -0
  506. package/dist/esm/notifications/constants.d.ts +197 -0
  507. package/dist/esm/notifications/constants.d.ts.map +1 -0
  508. package/dist/esm/notifications/constants.js +178 -0
  509. package/dist/esm/notifications/constants.js.map +1 -0
  510. package/dist/esm/notifications/index.d.ts +5 -0
  511. package/dist/esm/notifications/index.d.ts.map +1 -0
  512. package/dist/esm/notifications/index.js +9 -0
  513. package/dist/esm/notifications/index.js.map +1 -0
  514. package/dist/esm/notifications/schemas.d.ts +1016 -0
  515. package/dist/esm/notifications/schemas.d.ts.map +1 -0
  516. package/dist/esm/notifications/schemas.js +848 -0
  517. package/dist/esm/notifications/schemas.js.map +1 -0
  518. package/dist/esm/onboarding/constants.d.ts +138 -0
  519. package/dist/esm/onboarding/constants.d.ts.map +1 -0
  520. package/dist/esm/onboarding/constants.js +120 -0
  521. package/dist/esm/onboarding/constants.js.map +1 -0
  522. package/dist/esm/onboarding/index.d.ts +5 -0
  523. package/dist/esm/onboarding/index.d.ts.map +1 -0
  524. package/dist/esm/onboarding/index.js +7 -0
  525. package/dist/esm/onboarding/index.js.map +1 -0
  526. package/dist/esm/onboarding/schemas.d.ts +360 -0
  527. package/dist/esm/onboarding/schemas.d.ts.map +1 -0
  528. package/dist/esm/onboarding/schemas.js +257 -0
  529. package/dist/esm/onboarding/schemas.js.map +1 -0
  530. package/dist/esm/settings/constants.d.ts +206 -0
  531. package/dist/esm/settings/constants.d.ts.map +1 -0
  532. package/dist/esm/settings/constants.js +197 -0
  533. package/dist/esm/settings/constants.js.map +1 -0
  534. package/dist/esm/settings/index.d.ts +6 -0
  535. package/dist/esm/settings/index.d.ts.map +1 -0
  536. package/dist/esm/settings/index.js +11 -0
  537. package/dist/esm/settings/index.js.map +1 -0
  538. package/dist/esm/settings/schemas.d.ts +574 -0
  539. package/dist/esm/settings/schemas.d.ts.map +1 -0
  540. package/dist/esm/settings/schemas.js +434 -0
  541. package/dist/esm/settings/schemas.js.map +1 -0
  542. package/dist/esm/settings/types.d.ts +79 -0
  543. package/dist/esm/settings/types.d.ts.map +1 -0
  544. package/dist/esm/settings/types.js +5 -0
  545. package/dist/esm/settings/types.js.map +1 -0
  546. package/dist/esm/sharing/constants.d.ts +216 -0
  547. package/dist/esm/sharing/constants.d.ts.map +1 -0
  548. package/dist/esm/sharing/constants.js +159 -0
  549. package/dist/esm/sharing/constants.js.map +1 -0
  550. package/dist/esm/sharing/enum.d.ts +5 -0
  551. package/dist/esm/sharing/enum.d.ts.map +1 -0
  552. package/dist/esm/sharing/enum.js +6 -0
  553. package/dist/esm/sharing/enum.js.map +1 -0
  554. package/dist/esm/sharing/grants.d.ts +490 -0
  555. package/dist/esm/sharing/grants.d.ts.map +1 -0
  556. package/dist/esm/sharing/grants.js +444 -0
  557. package/dist/esm/sharing/grants.js.map +1 -0
  558. package/dist/esm/sharing/groups.d.ts +410 -0
  559. package/dist/esm/sharing/groups.d.ts.map +1 -0
  560. package/dist/esm/sharing/groups.js +372 -0
  561. package/dist/esm/sharing/groups.js.map +1 -0
  562. package/dist/esm/sharing/index.d.ts +5 -0
  563. package/dist/esm/sharing/index.d.ts.map +1 -0
  564. package/dist/esm/sharing/index.js +11 -0
  565. package/dist/esm/sharing/index.js.map +1 -0
  566. package/dist/esm/sharing/schemas.d.ts +3 -0
  567. package/dist/esm/sharing/schemas.d.ts.map +1 -0
  568. package/dist/esm/sharing/schemas.js +5 -0
  569. package/dist/esm/sharing/schemas.js.map +1 -0
  570. package/dist/esm/storage/constants.d.ts +111 -0
  571. package/dist/esm/storage/constants.d.ts.map +1 -0
  572. package/dist/esm/storage/constants.js +104 -0
  573. package/dist/esm/storage/constants.js.map +1 -0
  574. package/dist/esm/storage/index.d.ts +27 -0
  575. package/dist/esm/storage/index.d.ts.map +1 -0
  576. package/dist/esm/storage/index.js +23 -0
  577. package/dist/esm/storage/index.js.map +1 -0
  578. package/dist/esm/storage/objects-complete-upload.d.ts +19 -0
  579. package/dist/esm/storage/objects-complete-upload.d.ts.map +1 -0
  580. package/dist/esm/storage/objects-complete-upload.js +16 -0
  581. package/dist/esm/storage/objects-complete-upload.js.map +1 -0
  582. package/dist/esm/storage/objects-download-url.d.ts +17 -0
  583. package/dist/esm/storage/objects-download-url.d.ts.map +1 -0
  584. package/dist/esm/storage/objects-download-url.js +13 -0
  585. package/dist/esm/storage/objects-download-url.js.map +1 -0
  586. package/dist/esm/storage/objects-init-upload.d.ts +39 -0
  587. package/dist/esm/storage/objects-init-upload.d.ts.map +1 -0
  588. package/dist/esm/storage/objects-init-upload.js +37 -0
  589. package/dist/esm/storage/objects-init-upload.js.map +1 -0
  590. package/dist/esm/storage/objects-list-query.d.ts +50 -0
  591. package/dist/esm/storage/objects-list-query.d.ts.map +1 -0
  592. package/dist/esm/storage/objects-list-query.js +20 -0
  593. package/dist/esm/storage/objects-list-query.js.map +1 -0
  594. package/dist/esm/storage/objects-object-response.d.ts +49 -0
  595. package/dist/esm/storage/objects-object-response.d.ts.map +1 -0
  596. package/dist/esm/storage/objects-object-response.js +51 -0
  597. package/dist/esm/storage/objects-object-response.js.map +1 -0
  598. package/dist/esm/storage/objects-update-metadata.d.ts +16 -0
  599. package/dist/esm/storage/objects-update-metadata.d.ts.map +1 -0
  600. package/dist/esm/storage/objects-update-metadata.js +11 -0
  601. package/dist/esm/storage/objects-update-metadata.js.map +1 -0
  602. package/dist/esm/storage/schemas.d.ts +13 -0
  603. package/dist/esm/storage/schemas.d.ts.map +1 -0
  604. package/dist/esm/storage/schemas.js +19 -0
  605. package/dist/esm/storage/schemas.js.map +1 -0
  606. package/dist/esm/storage/settings-schemas.d.ts +188 -0
  607. package/dist/esm/storage/settings-schemas.d.ts.map +1 -0
  608. package/dist/esm/storage/settings-schemas.js +220 -0
  609. package/dist/esm/storage/settings-schemas.js.map +1 -0
  610. package/dist/esm/storage/storage-bucket-provision.d.ts +152 -0
  611. package/dist/esm/storage/storage-bucket-provision.d.ts.map +1 -0
  612. package/dist/esm/storage/storage-bucket-provision.js +213 -0
  613. package/dist/esm/storage/storage-bucket-provision.js.map +1 -0
  614. package/dist/esm/storage/storage-config-response.d.ts +99 -0
  615. package/dist/esm/storage/storage-config-response.d.ts.map +1 -0
  616. package/dist/esm/storage/storage-config-response.js +170 -0
  617. package/dist/esm/storage/storage-config-response.js.map +1 -0
  618. package/dist/esm/storage/storage-config-update.d.ts +46 -0
  619. package/dist/esm/storage/storage-config-update.d.ts.map +1 -0
  620. package/dist/esm/storage/storage-config-update.js +130 -0
  621. package/dist/esm/storage/storage-config-update.js.map +1 -0
  622. package/dist/esm/storage/storage-connection-test.d.ts +129 -0
  623. package/dist/esm/storage/storage-connection-test.d.ts.map +1 -0
  624. package/dist/esm/storage/storage-connection-test.js +241 -0
  625. package/dist/esm/storage/storage-connection-test.js.map +1 -0
  626. package/dist/esm/storage/storage-status.d.ts +16 -0
  627. package/dist/esm/storage/storage-status.d.ts.map +1 -0
  628. package/dist/esm/storage/storage-status.js +20 -0
  629. package/dist/esm/storage/storage-status.js.map +1 -0
  630. package/dist/esm/telemetry/config.d.ts +4 -0
  631. package/dist/esm/telemetry/config.d.ts.map +1 -1
  632. package/dist/esm/telemetry/config.js +16 -2
  633. package/dist/esm/telemetry/config.js.map +1 -1
  634. package/dist/esm/telemetry/connection.d.ts +1 -1
  635. package/dist/esm/telemetry/constants.d.ts +378 -6
  636. package/dist/esm/telemetry/constants.d.ts.map +1 -1
  637. package/dist/esm/telemetry/constants.js +288 -4
  638. package/dist/esm/telemetry/constants.js.map +1 -1
  639. package/dist/esm/telemetry/dashboard.d.ts +188 -17
  640. package/dist/esm/telemetry/dashboard.d.ts.map +1 -1
  641. package/dist/esm/telemetry/dashboard.js +61 -3
  642. package/dist/esm/telemetry/dashboard.js.map +1 -1
  643. package/dist/esm/telemetry/index.d.ts +4 -4
  644. package/dist/esm/telemetry/index.d.ts.map +1 -1
  645. package/dist/esm/telemetry/index.js +2 -2
  646. package/dist/esm/telemetry/index.js.map +1 -1
  647. package/dist/esm/telemetry/presentation.d.ts +243 -0
  648. package/dist/esm/telemetry/presentation.d.ts.map +1 -0
  649. package/dist/esm/telemetry/presentation.js +297 -0
  650. package/dist/esm/telemetry/presentation.js.map +1 -0
  651. package/dist/esm/telemetry/query.d.ts +2 -2
  652. package/dist/esm/telemetry/schemas.d.ts +5 -2
  653. package/dist/esm/telemetry/schemas.d.ts.map +1 -1
  654. package/dist/esm/telemetry/schemas.js +3 -1
  655. package/dist/esm/telemetry/schemas.js.map +1 -1
  656. package/dist/esm/telemetry/stack.d.ts +5 -5
  657. package/dist/esm/telemetry/store.d.ts +111 -0
  658. package/dist/esm/telemetry/store.d.ts.map +1 -0
  659. package/dist/esm/telemetry/store.js +80 -0
  660. package/dist/esm/telemetry/store.js.map +1 -0
  661. package/dist/esm/user-data/constants.d.ts +157 -0
  662. package/dist/esm/user-data/constants.d.ts.map +1 -0
  663. package/dist/esm/user-data/constants.js +134 -0
  664. package/dist/esm/user-data/constants.js.map +1 -0
  665. package/dist/esm/user-data/index.d.ts +5 -0
  666. package/dist/esm/user-data/index.d.ts.map +1 -0
  667. package/dist/esm/user-data/index.js +7 -0
  668. package/dist/esm/user-data/index.js.map +1 -0
  669. package/dist/esm/user-data/schemas.d.ts +306 -0
  670. package/dist/esm/user-data/schemas.d.ts.map +1 -0
  671. package/dist/esm/user-data/schemas.js +330 -0
  672. package/dist/esm/user-data/schemas.js.map +1 -0
  673. package/package.json +151 -1
@@ -0,0 +1,889 @@
1
+ // =============================================================================
2
+ // The `ai` settings namespaces (issue #739, PP-8.6)
3
+ // =============================================================================
4
+ //
5
+ // The schemas of the AI platform's system namespace `ai` (stored shape, PATCH
6
+ // partial, PUT and PATCH request-body branches, response branch), of its org
7
+ // layer (#733: what one organization may set, tighten-only) and of the per-user
8
+ // namespace `ai`, moved verbatim from the reference app's
9
+ // `common/schemas/settings.schema.ts`, `system-settings-wire.schemas.ts` and
10
+ // `system-settings-response.schemas.ts`. The API registers the namespaces
11
+ // (`@marinoscar/platform-api/ai`); the web validates its forms with the same
12
+ // bounds. zod only: no Node API (this file also runs in the browser).
13
+ // =============================================================================
14
+ import { z } from 'zod';
15
+ import { AI_AZURE_API_VERSION_PATTERN, AI_AZURE_DEPLOYMENT_PATTERN, AI_AZURE_DEPLOYMENTS_MAX, AI_AZURE_ENDPOINT_SCHEMES, AI_AZURE_MODEL_ID_MAX, AI_COMPATIBLE_ENDPOINT_SCHEMES, AI_ENDPOINT_URL_MAX, AI_KEY_POLICIES, AI_LIMIT_MODEL_KEY_MAX, AI_LIMIT_MODEL_KEY_PATTERN, AI_LIMIT_VALUE_MAX, AI_LIMITS_PER_MODEL_MAX, AI_MCP_ALLOWED_HOST_PATTERN, AI_MCP_ALLOWED_HOSTS_MAX, AI_OPENAI_API_STYLES, AI_PROVIDER_ID_PATTERN, AI_USAGE_RETENTION_MAX_DAYS, aiEndpointUrlProblem, } from './constants.js';
16
+ // =============================================================================
17
+ // User namespace `ai`
18
+ // =============================================================================
19
+ /**
20
+ * Per-user AI preferences (`ai`) — issue #423, epic #419, umbrella #418.
21
+ *
22
+ * `defaultModel` is the ONLY field this issue adds: which (provider, model)
23
+ * a caller's AI surface should pre-select, so a user who has settled on one
24
+ * model does not re-pick it every time. Nullable, and the namespace itself
25
+ * optional — see below for why both.
26
+ *
27
+ * NON-SECRET ONLY, and this is the whole namespace, not a policy exception:
28
+ * a user's own provider key is `UserAiKey.secret`, ciphertext in its own
29
+ * table (`apps/api/prisma/schema.prisma`), never in `user_settings.value`,
30
+ * which — like `system_settings.value` — is returned wholesale by
31
+ * `GET /api/user-settings` and copied verbatim into whatever audit trail
32
+ * later issues add. `provider`/`modelId` here are the same kind of
33
+ * IDENTIFIER `systemStorageSchema.accessKeyId` is: they name a selection,
34
+ * they authorise nothing.
35
+ *
36
+ * `provider`/`modelId` are plain strings, not `z.enum(AI_PROVIDER_IDS)` /
37
+ * a foreign key into `AiModel`: this schema has no access to the database to
38
+ * validate a model still exists, and — matching `Job.type`'s and
39
+ * `AiModel.provider`'s own "a row must outlive the registry that produced it"
40
+ * reasoning throughout this codebase — a user's saved preference for a model
41
+ * later disabled or removed by an admin must remain a value this schema can
42
+ * represent, even though nothing routes to it any more.
43
+ *
44
+ * @stability experimental
45
+ */
46
+ export const userAiSettingsSchema = z.object({
47
+ /** The model an AI surface pre-selects; `null` means none chosen. */
48
+ defaultModel: z
49
+ .object({
50
+ /** Provider id. */
51
+ provider: z.string(),
52
+ /** Model id. */
53
+ modelId: z.string(),
54
+ })
55
+ .nullable(),
56
+ });
57
+ /**
58
+ * `ai`, PATCH counterpart. `defaultModel` stays required-but-nullable inside
59
+ * the object (an explicit `{ "ai": { "defaultModel": null } }` clears the
60
+ * selection back to "none chosen"; the whole `ai` object itself is optional
61
+ * to send at all, matching `dataTables`/`navigation` above).
62
+ *
63
+ * @stability experimental
64
+ */
65
+ export const userAiSettingsPatchSchema = z.object({
66
+ /** The model an AI surface pre-selects; `null` means none chosen. */
67
+ defaultModel: z
68
+ .object({
69
+ /** Provider id. */
70
+ provider: z.string(),
71
+ /** Model id. */
72
+ modelId: z.string(),
73
+ })
74
+ .nullable(),
75
+ });
76
+ // A factory, not a shared instance: every field gets its own enum, exactly as
77
+ // when each was written inline (the generated OpenAPI document is unchanged).
78
+ const keyPolicyEnum = () => z.enum(AI_KEY_POLICIES);
79
+ const mcpAllowedHostSchema = z.string().max(253).regex(AI_MCP_ALLOWED_HOST_PATTERN);
80
+ /**
81
+ * One limit value: a positive integer up to `AI_LIMIT_VALUE_MAX`.
82
+ *
83
+ * @stability experimental
84
+ */
85
+ export const aiLimitValueSchema = z.number().int().positive().max(AI_LIMIT_VALUE_MAX);
86
+ /**
87
+ * `ai.limits` (#450) — per-user and per-model rate limits and output caps.
88
+ * EVERY FIELD IS OPTIONAL, AND ABSENT MEANS UNLIMITED: `{}` (the default) is
89
+ * a deployment with no limits at all, which is exactly Phase 1's behaviour.
90
+ *
91
+ * - `perUser.requestsPerMinute` / `.requestsPerDay` — every inference call a
92
+ * user makes, whoever's key pays.
93
+ * - `orgKey.requestsPerDayPerUser` / `.tokensPerDayPerUser` — only calls the
94
+ * ORG key pays for (`keySource: 'org'`); a user on their own key is never
95
+ * counted against these.
96
+ * - `perModel['<provider>:<modelId>']` — `maxOutputTokens` clamps the call
97
+ * (together with `defaults.maxOutputTokensCap`, the smaller wins), and
98
+ * `requestsPerMinutePerUser` limits each user's calls to that one model.
99
+ *
100
+ * Enforced by `AiLimitsService` (`ai/runtime/ai-limits.service.ts`); see
101
+ * `docs/specs/ai-platform.md` §2.22.
102
+ *
103
+ * @stability experimental
104
+ */
105
+ export const systemAiLimitsSchema = z.object({
106
+ /** Limits on every call a user makes, whoever's key pays. */
107
+ perUser: z
108
+ .object({
109
+ /** Requests per minute. */
110
+ requestsPerMinute: aiLimitValueSchema.optional(),
111
+ /** Requests per UTC day. */
112
+ requestsPerDay: aiLimitValueSchema.optional(),
113
+ })
114
+ .optional(),
115
+ /** Limits on the calls an administrator-managed key pays for. */
116
+ orgKey: z
117
+ .object({
118
+ /** Requests per UTC day, per user. */
119
+ requestsPerDayPerUser: aiLimitValueSchema.optional(),
120
+ /** Input plus output tokens per UTC day, per user. */
121
+ tokensPerDayPerUser: aiLimitValueSchema.optional(),
122
+ })
123
+ .optional(),
124
+ // #739: the deployment default PER ORGANIZATION (requests and output tokens
125
+ // per UTC day, counted over every call made in that organization); absent
126
+ // means unlimited. An organization may only lower it (its org layer).
127
+ /** Limits on one organization's whole daily volume, whoever's key pays (#739). */
128
+ perOrg: z
129
+ .object({
130
+ /** Requests per UTC day. */
131
+ requestsPerDay: aiLimitValueSchema.optional(),
132
+ /** Output tokens per UTC day. */
133
+ outputTokensPerDay: aiLimitValueSchema.optional(),
134
+ })
135
+ .optional(),
136
+ /** Per-model limits, keyed `<provider>:<modelId>`. */
137
+ perModel: z
138
+ .record(z.string().max(AI_LIMIT_MODEL_KEY_MAX).regex(AI_LIMIT_MODEL_KEY_PATTERN), z.object({
139
+ /** Output-token ceiling for every call to the model. */
140
+ maxOutputTokens: aiLimitValueSchema.optional(),
141
+ /** Requests per minute, per user, to the model. */
142
+ requestsPerMinutePerUser: aiLimitValueSchema.optional(),
143
+ }))
144
+ .refine((value) => Object.keys(value).length <= AI_LIMITS_PER_MODEL_MAX, {
145
+ message: `At most ${AI_LIMITS_PER_MODEL_MAX} per-model limits`,
146
+ })
147
+ .optional(),
148
+ });
149
+ /**
150
+ * Deployment-wide AI platform policy (`ai`).
151
+ *
152
+ * `enabled` is the master switch: OFF by default, matching every other
153
+ * feature namespace in this file that ships ahead of its own UI
154
+ * (`databaseBackup.enabled`, `nodes.jobSecretBrokerEnabled`) — a capability
155
+ * this deployment did not ask for must not turn itself on by existing in the
156
+ * schema.
157
+ *
158
+ * `providers.openai.baseUrl` IS AN ENDPOINT OVERRIDE, NOT A CREDENTIAL — the
159
+ * exact counterpart of `systemStorageSchema.endpoint`. It exists for
160
+ * OpenAI-compatible proxies and self-hosted gateways, and is optional because
161
+ * absent means "use the provider's own default host". `providers` is a RECORD
162
+ * keyed by provider id (PP-14.6, #924), open to a provider an app or package
163
+ * registers: this schema checks the id and `enabled`, and the provider's own
164
+ * `settingsSchema` (the API's provider registry) validates the rest, which a
165
+ * schema in this package cannot, since it does not know which providers a
166
+ * deployment registered. The stored shape of the five built-in providers is
167
+ * unchanged.
168
+ *
169
+ * `defaults.maxOutputTokensCap` bounds every call regardless of what the
170
+ * caller (or the model's own `maxOutputTokens`) requests, and is optional:
171
+ * absent means "no deployment-wide cap", not zero.
172
+ * `defaults.allowBackgroundRuns` decides whether a call may be queued as an `AiRun`
173
+ * job at all rather than only served synchronously; ON by default, since the
174
+ * job queue is this application's normal way of doing anything that takes a
175
+ * while (see the "Every Long-Running Activity Is a Queue Job" rules) and a
176
+ * deployment that has not thought about AI at all should not have quietly
177
+ * disabled the queue path the moment this namespace materialises.
178
+ *
179
+ * `defaults.allowRealtime` (#449) decides whether a user may mint a realtime
180
+ * voice session (`POST /api/ai/realtime/sessions`) — an ephemeral provider
181
+ * secret handed to the BROWSER, after which the server can neither see nor
182
+ * meter the conversation. OFF by default: that loss of per-call control is
183
+ * an administrator's decision (docs/specs/ai-platform.md §2.15). A row
184
+ * written before the field existed reads it as `false` without disturbing
185
+ * the rest of `defaults` (`SystemSettingsService.withAiSlots`).
186
+ *
187
+ * `logPromptContent` is OFF by default and is a deliberate, named privacy
188
+ * decision: whether this deployment's own logs/telemetry may capture prompt
189
+ * text at all, independent of `enabled`. A deployment can turn AI on while
190
+ * still refusing to let prompts (which may carry a user's own sensitive
191
+ * input) land in a log line nobody scoped for that.
192
+ *
193
+ * ⚠ THERE IS NO API KEY FIELD ANYWHERE IN THIS NAMESPACE, AND THERE MUST
194
+ * NEVER BE ONE — see the compile-time proof at the bottom of this file. A
195
+ * user's own key is `UserAiKey.secret`, ciphertext in its own table, never
196
+ * in this JSONB blob; an org-wide fallback key (
197
+ * `AI_KEY_POLICIES.byok_with_org_fallback`) is credential material for the same reason
198
+ * `systemStorageSchema`'s own header gives for the storage secret access
199
+ * key: this object is returned WHOLESALE by `GET /api/system-settings` and
200
+ * copied verbatim into every settings audit row, so a secret here is one
201
+ * admin GET away from being on the wire.
202
+ *
203
+ * `usageRetentionDays` (#443) is how long `ai_usage_events` rows are kept
204
+ * before the daily `ai.usage.purge` job deletes them — 180 days by default,
205
+ * comfortably past the 90-day window the usage report can show. It is a data
206
+ * retention decision, so it applies whether or not AI is currently enabled.
207
+ *
208
+ * `hostedTools` (#442) switches each provider-hosted tool type on for the
209
+ * deployment — web search, file search, code interpreter, image generation
210
+ * and remote MCP. ALL OFF BY DEFAULT: each one reaches outside this
211
+ * deployment (the open web, a third-party MCP server) and bills per use, so
212
+ * it is an administrator's decision, never a side effect of upgrading.
213
+ * `mcpAllowedHosts` optionally narrows which hosts an MCP `serverUrl` may
214
+ * name (`*.example.com` for subdomains); empty means any `https` host. It is
215
+ * a list of HOSTNAMES — MCP credentials travel per request, in the tool's
216
+ * `headers`, and are never stored here or anywhere else.
217
+ *
218
+ * `limits` (#450) holds the per-user and per-model rate limits and output
219
+ * caps — see `systemAiLimitsSchema`. Every field inside it is optional and
220
+ * absent means unlimited; the default is `{}`.
221
+ *
222
+ * NO `.default()` ON ANY FIELD, matching every namespace above it in this
223
+ * file. The defaults live in `DEFAULT_SYSTEM_SETTINGS` (settings.types.ts)
224
+ * and nowhere else.
225
+ */
226
+ /**
227
+ * One provider's slot in `ai.providers`: its switch and optional endpoint
228
+ * override. Every provider id has at least this shape; the two #448 slots
229
+ * below extend it.
230
+ *
231
+ * @stability experimental
232
+ */
233
+ export const systemAiProviderSchema = z.object({
234
+ /** Whether AI is switched on (the kill switch). */
235
+ enabled: z.boolean(),
236
+ /** The endpoint override; absent means the provider's default. */
237
+ baseUrl: z.string().url().optional(),
238
+ });
239
+ // ---- OpenAI-family endpoints (#448) ------------------------------------------
240
+ //
241
+ // SSRF POSTURE. `azure-openai` and `openai-compatible` point this server's
242
+ // outbound AI calls at an administrator-chosen host, so their `baseUrl` is
243
+ // validated harder than `openai.baseUrl` (which is left as it was):
244
+ //
245
+ // - scheme `https` only for Azure (every Azure OpenAI resource is https),
246
+ // `http` or `https` for a compatible server (a self-hosted Ollama on a
247
+ // private network is commonly plain http);
248
+ // - no credentials in the URL (`https://user:pass@host`) — a key belongs in
249
+ // the encrypted credential store, never in a JSONB blob `GET
250
+ // /api/system-settings` returns wholesale;
251
+ // - no fragment, which no HTTP request can carry anyway.
252
+ //
253
+ // POINTING AT AN INTERNAL HOST IS AN EXPLICIT ADMINISTRATOR DECISION, not
254
+ // something this validation refuses: `http://ollama.internal:11434/v1` is the
255
+ // canonical self-hosted setup, and the setting is writable only with
256
+ // `ai_config:write` / `system_settings:write`, both seeded Admin-only. What the
257
+ // adapters additionally refuse is being REDIRECTED somewhere else: their
258
+ // transport follows no redirect to another origin (see
259
+ // `ai/providers/openai/openai-redirect-guard.ts`).
260
+ /**
261
+ * A `baseUrl` for an admin-chosen OpenAI-family endpoint, restricted to `schemes`.
262
+ *
263
+ * @stability experimental
264
+ */
265
+ export function aiEndpointUrlSchema(schemes) {
266
+ return z
267
+ .string()
268
+ .max(AI_ENDPOINT_URL_MAX)
269
+ .superRefine((value, ctx) => {
270
+ const problem = aiEndpointUrlProblem(value, schemes);
271
+ if (problem)
272
+ ctx.addIssue({ code: 'custom', message: problem });
273
+ });
274
+ }
275
+ const apiStyleEnum = () => z.enum(AI_OPENAI_API_STYLES);
276
+ /**
277
+ * Azure OpenAI's model id to deployment name map.
278
+ *
279
+ * @stability experimental
280
+ */
281
+ export const aiAzureDeploymentsSchema = z
282
+ .record(z.string().min(1).max(AI_AZURE_MODEL_ID_MAX), z.string().regex(AI_AZURE_DEPLOYMENT_PATTERN, 'An Azure deployment name'))
283
+ .refine((value) => Object.keys(value).length <= AI_AZURE_DEPLOYMENTS_MAX, {
284
+ message: `At most ${AI_AZURE_DEPLOYMENTS_MAX} deployments`,
285
+ });
286
+ /**
287
+ * `providers['azure-openai']` (#448).
288
+ *
289
+ * - `baseUrl` — the resource endpoint, `https://<resource>.openai.azure.com`
290
+ * (the SDK appends `/openai`). Named `baseUrl`, like every other slot, so
291
+ * every generic consumer (the admin test's override, the catalog sync, the
292
+ * per-call context) handles it with no Azure special case. Required before
293
+ * the provider can be enabled — see `AiConfigAdminService`.
294
+ * - `apiVersion` — the `api-version` query value; absent means
295
+ * `AZURE_OPENAI_DEFAULT_API_VERSION` (`ai/providers/azure-openai`).
296
+ * - `apiStyle` — `responses` (the default: current api-versions serve the
297
+ * Responses API) or `chat_completions` for an older api-version or a
298
+ * deployment the Responses API does not cover.
299
+ * - `deployments` — model id → deployment name. Azure routes by DEPLOYMENT,
300
+ * and a deployment may be named anything; when this map is set its keys
301
+ * ARE the model list the catalog discovers, and a model id missing from it
302
+ * is sent as its own deployment name.
303
+ *
304
+ * @stability experimental
305
+ */
306
+ export const systemAiAzureProviderSchema = systemAiProviderSchema.extend({
307
+ /** The endpoint override; absent means the provider's default. */
308
+ baseUrl: aiEndpointUrlSchema(AI_AZURE_ENDPOINT_SCHEMES).optional(),
309
+ /** Azure OpenAI: the API version. */
310
+ apiVersion: z.string().regex(AI_AZURE_API_VERSION_PATTERN).optional(),
311
+ /** Which API shape the server speaks (`responses` or `chat_completions`). */
312
+ apiStyle: apiStyleEnum().optional(),
313
+ /** Azure OpenAI: model id to deployment name. */
314
+ deployments: aiAzureDeploymentsSchema.optional(),
315
+ });
316
+ /**
317
+ * `providers['openai-compatible']` (#448) — Ollama, vLLM, LM Studio or any
318
+ * other server speaking the OpenAI wire protocol.
319
+ *
320
+ * - `baseUrl` — the server's API root, INCLUDING its version segment
321
+ * (`http://ollama.internal:11434/v1`); required before enabling.
322
+ * - `apiStyle` — `chat_completions` (the default: what every compatible
323
+ * server serves) or `responses` for one that also serves the Responses API.
324
+ * - `requiresKey` — absent or `true`: a key is resolved like any provider's
325
+ * (BYOK, or the org fallback). `false` is the ADMINISTRATOR'S OPT-IN to a
326
+ * keyless server: calls carry no credential, no user needs a key, and
327
+ * usage is recorded with `keySource: 'none'` (docs/specs/ai-platform.md
328
+ * §2.24).
329
+ *
330
+ * @stability experimental
331
+ */
332
+ export const systemAiCompatibleProviderSchema = systemAiProviderSchema.extend({
333
+ /** The endpoint override; absent means the provider's default. */
334
+ baseUrl: aiEndpointUrlSchema(AI_COMPATIBLE_ENDPOINT_SCHEMES).optional(),
335
+ /** Which API shape the server speaks (`responses` or `chat_completions`). */
336
+ apiStyle: apiStyleEnum().optional(),
337
+ /** OpenAI-compatible: whether the server needs a key. */
338
+ requiresKey: z.boolean().optional(),
339
+ });
340
+ // ---- the open `providers` record (PP-14.6, issue #924) ------------------------------------
341
+ //
342
+ // `ai.providers` is a RECORD keyed by provider id, not an object with one fixed
343
+ // key per provider. A provider an app or package adds
344
+ // (`registerAiProvider`, `@marinoscar/platform-api/ai`) has a slot with no
345
+ // change here. The record only checks the id and the one field every slot
346
+ // has (`enabled`); the provider-specific fields pass through and are validated
347
+ // by the provider's own `settingsSchema` where the registry is (the API's
348
+ // `ai` namespace read and merge), never by this package, which cannot know
349
+ // which providers a deployment registered.
350
+ /**
351
+ * A provider id: a lower-case letter, then lower-case letters, digits and
352
+ * hyphens (2 to 48 characters). The pattern of the pluggable-kind registry
353
+ * and the provider part of an `ai.limits.perModel` key.
354
+ *
355
+ * @extensionPoint schema
356
+ * @stability experimental
357
+ */
358
+ export const aiProviderIdSchema = z.string().regex(AI_PROVIDER_ID_PATTERN);
359
+ /**
360
+ * One provider's slot in the stored `ai.providers` record: the switch every
361
+ * provider has, plus the provider's own non-secret settings (`baseUrl`,
362
+ * `region`, ...), which pass through. Carries no key.
363
+ *
364
+ * @extensionPoint schema
365
+ * @stability experimental
366
+ */
367
+ export const aiProviderSlotSchema = z.looseObject({
368
+ /** Whether the provider is switched on. */
369
+ enabled: z.boolean(),
370
+ });
371
+ /**
372
+ * One provider's slot in a PATCH: every field optional, and a provider's own
373
+ * optional setting takes `null` to remove it (back to its default).
374
+ *
375
+ * @stability experimental
376
+ */
377
+ export const aiProviderSlotPatchSchema = z.looseObject({
378
+ /** Whether the provider is switched on. */
379
+ enabled: z.boolean().optional(),
380
+ });
381
+ /**
382
+ * `ai.providers` as stored and as a PUT carries it: slots by provider id.
383
+ *
384
+ * @stability experimental
385
+ */
386
+ export const systemAiProvidersSchema = z.record(aiProviderIdSchema, aiProviderSlotSchema);
387
+ /**
388
+ * `ai.providers` in a PATCH: the slots to change, by provider id; a provider
389
+ * left out keeps its stored settings.
390
+ *
391
+ * @stability experimental
392
+ */
393
+ export const systemAiProvidersPatchSchema = z.record(aiProviderIdSchema, aiProviderSlotPatchSchema);
394
+ /**
395
+ * `ai.providers` as `GET /api/system-settings` answers it. `hasKey` is
396
+ * reported by consumers that know whether a deployment key is stored.
397
+ *
398
+ * @stability experimental
399
+ */
400
+ export const aiProvidersResponseSchema = z.record(aiProviderIdSchema, z.looseObject({
401
+ /** Whether the provider is switched on. */
402
+ enabled: z.boolean(),
403
+ /** Whether the deployment stores a key for the provider. */
404
+ hasKey: z.boolean().optional(),
405
+ }));
406
+ /**
407
+ * `ai.providers` in an organization's overrides: it may only switch a
408
+ * provider off for its members.
409
+ *
410
+ * @stability experimental
411
+ */
412
+ export const orgAiProvidersSchema = z.record(aiProviderIdSchema, z.object({
413
+ /** `false` switches the provider off for the organization's members. */
414
+ enabled: z.boolean().optional(),
415
+ }));
416
+ /**
417
+ * The stored `ai` system settings namespace: the deployment's AI policy.
418
+ * It carries no key (see `AI_SETTINGS_CARRIES_NO_SECRET`).
419
+ *
420
+ * @stability experimental
421
+ */
422
+ export const systemAiSchema = z.object({
423
+ /** Whether AI is switched on (the kill switch). */
424
+ enabled: z.boolean(),
425
+ /** Whose key pays: the caller's own only (`byok`), or an administrator's as a fallback. */
426
+ keyPolicy: keyPolicyEnum(),
427
+ /** Per-provider settings, by provider id. */
428
+ providers: systemAiProvidersSchema,
429
+ /** Deployment-wide defaults a call cannot exceed. */
430
+ defaults: z.object({
431
+ /** Output-token ceiling for every call; `null` means no cap. */
432
+ maxOutputTokensCap: z.number().int().positive().optional(),
433
+ /** Whether a call may be queued as a background run. */
434
+ allowBackgroundRuns: z.boolean(),
435
+ // #449. Appended; see the header for how an older row reads it.
436
+ /** Whether realtime voice sessions may be minted. */
437
+ allowRealtime: z.boolean(),
438
+ }),
439
+ /** Whether prompt and response text is written to the logs. */
440
+ logPromptContent: z.boolean(),
441
+ /** Days usage rows are kept. */
442
+ usageRetentionDays: z.number().int().min(1).max(AI_USAGE_RETENTION_MAX_DAYS),
443
+ /** Which provider-hosted tools are switched on (all off by default). */
444
+ hostedTools: z.object({
445
+ /** Hosted web search. */
446
+ web_search: z.boolean(),
447
+ /** Hosted file search. */
448
+ file_search: z.boolean(),
449
+ /** Hosted code execution. */
450
+ code_interpreter: z.boolean(),
451
+ /** Hosted image generation. */
452
+ image_generation: z.boolean(),
453
+ /** Remote MCP servers. */
454
+ mcp: z.boolean(),
455
+ /** Hosts a remote MCP server may be on; empty means any `https://` host. */
456
+ mcpAllowedHosts: z.array(mcpAllowedHostSchema).max(AI_MCP_ALLOWED_HOSTS_MAX),
457
+ }),
458
+ /** Rate limits and output caps; every absent field is unlimited. */
459
+ limits: systemAiLimitsSchema,
460
+ // #739: whether the DEPLOYMENT's provider key (the `ai` credential of the
461
+ // system tier) may serve a call made in an organization that has no key of
462
+ // its own, under the same rule an organization key does. `true`: today's
463
+ // behaviour, where the deployment key is the only administrator key.
464
+ /** Whether the deployment's keys pay for an organization that stores no key of its own (#739). */
465
+ deploymentKeyServesOrgs: z.boolean(),
466
+ });
467
+ /**
468
+ * `ai`, one level deep — matching `systemStoragePatchSchema`'s own shape one
469
+ * level further in: `providers` and `defaults` are each optional as a whole
470
+ * AND optional field by field inside, so
471
+ * `{ "ai": { "providers": { "openai": { "enabled": true } } } }` is a legal body that leaves `defaults` and
472
+ * `logPromptContent` untouched. See `SystemSettingsService.patchSettings`
473
+ * for the merge this shape is built to support.
474
+ */
475
+ //
476
+ // `baseUrl` and `maxOutputTokensCap` are the two OPTIONAL fields of the stored
477
+ // value, so they are the two a PATCH must be able to REMOVE: absent leaves the
478
+ // stored value alone, explicit `null` deletes it (back to "provider default
479
+ // host" / "no cap"). The same absent-vs-null distinction
480
+ // `storage.forcePathStyle` and `maintenance.startedAt` already draw; without
481
+ // it an override, once set, could be changed but never cleared (#428).
482
+ /**
483
+ * A `PATCH /api/system-settings` body's `ai` member: every field optional.
484
+ *
485
+ * @stability experimental
486
+ */
487
+ export const systemAiPatchSchema = z.object({
488
+ /** Whether AI is switched on (the kill switch). */
489
+ enabled: z.boolean().optional(),
490
+ /** Whose key pays: the caller's own only (`byok`), or an administrator's as a fallback. */
491
+ keyPolicy: keyPolicyEnum().optional(),
492
+ /** Per-provider settings, by provider id. */
493
+ providers: systemAiProvidersPatchSchema.optional(),
494
+ /** Deployment-wide defaults a call cannot exceed. */
495
+ defaults: z
496
+ .object({
497
+ /** Output-token ceiling for every call; `null` means no cap. */
498
+ maxOutputTokensCap: z.number().int().positive().nullable().optional(),
499
+ /** Whether a call may be queued as a background run. */
500
+ allowBackgroundRuns: z.boolean().optional(),
501
+ /** Whether realtime voice sessions may be minted. */
502
+ allowRealtime: z.boolean().optional(),
503
+ })
504
+ .optional(),
505
+ /** Whether prompt and response text is written to the logs. */
506
+ logPromptContent: z.boolean().optional(),
507
+ /** Days usage rows are kept. */
508
+ usageRetentionDays: z.number().int().min(1).max(AI_USAGE_RETENTION_MAX_DAYS).optional(),
509
+ // Field by field; `mcpAllowedHosts` REPLACES wholesale (RFC 7396's rule
510
+ // for arrays, and `notifications.disabledEvents`' precedent).
511
+ /** Which provider-hosted tools are switched on (all off by default). */
512
+ hostedTools: z
513
+ .object({
514
+ /** Hosted web search. */
515
+ web_search: z.boolean().optional(),
516
+ /** Hosted file search. */
517
+ file_search: z.boolean().optional(),
518
+ /** Hosted code execution. */
519
+ code_interpreter: z.boolean().optional(),
520
+ /** Hosted image generation. */
521
+ image_generation: z.boolean().optional(),
522
+ /** Remote MCP servers. */
523
+ mcp: z.boolean().optional(),
524
+ /** Hosts a remote MCP server may be on; empty means any `https://` host. */
525
+ mcpAllowedHosts: z.array(mcpAllowedHostSchema).max(AI_MCP_ALLOWED_HOSTS_MAX).optional(),
526
+ })
527
+ .optional(),
528
+ // #450. REPLACES WHOLESALE when present — the whole `limits` object is the
529
+ // new value. A field-by-field merge could never REMOVE a limit (or a
530
+ // per-model entry), and "absent means unlimited" is the one way to lift
531
+ // one; the same reasoning as `mcpAllowedHosts` above.
532
+ /** Rate limits and output caps; every absent field is unlimited. */
533
+ limits: systemAiLimitsSchema.optional(),
534
+ // #739. See `systemAiSchema`.
535
+ /** Whether the deployment's keys pay for an organization that stores no key of its own (#739). */
536
+ deploymentKeyServesOrgs: z.boolean().optional(),
537
+ });
538
+ // =============================================================================
539
+ // AI platform policy on the wire (#423, epic #419, umbrella #418)
540
+ // =============================================================================
541
+ //
542
+ // Restated here rather than imported, for the reason at the top of this file.
543
+ // Optional in the PUT body like the operations namespaces and `storage`
544
+ // above, and for the identical reason: this block ships ahead of every
545
+ // client that knows it exists.
546
+ //
547
+ // NO API KEY FIELD, ON EITHER SCHEMA, EVER. A user's own key is
548
+ // `UserAiKey.secret`, written through its own dedicated endpoint (#428), not
549
+ // through this document; an org-wide fallback key belongs in the encrypted
550
+ // credential store. See `common/schemas/settings.schema.ts`, which carries
551
+ // the argument and a compile-time proof of the absence.
552
+ //
553
+ // Bounds mirror `systemAiSchema` exactly.
554
+ // `ai.limits` (#450). Every field optional — absent means unlimited. Used by
555
+ // the PUT body and (whole, since a PATCH replaces it wholesale) the PATCH body.
556
+ /**
557
+ * The admin `PUT /api/admin/ai/config` body's `limits`.
558
+ *
559
+ * @stability experimental
560
+ */
561
+ export const aiLimitsSettingsSchema = z.object({
562
+ /** Limits on every call a user makes, whoever's key pays. */
563
+ perUser: z
564
+ .object({
565
+ /** Requests per minute. */
566
+ requestsPerMinute: aiLimitValueSchema.optional(),
567
+ /** Requests per UTC day. */
568
+ requestsPerDay: aiLimitValueSchema.optional(),
569
+ })
570
+ .optional(),
571
+ /** Limits on the calls an administrator-managed key pays for. */
572
+ orgKey: z
573
+ .object({
574
+ /** Requests per UTC day, per user. */
575
+ requestsPerDayPerUser: aiLimitValueSchema.optional(),
576
+ /** Input plus output tokens per UTC day, per user. */
577
+ tokensPerDayPerUser: aiLimitValueSchema.optional(),
578
+ })
579
+ .optional(),
580
+ // #739: the deployment default PER ORGANIZATION (requests and output tokens
581
+ // per UTC day, counted over every call made in that organization); absent
582
+ // means unlimited. An organization may only lower it (its org layer).
583
+ /** Limits on one organization's whole daily volume, whoever's key pays (#739). */
584
+ perOrg: z
585
+ .object({
586
+ /** Requests per UTC day. */
587
+ requestsPerDay: aiLimitValueSchema.optional(),
588
+ /** Output tokens per UTC day. */
589
+ outputTokensPerDay: aiLimitValueSchema.optional(),
590
+ })
591
+ .optional(),
592
+ /** Per-model limits, keyed `<provider>:<modelId>`. */
593
+ perModel: z
594
+ .record(z.string().max(AI_LIMIT_MODEL_KEY_MAX).regex(AI_LIMIT_MODEL_KEY_PATTERN), z.object({
595
+ /** Output-token ceiling for every call to the model. */
596
+ maxOutputTokens: aiLimitValueSchema.optional(),
597
+ /** Requests per minute, per user, to the model. */
598
+ requestsPerMinutePerUser: aiLimitValueSchema.optional(),
599
+ }))
600
+ .refine((value) => Object.keys(value).length <= AI_LIMITS_PER_MODEL_MAX, {
601
+ message: `At most ${AI_LIMITS_PER_MODEL_MAX} per-model limits`,
602
+ })
603
+ .optional(),
604
+ });
605
+ /**
606
+ * The `ai` namespace on the wire of `PUT /api/system-settings`.
607
+ *
608
+ * @stability experimental
609
+ */
610
+ export const aiSettingsSchema = z.object({
611
+ /** Whether AI is switched on (the kill switch). */
612
+ enabled: z.boolean(),
613
+ /** Whose key pays: the caller's own only (`byok`), or an administrator's as a fallback. */
614
+ keyPolicy: keyPolicyEnum(),
615
+ /** Per-provider settings, by provider id. */
616
+ providers: systemAiProvidersSchema,
617
+ /** Deployment-wide defaults a call cannot exceed. */
618
+ defaults: z.object({
619
+ /** Output-token ceiling for every call; `null` means no cap. */
620
+ maxOutputTokensCap: z.number().int().positive().optional(),
621
+ /** Whether a call may be queued as a background run. */
622
+ allowBackgroundRuns: z.boolean(),
623
+ /** Whether realtime voice sessions may be minted. */
624
+ allowRealtime: z.boolean(),
625
+ }),
626
+ /** Whether prompt and response text is written to the logs. */
627
+ logPromptContent: z.boolean(),
628
+ /** Days usage rows are kept. */
629
+ usageRetentionDays: z.number().int().min(1).max(AI_USAGE_RETENTION_MAX_DAYS),
630
+ /** Which provider-hosted tools are switched on (all off by default). */
631
+ hostedTools: z.object({
632
+ /** Hosted web search. */
633
+ web_search: z.boolean(),
634
+ /** Hosted file search. */
635
+ file_search: z.boolean(),
636
+ /** Hosted code execution. */
637
+ code_interpreter: z.boolean(),
638
+ /** Hosted image generation. */
639
+ image_generation: z.boolean(),
640
+ /** Remote MCP servers. */
641
+ mcp: z.boolean(),
642
+ /** Hosts a remote MCP server may be on; empty means any `https://` host. */
643
+ mcpAllowedHosts: z
644
+ .array(z.string().max(253).regex(AI_MCP_ALLOWED_HOST_PATTERN))
645
+ .max(AI_MCP_ALLOWED_HOSTS_MAX),
646
+ }),
647
+ /** Rate limits and output caps; every absent field is unlimited. */
648
+ limits: aiLimitsSettingsSchema,
649
+ // #739: optional on the wire, so a client that predates it still PUTs a
650
+ // legal body; absent keeps the stored value (default `true`).
651
+ /** Whether the deployment's keys pay for an organization that stores no key of its own (#739). */
652
+ deploymentKeyServesOrgs: z.boolean().optional(),
653
+ });
654
+ // #423, epic #419. Optional at the namespace level and field by field
655
+ // inside, one level into each `providers.<id>` and `defaults`, matching
656
+ // `storage` above — `{ "ai": { "enabled": true } }` must be a legal body,
657
+ // or the admin page has to send the whole namespace to flip one switch.
658
+ // NO API KEY FIELD — see the section header above.
659
+ /**
660
+ * The `ai` namespace on the wire of `PATCH /api/system-settings`.
661
+ *
662
+ * @stability experimental
663
+ */
664
+ export const aiSettingsPatchSchema = z.object({
665
+ /** Whether AI is switched on (the kill switch). */
666
+ enabled: z.boolean().optional(),
667
+ /** Whose key pays: the caller's own only (`byok`), or an administrator's as a fallback. */
668
+ keyPolicy: keyPolicyEnum().optional(),
669
+ /** Per-provider settings, by provider id. */
670
+ providers: systemAiProvidersPatchSchema.optional(),
671
+ /** Deployment-wide defaults a call cannot exceed. */
672
+ defaults: z
673
+ .object({
674
+ // Absent leaves it alone; explicit `null` removes the cap.
675
+ /** Output-token ceiling for every call; `null` means no cap. */
676
+ maxOutputTokensCap: z.number().int().positive().nullable().optional(),
677
+ /** Whether a call may be queued as a background run. */
678
+ allowBackgroundRuns: z.boolean().optional(),
679
+ /** Whether realtime voice sessions may be minted. */
680
+ allowRealtime: z.boolean().optional(),
681
+ })
682
+ .optional(),
683
+ /** Whether prompt and response text is written to the logs. */
684
+ logPromptContent: z.boolean().optional(),
685
+ /** Days usage rows are kept. */
686
+ usageRetentionDays: z.number().int().min(1).max(AI_USAGE_RETENTION_MAX_DAYS).optional(),
687
+ // #442. Booleans field by field; `mcpAllowedHosts` replaces wholesale.
688
+ /** Which provider-hosted tools are switched on (all off by default). */
689
+ hostedTools: z
690
+ .object({
691
+ /** Hosted web search. */
692
+ web_search: z.boolean().optional(),
693
+ /** Hosted file search. */
694
+ file_search: z.boolean().optional(),
695
+ /** Hosted code execution. */
696
+ code_interpreter: z.boolean().optional(),
697
+ /** Hosted image generation. */
698
+ image_generation: z.boolean().optional(),
699
+ /** Remote MCP servers. */
700
+ mcp: z.boolean().optional(),
701
+ /** Hosts a remote MCP server may be on; empty means any `https://` host. */
702
+ mcpAllowedHosts: z
703
+ .array(z.string().max(253).regex(AI_MCP_ALLOWED_HOST_PATTERN))
704
+ .max(AI_MCP_ALLOWED_HOSTS_MAX)
705
+ .optional(),
706
+ })
707
+ .optional(),
708
+ // #450. Replaces wholesale when present — see `systemAiPatchSchema`.
709
+ /** Rate limits and output caps; every absent field is unlimited. */
710
+ limits: aiLimitsSettingsSchema.optional(),
711
+ /** Whether the deployment's keys pay for an organization that stores no key of its own (#739). */
712
+ deploymentKeyServesOrgs: z.boolean().optional(),
713
+ });
714
+ // #423, epic #419, umbrella #418 — the AI platform policy, published for
715
+ // the same reason the operations namespaces and `storage` above are: a
716
+ // block this response omits is a block no client can echo back in a PUT.
717
+ //
718
+ // THERE IS NO API KEY FIELD AND THERE MUST NEVER BE ONE. A user's own key
719
+ // is `UserAiKey.secret`, in its own table; an org-wide fallback key belongs
720
+ // in the encrypted credential store. See
721
+ // `common/schemas/settings.schema.ts` for the full argument and its
722
+ // compile-time proof.
723
+ /**
724
+ * The `ai` namespace as `GET /api/system-settings` answers it.
725
+ *
726
+ * @stability experimental
727
+ */
728
+ export const aiResponseSchema = z.object({
729
+ /** Whether AI is switched on (the kill switch). */
730
+ enabled: z.boolean(),
731
+ /** Whose key pays: the caller's own only (`byok`), or an administrator's as a fallback. */
732
+ keyPolicy: keyPolicyEnum(),
733
+ /** Per-provider settings, by provider id. */
734
+ providers: aiProvidersResponseSchema,
735
+ /** Deployment-wide defaults a call cannot exceed. */
736
+ defaults: z.object({
737
+ /** Output-token ceiling for every call; `null` means no cap. */
738
+ maxOutputTokensCap: z.number().optional(),
739
+ /** Whether a call may be queued as a background run. */
740
+ allowBackgroundRuns: z.boolean(),
741
+ /** Whether realtime voice sessions may be minted. */
742
+ allowRealtime: z.boolean(),
743
+ }),
744
+ /** Whether prompt and response text is written to the logs. */
745
+ logPromptContent: z.boolean(),
746
+ /** Days usage rows are kept. */
747
+ usageRetentionDays: z.number().int(),
748
+ /** Which provider-hosted tools are switched on (all off by default). */
749
+ hostedTools: z.object({
750
+ /** Hosted web search. */
751
+ web_search: z.boolean(),
752
+ /** Hosted file search. */
753
+ file_search: z.boolean(),
754
+ /** Hosted code execution. */
755
+ code_interpreter: z.boolean(),
756
+ /** Hosted image generation. */
757
+ image_generation: z.boolean(),
758
+ /** Remote MCP servers. */
759
+ mcp: z.boolean(),
760
+ /** Hosts a remote MCP server may be on; empty means any `https://` host. */
761
+ mcpAllowedHosts: z.array(z.string()),
762
+ }),
763
+ /** Rate limits and output caps; every absent field is unlimited. */
764
+ limits: z.object({
765
+ /** Limits on every call a user makes, whoever's key pays. */
766
+ perUser: z
767
+ .object({
768
+ /** Requests per minute. */
769
+ requestsPerMinute: z.number().int().optional(),
770
+ /** Requests per UTC day. */
771
+ requestsPerDay: z.number().int().optional(),
772
+ })
773
+ .optional(),
774
+ /** Limits on the calls an administrator-managed key pays for. */
775
+ orgKey: z
776
+ .object({
777
+ /** Requests per UTC day, per user. */
778
+ requestsPerDayPerUser: z.number().int().optional(),
779
+ /** Input plus output tokens per UTC day, per user. */
780
+ tokensPerDayPerUser: z.number().int().optional(),
781
+ })
782
+ .optional(),
783
+ /** Limits on one organization's whole daily volume, whoever's key pays (#739). */
784
+ perOrg: z
785
+ .object({
786
+ /** Requests per UTC day. */
787
+ requestsPerDay: z.number().int().optional(),
788
+ /** Output tokens per UTC day. */
789
+ outputTokensPerDay: z.number().int().optional(),
790
+ })
791
+ .optional(),
792
+ /** Per-model limits, keyed `<provider>:<modelId>`. */
793
+ perModel: z
794
+ .record(z.string(), z.object({
795
+ /** Output-token ceiling for every call to the model. */
796
+ maxOutputTokens: z.number().int().optional(),
797
+ /** Requests per minute, per user, to the model. */
798
+ requestsPerMinutePerUser: z.number().int().optional(),
799
+ }))
800
+ .optional(),
801
+ }),
802
+ /** Whether the deployment's keys pay for an organization that stores no key of its own (#739). */
803
+ deploymentKeyServesOrgs: z.boolean(),
804
+ });
805
+ // =============================================================================
806
+ // The org layer of `ai` (issue #739): what one organization may set
807
+ // =============================================================================
808
+ //
809
+ // An organization can only TIGHTEN the deployment's policy (`/api/org-settings`,
810
+ // `org_ai_config:write`): turn AI off for its members, narrow `keyPolicy` from
811
+ // `byok_with_org_fallback` to `byok` (never the reverse), lower the per-org
812
+ // daily caps, and switch providers off. Every field optional (an org stores
813
+ // only what it overrides), no `.default()`, no secret.
814
+ /**
815
+ * The fields of the `ai` namespace an organization may set for itself.
816
+ *
817
+ * @stability experimental
818
+ */
819
+ export const orgAiSettingsSchema = z.object({
820
+ /** Whether AI is switched on (the kill switch). */
821
+ enabled: z.boolean().optional(),
822
+ /** Whose key pays: the caller's own only (`byok`), or an administrator's as a fallback. */
823
+ keyPolicy: keyPolicyEnum().optional(),
824
+ /** Per-provider settings, by provider id. */
825
+ providers: orgAiProvidersSchema.optional(),
826
+ /** Rate limits and output caps; every absent field is unlimited. */
827
+ limits: z
828
+ .object({
829
+ /** Limits on one organization's whole daily volume, whoever's key pays (#739). */
830
+ perOrg: z
831
+ .object({
832
+ /** Requests per UTC day. */
833
+ requestsPerDay: aiLimitValueSchema.optional(),
834
+ /** Output tokens per UTC day. */
835
+ outputTokensPerDay: aiLimitValueSchema.optional(),
836
+ })
837
+ .optional(),
838
+ })
839
+ .optional(),
840
+ });
841
+ function lower(system, org) {
842
+ if (system === undefined)
843
+ return org;
844
+ if (org === undefined)
845
+ return system;
846
+ return Math.min(system, org);
847
+ }
848
+ /**
849
+ * The effective `ai` policy of an organization: the deployment's value with
850
+ * the organization's overrides applied, each of which can only tighten it.
851
+ *
852
+ * @param system - the deployment's `ai` value.
853
+ * @param org - the organization's stored overrides.
854
+ * @returns the effective value (a new object; `system` is not modified).
855
+ *
856
+ * @stability experimental
857
+ */
858
+ export function tightenAiPolicy(system, org) {
859
+ const keyPolicy = system.keyPolicy === 'byok' || org.keyPolicy === 'byok' ? 'byok' : system.keyPolicy;
860
+ const providers = Object.fromEntries(Object.entries(system.providers).map(([id, slot]) => {
861
+ const override = org.providers?.[id];
862
+ return [id, { ...slot, enabled: slot.enabled && (override?.enabled ?? true) }];
863
+ }));
864
+ const systemPerOrg = system.limits.perOrg;
865
+ const orgPerOrg = org.limits?.perOrg;
866
+ const requestsPerDay = lower(systemPerOrg?.requestsPerDay, orgPerOrg?.requestsPerDay);
867
+ const outputTokensPerDay = lower(systemPerOrg?.outputTokensPerDay, orgPerOrg?.outputTokensPerDay);
868
+ const perOrg = requestsPerDay !== undefined || outputTokensPerDay !== undefined
869
+ ? {
870
+ ...(requestsPerDay !== undefined ? { requestsPerDay } : {}),
871
+ ...(outputTokensPerDay !== undefined ? { outputTokensPerDay } : {}),
872
+ }
873
+ : undefined;
874
+ const { perOrg: _drop, ...limits } = system.limits;
875
+ return {
876
+ ...system,
877
+ enabled: system.enabled && (org.enabled ?? true),
878
+ keyPolicy,
879
+ providers,
880
+ limits: { ...limits, ...(perOrg ? { perOrg } : {}) },
881
+ };
882
+ }
883
+ /**
884
+ * The proof's witness value.
885
+ *
886
+ * @stability experimental
887
+ */
888
+ export const AI_SETTINGS_CARRIES_NO_SECRET = true;
889
+ //# sourceMappingURL=schemas.js.map