feat(orchestration): multi-agent communication, unified agents, env passthrough

- btmsg: admin role (tier 0), channel messaging (create/list/send/history),
  admin global feed, mark-read conversations
- Rust btmsg module: admin bypass, channels, feed, 8 new Tauri commands
- CommsTab: sidebar chat interface with activity feed, DMs, channels (Ctrl+M)
- Agent unification: Tier 1 agents rendered as ProjectBoxes via agentToProject()
  converter, getAllWorkItems() combines agents + projects in ProjectGrid
- GroupAgentsPanel: click-to-navigate agents to their ProjectBox
- Agent system prompts: generateAgentPrompt() builds comprehensive introductory
  context (role, environment, team, btmsg/bttask docs, workflow instructions)
- AgentSession passes group context to prompt generator via $derived.by()
- BTMSG_AGENT_ID env var passthrough: extra_env field flows through full chain
  (agent-bridge → Rust AgentQueryOptions → NDJSON → sidecar runners → cleanEnv)
- workspace store: updateAgent() for Tier 1 agent config persistence
This commit is contained in:
DexterFromLab 2026-03-11 14:53:39 +01:00
parent 1331d094b3
commit a158ed9544
19 changed files with 1918 additions and 39 deletions

View file

@ -29,6 +29,38 @@ export interface BtmsgMessage {
sender_role?: string;
}
export interface BtmsgFeedMessage {
id: string;
fromAgent: string;
toAgent: string;
content: string;
createdAt: string;
replyTo: string | null;
senderName: string;
senderRole: string;
recipientName: string;
recipientRole: string;
}
export interface BtmsgChannel {
id: string;
name: string;
groupId: string;
createdBy: string;
memberCount: number;
createdAt: string;
}
export interface BtmsgChannelMessage {
id: string;
channelId: string;
fromAgent: string;
content: string;
createdAt: string;
senderName: string;
senderRole: string;
}
/**
* Get all agents in a group with their unread counts.
*/
@ -70,3 +102,59 @@ export async function sendMessage(fromAgent: string, toAgent: string, content: s
export async function setAgentStatus(agentId: string, status: string): Promise<void> {
return invoke('btmsg_set_status', { agentId, status });
}
/**
* Ensure admin agent exists with contacts to all agents.
*/
export async function ensureAdmin(groupId: string): Promise<void> {
return invoke('btmsg_ensure_admin', { groupId });
}
/**
* Get all messages in group (admin global feed).
*/
export async function getAllFeed(groupId: string, limit: number = 100): Promise<BtmsgFeedMessage[]> {
return invoke('btmsg_all_feed', { groupId, limit });
}
/**
* Mark all messages from sender to reader as read.
*/
export async function markRead(readerId: string, senderId: string): Promise<void> {
return invoke('btmsg_mark_read', { readerId, senderId });
}
/**
* Get channels in a group.
*/
export async function getChannels(groupId: string): Promise<BtmsgChannel[]> {
return invoke('btmsg_get_channels', { groupId });
}
/**
* Get messages in a channel.
*/
export async function getChannelMessages(channelId: string, limit: number = 100): Promise<BtmsgChannelMessage[]> {
return invoke('btmsg_channel_messages', { channelId, limit });
}
/**
* Send a message to a channel.
*/
export async function sendChannelMessage(channelId: string, fromAgent: string, content: string): Promise<string> {
return invoke('btmsg_channel_send', { channelId, fromAgent, content });
}
/**
* Create a new channel.
*/
export async function createChannel(name: string, groupId: string, createdBy: string): Promise<string> {
return invoke('btmsg_create_channel', { name, groupId, createdBy });
}
/**
* Add a member to a channel.
*/
export async function addChannelMember(channelId: string, agentId: string): Promise<void> {
return invoke('btmsg_add_channel_member', { channelId, agentId });
}