@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,177 @@
1
+ /**
2
+ * Telemetry: traces and metrics (OpenTelemetry through Effect), error capture (Sentry behind an interface) and
3
+ * product analytics (PostHog behind an interface), with Privacy consent gating. Documented in
4
+ * docs/contracts/telemetry.md; conformance kit `@eloxiv/testing/conformance/Telemetry`.
5
+ *
6
+ * Everything that leaves is allowlisted: no free-form string ever does.
7
+ *
8
+ * **Traces and metrics.** The kernel exports OTLP (HTTP, JSON) to a configured collector: a span per invocation
9
+ * (`Invocation.invoke`) and per HTTP request, and invocation counts and durations. A span attribute leaves only if
10
+ * its key is in `TELEMETRY_SPAN_ATTRIBUTES` and its value is a declared low-cardinality value for that key: a
11
+ * registered action or module name (otherwise `unknown`), a surface, an origin, an outcome, a known error tag,
12
+ * an HTTP method, a status code, a route template (never a path), a URL scheme. Span events (log lines) never
13
+ * leave, and a failed span records only its error's tag.
14
+ *
15
+ * **Error capture.** Unexpected failures are captured through an `ErrorCapture` interface with a Sentry adapter
16
+ * (the envelope protocol). A report carries only the failure's tag, the invocation id and the tag's fixed
17
+ * message (`CAPTURED_ERROR_MESSAGES`): never the error's own message, stack or any value of the call.
18
+ *
19
+ * **Product analytics.** Every event is declared (modules' `analyticsEvents`, the app's `client.*` events, the
20
+ * kernel's own `eloxiv.action_invoked`), with its consent category and typed properties (`AnalyticsProperty`:
21
+ * enums, numbers, booleans and ids, ids pseudonymised with a keyed hash); anything else is refused. An event goes
22
+ * to the analytics adapter (PostHog's capture API) only if the person consents to its category (Privacy `allows`),
23
+ * checked as the batch leaves, after the call commits; the person is a keyed hash of their user id.
24
+ */
25
+ import { Schema } from "effect"
26
+ import { Forbidden, InvalidInput, Unauthenticated } from "../Errors.ts"
27
+ import { defineOperation, defineServiceContract } from "../Service.ts"
28
+ import { ConsentCategory } from "./Privacy.ts"
29
+
30
+ export * from "../Analytics.ts"
31
+
32
+ /** The span attribute keys the kernel exports; each value is checked against what the key may hold. */
33
+ export const TELEMETRY_SPAN_ATTRIBUTES = [
34
+ "eloxiv.action",
35
+ "eloxiv.surface",
36
+ "eloxiv.module",
37
+ "eloxiv.origin",
38
+ "eloxiv.outcome",
39
+ "eloxiv.error_tag",
40
+ "eloxiv.replayed",
41
+ "http.request.method",
42
+ "http.response.status_code",
43
+ "http.route",
44
+ "url.scheme",
45
+ "db.system",
46
+ "db.system.name",
47
+ "db.operation.name",
48
+ ] as const
49
+
50
+ /** The tags a captured failure can have, each with the only message a report about it carries. */
51
+ export const CAPTURED_ERROR_MESSAGES = {
52
+ Defect: "An invocation failed unexpectedly; see the kernel's logs for this invocation id",
53
+ Client: "A client reported an unexpected error; see its route, error name and breadcrumbs",
54
+ } as const
55
+ export type CapturedTag = keyof typeof CAPTURED_ERROR_MESSAGES
56
+
57
+ /** A short label: letters, digits, `_`, `.`, `-`, `:` and `/` (an error's class name, a breadcrumb's name, a route). */
58
+ const Label = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_.:/-]{1,64}$/u))
59
+
60
+ /**
61
+ * A client's unexpected error (`telemetry.captureError`), as the client SDK reports it: what kind (a thrown exception,
62
+ * an unhandled rejection), the error's class name, the route it happened on as a template (`/orders/:id`, query and
63
+ * fragment dropped, ids replaced), the invocation it followed (correlation), and the last breadcrumbs (what the person
64
+ * did, by kind and a label). **Never a message, a stack, a URL's values or any input**: every field is a label.
65
+ */
66
+ export const ClientErrorReport = Schema.Struct({
67
+ kind: Schema.Literals(["exception", "rejection"]),
68
+ errorName: Label,
69
+ route: Schema.String.check(Schema.isPattern(/^\/[A-Za-z0-9_.:\-/*]{0,199}$/u)),
70
+ invocationId: Schema.optionalKey(Schema.String.check(Schema.isPattern(/^[0-9a-f-]{8,64}$/u))),
71
+ breadcrumbs: Schema.Array(
72
+ Schema.Struct({
73
+ kind: Schema.Literals(["navigation", "action", "request", "ui"]),
74
+ name: Label,
75
+ at: Schema.Number,
76
+ }),
77
+ ).check(Schema.isMaxLength(20)),
78
+ })
79
+ export type ClientErrorReport = typeof ClientErrorReport.Type
80
+
81
+ /** A captured failure: what an error-capture adapter receives. Nothing of the error itself. */
82
+ export const CapturedError = Schema.Struct({
83
+ eventId: Schema.String,
84
+ timestamp: Schema.Number,
85
+ level: Schema.Literals(["fatal", "error", "warning"]),
86
+ tag: Schema.Literals(Object.keys(CAPTURED_ERROR_MESSAGES) as [CapturedTag]),
87
+ /** `CAPTURED_ERROR_MESSAGES[tag]`. */
88
+ message: Schema.String,
89
+ invocationId: Schema.NullOr(Schema.String),
90
+ /** The deployment's own labels (configuration, not data). */
91
+ environment: Schema.String,
92
+ release: Schema.NullOr(Schema.String),
93
+ /** A client's report (tag `Client`): its labels, as declared above. */
94
+ client: Schema.optionalKey(ClientErrorReport),
95
+ })
96
+ export type CapturedError = typeof CapturedError.Type
97
+
98
+ const PropertyValue = Schema.Union([Schema.String, Schema.Number, Schema.Boolean])
99
+
100
+ /** What a handler or client tracks: a declared event and its declared properties. */
101
+ export const TrackEvent = Schema.Struct({
102
+ event: Schema.String.check(Schema.isMaxLength(100)),
103
+ properties: Schema.optionalKey(Schema.Record(Schema.String, PropertyValue)),
104
+ })
105
+ export type TrackEvent = typeof TrackEvent.Type
106
+
107
+ /** An event as an analytics adapter receives it: declared values only, ids pseudonymised. */
108
+ export const AnalyticsEvent = Schema.Struct({
109
+ uuid: Schema.String,
110
+ event: Schema.String,
111
+ category: ConsentCategory,
112
+ /** A keyed hash of the user id (never the id itself). */
113
+ distinctId: Schema.String,
114
+ properties: Schema.Record(Schema.String, PropertyValue),
115
+ timestamp: Schema.Number,
116
+ })
117
+ export type AnalyticsEvent = typeof AnalyticsEvent.Type
118
+
119
+ /** The kernel action (module `telemetry`). */
120
+ export const TELEMETRY_ACTIONS = { track: "telemetry.track", captureError: "telemetry.captureError" } as const
121
+
122
+ /** The most error reports one person's clients send a minute; the rest are dropped (and counted in the log). */
123
+ export const CLIENT_ERRORS_PER_MINUTE = 30
124
+
125
+ /** The kernel's own event, for every first execution a person or their agent makes. */
126
+ export const ACTION_INVOKED_EVENT = "eloxiv.action_invoked"
127
+
128
+ /** The kernel's own event when a signed-in person claims their visit (Privacy): its first touch's channel only. */
129
+ export const VISIT_CLAIMED_EVENT = "eloxiv.visit_claimed"
130
+
131
+ export const TelemetryContract = defineServiceContract({
132
+ name: "Telemetry",
133
+ kind: "kernel",
134
+ version: "1.0.0",
135
+ description:
136
+ "OpenTelemetry traces and metrics exported over OTLP through Effect, with declared low-cardinality attribute " +
137
+ "values only (registered names, enums, route templates); error capture behind an interface with a Sentry " +
138
+ "adapter, reporting only a failure's tag, its invocation id and the tag's fixed message; and product analytics " +
139
+ "behind an interface with a PostHog adapter, for declared events with typed properties (ids pseudonymised), " +
140
+ "sent only with the person's consent for the event's category, after commit and off the request path.",
141
+ operations: {
142
+ captureError: defineOperation({
143
+ description:
144
+ "In process: report an unexpected failure by its tag and invocation id. Never fails the caller (an " +
145
+ "adapter's failure is logged).",
146
+ input: Schema.Struct({ tag: Schema.String, invocationId: Schema.NullOr(Schema.String) }),
147
+ output: Schema.Void,
148
+ errors: Schema.Never,
149
+ }),
150
+ track: defineOperation({
151
+ description:
152
+ "ctx.analytics.track and the telemetry.track action: a declared event with declared, typed properties for " +
153
+ "the acting person (InvalidInput otherwise), sent after the call commits only if they consent to its " +
154
+ "category.",
155
+ input: TrackEvent,
156
+ output: Schema.Struct({ accepted: Schema.Boolean }),
157
+ errors: Schema.Union([Unauthenticated, Forbidden, InvalidInput]),
158
+ }),
159
+ reportClientError: defineOperation({
160
+ description:
161
+ "The telemetry.captureError action: a client's unexpected error, as labels only (its kind, class name, route " +
162
+ "template, correlated invocation and breadcrumbs; never a message or stack), sent to error capture with the " +
163
+ "fixed message of tag Client; at most CLIENT_ERRORS_PER_MINUTE a person per calendar minute are kept (so up " +
164
+ "to twice it in any 60 seconds across a boundary).",
165
+ input: ClientErrorReport,
166
+ output: Schema.Struct({ accepted: Schema.Boolean }),
167
+ errors: Schema.Union([Unauthenticated, Forbidden, InvalidInput]),
168
+ }),
169
+ flush: defineOperation({
170
+ description: "In process: send what is queued (traces, metrics, errors, events) now; called at shutdown.",
171
+ input: Schema.Struct({}),
172
+ output: Schema.Void,
173
+ errors: Schema.Never,
174
+ }),
175
+ },
176
+ types: { CapturedError, AnalyticsEvent, TrackEvent, ClientErrorReport },
177
+ })
@@ -0,0 +1,136 @@
1
+ /**
2
+ * ThemeTokens (a shell contract): the design tokens a registry theme provides and the shell and UI items
3
+ * consume, as CSS custom properties or resolved values. Colours come in light and dark pairs, so every colour
4
+ * token works in both schemes; spacing and insets are logical (inline start and end, block start and end), never
5
+ * left or right, so right-to-left layouts mirror without a second theme; resolving for a direction gives the
6
+ * physical sides for platforms without logical properties. Every foreground token must keep WCAG AA contrast
7
+ * (4.5:1) against the background it is named for, in both schemes.
8
+ *
9
+ * Documented in docs/contracts/theme-tokens.md; conformance kit `@eloxiv/testing/conformance/ThemeTokens`;
10
+ * implemented by `@eloxiv/shell-core` (`themeCss`, `resolveTheme`), consumed by the registry's `theme` item.
11
+ */
12
+ import { Schema } from "effect"
13
+ import { defineServiceContract } from "../Service.ts"
14
+
15
+ /**
16
+ * The colour tokens every theme defines (shadcn/ui's vocabulary, which the registry UI uses). A token
17
+ * `<name>-foreground` is text on `<name>`; `foreground` is text on `background`.
18
+ */
19
+ export const COLOR_TOKENS = [
20
+ "background",
21
+ "foreground",
22
+ "card",
23
+ "card-foreground",
24
+ "popover",
25
+ "popover-foreground",
26
+ "primary",
27
+ "primary-foreground",
28
+ "secondary",
29
+ "secondary-foreground",
30
+ "muted",
31
+ "muted-foreground",
32
+ "accent",
33
+ "accent-foreground",
34
+ "destructive",
35
+ "destructive-foreground",
36
+ "border",
37
+ "input",
38
+ "ring",
39
+ ] as const
40
+ export type ColorToken = (typeof COLOR_TOKENS)[number]
41
+
42
+ /** The contrast every foreground keeps against its background (WCAG 2.2 AA, normal text). */
43
+ export const MIN_CONTRAST = 4.5
44
+
45
+ /** A CSS colour the implementation can measure: `#rgb`, `#rrggbb` or `oklch(L C H)` or `oklch(L C H / A)` (L and A as a number or %). */
46
+ export const ThemeColor = Schema.String.check(
47
+ Schema.isPattern(
48
+ /^(#[0-9a-fA-F]{3}|#[0-9a-fA-F]{6}|oklch\(\s*[0-9.]+%?\s+[0-9.]+\s+[0-9.]+(\s*\/\s*[0-9.]+%?)?\s*\))$/,
49
+ ),
50
+ )
51
+
52
+ export const ColorPair = Schema.Struct({ light: ThemeColor, dark: ThemeColor })
53
+ export type ColorPair = typeof ColorPair.Type
54
+
55
+ /** A CSS length: a number with `rem`, `px` or `em`, or zero. */
56
+ export const CssLength = Schema.String.check(Schema.isPattern(/^(0|[0-9]+(\.[0-9]+)?(rem|px|em))$/))
57
+
58
+ export const ThemeTokens = Schema.Struct({
59
+ /** The theme's name, e.g. `default`. */
60
+ name: Schema.String.check(Schema.isPattern(/^[a-z][a-z0-9-]*$/)),
61
+ colors: Schema.Record(Schema.String, ColorPair),
62
+ /** The base corner radius (`--radius`). */
63
+ radius: CssLength,
64
+ /** The spacing unit (`--spacing`); layouts multiply it. */
65
+ spacing: CssLength,
66
+ fonts: Schema.Struct({ sans: Schema.String, mono: Schema.String }),
67
+ })
68
+ export type ThemeTokens = typeof ThemeTokens.Type
69
+
70
+ export const ColorScheme = Schema.Literals(["light", "dark"])
71
+ export type ColorScheme = typeof ColorScheme.Type
72
+ export const TextDirection = Schema.Literals(["ltr", "rtl"])
73
+ export type TextDirection = typeof TextDirection.Type
74
+
75
+ /** Insets on logical sides (lengths). */
76
+ export const LogicalInset = Schema.Struct({
77
+ blockStart: CssLength,
78
+ inlineEnd: CssLength,
79
+ blockEnd: CssLength,
80
+ inlineStart: CssLength,
81
+ })
82
+ export type LogicalInset = typeof LogicalInset.Type
83
+
84
+ /** The same insets on physical sides, for one direction. */
85
+ export const PhysicalInset = Schema.Struct({ top: CssLength, right: CssLength, bottom: CssLength, left: CssLength })
86
+ export type PhysicalInset = typeof PhysicalInset.Type
87
+
88
+ /** One scheme's values as CSS custom properties (`--background`, `--radius`, ...). */
89
+ export const ResolvedTheme = Schema.Struct({
90
+ scheme: ColorScheme,
91
+ direction: TextDirection,
92
+ variables: Schema.Record(Schema.String, Schema.String),
93
+ })
94
+ export type ResolvedTheme = typeof ResolvedTheme.Type
95
+
96
+ export const ThemeTokensContract = defineServiceContract({
97
+ name: "ThemeTokens",
98
+ kind: "shell",
99
+ version: "1.0.0",
100
+ description:
101
+ "Design tokens: colour tokens in light and dark pairs (every token in COLOR_TOKENS, each foreground at " +
102
+ "least 4.5:1 against its background in both schemes), a radius, a spacing unit and font stacks; resolved " +
103
+ "per scheme and direction into CSS custom properties, written as one stylesheet (`:root` for light, `.dark` " +
104
+ "and `[data-theme=dark]` for dark, `[dir=rtl]` for the direction), and logical insets mapped to physical " +
105
+ "sides for a direction.",
106
+ operations: {
107
+ validate: {
108
+ description:
109
+ "Every problem with a theme: a missing colour token, an unmeasurable colour, or a foreground below 4.5:1 " +
110
+ "against its background in either scheme. Empty when the theme is valid.",
111
+ input: ThemeTokens,
112
+ output: Schema.Struct({ problems: Schema.Array(Schema.String) }),
113
+ errors: Schema.Never,
114
+ },
115
+ resolve: {
116
+ description: "One scheme's tokens as CSS custom properties, for a direction (`--direction`, `--inline-start`).",
117
+ input: Schema.Struct({ theme: ThemeTokens, scheme: ColorScheme, direction: TextDirection }),
118
+ output: ResolvedTheme,
119
+ errors: Schema.Never,
120
+ },
121
+ css: {
122
+ description:
123
+ "The theme as one stylesheet: light on `:root`, dark on `.dark` and `[data-theme=dark]`, direction on `[dir=rtl]`.",
124
+ input: Schema.Struct({ theme: ThemeTokens }),
125
+ output: Schema.Struct({ css: Schema.String }),
126
+ errors: Schema.Never,
127
+ },
128
+ inset: {
129
+ description: "Logical insets on the physical sides of a direction (inline start is left in ltr, right in rtl).",
130
+ input: Schema.Struct({ inset: LogicalInset, direction: TextDirection }),
131
+ output: PhysicalInset,
132
+ errors: Schema.Never,
133
+ },
134
+ },
135
+ types: { ThemeTokens, ColorPair, ColorScheme, TextDirection, LogicalInset, PhysicalInset, ResolvedTheme },
136
+ })
@@ -0,0 +1,94 @@
1
+ /**
2
+ * ToolSource: an external server's tools (a remote MCP server, through the registry's `mcp` connector) over a kernel
3
+ * Connection whose endpoint is the server. The kernel carries the credential (none, a secret it holds, or an OAuth
4
+ * grant it discovered and keeps) and checks every destination; the connector speaks the protocol. See
5
+ * docs/contracts/tool-source.md.
6
+ */
7
+ import { Schema } from "effect"
8
+ import { defineOperation, defineServiceContract } from "../Service.ts"
9
+ import { CapabilityError, PageRequest } from "./Capability.ts"
10
+
11
+ /** A tool the server offers, as it describes it. Its hints are the server's word, not a guarantee. */
12
+ export const RemoteTool = Schema.Struct({
13
+ name: Schema.String,
14
+ title: Schema.NullOr(Schema.String),
15
+ description: Schema.String,
16
+ /** The tool's input, as a JSON Schema object. */
17
+ inputSchema: Schema.Record(Schema.String, Schema.Unknown),
18
+ /** The server says the tool only reads (MCP `readOnlyHint`). */
19
+ readOnly: Schema.Boolean,
20
+ /** The server says the tool may destroy something (MCP `destructiveHint`). */
21
+ destructive: Schema.Boolean,
22
+ /**
23
+ * The MCP Apps extension (`_meta.ui`), when the server declares it: the `ui://` resource the tool's result is shown
24
+ * in (null for a tool without one), and who may call the tool: `model` (the agent), `app` (an MCP App's view), or
25
+ * both (the default).
26
+ */
27
+ ui: Schema.optionalKey(
28
+ Schema.Struct({
29
+ resourceUri: Schema.NullOr(Schema.String),
30
+ visibility: Schema.Array(Schema.Literals(["model", "app"])),
31
+ }),
32
+ ),
33
+ })
34
+ export type RemoteTool = typeof RemoteTool.Type
35
+
36
+ /** One content of a resource the server answered (`resources/read`): text or base64 bytes, with its `_meta`. */
37
+ export const ResourceContent = Schema.Struct({
38
+ uri: Schema.String,
39
+ mimeType: Schema.NullOr(Schema.String),
40
+ text: Schema.NullOr(Schema.String),
41
+ blob: Schema.NullOr(Schema.String),
42
+ meta: Schema.NullOr(Schema.Record(Schema.String, Schema.Unknown)),
43
+ })
44
+ export type ResourceContent = typeof ResourceContent.Type
45
+
46
+ /** What a tool call answered: its content blocks as the server sent them, and whether the tool reported an error. */
47
+ export const ToolResult = Schema.Struct({
48
+ content: Schema.Array(Schema.Unknown),
49
+ structuredContent: Schema.NullOr(Schema.Unknown),
50
+ isError: Schema.Boolean,
51
+ })
52
+ export type ToolResult = typeof ToolResult.Type
53
+
54
+ export const ToolSourceFlags = Schema.Struct({
55
+ /** The protocol revision the connector speaks (MCP: `2025-06-18`). */
56
+ protocol: Schema.String,
57
+ })
58
+ export type ToolSourceFlags = typeof ToolSourceFlags.Type
59
+
60
+ export const ToolSourceContract = defineServiceContract({
61
+ name: "ToolSource",
62
+ kind: "capability",
63
+ version: "1.1.0",
64
+ description:
65
+ "An external server's tools over a kernel Connection whose endpoint is the server (a remote MCP server). Listing needs tools.read, calling tools.call; a call has effects others may see, so it is never retried after the server may have acted. Operations fail only with the standard capability errors; a tool's own failure is a result with isError.",
66
+ operations: {
67
+ listTools: defineOperation({
68
+ description: "The tools the server offers, one page at a time.",
69
+ input: Schema.Struct(PageRequest),
70
+ output: Schema.Struct({ tools: Schema.Array(RemoteTool), nextPageToken: Schema.NullOr(Schema.String) }),
71
+ errors: CapabilityError,
72
+ scopes: ["tools.read"],
73
+ }),
74
+ callTool: defineOperation({
75
+ description:
76
+ "Call one tool with its arguments (checked by the server against its input schema). A tool that fails answers isError: true with its content; a refused or unreachable server is a capability error.",
77
+ input: Schema.Struct({ name: Schema.String, arguments: Schema.Record(Schema.String, Schema.Unknown) }),
78
+ output: ToolResult,
79
+ errors: CapabilityError,
80
+ scopes: ["tools.call"],
81
+ // The server may act on the call (create an issue, send a message); a 5xx is not sent again.
82
+ effect: "external",
83
+ }),
84
+ readResource: defineOperation({
85
+ description:
86
+ "Read one resource the server offers by its URI (an MCP App's `ui://` view, say): its contents as the server sent them. An unknown resource is invalid input.",
87
+ input: Schema.Struct({ uri: Schema.String.check(Schema.isMaxLength(2000)) }),
88
+ output: Schema.Struct({ contents: Schema.Array(ResourceContent) }),
89
+ errors: CapabilityError,
90
+ scopes: ["tools.read"],
91
+ }),
92
+ },
93
+ types: { RemoteTool, ToolResult, ResourceContent, ToolSourceFlags },
94
+ })
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Versioning: module versions and record history. Documented in docs/contracts/versioning.md; conformance kit
3
+ * `@eloxiv/testing/conformance/Versioning`.
4
+ *
5
+ * **Module versions.** A module's manifest has a `version` and may declare the kernel versions it works with
6
+ * (`kernel`, a range such as `>=0.1.0 <2.0.0` or `^1.2.0`). Setup refuses, before it changes anything, a module
7
+ * whose range the kernel's version is outside, and a module older than the version installed (a downgrade); it
8
+ * records each module's installed version and every change of version (from, to, the kernel's version, when) in
9
+ * one transaction with the migrations and hardening, so the record never disagrees with the schema.
10
+ *
11
+ * **Record history.** An entity that opts in (`history: true` on its contract) gets an append-only history: every
12
+ * change an action makes to one of its records (insert, update, delete) is recorded with the record as the
13
+ * action left it (as it was, for a delete), the acting person, the action and its invocation id, in the
14
+ * action's transaction. Modules cannot write or change it. History is read through the record's own read policy,
15
+ * applied to the record's latest state (the current row, or the last recorded one once deleted): whoever may read
16
+ * the record may read its history, nobody else. Restore is an action: a module declares one (with its own policy)
17
+ * and its handler calls `ctx.history.restore`, which writes the chosen version back as that action, so the
18
+ * restore is authorised, audited and recorded in the history like any change.
19
+ *
20
+ * **Agent edit groups.** Every change an agent run makes is kept with the run, the conversation and the message that
21
+ * started it (a sub-agent's with its parent's): its record versions, and an autosave of each collaborative document
22
+ * it changed. `versioning.agentEdits` lists a group (one message's run, or every run of a conversation), and a
23
+ * revert undoes exactly that group's changes: a record's through `ctx.history.revert` in the module's own action, a
24
+ * document's through `collab.revert`; what someone changed since stays.
25
+ */
26
+ import { Schema } from "effect"
27
+ import { Forbidden, InvalidInput, Unauthenticated } from "../Errors.ts"
28
+ import { defineOperation, defineServiceContract } from "../Service.ts"
29
+
30
+ // ---------------------------------------------------------------------------------------------------------
31
+ // Module versions
32
+
33
+ export const ModuleVersion = Schema.Struct({
34
+ module: Schema.String,
35
+ version: Schema.String,
36
+ /** The kernel versions it declares it works with (`*` when it declares none). */
37
+ kernelRange: Schema.String,
38
+ installedAt: Schema.Number,
39
+ updatedAt: Schema.Number,
40
+ })
41
+ export type ModuleVersion = typeof ModuleVersion.Type
42
+
43
+ export const ModuleUpgrade = Schema.Struct({
44
+ module: Schema.String,
45
+ /** `null` for the first install. */
46
+ fromVersion: Schema.NullOr(Schema.String),
47
+ toVersion: Schema.String,
48
+ kernelVersion: Schema.String,
49
+ at: Schema.Number,
50
+ })
51
+ export type ModuleUpgrade = typeof ModuleUpgrade.Type
52
+
53
+ export const ModuleVersions = Schema.Struct({
54
+ kernelVersion: Schema.String,
55
+ modules: Schema.Array(ModuleVersion),
56
+ history: Schema.Array(ModuleUpgrade),
57
+ })
58
+
59
+ export { satisfiesRange } from "../Versions.ts"
60
+
61
+ // ---------------------------------------------------------------------------------------------------------
62
+ // Record history
63
+
64
+ export const HistoryOp = Schema.Literals(["insert", "update", "delete"])
65
+ export type HistoryOp = typeof HistoryOp.Type
66
+
67
+ /** The agent run a change was made by, and the conversation and message that started it (its edit group). */
68
+ export const AgentEdit = Schema.Struct({
69
+ runId: Schema.String,
70
+ conversationId: Schema.String,
71
+ /** The person's message that started the run (null for a run no message started). */
72
+ messageId: Schema.NullOr(Schema.String),
73
+ })
74
+ export type AgentEdit = typeof AgentEdit.Type
75
+
76
+ /** One version of a record. */
77
+ export const RecordVersion = Schema.Struct({
78
+ /** 1 for the first recorded change of the record, then 2, 3, ... */
79
+ version: Schema.Number,
80
+ op: HistoryOp,
81
+ /** The record as the change left it (as it was before a delete), as its table's columns. */
82
+ snapshot: Schema.Record(Schema.String, Schema.Unknown),
83
+ actorUserId: Schema.String,
84
+ action: Schema.String,
85
+ invocationId: Schema.String,
86
+ at: Schema.Number,
87
+ /** The agent run that made the change, when one did. */
88
+ agent: Schema.optionalKey(AgentEdit),
89
+ })
90
+ export type RecordVersion = typeof RecordVersion.Type
91
+
92
+ /**
93
+ * A record of an entity with history: `<module>.<entity>` (`notes.note`) and its primary key. The contract names
94
+ * it `RecordRef`; it is exported as `HistoryRecordRef` beside Files' `RecordRef`, which does not check the name.
95
+ */
96
+ export const HistoryRecordRef = Schema.Struct({
97
+ entity: Schema.String.check(Schema.isPattern(/^[a-z][a-z0-9_]*\.[A-Za-z][A-Za-z0-9_]*$/)),
98
+ id: Schema.String,
99
+ })
100
+ export type HistoryRecordRef = typeof HistoryRecordRef.Type
101
+
102
+ export const RecordHistory = Schema.Struct({
103
+ entity: Schema.String,
104
+ id: Schema.String,
105
+ /** Whether the record exists now (false once deleted). */
106
+ exists: Schema.Boolean,
107
+ versions: Schema.Array(RecordVersion),
108
+ })
109
+
110
+ export const VersionRef = Schema.Struct({
111
+ entity: HistoryRecordRef.fields.entity,
112
+ id: Schema.String,
113
+ version: Schema.Number.check(Schema.isGreaterThanOrEqualTo(1)),
114
+ })
115
+ export type VersionRef = typeof VersionRef.Type
116
+
117
+ /**
118
+ * An agent edit group: the changes of the run one message of a conversation started (with its sub-agents' runs),
119
+ * or, without `messageId`, of every run of the conversation (back to the start of the chat). Only the caller's own
120
+ * runs' changes belong to it.
121
+ */
122
+ export const AgentEditGroup = Schema.Struct({
123
+ conversationId: Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(256)),
124
+ messageId: Schema.optionalKey(Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(256))),
125
+ })
126
+ export type AgentEditGroup = typeof AgentEditGroup.Type
127
+
128
+ /** What an edit group changed that the caller may read now: records with history, and collaborative documents. */
129
+ export const AgentEdits = Schema.Struct({
130
+ conversationId: Schema.String,
131
+ messageId: Schema.NullOr(Schema.String),
132
+ /** Records of entities with history (`<module>.<entity>`), with the versions the group made. */
133
+ records: Schema.Array(
134
+ Schema.Struct({ entity: Schema.String, id: Schema.String, versions: Schema.Array(Schema.Number) }),
135
+ ),
136
+ /** Records' collaborative documents (their Cedar type), with how many of the group's runs changed each. */
137
+ documents: Schema.Array(Schema.Struct({ entity: Schema.String, id: Schema.String, runs: Schema.Number })),
138
+ })
139
+ export type AgentEdits = typeof AgentEdits.Type
140
+
141
+ /** A record revert's input (`ctx.history.revert`): the record and the group. */
142
+ export const RecordRevert = Schema.Struct({ ...HistoryRecordRef.fields, ...AgentEditGroup.fields })
143
+
144
+ /**
145
+ * What a revert did to a record: `reverted` (the group's changes undone, except the fields in `kept`), `unchanged`
146
+ * (the group did not change it, or nothing of its changes is left to undo), or `kept` (the group created or deleted
147
+ * the record and someone changed it since: left as it is).
148
+ */
149
+ export const RecordRevertResult = Schema.Struct({
150
+ id: Schema.String,
151
+ outcome: Schema.Literals(["reverted", "unchanged", "kept"]),
152
+ /** Fields the group changed that someone changed again since: they keep the later value. */
153
+ kept: Schema.Array(Schema.String),
154
+ })
155
+ export type RecordRevertResult = typeof RecordRevertResult.Type
156
+
157
+ /** The kernel actions (module `versioning`). */
158
+ export const VERSIONING_ACTIONS = {
159
+ modules: "versioning.modules",
160
+ history: "versioning.history",
161
+ version: "versioning.version",
162
+ agentEdits: "versioning.agentEdits",
163
+ } as const
164
+
165
+ const Errors = Schema.Union([Unauthenticated, Forbidden, InvalidInput])
166
+
167
+ export const VersioningContract = defineServiceContract({
168
+ name: "Versioning",
169
+ kind: "kernel",
170
+ version: "1.1.0",
171
+ description:
172
+ "Module versions (installed version, upgrade history, compatibility between a module's version and the " +
173
+ "kernel's, checked by setup before it changes anything) and record history for entities that opt in: an " +
174
+ "append-only history of every change an action makes, with the acting person, the action and its " +
175
+ "invocation id, readable through the record's own read policy; restore is a module's action calling " +
176
+ "ctx.history.restore. Agent edit groups: every change an agent run makes is kept with its run, conversation and " +
177
+ "message, listed by versioning.agentEdits and reverted, later changes kept, by ctx.history.revert.",
178
+ operations: {
179
+ modules: defineOperation({
180
+ description:
181
+ "versioning.modules: the kernel's version, each installed module's version and range, and every change of version.",
182
+ input: Schema.Struct({}),
183
+ output: ModuleVersions,
184
+ errors: Errors,
185
+ }),
186
+ history: defineOperation({
187
+ description:
188
+ "versioning.history: a record's versions, oldest first, if the caller may read the record in its latest " +
189
+ "state (Forbidden otherwise, and for a record with no history: the two are not told apart).",
190
+ input: HistoryRecordRef,
191
+ output: RecordHistory,
192
+ errors: Errors,
193
+ }),
194
+ version: defineOperation({
195
+ description: "versioning.version: one version of a record, under the same rule.",
196
+ input: VersionRef,
197
+ output: RecordVersion,
198
+ errors: Errors,
199
+ }),
200
+ restore: defineOperation({
201
+ description:
202
+ "In process (ctx.history.restore, in a module's own action on its own entity): write a version back as " +
203
+ "that action, after checking the caller may read the record. The write is authorised by the action's " +
204
+ "policy like any other and recorded as a new version.",
205
+ input: VersionRef,
206
+ output: Schema.Struct({ id: Schema.String, restoredVersion: Schema.Number }),
207
+ errors: Errors,
208
+ }),
209
+ agentEdits: defineOperation({
210
+ description:
211
+ "versioning.agentEdits: what one of the caller's agent edit groups (a message's run, or a whole " +
212
+ "conversation's runs) changed, among the records and documents the caller may read now.",
213
+ input: AgentEditGroup,
214
+ output: AgentEdits,
215
+ errors: Errors,
216
+ }),
217
+ revert: defineOperation({
218
+ description:
219
+ "In process (ctx.history.revert, in a module's own action on its own entity): undo the group's changes to " +
220
+ "a record, field by field, as that action (its policy decides); a field someone changed since keeps its " +
221
+ "value, a record the group created or deleted that someone changed since is kept. Recorded as a new version.",
222
+ input: RecordRevert,
223
+ output: RecordRevertResult,
224
+ errors: Errors,
225
+ }),
226
+ },
227
+ types: {
228
+ ModuleVersion,
229
+ ModuleUpgrade,
230
+ RecordVersion,
231
+ RecordRef: HistoryRecordRef,
232
+ HistoryOp,
233
+ AgentEdit,
234
+ AgentEditGroup,
235
+ AgentEdits,
236
+ },
237
+ })