@jini-ai/cms 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (527) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +84 -0
  3. package/dist/content-types/agent-tools.d.ts +65 -0
  4. package/dist/content-types/agent-tools.d.ts.map +1 -0
  5. package/dist/content-types/agent-tools.js +172 -0
  6. package/dist/content-types/agent-tools.js.map +1 -0
  7. package/dist/content-types/cleanup.d.ts +118 -0
  8. package/dist/content-types/cleanup.d.ts.map +1 -0
  9. package/dist/content-types/cleanup.js +65 -0
  10. package/dist/content-types/cleanup.js.map +1 -0
  11. package/dist/content-types/errors.d.ts +90 -0
  12. package/dist/content-types/errors.d.ts.map +1 -0
  13. package/dist/content-types/errors.js +119 -0
  14. package/dist/content-types/errors.js.map +1 -0
  15. package/dist/content-types/field-defs.d.ts +25 -0
  16. package/dist/content-types/field-defs.d.ts.map +1 -0
  17. package/dist/content-types/field-defs.js +155 -0
  18. package/dist/content-types/field-defs.js.map +1 -0
  19. package/dist/content-types/index-provisioning.d.ts +94 -0
  20. package/dist/content-types/index-provisioning.d.ts.map +1 -0
  21. package/dist/content-types/index-provisioning.js +133 -0
  22. package/dist/content-types/index-provisioning.js.map +1 -0
  23. package/dist/content-types/index.d.ts +63 -0
  24. package/dist/content-types/index.d.ts.map +1 -0
  25. package/dist/content-types/index.js +36 -0
  26. package/dist/content-types/index.js.map +1 -0
  27. package/dist/content-types/lifecycle-dispatch.d.ts +38 -0
  28. package/dist/content-types/lifecycle-dispatch.d.ts.map +1 -0
  29. package/dist/content-types/lifecycle-dispatch.js +28 -0
  30. package/dist/content-types/lifecycle-dispatch.js.map +1 -0
  31. package/dist/content-types/lifecycle.d.ts +104 -0
  32. package/dist/content-types/lifecycle.d.ts.map +1 -0
  33. package/dist/content-types/lifecycle.js +143 -0
  34. package/dist/content-types/lifecycle.js.map +1 -0
  35. package/dist/content-types/list.d.ts +44 -0
  36. package/dist/content-types/list.d.ts.map +1 -0
  37. package/dist/content-types/list.js +13 -0
  38. package/dist/content-types/list.js.map +1 -0
  39. package/dist/content-types/repo.memory.d.ts +72 -0
  40. package/dist/content-types/repo.memory.d.ts.map +1 -0
  41. package/dist/content-types/repo.memory.js +71 -0
  42. package/dist/content-types/repo.memory.js.map +1 -0
  43. package/dist/content-types/tool-registrations.d.ts +65 -0
  44. package/dist/content-types/tool-registrations.d.ts.map +1 -0
  45. package/dist/content-types/tool-registrations.js +180 -0
  46. package/dist/content-types/tool-registrations.js.map +1 -0
  47. package/dist/content-types/types.d.ts +78 -0
  48. package/dist/content-types/types.d.ts.map +1 -0
  49. package/dist/content-types/types.js +32 -0
  50. package/dist/content-types/types.js.map +1 -0
  51. package/dist/content-types/write-service.d.ts +141 -0
  52. package/dist/content-types/write-service.d.ts.map +1 -0
  53. package/dist/content-types/write-service.js +180 -0
  54. package/dist/content-types/write-service.js.map +1 -0
  55. package/dist/core/commands/change-set.d.ts +98 -0
  56. package/dist/core/commands/change-set.d.ts.map +1 -0
  57. package/dist/core/commands/change-set.js +2 -0
  58. package/dist/core/commands/change-set.js.map +1 -0
  59. package/dist/core/commands/command.d.ts +168 -0
  60. package/dist/core/commands/command.d.ts.map +1 -0
  61. package/dist/core/commands/command.js +173 -0
  62. package/dist/core/commands/command.js.map +1 -0
  63. package/dist/core/index.d.ts +45 -0
  64. package/dist/core/index.d.ts.map +1 -0
  65. package/dist/core/index.js +43 -0
  66. package/dist/core/index.js.map +1 -0
  67. package/dist/core/ports.d.ts +139 -0
  68. package/dist/core/ports.d.ts.map +1 -0
  69. package/dist/core/ports.js +2 -0
  70. package/dist/core/ports.js.map +1 -0
  71. package/dist/core/tools/registration-kit.d.ts +308 -0
  72. package/dist/core/tools/registration-kit.d.ts.map +1 -0
  73. package/dist/core/tools/registration-kit.js +381 -0
  74. package/dist/core/tools/registration-kit.js.map +1 -0
  75. package/dist/entries/agent-tools.d.ts +78 -0
  76. package/dist/entries/agent-tools.d.ts.map +1 -0
  77. package/dist/entries/agent-tools.js +158 -0
  78. package/dist/entries/agent-tools.js.map +1 -0
  79. package/dist/entries/errors.d.ts +43 -0
  80. package/dist/entries/errors.d.ts.map +1 -0
  81. package/dist/entries/errors.js +59 -0
  82. package/dist/entries/errors.js.map +1 -0
  83. package/dist/entries/field-validation.d.ts +70 -0
  84. package/dist/entries/field-validation.d.ts.map +1 -0
  85. package/dist/entries/field-validation.js +87 -0
  86. package/dist/entries/field-validation.js.map +1 -0
  87. package/dist/entries/index.d.ts +55 -0
  88. package/dist/entries/index.d.ts.map +1 -0
  89. package/dist/entries/index.js +38 -0
  90. package/dist/entries/index.js.map +1 -0
  91. package/dist/entries/lifecycle-dispatch.d.ts +15 -0
  92. package/dist/entries/lifecycle-dispatch.d.ts.map +1 -0
  93. package/dist/entries/lifecycle-dispatch.js +16 -0
  94. package/dist/entries/lifecycle-dispatch.js.map +1 -0
  95. package/dist/entries/list.d.ts +47 -0
  96. package/dist/entries/list.d.ts.map +1 -0
  97. package/dist/entries/list.js +12 -0
  98. package/dist/entries/list.js.map +1 -0
  99. package/dist/entries/repo.memory.d.ts +64 -0
  100. package/dist/entries/repo.memory.d.ts.map +1 -0
  101. package/dist/entries/repo.memory.js +73 -0
  102. package/dist/entries/repo.memory.js.map +1 -0
  103. package/dist/entries/tool-registrations.d.ts +52 -0
  104. package/dist/entries/tool-registrations.d.ts.map +1 -0
  105. package/dist/entries/tool-registrations.js +141 -0
  106. package/dist/entries/tool-registrations.js.map +1 -0
  107. package/dist/entries/types.d.ts +55 -0
  108. package/dist/entries/types.d.ts.map +1 -0
  109. package/dist/entries/types.js +2 -0
  110. package/dist/entries/types.js.map +1 -0
  111. package/dist/entries/write-service.d.ts +202 -0
  112. package/dist/entries/write-service.d.ts.map +1 -0
  113. package/dist/entries/write-service.js +204 -0
  114. package/dist/entries/write-service.js.map +1 -0
  115. package/dist/identity/admin-crud-service.d.ts +252 -0
  116. package/dist/identity/admin-crud-service.d.ts.map +1 -0
  117. package/dist/identity/admin-crud-service.js +437 -0
  118. package/dist/identity/admin-crud-service.js.map +1 -0
  119. package/dist/identity/agent-tool-input.d.ts +58 -0
  120. package/dist/identity/agent-tool-input.d.ts.map +1 -0
  121. package/dist/identity/agent-tool-input.js +126 -0
  122. package/dist/identity/agent-tool-input.js.map +1 -0
  123. package/dist/identity/agent-tools.d.ts +101 -0
  124. package/dist/identity/agent-tools.d.ts.map +1 -0
  125. package/dist/identity/agent-tools.js +290 -0
  126. package/dist/identity/agent-tools.js.map +1 -0
  127. package/dist/identity/auth-service.d.ts +87 -0
  128. package/dist/identity/auth-service.d.ts.map +1 -0
  129. package/dist/identity/auth-service.js +141 -0
  130. package/dist/identity/auth-service.js.map +1 -0
  131. package/dist/identity/authorize.d.ts +90 -0
  132. package/dist/identity/authorize.d.ts.map +1 -0
  133. package/dist/identity/authorize.js +94 -0
  134. package/dist/identity/authorize.js.map +1 -0
  135. package/dist/identity/grant-service.d.ts +198 -0
  136. package/dist/identity/grant-service.d.ts.map +1 -0
  137. package/dist/identity/grant-service.js +361 -0
  138. package/dist/identity/grant-service.js.map +1 -0
  139. package/dist/identity/hasher.d.ts +39 -0
  140. package/dist/identity/hasher.d.ts.map +1 -0
  141. package/dist/identity/hasher.js +39 -0
  142. package/dist/identity/hasher.js.map +1 -0
  143. package/dist/identity/index.d.ts +59 -0
  144. package/dist/identity/index.d.ts.map +1 -0
  145. package/dist/identity/index.js +51 -0
  146. package/dist/identity/index.js.map +1 -0
  147. package/dist/identity/password-policy.d.ts +58 -0
  148. package/dist/identity/password-policy.d.ts.map +1 -0
  149. package/dist/identity/password-policy.js +67 -0
  150. package/dist/identity/password-policy.js.map +1 -0
  151. package/dist/identity/permission-migrations.d.ts +86 -0
  152. package/dist/identity/permission-migrations.d.ts.map +1 -0
  153. package/dist/identity/permission-migrations.js +67 -0
  154. package/dist/identity/permission-migrations.js.map +1 -0
  155. package/dist/identity/permissions.d.ts +35 -0
  156. package/dist/identity/permissions.d.ts.map +1 -0
  157. package/dist/identity/permissions.js +603 -0
  158. package/dist/identity/permissions.js.map +1 -0
  159. package/dist/identity/ports.d.ts +201 -0
  160. package/dist/identity/ports.d.ts.map +1 -0
  161. package/dist/identity/ports.js +2 -0
  162. package/dist/identity/ports.js.map +1 -0
  163. package/dist/identity/repo.memory.d.ts +164 -0
  164. package/dist/identity/repo.memory.d.ts.map +1 -0
  165. package/dist/identity/repo.memory.js +224 -0
  166. package/dist/identity/repo.memory.js.map +1 -0
  167. package/dist/identity/seed.d.ts +42 -0
  168. package/dist/identity/seed.d.ts.map +1 -0
  169. package/dist/identity/seed.js +277 -0
  170. package/dist/identity/seed.js.map +1 -0
  171. package/dist/identity/tool-registrations.d.ts +50 -0
  172. package/dist/identity/tool-registrations.d.ts.map +1 -0
  173. package/dist/identity/tool-registrations.js +419 -0
  174. package/dist/identity/tool-registrations.js.map +1 -0
  175. package/dist/identity/types.d.ts +185 -0
  176. package/dist/identity/types.d.ts.map +1 -0
  177. package/dist/identity/types.js +64 -0
  178. package/dist/identity/types.js.map +1 -0
  179. package/dist/identity/username.d.ts +12 -0
  180. package/dist/identity/username.d.ts.map +1 -0
  181. package/dist/identity/username.js +14 -0
  182. package/dist/identity/username.js.map +1 -0
  183. package/dist/media/agent-tools.d.ts +66 -0
  184. package/dist/media/agent-tools.d.ts.map +1 -0
  185. package/dist/media/agent-tools.js +131 -0
  186. package/dist/media/agent-tools.js.map +1 -0
  187. package/dist/media/blob-gc-lock.d.ts +37 -0
  188. package/dist/media/blob-gc-lock.d.ts.map +1 -0
  189. package/dist/media/blob-gc-lock.js +55 -0
  190. package/dist/media/blob-gc-lock.js.map +1 -0
  191. package/dist/media/blob-gc.d.ts +246 -0
  192. package/dist/media/blob-gc.d.ts.map +1 -0
  193. package/dist/media/blob-gc.js +254 -0
  194. package/dist/media/blob-gc.js.map +1 -0
  195. package/dist/media/blob-key.d.ts +28 -0
  196. package/dist/media/blob-key.d.ts.map +1 -0
  197. package/dist/media/blob-key.js +11 -0
  198. package/dist/media/blob-key.js.map +1 -0
  199. package/dist/media/blob-store.fs.d.ts +23 -0
  200. package/dist/media/blob-store.fs.d.ts.map +1 -0
  201. package/dist/media/blob-store.fs.js +48 -0
  202. package/dist/media/blob-store.fs.js.map +1 -0
  203. package/dist/media/blob-store.memory.d.ts +22 -0
  204. package/dist/media/blob-store.memory.d.ts.map +1 -0
  205. package/dist/media/blob-store.memory.js +23 -0
  206. package/dist/media/blob-store.memory.js.map +1 -0
  207. package/dist/media/content-type-sniffer.d.ts +49 -0
  208. package/dist/media/content-type-sniffer.d.ts.map +1 -0
  209. package/dist/media/content-type-sniffer.js +141 -0
  210. package/dist/media/content-type-sniffer.js.map +1 -0
  211. package/dist/media/image-transformer.d.ts +45 -0
  212. package/dist/media/image-transformer.d.ts.map +1 -0
  213. package/dist/media/image-transformer.js +23 -0
  214. package/dist/media/image-transformer.js.map +1 -0
  215. package/dist/media/image-transformer.sharp.d.ts +26 -0
  216. package/dist/media/image-transformer.sharp.d.ts.map +1 -0
  217. package/dist/media/image-transformer.sharp.js +91 -0
  218. package/dist/media/image-transformer.sharp.js.map +1 -0
  219. package/dist/media/index.d.ts +43 -0
  220. package/dist/media/index.d.ts.map +1 -0
  221. package/dist/media/index.js +31 -0
  222. package/dist/media/index.js.map +1 -0
  223. package/dist/media/media-service.d.ts +244 -0
  224. package/dist/media/media-service.d.ts.map +1 -0
  225. package/dist/media/media-service.js +345 -0
  226. package/dist/media/media-service.js.map +1 -0
  227. package/dist/media/ports.d.ts +142 -0
  228. package/dist/media/ports.d.ts.map +1 -0
  229. package/dist/media/ports.js +2 -0
  230. package/dist/media/ports.js.map +1 -0
  231. package/dist/media/rendition-service.d.ts +66 -0
  232. package/dist/media/rendition-service.d.ts.map +1 -0
  233. package/dist/media/rendition-service.js +135 -0
  234. package/dist/media/rendition-service.js.map +1 -0
  235. package/dist/media/repo.memory.d.ts +107 -0
  236. package/dist/media/repo.memory.d.ts.map +1 -0
  237. package/dist/media/repo.memory.js +131 -0
  238. package/dist/media/repo.memory.js.map +1 -0
  239. package/dist/media/tool-registrations.d.ts +42 -0
  240. package/dist/media/tool-registrations.d.ts.map +1 -0
  241. package/dist/media/tool-registrations.js +121 -0
  242. package/dist/media/tool-registrations.js.map +1 -0
  243. package/dist/media/transform-lock.d.ts +36 -0
  244. package/dist/media/transform-lock.d.ts.map +1 -0
  245. package/dist/media/transform-lock.js +50 -0
  246. package/dist/media/transform-lock.js.map +1 -0
  247. package/dist/media/transform-registry.d.ts +103 -0
  248. package/dist/media/transform-registry.d.ts.map +1 -0
  249. package/dist/media/transform-registry.js +87 -0
  250. package/dist/media/transform-registry.js.map +1 -0
  251. package/dist/media/transform-types.d.ts +82 -0
  252. package/dist/media/transform-types.d.ts.map +1 -0
  253. package/dist/media/transform-types.js +47 -0
  254. package/dist/media/transform-types.js.map +1 -0
  255. package/dist/media/types.d.ts +150 -0
  256. package/dist/media/types.d.ts.map +1 -0
  257. package/dist/media/types.js +26 -0
  258. package/dist/media/types.js.map +1 -0
  259. package/dist/navigation/agent-tools.d.ts +90 -0
  260. package/dist/navigation/agent-tools.d.ts.map +1 -0
  261. package/dist/navigation/agent-tools.js +225 -0
  262. package/dist/navigation/agent-tools.js.map +1 -0
  263. package/dist/navigation/contracts.d.ts +98 -0
  264. package/dist/navigation/contracts.d.ts.map +1 -0
  265. package/dist/navigation/contracts.js +70 -0
  266. package/dist/navigation/contracts.js.map +1 -0
  267. package/dist/navigation/index.d.ts +39 -0
  268. package/dist/navigation/index.d.ts.map +1 -0
  269. package/dist/navigation/index.js +30 -0
  270. package/dist/navigation/index.js.map +1 -0
  271. package/dist/navigation/menu-service.d.ts +256 -0
  272. package/dist/navigation/menu-service.d.ts.map +1 -0
  273. package/dist/navigation/menu-service.js +382 -0
  274. package/dist/navigation/menu-service.js.map +1 -0
  275. package/dist/navigation/ports.d.ts +147 -0
  276. package/dist/navigation/ports.d.ts.map +1 -0
  277. package/dist/navigation/ports.js +2 -0
  278. package/dist/navigation/ports.js.map +1 -0
  279. package/dist/navigation/read-model.d.ts +11 -0
  280. package/dist/navigation/read-model.d.ts.map +1 -0
  281. package/dist/navigation/read-model.js +27 -0
  282. package/dist/navigation/read-model.js.map +1 -0
  283. package/dist/navigation/reconcile.d.ts +57 -0
  284. package/dist/navigation/reconcile.d.ts.map +1 -0
  285. package/dist/navigation/reconcile.js +33 -0
  286. package/dist/navigation/reconcile.js.map +1 -0
  287. package/dist/navigation/repo.memory.d.ts +137 -0
  288. package/dist/navigation/repo.memory.d.ts.map +1 -0
  289. package/dist/navigation/repo.memory.js +95 -0
  290. package/dist/navigation/repo.memory.js.map +1 -0
  291. package/dist/navigation/resolver.d.ts +110 -0
  292. package/dist/navigation/resolver.d.ts.map +1 -0
  293. package/dist/navigation/resolver.js +131 -0
  294. package/dist/navigation/resolver.js.map +1 -0
  295. package/dist/navigation/tool-registrations.d.ts +43 -0
  296. package/dist/navigation/tool-registrations.d.ts.map +1 -0
  297. package/dist/navigation/tool-registrations.js +126 -0
  298. package/dist/navigation/tool-registrations.js.map +1 -0
  299. package/dist/navigation/types.d.ts +207 -0
  300. package/dist/navigation/types.d.ts.map +1 -0
  301. package/dist/navigation/types.js +14 -0
  302. package/dist/navigation/types.js.map +1 -0
  303. package/dist/presentation/index.d.ts +15 -0
  304. package/dist/presentation/index.d.ts.map +1 -0
  305. package/dist/presentation/index.js +15 -0
  306. package/dist/presentation/index.js.map +1 -0
  307. package/dist/presentation/presentation.d.ts +72 -0
  308. package/dist/presentation/presentation.d.ts.map +1 -0
  309. package/dist/presentation/presentation.js +51 -0
  310. package/dist/presentation/presentation.js.map +1 -0
  311. package/dist/presentation/repo.memory.d.ts +9 -0
  312. package/dist/presentation/repo.memory.d.ts.map +1 -0
  313. package/dist/presentation/repo.memory.js +21 -0
  314. package/dist/presentation/repo.memory.js.map +1 -0
  315. package/dist/server/index.d.ts +28 -0
  316. package/dist/server/index.d.ts.map +1 -0
  317. package/dist/server/index.js +28 -0
  318. package/dist/server/index.js.map +1 -0
  319. package/dist/settings/agent-tools.d.ts +83 -0
  320. package/dist/settings/agent-tools.d.ts.map +1 -0
  321. package/dist/settings/agent-tools.js +200 -0
  322. package/dist/settings/agent-tools.js.map +1 -0
  323. package/dist/settings/agent-writable-preferences.d.ts +67 -0
  324. package/dist/settings/agent-writable-preferences.d.ts.map +1 -0
  325. package/dist/settings/agent-writable-preferences.js +144 -0
  326. package/dist/settings/agent-writable-preferences.js.map +1 -0
  327. package/dist/settings/change-feed.d.ts +74 -0
  328. package/dist/settings/change-feed.d.ts.map +1 -0
  329. package/dist/settings/change-feed.js +61 -0
  330. package/dist/settings/change-feed.js.map +1 -0
  331. package/dist/settings/definitions-dispatch.d.ts +51 -0
  332. package/dist/settings/definitions-dispatch.d.ts.map +1 -0
  333. package/dist/settings/definitions-dispatch.js +86 -0
  334. package/dist/settings/definitions-dispatch.js.map +1 -0
  335. package/dist/settings/dictionaries/index.d.ts +45 -0
  336. package/dist/settings/dictionaries/index.d.ts.map +1 -0
  337. package/dist/settings/dictionaries/index.js +69 -0
  338. package/dist/settings/dictionaries/index.js.map +1 -0
  339. package/dist/settings/dictionaries/settings-dialog.ar.d.ts +3 -0
  340. package/dist/settings/dictionaries/settings-dialog.ar.d.ts.map +1 -0
  341. package/dist/settings/dictionaries/settings-dialog.ar.js +28 -0
  342. package/dist/settings/dictionaries/settings-dialog.ar.js.map +1 -0
  343. package/dist/settings/dictionaries/settings-dialog.bn.d.ts +3 -0
  344. package/dist/settings/dictionaries/settings-dialog.bn.d.ts.map +1 -0
  345. package/dist/settings/dictionaries/settings-dialog.bn.js +28 -0
  346. package/dist/settings/dictionaries/settings-dialog.bn.js.map +1 -0
  347. package/dist/settings/dictionaries/settings-dialog.de.d.ts +3 -0
  348. package/dist/settings/dictionaries/settings-dialog.de.d.ts.map +1 -0
  349. package/dist/settings/dictionaries/settings-dialog.de.js +28 -0
  350. package/dist/settings/dictionaries/settings-dialog.de.js.map +1 -0
  351. package/dist/settings/dictionaries/settings-dialog.es.d.ts +3 -0
  352. package/dist/settings/dictionaries/settings-dialog.es.d.ts.map +1 -0
  353. package/dist/settings/dictionaries/settings-dialog.es.js +28 -0
  354. package/dist/settings/dictionaries/settings-dialog.es.js.map +1 -0
  355. package/dist/settings/dictionaries/settings-dialog.fa.d.ts +3 -0
  356. package/dist/settings/dictionaries/settings-dialog.fa.d.ts.map +1 -0
  357. package/dist/settings/dictionaries/settings-dialog.fa.js +28 -0
  358. package/dist/settings/dictionaries/settings-dialog.fa.js.map +1 -0
  359. package/dist/settings/dictionaries/settings-dialog.fr.d.ts +3 -0
  360. package/dist/settings/dictionaries/settings-dialog.fr.d.ts.map +1 -0
  361. package/dist/settings/dictionaries/settings-dialog.fr.js +28 -0
  362. package/dist/settings/dictionaries/settings-dialog.fr.js.map +1 -0
  363. package/dist/settings/dictionaries/settings-dialog.hi.d.ts +3 -0
  364. package/dist/settings/dictionaries/settings-dialog.hi.d.ts.map +1 -0
  365. package/dist/settings/dictionaries/settings-dialog.hi.js +28 -0
  366. package/dist/settings/dictionaries/settings-dialog.hi.js.map +1 -0
  367. package/dist/settings/dictionaries/settings-dialog.hu.d.ts +3 -0
  368. package/dist/settings/dictionaries/settings-dialog.hu.d.ts.map +1 -0
  369. package/dist/settings/dictionaries/settings-dialog.hu.js +28 -0
  370. package/dist/settings/dictionaries/settings-dialog.hu.js.map +1 -0
  371. package/dist/settings/dictionaries/settings-dialog.id.d.ts +3 -0
  372. package/dist/settings/dictionaries/settings-dialog.id.d.ts.map +1 -0
  373. package/dist/settings/dictionaries/settings-dialog.id.js +28 -0
  374. package/dist/settings/dictionaries/settings-dialog.id.js.map +1 -0
  375. package/dist/settings/dictionaries/settings-dialog.it.d.ts +3 -0
  376. package/dist/settings/dictionaries/settings-dialog.it.d.ts.map +1 -0
  377. package/dist/settings/dictionaries/settings-dialog.it.js +28 -0
  378. package/dist/settings/dictionaries/settings-dialog.it.js.map +1 -0
  379. package/dist/settings/dictionaries/settings-dialog.ja.d.ts +3 -0
  380. package/dist/settings/dictionaries/settings-dialog.ja.d.ts.map +1 -0
  381. package/dist/settings/dictionaries/settings-dialog.ja.js +28 -0
  382. package/dist/settings/dictionaries/settings-dialog.ja.js.map +1 -0
  383. package/dist/settings/dictionaries/settings-dialog.ko.d.ts +3 -0
  384. package/dist/settings/dictionaries/settings-dialog.ko.d.ts.map +1 -0
  385. package/dist/settings/dictionaries/settings-dialog.ko.js +28 -0
  386. package/dist/settings/dictionaries/settings-dialog.ko.js.map +1 -0
  387. package/dist/settings/dictionaries/settings-dialog.pl.d.ts +3 -0
  388. package/dist/settings/dictionaries/settings-dialog.pl.d.ts.map +1 -0
  389. package/dist/settings/dictionaries/settings-dialog.pl.js +28 -0
  390. package/dist/settings/dictionaries/settings-dialog.pl.js.map +1 -0
  391. package/dist/settings/dictionaries/settings-dialog.pt-BR.d.ts +3 -0
  392. package/dist/settings/dictionaries/settings-dialog.pt-BR.d.ts.map +1 -0
  393. package/dist/settings/dictionaries/settings-dialog.pt-BR.js +28 -0
  394. package/dist/settings/dictionaries/settings-dialog.pt-BR.js.map +1 -0
  395. package/dist/settings/dictionaries/settings-dialog.ru.d.ts +3 -0
  396. package/dist/settings/dictionaries/settings-dialog.ru.d.ts.map +1 -0
  397. package/dist/settings/dictionaries/settings-dialog.ru.js +28 -0
  398. package/dist/settings/dictionaries/settings-dialog.ru.js.map +1 -0
  399. package/dist/settings/dictionaries/settings-dialog.th.d.ts +3 -0
  400. package/dist/settings/dictionaries/settings-dialog.th.d.ts.map +1 -0
  401. package/dist/settings/dictionaries/settings-dialog.th.js +28 -0
  402. package/dist/settings/dictionaries/settings-dialog.th.js.map +1 -0
  403. package/dist/settings/dictionaries/settings-dialog.tr.d.ts +3 -0
  404. package/dist/settings/dictionaries/settings-dialog.tr.d.ts.map +1 -0
  405. package/dist/settings/dictionaries/settings-dialog.tr.js +28 -0
  406. package/dist/settings/dictionaries/settings-dialog.tr.js.map +1 -0
  407. package/dist/settings/dictionaries/settings-dialog.uk.d.ts +3 -0
  408. package/dist/settings/dictionaries/settings-dialog.uk.d.ts.map +1 -0
  409. package/dist/settings/dictionaries/settings-dialog.uk.js +28 -0
  410. package/dist/settings/dictionaries/settings-dialog.uk.js.map +1 -0
  411. package/dist/settings/dictionaries/settings-dialog.ur.d.ts +3 -0
  412. package/dist/settings/dictionaries/settings-dialog.ur.d.ts.map +1 -0
  413. package/dist/settings/dictionaries/settings-dialog.ur.js +28 -0
  414. package/dist/settings/dictionaries/settings-dialog.ur.js.map +1 -0
  415. package/dist/settings/dictionaries/settings-dialog.zh-CN.d.ts +3 -0
  416. package/dist/settings/dictionaries/settings-dialog.zh-CN.d.ts.map +1 -0
  417. package/dist/settings/dictionaries/settings-dialog.zh-CN.js +28 -0
  418. package/dist/settings/dictionaries/settings-dialog.zh-CN.js.map +1 -0
  419. package/dist/settings/dictionaries/settings-dialog.zh-TW.d.ts +3 -0
  420. package/dist/settings/dictionaries/settings-dialog.zh-TW.d.ts.map +1 -0
  421. package/dist/settings/dictionaries/settings-dialog.zh-TW.js +28 -0
  422. package/dist/settings/dictionaries/settings-dialog.zh-TW.js.map +1 -0
  423. package/dist/settings/ensure-definitions.d.ts +88 -0
  424. package/dist/settings/ensure-definitions.d.ts.map +1 -0
  425. package/dist/settings/ensure-definitions.js +91 -0
  426. package/dist/settings/ensure-definitions.js.map +1 -0
  427. package/dist/settings/errors.d.ts +36 -0
  428. package/dist/settings/errors.d.ts.map +1 -0
  429. package/dist/settings/errors.js +40 -0
  430. package/dist/settings/errors.js.map +1 -0
  431. package/dist/settings/index.d.ts +37 -0
  432. package/dist/settings/index.d.ts.map +1 -0
  433. package/dist/settings/index.js +36 -0
  434. package/dist/settings/index.js.map +1 -0
  435. package/dist/settings/ports.d.ts +117 -0
  436. package/dist/settings/ports.d.ts.map +1 -0
  437. package/dist/settings/ports.js +2 -0
  438. package/dist/settings/ports.js.map +1 -0
  439. package/dist/settings/purge-service.d.ts +53 -0
  440. package/dist/settings/purge-service.d.ts.map +1 -0
  441. package/dist/settings/purge-service.js +105 -0
  442. package/dist/settings/purge-service.js.map +1 -0
  443. package/dist/settings/repo.memory.d.ts +119 -0
  444. package/dist/settings/repo.memory.d.ts.map +1 -0
  445. package/dist/settings/repo.memory.js +199 -0
  446. package/dist/settings/repo.memory.js.map +1 -0
  447. package/dist/settings/settings.d.ts +124 -0
  448. package/dist/settings/settings.d.ts.map +1 -0
  449. package/dist/settings/settings.js +238 -0
  450. package/dist/settings/settings.js.map +1 -0
  451. package/dist/settings/tool-registrations.d.ts +56 -0
  452. package/dist/settings/tool-registrations.d.ts.map +1 -0
  453. package/dist/settings/tool-registrations.js +240 -0
  454. package/dist/settings/tool-registrations.js.map +1 -0
  455. package/dist/settings/types.d.ts +125 -0
  456. package/dist/settings/types.d.ts.map +1 -0
  457. package/dist/settings/types.js +3 -0
  458. package/dist/settings/types.js.map +1 -0
  459. package/dist/settings/ui-tab-definitions.d.ts +41 -0
  460. package/dist/settings/ui-tab-definitions.d.ts.map +1 -0
  461. package/dist/settings/ui-tab-definitions.js +148 -0
  462. package/dist/settings/ui-tab-definitions.js.map +1 -0
  463. package/dist/settings/write-service.d.ts +314 -0
  464. package/dist/settings/write-service.d.ts.map +1 -0
  465. package/dist/settings/write-service.js +677 -0
  466. package/dist/settings/write-service.js.map +1 -0
  467. package/dist/taxonomy/agent-tools.d.ts +76 -0
  468. package/dist/taxonomy/agent-tools.d.ts.map +1 -0
  469. package/dist/taxonomy/agent-tools.js +178 -0
  470. package/dist/taxonomy/agent-tools.js.map +1 -0
  471. package/dist/taxonomy/content-lookup.d.ts +45 -0
  472. package/dist/taxonomy/content-lookup.d.ts.map +1 -0
  473. package/dist/taxonomy/content-lookup.js +9 -0
  474. package/dist/taxonomy/content-lookup.js.map +1 -0
  475. package/dist/taxonomy/index.d.ts +38 -0
  476. package/dist/taxonomy/index.d.ts.map +1 -0
  477. package/dist/taxonomy/index.js +38 -0
  478. package/dist/taxonomy/index.js.map +1 -0
  479. package/dist/taxonomy/list.d.ts +39 -0
  480. package/dist/taxonomy/list.d.ts.map +1 -0
  481. package/dist/taxonomy/list.js +19 -0
  482. package/dist/taxonomy/list.js.map +1 -0
  483. package/dist/taxonomy/merge-term.d.ts +94 -0
  484. package/dist/taxonomy/merge-term.d.ts.map +1 -0
  485. package/dist/taxonomy/merge-term.js +65 -0
  486. package/dist/taxonomy/merge-term.js.map +1 -0
  487. package/dist/taxonomy/repo.memory.d.ts +160 -0
  488. package/dist/taxonomy/repo.memory.d.ts.map +1 -0
  489. package/dist/taxonomy/repo.memory.js +171 -0
  490. package/dist/taxonomy/repo.memory.js.map +1 -0
  491. package/dist/taxonomy/validation-chain.d.ts +114 -0
  492. package/dist/taxonomy/validation-chain.d.ts.map +1 -0
  493. package/dist/taxonomy/validation-chain.js +152 -0
  494. package/dist/taxonomy/validation-chain.js.map +1 -0
  495. package/dist/taxonomy/write-service.d.ts +387 -0
  496. package/dist/taxonomy/write-service.d.ts.map +1 -0
  497. package/dist/taxonomy/write-service.js +350 -0
  498. package/dist/taxonomy/write-service.js.map +1 -0
  499. package/dist/workspace/agent-tools.d.ts +67 -0
  500. package/dist/workspace/agent-tools.d.ts.map +1 -0
  501. package/dist/workspace/agent-tools.js +103 -0
  502. package/dist/workspace/agent-tools.js.map +1 -0
  503. package/dist/workspace/create.d.ts +116 -0
  504. package/dist/workspace/create.d.ts.map +1 -0
  505. package/dist/workspace/create.js +69 -0
  506. package/dist/workspace/create.js.map +1 -0
  507. package/dist/workspace/delete.d.ts +50 -0
  508. package/dist/workspace/delete.d.ts.map +1 -0
  509. package/dist/workspace/delete.js +24 -0
  510. package/dist/workspace/delete.js.map +1 -0
  511. package/dist/workspace/index.d.ts +27 -0
  512. package/dist/workspace/index.d.ts.map +1 -0
  513. package/dist/workspace/index.js +27 -0
  514. package/dist/workspace/index.js.map +1 -0
  515. package/dist/workspace/repo.memory.d.ts +34 -0
  516. package/dist/workspace/repo.memory.d.ts.map +1 -0
  517. package/dist/workspace/repo.memory.js +50 -0
  518. package/dist/workspace/repo.memory.js.map +1 -0
  519. package/dist/workspace/tool-registrations.d.ts +38 -0
  520. package/dist/workspace/tool-registrations.d.ts.map +1 -0
  521. package/dist/workspace/tool-registrations.js +71 -0
  522. package/dist/workspace/tool-registrations.js.map +1 -0
  523. package/dist/workspace/update.d.ts +52 -0
  524. package/dist/workspace/update.d.ts.map +1 -0
  525. package/dist/workspace/update.js +41 -0
  526. package/dist/workspace/update.js.map +1 -0
  527. package/package.json +149 -0
@@ -0,0 +1,125 @@
1
+ import type { ISODateTime, JsonValue, UUID } from "../core/ports.js";
2
+ /**
3
+ * @file Settings domain types.
4
+ *
5
+ * Purpose:
6
+ * Record shapes + the schema-validation vocabulary shared by `settings.ts`,
7
+ * `write-service.ts`, `purge-service.ts`, and both repo adapters. Interfaces
8
+ * and types only — no feature logic (mirrors `identity/types.ts`).
9
+ */
10
+ export type SettingScope = "global" | "workspace" | "user";
11
+ export type SettingOwnerKind = "core" | "site" | "theme";
12
+ export type DefinitionStatus = "active" | "alias" | "deprecated" | "tombstone";
13
+ export type ValueState = "set" | "cleared";
14
+ export type RevisionEntityKind = "definition" | "value";
15
+ export type RevisionOp = "register" | "alias" | "retype"
16
+ /**
17
+ * A `core` definition's stored `default_json` was reconciled to the default
18
+ * its source declares (`write-service.ts`'s `reconcileDefinitionDefault`).
19
+ * Distinct from `retype`: the schema is unchanged, so no stored value needs
20
+ * coercion and the definition version does NOT advance. Only unset-value
21
+ * resolution changes.
22
+ */
23
+ | "redefault" | "deprecate" | "tombstone" | "set" | "clear" | "purge" | "coerce";
24
+ /** Scope bitmask values: global=1, workspace=2, user=4. Legal range 1..7. */
25
+ export declare const SCOPE_BIT: {
26
+ readonly global: 1;
27
+ readonly workspace: 2;
28
+ readonly user: 4;
29
+ };
30
+ /**
31
+ * A deliberately small, total value-schema vocabulary (Article III — this
32
+ * feature registers string/number/boolean/enum settings; a generic JSON
33
+ * Schema engine is not needed and would be speculative generality). Every
34
+ * variant is exhaustively validatable by `validateValue`.
35
+ */
36
+ /**
37
+ * `{type:"json"}` is a deliberately narrow, scalar-ADJACENT exception to the
38
+ * "deliberately small" vocabulary above: it accepts any JSON value
39
+ * (object/array/scalar) and validates nothing about its internal shape —
40
+ * that is the registering feature's own write-path responsibility, never
41
+ * this ledger's job.
42
+ *
43
+ * Enforcement rule that must survive any refactor: Code Review must confirm
44
+ * that EVERY use is genuinely unbounded, list-shaped data with no scalar
45
+ * decomposition available — it is not a general escape hatch for fields that
46
+ * could be scalar-decomposed instead. The check is per-use, deliberately not
47
+ * a headcount. See `docs/decisions/settings-json-schema-variant.md` for the
48
+ * originating rationale and a related non-null-default invariant.
49
+ */
50
+ export type SettingValueSchema = {
51
+ type: "string";
52
+ nullable?: boolean;
53
+ } | {
54
+ type: "number";
55
+ nullable?: boolean;
56
+ } | {
57
+ type: "boolean";
58
+ nullable?: boolean;
59
+ } | {
60
+ type: "enum";
61
+ values: readonly string[];
62
+ nullable?: boolean;
63
+ } | {
64
+ type: "json";
65
+ nullable?: boolean;
66
+ };
67
+ export interface SettingDefinitionRecord {
68
+ settingId: UUID;
69
+ version: number;
70
+ /** NULL = platform def (core/theme); non-null = site-owned. */
71
+ workspaceId: UUID | null;
72
+ namespace: string;
73
+ key: string;
74
+ ownerKind: SettingOwnerKind;
75
+ ownerId: string | null;
76
+ schema: SettingValueSchema;
77
+ defaultValue: JsonValue | null;
78
+ /** Bitmask over `SCOPE_BIT`, legal range 1..7. */
79
+ scopes: number;
80
+ secret: boolean;
81
+ status: DefinitionStatus;
82
+ aliasOfNamespace: string | null;
83
+ aliasOfKey: string | null;
84
+ /** Present only when `version > 1`; a total coercer id/tag for the prior version. */
85
+ coercionTag: string | null;
86
+ createdAt: ISODateTime;
87
+ updatedAt: ISODateTime;
88
+ }
89
+ export interface SettingValueRecord {
90
+ settingId: UUID;
91
+ scope: SettingScope;
92
+ /** Present for workspace/user scope; null for global. */
93
+ workspaceId: UUID | null;
94
+ /** Present for user scope only. */
95
+ principalId: UUID | null;
96
+ valueJson: JsonValue | null;
97
+ state: ValueState;
98
+ defVersion: number;
99
+ seq: number;
100
+ updatedBy: UUID;
101
+ updatedAt: ISODateTime;
102
+ originPluginId: string | null;
103
+ }
104
+ export interface SettingRevisionRecord {
105
+ seq: number;
106
+ entityKind: RevisionEntityKind;
107
+ settingId: UUID;
108
+ scope: SettingScope | null;
109
+ workspaceId: UUID | null;
110
+ principalId: UUID | null;
111
+ op: RevisionOp;
112
+ beforeJson: JsonValue | null;
113
+ afterJson: JsonValue | null;
114
+ defVersion: number;
115
+ actor: UUID;
116
+ originPluginId: string | null;
117
+ changeSetId: string | null;
118
+ createdAt: ISODateTime;
119
+ }
120
+ /** The context a resolver/write call is evaluated against. */
121
+ export interface SettingScopeContext {
122
+ workspaceId?: UUID | undefined;
123
+ principalId?: UUID | undefined;
124
+ }
125
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/settings/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAErE;;;;;;;GAOG;AAEH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC;AAC3D,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AACzD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,WAAW,CAAC;AAC/E,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,SAAS,CAAC;AAC3C,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,OAAO,CAAC;AACxD,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,OAAO,GACP,QAAQ;AACV;;;;;;GAMG;GACD,WAAW,GACX,WAAW,GACX,WAAW,GACX,KAAK,GACL,OAAO,GACP,OAAO,GACP,QAAQ,CAAC;AAEb,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= { global: 1, workspace: 2, user: 4 };
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/settings/types.ts"],"names":[],"mappings":"AAmCA,6EAA6E;AAC7E,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAW,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { UUID } from "../core/ports.js";
2
+ import { type EnsureSettingDefinitionsDeps } from "./ensure-definitions.js";
3
+ /**
4
+ * @file Boot-time definition registration for the settings-dialog tabs that
5
+ * need nothing but ledger storage — Instructions, Notifications, and Privacy.
6
+ *
7
+ * These three sit together because they are the same shape of problem, not
8
+ * because they are the same domain: each is a `value` + `onChange` component
9
+ * from a shared UI library with no async port, so the entire host-side cost
10
+ * is "register some keys and map them". A tab that needs real backend work
11
+ * (routes, a port) should keep its own module rather than accreting into
12
+ * this one.
13
+ *
14
+ * All three read and write through the generic settings ledger routes a host
15
+ * exposes, gated by the ledger's own scope-derived `settings.workspace.write`
16
+ * check. There is no bespoke get/set service and no per-tab permission — the
17
+ * reason the shared `ensureSettingDefinitions` helper exists.
18
+ */
19
+ /** Custom instructions applied to every admin-assistant conversation. */
20
+ export declare const INSTRUCTIONS_NAMESPACE = "core.instructions";
21
+ /** Completion-sound and desktop-notification preferences. */
22
+ export declare const NOTIFICATIONS_NAMESPACE = "core.notifications";
23
+ /** Telemetry consent state. */
24
+ export declare const PRIVACY_NAMESPACE = "core.privacy";
25
+ /** Theme choice and accent color for the settings-dialog surface. */
26
+ export declare const APPEARANCE_NAMESPACE = "core.appearance";
27
+ /** Admin UI locale. */
28
+ export declare const LANGUAGE_NAMESPACE = "core.language";
29
+ export interface EnsureSettingsUiTabDefinitionsInput {
30
+ /** The trusted boot-time actor these writes are attributed to. */
31
+ systemPrincipalId: UUID;
32
+ }
33
+ /**
34
+ * Idempotently registers the Instructions, Notifications, and Privacy
35
+ * definitions. Safe to call on every boot.
36
+ *
37
+ * @complexity O(n) in the total number of definitions (9), each a
38
+ * skip-if-registered check plus at most one `registerDefinitions` call.
39
+ */
40
+ export declare function ensureSettingsUiTabDefinitions(deps: EnsureSettingDefinitionsDeps, input: EnsureSettingsUiTabDefinitionsInput): Promise<void>;
41
+ //# sourceMappingURL=ui-tab-definitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-tab-definitions.d.ts","sourceRoot":"","sources":["../../src/settings/ui-tab-definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAEL,KAAK,4BAA4B,EAElC,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;;;;;;;;;GAeG;AAEH,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAE1D,6DAA6D;AAC7D,eAAO,MAAM,uBAAuB,uBAAuB,CAAC;AAE5D,+BAA+B;AAC/B,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD,uBAAuB;AACvB,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAqHlD,MAAM,WAAW,mCAAmC;IAClD,kEAAkE;IAClE,iBAAiB,EAAE,IAAI,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,4BAA4B,EAClC,KAAK,EAAE,mCAAmC,GACzC,OAAO,CAAC,IAAI,CAAC,CAgBf"}
@@ -0,0 +1,148 @@
1
+ import { ensureSettingDefinitions, } from "./ensure-definitions.js";
2
+ import { SCOPE_BIT } from "./types.js";
3
+ /**
4
+ * @file Boot-time definition registration for the settings-dialog tabs that
5
+ * need nothing but ledger storage — Instructions, Notifications, and Privacy.
6
+ *
7
+ * These three sit together because they are the same shape of problem, not
8
+ * because they are the same domain: each is a `value` + `onChange` component
9
+ * from a shared UI library with no async port, so the entire host-side cost
10
+ * is "register some keys and map them". A tab that needs real backend work
11
+ * (routes, a port) should keep its own module rather than accreting into
12
+ * this one.
13
+ *
14
+ * All three read and write through the generic settings ledger routes a host
15
+ * exposes, gated by the ledger's own scope-derived `settings.workspace.write`
16
+ * check. There is no bespoke get/set service and no per-tab permission — the
17
+ * reason the shared `ensureSettingDefinitions` helper exists.
18
+ */
19
+ /** Custom instructions applied to every admin-assistant conversation. */
20
+ export const INSTRUCTIONS_NAMESPACE = "core.instructions";
21
+ /** Completion-sound and desktop-notification preferences. */
22
+ export const NOTIFICATIONS_NAMESPACE = "core.notifications";
23
+ /** Telemetry consent state. */
24
+ export const PRIVACY_NAMESPACE = "core.privacy";
25
+ /** Theme choice and accent color for the settings-dialog surface. */
26
+ export const APPEARANCE_NAMESPACE = "core.appearance";
27
+ /** Admin UI locale. */
28
+ export const LANGUAGE_NAMESPACE = "core.language";
29
+ /**
30
+ * "No consent decision recorded yet", which a host's UI layer may spell as
31
+ * `privacyDecisionAt: null`.
32
+ *
33
+ * A literal `null` default is not registrable (see `SettingDefinitionSpec.
34
+ * defaultValue` — non-secret definitions reject a null default outright), so
35
+ * this needs a sentinel. `0` is safe rather than merely convenient: the field
36
+ * is epoch milliseconds, and 0 is 1970-01-01, which cannot be a real decision
37
+ * timestamp for software that did not exist then. The tab uses this exact
38
+ * distinction — an unset value renders the first-run consent prompt, a set one
39
+ * renders the "decided" state — so collapsing the two would silently re-prompt
40
+ * an operator who has already chosen.
41
+ */
42
+ const NO_DECISION_SENTINEL = 0;
43
+ /**
44
+ * "No installation id", which a host's UI layer may spell as
45
+ * `installationId: null` (its meaning: telemetry sharing is fully declined).
46
+ * `""` is not a legal id — the tab generates opaque non-empty strings — so it
47
+ * cannot collide with a real one.
48
+ */
49
+ const NO_INSTALLATION_ID_SENTINEL = "";
50
+ const INSTRUCTIONS_DEFINITIONS = [
51
+ // A host's `InstructionsTab` may collapse an all-empty textarea to `undefined` rather than `''`
52
+ // (its `onChange` contract), so the adapter maps that back to this empty-string default instead
53
+ // of storing a distinguishable "explicitly emptied" state the tab cannot itself produce.
54
+ { key: "custom", schema: { type: "string" }, defaultValue: "" },
55
+ ];
56
+ /**
57
+ * Notification preferences are the one genuinely PER-OPERATOR surface in this
58
+ * set, so they register `SCOPE_BIT.user` alongside `workspace` and the adapter
59
+ * writes at user scope. Two admins sharing a workspace should not fight over
60
+ * whether a completion sound plays on the other's machine — unlike a tab
61
+ * whose backing resource is genuinely shared workspace state.
62
+ *
63
+ * The `workspace` bit stays in the mask so an operator with no user-scoped row
64
+ * still inherits a workspace-level default rather than falling all the way
65
+ * back to the registered one.
66
+ */
67
+ const NOTIFICATIONS_SCOPES = SCOPE_BIT.user | SCOPE_BIT.workspace;
68
+ const NOTIFICATIONS_DEFINITIONS = [
69
+ { key: "soundEnabled", schema: { type: "boolean" }, defaultValue: false, scopes: NOTIFICATIONS_SCOPES },
70
+ // Free-form strings rather than an enum: sound ids are plain strings upstream and the catalog is
71
+ // owned by a host's UI library. Pinning an enum here would make a package-side catalog addition
72
+ // fail validation on an already-registered definition, which is a worse failure than accepting an
73
+ // id the catalog no longer lists (the tab falls back to its own default for an unknown id).
74
+ { key: "successSoundId", schema: { type: "string" }, defaultValue: "ding", scopes: NOTIFICATIONS_SCOPES },
75
+ { key: "failureSoundId", schema: { type: "string" }, defaultValue: "buzz", scopes: NOTIFICATIONS_SCOPES },
76
+ // Desktop notifications also need the BROWSER's Notification permission,
77
+ // which is per-browser and not ours to store. This flag is only the
78
+ // operator's intent; the tab reconciles it against the live permission.
79
+ { key: "desktopEnabled", schema: { type: "boolean" }, defaultValue: false, scopes: NOTIFICATIONS_SCOPES },
80
+ ];
81
+ const PRIVACY_DEFINITIONS = [
82
+ // Both telemetry categories default OFF. A "consent state" type may type them optional, but
83
+ // "unset" is carried by `decisionAt` instead — an operator who has decided has a timestamp, and
84
+ // these two then mean exactly what they say.
85
+ { key: "telemetry.metrics", schema: { type: "boolean" }, defaultValue: false },
86
+ { key: "telemetry.content", schema: { type: "boolean" }, defaultValue: false },
87
+ { key: "installationId", schema: { type: "string" }, defaultValue: NO_INSTALLATION_ID_SENTINEL },
88
+ { key: "decisionAt", schema: { type: "number" }, defaultValue: NO_DECISION_SENTINEL },
89
+ ];
90
+ /**
91
+ * Appearance and Language are per-OPERATOR, same reasoning as Notifications:
92
+ * which theme one admin looks at, and which language they read, are not
93
+ * properties of the workspace. The `workspace` bit stays in the mask so an
94
+ * operator with no user-scoped row still inherits a workspace default.
95
+ */
96
+ const PER_OPERATOR_SCOPES = SCOPE_BIT.user | SCOPE_BIT.workspace;
97
+ const APPEARANCE_DEFINITIONS = [
98
+ // Defaults to LIGHT rather than "system" here — a host whose surrounding admin UI is
99
+ // light-only would put a dark panel inside a light app for every operator on a dark-mode
100
+ // machine if this defaulted to following the OS. "system" stays selectable; a host can
101
+ // override this default at its own registration call site if its UI has a real dark variant.
102
+ {
103
+ key: "theme",
104
+ schema: { type: "enum", values: ["system", "light", "dark"] },
105
+ defaultValue: "light",
106
+ scopes: PER_OPERATOR_SCOPES,
107
+ },
108
+ // Free-form string rather than an enum over a swatch palette: a host's UI may ship a color
109
+ // picker, so any `#rrggbb` is reachable, and its own accent-color normalizer already rejects
110
+ // malformed values at render time. Pinning an enum here would reject a legitimate custom color
111
+ // at the ledger.
112
+ {
113
+ key: "accentColor",
114
+ schema: { type: "string" },
115
+ defaultValue: "#2563eb",
116
+ scopes: PER_OPERATOR_SCOPES,
117
+ },
118
+ ];
119
+ const LANGUAGE_DEFINITIONS = [
120
+ // A BCP-47-ish code, not an enum. The catalog of real locales is a host's own i18n concern, not
121
+ // this library's; the tab takes a host-supplied `LocaleOption[]` and an unknown stored code
122
+ // simply selects nothing rather than failing a ledger write.
123
+ { key: "locale", schema: { type: "string" }, defaultValue: "en", scopes: PER_OPERATOR_SCOPES },
124
+ ];
125
+ /**
126
+ * Idempotently registers the Instructions, Notifications, and Privacy
127
+ * definitions. Safe to call on every boot.
128
+ *
129
+ * @complexity O(n) in the total number of definitions (9), each a
130
+ * skip-if-registered check plus at most one `registerDefinitions` call.
131
+ */
132
+ export async function ensureSettingsUiTabDefinitions(deps, input) {
133
+ const namespaces = [
134
+ { namespace: INSTRUCTIONS_NAMESPACE, definitions: INSTRUCTIONS_DEFINITIONS },
135
+ { namespace: NOTIFICATIONS_NAMESPACE, definitions: NOTIFICATIONS_DEFINITIONS },
136
+ { namespace: PRIVACY_NAMESPACE, definitions: PRIVACY_DEFINITIONS },
137
+ { namespace: APPEARANCE_NAMESPACE, definitions: APPEARANCE_DEFINITIONS },
138
+ { namespace: LANGUAGE_NAMESPACE, definitions: LANGUAGE_DEFINITIONS },
139
+ ];
140
+ for (const { namespace, definitions } of namespaces) {
141
+ await ensureSettingDefinitions(deps, {
142
+ namespace,
143
+ definitions,
144
+ systemPrincipalId: input.systemPrincipalId,
145
+ });
146
+ }
147
+ }
148
+ //# sourceMappingURL=ui-tab-definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-tab-definitions.js","sourceRoot":"","sources":["../../src/settings/ui-tab-definitions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,GAGzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;;;;;;;;;GAeG;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,6DAA6D;AAC7D,MAAM,CAAC,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAE5D,+BAA+B;AAC/B,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAEhD,qEAAqE;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAEtD,uBAAuB;AACvB,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,oBAAoB,GAAG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,EAClC,KAA0C;IAE1C,MAAM,UAAU,GAAG;QACjB,EAAE,SAAS,EAAE,sBAAsB,EAAE,WAAW,EAAE,wBAAwB,EAAE;QAC5E,EAAE,SAAS,EAAE,uBAAuB,EAAE,WAAW,EAAE,yBAAyB,EAAE;QAC9E,EAAE,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,mBAAmB,EAAE;QAClE,EAAE,SAAS,EAAE,oBAAoB,EAAE,WAAW,EAAE,sBAAsB,EAAE;QACxE,EAAE,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,oBAAoB,EAAE;KACrE,CAAC;IAEF,KAAK,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,UAAU,EAAE,CAAC;QACpD,MAAM,wBAAwB,CAAC,IAAI,EAAE;YACnC,SAAS;YACT,WAAW;YACX,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;SAC3C,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -0,0 +1,314 @@
1
+ import type { ClockPort, IdGeneratorPort, JsonValue, UUID } from "../core/ports.js";
2
+ import type { PrincipalRepoPort } from "../identity/index.js";
3
+ import type { SettingsRepoPort } from "./ports.js";
4
+ import { type DefinitionInput } from "./settings.js";
5
+ import { type SettingScope, type SettingValueSchema } from "./types.js";
6
+ /**
7
+ * @file `SettingsWriteService` — the single write chokepoint (REQ-04).
8
+ *
9
+ * Purpose:
10
+ * The ONLY value/definition-mutation path. Repo write methods
11
+ * (`saveDefinition`/`save*Value`/`appendRevision`/`delete*Value`) must never
12
+ * be called from outside this file (Code Review enforces this as a file-
13
+ * boundary check).
14
+ *
15
+ * Every export here: `authorize()` first (fail-closed, INV-07) -> validate ->
16
+ * write value/definition row + revision in one transaction (INV-01).
17
+ *
18
+ * `deriveRequiredPermission` is the sole source of truth for the self-vs-
19
+ * other permission rule (behavior.spec.md §1.3) — closes Red-Team RT-003.
20
+ * REQ-13's target-principal check reuses `identity.PrincipalRepoPort`
21
+ * directly — no new port (closes RT-001/RT-002 at the implementation level).
22
+ */
23
+ /** Matches `core/commands/command.ts`'s `AuthorizeFn` shape structurally — no import, kept decoupled. */
24
+ export type AuthorizeFn = (params: {
25
+ principalId: UUID;
26
+ permission: string;
27
+ workspaceId: UUID;
28
+ entityType?: string;
29
+ entityId?: UUID;
30
+ }) => Promise<{
31
+ allowed: boolean;
32
+ reason: string;
33
+ }>;
34
+ export interface SettingsWriteServiceDeps {
35
+ repo: SettingsRepoPort;
36
+ clock: ClockPort;
37
+ ids: IdGeneratorPort;
38
+ authorize: AuthorizeFn;
39
+ /** REQ-13 — reused directly from `identity`, not duplicated. */
40
+ principals: PrincipalRepoPort;
41
+ }
42
+ /**
43
+ * behavior.spec.md §1.3 / REQ-06 `[internal-invariant]` — the self-vs-other
44
+ * permission derivation. `targetPrincipalId` omitted or equal to the caller
45
+ * -> `settings.user.self.write`; any other principal -> `settings.user.write`.
46
+ * A divergence between this function and any other implementation of the
47
+ * rule is a fail-open authorization bug (Red-Team RT-003) — this is the only
48
+ * place the rule may be encoded.
49
+ *
50
+ * @complexity O(1), pure.
51
+ * @overallScore 100
52
+ */
53
+ export declare function deriveRequiredPermission(input: {
54
+ scope: SettingScope;
55
+ targetPrincipalId?: UUID | undefined;
56
+ callerPrincipalId: UUID;
57
+ }): string;
58
+ export interface RegisterDefinitionsRequired {
59
+ deps: SettingsWriteServiceDeps;
60
+ input: {
61
+ definitions: DefinitionInput[];
62
+ callerPrincipalId: UUID;
63
+ /** The workspace the caller is authorizing in (always required — even platform-def registration is authorized within a workspace context). */
64
+ authWorkspaceId: UUID;
65
+ };
66
+ }
67
+ /** REQ-02/REQ-09 chokepoint write: authorize `settings.definitions.manage` -> validate -> write + revision, one per definition, each its own tx. */
68
+ export declare function registerDefinitions(required: RegisterDefinitionsRequired): Promise<{
69
+ registered: string[];
70
+ }>;
71
+ export interface SetValueRequired {
72
+ deps: SettingsWriteServiceDeps;
73
+ input: {
74
+ namespace: string;
75
+ key: string;
76
+ scope: SettingScope;
77
+ value: JsonValue;
78
+ workspaceId?: UUID | undefined;
79
+ principalId?: UUID | undefined;
80
+ callerPrincipalId: UUID;
81
+ /**
82
+ * The ambient workspace to authorize the caller's grant in. Optional and
83
+ * additive: when omitted, falls back to `input.workspaceId ??
84
+ * input.callerPrincipalId`. Callers that DO have a real ambient workspace
85
+ * (every HTTP route in a single-workspace host) should pass it
86
+ * explicitly: for `scope=global` (no `workspaceId`), falling back to
87
+ * `callerPrincipalId` as a stand-in "workspace" id is nonsensical against
88
+ * the real `authorize()` (identity's own authorize looks the principal up
89
+ * by `{workspaceId, id}` — a bogus workspaceId means `findById` returns
90
+ * null and every request is denied `principal_disabled`, including the
91
+ * wildcard-owner).
92
+ */
93
+ authWorkspaceId?: UUID | undefined;
94
+ /**
95
+ * `deriveRequiredPermission` unconditionally derives `settings.workspace.write` for
96
+ * `scope: "workspace"` — a caller that already authorized a narrower, domain-specific
97
+ * permission at its own route layer (e.g. a comments module's `comments.configure`, an SEO
98
+ * module's `admin.seo.manage`) still hits this chokepoint's generic `settings.workspace.write`
99
+ * check and gets a masked 500 if it lacks that broader grant, even though its own domain
100
+ * permission is exactly what the feature's admin UI advertises as sufficient. Optional and
101
+ * additive: omitted, behavior is unchanged (every pre-existing caller still gets the
102
+ * scope-derived permission). When a domain-settings module supplies this, the chokepoint
103
+ * authorizes THIS permission instead of the scope-derived one — still a mandatory
104
+ * `authorize()` call before any write (INV-07 fail-closed discipline is not relaxed, only
105
+ * which permission string is checked).
106
+ */
107
+ requiredPermissionOverride?: string | undefined;
108
+ };
109
+ }
110
+ /** REQ-04/REQ-13 chokepoint write: authorize -> validate -> value + revision, same tx. */
111
+ export declare function set(required: SetValueRequired): Promise<{
112
+ value: JsonValue;
113
+ revisionSeq: number;
114
+ }>;
115
+ export interface ClearValueRequired {
116
+ deps: SettingsWriteServiceDeps;
117
+ input: {
118
+ namespace: string;
119
+ key: string;
120
+ scope: SettingScope;
121
+ workspaceId?: UUID | undefined;
122
+ principalId?: UUID | undefined;
123
+ callerPrincipalId: UUID;
124
+ /** Set by `resetNamespace` when looping `clear()` in its own reset-authorized context (R3-01) — bypasses the inner authorize() re-check, still writes a normal revision. */
125
+ skipAuthorize?: boolean | undefined;
126
+ /** Set by a caller that has ALREADY opened a transaction around this write —
127
+ * see `resetNamespace`. Explicit rather than an ambient depth counter,
128
+ * because an ambient one cannot tell a genuine nesting from a concurrent
129
+ * unrelated transaction and silently merges the two. */
130
+ skipTransaction?: boolean | undefined;
131
+ /** See `SetValueRequired.input.authWorkspaceId`'s doc. Optional/additive. */
132
+ authWorkspaceId?: UUID | undefined;
133
+ };
134
+ }
135
+ /** REQ-04/REQ-13 chokepoint write: authorize -> value + revision (state='cleared'), same tx. */
136
+ export declare function clear(required: ClearValueRequired): Promise<{
137
+ revisionSeq: number;
138
+ }>;
139
+ export interface ResetNamespaceRequired {
140
+ deps: SettingsWriteServiceDeps;
141
+ input: {
142
+ namespace: string;
143
+ scope: Exclude<SettingScope, never>;
144
+ workspaceId?: UUID | undefined;
145
+ principalId?: UUID | undefined;
146
+ callerPrincipalId: UUID;
147
+ /** See `SetValueRequired.input.authWorkspaceId`'s doc. Optional/additive. */
148
+ authWorkspaceId?: UUID | undefined;
149
+ };
150
+ }
151
+ /**
152
+ * EC-09/R3-01 — an explicit, human-invoked orchestrator: authorize
153
+ * the matching `settings.reset.*` permission once, then loop `clear()` for
154
+ * every setting in the namespace in the reset-authorized internal context
155
+ * (`skipAuthorize: true`) — the outer reset permission is sufficient on its
156
+ * own; each inner clear still emits its own `op='clear'` revision.
157
+ *
158
+ * `revisionSeqs` collects each inner `clear()` call's own `revisionSeq` so a
159
+ * host's admin HTTP route can surface the full contract without a second
160
+ * read. Existing callers that only read `.clearedCount` are unaffected.
161
+ */
162
+ export declare function resetNamespace(required: ResetNamespaceRequired, keysInNamespace: string[]): Promise<{
163
+ clearedCount: number;
164
+ revisionSeqs: number[];
165
+ }>;
166
+ export interface RenameDefinitionRequired {
167
+ deps: SettingsWriteServiceDeps;
168
+ input: {
169
+ namespace: string;
170
+ key: string;
171
+ workspaceId: UUID | null;
172
+ newNamespace: string;
173
+ newKey: string;
174
+ callerPrincipalId: UUID;
175
+ /** The workspace the caller is authorizing in (see `registerDefinitions`' identical field). */
176
+ authWorkspaceId: UUID;
177
+ };
178
+ }
179
+ /**
180
+ * The rename mechanism (AC-09, EC-06): a same-tx pair —
181
+ * (1) UPDATE the active definition row's `(namespace,key)` to the new name,
182
+ * same `setting_id`/`version` (ledgered `op='alias'`); (2) INSERT a fresh v1
183
+ * alias marker at the OLD name pointing at the new name. Because identity
184
+ * never moves, value rows (keyed on `setting_id` only) stay attached.
185
+ *
186
+ * Sequential rename (A->B then B->C) retargets every prior marker pointing
187
+ * at the OLD name to the NEW name in the same tx. A rename target that
188
+ * itself resolves to an existing alias is rejected `ALIAS_DEPTH_EXCEEDED`
189
+ * (behavior.spec.md §7: "the rename target resolves to an alias").
190
+ *
191
+ * Never touches `schema`/`defaultValue`/`scopes` -- a pure rename can never
192
+ * trigger `RENAME_RETYPE_CONFLICT` by construction; that guard lives in
193
+ * `retypeDefinition` ("no rename+retype in one op").
194
+ */
195
+ export declare function renameDefinition(required: RenameDefinitionRequired): Promise<{
196
+ settingId: string;
197
+ markerSettingId: string;
198
+ }>;
199
+ export interface RetypeDefinitionRequired {
200
+ deps: SettingsWriteServiceDeps;
201
+ input: {
202
+ namespace: string;
203
+ key: string;
204
+ workspaceId: UUID | null;
205
+ schema: SettingValueSchema;
206
+ defaultValue: JsonValue | null;
207
+ /** A total coercer id/tag (EC-08 registry in `settings.ts`) for reading values recorded under any prior version. */
208
+ coercionTag: string;
209
+ /**
210
+ * Present only to detect a combined rename+retype request;
211
+ * retype never actually moves `(namespace,key)` -- if provided and it
212
+ * differs from the current name while `schema` also differs, the whole
213
+ * op is rejected `RENAME_RETYPE_CONFLICT` rather than silently doing
214
+ * only the schema half.
215
+ */
216
+ newNamespace?: string | undefined;
217
+ newKey?: string | undefined;
218
+ callerPrincipalId: UUID;
219
+ authWorkspaceId: UUID;
220
+ };
221
+ }
222
+ /**
223
+ * The retype mechanism (AC-10, EC-05): a same-tx pair --
224
+ * (1) UPDATE the prior active version's `status` to `deprecated` FIRST (else
225
+ * the insert in step 2 collides with the one-active-row-per-slot
226
+ * invariant); (2) INSERT the new `version+1` row as `active`, same
227
+ * `setting_id`/`namespace`/`key`. Rejected unless every prior version
228
+ * (2..N) already carries a total coercer -- `coercionTag` is `null` only for
229
+ * version 1 by construction (`types.ts`), so this walks 2..N and requires
230
+ * each to be non-null.
231
+ */
232
+ export declare function retypeDefinition(required: RetypeDefinitionRequired): Promise<{
233
+ settingId: string;
234
+ version: number;
235
+ }>;
236
+ export interface ReconcileDefinitionDefaultRequired {
237
+ deps: SettingsWriteServiceDeps;
238
+ input: {
239
+ namespace: string;
240
+ key: string;
241
+ workspaceId: UUID | null;
242
+ /** The default the SOURCE declares. Wins over a differing stored default. */
243
+ defaultValue: JsonValue;
244
+ callerPrincipalId: UUID;
245
+ authWorkspaceId: UUID;
246
+ };
247
+ }
248
+ /**
249
+ * Reconciles a stored `default_json` that has drifted from the default its
250
+ * source declares. Idempotent and a no-op when they already agree.
251
+ *
252
+ * Why this exists — the bug it closes:
253
+ * `ensure-definitions.ts` registers each definition once and then skips it
254
+ * forever (`if (existing) continue;`). That makes a changed `defaultValue` in
255
+ * SOURCE unreachable in any install that has already booted, for every
256
+ * settings-dialog tab a host registers this way. It can surface as a stored
257
+ * default staying "system" in the database while source says "light",
258
+ * rendering a settings panel with the wrong initial state — a visibly wrong
259
+ * value produced by entirely correct-looking source. The next occurrence
260
+ * could be a silently wrong default with no visual tell at all.
261
+ *
262
+ * Why `core`-only:
263
+ * `ownerKind` already encodes who owns a definition. `core` definitions
264
+ * configure a platform capability and are code-owned, so code is the authority
265
+ * on their default and may overwrite a drifted stored one. `site` and `theme`
266
+ * definitions are operator-owned — silently overwriting those would destroy a
267
+ * deliberate choice, so they are rejected rather than reconciled.
268
+ *
269
+ * Why this is NOT a `retype`:
270
+ * `retype` deprecates the active row and inserts `version+1` because a changed
271
+ * SCHEMA means every stored value needs a total coercer. A changed DEFAULT
272
+ * needs none — the schema is untouched, so every stored value stays valid and
273
+ * only the resolution of UNSET values moves. The row is therefore updated in
274
+ * place at the same version, and the paired revision carries the old and new
275
+ * default in `beforeJson`/`afterJson` so the change is auditable.
276
+ *
277
+ * @complexity O(1) — one definition lookup plus at most one row update and one
278
+ * revision append, in a single transaction.
279
+ */
280
+ export declare function reconcileDefinitionDefault(required: ReconcileDefinitionDefaultRequired): Promise<{
281
+ settingId: string;
282
+ changed: boolean;
283
+ }>;
284
+ export interface DeprecateDefinitionRequired {
285
+ deps: SettingsWriteServiceDeps;
286
+ input: {
287
+ namespace: string;
288
+ key: string;
289
+ workspaceId: UUID | null;
290
+ callerPrincipalId: UUID;
291
+ authWorkspaceId: UUID;
292
+ };
293
+ }
294
+ export interface TombstoneDefinitionRequired {
295
+ deps: SettingsWriteServiceDeps;
296
+ input: {
297
+ namespace: string;
298
+ key: string;
299
+ workspaceId: UUID | null;
300
+ callerPrincipalId: UUID;
301
+ authWorkspaceId: UUID;
302
+ };
303
+ }
304
+ /** Flips the active definition's status to `deprecated`, ledgered `op='deprecate'` -- same-tx, chokepoint-gated. */
305
+ export declare function deprecateDefinition(required: DeprecateDefinitionRequired): Promise<{
306
+ settingId: string;
307
+ version: number;
308
+ }>;
309
+ /** Flips the active definition's status to `tombstone` (kills a core key), ledgered `op='tombstone'` -- same-tx, chokepoint-gated. */
310
+ export declare function tombstoneDefinition(required: TombstoneDefinitionRequired): Promise<{
311
+ settingId: string;
312
+ version: number;
313
+ }>;
314
+ //# sourceMappingURL=write-service.d.ts.map