Defines a standard interface for managing AI agent lifecycles, including process spawning, cancellation, and streaming message handling. Use this to build modular agent-based CLI tools.
// Source: https://github.com/AVIDS2/memorix | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Agent Adapter types — Phase 4c spawn + handle model.
*
* Each agent CLI adapter implements this interface.
* spawn() returns a process handle immediately (NOT exec + string).
* Bounded memory via RingBuffer. Cancellation via abort().
*/
export interface AgentProcess {
/** Underlying child process PID */
pid: number;
/** Resolves when process exits */
completion: Promise<AgentProcessResult>;
/** Abort the process (SIGTERM, then SIGKILL after grace period) */
abort(): void;
/** Streaming messages from the agent process (if supported by the adapter) */
messages
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key