MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / DeepWikiPlugin

Class DeepWikiPlugin

deepwiki/deepwiki.ts:628–1002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626};
627
628class DeepWikiPlugin extends Plugin {
629 name = "deepwiki";
630
631 private store = new DeepWikiStore();
632 private mcp = new DeepWikiMcp();
633 private inited = false;
634 private lifecycleDispose: (() => void | Promise<void>) | null = null;
635 private resourcesClosed = false;
636 private httpAgent = new http.Agent({ keepAlive: true });
637 private httpsAgent = new https.Agent({ keepAlive: true });
638
639 private httpClient = axios.create({
640 httpAgent: this.httpAgent,
641 httpsAgent: this.httpsAgent,
642 });
643
644 setup(context: PluginRuntimeContext): void {
645 this.lifecycleDispose = context.lifecycle.trackDisposable(() => this.closeResources(), {
646 label: "plugin:deepwiki:resources",
647 });
648 }
649
650 async cleanup(): Promise<void> {
651 const dispose = this.lifecycleDispose;
652 this.lifecycleDispose = null;
653 if (dispose) {
654 await dispose();
655 return;
656 }
657 await this.closeResources();
658 }
659
660 private async closeResources(): Promise<void> {
661 if (this.resourcesClosed) return;
662 this.resourcesClosed = true;
663 await this.mcp.close();
664 this.httpAgent.destroy();
665 this.httpsAgent.destroy();
666 }
667
668 private async initOnce(): Promise<void> {
669 if (this.resourcesClosed) {
670 this.mcp = new DeepWikiMcp();
671 this.httpAgent = new http.Agent({ keepAlive: true });
672 this.httpsAgent = new https.Agent({ keepAlive: true });
673 this.httpClient = axios.create({
674 httpAgent: this.httpAgent,
675 httpsAgent: this.httpsAgent,
676 });
677 this.resourcesClosed = false;
678 }
679 if (this.inited) return;
680 await this.store.init();
681 this.inited = true;
682 }
683
684 private getMainPrefix(): string {
685 const prefixes = getPrefixes();

Callers

nothing calls this directly

Calls 15

helpTextMethod · 0.95
initOnceMethod · 0.95
getChatKeyMethod · 0.95
getMainPrefixMethod · 0.95
sendAnswerOrTelegraphMethod · 0.95
formatErrorMethod · 0.95
getRepliedMessageTextFunction · 0.85
getRepliedMessageIdFunction · 0.85
normalizeTagFunction · 0.85
parseRepoFromUrlFunction · 0.85
buildQuestionWithContextFunction · 0.85
getChatStateMethod · 0.80

Tested by

no test coverage detected