Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: https://github.com/siyuan-note/siyuan/pull/17487

Daniel10c0fc0b169a
diff --git a/app/src/plugin/kernel.ts b/app/src/plugin/kernel.ts
index c6c2cc2cfd..87e2968e71 100644
--- a/app/src/plugin/kernel.ts
+++ b/app/src/plugin/kernel.ts
@@ -79,41 +79,39 @@ export class Kernel implements IKernelPlugin {
}
#createRpc(): IKernelPluginRpc {
- const self = this;
-
const call = new Proxy({} as Record<TJsonRpcMethod, (...args: TJsonRpcMethodParams) => Promise<any>>, {
- get(_target, method: string) {
- return (...args: TJsonRpcMethodParams) => self.#rpcCall(method, ...args);
+ get: (_target, method: string) => {
+ return (...args: TJsonRpcMethodParams) => this.#rpcCall(method, ...args);
}
});
const notify = new Proxy({} as Record<TJsonRpcMethod, (...args: TJsonRpcMethodParams) => void>, {
- get(_target, method: string) {
- return (...args: TJsonRpcMethodParams) => self.#rpcNotify(method, ...args);
+ get: (_target, method: string) => {
+ return (...args: TJsonRpcMethodParams) => this.#rpcNotify(method, ...args);
}
});
return {
call,
notify,
- batch: self.#rpcBatchCall.bind(self),
+ batch: this.#rpcBatchCall.bind(this),
bind: (method: TJsonRpcMethod, handler: TJsonRpcHandler<void>) => {
const handlers = (() => {
- let handlers = self.#handlers.get(method);
+ let handlers = this.#handlers.get(method);
if (!handlers) {
handlers = new Set();
- self.#handlers.set(method, handlers);
+ this.#handlers.set(method, handlers);
}
return handlers;
})();
handlers.add(handler);
},
unbind: (method: TJsonRpcMethod, handler: TJsonRpcHandler<void>) => {
- const handlers = self.#handlers.get(method);
+ const handlers = this.#handlers.get(method);
if (handlers) {
handlers.delete(handler);
if (handlers.size === 0) {
- self.#handlers.delete(method);
+ this.#handlers.delete(method);
}
}
},