nolo-cli 0.228.0-alpha.1 → 0.228.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 (238) hide show
  1. package/README.md +3 -5
  2. package/{_executeModel-WZKT6XEU.js → _executeModel-GIFVXKDT.js} +89 -82
  3. package/{accountResolver-QETKNC7T.js → accountResolver-NGICIMEE.js} +1 -1
  4. package/{action-GDZDXPMB.js → action-WZTKEF5H.js} +9 -6
  5. package/{addContentAction-7RO4AMRI.js → addContentAction-MLI6GOBV.js} +14 -13
  6. package/{addDialogAgentAction-EVYBGTXB.js → addDialogAgentAction-ARGQM22H.js} +17 -16
  7. package/{agentDeleteCommand-PZWRHNXY.js → agentDeleteCommand-UF7XVELS.js} +120 -111
  8. package/{agentEmailCommands-QTKMEICX.js → agentEmailCommands-SFHRPQYC.js} +120 -107
  9. package/agentListCommands-IXKBP3W5.js +644 -0
  10. package/{agentMachineCommands-7QGICJLM.js → agentMachineCommands-7NX6PWQ6.js} +56 -48
  11. package/{agentProviderCommands-STI3DQ6A.js → agentProviderCommands-C5T7C5KZ.js} +2 -2
  12. package/{agentPullCommand-KHV4EELF.js → agentPullCommand-4EQZYHU4.js} +1 -1
  13. package/agentRecordCommands-IUNX6XD6.js +188 -0
  14. package/{agentRunCommand-OFQLOF5Y.js → agentRunCommand-LCR4XADM.js} +127 -111
  15. package/{agentRunControl-MBG4U6SL.js → agentRunControl-RN2P6AOD.js} +11 -9
  16. package/{agentRuntimeLocal-TU4LA353.js → agentRuntimeLocal-LVXPQ7QA.js} +57 -43
  17. package/{agentSlice-L4SBGWTB.js → agentSlice-ZGMOH6TE.js} +15 -14
  18. package/{appDeleteCommands-JWP3XPUA.js → appDeleteCommands-BESCJOQM.js} +56 -48
  19. package/{appDeployCommands-6E4TQCWI.js → appDeployCommands-LPTR6IOX.js} +56 -48
  20. package/{appDeployStatusCommands-ALU4SADG.js → appDeployStatusCommands-BZ7KZ5RD.js} +56 -48
  21. package/{appGetCommands-JEY4L6L4.js → appGetCommands-EDWGJV4S.js} +56 -48
  22. package/{appListCommands-PCAVHU7M.js → appListCommands-OPRWYPM6.js} +56 -48
  23. package/{authCommand-CGRIIOOV.js → authCommand-3C3RN4OU.js} +25 -19
  24. package/{authCommands-55OGQGCR.js → authCommands-ZMVEDCQD.js} +12 -6
  25. package/{builtinSkillRegistry-BAE2LDXF.js → builtinSkillRegistry-VRCMQ77Q.js} +7 -7
  26. package/{chromeCommands-G5UDKVSV.js → chromeCommands-O4IIKTBD.js} +384 -7
  27. package/{chromeOpsCommands-WAA45NCS.js → chromeOpsCommands-NZITLHWO.js} +3 -3
  28. package/{chunk-AUAJTAFM.js → chunk-2BKNICGK.js} +4 -4
  29. package/{chunk-QYB23WUH.js → chunk-2FK2KZSL.js} +1 -1
  30. package/chunk-2SXN7LAY.js +15 -0
  31. package/{chunk-H6L2NFHY.js → chunk-3DJJ4CFG.js} +11 -11
  32. package/{chunk-TSPMLCWI.js → chunk-4IQN6FWY.js} +5 -5
  33. package/{chunk-GUXZK7SE.js → chunk-4OXPN3WC.js} +17 -6
  34. package/chunk-4ZCTKB27.js +31 -0
  35. package/chunk-53W5BXLN.js +340 -0
  36. package/{chunk-3P54D2E4.js → chunk-5HUO7SEX.js} +9 -107
  37. package/chunk-6ASGEP5D.js +21 -0
  38. package/{chunk-DDC6P6EH.js → chunk-6CXQ3YNJ.js} +68 -40
  39. package/{chunk-G7IUT2V3.js → chunk-6MTVACLN.js} +365 -64
  40. package/{chunk-ZOHO6MOF.js → chunk-6RSNVJGO.js} +2 -99
  41. package/{chunk-XSW4EXQV.js → chunk-6TVYUQRM.js} +55 -18
  42. package/{chunk-PDCV7P5W.js → chunk-6XIE5ZGI.js} +1 -1
  43. package/{chunk-7Z6EW7AH.js → chunk-6XVPMGXK.js} +97 -11
  44. package/{chunk-ALAES342.js → chunk-73PZD7JZ.js} +9 -5
  45. package/{chunk-2MCB7CD7.js → chunk-7UVVLYKC.js} +9 -9
  46. package/{chunk-S6FDXXZV.js → chunk-ADOOL3PG.js} +2 -2
  47. package/{chunk-OWKNSIXL.js → chunk-AEZBAFC6.js} +334 -77
  48. package/{chunk-PWTNI4N7.js → chunk-ANUP75N2.js} +22 -0
  49. package/{chunk-RG2DGNL6.js → chunk-ARFCL53U.js} +5 -5
  50. package/{chunk-SRCCSTIM.js → chunk-AS6L5KSD.js} +4 -4
  51. package/{chunk-GPOV42YM.js → chunk-BAH3BAUZ.js} +8 -8
  52. package/{chunk-N5Z2V73W.js → chunk-BFKJ2RS3.js} +1 -1
  53. package/{chunk-F6Z6ZCUV.js → chunk-BVEDT6DM.js} +3 -3
  54. package/chunk-C5A54QS7.js +108 -0
  55. package/{chunk-CD3RU7XL.js → chunk-CD2DK5JA.js} +120 -14
  56. package/{chunk-BP5ZJ6B4.js → chunk-CD64YXRB.js} +1 -1
  57. package/{chunk-VP3BINY7.js → chunk-CIGCTSBF.js} +31 -1
  58. package/{chunk-D6YNCNM6.js → chunk-CIUZXD5D.js} +12 -12
  59. package/{chunk-EVGU5P4U.js → chunk-CO6E7YK6.js} +1 -1
  60. package/{chunk-VMJVAJ6W.js → chunk-CTIEJRTP.js} +28 -4
  61. package/{chunk-7JGMNKKG.js → chunk-CTWCZKNS.js} +29 -8
  62. package/{chunk-YFLVRVYK.js → chunk-D25ONVOH.js} +1 -1
  63. package/{chunk-LKA64WH4.js → chunk-DMPZMYH4.js} +37 -1
  64. package/{chunk-262R3XNN.js → chunk-E5RYFR7E.js} +334 -103
  65. package/{chunk-OQHIVPG4.js → chunk-E6A5NHDH.js} +4 -1
  66. package/{chunk-HSSBDZLD.js → chunk-EDT65EUE.js} +6 -6
  67. package/{chunk-IAAIUH64.js → chunk-EQZQUQ33.js} +7 -7
  68. package/{chunk-HBRDSQ3M.js → chunk-ESN4WNWU.js} +3 -2
  69. package/{chunk-2YGBI2XB.js → chunk-FE7G6DSP.js} +11 -1
  70. package/{chunk-547ENH5T.js → chunk-FFFKAOJN.js} +4 -4
  71. package/{chunk-5ZUOVCKT.js → chunk-FGHEF6WI.js} +3 -1
  72. package/{chunk-IXG6YXQM.js → chunk-FTWAOKFU.js} +795 -361
  73. package/chunk-GAHJLSDO.js +107 -0
  74. package/{chunk-2X7WFDT6.js → chunk-GX6DITLQ.js} +1 -1
  75. package/{chunk-GYS5FUYR.js → chunk-HCCQEMTK.js} +28 -28
  76. package/{chunk-CMMI3DAT.js → chunk-HZDK56EK.js} +33 -26
  77. package/{chunk-UE2EVEYS.js → chunk-IIOSZAJX.js} +4 -4
  78. package/chunk-IIRJ4P4I.js +24 -0
  79. package/{chunk-QCB42576.js → chunk-IJZC2KIJ.js} +1 -1
  80. package/{chunk-RYOLWYBK.js → chunk-ITBX27W6.js} +97 -21
  81. package/{chunk-VSYTM22R.js → chunk-J2VIGDJN.js} +6 -6
  82. package/{chunk-QBZCGP34.js → chunk-JEWMQR6J.js} +1 -1
  83. package/{chunk-6QHKRARD.js → chunk-JFRJEPFI.js} +29 -5
  84. package/{chunk-S6K5F3KP.js → chunk-JP2BH4NC.js} +1 -1
  85. package/{chunk-MDZWUD3R.js → chunk-JU7VN4LF.js} +38 -29
  86. package/{chunk-RTHFJZ6M.js → chunk-K26XPZRB.js} +2 -2
  87. package/{chunk-ZYKJBRZ3.js → chunk-K7VIXYTZ.js} +1 -3
  88. package/chunk-KK3FCYZM.js +647 -0
  89. package/chunk-KLAMJNKQ.js +33394 -0
  90. package/{chunk-4JVNURX4.js → chunk-KQHEGELM.js} +68 -16
  91. package/chunk-KXOPLLFP.js +190 -0
  92. package/{chunk-GOCSSER3.js → chunk-KZ5OD2MO.js} +4 -4
  93. package/{chunk-ILHQ2AXT.js → chunk-KZAT2M2V.js} +14 -8
  94. package/chunk-LHCGKAFO.js +739 -0
  95. package/{chunk-XJPLSAPJ.js → chunk-LMGFVH65.js} +107 -104
  96. package/{chunk-QRGDJA4B.js → chunk-LTVEOOZL.js} +19 -6
  97. package/{chunk-L32W3PRP.js → chunk-MAA42MMV.js} +233 -17
  98. package/{chunk-ATEKLSLR.js → chunk-MTM4LRVG.js} +14 -9
  99. package/chunk-MVOZ22RZ.js +26 -0
  100. package/{chunk-2NPD3FTX.js → chunk-MYYNZG2M.js} +139 -39
  101. package/{chunk-DBUR22G5.js → chunk-MZVCFV3T.js} +19 -15
  102. package/{chunk-K67C2JUC.js → chunk-N74XL3NI.js} +9 -9
  103. package/{chunk-VS276URX.js → chunk-NEG5LYK5.js} +1 -1
  104. package/{chunk-RBPUNSG5.js → chunk-OAZP4TSA.js} +18 -108
  105. package/{chunk-SMJEXX2S.js → chunk-ODBYGVO2.js} +232 -10
  106. package/{chunk-M4SFKP5L.js → chunk-OHUYN3YU.js} +3 -3
  107. package/{chunk-HYLRQDEE.js → chunk-OLGFIQN2.js} +6 -6
  108. package/{chunk-M3JEW6N6.js → chunk-OYUMJMC5.js} +15 -0
  109. package/chunk-P27E22MA.js +203 -0
  110. package/{chunk-BIWI5M4E.js → chunk-PBPXXMWZ.js} +1 -1
  111. package/{chunk-OBSEKCVK.js → chunk-PQ63BDV3.js} +210 -51
  112. package/{chunk-4I2MXV5Q.js → chunk-PVFYPUIM.js} +2 -0
  113. package/{chunk-OG6MQOQG.js → chunk-QMNVV3YM.js} +10 -37
  114. package/{chunk-GACR7H6T.js → chunk-R5NRFXGD.js} +5 -5
  115. package/{chunk-5FUN7EG4.js → chunk-RD3QLZQV.js} +83 -47
  116. package/{chunk-4WVJLODK.js → chunk-RHBD22LV.js} +9 -4
  117. package/{chunk-EXJK7TQO.js → chunk-RMWDKLBE.js} +1520 -562
  118. package/{chunk-TGNIKIHR.js → chunk-RR3MB26M.js} +2 -2
  119. package/{chunk-OOJNQK6V.js → chunk-S25VJYXV.js} +8 -2
  120. package/{chunk-STJ6LSQE.js → chunk-SCMYAGQE.js} +1135 -712
  121. package/{chunk-YKY4OVOX.js → chunk-SPU3L3OR.js} +17 -170
  122. package/chunk-SR4FE5VD.js +9 -0
  123. package/{chunk-DUUDXSLX.js → chunk-SX6AWTNK.js} +28 -4
  124. package/{chunk-ZH3KXFHS.js → chunk-TMRJGSK2.js} +1 -1
  125. package/{chunk-S2NTVGA2.js → chunk-U35UUM5K.js} +2 -1
  126. package/{chunk-PPJYZRSQ.js → chunk-U5LOKQ2R.js} +30 -14
  127. package/{chunk-UAIHKQIA.js → chunk-U6RD332P.js} +18 -2
  128. package/{chunk-3U44JB3O.js → chunk-UF6J7NXV.js} +1 -1
  129. package/{chunk-Q3IVPFVO.js → chunk-UHW6SCVK.js} +1 -1
  130. package/chunk-UOUMPHS5.js +103 -0
  131. package/{chunk-HHFGE2WF.js → chunk-UPOW5HTG.js} +5 -5
  132. package/{chunk-DEA37IUY.js → chunk-V4IYI3SB.js} +2 -2
  133. package/{chunk-UWAIJOF2.js → chunk-VKCPKCSS.js} +66 -92
  134. package/{chunk-HGDKT2D6.js → chunk-VTHWBTRE.js} +177 -1
  135. package/{chunk-OBIC6EG7.js → chunk-VUHKG4KS.js} +3 -3
  136. package/{chunk-EEOOBRA7.js → chunk-W3HSD32M.js} +13 -6
  137. package/{chunk-P2ZLUIW2.js → chunk-W6T4FNZP.js} +351 -26
  138. package/chunk-WDWZPASX.js +29 -0
  139. package/chunk-WFGNWWJI.js +326 -0
  140. package/{chunk-R6Z5S5GA.js → chunk-WQDTSK5U.js} +51 -14
  141. package/{chunk-OYU2MA5S.js → chunk-X22AUZKL.js} +152 -167
  142. package/{chunk-4ZGPHFLE.js → chunk-X3OZ655T.js} +2 -2
  143. package/{chunk-NHY322ZU.js → chunk-XCA4WHX5.js} +588 -64
  144. package/{chunk-TI2EPRHE.js → chunk-XJSEST7D.js} +3 -3
  145. package/{chunk-JUSHVFNF.js → chunk-XNTZD4AE.js} +1230 -1356
  146. package/chunk-XSRSAU3O.js +133 -0
  147. package/{chunk-CYWNWA77.js → chunk-Y4NPF2UN.js} +6 -3
  148. package/{chunk-FJSNBZXR.js → chunk-YDRRGVT5.js} +1 -1
  149. package/{chunk-R3NEQZ53.js → chunk-YFW4H6DL.js} +405 -338
  150. package/{chunk-BNMPUQW6.js → chunk-YGDYYFRX.js} +20 -24
  151. package/{chunk-4N6G2CKP.js → chunk-YHNUDTU4.js} +49 -3
  152. package/chunk-YJPK35HB.js +175 -0
  153. package/{chunk-6OVNSQHN.js → chunk-YLAHYLDQ.js} +5 -0
  154. package/{chunk-AGYPUBFW.js → chunk-Z7KE4K3H.js} +195 -123
  155. package/{chunk-DGYCDA6W.js → chunk-ZM5AZTQG.js} +20 -13
  156. package/{chunk-CBUZ6DKA.js → chunk-ZQ6K57FJ.js} +1 -1
  157. package/{cliAgentConfigHelpers-BTRHMPW2.js → cliAgentConfigHelpers-37ZNEY5Y.js} +9 -9
  158. package/{cliAuthorityBrokerClient-XHH7MH2P.js → cliAuthorityBrokerClient-SFPC3WVK.js} +1 -1
  159. package/{cliLocalAgentRecordReader-M3F76NIP.js → cliLocalAgentRecordReader-MCQVRWBR.js} +59 -47
  160. package/{commandRegistry-ZLWHQVAI.js → commandRegistry-NTH5IAN5.js} +104 -92
  161. package/{contentThunks-4ZX2TO7C.js → contentThunks-SPXTX5U2.js} +38 -36
  162. package/{cooldownCommands-YB5H5BBK.js → cooldownCommands-TIFCHCUN.js} +1 -1
  163. package/{createAgentAutomationAction-L4CYUZJG.js → createAgentAutomationAction-KUQKCOXB.js} +38 -36
  164. package/{createDialogAction-QTU2R2Q3.js → createDialogAction-HJN5U3XS.js} +39 -37
  165. package/{createPageAction-F3GJTHW2.js → createPageAction-ZAHRDOAU.js} +43 -41
  166. package/{db-M7FU2GNK.js → db-CMUTP3W5.js} +2 -2
  167. package/{dbSlice-XRUZOGSU.js → dbSlice-656PMWR2.js} +13 -12
  168. package/{deleteFile-6URDHYRB.js → deleteFile-ZCQESEEQ.js} +10 -7
  169. package/{dialogCommands-NRLCOPJR.js → dialogCommands-KZTZLWPZ.js} +61 -54
  170. package/dialogMessageRecord-OAV77LT7.js +7 -0
  171. package/{dialogNotifyCommand-SHGPCU22.js → dialogNotifyCommand-PST75COP.js} +11 -11
  172. package/{dialogSlice-P2S4LXQD.js → dialogSlice-BXIERQHO.js} +39 -37
  173. package/{dialogUsageCommand-W2WCSGKF.js → dialogUsageCommand-6RW2FY6K.js} +5 -5
  174. package/{docCreateCommands-YJRDA3RX.js → docCreateCommands-26HJ5NAY.js} +55 -47
  175. package/{docDeleteCommands-A5QIHZNF.js → docDeleteCommands-UAOHH5XK.js} +57 -49
  176. package/{docReadCommands-CF2LTMYH.js → docReadCommands-4ADG7YE6.js} +55 -47
  177. package/{docStore-6O7NYL6A.js → docStore-FZ75HWP2.js} +15 -14
  178. package/{docUpdateCommands-QRKV4ZXE.js → docUpdateCommands-OGFJZENF.js} +55 -47
  179. package/fetchMessages-TQEUZD7H.js +1 -1
  180. package/{getPricing-LF5C4XSI.js → getPricing-FCHYVRJU.js} +4 -4
  181. package/{handleSendMessageAction-7IHLR37A.js → handleSendMessageAction-KP6GGBFY.js} +84 -79
  182. package/{hostCredentialCreate-VNCQUAFT.js → hostCredentialCreate-23TX56G7.js} +119 -105
  183. package/index.js +8 -8
  184. package/{lib-OT5OTXRU.js → lib-62SWPXNF.js} +3 -7
  185. package/{localDialogRead-CCOCVGAP.js → localDialogRead-CIOTQM5T.js} +1 -1
  186. package/{localRuntimeAdapter-FOWVNMIK.js → localRuntimeAdapter-MTUWOYPN.js} +126 -111
  187. package/{localRuntimeAuthority-IBJAT62G.js → localRuntimeAuthority-TYHQCTZN.js} +5 -3
  188. package/{localRuntimeDb-N7KHDXS2.js → localRuntimeDb-BO7IVWAZ.js} +1 -1
  189. package/{machineCommands-ZGC3J4JB.js → machineCommands-4WJUJQHW.js} +260 -323
  190. package/{machineWsRunDispatch-KK5U4M3G.js → machineWsRunDispatch-V3U4JM67.js} +115 -102
  191. package/markdownToSlate-KIYM7B3P.js +8 -0
  192. package/mcpLocalAuthorizeCommand-TI656UWC.js +106 -0
  193. package/{memberThunks-7Y3OYSJQ.js → memberThunks-JFYC4Z5L.js} +20 -15
  194. package/{models-H5NNZRLH.js → models-EP7VG6N2.js} +2 -2
  195. package/{overlay-BBQZXGYI.js → overlay-JA3SPVUS.js} +5 -3
  196. package/package.json +1 -1
  197. package/{projectArchive-7ZDYBXAX.js → projectArchive-NU2Z5HOR.js} +45 -43
  198. package/{providerPresetApply-WHAMP2D5.js → providerPresetApply-4H7YP5D7.js} +6 -6
  199. package/{providerRegistry-ZI2KORJ7.js → providerRegistry-F3UPOTIY.js} +6 -6
  200. package/{read-TYMBGEXO.js → read-BRZHXUJ6.js} +9 -8
  201. package/{readDocTool-SKQVHBLO.js → readDocTool-N7RVFQEE.js} +1 -1
  202. package/{readlineWorkspace-YHT4SX2C.js → readlineWorkspace-T56MRMS5.js} +6426 -3669
  203. package/rememberExplicit-CPAPONSI.js +15 -0
  204. package/{removeDialogAgentAction-F5QE2O2B.js → removeDialogAgentAction-J7XU7OUX.js} +19 -18
  205. package/{runAgentClientLoop-H4ED5V3K.js → runAgentClientLoop-O2GRCGRZ.js} +97 -75
  206. package/{runtimeDoctorCommands-RRKPBGVO.js → runtimeDoctorCommands-RDRJXMXC.js} +8 -8
  207. package/{secretCommands-KZWBZIYS.js → secretCommands-2FEMRUFM.js} +3 -3
  208. package/{setDialogExtraReferencesAction-72L27ERM.js → setDialogExtraReferencesAction-Q4V2ZZW2.js} +16 -15
  209. package/{setPrimaryDialogAgentAction-GJJDUSGJ.js → setPrimaryDialogAgentAction-742H5S6T.js} +19 -18
  210. package/{settingThunks-ZRGWVGZD.js → settingThunks-T4FXSV6M.js} +185 -66
  211. package/{skillDiscovery-I37M5KJC.js → skillDiscovery-MDDKPTW3.js} +4 -3
  212. package/{spaceCommands-MEH3HJBC.js → spaceCommands-W5TAVFDT.js} +59 -51
  213. package/{streamAgentChatTurn-ZXPOXU33.js → streamAgentChatTurn-OWDJMU5E.js} +238 -178
  214. package/{switchDialogAgentAction-IIJBPND3.js → switchDialogAgentAction-HLDLHRRA.js} +17 -16
  215. package/{tableCommands-FTAOCBTX.js → tableCommands-44GC4N6J.js} +8 -5
  216. package/{toolApiClient-OGQEBQVX.js → toolApiClient-N5PYW2R3.js} +8 -6
  217. package/{tools-2MRWA2PP.js → tools-O7SGGVA3.js} +67 -62
  218. package/{tuiRestart-2IL37YIB.js → tuiRestart-EOGC2BYY.js} +10 -10
  219. package/{tuiSummaryLlmCaller-W2QN4VAC.js → tuiSummaryLlmCaller-TM5BU73J.js} +16 -15
  220. package/{updateCommands-CPATDG6J.js → updateCommands-FBYA5WVG.js} +3 -3
  221. package/{updateDialogTitleAction-RZ3KZSGQ.js → updateDialogTitleAction-EXSZGTLL.js} +40 -38
  222. package/{usageCommand-2BF74MKF.js → usageCommand-L4OFWXEU.js} +2 -2
  223. package/{usageRebuildCommand-UHB55BQM.js → usageRebuildCommand-7JR33UHS.js} +3 -3
  224. package/webapi-QVV65DQF.js +2487 -0
  225. package/{windowsSelfUpdate-ZFD6J5HF.js → windowsSelfUpdate-M4V77OUB.js} +2 -2
  226. package/workContext-Y3ADAPZU.js +14 -0
  227. package/workContextAccess-VU5I4LKZ.js +11 -0
  228. package/workContextWriteNotice-YCSSMHN4.js +7 -0
  229. package/{workloadLifecycle-HFJIN5IZ.js → workloadLifecycle-ZCSQCHG3.js} +2 -2
  230. package/agentListCommands-GUGMORTK.js +0 -1005
  231. package/agentRecordCommands-SLLADS5C.js +0 -175
  232. package/chunk-2WZXXAQD.js +0 -57
  233. package/chunk-5ZMIIR23.js +0 -265
  234. package/chunk-62HXNQVV.js +0 -134
  235. package/chunk-TUSTONB3.js +0 -81
  236. package/chunk-ZXF6D3I6.js +0 -359
  237. package/{chunk-W6RFEDN4.js → chunk-AETZ7AD6.js} +3 -3
  238. /package/{chunk-FJ23FZXF.js → chunk-VIYVRPMJ.js} +0 -0
@@ -0,0 +1,739 @@
1
+ import {
2
+ assertCredentialRef
3
+ } from "./chunk-E6A5NHDH.js";
4
+ import {
5
+ asTrimmedString
6
+ } from "./chunk-3EUW3WEO.js";
7
+
8
+ // packages/agent-runtime/linuxSecretServiceCredentialBroker.ts
9
+ import { spawn } from "node:child_process";
10
+ var LINUX_SECRET_SERVICE_ATTRIBUTE = "nolo-credential";
11
+ var SECRET_TOOL_NO_MATCH_EXIT = 1;
12
+ var isGenuineNoMatch = (result) => result.exitCode === SECRET_TOOL_NO_MATCH_EXIT && result.stderr.trim() === "";
13
+ var DEFAULT_SECRET_TOOL_BIN = "secret-tool";
14
+ function safeCredentialRef(ref) {
15
+ try {
16
+ return assertCredentialRef(ref);
17
+ } catch {
18
+ throw new Error("invalid_ref");
19
+ }
20
+ }
21
+ function brokerFailure(op) {
22
+ throw new Error(`credential_broker_${op}_failed`);
23
+ }
24
+ function createDefaultSecretToolRunner(secretToolBin = DEFAULT_SECRET_TOOL_BIN) {
25
+ return (input) => new Promise((resolve) => {
26
+ let stdout = "";
27
+ let stderr = "";
28
+ let settled = false;
29
+ const finish = (result) => {
30
+ if (settled) return;
31
+ settled = true;
32
+ resolve(result);
33
+ };
34
+ let child;
35
+ try {
36
+ child = spawn(secretToolBin, input.args, {
37
+ stdio: ["pipe", "pipe", "pipe"]
38
+ });
39
+ } catch {
40
+ finish({ exitCode: -1, stdout: "", stderr: "" });
41
+ return;
42
+ }
43
+ child.stdout?.on("data", (chunk) => {
44
+ stdout += chunk;
45
+ });
46
+ child.stderr?.on("data", (chunk) => {
47
+ stderr += chunk;
48
+ });
49
+ child.on("error", () => {
50
+ finish({ exitCode: -1, stdout: "", stderr: "" });
51
+ });
52
+ child.on("close", (code) => {
53
+ finish({
54
+ exitCode: typeof code === "number" ? code : -1,
55
+ stdout,
56
+ stderr
57
+ });
58
+ });
59
+ if (input.stdin !== void 0) {
60
+ child.stdin?.write(input.stdin);
61
+ }
62
+ child.stdin?.end();
63
+ });
64
+ }
65
+ function createLinuxSecretServiceCredentialBroker(options = {}) {
66
+ const runner = options.runner ?? createDefaultSecretToolRunner(options.secretToolBin);
67
+ const attribute = options.attribute ?? LINUX_SECRET_SERVICE_ATTRIBUTE;
68
+ const attrArgs = (ref) => [attribute, ref];
69
+ const lookup = async (ref) => {
70
+ try {
71
+ return await runner({ args: ["lookup", ...attrArgs(ref)] });
72
+ } catch {
73
+ brokerFailure("get");
74
+ }
75
+ };
76
+ return {
77
+ async get(ref) {
78
+ const safeRef = safeCredentialRef(ref);
79
+ const result = await lookup(safeRef);
80
+ if (isGenuineNoMatch(result)) return null;
81
+ if (result.exitCode !== 0) brokerFailure("get");
82
+ const secret = result.stdout.replace(/\n$/, "");
83
+ return secret.length > 0 ? secret : null;
84
+ },
85
+ async put(ref, secret) {
86
+ const safeRef = safeCredentialRef(ref);
87
+ const value = asTrimmedString(secret);
88
+ if (!value) {
89
+ throw new Error("Cannot store an empty credential secret.");
90
+ }
91
+ const args = [
92
+ "store",
93
+ `--label=nolo-credential:${safeRef}`,
94
+ ...attrArgs(safeRef)
95
+ ];
96
+ if (value.includes("\n") || args.some((arg) => arg.includes(value))) {
97
+ brokerFailure("put");
98
+ }
99
+ let result;
100
+ try {
101
+ result = await runner({ args, stdin: value });
102
+ } catch {
103
+ brokerFailure("put");
104
+ }
105
+ if (result.exitCode !== 0) brokerFailure("put");
106
+ },
107
+ async delete(ref) {
108
+ const safeRef = safeCredentialRef(ref);
109
+ let result;
110
+ try {
111
+ result = await runner({ args: ["clear", ...attrArgs(safeRef)] });
112
+ } catch {
113
+ brokerFailure("delete");
114
+ }
115
+ if (result.exitCode === 0 || isGenuineNoMatch(result)) {
116
+ return;
117
+ }
118
+ brokerFailure("delete");
119
+ },
120
+ async has(ref) {
121
+ const safeRef = safeCredentialRef(ref);
122
+ const result = await lookup(safeRef);
123
+ if (isGenuineNoMatch(result)) return false;
124
+ if (result.exitCode !== 0) brokerFailure("has");
125
+ return true;
126
+ }
127
+ };
128
+ }
129
+
130
+ // packages/agent-runtime/macOsKeychainCredentialBroker.ts
131
+ import { spawn as spawn2 } from "node:child_process";
132
+ var MACOS_KEYCHAIN_SERVICE_PREFIX = "nolo.credentials.keys";
133
+ var MACOS_KEYCHAIN_ACCOUNT = "api-key";
134
+ var SECURITY_ITEM_NOT_FOUND_EXIT = 44;
135
+ var DEFAULT_SECURITY_BIN = "/usr/bin/security";
136
+ function safeCredentialRef2(ref) {
137
+ try {
138
+ return assertCredentialRef(ref);
139
+ } catch {
140
+ throw new Error("invalid_ref");
141
+ }
142
+ }
143
+ function credentialRefToMacOsKeychainService(ref, servicePrefix = MACOS_KEYCHAIN_SERVICE_PREFIX) {
144
+ const safe = safeCredentialRef2(ref);
145
+ const hex = Buffer.from(safe, "utf8").toString("hex");
146
+ if (!hex) {
147
+ throw new Error("invalid_ref");
148
+ }
149
+ return `${servicePrefix}.${hex}`;
150
+ }
151
+ function rethrowBrokerError(op, _error) {
152
+ throw new Error(`credential_broker_${op}_failed`);
153
+ }
154
+ function createDefaultSecurityRunner(securityBin = DEFAULT_SECURITY_BIN) {
155
+ return function defaultSecurityRunner(input) {
156
+ return new Promise((resolve) => {
157
+ let settled = false;
158
+ const finish = (result) => {
159
+ if (settled) return;
160
+ settled = true;
161
+ resolve(result);
162
+ };
163
+ let child;
164
+ try {
165
+ child = spawn2(securityBin, input.args, {
166
+ stdio: ["pipe", "pipe", "pipe"]
167
+ });
168
+ } catch {
169
+ finish({ exitCode: -1, stdout: "", stderr: "" });
170
+ return;
171
+ }
172
+ let stdout = "";
173
+ let stderr = "";
174
+ child.stdout?.setEncoding("utf8");
175
+ child.stderr?.setEncoding("utf8");
176
+ child.stdout?.on("data", (chunk) => {
177
+ stdout += chunk;
178
+ });
179
+ child.stderr?.on("data", (chunk) => {
180
+ stderr += chunk;
181
+ });
182
+ child.on("error", () => {
183
+ finish({ exitCode: -1, stdout: "", stderr: "" });
184
+ });
185
+ child.on("close", (code) => {
186
+ finish({
187
+ exitCode: typeof code === "number" ? code : -1,
188
+ stdout,
189
+ stderr
190
+ });
191
+ });
192
+ if (input.stdin !== void 0) {
193
+ child.stdin?.write(input.stdin);
194
+ }
195
+ child.stdin?.end();
196
+ });
197
+ };
198
+ }
199
+ function createMacOsKeychainCredentialBroker(options = {}) {
200
+ const runner = options.runner ?? createDefaultSecurityRunner(options.securityBin);
201
+ const servicePrefix = options.servicePrefix ?? MACOS_KEYCHAIN_SERVICE_PREFIX;
202
+ const account = options.account ?? MACOS_KEYCHAIN_ACCOUNT;
203
+ const serviceFor = (ref) => credentialRefToMacOsKeychainService(ref, servicePrefix);
204
+ return {
205
+ async get(ref) {
206
+ const safeRef = safeCredentialRef2(ref);
207
+ const service = serviceFor(safeRef);
208
+ let result;
209
+ try {
210
+ result = await runner({
211
+ args: [
212
+ "find-generic-password",
213
+ "-a",
214
+ account,
215
+ "-s",
216
+ service,
217
+ "-w"
218
+ ]
219
+ });
220
+ } catch (error) {
221
+ rethrowBrokerError("get", error);
222
+ }
223
+ if (result.exitCode === SECURITY_ITEM_NOT_FOUND_EXIT) {
224
+ return null;
225
+ }
226
+ if (result.exitCode !== 0) {
227
+ rethrowBrokerError("get");
228
+ }
229
+ const secret = result.stdout.replace(/\n$/, "");
230
+ return secret.length > 0 ? secret : null;
231
+ },
232
+ async put(ref, secret) {
233
+ const safeRef = safeCredentialRef2(ref);
234
+ const value = asTrimmedString(secret);
235
+ if (!value) {
236
+ throw new Error("Cannot store an empty credential secret.");
237
+ }
238
+ const service = serviceFor(safeRef);
239
+ const stdin = `${value}
240
+ ${value}
241
+ `;
242
+ let result;
243
+ try {
244
+ result = await runner({
245
+ args: [
246
+ "add-generic-password",
247
+ "-a",
248
+ account,
249
+ "-s",
250
+ service,
251
+ "-U",
252
+ "-w"
253
+ ],
254
+ stdin
255
+ });
256
+ } catch (error) {
257
+ rethrowBrokerError("put", error);
258
+ }
259
+ if (result.exitCode !== 0) {
260
+ rethrowBrokerError("put");
261
+ }
262
+ },
263
+ async delete(ref) {
264
+ const safeRef = safeCredentialRef2(ref);
265
+ const service = serviceFor(safeRef);
266
+ let result;
267
+ try {
268
+ result = await runner({
269
+ args: [
270
+ "delete-generic-password",
271
+ "-a",
272
+ account,
273
+ "-s",
274
+ service
275
+ ]
276
+ });
277
+ } catch (error) {
278
+ rethrowBrokerError("delete", error);
279
+ }
280
+ if (result.exitCode === 0 || result.exitCode === SECURITY_ITEM_NOT_FOUND_EXIT) {
281
+ return;
282
+ }
283
+ rethrowBrokerError("delete");
284
+ },
285
+ async has(ref) {
286
+ const safeRef = safeCredentialRef2(ref);
287
+ const service = serviceFor(safeRef);
288
+ let result;
289
+ try {
290
+ result = await runner({
291
+ args: [
292
+ "find-generic-password",
293
+ "-a",
294
+ account,
295
+ "-s",
296
+ service
297
+ ]
298
+ });
299
+ } catch (error) {
300
+ rethrowBrokerError("has", error);
301
+ }
302
+ if (result.exitCode === SECURITY_ITEM_NOT_FOUND_EXIT) {
303
+ return false;
304
+ }
305
+ if (result.exitCode !== 0) {
306
+ rethrowBrokerError("has");
307
+ }
308
+ return true;
309
+ }
310
+ };
311
+ }
312
+
313
+ // packages/agent-runtime/windowsCredentialManagerBroker.ts
314
+ import { spawn as spawn3 } from "node:child_process";
315
+ var WINDOWS_CREDENTIAL_TARGET_PREFIX = "nolo.credentials.keys";
316
+ var WIN_ERROR_NOT_FOUND = 1168;
317
+ var WINDOWS_CREDENTIAL_MANAGER_SCRIPT = `
318
+ $ErrorActionPreference = 'Stop'
319
+ try {
320
+ $raw = [Console]::In.ReadToEnd()
321
+ if ([string]::IsNullOrWhiteSpace($raw)) { exit 1 }
322
+ $req = $raw | ConvertFrom-Json
323
+ $op = [string]$req.op
324
+ $target = [string]$req.target
325
+ if ([string]::IsNullOrWhiteSpace($op) -or [string]::IsNullOrWhiteSpace($target)) { exit 1 }
326
+
327
+ Add-Type @"
328
+ using System;
329
+ using System.Runtime.InteropServices;
330
+ using System.Text;
331
+
332
+ public class NoloCredNative {
333
+ public const int CRED_TYPE_GENERIC = 1;
334
+ public const int CRED_PERSIST_LOCAL_MACHINE = 2;
335
+ public const int ERROR_NOT_FOUND = 1168;
336
+
337
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
338
+ public struct CREDENTIAL {
339
+ public int Flags;
340
+ public int Type;
341
+ public string TargetName;
342
+ public string Comment;
343
+ public long LastWritten;
344
+ public int CredentialBlobSize;
345
+ public IntPtr CredentialBlob;
346
+ public int Persist;
347
+ public int AttributeCount;
348
+ public IntPtr Attributes;
349
+ public string TargetAlias;
350
+ public string UserName;
351
+ }
352
+
353
+ [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
354
+ public static extern bool CredWriteW(ref CREDENTIAL userCredential, uint flags);
355
+
356
+ [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
357
+ public static extern bool CredReadW(string target, int type, int reservedFlag, out IntPtr credentialPtr);
358
+
359
+ [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
360
+ public static extern bool CredDeleteW(string target, int type, int flags);
361
+
362
+ [DllImport("advapi32.dll", SetLastError = true)]
363
+ public static extern void CredFree(IntPtr buffer);
364
+ }
365
+ "@
366
+
367
+ if ($op -eq 'get') {
368
+ $ptr = [IntPtr]::Zero
369
+ $ok = [NoloCredNative]::CredReadW($target, [NoloCredNative]::CRED_TYPE_GENERIC, 0, [ref]$ptr)
370
+ if (-not $ok) {
371
+ exit [Runtime.InteropServices.Marshal]::GetLastWin32Error()
372
+ }
373
+ try {
374
+ $cred = [Runtime.InteropServices.Marshal]::PtrToStructure($ptr, [type][NoloCredNative+CREDENTIAL])
375
+ if ($cred.CredentialBlobSize -le 0 -or $cred.CredentialBlob -eq [IntPtr]::Zero) {
376
+ $payload = @{ secret = '' } | ConvertTo-Json -Compress
377
+ [Console]::Out.Write($payload)
378
+ exit 0
379
+ }
380
+ $bytes = New-Object byte[] $cred.CredentialBlobSize
381
+ [Runtime.InteropServices.Marshal]::Copy($cred.CredentialBlob, $bytes, 0, $cred.CredentialBlobSize)
382
+ $secret = [Text.Encoding]::UTF8.GetString($bytes)
383
+ $payload = @{ secret = $secret } | ConvertTo-Json -Compress
384
+ [Console]::Out.Write($payload)
385
+ exit 0
386
+ } finally {
387
+ [NoloCredNative]::CredFree($ptr)
388
+ }
389
+ }
390
+
391
+ if ($op -eq 'has') {
392
+ $ptr = [IntPtr]::Zero
393
+ $ok = [NoloCredNative]::CredReadW($target, [NoloCredNative]::CRED_TYPE_GENERIC, 0, [ref]$ptr)
394
+ if (-not $ok) {
395
+ exit [Runtime.InteropServices.Marshal]::GetLastWin32Error()
396
+ }
397
+ [NoloCredNative]::CredFree($ptr)
398
+ exit 0
399
+ }
400
+
401
+ if ($op -eq 'put') {
402
+ $secret = [string]$req.secret
403
+ if ([string]::IsNullOrEmpty($secret)) { exit 1 }
404
+ $blob = [Text.Encoding]::UTF8.GetBytes($secret)
405
+ $cred = New-Object NoloCredNative+CREDENTIAL
406
+ $cred.Type = [NoloCredNative]::CRED_TYPE_GENERIC
407
+ $cred.TargetName = $target
408
+ $cred.UserName = 'api-key'
409
+ $cred.Persist = [NoloCredNative]::CRED_PERSIST_LOCAL_MACHINE
410
+ $cred.CredentialBlobSize = $blob.Length
411
+ $cred.CredentialBlob = [Runtime.InteropServices.Marshal]::AllocHGlobal($blob.Length)
412
+ try {
413
+ if ($blob.Length -gt 0) {
414
+ [Runtime.InteropServices.Marshal]::Copy($blob, 0, $cred.CredentialBlob, $blob.Length)
415
+ }
416
+ $ok = [NoloCredNative]::CredWriteW([ref]$cred, 0)
417
+ if (-not $ok) {
418
+ exit [Runtime.InteropServices.Marshal]::GetLastWin32Error()
419
+ }
420
+ exit 0
421
+ } finally {
422
+ [Runtime.InteropServices.Marshal]::FreeHGlobal($cred.CredentialBlob)
423
+ }
424
+ }
425
+
426
+ if ($op -eq 'delete') {
427
+ $ok = [NoloCredNative]::CredDeleteW($target, [NoloCredNative]::CRED_TYPE_GENERIC, 0)
428
+ if (-not $ok) {
429
+ exit [Runtime.InteropServices.Marshal]::GetLastWin32Error()
430
+ }
431
+ exit 0
432
+ }
433
+
434
+ exit 1
435
+ } catch {
436
+ exit 1
437
+ }
438
+ `.trim();
439
+ function safeCredentialRef3(ref) {
440
+ try {
441
+ return assertCredentialRef(ref);
442
+ } catch {
443
+ throw new Error("invalid_ref");
444
+ }
445
+ }
446
+ function credentialRefToWindowsCredentialTarget(ref, targetPrefix = WINDOWS_CREDENTIAL_TARGET_PREFIX) {
447
+ const safe = safeCredentialRef3(ref);
448
+ const hex = Buffer.from(safe, "utf8").toString("hex");
449
+ if (!hex) {
450
+ throw new Error("invalid_ref");
451
+ }
452
+ return `${targetPrefix}.${hex}`;
453
+ }
454
+ function rethrowBrokerError2(op, _error) {
455
+ throw new Error(`credential_broker_${op}_failed`);
456
+ }
457
+ function buildWindowsCredentialPowerShellArgs(script = WINDOWS_CREDENTIAL_MANAGER_SCRIPT) {
458
+ const encoded = Buffer.from(script, "utf16le").toString("base64");
459
+ return [
460
+ "-NoProfile",
461
+ "-NonInteractive",
462
+ "-ExecutionPolicy",
463
+ "Bypass",
464
+ "-EncodedCommand",
465
+ encoded
466
+ ];
467
+ }
468
+ function requestStdin(payload) {
469
+ return JSON.stringify(payload);
470
+ }
471
+ function parseGetSecretFromStdout(stdout) {
472
+ const trimmed = asTrimmedString(stdout);
473
+ if (!trimmed) {
474
+ rethrowBrokerError2("get");
475
+ }
476
+ let parsed;
477
+ try {
478
+ parsed = JSON.parse(trimmed);
479
+ } catch {
480
+ rethrowBrokerError2("get");
481
+ }
482
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed) || typeof parsed.secret !== "string") {
483
+ rethrowBrokerError2("get");
484
+ }
485
+ return parsed.secret;
486
+ }
487
+ function spawnShell(bin, args, stdin) {
488
+ return new Promise((resolve) => {
489
+ let settled = false;
490
+ const finish = (result) => {
491
+ if (settled) return;
492
+ settled = true;
493
+ resolve(result);
494
+ };
495
+ let child;
496
+ try {
497
+ child = spawn3(bin, args, {
498
+ stdio: ["pipe", "pipe", "pipe"],
499
+ windowsHide: true
500
+ });
501
+ } catch {
502
+ finish({ exitCode: -1, stdout: "", stderr: "" });
503
+ return;
504
+ }
505
+ let stdout = "";
506
+ let stderr = "";
507
+ child.stdout?.setEncoding("utf8");
508
+ child.stderr?.setEncoding("utf8");
509
+ child.stdout?.on("data", (chunk) => {
510
+ stdout += chunk;
511
+ });
512
+ child.stderr?.on("data", (chunk) => {
513
+ stderr += chunk;
514
+ });
515
+ child.on("error", () => {
516
+ finish({ exitCode: -1, stdout: "", stderr: "" });
517
+ });
518
+ child.on("close", (code) => {
519
+ finish({
520
+ exitCode: typeof code === "number" ? code : -1,
521
+ stdout,
522
+ stderr
523
+ });
524
+ });
525
+ if (stdin !== void 0) {
526
+ child.stdin?.write(stdin);
527
+ }
528
+ child.stdin?.end();
529
+ });
530
+ }
531
+ function createDefaultWindowsCredentialRunner(shellBin) {
532
+ let resolvedBin = shellBin ?? null;
533
+ return async function defaultWindowsCredentialRunner(input) {
534
+ if (resolvedBin) {
535
+ return spawnShell(resolvedBin, input.args, input.stdin);
536
+ }
537
+ const first = await spawnShell("powershell.exe", input.args, input.stdin);
538
+ if (first.exitCode !== -1) {
539
+ resolvedBin = "powershell.exe";
540
+ return first;
541
+ }
542
+ const second = await spawnShell("pwsh", input.args, input.stdin);
543
+ if (second.exitCode !== -1) {
544
+ resolvedBin = "pwsh";
545
+ }
546
+ return second;
547
+ };
548
+ }
549
+ function createWindowsCredentialManagerBroker(options = {}) {
550
+ const runner = options.runner ?? createDefaultWindowsCredentialRunner(options.shellBin);
551
+ const targetPrefix = options.targetPrefix ?? WINDOWS_CREDENTIAL_TARGET_PREFIX;
552
+ const targetFor = (ref) => credentialRefToWindowsCredentialTarget(ref, targetPrefix);
553
+ const staticArgs = buildWindowsCredentialPowerShellArgs();
554
+ return {
555
+ async get(ref) {
556
+ const safeRef = safeCredentialRef3(ref);
557
+ const target = targetFor(safeRef);
558
+ let result;
559
+ try {
560
+ result = await runner({
561
+ args: staticArgs,
562
+ stdin: requestStdin({ op: "get", target })
563
+ });
564
+ } catch (error) {
565
+ rethrowBrokerError2("get", error);
566
+ }
567
+ if (result.exitCode === WIN_ERROR_NOT_FOUND) {
568
+ return null;
569
+ }
570
+ if (result.exitCode !== 0) {
571
+ rethrowBrokerError2("get");
572
+ }
573
+ const secret = parseGetSecretFromStdout(result.stdout);
574
+ return secret.length > 0 ? secret : null;
575
+ },
576
+ async put(ref, secret) {
577
+ const safeRef = safeCredentialRef3(ref);
578
+ const value = asTrimmedString(secret);
579
+ if (!value) {
580
+ throw new Error("Cannot store an empty credential secret.");
581
+ }
582
+ const target = targetFor(safeRef);
583
+ let result;
584
+ try {
585
+ result = await runner({
586
+ args: staticArgs,
587
+ stdin: requestStdin({ op: "put", target, secret: value })
588
+ });
589
+ } catch (error) {
590
+ rethrowBrokerError2("put", error);
591
+ }
592
+ if (result.exitCode !== 0) {
593
+ rethrowBrokerError2("put");
594
+ }
595
+ },
596
+ async delete(ref) {
597
+ const safeRef = safeCredentialRef3(ref);
598
+ const target = targetFor(safeRef);
599
+ let result;
600
+ try {
601
+ result = await runner({
602
+ args: staticArgs,
603
+ stdin: requestStdin({ op: "delete", target })
604
+ });
605
+ } catch (error) {
606
+ rethrowBrokerError2("delete", error);
607
+ }
608
+ if (result.exitCode === 0 || result.exitCode === WIN_ERROR_NOT_FOUND) {
609
+ return;
610
+ }
611
+ rethrowBrokerError2("delete");
612
+ },
613
+ async has(ref) {
614
+ const safeRef = safeCredentialRef3(ref);
615
+ const target = targetFor(safeRef);
616
+ let result;
617
+ try {
618
+ result = await runner({
619
+ args: staticArgs,
620
+ stdin: requestStdin({ op: "has", target })
621
+ });
622
+ } catch (error) {
623
+ rethrowBrokerError2("has", error);
624
+ }
625
+ if (result.exitCode === WIN_ERROR_NOT_FOUND) {
626
+ return false;
627
+ }
628
+ if (result.exitCode !== 0) {
629
+ rethrowBrokerError2("has");
630
+ }
631
+ return true;
632
+ }
633
+ };
634
+ }
635
+
636
+ // packages/agent-runtime/desktopHostCredentialBroker.ts
637
+ function createClosedCredentialBroker(code = "credential_store_unavailable") {
638
+ const fail = () => {
639
+ throw new Error(code);
640
+ };
641
+ return {
642
+ get: fail,
643
+ put: fail,
644
+ delete: fail,
645
+ has: () => false
646
+ };
647
+ }
648
+ function createHostCredentialBrokerChain(args) {
649
+ const { strict, session, legacy, notifySessionFallback, notifyLegacyHit } = args;
650
+ const legacyNoticed = /* @__PURE__ */ new Set();
651
+ let sessionNotified = false;
652
+ const noticeSession = () => {
653
+ if (sessionNotified || !notifySessionFallback) return;
654
+ sessionNotified = true;
655
+ try {
656
+ notifySessionFallback();
657
+ } catch {
658
+ }
659
+ };
660
+ return {
661
+ async get(ref) {
662
+ try {
663
+ const strictValue = await strict.get(ref);
664
+ if (strictValue !== null && strictValue !== void 0) return strictValue;
665
+ } catch {
666
+ }
667
+ const sessionValue = await session.get(ref);
668
+ if (sessionValue !== null && sessionValue !== void 0) return sessionValue;
669
+ if (!legacy) return null;
670
+ const legacyValue = await legacy.get(ref);
671
+ if (legacyValue !== null && legacyValue !== void 0) {
672
+ if (notifyLegacyHit && !legacyNoticed.has(ref)) {
673
+ legacyNoticed.add(ref);
674
+ try {
675
+ notifyLegacyHit(ref);
676
+ } catch {
677
+ }
678
+ }
679
+ return legacyValue;
680
+ }
681
+ return null;
682
+ },
683
+ async put(ref, secret) {
684
+ try {
685
+ await strict.put(ref, secret);
686
+ if (await strict.has(ref)) return;
687
+ } catch {
688
+ }
689
+ await session.put(ref, secret);
690
+ noticeSession();
691
+ },
692
+ async delete(ref) {
693
+ try {
694
+ await strict.delete(ref);
695
+ } catch {
696
+ }
697
+ try {
698
+ await session.delete(ref);
699
+ } catch {
700
+ }
701
+ if (legacy) await legacy.delete(ref);
702
+ },
703
+ async has(ref) {
704
+ try {
705
+ if (await strict.has(ref)) return true;
706
+ } catch {
707
+ }
708
+ if (await session.has(ref)) return true;
709
+ return legacy ? await legacy.has(ref) : false;
710
+ }
711
+ };
712
+ }
713
+ function createStrictHostCredentialBroker(options = {}) {
714
+ const platform = options.platform ?? process.platform;
715
+ const env = options.env ?? process.env;
716
+ const override = String(env.NOLO_DESKTOP_CREDENTIAL_STORE ?? "").trim().toLowerCase();
717
+ if (override === "file") {
718
+ return createClosedCredentialBroker("credential_store_file_not_allowed");
719
+ }
720
+ if (platform === "darwin" || override === "keychain") return createSystemStoreBroker("keychain", options);
721
+ if (platform === "win32" || override === "credman") return createSystemStoreBroker("credman", options);
722
+ if (platform === "linux" || override === "secret-service") return createSystemStoreBroker("secret-service", options);
723
+ return createClosedCredentialBroker("credential_store_unsupported");
724
+ }
725
+ function createSystemStoreBroker(mode, options) {
726
+ switch (mode) {
727
+ case "keychain":
728
+ return options.keychainBroker ?? options.createKeychainBroker?.() ?? createMacOsKeychainCredentialBroker();
729
+ case "credman":
730
+ return options.windowsCredentialBroker ?? options.createWindowsCredentialBroker?.() ?? createWindowsCredentialManagerBroker();
731
+ case "secret-service":
732
+ return options.linuxSecretServiceBroker ?? options.createLinuxSecretServiceBroker?.() ?? createLinuxSecretServiceCredentialBroker();
733
+ }
734
+ }
735
+
736
+ export {
737
+ createHostCredentialBrokerChain,
738
+ createStrictHostCredentialBroker
739
+ };