@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.
- package/CHANGELOG.md +9 -7
- package/dist/{chunk-OSWF5QDO.mjs → chunk-GGNRDS7N.mjs} +2 -2
- package/dist/{chunk-APVJZO3R.mjs → chunk-LSLFIYKP.mjs} +2 -2
- package/dist/{chunk-36AYTJIE.mjs → chunk-R6AUAQK6.mjs} +29 -27
- package/dist/chunk-R6AUAQK6.mjs.map +1 -0
- package/dist/{chunk-M74ZTUCC.mjs → chunk-TA5I5LYF.mjs} +2 -2
- package/dist/{chunk-OKQVDDJ2.mjs → chunk-W7GP2EOT.mjs} +50 -2
- package/dist/chunk-W7GP2EOT.mjs.map +1 -0
- package/dist/{copilot-runtime-12e7ac40.d.ts → copilot-runtime-48d7c2fc.d.ts} +1 -1
- package/dist/{groq-adapter-24abe931.d.ts → groq-adapter-ac43305a.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +83 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -5
- package/dist/index.mjs.map +1 -1
- package/dist/{langserve-f021ab9c.d.ts → langserve-b74e8606.d.ts} +2 -2
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +16 -14
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +5 -5
- package/dist/lib/integrations/index.d.ts +3 -3
- package/dist/lib/integrations/index.js +9 -2
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +5 -5
- package/dist/lib/integrations/nest/index.d.ts +2 -2
- package/dist/lib/integrations/nest/index.js +9 -2
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +3 -3
- package/dist/lib/integrations/node-express/index.d.ts +2 -2
- package/dist/lib/integrations/node-express/index.js +9 -2
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +3 -3
- package/dist/lib/integrations/node-http/index.d.ts +2 -2
- package/dist/lib/integrations/node-http/index.js +9 -2
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +2 -2
- package/dist/service-adapters/index.d.ts +35 -4
- package/dist/service-adapters/index.js +50 -0
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +5 -1
- package/package.json +2 -2
- package/src/lib/logger.ts +4 -0
- package/src/lib/runtime/copilot-runtime.ts +1 -7
- package/src/lib/runtime/remote-action-constructors.ts +61 -57
- package/src/service-adapters/events.ts +2 -2
- package/src/service-adapters/experimental/empty/empty-adapter.ts +33 -0
- package/src/service-adapters/index.ts +7 -1
- package/dist/chunk-36AYTJIE.mjs.map +0 -1
- package/dist/chunk-OKQVDDJ2.mjs.map +0 -1
- /package/dist/{chunk-OSWF5QDO.mjs.map → chunk-GGNRDS7N.mjs.map} +0 -0
- /package/dist/{chunk-APVJZO3R.mjs.map → chunk-LSLFIYKP.mjs.map} +0 -0
- /package/dist/{chunk-M74ZTUCC.mjs.map → chunk-TA5I5LYF.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# @copilotkit/runtime
|
|
2
2
|
|
|
3
|
-
## 1.4.8
|
|
3
|
+
## 1.4.8
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
7
|
+
- - Better error handling
|
|
8
|
+
- Introduce new "EmptyLLMAdapter" for when using CoAgents
|
|
9
|
+
- Improve dev console help options
|
|
10
|
+
- Allow CopilotKit remote endpoint without agents
|
|
11
|
+
- 989f159: - fix: allow CopilotKit Remote Endpoint without agents
|
|
12
|
+
- Apply suggestions from code review
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @copilotkit/shared@1.4.8
|
|
13
15
|
|
|
14
16
|
## 1.4.8-next.0
|
|
15
17
|
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
getCommonConfig,
|
|
3
3
|
getRuntimeInstanceTelemetryInfo,
|
|
4
4
|
telemetry_client_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-R6AUAQK6.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-44O2JGUY.mjs";
|
|
@@ -77,4 +77,4 @@ export {
|
|
|
77
77
|
config,
|
|
78
78
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
//# sourceMappingURL=chunk-GGNRDS7N.mjs.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
copilotRuntimeNodeHttpEndpoint,
|
|
3
3
|
getRuntimeInstanceTelemetryInfo,
|
|
4
4
|
telemetry_client_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-R6AUAQK6.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-44O2JGUY.mjs";
|
|
@@ -22,4 +22,4 @@ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
|
|
|
22
22
|
export {
|
|
23
23
|
copilotRuntimeNodeExpressEndpoint
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-LSLFIYKP.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RemoteChain,
|
|
3
3
|
streamLangChainResponse
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-W7GP2EOT.mjs";
|
|
5
5
|
import {
|
|
6
6
|
GuardrailsValidationFailureResponse,
|
|
7
7
|
MessageStreamInterruptedResponse,
|
|
@@ -37,7 +37,7 @@ var require_package = __commonJS({
|
|
|
37
37
|
publishConfig: {
|
|
38
38
|
access: "public"
|
|
39
39
|
},
|
|
40
|
-
version: "1.4.8
|
|
40
|
+
version: "1.4.8",
|
|
41
41
|
sideEffects: false,
|
|
42
42
|
main: "./dist/index.js",
|
|
43
43
|
module: "./dist/index.mjs",
|
|
@@ -1041,7 +1041,7 @@ CopilotResponse = _ts_decorate11([
|
|
|
1041
1041
|
import { Repeater } from "graphql-yoga";
|
|
1042
1042
|
|
|
1043
1043
|
// src/service-adapters/events.ts
|
|
1044
|
-
import { randomId as
|
|
1044
|
+
import { randomId as randomId2 } from "@copilotkit/shared";
|
|
1045
1045
|
import { of, concat, map, scan as scan2, concatMap, ReplaySubject as ReplaySubject2, firstValueFrom, from as from2 } from "rxjs";
|
|
1046
1046
|
|
|
1047
1047
|
// src/lib/telemetry-client.ts
|
|
@@ -1779,6 +1779,7 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
|
|
|
1779
1779
|
}
|
|
1780
1780
|
__name(constructLGCRemoteAction, "constructLGCRemoteAction");
|
|
1781
1781
|
function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, logger: logger2, messages, agentStates }) {
|
|
1782
|
+
const totalAgents = Array.isArray(json["agents"]) ? json["agents"].length : 0;
|
|
1782
1783
|
const actions = json["actions"].map((action) => ({
|
|
1783
1784
|
name: action.name,
|
|
1784
1785
|
description: action.description,
|
|
@@ -1792,7 +1793,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
1792
1793
|
telemetry_client_default.capture("oss.runtime.remote_action_executed", {
|
|
1793
1794
|
agentExecution: false,
|
|
1794
1795
|
type: "self-hosted",
|
|
1795
|
-
agentsAmount:
|
|
1796
|
+
agentsAmount: totalAgents
|
|
1796
1797
|
});
|
|
1797
1798
|
try {
|
|
1798
1799
|
const response = await fetch(`${url}/actions/execute`, {
|
|
@@ -1827,7 +1828,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
1827
1828
|
}
|
|
1828
1829
|
}
|
|
1829
1830
|
}));
|
|
1830
|
-
const agents = json["agents"].map((agent) => ({
|
|
1831
|
+
const agents = totalAgents ? json["agents"].map((agent) => ({
|
|
1831
1832
|
name: agent.name,
|
|
1832
1833
|
description: agent.description,
|
|
1833
1834
|
parameters: [],
|
|
@@ -1880,7 +1881,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
1880
1881
|
streamResponse(response.body, eventSource.eventStream$);
|
|
1881
1882
|
return eventSource.processLangGraphEvents();
|
|
1882
1883
|
}
|
|
1883
|
-
}));
|
|
1884
|
+
})) : [];
|
|
1884
1885
|
return [
|
|
1885
1886
|
...actions,
|
|
1886
1887
|
...agents
|
|
@@ -2058,7 +2059,7 @@ __name(setupRemoteActions, "setupRemoteActions");
|
|
|
2058
2059
|
import { createHash as createHash3 } from "crypto";
|
|
2059
2060
|
|
|
2060
2061
|
// src/lib/runtime/copilot-runtime.ts
|
|
2061
|
-
import { actionParametersToJsonSchema
|
|
2062
|
+
import { actionParametersToJsonSchema } from "@copilotkit/shared";
|
|
2062
2063
|
|
|
2063
2064
|
// src/service-adapters/conversion.ts
|
|
2064
2065
|
import { plainToInstance } from "class-transformer";
|
|
@@ -2189,13 +2190,7 @@ var CopilotRuntime = class {
|
|
|
2189
2190
|
} catch (error) {
|
|
2190
2191
|
console.error("Error getting response:", error);
|
|
2191
2192
|
eventSource.sendErrorMessageToChat();
|
|
2192
|
-
|
|
2193
|
-
threadId: threadId || randomId2(),
|
|
2194
|
-
runId: runId || randomId2(),
|
|
2195
|
-
eventSource,
|
|
2196
|
-
serverSideActions: [],
|
|
2197
|
-
actionInputsWithoutAgents: []
|
|
2198
|
-
};
|
|
2193
|
+
throw error;
|
|
2199
2194
|
}
|
|
2200
2195
|
}
|
|
2201
2196
|
async processAgentRequest(request) {
|
|
@@ -2470,14 +2465,14 @@ var RuntimeEventSource = class {
|
|
|
2470
2465
|
async stream(callback) {
|
|
2471
2466
|
this.callback = callback;
|
|
2472
2467
|
}
|
|
2473
|
-
sendErrorMessageToChat() {
|
|
2474
|
-
const errorMessage =
|
|
2468
|
+
sendErrorMessageToChat(message = "An error occurred. Please try again.") {
|
|
2469
|
+
const errorMessage = `\u274C ${message}`;
|
|
2475
2470
|
if (!this.callback) {
|
|
2476
2471
|
this.stream(async (eventStream$) => {
|
|
2477
|
-
eventStream$.sendTextMessage(
|
|
2472
|
+
eventStream$.sendTextMessage(randomId2(), errorMessage);
|
|
2478
2473
|
});
|
|
2479
2474
|
} else {
|
|
2480
|
-
this.eventStream$.sendTextMessage(
|
|
2475
|
+
this.eventStream$.sendTextMessage(randomId2(), errorMessage);
|
|
2481
2476
|
}
|
|
2482
2477
|
}
|
|
2483
2478
|
processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents }) {
|
|
@@ -2583,7 +2578,7 @@ __name(executeAction, "executeAction");
|
|
|
2583
2578
|
import { GraphQLJSONObject } from "graphql-scalars";
|
|
2584
2579
|
import { plainToInstance as plainToInstance2 } from "class-transformer";
|
|
2585
2580
|
import { GraphQLError } from "graphql";
|
|
2586
|
-
import { randomId as
|
|
2581
|
+
import { randomId as randomId3 } from "@copilotkit/shared";
|
|
2587
2582
|
function _ts_decorate12(decorators, target, key, desc) {
|
|
2588
2583
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2589
2584
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -2700,7 +2695,7 @@ var CopilotResolver = class {
|
|
|
2700
2695
|
rejectOutputMessagesPromise = reject;
|
|
2701
2696
|
});
|
|
2702
2697
|
logger2.debug("Processing");
|
|
2703
|
-
const { eventSource, threadId =
|
|
2698
|
+
const { eventSource, threadId = randomId3(), runId, serverSideActions, actionInputsWithoutAgents } = await copilotRuntime.processRuntimeRequest({
|
|
2704
2699
|
serviceAdapter,
|
|
2705
2700
|
messages: data.messages,
|
|
2706
2701
|
actions: data.frontend.actions.filter((action) => action.available !== ActionInputAvailability.disabled),
|
|
@@ -2745,7 +2740,7 @@ var CopilotResolver = class {
|
|
|
2745
2740
|
});
|
|
2746
2741
|
outputMessages = [
|
|
2747
2742
|
plainToInstance2(TextMessage, {
|
|
2748
|
-
id:
|
|
2743
|
+
id: randomId3(),
|
|
2749
2744
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2750
2745
|
content: result.reason,
|
|
2751
2746
|
role: MessageRole.assistant
|
|
@@ -2908,7 +2903,7 @@ var CopilotResolver = class {
|
|
|
2908
2903
|
result: event.result
|
|
2909
2904
|
}, "Action execution result event received");
|
|
2910
2905
|
pushMessage({
|
|
2911
|
-
id:
|
|
2906
|
+
id: randomId3(),
|
|
2912
2907
|
status: new SuccessMessageStatus(),
|
|
2913
2908
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2914
2909
|
actionExecutionId: event.actionExecutionId,
|
|
@@ -2916,7 +2911,7 @@ var CopilotResolver = class {
|
|
|
2916
2911
|
result: event.result
|
|
2917
2912
|
});
|
|
2918
2913
|
outputMessages.push(plainToInstance2(ResultMessage, {
|
|
2919
|
-
id:
|
|
2914
|
+
id: randomId3(),
|
|
2920
2915
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2921
2916
|
actionExecutionId: event.actionExecutionId,
|
|
2922
2917
|
actionName: event.actionName,
|
|
@@ -2928,7 +2923,7 @@ var CopilotResolver = class {
|
|
|
2928
2923
|
event
|
|
2929
2924
|
}, "Agent message event received");
|
|
2930
2925
|
pushMessage({
|
|
2931
|
-
id:
|
|
2926
|
+
id: randomId3(),
|
|
2932
2927
|
status: new SuccessMessageStatus(),
|
|
2933
2928
|
threadId: event.threadId,
|
|
2934
2929
|
agentName: event.agentName,
|
|
@@ -2941,7 +2936,7 @@ var CopilotResolver = class {
|
|
|
2941
2936
|
createdAt: /* @__PURE__ */ new Date()
|
|
2942
2937
|
});
|
|
2943
2938
|
outputMessages.push(plainToInstance2(AgentStateMessage, {
|
|
2944
|
-
id:
|
|
2939
|
+
id: randomId3(),
|
|
2945
2940
|
threadId: event.threadId,
|
|
2946
2941
|
agentName: event.agentName,
|
|
2947
2942
|
nodeName: event.nodeName,
|
|
@@ -3022,7 +3017,14 @@ function createLogger(options) {
|
|
|
3022
3017
|
colorize: true
|
|
3023
3018
|
});
|
|
3024
3019
|
const logger2 = createPinoLogger({
|
|
3025
|
-
level: process.env.LOG_LEVEL || level || "error"
|
|
3020
|
+
level: process.env.LOG_LEVEL || level || "error",
|
|
3021
|
+
redact: {
|
|
3022
|
+
paths: [
|
|
3023
|
+
"pid",
|
|
3024
|
+
"hostname"
|
|
3025
|
+
],
|
|
3026
|
+
remove: true
|
|
3027
|
+
}
|
|
3026
3028
|
}, stream);
|
|
3027
3029
|
if (component) {
|
|
3028
3030
|
return logger2.child({
|
|
@@ -3145,4 +3147,4 @@ export {
|
|
|
3145
3147
|
getCommonConfig,
|
|
3146
3148
|
copilotRuntimeNodeHttpEndpoint
|
|
3147
3149
|
};
|
|
3148
|
-
//# sourceMappingURL=chunk-
|
|
3150
|
+
//# sourceMappingURL=chunk-R6AUAQK6.mjs.map
|