TypeScript plugin that bridges OpenClaw to ZhiYi MemoryWeave: - ZhiYiClient: REST API wrapper (commit/recall/searchNotes/navigate) - Plugin hooks: memory:recall, memory:commit, memory:graphNavigate, memory:searchNotes - CLI: LanceDB migration tool (placeholder — needs OpenClaw LanceDB reader) - package.json with axios + TypeScript deps - README with install instructions Namespace: openclaw-main (isolated from hermes-main) TODO: implement LanceDB reader for migration
19 lines
417 B
JavaScript
19 lines
417 B
JavaScript
import utils from '../utils.js';
|
|
|
|
const callbackify = (fn, reducer) => {
|
|
return utils.isAsyncFn(fn)
|
|
? function (...args) {
|
|
const cb = args.pop();
|
|
fn.apply(this, args).then((value) => {
|
|
try {
|
|
reducer ? cb(null, ...reducer(value)) : cb(null, value);
|
|
} catch (err) {
|
|
cb(err);
|
|
}
|
|
}, cb);
|
|
}
|
|
: fn;
|
|
};
|
|
|
|
export default callbackify;
|