MCPcopy
hub / github.com/CopilotKit/CopilotKit / getOrCreate

Method getOrCreate

packages/bot-slack/src/adapter.ts:761–779  ·  view source on GitHub ↗
(
        conversationKey: string,
        replyTarget: BotReplyTarget,
        makeAgent: (threadId: string) => AbstractAgent,
      )

Source from the content-addressed store, hash-verified

759 const store = this.store;
760 return {
761 async getOrCreate(
762 conversationKey: string,
763 replyTarget: BotReplyTarget,
764 makeAgent: (threadId: string) => AbstractAgent,
765 ): Promise<AgentSession> {
766 const idx = conversationKey.indexOf("::");
767 const channelId =
768 idx >= 0 ? conversationKey.slice(0, idx) : conversationKey;
769 const scope = idx >= 0 ? conversationKey.slice(idx + 2) : DM_SCOPE;
770 const key: ConversationKey = { channelId, scope };
771 const session = await store.getOrCreate(
772 key,
773 replyTarget as ReplyTarget,
774 makeAgent as unknown as Parameters<
775 SlackConversationStore["getOrCreate"]
776 >[2],
777 );
778 return { agent: session.agent as unknown as AbstractAgent };
779 },
780 };
781 }
782

Callers

nothing calls this directly

Calls 1

getOrCreateMethod · 0.65

Tested by

no test coverage detected