@ontos-ai/knowhere-claw 0.2.0 → 0.2.2
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.
- package/dist/__tests__/channel-route.test.d.ts +1 -0
- package/dist/__tests__/ingest-tool.test.d.ts +1 -0
- package/dist/__tests__/kg-service-test-helper.d.ts +2 -0
- package/dist/__tests__/kg-service.test.d.ts +1 -0
- package/dist/__tests__/read-result-file-tool.test.d.ts +1 -0
- package/dist/__tests__/tracker-progress.test.d.ts +1 -0
- package/dist/_virtual/_rolldown/runtime.js +1 -35
- package/dist/channel-delivery.d.ts +21 -0
- package/dist/client.d.ts +33 -0
- package/dist/client.js +1 -1
- package/dist/config.d.ts +13 -0
- package/dist/connect-builder.d.ts +48 -0
- package/dist/connect-builder.js +1 -2
- package/dist/error-message.d.ts +1 -0
- package/dist/graph-builder.d.ts +75 -0
- package/dist/graph-builder.js +9 -5
- package/dist/index.d.ts +9 -0
- package/dist/kg-service.d.ts +38 -0
- package/dist/kg-service.js +39 -33
- package/dist/parser.d.ts +16 -0
- package/dist/parser.js +1 -1
- package/dist/session.d.ts +11 -0
- package/dist/store.d.ts +79 -0
- package/dist/text.d.ts +10 -0
- package/dist/tools.d.ts +10 -0
- package/dist/tracker-progress.d.ts +10 -0
- package/dist/types.d.ts +320 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -3
- package/dist/node_modules/.pnpm/@knowhere-ai_sdk@0.1.1/node_modules/@knowhere-ai/sdk/dist/index.js +0 -717
- 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
- package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/pre-binding.js +0 -35
- 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
- package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/napi.js +0 -142
- 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
- package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js +0 -199
- package/dist/node_modules/.pnpm/@mapbox_node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/package.js +0 -67
- package/dist/node_modules/.pnpm/abbrev@1.1.1/node_modules/abbrev/abbrev.js +0 -59
- package/dist/node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js +0 -11
- package/dist/node_modules/.pnpm/aproba@2.1.0/node_modules/aproba/index.js +0 -119
- package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/index.js +0 -13
- package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker-base.js +0 -16
- package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker-group.js +0 -98
- package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker-stream.js +0 -37
- package/dist/node_modules/.pnpm/are-we-there-yet@2.0.0/node_modules/are-we-there-yet/lib/tracker.js +0 -32
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/adapters.js +0 -83
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/fetch.js +0 -170
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/xhr.js +0 -106
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/axios.js +0 -57
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/CancelToken.js +0 -90
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/CanceledError.js +0 -20
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/isCancel.js +0 -6
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/Axios.js +0 -174
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/AxiosError.js +0 -70
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/AxiosHeaders.js +0 -204
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/InterceptorManager.js +0 -60
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/buildFullPath.js +0 -20
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/dispatchRequest.js +0 -52
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/mergeConfig.js +0 -81
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/settle.js +0 -18
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/transformData.js +0 -25
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/defaults/index.js +0 -107
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/defaults/transitional.js +0 -9
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/env/data.js +0 -4
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -50
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -77
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/bind.js +0 -15
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/buildURL.js +0 -40
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/combineURLs.js +0 -14
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/composeSignals.js +0 -39
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/cookies.js +0 -31
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/formDataToJSON.js +0 -67
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -14
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -8
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/parseHeaders.js +0 -53
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/parseProtocol.js +0 -7
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/progressEventReducer.js +0 -38
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/resolveConfig.js +0 -36
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/speedometer.js +0 -36
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/spread.js +0 -29
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/throttle.js +0 -38
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/toFormData.js +0 -151
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -18
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/trackStream.js +0 -69
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/validator.js +0 -76
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -4
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -4
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -5
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/index.js +0 -22
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/common/utils.js +0 -46
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/index.js +0 -9
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/utils.js +0 -698
- package/dist/node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js +0 -53
- package/dist/node_modules/.pnpm/brace-expansion@1.1.12/node_modules/brace-expansion/index.js +0 -132
- package/dist/node_modules/.pnpm/color-support@1.1.3/node_modules/color-support/browser.js +0 -18
- package/dist/node_modules/.pnpm/concat-map@0.0.1/node_modules/concat-map/index.js +0 -19
- package/dist/node_modules/.pnpm/console-control-strings@1.1.0/node_modules/console-control-strings/index.js +0 -104
- package/dist/node_modules/.pnpm/delegates@1.0.0/node_modules/delegates/index.js +0 -104
- package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/detect-libc.js +0 -221
- package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/elf.js +0 -26
- package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/filesystem.js +0 -48
- package/dist/node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/process.js +0 -24
- package/dist/node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js +0 -10
- package/dist/node_modules/.pnpm/fflate@0.8.2/node_modules/fflate/esm/browser.js +0 -426
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy-sync.js +0 -120
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy.js +0 -100
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/index.js +0 -15
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/empty/index.js +0 -43
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/file.js +0 -53
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/index.js +0 -27
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/link.js +0 -56
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-paths.js +0 -89
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-type.js +0 -35
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink.js +0 -81
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js +0 -113
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/index.js +0 -29
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/index.js +0 -22
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/jsonfile.js +0 -15
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json-sync.js +0 -15
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json.js +0 -15
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js +0 -20
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/make-dir.js +0 -33
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/utils.js +0 -17
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/index.js +0 -15
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move-sync.js +0 -56
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move.js +0 -49
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/output-file/index.js +0 -30
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js +0 -18
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/remove/index.js +0 -27
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/async.js +0 -15
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js +0 -131
- package/dist/node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/utimes.js +0 -34
- package/dist/node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js +0 -51
- package/dist/node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js +0 -171
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/base-theme.js +0 -21
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/error.js +0 -27
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/has-color.js +0 -9
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/index.js +0 -224
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/plumbing.js +0 -48
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/process.js +0 -8
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/progress-bar.js +0 -46
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/render-template.js +0 -155
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/set-immediate.js +0 -14
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/set-interval.js +0 -8
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/spin.js +0 -10
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/template-item.js +0 -58
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/theme-set.js +0 -99
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/themes.js +0 -67
- package/dist/node_modules/.pnpm/gauge@3.0.2/node_modules/gauge/wide-truncate.js +0 -22
- package/dist/node_modules/.pnpm/glob@7.2.3/node_modules/glob/common.js +0 -162
- package/dist/node_modules/.pnpm/glob@7.2.3/node_modules/glob/glob.js +0 -451
- package/dist/node_modules/.pnpm/glob@7.2.3/node_modules/glob/sync.js +0 -280
- package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js +0 -20
- package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js +0 -362
- package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js +0 -92
- package/dist/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js +0 -255
- package/dist/node_modules/.pnpm/has-unicode@2.0.1/node_modules/has-unicode/index.js +0 -14
- package/dist/node_modules/.pnpm/inflight@1.0.6/node_modules/inflight/inflight.js +0 -45
- package/dist/node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js +0 -27
- package/dist/node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js +0 -14
- package/dist/node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/index.js +0 -68
- package/dist/node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/utils.js +0 -19
- package/dist/node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js +0 -3110
- package/dist/node_modules/.pnpm/minimatch@3.1.5/node_modules/minimatch/minimatch.js +0 -578
- package/dist/node_modules/.pnpm/nodejieba@2.6.0/node_modules/nodejieba/index.js +0 -46
- package/dist/node_modules/.pnpm/nopt@5.0.0/node_modules/nopt/lib/nopt.js +0 -330
- package/dist/node_modules/.pnpm/npmlog@5.0.1/node_modules/npmlog/log.js +0 -305
- package/dist/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +0 -54
- package/dist/node_modules/.pnpm/once@1.4.0/node_modules/once/once.js +0 -44
- package/dist/node_modules/.pnpm/path-is-absolute@1.0.1/node_modules/path-is-absolute/index.js +0 -19
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/errors-browser.js +0 -88
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_duplex.js +0 -75
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_passthrough.js +0 -19
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_readable.js +0 -666
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_transform.js +0 -89
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_writable.js +0 -423
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/async_iterator.js +0 -172
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/buffer_list.js +0 -243
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -77
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +0 -87
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from-browser.js +0 -10
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/pipeline.js +0 -80
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/state.js +0 -21
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -8
- package/dist/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/readable-browser.js +0 -23
- package/dist/node_modules/.pnpm/rimraf@3.0.2/node_modules/rimraf/rimraf.js +0 -229
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js +0 -79
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js +0 -282
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js +0 -186
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js +0 -14
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js +0 -41
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js +0 -34
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js +0 -15
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js +0 -32
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js +0 -22
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js +0 -19
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js +0 -14
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js +0 -18
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js +0 -14
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js +0 -99
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js +0 -28
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js +0 -8
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js +0 -23
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js +0 -36
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js +0 -15
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js +0 -84
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js +0 -15
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js +0 -31
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js +0 -31
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js +0 -45
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js +0 -64
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js +0 -35
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js +0 -102
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js +0 -17
- package/dist/node_modules/.pnpm/set-blocking@2.0.0/node_modules/set-blocking/index.js +0 -12
- package/dist/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js +0 -130
- package/dist/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js +0 -16
- package/dist/node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js +0 -30
- package/dist/node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js +0 -10
- package/dist/node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js +0 -26
- package/dist/node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/browser.js +0 -59
- package/dist/node_modules/.pnpm/wide-align@1.1.5/node_modules/wide-align/align.js +0 -52
- package/dist/node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js +0 -26
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 {
|
|
4
|
+
export { __esmMin };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
|
2
|
+
import type { ChannelRouteRecord } from "./types";
|
|
3
|
+
type DeliverySurface = "discord" | "imessage" | "line" | "signal" | "slack" | "telegram" | "whatsapp";
|
|
4
|
+
type DeliveryResult = {
|
|
5
|
+
delivered: boolean;
|
|
6
|
+
surface?: DeliverySurface;
|
|
7
|
+
to?: string;
|
|
8
|
+
accountId?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function deliverChannelMessage(params: {
|
|
11
|
+
api: OpenClawPluginApi;
|
|
12
|
+
operationLabel: string;
|
|
13
|
+
context?: unknown;
|
|
14
|
+
sessionKey?: string;
|
|
15
|
+
messages?: unknown[];
|
|
16
|
+
channelRoute?: ChannelRouteRecord;
|
|
17
|
+
text: string;
|
|
18
|
+
mediaUrl?: string;
|
|
19
|
+
mediaLocalRoots?: readonly string[];
|
|
20
|
+
}): Promise<DeliveryResult>;
|
|
21
|
+
export {};
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { KnowhereIngestRequest, KnowhereIngestResult, KnowhereJobList, KnowhereJobListRequest, KnowhereJobResult } from "./types";
|
|
2
|
+
export declare class KnowhereClient {
|
|
3
|
+
private readonly apiKey;
|
|
4
|
+
private readonly baseUrl;
|
|
5
|
+
private readonly requestTimeoutMs;
|
|
6
|
+
private readonly uploadTimeoutMs;
|
|
7
|
+
private readonly pollIntervalMs;
|
|
8
|
+
private readonly pollTimeoutMs;
|
|
9
|
+
private readonly logger;
|
|
10
|
+
private readonly sdk;
|
|
11
|
+
constructor(params: {
|
|
12
|
+
apiKey: string;
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
requestTimeoutMs: number;
|
|
15
|
+
uploadTimeoutMs: number;
|
|
16
|
+
pollIntervalMs: number;
|
|
17
|
+
pollTimeoutMs: number;
|
|
18
|
+
logger: {
|
|
19
|
+
debug?: (message: string) => void;
|
|
20
|
+
info: (message: string) => void;
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
ingestDocument(params: KnowhereIngestRequest): Promise<KnowhereIngestResult>;
|
|
24
|
+
private logPollProgress;
|
|
25
|
+
getJob(jobId: string): Promise<KnowhereJobResult>;
|
|
26
|
+
listJobs(options?: KnowhereJobListRequest): Promise<KnowhereJobList>;
|
|
27
|
+
getCompletedJobResult(jobId: string): Promise<KnowhereIngestResult>;
|
|
28
|
+
private downloadResultArchive;
|
|
29
|
+
private uploadFile;
|
|
30
|
+
private requestJson;
|
|
31
|
+
private requestBuffer;
|
|
32
|
+
private request;
|
|
33
|
+
}
|
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,
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
|
2
|
+
import type { JsonSchemaObject, ResolvedKnowhereConfig, StringRecord, KnowledgeGraphConfig } from "./types";
|
|
3
|
+
export declare const DEFAULT_BASE_URL = "https://api.knowhereto.ai";
|
|
4
|
+
export declare const knowherePluginConfigSchema: JsonSchemaObject;
|
|
5
|
+
export declare function resolveKnowhereConfig(api: OpenClawPluginApi): ResolvedKnowhereConfig;
|
|
6
|
+
export declare const API_KEY_URL = "https://knowhereto.ai/api-keys";
|
|
7
|
+
export declare const PURCHASE_CREDITS_URL = "https://knowhereto.ai/usage?buy=true";
|
|
8
|
+
export declare function assertKnowhereApiKey(config: ResolvedKnowhereConfig): void;
|
|
9
|
+
export declare function isPaymentRequiredError(error: unknown): boolean;
|
|
10
|
+
export declare function formatPaymentRequiredMessage(): string;
|
|
11
|
+
export declare function readPersistedApiKey(storageDir: string): Promise<string | null>;
|
|
12
|
+
export declare function persistApiKey(storageDir: string, apiKey: string): Promise<void>;
|
|
13
|
+
export declare function resolveKnowledgeGraphConfig(raw: StringRecord): KnowledgeGraphConfig;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection Builder Module
|
|
3
|
+
*
|
|
4
|
+
* TypeScript implementation of knowhere-api/apps/worker/app/services/connect_builder/builder.py
|
|
5
|
+
* Builds connections between chunks based on keyword overlap and content similarity.
|
|
6
|
+
*/
|
|
7
|
+
import type { PluginLogger } from "./types";
|
|
8
|
+
/**
|
|
9
|
+
* Chunk data structure for building connections
|
|
10
|
+
*/
|
|
11
|
+
export interface ChunkData {
|
|
12
|
+
chunk_id: string;
|
|
13
|
+
path: string;
|
|
14
|
+
content: string;
|
|
15
|
+
metadata: {
|
|
16
|
+
keywords?: string[];
|
|
17
|
+
tokens?: string[];
|
|
18
|
+
summary?: string;
|
|
19
|
+
length?: number;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Connection result between two chunks
|
|
25
|
+
*/
|
|
26
|
+
export interface Connection {
|
|
27
|
+
source: string;
|
|
28
|
+
target: string;
|
|
29
|
+
relation: string;
|
|
30
|
+
score: number;
|
|
31
|
+
sharedKeywords: string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Configuration for connection building
|
|
35
|
+
*/
|
|
36
|
+
export interface ConnectBuilderConfig {
|
|
37
|
+
minKeywordOverlap: number;
|
|
38
|
+
keywordScoreWeight: number;
|
|
39
|
+
maxConnectionsPerChunk: number;
|
|
40
|
+
minScoreThreshold: number;
|
|
41
|
+
crossFileOnly: boolean;
|
|
42
|
+
maxContentOverlap: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Main function to build connections between chunks
|
|
46
|
+
* Equivalent to Python: build_connections
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildConnections(chunks: ChunkData[], config: ConnectBuilderConfig, logger?: PluginLogger): Connection[];
|
package/dist/connect-builder.js
CHANGED
|
@@ -120,7 +120,6 @@ function buildConnections(chunks, config, logger) {
|
|
|
120
120
|
const sourceChunk = chunkById.get(sourceId);
|
|
121
121
|
if (!sourceChunk) continue;
|
|
122
122
|
const sourceKeywords = getKeywords(sourceChunk);
|
|
123
|
-
sourceKeywords.map(normalizeKeyword);
|
|
124
123
|
const sourceFileKey = extractFileKey(sourceChunk.path);
|
|
125
124
|
for (const targetId of targetIds) {
|
|
126
125
|
const targetChunk = chunkById.get(targetId);
|
|
@@ -165,7 +164,7 @@ function buildConnections(chunks, config, logger) {
|
|
|
165
164
|
connectionsByChunk.get(conn.target).push(conn);
|
|
166
165
|
}
|
|
167
166
|
const kept = /* @__PURE__ */ new Set();
|
|
168
|
-
for (const [
|
|
167
|
+
for (const [, conns] of connectionsByChunk) {
|
|
169
168
|
const topN = conns.sort((a, b) => b.score - a.score).slice(0, config.maxConnectionsPerChunk);
|
|
170
169
|
for (const conn of topN) kept.add(conn);
|
|
171
170
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatErrorMessage(error: unknown): string;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph Builder Module
|
|
3
|
+
*
|
|
4
|
+
* TypeScript implementation of knowhere-api/apps/worker/app/services/connect_builder/graph_builder.py
|
|
5
|
+
* Builds file-level knowledge graphs from chunk connections with TF-IDF and importance scoring.
|
|
6
|
+
*/
|
|
7
|
+
import type { ChunkData, Connection } from "./connect-builder";
|
|
8
|
+
import type { PluginLogger } from "./types";
|
|
9
|
+
/**
|
|
10
|
+
* File-level edge in the knowledge graph
|
|
11
|
+
*/
|
|
12
|
+
interface FileEdge {
|
|
13
|
+
source: string;
|
|
14
|
+
target: string;
|
|
15
|
+
connection_count: number;
|
|
16
|
+
avg_score: number;
|
|
17
|
+
top_connections: Array<{
|
|
18
|
+
source_chunk: string;
|
|
19
|
+
source_id: string;
|
|
20
|
+
target_chunk: string;
|
|
21
|
+
target_id: string;
|
|
22
|
+
relation: string;
|
|
23
|
+
score: number;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* File metadata in the knowledge graph
|
|
28
|
+
*/
|
|
29
|
+
interface FileMetadata {
|
|
30
|
+
chunks_count: number;
|
|
31
|
+
types: Record<string, number>;
|
|
32
|
+
top_keywords: string[];
|
|
33
|
+
top_summary: string;
|
|
34
|
+
importance: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Complete knowledge graph structure
|
|
38
|
+
*/
|
|
39
|
+
export interface KnowledgeGraph {
|
|
40
|
+
version: string;
|
|
41
|
+
stats: {
|
|
42
|
+
total_files: number;
|
|
43
|
+
total_chunks: number;
|
|
44
|
+
total_cross_file_edges: number;
|
|
45
|
+
};
|
|
46
|
+
files: Record<string, FileMetadata>;
|
|
47
|
+
edges: FileEdge[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Chunk statistics for usage tracking
|
|
51
|
+
*/
|
|
52
|
+
export interface ChunkStats {
|
|
53
|
+
[chunkId: string]: {
|
|
54
|
+
hit_count: number;
|
|
55
|
+
last_accessed?: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Main function to build knowledge graph
|
|
60
|
+
* Equivalent to Python: build_knowledge_graph
|
|
61
|
+
*/
|
|
62
|
+
export declare function buildKnowledgeGraph(chunks: ChunkData[], connections: Connection[], chunkStats: ChunkStats, jiebaInitialized: boolean, logger?: PluginLogger): KnowledgeGraph;
|
|
63
|
+
/**
|
|
64
|
+
* Incremental update: match new chunks against existing chunks
|
|
65
|
+
* Equivalent to Python: _incremental_connections
|
|
66
|
+
*/
|
|
67
|
+
export declare function incrementalConnections(newChunks: ChunkData[], existingChunks: ChunkData[], config: {
|
|
68
|
+
minKeywordOverlap: number;
|
|
69
|
+
keywordScoreWeight: number;
|
|
70
|
+
maxConnectionsPerChunk: number;
|
|
71
|
+
minScoreThreshold: number;
|
|
72
|
+
crossFileOnly: boolean;
|
|
73
|
+
maxContentOverlap: number;
|
|
74
|
+
}, logger?: PluginLogger): Connection[];
|
|
75
|
+
export {};
|
package/dist/graph-builder.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
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
|
-
|
|
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,13 +29,13 @@ 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
|
|
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;
|
|
32
36
|
return true;
|
|
33
37
|
});
|
|
34
|
-
} catch
|
|
38
|
+
} catch {
|
|
35
39
|
return cleanContent.split(/\s+/).filter((w) => w.length > 1);
|
|
36
40
|
}
|
|
37
41
|
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
|
2
|
+
declare const plugin: {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
configSchema: import("./types").JsonSchemaObject;
|
|
7
|
+
register(api: OpenClawPluginApi): void;
|
|
8
|
+
};
|
|
9
|
+
export default plugin;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { KnowledgeGraphConfig, PluginLogger, ToolRuntimeContext, KbMetadata, KnowledgeGraph, FileEdge } from "./types";
|
|
2
|
+
export interface KnowledgeGraphServiceParams {
|
|
3
|
+
config: KnowledgeGraphConfig;
|
|
4
|
+
logger: PluginLogger;
|
|
5
|
+
}
|
|
6
|
+
type DegradationMode = "full" | "basic" | "disabled";
|
|
7
|
+
export declare class KnowledgeGraphService {
|
|
8
|
+
private readonly config;
|
|
9
|
+
private readonly logger;
|
|
10
|
+
private degradationMode;
|
|
11
|
+
private buildQueues;
|
|
12
|
+
private jiebaInitialized;
|
|
13
|
+
constructor(params: KnowledgeGraphServiceParams);
|
|
14
|
+
initialize(): Promise<void>;
|
|
15
|
+
private checkPythonEnvironment;
|
|
16
|
+
private initializeJieba;
|
|
17
|
+
extractKeywords(text: string, topK?: number): Promise<string[]>;
|
|
18
|
+
resolveKbId(context: ToolRuntimeContext): string | null;
|
|
19
|
+
getKbPath(kbId: string): string;
|
|
20
|
+
ensureKbDirectory(kbId: string): Promise<string>;
|
|
21
|
+
saveDocumentToKb(params: {
|
|
22
|
+
kbId: string;
|
|
23
|
+
docId: string;
|
|
24
|
+
sourcePath: string;
|
|
25
|
+
keywords: string[];
|
|
26
|
+
metadata: Record<string, unknown>;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
scheduleBuild(kbId: string, task: () => Promise<void>): Promise<void>;
|
|
29
|
+
buildKnowledgeGraph(kbId: string): Promise<void>;
|
|
30
|
+
private updateKbMetadata;
|
|
31
|
+
queryGraph(kbId: string, fileKey?: string): Promise<FileEdge[]>;
|
|
32
|
+
getKnowledgeGraph(kbId: string): Promise<KnowledgeGraph | null>;
|
|
33
|
+
listKnowledgeBases(): Promise<string[]>;
|
|
34
|
+
getKbMetadata(kbId: string): Promise<KbMetadata | null>;
|
|
35
|
+
isEnabled(): boolean;
|
|
36
|
+
getDegradationMode(): DegradationMode;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
package/dist/kg-service.js
CHANGED
|
@@ -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,
|
|
@@ -25,6 +22,15 @@ const DEFAULT_KG_CONFIG = {
|
|
|
25
22
|
buildTimeout: 3e5,
|
|
26
23
|
notifyOnGraphFailure: false
|
|
27
24
|
};
|
|
25
|
+
function formatUnknownError(error) {
|
|
26
|
+
return error instanceof Error ? error.message : String(error);
|
|
27
|
+
}
|
|
28
|
+
function extractKeywordText(item) {
|
|
29
|
+
if (typeof item === "string") return item;
|
|
30
|
+
if (typeof item === "number" || typeof item === "boolean" || typeof item === "bigint") return String(item);
|
|
31
|
+
if (typeof item === "object" && item !== null && "word" in item && typeof item.word === "string") return item.word;
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
28
34
|
var KnowledgeGraphService = class {
|
|
29
35
|
config;
|
|
30
36
|
logger;
|
|
@@ -68,7 +74,7 @@ var KnowledgeGraphService = class {
|
|
|
68
74
|
async checkPythonEnvironment() {
|
|
69
75
|
return new Promise((resolve, reject) => {
|
|
70
76
|
const python = spawn("python3", ["--version"]);
|
|
71
|
-
python.on("error", (
|
|
77
|
+
python.on("error", () => {
|
|
72
78
|
const error = /* @__PURE__ */ new Error("Python3 not found in PATH");
|
|
73
79
|
error.code = "PYTHON_MISSING";
|
|
74
80
|
reject(error);
|
|
@@ -87,10 +93,10 @@ var KnowledgeGraphService = class {
|
|
|
87
93
|
}
|
|
88
94
|
async initializeJieba() {
|
|
89
95
|
try {
|
|
90
|
-
|
|
96
|
+
nodejieba.load();
|
|
91
97
|
this.jiebaInitialized = true;
|
|
92
98
|
this.logger.info("Nodejieba initialized successfully");
|
|
93
|
-
} catch
|
|
99
|
+
} catch {
|
|
94
100
|
const err = /* @__PURE__ */ new Error("Failed to initialize nodejieba");
|
|
95
101
|
err.code = "NODEJIEBA_MISSING";
|
|
96
102
|
throw err;
|
|
@@ -99,14 +105,14 @@ var KnowledgeGraphService = class {
|
|
|
99
105
|
async extractKeywords(text, topK = 20) {
|
|
100
106
|
if (this.degradationMode === "disabled") return [];
|
|
101
107
|
if (this.degradationMode === "full" && this.jiebaInitialized) try {
|
|
102
|
-
const rawKeywords =
|
|
103
|
-
return (Array.isArray(rawKeywords) ? rawKeywords : []).map((item) =>
|
|
108
|
+
const rawKeywords = nodejieba.extract(text, topK);
|
|
109
|
+
return (Array.isArray(rawKeywords) ? rawKeywords : []).map((item) => extractKeywordText(item)).filter((keyword) => keyword !== null).filter((kw) => {
|
|
104
110
|
if (kw.length <= 1) return false;
|
|
105
111
|
if (/^\d+$/.test(kw)) return false;
|
|
106
112
|
return true;
|
|
107
113
|
}).slice(0, topK);
|
|
108
114
|
} catch (error) {
|
|
109
|
-
this.logger.warn(`Jieba extraction failed, falling back to basic: ${error}`);
|
|
115
|
+
this.logger.warn(`Jieba extraction failed, falling back to basic: ${formatUnknownError(error)}`);
|
|
110
116
|
this.degradationMode = "basic";
|
|
111
117
|
}
|
|
112
118
|
return text.split(/\s+/).filter((w) => w.length > 1).slice(0, topK);
|
|
@@ -130,18 +136,18 @@ var KnowledgeGraphService = class {
|
|
|
130
136
|
}
|
|
131
137
|
async ensureKbDirectory(kbId) {
|
|
132
138
|
const kbPath = this.getKbPath(kbId);
|
|
133
|
-
await
|
|
139
|
+
await fs.ensureDir(kbPath);
|
|
134
140
|
return kbPath;
|
|
135
141
|
}
|
|
136
142
|
async saveDocumentToKb(params) {
|
|
137
143
|
const kbPath = await this.ensureKbDirectory(params.kbId);
|
|
138
144
|
const docDir = path.join(kbPath, params.docId);
|
|
139
|
-
await
|
|
140
|
-
await
|
|
145
|
+
await fs.ensureDir(docDir);
|
|
146
|
+
await fs.copy(params.sourcePath, docDir, { overwrite: true });
|
|
141
147
|
const keywordsPath = path.join(docDir, "keywords.json");
|
|
142
|
-
await
|
|
148
|
+
await fs.writeJSON(keywordsPath, params.keywords, { spaces: 2 });
|
|
143
149
|
const metadataPath = path.join(docDir, "metadata.json");
|
|
144
|
-
await
|
|
150
|
+
await fs.writeJSON(metadataPath, params.metadata, { spaces: 2 });
|
|
145
151
|
this.logger.info(`Document saved to knowledge base: kb=${params.kbId} doc=${params.docId}`);
|
|
146
152
|
}
|
|
147
153
|
async scheduleBuild(kbId, task) {
|
|
@@ -162,11 +168,11 @@ var KnowledgeGraphService = class {
|
|
|
162
168
|
}
|
|
163
169
|
async buildKnowledgeGraph(kbId) {
|
|
164
170
|
const kbPath = this.getKbPath(kbId);
|
|
165
|
-
const docs = await
|
|
171
|
+
const docs = await fs.readdir(kbPath);
|
|
166
172
|
const docDirs = [];
|
|
167
173
|
for (const doc of docs) {
|
|
168
174
|
const docPath = path.join(kbPath, doc);
|
|
169
|
-
if ((await
|
|
175
|
+
if ((await fs.stat(docPath)).isDirectory() && doc !== "knowledge_graph.json" && doc !== "chunk_stats.json" && doc !== "kb_metadata.json") docDirs.push(doc);
|
|
170
176
|
}
|
|
171
177
|
if (docDirs.length < 2) {
|
|
172
178
|
this.logger.info(`Not enough documents for graph building (need >=2, have ${docDirs.length}), skipping`);
|
|
@@ -177,8 +183,8 @@ var KnowledgeGraphService = class {
|
|
|
177
183
|
const allChunks = [];
|
|
178
184
|
for (const docDir of docDirs) {
|
|
179
185
|
const chunksPath = path.join(kbPath, docDir, "chunks.json");
|
|
180
|
-
if (await
|
|
181
|
-
const chunksData = await
|
|
186
|
+
if (await fs.pathExists(chunksPath)) {
|
|
187
|
+
const chunksData = await fs.readJSON(chunksPath);
|
|
182
188
|
if (chunksData.chunks && Array.isArray(chunksData.chunks)) allChunks.push(...chunksData.chunks);
|
|
183
189
|
}
|
|
184
190
|
}
|
|
@@ -191,10 +197,10 @@ var KnowledgeGraphService = class {
|
|
|
191
197
|
this.logger.info(`Built ${connections.length} connections`);
|
|
192
198
|
const chunkStatsPath = path.join(kbPath, "chunk_stats.json");
|
|
193
199
|
let chunkStats = {};
|
|
194
|
-
if (await
|
|
200
|
+
if (await fs.pathExists(chunkStatsPath)) chunkStats = await fs.readJSON(chunkStatsPath);
|
|
195
201
|
const knowledgeGraph = buildKnowledgeGraph(allChunks, connections, chunkStats, this.jiebaInitialized, this.logger);
|
|
196
202
|
const graphFile = path.join(kbPath, "knowledge_graph.json");
|
|
197
|
-
await
|
|
203
|
+
await fs.writeJSON(graphFile, knowledgeGraph, { spaces: 2 });
|
|
198
204
|
this.logger.info(`Knowledge graph saved to ${graphFile}`);
|
|
199
205
|
await this.updateKbMetadata(kbPath, {
|
|
200
206
|
lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -202,41 +208,41 @@ var KnowledgeGraphService = class {
|
|
|
202
208
|
});
|
|
203
209
|
this.logger.info(`Knowledge graph built successfully for kb=${kbId}`);
|
|
204
210
|
} catch (error) {
|
|
205
|
-
this.logger.error(`Failed to build knowledge graph: ${error}`);
|
|
211
|
+
this.logger.error(`Failed to build knowledge graph: ${formatUnknownError(error)}`);
|
|
206
212
|
throw error;
|
|
207
213
|
}
|
|
208
214
|
}
|
|
209
215
|
async updateKbMetadata(kbPath, updates) {
|
|
210
216
|
const metadataPath = path.join(kbPath, "kb_metadata.json");
|
|
211
217
|
let metadata = {};
|
|
212
|
-
if (await
|
|
218
|
+
if (await fs.pathExists(metadataPath)) metadata = await fs.readJSON(metadataPath);
|
|
213
219
|
const updated = {
|
|
214
220
|
...metadata,
|
|
215
221
|
...updates
|
|
216
222
|
};
|
|
217
|
-
await
|
|
223
|
+
await fs.writeJSON(metadataPath, updated, { spaces: 2 });
|
|
218
224
|
}
|
|
219
225
|
async queryGraph(kbId, fileKey) {
|
|
220
226
|
const graphPath = path.join(this.getKbPath(kbId), "knowledge_graph.json");
|
|
221
|
-
if (!await
|
|
222
|
-
const graph = await
|
|
227
|
+
if (!await fs.pathExists(graphPath)) return [];
|
|
228
|
+
const graph = await fs.readJSON(graphPath);
|
|
223
229
|
if (!fileKey) return graph.edges;
|
|
224
230
|
return graph.edges.filter((edge) => edge.source === fileKey || edge.target === fileKey);
|
|
225
231
|
}
|
|
226
232
|
async getKnowledgeGraph(kbId) {
|
|
227
233
|
const graphPath = path.join(this.getKbPath(kbId), "knowledge_graph.json");
|
|
228
|
-
if (!await
|
|
229
|
-
return await
|
|
234
|
+
if (!await fs.pathExists(graphPath)) return null;
|
|
235
|
+
return await fs.readJSON(graphPath);
|
|
230
236
|
}
|
|
231
237
|
async listKnowledgeBases() {
|
|
232
238
|
const knowhereRoot = path.join(os.homedir(), ".knowhere");
|
|
233
|
-
if (!await
|
|
234
|
-
return (await
|
|
239
|
+
if (!await fs.pathExists(knowhereRoot)) return [];
|
|
240
|
+
return (await fs.readdir(knowhereRoot, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name);
|
|
235
241
|
}
|
|
236
242
|
async getKbMetadata(kbId) {
|
|
237
243
|
const metadataPath = path.join(this.getKbPath(kbId), "kb_metadata.json");
|
|
238
|
-
if (!await
|
|
239
|
-
return await
|
|
244
|
+
if (!await fs.pathExists(metadataPath)) return null;
|
|
245
|
+
return await fs.readJSON(metadataPath);
|
|
240
246
|
}
|
|
241
247
|
isEnabled() {
|
|
242
248
|
return this.degradationMode !== "disabled";
|
package/dist/parser.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { KnowhereDownloadedResult, KnowhereManifest, KnowhereParseResult, KnowhereStatistics, StoredBrowseIndex, StoredChunk } from "./types";
|
|
2
|
+
type KnowhereStoredResultSummary = {
|
|
3
|
+
manifest: KnowhereManifest;
|
|
4
|
+
chunkCount: number;
|
|
5
|
+
statistics: KnowhereStatistics;
|
|
6
|
+
};
|
|
7
|
+
export declare const STORED_BROWSE_INDEX_VERSION = 2;
|
|
8
|
+
export declare function resolveResultEntryPath(rootDir: string, entryPath: string): string;
|
|
9
|
+
export declare function buildStoredPathPrefixes(storedPath: string): string[];
|
|
10
|
+
export declare function isStoredBrowseIndex(value: unknown): value is StoredBrowseIndex;
|
|
11
|
+
export declare function buildStoredBrowseIndex(resultDir: string, manifest: KnowhereManifest, chunks: StoredChunk[]): Promise<StoredBrowseIndex>;
|
|
12
|
+
export declare function extractKnowhereResultArchive(downloadedResult: KnowhereDownloadedResult, targetDir: string): Promise<void>;
|
|
13
|
+
export declare function readStoredKnowhereResultSummary(resultDir: string): Promise<KnowhereStoredResultSummary>;
|
|
14
|
+
export declare function readStoredKnowhereResultContent(resultDir: string): Promise<Omit<KnowhereParseResult, "browseIndex">>;
|
|
15
|
+
export declare function readStoredKnowhereParseResult(resultDir: string): Promise<KnowhereParseResult>;
|
|
16
|
+
export {};
|
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";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ParsedConversationSessionKey = {
|
|
2
|
+
agentId: string;
|
|
3
|
+
surface: string;
|
|
4
|
+
remainder: string;
|
|
5
|
+
segments: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare function parseConversationSessionKey(sessionKey: string | undefined): ParsedConversationSessionKey | undefined;
|
|
8
|
+
export declare function normalizeConversationScopeKey(sessionKey: string | undefined): string | undefined;
|
|
9
|
+
export declare function resolveSharedConversationScopeKey(sessionKey: string | undefined): string | undefined;
|
|
10
|
+
export declare function findConversationSegmentValue(session: ParsedConversationSessionKey | undefined, ...keys: string[]): string | undefined;
|
|
11
|
+
export declare function deriveMessageContextScopeKey(context: unknown): string | undefined;
|