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) (
56 lines (55 loc) • 1.54 kB
TypeScript
export declare enum PhaseType {
CONFIRM = "confirm",
THINKPLAN = "thinkplan",
PLAN = "plan",
REACT = "react",
SUMMARY = "summary",
ALL = "all"
}
export interface PhasePromptFactory {
[key: string]: (markdownPrompt: string) => string;
}
export interface PhaseState {
currentTask?: string;
reactCycleCount: number;
}
/**
* 阶段必要性判断结果
*/
export interface PhaseNecessityResult {
isNecessary: boolean;
reason: string;
}
/**
* Phases 类 - Agent 阶段管理器
*
* 设计理念:基于 LLM 上下文的自主任务判断
*
* 核心原则:
* 1. 相信 LLM 基于上下文做出正确判断的能力
* 2. 对话历史和工具调用结果就是任务状态的唯一真相源
* 3. 简化状态管理,让代码更易维护
*/
export declare class Phases {
private phases;
private currentPhaseIndex;
private disabledPhases;
private phaseState;
private logger;
private promptFactory;
private static sharedLLM?;
private static llmCallCache;
private static cacheExpiry;
private static readonly CACHE_TTL;
constructor(logger?: (message: string, data?: any) => void, promptFactory?: PhasePromptFactory);
getCurrentPhase(): PhaseType;
nextPhase(): PhaseType | null;
getNextPhase(): PhaseType | null;
getPhaseState(): PhaseState;
resetPhase(): void;
disablePhase(phase: PhaseType): void;
getPhasePrompt(phase: PhaseType, options?: {
customPrompt?: string;
input?: string;
}): string;
}