Skip to content

Commit 891fcb7

Browse files
bloveclaude
andauthored
refactor: rename ChatAgent → Agent across the contract surface (#137)
* docs: ChatAgent → Agent rename design Scope: contract types strip prefix (Agent, AgentWithHistory). Data types go bare (Message, Role, ToolCall, ContentBlock, Subagent). Collision-prone types prefix with Agent (AgentCustomEvent, AgentInterrupt, AgentStatus, AgentSubmit*, AgentCheckpoint). No backwards-compat aliases, no structural changes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * docs: ChatAgent → Agent rename implementation plan 8 tasks: rename agent/ files, testing/ files, exports, primitives + compositions, langgraph adapter file, cockpit consumers, then verify. git mv preserves history; ordered find/replace avoids partial matches. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(chat): rename ChatAgent → Agent and paired types - Strip Chat prefix from contract types (Agent, AgentWithHistory) - Strip Chat prefix from data types (Message, Role, ToolCall, ContentBlock, Subagent) - Prefix Agent on collision-prone types (AgentStatus, AgentInterrupt, AgentCustomEvent, AgentSubmit*, AgentCheckpoint) - Rename mockChatAgent → mockAgent, conformance helpers analogously - File renames via git mv preserve history Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(langgraph): rename toChatAgent → toAgent Adapter function renamed to match Agent rename in @cacheplane/chat. ChatAgent → Agent, ChatAgentWithHistory → AgentWithHistory in return type and translation helpers. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(cockpit): adopt Agent rename across demos Updates imports of toChatAgent → toAgent and any direct Type references (ChatAgent, ChatMessage, etc.) to the new bare/Agent- prefixed names. Component class imports (ChatMessagesComponent etc.) are unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * docs(chat): update README to reference Agent contract Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 4f3259e commit 891fcb7

82 files changed

Lines changed: 1138 additions & 493 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cockpit/chat/a2ui/angular/src/app/a2ui.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
22
import { Component } from '@angular/core';
33
import { ChatComponent, a2uiBasicCatalog } from '@cacheplane/chat';
4-
import { agent, toChatAgent } from '@cacheplane/langgraph';
4+
import { agent, toAgent } from '@cacheplane/langgraph';
55
import { environment } from '../environments/environment';
66

77
@Component({
@@ -15,6 +15,6 @@ export class A2uiComponent {
1515
apiUrl: environment.langGraphApiUrl,
1616
assistantId: environment.a2uiAssistantId,
1717
});
18-
protected readonly chatAgent = toChatAgent(this.agentRef);
18+
protected readonly chatAgent = toAgent(this.agentRef);
1919
protected readonly catalog = a2uiBasicCatalog();
2020
}

cockpit/chat/debug/angular/src/app/debug.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
22
import { Component } from '@angular/core';
33
import { ChatDebugComponent } from '@cacheplane/chat';
4-
import { agent, toChatAgent } from '@cacheplane/langgraph';
4+
import { agent, toAgent } from '@cacheplane/langgraph';
55
import { ExampleChatLayoutComponent } from '@cacheplane/example-layouts';
66
import { environment } from '../environments/environment';
77

@@ -25,5 +25,5 @@ export class DebugPageComponent {
2525
apiUrl: environment.langGraphApiUrl,
2626
assistantId: environment.streamingAssistantId,
2727
});
28-
protected readonly chatAgent = toChatAgent(this.stream);
28+
protected readonly chatAgent = toAgent(this.stream);
2929
}

cockpit/chat/generative-ui/angular/src/app/generative-ui.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
22
import { Component } from '@angular/core';
33
import { ChatComponent, views } from '@cacheplane/chat';
4-
import { agent, toChatAgent } from '@cacheplane/langgraph';
4+
import { agent, toAgent } from '@cacheplane/langgraph';
55
import { ExampleChatLayoutComponent } from '@cacheplane/example-layouts';
66
import { environment } from '../environments/environment';
77

@@ -36,6 +36,6 @@ export class GenerativeUiComponent {
3636
apiUrl: environment.langGraphApiUrl,
3737
assistantId: environment.generativeUiAssistantId,
3838
});
39-
protected readonly chatAgent = toChatAgent(this.agentRef);
39+
protected readonly chatAgent = toAgent(this.agentRef);
4040
protected readonly dashboardViews = dashboardViews;
4141
}

cockpit/chat/input/angular/src/app/input.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Component, computed } from '@angular/core';
33
import { ChatInputComponent as ChatInputPrimitive } from '@cacheplane/chat';
44
import { ChatMessagesComponent } from '@cacheplane/chat';
55
import { ExampleChatLayoutComponent } from '@cacheplane/example-layouts';
6-
import { agent, toChatAgent } from '@cacheplane/langgraph';
6+
import { agent, toAgent } from '@cacheplane/langgraph';
77
import { environment } from '../environments/environment';
88

99
/**
@@ -56,7 +56,7 @@ export class InputComponent {
5656
apiUrl: environment.langGraphApiUrl,
5757
assistantId: environment.streamingAssistantId,
5858
});
59-
protected readonly chatAgent = toChatAgent(this.stream);
59+
protected readonly chatAgent = toAgent(this.stream);
6060

6161
protected readonly streamStatus = computed(() => this.stream.status());
6262
protected readonly isLoading = computed(() => this.stream.isLoading());

cockpit/chat/interrupts/angular/src/app/interrupts.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Component, computed } from '@angular/core';
33
import { JsonPipe } from '@angular/common';
44
import { ChatComponent, ChatInterruptPanelComponent } from '@cacheplane/chat';
55
import { ExampleChatLayoutComponent } from '@cacheplane/example-layouts';
6-
import { agent, toChatAgent } from '@cacheplane/langgraph';
6+
import { agent, toAgent } from '@cacheplane/langgraph';
77
import { environment } from '../environments/environment';
88

99
/**
@@ -37,7 +37,7 @@ export class InterruptsComponent {
3737
apiUrl: environment.langGraphApiUrl,
3838
assistantId: environment.streamingAssistantId,
3939
});
40-
protected readonly chatAgent = toChatAgent(this.stream);
40+
protected readonly chatAgent = toAgent(this.stream);
4141

4242
protected readonly streamStatus = computed(() => this.stream.status());
4343
}

cockpit/chat/messages/angular/src/app/messages.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
ChatTypingIndicatorComponent,
77
} from '@cacheplane/chat';
88
import { ExampleChatLayoutComponent } from '@cacheplane/example-layouts';
9-
import { agent, toChatAgent } from '@cacheplane/langgraph';
9+
import { agent, toAgent } from '@cacheplane/langgraph';
1010
import { environment } from '../environments/environment';
1111

1212
/**
@@ -51,7 +51,7 @@ export class MessagesComponent {
5151
apiUrl: environment.langGraphApiUrl,
5252
assistantId: environment.streamingAssistantId,
5353
});
54-
protected readonly chatAgent = toChatAgent(this.stream);
54+
protected readonly chatAgent = toAgent(this.stream);
5555

5656
submitMessage(content: string) {
5757
this.chatAgent.submit({ message: content });

cockpit/chat/subagents/angular/src/app/subagents.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
ChatSubagentCardComponent,
77
} from '@cacheplane/chat';
88
import { ExampleChatLayoutComponent } from '@cacheplane/example-layouts';
9-
import { agent, toChatAgent } from '@cacheplane/langgraph';
9+
import { agent, toAgent } from '@cacheplane/langgraph';
1010
import { environment } from '../environments/environment';
1111

1212
/**
@@ -44,5 +44,5 @@ export class SubagentsComponent {
4444
apiUrl: environment.langGraphApiUrl,
4545
assistantId: environment.streamingAssistantId,
4646
});
47-
protected readonly chatAgent = toChatAgent(this.stream);
47+
protected readonly chatAgent = toAgent(this.stream);
4848
}

cockpit/chat/theming/angular/src/app/theming.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Component, signal } from '@angular/core';
33
import { TitleCasePipe } from '@angular/common';
44
import { ChatComponent } from '@cacheplane/chat';
55
import { ExampleChatLayoutComponent } from '@cacheplane/example-layouts';
6-
import { agent, toChatAgent } from '@cacheplane/langgraph';
6+
import { agent, toAgent } from '@cacheplane/langgraph';
77
import { environment } from '../environments/environment';
88

99
const THEMES: Record<string, Record<string, string>> = {
@@ -88,7 +88,7 @@ export class ThemingComponent {
8888
apiUrl: environment.langGraphApiUrl,
8989
assistantId: environment.streamingAssistantId,
9090
});
91-
protected readonly chatAgent = toChatAgent(this.stream);
91+
protected readonly chatAgent = toAgent(this.stream);
9292

9393
protected readonly themeNames = Object.keys(THEMES);
9494
protected readonly activeTheme = signal('dark');

cockpit/chat/threads/angular/src/app/threads.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
22
import { Component, signal } from '@angular/core';
33
import { ChatComponent, ChatThreadListComponent, type Thread } from '@cacheplane/chat';
4-
import { agent, toChatAgent } from '@cacheplane/langgraph';
4+
import { agent, toAgent } from '@cacheplane/langgraph';
55
import { ExampleChatLayoutComponent } from '@cacheplane/example-layouts';
66
import { environment } from '../environments/environment';
77

@@ -33,7 +33,7 @@ export class ThreadsComponent {
3333
apiUrl: environment.langGraphApiUrl,
3434
assistantId: environment.streamingAssistantId,
3535
});
36-
protected readonly chatAgent = toChatAgent(this.stream);
36+
protected readonly chatAgent = toAgent(this.stream);
3737

3838
protected readonly threads = signal<Thread[]>([
3939
{ id: 'thread-1', title: 'First Conversation' },

cockpit/chat/timeline/angular/src/app/timeline.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { Component } from '@angular/core';
33
import { ChatComponent, ChatTimelineSliderComponent } from '@cacheplane/chat';
44
import { ExampleChatLayoutComponent } from '@cacheplane/example-layouts';
5-
import { agent, toChatAgent } from '@cacheplane/langgraph';
5+
import { agent, toAgent } from '@cacheplane/langgraph';
66
import { environment } from '../environments/environment';
77

88
/**
@@ -38,5 +38,5 @@ export class TimelineComponent {
3838
apiUrl: environment.langGraphApiUrl,
3939
assistantId: environment.streamingAssistantId,
4040
});
41-
protected readonly chatAgent = toChatAgent(this.stream);
41+
protected readonly chatAgent = toAgent(this.stream);
4242
}

0 commit comments

Comments
 (0)