@hashgraphonline/standards-agent-kit 0.0.18 → 0.0.19

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 (430) hide show
  1. package/README.md +83 -0
  2. package/dist/_virtual/_commonjsHelpers.js +7 -0
  3. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  4. package/dist/_virtual/index.js +8 -0
  5. package/dist/_virtual/index.js.map +1 -0
  6. package/dist/_virtual/index10.js +5 -0
  7. package/dist/_virtual/index10.js.map +1 -0
  8. package/dist/_virtual/index11.js +5 -0
  9. package/dist/_virtual/index11.js.map +1 -0
  10. package/dist/_virtual/index12.js +8 -0
  11. package/dist/_virtual/index12.js.map +1 -0
  12. package/dist/_virtual/index13.js +5 -0
  13. package/dist/_virtual/index13.js.map +1 -0
  14. package/dist/_virtual/index14.js +5 -0
  15. package/dist/_virtual/index14.js.map +1 -0
  16. package/dist/_virtual/index2.js +3 -0
  17. package/dist/_virtual/index2.js.map +1 -0
  18. package/dist/_virtual/index3.js +8 -0
  19. package/dist/_virtual/index3.js.map +1 -0
  20. package/dist/_virtual/index4.js +8 -0
  21. package/dist/_virtual/index4.js.map +1 -0
  22. package/dist/_virtual/index5.js +6 -0
  23. package/dist/_virtual/index5.js.map +1 -0
  24. package/dist/_virtual/index6.js +8 -0
  25. package/dist/_virtual/index6.js.map +1 -0
  26. package/dist/_virtual/index7.js +5 -0
  27. package/dist/_virtual/index7.js.map +1 -0
  28. package/dist/_virtual/index8.js +5 -0
  29. package/dist/_virtual/index8.js.map +1 -0
  30. package/dist/_virtual/index9.js +5 -0
  31. package/dist/_virtual/index9.js.map +1 -0
  32. package/dist/_virtual/lower-bound.js +5 -0
  33. package/dist/_virtual/lower-bound.js.map +1 -0
  34. package/dist/_virtual/priority-queue.js +5 -0
  35. package/dist/_virtual/priority-queue.js.map +1 -0
  36. package/dist/_virtual/re.js +5 -0
  37. package/dist/_virtual/re.js.map +1 -0
  38. package/dist/_virtual/retry.js +5 -0
  39. package/dist/_virtual/retry.js.map +1 -0
  40. package/dist/agents/index.d.ts +0 -0
  41. package/dist/hcs10/HCS10Client.d.ts +117 -0
  42. package/dist/hcs10/HCS10Client.js +251 -0
  43. package/dist/hcs10/HCS10Client.js.map +1 -0
  44. package/dist/hcs10/index.d.ts +1 -0
  45. package/dist/hcs10/types.d.ts +35 -0
  46. package/dist/index.d.ts +5 -2
  47. package/dist/index.es.js +9747 -11699
  48. package/dist/index.es.js.map +1 -1
  49. package/dist/index.js +44 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/init.d.ts +59 -0
  52. package/dist/init.js +92 -0
  53. package/dist/init.js.map +1 -0
  54. package/dist/node_modules/@langchain/core/dist/callbacks/base.js +98 -0
  55. package/dist/node_modules/@langchain/core/dist/callbacks/base.js.map +1 -0
  56. package/dist/node_modules/@langchain/core/dist/callbacks/manager.js +419 -0
  57. package/dist/node_modules/@langchain/core/dist/callbacks/manager.js.map +1 -0
  58. package/dist/node_modules/@langchain/core/dist/callbacks/promises.js +16 -0
  59. package/dist/node_modules/@langchain/core/dist/callbacks/promises.js.map +1 -0
  60. package/dist/node_modules/@langchain/core/dist/language_models/base.js +42 -0
  61. package/dist/node_modules/@langchain/core/dist/language_models/base.js.map +1 -0
  62. package/dist/node_modules/@langchain/core/dist/load/map_keys.js +16 -0
  63. package/dist/node_modules/@langchain/core/dist/load/map_keys.js.map +1 -0
  64. package/dist/node_modules/@langchain/core/dist/load/serializable.js +121 -0
  65. package/dist/node_modules/@langchain/core/dist/load/serializable.js.map +1 -0
  66. package/dist/node_modules/@langchain/core/dist/messages/ai.js +95 -0
  67. package/dist/node_modules/@langchain/core/dist/messages/ai.js.map +1 -0
  68. package/dist/node_modules/@langchain/core/dist/messages/base.js +112 -0
  69. package/dist/node_modules/@langchain/core/dist/messages/base.js.map +1 -0
  70. package/dist/node_modules/@langchain/core/dist/messages/utils.js +30 -0
  71. package/dist/node_modules/@langchain/core/dist/messages/utils.js.map +1 -0
  72. package/dist/node_modules/@langchain/core/dist/runnables/base.js +1277 -0
  73. package/dist/node_modules/@langchain/core/dist/runnables/base.js.map +1 -0
  74. package/dist/node_modules/@langchain/core/dist/runnables/config.js +83 -0
  75. package/dist/node_modules/@langchain/core/dist/runnables/config.js.map +1 -0
  76. package/dist/node_modules/@langchain/core/dist/runnables/graph.js +106 -0
  77. package/dist/node_modules/@langchain/core/dist/runnables/graph.js.map +1 -0
  78. package/dist/node_modules/@langchain/core/dist/runnables/iter.js +33 -0
  79. package/dist/node_modules/@langchain/core/dist/runnables/iter.js.map +1 -0
  80. package/dist/node_modules/@langchain/core/dist/runnables/utils.js +54 -0
  81. package/dist/node_modules/@langchain/core/dist/runnables/utils.js.map +1 -0
  82. package/dist/node_modules/@langchain/core/dist/runnables/wrappers.js +20 -0
  83. package/dist/node_modules/@langchain/core/dist/runnables/wrappers.js.map +1 -0
  84. package/dist/node_modules/@langchain/core/dist/singletons/index.js +34 -0
  85. package/dist/node_modules/@langchain/core/dist/singletons/index.js.map +1 -0
  86. package/dist/node_modules/@langchain/core/dist/tools.js +69 -0
  87. package/dist/node_modules/@langchain/core/dist/tools.js.map +1 -0
  88. package/dist/node_modules/@langchain/core/dist/tracers/base.js +299 -0
  89. package/dist/node_modules/@langchain/core/dist/tracers/base.js.map +1 -0
  90. package/dist/node_modules/@langchain/core/dist/tracers/console.js +193 -0
  91. package/dist/node_modules/@langchain/core/dist/tracers/console.js.map +1 -0
  92. package/dist/node_modules/@langchain/core/dist/tracers/initialize.js +10 -0
  93. package/dist/node_modules/@langchain/core/dist/tracers/initialize.js.map +1 -0
  94. package/dist/node_modules/@langchain/core/dist/tracers/log_stream.js +284 -0
  95. package/dist/node_modules/@langchain/core/dist/tracers/log_stream.js.map +1 -0
  96. package/dist/node_modules/@langchain/core/dist/tracers/root_listener.js +54 -0
  97. package/dist/node_modules/@langchain/core/dist/tracers/root_listener.js.map +1 -0
  98. package/dist/node_modules/@langchain/core/dist/tracers/tracer_langchain.js +68 -0
  99. package/dist/node_modules/@langchain/core/dist/tracers/tracer_langchain.js.map +1 -0
  100. package/dist/node_modules/@langchain/core/dist/utils/async_caller.js +86 -0
  101. package/dist/node_modules/@langchain/core/dist/utils/async_caller.js.map +1 -0
  102. package/dist/node_modules/@langchain/core/dist/utils/env.js +33 -0
  103. package/dist/node_modules/@langchain/core/dist/utils/env.js.map +1 -0
  104. package/dist/node_modules/@langchain/core/dist/utils/fast-json-patch/core.js +218 -0
  105. package/dist/node_modules/@langchain/core/dist/utils/fast-json-patch/core.js.map +1 -0
  106. package/dist/node_modules/@langchain/core/dist/utils/fast-json-patch/helpers.js +117 -0
  107. package/dist/node_modules/@langchain/core/dist/utils/fast-json-patch/helpers.js.map +1 -0
  108. package/dist/node_modules/@langchain/core/dist/utils/json.js +40 -0
  109. package/dist/node_modules/@langchain/core/dist/utils/json.js.map +1 -0
  110. package/dist/node_modules/@langchain/core/dist/utils/stream.js +164 -0
  111. package/dist/node_modules/@langchain/core/dist/utils/stream.js.map +1 -0
  112. package/dist/node_modules/@langchain/core/node_modules/ansi-styles/index.js +111 -0
  113. package/dist/node_modules/@langchain/core/node_modules/ansi-styles/index.js.map +1 -0
  114. package/dist/node_modules/@langchain/core/node_modules/camelcase/index.js +30 -0
  115. package/dist/node_modules/@langchain/core/node_modules/camelcase/index.js.map +1 -0
  116. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/client.js +2002 -0
  117. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/client.js.map +1 -0
  118. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/index.js +8 -0
  119. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/index.js.map +1 -0
  120. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/fetch.js +5 -0
  121. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/fetch.js.map +1 -0
  122. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/_uuid.js +12 -0
  123. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/_uuid.js.map +1 -0
  124. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/async_caller.js +94 -0
  125. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/async_caller.js.map +1 -0
  126. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/env.js +96 -0
  127. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/env.js.map +1 -0
  128. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/error.js +20 -0
  129. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/error.js.map +1 -0
  130. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js +82 -0
  131. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js.map +1 -0
  132. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/messages.js +15 -0
  133. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/messages.js.map +1 -0
  134. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/prompts.js +27 -0
  135. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/prompts.js.map +1 -0
  136. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/warn.js +8 -0
  137. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/warn.js.map +1 -0
  138. package/dist/node_modules/@langchain/core/node_modules/langsmith/node_modules/uuid/dist/esm-browser/native.js +8 -0
  139. package/dist/node_modules/@langchain/core/node_modules/langsmith/node_modules/uuid/dist/esm-browser/native.js.map +1 -0
  140. package/dist/node_modules/@langchain/core/node_modules/langsmith/node_modules/uuid/dist/esm-browser/regex.js +5 -0
  141. package/dist/node_modules/@langchain/core/node_modules/langsmith/node_modules/uuid/dist/esm-browser/regex.js.map +1 -0
  142. package/dist/node_modules/@langchain/core/node_modules/langsmith/node_modules/uuid/dist/esm-browser/rng.js +10 -0
  143. package/dist/node_modules/@langchain/core/node_modules/langsmith/node_modules/uuid/dist/esm-browser/rng.js.map +1 -0
  144. package/dist/node_modules/@langchain/core/node_modules/langsmith/node_modules/uuid/dist/esm-browser/stringify.js +10 -0
  145. package/dist/node_modules/@langchain/core/node_modules/langsmith/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -0
  146. package/dist/node_modules/@langchain/core/node_modules/langsmith/node_modules/uuid/dist/esm-browser/v4.js +14 -0
  147. package/dist/node_modules/@langchain/core/node_modules/langsmith/node_modules/uuid/dist/esm-browser/v4.js.map +1 -0
  148. package/dist/node_modules/@langchain/core/node_modules/langsmith/node_modules/uuid/dist/esm-browser/validate.js +8 -0
  149. package/dist/node_modules/@langchain/core/node_modules/langsmith/node_modules/uuid/dist/esm-browser/validate.js.map +1 -0
  150. package/dist/node_modules/@langchain/core/node_modules/uuid/dist/esm-browser/native.js +7 -0
  151. package/dist/node_modules/@langchain/core/node_modules/uuid/dist/esm-browser/native.js.map +1 -0
  152. package/dist/node_modules/@langchain/core/node_modules/uuid/dist/esm-browser/regex.js +5 -0
  153. package/dist/node_modules/@langchain/core/node_modules/uuid/dist/esm-browser/regex.js.map +1 -0
  154. package/dist/node_modules/@langchain/core/node_modules/uuid/dist/esm-browser/rng.js +11 -0
  155. package/dist/node_modules/@langchain/core/node_modules/uuid/dist/esm-browser/rng.js.map +1 -0
  156. package/dist/node_modules/@langchain/core/node_modules/uuid/dist/esm-browser/stringify.js +10 -0
  157. package/dist/node_modules/@langchain/core/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -0
  158. package/dist/node_modules/@langchain/core/node_modules/uuid/dist/esm-browser/v4.js +14 -0
  159. package/dist/node_modules/@langchain/core/node_modules/uuid/dist/esm-browser/v4.js.map +1 -0
  160. package/dist/node_modules/@langchain/core/node_modules/uuid/dist/esm-browser/validate.js +8 -0
  161. package/dist/node_modules/@langchain/core/node_modules/uuid/dist/esm-browser/validate.js.map +1 -0
  162. package/dist/node_modules/base64-js/index.js +53 -0
  163. package/dist/node_modules/base64-js/index.js.map +1 -0
  164. package/dist/node_modules/decamelize/index.js +12 -0
  165. package/dist/node_modules/decamelize/index.js.map +1 -0
  166. package/dist/node_modules/eventemitter3/index.js +112 -0
  167. package/dist/node_modules/eventemitter3/index.js.map +1 -0
  168. package/dist/node_modules/js-tiktoken/dist/chunk-Z5MDQTGX.js +117 -0
  169. package/dist/node_modules/js-tiktoken/dist/chunk-Z5MDQTGX.js.map +1 -0
  170. package/dist/node_modules/p-finally/index.js +18 -0
  171. package/dist/node_modules/p-finally/index.js.map +1 -0
  172. package/dist/node_modules/p-queue/dist/index.js +198 -0
  173. package/dist/node_modules/p-queue/dist/index.js.map +1 -0
  174. package/dist/node_modules/p-queue/dist/lower-bound.js +20 -0
  175. package/dist/node_modules/p-queue/dist/lower-bound.js.map +1 -0
  176. package/dist/node_modules/p-queue/dist/priority-queue.js +41 -0
  177. package/dist/node_modules/p-queue/dist/priority-queue.js.map +1 -0
  178. package/dist/node_modules/p-retry/index.js +63 -0
  179. package/dist/node_modules/p-retry/index.js.map +1 -0
  180. package/dist/node_modules/p-timeout/index.js +45 -0
  181. package/dist/node_modules/p-timeout/index.js.map +1 -0
  182. package/dist/node_modules/retry/index.js +9 -0
  183. package/dist/node_modules/retry/index.js.map +1 -0
  184. package/dist/node_modules/retry/lib/retry.js +59 -0
  185. package/dist/node_modules/retry/lib/retry.js.map +1 -0
  186. package/dist/node_modules/retry/lib/retry_operation.js +58 -0
  187. package/dist/node_modules/retry/lib/retry_operation.js.map +1 -0
  188. package/dist/node_modules/semver/classes/comparator.js +57 -0
  189. package/dist/node_modules/semver/classes/comparator.js.map +1 -0
  190. package/dist/node_modules/semver/classes/range.js +149 -0
  191. package/dist/node_modules/semver/classes/range.js.map +1 -0
  192. package/dist/node_modules/semver/classes/semver.js +170 -0
  193. package/dist/node_modules/semver/classes/semver.js.map +1 -0
  194. package/dist/node_modules/semver/functions/clean.js +15 -0
  195. package/dist/node_modules/semver/functions/clean.js.map +1 -0
  196. package/dist/node_modules/semver/functions/cmp.js +40 -0
  197. package/dist/node_modules/semver/functions/cmp.js.map +1 -0
  198. package/dist/node_modules/semver/functions/coerce.js +34 -0
  199. package/dist/node_modules/semver/functions/coerce.js.map +1 -0
  200. package/dist/node_modules/semver/functions/compare-build.js +15 -0
  201. package/dist/node_modules/semver/functions/compare-build.js.map +1 -0
  202. package/dist/node_modules/semver/functions/compare-loose.js +12 -0
  203. package/dist/node_modules/semver/functions/compare-loose.js.map +1 -0
  204. package/dist/node_modules/semver/functions/compare.js +12 -0
  205. package/dist/node_modules/semver/functions/compare.js.map +1 -0
  206. package/dist/node_modules/semver/functions/diff.js +25 -0
  207. package/dist/node_modules/semver/functions/diff.js.map +1 -0
  208. package/dist/node_modules/semver/functions/eq.js +12 -0
  209. package/dist/node_modules/semver/functions/eq.js.map +1 -0
  210. package/dist/node_modules/semver/functions/gt.js +12 -0
  211. package/dist/node_modules/semver/functions/gt.js.map +1 -0
  212. package/dist/node_modules/semver/functions/gte.js +12 -0
  213. package/dist/node_modules/semver/functions/gte.js.map +1 -0
  214. package/dist/node_modules/semver/functions/inc.js +22 -0
  215. package/dist/node_modules/semver/functions/inc.js.map +1 -0
  216. package/dist/node_modules/semver/functions/lt.js +12 -0
  217. package/dist/node_modules/semver/functions/lt.js.map +1 -0
  218. package/dist/node_modules/semver/functions/lte.js +12 -0
  219. package/dist/node_modules/semver/functions/lte.js.map +1 -0
  220. package/dist/node_modules/semver/functions/major.js +12 -0
  221. package/dist/node_modules/semver/functions/major.js.map +1 -0
  222. package/dist/node_modules/semver/functions/minor.js +12 -0
  223. package/dist/node_modules/semver/functions/minor.js.map +1 -0
  224. package/dist/node_modules/semver/functions/neq.js +12 -0
  225. package/dist/node_modules/semver/functions/neq.js.map +1 -0
  226. package/dist/node_modules/semver/functions/parse.js +22 -0
  227. package/dist/node_modules/semver/functions/parse.js.map +1 -0
  228. package/dist/node_modules/semver/functions/patch.js +12 -0
  229. package/dist/node_modules/semver/functions/patch.js.map +1 -0
  230. package/dist/node_modules/semver/functions/prerelease.js +15 -0
  231. package/dist/node_modules/semver/functions/prerelease.js.map +1 -0
  232. package/dist/node_modules/semver/functions/rcompare.js +12 -0
  233. package/dist/node_modules/semver/functions/rcompare.js.map +1 -0
  234. package/dist/node_modules/semver/functions/rsort.js +12 -0
  235. package/dist/node_modules/semver/functions/rsort.js.map +1 -0
  236. package/dist/node_modules/semver/functions/satisfies.js +19 -0
  237. package/dist/node_modules/semver/functions/satisfies.js.map +1 -0
  238. package/dist/node_modules/semver/functions/sort.js +12 -0
  239. package/dist/node_modules/semver/functions/sort.js.map +1 -0
  240. package/dist/node_modules/semver/functions/valid.js +15 -0
  241. package/dist/node_modules/semver/functions/valid.js.map +1 -0
  242. package/dist/node_modules/semver/index.js +98 -0
  243. package/dist/node_modules/semver/index.js.map +1 -0
  244. package/dist/node_modules/semver/internal/constants.js +29 -0
  245. package/dist/node_modules/semver/internal/constants.js.map +1 -0
  246. package/dist/node_modules/semver/internal/debug.js +9 -0
  247. package/dist/node_modules/semver/internal/debug.js.map +1 -0
  248. package/dist/node_modules/semver/internal/identifiers.js +17 -0
  249. package/dist/node_modules/semver/internal/identifiers.js.map +1 -0
  250. package/dist/node_modules/semver/internal/lrucache.js +33 -0
  251. package/dist/node_modules/semver/internal/lrucache.js.map +1 -0
  252. package/dist/node_modules/semver/internal/parse-options.js +11 -0
  253. package/dist/node_modules/semver/internal/parse-options.js.map +1 -0
  254. package/dist/node_modules/semver/internal/re.js +33 -0
  255. package/dist/node_modules/semver/internal/re.js.map +1 -0
  256. package/dist/node_modules/semver/ranges/gtr.js +12 -0
  257. package/dist/node_modules/semver/ranges/gtr.js.map +1 -0
  258. package/dist/node_modules/semver/ranges/intersects.js +12 -0
  259. package/dist/node_modules/semver/ranges/intersects.js.map +1 -0
  260. package/dist/node_modules/semver/ranges/ltr.js +12 -0
  261. package/dist/node_modules/semver/ranges/ltr.js.map +1 -0
  262. package/dist/node_modules/semver/ranges/max-satisfying.js +23 -0
  263. package/dist/node_modules/semver/ranges/max-satisfying.js.map +1 -0
  264. package/dist/node_modules/semver/ranges/min-satisfying.js +23 -0
  265. package/dist/node_modules/semver/ranges/min-satisfying.js.map +1 -0
  266. package/dist/node_modules/semver/ranges/min-version.js +43 -0
  267. package/dist/node_modules/semver/ranges/min-version.js.map +1 -0
  268. package/dist/node_modules/semver/ranges/outside.js +45 -0
  269. package/dist/node_modules/semver/ranges/outside.js.map +1 -0
  270. package/dist/node_modules/semver/ranges/simplify.js +25 -0
  271. package/dist/node_modules/semver/ranges/simplify.js.map +1 -0
  272. package/dist/node_modules/semver/ranges/subset.js +95 -0
  273. package/dist/node_modules/semver/ranges/subset.js.map +1 -0
  274. package/dist/node_modules/semver/ranges/to-comparators.js +12 -0
  275. package/dist/node_modules/semver/ranges/to-comparators.js.map +1 -0
  276. package/dist/node_modules/semver/ranges/valid.js +18 -0
  277. package/dist/node_modules/semver/ranges/valid.js.map +1 -0
  278. package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js +32 -0
  279. package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js.map +1 -0
  280. package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js +22 -0
  281. package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js.map +1 -0
  282. package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +14 -0
  283. package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js.map +1 -0
  284. package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js +44 -0
  285. package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js.map +1 -0
  286. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +7 -0
  287. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js.map +1 -0
  288. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +17 -0
  289. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js.map +1 -0
  290. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +26 -0
  291. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js.map +1 -0
  292. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +9 -0
  293. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js.map +1 -0
  294. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +8 -0
  295. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js.map +1 -0
  296. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +6 -0
  297. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js.map +1 -0
  298. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +59 -0
  299. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js.map +1 -0
  300. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +11 -0
  301. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js.map +1 -0
  302. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +8 -0
  303. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js.map +1 -0
  304. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +10 -0
  305. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js.map +1 -0
  306. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +36 -0
  307. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js.map +1 -0
  308. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +16 -0
  309. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js.map +1 -0
  310. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +27 -0
  311. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js.map +1 -0
  312. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +11 -0
  313. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js.map +1 -0
  314. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +9 -0
  315. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js.map +1 -0
  316. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +12 -0
  317. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js.map +1 -0
  318. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +30 -0
  319. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js.map +1 -0
  320. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +28 -0
  321. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js.map +1 -0
  322. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +50 -0
  323. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js.map +1 -0
  324. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +22 -0
  325. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js.map +1 -0
  326. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +21 -0
  327. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js.map +1 -0
  328. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +8 -0
  329. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js.map +1 -0
  330. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +6 -0
  331. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js.map +1 -0
  332. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +56 -0
  333. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js.map +1 -0
  334. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +17 -0
  335. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js.map +1 -0
  336. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +245 -0
  337. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
  338. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +27 -0
  339. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js.map +1 -0
  340. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +9 -0
  341. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js.map +1 -0
  342. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +69 -0
  343. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js.map +1 -0
  344. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +7 -0
  345. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js.map +1 -0
  346. package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js +110 -0
  347. package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js.map +1 -0
  348. package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +26 -0
  349. package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js.map +1 -0
  350. package/dist/plugins/BasePlugin.d.ts +28 -0
  351. package/dist/plugins/BasePlugin.js +19 -0
  352. package/dist/plugins/BasePlugin.js.map +1 -0
  353. package/dist/plugins/PluginInterface.d.ts +64 -0
  354. package/dist/plugins/PluginLoader.d.ts +38 -0
  355. package/dist/plugins/PluginLoader.js +60 -0
  356. package/dist/plugins/PluginLoader.js.map +1 -0
  357. package/dist/plugins/PluginRegistry.d.ts +47 -0
  358. package/dist/plugins/PluginRegistry.js +71 -0
  359. package/dist/plugins/PluginRegistry.js.map +1 -0
  360. package/dist/plugins/__tests__/BasePlugin.test.d.ts +1 -0
  361. package/dist/plugins/__tests__/PluginLoader.test.d.ts +1 -0
  362. package/dist/plugins/__tests__/PluginRegistry.test.d.ts +1 -0
  363. package/dist/plugins/defi/index.d.ts +13 -0
  364. package/dist/plugins/hedera/HbarPricePlugin.d.ts +45 -0
  365. package/dist/plugins/hedera/HbarPricePlugin.js +70 -0
  366. package/dist/plugins/hedera/HbarPricePlugin.js.map +1 -0
  367. package/dist/plugins/hedera/__tests__/HbarPricePlugin.test.d.ts +1 -0
  368. package/dist/plugins/index.d.ts +5 -0
  369. package/dist/plugins/weather/index.d.ts +15 -0
  370. package/dist/src/agents/index.d.ts +0 -0
  371. package/dist/src/plugins/hedera/HbarPricePlugin.d.ts +45 -0
  372. package/dist/src/plugins/index.d.ts +1 -0
  373. package/dist/src/tools/CheckMessagesTool.d.ts +9 -2
  374. package/dist/src/utils/state-tools.d.ts +23 -0
  375. package/dist/state/index.d.ts +2 -0
  376. package/dist/state/open-convai-state.d.ts +84 -0
  377. package/dist/state/open-convai-state.js +132 -0
  378. package/dist/state/open-convai-state.js.map +1 -0
  379. package/dist/state/state-types.d.ts +143 -0
  380. package/dist/tools/AcceptConnectionRequestTool.d.ts +33 -0
  381. package/dist/tools/AcceptConnectionRequestTool.js +116 -0
  382. package/dist/tools/AcceptConnectionRequestTool.js.map +1 -0
  383. package/dist/tools/CheckMessagesTool.d.ts +34 -0
  384. package/dist/tools/CheckMessagesTool.js +96 -0
  385. package/dist/tools/CheckMessagesTool.js.map +1 -0
  386. package/dist/tools/ConnectionMonitorTool.d.ts +96 -0
  387. package/dist/tools/ConnectionMonitorTool.js +289 -0
  388. package/dist/tools/ConnectionMonitorTool.js.map +1 -0
  389. package/dist/tools/ConnectionTool.d.ts +40 -0
  390. package/dist/tools/ConnectionTool.js +114 -0
  391. package/dist/tools/ConnectionTool.js.map +1 -0
  392. package/dist/tools/FindRegistrationsTool.d.ts +27 -0
  393. package/dist/tools/FindRegistrationsTool.js +64 -0
  394. package/dist/tools/FindRegistrationsTool.js.map +1 -0
  395. package/dist/tools/InitiateConnectionTool.d.ts +30 -0
  396. package/dist/tools/InitiateConnectionTool.js +79 -0
  397. package/dist/tools/InitiateConnectionTool.js.map +1 -0
  398. package/dist/tools/ListConnectionsTool.d.ts +33 -0
  399. package/dist/tools/ListConnectionsTool.js +327 -0
  400. package/dist/tools/ListConnectionsTool.js.map +1 -0
  401. package/dist/tools/ListUnapprovedConnectionRequestsTool.d.ts +53 -0
  402. package/dist/tools/ListUnapprovedConnectionRequestsTool.js +177 -0
  403. package/dist/tools/ListUnapprovedConnectionRequestsTool.js.map +1 -0
  404. package/dist/tools/ManageConnectionRequestsTool.d.ts +39 -0
  405. package/dist/tools/ManageConnectionRequestsTool.js +161 -0
  406. package/dist/tools/ManageConnectionRequestsTool.js.map +1 -0
  407. package/dist/tools/RegisterAgentTool.d.ts +188 -0
  408. package/dist/tools/RegisterAgentTool.js +331 -0
  409. package/dist/tools/RegisterAgentTool.js.map +1 -0
  410. package/dist/tools/RetrieveProfileTool.d.ts +34 -0
  411. package/dist/tools/RetrieveProfileTool.js +53 -0
  412. package/dist/tools/RetrieveProfileTool.js.map +1 -0
  413. package/dist/tools/SendMessageToConnectionTool.d.ts +31 -0
  414. package/dist/tools/SendMessageToConnectionTool.js +74 -0
  415. package/dist/tools/SendMessageToConnectionTool.js.map +1 -0
  416. package/dist/tools/SendMessageTool.d.ts +44 -0
  417. package/dist/tools/SendMessageTool.js +75 -0
  418. package/dist/tools/SendMessageTool.js.map +1 -0
  419. package/dist/tools/index.d.ts +13 -0
  420. package/dist/utils/Encryption.d.ts +7 -0
  421. package/dist/utils/Encryption.js +7 -0
  422. package/dist/utils/Encryption.js.map +1 -0
  423. package/dist/utils/HederaClient.d.ts +18 -0
  424. package/dist/utils/connectionUtils.d.ts +15 -0
  425. package/dist/utils/connectionUtils.js +64 -0
  426. package/dist/utils/connectionUtils.js.map +1 -0
  427. package/dist/utils/state-tools.d.ts +23 -0
  428. package/dist/utils/state-tools.js +90 -0
  429. package/dist/utils/state-tools.js.map +1 -0
  430. package/package.json +20 -10
@@ -0,0 +1,114 @@
1
+ import { StructuredTool as l } from "../node_modules/@langchain/core/dist/tools.js";
2
+ import { z as h } from "zod";
3
+ import { Logger as m } from "@hashgraphonline/standards-sdk";
4
+ class $ extends l {
5
+ /**
6
+ * @param client - Instance of HCS10Client.
7
+ * @param stateManager - Instance of StateManager for shared state management.
8
+ */
9
+ constructor({ client: t, stateManager: o, ...n }) {
10
+ super(n), this.name = "monitor_connections", this.description = "Starts passively LISTENING on the current agent's own inbound topic for INCOMING HCS-10 connection requests. Handles received requests automatically. Takes NO arguments. DO NOT use this to start a new connection TO someone else.", this.isMonitoring = !1, this.monitoringTopic = null, this.schema = h.object({}), this.client = t, this.stateManager = o, this.logger = m.getInstance({
11
+ module: "ConnectionTool",
12
+ level: "info"
13
+ });
14
+ }
15
+ /**
16
+ * Initiates the connection request monitoring process in the background.
17
+ * Gets the inbound topic ID from the configured client.
18
+ */
19
+ async _call(t) {
20
+ let o;
21
+ try {
22
+ o = await this.client.getInboundTopicId();
23
+ } catch (n) {
24
+ const i = `Error getting inbound topic ID for monitoring: ${n instanceof Error ? n.message : String(n)}`;
25
+ return this.logger.error(i), i;
26
+ }
27
+ return o ? this.isMonitoring ? this.monitoringTopic === o ? `Already monitoring topic ${o}.` : `Error: Already monitoring a different topic (${this.monitoringTopic}). Stop the current monitor first.` : (this.isMonitoring = !0, this.monitoringTopic = o, this.logger.info(
28
+ `Initiating connection request monitoring for topic ${o}...`
29
+ ), this.monitorIncomingRequests(o).catch((n) => {
30
+ this.logger.error(
31
+ `Monitoring loop for ${o} encountered an unrecoverable error:`,
32
+ n
33
+ ), this.isMonitoring = !1, this.monitoringTopic = null;
34
+ }), `Started monitoring inbound topic ${o} for connection requests in the background.`) : "Error: Could not determine the inbound topic ID for the current agent.";
35
+ }
36
+ /**
37
+ * The core monitoring loop.
38
+ */
39
+ async monitorIncomingRequests(t) {
40
+ this.logger.info(`Monitoring inbound topic ${t}...`);
41
+ let o = 0;
42
+ const n = /* @__PURE__ */ new Set();
43
+ for (; this.isMonitoring && this.monitoringTopic === t; ) {
44
+ try {
45
+ const a = (await this.client.getMessages(t)).messages.filter(
46
+ (r) => r.op === "connection_request" && typeof r.sequence_number == "number" && r.sequence_number > o
47
+ );
48
+ for (const r of a) {
49
+ o = Math.max(
50
+ o,
51
+ r.sequence_number
52
+ );
53
+ const e = r.sequence_number, g = r.operator_id || "", s = g.split("@")[1] || null;
54
+ if (!s) {
55
+ this.logger.warn(
56
+ `Could not determine requesting account ID from operator_id '${g}' for request #${e}. Skipping.`
57
+ );
58
+ continue;
59
+ }
60
+ if (n.has(e)) {
61
+ this.logger.info(
62
+ `Connection request #${e} already processed in this session. Skipping.`
63
+ );
64
+ continue;
65
+ }
66
+ this.logger.info(
67
+ `Processing connection request #${e} from account ${s}...`
68
+ );
69
+ try {
70
+ const c = await this.client.handleConnectionRequest(
71
+ t,
72
+ s,
73
+ e
74
+ );
75
+ n.add(e), this.logger.info(
76
+ `Connection confirmed for request #${e}. New connection topic: ${c.connectionTopicId}`
77
+ );
78
+ const u = {
79
+ targetAccountId: s,
80
+ targetAgentName: `Agent ${s}`,
81
+ targetInboundTopicId: "N/A",
82
+ connectionTopicId: c.connectionTopicId
83
+ };
84
+ this.stateManager.addActiveConnection(u), this.logger.info(
85
+ `Added new active connection to ${s} state.`
86
+ );
87
+ } catch (c) {
88
+ this.logger.error(
89
+ `Error handling connection request #${e} from ${s}:`,
90
+ c
91
+ );
92
+ }
93
+ }
94
+ } catch (i) {
95
+ this.logger.error(
96
+ `Error fetching or processing messages for topic ${t}:`,
97
+ i
98
+ );
99
+ }
100
+ await new Promise((i) => setTimeout(i, 5e3));
101
+ }
102
+ this.logger.info(`Monitoring loop stopped for topic ${t}.`), this.isMonitoring = !1, this.monitoringTopic = null;
103
+ }
104
+ // Optional: Method to explicitly stop monitoring
105
+ stopMonitoring() {
106
+ this.isMonitoring ? (this.logger.info(
107
+ `Stopping monitoring for topic ${this.monitoringTopic}...`
108
+ ), this.isMonitoring = !1, this.monitoringTopic = null) : this.logger.info("Monitor is not currently running.");
109
+ }
110
+ }
111
+ export {
112
+ $ as ConnectionTool
113
+ };
114
+ //# sourceMappingURL=ConnectionTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionTool.js","sources":["../../src/tools/ConnectionTool.ts"],"sourcesContent":["import { HCS10Client } from '../hcs10/HCS10Client';\nimport { StructuredTool, ToolParams } from '@langchain/core/tools';\nimport { z } from 'zod';\n// Import FeeConfigBuilder if needed for explicit fee handling\n// import { FeeConfigBuilder } from '@hashgraphonline/standards-sdk';\nimport { Logger } from '@hashgraphonline/standards-sdk';\nimport {\n IStateManager,\n ActiveConnection,\n} from '../state/state-types'; // Corrected import path/name\n\nexport interface ConnectionToolParams extends ToolParams {\n client: HCS10Client;\n stateManager: IStateManager;\n}\n\n/**\n * ConnectionTool monitors the *current* agent's inbound topic for connection requests\n * and automatically handles them using the HCS-10 standard SDK flow.\n * Use this ONLY to passively LISTEN for other agents trying to connect TO YOU.\n * This tool takes NO arguments and does NOT start outgoing connections.\n */\nexport class ConnectionTool extends StructuredTool {\n name = 'monitor_connections';\n description =\n \"Starts passively LISTENING on the current agent's own inbound topic for INCOMING HCS-10 connection requests. Handles received requests automatically. Takes NO arguments. DO NOT use this to start a new connection TO someone else.\";\n public client: HCS10Client;\n public logger: Logger;\n private stateManager: IStateManager; // Renamed property\n private isMonitoring: boolean = false; // Flag to prevent multiple monitors\n private monitoringTopic: string | null = null;\n\n // Schema now takes NO arguments\n schema = z.object({});\n\n /**\n * @param client - Instance of HCS10Client.\n * @param stateManager - Instance of StateManager for shared state management.\n */\n constructor({ client, stateManager, ...rest }: ConnectionToolParams) {\n super(rest);\n this.client = client;\n this.stateManager = stateManager; // Renamed assignment\n this.logger = Logger.getInstance({\n module: 'ConnectionTool',\n level: 'info',\n });\n }\n\n /**\n * Initiates the connection request monitoring process in the background.\n * Gets the inbound topic ID from the configured client.\n */\n async _call(_input: z.infer<typeof this.schema>): Promise<string> {\n // Get inboundTopicId from the client\n let inboundTopicId: string;\n try {\n // Assuming getInboundTopicId() is implemented and available\n inboundTopicId = await this.client.getInboundTopicId();\n } catch (error) {\n const errorMsg = `Error getting inbound topic ID for monitoring: ${\n error instanceof Error ? error.message : String(error)\n }`;\n this.logger.error(errorMsg);\n return errorMsg;\n }\n\n if (!inboundTopicId) {\n return 'Error: Could not determine the inbound topic ID for the current agent.';\n }\n\n if (this.isMonitoring) {\n if (this.monitoringTopic === inboundTopicId) {\n return `Already monitoring topic ${inboundTopicId}.`;\n } else {\n return `Error: Already monitoring a different topic (${this.monitoringTopic}). Stop the current monitor first.`;\n // TODO: Add a mechanism to stop the monitor if needed.\n }\n }\n\n this.isMonitoring = true;\n this.monitoringTopic = inboundTopicId;\n this.logger.info(\n `Initiating connection request monitoring for topic ${inboundTopicId}...`\n );\n\n // Start the monitoring process asynchronously without awaiting it\n // This allows the tool call to return quickly.\n this.monitorIncomingRequests(inboundTopicId).catch((error) => {\n this.logger.error(\n `Monitoring loop for ${inboundTopicId} encountered an unrecoverable error:`,\n error\n );\n this.isMonitoring = false; // Reset flag on loop failure\n this.monitoringTopic = null;\n });\n\n return `Started monitoring inbound topic ${inboundTopicId} for connection requests in the background.`;\n }\n\n /**\n * The core monitoring loop.\n */\n private async monitorIncomingRequests(inboundTopicId: string): Promise<void> {\n this.logger.info(`Monitoring inbound topic ${inboundTopicId}...`);\n\n let lastProcessedMessageSequence = 0;\n const processedRequestIds = new Set<number>(); // Track processed requests within this monitoring session\n\n // Main monitoring loop\n while (this.isMonitoring && this.monitoringTopic === inboundTopicId) {\n try {\n const messagesResult = await this.client.getMessages(inboundTopicId);\n\n const connectionRequests = messagesResult.messages.filter(\n (msg) =>\n msg.op === 'connection_request' &&\n typeof msg.sequence_number === 'number' &&\n msg.sequence_number > lastProcessedMessageSequence\n );\n\n for (const message of connectionRequests) {\n lastProcessedMessageSequence = Math.max(\n lastProcessedMessageSequence,\n message.sequence_number\n );\n const connectionRequestId = message.sequence_number;\n\n // Extract requesting account ID from the message's operator_id field (topic@account)\n const senderOperatorId = message.operator_id || '';\n const requestingAccountId = senderOperatorId.split('@')[1] || null;\n\n if (!requestingAccountId) {\n this.logger.warn(\n `Could not determine requesting account ID from operator_id '${senderOperatorId}' for request #${connectionRequestId}. Skipping.`\n );\n continue;\n }\n\n if (processedRequestIds.has(connectionRequestId)) {\n this.logger.info(\n `Connection request #${connectionRequestId} already processed in this session. Skipping.`\n );\n continue;\n }\n\n this.logger.info(\n `Processing connection request #${connectionRequestId} from account ${requestingAccountId}...`\n );\n\n try {\n // Handle the connection request using the HCS10Client wrapper\n const confirmation = await this.client.handleConnectionRequest(\n inboundTopicId,\n requestingAccountId,\n connectionRequestId\n );\n\n processedRequestIds.add(connectionRequestId);\n this.logger.info(\n `Connection confirmed for request #${connectionRequestId}. New connection topic: ${confirmation.connectionTopicId}`\n );\n\n // Use stateManager to add connection\n const newConnection: ActiveConnection = {\n targetAccountId: requestingAccountId,\n targetAgentName: `Agent ${requestingAccountId}`,\n targetInboundTopicId: 'N/A',\n connectionTopicId: confirmation.connectionTopicId,\n };\n this.stateManager.addActiveConnection(newConnection);\n this.logger.info(\n `Added new active connection to ${requestingAccountId} state.`\n );\n } catch (handleError) {\n this.logger.error(\n `Error handling connection request #${connectionRequestId} from ${requestingAccountId}:`,\n handleError\n );\n }\n }\n } catch (error) {\n this.logger.error(\n `Error fetching or processing messages for topic ${inboundTopicId}:`,\n error\n );\n // Implement backoff or error threshold if needed\n }\n\n // Wait before the next poll\n await new Promise((resolve) => setTimeout(resolve, 5000)); // Poll every 5 seconds (adjust as needed)\n }\n\n this.logger.info(`Monitoring loop stopped for topic ${inboundTopicId}.`);\n this.isMonitoring = false; // Ensure flag is reset when loop exits\n this.monitoringTopic = null;\n }\n\n // Optional: Method to explicitly stop monitoring\n public stopMonitoring(): void {\n if (this.isMonitoring) {\n this.logger.info(\n `Stopping monitoring for topic ${this.monitoringTopic}...`\n );\n this.isMonitoring = false;\n this.monitoringTopic = null;\n } else {\n this.logger.info('Monitor is not currently running.');\n }\n }\n}\n"],"names":["ConnectionTool","StructuredTool","client","stateManager","rest","z","Logger","_input","inboundTopicId","error","errorMsg","lastProcessedMessageSequence","processedRequestIds","connectionRequests","msg","message","connectionRequestId","senderOperatorId","requestingAccountId","confirmation","newConnection","handleError","resolve"],"mappings":";;;AAsBO,MAAMA,UAAuBC,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBjD,YAAY,EAAE,QAAAC,GAAQ,cAAAC,GAAc,GAAGC,KAA8B;AACnE,UAAMA,CAAI,GAjBL,KAAA,OAAA,uBAEL,KAAA,cAAA,wOAIF,KAAQ,eAAwB,IAChC,KAAQ,kBAAiC,MAGhC,KAAA,SAAAC,EAAE,OAAO,CAAA,CAAE,GAQlB,KAAK,SAASH,GACd,KAAK,eAAeC,GACf,KAAA,SAASG,EAAO,YAAY;AAAA,MAC/B,QAAQ;AAAA,MACR,OAAO;AAAA,IAAA,CACR;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOH,MAAM,MAAMC,GAAsD;AAE5D,QAAAC;AACA,QAAA;AAEe,MAAAA,IAAA,MAAM,KAAK,OAAO,kBAAkB;AAAA,aAC9CC,GAAO;AACR,YAAAC,IAAW,kDACfD,aAAiB,QAAQA,EAAM,UAAU,OAAOA,CAAK,CACvD;AACK,kBAAA,OAAO,MAAMC,CAAQ,GACnBA;AAAA,IAAA;AAGT,WAAKF,IAID,KAAK,eACH,KAAK,oBAAoBA,IACpB,4BAA4BA,CAAc,MAE1C,gDAAgD,KAAK,eAAe,wCAK/E,KAAK,eAAe,IACpB,KAAK,kBAAkBA,GACvB,KAAK,OAAO;AAAA,MACV,sDAAsDA,CAAc;AAAA,IACtE,GAIA,KAAK,wBAAwBA,CAAc,EAAE,MAAM,CAACC,MAAU;AAC5D,WAAK,OAAO;AAAA,QACV,uBAAuBD,CAAc;AAAA,QACrCC;AAAA,MACF,GACA,KAAK,eAAe,IACpB,KAAK,kBAAkB;AAAA,IAAA,CACxB,GAEM,oCAAoCD,CAAc,iDA7BhD;AAAA,EA6BgD;AAAA;AAAA;AAAA;AAAA,EAM3D,MAAc,wBAAwBA,GAAuC;AAC3E,SAAK,OAAO,KAAK,4BAA4BA,CAAc,KAAK;AAEhE,QAAIG,IAA+B;AAC7B,UAAAC,wBAA0B,IAAY;AAG5C,WAAO,KAAK,gBAAgB,KAAK,oBAAoBJ,KAAgB;AAC/D,UAAA;AAGI,cAAAK,KAFiB,MAAM,KAAK,OAAO,YAAYL,CAAc,GAEzB,SAAS;AAAA,UACjD,CAACM,MACCA,EAAI,OAAO,wBACX,OAAOA,EAAI,mBAAoB,YAC/BA,EAAI,kBAAkBH;AAAA,QAC1B;AAEA,mBAAWI,KAAWF,GAAoB;AACxC,UAAAF,IAA+B,KAAK;AAAA,YAClCA;AAAA,YACAI,EAAQ;AAAA,UACV;AACA,gBAAMC,IAAsBD,EAAQ,iBAG9BE,IAAmBF,EAAQ,eAAe,IAC1CG,IAAsBD,EAAiB,MAAM,GAAG,EAAE,CAAC,KAAK;AAE9D,cAAI,CAACC,GAAqB;AACxB,iBAAK,OAAO;AAAA,cACV,+DAA+DD,CAAgB,kBAAkBD,CAAmB;AAAA,YACtH;AACA;AAAA,UAAA;AAGE,cAAAJ,EAAoB,IAAII,CAAmB,GAAG;AAChD,iBAAK,OAAO;AAAA,cACV,uBAAuBA,CAAmB;AAAA,YAC5C;AACA;AAAA,UAAA;AAGF,eAAK,OAAO;AAAA,YACV,kCAAkCA,CAAmB,iBAAiBE,CAAmB;AAAA,UAC3F;AAEI,cAAA;AAEI,kBAAAC,IAAe,MAAM,KAAK,OAAO;AAAA,cACrCX;AAAA,cACAU;AAAA,cACAF;AAAA,YACF;AAEA,YAAAJ,EAAoB,IAAII,CAAmB,GAC3C,KAAK,OAAO;AAAA,cACV,qCAAqCA,CAAmB,2BAA2BG,EAAa,iBAAiB;AAAA,YACnH;AAGA,kBAAMC,IAAkC;AAAA,cACtC,iBAAiBF;AAAA,cACjB,iBAAiB,SAASA,CAAmB;AAAA,cAC7C,sBAAsB;AAAA,cACtB,mBAAmBC,EAAa;AAAA,YAClC;AACK,iBAAA,aAAa,oBAAoBC,CAAa,GACnD,KAAK,OAAO;AAAA,cACV,kCAAkCF,CAAmB;AAAA,YACvD;AAAA,mBACOG,GAAa;AACpB,iBAAK,OAAO;AAAA,cACV,sCAAsCL,CAAmB,SAASE,CAAmB;AAAA,cACrFG;AAAA,YACF;AAAA,UAAA;AAAA,QACF;AAAA,eAEKZ,GAAO;AACd,aAAK,OAAO;AAAA,UACV,mDAAmDD,CAAc;AAAA,UACjEC;AAAA,QACF;AAAA,MAAA;AAKF,YAAM,IAAI,QAAQ,CAACa,MAAY,WAAWA,GAAS,GAAI,CAAC;AAAA,IAAA;AAG1D,SAAK,OAAO,KAAK,qCAAqCd,CAAc,GAAG,GACvE,KAAK,eAAe,IACpB,KAAK,kBAAkB;AAAA,EAAA;AAAA;AAAA,EAIlB,iBAAuB;AAC5B,IAAI,KAAK,gBACP,KAAK,OAAO;AAAA,MACV,iCAAiC,KAAK,eAAe;AAAA,IACvD,GACA,KAAK,eAAe,IACpB,KAAK,kBAAkB,QAElB,KAAA,OAAO,KAAK,mCAAmC;AAAA,EACtD;AAEJ;"}
@@ -0,0 +1,27 @@
1
+ import { StructuredTool, ToolParams } from '@langchain/core/tools';
2
+ import { z } from 'zod';
3
+ import { HCS10Client } from '../hcs10/HCS10Client';
4
+ export interface FindRegistrationsToolParams extends ToolParams {
5
+ hcsClient: HCS10Client;
6
+ }
7
+ /**
8
+ * A tool to search for registered HCS-10 agents using the configured registry.
9
+ */
10
+ export declare class FindRegistrationsTool extends StructuredTool {
11
+ name: string;
12
+ description: string;
13
+ schema: z.ZodObject<{
14
+ accountId: z.ZodOptional<z.ZodString>;
15
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ accountId?: string | undefined;
18
+ tags?: string[] | undefined;
19
+ }, {
20
+ accountId?: string | undefined;
21
+ tags?: string[] | undefined;
22
+ }>;
23
+ private hcsClient;
24
+ private logger;
25
+ constructor({ hcsClient, ...rest }: FindRegistrationsToolParams);
26
+ protected _call({ accountId, tags, }: z.infer<this['schema']>): Promise<string>;
27
+ }
@@ -0,0 +1,64 @@
1
+ import { StructuredTool as g } from "../node_modules/@langchain/core/dist/tools.js";
2
+ import { z as a } from "zod";
3
+ import { Logger as l } from "@hashgraphonline/standards-sdk";
4
+ class p extends g {
5
+ constructor({ hcsClient: o, ...e }) {
6
+ super(e), this.name = "find_registrations", this.description = "Searches the configured agent registry for HCS-10 agents. You can filter by account ID or tags. Returns basic registration info.", this.schema = a.object({
7
+ accountId: a.string().optional().describe(
8
+ "Optional: Filter registrations by a specific Hedera account ID (e.g., 0.0.12345)."
9
+ ),
10
+ tags: a.array(a.string()).optional().describe(
11
+ "Optional: Filter registrations by a list of tags (API filter only)."
12
+ )
13
+ }), this.hcsClient = o, this.logger = l.getInstance({ module: "FindRegistrationsTool" });
14
+ }
15
+ async _call({
16
+ accountId: o,
17
+ tags: e
18
+ }) {
19
+ this.logger.info(
20
+ "Searching registrations with filters - Account ID",
21
+ JSON.stringify({
22
+ accountId: o,
23
+ tags: e
24
+ })
25
+ );
26
+ const s = {};
27
+ o && (s.accountId = o), e && e.length > 0 && (s.tags = e), s.network = this.hcsClient.getNetwork();
28
+ try {
29
+ if (!this.hcsClient.standardClient)
30
+ throw new Error(
31
+ "Standard SDK client instance is not available in HCS10Client wrapper."
32
+ );
33
+ const t = await this.hcsClient.standardClient.findRegistrations(
34
+ s
35
+ );
36
+ if (!t.success || t.error)
37
+ return `Error finding registrations: ${t.error || "Unknown error"}`;
38
+ if (!t.registrations || t.registrations.length === 0)
39
+ return "No registrations found matching the criteria.";
40
+ let i = `Found ${t.registrations.length} registration(s):
41
+ `;
42
+ return t.registrations.forEach((n, c) => {
43
+ const r = n.metadata;
44
+ i += `${c + 1}. Name: ${r.name || "N/A"}
45
+ `, i += `Description: ${r.description || "N/A"}
46
+ `, i += ` Account ID: ${n.account_id}
47
+ `, i += ` Status: ${n.status}
48
+ `, i += ` Model: ${r.model || "N/A"}
49
+ `, r.tags && r.tags.length > 0 && (i += ` Tags: ${r.tags.join(", ")}
50
+ `), r.properties && (i += ` Properties: ${JSON.stringify(r.properties)}
51
+ `), i += ` Inbound Topic: ${n.inbound_topic_id}
52
+ `, i += ` Outbound Topic: ${n.outbound_topic_id}
53
+ `, i += ` Created At: ${n.created_at}
54
+ `;
55
+ }), i.trim();
56
+ } catch (t) {
57
+ return this.logger.error(`Failed to execute findRegistrations: ${t}`), `Error searching registrations: ${t instanceof Error ? t.message : String(t)}`;
58
+ }
59
+ }
60
+ }
61
+ export {
62
+ p as FindRegistrationsTool
63
+ };
64
+ //# sourceMappingURL=FindRegistrationsTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FindRegistrationsTool.js","sources":["../../src/tools/FindRegistrationsTool.ts"],"sourcesContent":["import { StructuredTool, ToolParams } from '@langchain/core/tools';\nimport { z } from 'zod';\nimport { HCS10Client } from '../hcs10/HCS10Client';\nimport {\n Logger,\n RegistrationSearchOptions,\n} from '@hashgraphonline/standards-sdk';\n\nexport interface FindRegistrationsToolParams extends ToolParams {\n hcsClient: HCS10Client;\n}\n\n/**\n * A tool to search for registered HCS-10 agents using the configured registry.\n */\nexport class FindRegistrationsTool extends StructuredTool {\n name = 'find_registrations';\n description =\n 'Searches the configured agent registry for HCS-10 agents. You can filter by account ID or tags. Returns basic registration info.';\n schema = z.object({\n accountId: z\n .string()\n .optional()\n .describe(\n 'Optional: Filter registrations by a specific Hedera account ID (e.g., 0.0.12345).'\n ),\n tags: z\n .array(z.string())\n .optional()\n .describe(\n 'Optional: Filter registrations by a list of tags (API filter only).'\n ),\n });\n\n private hcsClient: HCS10Client;\n private logger: Logger;\n\n constructor({ hcsClient, ...rest }: FindRegistrationsToolParams) {\n super(rest);\n this.hcsClient = hcsClient;\n this.logger = Logger.getInstance({ module: 'FindRegistrationsTool' });\n }\n\n protected async _call({\n accountId,\n tags,\n }: z.infer<this['schema']>): Promise<string> {\n this.logger.info(\n 'Searching registrations with filters - Account ID',\n JSON.stringify({\n accountId,\n tags,\n })\n );\n\n const options: RegistrationSearchOptions = {};\n if (accountId) {\n options.accountId = accountId;\n }\n if (tags && tags.length > 0) {\n options.tags = tags;\n }\n options.network = this.hcsClient.getNetwork();\n\n try {\n if (!this.hcsClient.standardClient) {\n throw new Error(\n 'Standard SDK client instance is not available in HCS10Client wrapper.'\n );\n }\n const result = await this.hcsClient.standardClient.findRegistrations(\n options\n );\n\n if (!result.success || result.error) {\n return `Error finding registrations: ${\n result.error || 'Unknown error'\n }`;\n }\n\n if (!result.registrations || result.registrations.length === 0) {\n return 'No registrations found matching the criteria.';\n }\n\n // Format the results based on available data from RegistrationSearchResult\n let output = `Found ${result.registrations.length} registration(s):\\n`;\n result.registrations.forEach((reg, index: number) => {\n const metadata: any = reg.metadata;\n output += `${index + 1}. Name: ${metadata.name || 'N/A'}\\n`;\n output += `Description: ${metadata.description || 'N/A'}\\n`;\n output += ` Account ID: ${reg.account_id}\\n`;\n output += ` Status: ${reg.status}\\n`;\n output += ` Model: ${metadata.model || 'N/A'}\\n`;\n if (metadata.tags && metadata.tags.length > 0) {\n output += ` Tags: ${metadata.tags.join(', ')}\\n`;\n }\n if (metadata.properties) {\n output += ` Properties: ${JSON.stringify(metadata.properties)}\\n`;\n }\n output += ` Inbound Topic: ${reg.inbound_topic_id}\\n`;\n output += ` Outbound Topic: ${reg.outbound_topic_id}\\n`;\n output += ` Created At: ${reg.created_at}\\n`;\n });\n\n return output.trim();\n } catch (error) {\n this.logger.error(`Failed to execute findRegistrations: ${error}`);\n return `Error searching registrations: ${\n error instanceof Error ? error.message : String(error)\n }`;\n }\n }\n}\n"],"names":["FindRegistrationsTool","StructuredTool","hcsClient","rest","z","Logger","accountId","tags","options","result","output","reg","index","metadata","error"],"mappings":";;;AAeO,MAAMA,UAA8BC,EAAe;AAAA,EAsBxD,YAAY,EAAE,WAAAC,GAAW,GAAGC,KAAqC;AAC/D,UAAMA,CAAI,GAtBL,KAAA,OAAA,sBAEL,KAAA,cAAA,oIACF,KAAA,SAASC,EAAE,OAAO;AAAA,MAChB,WAAWA,EACR,SACA,SACA,EAAA;AAAA,QACC;AAAA,MACF;AAAA,MACF,MAAMA,EACH,MAAMA,EAAE,QAAQ,EAChB,WACA;AAAA,QACC;AAAA,MAAA;AAAA,IACF,CACH,GAOC,KAAK,YAAYF,GACjB,KAAK,SAASG,EAAO,YAAY,EAAE,QAAQ,yBAAyB;AAAA,EAAA;AAAA,EAGtE,MAAgB,MAAM;AAAA,IACpB,WAAAC;AAAA,IACA,MAAAC;AAAA,EAAA,GAC2C;AAC3C,SAAK,OAAO;AAAA,MACV;AAAA,MACA,KAAK,UAAU;AAAA,QACb,WAAAD;AAAA,QACA,MAAAC;AAAA,MACD,CAAA;AAAA,IACH;AAEA,UAAMC,IAAqC,CAAC;AAC5C,IAAIF,MACFE,EAAQ,YAAYF,IAElBC,KAAQA,EAAK,SAAS,MACxBC,EAAQ,OAAOD,IAETC,EAAA,UAAU,KAAK,UAAU,WAAW;AAExC,QAAA;AACE,UAAA,CAAC,KAAK,UAAU;AAClB,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAEF,YAAMC,IAAS,MAAM,KAAK,UAAU,eAAe;AAAA,QACjDD;AAAA,MACF;AAEA,UAAI,CAACC,EAAO,WAAWA,EAAO;AACrB,eAAA,gCACLA,EAAO,SAAS,eAClB;AAGF,UAAI,CAACA,EAAO,iBAAiBA,EAAO,cAAc,WAAW;AACpD,eAAA;AAIT,UAAIC,IAAS,SAASD,EAAO,cAAc,MAAM;AAAA;AACjD,aAAAA,EAAO,cAAc,QAAQ,CAACE,GAAKC,MAAkB;AACnD,cAAMC,IAAgBF,EAAI;AAC1B,QAAAD,KAAU,GAAGE,IAAQ,CAAC,WAAWC,EAAS,QAAQ,KAAK;AAAA,GAC7CH,KAAA,gBAAgBG,EAAS,eAAe,KAAK;AAAA,GAC7CH,KAAA,kBAAkBC,EAAI,UAAU;AAAA,GAChCD,KAAA,cAAcC,EAAI,MAAM;AAAA,GACxBD,KAAA,aAAaG,EAAS,SAAS,KAAK;AAAA,GAC1CA,EAAS,QAAQA,EAAS,KAAK,SAAS,MAC1CH,KAAU,YAAYG,EAAS,KAAK,KAAK,IAAI,CAAC;AAAA,IAE5CA,EAAS,eACXH,KAAU,kBAAkB,KAAK,UAAUG,EAAS,UAAU,CAAC;AAAA,IAEvDH,KAAA,qBAAqBC,EAAI,gBAAgB;AAAA,GACzCD,KAAA,sBAAsBC,EAAI,iBAAiB;AAAA,GAC3CD,KAAA,kBAAkBC,EAAI,UAAU;AAAA;AAAA,MAAA,CAC3C,GAEMD,EAAO,KAAK;AAAA,aACZI,GAAO;AACd,kBAAK,OAAO,MAAM,wCAAwCA,CAAK,EAAE,GAC1D,kCACLA,aAAiB,QAAQA,EAAM,UAAU,OAAOA,CAAK,CACvD;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -0,0 +1,30 @@
1
+ import { StructuredTool, ToolParams } from '@langchain/core/tools';
2
+ import { z } from 'zod';
3
+ import { HCS10Client } from '../hcs10/HCS10Client';
4
+ import { IStateManager } from '../state/state-types';
5
+ export interface InitiateConnectionToolParams extends ToolParams {
6
+ hcsClient: HCS10Client;
7
+ stateManager: IStateManager;
8
+ }
9
+ /**
10
+ * A tool to actively START a NEW HCS-10 connection TO a target agent.
11
+ * Requires the target agent's account ID.
12
+ * It retrieves their profile, sends a connection request, waits for confirmation, and stores the connection using the provided stateManager.
13
+ * Use this tool ONLY to actively INITIATE an OUTGOING connection.
14
+ */
15
+ export declare class InitiateConnectionTool extends StructuredTool {
16
+ name: string;
17
+ description: string;
18
+ schema: z.ZodObject<{
19
+ targetAccountId: z.ZodString;
20
+ }, "strip", z.ZodTypeAny, {
21
+ targetAccountId: string;
22
+ }, {
23
+ targetAccountId: string;
24
+ }>;
25
+ private hcsClient;
26
+ private stateManager;
27
+ private logger;
28
+ constructor({ hcsClient, stateManager, ...rest }: InitiateConnectionToolParams);
29
+ protected _call({ targetAccountId }: z.infer<this['schema']>): Promise<string>;
30
+ }
@@ -0,0 +1,79 @@
1
+ import { StructuredTool as $ } from "../node_modules/@langchain/core/dist/tools.js";
2
+ import { z as C } from "zod";
3
+ import { Logger as w } from "@hashgraphonline/standards-sdk";
4
+ class v extends $ {
5
+ constructor({
6
+ hcsClient: n,
7
+ stateManager: t,
8
+ ...o
9
+ }) {
10
+ super(o), this.name = "initiate_connection", this.description = "Actively STARTS a NEW HCS-10 connection TO a specific target agent identified by their account ID. Requires the targetAccountId parameter. Use this ONLY to INITIATE an OUTGOING connection request.", this.schema = C.object({
11
+ targetAccountId: C.string().describe(
12
+ "The Hedera account ID (e.g., 0.0.12345) of the agent you want to connect with."
13
+ )
14
+ }), this.hcsClient = n, this.stateManager = t, this.logger = w.getInstance({ module: "InitiateConnectionTool" });
15
+ }
16
+ async _call({
17
+ targetAccountId: n
18
+ }) {
19
+ var o;
20
+ const t = this.stateManager.getCurrentAgent();
21
+ if (!t)
22
+ return "Error: Cannot initiate connection. No agent is currently active. Please register or select an agent first.";
23
+ this.logger.info(
24
+ `Attempting connection from ${t.accountId} to ${n}`
25
+ );
26
+ try {
27
+ this.logger.debug(`Retrieving profile for ${n}...`);
28
+ const e = await this.hcsClient.getAgentProfile(
29
+ n
30
+ );
31
+ if (!((o = e == null ? void 0 : e.topicInfo) != null && o.inboundTopic))
32
+ return `Error: Could not retrieve profile or find inbound topic ID for target agent ${n}. They might not be registered or have a public profile.`;
33
+ const s = e.topicInfo.inboundTopic, g = e.profile.name || `Agent ${n}`, a = await this.hcsClient.submitConnectionRequest(
34
+ s,
35
+ t.name
36
+ );
37
+ let i = null;
38
+ const l = a == null ? void 0 : a.topicSequenceNumber;
39
+ if (l !== null)
40
+ try {
41
+ if (i = l.toNumber(), isNaN(i))
42
+ throw new Error("Converted sequence number is NaN.");
43
+ } catch (u) {
44
+ throw new Error(
45
+ `Failed to convert connection request sequence number: ${u}`
46
+ );
47
+ }
48
+ else
49
+ throw new Error("Connection request sequence number not found.");
50
+ const h = 6e4, d = 2e3, T = Math.ceil(h / d), r = await this.hcsClient.waitForConnectionConfirmation(
51
+ s,
52
+ i,
53
+ T,
54
+ d
55
+ );
56
+ if (!(r != null && r.connectionTopicId))
57
+ return `Error: Connection confirmation not received from ${n} (for request ${i}) within ${h / 1e3} seconds.`;
58
+ const c = r.connectionTopicId;
59
+ this.logger.info(`Connection confirmed! Topic ID: ${c}`);
60
+ const b = {
61
+ targetAccountId: n,
62
+ targetAgentName: g,
63
+ targetInboundTopicId: s,
64
+ connectionTopicId: c
65
+ };
66
+ this.stateManager.addActiveConnection(b);
67
+ const f = this.stateManager.listConnections(), m = f.find(
68
+ (u) => u.connectionTopicId === c
69
+ ), p = m ? f.indexOf(m) + 1 : null;
70
+ return `Successfully established connection ${p ? `#${p}` : ""} with ${g} (${n}). Connection Topic: ${c}. You can now send messages using this connection.`;
71
+ } catch (e) {
72
+ return this.logger.error(`Connection initiation failed: ${e}`), `Error initiating connection with ${n}: ${e instanceof Error ? e.message : String(e)}`;
73
+ }
74
+ }
75
+ }
76
+ export {
77
+ v as InitiateConnectionTool
78
+ };
79
+ //# sourceMappingURL=InitiateConnectionTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InitiateConnectionTool.js","sources":["../../src/tools/InitiateConnectionTool.ts"],"sourcesContent":["import { StructuredTool, ToolParams } from '@langchain/core/tools';\nimport { z } from 'zod';\nimport { HCS10Client } from '../hcs10/HCS10Client';\nimport { IStateManager, ActiveConnection } from '../state/state-types';\nimport { Logger } from '@hashgraphonline/standards-sdk';\n\nexport interface InitiateConnectionToolParams extends ToolParams {\n hcsClient: HCS10Client;\n stateManager: IStateManager;\n}\n\n/**\n * A tool to actively START a NEW HCS-10 connection TO a target agent.\n * Requires the target agent's account ID.\n * It retrieves their profile, sends a connection request, waits for confirmation, and stores the connection using the provided stateManager.\n * Use this tool ONLY to actively INITIATE an OUTGOING connection.\n */\nexport class InitiateConnectionTool extends StructuredTool {\n name = 'initiate_connection';\n description =\n 'Actively STARTS a NEW HCS-10 connection TO a specific target agent identified by their account ID. Requires the targetAccountId parameter. Use this ONLY to INITIATE an OUTGOING connection request.';\n schema = z.object({\n targetAccountId: z\n .string()\n .describe(\n 'The Hedera account ID (e.g., 0.0.12345) of the agent you want to connect with.'\n )\n });\n\n private hcsClient: HCS10Client;\n private stateManager: IStateManager;\n private logger: Logger;\n\n constructor({\n hcsClient,\n stateManager,\n ...rest\n }: InitiateConnectionToolParams) {\n super(rest);\n this.hcsClient = hcsClient;\n this.stateManager = stateManager;\n this.logger = Logger.getInstance({ module: 'InitiateConnectionTool' });\n }\n\n protected async _call({\n targetAccountId\n }: z.infer<this['schema']>): Promise<string> {\n const currentAgent = this.stateManager.getCurrentAgent();\n if (!currentAgent) {\n return 'Error: Cannot initiate connection. No agent is currently active. Please register or select an agent first.';\n }\n\n this.logger.info(\n `Attempting connection from ${currentAgent.accountId} to ${targetAccountId}`\n );\n\n try {\n this.logger.debug(`Retrieving profile for ${targetAccountId}...`);\n const targetProfile = await this.hcsClient.getAgentProfile(\n targetAccountId\n );\n if (!targetProfile?.topicInfo?.inboundTopic) {\n return `Error: Could not retrieve profile or find inbound topic ID for target agent ${targetAccountId}. They might not be registered or have a public profile.`;\n }\n const targetInboundTopicId = targetProfile.topicInfo.inboundTopic;\n const targetAgentName =\n targetProfile.profile.name || `Agent ${targetAccountId}`;\n\n const requestResult = await this.hcsClient.submitConnectionRequest(\n targetInboundTopicId,\n currentAgent.name\n );\n let connectionRequestId: number | null = null;\n const sequenceNumberLong = requestResult?.topicSequenceNumber;\n if (sequenceNumberLong !== null) {\n try {\n connectionRequestId = sequenceNumberLong.toNumber();\n if (isNaN(connectionRequestId)) {\n throw new Error('Converted sequence number is NaN.');\n }\n } catch (conversionError) {\n throw new Error(\n `Failed to convert connection request sequence number: ${conversionError}`\n );\n }\n } else {\n throw new Error('Connection request sequence number not found.');\n }\n\n const confirmationTimeoutMs = 60000;\n const delayMs = 2000;\n const maxAttempts = Math.ceil(confirmationTimeoutMs / delayMs);\n\n const confirmationResult =\n await this.hcsClient.waitForConnectionConfirmation(\n targetInboundTopicId,\n connectionRequestId,\n maxAttempts,\n delayMs\n );\n\n if (!confirmationResult?.connectionTopicId) {\n return `Error: Connection confirmation not received from ${targetAccountId} (for request ${connectionRequestId}) within ${\n confirmationTimeoutMs / 1000\n } seconds.`;\n }\n\n const connectionTopicId = confirmationResult.connectionTopicId;\n this.logger.info(`Connection confirmed! Topic ID: ${connectionTopicId}`);\n\n const newConnection: ActiveConnection = {\n targetAccountId: targetAccountId,\n targetAgentName: targetAgentName,\n targetInboundTopicId: targetInboundTopicId,\n connectionTopicId: connectionTopicId,\n };\n this.stateManager.addActiveConnection(newConnection);\n\n const connections = this.stateManager.listConnections();\n const addedEntry = connections.find(\n (c) => c.connectionTopicId === connectionTopicId\n );\n const localConnectionId = addedEntry\n ? connections.indexOf(addedEntry) + 1\n : null;\n\n const idString = localConnectionId ? `#${localConnectionId}` : '';\n\n return `Successfully established connection ${idString} with ${targetAgentName} (${targetAccountId}). Connection Topic: ${connectionTopicId}. You can now send messages using this connection.`;\n } catch (error) {\n this.logger.error(`Connection initiation failed: ${error}`);\n return `Error initiating connection with ${targetAccountId}: ${\n error instanceof Error ? error.message : String(error)\n }`;\n }\n }\n}\n"],"names":["InitiateConnectionTool","StructuredTool","hcsClient","stateManager","rest","z","Logger","targetAccountId","currentAgent","targetProfile","_a","targetInboundTopicId","targetAgentName","requestResult","connectionRequestId","sequenceNumberLong","conversionError","confirmationTimeoutMs","delayMs","maxAttempts","confirmationResult","connectionTopicId","newConnection","connections","addedEntry","c","localConnectionId","error"],"mappings":";;;AAiBO,MAAMA,UAA+BC,EAAe;AAAA,EAgBzD,YAAY;AAAA,IACV,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAC4B;AAC/B,UAAMA,CAAI,GApBL,KAAA,OAAA,uBAEL,KAAA,cAAA,wMACF,KAAA,SAASC,EAAE,OAAO;AAAA,MAChB,iBAAiBA,EACd,OAAA,EACA;AAAA,QACC;AAAA,MAAA;AAAA,IACF,CACH,GAYC,KAAK,YAAYH,GACjB,KAAK,eAAeC,GACpB,KAAK,SAASG,EAAO,YAAY,EAAE,QAAQ,0BAA0B;AAAA,EAAA;AAAA,EAGvE,MAAgB,MAAM;AAAA,IACpB,iBAAAC;AAAA,EAAA,GAC2C;;AACrC,UAAAC,IAAe,KAAK,aAAa,gBAAgB;AACvD,QAAI,CAACA;AACI,aAAA;AAGT,SAAK,OAAO;AAAA,MACV,8BAA8BA,EAAa,SAAS,OAAOD,CAAe;AAAA,IAC5E;AAEI,QAAA;AACF,WAAK,OAAO,MAAM,0BAA0BA,CAAe,KAAK;AAC1D,YAAAE,IAAgB,MAAM,KAAK,UAAU;AAAA,QACzCF;AAAA,MACF;AACI,UAAA,GAACG,IAAAD,KAAA,gBAAAA,EAAe,cAAf,QAAAC,EAA0B;AAC7B,eAAO,+EAA+EH,CAAe;AAEjG,YAAAI,IAAuBF,EAAc,UAAU,cAC/CG,IACJH,EAAc,QAAQ,QAAQ,SAASF,CAAe,IAElDM,IAAgB,MAAM,KAAK,UAAU;AAAA,QACzCF;AAAA,QACAH,EAAa;AAAA,MACf;AACA,UAAIM,IAAqC;AACzC,YAAMC,IAAqBF,KAAA,gBAAAA,EAAe;AAC1C,UAAIE,MAAuB;AACrB,YAAA;AAEE,cADJD,IAAsBC,EAAmB,SAAS,GAC9C,MAAMD,CAAmB;AACrB,kBAAA,IAAI,MAAM,mCAAmC;AAAA,iBAE9CE,GAAiB;AACxB,gBAAM,IAAI;AAAA,YACR,yDAAyDA,CAAe;AAAA,UAC1E;AAAA,QAAA;AAAA;AAGI,cAAA,IAAI,MAAM,+CAA+C;AAGjE,YAAMC,IAAwB,KACxBC,IAAU,KACVC,IAAc,KAAK,KAAKF,IAAwBC,CAAO,GAEvDE,IACJ,MAAM,KAAK,UAAU;AAAA,QACnBT;AAAA,QACAG;AAAA,QACAK;AAAA,QACAD;AAAA,MACF;AAEE,UAAA,EAACE,KAAA,QAAAA,EAAoB;AACvB,eAAO,oDAAoDb,CAAe,iBAAiBO,CAAmB,YAC5GG,IAAwB,GAC1B;AAGF,YAAMI,IAAoBD,EAAmB;AAC7C,WAAK,OAAO,KAAK,mCAAmCC,CAAiB,EAAE;AAEvE,YAAMC,IAAkC;AAAA,QACtC,iBAAAf;AAAA,QACA,iBAAAK;AAAA,QACA,sBAAAD;AAAA,QACA,mBAAAU;AAAA,MACF;AACK,WAAA,aAAa,oBAAoBC,CAAa;AAE7C,YAAAC,IAAc,KAAK,aAAa,gBAAgB,GAChDC,IAAaD,EAAY;AAAA,QAC7B,CAACE,MAAMA,EAAE,sBAAsBJ;AAAA,MACjC,GACMK,IAAoBF,IACtBD,EAAY,QAAQC,CAAU,IAAI,IAClC;AAIJ,aAAO,uCAFUE,IAAoB,IAAIA,CAAiB,KAAK,EAET,SAASd,CAAe,KAAKL,CAAe,wBAAwBc,CAAiB;AAAA,aACpIM,GAAO;AACd,kBAAK,OAAO,MAAM,iCAAiCA,CAAK,EAAE,GACnD,oCAAoCpB,CAAe,KACxDoB,aAAiB,QAAQA,EAAM,UAAU,OAAOA,CAAK,CACvD;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -0,0 +1,33 @@
1
+ import { StructuredTool, ToolParams } from '@langchain/core/tools';
2
+ import { z } from 'zod';
3
+ import { IStateManager } from '../state/state-types';
4
+ import { HCS10Client } from '../hcs10/HCS10Client';
5
+ export interface ListConnectionsToolParams extends ToolParams {
6
+ stateManager: IStateManager;
7
+ hcsClient?: HCS10Client;
8
+ }
9
+ /**
10
+ * A tool to list currently active HCS-10 connections stored in the state manager.
11
+ * Enhanced to show more details similar to moonscape's implementation.
12
+ */
13
+ export declare class ListConnectionsTool extends StructuredTool {
14
+ name: string;
15
+ description: string;
16
+ schema: z.ZodObject<{
17
+ includeDetails: z.ZodOptional<z.ZodBoolean>;
18
+ showPending: z.ZodOptional<z.ZodBoolean>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ includeDetails?: boolean | undefined;
21
+ showPending?: boolean | undefined;
22
+ }, {
23
+ includeDetails?: boolean | undefined;
24
+ showPending?: boolean | undefined;
25
+ }>;
26
+ private stateManager;
27
+ private hcsClient?;
28
+ constructor({ stateManager, hcsClient, ...rest }: ListConnectionsToolParams);
29
+ protected _call(args: z.infer<this['schema']>): Promise<string>;
30
+ private formatConnection;
31
+ private enhanceConnectionInfo;
32
+ private fetchOutboundMessages;
33
+ }