This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Note: This is the Umbraco.AI.Agent.Copilot add-on package. See the root CLAUDE.md for shared coding standards, build commands, and repository-wide conventions that apply to all packages.
Umbraco.AI.Agent.Copilot is a frontend-only package that provides the copilot chat UI for Umbraco AI agents. It builds on top of Umbraco.AI.Agent.UI (the reusable chat infrastructure) and provides the copilot-specific implementation.
- Copilot sidebar container (chat interface in backoffice sidebar)
- Header button (quick access from backoffice header)
- AG-UI transport layer (streaming protocol implementation)
- Copilot context (integrates with
UaiChatContextApifrom Agent.UI) - Entity context integration (connects copilot with entity-aware features)
- Copilot-specific tool implementations
- Localization for copilot features
- No C# code
- No backend APIs (uses
Umbraco.AI.AgentAPIs) - No database access
- No Umbraco Composer
- No shared chat components (provided by
Umbraco.AI.Agent.UI)
# Build frontend assets (from repository root)
npm run build:copilot
# Watch frontend during development
npm run watch:copilot
# Build .NET solution (minimal - just static assets)
dotnet build Umbraco.AI.Agent.Copilot/Umbraco.AI.Agent.Copilot.slnxUmbraco.AI.Agent.Copilot/
├── src/
│ └── Umbraco.AI.Agent.Copilot/
│ ├── Client/
│ │ ├── src/
│ │ │ ├── copilot/ # Main copilot module
│ │ │ │ ├── components/ # Copilot-specific components
│ │ │ │ │ ├── sidebar/ # Sidebar container
│ │ │ │ │ └── header-app/ # Header button
│ │ │ │ ├── transport/ # AG-UI transport implementation
│ │ │ │ │ └── uai-http-agent.ts
│ │ │ │ ├── copilot.context.ts # Implements UaiChatContextApi
│ │ │ │ ├── tools/ # Copilot-specific tools
│ │ │ │ │ ├── entity/ # Entity-aware tools
│ │ │ │ │ ├── umbraco/ # Umbraco integration tools
│ │ │ │ │ └── examples/ # Example tools
│ │ │ │ └── frontend-tool.repository.ts # Tool registry
│ │ │ ├── lang/ # Localization
│ │ │ ├── manifests.ts # Extension manifests
│ │ │ └── index.ts # Package exports
│ │ ├── public/
│ │ │ └── umbraco-package.json # Umbraco package manifest
│ │ ├── package.json
│ │ ├── tsconfig.json
│ │ └── vite.config.ts
│ └── Umbraco.AI.Agent.Copilot.csproj
├── Directory.Build.props
├── Umbraco.AI.Agent.Copilot.slnx
├── changelog.config.json
├── version.json
├── README.md
└── CLAUDE.md
The copilot implements UaiChatContextApi from Agent.UI:
// Located in src/copilot/copilot.context.ts
export class UaiCopilotContext extends UmbContextBase<UmbElement> implements UaiChatContextApi {
private _runController: UaiRunController;
constructor(host: UmbElement) {
super(host);
// Initialize run controller with AG-UI transport
this._runController = new UaiRunController(this, {
transport: new UaiHttpAgent(/* config */),
frontendToolManager: new UaiFrontendToolManager(this),
});
}
// Implement UaiChatContextApi methods
async startRun(request: AGUIRunRequestModel) {
return this._runController.start(request);
}
// ... other methods
}The copilot provides the AG-UI transport implementation:
// Located in src/copilot/transport/uai-http-agent.ts
export class UaiHttpAgent implements AGUIAgent {
async run(request: AGUIRunRequest): Promise<AGUIRunResponse> {
// Streams agent responses from backend API
// Handles tool execution, HITL interrupts, etc.
}
}The copilot uses the tool system from Agent.UI:
Tool Renderers (defined in copilot-specific manifests):
const manifest: ManifestUaiAgentToolRenderer = {
type: "uaiAgentToolRenderer", // From Agent.UI
alias: "SearchUmbraco",
forToolName: "search_umbraco",
element: () => import("./search-umbraco.element.js"),
};Frontend Tools (copilot-specific implementations):
const manifest: ManifestUaiAgentFrontendTool = {
type: "uaiAgentFrontendTool", // From Agent.UI
alias: "GetPageInfo",
meta: {
toolName: "get_page_info",
description: "Gets info about the current page",
parameters: { /* schema */ },
},
api: () => import("./get-page-info.api.js"),
};The copilot maintains a registry of available frontend tools:
// Located in src/copilot/tools/frontend-tool.repository.ts
export class UaiFrontendToolRepository {
// Registers all copilot tools with UaiFrontendToolManager
registerTools(manager: UaiFrontendToolManager) {
// Tools are auto-discovered from extension manifests
}
}{
"peerDependencies": {
"@umbraco-ai/core": "^1.0.0",
"@umbraco-ai/agent": "^1.0.0",
"@umbraco-ai/agent-ui": "^1.0.0",
"@umbraco-cms/backoffice": "^17.1.0"
},
"dependencies": {
"@ag-ui/client": "^0.0.42"
}
}Note: rxjs is provided by @umbraco-ai/agent-ui.
None - this is a frontend-only package. The .csproj is a Razor Class Library that only serves static assets.
// Import API client and types from agent package
import { AgentsService } from "@umbraco-ai/agent";
import type { AGUIRunRequestModel } from "@umbraco-ai/agent";// Import shared chat infrastructure
import { UaiRunController, UaiFrontendToolManager } from "@umbraco-ai/agent-ui";
import type { UaiChatContextApi, ManifestUaiAgentToolRenderer } from "@umbraco-ai/agent-ui";// Import core utilities
import { someUtil } from "@umbraco-ai/core";Frontend assets compile to:
/App_Plugins/UmbracoAIAgentCopilot/umbraco-ai-agent-copilot.js
The import map in umbraco-package.json registers:
@umbraco-ai/agent-copilot->/App_Plugins/UmbracoAIAgentCopilot/umbraco-ai-agent-copilot.js
This package is frontend-only. Testing approaches:
- Manual testing - Run demo site and test copilot UI
- Unit tests - Use vitest for component/service unit tests (if added)
- Integration testing - Test with demo site that has both Agent and Copilot installed
┌─────────────────────────────────────────────────────┐
│ Umbraco.AI.Agent │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Core │ │ Persistence │ │ Web │ │
│ │ (Services) │ │ (Database) │ │ (APIs) │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ ┌──────────────────────────────────────────────────┤
│ │ Web.StaticAssets (Agent Management UI) │
│ │ - Agent workspace, collection, editing │
│ └──────────────────────────────────────────────────┤
└─────────────────────────────────────────────────────┘
│
│ depends on (npm)
▼
┌─────────────────────────────────────────────────────┐
│ Umbraco.AI.Agent.UI (Reusable) │
│ ┌──────────────────────────────────────────────────┤
│ │ Shared Chat Infrastructure │
│ │ - Components, services, contexts │
│ └──────────────────────────────────────────────────┤
└─────────────────────────────────────────────────────┘
│
│ depends on (npm + runtime)
▼
┌─────────────────────────────────────────────────────┐
│ Umbraco.AI.Agent.Copilot │
│ ┌──────────────────────────────────────────────────┤
│ │ Copilot-Specific UI │
│ │ - Sidebar, header button, AG-UI transport │
│ └──────────────────────────────────────────────────┤
└─────────────────────────────────────────────────────┘
- Create tool API class implementing the tool interface
- Create tool manifest with
type: 'uaiAgentFrontendTool'(from Agent.UI) - Add to
frontend-tool.repository.ts - Register in manifests.ts
- Create renderer element extending
LitElement - Create manifest with
type: 'uaiAgentToolRenderer'(from Agent.UI) - Set
forToolNameto match the tool - Register in manifests.ts
- Create approval element extending
UmbElementMixin(LitElement) - Create manifest with
type: 'uaiAgentApprovalElement'(from Agent.UI) - Set
forToolNameto match the tool requiring approval - Register in manifests.ts
- Build copilot:
npm run build:copilot - Run demo site:
dotnet run --project demo/Umbraco.AI.DemoSite - Open browser dev tools to see console logs
- Check Network tab for AG-UI streaming requests
- .NET 10.0 (
net10.0) - Uses Central Package Management (
Directory.Packages.props) - TypeScript 5.x
- Vite 7.x for bundling