perf: run knowledge, story graph and conversation search reads in a read-only worker

This commit is contained in:
mesalogo
2026-10-03 02:53:51 +08:00
parent 53b9ecbcae
commit f571301764
13 changed files with 799 additions and 65 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ export type StoryGraphRemoteBinding = {
}
export type StoryGraphService = {
available(binding: StoryGraphBinding): Promise<boolean>
read(name: StoryGraphToolName, input: unknown, projectId?: string, signal?: AbortSignal): Record<string, unknown>
read(name: StoryGraphToolName, input: unknown, projectId?: string, signal?: AbortSignal): Record<string, unknown> | Promise<Record<string, unknown>>
}
import { knowledgeReferenceKey, toKnowledgeReference } from '../../shared/knowledge-reference'
import {
@@ -1611,7 +1611,7 @@ export class KnowledgeMcpGateway {
effectiveSignal.throwIfAborted()
if (!await this.isStoryGraphAvailable(token)) throw new Error('story_graph_unavailable: Supervisor or runtime capability is disabled')
effectiveSignal.throwIfAborted()
const result = this.storyGraphService!.read(name, input, capability.storyGraph!.projectId, effectiveSignal)
const result = await this.storyGraphService!.read(name, input, capability.storyGraph!.projectId, effectiveSignal)
effectiveSignal.throwIfAborted()
if (!await this.isStoryGraphAvailable(token)) throw new Error('story_graph_unavailable: Supervisor or runtime capability is disabled')
effectiveSignal.throwIfAborted()