chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:58:18 +08:00
commit 6d5d58c1a9
18293 changed files with 3502153 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
import express from "express";
import dotenv from "dotenv";
import { z } from "zod";
import {
CopilotRuntime,
createCopilotEndpointSingleRouteExpress,
BuiltInAgent,
defineTool,
ToolDefinition,
} from "@copilotkit/runtime/v2";
dotenv.config();
const roastTool = defineTool({
name: "sayHello",
description: "Say hello while roasting the user's name",
parameters: z.object({
roast: z.string().describe("A playful roast about the user's name"),
}),
execute: async ({ roast }) => {
console.log(roast);
return "The person has been roasted.";
},
}) as unknown as ToolDefinition;
const runtime = new CopilotRuntime({
agents: {
default: new BuiltInAgent({
model: "openai/gpt-4o-mini",
tools: [roastTool],
}),
},
});
const app = express();
app.use(
"/api/copilotkit",
createCopilotEndpointSingleRouteExpress({
runtime,
basePath: "/",
}),
);
const port = Number(process.env.PORT ?? 4000);
app.listen(port, () => {
console.log(
`CopilotKit v2 runtime listening at http://localhost:${port}/api/copilotkit`,
);
});