@eloxiv/contracts 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +888 -0
  204. package/dist/contracts/LocalClient.d.ts.map +1 -0
  205. package/dist/contracts/LocalClient.js +429 -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 +1298 -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 +6657 -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 +620 -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,192 @@
1
+ /**
2
+ * Daemon (decision 7): the device daemon and its kernel side. Pairing a device to a person (or a service
3
+ * principal) in an organisation; custody of the device credential (OS secure storage, or a 0600 file); a
4
+ * loopback relay that exposes Eloxiv actions to local clients and local agent harnesses without ever showing
5
+ * them the kernel credential; turns run by local harnesses (Claude Code, Codex) on the person's own
6
+ * subscriptions; and a headless runner that serves turns addressed to it from the browser and from scheduled
7
+ * jobs. See docs/contracts/daemon.md.
8
+ *
9
+ * Operations are of three kinds: the kernel's device endpoints (the device credential, or a pairing's poll
10
+ * secret), the kernel's management operations (a signed-in person) and actions (`devices.sendTurn`,
11
+ * `devices.cancelTurn`, through the one invocation path), and the daemon's own loopback surface.
12
+ */
13
+ import { Schema } from "effect";
14
+ import { AppendedTurnEvents, AppendTurnEvents, CompletedTurn, CompleteTurn, DaemonHealth, DaemonStatus, DeviceInfo, HarnessEvent, HarnessKind, HarnessStatus, NextTurn, NextTurnRequest, PairingConfirm, PairingDecided, PairingDecision, PairingPoll, PairingPollResult, PairingRequest, PairingRequestLocal, PairingResult, PairingStart, PairingStarted, RelaySession, RelaySessionRequest, SendTurn, TurnEvent, TurnLeaseLost, TurnRecord, TurnStatus, TurnUsage, TurnView, } from "../Devices.js";
15
+ import { ConsentRequired, Forbidden, InvalidInput, Unauthenticated } from "../Errors.js";
16
+ import { defineOperation, defineServiceContract } from "../Service.js";
17
+ const AuthErrors = Schema.Union([Unauthenticated, Forbidden, InvalidInput]);
18
+ /** A harness turn the daemon runs locally (desktop) or for a claimed kernel turn (runner). */
19
+ export const HarnessTurn = Schema.Struct({
20
+ harness: HarnessKind,
21
+ prompt: Schema.String,
22
+ cwd: Schema.NullOr(Schema.String),
23
+ model: Schema.NullOr(Schema.String),
24
+ timeoutMs: Schema.Number,
25
+ actions: Schema.optionalKey(Schema.NullOr(Schema.Array(Schema.String))),
26
+ workspaceTools: Schema.optionalKey(Schema.Boolean),
27
+ });
28
+ export const HarnessOutcome = Schema.Struct({
29
+ outcome: Schema.Literals(["succeeded", "failed", "cancelled", "timed-out"]),
30
+ result: Schema.NullOr(Schema.String),
31
+ usage: Schema.NullOr(TurnUsage),
32
+ error: Schema.NullOr(Schema.String),
33
+ events: Schema.Array(HarnessEvent),
34
+ });
35
+ export const Daemon = defineServiceContract({
36
+ name: "Daemon",
37
+ kind: "kernel",
38
+ version: "1.1.0",
39
+ description: "The device daemon: pairing, token custody, the loopback relay, local agent harnesses on the person's own subscriptions, and the headless runner, with the kernel's device endpoints and turn queue.",
40
+ operations: {
41
+ // --- Kernel: pairing ----------------------------------------------------------------------------------------
42
+ startPairing: defineOperation({
43
+ description: "POST /kernel/device/pair/start (no credential; rate limited per address): start pairing a device. Returns a user code to show and a poll secret only the daemon holds. Codes expire after 10 minutes.",
44
+ input: PairingRequest,
45
+ output: PairingStarted,
46
+ errors: Schema.Union([InvalidInput, Forbidden]),
47
+ }),
48
+ pollPairing: defineOperation({
49
+ description: "POST /kernel/device/pair/poll: the pairing's state. Once a person confirmed the code, returns the device credential exactly once; a later poll, a wrong poll secret or an expired pairing is refused.",
50
+ input: PairingPoll,
51
+ output: PairingPollResult,
52
+ errors: Schema.Union([InvalidInput]),
53
+ }),
54
+ confirmPairing: defineOperation({
55
+ description: "POST /kernel/devices/confirmPairing (a signed-in person): approve a user code in the caller's organisation, pairing the device to the caller, or with principalId to a service principal (needs eloxiv.machine.manage). Wrong codes count against the caller; a used or expired code is refused. Audited.",
56
+ input: PairingDecision,
57
+ output: PairingDecided,
58
+ errors: AuthErrors,
59
+ }),
60
+ denyPairing: defineOperation({
61
+ description: "POST /kernel/devices/denyPairing (a signed-in person): refuse a user code. Audited.",
62
+ input: PairingDecision,
63
+ output: PairingDecided,
64
+ errors: AuthErrors,
65
+ }),
66
+ deviceStatus: defineOperation({
67
+ description: "GET /kernel/device/me (the device credential): the device as the kernel sees it. A revoked device's credential is refused (401) from its next request.",
68
+ input: Schema.Struct({}),
69
+ output: DeviceInfo,
70
+ errors: Schema.Union([Unauthenticated]),
71
+ }),
72
+ issueRelaySession: defineOperation({
73
+ description: "POST /kernel/device/relay-session (the device credential): an agent session for the device's subject, bound to the device (revoking the device ends it), for a local harness. Every call made with it is agent-originated, so consent applies.",
74
+ input: RelaySessionRequest,
75
+ output: RelaySession,
76
+ errors: Schema.Union([Unauthenticated, Forbidden, InvalidInput]),
77
+ }),
78
+ // --- Kernel: turns ------------------------------------------------------------------------------------------
79
+ sendTurn: defineOperation({
80
+ description: "Action devices.sendTurn (every surface; typed client, HTTP, MCP, agent tools, scheduled jobs): queue a turn for one of the caller's devices. Only the device's subject may address it; an agent-originated call needs consent. The request is a durable workflow (eloxiv.device-turn).",
81
+ input: SendTurn,
82
+ output: Schema.Struct({ turnId: Schema.String }),
83
+ errors: Schema.Union([Unauthenticated, Forbidden, InvalidInput, ConsentRequired]),
84
+ }),
85
+ cancelTurn: defineOperation({
86
+ description: "Action devices.cancelTurn: cancel a turn that has not finished; a running harness is stopped.",
87
+ input: Schema.Struct({ id: Schema.String }),
88
+ output: Schema.Struct({ id: Schema.String, status: TurnStatus }),
89
+ errors: AuthErrors,
90
+ }),
91
+ getTurn: defineOperation({
92
+ description: "POST /kernel/devices/getTurn (a signed-in person): a turn and its events, for its requester or the device's subject.",
93
+ input: Schema.Struct({ id: Schema.String }),
94
+ output: TurnView,
95
+ errors: AuthErrors,
96
+ }),
97
+ nextTurn: defineOperation({
98
+ description: "POST /kernel/device/turns/next (the device credential): claim the oldest queued turn addressed to this device, waiting up to waitMs. fresh: true (the first call after the daemon starts) requeues turns this device still held, so a restarted runner takes them again as a new attempt.",
99
+ input: NextTurnRequest,
100
+ output: NextTurn,
101
+ errors: Schema.Union([Unauthenticated]),
102
+ }),
103
+ appendTurnEvents: defineOperation({
104
+ description: "POST /kernel/device/turns/events (the device credential, the turn's lease): append harness events (idempotent by attempt and sequence number) and renew the lease. stop: true tells the runner to stop the harness.",
105
+ input: AppendTurnEvents,
106
+ output: AppendedTurnEvents,
107
+ errors: Schema.Union([Unauthenticated, TurnLeaseLost]),
108
+ }),
109
+ completeTurn: defineOperation({
110
+ description: "POST /kernel/device/turns/complete (the device credential, the turn's lease): settle the turn once. Repeating the report with the same lease is answered duplicate: true and changes nothing; a report under a lease that no longer holds the turn is TurnLeaseLost.",
111
+ input: CompleteTurn,
112
+ output: CompletedTurn,
113
+ errors: Schema.Union([Unauthenticated, TurnLeaseLost]),
114
+ }),
115
+ // --- Daemon: loopback ---------------------------------------------------------------------------------------
116
+ health: defineOperation({
117
+ description: "GET /health on the daemon (no credential): liveness and whether it is paired.",
118
+ input: Schema.Struct({}),
119
+ output: DaemonHealth,
120
+ errors: Schema.Never,
121
+ }),
122
+ status: defineOperation({
123
+ description: "GET /status on the daemon (a local client): its mode, the kernel pairing (never the credential), the secret store in use and the harnesses with their login state.",
124
+ input: Schema.Struct({}),
125
+ output: DaemonStatus,
126
+ errors: Schema.Union([Unauthenticated]),
127
+ }),
128
+ startLocalPairing: defineOperation({
129
+ description: "POST /local/pair/start on the daemon: ask to pair a local client (a browser extension, a CLI). The host approves the request (GET /local/pairings, POST /local/pairings/<id>/approve, or `eloxiv-daemon approve-client`) and shows the person its ten-character code, never this response or the log. At most 5 pairings start per 10 minutes (429).",
130
+ input: PairingRequestLocal,
131
+ output: PairingStart,
132
+ errors: Schema.Union([Forbidden]),
133
+ }),
134
+ approveLocalPairing: defineOperation({
135
+ description: "POST /local/pairings/<id>/approve on the daemon (the host only): approve a pending local pairing; the answer carries its code, to show the person.",
136
+ input: Schema.Struct({ pairingId: Schema.String }),
137
+ output: Schema.Struct({ pairingId: Schema.String, code: Schema.String, clientName: Schema.String }),
138
+ errors: Schema.Union([Unauthenticated, Forbidden]),
139
+ }),
140
+ confirmLocalPairing: defineOperation({
141
+ description: "POST /local/pair/confirm on the daemon: exchange an approved pairing's code for a local client token. Codes expire after 5 minutes and work once; three wrong codes discard a pairing, and three wrong codes anywhere lock every confirmation out for exponentially longer (429).",
142
+ input: PairingConfirm,
143
+ output: PairingResult,
144
+ errors: Schema.Union([InvalidInput, Forbidden]),
145
+ }),
146
+ startKernelPairing: defineOperation({
147
+ description: "POST /kernel-pairing/start on the daemon (the host or a local client): start pairing this device with a kernel; returns the code for the person to confirm while signed in. The daemon polls and keeps the credential.",
148
+ input: Schema.Struct({ kernelUrl: Schema.String, name: Schema.optionalKey(Schema.String) }),
149
+ output: DaemonStatus,
150
+ errors: Schema.Union([Unauthenticated, InvalidInput]),
151
+ }),
152
+ relayAction: defineOperation({
153
+ description: "POST /relay/actions/<action> on the daemon (a local client): call an Eloxiv action through the kernel's invocation path with the device's credential (as the person) or, for a harness, its agent session (agent-originated). The response is the kernel's result envelope or error; it never contains a kernel credential.",
154
+ input: Schema.Unknown,
155
+ output: Schema.Unknown,
156
+ errors: Schema.Union([Unauthenticated, Forbidden]),
157
+ }),
158
+ mcp: defineOperation({
159
+ description: "POST /mcp on the daemon (a harness's per-turn token): the kernel's MCP tools, relayed with the turn's agent session. A runner's tool calls carry idempotency keys derived from the turn, so a re-run attempt replays instead of repeating a side effect.",
160
+ input: Schema.Unknown,
161
+ output: Schema.Unknown,
162
+ errors: Schema.Union([Unauthenticated]),
163
+ }),
164
+ harnesses: defineOperation({
165
+ description: "GET /harnesses on the daemon (a local client): the installed harness CLIs, their versions and whether each is signed in.",
166
+ input: Schema.Struct({}),
167
+ output: Schema.Array(HarnessStatus),
168
+ errors: Schema.Union([Unauthenticated]),
169
+ }),
170
+ runTurn: defineOperation({
171
+ description: "POST /turns on the daemon (a local client): run a turn with a local harness now, streaming its events (server-sent events), with the Eloxiv actions as MCP tools through the relay. Honours cancellation (closing the request) and the timeout.",
172
+ input: HarnessTurn,
173
+ output: HarnessOutcome,
174
+ errors: Schema.Union([Unauthenticated, InvalidInput]),
175
+ }),
176
+ },
177
+ types: {
178
+ DeviceInfo,
179
+ PairingRequest,
180
+ PairingStarted,
181
+ PairingPollResult,
182
+ TurnRecord,
183
+ TurnEvent,
184
+ TurnUsage,
185
+ HarnessEvent,
186
+ HarnessStatus,
187
+ HarnessTurn,
188
+ HarnessOutcome,
189
+ DaemonStatus,
190
+ },
191
+ });
192
+ //# sourceMappingURL=Daemon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Daemon.js","sourceRoot":"","sources":["../../src/contracts/Daemon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EACb,QAAQ,EACR,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,GACT,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACxF,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAEtE,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,eAAe,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAA;AAE3E,8FAA8F;AAC9F,MAAM,CAAC,MAAM,WAAW,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ction a handler or subscriber sees, and the roles
3
+ * it runs as. Documented in docs/contracts/db-tx.md; conformance kit
4
+ * `@eloxiv/testing/conformance/DbTx`.
5
+ */
6
+ import { Schema } from "effect";
7
+ import { ActionFailed, Forbidden } from "../Errors.ts";
8
+ /** What an action handler is given besides its input (`HandlerContext` in `@eloxiv/kernel`). */
9
+ export declare const HandlerContextRecord: Schema.Struct<{
10
+ readonly actor: Schema.Struct<{
11
+ readonly userId: Schema.String;
12
+ readonly orgId: Schema.String;
13
+ readonly email: Schema.String;
14
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
15
+ readonly roles: Schema.$Array<Schema.String>;
16
+ readonly groups: Schema.$Array<Schema.String>;
17
+ readonly permissions: Schema.$Array<Schema.String>;
18
+ }>;
19
+ /** The invocation's id: its audit record and the outbox events it writes carry it. */
20
+ readonly invocationId: Schema.String;
21
+ }>;
22
+ export type HandlerContextRecord = typeof HandlerContextRecord.Type;
23
+ /** What an outbox subscriber is given besides the event payload. */
24
+ export declare const SubscriberContextRecord: Schema.Struct<{
25
+ /** The event's id: subscribers deduplicate effects outside the database on it. */
26
+ readonly eventId: Schema.String;
27
+ /** The event's organisation, the only one the subscriber may write in. */
28
+ readonly orgId: Schema.String;
29
+ }>;
30
+ export type SubscriberContextRecord = typeof SubscriberContextRecord.Type;
31
+ /** A module's database identity: a schema and two NOLOGIN roles. */
32
+ export declare const ModuleRoles: Schema.Struct<{
33
+ readonly module: Schema.String;
34
+ /** Postgres schema the module owns (default: the module's name). */
35
+ readonly schema: Schema.String;
36
+ /** `eloxiv_mod_<module>`: handlers and subscribers run as it (`SET LOCAL ROLE`). Plain DML on its own tables. */
37
+ readonly runtimeRole: Schema.String;
38
+ /** `eloxiv_own_<module>`: owns the schema and tables; used only by migrations. */
39
+ readonly ownerRole: Schema.String;
40
+ }>;
41
+ export type ModuleRoles = typeof ModuleRoles.Type;
42
+ /** Who acts in the current transaction, read by the generated row-level security policies. */
43
+ export declare const InvocationContext: Schema.Struct<{
44
+ /** The acting user's id, or `$system` for an outbox subscriber. */
45
+ readonly actor: Schema.String;
46
+ readonly org: Schema.String;
47
+ /** The action's name, or `$subscriber`. */
48
+ readonly action: Schema.String;
49
+ }>;
50
+ export type InvocationContext = typeof InvocationContext.Type;
51
+ /** One row a transaction inserted, updated or deleted in a module table (the write log the kernel checks). */
52
+ export declare const WriteLogEntry: Schema.Struct<{
53
+ readonly schema: Schema.String;
54
+ readonly table: Schema.String;
55
+ /** The row's primary key as text; null for a table without a single-column key (refused by the check). */
56
+ readonly pk: Schema.NullOr<Schema.String>;
57
+ readonly op: Schema.Literals<readonly ["INSERT", "UPDATE", "DELETE"]>;
58
+ }>;
59
+ export type WriteLogEntry = typeof WriteLogEntry.Type;
60
+ export declare const SqlStatement: Schema.Struct<{
61
+ /** SQL text with `$1`-style placeholders. */
62
+ readonly text: Schema.String;
63
+ readonly params: Schema.$Array<Schema.Unknown>;
64
+ }>;
65
+ export type SqlStatement = typeof SqlStatement.Type;
66
+ export declare const EmittedEvent: Schema.Struct<{
67
+ /** The event contract's type, e.g. `hello.greeted`. */
68
+ readonly type: Schema.String;
69
+ /** Encoded with the event contract's payload schema. */
70
+ readonly payload: Schema.Unknown;
71
+ }>;
72
+ export declare const DbTxContract: import("../Service.ts").ServiceContract<"DbTx", {
73
+ readonly sql: {
74
+ description: string;
75
+ input: Schema.Struct<{
76
+ /** SQL text with `$1`-style placeholders. */
77
+ readonly text: Schema.String;
78
+ readonly params: Schema.$Array<Schema.Unknown>;
79
+ }>;
80
+ output: Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>;
81
+ errors: Schema.Union<readonly [typeof Forbidden, typeof ActionFailed]>;
82
+ };
83
+ readonly emit: {
84
+ readonly description: "Write an event to the outbox in the same transaction: it exists exactly when the call commits (see Outbox).";
85
+ readonly input: Schema.Struct<{
86
+ /** The event contract's type, e.g. `hello.greeted`. */
87
+ readonly type: Schema.String;
88
+ /** Encoded with the event contract's payload schema. */
89
+ readonly payload: Schema.Unknown;
90
+ }>;
91
+ readonly output: Schema.Struct<{}>;
92
+ readonly errors: Schema.Never;
93
+ };
94
+ }, {
95
+ readonly HandlerContext: Schema.Struct<{
96
+ readonly actor: Schema.Struct<{
97
+ readonly userId: Schema.String;
98
+ readonly orgId: Schema.String;
99
+ readonly email: Schema.String;
100
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
101
+ readonly roles: Schema.$Array<Schema.String>;
102
+ readonly groups: Schema.$Array<Schema.String>;
103
+ readonly permissions: Schema.$Array<Schema.String>;
104
+ }>;
105
+ /** The invocation's id: its audit record and the outbox events it writes carry it. */
106
+ readonly invocationId: Schema.String;
107
+ }>;
108
+ readonly SubscriberContext: Schema.Struct<{
109
+ /** The event's id: subscribers deduplicate effects outside the database on it. */
110
+ readonly eventId: Schema.String;
111
+ /** The event's organisation, the only one the subscriber may write in. */
112
+ readonly orgId: Schema.String;
113
+ }>;
114
+ readonly ModuleRoles: Schema.Struct<{
115
+ readonly module: Schema.String;
116
+ /** Postgres schema the module owns (default: the module's name). */
117
+ readonly schema: Schema.String;
118
+ /** `eloxiv_mod_<module>`: handlers and subscribers run as it (`SET LOCAL ROLE`). Plain DML on its own tables. */
119
+ readonly runtimeRole: Schema.String;
120
+ /** `eloxiv_own_<module>`: owns the schema and tables; used only by migrations. */
121
+ readonly ownerRole: Schema.String;
122
+ }>;
123
+ readonly InvocationContext: Schema.Struct<{
124
+ /** The acting user's id, or `$system` for an outbox subscriber. */
125
+ readonly actor: Schema.String;
126
+ readonly org: Schema.String;
127
+ /** The action's name, or `$subscriber`. */
128
+ readonly action: Schema.String;
129
+ }>;
130
+ readonly WriteLogEntry: Schema.Struct<{
131
+ readonly schema: Schema.String;
132
+ readonly table: Schema.String;
133
+ /** The row's primary key as text; null for a table without a single-column key (refused by the check). */
134
+ readonly pk: Schema.NullOr<Schema.String>;
135
+ readonly op: Schema.Literals<readonly ["INSERT", "UPDATE", "DELETE"]>;
136
+ }>;
137
+ readonly SqlStatement: Schema.Struct<{
138
+ /** SQL text with `$1`-style placeholders. */
139
+ readonly text: Schema.String;
140
+ readonly params: Schema.$Array<Schema.Unknown>;
141
+ }>;
142
+ readonly EmittedEvent: Schema.Struct<{
143
+ /** The event contract's type, e.g. `hello.greeted`. */
144
+ readonly type: Schema.String;
145
+ /** Encoded with the event contract's payload schema. */
146
+ readonly payload: Schema.Unknown;
147
+ }>;
148
+ }>;
149
+ //# sourceMappingURL=DbTx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DbTx.d.ts","sourceRoot":"","sources":["../../src/contracts/DbTx.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAItD,gGAAgG;AAChG,eAAO,MAAM,oBAAoB;;;;;;;;;;IAE/B,sFAAsF;;EAEtF,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,OAAO,oBAAoB,CAAC,IAAI,CAAA;AAEnE,oEAAoE;AACpE,eAAO,MAAM,uBAAuB;IAClC,kFAAkF;;IAElF,0EAA0E;;EAE1E,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAC,IAAI,CAAA;AAEzE,oEAAoE;AACpE,eAAO,MAAM,WAAW;;IAEtB,oEAAoE;;IAEpE,iHAAiH;;IAEjH,kFAAkF;;EAElF,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB;IAC5B,mEAAmE;;;IAGnE,2CAA2C;;EAE3C,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAE7D,8GAA8G;AAC9G,eAAO,MAAM,aAAa;;;IAGxB,0GAA0G;;;EAG1G,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AAErD,eAAO,MAAM,YAAY;IACvB,6CAA6C;;;EAG7C,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAEnD,eAAO,MAAM,YAAY;IACvB,uDAAuD;;IAEvD,wDAAwD;;EAExD,CAAA;AAEF,eAAO,MAAM,YAAY;;QAWnB,WAAW;QAIX,KAAK;YA5BT,6CAA6C;;;;QA6BzC,MAAM;QACN,MAAM;;;;;YAvBV,uDAAuD;;YAEvD,wDAAwD;;;;;;;;;;;;;;;;;QAxDxD,sFAAsF;;;;QAOtF,kFAAkF;;QAElF,0EAA0E;;;;;QAQ1E,oEAAoE;;QAEpE,iHAAiH;;QAEjH,kFAAkF;;;;QAOlF,mEAAmE;;;QAGnE,2CAA2C;;;;;;QAS3C,0GAA0G;;;;;QAO1G,6CAA6C;;;;;QAO7C,uDAAuD;;QAEvD,wDAAwD;;;EAwCxD,CAAA"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Db/Tx: the database transaction a handler or subscriber sees, and the roles
3
+ * it runs as. Documented in docs/contracts/db-tx.md; conformance kit
4
+ * `@eloxiv/testing/conformance/DbTx`.
5
+ */
6
+ import { Schema } from "effect";
7
+ import { ActionFailed, Forbidden } from "../Errors.js";
8
+ import { Actor } from "../Records.js";
9
+ import { defineServiceContract } from "../Service.js";
10
+ /** What an action handler is given besides its input (`HandlerContext` in `@eloxiv/kernel`). */
11
+ export const HandlerContextRecord = Schema.Struct({
12
+ actor: Actor,
13
+ /** The invocation's id: its audit record and the outbox events it writes carry it. */
14
+ invocationId: Schema.String,
15
+ });
16
+ /** What an outbox subscriber is given besides the event payload. */
17
+ export const SubscriberContextRecord = Schema.Struct({
18
+ /** The event's id: subscribers deduplicate effects outside the database on it. */
19
+ eventId: Schema.String,
20
+ /** The event's organisation, the only one the subscriber may write in. */
21
+ orgId: Schema.String,
22
+ });
23
+ /** A module's database identity: a schema and two NOLOGIN roles. */
24
+ export const ModuleRoles = Schema.Struct({
25
+ module: Schema.String,
26
+ /** Postgres schema the module owns (default: the module's name). */
27
+ schema: Schema.String,
28
+ /** `eloxiv_mod_<module>`: handlers and subscribers run as it (`SET LOCAL ROLE`). Plain DML on its own tables. */
29
+ runtimeRole: Schema.String,
30
+ /** `eloxiv_own_<module>`: owns the schema and tables; used only by migrations. */
31
+ ownerRole: Schema.String,
32
+ });
33
+ /** Who acts in the current transaction, read by the generated row-level security policies. */
34
+ export const InvocationContext = Schema.Struct({
35
+ /** The acting user's id, or `$system` for an outbox subscriber. */
36
+ actor: Schema.String,
37
+ org: Schema.String,
38
+ /** The action's name, or `$subscriber`. */
39
+ action: Schema.String,
40
+ });
41
+ /** One row a transaction inserted, updated or deleted in a module table (the write log the kernel checks). */
42
+ export const WriteLogEntry = Schema.Struct({
43
+ schema: Schema.String,
44
+ table: Schema.String,
45
+ /** The row's primary key as text; null for a table without a single-column key (refused by the check). */
46
+ pk: Schema.NullOr(Schema.String),
47
+ op: Schema.Literals(["INSERT", "UPDATE", "DELETE"]),
48
+ });
49
+ export const SqlStatement = Schema.Struct({
50
+ /** SQL text with `$1`-style placeholders. */
51
+ text: Schema.String,
52
+ params: Schema.Array(Schema.Unknown),
53
+ });
54
+ export const EmittedEvent = Schema.Struct({
55
+ /** The event contract's type, e.g. `hello.greeted`. */
56
+ type: Schema.String,
57
+ /** Encoded with the event contract's payload schema. */
58
+ payload: Schema.Unknown,
59
+ });
60
+ export const DbTxContract = defineServiceContract({
61
+ name: "DbTx",
62
+ kind: "kernel",
63
+ version: "1.0.0",
64
+ description: "The transaction an action handler runs in: the invocation's own transaction, as the module's runtime role " +
65
+ "(`SET LOCAL ROLE`), under row-level security generated from the compiled policy, with every write to a " +
66
+ "module table recorded in a write log the kernel checks before commit. Subscribers run the same way in a " +
67
+ "savepoint per delivery, as a system actor limited to the event's organisation.",
68
+ operations: {
69
+ sql: {
70
+ description: "Run a statement in the invocation's transaction as the module's runtime role. Rows the caller may not " +
71
+ "read are filtered out; a statement that would insert or update a row the action may not write is " +
72
+ "refused by the database, and the call fails as `Forbidden`.",
73
+ input: SqlStatement,
74
+ output: Schema.Array(Schema.Record(Schema.String, Schema.Unknown)),
75
+ errors: Schema.Union([Forbidden, ActionFailed]),
76
+ },
77
+ emit: {
78
+ description: "Write an event to the outbox in the same transaction: it exists exactly when the call commits (see Outbox).",
79
+ input: EmittedEvent,
80
+ output: Schema.Struct({}),
81
+ errors: Schema.Never,
82
+ },
83
+ },
84
+ types: {
85
+ HandlerContext: HandlerContextRecord,
86
+ SubscriberContext: SubscriberContextRecord,
87
+ ModuleRoles,
88
+ InvocationContext,
89
+ WriteLogEntry,
90
+ SqlStatement,
91
+ EmittedEvent,
92
+ },
93
+ });
94
+ //# sourceMappingURL=DbTx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DbTx.js","sourceRoot":"","sources":["../../src/contracts/DbTx.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAErD,gGAAgG;AAChG,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,KAAK,EAAE,KAAK;IACZ,sFAAsF;IACtF,YAAY,EAAE,MAAM,CAAC,MAAM;CAC5B,CAAC,CAAA;AAGF,oEAAoE;AACpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC;IACnD,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC,MAAM;CACrB,CAAC,CAAA;AAGF,oEAAoE;AACpE,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,M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I,EAAE,MAAM;IACZ,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,OAAO;IAChB,WAAW,EACT,4GAA4G;QAC5G,yGAAyG;QACzG,0GAA0G;QAC1G,gFAAgF;IAClF,UAAU,EAAE;QACV,GAAG,EAAE;YACH,WAAW,EACT,wGAAwG;gBACxG,mGAAmG;gBACnG,6DAA6D;YAC/D,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YAClE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;SAChD;QACD,IAAI,EAAE;YACJ,WAAW,EACT,6GAA6G;YAC/G,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACzB,MAAM,EAAE,MAAM,CAAC,KAAK;SACrB;KACF;IACD,KAAK,EAAE;QACL,cAAc,EAAE,oBAAoB;QACpC,iBAAiB,EAAE,uBAAuB;QAC1C,WAAW;QACX,iBAAiB;QACjB,aAAa;QACb,YAAY;QACZ,YAAY;KACb;CACF,CAAC,CAAA"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Delegation: sub-agents with a narrower toolset and their own budget, run as child durable executions of the
3
+ * one agent; the result returns to the parent. There is no agent-to-agent protocol between modules, and a
4
+ * sub-agent never gains a tool or a permission its parent lacks. See docs/contracts/delegation.md.
5
+ */
6
+ import { Schema } from "effect";
7
+ import { ToolNotAllowed, UnknownRun } from "../Agent.ts";
8
+ export declare const DelegationContract: import("../Service.ts").ServiceContract<"Delegation", {
9
+ readonly delegate: import("../Service.ts").OperationContract<Schema.Struct<{
10
+ readonly task: Schema.String;
11
+ readonly tools: Schema.optionalKey<Schema.$Array<Schema.String>>;
12
+ readonly profile: Schema.optionalKey<Schema.String>;
13
+ readonly limits: Schema.optionalKey<Schema.Struct<{
14
+ readonly maxSteps: Schema.optionalKey<Schema.Number>;
15
+ readonly maxTokens: Schema.optionalKey<Schema.Number>;
16
+ readonly maxWallMs: Schema.optionalKey<Schema.Number>;
17
+ }>>;
18
+ }>, Schema.Struct<{
19
+ readonly runId: Schema.String;
20
+ readonly status: Schema.String;
21
+ readonly result: Schema.NullOr<Schema.String>;
22
+ }>, typeof ToolNotAllowed>;
23
+ readonly team: import("../Service.ts").OperationContract<Schema.Struct<{
24
+ readonly action: Schema.Literals<readonly ["spawn", "wait", "send", "list"]>;
25
+ readonly task: Schema.optionalKey<Schema.String>;
26
+ readonly name: Schema.optionalKey<Schema.String>;
27
+ readonly tools: Schema.optionalKey<Schema.$Array<Schema.String>>;
28
+ readonly profile: Schema.optionalKey<Schema.String>;
29
+ readonly limits: Schema.optionalKey<Schema.Struct<{
30
+ readonly maxSteps: Schema.optionalKey<Schema.Number>;
31
+ readonly maxTokens: Schema.optionalKey<Schema.Number>;
32
+ readonly maxWallMs: Schema.optionalKey<Schema.Number>;
33
+ }>>;
34
+ readonly seats: Schema.optionalKey<Schema.$Array<Schema.String>>;
35
+ readonly until: Schema.optionalKey<Schema.Literals<readonly ["all", "any"]>>;
36
+ readonly to: Schema.optionalKey<Schema.String>;
37
+ readonly text: Schema.optionalKey<Schema.String>;
38
+ }>, Schema.Struct<{
39
+ readonly seat: Schema.optionalKey<Schema.String>;
40
+ readonly finished: Schema.optionalKey<Schema.$Array<Schema.Struct<{
41
+ readonly seat: Schema.String;
42
+ readonly name: Schema.String;
43
+ readonly status: Schema.String;
44
+ readonly result: Schema.NullOr<Schema.String>;
45
+ readonly spent: Schema.Struct<{
46
+ readonly calls: Schema.Number;
47
+ readonly tokens: Schema.Number;
48
+ }>;
49
+ }>>>;
50
+ readonly messages: Schema.optionalKey<Schema.$Array<Schema.Struct<{
51
+ readonly from: Schema.String;
52
+ readonly name: Schema.String;
53
+ readonly text: Schema.String;
54
+ readonly seq: Schema.Number;
55
+ readonly sender: Schema.String;
56
+ }>>>;
57
+ }>, typeof ToolNotAllowed>;
58
+ readonly children: import("../Service.ts").OperationContract<Schema.Struct<{
59
+ readonly runId: Schema.String;
60
+ }>, Schema.$Array<Schema.Struct<{
61
+ readonly id: Schema.String;
62
+ readonly orgId: Schema.String;
63
+ readonly userId: Schema.String;
64
+ readonly conversationId: Schema.String;
65
+ readonly parentRunId: Schema.NullOr<Schema.String>;
66
+ readonly kind: Schema.Literals<readonly ["turn", "subagent", "job"]>;
67
+ readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "succeeded", "stopped", "failed", "cancelled"]>;
68
+ readonly stopReason: Schema.NullOr<Schema.Literals<readonly ["completed", "noop", "steps", "tokens", "wall-time", "budget", "cancelled", "model-error", "error", "processor"]>>;
69
+ readonly limits: Schema.Struct<{
70
+ readonly maxSteps: Schema.Number;
71
+ readonly maxTokens: Schema.Number;
72
+ readonly maxWallMs: Schema.Number;
73
+ }>;
74
+ readonly tools: Schema.NullOr<Schema.$Array<Schema.String>>;
75
+ readonly usage: Schema.Struct<{
76
+ readonly inputTokens: Schema.Number;
77
+ readonly outputTokens: Schema.Number;
78
+ }>;
79
+ readonly steps: Schema.Number;
80
+ readonly result: Schema.NullOr<Schema.String>;
81
+ readonly error: Schema.NullOr<Schema.String>;
82
+ readonly mode: Schema.optionalKey<Schema.Literals<readonly ["act", "plan"]>>;
83
+ readonly continuation: Schema.optionalKey<Schema.Struct<{
84
+ readonly of: Schema.String;
85
+ readonly previous: Schema.String;
86
+ readonly attempt: Schema.Number;
87
+ readonly automatic: Schema.Boolean;
88
+ }>>;
89
+ readonly verification: Schema.optionalKey<Schema.NullOr<Schema.Struct<{
90
+ readonly outcome: Schema.Literals<readonly ["passed", "retried", "annotated"]>;
91
+ readonly receipts: Schema.$Array<Schema.Struct<{
92
+ readonly tool: Schema.String;
93
+ readonly receipt: Schema.Struct<{
94
+ readonly changed: Schema.Boolean;
95
+ readonly verified: Schema.Union<readonly [Schema.Boolean, Schema.Literal<"unverified">]>;
96
+ readonly summary: Schema.String;
97
+ readonly subject: Schema.optionalKey<Schema.String>;
98
+ readonly checks: Schema.optionalKey<Schema.$Array<Schema.Struct<{
99
+ readonly id: Schema.String;
100
+ readonly ok: Schema.Boolean;
101
+ readonly detail: Schema.optionalKey<Schema.String>;
102
+ }>>>;
103
+ readonly warnings: Schema.optionalKey<Schema.$Array<Schema.String>>;
104
+ }>;
105
+ }>>;
106
+ readonly challengedBy: Schema.optionalKey<Schema.$Array<Schema.String>>;
107
+ }>>>;
108
+ readonly activity: Schema.optionalKey<Schema.Struct<{
109
+ readonly lastEventAt: Schema.NullOr<Schema.String>;
110
+ readonly stalled: Schema.Boolean;
111
+ }>>;
112
+ }>>, typeof UnknownRun>;
113
+ }, {
114
+ readonly ToolNotAllowed: typeof ToolNotAllowed;
115
+ readonly RunLimits: Schema.Struct<{
116
+ readonly maxSteps: Schema.Number;
117
+ readonly maxTokens: Schema.Number;
118
+ readonly maxWallMs: Schema.Number;
119
+ }>;
120
+ }>;
121
+ //# sourceMappingURL=Delegation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Delegation.d.ts","sourceRoot":"","sources":["../../src/contracts/Delegation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAkB,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiF7B,CAAA"}