@ontos-ai/knowhere-claw 0.2.1 → 0.2.2-beta.1

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 (222) hide show
  1. package/README.md +1 -1
  2. package/dist/_virtual/_rolldown/runtime.js +1 -35
  3. package/dist/client.js +1 -1
  4. package/dist/graph-builder.js +8 -4
  5. package/dist/kg-service.js +25 -28
  6. package/dist/parser.js +1 -1
  7. package/dist/tools.js +123 -34
  8. package/openclaw.plugin.json +1 -1
  9. package/package.json +3 -2
  10. package/skills/knowhere/SKILL.md +14 -9
  11. package/dist/node_modules/.pnpm/@knowhere-ai_sdk@0.1.1/node_modules/@knowhere-ai/sdk/dist/index.js +0 -717
  12. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js +0 -212
  13. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/pre-binding.js +0 -35
  14. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/abi_crosswalk.js +0 -2609
  15. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/napi.js +0 -142
  16. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js +0 -103
  17. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js +0 -199
  18. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/package.js +0 -67
  19. package/dist/node_modules/.pnpm/abbrev@1.1.1/node_modules/abbrev/abbrev.js +0 -59
  20. package/dist/node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js +0 -11
  21. package/dist/node_modules/.pnpm/aproba@2.1.0/node_modules/aproba/index.js +0 -119
  22. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/index.js +0 -13
  23. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker-base.js +0 -16
  24. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker-group.js +0 -98
  25. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker-stream.js +0 -37
  26. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker.js +0 -32
  27. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/adapters.js +0 -83
  28. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/fetch.js +0 -170
  29. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/xhr.js +0 -106
  30. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/axios.js +0 -57
  31. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/CancelToken.js +0 -90
  32. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/CanceledError.js +0 -20
  33. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/isCancel.js +0 -6
  34. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/Axios.js +0 -174
  35. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/AxiosError.js +0 -70
  36. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/AxiosHeaders.js +0 -204
  37. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/InterceptorManager.js +0 -60
  38. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/buildFullPath.js +0 -20
  39. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/dispatchRequest.js +0 -52
  40. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/mergeConfig.js +0 -81
  41. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/settle.js +0 -18
  42. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/transformData.js +0 -25
  43. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/defaults/index.js +0 -107
  44. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/defaults/transitional.js +0 -9
  45. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/env/data.js +0 -4
  46. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -50
  47. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -77
  48. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/bind.js +0 -15
  49. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/buildURL.js +0 -40
  50. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/combineURLs.js +0 -14
  51. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/composeSignals.js +0 -39
  52. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/cookies.js +0 -31
  53. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/formDataToJSON.js +0 -67
  54. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -14
  55. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
  56. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -8
  57. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/parseHeaders.js +0 -53
  58. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/parseProtocol.js +0 -7
  59. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/progressEventReducer.js +0 -38
  60. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/resolveConfig.js +0 -36
  61. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/speedometer.js +0 -36
  62. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/spread.js +0 -29
  63. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/throttle.js +0 -38
  64. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/toFormData.js +0 -151
  65. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -18
  66. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/trackStream.js +0 -69
  67. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/validator.js +0 -76
  68. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -4
  69. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -4
  70. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -5
  71. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/index.js +0 -22
  72. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/common/utils.js +0 -46
  73. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/index.js +0 -9
  74. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/utils.js +0 -698
  75. package/dist/node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js +0 -53
  76. package/dist/node_modules/.pnpm/brace-expansion@1.1.12/node_modules/brace-expansion/index.js +0 -132
  77. package/dist/node_modules/.pnpm/color-support@1.1.3/node_modules/color-support/browser.js +0 -18
  78. package/dist/node_modules/.pnpm/concat-map@0.0.1/node_modules/concat-map/index.js +0 -19
  79. package/dist/node_modules/.pnpm/console-control-strings@1.1.0/node_modules/console-control-strings/index.js +0 -104
  80. package/dist/node_modules/.pnpm/delegates@1.0.0/node_modules/delegates/index.js +0 -104
  81. package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/detect-libc.js +0 -221
  82. package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/elf.js +0 -26
  83. package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/filesystem.js +0 -48
  84. package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/process.js +0 -24
  85. package/dist/node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js +0 -10
  86. package/dist/node_modules/.pnpm/fflate@0.8.2/node_modules/fflate/esm/browser.js +0 -426
  87. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy-sync.js +0 -120
  88. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy.js +0 -100
  89. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/index.js +0 -15
  90. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/empty/index.js +0 -43
  91. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/file.js +0 -53
  92. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/index.js +0 -27
  93. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/link.js +0 -56
  94. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-paths.js +0 -89
  95. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-type.js +0 -35
  96. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink.js +0 -81
  97. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js +0 -113
  98. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/index.js +0 -29
  99. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/index.js +0 -22
  100. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/jsonfile.js +0 -15
  101. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json-sync.js +0 -15
  102. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json.js +0 -15
  103. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js +0 -20
  104. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/make-dir.js +0 -33
  105. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/utils.js +0 -17
  106. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/index.js +0 -15
  107. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move-sync.js +0 -56
  108. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move.js +0 -49
  109. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/output-file/index.js +0 -30
  110. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js +0 -18
  111. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/remove/index.js +0 -27
  112. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/async.js +0 -15
  113. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js +0 -131
  114. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/utimes.js +0 -34
  115. package/dist/node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js +0 -51
  116. package/dist/node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js +0 -171
  117. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/base-theme.js +0 -21
  118. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/error.js +0 -27
  119. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/has-color.js +0 -9
  120. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/index.js +0 -224
  121. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/plumbing.js +0 -48
  122. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/process.js +0 -8
  123. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/progress-bar.js +0 -46
  124. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/render-template.js +0 -155
  125. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/set-immediate.js +0 -14
  126. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/set-interval.js +0 -8
  127. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/spin.js +0 -10
  128. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/template-item.js +0 -58
  129. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/theme-set.js +0 -99
  130. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/themes.js +0 -67
  131. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/wide-truncate.js +0 -22
  132. package/dist/node_modules/.pnpm/glob@7.2.3/node_modules/glob/common.js +0 -162
  133. package/dist/node_modules/.pnpm/glob@7.2.3/node_modules/glob/glob.js +0 -451
  134. package/dist/node_modules/.pnpm/glob@7.2.3/node_modules/glob/sync.js +0 -280
  135. package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js +0 -20
  136. package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js +0 -362
  137. package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js +0 -92
  138. package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js +0 -255
  139. package/dist/node_modules/.pnpm/has-unicode@2.0.1/node_modules/has-unicode/index.js +0 -14
  140. package/dist/node_modules/.pnpm/inflight@1.0.6/node_modules/inflight/inflight.js +0 -45
  141. package/dist/node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js +0 -27
  142. package/dist/node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js +0 -14
  143. package/dist/node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/index.js +0 -68
  144. package/dist/node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/utils.js +0 -19
  145. package/dist/node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js +0 -3110
  146. package/dist/node_modules/.pnpm/minimatch@3.1.5/node_modules/minimatch/minimatch.js +0 -578
  147. package/dist/node_modules/.pnpm/nodejieba@2.6.0/node_modules/nodejieba/index.js +0 -46
  148. package/dist/node_modules/.pnpm/nopt@5.0.0/node_modules/nopt/lib/nopt.js +0 -330
  149. package/dist/node_modules/.pnpm/npmlog@5.0.1/node_modules/npmlog/log.js +0 -305
  150. package/dist/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +0 -54
  151. package/dist/node_modules/.pnpm/once@1.4.0/node_modules/once/once.js +0 -44
  152. package/dist/node_modules/.pnpm/path-is-absolute@1.0.1/node_modules/path-is-absolute/index.js +0 -19
  153. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/errors-browser.js +0 -88
  154. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_duplex.js +0 -75
  155. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_passthrough.js +0 -19
  156. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_readable.js +0 -666
  157. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_transform.js +0 -89
  158. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_writable.js +0 -423
  159. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/async_iterator.js +0 -172
  160. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/buffer_list.js +0 -243
  161. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -77
  162. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +0 -87
  163. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from-browser.js +0 -10
  164. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/pipeline.js +0 -80
  165. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/state.js +0 -21
  166. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -8
  167. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/readable-browser.js +0 -23
  168. package/dist/node_modules/.pnpm/rimraf@3.0.2/node_modules/rimraf/rimraf.js +0 -229
  169. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js +0 -79
  170. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js +0 -282
  171. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js +0 -186
  172. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js +0 -14
  173. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js +0 -41
  174. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js +0 -34
  175. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js +0 -15
  176. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js +0 -11
  177. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js +0 -11
  178. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js +0 -32
  179. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js +0 -11
  180. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js +0 -11
  181. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js +0 -11
  182. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js +0 -22
  183. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js +0 -11
  184. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js +0 -11
  185. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js +0 -11
  186. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js +0 -11
  187. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js +0 -11
  188. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js +0 -19
  189. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js +0 -11
  190. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js +0 -14
  191. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js +0 -11
  192. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js +0 -11
  193. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js +0 -18
  194. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js +0 -11
  195. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js +0 -14
  196. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js +0 -99
  197. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js +0 -28
  198. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js +0 -8
  199. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js +0 -23
  200. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js +0 -36
  201. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js +0 -15
  202. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js +0 -84
  203. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js +0 -11
  204. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js +0 -15
  205. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js +0 -11
  206. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js +0 -31
  207. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js +0 -31
  208. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js +0 -45
  209. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js +0 -64
  210. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js +0 -35
  211. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js +0 -102
  212. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js +0 -11
  213. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js +0 -17
  214. package/dist/node_modules/.pnpm/set-blocking@2.0.0/node_modules/set-blocking/index.js +0 -12
  215. package/dist/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js +0 -130
  216. package/dist/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js +0 -16
  217. package/dist/node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js +0 -30
  218. package/dist/node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js +0 -10
  219. package/dist/node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js +0 -26
  220. package/dist/node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/browser.js +0 -59
  221. package/dist/node_modules/.pnpm/wide-align@1.1.5/node_modules/wide-align/align.js +0 -52
  222. package/dist/node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js +0 -26
package/README.md CHANGED
@@ -116,7 +116,7 @@ Within each scope, the plugin keeps:
116
116
  ## Common Workflow
117
117
 
118
118
  1. Provide a file path or URL to the agent.
119
- 2. The agent ingests it into Knowhere and waits for the parse to finish.
119
+ 2. The agent ingests it into Knowhere. By default this starts parsing asynchronously and returns a job ID; when the current turn needs the parsed result immediately, the agent can call `knowhere_ingest_document` with `blockUntilComplete: true`.
120
120
  3. Follow-up questions reuse stored results from the current scope.
121
121
  4. When needed, the agent can preview structure, search chunks, read raw result
122
122
  files, or clear stored documents.
@@ -1,38 +1,4 @@
1
1
  //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
2
  var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
9
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
10
- var __exportAll = (all, no_symbols) => {
11
- let target = {};
12
- for (var name in all) __defProp(target, name, {
13
- get: all[name],
14
- enumerable: true
15
- });
16
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
17
- return target;
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
21
- key = keys[i];
22
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
23
- get: ((k) => from[k]).bind(null, key),
24
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
25
- });
26
- }
27
- return to;
28
- };
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
32
- }) : target, mod));
33
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
34
- if (typeof require !== "undefined") return require.apply(this, arguments);
35
- throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
36
- });
37
3
  //#endregion
38
- export { __commonJSMin, __esmMin, __exportAll, __require, __toESM };
4
+ export { __esmMin };
package/dist/client.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { isRecord } from "./types.js";
2
- import { Knowhere } from "./node_modules/.pnpm/@knowhere-ai_sdk@0.1.1/node_modules/@knowhere-ai/sdk/dist/index.js";
3
2
  import { formatErrorMessage } from "./error-message.js";
4
3
  import path from "node:path";
5
4
  import { createHash } from "node:crypto";
6
5
  import { openAsBlob } from "node:fs";
6
+ import { Knowhere } from "@knowhere-ai/sdk";
7
7
  //#region src/client.ts
8
8
  const RETRYABLE_STATUS_CODES = new Set([
9
9
  409,
@@ -1,7 +1,11 @@
1
- import { __toESM } from "./_virtual/_rolldown/runtime.js";
2
- import { require_nodejieba } from "./node_modules/.pnpm/nodejieba@2.6.0/node_modules/nodejieba/index.js";
1
+ import * as nodejieba from "nodejieba";
3
2
  //#region src/graph-builder.ts
4
- var import_nodejieba = /* @__PURE__ */ __toESM(require_nodejieba(), 1);
3
+ /**
4
+ * Graph Builder Module
5
+ *
6
+ * TypeScript implementation of knowhere-api/apps/worker/app/services/connect_builder/graph_builder.py
7
+ * Builds file-level knowledge graphs from chunk connections with TF-IDF and importance scoring.
8
+ */
5
9
  /**
6
10
  * Extract file key from chunk path
7
11
  */
@@ -25,7 +29,7 @@ function extractTokensFromContent(content, jiebaInitialized) {
25
29
  const cleanContent = content.replace(/<[^>]*>/g, " ");
26
30
  if (!jiebaInitialized) return cleanContent.split(/\s+/).filter((w) => w.length > 1);
27
31
  try {
28
- return import_nodejieba.cut(cleanContent).filter((token) => {
32
+ return nodejieba.cut(cleanContent).filter((token) => {
29
33
  if (token.length <= 1) return false;
30
34
  if (/^\d+$/.test(token)) return false;
31
35
  if (/^[^\w\u4e00-\u9fa5]+$/.test(token)) return false;
@@ -1,14 +1,11 @@
1
- import { __toESM } from "./_virtual/_rolldown/runtime.js";
2
- import { require_lib } from "./node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/index.js";
3
- import { require_nodejieba } from "./node_modules/.pnpm/nodejieba@2.6.0/node_modules/nodejieba/index.js";
4
1
  import { buildConnections, init_connect_builder } from "./connect-builder.js";
5
2
  import { buildKnowledgeGraph } from "./graph-builder.js";
6
3
  import path from "node:path";
7
4
  import { spawn } from "node:child_process";
5
+ import fs from "fs-extra";
8
6
  import os from "node:os";
7
+ import * as nodejieba from "nodejieba";
9
8
  //#region src/kg-service.ts
10
- var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
11
- var import_nodejieba = /* @__PURE__ */ __toESM(require_nodejieba(), 1);
12
9
  init_connect_builder();
13
10
  const DEFAULT_CONNECT_CONFIG = {
14
11
  minKeywordOverlap: 3,
@@ -96,7 +93,7 @@ var KnowledgeGraphService = class {
96
93
  }
97
94
  async initializeJieba() {
98
95
  try {
99
- import_nodejieba.load();
96
+ nodejieba.load();
100
97
  this.jiebaInitialized = true;
101
98
  this.logger.info("Nodejieba initialized successfully");
102
99
  } catch {
@@ -108,7 +105,7 @@ var KnowledgeGraphService = class {
108
105
  async extractKeywords(text, topK = 20) {
109
106
  if (this.degradationMode === "disabled") return [];
110
107
  if (this.degradationMode === "full" && this.jiebaInitialized) try {
111
- const rawKeywords = import_nodejieba.extract(text, topK);
108
+ const rawKeywords = nodejieba.extract(text, topK);
112
109
  return (Array.isArray(rawKeywords) ? rawKeywords : []).map((item) => extractKeywordText(item)).filter((keyword) => keyword !== null).filter((kw) => {
113
110
  if (kw.length <= 1) return false;
114
111
  if (/^\d+$/.test(kw)) return false;
@@ -139,18 +136,18 @@ var KnowledgeGraphService = class {
139
136
  }
140
137
  async ensureKbDirectory(kbId) {
141
138
  const kbPath = this.getKbPath(kbId);
142
- await import_lib.default.ensureDir(kbPath);
139
+ await fs.ensureDir(kbPath);
143
140
  return kbPath;
144
141
  }
145
142
  async saveDocumentToKb(params) {
146
143
  const kbPath = await this.ensureKbDirectory(params.kbId);
147
144
  const docDir = path.join(kbPath, params.docId);
148
- await import_lib.default.ensureDir(docDir);
149
- await import_lib.default.copy(params.sourcePath, docDir, { overwrite: true });
145
+ await fs.ensureDir(docDir);
146
+ await fs.copy(params.sourcePath, docDir, { overwrite: true });
150
147
  const keywordsPath = path.join(docDir, "keywords.json");
151
- await import_lib.default.writeJSON(keywordsPath, params.keywords, { spaces: 2 });
148
+ await fs.writeJSON(keywordsPath, params.keywords, { spaces: 2 });
152
149
  const metadataPath = path.join(docDir, "metadata.json");
153
- await import_lib.default.writeJSON(metadataPath, params.metadata, { spaces: 2 });
150
+ await fs.writeJSON(metadataPath, params.metadata, { spaces: 2 });
154
151
  this.logger.info(`Document saved to knowledge base: kb=${params.kbId} doc=${params.docId}`);
155
152
  }
156
153
  async scheduleBuild(kbId, task) {
@@ -171,11 +168,11 @@ var KnowledgeGraphService = class {
171
168
  }
172
169
  async buildKnowledgeGraph(kbId) {
173
170
  const kbPath = this.getKbPath(kbId);
174
- const docs = await import_lib.default.readdir(kbPath);
171
+ const docs = await fs.readdir(kbPath);
175
172
  const docDirs = [];
176
173
  for (const doc of docs) {
177
174
  const docPath = path.join(kbPath, doc);
178
- if ((await import_lib.default.stat(docPath)).isDirectory() && doc !== "knowledge_graph.json" && doc !== "chunk_stats.json" && doc !== "kb_metadata.json") docDirs.push(doc);
175
+ if ((await fs.stat(docPath)).isDirectory() && doc !== "knowledge_graph.json" && doc !== "chunk_stats.json" && doc !== "kb_metadata.json") docDirs.push(doc);
179
176
  }
180
177
  if (docDirs.length < 2) {
181
178
  this.logger.info(`Not enough documents for graph building (need >=2, have ${docDirs.length}), skipping`);
@@ -186,8 +183,8 @@ var KnowledgeGraphService = class {
186
183
  const allChunks = [];
187
184
  for (const docDir of docDirs) {
188
185
  const chunksPath = path.join(kbPath, docDir, "chunks.json");
189
- if (await import_lib.default.pathExists(chunksPath)) {
190
- const chunksData = await import_lib.default.readJSON(chunksPath);
186
+ if (await fs.pathExists(chunksPath)) {
187
+ const chunksData = await fs.readJSON(chunksPath);
191
188
  if (chunksData.chunks && Array.isArray(chunksData.chunks)) allChunks.push(...chunksData.chunks);
192
189
  }
193
190
  }
@@ -200,10 +197,10 @@ var KnowledgeGraphService = class {
200
197
  this.logger.info(`Built ${connections.length} connections`);
201
198
  const chunkStatsPath = path.join(kbPath, "chunk_stats.json");
202
199
  let chunkStats = {};
203
- if (await import_lib.default.pathExists(chunkStatsPath)) chunkStats = await import_lib.default.readJSON(chunkStatsPath);
200
+ if (await fs.pathExists(chunkStatsPath)) chunkStats = await fs.readJSON(chunkStatsPath);
204
201
  const knowledgeGraph = buildKnowledgeGraph(allChunks, connections, chunkStats, this.jiebaInitialized, this.logger);
205
202
  const graphFile = path.join(kbPath, "knowledge_graph.json");
206
- await import_lib.default.writeJSON(graphFile, knowledgeGraph, { spaces: 2 });
203
+ await fs.writeJSON(graphFile, knowledgeGraph, { spaces: 2 });
207
204
  this.logger.info(`Knowledge graph saved to ${graphFile}`);
208
205
  await this.updateKbMetadata(kbPath, {
209
206
  lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
@@ -218,34 +215,34 @@ var KnowledgeGraphService = class {
218
215
  async updateKbMetadata(kbPath, updates) {
219
216
  const metadataPath = path.join(kbPath, "kb_metadata.json");
220
217
  let metadata = {};
221
- if (await import_lib.default.pathExists(metadataPath)) metadata = await import_lib.default.readJSON(metadataPath);
218
+ if (await fs.pathExists(metadataPath)) metadata = await fs.readJSON(metadataPath);
222
219
  const updated = {
223
220
  ...metadata,
224
221
  ...updates
225
222
  };
226
- await import_lib.default.writeJSON(metadataPath, updated, { spaces: 2 });
223
+ await fs.writeJSON(metadataPath, updated, { spaces: 2 });
227
224
  }
228
225
  async queryGraph(kbId, fileKey) {
229
226
  const graphPath = path.join(this.getKbPath(kbId), "knowledge_graph.json");
230
- if (!await import_lib.default.pathExists(graphPath)) return [];
231
- const graph = await import_lib.default.readJSON(graphPath);
227
+ if (!await fs.pathExists(graphPath)) return [];
228
+ const graph = await fs.readJSON(graphPath);
232
229
  if (!fileKey) return graph.edges;
233
230
  return graph.edges.filter((edge) => edge.source === fileKey || edge.target === fileKey);
234
231
  }
235
232
  async getKnowledgeGraph(kbId) {
236
233
  const graphPath = path.join(this.getKbPath(kbId), "knowledge_graph.json");
237
- if (!await import_lib.default.pathExists(graphPath)) return null;
238
- return await import_lib.default.readJSON(graphPath);
234
+ if (!await fs.pathExists(graphPath)) return null;
235
+ return await fs.readJSON(graphPath);
239
236
  }
240
237
  async listKnowledgeBases() {
241
238
  const knowhereRoot = path.join(os.homedir(), ".knowhere");
242
- if (!await import_lib.default.pathExists(knowhereRoot)) return [];
243
- return (await import_lib.default.readdir(knowhereRoot, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name);
239
+ if (!await fs.pathExists(knowhereRoot)) return [];
240
+ return (await fs.readdir(knowhereRoot, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name);
244
241
  }
245
242
  async getKbMetadata(kbId) {
246
243
  const metadataPath = path.join(this.getKbPath(kbId), "kb_metadata.json");
247
- if (!await import_lib.default.pathExists(metadataPath)) return null;
248
- return await import_lib.default.readJSON(metadataPath);
244
+ if (!await fs.pathExists(metadataPath)) return null;
245
+ return await fs.readJSON(metadataPath);
249
246
  }
250
247
  isEnabled() {
251
248
  return this.degradationMode !== "disabled";
package/dist/parser.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { isNodeError, isRecord } from "./types.js";
2
- import { strFromU8, unzipSync } from "./node_modules/.pnpm/fflate@0.8.2/node_modules/fflate/esm/browser.js";
3
2
  import fs from "node:fs/promises";
4
3
  import path from "node:path";
5
4
  import { createHash } from "node:crypto";
5
+ import { strFromU8, unzipSync } from "fflate";
6
6
  const CHUNKS_FILE_NAME = "chunks.json";
7
7
  const FULL_MARKDOWN_FILE_NAME = "full.md";
8
8
  const HIERARCHY_FILE_NAME = "hierarchy.json";
package/dist/tools.js CHANGED
@@ -9,6 +9,13 @@ 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
+ const TERMINAL_JOB_STATUSES = new Set([
13
+ "cancelled",
14
+ "canceled",
15
+ "done",
16
+ "error",
17
+ "failed"
18
+ ]);
12
19
  async function buildKnowledgeGraphAsync(params) {
13
20
  const docDir = path.join(params.scope.documentsDir, params.docId);
14
21
  const metadataPath = path.join(docDir, "metadata.json");
@@ -95,6 +102,67 @@ function buildStoredDocumentSummaryLines(params) {
95
102
  if (params.includeUpdatedAt) lines.push(`Updated: ${params.document.updatedAt}`);
96
103
  return lines;
97
104
  }
105
+ function isTerminalJobStatus(status, hasError) {
106
+ return TERMINAL_JOB_STATUSES.has(status.trim().toLowerCase()) || hasError;
107
+ }
108
+ function startKnowledgeGraphBuild(params) {
109
+ if (!params.kgService.isEnabled()) return;
110
+ const kbId = params.kgService.resolveKbId(params.ctx);
111
+ if (!kbId) return;
112
+ params.api.logger.info(`knowhere: initiating knowledge graph build kbId=${kbId} docId=${params.document.id}`);
113
+ buildKnowledgeGraphAsync({
114
+ kgService: params.kgService,
115
+ kbId,
116
+ docId: params.document.id,
117
+ documentPayload: params.ingestResult,
118
+ scope: params.scope,
119
+ ctx: params.ctx,
120
+ api: params.api,
121
+ channelRoute: params.channelRoute,
122
+ sessionKey: params.sessionKey
123
+ }).catch((kgError) => {
124
+ params.api.logger.error(`knowhere: knowledge graph build failed kbId=${kbId} docId=${params.document.id}: ${formatErrorMessage(kgError)}`);
125
+ });
126
+ }
127
+ async function persistIngestedDocument(params) {
128
+ const storedDocument = await params.store.saveDownloadedDocument(params.scope, {
129
+ sourceType: params.sourceType,
130
+ source: params.source,
131
+ fileName: params.fileName,
132
+ docId: params.docId,
133
+ title: params.title,
134
+ dataId: params.dataId,
135
+ tags: params.tags,
136
+ job: params.ingestResult.job,
137
+ jobResult: params.ingestResult.jobResult,
138
+ downloadedResult: params.ingestResult.downloadedResult
139
+ }, { overwrite: params.overwrite });
140
+ params.api.logger.info(`knowhere: knowhere_ingest_document stored document scope=${params.scope.label} jobId=${params.ingestResult.job.job_id} docId=${storedDocument.id}`);
141
+ startKnowledgeGraphBuild({
142
+ api: params.api,
143
+ channelRoute: params.channelRoute,
144
+ ctx: params.ctx,
145
+ document: storedDocument,
146
+ ingestResult: params.ingestResult,
147
+ kgService: params.kgService,
148
+ scope: params.scope,
149
+ sessionKey: params.sessionKey
150
+ });
151
+ return storedDocument;
152
+ }
153
+ function formatCompletedIngestResult(params) {
154
+ return [
155
+ "Ingest complete.",
156
+ ...buildStoredDocumentSummaryLines({
157
+ document: params.document,
158
+ scopeLabel: params.scopeLabel,
159
+ includeJobId: true,
160
+ includeSource: true
161
+ }),
162
+ `Source type: ${params.sourceType}`,
163
+ "Next: use knowhere_preview_document for a structural overview or knowhere_grep to search the parsed content."
164
+ ].join("\n");
165
+ }
98
166
  function readString(value) {
99
167
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
100
168
  }
@@ -531,7 +599,7 @@ function createIngestTool(params) {
531
599
  return {
532
600
  name: "knowhere_ingest_document",
533
601
  label: "Knowhere Ingest",
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.",
602
+ 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. Knowhere must be the only parser for supported files. If Knowhere returns an error, surface that exact error to the user and do not fall back to other parsing methods or fabricate a preview. By default blockUntilComplete is false, so this tool is fire-and-forget and returns a job ID while parsing continues in the background. Set blockUntilComplete to true only when the current turn explicitly needs the parsed result before continuing. 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.",
535
603
  parameters: {
536
604
  type: "object",
537
605
  additionalProperties: false,
@@ -573,6 +641,10 @@ function createIngestTool(params) {
573
641
  type: "boolean",
574
642
  description: "Replace an existing stored document with the same docId."
575
643
  },
644
+ blockUntilComplete: {
645
+ type: "boolean",
646
+ description: "When true, wait for Knowhere to finish parsing, store the result, and return a ready-to-use stored-document summary. Defaults to false, which returns immediately with a job ID and continues parsing in the background."
647
+ },
576
648
  lang: {
577
649
  type: "string",
578
650
  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."
@@ -628,13 +700,14 @@ function createIngestTool(params) {
628
700
  filePath: resolvedFilePath,
629
701
  url: urlParam
630
702
  });
703
+ const blockUntilComplete = readBoolean(paramsRecord.blockUntilComplete, false);
631
704
  const tags = sanitizeStringArray(paramsRecord.tags);
632
705
  const overwrite = readBoolean(paramsRecord.overwrite, false);
633
706
  const trackerLanguage = readIngestTrackerLanguage(paramsRecord.lang);
634
707
  const sessionKey = params.ctx.sessionKey;
635
708
  const sourceType = urlParam ? "url" : "file";
636
709
  const channelRoute = await params.store.resolveChannelRoute({ sessionKey });
637
- params.api.logger.info(`knowhere: knowhere_ingest_document starting background ingest scope=${scope.label} sourceType=${sourceType} label=${JSON.stringify(progressLabel)} overwrite=${overwrite} docId=${docId ?? "auto"} dataId=${dataId ?? "none"} lang=${trackerLanguage} routeState=${channelRoute ? "resolved" : "missing"} routeAccountId=${channelRoute?.accountId ?? "none"}`);
710
+ params.api.logger.info(`knowhere: knowhere_ingest_document starting ingest scope=${scope.label} sourceType=${sourceType} label=${JSON.stringify(progressLabel)} mode=${blockUntilComplete ? "blocking" : "background"} overwrite=${overwrite} docId=${docId ?? "auto"} dataId=${dataId ?? "none"} lang=${trackerLanguage} routeState=${channelRoute ? "resolved" : "missing"} routeAccountId=${channelRoute?.accountId ?? "none"}`);
638
711
  let resolveJobCreated;
639
712
  const jobCreatedPromise = new Promise((resolve) => {
640
713
  resolveJobCreated = resolve;
@@ -653,40 +726,52 @@ function createIngestTool(params) {
653
726
  resolveJobCreated(job);
654
727
  }
655
728
  });
729
+ if (blockUntilComplete) {
730
+ const ingestResult = await ingestPromise.catch(rethrowWithPaymentHint);
731
+ params.api.logger.info(`knowhere: knowhere_ingest_document download completed scope=${scope.label} jobId=${ingestResult.job.job_id}; storing extracted result`);
732
+ return textResult(formatCompletedIngestResult({
733
+ document: await persistIngestedDocument({
734
+ api: params.api,
735
+ channelRoute,
736
+ ctx: params.ctx,
737
+ dataId,
738
+ docId,
739
+ fileName,
740
+ ingestResult,
741
+ kgService: params.kgService,
742
+ overwrite,
743
+ scope,
744
+ sessionKey,
745
+ source: urlParam || resolvedFilePath || "",
746
+ sourceType,
747
+ store: params.store,
748
+ tags,
749
+ title
750
+ }),
751
+ scopeLabel: scope.label,
752
+ sourceType
753
+ }));
754
+ }
656
755
  ingestPromise.then(async (ingestResult) => {
657
756
  params.api.logger.info(`knowhere: knowhere_ingest_document download completed scope=${scope.label} jobId=${ingestResult.job.job_id}; storing extracted result`);
658
- const storedDocument = await params.store.saveDownloadedDocument(scope, {
659
- sourceType,
660
- source: urlParam || resolvedFilePath || "",
661
- fileName,
662
- docId,
663
- title,
757
+ const storedDocument = await persistIngestedDocument({
758
+ api: params.api,
759
+ channelRoute,
760
+ ctx: params.ctx,
664
761
  dataId,
762
+ docId,
763
+ fileName,
764
+ ingestResult,
765
+ kgService: params.kgService,
766
+ overwrite,
767
+ scope,
768
+ sessionKey,
769
+ source: urlParam || resolvedFilePath || "",
770
+ sourceType,
771
+ store: params.store,
665
772
  tags,
666
- job: ingestResult.job,
667
- jobResult: ingestResult.jobResult,
668
- downloadedResult: ingestResult.downloadedResult
669
- }, { overwrite });
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
- }
773
+ title
774
+ });
690
775
  await notifyBackgroundIngestOutcome({
691
776
  api: params.api,
692
777
  context: params.ctx,
@@ -737,7 +822,7 @@ function createIngestTool(params) {
737
822
  `Job ID: ${createdJob.job_id}`,
738
823
  `File: ${progressLabel}`,
739
824
  `Scope: ${scope.label}`,
740
- "Use knowhere_get_job_status only if this turn needs the parsed result."
825
+ "This call does not include parsed content yet."
741
826
  ].join("\n"));
742
827
  }
743
828
  };
@@ -746,7 +831,7 @@ function createJobStatusTool(params) {
746
831
  return {
747
832
  name: "knowhere_get_job_status",
748
833
  label: "Knowhere Job Status",
749
- description: "Check the status of a Knowhere parsing job by job ID. Returns job status, progress, duration, credits spent, and whether the result is already stored locally. Use this to monitor a running job or inspect a past job before importing it with knowhere_import_completed_job.",
834
+ description: "Check the status of a Knowhere parsing job by job ID. Returns job status, progress, duration, credits spent, and whether the result is already stored locally. Use this to monitor a running job or inspect a past job before importing it with knowhere_import_completed_job. Do not assume a running job is stuck just because progress is unchanged or slow. Only treat the job as failed or stuck when Knowhere returns an explicit failure status or error code.",
750
835
  parameters: {
751
836
  type: "object",
752
837
  additionalProperties: false,
@@ -798,6 +883,10 @@ function createJobStatusTool(params) {
798
883
  lines.push(`Result URL: ${job.result_url}`);
799
884
  if (job.result_url_expires_at) lines.push(`Result URL expires: ${job.result_url_expires_at}`);
800
885
  }
886
+ const hasExplicitError = Boolean(job.error?.code || job.error?.message);
887
+ if (job.status.trim().toLowerCase() === "done") lines.push("Interpretation: completed.");
888
+ else if (isTerminalJobStatus(job.status, hasExplicitError)) lines.push("Interpretation: Knowhere reported an explicit failure. Surface this error to the user and do not fall back to other parsing methods.");
889
+ else lines.push("Interpretation: still running. Do not describe this job as stuck or failed unless a later Knowhere API response returns an explicit failure status or error code.");
801
890
  if (matchingDocuments.length === 0) lines.push("Stored docs in scope: none");
802
891
  else {
803
892
  lines.push("Stored docs in scope:");
@@ -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.2.1",
6
+ "version": "0.2.2",
7
7
  "uiHints": {
8
8
  "apiKey": {
9
9
  "label": "Knowhere API Key",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ontos-ai/knowhere-claw",
3
- "version": "0.2.1",
3
+ "version": "0.2.2-beta.1",
4
4
  "description": "OpenClaw plugin for Knowhere-powered document ingestion and automatic grounding.",
5
5
  "files": [
6
6
  "dist/",
@@ -25,6 +25,7 @@
25
25
  "fmt:check": "oxfmt --check",
26
26
  "lint": "oxlint --type-aware",
27
27
  "lint:fix": "oxlint --type-aware --fix",
28
+ "smoke:auto": "vite-node --mode smoke ./smoketest/run-tool.ts -- --auto --file-path smoketest/fixtures/sample.pdf",
28
29
  "smoke:tools": "vite-node --mode smoke ./smoketest/run-tool.ts",
29
30
  "release:beta": "node ./scripts/publish-beta-release.mjs",
30
31
  "release:publish": "node ./scripts/publish-release.mjs",
@@ -69,4 +70,4 @@
69
70
  "./dist/index.js"
70
71
  ]
71
72
  }
72
- }
73
+ }
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: knowhere
3
- description: First-class document reader. Use Knowhere tools whenever the task involves reading, understanding, searching, or reasoning over document files (PDF, DOCX, XLSX, PPTX, images, TXT, MD) or URLs — even if the user does not mention "Knowhere" by name. Prefer Knowhere over generic file reads for all supported formats. Covers ingestion, structured browsing, chunk search, result file inspection, job management, and scope cleanup.
3
+ description: First-class document reader. Use Knowhere tools whenever the task involves reading, understanding, searching, or reasoning over document files (PDF, DOCX, XLSX, PPTX, images, TXT, MD and more) or URLs — even if the user does not mention "Knowhere" by name. Prefer Knowhere over generic file reads for all supported formats. Covers ingestion, structured browsing, chunk search, result file inspection, job management, and scope cleanup.
4
4
  user-invocable: false
5
5
  ---
6
6
 
7
7
  # Knowhere Skill
8
8
 
9
- Knowhere is the first-class way to read, understand, and answer questions about document files. When a task involves reading or reasoning over a supported file (`.pdf`, `.docx`, `.xlsx`, `.pptx`, `.txt`, `.md`, `.jpg`, `.jpeg`, `.png`), always prefer Knowhere tools over generic file-reading approaches. Knowhere parses documents into structured chunks with hierarchy, summaries, tables, and images — far richer than raw text extraction.
9
+ Knowhere is the first-class way to read, understand, and answer questions about document files. When a task involves reading or reasoning over a supported file (`.pdf`, `.docx`, `.xlsx`, `.pptx`, `.txt`, `.md`, `.jpg`, `.jpeg`, `.png` and others), always prefer Knowhere tools over generic file-reading approaches. Knowhere parses documents into structured chunks with hierarchy, summaries, tables, and images — far richer than raw text extraction.
10
10
 
11
11
  Use the `knowhere_*` tools for explicit document ingestion and browse-first stored-result workflows. Before starting a new ingest, prefer checking whether the current scope already has the same document stored.
12
12
 
@@ -21,7 +21,9 @@ Reach for Knowhere tools first whenever:
21
21
 
22
22
  Do not attempt to read supported document files (especially PDFs, DOCX, XLSX, PPTX) with generic file-read tools or shell commands. These formats are binary or semi-structured and will produce garbled or incomplete output. Knowhere handles them properly.
23
23
 
24
- For plain text files (`.txt`, `.md`), Knowhere still adds value through chunking, hierarchy extraction, and search but direct reads are acceptable for quick one-off checks.
24
+ If Knowhere returns a parsing error, status error, or explicit failure status, report that exact error to the user and stop. Do not fall back to other parsing methods, do not guess from partial binary reads, and do not fabricate a preview or summary.
25
+
26
+ For plain text files (`.txt`, `.md`), Knowhere still adds value through chunking, hierarchy extraction, and search. Direct reads are acceptable only for quick workspace sanity checks that do not replace a requested parse, preview, or document-grounded answer.
25
27
 
26
28
  ## Terminology
27
29
 
@@ -132,17 +134,20 @@ After ingesting a document, use the returned document or job identifiers for fol
132
134
  ## Recommended workflow
133
135
 
134
136
  1. If the document may already exist in the current scope, call `knowhere_list_documents` first and compare `Source`, `File`, and `Title` to find an existing match.
135
- 2. Ingest or import the document only if it is not already in the store, or if the user explicitly wants a fresh parse. After calling `knowhere_ingest_document`, you receive a job ID immediately while parsing continues in the background. If the current turn needs the parsed document, check with `knowhere_get_job_status`; otherwise stop and wait for the user to continue later.
136
- 3. Call `knowhere_list_documents` again if you need to confirm the right `docId`.
137
- 4. Call `knowhere_preview_document` to get a structural overview (table of contents with summaries).
138
- 5. When you know what to search for, call `knowhere_grep` with `conditions: [{ pattern: "your query" }]` — this searches all text fields (content, summary, keywords, path) in one call. Add more conditions to narrow results (e.g. filter by `chunk.type` or `chunk.path`).
139
- 6. Call `knowhere_grep` with a path condition to narrow results to a specific branch when browsing by structure.
140
- 7. Call `knowhere_read_result_file` for `hierarchy.json`, `kb.csv`, table HTML, or image assets when the answer depends on parser rows, rich table structure, or visual content.
137
+ 2. Ingest or import the document only if it is not already in the store, or if the user explicitly wants a fresh parse. `knowhere_ingest_document` defaults to fire-and-forget (`blockUntilComplete: false`) and returns a job ID immediately while parsing continues in the background.
138
+ 3. Set `blockUntilComplete: true` on `knowhere_ingest_document` when the current turn explicitly needs the parsed result before continuing, such as "wait until it is parsed" or "show me a preview now".
139
+ 4. If a job was already started asynchronously and the current turn now depends on the parsed result, use `knowhere_get_job_status` until Knowhere reports `done` or an explicit failure. Do not infer "stuck" from unchanged progress alone.
140
+ 5. Call `knowhere_list_documents` again if you need to confirm the right `docId`.
141
+ 6. Call `knowhere_preview_document` to get a structural overview (table of contents with summaries).
142
+ 7. When you know what to search for, call `knowhere_grep` with `conditions: [{ pattern: "your query" }]` this searches all text fields (content, summary, keywords, path) in one call. Add more conditions to narrow results (e.g. filter by `chunk.type` or `chunk.path`).
143
+ 8. Call `knowhere_grep` with a path condition to narrow results to a specific branch when browsing by structure.
144
+ 9. Call `knowhere_read_result_file` for `hierarchy.json`, `kb.csv`, table HTML, or image assets when the answer depends on parser rows, rich table structure, or visual content.
141
145
 
142
146
  ## Reasoning rules
143
147
 
144
148
  - Prefer `knowhere_grep` for all text search. It supports composable AND conditions, regex, and normalizes HTML/LaTeX/unicode before matching. Use `knowhere_preview_document` when you need a quick overview and structural browsing by path.
145
149
  - Use `knowhere_preview_document` before broad reads when the document is large or the relevant branch is unclear.
150
+ - Use Knowhere as the only parser for document read. If Knowhere fails, surface the real error to the user instead of switching to another parsing approach.
146
151
  - Keep `path` in your reasoning and in your answer when possible. It restores section position and improves grounding.
147
152
  - Use `chunkId` and `path` internally for your own reasoning and tool calls, but do not expose them to the user. When citing sources, use human-readable section names derived from the path (e.g., "第7章 维护、保养" instead of `Default_Root/f339a970...-->7 维护、保养`). Never show raw `docId`, `chunkId`, or internal file paths in user-facing replies.
148
153
  - For image or table questions, inspect matching `image` or `table` chunks and the related manifest asset entries before answering. Use `knowhere_read_result_file` with the chunk's `assetFilePath` to prepare image assets for delivery, then use the returned `message` tool handoff when the user wants to see the image. Do not call `read` on the staged image path because it may live outside the agent sandbox.