@ontos-ai/knowhere-claw 0.1.4 → 0.1.5

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 (188) hide show
  1. package/README.md +3 -0
  2. package/dist/_virtual/_rolldown/runtime.js +2 -1
  3. package/dist/config.js +115 -1
  4. package/dist/connect-builder.js +181 -0
  5. package/dist/graph-builder.js +204 -0
  6. package/dist/index.js +15 -3
  7. package/dist/kg-service.js +249 -0
  8. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js +212 -0
  9. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/pre-binding.js +35 -0
  10. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/abi_crosswalk.js +2609 -0
  11. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/napi.js +142 -0
  12. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js +103 -0
  13. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js +199 -0
  14. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/package.js +67 -0
  15. package/dist/node_modules/.pnpm/abbrev@1.1.1/node_modules/abbrev/abbrev.js +59 -0
  16. package/dist/node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js +11 -0
  17. package/dist/node_modules/.pnpm/aproba@2.1.0/node_modules/aproba/index.js +119 -0
  18. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/index.js +13 -0
  19. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker-base.js +16 -0
  20. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker-group.js +98 -0
  21. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker-stream.js +37 -0
  22. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker.js +32 -0
  23. package/dist/node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js +53 -0
  24. package/dist/node_modules/.pnpm/brace-expansion@1.1.12/node_modules/brace-expansion/index.js +132 -0
  25. package/dist/node_modules/.pnpm/color-support@1.1.3/node_modules/color-support/browser.js +18 -0
  26. package/dist/node_modules/.pnpm/concat-map@0.0.1/node_modules/concat-map/index.js +19 -0
  27. package/dist/node_modules/.pnpm/console-control-strings@1.1.0/node_modules/console-control-strings/index.js +104 -0
  28. package/dist/node_modules/.pnpm/delegates@1.0.0/node_modules/delegates/index.js +104 -0
  29. package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/detect-libc.js +221 -0
  30. package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/elf.js +26 -0
  31. package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/filesystem.js +48 -0
  32. package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/process.js +24 -0
  33. package/dist/node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js +10 -0
  34. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy-sync.js +120 -0
  35. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy.js +100 -0
  36. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/index.js +15 -0
  37. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/empty/index.js +43 -0
  38. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/file.js +53 -0
  39. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/index.js +27 -0
  40. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/link.js +56 -0
  41. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-paths.js +89 -0
  42. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-type.js +35 -0
  43. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink.js +81 -0
  44. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js +113 -0
  45. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/index.js +29 -0
  46. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/index.js +22 -0
  47. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/jsonfile.js +15 -0
  48. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json-sync.js +15 -0
  49. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json.js +15 -0
  50. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js +20 -0
  51. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/make-dir.js +33 -0
  52. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/utils.js +17 -0
  53. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/index.js +15 -0
  54. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move-sync.js +56 -0
  55. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move.js +49 -0
  56. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/output-file/index.js +30 -0
  57. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js +18 -0
  58. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/remove/index.js +27 -0
  59. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/async.js +15 -0
  60. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js +131 -0
  61. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/utimes.js +34 -0
  62. package/dist/node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js +51 -0
  63. package/dist/node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js +171 -0
  64. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/base-theme.js +21 -0
  65. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/error.js +27 -0
  66. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/has-color.js +9 -0
  67. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/index.js +224 -0
  68. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/plumbing.js +48 -0
  69. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/process.js +8 -0
  70. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/progress-bar.js +46 -0
  71. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/render-template.js +155 -0
  72. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/set-immediate.js +14 -0
  73. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/set-interval.js +8 -0
  74. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/spin.js +10 -0
  75. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/template-item.js +58 -0
  76. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/theme-set.js +99 -0
  77. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/themes.js +67 -0
  78. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/wide-truncate.js +22 -0
  79. package/dist/node_modules/.pnpm/glob@7.2.3/node_modules/glob/common.js +162 -0
  80. package/dist/node_modules/.pnpm/glob@7.2.3/node_modules/glob/glob.js +451 -0
  81. package/dist/node_modules/.pnpm/glob@7.2.3/node_modules/glob/sync.js +280 -0
  82. package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js +20 -0
  83. package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js +362 -0
  84. package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js +92 -0
  85. package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js +255 -0
  86. package/dist/node_modules/.pnpm/has-unicode@2.0.1/node_modules/has-unicode/index.js +14 -0
  87. package/dist/node_modules/.pnpm/inflight@1.0.6/node_modules/inflight/inflight.js +45 -0
  88. package/dist/node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js +27 -0
  89. package/dist/node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js +14 -0
  90. package/dist/node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/index.js +68 -0
  91. package/dist/node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/utils.js +19 -0
  92. package/dist/node_modules/.pnpm/minimatch@3.1.5/node_modules/minimatch/minimatch.js +578 -0
  93. package/dist/node_modules/.pnpm/nodejieba@2.6.0/node_modules/nodejieba/index.js +46 -0
  94. package/dist/node_modules/.pnpm/nopt@5.0.0/node_modules/nopt/lib/nopt.js +330 -0
  95. package/dist/node_modules/.pnpm/npmlog@5.0.1/node_modules/npmlog/log.js +305 -0
  96. package/dist/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +54 -0
  97. package/dist/node_modules/.pnpm/once@1.4.0/node_modules/once/once.js +44 -0
  98. package/dist/node_modules/.pnpm/path-is-absolute@1.0.1/node_modules/path-is-absolute/index.js +19 -0
  99. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/errors-browser.js +88 -0
  100. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_duplex.js +75 -0
  101. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_passthrough.js +19 -0
  102. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_readable.js +666 -0
  103. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_transform.js +89 -0
  104. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_writable.js +423 -0
  105. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/async_iterator.js +172 -0
  106. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/buffer_list.js +243 -0
  107. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/destroy.js +77 -0
  108. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +87 -0
  109. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from-browser.js +10 -0
  110. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/pipeline.js +80 -0
  111. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/state.js +21 -0
  112. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/stream-browser.js +8 -0
  113. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/readable-browser.js +23 -0
  114. package/dist/node_modules/.pnpm/rimraf@3.0.2/node_modules/rimraf/rimraf.js +229 -0
  115. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js +79 -0
  116. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js +282 -0
  117. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js +186 -0
  118. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js +14 -0
  119. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js +41 -0
  120. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js +34 -0
  121. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js +15 -0
  122. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js +11 -0
  123. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js +11 -0
  124. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js +32 -0
  125. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js +11 -0
  126. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js +11 -0
  127. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js +11 -0
  128. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js +22 -0
  129. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js +11 -0
  130. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js +11 -0
  131. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js +11 -0
  132. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js +11 -0
  133. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js +11 -0
  134. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js +19 -0
  135. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js +11 -0
  136. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js +14 -0
  137. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js +11 -0
  138. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js +11 -0
  139. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js +18 -0
  140. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js +11 -0
  141. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js +14 -0
  142. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js +99 -0
  143. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js +28 -0
  144. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js +8 -0
  145. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js +23 -0
  146. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js +36 -0
  147. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js +15 -0
  148. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js +84 -0
  149. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js +11 -0
  150. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js +15 -0
  151. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js +11 -0
  152. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js +31 -0
  153. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js +31 -0
  154. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js +45 -0
  155. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js +64 -0
  156. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js +35 -0
  157. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js +102 -0
  158. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js +11 -0
  159. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js +17 -0
  160. package/dist/node_modules/.pnpm/set-blocking@2.0.0/node_modules/set-blocking/index.js +12 -0
  161. package/dist/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js +130 -0
  162. package/dist/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js +16 -0
  163. package/dist/node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js +30 -0
  164. package/dist/node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js +10 -0
  165. package/dist/node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js +26 -0
  166. package/dist/node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/browser.js +59 -0
  167. package/dist/node_modules/.pnpm/wide-align@1.1.5/node_modules/wide-align/align.js +52 -0
  168. package/dist/node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js +26 -0
  169. package/dist/tools.js +163 -3
  170. package/openclaw.plugin.json +1 -1
  171. package/package.json +15 -6
  172. package/skills/knowhere/SKILL.md +1 -1
  173. package/dist/__tests__/channel-route.test.d.ts +0 -1
  174. package/dist/__tests__/ingest-tool.test.d.ts +0 -1
  175. package/dist/__tests__/read-result-file-tool.test.d.ts +0 -1
  176. package/dist/__tests__/tracker-progress.test.d.ts +0 -1
  177. package/dist/channel-delivery.d.ts +0 -21
  178. package/dist/client.d.ts +0 -33
  179. package/dist/config.d.ts +0 -12
  180. package/dist/error-message.d.ts +0 -1
  181. package/dist/index.d.ts +0 -9
  182. package/dist/parser.d.ts +0 -16
  183. package/dist/session.d.ts +0 -11
  184. package/dist/store.d.ts +0 -79
  185. package/dist/text.d.ts +0 -10
  186. package/dist/tools.d.ts +0 -8
  187. package/dist/tracker-progress.d.ts +0 -10
  188. package/dist/types.d.ts +0 -248
@@ -0,0 +1,11 @@
1
+ import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
2
+ import { require_range } from "../classes/range.js";
3
+ //#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js
4
+ var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ const Range = require_range();
6
+ const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
7
+ module.exports = toComparators;
8
+ }));
9
+ //#endregion
10
+ export default require_to_comparators();
11
+ export { require_to_comparators };
@@ -0,0 +1,17 @@
1
+ import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
2
+ import { require_range } from "../classes/range.js";
3
+ //#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js
4
+ var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ const Range = require_range();
6
+ const validRange = (range, options) => {
7
+ try {
8
+ return new Range(range, options).range || "*";
9
+ } catch (er) {
10
+ return null;
11
+ }
12
+ };
13
+ module.exports = validRange;
14
+ }));
15
+ //#endregion
16
+ export default require_valid();
17
+ export { require_valid };
@@ -0,0 +1,12 @@
1
+ import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region node_modules/.pnpm/set-blocking@2.0.0/node_modules/set-blocking/index.js
3
+ var require_set_blocking = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ module.exports = function(blocking) {
5
+ [process.stdout, process.stderr].forEach(function(stream) {
6
+ if (stream._handle && stream.isTTY && typeof stream._handle.setBlocking === "function") stream._handle.setBlocking(blocking);
7
+ });
8
+ };
9
+ }));
10
+ //#endregion
11
+ export default require_set_blocking();
12
+ export { require_set_blocking };
@@ -0,0 +1,130 @@
1
+ import { __commonJSMin, __require } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ import { require_signals } from "./signals.js";
3
+ //#region node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
4
+ var require_signal_exit = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ var process = global.process;
6
+ const processOk = function(process) {
7
+ return process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
8
+ };
9
+ /* istanbul ignore if */
10
+ if (!processOk(process)) module.exports = function() {
11
+ return function() {};
12
+ };
13
+ else {
14
+ var assert = __require("assert");
15
+ var signals = require_signals();
16
+ var isWin = /^win/i.test(process.platform);
17
+ var EE = __require("events");
18
+ /* istanbul ignore if */
19
+ if (typeof EE !== "function") EE = EE.EventEmitter;
20
+ var emitter;
21
+ if (process.__signal_exit_emitter__) emitter = process.__signal_exit_emitter__;
22
+ else {
23
+ emitter = process.__signal_exit_emitter__ = new EE();
24
+ emitter.count = 0;
25
+ emitter.emitted = {};
26
+ }
27
+ if (!emitter.infinite) {
28
+ emitter.setMaxListeners(Infinity);
29
+ emitter.infinite = true;
30
+ }
31
+ module.exports = function(cb, opts) {
32
+ /* istanbul ignore if */
33
+ if (!processOk(global.process)) return function() {};
34
+ assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
35
+ if (loaded === false) load();
36
+ var ev = "exit";
37
+ if (opts && opts.alwaysLast) ev = "afterexit";
38
+ var remove = function() {
39
+ emitter.removeListener(ev, cb);
40
+ if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) unload();
41
+ };
42
+ emitter.on(ev, cb);
43
+ return remove;
44
+ };
45
+ var unload = function unload() {
46
+ if (!loaded || !processOk(global.process)) return;
47
+ loaded = false;
48
+ signals.forEach(function(sig) {
49
+ try {
50
+ process.removeListener(sig, sigListeners[sig]);
51
+ } catch (er) {}
52
+ });
53
+ process.emit = originalProcessEmit;
54
+ process.reallyExit = originalProcessReallyExit;
55
+ emitter.count -= 1;
56
+ };
57
+ module.exports.unload = unload;
58
+ var emit = function emit(event, code, signal) {
59
+ /* istanbul ignore if */
60
+ if (emitter.emitted[event]) return;
61
+ emitter.emitted[event] = true;
62
+ emitter.emit(event, code, signal);
63
+ };
64
+ var sigListeners = {};
65
+ signals.forEach(function(sig) {
66
+ sigListeners[sig] = function listener() {
67
+ /* istanbul ignore if */
68
+ if (!processOk(global.process)) return;
69
+ if (process.listeners(sig).length === emitter.count) {
70
+ unload();
71
+ emit("exit", null, sig);
72
+ /* istanbul ignore next */
73
+ emit("afterexit", null, sig);
74
+ /* istanbul ignore next */
75
+ if (isWin && sig === "SIGHUP") sig = "SIGINT";
76
+ /* istanbul ignore next */
77
+ process.kill(process.pid, sig);
78
+ }
79
+ };
80
+ });
81
+ module.exports.signals = function() {
82
+ return signals;
83
+ };
84
+ var loaded = false;
85
+ var load = function load() {
86
+ if (loaded || !processOk(global.process)) return;
87
+ loaded = true;
88
+ emitter.count += 1;
89
+ signals = signals.filter(function(sig) {
90
+ try {
91
+ process.on(sig, sigListeners[sig]);
92
+ return true;
93
+ } catch (er) {
94
+ return false;
95
+ }
96
+ });
97
+ process.emit = processEmit;
98
+ process.reallyExit = processReallyExit;
99
+ };
100
+ module.exports.load = load;
101
+ var originalProcessReallyExit = process.reallyExit;
102
+ var processReallyExit = function processReallyExit(code) {
103
+ /* istanbul ignore if */
104
+ if (!processOk(global.process)) return;
105
+ process.exitCode = code || 0;
106
+ emit("exit", process.exitCode, null);
107
+ /* istanbul ignore next */
108
+ emit("afterexit", process.exitCode, null);
109
+ /* istanbul ignore next */
110
+ originalProcessReallyExit.call(process, process.exitCode);
111
+ };
112
+ var originalProcessEmit = process.emit;
113
+ var processEmit = function processEmit(ev, arg) {
114
+ if (ev === "exit" && processOk(global.process)) {
115
+ /* istanbul ignore else */
116
+ if (arg !== void 0) process.exitCode = arg;
117
+ var ret = originalProcessEmit.apply(this, arguments);
118
+ /* istanbul ignore next */
119
+ emit("exit", process.exitCode, null);
120
+ /* istanbul ignore next */
121
+ emit("afterexit", process.exitCode, null);
122
+ /* istanbul ignore next */
123
+ return ret;
124
+ } else return originalProcessEmit.apply(this, arguments);
125
+ };
126
+ }
127
+ }));
128
+ //#endregion
129
+ export default require_signal_exit();
130
+ export { require_signal_exit };
@@ -0,0 +1,16 @@
1
+ import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js
3
+ var require_signals = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ module.exports = [
5
+ "SIGABRT",
6
+ "SIGALRM",
7
+ "SIGHUP",
8
+ "SIGINT",
9
+ "SIGTERM"
10
+ ];
11
+ if (process.platform !== "win32") module.exports.push("SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
12
+ if (process.platform === "linux") module.exports.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT", "SIGUNUSED");
13
+ }));
14
+ //#endregion
15
+ export default require_signals();
16
+ export { require_signals };
@@ -0,0 +1,30 @@
1
+ import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ import { require_strip_ansi } from "../../../strip-ansi@6.0.1/node_modules/strip-ansi/index.js";
3
+ import { require_is_fullwidth_code_point } from "../../../is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js";
4
+ import { require_emoji_regex } from "../../../emoji-regex@8.0.0/node_modules/emoji-regex/index.js";
5
+ //#region node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js
6
+ var require_string_width = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7
+ const stripAnsi = require_strip_ansi();
8
+ const isFullwidthCodePoint = require_is_fullwidth_code_point();
9
+ const emojiRegex = require_emoji_regex();
10
+ const stringWidth = (string) => {
11
+ if (typeof string !== "string" || string.length === 0) return 0;
12
+ string = stripAnsi(string);
13
+ if (string.length === 0) return 0;
14
+ string = string.replace(emojiRegex(), " ");
15
+ let width = 0;
16
+ for (let i = 0; i < string.length; i++) {
17
+ const code = string.codePointAt(i);
18
+ if (code <= 31 || code >= 127 && code <= 159) continue;
19
+ if (code >= 768 && code <= 879) continue;
20
+ if (code > 65535) i++;
21
+ width += isFullwidthCodePoint(code) ? 2 : 1;
22
+ }
23
+ return width;
24
+ };
25
+ module.exports = stringWidth;
26
+ module.exports.default = stringWidth;
27
+ }));
28
+ //#endregion
29
+ export default require_string_width();
30
+ export { require_string_width };
@@ -0,0 +1,10 @@
1
+ import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ import { require_ansi_regex } from "../../../ansi-regex@5.0.1/node_modules/ansi-regex/index.js";
3
+ //#region node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js
4
+ var require_strip_ansi = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ const ansiRegex = require_ansi_regex();
6
+ module.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
7
+ }));
8
+ //#endregion
9
+ export default require_strip_ansi();
10
+ export { require_strip_ansi };
@@ -0,0 +1,26 @@
1
+ import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js
3
+ var require_universalify = /* @__PURE__ */ __commonJSMin(((exports) => {
4
+ exports.fromCallback = function(fn) {
5
+ return Object.defineProperty(function(...args) {
6
+ if (typeof args[args.length - 1] === "function") fn.apply(this, args);
7
+ else return new Promise((resolve, reject) => {
8
+ args.push((err, res) => err != null ? reject(err) : resolve(res));
9
+ fn.apply(this, args);
10
+ });
11
+ }, "name", { value: fn.name });
12
+ };
13
+ exports.fromPromise = function(fn) {
14
+ return Object.defineProperty(function(...args) {
15
+ const cb = args[args.length - 1];
16
+ if (typeof cb !== "function") return fn.apply(this, args);
17
+ else {
18
+ args.pop();
19
+ fn.apply(this, args).then((r) => cb(null, r), cb);
20
+ }
21
+ }, "name", { value: fn.name });
22
+ };
23
+ }));
24
+ //#endregion
25
+ export default require_universalify();
26
+ export { require_universalify };
@@ -0,0 +1,59 @@
1
+ import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/browser.js
3
+ var require_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ /**
5
+ * Module exports.
6
+ */
7
+ module.exports = deprecate;
8
+ /**
9
+ * Mark that a method should not be used.
10
+ * Returns a modified function which warns once by default.
11
+ *
12
+ * If `localStorage.noDeprecation = true` is set, then it is a no-op.
13
+ *
14
+ * If `localStorage.throwDeprecation = true` is set, then deprecated functions
15
+ * will throw an Error when invoked.
16
+ *
17
+ * If `localStorage.traceDeprecation = true` is set, then deprecated functions
18
+ * will invoke `console.trace()` instead of `console.error()`.
19
+ *
20
+ * @param {Function} fn - the function to deprecate
21
+ * @param {String} msg - the string to print to the console when `fn` is invoked
22
+ * @returns {Function} a new "deprecated" version of `fn`
23
+ * @api public
24
+ */
25
+ function deprecate(fn, msg) {
26
+ if (config("noDeprecation")) return fn;
27
+ var warned = false;
28
+ function deprecated() {
29
+ if (!warned) {
30
+ if (config("throwDeprecation")) throw new Error(msg);
31
+ else if (config("traceDeprecation")) console.trace(msg);
32
+ else console.warn(msg);
33
+ warned = true;
34
+ }
35
+ return fn.apply(this, arguments);
36
+ }
37
+ return deprecated;
38
+ }
39
+ /**
40
+ * Checks `localStorage` for boolean values for the given `name`.
41
+ *
42
+ * @param {String} name
43
+ * @returns {Boolean}
44
+ * @api private
45
+ */
46
+ function config(name) {
47
+ try {
48
+ if (!global.localStorage) return false;
49
+ } catch (_) {
50
+ return false;
51
+ }
52
+ var val = global.localStorage[name];
53
+ if (null == val) return false;
54
+ return String(val).toLowerCase() === "true";
55
+ }
56
+ }));
57
+ //#endregion
58
+ export default require_browser();
59
+ export { require_browser };
@@ -0,0 +1,52 @@
1
+ import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ import { require_string_width } from "../../../string-width@4.2.3/node_modules/string-width/index.js";
3
+ //#region node_modules/.pnpm/wide-align@1.1.5/node_modules/wide-align/align.js
4
+ var require_align = /* @__PURE__ */ __commonJSMin(((exports) => {
5
+ var stringWidth = require_string_width();
6
+ exports.center = alignCenter;
7
+ exports.left = alignLeft;
8
+ exports.right = alignRight;
9
+ function createPadding(width) {
10
+ var result = "";
11
+ var string = " ";
12
+ var n = width;
13
+ do {
14
+ if (n % 2) result += string;
15
+ n = Math.floor(n / 2);
16
+ string += string;
17
+ } while (n);
18
+ return result;
19
+ }
20
+ function alignLeft(str, width) {
21
+ var trimmed = str.trimRight();
22
+ if (trimmed.length === 0 && str.length >= width) return str;
23
+ var padding = "";
24
+ var strWidth = stringWidth(trimmed);
25
+ if (strWidth < width) padding = createPadding(width - strWidth);
26
+ return trimmed + padding;
27
+ }
28
+ function alignRight(str, width) {
29
+ var trimmed = str.trimLeft();
30
+ if (trimmed.length === 0 && str.length >= width) return str;
31
+ var padding = "";
32
+ var strWidth = stringWidth(trimmed);
33
+ if (strWidth < width) padding = createPadding(width - strWidth);
34
+ return padding + trimmed;
35
+ }
36
+ function alignCenter(str, width) {
37
+ var trimmed = str.trim();
38
+ if (trimmed.length === 0 && str.length >= width) return str;
39
+ var padLeft = "";
40
+ var padRight = "";
41
+ var strWidth = stringWidth(trimmed);
42
+ if (strWidth < width) {
43
+ var padLeftBy = parseInt((width - strWidth) / 2, 10);
44
+ padLeft = createPadding(padLeftBy);
45
+ padRight = createPadding(width - (strWidth + padLeftBy));
46
+ }
47
+ return padLeft + trimmed + padRight;
48
+ }
49
+ }));
50
+ //#endregion
51
+ export default require_align();
52
+ export { require_align };
@@ -0,0 +1,26 @@
1
+ import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js
3
+ var require_wrappy = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ module.exports = wrappy;
5
+ function wrappy(fn, cb) {
6
+ if (fn && cb) return wrappy(fn)(cb);
7
+ if (typeof fn !== "function") throw new TypeError("need wrapper function");
8
+ Object.keys(fn).forEach(function(k) {
9
+ wrapper[k] = fn[k];
10
+ });
11
+ return wrapper;
12
+ function wrapper() {
13
+ var args = new Array(arguments.length);
14
+ for (var i = 0; i < args.length; i++) args[i] = arguments[i];
15
+ var ret = fn.apply(this, args);
16
+ var cb = args[args.length - 1];
17
+ if (typeof ret === "function" && ret !== cb) Object.keys(cb).forEach(function(k) {
18
+ ret[k] = cb[k];
19
+ });
20
+ return ret;
21
+ }
22
+ }
23
+ }));
24
+ //#endregion
25
+ export default require_wrappy();
26
+ export { require_wrappy };
package/dist/tools.js CHANGED
@@ -9,6 +9,45 @@ import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/core";
11
11
  //#region src/tools.ts
12
+ async function buildKnowledgeGraphAsync(params) {
13
+ const docDir = path.join(params.scope.documentsDir, params.docId);
14
+ const metadataPath = path.join(docDir, "metadata.json");
15
+ let payload = null;
16
+ try {
17
+ payload = await fs.readFile(metadataPath, "utf-8");
18
+ } catch {
19
+ payload = null;
20
+ }
21
+ if (!payload) {
22
+ params.api.logger.warn(`knowhere: cannot build KG, metadata not found for docId=${params.docId}`);
23
+ return;
24
+ }
25
+ const payloadData = JSON.parse(payload);
26
+ const fullMarkdownPath = path.join(docDir, "full_markdown.txt");
27
+ let fullMarkdown = "";
28
+ try {
29
+ fullMarkdown = await fs.readFile(fullMarkdownPath, "utf-8");
30
+ } catch {
31
+ params.api.logger.warn(`knowhere: full_markdown.txt not found for docId=${params.docId}, using empty content`);
32
+ }
33
+ const keywords = await params.kgService.extractKeywords(fullMarkdown, 20);
34
+ await params.kgService.saveDocumentToKb({
35
+ kbId: params.kbId,
36
+ docId: params.docId,
37
+ sourcePath: docDir,
38
+ keywords,
39
+ metadata: {
40
+ title: payloadData.document?.title || "Untitled",
41
+ sourceLabel: payloadData.document?.sourceLabel || "Unknown",
42
+ checksum: params.documentPayload.downloadedResult.rawZipSha1,
43
+ ingestedAt: (/* @__PURE__ */ new Date()).toISOString()
44
+ }
45
+ });
46
+ await params.kgService.scheduleBuild(params.kbId, async () => {
47
+ await params.kgService.buildKnowledgeGraph(params.kbId);
48
+ });
49
+ params.api.logger.info(`knowhere: knowledge graph build completed kbId=${params.kbId} docId=${params.docId}`);
50
+ }
12
51
  const PREVIEW_SUMMARY_MAX_CHARS = 120;
13
52
  const INGEST_TRACKER_LANGUAGES = new Set(["ch", "en"]);
14
53
  function textResult(text) {
@@ -492,7 +531,7 @@ function createIngestTool(params) {
492
531
  return {
493
532
  name: "knowhere_ingest_document",
494
533
  label: "Knowhere Ingest",
495
- description: "Parse a local file or remote URL with Knowhere and store the result in the current scope. Before calling this for a document that might already be stored in the current scope, use knowhere_list_documents and reuse the existing stored document when Source, File, or Title clearly match unless the user explicitly asks for a fresh parse or overwrite. When the user provides a URL to a document (PDF link, web page, etc.), pass it as the url parameter — Knowhere fetches it directly, no local download needed. Returns immediately with a job ID while parsing continues in the background. Use knowhere_get_job_status to check progress at any time. Use lang to control the language of the direct tracker follow-up (`en` by default, `ch` for Chinese). Provide either filePath or url, not both.",
534
+ description: "Parse a local file or remote URL with Knowhere and store the result in the current scope. Before calling this for a document that might already be stored in the current scope, use knowhere_list_documents and reuse the existing stored document when Source, File, or Title clearly match unless the user explicitly asks for a fresh parse or overwrite. When the user provides a URL to a document (PDF link, web page, etc.), pass it as the url parameter — Knowhere fetches it directly, no local download needed. Returns immediately with a job ID while parsing continues in the background. Use knowhere_get_job_status only when the current turn needs the parsed result. Use lang to control the language of any user-facing background status update (`en` by default, `ch` for Chinese). Provide either filePath or url, not both.",
496
535
  parameters: {
497
536
  type: "object",
498
537
  additionalProperties: false,
@@ -536,7 +575,7 @@ function createIngestTool(params) {
536
575
  },
537
576
  lang: {
538
577
  type: "string",
539
- description: "Language for the direct tracker follow-up message sent after background parsing completes or fails. Supports en and ch; unsupported values fall back to en."
578
+ description: "Language for any user-facing background status update sent after parsing completes or fails. Supports en and ch; unsupported values fall back to en."
540
579
  },
541
580
  parsing: {
542
581
  type: "object",
@@ -629,6 +668,25 @@ function createIngestTool(params) {
629
668
  downloadedResult: ingestResult.downloadedResult
630
669
  }, { overwrite });
631
670
  params.api.logger.info(`knowhere: knowhere_ingest_document stored document scope=${scope.label} jobId=${ingestResult.job.job_id} docId=${storedDocument.id} label=${JSON.stringify(progressLabel)}`);
671
+ if (params.kgService.isEnabled()) {
672
+ const kbId = params.kgService.resolveKbId(params.ctx);
673
+ if (kbId) {
674
+ params.api.logger.info(`knowhere: initiating knowledge graph build kbId=${kbId} docId=${storedDocument.id}`);
675
+ buildKnowledgeGraphAsync({
676
+ kgService: params.kgService,
677
+ kbId,
678
+ docId: storedDocument.id,
679
+ documentPayload: ingestResult,
680
+ scope,
681
+ ctx: params.ctx,
682
+ api: params.api,
683
+ channelRoute,
684
+ sessionKey
685
+ }).catch((kgError) => {
686
+ params.api.logger.error(`knowhere: knowledge graph build failed kbId=${kbId} docId=${storedDocument.id}: ${formatErrorMessage(kgError)}`);
687
+ });
688
+ }
689
+ }
632
690
  await notifyBackgroundIngestOutcome({
633
691
  api: params.api,
634
692
  context: params.ctx,
@@ -679,7 +737,7 @@ function createIngestTool(params) {
679
737
  `Job ID: ${createdJob.job_id}`,
680
738
  `File: ${progressLabel}`,
681
739
  `Scope: ${scope.label}`,
682
- "Use knowhere_get_job_status to check progress at any time."
740
+ "Use knowhere_get_job_status only if this turn needs the parsed result."
683
741
  ].join("\n"));
684
742
  }
685
743
  };
@@ -1479,12 +1537,104 @@ function createSetApiKeyTool(params) {
1479
1537
  }
1480
1538
  };
1481
1539
  }
1540
+ function createKgListTool(params) {
1541
+ return {
1542
+ name: "knowhere_kg_list",
1543
+ label: "Knowhere KG List",
1544
+ description: "List all available knowledge bases with optional statistics. Returns knowledge base IDs, document counts, and graph metadata.",
1545
+ parameters: {
1546
+ type: "object",
1547
+ additionalProperties: false,
1548
+ properties: { includeStats: {
1549
+ type: "boolean",
1550
+ description: "Include document count and graph statistics"
1551
+ } }
1552
+ },
1553
+ execute: async (_toolCallId, rawParams) => {
1554
+ const includeStats = readBoolean((isRecord(rawParams) ? rawParams : {}).includeStats, false);
1555
+ if (!params.kgService.isEnabled()) return textResult("Knowledge graph is disabled or unavailable.");
1556
+ params.api.logger.info(`knowhere: knowhere_kg_list listing knowledge bases includeStats=${includeStats}`);
1557
+ const kbIds = await params.kgService.listKnowledgeBases();
1558
+ if (kbIds.length === 0) return textResult("No knowledge bases found.");
1559
+ const lines = [`Found ${kbIds.length} knowledge base(s):`, ""];
1560
+ if (includeStats) {
1561
+ const statsPromises = kbIds.map(async (kbId) => {
1562
+ return {
1563
+ kbId,
1564
+ metadata: await params.kgService.getKbMetadata(kbId)
1565
+ };
1566
+ });
1567
+ const stats = await Promise.all(statsPromises);
1568
+ for (const { kbId, metadata } of stats) {
1569
+ lines.push(`- ${kbId}`);
1570
+ if (metadata) {
1571
+ lines.push(` Documents: ${metadata.documentCount || 0}`);
1572
+ lines.push(` Created: ${metadata.createdAt || "unknown"}`);
1573
+ lines.push(` Last updated: ${metadata.lastUpdated || "unknown"}`);
1574
+ }
1575
+ }
1576
+ } else for (const kbId of kbIds) lines.push(`- ${kbId}`);
1577
+ return textResult(lines.join("\n"));
1578
+ }
1579
+ };
1580
+ }
1581
+ function createKgQueryTool(params) {
1582
+ return {
1583
+ name: "knowhere_kg_query",
1584
+ label: "Knowhere KG Query",
1585
+ description: "Query the knowledge graph for file-level connections and document relationships. Returns the complete knowledge graph structure with file metadata, top keywords, importance scores, and cross-file edges.",
1586
+ parameters: {
1587
+ type: "object",
1588
+ additionalProperties: false,
1589
+ properties: {
1590
+ kbId: {
1591
+ type: "string",
1592
+ description: "Knowledge base ID to query"
1593
+ },
1594
+ fileKey: {
1595
+ type: "string",
1596
+ description: "Optional: Filter edges for a specific file (e.g., 'report.docx')"
1597
+ }
1598
+ },
1599
+ required: ["kbId"]
1600
+ },
1601
+ execute: async (_toolCallId, rawParams) => {
1602
+ const paramsRecord = isRecord(rawParams) ? rawParams : {};
1603
+ const kbId = readString(paramsRecord.kbId);
1604
+ const fileKey = readString(paramsRecord.fileKey);
1605
+ if (!kbId) throw new Error("kbId is required.");
1606
+ if (!params.kgService.isEnabled()) return textResult("Knowledge graph is disabled or unavailable.");
1607
+ params.api.logger.info(`knowhere: knowhere_kg_query querying graph kbId=${kbId} fileKey=${fileKey || "all"}`);
1608
+ const graph = await params.kgService.getKnowledgeGraph(kbId);
1609
+ if (!graph) return textResult(`Knowledge graph not found for knowledge base ${kbId}.`);
1610
+ let edges = graph.edges;
1611
+ if (fileKey) {
1612
+ edges = edges.filter((edge) => edge.source === fileKey || edge.target === fileKey);
1613
+ if (edges.length === 0) return textResult(`No connections found for file ${fileKey} in knowledge base ${kbId}.`);
1614
+ }
1615
+ return formatJsonToolResult({
1616
+ kbId,
1617
+ version: graph.version,
1618
+ stats: graph.stats,
1619
+ files: graph.files,
1620
+ edges: edges.map((edge) => ({
1621
+ source: edge.source,
1622
+ target: edge.target,
1623
+ connection_count: edge.connection_count,
1624
+ avg_score: edge.avg_score,
1625
+ top_connections: edge.top_connections
1626
+ }))
1627
+ });
1628
+ }
1629
+ };
1630
+ }
1482
1631
  function createKnowhereToolFactory(params) {
1483
1632
  return (ctx) => [
1484
1633
  createIngestTool({
1485
1634
  api: params.api,
1486
1635
  config: params.config,
1487
1636
  store: params.store,
1637
+ kgService: params.kgService,
1488
1638
  ctx
1489
1639
  }),
1490
1640
  createJobListTool({
@@ -1538,6 +1688,16 @@ function createKnowhereToolFactory(params) {
1538
1688
  createSetApiKeyTool({
1539
1689
  api: params.api,
1540
1690
  config: params.config
1691
+ }),
1692
+ createKgListTool({
1693
+ api: params.api,
1694
+ kgService: params.kgService,
1695
+ ctx
1696
+ }),
1697
+ createKgQueryTool({
1698
+ api: params.api,
1699
+ kgService: params.kgService,
1700
+ ctx
1541
1701
  })
1542
1702
  ];
1543
1703
  }
@@ -3,7 +3,7 @@
3
3
  "name": "Knowhere",
4
4
  "description": "Parse documents with Knowhere and expose the stored result as tool-queryable document state for OpenClaw agents.",
5
5
  "skills": ["./skills"],
6
- "version": "0.1.4",
6
+ "version": "0.1.5",
7
7
  "uiHints": {
8
8
  "apiKey": {
9
9
  "label": "Knowhere API Key",