@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.
- package/LICENSE +21 -0
- package/README.md +6 -2
- package/dist/Agent.d.ts +792 -0
- package/dist/Agent.d.ts.map +1 -0
- package/dist/Agent.js +610 -0
- package/dist/Agent.js.map +1 -0
- package/dist/Analytics.d.ts +46 -0
- package/dist/Analytics.d.ts.map +1 -0
- package/dist/Analytics.js +89 -0
- package/dist/Analytics.js.map +1 -0
- package/dist/Approval.d.ts +70 -0
- package/dist/Approval.d.ts.map +1 -0
- package/dist/Approval.js +127 -0
- package/dist/Approval.js.map +1 -0
- package/dist/Catalog.d.ts +238 -0
- package/dist/Catalog.d.ts.map +1 -0
- package/dist/Catalog.js +169 -0
- package/dist/Catalog.js.map +1 -0
- package/dist/Checklist.d.ts +99 -0
- package/dist/Checklist.d.ts.map +1 -0
- package/dist/Checklist.js +105 -0
- package/dist/Checklist.js.map +1 -0
- package/dist/Data.d.ts +107 -0
- package/dist/Data.d.ts.map +1 -0
- package/dist/Data.js +93 -0
- package/dist/Data.js.map +1 -0
- package/dist/Devices.d.ts +857 -0
- package/dist/Devices.d.ts.map +1 -0
- package/dist/Devices.js +590 -0
- package/dist/Devices.js.map +1 -0
- package/dist/Durable.d.ts +406 -0
- package/dist/Durable.d.ts.map +1 -0
- package/dist/Durable.js +203 -0
- package/dist/Durable.js.map +1 -0
- package/dist/Errors.d.ts +95 -0
- package/dist/Errors.d.ts.map +1 -0
- package/dist/Errors.js +72 -0
- package/dist/Errors.js.map +1 -0
- package/dist/JsonSchema.d.ts +355 -0
- package/dist/JsonSchema.d.ts.map +1 -0
- package/dist/JsonSchema.js +151 -0
- package/dist/JsonSchema.js.map +1 -0
- package/dist/Manifest.d.ts +353 -0
- package/dist/Manifest.d.ts.map +1 -0
- package/dist/Manifest.js +894 -0
- package/dist/Manifest.js.map +1 -0
- package/dist/Module.d.ts +447 -0
- package/dist/Module.d.ts.map +1 -0
- package/dist/Module.js +221 -0
- package/dist/Module.js.map +1 -0
- package/dist/Optimistic.d.ts +192 -0
- package/dist/Optimistic.d.ts.map +1 -0
- package/dist/Optimistic.js +319 -0
- package/dist/Optimistic.js.map +1 -0
- package/dist/Projection.d.ts +163 -0
- package/dist/Projection.d.ts.map +1 -0
- package/dist/Projection.js +158 -0
- package/dist/Projection.js.map +1 -0
- package/dist/Proposals.d.ts +103 -0
- package/dist/Proposals.d.ts.map +1 -0
- package/dist/Proposals.js +72 -0
- package/dist/Proposals.js.map +1 -0
- package/dist/Receipt.d.ts +243 -0
- package/dist/Receipt.d.ts.map +1 -0
- package/dist/Receipt.js +108 -0
- package/dist/Receipt.js.map +1 -0
- package/dist/Records.d.ts +297 -0
- package/dist/Records.d.ts.map +1 -0
- package/dist/Records.js +171 -0
- package/dist/Records.js.map +1 -0
- package/dist/Render.d.ts +207 -0
- package/dist/Render.d.ts.map +1 -0
- package/dist/Render.js +502 -0
- package/dist/Render.js.map +1 -0
- package/dist/Rpc.d.ts +115 -0
- package/dist/Rpc.d.ts.map +1 -0
- package/dist/Rpc.js +68 -0
- package/dist/Rpc.js.map +1 -0
- package/dist/SearchLanguages.d.ts +4 -0
- package/dist/SearchLanguages.d.ts.map +1 -0
- package/dist/SearchLanguages.js +33 -0
- package/dist/SearchLanguages.js.map +1 -0
- package/dist/Service.d.ts +59 -0
- package/dist/Service.d.ts.map +1 -0
- package/dist/Service.js +38 -0
- package/dist/Service.js.map +1 -0
- package/dist/Versions.d.ts +9 -0
- package/dist/Versions.d.ts.map +1 -0
- package/dist/Versions.js +78 -0
- package/dist/Versions.js.map +1 -0
- package/dist/contracts/ActionConsent.d.ts +189 -0
- package/dist/contracts/ActionConsent.d.ts.map +1 -0
- package/dist/contracts/ActionConsent.js +129 -0
- package/dist/contracts/ActionConsent.js.map +1 -0
- package/dist/contracts/ActionRegistry.d.ts +149 -0
- package/dist/contracts/ActionRegistry.d.ts.map +1 -0
- package/dist/contracts/ActionRegistry.js +37 -0
- package/dist/contracts/ActionRegistry.js.map +1 -0
- package/dist/contracts/Actor.d.ts +129 -0
- package/dist/contracts/Actor.d.ts.map +1 -0
- package/dist/contracts/Actor.js +47 -0
- package/dist/contracts/Actor.js.map +1 -0
- package/dist/contracts/AgentResources.d.ts +248 -0
- package/dist/contracts/AgentResources.d.ts.map +1 -0
- package/dist/contracts/AgentResources.js +158 -0
- package/dist/contracts/AgentResources.js.map +1 -0
- package/dist/contracts/AgentRuntime.d.ts +453 -0
- package/dist/contracts/AgentRuntime.d.ts.map +1 -0
- package/dist/contracts/AgentRuntime.js +117 -0
- package/dist/contracts/AgentRuntime.js.map +1 -0
- package/dist/contracts/Approvals.d.ts +303 -0
- package/dist/contracts/Approvals.d.ts.map +1 -0
- package/dist/contracts/Approvals.js +117 -0
- package/dist/contracts/Approvals.js.map +1 -0
- package/dist/contracts/Audit.d.ts +510 -0
- package/dist/contracts/Audit.d.ts.map +1 -0
- package/dist/contracts/Audit.js +139 -0
- package/dist/contracts/Audit.js.map +1 -0
- package/dist/contracts/CalendarProvider.d.ts +572 -0
- package/dist/contracts/CalendarProvider.d.ts.map +1 -0
- package/dist/contracts/CalendarProvider.js +203 -0
- package/dist/contracts/CalendarProvider.js.map +1 -0
- package/dist/contracts/Capability.d.ts +197 -0
- package/dist/contracts/Capability.d.ts.map +1 -0
- package/dist/contracts/Capability.js +189 -0
- package/dist/contracts/Capability.js.map +1 -0
- package/dist/contracts/ClientSDK.d.ts +250 -0
- package/dist/contracts/ClientSDK.d.ts.map +1 -0
- package/dist/contracts/ClientSDK.js +184 -0
- package/dist/contracts/ClientSDK.js.map +1 -0
- package/dist/contracts/CollabDocument.d.ts +781 -0
- package/dist/contracts/CollabDocument.d.ts.map +1 -0
- package/dist/contracts/CollabDocument.js +364 -0
- package/dist/contracts/CollabDocument.js.map +1 -0
- package/dist/contracts/Command.d.ts +183 -0
- package/dist/contracts/Command.d.ts.map +1 -0
- package/dist/contracts/Command.js +66 -0
- package/dist/contracts/Command.js.map +1 -0
- package/dist/contracts/Connections.d.ts +612 -0
- package/dist/contracts/Connections.d.ts.map +1 -0
- package/dist/contracts/Connections.js +323 -0
- package/dist/contracts/Connections.js.map +1 -0
- package/dist/contracts/ContextAccounting.d.ts +79 -0
- package/dist/contracts/ContextAccounting.d.ts.map +1 -0
- package/dist/contracts/ContextAccounting.js +32 -0
- package/dist/contracts/ContextAccounting.js.map +1 -0
- package/dist/contracts/Daemon.d.ts +486 -0
- package/dist/contracts/Daemon.d.ts.map +1 -0
- package/dist/contracts/Daemon.js +192 -0
- package/dist/contracts/Daemon.js.map +1 -0
- package/dist/contracts/DbTx.d.ts +149 -0
- package/dist/contracts/DbTx.d.ts.map +1 -0
- package/dist/contracts/DbTx.js +94 -0
- package/dist/contracts/DbTx.js.map +1 -0
- package/dist/contracts/Delegation.d.ts +121 -0
- package/dist/contracts/Delegation.d.ts.map +1 -0
- package/dist/contracts/Delegation.js +76 -0
- package/dist/contracts/Delegation.js.map +1 -0
- package/dist/contracts/DeviceControl.d.ts +293 -0
- package/dist/contracts/DeviceControl.d.ts.map +1 -0
- package/dist/contracts/DeviceControl.js +107 -0
- package/dist/contracts/DeviceControl.js.map +1 -0
- package/dist/contracts/Directory.d.ts +492 -0
- package/dist/contracts/Directory.d.ts.map +1 -0
- package/dist/contracts/Directory.js +225 -0
- package/dist/contracts/Directory.js.map +1 -0
- package/dist/contracts/DirectoryProvider.d.ts +214 -0
- package/dist/contracts/DirectoryProvider.d.ts.map +1 -0
- package/dist/contracts/DirectoryProvider.js +73 -0
- package/dist/contracts/DirectoryProvider.js.map +1 -0
- package/dist/contracts/DocumentSource.d.ts +190 -0
- package/dist/contracts/DocumentSource.d.ts.map +1 -0
- package/dist/contracts/DocumentSource.js +64 -0
- package/dist/contracts/DocumentSource.js.map +1 -0
- package/dist/contracts/Files.d.ts +762 -0
- package/dist/contracts/Files.d.ts.map +1 -0
- package/dist/contracts/Files.js +339 -0
- package/dist/contracts/Files.js.map +1 -0
- package/dist/contracts/Flags.d.ts +265 -0
- package/dist/contracts/Flags.d.ts.map +1 -0
- package/dist/contracts/Flags.js +197 -0
- package/dist/contracts/Flags.js.map +1 -0
- package/dist/contracts/Host.d.ts +320 -0
- package/dist/contracts/Host.d.ts.map +1 -0
- package/dist/contracts/Host.js +224 -0
- package/dist/contracts/Host.js.map +1 -0
- package/dist/contracts/HttpApi.d.ts +102 -0
- package/dist/contracts/HttpApi.d.ts.map +1 -0
- package/dist/contracts/HttpApi.js +89 -0
- package/dist/contracts/HttpApi.js.map +1 -0
- package/dist/contracts/Ingestion.d.ts +522 -0
- package/dist/contracts/Ingestion.d.ts.map +1 -0
- package/dist/contracts/Ingestion.js +275 -0
- package/dist/contracts/Ingestion.js.map +1 -0
- package/dist/contracts/Ingress.d.ts +132 -0
- package/dist/contracts/Ingress.d.ts.map +1 -0
- package/dist/contracts/Ingress.js +102 -0
- package/dist/contracts/Ingress.js.map +1 -0
- package/dist/contracts/Invocation.d.ts +361 -0
- package/dist/contracts/Invocation.d.ts.map +1 -0
- package/dist/contracts/Invocation.js +104 -0
- package/dist/contracts/Invocation.js.map +1 -0
- package/dist/contracts/LocalClient.d.ts +878 -0
- package/dist/contracts/LocalClient.d.ts.map +1 -0
- package/dist/contracts/LocalClient.js +423 -0
- package/dist/contracts/LocalClient.js.map +1 -0
- package/dist/contracts/Locale.d.ts +162 -0
- package/dist/contracts/Locale.d.ts.map +1 -0
- package/dist/contracts/Locale.js +123 -0
- package/dist/contracts/Locale.js.map +1 -0
- package/dist/contracts/MachineIdentity.d.ts +434 -0
- package/dist/contracts/MachineIdentity.d.ts.map +1 -0
- package/dist/contracts/MachineIdentity.js +223 -0
- package/dist/contracts/MachineIdentity.js.map +1 -0
- package/dist/contracts/MailProvider.d.ts +791 -0
- package/dist/contracts/MailProvider.d.ts.map +1 -0
- package/dist/contracts/MailProvider.js +237 -0
- package/dist/contracts/MailProvider.js.map +1 -0
- package/dist/contracts/Memory.d.ts +62 -0
- package/dist/contracts/Memory.d.ts.map +1 -0
- package/dist/contracts/Memory.js +43 -0
- package/dist/contracts/Memory.js.map +1 -0
- package/dist/contracts/Messaging.d.ts +154 -0
- package/dist/contracts/Messaging.d.ts.map +1 -0
- package/dist/contracts/Messaging.js +97 -0
- package/dist/contracts/Messaging.js.map +1 -0
- package/dist/contracts/Metering.d.ts +334 -0
- package/dist/contracts/Metering.d.ts.map +1 -0
- package/dist/contracts/Metering.js +202 -0
- package/dist/contracts/Metering.js.map +1 -0
- package/dist/contracts/ModelProvider.d.ts +142 -0
- package/dist/contracts/ModelProvider.d.ts.map +1 -0
- package/dist/contracts/ModelProvider.js +72 -0
- package/dist/contracts/ModelProvider.js.map +1 -0
- package/dist/contracts/ModuleManifest.d.ts +2519 -0
- package/dist/contracts/ModuleManifest.d.ts.map +1 -0
- package/dist/contracts/ModuleManifest.js +272 -0
- package/dist/contracts/ModuleManifest.js.map +1 -0
- package/dist/contracts/NotificationChannel.d.ts +378 -0
- package/dist/contracts/NotificationChannel.d.ts.map +1 -0
- package/dist/contracts/NotificationChannel.js +136 -0
- package/dist/contracts/NotificationChannel.js.map +1 -0
- package/dist/contracts/Notifications.d.ts +417 -0
- package/dist/contracts/Notifications.d.ts.map +1 -0
- package/dist/contracts/Notifications.js +267 -0
- package/dist/contracts/Notifications.js.map +1 -0
- package/dist/contracts/Outbox.d.ts +469 -0
- package/dist/contracts/Outbox.d.ts.map +1 -0
- package/dist/contracts/Outbox.js +215 -0
- package/dist/contracts/Outbox.js.map +1 -0
- package/dist/contracts/Privacy.d.ts +1029 -0
- package/dist/contracts/Privacy.d.ts.map +1 -0
- package/dist/contracts/Privacy.js +437 -0
- package/dist/contracts/Privacy.js.map +1 -0
- package/dist/contracts/Progress.d.ts +305 -0
- package/dist/contracts/Progress.d.ts.map +1 -0
- package/dist/contracts/Progress.js +174 -0
- package/dist/contracts/Progress.js.map +1 -0
- package/dist/contracts/QuerySurface.d.ts +231 -0
- package/dist/contracts/QuerySurface.d.ts.map +1 -0
- package/dist/contracts/QuerySurface.js +113 -0
- package/dist/contracts/QuerySurface.js.map +1 -0
- package/dist/contracts/Readiness.d.ts +105 -0
- package/dist/contracts/Readiness.d.ts.map +1 -0
- package/dist/contracts/Readiness.js +57 -0
- package/dist/contracts/Readiness.js.map +1 -0
- package/dist/contracts/Release.d.ts +295 -0
- package/dist/contracts/Release.d.ts.map +1 -0
- package/dist/contracts/Release.js +175 -0
- package/dist/contracts/Release.js.map +1 -0
- package/dist/contracts/ResultRendering.d.ts +533 -0
- package/dist/contracts/ResultRendering.d.ts.map +1 -0
- package/dist/contracts/ResultRendering.js +59 -0
- package/dist/contracts/ResultRendering.js.map +1 -0
- package/dist/contracts/Sandbox.d.ts +1164 -0
- package/dist/contracts/Sandbox.d.ts.map +1 -0
- package/dist/contracts/Sandbox.js +550 -0
- package/dist/contracts/Sandbox.js.map +1 -0
- package/dist/contracts/Scheduler.d.ts +814 -0
- package/dist/contracts/Scheduler.d.ts.map +1 -0
- package/dist/contracts/Scheduler.js +202 -0
- package/dist/contracts/Scheduler.js.map +1 -0
- package/dist/contracts/ScreenContext.d.ts +514 -0
- package/dist/contracts/ScreenContext.d.ts.map +1 -0
- package/dist/contracts/ScreenContext.js +272 -0
- package/dist/contracts/ScreenContext.js.map +1 -0
- package/dist/contracts/Search.d.ts +308 -0
- package/dist/contracts/Search.d.ts.map +1 -0
- package/dist/contracts/Search.js +107 -0
- package/dist/contracts/Search.js.map +1 -0
- package/dist/contracts/Secrets.d.ts +483 -0
- package/dist/contracts/Secrets.d.ts.map +1 -0
- package/dist/contracts/Secrets.js +136 -0
- package/dist/contracts/Secrets.js.map +1 -0
- package/dist/contracts/Settings.d.ts +221 -0
- package/dist/contracts/Settings.d.ts.map +1 -0
- package/dist/contracts/Settings.js +163 -0
- package/dist/contracts/Settings.js.map +1 -0
- package/dist/contracts/Sharing.d.ts +319 -0
- package/dist/contracts/Sharing.d.ts.map +1 -0
- package/dist/contracts/Sharing.js +172 -0
- package/dist/contracts/Sharing.js.map +1 -0
- package/dist/contracts/Slot.d.ts +162 -0
- package/dist/contracts/Slot.d.ts.map +1 -0
- package/dist/contracts/Slot.js +56 -0
- package/dist/contracts/Slot.js.map +1 -0
- package/dist/contracts/Space.d.ts +256 -0
- package/dist/contracts/Space.d.ts.map +1 -0
- package/dist/contracts/Space.js +133 -0
- package/dist/contracts/Space.js.map +1 -0
- package/dist/contracts/StorageAdapter.d.ts +124 -0
- package/dist/contracts/StorageAdapter.d.ts.map +1 -0
- package/dist/contracts/StorageAdapter.js +96 -0
- package/dist/contracts/StorageAdapter.js.map +1 -0
- package/dist/contracts/StorageBackend.d.ts +310 -0
- package/dist/contracts/StorageBackend.d.ts.map +1 -0
- package/dist/contracts/StorageBackend.js +196 -0
- package/dist/contracts/StorageBackend.js.map +1 -0
- package/dist/contracts/Sync.d.ts +286 -0
- package/dist/contracts/Sync.d.ts.map +1 -0
- package/dist/contracts/Sync.js +157 -0
- package/dist/contracts/Sync.js.map +1 -0
- package/dist/contracts/Telemetry.d.ts +183 -0
- package/dist/contracts/Telemetry.d.ts.map +1 -0
- package/dist/contracts/Telemetry.js +153 -0
- package/dist/contracts/Telemetry.js.map +1 -0
- package/dist/contracts/ThemeTokens.d.ts +212 -0
- package/dist/contracts/ThemeTokens.d.ts.map +1 -0
- package/dist/contracts/ThemeTokens.js +111 -0
- package/dist/contracts/ThemeTokens.js.map +1 -0
- package/dist/contracts/ToolSource.d.ts +135 -0
- package/dist/contracts/ToolSource.d.ts.map +1 -0
- package/dist/contracts/ToolSource.js +81 -0
- package/dist/contracts/ToolSource.js.map +1 -0
- package/dist/contracts/Versioning.d.ts +363 -0
- package/dist/contracts/Versioning.d.ts.map +1 -0
- package/dist/contracts/Versioning.js +201 -0
- package/dist/contracts/Versioning.js.map +1 -0
- package/dist/contracts/View.d.ts +232 -0
- package/dist/contracts/View.d.ts.map +1 -0
- package/dist/contracts/View.js +102 -0
- package/dist/contracts/View.js.map +1 -0
- package/dist/contracts/WorkItems.d.ts +242 -0
- package/dist/contracts/WorkItems.d.ts.map +1 -0
- package/dist/contracts/WorkItems.js +126 -0
- package/dist/contracts/WorkItems.js.map +1 -0
- package/dist/contracts/Workflow.d.ts +191 -0
- package/dist/contracts/Workflow.d.ts.map +1 -0
- package/dist/contracts/Workflow.js +63 -0
- package/dist/contracts/Workflow.js.map +1 -0
- package/dist/contracts/index.d.ts +75 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +196 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/devices/module.d.ts +3777 -0
- package/dist/devices/module.d.ts.map +1 -0
- package/dist/devices/module.js +179 -0
- package/dist/devices/module.js.map +1 -0
- package/dist/drizzle/Entity.d.ts +148 -0
- package/dist/drizzle/Entity.d.ts.map +1 -0
- package/dist/drizzle/Entity.js +396 -0
- package/dist/drizzle/Entity.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -3
- package/schema/Actor.json +46 -0
- package/schema/AuditRecord.json +403 -0
- package/schema/DaemonHealth.json +29 -0
- package/schema/InvocationError.json +257 -0
- package/schema/InvocationReceipt.json +253 -0
- package/schema/Lockfile.json +129 -0
- package/schema/OutboxEvent.json +36 -0
- package/schema/PairingConfirm.json +33 -0
- package/schema/PairingResult.json +18 -0
- package/schema/PairingStart.json +18 -0
- package/schema/ProvenanceEntry.json +110 -0
- package/schema/ReplayEnvelope.json +269 -0
- package/schema/Surface.json +17 -0
- package/schema/codegen/LocalClient.json +1295 -0
- package/schema/codegen/Sandbox.json +320 -0
- package/schema/contracts/ActionConsent.json +1930 -0
- package/schema/contracts/ActionRegistry.json +722 -0
- package/schema/contracts/Actor.json +451 -0
- package/schema/contracts/AgentResources.json +1400 -0
- package/schema/contracts/AgentRuntime.json +4017 -0
- package/schema/contracts/Approvals.json +2916 -0
- package/schema/contracts/Audit.json +3268 -0
- package/schema/contracts/CalendarProvider.json +5557 -0
- package/schema/contracts/ClientSDK.json +1400 -0
- package/schema/contracts/CollabDocument.json +4012 -0
- package/schema/contracts/Command.json +616 -0
- package/schema/contracts/Connections.json +6687 -0
- package/schema/contracts/ContextAccounting.json +685 -0
- package/schema/contracts/Daemon.json +4555 -0
- package/schema/contracts/DbTx.json +321 -0
- package/schema/contracts/Delegation.json +949 -0
- package/schema/contracts/DeviceControl.json +2626 -0
- package/schema/contracts/Directory.json +5168 -0
- package/schema/contracts/DirectoryProvider.json +2090 -0
- package/schema/contracts/DocumentSource.json +2044 -0
- package/schema/contracts/Files.json +4122 -0
- package/schema/contracts/Flags.json +1202 -0
- package/schema/contracts/Host.json +1769 -0
- package/schema/contracts/HttpApi.json +1615 -0
- package/schema/contracts/Ingestion.json +3211 -0
- package/schema/contracts/Ingress.json +819 -0
- package/schema/contracts/Invocation.json +2044 -0
- package/schema/contracts/LocalClient.json +6642 -0
- package/schema/contracts/Locale.json +654 -0
- package/schema/contracts/MachineIdentity.json +2303 -0
- package/schema/contracts/MailProvider.json +6663 -0
- package/schema/contracts/Memory.json +579 -0
- package/schema/contracts/Messaging.json +1764 -0
- package/schema/contracts/Metering.json +3060 -0
- package/schema/contracts/ModelProvider.json +1127 -0
- package/schema/contracts/ModuleManifest.json +9449 -0
- package/schema/contracts/NotificationChannel.json +986 -0
- package/schema/contracts/Notifications.json +4280 -0
- package/schema/contracts/Outbox.json +1451 -0
- package/schema/contracts/Privacy.json +4354 -0
- package/schema/contracts/Progress.json +1524 -0
- package/schema/contracts/QuerySurface.json +661 -0
- package/schema/contracts/Readiness.json +209 -0
- package/schema/contracts/Release.json +805 -0
- package/schema/contracts/ResultRendering.json +2859 -0
- package/schema/contracts/Sandbox.json +2286 -0
- package/schema/contracts/Scheduler.json +6138 -0
- package/schema/contracts/ScreenContext.json +1238 -0
- package/schema/contracts/Search.json +1058 -0
- package/schema/contracts/Secrets.json +2444 -0
- package/schema/contracts/Settings.json +654 -0
- package/schema/contracts/Sharing.json +2854 -0
- package/schema/contracts/Slot.json +537 -0
- package/schema/contracts/Space.json +892 -0
- package/schema/contracts/StorageAdapter.json +623 -0
- package/schema/contracts/StorageBackend.json +2421 -0
- package/schema/contracts/Sync.json +894 -0
- package/schema/contracts/Telemetry.json +696 -0
- package/schema/contracts/ThemeTokens.json +547 -0
- package/schema/contracts/ToolSource.json +1333 -0
- package/schema/contracts/Versioning.json +1481 -0
- package/schema/contracts/View.json +750 -0
- package/schema/contracts/WorkItems.json +1731 -0
- package/schema/contracts/Workflow.json +1242 -0
- package/src/Agent.ts +758 -0
- package/src/Analytics.ts +110 -0
- package/src/Approval.ts +131 -0
- package/src/Catalog.ts +192 -0
- package/src/Checklist.ts +162 -0
- package/src/Data.ts +109 -0
- package/src/Devices.ts +721 -0
- package/src/Durable.ts +240 -0
- package/src/Errors.ts +111 -0
- package/src/JsonSchema.ts +166 -0
- package/src/Manifest.ts +1147 -0
- package/src/Module.ts +640 -0
- package/src/Optimistic.ts +332 -0
- package/src/Projection.ts +207 -0
- package/src/Proposals.ts +89 -0
- package/src/Receipt.ts +125 -0
- package/src/Records.ts +197 -0
- package/src/Render.ts +515 -0
- package/src/Rpc.ts +113 -0
- package/src/SearchLanguages.ts +33 -0
- package/src/Service.ts +102 -0
- package/src/Versions.ts +69 -0
- package/src/contracts/ActionConsent.ts +150 -0
- package/src/contracts/ActionRegistry.ts +39 -0
- package/src/contracts/Actor.ts +53 -0
- package/src/contracts/AgentResources.ts +167 -0
- package/src/contracts/AgentRuntime.ts +154 -0
- package/src/contracts/Approvals.ts +133 -0
- package/src/contracts/Audit.ts +160 -0
- package/src/contracts/CalendarProvider.ts +241 -0
- package/src/contracts/Capability.ts +246 -0
- package/src/contracts/ClientSDK.ts +199 -0
- package/src/contracts/CollabDocument.ts +420 -0
- package/src/contracts/Command.ts +74 -0
- package/src/contracts/Connections.ts +360 -0
- package/src/contracts/ContextAccounting.ts +35 -0
- package/src/contracts/Daemon.ts +247 -0
- package/src/contracts/DbTx.ts +110 -0
- package/src/contracts/Delegation.ts +91 -0
- package/src/contracts/DeviceControl.ts +143 -0
- package/src/contracts/Directory.ts +384 -0
- package/src/contracts/DirectoryProvider.ts +82 -0
- package/src/contracts/DocumentSource.ts +71 -0
- package/src/contracts/Files.ts +395 -0
- package/src/contracts/Flags.ts +241 -0
- package/src/contracts/Host.ts +245 -0
- package/src/contracts/HttpApi.ts +100 -0
- package/src/contracts/Ingestion.ts +315 -0
- package/src/contracts/Ingress.ts +132 -0
- package/src/contracts/Invocation.ts +122 -0
- package/src/contracts/LocalClient.ts +614 -0
- package/src/contracts/Locale.ts +133 -0
- package/src/contracts/MachineIdentity.ts +305 -0
- package/src/contracts/MailProvider.ts +272 -0
- package/src/contracts/Memory.ts +47 -0
- package/src/contracts/Messaging.ts +108 -0
- package/src/contracts/Metering.ts +231 -0
- package/src/contracts/ModelProvider.ts +87 -0
- package/src/contracts/ModuleManifest.ts +310 -0
- package/src/contracts/NotificationChannel.ts +158 -0
- package/src/contracts/Notifications.ts +309 -0
- package/src/contracts/Outbox.ts +246 -0
- package/src/contracts/Privacy.ts +502 -0
- package/src/contracts/Progress.ts +196 -0
- package/src/contracts/QuerySurface.ts +134 -0
- package/src/contracts/Readiness.ts +67 -0
- package/src/contracts/Release.ts +199 -0
- package/src/contracts/ResultRendering.ts +65 -0
- package/src/contracts/Sandbox.ts +648 -0
- package/src/contracts/Scheduler.ts +237 -0
- package/src/contracts/ScreenContext.ts +316 -0
- package/src/contracts/Search.ts +126 -0
- package/src/contracts/Secrets.ts +162 -0
- package/src/contracts/Settings.ts +207 -0
- package/src/contracts/Sharing.ts +205 -0
- package/src/contracts/Slot.ts +61 -0
- package/src/contracts/Space.ts +157 -0
- package/src/contracts/StorageAdapter.ts +104 -0
- package/src/contracts/StorageBackend.ts +220 -0
- package/src/contracts/Sync.ts +180 -0
- package/src/contracts/Telemetry.ts +177 -0
- package/src/contracts/ThemeTokens.ts +136 -0
- package/src/contracts/ToolSource.ts +94 -0
- package/src/contracts/Versioning.ts +237 -0
- package/src/contracts/View.ts +116 -0
- package/src/contracts/WorkItems.ts +144 -0
- package/src/contracts/Workflow.ts +67 -0
- package/src/contracts/index.ts +205 -0
- package/src/devices/module.ts +201 -0
- package/src/drizzle/Entity.ts +524 -0
- 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
|
+
)
|