@ontos-ai/knowhere-claw 0.2.0 → 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 (244) hide show
  1. package/README.md +1 -1
  2. package/dist/__tests__/channel-route.test.d.ts +1 -0
  3. package/dist/__tests__/ingest-tool.test.d.ts +1 -0
  4. package/dist/__tests__/kg-service-test-helper.d.ts +2 -0
  5. package/dist/__tests__/kg-service.test.d.ts +1 -0
  6. package/dist/__tests__/read-result-file-tool.test.d.ts +1 -0
  7. package/dist/__tests__/tracker-progress.test.d.ts +1 -0
  8. package/dist/_virtual/_rolldown/runtime.js +1 -35
  9. package/dist/channel-delivery.d.ts +21 -0
  10. package/dist/client.d.ts +33 -0
  11. package/dist/client.js +1 -1
  12. package/dist/config.d.ts +13 -0
  13. package/dist/connect-builder.d.ts +48 -0
  14. package/dist/connect-builder.js +1 -2
  15. package/dist/error-message.d.ts +1 -0
  16. package/dist/graph-builder.d.ts +75 -0
  17. package/dist/graph-builder.js +9 -5
  18. package/dist/index.d.ts +9 -0
  19. package/dist/kg-service.d.ts +38 -0
  20. package/dist/kg-service.js +39 -33
  21. package/dist/parser.d.ts +16 -0
  22. package/dist/parser.js +1 -1
  23. package/dist/session.d.ts +11 -0
  24. package/dist/store.d.ts +79 -0
  25. package/dist/text.d.ts +10 -0
  26. package/dist/tools.d.ts +10 -0
  27. package/dist/tools.js +123 -34
  28. package/dist/tracker-progress.d.ts +10 -0
  29. package/dist/types.d.ts +320 -0
  30. package/openclaw.plugin.json +1 -1
  31. package/package.json +3 -2
  32. package/skills/knowhere/SKILL.md +14 -9
  33. package/dist/node_modules/.pnpm/@knowhere-ai_sdk@0.1.1/node_modules/@knowhere-ai/sdk/dist/index.js +0 -717
  34. 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
  35. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/pre-binding.js +0 -35
  36. 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
  37. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/napi.js +0 -142
  38. 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
  39. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js +0 -199
  40. package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/package.js +0 -67
  41. package/dist/node_modules/.pnpm/abbrev@1.1.1/node_modules/abbrev/abbrev.js +0 -59
  42. package/dist/node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js +0 -11
  43. package/dist/node_modules/.pnpm/aproba@2.1.0/node_modules/aproba/index.js +0 -119
  44. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/index.js +0 -13
  45. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker-base.js +0 -16
  46. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker-group.js +0 -98
  47. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker-stream.js +0 -37
  48. package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker.js +0 -32
  49. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/adapters.js +0 -83
  50. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/fetch.js +0 -170
  51. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/xhr.js +0 -106
  52. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/axios.js +0 -57
  53. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/CancelToken.js +0 -90
  54. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/CanceledError.js +0 -20
  55. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/isCancel.js +0 -6
  56. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/Axios.js +0 -174
  57. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/AxiosError.js +0 -70
  58. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/AxiosHeaders.js +0 -204
  59. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/InterceptorManager.js +0 -60
  60. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/buildFullPath.js +0 -20
  61. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/dispatchRequest.js +0 -52
  62. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/mergeConfig.js +0 -81
  63. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/settle.js +0 -18
  64. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/transformData.js +0 -25
  65. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/defaults/index.js +0 -107
  66. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/defaults/transitional.js +0 -9
  67. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/env/data.js +0 -4
  68. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -50
  69. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -77
  70. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/bind.js +0 -15
  71. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/buildURL.js +0 -40
  72. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/combineURLs.js +0 -14
  73. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/composeSignals.js +0 -39
  74. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/cookies.js +0 -31
  75. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/formDataToJSON.js +0 -67
  76. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -14
  77. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
  78. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -8
  79. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/parseHeaders.js +0 -53
  80. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/parseProtocol.js +0 -7
  81. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/progressEventReducer.js +0 -38
  82. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/resolveConfig.js +0 -36
  83. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/speedometer.js +0 -36
  84. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/spread.js +0 -29
  85. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/throttle.js +0 -38
  86. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/toFormData.js +0 -151
  87. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -18
  88. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/trackStream.js +0 -69
  89. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/validator.js +0 -76
  90. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -4
  91. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -4
  92. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -5
  93. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/index.js +0 -22
  94. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/common/utils.js +0 -46
  95. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/index.js +0 -9
  96. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/utils.js +0 -698
  97. package/dist/node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js +0 -53
  98. package/dist/node_modules/.pnpm/brace-expansion@1.1.12/node_modules/brace-expansion/index.js +0 -132
  99. package/dist/node_modules/.pnpm/color-support@1.1.3/node_modules/color-support/browser.js +0 -18
  100. package/dist/node_modules/.pnpm/concat-map@0.0.1/node_modules/concat-map/index.js +0 -19
  101. package/dist/node_modules/.pnpm/console-control-strings@1.1.0/node_modules/console-control-strings/index.js +0 -104
  102. package/dist/node_modules/.pnpm/delegates@1.0.0/node_modules/delegates/index.js +0 -104
  103. package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/detect-libc.js +0 -221
  104. package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/elf.js +0 -26
  105. package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/filesystem.js +0 -48
  106. package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/process.js +0 -24
  107. package/dist/node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js +0 -10
  108. package/dist/node_modules/.pnpm/fflate@0.8.2/node_modules/fflate/esm/browser.js +0 -426
  109. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy-sync.js +0 -120
  110. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy.js +0 -100
  111. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/index.js +0 -15
  112. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/empty/index.js +0 -43
  113. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/file.js +0 -53
  114. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/index.js +0 -27
  115. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/link.js +0 -56
  116. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-paths.js +0 -89
  117. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-type.js +0 -35
  118. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink.js +0 -81
  119. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js +0 -113
  120. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/index.js +0 -29
  121. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/index.js +0 -22
  122. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/jsonfile.js +0 -15
  123. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json-sync.js +0 -15
  124. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json.js +0 -15
  125. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js +0 -20
  126. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/make-dir.js +0 -33
  127. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/utils.js +0 -17
  128. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/index.js +0 -15
  129. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move-sync.js +0 -56
  130. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move.js +0 -49
  131. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/output-file/index.js +0 -30
  132. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js +0 -18
  133. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/remove/index.js +0 -27
  134. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/async.js +0 -15
  135. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js +0 -131
  136. package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/utimes.js +0 -34
  137. package/dist/node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js +0 -51
  138. package/dist/node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js +0 -171
  139. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/base-theme.js +0 -21
  140. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/error.js +0 -27
  141. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/has-color.js +0 -9
  142. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/index.js +0 -224
  143. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/plumbing.js +0 -48
  144. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/process.js +0 -8
  145. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/progress-bar.js +0 -46
  146. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/render-template.js +0 -155
  147. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/set-immediate.js +0 -14
  148. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/set-interval.js +0 -8
  149. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/spin.js +0 -10
  150. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/template-item.js +0 -58
  151. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/theme-set.js +0 -99
  152. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/themes.js +0 -67
  153. package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/wide-truncate.js +0 -22
  154. package/dist/node_modules/.pnpm/glob@7.2.3/node_modules/glob/common.js +0 -162
  155. package/dist/node_modules/.pnpm/glob@7.2.3/node_modules/glob/glob.js +0 -451
  156. package/dist/node_modules/.pnpm/glob@7.2.3/node_modules/glob/sync.js +0 -280
  157. package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js +0 -20
  158. package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js +0 -362
  159. package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js +0 -92
  160. package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js +0 -255
  161. package/dist/node_modules/.pnpm/has-unicode@2.0.1/node_modules/has-unicode/index.js +0 -14
  162. package/dist/node_modules/.pnpm/inflight@1.0.6/node_modules/inflight/inflight.js +0 -45
  163. package/dist/node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js +0 -27
  164. package/dist/node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js +0 -14
  165. package/dist/node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/index.js +0 -68
  166. package/dist/node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/utils.js +0 -19
  167. package/dist/node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js +0 -3110
  168. package/dist/node_modules/.pnpm/minimatch@3.1.5/node_modules/minimatch/minimatch.js +0 -578
  169. package/dist/node_modules/.pnpm/nodejieba@2.6.0/node_modules/nodejieba/index.js +0 -46
  170. package/dist/node_modules/.pnpm/nopt@5.0.0/node_modules/nopt/lib/nopt.js +0 -330
  171. package/dist/node_modules/.pnpm/npmlog@5.0.1/node_modules/npmlog/log.js +0 -305
  172. package/dist/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +0 -54
  173. package/dist/node_modules/.pnpm/once@1.4.0/node_modules/once/once.js +0 -44
  174. package/dist/node_modules/.pnpm/path-is-absolute@1.0.1/node_modules/path-is-absolute/index.js +0 -19
  175. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/errors-browser.js +0 -88
  176. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_duplex.js +0 -75
  177. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_passthrough.js +0 -19
  178. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_readable.js +0 -666
  179. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_transform.js +0 -89
  180. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_writable.js +0 -423
  181. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/async_iterator.js +0 -172
  182. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/buffer_list.js +0 -243
  183. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -77
  184. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +0 -87
  185. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from-browser.js +0 -10
  186. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/pipeline.js +0 -80
  187. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/state.js +0 -21
  188. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -8
  189. package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/readable-browser.js +0 -23
  190. package/dist/node_modules/.pnpm/rimraf@3.0.2/node_modules/rimraf/rimraf.js +0 -229
  191. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js +0 -79
  192. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js +0 -282
  193. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js +0 -186
  194. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js +0 -14
  195. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js +0 -41
  196. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js +0 -34
  197. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js +0 -15
  198. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js +0 -11
  199. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js +0 -11
  200. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js +0 -32
  201. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js +0 -11
  202. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js +0 -11
  203. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js +0 -11
  204. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js +0 -22
  205. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js +0 -11
  206. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js +0 -11
  207. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js +0 -11
  208. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js +0 -11
  209. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js +0 -11
  210. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js +0 -19
  211. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js +0 -11
  212. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js +0 -14
  213. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js +0 -11
  214. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js +0 -11
  215. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js +0 -18
  216. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js +0 -11
  217. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js +0 -14
  218. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js +0 -99
  219. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js +0 -28
  220. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js +0 -8
  221. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js +0 -23
  222. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js +0 -36
  223. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js +0 -15
  224. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js +0 -84
  225. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js +0 -11
  226. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js +0 -15
  227. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js +0 -11
  228. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js +0 -31
  229. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js +0 -31
  230. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js +0 -45
  231. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js +0 -64
  232. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js +0 -35
  233. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js +0 -102
  234. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js +0 -11
  235. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js +0 -17
  236. package/dist/node_modules/.pnpm/set-blocking@2.0.0/node_modules/set-blocking/index.js +0 -12
  237. package/dist/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js +0 -130
  238. package/dist/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js +0 -16
  239. package/dist/node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js +0 -30
  240. package/dist/node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js +0 -10
  241. package/dist/node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js +0 -26
  242. package/dist/node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/browser.js +0 -59
  243. package/dist/node_modules/.pnpm/wide-align@1.1.5/node_modules/wide-align/align.js +0 -52
  244. package/dist/node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js +0 -26
@@ -0,0 +1,79 @@
1
+ import type { ChannelRouteRecord, KnowhereScope, PluginLogger, SaveStoredDocumentPayload, ScopeMode, StoredDocumentPayload, StoredDocumentRecord } from "./types";
2
+ export declare class KnowhereStore {
3
+ private readonly rootDir;
4
+ private readonly scopeMode;
5
+ private readonly logger;
6
+ private readonly indexCache;
7
+ private readonly documentPayloadCache;
8
+ private readonly scopeAccessChains;
9
+ private readonly scopeKeyAliases;
10
+ private readonly sessionScopeKeysBySessionId;
11
+ private readonly sessionScopeKeysBySessionKey;
12
+ private readonly channelRoutes;
13
+ private routesLoaded;
14
+ constructor(params: {
15
+ rootDir: string;
16
+ scopeMode: ScopeMode;
17
+ logger: PluginLogger;
18
+ });
19
+ registerScopeAlias(context: {
20
+ scopeKey: string;
21
+ sessionKey?: string;
22
+ sessionId?: string;
23
+ }): string;
24
+ registerMessageScope(context: {
25
+ sessionKey?: string;
26
+ sessionId?: string;
27
+ messageContext: unknown;
28
+ }): string | undefined;
29
+ registerChannelRoute(params: {
30
+ channelId: string;
31
+ accountId?: string;
32
+ conversationId?: string;
33
+ }): Promise<void>;
34
+ resolveChannelRoute(params: {
35
+ channelId?: string;
36
+ conversationId?: string;
37
+ sessionKey?: string;
38
+ }): Promise<ChannelRouteRecord | undefined>;
39
+ private lookupChannelRoute;
40
+ inheritScopeAlias(context: {
41
+ childSessionKey?: string;
42
+ childSessionId?: string;
43
+ requesterSessionKey?: string;
44
+ requesterSessionId?: string;
45
+ }): string | undefined;
46
+ resolveScope(context?: {
47
+ agentId?: string;
48
+ sessionKey?: string;
49
+ sessionId?: string;
50
+ }): KnowhereScope;
51
+ listDocuments(scope: KnowhereScope): Promise<StoredDocumentRecord[]>;
52
+ loadDocumentPayload(scope: KnowhereScope, docId: string): Promise<StoredDocumentPayload | null>;
53
+ getResultFileAbsolutePath(scope: KnowhereScope, docId: string, relativePath: string): string;
54
+ readResultFile(scope: KnowhereScope, docId: string, relativePath: string): Promise<{
55
+ document: StoredDocumentRecord;
56
+ relativePath: string;
57
+ text: string | null;
58
+ } | null>;
59
+ saveDownloadedDocument(scope: KnowhereScope, payload: SaveStoredDocumentPayload, options?: {
60
+ overwrite?: boolean;
61
+ }): Promise<StoredDocumentRecord>;
62
+ removeDocument(scope: KnowhereScope, docId: string): Promise<StoredDocumentRecord | null>;
63
+ clearScope(scope: KnowhereScope): Promise<StoredDocumentRecord[]>;
64
+ private getIndex;
65
+ private persistIndex;
66
+ private runWithScopeAccessLock;
67
+ private removeDocumentArtifacts;
68
+ private buildDocumentPayloadCacheKey;
69
+ private touchDocumentPayloadCache;
70
+ private deleteDocumentPayloadCache;
71
+ private deleteScopeDocumentPayloadCaches;
72
+ private loadOrBuildBrowseIndex;
73
+ private buildRouteKey;
74
+ private ensureRoutesLoaded;
75
+ private persistRoutes;
76
+ private resolveCanonicalScopeKey;
77
+ private resolveKnownScopeKey;
78
+ private rebuildIndex;
79
+ }
package/dist/text.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ export declare function normalizeWhitespace(value: unknown): string;
2
+ export declare function truncateText(value: unknown, maxChars: number): string;
3
+ export declare function slugify(value: unknown, fallback?: string): string;
4
+ export declare function hashString(value: string): string;
5
+ export declare function sanitizeStringArray(value: unknown): string[];
6
+ export declare function toComparableText(value: unknown): string;
7
+ export declare function stripHtmlTags(text: string): string;
8
+ export declare function stripLatex(text: string): string;
9
+ export declare function normalizeUnicode(text: string): string;
10
+ export declare function normalizeForGrep(text: string): string;
@@ -0,0 +1,10 @@
1
+ import { type AnyAgentTool, type OpenClawPluginApi } from "openclaw/plugin-sdk/core";
2
+ import { KnowhereStore } from "./store";
3
+ import type { KnowledgeGraphService } from "./kg-service";
4
+ import type { ResolvedKnowhereConfig, ToolRuntimeContext } from "./types";
5
+ export declare function createKnowhereToolFactory(params: {
6
+ api: OpenClawPluginApi;
7
+ config: ResolvedKnowhereConfig;
8
+ store: KnowhereStore;
9
+ kgService: KnowledgeGraphService;
10
+ }): (ctx: ToolRuntimeContext) => AnyAgentTool[];
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:");
@@ -0,0 +1,10 @@
1
+ import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
2
+ import type { ChannelRouteRecord } from "./types";
3
+ export declare function sendTrackerProgress(params: {
4
+ api: OpenClawPluginApi;
5
+ context?: unknown;
6
+ sessionKey?: string;
7
+ messages?: unknown[];
8
+ channelRoute?: ChannelRouteRecord;
9
+ text: string;
10
+ }): Promise<boolean>;
@@ -0,0 +1,320 @@
1
+ export type ScopeMode = "session" | "agent" | "global";
2
+ export type StringRecord = Record<string, unknown>;
3
+ export interface PluginLogger {
4
+ debug?: (message: string) => void;
5
+ info: (message: string) => void;
6
+ warn: (message: string) => void;
7
+ error: (message: string) => void;
8
+ }
9
+ export interface ToolRuntimeContext {
10
+ workspaceDir?: string;
11
+ agentId?: string;
12
+ accountId?: string;
13
+ sessionKey?: string;
14
+ sessionId?: string;
15
+ }
16
+ export interface ResolvedKnowhereConfig {
17
+ apiKey: string;
18
+ baseUrl: string;
19
+ storageDir: string;
20
+ scopeMode: ScopeMode;
21
+ pollIntervalMs: number;
22
+ pollTimeoutMs: number;
23
+ requestTimeoutMs: number;
24
+ uploadTimeoutMs: number;
25
+ }
26
+ export interface KnowhereStatistics {
27
+ total_chunks?: number;
28
+ text_chunks?: number;
29
+ image_chunks?: number;
30
+ table_chunks?: number;
31
+ total_pages?: number;
32
+ }
33
+ export interface KnowhereChecksum {
34
+ algorithm?: string;
35
+ value?: string;
36
+ }
37
+ export interface KnowhereManifest {
38
+ version?: string;
39
+ job_id?: string;
40
+ data_id?: string;
41
+ source_file_name?: string;
42
+ processing_date?: string;
43
+ checksum?: KnowhereChecksum;
44
+ statistics?: KnowhereStatistics;
45
+ files?: StringRecord;
46
+ }
47
+ export interface StoredChunk {
48
+ chunkId: string;
49
+ type: "text" | "image" | "table";
50
+ path: string | null;
51
+ summary: string;
52
+ content: string;
53
+ tokens: number | null;
54
+ keywords: string[];
55
+ relationships: unknown[];
56
+ metadata: StringRecord;
57
+ assetFilePath: string | null;
58
+ originalName: string | null;
59
+ tableType: string | null;
60
+ }
61
+ export interface StoredPathRecord {
62
+ path: string;
63
+ parentPath: string | null;
64
+ depth: number;
65
+ childPaths: string[];
66
+ chunkIds: string[];
67
+ directChunkCount: number;
68
+ chunkCount: number;
69
+ textChunkCount: number;
70
+ imageChunkCount: number;
71
+ tableChunkCount: number;
72
+ }
73
+ export type StoredResultFileKind = "manifest" | "chunks" | "fullMarkdown" | "kbCsv" | "hierarchy" | "hierarchyView" | "image" | "table" | "other";
74
+ export interface StoredResultFileRecord {
75
+ relativePath: string;
76
+ kind: StoredResultFileKind;
77
+ chunkId: string | null;
78
+ format: string | null;
79
+ sizeBytes: number | null;
80
+ }
81
+ export interface StoredBrowseIndex {
82
+ version: number;
83
+ paths: StoredPathRecord[];
84
+ chunkOrder: string[];
85
+ resultFiles: StoredResultFileRecord[];
86
+ }
87
+ export interface KnowhereParseResult {
88
+ manifest: KnowhereManifest;
89
+ chunks: StoredChunk[];
90
+ fullMarkdown: string;
91
+ hierarchy: unknown;
92
+ browseIndex: StoredBrowseIndex;
93
+ }
94
+ export interface KnowhereDownloadedResult {
95
+ zipBytes: Buffer;
96
+ rawZipSha1: string;
97
+ }
98
+ export interface KnowhereJob {
99
+ job_id: string;
100
+ status: string;
101
+ source_type: string;
102
+ data_id?: string | null;
103
+ created_at?: string | null;
104
+ upload_url?: string | null;
105
+ upload_headers?: Record<string, string> | null;
106
+ expires_in?: number | null;
107
+ }
108
+ export interface KnowhereJobError {
109
+ code?: string;
110
+ message?: string;
111
+ request_id?: string;
112
+ details?: unknown;
113
+ }
114
+ export interface KnowhereJobResult {
115
+ job_id: string;
116
+ status: string;
117
+ source_type: string;
118
+ data_id?: string | null;
119
+ created_at?: string | null;
120
+ progress?: unknown;
121
+ error?: KnowhereJobError | null;
122
+ result?: StringRecord | null;
123
+ result_url?: string | null;
124
+ result_url_expires_at?: string | null;
125
+ file_name?: string | null;
126
+ file_extension?: string | null;
127
+ model?: string | null;
128
+ ocr_enabled?: boolean | null;
129
+ duration_seconds?: number | null;
130
+ credits_spent?: number | null;
131
+ }
132
+ export interface KnowhereJobList {
133
+ jobs: KnowhereJobResult[];
134
+ total: number;
135
+ page: number;
136
+ pageSize: number;
137
+ totalPages: number;
138
+ }
139
+ export interface KnowhereJobListRequest {
140
+ page?: number;
141
+ pageSize?: number;
142
+ jobStatus?: string;
143
+ jobType?: string;
144
+ recentDays?: 1 | 7 | 30;
145
+ startTime?: string;
146
+ endTime?: string;
147
+ }
148
+ export interface KnowhereParsingParams {
149
+ model?: "base" | "advanced";
150
+ ocr_enabled?: boolean;
151
+ kb_dir?: string;
152
+ doc_type?: string;
153
+ smart_title_parse?: boolean;
154
+ summary_image?: boolean;
155
+ summary_table?: boolean;
156
+ summary_txt?: boolean;
157
+ add_frag_desc?: string;
158
+ }
159
+ export interface KnowhereIngestRequest {
160
+ filePath?: string;
161
+ fileName?: string;
162
+ url?: string;
163
+ dataId?: string;
164
+ parsingParams?: KnowhereParsingParams;
165
+ onJobCreated?: (job: KnowhereJob) => void | Promise<void>;
166
+ onJobUpdated?: (jobResult: KnowhereJobResult) => void | Promise<void>;
167
+ }
168
+ export interface KnowhereIngestResult {
169
+ job: KnowhereJob;
170
+ jobResult: KnowhereJobResult;
171
+ downloadedResult: KnowhereDownloadedResult;
172
+ }
173
+ export interface KnowhereScope {
174
+ mode: ScopeMode | "global";
175
+ key: string;
176
+ label: string;
177
+ rootDir: string;
178
+ documentsDir: string;
179
+ indexPath: string;
180
+ }
181
+ export interface StoredDocumentRecord {
182
+ id: string;
183
+ title: string;
184
+ sourceType: "file" | "url";
185
+ source: string;
186
+ sourceLabel: string;
187
+ fileName: string | null;
188
+ originalFileName: string | null;
189
+ dataId: string | null;
190
+ jobId: string | null;
191
+ checksum: string | null;
192
+ resultUrl: string | null;
193
+ resultUrlExpiresAt: string | null;
194
+ scopeLabel: string;
195
+ tags: string[];
196
+ ingestedAt: string;
197
+ updatedAt: string;
198
+ chunkCount: number;
199
+ statistics: KnowhereStatistics;
200
+ }
201
+ export interface StoredDocumentPayload {
202
+ version: number;
203
+ document: StoredDocumentRecord;
204
+ manifest: KnowhereManifest;
205
+ jobResult: KnowhereJobResult;
206
+ fullMarkdown: string;
207
+ hierarchy: unknown;
208
+ browseIndex: StoredBrowseIndex;
209
+ rawZipSha1: string;
210
+ chunks: StoredChunk[];
211
+ }
212
+ export interface StoredDocumentMetadata {
213
+ version: number;
214
+ document: StoredDocumentRecord;
215
+ jobResult: KnowhereJobResult;
216
+ rawZipSha1: string;
217
+ }
218
+ export interface KnowhereIndex {
219
+ version: number;
220
+ scopeMode: string;
221
+ scopeKey: string;
222
+ updatedAt: string | null;
223
+ documents: StoredDocumentRecord[];
224
+ }
225
+ export interface SaveStoredDocumentPayload {
226
+ sourceType: "file" | "url";
227
+ source: string;
228
+ sourceLabel?: string;
229
+ fileName: string | null;
230
+ docId?: string;
231
+ title?: string;
232
+ dataId?: string;
233
+ tags: string[];
234
+ job: KnowhereJob;
235
+ jobResult: KnowhereJobResult;
236
+ downloadedResult: KnowhereDownloadedResult;
237
+ }
238
+ export interface JsonSchemaObject {
239
+ [key: string]: unknown;
240
+ }
241
+ export interface ChannelRouteRecord {
242
+ readonly channelId: string;
243
+ readonly accountId: string;
244
+ readonly conversationId?: string;
245
+ readonly updatedAt: string;
246
+ }
247
+ export declare function isRecord(value: unknown): value is StringRecord;
248
+ export declare function isNodeError(error: unknown): error is NodeJS.ErrnoException;
249
+ export type KbIdSource = "disabled" | "agent" | "agent-session" | "global";
250
+ export interface KnowledgeGraphConnectConfig {
251
+ minKeywordOverlap: number;
252
+ keywordScoreWeight: number;
253
+ maxConnectionsPerChunk: number;
254
+ minScoreThreshold: number;
255
+ crossFileOnly: boolean;
256
+ maxContentOverlap: number;
257
+ }
258
+ export interface KnowledgeGraphConfig {
259
+ enableKnowledgeGraph: boolean;
260
+ kbId?: string;
261
+ kbIdSource?: KbIdSource;
262
+ concurrentBuildStrategy?: "queue" | "skip";
263
+ buildTimeout?: number;
264
+ notifyOnGraphFailure?: boolean;
265
+ connectConfig?: Partial<KnowledgeGraphConnectConfig>;
266
+ }
267
+ export interface GraphConnection {
268
+ source: string;
269
+ target: string;
270
+ score: number;
271
+ sharedKeywords: string[];
272
+ connectionType: string;
273
+ }
274
+ /**
275
+ * File-level edge in knowledge graph (matches SKILL.md schema)
276
+ */
277
+ export interface FileEdge {
278
+ source: string;
279
+ target: string;
280
+ connection_count: number;
281
+ avg_score: number;
282
+ top_connections: Array<{
283
+ source_chunk: string;
284
+ source_id: string;
285
+ target_chunk: string;
286
+ target_id: string;
287
+ relation: string;
288
+ score: number;
289
+ }>;
290
+ }
291
+ /**
292
+ * File metadata in knowledge graph (matches SKILL.md schema)
293
+ */
294
+ export interface FileMetadata {
295
+ chunks_count: number;
296
+ types: Record<string, number>;
297
+ top_keywords: string[];
298
+ top_summary: string;
299
+ importance: number;
300
+ }
301
+ /**
302
+ * Knowledge graph structure (matches SKILL.md schema)
303
+ */
304
+ export interface KnowledgeGraph {
305
+ version: string;
306
+ stats: {
307
+ total_files: number;
308
+ total_chunks: number;
309
+ total_cross_file_edges: number;
310
+ };
311
+ files: Record<string, FileMetadata>;
312
+ edges: FileEdge[];
313
+ }
314
+ export interface KbMetadata {
315
+ kbId: string;
316
+ createdAt: string;
317
+ lastUpdated: string;
318
+ documentCount: number;
319
+ config: Partial<KnowledgeGraphConnectConfig>;
320
+ }
@@ -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.5",
6
+ "version": "0.2.2",
7
7
  "uiHints": {
8
8
  "apiKey": {
9
9
  "label": "Knowhere API Key",