@usesigil/kit 0.16.0 → 0.18.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 (633) hide show
  1. package/README.md +56 -0
  2. package/dist/advanced-analytics.d.ts +3 -2
  3. package/dist/advanced-analytics.d.ts.map +1 -1
  4. package/dist/advanced-analytics.js +9 -42
  5. package/dist/advanced-analytics.js.map +1 -1
  6. package/dist/agent-bootstrap.d.ts +1 -2
  7. package/dist/agent-bootstrap.d.ts.map +1 -1
  8. package/dist/agent-bootstrap.js.map +1 -1
  9. package/dist/agent-errors.d.ts +20 -4
  10. package/dist/agent-errors.d.ts.map +1 -1
  11. package/dist/agent-errors.js +864 -367
  12. package/dist/agent-errors.js.map +1 -1
  13. package/dist/audit-log.d.ts +101 -0
  14. package/dist/audit-log.d.ts.map +1 -0
  15. package/dist/audit-log.js +145 -0
  16. package/dist/audit-log.js.map +1 -0
  17. package/dist/caip2-network.d.ts +171 -0
  18. package/dist/caip2-network.d.ts.map +1 -0
  19. package/dist/caip2-network.js +202 -0
  20. package/dist/caip2-network.js.map +1 -0
  21. package/dist/canonical-encode.d.ts +59 -0
  22. package/dist/canonical-encode.d.ts.map +1 -0
  23. package/dist/canonical-encode.js +141 -0
  24. package/dist/canonical-encode.js.map +1 -0
  25. package/dist/cosign-helper.d.ts +264 -0
  26. package/dist/cosign-helper.d.ts.map +1 -0
  27. package/dist/cosign-helper.js +147 -0
  28. package/dist/cosign-helper.js.map +1 -0
  29. package/dist/create-vault.d.ts +92 -0
  30. package/dist/create-vault.d.ts.map +1 -1
  31. package/dist/create-vault.js +108 -7
  32. package/dist/create-vault.js.map +1 -1
  33. package/dist/dashboard/close-vault.d.ts +110 -0
  34. package/dist/dashboard/close-vault.d.ts.map +1 -0
  35. package/dist/dashboard/close-vault.js +165 -0
  36. package/dist/dashboard/close-vault.js.map +1 -0
  37. package/dist/dashboard/errors.d.ts +2 -2
  38. package/dist/dashboard/errors.d.ts.map +1 -1
  39. package/dist/dashboard/errors.js +11 -7
  40. package/dist/dashboard/errors.js.map +1 -1
  41. package/dist/dashboard/index.d.ts +190 -34
  42. package/dist/dashboard/index.d.ts.map +1 -1
  43. package/dist/dashboard/index.js +282 -52
  44. package/dist/dashboard/index.js.map +1 -1
  45. package/dist/dashboard/mutations.d.ts +153 -24
  46. package/dist/dashboard/mutations.d.ts.map +1 -1
  47. package/dist/dashboard/mutations.js +680 -114
  48. package/dist/dashboard/mutations.js.map +1 -1
  49. package/dist/dashboard/post-assertion-validation.d.ts +1 -1
  50. package/dist/dashboard/post-assertion-validation.d.ts.map +1 -1
  51. package/dist/dashboard/post-assertion-validation.js +169 -48
  52. package/dist/dashboard/post-assertion-validation.js.map +1 -1
  53. package/dist/dashboard/reads.d.ts +3 -4
  54. package/dist/dashboard/reads.d.ts.map +1 -1
  55. package/dist/dashboard/reads.js +11 -22
  56. package/dist/dashboard/reads.js.map +1 -1
  57. package/dist/dashboard/types.d.ts +56 -19
  58. package/dist/dashboard/types.d.ts.map +1 -1
  59. package/dist/errors/agent-errors.generated.d.ts +21 -0
  60. package/dist/errors/agent-errors.generated.d.ts.map +1 -0
  61. package/dist/errors/agent-errors.generated.js +134 -0
  62. package/dist/errors/agent-errors.generated.js.map +1 -0
  63. package/dist/errors/codes.d.ts +21 -2
  64. package/dist/errors/codes.d.ts.map +1 -1
  65. package/dist/errors/codes.js +19 -0
  66. package/dist/errors/codes.js.map +1 -1
  67. package/dist/errors/context.d.ts +9 -1
  68. package/dist/errors/context.d.ts.map +1 -1
  69. package/dist/event-analytics.d.ts +1 -3
  70. package/dist/event-analytics.d.ts.map +1 -1
  71. package/dist/event-analytics.js +28 -81
  72. package/dist/event-analytics.js.map +1 -1
  73. package/dist/events.d.ts.map +1 -1
  74. package/dist/events.js +23 -14
  75. package/dist/events.js.map +1 -1
  76. package/dist/generated/accounts/agentSpendOverlay.d.ts +60 -0
  77. package/dist/generated/accounts/agentSpendOverlay.d.ts.map +1 -1
  78. package/dist/generated/accounts/agentSpendOverlay.js +6 -2
  79. package/dist/generated/accounts/agentSpendOverlay.js.map +1 -1
  80. package/dist/generated/accounts/agentVault.d.ts +168 -4
  81. package/dist/generated/accounts/agentVault.d.ts.map +1 -1
  82. package/dist/generated/accounts/agentVault.js +11 -3
  83. package/dist/generated/accounts/agentVault.js.map +1 -1
  84. package/dist/generated/accounts/auditLogRejected.d.ts +66 -0
  85. package/dist/generated/accounts/auditLogRejected.d.ts.map +1 -0
  86. package/dist/generated/accounts/auditLogRejected.js +68 -0
  87. package/dist/generated/accounts/auditLogRejected.js.map +1 -0
  88. package/dist/generated/accounts/auditLogSuccess.d.ts +78 -0
  89. package/dist/generated/accounts/auditLogSuccess.d.ts.map +1 -0
  90. package/dist/generated/accounts/auditLogSuccess.js +68 -0
  91. package/dist/generated/accounts/auditLogSuccess.js.map +1 -0
  92. package/dist/generated/accounts/index.d.ts +4 -4
  93. package/dist/generated/accounts/index.d.ts.map +1 -1
  94. package/dist/generated/accounts/index.js +4 -4
  95. package/dist/generated/accounts/index.js.map +1 -1
  96. package/dist/generated/accounts/pendingAgentGrant.d.ts +199 -0
  97. package/dist/generated/accounts/pendingAgentGrant.d.ts.map +1 -0
  98. package/dist/generated/accounts/pendingAgentGrant.js +75 -0
  99. package/dist/generated/accounts/pendingAgentGrant.js.map +1 -0
  100. package/dist/generated/accounts/pendingAgentPermissionsUpdate.d.ts +64 -0
  101. package/dist/generated/accounts/pendingAgentPermissionsUpdate.d.ts.map +1 -1
  102. package/dist/generated/accounts/pendingAgentPermissionsUpdate.js +7 -1
  103. package/dist/generated/accounts/pendingAgentPermissionsUpdate.js.map +1 -1
  104. package/dist/generated/accounts/pendingOwnershipTransfer.d.ts +131 -0
  105. package/dist/generated/accounts/pendingOwnershipTransfer.d.ts.map +1 -0
  106. package/dist/generated/accounts/pendingOwnershipTransfer.js +76 -0
  107. package/dist/generated/accounts/pendingOwnershipTransfer.js.map +1 -0
  108. package/dist/generated/accounts/pendingPolicyUpdate.d.ts +200 -4
  109. package/dist/generated/accounts/pendingPolicyUpdate.d.ts.map +1 -1
  110. package/dist/generated/accounts/pendingPolicyUpdate.js +19 -1
  111. package/dist/generated/accounts/pendingPolicyUpdate.js.map +1 -1
  112. package/dist/generated/accounts/policyConfig.d.ts +479 -36
  113. package/dist/generated/accounts/policyConfig.d.ts.map +1 -1
  114. package/dist/generated/accounts/policyConfig.js +30 -3
  115. package/dist/generated/accounts/policyConfig.js.map +1 -1
  116. package/dist/generated/accounts/postExecutionAssertions.d.ts +2 -2
  117. package/dist/generated/accounts/postExecutionAssertions.d.ts.map +1 -1
  118. package/dist/generated/accounts/postExecutionAssertions.js +3 -3
  119. package/dist/generated/accounts/sessionAuthority.d.ts +140 -12
  120. package/dist/generated/accounts/sessionAuthority.d.ts.map +1 -1
  121. package/dist/generated/accounts/sessionAuthority.js +9 -7
  122. package/dist/generated/accounts/sessionAuthority.js.map +1 -1
  123. package/dist/generated/accounts/spendTracker.d.ts +83 -3
  124. package/dist/generated/accounts/spendTracker.d.ts.map +1 -1
  125. package/dist/generated/accounts/spendTracker.js +14 -2
  126. package/dist/generated/accounts/spendTracker.js.map +1 -1
  127. package/dist/generated/errors/sigil.d.ts +131 -83
  128. package/dist/generated/errors/sigil.d.ts.map +1 -1
  129. package/dist/generated/errors/sigil.js +178 -106
  130. package/dist/generated/errors/sigil.js.map +1 -1
  131. package/dist/generated/event-discriminators.d.ts.map +1 -1
  132. package/dist/generated/event-discriminators.js +11 -14
  133. package/dist/generated/event-discriminators.js.map +1 -1
  134. package/dist/generated/instructions/acceptOwnershipTransfer.d.ts +142 -0
  135. package/dist/generated/instructions/acceptOwnershipTransfer.d.ts.map +1 -0
  136. package/dist/generated/instructions/acceptOwnershipTransfer.js +171 -0
  137. package/dist/generated/instructions/acceptOwnershipTransfer.js.map +1 -0
  138. package/dist/generated/instructions/acceptOwnershipTransferMultisig.d.ts +85 -0
  139. package/dist/generated/instructions/acceptOwnershipTransferMultisig.d.ts.map +1 -0
  140. package/dist/generated/instructions/acceptOwnershipTransferMultisig.js +171 -0
  141. package/dist/generated/instructions/acceptOwnershipTransferMultisig.js.map +1 -0
  142. package/dist/generated/instructions/applyAgentGrant.d.ts +100 -0
  143. package/dist/generated/instructions/applyAgentGrant.d.ts.map +1 -0
  144. package/dist/generated/instructions/{applyConstraintsUpdate.js → applyAgentGrant.js} +66 -42
  145. package/dist/generated/instructions/applyAgentGrant.js.map +1 -0
  146. package/dist/generated/instructions/applyAgentPermissionsUpdate.d.ts +31 -8
  147. package/dist/generated/instructions/applyAgentPermissionsUpdate.d.ts.map +1 -1
  148. package/dist/generated/instructions/applyAgentPermissionsUpdate.js +38 -2
  149. package/dist/generated/instructions/applyAgentPermissionsUpdate.js.map +1 -1
  150. package/dist/generated/instructions/applyPendingPolicy.d.ts +18 -7
  151. package/dist/generated/instructions/applyPendingPolicy.d.ts.map +1 -1
  152. package/dist/generated/instructions/applyPendingPolicy.js +38 -2
  153. package/dist/generated/instructions/applyPendingPolicy.js.map +1 -1
  154. package/dist/generated/instructions/cancelAgentGrant.d.ts +106 -0
  155. package/dist/generated/instructions/cancelAgentGrant.d.ts.map +1 -0
  156. package/dist/generated/instructions/{allocatePendingConstraintsPda.js → cancelAgentGrant.js} +54 -42
  157. package/dist/generated/instructions/cancelAgentGrant.js.map +1 -0
  158. package/dist/generated/instructions/cancelOwnershipTransfer.d.ts +121 -0
  159. package/dist/generated/instructions/cancelOwnershipTransfer.d.ts.map +1 -0
  160. package/dist/generated/instructions/{queueCloseConstraints.js → cancelOwnershipTransfer.js} +58 -44
  161. package/dist/generated/instructions/cancelOwnershipTransfer.js.map +1 -0
  162. package/dist/generated/instructions/closePostAssertions.d.ts +6 -1
  163. package/dist/generated/instructions/closePostAssertions.d.ts.map +1 -1
  164. package/dist/generated/instructions/closePostAssertions.js +11 -3
  165. package/dist/generated/instructions/closePostAssertions.js.map +1 -1
  166. package/dist/generated/instructions/closeVault.d.ts +40 -8
  167. package/dist/generated/instructions/closeVault.d.ts.map +1 -1
  168. package/dist/generated/instructions/closeVault.js +40 -2
  169. package/dist/generated/instructions/closeVault.js.map +1 -1
  170. package/dist/generated/instructions/createPostAssertions.d.ts +4 -0
  171. package/dist/generated/instructions/createPostAssertions.d.ts.map +1 -1
  172. package/dist/generated/instructions/createPostAssertions.js +2 -0
  173. package/dist/generated/instructions/createPostAssertions.js.map +1 -1
  174. package/dist/generated/instructions/depositFunds.d.ts +21 -10
  175. package/dist/generated/instructions/depositFunds.d.ts.map +1 -1
  176. package/dist/generated/instructions/depositFunds.js +37 -2
  177. package/dist/generated/instructions/depositFunds.js.map +1 -1
  178. package/dist/generated/instructions/finalizeSession.d.ts +49 -7
  179. package/dist/generated/instructions/finalizeSession.d.ts.map +1 -1
  180. package/dist/generated/instructions/finalizeSession.js +59 -2
  181. package/dist/generated/instructions/finalizeSession.js.map +1 -1
  182. package/dist/generated/instructions/freezeVault.d.ts +36 -5
  183. package/dist/generated/instructions/freezeVault.d.ts.map +1 -1
  184. package/dist/generated/instructions/freezeVault.js +65 -4
  185. package/dist/generated/instructions/freezeVault.js.map +1 -1
  186. package/dist/generated/instructions/index.d.ts +10 -15
  187. package/dist/generated/instructions/index.d.ts.map +1 -1
  188. package/dist/generated/instructions/index.js +10 -15
  189. package/dist/generated/instructions/index.js.map +1 -1
  190. package/dist/generated/instructions/initializeVault.d.ts +79 -9
  191. package/dist/generated/instructions/initializeVault.d.ts.map +1 -1
  192. package/dist/generated/instructions/initializeVault.js +57 -3
  193. package/dist/generated/instructions/initializeVault.js.map +1 -1
  194. package/dist/generated/instructions/initiateOwnershipTransfer.d.ts +106 -0
  195. package/dist/generated/instructions/initiateOwnershipTransfer.d.ts.map +1 -0
  196. package/dist/generated/instructions/initiateOwnershipTransfer.js +181 -0
  197. package/dist/generated/instructions/initiateOwnershipTransfer.js.map +1 -0
  198. package/dist/generated/instructions/pauseAgent.d.ts +49 -5
  199. package/dist/generated/instructions/pauseAgent.d.ts.map +1 -1
  200. package/dist/generated/instructions/pauseAgent.js +80 -5
  201. package/dist/generated/instructions/pauseAgent.js.map +1 -1
  202. package/dist/generated/instructions/promoteGraylistDestination.d.ts +56 -0
  203. package/dist/generated/instructions/promoteGraylistDestination.d.ts.map +1 -0
  204. package/dist/generated/instructions/{createInstructionConstraints.js → promoteGraylistDestination.js} +23 -40
  205. package/dist/generated/instructions/promoteGraylistDestination.js.map +1 -0
  206. package/dist/generated/instructions/queueAgentGrant.d.ts +113 -0
  207. package/dist/generated/instructions/queueAgentGrant.d.ts.map +1 -0
  208. package/dist/generated/instructions/queueAgentGrant.js +181 -0
  209. package/dist/generated/instructions/queueAgentGrant.js.map +1 -0
  210. package/dist/generated/instructions/queueAgentPermissionsUpdate.d.ts +8 -0
  211. package/dist/generated/instructions/queueAgentPermissionsUpdate.d.ts.map +1 -1
  212. package/dist/generated/instructions/queueAgentPermissionsUpdate.js +4 -0
  213. package/dist/generated/instructions/queueAgentPermissionsUpdate.js.map +1 -1
  214. package/dist/generated/instructions/queuePolicyUpdate.d.ts +32 -0
  215. package/dist/generated/instructions/queuePolicyUpdate.d.ts.map +1 -1
  216. package/dist/generated/instructions/queuePolicyUpdate.js +17 -1
  217. package/dist/generated/instructions/queuePolicyUpdate.js.map +1 -1
  218. package/dist/generated/instructions/reactivateVault.d.ts +71 -5
  219. package/dist/generated/instructions/reactivateVault.d.ts.map +1 -1
  220. package/dist/generated/instructions/reactivateVault.js +80 -5
  221. package/dist/generated/instructions/reactivateVault.js.map +1 -1
  222. package/dist/generated/instructions/recordAgentViolation.d.ts +89 -0
  223. package/dist/generated/instructions/recordAgentViolation.d.ts.map +1 -0
  224. package/dist/generated/instructions/recordAgentViolation.js +152 -0
  225. package/dist/generated/instructions/recordAgentViolation.js.map +1 -0
  226. package/dist/generated/instructions/registerAgent.d.ts +84 -6
  227. package/dist/generated/instructions/registerAgent.d.ts.map +1 -1
  228. package/dist/generated/instructions/registerAgent.js +81 -4
  229. package/dist/generated/instructions/registerAgent.js.map +1 -1
  230. package/dist/generated/instructions/revokeAgent.d.ts +49 -6
  231. package/dist/generated/instructions/revokeAgent.d.ts.map +1 -1
  232. package/dist/generated/instructions/revokeAgent.js +81 -4
  233. package/dist/generated/instructions/revokeAgent.js.map +1 -1
  234. package/dist/generated/instructions/setObserveOnly.d.ts +56 -0
  235. package/dist/generated/instructions/setObserveOnly.d.ts.map +1 -0
  236. package/dist/generated/instructions/setObserveOnly.js +111 -0
  237. package/dist/generated/instructions/setObserveOnly.js.map +1 -0
  238. package/dist/generated/instructions/unpauseAgent.d.ts +46 -5
  239. package/dist/generated/instructions/unpauseAgent.d.ts.map +1 -1
  240. package/dist/generated/instructions/unpauseAgent.js +80 -5
  241. package/dist/generated/instructions/unpauseAgent.js.map +1 -1
  242. package/dist/generated/instructions/validateAndAuthorize.d.ts +29 -0
  243. package/dist/generated/instructions/validateAndAuthorize.d.ts.map +1 -1
  244. package/dist/generated/instructions/validateAndAuthorize.js +4 -0
  245. package/dist/generated/instructions/validateAndAuthorize.js.map +1 -1
  246. package/dist/generated/instructions/withdrawFunds.d.ts +53 -11
  247. package/dist/generated/instructions/withdrawFunds.d.ts.map +1 -1
  248. package/dist/generated/instructions/withdrawFunds.js +51 -2
  249. package/dist/generated/instructions/withdrawFunds.js.map +1 -1
  250. package/dist/generated/programs/sigil.d.ts +79 -99
  251. package/dist/generated/programs/sigil.d.ts.map +1 -1
  252. package/dist/generated/programs/sigil.js +139 -199
  253. package/dist/generated/programs/sigil.js.map +1 -1
  254. package/dist/generated/types/actionAuthorized.d.ts +0 -2
  255. package/dist/generated/types/actionAuthorized.d.ts.map +1 -1
  256. package/dist/generated/types/actionAuthorized.js +0 -2
  257. package/dist/generated/types/actionAuthorized.js.map +1 -1
  258. package/dist/generated/types/agentAutoRevoked.d.ts +31 -0
  259. package/dist/generated/types/agentAutoRevoked.d.ts.map +1 -0
  260. package/dist/generated/types/{orphanConstraintsPdaCleaned.js → agentAutoRevoked.js} +12 -8
  261. package/dist/generated/types/agentAutoRevoked.js.map +1 -0
  262. package/dist/generated/types/agentEntry.d.ts +48 -0
  263. package/dist/generated/types/agentEntry.d.ts.map +1 -1
  264. package/dist/generated/types/agentEntry.js +4 -2
  265. package/dist/generated/types/agentEntry.js.map +1 -1
  266. package/dist/generated/types/agentGrantApplied.d.ts +38 -0
  267. package/dist/generated/types/agentGrantApplied.d.ts.map +1 -0
  268. package/dist/generated/types/agentGrantApplied.js +34 -0
  269. package/dist/generated/types/agentGrantApplied.js.map +1 -0
  270. package/dist/generated/types/agentGrantCancelled.d.ts +33 -0
  271. package/dist/generated/types/agentGrantCancelled.d.ts.map +1 -0
  272. package/dist/generated/types/agentGrantCancelled.js +28 -0
  273. package/dist/generated/types/agentGrantCancelled.js.map +1 -0
  274. package/dist/generated/types/agentGrantQueued.d.ts +38 -0
  275. package/dist/generated/types/agentGrantQueued.d.ts.map +1 -0
  276. package/dist/generated/types/agentGrantQueued.js +32 -0
  277. package/dist/generated/types/agentGrantQueued.js.map +1 -0
  278. package/dist/generated/types/auditEntry.d.ts +120 -0
  279. package/dist/generated/types/auditEntry.d.ts.map +1 -0
  280. package/dist/generated/types/auditEntry.js +34 -0
  281. package/dist/generated/types/auditEntry.js.map +1 -0
  282. package/dist/generated/types/destinationGraylistEntry.d.ts +32 -0
  283. package/dist/generated/types/destinationGraylistEntry.d.ts.map +1 -0
  284. package/dist/generated/types/destinationGraylistEntry.js +24 -0
  285. package/dist/generated/types/destinationGraylistEntry.js.map +1 -0
  286. package/dist/generated/types/graylistEntered.d.ts +31 -0
  287. package/dist/generated/types/graylistEntered.d.ts.map +1 -0
  288. package/dist/generated/types/graylistEntered.js +30 -0
  289. package/dist/generated/types/graylistEntered.js.map +1 -0
  290. package/dist/generated/types/graylistPromoted.d.ts +29 -0
  291. package/dist/generated/types/graylistPromoted.d.ts.map +1 -0
  292. package/dist/generated/types/graylistPromoted.js +28 -0
  293. package/dist/generated/types/graylistPromoted.js.map +1 -0
  294. package/dist/generated/types/index.d.ts +13 -22
  295. package/dist/generated/types/index.d.ts.map +1 -1
  296. package/dist/generated/types/index.js +13 -22
  297. package/dist/generated/types/index.js.map +1 -1
  298. package/dist/generated/types/observeOnlyChanged.d.ts +33 -0
  299. package/dist/generated/types/observeOnlyChanged.d.ts.map +1 -0
  300. package/dist/generated/types/observeOnlyChanged.js +32 -0
  301. package/dist/generated/types/observeOnlyChanged.js.map +1 -0
  302. package/dist/generated/types/ownershipTransferAccepted.d.ts +32 -0
  303. package/dist/generated/types/ownershipTransferAccepted.d.ts.map +1 -0
  304. package/dist/generated/types/ownershipTransferAccepted.js +30 -0
  305. package/dist/generated/types/ownershipTransferAccepted.js.map +1 -0
  306. package/dist/generated/types/ownershipTransferCancelled.d.ts +29 -0
  307. package/dist/generated/types/ownershipTransferCancelled.d.ts.map +1 -0
  308. package/dist/generated/types/ownershipTransferCancelled.js +28 -0
  309. package/dist/generated/types/ownershipTransferCancelled.js.map +1 -0
  310. package/dist/generated/types/ownershipTransferInitiated.d.ts +33 -0
  311. package/dist/generated/types/ownershipTransferInitiated.d.ts.map +1 -0
  312. package/dist/generated/types/ownershipTransferInitiated.js +30 -0
  313. package/dist/generated/types/ownershipTransferInitiated.js.map +1 -0
  314. package/dist/generated/types/perRecipientCounter.d.ts +61 -0
  315. package/dist/generated/types/perRecipientCounter.d.ts.map +1 -0
  316. package/dist/generated/types/perRecipientCounter.js +26 -0
  317. package/dist/generated/types/perRecipientCounter.js.map +1 -0
  318. package/dist/generated/types/postAssertionEntry.d.ts +14 -7
  319. package/dist/generated/types/postAssertionEntry.d.ts.map +1 -1
  320. package/dist/generated/types/postAssertionEntry.js +5 -7
  321. package/dist/generated/types/postAssertionEntry.js.map +1 -1
  322. package/dist/generated/types/postAssertionEntryZC.d.ts +53 -22
  323. package/dist/generated/types/postAssertionEntryZC.d.ts.map +1 -1
  324. package/dist/generated/types/postAssertionEntryZC.js +4 -6
  325. package/dist/generated/types/postAssertionEntryZC.js.map +1 -1
  326. package/dist/generated/types/sessionFinalized.d.ts +0 -4
  327. package/dist/generated/types/sessionFinalized.d.ts.map +1 -1
  328. package/dist/generated/types/sessionFinalized.js +0 -2
  329. package/dist/generated/types/sessionFinalized.js.map +1 -1
  330. package/dist/generated/types/vaultFrozen.d.ts +14 -0
  331. package/dist/generated/types/vaultFrozen.d.ts.map +1 -1
  332. package/dist/generated/types/vaultFrozen.js +2 -0
  333. package/dist/generated/types/vaultFrozen.js.map +1 -1
  334. package/dist/index.d.ts +31 -9
  335. package/dist/index.d.ts.map +1 -1
  336. package/dist/index.js +67 -11
  337. package/dist/index.js.map +1 -1
  338. package/dist/inspector.d.ts +0 -23
  339. package/dist/inspector.d.ts.map +1 -1
  340. package/dist/inspector.js +0 -52
  341. package/dist/inspector.js.map +1 -1
  342. package/dist/kit-adapter.d.ts +1 -1
  343. package/dist/kit-adapter.d.ts.map +1 -1
  344. package/dist/kit-adapter.js +1 -1
  345. package/dist/kit-adapter.js.map +1 -1
  346. package/dist/multisig-detection.d.ts +83 -0
  347. package/dist/multisig-detection.d.ts.map +1 -0
  348. package/dist/multisig-detection.js +128 -0
  349. package/dist/multisig-detection.js.map +1 -0
  350. package/dist/ownership-transfer.d.ts +79 -0
  351. package/dist/ownership-transfer.d.ts.map +1 -0
  352. package/dist/ownership-transfer.js +66 -0
  353. package/dist/ownership-transfer.js.map +1 -0
  354. package/dist/policy/compute-agent-perms-cosign-digest.d.ts +51 -0
  355. package/dist/policy/compute-agent-perms-cosign-digest.d.ts.map +1 -0
  356. package/dist/policy/compute-agent-perms-cosign-digest.js +55 -0
  357. package/dist/policy/compute-agent-perms-cosign-digest.js.map +1 -0
  358. package/dist/policy/compute-cosign-digest.d.ts +193 -0
  359. package/dist/policy/compute-cosign-digest.d.ts.map +1 -0
  360. package/dist/policy/compute-cosign-digest.js +318 -0
  361. package/dist/policy/compute-cosign-digest.js.map +1 -0
  362. package/dist/policy/compute-policy-preview-digest.d.ts +279 -0
  363. package/dist/policy/compute-policy-preview-digest.d.ts.map +1 -0
  364. package/dist/policy/compute-policy-preview-digest.js +373 -0
  365. package/dist/policy/compute-policy-preview-digest.js.map +1 -0
  366. package/dist/policy-attestation.d.ts +51 -0
  367. package/dist/policy-attestation.d.ts.map +1 -0
  368. package/dist/policy-attestation.js +43 -0
  369. package/dist/policy-attestation.js.map +1 -0
  370. package/dist/preview-create-vault.d.ts.map +1 -1
  371. package/dist/preview-create-vault.js +37 -16
  372. package/dist/preview-create-vault.js.map +1 -1
  373. package/dist/resolve-accounts.d.ts +75 -10
  374. package/dist/resolve-accounts.d.ts.map +1 -1
  375. package/dist/resolve-accounts.js +68 -32
  376. package/dist/resolve-accounts.js.map +1 -1
  377. package/dist/rpc-helpers.d.ts +29 -3
  378. package/dist/rpc-helpers.d.ts.map +1 -1
  379. package/dist/rpc-helpers.js +51 -12
  380. package/dist/rpc-helpers.js.map +1 -1
  381. package/dist/seal/intent-digest.d.ts +195 -0
  382. package/dist/seal/intent-digest.d.ts.map +1 -0
  383. package/dist/seal/intent-digest.js +372 -0
  384. package/dist/seal/intent-digest.js.map +1 -0
  385. package/dist/seal.d.ts +166 -3
  386. package/dist/seal.d.ts.map +1 -1
  387. package/dist/seal.js +428 -32
  388. package/dist/seal.js.map +1 -1
  389. package/dist/security-analytics.d.ts +3 -3
  390. package/dist/security-analytics.d.ts.map +1 -1
  391. package/dist/security-analytics.js +13 -128
  392. package/dist/security-analytics.js.map +1 -1
  393. package/dist/session-mint.d.ts +72 -0
  394. package/dist/session-mint.d.ts.map +1 -0
  395. package/dist/session-mint.js +59 -0
  396. package/dist/session-mint.js.map +1 -0
  397. package/dist/simulation.d.ts +19 -0
  398. package/dist/simulation.d.ts.map +1 -1
  399. package/dist/simulation.js +187 -95
  400. package/dist/simulation.js.map +1 -1
  401. package/dist/squads-detection.d.ts +135 -0
  402. package/dist/squads-detection.d.ts.map +1 -0
  403. package/dist/squads-detection.js +124 -0
  404. package/dist/squads-detection.js.map +1 -0
  405. package/dist/state-resolver.d.ts +0 -16
  406. package/dist/state-resolver.d.ts.map +1 -1
  407. package/dist/state-resolver.js +162 -97
  408. package/dist/state-resolver.js.map +1 -1
  409. package/dist/testing/devnet.d.ts +40 -1
  410. package/dist/testing/devnet.d.ts.map +1 -1
  411. package/dist/testing/devnet.js +333 -44
  412. package/dist/testing/devnet.js.map +1 -1
  413. package/dist/testing/errors/expect.d.ts +1 -1
  414. package/dist/testing/errors/expect.js +1 -1
  415. package/dist/testing/errors/names.generated.d.ts +82 -58
  416. package/dist/testing/errors/names.generated.d.ts.map +1 -1
  417. package/dist/testing/errors/names.generated.js +83 -59
  418. package/dist/testing/errors/names.generated.js.map +1 -1
  419. package/dist/testing/mock-rpc.d.ts +8 -0
  420. package/dist/testing/mock-rpc.d.ts.map +1 -1
  421. package/dist/testing/mock-rpc.js +13 -0
  422. package/dist/testing/mock-rpc.js.map +1 -1
  423. package/dist/testing/mock-state.d.ts +2 -0
  424. package/dist/testing/mock-state.d.ts.map +1 -1
  425. package/dist/testing/mock-state.js +43 -4
  426. package/dist/testing/mock-state.js.map +1 -1
  427. package/dist/types.d.ts +5 -15
  428. package/dist/types.d.ts.map +1 -1
  429. package/dist/types.js +11 -69
  430. package/dist/types.js.map +1 -1
  431. package/dist/vault-analytics.d.ts +0 -2
  432. package/dist/vault-analytics.d.ts.map +1 -1
  433. package/dist/vault-analytics.js +1 -9
  434. package/dist/vault-analytics.js.map +1 -1
  435. package/package.json +7 -12
  436. package/dist/constraints/index.d.ts +0 -23
  437. package/dist/constraints/index.d.ts.map +0 -1
  438. package/dist/constraints/index.js +0 -24
  439. package/dist/constraints/index.js.map +0 -1
  440. package/dist/dashboard/constraint-builders.d.ts +0 -82
  441. package/dist/dashboard/constraint-builders.d.ts.map +0 -1
  442. package/dist/dashboard/constraint-builders.js +0 -204
  443. package/dist/dashboard/constraint-builders.js.map +0 -1
  444. package/dist/dashboard/constraint-reads.d.ts +0 -50
  445. package/dist/dashboard/constraint-reads.d.ts.map +0 -1
  446. package/dist/dashboard/constraint-reads.js +0 -119
  447. package/dist/dashboard/constraint-reads.js.map +0 -1
  448. package/dist/generated/accounts/escrowDeposit.d.ts +0 -50
  449. package/dist/generated/accounts/escrowDeposit.d.ts.map +0 -1
  450. package/dist/generated/accounts/escrowDeposit.js +0 -76
  451. package/dist/generated/accounts/escrowDeposit.js.map +0 -1
  452. package/dist/generated/accounts/instructionConstraints.d.ts +0 -46
  453. package/dist/generated/accounts/instructionConstraints.d.ts.map +0 -1
  454. package/dist/generated/accounts/instructionConstraints.js +0 -73
  455. package/dist/generated/accounts/instructionConstraints.js.map +0 -1
  456. package/dist/generated/accounts/pendingCloseConstraints.d.ts +0 -49
  457. package/dist/generated/accounts/pendingCloseConstraints.d.ts.map +0 -1
  458. package/dist/generated/accounts/pendingCloseConstraints.js +0 -68
  459. package/dist/generated/accounts/pendingCloseConstraints.js.map +0 -1
  460. package/dist/generated/accounts/pendingConstraintsUpdate.d.ts +0 -76
  461. package/dist/generated/accounts/pendingConstraintsUpdate.d.ts.map +0 -1
  462. package/dist/generated/accounts/pendingConstraintsUpdate.js +0 -77
  463. package/dist/generated/accounts/pendingConstraintsUpdate.js.map +0 -1
  464. package/dist/generated/instructions/allocateConstraintsPda.d.ts +0 -62
  465. package/dist/generated/instructions/allocateConstraintsPda.d.ts.map +0 -1
  466. package/dist/generated/instructions/allocateConstraintsPda.js +0 -134
  467. package/dist/generated/instructions/allocateConstraintsPda.js.map +0 -1
  468. package/dist/generated/instructions/allocatePendingConstraintsPda.d.ts +0 -66
  469. package/dist/generated/instructions/allocatePendingConstraintsPda.d.ts.map +0 -1
  470. package/dist/generated/instructions/allocatePendingConstraintsPda.js.map +0 -1
  471. package/dist/generated/instructions/applyCloseConstraints.d.ts +0 -59
  472. package/dist/generated/instructions/applyCloseConstraints.d.ts.map +0 -1
  473. package/dist/generated/instructions/applyCloseConstraints.js +0 -143
  474. package/dist/generated/instructions/applyCloseConstraints.js.map +0 -1
  475. package/dist/generated/instructions/applyConstraintsUpdate.d.ts +0 -62
  476. package/dist/generated/instructions/applyConstraintsUpdate.d.ts.map +0 -1
  477. package/dist/generated/instructions/applyConstraintsUpdate.js.map +0 -1
  478. package/dist/generated/instructions/cancelCloseConstraints.d.ts +0 -51
  479. package/dist/generated/instructions/cancelCloseConstraints.d.ts.map +0 -1
  480. package/dist/generated/instructions/cancelCloseConstraints.js +0 -115
  481. package/dist/generated/instructions/cancelCloseConstraints.js.map +0 -1
  482. package/dist/generated/instructions/cancelConstraintsUpdate.d.ts +0 -51
  483. package/dist/generated/instructions/cancelConstraintsUpdate.d.ts.map +0 -1
  484. package/dist/generated/instructions/cancelConstraintsUpdate.js +0 -115
  485. package/dist/generated/instructions/cancelConstraintsUpdate.js.map +0 -1
  486. package/dist/generated/instructions/cleanupOrphanConstraintsPda.d.ts +0 -67
  487. package/dist/generated/instructions/cleanupOrphanConstraintsPda.d.ts.map +0 -1
  488. package/dist/generated/instructions/cleanupOrphanConstraintsPda.js +0 -120
  489. package/dist/generated/instructions/cleanupOrphanConstraintsPda.js.map +0 -1
  490. package/dist/generated/instructions/closeSettledEscrow.d.ts +0 -72
  491. package/dist/generated/instructions/closeSettledEscrow.d.ts.map +0 -1
  492. package/dist/generated/instructions/closeSettledEscrow.js +0 -127
  493. package/dist/generated/instructions/closeSettledEscrow.js.map +0 -1
  494. package/dist/generated/instructions/createEscrow.d.ts +0 -131
  495. package/dist/generated/instructions/createEscrow.d.ts.map +0 -1
  496. package/dist/generated/instructions/createEscrow.js +0 -272
  497. package/dist/generated/instructions/createEscrow.js.map +0 -1
  498. package/dist/generated/instructions/createInstructionConstraints.d.ts +0 -68
  499. package/dist/generated/instructions/createInstructionConstraints.d.ts.map +0 -1
  500. package/dist/generated/instructions/createInstructionConstraints.js.map +0 -1
  501. package/dist/generated/instructions/extendPda.d.ts +0 -52
  502. package/dist/generated/instructions/extendPda.d.ts.map +0 -1
  503. package/dist/generated/instructions/extendPda.js +0 -86
  504. package/dist/generated/instructions/extendPda.js.map +0 -1
  505. package/dist/generated/instructions/queueCloseConstraints.d.ts +0 -66
  506. package/dist/generated/instructions/queueCloseConstraints.d.ts.map +0 -1
  507. package/dist/generated/instructions/queueCloseConstraints.js.map +0 -1
  508. package/dist/generated/instructions/queueConstraintsUpdate.d.ts +0 -75
  509. package/dist/generated/instructions/queueConstraintsUpdate.d.ts.map +0 -1
  510. package/dist/generated/instructions/queueConstraintsUpdate.js +0 -154
  511. package/dist/generated/instructions/queueConstraintsUpdate.js.map +0 -1
  512. package/dist/generated/instructions/refundEscrow.d.ts +0 -74
  513. package/dist/generated/instructions/refundEscrow.d.ts.map +0 -1
  514. package/dist/generated/instructions/refundEscrow.js +0 -142
  515. package/dist/generated/instructions/refundEscrow.js.map +0 -1
  516. package/dist/generated/instructions/settleEscrow.d.ts +0 -80
  517. package/dist/generated/instructions/settleEscrow.d.ts.map +0 -1
  518. package/dist/generated/instructions/settleEscrow.js +0 -173
  519. package/dist/generated/instructions/settleEscrow.js.map +0 -1
  520. package/dist/generated/types/accountConstraint.d.ts +0 -33
  521. package/dist/generated/types/accountConstraint.d.ts.map +0 -1
  522. package/dist/generated/types/accountConstraint.js +0 -26
  523. package/dist/generated/types/accountConstraint.js.map +0 -1
  524. package/dist/generated/types/accountConstraintZC.d.ts +0 -25
  525. package/dist/generated/types/accountConstraintZC.d.ts.map +0 -1
  526. package/dist/generated/types/accountConstraintZC.js +0 -28
  527. package/dist/generated/types/accountConstraintZC.js.map +0 -1
  528. package/dist/generated/types/closeConstraintsApplied.d.ts +0 -20
  529. package/dist/generated/types/closeConstraintsApplied.d.ts.map +0 -1
  530. package/dist/generated/types/closeConstraintsApplied.js +0 -24
  531. package/dist/generated/types/closeConstraintsApplied.js.map +0 -1
  532. package/dist/generated/types/closeConstraintsCancelled.d.ts +0 -16
  533. package/dist/generated/types/closeConstraintsCancelled.d.ts.map +0 -1
  534. package/dist/generated/types/closeConstraintsCancelled.js +0 -18
  535. package/dist/generated/types/closeConstraintsCancelled.js.map +0 -1
  536. package/dist/generated/types/closeConstraintsQueued.d.ts +0 -20
  537. package/dist/generated/types/closeConstraintsQueued.d.ts.map +0 -1
  538. package/dist/generated/types/closeConstraintsQueued.js +0 -24
  539. package/dist/generated/types/closeConstraintsQueued.js.map +0 -1
  540. package/dist/generated/types/constraintEntry.d.ts +0 -35
  541. package/dist/generated/types/constraintEntry.d.ts.map +0 -1
  542. package/dist/generated/types/constraintEntry.js +0 -29
  543. package/dist/generated/types/constraintEntry.js.map +0 -1
  544. package/dist/generated/types/constraintEntryZC.d.ts +0 -73
  545. package/dist/generated/types/constraintEntryZC.d.ts.map +0 -1
  546. package/dist/generated/types/constraintEntryZC.js +0 -49
  547. package/dist/generated/types/constraintEntryZC.js.map +0 -1
  548. package/dist/generated/types/constraintOperator.d.ts +0 -22
  549. package/dist/generated/types/constraintOperator.d.ts.map +0 -1
  550. package/dist/generated/types/constraintOperator.js +0 -28
  551. package/dist/generated/types/constraintOperator.js.map +0 -1
  552. package/dist/generated/types/constraintsChangeApplied.d.ts +0 -30
  553. package/dist/generated/types/constraintsChangeApplied.d.ts.map +0 -1
  554. package/dist/generated/types/constraintsChangeApplied.js +0 -32
  555. package/dist/generated/types/constraintsChangeApplied.js.map +0 -1
  556. package/dist/generated/types/constraintsChangeCancelled.d.ts +0 -16
  557. package/dist/generated/types/constraintsChangeCancelled.d.ts.map +0 -1
  558. package/dist/generated/types/constraintsChangeCancelled.js +0 -18
  559. package/dist/generated/types/constraintsChangeCancelled.js.map +0 -1
  560. package/dist/generated/types/constraintsChangeQueued.d.ts +0 -30
  561. package/dist/generated/types/constraintsChangeQueued.d.ts.map +0 -1
  562. package/dist/generated/types/constraintsChangeQueued.js +0 -32
  563. package/dist/generated/types/constraintsChangeQueued.js.map +0 -1
  564. package/dist/generated/types/dataConstraint.d.ts +0 -23
  565. package/dist/generated/types/dataConstraint.d.ts.map +0 -1
  566. package/dist/generated/types/dataConstraint.js +0 -27
  567. package/dist/generated/types/dataConstraint.js.map +0 -1
  568. package/dist/generated/types/dataConstraintZC.d.ts +0 -20
  569. package/dist/generated/types/dataConstraintZC.d.ts.map +0 -1
  570. package/dist/generated/types/dataConstraintZC.js +0 -30
  571. package/dist/generated/types/dataConstraintZC.js.map +0 -1
  572. package/dist/generated/types/discriminatorFormat.d.ts +0 -25
  573. package/dist/generated/types/discriminatorFormat.d.ts.map +0 -1
  574. package/dist/generated/types/discriminatorFormat.js +0 -31
  575. package/dist/generated/types/discriminatorFormat.js.map +0 -1
  576. package/dist/generated/types/escrowCreated.d.ts +0 -30
  577. package/dist/generated/types/escrowCreated.d.ts.map +0 -1
  578. package/dist/generated/types/escrowCreated.js +0 -34
  579. package/dist/generated/types/escrowCreated.js.map +0 -1
  580. package/dist/generated/types/escrowRefunded.d.ts +0 -26
  581. package/dist/generated/types/escrowRefunded.d.ts.map +0 -1
  582. package/dist/generated/types/escrowRefunded.js +0 -30
  583. package/dist/generated/types/escrowRefunded.js.map +0 -1
  584. package/dist/generated/types/escrowSettled.d.ts +0 -26
  585. package/dist/generated/types/escrowSettled.d.ts.map +0 -1
  586. package/dist/generated/types/escrowSettled.js +0 -30
  587. package/dist/generated/types/escrowSettled.js.map +0 -1
  588. package/dist/generated/types/escrowStatus.d.ts +0 -18
  589. package/dist/generated/types/escrowStatus.d.ts.map +0 -1
  590. package/dist/generated/types/escrowStatus.js +0 -24
  591. package/dist/generated/types/escrowStatus.js.map +0 -1
  592. package/dist/generated/types/instructionConstraintsCreated.d.ts +0 -34
  593. package/dist/generated/types/instructionConstraintsCreated.d.ts.map +0 -1
  594. package/dist/generated/types/instructionConstraintsCreated.js +0 -36
  595. package/dist/generated/types/instructionConstraintsCreated.js.map +0 -1
  596. package/dist/generated/types/orphanConstraintsPdaCleaned.d.ts +0 -22
  597. package/dist/generated/types/orphanConstraintsPdaCleaned.d.ts.map +0 -1
  598. package/dist/generated/types/orphanConstraintsPdaCleaned.js.map +0 -1
  599. package/dist/generated/types/pdaAllocated.d.ts +0 -24
  600. package/dist/generated/types/pdaAllocated.d.ts.map +0 -1
  601. package/dist/generated/types/pdaAllocated.js +0 -28
  602. package/dist/generated/types/pdaAllocated.js.map +0 -1
  603. package/dist/generated/types/pdaExtended.d.ts +0 -24
  604. package/dist/generated/types/pdaExtended.d.ts.map +0 -1
  605. package/dist/generated/types/pdaExtended.js +0 -28
  606. package/dist/generated/types/pdaExtended.js.map +0 -1
  607. package/dist/post-assertions/cross-field-lte.d.ts +0 -134
  608. package/dist/post-assertions/cross-field-lte.d.ts.map +0 -1
  609. package/dist/post-assertions/cross-field-lte.js +0 -129
  610. package/dist/post-assertions/cross-field-lte.js.map +0 -1
  611. package/dist/post-assertions/index.d.ts +0 -28
  612. package/dist/post-assertions/index.d.ts.map +0 -1
  613. package/dist/post-assertions/index.js +0 -28
  614. package/dist/post-assertions/index.js.map +0 -1
  615. package/dist/post-assertions/presets/flash-trade.d.ts +0 -139
  616. package/dist/post-assertions/presets/flash-trade.d.ts.map +0 -1
  617. package/dist/post-assertions/presets/flash-trade.js +0 -154
  618. package/dist/post-assertions/presets/flash-trade.js.map +0 -1
  619. package/dist/protocol-registry/annotations/drift.json +0 -7
  620. package/dist/protocol-registry/annotations/flash-trade.json +0 -7
  621. package/dist/protocol-registry/annotations/jupiter-borrow.json +0 -7
  622. package/dist/protocol-registry/annotations/jupiter-earn.json +0 -7
  623. package/dist/protocol-registry/annotations/jupiter-lend.json +0 -7
  624. package/dist/protocol-registry/annotations/jupiter.json +0 -7
  625. package/dist/protocol-registry/annotations/kamino.json +0 -7
  626. package/dist/protocol-registry/index.d.ts +0 -45
  627. package/dist/protocol-registry/index.d.ts.map +0 -1
  628. package/dist/protocol-registry/index.js +0 -76
  629. package/dist/protocol-registry/index.js.map +0 -1
  630. package/dist/protocol-tier.d.ts +0 -157
  631. package/dist/protocol-tier.d.ts.map +0 -1
  632. package/dist/protocol-tier.js +0 -104
  633. package/dist/protocol-tier.js.map +0 -1
@@ -5,12 +5,43 @@
5
5
  * Every error includes a category, retryability flag, and
6
6
  * recovery actions that tell the agent exactly what to do next.
7
7
  *
8
- * Maps all 88 on-chain error codes (6000-6087) plus 34 SDK
9
- * error codes (7000-7033) to AgentError with machine-readable metadata.
8
+ * Maps all 105 on-chain error codes (6000-6104) post M1-04 constraints-engine
9
+ * teardown, which removed 10 dead constraint-only variants and renumbered the
10
+ * enum (positional). The IDL (`target/idl/sigil.json`) is the authoritative
11
+ * code↔name source; `error-map-drift.test.ts` enforces this map agrees with it.
12
+ * Plus 34 SDK error codes (7000-7033), all to AgentError with machine-readable
13
+ * metadata.
10
14
  *
11
15
  * Zero dependency on @solana/web3.js or @coral-xyz/anchor.
12
16
  * Uses bigint instead of BN for context values.
13
17
  */
18
+ // ---------------------------------------------------------------------------
19
+ // On-chain error code range constants — single source of truth.
20
+ //
21
+ // `dashboard/errors.ts` re-imports these for the FE→BE category mapping.
22
+ // `tests/dashboard/errors-categorize.test.ts` iterates every generated
23
+ // `SIGIL_ERROR__*` constant and asserts it falls within this range, so
24
+ // drift between MAX and the highest variant breaks CI immediately.
25
+ //
26
+ // MAINTENANCE — when `programs/sigil/src/errors.rs` adds a new variant:
27
+ // 1. Bump SIGIL_ON_CHAIN_ERROR_MAX below to the new highest code.
28
+ // 2. Add an entry to ON_CHAIN_ERRORS for that code (or a TODO with
29
+ // explicit deferral rationale).
30
+ // 3. Regenerate the IDL + SDK with `pnpm codama` so generated/errors
31
+ // stays in lockstep.
32
+ // ---------------------------------------------------------------------------
33
+ /** Lowest Anchor-error code Sigil emits. */
34
+ export const SIGIL_ON_CHAIN_ERROR_MIN = 6000;
35
+ /**
36
+ * Highest Anchor-error code currently in use. Bump when errors.rs grows.
37
+ *
38
+ * The enum tops out at 6106 (107 codes). The drift gate at
39
+ * `tests/error-map-drift.test.ts` derives the expected count from
40
+ * `target/idl/sigil.json` (the authoritative code↔name source) and asserts
41
+ * this map agrees with it by code AND name — so adding or renumbering an
42
+ * on-chain error without updating this map fails at test time.
43
+ */
44
+ export const SIGIL_ON_CHAIN_ERROR_MAX = 6111;
14
45
  export const ON_CHAIN_ERROR_MAP = {
15
46
  // --- Vault state errors ---
16
47
  6000: {
@@ -428,35 +459,6 @@ export const ON_CHAIN_ERROR_MAP = {
428
459
  ],
429
460
  },
430
461
  6030: {
431
- name: "SwapSlippageExceeded",
432
- message: "Swap slippage exceeds policy max_slippage_bps or quoted output is zero",
433
- category: "POLICY_VIOLATION",
434
- retryable: false,
435
- recovery_actions: [
436
- {
437
- action: "reduce_slippage",
438
- description: "Use a lower slippageBps value within the vault's maxSlippageBps",
439
- },
440
- {
441
- action: "check_policy",
442
- description: "Check the vault's maxSlippageBps setting",
443
- tool: "sigil_check_vault",
444
- },
445
- ],
446
- },
447
- 6031: {
448
- name: "InvalidJupiterInstruction",
449
- message: "Cannot parse Jupiter swap instruction data",
450
- category: "INPUT_VALIDATION",
451
- retryable: false,
452
- recovery_actions: [
453
- {
454
- action: "use_sdk",
455
- description: "Use the SDK's composeJupiterSwap — manual instruction building is error-prone",
456
- },
457
- ],
458
- },
459
- 6032: {
460
462
  name: "UnauthorizedTokenTransfer",
461
463
  message: "Top-level SPL Token transfer not allowed between validate and finalize",
462
464
  category: "POLICY_VIOLATION",
@@ -468,7 +470,7 @@ export const ON_CHAIN_ERROR_MAP = {
468
470
  },
469
471
  ],
470
472
  },
471
- 6033: {
473
+ 6031: {
472
474
  name: "SlippageBpsTooHigh",
473
475
  message: "Slippage BPS exceeds maximum allowed (5000 = 50%)",
474
476
  category: "INPUT_VALIDATION",
@@ -480,7 +482,7 @@ export const ON_CHAIN_ERROR_MAP = {
480
482
  },
481
483
  ],
482
484
  },
483
- 6034: {
485
+ 6032: {
484
486
  name: "ProtocolMismatch",
485
487
  message: "DeFi instruction program does not match the declared target_protocol",
486
488
  category: "INPUT_VALIDATION",
@@ -492,7 +494,7 @@ export const ON_CHAIN_ERROR_MAP = {
492
494
  },
493
495
  ],
494
496
  },
495
- 6035: {
497
+ 6033: {
496
498
  name: "TooManyDeFiInstructions",
497
499
  message: "Non-stablecoin swap allows exactly one DeFi instruction",
498
500
  category: "INPUT_VALIDATION",
@@ -505,7 +507,7 @@ export const ON_CHAIN_ERROR_MAP = {
505
507
  ],
506
508
  },
507
509
  // --- Multi-Agent errors ---
508
- 6036: {
510
+ 6034: {
509
511
  name: "MaxAgentsReached",
510
512
  message: "Maximum agents per vault reached (limit: 10)",
511
513
  category: "INPUT_VALIDATION",
@@ -518,7 +520,7 @@ export const ON_CHAIN_ERROR_MAP = {
518
520
  },
519
521
  ],
520
522
  },
521
- 6037: {
523
+ 6035: {
522
524
  name: "InsufficientPermissions",
523
525
  message: "Agent lacks permission for this action type",
524
526
  category: "PERMISSION",
@@ -535,7 +537,7 @@ export const ON_CHAIN_ERROR_MAP = {
535
537
  },
536
538
  ],
537
539
  },
538
- 6038: {
540
+ 6036: {
539
541
  name: "InvalidPermissions",
540
542
  message: "Capability exceeds the on-chain maximum (valid values: 0 = Disabled, 1 = Observer, 2 = Operator)",
541
543
  category: "INPUT_VALIDATION",
@@ -547,650 +549,1127 @@ export const ON_CHAIN_ERROR_MAP = {
547
549
  },
548
550
  ],
549
551
  },
550
- // --- Escrow errors ---
552
+ // --- Post-execution assertion config error ---
553
+ 6037: {
554
+ name: "InvalidConstraintConfig",
555
+ message: "Invalid constraint configuration: bounds exceeded",
556
+ category: "INPUT_VALIDATION",
557
+ retryable: false,
558
+ recovery_actions: [
559
+ {
560
+ action: "fix_constraints",
561
+ description: "Ensure constraint entries are within bounds (max 64 entries, 8 data constraints each)",
562
+ },
563
+ ],
564
+ },
565
+ // --- Per-agent spend limit errors ---
566
+ 6038: {
567
+ name: "AgentSpendLimitExceeded",
568
+ message: "Agent's rolling 24h spend exceeds their individual spending limit",
569
+ category: "SPENDING_CAP",
570
+ retryable: true,
571
+ retry_after_ms: 3_600_000,
572
+ recovery_actions: [
573
+ {
574
+ action: "reduce_amount",
575
+ description: "Reduce the amount to fit within the agent's remaining limit",
576
+ },
577
+ {
578
+ action: "check_spending",
579
+ description: "Check the agent's current spend against their limit",
580
+ tool: "sigil_check_spending",
581
+ },
582
+ {
583
+ action: "wait",
584
+ description: "Wait for the 24h rolling window to release spent capacity",
585
+ },
586
+ ],
587
+ },
551
588
  6039: {
552
- name: "EscrowNotActive",
553
- message: "Escrow is not in Active status",
554
- category: "RESOURCE_NOT_FOUND",
589
+ name: "OverlaySlotExhausted",
590
+ message: "Per-agent overlay is full cannot register agent with spending limit",
591
+ category: "INPUT_VALIDATION",
555
592
  retryable: false,
556
593
  recovery_actions: [
557
594
  {
558
- action: "check_escrow",
559
- description: "Verify the escrow exists and is in Active status",
595
+ action: "revoke_agent",
596
+ description: "Revoke an unused agent to free an overlay slot",
597
+ tool: "sigil_revoke_agent",
560
598
  },
561
599
  ],
562
600
  },
563
601
  6040: {
564
- name: "EscrowExpired",
565
- message: "Escrow has expired can only be refunded now",
602
+ name: "AgentSlotNotFound",
603
+ message: "Agent has per-agent spending limit but no overlay tracking slot",
566
604
  category: "RESOURCE_NOT_FOUND",
567
605
  retryable: false,
568
606
  recovery_actions: [
569
607
  {
570
- action: "refund_escrow",
571
- description: "Refund the expired escrow back to the source vault",
572
- tool: "sigil_refund_escrow",
608
+ action: "contact_support",
609
+ description: "This is an internal consistency error the overlay may need reinitialization",
573
610
  },
574
611
  ],
575
612
  },
576
613
  6041: {
577
- name: "EscrowNotExpired",
578
- message: "Escrow has not expired yet cannot refund before expiry",
614
+ name: "UnauthorizedTokenApproval",
615
+ message: "Unauthorized SPL Token Approve detected between validate and finalize",
616
+ category: "POLICY_VIOLATION",
617
+ retryable: false,
618
+ recovery_actions: [
619
+ {
620
+ action: "use_sdk",
621
+ description: "Use the SDK's compose functions — do not insert raw SPL Approve in the sandwich",
622
+ },
623
+ ],
624
+ },
625
+ 6042: {
626
+ name: "InvalidSessionExpiry",
627
+ message: "Session expiry slots out of range (10-450)",
579
628
  category: "INPUT_VALIDATION",
580
629
  retryable: false,
630
+ recovery_actions: [
631
+ {
632
+ action: "fix_expiry",
633
+ description: "Set session expiry between 10 and 450 slots",
634
+ },
635
+ ],
636
+ },
637
+ // --- Per-protocol spend cap errors ---
638
+ // Phase 5 §RP-1 V5: 6047 semantics flipped. The "rolling 24h per-protocol
639
+ // cap exceeded" semantic moved to 6095 (ErrDailyCapExceeded). 6047 now
640
+ // only emits from `state/tracker.rs:313` when the fixed-size per-protocol
641
+ // counter slot allocation (max 10 protocols tracked) is exhausted —
642
+ // i.e. an 11th distinct protocol attempted within the rolling window.
643
+ 6043: {
644
+ name: "ProtocolCapExceeded",
645
+ message: "Per-protocol counter slot allocation exhausted (max 10 protocols tracked)",
646
+ category: "SPENDING_CAP",
647
+ retryable: true,
648
+ retry_after_ms: 3_600_000,
581
649
  recovery_actions: [
582
650
  {
583
651
  action: "wait",
584
- description: "Wait for the escrow to expire before requesting a refund",
652
+ description: "Wait for an existing protocol slot's 24h rolling window to elapse before invoking a new protocol",
585
653
  },
586
654
  {
587
- action: "settle",
588
- description: "Settle the escrow if you are the destination agent",
589
- tool: "sigil_settle_escrow",
655
+ action: "use_existing_protocol",
656
+ description: "Reuse one of the protocols already tracked in the rolling window rather than invoking an 11th distinct protocol",
590
657
  },
591
658
  ],
592
659
  },
593
- 6042: {
594
- name: "InvalidEscrowVault",
595
- message: "Invalid escrow vault source or destination vault mismatch",
660
+ 6044: {
661
+ name: "ProtocolCapsMismatch",
662
+ message: "protocol_caps length must match protocols length when has_protocol_caps is true",
596
663
  category: "INPUT_VALIDATION",
597
664
  retryable: false,
598
665
  recovery_actions: [
599
666
  {
600
- action: "verify_vaults",
601
- description: "Ensure source and destination vault addresses match the escrow",
667
+ action: "fix_config",
668
+ description: "Ensure protocol_caps array length matches the protocols array length",
602
669
  },
603
670
  ],
604
671
  },
605
- 6043: {
606
- name: "EscrowConditionsNotMet",
607
- message: "Escrow settlement conditions not met (SHA-256 proof invalid)",
672
+ // --- Vault closure guard errors ---
673
+ 6045: {
674
+ name: "PendingPolicyExists",
675
+ message: "A pending policy update exists — apply or cancel it before closing vault",
676
+ category: "RESOURCE_NOT_FOUND",
677
+ retryable: false,
678
+ recovery_actions: [
679
+ {
680
+ action: "resolve_pending_policy",
681
+ description: "Apply or cancel the pending policy update before closing the vault",
682
+ },
683
+ ],
684
+ },
685
+ // --- Agent pause errors ---
686
+ 6046: {
687
+ name: "AgentPaused",
688
+ message: "Agent is paused — unpause before executing actions",
689
+ category: "PERMISSION",
690
+ retryable: false,
691
+ recovery_actions: [
692
+ {
693
+ action: "unpause_agent",
694
+ description: "Ask the vault owner to unpause this agent",
695
+ },
696
+ ],
697
+ },
698
+ 6047: {
699
+ name: "AgentAlreadyPaused",
700
+ message: "Agent is already paused",
608
701
  category: "INPUT_VALIDATION",
609
702
  retryable: false,
610
703
  recovery_actions: [
611
704
  {
612
- action: "provide_proof",
613
- description: "Provide the correct pre-image for the escrow's condition_hash",
705
+ action: "check_agent_status",
706
+ description: "Agent is already paused no action needed",
614
707
  },
615
708
  ],
616
709
  },
617
- 6044: {
618
- name: "EscrowDurationExceeded",
619
- message: "Escrow duration exceeds maximum (30 days)",
710
+ 6048: {
711
+ name: "AgentNotPaused",
712
+ message: "Agent is not paused cannot unpause",
620
713
  category: "INPUT_VALIDATION",
621
714
  retryable: false,
622
715
  recovery_actions: [
623
716
  {
624
- action: "reduce_duration",
625
- description: "Set escrow duration to 2,592,000 seconds (30 days) or less",
717
+ action: "check_agent_status",
718
+ description: "Agent is not paused no action needed",
626
719
  },
627
720
  ],
628
721
  },
629
- // --- Instruction constraints errors ---
630
- 6045: {
631
- name: "InvalidConstraintConfig",
632
- message: "Invalid constraint configuration: bounds exceeded",
722
+ 6049: {
723
+ name: "UnauthorizedPostFinalizeInstruction",
724
+ message: "Instructions after finalize_session must be ComputeBudget or SystemProgram only",
725
+ category: "POLICY_VIOLATION",
726
+ retryable: false,
727
+ recovery_actions: [
728
+ {
729
+ action: "remove_post_finalize_instructions",
730
+ description: "Remove any instructions placed after finalize_session in the transaction. Only ComputeBudget and SystemProgram instructions are allowed after finalize.",
731
+ },
732
+ ],
733
+ },
734
+ 6050: {
735
+ name: "UnexpectedBalanceDecrease",
736
+ message: "Vault stablecoin balance decreased more than the session authorized amount. " +
737
+ "This indicates a compromised DeFi program attempted to drain vault tokens via CPI.",
738
+ category: "FATAL",
739
+ retryable: false,
740
+ recovery_actions: [
741
+ {
742
+ action: "investigate_defi_program",
743
+ description: "The whitelisted DeFi program may be compromised. The actual vault balance decrease " +
744
+ "exceeded the authorized delegation amount (fees + DeFi spend). Freeze the vault, " +
745
+ "investigate the DeFi program, and consider removing it from the protocol allowlist.",
746
+ },
747
+ {
748
+ action: "freeze_vault",
749
+ description: "Immediately freeze the vault to prevent further transactions until the cause is identified.",
750
+ },
751
+ ],
752
+ },
753
+ // --- TOCTOU + timelock hardening errors ---
754
+ 6051: {
755
+ name: "TimelockTooShort",
756
+ message: "Timelock duration is below the minimum (1800 seconds / 30 minutes).",
633
757
  category: "INPUT_VALIDATION",
634
758
  retryable: false,
635
759
  recovery_actions: [
636
760
  {
637
- action: "fix_constraints",
638
- description: "Ensure constraint entries are within bounds (max 64 entries, 8 data constraints each)",
761
+ action: "increase_timelock",
762
+ description: "Set timelock_duration to at least 1800 seconds (30 minutes).",
639
763
  },
640
764
  ],
641
765
  },
642
- 6046: {
643
- name: "ConstraintViolated",
644
- message: "Instruction violated a configured constraint",
766
+ 6052: {
767
+ name: "PolicyVersionMismatch",
768
+ message: "Policy version changed since agent's last RPC read. Re-resolve vault state and retry.",
769
+ category: "TRANSIENT",
770
+ retryable: true,
771
+ retry_after_ms: 1000,
772
+ recovery_actions: [
773
+ {
774
+ action: "re_resolve_state",
775
+ description: "Re-fetch vault state via resolveVaultState() to get current policy version, then retry.",
776
+ },
777
+ ],
778
+ },
779
+ 6053: {
780
+ name: "ActiveSessionsExist",
781
+ message: "Cannot close vault with active sessions. Finalize all pending sessions first.",
782
+ category: "POLICY_VIOLATION",
783
+ retryable: true,
784
+ retry_after_ms: 10000,
785
+ recovery_actions: [
786
+ {
787
+ action: "finalize_sessions",
788
+ description: "Wait for active sessions to finalize or expire, then retry close_vault.",
789
+ },
790
+ ],
791
+ },
792
+ // --- Post-execution assertions (Phase B scaffolding) ---
793
+ 6054: {
794
+ name: "PostAssertionFailed",
795
+ message: "Post-execution assertion failed: account state did not satisfy constraint.",
645
796
  category: "POLICY_VIOLATION",
646
797
  retryable: false,
647
798
  recovery_actions: [
648
799
  {
649
- action: "check_constraints",
650
- description: "Review the vault's instruction constraints to understand what is allowed",
651
- tool: "sigil_check_vault",
800
+ action: "review_assertions",
801
+ description: "Review the vault's post-execution assertions. The trade's resulting account state violated a configured assertion.",
652
802
  },
803
+ ],
804
+ },
805
+ 6055: {
806
+ name: "InvalidPostAssertionIndex",
807
+ message: "Post-assertion references an invalid instruction index.",
808
+ category: "INPUT_VALIDATION",
809
+ retryable: false,
810
+ recovery_actions: [
653
811
  {
654
- action: "modify_instruction",
655
- description: "Modify the instruction parameters to satisfy the constraints",
812
+ action: "fix_assertions",
813
+ description: "Review and update the vault's post-assertion configuration.",
656
814
  },
657
815
  ],
658
816
  },
659
- 6047: {
660
- name: "InvalidConstraintsPda",
661
- message: "Invalid constraints PDA: wrong owner or vault",
817
+ 6056: {
818
+ name: "UnauthorizedPreValidateInstruction",
819
+ message: "Non-infrastructure instruction detected before validate_and_authorize.",
820
+ category: "PERMISSION",
821
+ retryable: false,
822
+ recovery_actions: [
823
+ {
824
+ action: "fix_instruction_order",
825
+ description: "Place validate_and_authorize before any DeFi or program instruction.",
826
+ },
827
+ ],
828
+ },
829
+ 6057: {
830
+ name: "SnapshotNotCaptured",
831
+ message: "Delta assertion snapshot was not captured in validate_and_authorize.",
662
832
  category: "INPUT_VALIDATION",
663
833
  retryable: false,
664
834
  recovery_actions: [
665
835
  {
666
- action: "verify_pda",
667
- description: "Use the correct constraints PDA derived from the vault",
836
+ action: "fix_assertions",
837
+ description: "Ensure validate_and_authorize captures a snapshot before finalize delta check.",
668
838
  },
669
839
  ],
670
840
  },
671
- 6048: {
672
- name: "InvalidPendingConstraintsPda",
673
- message: "Invalid pending constraints PDA: wrong owner or vault",
841
+ 6058: {
842
+ name: "InvalidConstraintOperator",
843
+ message: "Constraint operator value is not a valid ConstraintOperator discriminant.",
674
844
  category: "INPUT_VALIDATION",
675
845
  retryable: false,
676
846
  recovery_actions: [
677
847
  {
678
- action: "verify_pda",
679
- description: "Use the correct pending constraints PDA derived from the vault",
848
+ action: "fix_constraints",
849
+ description: "Ensure constraint operators are valid (0-6).",
680
850
  },
681
851
  ],
682
852
  },
683
- // --- Per-agent spend limit errors ---
684
- 6049: {
685
- name: "AgentSpendLimitExceeded",
686
- message: "Agent's rolling 24h spend exceeds their individual spending limit",
687
- category: "SPENDING_CAP",
688
- retryable: true,
689
- retry_after_ms: 3_600_000,
853
+ 6059: {
854
+ name: "ZeroCopyVaultMismatch",
855
+ message: "Zero-copy constraints account has wrong vault.",
856
+ category: "INPUT_VALIDATION",
857
+ retryable: false,
690
858
  recovery_actions: [
691
859
  {
692
- action: "reduce_amount",
693
- description: "Reduce the amount to fit within the agent's remaining limit",
860
+ action: "verify_pda",
861
+ description: "The constraints PDA does not belong to this vault.",
694
862
  },
863
+ ],
864
+ },
865
+ // F-10 audit fix: durable-nonce pre-signing defense (extended Bucket-3
866
+ // 2026-05-23 to cover the 2 timelocked-admin PDAs via the wider
867
+ // MAX_APPLY_AGE_SLOTS_TIMELOCKED_ADMIN ceiling)
868
+ 6060: {
869
+ name: "QueuedUpdateExpired",
870
+ message: "Queued update is too old (>MAX_APPLY_AGE_SLOTS / >MAX_APPLY_AGE_SLOTS_TIMELOCKED_ADMIN) — re-queue to apply. Defends against durable-nonce pre-signing.",
871
+ category: "POLICY_VIOLATION",
872
+ retryable: false,
873
+ recovery_actions: [
695
874
  {
696
- action: "check_spending",
697
- description: "Check the agent's current spend against their limit",
698
- tool: "sigil_check_spending",
875
+ action: "requeue",
876
+ description: "Re-queue the update via the matching ix for your flow: queue_policy_update / queue_constraints_update / queue_close_constraints / queue_agent_permissions_update / queue_agent_grant / initiate_ownership_transfer — the original queued update is past the freshness window.",
699
877
  },
878
+ ],
879
+ },
880
+ 6061: {
881
+ name: "AccountWritabilityMismatch",
882
+ message: "Account writability flag does not match the constraint requirement (read-only vs writable).",
883
+ category: "INPUT_VALIDATION",
884
+ retryable: false,
885
+ recovery_actions: [
700
886
  {
701
- action: "wait",
702
- description: "Wait for the 24h rolling window to release spent capacity",
887
+ action: "fix_constraints",
888
+ description: "Match the writability flag (read-only or writable) of the account passed to the instruction with the constraint's is_writable_required value.",
703
889
  },
704
890
  ],
705
891
  },
706
- 6050: {
707
- name: "OverlaySlotExhausted",
708
- message: "Per-agent overlay is full — cannot register agent with spending limit",
892
+ // M11 SIMD-0296 pad-attack DoS guard
893
+ 6062: {
894
+ name: "SysvarScanBoundExceeded",
895
+ message: "Sysvar instruction scan exceeded the per-tx safety bound (MAX_SYSVAR_SCAN_ITERATIONS=64).",
709
896
  category: "INPUT_VALIDATION",
710
897
  retryable: false,
711
898
  recovery_actions: [
712
899
  {
713
- action: "revoke_agent",
714
- description: "Revoke an unused agent to free an overlay slot",
715
- tool: "sigil_revoke_agent",
900
+ action: "fix_transaction_shape",
901
+ description: "Reduce the number of instructions in the transaction. The on-chain sysvar walk is bounded at 64 ix to defend against pad-attack DoS (M11 / SIMD-0296). Legitimate flows fit well under this cap.",
716
902
  },
717
903
  ],
718
904
  },
719
- 6051: {
720
- name: "AgentSlotNotFound",
721
- message: "Agent has per-agent spending limit but no overlay tracking slot",
722
- category: "RESOURCE_NOT_FOUND",
905
+ // C4 audit fix: async-fulfillment program deny
906
+ 6063: {
907
+ name: "AsyncFulfillmentNotPermitted",
908
+ message: "Async-fulfillment programs (Jupiter Perps, Drift v2, Drift JIT) are not permitted in V1 — keeper-driven settlement happens after finalize_session returns and cannot be measured against the spending cap.",
909
+ category: "POLICY_VIOLATION",
723
910
  retryable: false,
724
911
  recovery_actions: [
725
912
  {
726
- action: "contact_support",
727
- description: "This is an internal consistency error the overlay may need reinitialization",
913
+ action: "use_supported_protocol",
914
+ description: "Use a synchronous protocol (Jupiter swap, Jupiter Lend, etc.). V1.1 will add a sanctioned async-friendly path with settlement-tracked counters or post-execution attestation.",
728
915
  },
729
916
  ],
730
917
  },
731
- 6052: {
732
- name: "UnauthorizedTokenApproval",
733
- message: "Unauthorized SPL Token Approve detected between validate and finalize",
918
+ // PR 7: Token-2022 opcode blocks (M3 + Pentester HIGH/MED + third-pass audit)
919
+ 6064: {
920
+ name: "ConfidentialTransferBlocked",
921
+ message: "Token-2022 ConfidentialTransfer is not permitted between validate_and_authorize and finalize_session.",
734
922
  category: "POLICY_VIOLATION",
735
923
  retryable: false,
736
924
  recovery_actions: [
737
925
  {
738
- action: "use_sdk",
739
- description: "Use the SDK's compose functions do not insert raw SPL Approve in the sandwich",
926
+ action: "use_supported_protocol",
927
+ description: "Token-2022 ConfidentialTransfer (opcode 27/42) hides spending amounts from sysvar accounting and cannot be tracked. Use the standard SPL Token transfer or Jupiter swap path instead.",
740
928
  },
741
929
  ],
742
930
  },
743
- 6053: {
744
- name: "InvalidSessionExpiry",
745
- message: "Session expiry slots out of range (10-450)",
931
+ 6065: {
932
+ name: "PermanentDelegateBlocked",
933
+ message: "Token-2022 PermanentDelegate is not permitted between validate_and_authorize and finalize_session.",
934
+ category: "POLICY_VIOLATION",
935
+ retryable: false,
936
+ recovery_actions: [
937
+ {
938
+ action: "use_supported_protocol",
939
+ description: "Token-2022 PermanentDelegate (opcode 35) installs a session-bound delegate that survives finalize. Reject up-front; use a per-tx Approve instead.",
940
+ },
941
+ ],
942
+ },
943
+ 6066: {
944
+ name: "TransferHookBlocked",
945
+ message: "Token-2022 TransferHook is not permitted between validate_and_authorize and finalize_session.",
946
+ category: "POLICY_VIOLATION",
947
+ retryable: false,
948
+ recovery_actions: [
949
+ {
950
+ action: "use_supported_protocol",
951
+ description: "Token-2022 TransferHook (opcode 36) routes mid-tx control to attacker-chosen code. Use a non-hook mint or whitelist the hook program in V1.1.",
952
+ },
953
+ ],
954
+ },
955
+ 6067: {
956
+ name: "LamportDrainBlocked",
957
+ message: "Token-2022 destructive-balance instruction (opcode 38/45/46) is not permitted between validate_and_authorize and finalize_session.",
958
+ category: "POLICY_VIOLATION",
959
+ retryable: false,
960
+ recovery_actions: [
961
+ {
962
+ action: "use_supported_protocol",
963
+ description: "WithdrawExcessLamports/UnwrapLamports/PermissionedBurnExtension drain SOL or balances outside the spending-cap path. Block at the gate; V1.1 may add an owner-allowlist for legitimate uses.",
964
+ },
965
+ ],
966
+ },
967
+ 6068: {
968
+ name: "BatchInstructionBlocked",
969
+ message: "Token-2022 Batch instruction (opcode 255) is blocked outright — wraps inner instructions and bypasses the byte-0 blocklist.",
970
+ category: "POLICY_VIOLATION",
971
+ retryable: false,
972
+ recovery_actions: [
973
+ {
974
+ action: "use_supported_protocol",
975
+ description: "Token-2022 Batch (opcode 255) wraps inner TokenInstructions; the byte-0 blocklist cannot see them. Submit each inner ix as its own top-level instruction so guards can inspect each.",
976
+ },
977
+ ],
978
+ },
979
+ // F-4 audit fix: explicit destination_mode. Phase 2 Option A tightens to
980
+ // 0 = RESTRICTED only — OPEN_WITH_CAP path deleted.
981
+ 6069: {
982
+ name: "InvalidDestinationMode",
983
+ message: "Invalid destination mode (must be 0 = RESTRICTED).",
746
984
  category: "INPUT_VALIDATION",
747
985
  retryable: false,
748
986
  recovery_actions: [
749
987
  {
750
- action: "fix_expiry",
751
- description: "Set session expiry between 10 and 450 slots",
988
+ action: "fix_policy",
989
+ description: "Pass destination_mode = 0 (RESTRICTED). Phase 2 deleted the permissive OPEN_WITH_CAP path.",
752
990
  },
753
991
  ],
754
992
  },
755
- 6054: {
756
- name: "UnconstrainedProgramBlocked",
757
- message: "Program has no constraint entry and strict mode is enabled",
993
+ // Phase 2 TA-04: reserved AgentEntry.capability values 3..=255 reject.
994
+ 6070: {
995
+ name: "InvalidCapability",
996
+ message: "Invalid agent capability value (must be 0 = Disabled, 1 = Observer, or 2 = Operator).",
997
+ category: "INPUT_VALIDATION",
998
+ retryable: false,
999
+ recovery_actions: [
1000
+ {
1001
+ action: "fix_policy",
1002
+ description: "Pass capability = 0, 1, or 2. Reserved values 3..=255 are explicitly rejected by register_agent / queue_agent_permissions_update / apply_agent_permissions_update.",
1003
+ },
1004
+ ],
1005
+ },
1006
+ // Phase 2 TA-19: policy_preview_digest mismatch — owner blind-sign defense.
1007
+ 6071: {
1008
+ name: "PolicyPreviewMismatch",
1009
+ message: "Policy preview digest mismatch — caller's signed digest differs from recomputed canonical digest.",
1010
+ category: "INPUT_VALIDATION",
1011
+ retryable: false,
1012
+ recovery_actions: [
1013
+ {
1014
+ action: "recompute_digest",
1015
+ description: "Recompute the policy preview digest via computePolicyPreviewDigest() against the actual policy fields and resubmit. Likely cause: owner signed a digest produced from stale fields, or a pending PDA was tampered with between queue and apply.",
1016
+ },
1017
+ ],
1018
+ },
1019
+ // Phase 2 TA-19: observe_only mode rejects all validate_and_authorize calls.
1020
+ 6072: {
1021
+ name: "ObserveOnlyModeBlocksExecute",
1022
+ message: "Vault is in observe_only mode — validate_and_authorize is blocked.",
758
1023
  category: "POLICY_VIOLATION",
759
1024
  retryable: false,
760
1025
  recovery_actions: [
761
1026
  {
762
- action: "add_constraint",
763
- description: "Add a constraint entry for this program, or disable strict mode",
1027
+ action: "switch_vault_mode",
1028
+ description: "Owner must queue + apply a policy update to flip observe_only off (or create a separate vault without observe_only set).",
764
1029
  },
1030
+ ],
1031
+ },
1032
+ // Phase 2 F-11: active vault (observe_only=false) requires at least one
1033
+ // entry on the protocol allowlist OR destination allowlist. An empty
1034
+ // allowlist would leave the vault silently inert.
1035
+ 6073: {
1036
+ name: "ActiveVaultRequiresAllowlist",
1037
+ message: "Active vault (observe_only=false) requires at least one protocol or destination on its allowlist.",
1038
+ category: "INPUT_VALIDATION",
1039
+ retryable: false,
1040
+ recovery_actions: [
765
1041
  {
766
- action: "check_constraints",
767
- description: "Review the vault's instruction constraints",
768
- tool: "sigil_check_vault",
1042
+ action: "add_allowlist_entry",
1043
+ description: "Either add at least one program to `protocols`, at least one wallet to `allowed_destinations`, or pass `observe_only=true` (intentional inert vault).",
769
1044
  },
770
1045
  ],
771
1046
  },
772
- // --- Per-protocol spend cap errors ---
773
- 6055: {
774
- name: "ProtocolCapExceeded",
775
- message: "Per-protocol rolling 24h spending cap would be exceeded",
776
- category: "SPENDING_CAP",
1047
+ // ─── Phase 3 pre-execution guards (TA-03/05/06/07/08/09/17) ───────────────
1048
+ // 6083-6090 codes added by Phase 3 — each is an on-chain policy-violation
1049
+ // surface that the SDK surfaces to dashboard / agent consumers.
1050
+ 6074: {
1051
+ name: "ErrMintNotPinned",
1052
+ message: "Deposit mint is not on the build-time stablecoin allowlist (USDC + USDT). Reject prevents exotic / typosquatted mints from being parked in the vault.",
1053
+ category: "INPUT_VALIDATION",
1054
+ retryable: false,
1055
+ recovery_actions: [
1056
+ {
1057
+ action: "use_pinned_stablecoin",
1058
+ description: "Re-issue the deposit using the USDC or USDT mint. Other tokens are not accepted by the vault.",
1059
+ },
1060
+ ],
1061
+ },
1062
+ 6075: {
1063
+ name: "ErrOutsideOperatingHours",
1064
+ message: "Current UTC hour is outside the policy's operating_hours bitmask. The vault is configured to spend only during specific UTC hours.",
1065
+ category: "POLICY_VIOLATION",
1066
+ retryable: true,
1067
+ recovery_actions: [
1068
+ {
1069
+ action: "retry_in_window",
1070
+ description: "Wait until a UTC hour permitted by the policy's operating_hours bitmask, or have the owner widen the mask via queue_policy_update.",
1071
+ },
1072
+ ],
1073
+ },
1074
+ 6076: {
1075
+ name: "ErrCooldownActive",
1076
+ message: "Agent cooldown has not elapsed since the last successful action. Per-agent cooldown is configured by the owner.",
1077
+ category: "POLICY_VIOLATION",
777
1078
  retryable: true,
778
- retry_after_ms: 3_600_000,
779
1079
  recovery_actions: [
780
1080
  {
781
- action: "reduce_amount",
782
- description: "Reduce the amount to fit within the protocol's remaining cap",
783
- },
784
- {
785
- action: "use_different_protocol",
786
- description: "Use a different protocol that has remaining capacity",
1081
+ action: "wait_cooldown",
1082
+ description: "Wait until the per-agent cooldown (in seconds) has elapsed since the agent's last successful action.",
787
1083
  },
1084
+ ],
1085
+ },
1086
+ 6077: {
1087
+ name: "ErrGraylistFriction",
1088
+ message: "Destination is on the graylist — a 24h friction window applied to newly-added allowlist destinations. Promote via promote_graylist_destination or wait for unlock.",
1089
+ category: "POLICY_VIOLATION",
1090
+ retryable: true,
1091
+ recovery_actions: [
788
1092
  {
789
- action: "wait",
790
- description: "Wait for the 24h rolling window to release spent capacity",
1093
+ action: "wait_or_promote",
1094
+ description: "Owner can promote the destination to active via promote_graylist_destination, or wait the remaining time until automatic unlock.",
791
1095
  },
792
1096
  ],
793
1097
  },
794
- 6056: {
795
- name: "ProtocolCapsMismatch",
796
- message: "protocol_caps length must match protocols length when has_protocol_caps is true",
1098
+ 6078: {
1099
+ name: "ErrGraylistFull",
1100
+ message: "Graylist bound exceeded (max 10 entries). Wait for an existing entry to unlock or promote.",
797
1101
  category: "INPUT_VALIDATION",
798
1102
  retryable: false,
799
1103
  recovery_actions: [
800
1104
  {
801
- action: "fix_config",
802
- description: "Ensure protocol_caps array length matches the protocols array length",
1105
+ action: "promote_or_wait",
1106
+ description: "Promote at least one graylist entry to active or wait for unlock. Then re-issue the destination-allowlist add.",
803
1107
  },
804
1108
  ],
805
1109
  },
806
- // --- Vault closure guard errors ---
807
- 6057: {
808
- name: "ActiveEscrowsExist",
809
- message: "Active escrow deposits exist — close them before closing vault",
810
- category: "RESOURCE_NOT_FOUND",
1110
+ 6079: {
1111
+ name: "ErrToken2022ExtensionForbidden",
1112
+ message: "Token-2022 mint has a forbidden extension. Only MemoTransfer and MetadataPointer extensions are permitted at deposit.",
1113
+ category: "INPUT_VALIDATION",
811
1114
  retryable: false,
812
1115
  recovery_actions: [
813
1116
  {
814
- action: "close_escrows",
815
- description: "Settle or refund all active escrows before closing the vault",
1117
+ action: "use_supported_mint",
1118
+ description: "Use a Token-2022 mint with no extensions, or one limited to MemoTransfer/MetadataPointer.",
816
1119
  },
817
1120
  ],
818
1121
  },
819
- 6058: {
820
- name: "ConstraintsNotClosed",
821
- message: "Instruction constraints PDA still exists close it before closing vault",
822
- category: "RESOURCE_NOT_FOUND",
1122
+ 6080: {
1123
+ name: "ErrCosignRequired",
1124
+ // §RP-2 M-NEW-3 (audit 2026-05-19): after P0.1 + H-NEW-1, 6089
1125
+ // fires from four sites — queue_policy_update (original elevated
1126
+ // mutation path), register_agent, set_observe_only(false→true),
1127
+ // and unpause_agent. The message + recovery now reflect that the
1128
+ // common axis is "cosign-opted-in vault + owner action lacking a
1129
+ // non-owner co-signer", not just queue_policy_update specifically.
1130
+ message: "Cosign-opted-in vault requires a non-owner signer for this owner-action. Original sites: queue_policy_update (elevated), register_agent, set_observe_only(false→true), unpause_agent.",
1131
+ category: "PERMISSION",
823
1132
  retryable: false,
824
1133
  recovery_actions: [
825
1134
  {
826
- action: "close_constraints",
827
- description: "Close the instruction constraints account before closing the vault",
1135
+ action: "supply_cosigner",
1136
+ description: "Supply the cosign session pubkey as a signer in remaining_accounts. For queue_policy_update, also pass cosign_session as an arg. The cosign session must not be the owner's own key.",
828
1137
  },
829
1138
  ],
830
1139
  },
831
- 6059: {
832
- name: "PendingPolicyExists",
833
- message: "A pending policy update exists apply or cancel it before closing vault",
834
- category: "RESOURCE_NOT_FOUND",
1140
+ 6081: {
1141
+ name: "ErrAutoRevoked",
1142
+ message: "Agent capability was auto-revoked after consecutive policy-violation failures. Owner must re-enable via queue_agent_permissions_update.",
1143
+ category: "PERMISSION",
835
1144
  retryable: false,
836
1145
  recovery_actions: [
837
1146
  {
838
- action: "resolve_pending_policy",
839
- description: "Apply or cancel the pending policy update before closing the vault",
1147
+ action: "owner_reenable",
1148
+ description: "Owner queues a fresh queue_agent_permissions_update setting the agent's capability back to Observer or Operator.",
840
1149
  },
841
1150
  ],
842
1151
  },
843
- // --- Agent pause errors ---
844
- 6060: {
845
- name: "AgentPaused",
846
- message: "Agent is paused unpause before executing actions",
847
- category: "PERMISSION",
1152
+ // Phase 4 Bundle integrity (TA-10 + TA-11 + AC-10)
1153
+ 6082: {
1154
+ name: "ErrSandwichIntegrity",
1155
+ message: "Bundle integrity violation: multiple validate_and_authorize instructions for the same (vault, agent, mint) tuple in one transaction. At most one is permitted (TA-10 hardening).",
1156
+ category: "POLICY_VIOLATION",
848
1157
  retryable: false,
849
1158
  recovery_actions: [
850
1159
  {
851
- action: "unpause_agent",
852
- description: "Ask the vault owner to unpause this agent",
1160
+ action: "rebuild_bundle",
1161
+ description: "Rebuild the transaction with exactly one validate_and_authorize per (vault, agent, mint) tuple. ComputeBudget and SystemProgram instructions may be interleaved.",
853
1162
  },
854
1163
  ],
855
1164
  },
856
- 6061: {
857
- name: "AgentAlreadyPaused",
858
- message: "Agent is already paused",
859
- category: "INPUT_VALIDATION",
1165
+ 6083: {
1166
+ name: "ErrProtectedWritable",
1167
+ message: "A Sigil-owned PDA was passed as writable to a foreign instruction between validate and finalize (TA-11). Protected PDAs include vault, policy, tracker, session, post_assertions, audit, constraints, and overlay accounts.",
1168
+ category: "POLICY_VIOLATION",
860
1169
  retryable: false,
861
1170
  recovery_actions: [
862
1171
  {
863
- action: "check_agent_status",
864
- description: "Agent is already paused no action needed",
1172
+ action: "remove_protected_pda_writable",
1173
+ description: "Remove the writable flag on any Sigil PDA passed to the DeFi instruction, or remove the PDA from that instruction's account metas entirely. Sigil PDAs may still be read by foreign instructions (writable=false is allowed).",
865
1174
  },
866
1175
  ],
867
1176
  },
868
- 6062: {
869
- name: "AgentNotPaused",
870
- message: "Agent is not paused cannot unpause",
1177
+ 6084: {
1178
+ name: "ErrSessionNonceMismatch",
1179
+ message: "Session nonce mismatch (AC-10 durable-nonce replay defense). The caller's expected_nonce does not match the session's stored nonce. For a fresh session, pass expected_nonce = 0.",
871
1180
  category: "INPUT_VALIDATION",
872
1181
  retryable: false,
873
1182
  recovery_actions: [
874
1183
  {
875
- action: "check_agent_status",
876
- description: "Agent is not paused no action needed",
1184
+ action: "fresh_session_nonce",
1185
+ description: "Pass expected_nonce = 0 for a fresh validate_and_authorize. A non-zero value is only valid in Phase 8 ownership-transfer flow (M-5).",
877
1186
  },
878
1187
  ],
879
1188
  },
880
- 6063: {
881
- name: "UnauthorizedPostFinalizeInstruction",
882
- message: "Instructions after finalize_session must be ComputeBudget or SystemProgram only",
1189
+ // ─── Phase 5: post-execution invariants (TA-12 + TA-13 + TA-14) ───
1190
+ // §RP-1 V5: added Phase 5 mappings missing from the SDK error table.
1191
+ // Source of truth: programs/sigil/src/errors.rs:407-451 + IDL.
1192
+ /** 6085 — TA-12: combined USDC+USDT vault balance dropped below the
1193
+ * owner-configured `policy.stable_balance_floor`. The HARD reserve —
1194
+ * no combination of attacks (CPI drain, per-protocol cap bypass, fee
1195
+ * inflation) may drain the vault below this line. Asserted in both
1196
+ * `finalize_session` and `agent_transfer` after the CPI completes.
1197
+ */
1198
+ 6085: {
1199
+ name: "ErrStableFloorViolation",
1200
+ message: "Stable balance floor violated — combined USDC+USDT balance dropped below policy.stable_balance_floor",
883
1201
  category: "POLICY_VIOLATION",
884
1202
  retryable: false,
885
1203
  recovery_actions: [
886
1204
  {
887
- action: "remove_post_finalize_instructions",
888
- description: "Remove any instructions placed after finalize_session in the transaction. Only ComputeBudget and SystemProgram instructions are allowed after finalize.",
1205
+ action: "reduce_amount",
1206
+ description: "Reduce the transfer amount so the post-execution combined USDC+USDT vault balance stays at or above policy.stable_balance_floor",
1207
+ },
1208
+ {
1209
+ action: "deposit_more",
1210
+ description: "Owner can deposit additional USDC or USDT to raise the combined balance above the floor before the agent retries",
1211
+ },
1212
+ {
1213
+ action: "lower_floor",
1214
+ description: "Owner can queue a policy update to lower stable_balance_floor (timelock-gated, owner-only)",
889
1215
  },
890
1216
  ],
891
1217
  },
892
- 6064: {
893
- name: "UnexpectedBalanceDecrease",
894
- message: "Vault stablecoin balance decreased more than the session authorized amount. " +
895
- "This indicates a compromised DeFi program attempted to drain vault tokens via CPI.",
896
- category: "FATAL",
897
- retryable: false,
1218
+ /** 6095 — TA-13: per-protocol daily cap exceeded. The owner-configured
1219
+ * `policy.protocol_caps[i]` rolling-24h cap for the protocol the agent
1220
+ * is invoking would be exceeded by this transaction. Distinct from
1221
+ * 6047 (ProtocolCapExceeded), which now signals slot-allocation
1222
+ * exhaustion only — see §RP-1 V5 disposition.
1223
+ */
1224
+ 6086: {
1225
+ name: "ErrDailyCapExceeded",
1226
+ message: "Per-protocol daily spending cap would be exceeded (rolling 24h)",
1227
+ category: "SPENDING_CAP",
1228
+ retryable: true,
1229
+ retry_after_ms: 3_600_000,
898
1230
  recovery_actions: [
899
1231
  {
900
- action: "investigate_defi_program",
901
- description: "The whitelisted DeFi program may be compromised. The actual vault balance decrease " +
902
- "exceeded the authorized delegation amount (fees + DeFi spend). Freeze the vault, " +
903
- "investigate the DeFi program, and consider removing it from the protocol allowlist.",
1232
+ action: "reduce_amount",
1233
+ description: "Reduce the amount to fit within this protocol's remaining 24h rolling-window cap",
904
1234
  },
905
1235
  {
906
- action: "freeze_vault",
907
- description: "Immediately freeze the vault to prevent further transactions until the cause is identified.",
1236
+ action: "use_different_protocol",
1237
+ description: "Route through a different allowlisted protocol that has remaining 24h capacity",
1238
+ },
1239
+ {
1240
+ action: "wait",
1241
+ description: "Wait for the 24h rolling window to release spent capacity for this protocol",
1242
+ },
1243
+ ],
1244
+ },
1245
+ /** 6096 — TA-14: per-recipient daily cap exceeded. The recipient's
1246
+ * rolling-24h outflow would breach `policy.per_recipient_daily_cap_usd`.
1247
+ * Resolved via SPL TokenAccount.owner (the WALLET that holds the
1248
+ * destination ATA), NOT the meta pubkey. Eviction is age-based, never
1249
+ * LRU — array-full with no expired slot returns this code too,
1250
+ * preventing churn-eviction bypass.
1251
+ *
1252
+ * **H-10 (pre-redeploy audit 2026-05-21) — TRIPLE-CAUSE DISAMBIGUATION:**
1253
+ * The same code (6096) fires from THREE distinct branches inside
1254
+ * `programs/sigil/src/instructions/finalize_session.rs`:
1255
+ *
1256
+ * 1. **Cap exceeded** (`finalize_session.rs:654`): cumulative 24h
1257
+ * recipient outflow + this transfer > policy cap. Recovery: shrink
1258
+ * the amount, route via a different allowed recipient with cap
1259
+ * headroom, or wait for the rolling window to release capacity.
1260
+ * 2. **Multiple distinct recipients in one tx** (`finalize_session.rs:638`):
1261
+ * V1 enforces single-recipient-per-tx for per-recipient cap
1262
+ * attribution sanity. Recovery: SPLIT the bundle so each finalize
1263
+ * touches at most one allowlisted recipient
1264
+ * (`split_into_separate_transactions`).
1265
+ * 3. **`per_recipient` array full with no expired slot**
1266
+ * (`finalize_session.rs:658` via `tracker.record_recipient_spend`):
1267
+ * the fixed-size 10-slot tracker has no entry eligible for
1268
+ * age-based eviction. Recovery: wait for an entry to age out
1269
+ * (same `wait` action as cause 1).
1270
+ *
1271
+ * UX-side: callers cannot distinguish the three branches from the
1272
+ * error code alone — the recovery list below covers all three.
1273
+ */
1274
+ 6087: {
1275
+ name: "ErrRecipientCapExceeded",
1276
+ message: "Per-recipient cap blocked — three possible causes: (a) recipient outflow would breach policy.per_recipient_daily_cap_usd within rolling 24h window; (b) bundle touches multiple distinct allowlisted recipients in one finalize (V1 single-recipient-per-tx rule); (c) per_recipient tracker array full with no expired slot to evict",
1277
+ category: "SPENDING_CAP",
1278
+ retryable: true,
1279
+ retry_after_ms: 3_600_000,
1280
+ recovery_actions: [
1281
+ {
1282
+ action: "reduce_amount",
1283
+ description: "Reduce the transfer amount so the recipient's 24h rolling outflow stays under policy.per_recipient_daily_cap_usd",
1284
+ },
1285
+ {
1286
+ action: "split_into_separate_transactions",
1287
+ description: "If the bundle touches multiple distinct allowlisted recipients in one finalize, split it so each transaction touches at most one recipient. V1 enforces single-recipient-per-tx for per-recipient cap attribution.",
1288
+ },
1289
+ {
1290
+ action: "use_different_recipient",
1291
+ description: "Route the transfer to a different allowed destination that has remaining 24h cap headroom",
1292
+ },
1293
+ {
1294
+ action: "wait",
1295
+ description: "Wait for the recipient's rolling 24h window to release spent capacity (also remediates the array-full / no-evictable-slot case)",
1296
+ },
1297
+ ],
1298
+ },
1299
+ // ─── Phase 6: Maestro borrows R-1/R-2/R-3/R-4 (TA-13 absorption) ───
1300
+ // §RP-2 H-NEW-2: added Phase 6 mappings (R-1..R-4) — the predicate already
1301
+ // routes them as "Sigil error" via the >= 6000 && <= SIGIL_ON_CHAIN_ERROR_MAX
1302
+ // bound, but ON_CHAIN_ERROR_MAP had no entries, so users got "Unknown
1303
+ // on-chain error code N" with category FATAL + empty recovery.
1304
+ // Source of truth: programs/sigil/src/errors.rs + IDL.
1305
+ /** 6097 — R-1 MintDeltaCap (attack signal): combined balance of
1306
+ * vault-owned ATAs for the configured mint dropped by more than
1307
+ * `max_net_decrease` between `validate_and_authorize` (pre-snap sum)
1308
+ * and `finalize_session` (post sum). Two enforcement shapes:
1309
+ * scope=0 (vault-wide multi-ATA sum) and scope=1 (single target_account).
1310
+ * Pairs with R-2 (6099) per F-18 to close close-and-recreate evasion.
1311
+ */
1312
+ 6088: {
1313
+ name: "ErrMintDeltaCapExceeded",
1314
+ message: "Mint delta cap exceeded — net outflow of [mint] from vault exceeded policy.mint_delta_cap[mint] within the post-execution check window.",
1315
+ category: "POLICY_VIOLATION",
1316
+ retryable: false,
1317
+ recovery_actions: [
1318
+ {
1319
+ action: "verify_post_assertions",
1320
+ description: "Verify the policy.post_assertions configuration for the affected mint. Reduce transaction outflow or raise the per-mint cap via queue_policy_update (timelock-gated).",
908
1321
  },
909
1322
  ],
910
1323
  },
911
- // --- TOCTOU + timelock hardening errors ---
912
- 6065: {
913
- name: "TimelockTooShort",
914
- message: "Timelock duration is below the minimum (1800 seconds / 30 minutes).",
915
- category: "INPUT_VALIDATION",
1324
+ /** 6098 R-1 MintDeltaCap (caller-bug signal): entry's accounts
1325
+ * couldn't be resolved at validate time. Common shapes:
1326
+ * - scope=1 and target_account not present in remaining_accounts
1327
+ * - target_account's mint field doesn't match the configured mint
1328
+ * - target_account isn't owned by the vault
1329
+ * - scope=0 with no derived ATAs supplied in remaining_accounts
1330
+ * Distinct from ErrMintDeltaCapExceeded because this is a
1331
+ * configuration or caller-side bug (recoverable by fixing the caller),
1332
+ * not an attack signal (which fires 6097 at finalize).
1333
+ */
1334
+ 6089: {
1335
+ name: "MintDeltaCapMisconfigured",
1336
+ message: "Mint delta cap entry misconfigured — invalid scope value, zero max_net_decrease, or required derived ATA missing from remaining_accounts.",
1337
+ category: "FATAL",
916
1338
  retryable: false,
917
1339
  recovery_actions: [
918
1340
  {
919
- action: "increase_timelock",
920
- description: "Set timelock_duration to at least 1800 seconds (30 minutes).",
1341
+ action: "inspect_entry_config",
1342
+ description: "Inspect the failed entry's scope value (0 or 1 only), max_net_decrease (must be non-zero for scope=0), and remaining_accounts (must include every derived ATA for scope=0).",
921
1343
  },
922
1344
  ],
923
1345
  },
924
- 6066: {
925
- name: "PolicyVersionMismatch",
926
- message: "Policy version changed since agent's last RPC read. Re-resolve vault state and retry.",
927
- category: "TRANSIENT",
928
- retryable: true,
929
- retry_after_ms: 1000,
1346
+ /** 6099 — R-2 AtaAuthorityPin (attack signal): a vault-owned token
1347
+ * account had its authority changed during the sandwich, or was
1348
+ * closed and not reinstated as a vault-owned account before finalize.
1349
+ * Detected by reading bytes 32..64 of the post-CPI token account data
1350
+ * and comparing to `vault.key().to_bytes()`. Also fires when the
1351
+ * account is closed (data length < 64) or its owner program is no
1352
+ * longer SPL Token or Token-2022. Pairs with 6097 to close F-18
1353
+ * close+drain+recreate.
1354
+ */
1355
+ 6090: {
1356
+ name: "ErrAtaAuthorityChanged",
1357
+ message: "Vault ATA authority changed mid-transaction — a CPI altered the SPL TokenAccount owner field, defeating the vault's custody.",
1358
+ category: "POLICY_VIOLATION",
1359
+ retryable: false,
930
1360
  recovery_actions: [
931
1361
  {
932
- action: "re_resolve_state",
933
- description: "Re-fetch vault state via resolveVaultState() to get current policy version, then retry.",
1362
+ action: "audit_ix_for_set_authority",
1363
+ description: "Verify the DeFi instruction in the bundle does not call setAuthority on any vault-owned ATA. Refuse the bundle and audit the agent's request.",
934
1364
  },
935
1365
  ],
936
1366
  },
937
- 6067: {
938
- name: "ActiveSessionsExist",
939
- message: "Cannot close vault with active sessions. Finalize all pending sessions first.",
1367
+ /** 6100 — R-3 OutputBalanceFloor (attack signal): a token account
1368
+ * that was supposed to receive at least `min_increase` units of its
1369
+ * mint during the sandwich did not. Snapshot at
1370
+ * `validate_and_authorize` against `target_account.amount` (u64 LE at
1371
+ * bytes 64..72), finalize requires (post - pre) >= aux_value.
1372
+ * Counter to "dust-fill" attacks where the agent obtains delegation
1373
+ * authority then runs a swap that returns 1 lamport.
1374
+ */
1375
+ 6091: {
1376
+ name: "ErrOutputBelowFloor",
1377
+ message: "Output balance floor violated — the vault's target ATA gained less than policy.min_increase_usd after the post-execution check.",
940
1378
  category: "POLICY_VIOLATION",
941
- retryable: true,
942
- retry_after_ms: 10000,
1379
+ retryable: false,
943
1380
  recovery_actions: [
944
1381
  {
945
- action: "finalize_sessions",
946
- description: "Wait for active sessions to finalize or expire, then retry close_vault.",
1382
+ action: "audit_output_value",
1383
+ description: "Verify the DeFi instruction's output. Common causes: dust-fill swap, partial fill, wrong destination meta. Audit the agent's slippage settings.",
947
1384
  },
948
1385
  ],
949
1386
  },
950
- // --- Post-execution assertions (Phase B scaffolding) ---
951
- 6068: {
952
- name: "PostAssertionFailed",
953
- message: "Post-execution assertion failed: account state did not satisfy constraint.",
1387
+ /** 6101 — R-4 DeclarationConsistency (attack signal): the
1388
+ * (recipient, mint) pair declared on a post-assertion entry doesn't
1389
+ * match the SPL token account at the configured CPI account-meta
1390
+ * index. Closes the "declaration dishonesty" attack: agent declares
1391
+ * "recipient: alice" to satisfy a destination-allowlist check, then
1392
+ * inserts attacker_ata into the CPI metas. The recipient who would
1393
+ * receive funds (attacker_ata.owner) ≠ alice, so R-4 rejects.
1394
+ */
1395
+ 6092: {
1396
+ name: "ErrDeclarationInconsistent",
1397
+ message: "Declaration consistency check failed — the CPI account meta at the declared index is not a token account matching the agent's declared recipient + mint.",
954
1398
  category: "POLICY_VIOLATION",
955
1399
  retryable: false,
956
1400
  recovery_actions: [
957
1401
  {
958
- action: "review_assertions",
959
- description: "Review the vault's post-execution assertions. The trade's resulting account state violated a configured assertion.",
1402
+ action: "verify_declaration_matches_ix",
1403
+ description: "Verify the agent's authorized_token + output_mint declaration matches the actual SPL TokenAccount at the declared meta index in the DeFi instruction. Reject the bundle if the agent supplied inconsistent declaration.",
960
1404
  },
961
1405
  ],
962
1406
  },
963
- 6069: {
964
- name: "InvalidPostAssertionIndex",
965
- message: "Post-assertion references an invalid instruction index.",
966
- category: "INPUT_VALIDATION",
1407
+ // ─── Audit 2026-05-19 (P1 HIGH fixes) ───
1408
+ // §RP-2 H-NEW-2: H-1 hard-reject mapping for the destination-check
1409
+ // meta budget. Previously the helper silently take()-truncated at 16;
1410
+ // 1f569eb made it a hard-reject (POLICY_VIOLATION).
1411
+ /** 6102 — H-1 hard-reject (audit 2026-05-19): the foreign DeFi
1412
+ * instruction passed more account metas than
1413
+ * `MAX_DESTINATION_CHECK_METAS_PER_IX` (16). Previously the helper
1414
+ * silently `take()`-truncated at the bound, leaving slots 17+
1415
+ * uninspected; an attacker hiding a hostile destination at slot 17+
1416
+ * would bypass the allowlist check. Hard-reject closes the
1417
+ * silent-drop. Expansion to 32 metas is v1.1 backlog (~+4K CU).
1418
+ */
1419
+ 6093: {
1420
+ name: "IxMetaCountExceeded",
1421
+ message: "Foreign instruction exceeded the account-meta processing budget (destination check: max 24 writable metas / 64 total; agent_transfer floor-walk: 16). The bundle is rejected rather than partially inspected.",
1422
+ category: "POLICY_VIOLATION",
967
1423
  retryable: false,
968
1424
  recovery_actions: [
969
1425
  {
970
- action: "fix_assertions",
971
- description: "Review and update the vault's post-assertion configuration.",
1426
+ action: "use_a_shorter_route",
1427
+ description: "The route references more writable accounts than the guard can inspect in one pass. Use a shorter Jupiter route; Sigil never reshapes the route itself — an unguardable route atomically reverts.",
972
1428
  },
973
1429
  ],
974
1430
  },
975
- 6070: {
976
- name: "UnauthorizedPreValidateInstruction",
977
- message: "Non-infrastructure instruction detected before validate_and_authorize.",
978
- category: "PERMISSION",
1431
+ // --- Phase 8 (ownership transfer + freeze hardening) ---
1432
+ // Phase 8 ownership-transfer + freeze-hardening codes (now 6094-6099 post M1-04).
1433
+ 6094: {
1434
+ name: "ErrPendingOwnershipExists",
1435
+ message: "An ownership transfer is already pending for this vault. Cancel the existing transfer before queueing a new target.",
1436
+ category: "POLICY_VIOLATION",
979
1437
  retryable: false,
980
1438
  recovery_actions: [
981
1439
  {
982
- action: "fix_instruction_order",
983
- description: "Place validate_and_authorize before any DeFi or program instruction.",
1440
+ action: "cancel_ownership_transfer",
1441
+ description: "Call cancel_ownership_transfer to release the pending PDA before queueing a new transfer.",
984
1442
  },
985
1443
  ],
986
1444
  },
987
- 6071: {
988
- name: "SnapshotNotCaptured",
989
- message: "Delta assertion snapshot was not captured in validate_and_authorize.",
990
- category: "INPUT_VALIDATION",
991
- retryable: false,
1445
+ 6095: {
1446
+ name: "ErrPendingOwnershipNotReady",
1447
+ message: "Ownership transfer timelock has not elapsed yet (default 48h). The new owner cannot accept until the window passes.",
1448
+ category: "TRANSIENT",
1449
+ retryable: true,
992
1450
  recovery_actions: [
993
1451
  {
994
- action: "fix_assertions",
995
- description: "Ensure validate_and_authorize captures a snapshot before finalize delta check.",
1452
+ action: "wait_timelock",
1453
+ description: "Wait for the timelock window to elapse. The owner can cancel during this window to abort the transfer.",
996
1454
  },
997
1455
  ],
998
1456
  },
999
- 6072: {
1000
- name: "InvalidConstraintOperator",
1001
- message: "Constraint operator value is not a valid ConstraintOperator discriminant.",
1457
+ 6096: {
1458
+ name: "ErrInvalidFreezeReason",
1459
+ message: "Invalid freeze_reason byte (must be 0=Manual, 1=AutoRevoke, or 2=EmergencyBoard).",
1002
1460
  category: "INPUT_VALIDATION",
1003
1461
  retryable: false,
1004
1462
  recovery_actions: [
1005
1463
  {
1006
- action: "fix_constraints",
1007
- description: "Ensure constraint operators are valid (0-6).",
1464
+ action: "fix_freeze_reason",
1465
+ description: "Re-call freeze_vault with a valid FreezeReason discriminant.",
1008
1466
  },
1009
1467
  ],
1010
1468
  },
1011
- 6073: {
1012
- name: "ConstraintsVaultMismatch",
1013
- message: "Zero-copy constraints account has wrong vault.",
1014
- category: "INPUT_VALIDATION",
1015
- retryable: false,
1469
+ 6097: {
1470
+ name: "ErrReactivateCooldownActive",
1471
+ message: "Reactivate requires a 5-minute observation cooldown after the vault was frozen. Try again after the cooldown elapses.",
1472
+ category: "TRANSIENT",
1473
+ retryable: true,
1474
+ retry_after_ms: 300_000,
1016
1475
  recovery_actions: [
1017
1476
  {
1018
- action: "verify_pda",
1019
- description: "The constraints PDA does not belong to this vault.",
1477
+ action: "wait_cooldown",
1478
+ description: "Wait for the 5-minute observation window to elapse before reactivating.",
1020
1479
  },
1021
1480
  ],
1022
1481
  },
1023
- 6074: {
1024
- name: "BlockedSplOpcode",
1025
- message: "SPL opcode is blocked at runtime and cannot be used in constraints.",
1482
+ 6098: {
1483
+ name: "ErrInvalidOwnershipTarget",
1484
+ message: "new_owner cannot be a system/program/sysvar address (would permanently brick the vault).",
1026
1485
  category: "INPUT_VALIDATION",
1027
1486
  retryable: false,
1028
1487
  recovery_actions: [
1029
1488
  {
1030
- action: "fix_constraints",
1031
- description: "Remove blocked SPL opcode from the constraint entryuse allowlisted opcodes only.",
1489
+ action: "use_signer_pubkey",
1490
+ description: "Pass an EOA pubkey or Squads V4 vault PDA as new_owner not SystemProgram, the program ID, or a sysvar.",
1032
1491
  },
1033
1492
  ],
1034
1493
  },
1035
- // F-10 audit fix: durable-nonce pre-signing defense
1036
- 6075: {
1037
- name: "QueuedUpdateExpired",
1038
- message: "Queued update is too old (>MAX_APPLY_AGE_SLOTS) — re-queue to apply. Defends against durable-nonce pre-signing.",
1039
- category: "POLICY_VIOLATION",
1494
+ 6099: {
1495
+ name: "ErrTooManyRevokePairs",
1496
+ message: "freeze_internal received more than MAX_REVOKE_PAIRS (10) session/token pairs in remaining_accounts.",
1497
+ category: "INPUT_VALIDATION",
1040
1498
  retryable: false,
1041
1499
  recovery_actions: [
1042
1500
  {
1043
- action: "requeue",
1044
- description: "Re-queue the update via queue_policy_update / queue_constraints_update / queue_close_constraints / queue_agent_permissions_update — the original queued update is past the freshness window.",
1501
+ action: "split_revoke_batch",
1502
+ description: "Split the (session_pda, token_account) pairs across multiple freeze_internal calls.",
1045
1503
  },
1046
1504
  ],
1047
1505
  },
1048
- 6076: {
1049
- name: "AccountWritabilityMismatch",
1050
- message: "Account writability flag does not match the constraint requirement (read-only vs writable).",
1051
- category: "INPUT_VALIDATION",
1506
+ // H-3 close (pre-redeploy audit 2026-05-21): close_vault rejects if
1507
+ // policy.has_post_assertions != 0 because the 672-byte PostExecutionAssertions
1508
+ // zero-copy PDA must be drained via close_post_assertions first; otherwise it
1509
+ // would be orphaned on close.
1510
+ 6100: {
1511
+ name: "ErrPostAssertionsNotClosed",
1512
+ message: "PostExecutionAssertions PDA still active — call close_post_assertions before close_vault.",
1513
+ category: "RESOURCE_NOT_FOUND",
1052
1514
  retryable: false,
1053
1515
  recovery_actions: [
1054
1516
  {
1055
- action: "fix_constraints",
1056
- description: "Match the writability flag (read-only or writable) of the account passed to the instruction with the constraint's is_writable_required value.",
1517
+ action: "close_post_assertions",
1518
+ description: "Invoke the close_post_assertions instruction to drain the 672-byte PostExecutionAssertions PDA, then retry close_vault.",
1057
1519
  },
1058
1520
  ],
1059
1521
  },
1060
- // M11 SIMD-0296 pad-attack DoS guard
1061
- 6077: {
1062
- name: "SysvarScanBoundExceeded",
1063
- message: "Sysvar instruction scan exceeded the per-tx safety bound (MAX_SYSVAR_SCAN_ITERATIONS=64).",
1522
+ // H-4 close (pre-redeploy audit 2026-05-21, Bucket 1): queue_policy_update
1523
+ // rejects if any allowed_destinations entry is the address of a Sigil-owned
1524
+ // protected PDA for this vault. Closes the owner-self-foot-gun where a
1525
+ // phished owner allowlists a Sigil PDA, enabling an agent to lock funds
1526
+ // at the PDA via a token transfer.
1527
+ 6101: {
1528
+ name: "ErrDestinationIsProtectedPda",
1529
+ message: "allowed_destinations entry is a Sigil-protected PDA — owner attempted to allowlist a vault/policy/pending_* PDA.",
1064
1530
  category: "INPUT_VALIDATION",
1065
1531
  retryable: false,
1066
1532
  recovery_actions: [
1067
1533
  {
1068
- action: "fix_transaction_shape",
1069
- description: "Reduce the number of instructions in the transaction. The on-chain sysvar walk is bounded at 64 ix to defend against pad-attack DoS (M11 / SIMD-0296). Legitimate flows fit well under this cap.",
1534
+ action: "remove_protected_pda_from_destinations",
1535
+ description: "Remove any pubkey from allowed_destinations that matches a Sigil-protected PDA for this vault. Use a plain EOA or external program owner instead.",
1070
1536
  },
1071
1537
  ],
1072
1538
  },
1073
- // C4 audit fix: async-fulfillment program deny
1074
- 6078: {
1075
- name: "AsyncFulfillmentNotPermitted",
1076
- message: "Async-fulfillment programs (Jupiter Perps, Drift v2, Drift JIT) are not permitted in V1 — keeper-driven settlement happens after finalize_session returns and cannot be measured against the spending cap.",
1539
+ // D-1 + D-6 close (Bucket 2 audit 2026-05-21): AL3 on-chain scalar intent-
1540
+ // digest mismatch. The wallet's preview-time digest doesn't match the
1541
+ // digest the on-chain verifier recomputed from validate_and_authorize's
1542
+ // args. Most likely: man-in-the-middle (compromised agent / browser ext)
1543
+ // swapped one of the scalar fields (mint, amount, target_protocol)
1544
+ // between preview and submit. Less likely: cross-network replay
1545
+ // (mainnet digest sent through a devnet program).
1546
+ 6102: {
1547
+ name: "ErrIntentDigestMismatch",
1548
+ message: "AL3 intent-digest mismatch — wallet preview digest does not match the executed bundle's scalars.",
1077
1549
  category: "POLICY_VIOLATION",
1078
1550
  retryable: false,
1079
1551
  recovery_actions: [
1080
1552
  {
1081
- action: "use_supported_protocol",
1082
- description: "Use a synchronous protocol (Jupiter swap, Jupiter Lend, etc.). V1.1 will add a sanctioned async-friendly path with settlement-tracked counters or post-execution attestation.",
1553
+ action: "rebuild_seal_from_fresh_preview",
1554
+ description: "Re-run the wallet preview to refresh the intent digest, then resubmit. If the mismatch persists after a fresh preview, suspect a compromised middleware/agent pause the agent and investigate.",
1083
1555
  },
1084
1556
  ],
1085
1557
  },
1086
- // Orphan constraints PDA cleanup (F3-H1 audit fix)
1087
- 6079: {
1088
- name: "ConstraintsAlreadyPopulated",
1089
- message: "Cannot clean an active constraints PDA via cleanup_orphan_constraints_pda — use queue_close_constraints + apply_close_constraints instead.",
1090
- category: "INPUT_VALIDATION",
1558
+ // M-5 close (Bucket 2 audit 2026-05-21, PEN-CROSS-3): apply_agent_grant
1559
+ // rejected because the recomputed digest of PendingAgentGrant content
1560
+ // doesn't match the queue-time digest. Same digest-binding defense class
1561
+ // as the policy/ownership pending-update digest checks.
1562
+ 6103: {
1563
+ name: "ErrPendingAgentGrantDigestMismatch",
1564
+ message: "PendingAgentGrant content tampered between queue and apply — digest mismatch.",
1565
+ category: "POLICY_VIOLATION",
1091
1566
  retryable: false,
1092
1567
  recovery_actions: [
1093
1568
  {
1094
- action: "use_close_path",
1095
- description: "Route through the timelocked close-constraints path; the orphan-cleanup instruction only operates on never-populated PDAs (partial allocate+extend chain).",
1569
+ action: "cancel_and_requeue_agent_grant",
1570
+ description: "Cancel the pending grant via cancel_agent_grant, then queue a fresh grant with the intended agent + capability.",
1096
1571
  },
1097
1572
  ],
1098
1573
  },
1099
- 6080: {
1100
- name: "OrphanPdaWrongOwner",
1101
- message: "PDA at the constraints seeds is not owned by the Sigil program.",
1102
- category: "INPUT_VALIDATION",
1574
+ // D-5 close (Bucket 2 audit 2026-05-21, F-RP3-1): reactivate_vault
1575
+ // rejected a FULL_CAPABILITY agent graft because no non-owner signer was
1576
+ // present. Defaults-on safety (NH-1): any FULL_CAPABILITY grant on
1577
+ // reactivate requires a second signer, regardless of whether
1578
+ // policy.cosign_session_pubkey was pre-configured. Closes the phished-
1579
+ // owner freeze→reactivate(attacker, FULL) single-signature foot-gun.
1580
+ 6104: {
1581
+ name: "ErrReactivateCosignRequiredForFullCapability",
1582
+ message: "Reactivate with a FULL_CAPABILITY new agent requires a non-owner cosigner.",
1583
+ category: "ESCALATION_REQUIRED",
1103
1584
  retryable: false,
1104
1585
  recovery_actions: [
1105
1586
  {
1106
- action: "verify_pda",
1107
- description: "Verify the PDA derivation: it must be owned by the Sigil program and match seeds (vault, constraints).",
1587
+ action: "include_second_signer_in_remaining_accounts",
1588
+ description: "Re-sign the reactivate transaction with a second non-owner signer in remaining_accounts. If policy.cosign_session_pubkey is set, the signer must match it.",
1108
1589
  },
1109
1590
  ],
1110
1591
  },
1111
- 6081: {
1112
- name: "OrphanPdaPopulated",
1113
- message: "PDA is fully populated (carries the Anchor discriminator) not an orphan; cannot be cleaned.",
1114
- category: "INPUT_VALIDATION",
1592
+ 6105: {
1593
+ name: "DestinationAccountUnresolvable",
1594
+ message: "A writable account of the DeFi instruction could not be resolved in validate's remaining_accounts, so the guard cannot classify it (F-Q1a destination completeness — rejected fail-closed rather than silently skipped).",
1595
+ category: "POLICY_VIOLATION",
1115
1596
  retryable: false,
1116
1597
  recovery_actions: [
1117
1598
  {
1118
- action: "use_close_path",
1119
- description: "Route fully-populated constraints PDAs through queue_close_constraints + apply_close_constraints.",
1599
+ action: "use_seal_to_populate_remaining_accounts",
1600
+ description: "Build the bundle with seal(), which auto-populates validate's (and finalize's) remaining_accounts with every writable account of the DeFi instruction (the fee-payer agent included). Hand-built bundles must mirror this.",
1120
1601
  },
1121
1602
  ],
1122
1603
  },
1123
- // PR 7: Token-2022 opcode blocks (M3 + Pentester HIGH/MED + third-pass audit)
1124
- 6082: {
1125
- name: "ConfidentialTransferBlocked",
1126
- message: "Token-2022 ConfidentialTransfer is not permitted between validate_and_authorize and finalize_session.",
1604
+ 6106: {
1605
+ name: "ErrToken2022OutputMintUnresolvable",
1606
+ message: "A vault-owned Token-2022 token account's mint could not be resolved in validate's remaining_accounts (or the supplied account is not Token-2022-owned), so the guard cannot vet its extensions (F-Q4 — rejected fail-closed). A PermanentDelegate / TransferHook / ConfidentialTransfer mint must be vetted before the vault may acquire the token.",
1127
1607
  category: "POLICY_VIOLATION",
1128
1608
  retryable: false,
1129
1609
  recovery_actions: [
1130
1610
  {
1131
- action: "use_supported_protocol",
1132
- description: "Token-2022 ConfidentialTransfer (opcode 27/42) hides spending amounts from sysvar accounting and cannot be tracked. Use the standard SPL Token transfer or Jupiter swap path instead.",
1611
+ action: "use_seal_to_populate_remaining_accounts",
1612
+ description: "Build the bundle with seal(), which auto-resolves vault-owned Token-2022 output mints (reading each writable account's mint on-chain) and feeds them into validate's remaining_accounts. Hand-built bundles must include the mint account of every vault-owned Token-2022 token account the swap writes.",
1133
1613
  },
1134
1614
  ],
1135
1615
  },
1136
- 6083: {
1137
- name: "PermanentDelegateBlocked",
1138
- message: "Token-2022 PermanentDelegate is not permitted between validate_and_authorize and finalize_session.",
1616
+ 6107: {
1617
+ name: "ErrOperatorGrantRequiresTimelock",
1618
+ message: "An OPERATOR-class agent grant cannot be seated instantly on this vault (single-key, cosign-required-but-unbound, or any vault with a configured operator_grant_delay_seconds > 0). It must route through the timelocked queue_agent_grant → apply_agent_grant path — the time-delay substitutes for the missing 2nd authorization factor (F-Q6).",
1139
1619
  category: "POLICY_VIOLATION",
1140
1620
  retryable: false,
1141
1621
  recovery_actions: [
1142
1622
  {
1143
- action: "use_supported_protocol",
1144
- description: "Token-2022 PermanentDelegate (opcode 35) installs a session-bound delegate that survives finalize. Reject up-front; use a per-tx Approve instead.",
1623
+ action: "use_queue_agent_grant",
1624
+ description: "Seat the OPERATOR via queue_agent_grant, wait the effective delay (>=10 min for a single-key vault, else the configured operator_grant_delay_seconds), then apply_agent_grant. A cosign-bound vault at zero delay can seat instantly by including the bound cosigner's signature in register_agent.",
1145
1625
  },
1146
1626
  ],
1147
1627
  },
1148
- 6084: {
1149
- name: "TransferHookBlocked",
1150
- message: "Token-2022 TransferHook is not permitted between validate_and_authorize and finalize_session.",
1628
+ 6108: {
1629
+ name: "ErrOperatorGrantDelayTooLong",
1630
+ message: "operator_grant_delay_seconds exceeds the maximum (48h / 172800s). A larger delay could exceed the apply-time freshness ceiling and leave a queued OPERATOR grant permanently unapplyable, so it is rejected at configuration time (F-Q6).",
1151
1631
  category: "POLICY_VIOLATION",
1152
1632
  retryable: false,
1153
1633
  recovery_actions: [
1154
1634
  {
1155
- action: "use_supported_protocol",
1156
- description: "Token-2022 TransferHook (opcode 36) routes mid-tx control to attacker-chosen code. Use a non-hook mint or whitelist the hook program in V1.1.",
1635
+ action: "lower_operator_grant_delay",
1636
+ description: "Set operator_grant_delay_seconds to at most 172800 (48h) in the queue_policy_update call.",
1157
1637
  },
1158
1638
  ],
1159
1639
  },
1160
- 6085: {
1161
- name: "LamportDrainBlocked",
1162
- message: "Token-2022 destructive-balance instruction (opcode 38/45/46) is not permitted between validate_and_authorize and finalize_session.",
1640
+ 6109: {
1641
+ name: "InvalidOwnerType",
1642
+ message: "vault.owner_type held a value outside the recognized discriminants (0 = EOA, 1 = multisig) at an OPERATOR-grant read site. Only reachable via on-chain state corruption (the field is program-set to {0,1}); the operation is rejected rather than acting on corrupted authority state (F-Q6).",
1163
1643
  category: "POLICY_VIOLATION",
1164
1644
  retryable: false,
1165
1645
  recovery_actions: [
1166
1646
  {
1167
- action: "use_supported_protocol",
1168
- description: "WithdrawExcessLamports/UnwrapLamports/PermissionedBurnExtension drain SOL or balances outside the spending-cap path. Block at the gate; V1.1 may add an owner-allowlist for legitimate uses.",
1647
+ action: "report_state_corruption",
1648
+ description: "vault.owner_type is program-set to 0 (EOA) or 1 (multisig); an out-of-range value indicates on-chain state corruption and should be unreachable in normal operation. OPERATOR-grant paths are blocked until the vault state is valid — report this.",
1169
1649
  },
1170
1650
  ],
1171
1651
  },
1172
- 6086: {
1173
- name: "BatchInstructionBlocked",
1174
- message: "Token-2022 Batch instruction (opcode 255) is blocked outright wraps inner instructions and bypasses the byte-0 blocklist.",
1652
+ 6110: {
1653
+ name: "SpendAccountingUnderflow",
1654
+ message: "finalize_session detected collected fees exceeding the realized stablecoin outflow (fees_collected > total_decrease) — an accounting impossibility, since fees are CPI'd out before the DeFi leg. The transaction is rejected fail-closed rather than under-counting the spend against the caps (F-Q9).",
1175
1655
  category: "POLICY_VIOLATION",
1176
1656
  retryable: false,
1177
1657
  recovery_actions: [
1178
1658
  {
1179
- action: "use_supported_protocol",
1180
- description: "Token-2022 Batch (opcode 255) wraps inner TokenInstructions; the byte-0 blocklist cannot see them. Submit each inner ix as its own top-level instruction so guards can inspect each.",
1659
+ action: "review_swap_construction",
1660
+ description: "This fires when a stablecoin-input action net-returned stablecoin so the measured outflow was smaller than the protocol+developer fees. Verify the DeFi instruction actually spends the declared stablecoin input; a net-return on the stablecoin-input path is anomalous and is rejected.",
1181
1661
  },
1182
1662
  ],
1183
1663
  },
1184
- // F-4 audit fix: explicit destination_mode (default Restricted closes default-allow drain)
1185
- 6087: {
1186
- name: "InvalidDestinationMode",
1187
- message: "Invalid destination mode (must be 0 = Restricted or 1 = OpenWithCap).",
1188
- category: "INPUT_VALIDATION",
1664
+ 6111: {
1665
+ name: "ErrMultisigCustodyUnsupported",
1666
+ message: "Squads multisig ownership custody is disabled in V1. Sigil's top-level-only (reject_cpi!) model is architecturally incompatible with a Squads multisig owner — a multisig acts on external programs only by CPI from vault_transaction_execute, but every Sigil owner instruction rejects CPI, so a multisig owner could neither accept ownership nor operate the vault afterward (and the prior path could brick the vault by setting an unsignable owner). initiate_ownership_transfer rejects is_multisig_target = true; accept_ownership_transfer_multisig rejects unconditionally (H-1, audit 2026-06-11).",
1667
+ category: "POLICY_VIOLATION",
1189
1668
  retryable: false,
1190
1669
  recovery_actions: [
1191
1670
  {
1192
- action: "fix_policy",
1193
- description: "Pass destination_mode = 0 (Restricted, default) or 1 (OpenWithCap, explicit opt-in to drain blast radius).",
1671
+ action: "use_eoa_owner",
1672
+ description: "Use a standard EOA (single-key) owner for the vault. Multisig custody is deferred to a future release (CPI-aware or Sigil-native M-of-N) pending re-audit.",
1194
1673
  },
1195
1674
  ],
1196
1675
  },
@@ -1694,7 +2173,7 @@ const SDK_ERRORS = {
1694
2173
  * Convert any error into a structured AgentError.
1695
2174
  *
1696
2175
  * Handles:
1697
- * - On-chain Anchor errors (code 6000-6087)
2176
+ * - On-chain Anchor errors (code 6000-6102)
1698
2177
  * - SDK errors (code 7000-7033)
1699
2178
  * - Network/RPC errors (from message patterns)
1700
2179
  * - Unknown errors (wrapped as FATAL)
@@ -1995,8 +2474,11 @@ function extractErrorCode(error) {
1995
2474
  if (!error || typeof error !== "object")
1996
2475
  return null;
1997
2476
  const e = error;
1998
- // Direct code property
1999
- if (typeof e.code === "number" && e.code >= 6000 && e.code <= 6087)
2477
+ // Direct code property — uses SIGIL_ON_CHAIN_ERROR_{MIN,MAX} constants
2478
+ // defined at top of file as single source of truth.
2479
+ if (typeof e.code === "number" &&
2480
+ e.code >= SIGIL_ON_CHAIN_ERROR_MIN &&
2481
+ e.code <= SIGIL_ON_CHAIN_ERROR_MAX)
2000
2482
  return e.code;
2001
2483
  // Anchor error structure
2002
2484
  if (e.error && typeof e.error === "object") {
@@ -2012,7 +2494,7 @@ function extractErrorCode(error) {
2012
2494
  const match = e.message.match(/custom program error: 0x([0-9a-fA-F]+)/);
2013
2495
  if (match) {
2014
2496
  const code = parseInt(match[1], 16);
2015
- if (code >= 6000 && code <= 6087)
2497
+ if (code >= SIGIL_ON_CHAIN_ERROR_MIN && code <= SIGIL_ON_CHAIN_ERROR_MAX)
2016
2498
  return code;
2017
2499
  }
2018
2500
  }
@@ -2169,17 +2651,6 @@ const SDK_ERROR_PATTERNS = [
2169
2651
  },
2170
2652
  ],
2171
2653
  },
2172
- {
2173
- pattern: /Escrow action/,
2174
- category: "INPUT_VALIDATION",
2175
- retryable: false,
2176
- recovery_actions: [
2177
- {
2178
- action: "use_escrow_api",
2179
- description: "Use createEscrow/settleEscrow/refundEscrow instead of wrap().",
2180
- },
2181
- ],
2182
- },
2183
2654
  ];
2184
2655
  // ─── SigilSdkError ──────────────────────────────────────────────────────────
2185
2656
  /**
@@ -2229,11 +2700,37 @@ export class SigilSdkError extends Error {
2229
2700
  * Returns a SigilSdkError (extends Error) so instanceof Error checks still work.
2230
2701
  *
2231
2702
  * Processing order:
2232
- * 1. Try on-chain error extraction via toAgentError() (numeric codes 6000-6087)
2703
+ * 1. Try on-chain error extraction via toAgentError() (numeric codes 6000-6102)
2233
2704
  * 2. Pattern-match SDK error messages (11 patterns from seal.ts throw sites)
2234
2705
  * 3. Fallback to UNKNOWN/FATAL
2235
2706
  */
2236
2707
  export function toSigilAgentError(err) {
2708
+ // Phase 9 Batch M §RP CRIT-1 fix: preserve SigilSdkDomainError and
2709
+ // SigilRpcError instances unmodified. These are the canonical
2710
+ // SDK-domain-typed errors carrying their own `.code`, structured
2711
+ // `.context`, and rich `.message`. Funneling them through the
2712
+ // pattern-matcher + UNKNOWN/FATAL fallback below silently strips
2713
+ // the context the throw site built (vault address, docs URL,
2714
+ // opt-in/opt-out snippets, network identifier, etc.).
2715
+ //
2716
+ // Wrap the domain error in a SigilSdkError that mirrors its code
2717
+ // + context so downstream consumers narrowing on either
2718
+ // `err instanceof SigilSdkDomainError` (the original throw) OR
2719
+ // `err.code === SIGIL_ERROR__SDK__MAINNET_CONFIRMATION_REQUIRED`
2720
+ // (the SigilSdkError surface) both work.
2721
+ if (err instanceof Error &&
2722
+ typeof err.code === "string" &&
2723
+ err.code.startsWith("SIGIL_ERROR__")) {
2724
+ const sigilErr = err;
2725
+ return new SigilSdkError({
2726
+ code: sigilErr.code,
2727
+ message: sigilErr.message,
2728
+ category: "FATAL",
2729
+ retryable: false,
2730
+ recovery_actions: [],
2731
+ context: sigilErr.context ?? {},
2732
+ });
2733
+ }
2237
2734
  // Try on-chain error extraction first
2238
2735
  const onChain = toAgentError(err);
2239
2736
  if (onChain.code !== "UNKNOWN")