Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

835 B
Raw Blame
export type PluginCommandContext = {
  args?: string;
  commandBody?: string;
  sessionKey?: string;
  sessionId?: string;
  agentId?: string;
  ovSessionId?: string;
  senderId?: string;
  requesterSenderId?: string;
};

export type CommandResult = {
  text: string;
  details?: Record<string, unknown>;
};

export type CommandDefinition = {
  name: string;
  description: string;
  acceptsArgs?: boolean;
  requireAuth?: boolean;
  handler: (ctx: PluginCommandContext) => CommandResult | Promise<CommandResult>;
};

export type OpenVikingCommandRegistrationApi = {
  registerCommand?: (command: CommandDefinition) => void;
};

export function registerOpenVikingCommands(
  api: OpenVikingCommandRegistrationApi,
  commands: CommandDefinition[],
): void {
  for (const command of commands) {
    api.registerCommand?.(command);
  }
}