mirror of
https://github.com/kennethnym/freya
synced 2026-07-03 14:51:13 +01:00
feat: add agent response scheduler
This commit is contained in:
@@ -1,8 +1,3 @@
|
||||
export interface SendMessageResult {
|
||||
message: string
|
||||
conversationId: string
|
||||
}
|
||||
|
||||
export type AgentEvent =
|
||||
| { type: "conversation_started"; conversationId: string }
|
||||
| { type: "message_created"; text: string }
|
||||
@@ -11,8 +6,11 @@ export type AgentEvent =
|
||||
| { type: "message_finished" }
|
||||
| { type: "message_failed"; error: string }
|
||||
|
||||
export type UserEvent = { type: "typing" }
|
||||
|
||||
export interface AgentServerApi {
|
||||
sendMessage(message: string): Promise<SendMessageResult>
|
||||
sendMessage(message: string): Promise<boolean>
|
||||
notify(event: UserEvent): void
|
||||
ping(): "pong"
|
||||
}
|
||||
|
||||
|
||||
@@ -146,6 +146,19 @@ export const ConversationEntryMetadata = type({
|
||||
/** Metadata bag attached to a conversation entry. */
|
||||
export type ConversationEntryMetadata = typeof ConversationEntryMetadata.infer
|
||||
|
||||
export const ToolCallPayload = type({
|
||||
toolName: "string",
|
||||
})
|
||||
|
||||
export type ToolCallPayload = typeof ToolCallPayload.infer
|
||||
|
||||
export const ToolResultPayload = type({
|
||||
toolName: "string",
|
||||
ok: "boolean",
|
||||
})
|
||||
|
||||
export type ToolResultPayload = typeof ToolResultPayload.infer
|
||||
|
||||
/** Generic object payload used by operational entries. */
|
||||
export const GenericObjectPayload = type("Record<string, unknown>")
|
||||
|
||||
@@ -158,6 +171,8 @@ export type ConversationEntryPayload =
|
||||
| AssistantMessagePayload
|
||||
| AttachmentPayload
|
||||
| ContextSummaryPayload
|
||||
| ToolCallPayload
|
||||
| ToolResultPayload
|
||||
| GenericObjectPayload
|
||||
|
||||
export const Conversation = type({
|
||||
|
||||
@@ -29,7 +29,9 @@ export {
|
||||
SystemNoteConversationEntry,
|
||||
TextMessagePart,
|
||||
ToolCallConversationEntry,
|
||||
ToolCallPayload,
|
||||
ToolResultConversationEntry,
|
||||
ToolResultPayload,
|
||||
UserMessagePayload,
|
||||
UserMessageConversationEntry,
|
||||
} from "./conversation"
|
||||
|
||||
Reference in New Issue
Block a user