@continue-reasoning/agent
Version:
A platform-agnostic AI agent framework for building autonomous AI agents with tool execution capabilities
111 lines • 3.94 kB
JavaScript
/**
* @fileoverview Universal AI Agent Framework Interfaces
*
* This file defines platform-agnostic interfaces for AI agents that can work
* with multiple LLM providers (Gemini, OpenAI, etc.). All interfaces are
* designed to be implementation-independent and focus on core functionality.
*/
/**
* Tool confirmation outcome options
*/
export var ToolConfirmationOutcome;
(function (ToolConfirmationOutcome) {
ToolConfirmationOutcome["ProceedOnce"] = "proceed_once";
ToolConfirmationOutcome["ProceedAlways"] = "proceed_always";
ToolConfirmationOutcome["ProceedAlwaysServer"] = "proceed_always_server";
ToolConfirmationOutcome["ProceedAlwaysTool"] = "proceed_always_tool";
ToolConfirmationOutcome["ModifyWithEditor"] = "modify_with_editor";
ToolConfirmationOutcome["Cancel"] = "cancel";
})(ToolConfirmationOutcome || (ToolConfirmationOutcome = {}));
/**
* Agent event types - agent event types
*
* Defines various events emitted during agent processing:
* - Content: Content generation events
* - ToolCallRequest: Tool call request events
* - ToolCallResponse: Tool call response events
* - TokenUsage: Token usage tracking events
* - Error: Error events
* - ModelFallback: Model fallback events
*/
export var AgentEventType;
(function (AgentEventType) {
AgentEventType["HistoryCleared"] = "history_cleared";
AgentEventType["SystemPromptSet"] = "system_prompt_set";
AgentEventType["UserMessage"] = "user_message";
AgentEventType["AssistantMessage"] = "assistant_message";
AgentEventType["TurnComplete"] = "turn_complete";
AgentEventType["ToolCallRequest"] = "tool_call_request";
AgentEventType["ToolCallResponse"] = "tool_call_response";
AgentEventType["ToolConfirmation"] = "tool_confirmation";
AgentEventType["UserCancelled"] = "user_cancelled";
AgentEventType["Error"] = "error";
AgentEventType["TokenUsage"] = "token_usage";
AgentEventType["ModelFallback"] = "model_fallback";
})(AgentEventType || (AgentEventType = {}));
/**
* Tool call execution states
*/
export var ToolCallStatus;
(function (ToolCallStatus) {
ToolCallStatus["Validating"] = "validating";
ToolCallStatus["Scheduled"] = "scheduled";
ToolCallStatus["Executing"] = "executing";
ToolCallStatus["Success"] = "success";
ToolCallStatus["Error"] = "error";
ToolCallStatus["Cancelled"] = "cancelled";
ToolCallStatus["AwaitingApproval"] = "awaiting_approval";
})(ToolCallStatus || (ToolCallStatus = {}));
/**
* Type guard for IAgent
*/
export function isAgent(obj) {
return (typeof obj === 'object' &&
obj !== null &&
'process' in obj &&
'getChat' in obj &&
'getToolScheduler' in obj &&
'getTokenUsage' in obj &&
'clearHistory' in obj &&
'setSystemPrompt' in obj &&
'getSystemPrompt' in obj &&
'getStatus' in obj &&
'onEvent' in obj &&
'offEvent' in obj);
}
/**
* Type guard for IChat
*/
export function isChat(obj) {
return (typeof obj === 'object' &&
obj !== null &&
'sendMessageStream' in obj &&
'getHistory' in obj &&
'clearHistory' in obj &&
'addHistory' in obj &&
'setHistory' in obj &&
'setSystemPrompt' in obj &&
'getSystemPrompt' in obj &&
'getTokenUsage' in obj &&
'getTokenTracker' in obj &&
'isProcessing' in obj &&
'getModelInfo' in obj &&
'handleModelFallback' in obj);
}
/**
* Type guard for ITool
*/
export function isTool(obj) {
return (typeof obj === 'object' &&
obj !== null &&
'name' in obj &&
'description' in obj &&
'schema' in obj &&
'isOutputMarkdown' in obj &&
'canUpdateOutput' in obj &&
'validateToolParams' in obj &&
'getDescription' in obj &&
'shouldConfirmExecute' in obj &&
'execute' in obj);
}
//# sourceMappingURL=interfaces.js.map