@copilotkitnext/core 0.0.22-alpha.7 → 0.0.22-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,13 +1,8 @@
1
- // src/core/agent-registry.ts
2
- import { HttpAgent as HttpAgent2 } from "@ag-ui/client";
3
- import { logger } from "@copilotkitnext/shared";
1
+ import { HttpAgent, runHttpRequest, transformHttpEventStream } from '@ag-ui/client';
2
+ import { logger, randomUUID, partialJSONParse } from '@copilotkitnext/shared';
3
+ import { zodToJsonSchema } from 'zod-to-json-schema';
4
4
 
5
- // src/agent.ts
6
- import {
7
- HttpAgent,
8
- runHttpRequest,
9
- transformHttpEventStream
10
- } from "@ag-ui/client";
5
+ // src/core/agent-registry.ts
11
6
  var ProxiedCopilotRuntimeAgent = class extends HttpAgent {
12
7
  runtimeUrl;
13
8
  transport;
@@ -239,7 +234,7 @@ var AgentRegistry = class {
239
234
  * Apply current headers to an agent
240
235
  */
241
236
  applyHeadersToAgent(agent) {
242
- if (agent instanceof HttpAgent2) {
237
+ if (agent instanceof HttpAgent) {
243
238
  agent.headers = { ...this.core.headers };
244
239
  }
245
240
  }
@@ -392,9 +387,6 @@ var AgentRegistry = class {
392
387
  );
393
388
  }
394
389
  };
395
-
396
- // src/core/context-store.ts
397
- import { randomUUID } from "@copilotkitnext/shared";
398
390
  var ContextStore = class {
399
391
  constructor(core) {
400
392
  this.core = core;
@@ -436,9 +428,6 @@ var ContextStore = class {
436
428
  );
437
429
  }
438
430
  };
439
-
440
- // src/core/suggestion-engine.ts
441
- import { randomUUID as randomUUID2, partialJSONParse } from "@copilotkitnext/shared";
442
431
  var SuggestionEngine = class {
443
432
  constructor(core) {
444
433
  this.core = core;
@@ -451,7 +440,7 @@ var SuggestionEngine = class {
451
440
  */
452
441
  initialize(suggestionsConfig) {
453
442
  for (const config of suggestionsConfig) {
454
- this._suggestionsConfig[randomUUID2()] = config;
443
+ this._suggestionsConfig[randomUUID()] = config;
455
444
  }
456
445
  }
457
446
  /**
@@ -459,7 +448,7 @@ var SuggestionEngine = class {
459
448
  * @returns The ID of the created config
460
449
  */
461
450
  addSuggestionsConfig(config) {
462
- const id = randomUUID2();
451
+ const id = randomUUID();
463
452
  this._suggestionsConfig[id] = config;
464
453
  void this.notifySuggestionsConfigChanged();
465
454
  return id;
@@ -490,7 +479,7 @@ var SuggestionEngine = class {
490
479
  if (!this.shouldShowSuggestions(config, messageCount)) {
491
480
  continue;
492
481
  }
493
- const suggestionId = randomUUID2();
482
+ const suggestionId = randomUUID();
494
483
  if (isDynamicSuggestionsConfig(config)) {
495
484
  if (!hasAnySuggestions) {
496
485
  hasAnySuggestions = true;
@@ -780,11 +769,6 @@ var SUGGEST_TOOL = {
780
769
  additionalProperties: false
781
770
  }
782
771
  };
783
-
784
- // src/core/run-handler.ts
785
- import { HttpAgent as HttpAgent3 } from "@ag-ui/client";
786
- import { randomUUID as randomUUID3, logger as logger2 } from "@copilotkitnext/shared";
787
- import { zodToJsonSchema } from "zod-to-json-schema";
788
772
  var RunHandler = class {
789
773
  constructor(core) {
790
774
  this.core = core;
@@ -809,7 +793,7 @@ var RunHandler = class {
809
793
  addTool(tool) {
810
794
  const existingToolIndex = this._tools.findIndex((t) => t.name === tool.name && t.agentId === tool.agentId);
811
795
  if (existingToolIndex !== -1) {
812
- logger2.warn(`Tool already exists: '${tool.name}' for agent '${tool.agentId || "global"}', skipping.`);
796
+ logger.warn(`Tool already exists: '${tool.name}' for agent '${tool.agentId || "global"}', skipping.`);
813
797
  return;
814
798
  }
815
799
  this._tools.push(tool);
@@ -851,7 +835,7 @@ var RunHandler = class {
851
835
  */
852
836
  async connectAgent({ agent }) {
853
837
  try {
854
- if (agent instanceof HttpAgent3) {
838
+ if (agent instanceof HttpAgent) {
855
839
  agent.headers = { ...this.core.headers };
856
840
  }
857
841
  const runAgentResult = await agent.connectAgent(
@@ -883,7 +867,7 @@ var RunHandler = class {
883
867
  if (agent.agentId) {
884
868
  void this.core.suggestionEngine.clearSuggestions(agent.agentId);
885
869
  }
886
- if (agent instanceof HttpAgent3) {
870
+ if (agent instanceof HttpAgent) {
887
871
  agent.headers = { ...this.core.headers };
888
872
  }
889
873
  if (withMessages) {
@@ -1047,7 +1031,7 @@ var RunHandler = class {
1047
1031
  if (!errorMessage || !isArgumentError) {
1048
1032
  const messageIndex = agent.messages.findIndex((m) => m.id === message.id);
1049
1033
  const toolMessage = {
1050
- id: randomUUID3(),
1034
+ id: randomUUID(),
1051
1035
  role: "tool",
1052
1036
  toolCallId: toolCall.id,
1053
1037
  content: toolCallResult
@@ -1152,7 +1136,7 @@ var RunHandler = class {
1152
1136
  if (!errorMessage || !isArgumentError) {
1153
1137
  const messageIndex = agent.messages.findIndex((m) => m.id === message.id);
1154
1138
  const toolMessage = {
1155
- id: randomUUID3(),
1139
+ id: randomUUID(),
1156
1140
  role: "tool",
1157
1141
  toolCallId: toolCall.id,
1158
1142
  content: toolCallResult
@@ -1895,17 +1879,7 @@ ${indent}${fence}`;
1895
1879
  }
1896
1880
  return result;
1897
1881
  }
1898
- export {
1899
- AgentRegistry,
1900
- ContextStore,
1901
- CopilotKitCore,
1902
- CopilotKitCoreErrorCode,
1903
- CopilotKitCoreRuntimeConnectionStatus,
1904
- ProxiedCopilotRuntimeAgent,
1905
- RunHandler,
1906
- StateManager,
1907
- SuggestionEngine,
1908
- ToolCallStatus,
1909
- completePartialMarkdown
1910
- };
1882
+
1883
+ export { AgentRegistry, ContextStore, CopilotKitCore, CopilotKitCoreErrorCode, CopilotKitCoreRuntimeConnectionStatus, ProxiedCopilotRuntimeAgent, RunHandler, StateManager, SuggestionEngine, ToolCallStatus, completePartialMarkdown };
1884
+ //# sourceMappingURL=index.mjs.map
1911
1885
  //# sourceMappingURL=index.mjs.map