@copilotkit/runtime 1.50.0-beta.8 → 1.50.0
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 +168 -0
- package/dist/chunk-27JKTS6P.mjs +1704 -0
- package/dist/chunk-27JKTS6P.mjs.map +1 -0
- package/dist/chunk-2GPTVDTO.mjs +25 -0
- package/dist/chunk-2GPTVDTO.mjs.map +1 -0
- package/dist/chunk-2OZAGFV3.mjs +43 -0
- package/dist/chunk-2OZAGFV3.mjs.map +1 -0
- package/dist/chunk-3AJVKDZX.mjs +3097 -0
- package/dist/chunk-3AJVKDZX.mjs.map +1 -0
- package/dist/chunk-45RCC3ZS.mjs +25 -0
- package/dist/chunk-45RCC3ZS.mjs.map +1 -0
- package/dist/chunk-4EHJ4XFJ.mjs +25 -0
- package/dist/chunk-4EHJ4XFJ.mjs.map +1 -0
- package/dist/chunk-4IANB4TC.mjs +25 -0
- package/dist/chunk-4IANB4TC.mjs.map +1 -0
- package/dist/chunk-4KES76K3.mjs +74 -0
- package/dist/chunk-4KES76K3.mjs.map +1 -0
- package/dist/chunk-4OGE3SLW.mjs +3100 -0
- package/dist/chunk-4OGE3SLW.mjs.map +1 -0
- package/dist/chunk-54YJBMCP.mjs +3097 -0
- package/dist/chunk-54YJBMCP.mjs.map +1 -0
- package/dist/chunk-62NE5S6M.mjs +226 -0
- package/dist/chunk-62NE5S6M.mjs.map +1 -0
- package/dist/chunk-6ER4SZYH.mjs +74 -0
- package/dist/chunk-6ER4SZYH.mjs.map +1 -0
- package/dist/chunk-6TNSLHVR.mjs +74 -0
- package/dist/chunk-6TNSLHVR.mjs.map +1 -0
- package/dist/chunk-6XRUR5UK.mjs +1 -0
- package/dist/chunk-6XRUR5UK.mjs.map +1 -0
- package/dist/chunk-7V4BK7TZ.mjs +25 -0
- package/dist/chunk-7V4BK7TZ.mjs.map +1 -0
- package/dist/chunk-7YZIEXD2.mjs +74 -0
- package/dist/chunk-7YZIEXD2.mjs.map +1 -0
- package/dist/chunk-A4XHOAFU.mjs +25 -0
- package/dist/chunk-A4XHOAFU.mjs.map +1 -0
- package/dist/chunk-A555KEAD.mjs +6020 -0
- package/dist/chunk-A555KEAD.mjs.map +1 -0
- package/dist/chunk-AF73TFTX.mjs +74 -0
- package/dist/chunk-AF73TFTX.mjs.map +1 -0
- package/dist/chunk-AMUJQ6IR.mjs +50 -0
- package/dist/chunk-AMUJQ6IR.mjs.map +1 -0
- package/dist/chunk-AQG2SVCA.mjs +25 -0
- package/dist/chunk-AQG2SVCA.mjs.map +1 -0
- package/dist/chunk-BJZHMXND.mjs +74 -0
- package/dist/chunk-BJZHMXND.mjs.map +1 -0
- package/dist/chunk-CB2OJXF6.mjs +25 -0
- package/dist/chunk-CB2OJXF6.mjs.map +1 -0
- package/dist/chunk-CEOMFPJU.mjs +6020 -0
- package/dist/chunk-CEOMFPJU.mjs.map +1 -0
- package/dist/chunk-CZVLR7CC.mjs +175 -0
- package/dist/chunk-CZVLR7CC.mjs.map +1 -0
- package/dist/chunk-DCEEHMLJ.mjs +1127 -0
- package/dist/chunk-DCEEHMLJ.mjs.map +1 -0
- package/dist/chunk-DE3CLKUG.mjs +25 -0
- package/dist/chunk-DE3CLKUG.mjs.map +1 -0
- package/dist/chunk-DTPRUTNV.mjs +25 -0
- package/dist/chunk-DTPRUTNV.mjs.map +1 -0
- package/dist/chunk-ERUOA47O.mjs +626 -0
- package/dist/chunk-ERUOA47O.mjs.map +1 -0
- package/dist/chunk-ESSRC64W.mjs +74 -0
- package/dist/chunk-ESSRC64W.mjs.map +1 -0
- package/dist/chunk-FHD4JECV.mjs +33 -0
- package/dist/chunk-FHD4JECV.mjs.map +1 -0
- package/dist/chunk-GRAN6K6N.mjs +25 -0
- package/dist/chunk-GRAN6K6N.mjs.map +1 -0
- package/dist/chunk-I27F2UPA.mjs +175 -0
- package/dist/chunk-I27F2UPA.mjs.map +1 -0
- package/dist/chunk-IAZKTOQW.mjs +25 -0
- package/dist/chunk-IAZKTOQW.mjs.map +1 -0
- package/dist/chunk-J6XZ5MFB.mjs +25 -0
- package/dist/chunk-J6XZ5MFB.mjs.map +1 -0
- package/dist/chunk-JJ32MA4C.mjs +73 -0
- package/dist/chunk-JJ32MA4C.mjs.map +1 -0
- package/dist/chunk-JJY4ZTHQ.mjs +25 -0
- package/dist/chunk-JJY4ZTHQ.mjs.map +1 -0
- package/dist/chunk-KEYLBFU2.mjs +3117 -0
- package/dist/chunk-KEYLBFU2.mjs.map +1 -0
- package/dist/chunk-KQ53L4WZ.mjs +3094 -0
- package/dist/chunk-KQ53L4WZ.mjs.map +1 -0
- package/dist/chunk-KTELVQ67.mjs +3098 -0
- package/dist/chunk-KTELVQ67.mjs.map +1 -0
- package/dist/chunk-LPEPX6NH.mjs +25 -0
- package/dist/chunk-LPEPX6NH.mjs.map +1 -0
- package/dist/chunk-MDXE55DK.mjs +3117 -0
- package/dist/chunk-MDXE55DK.mjs.map +1 -0
- package/dist/chunk-MMFUVOXH.mjs +73 -0
- package/dist/chunk-MMFUVOXH.mjs.map +1 -0
- package/dist/chunk-N3Y4U66N.mjs +253 -0
- package/dist/chunk-N3Y4U66N.mjs.map +1 -0
- package/dist/chunk-O7UYB4MH.mjs +25 -0
- package/dist/chunk-O7UYB4MH.mjs.map +1 -0
- package/dist/chunk-OFNVQHNM.mjs +3089 -0
- package/dist/chunk-OFNVQHNM.mjs.map +1 -0
- package/dist/chunk-OFSV5GET.mjs +3074 -0
- package/dist/chunk-OFSV5GET.mjs.map +1 -0
- package/dist/chunk-OMRST67R.mjs +25 -0
- package/dist/chunk-OMRST67R.mjs.map +1 -0
- package/dist/chunk-OWIGJONH.mjs +275 -0
- package/dist/chunk-OWIGJONH.mjs.map +1 -0
- package/dist/chunk-PRZHE74A.mjs +25 -0
- package/dist/chunk-PRZHE74A.mjs.map +1 -0
- package/dist/chunk-PTYRVXXP.mjs +80 -0
- package/dist/chunk-PTYRVXXP.mjs.map +1 -0
- package/dist/chunk-R22B5CCO.mjs +25 -0
- package/dist/chunk-R22B5CCO.mjs.map +1 -0
- package/dist/chunk-SHBDMA63.mjs +141 -0
- package/dist/chunk-SHBDMA63.mjs.map +1 -0
- package/dist/chunk-SPVXBPRA.mjs +74 -0
- package/dist/chunk-SPVXBPRA.mjs.map +1 -0
- package/dist/chunk-T72G46ME.mjs +25 -0
- package/dist/chunk-T72G46ME.mjs.map +1 -0
- package/dist/chunk-TGELROPU.mjs +25 -0
- package/dist/chunk-TGELROPU.mjs.map +1 -0
- package/dist/chunk-UNX4IAAD.mjs +25 -0
- package/dist/chunk-UNX4IAAD.mjs.map +1 -0
- package/dist/chunk-V4DHVC7M.mjs +3085 -0
- package/dist/chunk-V4DHVC7M.mjs.map +1 -0
- package/dist/chunk-VVRFOB66.mjs +25 -0
- package/dist/chunk-VVRFOB66.mjs.map +1 -0
- package/dist/chunk-W6NVBYM6.mjs +80 -0
- package/dist/chunk-W6NVBYM6.mjs.map +1 -0
- package/dist/chunk-W7MBACGC.mjs +74 -0
- package/dist/chunk-W7MBACGC.mjs.map +1 -0
- package/dist/chunk-WMD4XZZS.mjs +25 -0
- package/dist/chunk-WMD4XZZS.mjs.map +1 -0
- package/dist/chunk-WX2ZNCRT.mjs +74 -0
- package/dist/chunk-WX2ZNCRT.mjs.map +1 -0
- package/dist/chunk-XWBDEXDA.mjs +153 -0
- package/dist/chunk-XWBDEXDA.mjs.map +1 -0
- package/dist/chunk-Y2Z62E2T.mjs +74 -0
- package/dist/chunk-Y2Z62E2T.mjs.map +1 -0
- package/dist/chunk-YO4I6RVI.mjs +25 -0
- package/dist/chunk-YO4I6RVI.mjs.map +1 -0
- package/dist/chunk-Z6Q5IW6I.mjs +3098 -0
- package/dist/chunk-Z6Q5IW6I.mjs.map +1 -0
- package/dist/chunk-Z726O3G2.mjs +25 -0
- package/dist/chunk-Z726O3G2.mjs.map +1 -0
- package/dist/chunk-ZE4SMZZR.mjs +3097 -0
- package/dist/chunk-ZE4SMZZR.mjs.map +1 -0
- package/dist/chunk-ZULZB33C.mjs +73 -0
- package/dist/chunk-ZULZB33C.mjs.map +1 -0
- package/dist/chunk-ZVRGXMY7.mjs +25 -0
- package/dist/chunk-ZVRGXMY7.mjs.map +1 -0
- package/dist/chunk-ZZ35WBYQ.mjs +25 -0
- package/dist/chunk-ZZ35WBYQ.mjs.map +1 -0
- package/dist/graphql/message-conversion/index.d.ts +18 -0
- package/dist/graphql/message-conversion/index.js +725 -0
- package/dist/graphql/message-conversion/index.js.map +1 -0
- package/dist/graphql/message-conversion/index.mjs +245 -0
- package/dist/graphql/message-conversion/index.mjs.map +1 -0
- package/dist/graphql/types/base/index.d.ts +6 -0
- package/dist/graphql/types/base/index.js +63 -0
- package/dist/graphql/types/base/index.js.map +1 -0
- package/dist/graphql/types/base/index.mjs +8 -0
- package/dist/graphql/types/base/index.mjs.map +1 -0
- package/dist/graphql/types/converted/index.d.ts +2 -0
- package/dist/graphql/types/converted/index.js +200 -0
- package/dist/graphql/types/converted/index.js.map +1 -0
- package/dist/graphql/types/converted/index.mjs +19 -0
- package/dist/graphql/types/converted/index.mjs.map +1 -0
- package/dist/groq-adapter-540da9c3.d.ts +331 -0
- package/dist/groq-adapter-a6f5e9d2.d.ts +331 -0
- package/dist/groq-adapter-c8aec5c5.d.ts +321 -0
- package/dist/index-96b330da.d.ts +119 -0
- package/dist/index-adbd78f1.d.ts +154 -0
- package/dist/index.d.ts +67 -8
- package/dist/index.js +118 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +120 -31
- package/dist/index.mjs.map +1 -1
- package/dist/langserve-0c6100e3.d.ts +257 -0
- package/dist/langserve-978d5790.d.ts +243 -0
- package/dist/langserve-9fc76ce5.d.ts +243 -0
- package/dist/lib/cloud/index.d.ts +6 -0
- package/dist/lib/cloud/index.js +18 -0
- package/dist/lib/cloud/index.js.map +1 -0
- package/dist/lib/cloud/index.mjs +1 -0
- package/dist/lib/cloud/index.mjs.map +1 -0
- package/dist/lib/index.d.ts +212 -0
- package/dist/lib/index.js +7843 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/index.mjs +76 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/integrations/index.d.ts +34 -0
- package/dist/lib/integrations/index.js +3052 -0
- package/dist/lib/integrations/index.js.map +1 -0
- package/dist/lib/integrations/index.mjs +37 -0
- package/dist/lib/integrations/index.mjs.map +1 -0
- package/dist/lib/integrations/nest/index.d.ts +15 -0
- package/dist/lib/integrations/nest/index.js +2959 -0
- package/dist/lib/integrations/nest/index.js.map +1 -0
- package/dist/lib/integrations/nest/index.mjs +14 -0
- package/dist/lib/integrations/nest/index.mjs.map +1 -0
- package/dist/lib/integrations/node-express/index.d.ts +15 -0
- package/dist/lib/integrations/node-express/index.js +2959 -0
- package/dist/lib/integrations/node-express/index.js.map +1 -0
- package/dist/lib/integrations/node-express/index.mjs +14 -0
- package/dist/lib/integrations/node-express/index.mjs.map +1 -0
- package/dist/lib/integrations/node-http/index.d.ts +15 -0
- package/dist/lib/integrations/node-http/index.js +2945 -0
- package/dist/lib/integrations/node-http/index.js.map +1 -0
- package/dist/lib/integrations/node-http/index.mjs +13 -0
- package/dist/lib/integrations/node-http/index.mjs.map +1 -0
- package/dist/service-adapters/index.d.ts +162 -0
- package/dist/service-adapters/index.js +1787 -0
- package/dist/service-adapters/index.js.map +1 -0
- package/dist/service-adapters/index.mjs +34 -0
- package/dist/service-adapters/index.mjs.map +1 -0
- package/dist/service-adapters/shared/index.d.ts +9 -0
- package/dist/service-adapters/shared/index.js +72 -0
- package/dist/service-adapters/shared/index.js.map +1 -0
- package/dist/service-adapters/shared/index.mjs +8 -0
- package/dist/service-adapters/shared/index.mjs.map +1 -0
- package/dist/shared-0a7346ce.d.ts +466 -0
- package/dist/shared-35c6eb04.d.ts +448 -0
- package/dist/shared-9ed1dc31.d.ts +414 -0
- package/dist/shared-da5708fe.d.ts +449 -0
- package/dist/utils/index.d.ts +65 -0
- package/dist/utils/index.js +175 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +12 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +14 -20
- package/src/lib/index.ts +7 -6
- package/src/lib/runtime/copilot-runtime.ts +62 -26
- package/src/lib/runtime/telemetry-agent-runner.ts +139 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { BaseMessageInput } from './graphql/types/base/index.js';
|
|
2
|
+
|
|
3
|
+
declare enum MessageRole {
|
|
4
|
+
user = "user",
|
|
5
|
+
assistant = "assistant",
|
|
6
|
+
system = "system",
|
|
7
|
+
tool = "tool",
|
|
8
|
+
developer = "developer"
|
|
9
|
+
}
|
|
10
|
+
declare enum ActionInputAvailability {
|
|
11
|
+
disabled = "disabled",
|
|
12
|
+
enabled = "enabled",
|
|
13
|
+
remote = "remote"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare class MessageInput extends BaseMessageInput {
|
|
17
|
+
textMessage?: TextMessageInput;
|
|
18
|
+
actionExecutionMessage?: ActionExecutionMessageInput;
|
|
19
|
+
resultMessage?: ResultMessageInput;
|
|
20
|
+
agentStateMessage?: AgentStateMessageInput;
|
|
21
|
+
imageMessage?: ImageMessageInput;
|
|
22
|
+
}
|
|
23
|
+
declare class TextMessageInput {
|
|
24
|
+
content: string;
|
|
25
|
+
parentMessageId?: string;
|
|
26
|
+
role: MessageRole;
|
|
27
|
+
}
|
|
28
|
+
declare class ActionExecutionMessageInput {
|
|
29
|
+
name: string;
|
|
30
|
+
arguments: string;
|
|
31
|
+
parentMessageId?: string;
|
|
32
|
+
scope?: String;
|
|
33
|
+
}
|
|
34
|
+
declare class ResultMessageInput {
|
|
35
|
+
actionExecutionId: string;
|
|
36
|
+
actionName: string;
|
|
37
|
+
parentMessageId?: string;
|
|
38
|
+
result: string;
|
|
39
|
+
}
|
|
40
|
+
declare class AgentStateMessageInput {
|
|
41
|
+
threadId: string;
|
|
42
|
+
agentName: string;
|
|
43
|
+
role: MessageRole;
|
|
44
|
+
state: string;
|
|
45
|
+
running: boolean;
|
|
46
|
+
nodeName: string;
|
|
47
|
+
runId: string;
|
|
48
|
+
active: boolean;
|
|
49
|
+
}
|
|
50
|
+
declare class ImageMessageInput {
|
|
51
|
+
format: string;
|
|
52
|
+
bytes: string;
|
|
53
|
+
parentMessageId?: string;
|
|
54
|
+
role: MessageRole;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type MessageType = "TextMessage" | "ActionExecutionMessage" | "ResultMessage" | "AgentStateMessage" | "ImageMessage";
|
|
58
|
+
declare class Message extends BaseMessageInput {
|
|
59
|
+
type: MessageType;
|
|
60
|
+
isTextMessage(): this is TextMessage;
|
|
61
|
+
isActionExecutionMessage(): this is ActionExecutionMessage;
|
|
62
|
+
isResultMessage(): this is ResultMessage;
|
|
63
|
+
isAgentStateMessage(): this is AgentStateMessage;
|
|
64
|
+
isImageMessage(): this is ImageMessage;
|
|
65
|
+
}
|
|
66
|
+
declare class TextMessage extends Message implements TextMessageInput {
|
|
67
|
+
type: MessageType;
|
|
68
|
+
content: string;
|
|
69
|
+
role: MessageRole;
|
|
70
|
+
parentMessageId?: string;
|
|
71
|
+
}
|
|
72
|
+
declare class ActionExecutionMessage extends Message implements Omit<ActionExecutionMessageInput, "arguments" | "scope"> {
|
|
73
|
+
type: MessageType;
|
|
74
|
+
name: string;
|
|
75
|
+
arguments: Record<string, any>;
|
|
76
|
+
parentMessageId?: string;
|
|
77
|
+
}
|
|
78
|
+
declare class ResultMessage extends Message implements ResultMessageInput {
|
|
79
|
+
type: MessageType;
|
|
80
|
+
actionExecutionId: string;
|
|
81
|
+
actionName: string;
|
|
82
|
+
result: string;
|
|
83
|
+
static encodeResult(result: any, error?: {
|
|
84
|
+
code: string;
|
|
85
|
+
message: string;
|
|
86
|
+
} | string | Error): string;
|
|
87
|
+
static decodeResult(result: string): {
|
|
88
|
+
error?: {
|
|
89
|
+
code: string;
|
|
90
|
+
message: string;
|
|
91
|
+
};
|
|
92
|
+
result: string;
|
|
93
|
+
};
|
|
94
|
+
hasError(): boolean;
|
|
95
|
+
getError(): {
|
|
96
|
+
code: string;
|
|
97
|
+
message: string;
|
|
98
|
+
} | undefined;
|
|
99
|
+
}
|
|
100
|
+
declare class AgentStateMessage extends Message implements Omit<AgentStateMessageInput, "state"> {
|
|
101
|
+
type: MessageType;
|
|
102
|
+
threadId: string;
|
|
103
|
+
agentName: string;
|
|
104
|
+
nodeName: string;
|
|
105
|
+
runId: string;
|
|
106
|
+
active: boolean;
|
|
107
|
+
role: MessageRole;
|
|
108
|
+
state: any;
|
|
109
|
+
running: boolean;
|
|
110
|
+
}
|
|
111
|
+
declare class ImageMessage extends Message implements ImageMessageInput {
|
|
112
|
+
type: MessageType;
|
|
113
|
+
format: string;
|
|
114
|
+
bytes: string;
|
|
115
|
+
role: MessageRole;
|
|
116
|
+
parentMessageId?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export { ActionInputAvailability as A, ImageMessage as I, Message as M, ResultMessage as R, TextMessage as T, ActionExecutionMessage as a, MessageInput as b, MessageType as c, AgentStateMessage as d };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { BaseMessageInput } from './graphql/types/base/index.js';
|
|
2
|
+
|
|
3
|
+
declare enum MessageRole {
|
|
4
|
+
assistant = "assistant",
|
|
5
|
+
developer = "developer",
|
|
6
|
+
system = "system",
|
|
7
|
+
tool = "tool",
|
|
8
|
+
user = "user"
|
|
9
|
+
}
|
|
10
|
+
declare enum ActionInputAvailability {
|
|
11
|
+
disabled = "disabled",
|
|
12
|
+
enabled = "enabled",
|
|
13
|
+
remote = "remote"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare class MessageInput extends BaseMessageInput {
|
|
17
|
+
textMessage?: TextMessageInput;
|
|
18
|
+
actionExecutionMessage?: ActionExecutionMessageInput;
|
|
19
|
+
resultMessage?: ResultMessageInput;
|
|
20
|
+
agentStateMessage?: AgentStateMessageInput;
|
|
21
|
+
imageMessage?: ImageMessageInput;
|
|
22
|
+
}
|
|
23
|
+
declare class TextMessageInput {
|
|
24
|
+
content: string;
|
|
25
|
+
parentMessageId?: string;
|
|
26
|
+
role: MessageRole;
|
|
27
|
+
}
|
|
28
|
+
declare class ActionExecutionMessageInput {
|
|
29
|
+
name: string;
|
|
30
|
+
arguments: string;
|
|
31
|
+
parentMessageId?: string;
|
|
32
|
+
scope?: String;
|
|
33
|
+
}
|
|
34
|
+
declare class ResultMessageInput {
|
|
35
|
+
actionExecutionId: string;
|
|
36
|
+
actionName: string;
|
|
37
|
+
parentMessageId?: string;
|
|
38
|
+
result: string;
|
|
39
|
+
}
|
|
40
|
+
declare class AgentStateMessageInput {
|
|
41
|
+
threadId: string;
|
|
42
|
+
agentName: string;
|
|
43
|
+
role: MessageRole;
|
|
44
|
+
state: string;
|
|
45
|
+
running: boolean;
|
|
46
|
+
nodeName: string;
|
|
47
|
+
runId: string;
|
|
48
|
+
active: boolean;
|
|
49
|
+
}
|
|
50
|
+
declare class ImageMessageInput {
|
|
51
|
+
format: string;
|
|
52
|
+
bytes: string;
|
|
53
|
+
parentMessageId?: string;
|
|
54
|
+
role: MessageRole;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare enum MessageStatusCode {
|
|
58
|
+
Pending = "pending",
|
|
59
|
+
Success = "success",
|
|
60
|
+
Failed = "failed"
|
|
61
|
+
}
|
|
62
|
+
declare class BaseMessageStatus {
|
|
63
|
+
code: MessageStatusCode;
|
|
64
|
+
}
|
|
65
|
+
declare class PendingMessageStatus extends BaseMessageStatus {
|
|
66
|
+
code: MessageStatusCode;
|
|
67
|
+
}
|
|
68
|
+
declare class SuccessMessageStatus extends BaseMessageStatus {
|
|
69
|
+
code: MessageStatusCode;
|
|
70
|
+
}
|
|
71
|
+
declare class FailedMessageStatus extends BaseMessageStatus {
|
|
72
|
+
code: MessageStatusCode;
|
|
73
|
+
reason: string;
|
|
74
|
+
}
|
|
75
|
+
declare const MessageStatusUnion: PendingMessageStatus | SuccessMessageStatus | FailedMessageStatus;
|
|
76
|
+
type MessageStatus = typeof MessageStatusUnion;
|
|
77
|
+
|
|
78
|
+
declare abstract class BaseMessageOutput {
|
|
79
|
+
id: string;
|
|
80
|
+
createdAt: Date;
|
|
81
|
+
status: typeof MessageStatusUnion;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type MessageType = "TextMessage" | "ActionExecutionMessage" | "ResultMessage" | "AgentStateMessage" | "ImageMessage";
|
|
85
|
+
declare class Message {
|
|
86
|
+
type: MessageType;
|
|
87
|
+
id: BaseMessageOutput["id"];
|
|
88
|
+
createdAt: BaseMessageOutput["createdAt"];
|
|
89
|
+
status: MessageStatus;
|
|
90
|
+
constructor(props: any);
|
|
91
|
+
isTextMessage(): this is TextMessage;
|
|
92
|
+
isActionExecutionMessage(): this is ActionExecutionMessage;
|
|
93
|
+
isResultMessage(): this is ResultMessage;
|
|
94
|
+
isAgentStateMessage(): this is AgentStateMessage;
|
|
95
|
+
isImageMessage(): this is ImageMessage;
|
|
96
|
+
}
|
|
97
|
+
declare const Role: typeof MessageRole;
|
|
98
|
+
type MessageConstructorOptions = Partial<Message>;
|
|
99
|
+
type TextMessageConstructorOptions = MessageConstructorOptions & TextMessageInput;
|
|
100
|
+
declare class TextMessage extends Message implements TextMessageConstructorOptions {
|
|
101
|
+
content: TextMessageInput["content"];
|
|
102
|
+
parentMessageId: TextMessageInput["parentMessageId"];
|
|
103
|
+
role: TextMessageInput["role"];
|
|
104
|
+
type: "TextMessage";
|
|
105
|
+
constructor(props: TextMessageConstructorOptions);
|
|
106
|
+
}
|
|
107
|
+
declare class ActionExecutionMessage extends Message implements Omit<ActionExecutionMessageInput, "arguments" | "scope"> {
|
|
108
|
+
type: MessageType;
|
|
109
|
+
name: string;
|
|
110
|
+
arguments: Record<string, any>;
|
|
111
|
+
parentMessageId?: string;
|
|
112
|
+
}
|
|
113
|
+
declare class ResultMessage extends Message implements ResultMessageInput {
|
|
114
|
+
type: MessageType;
|
|
115
|
+
actionExecutionId: string;
|
|
116
|
+
actionName: string;
|
|
117
|
+
result: string;
|
|
118
|
+
static encodeResult(result: any, error?: {
|
|
119
|
+
code: string;
|
|
120
|
+
message: string;
|
|
121
|
+
} | string | Error): string;
|
|
122
|
+
static decodeResult(result: string): {
|
|
123
|
+
error?: {
|
|
124
|
+
code: string;
|
|
125
|
+
message: string;
|
|
126
|
+
};
|
|
127
|
+
result: string;
|
|
128
|
+
};
|
|
129
|
+
hasError(): boolean;
|
|
130
|
+
getError(): {
|
|
131
|
+
code: string;
|
|
132
|
+
message: string;
|
|
133
|
+
} | undefined;
|
|
134
|
+
}
|
|
135
|
+
declare class AgentStateMessage extends Message implements Omit<AgentStateMessageInput, "state"> {
|
|
136
|
+
type: MessageType;
|
|
137
|
+
threadId: string;
|
|
138
|
+
agentName: string;
|
|
139
|
+
nodeName: string;
|
|
140
|
+
runId: string;
|
|
141
|
+
active: boolean;
|
|
142
|
+
role: MessageRole;
|
|
143
|
+
state: any;
|
|
144
|
+
running: boolean;
|
|
145
|
+
}
|
|
146
|
+
declare class ImageMessage extends Message implements ImageMessageInput {
|
|
147
|
+
type: MessageType;
|
|
148
|
+
format: string;
|
|
149
|
+
bytes: string;
|
|
150
|
+
role: MessageRole;
|
|
151
|
+
parentMessageId?: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export { ActionExecutionMessage as A, ImageMessage as I, Message as M, ResultMessage as R, TextMessage as T, MessageInput as a, ActionInputAvailability as b, MessageType as c, Role as d, AgentStateMessage as e };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import Anthropic from '@anthropic-ai/sdk';
|
|
|
9
9
|
import * as graphql from 'graphql';
|
|
10
10
|
import * as pino from 'pino';
|
|
11
11
|
import { YogaInitialContext, createYoga } from 'graphql-yoga';
|
|
12
|
-
import { CopilotRuntimeOptions, CopilotRuntime as CopilotRuntime$1 } from '@copilotkitnext/runtime';
|
|
12
|
+
import { CopilotRuntimeOptions, CopilotRuntime as CopilotRuntime$1, AgentRunner } from '@copilotkitnext/runtime';
|
|
13
13
|
import { AbstractAgent } from '@ag-ui/client';
|
|
14
14
|
import * as http from 'http';
|
|
15
15
|
import { ServerResponse, IncomingMessage } from 'http';
|
|
@@ -1370,31 +1370,90 @@ declare function copilotRuntimeNestEndpoint(options: CreateCopilotRuntimeServerO
|
|
|
1370
1370
|
}, res: http.ServerResponse) => Promise<void>;
|
|
1371
1371
|
|
|
1372
1372
|
/**
|
|
1373
|
-
*
|
|
1373
|
+
* TelemetryAgentRunner - A wrapper around AgentRunner that adds telemetry
|
|
1374
|
+
* for agent execution streams.
|
|
1375
|
+
*
|
|
1376
|
+
* This captures the following telemetry events:
|
|
1377
|
+
* - oss.runtime.agent_execution_stream_started - when an agent execution starts
|
|
1378
|
+
* - oss.runtime.agent_execution_stream_ended - when an agent execution completes
|
|
1379
|
+
* - oss.runtime.agent_execution_stream_errored - when an agent execution fails
|
|
1380
|
+
*/
|
|
1381
|
+
|
|
1382
|
+
/**
|
|
1383
|
+
* Configuration options for TelemetryAgentRunner
|
|
1384
|
+
*/
|
|
1385
|
+
interface TelemetryAgentRunnerConfig {
|
|
1386
|
+
/**
|
|
1387
|
+
* The underlying runner to delegate to
|
|
1388
|
+
* If not provided, defaults to InMemoryAgentRunner
|
|
1389
|
+
*/
|
|
1390
|
+
runner?: AgentRunner;
|
|
1391
|
+
/**
|
|
1392
|
+
* Optional LangSmith API key (will be hashed for telemetry)
|
|
1393
|
+
*/
|
|
1394
|
+
langsmithApiKey?: string;
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* An AgentRunner wrapper that adds telemetry tracking for agent executions.
|
|
1398
|
+
*
|
|
1399
|
+
* Usage:
|
|
1400
|
+
* ```ts
|
|
1401
|
+
* const runtime = new CopilotRuntime({
|
|
1402
|
+
* runner: new TelemetryAgentRunner(),
|
|
1403
|
+
* // or with custom runner:
|
|
1404
|
+
* runner: new TelemetryAgentRunner({ runner: customRunner }),
|
|
1405
|
+
* });
|
|
1406
|
+
* ```
|
|
1407
|
+
*/
|
|
1408
|
+
declare class TelemetryAgentRunner implements AgentRunner {
|
|
1409
|
+
private readonly _runner;
|
|
1410
|
+
private readonly hashedLgcKey;
|
|
1411
|
+
constructor(config?: TelemetryAgentRunnerConfig);
|
|
1412
|
+
/**
|
|
1413
|
+
* Runs an agent with telemetry tracking.
|
|
1414
|
+
* Wraps the underlying runner's Observable stream with telemetry events.
|
|
1415
|
+
*/
|
|
1416
|
+
run(...args: Parameters<AgentRunner["run"]>): ReturnType<AgentRunner["run"]>;
|
|
1417
|
+
/**
|
|
1418
|
+
* Delegates to the underlying runner's connect method
|
|
1419
|
+
*/
|
|
1420
|
+
connect(...args: Parameters<AgentRunner["connect"]>): ReturnType<AgentRunner["connect"]>;
|
|
1421
|
+
/**
|
|
1422
|
+
* Delegates to the underlying runner's isRunning method
|
|
1423
|
+
*/
|
|
1424
|
+
isRunning(...args: Parameters<AgentRunner["isRunning"]>): ReturnType<AgentRunner["isRunning"]>;
|
|
1425
|
+
/**
|
|
1426
|
+
* Delegates to the underlying runner's stop method
|
|
1427
|
+
*/
|
|
1428
|
+
stop(...args: Parameters<AgentRunner["stop"]>): ReturnType<AgentRunner["stop"]>;
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* @deprecated LangGraphAgent import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
|
|
1374
1433
|
*/
|
|
1375
1434
|
declare class LangGraphAgent {
|
|
1376
1435
|
constructor();
|
|
1377
1436
|
}
|
|
1378
1437
|
/**
|
|
1379
|
-
* @deprecated LangGraphHttpAgent import from
|
|
1438
|
+
* @deprecated LangGraphHttpAgent import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
|
|
1380
1439
|
*/
|
|
1381
1440
|
declare class LangGraphHttpAgent {
|
|
1382
1441
|
constructor();
|
|
1383
1442
|
}
|
|
1384
1443
|
/**
|
|
1385
|
-
* @deprecated TextMessageEvents import from
|
|
1444
|
+
* @deprecated TextMessageEvents import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
|
|
1386
1445
|
*/
|
|
1387
1446
|
type TextMessageEvents = any;
|
|
1388
1447
|
/**
|
|
1389
|
-
* @deprecated ToolCallEvents import from
|
|
1448
|
+
* @deprecated ToolCallEvents import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
|
|
1390
1449
|
*/
|
|
1391
1450
|
type ToolCallEvents = any;
|
|
1392
1451
|
/**
|
|
1393
|
-
* @deprecated CustomEventNames import from
|
|
1452
|
+
* @deprecated CustomEventNames import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
|
|
1394
1453
|
*/
|
|
1395
1454
|
type CustomEventNames = any;
|
|
1396
1455
|
/**
|
|
1397
|
-
* @deprecated PredictStateTool import from
|
|
1456
|
+
* @deprecated PredictStateTool import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
|
|
1398
1457
|
*/
|
|
1399
1458
|
type PredictStateTool = any;
|
|
1400
1459
|
|
|
@@ -1443,4 +1502,4 @@ declare class UnknownErrorResponse extends FailedResponseStatus {
|
|
|
1443
1502
|
});
|
|
1444
1503
|
}
|
|
1445
1504
|
|
|
1446
|
-
export { AnthropicAdapter, AnthropicAdapterParams, AnthropicPromptCachingConfig, BedrockAdapter, BedrockAdapterParams, CommonConfig, CopilotRequestContextProperties, CopilotRuntime, CopilotRuntimeChatCompletionRequest, CopilotRuntimeChatCompletionResponse, CopilotRuntimeConstructorParams_BASE, CopilotRuntimeLogger, CopilotServiceAdapter, CreateCopilotRuntimeServerOptions, CustomEventNames, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter, GoogleGenerativeAIAdapter, GraphQLContext, GroqAdapter, GroqAdapterParams, GuardrailsValidationFailureResponse, LangChainAdapter, LangGraphAgent, LangGraphHttpAgent, LogLevel, MCPClient, MCPEndpointConfig, MCPTool, MessageStreamInterruptedResponse, OpenAIAdapter, OpenAIAdapterParams, OpenAIAssistantAdapter, OpenAIAssistantAdapterParams, PredictStateTool, RemoteChain, RemoteChainParameters, TextMessageEvents, ToolCallEvents, UnifyAdapter, UnifyAdapterParams, UnknownErrorResponse, addCustomHeaderPlugin, buildSchema, config, convertMCPToolsToActions, convertServiceAdapterError, copilotKitEndpoint, copilotRuntimeNestEndpoint, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint, copilotRuntimeNodeExpressEndpoint, copilotRuntimeNodeHttpEndpoint, createContext, createLogger, extractParametersFromSchema, generateMcpToolInstructions, getCommonConfig, langGraphPlatformEndpoint, readableStreamToNodeStream, resolveEndpointType };
|
|
1505
|
+
export { AnthropicAdapter, AnthropicAdapterParams, AnthropicPromptCachingConfig, BedrockAdapter, BedrockAdapterParams, CommonConfig, CopilotRequestContextProperties, CopilotRuntime, CopilotRuntimeChatCompletionRequest, CopilotRuntimeChatCompletionResponse, CopilotRuntimeConstructorParams_BASE, CopilotRuntimeLogger, CopilotServiceAdapter, CreateCopilotRuntimeServerOptions, CustomEventNames, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter, GoogleGenerativeAIAdapter, GraphQLContext, GroqAdapter, GroqAdapterParams, GuardrailsValidationFailureResponse, LangChainAdapter, LangGraphAgent, LangGraphHttpAgent, LogLevel, MCPClient, MCPEndpointConfig, MCPTool, MessageStreamInterruptedResponse, OpenAIAdapter, OpenAIAdapterParams, OpenAIAssistantAdapter, OpenAIAssistantAdapterParams, PredictStateTool, RemoteChain, RemoteChainParameters, TelemetryAgentRunner, TelemetryAgentRunnerConfig, TextMessageEvents, ToolCallEvents, UnifyAdapter, UnifyAdapterParams, UnknownErrorResponse, addCustomHeaderPlugin, buildSchema, config, convertMCPToolsToActions, convertServiceAdapterError, copilotKitEndpoint, copilotRuntimeNestEndpoint, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint, copilotRuntimeNodeExpressEndpoint, copilotRuntimeNodeHttpEndpoint, createContext, createLogger, extractParametersFromSchema, generateMcpToolInstructions, getCommonConfig, langGraphPlatformEndpoint, readableStreamToNodeStream, resolveEndpointType };
|
package/dist/index.js
CHANGED
|
@@ -72,7 +72,7 @@ var require_package = __commonJS({
|
|
|
72
72
|
publishConfig: {
|
|
73
73
|
access: "public"
|
|
74
74
|
},
|
|
75
|
-
version: "1.50.0
|
|
75
|
+
version: "1.50.0",
|
|
76
76
|
sideEffects: false,
|
|
77
77
|
main: "./dist/index.js",
|
|
78
78
|
module: "./dist/index.mjs",
|
|
@@ -123,12 +123,14 @@ var require_package = __commonJS({
|
|
|
123
123
|
vitest: "^3.2.4"
|
|
124
124
|
},
|
|
125
125
|
dependencies: {
|
|
126
|
+
"@ag-ui/client": "^0.0.42",
|
|
127
|
+
"@ag-ui/core": "^0.0.42",
|
|
128
|
+
"@ag-ui/langgraph": "^0.0.20",
|
|
126
129
|
"@copilotkit/shared": "workspace:*",
|
|
127
|
-
"@copilotkitnext/agent": "0.0.
|
|
128
|
-
"@copilotkitnext/runtime": "0.0.
|
|
130
|
+
"@copilotkitnext/agent": "0.0.31",
|
|
131
|
+
"@copilotkitnext/runtime": "0.0.31",
|
|
129
132
|
"@graphql-yoga/plugin-defer-stream": "^3.3.1",
|
|
130
133
|
"@hono/node-server": "^1.13.5",
|
|
131
|
-
"@langchain/core": "^0.3.38",
|
|
132
134
|
"@scarf/scarf": "^1.3.0",
|
|
133
135
|
"class-transformer": "^0.5.1",
|
|
134
136
|
"class-validator": "^0.14.1",
|
|
@@ -136,7 +138,6 @@ var require_package = __commonJS({
|
|
|
136
138
|
"graphql-scalars": "^1.23.0",
|
|
137
139
|
"graphql-yoga": "^5.3.1",
|
|
138
140
|
hono: "^4.10.3",
|
|
139
|
-
langchain: "^0.3.3",
|
|
140
141
|
openai: "^4.85.1",
|
|
141
142
|
"partial-json": "^0.1.7",
|
|
142
143
|
pino: "^9.2.0",
|
|
@@ -148,27 +149,20 @@ var require_package = __commonJS({
|
|
|
148
149
|
},
|
|
149
150
|
peerDependencies: {
|
|
150
151
|
"@anthropic-ai/sdk": "^0.57.0",
|
|
151
|
-
"@
|
|
152
|
-
"@
|
|
153
|
-
"@
|
|
154
|
-
"@
|
|
155
|
-
"@
|
|
156
|
-
"@langchain/
|
|
157
|
-
"@langchain/community": "^0.3.58",
|
|
158
|
-
"@langchain/google-gauth": "^0.1.0",
|
|
159
|
-
"@langchain/langgraph-sdk": "^0.0.70",
|
|
160
|
-
"@langchain/openai": "^0.4.2",
|
|
152
|
+
"@langchain/aws": ">=0.1.9",
|
|
153
|
+
"@langchain/core": ">=0.3.66",
|
|
154
|
+
"@langchain/community": ">=0.3.58",
|
|
155
|
+
"@langchain/google-gauth": ">=0.1.0",
|
|
156
|
+
"@langchain/langgraph-sdk": ">=0.1.2",
|
|
157
|
+
"@langchain/openai": ">=0.4.2",
|
|
161
158
|
"groq-sdk": ">=0.3.0 <1.0.0",
|
|
162
|
-
langchain: "
|
|
159
|
+
langchain: ">=0.3.3",
|
|
163
160
|
openai: "^4.85.1"
|
|
164
161
|
},
|
|
165
162
|
peerDependenciesMeta: {
|
|
166
163
|
"@anthropic-ai/sdk": {
|
|
167
164
|
optional: true
|
|
168
165
|
},
|
|
169
|
-
"@ag-ui/langgraph": {
|
|
170
|
-
optional: true
|
|
171
|
-
},
|
|
172
166
|
"@langchain/aws": {
|
|
173
167
|
optional: true
|
|
174
168
|
},
|
|
@@ -3240,6 +3234,82 @@ function aguiMessageWithImageToGQLMessage(message) {
|
|
|
3240
3234
|
});
|
|
3241
3235
|
}
|
|
3242
3236
|
__name(aguiMessageWithImageToGQLMessage, "aguiMessageWithImageToGQLMessage");
|
|
3237
|
+
var TelemetryAgentRunner = class {
|
|
3238
|
+
_runner;
|
|
3239
|
+
hashedLgcKey;
|
|
3240
|
+
constructor(config2) {
|
|
3241
|
+
this._runner = (config2 == null ? void 0 : config2.runner) ?? new runtime.InMemoryAgentRunner();
|
|
3242
|
+
this.hashedLgcKey = (config2 == null ? void 0 : config2.langsmithApiKey) ? crypto.createHash("sha256").update(config2.langsmithApiKey).digest("hex") : void 0;
|
|
3243
|
+
}
|
|
3244
|
+
/**
|
|
3245
|
+
* Runs an agent with telemetry tracking.
|
|
3246
|
+
* Wraps the underlying runner's Observable stream with telemetry events.
|
|
3247
|
+
*/
|
|
3248
|
+
run(...args) {
|
|
3249
|
+
const streamInfo = {
|
|
3250
|
+
hashedLgcKey: this.hashedLgcKey
|
|
3251
|
+
};
|
|
3252
|
+
let streamErrored = false;
|
|
3253
|
+
telemetry_client_default.capture("oss.runtime.agent_execution_stream_started", {
|
|
3254
|
+
hashedLgcKey: this.hashedLgcKey
|
|
3255
|
+
});
|
|
3256
|
+
return this._runner.run(...args).pipe(
|
|
3257
|
+
// Extract metadata from events if available
|
|
3258
|
+
rxjs.tap((event) => {
|
|
3259
|
+
var _a;
|
|
3260
|
+
const rawEvent = event.rawEvent;
|
|
3261
|
+
if (rawEvent == null ? void 0 : rawEvent.data) {
|
|
3262
|
+
const data = rawEvent.data;
|
|
3263
|
+
if ((_a = data == null ? void 0 : data.output) == null ? void 0 : _a.model) {
|
|
3264
|
+
streamInfo.model = data.output.model;
|
|
3265
|
+
streamInfo.provider = data.output.model;
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3268
|
+
if (rawEvent == null ? void 0 : rawEvent.metadata) {
|
|
3269
|
+
const metadata = rawEvent.metadata;
|
|
3270
|
+
if (metadata == null ? void 0 : metadata.langgraph_host) {
|
|
3271
|
+
streamInfo.langGraphHost = metadata.langgraph_host;
|
|
3272
|
+
}
|
|
3273
|
+
if (metadata == null ? void 0 : metadata.langgraph_version) {
|
|
3274
|
+
streamInfo.langGraphVersion = metadata.langgraph_version;
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
}),
|
|
3278
|
+
rxjs.catchError((error) => {
|
|
3279
|
+
streamErrored = true;
|
|
3280
|
+
telemetry_client_default.capture("oss.runtime.agent_execution_stream_errored", {
|
|
3281
|
+
...streamInfo,
|
|
3282
|
+
error: error instanceof Error ? error.message : String(error)
|
|
3283
|
+
});
|
|
3284
|
+
throw error;
|
|
3285
|
+
}),
|
|
3286
|
+
rxjs.finalize(() => {
|
|
3287
|
+
if (!streamErrored) {
|
|
3288
|
+
telemetry_client_default.capture("oss.runtime.agent_execution_stream_ended", streamInfo);
|
|
3289
|
+
}
|
|
3290
|
+
})
|
|
3291
|
+
);
|
|
3292
|
+
}
|
|
3293
|
+
/**
|
|
3294
|
+
* Delegates to the underlying runner's connect method
|
|
3295
|
+
*/
|
|
3296
|
+
connect(...args) {
|
|
3297
|
+
return this._runner.connect(...args);
|
|
3298
|
+
}
|
|
3299
|
+
/**
|
|
3300
|
+
* Delegates to the underlying runner's isRunning method
|
|
3301
|
+
*/
|
|
3302
|
+
isRunning(...args) {
|
|
3303
|
+
return this._runner.isRunning(...args);
|
|
3304
|
+
}
|
|
3305
|
+
/**
|
|
3306
|
+
* Delegates to the underlying runner's stop method
|
|
3307
|
+
*/
|
|
3308
|
+
stop(...args) {
|
|
3309
|
+
return this._runner.stop(...args);
|
|
3310
|
+
}
|
|
3311
|
+
};
|
|
3312
|
+
__name(TelemetryAgentRunner, "TelemetryAgentRunner");
|
|
3243
3313
|
|
|
3244
3314
|
// src/lib/runtime/types.ts
|
|
3245
3315
|
var EndpointType;
|
|
@@ -3393,12 +3463,16 @@ var CopilotRuntime = class {
|
|
|
3393
3463
|
constructor(params) {
|
|
3394
3464
|
const agents = (params == null ? void 0 : params.agents) ?? {};
|
|
3395
3465
|
const endpointAgents = this.assignEndpointsToAgents((params == null ? void 0 : params.remoteEndpoints) ?? []);
|
|
3466
|
+
const baseRunner = (params == null ? void 0 : params.runner) ?? new runtime.InMemoryAgentRunner();
|
|
3467
|
+
const runner = shared.isTelemetryDisabled() ? baseRunner : new TelemetryAgentRunner({
|
|
3468
|
+
runner: baseRunner
|
|
3469
|
+
});
|
|
3396
3470
|
this.runtimeArgs = {
|
|
3397
3471
|
agents: {
|
|
3398
3472
|
...endpointAgents,
|
|
3399
3473
|
...agents
|
|
3400
3474
|
},
|
|
3401
|
-
runner
|
|
3475
|
+
runner,
|
|
3402
3476
|
// TODO: add support for transcriptionService from CopilotRuntimeOptionsVNext once it is ready
|
|
3403
3477
|
// transcriptionService: params?.transcriptionService,
|
|
3404
3478
|
beforeRequestMiddleware: this.createOnBeforeRequestHandler(params).bind(this),
|
|
@@ -3424,6 +3498,7 @@ var CopilotRuntime = class {
|
|
|
3424
3498
|
}
|
|
3425
3499
|
handleServiceAdapter(serviceAdapter) {
|
|
3426
3500
|
this.runtimeArgs.agents = Promise.resolve(this.runtimeArgs.agents ?? {}).then(async (agents) => {
|
|
3501
|
+
var _a;
|
|
3427
3502
|
let agentsList = agents;
|
|
3428
3503
|
const isAgentsListEmpty = !Object.keys(agents).length;
|
|
3429
3504
|
const hasServiceAdapter = Boolean(serviceAdapter);
|
|
@@ -3441,10 +3516,11 @@ var CopilotRuntime = class {
|
|
|
3441
3516
|
model: `${serviceAdapter.provider}/${serviceAdapter.model}`
|
|
3442
3517
|
});
|
|
3443
3518
|
}
|
|
3444
|
-
|
|
3519
|
+
const actions = (_a = this.params) == null ? void 0 : _a.actions;
|
|
3520
|
+
if (actions) {
|
|
3445
3521
|
const mcpTools = await this.getToolsFromMCP();
|
|
3446
3522
|
agentsList = this.assignToolsToAgents(agents, [
|
|
3447
|
-
...this.getToolsFromActions(
|
|
3523
|
+
...this.getToolsFromActions(actions),
|
|
3448
3524
|
...mcpTools
|
|
3449
3525
|
]);
|
|
3450
3526
|
}
|
|
@@ -3491,11 +3567,24 @@ var CopilotRuntime = class {
|
|
|
3491
3567
|
}
|
|
3492
3568
|
createOnBeforeRequestHandler(params) {
|
|
3493
3569
|
return async (hookParams) => {
|
|
3494
|
-
var _a, _b;
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3570
|
+
var _a, _b, _c, _d;
|
|
3571
|
+
const { request } = hookParams;
|
|
3572
|
+
const publicApiKey = request.headers.get("x-copilotcloud-public-api-key");
|
|
3573
|
+
const body = await shared.readBody(request);
|
|
3574
|
+
const forwardedProps = body.forwardedProps;
|
|
3575
|
+
const cloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL || "https://api.cloud.copilotkit.ai";
|
|
3576
|
+
telemetry_client_default.capture("oss.runtime.copilot_request_created", {
|
|
3577
|
+
"cloud.guardrails.enabled": ((_a = forwardedProps == null ? void 0 : forwardedProps.cloud) == null ? void 0 : _a.guardrails) !== void 0,
|
|
3578
|
+
requestType: ((_b = forwardedProps == null ? void 0 : forwardedProps.metadata) == null ? void 0 : _b.requestType) ?? "unknown",
|
|
3579
|
+
"cloud.api_key_provided": !!publicApiKey,
|
|
3580
|
+
...publicApiKey ? {
|
|
3581
|
+
"cloud.public_api_key": publicApiKey
|
|
3582
|
+
} : {},
|
|
3583
|
+
"cloud.base_url": cloudBaseUrl
|
|
3584
|
+
});
|
|
3585
|
+
(_c = params == null ? void 0 : params.beforeRequestMiddleware) == null ? void 0 : _c.call(params, hookParams);
|
|
3586
|
+
if ((_d = params == null ? void 0 : params.middleware) == null ? void 0 : _d.onBeforeRequest) {
|
|
3587
|
+
const { request: request2, runtime, path } = hookParams;
|
|
3499
3588
|
const gqlMessages = aguiToGQL(body.messages).reduce((acc, msg) => {
|
|
3500
3589
|
if ("role" in msg && msg.role === "user") {
|
|
3501
3590
|
acc.inputMessages.push(msg);
|
|
@@ -3513,7 +3602,7 @@ var CopilotRuntime = class {
|
|
|
3513
3602
|
runId: body.runId,
|
|
3514
3603
|
inputMessages,
|
|
3515
3604
|
properties: body.forwardedProps,
|
|
3516
|
-
url:
|
|
3605
|
+
url: request2.url
|
|
3517
3606
|
});
|
|
3518
3607
|
}
|
|
3519
3608
|
};
|
|
@@ -5492,6 +5581,7 @@ exports.MessageStreamInterruptedResponse = MessageStreamInterruptedResponse;
|
|
|
5492
5581
|
exports.OpenAIAdapter = OpenAIAdapter;
|
|
5493
5582
|
exports.OpenAIAssistantAdapter = OpenAIAssistantAdapter;
|
|
5494
5583
|
exports.RemoteChain = RemoteChain;
|
|
5584
|
+
exports.TelemetryAgentRunner = TelemetryAgentRunner;
|
|
5495
5585
|
exports.UnifyAdapter = UnifyAdapter;
|
|
5496
5586
|
exports.UnknownErrorResponse = UnknownErrorResponse;
|
|
5497
5587
|
exports.addCustomHeaderPlugin = addCustomHeaderPlugin;
|