@eloxiv/kernel 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +6 -2
- package/dist/AccountMail.d.ts +40 -0
- package/dist/AccountMail.d.ts.map +1 -0
- package/dist/AccountMail.js +169 -0
- package/dist/AccountMail.js.map +1 -0
- package/dist/AppConfig.d.ts +72 -0
- package/dist/AppConfig.d.ts.map +1 -0
- package/dist/AppConfig.js +87 -0
- package/dist/AppConfig.js.map +1 -0
- package/dist/Approvals.d.ts +132 -0
- package/dist/Approvals.d.ts.map +1 -0
- package/dist/Approvals.js +342 -0
- package/dist/Approvals.js.map +1 -0
- package/dist/Audit.d.ts +93 -0
- package/dist/Audit.d.ts.map +1 -0
- package/dist/Audit.js +275 -0
- package/dist/Audit.js.map +1 -0
- package/dist/AuthSeam.d.ts +58 -0
- package/dist/AuthSeam.d.ts.map +1 -0
- package/dist/AuthSeam.js +101 -0
- package/dist/AuthSeam.js.map +1 -0
- package/dist/Authority.d.ts +160 -0
- package/dist/Authority.d.ts.map +1 -0
- package/dist/Authority.js +325 -0
- package/dist/Authority.js.map +1 -0
- package/dist/Avatars.d.ts +26 -0
- package/dist/Avatars.d.ts.map +1 -0
- package/dist/Avatars.js +140 -0
- package/dist/Avatars.js.map +1 -0
- package/dist/Base64url.d.ts +9 -0
- package/dist/Base64url.d.ts.map +1 -0
- package/dist/Base64url.js +26 -0
- package/dist/Base64url.js.map +1 -0
- package/dist/BasePath.d.ts +39 -0
- package/dist/BasePath.d.ts.map +1 -0
- package/dist/BasePath.js +70 -0
- package/dist/BasePath.js.map +1 -0
- package/dist/CallActed.d.ts +10 -0
- package/dist/CallActed.d.ts.map +1 -0
- package/dist/CallActed.js +10 -0
- package/dist/CallActed.js.map +1 -0
- package/dist/Config.d.ts +459 -0
- package/dist/Config.d.ts.map +1 -0
- package/dist/Config.js +415 -0
- package/dist/Config.js.map +1 -0
- package/dist/DeliveryPolicy.d.ts +20 -0
- package/dist/DeliveryPolicy.d.ts.map +1 -0
- package/dist/DeliveryPolicy.js +35 -0
- package/dist/DeliveryPolicy.js.map +1 -0
- package/dist/DesktopSignIn.d.ts +24 -0
- package/dist/DesktopSignIn.d.ts.map +1 -0
- package/dist/DesktopSignIn.js +148 -0
- package/dist/DesktopSignIn.js.map +1 -0
- package/dist/Directory.d.ts +179 -0
- package/dist/Directory.d.ts.map +1 -0
- package/dist/Directory.js +1184 -0
- package/dist/Directory.js.map +1 -0
- package/dist/Flags.d.ts +59 -0
- package/dist/Flags.d.ts.map +1 -0
- package/dist/Flags.js +195 -0
- package/dist/Flags.js.map +1 -0
- package/dist/Gate.d.ts +42 -0
- package/dist/Gate.d.ts.map +1 -0
- package/dist/Gate.js +132 -0
- package/dist/Gate.js.map +1 -0
- package/dist/Hash.d.ts +4 -0
- package/dist/Hash.d.ts.map +1 -0
- package/dist/Hash.js +16 -0
- package/dist/Hash.js.map +1 -0
- package/dist/Identity.d.ts +327 -0
- package/dist/Identity.d.ts.map +1 -0
- package/dist/Identity.js +1232 -0
- package/dist/Identity.js.map +1 -0
- package/dist/IntervalJob.d.ts +40 -0
- package/dist/IntervalJob.d.ts.map +1 -0
- package/dist/IntervalJob.js +76 -0
- package/dist/IntervalJob.js.map +1 -0
- package/dist/Invocation.d.ts +210 -0
- package/dist/Invocation.d.ts.map +1 -0
- package/dist/Invocation.js +1680 -0
- package/dist/Invocation.js.map +1 -0
- package/dist/KernelHandlers.d.ts +19 -0
- package/dist/KernelHandlers.d.ts.map +1 -0
- package/dist/KernelHandlers.js +15 -0
- package/dist/KernelHandlers.js.map +1 -0
- package/dist/KernelModule.d.ts +65 -0
- package/dist/KernelModule.d.ts.map +1 -0
- package/dist/KernelModule.js +116 -0
- package/dist/KernelModule.js.map +1 -0
- package/dist/MemberRoutes.d.ts +6 -0
- package/dist/MemberRoutes.d.ts.map +1 -0
- package/dist/MemberRoutes.js +107 -0
- package/dist/MemberRoutes.js.map +1 -0
- package/dist/Module.d.ts +479 -0
- package/dist/Module.d.ts.map +1 -0
- package/dist/Module.js +30 -0
- package/dist/Module.js.map +1 -0
- package/dist/ModuleIdentity.d.ts +17 -0
- package/dist/ModuleIdentity.d.ts.map +1 -0
- package/dist/ModuleIdentity.js +106 -0
- package/dist/ModuleIdentity.js.map +1 -0
- package/dist/Notifications.d.ts +107 -0
- package/dist/Notifications.d.ts.map +1 -0
- package/dist/Notifications.js +475 -0
- package/dist/Notifications.js.map +1 -0
- package/dist/Outbox.d.ts +146 -0
- package/dist/Outbox.d.ts.map +1 -0
- package/dist/Outbox.js +518 -0
- package/dist/Outbox.js.map +1 -0
- package/dist/Privacy.d.ts +50 -0
- package/dist/Privacy.d.ts.map +1 -0
- package/dist/Privacy.js +167 -0
- package/dist/Privacy.js.map +1 -0
- package/dist/Progress.d.ts +42 -0
- package/dist/Progress.d.ts.map +1 -0
- package/dist/Progress.js +215 -0
- package/dist/Progress.js.map +1 -0
- package/dist/QuerySurface.d.ts +73 -0
- package/dist/QuerySurface.d.ts.map +1 -0
- package/dist/QuerySurface.js +440 -0
- package/dist/QuerySurface.js.map +1 -0
- package/dist/QueryViews.d.ts +70 -0
- package/dist/QueryViews.d.ts.map +1 -0
- package/dist/QueryViews.js +94 -0
- package/dist/QueryViews.js.map +1 -0
- package/dist/Readiness.d.ts +40 -0
- package/dist/Readiness.d.ts.map +1 -0
- package/dist/Readiness.js +203 -0
- package/dist/Readiness.js.map +1 -0
- package/dist/Redact.d.ts +11 -0
- package/dist/Redact.d.ts.map +1 -0
- package/dist/Redact.js +21 -0
- package/dist/Redact.js.map +1 -0
- package/dist/Registry.d.ts +117 -0
- package/dist/Registry.d.ts.map +1 -0
- package/dist/Registry.js +297 -0
- package/dist/Registry.js.map +1 -0
- package/dist/Release.d.ts +205 -0
- package/dist/Release.d.ts.map +1 -0
- package/dist/Release.js +880 -0
- package/dist/Release.js.map +1 -0
- package/dist/Retention.d.ts +43 -0
- package/dist/Retention.d.ts.map +1 -0
- package/dist/Retention.js +124 -0
- package/dist/Retention.js.map +1 -0
- package/dist/Scheduler.d.ts +56 -0
- package/dist/Scheduler.d.ts.map +1 -0
- package/dist/Scheduler.js +470 -0
- package/dist/Scheduler.js.map +1 -0
- package/dist/Server.d.ts +341 -0
- package/dist/Server.d.ts.map +1 -0
- package/dist/Server.js +1106 -0
- package/dist/Server.js.map +1 -0
- package/dist/Sessions.d.ts +38 -0
- package/dist/Sessions.d.ts.map +1 -0
- package/dist/Sessions.js +45 -0
- package/dist/Sessions.js.map +1 -0
- package/dist/Settings.d.ts +63 -0
- package/dist/Settings.d.ts.map +1 -0
- package/dist/Settings.js +219 -0
- package/dist/Settings.js.map +1 -0
- package/dist/Sharing.d.ts +99 -0
- package/dist/Sharing.d.ts.map +1 -0
- package/dist/Sharing.js +315 -0
- package/dist/Sharing.js.map +1 -0
- package/dist/Sync.d.ts +188 -0
- package/dist/Sync.d.ts.map +1 -0
- package/dist/Sync.js +1100 -0
- package/dist/Sync.js.map +1 -0
- package/dist/Telemetry.d.ts +154 -0
- package/dist/Telemetry.d.ts.map +1 -0
- package/dist/Telemetry.js +536 -0
- package/dist/Telemetry.js.map +1 -0
- package/dist/Versioning.d.ts +98 -0
- package/dist/Versioning.d.ts.map +1 -0
- package/dist/Versioning.js +387 -0
- package/dist/Versioning.js.map +1 -0
- package/dist/WorkItems.d.ts +67 -0
- package/dist/WorkItems.d.ts.map +1 -0
- package/dist/WorkItems.js +211 -0
- package/dist/WorkItems.js.map +1 -0
- package/dist/Workflows.d.ts +78 -0
- package/dist/Workflows.d.ts.map +1 -0
- package/dist/Workflows.js +478 -0
- package/dist/Workflows.js.map +1 -0
- package/dist/agent/Admission.d.ts +22 -0
- package/dist/agent/Admission.d.ts.map +1 -0
- package/dist/agent/Admission.js +34 -0
- package/dist/agent/Admission.js.map +1 -0
- package/dist/agent/Channels.d.ts +15 -0
- package/dist/agent/Channels.d.ts.map +1 -0
- package/dist/agent/Channels.js +50 -0
- package/dist/agent/Channels.js.map +1 -0
- package/dist/agent/Context.d.ts +73 -0
- package/dist/agent/Context.d.ts.map +1 -0
- package/dist/agent/Context.js +338 -0
- package/dist/agent/Context.js.map +1 -0
- package/dist/agent/Http.d.ts +18 -0
- package/dist/agent/Http.d.ts.map +1 -0
- package/dist/agent/Http.js +410 -0
- package/dist/agent/Http.js.map +1 -0
- package/dist/agent/Metering.d.ts +162 -0
- package/dist/agent/Metering.d.ts.map +1 -0
- package/dist/agent/Metering.js +315 -0
- package/dist/agent/Metering.js.map +1 -0
- package/dist/agent/ModelSetup.d.ts +10 -0
- package/dist/agent/ModelSetup.d.ts.map +1 -0
- package/dist/agent/ModelSetup.js +331 -0
- package/dist/agent/ModelSetup.js.map +1 -0
- package/dist/agent/Models.d.ts +197 -0
- package/dist/agent/Models.d.ts.map +1 -0
- package/dist/agent/Models.js +489 -0
- package/dist/agent/Models.js.map +1 -0
- package/dist/agent/Processors.d.ts +102 -0
- package/dist/agent/Processors.d.ts.map +1 -0
- package/dist/agent/Processors.js +80 -0
- package/dist/agent/Processors.js.map +1 -0
- package/dist/agent/Queue.d.ts +21 -0
- package/dist/agent/Queue.d.ts.map +1 -0
- package/dist/agent/Queue.js +64 -0
- package/dist/agent/Queue.js.map +1 -0
- package/dist/agent/Receipts.d.ts +41 -0
- package/dist/agent/Receipts.d.ts.map +1 -0
- package/dist/agent/Receipts.js +142 -0
- package/dist/agent/Receipts.js.map +1 -0
- package/dist/agent/Resources.d.ts +68 -0
- package/dist/agent/Resources.d.ts.map +1 -0
- package/dist/agent/Resources.js +207 -0
- package/dist/agent/Resources.js.map +1 -0
- package/dist/agent/Run.d.ts +178 -0
- package/dist/agent/Run.d.ts.map +1 -0
- package/dist/agent/Run.js +2896 -0
- package/dist/agent/Run.js.map +1 -0
- package/dist/agent/Runtime.d.ts +79 -0
- package/dist/agent/Runtime.d.ts.map +1 -0
- package/dist/agent/Runtime.js +366 -0
- package/dist/agent/Runtime.js.map +1 -0
- package/dist/agent/Settings.d.ts +126 -0
- package/dist/agent/Settings.d.ts.map +1 -0
- package/dist/agent/Settings.js +44 -0
- package/dist/agent/Settings.js.map +1 -0
- package/dist/agent/Skills.d.ts +73 -0
- package/dist/agent/Skills.d.ts.map +1 -0
- package/dist/agent/Skills.js +95 -0
- package/dist/agent/Skills.js.map +1 -0
- package/dist/agent/Store.d.ts +37 -0
- package/dist/agent/Store.d.ts.map +1 -0
- package/dist/agent/Store.js +50 -0
- package/dist/agent/Store.js.map +1 -0
- package/dist/agent/ToolSearch.d.ts +37 -0
- package/dist/agent/ToolSearch.d.ts.map +1 -0
- package/dist/agent/ToolSearch.js +119 -0
- package/dist/agent/ToolSearch.js.map +1 -0
- package/dist/agent/index.d.ts +37 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +44 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/module.d.ts +12889 -0
- package/dist/agent/module.d.ts.map +1 -0
- package/dist/agent/module.js +1550 -0
- package/dist/agent/module.js.map +1 -0
- package/dist/appState/Sweep.d.ts +21 -0
- package/dist/appState/Sweep.d.ts.map +1 -0
- package/dist/appState/Sweep.js +46 -0
- package/dist/appState/Sweep.js.map +1 -0
- package/dist/appState/module.d.ts +1710 -0
- package/dist/appState/module.d.ts.map +1 -0
- package/dist/appState/module.js +344 -0
- package/dist/appState/module.js.map +1 -0
- package/dist/audit/module.d.ts +158 -0
- package/dist/audit/module.d.ts.map +1 -0
- package/dist/audit/module.js +72 -0
- package/dist/audit/module.js.map +1 -0
- package/dist/auth/AuthProvider.d.ts +224 -0
- package/dist/auth/AuthProvider.d.ts.map +1 -0
- package/dist/auth/AuthProvider.js +104 -0
- package/dist/auth/AuthProvider.js.map +1 -0
- package/dist/auth/BetterAuthProvider.d.ts +40 -0
- package/dist/auth/BetterAuthProvider.d.ts.map +1 -0
- package/dist/auth/BetterAuthProvider.js +458 -0
- package/dist/auth/BetterAuthProvider.js.map +1 -0
- package/dist/auth/Methods.d.ts +7 -0
- package/dist/auth/Methods.d.ts.map +1 -0
- package/dist/auth/Methods.js +7 -0
- package/dist/auth/Methods.js.map +1 -0
- package/dist/auth/SessionTokens.d.ts +23 -0
- package/dist/auth/SessionTokens.d.ts.map +1 -0
- package/dist/auth/SessionTokens.js +150 -0
- package/dist/auth/SessionTokens.js.map +1 -0
- package/dist/collab/Collab.d.ts +105 -0
- package/dist/collab/Collab.d.ts.map +1 -0
- package/dist/collab/Collab.js +475 -0
- package/dist/collab/Collab.js.map +1 -0
- package/dist/collab/Housekeeping.d.ts +38 -0
- package/dist/collab/Housekeeping.d.ts.map +1 -0
- package/dist/collab/Housekeeping.js +146 -0
- package/dist/collab/Housekeeping.js.map +1 -0
- package/dist/collab/LiveCopy.d.ts +7 -0
- package/dist/collab/LiveCopy.d.ts.map +1 -0
- package/dist/collab/LiveCopy.js +79 -0
- package/dist/collab/LiveCopy.js.map +1 -0
- package/dist/collab/Socket.d.ts +19 -0
- package/dist/collab/Socket.d.ts.map +1 -0
- package/dist/collab/Socket.js +323 -0
- package/dist/collab/Socket.js.map +1 -0
- package/dist/collab/Store.d.ts +42 -0
- package/dist/collab/Store.d.ts.map +1 -0
- package/dist/collab/Store.js +59 -0
- package/dist/collab/Store.js.map +1 -0
- package/dist/collab/Ydoc.d.ts +88 -0
- package/dist/collab/Ydoc.d.ts.map +1 -0
- package/dist/collab/Ydoc.js +314 -0
- package/dist/collab/Ydoc.js.map +1 -0
- package/dist/collab/derive/bundle.gen.d.ts +2 -0
- package/dist/collab/derive/bundle.gen.d.ts.map +1 -0
- package/dist/collab/derive/bundle.gen.js +3 -0
- package/dist/collab/derive/bundle.gen.js.map +1 -0
- package/dist/collab/derive/entry.d.ts +3 -0
- package/dist/collab/derive/entry.d.ts.map +1 -0
- package/dist/collab/derive/entry.js +35 -0
- package/dist/collab/derive/entry.js.map +1 -0
- package/dist/collab/derive/polyfill.d.ts +3 -0
- package/dist/collab/derive/polyfill.d.ts.map +1 -0
- package/dist/collab/derive/polyfill.js +17 -0
- package/dist/collab/derive/polyfill.js.map +1 -0
- package/dist/collab/module.d.ts +305 -0
- package/dist/collab/module.d.ts.map +1 -0
- package/dist/collab/module.js +161 -0
- package/dist/collab/module.js.map +1 -0
- package/dist/connections/Connections.d.ts +199 -0
- package/dist/connections/Connections.d.ts.map +1 -0
- package/dist/connections/Connections.js +1633 -0
- package/dist/connections/Connections.js.map +1 -0
- package/dist/connections/Connector.d.ts +213 -0
- package/dist/connections/Connector.d.ts.map +1 -0
- package/dist/connections/Connector.js +55 -0
- package/dist/connections/Connector.js.map +1 -0
- package/dist/connections/Crypto.d.ts +55 -0
- package/dist/connections/Crypto.d.ts.map +1 -0
- package/dist/connections/Crypto.js +100 -0
- package/dist/connections/Crypto.js.map +1 -0
- package/dist/connections/Destinations.d.ts +63 -0
- package/dist/connections/Destinations.d.ts.map +1 -0
- package/dist/connections/Destinations.js +338 -0
- package/dist/connections/Destinations.js.map +1 -0
- package/dist/connections/Discovery.d.ts +53 -0
- package/dist/connections/Discovery.d.ts.map +1 -0
- package/dist/connections/Discovery.js +209 -0
- package/dist/connections/Discovery.js.map +1 -0
- package/dist/connections/EffectKinds.d.ts +17 -0
- package/dist/connections/EffectKinds.d.ts.map +1 -0
- package/dist/connections/EffectKinds.js +26 -0
- package/dist/connections/EffectKinds.js.map +1 -0
- package/dist/connections/Effects.d.ts +49 -0
- package/dist/connections/Effects.d.ts.map +1 -0
- package/dist/connections/Effects.js +347 -0
- package/dist/connections/Effects.js.map +1 -0
- package/dist/connections/Metering.d.ts +40 -0
- package/dist/connections/Metering.d.ts.map +1 -0
- package/dist/connections/Metering.js +142 -0
- package/dist/connections/Metering.js.map +1 -0
- package/dist/connections/ProviderApi.d.ts +47 -0
- package/dist/connections/ProviderApi.d.ts.map +1 -0
- package/dist/connections/ProviderApi.js +103 -0
- package/dist/connections/ProviderApi.js.map +1 -0
- package/dist/connections/Secrets.d.ts +78 -0
- package/dist/connections/Secrets.d.ts.map +1 -0
- package/dist/connections/Secrets.js +342 -0
- package/dist/connections/Secrets.js.map +1 -0
- package/dist/connections/Sync.d.ts +85 -0
- package/dist/connections/Sync.d.ts.map +1 -0
- package/dist/connections/Sync.js +201 -0
- package/dist/connections/Sync.js.map +1 -0
- package/dist/connections/module.d.ts +1061 -0
- package/dist/connections/module.d.ts.map +1 -0
- package/dist/connections/module.js +485 -0
- package/dist/connections/module.js.map +1 -0
- package/dist/data/Corpus.d.ts +79 -0
- package/dist/data/Corpus.d.ts.map +1 -0
- package/dist/data/Corpus.js +343 -0
- package/dist/data/Corpus.js.map +1 -0
- package/dist/data/Datasets.d.ts +88 -0
- package/dist/data/Datasets.d.ts.map +1 -0
- package/dist/data/Datasets.js +375 -0
- package/dist/data/Datasets.js.map +1 -0
- package/dist/data/Programs.d.ts +58 -0
- package/dist/data/Programs.d.ts.map +1 -0
- package/dist/data/Programs.js +197 -0
- package/dist/data/Programs.js.map +1 -0
- package/dist/data/module.d.ts +210 -0
- package/dist/data/module.d.ts.map +1 -0
- package/dist/data/module.js +140 -0
- package/dist/data/module.js.map +1 -0
- package/dist/db/Bootstrap.d.ts +508 -0
- package/dist/db/Bootstrap.d.ts.map +1 -0
- package/dist/db/Bootstrap.js +2368 -0
- package/dist/db/Bootstrap.js.map +1 -0
- package/dist/db/Catalog.d.ts +10 -0
- package/dist/db/Catalog.d.ts.map +1 -0
- package/dist/db/Catalog.js +9 -0
- package/dist/db/Catalog.js.map +1 -0
- package/dist/db/Conflicts.d.ts +18 -0
- package/dist/db/Conflicts.d.ts.map +1 -0
- package/dist/db/Conflicts.js +29 -0
- package/dist/db/Conflicts.js.map +1 -0
- package/dist/db/DirectoryLock.d.ts +16 -0
- package/dist/db/DirectoryLock.d.ts.map +1 -0
- package/dist/db/DirectoryLock.js +15 -0
- package/dist/db/DirectoryLock.js.map +1 -0
- package/dist/db/HandlerGate.d.ts +28 -0
- package/dist/db/HandlerGate.d.ts.map +1 -0
- package/dist/db/HandlerGate.js +76 -0
- package/dist/db/HandlerGate.js.map +1 -0
- package/dist/db/Host.d.ts +94 -0
- package/dist/db/Host.d.ts.map +1 -0
- package/dist/db/Host.js +189 -0
- package/dist/db/Host.js.map +1 -0
- package/dist/db/KernelSchema.d.ts +52 -0
- package/dist/db/KernelSchema.d.ts.map +1 -0
- package/dist/db/KernelSchema.js +4313 -0
- package/dist/db/KernelSchema.js.map +1 -0
- package/dist/db/MigrationCheck.d.ts +38 -0
- package/dist/db/MigrationCheck.d.ts.map +1 -0
- package/dist/db/MigrationCheck.js +180 -0
- package/dist/db/MigrationCheck.js.map +1 -0
- package/dist/db/QueryViewCheck.d.ts +172 -0
- package/dist/db/QueryViewCheck.d.ts.map +1 -0
- package/dist/db/QueryViewCheck.js +967 -0
- package/dist/db/QueryViewCheck.js.map +1 -0
- package/dist/db/ReadOnly.d.ts +13 -0
- package/dist/db/ReadOnly.d.ts.map +1 -0
- package/dist/db/ReadOnly.js +16 -0
- package/dist/db/ReadOnly.js.map +1 -0
- package/dist/db/Scram.d.ts +5 -0
- package/dist/db/Scram.d.ts.map +1 -0
- package/dist/db/Scram.js +17 -0
- package/dist/db/Scram.js.map +1 -0
- package/dist/db/SqlState.d.ts +36 -0
- package/dist/db/SqlState.d.ts.map +1 -0
- package/dist/db/SqlState.js +64 -0
- package/dist/db/SqlState.js.map +1 -0
- package/dist/db/Startup.d.ts +18 -0
- package/dist/db/Startup.d.ts.map +1 -0
- package/dist/db/Startup.js +22 -0
- package/dist/db/Startup.js.map +1 -0
- package/dist/db/ZeroDdl.d.ts +85 -0
- package/dist/db/ZeroDdl.d.ts.map +1 -0
- package/dist/db/ZeroDdl.js +240 -0
- package/dist/db/ZeroDdl.js.map +1 -0
- package/dist/db/ZeroPush.d.ts +7 -0
- package/dist/db/ZeroPush.d.ts.map +1 -0
- package/dist/db/ZeroPush.js +126 -0
- package/dist/db/ZeroPush.js.map +1 -0
- package/dist/devices/Devices.d.ts +130 -0
- package/dist/devices/Devices.d.ts.map +1 -0
- package/dist/devices/Devices.js +769 -0
- package/dist/devices/Devices.js.map +1 -0
- package/dist/devices/Flow.d.ts +47 -0
- package/dist/devices/Flow.d.ts.map +1 -0
- package/dist/devices/Flow.js +131 -0
- package/dist/devices/Flow.js.map +1 -0
- package/dist/devices/Http.d.ts +6 -0
- package/dist/devices/Http.d.ts.map +1 -0
- package/dist/devices/Http.js +103 -0
- package/dist/devices/Http.js.map +1 -0
- package/dist/devices/module.d.ts +1313 -0
- package/dist/devices/module.d.ts.map +1 -0
- package/dist/devices/module.js +266 -0
- package/dist/devices/module.js.map +1 -0
- package/dist/durable/Cluster.d.ts +13 -0
- package/dist/durable/Cluster.d.ts.map +1 -0
- package/dist/durable/Cluster.js +57 -0
- package/dist/durable/Cluster.js.map +1 -0
- package/dist/durable/Definition.d.ts +215 -0
- package/dist/durable/Definition.d.ts.map +1 -0
- package/dist/durable/Definition.js +18 -0
- package/dist/durable/Definition.js.map +1 -0
- package/dist/durable/Schedule.d.ts +46 -0
- package/dist/durable/Schedule.d.ts.map +1 -0
- package/dist/durable/Schedule.js +120 -0
- package/dist/durable/Schedule.js.map +1 -0
- package/dist/durable/Trust.d.ts +90 -0
- package/dist/durable/Trust.d.ts.map +1 -0
- package/dist/durable/Trust.js +61 -0
- package/dist/durable/Trust.js.map +1 -0
- package/dist/enterprise/Routes.d.ts +32 -0
- package/dist/enterprise/Routes.d.ts.map +1 -0
- package/dist/enterprise/Routes.js +448 -0
- package/dist/enterprise/Routes.js.map +1 -0
- package/dist/enterprise/WorkOs.d.ts +42 -0
- package/dist/enterprise/WorkOs.d.ts.map +1 -0
- package/dist/enterprise/WorkOs.js +109 -0
- package/dist/enterprise/WorkOs.js.map +1 -0
- package/dist/files/FileTable.d.ts +937 -0
- package/dist/files/FileTable.d.ts.map +1 -0
- package/dist/files/FileTable.js +79 -0
- package/dist/files/FileTable.js.map +1 -0
- package/dist/files/Files.d.ts +169 -0
- package/dist/files/Files.d.ts.map +1 -0
- package/dist/files/Files.js +1232 -0
- package/dist/files/Files.js.map +1 -0
- package/dist/files/Http.d.ts +13 -0
- package/dist/files/Http.d.ts.map +1 -0
- package/dist/files/Http.js +30 -0
- package/dist/files/Http.js.map +1 -0
- package/dist/files/LocalStorage.d.ts +7 -0
- package/dist/files/LocalStorage.d.ts.map +1 -0
- package/dist/files/LocalStorage.js +284 -0
- package/dist/files/LocalStorage.js.map +1 -0
- package/dist/files/Providers.d.ts +64 -0
- package/dist/files/Providers.d.ts.map +1 -0
- package/dist/files/Providers.js +245 -0
- package/dist/files/Providers.js.map +1 -0
- package/dist/files/S3Storage.d.ts +27 -0
- package/dist/files/S3Storage.d.ts.map +1 -0
- package/dist/files/S3Storage.js +301 -0
- package/dist/files/S3Storage.js.map +1 -0
- package/dist/files/SigV4.d.ts +65 -0
- package/dist/files/SigV4.d.ts.map +1 -0
- package/dist/files/SigV4.js +152 -0
- package/dist/files/SigV4.js.map +1 -0
- package/dist/files/Sniff.d.ts +50 -0
- package/dist/files/Sniff.d.ts.map +1 -0
- package/dist/files/Sniff.js +223 -0
- package/dist/files/Sniff.js.map +1 -0
- package/dist/files/Storage.d.ts +75 -0
- package/dist/files/Storage.d.ts.map +1 -0
- package/dist/files/Storage.js +70 -0
- package/dist/files/Storage.js.map +1 -0
- package/dist/files/module.d.ts +666 -0
- package/dist/files/module.d.ts.map +1 -0
- package/dist/files/module.js +217 -0
- package/dist/files/module.js.map +1 -0
- package/dist/flags/module.d.ts +966 -0
- package/dist/flags/module.d.ts.map +1 -0
- package/dist/flags/module.js +146 -0
- package/dist/flags/module.js.map +1 -0
- package/dist/inbox/Flow.d.ts +49 -0
- package/dist/inbox/Flow.d.ts.map +1 -0
- package/dist/inbox/Flow.js +425 -0
- package/dist/inbox/Flow.js.map +1 -0
- package/dist/inbox/System.d.ts +11 -0
- package/dist/inbox/System.d.ts.map +1 -0
- package/dist/inbox/System.js +26 -0
- package/dist/inbox/System.js.map +1 -0
- package/dist/inbox/approvals.d.ts +1548 -0
- package/dist/inbox/approvals.d.ts.map +1 -0
- package/dist/inbox/approvals.js +268 -0
- package/dist/inbox/approvals.js.map +1 -0
- package/dist/inbox/consent.d.ts +1213 -0
- package/dist/inbox/consent.d.ts.map +1 -0
- package/dist/inbox/consent.js +281 -0
- package/dist/inbox/consent.js.map +1 -0
- package/dist/inbox/index.d.ts +2231 -0
- package/dist/inbox/index.d.ts.map +1 -0
- package/dist/inbox/index.js +22 -0
- package/dist/inbox/index.js.map +1 -0
- package/dist/inbox/notifications.d.ts +2743 -0
- package/dist/inbox/notifications.d.ts.map +1 -0
- package/dist/inbox/notifications.js +362 -0
- package/dist/inbox/notifications.js.map +1 -0
- package/dist/inbox/tables.d.ts +1992 -0
- package/dist/inbox/tables.d.ts.map +1 -0
- package/dist/inbox/tables.js +149 -0
- package/dist/inbox/tables.js.map +1 -0
- package/dist/inbox/workItems.d.ts +1188 -0
- package/dist/inbox/workItems.d.ts.map +1 -0
- package/dist/inbox/workItems.js +158 -0
- package/dist/inbox/workItems.js.map +1 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +154 -0
- package/dist/index.js.map +1 -0
- package/dist/ingestion/Chunk.d.ts +15 -0
- package/dist/ingestion/Chunk.d.ts.map +1 -0
- package/dist/ingestion/Chunk.js +49 -0
- package/dist/ingestion/Chunk.js.map +1 -0
- package/dist/ingestion/Extract.d.ts +69 -0
- package/dist/ingestion/Extract.d.ts.map +1 -0
- package/dist/ingestion/Extract.js +376 -0
- package/dist/ingestion/Extract.js.map +1 -0
- package/dist/ingestion/ExtractChild.d.ts +2 -0
- package/dist/ingestion/ExtractChild.d.ts.map +1 -0
- package/dist/ingestion/ExtractChild.js +54 -0
- package/dist/ingestion/ExtractChild.js.map +1 -0
- package/dist/ingestion/ExtractPool.d.ts +38 -0
- package/dist/ingestion/ExtractPool.d.ts.map +1 -0
- package/dist/ingestion/ExtractPool.js +203 -0
- package/dist/ingestion/ExtractPool.js.map +1 -0
- package/dist/ingestion/Ingestion.d.ts +183 -0
- package/dist/ingestion/Ingestion.d.ts.map +1 -0
- package/dist/ingestion/Ingestion.js +650 -0
- package/dist/ingestion/Ingestion.js.map +1 -0
- package/dist/ingestion/Isolated.d.ts +18 -0
- package/dist/ingestion/Isolated.d.ts.map +1 -0
- package/dist/ingestion/Isolated.js +15 -0
- package/dist/ingestion/Isolated.js.map +1 -0
- package/dist/ingestion/Markup.d.ts +29 -0
- package/dist/ingestion/Markup.d.ts.map +1 -0
- package/dist/ingestion/Markup.js +111 -0
- package/dist/ingestion/Markup.js.map +1 -0
- package/dist/ingestion/Pdf.d.ts +6 -0
- package/dist/ingestion/Pdf.d.ts.map +1 -0
- package/dist/ingestion/Pdf.js +192 -0
- package/dist/ingestion/Pdf.js.map +1 -0
- package/dist/ingestion/Runs.d.ts +59 -0
- package/dist/ingestion/Runs.d.ts.map +1 -0
- package/dist/ingestion/Runs.js +128 -0
- package/dist/ingestion/Runs.js.map +1 -0
- package/dist/ingestion/Scrub.d.ts +16 -0
- package/dist/ingestion/Scrub.d.ts.map +1 -0
- package/dist/ingestion/Scrub.js +15 -0
- package/dist/ingestion/Scrub.js.map +1 -0
- package/dist/ingestion/Zip.d.ts +19 -0
- package/dist/ingestion/Zip.d.ts.map +1 -0
- package/dist/ingestion/Zip.js +85 -0
- package/dist/ingestion/Zip.js.map +1 -0
- package/dist/ingestion/module.d.ts +111 -0
- package/dist/ingestion/module.d.ts.map +1 -0
- package/dist/ingestion/module.js +51 -0
- package/dist/ingestion/module.js.map +1 -0
- package/dist/ingress/Definition.d.ts +146 -0
- package/dist/ingress/Definition.d.ts.map +1 -0
- package/dist/ingress/Definition.js +12 -0
- package/dist/ingress/Definition.js.map +1 -0
- package/dist/ingress/Ingress.d.ts +61 -0
- package/dist/ingress/Ingress.d.ts.map +1 -0
- package/dist/ingress/Ingress.js +929 -0
- package/dist/ingress/Ingress.js.map +1 -0
- package/dist/ingress/Verifiers.d.ts +43 -0
- package/dist/ingress/Verifiers.d.ts.map +1 -0
- package/dist/ingress/Verifiers.js +137 -0
- package/dist/ingress/Verifiers.js.map +1 -0
- package/dist/machine/MachineIdentity.d.ts +34 -0
- package/dist/machine/MachineIdentity.d.ts.map +1 -0
- package/dist/machine/MachineIdentity.js +200 -0
- package/dist/machine/MachineIdentity.js.map +1 -0
- package/dist/machine/Managed.d.ts +40 -0
- package/dist/machine/Managed.d.ts.map +1 -0
- package/dist/machine/Managed.js +163 -0
- package/dist/machine/Managed.js.map +1 -0
- package/dist/machine/OAuth.d.ts +11 -0
- package/dist/machine/OAuth.d.ts.map +1 -0
- package/dist/machine/OAuth.js +913 -0
- package/dist/machine/OAuth.js.map +1 -0
- package/dist/machine/Pages.d.ts +64 -0
- package/dist/machine/Pages.d.ts.map +1 -0
- package/dist/machine/Pages.js +54 -0
- package/dist/machine/Pages.js.map +1 -0
- package/dist/machine/Tokens.d.ts +25 -0
- package/dist/machine/Tokens.d.ts.map +1 -0
- package/dist/machine/Tokens.js +62 -0
- package/dist/machine/Tokens.js.map +1 -0
- package/dist/make/Credentials.d.ts +8 -0
- package/dist/make/Credentials.d.ts.map +1 -0
- package/dist/make/Credentials.js +29 -0
- package/dist/make/Credentials.js.map +1 -0
- package/dist/make/Example.d.ts +159 -0
- package/dist/make/Example.d.ts.map +1 -0
- package/dist/make/Example.js +94 -0
- package/dist/make/Example.js.map +1 -0
- package/dist/make/Execute.d.ts +151 -0
- package/dist/make/Execute.d.ts.map +1 -0
- package/dist/make/Execute.js +316 -0
- package/dist/make/Execute.js.map +1 -0
- package/dist/make/Http.d.ts +17 -0
- package/dist/make/Http.d.ts.map +1 -0
- package/dist/make/Http.js +63 -0
- package/dist/make/Http.js.map +1 -0
- package/dist/make/Lifecycle.d.ts +167 -0
- package/dist/make/Lifecycle.d.ts.map +1 -0
- package/dist/make/Lifecycle.js +580 -0
- package/dist/make/Lifecycle.js.map +1 -0
- package/dist/make/Manifest.d.ts +61 -0
- package/dist/make/Manifest.d.ts.map +1 -0
- package/dist/make/Manifest.js +792 -0
- package/dist/make/Manifest.js.map +1 -0
- package/dist/make/Repair.d.ts +111 -0
- package/dist/make/Repair.d.ts.map +1 -0
- package/dist/make/Repair.js +236 -0
- package/dist/make/Repair.js.map +1 -0
- package/dist/make/Runtime.d.ts +144 -0
- package/dist/make/Runtime.d.ts.map +1 -0
- package/dist/make/Runtime.js +309 -0
- package/dist/make/Runtime.js.map +1 -0
- package/dist/make/Session.d.ts +19 -0
- package/dist/make/Session.d.ts.map +1 -0
- package/dist/make/Session.js +27 -0
- package/dist/make/Session.js.map +1 -0
- package/dist/make/SqlGuard.d.ts +48 -0
- package/dist/make/SqlGuard.d.ts.map +1 -0
- package/dist/make/SqlGuard.js +333 -0
- package/dist/make/SqlGuard.js.map +1 -0
- package/dist/make/Subscribe.d.ts +18 -0
- package/dist/make/Subscribe.d.ts.map +1 -0
- package/dist/make/Subscribe.js +175 -0
- package/dist/make/Subscribe.js.map +1 -0
- package/dist/make/Validate.d.ts +47 -0
- package/dist/make/Validate.d.ts.map +1 -0
- package/dist/make/Validate.js +222 -0
- package/dist/make/Validate.js.map +1 -0
- package/dist/make/ViewStep.d.ts +27 -0
- package/dist/make/ViewStep.d.ts.map +1 -0
- package/dist/make/ViewStep.js +43 -0
- package/dist/make/ViewStep.js.map +1 -0
- package/dist/make/module.d.ts +808 -0
- package/dist/make/module.d.ts.map +1 -0
- package/dist/make/module.js +232 -0
- package/dist/make/module.js.map +1 -0
- package/dist/notifications/Decide.d.ts +29 -0
- package/dist/notifications/Decide.d.ts.map +1 -0
- package/dist/notifications/Decide.js +395 -0
- package/dist/notifications/Decide.js.map +1 -0
- package/dist/notifications/Providers.d.ts +110 -0
- package/dist/notifications/Providers.d.ts.map +1 -0
- package/dist/notifications/Providers.js +404 -0
- package/dist/notifications/Providers.js.map +1 -0
- package/dist/notifications/Push.d.ts +189 -0
- package/dist/notifications/Push.d.ts.map +1 -0
- package/dist/notifications/Push.js +457 -0
- package/dist/notifications/Push.js.map +1 -0
- package/dist/notifications/Smtp.d.ts +74 -0
- package/dist/notifications/Smtp.d.ts.map +1 -0
- package/dist/notifications/Smtp.js +344 -0
- package/dist/notifications/Smtp.js.map +1 -0
- package/dist/policy/CedarSchema.d.ts +47 -0
- package/dist/policy/CedarSchema.d.ts.map +1 -0
- package/dist/policy/CedarSchema.js +115 -0
- package/dist/policy/CedarSchema.js.map +1 -0
- package/dist/policy/Compiler.d.ts +364 -0
- package/dist/policy/Compiler.d.ts.map +1 -0
- package/dist/policy/Compiler.js +1311 -0
- package/dist/policy/Compiler.js.map +1 -0
- package/dist/policy/Policy.d.ts +70 -0
- package/dist/policy/Policy.d.ts.map +1 -0
- package/dist/policy/Policy.js +114 -0
- package/dist/policy/Policy.js.map +1 -0
- package/dist/policy/Rls.d.ts +110 -0
- package/dist/policy/Rls.d.ts.map +1 -0
- package/dist/policy/Rls.js +314 -0
- package/dist/policy/Rls.js.map +1 -0
- package/dist/policy/Row.d.ts +17 -0
- package/dist/policy/Row.d.ts.map +1 -0
- package/dist/policy/Row.js +3 -0
- package/dist/policy/Row.js.map +1 -0
- package/dist/privacy/Flow.d.ts +20 -0
- package/dist/privacy/Flow.d.ts.map +1 -0
- package/dist/privacy/Flow.js +193 -0
- package/dist/privacy/Flow.js.map +1 -0
- package/dist/privacy/Inventory.d.ts +110 -0
- package/dist/privacy/Inventory.d.ts.map +1 -0
- package/dist/privacy/Inventory.js +1704 -0
- package/dist/privacy/Inventory.js.map +1 -0
- package/dist/privacy/Sources.d.ts +86 -0
- package/dist/privacy/Sources.d.ts.map +1 -0
- package/dist/privacy/Sources.js +598 -0
- package/dist/privacy/Sources.js.map +1 -0
- package/dist/privacy/Visits.d.ts +21 -0
- package/dist/privacy/Visits.d.ts.map +1 -0
- package/dist/privacy/Visits.js +279 -0
- package/dist/privacy/Visits.js.map +1 -0
- package/dist/privacy/ZeroCvr.d.ts +15 -0
- package/dist/privacy/ZeroCvr.d.ts.map +1 -0
- package/dist/privacy/ZeroCvr.js +63 -0
- package/dist/privacy/ZeroCvr.js.map +1 -0
- package/dist/privacy/module.d.ts +2505 -0
- package/dist/privacy/module.d.ts.map +1 -0
- package/dist/privacy/module.js +228 -0
- package/dist/privacy/module.js.map +1 -0
- package/dist/progress/module.d.ts +1572 -0
- package/dist/progress/module.d.ts.map +1 -0
- package/dist/progress/module.js +139 -0
- package/dist/progress/module.js.map +1 -0
- package/dist/proposals/module.d.ts +275 -0
- package/dist/proposals/module.d.ts.map +1 -0
- package/dist/proposals/module.js +269 -0
- package/dist/proposals/module.js.map +1 -0
- package/dist/query/module.d.ts +91 -0
- package/dist/query/module.d.ts.map +1 -0
- package/dist/query/module.js +50 -0
- package/dist/query/module.js.map +1 -0
- package/dist/records/Access.d.ts +26 -0
- package/dist/records/Access.d.ts.map +1 -0
- package/dist/records/Access.js +43 -0
- package/dist/records/Access.js.map +1 -0
- package/dist/records/References.d.ts +18 -0
- package/dist/records/References.d.ts.map +1 -0
- package/dist/records/References.js +47 -0
- package/dist/records/References.js.map +1 -0
- package/dist/runtime/bun.d.ts +29 -0
- package/dist/runtime/bun.d.ts.map +1 -0
- package/dist/runtime/bun.js +71 -0
- package/dist/runtime/bun.js.map +1 -0
- package/dist/runtime/idle.d.ts +5 -0
- package/dist/runtime/idle.d.ts.map +1 -0
- package/dist/runtime/idle.js +61 -0
- package/dist/runtime/idle.js.map +1 -0
- package/dist/runtime/node.d.ts +36 -0
- package/dist/runtime/node.d.ts.map +1 -0
- package/dist/runtime/node.js +86 -0
- package/dist/runtime/node.js.map +1 -0
- package/dist/runtime/resolve.d.ts +8 -0
- package/dist/runtime/resolve.d.ts.map +1 -0
- package/dist/runtime/resolve.js +136 -0
- package/dist/runtime/resolve.js.map +1 -0
- package/dist/sandbox/Sandbox.d.ts +86 -0
- package/dist/sandbox/Sandbox.d.ts.map +1 -0
- package/dist/sandbox/Sandbox.js +246 -0
- package/dist/sandbox/Sandbox.js.map +1 -0
- package/dist/sandbox/worker.d.ts +93 -0
- package/dist/sandbox/worker.d.ts.map +1 -0
- package/dist/sandbox/worker.js +503 -0
- package/dist/sandbox/worker.js.map +1 -0
- package/dist/scheduler/Automations.d.ts +99 -0
- package/dist/scheduler/Automations.d.ts.map +1 -0
- package/dist/scheduler/Automations.js +247 -0
- package/dist/scheduler/Automations.js.map +1 -0
- package/dist/scheduler/History.d.ts +61 -0
- package/dist/scheduler/History.d.ts.map +1 -0
- package/dist/scheduler/History.js +154 -0
- package/dist/scheduler/History.js.map +1 -0
- package/dist/scheduler/module.d.ts +2365 -0
- package/dist/scheduler/module.d.ts.map +1 -0
- package/dist/scheduler/module.js +370 -0
- package/dist/scheduler/module.js.map +1 -0
- package/dist/search/RecordLock.d.ts +22 -0
- package/dist/search/RecordLock.d.ts.map +1 -0
- package/dist/search/RecordLock.js +21 -0
- package/dist/search/RecordLock.js.map +1 -0
- package/dist/search/Search.d.ts +63 -0
- package/dist/search/Search.d.ts.map +1 -0
- package/dist/search/Search.js +424 -0
- package/dist/search/Search.js.map +1 -0
- package/dist/search/Sources.d.ts +56 -0
- package/dist/search/Sources.d.ts.map +1 -0
- package/dist/search/Sources.js +121 -0
- package/dist/search/Sources.js.map +1 -0
- package/dist/search/module.d.ts +72 -0
- package/dist/search/module.d.ts.map +1 -0
- package/dist/search/module.js +44 -0
- package/dist/search/module.js.map +1 -0
- package/dist/settings/module.d.ts +677 -0
- package/dist/settings/module.d.ts.map +1 -0
- package/dist/settings/module.js +103 -0
- package/dist/settings/module.js.map +1 -0
- package/dist/sharing/module.d.ts +1105 -0
- package/dist/sharing/module.d.ts.map +1 -0
- package/dist/sharing/module.js +295 -0
- package/dist/sharing/module.js.map +1 -0
- package/dist/spaces/module.d.ts +1787 -0
- package/dist/spaces/module.d.ts.map +1 -0
- package/dist/spaces/module.js +248 -0
- package/dist/spaces/module.js.map +1 -0
- package/dist/surfaces/Agent.d.ts +89 -0
- package/dist/surfaces/Agent.d.ts.map +1 -0
- package/dist/surfaces/Agent.js +112 -0
- package/dist/surfaces/Agent.js.map +1 -0
- package/dist/surfaces/CookieGuard.d.ts +77 -0
- package/dist/surfaces/CookieGuard.d.ts.map +1 -0
- package/dist/surfaces/CookieGuard.js +373 -0
- package/dist/surfaces/CookieGuard.js.map +1 -0
- package/dist/surfaces/Http.d.ts +15 -0
- package/dist/surfaces/Http.d.ts.map +1 -0
- package/dist/surfaces/Http.js +250 -0
- package/dist/surfaces/Http.js.map +1 -0
- package/dist/surfaces/Mcp.d.ts +90 -0
- package/dist/surfaces/Mcp.d.ts.map +1 -0
- package/dist/surfaces/Mcp.js +443 -0
- package/dist/surfaces/Mcp.js.map +1 -0
- package/dist/surfaces/Rpc.d.ts +15 -0
- package/dist/surfaces/Rpc.d.ts.map +1 -0
- package/dist/surfaces/Rpc.js +68 -0
- package/dist/surfaces/Rpc.js.map +1 -0
- package/dist/surfaces/headers.d.ts +9 -0
- package/dist/surfaces/headers.d.ts.map +1 -0
- package/dist/surfaces/headers.js +15 -0
- package/dist/surfaces/headers.js.map +1 -0
- package/dist/surfaces/request.d.ts +68 -0
- package/dist/surfaces/request.d.ts.map +1 -0
- package/dist/surfaces/request.js +130 -0
- package/dist/surfaces/request.js.map +1 -0
- package/dist/telemetry/module.d.ts +74 -0
- package/dist/telemetry/module.d.ts.map +1 -0
- package/dist/telemetry/module.js +77 -0
- package/dist/telemetry/module.js.map +1 -0
- package/dist/versioning/module.d.ts +231 -0
- package/dist/versioning/module.d.ts.map +1 -0
- package/dist/versioning/module.js +151 -0
- package/dist/versioning/module.js.map +1 -0
- package/package.json +71 -3
- package/src/AccountMail.ts +218 -0
- package/src/AppConfig.ts +148 -0
- package/src/Approvals.ts +555 -0
- package/src/Audit.ts +381 -0
- package/src/AuthSeam.ts +136 -0
- package/src/Authority.ts +577 -0
- package/src/Avatars.ts +172 -0
- package/src/Base64url.ts +23 -0
- package/src/BasePath.ts +80 -0
- package/src/CallActed.ts +10 -0
- package/src/Config.ts +857 -0
- package/src/DeliveryPolicy.ts +52 -0
- package/src/DesktopSignIn.ts +181 -0
- package/src/Directory.ts +1792 -0
- package/src/Flags.ts +281 -0
- package/src/Gate.ts +159 -0
- package/src/Hash.ts +14 -0
- package/src/Identity.ts +1811 -0
- package/src/IntervalJob.ts +96 -0
- package/src/Invocation.ts +2387 -0
- package/src/KernelHandlers.ts +29 -0
- package/src/KernelModule.ts +165 -0
- package/src/MemberRoutes.ts +146 -0
- package/src/Module.ts +573 -0
- package/src/ModuleIdentity.ts +134 -0
- package/src/Notifications.ts +665 -0
- package/src/Outbox.ts +761 -0
- package/src/Privacy.ts +265 -0
- package/src/Progress.ts +360 -0
- package/src/QuerySurface.ts +559 -0
- package/src/QueryViews.ts +165 -0
- package/src/Readiness.ts +284 -0
- package/src/Redact.ts +22 -0
- package/src/Registry.ts +399 -0
- package/src/Release.ts +1197 -0
- package/src/Retention.ts +167 -0
- package/src/Scheduler.ts +657 -0
- package/src/Server.ts +1838 -0
- package/src/Sessions.ts +56 -0
- package/src/Settings.ts +312 -0
- package/src/Sharing.ts +525 -0
- package/src/Sync.ts +1478 -0
- package/src/Telemetry.ts +754 -0
- package/src/Versioning.ts +588 -0
- package/src/WorkItems.ts +367 -0
- package/src/Workflows.ts +746 -0
- package/src/agent/Admission.ts +37 -0
- package/src/agent/Channels.ts +58 -0
- package/src/agent/Context.ts +430 -0
- package/src/agent/Http.ts +523 -0
- package/src/agent/Metering.ts +625 -0
- package/src/agent/ModelSetup.ts +414 -0
- package/src/agent/Models.ts +850 -0
- package/src/agent/Processors.ts +156 -0
- package/src/agent/Queue.ts +97 -0
- package/src/agent/Receipts.ts +192 -0
- package/src/agent/Resources.ts +376 -0
- package/src/agent/Run.ts +3762 -0
- package/src/agent/Runtime.ts +635 -0
- package/src/agent/Settings.ts +171 -0
- package/src/agent/Skills.ts +118 -0
- package/src/agent/Store.ts +73 -0
- package/src/agent/ToolSearch.ts +152 -0
- package/src/agent/index.ts +68 -0
- package/src/agent/migrations/agent/0000_agent.sql +162 -0
- package/src/agent/migrations/agent/0001_model_call.sql +33 -0
- package/src/agent/migrations/agent/0002_device.sql +2 -0
- package/src/agent/migrations/agent/0003_authority.sql +1 -0
- package/src/agent/migrations/agent/0004_budget_alert.sql +2 -0
- package/src/agent/migrations/agent/0005_feedback.sql +13 -0
- package/src/agent/migrations/agent/0095_run_options.sql +3 -0
- package/src/agent/migrations/agent/0096_conversation_meta.sql +7 -0
- package/src/agent/migrations/agent/0097_submission.sql +26 -0
- package/src/agent/migrations/agent/0098_threads.sql +21 -0
- package/src/agent/migrations/agent/0099_submission_refused.sql +4 -0
- package/src/agent/migrations/agent/0142_teams.sql +19 -0
- package/src/agent/module.ts +1793 -0
- package/src/appState/Sweep.ts +66 -0
- package/src/appState/migrations/0000_app_state.sql +35 -0
- package/src/appState/module.ts +418 -0
- package/src/audit/migrations/README.md +1 -0
- package/src/audit/module.ts +95 -0
- package/src/auth/AuthProvider.ts +293 -0
- package/src/auth/BetterAuthProvider.ts +476 -0
- package/src/auth/Methods.ts +7 -0
- package/src/auth/SessionTokens.ts +156 -0
- package/src/collab/Collab.ts +708 -0
- package/src/collab/Housekeeping.ts +193 -0
- package/src/collab/LiveCopy.ts +98 -0
- package/src/collab/Socket.ts +380 -0
- package/src/collab/Store.ts +105 -0
- package/src/collab/Ydoc.ts +337 -0
- package/src/collab/derive/bundle.gen.ts +2 -0
- package/src/collab/derive/entry.ts +34 -0
- package/src/collab/derive/polyfill.ts +15 -0
- package/src/collab/migrations/.gitkeep +0 -0
- package/src/collab/module.ts +237 -0
- package/src/connections/Connections.ts +2315 -0
- package/src/connections/Connector.ts +304 -0
- package/src/connections/Crypto.ts +134 -0
- package/src/connections/Destinations.ts +351 -0
- package/src/connections/Discovery.ts +251 -0
- package/src/connections/EffectKinds.ts +30 -0
- package/src/connections/Effects.ts +541 -0
- package/src/connections/Metering.ts +205 -0
- package/src/connections/ProviderApi.ts +137 -0
- package/src/connections/Secrets.ts +581 -0
- package/src/connections/Sync.ts +318 -0
- package/src/connections/migrations/.gitkeep +0 -0
- package/src/connections/module.ts +584 -0
- package/src/data/Corpus.ts +434 -0
- package/src/data/Datasets.ts +479 -0
- package/src/data/Programs.ts +285 -0
- package/src/data/migrations/README.md +1 -0
- package/src/data/module.ts +177 -0
- package/src/db/Bootstrap.ts +2832 -0
- package/src/db/Catalog.ts +10 -0
- package/src/db/Conflicts.ts +42 -0
- package/src/db/DirectoryLock.ts +19 -0
- package/src/db/HandlerGate.ts +107 -0
- package/src/db/Host.ts +250 -0
- package/src/db/KernelSchema.ts +4422 -0
- package/src/db/MigrationCheck.ts +221 -0
- package/src/db/QueryViewCheck.ts +1035 -0
- package/src/db/ReadOnly.ts +23 -0
- package/src/db/Scram.ts +20 -0
- package/src/db/SqlState.ts +77 -0
- package/src/db/Startup.ts +25 -0
- package/src/db/ZeroDdl.ts +272 -0
- package/src/db/ZeroPush.ts +128 -0
- package/src/db/schema.snapshot.json +13831 -0
- package/src/devices/Devices.ts +1219 -0
- package/src/devices/Flow.ts +198 -0
- package/src/devices/Http.ts +212 -0
- package/src/devices/migrations/0000_devices.sql +53 -0
- package/src/devices/migrations/0001_parent_run.sql +2 -0
- package/src/devices/migrations/0002_authority.sql +1 -0
- package/src/devices/migrations/0003_follow_up.sql +4 -0
- package/src/devices/migrations/0004_commands.sql +30 -0
- package/src/devices/migrations/0005_command_cancel.sql +7 -0
- package/src/devices/module.ts +313 -0
- package/src/durable/Cluster.ts +90 -0
- package/src/durable/Definition.ts +244 -0
- package/src/durable/Schedule.ts +155 -0
- package/src/durable/Trust.ts +149 -0
- package/src/enterprise/Routes.ts +501 -0
- package/src/enterprise/WorkOs.ts +133 -0
- package/src/files/FileTable.ts +84 -0
- package/src/files/Files.ts +1652 -0
- package/src/files/Http.ts +46 -0
- package/src/files/LocalStorage.ts +348 -0
- package/src/files/Providers.ts +356 -0
- package/src/files/S3Storage.ts +403 -0
- package/src/files/SigV4.ts +222 -0
- package/src/files/Sniff.ts +218 -0
- package/src/files/Storage.ts +143 -0
- package/src/files/migrations/README.md +1 -0
- package/src/files/module.ts +282 -0
- package/src/flags/migrations/0000_flags.sql +20 -0
- package/src/flags/module.ts +178 -0
- package/src/inbox/Flow.ts +548 -0
- package/src/inbox/System.ts +33 -0
- package/src/inbox/approvals.ts +335 -0
- package/src/inbox/consent.ts +331 -0
- package/src/inbox/index.ts +24 -0
- package/src/inbox/migrations/approvals/0000_approvals.sql +36 -0
- package/src/inbox/migrations/approvals/0001_provenance.sql +1 -0
- package/src/inbox/migrations/approvals/0002_withdrawn.sql +3 -0
- package/src/inbox/migrations/approvals/0003_title.sql +11 -0
- package/src/inbox/migrations/consent/0000_consent.sql +31 -0
- package/src/inbox/migrations/consent/0001_consent_revoked.sql +3 -0
- package/src/inbox/migrations/consent/0002_permission_request.sql +1 -0
- package/src/inbox/migrations/consent/0003_title.sql +11 -0
- package/src/inbox/migrations/inbox/0000_work_items.sql +31 -0
- package/src/inbox/migrations/notifications/0000_notifications.sql +66 -0
- package/src/inbox/notifications.ts +471 -0
- package/src/inbox/tables.ts +163 -0
- package/src/inbox/workItems.ts +199 -0
- package/src/index.ts +229 -0
- package/src/ingestion/Chunk.ts +49 -0
- package/src/ingestion/Extract.ts +387 -0
- package/src/ingestion/ExtractChild.ts +67 -0
- package/src/ingestion/ExtractPool.ts +270 -0
- package/src/ingestion/Ingestion.ts +929 -0
- package/src/ingestion/Isolated.ts +26 -0
- package/src/ingestion/Markup.ts +117 -0
- package/src/ingestion/Pdf.ts +167 -0
- package/src/ingestion/Runs.ts +192 -0
- package/src/ingestion/Scrub.ts +22 -0
- package/src/ingestion/Zip.ts +87 -0
- package/src/ingestion/migrations/README.md +1 -0
- package/src/ingestion/module.ts +65 -0
- package/src/ingress/Definition.ts +158 -0
- package/src/ingress/Ingress.ts +1220 -0
- package/src/ingress/Verifiers.ts +166 -0
- package/src/machine/MachineIdentity.ts +310 -0
- package/src/machine/Managed.ts +228 -0
- package/src/machine/OAuth.ts +1140 -0
- package/src/machine/Pages.ts +139 -0
- package/src/machine/Tokens.ts +75 -0
- package/src/make/Credentials.ts +36 -0
- package/src/make/Example.ts +104 -0
- package/src/make/Execute.ts +534 -0
- package/src/make/Http.ts +71 -0
- package/src/make/Lifecycle.ts +911 -0
- package/src/make/Manifest.ts +884 -0
- package/src/make/Repair.ts +262 -0
- package/src/make/Runtime.ts +494 -0
- package/src/make/Session.ts +33 -0
- package/src/make/SqlGuard.ts +362 -0
- package/src/make/Subscribe.ts +282 -0
- package/src/make/Validate.ts +247 -0
- package/src/make/ViewStep.ts +64 -0
- package/src/make/migrations/README.md +1 -0
- package/src/make/module.ts +261 -0
- package/src/notifications/Decide.ts +483 -0
- package/src/notifications/Providers.ts +532 -0
- package/src/notifications/Push.ts +594 -0
- package/src/notifications/Smtp.ts +379 -0
- package/src/policy/CedarSchema.ts +156 -0
- package/src/policy/Compiler.ts +1627 -0
- package/src/policy/Policy.ts +178 -0
- package/src/policy/Rls.ts +460 -0
- package/src/policy/Row.ts +15 -0
- package/src/privacy/Flow.ts +283 -0
- package/src/privacy/Inventory.ts +2414 -0
- package/src/privacy/Sources.ts +831 -0
- package/src/privacy/Visits.ts +339 -0
- package/src/privacy/ZeroCvr.ts +66 -0
- package/src/privacy/migrations/0000_privacy.sql +48 -0
- package/src/privacy/module.ts +280 -0
- package/src/progress/migrations/0000_progress.sql +27 -0
- package/src/progress/migrations/0001_notify.sql +1 -0
- package/src/progress/module.ts +161 -0
- package/src/proposals/migrations/README.md +1 -0
- package/src/proposals/module.ts +338 -0
- package/src/query/migrations/README.md +1 -0
- package/src/query/module.ts +66 -0
- package/src/records/Access.ts +97 -0
- package/src/records/References.ts +65 -0
- package/src/runtime/bun.ts +131 -0
- package/src/runtime/idle.ts +88 -0
- package/src/runtime/node.ts +140 -0
- package/src/runtime/resolve.ts +141 -0
- package/src/sandbox/Sandbox.ts +330 -0
- package/src/sandbox/worker.ts +577 -0
- package/src/scheduler/Automations.ts +319 -0
- package/src/scheduler/History.ts +231 -0
- package/src/scheduler/migrations/0000_schedules.sql +11 -0
- package/src/scheduler/migrations/0001_resumed_at.sql +1 -0
- package/src/scheduler/migrations/0002_origin.sql +3 -0
- package/src/scheduler/migrations/0003_authority.sql +1 -0
- package/src/scheduler/migrations/0004_operate.sql +18 -0
- package/src/scheduler/module.ts +445 -0
- package/src/search/RecordLock.ts +25 -0
- package/src/search/Search.ts +563 -0
- package/src/search/Sources.ts +157 -0
- package/src/search/migrations/README.md +1 -0
- package/src/search/module.ts +49 -0
- package/src/settings/migrations/0000_settings.sql +15 -0
- package/src/settings/module.ts +126 -0
- package/src/sharing/migrations/0000_access_requests.sql +17 -0
- package/src/sharing/module.ts +351 -0
- package/src/spaces/migrations/0000_spaces.sql +35 -0
- package/src/spaces/module.ts +287 -0
- package/src/surfaces/Agent.ts +224 -0
- package/src/surfaces/CookieGuard.ts +433 -0
- package/src/surfaces/Http.ts +341 -0
- package/src/surfaces/Mcp.ts +585 -0
- package/src/surfaces/Rpc.ts +101 -0
- package/src/surfaces/headers.ts +16 -0
- package/src/surfaces/request.ts +173 -0
- package/src/telemetry/migrations/.gitkeep +0 -0
- package/src/telemetry/module.ts +94 -0
- package/src/versioning/migrations/.gitkeep +0 -0
- package/src/versioning/module.ts +194 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent surface: every action becomes a tool whose input schema is the action's emitted JSON Schema. Tool calls
|
|
3
|
+
* run through the same invocation path, agent-originated: with the credentials of the person the agent serves
|
|
4
|
+
* (`toolsFor`, Vercel AI SDK tools), or, for the kernel's own agent runtime, as the person through the
|
|
5
|
+
* conversation's agent session (`execute`). Either way consent, policy, idempotency and audit apply.
|
|
6
|
+
*/
|
|
7
|
+
import type { AnyAction, AuditLineage, ExecutionIdentity, Forbidden, WriteReceipt } from "@eloxiv/contracts"
|
|
8
|
+
import { compactResult, InvocationError, mcpToolInput, renderResult, toJsonSchema, toolName } from "@eloxiv/contracts"
|
|
9
|
+
import { jsonSchema, tool, type ToolSet } from "ai"
|
|
10
|
+
import { Context, Effect, Exit, Layer, Option, Schema } from "effect"
|
|
11
|
+
import { Invocation } from "../Invocation.ts"
|
|
12
|
+
import type { EditGroup } from "../Versioning.ts"
|
|
13
|
+
import { MakeRuntime } from "../make/Runtime.ts"
|
|
14
|
+
import { Registry } from "../Registry.ts"
|
|
15
|
+
import { writeReceipt } from "../agent/Receipts.ts"
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A tool call's result. On success `output` is the result envelope, as on every surface:
|
|
19
|
+
* `{ kind: "output", output }`, or on a replayed tool call (same tool-call id) `{ kind: "replay", receipt }`.
|
|
20
|
+
*/
|
|
21
|
+
export type AgentToolResult =
|
|
22
|
+
| {
|
|
23
|
+
readonly ok: true
|
|
24
|
+
readonly output: unknown
|
|
25
|
+
/**
|
|
26
|
+
* The output as compact text (the ResultRendering contract), when the action declares a renderer: what the
|
|
27
|
+
* model reads first, bounded in characters and rows. The envelope stays complete beside it.
|
|
28
|
+
*/
|
|
29
|
+
readonly rendered?: string
|
|
30
|
+
/**
|
|
31
|
+
* What the call changed and whether that is verified (`agent/Receipts.ts`): on every successful call of an
|
|
32
|
+
* action of the app's that is not read-only.
|
|
33
|
+
*/
|
|
34
|
+
readonly receipt?: WriteReceipt
|
|
35
|
+
}
|
|
36
|
+
| { readonly ok: false; readonly error: { readonly _tag: string; readonly [key: string]: unknown } }
|
|
37
|
+
|
|
38
|
+
/** One action as a tool: its tool name (`hello_greet`), the action, its description and input JSON Schema. */
|
|
39
|
+
export interface AgentToolDefinition {
|
|
40
|
+
readonly name: string
|
|
41
|
+
readonly action: string
|
|
42
|
+
/** What people see the action called (`ActionContract.title`): a consent prompt names it. */
|
|
43
|
+
readonly title: string
|
|
44
|
+
readonly description: string
|
|
45
|
+
readonly inputSchema: unknown
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Who a tool call acts for: a surface's credentials, or (the agent runtime) a person through an agent session. */
|
|
49
|
+
export type AgentCaller =
|
|
50
|
+
| { readonly headers: Headers }
|
|
51
|
+
| {
|
|
52
|
+
readonly identity: ExecutionIdentity
|
|
53
|
+
readonly agentSession?: string | undefined
|
|
54
|
+
/** Checked inside the call's transaction before it runs (see `InvocationRequest.guard`). */
|
|
55
|
+
readonly guard?: Effect.Effect<void, Forbidden> | undefined
|
|
56
|
+
/** The run, step and tool call the call is made from (its audit lineage). */
|
|
57
|
+
readonly agentRun?: AuditLineage["agentRun"] | undefined
|
|
58
|
+
/** The run's agent edit group (the Versioning contract): its changes are kept with it. */
|
|
59
|
+
readonly editGroup?: EditGroup | undefined
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface AgentToolsShape {
|
|
63
|
+
/** Every action of the app's modules as a tool definition, by tool name. */
|
|
64
|
+
readonly definitions: ReadonlyMap<string, AgentToolDefinition>
|
|
65
|
+
/**
|
|
66
|
+
* The tools of a run in `orgId`: the app's actions, and those of the MAKE modules installed in that
|
|
67
|
+
* organisation now (read on every call, so an install or a rollback reaches the next model call).
|
|
68
|
+
*/
|
|
69
|
+
readonly definitionsFor: (orgId: string) => Effect.Effect<ReadonlyMap<string, AgentToolDefinition>>
|
|
70
|
+
/** Run one tool call through the invocation path, agent-originated, keyed by `idempotencyKey`. */
|
|
71
|
+
readonly execute: (request: {
|
|
72
|
+
readonly action: string
|
|
73
|
+
readonly input: unknown
|
|
74
|
+
readonly idempotencyKey: string
|
|
75
|
+
readonly caller: AgentCaller
|
|
76
|
+
}) => Effect.Effect<AgentToolResult>
|
|
77
|
+
/**
|
|
78
|
+
* AI SDK tools for one agent turn, acting with the caller's credentials: only the actions the caller's agent
|
|
79
|
+
* can reach (`Invocation.reach` on the agent surface: what the policy, the credential's scope or a disabled
|
|
80
|
+
* agent tool group hides is not offered). A caller that cannot be resolved is offered nothing. A call to any
|
|
81
|
+
* other action through `execute` is refused, and audited, by the invocation path.
|
|
82
|
+
*/
|
|
83
|
+
readonly toolsFor: (headers: Headers) => Effect.Effect<ToolSet>
|
|
84
|
+
/** The tool names (`hello_greet`) of the actions a caller's agent can reach now, sorted. */
|
|
85
|
+
readonly reachable: (caller: AgentCaller) => Effect.Effect<ReadonlyArray<string>>
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export class AgentTools extends Context.Service<AgentTools, AgentToolsShape>()("@eloxiv/kernel/AgentTools") {
|
|
89
|
+
static readonly layer = Layer.effect(
|
|
90
|
+
AgentTools,
|
|
91
|
+
Effect.gen(function* () {
|
|
92
|
+
const registry = yield* Registry
|
|
93
|
+
const invocation = yield* Invocation
|
|
94
|
+
const context = yield* Effect.context()
|
|
95
|
+
const run = Effect.runPromiseExitWith(context)
|
|
96
|
+
const actions: ReadonlyArray<AnyAction> = [...registry.actions.values()].map((a) => a.contract)
|
|
97
|
+
const definitions = new Map(
|
|
98
|
+
actions.map((action) => [
|
|
99
|
+
toolName(action.name),
|
|
100
|
+
{
|
|
101
|
+
name: toolName(action.name),
|
|
102
|
+
action: action.name,
|
|
103
|
+
title: action.title,
|
|
104
|
+
description: action.description,
|
|
105
|
+
// Object-rooted, as MCP's (model providers refuse a function whose parameters are not an object).
|
|
106
|
+
inputSchema: mcpToolInput(toJsonSchema(action.input)),
|
|
107
|
+
} satisfies AgentToolDefinition,
|
|
108
|
+
]),
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
const make = yield* Effect.serviceOption(MakeRuntime)
|
|
112
|
+
const definitionsFor = (orgId: string) =>
|
|
113
|
+
Option.isNone(make)
|
|
114
|
+
? Effect.succeed<ReadonlyMap<string, AgentToolDefinition>>(definitions)
|
|
115
|
+
: Effect.map(make.value.tools(orgId), (extra) => {
|
|
116
|
+
const all = new Map<string, AgentToolDefinition>(definitions)
|
|
117
|
+
for (const tool of extra) if (!all.has(tool.name)) all.set(tool.name, tool)
|
|
118
|
+
return all
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
const execute = (request: {
|
|
122
|
+
readonly action: string
|
|
123
|
+
readonly input: unknown
|
|
124
|
+
readonly idempotencyKey: string
|
|
125
|
+
readonly caller: AgentCaller
|
|
126
|
+
}): Effect.Effect<AgentToolResult> =>
|
|
127
|
+
Effect.gen(function* () {
|
|
128
|
+
const exit = yield* Effect.exit(
|
|
129
|
+
invocation.invoke({
|
|
130
|
+
action: request.action,
|
|
131
|
+
input: { encoded: request.input },
|
|
132
|
+
surface: "agent",
|
|
133
|
+
idempotencyKey: request.idempotencyKey,
|
|
134
|
+
...("headers" in request.caller
|
|
135
|
+
? { headers: request.caller.headers }
|
|
136
|
+
: {
|
|
137
|
+
identity: request.caller.identity,
|
|
138
|
+
agentSession: request.caller.agentSession,
|
|
139
|
+
guard: request.caller.guard,
|
|
140
|
+
agentRun: request.caller.agentRun,
|
|
141
|
+
editGroup: request.caller.editGroup,
|
|
142
|
+
}),
|
|
143
|
+
}),
|
|
144
|
+
)
|
|
145
|
+
if (Exit.isSuccess(exit)) {
|
|
146
|
+
const contract = registry.actions.get(request.action)?.contract
|
|
147
|
+
const render = contract?.render
|
|
148
|
+
const envelope = exit.value.encoded as { readonly kind?: unknown; readonly output?: unknown }
|
|
149
|
+
const receipt = contract === undefined ? undefined : writeReceipt(contract, envelope, exit.value.effects)
|
|
150
|
+
return {
|
|
151
|
+
ok: true,
|
|
152
|
+
output: exit.value.encoded,
|
|
153
|
+
...(render === undefined || envelope.kind !== "output"
|
|
154
|
+
? {}
|
|
155
|
+
: { rendered: compactResult(renderResult(render, envelope.output)) }),
|
|
156
|
+
...(receipt === undefined ? {} : { receipt }),
|
|
157
|
+
} as const
|
|
158
|
+
}
|
|
159
|
+
const error = exit.cause.reasons.find((r) => r._tag === "Fail")
|
|
160
|
+
if (error && error._tag === "Fail") {
|
|
161
|
+
// As every surface answers it: encoded through `InvocationError`, its message included (spreading the
|
|
162
|
+
// error dropped it, so a model never learned why its input was refused).
|
|
163
|
+
const encoded = yield* Schema.encodeUnknownEffect(Schema.toCodecJson(InvocationError))(error.error).pipe(
|
|
164
|
+
Effect.orElseSucceed(() => ({
|
|
165
|
+
_tag: (error.error as { _tag: string })._tag,
|
|
166
|
+
message: error.error instanceof Error ? error.error.message : "",
|
|
167
|
+
})),
|
|
168
|
+
)
|
|
169
|
+
return { ok: false, error: encoded as { readonly _tag: string } } as const
|
|
170
|
+
}
|
|
171
|
+
return yield* Effect.die(new Error(`Tool ${request.action} failed unexpectedly`))
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
const reachable = (caller: AgentCaller): Effect.Effect<ReadonlyArray<string>> =>
|
|
175
|
+
invocation
|
|
176
|
+
.reach(
|
|
177
|
+
"headers" in caller
|
|
178
|
+
? { surface: "agent", headers: caller.headers }
|
|
179
|
+
: { surface: "agent", identity: caller.identity, agentSession: caller.agentSession },
|
|
180
|
+
)
|
|
181
|
+
.pipe(
|
|
182
|
+
// The app's actions and the caller's organisation's MAKE actions, each as reach decided.
|
|
183
|
+
Effect.flatMap((reach) =>
|
|
184
|
+
Effect.map(definitionsFor(reach.actor.orgId), (known) =>
|
|
185
|
+
reach.actions.map(toolName).filter((name) => known.has(name)),
|
|
186
|
+
),
|
|
187
|
+
),
|
|
188
|
+
Effect.orElseSucceed(() => []),
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
return AgentTools.of({
|
|
192
|
+
definitions,
|
|
193
|
+
definitionsFor,
|
|
194
|
+
execute,
|
|
195
|
+
reachable,
|
|
196
|
+
toolsFor: (headers) =>
|
|
197
|
+
Effect.map(reachable({ headers }), (names) =>
|
|
198
|
+
Object.fromEntries(
|
|
199
|
+
names
|
|
200
|
+
.flatMap((name) => {
|
|
201
|
+
const definition = definitions.get(name)
|
|
202
|
+
return definition === undefined ? [] : [definition]
|
|
203
|
+
})
|
|
204
|
+
.map((definition) => [
|
|
205
|
+
definition.name,
|
|
206
|
+
tool({
|
|
207
|
+
description: definition.description,
|
|
208
|
+
inputSchema: jsonSchema<Record<string, unknown>>(definition.inputSchema as any),
|
|
209
|
+
// A retried tool call (same id from the model or the agent runtime) replays instead of re-executing.
|
|
210
|
+
execute: async (input, { toolCallId }): Promise<AgentToolResult> => {
|
|
211
|
+
const exit = await run(
|
|
212
|
+
execute({ action: definition.action, input, idempotencyKey: toolCallId, caller: { headers } }),
|
|
213
|
+
)
|
|
214
|
+
if (Exit.isSuccess(exit)) return exit.value
|
|
215
|
+
throw new Error(`Tool ${definition.action} failed unexpectedly`)
|
|
216
|
+
},
|
|
217
|
+
}),
|
|
218
|
+
]),
|
|
219
|
+
),
|
|
220
|
+
),
|
|
221
|
+
})
|
|
222
|
+
}),
|
|
223
|
+
)
|
|
224
|
+
}
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kernel's one guard against cross-site request forgery on cookie-authenticated mutations: a global middleware of
|
|
3
|
+
* `KernelRoutes`, so it stands in front of every route the kernel serves, today's and any added later.
|
|
4
|
+
*
|
|
5
|
+
* A browser attaches the session cookie (Better Auth's, SameSite=Lax) to a request another page makes. SameSite=Lax
|
|
6
|
+
* stops a cross-site POST, not a same-site one from another origin (a sibling subdomain), and CORS stops a page from
|
|
7
|
+
* reading the answer, not the request from acting. So a state-changing request (POST, PUT, PATCH, DELETE) that carries
|
|
8
|
+
* the session cookie and no `Authorization` header (a bearer credential is never attached by the browser, and a page
|
|
9
|
+
* of another origin cannot send one without the kernel's CORS approval) is refused unless:
|
|
10
|
+
*
|
|
11
|
+
* - its `Origin` is the kernel's own (`ELOXIV_BASE_URL`'s) or one the deployment trusts (`ELOXIV_TRUSTED_ORIGINS`);
|
|
12
|
+
* a missing `Origin`, or `null`, is refused;
|
|
13
|
+
* - its Fetch Metadata agrees (`Sec-Fetch-Site`, when the browser sends it): `same-origin` only from the kernel's own
|
|
14
|
+
* origin, `same-site` and `cross-site` only from an origin the deployment trusts (`same-site` is not trust: a sibling
|
|
15
|
+
* subdomain is same-site), `none` (a navigation the person typed) never;
|
|
16
|
+
* - its body is what the route takes: `application/json` on JSON routes (any route not listed otherwise, so a route
|
|
17
|
+
* added later is JSON until it says otherwise), forms on the OAuth pages' and unsubscribe's forms, anything on
|
|
18
|
+
* uploads and webhooks. A `text/plain` or bodiless "simple" request a page can send without a preflight is refused.
|
|
19
|
+
*
|
|
20
|
+
* The exemption follows the credential actually used: a request with an `Authorization` header (any value, a malformed
|
|
21
|
+
* or invalid one included) reaches its route without its cookie, so it authenticates by that header or not at all
|
|
22
|
+
* (and `Identity` never reads the cookie of a request that has one: `presentedCredential`). Without that, Better Auth
|
|
23
|
+
* would fall back to the cookie when the header's token does not verify, and a forged `Authorization: Bearer x` would
|
|
24
|
+
* carry a cookie-authenticated mutation past the guard.
|
|
25
|
+
*
|
|
26
|
+
* `COOKIE_ROUTES` is the inventory of every state-changing route the kernel registers, with the body it takes:
|
|
27
|
+
* `cookie-guard.test.ts` fails when the router registers a route (read from the router itself as `KernelRoutes`
|
|
28
|
+
* builds it) that the inventory does not list, and sends each a forged cookie request.
|
|
29
|
+
*/
|
|
30
|
+
import { parseCookies } from "better-call"
|
|
31
|
+
import { Effect, Layer } from "effect"
|
|
32
|
+
import { Cookies, Headers, HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http"
|
|
33
|
+
import { Audit } from "../Audit.ts"
|
|
34
|
+
import { Identity } from "../Identity.ts"
|
|
35
|
+
import { CLIENT_ADDRESS_HEADER, toWebHeaders } from "./headers.ts"
|
|
36
|
+
import { clientAddress } from "./request.ts"
|
|
37
|
+
|
|
38
|
+
/** The methods that change state: the guard's whole scope (GET, HEAD and OPTIONS change nothing). */
|
|
39
|
+
export const MUTATING_METHODS: ReadonlySet<string> = new Set(["POST", "PUT", "PATCH", "DELETE"])
|
|
40
|
+
|
|
41
|
+
/** What a route's body is: JSON, an HTML form, or anything (an upload's bytes, a webhook's payload). */
|
|
42
|
+
export type RouteBody = "json" | "form" | "any"
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Every state-changing route the kernel registers (a pattern: `*` stands for the rest of the path, `:name` for one
|
|
46
|
+
* segment), with the body it takes. A route not listed is JSON.
|
|
47
|
+
*/
|
|
48
|
+
export const COOKIE_ROUTES: ReadonlyArray<{
|
|
49
|
+
readonly method: string
|
|
50
|
+
readonly path: string
|
|
51
|
+
readonly body: RouteBody
|
|
52
|
+
}> = [
|
|
53
|
+
// Better Auth (sign-in, sign-up, sign-out, sessions): JSON.
|
|
54
|
+
{ method: "*", path: "/auth/*", body: "json" },
|
|
55
|
+
// The surfaces: actions over HTTP, the typed client's RPC (JSON or NDJSON, see `jsonLike`), MCP.
|
|
56
|
+
{ method: "POST", path: "/api/actions/*", body: "json" },
|
|
57
|
+
// A visitor's consent and touch (Privacy), and a signed-in person's claim of their visit.
|
|
58
|
+
{ method: "POST", path: "/privacy/visit", body: "json" },
|
|
59
|
+
{ method: "POST", path: "/privacy/visit/claim", body: "json" },
|
|
60
|
+
// Read batches (each item a read-only action call) and WebMCP's browser-agent sessions.
|
|
61
|
+
{ method: "POST", path: "/api/batch", body: "json" },
|
|
62
|
+
{ method: "POST", path: "/api/webmcp/session", body: "json" },
|
|
63
|
+
{ method: "POST", path: "/api/webmcp/session/revoke", body: "json" },
|
|
64
|
+
{ method: "POST", path: "/rpc", body: "json" },
|
|
65
|
+
{ method: "POST", path: "/mcp", body: "json" },
|
|
66
|
+
// The MCP server registers its endpoint for every method (a session's DELETE among them): JSON, as for POST.
|
|
67
|
+
{ method: "PUT", path: "/mcp", body: "json" },
|
|
68
|
+
{ method: "PATCH", path: "/mcp", body: "json" },
|
|
69
|
+
{ method: "DELETE", path: "/mcp", body: "json" },
|
|
70
|
+
{ method: "POST", path: "/mcp/*", body: "json" },
|
|
71
|
+
// The agent, MAKE's actions, sync's endpoints (zero-cache forwards a bearer credential, never a cookie).
|
|
72
|
+
{ method: "POST", path: "/agent/messages", body: "json" },
|
|
73
|
+
{ method: "POST", path: "/agent/complete", body: "json" },
|
|
74
|
+
// Model setup (keys, checks, choices, policy): only from the person's own session, so guarded as any JSON mutation.
|
|
75
|
+
{ method: "POST", path: "/agent/models/*", body: "json" },
|
|
76
|
+
{ method: "POST", path: "/make/actions/*", body: "json" },
|
|
77
|
+
{ method: "POST", path: "/zero/query", body: "json" },
|
|
78
|
+
{ method: "POST", path: "/zero/mutate", body: "json" },
|
|
79
|
+
// Management operations (a person's session): machine identity, ingress, devices, secrets.
|
|
80
|
+
{ method: "POST", path: "/kernel/machine-identity/*", body: "json" },
|
|
81
|
+
{ method: "POST", path: "/kernel/ingress/*", body: "json" },
|
|
82
|
+
{ method: "POST", path: "/kernel/devices/*", body: "json" },
|
|
83
|
+
{ method: "POST", path: "/kernel/secrets/*", body: "json" },
|
|
84
|
+
// Member administration (a person's own session): adding a member and giving a role; removing either.
|
|
85
|
+
{ method: "POST", path: "/api/org/members/*", body: "json" },
|
|
86
|
+
{ method: "DELETE", path: "/api/org/members/*", body: "json" },
|
|
87
|
+
{ method: "POST", path: "/kernel/directory/*", body: "json" },
|
|
88
|
+
// A person's own avatar: the photo's bytes, and its removal.
|
|
89
|
+
{ method: "PUT", path: "/api/me/avatar", body: "any" },
|
|
90
|
+
{ method: "DELETE", path: "/api/me/avatar", body: "json" },
|
|
91
|
+
// The desktop sign-in exchange: a signed-in person approves a desktop's challenge; the desktop redeems its code.
|
|
92
|
+
{ method: "POST", path: "/api/desktop/approve", body: "json" },
|
|
93
|
+
{ method: "POST", path: "/api/desktop/token", body: "json" },
|
|
94
|
+
// Enterprise sign-in (WorkOS SSO) starts here; Directory Sync's webhook (WorkOS's signed payload).
|
|
95
|
+
{ method: "POST", path: "/api/sso/start", body: "json" },
|
|
96
|
+
{ method: "POST", path: "/api/workos/webhook", body: "any" },
|
|
97
|
+
// The daemon's endpoints (a device credential; pairing starts without one).
|
|
98
|
+
{ method: "POST", path: "/kernel/device/pair/start", body: "json" },
|
|
99
|
+
{ method: "POST", path: "/kernel/device/pair/poll", body: "json" },
|
|
100
|
+
{ method: "POST", path: "/kernel/device/relay-session", body: "json" },
|
|
101
|
+
{ method: "POST", path: "/kernel/device/turns/next", body: "json" },
|
|
102
|
+
{ method: "POST", path: "/kernel/device/turns/events", body: "json" },
|
|
103
|
+
{ method: "POST", path: "/kernel/device/turns/complete", body: "json" },
|
|
104
|
+
{ method: "POST", path: "/kernel/device/sessions", body: "json" },
|
|
105
|
+
{ method: "POST", path: "/kernel/device/commands/next", body: "json" },
|
|
106
|
+
{ method: "POST", path: "/kernel/device/commands/complete", body: "json" },
|
|
107
|
+
{ method: "POST", path: "/kernel/device/commands/check", body: "json" },
|
|
108
|
+
{ method: "POST", path: "/kernel/device/capabilities", body: "json" },
|
|
109
|
+
{ method: "POST", path: "/kernel/device/push", body: "json" },
|
|
110
|
+
// The OAuth authorisation server: its pages' forms (each with its own CSRF token too) and its client endpoints.
|
|
111
|
+
{ method: "POST", path: "/oauth/sign-in", body: "form" },
|
|
112
|
+
{ method: "POST", path: "/oauth/consent", body: "form" },
|
|
113
|
+
{ method: "POST", path: "/oauth/device", body: "form" },
|
|
114
|
+
{ method: "POST", path: "/oauth/token", body: "form" },
|
|
115
|
+
{ method: "POST", path: "/oauth/revoke", body: "form" },
|
|
116
|
+
{ method: "POST", path: "/oauth/device_authorization", body: "form" },
|
|
117
|
+
{ method: "POST", path: "/oauth/register", body: "json" },
|
|
118
|
+
// One-click unsubscribe (RFC 8058: a form a mail provider posts, with the link's token).
|
|
119
|
+
{ method: "POST", path: "/notifications/unsubscribe", body: "form" },
|
|
120
|
+
// A push notification's decision (its token, no session needed): JSON.
|
|
121
|
+
{ method: "POST", path: "/api/notifications/decide", body: "json" },
|
|
122
|
+
// Uploads (the file's own bytes) and inbound webhooks (each source's payload, signed).
|
|
123
|
+
{ method: "PUT", path: "/files/upload", body: "any" },
|
|
124
|
+
{ method: "POST", path: "/ingress/:source", body: "any" },
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Every route a GET (or HEAD) reaches, with what it does. A browser follows a GET from any page with the person's
|
|
129
|
+
* cookie and no `Origin`, so the guard cannot tell a forged one from a real navigation: a GET either only reads, or
|
|
130
|
+
* changes state only under a protection a forged navigation cannot present (`protection`: a secret the request must
|
|
131
|
+
* carry, bound to the person's session or issued to them). `cookie-guard.test.ts` fails when the router registers a
|
|
132
|
+
* GET this does not cover, and sends each `write` a forged request that must change nothing.
|
|
133
|
+
*/
|
|
134
|
+
export const GET_ROUTES: ReadonlyArray<
|
|
135
|
+
| { readonly path: string; readonly effect: "read" }
|
|
136
|
+
| { readonly path: string; readonly effect: "write"; readonly protection: string }
|
|
137
|
+
> = [
|
|
138
|
+
// Reads: health and the kernel's descriptions, the person's own reads (each under their session's hold or their
|
|
139
|
+
// chain's assertion), MCP's event stream, the OAuth pages, the daemon's verify page, downloads (a signed URL).
|
|
140
|
+
{ path: "/health", effect: "read" },
|
|
141
|
+
{ path: "/ready", effect: "read" },
|
|
142
|
+
{ path: "/release", effect: "read" },
|
|
143
|
+
{ path: "/api/me/organizations", effect: "read" },
|
|
144
|
+
{ path: "/api/org/members", effect: "read" },
|
|
145
|
+
{ path: "/api/org/roles", effect: "read" },
|
|
146
|
+
{ path: "/api/users/:userId/avatar", effect: "read" },
|
|
147
|
+
{ path: "/api/openapi.json", effect: "read" },
|
|
148
|
+
{ path: "/api/webmcp/tools", effect: "read" },
|
|
149
|
+
{ path: "/mcp", effect: "read" },
|
|
150
|
+
{ path: "/.well-known/*", effect: "read" },
|
|
151
|
+
{ path: "/oauth/consent", effect: "read" },
|
|
152
|
+
{ path: "/oauth/device", effect: "read" },
|
|
153
|
+
{ path: "/kernel/device/me", effect: "read" },
|
|
154
|
+
{ path: "/kernel/devices/verify", effect: "read" },
|
|
155
|
+
{ path: "/agent/*", effect: "read" },
|
|
156
|
+
{ path: "/files/download", effect: "read" },
|
|
157
|
+
// A visitor's own consent and attribution (Privacy), named by their visit cookie.
|
|
158
|
+
{ path: "/privacy/visit", effect: "read" },
|
|
159
|
+
{
|
|
160
|
+
path: "/auth/*",
|
|
161
|
+
effect: "write",
|
|
162
|
+
protection:
|
|
163
|
+
"Better Auth's GETs change state only with a token a link carries (an email's verification) or for the session that makes them (its own expiry, moved forward on use)",
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
path: "/oauth/authorize",
|
|
167
|
+
effect: "write",
|
|
168
|
+
protection:
|
|
169
|
+
"records a pending authorisation request for a registered client and its registered redirect URI, which acts only once the person decides on the consent page (a POST with its session-bound csrf)",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
path: "/connections/authorize",
|
|
173
|
+
effect: "write",
|
|
174
|
+
protection:
|
|
175
|
+
"binds a flow to the session only for its own person, with the flow's id: 144 random bits the person's own connect action returned (a forged id matches no flow)",
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
path: "/connections/callback",
|
|
179
|
+
effect: "write",
|
|
180
|
+
protection:
|
|
181
|
+
"completes a flow only with the state bound to this session at authorize (256 random bits, hashed; single use)",
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
path: "/api/sso/callback",
|
|
185
|
+
effect: "write",
|
|
186
|
+
protection:
|
|
187
|
+
"completes an SSO sign-in only with the state its start bound to this browser (its cookie, 256 random bits, hashed, single use, ten minutes) and WorkOS's one-time code",
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
path: "/notifications/unsubscribe",
|
|
191
|
+
effect: "write",
|
|
192
|
+
protection:
|
|
193
|
+
"acts only with the link's signed token (organisation, person and category, HMAC under the kernel's secret)",
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
path: "/collab/socket",
|
|
197
|
+
effect: "write",
|
|
198
|
+
protection:
|
|
199
|
+
"a WebSocket: the cookie is used only from a trusted origin (the upgrade's Origin), and each change is an action on the invocation path",
|
|
200
|
+
},
|
|
201
|
+
]
|
|
202
|
+
|
|
203
|
+
const matches = (pattern: string, path: string) => {
|
|
204
|
+
if (pattern.endsWith("/*")) {
|
|
205
|
+
const base = pattern.slice(0, -2)
|
|
206
|
+
return path === base || path.startsWith(`${base}/`)
|
|
207
|
+
}
|
|
208
|
+
const want = pattern.split("/")
|
|
209
|
+
const have = path.split("/")
|
|
210
|
+
return want.length === have.length && want.every((segment, i) => segment.startsWith(":") || segment === have[i])
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** The body a route takes: its inventory entry's, else JSON (a route added later is JSON until it says otherwise). */
|
|
214
|
+
export const bodyOf = (method: string, path: string): RouteBody =>
|
|
215
|
+
COOKIE_ROUTES.find((route) => (route.method === "*" || route.method === method) && matches(route.path, path))?.body ??
|
|
216
|
+
"json"
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Does the request carry Better Auth's session cookie (`name`: Better Auth's, by default `better-auth.session_token`;
|
|
220
|
+
* also its `__Secure-` and `__Host-` forms)? Read with Better Auth's own cookie parser (better-call's
|
|
221
|
+
* `parseCookies`), so whatever cookie Better Auth would authenticate by, the guard sees: a second parser could miss one
|
|
222
|
+
* Better Auth reads (a space before the `=`, a quoted value) and let a forged cookie request through.
|
|
223
|
+
*/
|
|
224
|
+
export const hasSessionCookie = (cookie: string | undefined, name = "better-auth.session_token") => {
|
|
225
|
+
if (cookie === undefined) return false
|
|
226
|
+
const keys = parseCookies(cookie)
|
|
227
|
+
const bare = name.replace(/^__(?:Secure|Host)-/u, "")
|
|
228
|
+
return [bare, `__Secure-${bare}`, `__Host-${bare}`].some((key) => keys.has(key))
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const mediaType = (contentType: string | undefined) => (contentType ?? "").split(";")[0]!.trim().toLowerCase()
|
|
232
|
+
|
|
233
|
+
/** JSON, or the typed client's NDJSON (RPC's framing). */
|
|
234
|
+
const jsonLike = (type: string) => type === "application/json" || type === "application/ndjson"
|
|
235
|
+
|
|
236
|
+
const normaliseOrigin = (origin: string) => origin.trim().replace(/\/+$/u, "")
|
|
237
|
+
|
|
238
|
+
export interface GuardRequest {
|
|
239
|
+
readonly method: string
|
|
240
|
+
/** The path, without the query. */
|
|
241
|
+
readonly path: string
|
|
242
|
+
readonly headers: Readonly<Record<string, string | undefined>>
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface GuardOrigins {
|
|
246
|
+
/** The kernel's own origin (`ELOXIV_BASE_URL`'s). */
|
|
247
|
+
readonly kernel: string
|
|
248
|
+
/** The origins the deployment trusts (`ELOXIV_TRUSTED_ORIGINS`). */
|
|
249
|
+
readonly trusted: ReadonlyArray<string>
|
|
250
|
+
/** Better Auth's session cookie's name (its context's), when known. */
|
|
251
|
+
readonly sessionCookie?: string | undefined
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** Why the guard refuses `request`, or `undefined` when it lets it through. Header names are lower case. */
|
|
255
|
+
export const cookieMutationRefusal = (request: GuardRequest, origins: GuardOrigins): string | undefined => {
|
|
256
|
+
const method = request.method.toUpperCase()
|
|
257
|
+
if (!MUTATING_METHODS.has(method)) return undefined
|
|
258
|
+
// A bearer credential is never attached by a browser: such a request is not cookie-authenticated (its cookie never
|
|
259
|
+
// reaches the route: `CookieGuard`).
|
|
260
|
+
if (request.headers["authorization"] !== undefined) return undefined
|
|
261
|
+
if (!hasSessionCookie(request.headers["cookie"], origins.sessionCookie)) return undefined
|
|
262
|
+
const kernel = normaliseOrigin(origins.kernel)
|
|
263
|
+
const trusted = new Set(origins.trusted.map(normaliseOrigin))
|
|
264
|
+
const origin = request.headers["origin"]
|
|
265
|
+
if (origin === undefined || origin.trim() === "" || origin.trim() === "null") {
|
|
266
|
+
return "A request that changes something with the session cookie must say where it comes from (Origin)"
|
|
267
|
+
}
|
|
268
|
+
const from = normaliseOrigin(origin)
|
|
269
|
+
const own = from === kernel
|
|
270
|
+
if (!own && !trusted.has(from)) {
|
|
271
|
+
return `Requests with the session cookie are accepted only from the kernel's own origin or a trusted one, not ${from}`
|
|
272
|
+
}
|
|
273
|
+
const site = request.headers["sec-fetch-site"]
|
|
274
|
+
if (site !== undefined) {
|
|
275
|
+
const consistent =
|
|
276
|
+
site === "same-origin" ? own : site === "same-site" || site === "cross-site" ? trusted.has(from) : false
|
|
277
|
+
if (!consistent) {
|
|
278
|
+
return `The browser says this request is ${site}, which does not fit its origin ${from}`
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
const body = bodyOf(method, request.path)
|
|
282
|
+
const type = mediaType(request.headers["content-type"])
|
|
283
|
+
if (body === "json" && !jsonLike(type)) {
|
|
284
|
+
return `This route takes application/json with the session cookie, not ${type === "" ? "no content type" : type}`
|
|
285
|
+
}
|
|
286
|
+
if (body === "form" && type !== "application/x-www-form-urlencoded" && type !== "multipart/form-data") {
|
|
287
|
+
return `This route takes a form with the session cookie, not ${type === "" ? "no content type" : type}`
|
|
288
|
+
}
|
|
289
|
+
return undefined
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** The kernel's management contracts' routes, and the action prefix their operations are audited under. */
|
|
293
|
+
const MANAGED_PREFIXES: Readonly<Record<string, string>> = {
|
|
294
|
+
"machine-identity": "eloxiv.machine",
|
|
295
|
+
ingress: "eloxiv.ingress",
|
|
296
|
+
devices: "eloxiv.devices",
|
|
297
|
+
secrets: "eloxiv.secrets",
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* The action a request is audited as: an action's name on the HTTP surface (`/api/actions/<name>`), a management
|
|
302
|
+
* operation's (`/kernel/<contract>/<operation>`), the agent's send; otherwise the route (`POST /oauth/consent`).
|
|
303
|
+
*/
|
|
304
|
+
export const canonicalAction = (method: string, path: string): string => {
|
|
305
|
+
if (path.startsWith("/api/actions/")) {
|
|
306
|
+
try {
|
|
307
|
+
return decodeURIComponent(path.slice("/api/actions/".length))
|
|
308
|
+
} catch {
|
|
309
|
+
return `${method.toUpperCase()} /api/actions/*`
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
const managed = /^\/kernel\/([a-z-]+)\/([A-Za-z]+)$/u.exec(path)
|
|
313
|
+
if (managed !== null && MANAGED_PREFIXES[managed[1]!] !== undefined) {
|
|
314
|
+
return `${MANAGED_PREFIXES[managed[1]!]}.${managed[2]}`
|
|
315
|
+
}
|
|
316
|
+
if (path === "/agent/messages") return "agent.send"
|
|
317
|
+
return routeOf(method, path)
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* The route a request falls under, for the bound on refusals' records: its inventory pattern, or one name for every
|
|
322
|
+
* path the kernel does not list. Never the path a caller chose (`/x/1`, `/x/2`, … are one route).
|
|
323
|
+
*/
|
|
324
|
+
export const routeOf = (method: string, path: string): string => {
|
|
325
|
+
const listed = COOKIE_ROUTES.find(
|
|
326
|
+
(route) => (route.method === "*" || route.method === method) && matches(route.path, path),
|
|
327
|
+
)
|
|
328
|
+
return `${method.toUpperCase()} ${listed?.path ?? "(a route the kernel does not list)"}`
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/** A refusal is never cached (a route that promises `no-store` on every answer keeps it for the guard's too). */
|
|
332
|
+
const NO_STORE = { "cache-control": "no-store" }
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* The guard as `KernelRoutes`' global middleware: a refused request is answered 403 (`no-store`) before any route sees it, and
|
|
336
|
+
* audited (`denied`, as its canonical action; bounded per action and address: `Audit.denied`). Every request also
|
|
337
|
+
* reaches its route with the client address the kernel determined (`x-eloxiv-client-address`, replacing whatever a
|
|
338
|
+
* client sent), for the limits and records keyed on it.
|
|
339
|
+
*/
|
|
340
|
+
export const CookieGuard = (origins: GuardOrigins & { readonly proxyHops: number }) =>
|
|
341
|
+
Layer.unwrap(
|
|
342
|
+
Effect.gen(function* () {
|
|
343
|
+
const audit = yield* Audit
|
|
344
|
+
const identity = yield* Identity
|
|
345
|
+
// Better Auth's session cookie, by the name its context gives it (the `__Secure-` form when it serves securely).
|
|
346
|
+
const guarded = { ...origins, sessionCookie: yield* identity.sessionCookieName }
|
|
347
|
+
return HttpRouter.middleware(
|
|
348
|
+
(httpEffect) =>
|
|
349
|
+
Effect.gen(function* () {
|
|
350
|
+
const original = yield* HttpServerRequest.HttpServerRequest
|
|
351
|
+
const address = clientAddress(original, origins.proxyHops)
|
|
352
|
+
const headers: Record<string, string | undefined> = {}
|
|
353
|
+
for (const [name, value] of Object.entries(original.headers)) {
|
|
354
|
+
if (typeof value === "string") headers[name.toLowerCase()] = value
|
|
355
|
+
}
|
|
356
|
+
const path = new URL(original.url, "http://kernel").pathname
|
|
357
|
+
// A path whose escapes do not decode names no route: refused (400) and audited, bounded.
|
|
358
|
+
const decodes = (() => {
|
|
359
|
+
try {
|
|
360
|
+
decodeURIComponent(path)
|
|
361
|
+
return true
|
|
362
|
+
} catch {
|
|
363
|
+
return false
|
|
364
|
+
}
|
|
365
|
+
})()
|
|
366
|
+
if (!decodes) {
|
|
367
|
+
yield* audit.denied({
|
|
368
|
+
action: routeOf(original.method, path),
|
|
369
|
+
bucket: routeOf(original.method, path),
|
|
370
|
+
surface: "http",
|
|
371
|
+
actorUserId: null,
|
|
372
|
+
orgId: null,
|
|
373
|
+
errorTag: "InvalidInput",
|
|
374
|
+
address,
|
|
375
|
+
detail: { reason: "malformed-path" },
|
|
376
|
+
})
|
|
377
|
+
return HttpServerResponse.jsonUnsafe(
|
|
378
|
+
{ _tag: "InvalidInput", message: "The path's escapes do not decode" },
|
|
379
|
+
{ status: 400, headers: NO_STORE },
|
|
380
|
+
)
|
|
381
|
+
}
|
|
382
|
+
const refusal = cookieMutationRefusal({ method: original.method, path, headers }, guarded)
|
|
383
|
+
if (refusal !== undefined) {
|
|
384
|
+
yield* audit.denied({
|
|
385
|
+
action: canonicalAction(original.method, path),
|
|
386
|
+
// Counted per route pattern: a caller cannot spread its refusals over action names or paths.
|
|
387
|
+
bucket: routeOf(original.method, path),
|
|
388
|
+
surface: "http",
|
|
389
|
+
actorUserId: null,
|
|
390
|
+
orgId: null,
|
|
391
|
+
errorTag: "Forbidden",
|
|
392
|
+
address,
|
|
393
|
+
detail: {
|
|
394
|
+
reason: "cookie-request-forgery",
|
|
395
|
+
message: refusal,
|
|
396
|
+
origin: headers["origin"]?.slice(0, 200) ?? null,
|
|
397
|
+
path: path.slice(0, 200),
|
|
398
|
+
},
|
|
399
|
+
})
|
|
400
|
+
return HttpServerResponse.jsonUnsafe(
|
|
401
|
+
{ _tag: "Forbidden", action: "request", reason: "cookie-request-forgery", message: refusal },
|
|
402
|
+
{ status: 403, headers: NO_STORE },
|
|
403
|
+
)
|
|
404
|
+
}
|
|
405
|
+
// Exempt as bearer-authenticated only if it is: the route never sees the cookie of a request that carries
|
|
406
|
+
// an `Authorization` header (whatever it holds), so it authenticates by that header or not at all, never by
|
|
407
|
+
// the cookie a browser attached (Better Auth falls back to the cookie when a bearer token does not verify).
|
|
408
|
+
let forwarded = Headers.set(original.headers, CLIENT_ADDRESS_HEADER, address)
|
|
409
|
+
if (headers["authorization"] !== undefined) forwarded = Headers.remove(forwarded, "cookie")
|
|
410
|
+
// A browser's sliding session: a request authenticated by the session cookie moves the session's expiry
|
|
411
|
+
// forward when it is due, and the cookie goes back with the new lifetime (Identity.refreshCookie, the one
|
|
412
|
+
// resolution of a person's credential; Better Auth's routes are Identity.handleAuth's, which refreshes
|
|
413
|
+
// there, and Better Auth's own refresh is off).
|
|
414
|
+
const refreshed =
|
|
415
|
+
headers["authorization"] === undefined &&
|
|
416
|
+
headers["cookie"] !== undefined &&
|
|
417
|
+
!path.startsWith("/auth/") &&
|
|
418
|
+
path !== "/oauth/sign-in"
|
|
419
|
+
? yield* identity.refreshCookie(toWebHeaders(forwarded))
|
|
420
|
+
: undefined
|
|
421
|
+
const response = yield* Effect.provideService(
|
|
422
|
+
httpEffect,
|
|
423
|
+
HttpServerRequest.HttpServerRequest,
|
|
424
|
+
original.modify({ headers: forwarded }),
|
|
425
|
+
)
|
|
426
|
+
return refreshed === undefined
|
|
427
|
+
? response
|
|
428
|
+
: HttpServerResponse.mergeCookies(response, Cookies.fromSetCookie(refreshed))
|
|
429
|
+
}),
|
|
430
|
+
{ global: true },
|
|
431
|
+
)
|
|
432
|
+
}),
|
|
433
|
+
)
|