@eloxiv/testing 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/Admin.d.ts +20 -0
- package/dist/Admin.d.ts.map +1 -0
- package/dist/Admin.js +61 -0
- package/dist/Admin.js.map +1 -0
- package/dist/Agent.d.ts +97 -0
- package/dist/Agent.d.ts.map +1 -0
- package/dist/Agent.js +210 -0
- package/dist/Agent.js.map +1 -0
- package/dist/AgentSurface.d.ts +20 -0
- package/dist/AgentSurface.d.ts.map +1 -0
- package/dist/AgentSurface.js +36 -0
- package/dist/AgentSurface.js.map +1 -0
- package/dist/Embedder.d.ts +21 -0
- package/dist/Embedder.d.ts.map +1 -0
- package/dist/Embedder.js +54 -0
- package/dist/Embedder.js.map +1 -0
- package/dist/EvalMain.d.ts +2 -0
- package/dist/EvalMain.d.ts.map +1 -0
- package/dist/EvalMain.js +80 -0
- package/dist/EvalMain.js.map +1 -0
- package/dist/Evals.d.ts +95 -0
- package/dist/Evals.d.ts.map +1 -0
- package/dist/Evals.js +389 -0
- package/dist/Evals.js.map +1 -0
- package/dist/Kernel.d.ts +88 -0
- package/dist/Kernel.d.ts.map +1 -0
- package/dist/Kernel.js +108 -0
- package/dist/Kernel.js.map +1 -0
- package/dist/Launch.d.ts +86 -0
- package/dist/Launch.d.ts.map +1 -0
- package/dist/Launch.js +370 -0
- package/dist/Launch.js.map +1 -0
- package/dist/Locks.d.ts +39 -0
- package/dist/Locks.d.ts.map +1 -0
- package/dist/Locks.js +94 -0
- package/dist/Locks.js.map +1 -0
- package/dist/Routes.d.ts +19 -0
- package/dist/Routes.d.ts.map +1 -0
- package/dist/Routes.js +38 -0
- package/dist/Routes.js.map +1 -0
- package/dist/ScriptedChatModel.d.ts +51 -0
- package/dist/ScriptedChatModel.d.ts.map +1 -0
- package/dist/ScriptedChatModel.js +135 -0
- package/dist/ScriptedChatModel.js.map +1 -0
- package/dist/SmtpSink.d.ts +36 -0
- package/dist/SmtpSink.d.ts.map +1 -0
- package/dist/SmtpSink.js +185 -0
- package/dist/SmtpSink.js.map +1 -0
- package/dist/System.d.ts +271 -0
- package/dist/System.d.ts.map +1 -0
- package/dist/System.js +905 -0
- package/dist/System.js.map +1 -0
- package/dist/TcpProxy.d.ts +17 -0
- package/dist/TcpProxy.d.ts.map +1 -0
- package/dist/TcpProxy.js +100 -0
- package/dist/TcpProxy.js.map +1 -0
- package/dist/auth/TrustedProxyAuth.d.ts +28 -0
- package/dist/auth/TrustedProxyAuth.d.ts.map +1 -0
- package/dist/auth/TrustedProxyAuth.js +128 -0
- package/dist/auth/TrustedProxyAuth.js.map +1 -0
- package/dist/conformance/ActionConsent.d.ts +3 -0
- package/dist/conformance/ActionConsent.d.ts.map +1 -0
- package/dist/conformance/ActionConsent.js +347 -0
- package/dist/conformance/ActionConsent.js.map +1 -0
- package/dist/conformance/ActionRegistry.d.ts +64 -0
- package/dist/conformance/ActionRegistry.d.ts.map +1 -0
- package/dist/conformance/ActionRegistry.js +136 -0
- package/dist/conformance/ActionRegistry.js.map +1 -0
- package/dist/conformance/Actor.d.ts +43 -0
- package/dist/conformance/Actor.d.ts.map +1 -0
- package/dist/conformance/Actor.js +171 -0
- package/dist/conformance/Actor.js.map +1 -0
- package/dist/conformance/AgentReference.d.ts +30 -0
- package/dist/conformance/AgentReference.d.ts.map +1 -0
- package/dist/conformance/AgentReference.js +137 -0
- package/dist/conformance/AgentReference.js.map +1 -0
- package/dist/conformance/AgentResources.d.ts +3 -0
- package/dist/conformance/AgentResources.d.ts.map +1 -0
- package/dist/conformance/AgentResources.js +454 -0
- package/dist/conformance/AgentResources.js.map +1 -0
- package/dist/conformance/AgentRuntime.d.ts +3 -0
- package/dist/conformance/AgentRuntime.d.ts.map +1 -0
- package/dist/conformance/AgentRuntime.js +302 -0
- package/dist/conformance/AgentRuntime.js.map +1 -0
- package/dist/conformance/AgentSubject.d.ts +87 -0
- package/dist/conformance/AgentSubject.d.ts.map +1 -0
- package/dist/conformance/AgentSubject.js +18 -0
- package/dist/conformance/AgentSubject.js.map +1 -0
- package/dist/conformance/Approvals.d.ts +3 -0
- package/dist/conformance/Approvals.d.ts.map +1 -0
- package/dist/conformance/Approvals.js +258 -0
- package/dist/conformance/Approvals.js.map +1 -0
- package/dist/conformance/Audit.d.ts +3 -0
- package/dist/conformance/Audit.d.ts.map +1 -0
- package/dist/conformance/Audit.js +221 -0
- package/dist/conformance/Audit.js.map +1 -0
- package/dist/conformance/CalendarProvider.d.ts +4 -0
- package/dist/conformance/CalendarProvider.d.ts.map +1 -0
- package/dist/conformance/CalendarProvider.js +108 -0
- package/dist/conformance/CalendarProvider.js.map +1 -0
- package/dist/conformance/CapabilityKit.d.ts +191 -0
- package/dist/conformance/CapabilityKit.d.ts.map +1 -0
- package/dist/conformance/CapabilityKit.js +375 -0
- package/dist/conformance/CapabilityKit.js.map +1 -0
- package/dist/conformance/ClientSDK.d.ts +78 -0
- package/dist/conformance/ClientSDK.d.ts.map +1 -0
- package/dist/conformance/ClientSDK.js +163 -0
- package/dist/conformance/ClientSDK.js.map +1 -0
- package/dist/conformance/CollabDocument.d.ts +3 -0
- package/dist/conformance/CollabDocument.d.ts.map +1 -0
- package/dist/conformance/CollabDocument.js +934 -0
- package/dist/conformance/CollabDocument.js.map +1 -0
- package/dist/conformance/CollabReference.d.ts +8 -0
- package/dist/conformance/CollabReference.d.ts.map +1 -0
- package/dist/conformance/CollabReference.js +138 -0
- package/dist/conformance/CollabReference.js.map +1 -0
- package/dist/conformance/CollabSubject.d.ts +68 -0
- package/dist/conformance/CollabSubject.d.ts.map +1 -0
- package/dist/conformance/CollabSubject.js +2 -0
- package/dist/conformance/CollabSubject.js.map +1 -0
- package/dist/conformance/Command.d.ts +3 -0
- package/dist/conformance/Command.d.ts.map +1 -0
- package/dist/conformance/Command.js +73 -0
- package/dist/conformance/Command.js.map +1 -0
- package/dist/conformance/Connections.d.ts +4 -0
- package/dist/conformance/Connections.d.ts.map +1 -0
- package/dist/conformance/Connections.js +308 -0
- package/dist/conformance/Connections.js.map +1 -0
- package/dist/conformance/ConnectionsReference.d.ts +56 -0
- package/dist/conformance/ConnectionsReference.d.ts.map +1 -0
- package/dist/conformance/ConnectionsReference.js +74 -0
- package/dist/conformance/ConnectionsReference.js.map +1 -0
- package/dist/conformance/ConnectorReference.d.ts +86 -0
- package/dist/conformance/ConnectorReference.d.ts.map +1 -0
- package/dist/conformance/ConnectorReference.js +185 -0
- package/dist/conformance/ConnectorReference.js.map +1 -0
- package/dist/conformance/ContextAccounting.d.ts +8 -0
- package/dist/conformance/ContextAccounting.d.ts.map +1 -0
- package/dist/conformance/ContextAccounting.js +125 -0
- package/dist/conformance/ContextAccounting.js.map +1 -0
- package/dist/conformance/Daemon.d.ts +150 -0
- package/dist/conformance/Daemon.d.ts.map +1 -0
- package/dist/conformance/Daemon.js +718 -0
- package/dist/conformance/Daemon.js.map +1 -0
- package/dist/conformance/DaemonReference.d.ts +15 -0
- package/dist/conformance/DaemonReference.d.ts.map +1 -0
- package/dist/conformance/DaemonReference.js +163 -0
- package/dist/conformance/DaemonReference.js.map +1 -0
- package/dist/conformance/DbTx.d.ts +17 -0
- package/dist/conformance/DbTx.d.ts.map +1 -0
- package/dist/conformance/DbTx.js +184 -0
- package/dist/conformance/DbTx.js.map +1 -0
- package/dist/conformance/DecisionTokens.d.ts +3 -0
- package/dist/conformance/DecisionTokens.d.ts.map +1 -0
- package/dist/conformance/DecisionTokens.js +551 -0
- package/dist/conformance/DecisionTokens.js.map +1 -0
- package/dist/conformance/Delegation.d.ts +3 -0
- package/dist/conformance/Delegation.d.ts.map +1 -0
- package/dist/conformance/Delegation.js +149 -0
- package/dist/conformance/Delegation.js.map +1 -0
- package/dist/conformance/DeskReference.d.ts +21 -0
- package/dist/conformance/DeskReference.d.ts.map +1 -0
- package/dist/conformance/DeskReference.js +47 -0
- package/dist/conformance/DeskReference.js.map +1 -0
- package/dist/conformance/DeviceControl.d.ts +3 -0
- package/dist/conformance/DeviceControl.d.ts.map +1 -0
- package/dist/conformance/DeviceControl.js +579 -0
- package/dist/conformance/DeviceControl.js.map +1 -0
- package/dist/conformance/Directory.d.ts +36 -0
- package/dist/conformance/Directory.d.ts.map +1 -0
- package/dist/conformance/Directory.js +253 -0
- package/dist/conformance/Directory.js.map +1 -0
- package/dist/conformance/DirectoryProvider.d.ts +4 -0
- package/dist/conformance/DirectoryProvider.d.ts.map +1 -0
- package/dist/conformance/DirectoryProvider.js +58 -0
- package/dist/conformance/DirectoryProvider.js.map +1 -0
- package/dist/conformance/DocumentSource.d.ts +4 -0
- package/dist/conformance/DocumentSource.d.ts.map +1 -0
- package/dist/conformance/DocumentSource.js +43 -0
- package/dist/conformance/DocumentSource.js.map +1 -0
- package/dist/conformance/EndpointReference.d.ts +40 -0
- package/dist/conformance/EndpointReference.d.ts.map +1 -0
- package/dist/conformance/EndpointReference.js +67 -0
- package/dist/conformance/EndpointReference.js.map +1 -0
- package/dist/conformance/Files.d.ts +40 -0
- package/dist/conformance/Files.d.ts.map +1 -0
- package/dist/conformance/Files.js +592 -0
- package/dist/conformance/Files.js.map +1 -0
- package/dist/conformance/FilesReference.d.ts +31 -0
- package/dist/conformance/FilesReference.d.ts.map +1 -0
- package/dist/conformance/FilesReference.js +116 -0
- package/dist/conformance/FilesReference.js.map +1 -0
- package/dist/conformance/FilesSubject.d.ts +46 -0
- package/dist/conformance/FilesSubject.d.ts.map +1 -0
- package/dist/conformance/FilesSubject.js +3 -0
- package/dist/conformance/FilesSubject.js.map +1 -0
- package/dist/conformance/Flags.d.ts +3 -0
- package/dist/conformance/Flags.d.ts.map +1 -0
- package/dist/conformance/Flags.js +183 -0
- package/dist/conformance/Flags.js.map +1 -0
- package/dist/conformance/Host.d.ts +64 -0
- package/dist/conformance/Host.d.ts.map +1 -0
- package/dist/conformance/Host.js +152 -0
- package/dist/conformance/Host.js.map +1 -0
- package/dist/conformance/HttpApi.d.ts +5 -0
- package/dist/conformance/HttpApi.d.ts.map +1 -0
- package/dist/conformance/HttpApi.js +131 -0
- package/dist/conformance/HttpApi.js.map +1 -0
- package/dist/conformance/InboxReference.d.ts +28 -0
- package/dist/conformance/InboxReference.d.ts.map +1 -0
- package/dist/conformance/InboxReference.js +331 -0
- package/dist/conformance/InboxReference.js.map +1 -0
- package/dist/conformance/InboxSubject.d.ts +92 -0
- package/dist/conformance/InboxSubject.d.ts.map +1 -0
- package/dist/conformance/InboxSubject.js +16 -0
- package/dist/conformance/InboxSubject.js.map +1 -0
- package/dist/conformance/Ingestion.d.ts +10 -0
- package/dist/conformance/Ingestion.d.ts.map +1 -0
- package/dist/conformance/Ingestion.js +335 -0
- package/dist/conformance/Ingestion.js.map +1 -0
- package/dist/conformance/Ingress.d.ts +62 -0
- package/dist/conformance/Ingress.d.ts.map +1 -0
- package/dist/conformance/Ingress.js +346 -0
- package/dist/conformance/Ingress.js.map +1 -0
- package/dist/conformance/Invocation.d.ts +3 -0
- package/dist/conformance/Invocation.d.ts.map +1 -0
- package/dist/conformance/Invocation.js +665 -0
- package/dist/conformance/Invocation.js.map +1 -0
- package/dist/conformance/IsolationMatrix.d.ts +60 -0
- package/dist/conformance/IsolationMatrix.d.ts.map +1 -0
- package/dist/conformance/IsolationMatrix.js +196 -0
- package/dist/conformance/IsolationMatrix.js.map +1 -0
- package/dist/conformance/LiveConnection.d.ts +72 -0
- package/dist/conformance/LiveConnection.d.ts.map +1 -0
- package/dist/conformance/LiveConnection.js +125 -0
- package/dist/conformance/LiveConnection.js.map +1 -0
- package/dist/conformance/LocalClient.d.ts +62 -0
- package/dist/conformance/LocalClient.d.ts.map +1 -0
- package/dist/conformance/LocalClient.js +526 -0
- package/dist/conformance/LocalClient.js.map +1 -0
- package/dist/conformance/Locale.d.ts +28 -0
- package/dist/conformance/Locale.d.ts.map +1 -0
- package/dist/conformance/Locale.js +115 -0
- package/dist/conformance/Locale.js.map +1 -0
- package/dist/conformance/MachineIdentity.d.ts +39 -0
- package/dist/conformance/MachineIdentity.d.ts.map +1 -0
- package/dist/conformance/MachineIdentity.js +595 -0
- package/dist/conformance/MachineIdentity.js.map +1 -0
- package/dist/conformance/MailProvider.d.ts +4 -0
- package/dist/conformance/MailProvider.d.ts.map +1 -0
- package/dist/conformance/MailProvider.js +167 -0
- package/dist/conformance/MailProvider.js.map +1 -0
- package/dist/conformance/Memory.d.ts +10 -0
- package/dist/conformance/Memory.d.ts.map +1 -0
- package/dist/conformance/Memory.js +179 -0
- package/dist/conformance/Memory.js.map +1 -0
- package/dist/conformance/Messaging.d.ts +49 -0
- package/dist/conformance/Messaging.d.ts.map +1 -0
- package/dist/conformance/Messaging.js +117 -0
- package/dist/conformance/Messaging.js.map +1 -0
- package/dist/conformance/Metering.d.ts +26 -0
- package/dist/conformance/Metering.d.ts.map +1 -0
- package/dist/conformance/Metering.js +236 -0
- package/dist/conformance/Metering.js.map +1 -0
- package/dist/conformance/ModelProvider.d.ts +32 -0
- package/dist/conformance/ModelProvider.d.ts.map +1 -0
- package/dist/conformance/ModelProvider.js +100 -0
- package/dist/conformance/ModelProvider.js.map +1 -0
- package/dist/conformance/ModuleManifest.d.ts +9 -0
- package/dist/conformance/ModuleManifest.d.ts.map +1 -0
- package/dist/conformance/ModuleManifest.js +542 -0
- package/dist/conformance/ModuleManifest.js.map +1 -0
- package/dist/conformance/NotebookAgent.d.ts +32 -0
- package/dist/conformance/NotebookAgent.d.ts.map +1 -0
- package/dist/conformance/NotebookAgent.js +31 -0
- package/dist/conformance/NotebookAgent.js.map +1 -0
- package/dist/conformance/NotificationChannel.d.ts +40 -0
- package/dist/conformance/NotificationChannel.d.ts.map +1 -0
- package/dist/conformance/NotificationChannel.js +78 -0
- package/dist/conformance/NotificationChannel.js.map +1 -0
- package/dist/conformance/Notifications.d.ts +3 -0
- package/dist/conformance/Notifications.d.ts.map +1 -0
- package/dist/conformance/Notifications.js +240 -0
- package/dist/conformance/Notifications.js.map +1 -0
- package/dist/conformance/OAuthClient.d.ts +123 -0
- package/dist/conformance/OAuthClient.d.ts.map +1 -0
- package/dist/conformance/OAuthClient.js +204 -0
- package/dist/conformance/OAuthClient.js.map +1 -0
- package/dist/conformance/Outbox.d.ts +3 -0
- package/dist/conformance/Outbox.d.ts.map +1 -0
- package/dist/conformance/Outbox.js +266 -0
- package/dist/conformance/Outbox.js.map +1 -0
- package/dist/conformance/PlatformReference.d.ts +5 -0
- package/dist/conformance/PlatformReference.d.ts.map +1 -0
- package/dist/conformance/PlatformReference.js +66 -0
- package/dist/conformance/PlatformReference.js.map +1 -0
- package/dist/conformance/PlatformSubject.d.ts +45 -0
- package/dist/conformance/PlatformSubject.d.ts.map +1 -0
- package/dist/conformance/PlatformSubject.js +3 -0
- package/dist/conformance/PlatformSubject.js.map +1 -0
- package/dist/conformance/Privacy.d.ts +3 -0
- package/dist/conformance/Privacy.d.ts.map +1 -0
- package/dist/conformance/Privacy.js +437 -0
- package/dist/conformance/Privacy.js.map +1 -0
- package/dist/conformance/Progress.d.ts +3 -0
- package/dist/conformance/Progress.d.ts.map +1 -0
- package/dist/conformance/Progress.js +153 -0
- package/dist/conformance/Progress.js.map +1 -0
- package/dist/conformance/Push.d.ts +38 -0
- package/dist/conformance/Push.d.ts.map +1 -0
- package/dist/conformance/Push.js +649 -0
- package/dist/conformance/Push.js.map +1 -0
- package/dist/conformance/PushReference.d.ts +3 -0
- package/dist/conformance/PushReference.d.ts.map +1 -0
- package/dist/conformance/PushReference.js +97 -0
- package/dist/conformance/PushReference.js.map +1 -0
- package/dist/conformance/QuerySurface.d.ts +9 -0
- package/dist/conformance/QuerySurface.d.ts.map +1 -0
- package/dist/conformance/QuerySurface.js +349 -0
- package/dist/conformance/QuerySurface.js.map +1 -0
- package/dist/conformance/Readiness.d.ts +23 -0
- package/dist/conformance/Readiness.d.ts.map +1 -0
- package/dist/conformance/Readiness.js +110 -0
- package/dist/conformance/Readiness.js.map +1 -0
- package/dist/conformance/Reference.d.ts +17 -0
- package/dist/conformance/Reference.d.ts.map +1 -0
- package/dist/conformance/Reference.js +246 -0
- package/dist/conformance/Reference.js.map +1 -0
- package/dist/conformance/Release.d.ts +73 -0
- package/dist/conformance/Release.d.ts.map +1 -0
- package/dist/conformance/Release.js +556 -0
- package/dist/conformance/Release.js.map +1 -0
- package/dist/conformance/ReleaseReference.d.ts +5 -0
- package/dist/conformance/ReleaseReference.d.ts.map +1 -0
- package/dist/conformance/ReleaseReference.js +124 -0
- package/dist/conformance/ReleaseReference.js.map +1 -0
- package/dist/conformance/ResultRendering.d.ts +3 -0
- package/dist/conformance/ResultRendering.d.ts.map +1 -0
- package/dist/conformance/ResultRendering.js +120 -0
- package/dist/conformance/ResultRendering.js.map +1 -0
- package/dist/conformance/Sandbox.d.ts +58 -0
- package/dist/conformance/Sandbox.d.ts.map +1 -0
- package/dist/conformance/Sandbox.js +213 -0
- package/dist/conformance/Sandbox.js.map +1 -0
- package/dist/conformance/SandboxReference.d.ts +3 -0
- package/dist/conformance/SandboxReference.d.ts.map +1 -0
- package/dist/conformance/SandboxReference.js +44 -0
- package/dist/conformance/SandboxReference.js.map +1 -0
- package/dist/conformance/Scheduler.d.ts +106 -0
- package/dist/conformance/Scheduler.d.ts.map +1 -0
- package/dist/conformance/Scheduler.js +576 -0
- package/dist/conformance/Scheduler.js.map +1 -0
- package/dist/conformance/ScreenContext.d.ts +84 -0
- package/dist/conformance/ScreenContext.d.ts.map +1 -0
- package/dist/conformance/ScreenContext.js +290 -0
- package/dist/conformance/ScreenContext.js.map +1 -0
- package/dist/conformance/Search.d.ts +3 -0
- package/dist/conformance/Search.d.ts.map +1 -0
- package/dist/conformance/Search.js +333 -0
- package/dist/conformance/Search.js.map +1 -0
- package/dist/conformance/Secrets.d.ts +8 -0
- package/dist/conformance/Secrets.d.ts.map +1 -0
- package/dist/conformance/Secrets.js +231 -0
- package/dist/conformance/Secrets.js.map +1 -0
- package/dist/conformance/SecretsReference.d.ts +44 -0
- package/dist/conformance/SecretsReference.d.ts.map +1 -0
- package/dist/conformance/SecretsReference.js +73 -0
- package/dist/conformance/SecretsReference.js.map +1 -0
- package/dist/conformance/ServicesReference.d.ts +8 -0
- package/dist/conformance/ServicesReference.d.ts.map +1 -0
- package/dist/conformance/ServicesReference.js +273 -0
- package/dist/conformance/ServicesReference.js.map +1 -0
- package/dist/conformance/ServicesSubject.d.ts +104 -0
- package/dist/conformance/ServicesSubject.d.ts.map +1 -0
- package/dist/conformance/ServicesSubject.js +2 -0
- package/dist/conformance/ServicesSubject.js.map +1 -0
- package/dist/conformance/Settings.d.ts +3 -0
- package/dist/conformance/Settings.d.ts.map +1 -0
- package/dist/conformance/Settings.js +177 -0
- package/dist/conformance/Settings.js.map +1 -0
- package/dist/conformance/Sharing.d.ts +3 -0
- package/dist/conformance/Sharing.d.ts.map +1 -0
- package/dist/conformance/Sharing.js +368 -0
- package/dist/conformance/Sharing.js.map +1 -0
- package/dist/conformance/ShellSubject.d.ts +29 -0
- package/dist/conformance/ShellSubject.d.ts.map +1 -0
- package/dist/conformance/ShellSubject.js +13 -0
- package/dist/conformance/ShellSubject.js.map +1 -0
- package/dist/conformance/SignOutRace.d.ts +23 -0
- package/dist/conformance/SignOutRace.d.ts.map +1 -0
- package/dist/conformance/SignOutRace.js +49 -0
- package/dist/conformance/SignOutRace.js.map +1 -0
- package/dist/conformance/Slot.d.ts +3 -0
- package/dist/conformance/Slot.d.ts.map +1 -0
- package/dist/conformance/Slot.js +79 -0
- package/dist/conformance/Slot.js.map +1 -0
- package/dist/conformance/Space.d.ts +63 -0
- package/dist/conformance/Space.d.ts.map +1 -0
- package/dist/conformance/Space.js +294 -0
- package/dist/conformance/Space.js.map +1 -0
- package/dist/conformance/StorageAdapter.d.ts +76 -0
- package/dist/conformance/StorageAdapter.d.ts.map +1 -0
- package/dist/conformance/StorageAdapter.js +181 -0
- package/dist/conformance/StorageAdapter.js.map +1 -0
- package/dist/conformance/StorageBackend.d.ts +23 -0
- package/dist/conformance/StorageBackend.d.ts.map +1 -0
- package/dist/conformance/StorageBackend.js +274 -0
- package/dist/conformance/StorageBackend.js.map +1 -0
- package/dist/conformance/Subject.d.ts +198 -0
- package/dist/conformance/Subject.d.ts.map +1 -0
- package/dist/conformance/Subject.js +26 -0
- package/dist/conformance/Subject.js.map +1 -0
- package/dist/conformance/Sync.d.ts +3 -0
- package/dist/conformance/Sync.d.ts.map +1 -0
- package/dist/conformance/Sync.js +190 -0
- package/dist/conformance/Sync.js.map +1 -0
- package/dist/conformance/Telemetry.d.ts +3 -0
- package/dist/conformance/Telemetry.d.ts.map +1 -0
- package/dist/conformance/Telemetry.js +218 -0
- package/dist/conformance/Telemetry.js.map +1 -0
- package/dist/conformance/ThemeTokens.d.ts +22 -0
- package/dist/conformance/ThemeTokens.d.ts.map +1 -0
- package/dist/conformance/ThemeTokens.js +121 -0
- package/dist/conformance/ThemeTokens.js.map +1 -0
- package/dist/conformance/ToolSource.d.ts +5 -0
- package/dist/conformance/ToolSource.d.ts.map +1 -0
- package/dist/conformance/ToolSource.js +520 -0
- package/dist/conformance/ToolSource.js.map +1 -0
- package/dist/conformance/Versioning.d.ts +3 -0
- package/dist/conformance/Versioning.d.ts.map +1 -0
- package/dist/conformance/Versioning.js +160 -0
- package/dist/conformance/Versioning.js.map +1 -0
- package/dist/conformance/View.d.ts +3 -0
- package/dist/conformance/View.d.ts.map +1 -0
- package/dist/conformance/View.js +121 -0
- package/dist/conformance/View.js.map +1 -0
- package/dist/conformance/WorkItems.d.ts +3 -0
- package/dist/conformance/WorkItems.d.ts.map +1 -0
- package/dist/conformance/WorkItems.js +152 -0
- package/dist/conformance/WorkItems.js.map +1 -0
- package/dist/conformance/Workflow.d.ts +63 -0
- package/dist/conformance/Workflow.d.ts.map +1 -0
- package/dist/conformance/Workflow.js +235 -0
- package/dist/conformance/Workflow.js.map +1 -0
- package/dist/conformance/acme/chatlog.d.ts +591 -0
- package/dist/conformance/acme/chatlog.d.ts.map +1 -0
- package/dist/conformance/acme/chatlog.js +101 -0
- package/dist/conformance/acme/chatlog.js.map +1 -0
- package/dist/conformance/acme/connector.d.ts +12 -0
- package/dist/conformance/acme/connector.d.ts.map +1 -0
- package/dist/conformance/acme/connector.js +123 -0
- package/dist/conformance/acme/connector.js.map +1 -0
- package/dist/conformance/acme/migrations/0000_messages.sql +8 -0
- package/dist/conformance/archive/app.d.ts +728 -0
- package/dist/conformance/archive/app.d.ts.map +1 -0
- package/dist/conformance/archive/app.js +30 -0
- package/dist/conformance/archive/app.js.map +1 -0
- package/dist/conformance/archive/contract.d.ts +467 -0
- package/dist/conformance/archive/contract.d.ts.map +1 -0
- package/dist/conformance/archive/contract.js +187 -0
- package/dist/conformance/archive/contract.js.map +1 -0
- package/dist/conformance/archive/memo.sync.gen.d.ts +148 -0
- package/dist/conformance/archive/memo.sync.gen.d.ts.map +1 -0
- package/dist/conformance/archive/memo.sync.gen.js +23 -0
- package/dist/conformance/archive/memo.sync.gen.js.map +1 -0
- package/dist/conformance/archive/migrations/archive/0000_archive.sql +9 -0
- package/dist/conformance/archive/migrations/memo/0000_memo.sql +6 -0
- package/dist/conformance/archive/schema.d.ts +185 -0
- package/dist/conformance/archive/schema.d.ts.map +1 -0
- package/dist/conformance/archive/schema.js +22 -0
- package/dist/conformance/archive/schema.js.map +1 -0
- package/dist/conformance/archive/server.d.ts +273 -0
- package/dist/conformance/archive/server.d.ts.map +1 -0
- package/dist/conformance/archive/server.js +127 -0
- package/dist/conformance/archive/server.js.map +1 -0
- package/dist/conformance/archive/sync.gen.d.ts +319 -0
- package/dist/conformance/archive/sync.gen.d.ts.map +1 -0
- package/dist/conformance/archive/sync.gen.js +29 -0
- package/dist/conformance/archive/sync.gen.js.map +1 -0
- package/dist/conformance/atlas/app.d.ts +3 -0
- package/dist/conformance/atlas/app.d.ts.map +1 -0
- package/dist/conformance/atlas/app.js +15 -0
- package/dist/conformance/atlas/app.js.map +1 -0
- package/dist/conformance/atlas/contract.d.ts +489 -0
- package/dist/conformance/atlas/contract.d.ts.map +1 -0
- package/dist/conformance/atlas/contract.js +114 -0
- package/dist/conformance/atlas/contract.js.map +1 -0
- package/dist/conformance/crm/app.d.ts +304 -0
- package/dist/conformance/crm/app.d.ts.map +1 -0
- package/dist/conformance/crm/app.js +95 -0
- package/dist/conformance/crm/app.js.map +1 -0
- package/dist/conformance/crm/contract.d.ts +586 -0
- package/dist/conformance/crm/contract.d.ts.map +1 -0
- package/dist/conformance/crm/contract.js +153 -0
- package/dist/conformance/crm/contract.js.map +1 -0
- package/dist/conformance/crm/migrations/crm/0000_crm.sql +18 -0
- package/dist/conformance/crm/migrations/team/0000_team.sql +6 -0
- package/dist/conformance/crm/schema.d.ts +261 -0
- package/dist/conformance/crm/schema.d.ts.map +1 -0
- package/dist/conformance/crm/schema.js +25 -0
- package/dist/conformance/crm/schema.js.map +1 -0
- package/dist/conformance/crm/sync.gen.d.ts +188 -0
- package/dist/conformance/crm/sync.gen.d.ts.map +1 -0
- package/dist/conformance/crm/sync.gen.js +25 -0
- package/dist/conformance/crm/sync.gen.js.map +1 -0
- package/dist/conformance/desk/contract.d.ts +306 -0
- package/dist/conformance/desk/contract.d.ts.map +1 -0
- package/dist/conformance/desk/contract.js +56 -0
- package/dist/conformance/desk/contract.js.map +1 -0
- package/dist/conformance/desk/migrations/0000_notes.sql +7 -0
- package/dist/conformance/desk/server.d.ts +231 -0
- package/dist/conformance/desk/server.d.ts.map +1 -0
- package/dist/conformance/desk/server.js +123 -0
- package/dist/conformance/desk/server.js.map +1 -0
- package/dist/conformance/drafts/migrations/0000_drafts.sql +8 -0
- package/dist/conformance/drafts/module.d.ts +571 -0
- package/dist/conformance/drafts/module.d.ts.map +1 -0
- package/dist/conformance/drafts/module.js +190 -0
- package/dist/conformance/drafts/module.js.map +1 -0
- package/dist/conformance/fixture/app.d.ts +24 -0
- package/dist/conformance/fixture/app.d.ts.map +1 -0
- package/dist/conformance/fixture/app.js +26 -0
- package/dist/conformance/fixture/app.js.map +1 -0
- package/dist/conformance/fixture/docs/bad-sync.d.ts +105 -0
- package/dist/conformance/fixture/docs/bad-sync.d.ts.map +1 -0
- package/dist/conformance/fixture/docs/bad-sync.js +22 -0
- package/dist/conformance/fixture/docs/bad-sync.js.map +1 -0
- package/dist/conformance/fixture/docs/contract.d.ts +1091 -0
- package/dist/conformance/fixture/docs/contract.d.ts.map +1 -0
- package/dist/conformance/fixture/docs/contract.js +277 -0
- package/dist/conformance/fixture/docs/contract.js.map +1 -0
- package/dist/conformance/fixture/docs/migrations/0000_docs.sql +9 -0
- package/dist/conformance/fixture/docs/migrations/0001_seen.sql +12 -0
- package/dist/conformance/fixture/docs/migrations/0002_attachment.sql +6 -0
- package/dist/conformance/fixture/docs/policy.cedar +110 -0
- package/dist/conformance/fixture/docs/schema.d.ts +308 -0
- package/dist/conformance/fixture/docs/schema.d.ts.map +1 -0
- package/dist/conformance/fixture/docs/schema.js +36 -0
- package/dist/conformance/fixture/docs/schema.js.map +1 -0
- package/dist/conformance/fixture/docs/server.d.ts +552 -0
- package/dist/conformance/fixture/docs/server.d.ts.map +1 -0
- package/dist/conformance/fixture/docs/server.js +192 -0
- package/dist/conformance/fixture/docs/server.js.map +1 -0
- package/dist/conformance/fixture/docs/sync.d.ts +402 -0
- package/dist/conformance/fixture/docs/sync.d.ts.map +1 -0
- package/dist/conformance/fixture/docs/sync.gen.d.ts +574 -0
- package/dist/conformance/fixture/docs/sync.gen.d.ts.map +1 -0
- package/dist/conformance/fixture/docs/sync.gen.js +48 -0
- package/dist/conformance/fixture/docs/sync.gen.js.map +1 -0
- package/dist/conformance/fixture/docs/sync.js +23 -0
- package/dist/conformance/fixture/docs/sync.js.map +1 -0
- package/dist/conformance/fixture/peer/migrations/0000_peer.sql +8 -0
- package/dist/conformance/fixture/peer/module.d.ts +306 -0
- package/dist/conformance/fixture/peer/module.d.ts.map +1 -0
- package/dist/conformance/fixture/peer/module.js +44 -0
- package/dist/conformance/fixture/peer/module.js.map +1 -0
- package/dist/conformance/fixture/release/blocking/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/blocking/0001_wait.sql +2 -0
- package/dist/conformance/fixture/release/blocking-renamed/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/blocking-renamed/0001_wait.sql +5 -0
- package/dist/conformance/fixture/release/broken/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/broken/0001_extra.sql +3 -0
- package/dist/conformance/fixture/release/broken/0002_label.sql +3 -0
- package/dist/conformance/fixture/release/drift/escalate/0000_item.sql +5 -0
- package/dist/conformance/fixture/release/drift/escalate/0001_escalate.sql +8 -0
- package/dist/conformance/fixture/release/drift/v1/0000_item.sql +5 -0
- package/dist/conformance/fixture/release/escape/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/escape/0001_escape.sql +5 -0
- package/dist/conformance/fixture/release/misnamed/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/misnamed/0001_misname.sql +10 -0
- package/dist/conformance/fixture/release/module.d.ts +1878 -0
- package/dist/conformance/fixture/release/module.d.ts.map +1 -0
- package/dist/conformance/fixture/release/module.js +102 -0
- package/dist/conformance/fixture/release/module.js.map +1 -0
- package/dist/conformance/fixture/release/outside/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/outside/0001_extra.sql +3 -0
- package/dist/conformance/fixture/release/outside/0002_index.sql +4 -0
- package/dist/conformance/fixture/release/outside/0003_later.sql +1 -0
- package/dist/conformance/fixture/release/renamed/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/renamed/0001_misname.sql +10 -0
- package/dist/conformance/fixture/release/renamed/0002_restore.sql +1 -0
- package/dist/conformance/fixture/release/rogue/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/rogue/0001_extra.sql +3 -0
- package/dist/conformance/fixture/release/rogue/0002_definer.sql +1 -0
- package/dist/conformance/fixture/release/slow/0000_item.sql +5 -0
- package/dist/conformance/fixture/release/undeclared/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/undeclared/0001_extra.sql +3 -0
- package/dist/conformance/fixture/release/undeclared/0002_index.sql +1 -0
- package/dist/conformance/fixture/release/v1/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/v2/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/v2/0001_extra.sql +3 -0
- package/dist/conformance/fixture/release/v2/0002_label.sql +3 -0
- package/dist/conformance/fixture/release/viewed-retyped/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/viewed-retyped/0001_retype.sql +1 -0
- package/dist/conformance/kit-hash.d.ts +8 -0
- package/dist/conformance/kit-hash.d.ts.map +1 -0
- package/dist/conformance/kit-hash.js +20 -0
- package/dist/conformance/kit-hash.js.map +1 -0
- package/dist/conformance/ledger/contract.d.ts +380 -0
- package/dist/conformance/ledger/contract.d.ts.map +1 -0
- package/dist/conformance/ledger/contract.js +81 -0
- package/dist/conformance/ledger/contract.js.map +1 -0
- package/dist/conformance/ledger/migrations/0000_entries.sql +8 -0
- package/dist/conformance/ledger/server.d.ts +312 -0
- package/dist/conformance/ledger/server.d.ts.map +1 -0
- package/dist/conformance/ledger/server.js +152 -0
- package/dist/conformance/ledger/server.js.map +1 -0
- package/dist/conformance/library/app.d.ts +616 -0
- package/dist/conformance/library/app.d.ts.map +1 -0
- package/dist/conformance/library/app.js +35 -0
- package/dist/conformance/library/app.js.map +1 -0
- package/dist/conformance/library/contract.d.ts +377 -0
- package/dist/conformance/library/contract.d.ts.map +1 -0
- package/dist/conformance/library/contract.js +63 -0
- package/dist/conformance/library/contract.js.map +1 -0
- package/dist/conformance/library/migrations/0000_library.sql +14 -0
- package/dist/conformance/library/schema.d.ts +174 -0
- package/dist/conformance/library/schema.d.ts.map +1 -0
- package/dist/conformance/library/schema.js +24 -0
- package/dist/conformance/library/schema.js.map +1 -0
- package/dist/conformance/library/server.d.ts +191 -0
- package/dist/conformance/library/server.d.ts.map +1 -0
- package/dist/conformance/library/server.js +52 -0
- package/dist/conformance/library/server.js.map +1 -0
- package/dist/conformance/library/sync.gen.d.ts +519 -0
- package/dist/conformance/library/sync.gen.d.ts.map +1 -0
- package/dist/conformance/library/sync.gen.js +42 -0
- package/dist/conformance/library/sync.gen.js.map +1 -0
- package/dist/conformance/locale/catalog.d.ts +93 -0
- package/dist/conformance/locale/catalog.d.ts.map +1 -0
- package/dist/conformance/locale/catalog.js +104 -0
- package/dist/conformance/locale/catalog.js.map +1 -0
- package/dist/conformance/notebook/app.d.ts +1039 -0
- package/dist/conformance/notebook/app.d.ts.map +1 -0
- package/dist/conformance/notebook/app.js +88 -0
- package/dist/conformance/notebook/app.js.map +1 -0
- package/dist/conformance/notebook/evals/pages.evals.json +94 -0
- package/dist/conformance/notebook/migrations/0000_notebook.sql +10 -0
- package/dist/conformance/notebook/module.d.ts +717 -0
- package/dist/conformance/notebook/module.d.ts.map +1 -0
- package/dist/conformance/notebook/module.js +188 -0
- package/dist/conformance/notebook/module.js.map +1 -0
- package/dist/conformance/pad/app.d.ts +9 -0
- package/dist/conformance/pad/app.d.ts.map +1 -0
- package/dist/conformance/pad/app.js +13 -0
- package/dist/conformance/pad/app.js.map +1 -0
- package/dist/conformance/pad/contract.d.ts +281 -0
- package/dist/conformance/pad/contract.d.ts.map +1 -0
- package/dist/conformance/pad/contract.js +66 -0
- package/dist/conformance/pad/contract.js.map +1 -0
- package/dist/conformance/pad/migrations/pad/0000_pad.sql +8 -0
- package/dist/conformance/pad/migrations/pad/0001_live_copy.sql +2 -0
- package/dist/conformance/pad/schema.d.ts +127 -0
- package/dist/conformance/pad/schema.d.ts.map +1 -0
- package/dist/conformance/pad/schema.js +17 -0
- package/dist/conformance/pad/schema.js.map +1 -0
- package/dist/conformance/pad/server.d.ts +149 -0
- package/dist/conformance/pad/server.d.ts.map +1 -0
- package/dist/conformance/pad/server.js +81 -0
- package/dist/conformance/pad/server.js.map +1 -0
- package/dist/conformance/purchases/app.d.ts +480 -0
- package/dist/conformance/purchases/app.d.ts.map +1 -0
- package/dist/conformance/purchases/app.js +32 -0
- package/dist/conformance/purchases/app.js.map +1 -0
- package/dist/conformance/purchases/contract.d.ts +720 -0
- package/dist/conformance/purchases/contract.d.ts.map +1 -0
- package/dist/conformance/purchases/contract.js +148 -0
- package/dist/conformance/purchases/contract.js.map +1 -0
- package/dist/conformance/purchases/migrations/0000_purchases.sql +17 -0
- package/dist/conformance/purchases/server.d.ts +250 -0
- package/dist/conformance/purchases/server.d.ts.map +1 -0
- package/dist/conformance/purchases/server.js +85 -0
- package/dist/conformance/purchases/server.js.map +1 -0
- package/dist/conformance/studio/app.d.ts +996 -0
- package/dist/conformance/studio/app.d.ts.map +1 -0
- package/dist/conformance/studio/app.js +251 -0
- package/dist/conformance/studio/app.js.map +1 -0
- package/dist/conformance/studio/contract.d.ts +1318 -0
- package/dist/conformance/studio/contract.d.ts.map +1 -0
- package/dist/conformance/studio/contract.js +280 -0
- package/dist/conformance/studio/contract.js.map +1 -0
- package/dist/conformance/studio/migrations/billing/0000_billing.sql +6 -0
- package/dist/conformance/studio/migrations/journal/0000_journal.sql +9 -0
- package/dist/conformance/studio/migrations/mailbox/0000_mailbox.sql +7 -0
- package/dist/conformance/studio/migrations/tasks/0000_tasks.sql +7 -0
- package/dist/conformance/workshop/app.d.ts +8 -0
- package/dist/conformance/workshop/app.d.ts.map +1 -0
- package/dist/conformance/workshop/app.js +13 -0
- package/dist/conformance/workshop/app.js.map +1 -0
- package/dist/conformance/workshop/migrations/0000_notes.sql +7 -0
- package/dist/conformance/workshop/module.d.ts +407 -0
- package/dist/conformance/workshop/module.d.ts.map +1 -0
- package/dist/conformance/workshop/module.js +71 -0
- package/dist/conformance/workshop/module.js.map +1 -0
- package/dist/fakes/AcmeFake.d.ts +46 -0
- package/dist/fakes/AcmeFake.d.ts.map +1 -0
- package/dist/fakes/AcmeFake.js +131 -0
- package/dist/fakes/AcmeFake.js.map +1 -0
- package/dist/fakes/ApnsFake.d.ts +79 -0
- package/dist/fakes/ApnsFake.d.ts.map +1 -0
- package/dist/fakes/ApnsFake.js +220 -0
- package/dist/fakes/ApnsFake.js.map +1 -0
- package/dist/fakes/FcmFake.d.ts +46 -0
- package/dist/fakes/FcmFake.d.ts.map +1 -0
- package/dist/fakes/FcmFake.js +185 -0
- package/dist/fakes/FcmFake.js.map +1 -0
- package/dist/fakes/GoogleFake.d.ts +221 -0
- package/dist/fakes/GoogleFake.d.ts.map +1 -0
- package/dist/fakes/GoogleFake.js +1035 -0
- package/dist/fakes/GoogleFake.js.map +1 -0
- package/dist/fakes/HttpApiFake.d.ts +22 -0
- package/dist/fakes/HttpApiFake.d.ts.map +1 -0
- package/dist/fakes/HttpApiFake.js +74 -0
- package/dist/fakes/HttpApiFake.js.map +1 -0
- package/dist/fakes/McpFake.d.ts +80 -0
- package/dist/fakes/McpFake.d.ts.map +1 -0
- package/dist/fakes/McpFake.js +312 -0
- package/dist/fakes/McpFake.js.map +1 -0
- package/dist/fakes/MicrosoftGraphFake.d.ts +254 -0
- package/dist/fakes/MicrosoftGraphFake.d.ts.map +1 -0
- package/dist/fakes/MicrosoftGraphFake.js +850 -0
- package/dist/fakes/MicrosoftGraphFake.js.map +1 -0
- package/dist/fakes/S3Fake.d.ts +29 -0
- package/dist/fakes/S3Fake.d.ts.map +1 -0
- package/dist/fakes/S3Fake.js +347 -0
- package/dist/fakes/S3Fake.js.map +1 -0
- package/dist/fakes/Server.d.ts +137 -0
- package/dist/fakes/Server.d.ts.map +1 -0
- package/dist/fakes/Server.js +357 -0
- package/dist/fakes/Server.js.map +1 -0
- package/dist/fakes/SignInProviderFake.d.ts +21 -0
- package/dist/fakes/SignInProviderFake.d.ts.map +1 -0
- package/dist/fakes/SignInProviderFake.js +56 -0
- package/dist/fakes/SignInProviderFake.js.map +1 -0
- package/dist/fakes/SlackFake.d.ts +136 -0
- package/dist/fakes/SlackFake.d.ts.map +1 -0
- package/dist/fakes/SlackFake.js +787 -0
- package/dist/fakes/SlackFake.js.map +1 -0
- package/dist/fakes/Store.d.ts +40 -0
- package/dist/fakes/Store.d.ts.map +1 -0
- package/dist/fakes/Store.js +82 -0
- package/dist/fakes/Store.js.map +1 -0
- package/dist/fakes/TelemetryFakes.d.ts +77 -0
- package/dist/fakes/TelemetryFakes.d.ts.map +1 -0
- package/dist/fakes/TelemetryFakes.js +121 -0
- package/dist/fakes/TelemetryFakes.js.map +1 -0
- package/dist/fakes/TestCa.d.ts +11 -0
- package/dist/fakes/TestCa.d.ts.map +1 -0
- package/dist/fakes/TestCa.js +115 -0
- package/dist/fakes/TestCa.js.map +1 -0
- package/dist/fakes/WorkOsFake.d.ts +40 -0
- package/dist/fakes/WorkOsFake.d.ts.map +1 -0
- package/dist/fakes/WorkOsFake.js +103 -0
- package/dist/fakes/WorkOsFake.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/make/reference.d.ts +520 -0
- package/dist/make/reference.d.ts.map +1 -0
- package/dist/make/reference.js +182 -0
- package/dist/make/reference.js.map +1 -0
- package/dist/make/sources.d.ts +48 -0
- package/dist/make/sources.d.ts.map +1 -0
- package/dist/make/sources.js +806 -0
- package/dist/make/sources.js.map +1 -0
- package/package.json +77 -3
- package/src/Admin.ts +82 -0
- package/src/Agent.ts +289 -0
- package/src/AgentSurface.ts +51 -0
- package/src/Embedder.ts +69 -0
- package/src/EvalMain.ts +81 -0
- package/src/Evals.ts +490 -0
- package/src/Kernel.ts +228 -0
- package/src/Launch.ts +428 -0
- package/src/Locks.ts +123 -0
- package/src/Routes.ts +65 -0
- package/src/ScriptedChatModel.ts +189 -0
- package/src/SmtpSink.ts +205 -0
- package/src/System.ts +1072 -0
- package/src/TcpProxy.ts +102 -0
- package/src/auth/TrustedProxyAuth.ts +173 -0
- package/src/conformance/ActionConsent.ts +437 -0
- package/src/conformance/ActionRegistry.ts +174 -0
- package/src/conformance/Actor.ts +216 -0
- package/src/conformance/AgentReference.ts +171 -0
- package/src/conformance/AgentResources.ts +548 -0
- package/src/conformance/AgentRuntime.ts +388 -0
- package/src/conformance/AgentSubject.ts +103 -0
- package/src/conformance/Approvals.ts +363 -0
- package/src/conformance/Audit.ts +257 -0
- package/src/conformance/CalendarProvider.ts +156 -0
- package/src/conformance/CapabilityKit.ts +564 -0
- package/src/conformance/ClientSDK.ts +233 -0
- package/src/conformance/CollabDocument.ts +1203 -0
- package/src/conformance/CollabReference.ts +152 -0
- package/src/conformance/CollabSubject.ts +64 -0
- package/src/conformance/Command.ts +75 -0
- package/src/conformance/Connections.ts +357 -0
- package/src/conformance/ConnectionsReference.ts +172 -0
- package/src/conformance/ConnectorReference.ts +280 -0
- package/src/conformance/ContextAccounting.ts +169 -0
- package/src/conformance/Daemon.ts +936 -0
- package/src/conformance/DaemonReference.ts +189 -0
- package/src/conformance/DbTx.ts +253 -0
- package/src/conformance/DecisionTokens.ts +652 -0
- package/src/conformance/Delegation.ts +177 -0
- package/src/conformance/DeskReference.ts +73 -0
- package/src/conformance/DeviceControl.ts +700 -0
- package/src/conformance/Directory.ts +315 -0
- package/src/conformance/DirectoryProvider.ts +72 -0
- package/src/conformance/DocumentSource.ts +62 -0
- package/src/conformance/EndpointReference.ts +117 -0
- package/src/conformance/Files.ts +685 -0
- package/src/conformance/FilesReference.ts +154 -0
- package/src/conformance/FilesSubject.ts +50 -0
- package/src/conformance/Flags.ts +215 -0
- package/src/conformance/Host.ts +197 -0
- package/src/conformance/HttpApi.ts +169 -0
- package/src/conformance/InboxReference.ts +401 -0
- package/src/conformance/InboxSubject.ts +101 -0
- package/src/conformance/Ingestion.ts +425 -0
- package/src/conformance/Ingress.ts +498 -0
- package/src/conformance/Invocation.ts +780 -0
- package/src/conformance/IsolationMatrix.ts +215 -0
- package/src/conformance/LiveConnection.ts +197 -0
- package/src/conformance/LocalClient.ts +651 -0
- package/src/conformance/Locale.ts +141 -0
- package/src/conformance/MachineIdentity.ts +828 -0
- package/src/conformance/MailProvider.ts +217 -0
- package/src/conformance/Memory.ts +223 -0
- package/src/conformance/Messaging.ts +185 -0
- package/src/conformance/Metering.ts +293 -0
- package/src/conformance/ModelProvider.ts +139 -0
- package/src/conformance/ModuleManifest.ts +630 -0
- package/src/conformance/NotebookAgent.ts +41 -0
- package/src/conformance/NotificationChannel.ts +122 -0
- package/src/conformance/Notifications.ts +316 -0
- package/src/conformance/OAuthClient.ts +240 -0
- package/src/conformance/Outbox.ts +342 -0
- package/src/conformance/PlatformReference.ts +73 -0
- package/src/conformance/PlatformSubject.ts +50 -0
- package/src/conformance/Privacy.ts +577 -0
- package/src/conformance/Progress.ts +244 -0
- package/src/conformance/Push.ts +820 -0
- package/src/conformance/PushReference.ts +101 -0
- package/src/conformance/QuerySurface.ts +408 -0
- package/src/conformance/Readiness.ts +157 -0
- package/src/conformance/Reference.ts +326 -0
- package/src/conformance/Release.ts +690 -0
- package/src/conformance/ReleaseReference.ts +179 -0
- package/src/conformance/ResultRendering.ts +149 -0
- package/src/conformance/Sandbox.ts +313 -0
- package/src/conformance/SandboxReference.ts +52 -0
- package/src/conformance/Scheduler.ts +764 -0
- package/src/conformance/ScreenContext.ts +402 -0
- package/src/conformance/Search.ts +419 -0
- package/src/conformance/Secrets.ts +277 -0
- package/src/conformance/SecretsReference.ts +131 -0
- package/src/conformance/ServicesReference.ts +330 -0
- package/src/conformance/ServicesSubject.ts +105 -0
- package/src/conformance/Settings.ts +204 -0
- package/src/conformance/Sharing.ts +486 -0
- package/src/conformance/ShellSubject.ts +47 -0
- package/src/conformance/SignOutRace.ts +77 -0
- package/src/conformance/Slot.ts +84 -0
- package/src/conformance/Space.ts +432 -0
- package/src/conformance/StorageAdapter.ts +253 -0
- package/src/conformance/StorageBackend.ts +327 -0
- package/src/conformance/Subject.ts +208 -0
- package/src/conformance/Sync.ts +215 -0
- package/src/conformance/Telemetry.ts +287 -0
- package/src/conformance/ThemeTokens.ts +163 -0
- package/src/conformance/ToolSource.ts +632 -0
- package/src/conformance/Versioning.ts +199 -0
- package/src/conformance/View.ts +143 -0
- package/src/conformance/WorkItems.ts +186 -0
- package/src/conformance/Workflow.ts +304 -0
- package/src/conformance/acme/chatlog.ts +115 -0
- package/src/conformance/acme/connector.ts +151 -0
- package/src/conformance/acme/migrations/0000_messages.sql +8 -0
- package/src/conformance/archive/app.ts +33 -0
- package/src/conformance/archive/contract.ts +191 -0
- package/src/conformance/archive/memo.sync.gen.ts +25 -0
- package/src/conformance/archive/migrations/archive/0000_archive.sql +9 -0
- package/src/conformance/archive/migrations/memo/0000_memo.sql +6 -0
- package/src/conformance/archive/schema.ts +25 -0
- package/src/conformance/archive/server.ts +146 -0
- package/src/conformance/archive/sync.gen.ts +32 -0
- package/src/conformance/atlas/app.ts +16 -0
- package/src/conformance/atlas/contract.ts +118 -0
- package/src/conformance/crm/app.ts +107 -0
- package/src/conformance/crm/contract.ts +163 -0
- package/src/conformance/crm/migrations/crm/0000_crm.sql +18 -0
- package/src/conformance/crm/migrations/team/0000_team.sql +6 -0
- package/src/conformance/crm/schema.ts +28 -0
- package/src/conformance/crm/sync.gen.ts +27 -0
- package/src/conformance/desk/contract.ts +61 -0
- package/src/conformance/desk/migrations/0000_notes.sql +7 -0
- package/src/conformance/desk/server.ts +131 -0
- package/src/conformance/drafts/migrations/0000_drafts.sql +8 -0
- package/src/conformance/drafts/module.ts +211 -0
- package/src/conformance/fixture/app.ts +37 -0
- package/src/conformance/fixture/docs/bad-sync.ts +34 -0
- package/src/conformance/fixture/docs/contract.ts +297 -0
- package/src/conformance/fixture/docs/migrations/0000_docs.sql +9 -0
- package/src/conformance/fixture/docs/migrations/0001_seen.sql +12 -0
- package/src/conformance/fixture/docs/migrations/0002_attachment.sql +6 -0
- package/src/conformance/fixture/docs/policy.cedar +110 -0
- package/src/conformance/fixture/docs/schema.ts +41 -0
- package/src/conformance/fixture/docs/server.ts +292 -0
- package/src/conformance/fixture/docs/sync.gen.ts +54 -0
- package/src/conformance/fixture/docs/sync.ts +24 -0
- package/src/conformance/fixture/peer/migrations/0000_peer.sql +8 -0
- package/src/conformance/fixture/peer/module.ts +51 -0
- package/src/conformance/fixture/release/blocking/0000_item.sql +3 -0
- package/src/conformance/fixture/release/blocking/0001_wait.sql +2 -0
- package/src/conformance/fixture/release/blocking-renamed/0000_item.sql +3 -0
- package/src/conformance/fixture/release/blocking-renamed/0001_wait.sql +5 -0
- package/src/conformance/fixture/release/broken/0000_item.sql +3 -0
- package/src/conformance/fixture/release/broken/0001_extra.sql +3 -0
- package/src/conformance/fixture/release/broken/0002_label.sql +3 -0
- package/src/conformance/fixture/release/drift/escalate/0000_item.sql +5 -0
- package/src/conformance/fixture/release/drift/escalate/0001_escalate.sql +8 -0
- package/src/conformance/fixture/release/drift/v1/0000_item.sql +5 -0
- package/src/conformance/fixture/release/escape/0000_item.sql +3 -0
- package/src/conformance/fixture/release/escape/0001_escape.sql +5 -0
- package/src/conformance/fixture/release/misnamed/0000_item.sql +3 -0
- package/src/conformance/fixture/release/misnamed/0001_misname.sql +10 -0
- package/src/conformance/fixture/release/module.ts +119 -0
- package/src/conformance/fixture/release/outside/0000_item.sql +3 -0
- package/src/conformance/fixture/release/outside/0001_extra.sql +3 -0
- package/src/conformance/fixture/release/outside/0002_index.sql +4 -0
- package/src/conformance/fixture/release/outside/0003_later.sql +1 -0
- package/src/conformance/fixture/release/renamed/0000_item.sql +3 -0
- package/src/conformance/fixture/release/renamed/0001_misname.sql +10 -0
- package/src/conformance/fixture/release/renamed/0002_restore.sql +1 -0
- package/src/conformance/fixture/release/rogue/0000_item.sql +3 -0
- package/src/conformance/fixture/release/rogue/0001_extra.sql +3 -0
- package/src/conformance/fixture/release/rogue/0002_definer.sql +1 -0
- package/src/conformance/fixture/release/slow/0000_item.sql +5 -0
- package/src/conformance/fixture/release/undeclared/0000_item.sql +3 -0
- package/src/conformance/fixture/release/undeclared/0001_extra.sql +3 -0
- package/src/conformance/fixture/release/undeclared/0002_index.sql +1 -0
- package/src/conformance/fixture/release/v1/0000_item.sql +3 -0
- package/src/conformance/fixture/release/v2/0000_item.sql +3 -0
- package/src/conformance/fixture/release/v2/0001_extra.sql +3 -0
- package/src/conformance/fixture/release/v2/0002_label.sql +3 -0
- package/src/conformance/fixture/release/viewed-retyped/0000_item.sql +3 -0
- package/src/conformance/fixture/release/viewed-retyped/0001_retype.sql +1 -0
- package/src/conformance/kit-hash.ts +18 -0
- package/src/conformance/ledger/contract.ts +92 -0
- package/src/conformance/ledger/migrations/0000_entries.sql +8 -0
- package/src/conformance/ledger/server.ts +174 -0
- package/src/conformance/library/app.ts +38 -0
- package/src/conformance/library/contract.ts +66 -0
- package/src/conformance/library/migrations/0000_library.sql +14 -0
- package/src/conformance/library/schema.ts +27 -0
- package/src/conformance/library/server.ts +65 -0
- package/src/conformance/library/sync.gen.ts +47 -0
- package/src/conformance/locale/catalog.ts +111 -0
- package/src/conformance/notebook/app.ts +115 -0
- package/src/conformance/notebook/evals/pages.evals.json +94 -0
- package/src/conformance/notebook/migrations/0000_notebook.sql +10 -0
- package/src/conformance/notebook/module.ts +215 -0
- package/src/conformance/notebook/skills/meeting-notes.md +4 -0
- package/src/conformance/pad/app.ts +21 -0
- package/src/conformance/pad/contract.ts +69 -0
- package/src/conformance/pad/migrations/pad/0000_pad.sql +8 -0
- package/src/conformance/pad/migrations/pad/0001_live_copy.sql +2 -0
- package/src/conformance/pad/schema.ts +18 -0
- package/src/conformance/pad/server.ts +102 -0
- package/src/conformance/purchases/app.ts +34 -0
- package/src/conformance/purchases/contract.ts +161 -0
- package/src/conformance/purchases/migrations/0000_purchases.sql +17 -0
- package/src/conformance/purchases/server.ts +95 -0
- package/src/conformance/replica-search.mjs +22 -0
- package/src/conformance/studio/app.ts +298 -0
- package/src/conformance/studio/contract.ts +319 -0
- package/src/conformance/studio/migrations/billing/0000_billing.sql +6 -0
- package/src/conformance/studio/migrations/journal/0000_journal.sql +9 -0
- package/src/conformance/studio/migrations/mailbox/0000_mailbox.sql +7 -0
- package/src/conformance/studio/migrations/tasks/0000_tasks.sql +7 -0
- package/src/conformance/workshop/app.ts +14 -0
- package/src/conformance/workshop/migrations/0000_notes.sql +7 -0
- package/src/conformance/workshop/module.ts +79 -0
- package/src/fakes/AcmeFake.ts +182 -0
- package/src/fakes/ApnsFake.ts +245 -0
- package/src/fakes/FcmFake.ts +231 -0
- package/src/fakes/GoogleFake.ts +1346 -0
- package/src/fakes/HttpApiFake.ts +116 -0
- package/src/fakes/McpFake.ts +355 -0
- package/src/fakes/MicrosoftGraphFake.ts +1191 -0
- package/src/fakes/S3Fake.ts +376 -0
- package/src/fakes/Server.ts +445 -0
- package/src/fakes/SignInProviderFake.ts +70 -0
- package/src/fakes/SlackFake.ts +893 -0
- package/src/fakes/Store.ts +96 -0
- package/src/fakes/TelemetryFakes.ts +197 -0
- package/src/fakes/TestCa.ts +166 -0
- package/src/fakes/WorkOsFake.ts +136 -0
- package/src/index.ts +9 -0
- package/src/make/reference.ts +259 -0
- package/src/make/sources.ts +836 -0
|
@@ -0,0 +1,652 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conformance kit for decision tokens (Notifications 1.2.0's `POST /api/notifications/decide`): an approval or consent
|
|
3
|
+
* notification's push carries a single-use token, and the person's tap on Approve or Reject redeems it.
|
|
4
|
+
*
|
|
5
|
+
* - Only an APNs installation gets a token: an FCM installation's push offers the decision without one (its buttons
|
|
6
|
+
* open the app, which decides through the person's session), and nothing is minted for it.
|
|
7
|
+
* - The token decides through the existing actions as the person: an approval's approve or reject (the order runs
|
|
8
|
+
* only once approved), a consent's approve (remembering nothing beyond this call) or reject.
|
|
9
|
+
* - It is single use: a second redemption, with either verdict, answers what the first decided and decides nothing;
|
|
10
|
+
* two opposite verdicts at once decide once.
|
|
11
|
+
* - It is refused when it is unknown, expired, of an installation its session signed out, or when the person no
|
|
12
|
+
* longer holds the approver's role (and then it is spent); an agent has no way to redeem it (no action, no tool).
|
|
13
|
+
* - Its plaintext is nowhere but the provider payload: not in the replicated notification, the delivery log, the
|
|
14
|
+
* audit log or the outbox.
|
|
15
|
+
*
|
|
16
|
+
* Usage: `decisionTokenConformance(() => startMyKernel())` with a `PushSubject`.
|
|
17
|
+
*/
|
|
18
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest"
|
|
19
|
+
import { APPROVE } from "./purchases/contract.ts"
|
|
20
|
+
import { PUSH_APP, registerInstallation, wantPush, type PushSubject, type StartPushSubject } from "./Push.ts"
|
|
21
|
+
import { unique, until, type InboxOutcome, type InboxUser } from "./InboxSubject.ts"
|
|
22
|
+
|
|
23
|
+
const ORG = "acme"
|
|
24
|
+
|
|
25
|
+
export const decisionTokenConformance = (start: StartPushSubject) =>
|
|
26
|
+
describe("Decision tokens (Notifications 1.2.0)", () => {
|
|
27
|
+
let s: PushSubject
|
|
28
|
+
let rita: InboxUser
|
|
29
|
+
beforeAll(async () => {
|
|
30
|
+
s = await start()
|
|
31
|
+
await s.role(ORG, "push-approver", [APPROVE])
|
|
32
|
+
rita = await s.user(unique("rita"), ORG)
|
|
33
|
+
}, 120_000)
|
|
34
|
+
afterAll(() => s?.dispose())
|
|
35
|
+
|
|
36
|
+
/** An approver with an APNs installation who wants approval requests by push. */
|
|
37
|
+
const approver = async (name: string) => {
|
|
38
|
+
const who = await s.user(unique(name), ORG, { roles: ["push-approver"] })
|
|
39
|
+
await wantPush(s, who, "approvals.requested")
|
|
40
|
+
const device = s.apns.deviceToken(PUSH_APP)
|
|
41
|
+
await registerInstallation(s, who, { provider: "apns", token: device })
|
|
42
|
+
return { who, device }
|
|
43
|
+
}
|
|
44
|
+
const approvalId = (outcome: InboxOutcome) => {
|
|
45
|
+
if (outcome.ok || outcome.error._tag !== "ApprovalRequired") throw new Error(JSON.stringify(outcome))
|
|
46
|
+
return outcome.error["approvalId"] as string
|
|
47
|
+
}
|
|
48
|
+
/** Rita orders something that needs one approver; the approval's id. */
|
|
49
|
+
const order = async (amount = 2_000, vendor?: string) =>
|
|
50
|
+
approvalId(
|
|
51
|
+
await s.invoke({
|
|
52
|
+
action: "purchases.order",
|
|
53
|
+
input: { item: unique("chairs"), amount, ...(vendor === undefined ? {} : { vendor }) },
|
|
54
|
+
token: rita.token,
|
|
55
|
+
}),
|
|
56
|
+
)
|
|
57
|
+
/** The decision token the push for `requestId` carried to `device`. */
|
|
58
|
+
const tokenFor = async (device: string, requestId: string) => {
|
|
59
|
+
const [push] = await until(
|
|
60
|
+
`the push for ${requestId}`,
|
|
61
|
+
async () =>
|
|
62
|
+
s.apns
|
|
63
|
+
.deliveredTo(device)
|
|
64
|
+
.filter(
|
|
65
|
+
(d) =>
|
|
66
|
+
d.payload["eloxiv"]?.decision !== undefined &&
|
|
67
|
+
JSON.stringify(d.payload["eloxiv"].link ?? {}).includes(requestId),
|
|
68
|
+
),
|
|
69
|
+
(found) => found.length > 0,
|
|
70
|
+
)
|
|
71
|
+
return push!.payload["eloxiv"].decision.token as string
|
|
72
|
+
}
|
|
73
|
+
const status = async (id: string) =>
|
|
74
|
+
(await s.sql<{ status: string }>(`SELECT status FROM eloxiv_approvals.request WHERE id = $1`, [id]))[0]?.status
|
|
75
|
+
/** Sign the person out, and wait for their installation to go with the session. */
|
|
76
|
+
const signOutDevice = async (who: InboxUser) => {
|
|
77
|
+
await s.signOut(who)
|
|
78
|
+
await until(
|
|
79
|
+
"the installation gone",
|
|
80
|
+
() => s.sql(`SELECT id FROM eloxiv.push_installation WHERE user_id = $1`, [who.id]),
|
|
81
|
+
(rows) => rows.length === 0,
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
/** Redeem `token` to approve `id`: the answer, and the votes on the request after it. */
|
|
85
|
+
const tryApprove = async (token: string, id: string) => {
|
|
86
|
+
const answer = await s.decide(token, "approve")
|
|
87
|
+
return { status: answer.status, tag: answer.body["_tag"], votes: await votes(id) }
|
|
88
|
+
}
|
|
89
|
+
const refusedAsInvalid = { status: 400, tag: "InvalidDecision", votes: [] }
|
|
90
|
+
const votes = (id: string) =>
|
|
91
|
+
s.sql<{ approver_id: string; verdict: string }>(
|
|
92
|
+
`SELECT approver_id, verdict FROM eloxiv_approvals.vote WHERE request_id = $1`,
|
|
93
|
+
[id],
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
/** A person who wants consent requests by push, with `devices` APNs installations. */
|
|
97
|
+
const consenter = async (name: string, devices = 1) => {
|
|
98
|
+
const who = await s.user(unique(name), ORG)
|
|
99
|
+
await wantPush(s, who, "consent.requested")
|
|
100
|
+
const tokens: Array<string> = []
|
|
101
|
+
for (let i = 0; i < devices; i++) {
|
|
102
|
+
const device = s.apns.deviceToken(PUSH_APP)
|
|
103
|
+
await registerInstallation(s, who, { provider: "apns", token: device })
|
|
104
|
+
tokens.push(device)
|
|
105
|
+
}
|
|
106
|
+
return { who, tokens }
|
|
107
|
+
}
|
|
108
|
+
/** The person's agent asks to wire money: the consent request's id. */
|
|
109
|
+
const askConsent = async (who: InboxUser) => {
|
|
110
|
+
const outcome = await s.invoke({
|
|
111
|
+
action: "purchases.wire",
|
|
112
|
+
input: { amount: 3, payee: unique("payee") },
|
|
113
|
+
token: who.token,
|
|
114
|
+
surface: "agent",
|
|
115
|
+
})
|
|
116
|
+
if (outcome.ok || outcome.error._tag !== "ConsentRequired") throw new Error(JSON.stringify(outcome))
|
|
117
|
+
return outcome.error["consentId"] as string
|
|
118
|
+
}
|
|
119
|
+
/** The consent push for `consentId` to the APNs `device`. */
|
|
120
|
+
const consentPush = async (device: string, consentId: string) => {
|
|
121
|
+
const [push] = await until(
|
|
122
|
+
`the consent push for ${consentId}`,
|
|
123
|
+
async () => s.apns.deliveredTo(device).filter((d) => d.payload["eloxiv"]?.decision?.requestId === consentId),
|
|
124
|
+
(found) => found.length > 0,
|
|
125
|
+
)
|
|
126
|
+
return push!
|
|
127
|
+
}
|
|
128
|
+
/** The consent decision token the push for `consentId` carried to the APNs `device`. */
|
|
129
|
+
const consentToken = async (device: string, consentId: string) =>
|
|
130
|
+
(await consentPush(device, consentId)).payload["eloxiv"].decision.token as string
|
|
131
|
+
const consentStatusOf = async (id: string) =>
|
|
132
|
+
(await s.sql<{ status: string }>(`SELECT status FROM eloxiv_consent.request WHERE id = $1`, [id]))[0]?.status
|
|
133
|
+
|
|
134
|
+
it("approves an approval as the person, through the approval action, and answers no-store", async () => {
|
|
135
|
+
const { who, device } = await approver("ann")
|
|
136
|
+
const id = await order()
|
|
137
|
+
const push = await until(
|
|
138
|
+
"the approval push",
|
|
139
|
+
async () => s.apns.deliveredTo(device),
|
|
140
|
+
(found) => found.length > 0,
|
|
141
|
+
)
|
|
142
|
+
expect(push[0]!.payload["aps"].category).toBe("eloxiv.decision")
|
|
143
|
+
expect(push[0]!.payload["eloxiv"].link).toEqual({ view: "approvals.request", record: id, org: ORG })
|
|
144
|
+
expect(push[0]!.payload["eloxiv"].decision).toMatchObject({ kind: "approval", verdicts: ["approve", "reject"] })
|
|
145
|
+
const answer = await s.decide(await tokenFor(device, id), "approve")
|
|
146
|
+
expect(answer).toMatchObject({
|
|
147
|
+
status: 200,
|
|
148
|
+
cacheControl: "no-store",
|
|
149
|
+
body: { kind: "approval", requestId: id, verdict: "approve", status: "approved", replayed: false },
|
|
150
|
+
})
|
|
151
|
+
expect(await votes(id)).toEqual([{ approver_id: who.id, verdict: "approve" }])
|
|
152
|
+
await until(
|
|
153
|
+
"the approved order",
|
|
154
|
+
() => status(id),
|
|
155
|
+
(st) => st === "approved",
|
|
156
|
+
)
|
|
157
|
+
const audit = await s.audit({ action: "approvals.approve" })
|
|
158
|
+
expect(audit.some((r) => r.actorUserId === who.id && r.outcome === "succeeded")).toBe(true)
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
it("rejects an approval, and a second redemption answers what was decided and decides nothing", async () => {
|
|
162
|
+
const { device } = await approver("bo")
|
|
163
|
+
const id = await order()
|
|
164
|
+
const token = await tokenFor(device, id)
|
|
165
|
+
expect((await s.decide(token, "reject")).body).toMatchObject({ status: "rejected", replayed: false })
|
|
166
|
+
for (const verdict of ["reject", "approve"]) {
|
|
167
|
+
expect(await s.decide(token, verdict)).toMatchObject({
|
|
168
|
+
status: 200,
|
|
169
|
+
body: { verdict: "reject", status: "rejected", replayed: true },
|
|
170
|
+
})
|
|
171
|
+
}
|
|
172
|
+
expect(await votes(id)).toHaveLength(1)
|
|
173
|
+
expect(await status(id)).toBe("rejected")
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
it("decides once when opposite verdicts arrive together", async () => {
|
|
177
|
+
const { device } = await approver("cy")
|
|
178
|
+
const id = await order()
|
|
179
|
+
const token = await tokenFor(device, id)
|
|
180
|
+
const answers = await Promise.all([s.decide(token, "approve"), s.decide(token, "reject")])
|
|
181
|
+
expect(answers.filter((a) => a.body["replayed"] === false)).toHaveLength(1)
|
|
182
|
+
expect(new Set(answers.map((a) => a.body["verdict"])).size).toBe(1)
|
|
183
|
+
expect(await votes(id)).toHaveLength(1)
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
it("approves and rejects consent, remembering nothing beyond the one call", async () => {
|
|
187
|
+
const { who: dot, tokens } = await consenter("dot")
|
|
188
|
+
const tokenOf = async (consentId: string) => {
|
|
189
|
+
const push = await consentPush(tokens[0]!, consentId)
|
|
190
|
+
expect(push.payload["eloxiv"].decision).toMatchObject({ kind: "consent", verdicts: ["approve", "reject"] })
|
|
191
|
+
expect(push.payload["aps"].category).toBe("eloxiv.decision")
|
|
192
|
+
return consentToken(tokens[0]!, consentId)
|
|
193
|
+
}
|
|
194
|
+
const approved = await askConsent(dot)
|
|
195
|
+
expect((await s.decide(await tokenOf(approved), "approve")).body).toMatchObject({
|
|
196
|
+
kind: "consent",
|
|
197
|
+
status: "approved",
|
|
198
|
+
})
|
|
199
|
+
expect(await consentStatusOf(approved)).toBe("approved")
|
|
200
|
+
expect(await s.sql(`SELECT id FROM eloxiv_consent.permission WHERE user_id = $1`, [dot.id])).toEqual([])
|
|
201
|
+
const rejected = await askConsent(dot)
|
|
202
|
+
expect((await s.decide(await tokenOf(rejected), "reject")).body).toMatchObject({ status: "rejected" })
|
|
203
|
+
expect(await consentStatusOf(rejected)).toBe("rejected")
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
it("offers an FCM installation the decision without a token, and mints none for it", async () => {
|
|
207
|
+
const who = await s.user(unique("fin"), ORG)
|
|
208
|
+
await wantPush(s, who, "consent.requested")
|
|
209
|
+
const device = s.fcm.deviceToken()
|
|
210
|
+
const { installationId } = await registerInstallation(s, who, { provider: "fcm", token: device })
|
|
211
|
+
const consentId = await askConsent(who)
|
|
212
|
+
const [push] = await until(
|
|
213
|
+
`the consent push for ${consentId}`,
|
|
214
|
+
async () => s.fcm.deliveredTo(device).filter((d) => d.message["data"].eloxiv.includes(consentId)),
|
|
215
|
+
(found) => found.length > 0,
|
|
216
|
+
)
|
|
217
|
+
const eloxiv = JSON.parse(push!.message["data"].eloxiv)
|
|
218
|
+
expect(eloxiv).toMatchObject({ userId: who.id, installationId, orgId: ORG })
|
|
219
|
+
expect(eloxiv.decision).toEqual({ kind: "consent", requestId: consentId, verdicts: ["approve", "reject"] })
|
|
220
|
+
// The buttons still show: they open the app, which decides through the person's session.
|
|
221
|
+
expect(push!.message["data"].categoryId).toBe("eloxiv.decision")
|
|
222
|
+
expect(JSON.parse(push!.message["data"].body)).toEqual({ eloxiv })
|
|
223
|
+
expect(await s.sql(`SELECT 1 FROM eloxiv.notification_decision WHERE request_id = $1`, [consentId])).toEqual([])
|
|
224
|
+
expect(await consentStatusOf(consentId)).toBe("pending")
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
it("refuses an unknown token, a verdict it does not offer, and a malformed request", async () => {
|
|
228
|
+
expect(await s.decide("A".repeat(43), "approve")).toMatchObject({
|
|
229
|
+
status: 400,
|
|
230
|
+
body: { _tag: "InvalidDecision" },
|
|
231
|
+
})
|
|
232
|
+
const { device } = await approver("eli")
|
|
233
|
+
const id = await order()
|
|
234
|
+
const token = await tokenFor(device, id)
|
|
235
|
+
expect(await s.decide(token, "maybe")).toMatchObject({ status: 400, body: { _tag: "InvalidDecision" } })
|
|
236
|
+
expect(await s.decide(`${token.slice(0, -1)}${token.endsWith("A") ? "B" : "A"}`, "approve")).toMatchObject({
|
|
237
|
+
status: 400,
|
|
238
|
+
})
|
|
239
|
+
expect(await status(id)).toBe("pending")
|
|
240
|
+
const denied = await s.audit({ action: "notifications.decide" })
|
|
241
|
+
expect(denied.some((r) => r.outcome === "denied")).toBe(true)
|
|
242
|
+
})
|
|
243
|
+
|
|
244
|
+
it("refuses an expired token", async () => {
|
|
245
|
+
const { device } = await approver("fay")
|
|
246
|
+
// The slowco rule's requests expire after two seconds: so do their tokens.
|
|
247
|
+
const id = await order(2_000, "slowco")
|
|
248
|
+
const token = await tokenFor(device, id)
|
|
249
|
+
await new Promise((resolve) => setTimeout(resolve, 2_500))
|
|
250
|
+
expect(await s.decide(token, "approve")).toMatchObject({ status: 410, body: { _tag: "DecisionExpired" } })
|
|
251
|
+
expect(await votes(id)).toEqual([])
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
it("refuses a token once the person lost the approver's role, and spends it", async () => {
|
|
255
|
+
const { who, device } = await approver("gus")
|
|
256
|
+
const id = await order()
|
|
257
|
+
const token = await tokenFor(device, id)
|
|
258
|
+
await s.unassignRole(who.id, ORG, "push-approver")
|
|
259
|
+
expect(await s.decide(token, "approve")).toMatchObject({
|
|
260
|
+
status: 403,
|
|
261
|
+
body: { _tag: "Forbidden", replayed: false },
|
|
262
|
+
})
|
|
263
|
+
await s.assignRole(who.id, ORG, "push-approver")
|
|
264
|
+
expect(await s.decide(token, "approve")).toMatchObject({ status: 403, body: { replayed: true } })
|
|
265
|
+
expect(await votes(id)).toEqual([])
|
|
266
|
+
})
|
|
267
|
+
|
|
268
|
+
it("refuses a token whose installation's session signed out", async () => {
|
|
269
|
+
const { who, device } = await approver("hal")
|
|
270
|
+
const id = await order()
|
|
271
|
+
const token = await tokenFor(device, id)
|
|
272
|
+
await signOutDevice(who)
|
|
273
|
+
expect(await tryApprove(token, id)).toEqual(refusedAsInvalid)
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
it("gives an ordinary notification no decision, whatever category and link its sender gives it", async () => {
|
|
277
|
+
const { who, device } = await approver("kai")
|
|
278
|
+
const id = await order()
|
|
279
|
+
await tokenFor(device, id)
|
|
280
|
+
const title = unique("Please approve the refund")
|
|
281
|
+
const sent = await s.invoke({
|
|
282
|
+
action: "notifications.notify",
|
|
283
|
+
input: {
|
|
284
|
+
title,
|
|
285
|
+
body: "Tap Approve",
|
|
286
|
+
category: "approvals.requested",
|
|
287
|
+
link: { module: "approvals", entity: "request", id },
|
|
288
|
+
},
|
|
289
|
+
token: who.token,
|
|
290
|
+
})
|
|
291
|
+
expect(sent).toMatchObject({ ok: true })
|
|
292
|
+
const [push] = await until(
|
|
293
|
+
"the ordinary notification's push",
|
|
294
|
+
async () => s.apns.deliveredTo(device).filter((d) => d.payload["aps"]?.alert?.title === title),
|
|
295
|
+
(found) => found.length > 0,
|
|
296
|
+
)
|
|
297
|
+
expect(push!.payload["eloxiv"].decision).toBeUndefined()
|
|
298
|
+
expect(push!.payload["aps"].category).toBeUndefined()
|
|
299
|
+
})
|
|
300
|
+
|
|
301
|
+
it("refuses a token once its installation was registered again from another session", async () => {
|
|
302
|
+
const { who, device } = await approver("lea")
|
|
303
|
+
const installation = (
|
|
304
|
+
await s.sql<{ installation_id: string }>(
|
|
305
|
+
`SELECT installation_id FROM eloxiv.push_installation WHERE user_id = $1`,
|
|
306
|
+
[who.id],
|
|
307
|
+
)
|
|
308
|
+
)[0]!.installation_id
|
|
309
|
+
const id = await order()
|
|
310
|
+
const token = await tokenFor(device, id)
|
|
311
|
+
const elsewhere = await s.signIn(who)
|
|
312
|
+
await registerInstallation(s, elsewhere, { provider: "apns", token: device, installationId: installation })
|
|
313
|
+
expect(await tryApprove(token, id)).toEqual(refusedAsInvalid)
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
it("refuses a token once the session that registered its installation expired", async () => {
|
|
317
|
+
const { who, device } = await approver("max")
|
|
318
|
+
const id = await order()
|
|
319
|
+
const token = await tokenFor(device, id)
|
|
320
|
+
await s.sql(
|
|
321
|
+
`UPDATE auth.session SET "expiresAt" = now() - interval '1 minute'
|
|
322
|
+
WHERE id = (SELECT session_id FROM eloxiv.push_installation WHERE user_id = $1)`,
|
|
323
|
+
[who.id],
|
|
324
|
+
)
|
|
325
|
+
expect(await tryApprove(token, id)).toEqual(refusedAsInvalid)
|
|
326
|
+
})
|
|
327
|
+
|
|
328
|
+
it("refuses a token once the organisation no longer admits how its installation's session signed in", async () => {
|
|
329
|
+
const { device } = await approver("una")
|
|
330
|
+
const id = await order()
|
|
331
|
+
const token = await tokenFor(device, id)
|
|
332
|
+
// The organisation now admits only magic links: the password session that registered the installation is out.
|
|
333
|
+
await s.sql(`INSERT INTO eloxiv.org_sign_in (org_id, methods) VALUES ($1, ARRAY['magic-link'])`, [ORG])
|
|
334
|
+
try {
|
|
335
|
+
expect(await tryApprove(token, id)).toEqual(refusedAsInvalid)
|
|
336
|
+
} finally {
|
|
337
|
+
await s.sql(`DELETE FROM eloxiv.org_sign_in WHERE org_id = $1`, [ORG])
|
|
338
|
+
}
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
it("holds a change to the organisation's sign-in methods until a decision under the old ones commits", async () => {
|
|
342
|
+
const { device, who } = await approver("vic")
|
|
343
|
+
const id = await order()
|
|
344
|
+
const token = await tokenFor(device, id)
|
|
345
|
+
// The decision is held at its last write, every admission check behind it, until the gate opens.
|
|
346
|
+
await s.sql(`CREATE TABLE public.policy_gate (open boolean NOT NULL)`)
|
|
347
|
+
let settled = false
|
|
348
|
+
let change: Promise<unknown> | undefined
|
|
349
|
+
try {
|
|
350
|
+
await s.sql(`INSERT INTO public.policy_gate VALUES (false)`)
|
|
351
|
+
await s.sql(`CREATE FUNCTION public.policy_gate_wait() RETURNS trigger LANGUAGE plpgsql SECURITY DEFINER
|
|
352
|
+
SET search_path = pg_catalog AS $$
|
|
353
|
+
BEGIN
|
|
354
|
+
FOR i IN 1..600 LOOP
|
|
355
|
+
EXIT WHEN (SELECT open FROM public.policy_gate);
|
|
356
|
+
PERFORM pg_sleep(0.05);
|
|
357
|
+
END LOOP;
|
|
358
|
+
RETURN NEW;
|
|
359
|
+
END $$`)
|
|
360
|
+
await s.sql(`CREATE TRIGGER policy_gate BEFORE UPDATE ON eloxiv.notification_decision
|
|
361
|
+
FOR EACH ROW EXECUTE FUNCTION public.policy_gate_wait()`)
|
|
362
|
+
const answer = s.decide(token, "approve")
|
|
363
|
+
await until(
|
|
364
|
+
"the decision held at its last write",
|
|
365
|
+
() => s.sql(`SELECT 1 FROM pg_stat_activity WHERE datname = current_database() AND wait_event = 'PgSleep'`),
|
|
366
|
+
(rows) => rows.length > 0,
|
|
367
|
+
)
|
|
368
|
+
// The organisation now admits only magic links, written as a directory change is (its lock, exclusively).
|
|
369
|
+
change = s
|
|
370
|
+
.sql(
|
|
371
|
+
`DO $$ BEGIN /* decide-policy-change */ PERFORM eloxiv.lock_directory('${ORG}');
|
|
372
|
+
INSERT INTO eloxiv.org_sign_in (org_id, methods) VALUES ('${ORG}', ARRAY['magic-link'])
|
|
373
|
+
ON CONFLICT (org_id) DO UPDATE SET methods = EXCLUDED.methods; END $$`,
|
|
374
|
+
)
|
|
375
|
+
.finally(() => {
|
|
376
|
+
settled = true
|
|
377
|
+
})
|
|
378
|
+
await until(
|
|
379
|
+
"the policy change waiting for the decision, or committed",
|
|
380
|
+
async () =>
|
|
381
|
+
settled ||
|
|
382
|
+
(
|
|
383
|
+
await s.sql(`SELECT 1 FROM pg_stat_activity WHERE pid <> pg_backend_pid()
|
|
384
|
+
AND query LIKE '%decide-policy-change%' AND wait_event_type = 'Lock'`)
|
|
385
|
+
).length > 0,
|
|
386
|
+
(done) => done,
|
|
387
|
+
)
|
|
388
|
+
// Never committed while the decision it would have refused is still to commit.
|
|
389
|
+
expect(settled).toBe(false)
|
|
390
|
+
await s.sql(`UPDATE public.policy_gate SET open = true`)
|
|
391
|
+
expect(await answer).toMatchObject({ status: 200, body: { status: "approved", replayed: false } })
|
|
392
|
+
await change
|
|
393
|
+
expect(await votes(id)).toEqual([{ approver_id: who.id, verdict: "approve" }])
|
|
394
|
+
} finally {
|
|
395
|
+
await s.sql(`UPDATE public.policy_gate SET open = true`).catch(() => undefined)
|
|
396
|
+
await change?.catch(() => undefined)
|
|
397
|
+
await s.sql(`DROP TRIGGER IF EXISTS policy_gate ON eloxiv.notification_decision`)
|
|
398
|
+
await s.sql(`DROP FUNCTION IF EXISTS public.policy_gate_wait()`)
|
|
399
|
+
await s.sql(`DROP TABLE IF EXISTS public.policy_gate`)
|
|
400
|
+
await s.sql(`DELETE FROM eloxiv.org_sign_in WHERE org_id = $1`, [ORG])
|
|
401
|
+
}
|
|
402
|
+
})
|
|
403
|
+
|
|
404
|
+
it("decides a consent once when two devices answer with opposite verdicts", async () => {
|
|
405
|
+
const { who, tokens } = await consenter("nia", 2)
|
|
406
|
+
// One after the other: the second device's reject finds the consent approved, and leaves it so.
|
|
407
|
+
const first = await askConsent(who)
|
|
408
|
+
const [a, b] = [await consentToken(tokens[0]!, first), await consentToken(tokens[1]!, first)]
|
|
409
|
+
expect(await s.decide(a, "approve")).toMatchObject({ status: 200, body: { status: "approved" } })
|
|
410
|
+
expect(await s.decide(b, "reject")).toMatchObject({
|
|
411
|
+
status: 409,
|
|
412
|
+
body: { _tag: "InvalidInput", replayed: false },
|
|
413
|
+
})
|
|
414
|
+
expect(await consentStatusOf(first)).toBe("approved")
|
|
415
|
+
// At once: one decides, the other is refused, and the consent ends as the one that decided.
|
|
416
|
+
const second = await askConsent(who)
|
|
417
|
+
const [c, d] = [await consentToken(tokens[0]!, second), await consentToken(tokens[1]!, second)]
|
|
418
|
+
const answers = await Promise.all([s.decide(c, "approve"), s.decide(d, "reject")])
|
|
419
|
+
const decided = answers.filter((x) => x.status === 200)
|
|
420
|
+
expect(decided).toHaveLength(1)
|
|
421
|
+
expect(answers.filter((x) => x.status === 409)).toHaveLength(1)
|
|
422
|
+
expect(await consentStatusOf(second)).toBe(decided[0]!.body["status"])
|
|
423
|
+
})
|
|
424
|
+
|
|
425
|
+
it("refuses to reject from a push a consent the person already approved in chat", async () => {
|
|
426
|
+
const { who, tokens } = await consenter("oz")
|
|
427
|
+
const consentId = await askConsent(who)
|
|
428
|
+
const token = await consentToken(tokens[0]!, consentId)
|
|
429
|
+
expect(
|
|
430
|
+
await s.invoke({
|
|
431
|
+
action: "consent.approve",
|
|
432
|
+
input: { id: consentId, remember: "once" },
|
|
433
|
+
token: who.token,
|
|
434
|
+
idempotencyKey: `consent:${consentId}:approve:once`,
|
|
435
|
+
}),
|
|
436
|
+
).toMatchObject({ ok: true })
|
|
437
|
+
expect(await s.decide(token, "reject")).toMatchObject({ status: 409, body: { _tag: "InvalidInput" } })
|
|
438
|
+
expect(await consentStatusOf(consentId)).toBe("approved")
|
|
439
|
+
})
|
|
440
|
+
|
|
441
|
+
it("answers a consent decided elsewhere from one state, even when it is withdrawn while the redemption runs", async () => {
|
|
442
|
+
const { who, tokens } = await consenter("vi")
|
|
443
|
+
const consentId = await askConsent(who)
|
|
444
|
+
const token = await consentToken(tokens[0]!, consentId)
|
|
445
|
+
expect(
|
|
446
|
+
await s.invoke({
|
|
447
|
+
action: "consent.approve",
|
|
448
|
+
input: { id: consentId, remember: "once" },
|
|
449
|
+
token: who.token,
|
|
450
|
+
idempotencyKey: `consent:${consentId}:approve:once`,
|
|
451
|
+
}),
|
|
452
|
+
).toMatchObject({ ok: true })
|
|
453
|
+
// The redemption is held just after its call was refused (the consent is approved, not pending: the refusal's
|
|
454
|
+
// audit row waits for a gate), while the person withdraws the approval in chat.
|
|
455
|
+
await s.sql(`CREATE TABLE public.decide_gate (open boolean NOT NULL)`)
|
|
456
|
+
try {
|
|
457
|
+
await s.sql(`INSERT INTO public.decide_gate VALUES (false)`)
|
|
458
|
+
await s.sql(`CREATE FUNCTION public.decide_gate_wait() RETURNS trigger LANGUAGE plpgsql SECURITY DEFINER
|
|
459
|
+
SET search_path = pg_catalog AS $$
|
|
460
|
+
BEGIN
|
|
461
|
+
IF NEW.action = 'consent.approve' AND NEW.outcome = 'denied' THEN
|
|
462
|
+
FOR i IN 1..600 LOOP
|
|
463
|
+
EXIT WHEN (SELECT open FROM public.decide_gate);
|
|
464
|
+
PERFORM pg_sleep(0.05);
|
|
465
|
+
END LOOP;
|
|
466
|
+
END IF;
|
|
467
|
+
RETURN NEW;
|
|
468
|
+
END $$`)
|
|
469
|
+
await s.sql(`CREATE TRIGGER decide_gate AFTER INSERT ON eloxiv.audit_log
|
|
470
|
+
FOR EACH ROW EXECUTE FUNCTION public.decide_gate_wait()`)
|
|
471
|
+
const answer = s.decide(token, "approve")
|
|
472
|
+
await until(
|
|
473
|
+
"the redemption held after its refused call",
|
|
474
|
+
() => s.sql(`SELECT 1 FROM pg_stat_activity WHERE datname = current_database() AND wait_event = 'PgSleep'`),
|
|
475
|
+
(rows) => rows.length > 0,
|
|
476
|
+
)
|
|
477
|
+
expect(await s.invoke({ action: "consent.reject", input: { id: consentId }, token: who.token })).toMatchObject({
|
|
478
|
+
ok: true,
|
|
479
|
+
})
|
|
480
|
+
await s.sql(`UPDATE public.decide_gate SET open = true`)
|
|
481
|
+
expect(await consentStatusOf(consentId)).toBe("rejected")
|
|
482
|
+
// Never "approve" answered with the withdrawn status: the state it reads is the one it holds, now rejected.
|
|
483
|
+
expect(await answer).toMatchObject({ status: 409, body: { _tag: "InvalidInput", replayed: false } })
|
|
484
|
+
} finally {
|
|
485
|
+
await s.sql(`UPDATE public.decide_gate SET open = true`).catch(() => undefined)
|
|
486
|
+
await s.sql(`DROP TRIGGER IF EXISTS decide_gate ON eloxiv.audit_log`)
|
|
487
|
+
await s.sql(`DROP FUNCTION IF EXISTS public.decide_gate_wait()`)
|
|
488
|
+
await s.sql(`DROP TABLE IF EXISTS public.decide_gate`)
|
|
489
|
+
}
|
|
490
|
+
})
|
|
491
|
+
|
|
492
|
+
it("answers a decision the person already made elsewhere with the request's recorded status", async () => {
|
|
493
|
+
const { who, device } = await approver("pip")
|
|
494
|
+
const id = await order()
|
|
495
|
+
const token = await tokenFor(device, id)
|
|
496
|
+
expect(
|
|
497
|
+
await s.invoke({
|
|
498
|
+
action: "approvals.approve",
|
|
499
|
+
input: { id },
|
|
500
|
+
token: who.token,
|
|
501
|
+
idempotencyKey: `approval:${id}:approve`,
|
|
502
|
+
}),
|
|
503
|
+
).toMatchObject({ ok: true })
|
|
504
|
+
expect(await s.decide(token, "approve")).toMatchObject({
|
|
505
|
+
status: 200,
|
|
506
|
+
body: { kind: "approval", requestId: id, verdict: "approve", status: "approved", replayed: true },
|
|
507
|
+
})
|
|
508
|
+
expect(await votes(id)).toHaveLength(1)
|
|
509
|
+
})
|
|
510
|
+
|
|
511
|
+
it("answers an approval the person already gave in chat with a comment as the same decision", async () => {
|
|
512
|
+
const { who, device } = await approver("wyn")
|
|
513
|
+
const id = await order()
|
|
514
|
+
const token = await tokenFor(device, id)
|
|
515
|
+
expect(
|
|
516
|
+
await s.invoke({
|
|
517
|
+
action: "approvals.approve",
|
|
518
|
+
input: { id, comment: "Checked the quote" },
|
|
519
|
+
token: who.token,
|
|
520
|
+
idempotencyKey: `approval:${id}:approve`,
|
|
521
|
+
}),
|
|
522
|
+
).toMatchObject({ ok: true })
|
|
523
|
+
expect(await s.decide(token, "approve")).toMatchObject({
|
|
524
|
+
status: 200,
|
|
525
|
+
body: { kind: "approval", requestId: id, verdict: "approve", status: "approved", replayed: true },
|
|
526
|
+
})
|
|
527
|
+
expect(await votes(id)).toHaveLength(1)
|
|
528
|
+
})
|
|
529
|
+
|
|
530
|
+
it("answers a failure to record the decision with a no-store 503, deciding nothing until a retry", async () => {
|
|
531
|
+
const { who, device } = await approver("xan")
|
|
532
|
+
const id = await order()
|
|
533
|
+
const token = await tokenFor(device, id)
|
|
534
|
+
// The token's answer cannot be written (the action itself ran, in the savepoint that rolls back with it).
|
|
535
|
+
await s.sql(`CREATE FUNCTION public.decide_fault() RETURNS trigger LANGUAGE plpgsql
|
|
536
|
+
SET search_path = pg_catalog AS $$ BEGIN RAISE EXCEPTION 'decide write fault'; END $$`)
|
|
537
|
+
try {
|
|
538
|
+
await s.sql(`CREATE TRIGGER decide_fault BEFORE UPDATE ON eloxiv.notification_decision
|
|
539
|
+
FOR EACH ROW EXECUTE FUNCTION public.decide_fault()`)
|
|
540
|
+
expect(await s.decide(token, "approve")).toMatchObject({
|
|
541
|
+
status: 503,
|
|
542
|
+
cacheControl: "no-store",
|
|
543
|
+
body: { _tag: "ActionFailed" },
|
|
544
|
+
})
|
|
545
|
+
expect(await votes(id)).toEqual([])
|
|
546
|
+
} finally {
|
|
547
|
+
await s.sql(`DROP TRIGGER IF EXISTS decide_fault ON eloxiv.notification_decision`)
|
|
548
|
+
await s.sql(`DROP FUNCTION IF EXISTS public.decide_fault()`)
|
|
549
|
+
}
|
|
550
|
+
expect(await s.decide(token, "approve")).toMatchObject({ status: 200, body: { replayed: false } })
|
|
551
|
+
expect(await votes(id)).toEqual([{ approver_id: who.id, verdict: "approve" }])
|
|
552
|
+
})
|
|
553
|
+
|
|
554
|
+
it("answers a connection lost while recording the decision with a no-store 503, deciding nothing until a retry", async () => {
|
|
555
|
+
const { who, device } = await approver("zoe")
|
|
556
|
+
const id = await order()
|
|
557
|
+
const token = await tokenFor(device, id)
|
|
558
|
+
// The connection carrying the decision closes as its answer is written (its rollback cannot run either).
|
|
559
|
+
await s.sql(`CREATE FUNCTION public.decide_disconnect() RETURNS trigger LANGUAGE plpgsql SECURITY DEFINER
|
|
560
|
+
SET search_path = pg_catalog AS $$ BEGIN PERFORM pg_terminate_backend(pg_backend_pid()); RETURN NEW; END $$`)
|
|
561
|
+
try {
|
|
562
|
+
await s.sql(`CREATE TRIGGER decide_disconnect BEFORE UPDATE ON eloxiv.notification_decision
|
|
563
|
+
FOR EACH ROW EXECUTE FUNCTION public.decide_disconnect()`)
|
|
564
|
+
expect(await s.decide(token, "approve")).toMatchObject({
|
|
565
|
+
status: 503,
|
|
566
|
+
cacheControl: "no-store",
|
|
567
|
+
body: { _tag: "ActionFailed" },
|
|
568
|
+
})
|
|
569
|
+
expect(await votes(id)).toEqual([])
|
|
570
|
+
} finally {
|
|
571
|
+
await s.sql(`DROP TRIGGER IF EXISTS decide_disconnect ON eloxiv.notification_decision`)
|
|
572
|
+
await s.sql(`DROP FUNCTION IF EXISTS public.decide_disconnect()`)
|
|
573
|
+
}
|
|
574
|
+
expect(await s.decide(token, "approve")).toMatchObject({ status: 200, body: { replayed: false } })
|
|
575
|
+
expect(await votes(id)).toEqual([{ approver_id: who.id, verdict: "approve" }])
|
|
576
|
+
})
|
|
577
|
+
|
|
578
|
+
it("answers every redemption racing the first one with the answer that committed", async () => {
|
|
579
|
+
const { device } = await approver("rae")
|
|
580
|
+
const id = await order()
|
|
581
|
+
const token = await tokenFor(device, id)
|
|
582
|
+
const answers = await Promise.all(Array.from({ length: 6 }, () => s.decide(token, "approve")))
|
|
583
|
+
expect(answers.map((a) => a.status)).toEqual(answers.map(() => 200))
|
|
584
|
+
expect(answers.filter((a) => a.body["replayed"] === false)).toHaveLength(1)
|
|
585
|
+
expect(new Set(answers.map((a) => a.body["status"]))).toEqual(new Set(["approved"]))
|
|
586
|
+
})
|
|
587
|
+
|
|
588
|
+
it("releases no recorded answer once the installation was signed out", async () => {
|
|
589
|
+
const { who, device } = await approver("sid")
|
|
590
|
+
const id = await order()
|
|
591
|
+
const token = await tokenFor(device, id)
|
|
592
|
+
expect((await s.decide(token, "approve")).status).toBe(200)
|
|
593
|
+
await signOutDevice(who)
|
|
594
|
+
expect(await s.decide(token, "approve")).toMatchObject({ status: 400, body: { _tag: "InvalidDecision" } })
|
|
595
|
+
})
|
|
596
|
+
|
|
597
|
+
it("releases no recorded answer once the token expired", async () => {
|
|
598
|
+
const { device } = await approver("tod")
|
|
599
|
+
const id = await order(2_000, "slowco")
|
|
600
|
+
const token = await tokenFor(device, id)
|
|
601
|
+
expect((await s.decide(token, "approve")).status).toBe(200)
|
|
602
|
+
await new Promise((resolve) => setTimeout(resolve, 2_500))
|
|
603
|
+
expect(await s.decide(token, "approve")).toMatchObject({ status: 410, body: { _tag: "DecisionExpired" } })
|
|
604
|
+
})
|
|
605
|
+
|
|
606
|
+
it("gives an agent no way to redeem a token: no action, no MCP tool", async () => {
|
|
607
|
+
const { who } = await approver("ida")
|
|
608
|
+
const viaAgent = await s.invoke({
|
|
609
|
+
action: "notifications.decide",
|
|
610
|
+
input: { token: "x".repeat(43), verdict: "approve" },
|
|
611
|
+
token: who.token,
|
|
612
|
+
surface: "agent",
|
|
613
|
+
})
|
|
614
|
+
expect(viaAgent.ok).toBe(false)
|
|
615
|
+
// MCP has no such tool (the client may throw rather than answer an error).
|
|
616
|
+
const viaMcp = await s
|
|
617
|
+
.invoke({
|
|
618
|
+
action: "notifications.decide",
|
|
619
|
+
input: { token: "x".repeat(43), verdict: "approve" },
|
|
620
|
+
token: who.token,
|
|
621
|
+
surface: "mcp",
|
|
622
|
+
})
|
|
623
|
+
.catch((error: unknown) => ({ ok: false as const, error: { _tag: String(error) } }))
|
|
624
|
+
expect(viaMcp.ok).toBe(false)
|
|
625
|
+
})
|
|
626
|
+
|
|
627
|
+
it("keeps the token out of the replicated notification, the delivery log, the audit log and the outbox", async () => {
|
|
628
|
+
const { device } = await approver("jo")
|
|
629
|
+
const id = await order()
|
|
630
|
+
const token = await tokenFor(device, id)
|
|
631
|
+
await s.decide(token, "approve")
|
|
632
|
+
const hash = [...new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(token)))]
|
|
633
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
634
|
+
.join("")
|
|
635
|
+
for (const table of [
|
|
636
|
+
"eloxiv_notifications.notification",
|
|
637
|
+
"eloxiv_notifications.delivery",
|
|
638
|
+
"eloxiv.audit_log",
|
|
639
|
+
"eloxiv.outbox",
|
|
640
|
+
"eloxiv.push_delivery",
|
|
641
|
+
"eloxiv.idempotency_key",
|
|
642
|
+
]) {
|
|
643
|
+
const [found] = await s.sql<{ n: number }>(
|
|
644
|
+
`SELECT count(*)::int AS n FROM ${table} t WHERE t::text LIKE $1 OR t::text LIKE $2`,
|
|
645
|
+
[`%${token}%`, `%${hash}%`],
|
|
646
|
+
)
|
|
647
|
+
expect({ table, n: found!.n }).toEqual({ table, n: 0 })
|
|
648
|
+
}
|
|
649
|
+
// Only its hash is stored.
|
|
650
|
+
expect(await s.sql(`SELECT 1 FROM eloxiv.notification_decision WHERE token_hash = $1`, [hash])).toHaveLength(1)
|
|
651
|
+
})
|
|
652
|
+
})
|