@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
package/src/Devices.ts ADDED
@@ -0,0 +1,721 @@
1
+ /**
2
+ * Records of the device daemon (the Daemon and DeviceControl contracts): pairing a device to a person (or a
3
+ * service principal) in an organisation, the device credential's custody, the loopback relay's local clients,
4
+ * local agent harnesses (Claude Code, Codex) and the turns a headless runner serves, plus the kernel-provided
5
+ * `devices` module (turn requests are app data: they go through the one invocation path).
6
+ *
7
+ * See docs/contracts/daemon.md and docs/contracts/device-control.md.
8
+ */
9
+ import { Schema } from "effect"
10
+ import { PushSubscriptionInfo } from "./contracts/Host.ts"
11
+ import { defineAction, defineEvent } from "./Module.ts"
12
+
13
+ // --- Credentials and paths -------------------------------------------------------------------------------------
14
+
15
+ /** Opaque prefixes, recognisable to secret scanners: the device credential and a pairing's poll secret. */
16
+ export const DEVICE_CREDENTIAL_PREFIX = {
17
+ /** The device credential the kernel issues once a pairing is confirmed; the daemon keeps it in custody. */
18
+ device: "elxv_",
19
+ /** The secret a pending pairing is polled with (only the daemon that started the pairing has it). */
20
+ poll: "elxp_",
21
+ /** Local client tokens the daemon issues to loopback clients (never sent to the kernel). */
22
+ local: "elxl_",
23
+ } as const
24
+
25
+ /** Where the kernel serves devices (the daemon side uses the device credential; management a person's session). */
26
+ export const DEVICE_PATHS = {
27
+ pairStart: "/kernel/device/pair/start",
28
+ pairPoll: "/kernel/device/pair/poll",
29
+ me: "/kernel/device/me",
30
+ relaySession: "/kernel/device/relay-session",
31
+ turnsNext: "/kernel/device/turns/next",
32
+ turnsEvents: "/kernel/device/turns/events",
33
+ turnsComplete: "/kernel/device/turns/complete",
34
+ sessions: "/kernel/device/sessions",
35
+ commandsNext: "/kernel/device/commands/next",
36
+ commandsComplete: "/kernel/device/commands/complete",
37
+ commandsCheck: "/kernel/device/commands/check",
38
+ capabilities: "/kernel/device/capabilities",
39
+ push: "/kernel/device/push",
40
+ /** Management operations: `POST /kernel/devices/<operation>` with a person's session. */
41
+ manage: "/kernel/devices",
42
+ /** The page a person opens to confirm a pairing code (`verification_uri`). */
43
+ verify: "/kernel/devices/verify",
44
+ } as const
45
+
46
+ // --- Devices ----------------------------------------------------------------------------------------------------
47
+
48
+ /** A desktop daemon (beside the shell, usually the Tauri sidecar) or a headless runner on an always-on machine. */
49
+ export const DeviceKind = Schema.Literals(["desktop", "runner"])
50
+ export type DeviceKind = typeof DeviceKind.Type
51
+
52
+ /**
53
+ * The local agent harnesses an adapter exists for: Claude Code and Codex (their CLIs' JSON streams), OpenCode and
54
+ * any configured agent that speaks the Agent Client Protocol (`acp`).
55
+ */
56
+ export const HarnessKind = Schema.Literals(["claude-code", "codex", "opencode", "acp"])
57
+ export type HarnessKind = typeof HarnessKind.Type
58
+
59
+ /**
60
+ * What a device command acts on (DeviceControl): the daemon's **terminal** and the **files** of its workspace
61
+ * (served by the daemon itself), a **browser** (served by a paired browser-extension companion) and the
62
+ * **computer** (served by a paired computer-use companion). A daemon offers none unless it is started with them.
63
+ */
64
+ export const CommandKind = Schema.Literals(["terminal", "files", "browser", "computer"])
65
+ export type CommandKind = typeof CommandKind.Type
66
+
67
+ /**
68
+ * What a device can do: its harnesses, the command kinds it offers now (`commands`: enabled on the daemon and,
69
+ * for a browser or the computer, a companion connected), whether it refuses workspace tools (`toolsOnly`), and
70
+ * `computerUse` / `browserExtension`, true while their companion is connected.
71
+ */
72
+ export const DeviceCapabilities = Schema.Struct({
73
+ harnesses: Schema.Array(HarnessKind),
74
+ computerUse: Schema.Boolean,
75
+ browserExtension: Schema.Boolean,
76
+ commands: Schema.optionalKey(Schema.Array(CommandKind)),
77
+ toolsOnly: Schema.optionalKey(Schema.Boolean),
78
+ })
79
+ export type DeviceCapabilities = typeof DeviceCapabilities.Type
80
+
81
+ const Name = Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(100))
82
+
83
+ /** A paired device, as the kernel lists it (never its credential). */
84
+ export const DeviceInfo = Schema.Struct({
85
+ id: Schema.String,
86
+ orgId: Schema.String,
87
+ /** Whom the device acts for: a person (`user`) or an organisation's service principal (`service`). */
88
+ subject: Schema.String,
89
+ subjectKind: Schema.Literals(["user", "service"]),
90
+ /** The person who confirmed the pairing. */
91
+ pairedBy: Schema.String,
92
+ name: Schema.String,
93
+ kind: DeviceKind,
94
+ platform: Schema.String,
95
+ capabilities: DeviceCapabilities,
96
+ createdAt: Schema.String,
97
+ lastSeenAt: Schema.NullOr(Schema.String),
98
+ revokedAt: Schema.NullOr(Schema.String),
99
+ /** Whether the device registered a push subscription (`registerPush`); never the subscription itself. */
100
+ push: Schema.optionalKey(Schema.Boolean),
101
+ })
102
+ export type DeviceInfo = typeof DeviceInfo.Type
103
+
104
+ // --- Pairing (daemon <-> kernel) -------------------------------------------------------------------------------
105
+
106
+ /** What a daemon sends to start pairing: unauthenticated, rate limited per source address. */
107
+ export const PairingRequest = Schema.Struct({
108
+ name: Name,
109
+ kind: DeviceKind,
110
+ platform: Schema.String.check(Schema.isMaxLength(100)),
111
+ capabilities: DeviceCapabilities,
112
+ })
113
+ export type PairingRequest = typeof PairingRequest.Type
114
+
115
+ /**
116
+ * A started pairing (RFC 8628's shape): the daemon shows `userCode` (and `verificationUri`) and polls with
117
+ * `pairingId` and `pollSecret`; a signed-in person confirms the code on the kernel.
118
+ */
119
+ export const PairingStarted = Schema.Struct({
120
+ pairingId: Schema.String,
121
+ pollSecret: Schema.String,
122
+ userCode: Schema.String,
123
+ verificationUri: Schema.String,
124
+ verificationUriComplete: Schema.String,
125
+ expiresAt: Schema.String,
126
+ /** Seconds between polls. */
127
+ interval: Schema.Number,
128
+ })
129
+ export type PairingStarted = typeof PairingStarted.Type
130
+
131
+ export const PairingPoll = Schema.Struct({ pairingId: Schema.String, pollSecret: Schema.String })
132
+ export type PairingPoll = typeof PairingPoll.Type
133
+
134
+ /**
135
+ * The poll's answer. `paired` carries the device credential, exactly once: a later poll of the same pairing is
136
+ * refused (`InvalidInput`), so a credential is never issued twice.
137
+ */
138
+ export const PairingPollResult = Schema.Union([
139
+ Schema.Struct({ status: Schema.Literal("pending") }),
140
+ Schema.Struct({ status: Schema.Literal("denied") }),
141
+ Schema.Struct({ status: Schema.Literal("expired") }),
142
+ Schema.Struct({
143
+ status: Schema.Literal("paired"),
144
+ deviceId: Schema.String,
145
+ orgId: Schema.String,
146
+ subject: Schema.String,
147
+ credential: Schema.String,
148
+ }),
149
+ ])
150
+ export type PairingPollResult = typeof PairingPollResult.Type
151
+
152
+ /** A signed-in person confirms (or denies) a code; `principalId` pairs a runner for a service principal. */
153
+ export const PairingDecision = Schema.Struct({
154
+ userCode: Schema.String.check(Schema.isMaxLength(20)),
155
+ principalId: Schema.optionalKey(Schema.String),
156
+ })
157
+ export type PairingDecision = typeof PairingDecision.Type
158
+
159
+ export const PairingDecided = Schema.Struct({
160
+ pairingId: Schema.String,
161
+ status: Schema.Literals(["approved", "denied"]),
162
+ deviceId: Schema.NullOr(Schema.String),
163
+ })
164
+ export type PairingDecided = typeof PairingDecided.Type
165
+
166
+ /** A short-lived agent session for a device's harness: every call made with it is agent-originated. */
167
+ export const RelaySessionRequest = Schema.Struct({
168
+ purpose: Schema.String.check(Schema.isMaxLength(200)),
169
+ ttlSeconds: Schema.optionalKey(Schema.Number.check(Schema.isGreaterThan(0))),
170
+ /**
171
+ * The turn the session serves (one the device holds): the session then carries the authority of the call that
172
+ * queued the turn (its credential's scope, and the credential, re-validated by every call made with it).
173
+ */
174
+ turnId: Schema.optionalKey(Schema.String),
175
+ })
176
+ export const RelaySession = Schema.Struct({ id: Schema.String, token: Schema.String, expiresAt: Schema.String })
177
+ export type RelaySession = typeof RelaySession.Type
178
+
179
+ // --- Local clients (loopback) ----------------------------------------------------------------------------------
180
+
181
+ /** Who is talking to the daemon over loopback. */
182
+ export const LocalClientKind = Schema.Literals([
183
+ "host",
184
+ "shell",
185
+ "browser-extension",
186
+ "cli",
187
+ "computer-use",
188
+ "desktop-app",
189
+ "harness",
190
+ ])
191
+ export type LocalClientKind = typeof LocalClientKind.Type
192
+
193
+ /** Daemon health: unauthenticated, reveals nothing but whether the daemon is paired. */
194
+ export const DaemonHealth = Schema.Struct({
195
+ status: Schema.Literal("ok"),
196
+ version: Schema.String,
197
+ runtime: Schema.String,
198
+ /** Whether the daemon holds a device credential the kernel still accepts (as far as it knows). */
199
+ paired: Schema.Boolean,
200
+ })
201
+ export type DaemonHealth = typeof DaemonHealth.Type
202
+
203
+ /** A local client asks to pair: its name and kind, shown to the person who approves it. */
204
+ /**
205
+ * The kinds of local client that pair: a `browser-extension` or `computer-use` client may serve as a companion; a
206
+ * `desktop-app` (a native desktop client, decision 14) may use LocalClient (`/client/v1`), the person's session.
207
+ */
208
+ export const PairableClientKind = Schema.Literals(["shell", "browser-extension", "cli", "computer-use", "desktop-app"])
209
+
210
+ export const PairingRequestLocal = Schema.Struct({
211
+ clientName: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(100))),
212
+ kind: Schema.optionalKey(PairableClientKind),
213
+ })
214
+
215
+ /**
216
+ * A local pairing: the host approves it and shows the person its code (never this response, never the log);
217
+ * the caller then types the code.
218
+ */
219
+ export const PairingStart = Schema.Struct({
220
+ pairingId: Schema.String,
221
+ expiresAt: Schema.String,
222
+ })
223
+ export type PairingStart = typeof PairingStart.Type
224
+
225
+ export const PairingConfirm = Schema.Struct({
226
+ pairingId: Schema.String,
227
+ code: Schema.String,
228
+ clientName: Schema.String.check(Schema.isMaxLength(100)),
229
+ kind: Schema.optionalKey(PairableClientKind),
230
+ })
231
+ export type PairingConfirm = typeof PairingConfirm.Type
232
+
233
+ /** A local client's token: valid only on the daemon's loopback port, never on the kernel. */
234
+ export const PairingResult = Schema.Struct({ clientId: Schema.String, token: Schema.String })
235
+ export type PairingResult = typeof PairingResult.Type
236
+
237
+ export const HarnessStatus = Schema.Struct({
238
+ kind: HarnessKind,
239
+ available: Schema.Boolean,
240
+ version: Schema.NullOr(Schema.String),
241
+ /** Whether the CLI reports it is signed in to the person's subscription (null when it cannot tell). */
242
+ loggedIn: Schema.NullOr(Schema.Boolean),
243
+ detail: Schema.String,
244
+ })
245
+ export type HarnessStatus = typeof HarnessStatus.Type
246
+
247
+ export const DaemonStatus = Schema.Struct({
248
+ mode: Schema.Literals(["desktop", "headless"]),
249
+ kernel: Schema.Struct({
250
+ state: Schema.Literals(["unpaired", "pairing", "paired", "revoked"]),
251
+ url: Schema.NullOr(Schema.String),
252
+ deviceId: Schema.NullOr(Schema.String),
253
+ orgId: Schema.NullOr(Schema.String),
254
+ /** A pairing in progress: the code to confirm on the kernel. */
255
+ userCode: Schema.NullOr(Schema.String),
256
+ verificationUri: Schema.NullOr(Schema.String),
257
+ }),
258
+ secretStore: Schema.String,
259
+ harnesses: Schema.Array(HarnessStatus),
260
+ })
261
+ export type DaemonStatus = typeof DaemonStatus.Type
262
+
263
+ // --- Turns ------------------------------------------------------------------------------------------------------
264
+
265
+ export const TurnStatus = Schema.Literals(["queued", "running", "succeeded", "failed", "cancelled"])
266
+ export type TurnStatus = typeof TurnStatus.Type
267
+
268
+ /** Tokens a harness reported for a turn (the CLI's own figures; null fields when it does not report them). */
269
+ export const TurnUsage = Schema.Struct({
270
+ inputTokens: Schema.Number,
271
+ outputTokens: Schema.Number,
272
+ cachedInputTokens: Schema.NullOr(Schema.Number),
273
+ costUsd: Schema.NullOr(Schema.Number),
274
+ })
275
+ export type TurnUsage = typeof TurnUsage.Type
276
+
277
+ /**
278
+ * A harness event, normalised from the CLI's stream (Claude Code's stream-json, Codex's JSON events):
279
+ * `started` (the harness's session or thread id), `text` (assistant text), `tool-call`, `tool-result`,
280
+ * `usage`, `error`, `finished`. `data` keeps the normalised fields; raw CLI payloads are not forwarded.
281
+ */
282
+ export const TurnEventType = Schema.Literals([
283
+ "started",
284
+ "text",
285
+ "tool-call",
286
+ "tool-result",
287
+ "usage",
288
+ "error",
289
+ "finished",
290
+ ])
291
+ export type TurnEventType = typeof TurnEventType.Type
292
+
293
+ export const HarnessEvent = Schema.Struct({ type: TurnEventType, data: Schema.Unknown })
294
+ export type HarnessEvent = typeof HarnessEvent.Type
295
+
296
+ export const TurnEvent = Schema.Struct({
297
+ turnId: Schema.String,
298
+ attempt: Schema.Number,
299
+ seq: Schema.Number,
300
+ type: TurnEventType,
301
+ data: Schema.Unknown,
302
+ at: Schema.String,
303
+ })
304
+ export type TurnEvent = typeof TurnEvent.Type
305
+
306
+ export const TurnRecord = Schema.Struct({
307
+ id: Schema.String,
308
+ orgId: Schema.String,
309
+ deviceId: Schema.String,
310
+ requestedBy: Schema.String,
311
+ /** The origin of the request, as the kernel decided it (`system` for workflows and scheduled jobs). */
312
+ source: Schema.Literals(["person", "agent", "system"]),
313
+ /** The agent run the turn answers (a run on a paired device records itself here before it waits), if any. */
314
+ parentRunId: Schema.optionalKey(Schema.NullOr(Schema.String)),
315
+ prompt: Schema.String,
316
+ harness: HarnessKind,
317
+ cwd: Schema.NullOr(Schema.String),
318
+ model: Schema.NullOr(Schema.String),
319
+ timeoutMs: Schema.Number,
320
+ status: TurnStatus,
321
+ attempt: Schema.Number,
322
+ result: Schema.NullOr(Schema.String),
323
+ usage: Schema.NullOr(TurnUsage),
324
+ error: Schema.NullOr(Schema.String),
325
+ createdAt: Schema.String,
326
+ completedAt: Schema.NullOr(Schema.String),
327
+ /** Whether the device keeps the harness session so a follow-up turn can resume it. */
328
+ resumable: Schema.Boolean,
329
+ /** The turn this one follows up (it resumed that turn's harness session), or null. */
330
+ followUpOf: Schema.NullOr(Schema.String),
331
+ })
332
+ export type TurnRecord = typeof TurnRecord.Type
333
+
334
+ /** A turn a runner claimed: run it under `lease`; report events and the outcome with it. */
335
+ export const ClaimedTurn = Schema.Struct({
336
+ id: Schema.String,
337
+ attempt: Schema.Number,
338
+ lease: Schema.String,
339
+ prompt: Schema.String,
340
+ harness: HarnessKind,
341
+ cwd: Schema.NullOr(Schema.String),
342
+ model: Schema.NullOr(Schema.String),
343
+ timeoutMs: Schema.Number,
344
+ /** How long the lease lasts without a heartbeat (an events call). */
345
+ leaseMs: Schema.Number,
346
+ /** The Eloxiv actions the turn may call (null: every action the subject's policy allows). */
347
+ actions: Schema.NullOr(Schema.Array(Schema.String)),
348
+ /** Whether the harness also gets its built-in file and shell tools (off unless the request asked). */
349
+ workspaceTools: Schema.Boolean,
350
+ /** Keep the harness session (and its working directory) so a follow-up turn can resume it. */
351
+ resumable: Schema.optionalKey(Schema.Boolean),
352
+ /**
353
+ * A follow-up: the harness session to resume, one this device reported for the turn it follows. The daemon
354
+ * resumes only a session it started and still keeps; any other fails the turn.
355
+ */
356
+ resume: Schema.optionalKey(Schema.NullOr(Schema.String)),
357
+ })
358
+ export type ClaimedTurn = typeof ClaimedTurn.Type
359
+
360
+ export const NextTurnRequest = Schema.Struct({
361
+ /** Hold the request this long waiting for a turn (long poll; at most 30 s). */
362
+ waitMs: Schema.optionalKey(Schema.Number),
363
+ /**
364
+ * The daemon has just started: any turn this device still holds is abandoned (its harness died with the
365
+ * previous process), so it goes back to the queue and is claimed again now, as a new attempt.
366
+ */
367
+ fresh: Schema.optionalKey(Schema.Boolean),
368
+ })
369
+ export const NextTurn = Schema.Struct({ turn: Schema.NullOr(ClaimedTurn) })
370
+ export type NextTurn = typeof NextTurn.Type
371
+
372
+ export const AppendTurnEvents = Schema.Struct({
373
+ turnId: Schema.String,
374
+ lease: Schema.String,
375
+ events: Schema.Array(Schema.Struct({ seq: Schema.Number, type: TurnEventType, data: Schema.Unknown })),
376
+ })
377
+ export const AppendedTurnEvents = Schema.Struct({
378
+ accepted: Schema.Number,
379
+ /** The turn was cancelled (or settled otherwise): stop the harness. */
380
+ stop: Schema.Boolean,
381
+ })
382
+
383
+ export const CompleteTurn = Schema.Struct({
384
+ turnId: Schema.String,
385
+ lease: Schema.String,
386
+ outcome: Schema.Literals(["succeeded", "failed"]),
387
+ result: Schema.NullOr(Schema.String),
388
+ usage: Schema.NullOr(TurnUsage),
389
+ error: Schema.NullOr(Schema.String),
390
+ /** The harness's session (resumable turns): what a follow-up turn resumes. */
391
+ sessionId: Schema.optionalKey(Schema.NullOr(Schema.String.check(Schema.isMaxLength(200)))),
392
+ })
393
+ export type CompleteTurn = typeof CompleteTurn.Type
394
+ export const CompletedTurn = Schema.Struct({
395
+ /** The turn settled with this report. */
396
+ settled: Schema.Boolean,
397
+ /** The same lease had already settled it: this report changed nothing (a retry after a lost answer). */
398
+ duplicate: Schema.Boolean,
399
+ })
400
+
401
+ /** A turn and its events, for the person who asked for it or whose device runs it. */
402
+ export const TurnView = Schema.Struct({ turn: TurnRecord, events: Schema.Array(TurnEvent) })
403
+ export type TurnView = typeof TurnView.Type
404
+
405
+ /** A runner's report about a turn it no longer holds (another attempt took it, or it settled). */
406
+ export class TurnLeaseLost extends Schema.TaggedError<TurnLeaseLost>()(
407
+ "TurnLeaseLost",
408
+ { message: Schema.String, turnId: Schema.String },
409
+ { httpApiStatus: 409 },
410
+ ) {}
411
+
412
+ // --- DeviceControl: sessions -----------------------------------------------------------------------------------
413
+
414
+ /**
415
+ * A session on a device: a local client connected to the daemon (the shell, a browser extension, a CLI), a
416
+ * harness turn, or a computer-use session. Computer use and the browser extension are contract-level here:
417
+ * the daemon reports them when a capability exists; none is implemented yet.
418
+ */
419
+ export const DeviceSessionKind = Schema.Literals([
420
+ "shell",
421
+ "browser-extension",
422
+ "cli",
423
+ "harness",
424
+ "computer-use",
425
+ "desktop-app",
426
+ "terminal",
427
+ ])
428
+ export const DeviceSession = Schema.Struct({
429
+ id: Schema.String,
430
+ kind: DeviceSessionKind,
431
+ label: Schema.String,
432
+ startedAt: Schema.String,
433
+ endedAt: Schema.NullOr(Schema.String),
434
+ /** For a browser extension: the origin; for a harness: the harness kind; for computer use: the display. */
435
+ detail: Schema.NullOr(Schema.String),
436
+ })
437
+ export type DeviceSession = typeof DeviceSession.Type
438
+
439
+ export const ReportSessions = Schema.Struct({ sessions: Schema.Array(DeviceSession) })
440
+ export const DeviceSessions = Schema.Struct({ deviceId: Schema.String, sessions: Schema.Array(DeviceSession) })
441
+
442
+ /** Whether a capability is usable on a device now, and why not when it is not. */
443
+ export const CapabilityAvailability = Schema.Struct({
444
+ /** The daemon was started with it (`--allow-commands`). */
445
+ enabled: Schema.Boolean,
446
+ /** It can serve commands now (enabled, and for a browser or the computer, a companion connected). */
447
+ available: Schema.Boolean,
448
+ reason: Schema.NullOr(Schema.String),
449
+ })
450
+ export type CapabilityAvailability = typeof CapabilityAvailability.Type
451
+
452
+ /** What the daemon offers now (`GET /capabilities`): each command kind's availability, its harnesses, the profile. */
453
+ export const DeviceAvailability = Schema.Struct({
454
+ terminal: CapabilityAvailability,
455
+ files: CapabilityAvailability,
456
+ browser: CapabilityAvailability,
457
+ computer: CapabilityAvailability,
458
+ /** A local PTY for terminal sessions (`POST /terminals`); false: pipes. */
459
+ pty: Schema.Boolean,
460
+ toolsOnly: Schema.Boolean,
461
+ })
462
+ export type DeviceAvailability = typeof DeviceAvailability.Type
463
+
464
+ /** What computer use offers on a device (`GET /computer-use`): available while a computer-use companion serves it. */
465
+ export const ComputerUseCapability = Schema.Struct({
466
+ available: Schema.Boolean,
467
+ reason: Schema.String,
468
+ })
469
+
470
+ // --- DeviceControl: commands -----------------------------------------------------------------------------------
471
+
472
+ const Path = Schema.String.check(Schema.isMaxLength(1000))
473
+ const Text = (max: number) => Schema.String.check(Schema.isMaxLength(max))
474
+
475
+ /**
476
+ * Each operation's input. Paths are relative to the daemon's workspace and never leave it; `terminal.exec` runs
477
+ * one shell command there. Browser and computer operations are handed to the companion as they are.
478
+ */
479
+ export const COMMAND_INPUTS = {
480
+ "terminal.exec": Schema.Struct({ command: Text(10_000).check(Schema.isNonEmpty()), cwd: Schema.optionalKey(Path) }),
481
+ "files.read": Schema.Struct({ path: Path }),
482
+ "files.write": Schema.Struct({ path: Path, content: Text(1_000_000) }),
483
+ "files.edit": Schema.Struct({
484
+ path: Path,
485
+ oldText: Text(100_000).check(Schema.isNonEmpty()),
486
+ newText: Text(100_000),
487
+ }),
488
+ "files.list": Schema.Struct({ path: Schema.optionalKey(Path) }),
489
+ "files.search": Schema.Struct({ text: Text(1_000).check(Schema.isNonEmpty()), path: Schema.optionalKey(Path) }),
490
+ "browser.observe": Schema.Struct({}),
491
+ "browser.navigate": Schema.Struct({ url: Text(4_000) }),
492
+ "browser.click": Schema.Struct({
493
+ selector: Schema.optionalKey(Text(1_000)),
494
+ x: Schema.optionalKey(Schema.Number),
495
+ y: Schema.optionalKey(Schema.Number),
496
+ }),
497
+ "browser.type": Schema.Struct({ text: Text(10_000), selector: Schema.optionalKey(Text(1_000)) }),
498
+ "browser.scroll": Schema.Struct({ dx: Schema.optionalKey(Schema.Number), dy: Schema.optionalKey(Schema.Number) }),
499
+ "computer.observe": Schema.Struct({}),
500
+ "computer.click": Schema.Struct({ x: Schema.Number, y: Schema.Number, button: Schema.optionalKey(Text(20)) }),
501
+ "computer.type": Schema.Struct({ text: Text(10_000) }),
502
+ "computer.key": Schema.Struct({ key: Text(100) }),
503
+ "computer.scroll": Schema.Struct({ dx: Schema.optionalKey(Schema.Number), dy: Schema.optionalKey(Schema.Number) }),
504
+ } as const
505
+
506
+ export type CommandOperation = keyof typeof COMMAND_INPUTS
507
+ export const CommandOperation = Schema.Literals(
508
+ Object.keys(COMMAND_INPUTS) as [CommandOperation, ...CommandOperation[]],
509
+ )
510
+
511
+ /** The kind of device an operation runs on (`terminal.exec` is `terminal`, ...). */
512
+ export const commandKindOf = (operation: CommandOperation): CommandKind => operation.split(".")[0] as CommandKind
513
+
514
+ /** A command's default and longest time limits once a device takes it (ms), and how long it may wait to be taken. */
515
+ export const DEFAULT_COMMAND_TIMEOUT_MS = 60_000
516
+ export const MAX_COMMAND_TIMEOUT_MS = 10 * 60_000
517
+ export const COMMAND_QUEUE_MS = 2 * 60_000
518
+
519
+ export const SendCommand = Schema.Struct({
520
+ deviceId: Schema.String,
521
+ operation: CommandOperation,
522
+ /** The operation's input (see `COMMAND_INPUTS`). */
523
+ input: Schema.Unknown,
524
+ timeoutMs: Schema.optionalKey(Schema.Number.check(Schema.isGreaterThan(0))),
525
+ })
526
+ export type SendCommand = typeof SendCommand.Type
527
+
528
+ /**
529
+ * `cancelled` means the command never ran: cancelled while queued, or taken by a device that heard of the cancellation
530
+ * before it acted. A command cancelled while it ran ends `failed` (interrupted: what it did before it stopped stands)
531
+ * or as it really ended, with `cancelRequestedAt` set; nothing is ever reported undone.
532
+ */
533
+ export const CommandStatus = Schema.Literals(["queued", "running", "succeeded", "failed", "expired", "cancelled"])
534
+ export type CommandStatus = typeof CommandStatus.Type
535
+
536
+ export const CommandRecord = Schema.Struct({
537
+ id: Schema.String,
538
+ deviceId: Schema.String,
539
+ requestedBy: Schema.String,
540
+ source: Schema.Literals(["person", "agent", "system"]),
541
+ operation: CommandOperation,
542
+ input: Schema.Unknown,
543
+ status: CommandStatus,
544
+ /** The operation's answer (a command's output, a file's content, a page's text, ...). */
545
+ result: Schema.Unknown,
546
+ error: Schema.NullOr(Schema.String),
547
+ createdAt: Schema.String,
548
+ completedAt: Schema.NullOr(Schema.String),
549
+ /** When someone asked to cancel it (null: never). */
550
+ cancelRequestedAt: Schema.NullOr(Schema.String),
551
+ })
552
+ export type CommandRecord = typeof CommandRecord.Type
553
+
554
+ /** A command a device took: run it before `deadline` and report it with `lease`. */
555
+ export const ClaimedCommand = Schema.Struct({
556
+ id: Schema.String,
557
+ lease: Schema.String,
558
+ operation: CommandOperation,
559
+ input: Schema.Unknown,
560
+ timeoutMs: Schema.Number,
561
+ deadline: Schema.String,
562
+ })
563
+ export type ClaimedCommand = typeof ClaimedCommand.Type
564
+
565
+ export const NextCommandRequest = Schema.Struct({
566
+ /** The kinds the device can serve now; only commands of these are handed out. */
567
+ kinds: Schema.Array(CommandKind),
568
+ /** Hold the request this long waiting for a command (long poll; at most 30 s). */
569
+ waitMs: Schema.optionalKey(Schema.Number),
570
+ })
571
+ export const NextCommand = Schema.Struct({ command: Schema.NullOr(ClaimedCommand) })
572
+
573
+ export const CompleteCommand = Schema.Struct({
574
+ commandId: Schema.String,
575
+ lease: Schema.String,
576
+ /** `cancelled`: the device did not act (taken, then cancelled before it ran); only after a cancellation was asked. */
577
+ outcome: Schema.Literals(["succeeded", "failed", "cancelled"]),
578
+ result: Schema.Unknown,
579
+ error: Schema.NullOr(Schema.String.check(Schema.isMaxLength(10_000))),
580
+ })
581
+ export type CompleteCommand = typeof CompleteCommand.Type
582
+ export const CompletedCommand = Schema.Struct({ settled: Schema.Boolean, duplicate: Schema.Boolean })
583
+
584
+ /** A device asks, before it acts and while it waits or acts, whether a command it took should stop. */
585
+ export const CheckCommand = Schema.Struct({ commandId: Schema.String, lease: Schema.String })
586
+ /** `stop`: a cancellation was asked, or the device no longer holds the command (its lease or authority). */
587
+ export const CheckedCommand = Schema.Struct({ stop: Schema.Boolean })
588
+
589
+ /** A device reports what it offers now (its harnesses, command kinds and profile). */
590
+ export const ReportCapabilities = Schema.Struct({ capabilities: DeviceCapabilities })
591
+
592
+ /** A device registers (or, with null, removes) the push subscription notifications for its person may use. */
593
+ export const RegisterPush = Schema.Struct({ subscription: Schema.NullOr(PushSubscriptionInfo) })
594
+ export const RegisteredPush = Schema.Struct({ registered: Schema.Boolean })
595
+
596
+ // --- The kernel-provided `devices` module: its actions and events (its tables, entities and contract are in
597
+ // `@eloxiv/contracts/devices`, over Drizzle) -----------------------------------------------------------------
598
+
599
+ /** The longest prompt a turn carries (characters). */
600
+ export const MAX_TURN_PROMPT = 100_000
601
+ /** A turn's default and longest time limits (ms). */
602
+ export const DEFAULT_TURN_TIMEOUT_MS = 10 * 60 * 1000
603
+ export const MAX_TURN_TIMEOUT_MS = 6 * 60 * 60 * 1000
604
+
605
+ export const SendTurn = Schema.Struct({
606
+ deviceId: Schema.String,
607
+ prompt: Schema.String.check(Schema.isMaxLength(MAX_TURN_PROMPT)),
608
+ harness: Schema.optionalKey(HarnessKind),
609
+ /** The working directory on the device (default: the daemon's configured workspace). */
610
+ cwd: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1000))),
611
+ model: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(200))),
612
+ timeoutMs: Schema.optionalKey(Schema.Number.check(Schema.isGreaterThan(0))),
613
+ /** Limit the turn to these Eloxiv actions (by name); default every action the device's subject may call. */
614
+ actions: Schema.optionalKey(
615
+ Schema.Array(Schema.String.check(Schema.isMaxLength(200))).check(Schema.isMaxLength(100)),
616
+ ),
617
+ /**
618
+ * Give the harness its built-in file and shell tools in the working directory. Off by default: a shell runs
619
+ * as the device's OS user and can read what that user can (see docs/contracts/daemon.md).
620
+ */
621
+ workspaceTools: Schema.optionalKey(Schema.Boolean),
622
+ /**
623
+ * Keep the harness session on the device so a later turn can follow it up (`followUp`). Off by default: the
624
+ * harness keeps nothing after the turn (no transcript on disk, its temporary working directory removed).
625
+ */
626
+ resumable: Schema.optionalKey(Schema.Boolean),
627
+ /**
628
+ * Follow up an earlier resumable turn on the same device: the harness resumes that turn's session (its
629
+ * conversation and working directory), with the same harness. The new turn is resumable too.
630
+ */
631
+ followUp: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(100))),
632
+ })
633
+ export type SendTurn = typeof SendTurn.Type
634
+
635
+ export const sendTurn = defineAction({
636
+ name: "devices.sendTurn",
637
+ title: "Run an agent task on your device",
638
+ description:
639
+ "Ask one of your paired devices (a headless runner, or your desktop daemon) to run an agent turn with a local harness (Claude Code or Codex) on your own subscription. Only the person (or service principal) the device is paired to can address it. Returns the turn's id; it runs when the device picks it up.",
640
+ input: SendTurn,
641
+ output: Schema.Struct({ turnId: Schema.String }),
642
+ writes: "turn",
643
+ // An agent asking a device to run another agent needs the person's consent.
644
+ consent: true,
645
+ })
646
+
647
+ export const cancelTurn = defineAction({
648
+ name: "devices.cancelTurn",
649
+ title: "Cancel an agent task on your device",
650
+ description: "Cancel a turn you asked for (or one addressed to your device) that has not finished.",
651
+ input: Schema.Struct({ id: Schema.String }),
652
+ output: Schema.Struct({ id: Schema.String, status: TurnStatus }),
653
+ writes: "turn",
654
+ target: { entity: "turn", field: "id" },
655
+ hints: { idempotent: true },
656
+ })
657
+
658
+ export const turnRequested = defineEvent(
659
+ "devices.turnRequested",
660
+ Schema.Struct({ id: Schema.String, deviceId: Schema.String, requestedBy: Schema.String, timeoutMs: Schema.Number }),
661
+ )
662
+
663
+ export const turnSettled = defineEvent("devices.turnSettled", Schema.Struct({ id: Schema.String, status: TurnStatus }))
664
+
665
+ export const sendCommand = defineAction({
666
+ name: "devices.sendCommand",
667
+ title: "Run a command on your device",
668
+ description:
669
+ "Ask one of your paired devices to run one command: a shell command in its workspace (terminal.exec), a file operation there (files.read, files.write, files.edit, files.list, files.search), or a browser or computer operation its companion serves (browser.observe, browser.navigate, browser.click, browser.type, browser.scroll; computer.observe, computer.click, computer.type, computer.key, computer.scroll). The device must offer the operation's kind (devices.listDevices shows what each offers). Returns the command's id; read its result with devices.getCommand.",
670
+ input: SendCommand,
671
+ output: Schema.Struct({ commandId: Schema.String }),
672
+ writes: "command",
673
+ // Driving a person's terminal, files, browser or computer needs their consent when an agent asks.
674
+ consent: true,
675
+ })
676
+
677
+ export const cancelCommand = defineAction({
678
+ name: "devices.cancelCommand",
679
+ title: "Cancel a command on your device",
680
+ description:
681
+ "Cancel a device command you sent (or one sent to your device). One not taken yet never runs (status cancelled). One a device is running is stopped if it still can be: a shell command is interrupted (it ends failed, and what it did before it stopped stands); a browser or computer operation a companion already took runs to its end. Nothing already done is undone. A finished command is unchanged.",
682
+ input: Schema.Struct({ id: Schema.String }),
683
+ output: Schema.Struct({ id: Schema.String, status: CommandStatus, cancelRequested: Schema.Boolean }),
684
+ writes: "command",
685
+ target: { entity: "command", field: "id" },
686
+ hints: { idempotent: true },
687
+ })
688
+
689
+ export const getCommand = defineAction({
690
+ name: "devices.getCommand",
691
+ title: "Check a command on your device",
692
+ description:
693
+ "Read a device command you sent (or one sent to your device): its status (queued, running, succeeded, failed, expired, cancelled) and, once finished, its result or error. Poll it until it is no longer queued or running.",
694
+ input: Schema.Struct({ id: Schema.String }),
695
+ output: CommandRecord,
696
+ hints: { readOnly: true, idempotent: true },
697
+ })
698
+
699
+ export const DeviceSummary = Schema.Struct({
700
+ id: Schema.String,
701
+ name: Schema.String,
702
+ kind: DeviceKind,
703
+ harnesses: Schema.Array(Schema.String),
704
+ /** The command kinds the device offers now. */
705
+ commands: Schema.Array(CommandKind),
706
+ })
707
+
708
+ export const listDevices = defineAction({
709
+ name: "devices.listDevices",
710
+ title: "List your devices",
711
+ description:
712
+ "List your paired devices that are not revoked, with the harnesses they run turns with (devices.sendTurn) and the command kinds they offer now (devices.sendCommand: terminal, files, browser, computer).",
713
+ input: Schema.Struct({}),
714
+ output: Schema.Struct({ devices: Schema.Array(DeviceSummary) }),
715
+ hints: { readOnly: true, idempotent: true },
716
+ })
717
+
718
+ export const commandRequested = defineEvent(
719
+ "devices.commandRequested",
720
+ Schema.Struct({ id: Schema.String, deviceId: Schema.String, operation: Schema.String }),
721
+ )