@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,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conformance kit for the NotificationChannel contract (docs/contracts/notification-channel.md), for an
|
|
3
|
+
* email channel: a message delivered to one recipient arrives at a real SMTP server with its headers (From,
|
|
4
|
+
* To, Subject, Message-ID, one-click unsubscribe, the channel's extra headers) and its text and HTML bodies
|
|
5
|
+
* intact; a temporary failure is a retryable `ChannelError`, a refused recipient or a message of another
|
|
6
|
+
* kind a permanent one, and an unreachable server a retryable one.
|
|
7
|
+
*
|
|
8
|
+
* The push channel's kit is `pushConformance` (`./Push.ts`, exported here too): the kernel's channel against APNs
|
|
9
|
+
* and FCM protocol fakes. Chat is a contract only (Messaging provides it).
|
|
10
|
+
*
|
|
11
|
+
* Usage: `emailChannelConformance(() => startMyChannel())`, where the subject delivers through the channel to
|
|
12
|
+
* an SMTP server it controls (see `EmailChannelSubject`).
|
|
13
|
+
*/
|
|
14
|
+
import type { ChannelMessage, EmailMessage } from "@eloxiv/contracts"
|
|
15
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest"
|
|
16
|
+
import type { ReceivedMail } from "../SmtpSink.ts"
|
|
17
|
+
|
|
18
|
+
export { pushConformance, type PushSubject } from "./Push.ts"
|
|
19
|
+
|
|
20
|
+
export type Delivery =
|
|
21
|
+
| { readonly ok: true; readonly providerId: string | null }
|
|
22
|
+
| {
|
|
23
|
+
readonly ok: false
|
|
24
|
+
readonly error: { readonly _tag: string; readonly retryable: boolean; readonly message: string }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface EmailChannelSubject {
|
|
28
|
+
/** NotificationChannel.deliver on the channel under test. */
|
|
29
|
+
readonly deliver: (message: ChannelMessage) => Promise<Delivery>
|
|
30
|
+
/** The same channel pointed at a server that does not answer. */
|
|
31
|
+
readonly deliverUnreachable: (message: ChannelMessage) => Promise<Delivery>
|
|
32
|
+
/** What the SMTP server received, and controls over it. */
|
|
33
|
+
readonly received: () => ReadonlyArray<ReceivedMail>
|
|
34
|
+
readonly failNext: (count: number) => void
|
|
35
|
+
readonly refuse: (address: string) => void
|
|
36
|
+
readonly dispose: () => Promise<void>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const message = (overrides: Partial<EmailMessage> = {}): EmailMessage => ({
|
|
40
|
+
kind: "email",
|
|
41
|
+
messageId: `kit-${crypto.randomUUID()}@eloxiv`,
|
|
42
|
+
from: "Eloxiv Kit <kit@eloxiv.test>",
|
|
43
|
+
to: `rcpt-${crypto.randomUUID().slice(0, 8)}@example.com`,
|
|
44
|
+
subject: "Kit subject",
|
|
45
|
+
text: "Plain text body",
|
|
46
|
+
html: "<p>HTML body</p>",
|
|
47
|
+
unsubscribeUrl: "https://app.example.com/notifications/unsubscribe?token=abc.def",
|
|
48
|
+
headers: { "X-Eloxiv-Category": "kit.category" },
|
|
49
|
+
...overrides,
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
export const emailChannelConformance = (start: () => Promise<EmailChannelSubject>) =>
|
|
53
|
+
describe("NotificationChannel contract (email)", () => {
|
|
54
|
+
let s: EmailChannelSubject
|
|
55
|
+
beforeAll(async () => {
|
|
56
|
+
s = await start()
|
|
57
|
+
})
|
|
58
|
+
afterAll(() => s?.dispose())
|
|
59
|
+
|
|
60
|
+
const arrived = (to: string) => s.received().filter((m) => m.to.includes(to))
|
|
61
|
+
|
|
62
|
+
it("delivers a message that arrives with its headers and both bodies", async () => {
|
|
63
|
+
const sent = message({
|
|
64
|
+
subject: "Grüße from Eloxiv — ünïcode",
|
|
65
|
+
text: "Hello\nsecond line",
|
|
66
|
+
html: "<p>Hello <b>you</b></p>",
|
|
67
|
+
})
|
|
68
|
+
const result = await s.deliver(sent)
|
|
69
|
+
expect(result.ok).toBe(true)
|
|
70
|
+
const [mail] = arrived(sent.to)
|
|
71
|
+
expect(mail).toBeDefined()
|
|
72
|
+
expect(mail!.from).toBe("kit@eloxiv.test")
|
|
73
|
+
expect(mail!.headers["from"]).toBe("Eloxiv Kit <kit@eloxiv.test>")
|
|
74
|
+
expect(mail!.headers["to"]).toBe(sent.to)
|
|
75
|
+
expect(mail!.headers["subject"]).toBe("Grüße from Eloxiv — ünïcode")
|
|
76
|
+
expect(mail!.headers["message-id"]).toBe(`<${sent.messageId}>`)
|
|
77
|
+
expect(mail!.headers["list-unsubscribe"]).toBe(`<${sent.unsubscribeUrl}>`)
|
|
78
|
+
expect(mail!.headers["list-unsubscribe-post"]).toBe("List-Unsubscribe=One-Click")
|
|
79
|
+
expect(mail!.headers["x-eloxiv-category"]).toBe("kit.category")
|
|
80
|
+
expect(mail!.headers["date"]).toBeDefined()
|
|
81
|
+
expect(mail!.text?.replaceAll("\r\n", "\n")).toBe("Hello\nsecond line")
|
|
82
|
+
expect(mail!.html).toBe("<p>Hello <b>you</b></p>")
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it("delivers text-only messages and keeps lines that start with a dot", async () => {
|
|
86
|
+
const sent = message({ html: null, unsubscribeUrl: null, text: ".leading dot\n..two dots\n.\nend" })
|
|
87
|
+
expect((await s.deliver(sent)).ok).toBe(true)
|
|
88
|
+
const [mail] = arrived(sent.to)
|
|
89
|
+
expect(mail!.html).toBeUndefined()
|
|
90
|
+
expect(mail!.headers["list-unsubscribe"]).toBeUndefined()
|
|
91
|
+
expect(mail!.text?.replaceAll("\r\n", "\n")).toBe(".leading dot\n..two dots\n.\nend")
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it("reports a temporary failure as retryable, and delivers on the retry", async () => {
|
|
95
|
+
const sent = message()
|
|
96
|
+
s.failNext(1)
|
|
97
|
+
const first = await s.deliver(sent)
|
|
98
|
+
expect(first).toMatchObject({ ok: false, error: { _tag: "ChannelError", retryable: true } })
|
|
99
|
+
expect(arrived(sent.to)).toEqual([])
|
|
100
|
+
expect((await s.deliver(sent)).ok).toBe(true)
|
|
101
|
+
expect(arrived(sent.to)).toHaveLength(1)
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
it("reports a refused recipient as permanent", async () => {
|
|
105
|
+
const sent = message()
|
|
106
|
+
s.refuse(sent.to)
|
|
107
|
+
expect(await s.deliver(sent)).toMatchObject({ ok: false, error: { _tag: "ChannelError", retryable: false } })
|
|
108
|
+
expect(arrived(sent.to)).toEqual([])
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it("reports an unreachable server as retryable", async () => {
|
|
112
|
+
expect(await s.deliverUnreachable(message())).toMatchObject({
|
|
113
|
+
ok: false,
|
|
114
|
+
error: { _tag: "ChannelError", retryable: true },
|
|
115
|
+
})
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it("refuses a message of another kind, permanently", async () => {
|
|
119
|
+
const push: ChannelMessage = { kind: "push", messageId: "p1", userId: "u1", title: "t", body: "b", url: null }
|
|
120
|
+
expect(await s.deliver(push)).toMatchObject({ ok: false, error: { _tag: "ChannelError", retryable: false } })
|
|
121
|
+
})
|
|
122
|
+
})
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conformance kit for the Notifications contract (docs/contracts/notifications.md) on the inbox conformance
|
|
3
|
+
* app: durable in-app notifications per recipient (sent by a subscriber through the kernel API, synced to
|
|
4
|
+
* the recipient only, marked and dismissed by them alone), and system email through the email channel to the
|
|
5
|
+
* subject's SMTP server: templates, organisation overrides and preview, per-user preferences, retries and
|
|
6
|
+
* permanent failures in the delivery log, and the one-click unsubscribe link with suppression.
|
|
7
|
+
*
|
|
8
|
+
* Usage, in a Vitest file: `notificationsConformance(() => startMyKernel())`.
|
|
9
|
+
*/
|
|
10
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest"
|
|
11
|
+
import type { ReceivedMail } from "../SmtpSink.ts"
|
|
12
|
+
import {
|
|
13
|
+
unique,
|
|
14
|
+
until,
|
|
15
|
+
type InboxOutcome,
|
|
16
|
+
type InboxSubject,
|
|
17
|
+
type InboxUser,
|
|
18
|
+
type StartInboxSubject,
|
|
19
|
+
} from "./InboxSubject.ts"
|
|
20
|
+
|
|
21
|
+
const ORG = "acme"
|
|
22
|
+
const MANAGE = "notifications.manage"
|
|
23
|
+
|
|
24
|
+
export const notificationsConformance = (start: StartInboxSubject) =>
|
|
25
|
+
describe("Notifications contract", () => {
|
|
26
|
+
let s: InboxSubject
|
|
27
|
+
let nina: InboxUser
|
|
28
|
+
let omar: InboxUser
|
|
29
|
+
|
|
30
|
+
beforeAll(async () => {
|
|
31
|
+
s = await start()
|
|
32
|
+
nina = await s.user("nina", ORG)
|
|
33
|
+
omar = await s.user("omar", ORG)
|
|
34
|
+
}, 120_000)
|
|
35
|
+
afterAll(() => s?.dispose())
|
|
36
|
+
|
|
37
|
+
const notificationsOf = (who: InboxUser, category: string) =>
|
|
38
|
+
s.sql<{
|
|
39
|
+
id: string
|
|
40
|
+
title: string
|
|
41
|
+
body: string
|
|
42
|
+
read_at: unknown
|
|
43
|
+
dismissed_at: unknown
|
|
44
|
+
link_id: string | null
|
|
45
|
+
}>(
|
|
46
|
+
`SELECT id, title, body, read_at, dismissed_at, link_id FROM eloxiv_notifications.notification
|
|
47
|
+
WHERE recipient_id = $1 AND category = $2 ORDER BY created_at`,
|
|
48
|
+
[who.id, category],
|
|
49
|
+
)
|
|
50
|
+
const mailTo = (who: InboxUser) => s.mail.messages().filter((m) => m.to.includes(who.email))
|
|
51
|
+
/** An agent asks for consent: the person gets a `consent.requested` notification, and email. */
|
|
52
|
+
const askConsent = async (who: InboxUser, payee = unique("payee")) => {
|
|
53
|
+
const outcome = await s.invoke({
|
|
54
|
+
action: "purchases.wire",
|
|
55
|
+
input: { amount: 1, payee },
|
|
56
|
+
token: who.token,
|
|
57
|
+
surface: "agent",
|
|
58
|
+
})
|
|
59
|
+
if (outcome.ok || outcome.error._tag !== "ConsentRequired") throw new Error(JSON.stringify(outcome))
|
|
60
|
+
return outcome.error["consentId"] as string
|
|
61
|
+
}
|
|
62
|
+
const notificationFor = async (who: InboxUser, consentId: string) =>
|
|
63
|
+
(await notificationsOf(who, "consent.requested")).find((n) => n.link_id === consentId)!
|
|
64
|
+
/** The email sent for the notification of a consent request (matched on the notification's id header). */
|
|
65
|
+
const emailFor = async (who: InboxUser, consentId: string): Promise<ReceivedMail> => {
|
|
66
|
+
const id = notificationIdCache.get(consentId) ?? (await remember(who, consentId))
|
|
67
|
+
const mail = await until(
|
|
68
|
+
`the email for ${consentId}`,
|
|
69
|
+
async () => mailTo(who).find((m) => m.headers["x-eloxiv-notification"] === id),
|
|
70
|
+
(m) => m !== undefined,
|
|
71
|
+
)
|
|
72
|
+
return mail!
|
|
73
|
+
}
|
|
74
|
+
const notificationIdCache = new Map<string, string>()
|
|
75
|
+
const remember = async (who: InboxUser, consentId: string) => {
|
|
76
|
+
const n = await notificationFor(who, consentId)
|
|
77
|
+
notificationIdCache.set(consentId, n.id)
|
|
78
|
+
return n.id
|
|
79
|
+
}
|
|
80
|
+
const act = (who: InboxUser, action: string, input: Record<string, unknown>): Promise<InboxOutcome> =>
|
|
81
|
+
s.invoke({ action: `notifications.${action}`, input, token: who.token })
|
|
82
|
+
|
|
83
|
+
it("lets a subscriber notify through the kernel API: the recipient gets a durable in-app notification", async () => {
|
|
84
|
+
const outcome = await s.invoke({
|
|
85
|
+
action: "purchases.order",
|
|
86
|
+
input: { item: unique("cups"), amount: 9 },
|
|
87
|
+
token: nina.token,
|
|
88
|
+
})
|
|
89
|
+
const orderId = (outcome as { result: { output: { id: string } } }).result.output.id
|
|
90
|
+
const [note] = await until(
|
|
91
|
+
"the order notification",
|
|
92
|
+
() => notificationsOf(nina, "purchases.ordered"),
|
|
93
|
+
(rows) => rows.some((r) => r.link_id === orderId),
|
|
94
|
+
).then((rows) => rows.filter((r) => r.link_id === orderId))
|
|
95
|
+
expect(note).toMatchObject({ title: "Order placed", read_at: null, dismissed_at: null })
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it("syncs a notification to its recipient only, who alone marks and dismisses it", async () => {
|
|
99
|
+
const consentId = await askConsent(nina)
|
|
100
|
+
const id = await remember(nina, consentId)
|
|
101
|
+
const mine = await s.selected(
|
|
102
|
+
await s.query(nina.token, "notifications.mine"),
|
|
103
|
+
"eloxiv_notifications.notification",
|
|
104
|
+
)
|
|
105
|
+
expect(mine).toContain(id)
|
|
106
|
+
const theirs = await s.selected(
|
|
107
|
+
await s.query(omar.token, "notifications.mine"),
|
|
108
|
+
"eloxiv_notifications.notification",
|
|
109
|
+
)
|
|
110
|
+
expect(theirs).not.toContain(id)
|
|
111
|
+
expect(await act(omar, "markRead", { id })).toMatchObject({ ok: false, error: { _tag: "Forbidden" } })
|
|
112
|
+
expect(await act(nina, "markRead", { id })).toMatchObject({ ok: true })
|
|
113
|
+
expect((await notificationFor(nina, consentId)).read_at).not.toBeNull()
|
|
114
|
+
expect(await act(nina, "markUnread", { id })).toMatchObject({ ok: true })
|
|
115
|
+
expect((await notificationFor(nina, consentId)).read_at).toBeNull()
|
|
116
|
+
expect(await act(omar, "dismiss", { id })).toMatchObject({ ok: false, error: { _tag: "Forbidden" } })
|
|
117
|
+
expect(await act(nina, "dismiss", { id })).toMatchObject({ ok: true })
|
|
118
|
+
expect((await notificationFor(nina, consentId)).dismissed_at).not.toBeNull()
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
it("lists and counts a person's own unread notifications, which marking and dismissing change", async () => {
|
|
122
|
+
const category = unique("reminders")
|
|
123
|
+
const titles = [unique("first"), unique("second")]
|
|
124
|
+
for (const title of titles) {
|
|
125
|
+
expect(await act(nina, "notify", { title, body: "later", category })).toMatchObject({ ok: true })
|
|
126
|
+
}
|
|
127
|
+
const count = async (who: InboxUser) =>
|
|
128
|
+
((await act(who, "count", { category })) as { result: { output: { unread: number } } }).result.output.unread
|
|
129
|
+
const listed = async (who: InboxUser, input: Record<string, unknown> = {}) =>
|
|
130
|
+
(
|
|
131
|
+
(await act(who, "list", { category, ...input })) as {
|
|
132
|
+
result: { output: { notifications: ReadonlyArray<{ id: string; title: string }> } }
|
|
133
|
+
}
|
|
134
|
+
).result.output.notifications
|
|
135
|
+
expect(await count(nina)).toBe(2)
|
|
136
|
+
// Newest first; never another person's.
|
|
137
|
+
expect((await listed(nina)).map((n) => n.title)).toEqual(titles.toReversed())
|
|
138
|
+
expect(await listed(omar)).toEqual([])
|
|
139
|
+
expect(await count(omar)).toBe(0)
|
|
140
|
+
const [newest, oldest] = await listed(nina)
|
|
141
|
+
expect(await act(nina, "markRead", { id: newest!.id })).toMatchObject({ ok: true })
|
|
142
|
+
expect(await count(nina)).toBe(1)
|
|
143
|
+
expect((await listed(nina, { unreadOnly: true })).map((n) => n.id)).toEqual([oldest!.id])
|
|
144
|
+
expect(await act(nina, "dismiss", { id: oldest!.id })).toMatchObject({ ok: true })
|
|
145
|
+
expect(await count(nina)).toBe(0)
|
|
146
|
+
expect((await listed(nina)).map((n) => n.id)).toEqual([newest!.id])
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it("lets a person or their agent notify themselves, and other members only with notifications.send", async () => {
|
|
150
|
+
const category = unique("sent")
|
|
151
|
+
const session = await s.agentSession(nina, ORG)
|
|
152
|
+
const toSelf = await s.invoke({
|
|
153
|
+
action: "notifications.notify",
|
|
154
|
+
input: { title: "Report ready", body: "The export finished", category },
|
|
155
|
+
token: session.token,
|
|
156
|
+
surface: "agent",
|
|
157
|
+
})
|
|
158
|
+
expect(toSelf).toMatchObject({ ok: true })
|
|
159
|
+
expect((await notificationsOf(nina, category)).map((n) => n.title)).toEqual(["Report ready"])
|
|
160
|
+
const toOmar = { title: "Heads up", body: "Look at this", category, recipients: [omar.id] }
|
|
161
|
+
expect(await act(nina, "notify", toOmar)).toMatchObject({ ok: false, error: { _tag: "Forbidden" } })
|
|
162
|
+
expect(await notificationsOf(omar, category)).toEqual([])
|
|
163
|
+
const role = unique("senders")
|
|
164
|
+
await s.role(ORG, role, ["notifications.send"])
|
|
165
|
+
await s.assignRole(nina.id, ORG, role)
|
|
166
|
+
const sender = await s.user("nina", ORG)
|
|
167
|
+
expect(await act(sender, "notify", toOmar)).toMatchObject({ ok: true })
|
|
168
|
+
expect((await notificationsOf(omar, category)).map((n) => n.title)).toEqual(["Heads up"])
|
|
169
|
+
await s.unassignRole(nina.id, ORG, role)
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
it("lists the delivery log: a person's own deliveries, and with notifications.manage the organisation's", async () => {
|
|
173
|
+
const consentId = await askConsent(nina)
|
|
174
|
+
const id = await remember(nina, consentId)
|
|
175
|
+
await emailFor(nina, consentId)
|
|
176
|
+
const log = async (who: InboxUser) =>
|
|
177
|
+
(
|
|
178
|
+
(await act(who, "deliveryLog", { notificationId: id })) as {
|
|
179
|
+
result: { output: { deliveries: ReadonlyArray<{ recipientId: string; channel: string; status: string }> } }
|
|
180
|
+
}
|
|
181
|
+
).result.output.deliveries
|
|
182
|
+
expect((await log(nina)).map((d) => [d.recipientId, d.channel, d.status])).toEqual([[nina.id, "email", "sent"]])
|
|
183
|
+
// Another member sees none of it; one who manages notifications does.
|
|
184
|
+
expect(await log(omar)).toEqual([])
|
|
185
|
+
const role = unique("mail-admins")
|
|
186
|
+
await s.role(ORG, role, [MANAGE])
|
|
187
|
+
await s.assignRole(omar.id, ORG, role)
|
|
188
|
+
const manager = await s.user("omar", ORG)
|
|
189
|
+
expect((await log(manager)).map((d) => d.recipientId)).toEqual([nina.id])
|
|
190
|
+
await s.unassignRole(omar.id, ORG, role)
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
it("sends system email from the template, with a stable Message-ID and a one-click unsubscribe link", async () => {
|
|
194
|
+
const consentId = await askConsent(nina)
|
|
195
|
+
const id = await remember(nina, consentId)
|
|
196
|
+
const mail = await emailFor(nina, consentId)
|
|
197
|
+
expect(mail.from).toBe("noreply@eloxiv.test")
|
|
198
|
+
expect(mail.to).toEqual([nina.email])
|
|
199
|
+
expect(mail.headers["from"]).toBe("Eloxiv <noreply@eloxiv.test>")
|
|
200
|
+
// Named as people see the action (its title), never by its id.
|
|
201
|
+
expect(mail.headers["subject"]).toBe("Your agent wants to: Wire money")
|
|
202
|
+
expect(mail.headers["message-id"]).toMatch(/^<dlv_[0-9a-f]+@eloxiv>$/)
|
|
203
|
+
expect(mail.headers["x-eloxiv-category"]).toBe("consent.requested")
|
|
204
|
+
expect(mail.headers["list-unsubscribe"]).toMatch(/^<https?:\/\/[^>]+\/notifications\/unsubscribe\?token=[^>]+>$/)
|
|
205
|
+
expect(mail.headers["list-unsubscribe-post"]).toBe("List-Unsubscribe=One-Click")
|
|
206
|
+
expect(mail.text).toContain("Your agent wants to: Wire money.")
|
|
207
|
+
expect(mail.html).toContain("<strong>Wire money</strong>")
|
|
208
|
+
expect(mail.text).not.toContain("purchases.wire")
|
|
209
|
+
// Variables are escaped in HTML (the details are JSON with quotes).
|
|
210
|
+
expect(mail.html).toContain(""payee"")
|
|
211
|
+
// The delivery log records the send once the delivery commits (just after the server accepted it).
|
|
212
|
+
const [delivery] = await until(
|
|
213
|
+
"the delivery log",
|
|
214
|
+
() => s.deliveries(ORG, id),
|
|
215
|
+
(d) => d[0]?.status !== "pending",
|
|
216
|
+
)
|
|
217
|
+
expect(delivery).toMatchObject({ channel: "email", status: "sent", attempts: 1 })
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
it("retries a temporary failure through the outbox, and records the attempts", async () => {
|
|
221
|
+
s.mail.failNext(2)
|
|
222
|
+
const consentId = await askConsent(nina)
|
|
223
|
+
const id = await remember(nina, consentId)
|
|
224
|
+
await emailFor(nina, consentId)
|
|
225
|
+
const [delivery] = await until(
|
|
226
|
+
"the delivery log",
|
|
227
|
+
() => s.deliveries(ORG, id),
|
|
228
|
+
(d) => d[0]?.status === "sent",
|
|
229
|
+
)
|
|
230
|
+
expect(delivery).toMatchObject({ status: "sent", attempts: 3 })
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
it("records a permanent failure once, without retrying", async () => {
|
|
234
|
+
const pat = await s.user(unique("pat"), ORG)
|
|
235
|
+
s.mail.refuse(pat.email)
|
|
236
|
+
const consentId = await askConsent(pat)
|
|
237
|
+
const id = await remember(pat, consentId)
|
|
238
|
+
const [delivery] = await until(
|
|
239
|
+
"the failed delivery",
|
|
240
|
+
() => s.deliveries(ORG, id),
|
|
241
|
+
(d) => d[0]?.status === "failed",
|
|
242
|
+
)
|
|
243
|
+
expect(delivery).toMatchObject({ status: "failed", attempts: 1 })
|
|
244
|
+
expect(mailTo(pat)).toEqual([])
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
it("follows each person's preference: a category without email stays in-app", async () => {
|
|
248
|
+
const quiet = await s.user(unique("quiet"), ORG)
|
|
249
|
+
expect(await act(quiet, "setPreference", { category: "consent.requested", channels: ["in-app"] })).toMatchObject({
|
|
250
|
+
ok: true,
|
|
251
|
+
})
|
|
252
|
+
const consentId = await askConsent(quiet)
|
|
253
|
+
const id = await remember(quiet, consentId)
|
|
254
|
+
expect(await s.deliveries(ORG, id)).toEqual([])
|
|
255
|
+
await new Promise((r) => setTimeout(r, 300))
|
|
256
|
+
expect(mailTo(quiet)).toEqual([])
|
|
257
|
+
})
|
|
258
|
+
|
|
259
|
+
it("lets managers override a template for the organisation, previewed and then sent", async () => {
|
|
260
|
+
const mona = await s.user(unique("mona"), ORG)
|
|
261
|
+
const override = {
|
|
262
|
+
template: "consent.requested",
|
|
263
|
+
subject: "Agent request: {{action}}",
|
|
264
|
+
text: "Please look at {{action}} ({{actionName}}).",
|
|
265
|
+
html: "<p>Please look at <em>{{action}}</em>.</p>",
|
|
266
|
+
}
|
|
267
|
+
expect(await act(mona, "setEmailTemplate", override)).toMatchObject({ ok: false, error: { _tag: "Forbidden" } })
|
|
268
|
+
await s.role(ORG, "notifier", [MANAGE])
|
|
269
|
+
await s.assignRole(mona.id, ORG, "notifier")
|
|
270
|
+
expect(await act(mona, "setEmailTemplate", override)).toMatchObject({ ok: true })
|
|
271
|
+
expect(await s.preview(ORG, "consent.requested", { action: "x.y", actionName: "x.y", details: "" })).toEqual({
|
|
272
|
+
subject: "Agent request: x.y",
|
|
273
|
+
text: "Please look at x.y (x.y).",
|
|
274
|
+
html: "<p>Please look at <em>x.y</em>.</p>",
|
|
275
|
+
overridden: true,
|
|
276
|
+
})
|
|
277
|
+
// Another organisation keeps the registered template.
|
|
278
|
+
expect(await s.preview("globex", "consent.requested", { action: "x.y", details: "" })).toMatchObject({
|
|
279
|
+
subject: "Your agent wants to: x.y",
|
|
280
|
+
overridden: false,
|
|
281
|
+
})
|
|
282
|
+
await expect(s.preview(ORG, "no.such.template", {})).rejects.toMatchObject({ _tag: "UnknownTemplate" })
|
|
283
|
+
const consentId = await askConsent(omar)
|
|
284
|
+
await remember(omar, consentId)
|
|
285
|
+
const mail = await until(
|
|
286
|
+
"the overridden email",
|
|
287
|
+
async () => mailTo(omar).find((m) => m.headers["subject"] === "Agent request: Wire money"),
|
|
288
|
+
(m) => m !== undefined,
|
|
289
|
+
)
|
|
290
|
+
// `{{action}}` is what people see the action called (its title); `{{actionName}}` its id.
|
|
291
|
+
expect(mail?.text).toBe("Please look at Wire money (purchases.wire).")
|
|
292
|
+
})
|
|
293
|
+
|
|
294
|
+
it("unsubscribes the recipient from a category through the link, suppressing that address, audited", async () => {
|
|
295
|
+
const una = await s.user(unique("una"), ORG)
|
|
296
|
+
const first = await askConsent(una)
|
|
297
|
+
await remember(una, first)
|
|
298
|
+
const mail = await emailFor(una, first)
|
|
299
|
+
const url = /^<(.+)>$/.exec(mail.headers["list-unsubscribe"]!)![1]!
|
|
300
|
+
expect((await s.unsubscribe(url.replace(/token=[^&]+/, "token=forged.signature"))).status).toBe(400)
|
|
301
|
+
expect((await s.unsubscribe(url)).status).toBe(200)
|
|
302
|
+
const audited = (await s.audit({ action: "notifications.unsubscribe" })).filter((r) => r.actorUserId === una.id)
|
|
303
|
+
expect(audited).toHaveLength(1)
|
|
304
|
+
// Email is off for the category now.
|
|
305
|
+
const second = await askConsent(una)
|
|
306
|
+
const secondId = await remember(una, second)
|
|
307
|
+
expect(await s.deliveries(ORG, secondId)).toEqual([])
|
|
308
|
+
// Turning email back on still reaches no one: the address is suppressed for the category.
|
|
309
|
+
await act(una, "setPreference", { category: "consent.requested", channels: ["email"] })
|
|
310
|
+
const third = await askConsent(una)
|
|
311
|
+
const thirdId = await remember(una, third)
|
|
312
|
+
expect(await s.deliveries(ORG, thirdId)).toMatchObject([{ channel: "email", status: "suppressed" }])
|
|
313
|
+
await new Promise((r) => setTimeout(r, 300))
|
|
314
|
+
expect(mailTo(una)).toHaveLength(1)
|
|
315
|
+
})
|
|
316
|
+
})
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an outside client does against a kernel's OAuth authorisation server, in plain HTTP: register,
|
|
3
|
+
* authorise with PKCE through the kernel's pages (a cookie jar and form posts, as a browser would), exchange
|
|
4
|
+
* codes, refresh, revoke, run the device flow, and call actions with the resulting tokens. Used by the
|
|
5
|
+
* MachineIdentity kit and by tests of the CLI.
|
|
6
|
+
*/
|
|
7
|
+
import type { OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js"
|
|
8
|
+
import { createHash, randomBytes } from "node:crypto"
|
|
9
|
+
|
|
10
|
+
export const pkcePair = () => {
|
|
11
|
+
const verifier = randomBytes(32).toString("base64url")
|
|
12
|
+
return { verifier, challenge: createHash("sha256").update(verifier).digest("base64url") }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface Registered {
|
|
16
|
+
readonly client_id: string
|
|
17
|
+
readonly client_secret?: string | undefined
|
|
18
|
+
readonly redirect_uris: ReadonlyArray<string>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface TokenSet {
|
|
22
|
+
readonly access_token: string
|
|
23
|
+
readonly refresh_token: string
|
|
24
|
+
readonly expires_in: number
|
|
25
|
+
readonly scope: string
|
|
26
|
+
readonly token_type: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type TokenAnswer =
|
|
30
|
+
| { readonly ok: true; readonly tokens: TokenSet }
|
|
31
|
+
| { readonly ok: false; readonly status: number; readonly error: string; readonly description: string }
|
|
32
|
+
|
|
33
|
+
export const REDIRECT = "http://127.0.0.1:7/callback"
|
|
34
|
+
|
|
35
|
+
/** A browser: cookies kept across requests, redirects not followed (the caller follows what it must). */
|
|
36
|
+
export const browser = (base: string) => {
|
|
37
|
+
const cookies = new Map<string, string>()
|
|
38
|
+
const absorb = (response: Response) => {
|
|
39
|
+
for (const cookie of response.headers.getSetCookie()) {
|
|
40
|
+
const [pair] = cookie.split(";")
|
|
41
|
+
const eq = pair!.indexOf("=")
|
|
42
|
+
cookies.set(pair!.slice(0, eq).trim(), pair!.slice(eq + 1).trim())
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const request = async (path: string, init: RequestInit = {}) => {
|
|
46
|
+
const url = path.startsWith("http") ? path : `${base}${path}`
|
|
47
|
+
const headers = new Headers(init.headers)
|
|
48
|
+
if (cookies.size > 0) headers.set("cookie", [...cookies].map(([k, v]) => `${k}=${v}`).join("; "))
|
|
49
|
+
const response = await fetch(url, { ...init, headers, redirect: "manual" })
|
|
50
|
+
absorb(response)
|
|
51
|
+
return response
|
|
52
|
+
}
|
|
53
|
+
const post = (path: string, form: Record<string, string>, extra: Record<string, string> = {}) =>
|
|
54
|
+
request(path, {
|
|
55
|
+
method: "POST",
|
|
56
|
+
headers: { "content-type": "application/x-www-form-urlencoded", origin: new URL(base).origin, ...extra },
|
|
57
|
+
body: new URLSearchParams(form).toString(),
|
|
58
|
+
})
|
|
59
|
+
return { request, post, cookies }
|
|
60
|
+
}
|
|
61
|
+
export type Browser = ReturnType<typeof browser>
|
|
62
|
+
|
|
63
|
+
/** A hidden or named input's value in a page. */
|
|
64
|
+
export const field = (html: string, name: string) =>
|
|
65
|
+
new RegExp(`name="${name}" value="([^"]*)"`, "u").exec(html)?.[1]?.replaceAll("&", "&")
|
|
66
|
+
|
|
67
|
+
/** The first option of the organisation select whose value is `org`, if the page offers it. */
|
|
68
|
+
export const offersOrg = (html: string, org: string) => html.includes(`<option value="${org}">`)
|
|
69
|
+
|
|
70
|
+
export const signInThroughPage = async (b: Browser, page: string, email: string, password: string) => {
|
|
71
|
+
const returnTo = field(page, "return_to")
|
|
72
|
+
if (returnTo === undefined) throw new Error(`Not a sign-in page:\n${page}`)
|
|
73
|
+
const response = await b.post("/oauth/sign-in", { email, password, return_to: returnTo })
|
|
74
|
+
if (response.status !== 303) throw new Error(`Sign-in failed with ${response.status}: ${await response.text()}`)
|
|
75
|
+
return response.headers.get("location")!
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Drive the authorisation page as `email`: open the authorisation URL, sign in if asked, pick `org` and
|
|
80
|
+
* answer. Returns the final redirect (to the client's redirect URI) or the page the kernel showed instead.
|
|
81
|
+
*/
|
|
82
|
+
export const authorizeInBrowser = async (
|
|
83
|
+
b: Browser,
|
|
84
|
+
authorizationUrl: string,
|
|
85
|
+
user: { readonly email: string; readonly password: string },
|
|
86
|
+
org: string,
|
|
87
|
+
decision: "approve" | "deny" = "approve",
|
|
88
|
+
): Promise<{ readonly redirect: URL } | { readonly status: number; readonly page: string }> => {
|
|
89
|
+
let response = await b.request(authorizationUrl)
|
|
90
|
+
if (response.status !== 303) return { status: response.status, page: await response.text() }
|
|
91
|
+
const target = response.headers.get("location")!
|
|
92
|
+
if (!target.startsWith("/")) return { redirect: new URL(target) }
|
|
93
|
+
response = await b.request(target)
|
|
94
|
+
let page = await response.text()
|
|
95
|
+
if (field(page, "return_to") !== undefined) {
|
|
96
|
+
const back = await signInThroughPage(b, page, user.email, user.password)
|
|
97
|
+
response = await b.request(back)
|
|
98
|
+
page = await response.text()
|
|
99
|
+
}
|
|
100
|
+
const request = field(page, "request")
|
|
101
|
+
const csrf = field(page, "csrf")
|
|
102
|
+
if (request === undefined || csrf === undefined) return { status: response.status, page }
|
|
103
|
+
const answer = await b.post("/oauth/consent", { request, csrf, org, decision })
|
|
104
|
+
if (answer.status !== 303) return { status: answer.status, page: await answer.text() }
|
|
105
|
+
return { redirect: new URL(answer.headers.get("location")!) }
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const oauthClient = (base: string) => {
|
|
109
|
+
const form = async (path: string, params: Record<string, string | undefined>, basic?: string) => {
|
|
110
|
+
const body = new URLSearchParams()
|
|
111
|
+
for (const [key, value] of Object.entries(params)) if (value !== undefined) body.set(key, value)
|
|
112
|
+
const headers: Record<string, string> = { "content-type": "application/x-www-form-urlencoded" }
|
|
113
|
+
if (basic !== undefined) headers["authorization"] = `Basic ${basic}`
|
|
114
|
+
return fetch(`${base}${path}`, { method: "POST", headers, body })
|
|
115
|
+
}
|
|
116
|
+
const register = async (metadata: Record<string, unknown>) => {
|
|
117
|
+
const response = await fetch(`${base}/oauth/register`, {
|
|
118
|
+
method: "POST",
|
|
119
|
+
headers: { "content-type": "application/json" },
|
|
120
|
+
body: JSON.stringify(metadata),
|
|
121
|
+
})
|
|
122
|
+
return { status: response.status, body: (await response.json()) as Registered & { error?: string } }
|
|
123
|
+
}
|
|
124
|
+
const registerPublic = async (grantTypes = ["authorization_code", "refresh_token"], redirect = REDIRECT) => {
|
|
125
|
+
const { status, body } = await register({
|
|
126
|
+
client_name: "Conformance client",
|
|
127
|
+
redirect_uris: grantTypes.includes("authorization_code") ? [redirect] : [],
|
|
128
|
+
grant_types: grantTypes,
|
|
129
|
+
token_endpoint_auth_method: "none",
|
|
130
|
+
})
|
|
131
|
+
if (status !== 201) throw new Error(`Registration failed with ${status}: ${JSON.stringify(body)}`)
|
|
132
|
+
return body
|
|
133
|
+
}
|
|
134
|
+
const token = async (params: Record<string, string | undefined>, basic?: string): Promise<TokenAnswer> => {
|
|
135
|
+
const response = await form("/oauth/token", params, basic)
|
|
136
|
+
const body = (await response.json()) as Record<string, string>
|
|
137
|
+
if (response.ok) return { ok: true, tokens: body as unknown as TokenSet }
|
|
138
|
+
return {
|
|
139
|
+
ok: false,
|
|
140
|
+
status: response.status,
|
|
141
|
+
error: body["error"] ?? "",
|
|
142
|
+
description: body["error_description"] ?? "",
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const authorizationUrl = (params: Record<string, string | undefined>) => {
|
|
146
|
+
const url = new URL(`${base}/oauth/authorize`)
|
|
147
|
+
for (const [key, value] of Object.entries(params)) if (value !== undefined) url.searchParams.set(key, value)
|
|
148
|
+
return url.toString()
|
|
149
|
+
}
|
|
150
|
+
const revoke = (params: Record<string, string | undefined>) => form("/oauth/revoke", params)
|
|
151
|
+
const deviceAuthorization = async (params: Record<string, string | undefined>) => {
|
|
152
|
+
const response = await form("/oauth/device_authorization", params)
|
|
153
|
+
return { status: response.status, body: (await response.json()) as Record<string, any> }
|
|
154
|
+
}
|
|
155
|
+
return { register, registerPublic, token, authorizationUrl, revoke, deviceAuthorization, form }
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Call an action over HTTP with a bearer token; the envelope, or the error's tag and status. */
|
|
159
|
+
export const callAction = async (
|
|
160
|
+
base: string,
|
|
161
|
+
token: string,
|
|
162
|
+
action: string,
|
|
163
|
+
input: unknown,
|
|
164
|
+
headers: Record<string, string> = {},
|
|
165
|
+
): Promise<{ readonly status: number; readonly body: Record<string, any> }> => {
|
|
166
|
+
const response = await fetch(`${base}/api/actions/${action}`, {
|
|
167
|
+
method: "POST",
|
|
168
|
+
headers: { authorization: `Bearer ${token}`, "content-type": "application/json", ...headers },
|
|
169
|
+
body: JSON.stringify(input),
|
|
170
|
+
})
|
|
171
|
+
const text = await response.text()
|
|
172
|
+
return { status: response.status, body: text.length > 0 ? (JSON.parse(text) as Record<string, any>) : {} }
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** A JSON-RPC `tools/call` to `/mcp` in one request (no session), with a bearer token. */
|
|
176
|
+
export const callMcpTool = async (base: string, token: string, tool: string, args: unknown) => {
|
|
177
|
+
const response = await fetch(`${base}/mcp`, {
|
|
178
|
+
method: "POST",
|
|
179
|
+
headers: {
|
|
180
|
+
authorization: `Bearer ${token}`,
|
|
181
|
+
"content-type": "application/json",
|
|
182
|
+
accept: "application/json, text/event-stream",
|
|
183
|
+
"mcp-protocol-version": "2025-06-18",
|
|
184
|
+
},
|
|
185
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call", params: { name: tool, arguments: args } }),
|
|
186
|
+
})
|
|
187
|
+
const text = await response.text()
|
|
188
|
+
return { status: response.status, challenge: response.headers.get("www-authenticate"), text }
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The OAuth side of an MCP host (`@modelcontextprotocol/sdk`'s `OAuthClientProvider`), as Claude Code or another
|
|
193
|
+
* host implements it: it registers dynamically as a public client, keeps the PKCE verifier and the tokens, and
|
|
194
|
+
* records where it was sent to authorise (a host opens that URL in the person's browser; tests drive the pages
|
|
195
|
+
* with `authorizeInBrowser`). `scope` asks for a narrower scope than the default `actions`.
|
|
196
|
+
*/
|
|
197
|
+
export class McpOAuthProvider implements OAuthClientProvider {
|
|
198
|
+
authorization: URL | undefined
|
|
199
|
+
private info: any
|
|
200
|
+
private saved: any
|
|
201
|
+
private verifier = ""
|
|
202
|
+
private readonly options: { readonly name?: string; readonly scope?: string; readonly redirect?: string }
|
|
203
|
+
constructor(options: { readonly name?: string; readonly scope?: string; readonly redirect?: string } = {}) {
|
|
204
|
+
this.options = options
|
|
205
|
+
}
|
|
206
|
+
get redirectUrl() {
|
|
207
|
+
return this.options.redirect ?? REDIRECT
|
|
208
|
+
}
|
|
209
|
+
get clientMetadata() {
|
|
210
|
+
return {
|
|
211
|
+
client_name: this.options.name ?? "Conformance agent",
|
|
212
|
+
redirect_uris: [this.redirectUrl],
|
|
213
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
214
|
+
response_types: ["code"],
|
|
215
|
+
token_endpoint_auth_method: "none",
|
|
216
|
+
...(this.options.scope === undefined ? {} : { scope: this.options.scope }),
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
clientInformation() {
|
|
220
|
+
return this.info
|
|
221
|
+
}
|
|
222
|
+
saveClientInformation(info: unknown) {
|
|
223
|
+
this.info = info
|
|
224
|
+
}
|
|
225
|
+
tokens() {
|
|
226
|
+
return this.saved
|
|
227
|
+
}
|
|
228
|
+
saveTokens(tokens: unknown) {
|
|
229
|
+
this.saved = tokens
|
|
230
|
+
}
|
|
231
|
+
redirectToAuthorization(url: URL) {
|
|
232
|
+
this.authorization = url
|
|
233
|
+
}
|
|
234
|
+
saveCodeVerifier(verifier: string) {
|
|
235
|
+
this.verifier = verifier
|
|
236
|
+
}
|
|
237
|
+
codeVerifier() {
|
|
238
|
+
return this.verifier
|
|
239
|
+
}
|
|
240
|
+
}
|