@decionis/agentsafe 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 +202 -0
- package/NOTICE +4 -0
- package/README.md +909 -0
- package/dist/Cli.d.ts +3 -0
- package/dist/Cli.d.ts.map +1 -0
- package/dist/Cli.js +150 -0
- package/dist/Cli.js.map +1 -0
- package/dist/Index.d.ts +104 -0
- package/dist/Index.d.ts.map +1 -0
- package/dist/Index.js +102 -0
- package/dist/Index.js.map +1 -0
- package/dist/Serve.d.ts +26 -0
- package/dist/Serve.d.ts.map +1 -0
- package/dist/Serve.js +143 -0
- package/dist/Serve.js.map +1 -0
- package/dist/TrustedExecutor.d.ts +66 -0
- package/dist/TrustedExecutor.d.ts.map +1 -0
- package/dist/TrustedExecutor.js +170 -0
- package/dist/TrustedExecutor.js.map +1 -0
- package/dist/Version.d.ts +6 -0
- package/dist/Version.d.ts.map +1 -0
- package/dist/Version.js +21 -0
- package/dist/Version.js.map +1 -0
- package/dist/adapters/AdapterActionHandler.d.ts +48 -0
- package/dist/adapters/AdapterActionHandler.d.ts.map +1 -0
- package/dist/adapters/AdapterActionHandler.js +148 -0
- package/dist/adapters/AdapterActionHandler.js.map +1 -0
- package/dist/adapters/EffectAdapter.d.ts +96 -0
- package/dist/adapters/EffectAdapter.d.ts.map +1 -0
- package/dist/adapters/EffectAdapter.js +16 -0
- package/dist/adapters/EffectAdapter.js.map +1 -0
- package/dist/adapters/EffectAwareGrantVerifier.d.ts +30 -0
- package/dist/adapters/EffectAwareGrantVerifier.d.ts.map +1 -0
- package/dist/adapters/EffectAwareGrantVerifier.js +38 -0
- package/dist/adapters/EffectAwareGrantVerifier.js.map +1 -0
- package/dist/adapters/EffectComparison.d.ts +20 -0
- package/dist/adapters/EffectComparison.d.ts.map +1 -0
- package/dist/adapters/EffectComparison.js +48 -0
- package/dist/adapters/EffectComparison.js.map +1 -0
- package/dist/adapters/EffectEvidenceBuilder.d.ts +60 -0
- package/dist/adapters/EffectEvidenceBuilder.d.ts.map +1 -0
- package/dist/adapters/EffectEvidenceBuilder.js +127 -0
- package/dist/adapters/EffectEvidenceBuilder.js.map +1 -0
- package/dist/adapters/EffectEvidenceRegister.d.ts +31 -0
- package/dist/adapters/EffectEvidenceRegister.d.ts.map +1 -0
- package/dist/adapters/EffectEvidenceRegister.js +21 -0
- package/dist/adapters/EffectEvidenceRegister.js.map +1 -0
- package/dist/adapters/JcsDigest.d.ts +43 -0
- package/dist/adapters/JcsDigest.d.ts.map +1 -0
- package/dist/adapters/JcsDigest.js +86 -0
- package/dist/adapters/JcsDigest.js.map +1 -0
- package/dist/adapters/banking/BankingAction.d.ts +146 -0
- package/dist/adapters/banking/BankingAction.d.ts.map +1 -0
- package/dist/adapters/banking/BankingAction.js +102 -0
- package/dist/adapters/banking/BankingAction.js.map +1 -0
- package/dist/adapters/banking/BankingAdapter.d.ts +60 -0
- package/dist/adapters/banking/BankingAdapter.d.ts.map +1 -0
- package/dist/adapters/banking/BankingAdapter.js +107 -0
- package/dist/adapters/banking/BankingAdapter.js.map +1 -0
- package/dist/adapters/banking/BankingHandlers.d.ts +24 -0
- package/dist/adapters/banking/BankingHandlers.d.ts.map +1 -0
- package/dist/adapters/banking/BankingHandlers.js +47 -0
- package/dist/adapters/banking/BankingHandlers.js.map +1 -0
- package/dist/adapters/banking/BankingIntentBinder.d.ts +47 -0
- package/dist/adapters/banking/BankingIntentBinder.d.ts.map +1 -0
- package/dist/adapters/banking/BankingIntentBinder.js +64 -0
- package/dist/adapters/banking/BankingIntentBinder.js.map +1 -0
- package/dist/adapters/banking/CoreBankingHttpAdapter.d.ts +55 -0
- package/dist/adapters/banking/CoreBankingHttpAdapter.d.ts.map +1 -0
- package/dist/adapters/banking/CoreBankingHttpAdapter.js +248 -0
- package/dist/adapters/banking/CoreBankingHttpAdapter.js.map +1 -0
- package/dist/adapters/banking/Currency.d.ts +10 -0
- package/dist/adapters/banking/Currency.d.ts.map +1 -0
- package/dist/adapters/banking/Currency.js +91 -0
- package/dist/adapters/banking/Currency.js.map +1 -0
- package/dist/adapters/banking/EffectProjections.d.ts +52 -0
- package/dist/adapters/banking/EffectProjections.d.ts.map +1 -0
- package/dist/adapters/banking/EffectProjections.js +140 -0
- package/dist/adapters/banking/EffectProjections.js.map +1 -0
- package/dist/adapters/banking/Iban.d.ts +18 -0
- package/dist/adapters/banking/Iban.d.ts.map +1 -0
- package/dist/adapters/banking/Iban.js +38 -0
- package/dist/adapters/banking/Iban.js.map +1 -0
- package/dist/adapters/banking/Money.d.ts +32 -0
- package/dist/adapters/banking/Money.d.ts.map +1 -0
- package/dist/adapters/banking/Money.js +81 -0
- package/dist/adapters/banking/Money.js.map +1 -0
- package/dist/adapters/banking/ReasonCodes.d.ts +19 -0
- package/dist/adapters/banking/ReasonCodes.d.ts.map +1 -0
- package/dist/adapters/banking/ReasonCodes.js +35 -0
- package/dist/adapters/banking/ReasonCodes.js.map +1 -0
- package/dist/audit/ChainJournal.d.ts +38 -0
- package/dist/audit/ChainJournal.d.ts.map +1 -0
- package/dist/audit/ChainJournal.js +97 -0
- package/dist/audit/ChainJournal.js.map +1 -0
- package/dist/audit/HashChain.d.ts +39 -0
- package/dist/audit/HashChain.d.ts.map +1 -0
- package/dist/audit/HashChain.js +63 -0
- package/dist/audit/HashChain.js.map +1 -0
- package/dist/audit/HashChainedAuditSink.d.ts +22 -0
- package/dist/audit/HashChainedAuditSink.d.ts.map +1 -0
- package/dist/audit/HashChainedAuditSink.js +26 -0
- package/dist/audit/HashChainedAuditSink.js.map +1 -0
- package/dist/audit/LineAuditSink.d.ts +19 -0
- package/dist/audit/LineAuditSink.d.ts.map +1 -0
- package/dist/audit/LineAuditSink.js +35 -0
- package/dist/audit/LineAuditSink.js.map +1 -0
- package/dist/cli/Arguments.d.ts +26 -0
- package/dist/cli/Arguments.d.ts.map +1 -0
- package/dist/cli/Arguments.js +66 -0
- package/dist/cli/Arguments.js.map +1 -0
- package/dist/cli/CliProcess.d.ts +29 -0
- package/dist/cli/CliProcess.d.ts.map +1 -0
- package/dist/cli/CliProcess.js +78 -0
- package/dist/cli/CliProcess.js.map +1 -0
- package/dist/cli/Commands.d.ts +8 -0
- package/dist/cli/Commands.d.ts.map +1 -0
- package/dist/cli/Commands.js +67 -0
- package/dist/cli/Commands.js.map +1 -0
- package/dist/cli/ConfigCommand.d.ts +7 -0
- package/dist/cli/ConfigCommand.d.ts.map +1 -0
- package/dist/cli/ConfigCommand.js +77 -0
- package/dist/cli/ConfigCommand.js.map +1 -0
- package/dist/cli/ConfigFile.d.ts +21 -0
- package/dist/cli/ConfigFile.d.ts.map +1 -0
- package/dist/cli/ConfigFile.js +57 -0
- package/dist/cli/ConfigFile.js.map +1 -0
- package/dist/cli/Credentials.d.ts +15 -0
- package/dist/cli/Credentials.d.ts.map +1 -0
- package/dist/cli/Credentials.js +51 -0
- package/dist/cli/Credentials.js.map +1 -0
- package/dist/cli/Doctor.d.ts +25 -0
- package/dist/cli/Doctor.d.ts.map +1 -0
- package/dist/cli/Doctor.js +211 -0
- package/dist/cli/Doctor.js.map +1 -0
- package/dist/cli/Help.d.ts +3 -0
- package/dist/cli/Help.d.ts.map +1 -0
- package/dist/cli/Help.js +38 -0
- package/dist/cli/Help.js.map +1 -0
- package/dist/cli/Init.d.ts +32 -0
- package/dist/cli/Init.d.ts.map +1 -0
- package/dist/cli/Init.js +163 -0
- package/dist/cli/Init.js.map +1 -0
- package/dist/cli/Login.d.ts +16 -0
- package/dist/cli/Login.d.ts.map +1 -0
- package/dist/cli/Login.js +74 -0
- package/dist/cli/Login.js.map +1 -0
- package/dist/cli/Proxy.d.ts +41 -0
- package/dist/cli/Proxy.d.ts.map +1 -0
- package/dist/cli/Proxy.js +161 -0
- package/dist/cli/Proxy.js.map +1 -0
- package/dist/cli/Status.d.ts +7 -0
- package/dist/cli/Status.d.ts.map +1 -0
- package/dist/cli/Status.js +64 -0
- package/dist/cli/Status.js.map +1 -0
- package/dist/cli/TestCommand.d.ts +36 -0
- package/dist/cli/TestCommand.d.ts.map +1 -0
- package/dist/cli/TestCommand.js +173 -0
- package/dist/cli/TestCommand.js.map +1 -0
- package/dist/config/ConfigKeys.d.ts +10 -0
- package/dist/config/ConfigKeys.d.ts.map +1 -0
- package/dist/config/ConfigKeys.js +105 -0
- package/dist/config/ConfigKeys.js.map +1 -0
- package/dist/config/ExecutorConfig.d.ts +254 -0
- package/dist/config/ExecutorConfig.d.ts.map +1 -0
- package/dist/config/ExecutorConfig.js +637 -0
- package/dist/config/ExecutorConfig.js.map +1 -0
- package/dist/containment/ContainmentProbe.d.ts +87 -0
- package/dist/containment/ContainmentProbe.d.ts.map +1 -0
- package/dist/containment/ContainmentProbe.js +103 -0
- package/dist/containment/ContainmentProbe.js.map +1 -0
- package/dist/credential/CredentialError.d.ts +6 -0
- package/dist/credential/CredentialError.d.ts.map +1 -0
- package/dist/credential/CredentialError.js +10 -0
- package/dist/credential/CredentialError.js.map +1 -0
- package/dist/credential/DownstreamCredential.d.ts +38 -0
- package/dist/credential/DownstreamCredential.d.ts.map +1 -0
- package/dist/credential/DownstreamCredential.js +2 -0
- package/dist/credential/DownstreamCredential.js.map +1 -0
- package/dist/credential/GrantOf.d.ts +10 -0
- package/dist/credential/GrantOf.d.ts.map +1 -0
- package/dist/credential/GrantOf.js +16 -0
- package/dist/credential/GrantOf.js.map +1 -0
- package/dist/credential/PrivateKeyJwtCredential.d.ts +43 -0
- package/dist/credential/PrivateKeyJwtCredential.d.ts.map +1 -0
- package/dist/credential/PrivateKeyJwtCredential.js +126 -0
- package/dist/credential/PrivateKeyJwtCredential.js.map +1 -0
- package/dist/credential/SignedRequestCredential.d.ts +112 -0
- package/dist/credential/SignedRequestCredential.d.ts.map +1 -0
- package/dist/credential/SignedRequestCredential.js +255 -0
- package/dist/credential/SignedRequestCredential.js.map +1 -0
- package/dist/credential/StaticHeaderCredential.d.ts +16 -0
- package/dist/credential/StaticHeaderCredential.d.ts.map +1 -0
- package/dist/credential/StaticHeaderCredential.js +21 -0
- package/dist/credential/StaticHeaderCredential.js.map +1 -0
- package/dist/egress/EgressError.d.ts +13 -0
- package/dist/egress/EgressError.d.ts.map +1 -0
- package/dist/egress/EgressError.js +16 -0
- package/dist/egress/EgressError.js.map +1 -0
- package/dist/egress/EgressPolicy.d.ts +55 -0
- package/dist/egress/EgressPolicy.d.ts.map +1 -0
- package/dist/egress/EgressPolicy.js +137 -0
- package/dist/egress/EgressPolicy.js.map +1 -0
- package/dist/egress/GlobalFetchLock.d.ts +16 -0
- package/dist/egress/GlobalFetchLock.d.ts.map +1 -0
- package/dist/egress/GlobalFetchLock.js +34 -0
- package/dist/egress/GlobalFetchLock.js.map +1 -0
- package/dist/egress/GuardedFetch.d.ts +56 -0
- package/dist/egress/GuardedFetch.d.ts.map +1 -0
- package/dist/egress/GuardedFetch.js +300 -0
- package/dist/egress/GuardedFetch.js.map +1 -0
- package/dist/egress/TcpProbe.d.ts +35 -0
- package/dist/egress/TcpProbe.d.ts.map +1 -0
- package/dist/egress/TcpProbe.js +45 -0
- package/dist/egress/TcpProbe.js.map +1 -0
- package/dist/gateway/Activation.d.ts +39 -0
- package/dist/gateway/Activation.d.ts.map +1 -0
- package/dist/gateway/Activation.js +61 -0
- package/dist/gateway/Activation.js.map +1 -0
- package/dist/gateway/BoundaryTest.d.ts +92 -0
- package/dist/gateway/BoundaryTest.d.ts.map +1 -0
- package/dist/gateway/BoundaryTest.js +349 -0
- package/dist/gateway/BoundaryTest.js.map +1 -0
- package/dist/gateway/DemoAuthority.d.ts +41 -0
- package/dist/gateway/DemoAuthority.d.ts.map +1 -0
- package/dist/gateway/DemoAuthority.js +66 -0
- package/dist/gateway/DemoAuthority.js.map +1 -0
- package/dist/gateway/ForwardHandler.d.ts +56 -0
- package/dist/gateway/ForwardHandler.d.ts.map +1 -0
- package/dist/gateway/ForwardHandler.js +111 -0
- package/dist/gateway/ForwardHandler.js.map +1 -0
- package/dist/gateway/Gateway.d.ts +142 -0
- package/dist/gateway/Gateway.d.ts.map +1 -0
- package/dist/gateway/Gateway.js +819 -0
- package/dist/gateway/Gateway.js.map +1 -0
- package/dist/gateway/GatewayConfig.d.ts +237 -0
- package/dist/gateway/GatewayConfig.d.ts.map +1 -0
- package/dist/gateway/GatewayConfig.js +706 -0
- package/dist/gateway/GatewayConfig.js.map +1 -0
- package/dist/gateway/GatewayMetrics.d.ts +26 -0
- package/dist/gateway/GatewayMetrics.d.ts.map +1 -0
- package/dist/gateway/GatewayMetrics.js +28 -0
- package/dist/gateway/GatewayMetrics.js.map +1 -0
- package/dist/gateway/GatewayReport.d.ts +74 -0
- package/dist/gateway/GatewayReport.d.ts.map +1 -0
- package/dist/gateway/GatewayReport.js +109 -0
- package/dist/gateway/GatewayReport.js.map +1 -0
- package/dist/gateway/InterceptedRequest.d.ts +53 -0
- package/dist/gateway/InterceptedRequest.d.ts.map +1 -0
- package/dist/gateway/InterceptedRequest.js +80 -0
- package/dist/gateway/InterceptedRequest.js.map +1 -0
- package/dist/gateway/RouteTable.d.ts +28 -0
- package/dist/gateway/RouteTable.d.ts.map +1 -0
- package/dist/gateway/RouteTable.js +72 -0
- package/dist/gateway/RouteTable.js.map +1 -0
- package/dist/gateway/Upstream.d.ts +46 -0
- package/dist/gateway/Upstream.d.ts.map +1 -0
- package/dist/gateway/Upstream.js +158 -0
- package/dist/gateway/Upstream.js.map +1 -0
- package/dist/handlers/ForwardRequestHandler.d.ts +26 -0
- package/dist/handlers/ForwardRequestHandler.d.ts.map +1 -0
- package/dist/handlers/ForwardRequestHandler.js +98 -0
- package/dist/handlers/ForwardRequestHandler.js.map +1 -0
- package/dist/handlers/HandlerRegistration.d.ts +37 -0
- package/dist/handlers/HandlerRegistration.d.ts.map +1 -0
- package/dist/handlers/HandlerRegistration.js +2 -0
- package/dist/handlers/HandlerRegistration.js.map +1 -0
- package/dist/handlers/JournaledActionHandler.d.ts +31 -0
- package/dist/handlers/JournaledActionHandler.d.ts.map +1 -0
- package/dist/handlers/JournaledActionHandler.js +63 -0
- package/dist/handlers/JournaledActionHandler.js.map +1 -0
- package/dist/http/ExecutorHttpServer.d.ts +33 -0
- package/dist/http/ExecutorHttpServer.d.ts.map +1 -0
- package/dist/http/ExecutorHttpServer.js +176 -0
- package/dist/http/ExecutorHttpServer.js.map +1 -0
- package/dist/http/GatewayHttpServer.d.ts +42 -0
- package/dist/http/GatewayHttpServer.d.ts.map +1 -0
- package/dist/http/GatewayHttpServer.js +195 -0
- package/dist/http/GatewayHttpServer.js.map +1 -0
- package/dist/http/RecordingTarget.d.ts +18 -0
- package/dist/http/RecordingTarget.d.ts.map +1 -0
- package/dist/http/RecordingTarget.js +71 -0
- package/dist/http/RecordingTarget.js.map +1 -0
- package/dist/http/RequestContext.d.ts +17 -0
- package/dist/http/RequestContext.d.ts.map +1 -0
- package/dist/http/RequestContext.js +19 -0
- package/dist/http/RequestContext.js.map +1 -0
- package/dist/http/Routes.d.ts +93 -0
- package/dist/http/Routes.d.ts.map +1 -0
- package/dist/http/Routes.js +46 -0
- package/dist/http/Routes.js.map +1 -0
- package/dist/http/TlsListener.d.ts +38 -0
- package/dist/http/TlsListener.d.ts.map +1 -0
- package/dist/http/TlsListener.js +52 -0
- package/dist/http/TlsListener.js.map +1 -0
- package/dist/identity/Authenticator.d.ts +58 -0
- package/dist/identity/Authenticator.d.ts.map +1 -0
- package/dist/identity/Authenticator.js +170 -0
- package/dist/identity/Authenticator.js.map +1 -0
- package/dist/identity/PeerIdentity.d.ts +24 -0
- package/dist/identity/PeerIdentity.d.ts.map +1 -0
- package/dist/identity/PeerIdentity.js +29 -0
- package/dist/identity/PeerIdentity.js.map +1 -0
- package/dist/identity/PrincipalRegistry.d.ts +102 -0
- package/dist/identity/PrincipalRegistry.d.ts.map +1 -0
- package/dist/identity/PrincipalRegistry.js +191 -0
- package/dist/identity/PrincipalRegistry.js.map +1 -0
- package/dist/identity/PrincipalsFile.d.ts +152 -0
- package/dist/identity/PrincipalsFile.d.ts.map +1 -0
- package/dist/identity/PrincipalsFile.js +125 -0
- package/dist/identity/PrincipalsFile.js.map +1 -0
- package/dist/identity/RateLimiter.d.ts +43 -0
- package/dist/identity/RateLimiter.d.ts.map +1 -0
- package/dist/identity/RateLimiter.js +84 -0
- package/dist/identity/RateLimiter.js.map +1 -0
- package/dist/identity/SeparationOfDuties.d.ts +11 -0
- package/dist/identity/SeparationOfDuties.d.ts.map +1 -0
- package/dist/identity/SeparationOfDuties.js +25 -0
- package/dist/identity/SeparationOfDuties.js.map +1 -0
- package/dist/identity/WorkloadJwtVerifier.d.ts +57 -0
- package/dist/identity/WorkloadJwtVerifier.d.ts.map +1 -0
- package/dist/identity/WorkloadJwtVerifier.js +145 -0
- package/dist/identity/WorkloadJwtVerifier.js.map +1 -0
- package/dist/incident/EvidenceExport.d.ts +128 -0
- package/dist/incident/EvidenceExport.d.ts.map +1 -0
- package/dist/incident/EvidenceExport.js +187 -0
- package/dist/incident/EvidenceExport.js.map +1 -0
- package/dist/incident/FileProbe.d.ts +22 -0
- package/dist/incident/FileProbe.d.ts.map +1 -0
- package/dist/incident/FileProbe.js +31 -0
- package/dist/incident/FileProbe.js.map +1 -0
- package/dist/incident/HaltSwitch.d.ts +95 -0
- package/dist/incident/HaltSwitch.d.ts.map +1 -0
- package/dist/incident/HaltSwitch.js +171 -0
- package/dist/incident/HaltSwitch.js.map +1 -0
- package/dist/incident/Metrics.d.ts +71 -0
- package/dist/incident/Metrics.d.ts.map +1 -0
- package/dist/incident/Metrics.js +146 -0
- package/dist/incident/Metrics.js.map +1 -0
- package/dist/incident/SecurityEvents.d.ts +182 -0
- package/dist/incident/SecurityEvents.d.ts.map +1 -0
- package/dist/incident/SecurityEvents.js +167 -0
- package/dist/incident/SecurityEvents.js.map +1 -0
- package/dist/journal/ExecutionJournal.d.ts +96 -0
- package/dist/journal/ExecutionJournal.d.ts.map +1 -0
- package/dist/journal/ExecutionJournal.js +100 -0
- package/dist/journal/ExecutionJournal.js.map +1 -0
- package/dist/journal/FileExecutionJournal.d.ts +38 -0
- package/dist/journal/FileExecutionJournal.d.ts.map +1 -0
- package/dist/journal/FileExecutionJournal.js +137 -0
- package/dist/journal/FileExecutionJournal.js.map +1 -0
- package/dist/journal/InMemoryExecutionJournal.d.ts +23 -0
- package/dist/journal/InMemoryExecutionJournal.d.ts.map +1 -0
- package/dist/journal/InMemoryExecutionJournal.js +47 -0
- package/dist/journal/InMemoryExecutionJournal.js.map +1 -0
- package/dist/journal/StartupReconciler.d.ts +47 -0
- package/dist/journal/StartupReconciler.d.ts.map +1 -0
- package/dist/journal/StartupReconciler.js +89 -0
- package/dist/journal/StartupReconciler.js.map +1 -0
- package/dist/limits/HardLimits.d.ts +63 -0
- package/dist/limits/HardLimits.d.ts.map +1 -0
- package/dist/limits/HardLimits.js +120 -0
- package/dist/limits/HardLimits.js.map +1 -0
- package/dist/logging/LineEmitter.d.ts +26 -0
- package/dist/logging/LineEmitter.d.ts.map +1 -0
- package/dist/logging/LineEmitter.js +36 -0
- package/dist/logging/LineEmitter.js.map +1 -0
- package/dist/posture/HostPosture.d.ts +60 -0
- package/dist/posture/HostPosture.d.ts.map +1 -0
- package/dist/posture/HostPosture.js +104 -0
- package/dist/posture/HostPosture.js.map +1 -0
- package/dist/posture/PostureChecks.d.ts +52 -0
- package/dist/posture/PostureChecks.d.ts.map +1 -0
- package/dist/posture/PostureChecks.js +172 -0
- package/dist/posture/PostureChecks.js.map +1 -0
- package/dist/secrets/CompositeSecretStore.d.ts +37 -0
- package/dist/secrets/CompositeSecretStore.d.ts.map +1 -0
- package/dist/secrets/CompositeSecretStore.js +99 -0
- package/dist/secrets/CompositeSecretStore.js.map +1 -0
- package/dist/secrets/EnvSecretStore.d.ts +18 -0
- package/dist/secrets/EnvSecretStore.d.ts.map +1 -0
- package/dist/secrets/EnvSecretStore.js +46 -0
- package/dist/secrets/EnvSecretStore.js.map +1 -0
- package/dist/secrets/FileSecretStore.d.ts +60 -0
- package/dist/secrets/FileSecretStore.d.ts.map +1 -0
- package/dist/secrets/FileSecretStore.js +180 -0
- package/dist/secrets/FileSecretStore.js.map +1 -0
- package/dist/secrets/Redactor.d.ts +32 -0
- package/dist/secrets/Redactor.d.ts.map +1 -0
- package/dist/secrets/Redactor.js +108 -0
- package/dist/secrets/Redactor.js.map +1 -0
- package/dist/secrets/SecretHandle.d.ts +34 -0
- package/dist/secrets/SecretHandle.d.ts.map +1 -0
- package/dist/secrets/SecretHandle.js +71 -0
- package/dist/secrets/SecretHandle.js.map +1 -0
- package/dist/secrets/SecretStore.d.ts +37 -0
- package/dist/secrets/SecretStore.d.ts.map +1 -0
- package/dist/secrets/SecretStore.js +12 -0
- package/dist/secrets/SecretStore.js.map +1 -0
- package/dist/service/AuthorityClients.d.ts +50 -0
- package/dist/service/AuthorityClients.d.ts.map +1 -0
- package/dist/service/AuthorityClients.js +83 -0
- package/dist/service/AuthorityClients.js.map +1 -0
- package/dist/service/EscalationResolver.d.ts +97 -0
- package/dist/service/EscalationResolver.d.ts.map +1 -0
- package/dist/service/EscalationResolver.js +196 -0
- package/dist/service/EscalationResolver.js.map +1 -0
- package/dist/service/Requests.d.ts +99 -0
- package/dist/service/Requests.d.ts.map +1 -0
- package/dist/service/Requests.js +42 -0
- package/dist/service/Requests.js.map +1 -0
- package/dist/service/ServiceError.d.ts +20 -0
- package/dist/service/ServiceError.d.ts.map +1 -0
- package/dist/service/ServiceError.js +25 -0
- package/dist/service/ServiceError.js.map +1 -0
- package/dist/service/TrustedExecutorService.d.ts +221 -0
- package/dist/service/TrustedExecutorService.d.ts.map +1 -0
- package/dist/service/TrustedExecutorService.js +1066 -0
- package/dist/service/TrustedExecutorService.js.map +1 -0
- package/dist/time/ClockSkewGuard.d.ts +25 -0
- package/dist/time/ClockSkewGuard.d.ts.map +1 -0
- package/dist/time/ClockSkewGuard.js +35 -0
- package/dist/time/ClockSkewGuard.js.map +1 -0
- package/dist/time/MonotonicClock.d.ts +35 -0
- package/dist/time/MonotonicClock.d.ts.map +1 -0
- package/dist/time/MonotonicClock.js +52 -0
- package/dist/time/MonotonicClock.js.map +1 -0
- package/dist/verify/VerifyAuditChain.d.ts +36 -0
- package/dist/verify/VerifyAuditChain.d.ts.map +1 -0
- package/dist/verify/VerifyAuditChain.js +109 -0
- package/dist/verify/VerifyAuditChain.js.map +1 -0
- package/dist/verify/VerifyEvidenceBundle.d.ts +50 -0
- package/dist/verify/VerifyEvidenceBundle.d.ts.map +1 -0
- package/dist/verify/VerifyEvidenceBundle.js +157 -0
- package/dist/verify/VerifyEvidenceBundle.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { AddressInfo } from "node:net";
|
|
2
|
+
import { ChainJournal } from "./audit/ChainJournal.js";
|
|
3
|
+
import type { ExecutionJournal } from "./journal/ExecutionJournal.js";
|
|
4
|
+
import type { HaltSwitch } from "./incident/HaltSwitch.js";
|
|
5
|
+
import { HashChain } from "./audit/HashChain.js";
|
|
6
|
+
import type { ExecutorConfig } from "./config/ExecutorConfig.js";
|
|
7
|
+
import type { HandlerRegistration } from "./handlers/HandlerRegistration.js";
|
|
8
|
+
import { Authenticator } from "./identity/Authenticator.js";
|
|
9
|
+
import type { PrincipalRegistry } from "./identity/PrincipalRegistry.js";
|
|
10
|
+
import { RateLimiter } from "./identity/RateLimiter.js";
|
|
11
|
+
import { type ExecutorMetrics } from "./incident/Metrics.js";
|
|
12
|
+
import { HostPosture, type PostureReport } from "./posture/HostPosture.js";
|
|
13
|
+
import type { SecretStore } from "./secrets/SecretStore.js";
|
|
14
|
+
import { TrustedExecutorService, type ServiceDependencies } from "./service/TrustedExecutorService.js";
|
|
15
|
+
export interface TrustedExecutorDependencies extends Omit<ServiceDependencies, "posture" | "chain" | "metrics"> {
|
|
16
|
+
/** The posture to verify and follow; the real host unless a fixture is given. */
|
|
17
|
+
readonly posture?: HostPosture;
|
|
18
|
+
/** Where chain heads persist; built from the configuration when absent, none when null. */
|
|
19
|
+
readonly chainJournal?: ChainJournal | null;
|
|
20
|
+
/** Where attempts are journaled; the configured directory unless one is given. */
|
|
21
|
+
readonly attempts?: ExecutionJournal;
|
|
22
|
+
/** The stop; built from the configuration unless a test hands in its own. */
|
|
23
|
+
readonly halt?: HaltSwitch;
|
|
24
|
+
readonly metrics?: ExecutorMetrics;
|
|
25
|
+
/** The windows and locks the door keeps; a fresh one unless a test injects a clock through its own. */
|
|
26
|
+
readonly limits?: RateLimiter;
|
|
27
|
+
}
|
|
28
|
+
export interface TrustedExecutorOptions {
|
|
29
|
+
/** `ExecutorConfigLoader.load(env)`, or a configuration built by trusted startup code. */
|
|
30
|
+
readonly config: ExecutorConfig;
|
|
31
|
+
/** Every secret the configuration names; the executor owns the store from here on. */
|
|
32
|
+
readonly secrets: SecretStore;
|
|
33
|
+
/** The seam: what this process can run. Defaults to the reference forwarding handler. */
|
|
34
|
+
readonly handlers?: HandlerRegistration;
|
|
35
|
+
readonly dependencies?: TrustedExecutorDependencies;
|
|
36
|
+
}
|
|
37
|
+
export interface TrustedExecutor {
|
|
38
|
+
readonly service: TrustedExecutorService;
|
|
39
|
+
/** The attempt journal this process writes to; the file journal unless one was given. */
|
|
40
|
+
readonly attempts: ExecutionJournal;
|
|
41
|
+
/** The stop, for a test or an embedding process that halts without HTTP. */
|
|
42
|
+
readonly halt: HaltSwitch;
|
|
43
|
+
/** What was verified at start, and what development posture waived. */
|
|
44
|
+
readonly posture: PostureReport;
|
|
45
|
+
readonly metrics: ExecutorMetrics;
|
|
46
|
+
/** Who may call, as loaded at start. */
|
|
47
|
+
readonly principals: PrincipalRegistry;
|
|
48
|
+
/** The one chokepoint the door calls; exposed so a test can drive it directly. */
|
|
49
|
+
readonly authenticator: Authenticator;
|
|
50
|
+
/** The evidence chain's head: the sequence and hash of the last line written. */
|
|
51
|
+
readonly evidence: HashChain;
|
|
52
|
+
/** Binds the listener and starts following posture drift; the configured port and address unless overridden. */
|
|
53
|
+
listen(port?: number, address?: string): Promise<AddressInfo>;
|
|
54
|
+
close(): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The trusted executor, assembled: the host posture verified first, then the
|
|
58
|
+
* evidence chains restored from the journal, the service behind its one
|
|
59
|
+
* listener with the adopter's handlers registered and the registry sealed,
|
|
60
|
+
* every outbound connection through the guarded fetch, every credential
|
|
61
|
+
* read through the store. Nothing listens until `listen()` is called, and
|
|
62
|
+
* nothing here reads the process environment except to write lines; that
|
|
63
|
+
* is `serve()`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createTrustedExecutor(options: TrustedExecutorOptions): Promise<TrustedExecutor>;
|
|
66
|
+
//# sourceMappingURL=TrustedExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrustedExecutor.d.ts","sourceRoot":"","sources":["../src/TrustedExecutor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAG7E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG9E,OAAO,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MA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,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,gHAAgH;IAChH,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,eAAe,CAAC,CA+H1B"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import { ChainJournal } from "./audit/ChainJournal.js";
|
|
5
|
+
import { FileExecutionJournal } from "./journal/FileExecutionJournal.js";
|
|
6
|
+
import { InMemoryExecutionJournal } from "./journal/InMemoryExecutionJournal.js";
|
|
7
|
+
import { HashChain } from "./audit/HashChain.js";
|
|
8
|
+
import { EVIDENCE_STREAM } from "./audit/HashChainedAuditSink.js";
|
|
9
|
+
import { forwardRequestHandlers } from "./handlers/ForwardRequestHandler.js";
|
|
10
|
+
import { ExecutorHttpServer } from "./http/ExecutorHttpServer.js";
|
|
11
|
+
import { TlsListener } from "./http/TlsListener.js";
|
|
12
|
+
import { Authenticator } from "./identity/Authenticator.js";
|
|
13
|
+
import { RateLimiter } from "./identity/RateLimiter.js";
|
|
14
|
+
import { executorMetrics } from "./incident/Metrics.js";
|
|
15
|
+
import { SECURITY_STREAM, SecurityEvents } from "./incident/SecurityEvents.js";
|
|
16
|
+
import { LineEmitter } from "./logging/LineEmitter.js";
|
|
17
|
+
import { HostPosture } from "./posture/HostPosture.js";
|
|
18
|
+
import { Redactor } from "./secrets/Redactor.js";
|
|
19
|
+
import { TrustedExecutorService, } from "./service/TrustedExecutorService.js";
|
|
20
|
+
/**
|
|
21
|
+
* The trusted executor, assembled: the host posture verified first, then the
|
|
22
|
+
* evidence chains restored from the journal, the service behind its one
|
|
23
|
+
* listener with the adopter's handlers registered and the registry sealed,
|
|
24
|
+
* every outbound connection through the guarded fetch, every credential
|
|
25
|
+
* read through the store. Nothing listens until `listen()` is called, and
|
|
26
|
+
* nothing here reads the process environment except to write lines; that
|
|
27
|
+
* is `serve()`.
|
|
28
|
+
*/
|
|
29
|
+
export async function createTrustedExecutor(options) {
|
|
30
|
+
const dependencies = options.dependencies ?? {};
|
|
31
|
+
const config = options.config;
|
|
32
|
+
const readFile = dependencies.readFile ?? ((path) => readFileSync(path, "utf8"));
|
|
33
|
+
const journal = dependencies.chainJournal === undefined
|
|
34
|
+
? config.evidence.journalDir === null
|
|
35
|
+
? null
|
|
36
|
+
: new ChainJournal(config.evidence.journalDir, {
|
|
37
|
+
checkpointLines: config.evidence.checkpointLines,
|
|
38
|
+
})
|
|
39
|
+
: dependencies.chainJournal;
|
|
40
|
+
// The attempt journal is the durable one: an execution nobody could
|
|
41
|
+
// reconcile afterwards is worse than a refusal, so in enforcement the
|
|
42
|
+
// configuration requires a directory for it.
|
|
43
|
+
const attempts = dependencies.attempts ??
|
|
44
|
+
(config.evidence.journalDir === null
|
|
45
|
+
? new InMemoryExecutionJournal()
|
|
46
|
+
: new FileExecutionJournal(join(config.evidence.journalDir, "attempts"), {
|
|
47
|
+
retainDays: config.evidence.journalRetainDays,
|
|
48
|
+
}));
|
|
49
|
+
const { emit, security } = lines(options, dependencies, journal);
|
|
50
|
+
const posture = dependencies.posture ??
|
|
51
|
+
new HostPosture({
|
|
52
|
+
mode: config.posture.mode,
|
|
53
|
+
intervalSeconds: config.posture.intervalSeconds,
|
|
54
|
+
config: config.posture,
|
|
55
|
+
}, security);
|
|
56
|
+
const report = posture.report ?? posture.assertAtStartup();
|
|
57
|
+
const metrics = dependencies.metrics ?? executorMetrics();
|
|
58
|
+
const evidenceHead = journal?.restore(EVIDENCE_STREAM) ?? null;
|
|
59
|
+
const evidence = new HashChain(EVIDENCE_STREAM, evidenceHead);
|
|
60
|
+
if (evidenceHead !== null) {
|
|
61
|
+
security.emit({ event: "CHAIN_RESUMED", chain: EVIDENCE_STREAM, head: evidenceHead.seq });
|
|
62
|
+
}
|
|
63
|
+
evidence.onLink(() => metrics.auditLines.inc({ chain: EVIDENCE_STREAM }));
|
|
64
|
+
security.chain.onLink(() => metrics.auditLines.inc({ chain: SECURITY_STREAM }));
|
|
65
|
+
const service = TrustedExecutorService.create(config, options.secrets, options.handlers ?? forwardRequestHandlers(), {
|
|
66
|
+
...dependencies,
|
|
67
|
+
emit,
|
|
68
|
+
security,
|
|
69
|
+
posture,
|
|
70
|
+
chain: evidence,
|
|
71
|
+
metrics,
|
|
72
|
+
readFile,
|
|
73
|
+
journal: attempts,
|
|
74
|
+
...(dependencies.halt === undefined ? {} : { halt: dependencies.halt }),
|
|
75
|
+
});
|
|
76
|
+
const tls = config.listener.tls === null
|
|
77
|
+
? null
|
|
78
|
+
: new TlsListener({
|
|
79
|
+
minVersion: config.listener.tls.minVersion,
|
|
80
|
+
material: () => ({
|
|
81
|
+
cert: readFile(config.listener.tls?.certFile ?? ""),
|
|
82
|
+
key: options.secrets.get("EXECUTOR_TLS_KEY"),
|
|
83
|
+
clientCa: config.listener.tls?.clientCaFile == null
|
|
84
|
+
? null
|
|
85
|
+
: readFile(config.listener.tls.clientCaFile),
|
|
86
|
+
}),
|
|
87
|
+
events: security,
|
|
88
|
+
});
|
|
89
|
+
const authenticator = new Authenticator({
|
|
90
|
+
registry: service.principals,
|
|
91
|
+
jwt: service.jwt,
|
|
92
|
+
audience: config.identity.jwt?.audience ?? null,
|
|
93
|
+
limits: dependencies.limits ?? new RateLimiter(),
|
|
94
|
+
unauthenticated: config.identity.unauthenticated,
|
|
95
|
+
lockout: config.identity.lockout,
|
|
96
|
+
requireCertificate: service.principals.legacy && tls?.mutual === true,
|
|
97
|
+
events: security,
|
|
98
|
+
});
|
|
99
|
+
service.jwt?.start();
|
|
100
|
+
const server = new ExecutorHttpServer(service, authenticator, { tls });
|
|
101
|
+
const stopRotation = tls !== null && options.secrets.has("EXECUTOR_TLS_KEY")
|
|
102
|
+
? options.secrets.onRotate("EXECUTOR_TLS_KEY", () => server.rotateTls())
|
|
103
|
+
: () => undefined;
|
|
104
|
+
const following = journal === null
|
|
105
|
+
? []
|
|
106
|
+
: [journal.follow(evidence, security), journal.follow(security.chain, security)];
|
|
107
|
+
let stopPosture = null;
|
|
108
|
+
const haltSwitch = service.haltSwitch;
|
|
109
|
+
haltSwitch.assertAtStartup();
|
|
110
|
+
let stopHalt = null;
|
|
111
|
+
return {
|
|
112
|
+
service,
|
|
113
|
+
attempts,
|
|
114
|
+
halt: haltSwitch,
|
|
115
|
+
posture: report,
|
|
116
|
+
metrics,
|
|
117
|
+
principals: service.principals,
|
|
118
|
+
authenticator,
|
|
119
|
+
evidence,
|
|
120
|
+
listen: async (port = config.port, address = config.bindAddress) => {
|
|
121
|
+
// What the last process left open is resolved before this one can be
|
|
122
|
+
// asked to do anything new, and read-only: the provider is asked what
|
|
123
|
+
// it did, never told to do it again.
|
|
124
|
+
await service.recover();
|
|
125
|
+
const bound = await server.listen(port, address);
|
|
126
|
+
stopPosture = posture.start();
|
|
127
|
+
stopHalt = haltSwitch.start();
|
|
128
|
+
return bound;
|
|
129
|
+
},
|
|
130
|
+
close: async () => {
|
|
131
|
+
stopPosture?.();
|
|
132
|
+
stopHalt?.();
|
|
133
|
+
stopRotation();
|
|
134
|
+
await server.close();
|
|
135
|
+
service.close();
|
|
136
|
+
for (const stop of following)
|
|
137
|
+
stop();
|
|
138
|
+
attempts.close();
|
|
139
|
+
options.secrets.close();
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** The writers the executor uses when none were injected: the process streams, through the redactor. */
|
|
144
|
+
function lines(options, dependencies, journal) {
|
|
145
|
+
if (dependencies.emit !== undefined && dependencies.security !== undefined) {
|
|
146
|
+
return { emit: dependencies.emit, security: dependencies.security };
|
|
147
|
+
}
|
|
148
|
+
const emitter = new LineEmitter({
|
|
149
|
+
stdout: (line) => {
|
|
150
|
+
process.stdout.write(`${line}\n`);
|
|
151
|
+
},
|
|
152
|
+
stderr: (line) => {
|
|
153
|
+
process.stderr.write(`${line}\n`);
|
|
154
|
+
},
|
|
155
|
+
}, new Redactor(() => options.config.secrets.required.map((name) => options.secrets.get(name).digest()), () => options.config.downstream.redactedHeaders));
|
|
156
|
+
let security = dependencies.security;
|
|
157
|
+
if (security === undefined) {
|
|
158
|
+
const head = journal?.restore(SECURITY_STREAM) ?? null;
|
|
159
|
+
security = new SecurityEvents(emitter.security, {
|
|
160
|
+
chain: new HashChain(SECURITY_STREAM, head),
|
|
161
|
+
});
|
|
162
|
+
if (head !== null) {
|
|
163
|
+
security.emit({ event: "CHAIN_RESUMED", chain: SECURITY_STREAM, head: head.seq });
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const events = security;
|
|
167
|
+
emitter.reportRedactions((patterns) => events.emit({ event: "LEAK_SUSPECTED", patterns: [...patterns] }));
|
|
168
|
+
return { emit: dependencies.emit ?? emitter.audit, security: events };
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=TrustedExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrustedExecutor.js","sourceRoot":"","sources":["../src/TrustedExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAGjF,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC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Q,CAAC;IACxB,OAAO,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,EAAE,CACpC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAClE,CAAC;IACF,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Version.d.ts","sourceRoot":"","sources":["../src/Version.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAcvC"}
|
package/dist/Version.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
const TOKEN = /^[\w.-]{1,64}$/;
|
|
3
|
+
/**
|
|
4
|
+
* This package's own version: the one the bundler defined, else the one
|
|
5
|
+
* in the manifest beside the code, else `0.0.0` if neither can be read.
|
|
6
|
+
*/
|
|
7
|
+
export function packageVersion() {
|
|
8
|
+
if (typeof __AGENTSAFE_VERSION__ === "string" && TOKEN.test(__AGENTSAFE_VERSION__)) {
|
|
9
|
+
return __AGENTSAFE_VERSION__;
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
const manifest = createRequire(import.meta.url)("../package.json");
|
|
13
|
+
return typeof manifest.version === "string" && TOKEN.test(manifest.version)
|
|
14
|
+
? manifest.version
|
|
15
|
+
: "0.0.0";
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return "0.0.0";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=Version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Version.js","sourceRoot":"","sources":["../src/Version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,KAAK,GAAG,gBAAgB,CAAC;AAK/B;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,IAAI,OAAO,qBAAqB,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,EAAE,CAAC;QACnF,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IACD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAEhE,CAAC;QACF,OAAO,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;YACzE,CAAC,CAAC,QAAQ,CAAC,OAAO;YAClB,CAAC,CAAC,OAAO,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ActionHandler, JsonObject } from "@decionis/agent-safe-pipeline";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import { type EffectAdapter } from "./EffectAdapter.js";
|
|
4
|
+
import type { EffectEvidenceRegister } from "./EffectEvidenceRegister.js";
|
|
5
|
+
/** What the executor reports about an adapter's attempt: statuses and digests only. */
|
|
6
|
+
export interface AdapterExecutionResult {
|
|
7
|
+
readonly outcome: "COMMITTED" | "FAILED";
|
|
8
|
+
readonly confirmation: "PENDING" | "CONFIRMED" | "NOT_EFFECTED" | "REVERSED" | "UNKNOWN";
|
|
9
|
+
readonly comparison: "MATCH" | "MISMATCH" | "PENDING";
|
|
10
|
+
readonly mismatchedFields: readonly string[];
|
|
11
|
+
readonly observationMethod: string;
|
|
12
|
+
readonly expectedEffectDigest: string;
|
|
13
|
+
readonly observedEffectDigest: string | null;
|
|
14
|
+
readonly responseDigest: string | null;
|
|
15
|
+
readonly providerReference: string | null;
|
|
16
|
+
readonly evidenceDigest: string;
|
|
17
|
+
readonly reasonCodes: readonly string[];
|
|
18
|
+
}
|
|
19
|
+
export interface AdapterHandlerOptions<TAction> {
|
|
20
|
+
readonly adapter: EffectAdapter<TAction>;
|
|
21
|
+
readonly schema: z.ZodType<TAction>;
|
|
22
|
+
readonly register: EffectEvidenceRegister;
|
|
23
|
+
readonly timeoutMs: number;
|
|
24
|
+
/** Told when an observation did not match what was authorised. */
|
|
25
|
+
readonly onMismatch?: (mismatched: readonly string[]) => void;
|
|
26
|
+
readonly clock?: () => Date;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The bridge from any `EffectAdapter` to the pipeline's `ActionHandler`. It
|
|
30
|
+
* keeps the shape the boundary requires and adds the effect plane:
|
|
31
|
+
*
|
|
32
|
+
* prepare, which reaches nothing; then the side effect inside
|
|
33
|
+
* `dispatch.run`, bounded by the smaller of the configured timeout and what
|
|
34
|
+
* is left of the grant; then the observation, compared field by field
|
|
35
|
+
* against what was authorised; then the record, registered against this
|
|
36
|
+
* exact authorization for the verifier to finalize with.
|
|
37
|
+
*
|
|
38
|
+
* `SafeExecutor` and the pipeline's registry are untouched: a provider that
|
|
39
|
+
* neither committed nor refused throws `IndeterminateOutcome` from inside
|
|
40
|
+
* the dispatch, which the registry already reports as an unknown outcome,
|
|
41
|
+
* and a deterministic refusal returns a result whose own outcome is
|
|
42
|
+
* `FAILED`. What the pipeline calls the handler's outcome is unchanged;
|
|
43
|
+
* what the effect plane says about it is separate, and that is deliberate.
|
|
44
|
+
*/
|
|
45
|
+
export declare function adapterActionHandler<TAction>(options: AdapterHandlerOptions<TAction>): ActionHandler<TAction, AdapterExecutionResult>;
|
|
46
|
+
/** The effect block a response carries, from the handler's own result. */
|
|
47
|
+
export declare function effectBlock(result: unknown): JsonObject | null;
|
|
48
|
+
//# sourceMappingURL=AdapterActionHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdapterActionHandler.d.ts","s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E,MAAM,CAAC;IAC3B,kEAAkE;IAClE,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAC;IAC9D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAC1C,OAAO,EAAE,qBAAqB,CAAC,OAAO,CAAC,GACtC,aAAa,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAgHhD;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAiB9D"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { ProviderRefusal } from "@decionis/agent-safe-pipeline";
|
|
2
|
+
import { dispatchBudgetMs, MonotonicDeadline } from "../time/MonotonicClock.js";
|
|
3
|
+
import { IndeterminateOutcome } from "./EffectAdapter.js";
|
|
4
|
+
import { buildEffectRecord } from "./EffectEvidenceBuilder.js";
|
|
5
|
+
/**
|
|
6
|
+
* The bridge from any `EffectAdapter` to the pipeline's `ActionHandler`. It
|
|
7
|
+
* keeps the shape the boundary requires and adds the effect plane:
|
|
8
|
+
*
|
|
9
|
+
* prepare, which reaches nothing; then the side effect inside
|
|
10
|
+
* `dispatch.run`, bounded by the smaller of the configured timeout and what
|
|
11
|
+
* is left of the grant; then the observation, compared field by field
|
|
12
|
+
* against what was authorised; then the record, registered against this
|
|
13
|
+
* exact authorization for the verifier to finalize with.
|
|
14
|
+
*
|
|
15
|
+
* `SafeExecutor` and the pipeline's registry are untouched: a provider that
|
|
16
|
+
* neither committed nor refused throws `IndeterminateOutcome` from inside
|
|
17
|
+
* the dispatch, which the registry already reports as an unknown outcome,
|
|
18
|
+
* and a deterministic refusal returns a result whose own outcome is
|
|
19
|
+
* `FAILED`. What the pipeline calls the handler's outcome is unchanged;
|
|
20
|
+
* what the effect plane says about it is separate, and that is deliberate.
|
|
21
|
+
*/
|
|
22
|
+
export function adapterActionHandler(options) {
|
|
23
|
+
const clock = options.clock ?? (() => new Date());
|
|
24
|
+
const observer = { id: options.adapter.id, version: options.adapter.version };
|
|
25
|
+
const execute = async (context) => {
|
|
26
|
+
const prepared = options.adapter.prepare(context.parameters);
|
|
27
|
+
const deadline = MonotonicDeadline.after(dispatchBudgetMs(options.timeoutMs, context.authorization));
|
|
28
|
+
let result = null;
|
|
29
|
+
let indeterminate = null;
|
|
30
|
+
try {
|
|
31
|
+
result = await context.dispatch.run(async () => await options.adapter.execute({
|
|
32
|
+
action: context.parameters,
|
|
33
|
+
prepared,
|
|
34
|
+
authorization: context.authorization,
|
|
35
|
+
idempotencyKey: context.dispatch.idempotencyKey,
|
|
36
|
+
deadline,
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (!(error instanceof IndeterminateOutcome))
|
|
41
|
+
throw error;
|
|
42
|
+
indeterminate = { reason: error.reason, providerStatus: error.providerStatus };
|
|
43
|
+
}
|
|
44
|
+
const observed = result === null ? null : options.adapter.observeEffect(result, prepared);
|
|
45
|
+
const record = buildEffectRecord({
|
|
46
|
+
prepared,
|
|
47
|
+
result: result === null ? null : { ...result, observed },
|
|
48
|
+
...(indeterminate === null ? {} : { indeterminate }),
|
|
49
|
+
observer,
|
|
50
|
+
correlationId: context.intent.intent.intentId,
|
|
51
|
+
idempotencyKey: context.dispatch.idempotencyKey,
|
|
52
|
+
observedAt: clock().toISOString(),
|
|
53
|
+
});
|
|
54
|
+
options.register.attach(context.authorization, record);
|
|
55
|
+
if (record.comparison === "MISMATCH")
|
|
56
|
+
options.onMismatch?.(record.mismatched);
|
|
57
|
+
// An outcome nobody can determine stays undetermined: the throw is
|
|
58
|
+
// re-raised so the pipeline reports an unknown outcome rather than a
|
|
59
|
+
// failure or a success.
|
|
60
|
+
if (indeterminate !== null) {
|
|
61
|
+
throw new IndeterminateOutcome(indeterminate.reason, indeterminate.providerStatus);
|
|
62
|
+
}
|
|
63
|
+
// A provider that was reached and said no is a fact, not a success. The
|
|
64
|
+
// evidence is registered above either way, so the authority still learns
|
|
65
|
+
// what was observed; the throw is what tells the pipeline that nothing
|
|
66
|
+
// was effected, so it reports `DEFINITELY_NOT_EXECUTED` rather than a
|
|
67
|
+
// completed execution whose own effect block says otherwise.
|
|
68
|
+
if (record.outcome === "FAILED") {
|
|
69
|
+
throw new ProviderRefusal(record.reasonCodes[0] ?? "PROVIDER_REFUSED");
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
outcome: "COMMITTED",
|
|
73
|
+
confirmation: record.confirmation,
|
|
74
|
+
comparison: record.comparison,
|
|
75
|
+
mismatchedFields: record.mismatched,
|
|
76
|
+
observationMethod: record.observationMethod,
|
|
77
|
+
expectedEffectDigest: record.expectedEffectDigest,
|
|
78
|
+
observedEffectDigest: record.observedEffectDigest,
|
|
79
|
+
responseDigest: record.responseDigest,
|
|
80
|
+
providerReference: record.providerReference,
|
|
81
|
+
evidenceDigest: record.evidenceDigest,
|
|
82
|
+
reasonCodes: record.reasonCodes,
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
const reconcile = async (context) => {
|
|
86
|
+
const prepared = options.adapter.prepare(context.parameters);
|
|
87
|
+
const answer = await options.adapter.reconcile({
|
|
88
|
+
idempotencyKey: context.idempotencyKey,
|
|
89
|
+
providerReference: null,
|
|
90
|
+
intentHash: context.intent.intentHash,
|
|
91
|
+
prepared,
|
|
92
|
+
});
|
|
93
|
+
if (answer.status !== "COMPLETED")
|
|
94
|
+
return { status: answer.status };
|
|
95
|
+
const observed = options.adapter.observeEffect(answer.result, prepared);
|
|
96
|
+
const record = buildEffectRecord({
|
|
97
|
+
prepared,
|
|
98
|
+
result: { ...answer.result, observed },
|
|
99
|
+
observer,
|
|
100
|
+
correlationId: context.intent.intent.intentId,
|
|
101
|
+
idempotencyKey: context.idempotencyKey,
|
|
102
|
+
observedAt: clock().toISOString(),
|
|
103
|
+
});
|
|
104
|
+
// Absence of an error is not success: only a read-back whose projection
|
|
105
|
+
// matches what was authorised is a completed reconciliation.
|
|
106
|
+
if (record.comparison !== "MATCH")
|
|
107
|
+
return { status: "UNKNOWN" };
|
|
108
|
+
return {
|
|
109
|
+
status: "COMPLETED",
|
|
110
|
+
result: {
|
|
111
|
+
outcome: "COMMITTED",
|
|
112
|
+
confirmation: record.confirmation,
|
|
113
|
+
comparison: record.comparison,
|
|
114
|
+
mismatchedFields: record.mismatched,
|
|
115
|
+
observationMethod: record.observationMethod,
|
|
116
|
+
expectedEffectDigest: record.expectedEffectDigest,
|
|
117
|
+
observedEffectDigest: record.observedEffectDigest,
|
|
118
|
+
responseDigest: record.responseDigest,
|
|
119
|
+
providerReference: record.providerReference,
|
|
120
|
+
evidenceDigest: record.evidenceDigest,
|
|
121
|
+
reasonCodes: record.reasonCodes,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
return { parametersSchema: options.schema, execute, reconcile };
|
|
126
|
+
}
|
|
127
|
+
/** The effect block a response carries, from the handler's own result. */
|
|
128
|
+
export function effectBlock(result) {
|
|
129
|
+
if (typeof result !== "object" || result === null)
|
|
130
|
+
return null;
|
|
131
|
+
const candidate = result;
|
|
132
|
+
if (typeof candidate.evidenceDigest !== "string")
|
|
133
|
+
return null;
|
|
134
|
+
return {
|
|
135
|
+
outcome: candidate.outcome ?? null,
|
|
136
|
+
confirmation: candidate.confirmation ?? null,
|
|
137
|
+
comparison: candidate.comparison ?? null,
|
|
138
|
+
mismatched_fields: [...(candidate.mismatchedFields ?? [])],
|
|
139
|
+
observation_method: candidate.observationMethod ?? null,
|
|
140
|
+
expected_effect_digest: candidate.expectedEffectDigest ?? null,
|
|
141
|
+
observed_effect_digest: candidate.observedEffectDigest ?? null,
|
|
142
|
+
response_digest: candidate.responseDigest ?? null,
|
|
143
|
+
provider_reference: candidate.providerReference ?? null,
|
|
144
|
+
evidence_digest: candidate.evidenceDigest,
|
|
145
|
+
reason_codes: [...(candidate.reasonCodes ?? [])],
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=AdapterActionHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdapterActionHandler.js","sourceRoot":"","sources":["../../src/adapters/AdapterActionHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAShE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAA2C,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AA4B/D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAuC;IAEvC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,GAAS,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,EAAE,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAE9E,MAAM,OAAO,GAAG,KAAK,EACnB,OAAwC,EACP,EAAE;QACnC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC7D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CACtC,gBAAgB,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,aAAa,CAAC,CAC3D,CAAC;QACF,IAAI,MAAM,GAA0B,IAAI,CAAC;QACzC,IAAI,aAAa,GACf,IAAI,CAAC;QACP,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,CACjC,KAAK,IAAI,EAAE,CACT,MAAM,OAAO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CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CAAC,MAAe;IACzC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/D,MAAM,SAAS,GAAG,MAAyC,CAAC;IAC5D,IAAI,OAAO,SAAS,CAAC,cAAc,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC9D,OAAO;QACL,OAAO,EAAE,SAAS,CAAC,OAAO,IAAI,IAAI;QAClC,YAAY,EAAE,SAAS,CAAC,YAAY,IAAI,IAAI;QAC5C,UAAU,EAAE,SAAS,CAAC,UAAU,IAAI,IAAI;QACxC,iBAAiB,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;QAC1D,kBAAkB,EAAE,SAAS,CAAC,iBAAiB,IAAI,IAAI;QACvD,sBAAsB,EAAE,SAAS,CAAC,oBAAoB,IAAI,IAAI;QAC9D,sBAAsB,EAAE,SAAS,CAAC,oBAAoB,IAAI,IAAI;QAC9D,eAAe,EAAE,SAAS,CAAC,cAAc,IAAI,IAAI;QACjD,kBAAkB,EAAE,SAAS,CAAC,iBAAiB,IAAI,IAAI;QACvD,eAAe,EAAE,SAAS,CAAC,cAAc;QACzC,YAAY,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;KACjD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { JsonObject, JsonValue, VerifiedAuthorization } from "@decionis/agent-safe-pipeline";
|
|
2
|
+
import type { MonotonicDeadline } from "../time/MonotonicClock.js";
|
|
3
|
+
import type { Sha256 } from "./JcsDigest.js";
|
|
4
|
+
/** What the adapter worked out before anything left the process. */
|
|
5
|
+
export interface PreparedAction {
|
|
6
|
+
/** The effect the action asks for, as the profile's projection of it. */
|
|
7
|
+
readonly expectedEffect: JsonObject;
|
|
8
|
+
readonly expectedEffectDigest: Sha256;
|
|
9
|
+
/** The digest of the canonical action itself, for the authority's binding. */
|
|
10
|
+
readonly intentDigest: Sha256;
|
|
11
|
+
/** The digest of what will be sent, so a later reader can tell what was asked. */
|
|
12
|
+
readonly requestDigest: Sha256;
|
|
13
|
+
/** The resource the effect lands on, as the profile names it. */
|
|
14
|
+
readonly resourceRef: string;
|
|
15
|
+
readonly effectType: string;
|
|
16
|
+
readonly domain: string;
|
|
17
|
+
readonly actionType: string;
|
|
18
|
+
}
|
|
19
|
+
/** What the provider said, as the adapter read it. Never a body, never a credential. */
|
|
20
|
+
export interface ProviderResult {
|
|
21
|
+
readonly status: "COMMITTED" | "FAILED";
|
|
22
|
+
readonly providerStatus: string | null;
|
|
23
|
+
readonly providerReference: string | null;
|
|
24
|
+
readonly responseDigest: Sha256 | null;
|
|
25
|
+
/** A profile reason code when the provider refused; null when it accepted. */
|
|
26
|
+
readonly failureReason: string | null;
|
|
27
|
+
/** The observed effect as the adapter could read it, or null when it could not. */
|
|
28
|
+
readonly observed: JsonObject | null;
|
|
29
|
+
readonly observationMethod: ObservationMethod;
|
|
30
|
+
readonly providerGenerated: boolean;
|
|
31
|
+
readonly source: string;
|
|
32
|
+
}
|
|
33
|
+
export type ObservationMethod = "DOWNSTREAM_ACK" | "READ_AFTER_WRITE" | "EVENT_CONFIRMATION" | "STATE_RECONCILIATION" | "SIGNED_RECEIPT" | "EXTERNAL_ATTESTATION" | "HUMAN_VALIDATION";
|
|
34
|
+
/**
|
|
35
|
+
* A provider that neither committed nor refused. Thrown from `execute`
|
|
36
|
+
* after the request left the process, so the registry reports an unknown
|
|
37
|
+
* outcome and nothing interprets silence as success.
|
|
38
|
+
*/
|
|
39
|
+
export declare class IndeterminateOutcome extends Error {
|
|
40
|
+
readonly reason: string;
|
|
41
|
+
readonly providerStatus: string | null;
|
|
42
|
+
constructor(reason: string, providerStatus?: string | null);
|
|
43
|
+
}
|
|
44
|
+
export interface AdapterExecution<TAction> {
|
|
45
|
+
readonly action: TAction;
|
|
46
|
+
readonly prepared: PreparedAction;
|
|
47
|
+
readonly authorization: VerifiedAuthorization;
|
|
48
|
+
readonly idempotencyKey: string;
|
|
49
|
+
/** The budget left for this dispatch: the smaller of the timeout and the grant. */
|
|
50
|
+
readonly deadline: MonotonicDeadline;
|
|
51
|
+
}
|
|
52
|
+
export interface AdapterReconciliation {
|
|
53
|
+
readonly idempotencyKey: string;
|
|
54
|
+
readonly providerReference: string | null;
|
|
55
|
+
readonly intentHash: string;
|
|
56
|
+
readonly prepared: PreparedAction;
|
|
57
|
+
}
|
|
58
|
+
export type ProviderReconciliationResult = {
|
|
59
|
+
readonly status: "COMPLETED";
|
|
60
|
+
readonly result: ProviderResult;
|
|
61
|
+
} | {
|
|
62
|
+
readonly status: "NOT_EXECUTED";
|
|
63
|
+
} | {
|
|
64
|
+
readonly status: "UNKNOWN";
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* One contract for every family of consequential actions. It is deliberately
|
|
68
|
+
* four small methods, three of them pure:
|
|
69
|
+
*
|
|
70
|
+
* - `prepare` works out what the action asks for and what its effect should
|
|
71
|
+
* be. It reaches nothing and may be called before the authority is asked.
|
|
72
|
+
* - `execute` performs the side effect, once, inside the dispatch the
|
|
73
|
+
* pipeline opened. A provider that neither committed nor refused is an
|
|
74
|
+
* `IndeterminateOutcome`, never a guess.
|
|
75
|
+
* - `observeEffect` reads what the provider said into the profile's
|
|
76
|
+
* projection. Pure: no second call, no interpretation of silence.
|
|
77
|
+
* - `reconcile` asks the provider what it did with an idempotency key,
|
|
78
|
+
* read-only, and may never initiate anything.
|
|
79
|
+
*
|
|
80
|
+
* A second family is a directory beside `banking/`, not a rewrite: the
|
|
81
|
+
* handler bridge, the comparison, the evidence and the verifier all work off
|
|
82
|
+
* this contract alone.
|
|
83
|
+
*/
|
|
84
|
+
export interface EffectAdapter<TAction> {
|
|
85
|
+
readonly id: string;
|
|
86
|
+
readonly version: string;
|
|
87
|
+
/** The transport action names this adapter answers for. */
|
|
88
|
+
readonly actionTypes: readonly string[];
|
|
89
|
+
prepare(action: TAction): PreparedAction;
|
|
90
|
+
execute(execution: AdapterExecution<TAction>): Promise<ProviderResult>;
|
|
91
|
+
observeEffect(result: ProviderResult, prepared: PreparedAction): JsonObject | null;
|
|
92
|
+
reconcile(context: AdapterReconciliation): Promise<ProviderReconciliationResult>;
|
|
93
|
+
}
|
|
94
|
+
/** A value the projection can hold, narrowed for comparison. */
|
|
95
|
+
export type ProjectionValue = JsonValue;
|
|
96
|
+
//# sourceMappingURL=EffectAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EffectAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/EffectAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,cAAc,EAAE,UAAU,CAAC;IACpC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,kFAAkF;IAClF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,iEAAiE;IACjE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,wFAAwF;AACxF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC;IACxC,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AC,QAAQ,EAAE,cAAc,CAAC;CACnC;AAED,MAAM,MAAM,4BAA4B,GACpC;IAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;CAAE,GACjE;IAAE,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;CAAE,GACnC;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAEnC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,aAAa,CAAC,OAAO;IACpC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2DAA2D;IAC3D,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,CAAC;IACzC,OAAO,CAAC,SAAS,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACvE,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,GAAG,UAAU,GAAG,IAAI,CAAC;IACnF,SAAS,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;CAClF;AAED,gEAAgE;AAChE,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A provider that neither committed nor refused. Thrown from `execute`
|
|
3
|
+
* after the request left the process, so the registry reports an unknown
|
|
4
|
+
* outcome and nothing interprets silence as success.
|
|
5
|
+
*/
|
|
6
|
+
export class IndeterminateOutcome extends Error {
|
|
7
|
+
reason;
|
|
8
|
+
providerStatus;
|
|
9
|
+
constructor(reason, providerStatus = null) {
|
|
10
|
+
super(reason);
|
|
11
|
+
this.reason = reason;
|
|
12
|
+
this.providerStatus = providerStatus;
|
|
13
|
+
this.name = "IndeterminateOutcome";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=EffectAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EffectAdapter.js","sourceRoot":"","sources":["../../src/adapters/EffectAdapter.ts"],"names":[],"mappings":"AA4CA;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAE3B;IACA;IAFlB,YACkB,MAAc,EACd,iBAAgC,IAAI;QAEpD,KAAK,CAAC,MAAM,CAAC,CAAC;QAHE,WAAM,GAAN,MAAM,CAAQ;QACd,mBAAc,GAAd,cAAc,CAAsB;QAGpD,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF"}
|