diff --git a/src/db/agent-destinations.ts b/src/db/agent-destinations.ts index 2d319de..737e67d 100644 --- a/src/db/agent-destinations.ts +++ b/src/db/agent-destinations.ts @@ -39,28 +39,22 @@ export function getDestinationByTarget( targetId: string, ): AgentDestination | undefined { return getDb() - .prepare( - 'SELECT * FROM agent_destinations WHERE agent_group_id = ? AND target_type = ? AND target_id = ?', - ) + .prepare('SELECT * FROM agent_destinations WHERE agent_group_id = ? AND target_type = ? AND target_id = ?') .get(agentGroupId, targetType, targetId) as AgentDestination | undefined; } /** Permission check: can this agent send to this target? */ -export function hasDestination( - agentGroupId: string, - targetType: 'channel' | 'agent', - targetId: string, -): boolean { +export function hasDestination(agentGroupId: string, targetType: 'channel' | 'agent', targetId: string): boolean { const row = getDb() - .prepare( - 'SELECT 1 FROM agent_destinations WHERE agent_group_id = ? AND target_type = ? AND target_id = ? LIMIT 1', - ) + .prepare('SELECT 1 FROM agent_destinations WHERE agent_group_id = ? AND target_type = ? AND target_id = ? LIMIT 1') .get(agentGroupId, targetType, targetId); return !!row; } export function deleteDestination(agentGroupId: string, localName: string): void { - getDb().prepare('DELETE FROM agent_destinations WHERE agent_group_id = ? AND local_name = ?').run(agentGroupId, localName); + getDb() + .prepare('DELETE FROM agent_destinations WHERE agent_group_id = ? AND local_name = ?') + .run(agentGroupId, localName); } /** Normalize a human-readable name into a lowercase, dash-separated identifier. */ diff --git a/src/delivery.ts b/src/delivery.ts index 144d213..2c44941 100644 --- a/src/delivery.ts +++ b/src/delivery.ts @@ -26,12 +26,7 @@ import { updateAgentGroup, getAgentGroupByFolder, } from './db/agent-groups.js'; -import { - createDestination, - getDestinationByName, - hasDestination, - normalizeName, -} from './db/agent-destinations.js'; +import { createDestination, getDestinationByName, hasDestination, normalizeName } from './db/agent-destinations.js'; import { getMessagingGroupByPlatform, getMessagingGroupsByAgentGroup } from './db/messaging-groups.js'; import { log } from './log.js'; import { @@ -617,7 +612,10 @@ async function handleSystemAction( }); // Fire-and-forget notification back to the creator - notifyAgent(session, `Agent "${localName}" created. You can now message it with ....`); + notifyAgent( + session, + `Agent "${localName}" created. You can now message it with ....`, + ); log.info('Agent group created', { agentGroupId, name, localName, folder, parent: sourceGroup.id }); // Note: requestId is unused — this is fire-and-forget, not request/response. void requestId; @@ -636,12 +634,18 @@ async function handleSystemAction( notifyAgent(session, 'add_mcp_server failed: name and command are required.'); break; } - await requestApproval(session, agentGroup.name, 'add_mcp_server', { - name: serverName, - command, - args: (content.args as string[]) || [], - env: (content.env as Record) || {}, - }, `Agent "${agentGroup.name}" requests a new MCP server:\n${serverName} (${command})`); + await requestApproval( + session, + agentGroup.name, + 'add_mcp_server', + { + name: serverName, + command, + args: (content.args as string[]) || [], + env: (content.env as Record) || {}, + }, + `Agent "${agentGroup.name}" requests a new MCP server:\n${serverName} (${command})`, + ); break; }