@prismshadow/penguin-library-agent · library/agent/src/contract.ts:134

AgentLifecycle

interface

AgentLifecycle: the mechanism AgentService implements — the list, the creation, the delete and the plugin update surface.

API

@Interface("@prismshadow/penguin-server#AgentLifecycle")
export abstract class AgentLifecycle {
  abstract listAgents(projectId: string): Promise<AgentListItem[]>;
  abstract takenAgentIds(projectId: string): Promise<string[]>;
  abstract deleteAgent(projectId: string, agentId: string): Promise<AgentDeletionInfo>;
  abstract agentDeletion(projectId: string, deletionId: string): AgentDeletionInfo | null;
  abstract resumeDeletions(): Promise<void>;
  abstract createAgent(
      projectId: string,
      agentId: string,
      creation?: AgentCreation,
    ): Promise<AgentListItem>;
  abstract pluginVersion(
      projectId: string,
      agentId: string,
      pluginName: string,
    ): Promise<{ installed: string | null; library: string | null }>;
  abstract updatePlugin(projectId: string, agentId: string, pluginName: string): Promise<void>;
}

Contract Topology

Static AST wiring across @Module / @Provide / @Use

Members (8)

listAgents

listAgents(projectId: string): Promise<AgentListItem[]>
@paramprojectIdstring
@returnsPromise<AgentListItem[]>

takenAgentIds

takenAgentIds(projectId: string): Promise<string[]>

Every id createAgent refuses as taken, as names only, including a folder that does not list.

@paramprojectIdstring
@returnsPromise<string[]>

deleteAgent

deleteAgent(projectId: string, agentId: string): Promise<AgentDeletionInfo>

Moves the Agent's folder out of the agents directory in one rename and drops its index row, so it is gone from every list and route at once; its files are then removed in the background, as the returned deletion reports. Refuses a built-in Agent, and a folder another program holds open (409 agent_folder_busy, nothing deleted).

@paramprojectIdstring
@paramagentIdstring
@returnsPromise<AgentDeletionInfo>

agentDeletion

agentDeletion(projectId: string, deletionId: string): AgentDeletionInfo | null

Where one deletion stands; null once it is unknown here (finished long ago, or never was).

@paramprojectIdstring
@paramdeletionIdstring
@returnsAgentDeletionInfo | null

resumeDeletions

resumeDeletions(): Promise<void>

Removes whatever deleted Agents left behind when the server last stopped mid-removal.

@returnsPromise<void>

createAgent

createAgent(projectId: string, agentId: string, creation?: AgentCreation): Promise<AgentListItem>
@paramprojectIdstring
@paramagentIdstring
@paramcreation?AgentCreation
@returnsPromise<AgentListItem>

pluginVersion

pluginVersion(projectId: string, agentId: string, pluginName: string): Promise<{ installed: string | null; library: string | null }>
@paramprojectIdstring
@paramagentIdstring
@parampluginNamestring
@returnsPromise<{ installed: string | null; library: string | null }>

updatePlugin

updatePlugin(projectId: string, agentId: string, pluginName: string): Promise<void>
@paramprojectIdstring
@paramagentIdstring
@parampluginNamestring
@returnsPromise<void>