@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 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/graphql/types/response-status.type.ts","../../src/utils/failed-response-status-reasons.ts"],"sourcesContent":["export * from \"./failed-response-status-reasons\";\n","import { GraphQLJSON } from \"graphql-scalars\";\nimport { Field, InterfaceType, ObjectType, createUnionType, registerEnumType } from \"type-graphql\";\n\nexport enum ResponseStatusCode {\n Pending = \"pending\",\n Success = \"success\",\n Failed = \"failed\",\n}\n\nregisterEnumType(ResponseStatusCode, {\n name: \"ResponseStatusCode\",\n});\n\n@InterfaceType({\n resolveType(value) {\n if (value.code === ResponseStatusCode.Success) {\n return SuccessResponseStatus;\n } else if (value.code === ResponseStatusCode.Failed) {\n return FailedResponseStatus;\n } else if (value.code === ResponseStatusCode.Pending) {\n return PendingResponseStatus;\n }\n return undefined;\n },\n})\n@ObjectType()\nabstract class BaseResponseStatus {\n @Field(() => ResponseStatusCode)\n code: ResponseStatusCode;\n}\n\n@ObjectType({ implements: BaseResponseStatus })\nexport class PendingResponseStatus extends BaseResponseStatus {\n code: ResponseStatusCode = ResponseStatusCode.Pending;\n}\n\n@ObjectType({ implements: BaseResponseStatus })\nexport class SuccessResponseStatus extends BaseResponseStatus {\n code: ResponseStatusCode = ResponseStatusCode.Success;\n}\n\nexport enum FailedResponseStatusReason {\n GUARDRAILS_VALIDATION_FAILED = \"GUARDRAILS_VALIDATION_FAILED\",\n MESSAGE_STREAM_INTERRUPTED = \"MESSAGE_STREAM_INTERRUPTED\",\n UNKNOWN_ERROR = \"UNKNOWN_ERROR\",\n}\n\nregisterEnumType(FailedResponseStatusReason, {\n name: \"FailedResponseStatusReason\",\n});\n\n@ObjectType({ implements: BaseResponseStatus })\nexport class FailedResponseStatus extends BaseResponseStatus {\n code: ResponseStatusCode = ResponseStatusCode.Failed;\n\n @Field(() => FailedResponseStatusReason)\n reason: FailedResponseStatusReason;\n\n @Field(() => GraphQLJSON, { nullable: true })\n details?: Record<string, any> = null;\n}\n\nexport const ResponseStatusUnion = createUnionType({\n name: \"ResponseStatus\",\n types: () => [PendingResponseStatus, SuccessResponseStatus, FailedResponseStatus] as const,\n});\n","import {\n FailedResponseStatus,\n FailedResponseStatusReason,\n} from \"../graphql/types/response-status.type\";\n\nexport class GuardrailsValidationFailureResponse extends FailedResponseStatus {\n reason = FailedResponseStatusReason.GUARDRAILS_VALIDATION_FAILED;\n declare details: {\n guardrailsReason: string;\n };\n\n constructor({ guardrailsReason }) {\n super();\n this.details = {\n guardrailsReason,\n };\n }\n}\n\nexport class MessageStreamInterruptedResponse extends FailedResponseStatus {\n reason = FailedResponseStatusReason.MESSAGE_STREAM_INTERRUPTED;\n declare details: {\n messageId: string;\n description: string;\n };\n\n constructor({ messageId }: { messageId: string }) {\n super();\n this.details = {\n messageId,\n description: \"Check the message for mode details\",\n };\n }\n}\n\nexport class UnknownErrorResponse extends FailedResponseStatus {\n reason = FailedResponseStatusReason.UNKNOWN_ERROR;\n declare details: {\n description?: string;\n originalError?: {\n code?: string;\n statusCode?: number;\n severity?: string;\n visibility?: string;\n originalErrorType?: string;\n extensions?: any;\n };\n };\n\n constructor({\n description,\n originalError,\n }: {\n description?: string;\n originalError?: {\n code?: string;\n statusCode?: number;\n severity?: string;\n visibility?: string;\n originalErrorType?: string;\n extensions?: any;\n };\n }) {\n super();\n this.details = {\n description,\n originalError,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;ACAA,6BAA4B;AAC5B,0BAAoF;;;;;;;;;;;;;;;;;;UAExEA,qBAAAA;;;;GAAAA,uBAAAA,qBAAAA,CAAAA,EAAAA;IAMZC,sCAAiBD,oBAAoB;EACnCE,MAAM;AACR,CAAA;AAeA,IAAeC,qBAAf,6BAAeA,oBAAAA;EAEbC;AACF,GAHA;;MACGC,2BAAM,MAAML,kBAAAA;;GADAG,mBAAAA,WAAAA,QAAAA,MAAAA;AAAAA,qBAAAA,aAAAA;MAbdG,mCAAc;IACbC,YAAYC,OAAK;AACf,UAAIA,MAAMJ,SAAI,WAAiC;AAC7C,eAAOK;MACT,WAAWD,MAAMJ,SAAI,UAAgC;AACnD,eAAOM;MACT,WAAWF,MAAMJ,SAAI,WAAiC;AACpD,eAAOO;MACT;AACA,aAAOC;IACT;EACF,CAAA;MACCC,gCAAAA;GACcV,kBAAAA;AAMR,IAAMQ,wBAAN,cAAoCR,mBAAAA;EACzCC,OAAAA;AACF;AAFaO;AAAAA,wBAAAA,aAAAA;MADZE,gCAAW;IAAEC,YAAYX;EAAmB,CAAA;GAChCQ,qBAAAA;AAKN,IAAMF,wBAAN,cAAoCN,mBAAAA;EACzCC,OAAAA;AACF;AAFaK;AAAAA,wBAAAA,aAAAA;MADZI,gCAAW;IAAEC,YAAYX;EAAmB,CAAA;GAChCM,qBAAAA;;UAIDM,6BAAAA;;;;GAAAA,+BAAAA,6BAAAA,CAAAA,EAAAA;IAMZd,sCAAiBc,4BAA4B;EAC3Cb,MAAM;AACR,CAAA;AAGO,IAAMQ,uBAAN,cAAmCP,mBAAAA;EACxCC,OAAAA;EAGAY;EAGAC,UAAgC;AAClC;AARaP;;MAGVL,2BAAM,MAAMU,0BAAAA;;GAHFL,qBAAAA,WAAAA,UAAAA,MAAAA;;MAMVL,2BAAM,MAAMa,oCAAa;IAAEC,UAAU;EAAK,CAAA;qCACjC,WAAA,cAAA,SAAA,MAAA;GAPCT,qBAAAA,WAAAA,WAAAA,MAAAA;AAAAA,uBAAAA,aAAAA;MADZG,gCAAW;IAAEC,YAAYX;EAAmB,CAAA;GAChCO,oBAAAA;AAUN,IAAMU,0BAAsBC,qCAAgB;EACjDnB,MAAM;EACNoB,OAAO,MAAM;IAACX;IAAuBF;IAAuBC;;AAC9D,CAAA;;;AC5DO,IAAMa,sCAAN,cAAkDC,qBAAAA;EACvDC,SAASC,2BAA2BC;EAKpCC,YAAY,EAAEC,iBAAgB,GAAI;AAChC,UAAK;AACL,SAAKC,UAAU;MACbD;IACF;EACF;AACF;AAZaN;AAcN,IAAMQ,mCAAN,cAA+CP,qBAAAA;EACpDC,SAASC,2BAA2BM;EAMpCJ,YAAY,EAAEK,UAAS,GAA2B;AAChD,UAAK;AACL,SAAKH,UAAU;MACbG;MACAC,aAAa;IACf;EACF;AACF;AAdaH;AAgBN,IAAMI,uBAAN,cAAmCX,qBAAAA;EACxCC,SAASC,2BAA2BU;EAapCR,YAAY,EACVM,aACAG,cAAa,GAWZ;AACD,UAAK;AACL,SAAKP,UAAU;MACbI;MACAG;IACF;EACF;AACF;AAlCaF;","names":["ResponseStatusCode","registerEnumType","name","BaseResponseStatus","code","Field","InterfaceType","resolveType","value","SuccessResponseStatus","FailedResponseStatus","PendingResponseStatus","undefined","ObjectType","implements","FailedResponseStatusReason","reason","details","GraphQLJSON","nullable","ResponseStatusUnion","createUnionType","types","GuardrailsValidationFailureResponse","FailedResponseStatus","reason","FailedResponseStatusReason","GUARDRAILS_VALIDATION_FAILED","constructor","guardrailsReason","details","MessageStreamInterruptedResponse","MESSAGE_STREAM_INTERRUPTED","messageId","description","UnknownErrorResponse","UNKNOWN_ERROR","originalError"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GuardrailsValidationFailureResponse,
|
|
3
|
+
MessageStreamInterruptedResponse,
|
|
4
|
+
UnknownErrorResponse
|
|
5
|
+
} from "../chunk-XWBDEXDA.mjs";
|
|
6
|
+
import "../chunk-FHD4JECV.mjs";
|
|
7
|
+
export {
|
|
8
|
+
GuardrailsValidationFailureResponse,
|
|
9
|
+
MessageStreamInterruptedResponse,
|
|
10
|
+
UnknownErrorResponse
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.50.0
|
|
12
|
+
"version": "1.50.0",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -50,11 +50,13 @@
|
|
|
50
50
|
"tsconfig": "1.4.6"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
53
|
+
"@ag-ui/client": "^0.0.42",
|
|
54
|
+
"@ag-ui/core": "^0.0.42",
|
|
55
|
+
"@ag-ui/langgraph": "^0.0.20",
|
|
56
|
+
"@copilotkitnext/agent": "0.0.31",
|
|
57
|
+
"@copilotkitnext/runtime": "0.0.31",
|
|
55
58
|
"@graphql-yoga/plugin-defer-stream": "^3.3.1",
|
|
56
59
|
"@hono/node-server": "^1.13.5",
|
|
57
|
-
"@langchain/core": "^0.3.38",
|
|
58
60
|
"@scarf/scarf": "^1.3.0",
|
|
59
61
|
"class-transformer": "^0.5.1",
|
|
60
62
|
"class-validator": "^0.14.1",
|
|
@@ -62,7 +64,6 @@
|
|
|
62
64
|
"graphql-scalars": "^1.23.0",
|
|
63
65
|
"graphql-yoga": "^5.3.1",
|
|
64
66
|
"hono": "^4.10.3",
|
|
65
|
-
"langchain": "^0.3.3",
|
|
66
67
|
"openai": "^4.85.1",
|
|
67
68
|
"partial-json": "^0.1.7",
|
|
68
69
|
"pino": "^9.2.0",
|
|
@@ -71,31 +72,24 @@
|
|
|
71
72
|
"rxjs": "7.8.1",
|
|
72
73
|
"type-graphql": "2.0.0-rc.1",
|
|
73
74
|
"zod": "^3.23.3",
|
|
74
|
-
"@copilotkit/shared": "1.50.0
|
|
75
|
+
"@copilotkit/shared": "1.50.0"
|
|
75
76
|
},
|
|
76
77
|
"peerDependencies": {
|
|
77
78
|
"@anthropic-ai/sdk": "^0.57.0",
|
|
78
|
-
"@
|
|
79
|
-
"@
|
|
80
|
-
"@
|
|
81
|
-
"@
|
|
82
|
-
"@
|
|
83
|
-
"@langchain/
|
|
84
|
-
"@langchain/community": "^0.3.58",
|
|
85
|
-
"@langchain/google-gauth": "^0.1.0",
|
|
86
|
-
"@langchain/langgraph-sdk": "^0.0.70",
|
|
87
|
-
"@langchain/openai": "^0.4.2",
|
|
79
|
+
"@langchain/aws": ">=0.1.9",
|
|
80
|
+
"@langchain/core": ">=0.3.66",
|
|
81
|
+
"@langchain/community": ">=0.3.58",
|
|
82
|
+
"@langchain/google-gauth": ">=0.1.0",
|
|
83
|
+
"@langchain/langgraph-sdk": ">=0.1.2",
|
|
84
|
+
"@langchain/openai": ">=0.4.2",
|
|
88
85
|
"groq-sdk": ">=0.3.0 <1.0.0",
|
|
89
|
-
"langchain": "
|
|
86
|
+
"langchain": ">=0.3.3",
|
|
90
87
|
"openai": "^4.85.1"
|
|
91
88
|
},
|
|
92
89
|
"peerDependenciesMeta": {
|
|
93
90
|
"@anthropic-ai/sdk": {
|
|
94
91
|
"optional": true
|
|
95
92
|
},
|
|
96
|
-
"@ag-ui/langgraph": {
|
|
97
|
-
"optional": true
|
|
98
|
-
},
|
|
99
93
|
"@langchain/aws": {
|
|
100
94
|
"optional": true
|
|
101
95
|
},
|
package/src/lib/index.ts
CHANGED
|
@@ -8,11 +8,12 @@ export * from "./integrations";
|
|
|
8
8
|
export * from "./logger";
|
|
9
9
|
export * from "./runtime/copilot-runtime";
|
|
10
10
|
export * from "./runtime/mcp-tools-utils";
|
|
11
|
+
export * from "./runtime/telemetry-agent-runner";
|
|
11
12
|
|
|
12
13
|
// The below re-exports "dummy" classes and types, to get a deprecation warning redirecting the users to import these from the correct, new route
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
* @deprecated LangGraphAgent import from
|
|
16
|
+
* @deprecated LangGraphAgent import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
|
|
16
17
|
*/
|
|
17
18
|
export class LangGraphAgent {
|
|
18
19
|
constructor() {
|
|
@@ -23,7 +24,7 @@ export class LangGraphAgent {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
|
-
* @deprecated LangGraphHttpAgent import from
|
|
27
|
+
* @deprecated LangGraphHttpAgent import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
|
|
27
28
|
*/
|
|
28
29
|
export class LangGraphHttpAgent {
|
|
29
30
|
constructor() {
|
|
@@ -34,18 +35,18 @@ export class LangGraphHttpAgent {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
|
-
* @deprecated TextMessageEvents import from
|
|
38
|
+
* @deprecated TextMessageEvents import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
|
|
38
39
|
*/
|
|
39
40
|
export type TextMessageEvents = any;
|
|
40
41
|
/**
|
|
41
|
-
* @deprecated ToolCallEvents import from
|
|
42
|
+
* @deprecated ToolCallEvents import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
|
|
42
43
|
*/
|
|
43
44
|
export type ToolCallEvents = any;
|
|
44
45
|
/**
|
|
45
|
-
* @deprecated CustomEventNames import from
|
|
46
|
+
* @deprecated CustomEventNames import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
|
|
46
47
|
*/
|
|
47
48
|
export type CustomEventNames = any;
|
|
48
49
|
/**
|
|
49
|
-
* @deprecated PredictStateTool import from
|
|
50
|
+
* @deprecated PredictStateTool import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
|
|
50
51
|
*/
|
|
51
52
|
export type PredictStateTool = any;
|
|
@@ -13,47 +13,50 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import {
|
|
16
|
-
Action,
|
|
17
|
-
CopilotErrorHandler,
|
|
16
|
+
type Action,
|
|
17
|
+
type CopilotErrorHandler,
|
|
18
18
|
CopilotKitMisuseError,
|
|
19
|
-
MaybePromise,
|
|
20
|
-
NonEmptyRecord,
|
|
21
|
-
Parameter,
|
|
19
|
+
type MaybePromise,
|
|
20
|
+
type NonEmptyRecord,
|
|
21
|
+
type Parameter,
|
|
22
22
|
readBody,
|
|
23
23
|
getZodParameters,
|
|
24
|
-
PartialBy,
|
|
24
|
+
type PartialBy,
|
|
25
|
+
isTelemetryDisabled,
|
|
25
26
|
} from "@copilotkit/shared";
|
|
26
|
-
import {
|
|
27
|
+
import type { RunAgentInput } from "@ag-ui/core";
|
|
27
28
|
import { aguiToGQL } from "../../graphql/message-conversion/agui-to-gql";
|
|
28
|
-
import { CopilotServiceAdapter, RemoteChainParameters } from "../../service-adapters";
|
|
29
|
+
import type { CopilotServiceAdapter, RemoteChainParameters } from "../../service-adapters";
|
|
29
30
|
import {
|
|
30
31
|
CopilotRuntime as CopilotRuntimeVNext,
|
|
31
|
-
CopilotRuntimeOptions,
|
|
32
|
-
CopilotRuntimeOptions as CopilotRuntimeOptionsVNext,
|
|
33
|
-
InMemoryAgentRunner
|
|
32
|
+
type CopilotRuntimeOptions,
|
|
33
|
+
type CopilotRuntimeOptions as CopilotRuntimeOptionsVNext,
|
|
34
|
+
InMemoryAgentRunner,
|
|
34
35
|
} from "@copilotkitnext/runtime";
|
|
36
|
+
import { TelemetryAgentRunner } from "./telemetry-agent-runner";
|
|
37
|
+
import telemetry from "../telemetry-client";
|
|
35
38
|
|
|
36
|
-
import { MessageInput } from "../../graphql/inputs/message.input";
|
|
37
|
-
import { Message } from "../../graphql/types/converted";
|
|
39
|
+
import type { MessageInput } from "../../graphql/inputs/message.input";
|
|
40
|
+
import type { Message } from "../../graphql/types/converted";
|
|
38
41
|
|
|
39
42
|
import {
|
|
40
43
|
EndpointType,
|
|
41
|
-
EndpointDefinition,
|
|
42
|
-
CopilotKitEndpoint,
|
|
43
|
-
LangGraphPlatformEndpoint,
|
|
44
|
+
type EndpointDefinition,
|
|
45
|
+
type CopilotKitEndpoint,
|
|
46
|
+
type LangGraphPlatformEndpoint,
|
|
44
47
|
} from "./types";
|
|
45
48
|
|
|
46
|
-
import { CopilotObservabilityConfig, LLMRequestData, LLMResponseData } from "../observability";
|
|
47
|
-
import { AbstractAgent } from "@ag-ui/client";
|
|
49
|
+
import type { CopilotObservabilityConfig, LLMRequestData, LLMResponseData } from "../observability";
|
|
50
|
+
import type { AbstractAgent } from "@ag-ui/client";
|
|
48
51
|
|
|
49
52
|
// +++ MCP Imports +++
|
|
50
53
|
import {
|
|
51
|
-
MCPClient,
|
|
52
|
-
MCPEndpointConfig,
|
|
53
|
-
MCPTool,
|
|
54
|
+
type MCPClient,
|
|
55
|
+
type MCPEndpointConfig,
|
|
56
|
+
type MCPTool,
|
|
54
57
|
extractParametersFromSchema,
|
|
55
58
|
} from "./mcp-tools-utils";
|
|
56
|
-
import { BasicAgent, BasicAgentConfiguration } from "@copilotkitnext/agent";
|
|
59
|
+
import { BasicAgent, type BasicAgentConfiguration } from "@copilotkitnext/agent";
|
|
57
60
|
// Define the function type alias here or import if defined elsewhere
|
|
58
61
|
type CreateMCPClientFunction = (config: MCPEndpointConfig) => Promise<MCPClient>;
|
|
59
62
|
|
|
@@ -308,9 +311,19 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
308
311
|
const agents = params?.agents ?? {};
|
|
309
312
|
const endpointAgents = this.assignEndpointsToAgents(params?.remoteEndpoints ?? []);
|
|
310
313
|
|
|
314
|
+
// Determine the base runner (user-provided or default)
|
|
315
|
+
const baseRunner = params?.runner ?? new InMemoryAgentRunner();
|
|
316
|
+
|
|
317
|
+
// Wrap with TelemetryAgentRunner unless telemetry is disabled
|
|
318
|
+
// This ensures we always capture agent execution telemetry when enabled,
|
|
319
|
+
// even if the user provides their own custom runner
|
|
320
|
+
const runner = isTelemetryDisabled()
|
|
321
|
+
? baseRunner
|
|
322
|
+
: new TelemetryAgentRunner({ runner: baseRunner });
|
|
323
|
+
|
|
311
324
|
this.runtimeArgs = {
|
|
312
325
|
agents: { ...endpointAgents, ...agents },
|
|
313
|
-
runner
|
|
326
|
+
runner,
|
|
314
327
|
// TODO: add support for transcriptionService from CopilotRuntimeOptionsVNext once it is ready
|
|
315
328
|
// transcriptionService: params?.transcriptionService,
|
|
316
329
|
|
|
@@ -372,10 +385,11 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
372
385
|
});
|
|
373
386
|
}
|
|
374
387
|
|
|
375
|
-
|
|
388
|
+
const actions = this.params?.actions;
|
|
389
|
+
if (actions) {
|
|
376
390
|
const mcpTools = await this.getToolsFromMCP();
|
|
377
391
|
agentsList = this.assignToolsToAgents(agents, [
|
|
378
|
-
...this.getToolsFromActions(
|
|
392
|
+
...this.getToolsFromActions(actions),
|
|
379
393
|
...mcpTools,
|
|
380
394
|
]);
|
|
381
395
|
}
|
|
@@ -437,6 +451,29 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
437
451
|
params?: CopilotRuntimeConstructorParams<T> & PartialBy<CopilotRuntimeOptions, "agents">,
|
|
438
452
|
) {
|
|
439
453
|
return async (hookParams: BeforeRequestMiddlewareFnParameters[0]) => {
|
|
454
|
+
const { request } = hookParams;
|
|
455
|
+
|
|
456
|
+
// Capture telemetry for copilot request creation
|
|
457
|
+
const publicApiKey = request.headers.get("x-copilotcloud-public-api-key");
|
|
458
|
+
const body = (await readBody(request)) as RunAgentInput;
|
|
459
|
+
const forwardedProps = body.forwardedProps as
|
|
460
|
+
| {
|
|
461
|
+
cloud?: { guardrails?: unknown };
|
|
462
|
+
metadata?: { requestType?: string };
|
|
463
|
+
}
|
|
464
|
+
| undefined;
|
|
465
|
+
|
|
466
|
+
// Get cloud base URL from environment or default
|
|
467
|
+
const cloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL || "https://api.cloud.copilotkit.ai";
|
|
468
|
+
|
|
469
|
+
telemetry.capture("oss.runtime.copilot_request_created", {
|
|
470
|
+
"cloud.guardrails.enabled": forwardedProps?.cloud?.guardrails !== undefined,
|
|
471
|
+
requestType: forwardedProps?.metadata?.requestType ?? "unknown",
|
|
472
|
+
"cloud.api_key_provided": !!publicApiKey,
|
|
473
|
+
...(publicApiKey ? { "cloud.public_api_key": publicApiKey } : {}),
|
|
474
|
+
"cloud.base_url": cloudBaseUrl,
|
|
475
|
+
});
|
|
476
|
+
|
|
440
477
|
// TODO: get public api key and run with expected data
|
|
441
478
|
// if (this.observability?.enabled && this.params.publicApiKey) {
|
|
442
479
|
// this.logObservabilityBeforeRequest()
|
|
@@ -447,7 +484,6 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
447
484
|
|
|
448
485
|
if (params?.middleware?.onBeforeRequest) {
|
|
449
486
|
const { request, runtime, path } = hookParams;
|
|
450
|
-
const body = (await readBody(request)) as RunAgentInput;
|
|
451
487
|
const gqlMessages = (aguiToGQL(body.messages) as Message[]).reduce(
|
|
452
488
|
(acc, msg) => {
|
|
453
489
|
if ("role" in msg && msg.role === "user") {
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TelemetryAgentRunner - A wrapper around AgentRunner that adds telemetry
|
|
3
|
+
* for agent execution streams.
|
|
4
|
+
*
|
|
5
|
+
* This captures the following telemetry events:
|
|
6
|
+
* - oss.runtime.agent_execution_stream_started - when an agent execution starts
|
|
7
|
+
* - oss.runtime.agent_execution_stream_ended - when an agent execution completes
|
|
8
|
+
* - oss.runtime.agent_execution_stream_errored - when an agent execution fails
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { type AgentRunner, InMemoryAgentRunner } from "@copilotkitnext/runtime";
|
|
12
|
+
import { createHash } from "node:crypto";
|
|
13
|
+
import { tap, catchError, finalize } from "rxjs";
|
|
14
|
+
import telemetry from "../telemetry-client";
|
|
15
|
+
import type { AgentExecutionResponseInfo } from "@copilotkit/shared/src/telemetry/events";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Configuration options for TelemetryAgentRunner
|
|
19
|
+
*/
|
|
20
|
+
export interface TelemetryAgentRunnerConfig {
|
|
21
|
+
/**
|
|
22
|
+
* The underlying runner to delegate to
|
|
23
|
+
* If not provided, defaults to InMemoryAgentRunner
|
|
24
|
+
*/
|
|
25
|
+
runner?: AgentRunner;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Optional LangSmith API key (will be hashed for telemetry)
|
|
29
|
+
*/
|
|
30
|
+
langsmithApiKey?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* An AgentRunner wrapper that adds telemetry tracking for agent executions.
|
|
35
|
+
*
|
|
36
|
+
* Usage:
|
|
37
|
+
* ```ts
|
|
38
|
+
* const runtime = new CopilotRuntime({
|
|
39
|
+
* runner: new TelemetryAgentRunner(),
|
|
40
|
+
* // or with custom runner:
|
|
41
|
+
* runner: new TelemetryAgentRunner({ runner: customRunner }),
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export class TelemetryAgentRunner implements AgentRunner {
|
|
46
|
+
private readonly _runner: AgentRunner;
|
|
47
|
+
private readonly hashedLgcKey: string | undefined;
|
|
48
|
+
|
|
49
|
+
constructor(config?: TelemetryAgentRunnerConfig) {
|
|
50
|
+
this._runner = config?.runner ?? new InMemoryAgentRunner();
|
|
51
|
+
this.hashedLgcKey = config?.langsmithApiKey
|
|
52
|
+
? createHash("sha256").update(config.langsmithApiKey).digest("hex")
|
|
53
|
+
: undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Runs an agent with telemetry tracking.
|
|
58
|
+
* Wraps the underlying runner's Observable stream with telemetry events.
|
|
59
|
+
*/
|
|
60
|
+
run(...args: Parameters<AgentRunner["run"]>): ReturnType<AgentRunner["run"]> {
|
|
61
|
+
const streamInfo: AgentExecutionResponseInfo = {
|
|
62
|
+
hashedLgcKey: this.hashedLgcKey,
|
|
63
|
+
};
|
|
64
|
+
let streamErrored = false;
|
|
65
|
+
|
|
66
|
+
// Capture stream started event
|
|
67
|
+
telemetry.capture("oss.runtime.agent_execution_stream_started", {
|
|
68
|
+
hashedLgcKey: this.hashedLgcKey,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Delegate to the underlying runner and wrap with telemetry
|
|
72
|
+
return this._runner.run(...args).pipe(
|
|
73
|
+
// Extract metadata from events if available
|
|
74
|
+
tap((event) => {
|
|
75
|
+
// Try to extract provider/model info from raw events
|
|
76
|
+
const rawEvent = (
|
|
77
|
+
event as {
|
|
78
|
+
rawEvent?: { metadata?: Record<string, unknown>; data?: Record<string, unknown> };
|
|
79
|
+
}
|
|
80
|
+
).rawEvent;
|
|
81
|
+
if (rawEvent?.data) {
|
|
82
|
+
const data = rawEvent.data as { output?: { model?: string } };
|
|
83
|
+
if (data?.output?.model) {
|
|
84
|
+
streamInfo.model = data.output.model;
|
|
85
|
+
streamInfo.provider = data.output.model;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (rawEvent?.metadata) {
|
|
89
|
+
const metadata = rawEvent.metadata as {
|
|
90
|
+
langgraph_host?: string;
|
|
91
|
+
langgraph_version?: string;
|
|
92
|
+
};
|
|
93
|
+
if (metadata?.langgraph_host) {
|
|
94
|
+
streamInfo.langGraphHost = metadata.langgraph_host;
|
|
95
|
+
}
|
|
96
|
+
if (metadata?.langgraph_version) {
|
|
97
|
+
streamInfo.langGraphVersion = metadata.langgraph_version;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}),
|
|
101
|
+
catchError((error) => {
|
|
102
|
+
// Capture stream error event
|
|
103
|
+
streamErrored = true;
|
|
104
|
+
telemetry.capture("oss.runtime.agent_execution_stream_errored", {
|
|
105
|
+
...streamInfo,
|
|
106
|
+
error: error instanceof Error ? error.message : String(error),
|
|
107
|
+
});
|
|
108
|
+
throw error;
|
|
109
|
+
}),
|
|
110
|
+
finalize(() => {
|
|
111
|
+
// Capture stream ended event (only if not errored)
|
|
112
|
+
if (!streamErrored) {
|
|
113
|
+
telemetry.capture("oss.runtime.agent_execution_stream_ended", streamInfo);
|
|
114
|
+
}
|
|
115
|
+
}),
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Delegates to the underlying runner's connect method
|
|
121
|
+
*/
|
|
122
|
+
connect(...args: Parameters<AgentRunner["connect"]>): ReturnType<AgentRunner["connect"]> {
|
|
123
|
+
return this._runner.connect(...args);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Delegates to the underlying runner's isRunning method
|
|
128
|
+
*/
|
|
129
|
+
isRunning(...args: Parameters<AgentRunner["isRunning"]>): ReturnType<AgentRunner["isRunning"]> {
|
|
130
|
+
return this._runner.isRunning(...args);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Delegates to the underlying runner's stop method
|
|
135
|
+
*/
|
|
136
|
+
stop(...args: Parameters<AgentRunner["stop"]>): ReturnType<AgentRunner["stop"]> {
|
|
137
|
+
return this._runner.stop(...args);
|
|
138
|
+
}
|
|
139
|
+
}
|