@ixo/editor 6.35.5 → 7.0.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 (328) hide show
  1. package/dist/{BidConfig-4AQPVSPC.js → BidConfig-ZH625SNZ.js} +12 -13
  2. package/dist/{BidConfig-4AQPVSPC.js.map → BidConfig-ZH625SNZ.js.map} +1 -1
  3. package/dist/{BidFlowDetail-ET3TZUFV.js → BidFlowDetail-SZMKY75S.js} +18 -19
  4. package/dist/{BidFlowDetail-ET3TZUFV.js.map → BidFlowDetail-SZMKY75S.js.map} +1 -1
  5. package/dist/{CalendarEventCreateConfig-IRPEASQE.js → CalendarEventCreateConfig-F7EYC4VL.js} +13 -14
  6. package/dist/{CalendarEventCreateConfig-IRPEASQE.js.map → CalendarEventCreateConfig-F7EYC4VL.js.map} +1 -1
  7. package/dist/{CalendarEventCreateFlowDetail-XGSRNIDZ.js → CalendarEventCreateFlowDetail-JMYDUZRK.js} +14 -15
  8. package/dist/{CalendarEventCreateFlowDetail-XGSRNIDZ.js.map → CalendarEventCreateFlowDetail-JMYDUZRK.js.map} +1 -1
  9. package/dist/{CalendarEventListConfig-I3BQR3DL.js → CalendarEventListConfig-RRIV7IZG.js} +13 -14
  10. package/dist/{CalendarEventListConfig-I3BQR3DL.js.map → CalendarEventListConfig-RRIV7IZG.js.map} +1 -1
  11. package/dist/{CalendarEventListFlowDetail-SSRTOXIX.js → CalendarEventListFlowDetail-6LN4I3SI.js} +7 -5
  12. package/dist/{CalendarEventListFlowDetail-SSRTOXIX.js.map → CalendarEventListFlowDetail-6LN4I3SI.js.map} +1 -1
  13. package/dist/{CalendarEventUpdateConfig-O3YZKZIM.js → CalendarEventUpdateConfig-SARWZZG4.js} +13 -14
  14. package/dist/{CalendarEventUpdateConfig-O3YZKZIM.js.map → CalendarEventUpdateConfig-SARWZZG4.js.map} +1 -1
  15. package/dist/{CalendarEventUpdateFlowDetail-K4DSHL6C.js → CalendarEventUpdateFlowDetail-KZ2FG76Z.js} +14 -15
  16. package/dist/{CalendarEventUpdateFlowDetail-K4DSHL6C.js.map → CalendarEventUpdateFlowDetail-KZ2FG76Z.js.map} +1 -1
  17. package/dist/{ClaimConfig-2Q5W3Y4C.js → ClaimConfig-PMRVROQ7.js} +12 -13
  18. package/dist/{ClaimConfig-2Q5W3Y4C.js.map → ClaimConfig-PMRVROQ7.js.map} +1 -1
  19. package/dist/{ClaimFlowDetail-PKXLVOXC.js → ClaimFlowDetail-3364FIDU.js} +18 -19
  20. package/dist/{ClaimFlowDetail-PKXLVOXC.js.map → ClaimFlowDetail-3364FIDU.js.map} +1 -1
  21. package/dist/{CollectionLifecycleConfig-LCCGZ3CJ.js → CollectionLifecycleConfig-YPTZZJ3S.js} +6 -4
  22. package/dist/{CollectionLifecycleConfig-LCCGZ3CJ.js.map → CollectionLifecycleConfig-YPTZZJ3S.js.map} +1 -1
  23. package/dist/{CollectionLifecycleFlowDetail-IZCKERFC.js → CollectionLifecycleFlowDetail-OD7OZH6W.js} +17 -18
  24. package/dist/{CollectionLifecycleFlowDetail-IZCKERFC.js.map → CollectionLifecycleFlowDetail-OD7OZH6W.js.map} +1 -1
  25. package/dist/{CollectionUsersConfig-WVS7JE2F.js → CollectionUsersConfig-ETJM2G23.js} +15 -16
  26. package/dist/{CollectionUsersConfig-WVS7JE2F.js.map → CollectionUsersConfig-ETJM2G23.js.map} +1 -1
  27. package/dist/{CollectionUsersFlowDetail-Y2UH3TU7.js → CollectionUsersFlowDetail-AMPT7UEV.js} +19 -20
  28. package/dist/{CollectionUsersFlowDetail-Y2UH3TU7.js.map → CollectionUsersFlowDetail-AMPT7UEV.js.map} +1 -1
  29. package/dist/{CredentialStoreConfig-V3YSYSIT.js → CredentialStoreConfig-ZQFLCBDT.js} +9 -11
  30. package/dist/{CredentialStoreConfig-V3YSYSIT.js.map → CredentialStoreConfig-ZQFLCBDT.js.map} +1 -1
  31. package/dist/{CredentialStoreFlowDetail-FL7QAM3S.js → CredentialStoreFlowDetail-5LRH7NH5.js} +9 -10
  32. package/dist/{CredentialStoreFlowDetail-FL7QAM3S.js.map → CredentialStoreFlowDetail-5LRH7NH5.js.map} +1 -1
  33. package/dist/{DesignPodFlowDetail-JHJWGNVY.js → DesignPodFlowDetail-ECFMDZZ3.js} +7 -8
  34. package/dist/{DesignPodFlowDetail-JHJWGNVY.js.map → DesignPodFlowDetail-ECFMDZZ3.js.map} +1 -1
  35. package/dist/{DomainCardPreviewFlowDetail-Y2FE7O5Z.js → DomainCardPreviewFlowDetail-M7FPXS4N.js} +9 -10
  36. package/dist/{DomainCardPreviewFlowDetail-Y2FE7O5Z.js.map → DomainCardPreviewFlowDetail-M7FPXS4N.js.map} +1 -1
  37. package/dist/{DomainIndexerLookupFlowDetail-GJ7WWK7I.js → DomainIndexerLookupFlowDetail-L6GSDWLI.js} +7 -5
  38. package/dist/{DomainIndexerLookupFlowDetail-GJ7WWK7I.js.map → DomainIndexerLookupFlowDetail-L6GSDWLI.js.map} +1 -1
  39. package/dist/{DomainSignFlowDetail-BXZ6JBPR.js → DomainSignFlowDetail-5ERYSTPG.js} +10 -11
  40. package/dist/{DomainSignFlowDetail-BXZ6JBPR.js.map → DomainSignFlowDetail-5ERYSTPG.js.map} +1 -1
  41. package/dist/{DomainSingleSelectionConfig-ZNKIXB4P.js → DomainSingleSelectionConfig-DTHYPZBO.js} +6 -4
  42. package/dist/{DomainSingleSelectionConfig-ZNKIXB4P.js.map → DomainSingleSelectionConfig-DTHYPZBO.js.map} +1 -1
  43. package/dist/{DomainSingleSelectionFlowDetail-HWTQXSLA.js → DomainSingleSelectionFlowDetail-JKNAC2RY.js} +7 -5
  44. package/dist/{DomainSingleSelectionFlowDetail-HWTQXSLA.js.map → DomainSingleSelectionFlowDetail-JKNAC2RY.js.map} +1 -1
  45. package/dist/{EmailSendConfig-OQVXHNAF.js → EmailSendConfig-O3XDS5IE.js} +12 -13
  46. package/dist/{EmailSendConfig-OQVXHNAF.js.map → EmailSendConfig-O3XDS5IE.js.map} +1 -1
  47. package/dist/{EntityCreateOracleFlowDetail-H2X7CPYU.js → EntityCreateOracleFlowDetail-6XJ4UEL5.js} +9 -10
  48. package/dist/{EntityCreateOracleFlowDetail-H2X7CPYU.js.map → EntityCreateOracleFlowDetail-6XJ4UEL5.js.map} +1 -1
  49. package/dist/{EntitySingleSelectionFlowDetail-GFQGX3GA.js → EntitySingleSelectionFlowDetail-5BDIVHQV.js} +8 -6
  50. package/dist/{EntitySingleSelectionFlowDetail-GFQGX3GA.js.map → EntitySingleSelectionFlowDetail-5BDIVHQV.js.map} +1 -1
  51. package/dist/{EntityTransferFlowDetail-XEXM34XB.js → EntityTransferFlowDetail-DY2UZ5VA.js} +9 -10
  52. package/dist/{EntityTransferFlowDetail-XEXM34XB.js.map → EntityTransferFlowDetail-DY2UZ5VA.js.map} +1 -1
  53. package/dist/{EvalEngineConfig-6B5EXETY.js → EvalEngineConfig-5ZBXA3Q6.js} +17 -18
  54. package/dist/{EvalEngineConfig-6B5EXETY.js.map → EvalEngineConfig-5ZBXA3Q6.js.map} +1 -1
  55. package/dist/{EvalEngineFlowDetail-PUFRNO4U.js → EvalEngineFlowDetail-YL3FFONH.js} +11 -10
  56. package/dist/{EvalEngineFlowDetail-PUFRNO4U.js.map → EvalEngineFlowDetail-YL3FFONH.js.map} +1 -1
  57. package/dist/{EvaluateBidConfig-FGCVB3YR.js → EvaluateBidConfig-ZU7QUFXL.js} +12 -13
  58. package/dist/{EvaluateBidConfig-FGCVB3YR.js.map → EvaluateBidConfig-ZU7QUFXL.js.map} +1 -1
  59. package/dist/{EvaluateBidFlowDetail-4C3K2QVH.js → EvaluateBidFlowDetail-IATWBOE5.js} +17 -18
  60. package/dist/{EvaluateBidFlowDetail-4C3K2QVH.js.map → EvaluateBidFlowDetail-IATWBOE5.js.map} +1 -1
  61. package/dist/{EvaluateClaimConfig-LG47V642.js → EvaluateClaimConfig-HEYNWGSN.js} +12 -13
  62. package/dist/{EvaluateClaimConfig-LG47V642.js.map → EvaluateClaimConfig-HEYNWGSN.js.map} +1 -1
  63. package/dist/{EvaluateClaimFlowDetail-ITMCSEZT.js → EvaluateClaimFlowDetail-TOX53BGP.js} +18 -19
  64. package/dist/{EvaluateClaimFlowDetail-ITMCSEZT.js.map → EvaluateClaimFlowDetail-TOX53BGP.js.map} +1 -1
  65. package/dist/{FormSubmitFlowDetail-IAHDJS6P.js → FormSubmitFlowDetail-CVSUWEAW.js} +9 -10
  66. package/dist/{FormSubmitFlowDetail-IAHDJS6P.js.map → FormSubmitFlowDetail-CVSUWEAW.js.map} +1 -1
  67. package/dist/{GovernanceAuthzExecFlowDetail-SQBGU5BX.js → GovernanceAuthzExecFlowDetail-GWKPT7QW.js} +10 -11
  68. package/dist/{GovernanceAuthzExecFlowDetail-SQBGU5BX.js.map → GovernanceAuthzExecFlowDetail-GWKPT7QW.js.map} +1 -1
  69. package/dist/{GovernanceAuthzGrantFlowDetail-DZPNLANT.js → GovernanceAuthzGrantFlowDetail-L7EPQQZ6.js} +11 -12
  70. package/dist/{GovernanceAuthzGrantFlowDetail-DZPNLANT.js.map → GovernanceAuthzGrantFlowDetail-L7EPQQZ6.js.map} +1 -1
  71. package/dist/{GovernanceAuthzRevokeFlowDetail-3JZ4IUJG.js → GovernanceAuthzRevokeFlowDetail-X2VQHRCB.js} +11 -12
  72. package/dist/{GovernanceAuthzRevokeFlowDetail-3JZ4IUJG.js.map → GovernanceAuthzRevokeFlowDetail-X2VQHRCB.js.map} +1 -1
  73. package/dist/{GovernanceChainVoteFlowDetail-475UDNG6.js → GovernanceChainVoteFlowDetail-BO3DJNDF.js} +10 -11
  74. package/dist/{GovernanceChainVoteFlowDetail-475UDNG6.js.map → GovernanceChainVoteFlowDetail-BO3DJNDF.js.map} +1 -1
  75. package/dist/{GovernanceConfigFlowDetail-SQ5PPDRX.js → GovernanceConfigFlowDetail-FZB4R54G.js} +7 -5
  76. package/dist/{GovernanceConfigFlowDetail-SQ5PPDRX.js.map → GovernanceConfigFlowDetail-FZB4R54G.js.map} +1 -1
  77. package/dist/{GovernanceContractExecuteFlowDetail-H2ZV6W2E.js → GovernanceContractExecuteFlowDetail-JHIXCNXS.js} +11 -12
  78. package/dist/{GovernanceContractExecuteFlowDetail-H2ZV6W2E.js.map → GovernanceContractExecuteFlowDetail-JHIXCNXS.js.map} +1 -1
  79. package/dist/{GovernanceContractInstantiateFlowDetail-YJJMGM54.js → GovernanceContractInstantiateFlowDetail-XWSI2HXG.js} +11 -12
  80. package/dist/{GovernanceContractInstantiateFlowDetail-YJJMGM54.js.map → GovernanceContractInstantiateFlowDetail-XWSI2HXG.js.map} +1 -1
  81. package/dist/{GovernanceContractManageCw20FlowDetail-OCBMW3YJ.js → GovernanceContractManageCw20FlowDetail-5QI3FBNT.js} +10 -11
  82. package/dist/{GovernanceContractManageCw20FlowDetail-OCBMW3YJ.js.map → GovernanceContractManageCw20FlowDetail-5QI3FBNT.js.map} +1 -1
  83. package/dist/{GovernanceContractMigrateFlowDetail-JDNIKTT3.js → GovernanceContractMigrateFlowDetail-W2DEBKKU.js} +11 -12
  84. package/dist/{GovernanceContractMigrateFlowDetail-JDNIKTT3.js.map → GovernanceContractMigrateFlowDetail-W2DEBKKU.js.map} +1 -1
  85. package/dist/{GovernanceContractUpdateAdminFlowDetail-SZBOAOCC.js → GovernanceContractUpdateAdminFlowDetail-VZ6245TK.js} +10 -11
  86. package/dist/{GovernanceContractUpdateAdminFlowDetail-SZBOAOCC.js.map → GovernanceContractUpdateAdminFlowDetail-VZ6245TK.js.map} +1 -1
  87. package/dist/{GovernanceCustomMessageFlowDetail-CXD4ZATO.js → GovernanceCustomMessageFlowDetail-NNTHVM5D.js} +11 -12
  88. package/dist/{GovernanceCustomMessageFlowDetail-CXD4ZATO.js.map → GovernanceCustomMessageFlowDetail-NNTHVM5D.js.map} +1 -1
  89. package/dist/{GovernanceDaoAcceptToMarketplaceFlowDetail-Q6ZBNY7Z.js → GovernanceDaoAcceptToMarketplaceFlowDetail-EO3CFNLA.js} +11 -12
  90. package/dist/{GovernanceDaoAcceptToMarketplaceFlowDetail-Q6ZBNY7Z.js.map → GovernanceDaoAcceptToMarketplaceFlowDetail-EO3CFNLA.js.map} +1 -1
  91. package/dist/{GovernanceDaoAdminExecFlowDetail-JAEAY2US.js → GovernanceDaoAdminExecFlowDetail-YQCDUW2V.js} +12 -13
  92. package/dist/{GovernanceDaoAdminExecFlowDetail-JAEAY2US.js.map → GovernanceDaoAdminExecFlowDetail-YQCDUW2V.js.map} +1 -1
  93. package/dist/{GovernanceDaoCreateEntityFlowDetail-7RVNTVAB.js → GovernanceDaoCreateEntityFlowDetail-RSFFRATK.js} +11 -12
  94. package/dist/{GovernanceDaoCreateEntityFlowDetail-7RVNTVAB.js.map → GovernanceDaoCreateEntityFlowDetail-RSFFRATK.js.map} +1 -1
  95. package/dist/{GovernanceDaoJoinFlowDetail-XYCTCNHO.js → GovernanceDaoJoinFlowDetail-GJWWQPD2.js} +11 -12
  96. package/dist/{GovernanceDaoJoinFlowDetail-XYCTCNHO.js.map → GovernanceDaoJoinFlowDetail-GJWWQPD2.js.map} +1 -1
  97. package/dist/{GovernanceDaoManageStorageFlowDetail-LMLYLYYC.js → GovernanceDaoManageStorageFlowDetail-KGMWUB4Z.js} +10 -11
  98. package/dist/{GovernanceDaoManageStorageFlowDetail-LMLYLYYC.js.map → GovernanceDaoManageStorageFlowDetail-KGMWUB4Z.js.map} +1 -1
  99. package/dist/{GovernanceDaoManageSubDaosFlowDetail-YUFQ67JN.js → GovernanceDaoManageSubDaosFlowDetail-3WTI6AX7.js} +11 -12
  100. package/dist/{GovernanceDaoManageSubDaosFlowDetail-YUFQ67JN.js.map → GovernanceDaoManageSubDaosFlowDetail-3WTI6AX7.js.map} +1 -1
  101. package/dist/{GovernanceDaoUpdateInfoFlowDetail-G5FIBY4L.js → GovernanceDaoUpdateInfoFlowDetail-2DCOJGYV.js} +10 -11
  102. package/dist/{GovernanceDaoUpdateInfoFlowDetail-G5FIBY4L.js.map → GovernanceDaoUpdateInfoFlowDetail-2DCOJGYV.js.map} +1 -1
  103. package/dist/{GovernanceMemberProposalConfig-IGPXEFDB.js → GovernanceMemberProposalConfig-LW6KNHVY.js} +7 -5
  104. package/dist/{GovernanceMemberProposalConfig-IGPXEFDB.js.map → GovernanceMemberProposalConfig-LW6KNHVY.js.map} +1 -1
  105. package/dist/{GovernanceMemberProposalFlowDetail-T3VURONF.js → GovernanceMemberProposalFlowDetail-JNO3RPDW.js} +11 -12
  106. package/dist/{GovernanceMemberProposalFlowDetail-T3VURONF.js.map → GovernanceMemberProposalFlowDetail-JNO3RPDW.js.map} +1 -1
  107. package/dist/{GovernanceNftBurnFlowDetail-AG4I2O7H.js → GovernanceNftBurnFlowDetail-MG3S2DZB.js} +10 -11
  108. package/dist/{GovernanceNftBurnFlowDetail-AG4I2O7H.js.map → GovernanceNftBurnFlowDetail-MG3S2DZB.js.map} +1 -1
  109. package/dist/{GovernanceNftManageCollectionsFlowDetail-UAAGO3Q6.js → GovernanceNftManageCollectionsFlowDetail-FB5BRSLF.js} +10 -11
  110. package/dist/{GovernanceNftManageCollectionsFlowDetail-UAAGO3Q6.js.map → GovernanceNftManageCollectionsFlowDetail-FB5BRSLF.js.map} +1 -1
  111. package/dist/{GovernanceNftTransferFlowDetail-KXM7DTOV.js → GovernanceNftTransferFlowDetail-27CRQVTA.js} +11 -12
  112. package/dist/{GovernanceNftTransferFlowDetail-KXM7DTOV.js.map → GovernanceNftTransferFlowDetail-27CRQVTA.js.map} +1 -1
  113. package/dist/{GovernanceSettingsProposalConfig-4SLJTBLW.js → GovernanceSettingsProposalConfig-WBOTSKNF.js} +7 -5
  114. package/dist/{GovernanceSettingsProposalConfig-4SLJTBLW.js.map → GovernanceSettingsProposalConfig-WBOTSKNF.js.map} +1 -1
  115. package/dist/{GovernanceSettingsProposalFlowDetail-VFZPSCLR.js → GovernanceSettingsProposalFlowDetail-W2KXBQM2.js} +10 -11
  116. package/dist/{GovernanceSettingsProposalFlowDetail-VFZPSCLR.js.map → GovernanceSettingsProposalFlowDetail-W2KXBQM2.js.map} +1 -1
  117. package/dist/{GovernanceStakingStakeFlowDetail-ULLJ7FLM.js → GovernanceStakingStakeFlowDetail-Z7MCDZDV.js} +10 -11
  118. package/dist/{GovernanceStakingStakeFlowDetail-ULLJ7FLM.js.map → GovernanceStakingStakeFlowDetail-Z7MCDZDV.js.map} +1 -1
  119. package/dist/{GovernanceStakingStakeToGroupFlowDetail-CSPKJA3H.js → GovernanceStakingStakeToGroupFlowDetail-EC6JGRMB.js} +10 -11
  120. package/dist/{GovernanceStakingStakeToGroupFlowDetail-CSPKJA3H.js.map → GovernanceStakingStakeToGroupFlowDetail-EC6JGRMB.js.map} +1 -1
  121. package/dist/{GovernanceSubmissionConfigProposalFlowDetail-MZCPSZF2.js → GovernanceSubmissionConfigProposalFlowDetail-YHO3F7TI.js} +10 -11
  122. package/dist/{GovernanceSubmissionConfigProposalFlowDetail-MZCPSZF2.js.map → GovernanceSubmissionConfigProposalFlowDetail-YHO3F7TI.js.map} +1 -1
  123. package/dist/{GovernanceTransactionMintFlowDetail-Y2WRAODH.js → GovernanceTransactionMintFlowDetail-K6PPDCH6.js} +11 -12
  124. package/dist/{GovernanceTransactionMintFlowDetail-Y2WRAODH.js.map → GovernanceTransactionMintFlowDetail-K6PPDCH6.js.map} +1 -1
  125. package/dist/{GovernanceTransactionPerformTokenSwapFlowDetail-GEK6PMMI.js → GovernanceTransactionPerformTokenSwapFlowDetail-6PEN4FED.js} +10 -11
  126. package/dist/{GovernanceTransactionPerformTokenSwapFlowDetail-GEK6PMMI.js.map → GovernanceTransactionPerformTokenSwapFlowDetail-6PEN4FED.js.map} +1 -1
  127. package/dist/{GovernanceTransactionSendFundsConfig-VBKMLSF3.js → GovernanceTransactionSendFundsConfig-JRROE44J.js} +7 -5
  128. package/dist/{GovernanceTransactionSendFundsConfig-VBKMLSF3.js.map → GovernanceTransactionSendFundsConfig-JRROE44J.js.map} +1 -1
  129. package/dist/{GovernanceTransactionSendFundsFlowDetail-5TZB64VL.js → GovernanceTransactionSendFundsFlowDetail-Z57XAY3D.js} +11 -12
  130. package/dist/{GovernanceTransactionSendFundsFlowDetail-5TZB64VL.js.map → GovernanceTransactionSendFundsFlowDetail-Z57XAY3D.js.map} +1 -1
  131. package/dist/{GovernanceTransactionSendGroupTokenFlowDetail-EGOWVZM2.js → GovernanceTransactionSendGroupTokenFlowDetail-OSEHM66P.js} +11 -12
  132. package/dist/{GovernanceTransactionSendGroupTokenFlowDetail-EGOWVZM2.js.map → GovernanceTransactionSendGroupTokenFlowDetail-OSEHM66P.js.map} +1 -1
  133. package/dist/{GovernanceTransactionWithdrawTokenSwapFlowDetail-6XWVO5O6.js → GovernanceTransactionWithdrawTokenSwapFlowDetail-AZFHSIBD.js} +10 -11
  134. package/dist/{GovernanceTransactionWithdrawTokenSwapFlowDetail-6XWVO5O6.js.map → GovernanceTransactionWithdrawTokenSwapFlowDetail-AZFHSIBD.js.map} +1 -1
  135. package/dist/{GovernanceValidatorActionsFlowDetail-ZMLPAFUB.js → GovernanceValidatorActionsFlowDetail-3YSPIIVG.js} +10 -11
  136. package/dist/{GovernanceValidatorActionsFlowDetail-ZMLPAFUB.js.map → GovernanceValidatorActionsFlowDetail-3YSPIIVG.js.map} +1 -1
  137. package/dist/{HarvestConfig-72UJXJ2I.js → HarvestConfig-FXZYEZRA.js} +10 -12
  138. package/dist/{HarvestConfig-72UJXJ2I.js.map → HarvestConfig-FXZYEZRA.js.map} +1 -1
  139. package/dist/{HarvestFlowDetail-X3RUH3X3.js → HarvestFlowDetail-Y2AJWJKR.js} +9 -10
  140. package/dist/{HarvestFlowDetail-X3RUH3X3.js.map → HarvestFlowDetail-Y2AJWJKR.js.map} +1 -1
  141. package/dist/{HttpRequestConfig-PZAX5VZO.js → HttpRequestConfig-A3UIM3K2.js} +9 -11
  142. package/dist/{HttpRequestConfig-PZAX5VZO.js.map → HttpRequestConfig-A3UIM3K2.js.map} +1 -1
  143. package/dist/{HttpRequestFlowDetail-JVLV533Z.js → HttpRequestFlowDetail-VWD64O3P.js} +7 -5
  144. package/dist/{HttpRequestFlowDetail-JVLV533Z.js.map → HttpRequestFlowDetail-VWD64O3P.js.map} +1 -1
  145. package/dist/{IdentityCreateFlowDetail-EXJ3Y36S.js → IdentityCreateFlowDetail-DXUI6S4I.js} +17 -18
  146. package/dist/{IdentityCreateFlowDetail-EXJ3Y36S.js.map → IdentityCreateFlowDetail-DXUI6S4I.js.map} +1 -1
  147. package/dist/{IidCreateFlowDetail-4BVQYOFR.js → IidCreateFlowDetail-INISHT4R.js} +17 -18
  148. package/dist/{IidCreateFlowDetail-4BVQYOFR.js.map → IidCreateFlowDetail-INISHT4R.js.map} +1 -1
  149. package/dist/{KycVerifyConfig-7YN6E4QF.js → KycVerifyConfig-KSECQD2D.js} +9 -11
  150. package/dist/{KycVerifyConfig-7YN6E4QF.js.map → KycVerifyConfig-KSECQD2D.js.map} +1 -1
  151. package/dist/{KycVerifyFlowDetail-DTK3GB6S.js → KycVerifyFlowDetail-ZLDIZ4HC.js} +16 -17
  152. package/dist/{KycVerifyFlowDetail-DTK3GB6S.js.map → KycVerifyFlowDetail-ZLDIZ4HC.js.map} +1 -1
  153. package/dist/{ListDomainFlowsFlowDetail-XX5AXDZZ.js → ListDomainFlowsFlowDetail-PJQCAY3I.js} +7 -5
  154. package/dist/{ListDomainFlowsFlowDetail-XX5AXDZZ.js.map → ListDomainFlowsFlowDetail-PJQCAY3I.js.map} +1 -1
  155. package/dist/{LoadBatchesFlowDetail-GB24T76O.js → LoadBatchesFlowDetail-TL4TQDZ5.js} +9 -10
  156. package/dist/{LoadBatchesFlowDetail-GB24T76O.js.map → LoadBatchesFlowDetail-TL4TQDZ5.js.map} +1 -1
  157. package/dist/{MatrixDmConfig-NBII27CS.js → MatrixDmConfig-DRY27FAM.js} +6 -4
  158. package/dist/{MatrixDmConfig-NBII27CS.js.map → MatrixDmConfig-DRY27FAM.js.map} +1 -1
  159. package/dist/{MatrixRegisterFlowDetail-D5YNL5QX.js → MatrixRegisterFlowDetail-RXHGTTQF.js} +9 -10
  160. package/dist/{MatrixRegisterFlowDetail-D5YNL5QX.js.map → MatrixRegisterFlowDetail-RXHGTTQF.js.map} +1 -1
  161. package/dist/{MemberMultiSelectFlowDetail-6C4ZMSDR.js → MemberMultiSelectFlowDetail-N64ZK7GE.js} +7 -5
  162. package/dist/{MemberMultiSelectFlowDetail-6C4ZMSDR.js.map → MemberMultiSelectFlowDetail-N64ZK7GE.js.map} +1 -1
  163. package/dist/{OracleConfig-RW55I2YD.js → OracleConfig-KUPPRFL2.js} +9 -11
  164. package/dist/{OracleConfig-RW55I2YD.js.map → OracleConfig-KUPPRFL2.js.map} +1 -1
  165. package/dist/{OracleConfigureOracleFlowDetail-R3JOT72V.js → OracleConfigureOracleFlowDetail-L7GRKOSV.js} +17 -18
  166. package/dist/{OracleConfigureOracleFlowDetail-R3JOT72V.js.map → OracleConfigureOracleFlowDetail-L7GRKOSV.js.map} +1 -1
  167. package/dist/{OracleContractFlowDetail-M3PM4AU4.js → OracleContractFlowDetail-D2XZYWVG.js} +9 -10
  168. package/dist/{OracleContractFlowDetail-M3PM4AU4.js.map → OracleContractFlowDetail-D2XZYWVG.js.map} +1 -1
  169. package/dist/{OracleDeployFlowDetail-WKTMD2AD.js → OracleDeployFlowDetail-TCFIJYP7.js} +9 -10
  170. package/dist/{OracleDeployFlowDetail-WKTMD2AD.js.map → OracleDeployFlowDetail-TCFIJYP7.js.map} +1 -1
  171. package/dist/{OracleDeploySetupFlowDetail-R3BQ7EAU.js → OracleDeploySetupFlowDetail-KMGBPIND.js} +9 -10
  172. package/dist/{OracleDeploySetupFlowDetail-R3BQ7EAU.js.map → OracleDeploySetupFlowDetail-KMGBPIND.js.map} +1 -1
  173. package/dist/{OracleDeployStartFlowDetail-EL3CMDMG.js → OracleDeployStartFlowDetail-DTK5PLC5.js} +9 -10
  174. package/dist/{OracleDeployStartFlowDetail-EL3CMDMG.js.map → OracleDeployStartFlowDetail-DTK5PLC5.js.map} +1 -1
  175. package/dist/{OracleFlowDetail-5JCJK3GH.js → OracleFlowDetail-FEPE3YYU.js} +9 -10
  176. package/dist/{OracleFlowDetail-5JCJK3GH.js.map → OracleFlowDetail-FEPE3YYU.js.map} +1 -1
  177. package/dist/{OraclePromptFlowDetail-O3XNK7HY.js → OraclePromptFlowDetail-2B55RVOO.js} +9 -10
  178. package/dist/{OraclePromptFlowDetail-O3XNK7HY.js.map → OraclePromptFlowDetail-2B55RVOO.js.map} +1 -1
  179. package/dist/{OracleStoreConfigFlowDetail-Q6AUUSUL.js → OracleStoreConfigFlowDetail-Q6PTB2TR.js} +9 -10
  180. package/dist/{OracleStoreConfigFlowDetail-Q6AUUSUL.js.map → OracleStoreConfigFlowDetail-Q6PTB2TR.js.map} +1 -1
  181. package/dist/{OracleStoreSecretsAndConfigFlowDetail-EIQPZQMF.js → OracleStoreSecretsAndConfigFlowDetail-D2YXIJ57.js} +17 -18
  182. package/dist/{OracleStoreSecretsAndConfigFlowDetail-EIQPZQMF.js.map → OracleStoreSecretsAndConfigFlowDetail-D2YXIJ57.js.map} +1 -1
  183. package/dist/{OracleStoreSecretsFlowDetail-WJXCPYSN.js → OracleStoreSecretsFlowDetail-DHNXG3CZ.js} +17 -18
  184. package/dist/{OracleStoreSecretsFlowDetail-WJXCPYSN.js.map → OracleStoreSecretsFlowDetail-DHNXG3CZ.js.map} +1 -1
  185. package/dist/{ProposalCreateConfig-7C5W2UHX.js → ProposalCreateConfig-W3XNV7SH.js} +12 -13
  186. package/dist/{ProposalCreateConfig-7C5W2UHX.js.map → ProposalCreateConfig-W3XNV7SH.js.map} +1 -1
  187. package/dist/{ProposalCreateFlowDetail-PJB2ANZM.js → ProposalCreateFlowDetail-2ZNJZMSY.js} +19 -20
  188. package/dist/{ProposalCreateFlowDetail-PJB2ANZM.js.map → ProposalCreateFlowDetail-2ZNJZMSY.js.map} +1 -1
  189. package/dist/{ProposalVoteConfig-AUU6QCSN.js → ProposalVoteConfig-DDEF76CL.js} +12 -13
  190. package/dist/{ProposalVoteConfig-AUU6QCSN.js.map → ProposalVoteConfig-DDEF76CL.js.map} +1 -1
  191. package/dist/{ProposalVoteFlowDetail-IJJ3OHAB.js → ProposalVoteFlowDetail-6BOYU4XJ.js} +10 -11
  192. package/dist/{ProposalVoteFlowDetail-IJJ3OHAB.js.map → ProposalVoteFlowDetail-6BOYU4XJ.js.map} +1 -1
  193. package/dist/{ProtocolSelectFlowDetail-XBSJIEIH.js → ProtocolSelectFlowDetail-IKYJQZAO.js} +6 -4
  194. package/dist/{ProtocolSelectFlowDetail-XBSJIEIH.js.map → ProtocolSelectFlowDetail-IKYJQZAO.js.map} +1 -1
  195. package/dist/{RetireConfig-EICGSI7K.js → RetireConfig-PQPUZHIW.js} +10 -12
  196. package/dist/{RetireConfig-EICGSI7K.js.map → RetireConfig-PQPUZHIW.js.map} +1 -1
  197. package/dist/{RetireFlowDetail-VZ5O4SXI.js → RetireFlowDetail-SP5GBJSA.js} +9 -10
  198. package/dist/{RetireFlowDetail-VZ5O4SXI.js.map → RetireFlowDetail-SP5GBJSA.js.map} +1 -1
  199. package/dist/{SandboxProvisionFlowDetail-RUY64INV.js → SandboxProvisionFlowDetail-CQ7XZWNA.js} +9 -10
  200. package/dist/{SandboxProvisionFlowDetail-RUY64INV.js.map → SandboxProvisionFlowDetail-CQ7XZWNA.js.map} +1 -1
  201. package/dist/{WalletFundConfig-CMM3EP3B.js → WalletFundConfig-T5S6B2HH.js} +7 -5
  202. package/dist/{WalletFundConfig-CMM3EP3B.js.map → WalletFundConfig-T5S6B2HH.js.map} +1 -1
  203. package/dist/{WalletFundFlowDetail-TXWCZA4K.js → WalletFundFlowDetail-WLQLJS34.js} +10 -11
  204. package/dist/{WalletFundFlowDetail-TXWCZA4K.js.map → WalletFundFlowDetail-WLQLJS34.js.map} +1 -1
  205. package/dist/{WalletGenerateAndFundFlowDetail-C2LZW3NO.js → WalletGenerateAndFundFlowDetail-7LEBWWEA.js} +7 -5
  206. package/dist/{WalletGenerateAndFundFlowDetail-C2LZW3NO.js.map → WalletGenerateAndFundFlowDetail-7LEBWWEA.js.map} +1 -1
  207. package/dist/{WalletGenerateFlowDetail-CQCNDGJA.js → WalletGenerateFlowDetail-CBAVDW7Z.js} +7 -5
  208. package/dist/{WalletGenerateFlowDetail-CQCNDGJA.js.map → WalletGenerateFlowDetail-CBAVDW7Z.js.map} +1 -1
  209. package/dist/{XeroContactCreateConfig-MGXISMDB.js → XeroContactCreateConfig-TKJKZAC4.js} +13 -14
  210. package/dist/{XeroContactCreateConfig-MGXISMDB.js.map → XeroContactCreateConfig-TKJKZAC4.js.map} +1 -1
  211. package/dist/{XeroContactCreateFlowDetail-45CMV27U.js → XeroContactCreateFlowDetail-O3ZITUCC.js} +14 -15
  212. package/dist/{XeroContactCreateFlowDetail-45CMV27U.js.map → XeroContactCreateFlowDetail-O3ZITUCC.js.map} +1 -1
  213. package/dist/{XeroInvoiceCreateConfig-MQBUY5KV.js → XeroInvoiceCreateConfig-LAMB7Q3J.js} +16 -17
  214. package/dist/{XeroInvoiceCreateConfig-MQBUY5KV.js.map → XeroInvoiceCreateConfig-LAMB7Q3J.js.map} +1 -1
  215. package/dist/{XeroInvoiceCreateFlowDetail-N6ZLSOFL.js → XeroInvoiceCreateFlowDetail-KIYWUT2B.js} +16 -17
  216. package/dist/{XeroInvoiceCreateFlowDetail-N6ZLSOFL.js.map → XeroInvoiceCreateFlowDetail-KIYWUT2B.js.map} +1 -1
  217. package/dist/{XeroInvoiceListConfig-UNX4VEOG.js → XeroInvoiceListConfig-PUUQP4UP.js} +13 -14
  218. package/dist/{XeroInvoiceListConfig-UNX4VEOG.js.map → XeroInvoiceListConfig-PUUQP4UP.js.map} +1 -1
  219. package/dist/{XeroInvoiceListFlowDetail-LYHODWH6.js → XeroInvoiceListFlowDetail-YPU6MFSX.js} +7 -5
  220. package/dist/{XeroInvoiceListFlowDetail-LYHODWH6.js.map → XeroInvoiceListFlowDetail-YPU6MFSX.js.map} +1 -1
  221. package/dist/{XeroPaymentCreateConfig-KLIV5FAB.js → XeroPaymentCreateConfig-XNMSDVG3.js} +9 -11
  222. package/dist/{XeroPaymentCreateConfig-KLIV5FAB.js.map → XeroPaymentCreateConfig-XNMSDVG3.js.map} +1 -1
  223. package/dist/{XeroPaymentCreateFlowDetail-6D5K4Z5O.js → XeroPaymentCreateFlowDetail-CB55SP6X.js} +15 -16
  224. package/dist/{XeroPaymentCreateFlowDetail-6D5K4Z5O.js.map → XeroPaymentCreateFlowDetail-CB55SP6X.js.map} +1 -1
  225. package/dist/chunk-2KOJBMG5.js +1296 -0
  226. package/dist/chunk-2KOJBMG5.js.map +1 -0
  227. package/dist/{chunk-7VFCZZMP.js → chunk-3WLWIA7D.js} +68 -7
  228. package/dist/chunk-3WLWIA7D.js.map +1 -0
  229. package/dist/{chunk-STH2HPZK.js → chunk-6JOBSAZF.js} +2 -2
  230. package/dist/{chunk-JIDTNKKL.js → chunk-7TVYQNOR.js} +57 -6
  231. package/dist/chunk-7TVYQNOR.js.map +1 -0
  232. package/dist/{chunk-PFF6VY35.js → chunk-A7L3NJK6.js} +2 -2
  233. package/dist/{chunk-4DGCCXD6.js → chunk-BAQA4AZN.js} +36 -5
  234. package/dist/chunk-BAQA4AZN.js.map +1 -0
  235. package/dist/{chunk-MQCDMHRZ.js → chunk-C376YPPE.js} +3 -3
  236. package/dist/{chunk-4PONO4US.js → chunk-CMG6TZKH.js} +3 -3
  237. package/dist/{chunk-DSAOXGJH.js → chunk-DMXZIAAW.js} +3 -3
  238. package/dist/{chunk-E6N2G3BQ.js → chunk-DVZU2FI6.js} +13 -13
  239. package/dist/chunk-DVZU2FI6.js.map +1 -0
  240. package/dist/{chunk-676HDB7K.js → chunk-EH7EYO4N.js} +4 -4
  241. package/dist/{chunk-QND2IQ67.js → chunk-EWDTMHPF.js} +702 -647
  242. package/dist/chunk-EWDTMHPF.js.map +1 -0
  243. package/dist/{chunk-5IH3VC5I.js → chunk-FJ36VM6S.js} +2 -2
  244. package/dist/{chunk-Y4EEDWYE.js → chunk-IMN2PXVU.js} +8 -6
  245. package/dist/{chunk-Y4EEDWYE.js.map → chunk-IMN2PXVU.js.map} +1 -1
  246. package/dist/{chunk-IFWKRCFF.js → chunk-J6AWMFEF.js} +2 -2
  247. package/dist/{chunk-ZP4D73DO.js → chunk-JDNOVB6L.js} +2 -2
  248. package/dist/{chunk-NIXT2SBH.js → chunk-JK6RAKE3.js} +2 -2
  249. package/dist/{chunk-F2SBFVIX.js → chunk-JSE2MTU7.js} +241 -218
  250. package/dist/chunk-JSE2MTU7.js.map +1 -0
  251. package/dist/{chunk-PYNDJDWZ.js → chunk-JWC4VVY7.js} +3 -5
  252. package/dist/{chunk-PYNDJDWZ.js.map → chunk-JWC4VVY7.js.map} +1 -1
  253. package/dist/{chunk-EGVS23DR.js → chunk-L7WHIPGC.js} +2 -2
  254. package/dist/{chunk-IVOOK475.js → chunk-LSWKBCB3.js} +5 -5
  255. package/dist/{chunk-NJAII6CO.js → chunk-M3GHFF5N.js} +2 -2
  256. package/dist/{chunk-ILSFU3WD.js → chunk-MQAJXYIS.js} +2 -2
  257. package/dist/{chunk-QZYCJ2GZ.js → chunk-MY22PTP4.js} +2 -2
  258. package/dist/{chunk-JVROGQ7Q.js → chunk-QSUE3ZFB.js} +2 -2
  259. package/dist/{chunk-IIIZZ4E4.js → chunk-QW7LA67J.js} +304 -213
  260. package/dist/chunk-QW7LA67J.js.map +1 -0
  261. package/dist/{chunk-FFYZXA75.js → chunk-RETGBEFM.js} +2 -2
  262. package/dist/{chunk-VRZ5LMOW.js → chunk-RQS3KQLQ.js} +2 -2
  263. package/dist/{chunk-SEJJ7CRI.js → chunk-RV7QJFSE.js} +2 -2
  264. package/dist/{chunk-GR4SIU32.js → chunk-S2ETTOE5.js} +2 -2
  265. package/dist/{chunk-YLNEKJQ5.js → chunk-SRSVMD6E.js} +2 -2
  266. package/dist/{chunk-P7OBLJAG.js → chunk-SUUULPJP.js} +13 -11
  267. package/dist/chunk-SUUULPJP.js.map +1 -0
  268. package/dist/chunk-THG6RXFR.js +68 -0
  269. package/dist/chunk-THG6RXFR.js.map +1 -0
  270. package/dist/{chunk-RRYBAE6E.js → chunk-UTLM6U75.js} +6 -66
  271. package/dist/chunk-UTLM6U75.js.map +1 -0
  272. package/dist/{chunk-BZ7UPUTY.js → chunk-X23SZR5N.js} +2 -2
  273. package/dist/{chunk-ZZ7FDJKJ.js → chunk-YMGLWNV5.js} +2 -2
  274. package/dist/{chunk-SB5UCPZH.js → chunk-ZIT2N7CI.js} +2 -2
  275. package/dist/{connections-CEcurtWI.d.ts → connections-tcxJgB1K.d.ts} +20 -23
  276. package/dist/core/index.cjs +1495 -414
  277. package/dist/core/index.cjs.map +1 -1
  278. package/dist/core/index.d.ts +276 -24
  279. package/dist/core/index.js +366 -85
  280. package/dist/core/index.js.map +1 -1
  281. package/dist/flow-vnext/index.js +6 -4
  282. package/dist/{graphql-client-B2tREsx6.d.ts → graphql-client-VK7-KGDc.d.ts} +1 -1
  283. package/dist/index.d.ts +3 -3
  284. package/dist/index.js +28 -28
  285. package/dist/mantine/index.d.ts +4 -4
  286. package/dist/mantine/index.js +30 -32
  287. package/dist/mantine/index.js.map +1 -1
  288. package/dist/{types-Dqk5MTfW.d.ts → types-CYtPUWc7.d.ts} +889 -400
  289. package/package.json +3 -2
  290. package/dist/chunk-4DGCCXD6.js.map +0 -1
  291. package/dist/chunk-7VFCZZMP.js.map +0 -1
  292. package/dist/chunk-7W7UUUIE.js +0 -609
  293. package/dist/chunk-7W7UUUIE.js.map +0 -1
  294. package/dist/chunk-E6N2G3BQ.js.map +0 -1
  295. package/dist/chunk-F2SBFVIX.js.map +0 -1
  296. package/dist/chunk-HT6L7A5M.js +0 -12
  297. package/dist/chunk-HT6L7A5M.js.map +0 -1
  298. package/dist/chunk-IIIZZ4E4.js.map +0 -1
  299. package/dist/chunk-JIDTNKKL.js.map +0 -1
  300. package/dist/chunk-P7OBLJAG.js.map +0 -1
  301. package/dist/chunk-QND2IQ67.js.map +0 -1
  302. package/dist/chunk-RRYBAE6E.js.map +0 -1
  303. package/dist/chunk-TS2LNBF2.js +0 -68
  304. package/dist/chunk-TS2LNBF2.js.map +0 -1
  305. /package/dist/{chunk-STH2HPZK.js.map → chunk-6JOBSAZF.js.map} +0 -0
  306. /package/dist/{chunk-PFF6VY35.js.map → chunk-A7L3NJK6.js.map} +0 -0
  307. /package/dist/{chunk-MQCDMHRZ.js.map → chunk-C376YPPE.js.map} +0 -0
  308. /package/dist/{chunk-4PONO4US.js.map → chunk-CMG6TZKH.js.map} +0 -0
  309. /package/dist/{chunk-DSAOXGJH.js.map → chunk-DMXZIAAW.js.map} +0 -0
  310. /package/dist/{chunk-676HDB7K.js.map → chunk-EH7EYO4N.js.map} +0 -0
  311. /package/dist/{chunk-5IH3VC5I.js.map → chunk-FJ36VM6S.js.map} +0 -0
  312. /package/dist/{chunk-IFWKRCFF.js.map → chunk-J6AWMFEF.js.map} +0 -0
  313. /package/dist/{chunk-ZP4D73DO.js.map → chunk-JDNOVB6L.js.map} +0 -0
  314. /package/dist/{chunk-NIXT2SBH.js.map → chunk-JK6RAKE3.js.map} +0 -0
  315. /package/dist/{chunk-EGVS23DR.js.map → chunk-L7WHIPGC.js.map} +0 -0
  316. /package/dist/{chunk-IVOOK475.js.map → chunk-LSWKBCB3.js.map} +0 -0
  317. /package/dist/{chunk-NJAII6CO.js.map → chunk-M3GHFF5N.js.map} +0 -0
  318. /package/dist/{chunk-ILSFU3WD.js.map → chunk-MQAJXYIS.js.map} +0 -0
  319. /package/dist/{chunk-QZYCJ2GZ.js.map → chunk-MY22PTP4.js.map} +0 -0
  320. /package/dist/{chunk-JVROGQ7Q.js.map → chunk-QSUE3ZFB.js.map} +0 -0
  321. /package/dist/{chunk-FFYZXA75.js.map → chunk-RETGBEFM.js.map} +0 -0
  322. /package/dist/{chunk-VRZ5LMOW.js.map → chunk-RQS3KQLQ.js.map} +0 -0
  323. /package/dist/{chunk-SEJJ7CRI.js.map → chunk-RV7QJFSE.js.map} +0 -0
  324. /package/dist/{chunk-GR4SIU32.js.map → chunk-S2ETTOE5.js.map} +0 -0
  325. /package/dist/{chunk-YLNEKJQ5.js.map → chunk-SRSVMD6E.js.map} +0 -0
  326. /package/dist/{chunk-BZ7UPUTY.js.map → chunk-X23SZR5N.js.map} +0 -0
  327. /package/dist/{chunk-ZZ7FDJKJ.js.map → chunk-YMGLWNV5.js.map} +0 -0
  328. /package/dist/{chunk-SB5UCPZH.js.map → chunk-ZIT2N7CI.js.map} +0 -0
@@ -78,6 +78,7 @@ __export(core_exports, {
78
78
  ACTION_MANIFEST_VERSION: () => ACTION_MANIFEST_VERSION,
79
79
  ACTION_REGISTRY_VERSION: () => ACTION_REGISTRY_VERSION,
80
80
  ACTION_SAFETY_BY_TYPE: () => ACTION_SAFETY_BY_TYPE,
81
+ AUTHORITY_RECHECK_MS: () => AUTHORITY_RECHECK_MS,
81
82
  ActionContractResolutionError: () => ActionContractResolutionError,
82
83
  ActionManifestV2VerificationError: () => ActionManifestV2VerificationError,
83
84
  ComposioContractMismatchError: () => ComposioContractMismatchError,
@@ -91,10 +92,13 @@ __export(core_exports, {
91
92
  EffectClaimTransitionError: () => EffectClaimTransitionError,
92
93
  EncryptedMatrixFlowDefinitionRevisionRepository: () => EncryptedMatrixFlowDefinitionRevisionRepository,
93
94
  ExplicitRunRequiredError: () => ExplicitRunRequiredError,
95
+ FLOW_AUTHORITY_EVENT_TYPE: () => FLOW_AUTHORITY_EVENT_TYPE,
94
96
  FLOW_CAPABILITIES: () => FLOW_CAPABILITIES,
95
97
  FLOW_CONNECTIONS_MAP_KEY: () => FLOW_CONNECTIONS_MAP_KEY,
96
98
  FLOW_CONNECTION_BINDINGS_MAP_KEY: () => FLOW_CONNECTION_BINDINGS_MAP_KEY,
99
+ FLOW_IDENTITY_EVENT_TYPE: () => FLOW_IDENTITY_EVENT_TYPE,
97
100
  FLOW_PARTICIPANTS_MAP_KEY: () => FLOW_PARTICIPANTS_MAP_KEY,
101
+ FLOW_REQUESTS_MAP_KEY: () => FLOW_REQUESTS_MAP_KEY,
98
102
  FLOW_RUN_PROJECTIONS_MAP_KEY: () => FLOW_RUN_PROJECTIONS_MAP_KEY,
99
103
  FlowAgentService: () => FlowAgentService,
100
104
  FlowDefinitionPublicationError: () => FlowDefinitionPublicationError,
@@ -162,6 +166,9 @@ __export(core_exports, {
162
166
  assertLegacyFlowOperationAllowed: () => assertLegacyFlowOperationAllowed,
163
167
  assertRunActionExecutionAllowed: () => assertRunActionExecutionAllowed,
164
168
  auditFlowProjections: () => auditFlowProjections,
169
+ authorityEventMatches: () => authorityEventMatches,
170
+ bindFlowOwner: () => bindFlowOwner,
171
+ bindFlowOwnerFromRoom: () => bindFlowOwnerFromRoom,
165
172
  boundRunActionOutput: () => boundRunActionOutput,
166
173
  boundRunEventJson: () => boundRunEventJson,
167
174
  buildActionRunInputs: () => buildActionRunInputs,
@@ -183,7 +190,9 @@ __export(core_exports, {
183
190
  canonicalDesignPodJson: () => canonicalDesignPodJson,
184
191
  canonicalizeJson: () => canonicalizeJson,
185
192
  canonicalizeManifestV2Payload: () => canonicalizeManifestV2Payload,
193
+ capabilityForRequest: () => capabilityForRequest,
186
194
  capabilityPatternCoversCan: () => capabilityPatternCoversCan,
195
+ censusFlowAuthority: () => censusFlowAuthority,
187
196
  claimEffect: () => claimEffect,
188
197
  classifyBlockerCause: () => classifyBlockerCause,
189
198
  classifyNodeState: () => classifyNodeState,
@@ -212,7 +221,9 @@ __export(core_exports, {
212
221
  createDesignPodArtifactReceipt: () => createDesignPodArtifactReceipt,
213
222
  createDesignPodOperationalFlowPlan: () => createDesignPodOperationalFlowPlan,
214
223
  createDesignPodPortalJourneyPlan: () => createDesignPodPortalJourneyPlan,
224
+ createFlowAuthorityIndex: () => createFlowAuthorityIndex,
215
225
  createFlowDraftProposal: () => createFlowDraftProposal,
226
+ createFlowRequest: () => createFlowRequest,
216
227
  createInvocationStore: () => createInvocationStore,
217
228
  createMcpTopicExecutorAdapter: () => createMcpTopicExecutorAdapter,
218
229
  createMemoryInvocationStore: () => createMemoryInvocationStore,
@@ -220,6 +231,7 @@ __export(core_exports, {
220
231
  createOracleInitFlowTemplate: () => createOracleInitFlowTemplate,
221
232
  createPeerExecutor: () => createPeerExecutor,
222
233
  createQiForgeTopicExecutorAdapter: () => createQiForgeTopicExecutorAdapter,
234
+ createReceiptVerifier: () => createReceiptVerifier,
223
235
  createReference: () => createReference,
224
236
  createRunEventIdempotencyKey: () => createRunEventIdempotencyKey,
225
237
  createRunId: () => createRunId,
@@ -230,9 +242,11 @@ __export(core_exports, {
230
242
  createRunUlid: () => createRunUlid,
231
243
  createRuntimeStateManager: () => createRuntimeStateManager,
232
244
  createUcanDelegationStore: () => createUcanDelegationStore,
245
+ createUcanRunLifecycleAuthorizer: () => createUcanRunLifecycleAuthorizer,
233
246
  createUcanService: () => createUcanService,
234
247
  createYDocRuntimeManager: () => createYDocRuntimeManager,
235
248
  createYjsFlowDefinitionDraftRepository: () => createYjsFlowDefinitionDraftRepository,
249
+ decodeCarBase64: () => decodeCarBase64,
236
250
  decompileToBaseUcanFlow: () => decompileToBaseUcanFlow,
237
251
  deepFreezeJson: () => deepFreezeJson,
238
252
  deleteActionState: () => deleteActionState,
@@ -244,6 +258,8 @@ __export(core_exports, {
244
258
  detectRunDefinitionDrift: () => detectRunDefinitionDrift,
245
259
  digestCanonicalJson: () => digestCanonicalJson,
246
260
  digestDesignPodValue: () => digestDesignPodValue,
261
+ digestInputResponse: () => digestInputResponse,
262
+ digestRequestValue: () => digestRequestValue,
247
263
  dispatchFlowStartTriggers: () => dispatchFlowStartTriggers,
248
264
  doneWhenCompleted: () => doneWhenCompleted,
249
265
  drainTopicReceiptOutbox: () => drainTopicReceiptOutbox,
@@ -264,6 +280,8 @@ __export(core_exports, {
264
280
  findXeroWorkItems: () => findXeroWorkItems,
265
281
  findXeroWorkItemsForEditor: () => findXeroWorkItemsForEditor,
266
282
  fingerprintFlowCommand: () => fingerprintFlowCommand,
283
+ flowOwnerDidFromCreateSender: () => flowOwnerDidFromCreateSender,
284
+ flowOwnerOf: () => flowOwnerOf,
267
285
  flowRunProjectionStorageKey: () => flowRunProjectionStorageKey,
268
286
  generateActionManifest: () => generateActionManifest,
269
287
  getAction: () => getAction,
@@ -291,6 +309,7 @@ __export(core_exports, {
291
309
  getVersionPolicy: () => getVersionPolicy,
292
310
  getXeroWorkItemsMap: () => getXeroWorkItemsMap,
293
311
  getXeroWorkTerminalMap: () => getXeroWorkTerminalMap,
312
+ grantCoversExercise: () => grantCoversExercise,
294
313
  hasAction: () => hasAction,
295
314
  hasLegacyRuntimeHistory: () => hasLegacyRuntimeHistory,
296
315
  hasReferences: () => hasReferences,
@@ -303,6 +322,7 @@ __export(core_exports, {
303
322
  isBlankInputValue: () => isBlankInputValue,
304
323
  isCapabilityMatch: () => isCapabilityMatch,
305
324
  isExternalMutation: () => isExternalMutation,
325
+ isFlowOwner: () => isFlowOwner,
306
326
  isLegacyRuntimeAdoptionEnabled: () => isLegacyRuntimeAdoptionEnabled,
307
327
  isNeverDoneAction: () => isNeverDoneAction,
308
328
  isNodeContextRecord: () => isNodeContextRecord,
@@ -311,6 +331,7 @@ __export(core_exports, {
311
331
  isRuntimeRef: () => isRuntimeRef,
312
332
  isVerifiedCompletion: () => isVerifiedCompletion,
313
333
  isVersionAtLeast: () => isVersionAtLeast,
334
+ lifecycleRequestProof: () => lifecycleRequestProof,
314
335
  listOpenRuns: () => listOpenRuns,
315
336
  listRuns: () => listRuns,
316
337
  markDesignPodReviewed: () => markDesignPodReviewed,
@@ -330,6 +351,7 @@ __export(core_exports, {
330
351
  normalizeCapabilityPattern: () => normalizeCapabilityPattern,
331
352
  normalizeCondition: () => normalizeCondition,
332
353
  normalizeConditions: () => normalizeConditions,
354
+ normalizeDid: () => normalizeDid,
333
355
  oracleInitSurveySchema: () => oracleInitSurveySchema,
334
356
  parseConditionConfig: () => parseConditionConfig,
335
357
  parseConditionConfigStrict: () => parseConditionConfigStrict,
@@ -359,7 +381,10 @@ __export(core_exports, {
359
381
  readFlowDocument: () => readFlowDocument,
360
382
  readFlowDocumentHistory: () => readFlowDocumentHistory,
361
383
  readFlowFromEditor: () => readFlowFromEditor,
384
+ readFlowIdentityDocId: () => readFlowIdentityDocId,
385
+ readFlowOwnerDid: () => readFlowOwnerDid,
362
386
  readFlowParticipants: () => readFlowParticipants,
387
+ readFlowRequest: () => readFlowRequest,
363
388
  readFlowRunProjection: () => readFlowRunProjection,
364
389
  readFlowXeroBinding: () => readFlowXeroBinding,
365
390
  readFlowXeroBindingFromEditor: () => readFlowXeroBindingFromEditor,
@@ -367,6 +392,7 @@ __export(core_exports, {
367
392
  readPendingInvocations: () => readPendingInvocations,
368
393
  readPendingRunTimelineEvents: () => readPendingRunTimelineEvents,
369
394
  readQueuedAgentCommands: () => readQueuedAgentCommands,
395
+ readRoomCreatorUserId: () => readRoomCreatorUserId,
370
396
  readRunActionStates: () => readRunActionStates,
371
397
  readRunRecords: () => readRunRecords,
372
398
  reconcileActionReadBack: () => reconcileActionReadBack,
@@ -389,6 +415,7 @@ __export(core_exports, {
389
415
  repairFlowRunProjection: () => repairFlowRunProjection,
390
416
  replaceBlockInFragment: () => replaceBlockInFragment,
391
417
  replayFailedListenerRun: () => replayFailedListenerRun,
418
+ requestStepRun: () => requestStepRun,
392
419
  requiredCapabilityForCommand: () => requiredCapabilityForCommand,
393
420
  resetActionState: () => resetActionState,
394
421
  resetStepRuntime: () => resetStepRuntime,
@@ -406,6 +433,7 @@ __export(core_exports, {
406
433
  resolveSingleReference: () => resolveSingleReference,
407
434
  resourceMatches: () => resourceMatches,
408
435
  retryPendingRunTimelineEvents: () => retryPendingRunTimelineEvents,
436
+ revocationCheckerFor: () => revocationCheckerFor,
409
437
  runLedgerAttestations: () => runLedgerAttestations,
410
438
  sameDesignPodActor: () => sameDesignPodActor,
411
439
  seedDesignPodMethodDefinition: () => seedDesignPodMethodDefinition,
@@ -431,10 +459,12 @@ __export(core_exports, {
431
459
  signFlowDefinitionRevision: () => signFlowDefinitionRevision,
432
460
  signFlowEvent: () => signFlowEvent,
433
461
  signMatrixDefinitionAnchor: () => signMatrixDefinitionAnchor,
462
+ signedCapabilityCovers: () => signedCapabilityCovers,
434
463
  snapshotInputRefs: () => snapshotInputRefs,
435
464
  snapshotNode: () => snapshotNode,
436
465
  startRun: () => startRun,
437
466
  subscribeToActionState: () => subscribeToActionState,
467
+ summarizeFlowAuthorityCensus: () => summarizeFlowAuthorityCensus,
438
468
  swapFlowBlocks: () => swapFlowBlocks,
439
469
  syncFlowNodePropsFromProjection: () => syncFlowNodePropsFromProjection,
440
470
  tickFlowAgent: () => tickFlowAgent,
@@ -446,6 +476,7 @@ __export(core_exports, {
446
476
  topicActionThreadUpdateTransactionId: () => topicActionThreadUpdateTransactionId,
447
477
  topicSemanticRecordsDigest: () => topicSemanticRecordsDigest,
448
478
  typeToCan: () => typeToCan,
479
+ ucanVerificationEnvFrom: () => ucanVerificationEnvFrom,
449
480
  updateAgentCommand: () => updateAgentCommand,
450
481
  updateDesignPodControl: () => updateDesignPodControl,
451
482
  updateNodeRuntime: () => updateNodeRuntime,
@@ -462,6 +493,7 @@ __export(core_exports, {
462
493
  validateFlowAgentLease: () => validateFlowAgentLease,
463
494
  validateTopicSemanticRecord: () => validateTopicSemanticRecord,
464
495
  validateTopicSemanticRecordBatch: () => validateTopicSemanticRecordBatch,
496
+ verifyActionAuthority: () => verifyActionAuthority,
465
497
  verifyActionManifestV2: () => verifyActionManifestV2,
466
498
  verifyCompletion: () => verifyCompletion,
467
499
  verifyComposioActionAvailability: () => verifyComposioActionAvailability,
@@ -469,9 +501,13 @@ __export(core_exports, {
469
501
  verifyExecutionPolicy: () => verifyExecutionPolicy,
470
502
  verifyFlowDefinitionRevision: () => verifyFlowDefinitionRevision,
471
503
  verifyFlowEvent: () => verifyFlowEvent,
504
+ verifyGrant: () => verifyGrant,
505
+ verifyInvocation: () => verifyInvocation,
472
506
  verifyMatrixDefinitionAnchor: () => verifyMatrixDefinitionAnchor,
473
507
  writeActionState: () => writeActionState,
474
508
  writeCompiledBlocksToFragment: () => writeCompiledBlocksToFragment,
509
+ writeFlowIdentity: () => writeFlowIdentity,
510
+ writeFlowRequest: () => writeFlowRequest,
475
511
  writeRunRecordAndReconcile: () => writeRunRecordAndReconcile,
476
512
  xeroOracleActivityForBlock: () => xeroOracleActivityForBlock,
477
513
  xeroOracleActivityForBlockForEditor: () => xeroOracleActivityForBlockForEditor
@@ -1689,9 +1725,9 @@ function getOutputSchemaForBlock(action, inputs) {
1689
1725
  }
1690
1726
  return action.outputSchema || [];
1691
1727
  }
1692
- function mergeByKey(baseline, dynamic, keyOf) {
1693
- const dynamicKeys = new Set(dynamic.map(keyOf));
1694
- return [...baseline.filter((item) => !dynamicKeys.has(keyOf(item))), ...dynamic];
1728
+ function mergeByKey(baseline, dynamic, keyOf2) {
1729
+ const dynamicKeys = new Set(dynamic.map(keyOf2));
1730
+ return [...baseline.filter((item) => !dynamicKeys.has(keyOf2(item))), ...dynamic];
1695
1731
  }
1696
1732
  function normalizeInputs(inputs) {
1697
1733
  if (!inputs) return {};
@@ -1930,6 +1966,13 @@ function ensureRunScopedMap(yDoc, runId, key) {
1930
1966
  run.set(key, new Y.Map());
1931
1967
  return getRunScopedMap(yDoc, runId, key);
1932
1968
  }
1969
+ function patchRunMeta(yDoc, runId, patch) {
1970
+ assertDoc(yDoc, "patchRunMeta");
1971
+ const run = getExistingRunsMap(yDoc)?.get(runId);
1972
+ const meta = run?.get(META_KEY);
1973
+ if (!run || !meta || typeof meta !== "object") return;
1974
+ run.set(META_KEY, { ...meta, ...patch });
1975
+ }
1933
1976
  function getRunMeta(yDoc, runId) {
1934
1977
  assertDoc(yDoc, "getRunMeta");
1935
1978
  const run = getExistingRunsMap(yDoc)?.get(runId);
@@ -2215,6 +2258,57 @@ async function digestDesignPodValue(value) {
2215
2258
  return `sha256:${Array.from(new Uint8Array(hash), (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
2216
2259
  }
2217
2260
 
2261
+ // src/core/lib/ucan/normalizeDid.ts
2262
+ function normalizeDid(did) {
2263
+ if (did.startsWith("did:")) return did;
2264
+ if (did.startsWith("ixo1")) return `did:ixo:${did}`;
2265
+ if (!did.startsWith("@did-")) return did;
2266
+ const [localpart] = did.split(":");
2267
+ const parts = localpart.split("-");
2268
+ if (parts.length < 3 || parts[0] !== "@did") return did;
2269
+ return `did:${parts[1]}:${parts.slice(2).join("-")}`;
2270
+ }
2271
+
2272
+ // src/core/lib/flowOwner.ts
2273
+ function serverOf(userId) {
2274
+ const index = userId.indexOf(":");
2275
+ return index === -1 ? "" : userId.slice(index + 1);
2276
+ }
2277
+ function flowOwnerDidFromCreateSender(sender, trustedServers) {
2278
+ if (!sender || !sender.startsWith("@did-")) return "";
2279
+ const server = serverOf(sender);
2280
+ if (!server || !trustedServers.includes(server)) return "";
2281
+ const did = normalizeDid(sender);
2282
+ return did.startsWith("did:") ? did : "";
2283
+ }
2284
+ function readRoomCreatorUserId(client, roomId) {
2285
+ if (!client || !roomId || typeof client.getRoom !== "function") return "";
2286
+ const event = client.getRoom(roomId)?.currentState?.getStateEvents?.("m.room.create", "");
2287
+ return event?.getSender?.() ?? "";
2288
+ }
2289
+ function readFlowOwnerDid(client, roomId, options = {}) {
2290
+ if (!client) return "";
2291
+ const domain = client.getDomain?.() ?? "";
2292
+ const trusted = options.trustedServers ?? (domain ? [domain] : []);
2293
+ return flowOwnerDidFromCreateSender(readRoomCreatorUserId(client, roomId), trusted);
2294
+ }
2295
+ var boundOwners = /* @__PURE__ */ new WeakMap();
2296
+ function bindFlowOwner(doc, ownerDid) {
2297
+ if (ownerDid) boundOwners.set(doc, normalizeDid(ownerDid));
2298
+ }
2299
+ function bindFlowOwnerFromRoom(doc, client, roomId, options) {
2300
+ const owner = readFlowOwnerDid(client, roomId, options);
2301
+ if (owner) bindFlowOwner(doc, owner);
2302
+ return owner;
2303
+ }
2304
+ function flowOwnerOf(doc) {
2305
+ return doc ? boundOwners.get(doc) ?? "" : "";
2306
+ }
2307
+ function isFlowOwner(doc, did) {
2308
+ const owner = flowOwnerOf(doc);
2309
+ return Boolean(owner && did && normalizeDid(did) === owner);
2310
+ }
2311
+
2218
2312
  // src/core/lib/designPod/state.ts
2219
2313
  var DESIGN_POD_DEFINITION_MAP_KEY = "designPodDefinition";
2220
2314
  var DESIGN_POD_STATE_MAP_KEY = "designPodState";
@@ -2267,7 +2361,7 @@ async function initializeDesignPod(doc, methodId, identity2) {
2267
2361
  throw new Error("Design POD identity is already pinned to a different project session");
2268
2362
  }
2269
2363
  const root2 = doc.getMap("root");
2270
- if (root2.get("doc_id") !== pinnedIdentity.flowRoomId || root2.get("flowOwnerDid") !== pinnedIdentity.flowOwnerDid) {
2364
+ if (root2.get("doc_id") !== pinnedIdentity.flowRoomId || !isFlowOwner(doc, pinnedIdentity.flowOwnerDid)) {
2271
2365
  throw new Error("Design POD Flow authority no longer matches its pinned Flow owner and Matrix room");
2272
2366
  }
2273
2367
  if (isRunTerminalOrPending(doc, existingIdentity.sessionRunId)) {
@@ -2279,6 +2373,9 @@ async function initializeDesignPod(doc, methodId, identity2) {
2279
2373
  if (isRunTerminalOrPending(doc, pinnedIdentity.sessionRunId)) {
2280
2374
  throw new TerminalRunExecutionError(pinnedIdentity.sessionRunId, "design-pod-initialize");
2281
2375
  }
2376
+ if (!isFlowOwner(doc, pinnedIdentity.flowOwnerDid)) {
2377
+ throw new Error("The Design POD Flow owner must be the person who created this Flow room");
2378
+ }
2282
2379
  definitionMap(doc).set(MANIFEST_KEY, manifest);
2283
2380
  map.set(IDENTITY_KEY, pinnedIdentity);
2284
2381
  const root = doc.getMap("root");
@@ -2653,12 +2750,12 @@ function flowAuthority(doc, state, authority) {
2653
2750
  if (state.identity.designProjectEntityDid !== authority.designProjectEntityDid || state.identity.flowOwnerDid !== authority.flowOwnerDid || state.identity.flowRoomId !== authority.flowRoomId || state.identity.sessionRunId !== authority.sessionRunId) {
2654
2751
  throw new Error("The Design POD project identity does not match Portal-owned authority");
2655
2752
  }
2656
- if (root.get("doc_id") !== authority.flowRoomId || root.get("flowOwnerDid") !== authority.flowOwnerDid) {
2753
+ if (root.get("doc_id") !== authority.flowRoomId || !isFlowOwner(doc, authority.flowOwnerDid)) {
2657
2754
  throw new Error("The collaborative Flow authority does not match the Portal-owned Flow owner and Matrix room");
2658
2755
  }
2659
2756
  return { flowUri: `ixo:flow:${authority.flowRoomId}`, flowOwnerDid: authority.flowOwnerDid };
2660
2757
  }
2661
- async function verifyActionProof(doc, state, proof, expected, authority, verifyInvocation) {
2758
+ async function verifyActionProof(doc, state, proof, expected, authority, verifyInvocation2) {
2662
2759
  if (!proof?.invocationCid || !proof.actionBlockId || !proof.inputDigest) {
2663
2760
  throw new Error(`${expected.actionType} is missing its identity-bound Flow invocation proof`);
2664
2761
  }
@@ -2670,7 +2767,7 @@ async function verifyActionProof(doc, state, proof, expected, authority, verifyI
2670
2767
  if (invocation.result !== "success" || invocation.invokerDid !== expected.actorDid || invocation.blockId !== proof.actionBlockId || invocation.sessionRunId !== state.identity.sessionRunId || invocation.capability?.can !== "flow/block/execute" || invocation.capability?.with !== `${flowUri}:${proof.actionBlockId}` || invocation.facts?.actionType !== expected.actionType || invocation.facts?.inputDigest !== proof.inputDigest || invocation.facts?.sessionRunId !== state.identity.sessionRunId) {
2671
2768
  throw new Error(`${expected.actionType} invocation metadata does not match the reviewed Flow action`);
2672
2769
  }
2673
- const verified = await verifyInvocation({
2770
+ const verified = await verifyInvocation2({
2674
2771
  invocation,
2675
2772
  expected: {
2676
2773
  actorDid: expected.actorDid,
@@ -2913,7 +3010,7 @@ async function verifyDesignPodPublishedRun(params) {
2913
3010
  if (!state || state.identity.sessionRunId !== params.runId) throw new Error("The run is not the pinned Design POD session");
2914
3011
  if (params.flowUri !== `ixo:flow:${state.identity.flowRoomId}`) throw new Error("The Flow URI does not match the pinned Matrix room");
2915
3012
  const root = params.yDoc.getMap("root");
2916
- if (root.get("doc_id") !== state.identity.flowRoomId || root.get("flowOwnerDid") !== state.identity.flowOwnerDid) {
3013
+ if (root.get("doc_id") !== state.identity.flowRoomId || !isFlowOwner(params.yDoc, state.identity.flowOwnerDid)) {
2917
3014
  throw new Error("The collaborative Flow authority does not match the pinned Portal authority");
2918
3015
  }
2919
3016
  const release = state.release;
@@ -3421,6 +3518,7 @@ var SharedFlowDocument = class {
3421
3518
  Y2.decodeUpdate(this.checkpoint.update);
3422
3519
  Y2.applyUpdate(this.doc, this.checkpoint.update, this);
3423
3520
  this.ready = true;
3521
+ bindFlowOwnerFromRoom(this.doc, this.client, this.roomId);
3424
3522
  this.notify();
3425
3523
  } catch {
3426
3524
  this.checkpoint = void 0;
@@ -3431,6 +3529,7 @@ var SharedFlowDocument = class {
3431
3529
  if (generation !== this.generation) return;
3432
3530
  Y2.applyUpdate(this.doc, result.update, this);
3433
3531
  this.ready = true;
3532
+ bindFlowOwnerFromRoom(this.doc, this.client, this.roomId);
3434
3533
  this.error = void 0;
3435
3534
  this.attempt = 0;
3436
3535
  if (result.token) this.checkpoint = { update: result.update, token: result.token, savedAt: Date.now() };
@@ -4161,7 +4260,7 @@ function findFailedListenersForSourceRun(yDoc, sourceBlockId, sourceRunId, liste
4161
4260
  }
4162
4261
  return failures;
4163
4262
  }
4164
- function replayFailedListenerRun(yDoc, failedRecord, listenerBlockId, originalPayload, originalRefSnapshots, assigneeDid, sessionRunId) {
4263
+ function replayFailedListenerRun(yDoc, failedRecord, listenerBlockId, originalPayload, originalRefSnapshots, assigneeDid, sessionRunId, requestId) {
4165
4264
  if (!failedRecord.triggeredBy) return false;
4166
4265
  const replayId = `${failedRecord.runId}:replay-${Date.now().toString(36)}`;
4167
4266
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -4176,7 +4275,8 @@ function replayFailedListenerRun(yDoc, failedRecord, listenerBlockId, originalPa
4176
4275
  refSnapshots: originalRefSnapshots,
4177
4276
  assigneeDid,
4178
4277
  emittedAt: now,
4179
- expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3).toISOString()
4278
+ expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3).toISOString(),
4279
+ ...requestId ? { requestId } : {}
4180
4280
  };
4181
4281
  return queuePendingInvocation(yDoc, listenerBlockId, replay, sessionRunId || failedRecord.sessionRunId);
4182
4282
  }
@@ -5948,7 +6048,7 @@ function requireExecutionProof(ctx) {
5948
6048
  var sameActorDid = sameDesignPodActor;
5949
6049
  function assertFlowAuthority(doc, authority) {
5950
6050
  const root = doc.getMap("root");
5951
- if (root.get("doc_id") !== authority.flowRoomId || root.get("flowOwnerDid") !== authority.flowOwnerDid) {
6051
+ if (root.get("doc_id") !== authority.flowRoomId || !isFlowOwner(doc, authority.flowOwnerDid)) {
5952
6052
  throw new Error("The collaborative Flow authority does not match the Portal-owned Flow owner and Matrix room");
5953
6053
  }
5954
6054
  }
@@ -6173,7 +6273,7 @@ function captureBlueprintAuthority(doc, state) {
6173
6273
  return canonicalDesignPodJson({
6174
6274
  manifest,
6175
6275
  identity: state.identity,
6176
- flowAuthority: { docId: root.get("doc_id"), flowOwnerDid: root.get("flowOwnerDid") },
6276
+ flowAuthority: { docId: root.get("doc_id"), flowOwnerDid: flowOwnerOf(doc) },
6177
6277
  controls: state.controls,
6178
6278
  checklistRecords: state.checklistRecords
6179
6279
  });
@@ -11450,13 +11550,13 @@ function strings(value, name) {
11450
11550
  return value.map((item) => String(item).trim());
11451
11551
  }
11452
11552
  function decimalAtLeast(left, right) {
11453
- const parse = (value) => {
11553
+ const parse2 = (value) => {
11454
11554
  if (!/^(?:0|[1-9]\d*)(?:\.\d+)?$/.test(value)) throw new Error("Coin amount must be a non-negative decimal string");
11455
11555
  const [whole, fraction = ""] = value.split(".");
11456
11556
  return { whole, fraction };
11457
11557
  };
11458
- const leftValue = parse(left);
11459
- const rightValue = parse(right);
11558
+ const leftValue = parse2(left);
11559
+ const rightValue = parse2(right);
11460
11560
  const scale = Math.max(leftValue.fraction.length, rightValue.fraction.length);
11461
11561
  const units = (value) => BigInt(`${value.whole}${value.fraction.padEnd(scale, "0")}`);
11462
11562
  return units(leftValue) >= units(rightValue);
@@ -14539,7 +14639,7 @@ function parseExpression(src) {
14539
14639
  pos = re.lastIndex;
14540
14640
  return m[0];
14541
14641
  };
14542
- const fail = (message) => {
14642
+ const fail2 = (message) => {
14543
14643
  throw new ExpressionSyntaxError(message, pos);
14544
14644
  };
14545
14645
  const parseExpr = () => {
@@ -14565,7 +14665,7 @@ function parseExpression(src) {
14565
14665
  const parseFactor = () => {
14566
14666
  skipWs();
14567
14667
  const ch = src[pos];
14568
- if (ch === void 0) return fail("unexpected end of expression");
14668
+ if (ch === void 0) return fail2("unexpected end of expression");
14569
14669
  if (ch === "-") {
14570
14670
  pos++;
14571
14671
  return { kind: "neg", operand: parseFactor() };
@@ -14574,7 +14674,7 @@ function parseExpression(src) {
14574
14674
  pos++;
14575
14675
  const inner = parseExpr();
14576
14676
  skipWs();
14577
- if (src[pos] !== ")") return fail("expected ')'");
14677
+ if (src[pos] !== ")") return fail2("expected ')'");
14578
14678
  pos++;
14579
14679
  return inner;
14580
14680
  }
@@ -14582,17 +14682,17 @@ function parseExpression(src) {
14582
14682
  const quote = ch;
14583
14683
  const start = ++pos;
14584
14684
  while (pos < src.length && src[pos] !== quote) pos++;
14585
- if (pos >= src.length) return fail("unterminated string literal");
14685
+ if (pos >= src.length) return fail2("unterminated string literal");
14586
14686
  return { kind: "str", value: src.slice(start, pos++) };
14587
14687
  }
14588
14688
  if (ch === "$") {
14589
14689
  const ref = match(FIELD_REF);
14590
- if (!ref) return fail("malformed $field reference");
14690
+ if (!ref) return fail2("malformed $field reference");
14591
14691
  return { kind: "ref", ref };
14592
14692
  }
14593
14693
  if (ch === "~") {
14594
14694
  const ref = match(SIGIL_REF);
14595
- if (!ref) return fail("malformed ~-reference");
14695
+ if (!ref) return fail2("malformed ~-reference");
14596
14696
  return { kind: "ref", ref };
14597
14697
  }
14598
14698
  const numeric = match(NUMBER);
@@ -14603,7 +14703,7 @@ function parseExpression(src) {
14603
14703
  if (ident) {
14604
14704
  if (ident === "true" || ident === "false") return { kind: "bool", value: ident === "true" };
14605
14705
  skipWs();
14606
- if (src[pos] !== "(") return fail(`'${ident}' is not a value \u2014 bare identifiers must be function calls`);
14706
+ if (src[pos] !== "(") return fail2(`'${ident}' is not a value \u2014 bare identifiers must be function calls`);
14607
14707
  pos++;
14608
14708
  const args = [];
14609
14709
  skipWs();
@@ -14621,16 +14721,16 @@ function parseExpression(src) {
14621
14721
  pos++;
14622
14722
  break;
14623
14723
  }
14624
- return fail("expected ',' or ')'");
14724
+ return fail2("expected ',' or ')'");
14625
14725
  }
14626
14726
  }
14627
14727
  return { kind: "call", name: ident, args };
14628
14728
  }
14629
- return fail(`unexpected character '${ch}'`);
14729
+ return fail2(`unexpected character '${ch}'`);
14630
14730
  };
14631
14731
  const root = parseExpr();
14632
14732
  skipWs();
14633
- if (pos < src.length) fail(`unexpected trailing input '${src.slice(pos)}'`);
14733
+ if (pos < src.length) fail2(`unexpected trailing input '${src.slice(pos)}'`);
14634
14734
  return root;
14635
14735
  }
14636
14736
 
@@ -19745,72 +19845,6 @@ function deriveMigratedRunId(params) {
19745
19845
  return `r-0001-${encodeCrockford(fnv1a(seed), 8)}${encodeCrockford(fnv1a(`${seed}\0salt`), 8)}`;
19746
19846
  }
19747
19847
 
19748
- // src/core/lib/flowEngine/versionManifest.ts
19749
- var VERSION_MANIFEST = {
19750
- "0.3": {
19751
- version: "0.3",
19752
- label: "Legacy",
19753
- ucanRequired: false,
19754
- delegationRootRequired: false,
19755
- whitelistOnlyAllowed: true,
19756
- unrestrictedAllowed: true,
19757
- executionPath: "legacy",
19758
- authorizationFn: "v1",
19759
- allowedAuthModes: ["anyone", "actors", "capability"],
19760
- ui: {
19761
- showDelegationPanel: false,
19762
- showWhitelistConfig: true,
19763
- showAnyoneConfig: true,
19764
- showMigrationBanner: true,
19765
- requirePinForExecution: false
19766
- },
19767
- description: "Legacy version. UCAN optional, whitelist-only authorization accepted."
19768
- },
19769
- "1.0.0": {
19770
- version: "1.0.0",
19771
- label: "UCAN Required",
19772
- ucanRequired: true,
19773
- delegationRootRequired: true,
19774
- whitelistOnlyAllowed: false,
19775
- unrestrictedAllowed: false,
19776
- executionPath: "invocation",
19777
- authorizationFn: "v2",
19778
- allowedAuthModes: ["capability"],
19779
- ui: {
19780
- showDelegationPanel: true,
19781
- showWhitelistConfig: false,
19782
- showAnyoneConfig: false,
19783
- showMigrationBanner: false,
19784
- requirePinForExecution: true
19785
- },
19786
- description: "UCAN-enforced. Every block execution requires a valid delegation chain."
19787
- }
19788
- };
19789
- var LATEST_VERSION = "1.0.0";
19790
- var tempUcanEnforcementDisabled = false;
19791
- function isTempUcanEnforcementDisabled() {
19792
- return tempUcanEnforcementDisabled;
19793
- }
19794
- var MIGRATION_PATH = ["0.3", "1.0.0"];
19795
- function getVersionPolicy(version) {
19796
- const policy = VERSION_MANIFEST[version] ?? VERSION_MANIFEST[LATEST_VERSION];
19797
- if (tempUcanEnforcementDisabled && policy.ucanRequired) {
19798
- return {
19799
- ...policy,
19800
- ucanRequired: false,
19801
- delegationRootRequired: false,
19802
- ui: { ...policy.ui, requirePinForExecution: false }
19803
- };
19804
- }
19805
- return policy;
19806
- }
19807
- function isVersionAtLeast(current, minimum) {
19808
- const currentIdx = MIGRATION_PATH.indexOf(current);
19809
- const minimumIdx = MIGRATION_PATH.indexOf(minimum);
19810
- const effectiveCurrent = currentIdx === -1 ? MIGRATION_PATH.length : currentIdx;
19811
- return effectiveCurrent >= minimumIdx;
19812
- }
19813
-
19814
19848
  // src/core/lib/flowEngine/reconcile.ts
19815
19849
  var activeReconciliations = /* @__PURE__ */ new WeakMap();
19816
19850
  function flattenBlocks2(blocks) {
@@ -19873,9 +19907,9 @@ function _reconcilePendingInvocationsInner(editor, yDoc, runId) {
19873
19907
  }
19874
19908
  return consumed.has(pendingId);
19875
19909
  };
19876
- const schemaVersionRaw = yDoc.getMap("root").get("schema_version");
19877
- const ucanRequired = typeof schemaVersionRaw === "string" ? !!getVersionPolicy(schemaVersionRaw)?.ucanRequired : false;
19878
19910
  const invocationsMap = yDoc.getMap("invocations");
19911
+ const receipts = editor.getUcanService?.()?.receipts;
19912
+ const awaiting = [];
19879
19913
  const getNodeOutput2 = (nodeId) => {
19880
19914
  const out = readActionState(yDoc, runId, nodeId).output;
19881
19915
  return out && typeof out === "object" && !Array.isArray(out) ? out : void 0;
@@ -19899,11 +19933,20 @@ function _reconcilePendingInvocationsInner(editor, yDoc, runId) {
19899
19933
  if (!hasAnyListener) continue;
19900
19934
  const records = readRunRecords(yDoc, sourceBlockId, runId);
19901
19935
  for (const record3 of records) {
19902
- if (!isTrustedRunRecord(record3, ucanRequired, invocationsMap)) continue;
19936
+ const trust = runRecordTrust(record3, sourceBlockId, invocationsMap, receipts);
19937
+ if (trust === "pending") {
19938
+ const invocation = invocationsMap.get(record3.invocationCid);
19939
+ awaiting.push(receipts.verify(invocation, { blockId: sourceBlockId }));
19940
+ continue;
19941
+ }
19942
+ if (trust !== "verified") continue;
19903
19943
  processRunRecord(yDoc, runId, sourceBlockId, record3, listenersBySource, getNodeOutput2, isConsumed, now);
19904
19944
  processBarrierRunRecord(yDoc, runId, sourceBlockId, record3, barrierListenersBySource, getNodeOutput2, isConsumed, now);
19905
19945
  }
19906
19946
  }
19947
+ if (awaiting.length > 0) {
19948
+ void Promise.allSettled(awaiting).then(() => reconcilePendingInvocations(editor, runId));
19949
+ }
19907
19950
  }
19908
19951
  function dispatchFlowStartTriggers(params) {
19909
19952
  const blocks = flattenBlocks2(params.blocks);
@@ -19942,7 +19985,8 @@ function dispatchFlowStartTriggers(params) {
19942
19985
  refSnapshots,
19943
19986
  assigneeDid: resolveAssignee(block) || "unassigned",
19944
19987
  emittedAt,
19945
- expiresAt: computeExpiry(block, emittedAt)
19988
+ expiresAt: computeExpiry(block, emittedAt),
19989
+ ...params.requestId ? { requestId: params.requestId } : {}
19946
19990
  };
19947
19991
  if (queuePendingInvocation(params.yDoc, block.id, invocation, params.runId)) {
19948
19992
  queued += 1;
@@ -19953,10 +19997,13 @@ function dispatchFlowStartTriggers(params) {
19953
19997
  }
19954
19998
  return queued;
19955
19999
  }
19956
- function isTrustedRunRecord(record3, ucanRequired, invocationsMap) {
19957
- if (!ucanRequired) return true;
19958
- if (!record3.invocationCid) return false;
19959
- return invocationsMap.get(record3.invocationCid) !== void 0;
20000
+ function runRecordTrust(record3, sourceBlockId, invocationsMap, receipts) {
20001
+ if (!record3.invocationCid) return "untrusted";
20002
+ const invocation = invocationsMap.get(record3.invocationCid);
20003
+ if (!invocation || typeof invocation !== "object" || invocation.result !== "success") return "untrusted";
20004
+ if (!receipts) return "untrusted";
20005
+ const status = receipts.check(invocation, { blockId: sourceBlockId });
20006
+ return status.status === "verified" ? "verified" : status.status === "pending" ? "pending" : "untrusted";
19960
20007
  }
19961
20008
  function processRunRecord(yDoc, runId, sourceBlockId, record3, listenersBySource, getNodeOutput2, isConsumed, now) {
19962
20009
  if (!Array.isArray(record3.events)) return;
@@ -19993,7 +20040,10 @@ function processRunRecord(yDoc, runId, sourceBlockId, record3, listenersBySource
19993
20040
  refSnapshots,
19994
20041
  assigneeDid,
19995
20042
  emittedAt: record3.completedAt,
19996
- expiresAt
20043
+ expiresAt,
20044
+ // What this invocation acts on: the triggering step's verified
20045
+ // receipt (only verified receipts reach here).
20046
+ ...record3.invocationCid ? { requestId: record3.invocationCid } : {}
19997
20047
  };
19998
20048
  queuePendingInvocation(yDoc, listenerBlockId, invocation, runId);
19999
20049
  writeActionState(yDoc, runId, listenerBlockId, {
@@ -20051,7 +20101,10 @@ function processBarrierRunRecord(yDoc, runId, sourceBlockId, record3, barrierLis
20051
20101
  refSnapshots,
20052
20102
  assigneeDid,
20053
20103
  emittedAt: record3.completedAt,
20054
- expiresAt
20104
+ expiresAt,
20105
+ // What this invocation acts on: the triggering step's verified
20106
+ // receipt (only verified receipts reach here).
20107
+ ...record3.invocationCid ? { requestId: record3.invocationCid } : {}
20055
20108
  };
20056
20109
  queuePendingInvocation(yDoc, listenerBlockId, invocation, runId);
20057
20110
  clearBarrierState(yDoc, listenerBlockId, runId);
@@ -20128,6 +20181,259 @@ function getActionForBlock(block) {
20128
20181
  return getAction(actionType);
20129
20182
  }
20130
20183
 
20184
+ // src/core/lib/flowEngine/versionManifest.ts
20185
+ var VERSION_MANIFEST = {
20186
+ "0.3": {
20187
+ version: "0.3",
20188
+ label: "Legacy",
20189
+ ucanRequired: false,
20190
+ delegationRootRequired: false,
20191
+ whitelistOnlyAllowed: true,
20192
+ unrestrictedAllowed: true,
20193
+ executionPath: "legacy",
20194
+ authorizationFn: "v1",
20195
+ allowedAuthModes: ["anyone", "actors", "capability"],
20196
+ ui: {
20197
+ showDelegationPanel: false,
20198
+ showWhitelistConfig: true,
20199
+ showAnyoneConfig: true,
20200
+ showMigrationBanner: true,
20201
+ requirePinForExecution: false
20202
+ },
20203
+ description: "Legacy version. UCAN optional, whitelist-only authorization accepted."
20204
+ },
20205
+ "1.0.0": {
20206
+ version: "1.0.0",
20207
+ label: "UCAN Required",
20208
+ ucanRequired: true,
20209
+ delegationRootRequired: true,
20210
+ whitelistOnlyAllowed: false,
20211
+ unrestrictedAllowed: false,
20212
+ executionPath: "invocation",
20213
+ authorizationFn: "v2",
20214
+ allowedAuthModes: ["capability"],
20215
+ ui: {
20216
+ showDelegationPanel: true,
20217
+ showWhitelistConfig: false,
20218
+ showAnyoneConfig: false,
20219
+ showMigrationBanner: false,
20220
+ requirePinForExecution: true
20221
+ },
20222
+ description: "UCAN-enforced. Every block execution requires a valid delegation chain."
20223
+ }
20224
+ };
20225
+ var LATEST_VERSION = "1.0.0";
20226
+ var tempUcanEnforcementDisabled = false;
20227
+ function isTempUcanEnforcementDisabled() {
20228
+ return tempUcanEnforcementDisabled;
20229
+ }
20230
+ var MIGRATION_PATH = ["0.3", "1.0.0"];
20231
+ function getVersionPolicy(version) {
20232
+ const policy = VERSION_MANIFEST[version] ?? VERSION_MANIFEST[LATEST_VERSION];
20233
+ if (tempUcanEnforcementDisabled && policy.ucanRequired) {
20234
+ return {
20235
+ ...policy,
20236
+ ucanRequired: false,
20237
+ delegationRootRequired: false,
20238
+ ui: { ...policy.ui, requirePinForExecution: false }
20239
+ };
20240
+ }
20241
+ return policy;
20242
+ }
20243
+ function isVersionAtLeast(current, minimum) {
20244
+ const currentIdx = MIGRATION_PATH.indexOf(current);
20245
+ const minimumIdx = MIGRATION_PATH.indexOf(minimum);
20246
+ const effectiveCurrent = currentIdx === -1 ? MIGRATION_PATH.length : currentIdx;
20247
+ return effectiveCurrent >= minimumIdx;
20248
+ }
20249
+
20250
+ // src/core/lib/flowEngine/vnext/canonical.ts
20251
+ function deepFreezeJson(value) {
20252
+ if (!value || typeof value !== "object") return value;
20253
+ for (const nested of Object.values(value)) deepFreezeJson(nested);
20254
+ return Object.freeze(value);
20255
+ }
20256
+ function isPlainObject2(value) {
20257
+ const prototype = Object.getPrototypeOf(value);
20258
+ return prototype === Object.prototype || prototype === null;
20259
+ }
20260
+ function assertValidUnicode2(value) {
20261
+ for (let index = 0; index < value.length; index += 1) {
20262
+ const codeUnit = value.charCodeAt(index);
20263
+ if (codeUnit >= 55296 && codeUnit <= 56319) {
20264
+ const next = value.charCodeAt(index + 1);
20265
+ if (!(next >= 56320 && next <= 57343)) {
20266
+ throw new TypeError("Canonical JSON contains an unpaired Unicode surrogate");
20267
+ }
20268
+ index += 1;
20269
+ } else if (codeUnit >= 56320 && codeUnit <= 57343) {
20270
+ throw new TypeError("Canonical JSON contains an unpaired Unicode surrogate");
20271
+ }
20272
+ }
20273
+ }
20274
+ function canonicalizeJson(value) {
20275
+ const ancestors = /* @__PURE__ */ new Set();
20276
+ const serialize = (candidate) => {
20277
+ if (candidate === null || typeof candidate === "boolean") return JSON.stringify(candidate);
20278
+ if (typeof candidate === "string") {
20279
+ assertValidUnicode2(candidate);
20280
+ return JSON.stringify(candidate);
20281
+ }
20282
+ if (typeof candidate === "number") {
20283
+ if (!Number.isFinite(candidate)) throw new TypeError("Canonical JSON numbers must be finite");
20284
+ return JSON.stringify(candidate);
20285
+ }
20286
+ if (typeof candidate !== "object") {
20287
+ throw new TypeError(`Canonical JSON contains a non-JSON value: ${typeof candidate}`);
20288
+ }
20289
+ if (ancestors.has(candidate)) throw new TypeError("Canonical JSON contains a circular reference");
20290
+ ancestors.add(candidate);
20291
+ try {
20292
+ if (Array.isArray(candidate)) return `[${candidate.map((entry) => serialize(entry)).join(",")}]`;
20293
+ if (!isPlainObject2(candidate)) throw new TypeError("Canonical JSON contains a non-plain object");
20294
+ return `{${Object.keys(candidate).sort().map((key) => {
20295
+ assertValidUnicode2(key);
20296
+ return `${JSON.stringify(key)}:${serialize(candidate[key])}`;
20297
+ }).join(",")}}`;
20298
+ } finally {
20299
+ ancestors.delete(candidate);
20300
+ }
20301
+ };
20302
+ return serialize(value);
20303
+ }
20304
+ async function digestCanonicalJson(value) {
20305
+ if (!globalThis.crypto?.subtle) throw new Error("Web Crypto is required to digest a Flow contract");
20306
+ const bytes = new TextEncoder().encode(canonicalizeJson(value));
20307
+ const digest2 = await globalThis.crypto.subtle.digest("SHA-256", bytes);
20308
+ const hex = Array.from(new Uint8Array(digest2), (byte) => byte.toString(16).padStart(2, "0")).join("");
20309
+ return `sha256:${hex}`;
20310
+ }
20311
+
20312
+ // src/core/lib/ucan/requestProofs.ts
20313
+ var FLOW_REQUESTS_MAP_KEY = "qi.flow.requests";
20314
+ function capabilityForRequest(kind, docId, stepId) {
20315
+ const flow = `ixo:flow:${docId}`;
20316
+ switch (kind) {
20317
+ case "run.start":
20318
+ return { can: "flow/run.start", with: flow };
20319
+ case "run.close":
20320
+ return { can: "flow/run.close", with: flow };
20321
+ case "schedule.arm":
20322
+ return { can: "flow/run.start-scheduled", with: flow };
20323
+ case "step.request":
20324
+ case "input.respond":
20325
+ if (!stepId) throw new Error(`A ${kind} request needs the step it is about.`);
20326
+ return { can: "flow/block/execute", with: `${flow}:${stepId}` };
20327
+ }
20328
+ }
20329
+ function digestRequestValue(value) {
20330
+ return digestCanonicalJson(JSON.parse(JSON.stringify(value ?? null)));
20331
+ }
20332
+ function digestInputResponse(content) {
20333
+ const { authorization: _authorization, ...rest } = content;
20334
+ return digestRequestValue(rest);
20335
+ }
20336
+ function randomRequestId() {
20337
+ const bytes = new Uint8Array(16);
20338
+ globalThis.crypto.getRandomValues(bytes);
20339
+ return `req-${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
20340
+ }
20341
+ async function createFlowRequest(ucanService, params) {
20342
+ if (!params.flowManagerDid.startsWith("did:")) throw new Error("The flow-manager is not known, so this request cannot be addressed to it.");
20343
+ if (params.kind !== "schedule.arm" && !params.runId) throw new Error(`A ${params.kind} request needs the run it is about.`);
20344
+ if (params.kind === "schedule.arm" && (!params.scheduleId || params.scheduleRevision === void 0)) {
20345
+ throw new Error("A schedule arm request needs the schedule and its current revision.");
20346
+ }
20347
+ const requestId = params.requestId ?? randomRequestId();
20348
+ const capability = capabilityForRequest(params.kind, params.docId, params.stepId);
20349
+ const facts = {
20350
+ type: "qi.flow.request",
20351
+ v: 1,
20352
+ kind: params.kind,
20353
+ roomId: params.roomId,
20354
+ docId: params.docId,
20355
+ ...params.runId ? { runId: params.runId } : {},
20356
+ ...params.stepId ? { stepId: params.stepId } : {},
20357
+ defHash: params.defHash,
20358
+ ...params.input !== void 0 ? { inputDigest: await digestRequestValue(params.input) } : {},
20359
+ requestId,
20360
+ ...params.answerDigest ? { answerDigest: params.answerDigest } : {},
20361
+ ...params.requestEventId ? { requestEventId: params.requestEventId } : {},
20362
+ ...params.scheduleId ? { scheduleId: params.scheduleId } : {},
20363
+ ...params.scheduleRevision !== void 0 ? { scheduleRevision: params.scheduleRevision } : {}
20364
+ };
20365
+ const result = await ucanService.createAndValidateInvocation(
20366
+ {
20367
+ invokerDid: params.requesterDid,
20368
+ invokerType: "user",
20369
+ audience: params.flowManagerDid,
20370
+ capability,
20371
+ proofs: [],
20372
+ facts,
20373
+ pin: params.pin
20374
+ },
20375
+ params.docId,
20376
+ params.stepId
20377
+ );
20378
+ if (!result.valid || !result.cid || !result.invocation) {
20379
+ throw new Error(result.error || "Your request could not be signed.");
20380
+ }
20381
+ return {
20382
+ v: 1,
20383
+ requestId,
20384
+ kind: params.kind,
20385
+ runId: params.runId ?? "",
20386
+ ...params.stepId ? { stepId: params.stepId } : {},
20387
+ requesterDid: params.requesterDid,
20388
+ invocationCid: result.cid,
20389
+ invocation: result.invocation,
20390
+ createdAt: (params.now ?? Date.now)()
20391
+ };
20392
+ }
20393
+ function writeFlowRequest(yDoc, record3) {
20394
+ yDoc.getMap(FLOW_REQUESTS_MAP_KEY).set(record3.invocationCid, record3);
20395
+ }
20396
+ function readFlowRequest(yDoc, requestId) {
20397
+ let found;
20398
+ yDoc.getMap(FLOW_REQUESTS_MAP_KEY).forEach((record3) => {
20399
+ if (!found && record3 && typeof record3 === "object" && record3.requestId === requestId) found = record3;
20400
+ });
20401
+ return found;
20402
+ }
20403
+ function lifecycleRequestProof(options) {
20404
+ return async ({ runId, defHash }) => options.ucanService.createRequestInvocation({
20405
+ kind: options.kind,
20406
+ requesterDid: options.requesterDid,
20407
+ flowManagerDid: options.flowManagerDid,
20408
+ roomId: options.roomId,
20409
+ docId: options.docId,
20410
+ runId,
20411
+ defHash,
20412
+ pin: await options.getPin()
20413
+ });
20414
+ }
20415
+ async function requestStepRun(yDoc, params) {
20416
+ const docId = yDoc.getMap("root").get("doc_id");
20417
+ if (typeof docId !== "string" || !docId) throw new Error("The flow has no id yet, so a step request cannot be signed for it.");
20418
+ const record3 = await createFlowRequest(params.ucanService, {
20419
+ kind: "step.request",
20420
+ requesterDid: params.requesterDid,
20421
+ flowManagerDid: params.flowManagerDid,
20422
+ roomId: params.roomId,
20423
+ docId,
20424
+ runId: params.runId,
20425
+ stepId: params.stepId,
20426
+ defHash: params.defHash ?? getRunMeta(yDoc, params.runId)?.manifest?.defHash ?? "",
20427
+ ...params.input !== void 0 ? { input: params.input } : {},
20428
+ pin: params.pin
20429
+ });
20430
+ yDoc.transact(() => {
20431
+ writeFlowRequest(yDoc, record3);
20432
+ resetActionState(yDoc, params.runId, params.stepId, { state: "idle", requestId: record3.requestId });
20433
+ });
20434
+ return record3;
20435
+ }
20436
+
20131
20437
  // src/core/lib/flowEngine/vnext/legacy.ts
20132
20438
  var LegacyFlowFrozenError = class extends Error {
20133
20439
  constructor(operation) {
@@ -20324,11 +20630,13 @@ async function startRun(params) {
20324
20630
  const now = params.now?.() ?? Date.now();
20325
20631
  const seq = nextRunSequence(params.yDoc);
20326
20632
  const runId = createRunId(seq, now);
20633
+ const request = params.requestProof ? await params.requestProof({ runId, defHash: params.definition.manifest.defHash }) : void 0;
20327
20634
  const meta = {
20328
20635
  seq,
20329
20636
  startedAt: now,
20330
20637
  startedByDid: params.actorDid,
20331
20638
  origin: "started",
20639
+ ...request ? { startRequestId: request.requestId } : {},
20332
20640
  ...params.label ? { label: params.label } : {},
20333
20641
  manifest: {
20334
20642
  blockIds: [...params.definition.manifest.blockIds],
@@ -20339,7 +20647,8 @@ async function startRun(params) {
20339
20647
  runId,
20340
20648
  kind: "run.started",
20341
20649
  payload: {
20342
- ...authorization.invocationCid ? { invocationCid: authorization.invocationCid } : {},
20650
+ // The requester's signed start request (a real invocation, not a grant).
20651
+ ...request ? { invocationCid: request.invocationCid } : authorization.invocationCid ? { invocationCid: authorization.invocationCid } : {},
20343
20652
  definitionRevision: params.definition.manifest.defHash,
20344
20653
  ...params.label ? { label: params.label } : {}
20345
20654
  },
@@ -20349,6 +20658,7 @@ async function startRun(params) {
20349
20658
  let flowStartInvocations = 0;
20350
20659
  params.yDoc.transact(() => {
20351
20660
  setMultiRunStorage(params.yDoc);
20661
+ if (request) writeFlowRequest(params.yDoc, request);
20352
20662
  ensureRun(params.yDoc, runId, meta);
20353
20663
  for (const blockId of meta.manifest.blockIds) {
20354
20664
  resetActionState(params.yDoc, runId, blockId, { state: "idle" });
@@ -20359,7 +20669,8 @@ async function startRun(params) {
20359
20669
  runId,
20360
20670
  blocks: params.document,
20361
20671
  startedAt: now,
20362
- sourceEventId: eventId
20672
+ sourceEventId: eventId,
20673
+ ...request ? { requestId: request.requestId } : {}
20363
20674
  });
20364
20675
  }
20365
20676
  params.yDoc.getMap("root").set("activeRunId", runId);
@@ -20388,11 +20699,13 @@ async function migrateFlowToSessions(params) {
20388
20699
  defHash: params.definition.manifest.defHash,
20389
20700
  startedAt
20390
20701
  });
20702
+ const request = params.requestProof ? await params.requestProof({ runId, defHash: params.definition.manifest.defHash }) : void 0;
20391
20703
  const meta = {
20392
20704
  seq: 1,
20393
20705
  startedAt,
20394
20706
  startedByDid: params.actorDid,
20395
20707
  origin: "migrated",
20708
+ ...request ? { startRequestId: request.requestId } : {},
20396
20709
  label: params.label || "Session 1 (migrated)",
20397
20710
  manifest: {
20398
20711
  blockIds: [...params.definition.manifest.blockIds],
@@ -20403,7 +20716,8 @@ async function migrateFlowToSessions(params) {
20403
20716
  runId,
20404
20717
  kind: "run.started",
20405
20718
  payload: {
20406
- ...authorization.invocationCid ? { invocationCid: authorization.invocationCid } : {},
20719
+ // The requester's signed start request (a real invocation, not a grant).
20720
+ ...request ? { invocationCid: request.invocationCid } : authorization.invocationCid ? { invocationCid: authorization.invocationCid } : {},
20407
20721
  definitionRevision: params.definition.manifest.defHash,
20408
20722
  label: meta.label
20409
20723
  },
@@ -20415,6 +20729,7 @@ async function migrateFlowToSessions(params) {
20415
20729
  let phantomCollected = false;
20416
20730
  params.yDoc.transact(() => {
20417
20731
  phantomCollected = collectPhantomLegacyRun(params.yDoc);
20732
+ if (request) writeFlowRequest(params.yDoc, request);
20418
20733
  ensureRun(params.yDoc, runId, meta);
20419
20734
  seeded = seedRunFromLegacyRuntime(params.yDoc, runId);
20420
20735
  stamped = stampPreSessionRecords(params.yDoc, runId);
@@ -20465,7 +20780,7 @@ function inspectPinnedDesignPodRunForClosure(yDoc, runId) {
20465
20780
  publication: typeof releaseDigest === "string" ? designPodState?.get(`publication:${releaseDigest}`) : void 0,
20466
20781
  root: {
20467
20782
  doc_id: getExistingYMap(yDoc, "root")?.get("doc_id"),
20468
- flowOwnerDid: getExistingYMap(yDoc, "root")?.get("flowOwnerDid")
20783
+ flowOwnerDid: flowOwnerOf(yDoc)
20469
20784
  }
20470
20785
  })
20471
20786
  )
@@ -20750,6 +21065,7 @@ async function closeRun(params) {
20750
21065
  actorDid: params.actorDid,
20751
21066
  runId: params.runId
20752
21067
  });
21068
+ await recordCloseRequest(params);
20753
21069
  const now = params.now?.() ?? Date.now();
20754
21070
  const summary = computeRunSummary(params.yDoc, params.runId, params.actionTypes, {
20755
21071
  flowId: params.flowUri,
@@ -20769,7 +21085,7 @@ async function closeRun(params) {
20769
21085
  const retained = await readMatrixTerminalState(params.eventLog, {
20770
21086
  runId: params.runId,
20771
21087
  flowUri: params.flowUri,
20772
- flowOwnerDid: String(getExistingYMap(params.yDoc, "root")?.get("flowOwnerDid") || ""),
21088
+ flowOwnerDid: flowOwnerOf(params.yDoc),
20773
21089
  verifyInvocation: params.verifyTerminalInvocation,
20774
21090
  requireAuthenticated: true
20775
21091
  });
@@ -20812,7 +21128,7 @@ async function closeRun(params) {
20812
21128
  try {
20813
21129
  const reconciled = await reconcileTerminalEvent(params.eventLog, event, reservation, {
20814
21130
  flowUri: params.flowUri,
20815
- flowOwnerDid: String(getExistingYMap(params.yDoc, "root")?.get("flowOwnerDid") || ""),
21131
+ flowOwnerDid: flowOwnerOf(params.yDoc),
20816
21132
  verifyInvocation: params.verifyTerminalInvocation,
20817
21133
  requireAuthenticated: authenticatedTerminalRequired
20818
21134
  });
@@ -20823,6 +21139,15 @@ async function closeRun(params) {
20823
21139
  }
20824
21140
  });
20825
21141
  }
21142
+ async function recordCloseRequest(params) {
21143
+ if (!params.requestProof) return;
21144
+ const defHash = getRunMeta(params.yDoc, params.runId)?.manifest?.defHash ?? "";
21145
+ const request = await params.requestProof({ runId: params.runId, defHash });
21146
+ params.yDoc.transact(() => {
21147
+ writeFlowRequest(params.yDoc, request);
21148
+ patchRunMeta(params.yDoc, params.runId, { closeRequestId: request.requestId });
21149
+ });
21150
+ }
20826
21151
  async function cancelRun(params) {
20827
21152
  return withLifecycleLock(params.yDoc, params.runId, async () => {
20828
21153
  const existing = getExistingRunsTerminalMap(params.yDoc)?.get(params.runId);
@@ -20846,6 +21171,7 @@ async function cancelRun(params) {
20846
21171
  actorDid: params.actorDid,
20847
21172
  runId: params.runId
20848
21173
  });
21174
+ await recordCloseRequest(params);
20849
21175
  const now = params.now?.() ?? Date.now();
20850
21176
  const pinnedDesignPod = await authenticatePinnedDesignPodClosure(params);
20851
21177
  const authenticatedTerminalRequired = pinnedDesignPod.pinned || Boolean(params.terminalAuthorization);
@@ -20859,7 +21185,7 @@ async function cancelRun(params) {
20859
21185
  const retained = await readMatrixTerminalState(params.eventLog, {
20860
21186
  runId: params.runId,
20861
21187
  flowUri: params.flowUri,
20862
- flowOwnerDid: String(getExistingYMap(params.yDoc, "root")?.get("flowOwnerDid") || ""),
21188
+ flowOwnerDid: flowOwnerOf(params.yDoc),
20863
21189
  verifyInvocation: params.verifyTerminalInvocation,
20864
21190
  requireAuthenticated: true
20865
21191
  });
@@ -20900,7 +21226,7 @@ async function cancelRun(params) {
20900
21226
  try {
20901
21227
  const reconciled = await reconcileTerminalEvent(params.eventLog, event, reservation, {
20902
21228
  flowUri: params.flowUri,
20903
- flowOwnerDid: String(getExistingYMap(params.yDoc, "root")?.get("flowOwnerDid") || ""),
21229
+ flowOwnerDid: flowOwnerOf(params.yDoc),
20904
21230
  verifyInvocation: params.verifyTerminalInvocation,
20905
21231
  requireAuthenticated: authenticatedTerminalRequired
20906
21232
  });
@@ -20996,43 +21322,22 @@ function resolveRef(ref, getNodeOutput2, triggerContext) {
20996
21322
  }
20997
21323
 
20998
21324
  // src/core/lib/flowEngine/authorization.ts
20999
- var isAuthorized = async (blockId, actorDid, ucanService, flowUri, schemaVersion, options = {}) => {
21000
- const policy = schemaVersion ? getVersionPolicy(schemaVersion) : null;
21001
- const requireUcan = options.requireSignedInvocation === true;
21002
- if (policy && !policy.ucanRequired && !requireUcan) {
21003
- return { authorized: true };
21004
- }
21325
+ var isAuthorized = async (blockId, actorDid, ucanService, flowUri) => {
21005
21326
  if (!ucanService) {
21006
- if (!policy && !requireUcan) {
21007
- return { authorized: true };
21008
- }
21009
- return {
21010
- authorized: false,
21011
- reason: requireUcan ? "UCAN service is not configured. This governed action requires a signed Flow invocation." : "UCAN service is not configured. This flow version requires UCAN authorization."
21012
- };
21327
+ return { authorized: false, reason: "This editor cannot check grants, so no step can run here." };
21013
21328
  }
21014
21329
  const capability = {
21015
21330
  can: "flow/block/execute",
21016
21331
  with: `${flowUri}:${blockId}`
21017
21332
  };
21018
- const result = await ucanService.validateDelegationChain(actorDid, capability);
21019
- if (!result.valid) {
21020
- return {
21021
- authorized: false,
21022
- reason: result.error || "No valid capability chain found"
21023
- };
21024
- }
21025
- const proofCids = result.proofChain?.map((d) => d.cid) || [];
21026
- if (requireUcan && proofCids.length === 0) {
21027
- return {
21028
- authorized: false,
21029
- reason: "A signed invocation requires a non-empty UCAN delegation proof chain."
21030
- };
21333
+ const result = await ucanService.findValidProofs(actorDid, capability);
21334
+ if (!result.found || !result.proofCids) {
21335
+ return { authorized: false, reason: result.error || "You have not been given this step in this flow." };
21031
21336
  }
21032
21337
  return {
21033
21338
  authorized: true,
21034
- capabilityId: proofCids[0],
21035
- proofCids
21339
+ capabilityId: result.proofCids[0],
21340
+ proofCids: result.proofCids
21036
21341
  };
21037
21342
  };
21038
21343
 
@@ -21057,82 +21362,83 @@ var executeNode = async ({
21057
21362
  context,
21058
21363
  action,
21059
21364
  invocationFacts = {},
21060
- requireSignedInvocation = false,
21061
21365
  pin
21062
21366
  }) => {
21063
- const { runtime, ucanService, invocationStore, flowUri, flowId, sessionRunId, schemaVersion, now } = context;
21064
- const auth = await isAuthorized(node.id, actorDid, ucanService, flowUri, schemaVersion, { requireSignedInvocation });
21065
- if (!auth.authorized) {
21367
+ const { runtime, ucanService, invocationStore, flowUri, flowId, sessionRunId, now } = context;
21368
+ const auth = await isAuthorized(node.id, actorDid, ucanService, flowUri);
21369
+ if (!auth.authorized || !ucanService) {
21066
21370
  return { success: false, stage: "authorization", error: auth.reason };
21067
21371
  }
21068
- if (requireSignedInvocation && !invocationStore) {
21069
- return { success: false, stage: "authorization", error: "A persisted invocation store is required for this governed action." };
21372
+ if (!invocationStore) {
21373
+ return { success: false, stage: "authorization", error: "This step cannot be recorded here, so it cannot run: no invocation store." };
21070
21374
  }
21071
21375
  if (node.linkedClaim && !node.linkedClaim.collectionId) {
21072
21376
  return { success: false, stage: "claim", error: "Linked claim collection is required but missing." };
21073
21377
  }
21378
+ const capability = {
21379
+ can: "flow/block/execute",
21380
+ with: `${flowUri}:${node.id}`
21381
+ };
21074
21382
  let invocationCid;
21075
21383
  let invocationData;
21076
- if (ucanService && auth.proofCids && auth.proofCids.length > 0) {
21077
- const capability = {
21078
- can: "flow/block/execute",
21079
- with: `${flowUri}:${node.id}`
21080
- };
21081
- try {
21082
- const invocationResult = await ucanService.createAndValidateInvocation(
21083
- {
21084
- invokerDid: actorDid,
21085
- invokerType: actorType,
21086
- entityRoomId,
21087
- capability,
21088
- proofs: auth.proofCids,
21089
- facts: invocationFacts,
21090
- pin
21091
- },
21092
- flowId,
21093
- node.id
21094
- );
21095
- if (!invocationResult.valid) {
21096
- return {
21097
- success: false,
21098
- stage: "authorization",
21099
- error: `Invocation validation failed: ${invocationResult.error}`
21100
- };
21101
- }
21102
- invocationCid = invocationResult.cid;
21103
- invocationData = invocationResult.invocation;
21104
- } catch (error) {
21105
- const message = error instanceof Error ? error.message : "Failed to create invocation";
21106
- return { success: false, stage: "authorization", error: message };
21384
+ let signedFacts = invocationFacts;
21385
+ let proofCids = auth.proofCids || [];
21386
+ let signedAt;
21387
+ try {
21388
+ const invocationResult = await ucanService.createAndValidateInvocation(
21389
+ {
21390
+ invokerDid: actorDid,
21391
+ invokerType: actorType,
21392
+ entityRoomId,
21393
+ capability,
21394
+ proofs: proofCids,
21395
+ facts: invocationFacts,
21396
+ pin
21397
+ },
21398
+ flowId,
21399
+ node.id
21400
+ );
21401
+ if (!invocationResult.valid || !invocationResult.cid || !invocationResult.invocation) {
21402
+ return {
21403
+ success: false,
21404
+ stage: "authorization",
21405
+ error: `Invocation validation failed: ${invocationResult.error ?? "no signed invocation was produced"}`
21406
+ };
21107
21407
  }
21408
+ invocationCid = invocationResult.cid;
21409
+ invocationData = invocationResult.invocation;
21410
+ signedFacts = invocationResult.facts ?? invocationFacts;
21411
+ proofCids = invocationResult.proofCids ?? proofCids;
21412
+ signedAt = invocationResult.signedAt;
21413
+ } catch (error) {
21414
+ const message = error instanceof Error ? error.message : "Failed to create invocation";
21415
+ return { success: false, stage: "authorization", error: message };
21108
21416
  }
21109
- if (requireSignedInvocation && (!invocationCid || !invocationData)) {
21110
- return { success: false, stage: "authorization", error: "This governed action requires a signed Flow invocation." };
21111
- }
21417
+ const executedAt = () => signedAt ?? (now ? now() : Date.now());
21112
21418
  try {
21113
21419
  const result = await action({
21114
21420
  invocationCid,
21115
21421
  invocation: invocationData,
21116
21422
  capabilityId: auth.capabilityId,
21117
- proofCids: auth.proofCids || [],
21118
- capability: { can: "flow/block/execute", with: `${flowUri}:${node.id}` },
21119
- facts: invocationFacts
21423
+ proofCids,
21424
+ capability,
21425
+ facts: signedFacts
21120
21426
  });
21121
21427
  if (node.linkedClaim && !result.claimId) {
21122
- if (invocationStore && invocationCid && invocationData) {
21428
+ {
21123
21429
  const storedInvocation = {
21124
21430
  cid: invocationCid,
21125
21431
  invocation: invocationData,
21126
21432
  invokerDid: actorDid,
21127
- capability: { can: "flow/block/execute", with: `${flowUri}:${node.id}` },
21128
- executedAt: now ? now() : Date.now(),
21433
+ capability,
21434
+ executedAt: executedAt(),
21129
21435
  flowId,
21130
21436
  sessionRunId,
21131
21437
  blockId: node.id,
21132
21438
  result: "failure",
21133
21439
  error: "Execution did not return a claimId for linked claim requirement.",
21134
- proofCids: auth.proofCids || [],
21135
- facts: invocationFacts
21440
+ proofCids,
21441
+ facts: signedFacts
21136
21442
  };
21137
21443
  invocationStore.add(storedInvocation);
21138
21444
  }
@@ -21143,24 +21449,25 @@ var executeNode = async ({
21143
21449
  invocationCid
21144
21450
  };
21145
21451
  }
21146
- if (invocationStore && invocationCid && invocationData) {
21452
+ {
21147
21453
  const storedInvocation = {
21148
21454
  cid: invocationCid,
21149
21455
  invocation: invocationData,
21150
21456
  invokerDid: actorDid,
21151
- capability: { can: "flow/block/execute", with: `${flowUri}:${node.id}` },
21152
- executedAt: now ? now() : Date.now(),
21457
+ capability,
21458
+ executedAt: executedAt(),
21153
21459
  flowId,
21154
21460
  sessionRunId,
21155
21461
  blockId: node.id,
21156
21462
  result: "success",
21157
- proofCids: auth.proofCids || [],
21158
- facts: invocationFacts,
21463
+ proofCids,
21464
+ facts: signedFacts,
21159
21465
  claimId: result.claimId
21160
21466
  };
21161
21467
  invocationStore.add(storedInvocation);
21468
+ ucanService.receipts?.remember(storedInvocation, { blockId: node.id }, { status: "verified" });
21162
21469
  }
21163
- updateRuntimeAfterSuccess(node, actorDid, runtime, result, invocationCid || auth.capabilityId, now);
21470
+ updateRuntimeAfterSuccess(node, actorDid, runtime, result, invocationCid, now);
21164
21471
  return {
21165
21472
  success: true,
21166
21473
  stage: "complete",
@@ -21170,20 +21477,20 @@ var executeNode = async ({
21170
21477
  };
21171
21478
  } catch (error) {
21172
21479
  const message = error instanceof Error ? error.message : "Execution failed";
21173
- if (invocationStore && invocationCid && invocationData) {
21480
+ {
21174
21481
  const storedInvocation = {
21175
21482
  cid: invocationCid,
21176
21483
  invocation: invocationData,
21177
21484
  invokerDid: actorDid,
21178
- capability: { can: "flow/block/execute", with: `${flowUri}:${node.id}` },
21179
- executedAt: now ? now() : Date.now(),
21485
+ capability,
21486
+ executedAt: executedAt(),
21180
21487
  flowId,
21181
21488
  sessionRunId,
21182
21489
  blockId: node.id,
21183
21490
  result: "failure",
21184
21491
  error: message,
21185
- proofCids: auth.proofCids || [],
21186
- facts: invocationFacts
21492
+ proofCids,
21493
+ facts: signedFacts
21187
21494
  };
21188
21495
  invocationStore.add(storedInvocation);
21189
21496
  }
@@ -21225,7 +21532,9 @@ function getReconcileEditor(params, yDoc, editor) {
21225
21532
  return {
21226
21533
  _yDoc: yDoc,
21227
21534
  _yRuntime: createRunRuntimeReaderWithDoc(yDoc, resolveRunIdForExecution(yDoc, params.runId)),
21228
- document: params.document
21535
+ document: params.document,
21536
+ // Reconciliation trusts the carried-forward receipt only when it verifies.
21537
+ getUcanService: () => params.ucanService ?? null
21229
21538
  };
21230
21539
  }
21231
21540
  function makeExecutionId(now) {
@@ -21737,7 +22046,8 @@ function getFlowMetadata(editor) {
21737
22046
  return {
21738
22047
  flowId,
21739
22048
  flowUri: flowId ? `ixo:flow:${flowId}` : "",
21740
- flowOwnerDid: editor?.getFlowOwnerDid?.() || metadata?.flowOwnerDid || "",
22049
+ // Room creator only; the doc's flowOwnerDid copy is not authority.
22050
+ flowOwnerDid: editor?.getFlowOwnerDid?.() || "",
21741
22051
  schemaVersion: metadata?.schema_version || "0.3"
21742
22052
  };
21743
22053
  }
@@ -21811,7 +22121,10 @@ function getReconcileEditor2(params, yDoc, editor) {
21811
22121
  return {
21812
22122
  _yDoc: yDoc,
21813
22123
  _yRuntime: createRunRuntimeReaderWithDoc(yDoc, resolveRunIdForExecution(yDoc, params.runId)),
21814
- document: params.document
22124
+ document: params.document,
22125
+ // Reconciliation trusts a run record only when its receipt verifies, and
22126
+ // reads the verifier from the service this execution signed with.
22127
+ getUcanService: () => params.ucanService ?? null
21815
22128
  };
21816
22129
  }
21817
22130
  function persistEvents(params) {
@@ -22443,13 +22756,26 @@ function runLedgerAttestations(yDoc) {
22443
22756
  };
22444
22757
  return (attemptId) => (index ?? (index = build())).get(attemptId);
22445
22758
  }
22759
+ function receiptVerdict(params, invocationCid, missingReason) {
22760
+ if (!invocationCid) return { status: "unverified", reason: missingReason };
22761
+ if (!params.getInvocation) return { status: "unverified", reason: "No invocation store available to verify the completion." };
22762
+ const invocation = params.getInvocation(invocationCid);
22763
+ if (!invocation) return { status: "unverified", reason: `Invocation ${invocationCid} not found in the invocation store.` };
22764
+ if (invocation.result !== "success") return { status: "unverified", reason: "Completion references a failed invocation." };
22765
+ if (invocation.blockId && invocation.blockId !== params.blockId) return { status: "unverified", reason: "Completion references an invocation for a different block." };
22766
+ if (!params.checkReceipt) return { status: "unverified", reason: "This step's receipt can't be checked here: no UCAN verifier is set up." };
22767
+ const receipt = params.checkReceipt(invocation, { blockId: params.blockId });
22768
+ if (receipt.status === "pending") return { status: "pending" };
22769
+ if (receipt.status === "unverified") return { status: "unverified", reason: receipt.reason };
22770
+ return { status: "verified" };
22771
+ }
22446
22772
  function verifyCompletion(params) {
22447
- const { runtime, blockId, actionType, getInvocation, getRunAttestation, schemaVersion } = params;
22773
+ const { runtime, blockId, actionType, getRunAttestation } = params;
22448
22774
  if (!runtime || runtime.state !== "completed") {
22449
22775
  return { status: "not_completed" };
22450
22776
  }
22451
22777
  if (runtime.manuallyVerified === true) {
22452
- return { status: "verified" };
22778
+ return receiptVerdict(params, runtime.lastInvocationCid, "This step was marked verified without a signed confirmation from someone allowed on it.");
22453
22779
  }
22454
22780
  if (actionType) {
22455
22781
  const action = getAction(actionType);
@@ -22460,10 +22786,6 @@ function verifyCompletion(params) {
22460
22786
  }
22461
22787
  }
22462
22788
  }
22463
- const policy = schemaVersion ? getVersionPolicy(schemaVersion) : null;
22464
- if (!policy?.ucanRequired) {
22465
- return { status: "verified" };
22466
- }
22467
22789
  const attemptId = typeof runtime.attemptId === "string" ? runtime.attemptId : void 0;
22468
22790
  const attestation = attemptId ? getRunAttestation?.(attemptId) : void 0;
22469
22791
  if (attestation) {
@@ -22478,27 +22800,11 @@ function verifyCompletion(params) {
22478
22800
  }
22479
22801
  return { status: "verified" };
22480
22802
  }
22481
- const invocationCid = runtime.lastInvocationCid;
22482
- if (!invocationCid) {
22483
- return {
22484
- status: "unverified",
22485
- reason: attemptId ? `Completed with no invocation record and no run-ledger attestation for attempt ${attemptId}.` : "Completed without an invocation record on a UCAN-enforced flow."
22486
- };
22487
- }
22488
- if (!getInvocation) {
22489
- return { status: "unverified", reason: "No invocation store available to verify the completion." };
22490
- }
22491
- const invocation = getInvocation(invocationCid);
22492
- if (!invocation) {
22493
- return { status: "unverified", reason: `Invocation ${invocationCid} not found in the invocation store.` };
22494
- }
22495
- if (invocation.result !== "success") {
22496
- return { status: "unverified", reason: "Completion references a failed invocation." };
22497
- }
22498
- if (invocation.blockId && invocation.blockId !== blockId) {
22499
- return { status: "unverified", reason: "Completion references an invocation for a different block." };
22500
- }
22501
- return { status: "verified" };
22803
+ return receiptVerdict(
22804
+ params,
22805
+ runtime.lastInvocationCid,
22806
+ attemptId ? `Completed with no invocation record and no run-ledger attestation for attempt ${attemptId}.` : "Completed without a signed receipt."
22807
+ );
22502
22808
  }
22503
22809
  function isVerifiedCompletion(params) {
22504
22810
  return verifyCompletion(params).status === "verified";
@@ -22545,68 +22851,6 @@ function deriveBlockPhase(params) {
22545
22851
  }
22546
22852
  }
22547
22853
 
22548
- // src/core/lib/flowEngine/vnext/canonical.ts
22549
- function deepFreezeJson(value) {
22550
- if (!value || typeof value !== "object") return value;
22551
- for (const nested of Object.values(value)) deepFreezeJson(nested);
22552
- return Object.freeze(value);
22553
- }
22554
- function isPlainObject2(value) {
22555
- const prototype = Object.getPrototypeOf(value);
22556
- return prototype === Object.prototype || prototype === null;
22557
- }
22558
- function assertValidUnicode2(value) {
22559
- for (let index = 0; index < value.length; index += 1) {
22560
- const codeUnit = value.charCodeAt(index);
22561
- if (codeUnit >= 55296 && codeUnit <= 56319) {
22562
- const next = value.charCodeAt(index + 1);
22563
- if (!(next >= 56320 && next <= 57343)) {
22564
- throw new TypeError("Canonical JSON contains an unpaired Unicode surrogate");
22565
- }
22566
- index += 1;
22567
- } else if (codeUnit >= 56320 && codeUnit <= 57343) {
22568
- throw new TypeError("Canonical JSON contains an unpaired Unicode surrogate");
22569
- }
22570
- }
22571
- }
22572
- function canonicalizeJson(value) {
22573
- const ancestors = /* @__PURE__ */ new Set();
22574
- const serialize = (candidate) => {
22575
- if (candidate === null || typeof candidate === "boolean") return JSON.stringify(candidate);
22576
- if (typeof candidate === "string") {
22577
- assertValidUnicode2(candidate);
22578
- return JSON.stringify(candidate);
22579
- }
22580
- if (typeof candidate === "number") {
22581
- if (!Number.isFinite(candidate)) throw new TypeError("Canonical JSON numbers must be finite");
22582
- return JSON.stringify(candidate);
22583
- }
22584
- if (typeof candidate !== "object") {
22585
- throw new TypeError(`Canonical JSON contains a non-JSON value: ${typeof candidate}`);
22586
- }
22587
- if (ancestors.has(candidate)) throw new TypeError("Canonical JSON contains a circular reference");
22588
- ancestors.add(candidate);
22589
- try {
22590
- if (Array.isArray(candidate)) return `[${candidate.map((entry) => serialize(entry)).join(",")}]`;
22591
- if (!isPlainObject2(candidate)) throw new TypeError("Canonical JSON contains a non-plain object");
22592
- return `{${Object.keys(candidate).sort().map((key) => {
22593
- assertValidUnicode2(key);
22594
- return `${JSON.stringify(key)}:${serialize(candidate[key])}`;
22595
- }).join(",")}}`;
22596
- } finally {
22597
- ancestors.delete(candidate);
22598
- }
22599
- };
22600
- return serialize(value);
22601
- }
22602
- async function digestCanonicalJson(value) {
22603
- if (!globalThis.crypto?.subtle) throw new Error("Web Crypto is required to digest a Flow contract");
22604
- const bytes = new TextEncoder().encode(canonicalizeJson(value));
22605
- const digest2 = await globalThis.crypto.subtle.digest("SHA-256", bytes);
22606
- const hex = Array.from(new Uint8Array(digest2), (byte) => byte.toString(16).padStart(2, "0")).join("");
22607
- return `sha256:${hex}`;
22608
- }
22609
-
22610
22854
  // src/core/lib/flowEngine/vnext/contracts.ts
22611
22855
  var FlowDefinitionVerificationError = class extends Error {
22612
22856
  constructor(code, message) {
@@ -25244,22 +25488,372 @@ var createMemoryInvocationStore = () => {
25244
25488
  };
25245
25489
 
25246
25490
  // src/core/services/ucanService.ts
25491
+ var import_ucan2 = require("@ixo/ucan");
25492
+
25493
+ // src/core/lib/ucan/signedChain.ts
25247
25494
  var import_ucan = require("@ixo/ucan");
25495
+ var import_core = require("@ucanto/core");
25496
+ var RECEIPT_ANCHOR_WINDOW_MS = 10 * 60 * 1e3;
25497
+ var fail = (code, reason) => ({ ok: false, code, reason });
25498
+ function decodeCarBase64(value) {
25499
+ let normalized = value.replace(/-/g, "+").replace(/_/g, "/");
25500
+ if (normalized.length % 4) normalized += "=".repeat(4 - normalized.length % 4);
25501
+ const binary = globalThis.atob(normalized);
25502
+ return Uint8Array.from(binary, (character) => character.charCodeAt(0));
25503
+ }
25504
+ function isSignedNode(value) {
25505
+ const node = value;
25506
+ return Boolean(node && typeof node === "object" && node.cid && typeof node.issuer?.did === "function" && typeof node.audience?.did === "function");
25507
+ }
25508
+ async function decodeSigned(car, cid) {
25509
+ if (typeof car !== "string" || car.length === 0) {
25510
+ return fail("MISSING_CAR", "This record has no signed copy, so it proves nothing.");
25511
+ }
25512
+ let extracted;
25513
+ try {
25514
+ extracted = await import_core.Delegation.extract(decodeCarBase64(car));
25515
+ } catch (error) {
25516
+ return fail("INVALID_FORMAT", `The signed copy could not be read: ${error instanceof Error ? error.message : String(error)}`);
25517
+ }
25518
+ if (extracted.error || !isSignedNode(extracted.ok)) {
25519
+ return fail("INVALID_FORMAT", `The signed copy could not be read: ${extracted.error?.message ?? "unknown format"}`);
25520
+ }
25521
+ const node = extracted.ok;
25522
+ if (node.cid.toString() !== cid) {
25523
+ return fail("CID_MISMATCH", `The signed copy is a different grant (${node.cid.toString()}) from the one it is stored as (${cid}).`);
25524
+ }
25525
+ return { ok: true, node };
25526
+ }
25527
+ function signedCapabilities(node) {
25528
+ const item = node;
25529
+ return [...item.capabilities ?? []].flatMap((entry) => {
25530
+ const capability = entry && typeof entry === "object" ? entry : null;
25531
+ if (!capability || typeof capability.can !== "string" || typeof capability.with !== "string") return [];
25532
+ const nb = capability.nb && typeof capability.nb === "object" && !Array.isArray(capability.nb) ? capability.nb : void 0;
25533
+ return [{ can: capability.can, with: capability.with, ...nb ? { nb } : {} }];
25534
+ });
25535
+ }
25536
+ function abilityCovers2(parent, child) {
25537
+ if (parent === "*" || parent === child) return true;
25538
+ return parent.endsWith("/*") && child.startsWith(parent.slice(0, -1));
25539
+ }
25540
+ function resourceCovers2(parent, child) {
25541
+ return parent === "*" || parent === child || child.startsWith(`${parent}:`) || parent.endsWith("*") && child.startsWith(parent.slice(0, -1));
25542
+ }
25543
+ function caveatsAttenuate(parent, child) {
25544
+ if (!parent || Object.keys(parent).length === 0) return true;
25545
+ if (!child) return false;
25546
+ return Object.entries(parent).every(([key, value]) => JSON.stringify(child[key]) === JSON.stringify(value));
25547
+ }
25548
+ function signedCapabilityCovers(parent, child) {
25549
+ return abilityCovers2(parent.can, child.can) && resourceCovers2(parent.with, child.with) && caveatsAttenuate(parent.nb, child.nb);
25550
+ }
25551
+ function grantCoversExercise(granted, required) {
25552
+ const resourceMatches2 = granted.with === "*" || granted.with === required.with || granted.with.endsWith("*") && required.with.startsWith(granted.with.slice(0, -1));
25553
+ return abilityCovers2(granted.can, required.can) && resourceMatches2 && caveatsAttenuate(granted.nb, required.nb);
25554
+ }
25555
+ function walkToOwner(node, ownerDid, seen2 = /* @__PURE__ */ new Set(), leafFallback = false) {
25556
+ const cid = node.cid.toString();
25557
+ if (seen2.has(cid)) return fail("BROKEN_LINK", "The signed chain loops back on itself.");
25558
+ const issuer = normalizeDid(node.issuer.did());
25559
+ const proofs = node.proofs ?? [];
25560
+ if (issuer === ownerDid) {
25561
+ for (const proof of proofs) {
25562
+ if (!isSignedNode(proof) || normalizeDid(proof.audience.did()) !== issuer) continue;
25563
+ const walked = walkToOwner(proof, ownerDid, new Set(seen2).add(cid));
25564
+ if (walked.ok) return { ok: true, dids: [...walked.dids, issuer], cids: [...walked.cids, cid], nodes: [...walked.nodes, node] };
25565
+ }
25566
+ return { ok: true, dids: [issuer], cids: [cid], nodes: [node] };
25567
+ }
25568
+ if (proofs.length === 0) {
25569
+ return fail("NOT_ROOTED_AT_OWNER", `The chain starts with ${issuer}, who did not create this flow (${ownerDid}).`);
25570
+ }
25571
+ const nextSeen = new Set(seen2).add(cid);
25572
+ const parents = proofs.filter((proof) => isSignedNode(proof) && normalizeDid(proof.audience.did()) === issuer);
25573
+ if (parents.length === 0) {
25574
+ const referencedOnly = proofs.some((proof) => !isSignedNode(proof));
25575
+ return fail(
25576
+ "BROKEN_LINK",
25577
+ referencedOnly ? "A grant in the chain is referenced but not included in the signed copy." : `Nothing in the chain was given to ${issuer}, who signed this.`
25578
+ );
25579
+ }
25580
+ const parentCapabilities = parents.flatMap(signedCapabilities);
25581
+ for (const child of signedCapabilities(node)) {
25582
+ const coveredByFallback = (parent) => leafFallback && abilityCovers2(parent.can, "flow/block/execute") && resourceCovers2(parent.with, child.with) && caveatsAttenuate(parent.nb, child.nb);
25583
+ if (!parentCapabilities.some((parent) => signedCapabilityCovers(parent, child) || coveredByFallback(parent))) {
25584
+ return fail("EXCEEDS_PARENT", `${child.can} on ${child.with} is wider than what ${issuer} was given.`);
25585
+ }
25586
+ }
25587
+ let first = null;
25588
+ const cids = [];
25589
+ const nodes = [];
25590
+ for (const parent of parents) {
25591
+ const walked = walkToOwner(parent, ownerDid, nextSeen);
25592
+ if (!walked.ok) return walked;
25593
+ first ?? (first = walked);
25594
+ for (const parentCid of walked.cids) if (!cids.includes(parentCid)) cids.push(parentCid);
25595
+ nodes.push(...walked.nodes);
25596
+ }
25597
+ return { ok: true, dids: [...first.dids, issuer], cids: [...cids, cid], nodes: [...nodes, node] };
25598
+ }
25599
+ function finiteSeconds(value) {
25600
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
25601
+ }
25602
+ function earliestExpirationSeconds(nodes) {
25603
+ let earliest;
25604
+ for (const node of nodes) {
25605
+ const exp = finiteSeconds(node.expiration);
25606
+ if (exp !== void 0 && (earliest === void 0 || exp < earliest)) earliest = exp;
25607
+ }
25608
+ return earliest;
25609
+ }
25610
+ async function resolveKeys(did, env) {
25611
+ if (did.startsWith("did:key:")) return [did];
25612
+ if (!env.didResolver) return fail("INVALID_SIGNATURE", `Cannot look up the keys for ${did}: no DID resolver is configured.`);
25613
+ const resolved = await env.didResolver(did);
25614
+ if ("error" in resolved) return fail("INVALID_SIGNATURE", `Cannot look up the keys for ${did}: ${resolved.error.message}`);
25615
+ if (!resolved.ok?.length) return fail("INVALID_SIGNATURE", `${did} has no signing keys on record.`);
25616
+ return resolved.ok;
25617
+ }
25618
+ async function verifyNodeSignature(node, env) {
25619
+ const issuerDid = node.issuer.did();
25620
+ const keys = await resolveKeys(issuerDid, env);
25621
+ if (!Array.isArray(keys)) return keys;
25622
+ for (const key of keys) {
25623
+ try {
25624
+ const verifier = import_ucan.ed25519.Verifier.parse(key);
25625
+ const wrapped = {
25626
+ did: () => issuerDid,
25627
+ verify: (payload, signature) => verifier.verify(payload, signature)
25628
+ };
25629
+ if (await import_core.UCAN.verifySignature(node.data, wrapped)) return null;
25630
+ } catch {
25631
+ }
25632
+ }
25633
+ return fail("INVALID_SIGNATURE", `The signature by ${issuerDid} does not check out.`);
25634
+ }
25635
+ function checkTimeAt(nodes, atMs) {
25636
+ const atSeconds = Math.floor(atMs / 1e3);
25637
+ for (const node of nodes) {
25638
+ const nbf = finiteSeconds(node.notBefore);
25639
+ if (nbf !== void 0 && atSeconds < nbf) {
25640
+ return fail("NOT_YET_VALID", `A grant in the chain only starts at ${new Date(nbf * 1e3).toISOString()}.`);
25641
+ }
25642
+ const exp = finiteSeconds(node.expiration);
25643
+ if (exp !== void 0 && atSeconds >= exp) {
25644
+ return fail("EXPIRED", `A grant in the chain had already expired at ${new Date(exp * 1e3).toISOString()}.`);
25645
+ }
25646
+ }
25647
+ return null;
25648
+ }
25649
+ async function checkRevocation(cids, env) {
25650
+ if (!env.revocationChecker) return fail("NO_REVOCATION_CHECKER", "Could not confirm the grant was not cancelled: no revocation service is configured.");
25651
+ try {
25652
+ const revoked = await env.revocationChecker.check(cids);
25653
+ const hit = revoked.find((cid) => cids.includes(cid));
25654
+ return hit ? { revoked: hit } : {};
25655
+ } catch (error) {
25656
+ return fail("REVOCATION_CHECK_FAILED", `Could not confirm the grant was not cancelled: ${error instanceof Error ? error.message : String(error)}`);
25657
+ }
25658
+ }
25659
+ function mapValidatorError(error) {
25660
+ const message = error?.message ?? "The signed chain did not verify.";
25661
+ switch (error?.code) {
25662
+ case "EXPIRED":
25663
+ return fail("EXPIRED", "This grant has expired.");
25664
+ case "REVOKED":
25665
+ return fail("REVOKED", `This grant has been cancelled. ${message}`);
25666
+ case "REVOCATION_CHECK_FAILED":
25667
+ return fail("REVOCATION_CHECK_FAILED", `Could not confirm the grant was not cancelled. ${message}`);
25668
+ case "INVALID_SIGNATURE":
25669
+ return fail("INVALID_SIGNATURE", message);
25670
+ case "INVALID_FORMAT":
25671
+ return fail("INVALID_FORMAT", message);
25672
+ default:
25673
+ if (/no expiration/i.test(message)) return fail("NO_EXPIRATION", "This grant never expires. Grants must have an end date; ask the flow creator to sign it again.");
25674
+ if (/expired/i.test(message)) return fail("EXPIRED", "This grant has expired.");
25675
+ return fail("UNAUTHORIZED", message);
25676
+ }
25677
+ }
25678
+ async function verifyGrant(car, options) {
25679
+ const ownerDid = options.ownerDid ? normalizeDid(options.ownerDid) : "";
25680
+ if (!ownerDid.startsWith("did:")) return fail("NO_OWNER", "This flow has no known creator, so no grant in it can be checked.");
25681
+ const decoded = await decodeSigned(car, options.cid);
25682
+ if (!decoded.ok) return decoded;
25683
+ const { node } = decoded;
25684
+ const audienceDid = normalizeDid(node.audience.did());
25685
+ if (audienceDid !== normalizeDid(options.actorDid)) {
25686
+ return fail("WRONG_AUDIENCE", `This grant was given to ${audienceDid}, not to ${normalizeDid(options.actorDid)}.`);
25687
+ }
25688
+ const walked = walkToOwner(node, ownerDid);
25689
+ if (!walked.ok) return walked;
25690
+ const capabilities = signedCapabilities(node);
25691
+ const covers = options.coverage === "hierarchical" ? signedCapabilityCovers : grantCoversExercise;
25692
+ if (!capabilities.some((capability) => covers(capability, options.required))) {
25693
+ return fail("CAPABILITY_NOT_COVERED", `This grant does not allow ${options.required.can} on ${options.required.with}.`);
25694
+ }
25695
+ const expSeconds = earliestExpirationSeconds(walked.nodes);
25696
+ const grant = {
25697
+ cid: options.cid,
25698
+ issuerDid: normalizeDid(node.issuer.did()),
25699
+ audienceDid,
25700
+ capabilities,
25701
+ ...expSeconds !== void 0 ? { expiresAt: expSeconds * 1e3 } : {},
25702
+ proofChain: walked.dids,
25703
+ proofChainCids: walked.cids
25704
+ };
25705
+ if (options.at === void 0) {
25706
+ if (!options.env.revocationChecker) return fail("NO_REVOCATION_CHECKER", "Could not confirm the grant was not cancelled: no revocation service is configured.");
25707
+ const notYet = checkTimeAt(walked.nodes, Date.now());
25708
+ if (notYet?.code === "NOT_YET_VALID") return notYet;
25709
+ const validator = await (0, import_ucan.createUCANValidator)({
25710
+ serverDid: node.audience.did(),
25711
+ rootIssuers: [ownerDid],
25712
+ didResolver: options.env.didResolver,
25713
+ revocationChecker: options.env.revocationChecker,
25714
+ revocationFailure: "closed",
25715
+ requireExpiration: true
25716
+ });
25717
+ const result = await validator.validateDelegation(car);
25718
+ if (!result.ok) return mapValidatorError(result.error);
25719
+ return { ok: true, grant };
25720
+ }
25721
+ for (const chainNode of walked.nodes) {
25722
+ const bad = await verifyNodeSignature(chainNode, options.env);
25723
+ if (bad) return bad;
25724
+ }
25725
+ const timeFailure = checkTimeAt(walked.nodes, options.at);
25726
+ if (timeFailure) return timeFailure;
25727
+ const revocation = await checkRevocation(walked.cids, options.env);
25728
+ if ("ok" in revocation) return revocation;
25729
+ return { ok: true, grant, ...revocation.revoked ? { revokedNow: revocation.revoked } : {} };
25730
+ }
25731
+ var capabilityParsers = /* @__PURE__ */ new Map();
25732
+ function capabilityParser(can) {
25733
+ let parser = capabilityParsers.get(can);
25734
+ if (!parser) {
25735
+ parser = (0, import_ucan.defineCapability)({ can, protocol: "ixo:" });
25736
+ capabilityParsers.set(can, parser);
25737
+ }
25738
+ return parser;
25739
+ }
25740
+ var NO_REPLAY_STORE = {
25741
+ has: async () => false,
25742
+ add: async () => void 0
25743
+ };
25744
+ function factsMatch(facts, expected) {
25745
+ if (!expected || Object.keys(expected).length === 0) return true;
25746
+ return (facts ?? []).some((fact) => {
25747
+ if (!fact || typeof fact !== "object") return false;
25748
+ const record3 = fact;
25749
+ return Object.entries(expected).every(([key, value]) => JSON.stringify(record3[key]) === JSON.stringify(value));
25750
+ });
25751
+ }
25752
+ function plainFacts(facts) {
25753
+ return (facts ?? []).filter((fact) => Boolean(fact) && typeof fact === "object" && !Array.isArray(fact));
25754
+ }
25755
+ async function verifyInvocation(car, options) {
25756
+ const ownerDid = options.ownerDid ? normalizeDid(options.ownerDid) : "";
25757
+ if (!ownerDid.startsWith("did:")) return fail("NO_OWNER", "This flow has no known creator, so no receipt in it can be checked.");
25758
+ const decoded = await decodeSigned(car, options.cid);
25759
+ if (!decoded.ok) return decoded;
25760
+ const { node } = decoded;
25761
+ const audienceDid = normalizeDid(node.audience.did());
25762
+ if (audienceDid !== normalizeDid(options.expectedAudience)) {
25763
+ return fail("WRONG_AUDIENCE", `This receipt is addressed to ${audienceDid}, not ${normalizeDid(options.expectedAudience)}.`);
25764
+ }
25765
+ const invokerDid = normalizeDid(node.issuer.did());
25766
+ if (options.actorDid && invokerDid !== normalizeDid(options.actorDid)) {
25767
+ return fail("WRONG_INVOKER", `This receipt was signed by ${invokerDid}, not by ${normalizeDid(options.actorDid)} as recorded.`);
25768
+ }
25769
+ const capabilities = signedCapabilities(node);
25770
+ const capability = capabilities[0];
25771
+ if (capabilities.length !== 1 || capability.can !== options.required.can || capability.with !== options.required.with) {
25772
+ return fail("CAPABILITY_NOT_COVERED", `This receipt is not for ${options.required.can} on ${options.required.with}.`);
25773
+ }
25774
+ if (!factsMatch(node.facts, options.expectedFacts)) {
25775
+ return fail("FACTS_MISMATCH", "The signed receipt does not match what the record says happened (action, inputs or run).");
25776
+ }
25777
+ const walked = walkToOwner(node, ownerDid, /* @__PURE__ */ new Set(), options.allowBlockExecuteFallback === true);
25778
+ if (!walked.ok) return walked;
25779
+ const expSeconds = earliestExpirationSeconds(walked.nodes);
25780
+ const grantExpSeconds = earliestExpirationSeconds(walked.nodes.filter((chainNode) => chainNode !== node));
25781
+ const verified = {
25782
+ cid: options.cid,
25783
+ invokerDid,
25784
+ audienceDid,
25785
+ capability,
25786
+ facts: plainFacts(node.facts),
25787
+ ...expSeconds !== void 0 ? { expiresAt: expSeconds * 1e3 } : {},
25788
+ ...grantExpSeconds !== void 0 ? { grantsExpireAt: grantExpSeconds * 1e3 } : {},
25789
+ proofChain: walked.dids,
25790
+ proofChainCids: walked.cids
25791
+ };
25792
+ if (options.at === void 0) {
25793
+ if (!options.env.revocationChecker) return fail("NO_REVOCATION_CHECKER", "Could not confirm the grant was not cancelled: no revocation service is configured.");
25794
+ const validator = await (0, import_ucan.createUCANValidator)({
25795
+ serverDid: node.audience.did(),
25796
+ rootIssuers: [ownerDid],
25797
+ didResolver: options.env.didResolver,
25798
+ invocationStore: NO_REPLAY_STORE,
25799
+ revocationChecker: options.env.revocationChecker,
25800
+ revocationFailure: "closed",
25801
+ requireExpiration: true
25802
+ });
25803
+ const result = await validator.validate(car, capabilityParser(options.required.can), options.required.with);
25804
+ if (!result.ok) return mapValidatorError(result.error);
25805
+ if (normalizeDid(result.proofChain?.[0] ?? "") !== ownerDid) {
25806
+ return fail("NOT_ROOTED_AT_OWNER", `The chain starts with ${result.proofChain?.[0] ?? "nobody"}, who did not create this flow.`);
25807
+ }
25808
+ return { ok: true, invocation: verified };
25809
+ }
25810
+ const ownExp = finiteSeconds(node.expiration);
25811
+ let noTimeAnchor = false;
25812
+ if (ownExp === void 0) {
25813
+ noTimeAnchor = true;
25814
+ } else {
25815
+ const expMs = ownExp * 1e3;
25816
+ if (options.at >= expMs || options.at < expMs - RECEIPT_ANCHOR_WINDOW_MS) {
25817
+ return fail("EXPIRED", `The recorded time ${new Date(options.at).toISOString()} is outside the time this receipt was signed for.`);
25818
+ }
25819
+ }
25820
+ for (const chainNode of walked.nodes) {
25821
+ const bad = await verifyNodeSignature(chainNode, options.env);
25822
+ if (bad) return bad;
25823
+ }
25824
+ const timeFailure = checkTimeAt(walked.nodes, options.at);
25825
+ if (timeFailure) return timeFailure;
25826
+ const revocation = await checkRevocation(walked.cids, options.env);
25827
+ if ("ok" in revocation) return revocation;
25828
+ return {
25829
+ ok: true,
25830
+ invocation: verified,
25831
+ ...revocation.revoked ? { revokedNow: revocation.revoked } : {},
25832
+ ...noTimeAnchor ? { noTimeAnchor: true } : {}
25833
+ };
25834
+ }
25835
+
25836
+ // src/core/services/ucanService.ts
25248
25837
  var FLOW_INVOCATION_SIGNER_TTL_SECONDS = 60 * 60;
25838
+ var FLOW_INVOCATION_TTL_SECONDS = 300;
25839
+ function createInvocationNonce() {
25840
+ const bytes = new Uint8Array(16);
25841
+ globalThis.crypto.getRandomValues(bytes);
25842
+ let binary = "";
25843
+ for (const byte of bytes) binary += String.fromCharCode(byte);
25844
+ return globalThis.btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
25845
+ }
25249
25846
  function toSupportedDID(did) {
25250
25847
  if (did.startsWith("did:ixo:") || did.startsWith("did:key:")) {
25251
25848
  return did;
25252
25849
  }
25253
25850
  return void 0;
25254
25851
  }
25255
- function normalizeDid(did) {
25256
- if (did.startsWith("did:")) return did;
25257
- if (did.startsWith("ixo1")) return `did:ixo:${did}`;
25258
- if (!did.startsWith("@did-")) return did;
25259
- const [localpart] = did.split(":");
25260
- const parts = localpart.split("-");
25261
- if (parts.length < 3 || parts[0] !== "@did") return did;
25262
- return `did:${parts[1]}:${parts.slice(2).join("-")}`;
25852
+ var DEFAULT_FLOW_GRANT_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
25853
+ function resolveGrantExpiration(expiration, now = Date.now()) {
25854
+ if (expiration === void 0) return now + DEFAULT_FLOW_GRANT_TTL_MS;
25855
+ if (!Number.isFinite(expiration) || expiration <= now) throw new Error("A grant needs an expiry date in the future.");
25856
+ return expiration;
25263
25857
  }
25264
25858
  function toInvocationAudienceDID(did) {
25265
25859
  const normalized = normalizeDid(did);
@@ -25281,11 +25875,11 @@ async function getSigner(handlers, did, didType, entityRoomId, pin) {
25281
25875
  const supportedDid = toSupportedDID(normalizedDid);
25282
25876
  if (handlers.getPrivateKey) {
25283
25877
  const privateKey = await handlers.getPrivateKey({ did: normalizedDid, didType, entityRoomId, pin });
25284
- return (0, import_ucan.parseSigner)(privateKey, supportedDid);
25878
+ return (0, import_ucan2.parseSigner)(privateKey, supportedDid);
25285
25879
  }
25286
25880
  if (handlers.getMnemonic) {
25287
25881
  const mnemonic = await handlers.getMnemonic({ did: normalizedDid, didType, entityRoomId, pin });
25288
- const result = await (0, import_ucan.signerFromMnemonic)(mnemonic, supportedDid);
25882
+ const result = await (0, import_ucan2.signerFromMnemonic)(mnemonic, supportedDid);
25289
25883
  return result.signer;
25290
25884
  }
25291
25885
  throw new Error("No signer handler configured (need getPrivateKey or getMnemonic)");
@@ -25293,11 +25887,6 @@ async function getSigner(handlers, did, didType, entityRoomId, pin) {
25293
25887
  function getCidFromDelegation(delegation) {
25294
25888
  return delegation.cid.toString();
25295
25889
  }
25296
- function rootCapabilityCovers(granted, requested) {
25297
- if (!requested.can.startsWith("flow/")) return false;
25298
- if (!ucanCapabilityCovers({ ...granted, with: "*" }, { ...requested, with: "*" })) return false;
25299
- return requested.with === granted.with || requested.with.startsWith(`${granted.with}:`);
25300
- }
25301
25890
  var createUcanService = (config) => {
25302
25891
  const { delegationStore, invocationStore, handlers, flowOwnerDid } = config;
25303
25892
  const delegationCache = /* @__PURE__ */ new Map();
@@ -25315,7 +25904,7 @@ var createUcanService = (config) => {
25315
25904
  return null;
25316
25905
  }
25317
25906
  try {
25318
- const delegation = await (0, import_ucan.parseDelegation)(stored.delegation);
25907
+ const delegation = await (0, import_ucan2.parseDelegation)(stored.delegation);
25319
25908
  delegationCache.set(cid, delegation);
25320
25909
  return delegation;
25321
25910
  } catch {
@@ -25346,6 +25935,7 @@ var createUcanService = (config) => {
25346
25935
  const { flowOwnerDid: ownerDid, issuerType, entityRoomId, flowUri: uri, pin } = params;
25347
25936
  const normalizedOwnerDid = normalizeDid(ownerDid);
25348
25937
  const capabilities = [{ can: "flow/*", with: uri }];
25938
+ const rootExpiration = resolveGrantExpiration();
25349
25939
  if (handlers.createSignerSession && handlers.createDelegationWithSession) {
25350
25940
  const session = await handlers.createSignerSession({
25351
25941
  did: normalizedOwnerDid,
@@ -25358,7 +25948,8 @@ var createUcanService = (config) => {
25358
25948
  sessionId: session.sessionId,
25359
25949
  audience: normalizedOwnerDid,
25360
25950
  capabilities,
25361
- proofs: []
25951
+ proofs: [],
25952
+ expiration: Math.floor(rootExpiration / 1e3)
25362
25953
  });
25363
25954
  const storedDelegation2 = {
25364
25955
  cid: result.cid,
@@ -25366,6 +25957,7 @@ var createUcanService = (config) => {
25366
25957
  issuerDid: normalizedOwnerDid,
25367
25958
  audienceDid: normalizedOwnerDid,
25368
25959
  capabilities,
25960
+ expiration: rootExpiration,
25369
25961
  createdAt: Date.now(),
25370
25962
  format: "car",
25371
25963
  proofCids: []
@@ -25375,13 +25967,14 @@ var createUcanService = (config) => {
25375
25967
  return storedDelegation2;
25376
25968
  }
25377
25969
  const signer = await getSigner(handlers, ownerDid, issuerType, entityRoomId, pin);
25378
- const delegation = await (0, import_ucan.createDelegation)({
25970
+ const delegation = await (0, import_ucan2.createDelegation)({
25379
25971
  issuer: signer,
25380
25972
  audience: toInvocationAudienceDID(normalizedOwnerDid),
25381
25973
  capabilities,
25382
- proofs: []
25974
+ proofs: [],
25975
+ expiration: Math.floor(rootExpiration / 1e3)
25383
25976
  });
25384
- const serialized = await (0, import_ucan.serializeDelegation)(delegation);
25977
+ const serialized = await (0, import_ucan2.serializeDelegation)(delegation);
25385
25978
  const cid = getCidFromDelegation(delegation);
25386
25979
  const storedDelegation = {
25387
25980
  cid,
@@ -25389,6 +25982,7 @@ var createUcanService = (config) => {
25389
25982
  issuerDid: normalizedOwnerDid,
25390
25983
  audienceDid: normalizedOwnerDid,
25391
25984
  capabilities,
25985
+ expiration: rootExpiration,
25392
25986
  createdAt: Date.now(),
25393
25987
  format: "car",
25394
25988
  proofCids: []
@@ -25399,7 +25993,8 @@ var createUcanService = (config) => {
25399
25993
  return storedDelegation;
25400
25994
  };
25401
25995
  const createDelegation = async (params) => {
25402
- const { issuerDid, issuerType, entityRoomId, audience, capabilities, proofs = [], expiration, pin } = params;
25996
+ const { issuerDid, issuerType, entityRoomId, audience, capabilities, proofs = [], pin } = params;
25997
+ const expiration = resolveGrantExpiration(params.expiration);
25403
25998
  const normalizedIssuerDid = normalizeDid(issuerDid);
25404
25999
  const normalizedAudienceDid = normalizeDid(audience);
25405
26000
  const proofCids = proofs;
@@ -25417,7 +26012,7 @@ var createUcanService = (config) => {
25417
26012
  audience: normalizedAudienceDid,
25418
26013
  capabilities,
25419
26014
  proofs: proofCars,
25420
- expiration: expiration ? Math.floor(expiration / 1e3) : void 0
26015
+ expiration: Math.floor(expiration / 1e3)
25421
26016
  });
25422
26017
  const storedDelegation2 = {
25423
26018
  cid: result.cid,
@@ -25435,14 +26030,14 @@ var createUcanService = (config) => {
25435
26030
  }
25436
26031
  const signer = await getSigner(handlers, issuerDid, issuerType, entityRoomId, pin);
25437
26032
  const proofDelegations = await getProofDelegations(proofCids);
25438
- const delegation = await (0, import_ucan.createDelegation)({
26033
+ const delegation = await (0, import_ucan2.createDelegation)({
25439
26034
  issuer: signer,
25440
26035
  audience: toInvocationAudienceDID(normalizedAudienceDid),
25441
26036
  capabilities: toUcantoCapabilities(capabilities),
25442
26037
  proofs: proofDelegations,
25443
- expiration: expiration ? Math.floor(expiration / 1e3) : void 0
26038
+ expiration: Math.floor(expiration / 1e3)
25444
26039
  });
25445
- const serialized = await (0, import_ucan.serializeDelegation)(delegation);
26040
+ const serialized = await (0, import_ucan2.serializeDelegation)(delegation);
25446
26041
  const cid = getCidFromDelegation(delegation);
25447
26042
  const storedDelegation = {
25448
26043
  cid,
@@ -25459,9 +26054,15 @@ var createUcanService = (config) => {
25459
26054
  delegationCache.set(cid, delegation);
25460
26055
  return storedDelegation;
25461
26056
  };
25462
- const revokeDelegation = (cid) => {
26057
+ const revokeDelegation = async (cid) => {
26058
+ const token = delegationStore.get(cid)?.delegation;
26059
+ if (token) {
26060
+ if (!handlers.revokeDelegation) throw new Error("Revoking is not available here, so the grant was left in place.");
26061
+ await handlers.revokeDelegation({ cid, token });
26062
+ }
25463
26063
  delegationStore.remove(cid);
25464
26064
  delegationCache.delete(cid);
26065
+ config.authority?.invalidate();
25465
26066
  };
25466
26067
  const getDelegation = (cid) => {
25467
26068
  return delegationStore.get(cid);
@@ -25473,74 +26074,33 @@ var createUcanService = (config) => {
25473
26074
  return delegationStore.getRoot();
25474
26075
  };
25475
26076
  const findValidProofs = async (audienceDid, capability) => {
25476
- const normalizedActorDid = normalizeDid(audienceDid);
25477
- const delegations = delegationStore.getAll().filter((delegation) => normalizeDid(delegation.audienceDid) === normalizedActorDid);
25478
- const root = delegationStore.getRoot();
25479
- if (root && normalizeDid(root.audienceDid) === normalizedActorDid && !(root.expiration && root.expiration < Date.now())) {
25480
- if (root.capabilities.some((granted) => rootCapabilityCovers(granted, capability))) {
25481
- return { found: true, proofCids: [root.cid] };
25482
- }
25483
- }
25484
- if (delegations.length === 0) {
25485
- return { found: false, error: "No delegations found for actor" };
25486
- }
25487
- for (const delegation of delegations) {
25488
- const covers = delegation.capabilities.some((granted) => ucanCapabilityCovers(granted, capability));
25489
- if (covers) {
25490
- if (delegation.expiration && delegation.expiration < Date.now()) {
25491
- continue;
25492
- }
25493
- const proofCids = [delegation.cid, ...delegation.proofCids];
25494
- return { found: true, proofCids };
25495
- }
26077
+ if (!config.authority) {
26078
+ return { found: false, error: "Grants cannot be checked in this editor: no UCAN verifier is set up." };
25496
26079
  }
25497
- return { found: false, error: "No valid delegation found for capability" };
26080
+ const decision = await config.authority.authorize(audienceDid, capability);
26081
+ return decision.allowed ? { found: true, proofCids: decision.proofCids } : { found: false, error: decision.reason };
25498
26082
  };
25499
26083
  const validateDelegationChain = async (audienceDid, capability) => {
25500
26084
  const proofsResult = await findValidProofs(audienceDid, capability);
25501
26085
  if (!proofsResult.found || !proofsResult.proofCids) {
25502
26086
  return { valid: false, error: proofsResult.error };
25503
26087
  }
25504
- const proofChain = [];
25505
- for (const cid of proofsResult.proofCids) {
25506
- const delegation = delegationStore.get(cid);
25507
- if (!delegation) {
25508
- return { valid: false, error: `Proof delegation ${cid} not found` };
25509
- }
25510
- proofChain.push(delegation);
25511
- }
25512
- for (let i = 0; i < proofChain.length - 1; i++) {
25513
- const current = proofChain[i];
25514
- const parent = proofChain[i + 1];
25515
- if (normalizeDid(parent.audienceDid) !== normalizeDid(current.issuerDid)) {
25516
- return {
25517
- valid: false,
25518
- error: `Chain broken: ${parent.cid} audience (${parent.audienceDid}) != ${current.cid} issuer (${current.issuerDid})`
25519
- };
25520
- }
25521
- }
25522
- const isFlowScoped = capability.can === "flow/*" || capability.can.startsWith("flow/");
25523
- if (isFlowScoped) {
25524
- const root = proofChain[proofChain.length - 1];
25525
- if (normalizeDid(root.issuerDid) !== normalizeDid(flowOwnerDid)) {
25526
- return { valid: false, error: `Root issuer ${root.issuerDid} is not flow owner ${flowOwnerDid}` };
25527
- }
25528
- }
26088
+ const proofChain = proofsResult.proofCids.map((cid) => delegationStore.get(cid)).filter((delegation) => delegation !== null);
25529
26089
  return { valid: true, proofChain };
25530
26090
  };
25531
26091
  const createAndValidateInvocation = async (params, _flowId, _blockId) => {
25532
- const { invokerDid, invokerType, entityRoomId, capability, proofs, pin } = params;
26092
+ const { invokerDid, invokerType, entityRoomId, capability, pin } = params;
25533
26093
  const normalizedInvokerDid = normalizeDid(invokerDid);
25534
- const validation = await validateDelegationChain(normalizedInvokerDid, capability);
25535
- if (!validation.valid) {
25536
- return {
25537
- cid: "",
25538
- invocation: "",
25539
- valid: false,
25540
- error: validation.error
25541
- };
25542
- }
26094
+ const refuse = (error) => ({ cid: "", invocation: "", valid: false, error });
26095
+ const proofsResult = await findValidProofs(normalizedInvokerDid, capability);
26096
+ if (!proofsResult.found || !proofsResult.proofCids) return refuse(proofsResult.error ?? "No valid grant for this action.");
26097
+ const proofs = proofsResult.proofCids;
25543
26098
  const audience = normalizeDid(params.audience ?? flowOwnerDid);
26099
+ if (!audience.startsWith("did:")) return refuse("We can't tell who created this flow yet, so nothing can be signed for it.");
26100
+ const ttlSeconds = Math.min(params.ttlSeconds ?? FLOW_INVOCATION_TTL_SECONDS, FLOW_INVOCATION_TTL_SECONDS);
26101
+ let expiration = 0;
26102
+ const facts = { ...params.facts ?? {}, nonce: typeof params.facts?.nonce === "string" ? params.facts.nonce : createInvocationNonce() };
26103
+ let minted;
25544
26104
  if (handlers.createSignerSession && handlers.createInvocationWithSession) {
25545
26105
  try {
25546
26106
  const cachedSession = await handlers.getActiveSignerSession?.({ did: normalizedInvokerDid });
@@ -25553,7 +26113,8 @@ var createUcanService = (config) => {
25553
26113
  ttlSeconds: FLOW_INVOCATION_SIGNER_TTL_SECONDS
25554
26114
  });
25555
26115
  const proofCars = await getProofCars(proofs);
25556
- const result = await handlers.createInvocationWithSession({
26116
+ expiration = Math.floor(Date.now() / 1e3) + ttlSeconds;
26117
+ minted = await handlers.createInvocationWithSession({
25557
26118
  sessionId: session.sessionId,
25558
26119
  audience,
25559
26120
  capability: {
@@ -25562,44 +26123,46 @@ var createUcanService = (config) => {
25562
26123
  ...capability.nb && { nb: capability.nb }
25563
26124
  },
25564
26125
  proofs: proofCars,
25565
- facts: params.facts
26126
+ facts,
26127
+ expiration
25566
26128
  });
25567
- return {
25568
- cid: result.cid,
25569
- invocation: result.invocation,
25570
- valid: true
25571
- };
25572
26129
  } catch (err) {
25573
- return {
25574
- cid: "",
25575
- invocation: "",
25576
- valid: false,
25577
- error: err instanceof Error ? err.message : "Failed to create invocation via session"
25578
- };
26130
+ return refuse(err instanceof Error ? err.message : "Failed to create invocation via session");
25579
26131
  }
25580
- }
25581
- const signer = await getSigner(handlers, invokerDid, invokerType, entityRoomId, pin);
25582
- const proofDelegations = await getProofDelegations(proofs);
25583
- const ucantoCapability = {
25584
- can: capability.can,
25585
- with: capability.with,
25586
- ...capability.nb && { nb: capability.nb }
25587
- };
25588
- const invocation = await (0, import_ucan.createInvocation)({
25589
- issuer: signer,
25590
- audience,
25591
- capability: ucantoCapability,
25592
- proofs: proofDelegations,
25593
- facts: params.facts ? [params.facts] : void 0
26132
+ } else {
26133
+ const signer = await getSigner(handlers, invokerDid, invokerType, entityRoomId, pin);
26134
+ const proofDelegations = await getProofDelegations(proofs);
26135
+ const ucantoCapability = {
26136
+ can: capability.can,
26137
+ with: capability.with,
26138
+ ...capability.nb && { nb: capability.nb }
26139
+ };
26140
+ expiration = Math.floor(Date.now() / 1e3) + ttlSeconds;
26141
+ const invocation = await (0, import_ucan2.createInvocation)({
26142
+ issuer: signer,
26143
+ audience,
26144
+ capability: ucantoCapability,
26145
+ proofs: proofDelegations,
26146
+ facts: [facts],
26147
+ expiration
26148
+ });
26149
+ const built = await invocation.buildIPLDView();
26150
+ minted = { cid: built.cid.toString(), invocation: await (0, import_ucan2.serializeInvocation)(invocation) };
26151
+ }
26152
+ if (!config.verification) return refuse("This invocation cannot be checked in this editor: no UCAN verifier is set up.");
26153
+ const verdict = await verifyInvocation(minted.invocation, {
26154
+ cid: minted.cid,
26155
+ expectedAudience: audience,
26156
+ ownerDid: flowOwnerDid,
26157
+ actorDid: normalizedInvokerDid,
26158
+ required: { can: capability.can, with: capability.with },
26159
+ expectedFacts: facts,
26160
+ env: config.verification,
26161
+ at: (expiration - ttlSeconds) * 1e3
25594
26162
  });
25595
- const serialized = await (0, import_ucan.serializeInvocation)(invocation);
25596
- const built = await invocation.buildIPLDView();
25597
- const cid = built.cid.toString();
25598
- return {
25599
- cid,
25600
- invocation: serialized,
25601
- valid: true
25602
- };
26163
+ if (!verdict.ok) return { cid: minted.cid, invocation: minted.invocation, valid: false, error: verdict.reason };
26164
+ if (verdict.revokedNow) return { cid: minted.cid, invocation: minted.invocation, valid: false, error: "The grant this relies on has been cancelled." };
26165
+ return { cid: minted.cid, invocation: minted.invocation, valid: true, facts, proofCids: proofs, expiresAt: expiration * 1e3, signedAt: (expiration - ttlSeconds) * 1e3 };
25603
26166
  };
25604
26167
  const executeWithInvocation = async (params, action, flowId, blockId, sessionRunId) => {
25605
26168
  const invocationResult = await createAndValidateInvocation(params, flowId, blockId);
@@ -25624,13 +26187,15 @@ var createUcanService = (config) => {
25624
26187
  invocation: invocationResult.invocation,
25625
26188
  invokerDid: params.invokerDid,
25626
26189
  capability: params.capability,
25627
- executedAt: Date.now(),
26190
+ // The receipt's time anchor: when it was signed, so that
26191
+ // exp = executedAt + 300s holds (contract §3).
26192
+ executedAt: invocationResult.signedAt ?? Date.now(),
25628
26193
  flowId,
25629
26194
  sessionRunId,
25630
26195
  blockId,
25631
26196
  result: "success",
25632
- proofCids: params.proofs,
25633
- facts: params.facts
26197
+ proofCids: invocationResult.proofCids ?? params.proofs,
26198
+ facts: invocationResult.facts ?? params.facts
25634
26199
  };
25635
26200
  invocationStore.add(storedInvocation);
25636
26201
  return {
@@ -25645,13 +26210,16 @@ var createUcanService = (config) => {
25645
26210
  invocation: invocationResult.invocation,
25646
26211
  invokerDid: params.invokerDid,
25647
26212
  capability: params.capability,
25648
- executedAt: Date.now(),
26213
+ // The receipt's time anchor: when it was signed, so that
26214
+ // exp = executedAt + 300s holds (contract §3).
26215
+ executedAt: invocationResult.signedAt ?? Date.now(),
25649
26216
  flowId,
25650
26217
  sessionRunId,
25651
26218
  blockId,
25652
26219
  result: "failure",
25653
26220
  error: error instanceof Error ? error.message : "Unknown error",
25654
- proofCids: params.proofs
26221
+ proofCids: invocationResult.proofCids ?? params.proofs,
26222
+ facts: invocationResult.facts ?? params.facts
25655
26223
  };
25656
26224
  invocationStore.add(storedInvocation);
25657
26225
  return {
@@ -25661,7 +26229,7 @@ var createUcanService = (config) => {
25661
26229
  };
25662
26230
  }
25663
26231
  };
25664
- return {
26232
+ const service = {
25665
26233
  createRootDelegation,
25666
26234
  createDelegation,
25667
26235
  revokeDelegation,
@@ -25673,8 +26241,13 @@ var createUcanService = (config) => {
25673
26241
  validateDelegationChain,
25674
26242
  findValidProofs,
25675
26243
  parseDelegationFromStore,
25676
- isConfigured
26244
+ isConfigured,
26245
+ authority: config.authority,
26246
+ verification: config.verification,
26247
+ receipts: config.receipts,
26248
+ createRequestInvocation: (params) => createFlowRequest(service, params)
25677
26249
  };
26250
+ return service;
25678
26251
  };
25679
26252
 
25680
26253
  // src/core/lib/flowEngine/emitEvents.ts
@@ -27940,7 +28513,8 @@ function readCompiledFlowFromYDoc(yDoc) {
27940
28513
  title: flowMeta.get("title") || "",
27941
28514
  goal: flowMeta.get("goal"),
27942
28515
  version: flowMeta.get("version") || "",
27943
- flowOwnerDid: flowMeta.get("flowOwnerDid") || "",
28516
+ // The room creator, never the doc's editable copy (see flowOwner.ts).
28517
+ flowOwnerDid: flowOwnerOf(yDoc),
27944
28518
  flowUri: flowMeta.get("flowUri"),
27945
28519
  compiledAt: flowMeta.get("compiledAt") || "",
27946
28520
  compiledFrom: "BaseUcanFlow"
@@ -28144,6 +28718,30 @@ function triggerToNodeIds(trigger, nodeIdByBlockId) {
28144
28718
  return trigger;
28145
28719
  }
28146
28720
 
28721
+ // src/core/lib/flowIdentity.ts
28722
+ var FLOW_IDENTITY_EVENT_TYPE = "ixo.qi.flow.identity";
28723
+ function readFlowIdentityDocId(client, roomId) {
28724
+ if (!client || !roomId || typeof client.getRoom !== "function") return "";
28725
+ const creator = readRoomCreatorUserId(client, roomId);
28726
+ if (!creator) return "";
28727
+ const event = client.getRoom(roomId)?.currentState?.getStateEvents?.(FLOW_IDENTITY_EVENT_TYPE, "");
28728
+ if (!event || event.getSender() !== creator) return "";
28729
+ const content = event.getContent?.();
28730
+ return typeof content?.docId === "string" ? content.docId : "";
28731
+ }
28732
+ async function writeFlowIdentity(client, roomId, docId, options = {}) {
28733
+ if (!client || !roomId || !docId) return "no-owner";
28734
+ if (!readFlowOwnerDid(client, roomId)) return "no-owner";
28735
+ const creator = readRoomCreatorUserId(client, roomId);
28736
+ if (!creator || client.getUserId?.() !== creator) return "not-creator";
28737
+ const existing = readFlowIdentityDocId(client, roomId);
28738
+ if (existing === docId) return "already-bound";
28739
+ if (existing && !options.overwrite) return "bound-to-another-doc";
28740
+ const content = { docId };
28741
+ await client.sendStateEvent(roomId, FLOW_IDENTITY_EVENT_TYPE, content, "");
28742
+ return "written";
28743
+ }
28744
+
28147
28745
  // src/core/lib/flowCompiler/setup.ts
28148
28746
  async function readFlowAsBaseUcan(options) {
28149
28747
  const { roomId, matrixClient } = options;
@@ -28191,6 +28789,7 @@ async function setupFlowFromBaseUcan(options) {
28191
28789
  try {
28192
28790
  finalCompiled = applyFlowPlanToYDoc(yDoc, { plan, incomingCompiled, creatorDid, docId, templateId, strategy });
28193
28791
  await provider.waitForFlush();
28792
+ await bindRoomIdentity(matrixClient, roomId, yDoc);
28194
28793
  } finally {
28195
28794
  provider.dispose();
28196
28795
  yDoc.destroy();
@@ -28212,6 +28811,7 @@ async function seedDesignPodTemplateFlow(options) {
28212
28811
  finalCompiled = applyFlowPlanToYDoc(yDoc, { plan, incomingCompiled, creatorDid, strategy: "full" });
28213
28812
  seedDesignPodMethodDefinition(yDoc, methodId);
28214
28813
  await provider.waitForFlush();
28814
+ await bindRoomIdentity(matrixClient, roomId, yDoc);
28215
28815
  } finally {
28216
28816
  provider.dispose();
28217
28817
  yDoc.destroy();
@@ -28297,8 +28897,18 @@ async function connectToRoom(roomId, matrixClient, options) {
28297
28897
  if (options.adoptRuns && provider.canWrite) {
28298
28898
  collectPhantomLegacyRun(yDoc);
28299
28899
  }
28900
+ bindFlowOwnerFromRoom(yDoc, client, roomId);
28300
28901
  return { yDoc, provider };
28301
28902
  }
28903
+ async function bindRoomIdentity(matrixClient, roomId, yDoc) {
28904
+ const docId = yDoc.getMap("root").get("doc_id");
28905
+ if (typeof docId !== "string" || !docId) return;
28906
+ try {
28907
+ await writeFlowIdentity(matrixClient, roomId, docId);
28908
+ } catch (error) {
28909
+ console.warn("Could not write the flow identity event:", error);
28910
+ }
28911
+ }
28302
28912
  function setRootMetadata(yDoc, root, plan, creatorDid, docId, templateId) {
28303
28913
  yDoc.transact(() => {
28304
28914
  if (!root.get("@context")) root.set("@context", "https://ixo.world/flow/0.3");
@@ -28307,7 +28917,9 @@ function setRootMetadata(yDoc, root, plan, creatorDid, docId, templateId) {
28307
28917
  if (!root.get("doc_id")) root.set("doc_id", docId || plan.flowId);
28308
28918
  if (!root.get("createdAt")) root.set("createdAt", (/* @__PURE__ */ new Date()).toISOString());
28309
28919
  if (!root.get("createdBy")) root.set("createdBy", creatorDid);
28310
- root.set("flowOwnerDid", creatorDid);
28920
+ const roomCreator = flowOwnerOf(yDoc);
28921
+ if (roomCreator) root.set("flowOwnerDid", roomCreator);
28922
+ else if (!root.get("flowOwnerDid")) root.set("flowOwnerDid", creatorDid);
28311
28923
  if (!hasLegacyRuntimeHistory(yDoc)) setMultiRunStorage(yDoc);
28312
28924
  if (templateId && !root.get("source_template_id")) {
28313
28925
  root.set("source_template_id", templateId);
@@ -29589,6 +30201,439 @@ var ManifestBoundTopicExecutorAdapter = class {
29589
30201
  var createQiForgeTopicExecutorAdapter = (executor, bridge) => new ManifestBoundTopicExecutorAdapter("qiforge", executor, bridge);
29590
30202
  var createMcpTopicExecutorAdapter = (executor, bridge) => new ManifestBoundTopicExecutorAdapter("mcp", executor, bridge);
29591
30203
 
30204
+ // src/core/lib/ucan/verificationEnv.ts
30205
+ var import_ucan3 = require("@ixo/ucan");
30206
+ var checkers = /* @__PURE__ */ new Map();
30207
+ function revocationCheckerFor(url) {
30208
+ let checker = checkers.get(url);
30209
+ if (!checker) {
30210
+ checker = (0, import_ucan3.createUcanStoreRevocationChecker)({ url });
30211
+ checkers.set(url, checker);
30212
+ }
30213
+ return checker;
30214
+ }
30215
+ function ucanVerificationEnvFrom(handlers) {
30216
+ const injected = handlers?.ucanVerification;
30217
+ if (!injected) return {};
30218
+ return {
30219
+ didResolver: injected.didResolver,
30220
+ ...injected.revocationStoreUrl ? { revocationChecker: revocationCheckerFor(injected.revocationStoreUrl) } : {}
30221
+ };
30222
+ }
30223
+
30224
+ // src/core/lib/ucan/flowAuthorityIndex.ts
30225
+ var import_core2 = require("@ucanto/core");
30226
+ var AUTHORITY_RECHECK_MS = 3e4;
30227
+ var NO_CACHE_CODES = /* @__PURE__ */ new Set(["REVOCATION_CHECK_FAILED", "NO_REVOCATION_CHECKER", "NO_OWNER"]);
30228
+ var FAILURE_PRIORITY = ["REVOKED", "EXPIRED", "NO_EXPIRATION", "REVOCATION_CHECK_FAILED", "NO_REVOCATION_CHECKER", "NOT_ROOTED_AT_OWNER", "EXCEEDS_PARENT", "INVALID_SIGNATURE"];
30229
+ function keyOf(actorDid, capability) {
30230
+ return `${actorDid}\0${capability.can}\0${capability.with}`;
30231
+ }
30232
+ function createFlowAuthorityIndex(options) {
30233
+ const now = options.now ?? Date.now;
30234
+ const decisions = /* @__PURE__ */ new Map();
30235
+ const parsed = /* @__PURE__ */ new Map();
30236
+ const listeners = /* @__PURE__ */ new Set();
30237
+ let generation = 0;
30238
+ const notify = () => {
30239
+ for (const listener of listeners) listener();
30240
+ };
30241
+ async function audienceOf(cid, car) {
30242
+ if (parsed.has(cid)) return parsed.get(cid);
30243
+ let value = null;
30244
+ if (car) {
30245
+ try {
30246
+ const extracted = await import_core2.Delegation.extract(decodeCarBase64(car));
30247
+ const node = extracted.ok;
30248
+ if (node && node.cid.toString() === cid) {
30249
+ value = { audience: normalizeDid(node.audience.did()), resources: node.capabilities.map((capability) => String(capability.with ?? "")) };
30250
+ }
30251
+ } catch {
30252
+ value = null;
30253
+ }
30254
+ }
30255
+ parsed.set(cid, value);
30256
+ return value;
30257
+ }
30258
+ const flowUriNow = () => typeof options.flowUri === "function" ? options.flowUri() : options.flowUri;
30259
+ function isFlowCapability(capability) {
30260
+ const flowUri = flowUriNow();
30261
+ if (!flowUri || !capability.can.startsWith("flow/")) return false;
30262
+ return capability.with === flowUri || capability.with.startsWith(`${flowUri}:`);
30263
+ }
30264
+ async function ownerDecision(owner, capability) {
30265
+ const root = options.delegationStore.getRoot();
30266
+ const rootCid = options.delegationStore.getRootCid();
30267
+ if (root && rootCid) {
30268
+ const verdict = await verifyGrant(root.delegation, { cid: rootCid, actorDid: owner, ownerDid: owner, required: capability, env: options.env, at: now(), coverage: "hierarchical" });
30269
+ if (verdict.ok && !verdict.revokedNow && verdict.grant.issuerDid === owner) {
30270
+ return { allowed: true, proofCids: [rootCid], viaOwner: true };
30271
+ }
30272
+ }
30273
+ return { allowed: true, proofCids: [], viaOwner: true };
30274
+ }
30275
+ async function decide(actorDid, capability) {
30276
+ const owner = options.getOwnerDid() ? normalizeDid(options.getOwnerDid()) : "";
30277
+ const recheck = now() + AUTHORITY_RECHECK_MS;
30278
+ if (!owner) {
30279
+ return { decision: { allowed: false, code: "NO_OWNER", reason: "We can't tell who created this flow yet, so nobody's grants can be checked." }, until: 0 };
30280
+ }
30281
+ if (!isFlowCapability(capability)) {
30282
+ return { decision: { allowed: false, code: "NOT_A_FLOW_CAPABILITY", reason: `${capability.can} on ${capability.with} is not part of this flow.` }, until: recheck };
30283
+ }
30284
+ const actor = normalizeDid(actorDid);
30285
+ if (actor === owner) return { decision: await ownerDecision(owner, capability), until: recheck };
30286
+ const rootCid = options.delegationStore.getRootCid();
30287
+ const candidates = [];
30288
+ for (const record3 of options.delegationStore.getAll()) {
30289
+ if (record3.cid === rootCid) continue;
30290
+ const signed = await audienceOf(record3.cid, record3.delegation);
30291
+ if (!signed || signed.audience !== actor) continue;
30292
+ candidates.push({ cid: record3.cid, car: record3.delegation, exact: signed.resources.includes(capability.with) });
30293
+ }
30294
+ if (candidates.length === 0) {
30295
+ return { decision: { allowed: false, code: "NO_GRANT", reason: "You have not been given this step in this flow." }, until: recheck };
30296
+ }
30297
+ candidates.sort((left, right) => Number(right.exact) - Number(left.exact) || (left.cid < right.cid ? -1 : left.cid > right.cid ? 1 : 0));
30298
+ const failures = [];
30299
+ for (const candidate of candidates) {
30300
+ const verdict = await verifyGrant(candidate.car, { cid: candidate.cid, actorDid: actor, ownerDid: owner, required: capability, env: options.env });
30301
+ if (verdict.ok) {
30302
+ const inStore = verdict.grant.proofChainCids.filter((cid) => cid !== candidate.cid && options.delegationStore.has(cid)).reverse();
30303
+ const until = Math.min(recheck, verdict.grant.expiresAt ?? recheck);
30304
+ return { decision: { allowed: true, proofCids: [candidate.cid, ...inStore], grant: verdict.grant, viaOwner: false }, until };
30305
+ }
30306
+ failures.push({ code: verdict.code, reason: verdict.reason });
30307
+ }
30308
+ failures.sort((a, b) => {
30309
+ const rank = (code) => {
30310
+ const index = FAILURE_PRIORITY.indexOf(code);
30311
+ return index === -1 ? FAILURE_PRIORITY.length : index;
30312
+ };
30313
+ return rank(a.code) - rank(b.code);
30314
+ });
30315
+ const worst = failures[0];
30316
+ return { decision: { allowed: false, code: worst.code, reason: worst.reason }, until: NO_CACHE_CODES.has(worst.code) ? 0 : recheck };
30317
+ }
30318
+ return {
30319
+ async authorize(actorDid, capability) {
30320
+ const key = keyOf(normalizeDid(actorDid), capability);
30321
+ const cached2 = decisions.get(key);
30322
+ if (cached2 && cached2.until > now()) return cached2.decision;
30323
+ const started = generation;
30324
+ const { decision, until } = await decide(actorDid, capability);
30325
+ if (started === generation) {
30326
+ if (until > now()) decisions.set(key, { decision, until });
30327
+ else decisions.delete(key);
30328
+ notify();
30329
+ }
30330
+ return decision;
30331
+ },
30332
+ peek(actorDid, capability) {
30333
+ const cached2 = decisions.get(keyOf(normalizeDid(actorDid), capability));
30334
+ return cached2 && cached2.until > now() ? cached2.decision : void 0;
30335
+ },
30336
+ invalidate() {
30337
+ generation += 1;
30338
+ decisions.clear();
30339
+ parsed.clear();
30340
+ notify();
30341
+ },
30342
+ subscribe(listener) {
30343
+ listeners.add(listener);
30344
+ return () => listeners.delete(listener);
30345
+ }
30346
+ };
30347
+ }
30348
+
30349
+ // src/core/lib/ucan/census.ts
30350
+ var import_core3 = require("@ucanto/core");
30351
+ var RESERVED_KEYS = /* @__PURE__ */ new Set(["__root__", "__version__"]);
30352
+ function unwrap(value) {
30353
+ const plain = value && typeof value.toJSON === "function" ? value.toJSON() : value;
30354
+ if (!plain || typeof plain !== "object" || Array.isArray(plain)) return null;
30355
+ const record3 = plain;
30356
+ const data = record3.data;
30357
+ return data && typeof data === "object" && !Array.isArray(data) ? data : record3;
30358
+ }
30359
+ async function parse(car, cid) {
30360
+ if (typeof car !== "string" || !car) return null;
30361
+ try {
30362
+ const extracted = await import_core3.Delegation.extract(decodeCarBase64(car));
30363
+ const node = extracted.ok;
30364
+ if (!node || node.cid.toString() !== cid) return null;
30365
+ return node;
30366
+ } catch {
30367
+ return null;
30368
+ }
30369
+ }
30370
+ function chainRootIssuer(node) {
30371
+ let current = node;
30372
+ for (let depth = 0; depth < 32; depth += 1) {
30373
+ const parent = current.proofs?.[0];
30374
+ if (!parent || typeof parent.issuer?.did !== "function") break;
30375
+ current = parent;
30376
+ }
30377
+ return normalizeDid(current.issuer.did());
30378
+ }
30379
+ async function censusFlowAuthority(yDoc, creatorDid = flowOwnerOf(yDoc)) {
30380
+ const creator = creatorDid ? normalizeDid(creatorDid) : "";
30381
+ const delegations = yDoc.getMap("delegations");
30382
+ const rootCid = delegations.get("__root__");
30383
+ const mirror = yDoc.getMap("root").get("flowOwnerDid");
30384
+ let rootIssuerDid = "";
30385
+ let grants = 0;
30386
+ let grantsNotFromCreator = 0;
30387
+ let unsignedRecords = 0;
30388
+ const others = /* @__PURE__ */ new Map();
30389
+ for (const [cid, raw] of delegations.entries()) {
30390
+ if (RESERVED_KEYS.has(cid)) continue;
30391
+ const record3 = unwrap(raw);
30392
+ const node = await parse(record3?.delegation, cid);
30393
+ if (!node) {
30394
+ unsignedRecords += 1;
30395
+ continue;
30396
+ }
30397
+ const issuer = chainRootIssuer(node);
30398
+ if (cid === rootCid) {
30399
+ rootIssuerDid = normalizeDid(node.issuer.did());
30400
+ continue;
30401
+ }
30402
+ grants += 1;
30403
+ if (issuer !== creator) {
30404
+ grantsNotFromCreator += 1;
30405
+ others.set(issuer, (others.get(issuer) ?? 0) + 1);
30406
+ }
30407
+ }
30408
+ const rootIssuedByCreator = Boolean(creator && rootIssuerDid === creator);
30409
+ return {
30410
+ creatorDid: creator,
30411
+ mirrorOwnerDid: typeof mirror === "string" ? mirror : "",
30412
+ rootIssuerDid,
30413
+ rootIssuedByCreator,
30414
+ grants,
30415
+ grantsNotFromCreator,
30416
+ unsignedRecords,
30417
+ otherIssuers: [...others.entries()].map(([did, count]) => ({ did, grants: count })).sort((a, b) => b.grants - a.grants || a.did.localeCompare(b.did)),
30418
+ needsResign: Boolean(creator) && (Boolean(rootIssuerDid) && !rootIssuedByCreator || grantsNotFromCreator > 0)
30419
+ };
30420
+ }
30421
+ function summarizeFlowAuthorityCensus(censuses) {
30422
+ return censuses.reduce(
30423
+ (summary, census) => ({
30424
+ flows: summary.flows + 1,
30425
+ flowsWithUnknownCreator: summary.flowsWithUnknownCreator + (census.creatorDid ? 0 : 1),
30426
+ flowsNeedingResign: summary.flowsNeedingResign + (census.needsResign ? 1 : 0),
30427
+ grantsNotFromCreator: summary.grantsNotFromCreator + census.grantsNotFromCreator
30428
+ }),
30429
+ { flows: 0, flowsWithUnknownCreator: 0, flowsNeedingResign: 0, grantsNotFromCreator: 0 }
30430
+ );
30431
+ }
30432
+
30433
+ // src/core/lib/ucan/lifecycleAuthorizer.ts
30434
+ function createUcanRunLifecycleAuthorizer(getService) {
30435
+ return async (request) => {
30436
+ const service = getService();
30437
+ if (!service) {
30438
+ return { allowed: false, reason: "This editor cannot check grants, so no session can be started or closed here." };
30439
+ }
30440
+ const result = await service.findValidProofs(request.actorDid, { can: request.can, with: request.with });
30441
+ return result.found ? { allowed: true } : { allowed: false, reason: result.error || `You are not allowed to ${request.can === "flow/run.start" ? "start" : "close"} this flow.` };
30442
+ };
30443
+ }
30444
+
30445
+ // src/core/lib/ucan/receiptVerifier.ts
30446
+ var TRANSIENT = /* @__PURE__ */ new Set(["REVOCATION_CHECK_FAILED", "NO_REVOCATION_CHECKER", "NO_OWNER"]);
30447
+ var TRANSIENT_TTL_MS = 5e3;
30448
+ function createReceiptVerifier(options) {
30449
+ const now = options.now ?? Date.now;
30450
+ const ttlMs = options.ttlMs ?? 3e4;
30451
+ const cache = /* @__PURE__ */ new Map();
30452
+ const inFlight = /* @__PURE__ */ new Map();
30453
+ const listeners = /* @__PURE__ */ new Set();
30454
+ const keyOf2 = (invocation, expected) => `${invocation.cid}\0${expected.blockId}\0${invocation.invokerDid}\0${invocation.sessionRunId ?? ""}`;
30455
+ async function run(invocation, expected) {
30456
+ const owner = options.getOwnerDid() ? normalizeDid(options.getOwnerDid()) : "";
30457
+ if (!owner) return { status: { status: "unverified", reason: "We can't tell who created this flow yet, so its receipts can't be checked." }, transient: true };
30458
+ const verdict = await verifyInvocation(invocation.invocation, {
30459
+ cid: invocation.cid,
30460
+ expectedAudience: owner,
30461
+ ownerDid: owner,
30462
+ actorDid: invocation.invokerDid,
30463
+ required: { can: "flow/block/execute", with: `${typeof options.flowUri === "function" ? options.flowUri() : options.flowUri}:${expected.blockId}` },
30464
+ // The record's session run (what every surface groups it under) must be
30465
+ // the one the signer bound it to.
30466
+ ...invocation.sessionRunId ? { expectedFacts: { sessionRunId: invocation.sessionRunId } } : {},
30467
+ env: options.env,
30468
+ at: invocation.executedAt
30469
+ });
30470
+ if (!verdict.ok) return { status: { status: "unverified", reason: verdict.reason }, transient: TRANSIENT.has(verdict.code) };
30471
+ if (verdict.revokedNow) {
30472
+ return { status: { status: "unverified", reason: "This step was done under a grant that has since been cancelled.", revokedSince: true }, transient: false };
30473
+ }
30474
+ return { status: { status: "verified", ...verdict.noTimeAnchor ? { noTimeAnchor: true } : {} }, transient: false };
30475
+ }
30476
+ const verifier = {
30477
+ check(invocation, expected) {
30478
+ const key = keyOf2(invocation, expected);
30479
+ const hit = cache.get(key);
30480
+ if (hit && hit.until > now()) return hit.status;
30481
+ void verifier.verify(invocation, expected);
30482
+ return hit?.status ?? { status: "pending" };
30483
+ },
30484
+ verify(invocation, expected) {
30485
+ const key = keyOf2(invocation, expected);
30486
+ const pending = inFlight.get(key);
30487
+ if (pending) return pending;
30488
+ const request = run(invocation, expected).then(({ status, transient }) => {
30489
+ cache.set(key, { status, until: now() + (transient ? TRANSIENT_TTL_MS : ttlMs) });
30490
+ for (const listener of listeners) listener();
30491
+ return status;
30492
+ }).finally(() => inFlight.delete(key));
30493
+ inFlight.set(key, request);
30494
+ return request;
30495
+ },
30496
+ remember(invocation, expected, status) {
30497
+ cache.set(keyOf2(invocation, expected), { status, until: now() + ttlMs });
30498
+ },
30499
+ subscribe(listener) {
30500
+ listeners.add(listener);
30501
+ return () => listeners.delete(listener);
30502
+ }
30503
+ };
30504
+ return verifier;
30505
+ }
30506
+
30507
+ // src/core/lib/ucan/actionAuthority.ts
30508
+ var import_core4 = require("@ucanto/core");
30509
+ var FLOW_AUTHORITY_EVENT_TYPE = "ixo.qi.flow.authority.v1";
30510
+ function isRecord6(value) {
30511
+ const record3 = value;
30512
+ return Boolean(record3 && record3.v === 1 && record3.grant?.car && record3.invocation?.car && record3.action && typeof record3.rootIssuer === "string");
30513
+ }
30514
+ function authorityEventMatches(content, runId, stepId) {
30515
+ return isRecord6(content) && content.action.runId === runId && content.action.stepId === stepId;
30516
+ }
30517
+ function statusFor(invocation, revokedNow, now) {
30518
+ if (revokedNow) return { status: "verified-at-the-time", reason: "A grant behind it has been cancelled since." };
30519
+ if (invocation.grantsExpireAt !== void 0 && invocation.grantsExpireAt <= now) {
30520
+ return { status: "verified-at-the-time", reason: `A grant behind it expired on ${new Date(invocation.grantsExpireAt).toISOString()}.` };
30521
+ }
30522
+ return { status: "verified" };
30523
+ }
30524
+ async function verifyPortalReceipt(params, receipt, now) {
30525
+ const verdict = await verifyInvocation(receipt.invocation, {
30526
+ cid: receipt.cid,
30527
+ expectedAudience: params.ownerDid,
30528
+ ownerDid: params.ownerDid,
30529
+ actorDid: receipt.invokerDid,
30530
+ required: { can: "flow/block/execute", with: `${params.flowUri}:${params.stepId}` },
30531
+ ...receipt.sessionRunId ? { expectedFacts: { sessionRunId: receipt.sessionRunId } } : {},
30532
+ env: params.env,
30533
+ at: receipt.executedAt
30534
+ });
30535
+ if (!verdict.ok) return { status: "not-verified", source: "portal-receipt", actorDid: normalizeDid(receipt.invokerDid), reason: verdict.reason };
30536
+ const base = { source: "portal-receipt", actorDid: verdict.invocation.invokerDid, chain: verdict.invocation.proofChain, at: receipt.executedAt };
30537
+ if (verdict.noTimeAnchor) {
30538
+ return { ...base, status: "no-time-anchor", reason: "This receipt was signed with no expiry, so the time it ran is only what the record says." };
30539
+ }
30540
+ return { ...base, ...statusFor(verdict.invocation, verdict.revokedNow, now) };
30541
+ }
30542
+ async function verifyFlowManagerRecord(params, event, now) {
30543
+ const record3 = event.content;
30544
+ if (!isRecord6(record3)) return { status: "not-verified", source: "flow-manager-record", reason: "The flow-manager's authority record could not be read." };
30545
+ if (normalizeDid(record3.rootIssuer) !== normalizeDid(params.ownerDid)) {
30546
+ return {
30547
+ status: "not-verified",
30548
+ source: "flow-manager-record",
30549
+ reason: `The flow-manager acted under authority from ${record3.rootIssuer}, who did not create this flow.`
30550
+ };
30551
+ }
30552
+ const env = {
30553
+ revocationChecker: params.env.revocationChecker,
30554
+ didResolver: async (did) => {
30555
+ if (did.startsWith("did:key:")) return { ok: [did] };
30556
+ const keys = (record3.signers[did] ?? []).filter((key) => key.startsWith("did:key:"));
30557
+ return keys.length > 0 ? { ok: keys } : { error: { name: "DIDKeyResolutionError", did, message: `the record keeps no key for ${did}` } };
30558
+ }
30559
+ };
30560
+ const holder = await holderOf(record3);
30561
+ const verdict = await verifyInvocation(record3.invocation.car, {
30562
+ cid: record3.invocation.cid,
30563
+ expectedAudience: holder,
30564
+ ownerDid: params.ownerDid,
30565
+ actorDid: holder,
30566
+ required: { can: record3.action.can, with: record3.action.with },
30567
+ expectedFacts: {
30568
+ runId: record3.action.runId,
30569
+ stepId: record3.action.stepId,
30570
+ attemptId: record3.action.attemptId,
30571
+ operationId: record3.action.operationId,
30572
+ inputDigest: record3.action.inputDigest
30573
+ },
30574
+ env,
30575
+ at: event.originServerTs,
30576
+ allowBlockExecuteFallback: record3.action.safety !== "fenced"
30577
+ });
30578
+ if (!verdict.ok) return { status: "not-verified", source: "flow-manager-record", actorDid: holder, reason: verdict.reason };
30579
+ if (!verdict.invocation.proofChainCids.includes(record3.grant.cid)) {
30580
+ return { status: "not-verified", source: "flow-manager-record", actorDid: holder, reason: "The flow-manager did not act under the grant it recorded." };
30581
+ }
30582
+ let requesterDid;
30583
+ if (record3.requester) {
30584
+ const requester = await verifyRequester(record3, env, event.originServerTs, params.ownerDid);
30585
+ if ("reason" in requester) return { status: "not-verified", source: "flow-manager-record", actorDid: holder, reason: requester.reason };
30586
+ requesterDid = requester.did;
30587
+ }
30588
+ return {
30589
+ source: "flow-manager-record",
30590
+ actorDid: holder,
30591
+ chain: verdict.invocation.proofChain,
30592
+ at: event.originServerTs,
30593
+ ...requesterDid ? { requesterDid } : {},
30594
+ ...statusFor(verdict.invocation, verdict.revokedNow, now)
30595
+ };
30596
+ }
30597
+ async function holderOf(record3) {
30598
+ const extracted = await import_core4.Delegation.extract(decodeCarBase64(record3.grant.car));
30599
+ const grant = extracted.ok;
30600
+ return grant ? normalizeDid(grant.audience.did()) : "";
30601
+ }
30602
+ async function verifyRequester(record3, env, fallbackAt, ownerDid) {
30603
+ const requester = record3.requester;
30604
+ const extracted = await import_core4.Delegation.extract(decodeCarBase64(requester.car));
30605
+ const node = extracted.ok;
30606
+ const claimed = node?.capabilities?.[0];
30607
+ if (!node || !claimed) return { reason: "The requester's signed request could not be read." };
30608
+ const verdict = await verifyInvocation(requester.car, {
30609
+ cid: requester.cid,
30610
+ expectedAudience: node.audience.did(),
30611
+ ownerDid,
30612
+ required: { can: claimed.can, with: claimed.with },
30613
+ expectedFacts: { type: "qi.flow.request", runId: record3.action.runId },
30614
+ env,
30615
+ // Checked as of when the flow-manager accepted it: a request lives for
30616
+ // minutes, the run it started for much longer.
30617
+ at: typeof requester.acceptedAt === "number" ? requester.acceptedAt : fallbackAt
30618
+ });
30619
+ if (!verdict.ok) return { reason: `The request the flow-manager acted on does not check out: ${verdict.reason}` };
30620
+ return { did: verdict.invocation.invokerDid };
30621
+ }
30622
+ async function verifyActionAuthority(params) {
30623
+ const now = (params.now ?? Date.now)();
30624
+ if (!params.ownerDid) return { status: "not-verified", source: "none", reason: "We can't tell who created this flow, so nothing in it can be checked." };
30625
+ const runtime = readActionState(params.yDoc, params.runId, params.stepId);
30626
+ const receiptCid = typeof runtime.lastInvocationCid === "string" ? runtime.lastInvocationCid : void 0;
30627
+ const receipt = receiptCid ? params.yDoc.getMap("invocations").get(receiptCid) : void 0;
30628
+ if (receipt && typeof receipt === "object" && receipt.invocation) return verifyPortalReceipt(params, receipt, now);
30629
+ if (params.authorityEvent) return verifyFlowManagerRecord(params, params.authorityEvent, now);
30630
+ return {
30631
+ status: "not-verified",
30632
+ source: "none",
30633
+ reason: receiptCid ? "The receipt this step points at is missing its signed copy." : "There is no signed proof of who did this step."
30634
+ };
30635
+ }
30636
+
29592
30637
  // src/core/templates/oracleInitFlow.ts
29593
30638
  var oracleInitSurveySchema = {
29594
30639
  title: "Oracle Configuration",
@@ -29974,6 +31019,7 @@ function createOracleInitFlowTemplate() {
29974
31019
  ACTION_MANIFEST_VERSION,
29975
31020
  ACTION_REGISTRY_VERSION,
29976
31021
  ACTION_SAFETY_BY_TYPE,
31022
+ AUTHORITY_RECHECK_MS,
29977
31023
  ActionContractResolutionError,
29978
31024
  ActionManifestV2VerificationError,
29979
31025
  ComposioContractMismatchError,
@@ -29987,10 +31033,13 @@ function createOracleInitFlowTemplate() {
29987
31033
  EffectClaimTransitionError,
29988
31034
  EncryptedMatrixFlowDefinitionRevisionRepository,
29989
31035
  ExplicitRunRequiredError,
31036
+ FLOW_AUTHORITY_EVENT_TYPE,
29990
31037
  FLOW_CAPABILITIES,
29991
31038
  FLOW_CONNECTIONS_MAP_KEY,
29992
31039
  FLOW_CONNECTION_BINDINGS_MAP_KEY,
31040
+ FLOW_IDENTITY_EVENT_TYPE,
29993
31041
  FLOW_PARTICIPANTS_MAP_KEY,
31042
+ FLOW_REQUESTS_MAP_KEY,
29994
31043
  FLOW_RUN_PROJECTIONS_MAP_KEY,
29995
31044
  FlowAgentService,
29996
31045
  FlowDefinitionPublicationError,
@@ -30058,6 +31107,9 @@ function createOracleInitFlowTemplate() {
30058
31107
  assertLegacyFlowOperationAllowed,
30059
31108
  assertRunActionExecutionAllowed,
30060
31109
  auditFlowProjections,
31110
+ authorityEventMatches,
31111
+ bindFlowOwner,
31112
+ bindFlowOwnerFromRoom,
30061
31113
  boundRunActionOutput,
30062
31114
  boundRunEventJson,
30063
31115
  buildActionRunInputs,
@@ -30079,7 +31131,9 @@ function createOracleInitFlowTemplate() {
30079
31131
  canonicalDesignPodJson,
30080
31132
  canonicalizeJson,
30081
31133
  canonicalizeManifestV2Payload,
31134
+ capabilityForRequest,
30082
31135
  capabilityPatternCoversCan,
31136
+ censusFlowAuthority,
30083
31137
  claimEffect,
30084
31138
  classifyBlockerCause,
30085
31139
  classifyNodeState,
@@ -30108,7 +31162,9 @@ function createOracleInitFlowTemplate() {
30108
31162
  createDesignPodArtifactReceipt,
30109
31163
  createDesignPodOperationalFlowPlan,
30110
31164
  createDesignPodPortalJourneyPlan,
31165
+ createFlowAuthorityIndex,
30111
31166
  createFlowDraftProposal,
31167
+ createFlowRequest,
30112
31168
  createInvocationStore,
30113
31169
  createMcpTopicExecutorAdapter,
30114
31170
  createMemoryInvocationStore,
@@ -30116,6 +31172,7 @@ function createOracleInitFlowTemplate() {
30116
31172
  createOracleInitFlowTemplate,
30117
31173
  createPeerExecutor,
30118
31174
  createQiForgeTopicExecutorAdapter,
31175
+ createReceiptVerifier,
30119
31176
  createReference,
30120
31177
  createRunEventIdempotencyKey,
30121
31178
  createRunId,
@@ -30126,9 +31183,11 @@ function createOracleInitFlowTemplate() {
30126
31183
  createRunUlid,
30127
31184
  createRuntimeStateManager,
30128
31185
  createUcanDelegationStore,
31186
+ createUcanRunLifecycleAuthorizer,
30129
31187
  createUcanService,
30130
31188
  createYDocRuntimeManager,
30131
31189
  createYjsFlowDefinitionDraftRepository,
31190
+ decodeCarBase64,
30132
31191
  decompileToBaseUcanFlow,
30133
31192
  deepFreezeJson,
30134
31193
  deleteActionState,
@@ -30140,6 +31199,8 @@ function createOracleInitFlowTemplate() {
30140
31199
  detectRunDefinitionDrift,
30141
31200
  digestCanonicalJson,
30142
31201
  digestDesignPodValue,
31202
+ digestInputResponse,
31203
+ digestRequestValue,
30143
31204
  dispatchFlowStartTriggers,
30144
31205
  doneWhenCompleted,
30145
31206
  drainTopicReceiptOutbox,
@@ -30160,6 +31221,8 @@ function createOracleInitFlowTemplate() {
30160
31221
  findXeroWorkItems,
30161
31222
  findXeroWorkItemsForEditor,
30162
31223
  fingerprintFlowCommand,
31224
+ flowOwnerDidFromCreateSender,
31225
+ flowOwnerOf,
30163
31226
  flowRunProjectionStorageKey,
30164
31227
  generateActionManifest,
30165
31228
  getAction,
@@ -30187,6 +31250,7 @@ function createOracleInitFlowTemplate() {
30187
31250
  getVersionPolicy,
30188
31251
  getXeroWorkItemsMap,
30189
31252
  getXeroWorkTerminalMap,
31253
+ grantCoversExercise,
30190
31254
  hasAction,
30191
31255
  hasLegacyRuntimeHistory,
30192
31256
  hasReferences,
@@ -30199,6 +31263,7 @@ function createOracleInitFlowTemplate() {
30199
31263
  isBlankInputValue,
30200
31264
  isCapabilityMatch,
30201
31265
  isExternalMutation,
31266
+ isFlowOwner,
30202
31267
  isLegacyRuntimeAdoptionEnabled,
30203
31268
  isNeverDoneAction,
30204
31269
  isNodeContextRecord,
@@ -30207,6 +31272,7 @@ function createOracleInitFlowTemplate() {
30207
31272
  isRuntimeRef,
30208
31273
  isVerifiedCompletion,
30209
31274
  isVersionAtLeast,
31275
+ lifecycleRequestProof,
30210
31276
  listOpenRuns,
30211
31277
  listRuns,
30212
31278
  markDesignPodReviewed,
@@ -30226,6 +31292,7 @@ function createOracleInitFlowTemplate() {
30226
31292
  normalizeCapabilityPattern,
30227
31293
  normalizeCondition,
30228
31294
  normalizeConditions,
31295
+ normalizeDid,
30229
31296
  oracleInitSurveySchema,
30230
31297
  parseConditionConfig,
30231
31298
  parseConditionConfigStrict,
@@ -30255,7 +31322,10 @@ function createOracleInitFlowTemplate() {
30255
31322
  readFlowDocument,
30256
31323
  readFlowDocumentHistory,
30257
31324
  readFlowFromEditor,
31325
+ readFlowIdentityDocId,
31326
+ readFlowOwnerDid,
30258
31327
  readFlowParticipants,
31328
+ readFlowRequest,
30259
31329
  readFlowRunProjection,
30260
31330
  readFlowXeroBinding,
30261
31331
  readFlowXeroBindingFromEditor,
@@ -30263,6 +31333,7 @@ function createOracleInitFlowTemplate() {
30263
31333
  readPendingInvocations,
30264
31334
  readPendingRunTimelineEvents,
30265
31335
  readQueuedAgentCommands,
31336
+ readRoomCreatorUserId,
30266
31337
  readRunActionStates,
30267
31338
  readRunRecords,
30268
31339
  reconcileActionReadBack,
@@ -30285,6 +31356,7 @@ function createOracleInitFlowTemplate() {
30285
31356
  repairFlowRunProjection,
30286
31357
  replaceBlockInFragment,
30287
31358
  replayFailedListenerRun,
31359
+ requestStepRun,
30288
31360
  requiredCapabilityForCommand,
30289
31361
  resetActionState,
30290
31362
  resetStepRuntime,
@@ -30302,6 +31374,7 @@ function createOracleInitFlowTemplate() {
30302
31374
  resolveSingleReference,
30303
31375
  resourceMatches,
30304
31376
  retryPendingRunTimelineEvents,
31377
+ revocationCheckerFor,
30305
31378
  runLedgerAttestations,
30306
31379
  sameDesignPodActor,
30307
31380
  seedDesignPodMethodDefinition,
@@ -30327,10 +31400,12 @@ function createOracleInitFlowTemplate() {
30327
31400
  signFlowDefinitionRevision,
30328
31401
  signFlowEvent,
30329
31402
  signMatrixDefinitionAnchor,
31403
+ signedCapabilityCovers,
30330
31404
  snapshotInputRefs,
30331
31405
  snapshotNode,
30332
31406
  startRun,
30333
31407
  subscribeToActionState,
31408
+ summarizeFlowAuthorityCensus,
30334
31409
  swapFlowBlocks,
30335
31410
  syncFlowNodePropsFromProjection,
30336
31411
  tickFlowAgent,
@@ -30342,6 +31417,7 @@ function createOracleInitFlowTemplate() {
30342
31417
  topicActionThreadUpdateTransactionId,
30343
31418
  topicSemanticRecordsDigest,
30344
31419
  typeToCan,
31420
+ ucanVerificationEnvFrom,
30345
31421
  updateAgentCommand,
30346
31422
  updateDesignPodControl,
30347
31423
  updateNodeRuntime,
@@ -30358,6 +31434,7 @@ function createOracleInitFlowTemplate() {
30358
31434
  validateFlowAgentLease,
30359
31435
  validateTopicSemanticRecord,
30360
31436
  validateTopicSemanticRecordBatch,
31437
+ verifyActionAuthority,
30361
31438
  verifyActionManifestV2,
30362
31439
  verifyCompletion,
30363
31440
  verifyComposioActionAvailability,
@@ -30365,9 +31442,13 @@ function createOracleInitFlowTemplate() {
30365
31442
  verifyExecutionPolicy,
30366
31443
  verifyFlowDefinitionRevision,
30367
31444
  verifyFlowEvent,
31445
+ verifyGrant,
31446
+ verifyInvocation,
30368
31447
  verifyMatrixDefinitionAnchor,
30369
31448
  writeActionState,
30370
31449
  writeCompiledBlocksToFragment,
31450
+ writeFlowIdentity,
31451
+ writeFlowRequest,
30371
31452
  writeRunRecordAndReconcile,
30372
31453
  xeroOracleActivityForBlock,
30373
31454
  xeroOracleActivityForBlockForEditor