@copilotkit/runtime 1.4.8-no-pino-redact.1 → 1.4.8

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +9 -7
  2. package/dist/{chunk-OSWF5QDO.mjs → chunk-GGNRDS7N.mjs} +2 -2
  3. package/dist/{chunk-APVJZO3R.mjs → chunk-LSLFIYKP.mjs} +2 -2
  4. package/dist/{chunk-36AYTJIE.mjs → chunk-R6AUAQK6.mjs} +29 -27
  5. package/dist/chunk-R6AUAQK6.mjs.map +1 -0
  6. package/dist/{chunk-M74ZTUCC.mjs → chunk-TA5I5LYF.mjs} +2 -2
  7. package/dist/{chunk-OKQVDDJ2.mjs → chunk-W7GP2EOT.mjs} +50 -2
  8. package/dist/chunk-W7GP2EOT.mjs.map +1 -0
  9. package/dist/{copilot-runtime-12e7ac40.d.ts → copilot-runtime-48d7c2fc.d.ts} +1 -1
  10. package/dist/{groq-adapter-24abe931.d.ts → groq-adapter-ac43305a.d.ts} +1 -1
  11. package/dist/index.d.ts +4 -4
  12. package/dist/index.js +83 -31
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +9 -5
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/{langserve-f021ab9c.d.ts → langserve-b74e8606.d.ts} +2 -2
  17. package/dist/lib/index.d.ts +3 -3
  18. package/dist/lib/index.js +16 -14
  19. package/dist/lib/index.js.map +1 -1
  20. package/dist/lib/index.mjs +5 -5
  21. package/dist/lib/integrations/index.d.ts +3 -3
  22. package/dist/lib/integrations/index.js +9 -2
  23. package/dist/lib/integrations/index.js.map +1 -1
  24. package/dist/lib/integrations/index.mjs +5 -5
  25. package/dist/lib/integrations/nest/index.d.ts +2 -2
  26. package/dist/lib/integrations/nest/index.js +9 -2
  27. package/dist/lib/integrations/nest/index.js.map +1 -1
  28. package/dist/lib/integrations/nest/index.mjs +3 -3
  29. package/dist/lib/integrations/node-express/index.d.ts +2 -2
  30. package/dist/lib/integrations/node-express/index.js +9 -2
  31. package/dist/lib/integrations/node-express/index.js.map +1 -1
  32. package/dist/lib/integrations/node-express/index.mjs +3 -3
  33. package/dist/lib/integrations/node-http/index.d.ts +2 -2
  34. package/dist/lib/integrations/node-http/index.js +9 -2
  35. package/dist/lib/integrations/node-http/index.js.map +1 -1
  36. package/dist/lib/integrations/node-http/index.mjs +2 -2
  37. package/dist/service-adapters/index.d.ts +35 -4
  38. package/dist/service-adapters/index.js +50 -0
  39. package/dist/service-adapters/index.js.map +1 -1
  40. package/dist/service-adapters/index.mjs +5 -1
  41. package/package.json +2 -2
  42. package/src/lib/logger.ts +4 -0
  43. package/src/lib/runtime/copilot-runtime.ts +1 -7
  44. package/src/lib/runtime/remote-action-constructors.ts +61 -57
  45. package/src/service-adapters/events.ts +2 -2
  46. package/src/service-adapters/experimental/empty/empty-adapter.ts +33 -0
  47. package/src/service-adapters/index.ts +7 -1
  48. package/dist/chunk-36AYTJIE.mjs.map +0 -1
  49. package/dist/chunk-OKQVDDJ2.mjs.map +0 -1
  50. /package/dist/{chunk-OSWF5QDO.mjs.map → chunk-GGNRDS7N.mjs.map} +0 -0
  51. /package/dist/{chunk-APVJZO3R.mjs.map → chunk-LSLFIYKP.mjs.map} +0 -0
  52. /package/dist/{chunk-M74ZTUCC.mjs.map → chunk-TA5I5LYF.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  config,
4
4
  copilotRuntimeNextJSAppRouterEndpoint,
5
5
  copilotRuntimeNextJSPagesRouterEndpoint
6
- } from "./chunk-OSWF5QDO.mjs";
6
+ } from "./chunk-GGNRDS7N.mjs";
7
7
  import {
8
8
  copilotRuntimeNestEndpoint
9
- } from "./chunk-M74ZTUCC.mjs";
9
+ } from "./chunk-TA5I5LYF.mjs";
10
10
  import {
11
11
  copilotRuntimeNodeExpressEndpoint
12
- } from "./chunk-APVJZO3R.mjs";
12
+ } from "./chunk-LSLFIYKP.mjs";
13
13
  import {
14
14
  CopilotRuntime,
15
15
  buildSchema,
@@ -20,9 +20,11 @@ import {
20
20
  getCommonConfig,
21
21
  langGraphPlatformEndpoint,
22
22
  resolveEndpointType
23
- } from "./chunk-36AYTJIE.mjs";
23
+ } from "./chunk-R6AUAQK6.mjs";
24
24
  import {
25
25
  AnthropicAdapter,
26
+ ExperimentalEmptyAdapter,
27
+ ExperimentalOllamaAdapter,
26
28
  GoogleGenerativeAIAdapter,
27
29
  GroqAdapter,
28
30
  LangChainAdapter,
@@ -30,7 +32,7 @@ import {
30
32
  OpenAIAssistantAdapter,
31
33
  RemoteChain,
32
34
  UnifyAdapter
33
- } from "./chunk-OKQVDDJ2.mjs";
35
+ } from "./chunk-W7GP2EOT.mjs";
34
36
  import {
35
37
  GuardrailsValidationFailureResponse,
36
38
  MessageStreamInterruptedResponse,
@@ -45,6 +47,8 @@ import "reflect-metadata";
45
47
  export {
46
48
  AnthropicAdapter,
47
49
  CopilotRuntime,
50
+ ExperimentalEmptyAdapter,
51
+ ExperimentalOllamaAdapter,
48
52
  GoogleGenerativeAIAdapter,
49
53
  GroqAdapter,
50
54
  GuardrailsValidationFailureResponse,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import \"reflect-metadata\";\nexport * from \"./lib\";\nexport * from \"./utils\";\nexport * from \"./service-adapters\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import \"reflect-metadata\";\nexport * from \"./lib\";\nexport * from \"./utils\";\nexport * from \"./service-adapters\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO;","names":[]}
@@ -82,7 +82,7 @@ declare class RuntimeEventSource {
82
82
  private eventStream$;
83
83
  private callback;
84
84
  stream(callback: EventSourceCallback): Promise<void>;
85
- sendErrorMessageToChat(): void;
85
+ sendErrorMessageToChat(message?: string): void;
86
86
  processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents, }: {
87
87
  serverSideActions: Action<any>[];
88
88
  guardrailsResult$?: Subject<GuardrailsResult>;
@@ -133,4 +133,4 @@ declare class RemoteChain {
133
133
  inferLangServeParameters(): Promise<void>;
134
134
  }
135
135
 
136
- export { ActionInput as A, CopilotServiceAdapter as C, ForwardedParametersInput as F, RemoteChainParameters as R, RemoteChain as a, RuntimeEventSource as b, CopilotRuntimeChatCompletionRequest as c, CopilotRuntimeChatCompletionResponse as d };
136
+ export { ActionInput as A, CopilotRuntimeChatCompletionRequest as C, ForwardedParametersInput as F, RemoteChainParameters as R, CopilotRuntimeChatCompletionResponse as a, CopilotServiceAdapter as b, RemoteChain as c, RuntimeEventSource as d };
@@ -1,11 +1,11 @@
1
- export { h as CommonConfig, b as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, d as CreateCopilotRuntimeServerOptions, G as GraphQLContext, g as buildSchema, c as copilotKitEndpoint, e as createContext, f as flattenToolCallsNoDuplicates, i as getCommonConfig, l as langGraphPlatformEndpoint, r as resolveEndpointType } from '../copilot-runtime-12e7ac40.js';
2
- export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from '../groq-adapter-24abe931.js';
1
+ export { h as CommonConfig, b as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, d as CreateCopilotRuntimeServerOptions, G as GraphQLContext, g as buildSchema, c as copilotKitEndpoint, e as createContext, f as flattenToolCallsNoDuplicates, i as getCommonConfig, l as langGraphPlatformEndpoint, r as resolveEndpointType } from '../copilot-runtime-48d7c2fc.js';
2
+ export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from '../groq-adapter-ac43305a.js';
3
3
  export { CopilotRuntimeServerInstance, config, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint } from './integrations/index.js';
4
4
  export { copilotRuntimeNodeHttpEndpoint } from './integrations/node-http/index.js';
5
5
  export { copilotRuntimeNodeExpressEndpoint } from './integrations/node-express/index.js';
6
6
  export { copilotRuntimeNestEndpoint } from './integrations/nest/index.js';
7
7
  import '@copilotkit/shared';
8
- import '../langserve-f021ab9c.js';
8
+ import '../langserve-b74e8606.js';
9
9
  import '../index-10b1c870.js';
10
10
  import '../graphql/types/base/index.js';
11
11
  import 'rxjs';
package/dist/lib/index.js CHANGED
@@ -44,7 +44,7 @@ var require_package = __commonJS({
44
44
  publishConfig: {
45
45
  access: "public"
46
46
  },
47
- version: "1.4.8-no-pino-redact.1",
47
+ version: "1.4.8",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -1830,6 +1830,7 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
1830
1830
  }
1831
1831
  __name(constructLGCRemoteAction, "constructLGCRemoteAction");
1832
1832
  function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, logger: logger2, messages, agentStates }) {
1833
+ const totalAgents = Array.isArray(json["agents"]) ? json["agents"].length : 0;
1833
1834
  const actions = json["actions"].map((action) => ({
1834
1835
  name: action.name,
1835
1836
  description: action.description,
@@ -1843,7 +1844,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
1843
1844
  telemetry_client_default.capture("oss.runtime.remote_action_executed", {
1844
1845
  agentExecution: false,
1845
1846
  type: "self-hosted",
1846
- agentsAmount: json["agents"].length
1847
+ agentsAmount: totalAgents
1847
1848
  });
1848
1849
  try {
1849
1850
  const response = await fetch(`${url}/actions/execute`, {
@@ -1878,7 +1879,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
1878
1879
  }
1879
1880
  }
1880
1881
  }));
1881
- const agents = json["agents"].map((agent) => ({
1882
+ const agents = totalAgents ? json["agents"].map((agent) => ({
1882
1883
  name: agent.name,
1883
1884
  description: agent.description,
1884
1885
  parameters: [],
@@ -1931,7 +1932,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
1931
1932
  streamResponse(response.body, eventSource.eventStream$);
1932
1933
  return eventSource.processLangGraphEvents();
1933
1934
  }
1934
- }));
1935
+ })) : [];
1935
1936
  return [
1936
1937
  ...actions,
1937
1938
  ...agents
@@ -2242,8 +2243,8 @@ var RuntimeEventSource = class {
2242
2243
  async stream(callback) {
2243
2244
  this.callback = callback;
2244
2245
  }
2245
- sendErrorMessageToChat() {
2246
- const errorMessage = "\u274C An error occurred. Please try again.";
2246
+ sendErrorMessageToChat(message = "An error occurred. Please try again.") {
2247
+ const errorMessage = `\u274C ${message}`;
2247
2248
  if (!this.callback) {
2248
2249
  this.stream(async (eventStream$) => {
2249
2250
  eventStream$.sendTextMessage((0, import_shared8.randomId)(), errorMessage);
@@ -2565,13 +2566,7 @@ var CopilotRuntime = class {
2565
2566
  } catch (error) {
2566
2567
  console.error("Error getting response:", error);
2567
2568
  eventSource.sendErrorMessageToChat();
2568
- return {
2569
- threadId: threadId || (0, import_shared9.randomId)(),
2570
- runId: runId || (0, import_shared9.randomId)(),
2571
- eventSource,
2572
- serverSideActions: [],
2573
- actionInputsWithoutAgents: []
2574
- };
2569
+ throw error;
2575
2570
  }
2576
2571
  }
2577
2572
  async processAgentRequest(request) {
@@ -4168,7 +4163,14 @@ function createLogger(options) {
4168
4163
  colorize: true
4169
4164
  });
4170
4165
  const logger2 = (0, import_pino.default)({
4171
- level: process.env.LOG_LEVEL || level || "error"
4166
+ level: process.env.LOG_LEVEL || level || "error",
4167
+ redact: {
4168
+ paths: [
4169
+ "pid",
4170
+ "hostname"
4171
+ ],
4172
+ remove: true
4173
+ }
4172
4174
  }, stream);
4173
4175
  if (component) {
4174
4176
  return logger2.child({