@copilotkitnext/runtime 1.54.1-next.1 → 1.54.1-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/endpoints/express.cjs +11 -0
- package/dist/endpoints/express.cjs.map +1 -1
- package/dist/endpoints/express.d.cts.map +1 -1
- package/dist/endpoints/express.d.mts.map +1 -1
- package/dist/endpoints/express.mjs +11 -0
- package/dist/endpoints/express.mjs.map +1 -1
- package/dist/endpoints/hono.cjs +13 -1
- package/dist/endpoints/hono.cjs.map +1 -1
- package/dist/endpoints/hono.d.cts.map +1 -1
- package/dist/endpoints/hono.d.mts.map +1 -1
- package/dist/endpoints/hono.mjs +13 -1
- package/dist/endpoints/hono.mjs.map +1 -1
- package/dist/handlers/handle-connect.cjs +8 -0
- package/dist/handlers/handle-connect.cjs.map +1 -1
- package/dist/handlers/handle-connect.mjs +8 -0
- package/dist/handlers/handle-connect.mjs.map +1 -1
- package/dist/handlers/handle-run.cjs +8 -0
- package/dist/handlers/handle-run.cjs.map +1 -1
- package/dist/handlers/handle-run.mjs +8 -0
- package/dist/handlers/handle-run.mjs.map +1 -1
- package/dist/handlers/intelligence/run.cjs +20 -9
- package/dist/handlers/intelligence/run.cjs.map +1 -1
- package/dist/handlers/intelligence/run.mjs +20 -9
- package/dist/handlers/intelligence/run.mjs.map +1 -1
- package/dist/handlers/intelligence/thread-names.cjs +2 -1
- package/dist/handlers/intelligence/thread-names.cjs.map +1 -1
- package/dist/handlers/intelligence/thread-names.mjs +2 -1
- package/dist/handlers/intelligence/thread-names.mjs.map +1 -1
- package/dist/handlers/intelligence/threads.cjs +52 -34
- package/dist/handlers/intelligence/threads.cjs.map +1 -1
- package/dist/handlers/intelligence/threads.mjs +52 -34
- package/dist/handlers/intelligence/threads.mjs.map +1 -1
- package/dist/handlers/shared/json-response.cjs +4 -0
- package/dist/handlers/shared/json-response.cjs.map +1 -1
- package/dist/handlers/shared/json-response.mjs +4 -1
- package/dist/handlers/shared/json-response.mjs.map +1 -1
- package/dist/handlers/shared/resolve-intelligence-user.cjs +19 -0
- package/dist/handlers/shared/resolve-intelligence-user.cjs.map +1 -0
- package/dist/handlers/shared/resolve-intelligence-user.mjs +19 -0
- package/dist/handlers/shared/resolve-intelligence-user.mjs.map +1 -0
- package/dist/handlers/shared/sse-response.cjs +7 -1
- package/dist/handlers/shared/sse-response.cjs.map +1 -1
- package/dist/handlers/shared/sse-response.mjs +7 -1
- package/dist/handlers/shared/sse-response.mjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/runtime.cjs +5 -0
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +11 -1
- package/dist/runtime.d.cts.map +1 -1
- package/dist/runtime.d.mts +11 -1
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +5 -0
- package/dist/runtime.mjs.map +1 -1
- package/dist/telemetry/index.cjs +1 -0
- package/dist/telemetry/index.mjs +3 -0
- package/dist/telemetry/scarf-client.cjs +29 -0
- package/dist/telemetry/scarf-client.cjs.map +1 -0
- package/dist/telemetry/scarf-client.mjs +29 -0
- package/dist/telemetry/scarf-client.mjs.map +1 -0
- package/dist/telemetry/telemetry-client.cjs +36 -0
- package/dist/telemetry/telemetry-client.cjs.map +1 -0
- package/dist/telemetry/telemetry-client.mjs +34 -0
- package/dist/telemetry/telemetry-client.mjs.map +1 -0
- package/package.json +6 -5
- package/vitest.config.mjs +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threads.mjs","names":[],"sources":["../../../src/handlers/intelligence/threads.ts"],"sourcesContent":["import {\n CopilotIntelligenceRuntimeLike,\n CopilotRuntimeLike,\n isIntelligenceRuntime,\n} from \"../../runtime\";\nimport { logger } from \"@copilotkitnext/shared\";\nimport { errorResponse } from \"../shared/json-response\";\nimport { isValidIdentifier } from \"../shared/intelligence-utils\";\n\ninterface ThreadsHandlerParams {\n runtime: CopilotRuntimeLike;\n request: Request;\n}\n\ninterface ThreadMutationParams extends ThreadsHandlerParams {\n threadId: string;\n}\n\nasync function parseJsonBody(\n request: Request,\n): Promise<Record<string, unknown> | Response> {\n try {\n return (await request.json()) as Record<string, unknown>;\n } catch (error) {\n logger.error({ err: error }, \"Malformed JSON in request body\");\n return errorResponse(\"Invalid request body\", 400);\n }\n}\n\nfunction requireIntelligenceRuntime(\n runtime: CopilotRuntimeLike,\n): CopilotIntelligenceRuntimeLike | Response {\n if (!isIntelligenceRuntime(runtime)) {\n return errorResponse(\n \"Missing CopilotKitIntelligence configuration. Thread operations require a CopilotKitIntelligence instance to be provided in CopilotRuntime options.\",\n 422,\n );\n }\n\n return runtime;\n}\n\nexport async function handleListThreads({\n runtime,\n request,\n}: ThreadsHandlerParams): Promise<Response> {\n const intelligenceRuntime = requireIntelligenceRuntime(runtime);\n if (intelligenceRuntime
|
|
1
|
+
{"version":3,"file":"threads.mjs","names":[],"sources":["../../../src/handlers/intelligence/threads.ts"],"sourcesContent":["import {\n CopilotIntelligenceRuntimeLike,\n CopilotRuntimeLike,\n isIntelligenceRuntime,\n} from \"../../runtime\";\nimport { logger } from \"@copilotkitnext/shared\";\nimport { errorResponse, isHandlerResponse } from \"../shared/json-response\";\nimport { isValidIdentifier } from \"../shared/intelligence-utils\";\nimport { resolveIntelligenceUser } from \"../shared/resolve-intelligence-user\";\n\ninterface ThreadsHandlerParams {\n runtime: CopilotRuntimeLike;\n request: Request;\n}\n\ninterface ThreadMutationParams extends ThreadsHandlerParams {\n threadId: string;\n}\n\ninterface ThreadMutationContext {\n userId: string;\n agentId: string;\n body: Record<string, unknown>;\n}\n\nasync function parseJsonBody(\n request: Request,\n): Promise<Record<string, unknown> | Response> {\n try {\n return (await request.json()) as Record<string, unknown>;\n } catch (error) {\n logger.error({ err: error }, \"Malformed JSON in request body\");\n return errorResponse(\"Invalid request body\", 400);\n }\n}\n\nfunction requireIntelligenceRuntime(\n runtime: CopilotRuntimeLike,\n): CopilotIntelligenceRuntimeLike | Response {\n if (!isIntelligenceRuntime(runtime)) {\n return errorResponse(\n \"Missing CopilotKitIntelligence configuration. Thread operations require a CopilotKitIntelligence instance to be provided in CopilotRuntime options.\",\n 422,\n );\n }\n\n return runtime;\n}\n\nasync function resolveThreadMutationContext(\n runtime: CopilotIntelligenceRuntimeLike,\n request: Request,\n): Promise<ThreadMutationContext | Response> {\n const body = await parseJsonBody(request);\n if (isHandlerResponse(body)) return body;\n\n const user = await resolveIntelligenceUser({ runtime, request });\n if (isHandlerResponse(user)) return user;\n\n const agentId = body.agentId;\n if (!isValidIdentifier(agentId)) {\n return errorResponse(\"Valid agentId is required\", 400);\n }\n\n return {\n body,\n userId: user.id,\n agentId,\n };\n}\n\nexport async function handleListThreads({\n runtime,\n request,\n}: ThreadsHandlerParams): Promise<Response> {\n const intelligenceRuntime = requireIntelligenceRuntime(runtime);\n if (isHandlerResponse(intelligenceRuntime)) {\n return intelligenceRuntime;\n }\n\n try {\n const url = new URL(request.url);\n const agentId = url.searchParams.get(\"agentId\");\n const user = await resolveIntelligenceUser({\n runtime: intelligenceRuntime,\n request,\n });\n if (isHandlerResponse(user)) return user;\n\n if (!isValidIdentifier(agentId)) {\n return errorResponse(\"Valid agentId query param is required\", 400);\n }\n\n const data = await intelligenceRuntime.intelligence.listThreads({\n userId: user.id,\n agentId,\n });\n\n return Response.json(data);\n } catch (error) {\n logger.error({ err: error }, \"Error listing threads\");\n return errorResponse(\"Failed to list threads\", 500);\n }\n}\n\nexport async function handleUpdateThread({\n runtime,\n request,\n threadId,\n}: ThreadMutationParams): Promise<Response> {\n const intelligenceRuntime = requireIntelligenceRuntime(runtime);\n if (isHandlerResponse(intelligenceRuntime)) {\n return intelligenceRuntime;\n }\n\n try {\n const mutation = await resolveThreadMutationContext(\n intelligenceRuntime,\n request,\n );\n if (isHandlerResponse(mutation)) return mutation;\n\n const updates = { ...mutation.body };\n delete updates.agentId;\n delete updates.userId;\n\n const thread = await intelligenceRuntime.intelligence.updateThread({\n threadId,\n userId: mutation.userId,\n agentId: mutation.agentId,\n updates,\n });\n\n return Response.json(thread);\n } catch (error) {\n logger.error({ err: error, threadId }, \"Error updating thread\");\n return errorResponse(\"Failed to update thread\", 500);\n }\n}\n\nexport async function handleSubscribeToThreads({\n runtime,\n request,\n}: ThreadsHandlerParams): Promise<Response> {\n const intelligenceRuntime = requireIntelligenceRuntime(runtime);\n if (isHandlerResponse(intelligenceRuntime)) {\n return intelligenceRuntime;\n }\n\n try {\n const user = await resolveIntelligenceUser({\n runtime: intelligenceRuntime,\n request,\n });\n if (isHandlerResponse(user)) return user;\n\n const credentials =\n await intelligenceRuntime.intelligence.ɵsubscribeToThreads({\n userId: user.id,\n });\n\n return Response.json({ joinToken: credentials.joinToken });\n } catch (error) {\n logger.error({ err: error }, \"Error subscribing to threads\");\n return errorResponse(\"Failed to subscribe to threads\", 500);\n }\n}\n\nexport async function handleArchiveThread({\n runtime,\n request,\n threadId,\n}: ThreadMutationParams): Promise<Response> {\n const intelligenceRuntime = requireIntelligenceRuntime(runtime);\n if (isHandlerResponse(intelligenceRuntime)) {\n return intelligenceRuntime;\n }\n\n try {\n const mutation = await resolveThreadMutationContext(\n intelligenceRuntime,\n request,\n );\n if (isHandlerResponse(mutation)) return mutation;\n\n await intelligenceRuntime.intelligence.archiveThread({\n threadId,\n userId: mutation.userId,\n agentId: mutation.agentId,\n });\n\n return Response.json({ threadId, archived: true });\n } catch (error) {\n logger.error({ err: error, threadId }, \"Error archiving thread\");\n return errorResponse(\"Failed to archive thread\", 500);\n }\n}\n\nexport async function handleDeleteThread({\n runtime,\n request,\n threadId,\n}: ThreadMutationParams): Promise<Response> {\n const intelligenceRuntime = requireIntelligenceRuntime(runtime);\n if (isHandlerResponse(intelligenceRuntime)) {\n return intelligenceRuntime;\n }\n\n try {\n const mutation = await resolveThreadMutationContext(\n intelligenceRuntime,\n request,\n );\n if (isHandlerResponse(mutation)) return mutation;\n\n await intelligenceRuntime.intelligence.deleteThread({\n threadId,\n userId: mutation.userId,\n agentId: mutation.agentId,\n });\n\n return Response.json({ threadId, deleted: true });\n } catch (error) {\n logger.error({ err: error, threadId }, \"Error deleting thread\");\n return errorResponse(\"Failed to delete thread\", 500);\n }\n}\n"],"mappings":";;;;;;;AAyBA,eAAe,cACb,SAC6C;AAC7C,KAAI;AACF,SAAQ,MAAM,QAAQ,MAAM;UACrB,OAAO;AACd,SAAO,MAAM,EAAE,KAAK,OAAO,EAAE,iCAAiC;AAC9D,SAAO,cAAc,wBAAwB,IAAI;;;AAIrD,SAAS,2BACP,SAC2C;AAC3C,KAAI,CAAC,sBAAsB,QAAQ,CACjC,QAAO,cACL,uJACA,IACD;AAGH,QAAO;;AAGT,eAAe,6BACb,SACA,SAC2C;CAC3C,MAAM,OAAO,MAAM,cAAc,QAAQ;AACzC,KAAI,kBAAkB,KAAK,CAAE,QAAO;CAEpC,MAAM,OAAO,MAAM,wBAAwB;EAAE;EAAS;EAAS,CAAC;AAChE,KAAI,kBAAkB,KAAK,CAAE,QAAO;CAEpC,MAAM,UAAU,KAAK;AACrB,KAAI,CAAC,kBAAkB,QAAQ,CAC7B,QAAO,cAAc,6BAA6B,IAAI;AAGxD,QAAO;EACL;EACA,QAAQ,KAAK;EACb;EACD;;AAGH,eAAsB,kBAAkB,EACtC,SACA,WAC0C;CAC1C,MAAM,sBAAsB,2BAA2B,QAAQ;AAC/D,KAAI,kBAAkB,oBAAoB,CACxC,QAAO;AAGT,KAAI;EAEF,MAAM,UADM,IAAI,IAAI,QAAQ,IAAI,CACZ,aAAa,IAAI,UAAU;EAC/C,MAAM,OAAO,MAAM,wBAAwB;GACzC,SAAS;GACT;GACD,CAAC;AACF,MAAI,kBAAkB,KAAK,CAAE,QAAO;AAEpC,MAAI,CAAC,kBAAkB,QAAQ,CAC7B,QAAO,cAAc,yCAAyC,IAAI;EAGpE,MAAM,OAAO,MAAM,oBAAoB,aAAa,YAAY;GAC9D,QAAQ,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AAI,kBAAkB,oBAAoB,CACxC,QAAO;AAGT,KAAI;EACF,MAAM,WAAW,MAAM,6BACrB,qBACA,QACD;AACD,MAAI,kBAAkB,SAAS,CAAE,QAAO;AAExC,QAAM,oBAAoB,aAAa,cAAc;GACnD;GACA,QAAQ,SAAS;GACjB,SAAS,SAAS;GACnB,CAAC;AAEF,SAAO,SAAS,KAAK;GAAE;GAAU,UAAU;GAAM,CAAC;UAC3C,OAAO;AACd,SAAO,MAAM;GAAE,KAAK;GAAO;GAAU,EAAE,yBAAyB;AAChE,SAAO,cAAc,4BAA4B,IAAI;;;AAIzD,eAAsB,mBAAmB,EACvC,SACA,SACA,YAC0C;CAC1C,MAAM,sBAAsB,2BAA2B,QAAQ;AAC/D,KAAI,kBAAkB,oBAAoB,CACxC,QAAO;AAGT,KAAI;EACF,MAAM,WAAW,MAAM,6BACrB,qBACA,QACD;AACD,MAAI,kBAAkB,SAAS,CAAE,QAAO;AAExC,QAAM,oBAAoB,aAAa,aAAa;GAClD;GACA,QAAQ,SAAS;GACjB,SAAS,SAAS;GACnB,CAAC;AAEF,SAAO,SAAS,KAAK;GAAE;GAAU,SAAS;GAAM,CAAC;UAC1C,OAAO;AACd,SAAO,MAAM;GAAE,KAAK;GAAO;GAAU,EAAE,wBAAwB;AAC/D,SAAO,cAAc,2BAA2B,IAAI"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/handlers/shared/json-response.ts
|
|
3
3
|
const errorResponse = (message, status) => Response.json({ error: message }, { status });
|
|
4
|
+
function isHandlerResponse(value) {
|
|
5
|
+
return value instanceof Response;
|
|
6
|
+
}
|
|
4
7
|
|
|
5
8
|
//#endregion
|
|
6
9
|
exports.errorResponse = errorResponse;
|
|
10
|
+
exports.isHandlerResponse = isHandlerResponse;
|
|
7
11
|
//# sourceMappingURL=json-response.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-response.cjs","names":[],"sources":["../../../src/handlers/shared/json-response.ts"],"sourcesContent":["export const errorResponse = (message: string, status: number) =>\n Response.json({ error: message }, { status });\n"],"mappings":";;AAAA,MAAa,iBAAiB,SAAiB,WAC7C,SAAS,KAAK,EAAE,OAAO,SAAS,EAAE,EAAE,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"json-response.cjs","names":[],"sources":["../../../src/handlers/shared/json-response.ts"],"sourcesContent":["export const errorResponse = (message: string, status: number) =>\n Response.json({ error: message }, { status });\n\nexport function isHandlerResponse(value: unknown): value is Response {\n return value instanceof Response;\n}\n"],"mappings":";;AAAA,MAAa,iBAAiB,SAAiB,WAC7C,SAAS,KAAK,EAAE,OAAO,SAAS,EAAE,EAAE,QAAQ,CAAC;AAE/C,SAAgB,kBAAkB,OAAmC;AACnE,QAAO,iBAAiB"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
//#region src/handlers/shared/json-response.ts
|
|
2
2
|
const errorResponse = (message, status) => Response.json({ error: message }, { status });
|
|
3
|
+
function isHandlerResponse(value) {
|
|
4
|
+
return value instanceof Response;
|
|
5
|
+
}
|
|
3
6
|
|
|
4
7
|
//#endregion
|
|
5
|
-
export { errorResponse };
|
|
8
|
+
export { errorResponse, isHandlerResponse };
|
|
6
9
|
//# sourceMappingURL=json-response.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-response.mjs","names":[],"sources":["../../../src/handlers/shared/json-response.ts"],"sourcesContent":["export const errorResponse = (message: string, status: number) =>\n Response.json({ error: message }, { status });\n"],"mappings":";AAAA,MAAa,iBAAiB,SAAiB,WAC7C,SAAS,KAAK,EAAE,OAAO,SAAS,EAAE,EAAE,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"json-response.mjs","names":[],"sources":["../../../src/handlers/shared/json-response.ts"],"sourcesContent":["export const errorResponse = (message: string, status: number) =>\n Response.json({ error: message }, { status });\n\nexport function isHandlerResponse(value: unknown): value is Response {\n return value instanceof Response;\n}\n"],"mappings":";AAAA,MAAa,iBAAiB,SAAiB,WAC7C,SAAS,KAAK,EAAE,OAAO,SAAS,EAAE,EAAE,QAAQ,CAAC;AAE/C,SAAgB,kBAAkB,OAAmC;AACnE,QAAO,iBAAiB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const require_json_response = require('./json-response.cjs');
|
|
2
|
+
const require_intelligence_utils = require('./intelligence-utils.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/handlers/shared/resolve-intelligence-user.ts
|
|
5
|
+
async function resolveIntelligenceUser(params) {
|
|
6
|
+
const { runtime, request } = params;
|
|
7
|
+
try {
|
|
8
|
+
const user = await runtime.identifyUser(request);
|
|
9
|
+
if (!require_intelligence_utils.isValidIdentifier(user?.id)) return require_json_response.errorResponse("identifyUser must return a valid user id", 400);
|
|
10
|
+
return { id: user.id };
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error("Error identifying intelligence user:", error);
|
|
13
|
+
return require_json_response.errorResponse("Failed to identify user", 500);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.resolveIntelligenceUser = resolveIntelligenceUser;
|
|
19
|
+
//# sourceMappingURL=resolve-intelligence-user.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-intelligence-user.cjs","names":["isValidIdentifier","errorResponse"],"sources":["../../../src/handlers/shared/resolve-intelligence-user.ts"],"sourcesContent":["import {\n CopilotIntelligenceRuntimeLike,\n CopilotRuntimeUser,\n} from \"../../runtime\";\nimport { errorResponse } from \"./json-response\";\nimport { isValidIdentifier } from \"./intelligence-utils\";\n\nexport async function resolveIntelligenceUser(params: {\n runtime: CopilotIntelligenceRuntimeLike;\n request: Request;\n}): Promise<CopilotRuntimeUser | Response> {\n const { runtime, request } = params;\n\n try {\n const user = await runtime.identifyUser(request);\n if (!isValidIdentifier(user?.id)) {\n return errorResponse(\"identifyUser must return a valid user id\", 400);\n }\n\n return { id: user.id };\n } catch (error) {\n console.error(\"Error identifying intelligence user:\", error);\n return errorResponse(\"Failed to identify user\", 500);\n }\n}\n"],"mappings":";;;;AAOA,eAAsB,wBAAwB,QAGH;CACzC,MAAM,EAAE,SAAS,YAAY;AAE7B,KAAI;EACF,MAAM,OAAO,MAAM,QAAQ,aAAa,QAAQ;AAChD,MAAI,CAACA,6CAAkB,MAAM,GAAG,CAC9B,QAAOC,oCAAc,4CAA4C,IAAI;AAGvE,SAAO,EAAE,IAAI,KAAK,IAAI;UACf,OAAO;AACd,UAAQ,MAAM,wCAAwC,MAAM;AAC5D,SAAOA,oCAAc,2BAA2B,IAAI"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { errorResponse } from "./json-response.mjs";
|
|
2
|
+
import { isValidIdentifier } from "./intelligence-utils.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/handlers/shared/resolve-intelligence-user.ts
|
|
5
|
+
async function resolveIntelligenceUser(params) {
|
|
6
|
+
const { runtime, request } = params;
|
|
7
|
+
try {
|
|
8
|
+
const user = await runtime.identifyUser(request);
|
|
9
|
+
if (!isValidIdentifier(user?.id)) return errorResponse("identifyUser must return a valid user id", 400);
|
|
10
|
+
return { id: user.id };
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error("Error identifying intelligence user:", error);
|
|
13
|
+
return errorResponse("Failed to identify user", 500);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { resolveIntelligenceUser };
|
|
19
|
+
//# sourceMappingURL=resolve-intelligence-user.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-intelligence-user.mjs","names":[],"sources":["../../../src/handlers/shared/resolve-intelligence-user.ts"],"sourcesContent":["import {\n CopilotIntelligenceRuntimeLike,\n CopilotRuntimeUser,\n} from \"../../runtime\";\nimport { errorResponse } from \"./json-response\";\nimport { isValidIdentifier } from \"./intelligence-utils\";\n\nexport async function resolveIntelligenceUser(params: {\n runtime: CopilotIntelligenceRuntimeLike;\n request: Request;\n}): Promise<CopilotRuntimeUser | Response> {\n const { runtime, request } = params;\n\n try {\n const user = await runtime.identifyUser(request);\n if (!isValidIdentifier(user?.id)) {\n return errorResponse(\"identifyUser must return a valid user id\", 400);\n }\n\n return { id: user.id };\n } catch (error) {\n console.error(\"Error identifying intelligence user:\", error);\n return errorResponse(\"Failed to identify user\", 500);\n }\n}\n"],"mappings":";;;;AAOA,eAAsB,wBAAwB,QAGH;CACzC,MAAM,EAAE,SAAS,YAAY;AAE7B,KAAI;EACF,MAAM,OAAO,MAAM,QAAQ,aAAa,QAAQ;AAChD,MAAI,CAAC,kBAAkB,MAAM,GAAG,CAC9B,QAAO,cAAc,4CAA4C,IAAI;AAGvE,SAAO,EAAE,IAAI,KAAK,IAAI;UACf,OAAO;AACd,UAAQ,MAAM,wCAAwC,MAAM;AAC5D,SAAO,cAAc,2BAA2B,IAAI"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_telemetry_client = require('../../telemetry/telemetry-client.cjs');
|
|
3
|
+
require('../../telemetry/index.cjs');
|
|
2
4
|
let _ag_ui_encoder = require("@ag-ui/encoder");
|
|
3
5
|
|
|
4
6
|
//#region src/handlers/shared/sse-response.ts
|
|
@@ -24,7 +26,9 @@ function createSseEventResponse({ request, observableFactory }) {
|
|
|
24
26
|
};
|
|
25
27
|
let subscription;
|
|
26
28
|
(async () => {
|
|
27
|
-
|
|
29
|
+
const observable = await observableFactory();
|
|
30
|
+
require_telemetry_client.default.capture("oss.runtime.agent_execution_stream_started", {});
|
|
31
|
+
subscription = observable.subscribe({
|
|
28
32
|
next: async (event) => {
|
|
29
33
|
if (!request.signal.aborted && !streamClosed) try {
|
|
30
34
|
await writer.write(encoder.encode(event));
|
|
@@ -33,10 +37,12 @@ function createSseEventResponse({ request, observableFactory }) {
|
|
|
33
37
|
}
|
|
34
38
|
},
|
|
35
39
|
error: async (error) => {
|
|
40
|
+
require_telemetry_client.default.capture("oss.runtime.agent_execution_stream_errored", { error: error instanceof Error ? error.message : String(error) });
|
|
36
41
|
logError(error);
|
|
37
42
|
await closeStream();
|
|
38
43
|
},
|
|
39
44
|
complete: async () => {
|
|
45
|
+
require_telemetry_client.default.capture("oss.runtime.agent_execution_stream_ended", {});
|
|
40
46
|
await closeStream();
|
|
41
47
|
}
|
|
42
48
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse-response.cjs","names":["EventEncoder"],"sources":["../../../src/handlers/shared/sse-response.ts"],"sourcesContent":["import { BaseEvent } from \"@ag-ui/client\";\nimport { EventEncoder } from \"@ag-ui/encoder\";\nimport { Observable, Subscription } from \"rxjs\";\n\ninterface CreateSseEventResponseParams {\n request: Request;\n observableFactory: () =>\n | Promise<Observable<BaseEvent>>\n | Observable<BaseEvent>;\n}\n\nexport function createSseEventResponse({\n request,\n observableFactory,\n}: CreateSseEventResponseParams): Response {\n const stream = new TransformStream();\n const writer = stream.writable.getWriter();\n const encoder = new EventEncoder();\n let streamClosed = false;\n\n const closeStream = async () => {\n if (!streamClosed) {\n try {\n await writer.close();\n streamClosed = true;\n } catch {\n // Stream already closed.\n }\n }\n };\n\n const logError = (error: unknown) => {\n console.error(\"Error running agent:\", error);\n console.error(\n \"Error stack:\",\n error instanceof Error ? error.stack : \"No stack trace\",\n );\n console.error(\"Error details:\", {\n name: error instanceof Error ? error.name : \"Unknown\",\n message: error instanceof Error ? error.message : String(error),\n cause: error instanceof Error ? error.cause : undefined,\n });\n };\n\n let subscription: Subscription | undefined;\n\n (async () => {\n const observable = await observableFactory();\n\n subscription = observable.subscribe({\n next: async (event) => {\n if (!request.signal.aborted && !streamClosed) {\n try {\n await writer.write(encoder.encode(event));\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n streamClosed = true;\n }\n }\n }\n },\n error: async (error) => {\n logError(error);\n await closeStream();\n },\n complete: async () => {\n await closeStream();\n },\n });\n\n // If the client disconnected before the subscription was created,\n // unsubscribe immediately to avoid leaking the observable.\n if (request.signal.aborted) {\n subscription.unsubscribe();\n }\n })().catch(async (error) => {\n logError(error);\n await closeStream();\n });\n\n request.signal.addEventListener(\"abort\", () => {\n subscription?.unsubscribe();\n });\n\n return new Response(stream.readable, {\n status: 200,\n headers: {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n },\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sse-response.cjs","names":["EventEncoder"],"sources":["../../../src/handlers/shared/sse-response.ts"],"sourcesContent":["import { BaseEvent } from \"@ag-ui/client\";\nimport { EventEncoder } from \"@ag-ui/encoder\";\nimport { Observable, Subscription } from \"rxjs\";\nimport { telemetry } from \"../../telemetry\";\n\ninterface CreateSseEventResponseParams {\n request: Request;\n observableFactory: () =>\n | Promise<Observable<BaseEvent>>\n | Observable<BaseEvent>;\n}\n\nexport function createSseEventResponse({\n request,\n observableFactory,\n}: CreateSseEventResponseParams): Response {\n const stream = new TransformStream();\n const writer = stream.writable.getWriter();\n const encoder = new EventEncoder();\n let streamClosed = false;\n\n const closeStream = async () => {\n if (!streamClosed) {\n try {\n await writer.close();\n streamClosed = true;\n } catch {\n // Stream already closed.\n }\n }\n };\n\n const logError = (error: unknown) => {\n console.error(\"Error running agent:\", error);\n console.error(\n \"Error stack:\",\n error instanceof Error ? error.stack : \"No stack trace\",\n );\n console.error(\"Error details:\", {\n name: error instanceof Error ? error.name : \"Unknown\",\n message: error instanceof Error ? error.message : String(error),\n cause: error instanceof Error ? error.cause : undefined,\n });\n };\n\n let subscription: Subscription | undefined;\n\n (async () => {\n const observable = await observableFactory();\n\n telemetry.capture(\"oss.runtime.agent_execution_stream_started\", {});\n\n subscription = observable.subscribe({\n next: async (event) => {\n if (!request.signal.aborted && !streamClosed) {\n try {\n await writer.write(encoder.encode(event));\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n streamClosed = true;\n }\n }\n }\n },\n error: async (error) => {\n telemetry.capture(\"oss.runtime.agent_execution_stream_errored\", {\n error: error instanceof Error ? error.message : String(error),\n });\n logError(error);\n await closeStream();\n },\n complete: async () => {\n telemetry.capture(\"oss.runtime.agent_execution_stream_ended\", {});\n await closeStream();\n },\n });\n\n // If the client disconnected before the subscription was created,\n // unsubscribe immediately to avoid leaking the observable.\n if (request.signal.aborted) {\n subscription.unsubscribe();\n }\n })().catch(async (error) => {\n logError(error);\n await closeStream();\n });\n\n request.signal.addEventListener(\"abort\", () => {\n subscription?.unsubscribe();\n });\n\n return new Response(stream.readable, {\n status: 200,\n headers: {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n },\n });\n}\n"],"mappings":";;;;;;AAYA,SAAgB,uBAAuB,EACrC,SACA,qBACyC;CACzC,MAAM,SAAS,IAAI,iBAAiB;CACpC,MAAM,SAAS,OAAO,SAAS,WAAW;CAC1C,MAAM,UAAU,IAAIA,6BAAc;CAClC,IAAI,eAAe;CAEnB,MAAM,cAAc,YAAY;AAC9B,MAAI,CAAC,aACH,KAAI;AACF,SAAM,OAAO,OAAO;AACpB,kBAAe;UACT;;CAMZ,MAAM,YAAY,UAAmB;AACnC,UAAQ,MAAM,wBAAwB,MAAM;AAC5C,UAAQ,MACN,gBACA,iBAAiB,QAAQ,MAAM,QAAQ,iBACxC;AACD,UAAQ,MAAM,kBAAkB;GAC9B,MAAM,iBAAiB,QAAQ,MAAM,OAAO;GAC5C,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;GAC/D,OAAO,iBAAiB,QAAQ,MAAM,QAAQ;GAC/C,CAAC;;CAGJ,IAAI;AAEJ,EAAC,YAAY;EACX,MAAM,aAAa,MAAM,mBAAmB;AAE5C,mCAAU,QAAQ,8CAA8C,EAAE,CAAC;AAEnE,iBAAe,WAAW,UAAU;GAClC,MAAM,OAAO,UAAU;AACrB,QAAI,CAAC,QAAQ,OAAO,WAAW,CAAC,aAC9B,KAAI;AACF,WAAM,OAAO,MAAM,QAAQ,OAAO,MAAM,CAAC;aAClC,OAAO;AACd,SAAI,iBAAiB,SAAS,MAAM,SAAS,aAC3C,gBAAe;;;GAKvB,OAAO,OAAO,UAAU;AACtB,qCAAU,QAAQ,8CAA8C,EAC9D,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,EAC9D,CAAC;AACF,aAAS,MAAM;AACf,UAAM,aAAa;;GAErB,UAAU,YAAY;AACpB,qCAAU,QAAQ,4CAA4C,EAAE,CAAC;AACjE,UAAM,aAAa;;GAEtB,CAAC;AAIF,MAAI,QAAQ,OAAO,QACjB,cAAa,aAAa;KAE1B,CAAC,MAAM,OAAO,UAAU;AAC1B,WAAS,MAAM;AACf,QAAM,aAAa;GACnB;AAEF,SAAQ,OAAO,iBAAiB,eAAe;AAC7C,gBAAc,aAAa;GAC3B;AAEF,QAAO,IAAI,SAAS,OAAO,UAAU;EACnC,QAAQ;EACR,SAAS;GACP,gBAAgB;GAChB,iBAAiB;GACjB,YAAY;GACb;EACF,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import telemetry from "../../telemetry/telemetry-client.mjs";
|
|
2
|
+
import "../../telemetry/index.mjs";
|
|
1
3
|
import { EventEncoder } from "@ag-ui/encoder";
|
|
2
4
|
|
|
3
5
|
//#region src/handlers/shared/sse-response.ts
|
|
@@ -23,7 +25,9 @@ function createSseEventResponse({ request, observableFactory }) {
|
|
|
23
25
|
};
|
|
24
26
|
let subscription;
|
|
25
27
|
(async () => {
|
|
26
|
-
|
|
28
|
+
const observable = await observableFactory();
|
|
29
|
+
telemetry.capture("oss.runtime.agent_execution_stream_started", {});
|
|
30
|
+
subscription = observable.subscribe({
|
|
27
31
|
next: async (event) => {
|
|
28
32
|
if (!request.signal.aborted && !streamClosed) try {
|
|
29
33
|
await writer.write(encoder.encode(event));
|
|
@@ -32,10 +36,12 @@ function createSseEventResponse({ request, observableFactory }) {
|
|
|
32
36
|
}
|
|
33
37
|
},
|
|
34
38
|
error: async (error) => {
|
|
39
|
+
telemetry.capture("oss.runtime.agent_execution_stream_errored", { error: error instanceof Error ? error.message : String(error) });
|
|
35
40
|
logError(error);
|
|
36
41
|
await closeStream();
|
|
37
42
|
},
|
|
38
43
|
complete: async () => {
|
|
44
|
+
telemetry.capture("oss.runtime.agent_execution_stream_ended", {});
|
|
39
45
|
await closeStream();
|
|
40
46
|
}
|
|
41
47
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse-response.mjs","names":[],"sources":["../../../src/handlers/shared/sse-response.ts"],"sourcesContent":["import { BaseEvent } from \"@ag-ui/client\";\nimport { EventEncoder } from \"@ag-ui/encoder\";\nimport { Observable, Subscription } from \"rxjs\";\n\ninterface CreateSseEventResponseParams {\n request: Request;\n observableFactory: () =>\n | Promise<Observable<BaseEvent>>\n | Observable<BaseEvent>;\n}\n\nexport function createSseEventResponse({\n request,\n observableFactory,\n}: CreateSseEventResponseParams): Response {\n const stream = new TransformStream();\n const writer = stream.writable.getWriter();\n const encoder = new EventEncoder();\n let streamClosed = false;\n\n const closeStream = async () => {\n if (!streamClosed) {\n try {\n await writer.close();\n streamClosed = true;\n } catch {\n // Stream already closed.\n }\n }\n };\n\n const logError = (error: unknown) => {\n console.error(\"Error running agent:\", error);\n console.error(\n \"Error stack:\",\n error instanceof Error ? error.stack : \"No stack trace\",\n );\n console.error(\"Error details:\", {\n name: error instanceof Error ? error.name : \"Unknown\",\n message: error instanceof Error ? error.message : String(error),\n cause: error instanceof Error ? error.cause : undefined,\n });\n };\n\n let subscription: Subscription | undefined;\n\n (async () => {\n const observable = await observableFactory();\n\n subscription = observable.subscribe({\n next: async (event) => {\n if (!request.signal.aborted && !streamClosed) {\n try {\n await writer.write(encoder.encode(event));\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n streamClosed = true;\n }\n }\n }\n },\n error: async (error) => {\n logError(error);\n await closeStream();\n },\n complete: async () => {\n await closeStream();\n },\n });\n\n // If the client disconnected before the subscription was created,\n // unsubscribe immediately to avoid leaking the observable.\n if (request.signal.aborted) {\n subscription.unsubscribe();\n }\n })().catch(async (error) => {\n logError(error);\n await closeStream();\n });\n\n request.signal.addEventListener(\"abort\", () => {\n subscription?.unsubscribe();\n });\n\n return new Response(stream.readable, {\n status: 200,\n headers: {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n },\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sse-response.mjs","names":[],"sources":["../../../src/handlers/shared/sse-response.ts"],"sourcesContent":["import { BaseEvent } from \"@ag-ui/client\";\nimport { EventEncoder } from \"@ag-ui/encoder\";\nimport { Observable, Subscription } from \"rxjs\";\nimport { telemetry } from \"../../telemetry\";\n\ninterface CreateSseEventResponseParams {\n request: Request;\n observableFactory: () =>\n | Promise<Observable<BaseEvent>>\n | Observable<BaseEvent>;\n}\n\nexport function createSseEventResponse({\n request,\n observableFactory,\n}: CreateSseEventResponseParams): Response {\n const stream = new TransformStream();\n const writer = stream.writable.getWriter();\n const encoder = new EventEncoder();\n let streamClosed = false;\n\n const closeStream = async () => {\n if (!streamClosed) {\n try {\n await writer.close();\n streamClosed = true;\n } catch {\n // Stream already closed.\n }\n }\n };\n\n const logError = (error: unknown) => {\n console.error(\"Error running agent:\", error);\n console.error(\n \"Error stack:\",\n error instanceof Error ? error.stack : \"No stack trace\",\n );\n console.error(\"Error details:\", {\n name: error instanceof Error ? error.name : \"Unknown\",\n message: error instanceof Error ? error.message : String(error),\n cause: error instanceof Error ? error.cause : undefined,\n });\n };\n\n let subscription: Subscription | undefined;\n\n (async () => {\n const observable = await observableFactory();\n\n telemetry.capture(\"oss.runtime.agent_execution_stream_started\", {});\n\n subscription = observable.subscribe({\n next: async (event) => {\n if (!request.signal.aborted && !streamClosed) {\n try {\n await writer.write(encoder.encode(event));\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n streamClosed = true;\n }\n }\n }\n },\n error: async (error) => {\n telemetry.capture(\"oss.runtime.agent_execution_stream_errored\", {\n error: error instanceof Error ? error.message : String(error),\n });\n logError(error);\n await closeStream();\n },\n complete: async () => {\n telemetry.capture(\"oss.runtime.agent_execution_stream_ended\", {});\n await closeStream();\n },\n });\n\n // If the client disconnected before the subscription was created,\n // unsubscribe immediately to avoid leaking the observable.\n if (request.signal.aborted) {\n subscription.unsubscribe();\n }\n })().catch(async (error) => {\n logError(error);\n await closeStream();\n });\n\n request.signal.addEventListener(\"abort\", () => {\n subscription?.unsubscribe();\n });\n\n return new Response(stream.readable, {\n status: 200,\n headers: {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n },\n });\n}\n"],"mappings":";;;;;AAYA,SAAgB,uBAAuB,EACrC,SACA,qBACyC;CACzC,MAAM,SAAS,IAAI,iBAAiB;CACpC,MAAM,SAAS,OAAO,SAAS,WAAW;CAC1C,MAAM,UAAU,IAAI,cAAc;CAClC,IAAI,eAAe;CAEnB,MAAM,cAAc,YAAY;AAC9B,MAAI,CAAC,aACH,KAAI;AACF,SAAM,OAAO,OAAO;AACpB,kBAAe;UACT;;CAMZ,MAAM,YAAY,UAAmB;AACnC,UAAQ,MAAM,wBAAwB,MAAM;AAC5C,UAAQ,MACN,gBACA,iBAAiB,QAAQ,MAAM,QAAQ,iBACxC;AACD,UAAQ,MAAM,kBAAkB;GAC9B,MAAM,iBAAiB,QAAQ,MAAM,OAAO;GAC5C,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;GAC/D,OAAO,iBAAiB,QAAQ,MAAM,QAAQ;GAC/C,CAAC;;CAGJ,IAAI;AAEJ,EAAC,YAAY;EACX,MAAM,aAAa,MAAM,mBAAmB;AAE5C,YAAU,QAAQ,8CAA8C,EAAE,CAAC;AAEnE,iBAAe,WAAW,UAAU;GAClC,MAAM,OAAO,UAAU;AACrB,QAAI,CAAC,QAAQ,OAAO,WAAW,CAAC,aAC9B,KAAI;AACF,WAAM,OAAO,MAAM,QAAQ,OAAO,MAAM,CAAC;aAClC,OAAO;AACd,SAAI,iBAAiB,SAAS,MAAM,SAAS,aAC3C,gBAAe;;;GAKvB,OAAO,OAAO,UAAU;AACtB,cAAU,QAAQ,8CAA8C,EAC9D,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,EAC9D,CAAC;AACF,aAAS,MAAM;AACf,UAAM,aAAa;;GAErB,UAAU,YAAY;AACpB,cAAU,QAAQ,4CAA4C,EAAE,CAAC;AACjE,UAAM,aAAa;;GAEtB,CAAC;AAIF,MAAI,QAAQ,OAAO,QACjB,cAAa,aAAa;KAE1B,CAAC,MAAM,OAAO,UAAU;AAC1B,WAAS,MAAM;AACf,QAAM,aAAa;GACnB;AAEF,SAAQ,OAAO,iBAAiB,eAAe;AAC7C,gBAAc,aAAa;GAC3B;AAEF,QAAO,IAAI,SAAS,OAAO,UAAU;EACnC,QAAQ;EACR,SAAS;GACP,gBAAgB;GAChB,iBAAiB;GACjB,YAAY;GACb;EACF,CAAC"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TranscribeFileOptions, TranscriptionService } from "./transcription-service/transcription-service.cjs";
|
|
2
2
|
import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest } from "./runner/agent-runner.cjs";
|
|
3
3
|
import { CopilotKitIntelligence, CopilotKitIntelligenceConfig, CreateThreadRequest, ListThreadsResponse, SubscribeToThreadsRequest, SubscribeToThreadsResponse, ThreadSummary, UpdateThreadRequest } from "./intelligence-platform/client.cjs";
|
|
4
|
-
import { CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeLike, CopilotRuntimeOptions, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, McpAppsConfig, McpAppsServerConfig, VERSION, isIntelligenceRuntime } from "./runtime.cjs";
|
|
4
|
+
import { CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeLike, CopilotRuntimeOptions, CopilotRuntimeUser, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, IdentifyUserCallback, McpAppsConfig, McpAppsServerConfig, VERSION, isIntelligenceRuntime } from "./runtime.cjs";
|
|
5
5
|
import { CopilotEndpointCorsConfig, createCopilotEndpoint } from "./endpoints/hono.cjs";
|
|
6
6
|
import { createCopilotEndpointSingleRoute } from "./endpoints/hono-single.cjs";
|
|
7
7
|
import { InMemoryAgentRunner } from "./runner/in-memory.cjs";
|
|
8
8
|
import { IntelligenceAgentRunner, IntelligenceAgentRunnerOptions } from "./runner/intelligence.cjs";
|
|
9
9
|
import { finalizeRunEvents } from "./runner/index.cjs";
|
|
10
|
-
export { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, CopilotEndpointCorsConfig, CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotKitIntelligence, type CopilotKitIntelligenceConfig, CopilotRuntime, CopilotRuntimeLike, CopilotRuntimeOptions, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, type CreateThreadRequest, InMemoryAgentRunner, IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, type ListThreadsResponse, McpAppsConfig, McpAppsServerConfig, type SubscribeToThreadsRequest, type SubscribeToThreadsResponse, type ThreadSummary, TranscribeFileOptions, TranscriptionService, type UpdateThreadRequest, VERSION, createCopilotEndpoint, createCopilotEndpointSingleRoute, finalizeRunEvents, isIntelligenceRuntime };
|
|
10
|
+
export { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, CopilotEndpointCorsConfig, CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotKitIntelligence, type CopilotKitIntelligenceConfig, CopilotRuntime, CopilotRuntimeLike, CopilotRuntimeOptions, CopilotRuntimeUser, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, type CreateThreadRequest, IdentifyUserCallback, InMemoryAgentRunner, IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, type ListThreadsResponse, McpAppsConfig, McpAppsServerConfig, type SubscribeToThreadsRequest, type SubscribeToThreadsResponse, type ThreadSummary, TranscribeFileOptions, TranscriptionService, type UpdateThreadRequest, VERSION, createCopilotEndpoint, createCopilotEndpointSingleRoute, finalizeRunEvents, isIntelligenceRuntime };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,11 +2,11 @@ import { TranscribeFileOptions, TranscriptionService } from "./transcription-ser
|
|
|
2
2
|
import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest } from "./runner/agent-runner.mjs";
|
|
3
3
|
import { CopilotKitIntelligence, CopilotKitIntelligenceConfig, CreateThreadRequest, ListThreadsResponse, SubscribeToThreadsRequest, SubscribeToThreadsResponse, ThreadSummary, UpdateThreadRequest } from "./intelligence-platform/client.mjs";
|
|
4
4
|
import "./intelligence-platform/index.mjs";
|
|
5
|
-
import { CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeLike, CopilotRuntimeOptions, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, McpAppsConfig, McpAppsServerConfig, VERSION, isIntelligenceRuntime } from "./runtime.mjs";
|
|
5
|
+
import { CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeLike, CopilotRuntimeOptions, CopilotRuntimeUser, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, IdentifyUserCallback, McpAppsConfig, McpAppsServerConfig, VERSION, isIntelligenceRuntime } from "./runtime.mjs";
|
|
6
6
|
import { CopilotEndpointCorsConfig, createCopilotEndpoint } from "./endpoints/hono.mjs";
|
|
7
7
|
import { createCopilotEndpointSingleRoute } from "./endpoints/hono-single.mjs";
|
|
8
8
|
import "./endpoints/index.mjs";
|
|
9
9
|
import { InMemoryAgentRunner } from "./runner/in-memory.mjs";
|
|
10
10
|
import { IntelligenceAgentRunner, IntelligenceAgentRunnerOptions } from "./runner/intelligence.mjs";
|
|
11
11
|
import { finalizeRunEvents } from "./runner/index.mjs";
|
|
12
|
-
export { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, CopilotEndpointCorsConfig, CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotKitIntelligence, type CopilotKitIntelligenceConfig, CopilotRuntime, CopilotRuntimeLike, CopilotRuntimeOptions, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, type CreateThreadRequest, InMemoryAgentRunner, IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, type ListThreadsResponse, McpAppsConfig, McpAppsServerConfig, type SubscribeToThreadsRequest, type SubscribeToThreadsResponse, type ThreadSummary, TranscribeFileOptions, TranscriptionService, type UpdateThreadRequest, VERSION, createCopilotEndpoint, createCopilotEndpointSingleRoute, finalizeRunEvents, isIntelligenceRuntime };
|
|
12
|
+
export { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, CopilotEndpointCorsConfig, CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotKitIntelligence, type CopilotKitIntelligenceConfig, CopilotRuntime, CopilotRuntimeLike, CopilotRuntimeOptions, CopilotRuntimeUser, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, type CreateThreadRequest, IdentifyUserCallback, InMemoryAgentRunner, IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, type ListThreadsResponse, McpAppsConfig, McpAppsServerConfig, type SubscribeToThreadsRequest, type SubscribeToThreadsResponse, type ThreadSummary, TranscribeFileOptions, TranscriptionService, type UpdateThreadRequest, VERSION, createCopilotEndpoint, createCopilotEndpointSingleRoute, finalizeRunEvents, isIntelligenceRuntime };
|
package/dist/package.cjs
CHANGED
package/dist/package.mjs
CHANGED
package/dist/runtime.cjs
CHANGED
|
@@ -34,6 +34,7 @@ var CopilotSseRuntime = class extends BaseCopilotRuntime {
|
|
|
34
34
|
};
|
|
35
35
|
var CopilotIntelligenceRuntime = class extends BaseCopilotRuntime {
|
|
36
36
|
intelligence;
|
|
37
|
+
identifyUser;
|
|
37
38
|
generateThreadNames;
|
|
38
39
|
mode = _copilotkitnext_shared.RUNTIME_MODE_INTELLIGENCE;
|
|
39
40
|
constructor(options) {
|
|
@@ -42,6 +43,7 @@ var CopilotIntelligenceRuntime = class extends BaseCopilotRuntime {
|
|
|
42
43
|
authToken: options.intelligence.ɵgetRunnerAuthToken()
|
|
43
44
|
}));
|
|
44
45
|
this.intelligence = options.intelligence;
|
|
46
|
+
this.identifyUser = options.identifyUser;
|
|
45
47
|
this.generateThreadNames = options.generateThreadNames ?? true;
|
|
46
48
|
}
|
|
47
49
|
};
|
|
@@ -87,6 +89,9 @@ var CopilotRuntime = class {
|
|
|
87
89
|
get generateThreadNames() {
|
|
88
90
|
return isIntelligenceRuntime(this.delegate) ? this.delegate.generateThreadNames : void 0;
|
|
89
91
|
}
|
|
92
|
+
get identifyUser() {
|
|
93
|
+
return isIntelligenceRuntime(this.delegate) ? this.delegate.identifyUser : void 0;
|
|
94
|
+
}
|
|
90
95
|
get mode() {
|
|
91
96
|
return this.delegate.mode;
|
|
92
97
|
}
|
package/dist/runtime.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.cjs","names":["RUNTIME_MODE_SSE","InMemoryAgentRunner","RUNTIME_MODE_INTELLIGENCE","IntelligenceAgentRunner"],"sources":["../src/runtime.ts"],"sourcesContent":["import {\n MaybePromise,\n NonEmptyRecord,\n RuntimeMode,\n RUNTIME_MODE_SSE,\n RUNTIME_MODE_INTELLIGENCE,\n} from \"@copilotkitnext/shared\";\nimport { AbstractAgent } from \"@ag-ui/client\";\nimport type { MCPClientConfig } from \"@ag-ui/mcp-apps-middleware\";\nimport { A2UIMiddlewareConfig } from \"@ag-ui/a2ui-middleware\";\nimport pkg from \"../package.json\";\nimport type {\n BeforeRequestMiddleware,\n AfterRequestMiddleware,\n} from \"./middleware\";\nimport { TranscriptionService } from \"./transcription-service/transcription-service\";\nimport { AgentRunner } from \"./runner/agent-runner\";\nimport { InMemoryAgentRunner } from \"./runner/in-memory\";\nimport { IntelligenceAgentRunner } from \"./runner/intelligence\";\nimport { CopilotKitIntelligence } from \"./intelligence-platform\";\n\nexport const VERSION = pkg.version;\n\ninterface BaseCopilotRuntimeMiddlewareOptions {\n /** If set, middleware only applies to these named agents. Applies to all agents if omitted. */\n agents?: string[];\n}\n\nexport type McpAppsServerConfig = MCPClientConfig & {\n /** Agent to bind this server to. If omitted, the server is available to all agents. */\n agentId?: string;\n};\n\nexport interface McpAppsConfig {\n /** List of MCP server configurations. */\n servers: McpAppsServerConfig[];\n}\n\ninterface CopilotRuntimeMiddlewares {\n /** Auto-apply A2UIMiddleware to agents at run time. */\n a2ui?: BaseCopilotRuntimeMiddlewareOptions & A2UIMiddlewareConfig;\n /** Auto-apply MCPAppsMiddleware to agents at run time. */\n mcpApps?: McpAppsConfig;\n}\n\ninterface BaseCopilotRuntimeOptions extends CopilotRuntimeMiddlewares {\n /** Map of available agents (loaded lazily is fine). */\n agents: MaybePromise<NonEmptyRecord<Record<string, AbstractAgent>>>;\n /** Optional transcription service for audio processing. */\n transcriptionService?: TranscriptionService;\n /** Optional *before* middleware – callback function or webhook URL. */\n beforeRequestMiddleware?: BeforeRequestMiddleware;\n /** Optional *after* middleware – callback function or webhook URL. */\n afterRequestMiddleware?: AfterRequestMiddleware;\n}\n\nexport interface CopilotSseRuntimeOptions extends BaseCopilotRuntimeOptions {\n /** The runner to use for running agents in SSE mode. */\n runner?: AgentRunner;\n intelligence?: undefined;\n generateThreadNames?: undefined;\n}\n\nexport interface CopilotIntelligenceRuntimeOptions extends BaseCopilotRuntimeOptions {\n /** Configures Intelligence mode for durable threads and realtime events. */\n intelligence: CopilotKitIntelligence;\n /** Auto-generate short names for newly created threads. */\n generateThreadNames?: boolean;\n}\n\nexport type CopilotRuntimeOptions =\n | CopilotSseRuntimeOptions\n | CopilotIntelligenceRuntimeOptions;\n\nexport interface CopilotRuntimeLike {\n agents: CopilotRuntimeOptions[\"agents\"];\n transcriptionService: CopilotRuntimeOptions[\"transcriptionService\"];\n beforeRequestMiddleware: CopilotRuntimeOptions[\"beforeRequestMiddleware\"];\n afterRequestMiddleware: CopilotRuntimeOptions[\"afterRequestMiddleware\"];\n runner: AgentRunner;\n a2ui: CopilotRuntimeOptions[\"a2ui\"];\n mcpApps: CopilotRuntimeOptions[\"mcpApps\"];\n intelligence?: CopilotKitIntelligence;\n mode: RuntimeMode;\n}\n\nexport interface CopilotSseRuntimeLike extends CopilotRuntimeLike {\n intelligence?: undefined;\n mode: RUNTIME_MODE_SSE;\n}\n\nexport interface CopilotIntelligenceRuntimeLike extends CopilotRuntimeLike {\n intelligence: CopilotKitIntelligence;\n generateThreadNames: boolean;\n mode: RUNTIME_MODE_INTELLIGENCE;\n}\n\nabstract class BaseCopilotRuntime implements CopilotRuntimeLike {\n public agents: CopilotRuntimeOptions[\"agents\"];\n public transcriptionService: CopilotRuntimeOptions[\"transcriptionService\"];\n public beforeRequestMiddleware: CopilotRuntimeOptions[\"beforeRequestMiddleware\"];\n public afterRequestMiddleware: CopilotRuntimeOptions[\"afterRequestMiddleware\"];\n public runner: AgentRunner;\n public a2ui: CopilotRuntimeOptions[\"a2ui\"];\n public mcpApps: CopilotRuntimeOptions[\"mcpApps\"];\n\n abstract readonly intelligence?: CopilotKitIntelligence;\n abstract readonly mode: RuntimeMode;\n\n constructor(options: BaseCopilotRuntimeOptions, runner: AgentRunner) {\n const {\n agents,\n transcriptionService,\n beforeRequestMiddleware,\n afterRequestMiddleware,\n a2ui,\n mcpApps,\n } = options;\n\n this.agents = agents;\n this.transcriptionService = transcriptionService;\n this.beforeRequestMiddleware = beforeRequestMiddleware;\n this.afterRequestMiddleware = afterRequestMiddleware;\n this.a2ui = a2ui;\n this.mcpApps = mcpApps;\n this.runner = runner;\n }\n}\n\nexport class CopilotSseRuntime\n extends BaseCopilotRuntime\n implements CopilotSseRuntimeLike\n{\n readonly intelligence = undefined;\n readonly mode = RUNTIME_MODE_SSE;\n\n constructor(options: CopilotSseRuntimeOptions) {\n super(options, options.runner ?? new InMemoryAgentRunner());\n }\n}\n\nexport class CopilotIntelligenceRuntime\n extends BaseCopilotRuntime\n implements CopilotIntelligenceRuntimeLike\n{\n readonly intelligence: CopilotKitIntelligence;\n readonly generateThreadNames: boolean;\n readonly mode = RUNTIME_MODE_INTELLIGENCE;\n\n constructor(options: CopilotIntelligenceRuntimeOptions) {\n super(\n options,\n new IntelligenceAgentRunner({\n url: options.intelligence.ɵgetRunnerWsUrl(),\n authToken: options.intelligence.ɵgetRunnerAuthToken(),\n }),\n );\n this.intelligence = options.intelligence;\n this.generateThreadNames = options.generateThreadNames ?? true;\n }\n}\n\nfunction hasIntelligenceOptions(\n options: CopilotRuntimeOptions,\n): options is CopilotIntelligenceRuntimeOptions {\n return \"intelligence\" in options && !!options.intelligence;\n}\n\nexport function isIntelligenceRuntime(\n runtime: CopilotRuntimeLike,\n): runtime is CopilotIntelligenceRuntimeLike {\n return runtime.mode === RUNTIME_MODE_INTELLIGENCE && !!runtime.intelligence;\n}\n\n/**\n * Compatibility shim that preserves the legacy `CopilotRuntime` entrypoint.\n * New code should prefer `CopilotSseRuntime` or `CopilotIntelligenceRuntime`.\n */\nexport class CopilotRuntime implements CopilotRuntimeLike {\n private delegate: CopilotRuntimeLike;\n\n constructor(options: CopilotRuntimeOptions) {\n this.delegate = hasIntelligenceOptions(options)\n ? new CopilotIntelligenceRuntime(options)\n : new CopilotSseRuntime(options);\n }\n\n get agents(): CopilotRuntimeOptions[\"agents\"] {\n return this.delegate.agents;\n }\n\n get transcriptionService(): CopilotRuntimeOptions[\"transcriptionService\"] {\n return this.delegate.transcriptionService;\n }\n\n get beforeRequestMiddleware(): CopilotRuntimeOptions[\"beforeRequestMiddleware\"] {\n return this.delegate.beforeRequestMiddleware;\n }\n\n get afterRequestMiddleware(): CopilotRuntimeOptions[\"afterRequestMiddleware\"] {\n return this.delegate.afterRequestMiddleware;\n }\n\n get runner(): AgentRunner {\n return this.delegate.runner;\n }\n\n get a2ui(): CopilotRuntimeOptions[\"a2ui\"] {\n return this.delegate.a2ui;\n }\n\n get mcpApps(): CopilotRuntimeOptions[\"mcpApps\"] {\n return this.delegate.mcpApps;\n }\n\n get intelligence(): CopilotKitIntelligence | undefined {\n return this.delegate.intelligence;\n }\n\n get generateThreadNames(): boolean | undefined {\n return isIntelligenceRuntime(this.delegate)\n ? this.delegate.generateThreadNames\n : undefined;\n }\n\n get mode(): RuntimeMode {\n return this.delegate.mode;\n }\n}\n"],"mappings":";;;;;;;AAqBA,MAAa;
|
|
1
|
+
{"version":3,"file":"runtime.cjs","names":["RUNTIME_MODE_SSE","InMemoryAgentRunner","RUNTIME_MODE_INTELLIGENCE","IntelligenceAgentRunner"],"sources":["../src/runtime.ts"],"sourcesContent":["import {\n MaybePromise,\n NonEmptyRecord,\n RuntimeMode,\n RUNTIME_MODE_SSE,\n RUNTIME_MODE_INTELLIGENCE,\n} from \"@copilotkitnext/shared\";\nimport { AbstractAgent } from \"@ag-ui/client\";\nimport type { MCPClientConfig } from \"@ag-ui/mcp-apps-middleware\";\nimport { A2UIMiddlewareConfig } from \"@ag-ui/a2ui-middleware\";\nimport pkg from \"../package.json\";\nimport type {\n BeforeRequestMiddleware,\n AfterRequestMiddleware,\n} from \"./middleware\";\nimport { TranscriptionService } from \"./transcription-service/transcription-service\";\nimport { AgentRunner } from \"./runner/agent-runner\";\nimport { InMemoryAgentRunner } from \"./runner/in-memory\";\nimport { IntelligenceAgentRunner } from \"./runner/intelligence\";\nimport { CopilotKitIntelligence } from \"./intelligence-platform\";\n\nexport const VERSION = pkg.version;\n\ninterface BaseCopilotRuntimeMiddlewareOptions {\n /** If set, middleware only applies to these named agents. Applies to all agents if omitted. */\n agents?: string[];\n}\n\nexport type McpAppsServerConfig = MCPClientConfig & {\n /** Agent to bind this server to. If omitted, the server is available to all agents. */\n agentId?: string;\n};\n\nexport interface McpAppsConfig {\n /** List of MCP server configurations. */\n servers: McpAppsServerConfig[];\n}\n\ninterface CopilotRuntimeMiddlewares {\n /** Auto-apply A2UIMiddleware to agents at run time. */\n a2ui?: BaseCopilotRuntimeMiddlewareOptions & A2UIMiddlewareConfig;\n /** Auto-apply MCPAppsMiddleware to agents at run time. */\n mcpApps?: McpAppsConfig;\n}\n\ninterface BaseCopilotRuntimeOptions extends CopilotRuntimeMiddlewares {\n /** Map of available agents (loaded lazily is fine). */\n agents: MaybePromise<NonEmptyRecord<Record<string, AbstractAgent>>>;\n /** Optional transcription service for audio processing. */\n transcriptionService?: TranscriptionService;\n /** Optional *before* middleware – callback function or webhook URL. */\n beforeRequestMiddleware?: BeforeRequestMiddleware;\n /** Optional *after* middleware – callback function or webhook URL. */\n afterRequestMiddleware?: AfterRequestMiddleware;\n}\n\nexport interface CopilotRuntimeUser {\n id: string;\n}\n\nexport type IdentifyUserCallback = (\n request: Request,\n) => MaybePromise<CopilotRuntimeUser>;\n\nexport interface CopilotSseRuntimeOptions extends BaseCopilotRuntimeOptions {\n /** The runner to use for running agents in SSE mode. */\n runner?: AgentRunner;\n intelligence?: undefined;\n generateThreadNames?: undefined;\n}\n\nexport interface CopilotIntelligenceRuntimeOptions extends BaseCopilotRuntimeOptions {\n /** Configures Intelligence mode for durable threads and realtime events. */\n intelligence: CopilotKitIntelligence;\n /** Resolves the authenticated user for intelligence requests. */\n identifyUser: IdentifyUserCallback;\n /** Auto-generate short names for newly created threads. */\n generateThreadNames?: boolean;\n}\n\nexport type CopilotRuntimeOptions =\n | CopilotSseRuntimeOptions\n | CopilotIntelligenceRuntimeOptions;\n\nexport interface CopilotRuntimeLike {\n agents: CopilotRuntimeOptions[\"agents\"];\n transcriptionService: CopilotRuntimeOptions[\"transcriptionService\"];\n beforeRequestMiddleware: CopilotRuntimeOptions[\"beforeRequestMiddleware\"];\n afterRequestMiddleware: CopilotRuntimeOptions[\"afterRequestMiddleware\"];\n runner: AgentRunner;\n a2ui: CopilotRuntimeOptions[\"a2ui\"];\n mcpApps: CopilotRuntimeOptions[\"mcpApps\"];\n intelligence?: CopilotKitIntelligence;\n identifyUser?: IdentifyUserCallback;\n mode: RuntimeMode;\n}\n\nexport interface CopilotSseRuntimeLike extends CopilotRuntimeLike {\n intelligence?: undefined;\n mode: RUNTIME_MODE_SSE;\n}\n\nexport interface CopilotIntelligenceRuntimeLike extends CopilotRuntimeLike {\n intelligence: CopilotKitIntelligence;\n identifyUser: IdentifyUserCallback;\n generateThreadNames: boolean;\n mode: RUNTIME_MODE_INTELLIGENCE;\n}\n\nabstract class BaseCopilotRuntime implements CopilotRuntimeLike {\n public agents: CopilotRuntimeOptions[\"agents\"];\n public transcriptionService: CopilotRuntimeOptions[\"transcriptionService\"];\n public beforeRequestMiddleware: CopilotRuntimeOptions[\"beforeRequestMiddleware\"];\n public afterRequestMiddleware: CopilotRuntimeOptions[\"afterRequestMiddleware\"];\n public runner: AgentRunner;\n public a2ui: CopilotRuntimeOptions[\"a2ui\"];\n public mcpApps: CopilotRuntimeOptions[\"mcpApps\"];\n\n abstract readonly intelligence?: CopilotKitIntelligence;\n abstract readonly mode: RuntimeMode;\n\n constructor(options: BaseCopilotRuntimeOptions, runner: AgentRunner) {\n const {\n agents,\n transcriptionService,\n beforeRequestMiddleware,\n afterRequestMiddleware,\n a2ui,\n mcpApps,\n } = options;\n\n this.agents = agents;\n this.transcriptionService = transcriptionService;\n this.beforeRequestMiddleware = beforeRequestMiddleware;\n this.afterRequestMiddleware = afterRequestMiddleware;\n this.a2ui = a2ui;\n this.mcpApps = mcpApps;\n this.runner = runner;\n }\n}\n\nexport class CopilotSseRuntime\n extends BaseCopilotRuntime\n implements CopilotSseRuntimeLike\n{\n readonly intelligence = undefined;\n readonly mode = RUNTIME_MODE_SSE;\n\n constructor(options: CopilotSseRuntimeOptions) {\n super(options, options.runner ?? new InMemoryAgentRunner());\n }\n}\n\nexport class CopilotIntelligenceRuntime\n extends BaseCopilotRuntime\n implements CopilotIntelligenceRuntimeLike\n{\n readonly intelligence: CopilotKitIntelligence;\n readonly identifyUser: IdentifyUserCallback;\n readonly generateThreadNames: boolean;\n readonly mode = RUNTIME_MODE_INTELLIGENCE;\n\n constructor(options: CopilotIntelligenceRuntimeOptions) {\n super(\n options,\n new IntelligenceAgentRunner({\n url: options.intelligence.ɵgetRunnerWsUrl(),\n authToken: options.intelligence.ɵgetRunnerAuthToken(),\n }),\n );\n this.intelligence = options.intelligence;\n this.identifyUser = options.identifyUser;\n this.generateThreadNames = options.generateThreadNames ?? true;\n }\n}\n\nfunction hasIntelligenceOptions(\n options: CopilotRuntimeOptions,\n): options is CopilotIntelligenceRuntimeOptions {\n return \"intelligence\" in options && !!options.intelligence;\n}\n\nexport function isIntelligenceRuntime(\n runtime: CopilotRuntimeLike,\n): runtime is CopilotIntelligenceRuntimeLike {\n return runtime.mode === RUNTIME_MODE_INTELLIGENCE && !!runtime.intelligence;\n}\n\n/**\n * Compatibility shim that preserves the legacy `CopilotRuntime` entrypoint.\n * New code should prefer `CopilotSseRuntime` or `CopilotIntelligenceRuntime`.\n */\nexport class CopilotRuntime implements CopilotRuntimeLike {\n private delegate: CopilotRuntimeLike;\n\n constructor(options: CopilotRuntimeOptions) {\n this.delegate = hasIntelligenceOptions(options)\n ? new CopilotIntelligenceRuntime(options)\n : new CopilotSseRuntime(options);\n }\n\n get agents(): CopilotRuntimeOptions[\"agents\"] {\n return this.delegate.agents;\n }\n\n get transcriptionService(): CopilotRuntimeOptions[\"transcriptionService\"] {\n return this.delegate.transcriptionService;\n }\n\n get beforeRequestMiddleware(): CopilotRuntimeOptions[\"beforeRequestMiddleware\"] {\n return this.delegate.beforeRequestMiddleware;\n }\n\n get afterRequestMiddleware(): CopilotRuntimeOptions[\"afterRequestMiddleware\"] {\n return this.delegate.afterRequestMiddleware;\n }\n\n get runner(): AgentRunner {\n return this.delegate.runner;\n }\n\n get a2ui(): CopilotRuntimeOptions[\"a2ui\"] {\n return this.delegate.a2ui;\n }\n\n get mcpApps(): CopilotRuntimeOptions[\"mcpApps\"] {\n return this.delegate.mcpApps;\n }\n\n get intelligence(): CopilotKitIntelligence | undefined {\n return this.delegate.intelligence;\n }\n\n get generateThreadNames(): boolean | undefined {\n return isIntelligenceRuntime(this.delegate)\n ? this.delegate.generateThreadNames\n : undefined;\n }\n\n get identifyUser(): IdentifyUserCallback | undefined {\n return isIntelligenceRuntime(this.delegate)\n ? this.delegate.identifyUser\n : undefined;\n }\n\n get mode(): RuntimeMode {\n return this.delegate.mode;\n }\n}\n"],"mappings":";;;;;;;AAqBA,MAAa;AAwFb,IAAe,qBAAf,MAAgE;CAC9D,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CAKP,YAAY,SAAoC,QAAqB;EACnE,MAAM,EACJ,QACA,sBACA,yBACA,wBACA,MACA,YACE;AAEJ,OAAK,SAAS;AACd,OAAK,uBAAuB;AAC5B,OAAK,0BAA0B;AAC/B,OAAK,yBAAyB;AAC9B,OAAK,OAAO;AACZ,OAAK,UAAU;AACf,OAAK,SAAS;;;AAIlB,IAAa,oBAAb,cACU,mBAEV;CACE,AAAS,eA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GACvC,KAAK,SAAS,eACd;;CAGN,IAAI,OAAoB;AACtB,SAAO,KAAK,SAAS"}
|
package/dist/runtime.d.cts
CHANGED
|
@@ -36,6 +36,10 @@ interface BaseCopilotRuntimeOptions extends CopilotRuntimeMiddlewares {
|
|
|
36
36
|
/** Optional *after* middleware – callback function or webhook URL. */
|
|
37
37
|
afterRequestMiddleware?: AfterRequestMiddleware;
|
|
38
38
|
}
|
|
39
|
+
interface CopilotRuntimeUser {
|
|
40
|
+
id: string;
|
|
41
|
+
}
|
|
42
|
+
type IdentifyUserCallback = (request: Request) => MaybePromise<CopilotRuntimeUser>;
|
|
39
43
|
interface CopilotSseRuntimeOptions extends BaseCopilotRuntimeOptions {
|
|
40
44
|
/** The runner to use for running agents in SSE mode. */
|
|
41
45
|
runner?: AgentRunner;
|
|
@@ -45,6 +49,8 @@ interface CopilotSseRuntimeOptions extends BaseCopilotRuntimeOptions {
|
|
|
45
49
|
interface CopilotIntelligenceRuntimeOptions extends BaseCopilotRuntimeOptions {
|
|
46
50
|
/** Configures Intelligence mode for durable threads and realtime events. */
|
|
47
51
|
intelligence: CopilotKitIntelligence;
|
|
52
|
+
/** Resolves the authenticated user for intelligence requests. */
|
|
53
|
+
identifyUser: IdentifyUserCallback;
|
|
48
54
|
/** Auto-generate short names for newly created threads. */
|
|
49
55
|
generateThreadNames?: boolean;
|
|
50
56
|
}
|
|
@@ -58,6 +64,7 @@ interface CopilotRuntimeLike {
|
|
|
58
64
|
a2ui: CopilotRuntimeOptions["a2ui"];
|
|
59
65
|
mcpApps: CopilotRuntimeOptions["mcpApps"];
|
|
60
66
|
intelligence?: CopilotKitIntelligence;
|
|
67
|
+
identifyUser?: IdentifyUserCallback;
|
|
61
68
|
mode: RuntimeMode;
|
|
62
69
|
}
|
|
63
70
|
interface CopilotSseRuntimeLike extends CopilotRuntimeLike {
|
|
@@ -66,6 +73,7 @@ interface CopilotSseRuntimeLike extends CopilotRuntimeLike {
|
|
|
66
73
|
}
|
|
67
74
|
interface CopilotIntelligenceRuntimeLike extends CopilotRuntimeLike {
|
|
68
75
|
intelligence: CopilotKitIntelligence;
|
|
76
|
+
identifyUser: IdentifyUserCallback;
|
|
69
77
|
generateThreadNames: boolean;
|
|
70
78
|
mode: RUNTIME_MODE_INTELLIGENCE;
|
|
71
79
|
}
|
|
@@ -88,6 +96,7 @@ declare class CopilotSseRuntime extends BaseCopilotRuntime implements CopilotSse
|
|
|
88
96
|
}
|
|
89
97
|
declare class CopilotIntelligenceRuntime extends BaseCopilotRuntime implements CopilotIntelligenceRuntimeLike {
|
|
90
98
|
readonly intelligence: CopilotKitIntelligence;
|
|
99
|
+
readonly identifyUser: IdentifyUserCallback;
|
|
91
100
|
readonly generateThreadNames: boolean;
|
|
92
101
|
readonly mode: any;
|
|
93
102
|
constructor(options: CopilotIntelligenceRuntimeOptions);
|
|
@@ -109,8 +118,9 @@ declare class CopilotRuntime implements CopilotRuntimeLike {
|
|
|
109
118
|
get mcpApps(): CopilotRuntimeOptions["mcpApps"];
|
|
110
119
|
get intelligence(): CopilotKitIntelligence | undefined;
|
|
111
120
|
get generateThreadNames(): boolean | undefined;
|
|
121
|
+
get identifyUser(): IdentifyUserCallback | undefined;
|
|
112
122
|
get mode(): RuntimeMode;
|
|
113
123
|
}
|
|
114
124
|
//#endregion
|
|
115
|
-
export { CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeLike, CopilotRuntimeOptions, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, McpAppsConfig, McpAppsServerConfig, VERSION, isIntelligenceRuntime };
|
|
125
|
+
export { CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeLike, CopilotRuntimeOptions, CopilotRuntimeUser, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, IdentifyUserCallback, McpAppsConfig, McpAppsServerConfig, VERSION, isIntelligenceRuntime };
|
|
116
126
|
//# sourceMappingURL=runtime.d.cts.map
|
package/dist/runtime.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.cts","names":[],"sources":["../src/runtime.ts"],"mappings":";;;;;;;;;;cAqBa,OAAA;AAAA,UAEH,mCAAA;EAFG;EAIX,MAAA;AAAA;AAAA,KAGU,mBAAA,GAAsB,eAAA;EAPA,uFAShC,OAAA;AAAA;AAAA,UAGe,aAAA;EARf;EAUA,OAAA,EAAS,mBAAA;AAAA;AAAA,UAGD,yBAAA;;EAER,IAAA,GAAO,mCAAA,GAAsC,oBAAA;EAVtC;EAYP,OAAA,GAAU,aAAA;AAAA;AAAA,UAGF,yBAAA,SAAkC,yBAAA;EAV1C;EAYA,MAAA,EAAQ,YAAA,CAAa,cAAA,CAAe,MAAA,SAAe,aAAA;EAT3C;EAWR,oBAAA,GAAuB,oBAAA;;EAEvB,uBAAA,GAA0B,uBAAA;EAXmB;EAa7C,sBAAA,GAAyB,sBAAA;AAAA;AAAA,UAGV,wBAAA,SAAiC,yBAAA;
|
|
1
|
+
{"version":3,"file":"runtime.d.cts","names":[],"sources":["../src/runtime.ts"],"mappings":";;;;;;;;;;cAqBa,OAAA;AAAA,UAEH,mCAAA;EAFG;EAIX,MAAA;AAAA;AAAA,KAGU,mBAAA,GAAsB,eAAA;EAPA,uFAShC,OAAA;AAAA;AAAA,UAGe,aAAA;EARf;EAUA,OAAA,EAAS,mBAAA;AAAA;AAAA,UAGD,yBAAA;;EAER,IAAA,GAAO,mCAAA,GAAsC,oBAAA;EAVtC;EAYP,OAAA,GAAU,aAAA;AAAA;AAAA,UAGF,yBAAA,SAAkC,yBAAA;EAV1C;EAYA,MAAA,EAAQ,YAAA,CAAa,cAAA,CAAe,MAAA,SAAe,aAAA;EAT3C;EAWR,oBAAA,GAAuB,oBAAA;;EAEvB,uBAAA,GAA0B,uBAAA;EAXmB;EAa7C,sBAAA,GAA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,kBAAA,YACG,qBAAA;EAAA,SAEF,YAAA;EAAA,SACA,IAAA;cAEG,OAAA,EAAS,wBAAA;AAAA;AAAA,cAKV,0BAAA,SACH,kBAAA,YACG,8BAAA;EAAA,SAEF,YAAA,EAAc,sBAAA;EAAA,SACd,YAAA,EAAc,oBAAA;EAAA,SACd,mBAAA;EAAA,SACA,IAAA;cAEG,OAAA,EAAS,iCAAA;AAAA;AAAA,iBAoBP,qBAAA,CACd,OAAA,EAAS,kBAAA,GACR,OAAA,IAAW,8BAAA;;;;;cAQD,cAAA,YAA0B,kBAAA;EAAA,QAC7B,QAAA;cAEI,OAAA,EAAS,qBAAA;EAAA,IAMjB,MAAA,CAAA,GAAU,qBAAA;EAAA,IAIV,oBAAA,CAAA,GAAwB,qBAAA;EAAA,IAIxB,uBAAA,CAAA,GAA2B,qBAAA;EAAA,IAI3B,sBAAA,CAAA,GAA0B,qBAAA;EAAA,IAI1B,MAAA,CAAA,GAAU,WAAA;EAAA,IAIV,IAAA,CAAA,GAAQ,qBAAA;EAAA,IAIR,OAAA,CAAA,GAAW,qBAAA;EAAA,IAIX,YAAA,CAAA,GAAgB,sBAAA;EAAA,IAIhB,mBAAA,CAAA;EAAA,IAMA,YAAA,CAAA,GAAgB,oBAAA;EAAA,IAMhB,IAAA,CAAA,GAAQ,WAAA;AAAA"}
|
package/dist/runtime.d.mts
CHANGED
|
@@ -37,6 +37,10 @@ interface BaseCopilotRuntimeOptions extends CopilotRuntimeMiddlewares {
|
|
|
37
37
|
/** Optional *after* middleware – callback function or webhook URL. */
|
|
38
38
|
afterRequestMiddleware?: AfterRequestMiddleware;
|
|
39
39
|
}
|
|
40
|
+
interface CopilotRuntimeUser {
|
|
41
|
+
id: string;
|
|
42
|
+
}
|
|
43
|
+
type IdentifyUserCallback = (request: Request) => MaybePromise<CopilotRuntimeUser>;
|
|
40
44
|
interface CopilotSseRuntimeOptions extends BaseCopilotRuntimeOptions {
|
|
41
45
|
/** The runner to use for running agents in SSE mode. */
|
|
42
46
|
runner?: AgentRunner;
|
|
@@ -46,6 +50,8 @@ interface CopilotSseRuntimeOptions extends BaseCopilotRuntimeOptions {
|
|
|
46
50
|
interface CopilotIntelligenceRuntimeOptions extends BaseCopilotRuntimeOptions {
|
|
47
51
|
/** Configures Intelligence mode for durable threads and realtime events. */
|
|
48
52
|
intelligence: CopilotKitIntelligence;
|
|
53
|
+
/** Resolves the authenticated user for intelligence requests. */
|
|
54
|
+
identifyUser: IdentifyUserCallback;
|
|
49
55
|
/** Auto-generate short names for newly created threads. */
|
|
50
56
|
generateThreadNames?: boolean;
|
|
51
57
|
}
|
|
@@ -59,6 +65,7 @@ interface CopilotRuntimeLike {
|
|
|
59
65
|
a2ui: CopilotRuntimeOptions["a2ui"];
|
|
60
66
|
mcpApps: CopilotRuntimeOptions["mcpApps"];
|
|
61
67
|
intelligence?: CopilotKitIntelligence;
|
|
68
|
+
identifyUser?: IdentifyUserCallback;
|
|
62
69
|
mode: RuntimeMode;
|
|
63
70
|
}
|
|
64
71
|
interface CopilotSseRuntimeLike extends CopilotRuntimeLike {
|
|
@@ -67,6 +74,7 @@ interface CopilotSseRuntimeLike extends CopilotRuntimeLike {
|
|
|
67
74
|
}
|
|
68
75
|
interface CopilotIntelligenceRuntimeLike extends CopilotRuntimeLike {
|
|
69
76
|
intelligence: CopilotKitIntelligence;
|
|
77
|
+
identifyUser: IdentifyUserCallback;
|
|
70
78
|
generateThreadNames: boolean;
|
|
71
79
|
mode: RUNTIME_MODE_INTELLIGENCE;
|
|
72
80
|
}
|
|
@@ -89,6 +97,7 @@ declare class CopilotSseRuntime extends BaseCopilotRuntime implements CopilotSse
|
|
|
89
97
|
}
|
|
90
98
|
declare class CopilotIntelligenceRuntime extends BaseCopilotRuntime implements CopilotIntelligenceRuntimeLike {
|
|
91
99
|
readonly intelligence: CopilotKitIntelligence;
|
|
100
|
+
readonly identifyUser: IdentifyUserCallback;
|
|
92
101
|
readonly generateThreadNames: boolean;
|
|
93
102
|
readonly mode: any;
|
|
94
103
|
constructor(options: CopilotIntelligenceRuntimeOptions);
|
|
@@ -110,8 +119,9 @@ declare class CopilotRuntime implements CopilotRuntimeLike {
|
|
|
110
119
|
get mcpApps(): CopilotRuntimeOptions["mcpApps"];
|
|
111
120
|
get intelligence(): CopilotKitIntelligence | undefined;
|
|
112
121
|
get generateThreadNames(): boolean | undefined;
|
|
122
|
+
get identifyUser(): IdentifyUserCallback | undefined;
|
|
113
123
|
get mode(): RuntimeMode;
|
|
114
124
|
}
|
|
115
125
|
//#endregion
|
|
116
|
-
export { CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeLike, CopilotRuntimeOptions, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, McpAppsConfig, McpAppsServerConfig, VERSION, isIntelligenceRuntime };
|
|
126
|
+
export { CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeLike, CopilotRuntimeOptions, CopilotRuntimeUser, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, IdentifyUserCallback, McpAppsConfig, McpAppsServerConfig, VERSION, isIntelligenceRuntime };
|
|
117
127
|
//# sourceMappingURL=runtime.d.mts.map
|
package/dist/runtime.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/runtime.ts"],"mappings":";;;;;;;;;;;cAqBa,OAAA;AAAA,UAEH,mCAAA;;EAER,MAAA;AAAA;AAAA,KAGU,mBAAA,GAAsB,eAAA;EAPA,uFAShC,OAAA;AAAA;AAAA,UAGe,aAAA;;EAEf,OAAA,EAAS,mBAAA;AAAA;AAAA,UAGD,yBAAA;EAVqB;EAY7B,IAAA,GAAO,mCAAA,GAAsC,oBAAA;EAZb;EAchC,OAAA,GAAU,aAAA;AAAA;AAAA,UAGF,yBAAA,SAA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qBAAA;EAAA,IAIxB,uBAAA,CAAA,GAA2B,qBAAA;EAAA,IAI3B,sBAAA,CAAA,GAA0B,qBAAA;EAAA,IAI1B,MAAA,CAAA,GAAU,WAAA;EAAA,IAIV,IAAA,CAAA,GAAQ,qBAAA;EAAA,IAIR,OAAA,CAAA,GAAW,qBAAA;EAAA,IAIX,YAAA,CAAA,GAAgB,sBAAA;EAAA,IAIhB,mBAAA,CAAA;EAAA,IAMA,YAAA,CAAA,GAAgB,oBAAA;EAAA,IAMhB,IAAA,CAAA,GAAQ,WAAA;AAAA"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -33,6 +33,7 @@ var CopilotSseRuntime = class extends BaseCopilotRuntime {
|
|
|
33
33
|
};
|
|
34
34
|
var CopilotIntelligenceRuntime = class extends BaseCopilotRuntime {
|
|
35
35
|
intelligence;
|
|
36
|
+
identifyUser;
|
|
36
37
|
generateThreadNames;
|
|
37
38
|
mode = RUNTIME_MODE_INTELLIGENCE;
|
|
38
39
|
constructor(options) {
|
|
@@ -41,6 +42,7 @@ var CopilotIntelligenceRuntime = class extends BaseCopilotRuntime {
|
|
|
41
42
|
authToken: options.intelligence.ɵgetRunnerAuthToken()
|
|
42
43
|
}));
|
|
43
44
|
this.intelligence = options.intelligence;
|
|
45
|
+
this.identifyUser = options.identifyUser;
|
|
44
46
|
this.generateThreadNames = options.generateThreadNames ?? true;
|
|
45
47
|
}
|
|
46
48
|
};
|
|
@@ -86,6 +88,9 @@ var CopilotRuntime = class {
|
|
|
86
88
|
get generateThreadNames() {
|
|
87
89
|
return isIntelligenceRuntime(this.delegate) ? this.delegate.generateThreadNames : void 0;
|
|
88
90
|
}
|
|
91
|
+
get identifyUser() {
|
|
92
|
+
return isIntelligenceRuntime(this.delegate) ? this.delegate.identifyUser : void 0;
|
|
93
|
+
}
|
|
89
94
|
get mode() {
|
|
90
95
|
return this.delegate.mode;
|
|
91
96
|
}
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":["pkg.version"],"sources":["../src/runtime.ts"],"sourcesContent":["import {\n MaybePromise,\n NonEmptyRecord,\n RuntimeMode,\n RUNTIME_MODE_SSE,\n RUNTIME_MODE_INTELLIGENCE,\n} from \"@copilotkitnext/shared\";\nimport { AbstractAgent } from \"@ag-ui/client\";\nimport type { MCPClientConfig } from \"@ag-ui/mcp-apps-middleware\";\nimport { A2UIMiddlewareConfig } from \"@ag-ui/a2ui-middleware\";\nimport pkg from \"../package.json\";\nimport type {\n BeforeRequestMiddleware,\n AfterRequestMiddleware,\n} from \"./middleware\";\nimport { TranscriptionService } from \"./transcription-service/transcription-service\";\nimport { AgentRunner } from \"./runner/agent-runner\";\nimport { InMemoryAgentRunner } from \"./runner/in-memory\";\nimport { IntelligenceAgentRunner } from \"./runner/intelligence\";\nimport { CopilotKitIntelligence } from \"./intelligence-platform\";\n\nexport const VERSION = pkg.version;\n\ninterface BaseCopilotRuntimeMiddlewareOptions {\n /** If set, middleware only applies to these named agents. Applies to all agents if omitted. */\n agents?: string[];\n}\n\nexport type McpAppsServerConfig = MCPClientConfig & {\n /** Agent to bind this server to. If omitted, the server is available to all agents. */\n agentId?: string;\n};\n\nexport interface McpAppsConfig {\n /** List of MCP server configurations. */\n servers: McpAppsServerConfig[];\n}\n\ninterface CopilotRuntimeMiddlewares {\n /** Auto-apply A2UIMiddleware to agents at run time. */\n a2ui?: BaseCopilotRuntimeMiddlewareOptions & A2UIMiddlewareConfig;\n /** Auto-apply MCPAppsMiddleware to agents at run time. */\n mcpApps?: McpAppsConfig;\n}\n\ninterface BaseCopilotRuntimeOptions extends CopilotRuntimeMiddlewares {\n /** Map of available agents (loaded lazily is fine). */\n agents: MaybePromise<NonEmptyRecord<Record<string, AbstractAgent>>>;\n /** Optional transcription service for audio processing. */\n transcriptionService?: TranscriptionService;\n /** Optional *before* middleware – callback function or webhook URL. */\n beforeRequestMiddleware?: BeforeRequestMiddleware;\n /** Optional *after* middleware – callback function or webhook URL. */\n afterRequestMiddleware?: AfterRequestMiddleware;\n}\n\nexport interface CopilotSseRuntimeOptions extends BaseCopilotRuntimeOptions {\n /** The runner to use for running agents in SSE mode. */\n runner?: AgentRunner;\n intelligence?: undefined;\n generateThreadNames?: undefined;\n}\n\nexport interface CopilotIntelligenceRuntimeOptions extends BaseCopilotRuntimeOptions {\n /** Configures Intelligence mode for durable threads and realtime events. */\n intelligence: CopilotKitIntelligence;\n /** Auto-generate short names for newly created threads. */\n generateThreadNames?: boolean;\n}\n\nexport type CopilotRuntimeOptions =\n | CopilotSseRuntimeOptions\n | CopilotIntelligenceRuntimeOptions;\n\nexport interface CopilotRuntimeLike {\n agents: CopilotRuntimeOptions[\"agents\"];\n transcriptionService: CopilotRuntimeOptions[\"transcriptionService\"];\n beforeRequestMiddleware: CopilotRuntimeOptions[\"beforeRequestMiddleware\"];\n afterRequestMiddleware: CopilotRuntimeOptions[\"afterRequestMiddleware\"];\n runner: AgentRunner;\n a2ui: CopilotRuntimeOptions[\"a2ui\"];\n mcpApps: CopilotRuntimeOptions[\"mcpApps\"];\n intelligence?: CopilotKitIntelligence;\n mode: RuntimeMode;\n}\n\nexport interface CopilotSseRuntimeLike extends CopilotRuntimeLike {\n intelligence?: undefined;\n mode: RUNTIME_MODE_SSE;\n}\n\nexport interface CopilotIntelligenceRuntimeLike extends CopilotRuntimeLike {\n intelligence: CopilotKitIntelligence;\n generateThreadNames: boolean;\n mode: RUNTIME_MODE_INTELLIGENCE;\n}\n\nabstract class BaseCopilotRuntime implements CopilotRuntimeLike {\n public agents: CopilotRuntimeOptions[\"agents\"];\n public transcriptionService: CopilotRuntimeOptions[\"transcriptionService\"];\n public beforeRequestMiddleware: CopilotRuntimeOptions[\"beforeRequestMiddleware\"];\n public afterRequestMiddleware: CopilotRuntimeOptions[\"afterRequestMiddleware\"];\n public runner: AgentRunner;\n public a2ui: CopilotRuntimeOptions[\"a2ui\"];\n public mcpApps: CopilotRuntimeOptions[\"mcpApps\"];\n\n abstract readonly intelligence?: CopilotKitIntelligence;\n abstract readonly mode: RuntimeMode;\n\n constructor(options: BaseCopilotRuntimeOptions, runner: AgentRunner) {\n const {\n agents,\n transcriptionService,\n beforeRequestMiddleware,\n afterRequestMiddleware,\n a2ui,\n mcpApps,\n } = options;\n\n this.agents = agents;\n this.transcriptionService = transcriptionService;\n this.beforeRequestMiddleware = beforeRequestMiddleware;\n this.afterRequestMiddleware = afterRequestMiddleware;\n this.a2ui = a2ui;\n this.mcpApps = mcpApps;\n this.runner = runner;\n }\n}\n\nexport class CopilotSseRuntime\n extends BaseCopilotRuntime\n implements CopilotSseRuntimeLike\n{\n readonly intelligence = undefined;\n readonly mode = RUNTIME_MODE_SSE;\n\n constructor(options: CopilotSseRuntimeOptions) {\n super(options, options.runner ?? new InMemoryAgentRunner());\n }\n}\n\nexport class CopilotIntelligenceRuntime\n extends BaseCopilotRuntime\n implements CopilotIntelligenceRuntimeLike\n{\n readonly intelligence: CopilotKitIntelligence;\n readonly generateThreadNames: boolean;\n readonly mode = RUNTIME_MODE_INTELLIGENCE;\n\n constructor(options: CopilotIntelligenceRuntimeOptions) {\n super(\n options,\n new IntelligenceAgentRunner({\n url: options.intelligence.ɵgetRunnerWsUrl(),\n authToken: options.intelligence.ɵgetRunnerAuthToken(),\n }),\n );\n this.intelligence = options.intelligence;\n this.generateThreadNames = options.generateThreadNames ?? true;\n }\n}\n\nfunction hasIntelligenceOptions(\n options: CopilotRuntimeOptions,\n): options is CopilotIntelligenceRuntimeOptions {\n return \"intelligence\" in options && !!options.intelligence;\n}\n\nexport function isIntelligenceRuntime(\n runtime: CopilotRuntimeLike,\n): runtime is CopilotIntelligenceRuntimeLike {\n return runtime.mode === RUNTIME_MODE_INTELLIGENCE && !!runtime.intelligence;\n}\n\n/**\n * Compatibility shim that preserves the legacy `CopilotRuntime` entrypoint.\n * New code should prefer `CopilotSseRuntime` or `CopilotIntelligenceRuntime`.\n */\nexport class CopilotRuntime implements CopilotRuntimeLike {\n private delegate: CopilotRuntimeLike;\n\n constructor(options: CopilotRuntimeOptions) {\n this.delegate = hasIntelligenceOptions(options)\n ? new CopilotIntelligenceRuntime(options)\n : new CopilotSseRuntime(options);\n }\n\n get agents(): CopilotRuntimeOptions[\"agents\"] {\n return this.delegate.agents;\n }\n\n get transcriptionService(): CopilotRuntimeOptions[\"transcriptionService\"] {\n return this.delegate.transcriptionService;\n }\n\n get beforeRequestMiddleware(): CopilotRuntimeOptions[\"beforeRequestMiddleware\"] {\n return this.delegate.beforeRequestMiddleware;\n }\n\n get afterRequestMiddleware(): CopilotRuntimeOptions[\"afterRequestMiddleware\"] {\n return this.delegate.afterRequestMiddleware;\n }\n\n get runner(): AgentRunner {\n return this.delegate.runner;\n }\n\n get a2ui(): CopilotRuntimeOptions[\"a2ui\"] {\n return this.delegate.a2ui;\n }\n\n get mcpApps(): CopilotRuntimeOptions[\"mcpApps\"] {\n return this.delegate.mcpApps;\n }\n\n get intelligence(): CopilotKitIntelligence | undefined {\n return this.delegate.intelligence;\n }\n\n get generateThreadNames(): boolean | undefined {\n return isIntelligenceRuntime(this.delegate)\n ? this.delegate.generateThreadNames\n : undefined;\n }\n\n get mode(): RuntimeMode {\n return this.delegate.mode;\n }\n}\n"],"mappings":";;;;;;AAqBA,MAAa,UAAUA;
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":["pkg.version"],"sources":["../src/runtime.ts"],"sourcesContent":["import {\n MaybePromise,\n NonEmptyRecord,\n RuntimeMode,\n RUNTIME_MODE_SSE,\n RUNTIME_MODE_INTELLIGENCE,\n} from \"@copilotkitnext/shared\";\nimport { AbstractAgent } from \"@ag-ui/client\";\nimport type { MCPClientConfig } from \"@ag-ui/mcp-apps-middleware\";\nimport { A2UIMiddlewareConfig } from \"@ag-ui/a2ui-middleware\";\nimport pkg from \"../package.json\";\nimport type {\n BeforeRequestMiddleware,\n AfterRequestMiddleware,\n} from \"./middleware\";\nimport { TranscriptionService } from \"./transcription-service/transcription-service\";\nimport { AgentRunner } from \"./runner/agent-runner\";\nimport { InMemoryAgentRunner } from \"./runner/in-memory\";\nimport { IntelligenceAgentRunner } from \"./runner/intelligence\";\nimport { CopilotKitIntelligence } from \"./intelligence-platform\";\n\nexport const VERSION = pkg.version;\n\ninterface BaseCopilotRuntimeMiddlewareOptions {\n /** If set, middleware only applies to these named agents. Applies to all agents if omitted. */\n agents?: string[];\n}\n\nexport type McpAppsServerConfig = MCPClientConfig & {\n /** Agent to bind this server to. If omitted, the server is available to all agents. */\n agentId?: string;\n};\n\nexport interface McpAppsConfig {\n /** List of MCP server configurations. */\n servers: McpAppsServerConfig[];\n}\n\ninterface CopilotRuntimeMiddlewares {\n /** Auto-apply A2UIMiddleware to agents at run time. */\n a2ui?: BaseCopilotRuntimeMiddlewareOptions & A2UIMiddlewareConfig;\n /** Auto-apply MCPAppsMiddleware to agents at run time. */\n mcpApps?: McpAppsConfig;\n}\n\ninterface BaseCopilotRuntimeOptions extends CopilotRuntimeMiddlewares {\n /** Map of available agents (loaded lazily is fine). */\n agents: MaybePromise<NonEmptyRecord<Record<string, AbstractAgent>>>;\n /** Optional transcription service for audio processing. */\n transcriptionService?: TranscriptionService;\n /** Optional *before* middleware – callback function or webhook URL. */\n beforeRequestMiddleware?: BeforeRequestMiddleware;\n /** Optional *after* middleware – callback function or webhook URL. */\n afterRequestMiddleware?: AfterRequestMiddleware;\n}\n\nexport interface CopilotRuntimeUser {\n id: string;\n}\n\nexport type IdentifyUserCallback = (\n request: Request,\n) => MaybePromise<CopilotRuntimeUser>;\n\nexport interface CopilotSseRuntimeOptions extends BaseCopilotRuntimeOptions {\n /** The runner to use for running agents in SSE mode. */\n runner?: AgentRunner;\n intelligence?: undefined;\n generateThreadNames?: undefined;\n}\n\nexport interface CopilotIntelligenceRuntimeOptions extends BaseCopilotRuntimeOptions {\n /** Configures Intelligence mode for durable threads and realtime events. */\n intelligence: CopilotKitIntelligence;\n /** Resolves the authenticated user for intelligence requests. */\n identifyUser: IdentifyUserCallback;\n /** Auto-generate short names for newly created threads. */\n generateThreadNames?: boolean;\n}\n\nexport type CopilotRuntimeOptions =\n | CopilotSseRuntimeOptions\n | CopilotIntelligenceRuntimeOptions;\n\nexport interface CopilotRuntimeLike {\n agents: CopilotRuntimeOptions[\"agents\"];\n transcriptionService: CopilotRuntimeOptions[\"transcriptionService\"];\n beforeRequestMiddleware: CopilotRuntimeOptions[\"beforeRequestMiddleware\"];\n afterRequestMiddleware: CopilotRuntimeOptions[\"afterRequestMiddleware\"];\n runner: AgentRunner;\n a2ui: CopilotRuntimeOptions[\"a2ui\"];\n mcpApps: CopilotRuntimeOptions[\"mcpApps\"];\n intelligence?: CopilotKitIntelligence;\n identifyUser?: IdentifyUserCallback;\n mode: RuntimeMode;\n}\n\nexport interface CopilotSseRuntimeLike extends CopilotRuntimeLike {\n intelligence?: undefined;\n mode: RUNTIME_MODE_SSE;\n}\n\nexport interface CopilotIntelligenceRuntimeLike extends CopilotRuntimeLike {\n intelligence: CopilotKitIntelligence;\n identifyUser: IdentifyUserCallback;\n generateThreadNames: boolean;\n mode: RUNTIME_MODE_INTELLIGENCE;\n}\n\nabstract class BaseCopilotRuntime implements CopilotRuntimeLike {\n public agents: CopilotRuntimeOptions[\"agents\"];\n public transcriptionService: CopilotRuntimeOptions[\"transcriptionService\"];\n public beforeRequestMiddleware: CopilotRuntimeOptions[\"beforeRequestMiddleware\"];\n public afterRequestMiddleware: CopilotRuntimeOptions[\"afterRequestMiddleware\"];\n public runner: AgentRunner;\n public a2ui: CopilotRuntimeOptions[\"a2ui\"];\n public mcpApps: CopilotRuntimeOptions[\"mcpApps\"];\n\n abstract readonly intelligence?: CopilotKitIntelligence;\n abstract readonly mode: RuntimeMode;\n\n constructor(options: BaseCopilotRuntimeOptions, runner: AgentRunner) {\n const {\n agents,\n transcriptionService,\n beforeRequestMiddleware,\n afterRequestMiddleware,\n a2ui,\n mcpApps,\n } = options;\n\n this.agents = agents;\n this.transcriptionService = transcriptionService;\n this.beforeRequestMiddleware = beforeRequestMiddleware;\n this.afterRequestMiddleware = afterRequestMiddleware;\n this.a2ui = a2ui;\n this.mcpApps = mcpApps;\n this.runner = runner;\n }\n}\n\nexport class CopilotSseRuntime\n extends BaseCopilotRuntime\n implements CopilotSseRuntimeLike\n{\n readonly intelligence = undefined;\n readonly mode = RUNTIME_MODE_SSE;\n\n constructor(options: CopilotSseRuntimeOptions) {\n super(options, options.runner ?? new InMemoryAgentRunner());\n }\n}\n\nexport class CopilotIntelligenceRuntime\n extends BaseCopilotRuntime\n implements CopilotIntelligenceRuntimeLike\n{\n readonly intelligence: CopilotKitIntelligence;\n readonly identifyUser: IdentifyUserCallback;\n readonly generateThreadNames: boolean;\n readonly mode = RUNTIME_MODE_INTELLIGENCE;\n\n constructor(options: CopilotIntelligenceRuntimeOptions) {\n super(\n options,\n new IntelligenceAgentRunner({\n url: options.intelligence.ɵgetRunnerWsUrl(),\n authToken: options.intelligence.ɵgetRunnerAuthToken(),\n }),\n );\n this.intelligence = options.intelligence;\n this.identifyUser = options.identifyUser;\n this.generateThreadNames = options.generateThreadNames ?? true;\n }\n}\n\nfunction hasIntelligenceOptions(\n options: CopilotRuntimeOptions,\n): options is CopilotIntelligenceRuntimeOptions {\n return \"intelligence\" in options && !!options.intelligence;\n}\n\nexport function isIntelligenceRuntime(\n runtime: CopilotRuntimeLike,\n): runtime is CopilotIntelligenceRuntimeLike {\n return runtime.mode === RUNTIME_MODE_INTELLIGENCE && !!runtime.intelligence;\n}\n\n/**\n * Compatibility shim that preserves the legacy `CopilotRuntime` entrypoint.\n * New code should prefer `CopilotSseRuntime` or `CopilotIntelligenceRuntime`.\n */\nexport class CopilotRuntime implements CopilotRuntimeLike {\n private delegate: CopilotRuntimeLike;\n\n constructor(options: CopilotRuntimeOptions) {\n this.delegate = hasIntelligenceOptions(options)\n ? new CopilotIntelligenceRuntime(options)\n : new CopilotSseRuntime(options);\n }\n\n get agents(): CopilotRuntimeOptions[\"agents\"] {\n return this.delegate.agents;\n }\n\n get transcriptionService(): CopilotRuntimeOptions[\"transcriptionService\"] {\n return this.delegate.transcriptionService;\n }\n\n get beforeRequestMiddleware(): CopilotRuntimeOptions[\"beforeRequestMiddleware\"] {\n return this.delegate.beforeRequestMiddleware;\n }\n\n get afterRequestMiddleware(): CopilotRuntimeOptions[\"afterRequestMiddleware\"] {\n return this.delegate.afterRequestMiddleware;\n }\n\n get runner(): AgentRunner {\n return this.delegate.runner;\n }\n\n get a2ui(): CopilotRuntimeOptions[\"a2ui\"] {\n return this.delegate.a2ui;\n }\n\n get mcpApps(): CopilotRuntimeOptions[\"mcpApps\"] {\n return this.delegate.mcpApps;\n }\n\n get intelligence(): CopilotKitIntelligence | undefined {\n return this.delegate.intelligence;\n }\n\n get generateThreadNames(): boolean | undefined {\n return isIntelligenceRuntime(this.delegate)\n ? this.delegate.generateThreadNames\n : undefined;\n }\n\n get identifyUser(): IdentifyUserCallback | undefined {\n return isIntelligenceRuntime(this.delegate)\n ? this.delegate.identifyUser\n : undefined;\n }\n\n get mode(): RuntimeMode {\n return this.delegate.mode;\n }\n}\n"],"mappings":";;;;;;AAqBA,MAAa,UAAUA;AAwFvB,IAAe,qBAAf,MAAgE;CAC9D,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CAKP,YAAY,SAAoC,QAAqB;EACnE,MAAM,EACJ,QACA,sBACA,yBACA,wBACA,MACA,YACE;AAEJ,OAAK,SAAS;AACd,OAAK,uBAAuB;AAC5B,OAAK,0BAA0B;AAC/B,OAAK,yBAAyB;AAC9B,OAAK,OAAO;AACZ,OAAK,UAAU;AACf,OAAK,SAAS;;;AAIlB,IAAa,oBAAb,cACU,mBAEV;CACE,AAAS,eAAe;CACxB,AAAS,OAAO;CAEhB,YAAY,SAAmC;AAC7C,QAAM,SAAS,QAAQ,UAAU,IAAI,qBAAqB,CAAC;;;AAI/D,IAAa,6BAAb,cACU,mBAEV;CACE,AAAS;CACT,AAAS;CACT,AAAS;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