style: prettier formatting fixes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -39,28 +39,22 @@ export function getDestinationByTarget(
|
|||||||
targetId: string,
|
targetId: string,
|
||||||
): AgentDestination | undefined {
|
): AgentDestination | undefined {
|
||||||
return getDb()
|
return getDb()
|
||||||
.prepare(
|
.prepare('SELECT * FROM agent_destinations WHERE agent_group_id = ? AND target_type = ? AND target_id = ?')
|
||||||
'SELECT * FROM agent_destinations WHERE agent_group_id = ? AND target_type = ? AND target_id = ?',
|
|
||||||
)
|
|
||||||
.get(agentGroupId, targetType, targetId) as AgentDestination | undefined;
|
.get(agentGroupId, targetType, targetId) as AgentDestination | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Permission check: can this agent send to this target? */
|
/** Permission check: can this agent send to this target? */
|
||||||
export function hasDestination(
|
export function hasDestination(agentGroupId: string, targetType: 'channel' | 'agent', targetId: string): boolean {
|
||||||
agentGroupId: string,
|
|
||||||
targetType: 'channel' | 'agent',
|
|
||||||
targetId: string,
|
|
||||||
): boolean {
|
|
||||||
const row = getDb()
|
const row = getDb()
|
||||||
.prepare(
|
.prepare('SELECT 1 FROM agent_destinations WHERE agent_group_id = ? AND target_type = ? AND target_id = ? LIMIT 1')
|
||||||
'SELECT 1 FROM agent_destinations WHERE agent_group_id = ? AND target_type = ? AND target_id = ? LIMIT 1',
|
|
||||||
)
|
|
||||||
.get(agentGroupId, targetType, targetId);
|
.get(agentGroupId, targetType, targetId);
|
||||||
return !!row;
|
return !!row;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleteDestination(agentGroupId: string, localName: string): void {
|
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. */
|
/** Normalize a human-readable name into a lowercase, dash-separated identifier. */
|
||||||
|
|||||||
@@ -26,12 +26,7 @@ import {
|
|||||||
updateAgentGroup,
|
updateAgentGroup,
|
||||||
getAgentGroupByFolder,
|
getAgentGroupByFolder,
|
||||||
} from './db/agent-groups.js';
|
} from './db/agent-groups.js';
|
||||||
import {
|
import { createDestination, getDestinationByName, hasDestination, normalizeName } from './db/agent-destinations.js';
|
||||||
createDestination,
|
|
||||||
getDestinationByName,
|
|
||||||
hasDestination,
|
|
||||||
normalizeName,
|
|
||||||
} from './db/agent-destinations.js';
|
|
||||||
import { getMessagingGroupByPlatform, getMessagingGroupsByAgentGroup } from './db/messaging-groups.js';
|
import { getMessagingGroupByPlatform, getMessagingGroupsByAgentGroup } from './db/messaging-groups.js';
|
||||||
import { log } from './log.js';
|
import { log } from './log.js';
|
||||||
import {
|
import {
|
||||||
@@ -617,7 +612,10 @@ async function handleSystemAction(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Fire-and-forget notification back to the creator
|
// Fire-and-forget notification back to the creator
|
||||||
notifyAgent(session, `Agent "${localName}" created. You can now message it with <message to="${localName}">...</message>.`);
|
notifyAgent(
|
||||||
|
session,
|
||||||
|
`Agent "${localName}" created. You can now message it with <message to="${localName}">...</message>.`,
|
||||||
|
);
|
||||||
log.info('Agent group created', { agentGroupId, name, localName, folder, parent: sourceGroup.id });
|
log.info('Agent group created', { agentGroupId, name, localName, folder, parent: sourceGroup.id });
|
||||||
// Note: requestId is unused — this is fire-and-forget, not request/response.
|
// Note: requestId is unused — this is fire-and-forget, not request/response.
|
||||||
void requestId;
|
void requestId;
|
||||||
@@ -636,12 +634,18 @@ async function handleSystemAction(
|
|||||||
notifyAgent(session, 'add_mcp_server failed: name and command are required.');
|
notifyAgent(session, 'add_mcp_server failed: name and command are required.');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
await requestApproval(session, agentGroup.name, 'add_mcp_server', {
|
await requestApproval(
|
||||||
|
session,
|
||||||
|
agentGroup.name,
|
||||||
|
'add_mcp_server',
|
||||||
|
{
|
||||||
name: serverName,
|
name: serverName,
|
||||||
command,
|
command,
|
||||||
args: (content.args as string[]) || [],
|
args: (content.args as string[]) || [],
|
||||||
env: (content.env as Record<string, string>) || {},
|
env: (content.env as Record<string, string>) || {},
|
||||||
}, `Agent "${agentGroup.name}" requests a new MCP server:\n${serverName} (${command})`);
|
},
|
||||||
|
`Agent "${agentGroup.name}" requests a new MCP server:\n${serverName} (${command})`,
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user