MCPcopy
hub / github.com/CopilotKit/CopilotKit / constructor

Method constructor

packages/angular/src/lib/copilotkit.ts:174–251  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172 #a2UIContextIds: string[] = [];
173
174 constructor() {
175 ensureLicenseWatermark(this.#config.headers);
176
177 this.#runtimeConnectionStatus.set(this.core.runtimeConnectionStatus);
178 this.#runtimeUrl.set(this.core.runtimeUrl);
179 this.#runtimeTransport.set(this.core.runtimeTransport);
180 this.#headers.set(this.core.headers);
181 this.#threadEndpoints.set(this.core.threadEndpoints);
182 this.#intelligence.set(this.core.intelligence);
183 this.#licenseStatus.set(this.core.licenseStatus);
184 this.#config.renderToolCalls?.forEach((renderConfig) => {
185 this.addRenderToolCall(renderConfig);
186 });
187 this.#config.renderActivityMessages?.forEach((renderConfig) => {
188 this.addRenderActivityMessage(renderConfig);
189 });
190
191 this.#config.tools?.forEach((tool) => {
192 if (tool.renderer && tool.parameters) {
193 this.addRenderToolCall({
194 name: tool.name,
195 args: tool.parameters,
196 component: tool.renderer,
197 agentId: tool.agentId,
198 });
199 }
200 });
201
202 this.#config.frontendTools?.forEach((clientTool) => {
203 this.addFrontendTool({ ...clientTool, injector: this.#rootInjector });
204 });
205
206 this.#config.humanInTheLoop?.forEach((humanInTheLoopTool) => {
207 this.addHumanInTheLoop(humanInTheLoopTool);
208 });
209
210 this.core.subscribe({
211 onAgentsChanged: () => {
212 this.#agents.set(this.core.agents);
213 },
214 onRuntimeConnectionStatusChanged: ({ status }) => {
215 // Core assigns `threadEndpoints`/`intelligence` synchronously before it
216 // notifies this callback (see agent-registry `ensureRuntimeMode`), so
217 // mirroring them here keeps the signals in lockstep with the status
218 // signal and lets reactive consumers observe `intelligence.wsUrl` once
219 // `/info` resolves.
220 this.#runtimeConnectionStatus.set(status);
221 this.#threadEndpoints.set(this.core.threadEndpoints);
222 this.#intelligence.set(this.core.intelligence);
223 this.#licenseStatus.set(this.core.licenseStatus);
224 this.#syncBuiltInActivityMessageRenderers();
225 this.#syncBuiltInOpenGenerativeUI();
226 },
227 onHeadersChanged: ({ headers }) => {
228 this.#headers.set(headers);
229 },
230 onSuggestionsChanged: ({ agentId, suggestions }) => {
231 this.#setSuggestions(agentId, {

Callers

nothing calls this directly

Calls 12

addRenderToolCallMethod · 0.95
addFrontendToolMethod · 0.95
addHumanInTheLoopMethod · 0.95
#setSuggestionsMethod · 0.95
ensureLicenseWatermarkFunction · 0.90
forEachMethod · 0.80
subscribeMethod · 0.65
setMethod · 0.45
getSuggestionsMethod · 0.45

Tested by

no test coverage detected