Skip to content

Commit bcd2d19

Browse files
committed
Add dashboard session and usage views
1 parent 27d3589 commit bcd2d19

40 files changed

Lines changed: 3038 additions & 14 deletions

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,13 @@ sprints/
4040
htmlcov/
4141
.mcp.json
4242
.playwright-mcp/
43+
44+
# Local E2E screenshots
45+
login-error.png
46+
login-fixed.png
47+
login-page.png
48+
login-username-password.png
49+
pm-admin-denied.png
50+
project-detail.png
51+
projects-after-login.png
52+
projects-page.png

login-error.png

-29.8 KB
Binary file not shown.

login-fixed.png

-64.5 KB
Binary file not shown.

login-page.png

-18.8 KB
Binary file not shown.

login-username-password.png

-19.3 KB
Binary file not shown.

packages/shared/api_types.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,21 @@ class AddUserRequest(BaseModel):
189189
role: Literal["pm", "admin"] = "pm"
190190

191191

192+
class UpdateUserFeishuBindingRequest(BaseModel):
193+
"""Admin request to update a platform user's Feishu binding."""
194+
195+
feishu_user_id: str | None = Field(default=None, max_length=128)
196+
197+
198+
class KeeperPairingCodeInfo(BaseModel):
199+
"""One-time code used to bind a PM's Feishu account to a project Keeper bot."""
200+
201+
code: str
202+
project_id: str
203+
expires_at: datetime
204+
status: Literal["active", "used", "expired"]
205+
206+
192207
class LoginRequest(BaseModel):
193208
"""Request to log in with username and password."""
194209

@@ -226,6 +241,16 @@ class TokenUsageDayRow(BaseModel):
226241
output_tokens: int
227242

228243

244+
class TokenUsageScopeRow(BaseModel):
245+
"""Aggregated token consumption for one scope (agent/session) and model."""
246+
247+
scope_id: str
248+
model: str
249+
input_tokens: int
250+
output_tokens: int
251+
request_count: int
252+
253+
229254
class CreateProjectRequest(BaseModel):
230255
"""Request to create a new project from the Dashboard."""
231256

@@ -306,6 +331,53 @@ class UpdateScoutRequest(BaseModel):
306331
# ============================================================================
307332

308333

334+
class ConversationSessionListItem(BaseModel):
335+
"""Summary row for one stored conversation session."""
336+
337+
session_id: str
338+
project_id: str
339+
agent_id: str
340+
agent_role: Literal["keeper", "scout", "queen", "forager"] | str
341+
source: Literal["feishu_private", "feishu_group", "web"]
342+
counterparty_id: str | None = None
343+
counterparty_name: str | None = None
344+
group_id: str | None = None
345+
status: str
346+
message_count: int
347+
started_at: datetime
348+
last_message_at: datetime
349+
last_trace_id: str | None = None
350+
351+
352+
class ConversationMessageItem(BaseModel):
353+
"""One message within a stored conversation transcript."""
354+
355+
message_id: str
356+
session_id: str
357+
project_id: str
358+
agent_id: str
359+
trace_id: str | None = None
360+
role: Literal["user", "assistant", "tool", "system"] | str
361+
sender_id: str | None = None
362+
sender_name: str | None = None
363+
content_text: str
364+
content_json: dict = Field(default_factory=dict)
365+
message_source_id: str | None = None
366+
created_at: datetime
367+
368+
369+
class ConversationSessionDetail(ConversationSessionListItem):
370+
"""Full transcript view for one conversation session."""
371+
372+
messages: list[ConversationMessageItem]
373+
374+
375+
class PostSessionMessageRequest(BaseModel):
376+
"""Post one user-authored message from the dashboard into a Keeper session."""
377+
378+
content_text: str = Field(min_length=1, max_length=20000)
379+
380+
309381
# ============================================================================
310382
# Trace / Span Types
311383
# ============================================================================

packages/shared/api_types.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,45 @@ export interface ScoutInfo {
4040
created_at: string;
4141
}
4242

43+
export interface ConversationSessionListItem {
44+
session_id: string;
45+
project_id: string;
46+
agent_id: string;
47+
agent_role: string;
48+
source: "feishu_private" | "feishu_group" | "web";
49+
counterparty_id: string | null;
50+
counterparty_name: string | null;
51+
group_id: string | null;
52+
status: string;
53+
message_count: number;
54+
started_at: string;
55+
last_message_at: string;
56+
last_trace_id: string | null;
57+
}
58+
59+
export interface ConversationMessageItem {
60+
message_id: string;
61+
session_id: string;
62+
project_id: string;
63+
agent_id: string;
64+
trace_id: string | null;
65+
role: string;
66+
sender_id: string | null;
67+
sender_name: string | null;
68+
content_text: string;
69+
content_json: Record<string, unknown>;
70+
message_source_id: string | null;
71+
created_at: string;
72+
}
73+
74+
export interface ConversationSessionDetail extends ConversationSessionListItem {
75+
messages: ConversationMessageItem[];
76+
}
77+
78+
export interface PostSessionMessageRequest {
79+
content_text: string;
80+
}
81+
4382
export interface ProjectDetail {
4483
project_id: string;
4584
project_name: string;
@@ -146,6 +185,17 @@ export interface AddUserRequest {
146185
role: "pm" | "admin";
147186
}
148187

188+
export interface UpdateUserFeishuBindingRequest {
189+
feishu_user_id: string | null;
190+
}
191+
192+
export interface KeeperPairingCodeInfo {
193+
code: string;
194+
project_id: string;
195+
expires_at: string;
196+
status: "active" | "used" | "expired";
197+
}
198+
149199
export interface CreateInviteCodeRequest {
150200
expires_in_hours: number;
151201
}
@@ -172,6 +222,14 @@ export interface TokenUsageDayRow {
172222
output_tokens: number;
173223
}
174224

225+
export interface TokenUsageScopeRow {
226+
scope_id: string;
227+
model: string;
228+
input_tokens: number;
229+
output_tokens: number;
230+
request_count: number;
231+
}
232+
175233
// ============================================================================
176234
// Trace / Span Types
177235
// ============================================================================

pm-admin-denied.png

-34.4 KB
Binary file not shown.

project-detail.png

-56.9 KB
Binary file not shown.

projects-after-login.png

-29.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)