forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivity-renderer.ts
More file actions
28 lines (23 loc) · 970 Bytes
/
Copy pathactivity-renderer.ts
File metadata and controls
28 lines (23 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { Type, Signal } from "@angular/core";
import type { AbstractAgent, ActivityMessage } from "@ag-ui/client";
export type AngularActivityContentParseResult<T> =
| { success: true; data: T }
| { success: false; error?: unknown };
export interface AngularActivityContentSchema<T> {
safeParse(content: unknown): AngularActivityContentParseResult<T>;
}
export interface ActivityRenderer<TActivityContent = unknown> {
activityType: Signal<string>;
content: Signal<TActivityContent>;
message: Signal<ActivityMessage>;
agent: Signal<AbstractAgent | undefined>;
}
export interface RenderActivityMessageConfig<TActivityContent = unknown> {
activityType: string;
agentId?: string;
content: AngularActivityContentSchema<TActivityContent>;
component: Type<ActivityRenderer<TActivityContent>>;
}
export const anyActivityContentSchema: AngularActivityContentSchema<unknown> = {
safeParse: (content: unknown) => ({ success: true, data: content }),
};