@eloxiv/contracts 0.0.0-stage → 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 (537) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -2
  3. package/dist/Agent.d.ts +792 -0
  4. package/dist/Agent.d.ts.map +1 -0
  5. package/dist/Agent.js +610 -0
  6. package/dist/Agent.js.map +1 -0
  7. package/dist/Analytics.d.ts +46 -0
  8. package/dist/Analytics.d.ts.map +1 -0
  9. package/dist/Analytics.js +89 -0
  10. package/dist/Analytics.js.map +1 -0
  11. package/dist/Approval.d.ts +70 -0
  12. package/dist/Approval.d.ts.map +1 -0
  13. package/dist/Approval.js +127 -0
  14. package/dist/Approval.js.map +1 -0
  15. package/dist/Catalog.d.ts +238 -0
  16. package/dist/Catalog.d.ts.map +1 -0
  17. package/dist/Catalog.js +169 -0
  18. package/dist/Catalog.js.map +1 -0
  19. package/dist/Checklist.d.ts +99 -0
  20. package/dist/Checklist.d.ts.map +1 -0
  21. package/dist/Checklist.js +105 -0
  22. package/dist/Checklist.js.map +1 -0
  23. package/dist/Data.d.ts +107 -0
  24. package/dist/Data.d.ts.map +1 -0
  25. package/dist/Data.js +93 -0
  26. package/dist/Data.js.map +1 -0
  27. package/dist/Devices.d.ts +857 -0
  28. package/dist/Devices.d.ts.map +1 -0
  29. package/dist/Devices.js +590 -0
  30. package/dist/Devices.js.map +1 -0
  31. package/dist/Durable.d.ts +406 -0
  32. package/dist/Durable.d.ts.map +1 -0
  33. package/dist/Durable.js +203 -0
  34. package/dist/Durable.js.map +1 -0
  35. package/dist/Errors.d.ts +95 -0
  36. package/dist/Errors.d.ts.map +1 -0
  37. package/dist/Errors.js +72 -0
  38. package/dist/Errors.js.map +1 -0
  39. package/dist/JsonSchema.d.ts +355 -0
  40. package/dist/JsonSchema.d.ts.map +1 -0
  41. package/dist/JsonSchema.js +151 -0
  42. package/dist/JsonSchema.js.map +1 -0
  43. package/dist/Manifest.d.ts +353 -0
  44. package/dist/Manifest.d.ts.map +1 -0
  45. package/dist/Manifest.js +894 -0
  46. package/dist/Manifest.js.map +1 -0
  47. package/dist/Module.d.ts +447 -0
  48. package/dist/Module.d.ts.map +1 -0
  49. package/dist/Module.js +221 -0
  50. package/dist/Module.js.map +1 -0
  51. package/dist/Optimistic.d.ts +192 -0
  52. package/dist/Optimistic.d.ts.map +1 -0
  53. package/dist/Optimistic.js +319 -0
  54. package/dist/Optimistic.js.map +1 -0
  55. package/dist/Projection.d.ts +163 -0
  56. package/dist/Projection.d.ts.map +1 -0
  57. package/dist/Projection.js +158 -0
  58. package/dist/Projection.js.map +1 -0
  59. package/dist/Proposals.d.ts +103 -0
  60. package/dist/Proposals.d.ts.map +1 -0
  61. package/dist/Proposals.js +72 -0
  62. package/dist/Proposals.js.map +1 -0
  63. package/dist/Receipt.d.ts +243 -0
  64. package/dist/Receipt.d.ts.map +1 -0
  65. package/dist/Receipt.js +108 -0
  66. package/dist/Receipt.js.map +1 -0
  67. package/dist/Records.d.ts +297 -0
  68. package/dist/Records.d.ts.map +1 -0
  69. package/dist/Records.js +171 -0
  70. package/dist/Records.js.map +1 -0
  71. package/dist/Render.d.ts +207 -0
  72. package/dist/Render.d.ts.map +1 -0
  73. package/dist/Render.js +502 -0
  74. package/dist/Render.js.map +1 -0
  75. package/dist/Rpc.d.ts +115 -0
  76. package/dist/Rpc.d.ts.map +1 -0
  77. package/dist/Rpc.js +68 -0
  78. package/dist/Rpc.js.map +1 -0
  79. package/dist/SearchLanguages.d.ts +4 -0
  80. package/dist/SearchLanguages.d.ts.map +1 -0
  81. package/dist/SearchLanguages.js +33 -0
  82. package/dist/SearchLanguages.js.map +1 -0
  83. package/dist/Service.d.ts +59 -0
  84. package/dist/Service.d.ts.map +1 -0
  85. package/dist/Service.js +38 -0
  86. package/dist/Service.js.map +1 -0
  87. package/dist/Versions.d.ts +9 -0
  88. package/dist/Versions.d.ts.map +1 -0
  89. package/dist/Versions.js +78 -0
  90. package/dist/Versions.js.map +1 -0
  91. package/dist/contracts/ActionConsent.d.ts +189 -0
  92. package/dist/contracts/ActionConsent.d.ts.map +1 -0
  93. package/dist/contracts/ActionConsent.js +129 -0
  94. package/dist/contracts/ActionConsent.js.map +1 -0
  95. package/dist/contracts/ActionRegistry.d.ts +149 -0
  96. package/dist/contracts/ActionRegistry.d.ts.map +1 -0
  97. package/dist/contracts/ActionRegistry.js +37 -0
  98. package/dist/contracts/ActionRegistry.js.map +1 -0
  99. package/dist/contracts/Actor.d.ts +129 -0
  100. package/dist/contracts/Actor.d.ts.map +1 -0
  101. package/dist/contracts/Actor.js +47 -0
  102. package/dist/contracts/Actor.js.map +1 -0
  103. package/dist/contracts/AgentResources.d.ts +248 -0
  104. package/dist/contracts/AgentResources.d.ts.map +1 -0
  105. package/dist/contracts/AgentResources.js +158 -0
  106. package/dist/contracts/AgentResources.js.map +1 -0
  107. package/dist/contracts/AgentRuntime.d.ts +453 -0
  108. package/dist/contracts/AgentRuntime.d.ts.map +1 -0
  109. package/dist/contracts/AgentRuntime.js +117 -0
  110. package/dist/contracts/AgentRuntime.js.map +1 -0
  111. package/dist/contracts/Approvals.d.ts +303 -0
  112. package/dist/contracts/Approvals.d.ts.map +1 -0
  113. package/dist/contracts/Approvals.js +117 -0
  114. package/dist/contracts/Approvals.js.map +1 -0
  115. package/dist/contracts/Audit.d.ts +510 -0
  116. package/dist/contracts/Audit.d.ts.map +1 -0
  117. package/dist/contracts/Audit.js +139 -0
  118. package/dist/contracts/Audit.js.map +1 -0
  119. package/dist/contracts/CalendarProvider.d.ts +572 -0
  120. package/dist/contracts/CalendarProvider.d.ts.map +1 -0
  121. package/dist/contracts/CalendarProvider.js +203 -0
  122. package/dist/contracts/CalendarProvider.js.map +1 -0
  123. package/dist/contracts/Capability.d.ts +197 -0
  124. package/dist/contracts/Capability.d.ts.map +1 -0
  125. package/dist/contracts/Capability.js +189 -0
  126. package/dist/contracts/Capability.js.map +1 -0
  127. package/dist/contracts/ClientSDK.d.ts +250 -0
  128. package/dist/contracts/ClientSDK.d.ts.map +1 -0
  129. package/dist/contracts/ClientSDK.js +184 -0
  130. package/dist/contracts/ClientSDK.js.map +1 -0
  131. package/dist/contracts/CollabDocument.d.ts +781 -0
  132. package/dist/contracts/CollabDocument.d.ts.map +1 -0
  133. package/dist/contracts/CollabDocument.js +364 -0
  134. package/dist/contracts/CollabDocument.js.map +1 -0
  135. package/dist/contracts/Command.d.ts +183 -0
  136. package/dist/contracts/Command.d.ts.map +1 -0
  137. package/dist/contracts/Command.js +66 -0
  138. package/dist/contracts/Command.js.map +1 -0
  139. package/dist/contracts/Connections.d.ts +612 -0
  140. package/dist/contracts/Connections.d.ts.map +1 -0
  141. package/dist/contracts/Connections.js +323 -0
  142. package/dist/contracts/Connections.js.map +1 -0
  143. package/dist/contracts/ContextAccounting.d.ts +79 -0
  144. package/dist/contracts/ContextAccounting.d.ts.map +1 -0
  145. package/dist/contracts/ContextAccounting.js +32 -0
  146. package/dist/contracts/ContextAccounting.js.map +1 -0
  147. package/dist/contracts/Daemon.d.ts +486 -0
  148. package/dist/contracts/Daemon.d.ts.map +1 -0
  149. package/dist/contracts/Daemon.js +192 -0
  150. package/dist/contracts/Daemon.js.map +1 -0
  151. package/dist/contracts/DbTx.d.ts +149 -0
  152. package/dist/contracts/DbTx.d.ts.map +1 -0
  153. package/dist/contracts/DbTx.js +94 -0
  154. package/dist/contracts/DbTx.js.map +1 -0
  155. package/dist/contracts/Delegation.d.ts +121 -0
  156. package/dist/contracts/Delegation.d.ts.map +1 -0
  157. package/dist/contracts/Delegation.js +76 -0
  158. package/dist/contracts/Delegation.js.map +1 -0
  159. package/dist/contracts/DeviceControl.d.ts +293 -0
  160. package/dist/contracts/DeviceControl.d.ts.map +1 -0
  161. package/dist/contracts/DeviceControl.js +107 -0
  162. package/dist/contracts/DeviceControl.js.map +1 -0
  163. package/dist/contracts/Directory.d.ts +492 -0
  164. package/dist/contracts/Directory.d.ts.map +1 -0
  165. package/dist/contracts/Directory.js +225 -0
  166. package/dist/contracts/Directory.js.map +1 -0
  167. package/dist/contracts/DirectoryProvider.d.ts +214 -0
  168. package/dist/contracts/DirectoryProvider.d.ts.map +1 -0
  169. package/dist/contracts/DirectoryProvider.js +73 -0
  170. package/dist/contracts/DirectoryProvider.js.map +1 -0
  171. package/dist/contracts/DocumentSource.d.ts +190 -0
  172. package/dist/contracts/DocumentSource.d.ts.map +1 -0
  173. package/dist/contracts/DocumentSource.js +64 -0
  174. package/dist/contracts/DocumentSource.js.map +1 -0
  175. package/dist/contracts/Files.d.ts +762 -0
  176. package/dist/contracts/Files.d.ts.map +1 -0
  177. package/dist/contracts/Files.js +339 -0
  178. package/dist/contracts/Files.js.map +1 -0
  179. package/dist/contracts/Flags.d.ts +265 -0
  180. package/dist/contracts/Flags.d.ts.map +1 -0
  181. package/dist/contracts/Flags.js +197 -0
  182. package/dist/contracts/Flags.js.map +1 -0
  183. package/dist/contracts/Host.d.ts +320 -0
  184. package/dist/contracts/Host.d.ts.map +1 -0
  185. package/dist/contracts/Host.js +224 -0
  186. package/dist/contracts/Host.js.map +1 -0
  187. package/dist/contracts/HttpApi.d.ts +102 -0
  188. package/dist/contracts/HttpApi.d.ts.map +1 -0
  189. package/dist/contracts/HttpApi.js +89 -0
  190. package/dist/contracts/HttpApi.js.map +1 -0
  191. package/dist/contracts/Ingestion.d.ts +522 -0
  192. package/dist/contracts/Ingestion.d.ts.map +1 -0
  193. package/dist/contracts/Ingestion.js +275 -0
  194. package/dist/contracts/Ingestion.js.map +1 -0
  195. package/dist/contracts/Ingress.d.ts +132 -0
  196. package/dist/contracts/Ingress.d.ts.map +1 -0
  197. package/dist/contracts/Ingress.js +102 -0
  198. package/dist/contracts/Ingress.js.map +1 -0
  199. package/dist/contracts/Invocation.d.ts +361 -0
  200. package/dist/contracts/Invocation.d.ts.map +1 -0
  201. package/dist/contracts/Invocation.js +104 -0
  202. package/dist/contracts/Invocation.js.map +1 -0
  203. package/dist/contracts/LocalClient.d.ts +878 -0
  204. package/dist/contracts/LocalClient.d.ts.map +1 -0
  205. package/dist/contracts/LocalClient.js +423 -0
  206. package/dist/contracts/LocalClient.js.map +1 -0
  207. package/dist/contracts/Locale.d.ts +162 -0
  208. package/dist/contracts/Locale.d.ts.map +1 -0
  209. package/dist/contracts/Locale.js +123 -0
  210. package/dist/contracts/Locale.js.map +1 -0
  211. package/dist/contracts/MachineIdentity.d.ts +434 -0
  212. package/dist/contracts/MachineIdentity.d.ts.map +1 -0
  213. package/dist/contracts/MachineIdentity.js +223 -0
  214. package/dist/contracts/MachineIdentity.js.map +1 -0
  215. package/dist/contracts/MailProvider.d.ts +791 -0
  216. package/dist/contracts/MailProvider.d.ts.map +1 -0
  217. package/dist/contracts/MailProvider.js +237 -0
  218. package/dist/contracts/MailProvider.js.map +1 -0
  219. package/dist/contracts/Memory.d.ts +62 -0
  220. package/dist/contracts/Memory.d.ts.map +1 -0
  221. package/dist/contracts/Memory.js +43 -0
  222. package/dist/contracts/Memory.js.map +1 -0
  223. package/dist/contracts/Messaging.d.ts +154 -0
  224. package/dist/contracts/Messaging.d.ts.map +1 -0
  225. package/dist/contracts/Messaging.js +97 -0
  226. package/dist/contracts/Messaging.js.map +1 -0
  227. package/dist/contracts/Metering.d.ts +334 -0
  228. package/dist/contracts/Metering.d.ts.map +1 -0
  229. package/dist/contracts/Metering.js +202 -0
  230. package/dist/contracts/Metering.js.map +1 -0
  231. package/dist/contracts/ModelProvider.d.ts +142 -0
  232. package/dist/contracts/ModelProvider.d.ts.map +1 -0
  233. package/dist/contracts/ModelProvider.js +72 -0
  234. package/dist/contracts/ModelProvider.js.map +1 -0
  235. package/dist/contracts/ModuleManifest.d.ts +2519 -0
  236. package/dist/contracts/ModuleManifest.d.ts.map +1 -0
  237. package/dist/contracts/ModuleManifest.js +272 -0
  238. package/dist/contracts/ModuleManifest.js.map +1 -0
  239. package/dist/contracts/NotificationChannel.d.ts +378 -0
  240. package/dist/contracts/NotificationChannel.d.ts.map +1 -0
  241. package/dist/contracts/NotificationChannel.js +136 -0
  242. package/dist/contracts/NotificationChannel.js.map +1 -0
  243. package/dist/contracts/Notifications.d.ts +417 -0
  244. package/dist/contracts/Notifications.d.ts.map +1 -0
  245. package/dist/contracts/Notifications.js +267 -0
  246. package/dist/contracts/Notifications.js.map +1 -0
  247. package/dist/contracts/Outbox.d.ts +469 -0
  248. package/dist/contracts/Outbox.d.ts.map +1 -0
  249. package/dist/contracts/Outbox.js +215 -0
  250. package/dist/contracts/Outbox.js.map +1 -0
  251. package/dist/contracts/Privacy.d.ts +1029 -0
  252. package/dist/contracts/Privacy.d.ts.map +1 -0
  253. package/dist/contracts/Privacy.js +437 -0
  254. package/dist/contracts/Privacy.js.map +1 -0
  255. package/dist/contracts/Progress.d.ts +305 -0
  256. package/dist/contracts/Progress.d.ts.map +1 -0
  257. package/dist/contracts/Progress.js +174 -0
  258. package/dist/contracts/Progress.js.map +1 -0
  259. package/dist/contracts/QuerySurface.d.ts +231 -0
  260. package/dist/contracts/QuerySurface.d.ts.map +1 -0
  261. package/dist/contracts/QuerySurface.js +113 -0
  262. package/dist/contracts/QuerySurface.js.map +1 -0
  263. package/dist/contracts/Readiness.d.ts +105 -0
  264. package/dist/contracts/Readiness.d.ts.map +1 -0
  265. package/dist/contracts/Readiness.js +57 -0
  266. package/dist/contracts/Readiness.js.map +1 -0
  267. package/dist/contracts/Release.d.ts +295 -0
  268. package/dist/contracts/Release.d.ts.map +1 -0
  269. package/dist/contracts/Release.js +175 -0
  270. package/dist/contracts/Release.js.map +1 -0
  271. package/dist/contracts/ResultRendering.d.ts +533 -0
  272. package/dist/contracts/ResultRendering.d.ts.map +1 -0
  273. package/dist/contracts/ResultRendering.js +59 -0
  274. package/dist/contracts/ResultRendering.js.map +1 -0
  275. package/dist/contracts/Sandbox.d.ts +1164 -0
  276. package/dist/contracts/Sandbox.d.ts.map +1 -0
  277. package/dist/contracts/Sandbox.js +550 -0
  278. package/dist/contracts/Sandbox.js.map +1 -0
  279. package/dist/contracts/Scheduler.d.ts +814 -0
  280. package/dist/contracts/Scheduler.d.ts.map +1 -0
  281. package/dist/contracts/Scheduler.js +202 -0
  282. package/dist/contracts/Scheduler.js.map +1 -0
  283. package/dist/contracts/ScreenContext.d.ts +514 -0
  284. package/dist/contracts/ScreenContext.d.ts.map +1 -0
  285. package/dist/contracts/ScreenContext.js +272 -0
  286. package/dist/contracts/ScreenContext.js.map +1 -0
  287. package/dist/contracts/Search.d.ts +308 -0
  288. package/dist/contracts/Search.d.ts.map +1 -0
  289. package/dist/contracts/Search.js +107 -0
  290. package/dist/contracts/Search.js.map +1 -0
  291. package/dist/contracts/Secrets.d.ts +483 -0
  292. package/dist/contracts/Secrets.d.ts.map +1 -0
  293. package/dist/contracts/Secrets.js +136 -0
  294. package/dist/contracts/Secrets.js.map +1 -0
  295. package/dist/contracts/Settings.d.ts +221 -0
  296. package/dist/contracts/Settings.d.ts.map +1 -0
  297. package/dist/contracts/Settings.js +163 -0
  298. package/dist/contracts/Settings.js.map +1 -0
  299. package/dist/contracts/Sharing.d.ts +319 -0
  300. package/dist/contracts/Sharing.d.ts.map +1 -0
  301. package/dist/contracts/Sharing.js +172 -0
  302. package/dist/contracts/Sharing.js.map +1 -0
  303. package/dist/contracts/Slot.d.ts +162 -0
  304. package/dist/contracts/Slot.d.ts.map +1 -0
  305. package/dist/contracts/Slot.js +56 -0
  306. package/dist/contracts/Slot.js.map +1 -0
  307. package/dist/contracts/Space.d.ts +256 -0
  308. package/dist/contracts/Space.d.ts.map +1 -0
  309. package/dist/contracts/Space.js +133 -0
  310. package/dist/contracts/Space.js.map +1 -0
  311. package/dist/contracts/StorageAdapter.d.ts +124 -0
  312. package/dist/contracts/StorageAdapter.d.ts.map +1 -0
  313. package/dist/contracts/StorageAdapter.js +96 -0
  314. package/dist/contracts/StorageAdapter.js.map +1 -0
  315. package/dist/contracts/StorageBackend.d.ts +310 -0
  316. package/dist/contracts/StorageBackend.d.ts.map +1 -0
  317. package/dist/contracts/StorageBackend.js +196 -0
  318. package/dist/contracts/StorageBackend.js.map +1 -0
  319. package/dist/contracts/Sync.d.ts +286 -0
  320. package/dist/contracts/Sync.d.ts.map +1 -0
  321. package/dist/contracts/Sync.js +157 -0
  322. package/dist/contracts/Sync.js.map +1 -0
  323. package/dist/contracts/Telemetry.d.ts +183 -0
  324. package/dist/contracts/Telemetry.d.ts.map +1 -0
  325. package/dist/contracts/Telemetry.js +153 -0
  326. package/dist/contracts/Telemetry.js.map +1 -0
  327. package/dist/contracts/ThemeTokens.d.ts +212 -0
  328. package/dist/contracts/ThemeTokens.d.ts.map +1 -0
  329. package/dist/contracts/ThemeTokens.js +111 -0
  330. package/dist/contracts/ThemeTokens.js.map +1 -0
  331. package/dist/contracts/ToolSource.d.ts +135 -0
  332. package/dist/contracts/ToolSource.d.ts.map +1 -0
  333. package/dist/contracts/ToolSource.js +81 -0
  334. package/dist/contracts/ToolSource.js.map +1 -0
  335. package/dist/contracts/Versioning.d.ts +363 -0
  336. package/dist/contracts/Versioning.d.ts.map +1 -0
  337. package/dist/contracts/Versioning.js +201 -0
  338. package/dist/contracts/Versioning.js.map +1 -0
  339. package/dist/contracts/View.d.ts +232 -0
  340. package/dist/contracts/View.d.ts.map +1 -0
  341. package/dist/contracts/View.js +102 -0
  342. package/dist/contracts/View.js.map +1 -0
  343. package/dist/contracts/WorkItems.d.ts +242 -0
  344. package/dist/contracts/WorkItems.d.ts.map +1 -0
  345. package/dist/contracts/WorkItems.js +126 -0
  346. package/dist/contracts/WorkItems.js.map +1 -0
  347. package/dist/contracts/Workflow.d.ts +191 -0
  348. package/dist/contracts/Workflow.d.ts.map +1 -0
  349. package/dist/contracts/Workflow.js +63 -0
  350. package/dist/contracts/Workflow.js.map +1 -0
  351. package/dist/contracts/index.d.ts +75 -0
  352. package/dist/contracts/index.d.ts.map +1 -0
  353. package/dist/contracts/index.js +196 -0
  354. package/dist/contracts/index.js.map +1 -0
  355. package/dist/devices/module.d.ts +3777 -0
  356. package/dist/devices/module.d.ts.map +1 -0
  357. package/dist/devices/module.js +179 -0
  358. package/dist/devices/module.js.map +1 -0
  359. package/dist/drizzle/Entity.d.ts +148 -0
  360. package/dist/drizzle/Entity.d.ts.map +1 -0
  361. package/dist/drizzle/Entity.js +396 -0
  362. package/dist/drizzle/Entity.js.map +1 -0
  363. package/dist/index.d.ts +20 -0
  364. package/dist/index.d.ts.map +1 -0
  365. package/dist/index.js +20 -0
  366. package/dist/index.js.map +1 -0
  367. package/package.json +48 -3
  368. package/schema/Actor.json +46 -0
  369. package/schema/AuditRecord.json +403 -0
  370. package/schema/DaemonHealth.json +29 -0
  371. package/schema/InvocationError.json +257 -0
  372. package/schema/InvocationReceipt.json +253 -0
  373. package/schema/Lockfile.json +129 -0
  374. package/schema/OutboxEvent.json +36 -0
  375. package/schema/PairingConfirm.json +33 -0
  376. package/schema/PairingResult.json +18 -0
  377. package/schema/PairingStart.json +18 -0
  378. package/schema/ProvenanceEntry.json +110 -0
  379. package/schema/ReplayEnvelope.json +269 -0
  380. package/schema/Surface.json +17 -0
  381. package/schema/codegen/LocalClient.json +1295 -0
  382. package/schema/codegen/Sandbox.json +320 -0
  383. package/schema/contracts/ActionConsent.json +1930 -0
  384. package/schema/contracts/ActionRegistry.json +722 -0
  385. package/schema/contracts/Actor.json +451 -0
  386. package/schema/contracts/AgentResources.json +1400 -0
  387. package/schema/contracts/AgentRuntime.json +4017 -0
  388. package/schema/contracts/Approvals.json +2916 -0
  389. package/schema/contracts/Audit.json +3268 -0
  390. package/schema/contracts/CalendarProvider.json +5557 -0
  391. package/schema/contracts/ClientSDK.json +1400 -0
  392. package/schema/contracts/CollabDocument.json +4012 -0
  393. package/schema/contracts/Command.json +616 -0
  394. package/schema/contracts/Connections.json +6687 -0
  395. package/schema/contracts/ContextAccounting.json +685 -0
  396. package/schema/contracts/Daemon.json +4555 -0
  397. package/schema/contracts/DbTx.json +321 -0
  398. package/schema/contracts/Delegation.json +949 -0
  399. package/schema/contracts/DeviceControl.json +2626 -0
  400. package/schema/contracts/Directory.json +5168 -0
  401. package/schema/contracts/DirectoryProvider.json +2090 -0
  402. package/schema/contracts/DocumentSource.json +2044 -0
  403. package/schema/contracts/Files.json +4122 -0
  404. package/schema/contracts/Flags.json +1202 -0
  405. package/schema/contracts/Host.json +1769 -0
  406. package/schema/contracts/HttpApi.json +1615 -0
  407. package/schema/contracts/Ingestion.json +3211 -0
  408. package/schema/contracts/Ingress.json +819 -0
  409. package/schema/contracts/Invocation.json +2044 -0
  410. package/schema/contracts/LocalClient.json +6642 -0
  411. package/schema/contracts/Locale.json +654 -0
  412. package/schema/contracts/MachineIdentity.json +2303 -0
  413. package/schema/contracts/MailProvider.json +6663 -0
  414. package/schema/contracts/Memory.json +579 -0
  415. package/schema/contracts/Messaging.json +1764 -0
  416. package/schema/contracts/Metering.json +3060 -0
  417. package/schema/contracts/ModelProvider.json +1127 -0
  418. package/schema/contracts/ModuleManifest.json +9449 -0
  419. package/schema/contracts/NotificationChannel.json +986 -0
  420. package/schema/contracts/Notifications.json +4280 -0
  421. package/schema/contracts/Outbox.json +1451 -0
  422. package/schema/contracts/Privacy.json +4354 -0
  423. package/schema/contracts/Progress.json +1524 -0
  424. package/schema/contracts/QuerySurface.json +661 -0
  425. package/schema/contracts/Readiness.json +209 -0
  426. package/schema/contracts/Release.json +805 -0
  427. package/schema/contracts/ResultRendering.json +2859 -0
  428. package/schema/contracts/Sandbox.json +2286 -0
  429. package/schema/contracts/Scheduler.json +6138 -0
  430. package/schema/contracts/ScreenContext.json +1238 -0
  431. package/schema/contracts/Search.json +1058 -0
  432. package/schema/contracts/Secrets.json +2444 -0
  433. package/schema/contracts/Settings.json +654 -0
  434. package/schema/contracts/Sharing.json +2854 -0
  435. package/schema/contracts/Slot.json +537 -0
  436. package/schema/contracts/Space.json +892 -0
  437. package/schema/contracts/StorageAdapter.json +623 -0
  438. package/schema/contracts/StorageBackend.json +2421 -0
  439. package/schema/contracts/Sync.json +894 -0
  440. package/schema/contracts/Telemetry.json +696 -0
  441. package/schema/contracts/ThemeTokens.json +547 -0
  442. package/schema/contracts/ToolSource.json +1333 -0
  443. package/schema/contracts/Versioning.json +1481 -0
  444. package/schema/contracts/View.json +750 -0
  445. package/schema/contracts/WorkItems.json +1731 -0
  446. package/schema/contracts/Workflow.json +1242 -0
  447. package/src/Agent.ts +758 -0
  448. package/src/Analytics.ts +110 -0
  449. package/src/Approval.ts +131 -0
  450. package/src/Catalog.ts +192 -0
  451. package/src/Checklist.ts +162 -0
  452. package/src/Data.ts +109 -0
  453. package/src/Devices.ts +721 -0
  454. package/src/Durable.ts +240 -0
  455. package/src/Errors.ts +111 -0
  456. package/src/JsonSchema.ts +166 -0
  457. package/src/Manifest.ts +1147 -0
  458. package/src/Module.ts +640 -0
  459. package/src/Optimistic.ts +332 -0
  460. package/src/Projection.ts +207 -0
  461. package/src/Proposals.ts +89 -0
  462. package/src/Receipt.ts +125 -0
  463. package/src/Records.ts +197 -0
  464. package/src/Render.ts +515 -0
  465. package/src/Rpc.ts +113 -0
  466. package/src/SearchLanguages.ts +33 -0
  467. package/src/Service.ts +102 -0
  468. package/src/Versions.ts +69 -0
  469. package/src/contracts/ActionConsent.ts +150 -0
  470. package/src/contracts/ActionRegistry.ts +39 -0
  471. package/src/contracts/Actor.ts +53 -0
  472. package/src/contracts/AgentResources.ts +167 -0
  473. package/src/contracts/AgentRuntime.ts +154 -0
  474. package/src/contracts/Approvals.ts +133 -0
  475. package/src/contracts/Audit.ts +160 -0
  476. package/src/contracts/CalendarProvider.ts +241 -0
  477. package/src/contracts/Capability.ts +246 -0
  478. package/src/contracts/ClientSDK.ts +199 -0
  479. package/src/contracts/CollabDocument.ts +420 -0
  480. package/src/contracts/Command.ts +74 -0
  481. package/src/contracts/Connections.ts +360 -0
  482. package/src/contracts/ContextAccounting.ts +35 -0
  483. package/src/contracts/Daemon.ts +247 -0
  484. package/src/contracts/DbTx.ts +110 -0
  485. package/src/contracts/Delegation.ts +91 -0
  486. package/src/contracts/DeviceControl.ts +143 -0
  487. package/src/contracts/Directory.ts +384 -0
  488. package/src/contracts/DirectoryProvider.ts +82 -0
  489. package/src/contracts/DocumentSource.ts +71 -0
  490. package/src/contracts/Files.ts +395 -0
  491. package/src/contracts/Flags.ts +241 -0
  492. package/src/contracts/Host.ts +245 -0
  493. package/src/contracts/HttpApi.ts +100 -0
  494. package/src/contracts/Ingestion.ts +315 -0
  495. package/src/contracts/Ingress.ts +132 -0
  496. package/src/contracts/Invocation.ts +122 -0
  497. package/src/contracts/LocalClient.ts +614 -0
  498. package/src/contracts/Locale.ts +133 -0
  499. package/src/contracts/MachineIdentity.ts +305 -0
  500. package/src/contracts/MailProvider.ts +272 -0
  501. package/src/contracts/Memory.ts +47 -0
  502. package/src/contracts/Messaging.ts +108 -0
  503. package/src/contracts/Metering.ts +231 -0
  504. package/src/contracts/ModelProvider.ts +87 -0
  505. package/src/contracts/ModuleManifest.ts +310 -0
  506. package/src/contracts/NotificationChannel.ts +158 -0
  507. package/src/contracts/Notifications.ts +309 -0
  508. package/src/contracts/Outbox.ts +246 -0
  509. package/src/contracts/Privacy.ts +502 -0
  510. package/src/contracts/Progress.ts +196 -0
  511. package/src/contracts/QuerySurface.ts +134 -0
  512. package/src/contracts/Readiness.ts +67 -0
  513. package/src/contracts/Release.ts +199 -0
  514. package/src/contracts/ResultRendering.ts +65 -0
  515. package/src/contracts/Sandbox.ts +648 -0
  516. package/src/contracts/Scheduler.ts +237 -0
  517. package/src/contracts/ScreenContext.ts +316 -0
  518. package/src/contracts/Search.ts +126 -0
  519. package/src/contracts/Secrets.ts +162 -0
  520. package/src/contracts/Settings.ts +207 -0
  521. package/src/contracts/Sharing.ts +205 -0
  522. package/src/contracts/Slot.ts +61 -0
  523. package/src/contracts/Space.ts +157 -0
  524. package/src/contracts/StorageAdapter.ts +104 -0
  525. package/src/contracts/StorageBackend.ts +220 -0
  526. package/src/contracts/Sync.ts +180 -0
  527. package/src/contracts/Telemetry.ts +177 -0
  528. package/src/contracts/ThemeTokens.ts +136 -0
  529. package/src/contracts/ToolSource.ts +94 -0
  530. package/src/contracts/Versioning.ts +237 -0
  531. package/src/contracts/View.ts +116 -0
  532. package/src/contracts/WorkItems.ts +144 -0
  533. package/src/contracts/Workflow.ts +67 -0
  534. package/src/contracts/index.ts +205 -0
  535. package/src/devices/module.ts +201 -0
  536. package/src/drizzle/Entity.ts +524 -0
  537. package/src/index.ts +19 -0
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Secrets: scoped secret custody, encrypted at rest with envelope encryption. See docs/contracts/secrets.md.
3
+ */
4
+ import { Schema } from "effect"
5
+ import { Forbidden, InvalidInput, Unauthenticated } from "../Errors.ts"
6
+ import { defineOperation, defineServiceContract } from "../Service.ts"
7
+
8
+ /** Who a secret belongs to: an organisation, a person in it, or a Connection (its tokens). */
9
+ export const SecretScope = Schema.Union([
10
+ Schema.Struct({ kind: Schema.Literal("org"), orgId: Schema.String }),
11
+ Schema.Struct({ kind: Schema.Literal("user"), orgId: Schema.String, userId: Schema.String }),
12
+ Schema.Struct({ kind: Schema.Literal("connection"), orgId: Schema.String, connectionId: Schema.String }),
13
+ ])
14
+ export type SecretScope = typeof SecretScope.Type
15
+
16
+ /** What can be known about a secret without reading it. Never its value. */
17
+ export const SecretMetadata = Schema.Struct({
18
+ scope: SecretScope,
19
+ name: Schema.String,
20
+ /** The key-encryption key its data key is wrapped with. */
21
+ keyId: Schema.String,
22
+ /** Incremented on every write and every rotation. */
23
+ version: Schema.Int,
24
+ /** The only origins the kernel sends it to (null: wherever what uses it sends it). */
25
+ allowedOrigins: Schema.NullOr(Schema.Array(Schema.String)),
26
+ /** The feature that manages it (null: the person or administrator who put it); management cannot delete it. */
27
+ managedBy: Schema.NullOr(Schema.String),
28
+ /** Its last four characters after an ellipsis (`…f00d`), for a value of at least 16; null otherwise. */
29
+ hint: Schema.NullOr(Schema.String),
30
+ createdAt: Schema.String,
31
+ updatedAt: Schema.String,
32
+ })
33
+ export type SecretMetadata = typeof SecretMetadata.Type
34
+
35
+ /** What uses a secret: a Connection that sends it, or a requirement the app declares for a feature. */
36
+ export const SecretUsage = Schema.Union([
37
+ Schema.Struct({
38
+ kind: Schema.Literal("connection"),
39
+ connectionId: Schema.String,
40
+ provider: Schema.String,
41
+ label: Schema.String,
42
+ /** `credential` (sent to its endpoint) or `client-secret` (its OAuth client's). */
43
+ as: Schema.Literals(["credential", "client-secret"]),
44
+ }),
45
+ Schema.Struct({ kind: Schema.Literal("requirement"), feature: Schema.String, description: Schema.String }),
46
+ ])
47
+ export type SecretUsage = typeof SecretUsage.Type
48
+
49
+ /** A secret an app needs (`KernelApp.secrets`): put by an administrator (`org`) or each person (`user`). */
50
+ export const SecretRequirement = Schema.Struct({
51
+ scope: Schema.Literals(["org", "user"]),
52
+ name: Schema.String,
53
+ feature: Schema.String,
54
+ description: Schema.String,
55
+ })
56
+ export type SecretRequirement = typeof SecretRequirement.Type
57
+
58
+ export const SecretInventoryEntry = Schema.Struct({
59
+ scope: Schema.Literals(["org", "user"]),
60
+ name: Schema.String,
61
+ /** Null when it is required but not put yet. */
62
+ metadata: Schema.NullOr(SecretMetadata),
63
+ usages: Schema.Array(SecretUsage),
64
+ })
65
+ export type SecretInventoryEntry = typeof SecretInventoryEntry.Type
66
+
67
+ export class SecretNotFound extends Schema.TaggedError<SecretNotFound>()(
68
+ "SecretNotFound",
69
+ { message: Schema.String },
70
+ { httpApiStatus: 404 },
71
+ ) {}
72
+
73
+ /** The stored ciphertext could not be decrypted (an unknown or retired key, or tampered data). */
74
+ export class SecretUnreadable extends Schema.TaggedError<SecretUnreadable>()(
75
+ "SecretUnreadable",
76
+ { message: Schema.String },
77
+ { httpApiStatus: 500 },
78
+ ) {}
79
+
80
+ const SecretName = Schema.String.check(Schema.isPattern(/^[a-z0-9][a-z0-9._-]{0,99}$/u))
81
+ const ManagedScope = Schema.Union([
82
+ Schema.Struct({ kind: Schema.Literal("org"), orgId: Schema.String }),
83
+ Schema.Struct({ kind: Schema.Literal("user"), orgId: Schema.String, userId: Schema.String }),
84
+ ])
85
+ const ManageError = Schema.Union([Unauthenticated, Forbidden, InvalidInput])
86
+
87
+ export const SecretsContract = defineServiceContract({
88
+ name: "Secrets",
89
+ kind: "kernel",
90
+ version: "1.1.0",
91
+ description:
92
+ "Scoped secrets (organisation, user, connection), encrypted at rest with envelope encryption: each value under its own data key (AES-256-GCM, bound to its scope and name), the data key wrapped by a key-encryption key from a pluggable KeyEncryption (the deployment key from configuration by default; a KMS can replace it). Rotation re-encrypts every secret under the current key. Access goes only through the kernel: every read and write is audited by name and scope, never by value, and module roles cannot reach the storage.",
93
+ operations: {
94
+ put: defineOperation({
95
+ description:
96
+ "Store (or replace) a secret. In process for the kernel; over HTTP (POST /kernel/secrets/put) a signed-in person stores secrets of their own (`user`) or, with eloxiv.secrets.manage, of their organisation (`org`).",
97
+ input: Schema.Struct({
98
+ scope: SecretScope,
99
+ name: SecretName,
100
+ value: Schema.String,
101
+ /** Origins (`https://api.example.com`) it may be sent to; the kernel refuses to send it anywhere else. */
102
+ allowedOrigins: Schema.optionalKey(Schema.Array(Schema.String)),
103
+ }),
104
+ output: SecretMetadata,
105
+ errors: Schema.Union([ManageError, SecretUnreadable]),
106
+ }),
107
+ read: defineOperation({
108
+ description:
109
+ "A secret's value: in process only (the kernel and its Connections), audited as eloxiv.secrets.read. Never over a surface.",
110
+ input: Schema.Struct({ scope: SecretScope, name: SecretName, purpose: Schema.String }),
111
+ output: Schema.Struct({ value: Schema.String, metadata: SecretMetadata }),
112
+ errors: Schema.Union([SecretNotFound, SecretUnreadable]),
113
+ }),
114
+ delete: defineOperation({
115
+ description:
116
+ "Delete a secret (or every secret of a scope). Audited. Over HTTP a secret a feature manages (`managedBy`) is refused: it is removed where it is managed.",
117
+ input: Schema.Struct({ scope: SecretScope, name: Schema.optionalKey(SecretName) }),
118
+ output: Schema.Struct({ deleted: Schema.Int }),
119
+ errors: ManageError,
120
+ }),
121
+ list: defineOperation({
122
+ description: "The secrets of a scope, as metadata (never values).",
123
+ input: Schema.Struct({ scope: SecretScope }),
124
+ output: Schema.Array(SecretMetadata),
125
+ errors: ManageError,
126
+ }),
127
+ inventory: defineOperation({
128
+ description:
129
+ "POST /kernel/secrets/inventory, for a signed-in person: their own secrets and, with eloxiv.secrets.manage, the organisation's, each with what uses it (the Connections that send it, the app's requirements), and the required secrets not put yet (metadata null). Never values.",
130
+ input: Schema.Struct({}),
131
+ output: Schema.Struct({ secrets: Schema.Array(SecretInventoryEntry) }),
132
+ errors: ManageError,
133
+ }),
134
+ previewRemoval: defineOperation({
135
+ description:
136
+ "POST /kernel/secrets/preview-removal: what deleting one secret would break (its usages), and whether management may delete it (`managedBy` null), before anything is deleted.",
137
+ input: Schema.Struct({ scope: ManagedScope, name: SecretName }),
138
+ output: Schema.Struct({
139
+ metadata: Schema.NullOr(SecretMetadata),
140
+ usages: Schema.Array(SecretUsage),
141
+ deletable: Schema.Boolean,
142
+ }),
143
+ errors: ManageError,
144
+ }),
145
+ rotate: defineOperation({
146
+ description:
147
+ "Re-encrypt every secret not yet under the current key-encryption key (a new data key and new ciphertext each), so a retired key can be removed. A secret that does not decrypt (its key is not configured, or it was tampered with) is left as it is and counted in `unreadable`. Audited once with the counts.",
148
+ input: Schema.Struct({}),
149
+ output: Schema.Struct({ rotated: Schema.Int, unreadable: Schema.Int, keyId: Schema.String }),
150
+ errors: SecretUnreadable,
151
+ }),
152
+ },
153
+ types: {
154
+ SecretScope,
155
+ SecretMetadata,
156
+ SecretUsage,
157
+ SecretRequirement,
158
+ SecretInventoryEntry,
159
+ SecretNotFound,
160
+ SecretUnreadable,
161
+ },
162
+ })
@@ -0,0 +1,207 @@
1
+ /**
2
+ * Settings: scoped values declared in module manifests (`settings`), each with a value schema and a default,
3
+ * read by key only. Documented in docs/contracts/settings.md; conformance kit
4
+ * `@eloxiv/testing/conformance/Settings`.
5
+ *
6
+ * A value can be set at four levels, narrowest first: a person's own (`user`, in the organisation they act
7
+ * in), the organisation's (`org`), the deployment's (`app`, configuration) and the module installation's
8
+ * (`module`, configuration). A setting's declared scope is the narrowest level it accepts; a read takes the
9
+ * first level from there that holds a value, then the declared default (`resolveSetting`).
10
+ */
11
+ import { Schema } from "effect"
12
+ import { Forbidden, InvalidInput, Unauthenticated } from "../Errors.ts"
13
+ import { SettingScope } from "../Manifest.ts"
14
+ import { defineOperation, defineServiceContract } from "../Service.ts"
15
+
16
+ /** The permission organisation administrators need to set or clear organisation-level values. */
17
+ export const SETTINGS_MANAGE = "eloxiv.settings.manage"
18
+
19
+ /** Where a value lives, narrowest first. */
20
+ export const SETTING_LEVELS = ["user", "org", "app", "module"] as const
21
+ export type SettingLevel = (typeof SETTING_LEVELS)[number]
22
+ export const SettingLevel = Schema.Literals(SETTING_LEVELS)
23
+
24
+ /** Levels a person or an organisation administrator writes through actions; `app` and `module` are configuration. */
25
+ export const WritableLevel = Schema.Literals(["user", "org"])
26
+ export type WritableLevel = typeof WritableLevel.Type
27
+
28
+ /** The levels a setting of `scope` resolves through, in order. */
29
+ export const settingLevels = (scope: SettingScope): ReadonlyArray<SettingLevel> =>
30
+ SETTING_LEVELS.slice(SETTING_LEVELS.indexOf(scope))
31
+
32
+ export interface ResolvedSetting {
33
+ /** The encoded (JSON) value. */
34
+ readonly value: unknown
35
+ /** The level it came from, or `default`. */
36
+ readonly source: SettingLevel | "default"
37
+ }
38
+
39
+ /**
40
+ * Resolve a setting by its declared scope order: the first of its levels (`settingLevels`) that holds a value
41
+ * in `values`, else the declared default. Clients resolve with the same function over their replica.
42
+ */
43
+ export const resolveSetting = (
44
+ declaration: { readonly scope: SettingScope; readonly default: unknown },
45
+ values: Partial<Readonly<Record<SettingLevel, unknown>>>,
46
+ ): ResolvedSetting => {
47
+ for (const level of settingLevels(declaration.scope)) {
48
+ if (values[level] !== undefined) return { value: values[level], source: level }
49
+ }
50
+ return { value: declaration.default, source: "default" }
51
+ }
52
+
53
+ /** The id of a stored value: one per level, organisation, person and key. */
54
+ export const settingValueId = (level: WritableLevel, orgId: string, userId: string | null, key: string) =>
55
+ `${level}:${orgId}:${userId ?? ""}:${key}`
56
+
57
+ /** A stored user- or organisation-level value, as the replica holds it (table `eloxiv_settings.value`). */
58
+ export const SettingValue = Schema.Struct({
59
+ id: Schema.String,
60
+ key: Schema.String,
61
+ level: WritableLevel,
62
+ orgId: Schema.String,
63
+ /** The person, for a user-level value; `null` for an organisation-level one. */
64
+ userId: Schema.NullOr(Schema.String),
65
+ value: Schema.Unknown,
66
+ updatedBy: Schema.String,
67
+ updatedAt: Schema.Number,
68
+ })
69
+ export type SettingValue = typeof SettingValue.Type
70
+
71
+ export const SettingKey = Schema.Struct({ key: Schema.String })
72
+
73
+ export const SettingRead = Schema.Struct({
74
+ key: Schema.String,
75
+ /** The encoded (JSON) value. */
76
+ value: Schema.Unknown,
77
+ source: Schema.Literals([...SETTING_LEVELS, "default"]),
78
+ })
79
+ export type SettingRead = typeof SettingRead.Type
80
+
81
+ export const SettingWrite = Schema.Struct({
82
+ key: Schema.String,
83
+ /** `user` (your own value) or `org` (the organisation's, administrators only). Default: the setting's scope. */
84
+ level: Schema.optionalKey(WritableLevel),
85
+ /** The encoded (JSON) value; it must decode against the setting's schema. */
86
+ value: Schema.Unknown,
87
+ })
88
+ export type SettingWrite = typeof SettingWrite.Type
89
+
90
+ export const SettingClear = Schema.Struct({ key: Schema.String, level: Schema.optionalKey(WritableLevel) })
91
+ export type SettingClear = typeof SettingClear.Type
92
+
93
+ export const SettingChanged = Schema.Struct({
94
+ id: Schema.String,
95
+ key: Schema.String,
96
+ level: WritableLevel,
97
+ })
98
+
99
+ /** A deployment value (`app` or `module` level), set by configuration or a deployment administrator. */
100
+ export const SettingConfigure = Schema.Struct({
101
+ key: Schema.String,
102
+ level: Schema.Literals(["app", "module"]),
103
+ /** The encoded value, or `null` to remove it. */
104
+ value: Schema.Unknown,
105
+ })
106
+ export type SettingConfigure = typeof SettingConfigure.Type
107
+
108
+ /** What the audit record of a settings write holds as `detail`. */
109
+ export const SettingAuditDetail = Schema.Struct({
110
+ key: Schema.String,
111
+ level: SettingLevel,
112
+ subject: Schema.NullOr(Schema.String),
113
+ before: Schema.Unknown,
114
+ after: Schema.Unknown,
115
+ })
116
+
117
+ /** The kernel actions (module `settings`). */
118
+ export const SETTINGS_ACTIONS = { get: "settings.get", set: "settings.set", clear: "settings.clear" } as const
119
+
120
+ /**
121
+ * Each person's preferences, declared by the kernel's `settings` module (user scope: a person's own value, else
122
+ * their organisation's, else the default), synced to their replica like any setting: their language, their time
123
+ * zone (a cron schedule they create with `timeZone: "local"` runs in it), and their light, dark or system theme.
124
+ */
125
+ export const PREFERENCE_SETTINGS = {
126
+ locale: "settings.locale",
127
+ timeZone: "settings.timeZone",
128
+ theme: "settings.theme",
129
+ } as const
130
+
131
+ /** A BCP 47 language tag (`en`, `ar`, `pt-BR`), or null for the browser's. */
132
+ export const PreferredLocale = Schema.NullOr(
133
+ Schema.String.check(Schema.isPattern(/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8}){0,3}$/)),
134
+ )
135
+ /** An IANA time zone (`Europe/London`, `UTC`), or null for the device's. */
136
+ export const PreferredTimeZone = Schema.NullOr(
137
+ Schema.String.check(Schema.isPattern(/^(UTC|[A-Za-z_]+(\/[A-Za-z0-9_+-]+){1,2})$/)),
138
+ )
139
+ export const PreferredTheme = Schema.Literals(["system", "light", "dark"])
140
+
141
+ /** The declarations (`settings` in the settings module's manifest). */
142
+ export const PREFERENCE_DECLARATIONS = {
143
+ [PREFERENCE_SETTINGS.locale]: {
144
+ description: "Your language for the app (a BCP 47 tag), or null for your browser's.",
145
+ scope: "user",
146
+ schema: PreferredLocale,
147
+ default: null,
148
+ },
149
+ [PREFERENCE_SETTINGS.timeZone]: {
150
+ description: "Your time zone (IANA), or null for your device's. Schedules you create in local time use it.",
151
+ scope: "user",
152
+ schema: PreferredTimeZone,
153
+ default: null,
154
+ },
155
+ [PREFERENCE_SETTINGS.theme]: {
156
+ description: "Light, dark, or following your system.",
157
+ scope: "user",
158
+ schema: PreferredTheme,
159
+ default: "system",
160
+ },
161
+ } as const
162
+
163
+ export const SettingsContract = defineServiceContract({
164
+ name: "Settings",
165
+ kind: "kernel",
166
+ version: "1.0.0",
167
+ description:
168
+ "Scoped values declared in module manifests (user, org, app and module scopes), each with a value schema and " +
169
+ "a default. Reads are keyed (get resolves one key through the declared scope order) and never list. Writes are " +
170
+ "kernel actions authorised by level (a person writes their own user-level values; organisation administrators " +
171
+ "the organisation's), validated against the schema and audited; app and module levels are configuration. " +
172
+ "User- and organisation-level values sync to the person's replica. Secrets never go in settings.",
173
+ operations: {
174
+ get: defineOperation({
175
+ description:
176
+ "The value of one declared setting for the caller, resolved through its scope's levels (user, org, app, " +
177
+ "module) to the declared default, with the level it came from. Unknown keys are InvalidInput.",
178
+ input: SettingKey,
179
+ output: SettingRead,
180
+ errors: Schema.Union([Unauthenticated, Forbidden, InvalidInput]),
181
+ }),
182
+ set: defineOperation({
183
+ description:
184
+ "Set a user-level value (your own) or an organisation-level value (administrators, with " +
185
+ "eloxiv.settings.manage). The value must decode against the setting's schema, and the level must be one " +
186
+ "the setting's scope accepts. Audited with the value before and after.",
187
+ input: SettingWrite,
188
+ output: SettingChanged,
189
+ errors: Schema.Union([Unauthenticated, Forbidden, InvalidInput]),
190
+ }),
191
+ clear: defineOperation({
192
+ description: "Remove a user- or organisation-level value, so reads fall through to the next level. Audited.",
193
+ input: SettingClear,
194
+ output: SettingChanged,
195
+ errors: Schema.Union([Unauthenticated, Forbidden, InvalidInput]),
196
+ }),
197
+ configure: defineOperation({
198
+ description:
199
+ "Operators only (in process, not a surface): set or remove a deployment value at the app or module level. " +
200
+ "Validated against the schema and audited as eloxiv.settings.configure.",
201
+ input: SettingConfigure,
202
+ output: Schema.Struct({ key: Schema.String, level: Schema.Literals(["app", "module"]) }),
203
+ errors: InvalidInput,
204
+ }),
205
+ },
206
+ types: { SettingValue, SettingRead, SettingWrite, SettingClear, SettingConfigure, SettingLevel, SettingAuditDetail },
207
+ })
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Sharing (decision 2; the Sharing row of decisions.md): per-record grants to a user, a group, the whole
3
+ * organisation or a link, and access requests, compiled into the policy filters row-level security, sync and
4
+ * the query views use. Who may share a record is itself a policy: the record's entity's Cedar action `share`.
5
+ * See docs/contracts/sharing.md.
6
+ */
7
+ import { Schema } from "effect"
8
+ import { InvocationError } from "../Errors.ts"
9
+ import { defineOperation, defineServiceContract } from "../Service.ts"
10
+
11
+ /**
12
+ * Who a grant is to: a member of the organisation, a group of it, the organisation itself, or a link (an
13
+ * unguessable token that members of the organisation redeem once to hold the grant).
14
+ */
15
+ export const Grantee = Schema.Union([
16
+ Schema.Struct({ user: Schema.String }),
17
+ Schema.Struct({ group: Schema.String }),
18
+ Schema.Struct({ org: Schema.String }),
19
+ Schema.Struct({ link: Schema.Struct({}) }),
20
+ ])
21
+ export type Grantee = typeof Grantee.Type
22
+
23
+ /** A record that can be shared: its entity's Cedar type and its primary key. */
24
+ export const SharedRecord = Schema.Struct({
25
+ /** The entity's Cedar type, e.g. `Docs::Doc`. */
26
+ entity: Schema.String,
27
+ id: Schema.String,
28
+ })
29
+ export type SharedRecord = typeof SharedRecord.Type
30
+
31
+ export const ShareInput = Schema.Struct({
32
+ ...SharedRecord.fields,
33
+ grantee: Grantee,
34
+ /** One of the entity's sharing permissions (the `permission` of one of its sharing attributes). */
35
+ permission: Schema.String,
36
+ /** ISO 8601 instant after which the grant authorises nothing. Links default to 30 days, at most 365. */
37
+ expiresAt: Schema.optionalKey(Schema.NullOr(Schema.String)),
38
+ })
39
+ export type ShareInput = typeof ShareInput.Type
40
+
41
+ export const ShareOutput = Schema.Struct({
42
+ grantId: Schema.String,
43
+ /** The link's token, returned once when a link is created and never again (only its hash is stored). */
44
+ token: Schema.NullOr(Schema.String),
45
+ expiresAt: Schema.NullOr(Schema.String),
46
+ })
47
+ export type ShareOutput = typeof ShareOutput.Type
48
+
49
+ export const GrantKind = Schema.Literals(["user", "group", "org", "link"])
50
+ export type GrantKind = typeof GrantKind.Type
51
+
52
+ /** One grant of a record, as its managers see it (never a link's token). */
53
+ export const Grant = Schema.Struct({
54
+ id: Schema.String,
55
+ kind: GrantKind,
56
+ /** The user, group or organisation id; for a link, the grant's own id. */
57
+ grantee: Schema.String,
58
+ permission: Schema.String,
59
+ grantedBy: Schema.String,
60
+ createdAt: Schema.String,
61
+ expiresAt: Schema.NullOr(Schema.String),
62
+ /** For a link: how many members redeemed it. */
63
+ redemptions: Schema.Number,
64
+ })
65
+ export type Grant = typeof Grant.Type
66
+
67
+ export const UnshareInput = Schema.Struct({ grantId: Schema.String })
68
+ export const UnshareOutput = Schema.Struct({ revoked: Schema.Boolean })
69
+ export const ListGrantsOutput = Schema.Struct({ grants: Schema.Array(Grant) })
70
+
71
+ export const RedeemLinkInput = Schema.Struct({ token: Schema.String })
72
+ export const RedeemLinkOutput = Schema.Struct({ ...SharedRecord.fields, permission: Schema.String })
73
+
74
+ export const AccessRequestStatus = Schema.Literals(["pending", "approved", "denied"])
75
+ export type AccessRequestStatus = typeof AccessRequestStatus.Type
76
+
77
+ export const RequestAccessInput = Schema.Struct({
78
+ ...SharedRecord.fields,
79
+ permission: Schema.String,
80
+ message: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1000))),
81
+ })
82
+ export type RequestAccessInput = typeof RequestAccessInput.Type
83
+ /** The same answer whether or not the record exists or anyone can manage it: a request reveals nothing. */
84
+ export const RequestAccessOutput = Schema.Struct({ id: Schema.String, status: AccessRequestStatus })
85
+
86
+ export const DecideAccessInput = Schema.Struct({ id: Schema.String })
87
+ export const DecideAccessOutput = Schema.Struct({
88
+ id: Schema.String,
89
+ status: AccessRequestStatus,
90
+ /** The grant an approval made. */
91
+ grantId: Schema.NullOr(Schema.String),
92
+ })
93
+
94
+ export const AccessStatusInput = SharedRecord
95
+ /**
96
+ * What a person may do with a record they were sent to, for an access gate: `allowed` when they may read it now,
97
+ * `unavailable` otherwise. A record that does not exist, one of another organisation and one they may not read are
98
+ * all `unavailable`: the answer never says which. Their own requests for it are theirs to see either way.
99
+ */
100
+ export const AccessStatusOutput = Schema.Struct({
101
+ access: Schema.Literals(["allowed", "unavailable"]),
102
+ /** Whether they may share it (manage its grants and decide requests for it); false unless `allowed`. */
103
+ canShare: Schema.Boolean,
104
+ /** Their own access requests for the record in the organisation they act in, most recent first. */
105
+ requests: Schema.Array(
106
+ Schema.Struct({
107
+ id: Schema.String,
108
+ permission: Schema.String,
109
+ status: AccessRequestStatus,
110
+ updatedAt: Schema.String,
111
+ }),
112
+ ),
113
+ })
114
+ export type AccessStatusOutput = typeof AccessStatusOutput.Type
115
+
116
+ /** An access request, as its requester and the record's managers see it (synced to their replicas). */
117
+ export const AccessRequest = Schema.Struct({
118
+ id: Schema.String,
119
+ orgId: Schema.String,
120
+ requesterId: Schema.String,
121
+ resourceType: Schema.String,
122
+ resourceId: Schema.String,
123
+ permission: Schema.String,
124
+ message: Schema.NullOr(Schema.String),
125
+ status: AccessRequestStatus,
126
+ decidedBy: Schema.NullOr(Schema.String),
127
+ })
128
+ export type AccessRequest = typeof AccessRequest.Type
129
+
130
+ /** The columns of `eloxiv.share_grant`, field to column. */
131
+ export const ShareGrantColumns = Schema.Struct({
132
+ id: Schema.Literal("id"),
133
+ resourceType: Schema.Literal("resource_type"),
134
+ resourceId: Schema.Literal("resource_id"),
135
+ granteeKind: Schema.Literal("grantee_kind"),
136
+ granteeId: Schema.Literal("grantee_id"),
137
+ orgId: Schema.Literal("org_id"),
138
+ permission: Schema.Literal("permission"),
139
+ expiresAt: Schema.Literal("expires_at"),
140
+ })
141
+
142
+ export const SharingContract = defineServiceContract({
143
+ name: "Sharing",
144
+ kind: "kernel",
145
+ version: "1.0.0",
146
+ description:
147
+ "Per-record sharing grants to a user, a group, the whole organisation or a link, with the permissions an entity declares, and access requests that reach a record's managers as work items and notifications. Who may share a record (and list or revoke its grants, and decide requests for it) is the entity's own Cedar policy for the action `share`. Grants compile into the same filters that row-level security, sync and the query views apply, evaluated for the acting principal only, live: a grant or revocation reaches connected replicas without reconnecting. Every operation is an action on every surface, audited.",
148
+ operations: {
149
+ grant: defineOperation({
150
+ description:
151
+ "Action sharing.grant: grant a permission on a record you may share, to a member or group of your organisation, the organisation, or a new link (whose token is returned once). Sharing the same thing again returns the existing grant, with the new expiry.",
152
+ input: ShareInput,
153
+ output: ShareOutput,
154
+ errors: InvocationError,
155
+ }),
156
+ revoke: defineOperation({
157
+ description:
158
+ "Action sharing.revoke: revoke a grant of a record you may share (a link stops working for everyone who redeemed it).",
159
+ input: UnshareInput,
160
+ output: UnshareOutput,
161
+ errors: InvocationError,
162
+ }),
163
+ list: defineOperation({
164
+ description: "Action sharing.list: the grants of a record you may share.",
165
+ input: SharedRecord,
166
+ output: ListGrantsOutput,
167
+ errors: InvocationError,
168
+ }),
169
+ redeemLink: defineOperation({
170
+ description:
171
+ "Action sharing.redeemLink: present a link's token while acting in the organisation it was made in; from then on you hold its grant, until it is revoked or expires.",
172
+ input: RedeemLinkInput,
173
+ output: RedeemLinkOutput,
174
+ errors: InvocationError,
175
+ }),
176
+ requestAccess: defineOperation({
177
+ description:
178
+ "Action sharing.requestAccess: ask for a permission on a record. Each member of your organisation who may share the record gets a work item and a notification; the answer is the same whether or not the record exists.",
179
+ input: RequestAccessInput,
180
+ output: RequestAccessOutput,
181
+ errors: InvocationError,
182
+ }),
183
+ access: defineOperation({
184
+ description:
185
+ "Action sharing.access (read-only): whether the caller may read a record now (`allowed`) or not (`unavailable`, the same for a record that does not exist), whether they may share it, and their own access requests for it, for an access gate.",
186
+ input: AccessStatusInput,
187
+ output: AccessStatusOutput,
188
+ errors: InvocationError,
189
+ }),
190
+ approveRequest: defineOperation({
191
+ description:
192
+ "Action sharing.approveRequest: grant a pending request, if you may still share the record; the requester is notified and every manager's work item closes.",
193
+ input: DecideAccessInput,
194
+ output: DecideAccessOutput,
195
+ errors: InvocationError,
196
+ }),
197
+ denyRequest: defineOperation({
198
+ description: "Action sharing.denyRequest: refuse a pending request you were asked to decide.",
199
+ input: DecideAccessInput,
200
+ output: DecideAccessOutput,
201
+ errors: InvocationError,
202
+ }),
203
+ },
204
+ types: { Grantee, SharedRecord, Grant, GrantKind, AccessRequest, AccessRequestStatus, ShareGrantColumns },
205
+ })
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Slot (a shell contract): the extension points modules declare (`slots`) and the contributions other modules
3
+ * make to them (`contributions`: one of the app's views or commands), resolved across every installed module
4
+ * into one deterministic order. A slot accepts either views or commands; the manifest check refuses a
5
+ * contribution of the other kind, to a slot that does not exist, or of a target that does not exist.
6
+ * Documented in docs/contracts/slot.md; conformance kit `@eloxiv/testing/conformance/Slot`; implemented by
7
+ * `@eloxiv/shell-core` (`shellRegistry`).
8
+ */
9
+ import { Schema } from "effect"
10
+ import { defineServiceContract } from "../Service.ts"
11
+ import { PaletteEntry } from "./Command.ts"
12
+ import { ViewDescriptor } from "./View.ts"
13
+
14
+ export const SlotDescriptor = Schema.Struct({
15
+ /** Namespaced by the module that exposes it, e.g. `home.launcher`. */
16
+ id: Schema.String,
17
+ module: Schema.String,
18
+ description: Schema.String,
19
+ accepts: Schema.Literals(["view", "command"]),
20
+ })
21
+ export type SlotDescriptor = typeof SlotDescriptor.Type
22
+
23
+ /** One resolved contribution: who contributed it, its order, and the view or palette entry it names. */
24
+ export const SlotEntry = Schema.Struct({
25
+ contribution: Schema.String,
26
+ module: Schema.String,
27
+ order: Schema.optionalKey(Schema.Number),
28
+ target: Schema.Union([Schema.Struct({ view: ViewDescriptor }), Schema.Struct({ command: PaletteEntry })]),
29
+ })
30
+ export type SlotEntry = typeof SlotEntry.Type
31
+
32
+ export class UnknownSlot extends Schema.TaggedError<UnknownSlot>()("UnknownSlot", {
33
+ message: Schema.String,
34
+ slot: Schema.String,
35
+ }) {}
36
+
37
+ export const SlotContract = defineServiceContract({
38
+ name: "Slot",
39
+ kind: "shell",
40
+ version: "1.0.0",
41
+ description:
42
+ "The extension points every installed module declares, and each one's contributions from any module, " +
43
+ "resolved to the view or palette entry they name and ordered deterministically: by `order` ascending (an " +
44
+ "entry without one after every entry with one), then by the contributing module's installation order, then " +
45
+ "by contribution id.",
46
+ operations: {
47
+ list: {
48
+ description: "Every slot, in module installation order, then by id.",
49
+ input: Schema.Struct({}),
50
+ output: Schema.Array(SlotDescriptor),
51
+ errors: Schema.Never,
52
+ },
53
+ resolve: {
54
+ description: "A slot's contributions from every installed module, resolved and in order.",
55
+ input: Schema.Struct({ slot: Schema.String }),
56
+ output: Schema.Array(SlotEntry),
57
+ errors: UnknownSlot,
58
+ },
59
+ },
60
+ types: { SlotDescriptor, SlotEntry, UnknownSlot },
61
+ })