@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/Render.ts
ADDED
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renderers declared per output schema and the pure functions that apply them (the ResultRendering contract,
|
|
3
|
+
* `contracts/ResultRendering.ts`): kept apart from the contract so the manifest checks can use them.
|
|
4
|
+
* A module declares a renderer per output schema (`render` on an action, or on a published query view): a
|
|
5
|
+
* table, a card, a list or markdown, naming fields of the output. The kernel checks every declaration against
|
|
6
|
+
* the schema at startup (an unknown field, or a table over something that is not a list of records, refuses the
|
|
7
|
+
* app), publishes it in the manifest, and turns an output into a headless `ResultView` (`renderResult`): plain
|
|
8
|
+
* data a shell or chat UI draws with its own components, and that an agent reads as compact text
|
|
9
|
+
* (`compactResult`, bounded in characters and rows). The same pure functions run in the kernel, the client SDK
|
|
10
|
+
* and any UI, so every surface shows one result the same way.
|
|
11
|
+
*
|
|
12
|
+
* Renderers only select and label what the output already holds: a view never carries a value the output did
|
|
13
|
+
* not, so rendering can neither widen what a caller sees nor fail a call (a value of an unexpected shape is
|
|
14
|
+
* shown as JSON text).
|
|
15
|
+
*/
|
|
16
|
+
import { Schema, SchemaAST } from "effect"
|
|
17
|
+
|
|
18
|
+
export const RenderFormat = Schema.Literals(["text", "number", "date", "datetime", "boolean", "id", "json"])
|
|
19
|
+
export type RenderFormat = typeof RenderFormat.Type
|
|
20
|
+
|
|
21
|
+
/** A field of the output (or of each row) and how to label and format it. */
|
|
22
|
+
export const RenderField = Schema.Struct({
|
|
23
|
+
field: Schema.String.check(Schema.isNonEmpty()),
|
|
24
|
+
label: Schema.optionalKey(Schema.String),
|
|
25
|
+
format: Schema.optionalKey(RenderFormat),
|
|
26
|
+
})
|
|
27
|
+
export type RenderField = typeof RenderField.Type
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The renderer a module declares for an output schema. `rows` and `items` name the output's list field
|
|
31
|
+
* (omitted: the output itself is the list, as for a query view's rows); every other name is a field of the
|
|
32
|
+
* output, or of each row or item.
|
|
33
|
+
*/
|
|
34
|
+
export const RenderDeclaration = Schema.Union([
|
|
35
|
+
Schema.Struct({
|
|
36
|
+
kind: Schema.Literal("table"),
|
|
37
|
+
title: Schema.optionalKey(Schema.String),
|
|
38
|
+
rows: Schema.optionalKey(Schema.String),
|
|
39
|
+
columns: Schema.Array(RenderField).check(Schema.isMinLength(1)),
|
|
40
|
+
}),
|
|
41
|
+
Schema.Struct({
|
|
42
|
+
kind: Schema.Literal("card"),
|
|
43
|
+
title: Schema.String,
|
|
44
|
+
subtitle: Schema.optionalKey(Schema.String),
|
|
45
|
+
fields: Schema.Array(RenderField),
|
|
46
|
+
}),
|
|
47
|
+
Schema.Struct({
|
|
48
|
+
kind: Schema.Literal("list"),
|
|
49
|
+
items: Schema.optionalKey(Schema.String),
|
|
50
|
+
title: Schema.String,
|
|
51
|
+
subtitle: Schema.optionalKey(Schema.String),
|
|
52
|
+
}),
|
|
53
|
+
Schema.Struct({ kind: Schema.Literal("markdown"), field: Schema.String }),
|
|
54
|
+
/** A chart over a list of records: `x` labels each point, each of `series` is a numeric field. */
|
|
55
|
+
Schema.Struct({
|
|
56
|
+
kind: Schema.Literal("chart"),
|
|
57
|
+
chart: Schema.Literals(["bar", "line", "pie"]),
|
|
58
|
+
title: Schema.optionalKey(Schema.String),
|
|
59
|
+
rows: Schema.optionalKey(Schema.String),
|
|
60
|
+
x: RenderField,
|
|
61
|
+
series: Schema.Array(RenderField).check(Schema.isMinLength(1), Schema.isMaxLength(10)),
|
|
62
|
+
}),
|
|
63
|
+
/** One number that matters (an insight): its value, and optionally how it moved. */
|
|
64
|
+
Schema.Struct({
|
|
65
|
+
kind: Schema.Literal("metric"),
|
|
66
|
+
label: Schema.String,
|
|
67
|
+
value: Schema.String,
|
|
68
|
+
delta: Schema.optionalKey(Schema.String),
|
|
69
|
+
unit: Schema.optionalKey(Schema.String),
|
|
70
|
+
}),
|
|
71
|
+
/** What changed: a field before and after. */
|
|
72
|
+
Schema.Struct({
|
|
73
|
+
kind: Schema.Literal("change"),
|
|
74
|
+
title: Schema.optionalKey(Schema.String),
|
|
75
|
+
before: Schema.String,
|
|
76
|
+
after: Schema.String,
|
|
77
|
+
}),
|
|
78
|
+
/** A file (the Files contract), by the field holding its id: a UI shows or downloads it only through Files. */
|
|
79
|
+
Schema.Struct({
|
|
80
|
+
kind: Schema.Literal("file"),
|
|
81
|
+
file: Schema.String,
|
|
82
|
+
name: Schema.optionalKey(Schema.String),
|
|
83
|
+
/** The field holding its media type: an `image/*` file is shown as an image (still fetched through Files). */
|
|
84
|
+
mediaType: Schema.optionalKey(Schema.String),
|
|
85
|
+
}),
|
|
86
|
+
/** Work in progress (the Progress contract), by the field holding its task id: a UI follows the task's state. */
|
|
87
|
+
Schema.Struct({ kind: Schema.Literal("progress"), task: Schema.String, label: Schema.optionalKey(Schema.String) }),
|
|
88
|
+
])
|
|
89
|
+
export type RenderDeclaration = typeof RenderDeclaration.Type
|
|
90
|
+
|
|
91
|
+
const Json = Schema.Unknown
|
|
92
|
+
|
|
93
|
+
/** The headless description of one result: what a UI draws and an agent reads. */
|
|
94
|
+
export const ResultView = Schema.Union([
|
|
95
|
+
Schema.Struct({
|
|
96
|
+
kind: Schema.Literal("table"),
|
|
97
|
+
title: Schema.NullOr(Schema.String),
|
|
98
|
+
columns: Schema.Array(Schema.Struct({ key: Schema.String, label: Schema.String, format: RenderFormat })),
|
|
99
|
+
rows: Schema.Array(Schema.Record(Schema.String, Json)),
|
|
100
|
+
/** Rows in the output; `rows` holds at most the limit. */
|
|
101
|
+
totalRows: Schema.Number,
|
|
102
|
+
truncated: Schema.Boolean,
|
|
103
|
+
}),
|
|
104
|
+
Schema.Struct({
|
|
105
|
+
kind: Schema.Literal("card"),
|
|
106
|
+
title: Schema.String,
|
|
107
|
+
subtitle: Schema.NullOr(Schema.String),
|
|
108
|
+
fields: Schema.Array(Schema.Struct({ label: Schema.String, value: Json, format: RenderFormat })),
|
|
109
|
+
}),
|
|
110
|
+
Schema.Struct({
|
|
111
|
+
kind: Schema.Literal("list"),
|
|
112
|
+
items: Schema.Array(Schema.Struct({ title: Schema.String, subtitle: Schema.NullOr(Schema.String) })),
|
|
113
|
+
totalItems: Schema.Number,
|
|
114
|
+
truncated: Schema.Boolean,
|
|
115
|
+
}),
|
|
116
|
+
Schema.Struct({ kind: Schema.Literal("markdown"), text: Schema.String, truncated: Schema.Boolean }),
|
|
117
|
+
Schema.Struct({
|
|
118
|
+
kind: Schema.Literal("chart"),
|
|
119
|
+
chart: Schema.Literals(["bar", "line", "pie"]),
|
|
120
|
+
title: Schema.NullOr(Schema.String),
|
|
121
|
+
x: Schema.Struct({ key: Schema.String, label: Schema.String }),
|
|
122
|
+
series: Schema.Array(Schema.Struct({ key: Schema.String, label: Schema.String })),
|
|
123
|
+
/** Each point: its `x` as text, and each series' value as a number (null when it is not one). */
|
|
124
|
+
points: Schema.Array(Schema.Record(Schema.String, Json)),
|
|
125
|
+
totalPoints: Schema.Number,
|
|
126
|
+
truncated: Schema.Boolean,
|
|
127
|
+
}),
|
|
128
|
+
Schema.Struct({
|
|
129
|
+
kind: Schema.Literal("metric"),
|
|
130
|
+
label: Schema.String,
|
|
131
|
+
value: Json,
|
|
132
|
+
delta: Json,
|
|
133
|
+
unit: Schema.NullOr(Schema.String),
|
|
134
|
+
}),
|
|
135
|
+
Schema.Struct({ kind: Schema.Literal("change"), title: Schema.NullOr(Schema.String), before: Json, after: Json }),
|
|
136
|
+
/** A file by id and name: the UI asks Files for it (its read policy decides), never the view. */
|
|
137
|
+
Schema.Struct({
|
|
138
|
+
kind: Schema.Literal("file"),
|
|
139
|
+
fileId: Schema.String,
|
|
140
|
+
name: Schema.NullOr(Schema.String),
|
|
141
|
+
mediaType: Schema.NullOr(Schema.String),
|
|
142
|
+
/** Whether to show it as an image (its media type is `image/*`, but SVG, which can run script). */
|
|
143
|
+
image: Schema.Boolean,
|
|
144
|
+
}),
|
|
145
|
+
/** A Progress task by id, with its label: the UI reads the task's state from the Progress contract. */
|
|
146
|
+
Schema.Struct({ kind: Schema.Literal("progress"), taskId: Schema.String, label: Schema.NullOr(Schema.String) }),
|
|
147
|
+
/** No renderer declared (or the output did not have the declared shape): the output as JSON. */
|
|
148
|
+
Schema.Struct({ kind: Schema.Literal("json"), value: Json }),
|
|
149
|
+
])
|
|
150
|
+
export type ResultView = typeof ResultView.Type
|
|
151
|
+
|
|
152
|
+
/** Limits on what a view carries and what compact text holds. */
|
|
153
|
+
export interface RenderLimits {
|
|
154
|
+
/** Rows or items a view holds (default 200). */
|
|
155
|
+
readonly maxRows?: number | undefined
|
|
156
|
+
/** Characters of markdown a view holds (default 20,000). */
|
|
157
|
+
readonly maxText?: number | undefined
|
|
158
|
+
}
|
|
159
|
+
export interface CompactLimits {
|
|
160
|
+
/** Characters of compact text (default 2,000; the text says when it was cut). */
|
|
161
|
+
readonly maxChars?: number | undefined
|
|
162
|
+
/** Rows or items listed (default 20). */
|
|
163
|
+
readonly maxRows?: number | undefined
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export const RENDER_DEFAULTS = { maxRows: 200, maxText: 20_000, maxChars: 2_000, compactRows: 20 } as const
|
|
167
|
+
|
|
168
|
+
// ---------------------------------------------------------------------------------------------------------
|
|
169
|
+
// Checking declarations against an output schema
|
|
170
|
+
|
|
171
|
+
type Shape =
|
|
172
|
+
| { readonly kind: "object"; readonly fields: ReadonlyMap<string, Shape> }
|
|
173
|
+
| { readonly kind: "array"; readonly item: Shape }
|
|
174
|
+
| { readonly kind: "value" }
|
|
175
|
+
| { readonly kind: "any" }
|
|
176
|
+
|
|
177
|
+
const shapeOf = (ast: SchemaAST.AST, depth = 0): Shape => {
|
|
178
|
+
if (depth > 20) return { kind: "any" }
|
|
179
|
+
switch (ast._tag) {
|
|
180
|
+
case "Objects": {
|
|
181
|
+
const fields = new Map<string, Shape>()
|
|
182
|
+
for (const property of ast.propertySignatures) {
|
|
183
|
+
if (typeof property.name === "string") fields.set(property.name, shapeOf(property.type, depth + 1))
|
|
184
|
+
}
|
|
185
|
+
if (ast.indexSignatures.length > 0) return { kind: "any" }
|
|
186
|
+
return { kind: "object", fields }
|
|
187
|
+
}
|
|
188
|
+
case "Arrays": {
|
|
189
|
+
const item = ast.rest[0] ?? ast.elements[0]
|
|
190
|
+
return { kind: "array", item: item === undefined ? { kind: "any" } : shapeOf(item, depth + 1) }
|
|
191
|
+
}
|
|
192
|
+
case "Union": {
|
|
193
|
+
// `NullOr(X)` and similar: the non-null member, when there is exactly one shaped member.
|
|
194
|
+
const shaped = ast.types
|
|
195
|
+
.map((t) => shapeOf(t, depth + 1))
|
|
196
|
+
.filter((s) => s.kind === "object" || s.kind === "array")
|
|
197
|
+
return shaped.length === 1 ? shaped[0]! : shaped.length === 0 ? { kind: "value" } : { kind: "any" }
|
|
198
|
+
}
|
|
199
|
+
case "Suspend":
|
|
200
|
+
return shapeOf(ast.thunk(), depth + 1)
|
|
201
|
+
case "Unknown":
|
|
202
|
+
case "Any":
|
|
203
|
+
return { kind: "any" }
|
|
204
|
+
default:
|
|
205
|
+
return { kind: "value" }
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Why a renderer does not fit an output schema: every named field must exist (a table's `rows` and a list's
|
|
211
|
+
* `items` must be lists of records, and their columns fields of each record). Empty when it fits.
|
|
212
|
+
*/
|
|
213
|
+
export const renderProblems = (declaration: unknown, output: Schema.Top): ReadonlyArray<string> => {
|
|
214
|
+
if (!Schema.is(RenderDeclaration)(declaration)) {
|
|
215
|
+
return ["is not a table, card, list, markdown, chart, metric, change, file or progress renderer"]
|
|
216
|
+
}
|
|
217
|
+
const root = shapeOf(SchemaAST.toEncoded(output.ast))
|
|
218
|
+
if (root.kind === "any") return []
|
|
219
|
+
const problems: Array<string> = []
|
|
220
|
+
const field = (shape: Shape, name: string, where: string) => {
|
|
221
|
+
if (shape.kind === "any") return
|
|
222
|
+
if (shape.kind !== "object" || !shape.fields.has(name)) problems.push(`names unknown field ${name} of ${where}`)
|
|
223
|
+
}
|
|
224
|
+
const listOf = (path: string | undefined, what: string): Shape | undefined => {
|
|
225
|
+
const list = path === undefined ? root : root.kind === "object" ? root.fields.get(path) : undefined
|
|
226
|
+
if (list === undefined) {
|
|
227
|
+
if (root.kind !== "object") problems.push(`names ${what} field ${String(path)} of an output that is not a record`)
|
|
228
|
+
else problems.push(`names unknown ${what} field ${String(path)}`)
|
|
229
|
+
return undefined
|
|
230
|
+
}
|
|
231
|
+
if (list.kind === "any") return { kind: "any" }
|
|
232
|
+
if (list.kind !== "array") {
|
|
233
|
+
problems.push(
|
|
234
|
+
path === undefined ? `needs an output that is a list` : `names ${what} field ${path}, which is not a list`,
|
|
235
|
+
)
|
|
236
|
+
return undefined
|
|
237
|
+
}
|
|
238
|
+
if (list.item.kind !== "object" && list.item.kind !== "any") {
|
|
239
|
+
problems.push(`needs a list of records${path === undefined ? "" : ` in ${path}`}`)
|
|
240
|
+
return undefined
|
|
241
|
+
}
|
|
242
|
+
return list.item
|
|
243
|
+
}
|
|
244
|
+
switch (declaration.kind) {
|
|
245
|
+
case "table": {
|
|
246
|
+
const row = listOf(declaration.rows, "rows")
|
|
247
|
+
if (row !== undefined) for (const column of declaration.columns) field(row, column.field, "each row")
|
|
248
|
+
break
|
|
249
|
+
}
|
|
250
|
+
case "list": {
|
|
251
|
+
const item = listOf(declaration.items, "items")
|
|
252
|
+
if (item !== undefined) {
|
|
253
|
+
field(item, declaration.title, "each item")
|
|
254
|
+
if (declaration.subtitle !== undefined) field(item, declaration.subtitle, "each item")
|
|
255
|
+
}
|
|
256
|
+
break
|
|
257
|
+
}
|
|
258
|
+
case "card":
|
|
259
|
+
field(root, declaration.title, "the output")
|
|
260
|
+
if (declaration.subtitle !== undefined) field(root, declaration.subtitle, "the output")
|
|
261
|
+
for (const f of declaration.fields) field(root, f.field, "the output")
|
|
262
|
+
break
|
|
263
|
+
case "markdown":
|
|
264
|
+
field(root, declaration.field, "the output")
|
|
265
|
+
break
|
|
266
|
+
case "chart": {
|
|
267
|
+
const row = listOf(declaration.rows, "rows")
|
|
268
|
+
if (row !== undefined) for (const f of [declaration.x, ...declaration.series]) field(row, f.field, "each row")
|
|
269
|
+
break
|
|
270
|
+
}
|
|
271
|
+
case "metric":
|
|
272
|
+
for (const name of [declaration.value, declaration.delta]) if (name !== undefined) field(root, name, "the output")
|
|
273
|
+
break
|
|
274
|
+
case "change":
|
|
275
|
+
for (const name of [declaration.title, declaration.before, declaration.after]) {
|
|
276
|
+
if (name !== undefined) field(root, name, "the output")
|
|
277
|
+
}
|
|
278
|
+
break
|
|
279
|
+
case "file":
|
|
280
|
+
for (const name of [declaration.file, declaration.name, declaration.mediaType]) {
|
|
281
|
+
if (name !== undefined) field(root, name, "the output")
|
|
282
|
+
}
|
|
283
|
+
break
|
|
284
|
+
case "progress":
|
|
285
|
+
field(root, declaration.task, "the output")
|
|
286
|
+
break
|
|
287
|
+
}
|
|
288
|
+
return problems
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// ---------------------------------------------------------------------------------------------------------
|
|
292
|
+
// Rendering
|
|
293
|
+
|
|
294
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
295
|
+
typeof value === "object" && value !== null && !Array.isArray(value)
|
|
296
|
+
|
|
297
|
+
const labelOf = (f: RenderField) =>
|
|
298
|
+
f.label ??
|
|
299
|
+
f.field
|
|
300
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
|
|
301
|
+
.replace(/[_-]+/g, " ")
|
|
302
|
+
.replace(/^./, (c) => c.toUpperCase())
|
|
303
|
+
|
|
304
|
+
const textOf = (value: unknown): string => {
|
|
305
|
+
if (value === null || value === undefined) return ""
|
|
306
|
+
if (typeof value === "string") return value
|
|
307
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value)
|
|
308
|
+
try {
|
|
309
|
+
return JSON.stringify(value) ?? ""
|
|
310
|
+
} catch {
|
|
311
|
+
return ""
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* The headless view of an (encoded) output under its declared renderer: only the fields the renderer names, at
|
|
317
|
+
* most `maxRows` rows or items. Without a renderer, or when the output does not have the declared shape, the
|
|
318
|
+
* output as JSON.
|
|
319
|
+
*/
|
|
320
|
+
export const renderResult = (
|
|
321
|
+
declaration: RenderDeclaration | undefined,
|
|
322
|
+
output: unknown,
|
|
323
|
+
limits: RenderLimits = {},
|
|
324
|
+
): ResultView => {
|
|
325
|
+
const maxRows = limits.maxRows ?? RENDER_DEFAULTS.maxRows
|
|
326
|
+
const maxText = limits.maxText ?? RENDER_DEFAULTS.maxText
|
|
327
|
+
const json: ResultView = { kind: "json", value: output ?? null }
|
|
328
|
+
if (declaration === undefined) return json
|
|
329
|
+
const listAt = (path: string | undefined): ReadonlyArray<unknown> | undefined => {
|
|
330
|
+
const list = path === undefined ? output : isRecord(output) ? output[path] : undefined
|
|
331
|
+
return Array.isArray(list) ? list : undefined
|
|
332
|
+
}
|
|
333
|
+
switch (declaration.kind) {
|
|
334
|
+
case "table": {
|
|
335
|
+
const list = listAt(declaration.rows)
|
|
336
|
+
if (list === undefined) return json
|
|
337
|
+
const rows = list.slice(0, maxRows).map((row) => {
|
|
338
|
+
const record = isRecord(row) ? row : {}
|
|
339
|
+
return Object.fromEntries(declaration.columns.map((c) => [c.field, record[c.field] ?? null]))
|
|
340
|
+
})
|
|
341
|
+
return {
|
|
342
|
+
kind: "table",
|
|
343
|
+
title: declaration.title ?? null,
|
|
344
|
+
columns: declaration.columns.map((c) => ({ key: c.field, label: labelOf(c), format: c.format ?? "text" })),
|
|
345
|
+
rows,
|
|
346
|
+
totalRows: list.length,
|
|
347
|
+
truncated: list.length > rows.length,
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
case "list": {
|
|
351
|
+
const list = listAt(declaration.items)
|
|
352
|
+
if (list === undefined) return json
|
|
353
|
+
const items = list.slice(0, maxRows).map((item) => {
|
|
354
|
+
const record = isRecord(item) ? item : {}
|
|
355
|
+
return {
|
|
356
|
+
title: textOf(record[declaration.title]),
|
|
357
|
+
subtitle: declaration.subtitle === undefined ? null : textOf(record[declaration.subtitle]) || null,
|
|
358
|
+
}
|
|
359
|
+
})
|
|
360
|
+
return { kind: "list", items, totalItems: list.length, truncated: list.length > items.length }
|
|
361
|
+
}
|
|
362
|
+
case "card": {
|
|
363
|
+
if (!isRecord(output)) return json
|
|
364
|
+
return {
|
|
365
|
+
kind: "card",
|
|
366
|
+
title: textOf(output[declaration.title]),
|
|
367
|
+
subtitle: declaration.subtitle === undefined ? null : textOf(output[declaration.subtitle]) || null,
|
|
368
|
+
fields: declaration.fields.map((f) => ({
|
|
369
|
+
label: labelOf(f),
|
|
370
|
+
value: output[f.field] ?? null,
|
|
371
|
+
format: f.format ?? "text",
|
|
372
|
+
})),
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
case "markdown": {
|
|
376
|
+
if (!isRecord(output)) return json
|
|
377
|
+
const text = textOf(output[declaration.field])
|
|
378
|
+
return { kind: "markdown", text: text.slice(0, maxText), truncated: text.length > maxText }
|
|
379
|
+
}
|
|
380
|
+
case "chart": {
|
|
381
|
+
const list = listAt(declaration.rows)
|
|
382
|
+
if (list === undefined) return json
|
|
383
|
+
const number = (value: unknown) => (typeof value === "number" && Number.isFinite(value) ? value : null)
|
|
384
|
+
const points = list.slice(0, maxRows).map((row) => {
|
|
385
|
+
const record = isRecord(row) ? row : {}
|
|
386
|
+
return Object.fromEntries([
|
|
387
|
+
[declaration.x.field, textOf(record[declaration.x.field])],
|
|
388
|
+
...declaration.series.map((f) => [f.field, number(record[f.field])]),
|
|
389
|
+
])
|
|
390
|
+
})
|
|
391
|
+
return {
|
|
392
|
+
kind: "chart",
|
|
393
|
+
chart: declaration.chart,
|
|
394
|
+
title: declaration.title ?? null,
|
|
395
|
+
x: { key: declaration.x.field, label: labelOf(declaration.x) },
|
|
396
|
+
series: declaration.series.map((f) => ({ key: f.field, label: labelOf(f) })),
|
|
397
|
+
points,
|
|
398
|
+
totalPoints: list.length,
|
|
399
|
+
truncated: list.length > points.length,
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
case "metric":
|
|
403
|
+
if (!isRecord(output)) return json
|
|
404
|
+
return {
|
|
405
|
+
kind: "metric",
|
|
406
|
+
label: declaration.label,
|
|
407
|
+
value: output[declaration.value] ?? null,
|
|
408
|
+
delta: declaration.delta === undefined ? null : (output[declaration.delta] ?? null),
|
|
409
|
+
unit: declaration.unit ?? null,
|
|
410
|
+
}
|
|
411
|
+
case "change":
|
|
412
|
+
if (!isRecord(output)) return json
|
|
413
|
+
return {
|
|
414
|
+
kind: "change",
|
|
415
|
+
title: declaration.title === undefined ? null : textOf(output[declaration.title]) || null,
|
|
416
|
+
before: output[declaration.before] ?? null,
|
|
417
|
+
after: output[declaration.after] ?? null,
|
|
418
|
+
}
|
|
419
|
+
case "file": {
|
|
420
|
+
if (!isRecord(output) || typeof output[declaration.file] !== "string") return json
|
|
421
|
+
const mediaType = declaration.mediaType === undefined ? null : textOf(output[declaration.mediaType]) || null
|
|
422
|
+
return {
|
|
423
|
+
kind: "file",
|
|
424
|
+
fileId: output[declaration.file] as string,
|
|
425
|
+
name: declaration.name === undefined ? null : textOf(output[declaration.name]) || null,
|
|
426
|
+
mediaType,
|
|
427
|
+
image: mediaType !== null && /^image\/(?!svg)/i.test(mediaType),
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
case "progress": {
|
|
431
|
+
if (!isRecord(output) || typeof output[declaration.task] !== "string") return json
|
|
432
|
+
return { kind: "progress", taskId: output[declaration.task] as string, label: declaration.label ?? null }
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
const cell = (value: unknown, max = 80) => {
|
|
438
|
+
const text = textOf(value).replace(/\s+/g, " ").replaceAll("|", "\\|")
|
|
439
|
+
return text.length > max ? `${text.slice(0, max - 1)}…` : text
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* A view as compact text for an agent: a markdown table, `Title — subtitle` lines, a card's `label: value`
|
|
444
|
+
* lines, or the markdown itself, never longer than `maxChars` and saying how much was left out.
|
|
445
|
+
*/
|
|
446
|
+
export const compactResult = (view: ResultView, limits: CompactLimits = {}): string => {
|
|
447
|
+
const maxChars = Math.max(80, limits.maxChars ?? RENDER_DEFAULTS.maxChars)
|
|
448
|
+
const maxRows = Math.max(1, limits.maxRows ?? RENDER_DEFAULTS.compactRows)
|
|
449
|
+
const lines: Array<string> = []
|
|
450
|
+
let omitted = 0
|
|
451
|
+
switch (view.kind) {
|
|
452
|
+
case "table": {
|
|
453
|
+
if (view.title !== null) lines.push(view.title)
|
|
454
|
+
lines.push(`| ${view.columns.map((c) => cell(c.label)).join(" | ")} |`)
|
|
455
|
+
lines.push(`| ${view.columns.map(() => "---").join(" | ")} |`)
|
|
456
|
+
const shown = view.rows.slice(0, maxRows)
|
|
457
|
+
for (const row of shown) lines.push(`| ${view.columns.map((c) => cell(row[c.key])).join(" | ")} |`)
|
|
458
|
+
omitted = view.totalRows - shown.length
|
|
459
|
+
if (omitted > 0)
|
|
460
|
+
lines.push(`(${omitted} more row${omitted === 1 ? "" : "s"} not shown; ${view.totalRows} in all)`)
|
|
461
|
+
break
|
|
462
|
+
}
|
|
463
|
+
case "list": {
|
|
464
|
+
const shown = view.items.slice(0, maxRows)
|
|
465
|
+
for (const item of shown)
|
|
466
|
+
lines.push(`- ${cell(item.title, 120)}${item.subtitle === null ? "" : ` — ${cell(item.subtitle, 120)}`}`)
|
|
467
|
+
omitted = view.totalItems - shown.length
|
|
468
|
+
if (omitted > 0)
|
|
469
|
+
lines.push(`(${omitted} more item${omitted === 1 ? "" : "s"} not shown; ${view.totalItems} in all)`)
|
|
470
|
+
break
|
|
471
|
+
}
|
|
472
|
+
case "card":
|
|
473
|
+
lines.push(view.subtitle === null ? view.title : `${view.title} — ${view.subtitle}`)
|
|
474
|
+
for (const f of view.fields) lines.push(`${f.label}: ${cell(f.value, 200)}`)
|
|
475
|
+
break
|
|
476
|
+
case "markdown":
|
|
477
|
+
lines.push(view.text)
|
|
478
|
+
if (view.truncated) lines.push("(cut short)")
|
|
479
|
+
break
|
|
480
|
+
case "chart": {
|
|
481
|
+
if (view.title !== null) lines.push(view.title)
|
|
482
|
+
const shown = view.points.slice(0, maxRows)
|
|
483
|
+
for (const point of shown) {
|
|
484
|
+
lines.push(
|
|
485
|
+
`- ${cell(point[view.x.key], 60)}: ${view.series.map((s) => `${s.label} ${cell(point[s.key], 30)}`).join(", ")}`,
|
|
486
|
+
)
|
|
487
|
+
}
|
|
488
|
+
omitted = view.totalPoints - shown.length
|
|
489
|
+
if (omitted > 0)
|
|
490
|
+
lines.push(`(${omitted} more point${omitted === 1 ? "" : "s"} not shown; ${view.totalPoints} in all)`)
|
|
491
|
+
break
|
|
492
|
+
}
|
|
493
|
+
case "metric":
|
|
494
|
+
lines.push(
|
|
495
|
+
`${view.label}: ${cell(view.value, 60)}${view.unit === null ? "" : ` ${view.unit}`}${view.delta === null ? "" : ` (${cell(view.delta, 30)})`}`,
|
|
496
|
+
)
|
|
497
|
+
break
|
|
498
|
+
case "change":
|
|
499
|
+
lines.push(`${view.title === null ? "" : `${view.title}: `}${cell(view.before, 200)} → ${cell(view.after, 200)}`)
|
|
500
|
+
break
|
|
501
|
+
case "file":
|
|
502
|
+
lines.push(`${view.image ? "Image" : "File"}: ${view.name ?? view.fileId} (${view.fileId})`)
|
|
503
|
+
break
|
|
504
|
+
case "progress":
|
|
505
|
+
lines.push(`${view.label ?? "Progress"}: task ${view.taskId}`)
|
|
506
|
+
break
|
|
507
|
+
case "json":
|
|
508
|
+
lines.push(textOf(view.value))
|
|
509
|
+
break
|
|
510
|
+
}
|
|
511
|
+
const text = lines.join("\n")
|
|
512
|
+
if (text.length <= maxChars) return text
|
|
513
|
+
const marker = `\n(cut at ${maxChars} characters of ${text.length})`
|
|
514
|
+
return text.slice(0, Math.max(0, maxChars - marker.length)) + marker
|
|
515
|
+
}
|
package/src/Rpc.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The typed client projection: the action registry becomes an Effect RPC group
|
|
3
|
+
* with no hand-written glue. Shared by the kernel (server) and the client SDK.
|
|
4
|
+
*/
|
|
5
|
+
import { Schema } from "effect"
|
|
6
|
+
import { Rpc, RpcGroup } from "effect/rpc"
|
|
7
|
+
import { InvocationError } from "./Errors.ts"
|
|
8
|
+
import type { ActionContract, ActionsOf, AnyAction, AnyModuleContract } from "./Module.ts"
|
|
9
|
+
import { actionRegistry } from "./Module.ts"
|
|
10
|
+
import { actionResult, type ReplayEnvelope } from "./Receipt.ts"
|
|
11
|
+
|
|
12
|
+
export type ActionRpc<A> =
|
|
13
|
+
A extends ActionContract<infer Name, infer Input, infer Output>
|
|
14
|
+
? Rpc.Rpc<
|
|
15
|
+
Name,
|
|
16
|
+
Input,
|
|
17
|
+
Schema.Union<
|
|
18
|
+
readonly [
|
|
19
|
+
Schema.Struct<{ readonly kind: Schema.Literal<"output">; readonly output: Output }>,
|
|
20
|
+
typeof ReplayEnvelope,
|
|
21
|
+
]
|
|
22
|
+
>,
|
|
23
|
+
typeof InvocationError
|
|
24
|
+
>
|
|
25
|
+
: never
|
|
26
|
+
|
|
27
|
+
export type RegistryRpcs<Modules extends ReadonlyArray<AnyModuleContract>> = ActionRpc<ActionsOf<Modules>>
|
|
28
|
+
|
|
29
|
+
export const actionToRpc = <A extends AnyAction>(action: A): ActionRpc<A> =>
|
|
30
|
+
Rpc.make(action.name, {
|
|
31
|
+
payload: action.input,
|
|
32
|
+
success: actionResult(action),
|
|
33
|
+
error: InvocationError,
|
|
34
|
+
}) as ActionRpc<A>
|
|
35
|
+
|
|
36
|
+
/** Project every action of the given modules into one RPC group. */
|
|
37
|
+
export const toRpcGroup = <const Modules extends ReadonlyArray<AnyModuleContract>>(
|
|
38
|
+
modules: Modules,
|
|
39
|
+
): RpcGroup.RpcGroup<RegistryRpcs<Modules>> =>
|
|
40
|
+
RpcGroup.make(...[...actionRegistry(modules).values()].map(actionToRpc)) as unknown as RpcGroup.RpcGroup<
|
|
41
|
+
RegistryRpcs<Modules>
|
|
42
|
+
>
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A MAKE module's action as the typed RPC client lists it: MAKE modules are installed at run time, so the client
|
|
46
|
+
* projected from the app's modules cannot name them; it lists the ones its caller reaches (`$make.actions`) and calls
|
|
47
|
+
* them through the invocation path (`$make.call`). `description` is marked as the module's own, untrusted text.
|
|
48
|
+
*/
|
|
49
|
+
export const MakeActionListing = Schema.Struct({
|
|
50
|
+
name: Schema.String,
|
|
51
|
+
module: Schema.String,
|
|
52
|
+
description: Schema.String,
|
|
53
|
+
/** The input's and output's JSON Schemas. */
|
|
54
|
+
input: Schema.Json,
|
|
55
|
+
output: Schema.Json,
|
|
56
|
+
readOnly: Schema.Boolean,
|
|
57
|
+
})
|
|
58
|
+
export type MakeActionListing = typeof MakeActionListing.Type
|
|
59
|
+
|
|
60
|
+
/** The RPC that lists the MAKE actions the caller reaches. */
|
|
61
|
+
export const MAKE_RPC_ACTIONS = "$make.actions"
|
|
62
|
+
/** The RPC that calls a MAKE action (`{ action, input }`), as any call: the action's envelope, or its typed error. */
|
|
63
|
+
export const MAKE_RPC_CALL = "$make.call"
|
|
64
|
+
|
|
65
|
+
/** The MAKE RPCs, served beside the app's actions (names no module's action can have). */
|
|
66
|
+
export const MakeRpcGroup = RpcGroup.make(
|
|
67
|
+
Rpc.make(MAKE_RPC_ACTIONS, {
|
|
68
|
+
payload: Schema.Struct({}),
|
|
69
|
+
success: Schema.Array(MakeActionListing),
|
|
70
|
+
error: InvocationError,
|
|
71
|
+
}),
|
|
72
|
+
Rpc.make(MAKE_RPC_CALL, {
|
|
73
|
+
payload: Schema.Struct({ action: Schema.String, input: Schema.Json }),
|
|
74
|
+
success: Schema.Json,
|
|
75
|
+
error: InvocationError,
|
|
76
|
+
}),
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
/** Header carrying the caller's idempotency key on RPC and HTTP (and on MCP as a fallback for `_meta`). */
|
|
80
|
+
export const IDEMPOTENCY_HEADER = "idempotency-key"
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The key in an MCP `tools/call` request's `params._meta` that carries the call's idempotency key. It takes
|
|
84
|
+
* precedence over the `idempotency-key` HTTP header, which applies to every call on the connection.
|
|
85
|
+
*/
|
|
86
|
+
export const MCP_IDEMPOTENCY_META = "io.eloxiv/idempotency-key"
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Header a client sets to label its HTTP calls with another surface for the audit log. Only `cli` is
|
|
90
|
+
* recognised; the label changes the audit record and nothing else (no credential, scope or policy reads it).
|
|
91
|
+
*/
|
|
92
|
+
export const SURFACE_HEADER = "x-eloxiv-surface"
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The input schema on the wire: any JSON, documented as the action's input.
|
|
96
|
+
* Servers accept raw input and leave decoding to the invocation path, so a
|
|
97
|
+
* request with invalid input is rejected *and audited* the same way on every
|
|
98
|
+
* surface (the typed client still validates before sending).
|
|
99
|
+
*/
|
|
100
|
+
export const wireInput = (action: AnyAction) =>
|
|
101
|
+
Schema.Json.check(
|
|
102
|
+
Schema.makeFilter(() => true, {
|
|
103
|
+
toJsonSchema: () => Schema.toJsonSchemaDocument(action.input).schema as never,
|
|
104
|
+
}),
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
/** The server's view of the action registry: the same RPCs, with raw (wire) input. */
|
|
108
|
+
export const toWireRpcGroup = (modules: ReadonlyArray<AnyModuleContract>) =>
|
|
109
|
+
RpcGroup.make(
|
|
110
|
+
...[...actionRegistry(modules).values()].map((action) =>
|
|
111
|
+
Rpc.make(action.name, { payload: wireInput(action), success: actionResult(action), error: InvocationError }),
|
|
112
|
+
),
|
|
113
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** PostgreSQL's built-in text search configurations an entity may index with (`EntitySearch.language`). */
|
|
2
|
+
export const SEARCH_LANGUAGES = [
|
|
3
|
+
"simple",
|
|
4
|
+
"arabic",
|
|
5
|
+
"armenian",
|
|
6
|
+
"basque",
|
|
7
|
+
"catalan",
|
|
8
|
+
"danish",
|
|
9
|
+
"dutch",
|
|
10
|
+
"english",
|
|
11
|
+
"finnish",
|
|
12
|
+
"french",
|
|
13
|
+
"german",
|
|
14
|
+
"greek",
|
|
15
|
+
"hindi",
|
|
16
|
+
"hungarian",
|
|
17
|
+
"indonesian",
|
|
18
|
+
"irish",
|
|
19
|
+
"italian",
|
|
20
|
+
"lithuanian",
|
|
21
|
+
"nepali",
|
|
22
|
+
"norwegian",
|
|
23
|
+
"portuguese",
|
|
24
|
+
"romanian",
|
|
25
|
+
"russian",
|
|
26
|
+
"serbian",
|
|
27
|
+
"spanish",
|
|
28
|
+
"swedish",
|
|
29
|
+
"tamil",
|
|
30
|
+
"turkish",
|
|
31
|
+
"yiddish",
|
|
32
|
+
] as const
|
|
33
|
+
export type SearchLanguage = (typeof SEARCH_LANGUAGES)[number]
|