@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.
Files changed (436) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +4 -0
  3. package/README.md +909 -0
  4. package/dist/Cli.d.ts +3 -0
  5. package/dist/Cli.d.ts.map +1 -0
  6. package/dist/Cli.js +150 -0
  7. package/dist/Cli.js.map +1 -0
  8. package/dist/Index.d.ts +104 -0
  9. package/dist/Index.d.ts.map +1 -0
  10. package/dist/Index.js +102 -0
  11. package/dist/Index.js.map +1 -0
  12. package/dist/Serve.d.ts +26 -0
  13. package/dist/Serve.d.ts.map +1 -0
  14. package/dist/Serve.js +143 -0
  15. package/dist/Serve.js.map +1 -0
  16. package/dist/TrustedExecutor.d.ts +66 -0
  17. package/dist/TrustedExecutor.d.ts.map +1 -0
  18. package/dist/TrustedExecutor.js +170 -0
  19. package/dist/TrustedExecutor.js.map +1 -0
  20. package/dist/Version.d.ts +6 -0
  21. package/dist/Version.d.ts.map +1 -0
  22. package/dist/Version.js +21 -0
  23. package/dist/Version.js.map +1 -0
  24. package/dist/adapters/AdapterActionHandler.d.ts +48 -0
  25. package/dist/adapters/AdapterActionHandler.d.ts.map +1 -0
  26. package/dist/adapters/AdapterActionHandler.js +148 -0
  27. package/dist/adapters/AdapterActionHandler.js.map +1 -0
  28. package/dist/adapters/EffectAdapter.d.ts +96 -0
  29. package/dist/adapters/EffectAdapter.d.ts.map +1 -0
  30. package/dist/adapters/EffectAdapter.js +16 -0
  31. package/dist/adapters/EffectAdapter.js.map +1 -0
  32. package/dist/adapters/EffectAwareGrantVerifier.d.ts +30 -0
  33. package/dist/adapters/EffectAwareGrantVerifier.d.ts.map +1 -0
  34. package/dist/adapters/EffectAwareGrantVerifier.js +38 -0
  35. package/dist/adapters/EffectAwareGrantVerifier.js.map +1 -0
  36. package/dist/adapters/EffectComparison.d.ts +20 -0
  37. package/dist/adapters/EffectComparison.d.ts.map +1 -0
  38. package/dist/adapters/EffectComparison.js +48 -0
  39. package/dist/adapters/EffectComparison.js.map +1 -0
  40. package/dist/adapters/EffectEvidenceBuilder.d.ts +60 -0
  41. package/dist/adapters/EffectEvidenceBuilder.d.ts.map +1 -0
  42. package/dist/adapters/EffectEvidenceBuilder.js +127 -0
  43. package/dist/adapters/EffectEvidenceBuilder.js.map +1 -0
  44. package/dist/adapters/EffectEvidenceRegister.d.ts +31 -0
  45. package/dist/adapters/EffectEvidenceRegister.d.ts.map +1 -0
  46. package/dist/adapters/EffectEvidenceRegister.js +21 -0
  47. package/dist/adapters/EffectEvidenceRegister.js.map +1 -0
  48. package/dist/adapters/JcsDigest.d.ts +43 -0
  49. package/dist/adapters/JcsDigest.d.ts.map +1 -0
  50. package/dist/adapters/JcsDigest.js +86 -0
  51. package/dist/adapters/JcsDigest.js.map +1 -0
  52. package/dist/adapters/banking/BankingAction.d.ts +146 -0
  53. package/dist/adapters/banking/BankingAction.d.ts.map +1 -0
  54. package/dist/adapters/banking/BankingAction.js +102 -0
  55. package/dist/adapters/banking/BankingAction.js.map +1 -0
  56. package/dist/adapters/banking/BankingAdapter.d.ts +60 -0
  57. package/dist/adapters/banking/BankingAdapter.d.ts.map +1 -0
  58. package/dist/adapters/banking/BankingAdapter.js +107 -0
  59. package/dist/adapters/banking/BankingAdapter.js.map +1 -0
  60. package/dist/adapters/banking/BankingHandlers.d.ts +24 -0
  61. package/dist/adapters/banking/BankingHandlers.d.ts.map +1 -0
  62. package/dist/adapters/banking/BankingHandlers.js +47 -0
  63. package/dist/adapters/banking/BankingHandlers.js.map +1 -0
  64. package/dist/adapters/banking/BankingIntentBinder.d.ts +47 -0
  65. package/dist/adapters/banking/BankingIntentBinder.d.ts.map +1 -0
  66. package/dist/adapters/banking/BankingIntentBinder.js +64 -0
  67. package/dist/adapters/banking/BankingIntentBinder.js.map +1 -0
  68. package/dist/adapters/banking/CoreBankingHttpAdapter.d.ts +55 -0
  69. package/dist/adapters/banking/CoreBankingHttpAdapter.d.ts.map +1 -0
  70. package/dist/adapters/banking/CoreBankingHttpAdapter.js +248 -0
  71. package/dist/adapters/banking/CoreBankingHttpAdapter.js.map +1 -0
  72. package/dist/adapters/banking/Currency.d.ts +10 -0
  73. package/dist/adapters/banking/Currency.d.ts.map +1 -0
  74. package/dist/adapters/banking/Currency.js +91 -0
  75. package/dist/adapters/banking/Currency.js.map +1 -0
  76. package/dist/adapters/banking/EffectProjections.d.ts +52 -0
  77. package/dist/adapters/banking/EffectProjections.d.ts.map +1 -0
  78. package/dist/adapters/banking/EffectProjections.js +140 -0
  79. package/dist/adapters/banking/EffectProjections.js.map +1 -0
  80. package/dist/adapters/banking/Iban.d.ts +18 -0
  81. package/dist/adapters/banking/Iban.d.ts.map +1 -0
  82. package/dist/adapters/banking/Iban.js +38 -0
  83. package/dist/adapters/banking/Iban.js.map +1 -0
  84. package/dist/adapters/banking/Money.d.ts +32 -0
  85. package/dist/adapters/banking/Money.d.ts.map +1 -0
  86. package/dist/adapters/banking/Money.js +81 -0
  87. package/dist/adapters/banking/Money.js.map +1 -0
  88. package/dist/adapters/banking/ReasonCodes.d.ts +19 -0
  89. package/dist/adapters/banking/ReasonCodes.d.ts.map +1 -0
  90. package/dist/adapters/banking/ReasonCodes.js +35 -0
  91. package/dist/adapters/banking/ReasonCodes.js.map +1 -0
  92. package/dist/audit/ChainJournal.d.ts +38 -0
  93. package/dist/audit/ChainJournal.d.ts.map +1 -0
  94. package/dist/audit/ChainJournal.js +97 -0
  95. package/dist/audit/ChainJournal.js.map +1 -0
  96. package/dist/audit/HashChain.d.ts +39 -0
  97. package/dist/audit/HashChain.d.ts.map +1 -0
  98. package/dist/audit/HashChain.js +63 -0
  99. package/dist/audit/HashChain.js.map +1 -0
  100. package/dist/audit/HashChainedAuditSink.d.ts +22 -0
  101. package/dist/audit/HashChainedAuditSink.d.ts.map +1 -0
  102. package/dist/audit/HashChainedAuditSink.js +26 -0
  103. package/dist/audit/HashChainedAuditSink.js.map +1 -0
  104. package/dist/audit/LineAuditSink.d.ts +19 -0
  105. package/dist/audit/LineAuditSink.d.ts.map +1 -0
  106. package/dist/audit/LineAuditSink.js +35 -0
  107. package/dist/audit/LineAuditSink.js.map +1 -0
  108. package/dist/cli/Arguments.d.ts +26 -0
  109. package/dist/cli/Arguments.d.ts.map +1 -0
  110. package/dist/cli/Arguments.js +66 -0
  111. package/dist/cli/Arguments.js.map +1 -0
  112. package/dist/cli/CliProcess.d.ts +29 -0
  113. package/dist/cli/CliProcess.d.ts.map +1 -0
  114. package/dist/cli/CliProcess.js +78 -0
  115. package/dist/cli/CliProcess.js.map +1 -0
  116. package/dist/cli/Commands.d.ts +8 -0
  117. package/dist/cli/Commands.d.ts.map +1 -0
  118. package/dist/cli/Commands.js +67 -0
  119. package/dist/cli/Commands.js.map +1 -0
  120. package/dist/cli/ConfigCommand.d.ts +7 -0
  121. package/dist/cli/ConfigCommand.d.ts.map +1 -0
  122. package/dist/cli/ConfigCommand.js +77 -0
  123. package/dist/cli/ConfigCommand.js.map +1 -0
  124. package/dist/cli/ConfigFile.d.ts +21 -0
  125. package/dist/cli/ConfigFile.d.ts.map +1 -0
  126. package/dist/cli/ConfigFile.js +57 -0
  127. package/dist/cli/ConfigFile.js.map +1 -0
  128. package/dist/cli/Credentials.d.ts +15 -0
  129. package/dist/cli/Credentials.d.ts.map +1 -0
  130. package/dist/cli/Credentials.js +51 -0
  131. package/dist/cli/Credentials.js.map +1 -0
  132. package/dist/cli/Doctor.d.ts +25 -0
  133. package/dist/cli/Doctor.d.ts.map +1 -0
  134. package/dist/cli/Doctor.js +211 -0
  135. package/dist/cli/Doctor.js.map +1 -0
  136. package/dist/cli/Help.d.ts +3 -0
  137. package/dist/cli/Help.d.ts.map +1 -0
  138. package/dist/cli/Help.js +38 -0
  139. package/dist/cli/Help.js.map +1 -0
  140. package/dist/cli/Init.d.ts +32 -0
  141. package/dist/cli/Init.d.ts.map +1 -0
  142. package/dist/cli/Init.js +163 -0
  143. package/dist/cli/Init.js.map +1 -0
  144. package/dist/cli/Login.d.ts +16 -0
  145. package/dist/cli/Login.d.ts.map +1 -0
  146. package/dist/cli/Login.js +74 -0
  147. package/dist/cli/Login.js.map +1 -0
  148. package/dist/cli/Proxy.d.ts +41 -0
  149. package/dist/cli/Proxy.d.ts.map +1 -0
  150. package/dist/cli/Proxy.js +161 -0
  151. package/dist/cli/Proxy.js.map +1 -0
  152. package/dist/cli/Status.d.ts +7 -0
  153. package/dist/cli/Status.d.ts.map +1 -0
  154. package/dist/cli/Status.js +64 -0
  155. package/dist/cli/Status.js.map +1 -0
  156. package/dist/cli/TestCommand.d.ts +36 -0
  157. package/dist/cli/TestCommand.d.ts.map +1 -0
  158. package/dist/cli/TestCommand.js +173 -0
  159. package/dist/cli/TestCommand.js.map +1 -0
  160. package/dist/config/ConfigKeys.d.ts +10 -0
  161. package/dist/config/ConfigKeys.d.ts.map +1 -0
  162. package/dist/config/ConfigKeys.js +105 -0
  163. package/dist/config/ConfigKeys.js.map +1 -0
  164. package/dist/config/ExecutorConfig.d.ts +254 -0
  165. package/dist/config/ExecutorConfig.d.ts.map +1 -0
  166. package/dist/config/ExecutorConfig.js +637 -0
  167. package/dist/config/ExecutorConfig.js.map +1 -0
  168. package/dist/containment/ContainmentProbe.d.ts +87 -0
  169. package/dist/containment/ContainmentProbe.d.ts.map +1 -0
  170. package/dist/containment/ContainmentProbe.js +103 -0
  171. package/dist/containment/ContainmentProbe.js.map +1 -0
  172. package/dist/credential/CredentialError.d.ts +6 -0
  173. package/dist/credential/CredentialError.d.ts.map +1 -0
  174. package/dist/credential/CredentialError.js +10 -0
  175. package/dist/credential/CredentialError.js.map +1 -0
  176. package/dist/credential/DownstreamCredential.d.ts +38 -0
  177. package/dist/credential/DownstreamCredential.d.ts.map +1 -0
  178. package/dist/credential/DownstreamCredential.js +2 -0
  179. package/dist/credential/DownstreamCredential.js.map +1 -0
  180. package/dist/credential/GrantOf.d.ts +10 -0
  181. package/dist/credential/GrantOf.d.ts.map +1 -0
  182. package/dist/credential/GrantOf.js +16 -0
  183. package/dist/credential/GrantOf.js.map +1 -0
  184. package/dist/credential/PrivateKeyJwtCredential.d.ts +43 -0
  185. package/dist/credential/PrivateKeyJwtCredential.d.ts.map +1 -0
  186. package/dist/credential/PrivateKeyJwtCredential.js +126 -0
  187. package/dist/credential/PrivateKeyJwtCredential.js.map +1 -0
  188. package/dist/credential/SignedRequestCredential.d.ts +112 -0
  189. package/dist/credential/SignedRequestCredential.d.ts.map +1 -0
  190. package/dist/credential/SignedRequestCredential.js +255 -0
  191. package/dist/credential/SignedRequestCredential.js.map +1 -0
  192. package/dist/credential/StaticHeaderCredential.d.ts +16 -0
  193. package/dist/credential/StaticHeaderCredential.d.ts.map +1 -0
  194. package/dist/credential/StaticHeaderCredential.js +21 -0
  195. package/dist/credential/StaticHeaderCredential.js.map +1 -0
  196. package/dist/egress/EgressError.d.ts +13 -0
  197. package/dist/egress/EgressError.d.ts.map +1 -0
  198. package/dist/egress/EgressError.js +16 -0
  199. package/dist/egress/EgressError.js.map +1 -0
  200. package/dist/egress/EgressPolicy.d.ts +55 -0
  201. package/dist/egress/EgressPolicy.d.ts.map +1 -0
  202. package/dist/egress/EgressPolicy.js +137 -0
  203. package/dist/egress/EgressPolicy.js.map +1 -0
  204. package/dist/egress/GlobalFetchLock.d.ts +16 -0
  205. package/dist/egress/GlobalFetchLock.d.ts.map +1 -0
  206. package/dist/egress/GlobalFetchLock.js +34 -0
  207. package/dist/egress/GlobalFetchLock.js.map +1 -0
  208. package/dist/egress/GuardedFetch.d.ts +56 -0
  209. package/dist/egress/GuardedFetch.d.ts.map +1 -0
  210. package/dist/egress/GuardedFetch.js +300 -0
  211. package/dist/egress/GuardedFetch.js.map +1 -0
  212. package/dist/egress/TcpProbe.d.ts +35 -0
  213. package/dist/egress/TcpProbe.d.ts.map +1 -0
  214. package/dist/egress/TcpProbe.js +45 -0
  215. package/dist/egress/TcpProbe.js.map +1 -0
  216. package/dist/gateway/Activation.d.ts +39 -0
  217. package/dist/gateway/Activation.d.ts.map +1 -0
  218. package/dist/gateway/Activation.js +61 -0
  219. package/dist/gateway/Activation.js.map +1 -0
  220. package/dist/gateway/BoundaryTest.d.ts +92 -0
  221. package/dist/gateway/BoundaryTest.d.ts.map +1 -0
  222. package/dist/gateway/BoundaryTest.js +349 -0
  223. package/dist/gateway/BoundaryTest.js.map +1 -0
  224. package/dist/gateway/DemoAuthority.d.ts +41 -0
  225. package/dist/gateway/DemoAuthority.d.ts.map +1 -0
  226. package/dist/gateway/DemoAuthority.js +66 -0
  227. package/dist/gateway/DemoAuthority.js.map +1 -0
  228. package/dist/gateway/ForwardHandler.d.ts +56 -0
  229. package/dist/gateway/ForwardHandler.d.ts.map +1 -0
  230. package/dist/gateway/ForwardHandler.js +111 -0
  231. package/dist/gateway/ForwardHandler.js.map +1 -0
  232. package/dist/gateway/Gateway.d.ts +142 -0
  233. package/dist/gateway/Gateway.d.ts.map +1 -0
  234. package/dist/gateway/Gateway.js +819 -0
  235. package/dist/gateway/Gateway.js.map +1 -0
  236. package/dist/gateway/GatewayConfig.d.ts +237 -0
  237. package/dist/gateway/GatewayConfig.d.ts.map +1 -0
  238. package/dist/gateway/GatewayConfig.js +706 -0
  239. package/dist/gateway/GatewayConfig.js.map +1 -0
  240. package/dist/gateway/GatewayMetrics.d.ts +26 -0
  241. package/dist/gateway/GatewayMetrics.d.ts.map +1 -0
  242. package/dist/gateway/GatewayMetrics.js +28 -0
  243. package/dist/gateway/GatewayMetrics.js.map +1 -0
  244. package/dist/gateway/GatewayReport.d.ts +74 -0
  245. package/dist/gateway/GatewayReport.d.ts.map +1 -0
  246. package/dist/gateway/GatewayReport.js +109 -0
  247. package/dist/gateway/GatewayReport.js.map +1 -0
  248. package/dist/gateway/InterceptedRequest.d.ts +53 -0
  249. package/dist/gateway/InterceptedRequest.d.ts.map +1 -0
  250. package/dist/gateway/InterceptedRequest.js +80 -0
  251. package/dist/gateway/InterceptedRequest.js.map +1 -0
  252. package/dist/gateway/RouteTable.d.ts +28 -0
  253. package/dist/gateway/RouteTable.d.ts.map +1 -0
  254. package/dist/gateway/RouteTable.js +72 -0
  255. package/dist/gateway/RouteTable.js.map +1 -0
  256. package/dist/gateway/Upstream.d.ts +46 -0
  257. package/dist/gateway/Upstream.d.ts.map +1 -0
  258. package/dist/gateway/Upstream.js +158 -0
  259. package/dist/gateway/Upstream.js.map +1 -0
  260. package/dist/handlers/ForwardRequestHandler.d.ts +26 -0
  261. package/dist/handlers/ForwardRequestHandler.d.ts.map +1 -0
  262. package/dist/handlers/ForwardRequestHandler.js +98 -0
  263. package/dist/handlers/ForwardRequestHandler.js.map +1 -0
  264. package/dist/handlers/HandlerRegistration.d.ts +37 -0
  265. package/dist/handlers/HandlerRegistration.d.ts.map +1 -0
  266. package/dist/handlers/HandlerRegistration.js +2 -0
  267. package/dist/handlers/HandlerRegistration.js.map +1 -0
  268. package/dist/handlers/JournaledActionHandler.d.ts +31 -0
  269. package/dist/handlers/JournaledActionHandler.d.ts.map +1 -0
  270. package/dist/handlers/JournaledActionHandler.js +63 -0
  271. package/dist/handlers/JournaledActionHandler.js.map +1 -0
  272. package/dist/http/ExecutorHttpServer.d.ts +33 -0
  273. package/dist/http/ExecutorHttpServer.d.ts.map +1 -0
  274. package/dist/http/ExecutorHttpServer.js +176 -0
  275. package/dist/http/ExecutorHttpServer.js.map +1 -0
  276. package/dist/http/GatewayHttpServer.d.ts +42 -0
  277. package/dist/http/GatewayHttpServer.d.ts.map +1 -0
  278. package/dist/http/GatewayHttpServer.js +195 -0
  279. package/dist/http/GatewayHttpServer.js.map +1 -0
  280. package/dist/http/RecordingTarget.d.ts +18 -0
  281. package/dist/http/RecordingTarget.d.ts.map +1 -0
  282. package/dist/http/RecordingTarget.js +71 -0
  283. package/dist/http/RecordingTarget.js.map +1 -0
  284. package/dist/http/RequestContext.d.ts +17 -0
  285. package/dist/http/RequestContext.d.ts.map +1 -0
  286. package/dist/http/RequestContext.js +19 -0
  287. package/dist/http/RequestContext.js.map +1 -0
  288. package/dist/http/Routes.d.ts +93 -0
  289. package/dist/http/Routes.d.ts.map +1 -0
  290. package/dist/http/Routes.js +46 -0
  291. package/dist/http/Routes.js.map +1 -0
  292. package/dist/http/TlsListener.d.ts +38 -0
  293. package/dist/http/TlsListener.d.ts.map +1 -0
  294. package/dist/http/TlsListener.js +52 -0
  295. package/dist/http/TlsListener.js.map +1 -0
  296. package/dist/identity/Authenticator.d.ts +58 -0
  297. package/dist/identity/Authenticator.d.ts.map +1 -0
  298. package/dist/identity/Authenticator.js +170 -0
  299. package/dist/identity/Authenticator.js.map +1 -0
  300. package/dist/identity/PeerIdentity.d.ts +24 -0
  301. package/dist/identity/PeerIdentity.d.ts.map +1 -0
  302. package/dist/identity/PeerIdentity.js +29 -0
  303. package/dist/identity/PeerIdentity.js.map +1 -0
  304. package/dist/identity/PrincipalRegistry.d.ts +102 -0
  305. package/dist/identity/PrincipalRegistry.d.ts.map +1 -0
  306. package/dist/identity/PrincipalRegistry.js +191 -0
  307. package/dist/identity/PrincipalRegistry.js.map +1 -0
  308. package/dist/identity/PrincipalsFile.d.ts +152 -0
  309. package/dist/identity/PrincipalsFile.d.ts.map +1 -0
  310. package/dist/identity/PrincipalsFile.js +125 -0
  311. package/dist/identity/PrincipalsFile.js.map +1 -0
  312. package/dist/identity/RateLimiter.d.ts +43 -0
  313. package/dist/identity/RateLimiter.d.ts.map +1 -0
  314. package/dist/identity/RateLimiter.js +84 -0
  315. package/dist/identity/RateLimiter.js.map +1 -0
  316. package/dist/identity/SeparationOfDuties.d.ts +11 -0
  317. package/dist/identity/SeparationOfDuties.d.ts.map +1 -0
  318. package/dist/identity/SeparationOfDuties.js +25 -0
  319. package/dist/identity/SeparationOfDuties.js.map +1 -0
  320. package/dist/identity/WorkloadJwtVerifier.d.ts +57 -0
  321. package/dist/identity/WorkloadJwtVerifier.d.ts.map +1 -0
  322. package/dist/identity/WorkloadJwtVerifier.js +145 -0
  323. package/dist/identity/WorkloadJwtVerifier.js.map +1 -0
  324. package/dist/incident/EvidenceExport.d.ts +128 -0
  325. package/dist/incident/EvidenceExport.d.ts.map +1 -0
  326. package/dist/incident/EvidenceExport.js +187 -0
  327. package/dist/incident/EvidenceExport.js.map +1 -0
  328. package/dist/incident/FileProbe.d.ts +22 -0
  329. package/dist/incident/FileProbe.d.ts.map +1 -0
  330. package/dist/incident/FileProbe.js +31 -0
  331. package/dist/incident/FileProbe.js.map +1 -0
  332. package/dist/incident/HaltSwitch.d.ts +95 -0
  333. package/dist/incident/HaltSwitch.d.ts.map +1 -0
  334. package/dist/incident/HaltSwitch.js +171 -0
  335. package/dist/incident/HaltSwitch.js.map +1 -0
  336. package/dist/incident/Metrics.d.ts +71 -0
  337. package/dist/incident/Metrics.d.ts.map +1 -0
  338. package/dist/incident/Metrics.js +146 -0
  339. package/dist/incident/Metrics.js.map +1 -0
  340. package/dist/incident/SecurityEvents.d.ts +182 -0
  341. package/dist/incident/SecurityEvents.d.ts.map +1 -0
  342. package/dist/incident/SecurityEvents.js +167 -0
  343. package/dist/incident/SecurityEvents.js.map +1 -0
  344. package/dist/journal/ExecutionJournal.d.ts +96 -0
  345. package/dist/journal/ExecutionJournal.d.ts.map +1 -0
  346. package/dist/journal/ExecutionJournal.js +100 -0
  347. package/dist/journal/ExecutionJournal.js.map +1 -0
  348. package/dist/journal/FileExecutionJournal.d.ts +38 -0
  349. package/dist/journal/FileExecutionJournal.d.ts.map +1 -0
  350. package/dist/journal/FileExecutionJournal.js +137 -0
  351. package/dist/journal/FileExecutionJournal.js.map +1 -0
  352. package/dist/journal/InMemoryExecutionJournal.d.ts +23 -0
  353. package/dist/journal/InMemoryExecutionJournal.d.ts.map +1 -0
  354. package/dist/journal/InMemoryExecutionJournal.js +47 -0
  355. package/dist/journal/InMemoryExecutionJournal.js.map +1 -0
  356. package/dist/journal/StartupReconciler.d.ts +47 -0
  357. package/dist/journal/StartupReconciler.d.ts.map +1 -0
  358. package/dist/journal/StartupReconciler.js +89 -0
  359. package/dist/journal/StartupReconciler.js.map +1 -0
  360. package/dist/limits/HardLimits.d.ts +63 -0
  361. package/dist/limits/HardLimits.d.ts.map +1 -0
  362. package/dist/limits/HardLimits.js +120 -0
  363. package/dist/limits/HardLimits.js.map +1 -0
  364. package/dist/logging/LineEmitter.d.ts +26 -0
  365. package/dist/logging/LineEmitter.d.ts.map +1 -0
  366. package/dist/logging/LineEmitter.js +36 -0
  367. package/dist/logging/LineEmitter.js.map +1 -0
  368. package/dist/posture/HostPosture.d.ts +60 -0
  369. package/dist/posture/HostPosture.d.ts.map +1 -0
  370. package/dist/posture/HostPosture.js +104 -0
  371. package/dist/posture/HostPosture.js.map +1 -0
  372. package/dist/posture/PostureChecks.d.ts +52 -0
  373. package/dist/posture/PostureChecks.d.ts.map +1 -0
  374. package/dist/posture/PostureChecks.js +172 -0
  375. package/dist/posture/PostureChecks.js.map +1 -0
  376. package/dist/secrets/CompositeSecretStore.d.ts +37 -0
  377. package/dist/secrets/CompositeSecretStore.d.ts.map +1 -0
  378. package/dist/secrets/CompositeSecretStore.js +99 -0
  379. package/dist/secrets/CompositeSecretStore.js.map +1 -0
  380. package/dist/secrets/EnvSecretStore.d.ts +18 -0
  381. package/dist/secrets/EnvSecretStore.d.ts.map +1 -0
  382. package/dist/secrets/EnvSecretStore.js +46 -0
  383. package/dist/secrets/EnvSecretStore.js.map +1 -0
  384. package/dist/secrets/FileSecretStore.d.ts +60 -0
  385. package/dist/secrets/FileSecretStore.d.ts.map +1 -0
  386. package/dist/secrets/FileSecretStore.js +180 -0
  387. package/dist/secrets/FileSecretStore.js.map +1 -0
  388. package/dist/secrets/Redactor.d.ts +32 -0
  389. package/dist/secrets/Redactor.d.ts.map +1 -0
  390. package/dist/secrets/Redactor.js +108 -0
  391. package/dist/secrets/Redactor.js.map +1 -0
  392. package/dist/secrets/SecretHandle.d.ts +34 -0
  393. package/dist/secrets/SecretHandle.d.ts.map +1 -0
  394. package/dist/secrets/SecretHandle.js +71 -0
  395. package/dist/secrets/SecretHandle.js.map +1 -0
  396. package/dist/secrets/SecretStore.d.ts +37 -0
  397. package/dist/secrets/SecretStore.d.ts.map +1 -0
  398. package/dist/secrets/SecretStore.js +12 -0
  399. package/dist/secrets/SecretStore.js.map +1 -0
  400. package/dist/service/AuthorityClients.d.ts +50 -0
  401. package/dist/service/AuthorityClients.d.ts.map +1 -0
  402. package/dist/service/AuthorityClients.js +83 -0
  403. package/dist/service/AuthorityClients.js.map +1 -0
  404. package/dist/service/EscalationResolver.d.ts +97 -0
  405. package/dist/service/EscalationResolver.d.ts.map +1 -0
  406. package/dist/service/EscalationResolver.js +196 -0
  407. package/dist/service/EscalationResolver.js.map +1 -0
  408. package/dist/service/Requests.d.ts +99 -0
  409. package/dist/service/Requests.d.ts.map +1 -0
  410. package/dist/service/Requests.js +42 -0
  411. package/dist/service/Requests.js.map +1 -0
  412. package/dist/service/ServiceError.d.ts +20 -0
  413. package/dist/service/ServiceError.d.ts.map +1 -0
  414. package/dist/service/ServiceError.js +25 -0
  415. package/dist/service/ServiceError.js.map +1 -0
  416. package/dist/service/TrustedExecutorService.d.ts +221 -0
  417. package/dist/service/TrustedExecutorService.d.ts.map +1 -0
  418. package/dist/service/TrustedExecutorService.js +1066 -0
  419. package/dist/service/TrustedExecutorService.js.map +1 -0
  420. package/dist/time/ClockSkewGuard.d.ts +25 -0
  421. package/dist/time/ClockSkewGuard.d.ts.map +1 -0
  422. package/dist/time/ClockSkewGuard.js +35 -0
  423. package/dist/time/ClockSkewGuard.js.map +1 -0
  424. package/dist/time/MonotonicClock.d.ts +35 -0
  425. package/dist/time/MonotonicClock.d.ts.map +1 -0
  426. package/dist/time/MonotonicClock.js +52 -0
  427. package/dist/time/MonotonicClock.js.map +1 -0
  428. package/dist/verify/VerifyAuditChain.d.ts +36 -0
  429. package/dist/verify/VerifyAuditChain.d.ts.map +1 -0
  430. package/dist/verify/VerifyAuditChain.js +109 -0
  431. package/dist/verify/VerifyAuditChain.js.map +1 -0
  432. package/dist/verify/VerifyEvidenceBundle.d.ts +50 -0
  433. package/dist/verify/VerifyEvidenceBundle.d.ts.map +1 -0
  434. package/dist/verify/VerifyEvidenceBundle.js +157 -0
  435. package/dist/verify/VerifyEvidenceBundle.js.map +1 -0
  436. package/package.json +80 -0
package/README.md ADDED
@@ -0,0 +1,909 @@
1
+ # @decionis/agentsafe
2
+
3
+ The trusted executor of the Execution Authority architecture as one deployable process. A workflow
4
+ or agent host posts a proposal to it over HTTP; the executor attaches the trusted context from its
5
+ own configuration, asks the authority for a verdict, and on an `ALLOW` in enforcement claims the
6
+ single-use grant and runs the registered handler once. The proposer never receives a grant or a
7
+ credential. In shadow it records what the authority would have decided and never executes.
8
+
9
+ It is `IntentCapture`, `DecionisGate`, `DecionisGrantVerifier`, `ActionRegistry`, `SafeExecutor`,
10
+ `ShadowPipeline` and `AuditRecorder` from
11
+ [`@decionis/agent-safe-pipeline`](https://www.npmjs.com/package/@decionis/agent-safe-pipeline),
12
+ placed behind a listener so they run as their own service, inside your trust domain, on the far
13
+ side of a network policy from the agent.
14
+
15
+ ```bash
16
+ npm install @decionis/agentsafe
17
+ ```
18
+
19
+ ## The gateway
20
+
21
+ The same runtime is also an HTTP-interception gateway: put it in front of an agent, an API or a
22
+ service, and every `POST`, `PUT`, `PATCH` and `DELETE` that passes through it is captured as an
23
+ intent, decided by the authority, and forwarded byte for byte only on an `ALLOW`, once, under a
24
+ claimed single-use grant. A `BLOCK` is refused, an `ESCALATE` is held, and an authority that
25
+ cannot be reached is its own state, never a verdict.
26
+
27
+ ```bash
28
+ npm install -g @decionis/agentsafe
29
+ agentsafe proxy --upstream http://localhost:3000 --port 8080
30
+ ```
31
+
32
+ Without a Decionis key that runs a local demo authority in the same process, on loopback, with a
33
+ synthetic policy, and says so on every line. With `DECIONIS_API_KEY` and `DECIONIS_TENANT_ID` (or
34
+ `agentsafe login`) it asks Decionis, in shadow first. `agentsafe test` shows, on a synthetic
35
+ target and with nothing of yours involved, what reaches a target with no boundary in the way and
36
+ what enforcement prevents; `agentsafe init` writes the configuration file, `agentsafe doctor`
37
+ checks the binary, the configuration, the upstream, Decionis and the credentials, `agentsafe
38
+ config` prints what resolved and from where, and `agentsafe status` asks a running gateway what
39
+ it is doing. The five-minute path is
40
+ [docs/quickstart](https://github.com/decionis/agent-safe-pipeline/blob/master/docs/quickstart/README.md);
41
+ what is intercepted, bound and forwarded is
42
+ [docs/gateway/http-interception.md](https://github.com/decionis/agent-safe-pipeline/blob/master/docs/gateway/http-interception.md);
43
+ every command, key and variable is under
44
+ [docs/reference](https://github.com/decionis/agent-safe-pipeline/blob/master/docs/reference/cli.md).
45
+
46
+ The rest of this README is the proposal executor, `agentsafe serve`: the same lifecycle behind an
47
+ envelope ingress with principals, a downstream credential and a verified host posture, for a
48
+ deployment that holds the boundary as a bank does.
49
+
50
+ ## Minimal process
51
+
52
+ ```ts
53
+ import { serve, type HandlerRegistration } from "@decionis/agentsafe";
54
+ import { JsonObjectSchema } from "@decionis/agent-safe-pipeline";
55
+
56
+ const handlers: HandlerRegistration = ({ registry, downstream, credential, fetch }) => {
57
+ registry.register("create_payout", {
58
+ parametersSchema: JsonObjectSchema,
59
+ execute: ({ intent, parameters, authorization, dispatch }) =>
60
+ dispatch.run(async (idempotencyKey) => {
61
+ const body = JSON.stringify(parameters);
62
+ // The credential resolves the current secret for this request only;
63
+ // the handler never holds a value of its own.
64
+ const headers = await credential.headersFor({
65
+ method: "POST",
66
+ url: downstream.url,
67
+ body,
68
+ idempotencyKey,
69
+ intentHash: intent.intentHash,
70
+ });
71
+ // The provider side effect, and nothing else, goes here.
72
+ const response = await fetch(downstream.url, {
73
+ method: "POST",
74
+ headers: {
75
+ ...headers,
76
+ "idempotency-key": idempotencyKey,
77
+ "x-agent-safe-dossier-id": authorization.dossierId,
78
+ },
79
+ body,
80
+ });
81
+ return { status: response.status, accepted: response.ok };
82
+ }),
83
+ reconcile: async ({ idempotencyKey }) => {
84
+ // Read-only: what did the provider do with this key? Never send again.
85
+ const response = await fetch(
86
+ `${downstream.lookupUrl}`.replace("{idempotency_key}", idempotencyKey),
87
+ );
88
+ if (response.status === 404) return { status: "NOT_EXECUTED" };
89
+ if (response.ok)
90
+ return { status: "COMPLETED", result: { status: response.status, accepted: true } };
91
+ return { status: "UNKNOWN" };
92
+ },
93
+ });
94
+ return ["create_payout"];
95
+ };
96
+
97
+ await serve(handlers);
98
+ ```
99
+
100
+ `serve` reads the configuration from the environment, seals the global `fetch`, verifies the host
101
+ posture, opens the secrets from their mounted files, restores the evidence chains from the
102
+ journal, binds the listener, and on `SIGTERM` closes it and persists the chain heads. A journal
103
+ directory it cannot open is also a refusal to start, reported after the posture, because a host
104
+ that does not hold its posture is wrong about something more fundamental than a directory and its
105
+ refusal names the check; `SIGHUP`
106
+ re-reads the secret files, and a rotated TLS key replaces the listener's context in place. A missing or invalid variable, a host that does not hold the posture, or a secret
107
+ file another user could read is a refusal to start that names the variable or the check, never a
108
+ value. The bin `agentsafe serve` does the same with the reference forwarding handler,
109
+ `forwardRequestHandlers()`, which posts the verified parameters to `DOWNSTREAM_URL`;
110
+ `agentsafe verify chain <file>` (also `verify-chain`) checks a log's chains offline. To assemble the
111
+ executor without a process around it, `createTrustedExecutor({ config, secrets, handlers })`
112
+ verifies the posture, returns the service and a `listen`/`close` pair, and owns the secret store
113
+ from then on; the offline proof in the repository does exactly that against loopback doubles.
114
+
115
+ ## What it is, and is not
116
+
117
+ It is the execution boundary as a process: the same components as the package README of
118
+ `@decionis/agent-safe-pipeline` shows in one file, with a listener, a configuration contract, an
119
+ escalation resolver for both Presence shapes, and a sealed handler seam.
120
+
121
+ It is not a hosted service, not the authority (that is the Decionis service, or your own
122
+ implementation of the two interfaces in
123
+ [OPEN-CORE.md](https://github.com/decionis/agent-safe-pipeline/blob/master/OPEN-CORE.md)), and not
124
+ a substitute for the controls the host owns: executor isolation, agent egress denial, credential
125
+ scoping
126
+ ([THREAT-MODEL.md](https://github.com/decionis/agent-safe-pipeline/blob/master/THREAT-MODEL.md),
127
+ "Accepted risks"). The Kubernetes manifest in the repository's
128
+ [deployment kit](https://github.com/decionis/agent-safe-pipeline/blob/master/deploy/README.md) is
129
+ where those controls are written down.
130
+
131
+ ## The wire contract
132
+
133
+ | Method | Path | Who | What it does |
134
+ | ------ | ----------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------ |
135
+ | `GET` | `/health` | anyone | The process is up |
136
+ | `GET` | `/ready` | anyone | Ready, or 503 while halted or still resolving an attempt; reports the mode and the actions |
137
+ | `POST` | `/v1/actions` | a `PROPOSER` | Capture, evaluate, and in enforcement execute once on an `ALLOW` |
138
+ | `POST` | `/v1/reconciliations` | the `PROPOSER` that proposed | Read-only: what the provider did with an attempt whose answer was lost |
139
+ | `POST` | `/v1/escalations` | the `PROPOSER` that proposed | Resume an open escalation: one lookup, then a fresh decision if the person answered |
140
+ | `GET` | `/v1/control/status` | an `OPERATOR` with `status` | Mode, actions, posture, principals, the chain's head, the halt, the open attempts |
141
+ | `POST` | `/v1/control/halt` | an `OPERATOR` with `halt` | Stop taking new work, with a reason |
142
+ | `POST` | `/v1/control/resume` | an `OPERATOR` with `resume` | Take work again, with a reason; refused while the cause of the halt stands |
143
+ | `GET` | `/v1/control/open-attempts` | an `OPERATOR` with `status` | The attempts whose outcome this process does not know |
144
+ | `POST` | `/v1/control/secrets/reload` | an `OPERATOR` with `secrets.reload` | Re-read every secret file now; the report names files, never values |
145
+ | `POST` | `/v1/control/evidence-export` | an `OPERATOR` with `evidence` | Write a bundle of this process's own evidence, and return its manifest |
146
+ | `GET` | `/metrics` | an `OPERATOR` with `metrics` | The OpenMetrics exposition |
147
+
148
+ Who may call is the principals file, described below; without one, the one legacy caller presents
149
+ the caller token as `Authorization: Bearer <token>`. Every request that is not public passes the
150
+ door in one fixed, fail-closed order: the window for failed attempts (`429 RATE_LIMITED`); a
151
+ client certificate together with a bearer, which is ambiguous and refused (`401 AUTH_AMBIGUOUS`);
152
+ the certificate, by SAN URI and optional pin; the bearer, by digest across every bearer principal
153
+ in constant time, then as a workload token; the principal's lock (`423 PRINCIPAL_LOCKED`, only once
154
+ the principal is known, so a lock is never an existence oracle); the principal's own window; the
155
+ route's role (`403 ROLE_FORBIDDEN`); the route's scope (`403 SCOPE_FORBIDDEN`). A refusal is a
156
+ status and a stable code with nothing from the request echoed back, and one `AUTH_FAILED` event
157
+ with the method and the code. Bodies are JSON, at most 100 KiB. Every response, refusals included,
158
+ carries `Content-Security-Policy: default-src 'none'; frame-ancestors 'none'`,
159
+ `X-Frame-Options: DENY`, `X-Content-Type-Options: nosniff` and `Cache-Control: no-store`.
160
+
161
+ ### The listener
162
+
163
+ The listener is TLS: `EXECUTOR_TLS_CERT_FILE` and the `EXECUTOR_TLS_KEY` secret, TLS 1.3 unless
164
+ `EXECUTOR_TLS_MIN_VERSION=1.2` admits 1.2 with ECDHE and an AEAD cipher only, no renegotiation,
165
+ HTTP/1.1 only. With `EXECUTOR_TLS_CLIENT_CA_FILE` every connection is asked for a client
166
+ certificate; the handshake admits a connection without one, deliberately, because the kubelet's
167
+ HTTPS probes present none. With a principals file, a certificate is one credential kind among
168
+ three and names its principal by SAN URI; without one, every route that is not public requires an
169
+ authorized certificate and the caller token together, so a probe reaches `/health` and nothing
170
+ else. A rotated key replaces the TLS
171
+ context in place; connections already open keep the context they negotiated. Plaintext, for a
172
+ developer's machine and the offline proof, needs `EXECUTOR_ALLOW_PLAINTEXT_LISTENER=true` and is
173
+ refused under `NODE_ENV=production`. A refusal at the door is recorded on the security stream as
174
+ `AUTH_FAILED` with the method, `bearer` or `mtls`, and nothing else.
175
+
176
+ ### `POST /v1/actions`
177
+
178
+ ```json
179
+ {
180
+ "proposal": {
181
+ "action": "forward_request",
182
+ "target": "payout:synthetic-beneficiary-1",
183
+ "parameters": { "amountMinor": 5000, "currency": "USD" }
184
+ },
185
+ "idempotency_key": "payout-1-v1",
186
+ "correlation_id": "synthetic-run-1"
187
+ }
188
+ ```
189
+
190
+ `proposal` is the agent's part and nothing else. Tenant, actor, downstream target and credentials
191
+ come from the executor's configuration, and a request that tries to supply them is refused by the
192
+ strict schema (`400 REQUEST_INVALID`). The idempotency key and correlation id are the caller's,
193
+ derived from its own record of the work. An action the process has not registered is refused before
194
+ any authority is asked (`422 ACTION_NOT_REGISTERED`): no dossier and no grant for something that
195
+ could never execute.
196
+
197
+ The answer, in enforcement:
198
+
199
+ ```json
200
+ {
201
+ "mode": "ENFORCEMENT",
202
+ "intent_id": "…",
203
+ "intent_hash": "sha256:…",
204
+ "verdict": "ALLOW",
205
+ "decision_id": "…",
206
+ "dossier_id": "…",
207
+ "reason_codes": [],
208
+ "fail_closed": false,
209
+ "outcome": "COMPLETED",
210
+ "executed": true,
211
+ "authorization": { "decision_id": "…", "dossier_id": "…", "grant_id": "…", "expires_at": "…" },
212
+ "finalization": "RECORDED",
213
+ "result": { "status": 202, "accepted": true },
214
+ "effect": null,
215
+ "recovery": null
216
+ }
217
+ ```
218
+
219
+ `outcome` is one of the executor's four
220
+ ([execution outcomes](https://github.com/decionis/agent-safe-pipeline/blob/master/docs/execution-outcomes.md)):
221
+ `COMPLETED`, `BLOCKED`, `FAILED_BEFORE_DISPATCH`, `UNKNOWN_AFTER_DISPATCH`, or `ESCALATE_PENDING`
222
+ while a person has yet to answer. A `BLOCK` comes back with `executed: false`, no `authorization`,
223
+ and the reason codes. An `ESCALATE` comes back the same way, plus an `escalation` object when the
224
+ executor is configured to resolve one (below); with `EXECUTOR_ESCALATION=NONE` the hold is the
225
+ answer. `authorization` is the consumed binding, kept as evidence; the grant token itself never
226
+ leaves the process.
227
+
228
+ A provider that was reached and refused deterministically comes back as `DEFINITELY_NOT_EXECUTED`
229
+ with `executed: false`, its own reason among the reason codes, and no `effect` block: a handler
230
+ that throws returns no result to read one from. The observation is not lost — the adapter registers
231
+ it before throwing, so the authority receives the effect evidence with the finalization, and the
232
+ security stream carries `PROVIDER_REFUSED`.
233
+
234
+ `effect` is what the adapter observed, for a family that has an effect plane: the outcome, the
235
+ confirmation, the comparison against what was authorised, the fields that differ, the observation
236
+ method, both effect digests, the response digest, the provider's reference, and the digest of the
237
+ record itself. It is `null` for an action with no adapter, and it never carries a provider body, a
238
+ parameter, or a credential. An observed effect that is not the authorised one leaves `outcome` at
239
+ `COMPLETED`, because the handler returned, and says the rest in this block with `EFFECT_MISMATCH`
240
+ among the reason codes; what the executor then does about it is
241
+ `EXECUTOR_ON_EFFECT_MISMATCH`. The states and the mismatch behaviour are in
242
+ [execution outcomes](https://github.com/decionis/agent-safe-pipeline/blob/master/docs/execution-outcomes.md).
243
+
244
+ In shadow, `mode` is `SHADOW`, `outcome` is the observation status (`OBSERVED`, `UNAVAILABLE`,
245
+ `TIMED_OUT`, `INVALID`), `executed` is always `false`, and `authorization` is always `null`. The
246
+ production action, if there is one, runs in the caller as it did before
247
+ ([shadow mode](https://github.com/decionis/agent-safe-pipeline/blob/master/docs/shadow-mode.md)).
248
+
249
+ ### `POST /v1/reconciliations`
250
+
251
+ When a provider took the request and the response was lost, the answer is `UNKNOWN_AFTER_DISPATCH`
252
+ with `executed: null` and a `recovery` object: the exact intent and the recovery reference. Present
253
+ that object back, unchanged, and the executor asks the provider what it did with the idempotency
254
+ key, never sending the request again. The intent is re-hashed on the way in, so a changed intent no
255
+ longer matches its reference and is refused with `RECOVERY_BINDING_MISMATCH`. The process keeps no
256
+ state between the two calls.
257
+
258
+ ### `POST /v1/escalations`
259
+
260
+ An `ESCALATE` means a named person has to approve this exact intent. The executor resolves it in
261
+ one of two shapes, chosen by `EXECUTOR_ESCALATION`; both are stateless on this side, and in both the
262
+ authority decides again with the person's answer as evidence before any grant exists:
263
+
264
+ | Shape | Who talks to Presence | What the caller is handed |
265
+ | --------- | ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------- |
266
+ | `DIRECT` | This process, holding the Presence credential; the request is bound to the intent hash the person sees | `{ mode: "DIRECT", intent, request_id, approval_url, expires_at }` |
267
+ | `MANAGED` | The authority; no Presence credential exists in this process | `{ mode: "MANAGED", intent, escalation }`, the authority's escalation state |
268
+
269
+ The caller presents the `escalation` object back, unchanged, whenever it wants an answer. The
270
+ executor makes one bounded lookup: still pending comes back as `ESCALATE_PENDING` with the state to
271
+ present next time; an approval goes back to the authority, which evaluates the same intent again
272
+ and, on `ALLOW`, the action runs once; a denial, expiry or cancellation is a `BLOCK`. The intent is
273
+ re-hashed on the way in, so a receipt or an escalation that belongs to a different intent yields
274
+ nothing, and an intent past `EXECUTOR_INTENT_TTL_SECONDS` is refused with `409 INTENT_EXPIRED`: an
275
+ approval cannot revive an expired intent. Nothing waits inside a request, and nothing is kept
276
+ between two.
277
+
278
+ ## Configuration
279
+
280
+ Every variable, in one list (`CONFIG_KEYS`). A missing or invalid value is a refusal to start that
281
+ names the variable and never its value. Nothing that identifies a tenant, a system, a person or a
282
+ network path has a default.
283
+
284
+ | Variable | Meaning |
285
+ | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
286
+ | `EXECUTOR_MODE` | `SHADOW` or `ENFORCEMENT` |
287
+ | `EXECUTOR_BIND_ADDRESS`, `PORT` | Where the listener binds |
288
+ | `EXECUTOR_TENANT_ID` | Legacy mode only: the Decionis tenant, a UUID |
289
+ | `EXECUTOR_ACTOR_ID`, `_TYPE` | Legacy mode only: the actor the intent names; `EXECUTOR_ACTOR_RUNTIME` is optional |
290
+ | `EXECUTOR_INTENT_TTL_SECONDS` | How long a proposal stays valid, at most five minutes; a ceremony has to finish inside it |
291
+ | `EXECUTOR_CALLER_TOKEN` | Legacy mode only: the token the one caller presents; secret |
292
+ | `EXECUTOR_PRINCIPALS_FILE` | The principals file; excludes `EXECUTOR_TENANT_ID`, `EXECUTOR_ACTOR_*` and the caller token; required in production |
293
+ | `EXECUTOR_ALLOW_LEGACY_CALLER` | `true` lets production run without a principals file, on the legacy caller alone |
294
+ | `EXECUTOR_JWT_AUDIENCE`, `EXECUTOR_JWKS_FILE` | Together: the audience workload tokens must carry, and the JWKS they are verified against |
295
+ | `EXECUTOR_JWKS_URL`, `EXECUTOR_JWKS_CA_FILE` | Optional: where the JWKS is refreshed from through the guarded fetch, and the bundle that address is verified against |
296
+ | `EXECUTOR_JWKS_REFRESH_SECONDS` | How often, one minute to a day, five minutes by default |
297
+ | `EXECUTOR_JWT_CLOCK_TOLERANCE_SECONDS` | Leeway on a token's times, up to five minutes, thirty seconds by default |
298
+ | `EXECUTOR_RATE_LIMIT_UNAUTHENTICATED` | `<count>/<seconds>` for attempts that never became a principal; `20/60` by default |
299
+ | `EXECUTOR_AUTH_LOCKOUT` | `<failures>/<seconds>/<lock seconds>` for a principal's proven failures; `10/60/300` by default, `0/…` disables |
300
+ | `EXECUTOR_ESCALATION` | `NONE`, `DIRECT` or `MANAGED`; refused in shadow, which never escalates |
301
+ | `EXECUTOR_POSTURE` | `ENFORCED` (the default) or `DEVELOPMENT`, which waives the host checks and says so; refused under `NODE_ENV=production` |
302
+ | `EXECUTOR_POSTURE_INTERVAL_SECONDS` | How often the drift checks repeat while running; ten seconds to ten minutes, sixty by default |
303
+ | `EXECUTOR_SECRETS_DIR` | The directory every `<NAME>_FILE` must resolve inside; required in production when any file is mounted |
304
+ | `EXECUTOR_TLS_CERT_FILE`, `EXECUTOR_TLS_KEY` | The listener's certificate chain and its private key; the key is a secret, given as `EXECUTOR_TLS_KEY_FILE` in production |
305
+ | `EXECUTOR_TLS_CLIENT_CA_FILE` | Optional: the CA that callers' client certificates chain to; every non-public route then requires one |
306
+ | `EXECUTOR_TLS_MIN_VERSION` | `1.3` (the default) or `1.2`, which admits TLS 1.2 with AEAD ciphers only |
307
+ | `EXECUTOR_ALLOW_PLAINTEXT_LISTENER` | `true` runs the listener without TLS, for a developer's machine; refused under `NODE_ENV=production` |
308
+ | `EXECUTOR_EGRESS_MAX_RESPONSE_BYTES` | The most any outbound response may carry, 1 KiB to 16 MiB, 1 MiB by default |
309
+ | `EXECUTOR_JOURNAL_DIR` | Where the evidence chains' heads and the attempt journal live; absolute, writable, required in enforcement |
310
+ | `EXECUTOR_JOURNAL_REQUIRED` | `false` lets enforcement run without a journal, for a developer's machine; refused under `NODE_ENV=production` |
311
+ | `EXECUTOR_JOURNAL_RETAIN_DAYS` | How many days of attempt files a restart reads back, one to a year, seven by default |
312
+ | `EXECUTOR_READY_REQUIRES_NO_UNKNOWN_ATTEMPTS` | `true` keeps `/ready` at 503 while any attempt's outcome is unknown |
313
+ | `EXECUTOR_HALT_FILE` | Optional: a file whose presence halts the executor, watched and polled |
314
+ | `EXECUTOR_HALT_ON_AUTH_FAILURES` | `<count>/<seconds>` of door refusals that halt the executor; `50/60` by default |
315
+ | `EXECUTOR_HALT_ON_EGRESS_REFUSALS` | `<count>/<seconds>` of refused outbound requests that halt it; `5/60` by default |
316
+ | `EXECUTOR_HARD_LIMIT_SINGLE_MINOR` | `CHF:2500000000,EUR:1000000`: the most one action may move, per currency, in minor units |
317
+ | `EXECUTOR_HARD_LIMIT_WINDOW_SECONDS` | The window the count and sum below are measured over; required with either |
318
+ | `EXECUTOR_HARD_LIMIT_WINDOW_COUNT` | Optional: the most actions that may execute inside the window |
319
+ | `EXECUTOR_HARD_LIMIT_WINDOW_SUM_MINOR` | Optional: the most value that may move inside the window, in minor units |
320
+ | `EXECUTOR_MAX_CLOCK_SKEW_MS` | How far the authority's clock may differ before the executor halts; two seconds by default |
321
+ | `EXECUTOR_AUDIT_CHECKPOINT_LINES` | How many chained lines between persisted heads, one hundred by default |
322
+ | `EXECUTOR_EVIDENCE_DIR` | Where an operator's evidence bundle is written; exporting is refused with `409` when absent |
323
+ | `EXECUTOR_EVIDENCE_WINDOW_LINES` | Lines of each stream this process keeps for a bundle, 100 to 200000, five thousand by default |
324
+ | `EXECUTOR_EVIDENCE_SIGNING_KEY` | Optional Ed25519 PKCS#8 key that signs a bundle's manifest; secret, and needs an evidence directory |
325
+ | `EXECUTOR_IMAGE_DIGEST` | What the platform says this deployment is running; carried into a bundle and marked not self-verified |
326
+ | `DECIONIS_API_URL` | The authority, HTTPS |
327
+ | `DECIONIS_API_KEY` | The server-side Decionis credential; secret |
328
+ | `DECIONIS_ALLOW_INSECURE_LOOPBACK` | `true` permits plain HTTP to loopback for local doubles; refused under `NODE_ENV=production` |
329
+ | `DECIONIS_CA_FILE`, `DECIONIS_SPKI_PINS` | Optional: the PEM bundle the authority is verified against, and two or more `sha256/<base64>` SPKI pins |
330
+ | `PRESENCE_APPROVER_ID` | The person who must approve (`DIRECT` and `MANAGED`); `PRESENCE_APPROVER_ROLE` is optional in `MANAGED` |
331
+ | `PRESENCE_VERIFICATION_LEVEL`, `_METHODS` | `STANDARD` or `HIGH_CONFIDENCE`, and a comma-separated list of `WEBAUTHN`, `ACTIVE_LIVENESS` |
332
+ | `PRESENCE_API_URL`, `PRESENCE_API_KEY` | `DIRECT` only: the Presence service and its server-side credential; secret |
333
+ | `PRESENCE_ORGANIZATION` | `DIRECT` only: the requesting party the person sees |
334
+ | `PRESENCE_CA_FILE` | `DIRECT` only, optional: the PEM bundle the Presence service is verified against |
335
+ | `PRESENCE_HARDWARE_PKI_REQUIRED`, `_DISALLOW_VIRTUAL_CAMERAS` | `DIRECT` only: `true` or `false` |
336
+ | `DOWNSTREAM_URL` | Where the reference handler forwards the verified parameters, HTTPS |
337
+ | `DOWNSTREAM_LOOKUP_URL` | Optional read-only lookup for reconciliation; must contain `{idempotency_key}` |
338
+ | `DOWNSTREAM_SYSTEM`, `_OPERATION`, `_ENVIRONMENT` | The downstream target the intent names |
339
+ | `DOWNSTREAM_CREDENTIAL_KIND` | `STATIC_HEADER` (the default), `PRIVATE_KEY_JWT` or `SIGNED_REQUEST`; the other kinds' keys must be absent |
340
+ | `DOWNSTREAM_CREDENTIAL` | `STATIC_HEADER`: the header value the downstream expects, prefix included; secret |
341
+ | `DOWNSTREAM_CREDENTIAL_HEADER` | `STATIC_HEADER`: the header it goes in |
342
+ | `DOWNSTREAM_TOKEN_URL`, `DOWNSTREAM_CLIENT_ID` | `PRIVATE_KEY_JWT`: the token endpoint, HTTPS, and the client id |
343
+ | `DOWNSTREAM_PRIVATE_KEY` | `PRIVATE_KEY_JWT`: the PKCS#8 key the assertion is signed with; secret |
344
+ | `DOWNSTREAM_PRIVATE_KEY_ID`, `_ALGORITHM` | `PRIVATE_KEY_JWT`: optional `kid`, and `ES256` (the default) or `PS256` |
345
+ | `DOWNSTREAM_TOKEN_AUDIENCE`, `DOWNSTREAM_TOKEN_SCOPE` | `PRIVATE_KEY_JWT`: optional assertion audience (the token endpoint by default) and scope |
346
+ | `DOWNSTREAM_SIGNING_KEY`, `DOWNSTREAM_SIGNING_KEY_ID` | `SIGNED_REQUEST`: the Ed25519 PKCS#8 key or the HMAC secret, and the `keyid` the downstream knows it by; the key is secret |
347
+ | `DOWNSTREAM_SIGNING_ALGORITHM` | `SIGNED_REQUEST`: `ed25519` (the default) or `hmac-sha256` |
348
+ | `DOWNSTREAM_CA_FILE`, `DOWNSTREAM_SPKI_PINS` | Optional: the PEM bundle the downstream is verified against, and two or more `sha256/<base64>` SPKI pins |
349
+ | `DOWNSTREAM_TIMEOUT_MS` | Finite, at most fifteen seconds |
350
+ | `DOWNSTREAM_LOOKUP_BY_REFERENCE_URL` | Optional read-back by the provider's own reference; must contain `{provider_reference}` |
351
+ | `BANKING_ADAPTER_ID`, `BANKING_ADAPTER_VERSION` | The observer identity the effect evidence names; `AGENTSAFE_CORE_BANKING` and `0.1.0` by default |
352
+ | `EXECUTOR_ON_EFFECT_MISMATCH` | `HALT` (the default) or `ALERT`: what an observed effect that is not the authorised one does |
353
+
354
+ ## Principals
355
+
356
+ `EXECUTOR_PRINCIPALS_FILE` names every caller: who they are, what role they hold, and how they
357
+ prove it. The file is `agent-safe.principals/1`, at most two hundred principals, checked for its
358
+ mode and owner like a secret although it holds no secret: a bearer credential is the SHA-256 of
359
+ the token, a certificate is named by its SAN URI, a workload token by its issuer and subject.
360
+
361
+ ```json
362
+ {
363
+ "version": "agent-safe.principals/1",
364
+ "principals": [
365
+ {
366
+ "id": "treasury-workflow",
367
+ "role": "PROPOSER",
368
+ "tenant_id": "00000000-0000-4000-8000-000000000001",
369
+ "actor": { "id": "synthetic-payout-agent", "type": "AI_AGENT", "runtime": "workflow-runner" },
370
+ "allowed_actions": ["forward_request"],
371
+ "credential": {
372
+ "kind": "WORKLOAD_JWT",
373
+ "issuer": "https://kubernetes.default.svc.cluster.example",
374
+ "subject": "system:serviceaccount:agent-safe-agents:treasury-workflow",
375
+ "required_claims": { "kubernetes.io/namespace": "agent-safe-agents" }
376
+ },
377
+ "rate_limit": "120/60"
378
+ },
379
+ {
380
+ "id": "batch-runner",
381
+ "role": "PROPOSER",
382
+ "tenant_id": "00000000-0000-4000-8000-000000000001",
383
+ "actor": { "id": "synthetic-batch-agent", "type": "AI_AGENT" },
384
+ "allowed_actions": ["forward_request"],
385
+ "credential": { "kind": "BEARER", "token_sha256": "<sha256 of the token, hex>" }
386
+ },
387
+ {
388
+ "id": "ops-oncall",
389
+ "role": "OPERATOR",
390
+ "scopes": ["status", "metrics", "secrets.reload"],
391
+ "credential": { "kind": "MTLS", "san_uri": "spiffe://bank.example/ns/ops/sa/oncall" }
392
+ }
393
+ ]
394
+ }
395
+ ```
396
+
397
+ A `PROPOSER` carries the tenant and actor its intents name and the actions it may propose; an
398
+ `OPERATOR` carries scopes from `halt`, `resume`, `secrets.reload`, `status`, `metrics`,
399
+ `evidence`. The tenant and actor come from the principal, never from the request, and the
400
+ principal's id travels inside the hashed intent as `context.caller_principal`, so the authority's
401
+ policy can see who asked and a reconciliation or a resumption is refused unless the intent
402
+ presented is the caller's own (`403 INTENT_PRINCIPAL_MISMATCH`). An action a principal may not
403
+ propose is `403 ACTION_NOT_PERMITTED_FOR_PRINCIPAL`, refused before the intent is captured. A
404
+ proposer whose id or actor is the configured approver, or whose actor is an operator, is refused
405
+ at start or as `422 SEPARATION_OF_DUTIES_VIOLATED`; the authority's maker-checker rule is not
406
+ duplicated, only the obvious self-approval shapes are stopped early.
407
+
408
+ Loading refuses a duplicate id, a credential identity claimed twice
409
+ (`PRINCIPALS_CREDENTIAL_SHARED`), an action nobody registered, a workload credential without
410
+ `EXECUTOR_JWT_AUDIENCE` and `EXECUTOR_JWKS_FILE`, and a certificate credential without
411
+ `EXECUTOR_TLS_CLIENT_CA_FILE`. `BEARER` principals are allowed in production and named on the
412
+ security stream at start (`BEARER_PRINCIPAL_CONFIGURED`), because a digest in a file is still a
413
+ bearer secret somewhere else.
414
+
415
+ Workload tokens are verified against the JWKS in `EXECUTOR_JWKS_FILE`, which the platform team
416
+ places from the cluster's `/openid/v1/jwks`, optionally refreshed from `EXECUTOR_JWKS_URL`
417
+ through the guarded fetch with the last good set kept on any failure. RS256, ES256 and EdDSA only;
418
+ `iss`, `sub`, `exp` and `iat` required; at most a day old; the audience must include the
419
+ executor's or the one the principal names; `required_claims` must match exactly. Each refusal has
420
+ its own code (`JWT_SIGNATURE_INVALID`, `JWT_AUDIENCE_MISMATCH`, `JWT_ISSUER_UNKNOWN`,
421
+ `JWT_EXPIRED`, `JWT_ALGORITHM_REFUSED`, `JWT_SUBJECT_UNKNOWN`, `JWT_CLAIM_MISMATCH`). There is no
422
+ `jti` cache by design: a projected token is a bearer for its lifetime, a replayed request is
423
+ defeated by the idempotency key, the intent hash and the single-use grant, and a signed request
424
+ exists for per-request proof.
425
+
426
+ Failed attempts that never became a principal share one window,
427
+ `EXECUTOR_RATE_LIMIT_UNAUTHENTICATED`; a principal whose proven identity keeps failing (a workload
428
+ token with the wrong audience or claim, a pinned certificate that does not match) is locked after
429
+ `EXECUTOR_AUTH_LOCKOUT` failures, unlocked only by expiry or a restart, and the lock is recorded
430
+ as `PRINCIPAL_LOCKED`; a principal's own `rate_limit` bounds what it may send, and a rule that is
431
+ not `<count>/<seconds>` is refused at start-up naming the principal by id rather than by its
432
+ position in the file.
433
+
434
+ Without a principals file the executor runs in legacy mode: one `PROPOSER` named `legacy-caller`
435
+ is synthesised from `EXECUTOR_TENANT_ID`, `EXECUTOR_ACTOR_*` and the caller token, allowed every
436
+ registered action, with no operator at all, so every control route answers `403`. The security
437
+ stream says `LEGACY_PRINCIPAL_MODE` at start, and production refuses it unless
438
+ `EXECUTOR_ALLOW_LEGACY_CALLER=true` says so by name.
439
+
440
+ ## Secrets
441
+
442
+ Each secret is given as `<NAME>_FILE`, the path of a mounted file, or outside production as the
443
+ variable `<NAME>`; never both, and in production only the file, because a file is the one shape
444
+ whose permissions and rotation this process can verify. A secret file must be a regular file,
445
+ inside `EXECUTOR_SECRETS_DIR`, and either private to the process's user or owned by root and
446
+ readable by the process's group alone, which is how a Kubernetes Secret volume mounts with
447
+ `fsGroup` set; anything else is a refusal that names the variable.
448
+
449
+ Secrets are read into handles that hand the value out only for the duration of a request and zero
450
+ it on disposal; a handle never becomes a string by `toString`, `toJSON`, or `util.inspect`. The
451
+ mount directory is watched and polled: a changed file becomes current atomically, the old handle is
452
+ zeroed after a grace, and the security stream records `SECRET_ROTATED` with the name. The gate and
453
+ the verifier read the authority's credential from the handle at each request, so a rotated file
454
+ reaches the next request with nothing rebuilt and a request already in flight keeps the value it
455
+ sent. The Presence client is the exception: it takes a string once, from a package this repository
456
+ does not own, so a rotated Presence key rebuilds the credential-holding clients as one set and says
457
+ so as `AUTHORITY_CLIENTS_REBUILT`. A file that fails its checks on reload is refused with `SECRET_RELOAD_REFUSED` and the
458
+ previous value stays current. A rotated caller token admits the new value from the next request
459
+ and refuses the old one.
460
+
461
+ Every line that leaves the process passes a redactor that holds no secret value, only the digests
462
+ of the current secrets: a whole value that reaches a line is recognised by hashing the line's
463
+ tokens, and a bearer credential, a PEM block, a compact JWS, or the configured downstream header is
464
+ recognised by shape. A redaction is reported as `LEAK_SUSPECTED` on the security stream and never
465
+ stops the line.
466
+
467
+ Where the value comes from is yours: a Kubernetes Secret, the Secrets Store CSI driver in front of
468
+ a cloud KMS or Vault, or External Secrets. Each lands the credential as a file this process reads
469
+ and follows; none of them is integrated here, and an HSM-resident signing key that must never leave
470
+ its device needs a signing sidecar this package does not provide.
471
+
472
+ ## Downstream credentials
473
+
474
+ `DOWNSTREAM_CREDENTIAL_KIND` says how this process proves itself to the downstream; a handler asks
475
+ the credential for headers before the point of no return and never holds a value of its own.
476
+
477
+ - `STATIC_HEADER` (the default): the value of `DOWNSTREAM_CREDENTIAL` in
478
+ `DOWNSTREAM_CREDENTIAL_HEADER`, prefix included.
479
+ - `PRIVATE_KEY_JWT`: OAuth 2.0 client credentials with a `private_key_jwt` assertion, the FAPI
480
+ baseline. An assertion signed with `DOWNSTREAM_PRIVATE_KEY` (ES256 or PS256, `iss` and `sub` the
481
+ client id, `aud` the token endpoint or `DOWNSTREAM_TOKEN_AUDIENCE`, a fresh `jti`, sixty
482
+ seconds of life) is posted to `DOWNSTREAM_TOKEN_URL`, a sealed egress destination under the
483
+ downstream's anchor; the access token is held as a secret handle until thirty seconds before it
484
+ expires, with one refresh in flight at a time. A token that cannot be obtained is a failure
485
+ before dispatch, never an unknown outcome.
486
+ - `SIGNED_REQUEST`: an RFC 9421 signature with an RFC 9530 content digest, Ed25519 or HMAC-SHA256
487
+ with `DOWNSTREAM_SIGNING_KEY`. Every request covers the method, the path, the body's digest, the
488
+ idempotency key and the intent hash, so the downstream can prove that this process, holding this
489
+ key, sent this request for this intent. A dispatch also covers `x-agent-safe-grant-id` and
490
+ `x-agent-safe-decision-id`, and, when the authority attested the claim,
491
+ `x-agent-safe-claim-attestation`: the authority's own signed proof that this grant was claimed
492
+ for this intent, which a downstream verifies against the authority's public JWKS. The handler
493
+ must send every covered header with the value it asked the credential to sign; `headersFor`
494
+ returns them beside the signature, and the reference handlers send them.
495
+
496
+ The three are not equally strong, and the choice decides what an agent that reaches the provider
497
+ anyway can do with the path:
498
+
499
+ | Kind | What the downstream is shown | What a captured value is worth |
500
+ | ----------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
501
+ | `STATIC_HEADER` | A bearer | Everything, until it is rotated: whoever holds it is the executor |
502
+ | `PRIVATE_KEY_JWT` | A bearer minted from a key | The access token until `exp`; the key itself stays in the process |
503
+ | `SIGNED_REQUEST` | A per-request signature, and the authority's attestation of the claim | Nothing. It is bound to this method, path, body, idempotency key, intent hash, grant and decision |
504
+
505
+ For anything reaching a system of record, `SIGNED_REQUEST` is the one that keeps the boundary when
506
+ the network does not: a caller with a perfect route and a copied set of headers still cannot
507
+ produce a signature, so the provider can refuse it. With the attestation covered, the provider can
508
+ also refuse an instruction the authority never claimed, not merely one the executor never signed:
509
+ the signature proves that this process sent this request, and the attestation inside it proves
510
+ that the authority claimed this grant for this intent, with a digest of the very parameters the
511
+ provider is looking at. See [bypass resistance](../../docs/bypass-resistance.md).
512
+
513
+ The keys of the kinds not selected must be absent, and each kind names the one secret it needs. A
514
+ downstream verifies a signed request like this:
515
+
516
+ ```text
517
+ params = the text after "agentsafe=" in the signature-input header:
518
+ (components);created=<unix seconds>;keyid="<id>";alg="ed25519"|"hmac-sha256"
519
+ components = the quoted names inside the parentheses, in order. Always:
520
+ "@method" "@path" "content-digest" "idempotency-key" "x-agent-safe-intent-hash"
521
+ On a dispatch, also: "x-agent-safe-grant-id" "x-agent-safe-decision-id"
522
+ When the authority attested the claim, also: "x-agent-safe-claim-attestation"
523
+ base = for each component, in that order, one line:
524
+ '"@method": ' + METHOD
525
+ '"@path": ' + PATH
526
+ '"content-digest": sha-256=:' + base64(sha256(body)) + ':'
527
+ '"<header-name>": ' + that header's value, for every other component
528
+ joined by "\n", then
529
+ + "\n" + '"@signature-params": ' + params
530
+ signature = base64 between the colons after "agentsafe=" in the signature header
531
+ refuse unless the content-digest matches the body you received,
532
+ every component you require is among the covered ones -- a system of
533
+ record that effects anything requires all eight --
534
+ every covered header is present and equals the value in the base,
535
+ created is inside your clock window,
536
+ keyid names a key you issued to the executor,
537
+ and verify(alg, key, base, signature) holds
538
+ then, for anything you will effect, verify the attestation:
539
+ split x-agent-safe-claim-attestation on "." into header, payload, signature
540
+ header.alg is "EdDSA", header.typ is "decionis-claim-attestation+jwt"
541
+ header.kid names a key in the authority's
542
+ GET /.well-known/decionis-execution-grant-jwks.json
543
+ Ed25519-verify(key, header + "." + payload, signature) holds
544
+ payload.sub equals x-agent-safe-grant-id
545
+ payload.decision_id equals x-agent-safe-decision-id
546
+ payload.binding.intent_hash equals x-agent-safe-intent-hash
547
+ payload.binding.execution_payload_digest equals
548
+ "sha256:" + hex(sha256(canonical(body))) under
549
+ payload.binding.execution_payload_canonicalization_profile ("RFC8785/JCS")
550
+ payload.exp has not passed, and payload.sub was not seen within the lease
551
+ ```
552
+
553
+ `SignedRequestCredential.verify` in this package is the first half of that procedure, with
554
+ `materialFrom` building the material from a received request and `require` naming what the
555
+ signature must cover; the offline proof's strict provider double is the whole of it, attestation
556
+ included, written against nothing but the authority's public keys.
557
+
558
+ ## The attempt journal
559
+
560
+ An execution nobody could reconcile afterwards is worse than a refusal. So
561
+ before the executor may run an action, the attempt is on disk:
562
+
563
+ | Record | When | What it carries |
564
+ | ---------------- | ----------------------------------------------------------- | --------------------------------------------------------------------- |
565
+ | `ATTEMPT_OPENED` | After the authority allows, before the executor runs | The identifiers, the caller, and the captured intent verbatim |
566
+ | `GRANT_CLAIMED` | After the grant is consumed, before the provider is touched | The grant, its expiry, and the digest of what is about to be sent |
567
+ | `ATTEMPT_CLOSED` | Once the outcome is known | The outcome, whether it executed, and how the authority was finalized |
568
+ | `RECONCILED` | When a lost outcome is resolved | The status, and whether a restart or the caller resolved it |
569
+
570
+ The claim is the record that must never be lost: it is written by a decorator
571
+ inside the handler, after `SafeExecutor` consumed the grant and before the
572
+ handler's own body. A journal that cannot take it throws there, which is
573
+ still _before_ dispatch, so the registry reports `FAILED_BEFORE_DISPATCH`,
574
+ `SafeExecutor` finalizes the attempt as `FAILED`, and the authority learns
575
+ the attempt failed rather than waiting for a lease to lapse. The decorator is
576
+ applied by the registry the adopter's registration fills, so an ordinary
577
+ handler gets the durable claim without knowing about it.
578
+
579
+ An outcome that is **unknown** is the one thing that must not be closed: the
580
+ attempt stays open, and the next process resolves it. `EXECUTOR_JOURNAL_DIR`
581
+ names the directory; under it, `attempts/` holds append-only JSONL, one file
582
+ per UTC day, each record flushed to the device before the append returns, the
583
+ directory private to the process, a record over 256 KiB refused rather than
584
+ truncated. In enforcement a directory is required unless
585
+ `EXECUTOR_JOURNAL_REQUIRED=false` says otherwise, which production refuses.
586
+
587
+ What the journal holds is the request's own parameters, which the evidence
588
+ streams never carry, so it is as sensitive as the traffic itself and belongs
589
+ on a volume with the same protection. It is per process: a pod that loses its
590
+ volume loses its open attempts, which is why the manifest gives each replica
591
+ its own claim and why the authority's lease recovery remains the backstop.
592
+
593
+ ## Startup reconciliation
594
+
595
+ `listen()` resolves what the last process left behind before this one accepts
596
+ a connection. Each open attempt's stored intent is re-hashed rather than
597
+ trusted, and the provider is asked what it did with that idempotency key
598
+ through the handler's read-only `reconcile`. Nothing is ever re-executed:
599
+ the reconciler calls the registry's read path, never its execute path.
600
+
601
+ | Resolution | What it means |
602
+ | ------------------------- | --------------------------------------------------------------------------------------- |
603
+ | `RECONCILED_COMPLETED` | The provider says it acted; the attempt is closed |
604
+ | `RECONCILED_NOT_EXECUTED` | The provider says it did not; the attempt is closed |
605
+ | `STILL_UNKNOWN` | The provider cannot say; the attempt stays open and the next start asks again |
606
+ | `UNCLAIMED` | No grant was consumed, so the provider was never reached; the authority's lease owns it |
607
+ | `BINDING_MISMATCH` | The stored intent no longer hashes to its record: a tampered journal, asked nothing |
608
+
609
+ `GET /v1/control/open-attempts` lists them, `/ready` reports how many are
610
+ unknown, and `EXECUTOR_READY_REQUIRES_NO_UNKNOWN_ATTEMPTS=true` keeps the
611
+ process out of a load balancer until none are.
612
+
613
+ ## The halt
614
+
615
+ The stop is deliberately easy to reach and deliberately hard to leave. An
616
+ operator halts with a reason; a file halts by existing; and a posture drift,
617
+ a spike of refusals at the door, a spike of refused outbound requests, or a
618
+ clock that cannot be trusted halt on their own.
619
+
620
+ While halted, a proposal or a resumption is refused with `503` in the same
621
+ shape the caller already parses (`verdict: BLOCK`, `outcome: BLOCKED`,
622
+ `fail_closed: true`, `reason_codes: ["EXECUTOR_HALTED"]`) and a `Retry-After`
623
+ of thirty seconds. The refusal is recorded through the audit recorder as
624
+ `EXECUTION_BLOCKED`, so a halt is evidence and not just an absence. Nothing
625
+ is asked of the authority, so a halted executor costs no dossier and no
626
+ grant. What is already in flight finishes and is journaled, because
627
+ abandoning a dispatch is how an outcome becomes unknown. `/ready` answers
628
+ `503`; `/health` stays `200`, so a halt never becomes a restart loop.
629
+
630
+ Resuming is an operator's act with a reason, refused with
631
+ `409 HALT_CAUSE_PERSISTS` while the halt file is still there or a posture
632
+ drift still stands. A process that starts with the halt file present starts
633
+ halted. A spike threshold is reachable from the agent zone by design: a
634
+ compromised caller that floods the door stops the executor rather than being
635
+ ignored, which is the fail-closed choice, and the thresholds are
636
+ configurable for institutions that would rather not.
637
+
638
+ ## Host ceilings
639
+
640
+ `EXECUTOR_HARD_LIMIT_SINGLE_MINOR` is the most one action may move, per ISO
641
+ 4217 code, in minor units, and the window settings bound how many actions and
642
+ how much value pass in a period. They only ever refuse: a policy that would
643
+ allow more is still bounded here, and a ceiling can never widen what the
644
+ authority narrowed.
645
+
646
+ The check runs before the authority is asked, so nothing this host would
647
+ refuse costs a dossier or a grant, and the commit runs after an `ALLOW` and
648
+ before the executor runs, so a refusal consumes no grant and two requests
649
+ cannot cross the window by racing. A refusal is `422` with its own code
650
+ (`HARD_LIMIT_EXCEEDED`, `HARD_LIMIT_CURRENCY_UNKNOWN`,
651
+ `HARD_LIMIT_AMOUNT_INVALID`, `HARD_LIMIT_WINDOW_COUNT_EXCEEDED`,
652
+ `HARD_LIMIT_WINDOW_SUM_EXCEEDED`), recorded as evidence and counted.
653
+
654
+ The amount is read from the intent's own parameters: an integer
655
+ `amountMinor` and a three-letter `currency`. An action carrying neither is
656
+ not a payment and is bounded by the count window alone; one carrying half of
657
+ a value is refused rather than guessed at; a currency the configuration never
658
+ named is refused. A banking adapter family will carry its own projection
659
+ later; this is the generic one.
660
+
661
+ The window is process memory. A restart forgets it and two replicas each keep
662
+ their own, which is stated plainly because it is why these are a backstop
663
+ against a policy mistake, not a treasury control.
664
+
665
+ ## Clocks
666
+
667
+ A boundary that binds short-lived grants cannot afford to disagree with the
668
+ party issuing them: a host running behind would accept a grant the authority
669
+ considers expired, and one running ahead would refuse grants that are still
670
+ good. So every answer from the authority is measured against this host's
671
+ clock, the skew is recorded, and past `EXECUTOR_MAX_CLOCK_SKEW_MS` the
672
+ executor halts rather than guess which clock is right. The skew is measured,
673
+ never corrected, and the round trip's own latency is inside the measurement,
674
+ which is why the bound is seconds rather than milliseconds.
675
+
676
+ Dispatch deadlines are monotonic and bounded by the authorization: a provider
677
+ is never given more time than the grant has left, and correcting the wall
678
+ clock cannot extend a call already in flight.
679
+
680
+ ## Egress
681
+
682
+ Every connection this process opens, to the authority, to the Presence service when it holds
683
+ that credential, to the downstream and its lookup, goes through one guarded fetch. Its policy is
684
+ sealed from the configuration: the origin and path prefix of each address the configuration
685
+ names, and nothing else, each with the trust anchor declared for it (`DECIONIS_CA_FILE`,
686
+ `PRESENCE_CA_FILE`, `DOWNSTREAM_CA_FILE`, or the platform's store when none is) and, for the
687
+ authority and the downstream, optional SPKI pins that any certificate in the chain may satisfy. A
688
+ request to any other origin, to a path outside the prefix, over plain HTTP anywhere but loopback,
689
+ or with credentials in the URL is refused before a socket exists. A name is resolved once and
690
+ refused if it answers with this host, the link-local range, multicast, or nowhere; private ranges
691
+ are allowed, because that is where an institution's systems live. TLS is 1.2 or later against the
692
+ destination's anchor, with hostname verification and the pins; a redirect is never followed, and
693
+ one that leaves the origin is reported; the body is read whole under
694
+ `EXECUTOR_EGRESS_MAX_RESPONSE_BYTES` and returned as a standard `Response`, which is what the gate,
695
+ the verifier, the Presence transport and the handlers take from a fetch. Every refusal is
696
+ `EGRESS_REFUSED` on the security stream with the origin and a code, `EGRESS_ORIGIN_NOT_ALLOWED`,
697
+ `EGRESS_SCHEME_NOT_ALLOWED`, `EGRESS_PATH_NOT_ALLOWED`, `EGRESS_ADDRESS_REFUSED`,
698
+ `EGRESS_TLS_REJECTED`, `EGRESS_TLS_PIN_MISMATCH`, `EGRESS_BODY_TOO_LARGE`, `EGRESS_TIMEOUT`,
699
+ `EGRESS_REDIRECT_REFUSED`, `EGRESS_RESPONSE_INVALID` or `EGRESS_INIT_UNSUPPORTED`, and is counted.
700
+
701
+ Three layers hold this: the wiring, which hands the guarded fetch to every component and to the
702
+ handler seam; the global `fetch`, which `serve` replaces at start with one that refuses and makes
703
+ unassignable, and whose absence is the posture check `GLOBAL_FETCH_UNLOCKED`; and a lint rule in
704
+ the repository that confines socket modules to the two directories that may open one, which is a
705
+ review control and said so. None of them binds the agent: the network policy in the deployment kit
706
+ is what keeps the agent from the downstream.
707
+
708
+ ## Host posture
709
+
710
+ A process cannot create its own isolation. What it can do is verify the posture it is able to
711
+ observe and refuse to run without it, so that a deployment which skipped a control finds out at
712
+ start rather than at an incident. Under `EXECUTOR_POSTURE=ENFORCED`, the default, every check
713
+ below must hold or the process exits with `REFUSED_TO_START` naming the check; a subset is
714
+ repeated every `EXECUTOR_POSTURE_INTERVAL_SECONDS`, and a regression while running is
715
+ `POSTURE_DRIFT`, during which new enforcement work is refused with `503 POSTURE_DEGRADED` until the
716
+ host recovers (`POSTURE_RESTORED`).
717
+
718
+ | Check | What refuses |
719
+ | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
720
+ | `ROOT_UID` | The effective user is root |
721
+ | `ROOT_WRITABLE`, `CWD_WRITABLE` | The root filesystem or the working directory is writable |
722
+ | `SA_TOKEN_PRESENT` | A Kubernetes service-account token is mounted |
723
+ | `NODE_ENV` | `NODE_ENV` is not `production` |
724
+ | `PROXY_ENV` | Any `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, `NO_PROXY` or `NODE_USE_ENV_PROXY` is set |
725
+ | `NODE_OPTIONS`, `EXTRA_CA`, `KEYLOG` | `NODE_OPTIONS`, `NODE_EXTRA_CA_CERTS` or `SSLKEYLOGFILE` is set |
726
+ | `TLS_REJECT_DISABLED` | `NODE_TLS_REJECT_UNAUTHORIZED=0` |
727
+ | `INSPECTOR_ACTIVE` | The inspector is listening |
728
+ | `SECRET_IN_ENV` | A secret was given as a variable in production |
729
+ | `SECRET_FILE_OUTSIDE_DIR`, `SECRET_FILE_MODE`, `SECRET_FILE_OWNER` | A secret file resolves outside `EXECUTOR_SECRETS_DIR`, or another user could read it |
730
+ | `PERMISSION_MODEL_ABSENT`, `PERMISSION_FS_WRITE`, `PERMISSION_CHILD_PROCESS`, `PERMISSION_WORKER` | Node's permission model is off, or allows writes outside the journal directory, child processes, or workers |
731
+ | `GLOBAL_FETCH_UNLOCKED` | The global `fetch` is not the refusing stub `serve` installs, so code could reach the network around the guard |
732
+ | `PRINCIPALS_FILE_MODE`, `PRINCIPALS_FILE_OWNER` | The principals file is not a regular file another user could not write, or is owned by someone else |
733
+
734
+ `EXECUTOR_POSTURE=DEVELOPMENT`, for a developer's machine and the offline proof, waives the
735
+ host-specific checks, the fetch lock among them because a test process is its own client, and
736
+ records each waiver as `POSTURE_WAIVED` on the security stream. It never waives `ROOT_UID`,
737
+ `SA_TOKEN_PRESENT`, or `TLS_REJECT_DISABLED`, and it is refused under `NODE_ENV=production`. The checks say what the process can see; the container runtime, Pod
738
+ Security Admission, and the network policy in the
739
+ [deployment kit](https://github.com/decionis/agent-safe-pipeline/blob/master/deploy/README.md)
740
+ are what make the posture true.
741
+
742
+ ## Evidence and metrics
743
+
744
+ The process writes two chained streams: the evidence stream on standard output,
745
+ `agent-safe.executor-evidence/1`, one line per lifecycle event with the pipeline's identifiers,
746
+ digests, verdict and reason codes plus the authenticated caller; and the security stream on
747
+ standard error, `agent-safe.security/1`, one line per thing that happened to the process. Every
748
+ line carries `seq`, `prev_hash` and `hash`, so a line altered, removed or reordered after the fact
749
+ is detectable by anyone holding the lines. `agentsafe verify-chain <file>` walks a log and exits
750
+ non-zero on any break; `verifyAuditChain(lines)` is the same walk as a function. With
751
+ `EXECUTOR_JOURNAL_DIR` set, the chain heads persist under it and a restart continues the sequence,
752
+ recording `CHAIN_RESUMED`; a crash between two checkpoints leaves a visible sequence gap rather
753
+ than a seamless chain. The envelope, the verifier's findings, and what the chain does not prove
754
+ are in
755
+ [docs/executor-evidence.md](https://github.com/decionis/agent-safe-pipeline/blob/master/docs/executor-evidence.md).
756
+
757
+ Counters with fixed label names count proposals by verdict, executions by outcome, refusals at
758
+ the door by method, egress refusals by code, secret rotations by name, posture drift by check,
759
+ redactions, TLS context rotations, chained lines by stream, principals locked, and operator
760
+ actions by action. They are rendered as OpenMetrics
761
+ text through `executor.metrics.registry.render()` and on `GET /metrics` to an operator with the
762
+ `metrics` scope; a proposer is not the party that should read them, and every operator action is
763
+ recorded as `OPERATOR_ACTION` with the principal and the action.
764
+
765
+ ## Incident response
766
+
767
+ Three things are for the moment something has gone wrong.
768
+
769
+ **The stop**, which is above. Reach for it early: work in flight finishes and is journaled, so a
770
+ halt costs the proposals that have not started and nothing else.
771
+
772
+ **A bundle**, taken from a running process by an operator holding the `evidence` scope:
773
+
774
+ ```bash
775
+ curl -sS -X POST https://executor.example:8443/v1/control/evidence-export -H 'content-type: application/json' -d '{"reason":"on-call took a bundle"}'
776
+ ```
777
+
778
+ It writes five files into a directory under `EXECUTOR_EVIDENCE_DIR`, named by the instant so two
779
+ exports during one incident do not overwrite each other: both chained streams as this process
780
+ still held them, the open attempts, the posture by check, and a manifest that digests every one of
781
+ them. The manifest also carries the chain heads, a digest of the non-secret configuration, the
782
+ image digest as the platform reported it (marked not self-verified, because a process cannot read
783
+ the digest of its own image), and every secret's name with a rotation count.
784
+
785
+ What is not in it: any secret, any digest of a secret (a low-entropy credential's digest is a
786
+ guessable oracle), any request parameter, and any provider body. The attempt journal holds
787
+ parameters, so a bundle names attempts by identifier and state and never copies the journal. Take
788
+ that from the volume, under the same handling as the traffic, and only when you need it.
789
+
790
+ **A verifier** that needs nothing from the executor:
791
+
792
+ ```bash
793
+ agentsafe verify-bundle ./2026-03-02T10-00-00-000Z
794
+ ```
795
+
796
+ It recomputes every file's digest against the manifest, walks both chains, and checks that each
797
+ stream's last line is the head the manifest claims. Then it says which of two things it
798
+ established:
799
+
800
+ | It reports | What that means |
801
+ | ------------------------ | ----------------------------------------------------------------------------------- |
802
+ | `INTERNAL_CONSISTENCY` | The bundle is the bundle that was made. Nothing here establishes **who** made it |
803
+ | `ORIGIN_AND_CONSISTENCY` | A signature over the manifest verified against a public key **the reader** supplied |
804
+
805
+ The reader's key comes from `AGENTSAFE_EVIDENCE_PUBLIC_KEY`, never from the bundle: a signature
806
+ verified with a key the bundle carried would prove nothing, so the verifier will not do it. Set
807
+ `EXECUTOR_EVIDENCE_SIGNING_KEY_FILE` before an incident if you want the second row; afterwards is
808
+ too late.
809
+
810
+ The six playbooks, per incident class, are in
811
+ [incident response](https://github.com/decionis/agent-safe-pipeline/blob/master/docs/incident-response.md),
812
+ with command-bearing copies under
813
+ [`deploy/incident/`](https://github.com/decionis/agent-safe-pipeline/blob/master/deploy/incident)
814
+ and alerting rules as data, applied by nothing, in
815
+ [`deploy/alerts/TrustedExecutor.yaml`](https://github.com/decionis/agent-safe-pipeline/blob/master/deploy/alerts/TrustedExecutor.yaml).
816
+
817
+ ## The seam
818
+
819
+ A `HandlerRegistration` receives the registry, the downstream configuration, the credential that
820
+ proves this process to the downstream, the fetch it may use, the register where a handler that
821
+ observes an effect records what it saw, and the family's own settings, registers what this process
822
+ can run, and returns the action names in the order `/ready` reports them. The registry is sealed the
823
+ moment it returns. Keep the shape: a strict parameter schema, the side effect inside
824
+ `dispatch.run` so a transport failure after the point of no return is reported as unknown rather
825
+ than retried, and a `reconcile` that only reads. The credential is resolved on this side of the
826
+ boundary at the moment of dispatch and handed to the handler as headers; the agent never sees it
827
+ and cannot name it.
828
+
829
+ ## Adapters
830
+
831
+ An adapter is how a family of consequential actions reaches a provider, and it is deliberately
832
+ four small methods, three of them pure:
833
+
834
+ | Method | What it does |
835
+ | --------------- | --------------------------------------------------------------------------------- |
836
+ | `prepare` | Works out what the action asks for and what its effect should be. Reaches nothing |
837
+ | `execute` | Performs the side effect, once, inside the dispatch the pipeline opened |
838
+ | `observeEffect` | Reads what the provider said into the family's projection. Pure |
839
+ | `reconcile` | Asks the provider what it did with an idempotency key. Read-only, always |
840
+
841
+ `adapterActionHandler` bridges any adapter to the pipeline's `ActionHandler`: prepare, then the
842
+ side effect inside `dispatch.run` bounded by the smaller of the timeout and what is left of the
843
+ grant, then the observation, then the comparison field by field against what was authorised, then
844
+ the record, registered against that exact authorization for the verifier to finalize with. A
845
+ provider that neither committed nor refused throws, so the outcome is reported as unknown rather
846
+ than guessed. `SafeExecutor` and the pipeline's registry are untouched.
847
+
848
+ A second family is a new directory beside `banking/`, not a rewrite: the handler bridge, the
849
+ comparison, the evidence and the verifier all work off the adapter contract alone.
850
+
851
+ ### The banking family
852
+
853
+ `bankingHandlers()` registers every action type this build mirrors from the BEAP v0.1 profile,
854
+ each bridged to the same adapter over the configured downstream. An action arrives as the
855
+ canonical `BankingAction` in the proposal's parameters, and the executor derives the transport's
856
+ action name and target from it rather than trusting them; a disagreement is a refusal before the
857
+ authority is asked. The amount is read as a `bigint` of minor units at the currency's own ISO 4217
858
+ scale, and an `iban:` reference is check-digit validated.
859
+
860
+ The reference transport maps the provider's answer without inferring anything:
861
+
862
+ | The provider says | This boundary reports |
863
+ | ----------------------------------------- | ------------------------------------------- |
864
+ | 2xx, a status meaning it took the request | Committed, acknowledged, not yet confirmed |
865
+ | 2xx, a status meaning it posted | Committed, then read back before confirming |
866
+ | a deterministic refusal with a body | Failed; nothing was effected |
867
+ | anything else: no body, a timeout, a 5xx | Indeterminate, and reconciliation owns it |
868
+
869
+ An adopter with their own core replaces the transport and keeps everything else, because the
870
+ profile's arithmetic, the projection, the comparison and the evidence belong to the adapter rather
871
+ than the transport. What the executor implements of the profile, and what it does not claim, is in
872
+ [BEAP conformance](https://github.com/decionis/agent-safe-pipeline/blob/master/docs/beap-conformance.md);
873
+ the confirmation states and the mismatch behaviour are in
874
+ [execution outcomes](https://github.com/decionis/agent-safe-pipeline/blob/master/docs/execution-outcomes.md).
875
+
876
+ ## The image
877
+
878
+ ```bash
879
+ docker build -f packages/agentsafe/Dockerfile -t agentsafe .
880
+ ```
881
+
882
+ Built from the repository root. The runtime is distroless: no shell, no package manager, the
883
+ `nonroot` user, `NODE_ENV=production` baked in, and node started under its permission model,
884
+ allowed to read the application and the mounts under `/var/run/agent-safe`, to read and write
885
+ `/var/lib/agent-safe` (the evidence chains' journal, which it writes and reads back after a
886
+ restart), and to spawn nothing. The image holds no configuration and starts
887
+ `agentsafe serve` with the reference forwarding handler. The
888
+ [deployment kit](https://github.com/decionis/agent-safe-pipeline/blob/master/deploy/README.md) has
889
+ the manifests that supply the configuration, the posture and the two zones' network policies, the
890
+ runbook from shadow to enforcement, and how to take the image the release workflow publishes and verify it instead of
891
+ building your own.
892
+
893
+ ## What a green run is not
894
+
895
+ The proof in the repository runs this package against a loopback authority and a loopback provider
896
+ with synthetic policy. It shows the boundary holding in this process on this commit; it is not
897
+ evidence that a hosted integration exists, that any provider behaves this way, or that a deployment
898
+ has the isolation the threat model asks the host for.
899
+
900
+ ## Support and license
901
+
902
+ Report suspected vulnerabilities through
903
+ [GitHub's private advisory form](https://github.com/decionis/agent-safe-pipeline/security/advisories/new),
904
+ not a public issue; the response targets are in
905
+ [SECURITY.md](https://github.com/decionis/agent-safe-pipeline/blob/master/SECURITY.md). Questions
906
+ and defects go to the
907
+ [issue tracker](https://github.com/decionis/agent-safe-pipeline/issues). Apache-2.0; see
908
+ [LICENSE](https://github.com/decionis/agent-safe-pipeline/blob/master/LICENSE) and
909
+ [NOTICE](https://github.com/decionis/agent-safe-pipeline/blob/master/NOTICE).