fix(btmsg): convert positional column access to named, fix camelCase mismatch

CRITICAL: get_agents() used SELECT * positional index 7 for status,
but column 7 is system_prompt (column 8 is status). Converted all
query functions in btmsg.rs and bttask.rs to named column access.

Fixed BtmsgAgent/BtmsgMessage TypeScript interfaces to use camelCase
matching Rust serde(rename_all = camelCase). Updated CommsTab consumer.
This commit is contained in:
Hibryda 2026-03-11 21:54:19 +01:00
parent 32f6d7eadf
commit 93c2cdf434
4 changed files with 99 additions and 88 deletions

View file

@ -10,23 +10,23 @@ export interface BtmsgAgent {
id: string;
name: string;
role: string;
group_id: string;
groupId: string;
tier: number;
model: string | null;
status: string;
unread_count: number;
unreadCount: number;
}
export interface BtmsgMessage {
id: string;
from_agent: string;
to_agent: string;
fromAgent: string;
toAgent: string;
content: string;
read: boolean;
reply_to: string | null;
created_at: string;
sender_name?: string;
sender_role?: string;
replyTo: string | null;
createdAt: string;
senderName?: string;
senderRole?: string;
}
export interface BtmsgFeedMessage {

View file

@ -257,8 +257,8 @@
<span class="conv-icon">{getAgentIcon(agent.role)}</span>
<span class="conv-name">{agent.name}</span>
<span class="status-dot {statusClass}"></span>
{#if agent.unread_count > 0}
<span class="unread-badge">{agent.unread_count}</span>
{#if agent.unreadCount > 0}
<span class="unread-badge">{agent.unreadCount}</span>
{/if}
</button>
{/each}
@ -301,11 +301,11 @@
<div class="empty-state">No messages yet. Start the conversation!</div>
{:else}
{#each dmMessages as msg (msg.id)}
{@const isMe = msg.from_agent === ADMIN_ID}
{@const isMe = msg.fromAgent === ADMIN_ID}
<div class="message" class:own={isMe}>
<div class="msg-header">
<span class="msg-sender">{isMe ? 'You' : (msg.sender_name ?? msg.from_agent)}</span>
<span class="msg-time">{formatTime(msg.created_at)}</span>
<span class="msg-sender">{isMe ? 'You' : (msg.senderName ?? msg.fromAgent)}</span>
<span class="msg-time">{formatTime(msg.createdAt)}</span>
</div>
<div class="msg-content">{msg.content}</div>
</div>