Skip to main content

Fix chat import resolution and monitor decision ordering

Summary​

This update fixes frontend CI typecheck failures caused by an external chat package import path, and adds a defensive sort for monitor tick decisions so the newest decision is always used first in UI state.

What changed​

  1. Switched frontend chat dependency from an external link to the in-repo workspace package.
  2. Updated chat imports to use @quantago/chat-ui.
  3. Extended shared ChatTurn type with optional sender metadata fields used by shared bot conversations.
  4. Added client-side newest-first sort for bot tick decisions.
  5. Fixed one frontend lint error (no-empty) in websocket frame parsing.

Reasoning​

  • CI could not resolve @questingo/ai-chat/client in GitHub Actions because that linked path points outside this repository layout.
  • @quantago/chat-ui exists inside this workspace and is the stable package to depend on for both local and CI environments.
  • The monitor panel reads the first decision row (decisions[0]), so a defensive sort in the API client guarantees deterministic newest-first behavior even if upstream ordering changes.

Key snippets​

// services/frontend/package.json
"@quantago/chat-ui": "workspace:*"
// services/frontend/src/lib/api-client/index.ts
export async function listBotTickDecisions(botId: string, limit = 200): Promise<BotTickDecision[]> {
const res = await apiRequest<{ items: BotTickDecision[] }>(`/api/bots/${botId}/tick-decisions?limit=${limit}`);
return [...res.items].sort((a, b) => Date.parse(b.tickAt) - Date.parse(a.tickAt));
}
// packages/chat-ui/src/StreamingChatPanel.tsx
export interface ChatTurn {
id: string;
role: ChatTurnRole;
content: string;
senderUserId?: string;
senderName?: string | null;
senderEmail?: string | null;
status?: 'streaming' | 'thinking' | 'done' | 'error';
}

Validation​

  • pnpm typecheck from quantago root: passed.
  • pnpm lint from quantago root: passed with warnings only (no errors).