UNPKG

flux-agent

Version:

FluxAgent - 一个可灵活插拔的AI Agent系统框架,基于TypeScript开发,支持流式执行、事件系统、插件系统、知识库管理等功能 (Protected Release) (Protected Release) (Protected Release) (Protected Release) (Protected Release) (Protected Release) (Protected Release) (Protected Release) (Protected Release) (

63 lines (62 loc) 1.83 kB
import { Memory, Message } from './Memory'; import { ToolInfo, TagedPrompt } from './execution/types'; export interface ContextRecord { type: 'user_input' | 'agent_response' | 'tool_call' | 'tool_result' | 'phase_change' | 'system_event'; content: any; timestamp: number; phase?: string; images?: Array<{ url: string; expiresAt: number; }>; metadata?: Record<string, any>; } export declare class Context { private records; private memory; private userInputStack; private imagesStack; private currentPhase?; constructor(memory: Memory); addUserInput(content: string, images?: Array<{ url: string; expiresAt: number; }>): void; addUserMessage(tagedPrompt: TagedPrompt): void; addAgentResponse(content: string): void; addToolCall(toolName: string, args: Record<string, any>): void; addToolResult(toolInfo: ToolInfo): void; addPhaseChange(fromPhase: string, toPhase: string): void; consumeUserInput(): { userInput: string | undefined; images: Array<{ url: string; expiresAt: number; }> | undefined; }; getLatestUserInput(): string | undefined; getMemory(): Memory; getMessages(): Message[]; cleanUnrelatedMessages(): void; getCurrentPhase(): string | undefined; setCurrentPhase(phase: string): void; clear(): void; /** * 导出Context状态用于快照 */ export(): { records: Message[]; userInputStack: string[]; currentPhase?: string; memoryMessages: Message[]; }; /** * 从导出的状态恢复Context */ import(data: { records: Message[]; userInputStack: string[]; currentPhase?: string; memoryMessages: Message[]; }): void; }