@eloxiv/contracts 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +6 -2
- package/dist/Agent.d.ts +792 -0
- package/dist/Agent.d.ts.map +1 -0
- package/dist/Agent.js +610 -0
- package/dist/Agent.js.map +1 -0
- package/dist/Analytics.d.ts +46 -0
- package/dist/Analytics.d.ts.map +1 -0
- package/dist/Analytics.js +89 -0
- package/dist/Analytics.js.map +1 -0
- package/dist/Approval.d.ts +70 -0
- package/dist/Approval.d.ts.map +1 -0
- package/dist/Approval.js +127 -0
- package/dist/Approval.js.map +1 -0
- package/dist/Catalog.d.ts +238 -0
- package/dist/Catalog.d.ts.map +1 -0
- package/dist/Catalog.js +169 -0
- package/dist/Catalog.js.map +1 -0
- package/dist/Checklist.d.ts +99 -0
- package/dist/Checklist.d.ts.map +1 -0
- package/dist/Checklist.js +105 -0
- package/dist/Checklist.js.map +1 -0
- package/dist/Data.d.ts +107 -0
- package/dist/Data.d.ts.map +1 -0
- package/dist/Data.js +93 -0
- package/dist/Data.js.map +1 -0
- package/dist/Devices.d.ts +857 -0
- package/dist/Devices.d.ts.map +1 -0
- package/dist/Devices.js +590 -0
- package/dist/Devices.js.map +1 -0
- package/dist/Durable.d.ts +406 -0
- package/dist/Durable.d.ts.map +1 -0
- package/dist/Durable.js +203 -0
- package/dist/Durable.js.map +1 -0
- package/dist/Errors.d.ts +95 -0
- package/dist/Errors.d.ts.map +1 -0
- package/dist/Errors.js +72 -0
- package/dist/Errors.js.map +1 -0
- package/dist/JsonSchema.d.ts +355 -0
- package/dist/JsonSchema.d.ts.map +1 -0
- package/dist/JsonSchema.js +151 -0
- package/dist/JsonSchema.js.map +1 -0
- package/dist/Manifest.d.ts +353 -0
- package/dist/Manifest.d.ts.map +1 -0
- package/dist/Manifest.js +894 -0
- package/dist/Manifest.js.map +1 -0
- package/dist/Module.d.ts +447 -0
- package/dist/Module.d.ts.map +1 -0
- package/dist/Module.js +221 -0
- package/dist/Module.js.map +1 -0
- package/dist/Optimistic.d.ts +192 -0
- package/dist/Optimistic.d.ts.map +1 -0
- package/dist/Optimistic.js +319 -0
- package/dist/Optimistic.js.map +1 -0
- package/dist/Projection.d.ts +163 -0
- package/dist/Projection.d.ts.map +1 -0
- package/dist/Projection.js +158 -0
- package/dist/Projection.js.map +1 -0
- package/dist/Proposals.d.ts +103 -0
- package/dist/Proposals.d.ts.map +1 -0
- package/dist/Proposals.js +72 -0
- package/dist/Proposals.js.map +1 -0
- package/dist/Receipt.d.ts +243 -0
- package/dist/Receipt.d.ts.map +1 -0
- package/dist/Receipt.js +108 -0
- package/dist/Receipt.js.map +1 -0
- package/dist/Records.d.ts +297 -0
- package/dist/Records.d.ts.map +1 -0
- package/dist/Records.js +171 -0
- package/dist/Records.js.map +1 -0
- package/dist/Render.d.ts +207 -0
- package/dist/Render.d.ts.map +1 -0
- package/dist/Render.js +502 -0
- package/dist/Render.js.map +1 -0
- package/dist/Rpc.d.ts +115 -0
- package/dist/Rpc.d.ts.map +1 -0
- package/dist/Rpc.js +68 -0
- package/dist/Rpc.js.map +1 -0
- package/dist/SearchLanguages.d.ts +4 -0
- package/dist/SearchLanguages.d.ts.map +1 -0
- package/dist/SearchLanguages.js +33 -0
- package/dist/SearchLanguages.js.map +1 -0
- package/dist/Service.d.ts +59 -0
- package/dist/Service.d.ts.map +1 -0
- package/dist/Service.js +38 -0
- package/dist/Service.js.map +1 -0
- package/dist/Versions.d.ts +9 -0
- package/dist/Versions.d.ts.map +1 -0
- package/dist/Versions.js +78 -0
- package/dist/Versions.js.map +1 -0
- package/dist/contracts/ActionConsent.d.ts +189 -0
- package/dist/contracts/ActionConsent.d.ts.map +1 -0
- package/dist/contracts/ActionConsent.js +129 -0
- package/dist/contracts/ActionConsent.js.map +1 -0
- package/dist/contracts/ActionRegistry.d.ts +149 -0
- package/dist/contracts/ActionRegistry.d.ts.map +1 -0
- package/dist/contracts/ActionRegistry.js +37 -0
- package/dist/contracts/ActionRegistry.js.map +1 -0
- package/dist/contracts/Actor.d.ts +129 -0
- package/dist/contracts/Actor.d.ts.map +1 -0
- package/dist/contracts/Actor.js +47 -0
- package/dist/contracts/Actor.js.map +1 -0
- package/dist/contracts/AgentResources.d.ts +248 -0
- package/dist/contracts/AgentResources.d.ts.map +1 -0
- package/dist/contracts/AgentResources.js +158 -0
- package/dist/contracts/AgentResources.js.map +1 -0
- package/dist/contracts/AgentRuntime.d.ts +453 -0
- package/dist/contracts/AgentRuntime.d.ts.map +1 -0
- package/dist/contracts/AgentRuntime.js +117 -0
- package/dist/contracts/AgentRuntime.js.map +1 -0
- package/dist/contracts/Approvals.d.ts +303 -0
- package/dist/contracts/Approvals.d.ts.map +1 -0
- package/dist/contracts/Approvals.js +117 -0
- package/dist/contracts/Approvals.js.map +1 -0
- package/dist/contracts/Audit.d.ts +510 -0
- package/dist/contracts/Audit.d.ts.map +1 -0
- package/dist/contracts/Audit.js +139 -0
- package/dist/contracts/Audit.js.map +1 -0
- package/dist/contracts/CalendarProvider.d.ts +572 -0
- package/dist/contracts/CalendarProvider.d.ts.map +1 -0
- package/dist/contracts/CalendarProvider.js +203 -0
- package/dist/contracts/CalendarProvider.js.map +1 -0
- package/dist/contracts/Capability.d.ts +197 -0
- package/dist/contracts/Capability.d.ts.map +1 -0
- package/dist/contracts/Capability.js +189 -0
- package/dist/contracts/Capability.js.map +1 -0
- package/dist/contracts/ClientSDK.d.ts +250 -0
- package/dist/contracts/ClientSDK.d.ts.map +1 -0
- package/dist/contracts/ClientSDK.js +184 -0
- package/dist/contracts/ClientSDK.js.map +1 -0
- package/dist/contracts/CollabDocument.d.ts +781 -0
- package/dist/contracts/CollabDocument.d.ts.map +1 -0
- package/dist/contracts/CollabDocument.js +364 -0
- package/dist/contracts/CollabDocument.js.map +1 -0
- package/dist/contracts/Command.d.ts +183 -0
- package/dist/contracts/Command.d.ts.map +1 -0
- package/dist/contracts/Command.js +66 -0
- package/dist/contracts/Command.js.map +1 -0
- package/dist/contracts/Connections.d.ts +612 -0
- package/dist/contracts/Connections.d.ts.map +1 -0
- package/dist/contracts/Connections.js +323 -0
- package/dist/contracts/Connections.js.map +1 -0
- package/dist/contracts/ContextAccounting.d.ts +79 -0
- package/dist/contracts/ContextAccounting.d.ts.map +1 -0
- package/dist/contracts/ContextAccounting.js +32 -0
- package/dist/contracts/ContextAccounting.js.map +1 -0
- package/dist/contracts/Daemon.d.ts +486 -0
- package/dist/contracts/Daemon.d.ts.map +1 -0
- package/dist/contracts/Daemon.js +192 -0
- package/dist/contracts/Daemon.js.map +1 -0
- package/dist/contracts/DbTx.d.ts +149 -0
- package/dist/contracts/DbTx.d.ts.map +1 -0
- package/dist/contracts/DbTx.js +94 -0
- package/dist/contracts/DbTx.js.map +1 -0
- package/dist/contracts/Delegation.d.ts +121 -0
- package/dist/contracts/Delegation.d.ts.map +1 -0
- package/dist/contracts/Delegation.js +76 -0
- package/dist/contracts/Delegation.js.map +1 -0
- package/dist/contracts/DeviceControl.d.ts +293 -0
- package/dist/contracts/DeviceControl.d.ts.map +1 -0
- package/dist/contracts/DeviceControl.js +107 -0
- package/dist/contracts/DeviceControl.js.map +1 -0
- package/dist/contracts/Directory.d.ts +492 -0
- package/dist/contracts/Directory.d.ts.map +1 -0
- package/dist/contracts/Directory.js +225 -0
- package/dist/contracts/Directory.js.map +1 -0
- package/dist/contracts/DirectoryProvider.d.ts +214 -0
- package/dist/contracts/DirectoryProvider.d.ts.map +1 -0
- package/dist/contracts/DirectoryProvider.js +73 -0
- package/dist/contracts/DirectoryProvider.js.map +1 -0
- package/dist/contracts/DocumentSource.d.ts +190 -0
- package/dist/contracts/DocumentSource.d.ts.map +1 -0
- package/dist/contracts/DocumentSource.js +64 -0
- package/dist/contracts/DocumentSource.js.map +1 -0
- package/dist/contracts/Files.d.ts +762 -0
- package/dist/contracts/Files.d.ts.map +1 -0
- package/dist/contracts/Files.js +339 -0
- package/dist/contracts/Files.js.map +1 -0
- package/dist/contracts/Flags.d.ts +265 -0
- package/dist/contracts/Flags.d.ts.map +1 -0
- package/dist/contracts/Flags.js +197 -0
- package/dist/contracts/Flags.js.map +1 -0
- package/dist/contracts/Host.d.ts +320 -0
- package/dist/contracts/Host.d.ts.map +1 -0
- package/dist/contracts/Host.js +224 -0
- package/dist/contracts/Host.js.map +1 -0
- package/dist/contracts/HttpApi.d.ts +102 -0
- package/dist/contracts/HttpApi.d.ts.map +1 -0
- package/dist/contracts/HttpApi.js +89 -0
- package/dist/contracts/HttpApi.js.map +1 -0
- package/dist/contracts/Ingestion.d.ts +522 -0
- package/dist/contracts/Ingestion.d.ts.map +1 -0
- package/dist/contracts/Ingestion.js +275 -0
- package/dist/contracts/Ingestion.js.map +1 -0
- package/dist/contracts/Ingress.d.ts +132 -0
- package/dist/contracts/Ingress.d.ts.map +1 -0
- package/dist/contracts/Ingress.js +102 -0
- package/dist/contracts/Ingress.js.map +1 -0
- package/dist/contracts/Invocation.d.ts +361 -0
- package/dist/contracts/Invocation.d.ts.map +1 -0
- package/dist/contracts/Invocation.js +104 -0
- package/dist/contracts/Invocation.js.map +1 -0
- package/dist/contracts/LocalClient.d.ts +888 -0
- package/dist/contracts/LocalClient.d.ts.map +1 -0
- package/dist/contracts/LocalClient.js +429 -0
- package/dist/contracts/LocalClient.js.map +1 -0
- package/dist/contracts/Locale.d.ts +162 -0
- package/dist/contracts/Locale.d.ts.map +1 -0
- package/dist/contracts/Locale.js +123 -0
- package/dist/contracts/Locale.js.map +1 -0
- package/dist/contracts/MachineIdentity.d.ts +434 -0
- package/dist/contracts/MachineIdentity.d.ts.map +1 -0
- package/dist/contracts/MachineIdentity.js +223 -0
- package/dist/contracts/MachineIdentity.js.map +1 -0
- package/dist/contracts/MailProvider.d.ts +791 -0
- package/dist/contracts/MailProvider.d.ts.map +1 -0
- package/dist/contracts/MailProvider.js +237 -0
- package/dist/contracts/MailProvider.js.map +1 -0
- package/dist/contracts/Memory.d.ts +62 -0
- package/dist/contracts/Memory.d.ts.map +1 -0
- package/dist/contracts/Memory.js +43 -0
- package/dist/contracts/Memory.js.map +1 -0
- package/dist/contracts/Messaging.d.ts +154 -0
- package/dist/contracts/Messaging.d.ts.map +1 -0
- package/dist/contracts/Messaging.js +97 -0
- package/dist/contracts/Messaging.js.map +1 -0
- package/dist/contracts/Metering.d.ts +334 -0
- package/dist/contracts/Metering.d.ts.map +1 -0
- package/dist/contracts/Metering.js +202 -0
- package/dist/contracts/Metering.js.map +1 -0
- package/dist/contracts/ModelProvider.d.ts +142 -0
- package/dist/contracts/ModelProvider.d.ts.map +1 -0
- package/dist/contracts/ModelProvider.js +72 -0
- package/dist/contracts/ModelProvider.js.map +1 -0
- package/dist/contracts/ModuleManifest.d.ts +2519 -0
- package/dist/contracts/ModuleManifest.d.ts.map +1 -0
- package/dist/contracts/ModuleManifest.js +272 -0
- package/dist/contracts/ModuleManifest.js.map +1 -0
- package/dist/contracts/NotificationChannel.d.ts +378 -0
- package/dist/contracts/NotificationChannel.d.ts.map +1 -0
- package/dist/contracts/NotificationChannel.js +136 -0
- package/dist/contracts/NotificationChannel.js.map +1 -0
- package/dist/contracts/Notifications.d.ts +417 -0
- package/dist/contracts/Notifications.d.ts.map +1 -0
- package/dist/contracts/Notifications.js +267 -0
- package/dist/contracts/Notifications.js.map +1 -0
- package/dist/contracts/Outbox.d.ts +469 -0
- package/dist/contracts/Outbox.d.ts.map +1 -0
- package/dist/contracts/Outbox.js +215 -0
- package/dist/contracts/Outbox.js.map +1 -0
- package/dist/contracts/Privacy.d.ts +1029 -0
- package/dist/contracts/Privacy.d.ts.map +1 -0
- package/dist/contracts/Privacy.js +437 -0
- package/dist/contracts/Privacy.js.map +1 -0
- package/dist/contracts/Progress.d.ts +305 -0
- package/dist/contracts/Progress.d.ts.map +1 -0
- package/dist/contracts/Progress.js +174 -0
- package/dist/contracts/Progress.js.map +1 -0
- package/dist/contracts/QuerySurface.d.ts +231 -0
- package/dist/contracts/QuerySurface.d.ts.map +1 -0
- package/dist/contracts/QuerySurface.js +113 -0
- package/dist/contracts/QuerySurface.js.map +1 -0
- package/dist/contracts/Readiness.d.ts +105 -0
- package/dist/contracts/Readiness.d.ts.map +1 -0
- package/dist/contracts/Readiness.js +57 -0
- package/dist/contracts/Readiness.js.map +1 -0
- package/dist/contracts/Release.d.ts +295 -0
- package/dist/contracts/Release.d.ts.map +1 -0
- package/dist/contracts/Release.js +175 -0
- package/dist/contracts/Release.js.map +1 -0
- package/dist/contracts/ResultRendering.d.ts +533 -0
- package/dist/contracts/ResultRendering.d.ts.map +1 -0
- package/dist/contracts/ResultRendering.js +59 -0
- package/dist/contracts/ResultRendering.js.map +1 -0
- package/dist/contracts/Sandbox.d.ts +1164 -0
- package/dist/contracts/Sandbox.d.ts.map +1 -0
- package/dist/contracts/Sandbox.js +550 -0
- package/dist/contracts/Sandbox.js.map +1 -0
- package/dist/contracts/Scheduler.d.ts +814 -0
- package/dist/contracts/Scheduler.d.ts.map +1 -0
- package/dist/contracts/Scheduler.js +202 -0
- package/dist/contracts/Scheduler.js.map +1 -0
- package/dist/contracts/ScreenContext.d.ts +514 -0
- package/dist/contracts/ScreenContext.d.ts.map +1 -0
- package/dist/contracts/ScreenContext.js +272 -0
- package/dist/contracts/ScreenContext.js.map +1 -0
- package/dist/contracts/Search.d.ts +308 -0
- package/dist/contracts/Search.d.ts.map +1 -0
- package/dist/contracts/Search.js +107 -0
- package/dist/contracts/Search.js.map +1 -0
- package/dist/contracts/Secrets.d.ts +483 -0
- package/dist/contracts/Secrets.d.ts.map +1 -0
- package/dist/contracts/Secrets.js +136 -0
- package/dist/contracts/Secrets.js.map +1 -0
- package/dist/contracts/Settings.d.ts +221 -0
- package/dist/contracts/Settings.d.ts.map +1 -0
- package/dist/contracts/Settings.js +163 -0
- package/dist/contracts/Settings.js.map +1 -0
- package/dist/contracts/Sharing.d.ts +319 -0
- package/dist/contracts/Sharing.d.ts.map +1 -0
- package/dist/contracts/Sharing.js +172 -0
- package/dist/contracts/Sharing.js.map +1 -0
- package/dist/contracts/Slot.d.ts +162 -0
- package/dist/contracts/Slot.d.ts.map +1 -0
- package/dist/contracts/Slot.js +56 -0
- package/dist/contracts/Slot.js.map +1 -0
- package/dist/contracts/Space.d.ts +256 -0
- package/dist/contracts/Space.d.ts.map +1 -0
- package/dist/contracts/Space.js +133 -0
- package/dist/contracts/Space.js.map +1 -0
- package/dist/contracts/StorageAdapter.d.ts +124 -0
- package/dist/contracts/StorageAdapter.d.ts.map +1 -0
- package/dist/contracts/StorageAdapter.js +96 -0
- package/dist/contracts/StorageAdapter.js.map +1 -0
- package/dist/contracts/StorageBackend.d.ts +310 -0
- package/dist/contracts/StorageBackend.d.ts.map +1 -0
- package/dist/contracts/StorageBackend.js +196 -0
- package/dist/contracts/StorageBackend.js.map +1 -0
- package/dist/contracts/Sync.d.ts +286 -0
- package/dist/contracts/Sync.d.ts.map +1 -0
- package/dist/contracts/Sync.js +157 -0
- package/dist/contracts/Sync.js.map +1 -0
- package/dist/contracts/Telemetry.d.ts +183 -0
- package/dist/contracts/Telemetry.d.ts.map +1 -0
- package/dist/contracts/Telemetry.js +153 -0
- package/dist/contracts/Telemetry.js.map +1 -0
- package/dist/contracts/ThemeTokens.d.ts +212 -0
- package/dist/contracts/ThemeTokens.d.ts.map +1 -0
- package/dist/contracts/ThemeTokens.js +111 -0
- package/dist/contracts/ThemeTokens.js.map +1 -0
- package/dist/contracts/ToolSource.d.ts +135 -0
- package/dist/contracts/ToolSource.d.ts.map +1 -0
- package/dist/contracts/ToolSource.js +81 -0
- package/dist/contracts/ToolSource.js.map +1 -0
- package/dist/contracts/Versioning.d.ts +363 -0
- package/dist/contracts/Versioning.d.ts.map +1 -0
- package/dist/contracts/Versioning.js +201 -0
- package/dist/contracts/Versioning.js.map +1 -0
- package/dist/contracts/View.d.ts +232 -0
- package/dist/contracts/View.d.ts.map +1 -0
- package/dist/contracts/View.js +102 -0
- package/dist/contracts/View.js.map +1 -0
- package/dist/contracts/WorkItems.d.ts +242 -0
- package/dist/contracts/WorkItems.d.ts.map +1 -0
- package/dist/contracts/WorkItems.js +126 -0
- package/dist/contracts/WorkItems.js.map +1 -0
- package/dist/contracts/Workflow.d.ts +191 -0
- package/dist/contracts/Workflow.d.ts.map +1 -0
- package/dist/contracts/Workflow.js +63 -0
- package/dist/contracts/Workflow.js.map +1 -0
- package/dist/contracts/index.d.ts +75 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +196 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/devices/module.d.ts +3777 -0
- package/dist/devices/module.d.ts.map +1 -0
- package/dist/devices/module.js +179 -0
- package/dist/devices/module.js.map +1 -0
- package/dist/drizzle/Entity.d.ts +148 -0
- package/dist/drizzle/Entity.d.ts.map +1 -0
- package/dist/drizzle/Entity.js +396 -0
- package/dist/drizzle/Entity.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -3
- package/schema/Actor.json +46 -0
- package/schema/AuditRecord.json +403 -0
- package/schema/DaemonHealth.json +29 -0
- package/schema/InvocationError.json +257 -0
- package/schema/InvocationReceipt.json +253 -0
- package/schema/Lockfile.json +129 -0
- package/schema/OutboxEvent.json +36 -0
- package/schema/PairingConfirm.json +33 -0
- package/schema/PairingResult.json +18 -0
- package/schema/PairingStart.json +18 -0
- package/schema/ProvenanceEntry.json +110 -0
- package/schema/ReplayEnvelope.json +269 -0
- package/schema/Surface.json +17 -0
- package/schema/codegen/LocalClient.json +1298 -0
- package/schema/codegen/Sandbox.json +320 -0
- package/schema/contracts/ActionConsent.json +1930 -0
- package/schema/contracts/ActionRegistry.json +722 -0
- package/schema/contracts/Actor.json +451 -0
- package/schema/contracts/AgentResources.json +1400 -0
- package/schema/contracts/AgentRuntime.json +4017 -0
- package/schema/contracts/Approvals.json +2916 -0
- package/schema/contracts/Audit.json +3268 -0
- package/schema/contracts/CalendarProvider.json +5557 -0
- package/schema/contracts/ClientSDK.json +1400 -0
- package/schema/contracts/CollabDocument.json +4012 -0
- package/schema/contracts/Command.json +616 -0
- package/schema/contracts/Connections.json +6687 -0
- package/schema/contracts/ContextAccounting.json +685 -0
- package/schema/contracts/Daemon.json +4555 -0
- package/schema/contracts/DbTx.json +321 -0
- package/schema/contracts/Delegation.json +949 -0
- package/schema/contracts/DeviceControl.json +2626 -0
- package/schema/contracts/Directory.json +5168 -0
- package/schema/contracts/DirectoryProvider.json +2090 -0
- package/schema/contracts/DocumentSource.json +2044 -0
- package/schema/contracts/Files.json +4122 -0
- package/schema/contracts/Flags.json +1202 -0
- package/schema/contracts/Host.json +1769 -0
- package/schema/contracts/HttpApi.json +1615 -0
- package/schema/contracts/Ingestion.json +3211 -0
- package/schema/contracts/Ingress.json +819 -0
- package/schema/contracts/Invocation.json +2044 -0
- package/schema/contracts/LocalClient.json +6657 -0
- package/schema/contracts/Locale.json +654 -0
- package/schema/contracts/MachineIdentity.json +2303 -0
- package/schema/contracts/MailProvider.json +6663 -0
- package/schema/contracts/Memory.json +579 -0
- package/schema/contracts/Messaging.json +1764 -0
- package/schema/contracts/Metering.json +3060 -0
- package/schema/contracts/ModelProvider.json +1127 -0
- package/schema/contracts/ModuleManifest.json +9449 -0
- package/schema/contracts/NotificationChannel.json +986 -0
- package/schema/contracts/Notifications.json +4280 -0
- package/schema/contracts/Outbox.json +1451 -0
- package/schema/contracts/Privacy.json +4354 -0
- package/schema/contracts/Progress.json +1524 -0
- package/schema/contracts/QuerySurface.json +661 -0
- package/schema/contracts/Readiness.json +209 -0
- package/schema/contracts/Release.json +805 -0
- package/schema/contracts/ResultRendering.json +2859 -0
- package/schema/contracts/Sandbox.json +2286 -0
- package/schema/contracts/Scheduler.json +6138 -0
- package/schema/contracts/ScreenContext.json +1238 -0
- package/schema/contracts/Search.json +1058 -0
- package/schema/contracts/Secrets.json +2444 -0
- package/schema/contracts/Settings.json +654 -0
- package/schema/contracts/Sharing.json +2854 -0
- package/schema/contracts/Slot.json +537 -0
- package/schema/contracts/Space.json +892 -0
- package/schema/contracts/StorageAdapter.json +623 -0
- package/schema/contracts/StorageBackend.json +2421 -0
- package/schema/contracts/Sync.json +894 -0
- package/schema/contracts/Telemetry.json +696 -0
- package/schema/contracts/ThemeTokens.json +547 -0
- package/schema/contracts/ToolSource.json +1333 -0
- package/schema/contracts/Versioning.json +1481 -0
- package/schema/contracts/View.json +750 -0
- package/schema/contracts/WorkItems.json +1731 -0
- package/schema/contracts/Workflow.json +1242 -0
- package/src/Agent.ts +758 -0
- package/src/Analytics.ts +110 -0
- package/src/Approval.ts +131 -0
- package/src/Catalog.ts +192 -0
- package/src/Checklist.ts +162 -0
- package/src/Data.ts +109 -0
- package/src/Devices.ts +721 -0
- package/src/Durable.ts +240 -0
- package/src/Errors.ts +111 -0
- package/src/JsonSchema.ts +166 -0
- package/src/Manifest.ts +1147 -0
- package/src/Module.ts +640 -0
- package/src/Optimistic.ts +332 -0
- package/src/Projection.ts +207 -0
- package/src/Proposals.ts +89 -0
- package/src/Receipt.ts +125 -0
- package/src/Records.ts +197 -0
- package/src/Render.ts +515 -0
- package/src/Rpc.ts +113 -0
- package/src/SearchLanguages.ts +33 -0
- package/src/Service.ts +102 -0
- package/src/Versions.ts +69 -0
- package/src/contracts/ActionConsent.ts +150 -0
- package/src/contracts/ActionRegistry.ts +39 -0
- package/src/contracts/Actor.ts +53 -0
- package/src/contracts/AgentResources.ts +167 -0
- package/src/contracts/AgentRuntime.ts +154 -0
- package/src/contracts/Approvals.ts +133 -0
- package/src/contracts/Audit.ts +160 -0
- package/src/contracts/CalendarProvider.ts +241 -0
- package/src/contracts/Capability.ts +246 -0
- package/src/contracts/ClientSDK.ts +199 -0
- package/src/contracts/CollabDocument.ts +420 -0
- package/src/contracts/Command.ts +74 -0
- package/src/contracts/Connections.ts +360 -0
- package/src/contracts/ContextAccounting.ts +35 -0
- package/src/contracts/Daemon.ts +247 -0
- package/src/contracts/DbTx.ts +110 -0
- package/src/contracts/Delegation.ts +91 -0
- package/src/contracts/DeviceControl.ts +143 -0
- package/src/contracts/Directory.ts +384 -0
- package/src/contracts/DirectoryProvider.ts +82 -0
- package/src/contracts/DocumentSource.ts +71 -0
- package/src/contracts/Files.ts +395 -0
- package/src/contracts/Flags.ts +241 -0
- package/src/contracts/Host.ts +245 -0
- package/src/contracts/HttpApi.ts +100 -0
- package/src/contracts/Ingestion.ts +315 -0
- package/src/contracts/Ingress.ts +132 -0
- package/src/contracts/Invocation.ts +122 -0
- package/src/contracts/LocalClient.ts +620 -0
- package/src/contracts/Locale.ts +133 -0
- package/src/contracts/MachineIdentity.ts +305 -0
- package/src/contracts/MailProvider.ts +272 -0
- package/src/contracts/Memory.ts +47 -0
- package/src/contracts/Messaging.ts +108 -0
- package/src/contracts/Metering.ts +231 -0
- package/src/contracts/ModelProvider.ts +87 -0
- package/src/contracts/ModuleManifest.ts +310 -0
- package/src/contracts/NotificationChannel.ts +158 -0
- package/src/contracts/Notifications.ts +309 -0
- package/src/contracts/Outbox.ts +246 -0
- package/src/contracts/Privacy.ts +502 -0
- package/src/contracts/Progress.ts +196 -0
- package/src/contracts/QuerySurface.ts +134 -0
- package/src/contracts/Readiness.ts +67 -0
- package/src/contracts/Release.ts +199 -0
- package/src/contracts/ResultRendering.ts +65 -0
- package/src/contracts/Sandbox.ts +648 -0
- package/src/contracts/Scheduler.ts +237 -0
- package/src/contracts/ScreenContext.ts +316 -0
- package/src/contracts/Search.ts +126 -0
- package/src/contracts/Secrets.ts +162 -0
- package/src/contracts/Settings.ts +207 -0
- package/src/contracts/Sharing.ts +205 -0
- package/src/contracts/Slot.ts +61 -0
- package/src/contracts/Space.ts +157 -0
- package/src/contracts/StorageAdapter.ts +104 -0
- package/src/contracts/StorageBackend.ts +220 -0
- package/src/contracts/Sync.ts +180 -0
- package/src/contracts/Telemetry.ts +177 -0
- package/src/contracts/ThemeTokens.ts +136 -0
- package/src/contracts/ToolSource.ts +94 -0
- package/src/contracts/Versioning.ts +237 -0
- package/src/contracts/View.ts +116 -0
- package/src/contracts/WorkItems.ts +144 -0
- package/src/contracts/Workflow.ts +67 -0
- package/src/contracts/index.ts +205 -0
- package/src/devices/module.ts +201 -0
- package/src/drizzle/Entity.ts +524 -0
- package/src/index.ts +19 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/** The Scheduler contract: cron and interval jobs, event triggers and recovery sweeps. See docs/contracts/scheduler.md. */
|
|
2
|
+
import { Schema } from "effect"
|
|
3
|
+
import {
|
|
4
|
+
AutomationCondition,
|
|
5
|
+
CatchUp,
|
|
6
|
+
EventSchedule,
|
|
7
|
+
ExecutionIdentity,
|
|
8
|
+
JobContract,
|
|
9
|
+
NoOpOutcome,
|
|
10
|
+
RuntimeScheduleSpec,
|
|
11
|
+
ScheduleSpec,
|
|
12
|
+
ScheduleTarget,
|
|
13
|
+
} from "../Durable.ts"
|
|
14
|
+
import { InvalidInput, InvocationError } from "../Errors.ts"
|
|
15
|
+
import { defineOperation, defineServiceContract } from "../Service.ts"
|
|
16
|
+
|
|
17
|
+
/** A schedule as the scheduler runs it: from a manifest job (per organisation) or created at runtime. */
|
|
18
|
+
export const ScheduleRecord = Schema.Struct({
|
|
19
|
+
/** Stable key: `job:<module>.<job>:<org>` or `schedule:<id>`. Runs are keyed by (key, scheduled time). */
|
|
20
|
+
key: Schema.String,
|
|
21
|
+
source: Schema.Literals(["manifest", "runtime"]),
|
|
22
|
+
schedule: ScheduleSpec,
|
|
23
|
+
target: ScheduleTarget,
|
|
24
|
+
identity: ExecutionIdentity,
|
|
25
|
+
catchUp: CatchUp,
|
|
26
|
+
paused: Schema.Boolean,
|
|
27
|
+
})
|
|
28
|
+
export type ScheduleRecord = typeof ScheduleRecord.Type
|
|
29
|
+
|
|
30
|
+
/** One run the scheduler started: a workflow execution keyed by (schedule, scheduled time). */
|
|
31
|
+
export const ScheduledRun = Schema.Struct({
|
|
32
|
+
key: Schema.String,
|
|
33
|
+
scheduledAt: Schema.String,
|
|
34
|
+
executionId: Schema.String,
|
|
35
|
+
/** True when the run came due while no kernel was running it (it was caught up). */
|
|
36
|
+
missed: Schema.Boolean,
|
|
37
|
+
})
|
|
38
|
+
export type ScheduledRun = typeof ScheduledRun.Type
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Where a recorded run is: `pending` (recorded, not handed to the engine yet), `running`, `succeeded`, `noop` (it
|
|
42
|
+
* succeeded by doing nothing on purpose: a no-op outcome), `failed`, `cancelled`, or `refused` (the engine refused
|
|
43
|
+
* its start: the app no longer has the workflow, or the input no longer decodes).
|
|
44
|
+
*/
|
|
45
|
+
export const RunState = Schema.Literals(["pending", "running", "succeeded", "noop", "failed", "cancelled", "refused"])
|
|
46
|
+
export type RunState = typeof RunState.Type
|
|
47
|
+
|
|
48
|
+
/** One run in a schedule's (or a one-off run request's) history, newest first. */
|
|
49
|
+
export const RunRecord = Schema.Struct({
|
|
50
|
+
key: Schema.String,
|
|
51
|
+
scheduledAt: Schema.String,
|
|
52
|
+
executionId: Schema.String,
|
|
53
|
+
missed: Schema.Boolean,
|
|
54
|
+
/** Who asked for it, for a run started by hand (`scheduler.runNow`, `scheduler.run`); null for a due run. */
|
|
55
|
+
requestedBy: Schema.NullOr(Schema.String),
|
|
56
|
+
state: RunState,
|
|
57
|
+
/** A no-op's reason, or why the start was refused. */
|
|
58
|
+
reason: Schema.NullOr(Schema.String),
|
|
59
|
+
/** A no-op's evidence. */
|
|
60
|
+
evidence: Schema.Array(Schema.String),
|
|
61
|
+
/** A failed run's error tag (never its message, which can carry what the work was about). */
|
|
62
|
+
error: Schema.NullOr(Schema.String),
|
|
63
|
+
startedAt: Schema.String,
|
|
64
|
+
finishedAt: Schema.NullOr(Schema.String),
|
|
65
|
+
})
|
|
66
|
+
export type RunRecord = typeof RunRecord.Type
|
|
67
|
+
|
|
68
|
+
/** A runtime schedule as the people who may see it read it, with its state of health. */
|
|
69
|
+
export const ScheduleSummary = Schema.Struct({
|
|
70
|
+
id: Schema.String,
|
|
71
|
+
name: Schema.String,
|
|
72
|
+
ownerId: Schema.String,
|
|
73
|
+
schedule: RuntimeScheduleSpec,
|
|
74
|
+
target: ScheduleTarget,
|
|
75
|
+
catchUp: CatchUp,
|
|
76
|
+
paused: Schema.Boolean,
|
|
77
|
+
/** Why the kernel paused it (`failures`: it failed `pauseAfter` times in a row), or null. */
|
|
78
|
+
pausedReason: Schema.NullOr(Schema.String),
|
|
79
|
+
/** Due runs that failed in a row since the last one that did not (runs started by hand do not count). */
|
|
80
|
+
failureStreak: Schema.Int,
|
|
81
|
+
lastRun: Schema.NullOr(RunRecord),
|
|
82
|
+
/** The next due time (null while paused). */
|
|
83
|
+
nextRunAt: Schema.NullOr(Schema.String),
|
|
84
|
+
})
|
|
85
|
+
export type ScheduleSummary = typeof ScheduleSummary.Type
|
|
86
|
+
|
|
87
|
+
/** Whether scheduling is alive: a kernel is sweeping, and runs are not waiting to start. */
|
|
88
|
+
export const SchedulerHealth = Schema.Struct({
|
|
89
|
+
status: Schema.Literals(["ok", "degraded", "down"]),
|
|
90
|
+
/** When a kernel last swept (null if none ever did). */
|
|
91
|
+
lastSweepAt: Schema.NullOr(Schema.String),
|
|
92
|
+
/** Recorded runs not handed to the engine yet, and run requests not recorded yet, older than the grace period. */
|
|
93
|
+
waiting: Schema.Int,
|
|
94
|
+
detail: Schema.String,
|
|
95
|
+
})
|
|
96
|
+
export type SchedulerHealth = typeof SchedulerHealth.Type
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* What a member can automate (`scheduler.catalog`): the actions a target may name, the workflows members may
|
|
100
|
+
* schedule, and the event types modules emit. Listing is not authorisation: every run is checked as it runs.
|
|
101
|
+
*/
|
|
102
|
+
export const AutomationCatalog = Schema.Struct({
|
|
103
|
+
actions: Schema.Array(Schema.Struct({ name: Schema.String, description: Schema.String, module: Schema.String })),
|
|
104
|
+
workflows: Schema.Array(Schema.Struct({ name: Schema.String })),
|
|
105
|
+
/** `automatable`: the event names its record, so members' event automations may run on it. */
|
|
106
|
+
events: Schema.Array(Schema.Struct({ type: Schema.String, module: Schema.String, automatable: Schema.Boolean })),
|
|
107
|
+
})
|
|
108
|
+
export type AutomationCatalog = typeof AutomationCatalog.Type
|
|
109
|
+
|
|
110
|
+
/** An outbox event type that starts a workflow, keyed by the event id. */
|
|
111
|
+
export const EventTrigger = Schema.Struct({
|
|
112
|
+
id: Schema.String,
|
|
113
|
+
event: Schema.String,
|
|
114
|
+
workflow: Schema.String,
|
|
115
|
+
})
|
|
116
|
+
export type EventTrigger = typeof EventTrigger.Type
|
|
117
|
+
|
|
118
|
+
const ScheduleInput = Schema.Struct({
|
|
119
|
+
name: Schema.String,
|
|
120
|
+
schedule: RuntimeScheduleSpec,
|
|
121
|
+
target: ScheduleTarget,
|
|
122
|
+
catchUp: Schema.optionalKey(CatchUp),
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
export const Scheduler = defineServiceContract({
|
|
126
|
+
name: "Scheduler",
|
|
127
|
+
kind: "kernel",
|
|
128
|
+
version: "1.4.0",
|
|
129
|
+
description:
|
|
130
|
+
"Cron (IANA time zone, correct across DST) and interval schedules, each with an execution identity and a target (an action with input, or a workflow). Schedules come from module manifests (`jobs`) and from runtime schedules created, paused, resumed and deleted through the authorised, audited actions scheduler.create, scheduler.pause, scheduler.resume and scheduler.delete. Each due run starts a durable workflow execution keyed by (schedule, scheduled time); a recovery sweep at startup applies each schedule's catch-up policy. Outbox event types trigger workflows keyed by the event id.",
|
|
131
|
+
operations: {
|
|
132
|
+
create: defineOperation({
|
|
133
|
+
description:
|
|
134
|
+
"Action scheduler.create: a runtime schedule that runs as its creator in the organisation they act in (membership is re-checked at every run). A workflow target must be a workflow defined as schedulable.",
|
|
135
|
+
input: ScheduleInput,
|
|
136
|
+
output: Schema.Struct({ id: Schema.String }),
|
|
137
|
+
errors: InvocationError,
|
|
138
|
+
}),
|
|
139
|
+
pause: defineOperation({
|
|
140
|
+
description: "Action scheduler.pause: stop starting runs. Runs that came due while paused are not caught up.",
|
|
141
|
+
input: Schema.Struct({ id: Schema.String }),
|
|
142
|
+
output: Schema.Struct({ id: Schema.String }),
|
|
143
|
+
errors: InvocationError,
|
|
144
|
+
}),
|
|
145
|
+
resume: defineOperation({
|
|
146
|
+
description: "Action scheduler.resume: start runs again from the next due time.",
|
|
147
|
+
input: Schema.Struct({ id: Schema.String }),
|
|
148
|
+
output: Schema.Struct({ id: Schema.String }),
|
|
149
|
+
errors: InvocationError,
|
|
150
|
+
}),
|
|
151
|
+
delete: defineOperation({
|
|
152
|
+
description: "Action scheduler.delete: remove a runtime schedule. Runs already started continue.",
|
|
153
|
+
input: Schema.Struct({ id: Schema.String }),
|
|
154
|
+
output: Schema.Struct({ id: Schema.String }),
|
|
155
|
+
errors: InvocationError,
|
|
156
|
+
}),
|
|
157
|
+
runNow: defineOperation({
|
|
158
|
+
description:
|
|
159
|
+
"Action scheduler.runNow: queue one run of a schedule now, outside its schedule (also while paused), as the schedule's own identity. Its owner, members it is shared with for `operate`, and holders of scheduler.manage may. A run started by hand never moves the failure streak.",
|
|
160
|
+
input: Schema.Struct({ id: Schema.String }),
|
|
161
|
+
output: Schema.Struct({ id: Schema.String, key: Schema.String }),
|
|
162
|
+
errors: InvocationError,
|
|
163
|
+
}),
|
|
164
|
+
run: defineOperation({
|
|
165
|
+
description:
|
|
166
|
+
"Action scheduler.run: run an action or a schedulable workflow once, now, as the caller, recorded like a schedule's run (key `run:<id>`).",
|
|
167
|
+
input: Schema.Struct({ target: ScheduleTarget }),
|
|
168
|
+
output: Schema.Struct({ id: Schema.String, key: Schema.String }),
|
|
169
|
+
errors: InvocationError,
|
|
170
|
+
}),
|
|
171
|
+
list: defineOperation({
|
|
172
|
+
description:
|
|
173
|
+
"Action scheduler.list: the runtime schedules the caller may see (their own, those shared with them, all of the organisation's with scheduler.manage), with failure streak, last run and next due time.",
|
|
174
|
+
input: Schema.Struct({}),
|
|
175
|
+
output: Schema.Struct({ schedules: Schema.Array(ScheduleSummary) }),
|
|
176
|
+
errors: InvocationError,
|
|
177
|
+
}),
|
|
178
|
+
runs: defineOperation({
|
|
179
|
+
description:
|
|
180
|
+
"Action scheduler.runs: the recent runs of a schedule or a one-off run the caller may see, newest first: state (including no-op), reason, error tag, times.",
|
|
181
|
+
input: Schema.Struct({ id: Schema.String, limit: Schema.optionalKey(Schema.Int) }),
|
|
182
|
+
output: Schema.Struct({ runs: Schema.Array(RunRecord) }),
|
|
183
|
+
errors: InvocationError,
|
|
184
|
+
}),
|
|
185
|
+
catalog: defineOperation({
|
|
186
|
+
description:
|
|
187
|
+
"Action scheduler.catalog: what a schedule or a one-off run can target (actions, schedulable workflows) and the event types modules emit.",
|
|
188
|
+
input: Schema.Struct({}),
|
|
189
|
+
output: AutomationCatalog,
|
|
190
|
+
errors: InvocationError,
|
|
191
|
+
}),
|
|
192
|
+
health: defineOperation({
|
|
193
|
+
description: "Action scheduler.health: whether a kernel is sweeping and whether runs are waiting to start.",
|
|
194
|
+
input: Schema.Struct({}),
|
|
195
|
+
output: SchedulerHealth,
|
|
196
|
+
errors: InvocationError,
|
|
197
|
+
}),
|
|
198
|
+
schedules: defineOperation({
|
|
199
|
+
description: "Every schedule the scheduler runs (manifest jobs per organisation, and runtime schedules).",
|
|
200
|
+
input: Schema.Struct({}),
|
|
201
|
+
output: Schema.Struct({ schedules: Schema.Array(ScheduleRecord) }),
|
|
202
|
+
errors: Schema.Never,
|
|
203
|
+
}),
|
|
204
|
+
sweep: defineOperation({
|
|
205
|
+
description:
|
|
206
|
+
"Start every run that is due at `now` (default: the current time) and not started yet, applying catch-up policies. The kernel runs it continuously and at startup (the recovery sweep).",
|
|
207
|
+
input: Schema.Struct({ now: Schema.optionalKey(Schema.String) }),
|
|
208
|
+
output: Schema.Struct({ started: Schema.Array(ScheduledRun) }),
|
|
209
|
+
errors: Schema.Never,
|
|
210
|
+
}),
|
|
211
|
+
preview: defineOperation({
|
|
212
|
+
description: "The next `count` due times of a schedule after `after` (ISO instants, UTC).",
|
|
213
|
+
input: Schema.Struct({ schedule: ScheduleSpec, after: Schema.String, count: Schema.Int }),
|
|
214
|
+
output: Schema.Struct({ times: Schema.Array(Schema.String) }),
|
|
215
|
+
errors: InvalidInput,
|
|
216
|
+
}),
|
|
217
|
+
},
|
|
218
|
+
types: {
|
|
219
|
+
ScheduleSpec,
|
|
220
|
+
ScheduleTarget,
|
|
221
|
+
CatchUp,
|
|
222
|
+
ExecutionIdentity,
|
|
223
|
+
JobContract,
|
|
224
|
+
ScheduleRecord,
|
|
225
|
+
ScheduledRun,
|
|
226
|
+
RunState,
|
|
227
|
+
RunRecord,
|
|
228
|
+
ScheduleSummary,
|
|
229
|
+
SchedulerHealth,
|
|
230
|
+
AutomationCatalog,
|
|
231
|
+
NoOpOutcome,
|
|
232
|
+
EventSchedule,
|
|
233
|
+
AutomationCondition,
|
|
234
|
+
RuntimeScheduleSpec,
|
|
235
|
+
EventTrigger,
|
|
236
|
+
},
|
|
237
|
+
})
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ScreenContext (a shell contract): what the person is looking at (the view, the record in focus, the records
|
|
3
|
+
* visible and the records selected), exposed to their agent so "this one" and "these" mean something, under
|
|
4
|
+
* privacy rules the person and the app control.
|
|
5
|
+
*
|
|
6
|
+
* The privacy rules, which every implementation applies before anything leaves the screen:
|
|
7
|
+
* 1. **References only.** A snapshot names records as `{ module, entity, id }` and the view by id: never a field
|
|
8
|
+
* value, never text on the screen. The agent reads a record only through its tools, under the person's policy.
|
|
9
|
+
* 2. **Off means nothing.** While the person has screen sharing off, there is no snapshot at all.
|
|
10
|
+
* 3. **Private views and entities.** A view the app or person marks private yields no snapshot; references to
|
|
11
|
+
* a private entity are withheld from every snapshot (counted in `withheld`, never named).
|
|
12
|
+
* 4. **Installed entities only.** A reference to an entity no installed module declares is withheld.
|
|
13
|
+
* 5. **Bounded.** At most `maxReferences` references in all (focus first, then selection, then visible); the rest
|
|
14
|
+
* are withheld.
|
|
15
|
+
*
|
|
16
|
+
* The kernel's `agent.send` takes a snapshot as `screen` and shows the model its references (never trusted for
|
|
17
|
+
* authorisation: the agent's tools still run under the person's policy).
|
|
18
|
+
*
|
|
19
|
+
* Durable state and agent commands (the kernel-provided `app_state` module, its actions below): each person's
|
|
20
|
+
* application state in each organisation (navigation, selection, the published screen, drafts), keyed, per tab or
|
|
21
|
+
* shared by every tab, with versions for compare-and-set, readable in one batch; and commands for the person's
|
|
22
|
+
* screen (navigate, open settings, ...) that their agent or another client issues, each delivered until a tab
|
|
23
|
+
* acknowledges it after handling it, and issued once under its id. Documented in
|
|
24
|
+
* docs/contracts/screen-context.md; conformance kit `@eloxiv/testing/conformance/ScreenContext`; implemented by
|
|
25
|
+
* `@eloxiv/shell-core` (`makeScreenContext`) and the kernel's agent module.
|
|
26
|
+
*/
|
|
27
|
+
import { Schema } from "effect"
|
|
28
|
+
import { defineServiceContract } from "../Service.ts"
|
|
29
|
+
import { EntityReference } from "./WorkItems.ts"
|
|
30
|
+
|
|
31
|
+
/** The most references a snapshot may carry, whatever the rules say. */
|
|
32
|
+
export const SCREEN_REFERENCE_LIMIT = 50
|
|
33
|
+
|
|
34
|
+
/** A bounded entity reference, as a snapshot carries it. */
|
|
35
|
+
export const ScreenReference = Schema.Struct({
|
|
36
|
+
module: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(100)),
|
|
37
|
+
entity: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(100)),
|
|
38
|
+
id: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(500)),
|
|
39
|
+
})
|
|
40
|
+
export type ScreenReference = typeof ScreenReference.Type
|
|
41
|
+
|
|
42
|
+
/** What the shell reports about the screen (in full; the rules decide what of it leaves). */
|
|
43
|
+
export const ScreenState = Schema.Struct({
|
|
44
|
+
/** The view on screen, by id; `null` when no module view is open (the launcher, a settings page). */
|
|
45
|
+
view: Schema.NullOr(Schema.String),
|
|
46
|
+
/** The record the view is open on, if any. */
|
|
47
|
+
focus: Schema.optionalKey(Schema.NullOr(EntityReference)),
|
|
48
|
+
/** Records the view shows (a list's rows). */
|
|
49
|
+
visible: Schema.optionalKey(Schema.Array(EntityReference)),
|
|
50
|
+
/** Records the person selected. */
|
|
51
|
+
selection: Schema.optionalKey(Schema.Array(EntityReference)),
|
|
52
|
+
})
|
|
53
|
+
export type ScreenState = typeof ScreenState.Type
|
|
54
|
+
|
|
55
|
+
/** What the agent receives: the view and the references the rules let through, and how many they withheld. */
|
|
56
|
+
export const ScreenSnapshot = Schema.Struct({
|
|
57
|
+
view: Schema.NullOr(
|
|
58
|
+
Schema.Struct({
|
|
59
|
+
id: Schema.String.check(Schema.isMaxLength(200)),
|
|
60
|
+
title: Schema.String.check(Schema.isMaxLength(200)),
|
|
61
|
+
route: Schema.String.check(Schema.isMaxLength(500)),
|
|
62
|
+
}),
|
|
63
|
+
),
|
|
64
|
+
focus: Schema.NullOr(ScreenReference),
|
|
65
|
+
selection: Schema.Array(ScreenReference).check(Schema.isMaxLength(SCREEN_REFERENCE_LIMIT)),
|
|
66
|
+
visible: Schema.Array(ScreenReference).check(Schema.isMaxLength(SCREEN_REFERENCE_LIMIT)),
|
|
67
|
+
withheld: Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0)),
|
|
68
|
+
}).check(
|
|
69
|
+
// The bound is on every reference together (focus, selection and visible), not on each list.
|
|
70
|
+
Schema.makeFilter(
|
|
71
|
+
(s) =>
|
|
72
|
+
(s.focus === null ? 0 : 1) + s.selection.length + s.visible.length <= SCREEN_REFERENCE_LIMIT ||
|
|
73
|
+
`a snapshot carries at most ${SCREEN_REFERENCE_LIMIT} references in all`,
|
|
74
|
+
),
|
|
75
|
+
)
|
|
76
|
+
export type ScreenSnapshot = typeof ScreenSnapshot.Type
|
|
77
|
+
|
|
78
|
+
/** The privacy rules: the person's switch, and the app's private views and entities. */
|
|
79
|
+
export const ScreenPrivacy = Schema.Struct({
|
|
80
|
+
sharing: Schema.Boolean,
|
|
81
|
+
/** View ids that never yield a snapshot. */
|
|
82
|
+
privateViews: Schema.Array(Schema.String),
|
|
83
|
+
/** Entities (`<module>.<entity>`) whose records are never referenced. */
|
|
84
|
+
privateEntities: Schema.Array(Schema.String),
|
|
85
|
+
maxReferences: Schema.Number.check(Schema.isInt(), Schema.isBetween({ minimum: 0, maximum: SCREEN_REFERENCE_LIMIT })),
|
|
86
|
+
})
|
|
87
|
+
export type ScreenPrivacy = typeof ScreenPrivacy.Type
|
|
88
|
+
|
|
89
|
+
/** The kernel's `app_state` module's actions. */
|
|
90
|
+
export const APP_STATE_ACTIONS = {
|
|
91
|
+
read: "app_state.get",
|
|
92
|
+
write: "app_state.write",
|
|
93
|
+
remove: "app_state.remove",
|
|
94
|
+
issue: "app_state.issue",
|
|
95
|
+
pending: "app_state.pending",
|
|
96
|
+
acknowledge: "app_state.acknowledge",
|
|
97
|
+
outcome: "app_state.outcome",
|
|
98
|
+
} as const
|
|
99
|
+
|
|
100
|
+
/** The key the shell publishes its screen snapshot under (per tab). */
|
|
101
|
+
export const SCREEN_STATE_KEY = "screen"
|
|
102
|
+
/** At most this many keys in one read. */
|
|
103
|
+
export const APP_STATE_READ_LIMIT = 50
|
|
104
|
+
/** At most this many bytes of JSON in one value. */
|
|
105
|
+
export const APP_STATE_VALUE_BYTES = 16_384
|
|
106
|
+
/** At most this many entries per person and organisation: the oldest per-tab entries make room; shared ones do not. */
|
|
107
|
+
export const APP_STATE_ENTRY_LIMIT = 200
|
|
108
|
+
/** At most this many pending commands per person and organisation. */
|
|
109
|
+
export const APP_COMMAND_PENDING_LIMIT = 50
|
|
110
|
+
/** At most this many bytes of JSON in one command. */
|
|
111
|
+
export const APP_COMMAND_BYTES = 4_096
|
|
112
|
+
|
|
113
|
+
const NAME = /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/
|
|
114
|
+
/** An app-state key (`screen`, `mail.compose`, `route`): letters, digits and `._:/-`, at most 128. */
|
|
115
|
+
export const AppStateKey = Schema.String.check(Schema.isPattern(NAME))
|
|
116
|
+
/** A tab's id (`tabIdentity`); absent for the entries every tab shares. */
|
|
117
|
+
export const TabId = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_-]{1,64}$/))
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* One stored entry: its value, version and the tab that wrote it. A version only grows (a new entry's is the time it
|
|
121
|
+
* is written, then one more on each write) and never repeats for a key, even once its removed entry was swept.
|
|
122
|
+
*/
|
|
123
|
+
export const AppStateEntry = Schema.Struct({
|
|
124
|
+
key: Schema.String,
|
|
125
|
+
/** The tab the entry is for, or `null` for one every tab shares. */
|
|
126
|
+
tabId: Schema.NullOr(Schema.String),
|
|
127
|
+
value: Schema.Json,
|
|
128
|
+
version: Schema.Number,
|
|
129
|
+
/** The tab whose write this is (`null` when not written from a tab: the agent, a headless client). */
|
|
130
|
+
writtenBy: Schema.NullOr(Schema.String),
|
|
131
|
+
updatedAt: Schema.String,
|
|
132
|
+
})
|
|
133
|
+
export type AppStateEntry = typeof AppStateEntry.Type
|
|
134
|
+
|
|
135
|
+
export const AppStateRead = Schema.Struct({
|
|
136
|
+
keys: Schema.Array(AppStateKey).check(Schema.isMinLength(1), Schema.isMaxLength(APP_STATE_READ_LIMIT)),
|
|
137
|
+
/** With a tab: that tab's entries and the shared ones. Without: the shared ones and every tab's. */
|
|
138
|
+
tabId: Schema.optionalKey(TabId),
|
|
139
|
+
})
|
|
140
|
+
export const AppStateReadResult = Schema.Struct({ entries: Schema.Array(AppStateEntry) })
|
|
141
|
+
|
|
142
|
+
export const AppStateWrite = Schema.Struct({
|
|
143
|
+
key: AppStateKey,
|
|
144
|
+
value: Schema.Json,
|
|
145
|
+
/** The tab the entry is for; absent for the shared entry. */
|
|
146
|
+
tabId: Schema.optionalKey(TabId),
|
|
147
|
+
/** Compare-and-set: write only if the entry is at this version now (0: only if there is none). */
|
|
148
|
+
expectedVersion: Schema.optionalKey(Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))),
|
|
149
|
+
/** The writing tab, recorded with the entry so that tab can ignore its own echo. */
|
|
150
|
+
writer: Schema.optionalKey(TabId),
|
|
151
|
+
})
|
|
152
|
+
/** `written: false` when the compare-and-set failed: `version` is the entry's current one (0: none). */
|
|
153
|
+
export const AppStateWriteResult = Schema.Struct({ written: Schema.Boolean, version: Schema.Number })
|
|
154
|
+
|
|
155
|
+
export const AppStateRemove = Schema.Struct({
|
|
156
|
+
key: AppStateKey,
|
|
157
|
+
tabId: Schema.optionalKey(TabId),
|
|
158
|
+
expectedVersion: Schema.optionalKey(Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(1))),
|
|
159
|
+
})
|
|
160
|
+
/** `removed: false` when there was none or the compare-and-set failed; `version` is the entry's version now. */
|
|
161
|
+
export const AppStateRemoveResult = Schema.Struct({ removed: Schema.Boolean, version: Schema.Number })
|
|
162
|
+
|
|
163
|
+
/** A command for the person's screen: its kind and whatever the kind needs (the shell decides what it does). */
|
|
164
|
+
export const AppCommand = Schema.Record(Schema.String, Schema.Json).check(
|
|
165
|
+
Schema.makeFilter(
|
|
166
|
+
(command) =>
|
|
167
|
+
(typeof command["kind"] === "string" && /^[a-z][a-z0-9.-]{0,63}$/.test(command["kind"])) ||
|
|
168
|
+
"a command is { kind, ... } with kind a lowercase name of at most 64 characters",
|
|
169
|
+
),
|
|
170
|
+
)
|
|
171
|
+
export type AppCommand = typeof AppCommand.Type
|
|
172
|
+
|
|
173
|
+
export const AppCommandIssue = Schema.Struct({
|
|
174
|
+
/** The command's id, chosen by its issuer: issuing the same id again issues nothing. */
|
|
175
|
+
id: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_-]{1,64}$/)),
|
|
176
|
+
command: AppCommand,
|
|
177
|
+
/** The tab it is for; absent for whichever of the person's tabs handles it first. */
|
|
178
|
+
tabId: Schema.optionalKey(TabId),
|
|
179
|
+
})
|
|
180
|
+
export const AppCommandIssueResult = Schema.Struct({ id: Schema.String, issued: Schema.Boolean })
|
|
181
|
+
|
|
182
|
+
export const PendingAppCommand = Schema.Struct({
|
|
183
|
+
id: Schema.String,
|
|
184
|
+
command: AppCommand,
|
|
185
|
+
tabId: Schema.NullOr(Schema.String),
|
|
186
|
+
/** Who issued it: `agent` (the person's agent), `person` (one of their clients) or `system` (a job acting for them). */
|
|
187
|
+
issuedBy: Schema.Literals(["agent", "person", "system"]),
|
|
188
|
+
issuedAt: Schema.String,
|
|
189
|
+
})
|
|
190
|
+
export type PendingAppCommand = typeof PendingAppCommand.Type
|
|
191
|
+
|
|
192
|
+
export const AppCommandPending = Schema.Struct({ tabId: Schema.optionalKey(TabId) })
|
|
193
|
+
export const AppCommandPendingResult = Schema.Struct({ commands: Schema.Array(PendingAppCommand) })
|
|
194
|
+
|
|
195
|
+
export const AppCommandOutcome = Schema.Literals(["done", "refused", "failed"])
|
|
196
|
+
export type AppCommandOutcome = typeof AppCommandOutcome.Type
|
|
197
|
+
export const AppCommandAcknowledge = Schema.Struct({
|
|
198
|
+
id: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_-]{1,64}$/)),
|
|
199
|
+
outcome: AppCommandOutcome,
|
|
200
|
+
detail: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(500))),
|
|
201
|
+
/** The tab that handled it. */
|
|
202
|
+
tabId: Schema.optionalKey(TabId),
|
|
203
|
+
})
|
|
204
|
+
/** `acknowledged: false` when another tab acknowledged it first (or there is no such command); `outcome` is the first. */
|
|
205
|
+
export const AppCommandAcknowledgeResult = Schema.Struct({
|
|
206
|
+
acknowledged: Schema.Boolean,
|
|
207
|
+
outcome: Schema.NullOr(AppCommandOutcome),
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
/** A command's state: still pending, or acknowledged with its outcome and detail (an `ask` command's answer). */
|
|
211
|
+
export const AppCommandOutcomeRead = Schema.Struct({
|
|
212
|
+
id: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_-]{1,64}$/)),
|
|
213
|
+
})
|
|
214
|
+
export const AppCommandOutcomeResult = Schema.Struct({
|
|
215
|
+
id: Schema.String,
|
|
216
|
+
state: Schema.Literals(["pending", "acknowledged", "unknown"]),
|
|
217
|
+
outcome: Schema.NullOr(AppCommandOutcome),
|
|
218
|
+
detail: Schema.NullOr(Schema.String),
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
export const ScreenContextContract = defineServiceContract({
|
|
222
|
+
name: "ScreenContext",
|
|
223
|
+
kind: "shell",
|
|
224
|
+
version: "1.1.0",
|
|
225
|
+
description:
|
|
226
|
+
"What the person is looking at (view, focused record, visible and selected records), exposed to their agent " +
|
|
227
|
+
"as references only, under privacy rules: nothing while sharing is off or on a private view; private and " +
|
|
228
|
+
"uninstalled entities withheld; at most maxReferences references (focus, then selection, then visible). " +
|
|
229
|
+
"agent.send takes the snapshot as `screen`; the agent's tools still run under the person's policy. " +
|
|
230
|
+
"Durable state and agent commands (the kernel's appState module): keyed state per person, organisation and tab " +
|
|
231
|
+
"with compare-and-set, and commands for the screen delivered until a tab acknowledges them after handling.",
|
|
232
|
+
operations: {
|
|
233
|
+
update: {
|
|
234
|
+
description: "Report the screen: the view (by id) and the records in focus, visible and selected.",
|
|
235
|
+
input: ScreenState,
|
|
236
|
+
output: Schema.Struct({}),
|
|
237
|
+
errors: Schema.Never,
|
|
238
|
+
},
|
|
239
|
+
snapshot: {
|
|
240
|
+
description:
|
|
241
|
+
"What the agent may see now, after the privacy rules; `null` while sharing is off, on a private view, " +
|
|
242
|
+
"or on a view no installed module declares.",
|
|
243
|
+
input: Schema.Struct({}),
|
|
244
|
+
output: Schema.NullOr(ScreenSnapshot),
|
|
245
|
+
errors: Schema.Never,
|
|
246
|
+
},
|
|
247
|
+
privacy: {
|
|
248
|
+
description: "The privacy rules in force.",
|
|
249
|
+
input: Schema.Struct({}),
|
|
250
|
+
output: ScreenPrivacy,
|
|
251
|
+
errors: Schema.Never,
|
|
252
|
+
},
|
|
253
|
+
setSharing: {
|
|
254
|
+
description: "The person's switch: share the screen with their agent, or not.",
|
|
255
|
+
input: Schema.Struct({ sharing: Schema.Boolean }),
|
|
256
|
+
output: ScreenPrivacy,
|
|
257
|
+
errors: Schema.Never,
|
|
258
|
+
},
|
|
259
|
+
readState: {
|
|
260
|
+
description:
|
|
261
|
+
"`app_state.get`: the person's entries for these keys (a tab's and the shared ones), with their versions.",
|
|
262
|
+
input: AppStateRead,
|
|
263
|
+
output: AppStateReadResult,
|
|
264
|
+
errors: Schema.Never,
|
|
265
|
+
},
|
|
266
|
+
writeState: {
|
|
267
|
+
description:
|
|
268
|
+
"`app_state.write`: set an entry (for a tab, or shared); with `expectedVersion`, only if it is at that version.",
|
|
269
|
+
input: AppStateWrite,
|
|
270
|
+
output: AppStateWriteResult,
|
|
271
|
+
errors: Schema.Never,
|
|
272
|
+
},
|
|
273
|
+
removeState: {
|
|
274
|
+
description: "`app_state.remove`: delete an entry; with `expectedVersion`, only if it is at that version.",
|
|
275
|
+
input: AppStateRemove,
|
|
276
|
+
output: AppStateRemoveResult,
|
|
277
|
+
errors: Schema.Never,
|
|
278
|
+
},
|
|
279
|
+
issueCommand: {
|
|
280
|
+
description:
|
|
281
|
+
"`app_state.issue`: a command for the person's screen (from their agent or a client), once under its id.",
|
|
282
|
+
input: AppCommandIssue,
|
|
283
|
+
output: AppCommandIssueResult,
|
|
284
|
+
errors: Schema.Never,
|
|
285
|
+
},
|
|
286
|
+
pendingCommands: {
|
|
287
|
+
description: "`app_state.pending`: the commands no tab has acknowledged yet, for a tab or any, oldest first.",
|
|
288
|
+
input: AppCommandPending,
|
|
289
|
+
output: AppCommandPendingResult,
|
|
290
|
+
errors: Schema.Never,
|
|
291
|
+
},
|
|
292
|
+
commandOutcome: {
|
|
293
|
+
description:
|
|
294
|
+
"`app_state.outcome`: a command's state, and once acknowledged its outcome and detail (an ask command's answer).",
|
|
295
|
+
input: AppCommandOutcomeRead,
|
|
296
|
+
output: AppCommandOutcomeResult,
|
|
297
|
+
errors: Schema.Never,
|
|
298
|
+
},
|
|
299
|
+
acknowledgeCommand: {
|
|
300
|
+
description:
|
|
301
|
+
"`app_state.acknowledge`: a tab handled the command (done, refused or failed); the first one counts.",
|
|
302
|
+
input: AppCommandAcknowledge,
|
|
303
|
+
output: AppCommandAcknowledgeResult,
|
|
304
|
+
errors: Schema.Never,
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
types: {
|
|
308
|
+
ScreenState,
|
|
309
|
+
ScreenSnapshot,
|
|
310
|
+
ScreenReference,
|
|
311
|
+
ScreenPrivacy,
|
|
312
|
+
AppStateEntry,
|
|
313
|
+
AppCommand,
|
|
314
|
+
PendingAppCommand,
|
|
315
|
+
},
|
|
316
|
+
})
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search: full-text search over the records modules declare searchable, over the files attached to them and over
|
|
3
|
+
* the text Ingestion extracted from them (docs/contracts/search.md). PostgreSQL full-text search (decision: "a
|
|
4
|
+
* Rust index later if relevance demands it"): the kernel keeps the index itself, updated in the same transaction
|
|
5
|
+
* as every write to a searchable table, so it is never stale; ranking, highlighting, per-module and cross-module
|
|
6
|
+
* search. Every hit is filtered by the read policy of the record it belongs to, for the caller, at query time:
|
|
7
|
+
* a hit the caller cannot read is never returned, nor counted.
|
|
8
|
+
*/
|
|
9
|
+
import { Schema } from "effect"
|
|
10
|
+
import { Forbidden, InvalidInput, Unauthenticated } from "../Errors.ts"
|
|
11
|
+
import { defineOperation, defineServiceContract } from "../Service.ts"
|
|
12
|
+
|
|
13
|
+
import { SEARCH_LANGUAGES } from "../SearchLanguages.ts"
|
|
14
|
+
|
|
15
|
+
export { SEARCH_LANGUAGES, type SearchLanguage } from "../SearchLanguages.ts"
|
|
16
|
+
|
|
17
|
+
/** The weight of a searchable field: A ranks highest. */
|
|
18
|
+
export const SearchWeight = Schema.Literals(["A", "B", "C", "D"])
|
|
19
|
+
export type SearchWeight = typeof SearchWeight.Type
|
|
20
|
+
|
|
21
|
+
/** The kernel's search action. */
|
|
22
|
+
export const SEARCH_ACTION = "search.query"
|
|
23
|
+
|
|
24
|
+
/** Longest query, in characters. */
|
|
25
|
+
export const SEARCH_MAX_QUERY = 500
|
|
26
|
+
/** Most hits per page. */
|
|
27
|
+
export const SEARCH_MAX_LIMIT = 50
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* What an entity declares to be searchable (`EntityContract.search`): its string fields with their weights, the
|
|
31
|
+
* field shown as a hit's title (default: the first field weighted A), and the text search configuration (default
|
|
32
|
+
* `simple`: no stemming, any language).
|
|
33
|
+
*/
|
|
34
|
+
export const EntitySearchDeclaration = Schema.Struct({
|
|
35
|
+
fields: Schema.Record(Schema.String, SearchWeight),
|
|
36
|
+
title: Schema.optionalKey(Schema.String),
|
|
37
|
+
language: Schema.optionalKey(Schema.Literals(SEARCH_LANGUAGES)),
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
export const SearchRequest = Schema.Struct({
|
|
41
|
+
/**
|
|
42
|
+
* Web-search syntax: words (all must match, stemmed by the entity's language), `"a phrase"`, `or`, and `-word`
|
|
43
|
+
* to exclude.
|
|
44
|
+
*/
|
|
45
|
+
query: Schema.String.check(Schema.isMaxLength(SEARCH_MAX_QUERY)),
|
|
46
|
+
/** Search only these modules (by name). Default: every module. */
|
|
47
|
+
modules: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
48
|
+
/** Search only these entities (Cedar types, `Archive::Doc`). Default: every entity. */
|
|
49
|
+
entities: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
50
|
+
/** Hits per page, 1 to 50 (default 20). */
|
|
51
|
+
limit: Schema.optionalKey(
|
|
52
|
+
Schema.Number.check(Schema.isInt(), Schema.isBetween({ minimum: 1, maximum: SEARCH_MAX_LIMIT })),
|
|
53
|
+
),
|
|
54
|
+
/**
|
|
55
|
+
* `lexical` matches words (full-text search); `hybrid` also matches meaning, by the embeddings of the index's text
|
|
56
|
+
* (the deployment's embedding model, through ModelProvider), and fuses both rankings. Default: `hybrid` where the
|
|
57
|
+
* deployment configures embeddings, else `lexical` (asking for `hybrid` without them searches lexically).
|
|
58
|
+
*/
|
|
59
|
+
mode: Schema.optionalKey(Schema.Literals(["lexical", "hybrid"])),
|
|
60
|
+
/** The previous page's `nextCursor`. */
|
|
61
|
+
cursor: Schema.optionalKey(Schema.String),
|
|
62
|
+
})
|
|
63
|
+
export type SearchRequest = typeof SearchRequest.Type
|
|
64
|
+
|
|
65
|
+
/** Where in a record a hit matched: its own fields, a file's name, or a chunk of text ingested from it. */
|
|
66
|
+
export const HitSource = Schema.Union([
|
|
67
|
+
Schema.Struct({ kind: Schema.Literal("record") }),
|
|
68
|
+
Schema.Struct({ kind: Schema.Literal("file"), fileId: Schema.String }),
|
|
69
|
+
Schema.Struct({
|
|
70
|
+
kind: Schema.Literal("chunk"),
|
|
71
|
+
/** The ingestion item the text came from, and the file when it came from one. */
|
|
72
|
+
itemId: Schema.String,
|
|
73
|
+
fileId: Schema.NullOr(Schema.String),
|
|
74
|
+
/** The chunk's position (0-based) and its character range in the extracted text. */
|
|
75
|
+
seq: Schema.Number,
|
|
76
|
+
start: Schema.Number,
|
|
77
|
+
end: Schema.Number,
|
|
78
|
+
}),
|
|
79
|
+
])
|
|
80
|
+
export type HitSource = typeof HitSource.Type
|
|
81
|
+
|
|
82
|
+
export const SearchHit = Schema.Struct({
|
|
83
|
+
/** The record: its module, entity (Cedar type) and primary key. */
|
|
84
|
+
module: Schema.String,
|
|
85
|
+
entity: Schema.String,
|
|
86
|
+
id: Schema.String,
|
|
87
|
+
source: HitSource,
|
|
88
|
+
title: Schema.NullOr(Schema.String),
|
|
89
|
+
/** A plain-text excerpt around the matches (never markup). */
|
|
90
|
+
snippet: Schema.String,
|
|
91
|
+
/** The matched words in `snippet`, as `[start, end)` UTF-16 offsets. */
|
|
92
|
+
highlights: Schema.Array(Schema.Tuple([Schema.Number, Schema.Number])),
|
|
93
|
+
/** Higher is better; comparable within one result list. */
|
|
94
|
+
rank: Schema.Number,
|
|
95
|
+
/** What matched in a hybrid search: the words, the meaning, or both (absent in a lexical one). */
|
|
96
|
+
matched: Schema.optionalKey(Schema.Literals(["words", "meaning", "both"])),
|
|
97
|
+
})
|
|
98
|
+
export type SearchHit = typeof SearchHit.Type
|
|
99
|
+
|
|
100
|
+
export const SearchResult = Schema.Struct({
|
|
101
|
+
hits: Schema.Array(SearchHit),
|
|
102
|
+
/**
|
|
103
|
+
* Pass it back for more. Present while more of the index remains to be searched, so a page may hold fewer than
|
|
104
|
+
* `limit` hits (or none) and still have a next one; null at the end.
|
|
105
|
+
*/
|
|
106
|
+
nextCursor: Schema.NullOr(Schema.String),
|
|
107
|
+
})
|
|
108
|
+
export type SearchResult = typeof SearchResult.Type
|
|
109
|
+
|
|
110
|
+
export const SearchContract = defineServiceContract({
|
|
111
|
+
name: "Search",
|
|
112
|
+
kind: "kernel",
|
|
113
|
+
version: "1.1.0",
|
|
114
|
+
description:
|
|
115
|
+
"Full-text search (PostgreSQL), and hybrid search fusing it with semantic matches by embedding, over the records modules declare searchable, the names of the files attached to records, and the text Ingestion extracted, per module or across modules, ranked (field weights, proximity) and highlighted. The index is maintained by the database in the same transaction as every write to a searchable table, rebuilt by setup when a declaration changes, and confined to the caller's organisation; every hit is filtered by the read policy of its record, for the caller, when the query runs, so no hit the caller cannot read is ever returned. One action, search.query, on every surface (typed client, HTTP, MCP, agent tool, CLI).",
|
|
116
|
+
operations: {
|
|
117
|
+
query: defineOperation({
|
|
118
|
+
description:
|
|
119
|
+
"Search, in the organisation the caller acts in. Hits come best first, each with its record, where it matched, a plain-text snippet with highlight offsets, and a rank; follow `nextCursor` for more. Unknown modules or entities are InvalidInput.",
|
|
120
|
+
input: SearchRequest,
|
|
121
|
+
output: SearchResult,
|
|
122
|
+
errors: Schema.Union([Unauthenticated, Forbidden, InvalidInput]),
|
|
123
|
+
}),
|
|
124
|
+
},
|
|
125
|
+
types: { SearchRequest, SearchResult, SearchHit, HitSource, EntitySearchDeclaration, SearchWeight },
|
|
126
|
+
})
|