@hashgraphonline/conversational-agent 0.2.216 → 0.2.218

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 (312) hide show
  1. package/cli/readme.md +181 -0
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/index.d.ts +1 -0
  5. package/dist/cjs/plugins/community/swarm/SwarmPlugin.d.ts +17 -0
  6. package/dist/cjs/plugins/community/swarm/__tests__/SwarmPlugin.mocks.d.ts +1 -0
  7. package/dist/cjs/plugins/community/swarm/__tests__/SwarmPlugin.test.d.ts +1 -0
  8. package/dist/cjs/plugins/community/swarm/__tests__/tools/CreatePostageStampTool.test.d.ts +1 -0
  9. package/dist/cjs/plugins/community/swarm/__tests__/tools/DownloadDataTool.test.d.ts +1 -0
  10. package/dist/cjs/plugins/community/swarm/__tests__/tools/DownloadFilesTool.test.d.ts +1 -0
  11. package/dist/cjs/plugins/community/swarm/__tests__/tools/ExtendPostageStampTool.test.d.ts +1 -0
  12. package/dist/cjs/plugins/community/swarm/__tests__/tools/GetPostageStampTool.test.d.ts +1 -0
  13. package/dist/cjs/plugins/community/swarm/__tests__/tools/ListPostageStampsTool.test.d.ts +1 -0
  14. package/dist/cjs/plugins/community/swarm/__tests__/tools/QueryUploadProgressTool.test.d.ts +1 -0
  15. package/dist/cjs/plugins/community/swarm/__tests__/tools/ReadFeedTool.test.d.ts +1 -0
  16. package/dist/cjs/plugins/community/swarm/__tests__/tools/SwarmTool.mocks.d.ts +14 -0
  17. package/dist/cjs/plugins/community/swarm/__tests__/tools/UpdateFeedTool.test.d.ts +1 -0
  18. package/dist/cjs/plugins/community/swarm/__tests__/tools/UploadDataTool.test.d.ts +1 -0
  19. package/dist/cjs/plugins/community/swarm/__tests__/tools/UploadFileTool.test.d.ts +1 -0
  20. package/dist/cjs/plugins/community/swarm/__tests__/tools/UploadFolderTool.test.d.ts +1 -0
  21. package/dist/cjs/plugins/community/swarm/config.d.ts +6 -0
  22. package/dist/cjs/plugins/community/swarm/constants.d.ts +8 -0
  23. package/dist/cjs/plugins/community/swarm/index.d.ts +2 -0
  24. package/dist/cjs/plugins/community/swarm/model.d.ts +23 -0
  25. package/dist/cjs/plugins/community/swarm/tools/CreatePostageStampTool.d.ts +47 -0
  26. package/dist/cjs/plugins/community/swarm/tools/DownloadDataTool.d.ts +35 -0
  27. package/dist/cjs/plugins/community/swarm/tools/DownloadFilesTool.d.ts +41 -0
  28. package/dist/cjs/plugins/community/swarm/tools/ExtendPostageStampTool.d.ts +47 -0
  29. package/dist/cjs/plugins/community/swarm/tools/GetPostageStampTool.d.ts +35 -0
  30. package/dist/cjs/plugins/community/swarm/tools/ListPostageStampsTool.d.ts +53 -0
  31. package/dist/cjs/plugins/community/swarm/tools/QueryUploadProgressTool.d.ts +35 -0
  32. package/dist/cjs/plugins/community/swarm/tools/ReadFeedTool.d.ts +41 -0
  33. package/dist/cjs/plugins/community/swarm/tools/UpdateFeedTool.d.ts +47 -0
  34. package/dist/cjs/plugins/community/swarm/tools/UploadDataTool.d.ts +47 -0
  35. package/dist/cjs/plugins/community/swarm/tools/UploadFileTool.d.ts +53 -0
  36. package/dist/cjs/plugins/community/swarm/tools/UploadFolderTool.d.ts +47 -0
  37. package/dist/cjs/plugins/community/swarm/utils.d.ts +22 -0
  38. package/dist/cjs/plugins/index.d.ts +1 -0
  39. package/dist/esm/index.js +33 -31
  40. package/dist/esm/index.js.map +1 -1
  41. package/dist/esm/index10.js +13 -677
  42. package/dist/esm/index10.js.map +1 -1
  43. package/dist/esm/index11.js +601 -234
  44. package/dist/esm/index11.js.map +1 -1
  45. package/dist/esm/index12.js +296 -136
  46. package/dist/esm/index12.js.map +1 -1
  47. package/dist/esm/index13.js +127 -235
  48. package/dist/esm/index13.js.map +1 -1
  49. package/dist/esm/index14.js +247 -84
  50. package/dist/esm/index14.js.map +1 -1
  51. package/dist/esm/index15.js +81 -159
  52. package/dist/esm/index15.js.map +1 -1
  53. package/dist/esm/index16.js +155 -229
  54. package/dist/esm/index16.js.map +1 -1
  55. package/dist/esm/index17.js +238 -140
  56. package/dist/esm/index17.js.map +1 -1
  57. package/dist/esm/index18.js +139 -493
  58. package/dist/esm/index18.js.map +1 -1
  59. package/dist/esm/index19.js +479 -91
  60. package/dist/esm/index19.js.map +1 -1
  61. package/dist/esm/index20.js +88 -147
  62. package/dist/esm/index20.js.map +1 -1
  63. package/dist/esm/index21.js +127 -666
  64. package/dist/esm/index21.js.map +1 -1
  65. package/dist/esm/index22.js +698 -44
  66. package/dist/esm/index22.js.map +1 -1
  67. package/dist/esm/index23.js +45 -304
  68. package/dist/esm/index23.js.map +1 -1
  69. package/dist/esm/index24.js +303 -153
  70. package/dist/esm/index24.js.map +1 -1
  71. package/dist/esm/index25.js +150 -117
  72. package/dist/esm/index25.js.map +1 -1
  73. package/dist/esm/index26.js +154 -18
  74. package/dist/esm/index26.js.map +1 -1
  75. package/dist/esm/index27.js +18 -22
  76. package/dist/esm/index27.js.map +1 -1
  77. package/dist/esm/index28.js +15 -74
  78. package/dist/esm/index28.js.map +1 -1
  79. package/dist/esm/index29.js +70 -295
  80. package/dist/esm/index29.js.map +1 -1
  81. package/dist/esm/index30.js +279 -100
  82. package/dist/esm/index30.js.map +1 -1
  83. package/dist/esm/index31.js +86 -922
  84. package/dist/esm/index31.js.map +1 -1
  85. package/dist/esm/index32.js +904 -189
  86. package/dist/esm/index32.js.map +1 -1
  87. package/dist/esm/index33.js +185 -1169
  88. package/dist/esm/index33.js.map +1 -1
  89. package/dist/esm/index34.js +1218 -112
  90. package/dist/esm/index34.js.map +1 -1
  91. package/dist/esm/index35.js +111 -99
  92. package/dist/esm/index35.js.map +1 -1
  93. package/dist/esm/index36.js +113 -8
  94. package/dist/esm/index36.js.map +1 -1
  95. package/dist/esm/index37.js +8 -45
  96. package/dist/esm/index37.js.map +1 -1
  97. package/dist/esm/index38.js +41 -102
  98. package/dist/esm/index38.js.map +1 -1
  99. package/dist/esm/index39.js +96 -55
  100. package/dist/esm/index39.js.map +1 -1
  101. package/dist/esm/index4.js +1 -1
  102. package/dist/esm/index40.js +58 -71
  103. package/dist/esm/index40.js.map +1 -1
  104. package/dist/esm/index41.js +79 -21
  105. package/dist/esm/index41.js.map +1 -1
  106. package/dist/esm/index42.js +21 -5
  107. package/dist/esm/index42.js.map +1 -1
  108. package/dist/esm/index43.js +26 -11
  109. package/dist/esm/index43.js.map +1 -1
  110. package/dist/esm/index44.js +12 -322
  111. package/dist/esm/index44.js.map +1 -1
  112. package/dist/esm/index45.js +66 -173
  113. package/dist/esm/index45.js.map +1 -1
  114. package/dist/esm/index46.js +69 -24
  115. package/dist/esm/index46.js.map +1 -1
  116. package/dist/esm/index47.js +47 -88
  117. package/dist/esm/index47.js.map +1 -1
  118. package/dist/esm/index48.js +100 -7
  119. package/dist/esm/index48.js.map +1 -1
  120. package/dist/esm/index49.js +79 -0
  121. package/dist/esm/index49.js.map +1 -0
  122. package/dist/esm/index5.js +2 -2
  123. package/dist/esm/index50.js +75 -0
  124. package/dist/esm/index50.js.map +1 -0
  125. package/dist/esm/index51.js +124 -0
  126. package/dist/esm/index51.js.map +1 -0
  127. package/dist/esm/index52.js +58 -0
  128. package/dist/esm/index52.js.map +1 -0
  129. package/dist/esm/index53.js +83 -0
  130. package/dist/esm/index53.js.map +1 -0
  131. package/dist/esm/index54.js +100 -0
  132. package/dist/esm/index54.js.map +1 -0
  133. package/dist/esm/index55.js +118 -0
  134. package/dist/esm/index55.js.map +1 -0
  135. package/dist/esm/index56.js +108 -0
  136. package/dist/esm/index56.js.map +1 -0
  137. package/dist/esm/index57.js +8 -0
  138. package/dist/esm/index57.js.map +1 -0
  139. package/dist/esm/index58.js +325 -0
  140. package/dist/esm/index58.js.map +1 -0
  141. package/dist/esm/index59.js +187 -0
  142. package/dist/esm/index59.js.map +1 -0
  143. package/dist/esm/index6.js +132 -833
  144. package/dist/esm/index6.js.map +1 -1
  145. package/dist/esm/index60.js +10 -0
  146. package/dist/esm/index60.js.map +1 -0
  147. package/dist/esm/index61.js +98 -0
  148. package/dist/esm/index61.js.map +1 -0
  149. package/dist/esm/index62.js +131 -0
  150. package/dist/esm/index62.js.map +1 -0
  151. package/dist/esm/index63.js +19 -0
  152. package/dist/esm/index63.js.map +1 -0
  153. package/dist/esm/index7.js +826 -75
  154. package/dist/esm/index7.js.map +1 -1
  155. package/dist/esm/index8.js +91 -13
  156. package/dist/esm/index8.js.map +1 -1
  157. package/dist/esm/index9.js +13 -17
  158. package/dist/esm/index9.js.map +1 -1
  159. package/dist/types/index.d.ts +1 -0
  160. package/dist/types/plugins/community/swarm/SwarmPlugin.d.ts +17 -0
  161. package/dist/types/plugins/community/swarm/__tests__/SwarmPlugin.mocks.d.ts +1 -0
  162. package/dist/types/plugins/community/swarm/__tests__/SwarmPlugin.test.d.ts +1 -0
  163. package/dist/types/plugins/community/swarm/__tests__/tools/CreatePostageStampTool.test.d.ts +1 -0
  164. package/dist/types/plugins/community/swarm/__tests__/tools/DownloadDataTool.test.d.ts +1 -0
  165. package/dist/types/plugins/community/swarm/__tests__/tools/DownloadFilesTool.test.d.ts +1 -0
  166. package/dist/types/plugins/community/swarm/__tests__/tools/ExtendPostageStampTool.test.d.ts +1 -0
  167. package/dist/types/plugins/community/swarm/__tests__/tools/GetPostageStampTool.test.d.ts +1 -0
  168. package/dist/types/plugins/community/swarm/__tests__/tools/ListPostageStampsTool.test.d.ts +1 -0
  169. package/dist/types/plugins/community/swarm/__tests__/tools/QueryUploadProgressTool.test.d.ts +1 -0
  170. package/dist/types/plugins/community/swarm/__tests__/tools/ReadFeedTool.test.d.ts +1 -0
  171. package/dist/types/plugins/community/swarm/__tests__/tools/SwarmTool.mocks.d.ts +14 -0
  172. package/dist/types/plugins/community/swarm/__tests__/tools/UpdateFeedTool.test.d.ts +1 -0
  173. package/dist/types/plugins/community/swarm/__tests__/tools/UploadDataTool.test.d.ts +1 -0
  174. package/dist/types/plugins/community/swarm/__tests__/tools/UploadFileTool.test.d.ts +1 -0
  175. package/dist/types/plugins/community/swarm/__tests__/tools/UploadFolderTool.test.d.ts +1 -0
  176. package/dist/types/plugins/community/swarm/config.d.ts +6 -0
  177. package/dist/types/plugins/community/swarm/constants.d.ts +8 -0
  178. package/dist/types/plugins/community/swarm/index.d.ts +2 -0
  179. package/dist/types/plugins/community/swarm/model.d.ts +23 -0
  180. package/dist/types/plugins/community/swarm/tools/CreatePostageStampTool.d.ts +47 -0
  181. package/dist/types/plugins/community/swarm/tools/DownloadDataTool.d.ts +35 -0
  182. package/dist/types/plugins/community/swarm/tools/DownloadFilesTool.d.ts +41 -0
  183. package/dist/types/plugins/community/swarm/tools/ExtendPostageStampTool.d.ts +47 -0
  184. package/dist/types/plugins/community/swarm/tools/GetPostageStampTool.d.ts +35 -0
  185. package/dist/types/plugins/community/swarm/tools/ListPostageStampsTool.d.ts +53 -0
  186. package/dist/types/plugins/community/swarm/tools/QueryUploadProgressTool.d.ts +35 -0
  187. package/dist/types/plugins/community/swarm/tools/ReadFeedTool.d.ts +41 -0
  188. package/dist/types/plugins/community/swarm/tools/UpdateFeedTool.d.ts +47 -0
  189. package/dist/types/plugins/community/swarm/tools/UploadDataTool.d.ts +47 -0
  190. package/dist/types/plugins/community/swarm/tools/UploadFileTool.d.ts +53 -0
  191. package/dist/types/plugins/community/swarm/tools/UploadFolderTool.d.ts +47 -0
  192. package/dist/types/plugins/community/swarm/utils.d.ts +22 -0
  193. package/dist/types/plugins/index.d.ts +1 -0
  194. package/package.json +37 -27
  195. package/src/index.ts +1 -0
  196. package/src/plugins/community/swarm/README.md +279 -0
  197. package/src/plugins/community/swarm/SwarmPlugin.ts +178 -0
  198. package/src/plugins/community/swarm/__tests__/SwarmPlugin.mocks.ts +105 -0
  199. package/src/plugins/community/swarm/__tests__/SwarmPlugin.test.ts +93 -0
  200. package/src/plugins/community/swarm/__tests__/tools/CreatePostageStampTool.test.ts +152 -0
  201. package/src/plugins/community/swarm/__tests__/tools/DownloadDataTool.test.ts +93 -0
  202. package/src/plugins/community/swarm/__tests__/tools/DownloadFilesTool.test.ts +163 -0
  203. package/src/plugins/community/swarm/__tests__/tools/ExtendPostageStampTool.test.ts +132 -0
  204. package/src/plugins/community/swarm/__tests__/tools/GetPostageStampTool.test.ts +83 -0
  205. package/src/plugins/community/swarm/__tests__/tools/ListPostageStampsTool.test.ts +219 -0
  206. package/src/plugins/community/swarm/__tests__/tools/QueryUploadProgressTool.test.ts +169 -0
  207. package/src/plugins/community/swarm/__tests__/tools/ReadFeedTool.test.ts +133 -0
  208. package/src/plugins/community/swarm/__tests__/tools/SwarmTool.mocks.ts +67 -0
  209. package/src/plugins/community/swarm/__tests__/tools/UpdateFeedTool.test.ts +148 -0
  210. package/src/plugins/community/swarm/__tests__/tools/UploadDataTool.test.ts +125 -0
  211. package/src/plugins/community/swarm/__tests__/tools/UploadFileTool.test.ts +194 -0
  212. package/src/plugins/community/swarm/__tests__/tools/UploadFolderTool.test.ts +118 -0
  213. package/src/plugins/community/swarm/config.ts +6 -0
  214. package/src/plugins/community/swarm/constants.ts +12 -0
  215. package/src/plugins/community/swarm/index.ts +2 -0
  216. package/src/plugins/community/swarm/model.ts +23 -0
  217. package/src/plugins/community/swarm/tools/CreatePostageStampTool.ts +137 -0
  218. package/src/plugins/community/swarm/tools/DownloadDataTool.ts +79 -0
  219. package/src/plugins/community/swarm/tools/DownloadFilesTool.ts +155 -0
  220. package/src/plugins/community/swarm/tools/ExtendPostageStampTool.ts +112 -0
  221. package/src/plugins/community/swarm/tools/GetPostageStampTool.ts +92 -0
  222. package/src/plugins/community/swarm/tools/ListPostageStampsTool.ts +124 -0
  223. package/src/plugins/community/swarm/tools/QueryUploadProgressTool.ts +109 -0
  224. package/src/plugins/community/swarm/tools/ReadFeedTool.ts +110 -0
  225. package/src/plugins/community/swarm/tools/UpdateFeedTool.ts +149 -0
  226. package/src/plugins/community/swarm/tools/UploadDataTool.ts +109 -0
  227. package/src/plugins/community/swarm/tools/UploadFileTool.ts +163 -0
  228. package/src/plugins/community/swarm/tools/UploadFolderTool.ts +150 -0
  229. package/src/plugins/community/swarm/utils.ts +172 -0
  230. package/src/plugins/index.ts +1 -0
  231. package/cli/dist/CLIApp.d.ts +0 -11
  232. package/cli/dist/CLIApp.d.ts.map +0 -1
  233. package/cli/dist/CLIApp.js +0 -128
  234. package/cli/dist/CLIApp.js.map +0 -1
  235. package/cli/dist/LocalConversationalAgent.d.ts +0 -37
  236. package/cli/dist/LocalConversationalAgent.js +0 -58
  237. package/cli/dist/app.d.ts +0 -18
  238. package/cli/dist/app.d.ts.map +0 -1
  239. package/cli/dist/app.js +0 -14
  240. package/cli/dist/app.js.map +0 -1
  241. package/cli/dist/cli.d.ts +0 -3
  242. package/cli/dist/cli.d.ts.map +0 -1
  243. package/cli/dist/cli.js +0 -87
  244. package/cli/dist/cli.js.map +0 -1
  245. package/cli/dist/components/AppContainer.d.ts +0 -16
  246. package/cli/dist/components/AppContainer.js +0 -24
  247. package/cli/dist/components/AppScreens.d.ts +0 -2
  248. package/cli/dist/components/AppScreens.js +0 -259
  249. package/cli/dist/components/ChatScreen.d.ts +0 -21
  250. package/cli/dist/components/ChatScreen.d.ts.map +0 -1
  251. package/cli/dist/components/ChatScreen.js +0 -40
  252. package/cli/dist/components/ChatScreen.js.map +0 -1
  253. package/cli/dist/components/DebugLoadingScreen.d.ts +0 -5
  254. package/cli/dist/components/DebugLoadingScreen.js +0 -31
  255. package/cli/dist/components/LoadingScreen.d.ts +0 -3
  256. package/cli/dist/components/LoadingScreen.d.ts.map +0 -1
  257. package/cli/dist/components/LoadingScreen.js +0 -17
  258. package/cli/dist/components/LoadingScreen.js.map +0 -1
  259. package/cli/dist/components/LoadingScreenDebug.d.ts +0 -5
  260. package/cli/dist/components/LoadingScreenDebug.js +0 -27
  261. package/cli/dist/components/MCPConfigScreen.d.ts +0 -28
  262. package/cli/dist/components/MCPConfigScreen.d.ts.map +0 -1
  263. package/cli/dist/components/MCPConfigScreen.js +0 -186
  264. package/cli/dist/components/MCPConfigScreen.js.map +0 -1
  265. package/cli/dist/components/ScreenRouter.d.ts +0 -13
  266. package/cli/dist/components/ScreenRouter.d.ts.map +0 -1
  267. package/cli/dist/components/ScreenRouter.js +0 -23
  268. package/cli/dist/components/ScreenRouter.js.map +0 -1
  269. package/cli/dist/components/SetupScreen.d.ts +0 -16
  270. package/cli/dist/components/SetupScreen.d.ts.map +0 -1
  271. package/cli/dist/components/SetupScreen.js +0 -67
  272. package/cli/dist/components/SetupScreen.js.map +0 -1
  273. package/cli/dist/components/SingleLoadingScreen.d.ts +0 -5
  274. package/cli/dist/components/SingleLoadingScreen.js +0 -27
  275. package/cli/dist/components/StatusBadge.d.ts +0 -10
  276. package/cli/dist/components/StatusBadge.d.ts.map +0 -1
  277. package/cli/dist/components/StatusBadge.js +0 -24
  278. package/cli/dist/components/StatusBadge.js.map +0 -1
  279. package/cli/dist/components/TerminalWindow.d.ts +0 -9
  280. package/cli/dist/components/TerminalWindow.d.ts.map +0 -1
  281. package/cli/dist/components/TerminalWindow.js +0 -19
  282. package/cli/dist/components/TerminalWindow.js.map +0 -1
  283. package/cli/dist/components/WelcomeScreen.d.ts +0 -12
  284. package/cli/dist/components/WelcomeScreen.d.ts.map +0 -1
  285. package/cli/dist/components/WelcomeScreen.js +0 -47
  286. package/cli/dist/components/WelcomeScreen.js.map +0 -1
  287. package/cli/dist/context/AppContext.d.ts +0 -68
  288. package/cli/dist/context/AppContext.js +0 -363
  289. package/cli/dist/headless-runner.d.ts +0 -17
  290. package/cli/dist/headless-runner.d.ts.map +0 -1
  291. package/cli/dist/headless-runner.js +0 -128
  292. package/cli/dist/headless-runner.js.map +0 -1
  293. package/cli/dist/hooks/useInitializeAgent.d.ts +0 -19
  294. package/cli/dist/hooks/useInitializeAgent.d.ts.map +0 -1
  295. package/cli/dist/hooks/useInitializeAgent.js +0 -29
  296. package/cli/dist/hooks/useInitializeAgent.js.map +0 -1
  297. package/cli/dist/hooks/useStableState.d.ts +0 -38
  298. package/cli/dist/hooks/useStableState.d.ts.map +0 -1
  299. package/cli/dist/hooks/useStableState.js +0 -69
  300. package/cli/dist/hooks/useStableState.js.map +0 -1
  301. package/cli/dist/managers/AgentManager.d.ts +0 -58
  302. package/cli/dist/managers/AgentManager.d.ts.map +0 -1
  303. package/cli/dist/managers/AgentManager.js +0 -121
  304. package/cli/dist/managers/AgentManager.js.map +0 -1
  305. package/cli/dist/managers/ConfigManager.d.ts +0 -54
  306. package/cli/dist/managers/ConfigManager.d.ts.map +0 -1
  307. package/cli/dist/managers/ConfigManager.js +0 -188
  308. package/cli/dist/managers/ConfigManager.js.map +0 -1
  309. package/cli/dist/types.d.ts +0 -52
  310. package/cli/dist/types.d.ts.map +0 -1
  311. package/cli/dist/types.js +0 -34
  312. package/cli/dist/types.js.map +0 -1
@@ -1,82 +1,69 @@
1
- import { BasePlugin, BaseHederaQueryTool } from "hedera-agent-kit";
2
- import { z } from "zod";
3
- const PageSnapshotSchema = z.object({
4
- url: z.string().url(),
5
- maxCharacters: z.number().int().min(256, "Minimum length is 256 characters").max(8e3, "Maximum length is 8000 characters").optional().default(3e3)
6
- });
7
- class WebPageSnapshotTool extends BaseHederaQueryTool {
8
- constructor(params) {
9
- const { fetchImpl, ...rest } = params;
10
- super(rest);
11
- this.name = "web_page_snapshot";
12
- this.description = "Fetches the visible text content of a web page for analysis.";
13
- this.namespace = "browser";
14
- this.specificInputSchema = PageSnapshotSchema;
15
- this.fetchImpl = fetchImpl ?? fetch;
1
+ import { AccountId, Client, PrivateKey, TransactionReceipt, PublicKey } from "@hashgraph/sdk";
2
+ import { AbstractSigner } from "hedera-agent-kit";
3
+ import { HederaMirrorNode, Logger } from "@hashgraphonline/standards-sdk";
4
+ class BrowserSigner extends AbstractSigner {
5
+ getAccountId() {
6
+ return this.account;
16
7
  }
17
- async executeQuery(input) {
18
- const maxChars = input.maxCharacters ?? 3e3;
19
- try {
20
- const response = await this.fetchImpl(input.url, {
21
- redirect: "follow"
22
- });
23
- if (!response.ok) {
24
- return `Failed to load ${input.url}: HTTP ${response.status}`;
25
- }
26
- const html = await response.text();
27
- const text = this.normalizeHtml(html);
28
- if (!text) {
29
- return "The fetched page did not contain readable text.";
30
- }
31
- return text.length > maxChars ? `${text.slice(0, maxChars)}…` : text;
32
- } catch (error) {
33
- this.logger.error("WebPageSnapshotTool failed", error);
34
- return `Failed to fetch content for ${input.url}: ${error instanceof Error ? error.message : String(error)}`;
35
- }
8
+ getNetwork() {
9
+ return this.network;
36
10
  }
37
- normalizeHtml(html) {
38
- const withoutScripts = html.replace(/<script[\s\S]*?<\/script>/gi, " ").replace(/<style[\s\S]*?<\/style>/gi, " ").replace(/<!--([\s\S]*?)-->/g, " ");
39
- const stripped = withoutScripts.replace(/<[^>]+>/g, " ");
40
- const decoded = stripped.replace(/&nbsp;/gi, " ").replace(/&amp;/gi, "&").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&#39;/gi, "'");
41
- return decoded.replace(/\s+/g, " ").trim();
11
+ constructor(accountId, network, executor) {
12
+ super();
13
+ this.account = AccountId.fromString(accountId);
14
+ this.network = network;
15
+ this.client = network === "mainnet" ? Client.forMainnet() : Client.forTestnet();
16
+ this.exec = executor ?? null;
17
+ this.ephemeralKey = PrivateKey.generateED25519();
42
18
  }
43
- }
44
- class WebBrowserPlugin extends BasePlugin {
45
- constructor() {
46
- super(...arguments);
47
- this.id = "web-browser";
48
- this.name = "Web Browser Plugin";
49
- this.description = "Provides tools for fetching live web page content to enrich assistant understanding.";
50
- this.version = "0.1.0";
51
- this.author = "Hashgraph Online";
52
- this.namespace = "browser";
53
- this.tools = [];
19
+ /**
20
+ * Returns an auto-generated ED25519 key for client wiring only.
21
+ * Do not use for signing; wallet performs signing in renderer.
22
+ */
23
+ getOperatorPrivateKey() {
24
+ return this.ephemeralKey;
54
25
  }
55
- async initialize(context) {
56
- await super.initialize(context);
57
- const hederaKit = context.config.hederaKit;
58
- if (!hederaKit) {
59
- this.context.logger.warn(
60
- "WebBrowserPlugin skipped because HederaAgentKit was not present in plugin context."
61
- );
62
- this.tools = [];
63
- return;
64
- }
65
- const tool = new WebPageSnapshotTool({
66
- hederaKit,
67
- logger: this.context.logger
68
- });
69
- this.tools = [tool];
70
- this.context.logger.info("Web Browser Plugin initialized with snapshot tool");
26
+ getClient() {
27
+ return this.client;
71
28
  }
72
- getTools() {
73
- return this.tools;
29
+ async signAndExecuteTransaction(tx) {
30
+ if (!this.exec) {
31
+ throw new Error("BrowserSigner executor not available");
32
+ }
33
+ if (!tx.isFrozen()) {
34
+ await tx.freezeWith(this.client);
35
+ }
36
+ const base64 = Buffer.from(tx.toBytes()).toString("base64");
37
+ const { transactionId } = await this.exec(base64, this.network);
38
+ const mirror = new HederaMirrorNode(this.network);
39
+ const deadline = Date.now() + 6e4;
40
+ while (Date.now() < deadline) {
41
+ try {
42
+ const details = await mirror.getTransaction(transactionId);
43
+ if (details && details.result) {
44
+ return TransactionReceipt.fromBytes(
45
+ Buffer.from(details.result, "base64")
46
+ );
47
+ }
48
+ } catch {
49
+ }
50
+ await new Promise((r) => setTimeout(r, 1200));
51
+ }
52
+ return TransactionReceipt.fromBytes(Buffer.from(""));
74
53
  }
75
- async cleanup() {
76
- this.tools = [];
54
+ async getPublicKey() {
55
+ const network = this.network === "mainnet" ? "mainnet" : "testnet";
56
+ const mirror = new HederaMirrorNode(
57
+ network,
58
+ new Logger({ module: "BrowserSigner" })
59
+ );
60
+ const anyKey = await mirror.getPublicKey(this.account.toString());
61
+ const keyStr = typeof anyKey?.toString === "function" ? anyKey.toString() : String(anyKey);
62
+ return PublicKey.fromString(keyStr);
77
63
  }
78
64
  }
79
65
  export {
80
- WebBrowserPlugin
66
+ BrowserSigner,
67
+ BrowserSigner as default
81
68
  };
82
69
  //# sourceMappingURL=index40.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index40.js","sources":["../../src/plugins/web-browser/WebBrowserPlugin.ts"],"sourcesContent":["import {\n BasePlugin,\n type GenericPluginContext,\n BaseHederaQueryTool,\n type HederaAgentKit,\n type HederaTool,\n} from 'hedera-agent-kit';\nimport { z } from 'zod';\n\nconst PageSnapshotSchema = z.object({\n url: z.string().url(),\n maxCharacters: z\n .number()\n .int()\n .min(256, 'Minimum length is 256 characters')\n .max(8000, 'Maximum length is 8000 characters')\n .optional()\n .default(3000),\n});\n\nclass WebPageSnapshotTool extends BaseHederaQueryTool<typeof PageSnapshotSchema> {\n name = 'web_page_snapshot';\n description = 'Fetches the visible text content of a web page for analysis.';\n namespace = 'browser';\n specificInputSchema = PageSnapshotSchema;\n\n constructor(params: {\n hederaKit: HederaAgentKit;\n logger?: GenericPluginContext['logger'];\n fetchImpl?: typeof fetch;\n }) {\n const { fetchImpl, ...rest } = params;\n super(rest);\n this.fetchImpl = fetchImpl ?? fetch;\n }\n\n private readonly fetchImpl: typeof fetch;\n\n protected async executeQuery(\n input: z.infer<typeof PageSnapshotSchema>\n ): Promise<string> {\n const maxChars = input.maxCharacters ?? 3000;\n\n try {\n const response = await this.fetchImpl(input.url, {\n redirect: 'follow',\n });\n\n if (!response.ok) {\n return `Failed to load ${input.url}: HTTP ${response.status}`;\n }\n\n const html = await response.text();\n const text = this.normalizeHtml(html);\n\n if (!text) {\n return 'The fetched page did not contain readable text.';\n }\n\n return text.length > maxChars ? `${text.slice(0, maxChars)}…` : text;\n } catch (error) {\n this.logger.error('WebPageSnapshotTool failed', error);\n return `Failed to fetch content for ${input.url}: ${\n error instanceof Error ? error.message : String(error)\n }`;\n }\n }\n\n private normalizeHtml(html: string): string {\n const withoutScripts = html\n .replace(/<script[\\s\\S]*?<\\/script>/gi, ' ')\n .replace(/<style[\\s\\S]*?<\\/style>/gi, ' ')\n .replace(/<!--([\\s\\S]*?)-->/g, ' ');\n\n const stripped = withoutScripts.replace(/<[^>]+>/g, ' ');\n const decoded = stripped\n .replace(/&nbsp;/gi, ' ')\n .replace(/&amp;/gi, '&')\n .replace(/&lt;/gi, '<')\n .replace(/&gt;/gi, '>')\n .replace(/&quot;/gi, '\"')\n .replace(/&#39;/gi, \"'\");\n\n return decoded.replace(/\\s+/g, ' ').trim();\n }\n}\n\nexport class WebBrowserPlugin extends BasePlugin<GenericPluginContext> {\n id = 'web-browser';\n name = 'Web Browser Plugin';\n description =\n 'Provides tools for fetching live web page content to enrich assistant understanding.';\n version = '0.1.0';\n author = 'Hashgraph Online';\n namespace = 'browser';\n\n private tools: HederaTool[] = [];\n\n override async initialize(context: GenericPluginContext): Promise<void> {\n await super.initialize(context);\n\n const hederaKit = context.config.hederaKit as HederaAgentKit | undefined;\n\n if (!hederaKit) {\n this.context.logger.warn(\n 'WebBrowserPlugin skipped because HederaAgentKit was not present in plugin context.'\n );\n this.tools = [];\n return;\n }\n\n const tool = new WebPageSnapshotTool({\n hederaKit,\n logger: this.context.logger,\n });\n\n this.tools = [tool];\n this.context.logger.info('Web Browser Plugin initialized with snapshot tool');\n }\n\n override getTools(): HederaTool[] {\n return this.tools;\n }\n\n override async cleanup(): Promise<void> {\n this.tools = [];\n }\n}\n"],"names":[],"mappings":";;AASA,MAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,KAAK,EAAE,OAAA,EAAS,IAAA;AAAA,EAChB,eAAe,EACZ,OAAA,EACA,IAAA,EACA,IAAI,KAAK,kCAAkC,EAC3C,IAAI,KAAM,mCAAmC,EAC7C,SAAA,EACA,QAAQ,GAAI;AACjB,CAAC;AAED,MAAM,4BAA4B,oBAA+C;AAAA,EAM/E,YAAY,QAIT;AACD,UAAM,EAAE,WAAW,GAAG,KAAA,IAAS;AAC/B,UAAM,IAAI;AAXZ,SAAA,OAAO;AACP,SAAA,cAAc;AACd,SAAA,YAAY;AACZ,SAAA,sBAAsB;AASpB,SAAK,YAAY,aAAa;AAAA,EAChC;AAAA,EAIA,MAAgB,aACd,OACiB;AACjB,UAAM,WAAW,MAAM,iBAAiB;AAExC,QAAI;AACF,YAAM,WAAW,MAAM,KAAK,UAAU,MAAM,KAAK;AAAA,QAC/C,UAAU;AAAA,MAAA,CACX;AAED,UAAI,CAAC,SAAS,IAAI;AAChB,eAAO,kBAAkB,MAAM,GAAG,UAAU,SAAS,MAAM;AAAA,MAC7D;AAEA,YAAM,OAAO,MAAM,SAAS,KAAA;AAC5B,YAAM,OAAO,KAAK,cAAc,IAAI;AAEpC,UAAI,CAAC,MAAM;AACT,eAAO;AAAA,MACT;AAEA,aAAO,KAAK,SAAS,WAAW,GAAG,KAAK,MAAM,GAAG,QAAQ,CAAC,MAAM;AAAA,IAClE,SAAS,OAAO;AACd,WAAK,OAAO,MAAM,8BAA8B,KAAK;AACrD,aAAO,+BAA+B,MAAM,GAAG,KAC7C,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CACvD;AAAA,IACF;AAAA,EACF;AAAA,EAEQ,cAAc,MAAsB;AAC1C,UAAM,iBAAiB,KACpB,QAAQ,+BAA+B,GAAG,EAC1C,QAAQ,6BAA6B,GAAG,EACxC,QAAQ,sBAAsB,GAAG;AAEpC,UAAM,WAAW,eAAe,QAAQ,YAAY,GAAG;AACvD,UAAM,UAAU,SACb,QAAQ,YAAY,GAAG,EACvB,QAAQ,WAAW,GAAG,EACtB,QAAQ,UAAU,GAAG,EACrB,QAAQ,UAAU,GAAG,EACrB,QAAQ,YAAY,GAAG,EACvB,QAAQ,WAAW,GAAG;AAEzB,WAAO,QAAQ,QAAQ,QAAQ,GAAG,EAAE,KAAA;AAAA,EACtC;AACF;AAEO,MAAM,yBAAyB,WAAiC;AAAA,EAAhE,cAAA;AAAA,UAAA,GAAA,SAAA;AACL,SAAA,KAAK;AACL,SAAA,OAAO;AACP,SAAA,cACE;AACF,SAAA,UAAU;AACV,SAAA,SAAS;AACT,SAAA,YAAY;AAEZ,SAAQ,QAAsB,CAAA;AAAA,EAAC;AAAA,EAE/B,MAAe,WAAW,SAA8C;AACtE,UAAM,MAAM,WAAW,OAAO;AAE9B,UAAM,YAAY,QAAQ,OAAO;AAEjC,QAAI,CAAC,WAAW;AACd,WAAK,QAAQ,OAAO;AAAA,QAClB;AAAA,MAAA;AAEF,WAAK,QAAQ,CAAA;AACb;AAAA,IACF;AAEA,UAAM,OAAO,IAAI,oBAAoB;AAAA,MACnC;AAAA,MACA,QAAQ,KAAK,QAAQ;AAAA,IAAA,CACtB;AAED,SAAK,QAAQ,CAAC,IAAI;AAClB,SAAK,QAAQ,OAAO,KAAK,mDAAmD;AAAA,EAC9E;AAAA,EAES,WAAyB;AAChC,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAe,UAAyB;AACtC,SAAK,QAAQ,CAAA;AAAA,EACf;AACF;"}
1
+ {"version":3,"file":"index40.js","sources":["../../src/signers/browser-signer.ts"],"sourcesContent":["import {\n AccountId,\n Client,\n PrivateKey,\n PublicKey,\n Transaction,\n TransactionReceipt,\n} from '@hashgraph/sdk';\nimport { AbstractSigner } from 'hedera-agent-kit';\nimport {\n HederaMirrorNode,\n Logger,\n type NetworkType,\n} from '@hashgraphonline/standards-sdk';\n\n/**\n * BrowserSigner (bytes-only)\n *\n * Minimal signer compatible with HederaAgentKit in bytes/Provide Bytes mode.\n * - Does NOT hold a private key\n * - Cannot execute transactions; only provides identity and network context\n * - getOperatorPrivateKey() throws to signal absence of a local key\n */\nexport class BrowserSigner extends AbstractSigner {\n private readonly account: AccountId;\n private readonly network: 'mainnet' | 'testnet';\n private readonly client: Client;\n private readonly exec: ((\n base64: string,\n network: 'mainnet' | 'testnet'\n ) => Promise<{ transactionId: string }>) | null;\n private readonly ephemeralKey: PrivateKey;\n\n getAccountId(): AccountId {\n return this.account;\n }\n\n getNetwork(): 'mainnet' | 'testnet' {\n return this.network;\n }\n\n constructor(\n accountId: string,\n network: 'mainnet' | 'testnet',\n executor?: (\n base64: string,\n network: 'mainnet' | 'testnet'\n ) => Promise<{ transactionId: string }>\n ) {\n super();\n this.account = AccountId.fromString(accountId);\n this.network = network;\n this.client =\n network === 'mainnet' ? Client.forMainnet() : Client.forTestnet();\n this.exec = executor ?? null;\n this.ephemeralKey = PrivateKey.generateED25519();\n }\n\n /**\n * Returns an auto-generated ED25519 key for client wiring only.\n * Do not use for signing; wallet performs signing in renderer.\n */\n getOperatorPrivateKey(): PrivateKey {\n return this.ephemeralKey;\n }\n\n getClient(): Client {\n return this.client;\n }\n\n async signAndExecuteTransaction(\n tx: Transaction\n ): Promise<TransactionReceipt> {\n if (!this.exec) {\n throw new Error('BrowserSigner executor not available');\n }\n if (!tx.isFrozen()) {\n await tx.freezeWith(this.client);\n }\n const base64 = Buffer.from(tx.toBytes()).toString('base64');\n const { transactionId } = await this.exec(base64, this.network);\n const mirror = new HederaMirrorNode(this.network);\n const deadline = Date.now() + 60000;\n while (Date.now() < deadline) {\n try {\n const details = await mirror.getTransaction(transactionId);\n if (details && details.result) {\n return TransactionReceipt.fromBytes(\n Buffer.from(details.result, 'base64')\n );\n }\n } catch {}\n await new Promise((r) => setTimeout(r, 1200));\n }\n return TransactionReceipt.fromBytes(Buffer.from(''));\n }\n\n override async getPublicKey(): Promise<PublicKey> {\n const network: NetworkType =\n this.network === 'mainnet' ? 'mainnet' : 'testnet';\n const mirror = new HederaMirrorNode(\n network,\n new Logger({ module: 'BrowserSigner' })\n );\n const anyKey: any = await mirror.getPublicKey(this.account.toString());\n const keyStr = typeof anyKey?.toString === 'function' ? anyKey.toString() : String(anyKey);\n return PublicKey.fromString(keyStr);\n }\n}\n\nexport default BrowserSigner;\n"],"names":[],"mappings":";;;AAuBO,MAAM,sBAAsB,eAAe;AAAA,EAUhD,eAA0B;AACxB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,aAAoC;AAClC,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YACE,WACA,SACA,UAIA;AACA,UAAA;AACA,SAAK,UAAU,UAAU,WAAW,SAAS;AAC7C,SAAK,UAAU;AACf,SAAK,SACH,YAAY,YAAY,OAAO,WAAA,IAAe,OAAO,WAAA;AACvD,SAAK,OAAO,YAAY;AACxB,SAAK,eAAe,WAAW,gBAAA;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,wBAAoC;AAClC,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YAAoB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,0BACJ,IAC6B;AAC7B,QAAI,CAAC,KAAK,MAAM;AACd,YAAM,IAAI,MAAM,sCAAsC;AAAA,IACxD;AACA,QAAI,CAAC,GAAG,YAAY;AAClB,YAAM,GAAG,WAAW,KAAK,MAAM;AAAA,IACjC;AACA,UAAM,SAAS,OAAO,KAAK,GAAG,SAAS,EAAE,SAAS,QAAQ;AAC1D,UAAM,EAAE,kBAAkB,MAAM,KAAK,KAAK,QAAQ,KAAK,OAAO;AAC9D,UAAM,SAAS,IAAI,iBAAiB,KAAK,OAAO;AAChD,UAAM,WAAW,KAAK,IAAA,IAAQ;AAC9B,WAAO,KAAK,IAAA,IAAQ,UAAU;AAC5B,UAAI;AACF,cAAM,UAAU,MAAM,OAAO,eAAe,aAAa;AACzD,YAAI,WAAW,QAAQ,QAAQ;AAC7B,iBAAO,mBAAmB;AAAA,YACxB,OAAO,KAAK,QAAQ,QAAQ,QAAQ;AAAA,UAAA;AAAA,QAExC;AAAA,MACF,QAAQ;AAAA,MAAC;AACT,YAAM,IAAI,QAAQ,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC;AAAA,IAC9C;AACA,WAAO,mBAAmB,UAAU,OAAO,KAAK,EAAE,CAAC;AAAA,EACrD;AAAA,EAEA,MAAe,eAAmC;AAChD,UAAM,UACJ,KAAK,YAAY,YAAY,YAAY;AAC3C,UAAM,SAAS,IAAI;AAAA,MACjB;AAAA,MACA,IAAI,OAAO,EAAE,QAAQ,iBAAiB;AAAA,IAAA;AAExC,UAAM,SAAc,MAAM,OAAO,aAAa,KAAK,QAAQ,UAAU;AACrE,UAAM,SAAS,OAAO,QAAQ,aAAa,aAAa,OAAO,SAAA,IAAa,OAAO,MAAM;AACzF,WAAO,UAAU,WAAW,MAAM;AAAA,EACpC;AACF;"}
@@ -1,24 +1,82 @@
1
- const getSystemMessage = (accountId) => `You are a helpful assistant managing Hashgraph Online HCS-10 connections, messages, HCS-2 registries, content inscription, and Hedera Hashgraph operations.
2
-
3
- You have access to tools for:
4
- - HCS-10: registering agents, finding registered agents, initiating connections, listing active connections, sending messages over connections, and checking for new messages
5
- - HCS-2: creating registries, registering entries, updating entries, deleting entries, migrating registries, and querying registry contents
6
- - Inscription: inscribing content from URLs, files, or buffers, creating Hashinal NFTs, and retrieving inscriptions
7
- - Hedera Token Service (HTS): creating tokens, transferring tokens, airdropping tokens, and managing token operations
8
-
9
-
10
- *** IMPORTANT CONTEXT ***
11
- You are currently operating as agent: ${accountId || "unknown"} on the Hedera Hashgraph
12
- When users ask about "my profile", "my account", "my connections", etc., use this account ID: ${accountId || "unknown"}
13
-
14
- *** CRITICAL ENTITY HANDLING RULES ***
15
- - When users refer to entities (tokens, topics, accounts) with pronouns like "it", "that", "the token/topic", etc., ALWAYS use the most recently created entity of that type
16
- - Entity IDs look like "0.0.XXXXXX" and are stored in memory after creation
17
- - NEVER use example or placeholder IDs like "0.0.123456" - always use actual created entity IDs
18
- - Account ID ${accountId} is NOT a token - tokens and accounts are different entities
19
-
20
- Remember the connection numbers when listing connections, as users might refer to them.`;
1
+ import { BasePlugin, BaseHederaQueryTool } from "hedera-agent-kit";
2
+ import { z } from "zod";
3
+ const PageSnapshotSchema = z.object({
4
+ url: z.string().url(),
5
+ maxCharacters: z.number().int().min(256, "Minimum length is 256 characters").max(8e3, "Maximum length is 8000 characters").optional().default(3e3)
6
+ });
7
+ class WebPageSnapshotTool extends BaseHederaQueryTool {
8
+ constructor(params) {
9
+ const { fetchImpl, ...rest } = params;
10
+ super(rest);
11
+ this.name = "web_page_snapshot";
12
+ this.description = "Fetches the visible text content of a web page for analysis.";
13
+ this.namespace = "browser";
14
+ this.specificInputSchema = PageSnapshotSchema;
15
+ this.fetchImpl = fetchImpl ?? fetch;
16
+ }
17
+ async executeQuery(input) {
18
+ const maxChars = input.maxCharacters ?? 3e3;
19
+ try {
20
+ const response = await this.fetchImpl(input.url, {
21
+ redirect: "follow"
22
+ });
23
+ if (!response.ok) {
24
+ return `Failed to load ${input.url}: HTTP ${response.status}`;
25
+ }
26
+ const html = await response.text();
27
+ const text = this.normalizeHtml(html);
28
+ if (!text) {
29
+ return "The fetched page did not contain readable text.";
30
+ }
31
+ return text.length > maxChars ? `${text.slice(0, maxChars)}…` : text;
32
+ } catch (error) {
33
+ this.logger.error("WebPageSnapshotTool failed", error);
34
+ return `Failed to fetch content for ${input.url}: ${error instanceof Error ? error.message : String(error)}`;
35
+ }
36
+ }
37
+ normalizeHtml(html) {
38
+ const withoutScripts = html.replace(/<script[\s\S]*?<\/script>/gi, " ").replace(/<style[\s\S]*?<\/style>/gi, " ").replace(/<!--([\s\S]*?)-->/g, " ");
39
+ const stripped = withoutScripts.replace(/<[^>]+>/g, " ");
40
+ const decoded = stripped.replace(/&nbsp;/gi, " ").replace(/&amp;/gi, "&").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&#39;/gi, "'");
41
+ return decoded.replace(/\s+/g, " ").trim();
42
+ }
43
+ }
44
+ class WebBrowserPlugin extends BasePlugin {
45
+ constructor() {
46
+ super(...arguments);
47
+ this.id = "web-browser";
48
+ this.name = "Web Browser Plugin";
49
+ this.description = "Provides tools for fetching live web page content to enrich assistant understanding.";
50
+ this.version = "0.1.0";
51
+ this.author = "Hashgraph Online";
52
+ this.namespace = "browser";
53
+ this.tools = [];
54
+ }
55
+ async initialize(context) {
56
+ await super.initialize(context);
57
+ const hederaKit = context.config.hederaKit;
58
+ if (!hederaKit) {
59
+ this.context.logger.warn(
60
+ "WebBrowserPlugin skipped because HederaAgentKit was not present in plugin context."
61
+ );
62
+ this.tools = [];
63
+ return;
64
+ }
65
+ const tool = new WebPageSnapshotTool({
66
+ hederaKit,
67
+ logger: this.context.logger
68
+ });
69
+ this.tools = [tool];
70
+ this.context.logger.info("Web Browser Plugin initialized with snapshot tool");
71
+ }
72
+ getTools() {
73
+ return this.tools;
74
+ }
75
+ async cleanup() {
76
+ this.tools = [];
77
+ }
78
+ }
21
79
  export {
22
- getSystemMessage
80
+ WebBrowserPlugin
23
81
  };
24
82
  //# sourceMappingURL=index41.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index41.js","sources":["../../src/config/system-message.ts"],"sourcesContent":["export const getSystemMessage = (\n accountId?: string\n): string => `You are a helpful assistant managing Hashgraph Online HCS-10 connections, messages, HCS-2 registries, content inscription, and Hedera Hashgraph operations.\n\nYou have access to tools for:\n- HCS-10: registering agents, finding registered agents, initiating connections, listing active connections, sending messages over connections, and checking for new messages\n- HCS-2: creating registries, registering entries, updating entries, deleting entries, migrating registries, and querying registry contents\n- Inscription: inscribing content from URLs, files, or buffers, creating Hashinal NFTs, and retrieving inscriptions\n- Hedera Token Service (HTS): creating tokens, transferring tokens, airdropping tokens, and managing token operations\n\n\n*** IMPORTANT CONTEXT ***\nYou are currently operating as agent: ${accountId || 'unknown'} on the Hedera Hashgraph\nWhen users ask about \"my profile\", \"my account\", \"my connections\", etc., use this account ID: ${accountId || 'unknown'}\n\n*** CRITICAL ENTITY HANDLING RULES ***\n- When users refer to entities (tokens, topics, accounts) with pronouns like \"it\", \"that\", \"the token/topic\", etc., ALWAYS use the most recently created entity of that type\n- Entity IDs look like \"0.0.XXXXXX\" and are stored in memory after creation\n- NEVER use example or placeholder IDs like \"0.0.123456\" - always use actual created entity IDs\n- Account ID ${accountId} is NOT a token - tokens and accounts are different entities\n\n Remember the connection numbers when listing connections, as users might refer to them.`;\n"],"names":[],"mappings":"AAAO,MAAM,mBAAmB,CAC9B,cACW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAU2B,aAAa,SAAS;AAAA,gGACkC,aAAa,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAMvG,SAAS;AAAA;AAAA;"}
1
+ {"version":3,"file":"index41.js","sources":["../../src/plugins/web-browser/WebBrowserPlugin.ts"],"sourcesContent":["import {\n BasePlugin,\n type GenericPluginContext,\n BaseHederaQueryTool,\n type HederaAgentKit,\n type HederaTool,\n} from 'hedera-agent-kit';\nimport { z } from 'zod';\n\nconst PageSnapshotSchema = z.object({\n url: z.string().url(),\n maxCharacters: z\n .number()\n .int()\n .min(256, 'Minimum length is 256 characters')\n .max(8000, 'Maximum length is 8000 characters')\n .optional()\n .default(3000),\n});\n\nclass WebPageSnapshotTool extends BaseHederaQueryTool<typeof PageSnapshotSchema> {\n name = 'web_page_snapshot';\n description = 'Fetches the visible text content of a web page for analysis.';\n namespace = 'browser';\n specificInputSchema = PageSnapshotSchema;\n\n constructor(params: {\n hederaKit: HederaAgentKit;\n logger?: GenericPluginContext['logger'];\n fetchImpl?: typeof fetch;\n }) {\n const { fetchImpl, ...rest } = params;\n super(rest);\n this.fetchImpl = fetchImpl ?? fetch;\n }\n\n private readonly fetchImpl: typeof fetch;\n\n protected async executeQuery(\n input: z.infer<typeof PageSnapshotSchema>\n ): Promise<string> {\n const maxChars = input.maxCharacters ?? 3000;\n\n try {\n const response = await this.fetchImpl(input.url, {\n redirect: 'follow',\n });\n\n if (!response.ok) {\n return `Failed to load ${input.url}: HTTP ${response.status}`;\n }\n\n const html = await response.text();\n const text = this.normalizeHtml(html);\n\n if (!text) {\n return 'The fetched page did not contain readable text.';\n }\n\n return text.length > maxChars ? `${text.slice(0, maxChars)}…` : text;\n } catch (error) {\n this.logger.error('WebPageSnapshotTool failed', error);\n return `Failed to fetch content for ${input.url}: ${\n error instanceof Error ? error.message : String(error)\n }`;\n }\n }\n\n private normalizeHtml(html: string): string {\n const withoutScripts = html\n .replace(/<script[\\s\\S]*?<\\/script>/gi, ' ')\n .replace(/<style[\\s\\S]*?<\\/style>/gi, ' ')\n .replace(/<!--([\\s\\S]*?)-->/g, ' ');\n\n const stripped = withoutScripts.replace(/<[^>]+>/g, ' ');\n const decoded = stripped\n .replace(/&nbsp;/gi, ' ')\n .replace(/&amp;/gi, '&')\n .replace(/&lt;/gi, '<')\n .replace(/&gt;/gi, '>')\n .replace(/&quot;/gi, '\"')\n .replace(/&#39;/gi, \"'\");\n\n return decoded.replace(/\\s+/g, ' ').trim();\n }\n}\n\nexport class WebBrowserPlugin extends BasePlugin<GenericPluginContext> {\n id = 'web-browser';\n name = 'Web Browser Plugin';\n description =\n 'Provides tools for fetching live web page content to enrich assistant understanding.';\n version = '0.1.0';\n author = 'Hashgraph Online';\n namespace = 'browser';\n\n private tools: HederaTool[] = [];\n\n override async initialize(context: GenericPluginContext): Promise<void> {\n await super.initialize(context);\n\n const hederaKit = context.config.hederaKit as HederaAgentKit | undefined;\n\n if (!hederaKit) {\n this.context.logger.warn(\n 'WebBrowserPlugin skipped because HederaAgentKit was not present in plugin context.'\n );\n this.tools = [];\n return;\n }\n\n const tool = new WebPageSnapshotTool({\n hederaKit,\n logger: this.context.logger,\n });\n\n this.tools = [tool];\n this.context.logger.info('Web Browser Plugin initialized with snapshot tool');\n }\n\n override getTools(): HederaTool[] {\n return this.tools;\n }\n\n override async cleanup(): Promise<void> {\n this.tools = [];\n }\n}\n"],"names":[],"mappings":";;AASA,MAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,KAAK,EAAE,OAAA,EAAS,IAAA;AAAA,EAChB,eAAe,EACZ,OAAA,EACA,IAAA,EACA,IAAI,KAAK,kCAAkC,EAC3C,IAAI,KAAM,mCAAmC,EAC7C,SAAA,EACA,QAAQ,GAAI;AACjB,CAAC;AAED,MAAM,4BAA4B,oBAA+C;AAAA,EAM/E,YAAY,QAIT;AACD,UAAM,EAAE,WAAW,GAAG,KAAA,IAAS;AAC/B,UAAM,IAAI;AAXZ,SAAA,OAAO;AACP,SAAA,cAAc;AACd,SAAA,YAAY;AACZ,SAAA,sBAAsB;AASpB,SAAK,YAAY,aAAa;AAAA,EAChC;AAAA,EAIA,MAAgB,aACd,OACiB;AACjB,UAAM,WAAW,MAAM,iBAAiB;AAExC,QAAI;AACF,YAAM,WAAW,MAAM,KAAK,UAAU,MAAM,KAAK;AAAA,QAC/C,UAAU;AAAA,MAAA,CACX;AAED,UAAI,CAAC,SAAS,IAAI;AAChB,eAAO,kBAAkB,MAAM,GAAG,UAAU,SAAS,MAAM;AAAA,MAC7D;AAEA,YAAM,OAAO,MAAM,SAAS,KAAA;AAC5B,YAAM,OAAO,KAAK,cAAc,IAAI;AAEpC,UAAI,CAAC,MAAM;AACT,eAAO;AAAA,MACT;AAEA,aAAO,KAAK,SAAS,WAAW,GAAG,KAAK,MAAM,GAAG,QAAQ,CAAC,MAAM;AAAA,IAClE,SAAS,OAAO;AACd,WAAK,OAAO,MAAM,8BAA8B,KAAK;AACrD,aAAO,+BAA+B,MAAM,GAAG,KAC7C,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CACvD;AAAA,IACF;AAAA,EACF;AAAA,EAEQ,cAAc,MAAsB;AAC1C,UAAM,iBAAiB,KACpB,QAAQ,+BAA+B,GAAG,EAC1C,QAAQ,6BAA6B,GAAG,EACxC,QAAQ,sBAAsB,GAAG;AAEpC,UAAM,WAAW,eAAe,QAAQ,YAAY,GAAG;AACvD,UAAM,UAAU,SACb,QAAQ,YAAY,GAAG,EACvB,QAAQ,WAAW,GAAG,EACtB,QAAQ,UAAU,GAAG,EACrB,QAAQ,UAAU,GAAG,EACrB,QAAQ,YAAY,GAAG,EACvB,QAAQ,WAAW,GAAG;AAEzB,WAAO,QAAQ,QAAQ,QAAQ,GAAG,EAAE,KAAA;AAAA,EACtC;AACF;AAEO,MAAM,yBAAyB,WAAiC;AAAA,EAAhE,cAAA;AAAA,UAAA,GAAA,SAAA;AACL,SAAA,KAAK;AACL,SAAA,OAAO;AACP,SAAA,cACE;AACF,SAAA,UAAU;AACV,SAAA,SAAS;AACT,SAAA,YAAY;AAEZ,SAAQ,QAAsB,CAAA;AAAA,EAAC;AAAA,EAE/B,MAAe,WAAW,SAA8C;AACtE,UAAM,MAAM,WAAW,OAAO;AAE9B,UAAM,YAAY,QAAQ,OAAO;AAEjC,QAAI,CAAC,WAAW;AACd,WAAK,QAAQ,OAAO;AAAA,QAClB;AAAA,MAAA;AAEF,WAAK,QAAQ,CAAA;AACb;AAAA,IACF;AAEA,UAAM,OAAO,IAAI,oBAAoB;AAAA,MACnC;AAAA,MACA,QAAQ,KAAK,QAAQ;AAAA,IAAA,CACtB;AAED,SAAK,QAAQ,CAAC,IAAI;AAClB,SAAK,QAAQ,OAAO,KAAK,mDAAmD;AAAA,EAC9E;AAAA,EAES,WAAyB;AAChC,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAe,UAAyB;AACtC,SAAK,QAAQ,CAAA;AAAA,EACf;AACF;"}
@@ -1,8 +1,24 @@
1
- const ERROR_MESSAGES = {
2
- TOO_MANY_REQUESTS: "Too many requests. Please wait a moment and try again.",
3
- RATE_LIMITED: "I'm receiving too many requests right now. Please wait a moment and try again."
4
- };
1
+ const getSystemMessage = (accountId) => `You are a helpful assistant managing Hashgraph Online HCS-10 connections, messages, HCS-2 registries, content inscription, and Hedera Hashgraph operations.
2
+
3
+ You have access to tools for:
4
+ - HCS-10: registering agents, finding registered agents, initiating connections, listing active connections, sending messages over connections, and checking for new messages
5
+ - HCS-2: creating registries, registering entries, updating entries, deleting entries, migrating registries, and querying registry contents
6
+ - Inscription: inscribing content from URLs, files, or buffers, creating Hashinal NFTs, and retrieving inscriptions
7
+ - Hedera Token Service (HTS): creating tokens, transferring tokens, airdropping tokens, and managing token operations
8
+
9
+
10
+ *** IMPORTANT CONTEXT ***
11
+ You are currently operating as agent: ${accountId || "unknown"} on the Hedera Hashgraph
12
+ When users ask about "my profile", "my account", "my connections", etc., use this account ID: ${accountId || "unknown"}
13
+
14
+ *** CRITICAL ENTITY HANDLING RULES ***
15
+ - When users refer to entities (tokens, topics, accounts) with pronouns like "it", "that", "the token/topic", etc., ALWAYS use the most recently created entity of that type
16
+ - Entity IDs look like "0.0.XXXXXX" and are stored in memory after creation
17
+ - NEVER use example or placeholder IDs like "0.0.123456" - always use actual created entity IDs
18
+ - Account ID ${accountId} is NOT a token - tokens and accounts are different entities
19
+
20
+ Remember the connection numbers when listing connections, as users might refer to them.`;
5
21
  export {
6
- ERROR_MESSAGES
22
+ getSystemMessage
7
23
  };
8
24
  //# sourceMappingURL=index42.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index42.js","sources":["../../src/constants/messages.ts"],"sourcesContent":["/**\n * Common error messages and user feedback strings\n */\nexport const ERROR_MESSAGES = {\n TOO_MANY_REQUESTS: 'Too many requests. Please wait a moment and try again.',\n RATE_LIMITED: \"I'm receiving too many requests right now. Please wait a moment and try again.\",\n SYSTEM_ERROR: 'System error occurred',\n INVALID_INPUT: 'Invalid input provided',\n NETWORK_ERROR: 'Network error occurred',\n} as const;\n\n/**\n * Common success and status messages\n */\nexport const STATUS_MESSAGES = {\n OPERATION_SUCCESSFUL: 'Operation completed successfully',\n PROCESSING: 'Processing your request...',\n READY: 'Ready to process requests',\n INITIALIZING: 'Initializing...',\n} as const;"],"names":[],"mappings":"AAGO,MAAM,iBAAiB;AAAA,EAC5B,mBAAmB;AAAA,EACnB,cAAc;AAIhB;"}
1
+ {"version":3,"file":"index42.js","sources":["../../src/config/system-message.ts"],"sourcesContent":["export const getSystemMessage = (\n accountId?: string\n): string => `You are a helpful assistant managing Hashgraph Online HCS-10 connections, messages, HCS-2 registries, content inscription, and Hedera Hashgraph operations.\n\nYou have access to tools for:\n- HCS-10: registering agents, finding registered agents, initiating connections, listing active connections, sending messages over connections, and checking for new messages\n- HCS-2: creating registries, registering entries, updating entries, deleting entries, migrating registries, and querying registry contents\n- Inscription: inscribing content from URLs, files, or buffers, creating Hashinal NFTs, and retrieving inscriptions\n- Hedera Token Service (HTS): creating tokens, transferring tokens, airdropping tokens, and managing token operations\n\n\n*** IMPORTANT CONTEXT ***\nYou are currently operating as agent: ${accountId || 'unknown'} on the Hedera Hashgraph\nWhen users ask about \"my profile\", \"my account\", \"my connections\", etc., use this account ID: ${accountId || 'unknown'}\n\n*** CRITICAL ENTITY HANDLING RULES ***\n- When users refer to entities (tokens, topics, accounts) with pronouns like \"it\", \"that\", \"the token/topic\", etc., ALWAYS use the most recently created entity of that type\n- Entity IDs look like \"0.0.XXXXXX\" and are stored in memory after creation\n- NEVER use example or placeholder IDs like \"0.0.123456\" - always use actual created entity IDs\n- Account ID ${accountId} is NOT a token - tokens and accounts are different entities\n\n Remember the connection numbers when listing connections, as users might refer to them.`;\n"],"names":[],"mappings":"AAAO,MAAM,mBAAmB,CAC9B,cACW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAU2B,aAAa,SAAS;AAAA,gGACkC,aAAa,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAMvG,SAAS;AAAA;AAAA;"}
@@ -1,15 +1,30 @@
1
- import { EntityFormat } from "./index26.js";
2
- const ENTITY_PATTERNS = {
3
- TOPIC_REFERENCE: "the topic",
4
- TOKEN_REFERENCE: "the token"
1
+ const DEFAULT_CONTENT_REFERENCE_CONFIG = {
2
+ sizeThresholdBytes: 10 * 1024,
3
+ maxAgeMs: 60 * 60 * 1e3,
4
+ maxReferences: 100,
5
+ maxTotalStorageBytes: 100 * 1024 * 1024,
6
+ enableAutoCleanup: true,
7
+ cleanupIntervalMs: 5 * 60 * 1e3,
8
+ enablePersistence: false,
9
+ storageBackend: "memory",
10
+ cleanupPolicies: {
11
+ recent: { maxAgeMs: 30 * 60 * 1e3, priority: 1 },
12
+ userContent: { maxAgeMs: 2 * 60 * 60 * 1e3, priority: 2 },
13
+ agentGenerated: { maxAgeMs: 60 * 60 * 1e3, priority: 3 },
14
+ default: { maxAgeMs: 60 * 60 * 1e3, priority: 4 }
15
+ }
5
16
  };
6
- ({
7
- TOPIC: EntityFormat.TOPIC_ID,
8
- TOKEN: EntityFormat.TOKEN_ID,
9
- ACCOUNT: EntityFormat.ACCOUNT_ID,
10
- CONTRACT: EntityFormat.CONTRACT_ID
11
- });
17
+ class ContentReferenceError extends Error {
18
+ constructor(message, type, referenceId, suggestedActions) {
19
+ super(message);
20
+ this.type = type;
21
+ this.referenceId = referenceId;
22
+ this.suggestedActions = suggestedActions;
23
+ this.name = "ContentReferenceError";
24
+ }
25
+ }
12
26
  export {
13
- ENTITY_PATTERNS
27
+ ContentReferenceError,
28
+ DEFAULT_CONTENT_REFERENCE_CONFIG
14
29
  };
15
30
  //# sourceMappingURL=index43.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index43.js","sources":["../../src/constants/entity-references.ts"],"sourcesContent":["/**\n * Common entity reference patterns used across the application\n */\nexport const ENTITY_PATTERNS = {\n TOPIC_REFERENCE: 'the topic',\n TOKEN_REFERENCE: 'the token',\n ACCOUNT_REFERENCE: 'the account',\n TRANSACTION_REFERENCE: 'the transaction',\n CONTRACT_REFERENCE: 'the contract',\n} as const;\n\n/**\n * Entity type identifiers\n */\nimport { EntityFormat } from '../services/formatters/types';\n\nexport const ENTITY_TYPES = {\n TOPIC: EntityFormat.TOPIC_ID,\n TOKEN: EntityFormat.TOKEN_ID,\n ACCOUNT: EntityFormat.ACCOUNT_ID,\n TRANSACTION: 'transaction',\n CONTRACT: EntityFormat.CONTRACT_ID,\n} as const;\n"],"names":[],"mappings":";AAGO,MAAM,kBAAkB;AAAA,EAC7B,iBAAiB;AAAA,EACjB,iBAAiB;AAInB;AAAA,CAO4B;AAAA,EAC1B,OAAO,aAAa;AAAA,EACpB,OAAO,aAAa;AAAA,EACpB,SAAS,aAAa;AAAA,EAEtB,UAAU,aAAa;AACzB;"}
1
+ {"version":3,"file":"index43.js","sources":["../../src/types/content-reference.ts"],"sourcesContent":["/**\n * Content Reference System Types\n *\n * Shared interfaces for the Reference-Based Content System that handles\n * large content storage with unique reference IDs to optimize context window usage.\n */\n\n/**\n * Unique identifier for stored content references\n * Format: Cryptographically secure 32-byte identifier with base64url encoding\n */\nexport type ReferenceId = string;\n\n/**\n * Lifecycle state of a content reference\n */\nexport type ReferenceLifecycleState =\n | 'active'\n | 'expired'\n | 'cleanup_pending'\n | 'invalid';\n\n/**\n * Content types supported by the reference system\n */\nexport type ContentType =\n | 'text'\n | 'json'\n | 'html'\n | 'markdown'\n | 'binary'\n | 'unknown';\n\n/**\n * Sources that created the content reference\n */\nexport type ContentSource =\n | 'mcp_tool'\n | 'user_upload'\n | 'agent_generated'\n | 'system';\n\n/**\n * Metadata associated with stored content\n */\nexport interface ContentMetadata {\n /** Content type classification */\n contentType: ContentType;\n\n /** MIME type of the original content */\n mimeType?: string;\n\n /** Size in bytes of the stored content */\n sizeBytes: number;\n\n /** When the content was originally stored */\n createdAt: Date;\n\n /** Last time the content was accessed via reference resolution */\n lastAccessedAt: Date;\n\n /** Source that created this content reference */\n source: ContentSource;\n\n /** Name of the MCP tool that generated the content (if applicable) */\n mcpToolName?: string;\n\n /** Original filename or suggested name for the content */\n fileName?: string;\n\n /** Number of times this reference has been resolved */\n accessCount: number;\n\n /** Tags for categorization and cleanup policies */\n tags?: string[];\n\n /** Custom metadata from the source */\n customMetadata?: Record<string, unknown>;\n}\n\n/**\n * Core content reference object passed through agent context\n * Designed to be lightweight (<100 tokens) while providing enough\n * information for agent decision-making\n */\nexport interface ContentReference {\n /** Unique identifier for resolving the content */\n referenceId: ReferenceId;\n\n /** Current lifecycle state */\n state: ReferenceLifecycleState;\n\n /** Brief description or preview of the content (max 200 chars) */\n preview: string;\n\n /** Essential metadata for agent decision-making */\n metadata: Pick<\n ContentMetadata,\n 'contentType' | 'sizeBytes' | 'source' | 'fileName' | 'mimeType'\n >;\n\n /** When this reference was created */\n createdAt: Date;\n\n /** Special format indicator for reference IDs in content */\n readonly format: 'ref://{id}';\n}\n\n/**\n * Result of attempting to resolve a content reference\n */\nexport interface ReferenceResolutionResult {\n /** Whether the resolution was successful */\n success: boolean;\n\n /** The resolved content if successful */\n content?: Buffer;\n\n /** Complete metadata if successful */\n metadata?: ContentMetadata;\n\n /** Error message if resolution failed */\n error?: string;\n\n /** Specific error type for targeted error handling */\n errorType?:\n | 'not_found'\n | 'expired'\n | 'corrupted'\n | 'access_denied'\n | 'system_error';\n\n /** Suggested actions for recovery */\n suggestedActions?: string[];\n}\n\n/**\n * Configuration for content reference storage and lifecycle\n */\nexport interface ContentReferenceConfig {\n /** Size threshold above which content should be stored as references (default: 10KB) */\n sizeThresholdBytes: number;\n\n /** Maximum age for unused references before cleanup (default: 1 hour) */\n maxAgeMs: number;\n\n /** Maximum number of references to store simultaneously */\n maxReferences: number;\n\n /** Maximum total storage size for all references */\n maxTotalStorageBytes: number;\n\n /** Whether to enable automatic cleanup */\n enableAutoCleanup: boolean;\n\n /** Interval for cleanup checks in milliseconds */\n cleanupIntervalMs: number;\n\n /** Whether to persist references across restarts */\n enablePersistence: boolean;\n\n /** Storage backend configuration */\n storageBackend: 'memory' | 'filesystem' | 'hybrid';\n\n /** Cleanup policies for different content types */\n cleanupPolicies: {\n /** Policy for content marked as \"recent\" from MCP tools */\n recent: { maxAgeMs: number; priority: number };\n\n /** Policy for user-uploaded content */\n userContent: { maxAgeMs: number; priority: number };\n\n /** Policy for agent-generated content */\n agentGenerated: { maxAgeMs: number; priority: number };\n\n /** Default policy for other content */\n default: { maxAgeMs: number; priority: number };\n };\n}\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONTENT_REFERENCE_CONFIG: ContentReferenceConfig = {\n sizeThresholdBytes: 10 * 1024,\n maxAgeMs: 60 * 60 * 1000,\n maxReferences: 100,\n maxTotalStorageBytes: 100 * 1024 * 1024,\n enableAutoCleanup: true,\n cleanupIntervalMs: 5 * 60 * 1000,\n enablePersistence: false,\n storageBackend: 'memory',\n cleanupPolicies: {\n recent: { maxAgeMs: 30 * 60 * 1000, priority: 1 },\n userContent: { maxAgeMs: 2 * 60 * 60 * 1000, priority: 2 },\n agentGenerated: { maxAgeMs: 60 * 60 * 1000, priority: 3 },\n default: { maxAgeMs: 60 * 60 * 1000, priority: 4 },\n },\n};\n\n/**\n * Statistics about content reference usage and storage\n */\nexport interface ContentReferenceStats {\n /** Total number of active references */\n activeReferences: number;\n\n /** Total storage used by all references in bytes */\n totalStorageBytes: number;\n\n /** Number of references cleaned up in last cleanup cycle */\n recentlyCleanedUp: number;\n\n /** Number of successful reference resolutions since startup */\n totalResolutions: number;\n\n /** Number of failed resolution attempts */\n failedResolutions: number;\n\n /** Average content size in bytes */\n averageContentSize: number;\n\n /** Most frequently accessed reference ID */\n mostAccessedReferenceId?: ReferenceId;\n\n /** Storage utilization percentage */\n storageUtilization: number;\n\n /** Performance metrics */\n performanceMetrics: {\n /** Average time to create a reference in milliseconds */\n averageCreationTimeMs: number;\n\n /** Average time to resolve a reference in milliseconds */\n averageResolutionTimeMs: number;\n\n /** Average cleanup time in milliseconds */\n averageCleanupTimeMs: number;\n };\n}\n\n/**\n * Error types for content reference operations\n */\nexport class ContentReferenceError extends Error {\n constructor(\n message: string,\n public readonly type: ReferenceResolutionResult['errorType'],\n public readonly referenceId?: ReferenceId,\n public readonly suggestedActions?: string[]\n ) {\n super(message);\n this.name = 'ContentReferenceError';\n }\n}\n\n/**\n * Interface for content reference storage implementations\n */\nexport interface ContentReferenceStore {\n /**\n * Store content and return a reference\n */\n storeContent(\n content: Buffer,\n metadata: Omit<\n ContentMetadata,\n 'createdAt' | 'lastAccessedAt' | 'accessCount'\n >\n ): Promise<ContentReference>;\n\n /**\n * Resolve a reference to its content\n */\n resolveReference(\n referenceId: ReferenceId\n ): Promise<ReferenceResolutionResult>;\n\n /**\n * Check if a reference exists and is valid\n */\n hasReference(referenceId: ReferenceId): Promise<boolean>;\n\n /**\n * Mark a reference for cleanup\n */\n cleanupReference(referenceId: ReferenceId): Promise<boolean>;\n\n /**\n * Get current storage statistics\n */\n getStats(): Promise<ContentReferenceStats>;\n\n /**\n * Update configuration\n */\n updateConfig(config: Partial<ContentReferenceConfig>): Promise<void>;\n\n /**\n * Perform cleanup based on current policies\n */\n performCleanup(): Promise<{ cleanedUp: number; errors: string[] }>;\n\n /**\n * Dispose of resources\n */\n dispose(): Promise<void>;\n}\n"],"names":[],"mappings":"AAuLO,MAAM,mCAA2D;AAAA,EACtE,oBAAoB,KAAK;AAAA,EACzB,UAAU,KAAK,KAAK;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB,MAAM,OAAO;AAAA,EACnC,mBAAmB;AAAA,EACnB,mBAAmB,IAAI,KAAK;AAAA,EAC5B,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,IACf,QAAQ,EAAE,UAAU,KAAK,KAAK,KAAM,UAAU,EAAA;AAAA,IAC9C,aAAa,EAAE,UAAU,IAAI,KAAK,KAAK,KAAM,UAAU,EAAA;AAAA,IACvD,gBAAgB,EAAE,UAAU,KAAK,KAAK,KAAM,UAAU,EAAA;AAAA,IACtD,SAAS,EAAE,UAAU,KAAK,KAAK,KAAM,UAAU,EAAA;AAAA,EAAE;AAErD;AA8CO,MAAM,8BAA8B,MAAM;AAAA,EAC/C,YACE,SACgB,MACA,aACA,kBAChB;AACA,UAAM,OAAO;AAJG,SAAA,OAAA;AACA,SAAA,cAAA;AACA,SAAA,mBAAA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;"}