@copilotkit/runtime
Version:
<div align="center"> <a href="https://copilotkit.ai" target="_blank"> <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/banner.png" alt="CopilotKit Logo"> </a>
122 lines (94 loc) • 2.74 kB
text/typescript
import { Field, InterfaceType, ObjectType } from "type-graphql";
import { MessageRole } from "./enums";
import { MessageStatusUnion } from "./message-status.type";
import { ResponseStatusUnion } from "./response-status.type";
import { ExtensionsResponse } from "./extensions-response.type";
import { BaseMetaEvent } from "./meta-events.type";
({
resolveType(value) {
if (value.hasOwnProperty("content")) {
return TextMessageOutput;
} else if (value.hasOwnProperty("name")) {
return ActionExecutionMessageOutput;
} else if (value.hasOwnProperty("result")) {
return ResultMessageOutput;
} else if (value.hasOwnProperty("state")) {
return AgentStateMessageOutput;
}
return undefined;
},
})
export abstract class BaseMessageOutput {
(() => String)
id: string;
(() => Date)
createdAt: Date;
(() => MessageStatusUnion)
status: typeof MessageStatusUnion;
}
({ implements: BaseMessageOutput })
export class TextMessageOutput {
(() => MessageRole)
role: MessageRole;
(() => [String])
content: string[];
(() => String, { nullable: true })
parentMessageId?: string;
}
({ implements: BaseMessageOutput })
export class ActionExecutionMessageOutput {
(() => String)
name: string;
(() => String, {
nullable: true,
deprecationReason: "This field will be removed in a future version",
})
scope?: string;
(() => [String])
arguments: string[];
(() => String, { nullable: true })
parentMessageId?: string;
}
({ implements: BaseMessageOutput })
export class ResultMessageOutput {
(() => String)
actionExecutionId: string;
(() => String)
actionName: string;
(() => String)
result: string;
}
({ implements: BaseMessageOutput })
export class AgentStateMessageOutput {
(() => String)
threadId: string;
(() => String)
agentName: string;
(() => String)
nodeName: string;
(() => String)
runId: string;
(() => Boolean)
active: boolean;
(() => MessageRole)
role: MessageRole;
(() => String)
state: string;
(() => Boolean)
running: boolean;
}
()
export class CopilotResponse {
(() => String)
threadId!: string;
(() => ResponseStatusUnion)
status: typeof ResponseStatusUnion;
({ nullable: true })
runId?: string;
(() => [BaseMessageOutput])
messages: (typeof BaseMessageOutput)[];
(() => ExtensionsResponse, { nullable: true })
extensions?: ExtensionsResponse;
(() => [BaseMetaEvent], { nullable: true })
metaEvents?: (typeof BaseMetaEvent)[];
}