Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/convex/convex/lib/teamReadKeyHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
// and a known key is charged before its parameters are read. Both limiters
// fail closed.
//
// Each session carries transcript_messages: the count of every message in its
// transcript, so the person's prompts, the agent's replies and tool results
// all add to it. The team feed shows the same count at every sharing level.
//
// Answers 200 { sessions, next_cursor }; 400 for a bad parameter or cursor;
// 401 for a missing, unknown, revoked or expired key; 429 over a limit.
import { httpAction } from "../_generated/server";
Expand Down
6 changes: 4 additions & 2 deletions packages/convex/convex/teamReadKeys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe("team read keys", () => {
test("rows are the team floor at each member's level, metadata only, without child sessions", async () => {
const { t, ada, mo, hal, team, other, as } = await setup();
await session(t, ada, { team_id: team, title: "Ada shared", subtitle: "Ada summary", updated_at: NOW - HOUR });
await session(t, mo, { team_id: team, title: "Mo work", subtitle: "Mo summary", updated_at: NOW - 2 * HOUR });
await session(t, mo, { team_id: team, title: "Mo work", subtitle: "Mo summary", updated_at: NOW - 2 * HOUR, message_count: 42 });
await session(t, hal, { team_id: team, title: "Hal hidden" });
await session(t, ada, { team_id: other, title: "Ada other team" });
await session(t, ada, { title: "Ada personal", is_private: true });
Expand All @@ -140,11 +140,13 @@ describe("team read keys", () => {
title: "Ada shared",
summary: "Ada summary",
sharing: "full",
transcript_messages: 1,
work_state: expect.any(String),
started_at: new Date(NOW - 2 * HOUR).toISOString(),
updated_at: new Date(NOW - HOUR).toISOString(),
},
expect.objectContaining({ title: "Mo work", summary: "Mo summary", sharing: "summary", owner: expect.objectContaining({ name: "Mo" }) }),
// The team feed shows a summary share's message count too.
expect.objectContaining({ title: "Mo work", summary: "Mo summary", sharing: "summary", transcript_messages: 42, owner: expect.objectContaining({ name: "Mo" }) }),
expect.objectContaining({ title: "Assigned to Mo", sharing: "full", owner: expect.objectContaining({ id: String(mo) }), repo: null }),
]);
for (const leak of SECRETS) expect(raw).not.toContain(leak);
Expand Down
3 changes: 3 additions & 0 deletions packages/convex/convex/teamReadKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ export type TeamSessionRow = {
summary: string | null;
/** The level the owner shares this session with the team at. */
sharing: "summary" | "full";
/** Every message in the transcript: the person's, the agent's and tool results. */
transcript_messages: number;
work_state: WorkState;
started_at: string;
updated_at: string;
Expand Down Expand Up @@ -259,6 +261,7 @@ export const sessionsForKey = internalQuery({
title: (c.title_is_custom || c.subtitle !== undefined) && !needsHostedTitle(c) ? (c.title ?? null) : null,
summary: c.subtitle ?? null,
sharing: floor.contentVisible(c) ? "full" : "summary",
transcript_messages: c.message_count,
work_state: (await classifier.classify(c)).work_state,
started_at: new Date(c.started_at).toISOString(),
updated_at: new Date(c.updated_at).toISOString(),
Expand Down
Loading