Skip to content

Commit 23bc0b2

Browse files
authored
feat(cockpit): wire view components into all 6 examples (#67)
1 parent 0445c3b commit 23bc0b2

7 files changed

Lines changed: 48 additions & 12 deletions

File tree

cockpit/deep-agents/filesystem/angular/src/app/filesystem.component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Component, computed } from '@angular/core';
2-
import { ChatComponent } from '@cacheplane/chat';
2+
import { ChatComponent, views } from '@cacheplane/chat';
33
import { agent } from '@cacheplane/angular';
4+
import { signalStateStore } from '@cacheplane/render';
45
import { environment } from '../environments/environment';
6+
import { FilePreviewComponent } from './views/file-preview.component';
57

68
/**
79
* Represents a file operation extracted from agent tool calls.
@@ -30,7 +32,7 @@ interface FileOperation {
3032
imports: [ChatComponent],
3133
template: `
3234
<div class="flex h-screen">
33-
<chat [ref]="stream" class="flex-1 min-w-0" />
35+
<chat [ref]="stream" [views]="ui" [store]="uiStore" class="flex-1 min-w-0" />
3436
<aside class="w-72 shrink-0 border-l overflow-y-auto p-4 space-y-2"
3537
style="border-color: var(--chat-border, #333); background: var(--chat-bg, #171717); color: var(--chat-text, #e0e0e0);">
3638
<h3 class="text-xs font-semibold uppercase tracking-wide"
@@ -59,6 +61,9 @@ interface FileOperation {
5961
`,
6062
})
6163
export class FilesystemComponent {
64+
readonly ui = views({ 'file-preview': FilePreviewComponent });
65+
readonly uiStore = signalStateStore({});
66+
6267
/**
6368
* The streaming resource connected to the filesystem graph.
6469
*

cockpit/deep-agents/planning/angular/src/app/planning.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { Component, computed } from '@angular/core';
2-
import { ChatComponent } from '@cacheplane/chat';
2+
import { ChatComponent, views } from '@cacheplane/chat';
33
import { agent } from '@cacheplane/angular';
4+
import { signalStateStore } from '@cacheplane/render';
45
import { environment } from '../environments/environment';
6+
import { PlanChecklistComponent } from './views/plan-checklist.component';
7+
import { CheckboxRowComponent } from './views/checkbox-row.component';
58

69
/**
710
* Represents a single step in an agent-generated plan.
@@ -30,7 +33,7 @@ interface PlanStep {
3033
imports: [ChatComponent],
3134
template: `
3235
<div class="flex h-screen">
33-
<chat [ref]="stream" class="flex-1 min-w-0" />
36+
<chat [ref]="stream" [views]="ui" [store]="uiStore" class="flex-1 min-w-0" />
3437
<aside class="w-72 shrink-0 border-l overflow-y-auto p-4 space-y-2"
3538
style="border-color: var(--chat-border, #333); background: var(--chat-bg, #171717); color: var(--chat-text, #e0e0e0);">
3639
<h3 class="text-xs font-semibold uppercase tracking-wide"
@@ -58,6 +61,9 @@ interface PlanStep {
5861
`,
5962
})
6063
export class PlanningComponent {
64+
readonly ui = views({ 'plan-checklist': PlanChecklistComponent, 'checkbox-row': CheckboxRowComponent });
65+
readonly uiStore = signalStateStore({});
66+
6167
/**
6268
* The streaming resource connected to the planning graph.
6369
*

cockpit/deep-agents/sandboxes/angular/src/app/sandboxes.component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Component, computed } from '@angular/core';
2-
import { ChatComponent } from '@cacheplane/chat';
2+
import { ChatComponent, views } from '@cacheplane/chat';
33
import { agent } from '@cacheplane/angular';
4+
import { signalStateStore } from '@cacheplane/render';
45
import { environment } from '../environments/environment';
6+
import { CodeExecutionComponent } from './views/code-execution.component';
57

68
/**
79
* Represents a parsed code execution: the code that was run and its output.
@@ -28,7 +30,7 @@ interface CodeExecution {
2830
imports: [ChatComponent],
2931
template: `
3032
<div class="flex h-screen">
31-
<chat [ref]="stream" class="flex-1 min-w-0" />
33+
<chat [ref]="stream" [views]="ui" [store]="uiStore" class="flex-1 min-w-0" />
3234
<aside class="w-80 shrink-0 border-l overflow-y-auto p-4 space-y-3"
3335
style="border-color: var(--chat-border, #333); background: var(--chat-bg, #171717); color: var(--chat-text, #e0e0e0);">
3436
<h3 class="text-xs font-semibold uppercase tracking-wide"
@@ -59,6 +61,9 @@ interface CodeExecution {
5961
`,
6062
})
6163
export class SandboxesComponent {
64+
readonly ui = views({ 'code-execution': CodeExecutionComponent });
65+
readonly uiStore = signalStateStore({});
66+
6267
protected readonly stream = agent({
6368
apiUrl: environment.langGraphApiUrl,
6469
assistantId: environment.streamingAssistantId,

cockpit/deep-agents/skills/angular/src/app/skills.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { Component, computed } from '@angular/core';
2-
import { ChatComponent } from '@cacheplane/chat';
2+
import { ChatComponent, views } from '@cacheplane/chat';
33
import { agent } from '@cacheplane/angular';
4+
import { signalStateStore } from '@cacheplane/render';
45
import { environment } from '../environments/environment';
6+
import { CalculatorResultComponent } from './views/calculator-result.component';
7+
import { WordCountResultComponent } from './views/word-count-result.component';
58

69
/**
710
* Represents a matched skill invocation: tool call paired with its result.
@@ -29,7 +32,7 @@ interface SkillInvocation {
2932
imports: [ChatComponent],
3033
template: `
3134
<div class="flex h-screen">
32-
<chat [ref]="stream" class="flex-1 min-w-0" />
35+
<chat [ref]="stream" [views]="ui" [store]="uiStore" class="flex-1 min-w-0" />
3336
<aside class="w-72 shrink-0 border-l overflow-y-auto p-4 space-y-3"
3437
style="border-color: var(--chat-border, #333); background: var(--chat-bg, #171717); color: var(--chat-text, #e0e0e0);">
3538
<h3 class="text-xs font-semibold uppercase tracking-wide"
@@ -65,6 +68,9 @@ interface SkillInvocation {
6568
`,
6669
})
6770
export class SkillsComponent {
71+
readonly ui = views({ 'calculator-result': CalculatorResultComponent, 'word-count-result': WordCountResultComponent });
72+
readonly uiStore = signalStateStore({});
73+
6874
protected readonly stream = agent({
6975
apiUrl: environment.langGraphApiUrl,
7076
assistantId: environment.streamingAssistantId,

cockpit/langgraph/durable-execution/angular/src/app/durable-execution.component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Component, computed } from '@angular/core';
2-
import { ChatComponent } from '@cacheplane/chat';
2+
import { ChatComponent, views } from '@cacheplane/chat';
33
import { agent } from '@cacheplane/angular';
4+
import { signalStateStore } from '@cacheplane/render';
45
import { environment } from '../environments/environment';
6+
import { StepPipelineComponent } from './views/step-pipeline.component';
57

68
/**
79
* Pipeline step definition for the vertical progress indicator.
@@ -37,7 +39,7 @@ const STEP_LABELS: Record<string, string> = {
3739
imports: [ChatComponent],
3840
template: `
3941
<div class="flex h-screen">
40-
<chat [ref]="stream" class="flex-1 min-w-0" />
42+
<chat [ref]="stream" [views]="ui" [store]="uiStore" class="flex-1 min-w-0" />
4143
<aside class="w-64 shrink-0 border-l overflow-y-auto p-4"
4244
style="border-color: var(--chat-border, #333); background: var(--chat-bg, #171717); color: var(--chat-text, #e0e0e0);">
4345
<h3 class="text-xs font-semibold uppercase tracking-wide mb-6"
@@ -92,6 +94,9 @@ const STEP_LABELS: Record<string, string> = {
9294
`,
9395
})
9496
export class DurableExecutionComponent {
97+
readonly ui = views({ 'step-pipeline': StepPipelineComponent });
98+
readonly uiStore = signalStateStore({});
99+
95100
protected readonly stream = agent({
96101
apiUrl: environment.langGraphApiUrl,
97102
assistantId: environment.streamingAssistantId,

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
22
import { Component } from '@angular/core';
3-
import { ChatComponent, ChatInterruptPanelComponent, type InterruptAction } from '@cacheplane/chat';
3+
import { ChatComponent, ChatInterruptPanelComponent, views, type InterruptAction } from '@cacheplane/chat';
44
import { agent } from '@cacheplane/angular';
5+
import { signalStateStore } from '@cacheplane/render';
56
import { environment } from '../environments/environment';
7+
import { ApprovalCardComponent } from './views/approval-card.component';
68

79
/**
810
* InterruptsComponent demonstrates human-in-the-loop with `agent()`.
@@ -22,7 +24,7 @@ import { environment } from '../environments/environment';
2224
imports: [ChatComponent, ChatInterruptPanelComponent],
2325
template: `
2426
<div class="flex flex-col h-screen">
25-
<chat [ref]="stream" class="flex-1 min-w-0" />
27+
<chat [ref]="stream" [views]="ui" [store]="uiStore" class="flex-1 min-w-0" />
2628
@if (stream.interrupt()) {
2729
<div class="p-4" style="border-top: 1px solid var(--chat-border, #333);">
2830
<chat-interrupt-panel [ref]="stream" (action)="onInterruptAction($event)" />
@@ -32,6 +34,9 @@ import { environment } from '../environments/environment';
3234
`,
3335
})
3436
export class InterruptsComponent {
37+
readonly ui = views({ 'approval-card': ApprovalCardComponent });
38+
readonly uiStore = signalStateStore({});
39+
3540
/**
3641
* The streaming resource with interrupt support.
3742
*

libs/chat/src/lib/compositions/chat/chat.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import {
1414
} from '@angular/core';
1515
import { DomSanitizer } from '@angular/platform-browser';
1616
import type { AgentRef } from '@cacheplane/angular';
17+
import type { ViewRegistry } from '@cacheplane/render';
18+
import type { StateStore } from '@json-render/core';
1719
import { ChatMessagesComponent } from '../../primitives/chat-messages/chat-messages.component';
1820
import { MessageTemplateDirective } from '../../primitives/chat-messages/message-template.directive';
1921
import { ChatInputComponent } from '../../primitives/chat-input/chat-input.component';
@@ -176,6 +178,8 @@ export class ChatComponent {
176178
private readonly sanitizer = inject(DomSanitizer);
177179

178180
readonly ref = input.required<AgentRef<any, any>>();
181+
readonly views = input<ViewRegistry | undefined>(undefined);
182+
readonly store = input<StateStore | undefined>(undefined);
179183
readonly threads = input<Thread[]>([]);
180184
readonly activeThreadId = input<string>('');
181185
readonly threadSelected = output<string>();

0 commit comments

Comments
 (0)