@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/Analytics.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declared product analytics events (the Telemetry contract, `contracts/Telemetry.ts`), apart from the contract
|
|
3
|
+
* so the manifest checks can use them. Every event a module, an app's clients or the kernel sends is declared:
|
|
4
|
+
* its consent category and each property with a type. Only these leave:
|
|
5
|
+
*
|
|
6
|
+
* - `enum`: one of the declared values (never caller text);
|
|
7
|
+
* - `number`: a finite number;
|
|
8
|
+
* - `boolean`;
|
|
9
|
+
* - `id`: an identifier, which leaves only pseudonymised (a keyed hash), never as given.
|
|
10
|
+
*
|
|
11
|
+
* Anything else (an undeclared event or property, a value of another type or outside its enum) is refused.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export type AnalyticsProperty =
|
|
15
|
+
| { readonly kind: "enum"; readonly values: ReadonlyArray<string> }
|
|
16
|
+
| { readonly kind: "number" }
|
|
17
|
+
| { readonly kind: "boolean" }
|
|
18
|
+
| { readonly kind: "id" }
|
|
19
|
+
|
|
20
|
+
/** A declared event: what it records, the consent it needs, and its properties. */
|
|
21
|
+
export interface AnalyticsEventDeclaration {
|
|
22
|
+
readonly description: string
|
|
23
|
+
/** The Privacy consent category it needs (never `necessary`: analytics is never necessary). */
|
|
24
|
+
readonly category: "functional" | "analytics" | "marketing"
|
|
25
|
+
readonly properties: Readonly<Record<string, AnalyticsProperty>>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** An event name: lower case, namespaced (`journal.entry_written`, `client.page_viewed`). */
|
|
29
|
+
export const ANALYTICS_EVENT_NAME = /^[a-z][a-z0-9_]*(?:\.[a-z0-9_]+)+$/
|
|
30
|
+
const PROPERTY_NAME = /^[a-z][a-z0-9_]{0,63}$/
|
|
31
|
+
const ENUM_VALUE = /^[a-z0-9][a-z0-9_.:-]{0,63}$/
|
|
32
|
+
|
|
33
|
+
/** Why a declaration cannot be used (empty: it can). */
|
|
34
|
+
export const analyticsEventProblems = (id: string, declaration: AnalyticsEventDeclaration): ReadonlyArray<string> => {
|
|
35
|
+
const problems: Array<string> = []
|
|
36
|
+
if (!ANALYTICS_EVENT_NAME.test(id)) problems.push(`analytics event ${id} is not a lower-case, namespaced name`)
|
|
37
|
+
if (typeof declaration.description !== "string" || declaration.description.trim() === "") {
|
|
38
|
+
problems.push(`analytics event ${id} has no description`)
|
|
39
|
+
}
|
|
40
|
+
if (!["functional", "analytics", "marketing"].includes(declaration.category)) {
|
|
41
|
+
problems.push(`analytics event ${id} needs the category functional, analytics or marketing`)
|
|
42
|
+
}
|
|
43
|
+
for (const [name, property] of Object.entries(declaration.properties ?? {})) {
|
|
44
|
+
if (!PROPERTY_NAME.test(name))
|
|
45
|
+
problems.push(`analytics event ${id} has property ${name}, not a lower snake case name`)
|
|
46
|
+
const kind = (property as { readonly kind?: unknown }).kind
|
|
47
|
+
if (kind === "enum") {
|
|
48
|
+
const values = (property as { readonly values?: unknown }).values
|
|
49
|
+
if (!Array.isArray(values) || values.length === 0)
|
|
50
|
+
problems.push(`analytics event ${id}: ${name} declares no values`)
|
|
51
|
+
else {
|
|
52
|
+
for (const value of values) {
|
|
53
|
+
if (typeof value !== "string" || !ENUM_VALUE.test(value)) {
|
|
54
|
+
problems.push(`analytics event ${id}: ${name} has value ${String(value)}, not a short lower-case token`)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} else if (kind !== "number" && kind !== "boolean" && kind !== "id") {
|
|
59
|
+
problems.push(`analytics event ${id}: ${name} has unknown kind ${String(kind)}`)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return problems
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* An event's properties checked against its declaration: the values as they may leave, and which of them are ids
|
|
67
|
+
* (to pseudonymise before they leave); or why they are refused.
|
|
68
|
+
*/
|
|
69
|
+
export const checkAnalyticsProperties = (
|
|
70
|
+
declaration: AnalyticsEventDeclaration,
|
|
71
|
+
properties: Readonly<Record<string, unknown>> | undefined,
|
|
72
|
+
):
|
|
73
|
+
| {
|
|
74
|
+
readonly ok: true
|
|
75
|
+
readonly properties: Readonly<Record<string, string | number | boolean>>
|
|
76
|
+
readonly ids: ReadonlyArray<string>
|
|
77
|
+
}
|
|
78
|
+
| { readonly ok: false; readonly problem: string } => {
|
|
79
|
+
const out: Record<string, string | number | boolean> = {}
|
|
80
|
+
const ids: Array<string> = []
|
|
81
|
+
for (const [name, value] of Object.entries(properties ?? {})) {
|
|
82
|
+
const property = declaration.properties[name]
|
|
83
|
+
if (property === undefined) return { ok: false, problem: `property ${name} is not declared` }
|
|
84
|
+
switch (property.kind) {
|
|
85
|
+
case "enum":
|
|
86
|
+
if (typeof value !== "string" || !property.values.includes(value)) {
|
|
87
|
+
return { ok: false, problem: `property ${name} must be one of ${property.values.join(", ")}` }
|
|
88
|
+
}
|
|
89
|
+
out[name] = value
|
|
90
|
+
break
|
|
91
|
+
case "number":
|
|
92
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
93
|
+
return { ok: false, problem: `property ${name} must be a number` }
|
|
94
|
+
out[name] = value
|
|
95
|
+
break
|
|
96
|
+
case "boolean":
|
|
97
|
+
if (typeof value !== "boolean") return { ok: false, problem: `property ${name} must be a boolean` }
|
|
98
|
+
out[name] = value
|
|
99
|
+
break
|
|
100
|
+
case "id":
|
|
101
|
+
if (typeof value !== "string" || value.length === 0 || value.length > 200) {
|
|
102
|
+
return { ok: false, problem: `property ${name} must be an id` }
|
|
103
|
+
}
|
|
104
|
+
out[name] = value
|
|
105
|
+
ids.push(name)
|
|
106
|
+
break
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return { ok: true, properties: out, ids }
|
|
110
|
+
}
|
package/src/Approval.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Business approval rules (the Approvals contract), as declarative data a module manifest (`approvalRules`)
|
|
3
|
+
* or an app's configuration carries: which action needs approval, under what condition on its input, who may
|
|
4
|
+
* approve, how many approvals it takes, whether the requester may approve their own call and when the request
|
|
5
|
+
* expires. Conditions are evaluated on the action's decoded-then-encoded input, the same JSON whose hash the
|
|
6
|
+
* approval binds, so what the rule tested is exactly what runs.
|
|
7
|
+
*/
|
|
8
|
+
import { Schema } from "effect"
|
|
9
|
+
|
|
10
|
+
/** A comparison operator. `gt`, `gte`, `lt` and `lte` hold only between two numbers, `in` between a value and a list. */
|
|
11
|
+
export const ComparisonOperator = Schema.Literals(["eq", "ne", "gt", "gte", "lt", "lte", "in", "exists"])
|
|
12
|
+
export type ComparisonOperator = typeof ComparisonOperator.Type
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* One test on the input: `field` is a dot path into the encoded input (`amount`, `vendor.country`). A missing
|
|
16
|
+
* field fails every test except `ne` and `exists` (with `value: false`). Values of different JSON types are
|
|
17
|
+
* never equal, and an ordering between non-numbers is false, so a rule never matches by coercion.
|
|
18
|
+
*/
|
|
19
|
+
export const ApprovalComparison = Schema.Struct({
|
|
20
|
+
field: Schema.String,
|
|
21
|
+
op: ComparisonOperator,
|
|
22
|
+
/** The JSON value to compare with (a list for `in`, a boolean for `exists`). */
|
|
23
|
+
value: Schema.Unknown,
|
|
24
|
+
})
|
|
25
|
+
export type ApprovalComparison = typeof ApprovalComparison.Type
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Who may decide: members of the acting organisation who hold a permission (through their roles), hold a
|
|
29
|
+
* role, or belong to a group, checked against the live directory at the moment they decide.
|
|
30
|
+
*/
|
|
31
|
+
export const ApproverSpec = Schema.Union([
|
|
32
|
+
Schema.Struct({ permission: Schema.String }),
|
|
33
|
+
Schema.Struct({ role: Schema.String }),
|
|
34
|
+
Schema.Struct({ group: Schema.String }),
|
|
35
|
+
])
|
|
36
|
+
export type ApproverSpec = typeof ApproverSpec.Type
|
|
37
|
+
|
|
38
|
+
export const ApprovalRule = Schema.Struct({
|
|
39
|
+
description: Schema.String,
|
|
40
|
+
/** The action the rule applies to (its registered name). */
|
|
41
|
+
action: Schema.String,
|
|
42
|
+
/** Every comparison must hold (an empty or missing list always matches). For "or", declare two rules. */
|
|
43
|
+
when: Schema.optionalKey(Schema.Array(ApprovalComparison)),
|
|
44
|
+
approvers: ApproverSpec,
|
|
45
|
+
/** How many distinct approvers must approve (n of the m eligible). Default 1. One rejection rejects. */
|
|
46
|
+
quorum: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),
|
|
47
|
+
/** Whether the requester may approve their own call. Default false. */
|
|
48
|
+
allowSelfApproval: Schema.optionalKey(Schema.Boolean),
|
|
49
|
+
/** The request expires (and the call never runs) this long after it was made, in milliseconds. Default: never. */
|
|
50
|
+
expiresAfterMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),
|
|
51
|
+
})
|
|
52
|
+
export type ApprovalRule = typeof ApprovalRule.Type
|
|
53
|
+
|
|
54
|
+
/** The value at a dot path of a JSON value, or `undefined`. */
|
|
55
|
+
export const valueAt = (input: unknown, path: string): unknown => {
|
|
56
|
+
let value: unknown = input
|
|
57
|
+
for (const part of path.split(".")) {
|
|
58
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return undefined
|
|
59
|
+
if (!Object.hasOwn(value, part)) return undefined
|
|
60
|
+
value = (value as Record<string, unknown>)[part]
|
|
61
|
+
}
|
|
62
|
+
return value
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const jsonEquals = (a: unknown, b: unknown): boolean => {
|
|
66
|
+
if (a === b) return true
|
|
67
|
+
if (typeof a !== typeof b || a === null || b === null || typeof a !== "object") return false
|
|
68
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false
|
|
69
|
+
if (Array.isArray(a)) {
|
|
70
|
+
const bs = b as ReadonlyArray<unknown>
|
|
71
|
+
return a.length === bs.length && a.every((item, i) => jsonEquals(item, bs[i]))
|
|
72
|
+
}
|
|
73
|
+
const ak = Object.keys(a).sort()
|
|
74
|
+
const bk = Object.keys(b as object).sort()
|
|
75
|
+
return (
|
|
76
|
+
jsonEquals(ak, bk) &&
|
|
77
|
+
ak.every((k) => jsonEquals((a as Record<string, unknown>)[k], (b as Record<string, unknown>)[k]))
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Does one comparison hold for `input` (the encoded action input)? */
|
|
82
|
+
export const comparisonHolds = (comparison: ApprovalComparison, input: unknown): boolean => {
|
|
83
|
+
const actual = valueAt(input, comparison.field)
|
|
84
|
+
const expected = comparison.value
|
|
85
|
+
switch (comparison.op) {
|
|
86
|
+
case "exists":
|
|
87
|
+
return (actual !== undefined) === (expected !== false)
|
|
88
|
+
case "eq":
|
|
89
|
+
return actual !== undefined && jsonEquals(actual, expected)
|
|
90
|
+
case "ne":
|
|
91
|
+
return actual === undefined || !jsonEquals(actual, expected)
|
|
92
|
+
case "in":
|
|
93
|
+
return actual !== undefined && Array.isArray(expected) && expected.some((item) => jsonEquals(actual, item))
|
|
94
|
+
case "gt":
|
|
95
|
+
case "gte":
|
|
96
|
+
case "lt":
|
|
97
|
+
case "lte": {
|
|
98
|
+
if (typeof actual !== "number" || typeof expected !== "number") return false
|
|
99
|
+
if (comparison.op === "gt") return actual > expected
|
|
100
|
+
if (comparison.op === "gte") return actual >= expected
|
|
101
|
+
if (comparison.op === "lt") return actual < expected
|
|
102
|
+
return actual <= expected
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Does the rule apply to a call of `action` with `input` (encoded)? */
|
|
108
|
+
export const ruleMatches = (rule: ApprovalRule, action: string, input: unknown): boolean =>
|
|
109
|
+
rule.action === action && (rule.when ?? []).every((comparison) => comparisonHolds(comparison, input))
|
|
110
|
+
|
|
111
|
+
/** Problems with one rule's own shape (not its references): operators, values and numbers. */
|
|
112
|
+
export const approvalRuleShapeProblems = (rule: unknown): ReadonlyArray<string> => {
|
|
113
|
+
if (!Schema.is(ApprovalRule)(rule)) return ["is not an approval rule (description, action, approvers, ...)"]
|
|
114
|
+
const problems: Array<string> = []
|
|
115
|
+
if (rule.description.trim() === "") problems.push("has no description")
|
|
116
|
+
for (const comparison of rule.when ?? []) {
|
|
117
|
+
if (comparison.field.trim() === "" || comparison.field.split(".").some((part) => part === "")) {
|
|
118
|
+
problems.push(`compares an invalid field path "${comparison.field}"`)
|
|
119
|
+
}
|
|
120
|
+
if (comparison.op === "in" && !Array.isArray(comparison.value)) {
|
|
121
|
+
problems.push(`compares ${comparison.field} with "in" against a value that is not a list`)
|
|
122
|
+
}
|
|
123
|
+
if (["gt", "gte", "lt", "lte"].includes(comparison.op) && typeof comparison.value !== "number") {
|
|
124
|
+
problems.push(`orders ${comparison.field} against a value that is not a number`)
|
|
125
|
+
}
|
|
126
|
+
if (comparison.op === "exists" && typeof comparison.value !== "boolean") {
|
|
127
|
+
problems.push(`tests ${comparison.field} with "exists" against a value that is not a boolean`)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return problems
|
|
131
|
+
}
|
package/src/Catalog.ts
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/** Every kernel-level contract that is published as JSON Schema (`schema/*.json`, `schema/contracts/*.json`). */
|
|
2
|
+
import { InvocationError } from "./Errors.ts"
|
|
3
|
+
import { Actor, AuditRecord, Lockfile, OutboxEvent, ProvenanceEntry, Surface } from "./Records.ts"
|
|
4
|
+
import { DaemonHealth, PairingConfirm, PairingResult, PairingStart } from "./Devices.ts"
|
|
5
|
+
import { serviceContracts } from "./contracts/index.ts"
|
|
6
|
+
import { LocalClientContract } from "./contracts/LocalClient.ts"
|
|
7
|
+
import {
|
|
8
|
+
MakeViewCall,
|
|
9
|
+
MakeViewElement,
|
|
10
|
+
MakeViewMessage,
|
|
11
|
+
MakeViewNode,
|
|
12
|
+
MakeViewPropValue,
|
|
13
|
+
MakeViewProps,
|
|
14
|
+
MakeViewStep,
|
|
15
|
+
SandboxContract,
|
|
16
|
+
} from "./contracts/Sandbox.ts"
|
|
17
|
+
import { toJsonSchema, type JsonSchemaDocument } from "./JsonSchema.ts"
|
|
18
|
+
import { InvocationReceipt, ReplayEnvelope } from "./Receipt.ts"
|
|
19
|
+
import { serviceToJson } from "./Service.ts"
|
|
20
|
+
import type { Schema } from "effect"
|
|
21
|
+
|
|
22
|
+
export const catalog = {
|
|
23
|
+
Actor,
|
|
24
|
+
AuditRecord,
|
|
25
|
+
DaemonHealth,
|
|
26
|
+
InvocationError,
|
|
27
|
+
InvocationReceipt,
|
|
28
|
+
Lockfile,
|
|
29
|
+
OutboxEvent,
|
|
30
|
+
PairingConfirm,
|
|
31
|
+
PairingResult,
|
|
32
|
+
PairingStart,
|
|
33
|
+
ProvenanceEntry,
|
|
34
|
+
ReplayEnvelope,
|
|
35
|
+
Surface,
|
|
36
|
+
} as const
|
|
37
|
+
|
|
38
|
+
/** A set of published types emitted as one document for native code generation (`codegen/<name>.json`). */
|
|
39
|
+
export interface CodegenSource {
|
|
40
|
+
readonly name: string
|
|
41
|
+
readonly description: string
|
|
42
|
+
readonly version: string
|
|
43
|
+
readonly types: Readonly<Record<string, Schema.Top>>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* What native clients generate types from (decision 14), each emitted as one bundle, `codegen/<name>.json`: the
|
|
48
|
+
* LocalClient contract, and Sandbox's view runtime types a native MAKE renderer draws (the tree, its element, props
|
|
49
|
+
* and calls, each named, so a generator renames nothing).
|
|
50
|
+
*/
|
|
51
|
+
export const codegenSources: ReadonlyArray<CodegenSource> = [
|
|
52
|
+
LocalClientContract,
|
|
53
|
+
{
|
|
54
|
+
name: "Sandbox",
|
|
55
|
+
description:
|
|
56
|
+
"The MAKE view runtime's types for native renderers (Sandbox contract): one step of a view (its state, the calls " +
|
|
57
|
+
"it asks for, the tree), the tree's node and element, an element's props, a call and the messages a view is told.",
|
|
58
|
+
version: SandboxContract.version,
|
|
59
|
+
types: {
|
|
60
|
+
MakeViewStep,
|
|
61
|
+
MakeViewMessage,
|
|
62
|
+
MakeViewNode,
|
|
63
|
+
MakeViewElement,
|
|
64
|
+
MakeViewProps,
|
|
65
|
+
MakeViewPropValue,
|
|
66
|
+
MakeViewCall,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
const rewriteRefs = (value: unknown, rename: (name: string) => string): unknown => {
|
|
72
|
+
if (Array.isArray(value)) return value.map((item) => rewriteRefs(item, rename))
|
|
73
|
+
if (typeof value !== "object" || value === null) return value
|
|
74
|
+
const out: Record<string, unknown> = {}
|
|
75
|
+
for (const [key, field] of Object.entries(value)) {
|
|
76
|
+
out[key] =
|
|
77
|
+
key === "$ref" && typeof field === "string" && field.startsWith("#/$defs/")
|
|
78
|
+
? `#/$defs/${rename(field.slice("#/$defs/".length))}`
|
|
79
|
+
: rewriteRefs(field, rename)
|
|
80
|
+
}
|
|
81
|
+
return out
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** The single-value property every variant of `anyOf` (all `$ref`s) is tagged by, if there is one. */
|
|
85
|
+
const tagOf = (variants: ReadonlyArray<unknown>, defs: Record<string, any>): string | undefined => {
|
|
86
|
+
const objects = variants.map((variant) => {
|
|
87
|
+
const ref = (variant as { $ref?: unknown }).$ref
|
|
88
|
+
return typeof ref === "string" ? defs[ref.slice("#/$defs/".length)] : undefined
|
|
89
|
+
})
|
|
90
|
+
if (objects.some((object) => object?.type !== "object")) return undefined
|
|
91
|
+
for (const candidate of ["type", "state", "_tag"]) {
|
|
92
|
+
const values = objects.map((object) => object.properties?.[candidate]?.enum)
|
|
93
|
+
if (
|
|
94
|
+
values.every((value) => Array.isArray(value) && value.length === 1) &&
|
|
95
|
+
new Set(values.map((value) => value[0])).size === values.length &&
|
|
96
|
+
objects.every((object) => (object.required as ReadonlyArray<string> | undefined)?.includes(candidate))
|
|
97
|
+
) {
|
|
98
|
+
return candidate
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return undefined
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const NOT_NULL = JSON.stringify({ type: "null" })
|
|
105
|
+
const NON_FINITE = JSON.stringify({ type: "string", enum: ["Infinity", "-Infinity", "NaN"] })
|
|
106
|
+
const ANY_STRING = JSON.stringify({ type: "string" })
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Two of Effect's encodings a generator reads poorly, rewritten for it: an empty struct (`{ not: { type: "null" } }`,
|
|
110
|
+
* any value but null) is `{ type: "object" }` (a request body is always an object), and the strings Effect accepts
|
|
111
|
+
* for non-finite numbers (`"Infinity"`, `"-Infinity"`, `"NaN"`) are dropped from an `anyOf` that already allows any
|
|
112
|
+
* string.
|
|
113
|
+
*/
|
|
114
|
+
const forGenerators = (value: unknown): unknown => {
|
|
115
|
+
if (Array.isArray(value)) return value.map(forGenerators)
|
|
116
|
+
if (typeof value !== "object" || value === null) return value
|
|
117
|
+
const out: Record<string, unknown> = {}
|
|
118
|
+
for (const [key, field] of Object.entries(value)) {
|
|
119
|
+
if (key === "not" && JSON.stringify(field) === NOT_NULL) {
|
|
120
|
+
out["type"] = "object"
|
|
121
|
+
continue
|
|
122
|
+
}
|
|
123
|
+
if (key === "anyOf" && Array.isArray(field) && field.some((v) => JSON.stringify(v) === ANY_STRING)) {
|
|
124
|
+
out[key] = field.filter((v) => JSON.stringify(v) !== NON_FINITE).map(forGenerators)
|
|
125
|
+
continue
|
|
126
|
+
}
|
|
127
|
+
out[key] = forGenerators(field)
|
|
128
|
+
}
|
|
129
|
+
return out
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A set of types as one JSON Schema document for code generators (typify): every published type, and every type it
|
|
134
|
+
* refers to, under `$defs` by its own name (the `Encoded` suffix Effect gives tagged errors dropped), a union whose
|
|
135
|
+
* variants are objects tagged by one property (`type`, `state`, `_tag`) written as `oneOf`, so it becomes a tagged
|
|
136
|
+
* enum, and Effect's empty-struct and non-finite-number encodings simplified (`forGenerators`).
|
|
137
|
+
*/
|
|
138
|
+
export const codegenBundle = (contract: CodegenSource): JsonSchemaDocument => {
|
|
139
|
+
const defs: Record<string, unknown> = {}
|
|
140
|
+
const add = (name: string, schema: unknown) => {
|
|
141
|
+
const existing = defs[name]
|
|
142
|
+
if (existing !== undefined && JSON.stringify(existing) !== JSON.stringify(schema)) {
|
|
143
|
+
throw new Error(`${contract.name}: two different types are both named ${name}`)
|
|
144
|
+
}
|
|
145
|
+
defs[name] = schema
|
|
146
|
+
}
|
|
147
|
+
for (const [name, schema] of Object.entries(contract.types)) {
|
|
148
|
+
const { $schema: _, $defs, ...document } = toJsonSchema(schema) as Record<string, unknown>
|
|
149
|
+
for (const [def, definition] of Object.entries(($defs ?? {}) as Record<string, unknown>)) add(def, definition)
|
|
150
|
+
const ref = document["$ref"]
|
|
151
|
+
if (typeof ref !== "string" || ref !== `#/$defs/${name}` || Object.keys(document).length !== 1) add(name, document)
|
|
152
|
+
}
|
|
153
|
+
const names = new Set(Object.keys(defs))
|
|
154
|
+
const rename = (name: string) => {
|
|
155
|
+
const short = name.endsWith("Encoded") ? name.slice(0, -"Encoded".length) : name
|
|
156
|
+
return short !== name && !names.has(short) ? short : name
|
|
157
|
+
}
|
|
158
|
+
const renamed: Record<string, any> = {}
|
|
159
|
+
for (const [name, definition] of Object.entries(defs)) {
|
|
160
|
+
renamed[rename(name)] = forGenerators(rewriteRefs(definition, rename))
|
|
161
|
+
}
|
|
162
|
+
for (const definition of Object.values(renamed)) {
|
|
163
|
+
const variants = definition.anyOf as ReadonlyArray<unknown> | undefined
|
|
164
|
+
if (variants === undefined) continue
|
|
165
|
+
const tag = tagOf(variants, renamed)
|
|
166
|
+
if (tag === undefined) continue
|
|
167
|
+
delete definition.anyOf
|
|
168
|
+
definition.oneOf = variants
|
|
169
|
+
}
|
|
170
|
+
const sorted = Object.fromEntries(
|
|
171
|
+
Object.keys(renamed)
|
|
172
|
+
.sort()
|
|
173
|
+
.map((name) => [name, renamed[name]]),
|
|
174
|
+
)
|
|
175
|
+
return {
|
|
176
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
177
|
+
$id: `https://eloxiv.dev/schema/codegen/${contract.name}.json`,
|
|
178
|
+
title: contract.name,
|
|
179
|
+
description: contract.description,
|
|
180
|
+
version: contract.version,
|
|
181
|
+
$defs: sorted,
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** File path (relative to `schema/`) to JSON Schema document, in a stable order. */
|
|
186
|
+
export const emitCatalog = (): ReadonlyArray<readonly [string, JsonSchemaDocument]> => [
|
|
187
|
+
...Object.entries(catalog).map(
|
|
188
|
+
([name, schema]) => [`${name}.json`, { title: name, ...toJsonSchema(schema) }] as const,
|
|
189
|
+
),
|
|
190
|
+
...serviceContracts.map((contract) => [`contracts/${contract.name}.json`, serviceToJson(contract)] as const),
|
|
191
|
+
...codegenSources.map((source) => [`codegen/${source.name}.json`, codegenBundle(source)] as const),
|
|
192
|
+
]
|
package/src/Checklist.ts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup checklists (the onboarding a module or app declares, ledger B-067): named lists of steps a person (or an
|
|
3
|
+
* organisation) completes, dismisses and reopens, and a list they collapse or dismiss as a whole. A checklist's state
|
|
4
|
+
* is a Settings value (docs/contracts/settings.md) under the checklist's key, so it is durable, follows the person to
|
|
5
|
+
* every device (a `user` checklist's value syncs to each of their replicas), is written through the one invocation
|
|
6
|
+
* path (`settings.set`, which the person's agent can call as they could), and is audited. This module is the
|
|
7
|
+
* declaration and the pure state: `defineChecklist` gives the setting to declare in the manifest (`settings`), the
|
|
8
|
+
* transitions compute the next value to write, and `checklistSummary` what a screen or an agent shows.
|
|
9
|
+
*/
|
|
10
|
+
import { Schema } from "effect"
|
|
11
|
+
import type { SettingDeclaration } from "./Manifest.ts"
|
|
12
|
+
|
|
13
|
+
export const ChecklistStepState = Schema.Struct({
|
|
14
|
+
status: Schema.Literals(["done", "dismissed"]),
|
|
15
|
+
/** When it was done or dismissed (ISO 8601). */
|
|
16
|
+
at: Schema.String,
|
|
17
|
+
})
|
|
18
|
+
export type ChecklistStepState = typeof ChecklistStepState.Type
|
|
19
|
+
|
|
20
|
+
/** What is stored: the steps done or dismissed (others are open), and whether the list is collapsed or dismissed. */
|
|
21
|
+
export const ChecklistState = Schema.Struct({
|
|
22
|
+
steps: Schema.Record(Schema.String, ChecklistStepState),
|
|
23
|
+
collapsed: Schema.Boolean,
|
|
24
|
+
dismissed: Schema.Boolean,
|
|
25
|
+
})
|
|
26
|
+
export type ChecklistState = typeof ChecklistState.Type
|
|
27
|
+
|
|
28
|
+
export const EMPTY_CHECKLIST: ChecklistState = { steps: {}, collapsed: false, dismissed: false }
|
|
29
|
+
|
|
30
|
+
export interface ChecklistStep {
|
|
31
|
+
readonly id: string
|
|
32
|
+
readonly title: string
|
|
33
|
+
readonly description?: string | undefined
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface Checklist {
|
|
37
|
+
/** The setting's key, in its module's namespace (`mail.setup`). */
|
|
38
|
+
readonly key: string
|
|
39
|
+
readonly title: string
|
|
40
|
+
readonly description: string
|
|
41
|
+
/** `user`: each person's own progress; `org`: one shared list, which organisation administrators complete. */
|
|
42
|
+
readonly scope: "user" | "org"
|
|
43
|
+
readonly steps: ReadonlyArray<ChecklistStep>
|
|
44
|
+
/** The setting to declare in the module's manifest under `key` (`settings: { [key]: checklist.setting }`). */
|
|
45
|
+
readonly setting: SettingDeclaration<typeof ChecklistState>
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const STEP_ID = /^[a-z][a-z0-9_-]{0,63}$/u
|
|
49
|
+
|
|
50
|
+
export const defineChecklist = (checklist: {
|
|
51
|
+
readonly key: string
|
|
52
|
+
readonly title: string
|
|
53
|
+
readonly description: string
|
|
54
|
+
readonly scope?: "user" | "org"
|
|
55
|
+
readonly steps: ReadonlyArray<ChecklistStep>
|
|
56
|
+
}): Checklist => {
|
|
57
|
+
if (checklist.steps.length === 0) throw new Error(`Checklist ${checklist.key} has no steps`)
|
|
58
|
+
const ids = new Set<string>()
|
|
59
|
+
for (const step of checklist.steps) {
|
|
60
|
+
if (!STEP_ID.test(step.id)) throw new Error(`Checklist ${checklist.key}: step id ${step.id} is not a lower-case id`)
|
|
61
|
+
if (ids.has(step.id)) throw new Error(`Checklist ${checklist.key} has two steps ${step.id}`)
|
|
62
|
+
ids.add(step.id)
|
|
63
|
+
}
|
|
64
|
+
const scope = checklist.scope ?? "user"
|
|
65
|
+
return {
|
|
66
|
+
key: checklist.key,
|
|
67
|
+
title: checklist.title,
|
|
68
|
+
description: checklist.description,
|
|
69
|
+
scope,
|
|
70
|
+
steps: checklist.steps,
|
|
71
|
+
setting: {
|
|
72
|
+
description: `${checklist.title}: the setup checklist's progress (${checklist.description})`,
|
|
73
|
+
scope,
|
|
74
|
+
schema: ChecklistState,
|
|
75
|
+
default: EMPTY_CHECKLIST,
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const declared = (checklist: Checklist, step: string) => checklist.steps.some((s) => s.id === step)
|
|
81
|
+
|
|
82
|
+
const withStep = (state: ChecklistState, step: string, value: ChecklistStepState | undefined): ChecklistState => {
|
|
83
|
+
const steps = { ...state.steps }
|
|
84
|
+
if (value === undefined) delete steps[step]
|
|
85
|
+
else steps[step] = value
|
|
86
|
+
return { ...state, steps }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The step is done. A step the checklist does not declare changes nothing. */
|
|
90
|
+
export const completeStep = (checklist: Checklist, state: ChecklistState, step: string, at: string): ChecklistState =>
|
|
91
|
+
declared(checklist, step) ? withStep(state, step, { status: "done", at }) : state
|
|
92
|
+
|
|
93
|
+
/** The step is skipped: not done, no longer asked for. */
|
|
94
|
+
export const dismissStep = (checklist: Checklist, state: ChecklistState, step: string, at: string): ChecklistState =>
|
|
95
|
+
declared(checklist, step) ? withStep(state, step, { status: "dismissed", at }) : state
|
|
96
|
+
|
|
97
|
+
/** The step is open again (done or dismissed before). */
|
|
98
|
+
export const reopenStep = (checklist: Checklist, state: ChecklistState, step: string): ChecklistState =>
|
|
99
|
+
declared(checklist, step) ? withStep(state, step, undefined) : state
|
|
100
|
+
|
|
101
|
+
/** The list is folded away (or unfolded); its steps are kept. */
|
|
102
|
+
export const collapseChecklist = (state: ChecklistState, collapsed: boolean): ChecklistState => ({
|
|
103
|
+
...state,
|
|
104
|
+
collapsed,
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
/** The whole list is dismissed (not shown again), or shown again; its steps are kept. */
|
|
108
|
+
export const dismissChecklist = (state: ChecklistState, dismissed: boolean): ChecklistState => ({
|
|
109
|
+
...state,
|
|
110
|
+
dismissed,
|
|
111
|
+
collapsed: dismissed ? state.collapsed : false,
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
export interface ChecklistSummary {
|
|
115
|
+
readonly key: string
|
|
116
|
+
readonly title: string
|
|
117
|
+
readonly steps: ReadonlyArray<
|
|
118
|
+
ChecklistStep & { readonly status: "open" | "done" | "dismissed"; readonly at: string | null }
|
|
119
|
+
>
|
|
120
|
+
readonly total: number
|
|
121
|
+
readonly done: number
|
|
122
|
+
readonly dismissed: number
|
|
123
|
+
readonly open: number
|
|
124
|
+
/** Every step done or dismissed. */
|
|
125
|
+
readonly complete: boolean
|
|
126
|
+
readonly collapsed: boolean
|
|
127
|
+
/** The whole list was dismissed. */
|
|
128
|
+
readonly listDismissed: boolean
|
|
129
|
+
/** Whether to show it at all: neither dismissed nor complete. */
|
|
130
|
+
readonly visible: boolean
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** What to show of a checklist: its declared steps in order with their status (a step no longer declared is ignored). */
|
|
134
|
+
export const checklistSummary = (checklist: Checklist, state: ChecklistState): ChecklistSummary => {
|
|
135
|
+
const steps = checklist.steps.map((step) => {
|
|
136
|
+
const stored = state.steps[step.id]
|
|
137
|
+
return { ...step, status: stored?.status ?? ("open" as const), at: stored?.at ?? null }
|
|
138
|
+
})
|
|
139
|
+
const done = steps.filter((s) => s.status === "done").length
|
|
140
|
+
const dismissed = steps.filter((s) => s.status === "dismissed").length
|
|
141
|
+
const open = steps.length - done - dismissed
|
|
142
|
+
return {
|
|
143
|
+
key: checklist.key,
|
|
144
|
+
title: checklist.title,
|
|
145
|
+
steps,
|
|
146
|
+
total: steps.length,
|
|
147
|
+
done,
|
|
148
|
+
dismissed,
|
|
149
|
+
open,
|
|
150
|
+
complete: open === 0,
|
|
151
|
+
collapsed: state.collapsed,
|
|
152
|
+
listDismissed: state.dismissed,
|
|
153
|
+
visible: !state.dismissed && open > 0,
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** The `settings.set` input that stores `state` for `checklist` (at its scope's level). */
|
|
158
|
+
export const checklistWrite = (checklist: Checklist, state: ChecklistState) => ({
|
|
159
|
+
key: checklist.key,
|
|
160
|
+
value: Schema.encodeSync(ChecklistState)(state),
|
|
161
|
+
level: checklist.scope,
|
|
162
|
+
})
|