@readmagic/workmate 0.0.22 → 0.0.24

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 (395) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DWgTWJ7R.js → AddWorkspaceDirectory-Ch8IcWXO.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-Cyia0s4g.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-s0Orgord.js → AgentsMdExternalIncludesDialog-LjI_H_Au.js} +1 -1
  4. package/dist/chunks/App-BOqh_1tN.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-CSEuuoq9.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-D2Gesf-u.js → BypassPermissionsModeDialog-CwfCwUr9.js} +1 -1
  7. package/dist/chunks/CustomSelect-wmZ9jz0W.js +1 -0
  8. package/dist/chunks/{DiffDialog-v2IiYyi3.js → DiffDialog-BpXIEWiE.js} +5 -5
  9. package/dist/chunks/Doctor-CMpr7tdf.js +1 -0
  10. package/dist/chunks/Doctor-DqW6j3_B.js +3 -0
  11. package/dist/chunks/{ExitFlow-BasHk1mk.js → ExitFlow-DacaBTlk.js} +2 -2
  12. package/dist/chunks/Grove-CNqYPWI6.js +11 -0
  13. package/dist/chunks/{InvalidConfigDialog-DYVQK5js.js → InvalidConfigDialog-0TMJItCC.js} +1 -1
  14. package/dist/chunks/{InvalidSettingsDialog-Dg6OiStR.js → InvalidSettingsDialog-iwh8H52b.js} +1 -1
  15. package/dist/chunks/{KeybindingProviderSetup-Bn1jzN5F.js → KeybindingProviderSetup-D49HHTXD.js} +1 -1
  16. package/dist/chunks/MCPConnectionManager-Cie77ZAK.js +1 -0
  17. package/dist/chunks/MCPToolListView-B4ehtkXd.js +1 -0
  18. package/dist/chunks/{McpParsingWarnings-DZejAh8b.js → McpParsingWarnings-Bff66RtJ.js} +1 -1
  19. package/dist/chunks/MessageSelector-Dpd6Iywp.js +3 -0
  20. package/dist/chunks/Messages-DN7M3oS_.js +10 -0
  21. package/dist/chunks/Onboarding-CQmE3rUf.js +1 -0
  22. package/dist/chunks/{PromptInputFooterSuggestions-lkr_A5jQ.js → PromptInputFooterSuggestions-HI6HH3TP.js} +1 -1
  23. package/dist/chunks/{PromptInputHelpMenu-DaQKKyM5.js → PromptInputHelpMenu-3QNUC2Cg.js} +1 -1
  24. package/dist/chunks/ProviderSetup-BCSPsvfv.js +1 -0
  25. package/dist/chunks/QueryEngine-DdLWvJv6.js +1 -0
  26. package/dist/chunks/REPL-BqO9KcK_.js +124 -0
  27. package/dist/chunks/REPL-CmZmypfF.js +1 -0
  28. package/dist/chunks/ResumeConversation-DBqX7gva.js +1 -0
  29. package/dist/chunks/SearchExtraToolsTool-BsSoILFj.js +1 -0
  30. package/dist/chunks/{SelectMulti-CNE06VAN.js → SelectMulti-BQRHed-d.js} +1 -1
  31. package/dist/chunks/Settings-B-7yBewS.js +3 -0
  32. package/dist/chunks/Spinner-ByQXTvAA.js +1 -0
  33. package/dist/chunks/{SpinnerGlyph-A6G-gloN.js → SpinnerGlyph-CmkRUvHe.js} +1 -1
  34. package/dist/chunks/{TextInput-7uqPhq9T.js → TextInput-B8ruWRf2.js} +5 -5
  35. package/dist/chunks/{ThemePicker-DT9zVy-0.js → ThemePicker-BQErFFW1.js} +1 -1
  36. package/dist/chunks/TrustDialog-BIhz6AZE.js +1 -0
  37. package/dist/chunks/{ValidationErrorsList-BLtP647v.js → ValidationErrorsList-DgNzJQUP.js} +1 -1
  38. package/dist/chunks/_baseEach-CsIRoaTH.js +1 -0
  39. package/dist/chunks/add-dir-CrUDs19x.js +1 -0
  40. package/dist/chunks/{agentDisplay-vLQHFrmq.js → agentDisplay-M4pfwbMC.js} +1 -1
  41. package/dist/chunks/agents-CGaCQeLw.js +101 -0
  42. package/dist/chunks/{agents-DLz0kfsr.js → agents-DddX7lLX.js} +1 -1
  43. package/dist/chunks/allErrors-BF73lon8.js +1 -0
  44. package/dist/chunks/{appleTerminalBackup-BYKdf3of.js → appleTerminalBackup-BArZWB21.js} +1 -1
  45. package/dist/chunks/backgroundHousekeeping-Bq3LMsVR.js +17 -0
  46. package/dist/chunks/backgroundHousekeeping-Cl3Ox7Qh.js +1 -0
  47. package/dist/chunks/banner-Cu2-XUek.js +2 -0
  48. package/dist/chunks/{bedrockClient-DxE_mHFI.js → bedrockClient-CfiDN-kF.js} +2 -2
  49. package/dist/chunks/branch-Yg_taNlT.js +2 -0
  50. package/dist/chunks/{break-cache-BL2gnDLX.js → break-cache-BMXqFTeS.js} +2 -2
  51. package/dist/chunks/btw-udbprVvu.js +1 -0
  52. package/dist/chunks/caches-ChjIEcdd.js +1 -0
  53. package/dist/chunks/caches-DLJ6urv-.js +1 -0
  54. package/dist/chunks/{claudeDesktop-D3PEgx3U.js → claudeDesktop-D8ml2767.js} +1 -1
  55. package/dist/chunks/{clear-CXfhVRp8.js → clear-B8ZtFPOK.js} +1 -1
  56. package/dist/chunks/{client-DdenNfkQ.js → client-4iqhC8xq.js} +1 -1
  57. package/dist/chunks/client-BiqbIkwr.js +1 -0
  58. package/dist/chunks/client-CZ8nyVh5.js +1 -0
  59. package/dist/chunks/{client-DvhWKIOx.js → client-CpTCeWba.js} +1 -1
  60. package/dist/chunks/commands-CVCpJo7M.js +1 -0
  61. package/dist/chunks/compact-izk6RKHQ.js +2 -0
  62. package/dist/chunks/config-C-Y2qtB2.js +3 -0
  63. package/dist/chunks/config-CFqpXMFX.js +1 -0
  64. package/dist/chunks/config-DD8fCYXn.js +1 -0
  65. package/dist/chunks/{context-3s9wtn4L.js → context-BbVm4SWK.js} +1 -1
  66. package/dist/chunks/{context-noninteractive-CJhUu_4y.js → context-noninteractive-C7wrRZnM.js} +5 -5
  67. package/dist/chunks/context-noninteractive-x0HAzWhc.js +1 -0
  68. package/dist/chunks/conversation-DouVzO0K.js +1 -0
  69. package/dist/chunks/conversation-DrVkifKy.js +1 -0
  70. package/dist/chunks/conversationRecovery-DliPBo_z.js +1 -0
  71. package/dist/chunks/crossProjectResume-DxMy05_P.js +40 -0
  72. package/dist/chunks/cwd-Dc3NV7s8.js +1 -0
  73. package/dist/chunks/cwd-Pa83R95t.js +1 -0
  74. package/dist/chunks/{datadog-v_mXWncN.js → datadog-Cu3s7P48.js} +1 -1
  75. package/dist/chunks/{debug-8DCufdSp.js → debug-Bglx1aTu.js} +5 -5
  76. package/dist/chunks/{detectRepository-DfX8xXw2.js → detectRepository-CfX8Lc0A.js} +1 -1
  77. package/dist/chunks/{diff-DJSt7QO6.js → diff-DdpHThJ7.js} +1 -1
  78. package/dist/chunks/{directoryCompletion-CT6YVeg7.js → directoryCompletion-D_Rtg-4j.js} +1 -1
  79. package/dist/chunks/dist-es-B3-7VFf2.js +1 -0
  80. package/dist/chunks/dist-es-B7j_mv242.js +1 -0
  81. package/dist/chunks/dist-es-BSKD_hOQ.js +1 -0
  82. package/dist/chunks/dist-es-BSRN-2nA.js +9 -0
  83. package/dist/chunks/{dist-es-yHGBqhBe.js → dist-es-BXXmyhQ2.js} +1 -1
  84. package/dist/chunks/{dist-es-C3reqy7X.js → dist-es-BaQndfvh2.js} +1 -1
  85. package/dist/chunks/dist-es-CzTYn7xo.js +1 -0
  86. package/dist/chunks/dist-es-DSkyibcN.js +1 -0
  87. package/dist/chunks/{dist-es-BOPBJQo3.js → dist-es-_UNJQniz.js} +1 -1
  88. package/dist/chunks/dist-es-hwK6468D.js +1 -0
  89. package/dist/chunks/dist-es-ovsdbtwh.js +1 -0
  90. package/dist/chunks/doctor-D_kV_D_l.js +1 -0
  91. package/dist/chunks/{entry-ex0-RyYV.js → entry-Bxseqbi_.js} +4 -4
  92. package/dist/chunks/{envUtils-DcaKZlRU.js → envUtils-DfkgIdYf.js} +1 -1
  93. package/dist/chunks/esm-BXTZz3av.js +1 -0
  94. package/dist/chunks/{execFileNoThrow-BsfuytkN.js → execFileNoThrow-BTachNBI.js} +1 -1
  95. package/dist/chunks/exit-C_R_FgzR.js +1 -0
  96. package/dist/chunks/extraUsage-xMuDiNKh.js +1 -0
  97. package/dist/chunks/extractMemories-D4Dl1itt.js +1 -0
  98. package/dist/chunks/fast-DH-C5IZs.js +1 -0
  99. package/dist/chunks/fast-bopOPrtf.js +1 -0
  100. package/dist/chunks/fetchModelList-DC4VQpqa.js +1 -0
  101. package/dist/chunks/fetchModelList-FE8tzTDc.js +1 -0
  102. package/dist/chunks/{fileSuggestions-B-SLfb-o.js → fileSuggestions-C-9unnoJ.js} +2 -2
  103. package/dist/chunks/firstPartyEventLogger-QmjjQmgt.js +3 -0
  104. package/dist/chunks/firstPartyEventLogger-lFeqhtfh.js +1 -0
  105. package/dist/chunks/{gemini-BC9kHhwe.js → gemini-C_ApXgwc.js} +2 -2
  106. package/dist/chunks/generateSessionName-CQ03xlYI.js +1 -0
  107. package/dist/chunks/{genericProcessUtils-BYi0OefF.js → genericProcessUtils-DwQFuna9.js} +1 -1
  108. package/dist/chunks/goal-CdL29Y8C.js +3 -0
  109. package/dist/chunks/grok-C6WAslUT.js +1 -0
  110. package/dist/chunks/grove-O6qp7ITR.js +1 -0
  111. package/dist/chunks/{help-CK90i4hE.js → help-DxanITNN.js} +1 -1
  112. package/dist/chunks/history-BMycjPTT.js +1 -0
  113. package/dist/chunks/hooks-D9ApLkBp.js +1 -0
  114. package/dist/chunks/{hooks-BRFDg9DV.js → hooks-DR3IYPJ3.js} +3 -3
  115. package/dist/chunks/{install-ZMll-dAa.js → install-0D9u2dZw.js} +1 -1
  116. package/dist/chunks/instrumentation-BFiGwntt.js +21 -0
  117. package/dist/chunks/{job-G_ukhLc4.js → job-YhJQWgE0.js} +1 -1
  118. package/dist/chunks/keybindings-DZrF9iNd.js +1 -0
  119. package/dist/chunks/{launchLocalMemory-BcRlXLm6.js → launchLocalMemory-DhJ56KDc.js} +2 -2
  120. package/dist/chunks/launchOnboarding-DmMoZwv5.js +8 -0
  121. package/dist/chunks/{loadAgentsDir-C1LkW7gl.js → loadAgentsDir-B0Anodo0.js} +540 -543
  122. package/dist/chunks/loadAgentsDir-BbUR6pqH.js +1 -0
  123. package/dist/chunks/loadPluginHooks-BSwCtQ6T.js +1 -0
  124. package/dist/chunks/{loader-C61fB6vU.js → loader-CICGtLp2.js} +1 -1
  125. package/dist/chunks/{localSearch-DFo_WTMm.js → localSearch-BxLYi6w_.js} +1 -1
  126. package/dist/chunks/localSearch-zfn7jgrh.js +1 -0
  127. package/dist/chunks/{log-DaILwWJa.js → log-D2TIwHBV.js} +1 -1
  128. package/dist/chunks/logoUtils-CRxTutvr.js +1 -0
  129. package/dist/chunks/{magicDocs-DYc9TFmI.js → magicDocs-Bkz7ZcmL.js} +3 -3
  130. package/dist/chunks/main-9ksgUUY_.js +345 -0
  131. package/dist/chunks/managedEnv-BEqrGqn1.js +1 -0
  132. package/dist/chunks/managedEnv-OPlzUPbJ.js +1 -0
  133. package/dist/chunks/mcp-ChF12reQ.js +1 -0
  134. package/dist/chunks/mcp-DoEl5uah.js +2 -0
  135. package/dist/chunks/mcp-hp9qqjAy.js +6 -0
  136. package/dist/chunks/memory-Qv-wGNQ5.js +1 -0
  137. package/dist/chunks/{mode-Pan-Q2c4.js → mode-bFXPCR2P.js} +2 -2
  138. package/dist/chunks/model-6lkW4o2c.js +1 -0
  139. package/dist/chunks/model-BvQFFOf8.js +1 -0
  140. package/dist/chunks/modelOptions-BBvF3wHK.js +1 -0
  141. package/dist/chunks/nativeInstaller-CdjmE9Zy.js +1 -0
  142. package/dist/chunks/notifications-Bc6k-Ozy.js +1 -0
  143. package/dist/chunks/onChangeAppState-DLjZ1x95.js +1 -0
  144. package/dist/chunks/openai-D46QvESE.js +2 -0
  145. package/dist/chunks/{overlayContext-CMV7nYR9.js → overlayContext-8--_fbvY.js} +1 -1
  146. package/dist/chunks/{panel-D9fGQgln.js → panel-CVS4SK_E.js} +1 -1
  147. package/dist/chunks/parser-CG5RuOCK.js +1 -0
  148. package/dist/chunks/{parser-D8slvrJP.js → parser-Cg6hSCmn.js} +1 -1
  149. package/dist/chunks/partition-DznN4XZH.js +1 -0
  150. package/dist/chunks/{pasteStore-DNV1M5Xd.js → pasteStore-P0zP-ch0.js} +1 -1
  151. package/dist/chunks/permissions-DmGFViHI.js +3 -0
  152. package/dist/chunks/pidLock-Cm4sW35f.js +3 -0
  153. package/dist/chunks/{plan-CQLnPLuE.js → plan-CzGBz_87.js} +1 -1
  154. package/dist/chunks/{platform-Dzff1WWw.js → platform-BacQ6ACS.js} +1 -1
  155. package/dist/chunks/plugin-CluR79xX.js +17 -0
  156. package/dist/chunks/{pluginAutoupdate-BJaAqwTH.js → pluginAutoupdate-ennb9k8_.js} +1 -1
  157. package/dist/chunks/pluginBlocklist-9OrNEh--.js +1 -0
  158. package/dist/chunks/pluginCliCommands-CJv5uhOG.js +1 -0
  159. package/dist/chunks/{pluginFlagging-DQP8tBi2.js → pluginFlagging-js_-WmYj.js} +1 -1
  160. package/dist/chunks/pluginOperations-CcUSHAIa.js +2 -0
  161. package/dist/chunks/pluginStartupCheck-CRBUO9gP.js +1 -0
  162. package/dist/chunks/{pluginStartupCheck-CfRvCrFg.js → pluginStartupCheck-SRXOyqr7.js} +1 -1
  163. package/dist/chunks/plugins-IwwaCDba.js +4 -0
  164. package/dist/chunks/{poorMode-J5SYJvoY.js → poorMode-B0QGV6Ci.js} +1 -1
  165. package/dist/chunks/poorMode-G-pnu6NM.js +1 -0
  166. package/dist/chunks/print-CgszM1ea.js +13 -0
  167. package/dist/chunks/processBashCommand-D098WsqY.js +1 -0
  168. package/dist/chunks/processSlashCommand-DOQFjJ88.js +5 -0
  169. package/dist/chunks/{projectContext-Bw3o5BrN.js → projectContext-5fmRr6Sd.js} +1 -1
  170. package/dist/chunks/{projectContext-BN2ZWzOG.js → projectContext-DhtjLv3k.js} +1 -1
  171. package/dist/chunks/{projectOnboardingState-CJycxw5P.js → projectOnboardingState-B5YATuc6.js} +1 -1
  172. package/dist/chunks/prompt-BKPmDAuL.js +1 -0
  173. package/dist/chunks/{prompt-BGqgPgCU.js → prompt-CJ1l3XXk.js} +1 -1
  174. package/dist/chunks/prompt-CgOklk7z.js +1 -0
  175. package/dist/chunks/{promptEditor-CmQ9p4oe.js → promptEditor-DoGHJN_W.js} +1 -1
  176. package/dist/chunks/{protocolHandler-CJo9-PfZ.js → protocolHandler-DjQALaU2.js} +1 -1
  177. package/dist/chunks/{proxy-CB17QimU.js → proxy-CDBfZjO7.js} +2 -2
  178. package/dist/chunks/reconciler-ykkSPR-i.js +1 -0
  179. package/dist/chunks/refresh-Dn_I1R4v.js +1 -0
  180. package/dist/chunks/{registerProtocol-CLIpzVwF.js → registerProtocol-CAsDme_E.js} +1 -1
  181. package/dist/chunks/reject-DtcCfuZV.js +1 -0
  182. package/dist/chunks/{reload-plugins-DjugL8jH.js → reload-plugins-CQZFQLWP.js} +1 -1
  183. package/dist/chunks/rename-DyEfsZiq.js +1 -0
  184. package/dist/chunks/{renderOptions-Zqfm2U1y.js → renderOptions-DV0dn0IW.js} +1 -1
  185. package/dist/chunks/resume-BcXEDUqZ.js +2 -0
  186. package/dist/chunks/ripgrep-DLs8MraF.js +1 -0
  187. package/dist/chunks/{ripgrep-BuzOTf1S.js → ripgrep-Dl3y5r4m.js} +1 -1
  188. package/dist/chunks/{runtimeObserver-CK_iZ6OB.js → runtimeObserver-DEuR8z0f.js} +1 -1
  189. package/dist/chunks/{runtimeObserver-CpP0L9T9.js → runtimeObserver-PJ1o8GRA.js} +4 -4
  190. package/dist/chunks/sandbox-adapter-DfB9kgQD.js +1 -0
  191. package/dist/chunks/{sandbox-toggle-KOHYvbQT.js → sandbox-toggle-D9GDUsTl.js} +1 -1
  192. package/dist/chunks/searchExtraTools-D4gMMQv0.js +1 -0
  193. package/dist/chunks/{select-C_KXmqbI.js → select-DIxfl_VN.js} +1 -1
  194. package/dist/chunks/sessionFileAccessHooks-lbgHnVvi.js +1 -0
  195. package/dist/chunks/{sessionObserver-WOYv2n7C.js → sessionObserver-BtKjvteq.js} +2 -2
  196. package/dist/chunks/sessionObserver-D6qzEdGJ.js +1 -0
  197. package/dist/chunks/sessionStorage-C_7gow_z.js +1 -0
  198. package/dist/chunks/sessionTracing-CtbeAD0s.js +11 -0
  199. package/dist/chunks/settings-B2jvL8Dp.js +24 -0
  200. package/dist/chunks/settings-CisDe8DB.js +1 -0
  201. package/dist/chunks/setup-qecdf-ES.js +3 -0
  202. package/dist/chunks/{shadowedRuleDetection-Df-kZ_pK.js → shadowedRuleDetection-Bg_aIc5Z.js} +1 -1
  203. package/dist/chunks/{sideQuestion-CMB8hfgX.js → sideQuestion-D49GsfH7.js} +3 -3
  204. package/dist/chunks/sinks-C-lP7uyO.js +1 -0
  205. package/dist/chunks/sinks-De-B1lPQ.js +1 -0
  206. package/dist/chunks/skillChangeDetector-DkOJoNhT.js +1 -0
  207. package/dist/chunks/{skillGapStore-CfmlO6pb.js → skillGapStore-CcFoHNLl.js} +2 -2
  208. package/dist/chunks/{skillLifecycle-BQ2LMfMx.js → skillLifecycle-Bnz_4wE5.js} +2 -2
  209. package/dist/chunks/{skillSearchPanel-BwYuwLFs.js → skillSearchPanel-C_5yUhqn.js} +2 -2
  210. package/dist/chunks/{skills-BVHPQma0.js → skills-BE5scC-g.js} +1 -1
  211. package/dist/chunks/startupProfiler-BH0FoI66.js +1 -0
  212. package/dist/chunks/{startupProfiler-DTs9w9EN.js → startupProfiler-CJdr3SxP.js} +2 -2
  213. package/dist/chunks/state-B4jiUise.js +1 -0
  214. package/dist/chunks/state-BhOKSFi5.js +1 -0
  215. package/dist/chunks/status-Dw09WZLd.js +1 -0
  216. package/dist/chunks/statusNoticeHelpers-BRQpUIlH.js +1 -0
  217. package/dist/chunks/{stringUtils-BQm3OfeJ.js → stringUtils-C718f5ey.js} +1 -1
  218. package/dist/chunks/sts-ei3CGBNu.js +1 -0
  219. package/dist/chunks/switcher-CgZVah7U.js +1 -0
  220. package/dist/chunks/{switcher-Bq1Ct_Sn.js → switcher-DZwUo5Ed.js} +1 -1
  221. package/dist/chunks/{tasks-0c8Uy04D.js → tasks-DdcUQEeD.js} +1 -1
  222. package/dist/chunks/{templateJobs-BdFzE9XG.js → templateJobs-C8qsPrLj.js} +1 -1
  223. package/dist/chunks/{terminalSetup-Cf_r6pwK.js → terminalSetup-B_10N_gE.js} +3 -3
  224. package/dist/chunks/{terminalSetup-D7J6bxcn.js → terminalSetup-qc2PlvOm.js} +1 -1
  225. package/dist/chunks/{theme-Bby4fssR.js → theme-f1h2QI8J.js} +1 -1
  226. package/dist/chunks/tipRegistry-B71o4qWr.js +2 -0
  227. package/dist/chunks/{toolEventObserver-CzFZUIsM.js → toolEventObserver-7QP38x4t.js} +1 -1
  228. package/dist/chunks/toolPool-V-7Yv0GA.js +1 -0
  229. package/dist/chunks/{types-zk5Ltv5q.js → types-Dx7P7JLQ.js} +2 -2
  230. package/dist/chunks/udsClient-cQz6nJ_T.js +1 -0
  231. package/dist/chunks/{use-select-navigation-DMaC_3iw.js → use-select-navigation-hWL5VHnL.js} +1 -1
  232. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CjW3gUOt.js → useExitOnCtrlCDWithKeybindings-BKwzUpgb.js} +1 -1
  233. package/dist/chunks/useMainLoopModel-DxvV70Ru.js +1 -0
  234. package/dist/chunks/useManagePlugins-BXLXazrR.js +1 -0
  235. package/dist/chunks/useMergedTools-CCgnBJzO.js +1 -0
  236. package/dist/chunks/{useSearchInput-C2JuUW3g.js → useSearchInput-CzopttqC.js} +1 -1
  237. package/dist/chunks/useSettingsErrors-SFPWfxsA.js +1 -0
  238. package/dist/chunks/{util-Bq5l7FF5.js → util-Cbb3S6SX.js} +1 -1
  239. package/dist/chunks/validatePlugin-BMSoeb_b.js +1 -0
  240. package/dist/chunks/vim-CoRp9lY1.js +1 -0
  241. package/dist/chunks/worktree-Vm-SNY5x.js +1 -0
  242. package/dist/cli.js +1 -1
  243. package/package.json +1 -5
  244. package/dist/chunks/AgentsMdExternalIncludesDialog-DCvgQ6n3.js +0 -1
  245. package/dist/chunks/App-BcEI6U5j.js +0 -1
  246. package/dist/chunks/ApproveApiKey-DegdTXZl.js +0 -1
  247. package/dist/chunks/ApproveApiKey-_VXIMSwY.js +0 -1
  248. package/dist/chunks/BackgroundTasksDialog-CjBt1L0p.js +0 -2
  249. package/dist/chunks/CustomSelect-B46Eh0gU.js +0 -1
  250. package/dist/chunks/Doctor-BP0Rqraa.js +0 -1
  251. package/dist/chunks/Doctor-By_y3C2V.js +0 -3
  252. package/dist/chunks/Grove-C3mhgshv.js +0 -11
  253. package/dist/chunks/MCPConnectionManager-ChN4Ayjk.js +0 -1
  254. package/dist/chunks/MCPToolListView-DLSrQHDc.js +0 -1
  255. package/dist/chunks/MessageSelector-CdDlJE48.js +0 -3
  256. package/dist/chunks/Messages-DuL_r1Or.js +0 -10
  257. package/dist/chunks/Onboarding-CE2GNA-h.js +0 -1
  258. package/dist/chunks/QueryEngine-DNNy1UCD.js +0 -1
  259. package/dist/chunks/REPL-CEhW-C41.js +0 -1
  260. package/dist/chunks/REPL-CkSL4C_8.js +0 -124
  261. package/dist/chunks/ResumeConversation-BMCO_3X7.js +0 -1
  262. package/dist/chunks/SearchExtraToolsTool-DSy_jDhf.js +0 -1
  263. package/dist/chunks/Settings-mDykHLok.js +0 -2
  264. package/dist/chunks/Spinner-DwsJJUtn.js +0 -1
  265. package/dist/chunks/TrustDialog-G4jM9IfM.js +0 -1
  266. package/dist/chunks/add-dir-7RfQAC3h.js +0 -1
  267. package/dist/chunks/agents-BNg_skSm.js +0 -101
  268. package/dist/chunks/allErrors-DaztSMrw.js +0 -1
  269. package/dist/chunks/auth-BTB00dq5.js +0 -10
  270. package/dist/chunks/auth-Bbc0Ny8i.js +0 -1
  271. package/dist/chunks/backgroundHousekeeping-DYz83_8C.js +0 -1
  272. package/dist/chunks/backgroundHousekeeping-bEZtlJSf.js +0 -17
  273. package/dist/chunks/banner-mqZEluky.js +0 -2
  274. package/dist/chunks/branch-exFKkymg.js +0 -2
  275. package/dist/chunks/btw-3l78DYET.js +0 -1
  276. package/dist/chunks/caches-6Nx6tsk9.js +0 -1
  277. package/dist/chunks/caches-ouaWB9bY.js +0 -1
  278. package/dist/chunks/client-C01Bnxxv.js +0 -1
  279. package/dist/chunks/client-DYRgRQsr.js +0 -1
  280. package/dist/chunks/commands-BoxOw75F.js +0 -1
  281. package/dist/chunks/compact-BOYr105K.js +0 -2
  282. package/dist/chunks/config-BddEvZZl.js +0 -3
  283. package/dist/chunks/config-GEv9hUzz.js +0 -1
  284. package/dist/chunks/config-kw4xg7Nk.js +0 -1
  285. package/dist/chunks/context-noninteractive-DFvoZ2L9.js +0 -1
  286. package/dist/chunks/conversation-CoGharlH.js +0 -1
  287. package/dist/chunks/conversation-MxEVm54C.js +0 -1
  288. package/dist/chunks/conversationRecovery-Da_8uldZ.js +0 -1
  289. package/dist/chunks/crossProjectResume-CzPCHq_K.js +0 -40
  290. package/dist/chunks/cwd-BcO6WHKo.js +0 -1
  291. package/dist/chunks/cwd-CDUelriw.js +0 -1
  292. package/dist/chunks/dist-es-5t7v8oaj.js +0 -1
  293. package/dist/chunks/dist-es-BIjDeceU.js +0 -1
  294. package/dist/chunks/dist-es-C-OjW2Ao.js +0 -1
  295. package/dist/chunks/dist-es-CEk66gUu.js +0 -1
  296. package/dist/chunks/dist-es-CIULjvtA2.js +0 -1
  297. package/dist/chunks/dist-es-CMtO44xC.js +0 -1
  298. package/dist/chunks/dist-es-CYPVg66r.js +0 -9
  299. package/dist/chunks/dist-es-D1Y8zSMI.js +0 -1
  300. package/dist/chunks/dist-es-Gt_DpXlP.js +0 -1
  301. package/dist/chunks/dist-es-kj-F5A132.js +0 -1
  302. package/dist/chunks/doctor-DWvioSU9.js +0 -1
  303. package/dist/chunks/esm-BQY8jJNR.js +0 -1
  304. package/dist/chunks/exit-BxC_ZEtO.js +0 -1
  305. package/dist/chunks/extraUsage-DYm33Occ.js +0 -1
  306. package/dist/chunks/extractMemories-CzN3Ax2B.js +0 -1
  307. package/dist/chunks/fast-DqUpl_Lr.js +0 -1
  308. package/dist/chunks/fast-NUdUyAaM.js +0 -1
  309. package/dist/chunks/fetchModelList-CqsTAWEN.js +0 -1
  310. package/dist/chunks/fetchModelList-DBMHE6Ng.js +0 -1
  311. package/dist/chunks/firstPartyEventLogger-C0q45h_4.js +0 -3
  312. package/dist/chunks/firstPartyEventLogger-CP8hCBDj.js +0 -1
  313. package/dist/chunks/generateSessionName-ChvKBVxB.js +0 -1
  314. package/dist/chunks/goal-ByyimpVU.js +0 -3
  315. package/dist/chunks/grok-DenjixMl.js +0 -1
  316. package/dist/chunks/grove-Dq8QbQ9o.js +0 -7
  317. package/dist/chunks/history-CNQNd6hT.js +0 -1
  318. package/dist/chunks/hooks-BaYwmkxD.js +0 -1
  319. package/dist/chunks/instrumentation-BwVyvRfY.js +0 -21
  320. package/dist/chunks/keybindings-wNxBzDVQ.js +0 -1
  321. package/dist/chunks/launchOnboarding-CDjQ64RO.js +0 -8
  322. package/dist/chunks/loadAgentsDir-DKXap_Om.js +0 -1
  323. package/dist/chunks/loadPluginHooks-DtmHtEiS.js +0 -1
  324. package/dist/chunks/localSearch-BB9x5C2N.js +0 -1
  325. package/dist/chunks/logoUtils-Dj_2SWmO.js +0 -1
  326. package/dist/chunks/main-BRg8L_aw.js +0 -346
  327. package/dist/chunks/managedEnv-DsqAYOJ4.js +0 -1
  328. package/dist/chunks/managedEnv-lybrMred.js +0 -1
  329. package/dist/chunks/mcp-Bsw3cMiJ.js +0 -6
  330. package/dist/chunks/mcp-DDdud6Y7.js +0 -1
  331. package/dist/chunks/mcp-DbgTDUt7.js +0 -2
  332. package/dist/chunks/memory-CzwTzihf.js +0 -1
  333. package/dist/chunks/model-BYfmXKHf.js +0 -1
  334. package/dist/chunks/model-BwBE0Pt5.js +0 -1
  335. package/dist/chunks/modelOptions-DvNBapgG.js +0 -1
  336. package/dist/chunks/nativeInstaller-DnSNJWIi.js +0 -1
  337. package/dist/chunks/notifications-B0DTaYoy.js +0 -1
  338. package/dist/chunks/omit-Dl1Us_PY.js +0 -1
  339. package/dist/chunks/onChangeAppState-4KOJMN82.js +0 -1
  340. package/dist/chunks/openai-C_6C1_0N.js +0 -10
  341. package/dist/chunks/parser-BKAVMTyD.js +0 -1
  342. package/dist/chunks/partition-B504IgAa.js +0 -1
  343. package/dist/chunks/permissions-CLFMhdRk.js +0 -3
  344. package/dist/chunks/pidLock-D9do1Afy.js +0 -3
  345. package/dist/chunks/plugin-BYdF7uob.js +0 -17
  346. package/dist/chunks/pluginBlocklist-DKKmOnWM.js +0 -1
  347. package/dist/chunks/pluginCliCommands-z8TtJMKH.js +0 -1
  348. package/dist/chunks/pluginOperations-BcfJCDco.js +0 -2
  349. package/dist/chunks/pluginStartupCheck-Cq4PvULa.js +0 -1
  350. package/dist/chunks/plugins-CTM8jpOw.js +0 -4
  351. package/dist/chunks/policyLimits-a7ix6GnU.js +0 -1
  352. package/dist/chunks/poorMode-C11JEH3d.js +0 -1
  353. package/dist/chunks/print-u6MzL5Cr.js +0 -13
  354. package/dist/chunks/processBashCommand-DIwrI2QC.js +0 -1
  355. package/dist/chunks/processSlashCommand-B-Gujpxm.js +0 -5
  356. package/dist/chunks/prompt-BPJDGlx5.js +0 -1
  357. package/dist/chunks/prompt-DEdZzkEz.js +0 -1
  358. package/dist/chunks/reconciler-DSKLuOS7.js +0 -1
  359. package/dist/chunks/refresh-BbZFCNpn.js +0 -1
  360. package/dist/chunks/rename-DOtCOtEr.js +0 -1
  361. package/dist/chunks/resume-BB4T4WIV.js +0 -2
  362. package/dist/chunks/ripgrep-CZ2CqaHb.js +0 -1
  363. package/dist/chunks/sandbox-adapter-DhJJ6WOV.js +0 -1
  364. package/dist/chunks/searchExtraTools-CdJghGkj.js +0 -1
  365. package/dist/chunks/sessionFileAccessHooks-D7KbWFp7.js +0 -1
  366. package/dist/chunks/sessionObserver-DB-sLv-X.js +0 -1
  367. package/dist/chunks/sessionStorage-sgOAbDn7.js +0 -1
  368. package/dist/chunks/sessionTracing-yBre24PH.js +0 -11
  369. package/dist/chunks/settings-C-KNkvsM.js +0 -1
  370. package/dist/chunks/settings-DKN4xSpQ.js +0 -24
  371. package/dist/chunks/setup-CN_Pk7AR.js +0 -3
  372. package/dist/chunks/sinks-BS17vtN0.js +0 -1
  373. package/dist/chunks/sinks-D1EjkHb4.js +0 -1
  374. package/dist/chunks/skillChangeDetector-CBKuGuEi.js +0 -1
  375. package/dist/chunks/startupProfiler-B_U4QDtf.js +0 -1
  376. package/dist/chunks/state-BowF111d.js +0 -1
  377. package/dist/chunks/state-CGuyDES7.js +0 -1
  378. package/dist/chunks/status-BurdTfyz.js +0 -2
  379. package/dist/chunks/status-DMq1An5h.js +0 -1
  380. package/dist/chunks/statusNoticeHelpers-X75JNlx5.js +0 -1
  381. package/dist/chunks/sts-C2Gf2WYN.js +0 -1
  382. package/dist/chunks/switcher-DGD4ORVf.js +0 -1
  383. package/dist/chunks/tipRegistry-CyRXWWTz.js +0 -2
  384. package/dist/chunks/toolPool-CnrZcprA.js +0 -1
  385. package/dist/chunks/udsClient-ftP0yIpe.js +0 -1
  386. package/dist/chunks/useMainLoopModel-DWscpA9I.js +0 -1
  387. package/dist/chunks/useManagePlugins-CYXVcql2.js +0 -1
  388. package/dist/chunks/useMergedTools-DarmnCEw.js +0 -1
  389. package/dist/chunks/useSettingsErrors-DutJBiKZ.js +0 -1
  390. package/dist/chunks/validatePlugin-DIdEydz_.js +0 -1
  391. package/dist/chunks/vim-D8prM2IH.js +0 -1
  392. package/dist/chunks/worktree-Caqt2WRZ.js +0 -1
  393. /package/dist/chunks/{dist-es-Cgsa8pb82.js → dist-es-Cgsa8pb8.js} +0 -0
  394. /package/dist/chunks/{dist-es-Cwru7c2B2.js → dist-es-Cwru7c2B.js} +0 -0
  395. /package/dist/chunks/{dist-es-DXIR5NLi2.js → dist-es-DXIR5NLi.js} +0 -0
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{_t as t,t as n}from"./client-DvAL7lY8.js";import{L as r,h as i,t as a}from"./config-BSXLgwpD.js";import{readFileSync as o}from"node:fs";var s,c=e((()=>{s=e=>async t=>{e.logger?.debug(`@aws-sdk/credential-provider-web-identity - fromWebToken`);let{roleArn:n,roleSessionName:r,webIdentityToken:i,providerId:a,policyArns:o,policy:s,durationSeconds:c}=e,{roleAssumerWithWebIdentity:l}=e;if(!l){let{getDefaultRoleAssumerWithWebIdentity:n}=await import(`./sts-C2Gf2WYN.js`);l=n({...e.clientConfig,credentialProviderLogger:e.logger,parentClientConfig:{...t?.callerClientConfig,...e.parentClientConfig}},e.clientPlugins)}return l({RoleArn:n,RoleSessionName:r??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:i,ProviderId:a,PolicyArns:o,Policy:s,DurationSeconds:c})}})),l,u,d,f,p=e((()=>{n(),a(),c(),l=`AWS_WEB_IDENTITY_TOKEN_FILE`,u=`AWS_ROLE_ARN`,d=`AWS_ROLE_SESSION_NAME`,f=(e={})=>async n=>{e.logger?.debug(`@aws-sdk/credential-provider-web-identity - fromTokenFile`);let a=e?.webIdentityTokenFile??process.env[l],c=e?.roleArn??process.env[u],f=e?.roleSessionName??process.env[d];if(!a||!c)throw new r(`Web identity configuration not specified`,{logger:e.logger});let p=await s({...e,webIdentityToken:i?.getTokenRecord?.()[a]??o(a,{encoding:`ascii`}),roleArn:c,roleSessionName:f})(n);return a===process.env[l]&&t(p,`CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN`,`h`),p}})),m=e((()=>{p(),c()}));export{c as a,s as i,f as n,p as r,m as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{_t as t,t as n}from"./client-DvAL7lY8.js";import{L as r,h as i,t as a}from"./config-BSXLgwpD.js";import{readFileSync as o}from"node:fs";var s,c=e((()=>{s=e=>async t=>{e.logger?.debug(`@aws-sdk/credential-provider-web-identity - fromWebToken`);let{roleArn:n,roleSessionName:r,webIdentityToken:i,providerId:a,policyArns:o,policy:s,durationSeconds:c}=e,{roleAssumerWithWebIdentity:l}=e;if(!l){let{getDefaultRoleAssumerWithWebIdentity:n}=await import(`./sts-ei3CGBNu.js`);l=n({...e.clientConfig,credentialProviderLogger:e.logger,parentClientConfig:{...t?.callerClientConfig,...e.parentClientConfig}},e.clientPlugins)}return l({RoleArn:n,RoleSessionName:r??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:i,ProviderId:a,PolicyArns:o,Policy:s,DurationSeconds:c})}})),l,u,d,f,p=e((()=>{n(),a(),c(),l=`AWS_WEB_IDENTITY_TOKEN_FILE`,u=`AWS_ROLE_ARN`,d=`AWS_ROLE_SESSION_NAME`,f=(e={})=>async n=>{e.logger?.debug(`@aws-sdk/credential-provider-web-identity - fromTokenFile`);let a=e?.webIdentityTokenFile??process.env[l],c=e?.roleArn??process.env[u],f=e?.roleSessionName??process.env[d];if(!a||!c)throw new r(`Web identity configuration not specified`,{logger:e.logger});let p=await s({...e,webIdentityToken:i?.getTokenRecord?.()[a]??o(a,{encoding:`ascii`}),roleArn:c,roleSessionName:f})(n);return a===process.env[l]&&t(p,`CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN`,`h`),p}})),m=e((()=>{p(),c()}));export{c as a,s as i,f as n,p as r,m as t};
@@ -0,0 +1 @@
1
+ import"./client-DvAL7lY8.js";import{_ as e,f as t,t as n}from"./dist-es-_UNJQniz.js";n();export{e as BedrockRuntimeClient,t as CountTokensCommand};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,r as n,t as r}from"./dist-es-BSRN-2nA.js";r();export{t as credentialsTreatedAsExpired,n as credentialsWillNeedRefresh,e as defaultProvider};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{C as r,D as i,E as ee,F as a,I as te,L as ne,M as re,O as ie,P as ae,U as oe,V as se,X as ce,Y as le,_ as ue,d as de,et as fe,g as pe,i as me,j as he,k as ge,l as _e,mt as ve,n as ye,nt as be,ot as xe,p as Se,q as o,rt as Ce,s as we,st as Te,t as s,vt as Ee,x as De,y as Oe,z as ke}from"./client-DvAL7lY8.js";import{B as Ae,D as je,H as Me,M as Ne,O as Pe,Y as Fe,c as Ie,o as Le,q as Re,t as c,u as ze}from"./protocols-CnYQjBlj.js";import{B as Be,H as Ve,L as He,c as Ue,d as We,r as Ge,z as Ke}from"./serde-f76bObzR.js";import{a as qe,d as Je,l as Ye,m as l,o as Xe,r as Ze,s as Qe,t as $e}from"./config-BSXLgwpD.js";import{C as et,f as tt,i as nt,o as rt,s as it,t as u,u as at,v as ot}from"./dist-es-BF6bR-Ik.js";import{n as st,t as ct}from"./checksum-DgbnMdM-.js";import{C as lt,a as ut,s as dt,t as d}from"./event-streams-DoqJmjFN.js";import{C as ft,_ as pt,c as mt,i as ht,o as gt,t as _t}from"./protocols-CCsohXid.js";import{i as vt,t as yt}from"./dist-es-CYPVg66r.js";import{i as bt,r as xt,t as St}from"./dist-es-DKIwwJME.js";import{n as Ct,t as wt}from"./dist-es-Bfr4TzQe.js";import{PassThrough as Tt,Readable as Et,Transform as Dt,pipeline as Ot}from"node:stream";function kt(e){let t=e.signer,n=e.signer,r=Object.assign(e,{eventSigner:t,messageSigner:n}),i=r.eventStreamPayloadHandlerProvider(r);return Object.assign(r,{eventStreamPayloadHandler:i})}var At=e((()=>{})),jt=e((()=>{At()})),Mt,Nt=e((()=>{Mt=e=>e.protocol===`ws:`||e.protocol===`wss:`})),Pt,Ft=e((()=>{c(),Nt(),t(),Pt=class{constructor(e){n(this,`signer`,void 0),this.signer=e.signer}presign(e,t={}){return this.signer.presign(e,t)}async sign(e,t){return Re.isInstance(e)&&Mt(e)?{...await this.signer.presign({...e,body:``},{...t,expiresIn:60,unsignableHeaders:new Set(Object.keys(e.headers).filter(e=>e!==`host`))}),body:e.body}:this.signer.sign(e,t)}signMessage(e,t){return this.signer.signMessage(e,t)}}})),It,Lt,Rt=e((()=>{Ft(),It=e=>{let{signer:t}=e;return Object.assign(e,{signer:async e=>{let n=await t(e);if(Lt(n))return new Pt({signer:n});throw Error(`Expected WebsocketSignatureV4 signer, please check the client constructor.`)}})},Lt=e=>!!e})),zt=e((()=>{Nt(),Rt()}));function Bt(e){return{schemeId:`aws.auth#sigv4`,signingProperties:{name:`bedrock`,region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function Vt(e){return{schemeId:`smithy.api#httpBearerAuth`,propertiesExtractor:({profile:e,filepath:t,configFilepath:n,ignoreCache:r},i)=>({identityProperties:{profile:e,filepath:t,configFilepath:n,ignoreCache:r}})}}var Ht,Ut,Wt,Gt=e((()=>{gt(),u(),o(),Ht=async(e,t,n)=>({operation:Fe(t).operation,region:await Me(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),Ut=e=>{let t=[];switch(e.operation){default:t.push(Bt(e)),t.push(Vt(e))}return t},Wt=e=>{let t=it(e.token,rt,nt),n=mt(e);return Object.assign(n,{authSchemePreference:Me(e.authSchemePreference??[]),token:t})}})),Kt,qt,Jt=e((()=>{Kt=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:`bedrock`}),qt={UseFIPS:{type:`builtInParams`,name:`useFipsEndpoint`},Endpoint:{type:`builtInParams`,name:`endpoint`},Region:{type:`builtInParams`,name:`region`},UseDualStack:{type:`builtInParams`,name:`useDualstackEndpoint`}}})),Yt,Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn,mn=e((()=>{Yt=`@aws-sdk/client-bedrock-runtime`,Xt=`AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native`,Zt=`3.1085.0`,Qt={build:`concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs`,"build:cjs":`node ../../scripts/compilation/inline`,"build:es":`premove dist-es && tsc -p tsconfig.es.json`,"build:include:deps":`yarn g:turbo run build -F="$npm_package_name"`,"build:types":`premove dist-types && tsc -p tsconfig.types.json`,"build:types:downlevel":`downlevel-dts dist-types dist-types/ts3.4`,clean:`premove dist-cjs dist-es dist-types`,"extract:docs":`api-extractor run --local`,"generate:client":`node ../../scripts/generate-clients/single-service`,test:`yarn g:vitest run --passWithNoTests`,"test:watch":`yarn g:vitest watch --passWithNoTests`,"test:integration":`yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts`,"test:integration:watch":`yarn g:vitest watch --passWithNoTests -c vitest.config.integ.mts`,"test:e2e":`yarn g:vitest run -c vitest.config.e2e.mts`,"test:e2e:watch":`yarn g:vitest watch -c vitest.config.e2e.mts`,"test:browser":`yarn g:vitest run -c vitest.config.browser.e2e.mts`,"test:browser:watch":`yarn g:vitest watch -c vitest.config.browser.e2e.mts`,"test:index":`tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs`},$t=`./dist-cjs/index.js`,en=`./dist-types/index.d.ts`,tn=`./dist-es/index.js`,nn={"@aws-sdk/core":`^3.975.1`,"@aws-sdk/credential-provider-node":`^3.972.66`,"@aws-sdk/eventstream-handler-node":`^3.972.26`,"@aws-sdk/middleware-eventstream":`^3.972.22`,"@aws-sdk/middleware-websocket":`^3.972.39`,"@aws-sdk/token-providers":`3.1085.0`,"@aws-sdk/types":`^3.974.0`,"@smithy/core":`^3.29.2`,"@smithy/fetch-http-handler":`^5.6.4`,"@smithy/node-http-handler":`^4.9.4`,"@smithy/types":`^4.16.0`,tslib:`^2.6.2`},rn={"@smithy/snapshot-testing":`^2.2.7`,"@tsconfig/node20":`20.1.8`,"@types/node":`^20.14.8`,concurrently:`7.0.0`,"downlevel-dts":`0.10.1`,premove:`4.0.0`,typescript:`~5.8.3`,vitest:`^4.0.17`},an={node:`>=20.0.0`},on={"<4.5":{"dist-types/*":[`dist-types/ts3.4/*`]}},sn=[`dist-*/**`],cn={name:`AWS SDK for JavaScript Team`,url:`https://aws.amazon.com/sdk-for-javascript/`},ln=`Apache-2.0`,un={"./dist-es/runtimeConfig":`./dist-es/runtimeConfig.browser`},dn=`https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-bedrock-runtime`,fn={type:`git`,url:`https://github.com/aws/aws-sdk-js-v3.git`,directory:`clients/client-bedrock-runtime`},pn={name:Yt,description:Xt,version:Zt,scripts:Qt,main:$t,types:en,module:tn,sideEffects:!1,dependencies:nn,devDependencies:rn,engines:an,typesVersions:on,files:sn,author:cn,license:ln,browser:un,"react-native":{"./dist-es/runtimeConfig":`./dist-es/runtimeConfig.native`},homepage:dn,repository:fn}}));function hn(e){let t=Buffer.from(e,`hex`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}var gn,_n=e((()=>{t(),gn=class extends Dt{constructor(e){super({autoDestroy:!0,readableObjectMode:!0,writableObjectMode:!0,...e}),n(this,`priorSignature`,void 0),n(this,`messageSigner`,void 0),n(this,`eventStreamCodec`,void 0),n(this,`systemClockOffsetProvider`,void 0),n(this,`staticCredentials`,void 0),this.priorSignature=e.priorSignature,this.eventStreamCodec=e.eventStreamCodec,this.messageSigner=e.messageSigner,this.systemClockOffsetProvider=e.systemClockOffsetProvider,this.staticCredentials=e.credentials?.()}async _transform(e,t,n){try{let t=new Date(Date.now()+await this.systemClockOffsetProvider()),r={":date":{type:`timestamp`,value:t}},i=await this.messageSigner.sign({message:{body:e,headers:r},priorSignature:this.priorSignature},{signingDate:t,eventStreamCredentials:await this.staticCredentials});this.priorSignature=i.signature;let ee=this.eventStreamCodec.encode({headers:{...r,":chunk-signature":{type:`binary`,value:hn(i.signature)}},body:e});return this.push(ee),n()}catch(e){n(e)}}}})),vn,yn=e((()=>{d(),_n(),t(),vn=class{constructor(e){n(this,`messageSigner`,void 0),n(this,`eventStreamCodec`,void 0),n(this,`systemClockOffsetProvider`,void 0),n(this,`credentials`,void 0),this.messageSigner=e.messageSigner,this.eventStreamCodec=new lt(e.utf8Encoder,e.utf8Decoder),this.systemClockOffsetProvider=async()=>e.systemClockOffset??0,this.credentials=e.credentials}async handle(e,t,n={}){let r=t.request,{body:i,query:ee}=r;if(!(i instanceof Et))throw Error(`Eventstream payload must be a Readable stream.`);let a=i;r.body=new Tt({objectMode:!0});let te=r.headers?.authorization?.match(/Signature=([\w]+)$/)?.[1]??ee?.[`X-Amz-Signature`]??``;n.__staticSignature&&(te=``);let ne=new gn({priorSignature:te,eventStreamCodec:this.eventStreamCodec,messageSigner:await this.messageSigner(),systemClockOffsetProvider:this.systemClockOffsetProvider,credentials:this.credentials}),re,ie=new Promise((e,t)=>{re=()=>e(void 0),Ot(a,ne,r.body,e=>{e&&t(Error(`Pipeline error in @aws-sdk/eventstream-handler-node: ${e.message}`,{cause:e}))})}),ae;try{ae=await Promise.race([e(t),ie])}catch(e){throw r.body.end(),e}finally{re()}return ae}}})),bn,xn=e((()=>{yn(),bn=e=>new vn(e)})),Sn=e((()=>{xn()})),f,p,m,Cn,wn,h,Tn,En,g,_,v,Dn,On,kn,An,jn=e((()=>{a(),f=`ref`,p=-1,m=!0,Cn=`isSet`,wn=`PartitionResult`,h=`booleanEquals`,Tn=`getAttr`,En={[f]:`Endpoint`},g={[f]:wn},_={},v=[{[f]:`Region`}],Dn={conditions:[[Cn,[En]],[Cn,v],[`aws.partition`,v,wn],[h,[{[f]:`UseFIPS`},m]],[h,[{[f]:`UseDualStack`},m]],[h,[{fn:Tn,argv:[g,`supportsDualStack`]},m]],[h,[{fn:Tn,argv:[g,`supportsFIPS`]},m]]],results:[[p],[p,`Invalid Configuration: FIPS and custom endpoint are not supported`],[p,`Invalid Configuration: Dualstack and custom endpoint are not supported`],[En,_],[`https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}`,_],[p,`FIPS and DualStack are enabled, but this partition does not support one or both`],[`https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}`,_],[p,`FIPS is enabled but this partition does not support FIPS`],[`https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}`,_],[p,`DualStack is enabled but this partition does not support DualStack`],[`https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}`,_],[p,`Invalid Configuration: Missing Region`]]},On=2,kn=new Int32Array([-1,1,-1,0,12,3,1,4,100000011,2,5,100000011,3,8,6,4,7,100000010,5,100000008,100000009,4,10,9,6,100000006,100000007,5,11,100000005,6,100000004,100000005,3,100000001,13,4,100000002,100000003]),An=oe.from(kn,On,Dn.conditions,Dn.results)})),Mn,Nn,Pn=e((()=>{s(),a(),jn(),Mn=new se({size:50,params:[`Endpoint`,`Region`,`UseDualStack`,`UseFIPS`]}),Nn=(e,t={})=>Mn.get(e,()=>ne(An,{endpointParams:e,logger:t.logger})),ke.aws=we})),y,b=e((()=>{o(),y=class e extends Te{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}})),Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn=e((()=>{b(),t(),Fn=class e extends y{constructor(t){super({name:`AccessDeniedException`,$fault:`client`,...t}),n(this,`name`,`AccessDeniedException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},In=class e extends y{constructor(t){super({name:`InternalServerException`,$fault:`server`,...t}),n(this,`name`,`InternalServerException`),n(this,`$fault`,`server`),Object.setPrototypeOf(this,e.prototype)}},Ln=class e extends y{constructor(t){super({name:`ThrottlingException`,$fault:`client`,...t}),n(this,`name`,`ThrottlingException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},Rn=class e extends y{constructor(t){super({name:`ValidationException`,$fault:`client`,...t}),n(this,`name`,`ValidationException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},zn=class e extends y{constructor(t){super({name:`ConflictException`,$fault:`client`,...t}),n(this,`name`,`ConflictException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},Bn=class e extends y{constructor(t){super({name:`ResourceNotFoundException`,$fault:`client`,...t}),n(this,`name`,`ResourceNotFoundException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},Vn=class e extends y{constructor(t){super({name:`ServiceQuotaExceededException`,$fault:`client`,...t}),n(this,`name`,`ServiceQuotaExceededException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},Hn=class e extends y{constructor(t){super({name:`ServiceUnavailableException`,$fault:`server`,...t}),n(this,`name`,`ServiceUnavailableException`),n(this,`$fault`,`server`),Object.setPrototypeOf(this,e.prototype)}},Un=class e extends y{constructor(t){super({name:`ModelErrorException`,$fault:`client`,...t}),n(this,`name`,`ModelErrorException`),n(this,`$fault`,`client`),n(this,`originalStatusCode`,void 0),n(this,`resourceName`,void 0),Object.setPrototypeOf(this,e.prototype),this.originalStatusCode=t.originalStatusCode,this.resourceName=t.resourceName}},Wn=class e extends y{constructor(t){super({name:`ModelNotReadyException`,$fault:`client`,...t}),n(this,`name`,`ModelNotReadyException`),n(this,`$fault`,`client`),n(this,`$retryable`,{}),Object.setPrototypeOf(this,e.prototype)}},Gn=class e extends y{constructor(t){super({name:`ModelTimeoutException`,$fault:`client`,...t}),n(this,`name`,`ModelTimeoutException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},Kn=class e extends y{constructor(t){super({name:`ModelStreamErrorException`,$fault:`client`,...t}),n(this,`name`,`ModelStreamErrorException`),n(this,`$fault`,`client`),n(this,`originalStatusCode`,void 0),n(this,`originalMessage`,void 0),Object.setPrototypeOf(this,e.prototype),this.originalStatusCode=t.originalStatusCode,this.originalMessage=t.originalMessage}}})),Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,ir,ar,or,sr,cr,lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br,xr,Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,x,yi,bi,S,xi,C,w,T,Si,Ci,wi,Ti,E,Ei,Di,Oi,D,O,ki,k,A,j,Ai,M,ji,Mi,Ni,Pi,N,Fi,Ii,P,Li,Ri,F,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,I,Yi,Xi,Zi,Qi,$i,ea,L,ta,R,na,ra,ia,aa,oa,sa,ca,la,ua,z,da,fa,pa,B,ma,ha,ga,_a,V,va,ya,H,ba,xa,Sa,Ca,wa,U,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,W,Ia,G,La,Ra,za,Ba,K,Va,Ha,Ua,q,Wa,Ga,J,Ka,qa,Ja,Y,X,Ya,Xa,Za,Qa,$a,eo,to,no,Z,ro,io,ao,oo,so,co,lo,uo,fo,po,mo,ho,go,_o,vo,yo,bo,xo,So,Q,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,$=e((()=>{je(),b(),qn(),Jn=`AudioBlock`,Yn=`AccessDeniedException`,Xn=`AudioSource`,Zn=`AnyToolChoice`,Qn=`AutoToolChoice`,$n=`Body`,er=`Citation`,tr=`ContentBlocks`,nr=`ContentBlock`,rr=`CitationsConfig`,ir=`CitationsContentBlock`,ar=`ConflictException`,or=`CitationGeneratedContent`,sr=`CitationGeneratedContentList`,cr=`CitationLocation`,lr=`CachePointBlock`,ur=`CitationSourceContent`,dr=`CitationSourceContentList`,fr=`CountTokensInput`,pr=`ConverseTokensRequest`,mr=`CountTokensRequest`,hr=`CountTokensResponse`,gr=`CountTokens`,_r=`Citations`,vr=`DocumentBlock`,yr=`DocumentContentBlocks`,br=`DocumentContentBlock`,xr=`DocumentCharLocation`,Sr=`DocumentChunkLocation`,Cr=`DocumentPageLocation`,wr=`DocumentSource`,Tr=`ErrorBlock`,Er=`GuardrailConverseContentBlock`,Dr=`GuardrailConverseImageBlock`,Or=`GuardrailConverseImageSource`,kr=`GuardrailConverseTextBlock`,Ar=`ImageBlock`,jr=`InvokeModelTokensRequest`,Mr=`ImageSource`,Nr=`InternalServerException`,Pr=`Message`,Fr=`ModelErrorException`,Ir=`ModelNotReadyException`,Lr=`ModelStreamErrorException`,Rr=`ModelTimeoutException`,zr=`Messages`,Br=`ReasoningContentBlock`,Vr=`ResourceNotFoundException`,Hr=`ReasoningTextBlock`,Ur=`SystemContentBlocks`,Wr=`SystemContentBlock`,Gr=`S3Location`,Kr=`ServiceQuotaExceededException`,qr=`SearchResultBlock`,Jr=`SearchResultContentBlock`,Yr=`SearchResultContentBlocks`,Xr=`SearchResultLocation`,Zr=`SpecificToolChoice`,Qr=`SystemTool`,$r=`ServiceUnavailableException`,ei=`ToolConfiguration`,ti=`ToolChoice`,ni=`ThrottlingException`,ri=`ToolInputSchema`,ii=`ToolResultBlock`,ai=`ToolResultContentBlocks`,oi=`ToolResultContentBlock`,si=`ToolSpecification`,ci=`ToolUseBlock`,li=`Tools`,ui=`Tool`,di=`VideoBlock`,fi=`ValidationException`,pi=`VideoSource`,mi=`WebLocation`,hi=`additionalModelRequestFields`,gi=`any`,_i=`audio`,vi=`auto`,x=`bytes`,yi=`bucketOwner`,bi=`body`,S=`client`,xi=`citationsContent`,C=`cachePoint`,w=`citations`,T=`content`,Si=`context`,Ci=`converse`,wi=`documentChar`,Ti=`documentChunk`,E=`documentIndex`,Ei=`documentPage`,Di=`description`,Oi=`domain`,D=`document`,O=`error`,ki=`enabled`,k=`end`,A=`format`,j=`guardContent`,Ai=`http`,M=`httpError`,ji=`input`,Mi=`invokeModel`,Ni=`inputSchema`,Pi=`inputTokens`,N=`image`,Fi=`json`,Ii=`location`,P=`message`,Li=`modelId`,Ri=`messages`,F=`name`,zi=`originalMessage`,Bi=`originalStatusCode`,Vi=`qualifiers`,Hi=`reasoningContent`,Ui=`redactedContent`,Wi=`resourceName`,Gi=`reasoningText`,Ki=`role`,qi=`smithy.ts.sdk.synthetic.com.amazonaws.bedrockruntime`,Ji=`sourceContent`,I=`s3Location`,Yi=`searchResultIndex`,Xi=`searchResultLocation`,Zi=`searchResult`,Qi=`systemTool`,$i=`server`,ea=`signature`,L=`source`,ta=`status`,R=`start`,na=`strict`,ra=`system`,ia=`ttl`,aa=`toolConfig`,oa=`toolChoice`,sa=`toolResult`,ca=`toolSpec`,la=`toolUseId`,ua=`toolUse`,z=`text`,da=`title`,fa=`tools`,pa=`tool`,B=`type`,ma=`uri`,ha=`url`,ga=`video`,_a=`web`,V=`com.amazonaws.bedrockruntime`,va=Pe.for(qi),ya=[-3,qi,`BedrockRuntimeServiceException`,0,[],[]],va.registerError(ya,y),H=Pe.for(V),ba=[-3,V,Yn,{[O]:S,[M]:403},[P],[0]],H.registerError(ba,Fn),xa=[-3,V,ar,{[O]:S,[M]:400},[P],[0]],H.registerError(xa,zn),Sa=[-3,V,Nr,{[O]:$i,[M]:500},[P],[0]],H.registerError(Sa,In),Ca=[-3,V,Fr,{[O]:S,[M]:424},[P,Bi,Wi],[0,1,0]],H.registerError(Ca,Un),wa=[-3,V,Ir,{[O]:S,[M]:429},[P],[0]],H.registerError(wa,Wn),U=[-3,V,Lr,{[O]:S,[M]:424},[P,Bi,zi],[0,1,0]],H.registerError(U,Kn),Ta=[-3,V,Rr,{[O]:S,[M]:408},[P],[0]],H.registerError(Ta,Gn),Ea=[-3,V,Vr,{[O]:S,[M]:404},[P],[0]],H.registerError(Ea,Bn),Da=[-3,V,Kr,{[O]:S,[M]:400},[P],[0]],H.registerError(Da,Vn),Oa=[-3,V,$r,{[O]:$i,[M]:503},[P],[0]],H.registerError(Oa,Hn),ka=[-3,V,ni,{[O]:S,[M]:429},[P],[0]],H.registerError(ka,Ln),Aa=[-3,V,fi,{[O]:S,[M]:400},[P],[0]],H.registerError(Aa,Rn),ja=[va,H],Ma=[0,V,$n,8,21],Na=[3,V,Zn,0,[],[]],Pa=[3,V,Jn,0,[A,L,O],[0,[()=>ho,0],[()=>q,0]],2],Fa=[3,V,Qn,0,[],[]],W=[3,V,lr,0,[B,ia],[0,0],1],Ia=[3,V,er,0,[da,L,Ji,Ii],[0,0,()=>oo,()=>_o]],G=[3,V,rr,0,[ki],[2],1],La=[3,V,ir,0,[T,w],[()=>io,()=>ao]],Ra=[3,V,pr,0,[Ri,ra,aa,hi],[[()=>lo,0],[()=>fo,0],()=>$a,15]],za=[3,V,mr,0,[Li,ji],[[0,1],[()=>bo,0]],2],Ba=[3,V,hr,0,[Pi],[1],1],K=[3,V,vr,0,[F,L,A,Si,w],[0,()=>So,0,0,()=>G],2],Va=[3,V,xr,0,[E,R,k],[1,1,1]],Ha=[3,V,Sr,0,[E,R,k],[1,1,1]],Ua=[3,V,Cr,0,[E,R,k],[1,1,1]],q=[3,V,Tr,8,[P],[0]],Wa=[3,V,Dr,8,[A,L],[0,[()=>Co,0]],2],Ga=[3,V,kr,0,[z,Vi],[0,64],1],J=[3,V,Ar,0,[A,L,O],[0,[()=>wo,0],[()=>q,0]],2],Ka=[3,V,jr,0,[bi],[[()=>Ma,0]],1],qa=[3,V,Pr,0,[Ki,T],[0,[()=>so,0]],2],Ja=[3,V,Hr,8,[z,ea],[0,0],1],Y=[3,V,Gr,0,[ma,yi],[0,0],1],X=[3,V,qr,0,[L,da,T,w],[0,0,()=>uo,()=>G],3],Ya=[3,V,Jr,0,[z],[0],1],Xa=[3,V,Xr,0,[Yi,R,k],[1,1,1]],Za=[3,V,Zr,0,[F],[0],1],Qa=[3,V,Qr,0,[F],[0],1],$a=[3,V,ei,0,[fa,oa],[()=>mo,()=>Oo],1],eo=[3,V,ii,0,[la,T,ta,B],[0,[()=>po,0],0,0],2],to=[3,V,si,0,[F,Ni,Di,na],[0,()=>ko,0,2],2],no=[3,V,ci,0,[la,F,ji,B],[0,0,15,0],3],Z=[3,V,di,0,[A,L],[0,()=>jo],2],ro=[3,V,mi,0,[ha,Oi],[0,0]],io=[1,V,sr,0,()=>go],ao=[1,V,_r,0,()=>Ia],oo=[1,V,dr,0,()=>vo],so=[1,V,tr,0,[()=>yo,0]],co=[1,V,yr,0,()=>xo],lo=[1,V,zr,0,[()=>qa,0]],uo=[1,V,Yr,0,()=>Ya],fo=[1,V,Ur,0,[()=>Eo,0]],po=[1,V,ai,0,[()=>Ao,0]],mo=[1,V,li,0,()=>Do],ho=[4,V,Xn,8,[x,I],[21,()=>Y]],go=[4,V,or,0,[z],[0]],_o=[4,V,cr,0,[_a,wi,Ei,Ti,Xi],[()=>ro,()=>Va,()=>Ua,()=>Ha,()=>Xa]],vo=[4,V,ur,0,[z],[0]],yo=[4,V,nr,0,[z,N,D,ga,_i,ua,sa,j,C,Hi,xi,Zi],[0,[()=>J,0],()=>K,()=>Z,[()=>Pa,0],()=>no,[()=>eo,0],[()=>Q,0],()=>W,[()=>To,0],()=>La,()=>X]],bo=[4,V,fr,0,[Mi,Ci],[[()=>Ka,0],[()=>Ra,0]]],xo=[4,V,br,0,[z],[0]],So=[4,V,wr,0,[x,I,z,T],[21,()=>Y,0,()=>co]],Q=[4,V,Er,0,[z,N],[()=>Ga,[()=>Wa,0]]],Co=[4,V,Or,8,[x],[21]],wo=[4,V,Mr,8,[x,I],[21,()=>Y]],To=[4,V,Br,8,[Gi,Ui],[[()=>Ja,0],21]],Eo=[4,V,Wr,0,[z,j,C],[0,[()=>Q,0],()=>W]],Do=[4,V,ui,0,[ca,Qi,C],[()=>to,()=>Qa,()=>W]],Oo=[4,V,ti,0,[vi,gi,pa],[()=>Fa,()=>Na,()=>Za]],ko=[4,V,ri,0,[Fi],[15]],Ao=[4,V,oi,0,[Fi,z,N,D,ga,Zi],[15,0,[()=>J,0],()=>K,()=>Z,()=>X]],jo=[4,V,pi,0,[x,I],[21,()=>Y]],Mo=[9,V,gr,{[Ai]:[`POST`,`/model/{modelId}/count-tokens`,200]},()=>za,()=>Ba]})),No,Po=e((()=>{gt(),_t(),u(),ct(),o(),c(),Ge(),Gt(),Pn(),$(),No=e=>({apiVersion:`2023-09-30`,base64Decoder:e?.base64Decoder??Ve,base64Encoder:e?.base64Encoder??Ke,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Nn,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Ut,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:`aws.auth#sigv4`,identityProvider:e=>e.getIdentityProvider(`aws.auth#sigv4`),signer:new ft},{schemeId:`smithy.api#httpBearerAuth`,identityProvider:e=>e.getIdentityProvider(`smithy.api#httpBearerAuth`),signer:new at}],logger:e?.logger??new ce,protocol:e?.protocol??ht,protocolSettings:e?.protocolSettings??{defaultNamespace:`com.amazonaws.bedrockruntime`,errorTypeRegistries:ja,version:`2023-09-30`,serviceTarget:`AmazonBedrockFrontendService`},serviceId:e?.serviceId??`Bedrock Runtime`,sha256:e?.sha256??st,urlParser:e?.urlParser??Ae,utf8Decoder:e?.utf8Decoder??Be,utf8Encoder:e?.utf8Encoder??He})})),Fo,Io=e((()=>{mn(),s(),gt(),yt(),Sn(),St(),u(),o(),$e(),d(),i(),Ge(),wt(),Po(),Fo=e=>{Ce(process.version);let t=Ze(e),n=()=>t().then(xe),r=No(e);Ee(process.version);let i={profile:e?.profile,logger:r.logger,signingName:`bedrock`};return{...r,...e,runtime:`node`,defaultsMode:t,authSchemePreference:e?.authSchemePreference??l(pt,i),bodyLengthChecker:e?.bodyLengthChecker??We,credentialDefaultProvider:e?.credentialDefaultProvider??vt,defaultUserAgentProvider:e?.defaultUserAgentProvider??de({serviceId:r.serviceId,clientVersion:pn.version}),eventStreamPayloadHandlerProvider:e?.eventStreamPayloadHandlerProvider??bn,eventStreamSerdeProvider:e?.eventStreamSerdeProvider??dt,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:`aws.auth#sigv4`,identityProvider:e=>e.getIdentityProvider(`aws.auth#sigv4`),signer:new ft},{schemeId:`smithy.api#httpBearerAuth`,identityProvider:e=>e.getIdentityProvider(`smithy.api#httpBearerAuth`)||(async e=>{try{return await bt({signingName:`bedrock`})()}catch{return await xt(e)(e)}}),signer:new at}],maxAttempts:e?.maxAttempts??l(ie,e),region:e?.region??l(Qe,{...Xe,...i}),requestHandler:Ct.create(e?.requestHandler??(async()=>({...await n(),disableConcurrentStreams:!0}))),retryMode:e?.retryMode??l({...ge,default:async()=>(await n()).retryMode||re},e),streamCollector:e?.streamCollector??Ue,useDualstackEndpoint:e?.useDualstackEndpoint??l(Je,i),useFipsEndpoint:e?.useFipsEndpoint??l(Ye,i),userAgentAppId:e?.userAgentAppId??l(_e,i)}}})),Lo,Ro,zo=e((()=>{Lo=e=>{let t=e.httpAuthSchemes,n=e.httpAuthSchemeProvider,r=e.credentials,i=e.token;return{setHttpAuthScheme(e){let n=t.findIndex(t=>t.schemeId===e.schemeId);n===-1?t.push(e):t.splice(n,1,e)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider(){return n},setCredentials(e){r=e},credentials(){return r},setToken(e){i=e},token(){return i}}},Ro=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials(),token:e.token()})})),Bo,Vo=e((()=>{s(),o(),c(),zo(),Bo=(e,t)=>{let n=Object.assign(ye(e),fe(e),Ie(e),Lo(e));return t.forEach(e=>e.configure(n)),Object.assign(e,me(n),be(n),ze(n),Ro(n))}})),Ho,Uo=e((()=>{s(),jt(),zt(),u(),o(),$e(),a(),d(),c(),i(),je(),Gt(),Jt(),Io(),Vo(),t(),Ho=class extends ve{constructor(...[e]){let t=Fo(e||{});super(t),n(this,`config`,void 0),this.initConfig=t;let i=Bo(It(kt(Wt(ut(te(r(qe(he(pe(Kt(t)))))))))),e?.extensions||[]);this.config=i,this.middlewareStack.use(Ne(this.config)),this.middlewareStack.use(Se(this.config)),this.middlewareStack.use(ee(this.config)),this.middlewareStack.use(Le(this.config)),this.middlewareStack.use(De(this.config)),this.middlewareStack.use(Oe(this.config)),this.middlewareStack.use(ue(this.config)),this.middlewareStack.use(et(this.config,{httpAuthSchemeParametersProvider:Ht,identityProviderConfigProvider:async e=>new tt({"aws.auth#sigv4":e.credentials,"smithy.api#httpBearerAuth":e.token})})),this.middlewareStack.use(ot(this.config))}destroy(){super.destroy()}}})),Wo,Go,Ko,qo=e((()=>{o(),a(),Jt(),Wo=le(qt,`AmazonBedrockFrontendService`,`BedrockRuntimeClient`,ae),Go={},Ko=(e,t,n,r)=>[]})),Jo=e((()=>{})),Yo=e((()=>{})),Xo=e((()=>{})),Zo,Qo=e((()=>{qo(),$(),Zo=class extends Wo(Go,Ko,`CountTokens`,Mo){}})),$o=e((()=>{})),es=e((()=>{})),ts=e((()=>{})),ns=e((()=>{})),rs=e((()=>{})),is=e((()=>{})),as=e((()=>{})),os=e((()=>{})),ss=e((()=>{})),cs=e((()=>{Jo(),Yo(),Xo(),Qo(),$o(),es(),ts(),ns(),rs(),is(),as()})),ls=e((()=>{})),us=e((()=>{ls(),os()})),ds=e((()=>{})),fs=e((()=>{})),ps=e((()=>{Uo(),ss(),cs(),$(),us(),ds(),qn(),fs(),b()}));export{Ka as $,G as A,ja as At,Va as B,Vn as Bt,Fa as C,Ao as Ct,go as D,Z as Dt,Ia as E,Aa as Et,Mo as F,Un as Ft,q as G,y as Gt,xo as H,Ln as Ht,bo as I,Wn as It,Co as J,Q as K,b as Kt,za as L,Kn as Lt,xa as M,Fn as Mt,yo as N,zn as Nt,_o as O,jo as Ot,Ra as P,In as Pt,Sa as Q,Ba as R,Gn as Rt,ho as S,eo as St,W as T,no as Tt,Ua as U,Rn as Ut,Ha as V,Hn as Vt,So as W,qn as Wt,J as X,Ga as Y,wo as Z,Ho as _,ka as _t,as as a,To as at,Na as b,$a as bt,ns as c,Y as ct,$o as d,Xa as dt,qa as et,Zo as f,Da as ft,Jo as g,Qa as gt,Yo as h,Eo as ht,os as i,Ta as it,La as j,$ as jt,vo as k,ro as kt,ts as l,X as lt,Xo as m,Za as mt,ds as n,wa as nt,is as o,Ja as ot,Qo as p,Oa as pt,Wa as q,ss as r,U as rt,rs as s,Ea as st,ps as t,Ca as tt,es as u,Ya as ut,Uo as v,Do as vt,ya as w,to as wt,Pa as x,ko as xt,ba as y,Oo as yt,K as z,Bn as zt};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{C as r,D as i,E as ee,F as a,I as te,L as ne,M as re,O as ie,P as ae,U as oe,V as se,X as ce,Y as le,_ as ue,d as de,et as fe,g as pe,i as me,j as he,k as ge,l as _e,mt as ve,n as ye,nt as be,ot as xe,p as Se,q as o,rt as Ce,s as we,st as Te,t as s,vt as Ee,x as De,y as Oe,z as ke}from"./client-DvAL7lY8.js";import{B as Ae,D as je,H as Me,M as Ne,O as Pe,Y as Fe,c as Ie,o as Le,q as Re,t as c,u as ze}from"./protocols-CnYQjBlj.js";import{B as Be,H as Ve,L as He,c as Ue,d as We,r as Ge,z as Ke}from"./serde-f76bObzR.js";import{a as qe,d as Je,l as Ye,m as l,o as Xe,r as Ze,s as Qe,t as $e}from"./config-BSXLgwpD.js";import{C as et,f as tt,i as nt,o as rt,s as it,t as u,u as at,v as ot}from"./dist-es-BF6bR-Ik.js";import{n as st,t as ct}from"./checksum-DgbnMdM-.js";import{C as lt,a as ut,s as dt,t as d}from"./event-streams-DoqJmjFN.js";import{C as ft,_ as pt,c as mt,i as ht,o as gt,t as _t}from"./protocols-CCsohXid.js";import{i as vt,t as yt}from"./dist-es-BSRN-2nA.js";import{i as bt,r as xt,t as St}from"./dist-es-DKIwwJME.js";import{n as Ct,t as wt}from"./dist-es-Bfr4TzQe.js";import{PassThrough as Tt,Readable as Et,Transform as Dt,pipeline as Ot}from"node:stream";function kt(e){let t=e.signer,n=e.signer,r=Object.assign(e,{eventSigner:t,messageSigner:n}),i=r.eventStreamPayloadHandlerProvider(r);return Object.assign(r,{eventStreamPayloadHandler:i})}var At=e((()=>{})),jt=e((()=>{At()})),Mt,Nt=e((()=>{Mt=e=>e.protocol===`ws:`||e.protocol===`wss:`})),Pt,Ft=e((()=>{c(),Nt(),t(),Pt=class{constructor(e){n(this,`signer`,void 0),this.signer=e.signer}presign(e,t={}){return this.signer.presign(e,t)}async sign(e,t){return Re.isInstance(e)&&Mt(e)?{...await this.signer.presign({...e,body:``},{...t,expiresIn:60,unsignableHeaders:new Set(Object.keys(e.headers).filter(e=>e!==`host`))}),body:e.body}:this.signer.sign(e,t)}signMessage(e,t){return this.signer.signMessage(e,t)}}})),It,Lt,Rt=e((()=>{Ft(),It=e=>{let{signer:t}=e;return Object.assign(e,{signer:async e=>{let n=await t(e);if(Lt(n))return new Pt({signer:n});throw Error(`Expected WebsocketSignatureV4 signer, please check the client constructor.`)}})},Lt=e=>!!e})),zt=e((()=>{Nt(),Rt()}));function Bt(e){return{schemeId:`aws.auth#sigv4`,signingProperties:{name:`bedrock`,region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function Vt(e){return{schemeId:`smithy.api#httpBearerAuth`,propertiesExtractor:({profile:e,filepath:t,configFilepath:n,ignoreCache:r},i)=>({identityProperties:{profile:e,filepath:t,configFilepath:n,ignoreCache:r}})}}var Ht,Ut,Wt,Gt=e((()=>{gt(),u(),o(),Ht=async(e,t,n)=>({operation:Fe(t).operation,region:await Me(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),Ut=e=>{let t=[];switch(e.operation){default:t.push(Bt(e)),t.push(Vt(e))}return t},Wt=e=>{let t=it(e.token,rt,nt),n=mt(e);return Object.assign(n,{authSchemePreference:Me(e.authSchemePreference??[]),token:t})}})),Kt,qt,Jt=e((()=>{Kt=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:`bedrock`}),qt={UseFIPS:{type:`builtInParams`,name:`useFipsEndpoint`},Endpoint:{type:`builtInParams`,name:`endpoint`},Region:{type:`builtInParams`,name:`region`},UseDualStack:{type:`builtInParams`,name:`useDualstackEndpoint`}}})),Yt,Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn,mn=e((()=>{Yt=`@aws-sdk/client-bedrock-runtime`,Xt=`AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native`,Zt=`3.1085.0`,Qt={build:`concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs`,"build:cjs":`node ../../scripts/compilation/inline`,"build:es":`premove dist-es && tsc -p tsconfig.es.json`,"build:include:deps":`yarn g:turbo run build -F="$npm_package_name"`,"build:types":`premove dist-types && tsc -p tsconfig.types.json`,"build:types:downlevel":`downlevel-dts dist-types dist-types/ts3.4`,clean:`premove dist-cjs dist-es dist-types`,"extract:docs":`api-extractor run --local`,"generate:client":`node ../../scripts/generate-clients/single-service`,test:`yarn g:vitest run --passWithNoTests`,"test:watch":`yarn g:vitest watch --passWithNoTests`,"test:integration":`yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts`,"test:integration:watch":`yarn g:vitest watch --passWithNoTests -c vitest.config.integ.mts`,"test:e2e":`yarn g:vitest run -c vitest.config.e2e.mts`,"test:e2e:watch":`yarn g:vitest watch -c vitest.config.e2e.mts`,"test:browser":`yarn g:vitest run -c vitest.config.browser.e2e.mts`,"test:browser:watch":`yarn g:vitest watch -c vitest.config.browser.e2e.mts`,"test:index":`tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs`},$t=`./dist-cjs/index.js`,en=`./dist-types/index.d.ts`,tn=`./dist-es/index.js`,nn={"@aws-sdk/core":`^3.975.1`,"@aws-sdk/credential-provider-node":`^3.972.66`,"@aws-sdk/eventstream-handler-node":`^3.972.26`,"@aws-sdk/middleware-eventstream":`^3.972.22`,"@aws-sdk/middleware-websocket":`^3.972.39`,"@aws-sdk/token-providers":`3.1085.0`,"@aws-sdk/types":`^3.974.0`,"@smithy/core":`^3.29.2`,"@smithy/fetch-http-handler":`^5.6.4`,"@smithy/node-http-handler":`^4.9.4`,"@smithy/types":`^4.16.0`,tslib:`^2.6.2`},rn={"@smithy/snapshot-testing":`^2.2.7`,"@tsconfig/node20":`20.1.8`,"@types/node":`^20.14.8`,concurrently:`7.0.0`,"downlevel-dts":`0.10.1`,premove:`4.0.0`,typescript:`~5.8.3`,vitest:`^4.0.17`},an={node:`>=20.0.0`},on={"<4.5":{"dist-types/*":[`dist-types/ts3.4/*`]}},sn=[`dist-*/**`],cn={name:`AWS SDK for JavaScript Team`,url:`https://aws.amazon.com/sdk-for-javascript/`},ln=`Apache-2.0`,un={"./dist-es/runtimeConfig":`./dist-es/runtimeConfig.browser`},dn=`https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-bedrock-runtime`,fn={type:`git`,url:`https://github.com/aws/aws-sdk-js-v3.git`,directory:`clients/client-bedrock-runtime`},pn={name:Yt,description:Xt,version:Zt,scripts:Qt,main:$t,types:en,module:tn,sideEffects:!1,dependencies:nn,devDependencies:rn,engines:an,typesVersions:on,files:sn,author:cn,license:ln,browser:un,"react-native":{"./dist-es/runtimeConfig":`./dist-es/runtimeConfig.native`},homepage:dn,repository:fn}}));function hn(e){let t=Buffer.from(e,`hex`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}var gn,_n=e((()=>{t(),gn=class extends Dt{constructor(e){super({autoDestroy:!0,readableObjectMode:!0,writableObjectMode:!0,...e}),n(this,`priorSignature`,void 0),n(this,`messageSigner`,void 0),n(this,`eventStreamCodec`,void 0),n(this,`systemClockOffsetProvider`,void 0),n(this,`staticCredentials`,void 0),this.priorSignature=e.priorSignature,this.eventStreamCodec=e.eventStreamCodec,this.messageSigner=e.messageSigner,this.systemClockOffsetProvider=e.systemClockOffsetProvider,this.staticCredentials=e.credentials?.()}async _transform(e,t,n){try{let t=new Date(Date.now()+await this.systemClockOffsetProvider()),r={":date":{type:`timestamp`,value:t}},i=await this.messageSigner.sign({message:{body:e,headers:r},priorSignature:this.priorSignature},{signingDate:t,eventStreamCredentials:await this.staticCredentials});this.priorSignature=i.signature;let ee=this.eventStreamCodec.encode({headers:{...r,":chunk-signature":{type:`binary`,value:hn(i.signature)}},body:e});return this.push(ee),n()}catch(e){n(e)}}}})),vn,yn=e((()=>{d(),_n(),t(),vn=class{constructor(e){n(this,`messageSigner`,void 0),n(this,`eventStreamCodec`,void 0),n(this,`systemClockOffsetProvider`,void 0),n(this,`credentials`,void 0),this.messageSigner=e.messageSigner,this.eventStreamCodec=new lt(e.utf8Encoder,e.utf8Decoder),this.systemClockOffsetProvider=async()=>e.systemClockOffset??0,this.credentials=e.credentials}async handle(e,t,n={}){let r=t.request,{body:i,query:ee}=r;if(!(i instanceof Et))throw Error(`Eventstream payload must be a Readable stream.`);let a=i;r.body=new Tt({objectMode:!0});let te=r.headers?.authorization?.match(/Signature=([\w]+)$/)?.[1]??ee?.[`X-Amz-Signature`]??``;n.__staticSignature&&(te=``);let ne=new gn({priorSignature:te,eventStreamCodec:this.eventStreamCodec,messageSigner:await this.messageSigner(),systemClockOffsetProvider:this.systemClockOffsetProvider,credentials:this.credentials}),re,ie=new Promise((e,t)=>{re=()=>e(void 0),Ot(a,ne,r.body,e=>{e&&t(Error(`Pipeline error in @aws-sdk/eventstream-handler-node: ${e.message}`,{cause:e}))})}),ae;try{ae=await Promise.race([e(t),ie])}catch(e){throw r.body.end(),e}finally{re()}return ae}}})),bn,xn=e((()=>{yn(),bn=e=>new vn(e)})),Sn=e((()=>{xn()})),f,p,m,Cn,wn,h,Tn,En,g,_,v,Dn,On,kn,An,jn=e((()=>{a(),f=`ref`,p=-1,m=!0,Cn=`isSet`,wn=`PartitionResult`,h=`booleanEquals`,Tn=`getAttr`,En={[f]:`Endpoint`},g={[f]:wn},_={},v=[{[f]:`Region`}],Dn={conditions:[[Cn,[En]],[Cn,v],[`aws.partition`,v,wn],[h,[{[f]:`UseFIPS`},m]],[h,[{[f]:`UseDualStack`},m]],[h,[{fn:Tn,argv:[g,`supportsDualStack`]},m]],[h,[{fn:Tn,argv:[g,`supportsFIPS`]},m]]],results:[[p],[p,`Invalid Configuration: FIPS and custom endpoint are not supported`],[p,`Invalid Configuration: Dualstack and custom endpoint are not supported`],[En,_],[`https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}`,_],[p,`FIPS and DualStack are enabled, but this partition does not support one or both`],[`https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}`,_],[p,`FIPS is enabled but this partition does not support FIPS`],[`https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}`,_],[p,`DualStack is enabled but this partition does not support DualStack`],[`https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}`,_],[p,`Invalid Configuration: Missing Region`]]},On=2,kn=new Int32Array([-1,1,-1,0,12,3,1,4,100000011,2,5,100000011,3,8,6,4,7,100000010,5,100000008,100000009,4,10,9,6,100000006,100000007,5,11,100000005,6,100000004,100000005,3,100000001,13,4,100000002,100000003]),An=oe.from(kn,On,Dn.conditions,Dn.results)})),Mn,Nn,Pn=e((()=>{s(),a(),jn(),Mn=new se({size:50,params:[`Endpoint`,`Region`,`UseDualStack`,`UseFIPS`]}),Nn=(e,t={})=>Mn.get(e,()=>ne(An,{endpointParams:e,logger:t.logger})),ke.aws=we})),y,b=e((()=>{o(),y=class e extends Te{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}})),Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn=e((()=>{b(),t(),Fn=class e extends y{constructor(t){super({name:`AccessDeniedException`,$fault:`client`,...t}),n(this,`name`,`AccessDeniedException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},In=class e extends y{constructor(t){super({name:`InternalServerException`,$fault:`server`,...t}),n(this,`name`,`InternalServerException`),n(this,`$fault`,`server`),Object.setPrototypeOf(this,e.prototype)}},Ln=class e extends y{constructor(t){super({name:`ThrottlingException`,$fault:`client`,...t}),n(this,`name`,`ThrottlingException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},Rn=class e extends y{constructor(t){super({name:`ValidationException`,$fault:`client`,...t}),n(this,`name`,`ValidationException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},zn=class e extends y{constructor(t){super({name:`ConflictException`,$fault:`client`,...t}),n(this,`name`,`ConflictException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},Bn=class e extends y{constructor(t){super({name:`ResourceNotFoundException`,$fault:`client`,...t}),n(this,`name`,`ResourceNotFoundException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},Vn=class e extends y{constructor(t){super({name:`ServiceQuotaExceededException`,$fault:`client`,...t}),n(this,`name`,`ServiceQuotaExceededException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},Hn=class e extends y{constructor(t){super({name:`ServiceUnavailableException`,$fault:`server`,...t}),n(this,`name`,`ServiceUnavailableException`),n(this,`$fault`,`server`),Object.setPrototypeOf(this,e.prototype)}},Un=class e extends y{constructor(t){super({name:`ModelErrorException`,$fault:`client`,...t}),n(this,`name`,`ModelErrorException`),n(this,`$fault`,`client`),n(this,`originalStatusCode`,void 0),n(this,`resourceName`,void 0),Object.setPrototypeOf(this,e.prototype),this.originalStatusCode=t.originalStatusCode,this.resourceName=t.resourceName}},Wn=class e extends y{constructor(t){super({name:`ModelNotReadyException`,$fault:`client`,...t}),n(this,`name`,`ModelNotReadyException`),n(this,`$fault`,`client`),n(this,`$retryable`,{}),Object.setPrototypeOf(this,e.prototype)}},Gn=class e extends y{constructor(t){super({name:`ModelTimeoutException`,$fault:`client`,...t}),n(this,`name`,`ModelTimeoutException`),n(this,`$fault`,`client`),Object.setPrototypeOf(this,e.prototype)}},Kn=class e extends y{constructor(t){super({name:`ModelStreamErrorException`,$fault:`client`,...t}),n(this,`name`,`ModelStreamErrorException`),n(this,`$fault`,`client`),n(this,`originalStatusCode`,void 0),n(this,`originalMessage`,void 0),Object.setPrototypeOf(this,e.prototype),this.originalStatusCode=t.originalStatusCode,this.originalMessage=t.originalMessage}}})),Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,ir,ar,or,sr,cr,lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br,xr,Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,x,yi,bi,S,xi,C,w,T,Si,Ci,wi,Ti,E,Ei,Di,Oi,D,O,ki,k,A,j,Ai,M,ji,Mi,Ni,Pi,N,Fi,Ii,P,Li,Ri,F,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,I,Yi,Xi,Zi,Qi,$i,ea,L,ta,R,na,ra,ia,aa,oa,sa,ca,la,ua,z,da,fa,pa,B,ma,ha,ga,_a,V,va,ya,H,ba,xa,Sa,Ca,wa,U,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,W,Ia,G,La,Ra,za,Ba,K,Va,Ha,Ua,q,Wa,Ga,J,Ka,qa,Ja,Y,X,Ya,Xa,Za,Qa,$a,eo,to,no,Z,ro,io,ao,oo,so,co,lo,uo,fo,po,mo,ho,go,_o,vo,yo,bo,xo,So,Q,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,$=e((()=>{je(),b(),qn(),Jn=`AudioBlock`,Yn=`AccessDeniedException`,Xn=`AudioSource`,Zn=`AnyToolChoice`,Qn=`AutoToolChoice`,$n=`Body`,er=`Citation`,tr=`ContentBlocks`,nr=`ContentBlock`,rr=`CitationsConfig`,ir=`CitationsContentBlock`,ar=`ConflictException`,or=`CitationGeneratedContent`,sr=`CitationGeneratedContentList`,cr=`CitationLocation`,lr=`CachePointBlock`,ur=`CitationSourceContent`,dr=`CitationSourceContentList`,fr=`CountTokensInput`,pr=`ConverseTokensRequest`,mr=`CountTokensRequest`,hr=`CountTokensResponse`,gr=`CountTokens`,_r=`Citations`,vr=`DocumentBlock`,yr=`DocumentContentBlocks`,br=`DocumentContentBlock`,xr=`DocumentCharLocation`,Sr=`DocumentChunkLocation`,Cr=`DocumentPageLocation`,wr=`DocumentSource`,Tr=`ErrorBlock`,Er=`GuardrailConverseContentBlock`,Dr=`GuardrailConverseImageBlock`,Or=`GuardrailConverseImageSource`,kr=`GuardrailConverseTextBlock`,Ar=`ImageBlock`,jr=`InvokeModelTokensRequest`,Mr=`ImageSource`,Nr=`InternalServerException`,Pr=`Message`,Fr=`ModelErrorException`,Ir=`ModelNotReadyException`,Lr=`ModelStreamErrorException`,Rr=`ModelTimeoutException`,zr=`Messages`,Br=`ReasoningContentBlock`,Vr=`ResourceNotFoundException`,Hr=`ReasoningTextBlock`,Ur=`SystemContentBlocks`,Wr=`SystemContentBlock`,Gr=`S3Location`,Kr=`ServiceQuotaExceededException`,qr=`SearchResultBlock`,Jr=`SearchResultContentBlock`,Yr=`SearchResultContentBlocks`,Xr=`SearchResultLocation`,Zr=`SpecificToolChoice`,Qr=`SystemTool`,$r=`ServiceUnavailableException`,ei=`ToolConfiguration`,ti=`ToolChoice`,ni=`ThrottlingException`,ri=`ToolInputSchema`,ii=`ToolResultBlock`,ai=`ToolResultContentBlocks`,oi=`ToolResultContentBlock`,si=`ToolSpecification`,ci=`ToolUseBlock`,li=`Tools`,ui=`Tool`,di=`VideoBlock`,fi=`ValidationException`,pi=`VideoSource`,mi=`WebLocation`,hi=`additionalModelRequestFields`,gi=`any`,_i=`audio`,vi=`auto`,x=`bytes`,yi=`bucketOwner`,bi=`body`,S=`client`,xi=`citationsContent`,C=`cachePoint`,w=`citations`,T=`content`,Si=`context`,Ci=`converse`,wi=`documentChar`,Ti=`documentChunk`,E=`documentIndex`,Ei=`documentPage`,Di=`description`,Oi=`domain`,D=`document`,O=`error`,ki=`enabled`,k=`end`,A=`format`,j=`guardContent`,Ai=`http`,M=`httpError`,ji=`input`,Mi=`invokeModel`,Ni=`inputSchema`,Pi=`inputTokens`,N=`image`,Fi=`json`,Ii=`location`,P=`message`,Li=`modelId`,Ri=`messages`,F=`name`,zi=`originalMessage`,Bi=`originalStatusCode`,Vi=`qualifiers`,Hi=`reasoningContent`,Ui=`redactedContent`,Wi=`resourceName`,Gi=`reasoningText`,Ki=`role`,qi=`smithy.ts.sdk.synthetic.com.amazonaws.bedrockruntime`,Ji=`sourceContent`,I=`s3Location`,Yi=`searchResultIndex`,Xi=`searchResultLocation`,Zi=`searchResult`,Qi=`systemTool`,$i=`server`,ea=`signature`,L=`source`,ta=`status`,R=`start`,na=`strict`,ra=`system`,ia=`ttl`,aa=`toolConfig`,oa=`toolChoice`,sa=`toolResult`,ca=`toolSpec`,la=`toolUseId`,ua=`toolUse`,z=`text`,da=`title`,fa=`tools`,pa=`tool`,B=`type`,ma=`uri`,ha=`url`,ga=`video`,_a=`web`,V=`com.amazonaws.bedrockruntime`,va=Pe.for(qi),ya=[-3,qi,`BedrockRuntimeServiceException`,0,[],[]],va.registerError(ya,y),H=Pe.for(V),ba=[-3,V,Yn,{[O]:S,[M]:403},[P],[0]],H.registerError(ba,Fn),xa=[-3,V,ar,{[O]:S,[M]:400},[P],[0]],H.registerError(xa,zn),Sa=[-3,V,Nr,{[O]:$i,[M]:500},[P],[0]],H.registerError(Sa,In),Ca=[-3,V,Fr,{[O]:S,[M]:424},[P,Bi,Wi],[0,1,0]],H.registerError(Ca,Un),wa=[-3,V,Ir,{[O]:S,[M]:429},[P],[0]],H.registerError(wa,Wn),U=[-3,V,Lr,{[O]:S,[M]:424},[P,Bi,zi],[0,1,0]],H.registerError(U,Kn),Ta=[-3,V,Rr,{[O]:S,[M]:408},[P],[0]],H.registerError(Ta,Gn),Ea=[-3,V,Vr,{[O]:S,[M]:404},[P],[0]],H.registerError(Ea,Bn),Da=[-3,V,Kr,{[O]:S,[M]:400},[P],[0]],H.registerError(Da,Vn),Oa=[-3,V,$r,{[O]:$i,[M]:503},[P],[0]],H.registerError(Oa,Hn),ka=[-3,V,ni,{[O]:S,[M]:429},[P],[0]],H.registerError(ka,Ln),Aa=[-3,V,fi,{[O]:S,[M]:400},[P],[0]],H.registerError(Aa,Rn),ja=[va,H],Ma=[0,V,$n,8,21],Na=[3,V,Zn,0,[],[]],Pa=[3,V,Jn,0,[A,L,O],[0,[()=>ho,0],[()=>q,0]],2],Fa=[3,V,Qn,0,[],[]],W=[3,V,lr,0,[B,ia],[0,0],1],Ia=[3,V,er,0,[da,L,Ji,Ii],[0,0,()=>oo,()=>_o]],G=[3,V,rr,0,[ki],[2],1],La=[3,V,ir,0,[T,w],[()=>io,()=>ao]],Ra=[3,V,pr,0,[Ri,ra,aa,hi],[[()=>lo,0],[()=>fo,0],()=>$a,15]],za=[3,V,mr,0,[Li,ji],[[0,1],[()=>bo,0]],2],Ba=[3,V,hr,0,[Pi],[1],1],K=[3,V,vr,0,[F,L,A,Si,w],[0,()=>So,0,0,()=>G],2],Va=[3,V,xr,0,[E,R,k],[1,1,1]],Ha=[3,V,Sr,0,[E,R,k],[1,1,1]],Ua=[3,V,Cr,0,[E,R,k],[1,1,1]],q=[3,V,Tr,8,[P],[0]],Wa=[3,V,Dr,8,[A,L],[0,[()=>Co,0]],2],Ga=[3,V,kr,0,[z,Vi],[0,64],1],J=[3,V,Ar,0,[A,L,O],[0,[()=>wo,0],[()=>q,0]],2],Ka=[3,V,jr,0,[bi],[[()=>Ma,0]],1],qa=[3,V,Pr,0,[Ki,T],[0,[()=>so,0]],2],Ja=[3,V,Hr,8,[z,ea],[0,0],1],Y=[3,V,Gr,0,[ma,yi],[0,0],1],X=[3,V,qr,0,[L,da,T,w],[0,0,()=>uo,()=>G],3],Ya=[3,V,Jr,0,[z],[0],1],Xa=[3,V,Xr,0,[Yi,R,k],[1,1,1]],Za=[3,V,Zr,0,[F],[0],1],Qa=[3,V,Qr,0,[F],[0],1],$a=[3,V,ei,0,[fa,oa],[()=>mo,()=>Oo],1],eo=[3,V,ii,0,[la,T,ta,B],[0,[()=>po,0],0,0],2],to=[3,V,si,0,[F,Ni,Di,na],[0,()=>ko,0,2],2],no=[3,V,ci,0,[la,F,ji,B],[0,0,15,0],3],Z=[3,V,di,0,[A,L],[0,()=>jo],2],ro=[3,V,mi,0,[ha,Oi],[0,0]],io=[1,V,sr,0,()=>go],ao=[1,V,_r,0,()=>Ia],oo=[1,V,dr,0,()=>vo],so=[1,V,tr,0,[()=>yo,0]],co=[1,V,yr,0,()=>xo],lo=[1,V,zr,0,[()=>qa,0]],uo=[1,V,Yr,0,()=>Ya],fo=[1,V,Ur,0,[()=>Eo,0]],po=[1,V,ai,0,[()=>Ao,0]],mo=[1,V,li,0,()=>Do],ho=[4,V,Xn,8,[x,I],[21,()=>Y]],go=[4,V,or,0,[z],[0]],_o=[4,V,cr,0,[_a,wi,Ei,Ti,Xi],[()=>ro,()=>Va,()=>Ua,()=>Ha,()=>Xa]],vo=[4,V,ur,0,[z],[0]],yo=[4,V,nr,0,[z,N,D,ga,_i,ua,sa,j,C,Hi,xi,Zi],[0,[()=>J,0],()=>K,()=>Z,[()=>Pa,0],()=>no,[()=>eo,0],[()=>Q,0],()=>W,[()=>To,0],()=>La,()=>X]],bo=[4,V,fr,0,[Mi,Ci],[[()=>Ka,0],[()=>Ra,0]]],xo=[4,V,br,0,[z],[0]],So=[4,V,wr,0,[x,I,z,T],[21,()=>Y,0,()=>co]],Q=[4,V,Er,0,[z,N],[()=>Ga,[()=>Wa,0]]],Co=[4,V,Or,8,[x],[21]],wo=[4,V,Mr,8,[x,I],[21,()=>Y]],To=[4,V,Br,8,[Gi,Ui],[[()=>Ja,0],21]],Eo=[4,V,Wr,0,[z,j,C],[0,[()=>Q,0],()=>W]],Do=[4,V,ui,0,[ca,Qi,C],[()=>to,()=>Qa,()=>W]],Oo=[4,V,ti,0,[vi,gi,pa],[()=>Fa,()=>Na,()=>Za]],ko=[4,V,ri,0,[Fi],[15]],Ao=[4,V,oi,0,[Fi,z,N,D,ga,Zi],[15,0,[()=>J,0],()=>K,()=>Z,()=>X]],jo=[4,V,pi,0,[x,I],[21,()=>Y]],Mo=[9,V,gr,{[Ai]:[`POST`,`/model/{modelId}/count-tokens`,200]},()=>za,()=>Ba]})),No,Po=e((()=>{gt(),_t(),u(),ct(),o(),c(),Ge(),Gt(),Pn(),$(),No=e=>({apiVersion:`2023-09-30`,base64Decoder:e?.base64Decoder??Ve,base64Encoder:e?.base64Encoder??Ke,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Nn,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Ut,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:`aws.auth#sigv4`,identityProvider:e=>e.getIdentityProvider(`aws.auth#sigv4`),signer:new ft},{schemeId:`smithy.api#httpBearerAuth`,identityProvider:e=>e.getIdentityProvider(`smithy.api#httpBearerAuth`),signer:new at}],logger:e?.logger??new ce,protocol:e?.protocol??ht,protocolSettings:e?.protocolSettings??{defaultNamespace:`com.amazonaws.bedrockruntime`,errorTypeRegistries:ja,version:`2023-09-30`,serviceTarget:`AmazonBedrockFrontendService`},serviceId:e?.serviceId??`Bedrock Runtime`,sha256:e?.sha256??st,urlParser:e?.urlParser??Ae,utf8Decoder:e?.utf8Decoder??Be,utf8Encoder:e?.utf8Encoder??He})})),Fo,Io=e((()=>{mn(),s(),gt(),yt(),Sn(),St(),u(),o(),$e(),d(),i(),Ge(),wt(),Po(),Fo=e=>{Ce(process.version);let t=Ze(e),n=()=>t().then(xe),r=No(e);Ee(process.version);let i={profile:e?.profile,logger:r.logger,signingName:`bedrock`};return{...r,...e,runtime:`node`,defaultsMode:t,authSchemePreference:e?.authSchemePreference??l(pt,i),bodyLengthChecker:e?.bodyLengthChecker??We,credentialDefaultProvider:e?.credentialDefaultProvider??vt,defaultUserAgentProvider:e?.defaultUserAgentProvider??de({serviceId:r.serviceId,clientVersion:pn.version}),eventStreamPayloadHandlerProvider:e?.eventStreamPayloadHandlerProvider??bn,eventStreamSerdeProvider:e?.eventStreamSerdeProvider??dt,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:`aws.auth#sigv4`,identityProvider:e=>e.getIdentityProvider(`aws.auth#sigv4`),signer:new ft},{schemeId:`smithy.api#httpBearerAuth`,identityProvider:e=>e.getIdentityProvider(`smithy.api#httpBearerAuth`)||(async e=>{try{return await bt({signingName:`bedrock`})()}catch{return await xt(e)(e)}}),signer:new at}],maxAttempts:e?.maxAttempts??l(ie,e),region:e?.region??l(Qe,{...Xe,...i}),requestHandler:Ct.create(e?.requestHandler??(async()=>({...await n(),disableConcurrentStreams:!0}))),retryMode:e?.retryMode??l({...ge,default:async()=>(await n()).retryMode||re},e),streamCollector:e?.streamCollector??Ue,useDualstackEndpoint:e?.useDualstackEndpoint??l(Je,i),useFipsEndpoint:e?.useFipsEndpoint??l(Ye,i),userAgentAppId:e?.userAgentAppId??l(_e,i)}}})),Lo,Ro,zo=e((()=>{Lo=e=>{let t=e.httpAuthSchemes,n=e.httpAuthSchemeProvider,r=e.credentials,i=e.token;return{setHttpAuthScheme(e){let n=t.findIndex(t=>t.schemeId===e.schemeId);n===-1?t.push(e):t.splice(n,1,e)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider(){return n},setCredentials(e){r=e},credentials(){return r},setToken(e){i=e},token(){return i}}},Ro=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials(),token:e.token()})})),Bo,Vo=e((()=>{s(),o(),c(),zo(),Bo=(e,t)=>{let n=Object.assign(ye(e),fe(e),Ie(e),Lo(e));return t.forEach(e=>e.configure(n)),Object.assign(e,me(n),be(n),ze(n),Ro(n))}})),Ho,Uo=e((()=>{s(),jt(),zt(),u(),o(),$e(),a(),d(),c(),i(),je(),Gt(),Jt(),Io(),Vo(),t(),Ho=class extends ve{constructor(...[e]){let t=Fo(e||{});super(t),n(this,`config`,void 0),this.initConfig=t;let i=Bo(It(kt(Wt(ut(te(r(qe(he(pe(Kt(t)))))))))),e?.extensions||[]);this.config=i,this.middlewareStack.use(Ne(this.config)),this.middlewareStack.use(Se(this.config)),this.middlewareStack.use(ee(this.config)),this.middlewareStack.use(Le(this.config)),this.middlewareStack.use(De(this.config)),this.middlewareStack.use(Oe(this.config)),this.middlewareStack.use(ue(this.config)),this.middlewareStack.use(et(this.config,{httpAuthSchemeParametersProvider:Ht,identityProviderConfigProvider:async e=>new tt({"aws.auth#sigv4":e.credentials,"smithy.api#httpBearerAuth":e.token})})),this.middlewareStack.use(ot(this.config))}destroy(){super.destroy()}}})),Wo,Go,Ko,qo=e((()=>{o(),a(),Jt(),Wo=le(qt,`AmazonBedrockFrontendService`,`BedrockRuntimeClient`,ae),Go={},Ko=(e,t,n,r)=>[]})),Jo=e((()=>{})),Yo=e((()=>{})),Xo=e((()=>{})),Zo,Qo=e((()=>{qo(),$(),Zo=class extends Wo(Go,Ko,`CountTokens`,Mo){}})),$o=e((()=>{})),es=e((()=>{})),ts=e((()=>{})),ns=e((()=>{})),rs=e((()=>{})),is=e((()=>{})),as=e((()=>{})),os=e((()=>{})),ss=e((()=>{})),cs=e((()=>{Jo(),Yo(),Xo(),Qo(),$o(),es(),ts(),ns(),rs(),is(),as()})),ls=e((()=>{})),us=e((()=>{ls(),os()})),ds=e((()=>{})),fs=e((()=>{})),ps=e((()=>{Uo(),ss(),cs(),$(),us(),ds(),qn(),fs(),b()}));export{Ka as $,G as A,ja as At,Va as B,Vn as Bt,Fa as C,Ao as Ct,go as D,Z as Dt,Ia as E,Aa as Et,Mo as F,Un as Ft,q as G,y as Gt,xo as H,Ln as Ht,bo as I,Wn as It,Co as J,Q as K,b as Kt,za as L,Kn as Lt,xa as M,Fn as Mt,yo as N,zn as Nt,_o as O,jo as Ot,Ra as P,In as Pt,Sa as Q,Ba as R,Gn as Rt,ho as S,eo as St,W as T,no as Tt,Ua as U,Rn as Ut,Ha as V,Hn as Vt,So as W,qn as Wt,J as X,Ga as Y,wo as Z,Ho as _,ka as _t,as as a,To as at,Na as b,$a as bt,ns as c,Y as ct,$o as d,Xa as dt,qa as et,Zo as f,Da as ft,Jo as g,Qa as gt,Yo as h,Eo as ht,os as i,Ta as it,La as j,$ as jt,vo as k,ro as kt,ts as l,X as lt,Xo as m,Za as mt,ds as n,wa as nt,is as o,Ja as ot,Qo as p,Oa as pt,Wa as q,ss as r,U as rt,rs as s,Ea as st,ps as t,Ca as tt,es as u,Ya as ut,Uo as v,Do as vt,ya as w,to as wt,Pa as x,ko as xt,ba as y,Oo as yt,K as z,Bn as zt};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,t as n}from"./dist-es-BSRN-2nA.js";import"./dist-es-Cd_AeqMK.js";var r=e((()=>{})),i=e((()=>{})),a=e((()=>{})),o=e((()=>{})),s=e((()=>{})),c=e((()=>{})),l=e((()=>{})),u=e((()=>{})),d,f=e((()=>{n(),d=(e={})=>t({...e})})),p=e((()=>{})),m=e((()=>{})),h=e((()=>{})),g=e((()=>{})),_=e((()=>{}));e((()=>{r(),i(),a(),o(),s(),c(),l(),u(),f(),p(),m(),h(),g(),_()}))();export{d as fromNodeProviderChain};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./dist-es-B3-7VFf2.js";t();export{e as fromIni};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Doctor-DqW6j3_B.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};
@@ -1,6 +1,6 @@
1
- import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{A_ as n,B as r,Cc as i,E_ as a,Gl as o,Kl as s,Os as c,Pi as l,Sc as u,V as d,i as f,ir as p,ki as m,ks as h,o as g,vr as _}from"./loadAgentsDir-C1LkW7gl.js";import{$ as v,A as y,F as b,G as x,P as S,Q as C,V as w,W as T,Y as E,Z as D,tt as ee,x as te,z as O}from"./types-zk5Ltv5q.js";import{Mn as k,Yn as A,Z as ne,ar as re,dt as ie,or as ae,zt as j}from"./state-BowF111d.js";import{Cr as oe,d as se,h as ce,pr as le,yr as ue}from"./settings-DKN4xSpQ.js";import{m as de,r as fe}from"./config-BddEvZZl.js";import{f as pe,s as me}from"./model-BwBE0Pt5.js";import{_n as he,vn as ge}from"./prompt-BGqgPgCU.js";import{t as _e}from"./conversationRecovery-Da_8uldZ.js";import{t as ve}from"./QueryEngine-DNNy1UCD.js";import{n as ye,r as be}from"./modelOptions-DvNBapgG.js";import{n as xe,r as Se}from"./managedEnv-lybrMred.js";import{dirname as Ce}from"node:path";import{randomUUID as M}from"node:crypto";import{Readable as we,Writable as Te}from"node:stream";import{unlink as Ee}from"node:fs/promises";import*as N from"node:path/posix";import{isAbsolute as De,resolve as Oe}from"node:path/posix";te();var P={authenticate:`authenticate`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_focus:`document/didFocus`,document_did_open:`document/didOpen`,document_did_save:`document/didSave`,initialize:`initialize`,logout:`logout`,nes_accept:`nes/accept`,nes_close:`nes/close`,nes_reject:`nes/reject`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,session_cancel:`session/cancel`,session_close:`session/close`,session_fork:`session/fork`,session_list:`session/list`,session_load:`session/load`,session_new:`session/new`,session_prompt:`session/prompt`,session_resume:`session/resume`,session_set_config_option:`session/set_config_option`,session_set_mode:`session/set_mode`,session_set_model:`session/set_model`},F={elicitation_complete:`elicitation/complete`,elicitation_create:`elicitation/create`,fs_read_text_file:`fs/read_text_file`,fs_write_text_file:`fs/write_text_file`,session_request_permission:`session/request_permission`,session_update:`session/update`,terminal_create:`terminal/create`,terminal_kill:`terminal/kill`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`},ke=x({_meta:E(D(),v()).nullish(),terminal:b().optional().default(!1)}),Ae=x({_meta:E(D(),v()).nullish(),label:D().nullish(),name:D(),optional:b().optional().default(!1),secret:b().optional().default(!0)}),je=x({_meta:E(D(),v()).nullish(),description:D().nullish(),id:D(),name:D()}),Me=x({_meta:E(D(),v()).nullish(),description:D().nullish(),id:D(),link:D().nullish(),name:D(),vars:S(Ae)}),Ne=x({_meta:E(D(),v()).nullish(),args:S(D()).optional(),description:D().nullish(),env:E(D(),D()).optional(),id:D(),name:D()}),Pe=C([Me.and(x({type:w(`env_var`)})),Ne.and(x({type:w(`terminal`)})),je]),Fe=x({_meta:E(D(),v()).nullish(),methodId:D()}),Ie=x({_meta:E(D(),v()).nullish()}),Le=x({_meta:E(D(),v()).nullish(),blob:D(),mimeType:D().nullish(),uri:D()}),Re=x({default:b().nullish(),description:D().nullish(),title:D().nullish()}),ze=x({_meta:E(D(),v()).nullish()}),Be=x({_meta:E(D(),v()).nullish()}),Ve=x({amount:T(),currency:D()}),He=x({_meta:E(D(),v()).nullish(),terminalId:D()}),Ue=x({_meta:E(D(),v()).nullish(),newText:D(),oldText:D().nullish(),path:D()}),We=C([D(),T(),T(),b(),S(D())]),Ge=O(C([x({content:E(D(),We).nullish()}).and(x({action:w(`accept`)})),x({action:w(`decline`)}),x({action:w(`cancel`)})]),x({_meta:E(D(),v()).nullish()})),Ke=x({_meta:E(D(),v()).nullish()}),qe=D(),Je=x({_meta:E(D(),v()).nullish(),elicitationId:qe}),Ye=w(`object`),Xe=w(`string`),Ze=x({_meta:E(D(),v()).nullish()}),Qe=x({_meta:E(D(),v()).nullish(),form:Ke.nullish(),url:Ze.nullish()}),$e=x({const:D(),title:D()}),et=x({_meta:E(D(),v()).nullish(),name:D(),value:D()}),tt=x({code:C([w(-32700),w(-32600),w(-32601),w(-32602),w(-32603),w(-32800),w(-32e3),w(-32002),w(-32042),T().int().min(-2147483648,{message:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{message:`Invalid value: Expected int32 to be <= 2147483647`})]),data:v().optional(),message:D()}),nt=v(),rt=v(),it=v(),at=x({_meta:E(D(),v()).nullish(),readTextFile:b().optional().default(!1),writeTextFile:b().optional().default(!1)}),ot=x({_meta:E(D(),v()).nullish(),name:D(),value:D()}),st=x({_meta:E(D(),v()).nullish(),name:D(),title:D().nullish(),version:D()}),ct=x({default:T().nullish(),description:D().nullish(),maximum:T().nullish(),minimum:T().nullish(),title:D().nullish()}),lt=x({_meta:E(D(),v()).nullish()}),ut=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cursor:D().nullish(),cwd:D().nullish()}),dt=x({_meta:E(D(),v()).nullish()}),ft=x({_meta:E(D(),v()).nullish(),logout:dt.nullish()}),pt=x({_meta:E(D(),v()).nullish()}),mt=x({_meta:E(D(),v()).nullish()}),ht=x({_meta:E(D(),v()).nullish(),http:b().optional().default(!1),sse:b().optional().default(!1)}),gt=x({_meta:E(D(),v()).nullish(),headers:S(ot),name:D(),url:D()}),_t=x({_meta:E(D(),v()).nullish(),headers:S(ot),name:D(),url:D()}),vt=x({_meta:E(D(),v()).nullish(),args:S(D()),command:D(),env:S(et),name:D()}),I=C([gt.and(x({type:w(`http`)})),_t.and(x({type:w(`sse`)})),vt]),yt=D(),bt=x({_meta:E(D(),v()).nullish(),description:D().nullish(),modelId:yt,name:D()}),xt=C([w(`error`),w(`warning`),w(`information`),w(`hint`)]),St=x({_meta:E(D(),v()).nullish()}),Ct=x({_meta:E(D(),v()).nullish()}),wt=x({_meta:E(D(),v()).nullish()}),Tt=x({_meta:E(D(),v()).nullish()}),Et=x({_meta:E(D(),v()).nullish()}),Dt=x({_meta:E(D(),v()).nullish(),maxCount:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Ot=x({diff:D(),uri:D()}),kt=x({endLine:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),startLine:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),text:D()}),At=x({_meta:E(D(),v()).nullish()}),jt=x({_meta:E(D(),v()).nullish()}),Mt=x({languageId:D(),text:D(),uri:D()}),Nt=x({_meta:E(D(),v()).nullish(),maxCount:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Pt=C([w(`rejected`),w(`ignored`),w(`replaced`),w(`cancelled`)]),Ft=x({excerpts:S(kt),uri:D()}),It=x({_meta:E(D(),v()).nullish()}),Lt=x({_meta:E(D(),v()).nullish()}),Rt=x({name:D(),owner:D(),remoteUrl:D()}),zt=x({_meta:E(D(),v()).nullish()}),Bt=x({_meta:E(D(),v()).nullish(),jump:At.nullish(),rename:Lt.nullish(),searchAndReplace:zt.nullish()}),Vt=x({id:D(),isRegex:b().nullish(),replace:D(),search:D(),uri:D()}),Ht=C([w(`automatic`),w(`diagnostic`),w(`manual`)]),Ut=x({_meta:E(D(),v()).nullish(),maxCount:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Wt=x({_meta:E(D(),v()).nullish(),diagnostics:St.nullish(),editHistory:Dt.nullish(),openFiles:jt.nullish(),recentFiles:Nt.nullish(),relatedSnippets:It.nullish(),userActions:Ut.nullish()}),Gt=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),mcpServers:S(I)}),Kt=x({default:T().nullish(),description:D().nullish(),maximum:T().nullish(),minimum:T().nullish(),title:D().nullish()}),qt=D(),Jt=C([w(`allow_once`),w(`allow_always`),w(`reject_once`),w(`reject_always`)]),Yt=x({_meta:E(D(),v()).nullish(),kind:Jt,name:D(),optionId:qt}),Xt=C([w(`high`),w(`medium`),w(`low`)]),Zt=C([w(`pending`),w(`in_progress`),w(`completed`)]),Qt=x({_meta:E(D(),v()).nullish(),content:D(),priority:Xt,status:Zt}),$t=x({_meta:E(D(),v()).nullish(),entries:S(Qt)}),L=x({character:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),line:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`})}),en=x({id:D(),position:L,uri:D()}),tn=x({id:D(),newName:D(),position:L,uri:D()}),nn=x({action:D(),position:L,timestampMs:T(),uri:D()}),rn=C([w(`utf-16`),w(`utf-32`),w(`utf-8`)]),an=x({_meta:E(D(),v()).nullish(),auth:ke.optional().default({terminal:!1}),elicitation:Qe.nullish(),fs:at.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Bt.nullish(),positionEncodings:S(rn).optional(),terminal:b().optional().default(!1)}),on=x({_meta:E(D(),v()).nullish(),audio:b().optional().default(!1),embeddedContext:b().optional().default(!1),image:b().optional().default(!1)}),sn=T().int().gte(0).lte(65535),cn=x({_meta:E(D(),v()).nullish(),clientCapabilities:an.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:st.nullish(),protocolVersion:sn}),R=x({end:L,start:L}),ln=x({message:D(),range:R,severity:xt,uri:D()}),un=x({languageId:D(),lastFocusedMs:T().nullish(),uri:D(),visibleRange:R.nullish()}),dn=x({_meta:E(D(),v()).nullish(),diagnostics:S(ln).nullish(),editHistory:S(Ot).nullish(),openFiles:S(un).nullish(),recentFiles:S(Mt).nullish(),relatedSnippets:S(Ft).nullish(),userActions:S(nn).nullish()}),fn=x({newText:D(),range:R}),pn=C([x({cursorPosition:L.nullish(),edits:S(fn),id:D(),uri:D()}).and(x({kind:w(`edit`)})),en.and(x({kind:w(`jump`)})),tn.and(x({kind:w(`rename`)})),Vt.and(x({kind:w(`searchAndReplace`)}))]),mn=x({_meta:E(D(),v()).nullish(),content:D()}),hn=x({_meta:E(D(),v()).nullish()}),z=C([T(),D()]).nullable();x({_meta:E(D(),v()).nullish(),requestId:z});var gn=x({requestId:z}),_n=y([`assistant`,`user`]),B=x({_meta:E(D(),v()).nullish(),audience:S(_n).nullish(),lastModified:D().nullish(),priority:T().nullish()}),vn=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),data:D(),mimeType:D()}),yn=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),data:D(),mimeType:D(),uri:D().nullish()}),bn=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),description:D().nullish(),mimeType:D().nullish(),name:D(),size:T().nullish(),title:D().nullish(),uri:D()}),xn=x({_meta:E(D(),v()).nullish(),optionId:qt}),Sn=C([x({outcome:w(`cancelled`)}),xn.and(x({outcome:w(`selected`)}))]),Cn=x({_meta:E(D(),v()).nullish(),outcome:Sn}),wn=x({_meta:E(D(),v()).nullish()}),Tn=x({_meta:E(D(),v()).nullish()}),En=x({currentValue:b()}),Dn=D(),On=D(),kn=C([w(`mode`),w(`model`),w(`thought_level`),D()]),V=D(),An=x({_meta:E(D(),v()).nullish(),description:D().nullish(),name:D(),value:V}),jn=x({_meta:E(D(),v()).nullish(),group:Dn,name:D(),options:S(An)}),H=O(C([x({currentValue:V,options:C([S(An),S(jn)])}).and(x({type:w(`select`)})),En.and(x({type:w(`boolean`)}))]),x({_meta:E(D(),v()).nullish(),category:kn.nullish(),description:D().nullish(),id:On,name:D()})),Mn=x({_meta:E(D(),v()).nullish(),configOptions:S(H)}),Nn=x({_meta:E(D(),v()).nullish()}),U=D(),Pn=x({_meta:E(D(),v()).nullish(),id:D(),sessionId:U}),Fn=x({_meta:E(D(),v()).nullish(),sessionId:U}),In=x({_meta:E(D(),v()).nullish(),sessionId:U}),Ln=x({_meta:E(D(),v()).nullish(),sessionId:U}),Rn=x({_meta:E(D(),v()).nullish(),args:S(D()).optional(),command:D(),cwd:D().nullish(),env:S(et).optional(),outputByteLimit:T().nullish(),sessionId:U}),zn=x({_meta:E(D(),v()).nullish(),sessionId:U,uri:D()}),Bn=x({_meta:E(D(),v()).nullish(),position:L,sessionId:U,uri:D(),version:T(),visibleRange:R}),Vn=x({_meta:E(D(),v()).nullish(),languageId:D(),sessionId:U,text:D(),uri:D(),version:T()}),Hn=x({_meta:E(D(),v()).nullish(),sessionId:U,uri:D()}),Un=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),mcpServers:S(I).optional(),sessionId:U}),Wn=x({_meta:E(D(),v()).nullish(),sessionId:U,terminalId:D()}),Gn=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),mcpServers:S(I),sessionId:U}),Kn=x({_meta:E(D(),v()).nullish(),limit:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),line:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:D(),sessionId:U}),qn=x({_meta:E(D(),v()).nullish(),id:D(),reason:Pt.nullish(),sessionId:U}),Jn=x({_meta:E(D(),v()).nullish(),sessionId:U,terminalId:D()}),Yn=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),mcpServers:S(I).optional(),sessionId:U}),Xn=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),sessionId:U,title:D().nullish(),updatedAt:D().nullish()}),Zn=x({_meta:E(D(),v()).nullish(),nextCursor:D().nullish(),sessions:S(Xn)}),Qn=x({_meta:E(D(),v()).nullish(),title:D().nullish(),updatedAt:D().nullish()}),$n=x({_meta:E(D(),v()).nullish()}),W=D(),er=x({_meta:E(D(),v()).nullish(),currentModeId:W}),tr=x({_meta:E(D(),v()).nullish(),description:D().nullish(),id:W,name:D()}),G=x({_meta:E(D(),v()).nullish(),availableModes:S(tr),currentModeId:W}),K=x({_meta:E(D(),v()).nullish(),availableModels:S(bt),currentModelId:yt}),nr=x({_meta:E(D(),v()).nullish(),configOptions:S(H).nullish(),models:K.nullish(),modes:G.nullish(),sessionId:U}),rr=x({_meta:E(D(),v()).nullish(),configOptions:S(H).nullish(),models:K.nullish(),modes:G.nullish()}),ir=x({_meta:E(D(),v()).nullish(),configOptions:S(H).nullish(),models:K.nullish(),modes:G.nullish(),sessionId:U}),ar=x({_meta:E(D(),v()).nullish(),configOptions:S(H).nullish(),models:K.nullish(),modes:G.nullish()}),or=x({_meta:E(D(),v()).nullish()}),sr=x({_meta:E(D(),v()).nullish(),additionalDirectories:wn.nullish(),close:Tn.nullish(),fork:Nn.nullish(),list:$n.nullish(),resume:or.nullish()}),cr=O(C([x({type:w(`boolean`),value:b()}),x({value:V})]),x({_meta:E(D(),v()).nullish(),configId:On,sessionId:U})),lr=x({_meta:E(D(),v()).nullish(),configOptions:S(H)}),ur=x({_meta:E(D(),v()).nullish(),modeId:W,sessionId:U}),dr=x({_meta:E(D(),v()).nullish()}),fr=x({_meta:E(D(),v()).nullish(),modelId:yt,sessionId:U}),pr=x({_meta:E(D(),v()).nullish()}),mr=x({_meta:E(D(),v()).nullish(),sessionId:U}),hr=C([w(`end_turn`),w(`max_tokens`),w(`max_turn_requests`),w(`refusal`),w(`cancelled`)]),gr=C([w(`email`),w(`uri`),w(`date`),w(`date-time`)]),_r=x({default:D().nullish(),description:D().nullish(),enum:S(D()).nullish(),format:gr.nullish(),maxLength:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),minLength:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),oneOf:S($e).nullish(),pattern:D().nullish(),title:D().nullish()}),vr=x({_meta:E(D(),v()).nullish(),context:dn.nullish(),position:L,selection:R.nullish(),sessionId:U,triggerKind:Ht,uri:D(),version:T()}),yr=x({_meta:E(D(),v()).nullish(),suggestions:S(pn)}),br=x({_meta:E(D(),v()).nullish(),terminalId:D()}),xr=x({_meta:E(D(),v()).nullish(),exitCode:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:D().nullish()}),Sr=x({_meta:E(D(),v()).nullish(),sessionId:U,terminalId:D()}),Cr=x({_meta:E(D(),v()).nullish(),exitStatus:xr.nullish(),output:D(),truncated:b()}),wr=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),text:D()}),Tr=x({range:R.nullish(),text:D()}),Er=x({_meta:E(D(),v()).nullish(),contentChanges:S(Tr),sessionId:U,uri:D(),version:T()});x({method:D(),params:C([Fn,Vn,Er,zn,Hn,Bn,Pn,qn,nt]).nullish()});var Dr=C([w(`full`),w(`incremental`)]),Or=x({_meta:E(D(),v()).nullish(),syncKind:Dr}),kr=x({_meta:E(D(),v()).nullish(),didChange:Or.nullish(),didClose:Ct.nullish(),didFocus:wt.nullish(),didOpen:Tt.nullish(),didSave:Et.nullish()}),Ar=x({_meta:E(D(),v()).nullish(),document:kr.nullish()}),jr=x({_meta:E(D(),v()).nullish(),context:Wt.nullish(),events:Ar.nullish()}),Mr=x({_meta:E(D(),v()).nullish(),auth:ft.optional().default({}),loadSession:b().optional().default(!1),mcpCapabilities:ht.optional().default({http:!1,sse:!1}),nes:jr.nullish(),positionEncoding:rn.nullish(),promptCapabilities:on.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:sr.optional().default({})}),Nr=x({_meta:E(D(),v()).nullish(),agentCapabilities:Mr.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:st.nullish(),authMethods:S(Pe).optional().default([]),protocolVersion:sn}),Pr=C([x({_meta:E(D(),v()).nullish(),mimeType:D().nullish(),text:D(),uri:D()}),Le]),Fr=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),resource:Pr}),Ir=C([wr.and(x({type:w(`text`)})),yn.and(x({type:w(`image`)})),vn.and(x({type:w(`audio`)})),bn.and(x({type:w(`resource_link`)})),Fr.and(x({type:w(`resource`)}))]),Lr=x({_meta:E(D(),v()).nullish(),content:Ir}),Rr=x({_meta:E(D(),v()).nullish(),content:Ir,messageId:D().nullish()}),zr=x({_meta:E(D(),v()).nullish(),messageId:D().nullish(),prompt:S(Ir),sessionId:U}),Br=x({anyOf:S($e)}),Vr=C([Lr.and(x({type:w(`content`)})),Ue.and(x({type:w(`diff`)})),br.and(x({type:w(`terminal`)}))]),Hr=D(),Ur=x({sessionId:U,toolCallId:Hr.nullish()}),Wr=O(C([Ur,gn]),x({elicitationId:qe,url:D().url()})),Gr=x({_meta:E(D(),v()).nullish(),line:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:D()}),Kr=C([w(`pending`),w(`in_progress`),w(`completed`),w(`failed`)]),qr=C([w(`read`),w(`edit`),w(`delete`),w(`move`),w(`search`),w(`execute`),w(`think`),w(`fetch`),w(`switch_mode`),w(`other`)]),Jr=x({_meta:E(D(),v()).nullish(),content:S(Vr).optional(),kind:qr.optional(),locations:S(Gr).optional(),rawInput:v().optional(),rawOutput:v().optional(),status:Kr.optional(),title:D(),toolCallId:Hr}),Yr=x({_meta:E(D(),v()).nullish(),content:S(Vr).nullish(),kind:qr.nullish(),locations:S(Gr).nullish(),rawInput:v().optional(),rawOutput:v().optional(),status:Kr.nullish(),title:D().nullish(),toolCallId:Hr}),Xr=x({_meta:E(D(),v()).nullish(),options:S(Yt),sessionId:U,toolCall:Yr}),Zr=x({_meta:E(D(),v()).nullish(),hint:D()}),Qr=x({_meta:E(D(),v()).nullish(),description:D(),input:Zr.nullish(),name:D()}),$r=x({_meta:E(D(),v()).nullish(),availableCommands:S(Qr)}),ei=C([x({enum:S(D()),type:Xe}),Br]),ti=x({default:S(D()).nullish(),description:D().nullish(),items:ei,maxItems:T().nullish(),minItems:T().nullish(),title:D().nullish()}),ni=C([_r.and(x({type:w(`string`)})),Kt.and(x({type:w(`number`)})),ct.and(x({type:w(`integer`)})),Re.and(x({type:w(`boolean`)})),ti.and(x({type:w(`array`)}))]),ri=x({description:D().nullish(),properties:E(D(),ni).optional().default({}),required:S(D()).nullish(),title:D().nullish(),type:Ye.optional().default(`object`)}),ii=O(C([O(C([Ur,gn]),x({requestedSchema:ri})).and(x({mode:w(`form`)})),Wr.and(x({mode:w(`url`)}))]),x({_meta:E(D(),v()).nullish(),message:D()})),ai=x({cachedReadTokens:T().nullish(),cachedWriteTokens:T().nullish(),inputTokens:T(),outputTokens:T(),thoughtTokens:T().nullish(),totalTokens:T()});C([x({id:z,result:C([Nr,Ie,mt,ir,rr,Zn,nr,ar,Be,dr,lr,x({_meta:E(D(),v()).nullish(),stopReason:hr,usage:ai.nullish(),userMessageId:D().nullish()}),pr,mr,yr,ze,it])}),x({error:tt,id:z})]);var oi=x({_meta:E(D(),v()).nullish(),cost:Ve.nullish(),size:T(),used:T()}),si=C([Rr.and(x({sessionUpdate:w(`user_message_chunk`)})),Rr.and(x({sessionUpdate:w(`agent_message_chunk`)})),Rr.and(x({sessionUpdate:w(`agent_thought_chunk`)})),Jr.and(x({sessionUpdate:w(`tool_call`)})),Yr.and(x({sessionUpdate:w(`tool_call_update`)})),$t.and(x({sessionUpdate:w(`plan`)})),$r.and(x({sessionUpdate:w(`available_commands_update`)})),er.and(x({sessionUpdate:w(`current_mode_update`)})),Mn.and(x({sessionUpdate:w(`config_option_update`)})),Qn.and(x({sessionUpdate:w(`session_info_update`)})),oi.and(x({sessionUpdate:w(`usage_update`)}))]),ci=x({_meta:E(D(),v()).nullish(),sessionId:U,update:si});x({method:D(),params:C([ci,Je,nt]).nullish()});var li=x({_meta:E(D(),v()).nullish(),sessionId:U,terminalId:D()}),ui=x({_meta:E(D(),v()).nullish(),exitCode:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:D().nullish()}),di=x({name:D(),uri:D()}),fi=x({_meta:E(D(),v()).nullish(),repository:Rt.nullish(),workspaceFolders:S(di).nullish(),workspaceUri:D().nullish()});x({id:z,method:D(),params:C([cn,Fe,pt,Gt,Gn,ut,Un,Yn,Ln,ur,cr,zr,fr,fi,vr,In,rt]).nullish()});var pi=x({_meta:E(D(),v()).nullish(),content:D(),path:D(),sessionId:U});x({id:z,method:D(),params:C([pi,Kn,Xr,Rn,Sr,Jn,li,Wn,ii,rt]).nullish()}),C([x({id:z,result:C([x({_meta:E(D(),v()).nullish()}),mn,Cn,He,Cr,hn,ui,lt,Ge,it])}),x({error:tt,id:z})]),e();function mi(e,t){let n=new TextEncoder,r=new TextDecoder;return{readable:new ReadableStream({async start(e){let n=``,i=t.getReader();try{for(;;){let{value:t,done:a}=await i.read();if(a){n+=r.decode();break}if(!t)continue;n+=r.decode(t,{stream:!0});let o=n.split(`
1
+ import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{B as n,Ds as r,E_ as i,Ec as a,Es as o,Jl as s,Ni as c,Oi as l,S_ as u,Tc as d,V as f,Yl as p,_r as m,i as h,o as g,rr as _}from"./loadAgentsDir-B0Anodo0.js";import{$ as v,A as y,F as b,G as x,P as S,Q as C,V as w,W as T,Y as E,Z as D,tt as ee,x as te,z as O}from"./types-Dx7P7JLQ.js";import{Dn as k,It as A,J as ne,Wn as j,ct as re,er as ie,tr as ae}from"./state-B4jiUise.js";import{_r as oe,d as se,h as ce,pr as le,sr as ue}from"./settings-B2jvL8Dp.js";import{p as de,r as fe}from"./config-C-Y2qtB2.js";import{d as pe,o as me}from"./model-BvQFFOf8.js";import{_n as he,vn as ge}from"./prompt-CJ1l3XXk.js";import{t as _e}from"./conversationRecovery-DliPBo_z.js";import{t as ve}from"./QueryEngine-DdLWvJv6.js";import{n as ye,r as be}from"./modelOptions-BBvF3wHK.js";import{n as xe,r as Se}from"./managedEnv-OPlzUPbJ.js";import{dirname as Ce}from"node:path";import{randomUUID as M}from"node:crypto";import{Readable as we,Writable as Te}from"node:stream";import{unlink as Ee}from"node:fs/promises";import*as N from"node:path/posix";import{isAbsolute as De,resolve as Oe}from"node:path/posix";te();var P={authenticate:`authenticate`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_focus:`document/didFocus`,document_did_open:`document/didOpen`,document_did_save:`document/didSave`,initialize:`initialize`,logout:`logout`,nes_accept:`nes/accept`,nes_close:`nes/close`,nes_reject:`nes/reject`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,session_cancel:`session/cancel`,session_close:`session/close`,session_fork:`session/fork`,session_list:`session/list`,session_load:`session/load`,session_new:`session/new`,session_prompt:`session/prompt`,session_resume:`session/resume`,session_set_config_option:`session/set_config_option`,session_set_mode:`session/set_mode`,session_set_model:`session/set_model`},F={elicitation_complete:`elicitation/complete`,elicitation_create:`elicitation/create`,fs_read_text_file:`fs/read_text_file`,fs_write_text_file:`fs/write_text_file`,session_request_permission:`session/request_permission`,session_update:`session/update`,terminal_create:`terminal/create`,terminal_kill:`terminal/kill`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`},ke=x({_meta:E(D(),v()).nullish(),terminal:b().optional().default(!1)}),Ae=x({_meta:E(D(),v()).nullish(),label:D().nullish(),name:D(),optional:b().optional().default(!1),secret:b().optional().default(!0)}),je=x({_meta:E(D(),v()).nullish(),description:D().nullish(),id:D(),name:D()}),Me=x({_meta:E(D(),v()).nullish(),description:D().nullish(),id:D(),link:D().nullish(),name:D(),vars:S(Ae)}),Ne=x({_meta:E(D(),v()).nullish(),args:S(D()).optional(),description:D().nullish(),env:E(D(),D()).optional(),id:D(),name:D()}),Pe=C([Me.and(x({type:w(`env_var`)})),Ne.and(x({type:w(`terminal`)})),je]),Fe=x({_meta:E(D(),v()).nullish(),methodId:D()}),Ie=x({_meta:E(D(),v()).nullish()}),Le=x({_meta:E(D(),v()).nullish(),blob:D(),mimeType:D().nullish(),uri:D()}),Re=x({default:b().nullish(),description:D().nullish(),title:D().nullish()}),ze=x({_meta:E(D(),v()).nullish()}),Be=x({_meta:E(D(),v()).nullish()}),Ve=x({amount:T(),currency:D()}),He=x({_meta:E(D(),v()).nullish(),terminalId:D()}),Ue=x({_meta:E(D(),v()).nullish(),newText:D(),oldText:D().nullish(),path:D()}),We=C([D(),T(),T(),b(),S(D())]),Ge=O(C([x({content:E(D(),We).nullish()}).and(x({action:w(`accept`)})),x({action:w(`decline`)}),x({action:w(`cancel`)})]),x({_meta:E(D(),v()).nullish()})),Ke=x({_meta:E(D(),v()).nullish()}),qe=D(),Je=x({_meta:E(D(),v()).nullish(),elicitationId:qe}),Ye=w(`object`),Xe=w(`string`),Ze=x({_meta:E(D(),v()).nullish()}),Qe=x({_meta:E(D(),v()).nullish(),form:Ke.nullish(),url:Ze.nullish()}),$e=x({const:D(),title:D()}),et=x({_meta:E(D(),v()).nullish(),name:D(),value:D()}),tt=x({code:C([w(-32700),w(-32600),w(-32601),w(-32602),w(-32603),w(-32800),w(-32e3),w(-32002),w(-32042),T().int().min(-2147483648,{message:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{message:`Invalid value: Expected int32 to be <= 2147483647`})]),data:v().optional(),message:D()}),nt=v(),rt=v(),it=v(),at=x({_meta:E(D(),v()).nullish(),readTextFile:b().optional().default(!1),writeTextFile:b().optional().default(!1)}),ot=x({_meta:E(D(),v()).nullish(),name:D(),value:D()}),st=x({_meta:E(D(),v()).nullish(),name:D(),title:D().nullish(),version:D()}),ct=x({default:T().nullish(),description:D().nullish(),maximum:T().nullish(),minimum:T().nullish(),title:D().nullish()}),lt=x({_meta:E(D(),v()).nullish()}),ut=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cursor:D().nullish(),cwd:D().nullish()}),dt=x({_meta:E(D(),v()).nullish()}),ft=x({_meta:E(D(),v()).nullish(),logout:dt.nullish()}),pt=x({_meta:E(D(),v()).nullish()}),mt=x({_meta:E(D(),v()).nullish()}),ht=x({_meta:E(D(),v()).nullish(),http:b().optional().default(!1),sse:b().optional().default(!1)}),gt=x({_meta:E(D(),v()).nullish(),headers:S(ot),name:D(),url:D()}),_t=x({_meta:E(D(),v()).nullish(),headers:S(ot),name:D(),url:D()}),vt=x({_meta:E(D(),v()).nullish(),args:S(D()),command:D(),env:S(et),name:D()}),I=C([gt.and(x({type:w(`http`)})),_t.and(x({type:w(`sse`)})),vt]),yt=D(),bt=x({_meta:E(D(),v()).nullish(),description:D().nullish(),modelId:yt,name:D()}),xt=C([w(`error`),w(`warning`),w(`information`),w(`hint`)]),St=x({_meta:E(D(),v()).nullish()}),Ct=x({_meta:E(D(),v()).nullish()}),wt=x({_meta:E(D(),v()).nullish()}),Tt=x({_meta:E(D(),v()).nullish()}),Et=x({_meta:E(D(),v()).nullish()}),Dt=x({_meta:E(D(),v()).nullish(),maxCount:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Ot=x({diff:D(),uri:D()}),kt=x({endLine:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),startLine:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),text:D()}),At=x({_meta:E(D(),v()).nullish()}),jt=x({_meta:E(D(),v()).nullish()}),Mt=x({languageId:D(),text:D(),uri:D()}),Nt=x({_meta:E(D(),v()).nullish(),maxCount:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Pt=C([w(`rejected`),w(`ignored`),w(`replaced`),w(`cancelled`)]),Ft=x({excerpts:S(kt),uri:D()}),It=x({_meta:E(D(),v()).nullish()}),Lt=x({_meta:E(D(),v()).nullish()}),Rt=x({name:D(),owner:D(),remoteUrl:D()}),zt=x({_meta:E(D(),v()).nullish()}),Bt=x({_meta:E(D(),v()).nullish(),jump:At.nullish(),rename:Lt.nullish(),searchAndReplace:zt.nullish()}),Vt=x({id:D(),isRegex:b().nullish(),replace:D(),search:D(),uri:D()}),Ht=C([w(`automatic`),w(`diagnostic`),w(`manual`)]),Ut=x({_meta:E(D(),v()).nullish(),maxCount:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Wt=x({_meta:E(D(),v()).nullish(),diagnostics:St.nullish(),editHistory:Dt.nullish(),openFiles:jt.nullish(),recentFiles:Nt.nullish(),relatedSnippets:It.nullish(),userActions:Ut.nullish()}),Gt=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),mcpServers:S(I)}),Kt=x({default:T().nullish(),description:D().nullish(),maximum:T().nullish(),minimum:T().nullish(),title:D().nullish()}),qt=D(),Jt=C([w(`allow_once`),w(`allow_always`),w(`reject_once`),w(`reject_always`)]),Yt=x({_meta:E(D(),v()).nullish(),kind:Jt,name:D(),optionId:qt}),Xt=C([w(`high`),w(`medium`),w(`low`)]),Zt=C([w(`pending`),w(`in_progress`),w(`completed`)]),Qt=x({_meta:E(D(),v()).nullish(),content:D(),priority:Xt,status:Zt}),$t=x({_meta:E(D(),v()).nullish(),entries:S(Qt)}),L=x({character:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),line:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`})}),en=x({id:D(),position:L,uri:D()}),tn=x({id:D(),newName:D(),position:L,uri:D()}),nn=x({action:D(),position:L,timestampMs:T(),uri:D()}),rn=C([w(`utf-16`),w(`utf-32`),w(`utf-8`)]),an=x({_meta:E(D(),v()).nullish(),auth:ke.optional().default({terminal:!1}),elicitation:Qe.nullish(),fs:at.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Bt.nullish(),positionEncodings:S(rn).optional(),terminal:b().optional().default(!1)}),on=x({_meta:E(D(),v()).nullish(),audio:b().optional().default(!1),embeddedContext:b().optional().default(!1),image:b().optional().default(!1)}),sn=T().int().gte(0).lte(65535),cn=x({_meta:E(D(),v()).nullish(),clientCapabilities:an.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:st.nullish(),protocolVersion:sn}),R=x({end:L,start:L}),ln=x({message:D(),range:R,severity:xt,uri:D()}),un=x({languageId:D(),lastFocusedMs:T().nullish(),uri:D(),visibleRange:R.nullish()}),dn=x({_meta:E(D(),v()).nullish(),diagnostics:S(ln).nullish(),editHistory:S(Ot).nullish(),openFiles:S(un).nullish(),recentFiles:S(Mt).nullish(),relatedSnippets:S(Ft).nullish(),userActions:S(nn).nullish()}),fn=x({newText:D(),range:R}),pn=C([x({cursorPosition:L.nullish(),edits:S(fn),id:D(),uri:D()}).and(x({kind:w(`edit`)})),en.and(x({kind:w(`jump`)})),tn.and(x({kind:w(`rename`)})),Vt.and(x({kind:w(`searchAndReplace`)}))]),mn=x({_meta:E(D(),v()).nullish(),content:D()}),hn=x({_meta:E(D(),v()).nullish()}),z=C([T(),D()]).nullable();x({_meta:E(D(),v()).nullish(),requestId:z});var gn=x({requestId:z}),_n=y([`assistant`,`user`]),B=x({_meta:E(D(),v()).nullish(),audience:S(_n).nullish(),lastModified:D().nullish(),priority:T().nullish()}),vn=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),data:D(),mimeType:D()}),yn=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),data:D(),mimeType:D(),uri:D().nullish()}),bn=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),description:D().nullish(),mimeType:D().nullish(),name:D(),size:T().nullish(),title:D().nullish(),uri:D()}),xn=x({_meta:E(D(),v()).nullish(),optionId:qt}),Sn=C([x({outcome:w(`cancelled`)}),xn.and(x({outcome:w(`selected`)}))]),Cn=x({_meta:E(D(),v()).nullish(),outcome:Sn}),wn=x({_meta:E(D(),v()).nullish()}),Tn=x({_meta:E(D(),v()).nullish()}),En=x({currentValue:b()}),Dn=D(),On=D(),kn=C([w(`mode`),w(`model`),w(`thought_level`),D()]),V=D(),An=x({_meta:E(D(),v()).nullish(),description:D().nullish(),name:D(),value:V}),jn=x({_meta:E(D(),v()).nullish(),group:Dn,name:D(),options:S(An)}),H=O(C([x({currentValue:V,options:C([S(An),S(jn)])}).and(x({type:w(`select`)})),En.and(x({type:w(`boolean`)}))]),x({_meta:E(D(),v()).nullish(),category:kn.nullish(),description:D().nullish(),id:On,name:D()})),Mn=x({_meta:E(D(),v()).nullish(),configOptions:S(H)}),Nn=x({_meta:E(D(),v()).nullish()}),U=D(),Pn=x({_meta:E(D(),v()).nullish(),id:D(),sessionId:U}),Fn=x({_meta:E(D(),v()).nullish(),sessionId:U}),In=x({_meta:E(D(),v()).nullish(),sessionId:U}),Ln=x({_meta:E(D(),v()).nullish(),sessionId:U}),Rn=x({_meta:E(D(),v()).nullish(),args:S(D()).optional(),command:D(),cwd:D().nullish(),env:S(et).optional(),outputByteLimit:T().nullish(),sessionId:U}),zn=x({_meta:E(D(),v()).nullish(),sessionId:U,uri:D()}),Bn=x({_meta:E(D(),v()).nullish(),position:L,sessionId:U,uri:D(),version:T(),visibleRange:R}),Vn=x({_meta:E(D(),v()).nullish(),languageId:D(),sessionId:U,text:D(),uri:D(),version:T()}),Hn=x({_meta:E(D(),v()).nullish(),sessionId:U,uri:D()}),Un=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),mcpServers:S(I).optional(),sessionId:U}),Wn=x({_meta:E(D(),v()).nullish(),sessionId:U,terminalId:D()}),Gn=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),mcpServers:S(I),sessionId:U}),Kn=x({_meta:E(D(),v()).nullish(),limit:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),line:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:D(),sessionId:U}),qn=x({_meta:E(D(),v()).nullish(),id:D(),reason:Pt.nullish(),sessionId:U}),Jn=x({_meta:E(D(),v()).nullish(),sessionId:U,terminalId:D()}),Yn=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),mcpServers:S(I).optional(),sessionId:U}),Xn=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),sessionId:U,title:D().nullish(),updatedAt:D().nullish()}),Zn=x({_meta:E(D(),v()).nullish(),nextCursor:D().nullish(),sessions:S(Xn)}),Qn=x({_meta:E(D(),v()).nullish(),title:D().nullish(),updatedAt:D().nullish()}),$n=x({_meta:E(D(),v()).nullish()}),W=D(),er=x({_meta:E(D(),v()).nullish(),currentModeId:W}),tr=x({_meta:E(D(),v()).nullish(),description:D().nullish(),id:W,name:D()}),G=x({_meta:E(D(),v()).nullish(),availableModes:S(tr),currentModeId:W}),K=x({_meta:E(D(),v()).nullish(),availableModels:S(bt),currentModelId:yt}),nr=x({_meta:E(D(),v()).nullish(),configOptions:S(H).nullish(),models:K.nullish(),modes:G.nullish(),sessionId:U}),rr=x({_meta:E(D(),v()).nullish(),configOptions:S(H).nullish(),models:K.nullish(),modes:G.nullish()}),ir=x({_meta:E(D(),v()).nullish(),configOptions:S(H).nullish(),models:K.nullish(),modes:G.nullish(),sessionId:U}),ar=x({_meta:E(D(),v()).nullish(),configOptions:S(H).nullish(),models:K.nullish(),modes:G.nullish()}),or=x({_meta:E(D(),v()).nullish()}),sr=x({_meta:E(D(),v()).nullish(),additionalDirectories:wn.nullish(),close:Tn.nullish(),fork:Nn.nullish(),list:$n.nullish(),resume:or.nullish()}),cr=O(C([x({type:w(`boolean`),value:b()}),x({value:V})]),x({_meta:E(D(),v()).nullish(),configId:On,sessionId:U})),lr=x({_meta:E(D(),v()).nullish(),configOptions:S(H)}),ur=x({_meta:E(D(),v()).nullish(),modeId:W,sessionId:U}),dr=x({_meta:E(D(),v()).nullish()}),fr=x({_meta:E(D(),v()).nullish(),modelId:yt,sessionId:U}),pr=x({_meta:E(D(),v()).nullish()}),mr=x({_meta:E(D(),v()).nullish(),sessionId:U}),hr=C([w(`end_turn`),w(`max_tokens`),w(`max_turn_requests`),w(`refusal`),w(`cancelled`)]),gr=C([w(`email`),w(`uri`),w(`date`),w(`date-time`)]),_r=x({default:D().nullish(),description:D().nullish(),enum:S(D()).nullish(),format:gr.nullish(),maxLength:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),minLength:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),oneOf:S($e).nullish(),pattern:D().nullish(),title:D().nullish()}),vr=x({_meta:E(D(),v()).nullish(),context:dn.nullish(),position:L,selection:R.nullish(),sessionId:U,triggerKind:Ht,uri:D(),version:T()}),yr=x({_meta:E(D(),v()).nullish(),suggestions:S(pn)}),br=x({_meta:E(D(),v()).nullish(),terminalId:D()}),xr=x({_meta:E(D(),v()).nullish(),exitCode:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:D().nullish()}),Sr=x({_meta:E(D(),v()).nullish(),sessionId:U,terminalId:D()}),Cr=x({_meta:E(D(),v()).nullish(),exitStatus:xr.nullish(),output:D(),truncated:b()}),wr=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),text:D()}),Tr=x({range:R.nullish(),text:D()}),Er=x({_meta:E(D(),v()).nullish(),contentChanges:S(Tr),sessionId:U,uri:D(),version:T()});x({method:D(),params:C([Fn,Vn,Er,zn,Hn,Bn,Pn,qn,nt]).nullish()});var Dr=C([w(`full`),w(`incremental`)]),Or=x({_meta:E(D(),v()).nullish(),syncKind:Dr}),kr=x({_meta:E(D(),v()).nullish(),didChange:Or.nullish(),didClose:Ct.nullish(),didFocus:wt.nullish(),didOpen:Tt.nullish(),didSave:Et.nullish()}),Ar=x({_meta:E(D(),v()).nullish(),document:kr.nullish()}),jr=x({_meta:E(D(),v()).nullish(),context:Wt.nullish(),events:Ar.nullish()}),Mr=x({_meta:E(D(),v()).nullish(),auth:ft.optional().default({}),loadSession:b().optional().default(!1),mcpCapabilities:ht.optional().default({http:!1,sse:!1}),nes:jr.nullish(),positionEncoding:rn.nullish(),promptCapabilities:on.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:sr.optional().default({})}),Nr=x({_meta:E(D(),v()).nullish(),agentCapabilities:Mr.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:st.nullish(),authMethods:S(Pe).optional().default([]),protocolVersion:sn}),Pr=C([x({_meta:E(D(),v()).nullish(),mimeType:D().nullish(),text:D(),uri:D()}),Le]),Fr=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),resource:Pr}),Ir=C([wr.and(x({type:w(`text`)})),yn.and(x({type:w(`image`)})),vn.and(x({type:w(`audio`)})),bn.and(x({type:w(`resource_link`)})),Fr.and(x({type:w(`resource`)}))]),Lr=x({_meta:E(D(),v()).nullish(),content:Ir}),Rr=x({_meta:E(D(),v()).nullish(),content:Ir,messageId:D().nullish()}),zr=x({_meta:E(D(),v()).nullish(),messageId:D().nullish(),prompt:S(Ir),sessionId:U}),Br=x({anyOf:S($e)}),Vr=C([Lr.and(x({type:w(`content`)})),Ue.and(x({type:w(`diff`)})),br.and(x({type:w(`terminal`)}))]),Hr=D(),Ur=x({sessionId:U,toolCallId:Hr.nullish()}),Wr=O(C([Ur,gn]),x({elicitationId:qe,url:D().url()})),Gr=x({_meta:E(D(),v()).nullish(),line:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:D()}),Kr=C([w(`pending`),w(`in_progress`),w(`completed`),w(`failed`)]),qr=C([w(`read`),w(`edit`),w(`delete`),w(`move`),w(`search`),w(`execute`),w(`think`),w(`fetch`),w(`switch_mode`),w(`other`)]),Jr=x({_meta:E(D(),v()).nullish(),content:S(Vr).optional(),kind:qr.optional(),locations:S(Gr).optional(),rawInput:v().optional(),rawOutput:v().optional(),status:Kr.optional(),title:D(),toolCallId:Hr}),Yr=x({_meta:E(D(),v()).nullish(),content:S(Vr).nullish(),kind:qr.nullish(),locations:S(Gr).nullish(),rawInput:v().optional(),rawOutput:v().optional(),status:Kr.nullish(),title:D().nullish(),toolCallId:Hr}),Xr=x({_meta:E(D(),v()).nullish(),options:S(Yt),sessionId:U,toolCall:Yr}),Zr=x({_meta:E(D(),v()).nullish(),hint:D()}),Qr=x({_meta:E(D(),v()).nullish(),description:D(),input:Zr.nullish(),name:D()}),$r=x({_meta:E(D(),v()).nullish(),availableCommands:S(Qr)}),ei=C([x({enum:S(D()),type:Xe}),Br]),ti=x({default:S(D()).nullish(),description:D().nullish(),items:ei,maxItems:T().nullish(),minItems:T().nullish(),title:D().nullish()}),ni=C([_r.and(x({type:w(`string`)})),Kt.and(x({type:w(`number`)})),ct.and(x({type:w(`integer`)})),Re.and(x({type:w(`boolean`)})),ti.and(x({type:w(`array`)}))]),ri=x({description:D().nullish(),properties:E(D(),ni).optional().default({}),required:S(D()).nullish(),title:D().nullish(),type:Ye.optional().default(`object`)}),ii=O(C([O(C([Ur,gn]),x({requestedSchema:ri})).and(x({mode:w(`form`)})),Wr.and(x({mode:w(`url`)}))]),x({_meta:E(D(),v()).nullish(),message:D()})),ai=x({cachedReadTokens:T().nullish(),cachedWriteTokens:T().nullish(),inputTokens:T(),outputTokens:T(),thoughtTokens:T().nullish(),totalTokens:T()});C([x({id:z,result:C([Nr,Ie,mt,ir,rr,Zn,nr,ar,Be,dr,lr,x({_meta:E(D(),v()).nullish(),stopReason:hr,usage:ai.nullish(),userMessageId:D().nullish()}),pr,mr,yr,ze,it])}),x({error:tt,id:z})]);var oi=x({_meta:E(D(),v()).nullish(),cost:Ve.nullish(),size:T(),used:T()}),si=C([Rr.and(x({sessionUpdate:w(`user_message_chunk`)})),Rr.and(x({sessionUpdate:w(`agent_message_chunk`)})),Rr.and(x({sessionUpdate:w(`agent_thought_chunk`)})),Jr.and(x({sessionUpdate:w(`tool_call`)})),Yr.and(x({sessionUpdate:w(`tool_call_update`)})),$t.and(x({sessionUpdate:w(`plan`)})),$r.and(x({sessionUpdate:w(`available_commands_update`)})),er.and(x({sessionUpdate:w(`current_mode_update`)})),Mn.and(x({sessionUpdate:w(`config_option_update`)})),Qn.and(x({sessionUpdate:w(`session_info_update`)})),oi.and(x({sessionUpdate:w(`usage_update`)}))]),ci=x({_meta:E(D(),v()).nullish(),sessionId:U,update:si});x({method:D(),params:C([ci,Je,nt]).nullish()});var li=x({_meta:E(D(),v()).nullish(),sessionId:U,terminalId:D()}),ui=x({_meta:E(D(),v()).nullish(),exitCode:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:D().nullish()}),di=x({name:D(),uri:D()}),fi=x({_meta:E(D(),v()).nullish(),repository:Rt.nullish(),workspaceFolders:S(di).nullish(),workspaceUri:D().nullish()});x({id:z,method:D(),params:C([cn,Fe,pt,Gt,Gn,ut,Un,Yn,Ln,ur,cr,zr,fr,fi,vr,In,rt]).nullish()});var pi=x({_meta:E(D(),v()).nullish(),content:D(),path:D(),sessionId:U});x({id:z,method:D(),params:C([pi,Kn,Xr,Rn,Sr,Jn,li,Wn,ii,rt]).nullish()}),C([x({id:z,result:C([x({_meta:E(D(),v()).nullish()}),mn,Cn,He,Cr,hn,ui,lt,Ge,it])}),x({error:tt,id:z})]),e();function mi(e,t){let n=new TextEncoder,r=new TextDecoder;return{readable:new ReadableStream({async start(e){let n=``,i=t.getReader();try{for(;;){let{value:t,done:a}=await i.read();if(a){n+=r.decode();break}if(!t)continue;n+=r.decode(t,{stream:!0});let o=n.split(`
2
2
  `);n=o.pop()||``;for(let t of o){let n=t.trim();if(n)try{let t=JSON.parse(n);e.enqueue(t)}catch(e){console.error(`Failed to parse JSON message:`,n,e)}}}let t=n.trim();if(t)try{let n=JSON.parse(t);e.enqueue(n)}catch(e){console.error(`Failed to parse JSON message:`,t,e)}}catch(t){e.error(t);return}finally{i.releaseLock()}e.close()}}),writable:new WritableStream({async write(t){let r=JSON.stringify(t)+`
3
- `,i=e.getWriter();try{await i.write(n.encode(r))}finally{i.releaseLock()}}})}}te();var hi,gi=class{constructor(e,n){t(this,`connection`,void 0);let r=e(this),i=async(e,t)=>{switch(e){case P.initialize:{let e=cn.parse(t);return r.initialize(e)}case P.session_new:{let e=Gt.parse(t);return r.newSession(e)}case P.session_load:{if(!r.loadSession)throw q.methodNotFound(e);let n=Gn.parse(t);return r.loadSession(n)}case P.session_list:{if(!r.listSessions)throw q.methodNotFound(e);let n=ut.parse(t);return r.listSessions(n)}case P.session_fork:{if(!r.unstable_forkSession)throw q.methodNotFound(e);let n=Un.parse(t);return r.unstable_forkSession(n)}case P.session_resume:{if(!r.unstable_resumeSession)throw q.methodNotFound(e);let n=Yn.parse(t);return r.unstable_resumeSession(n)}case P.session_close:{if(!r.unstable_closeSession)throw q.methodNotFound(e);let n=Ln.parse(t);return r.unstable_closeSession(n)}case P.session_set_mode:{if(!r.setSessionMode)throw q.methodNotFound(e);let n=ur.parse(t);return await r.setSessionMode(n)??{}}case P.authenticate:{let e=Fe.parse(t);return await r.authenticate(e)??{}}case P.logout:{if(!r.unstable_logout)throw q.methodNotFound(e);let n=pt.parse(t);return await r.unstable_logout(n)??{}}case P.session_prompt:{let e=zr.parse(t);return r.prompt(e)}case P.session_set_model:{if(!r.unstable_setSessionModel)throw q.methodNotFound(e);let n=fr.parse(t);return await r.unstable_setSessionModel(n)??{}}case P.session_set_config_option:{if(!r.setSessionConfigOption)throw q.methodNotFound(e);let n=cr.parse(t);return r.setSessionConfigOption(n)}case P.nes_start:{if(!r.unstable_startNes)throw q.methodNotFound(e);let n=fi.parse(t);return r.unstable_startNes(n)}case P.nes_suggest:{if(!r.unstable_suggestNes)throw q.methodNotFound(e);let n=vr.parse(t);return r.unstable_suggestNes(n)}case P.nes_close:{if(!r.unstable_closeNes)throw q.methodNotFound(e);let n=In.parse(t);return await r.unstable_closeNes(n)??{}}default:if(r.extMethod)return r.extMethod(e,t);throw q.methodNotFound(e)}},a=async(e,t)=>{switch(e){case P.session_cancel:{let e=Fn.parse(t);return r.cancel(e)}case P.document_did_open:{if(!r.unstable_didOpenDocument)return;let e=Vn.parse(t);return r.unstable_didOpenDocument(e)}case P.document_did_change:{if(!r.unstable_didChangeDocument)return;let e=Er.parse(t);return r.unstable_didChangeDocument(e)}case P.document_did_close:{if(!r.unstable_didCloseDocument)return;let e=zn.parse(t);return r.unstable_didCloseDocument(e)}case P.document_did_save:{if(!r.unstable_didSaveDocument)return;let e=Hn.parse(t);return r.unstable_didSaveDocument(e)}case P.document_did_focus:{if(!r.unstable_didFocusDocument)return;let e=Bn.parse(t);return r.unstable_didFocusDocument(e)}case P.nes_accept:{if(!r.unstable_acceptNes)return;let e=Pn.parse(t);return r.unstable_acceptNes(e)}case P.nes_reject:{if(!r.unstable_rejectNes)return;let e=qn.parse(t);return r.unstable_rejectNes(e)}default:if(r.extNotification)return r.extNotification(e,t);throw q.methodNotFound(e)}};this.connection=new vi(i,a,n)}async sessionUpdate(e){return await this.connection.sendNotification(F.session_update,e)}async requestPermission(e){return await this.connection.sendRequest(F.session_request_permission,e)}async readTextFile(e){return await this.connection.sendRequest(F.fs_read_text_file,e)}async writeTextFile(e){return await this.connection.sendRequest(F.fs_write_text_file,e)??{}}async createTerminal(e){return new _i((await this.connection.sendRequest(F.terminal_create,e)).terminalId,e.sessionId,this.connection)}async unstable_createElicitation(e){return await this.connection.sendRequest(F.elicitation_create,e)}async unstable_completeElicitation(e){return await this.connection.sendNotification(F.elicitation_complete,e)}async extMethod(e,t){return await this.connection.sendRequest(e,t)}async extNotification(e,t){return await this.connection.sendNotification(e,t)}get signal(){return this.connection.signal}get closed(){return this.connection.closed}};hi=Symbol.asyncDispose;var _i=class{constructor(e,n,r){t(this,`id`,void 0),t(this,`sessionId`,void 0),t(this,`connection`,void 0),this.id=e,this.sessionId=n,this.connection=r}async currentOutput(){return await this.connection.sendRequest(F.terminal_output,{sessionId:this.sessionId,terminalId:this.id})}async waitForExit(){return await this.connection.sendRequest(F.terminal_wait_for_exit,{sessionId:this.sessionId,terminalId:this.id})}async kill(){return await this.connection.sendRequest(F.terminal_kill,{sessionId:this.sessionId,terminalId:this.id})??{}}async release(){return await this.connection.sendRequest(F.terminal_release,{sessionId:this.sessionId,terminalId:this.id})??{}}async[hi](){await this.release()}},vi=class{constructor(e,n,r){t(this,`pendingResponses`,new Map),t(this,`nextRequestId`,0),t(this,`requestHandler`,void 0),t(this,`notificationHandler`,void 0),t(this,`stream`,void 0),t(this,`writeQueue`,Promise.resolve()),t(this,`abortController`,new AbortController),t(this,`closedPromise`,void 0),this.requestHandler=e,this.notificationHandler=n,this.stream=r,this.closedPromise=new Promise(e=>{this.abortController.signal.addEventListener(`abort`,()=>e())}),this.receive()}get signal(){return this.abortController.signal}get closed(){return this.closedPromise}async receive(){let e;try{let e=this.stream.readable.getReader();try{for(;!this.abortController.signal.aborted;){let{value:t,done:n}=await e.read();if(n)break;if(t)try{this.processMessage(t)}catch(e){console.error(`Unexpected error during message processing:`,t,e),`id`in t&&t.id!==void 0&&this.sendMessage({jsonrpc:`2.0`,id:t.id,error:{code:-32700,message:`Parse error`}})}}}finally{e.releaseLock()}}catch(t){e=t}finally{this.close(e)}}close(e){if(this.abortController.signal.aborted)return;let t=e??Error(`ACP connection closed`);for(let e of this.pendingResponses.values())e.reject(t);this.pendingResponses.clear(),this.abortController.abort(t)}async processMessage(e){if(`method`in e&&`id`in e){let t=await this.tryCallRequestHandler(e.method,e.params);`error`in t&&console.error(`Error handling request`,e,t.error),await this.sendMessage({jsonrpc:`2.0`,id:e.id,...t})}else if(`method`in e){let t=await this.tryCallNotificationHandler(e.method,e.params);`error`in t&&console.error(`Error handling notification`,e,t.error)}else`id`in e?this.handleResponse(e):console.error(`Invalid message`,{message:e})}async tryCallRequestHandler(e,t){try{return{result:await this.requestHandler(e,t)??null}}catch(e){if(e instanceof q)return e.toResult();if(e instanceof ee)return q.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return q.internalError(t?JSON.parse(t):{}).toResult()}catch{return q.internalError({details:t}).toResult()}}}async tryCallNotificationHandler(e,t){try{return await this.notificationHandler(e,t),{result:null}}catch(e){if(e instanceof q)return e.toResult();if(e instanceof ee)return q.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return q.internalError(t?JSON.parse(t):{}).toResult()}catch{return q.internalError({details:t}).toResult()}}}handleResponse(e){let t=this.pendingResponses.get(e.id);if(t){if(`result`in e)t.resolve(e.result);else if(`error`in e){let{code:n,message:r,data:i}=e.error;t.reject(new q(n,r,i))}this.pendingResponses.delete(e.id)}else console.error(`Got response to unknown request`,e.id)}sendRequest(e,t){this.throwIfClosed();let n=this.nextRequestId++,r=new Promise((e,t)=>{this.pendingResponses.set(n,{resolve:e,reject:t})});return r.catch(()=>{}),this.sendMessage({jsonrpc:`2.0`,id:n,method:e,params:t}),r}async sendNotification(e,t){this.throwIfClosed(),await this.sendMessage({jsonrpc:`2.0`,method:e,params:t})}throwIfClosed(){if(this.abortController.signal.aborted)throw this.abortController.signal.reason??Error(`ACP connection closed`)}async sendMessage(e){return this.writeQueue=this.writeQueue.then(async()=>{let t=this.stream.writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(e=>{this.close(e)}),this.writeQueue}},q=class e extends Error{constructor(e,n,r){super(n),t(this,`code`,void 0),t(this,`data`,void 0),this.code=e,this.name=`RequestError`,this.data=r}static parseError(t,n){return new e(-32700,`Parse error${n?`: ${n}`:``}`,t)}static invalidRequest(t,n){return new e(-32600,`Invalid request${n?`: ${n}`:``}`,t)}static methodNotFound(t){return new e(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,n){return new e(-32602,`Invalid params${n?`: ${n}`:``}`,t)}static internalError(t,n){return new e(-32603,`Internal error${n?`: ${n}`:``}`,t)}static authRequired(t,n){return new e(-32e3,`Authentication required${n?`: ${n}`:``}`,t)}static resourceNotFound(t){return new e(-32002,`Resource not found${t?`: ${t}`:``}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}};re(),j(),ce(),ge(),de(),n(),i(),h(),l(),d(),g(),Se();function J(e,t){if(e)return t?De(e)?e:Oe(t,e):e}var yi=!(typeof process.geteuid==`function`?process.geteuid()===0:typeof process.getuid==`function`&&process.getuid()===0)||!!process.env.IS_SANDBOX,bi={auto:`auto`,default:`default`,acceptedits:`acceptEdits`,dontask:`dontAsk`,plan:`plan`,bypasspermissions:`bypassPermissions`,bypass:`bypassPermissions`};function xi(e,t=`permissions.defaultMode`){if(e===void 0)return`default`;if(typeof e!=`string`)throw Error(`Invalid ${t}: expected a string.`);let n=e.trim().toLowerCase();if(n===``)throw Error(`Invalid ${t}: expected a non-empty string.`);let r=bi[n];if(!r)throw Error(`Invalid ${t}: ${e}.`);if(r===`bypassPermissions`&&!yi)throw Error(`Invalid ${t}: bypassPermissions is not available when running as root.`);return r}function Si(e){let t=[...e.mcpServers??[]].sort((e,t)=>e.name.localeCompare(t.name));return JSON.stringify({cwd:e.cwd,mcpServers:t})}var Ci=256;function wi(e){let t=e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim();return t.length<=Ci?t:`${t.slice(0,Ci-1)}…`}function Ti(e,t){if(!t)return e;let n=N.resolve(t),r=N.resolve(e);return r.startsWith(n+N.sep)||r===n?N.relative(n,r):e}function Ei(e){let t="```";for(let n of e.matchAll(/^```+/gm)??[])for(;n[0].length>=t.length;)t+="`";return`${t}\n${e}${e.endsWith(`
3
+ `,i=e.getWriter();try{await i.write(n.encode(r))}finally{i.releaseLock()}}})}}te();var hi,gi=class{constructor(e,n){t(this,`connection`,void 0);let r=e(this),i=async(e,t)=>{switch(e){case P.initialize:{let e=cn.parse(t);return r.initialize(e)}case P.session_new:{let e=Gt.parse(t);return r.newSession(e)}case P.session_load:{if(!r.loadSession)throw q.methodNotFound(e);let n=Gn.parse(t);return r.loadSession(n)}case P.session_list:{if(!r.listSessions)throw q.methodNotFound(e);let n=ut.parse(t);return r.listSessions(n)}case P.session_fork:{if(!r.unstable_forkSession)throw q.methodNotFound(e);let n=Un.parse(t);return r.unstable_forkSession(n)}case P.session_resume:{if(!r.unstable_resumeSession)throw q.methodNotFound(e);let n=Yn.parse(t);return r.unstable_resumeSession(n)}case P.session_close:{if(!r.unstable_closeSession)throw q.methodNotFound(e);let n=Ln.parse(t);return r.unstable_closeSession(n)}case P.session_set_mode:{if(!r.setSessionMode)throw q.methodNotFound(e);let n=ur.parse(t);return await r.setSessionMode(n)??{}}case P.authenticate:{let e=Fe.parse(t);return await r.authenticate(e)??{}}case P.logout:{if(!r.unstable_logout)throw q.methodNotFound(e);let n=pt.parse(t);return await r.unstable_logout(n)??{}}case P.session_prompt:{let e=zr.parse(t);return r.prompt(e)}case P.session_set_model:{if(!r.unstable_setSessionModel)throw q.methodNotFound(e);let n=fr.parse(t);return await r.unstable_setSessionModel(n)??{}}case P.session_set_config_option:{if(!r.setSessionConfigOption)throw q.methodNotFound(e);let n=cr.parse(t);return r.setSessionConfigOption(n)}case P.nes_start:{if(!r.unstable_startNes)throw q.methodNotFound(e);let n=fi.parse(t);return r.unstable_startNes(n)}case P.nes_suggest:{if(!r.unstable_suggestNes)throw q.methodNotFound(e);let n=vr.parse(t);return r.unstable_suggestNes(n)}case P.nes_close:{if(!r.unstable_closeNes)throw q.methodNotFound(e);let n=In.parse(t);return await r.unstable_closeNes(n)??{}}default:if(r.extMethod)return r.extMethod(e,t);throw q.methodNotFound(e)}},a=async(e,t)=>{switch(e){case P.session_cancel:{let e=Fn.parse(t);return r.cancel(e)}case P.document_did_open:{if(!r.unstable_didOpenDocument)return;let e=Vn.parse(t);return r.unstable_didOpenDocument(e)}case P.document_did_change:{if(!r.unstable_didChangeDocument)return;let e=Er.parse(t);return r.unstable_didChangeDocument(e)}case P.document_did_close:{if(!r.unstable_didCloseDocument)return;let e=zn.parse(t);return r.unstable_didCloseDocument(e)}case P.document_did_save:{if(!r.unstable_didSaveDocument)return;let e=Hn.parse(t);return r.unstable_didSaveDocument(e)}case P.document_did_focus:{if(!r.unstable_didFocusDocument)return;let e=Bn.parse(t);return r.unstable_didFocusDocument(e)}case P.nes_accept:{if(!r.unstable_acceptNes)return;let e=Pn.parse(t);return r.unstable_acceptNes(e)}case P.nes_reject:{if(!r.unstable_rejectNes)return;let e=qn.parse(t);return r.unstable_rejectNes(e)}default:if(r.extNotification)return r.extNotification(e,t);throw q.methodNotFound(e)}};this.connection=new vi(i,a,n)}async sessionUpdate(e){return await this.connection.sendNotification(F.session_update,e)}async requestPermission(e){return await this.connection.sendRequest(F.session_request_permission,e)}async readTextFile(e){return await this.connection.sendRequest(F.fs_read_text_file,e)}async writeTextFile(e){return await this.connection.sendRequest(F.fs_write_text_file,e)??{}}async createTerminal(e){return new _i((await this.connection.sendRequest(F.terminal_create,e)).terminalId,e.sessionId,this.connection)}async unstable_createElicitation(e){return await this.connection.sendRequest(F.elicitation_create,e)}async unstable_completeElicitation(e){return await this.connection.sendNotification(F.elicitation_complete,e)}async extMethod(e,t){return await this.connection.sendRequest(e,t)}async extNotification(e,t){return await this.connection.sendNotification(e,t)}get signal(){return this.connection.signal}get closed(){return this.connection.closed}};hi=Symbol.asyncDispose;var _i=class{constructor(e,n,r){t(this,`id`,void 0),t(this,`sessionId`,void 0),t(this,`connection`,void 0),this.id=e,this.sessionId=n,this.connection=r}async currentOutput(){return await this.connection.sendRequest(F.terminal_output,{sessionId:this.sessionId,terminalId:this.id})}async waitForExit(){return await this.connection.sendRequest(F.terminal_wait_for_exit,{sessionId:this.sessionId,terminalId:this.id})}async kill(){return await this.connection.sendRequest(F.terminal_kill,{sessionId:this.sessionId,terminalId:this.id})??{}}async release(){return await this.connection.sendRequest(F.terminal_release,{sessionId:this.sessionId,terminalId:this.id})??{}}async[hi](){await this.release()}},vi=class{constructor(e,n,r){t(this,`pendingResponses`,new Map),t(this,`nextRequestId`,0),t(this,`requestHandler`,void 0),t(this,`notificationHandler`,void 0),t(this,`stream`,void 0),t(this,`writeQueue`,Promise.resolve()),t(this,`abortController`,new AbortController),t(this,`closedPromise`,void 0),this.requestHandler=e,this.notificationHandler=n,this.stream=r,this.closedPromise=new Promise(e=>{this.abortController.signal.addEventListener(`abort`,()=>e())}),this.receive()}get signal(){return this.abortController.signal}get closed(){return this.closedPromise}async receive(){let e;try{let e=this.stream.readable.getReader();try{for(;!this.abortController.signal.aborted;){let{value:t,done:n}=await e.read();if(n)break;if(t)try{this.processMessage(t)}catch(e){console.error(`Unexpected error during message processing:`,t,e),`id`in t&&t.id!==void 0&&this.sendMessage({jsonrpc:`2.0`,id:t.id,error:{code:-32700,message:`Parse error`}})}}}finally{e.releaseLock()}}catch(t){e=t}finally{this.close(e)}}close(e){if(this.abortController.signal.aborted)return;let t=e??Error(`ACP connection closed`);for(let e of this.pendingResponses.values())e.reject(t);this.pendingResponses.clear(),this.abortController.abort(t)}async processMessage(e){if(`method`in e&&`id`in e){let t=await this.tryCallRequestHandler(e.method,e.params);`error`in t&&console.error(`Error handling request`,e,t.error),await this.sendMessage({jsonrpc:`2.0`,id:e.id,...t})}else if(`method`in e){let t=await this.tryCallNotificationHandler(e.method,e.params);`error`in t&&console.error(`Error handling notification`,e,t.error)}else`id`in e?this.handleResponse(e):console.error(`Invalid message`,{message:e})}async tryCallRequestHandler(e,t){try{return{result:await this.requestHandler(e,t)??null}}catch(e){if(e instanceof q)return e.toResult();if(e instanceof ee)return q.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return q.internalError(t?JSON.parse(t):{}).toResult()}catch{return q.internalError({details:t}).toResult()}}}async tryCallNotificationHandler(e,t){try{return await this.notificationHandler(e,t),{result:null}}catch(e){if(e instanceof q)return e.toResult();if(e instanceof ee)return q.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return q.internalError(t?JSON.parse(t):{}).toResult()}catch{return q.internalError({details:t}).toResult()}}}handleResponse(e){let t=this.pendingResponses.get(e.id);if(t){if(`result`in e)t.resolve(e.result);else if(`error`in e){let{code:n,message:r,data:i}=e.error;t.reject(new q(n,r,i))}this.pendingResponses.delete(e.id)}else console.error(`Got response to unknown request`,e.id)}sendRequest(e,t){this.throwIfClosed();let n=this.nextRequestId++,r=new Promise((e,t)=>{this.pendingResponses.set(n,{resolve:e,reject:t})});return r.catch(()=>{}),this.sendMessage({jsonrpc:`2.0`,id:n,method:e,params:t}),r}async sendNotification(e,t){this.throwIfClosed(),await this.sendMessage({jsonrpc:`2.0`,method:e,params:t})}throwIfClosed(){if(this.abortController.signal.aborted)throw this.abortController.signal.reason??Error(`ACP connection closed`)}async sendMessage(e){return this.writeQueue=this.writeQueue.then(async()=>{let t=this.stream.writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(e=>{this.close(e)}),this.writeQueue}},q=class e extends Error{constructor(e,n,r){super(n),t(this,`code`,void 0),t(this,`data`,void 0),this.code=e,this.name=`RequestError`,this.data=r}static parseError(t,n){return new e(-32700,`Parse error${n?`: ${n}`:``}`,t)}static invalidRequest(t,n){return new e(-32600,`Invalid request${n?`: ${n}`:``}`,t)}static methodNotFound(t){return new e(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,n){return new e(-32602,`Invalid params${n?`: ${n}`:``}`,t)}static internalError(t,n){return new e(-32603,`Internal error${n?`: ${n}`:``}`,t)}static authRequired(t,n){return new e(-32e3,`Authentication required${n?`: ${n}`:``}`,t)}static resourceNotFound(t){return new e(-32002,`Resource not found${t?`: ${t}`:``}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}};ie(),A(),ce(),ge(),de(),i(),a(),r(),c(),f(),g(),Se();function J(e,t){if(e)return t?De(e)?e:Oe(t,e):e}var yi=!(typeof process.geteuid==`function`?process.geteuid()===0:typeof process.getuid==`function`&&process.getuid()===0)||!!process.env.IS_SANDBOX,bi={auto:`auto`,default:`default`,acceptedits:`acceptEdits`,dontask:`dontAsk`,plan:`plan`,bypasspermissions:`bypassPermissions`,bypass:`bypassPermissions`};function xi(e,t=`permissions.defaultMode`){if(e===void 0)return`default`;if(typeof e!=`string`)throw Error(`Invalid ${t}: expected a string.`);let n=e.trim().toLowerCase();if(n===``)throw Error(`Invalid ${t}: expected a non-empty string.`);let r=bi[n];if(!r)throw Error(`Invalid ${t}: ${e}.`);if(r===`bypassPermissions`&&!yi)throw Error(`Invalid ${t}: bypassPermissions is not available when running as root.`);return r}function Si(e){let t=[...e.mcpServers??[]].sort((e,t)=>e.name.localeCompare(t.name));return JSON.stringify({cwd:e.cwd,mcpServers:t})}var Ci=256;function wi(e){let t=e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim();return t.length<=Ci?t:`${t.slice(0,Ci-1)}…`}function Ti(e,t){if(!t)return e;let n=N.resolve(t),r=N.resolve(e);return r.startsWith(n+N.sep)||r===n?N.relative(n,r):e}function Ei(e){let t="```";for(let n of e.matchAll(/^```+/gm)??[])for(;n[0].length>=t.length;)t+="`";return`${t}\n${e}${e.endsWith(`
4
4
  `)?``:`
5
5
  `}${t}`}function Y(e,t=!1,n){let r=e.name,i=e.input;switch(r){case`Agent`:case`Task`:{let e=i?.description??`Task`,t=i?.prompt;return{title:e,kind:`think`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Bash`:{let e=i?.command??`Terminal`,t=i?.description;return{title:e,kind:`execute`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Read`:{let e=i?.file_path,t=e??`File`,r=i?.offset,a=i?.limit,o=``;a&&a>0?o=` (${r??1} - ${(r??1)+a-1})`:r&&(o=` (from line ${r})`);let s=t?Ti(t,n):`File`,c=J(e,n);return{title:`Read ${s}${o}`,kind:`read`,locations:c?[{path:c,line:r??1}]:[],content:[]}}case`Write`:{let e=i?.file_path??``,t=i?.content??``,r=e?Ti(e,n):void 0,a=J(e,n);return{title:r?`Write ${r}`:`Write`,kind:`edit`,content:a?[{type:`diff`,path:a,oldText:null,newText:t}]:[{type:`content`,content:{type:`text`,text:t}}],locations:a?[{path:a}]:[]}}case`Edit`:{let e=i?.file_path??``,t=i?.old_string??``,r=i?.new_string??``,a=e?Ti(e,n):void 0,o=J(e,n);return{title:a?`Edit ${a}`:`Edit`,kind:`edit`,content:o?[{type:`diff`,path:o,oldText:t||null,newText:r}]:[],locations:o?[{path:o}]:[]}}case`Glob`:{let e=i?.path??``,t=i?.pattern??``,r=J(e,n),a=`Find`;return e&&(a+=` \`${e}\``),t&&(a+=` \`${t}\``),{title:a,kind:`search`,content:[],locations:r?[{path:r}]:[]}}case`Grep`:{let e=i?.pattern??``,t=i?.path??``,n=`grep`;return i?.[`-i`]&&(n+=` -i`),i?.[`-n`]&&(n+=` -n`),i?.[`-A`]!==void 0&&(n+=` -A ${i[`-A`]}`),i?.[`-B`]!==void 0&&(n+=` -B ${i[`-B`]}`),i?.[`-C`]!==void 0&&(n+=` -C ${i[`-C`]}`),i?.output_mode===`files_with_matches`?n+=` -l`:i?.output_mode===`count`&&(n+=` -c`),i?.head_limit!==void 0&&(n+=` | head -${i.head_limit}`),i?.glob&&(n+=` --include="${i.glob}"`),i?.type&&(n+=` --type=${i.type}`),i?.multiline&&(n+=` -P`),e&&(n+=` "${e}"`),t&&(n+=` ${t}`),{title:n,kind:`search`,content:[]}}case`TodoWrite`:{let e=i?.todos;return{title:Array.isArray(e)?`Update TODOs: ${e.map(e=>e.content).join(`, `)}`:`Update TODOs`,kind:`think`,content:[]}}case`ExitPlanMode`:{let e=i?.plan;return{title:`Ready to code?`,kind:`switch_mode`,content:e?[{type:`content`,content:{type:`text`,text:e}}]:[]}}default:return{title:r||`Unknown Tool`,kind:`other`,content:[]}}}function Di(e,t){return Array.isArray(e)&&e.length>0?{content:e.map(e=>({type:`content`,content:Oi(e,t)}))}:typeof e==`string`&&e.length>0?{content:[{type:`content`,content:{type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e}}]}:{}}function Oi(e,t){let n=e=>({type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e});switch(e.type){case`text`:{let n=e.text;return{type:`text`,text:t?`\`\`\`\n${n}\n\`\`\``:n}}case`image`:{let t=e.source;return t?.type===`base64`?{type:`image`,data:t.data,mimeType:t.media_type}:n(t?.type===`url`?`[image: ${t.url}]`:`[image: file reference]`)}case`resource_link`:{let t=e.uri;return{type:`resource_link`,uri:t,name:e.name??t,mimeType:e.mimeType}}case`resource`:{let t=e.resource;return{type:`resource`,resource:{uri:t?.uri??``,mimeType:t?.mimeType,...typeof t?.text==`string`?{text:t.text}:{},...typeof t?.blob==`string`?{blob:t.blob}:{}}}}case`tool_reference`:return n(`Tool: ${e.tool_name}`);case`tool_search_tool_search_result`:{let t=e.tool_references;return n(`Tools found: ${t?.map(e=>e.tool_name).join(`, `)||`none`}`)}case`tool_search_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);case`web_fetch_result`:return n(`Fetched: ${e.url}`);case`web_fetch_tool_result_error`:return n(`Error: ${e.error_code}`);case`code_execution_result`:case`bash_code_execution_result`:return n(`Output: ${e.stdout||e.stderr||``}`);case`code_execution_tool_result_error`:case`bash_code_execution_tool_result_error`:return n(`Error: ${e.error_code}`);case`text_editor_code_execution_view_result`:return n(e.content);case`text_editor_code_execution_create_result`:return n(e.is_file_update?`File updated`:`File created`);case`text_editor_code_execution_str_replace_result`:{let t=e.lines;return n(t?.join(`
6
6
  `)||``)}case`text_editor_code_execution_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);default:try{return{type:`text`,text:JSON.stringify(e)}}catch{return{type:`text`,text:`[content]`}}}}function ki(e,t,n=!1){if(!t)return{};let r=e.is_error===!0,i=e.content;if(r&&i)return Di(i,!0);switch(t.name){case`Read`:return typeof i==`string`&&i.length>0?{content:[{type:`content`,content:{type:`text`,text:Ei(i)}}]}:Array.isArray(i)&&i.length>0?{content:i.map(e=>({type:`content`,content:e.type===`text`?{type:`text`,text:Ei(e.text)}:Oi(e,!1)}))}:{};case`Bash`:{let e=``;if(i&&typeof i==`object`&&!Array.isArray(i)&&i.type===`bash_code_execution_result`){let t=i;e=[t.stdout,t.stderr].filter(Boolean).join(`
@@ -9,5 +9,5 @@ import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{A_ as n,B as r,Cc as i
9
9
 
10
10
  Compacting completed.`}}}));break;case`result`:{let t=g.usage;t&&(l.inputTokens+=t.input_tokens??0,l.outputTokens+=t.output_tokens??0,l.cachedReadTokens+=t.cache_read_input_tokens??0,l.cachedWriteTokens+=t.cache_creation_input_tokens??0);let i=g.modelUsage;if(i&&d){let e=Pi(i,d);e?.contextWindow&&(f=e.contextWindow)}u!==null&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`usage_update`,used:u,size:f}});let a=g.subtype,o=g.is_error;if(r.aborted){c=`cancelled`;break}switch(a){case`success`:{let e=g.stop_reason;c=e===`max_tokens`?`max_tokens`:e===`refusal`?`refusal`:`end_turn`,o&&(c=`end_turn`);break}case`error_during_execution`:c=g.stop_reason===`max_tokens`?`max_tokens`:`end_turn`;break;case`error_max_budget_usd`:case`error_max_turns`:case`error_max_structured_output_retries`:c=`max_turn_requests`;break}break}case`stream_event`:{let t=g.parent_tool_use_id;t===null&&m===null&&(m=M());let r=Mi(g,e,i,n,{clientCapabilities:a,cwd:o,messageId:t===null?m??void 0:void 0});for(let e of r)await n.sessionUpdate(e);p=!0;break}case`assistant`:{let t=g.message,r=g.parent_tool_use_id;if(t?.usage&&r===null){let e=t.usage;u=(typeof e.input_tokens==`number`?e.input_tokens:0)+(typeof e.output_tokens==`number`?e.output_tokens:0)+(typeof e.cache_read_input_tokens==`number`?e.cache_read_input_tokens:0)+(typeof e.cache_creation_input_tokens==`number`?e.cache_creation_input_tokens:0)}r===null&&t?.model&&t.model!==`<synthetic>`&&(d=t.model);let s;r===null&&(m===null&&(m=M()),s=m);let c=ji(g,e,i,n,{clientCapabilities:a,cwd:o,parentToolUseId:r,streamingActive:p,messageId:s});for(let e of c)await n.sessionUpdate(e);r===null&&(m=null);break}case`user`:break;case`progress`:{let t=g.data;if(!t)break;let r=t.type;if(r===`agent_progress`||r===`skill_progress`){let r=t.message;if(r){let t=r.content;if(t)for(let r of t)r.type===`text`&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:r.text}}})}}break}case`tool_use_summary`:break;case`attachment`:break;case`compact_boundary`:u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
11
11
 
12
- Compacting completed.`}}});break;default:Fi.debug(`Ignoring unknown SDK message type`);break}}if(r.aborted||s?.())return{stopReason:`cancelled`,usage:l}}catch(e){if(r.aborted)return{stopReason:`cancelled`,usage:l};throw e}return{stopReason:c,usage:l}}async function Ri(e,t,n,r,i,a){for(let o of t){let t=o;if(t.type!==`user`&&t.type!==`assistant`){Fi.debug(`Ignoring unknown SDK message type`);continue}if(t.isMeta===!0)continue;let s=t.message?.content;if(!s)continue;let c=t.type===`assistant`?`assistant`:`user`;if(typeof s==`string`){if(!s.trim())continue;let t=M();await n.sessionUpdate({sessionId:e,update:{sessionUpdate:c===`assistant`?`agent_message_chunk`:`user_message_chunk`,...t?{messageId:t}:{},content:{type:`text`,text:s}}});continue}if(Array.isArray(s)){let t=X(s,c,e,r,n,void 0,{clientCapabilities:i,cwd:a,messageId:M()});for(let e of t)await n.sessionUpdate(e)}}}function zi(e,t,n,i,a,o,s,c){return async(n,l,u,d,f,p)=>{let m=Vi(i);if(n.name===`ExitPlanMode`)return Bi(e,t,f,l,m,a,o,s,c);if(p!==void 0)return p;try{let e=await r(n,l,u,d,f);if(e.behavior===`allow`||e.behavior===`deny`)return e}catch(e){return console.error(`[ACP Permissions] Pipeline error:`,e),{behavior:`deny`,message:`Permission pipeline failed`,decisionReason:{type:`other`,reason:`Permission pipeline failed`},toolUseID:f}}let h=Y({name:n.name,id:f,input:l},m,a),g={toolCallId:f,title:h.title,kind:h.kind,status:`pending`,rawInput:l},_=[{kind:`allow_always`,name:`Always Allow`,optionId:`allow_always`},{kind:`allow_once`,name:`Allow`,optionId:`allow`},{kind:`reject_once`,name:`Reject`,optionId:`reject`},{kind:`reject_always`,name:`Always Reject`,optionId:`reject_always`}];try{let n=await e.requestPermission({sessionId:t,toolCall:g,options:_});if(n.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Permission request cancelled by client`,decisionReason:{type:`mode`,mode:`default`},toolUseID:f};if(n.outcome.outcome===`selected`&&`optionId`in n.outcome&&n.outcome.optionId!==void 0){let e=n.outcome.optionId;if(e===`allow`||e===`allow_always`)return{behavior:`allow`,updatedInput:l}}return{behavior:`deny`,message:`Permission denied by client`,decisionReason:{type:`mode`,mode:`default`}}}catch(e){return console.error(`[ACP Permissions] Client request error:`,e),{behavior:`deny`,message:`Permission request failed`,decisionReason:{type:`mode`,mode:`default`}}}}}async function Bi(e,t,n,r,i,a,o,s,c){let l=[{kind:`allow_always`,name:`Yes, and use "auto" mode`,optionId:`auto`},{kind:`allow_always`,name:`Yes, and auto-accept edits`,optionId:`acceptEdits`},{kind:`allow_once`,name:`Yes, and manually approve edits`,optionId:`default`},{kind:`reject_once`,name:`No, keep planning`,optionId:`plan`}];s?.()===!0&&l.unshift({kind:`allow_always`,name:`Yes, and bypass permissions`,optionId:`bypassPermissions`});let u=Y({name:`ExitPlanMode`,id:n,input:r},i,a),d={toolCallId:n,title:u.title,kind:u.kind,status:`pending`,rawInput:r},f=await e.requestPermission({sessionId:t,toolCall:d,options:l});if(f.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Tool use aborted`,decisionReason:{type:`mode`,mode:`default`}};if(f.outcome.outcome===`selected`&&`optionId`in f.outcome&&f.outcome.optionId!==void 0){let n=f.outcome.optionId;if(l.some(e=>e.optionId===n)&&(n==="default"||n===`acceptEdits`||n===`auto`||n===`bypassPermissions`))return o?.(n),await e.sessionUpdate({sessionId:t,update:{sessionUpdate:`current_mode_update`,currentModeId:n}}),{behavior:`allow`,updatedInput:r}}return{behavior:`deny`,message:`User rejected request to exit plan mode.`,decisionReason:{type:`mode`,mode:`plan`}}}function Vi(e){if(!e)return!1;if(e.terminal===!0)return!0;let t=e._meta;return!t||typeof t!=`object`?!1:t.terminal_output===!0}pe(),be(),o(),ue(),e(),_();var Z=class{constructor(e){t(this,`conn`,void 0),t(this,`sessions`,new Map),t(this,`clientCapabilities`,void 0),this.conn=e}async initialize(e){return this.clientCapabilities=e.clientCapabilities,{protocolVersion:1,authMethods:[],agentInfo:{name:`workmate`,title:`Work Mate`,version:typeof globalThis.MACRO==`object`&&globalThis.MACRO!==null?String(globalThis.MACRO.VERSION??`0.0.0`):`0.0.0`},agentCapabilities:{_meta:{claudeCode:{promptQueueing:!0,forkSession:!0}},promptCapabilities:{image:!1,embeddedContext:!0},mcpCapabilities:{http:!0,sse:!0},loadSession:!0,sessionCapabilities:{list:{},resume:{},close:{},delete:{}}}}}async authenticate(e){return{}}async newSession(e){let t=await this.createSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async unstable_resumeSession(e){let t=await this.getOrCreateSession({...e,replay:!1});return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async loadSession(e){let t=await this.getOrCreateSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async listSessions(e){if(e.cursor!==void 0&&e.cursor!==null)throw Error(`Pagination cursor not supported: listSessions returns all results in a single page.`);let t=e.cwd||ne(),n=await le(t),r=await s({dir:t}),i=[];for(let e of r){if(!e.cwd||await le(e.cwd)!==n)continue;let t=wi(e.summary??``);i.push({sessionId:e.sessionId,cwd:e.cwd,...t?{title:t}:{},updatedAt:new Date(e.lastModified).toISOString()})}return{sessions:i}}async unstable_forkSession(e){let{initialMessages:t}=await Hi(e.sessionId),n=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{initialMessages:t});return this.scheduleAvailableCommandsUpdate(n.sessionId),n}async unstable_closeSession(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return await this.teardownSession(e.sessionId),{}}async unstable_deleteSession(e){let t=await oe(e.sessionId);if(t)try{await Ee(t.filePath)}catch(e){if(e.code!==`ENOENT`)throw e}return this.sessions.has(e.sessionId)&&await this.teardownSession(e.sessionId),{}}async extMethod(e,t){if(e===`session/delete`){let e=t.sessionId;if(typeof e!=`string`||e.length===0)throw Error(`session/delete requires a non-empty sessionId`);return this.unstable_deleteSession({sessionId:e})}throw q.methodNotFound(e)}async cancel(e){let t=this.sessions.get(e.sessionId);if(t){t.cancelled=!0,t.cancelGeneration+=1;for(let[,e]of t.pendingMessages)e.resolve(!0);t.pendingMessages.clear(),t.pendingQueue=[],t.pendingQueueHead=0,t.queryEngine.interrupt()}}async setSessionMode(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return this.applySessionMode(e.sessionId,e.modeId),await this.conn.sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:e.modeId}}),await this.updateConfigOption(e.sessionId,`mode`,e.modeId),{}}async unstable_setSessionModel(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);return t.queryEngine.setModel(e.modelId),await this.updateConfigOption(e.sessionId,`model`,e.modelId),{}}async sendAvailableCommandsUpdate(e){let t=this.sessions.get(e);if(!t)return;let n=t.commands.filter(e=>e.type===`prompt`&&!e.isHidden&&e.userInvocable!==!1).map(e=>({name:e.name,description:e.description,input:e.argumentHint?{hint:e.argumentHint}:void 0}));await this.conn.sessionUpdate({sessionId:e,update:{sessionUpdate:`available_commands_update`,availableCommands:n}})}scheduleAvailableCommandsUpdate(e){setTimeout(()=>{this.sendAvailableCommandsUpdate(e).catch(e=>{console.error(`[ACP] Failed to send available commands update:`,e)})},0)}};async function Hi(e){let t;try{let n=await p(e);n&&n.messages.length>0&&(t=_e(n.messages))}catch(e){console.error(`[ACP] fork source load failed:`,e)}return{initialMessages:t}}var Ui=[`auto`,`default`,`acceptEdits`,`bypassPermissions`,`dontAsk`,`plan`];function Wi(e){return Ui.includes(e)}function Gi(e,t,n){if(t){let t=Ki(e,`_meta.permissionMode`);if(t===`bypassPermissions`&&!Yi())throw Error(`Mode not available: bypassPermissions cannot run as root (start the agent as a non-root user, or set IS_SANDBOX=1).`);return t}return qi(n)??`default`}function Ki(e,t){if(e==null)throw Error(`Invalid ${t}: expected a string.`);return xi(e,t)}function qi(e){if(e!=null)try{return xi(e,`permissions.defaultMode`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[ACP] Invalid permissions.defaultMode, using default:`,t);return}}function Ji(e,t){return!!e&&Object.hasOwn(e,t)}function Yi(){return Xi()}function Xi(){return process.env.IS_SANDBOX?!0:typeof process.geteuid==`function`?process.geteuid()!==0:typeof process.getuid!=`function`||process.getuid()!==0}function Zi(e,t){return[{id:`mode`,name:`Mode`,description:`Session permission mode`,category:`mode`,type:`select`,currentValue:e.currentModeId,options:e.availableModes.map(e=>({value:e.id,name:e.name,description:e.description}))},{id:`model`,name:`Model`,description:`AI model to use`,category:`model`,type:`select`,currentValue:t.currentModelId,options:t.availableModels.map(e=>({value:e.modelId,name:e.name,description:e.description??void 0}))}]}function Qi(e){let t=[];if(!Array.isArray(e))return t;for(let n of e){if(typeof n!=`object`||!n)continue;let e=n;if(Array.isArray(e.options))for(let n of e.options)n&&typeof n==`object`&&typeof n.value==`string`&&t.push(n.value);else typeof n.value==`string`&&t.push(n.value)}return t}function Q(e){return e.conn}function $(e){return e.clientCapabilities}function $i(e,t,n,r){n===`mode`?t.modes={...t.modes,currentModeId:r}:n===`model`&&(t.models={...t.models,currentModelId:r})}j();function ea(){return se().permissions?.defaultMode}async function ta(e,t={}){fe();let n=t.sessionId??M(),r=e.cwd;A(n,ie()),k(r);let i=process.cwd(),o=!1;try{process.chdir(r),o=!0}catch{}ae(),xe();try{let i=he(),o=u(i),s=e._meta,l=Ji(s,`permissionMode`),d=Gi(l?s?.permissionMode:void 0,l,ea()),p=$(this),h=this.conn,g=zi(h,n,()=>this.sessions.get(n)?.modes.currentModeId??`default`,p,r,e=>{this.applySessionMode(n,e)},()=>this.sessions.get(n)?.appState.toolPermissionContext.isBypassPermissionsModeAvailable??!1),_=Yi(),v={...c(),toolPermissionContext:{...i,mode:d,isBypassPermissionsModeAvailable:_}},[y,b]=await Promise.all([m(r),f(r)]);v.agentDefinitions=b;let x=new ve({cwd:r,tools:o,commands:y,mcpClients:[],agents:b.activeAgents,canUseTool:g,getAppState:()=>v,setAppState:e=>{let t=e(v);Object.assign(v,t)},readFileCache:new a(500,50*1024*1024),includePartialMessages:!0,replayUserMessages:!0,initialMessages:t.initialMessages}),S={currentModeId:d,availableModes:[{id:`default`,name:`Default`,description:`Standard behavior, prompts for dangerous operations`},{id:`acceptEdits`,name:`Accept Edits`,description:`Auto-accept file edit operations`},{id:`plan`,name:`Plan Mode`,description:`Planning mode, no actual tool execution`},{id:`auto`,name:`Auto`,description:`Use a model classifier to approve/deny permission prompts.`},..._?[{id:`bypassPermissions`,name:`Bypass Permissions`,description:`Skip all permission checks`}]:[],{id:`dontAsk`,name:`Don't Ask`,description:`Don't prompt for permissions, deny if not pre-approved`}]},C=ye(),w=me(),T={availableModels:C.map(e=>({modelId:String(e.value??``),name:e.label??String(e.value??``),description:e.description??void 0})),currentModelId:w};x.setModel(w);let E=Zi(S,T),D={queryEngine:x,cancelled:!1,cancelGeneration:0,cwd:r,modes:S,models:T,configOptions:E,promptRunning:!1,pendingMessages:new Map,pendingQueue:[],pendingQueueHead:0,toolUseCache:{},clientCapabilities:p,appState:v,commands:y,sessionFingerprint:Si({cwd:r,mcpServers:e.mcpServers})};return this.sessions.set(n,D),{sessionId:n,modes:S,models:T,configOptions:E}}finally{o&&process.chdir(i)}}Object.assign(Z.prototype,{createSession:ta}),_(),j(),ue();async function na(e){let t=e.replay!==!1,n=this.sessions.get(e.sessionId);if(n){if(Si({cwd:e.cwd,mcpServers:e.mcpServers})===n.sessionFingerprint){let r=await oe(e.sessionId,e.cwd);return A(e.sessionId,r?Ce(r.filePath):null),k(e.cwd),t&&await this.replaySessionHistory(e),{sessionId:e.sessionId,modes:n.modes,models:n.models,configOptions:n.configOptions}}await this.teardownSession(e.sessionId)}let r=await oe(e.sessionId,e.cwd),i=r?Ce(r.filePath):null;A(e.sessionId,i),k(e.cwd);let a;if(r)try{let t=await p(e.sessionId);t&&t.messages.length>0&&(a=_e(t.messages))}catch(e){console.error(`[ACP] Failed to load session history:`,e)}let o=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{sessionId:e.sessionId,initialMessages:a});if(t&&a&&a.length>0){let t=this.sessions.get(e.sessionId);t&&await Ri(e.sessionId,a,Q(this),t.toolUseCache,$(this),t.cwd)}return{sessionId:o.sessionId,modes:o.modes,models:o.models,configOptions:o.configOptions}}async function ra(e){this.sessions.get(e)&&(await this.cancel({sessionId:e}),this.sessions.delete(e))}async function ia(e){try{let t=await p(e.sessionId);if(!t||t.messages.length===0)return;let n=_e(t.messages);if(n.length===0)return;let r=this.sessions.get(e.sessionId);if(!r)return;await Ri(e.sessionId,n,Q(this),r.toolUseCache,$(this),r.cwd)}catch(e){console.error(`[ACP] Failed to replay session history:`,e)}}function aa(e,t){if(!Wi(t))throw Error(`Invalid mode: ${t}`);let n=this.sessions.get(e);if(n){if(t===`bypassPermissions`&&!n.appState.toolPermissionContext.isBypassPermissionsModeAvailable||!n.modes.availableModes.some(e=>e.id===t))throw Error(`Mode not available: ${t}`);n.modes={...n.modes,currentModeId:t},n.appState.toolPermissionContext={...n.appState.toolPermissionContext,mode:t}}}async function oa(e,t,n){let r=this.sessions.get(e);r&&($i(this,r,t,n),r.configOptions=r.configOptions.map(e=>e.id===t&&typeof e.currentValue==`string`?{...e,currentValue:n}:e),await Q(this).sessionUpdate({sessionId:e,update:{sessionUpdate:`config_option_update`,configOptions:r.configOptions}}))}Object.assign(Z.prototype,{getOrCreateSession:na,teardownSession:ra,replaySessionHistory:ia,applySessionMode:aa,updateConfigOption:oa});function sa(e){if(!e||e.length===0)return``;let t=[];for(let n of e){let e=n;if(e.type===`text`)t.push(String(e.text??``));else if(e.type===`resource_link`){let n=typeof e.name==`string`?e.name:void 0,r=typeof e.uri==`string`?e.uri:void 0;t.push(ca(n,r))}else if(e.type===`resource`){let n=e.resource;if(n&&typeof n.text==`string`)t.push(n.text);else if(n&&typeof n.blob==`string`){let e=typeof n.mimeType==`string`?n.mimeType:`application/octet-stream`,r=typeof n.uri==`string`?n.uri:`(unknown uri)`;t.push(`Embedded resource: ${r} (${e}, base64 blob, ${n.blob.length} chars)`)}}}return t.filter(e=>e.length>0).join(`
13
- `)}function ca(e,t){let n=[];return e&&e.length>0&&n.push(`name=${e}`),t&&t.length>0&&n.push(`uri=${t}`),n.length>0?`Resource link: ${n.join(`, `)}`:`Resource link`}function la(e){for(;e.pendingQueueHead<e.pendingQueue.length;){let t=e.pendingQueue[e.pendingQueueHead++];if(!t)continue;let n=e.pendingMessages.get(t);if(n)return e.pendingMessages.delete(t),ua(e),n}ua(e)}function ua(e){if(e.pendingQueueHead!==0){if(e.pendingQueueHead>=e.pendingQueue.length){e.pendingQueue=[],e.pendingQueueHead=0;return}e.pendingQueueHead>1024&&e.pendingQueueHead*2>e.pendingQueue.length&&(e.pendingQueue=e.pendingQueue.slice(e.pendingQueueHead),e.pendingQueueHead=0)}}j();async function da(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session ${e.sessionId} not found`);let n=e.messageId??void 0,r=sa(e.prompt);if(!r.trim())throw Error(`Prompt content is empty`);let i=t.cancelGeneration;if(t.promptRunning){let e=M();if(await new Promise(n=>{t.pendingQueue.push(e),t.pendingMessages.set(e,{resolve:n})}))return{stopReason:`cancelled`}}if(t.cancelGeneration!==i)return{stopReason:`cancelled`};t.cancelled=!1,t.promptRunning=!0;try{t.queryEngine.resetAbortController(),A(e.sessionId,ie());let i=t.queryEngine.submitMessage(r),{stopReason:a,usage:o}=await Li(e.sessionId,i,Q(this),t.queryEngine.getAbortSignal(),t.toolUseCache,$(this),t.cwd,()=>t.cancelled);if(t.cancelled)return{stopReason:`cancelled`};if(await pa(this,e.sessionId,r),o){let e={inputTokens:o.inputTokens,outputTokens:o.outputTokens,cachedReadTokens:o.cachedReadTokens,cachedWriteTokens:o.cachedWriteTokens,thoughtTokens:0,totalTokens:o.inputTokens+o.outputTokens+o.cachedReadTokens+o.cachedWriteTokens+0};return{stopReason:a,usage:e,...n?{userMessageId:n}:{},_meta:{claudeCode:{usage:e}}}}return{stopReason:a,...n?{userMessageId:n}:{}}}catch(n){let r=n instanceof Error&&(n.name===`AbortError`||/abort|cancelled|interrupt/i.test(n.message));if(t.cancelled||r)return{stopReason:`cancelled`};throw n instanceof Error&&(n.message.includes(`terminated`)||n.message.includes(`process exited`))?(await this.teardownSession(e.sessionId),Error(`The Work Mate Agent process exited unexpectedly. Please start a new session.`)):n}finally{let e=la(t);e?(t.promptRunning=!0,e.resolve(!1)):t.promptRunning=!1}}async function fa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);if(typeof e.value!=`string`)throw Error(`Invalid value for config option ${e.configId}: ${String(e.value)}`);let n=t.configOptions.find(t=>t.id===e.configId);if(!n)throw Error(`Unknown config option: ${e.configId}`);if(n.type===`select`){let t=Qi(n.options);if(!t.includes(e.value))throw Error(`Invalid value '${e.value}' for config option ${e.configId}; must be one of: ${t.join(`, `)}`)}let r=e.value;return e.configId===`mode`?(this.applySessionMode(e.sessionId,r),await Q(this).sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:r}})):e.configId===`model`&&t.queryEngine.setModel(r),$i(this,t,e.configId,r),t.configOptions=t.configOptions.map(t=>t.id===e.configId&&typeof t.currentValue==`string`?{...t,currentValue:r}:t),{configOptions:t.configOptions}}async function pa(e,t,n){let r=e.sessions.get(t);if(!r)return;let i=r.toolUseCache;if(i.__sessionInfoTitleSent)return;i.__sessionInfoTitleSent=!0;let a=wi(n).slice(0,100);try{await Q(e).sessionUpdate({sessionId:t,update:{sessionUpdate:`session_info_update`,...a?{title:a}:{},updatedAt:new Date().toISOString()}})}catch(e){console.error(`[ACP] Failed to send session_info_update:`,e)}}Object.assign(Z.prototype,{prompt:da,setSessionConfigOption:fa}),de(),Se();function ma(e,t){let n=we.toWeb(e);return mi(Te.toWeb(t),n)}async function ha(){fe(),xe();let e=ma(process.stdin,process.stdout),t,n=new gi(e=>(t=new Z(e),t),e);console.log=console.error,console.info=console.error,console.warn=console.error,console.debug=console.error;async function r(){for(let[e]of t.sessions)try{await t.unstable_closeSession({sessionId:e})}catch{}process.exit(0)}n.closed.then(r).catch(r),process.on(`SIGTERM`,r),process.on(`SIGINT`,r),process.on(`unhandledRejection`,(e,t)=>{console.error(`Unhandled Rejection at:`,t,`reason:`,e)}),process.stdin.resume()}export{ha as runAcpAgent};
12
+ Compacting completed.`}}});break;default:Fi.debug(`Ignoring unknown SDK message type`);break}}if(r.aborted||s?.())return{stopReason:`cancelled`,usage:l}}catch(e){if(r.aborted)return{stopReason:`cancelled`,usage:l};throw e}return{stopReason:c,usage:l}}async function Ri(e,t,n,r,i,a){for(let o of t){let t=o;if(t.type!==`user`&&t.type!==`assistant`){Fi.debug(`Ignoring unknown SDK message type`);continue}if(t.isMeta===!0)continue;let s=t.message?.content;if(!s)continue;let c=t.type===`assistant`?`assistant`:`user`;if(typeof s==`string`){if(!s.trim())continue;let t=M();await n.sessionUpdate({sessionId:e,update:{sessionUpdate:c===`assistant`?`agent_message_chunk`:`user_message_chunk`,...t?{messageId:t}:{},content:{type:`text`,text:s}}});continue}if(Array.isArray(s)){let t=X(s,c,e,r,n,void 0,{clientCapabilities:i,cwd:a,messageId:M()});for(let e of t)await n.sessionUpdate(e)}}}function zi(e,t,r,i,a,o,s,c){return async(r,l,u,d,f,p)=>{let m=Vi(i);if(r.name===`ExitPlanMode`)return Bi(e,t,f,l,m,a,o,s,c);if(p!==void 0)return p;try{let e=await n(r,l,u,d,f);if(e.behavior===`allow`||e.behavior===`deny`)return e}catch(e){return console.error(`[ACP Permissions] Pipeline error:`,e),{behavior:`deny`,message:`Permission pipeline failed`,decisionReason:{type:`other`,reason:`Permission pipeline failed`},toolUseID:f}}let h=Y({name:r.name,id:f,input:l},m,a),g={toolCallId:f,title:h.title,kind:h.kind,status:`pending`,rawInput:l},_=[{kind:`allow_always`,name:`Always Allow`,optionId:`allow_always`},{kind:`allow_once`,name:`Allow`,optionId:`allow`},{kind:`reject_once`,name:`Reject`,optionId:`reject`},{kind:`reject_always`,name:`Always Reject`,optionId:`reject_always`}];try{let n=await e.requestPermission({sessionId:t,toolCall:g,options:_});if(n.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Permission request cancelled by client`,decisionReason:{type:`mode`,mode:`default`},toolUseID:f};if(n.outcome.outcome===`selected`&&`optionId`in n.outcome&&n.outcome.optionId!==void 0){let e=n.outcome.optionId;if(e===`allow`||e===`allow_always`)return{behavior:`allow`,updatedInput:l}}return{behavior:`deny`,message:`Permission denied by client`,decisionReason:{type:`mode`,mode:`default`}}}catch(e){return console.error(`[ACP Permissions] Client request error:`,e),{behavior:`deny`,message:`Permission request failed`,decisionReason:{type:`mode`,mode:`default`}}}}}async function Bi(e,t,n,r,i,a,o,s,c){let l=[{kind:`allow_always`,name:`Yes, and use "auto" mode`,optionId:`auto`},{kind:`allow_always`,name:`Yes, and auto-accept edits`,optionId:`acceptEdits`},{kind:`allow_once`,name:`Yes, and manually approve edits`,optionId:`default`},{kind:`reject_once`,name:`No, keep planning`,optionId:`plan`}];s?.()===!0&&l.unshift({kind:`allow_always`,name:`Yes, and bypass permissions`,optionId:`bypassPermissions`});let u=Y({name:`ExitPlanMode`,id:n,input:r},i,a),d={toolCallId:n,title:u.title,kind:u.kind,status:`pending`,rawInput:r},f=await e.requestPermission({sessionId:t,toolCall:d,options:l});if(f.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Tool use aborted`,decisionReason:{type:`mode`,mode:`default`}};if(f.outcome.outcome===`selected`&&`optionId`in f.outcome&&f.outcome.optionId!==void 0){let n=f.outcome.optionId;if(l.some(e=>e.optionId===n)&&(n==="default"||n===`acceptEdits`||n===`auto`||n===`bypassPermissions`))return o?.(n),await e.sessionUpdate({sessionId:t,update:{sessionUpdate:`current_mode_update`,currentModeId:n}}),{behavior:`allow`,updatedInput:r}}return{behavior:`deny`,message:`User rejected request to exit plan mode.`,decisionReason:{type:`mode`,mode:`plan`}}}function Vi(e){if(!e)return!1;if(e.terminal===!0)return!0;let t=e._meta;return!t||typeof t!=`object`?!1:t.terminal_output===!0}pe(),be(),s(),le(),e(),m();var Z=class{constructor(e){t(this,`conn`,void 0),t(this,`sessions`,new Map),t(this,`clientCapabilities`,void 0),this.conn=e}async initialize(e){return this.clientCapabilities=e.clientCapabilities,{protocolVersion:1,authMethods:[],agentInfo:{name:`workmate`,title:`Work Mate`,version:typeof globalThis.MACRO==`object`&&globalThis.MACRO!==null?String(globalThis.MACRO.VERSION??`0.0.0`):`0.0.0`},agentCapabilities:{_meta:{claudeCode:{promptQueueing:!0,forkSession:!0}},promptCapabilities:{image:!1,embeddedContext:!0},mcpCapabilities:{http:!0,sse:!0},loadSession:!0,sessionCapabilities:{list:{},resume:{},close:{},delete:{}}}}}async authenticate(e){return{}}async newSession(e){let t=await this.createSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async unstable_resumeSession(e){let t=await this.getOrCreateSession({...e,replay:!1});return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async loadSession(e){let t=await this.getOrCreateSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async listSessions(e){if(e.cursor!==void 0&&e.cursor!==null)throw Error(`Pagination cursor not supported: listSessions returns all results in a single page.`);let t=e.cwd||ne(),n=await ue(t),r=await p({dir:t}),i=[];for(let e of r){if(!e.cwd||await ue(e.cwd)!==n)continue;let t=wi(e.summary??``);i.push({sessionId:e.sessionId,cwd:e.cwd,...t?{title:t}:{},updatedAt:new Date(e.lastModified).toISOString()})}return{sessions:i}}async unstable_forkSession(e){let{initialMessages:t}=await Hi(e.sessionId),n=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{initialMessages:t});return this.scheduleAvailableCommandsUpdate(n.sessionId),n}async unstable_closeSession(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return await this.teardownSession(e.sessionId),{}}async unstable_deleteSession(e){let t=await oe(e.sessionId);if(t)try{await Ee(t.filePath)}catch(e){if(e.code!==`ENOENT`)throw e}return this.sessions.has(e.sessionId)&&await this.teardownSession(e.sessionId),{}}async extMethod(e,t){if(e===`session/delete`){let e=t.sessionId;if(typeof e!=`string`||e.length===0)throw Error(`session/delete requires a non-empty sessionId`);return this.unstable_deleteSession({sessionId:e})}throw q.methodNotFound(e)}async cancel(e){let t=this.sessions.get(e.sessionId);if(t){t.cancelled=!0,t.cancelGeneration+=1;for(let[,e]of t.pendingMessages)e.resolve(!0);t.pendingMessages.clear(),t.pendingQueue=[],t.pendingQueueHead=0,t.queryEngine.interrupt()}}async setSessionMode(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return this.applySessionMode(e.sessionId,e.modeId),await this.conn.sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:e.modeId}}),await this.updateConfigOption(e.sessionId,`mode`,e.modeId),{}}async unstable_setSessionModel(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);return t.queryEngine.setModel(e.modelId),await this.updateConfigOption(e.sessionId,`model`,e.modelId),{}}async sendAvailableCommandsUpdate(e){let t=this.sessions.get(e);if(!t)return;let n=t.commands.filter(e=>e.type===`prompt`&&!e.isHidden&&e.userInvocable!==!1).map(e=>({name:e.name,description:e.description,input:e.argumentHint?{hint:e.argumentHint}:void 0}));await this.conn.sessionUpdate({sessionId:e,update:{sessionUpdate:`available_commands_update`,availableCommands:n}})}scheduleAvailableCommandsUpdate(e){setTimeout(()=>{this.sendAvailableCommandsUpdate(e).catch(e=>{console.error(`[ACP] Failed to send available commands update:`,e)})},0)}};async function Hi(e){let t;try{let n=await _(e);n&&n.messages.length>0&&(t=_e(n.messages))}catch(e){console.error(`[ACP] fork source load failed:`,e)}return{initialMessages:t}}var Ui=[`auto`,`default`,`acceptEdits`,`bypassPermissions`,`dontAsk`,`plan`];function Wi(e){return Ui.includes(e)}function Gi(e,t,n){if(t){let t=Ki(e,`_meta.permissionMode`);if(t===`bypassPermissions`&&!Yi())throw Error(`Mode not available: bypassPermissions cannot run as root (start the agent as a non-root user, or set IS_SANDBOX=1).`);return t}return qi(n)??`default`}function Ki(e,t){if(e==null)throw Error(`Invalid ${t}: expected a string.`);return xi(e,t)}function qi(e){if(e!=null)try{return xi(e,`permissions.defaultMode`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[ACP] Invalid permissions.defaultMode, using default:`,t);return}}function Ji(e,t){return!!e&&Object.hasOwn(e,t)}function Yi(){return Xi()}function Xi(){return process.env.IS_SANDBOX?!0:typeof process.geteuid==`function`?process.geteuid()!==0:typeof process.getuid!=`function`||process.getuid()!==0}function Zi(e,t){return[{id:`mode`,name:`Mode`,description:`Session permission mode`,category:`mode`,type:`select`,currentValue:e.currentModeId,options:e.availableModes.map(e=>({value:e.id,name:e.name,description:e.description}))},{id:`model`,name:`Model`,description:`AI model to use`,category:`model`,type:`select`,currentValue:t.currentModelId,options:t.availableModels.map(e=>({value:e.modelId,name:e.name,description:e.description??void 0}))}]}function Qi(e){let t=[];if(!Array.isArray(e))return t;for(let n of e){if(typeof n!=`object`||!n)continue;let e=n;if(Array.isArray(e.options))for(let n of e.options)n&&typeof n==`object`&&typeof n.value==`string`&&t.push(n.value);else typeof n.value==`string`&&t.push(n.value)}return t}function Q(e){return e.conn}function $(e){return e.clientCapabilities}function $i(e,t,n,r){n===`mode`?t.modes={...t.modes,currentModeId:r}:n===`model`&&(t.models={...t.models,currentModelId:r})}A();function ea(){return se().permissions?.defaultMode}async function ta(e,t={}){fe();let n=t.sessionId??M(),r=e.cwd;j(n,re()),k(r);let i=process.cwd(),a=!1;try{process.chdir(r),a=!0}catch{}ae(),xe();try{let i=he(),a=d(i),s=e._meta,c=Ji(s,`permissionMode`),f=Gi(c?s?.permissionMode:void 0,c,ea()),p=$(this),m=this.conn,g=zi(m,n,()=>this.sessions.get(n)?.modes.currentModeId??`default`,p,r,e=>{this.applySessionMode(n,e)},()=>this.sessions.get(n)?.appState.toolPermissionContext.isBypassPermissionsModeAvailable??!1),_=Yi(),v={...o(),toolPermissionContext:{...i,mode:f,isBypassPermissionsModeAvailable:_}},[y,b]=await Promise.all([l(r),h(r)]);v.agentDefinitions=b;let x=new ve({cwd:r,tools:a,commands:y,mcpClients:[],agents:b.activeAgents,canUseTool:g,getAppState:()=>v,setAppState:e=>{let t=e(v);Object.assign(v,t)},readFileCache:new u(500,50*1024*1024),includePartialMessages:!0,replayUserMessages:!0,initialMessages:t.initialMessages}),S={currentModeId:f,availableModes:[{id:`default`,name:`Default`,description:`Standard behavior, prompts for dangerous operations`},{id:`acceptEdits`,name:`Accept Edits`,description:`Auto-accept file edit operations`},{id:`plan`,name:`Plan Mode`,description:`Planning mode, no actual tool execution`},{id:`auto`,name:`Auto`,description:`Use a model classifier to approve/deny permission prompts.`},..._?[{id:`bypassPermissions`,name:`Bypass Permissions`,description:`Skip all permission checks`}]:[],{id:`dontAsk`,name:`Don't Ask`,description:`Don't prompt for permissions, deny if not pre-approved`}]},C=ye(),w=me(),T={availableModels:C.map(e=>({modelId:String(e.value??``),name:e.label??String(e.value??``),description:e.description??void 0})),currentModelId:w};x.setModel(w);let E=Zi(S,T),D={queryEngine:x,cancelled:!1,cancelGeneration:0,cwd:r,modes:S,models:T,configOptions:E,promptRunning:!1,pendingMessages:new Map,pendingQueue:[],pendingQueueHead:0,toolUseCache:{},clientCapabilities:p,appState:v,commands:y,sessionFingerprint:Si({cwd:r,mcpServers:e.mcpServers})};return this.sessions.set(n,D),{sessionId:n,modes:S,models:T,configOptions:E}}finally{a&&process.chdir(i)}}Object.assign(Z.prototype,{createSession:ta}),m(),A(),le();async function na(e){let t=e.replay!==!1,n=this.sessions.get(e.sessionId);if(n){if(Si({cwd:e.cwd,mcpServers:e.mcpServers})===n.sessionFingerprint){let r=await oe(e.sessionId,e.cwd);return j(e.sessionId,r?Ce(r.filePath):null),k(e.cwd),t&&await this.replaySessionHistory(e),{sessionId:e.sessionId,modes:n.modes,models:n.models,configOptions:n.configOptions}}await this.teardownSession(e.sessionId)}let r=await oe(e.sessionId,e.cwd),i=r?Ce(r.filePath):null;j(e.sessionId,i),k(e.cwd);let a;if(r)try{let t=await _(e.sessionId);t&&t.messages.length>0&&(a=_e(t.messages))}catch(e){console.error(`[ACP] Failed to load session history:`,e)}let o=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{sessionId:e.sessionId,initialMessages:a});if(t&&a&&a.length>0){let t=this.sessions.get(e.sessionId);t&&await Ri(e.sessionId,a,Q(this),t.toolUseCache,$(this),t.cwd)}return{sessionId:o.sessionId,modes:o.modes,models:o.models,configOptions:o.configOptions}}async function ra(e){this.sessions.get(e)&&(await this.cancel({sessionId:e}),this.sessions.delete(e))}async function ia(e){try{let t=await _(e.sessionId);if(!t||t.messages.length===0)return;let n=_e(t.messages);if(n.length===0)return;let r=this.sessions.get(e.sessionId);if(!r)return;await Ri(e.sessionId,n,Q(this),r.toolUseCache,$(this),r.cwd)}catch(e){console.error(`[ACP] Failed to replay session history:`,e)}}function aa(e,t){if(!Wi(t))throw Error(`Invalid mode: ${t}`);let n=this.sessions.get(e);if(n){if(t===`bypassPermissions`&&!n.appState.toolPermissionContext.isBypassPermissionsModeAvailable||!n.modes.availableModes.some(e=>e.id===t))throw Error(`Mode not available: ${t}`);n.modes={...n.modes,currentModeId:t},n.appState.toolPermissionContext={...n.appState.toolPermissionContext,mode:t}}}async function oa(e,t,n){let r=this.sessions.get(e);r&&($i(this,r,t,n),r.configOptions=r.configOptions.map(e=>e.id===t&&typeof e.currentValue==`string`?{...e,currentValue:n}:e),await Q(this).sessionUpdate({sessionId:e,update:{sessionUpdate:`config_option_update`,configOptions:r.configOptions}}))}Object.assign(Z.prototype,{getOrCreateSession:na,teardownSession:ra,replaySessionHistory:ia,applySessionMode:aa,updateConfigOption:oa});function sa(e){if(!e||e.length===0)return``;let t=[];for(let n of e){let e=n;if(e.type===`text`)t.push(String(e.text??``));else if(e.type===`resource_link`){let n=typeof e.name==`string`?e.name:void 0,r=typeof e.uri==`string`?e.uri:void 0;t.push(ca(n,r))}else if(e.type===`resource`){let n=e.resource;if(n&&typeof n.text==`string`)t.push(n.text);else if(n&&typeof n.blob==`string`){let e=typeof n.mimeType==`string`?n.mimeType:`application/octet-stream`,r=typeof n.uri==`string`?n.uri:`(unknown uri)`;t.push(`Embedded resource: ${r} (${e}, base64 blob, ${n.blob.length} chars)`)}}}return t.filter(e=>e.length>0).join(`
13
+ `)}function ca(e,t){let n=[];return e&&e.length>0&&n.push(`name=${e}`),t&&t.length>0&&n.push(`uri=${t}`),n.length>0?`Resource link: ${n.join(`, `)}`:`Resource link`}function la(e){for(;e.pendingQueueHead<e.pendingQueue.length;){let t=e.pendingQueue[e.pendingQueueHead++];if(!t)continue;let n=e.pendingMessages.get(t);if(n)return e.pendingMessages.delete(t),ua(e),n}ua(e)}function ua(e){if(e.pendingQueueHead!==0){if(e.pendingQueueHead>=e.pendingQueue.length){e.pendingQueue=[],e.pendingQueueHead=0;return}e.pendingQueueHead>1024&&e.pendingQueueHead*2>e.pendingQueue.length&&(e.pendingQueue=e.pendingQueue.slice(e.pendingQueueHead),e.pendingQueueHead=0)}}A();async function da(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session ${e.sessionId} not found`);let n=e.messageId??void 0,r=sa(e.prompt);if(!r.trim())throw Error(`Prompt content is empty`);let i=t.cancelGeneration;if(t.promptRunning){let e=M();if(await new Promise(n=>{t.pendingQueue.push(e),t.pendingMessages.set(e,{resolve:n})}))return{stopReason:`cancelled`}}if(t.cancelGeneration!==i)return{stopReason:`cancelled`};t.cancelled=!1,t.promptRunning=!0;try{t.queryEngine.resetAbortController(),j(e.sessionId,re());let i=t.queryEngine.submitMessage(r),{stopReason:a,usage:o}=await Li(e.sessionId,i,Q(this),t.queryEngine.getAbortSignal(),t.toolUseCache,$(this),t.cwd,()=>t.cancelled);if(t.cancelled)return{stopReason:`cancelled`};if(await pa(this,e.sessionId,r),o){let e={inputTokens:o.inputTokens,outputTokens:o.outputTokens,cachedReadTokens:o.cachedReadTokens,cachedWriteTokens:o.cachedWriteTokens,thoughtTokens:0,totalTokens:o.inputTokens+o.outputTokens+o.cachedReadTokens+o.cachedWriteTokens+0};return{stopReason:a,usage:e,...n?{userMessageId:n}:{},_meta:{claudeCode:{usage:e}}}}return{stopReason:a,...n?{userMessageId:n}:{}}}catch(n){let r=n instanceof Error&&(n.name===`AbortError`||/abort|cancelled|interrupt/i.test(n.message));if(t.cancelled||r)return{stopReason:`cancelled`};throw n instanceof Error&&(n.message.includes(`terminated`)||n.message.includes(`process exited`))?(await this.teardownSession(e.sessionId),Error(`The Work Mate Agent process exited unexpectedly. Please start a new session.`)):n}finally{let e=la(t);e?(t.promptRunning=!0,e.resolve(!1)):t.promptRunning=!1}}async function fa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);if(typeof e.value!=`string`)throw Error(`Invalid value for config option ${e.configId}: ${String(e.value)}`);let n=t.configOptions.find(t=>t.id===e.configId);if(!n)throw Error(`Unknown config option: ${e.configId}`);if(n.type===`select`){let t=Qi(n.options);if(!t.includes(e.value))throw Error(`Invalid value '${e.value}' for config option ${e.configId}; must be one of: ${t.join(`, `)}`)}let r=e.value;return e.configId===`mode`?(this.applySessionMode(e.sessionId,r),await Q(this).sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:r}})):e.configId===`model`&&t.queryEngine.setModel(r),$i(this,t,e.configId,r),t.configOptions=t.configOptions.map(t=>t.id===e.configId&&typeof t.currentValue==`string`?{...t,currentValue:r}:t),{configOptions:t.configOptions}}async function pa(e,t,n){let r=e.sessions.get(t);if(!r)return;let i=r.toolUseCache;if(i.__sessionInfoTitleSent)return;i.__sessionInfoTitleSent=!0;let a=wi(n).slice(0,100);try{await Q(e).sessionUpdate({sessionId:t,update:{sessionUpdate:`session_info_update`,...a?{title:a}:{},updatedAt:new Date().toISOString()}})}catch(e){console.error(`[ACP] Failed to send session_info_update:`,e)}}Object.assign(Z.prototype,{prompt:da,setSessionConfigOption:fa}),de(),Se();function ma(e,t){let n=we.toWeb(e);return mi(Te.toWeb(t),n)}async function ha(){fe(),xe();let e=ma(process.stdin,process.stdout),t,n=new gi(e=>(t=new Z(e),t),e);console.log=console.error,console.info=console.error,console.warn=console.error,console.debug=console.error;async function r(){for(let[e]of t.sessions)try{await t.unstable_closeSession({sessionId:e})}catch{}process.exit(0)}n.closed.then(r).catch(r),process.on(`SIGTERM`,r),process.on(`SIGINT`,r),process.on(`unhandledRejection`,(e,t)=>{console.error(`Unhandled Rejection at:`,t,`reason:`,e)}),process.stdin.resume()}export{ha as runAcpAgent};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{homedir as r}from"os";import{join as i}from"path";function a(e){let t=process.env.NODE_OPTIONS;return t?t.split(/\s+/).includes(e):!1}function o(e){if(!e)return!1;if(typeof e==`boolean`)return e;let t=e.toLowerCase().trim();return[`1`,`true`,`yes`,`on`].includes(t)}function s(e){if(e===void 0)return!1;if(typeof e==`boolean`)return!e;if(!e)return!1;let t=e.toLowerCase().trim();return[`0`,`false`,`no`,`off`].includes(t)}function c(){return o(process.env.CLAUDE_CODE_SIMPLE)||process.argv.includes(`--bare`)}function l(e){let t={};if(e)for(let n of e){let[e,...r]=n.split(`=`);if(!e||r.length===0)throw Error(`Invalid environment variable format: ${n}, environment variables should be added as: -e KEY1=value1 -e KEY2=value2`);t[e]=r.join(`=`)}return t}function u(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||`us-east-1`}function d(){return process.env.CLOUD_ML_REGION||`us-east5`}function f(){return o(process.env.CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR)}function p(){return!1}function m(){return!1}function h(e){if(e){let t=_.find(([t])=>e.startsWith(t));if(t)return process.env[t[1]]||d()}return d()}var g,_,v=e((()=>{n(),g=t(()=>(process.env.WORKMATE_CONFIG_DIR??i(r(),`.workmate`)).normalize(`NFC`),()=>process.env.WORKMATE_CONFIG_DIR),_=[[`claude-haiku-4-5`,`VERTEX_REGION_CLAUDE_HAIKU_4_5`],[`claude-3-5-haiku`,`VERTEX_REGION_CLAUDE_3_5_HAIKU`],[`claude-3-5-sonnet`,`VERTEX_REGION_CLAUDE_3_5_SONNET`],[`claude-3-7-sonnet`,`VERTEX_REGION_CLAUDE_3_7_SONNET`],[`claude-opus-4-1`,`VERTEX_REGION_CLAUDE_4_1_OPUS`],[`claude-opus-4`,`VERTEX_REGION_CLAUDE_4_0_OPUS`],[`claude-sonnet-4-6`,`VERTEX_REGION_CLAUDE_4_6_SONNET`],[`claude-sonnet-4-5`,`VERTEX_REGION_CLAUDE_4_5_SONNET`],[`claude-sonnet-4`,`VERTEX_REGION_CLAUDE_4_0_SONNET`]]}));export{a,s as c,p as d,l as f,g as i,o as l,d as n,v as o,f as p,h as r,c as s,u as t,m as u};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{homedir as r}from"os";import{join as i}from"path";function a(e){let t=process.env.NODE_OPTIONS;return t?t.split(/\s+/).includes(e):!1}function o(e){if(!e)return!1;if(typeof e==`boolean`)return e;let t=e.toLowerCase().trim();return[`1`,`true`,`yes`,`on`].includes(t)}function s(e){if(e===void 0)return!1;if(typeof e==`boolean`)return!e;if(!e)return!1;let t=e.toLowerCase().trim();return[`0`,`false`,`no`,`off`].includes(t)}function c(){return o(process.env.CLAUDE_CODE_SIMPLE)||process.argv.includes(`--bare`)}function l(e){let t={};if(e)for(let n of e){let[e,...r]=n.split(`=`);if(!e||r.length===0)throw Error(`Invalid environment variable format: ${n}, environment variables should be added as: -e KEY1=value1 -e KEY2=value2`);t[e]=r.join(`=`)}return t}function u(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||`us-east-1`}function d(){return process.env.CLOUD_ML_REGION||`us-east5`}function f(){return o(process.env.CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR)}function p(){return!1}function m(e){if(e){let t=g.find(([t])=>e.startsWith(t));if(t)return process.env[t[1]]||d()}return d()}var h,g,_=e((()=>{n(),h=t(()=>(process.env.WORKMATE_CONFIG_DIR??i(r(),`.workmate`)).normalize(`NFC`),()=>process.env.WORKMATE_CONFIG_DIR),g=[[`claude-haiku-4-5`,`VERTEX_REGION_CLAUDE_HAIKU_4_5`],[`claude-3-5-haiku`,`VERTEX_REGION_CLAUDE_3_5_HAIKU`],[`claude-3-5-sonnet`,`VERTEX_REGION_CLAUDE_3_5_SONNET`],[`claude-3-7-sonnet`,`VERTEX_REGION_CLAUDE_3_7_SONNET`],[`claude-opus-4-1`,`VERTEX_REGION_CLAUDE_4_1_OPUS`],[`claude-opus-4`,`VERTEX_REGION_CLAUDE_4_0_OPUS`],[`claude-sonnet-4-6`,`VERTEX_REGION_CLAUDE_4_6_SONNET`],[`claude-sonnet-4-5`,`VERTEX_REGION_CLAUDE_4_5_SONNET`],[`claude-sonnet-4`,`VERTEX_REGION_CLAUDE_4_0_SONNET`]]}));export{a,s as c,l as d,f,h as i,o as l,d as n,_ as o,m as r,c as s,u as t,p as u};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{l as r,o as i}from"./envUtils-DfkgIdYf.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{E as s,O as c,S as l,i as u,l as d,n as f,s as p,v as ee}from"./esm-lWlUmoUA.js";import{B as m,C as te,D as h,E as ne,F as re,O as ie,S as ae,T as oe,b as se,c as ce,i as le,m as ue,n as g,o as de,u as fe,v as _,x as pe}from"./esm-BbMeEYcz.js";import{n as me,t as he}from"./esm-sVMjGuep.js";import{F as ge,I as _e,It as ve,Y as ye,at as be,st as xe,x as Se}from"./state-B4jiUise.js";import{C as Ce,I as we,i as Te,x as Ee}from"./debug-Bglx1aTu.js";import{Gt as De,Lr as Oe,Pr as ke,Ut as Ae,Wt as v,h as je,qt as Me,t as Ne}from"./settings-B2jvL8Dp.js";import{i as Pe,t as Fe}from"./execFileNoThrow-BTachNBI.js";import{a as Ie,n as Le,o as Re,r as ze}from"./platform-BacQ6ACS.js";import{Bt as Be,Ft as Ve,Gt as He,It as Ue,Lt as We,Pt as Ge,Qt as Ke,Vt as qe,Yt as y,Zt as Je,bt as Ye,d as Xe,o as Ze,t as b,yt as Qe,zt as $e}from"./model-BvQFFOf8.js";import{i as et,t as tt}from"./genericProcessUtils-DwQFuna9.js";import{arch as nt,hostname as rt,platform as it,release as at}from"os";import{extname as ot}from"path";import{stat as st}from"fs/promises";import{inspect as ct}from"util";import*as lt from"process";import{AsyncLocalStorage as ut}from"async_hooks";var x,dt=e((()=>{(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(x||(x={}))})),ft,pt,mt=e((()=>{ft=class{emit(e){}enabled(){return!1}},pt=new ft}));function ht(e,t,n){return r=>r===e?t:n}var S,C,gt=e((()=>{S=Symbol.for(`io.opentelemetry.js.api.logs`),C=globalThis})),_t,vt,yt=e((()=>{mt(),_t=class{getLogger(e,t,n){return new ft}},vt=new _t})),bt,xt=e((()=>{mt(),bt=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):pt}}})),w,St=e((()=>{yt(),xt(),w=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new bt(this,e,t,n)}_getDelegate(){return this._delegate??vt}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}}})),Ct,wt=e((()=>{gt(),yt(),St(),Ct=class e{constructor(){this._proxyLoggerProvider=new w}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return C[S]?this.getLoggerProvider():(C[S]=ht(1,e,vt),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return C[S]?.call(C,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete C[S],this._proxyLoggerProvider=new w}}})),Tt,T=e((()=>{dt(),mt(),wt(),Tt=Ct.getInstance()}));function Et(){return`workmate/0.0.24`}var Dt=e((()=>{})),Ot,kt,E,At=e((()=>{n(),Je(),Ot=[{modelEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],kt=[{modelEnvVar:`OPENAI_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],E=t((e,t)=>{if(y()===`firstParty`)return;let n=e.toLowerCase(),r=y()===`openai`?kt:Ot;for(let e of r){let r=process.env[e.modelEnvVar],i=process.env[e.capabilitiesEnvVar];if(!(!r||i===void 0)&&n===r.toLowerCase())return i.toLowerCase().split(`,`).map(e=>e.trim()).includes(t)}},(e,t)=>`${e.toLowerCase()}:${t}`)}));function jt(e){let t=[],n=[];for(let r of e)O.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function Mt(e){if(!e||e.length===0)return;let{allowed:t,disallowed:n}=jt(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${O.join(`, `)}`);return t.length>0?t:void 0}function Nt(e){let t=E(e,`interleaved_thinking`);if(t!==void 0)return t;let n=b(e),r=y();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function Pt(e){let t=b(e),n=y();return n===`foundry`?!0:n===`firstParty`?!t.includes(`claude-3-`):t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function Ft(e){let t=b(e),n=y();return n!==`firstParty`&&n!==`foundry`?!1:t.includes(`claude-sonnet-4-6`)||t.includes(`claude-sonnet-4-5`)||t.includes(`claude-opus-4-1`)||t.includes(`claude-opus-4-5`)||t.includes(`claude-opus-4-6`)||t.includes(`claude-opus-4-7`)||t.includes(`claude-haiku-4-5`)}function It(e){return!0}function D(){return(y()===`firstParty`||y()===`foundry`)&&!r(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&Ke()}function Lt(){return y()===`firstParty`&&!r(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function Rt(e,t){let n=[...k(e)];t?.isAgenticQuery&&(n.includes(`claude-code-20250219`)||n.push(Ve));let r=be();return!r||r.length===0?n:[...n,...r.filter(e=>!n.includes(e))]}var O,zt,k,Bt,Vt=e((()=>{n(),ve(),He(),Ye(),i(),Xe(),At(),Je(),je(),O=[Ue],zt=t(e=>{let t=[],n=b(e).includes(`haiku`);y();let i=D();n||t.push(Ve),Qe(e)&&t.push(Ue),!r(process.env.DISABLE_INTERLEAVED_THINKING)&&Nt(e)&&t.push($e),i&&Nt(e)&&!_e()&&Ne().showThinkingSummaries!==!0&&t.push(qe);let a=r(process.env.USE_API_CONTEXT_MANAGEMENT)||Pt(e),o=Pt(e);return D()&&(a||o)&&t.push(We),i&&Ft(e),i&&t.push(Be),process.env.ANTHROPIC_BETAS&&t.push(...process.env.ANTHROPIC_BETAS.split(`,`).map(e=>e.trim()).filter(Boolean)),t}),k=t(e=>{let t=zt(e);return y()===`bedrock`?t.filter(e=>!Ge.has(e)):t}),Bt=t(e=>zt(e).filter(e=>Ge.has(e)))}));function Ht(){return process.platform===`linux`&&r(process.env.CLAUDE_CODE_BUBBLEWRAP)}function Ut(){return process.platform===`linux`?A??!1:!1}async function Wt(){if(j!==void 0)return j;if(process.platform===`darwin`)return j=null,null;try{let e=await tt(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of Ae)if(e.includes(t))return j=t,t}}catch{}return j=null,null}async function Gt(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&v.platform!==`darwin`?await Wt()||`pycharm`:v.terminal}function Kt(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&v.platform!==`darwin`?j===void 0?`pycharm`:j||`pycharm`:v.terminal}async function qt(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await Wt()}var Jt,A,j,Yt,Xt=e((()=>{n(),Me(),i(),Pe(),et(),Jt=t(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await Fe(`test`,[`-f`,`/.dockerenv`]);return e===0}),A=null,process.platform===`linux`&&st(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{A=!0},()=>{A=!1}),Yt={...v,terminal:Kt(),getIsDocker:Jt,getIsBubblewrapSandbox:Ht,isMuslEnvironment:Ut,getTerminalWithJetBrainsDetectionAsync:Gt,initJetBrainsDetection:qt}}));function Zt(e){return Qt?.has(e)??!1}var Qt,$t=e((()=>{Te(),we()}));function M(){return an.getStore()}function en(e,t){return an.run(e,t)}function tn(e){return e?.agentType===`subagent`}function nn(){let e=M();if(!(!tn(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function rn(){let e=M();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var an,on=e((()=>{an=new ut}));function sn(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function cn(){return r(process.env.OTEL_LOG_TOOL_DETAILS)}function ln(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&Zt(t))}function un(e,t,n){let r=dn(e);return!r||!yn.has(r.serverName)&&!ln(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function dn(e){if(!e.startsWith(`mcp__`))return;let t=e.split(`__`);if(t.length<3)return;let n=t[1],r=t.slice(2).join(`__`);if(!(!n||!r))return{serverName:n,mcpToolName:r}}function fn(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function N(e,t=0){if(typeof e==`string`)return e.length>bn?`${e.slice(0,xn)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=Sn)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,I).map(e=>N(e,t+1));return e.length>I&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,I).map(([e,n])=>[e,N(n,t+1)]);return n.length>I&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function pn(e){if(!cn())return;let t=Ce(N(e));return t.length>F&&(t=`${t.slice(0,F)}…[truncated]`),t}function P(e){let t=ot(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>Cn?`other`:n}function mn(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=P(t);e&&(r.add(e),n=e)}for(let t of e.split(Tn)){if(!t)continue;let e=t.split(En);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(wn.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=P(i);a&&!r.has(a)&&(r.add(a),n=n?`${n},${a}`:a)}}if(n)return n}function hn(){let e=M();if(e)return{agentId:e.agentId,parentSessionId:e.parentSessionId,agentType:e.agentType};let t=process.env.CLAUDE_CODE_AGENT_ID,n=process.env.CLAUDE_CODE_PARENT_SESSION_ID,r=t?`standalone`:void 0;if(t||r||n)return{...t?{agentId:t}:{},...r?{agentType:r}:{},...n?{parentSessionId:n}:{}};let i=ye();return i?{parentSessionId:i}:{}}function gn(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(L&&R){let e=n-R;e>0&&(r=(t.user-L.user+(t.system-L.system))/(e*1e3)*100)}return L=t,R=n,{uptime:process.uptime(),rss:e.rss,heapTotal:e.heapTotal,heapUsed:e.heapUsed,external:e.external,arrayBuffers:e.arrayBuffers,constrainedMemory:process.constrainedMemory(),cpuUsage:t,cpuPercent:r}}catch{return}}async function _n(e={}){let t=e.model?String(e.model):Ze(),n=typeof e.betas==`string`?e.betas:k(t).join(`,`),[r,i]=await Promise.all([On(),ke()]),a=gn();return{model:t,sessionId:xe(),userType:process.env.USER_TYPE||``,...n.length>0?{betas:n}:{},envContext:r,...process.env.CLAUDE_CODE_ENTRYPOINT&&{entrypoint:process.env.CLAUDE_CODE_ENTRYPOINT},...process.env.CLAUDE_AGENT_SDK_VERSION&&{agentSdkVersion:process.env.CLAUDE_AGENT_SDK_VERSION},isInteractive:String(ge()),clientType:Se(),...a&&{processMetrics:a},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||``,sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||``,sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||``,...hn(),...i&&{rh:i}}}function vn(e,t,n={}){let{envContext:r,processMetrics:i,rh:a,skillMode:o,observerMode:s,...c}=e,l={platform:r.platform,platform_raw:r.platformRaw,arch:r.arch,node_version:r.nodeVersion,terminal:r.terminal||`unknown`,package_managers:r.packageManagers,runtimes:r.runtimes,is_running_with_bun:r.isRunningWithBun,is_ci:r.isCi,is_claubbit:r.isClaubbit,is_claude_code_remote:r.isClaudeCodeRemote,is_local_agent_mode:r.isLocalAgentMode,is_conductor:r.isConductor,is_github_action:r.isGithubAction,is_claude_code_action:r.isClaudeCodeAction,version:r.version,build_time:r.buildTime,deployment_environment:r.deploymentEnvironment};r.remoteEnvironmentType&&(l.remote_environment_type=r.remoteEnvironmentType),r.claudeCodeContainerId&&(l.claude_code_container_id=r.claudeCodeContainerId),r.claudeCodeRemoteSessionId&&(l.claude_code_remote_session_id=r.claudeCodeRemoteSessionId),r.tags&&(l.tags=r.tags.split(`,`).map(e=>e.trim()).filter(Boolean)),r.githubEventName&&(l.github_event_name=r.githubEventName),r.githubActionsRunnerEnvironment&&(l.github_actions_runner_environment=r.githubActionsRunnerEnvironment),r.githubActionsRunnerOs&&(l.github_actions_runner_os=r.githubActionsRunnerOs),r.githubActionRef&&(l.github_action_ref=r.githubActionRef),r.wslVersion&&(l.wsl_version=r.wslVersion),r.linuxDistroId&&(l.linux_distro_id=r.linuxDistroId),r.linuxDistroVersion&&(l.linux_distro_version=r.linuxDistroVersion),r.linuxKernel&&(l.linux_kernel=r.linuxKernel),r.vcs&&(l.vcs=r.vcs),r.versionBase&&(l.version_base=r.versionBase);let u={session_id:c.sessionId,model:c.model,user_type:c.userType,is_interactive:c.isInteractive===`true`,client_type:c.clientType};if(c.betas&&(u.betas=c.betas),c.entrypoint&&(u.entrypoint=c.entrypoint),c.agentSdkVersion&&(u.agent_sdk_version=c.agentSdkVersion),c.sweBenchRunId&&(u.swe_bench_run_id=c.sweBenchRunId),c.sweBenchInstanceId&&(u.swe_bench_instance_id=c.sweBenchInstanceId),c.sweBenchTaskId&&(u.swe_bench_task_id=c.sweBenchTaskId),c.agentId&&(u.agent_id=c.agentId),c.parentSessionId&&(u.parent_session_id=c.parentSessionId),c.agentType&&(u.agent_type=c.agentType),t.githubActionsMetadata){let e=t.githubActionsMetadata;l.github_actions_metadata={actor_id:e.actorId,repository_id:e.repositoryId,repository_owner_id:e.repositoryOwnerId}}let d;return(t.accountUuid||t.organizationUuid)&&(d={account_uuid:t.accountUuid,organization_uuid:t.organizationUuid}),{env:l,...i&&{process:Buffer.from(Ce(i)).toString(`base64`)},...d&&{auth:d},core:u,additional:{...a&&{rh:a},...o&&{skill_mode:o},...s&&{observer_mode:s},...n}}}var yn,bn,xn,F,I,Sn,Cn,wn,Tn,En,Dn,On,L,R,kn=e((()=>{n(),Me(),Xt(),Vt(),Xe(),ve(),i(),$t(),Oe(),Re(),on(),Ee(),yn=new Set,bn=512,xn=128,F=4*1024,I=20,Sn=2,Cn=10,wn=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),Tn=/\s*(?:&&|\|\||[;|])\s*/,En=/\s+/,Dn=t(()=>{let e=`0.0.24`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),On=t(async()=>{let[e,t,n,i]=await Promise.all([v.getPackageManagers(),v.getRuntimes(),ze(),Le()]);return{platform:De(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:v.arch,nodeVersion:v.nodeVersion,terminal:Yt.terminal,packageManagers:e.join(`,`),runtimes:t.join(`,`),isRunningWithBun:v.isRunningWithBun(),isCi:r(process.env.CI),isClaubbit:r(process.env.CLAUBBIT),isClaudeCodeRemote:r(process.env.CLAUDE_CODE_REMOTE),isLocalAgentMode:process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`,isConductor:v.isConductor(),...process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE&&{remoteEnvironmentType:process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE},...process.env.CLAUDE_CODE_CONTAINER_ID&&{claudeCodeContainerId:process.env.CLAUDE_CODE_CONTAINER_ID},...process.env.CLAUDE_CODE_REMOTE_SESSION_ID&&{claudeCodeRemoteSessionId:process.env.CLAUDE_CODE_REMOTE_SESSION_ID},...process.env.CLAUDE_CODE_TAGS&&{tags:process.env.CLAUDE_CODE_TAGS},isGithubAction:r(process.env.GITHUB_ACTIONS),isClaudeCodeAction:r(process.env.CLAUDE_CODE_ACTION),version:`0.0.24`,versionBase:Dn(),buildTime:`2026-08-26T10:41:05.156Z`,deploymentEnvironment:v.detectDeploymentEnvironment(),...r(process.env.GITHUB_ACTIONS)&&{githubEventName:process.env.GITHUB_EVENT_NAME,githubActionsRunnerEnvironment:process.env.RUNNER_ENVIRONMENT,githubActionsRunnerOs:process.env.RUNNER_OS,githubActionRef:process.env.GITHUB_ACTION_PATH?.includes(`claude-code-action/`)?process.env.GITHUB_ACTION_PATH.split(`claude-code-action/`)[1]:void 0},...Ie()&&{wslVersion:Ie()},...n??{},...i.length>0?{vcs:i.join(`,`)}:{}}}),L=null,R=null}));function An(e){return e.setValue(z,!0)}function jn(e){return e.getValue(z)===!0}var z,B=e((()=>{f(),z=c(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}));function Mn(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Nn(n)){p.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Pn(r)){p.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Nn(e){return typeof e==`string`&&e!==``}function Pn(e){return e==null?!0:Array.isArray(e)?Fn(e):In(typeof e)}function Fn(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(In(e)){t=e;continue}return!1}return!1}}return!0}function In(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var Ln=e((()=>{f()}));function Rn(){return e=>{p.error(zn(e))}}function zn(e){return typeof e==`string`?e:JSON.stringify(Bn(e))}function Bn(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var Vn=e((()=>{f()}));function Hn(e){try{Un(e)}catch{}}var Un,Wn=e((()=>{Vn(),Un=Rn()}));function Gn(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){p.warn(`Unknown value ${ct(t)} for ${e}, expected a number, using defaults`);return}return n}function V(e){let t=process.env[e];if(!(t==null||t.trim()===``))return t}var Kn=e((()=>{f()})),qn,Jn=e((()=>{qn=`2.9.0`})),Yn,Xn=e((()=>{Yn=`process.runtime.name`})),H,Zn=e((()=>{Jn(),_(),Xn(),H={[ne]:`opentelemetry`,[Yn]:`node`,[oe]:ie,[h]:qn}})),U,Qn=e((()=>{Kn(),Zn(),U=performance})),$n=e((()=>{Qn()}));function W(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*cr)]}function er(e){return or(W(U.timeOrigin),W(typeof e==`number`?e:U.now()))}function tr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=G),[n,r]}function nr(e){return e[0]*1e6+e[1]/1e3}function rr(e){return e[0]+e[1]/G}function ir(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function ar(e){return ir(e)||typeof e==`number`||e instanceof Date}function or(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=G&&(n[1]-=G,n[0]+=1),n}var sr,cr,G,lr=e((()=>{$n(),sr=9,cr=10**6,G=10**sr})),K,ur=e((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(K||(K={}))}));function dr(e){if(!fr(e)||pr(e)!==gr)return!1;let t=xr(e);if(t===null)return!0;let n=Cr.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&yr.call(n)===br}function fr(e){return typeof e==`object`&&!!e}function pr(e){return e==null?e===void 0?vr:_r:q&&q in Object(e)?mr(e):hr(e)}function mr(e){let t=Cr.call(e,q),n=e[q],r=!1;try{e[q]=void 0,r=!0}catch{}let i=wr.call(e);return r&&(t?e[q]=n:delete e[q]),i}function hr(e){return wr.call(e)}var gr,_r,vr,yr,br,xr,Sr,Cr,q,wr,Tr=e((()=>{gr=`[object Object]`,_r=`[object Null]`,vr=`[object Undefined]`,yr=Function.prototype.toString,br=yr.call(Object),xr=Object.getPrototypeOf,Sr=Object.prototype,Cr=Sr.hasOwnProperty,q=Symbol?Symbol.toStringTag:void 0,wr=Sr.toString}));function Er(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=Or(t,e.shift(),0,n);return t}function Dr(e){return J(e)?e.slice():e}function Or(e,t,n=0,r){let i;if(!(n>Mr)){if(n++,X(e)||X(t)||Ar(t))i=Dr(t);else if(J(e)){if(i=e.slice(),J(t))for(let e=0,n=t.length;e<n;e++)i.push(Dr(t[e]));else if(Y(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=Dr(t[r]))}}}else if(Y(e))if(Y(t)){if(!jr(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(X(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(kr(e,s,r)||kr(t,s,r))delete i[s];else{if(Y(a)&&Y(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=Or(i[s],c,n,r)}}}}else i=t;return i}}function kr(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function J(e){return Array.isArray(e)}function Ar(e){return typeof e==`function`}function Y(e){return!X(e)&&!J(e)&&!Ar(e)&&typeof e==`object`}function X(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function jr(e,t){return!(!dr(e)||!dr(t))}var Mr,Nr=e((()=>{Tr(),Mr=20})),Pr,Fr=e((()=>{a(),Pr=class{constructor(){o(this,`_promise`,void 0),o(this,`_resolve`,void 0),o(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}})),Ir,Lr=e((()=>{Fr(),a(),Ir=class{constructor(e,t){o(this,`_isCalled`,!1),o(this,`_deferred`,new Pr),o(this,`_callback`,void 0),o(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}));function Rr(e,t){return new Promise(n=>{d.with(An(d.active()),()=>{e.export(t,n)})})}var zr=e((()=>{f(),B()})),Br,Vr=e((()=>{B(),Ln(),Wn(),Vn(),lr(),ur(),$n(),Nr(),Lr(),zr(),Br={_export:Rr}}));function Hr(){if(Z===void 0)try{let e=globalThis.process.argv0;Z=e?`unknown_service:${e}`:`unknown_service`}catch{Z=`unknown_service`}return Z}var Z,Ur=e((()=>{})),Q,Wr=e((()=>{Q=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function Gr(e,t){return Xr.FromAttributeList(Object.entries(e),t)}function Kr(){return Gr({[te]:Hr(),[oe]:H[oe],[ne]:H[ne],[h]:H[h]})}function qr(e){return e.map(([e,t])=>Q(t)?[e,t.catch(t=>{p.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Jr(e){if(typeof e==`string`||e===void 0)return e;p.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Yr(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;p.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var Xr,Zr=e((()=>{f(),Vr(),_(),Ur(),Wr(),a(),Xr=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=qr(t),r._asyncAttributesPending=t.filter(([e,t])=>Q(t)).length>0,r}constructor(e,t){o(this,`_rawAttributes`,void 0),o(this,`_asyncAttributesPending`,!1),o(this,`_schemaUrl`,void 0),o(this,`_memoizedAttributes`,void 0);let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Q(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=qr(this._rawAttributes),this._schemaUrl=Jr(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Q(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&p.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Q(n)){p.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Yr(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),Qr,$r,ei=e((()=>{f(),_(),Vr(),a(),Qr=class{constructor(){o(this,`_MAX_LENGTH`,255),o(this,`_COMMA_SEPARATOR`,`,`),o(this,`_LABEL_KEY_VALUE_SPLITTER`,`=`)}detect(e){let t={},n=V(`OTEL_RESOURCE_ATTRIBUTES`),r=V(`OTEL_SERVICE_NAME`);if(n)try{let e=this._parseResourceAttributes(n);Object.assign(t,e)}catch(e){p.debug(`EnvDetector failed: ${e instanceof Error?e.message:e}`)}return r&&(t[te]=r),{attributes:t}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR).filter(e=>e.trim()!==``);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER);if(n.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${e}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[r,i]=n,a=r.trim(),o=i.trim();if(a.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${e}".`);let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch(t){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${e}": ${t instanceof Error?t.message:t}`,{cause:t})}if(s.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${s}".`);if(c.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${s}".`);t[s]=c}return t}},$r=new Qr})),ti,ni,ri,ii,ai,oi=e((()=>{ti=`host.arch`,ni=`host.id`,ri=`host.name`,ii=`os.type`,ai=`os.version`}));async function si(){if(!$)switch(lt.platform){case`darwin`:$=(await import(`./getMachineId-darwin-CsRhaP3y.js`)).getMachineId;break;case`linux`:$=(await import(`./getMachineId-linux-Bd7UBNRQ.js`)).getMachineId;break;case`freebsd`:$=(await import(`./getMachineId-bsd-Cut1kHoA.js`)).getMachineId;break;case`win32`:$=(await import(`./getMachineId-win-DamF2CH_.js`)).getMachineId;break;default:$=(await import(`./getMachineId-unsupported-vFGP8E_8.js`)).getMachineId;break}return $()}var $,ci=e((()=>{})),li,ui,di=e((()=>{li=e=>{switch(e){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return e}},ui=e=>{switch(e){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return e}}})),fi,pi,mi=e((()=>{oi(),ci(),di(),fi=class{detect(e){return{attributes:{[ri]:rt(),[ti]:li(nt()),[ni]:si()}}}},pi=new fi})),hi,gi,_i=e((()=>{oi(),di(),hi=class{detect(e){return{attributes:{[ii]:ui(it()),[ai]:at()}}}},gi=new hi})),vi=e((()=>{mi(),_i(),oi()})),yi=e((()=>{vi()})),bi=e((()=>{ei(),yi()})),xi=e((()=>{Zr(),bi(),Ur()}));function Si(e){return Ci(e,new WeakSet)}function Ci(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Ci(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Ci(e,t))}return!1}var wi=e((()=>{})),Ti,Ei=e((()=>{f(),g(),_(),wi(),a(),Ti=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){o(this,`hrTime`,void 0),o(this,`hrTimeObserved`,void 0),o(this,`spanContext`,void 0),o(this,`resource`,void 0),o(this,`instrumentationScope`,void 0),o(this,`attributes`,{}),o(this,`_severityText`,void 0),o(this,`_severityNumber`,void 0),o(this,`_body`,void 0),o(this,`_eventName`,void 0),o(this,`_attributesCount`,0),o(this,`_droppedAttributesCount`,0),o(this,`_isReadonly`,!1),o(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:s,severityText:c,body:l,attributes:d={},exception:f,context:p}=n,m=Date.now();if(this.hrTime=ue(r??m),this.hrTimeObserved=ue(i??m),p){let e=u.getSpanContext(p);e&&ee(e)&&(this.spanContext=e)}this.severityNumber=s,this.severityText=c,this.body=l,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(d),f!=null&&this._setException(f)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return p.warn(`Invalid attribute key: ${e}`),this;if(!Si(t))return p.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&p.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return p.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(se,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(ae,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(ae,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(se,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(pe,n.stack),t=!0)}t||p.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&p.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}})),Di,Oi=e((()=>{T(),f(),Ei(),a(),Di=class{constructor(e,t){o(this,`instrumentationScope`,void 0),o(this,`_sharedState`,void 0),o(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||d.active(),r=e.severityNumber??x.UNSPECIFIED;if(r!==x.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=u.getSpanContext(n);if(e&&ee(e)&&(e.traceFlags&l.SAMPLED)!==l.SAMPLED)return}let i=new Ti(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==x.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||d.active();if(t.traceBased){let e=u.getSpanContext(r);if(e&&ee(e)&&(e.traceFlags&l.SAMPLED)!==l.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}})),ki,Ai=e((()=>{ki=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),ji,Mi=e((()=>{g(),a(),ji=class{constructor(e,t){o(this,`processors`,void 0),o(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>de(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}));function Ni(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var Pi=e((()=>{})),Fi,Ii=e((()=>{Fi=`otel.sdk.log.created`})),Li,Ri=e((()=>{Ii(),a(),Li=class{constructor(e){o(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(Fi,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),zi,Bi=e((()=>{zi=`0.215.0`})),Vi,Hi,Ui,Wi=e((()=>{f(),T(),Ai(),Mi(),Pi(),Ri(),Bi(),a(),Vi={disabled:!1,minimumSeverity:x.UNSPECIFIED,traceBased:!1},Hi=()=>({...Vi}),Ui=class{constructor(e,t,n,r,i,a){o(this,`loggers`,new Map),o(this,`activeProcessor`,void 0),o(this,`registeredLogRecordProcessors`,[]),o(this,`resource`,void 0),o(this,`forceFlushTimeoutMillis`,void 0),o(this,`logRecordLimits`,void 0),o(this,`processors`,void 0),o(this,`loggerMetrics`,void 0),o(this,`_loggerConfigurator`,void 0),o(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new ji(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new ki,this._loggerConfigurator=i??Hi;let c=a?a.getMeter(`@opentelemetry/sdk-logs`,zi):s();this.loggerMetrics=new Li(c)}getLoggerConfig(e){let t=Ni(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),Gi,Ki=e((()=>{f(),T(),he(),g(),Oi(),Wi(),a(),Gi=class{constructor(e={}){o(this,`_shutdownOnce`,void 0),o(this,`_sharedState`,void 0);let t={resource:e.resource??me(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Hi,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new Ui(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new le(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return p.warn(`A shutdown LoggerProvider cannot provide a Logger`),pt;e||p.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Di({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(p.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(p.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}})),qi,Ji=e((()=>{g(),qi=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:fe(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:ce.SUCCESS})}}}));async function Yi(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var Xi,Zi,Qi=e((()=>{f(),g(),a(),Xi=class{constructor(e,t,n){o(this,`_exportCompleted`,void 0),o(this,`_exportScheduledPromise`,void 0),o(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await Yi(t),await d.with(m(d.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){re(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===ce.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},Zi=class{constructor(e,t){o(this,`_maxExportBatchSize`,void 0),o(this,`_maxQueueSize`,void 0),o(this,`_scheduledDelayMillis`,void 0),o(this,`_exportTimeoutMillis`,void 0),o(this,`_exporter`,void 0),o(this,`_currentExport`,null),o(this,`_finishedLogRecords`,[]),o(this,`_timer`,void 0),o(this,`_shutdownOnce`,void 0),o(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new le(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(p.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new Xi(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){re(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new Xi(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,re(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),$i,ea=e((()=>{Qi(),$i=class extends Zi{onShutdown(){}}})),ta=e((()=>{ea()})),na=e((()=>{ta()})),ra=e((()=>{Ki(),Ji(),na(),T()}));export{mn as $,rr as A,Hn as B,Er as C,At as Ct,er as D,Tt as Dt,or as E,T as Et,Qn as F,B as G,Ln as H,U as I,dn as J,jn as K,Gn as L,ar as M,ir as N,tr as O,W as P,P as Q,V as R,Nr as S,E as St,ur as T,Dt as Tt,Pn as U,Wn as V,Mn as W,pn as X,fn as Y,_n as Z,Gr as _,Vt as _t,Ji as a,rn as at,Ir as b,D as bt,xi as c,on as ct,pi as d,qt as dt,kn as et,mi as f,Xt as ft,Zr as g,k as gt,Kr as h,Rt as ht,qi as i,vn as it,lr as j,nr as k,_i as l,en as lt,ei as m,Bt as mt,$i as n,un as nt,Gi as o,M as ot,$r as p,Mt as pt,An as q,ea as r,sn as rt,Ki as s,nn as st,ra as t,cn as tt,gi as u,Yt as ut,Vr as v,It as vt,K as w,Et as wt,Lr as x,Lt as xt,Br as y,Ft as yt,Kn as z};
@@ -1,4 +1,4 @@
1
- import{i as e,n as t,o as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{a as o,c as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as m,t as h}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{i as g,n as _,r as v,t as y}from"./figures-5ThXQEtq.js";import{n as b,t as x}from"./cwd-BcO6WHKo.js";import{w as ee,x as te}from"./debug-8DCufdSp.js";import{o as ne,s as re}from"./log-DaILwWJa.js";import{aborted as ie,callbackify as S,debuglog as ae,inspect as oe,promisify as se,stripVTControlCharacters as ce}from"node:util";import C,{execArgv as le,execPath as ue,hrtime as de,platform as fe}from"node:process";import w from"node:path";import{ChildProcess as pe,execFile as me,spawn as he,spawnSync as ge}from"node:child_process";import{appendFileSync as _e,createReadStream as ve,createWriteStream as ye,readFileSync as be,statSync as xe,writeFileSync as Se}from"node:fs";import{constants as Ce}from"node:os";import we from"node:tty";import{EventEmitter as Te,addAbortListener as Ee,on as De,once as T,setMaxListeners as Oe}from"node:events";import{Duplex as ke,PassThrough as Ae,Readable as E,Transform as je,Writable as Me,getDefaultHighWaterMark as Ne}from"node:stream";import{StringDecoder as Pe}from"node:string_decoder";import{fileURLToPath as Fe}from"node:url";import{Buffer as Ie}from"node:buffer";import{scheduler as Le,setImmediate as Re,setTimeout as ze}from"node:timers/promises";import{serialize as Be}from"node:v8";import{finished as D}from"node:stream/promises";function O(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}var k=t((()=>{})),Ve,He,Ue,We,Ge=t((()=>{Ve=(e,t)=>{let n=We(He(e));if(typeof n!=`string`)throw TypeError(`${t} must be a string or a file URL: ${n}.`);return n},He=e=>Ue(e)?e.toString():e,Ue=e=>typeof e!=`string`&&e&&Object.getPrototypeOf(e)===String.prototype,We=e=>e instanceof URL?Fe(e):e})),Ke,qe=t((()=>{k(),Ge(),Ke=(e,t=[],n={})=>{let r=Ve(e,`First argument`),[i,a]=O(t)?[[],t]:[t,n];if(!Array.isArray(i))throw TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(e=>typeof e==`object`&&!!e))throw TypeError(`Second argument must be an array of strings: ${i}`);let o=i.map(String),s=o.find(e=>e.includes(`\0`));if(s!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${s}`);if(!O(a))throw TypeError(`Last argument must be an options object: ${a}`);return[r,o,a]}})),Je,Ye,A,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,j=t((()=>{({toString:Je}=Object.prototype),Ye=e=>Je.call(e)===`[object ArrayBuffer]`,A=e=>Je.call(e)===`[object Uint8Array]`,Xe=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ze=new TextEncoder,Qe=e=>Ze.encode(e),$e=new TextDecoder,et=e=>$e.decode(e),tt=(e,t)=>nt(e,t).join(``),nt=(e,t)=>{if(t===`utf8`&&e.every(e=>typeof e==`string`))return e;let n=new Pe(t),r=e.map(e=>typeof e==`string`?Qe(e):e).map(e=>n.write(e)),i=n.end();return i===``?r:[...r,i]},rt=e=>e.length===1&&A(e[0])?e[0]:at(it(e)),it=e=>e.map(e=>typeof e==`string`?Qe(e):e),at=e=>{let t=new Uint8Array(ot(e)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},ot=e=>{let t=0;for(let n of e)t+=n.length;return t}})),st,ct,lt,ut,dt,ft,pt,mt,ht,gt=t((()=>{k(),j(),st=e=>Array.isArray(e)&&Array.isArray(e.raw),ct=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=lt({templates:e,expressions:t,tokens:n,index:r,template:i});if(n.length===0)throw TypeError(`Template script must not be empty`);let[r,...i]=n;return[r,i,{}]},lt=({templates:e,expressions:t,tokens:n,index:r,template:i})=>{if(i===void 0)throw TypeError(`Invalid backslash sequence: ${e.raw[r]}`);let{nextTokens:a,leadingWhitespaces:o,trailingWhitespaces:s}=ut(i,e.raw[r]),c=pt(n,a,o);if(r===t.length)return c;let l=t[r],u=Array.isArray(l)?l.map(e=>mt(e)):[mt(l)];return pt(c,u,s)},ut=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let n=[],r=0,i=dt.has(t[0]);for(let i=0,a=0;i<e.length;i+=1,a+=1){let o=t[a];if(dt.has(o))r!==i&&n.push(e.slice(r,i)),r=i+1;else if(o===`\\`){let e=t[a+1];e===`
1
+ import{i as e,n as t,o as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{a as o,c as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as m,t as h}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{i as g,n as _,r as v,t as y}from"./figures-5ThXQEtq.js";import{n as b,t as x}from"./cwd-Pa83R95t.js";import{w as ee,x as te}from"./debug-Bglx1aTu.js";import{o as ne,s as re}from"./log-D2TIwHBV.js";import{aborted as ie,callbackify as S,debuglog as ae,inspect as oe,promisify as se,stripVTControlCharacters as ce}from"node:util";import C,{execArgv as le,execPath as ue,hrtime as de,platform as fe}from"node:process";import w from"node:path";import{ChildProcess as pe,execFile as me,spawn as he,spawnSync as ge}from"node:child_process";import{appendFileSync as _e,createReadStream as ve,createWriteStream as ye,readFileSync as be,statSync as xe,writeFileSync as Se}from"node:fs";import{constants as Ce}from"node:os";import we from"node:tty";import{EventEmitter as Te,addAbortListener as Ee,on as De,once as T,setMaxListeners as Oe}from"node:events";import{Duplex as ke,PassThrough as Ae,Readable as E,Transform as je,Writable as Me,getDefaultHighWaterMark as Ne}from"node:stream";import{StringDecoder as Pe}from"node:string_decoder";import{fileURLToPath as Fe}from"node:url";import{Buffer as Ie}from"node:buffer";import{scheduler as Le,setImmediate as Re,setTimeout as ze}from"node:timers/promises";import{serialize as Be}from"node:v8";import{finished as D}from"node:stream/promises";function O(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}var k=t((()=>{})),Ve,He,Ue,We,Ge=t((()=>{Ve=(e,t)=>{let n=We(He(e));if(typeof n!=`string`)throw TypeError(`${t} must be a string or a file URL: ${n}.`);return n},He=e=>Ue(e)?e.toString():e,Ue=e=>typeof e!=`string`&&e&&Object.getPrototypeOf(e)===String.prototype,We=e=>e instanceof URL?Fe(e):e})),Ke,qe=t((()=>{k(),Ge(),Ke=(e,t=[],n={})=>{let r=Ve(e,`First argument`),[i,a]=O(t)?[[],t]:[t,n];if(!Array.isArray(i))throw TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(e=>typeof e==`object`&&!!e))throw TypeError(`Second argument must be an array of strings: ${i}`);let o=i.map(String),s=o.find(e=>e.includes(`\0`));if(s!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${s}`);if(!O(a))throw TypeError(`Last argument must be an options object: ${a}`);return[r,o,a]}})),Je,Ye,A,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,j=t((()=>{({toString:Je}=Object.prototype),Ye=e=>Je.call(e)===`[object ArrayBuffer]`,A=e=>Je.call(e)===`[object Uint8Array]`,Xe=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ze=new TextEncoder,Qe=e=>Ze.encode(e),$e=new TextDecoder,et=e=>$e.decode(e),tt=(e,t)=>nt(e,t).join(``),nt=(e,t)=>{if(t===`utf8`&&e.every(e=>typeof e==`string`))return e;let n=new Pe(t),r=e.map(e=>typeof e==`string`?Qe(e):e).map(e=>n.write(e)),i=n.end();return i===``?r:[...r,i]},rt=e=>e.length===1&&A(e[0])?e[0]:at(it(e)),it=e=>e.map(e=>typeof e==`string`?Qe(e):e),at=e=>{let t=new Uint8Array(ot(e)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},ot=e=>{let t=0;for(let n of e)t+=n.length;return t}})),st,ct,lt,ut,dt,ft,pt,mt,ht,gt=t((()=>{k(),j(),st=e=>Array.isArray(e)&&Array.isArray(e.raw),ct=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=lt({templates:e,expressions:t,tokens:n,index:r,template:i});if(n.length===0)throw TypeError(`Template script must not be empty`);let[r,...i]=n;return[r,i,{}]},lt=({templates:e,expressions:t,tokens:n,index:r,template:i})=>{if(i===void 0)throw TypeError(`Invalid backslash sequence: ${e.raw[r]}`);let{nextTokens:a,leadingWhitespaces:o,trailingWhitespaces:s}=ut(i,e.raw[r]),c=pt(n,a,o);if(r===t.length)return c;let l=t[r],u=Array.isArray(l)?l.map(e=>mt(e)):[mt(l)];return pt(c,u,s)},ut=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let n=[],r=0,i=dt.has(t[0]);for(let i=0,a=0;i<e.length;i+=1,a+=1){let o=t[a];if(dt.has(o))r!==i&&n.push(e.slice(r,i)),r=i+1;else if(o===`\\`){let e=t[a+1];e===`
2
2
  `?(--i,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=ft[e]??1}}let a=r===e.length;return a||n.push(e.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:a}},dt=new Set([` `,` `,`\r`,`
3
3
  `]),ft={x:3,u:5},pt=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],mt=e=>{let t=typeof e;if(t===`string`)return e;if(t===`number`)return String(e);if(O(e)&&(`stdout`in e||`isMaxBuffer`in e))return ht(e);throw e instanceof pe||Object.prototype.toString.call(e)===`[object Promise]`?TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):TypeError(`Unexpected "${t}" in template expression`)},ht=({stdout:e})=>{if(typeof e==`string`)return e;if(A(e))return et(e);throw TypeError(e===void 0?`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`:`Unexpected "${typeof e}" stdout in template expression`)}})),M,_t,N,vt,P=t((()=>{M=e=>_t.includes(e),_t=[C.stdin,C.stdout,C.stderr],N=[`stdin`,`stdout`,`stderr`],vt=e=>N[e]??`stdio[${e}]`})),yt,bt,xt,St,Ct,wt,Tt,Et,Dt,Ot,kt,At,jt,Mt,F=t((()=>{k(),P(),yt=e=>{let t={...e};for(let n of jt)t[n]=bt(e,n);return t},bt=(e,t)=>{let n=Array.from({length:xt(e)+1}),r=St(e[t],n,t);return kt(r,t)},xt=({stdio:e})=>Array.isArray(e)?Math.max(e.length,N.length):N.length,St=(e,t,n)=>O(e)?Ct(e,t,n):t.fill(e),Ct=(e,t,n)=>{for(let r of Object.keys(e).sort(wt))for(let i of Et(r,n,t))t[i]=e[r];return t},wt=(e,t)=>Tt(e)<Tt(t)?1:-1,Tt=e=>e===`stdout`||e===`stderr`?0:e===`all`?2:1,Et=(e,t,n)=>{if(e===`ipc`)return[n.length-1];let r=Dt(e);if(r===void 0||r===0)throw TypeError(`"${t}.${e}" is invalid.
4
4
  It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(r>=n.length)throw TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{AC as t,Xs as n,Ys as r,_i as i,hi as a,jC as o,vt as s,xt as c}from"./loadAgentsDir-B0Anodo0.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{n as u,t as d}from"./ExitFlow-DacaBTlk.js";import{spawnSync as f}from"child_process";function p(){return o(g)??`Goodbye!`}async function m(e){if(n())return e(),f(`tmux`,[`detach-client`],{stdio:`ignore`}),null;let t=s()!==null;return t?(0,h.jsx)(d,{showWorktree:t,onDone:e,onCancel:()=>e()}):(e(p()),await a(0,`prompt_input_exit`),null)}var h,g;e((()=>{t(),u(),r(),i(),c(),h=l(),g=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}))();export{m as call};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Ip as n,Lp as r,mb as i,md as a,pd as o}from"./loadAgentsDir-B0Anodo0.js";import{D as s,Gt as c,I as l,P as u,T as d,ai as f,t as p,x as m}from"./src-DL3w8VPk.js";import{t as h}from"./jsx-runtime-Bb4Xn-E0.js";import{G as g,H as _,N as v,U as y,W as b,bt as x,d as S,h as C,yt as w}from"./model-BvQFFOf8.js";import{n as T,t as E}from"./useExitOnCtrlCDWithKeybindings-BKwzUpgb.js";import{t as D}from"./select-DIxfl_VN.js";import{n as O,r as k,t as A}from"./modelOptions-BBvF3wHK.js";import{t as j}from"./CustomSelect-wmZ9jz0W.js";import{n as M,t as N}from"./fetchModelList-FE8tzTDc.js";function P({initial:e,sessionModel:t,onSelect:n,onCancel:i,isStandaloneCommand:a,showFastModeNotice:f,headerText:p}){let h=T(),_=e===null?L:e,[x,S]=(0,F.useState)(_),E=r(e=>g()?e.fastMode:!1),[k,j]=(0,F.useState)(()=>new Set(w(_)?[_.replace(/\[1m\]/i,``)]:[])),M=(0,F.useCallback)(()=>{if(!x||x===L)return;let e=x.replace(/\[1m\]/i,``);j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[x]),P=(0,F.useMemo)(()=>O(E??!1),[E]),[R,z]=(0,F.useState)(null),[B,V]=(0,F.useState)(!1);(0,F.useEffect)(()=>{let e=!1;return V(!1),N().then(t=>{if(!e){if(!t||t.length===0){z(null),V(!0);return}z(t)}}).catch(()=>{e||V(!0)}),()=>{e=!0}},[]);let H=(0,F.useMemo)(()=>R?A(R,E??!1):null,[R,E]),U=R===null&&!B,W=(0,F.useMemo)(()=>{let t=H??P;return e!==null&&!t.some(t=>t.value===e)?[...t,{value:e,label:C(e),description:`Current model`}]:t},[H,P,e]),G=(0,F.useMemo)(()=>W.map(e=>({...e,value:e.value===null?L:e.value})),[W]),K=(0,F.useMemo)(()=>G.some(e=>e.value===_)?_:G[0]?.value??void 0,[G,_]),q=Math.min(10,G.length),J=Math.max(0,G.length-q),Y=G.find(e=>e.value===x)?.label,X=x!==void 0&&x!==L&&k.has(x.replace(/\[1m\]/i,``)),Z=(0,F.useCallback)(e=>{S(e)},[]);c({"modelPicker:toggle1M":()=>M()},{context:`ModelPicker`});function Q(e){if(e===L){n(null);return}let t=e.replace(/\[1m\]/i,``);n(k.has(t)?`${t}[1m]`:t)}let $=(0,I.jsxs)(l,{flexDirection:`column`,children:[(0,I.jsxs)(l,{flexDirection:`column`,children:[(0,I.jsxs)(l,{marginBottom:1,flexDirection:`column`,children:[(0,I.jsx)(u,{color:`remember`,bold:!0,children:`Select model`}),(0,I.jsx)(u,{dimColor:!0,children:p??`Choose a model for this and future sessions. Use Space to toggle 1M context.`}),t&&(0,I.jsxs)(u,{dimColor:!0,children:[`Currently using `,C(t),` for this session (set by plan mode). Selecting a model will undo this.`]})]}),(0,I.jsxs)(l,{flexDirection:`column`,marginBottom:1,children:[(0,I.jsx)(l,{flexDirection:`column`,children:(0,I.jsx)(D,{defaultValue:_,defaultFocusValue:K,options:G,onChange:Q,onFocus:Z,onCancel:i??(()=>{}),visibleOptionCount:q})}),J>0&&(0,I.jsx)(l,{paddingLeft:3,children:(0,I.jsxs)(u,{dimColor:!0,children:[`and `,J,` more…`]})}),U&&(0,I.jsx)(l,{paddingLeft:3,children:(0,I.jsx)(u,{dimColor:!0,children:`正在从 API 拉取可用模型列表…`})}),B&&R===null&&(0,I.jsx)(l,{paddingLeft:3,children:(0,I.jsx)(u,{dimColor:!0,children:`API 拉取失败,使用内置列表`})})]}),(0,I.jsx)(l,{marginBottom:1,flexDirection:`column`,children:X?(0,I.jsxs)(u,{dimColor:!0,children:[`1M context on`,(0,I.jsx)(u,{color:`subtle`,children:` · Space to toggle`})]}):(0,I.jsxs)(u,{color:`subtle`,children:[`1M context off`,Y?` for ${Y}`:``,(0,I.jsx)(u,{color:`subtle`,children:` · Space to toggle`})]})}),g()?f?(0,I.jsx)(l,{marginBottom:1,children:(0,I.jsxs)(u,{dimColor:!0,children:[`Fast mode is `,(0,I.jsx)(u,{bold:!0,children:`ON`}),` and available with `,v,` only (/fast). Switching to other models turn off fast mode.`]})}):y()&&!b()?(0,I.jsx)(l,{marginBottom:1,children:(0,I.jsxs)(u,{dimColor:!0,children:[`Use `,(0,I.jsx)(u,{bold:!0,children:`/fast`}),` to turn on Fast mode (`,v,` only).`]})}):null:null]}),a&&(0,I.jsx)(u,{dimColor:!0,italic:!0,children:h.pending?(0,I.jsxs)(I.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,I.jsxs)(d,{children:[(0,I.jsx)(s,{shortcut:`Enter`,action:`confirm`}),(0,I.jsx)(o,{action:`select:cancel`,context:`Select`,fallback:`Esc`,description:`exit`})]})})]});return a?(0,I.jsx)(m,{color:`permission`,children:$}):$}var F,I,L,R=e((()=>{F=t(f(),1),x(),E(),_(),p(),i(),n(),S(),k(),M(),a(),j(),I=h(),L=`__NO_PREFERENCE__`}));function z(e,t,n){return!1}var B=e((()=>{}));export{R as i,z as n,P as r,B as t};
@@ -0,0 +1 @@
1
+ import{cc as e,lc as t,sc as n,uc as r}from"./loadAgentsDir-B0Anodo0.js";r();export{n as drainPendingExtraction,e as executeExtractMemories,t as initExtractMemories};