@eloxiv/contracts 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +888 -0
- package/dist/contracts/LocalClient.d.ts.map +1 -0
- package/dist/contracts/LocalClient.js +429 -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 +1298 -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 +6657 -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 +620 -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/Durable.ts
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Records of durable work (the Workflow and Scheduler contracts): who an
|
|
3
|
+
* execution acts as, what a schedule is, and what an execution reports.
|
|
4
|
+
*/
|
|
5
|
+
import { Schema } from "effect"
|
|
6
|
+
import { ApprovalComparison } from "./Approval.ts"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Who a workflow execution or a scheduled run acts as when its steps invoke actions.
|
|
10
|
+
*
|
|
11
|
+
* - `user`: a person in an organisation. Membership is checked again at every call, so a run whose user
|
|
12
|
+
* has left the organisation is refused (`Forbidden`), never run with stale rights.
|
|
13
|
+
* - `system`: the organisation's system actor, the identity outbox subscribers use. Module policies grant
|
|
14
|
+
* it explicitly (`principal == Eloxiv::User::"$system"`); it has no rights by default.
|
|
15
|
+
*
|
|
16
|
+
* A user identity with `agentSession` acts for the person as their agent (the ActionConsent contract): work an
|
|
17
|
+
* agent set up to run later (a schedule it created) keeps its origin, so its calls are agent-originated, bound
|
|
18
|
+
* to that session, and consent applies to them as it would have to the agent's own calls.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* One authority deferred or indirect work depends on (Authority): a credential (an API token, an OAuth grant with
|
|
22
|
+
* its audience), the agent session or paired device it acts through, the linked platform identity an inbound
|
|
23
|
+
* webhook acts as, the connection a sync applies pages through, the consent that let an agent's call through (a
|
|
24
|
+
* remembered permission, or the person's approval of the call), the person's own signed-in session a call is made
|
|
25
|
+
* with (its Better Auth session id: a link of that call alone, never recorded for work that outlives it), or the
|
|
26
|
+
* person's membership of the organisation (`<org>:<user>`, which every assertion includes for a person). Every link
|
|
27
|
+
* is checked, its row locked, inside the work's own transaction before it acts.
|
|
28
|
+
*/
|
|
29
|
+
export const AuthorityLink = Schema.Union([
|
|
30
|
+
Schema.Struct({ kind: Schema.Literal("membership"), id: Schema.String }),
|
|
31
|
+
Schema.Struct({ kind: Schema.Literal("connection"), id: Schema.String }),
|
|
32
|
+
Schema.Struct({ kind: Schema.Literal("api-token"), id: Schema.String }),
|
|
33
|
+
Schema.Struct({ kind: Schema.Literal("oauth"), id: Schema.String, resource: Schema.String }),
|
|
34
|
+
Schema.Struct({ kind: Schema.Literal("agent-session"), id: Schema.String }),
|
|
35
|
+
Schema.Struct({ kind: Schema.Literal("session"), id: Schema.String }),
|
|
36
|
+
Schema.Struct({ kind: Schema.Literal("device"), id: Schema.String }),
|
|
37
|
+
Schema.Struct({ kind: Schema.Literal("linked-identity"), id: Schema.String }),
|
|
38
|
+
Schema.Struct({ kind: Schema.Literal("consent-permission"), id: Schema.String }),
|
|
39
|
+
Schema.Struct({ kind: Schema.Literal("consent-request"), id: Schema.String }),
|
|
40
|
+
])
|
|
41
|
+
export type AuthorityLink = typeof AuthorityLink.Type
|
|
42
|
+
|
|
43
|
+
/** The authorities a piece of deferred work depends on, all of which must hold whenever it acts. */
|
|
44
|
+
export const AuthorityChain = Schema.Array(AuthorityLink)
|
|
45
|
+
export type AuthorityChain = typeof AuthorityChain.Type
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* What deferred work records of the call that queued it (an approval request, a schedule, an agent run, a device
|
|
49
|
+
* turn): the scope of the call's credential (null when not narrowed) and its chain of authorities.
|
|
50
|
+
*/
|
|
51
|
+
export const AuthorityRecord = Schema.Struct({
|
|
52
|
+
scope: Schema.NullOr(Schema.Array(Schema.String)),
|
|
53
|
+
chain: AuthorityChain,
|
|
54
|
+
/**
|
|
55
|
+
* Work that runs again and again (a schedule): a one-time consent authorised the one call that set it up, not its
|
|
56
|
+
* runs, so its chain must hold a remembered permission wherever it holds a one-time consent, or it is refused.
|
|
57
|
+
*/
|
|
58
|
+
recurring: Schema.optionalKey(Schema.Boolean),
|
|
59
|
+
})
|
|
60
|
+
export type AuthorityRecord = typeof AuthorityRecord.Type
|
|
61
|
+
|
|
62
|
+
export const ExecutionIdentity = Schema.Union([
|
|
63
|
+
Schema.Struct({
|
|
64
|
+
kind: Schema.Literal("user"),
|
|
65
|
+
userId: Schema.String,
|
|
66
|
+
orgId: Schema.String,
|
|
67
|
+
/** Work an agent set up or asked for: its calls are the agent's (origin `agent`), bound to this session. */
|
|
68
|
+
agentSession: Schema.optionalKey(Schema.String),
|
|
69
|
+
/**
|
|
70
|
+
* The person's own call, deferred (a business approval executing what they asked): origin `person` rather
|
|
71
|
+
* than `system`.
|
|
72
|
+
*/
|
|
73
|
+
origin: Schema.optionalKey(Schema.Literal("person")),
|
|
74
|
+
/**
|
|
75
|
+
* What the work acts under (Authority): the scope of the credential it was asked for with (null when not
|
|
76
|
+
* narrowed; it narrows every call and every read the work makes) and the chain of authorities it depends on,
|
|
77
|
+
* every one asserted inside each call's own transaction (refused once any is missing, revoked, expired or no
|
|
78
|
+
* longer the person's). `unrecorded`, or absent: work queued before its authority was recorded, which never
|
|
79
|
+
* acts (it fails closed). Trusted server code that acts as a person with no revocable link says so:
|
|
80
|
+
* `{ scope: null, chain: [] }`.
|
|
81
|
+
*/
|
|
82
|
+
authority: Schema.optionalKey(Schema.Union([AuthorityRecord, Schema.Literal("unrecorded")])),
|
|
83
|
+
}),
|
|
84
|
+
Schema.Struct({
|
|
85
|
+
kind: Schema.Literal("system"),
|
|
86
|
+
orgId: Schema.String,
|
|
87
|
+
/**
|
|
88
|
+
* The scope the system's work was narrowed to (absent or null: not narrowed), as a credential's scope narrows a
|
|
89
|
+
* person's: an agent run limited to some tools acts within the actions they are, and work it queues (a scheduled
|
|
90
|
+
* run, an approved call, a nested call) keeps that scope whoever it acts as.
|
|
91
|
+
*/
|
|
92
|
+
scope: Schema.optionalKey(Schema.NullOr(Schema.Array(Schema.String))),
|
|
93
|
+
}),
|
|
94
|
+
])
|
|
95
|
+
export type ExecutionIdentity = typeof ExecutionIdentity.Type
|
|
96
|
+
|
|
97
|
+
/** A cron expression (5 fields, or 6 with seconds first) evaluated in an IANA time zone. */
|
|
98
|
+
export const CronSchedule = Schema.Struct({
|
|
99
|
+
kind: Schema.Literal("cron"),
|
|
100
|
+
expression: Schema.String,
|
|
101
|
+
/**
|
|
102
|
+
* IANA time zone, e.g. `Europe/London`. A local time a DST change skips runs once, shifted by the length of
|
|
103
|
+
* the gap (02:30 on a day when 02:00 jumps to 03:00 runs at 03:30); a local time a DST change repeats runs
|
|
104
|
+
* once, at its earlier occurrence.
|
|
105
|
+
*/
|
|
106
|
+
timeZone: Schema.String,
|
|
107
|
+
})
|
|
108
|
+
export type CronSchedule = typeof CronSchedule.Type
|
|
109
|
+
|
|
110
|
+
/** Every `everyMs` milliseconds from the schedule's anchor (when the kernel first saw it). */
|
|
111
|
+
export const IntervalSchedule = Schema.Struct({
|
|
112
|
+
kind: Schema.Literal("interval"),
|
|
113
|
+
everyMs: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
114
|
+
})
|
|
115
|
+
export type IntervalSchedule = typeof IntervalSchedule.Type
|
|
116
|
+
|
|
117
|
+
export const ScheduleSpec = Schema.Union([CronSchedule, IntervalSchedule])
|
|
118
|
+
export type ScheduleSpec = typeof ScheduleSpec.Type
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* When an event automation acts on an event: every comparison holds on the event's payload (`match`, the
|
|
122
|
+
* approval rules' comparisons: dot paths into the payload, never coerced), or the organisation's model judges
|
|
123
|
+
* that the event satisfies `prompt` (`prompt`, a natural-language condition; the model sees only that event's
|
|
124
|
+
* payload, and only once the automation's owner may read the event's record, metered for the owner).
|
|
125
|
+
*/
|
|
126
|
+
export const AutomationCondition = Schema.Union([
|
|
127
|
+
Schema.Struct({
|
|
128
|
+
kind: Schema.Literal("match"),
|
|
129
|
+
all: Schema.Array(ApprovalComparison).check(Schema.isMinLength(1), Schema.isMaxLength(20)),
|
|
130
|
+
}),
|
|
131
|
+
Schema.Struct({
|
|
132
|
+
kind: Schema.Literal("prompt"),
|
|
133
|
+
prompt: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(2_000)),
|
|
134
|
+
}),
|
|
135
|
+
])
|
|
136
|
+
export type AutomationCondition = typeof AutomationCondition.Type
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* A member's event automation: run the target for each event of type `event` (one that names its record) that
|
|
140
|
+
* its owner may read, when the condition holds. A string value of the target's input that is exactly
|
|
141
|
+
* `{{event.<path>}}` is replaced by that payload field (null when it is missing).
|
|
142
|
+
*/
|
|
143
|
+
export const EventSchedule = Schema.Struct({
|
|
144
|
+
kind: Schema.Literal("event"),
|
|
145
|
+
event: Schema.String.check(Schema.isNonEmpty()),
|
|
146
|
+
condition: Schema.optionalKey(AutomationCondition),
|
|
147
|
+
})
|
|
148
|
+
export type EventSchedule = typeof EventSchedule.Type
|
|
149
|
+
|
|
150
|
+
/** What a runtime schedule runs on: a cron or interval schedule, or events. */
|
|
151
|
+
export const RuntimeScheduleSpec = Schema.Union([CronSchedule, IntervalSchedule, EventSchedule])
|
|
152
|
+
export type RuntimeScheduleSpec = typeof RuntimeScheduleSpec.Type
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* What happens to runs that came due while no kernel was running them (older than the scheduler's grace
|
|
156
|
+
* period when it next sweeps):
|
|
157
|
+
* - `once` (default): run once for all of them, at the latest missed time;
|
|
158
|
+
* - `all`: run each missed time, oldest first (at most 100 per sweep);
|
|
159
|
+
* - `skip`: run none of them.
|
|
160
|
+
* Runs within the grace period always run.
|
|
161
|
+
*/
|
|
162
|
+
export const CatchUp = Schema.Literals(["once", "all", "skip"])
|
|
163
|
+
export type CatchUp = typeof CatchUp.Type
|
|
164
|
+
|
|
165
|
+
/** What a schedule starts: an action with input, or a workflow with input. */
|
|
166
|
+
export const ScheduleTarget = Schema.Union([
|
|
167
|
+
Schema.Struct({ kind: Schema.Literal("action"), action: Schema.String, input: Schema.Unknown }),
|
|
168
|
+
Schema.Struct({ kind: Schema.Literal("workflow"), workflow: Schema.String, input: Schema.Unknown }),
|
|
169
|
+
])
|
|
170
|
+
export type ScheduleTarget = typeof ScheduleTarget.Type
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* A job declared in a module manifest. It runs for every organisation, as that organisation's system
|
|
174
|
+
* actor, and invokes `action` with `input` through the invocation path.
|
|
175
|
+
*/
|
|
176
|
+
export const JobContract = Schema.Struct({
|
|
177
|
+
description: Schema.String,
|
|
178
|
+
schedule: ScheduleSpec,
|
|
179
|
+
action: Schema.String,
|
|
180
|
+
input: Schema.Unknown,
|
|
181
|
+
identity: Schema.Literal("system"),
|
|
182
|
+
catchUp: Schema.optionalKey(CatchUp),
|
|
183
|
+
})
|
|
184
|
+
export type JobContract = typeof JobContract.Type
|
|
185
|
+
|
|
186
|
+
/** Where an execution is. `running` covers executions that have not started yet or are between steps. */
|
|
187
|
+
export const ExecutionState = Schema.Literals(["running", "suspended", "succeeded", "failed", "cancelled"])
|
|
188
|
+
export type ExecutionState = typeof ExecutionState.Type
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* A run's typed outcome when it did nothing on purpose: a background job that found no work, a condition that did
|
|
192
|
+
* not hold. It is distinct from a success that shows nothing (completed), from a failure, and from a run whose
|
|
193
|
+
* effects are unknown. A workflow declares it with `ctx.noop(reason, evidence)`; an action a schedule or trigger
|
|
194
|
+
* runs returns it as its output (`noOp(...)`), which the run records. `reason` and `evidence` are what the work
|
|
195
|
+
* says about why: kept with the run's history, so keep them free of a person's data.
|
|
196
|
+
*/
|
|
197
|
+
export const NoOpOutcome = Schema.Struct({
|
|
198
|
+
"eloxiv/outcome": Schema.Literal("noop"),
|
|
199
|
+
reason: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(500)),
|
|
200
|
+
evidence: Schema.optionalKey(
|
|
201
|
+
Schema.Array(Schema.String.check(Schema.isMaxLength(500))).check(Schema.isMaxLength(20)),
|
|
202
|
+
),
|
|
203
|
+
})
|
|
204
|
+
export type NoOpOutcome = typeof NoOpOutcome.Type
|
|
205
|
+
|
|
206
|
+
/** The no-op outcome an action returns (or a workflow body records with `ctx.noop`). */
|
|
207
|
+
export const noOp = (reason: string, evidence?: ReadonlyArray<string>): NoOpOutcome => ({
|
|
208
|
+
"eloxiv/outcome": "noop",
|
|
209
|
+
reason,
|
|
210
|
+
...(evidence === undefined ? {} : { evidence: [...evidence] }),
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
/** Whether a value (an action's encoded output) is a no-op outcome. */
|
|
214
|
+
export const isNoOp: (value: unknown) => value is NoOpOutcome = Schema.is(NoOpOutcome)
|
|
215
|
+
|
|
216
|
+
export const ExecutionStatus = Schema.Struct({
|
|
217
|
+
executionId: Schema.String,
|
|
218
|
+
workflow: Schema.String,
|
|
219
|
+
key: Schema.String,
|
|
220
|
+
state: ExecutionState,
|
|
221
|
+
/** The workflow's result (JSON), when it succeeded. */
|
|
222
|
+
output: Schema.optionalKey(Schema.Unknown),
|
|
223
|
+
/** When it succeeded by doing nothing on purpose: the no-op it recorded. */
|
|
224
|
+
noop: Schema.optionalKey(NoOpOutcome),
|
|
225
|
+
/** The failure (tag and message), when it failed. */
|
|
226
|
+
error: Schema.optionalKey(Schema.Struct({ tag: Schema.String, message: Schema.String })),
|
|
227
|
+
})
|
|
228
|
+
export type ExecutionStatus = typeof ExecutionStatus.Type
|
|
229
|
+
|
|
230
|
+
/** One journalled step of an execution. */
|
|
231
|
+
export const StepRecord = Schema.Struct({
|
|
232
|
+
step: Schema.String,
|
|
233
|
+
/** How many times the step body started (more than one after a crash or a retried failure). */
|
|
234
|
+
attempts: Schema.Int,
|
|
235
|
+
state: Schema.Literals(["started", "succeeded", "failed"]),
|
|
236
|
+
/** For steps that invoke an action: the invocation that ran, and whether it returned a replay receipt. */
|
|
237
|
+
invocationId: Schema.NullOr(Schema.String),
|
|
238
|
+
replayed: Schema.NullOr(Schema.Boolean),
|
|
239
|
+
})
|
|
240
|
+
export type StepRecord = typeof StepRecord.Type
|
package/src/Errors.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The standard error set every action can fail with, on every surface.
|
|
3
|
+
* Surfaces translate these to their own vocabulary (HTTP status, MCP error, tool error)
|
|
4
|
+
* but the tag and fields are the contract.
|
|
5
|
+
*/
|
|
6
|
+
import { Schema } from "effect"
|
|
7
|
+
|
|
8
|
+
export class Unauthenticated extends Schema.TaggedError<Unauthenticated>()(
|
|
9
|
+
"Unauthenticated",
|
|
10
|
+
{ message: Schema.String },
|
|
11
|
+
{ httpApiStatus: 401 },
|
|
12
|
+
) {}
|
|
13
|
+
|
|
14
|
+
export class Forbidden extends Schema.TaggedError<Forbidden>()(
|
|
15
|
+
"Forbidden",
|
|
16
|
+
{ message: Schema.String, action: Schema.String },
|
|
17
|
+
{ httpApiStatus: 403 },
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
export class ApprovalRequired extends Schema.TaggedError<ApprovalRequired>()(
|
|
21
|
+
"ApprovalRequired",
|
|
22
|
+
{ message: Schema.String, action: Schema.String, approvalId: Schema.String },
|
|
23
|
+
{ httpApiStatus: 409 },
|
|
24
|
+
) {}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* An agent-originated call to an action that needs the person's consent (ActionConsent) is held: nothing ran.
|
|
28
|
+
* `consentId` names the pending consent, bound to the exact prepared input; the person approves or rejects it.
|
|
29
|
+
*/
|
|
30
|
+
export class ConsentRequired extends Schema.TaggedError<ConsentRequired>()(
|
|
31
|
+
"ConsentRequired",
|
|
32
|
+
{ message: Schema.String, action: Schema.String, consentId: Schema.String },
|
|
33
|
+
{ httpApiStatus: 409 },
|
|
34
|
+
) {}
|
|
35
|
+
|
|
36
|
+
export class IdempotencyConflict extends Schema.TaggedError<IdempotencyConflict>()(
|
|
37
|
+
"IdempotencyConflict",
|
|
38
|
+
{ message: Schema.String, key: Schema.String },
|
|
39
|
+
{ httpApiStatus: 422 },
|
|
40
|
+
) {}
|
|
41
|
+
|
|
42
|
+
export class InvalidInput extends Schema.TaggedError<InvalidInput>()(
|
|
43
|
+
"InvalidInput",
|
|
44
|
+
{ message: Schema.String },
|
|
45
|
+
{ httpApiStatus: 400 },
|
|
46
|
+
) {}
|
|
47
|
+
|
|
48
|
+
export class UnknownAction extends Schema.TaggedError<UnknownAction>()(
|
|
49
|
+
"UnknownAction",
|
|
50
|
+
{ message: Schema.String, action: Schema.String },
|
|
51
|
+
{ httpApiStatus: 404 },
|
|
52
|
+
) {}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* What a failed call may have done, so a caller knows whether retrying it can do something twice:
|
|
56
|
+
*
|
|
57
|
+
* - `none`: nothing of the call was kept: its writes, audit success, events and scheduled effects rolled back, and
|
|
58
|
+
* it changed nothing at a provider. Retrying it (with a new key or none) cannot repeat anything.
|
|
59
|
+
* - `unknown`: it may have acted, for one of two reasons the caller handles differently:
|
|
60
|
+
* - it changed the account's own data at a provider directly, or ran setup (MAKE's install and rollback, whose
|
|
61
|
+
* migrations commit on their own): those changes stay, while the call itself, its idempotency claim included,
|
|
62
|
+
* rolled back. A retry, even with the same key, runs it again and repeats them: reconcile first (read the state
|
|
63
|
+
* back) and retry only what did not happen;
|
|
64
|
+
* - it failed while its transaction was committing: the commit may have taken effect. A retry with the same
|
|
65
|
+
* idempotency key is safe: a call that committed answers with its receipt, one that did not runs once.
|
|
66
|
+
* Never retry an `unknown` failure blindly.
|
|
67
|
+
*/
|
|
68
|
+
export const FailedEffect = Schema.Literals(["none", "unknown"])
|
|
69
|
+
export type FailedEffect = typeof FailedEffect.Type
|
|
70
|
+
|
|
71
|
+
export class ActionFailed extends Schema.TaggedError<ActionFailed>()(
|
|
72
|
+
"ActionFailed",
|
|
73
|
+
{
|
|
74
|
+
message: Schema.String,
|
|
75
|
+
action: Schema.String,
|
|
76
|
+
/** What the failed call may have done (set by the invocation path on every call it answers). */
|
|
77
|
+
effect: Schema.optionalKey(FailedEffect),
|
|
78
|
+
},
|
|
79
|
+
{ httpApiStatus: 500 },
|
|
80
|
+
) {}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The client (an SDK build, a browser tab) is older than the oldest client the kernel accepts writes from
|
|
84
|
+
* (the Release contract's version skew). Its reads keep working; it should reload or upgrade, then retry.
|
|
85
|
+
*/
|
|
86
|
+
export class ClientOutdated extends Schema.TaggedError<ClientOutdated>()(
|
|
87
|
+
"ClientOutdated",
|
|
88
|
+
{
|
|
89
|
+
message: Schema.String,
|
|
90
|
+
action: Schema.String,
|
|
91
|
+
/** The version the client sent (`x-eloxiv-client-version`). */
|
|
92
|
+
clientVersion: Schema.String,
|
|
93
|
+
/** The oldest client version the kernel accepts writes from. */
|
|
94
|
+
minClientVersion: Schema.String,
|
|
95
|
+
},
|
|
96
|
+
{ httpApiStatus: 426 },
|
|
97
|
+
) {}
|
|
98
|
+
|
|
99
|
+
/** Every error an invocation can end with. */
|
|
100
|
+
export const InvocationError = Schema.Union([
|
|
101
|
+
Unauthenticated,
|
|
102
|
+
Forbidden,
|
|
103
|
+
ApprovalRequired,
|
|
104
|
+
ConsentRequired,
|
|
105
|
+
IdempotencyConflict,
|
|
106
|
+
InvalidInput,
|
|
107
|
+
UnknownAction,
|
|
108
|
+
ActionFailed,
|
|
109
|
+
ClientOutdated,
|
|
110
|
+
])
|
|
111
|
+
export type InvocationError = typeof InvocationError.Type
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/** JSON Schema emission: the language-neutral form of every contract. */
|
|
2
|
+
import { Schema } from "effect"
|
|
3
|
+
import { queryViewName, type ManifestDeclarations } from "./Manifest.ts"
|
|
4
|
+
import type { AnyModuleContract } from "./Module.ts"
|
|
5
|
+
import { actionResult } from "./Receipt.ts"
|
|
6
|
+
|
|
7
|
+
export type JsonSchemaDocument = Record<string, unknown>
|
|
8
|
+
|
|
9
|
+
export const toJsonSchema = (schema: Schema.Top): JsonSchemaDocument => {
|
|
10
|
+
const document = Schema.toJsonSchemaDocument(schema)
|
|
11
|
+
const definitions = document.definitions
|
|
12
|
+
return Object.keys(definitions).length === 0
|
|
13
|
+
? { $schema: "https://json-schema.org/draft/2020-12/schema", ...document.schema }
|
|
14
|
+
: { $schema: "https://json-schema.org/draft/2020-12/schema", ...document.schema, $defs: definitions }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** A module manifest's declarative part as JSON: what other languages and tools consume. */
|
|
18
|
+
export const moduleToJson = (module: AnyModuleContract) => ({
|
|
19
|
+
name: module.name,
|
|
20
|
+
version: module.version,
|
|
21
|
+
...(module.kernel === undefined ? {} : { kernel: module.kernel }),
|
|
22
|
+
cedarNamespace: module.cedarNamespace,
|
|
23
|
+
actions: Object.fromEntries(
|
|
24
|
+
Object.values(module.actions as Record<string, import("./Module.ts").AnyAction>).map((action) => [
|
|
25
|
+
action.name,
|
|
26
|
+
{
|
|
27
|
+
title: action.title,
|
|
28
|
+
description: action.description,
|
|
29
|
+
cedarAction: action.cedarAction,
|
|
30
|
+
// The authorisation contract: what the action may change.
|
|
31
|
+
writes: action.writes ?? null,
|
|
32
|
+
target: action.target ?? null,
|
|
33
|
+
actsOn: [...(action.actsOn ?? [])],
|
|
34
|
+
organisationWide: action.organisationWide ?? false,
|
|
35
|
+
bestEffort: action.bestEffort,
|
|
36
|
+
hints: action.hints,
|
|
37
|
+
consent: action.consent,
|
|
38
|
+
...(action.consentEachCall ? { consentEachCall: true } : {}),
|
|
39
|
+
// The surfaces that do not offer it, when there are any.
|
|
40
|
+
...(Object.values(action.exposure ?? {}).every(Boolean) ? {} : { exposure: action.exposure }),
|
|
41
|
+
...(Object.keys(action.connections ?? {}).length === 0 ? {} : { connections: action.connections }),
|
|
42
|
+
// The change a client's replica predicts before the server answers (Optimistic.ts), or null.
|
|
43
|
+
optimistic: action.optimistic ?? null,
|
|
44
|
+
input: toJsonSchema(action.input),
|
|
45
|
+
output: toJsonSchema(action.output),
|
|
46
|
+
// What every surface returns: { kind: "output", output } or { kind: "replay", receipt }.
|
|
47
|
+
result: toJsonSchema(actionResult(action)),
|
|
48
|
+
// How the output is shown (ResultRendering), when the module declares it.
|
|
49
|
+
...(action.render === undefined ? {} : { render: action.render }),
|
|
50
|
+
},
|
|
51
|
+
]),
|
|
52
|
+
),
|
|
53
|
+
events: Object.fromEntries(
|
|
54
|
+
Object.values(module.events as Record<string, import("./Module.ts").AnyEvent>).map((event) => [
|
|
55
|
+
event.type,
|
|
56
|
+
{ payload: toJsonSchema(event.payload) },
|
|
57
|
+
]),
|
|
58
|
+
),
|
|
59
|
+
entities: Object.fromEntries(
|
|
60
|
+
Object.values(module.entities as Record<string, import("./Module.ts").AnyEntity>).map((entity) => [
|
|
61
|
+
entity.name,
|
|
62
|
+
{
|
|
63
|
+
cedarType: entity.cedarType,
|
|
64
|
+
table: `${entity.table.schema}.${entity.table.name}`,
|
|
65
|
+
primaryKey: entity.primaryKey,
|
|
66
|
+
columns: entity.columns,
|
|
67
|
+
policyAttributes: entity.policyAttributes,
|
|
68
|
+
...(entity.search === undefined ? {} : { search: entity.search }),
|
|
69
|
+
...(entity.files === undefined ? {} : { files: entity.files }),
|
|
70
|
+
...(entity.collab === undefined ? {} : { collab: entity.collab }),
|
|
71
|
+
row: toJsonSchema(entity.row),
|
|
72
|
+
...(entity.history === true ? { history: true } : {}),
|
|
73
|
+
storage: entity.storage,
|
|
74
|
+
sync: entity.sync,
|
|
75
|
+
uniqueKeys: entity.uniqueKeys,
|
|
76
|
+
relationships: entity.relationships,
|
|
77
|
+
},
|
|
78
|
+
]),
|
|
79
|
+
),
|
|
80
|
+
...declarationsToJson(module),
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
const map = <V, R>(record: Readonly<Record<string, V>> | undefined, f: (value: V, key: string) => R) =>
|
|
84
|
+
Object.fromEntries(Object.entries(record ?? {}).map(([key, value]) => [key, f(value, key)])) as Record<string, R>
|
|
85
|
+
|
|
86
|
+
/** The manifest's declarations as JSON, with JSON Schema for every schema-typed field. */
|
|
87
|
+
const declarationsToJson = (module: Partial<ManifestDeclarations> & { readonly entities: object }) => ({
|
|
88
|
+
permissions: map(module.permissions, (p) => ({ description: p.description, actions: [...p.actions] })),
|
|
89
|
+
settings: map(module.settings, (s) => ({
|
|
90
|
+
description: s.description,
|
|
91
|
+
scope: s.scope,
|
|
92
|
+
schema: toJsonSchema(s.schema),
|
|
93
|
+
default: s.default,
|
|
94
|
+
})),
|
|
95
|
+
flags: map(module.flags, (f) => ({ description: f.description, default: f.default })),
|
|
96
|
+
skills: map(module.skills, (s) => ({
|
|
97
|
+
description: s.description,
|
|
98
|
+
content: s.content,
|
|
99
|
+
evals: s.evals ?? null,
|
|
100
|
+
...(s.audience === undefined ? {} : { audience: s.audience }),
|
|
101
|
+
...(s.requires === undefined ? {} : { requires: { flag: s.requires.flag } }),
|
|
102
|
+
})),
|
|
103
|
+
views: map(module.views, (v) => ({
|
|
104
|
+
title: v.title,
|
|
105
|
+
description: v.description ?? null,
|
|
106
|
+
route: v.route,
|
|
107
|
+
shows: v.shows,
|
|
108
|
+
})),
|
|
109
|
+
slots: map(module.slots, (s) => ({ description: s.description, accepts: s.accepts })),
|
|
110
|
+
contributions: map(module.contributions, (c) => ({ ...c, order: c.order ?? null })),
|
|
111
|
+
commands: map(module.commands, (c) => ({
|
|
112
|
+
title: c.title,
|
|
113
|
+
description: c.description ?? null,
|
|
114
|
+
keywords: [...(c.keywords ?? [])],
|
|
115
|
+
run: c.run,
|
|
116
|
+
})),
|
|
117
|
+
workItemSources: map(module.workItemSources, (w) => ({
|
|
118
|
+
description: w.description,
|
|
119
|
+
entity: w.entity,
|
|
120
|
+
title: w.title,
|
|
121
|
+
state: w.state,
|
|
122
|
+
assignee: w.assignee,
|
|
123
|
+
link: w.link,
|
|
124
|
+
})),
|
|
125
|
+
entityResolvers: map(module.entityResolvers, (r) => ({ title: r.title, link: r.link ?? null })),
|
|
126
|
+
queryViews: map(module.queryViews, (q, id) => {
|
|
127
|
+
const entity = (module.entities as Record<string, { readonly table: { readonly schema: string } }>)[q.entity]
|
|
128
|
+
return {
|
|
129
|
+
description: q.description,
|
|
130
|
+
entity: q.entity,
|
|
131
|
+
sql: q.sql,
|
|
132
|
+
// The database view the kernel creates for it (security invoker, in the module's schema).
|
|
133
|
+
view: entity === undefined ? null : `${entity.table.schema}.${queryViewName(id)}`,
|
|
134
|
+
row: toJsonSchema(q.row),
|
|
135
|
+
...(q.render === undefined ? {} : { render: q.render }),
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
138
|
+
approvalRules: map(module.approvalRules, (r) => ({
|
|
139
|
+
description: r.description,
|
|
140
|
+
action: r.action,
|
|
141
|
+
when: [...(r.when ?? [])],
|
|
142
|
+
approvers: r.approvers,
|
|
143
|
+
quorum: r.quorum ?? 1,
|
|
144
|
+
allowSelfApproval: r.allowSelfApproval ?? false,
|
|
145
|
+
expiresAfterMs: r.expiresAfterMs ?? null,
|
|
146
|
+
})),
|
|
147
|
+
toolGroups: map(module.toolGroups, (g) => ({ description: g.description, actions: [...g.actions] })),
|
|
148
|
+
// The analytics events the module sends (Telemetry), when it declares any.
|
|
149
|
+
...(Object.keys(module.analyticsEvents ?? {}).length === 0 ? {} : { analyticsEvents: module.analyticsEvents }),
|
|
150
|
+
// Records about a person and what erasure does to them (Privacy), when the module declares any.
|
|
151
|
+
...(Object.keys(module.dataSubjects ?? {}).length === 0
|
|
152
|
+
? {}
|
|
153
|
+
: {
|
|
154
|
+
dataSubjects: map(module.dataSubjects, (d) =>
|
|
155
|
+
"none" in d
|
|
156
|
+
? { none: d.none }
|
|
157
|
+
: {
|
|
158
|
+
fields: [...d.fields],
|
|
159
|
+
erase: d.erase,
|
|
160
|
+
...(d.export === undefined
|
|
161
|
+
? {}
|
|
162
|
+
: { export: d.export === false ? false : { fields: [...d.export.fields] } }),
|
|
163
|
+
},
|
|
164
|
+
),
|
|
165
|
+
}),
|
|
166
|
+
})
|