From b62da257d70ea5d232cd8956553d0c1be5237f4e Mon Sep 17 00:00:00 2001 From: lin onetwo Date: Mon, 14 Apr 2025 19:08:05 +0800 Subject: [PATCH] refactor: remove existing methods, so it won't interfere AI reasoning --- src/services/agent/interface.ts | 74 --------------------------------- 1 file changed, 74 deletions(-) diff --git a/src/services/agent/interface.ts b/src/services/agent/interface.ts index 20b35a82..64f74b8e 100644 --- a/src/services/agent/interface.ts +++ b/src/services/agent/interface.ts @@ -8,84 +8,10 @@ import { AgentDefinition, AgentState } from '@services/externalAPI/interface'; * Agent service to manage chat agents and service agents */ export interface IAgentService { - /** - * Create agent from definition - * Add to the memory, and add to the database. Ready to execute, or start immediately. - * - * @param agentInfo Please provide `agentID` if this agent is already in the database, so we can resume its state. - */ - createAgentAndAdd( - agentInfo: { definition: AgentDefinition; agentID?: string; workspaceID: string }, - options?: { start?: boolean }, - ): Promise<{ id: string; state: AgentState }>; - getAgentDefinitionFromURI(definitionURI: string): Promise<{ definition: AgentDefinition; definitionTiddlerTitle: string; workspaceID: string }>; - /** - * Get current state of an agent, including viewModel and chat history, etc. - * @param agentID The agent/chat ID - * @param providedState Normally we get state from stores, you can provide it here, so we can skip getting it from the store. - */ - getAgentState(agentID: string, providedState?: Partial): AgentState; - listAgents(): Array<[string, AgentDefinition]>; - /** - * Get agent's definition - */ - serializeAgent(agentID: string): string; - /** - * Get agent's runtime state, including viewModel and chat history, etc. - * @param providedState Normally we get state from stores, you can provide it here, so we can skip getting it from the store. - */ - serializeAgentState(agentID: string, providedState?: Partial): string; - /** - * Start running an agent by its id. Resume its state based on serializedState on database. - * - * The agent must be added to the memory and database (by `createAgentAndAdd`) before calling this method. - * You can pass `start: true` to `createAgentAndAdd` to start the agent immediately by automatically calling this method. - */ - startAgent(agentID: string): Promise; - /** - * Start all agents that are marked as running in the database. Resume their state based on serializedState on database. - */ - startWorkflows(): Promise; - /** - * Stop an agent by its id. Save its state to database. - */ - stopAgent(agentID: string): Promise; - /** - * subscribe to the agent state, to see if we need to update the UI elements - * @param agentID The agent/chat ID - */ - subscribeAgentState$(agentID: string): BehaviorSubject; - updateAgentState(agentID: string, nextState: AgentState): Promise; - /** - * Send a message to a chat agent - * @param agentID Agent ID to send message to - * @param message User message to send - */ - sendMessageToAgent(agentID: string, message: string): Promise; - /** - * Trigger execution of a service agent - * @param agentID Agent ID to execute - * @param params Optional parameters for execution - */ - executeServiceAgent(agentID: string, parameters?: Record): Promise; } export const AgentServiceIPCDescriptor = { channel: AgentChannel.name, properties: { - addAgentFromDefinitionTiddlerTitle: ProxyPropertyType.Function, - createAgentAndAdd: ProxyPropertyType.Function, - getAgentDefinitionFromURI: ProxyPropertyType.Function, - getAgentState: ProxyPropertyType.Function, - listAgents: ProxyPropertyType.Function, - serializeAgent: ProxyPropertyType.Function, - serializeAgentState: ProxyPropertyType.Function, - startAgent: ProxyPropertyType.Function, - startWorkflows: ProxyPropertyType.Function, - stopAgent: ProxyPropertyType.Function, - subscribeAgentState$: ProxyPropertyType.Function$, - updateAgentState: ProxyPropertyType.Function, - sendMessageToAgent: ProxyPropertyType.Function, - executeServiceAgent: ProxyPropertyType.Function, }, };