@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,360 @@
1
+ /**
2
+ * Connections: one OAuth grant per (organisation, owner, provider account), with merged scopes, custody in
3
+ * Secrets, refresh, and the 401-versus-403 rule. See docs/contracts/connections.md.
4
+ */
5
+ import { Schema } from "effect"
6
+ import { Forbidden, InvalidInput, Unauthenticated } from "../Errors.ts"
7
+ import { defineOperation, defineServiceContract } from "../Service.ts"
8
+ import { CapabilityError, CapabilityName } from "./Capability.ts"
9
+ import { ApiOperation, ApiResponse } from "./HttpApi.ts"
10
+ import { RemoteTool, ResourceContent, ToolResult } from "./ToolSource.ts"
11
+
12
+ export const ConnectionStatus = Schema.Literals(["active", "needs-reauth", "disconnected"])
13
+ export type ConnectionStatus = typeof ConnectionStatus.Type
14
+
15
+ export const Connection = Schema.Struct({
16
+ id: Schema.String,
17
+ orgId: Schema.String,
18
+ ownerId: Schema.String,
19
+ /** The connector's name, e.g. `microsoft-graph`, `google`. */
20
+ provider: Schema.String,
21
+ /** The provider's stable id for the account (Entra object id, Google `sub`). */
22
+ accountId: Schema.String,
23
+ /** A human label for the account (its email address). */
24
+ accountLabel: Schema.String,
25
+ /** The provider scopes granted, merged across every consent on this Connection. */
26
+ scopes: Schema.Array(Schema.String),
27
+ status: ConnectionStatus,
28
+ /** Why it is not active (for example the provider's `invalid_grant`). */
29
+ statusReason: Schema.NullOr(Schema.String),
30
+ /**
31
+ * Owned by the organisation rather than by `ownerId` (who added it): used by the members, groups and modules it is
32
+ * granted to (`connections.grant`), never by anyone else.
33
+ */
34
+ shared: Schema.Boolean,
35
+ /** An endpoint Connection's endpoint (a remote MCP server, an HTTP API's base URL); null for a provider's. */
36
+ endpoint: Schema.NullOr(Schema.String),
37
+ /** How it authenticates: the connector's OAuth grant or a discovered one (`oauth`), a secret (`secret`), nothing. */
38
+ auth: Schema.Literals(["oauth", "secret", "none"]),
39
+ /** For a ToolSource Connection: the only tools listed and callable (null: every tool the server offers). */
40
+ tools: Schema.NullOr(Schema.Array(Schema.String)),
41
+ createdAt: Schema.String,
42
+ updatedAt: Schema.String,
43
+ })
44
+ export type Connection = typeof Connection.Type
45
+
46
+ /** What starting (or upgrading) a grant returns: where to send the person's browser. */
47
+ export const ConsentStart = Schema.Struct({
48
+ flowId: Schema.String,
49
+ /** `<kernel>/connections/authorize?flow=<id>`: opened in a browser signed in as the same person. */
50
+ authorizeUrl: Schema.String,
51
+ /** The provider scopes the consent asks for (merged with the Connection's when upgrading). */
52
+ scopes: Schema.Array(Schema.String),
53
+ expiresAt: Schema.String,
54
+ })
55
+ export type ConsentStart = typeof ConsentStart.Type
56
+
57
+ const Request = {
58
+ /** Abstract capabilities to grant (each maps to the connector's scopes for its operations). */
59
+ capabilities: Schema.optionalKey(Schema.Array(CapabilityName)),
60
+ /** Provider scopes to grant beyond the capabilities'. */
61
+ scopes: Schema.optionalKey(Schema.Array(Schema.String)),
62
+ /** Where the browser goes after the callback: a path on the app, or a trusted origin. */
63
+ returnTo: Schema.optionalKey(Schema.String),
64
+ /** Connect it for the organisation (with eloxiv.connections.manage): shared, used by those it is granted to. */
65
+ shared: Schema.optionalKey(Schema.Boolean),
66
+ }
67
+
68
+ export const ConnectionsError = Schema.Union([Unauthenticated, Forbidden, InvalidInput])
69
+
70
+ /** How an endpoint Connection authenticates to its endpoint. A secret is named, never given: the kernel holds it. */
71
+ export const EndpointAuth = Schema.Union([
72
+ Schema.Struct({ kind: Schema.Literal("none") }),
73
+ Schema.Struct({
74
+ kind: Schema.Literal("secret"),
75
+ /** A secret of the caller (`user`) or of the organisation (`org`, with eloxiv.secrets.manage), put beforehand. */
76
+ scope: Schema.Literals(["user", "org"]),
77
+ name: Schema.String,
78
+ /** The request header it is sent in (default `authorization`). */
79
+ header: Schema.optionalKey(Schema.String),
80
+ /** What precedes it in the header (default `Bearer ` in `authorization`, nothing in any other header). */
81
+ prefix: Schema.optionalKey(Schema.String),
82
+ }),
83
+ Schema.Struct({
84
+ kind: Schema.Literal("oauth"),
85
+ /** Scopes to ask for (default: what the endpoint's metadata says it supports). */
86
+ scopes: Schema.optionalKey(Schema.Array(Schema.String)),
87
+ /** A client the authorization server issued you (default: registered dynamically). */
88
+ clientId: Schema.optionalKey(Schema.String),
89
+ /** That client's secret, as a secret of the caller or the organisation (as for `secret`). */
90
+ clientSecret: Schema.optionalKey(Schema.Struct({ scope: Schema.Literals(["user", "org"]), name: Schema.String })),
91
+ }),
92
+ ])
93
+ export type EndpointAuth = typeof EndpointAuth.Type
94
+
95
+ /** Who a shared Connection is granted to: every member, one member, a group, or a module (for its handlers). */
96
+ export const ConnectionGrantee = Schema.Union([
97
+ Schema.Struct({ kind: Schema.Literal("org") }),
98
+ Schema.Struct({ kind: Schema.Literal("user"), id: Schema.String }),
99
+ Schema.Struct({ kind: Schema.Literal("group"), id: Schema.String }),
100
+ Schema.Struct({ kind: Schema.Literal("module"), id: Schema.String }),
101
+ ])
102
+ export type ConnectionGrantee = typeof ConnectionGrantee.Type
103
+
104
+ export const ConnectionGrant = Schema.Struct({
105
+ connectionId: Schema.String,
106
+ grantee: ConnectionGrantee,
107
+ grantedBy: Schema.String,
108
+ createdAt: Schema.String,
109
+ })
110
+ export type ConnectionGrant = typeof ConnectionGrant.Type
111
+
112
+ const ById = Schema.Struct({ connectionId: Schema.String })
113
+
114
+ /**
115
+ * An MCP App session (the MCP Apps extension, headless): one person's open view of a ToolSource tool's `ui://`
116
+ * resource, whose tool calls go through the kernel. `tools` are the tools the view may call: the Connection's exposed
117
+ * tools the server lets an app call (visibility `app`), never another person's and never past `closeApp` or
118
+ * `expiresAt`.
119
+ */
120
+ export const McpAppSession = Schema.Struct({
121
+ id: Schema.String,
122
+ connectionId: Schema.String,
123
+ /** The tool whose `ui://` resource the session shows. */
124
+ tool: Schema.String,
125
+ resourceUri: Schema.String,
126
+ tools: Schema.Array(Schema.String),
127
+ openedAt: Schema.String,
128
+ expiresAt: Schema.String,
129
+ })
130
+ export type McpAppSession = typeof McpAppSession.Type
131
+
132
+ const BySession = Schema.Struct({ sessionId: Schema.String.check(Schema.isMaxLength(100)) })
133
+
134
+ /** An HTTP request a connector makes over a Connection. */
135
+ export const ProviderRequest = Schema.Struct({
136
+ method: Schema.String,
137
+ url: Schema.String,
138
+ headers: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
139
+ body: Schema.optionalKey(Schema.String),
140
+ /** The provider scopes the operation needs (for the missing-scope report on a 403). */
141
+ scopes: Schema.Array(Schema.String),
142
+ })
143
+
144
+ export const ConnectionsContract = defineServiceContract({
145
+ name: "Connections",
146
+ kind: "kernel",
147
+ version: "1.4.0",
148
+ description:
149
+ "Kernel Connections: one OAuth grant per (organisation, owner, provider account). Requesting more scopes upgrades the same Connection by incremental consent and merges its scopes; a connector may leave a capability's sensitive scopes to incremental consent alone. A capability may offer bounded raw requests to its provider's API over the Connection, sent through the outbound destination policy. Tokens live in Secrets. The kernel refreshes proactively before expiry, single-flight across callers and processes (a database lock), safely for providers that rotate refresh tokens. A 401 refreshes once and retries; if that fails the Connection needs reauthorisation and its owner is notified. A 403 never refreshes and reports the missing scopes with an offer of incremental consent. A Connection is usable only while its owner is a member of its organisation, checked on every use. The OAuth client flow (authorization code with PKCE S256, state bound to the person's session) runs through kernel routes. The lifecycle operations are actions of the kernel's `connections` module, so they are on every surface, authorised and audited. Custody does not depend on any external service; an adapter seam (ExternalCustody) allows one.",
150
+ operations: {
151
+ connect: defineOperation({
152
+ description:
153
+ "Action `connections.connect`: start consent for a provider. Returns the kernel's authorize URL; the callback creates the Connection, or upgrades the caller's existing Connection for the same account (one Connection, merged scopes).",
154
+ input: Schema.Struct({ provider: Schema.String, ...Request }),
155
+ output: ConsentStart,
156
+ errors: ConnectionsError,
157
+ }),
158
+ reconnect: defineOperation({
159
+ description:
160
+ "Action `connections.reconnect`: consent again for one of the caller's Connections, adding scopes (incremental consent) or recovering one that needs reauthorisation. The callback must return the same provider account.",
161
+ input: Schema.Struct({ connectionId: Schema.String, ...Request }),
162
+ output: ConsentStart,
163
+ errors: ConnectionsError,
164
+ }),
165
+ disconnect: defineOperation({
166
+ description:
167
+ "Action `connections.disconnect`: end one of the caller's Connections (an administrator with eloxiv.connections.manage may end any in the organisation). Its tokens are deleted from Secrets at once; it is never used again.",
168
+ input: Schema.Struct({ connectionId: Schema.String }),
169
+ output: Schema.Struct({ connectionId: Schema.String }),
170
+ errors: ConnectionsError,
171
+ }),
172
+ list: defineOperation({
173
+ description:
174
+ "Action `connections.list`: the caller's Connections in the organisation they act in (all of the organisation's with eloxiv.connections.manage). Never tokens.",
175
+ input: Schema.Struct({}),
176
+ output: Schema.Struct({ connections: Schema.Array(Connection) }),
177
+ errors: ConnectionsError,
178
+ }),
179
+ add: defineOperation({
180
+ description:
181
+ "Action `connections.add`: add (or update) a Connection of an endpoint connector (`mcp`, `http-openapi`) to an endpoint the caller names. The endpoint must be https to a public address (or a host the deployment allows); the kernel checks it on every request. With `auth.kind: oauth` the endpoint's authorization server is discovered and a client registered, and `consent` is the consent to open; otherwise the Connection is active at once. Adding the same endpoint again updates it.",
182
+ input: Schema.Struct({
183
+ provider: Schema.String,
184
+ endpoint: Schema.String,
185
+ label: Schema.optionalKey(Schema.String),
186
+ auth: EndpointAuth,
187
+ /** The connector's per-Connection options (an OpenAPI document's path, POSTs that only read). */
188
+ options: Schema.optionalKey(Schema.Unknown),
189
+ /** For a ToolSource Connection: the only tools to expose. */
190
+ tools: Schema.optionalKey(Schema.Array(Schema.String)),
191
+ shared: Schema.optionalKey(Schema.Boolean),
192
+ returnTo: Schema.optionalKey(Schema.String),
193
+ }),
194
+ output: Schema.Struct({ connection: Connection, consent: Schema.NullOr(ConsentStart) }),
195
+ errors: ConnectionsError,
196
+ }),
197
+ grant: defineOperation({
198
+ description:
199
+ "Action `connections.grant` (eloxiv.connections.manage): grant a shared Connection to every member, a member, a group or a module. A member uses it through the kernel's actions only with a grant to them (or a group of theirs, or everyone); a module's handlers use it only with a grant to the module as well.",
200
+ input: Schema.Struct({ connectionId: Schema.String, grantee: ConnectionGrantee }),
201
+ output: ConnectionGrant,
202
+ errors: ConnectionsError,
203
+ }),
204
+ revoke: defineOperation({
205
+ description: "Action `connections.revoke` (eloxiv.connections.manage): end one grant of a shared Connection.",
206
+ input: Schema.Struct({ connectionId: Schema.String, grantee: ConnectionGrantee }),
207
+ output: ById,
208
+ errors: ConnectionsError,
209
+ }),
210
+ grants: defineOperation({
211
+ description: "Action `connections.grants` (eloxiv.connections.manage): a shared Connection's grants.",
212
+ input: ById,
213
+ output: Schema.Struct({ grants: Schema.Array(ConnectionGrant) }),
214
+ errors: ConnectionsError,
215
+ }),
216
+ tools: defineOperation({
217
+ description:
218
+ "Action `connections.tools`: the tools a ToolSource Connection the caller may use exposes (every page, at most 1000 tools; only those its `tools` allow).",
219
+ input: ById,
220
+ output: Schema.Struct({ tools: Schema.Array(RemoteTool) }),
221
+ errors: Schema.Union([ConnectionsError, CapabilityError]),
222
+ }),
223
+ callTool: defineOperation({
224
+ description:
225
+ "Action `connections.callTool`: call one of a ToolSource Connection's tools. An agent's call needs the person's consent; a tool outside the Connection's `tools` is refused before anything is sent.",
226
+ input: Schema.Struct({
227
+ connectionId: Schema.String,
228
+ name: Schema.String,
229
+ arguments: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)),
230
+ }),
231
+ output: ToolResult,
232
+ errors: Schema.Union([ConnectionsError, CapabilityError]),
233
+ }),
234
+ openApp: defineOperation({
235
+ description:
236
+ "Action `connections.openApp`: open an MCP App session for one of a ToolSource Connection's tools that declares a `ui://` resource (and that the Connection exposes): the resource as the server sent it (the client renders it, in its own sandbox), the tools the view may call, and the session the view's calls name.",
237
+ input: Schema.Struct({ connectionId: Schema.String, tool: Schema.String }),
238
+ output: Schema.Struct({
239
+ session: McpAppSession,
240
+ resource: ResourceContent,
241
+ tools: Schema.Array(RemoteTool),
242
+ }),
243
+ errors: Schema.Union([ConnectionsError, CapabilityError]),
244
+ }),
245
+ appCall: defineOperation({
246
+ description:
247
+ "Action `connections.appCall`: a tool call from an open MCP App session of the caller's, through the same path as `connections.callTool` (the Connection's grant and exposed tools checked on each call; an agent's call needs the person's consent). Refused, sending nothing, for a tool the session may not call, a session that is closed, expired or someone else's, and a Connection the caller may no longer use.",
248
+ input: Schema.Struct({
249
+ sessionId: Schema.String.check(Schema.isMaxLength(100)),
250
+ name: Schema.String,
251
+ arguments: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)),
252
+ }),
253
+ output: ToolResult,
254
+ errors: Schema.Union([ConnectionsError, CapabilityError]),
255
+ }),
256
+ closeApp: defineOperation({
257
+ description:
258
+ "Action `connections.closeApp`: close one of the caller's MCP App sessions; its calls are refused from then on.",
259
+ input: BySession,
260
+ output: BySession,
261
+ errors: ConnectionsError,
262
+ }),
263
+ apiCatalog: defineOperation({
264
+ description: "Action `connections.apiCatalog`: the operations of an HttpApi Connection's OpenAPI document.",
265
+ input: ById,
266
+ output: Schema.Struct({
267
+ title: Schema.NullOr(Schema.String),
268
+ operations: Schema.Array(ApiOperation),
269
+ truncated: Schema.Boolean,
270
+ }),
271
+ errors: Schema.Union([ConnectionsError, CapabilityError]),
272
+ }),
273
+ apiDescribe: defineOperation({
274
+ description: "Action `connections.apiDescribe`: one operation of an HttpApi Connection's OpenAPI document.",
275
+ input: Schema.Struct({ connectionId: Schema.String, operationId: Schema.String }),
276
+ output: Schema.Struct({
277
+ operation: ApiOperation,
278
+ description: Schema.NullOr(Schema.String),
279
+ parameters: Schema.Array(Schema.Unknown),
280
+ requestBody: Schema.NullOr(Schema.Unknown),
281
+ }),
282
+ errors: Schema.Union([ConnectionsError, CapabilityError]),
283
+ }),
284
+ apiRead: defineOperation({
285
+ description:
286
+ "Action `connections.apiRead`: a request that only reads over an HttpApi Connection (GET, HEAD, or a POST its options name as reading), bounded, with optional pagination.",
287
+ input: Schema.Struct({
288
+ connectionId: Schema.String,
289
+ method: Schema.Literals(["GET", "HEAD", "POST"]),
290
+ path: Schema.String,
291
+ query: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
292
+ headers: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
293
+ json: Schema.optionalKey(Schema.Unknown),
294
+ maxPages: Schema.optionalKey(Schema.Int),
295
+ }),
296
+ output: Schema.Struct({ pages: Schema.Array(ApiResponse) }),
297
+ errors: Schema.Union([ConnectionsError, CapabilityError]),
298
+ }),
299
+ apiWrite: defineOperation({
300
+ description:
301
+ "Action `connections.apiWrite`: a request that may change something over an HttpApi Connection. An agent's call needs the person's consent for each call.",
302
+ input: Schema.Struct({
303
+ connectionId: Schema.String,
304
+ method: Schema.Literals(["POST", "PUT", "PATCH", "DELETE"]),
305
+ path: Schema.String,
306
+ query: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
307
+ headers: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
308
+ json: Schema.optionalKey(Schema.Unknown),
309
+ }),
310
+ output: ApiResponse,
311
+ errors: Schema.Union([ConnectionsError, CapabilityError]),
312
+ }),
313
+ authorize: defineOperation({
314
+ description:
315
+ "GET /connections/authorize?flow=<id>, in the person's signed-in browser: binds a fresh state and PKCE verifier (S256) to their session and redirects to the provider's authorization endpoint.",
316
+ input: Schema.Struct({ flow: Schema.String }),
317
+ output: Schema.Struct({ location: Schema.String }),
318
+ errors: ConnectionsError,
319
+ }),
320
+ callback: defineOperation({
321
+ description:
322
+ "GET /connections/callback?code=&state= (the registered redirect URI): the state must be unused, unexpired and bound to the same session; the code is exchanged with the verifier; the account is identified; the Connection is created or upgraded in one transaction and its tokens stored in Secrets. Redirects to `returnTo` with `connection=<id>`.",
323
+ input: Schema.Struct({
324
+ code: Schema.optionalKey(Schema.String),
325
+ state: Schema.String,
326
+ error: Schema.optionalKey(Schema.String),
327
+ }),
328
+ output: Schema.Struct({ connectionId: Schema.String }),
329
+ errors: ConnectionsError,
330
+ }),
331
+ request: defineOperation({
332
+ description:
333
+ "In process, for connectors: an HTTP request over a Connection. The kernel checks the owner's membership and the Connection's status, applies its backpressure (Metering), attaches a fresh access token (refreshing proactively), and maps the provider's answer: a 401 refreshes once and retries, a 403 reports missing scopes, 429 and 503 honour Retry-After.",
334
+ input: Schema.Struct({ connectionId: Schema.String, request: ProviderRequest }),
335
+ output: Schema.Struct({
336
+ status: Schema.Int,
337
+ headers: Schema.Record(Schema.String, Schema.String),
338
+ body: Schema.String,
339
+ }),
340
+ errors: CapabilityError,
341
+ }),
342
+ refresh: defineOperation({
343
+ description:
344
+ "In process: refresh a Connection's access token now (single-flight across processes). Used by `request`; exposed for tests and operators.",
345
+ input: Schema.Struct({ connectionId: Schema.String }),
346
+ output: Schema.Struct({ refreshed: Schema.Boolean, expiresAt: Schema.NullOr(Schema.String) }),
347
+ errors: CapabilityError,
348
+ }),
349
+ },
350
+ types: {
351
+ Connection,
352
+ ConnectionStatus,
353
+ ConsentStart,
354
+ ProviderRequest,
355
+ EndpointAuth,
356
+ ConnectionGrantee,
357
+ ConnectionGrant,
358
+ McpAppSession,
359
+ },
360
+ })
@@ -0,0 +1,35 @@
1
+ /**
2
+ * ContextAccounting: an inventory of everything a model call is sent (instructions, skills, memory, messages,
3
+ * tool results and tool definitions) with token counts per item, budgets per category, eviction and pinning.
4
+ * The inventory (the "context x-ray") adds up to exactly what the model is sent. See
5
+ * docs/contracts/context-accounting.md.
6
+ */
7
+ import { Schema } from "effect"
8
+ import { ContextCategory, ContextDirective, ContextInventory, ContextItem, EvictedItem, UnknownRun } from "../Agent.ts"
9
+ import { Forbidden, Unauthenticated } from "../Errors.ts"
10
+ import { defineOperation, defineServiceContract } from "../Service.ts"
11
+
12
+ export const ContextAccountingContract = defineServiceContract({
13
+ name: "ContextAccounting",
14
+ kind: "kernel",
15
+ version: "1.0.0",
16
+ description:
17
+ "The context x-ray: per model call, every item sent with its category, token count, pin state and source, totals against per-category budgets, and the items left out (over budget or evicted). Pinned items are kept whatever the budget; evicted items are left out until restored.",
18
+ operations: {
19
+ inventory: defineOperation({
20
+ description:
21
+ "The inventory of one model call of a run (the latest when `step` is omitted), for the run's owner. Its `total` is the sum of its items' tokens, and equals what was sent.",
22
+ input: Schema.Struct({ runId: Schema.String, step: Schema.optionalKey(Schema.Number) }),
23
+ output: ContextInventory,
24
+ errors: Schema.Union([Unauthenticated, UnknownRun]),
25
+ }),
26
+ direct: defineOperation({
27
+ description:
28
+ "Pin, evict or restore one item (`ref`) of a conversation's context (action `agent.directContext`): it applies from the next model call.",
29
+ input: Schema.Struct({ conversationId: Schema.String, ref: Schema.String, directive: ContextDirective }),
30
+ output: Schema.Struct({ ref: Schema.String, directive: ContextDirective }),
31
+ errors: Schema.Union([Unauthenticated, Forbidden]),
32
+ }),
33
+ },
34
+ types: { ContextCategory, ContextItem, EvictedItem, ContextInventory, ContextDirective },
35
+ })
@@ -0,0 +1,247 @@
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 {
15
+ AppendedTurnEvents,
16
+ AppendTurnEvents,
17
+ CompletedTurn,
18
+ CompleteTurn,
19
+ DaemonHealth,
20
+ DaemonStatus,
21
+ DeviceInfo,
22
+ HarnessEvent,
23
+ HarnessKind,
24
+ HarnessStatus,
25
+ NextTurn,
26
+ NextTurnRequest,
27
+ PairingConfirm,
28
+ PairingDecided,
29
+ PairingDecision,
30
+ PairingPoll,
31
+ PairingPollResult,
32
+ PairingRequest,
33
+ PairingRequestLocal,
34
+ PairingResult,
35
+ PairingStart,
36
+ PairingStarted,
37
+ RelaySession,
38
+ RelaySessionRequest,
39
+ SendTurn,
40
+ TurnEvent,
41
+ TurnLeaseLost,
42
+ TurnRecord,
43
+ TurnStatus,
44
+ TurnUsage,
45
+ TurnView,
46
+ } from "../Devices.ts"
47
+ import { ConsentRequired, Forbidden, InvalidInput, Unauthenticated } from "../Errors.ts"
48
+ import { defineOperation, defineServiceContract } from "../Service.ts"
49
+
50
+ const AuthErrors = Schema.Union([Unauthenticated, Forbidden, InvalidInput])
51
+
52
+ /** A harness turn the daemon runs locally (desktop) or for a claimed kernel turn (runner). */
53
+ export const HarnessTurn = Schema.Struct({
54
+ harness: HarnessKind,
55
+ prompt: Schema.String,
56
+ cwd: Schema.NullOr(Schema.String),
57
+ model: Schema.NullOr(Schema.String),
58
+ timeoutMs: Schema.Number,
59
+ actions: Schema.optionalKey(Schema.NullOr(Schema.Array(Schema.String))),
60
+ workspaceTools: Schema.optionalKey(Schema.Boolean),
61
+ })
62
+
63
+ export const HarnessOutcome = Schema.Struct({
64
+ outcome: Schema.Literals(["succeeded", "failed", "cancelled", "timed-out"]),
65
+ result: Schema.NullOr(Schema.String),
66
+ usage: Schema.NullOr(TurnUsage),
67
+ error: Schema.NullOr(Schema.String),
68
+ events: Schema.Array(HarnessEvent),
69
+ })
70
+
71
+ export const Daemon = defineServiceContract({
72
+ name: "Daemon",
73
+ kind: "kernel",
74
+ version: "1.1.0",
75
+ description:
76
+ "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.",
77
+ operations: {
78
+ // --- Kernel: pairing ----------------------------------------------------------------------------------------
79
+ startPairing: defineOperation({
80
+ description:
81
+ "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.",
82
+ input: PairingRequest,
83
+ output: PairingStarted,
84
+ errors: Schema.Union([InvalidInput, Forbidden]),
85
+ }),
86
+ pollPairing: defineOperation({
87
+ description:
88
+ "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.",
89
+ input: PairingPoll,
90
+ output: PairingPollResult,
91
+ errors: Schema.Union([InvalidInput]),
92
+ }),
93
+ confirmPairing: defineOperation({
94
+ description:
95
+ "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.",
96
+ input: PairingDecision,
97
+ output: PairingDecided,
98
+ errors: AuthErrors,
99
+ }),
100
+ denyPairing: defineOperation({
101
+ description: "POST /kernel/devices/denyPairing (a signed-in person): refuse a user code. Audited.",
102
+ input: PairingDecision,
103
+ output: PairingDecided,
104
+ errors: AuthErrors,
105
+ }),
106
+ deviceStatus: defineOperation({
107
+ description:
108
+ "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.",
109
+ input: Schema.Struct({}),
110
+ output: DeviceInfo,
111
+ errors: Schema.Union([Unauthenticated]),
112
+ }),
113
+ issueRelaySession: defineOperation({
114
+ description:
115
+ "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.",
116
+ input: RelaySessionRequest,
117
+ output: RelaySession,
118
+ errors: Schema.Union([Unauthenticated, Forbidden, InvalidInput]),
119
+ }),
120
+ // --- Kernel: turns ------------------------------------------------------------------------------------------
121
+ sendTurn: defineOperation({
122
+ description:
123
+ "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).",
124
+ input: SendTurn,
125
+ output: Schema.Struct({ turnId: Schema.String }),
126
+ errors: Schema.Union([Unauthenticated, Forbidden, InvalidInput, ConsentRequired]),
127
+ }),
128
+ cancelTurn: defineOperation({
129
+ description: "Action devices.cancelTurn: cancel a turn that has not finished; a running harness is stopped.",
130
+ input: Schema.Struct({ id: Schema.String }),
131
+ output: Schema.Struct({ id: Schema.String, status: TurnStatus }),
132
+ errors: AuthErrors,
133
+ }),
134
+ getTurn: defineOperation({
135
+ description:
136
+ "POST /kernel/devices/getTurn (a signed-in person): a turn and its events, for its requester or the device's subject.",
137
+ input: Schema.Struct({ id: Schema.String }),
138
+ output: TurnView,
139
+ errors: AuthErrors,
140
+ }),
141
+ nextTurn: defineOperation({
142
+ description:
143
+ "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.",
144
+ input: NextTurnRequest,
145
+ output: NextTurn,
146
+ errors: Schema.Union([Unauthenticated]),
147
+ }),
148
+ appendTurnEvents: defineOperation({
149
+ description:
150
+ "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.",
151
+ input: AppendTurnEvents,
152
+ output: AppendedTurnEvents,
153
+ errors: Schema.Union([Unauthenticated, TurnLeaseLost]),
154
+ }),
155
+ completeTurn: defineOperation({
156
+ description:
157
+ "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.",
158
+ input: CompleteTurn,
159
+ output: CompletedTurn,
160
+ errors: Schema.Union([Unauthenticated, TurnLeaseLost]),
161
+ }),
162
+ // --- Daemon: loopback ---------------------------------------------------------------------------------------
163
+ health: defineOperation({
164
+ description: "GET /health on the daemon (no credential): liveness and whether it is paired.",
165
+ input: Schema.Struct({}),
166
+ output: DaemonHealth,
167
+ errors: Schema.Never,
168
+ }),
169
+ status: defineOperation({
170
+ description:
171
+ "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.",
172
+ input: Schema.Struct({}),
173
+ output: DaemonStatus,
174
+ errors: Schema.Union([Unauthenticated]),
175
+ }),
176
+ startLocalPairing: defineOperation({
177
+ description:
178
+ "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).",
179
+ input: PairingRequestLocal,
180
+ output: PairingStart,
181
+ errors: Schema.Union([Forbidden]),
182
+ }),
183
+ approveLocalPairing: defineOperation({
184
+ description:
185
+ "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.",
186
+ input: Schema.Struct({ pairingId: Schema.String }),
187
+ output: Schema.Struct({ pairingId: Schema.String, code: Schema.String, clientName: Schema.String }),
188
+ errors: Schema.Union([Unauthenticated, Forbidden]),
189
+ }),
190
+ confirmLocalPairing: defineOperation({
191
+ description:
192
+ "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).",
193
+ input: PairingConfirm,
194
+ output: PairingResult,
195
+ errors: Schema.Union([InvalidInput, Forbidden]),
196
+ }),
197
+ startKernelPairing: defineOperation({
198
+ description:
199
+ "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.",
200
+ input: Schema.Struct({ kernelUrl: Schema.String, name: Schema.optionalKey(Schema.String) }),
201
+ output: DaemonStatus,
202
+ errors: Schema.Union([Unauthenticated, InvalidInput]),
203
+ }),
204
+ relayAction: defineOperation({
205
+ description:
206
+ "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.",
207
+ input: Schema.Unknown,
208
+ output: Schema.Unknown,
209
+ errors: Schema.Union([Unauthenticated, Forbidden]),
210
+ }),
211
+ mcp: defineOperation({
212
+ description:
213
+ "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.",
214
+ input: Schema.Unknown,
215
+ output: Schema.Unknown,
216
+ errors: Schema.Union([Unauthenticated]),
217
+ }),
218
+ harnesses: defineOperation({
219
+ description:
220
+ "GET /harnesses on the daemon (a local client): the installed harness CLIs, their versions and whether each is signed in.",
221
+ input: Schema.Struct({}),
222
+ output: Schema.Array(HarnessStatus),
223
+ errors: Schema.Union([Unauthenticated]),
224
+ }),
225
+ runTurn: defineOperation({
226
+ description:
227
+ "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.",
228
+ input: HarnessTurn,
229
+ output: HarnessOutcome,
230
+ errors: Schema.Union([Unauthenticated, InvalidInput]),
231
+ }),
232
+ },
233
+ types: {
234
+ DeviceInfo,
235
+ PairingRequest,
236
+ PairingStarted,
237
+ PairingPollResult,
238
+ TurnRecord,
239
+ TurnEvent,
240
+ TurnUsage,
241
+ HarnessEvent,
242
+ HarnessStatus,
243
+ HarnessTurn,
244
+ HarnessOutcome,
245
+ DaemonStatus,
246
+ },
247
+ })