Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ storybook-static
# Angular
.angular/
.playwright-mcp/

.pnpm-store
2 changes: 1 addition & 1 deletion apps/angular/demo-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "node --env-file=.env --loader tsx src/index.ts"
},
"dependencies": {
"@ag-ui/client": "0.0.40-alpha.3",
"@ag-ui/client": "0.0.40-alpha.6",
"@ag-ui/langgraph": "^0.0.11",
"@copilotkitnext/demo-agents": "workspace:^",
"@copilotkitnext/runtime": "workspace:^",
Expand Down
19 changes: 14 additions & 5 deletions apps/angular/demo-server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import { serve } from "@hono/node-server";
import { Hono } from "hono";
import { cors } from "hono/cors";
import { CopilotRuntime, createCopilotEndpoint, InMemoryAgentRunner } from "@copilotkitnext/runtime";
import { OpenAIAgent, SlowToolCallStreamingAgent } from "@copilotkitnext/demo-agents";
import {
CopilotRuntime,
createCopilotEndpoint,
InMemoryAgentRunner,
} from "@copilotkitnext/runtime";
import {
OpenAIAgent,
SlowToolCallStreamingAgent,
} from "@copilotkitnext/demo-agents";

const runtime = new CopilotRuntime({
agents: {
// @ts-ignore
default: new OpenAIAgent(),
default: new SlowToolCallStreamingAgent(),
},
runner: new InMemoryAgentRunner(),
});
Expand All @@ -25,7 +32,7 @@ app.use(
exposeHeaders: ["Content-Type"],
credentials: true,
maxAge: 86400,
}),
})
);

// Create the CopilotKit endpoint
Expand All @@ -39,4 +46,6 @@ app.route("/", copilotApp);

const port = Number(process.env.PORT || 3001);
serve({ fetch: app.fetch, port });
console.log(`CopilotKit runtime listening at http://localhost:${port}/api/copilotkit`);
console.log(
`CopilotKit runtime listening at http://localhost:${port}/api/copilotkit`
);
1 change: 0 additions & 1 deletion apps/angular/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@copilotkitnext/angular": "workspace:*",
"rxjs": "^7.8.1",
"tslib": "^2.8.1",
"zod": "^3.25.75",
"zone.js": "^0.14.0"
},
"devDependencies": {
Expand Down
11 changes: 7 additions & 4 deletions apps/angular/demo/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ApplicationConfig, importProvidersFrom } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { provideCopilotKit, provideCopilotChatLabels } from "@copilotkitnext/angular";
import {
provideCopilotKit,
provideCopilotChatLabels,
} from "@copilotkitnext/angular";
import { WildcardToolRenderComponent } from "./components/wildcard-tool-render.component";
import { helloWorldToolConfig } from "./tools/hello-world";

export const appConfig: ApplicationConfig = {
providers: [
Expand All @@ -15,12 +17,13 @@ export const appConfig: ApplicationConfig = {
component: WildcardToolRenderComponent,
} as any,
],
frontendTools: [helloWorldToolConfig],
frontendTools: [],
humanInTheLoop: [],
}),
provideCopilotChatLabels({
chatInputPlaceholder: "Ask me anything...",
chatDisclaimerText: "CopilotKit Angular Demo - AI responses may need verification.",
chatDisclaimerText:
"CopilotKit Angular Demo - AI responses may need verification.",
}),
],
};
27 changes: 0 additions & 27 deletions apps/angular/demo/src/app/tools/hello-world.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/angular/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"storybook:build": "ng run storybook-angular:build-storybook"
},
"dependencies": {
"@ag-ui/client": "0.0.40-alpha.3",
"@ag-ui/client": "0.0.40-alpha.6",
"@angular/animations": "^18.2.0",
"@angular/common": "^18.2.0",
"@angular/compiler": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/react/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@ag-ui/client": "0.0.40-alpha.3",
"@ag-ui/client": "0.0.40-alpha.6",
"@copilotkitnext/agent": "workspace:*",
"@copilotkitnext/core": "workspace:*",
"@copilotkitnext/react": "workspace:*",
Expand Down
7 changes: 3 additions & 4 deletions apps/react/demo/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"use client";

import { HttpAgent } from "@ag-ui/client";
import {
CopilotChat,
CopilotKitProvider,
useFrontendTool,
defineToolCallRenderer,
useConfigureSuggestions,
type ToolsMenuItem,
} from "@copilotkitnext/react";
import type { ToolsMenuItem } from "@copilotkitnext/react";
import { z } from "zod";
import { useMemo } from "react";

Expand Down Expand Up @@ -76,7 +75,7 @@ function Chat() {
return `Hello ${name}`;
},
});
const toolsMenu = useMemo<("-" | ToolsMenuItem)[]>(
const toolsMenu = useMemo<(ToolsMenuItem | "-")[]>(
() => [
{
label: "Say hi to CopilotKit",
Expand Down Expand Up @@ -108,5 +107,5 @@ function Chat() {
[],
);

return <CopilotChat inputProps={{ toolsMenu }} />;
return <CopilotChat inputProps={{ toolsMenu }} threadId="xyz" />;
}
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "CopilotKitNext",
"private": true,
"scripts": {
"predev": "turbo run build --filter='@copilotkitnext/core' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' --filter='@copilotkitnext/react' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/agent'",
"predev": "turbo run build --filter='@copilotkitnext/core' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' --filter='@copilotkitnext/react' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/agent' --filter='@copilotkitnext/sqlite-runner'",
"build": "turbo run build",
"clean": "turbo run clean",
"dev": "turbo run dev --filter='@copilotkitnext/core' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/react' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/agent' --concurrency=15",
"dev:packages": "turbo run dev --filter='@copilotkitnext/core' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/react' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/agent'",
"dev": "turbo run dev --filter='@copilotkitnext/core' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/sqlite-runner' --filter='@copilotkitnext/react' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/agent' --concurrency=15",
"dev:packages": "turbo run dev --filter='@copilotkitnext/core' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/sqlite-runner' --filter='@copilotkitnext/react' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/agent'",
"demo:angular": "turbo run dev --filter='@copilotkitnext/angular-demo-server' --filter='@copilotkitnext/angular-demo'",
"storybook:angular": "pnpm -C apps/angular/storybook dev",
"demo:react": "pnpm -C apps/react/demo dev",
Expand All @@ -22,9 +22,9 @@
"storybook": "pnpm storybook:react",
"storybook:all": "echo 'Run storybooks in separate terminals: pnpm storybook:react | pnpm storybook:angular'",
"build-storybook": "turbo run build --filter=storybook --filter=storybook-angular",
"bump:prerelease": "pnpm -r --filter='@copilotkitnext/agent' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/core' --filter='@copilotkitnext/react' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' exec pnpm version prerelease --preid=alpha",
"bump:release": "pnpm -r --filter='@copilotkitnext/agent' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/core' --filter='@copilotkitnext/react' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' exec pnpm version patch",
"publish:prerelease": "pnpm -r clean && pnpm install && turbo build && pnpm publish -r --no-git-checks --filter='@copilotkitnext/agent' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/core' --filter='@copilotkitnext/react' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' --tag alpha",
"bump:prerelease": "pnpm -r --filter='@copilotkitnext/agent' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/core' --filter='@copilotkitnext/react' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/sqlite-runner' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' exec pnpm version prerelease --preid=alpha",
"bump:release": "pnpm -r --filter='@copilotkitnext/agent' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/core' --filter='@copilotkitnext/react' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/sqlite-runner' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' exec pnpm version patch",
"publish:prerelease": "pnpm -r clean && pnpm install && turbo build && pnpm publish -r --no-git-checks --filter='@copilotkitnext/agent' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/core' --filter='@copilotkitnext/react' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/sqlite-runner' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' --tag alpha",
"publish:release:dry": "pnpm -r --filter '@copilotkitnext/*' publish --access public --dry-run",
"publish:release": "pnpm -r --filter '@copilotkitnext/*' publish --access public"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/agent/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@copilotkitnext/agent",
"version": "0.0.15",
"version": "0.0.14",
"description": "Basic Agent for CopilotKit",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -36,7 +36,7 @@
"vitest": "^3.0.5"
},
"dependencies": {
"@ag-ui/client": "0.0.40-alpha.3",
"@ag-ui/client": "0.0.40-alpha.6",
"@ai-sdk/anthropic": "^2.0.22",
"@ai-sdk/google": "^2.0.17",
"@ai-sdk/openai": "^2.0.42",
Expand Down
6 changes: 3 additions & 3 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@copilotkitnext/angular",
"version": "0.0.15",
"version": "0.0.14",
"description": "Angular library for CopilotKit",
"main": "dist/fesm2022/copilotkitnext-angular.mjs",
"module": "dist/fesm2022/copilotkitnext-angular.mjs",
Expand Down Expand Up @@ -31,8 +31,8 @@
"test:watch": "vitest --watch"
},
"dependencies": {
"@ag-ui/client": "0.0.40-alpha.3",
"@ag-ui/core": "0.0.40-alpha.3",
"@ag-ui/client": "0.0.40-alpha.6",
"@ag-ui/core": "0.0.40-alpha.6",
"@copilotkitnext/core": "workspace:*",
"@copilotkitnext/shared": "workspace:*",
"clsx": "^2.1.1",
Expand Down
25 changes: 20 additions & 5 deletions packages/angular/src/lib/agent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { DestroyRef, Injectable, inject, signal, computed, Signal } from "@angular/core";
import {
DestroyRef,
Injectable,
inject,
signal,
computed,
Signal,
} from "@angular/core";
import { CopilotKit } from "./copilotkit";
import type { AbstractAgent } from "@ag-ui/client";
import type { Message } from "@ag-ui/client";
Expand Down Expand Up @@ -54,7 +61,10 @@ export class AgentStore {
export class CopilotkitAgentFactory {
readonly #copilotkit = inject(CopilotKit);

createAgentStoreSignal(agentId: Signal<string | undefined>, destroyRef: DestroyRef): Signal<AgentStore | undefined> {
createAgentStoreSignal(
agentId: Signal<string | undefined>,
destroyRef: DestroyRef
): Signal<AgentStore | undefined> {
let lastAgentStore: AgentStore | undefined;

return computed(() => {
Expand All @@ -65,7 +75,9 @@ export class CopilotkitAgentFactory {
lastAgentStore = undefined;
}

const abstractAgent = this.#copilotkit.getAgent(agentId() || DEFAULT_AGENT_ID);
const abstractAgent = this.#copilotkit.getAgent(
agentId() || DEFAULT_AGENT_ID
);
if (!abstractAgent) return undefined;

lastAgentStore = new AgentStore(abstractAgent, destroyRef);
Expand All @@ -74,10 +86,13 @@ export class CopilotkitAgentFactory {
}
}

export function injectAgentStore(agentId: string | Signal<string | undefined>): Signal<AgentStore | undefined> {
export function injectAgentStore(
agentId: string | Signal<string | undefined>
): Signal<AgentStore | undefined> {
const agentFactory = inject(CopilotkitAgentFactory);
const destroyRef = inject(DestroyRef);
const agentIdSignal = typeof agentId === "function" ? agentId : computed(() => agentId);
const agentIdSignal =
typeof agentId === "function" ? agentId : computed(() => agentId);

return agentFactory.createAgentStoreSignal(agentIdSignal, destroyRef);
}
Loading
Loading