[codex] Show recent notes in user popovers (#270)

This commit is contained in:
Wes
2026-04-08 12:24:10 -07:00
committed by GitHub
parent 7a9218ba54
commit 7a1eb31492
10 changed files with 316 additions and 17 deletions

View File

@@ -0,0 +1,55 @@
import type { UserNote, UserNotesResponse } from "@/shared/api/socialTypes";
import { invokeTauri } from "./tauri";
type RawUserNote = {
id: string;
pubkey: string;
created_at: number;
content: string;
};
type RawUserNotesCursor = {
before: number;
before_id: string;
};
type RawUserNotesResponse = {
notes: RawUserNote[];
next_cursor: RawUserNotesCursor | null;
};
function fromRawUserNote(note: RawUserNote): UserNote {
return {
id: note.id,
pubkey: note.pubkey,
createdAt: note.created_at,
content: note.content,
};
}
export async function getUserNotes(
pubkey: string,
options?: {
limit?: number;
before?: number;
beforeId?: string;
},
): Promise<UserNotesResponse> {
const response = await invokeTauri<RawUserNotesResponse>("get_user_notes", {
pubkey,
limit: options?.limit ?? null,
before: options?.before ?? null,
beforeId: options?.beforeId ?? null,
});
return {
notes: response.notes.map(fromRawUserNote),
nextCursor: response.next_cursor
? {
before: response.next_cursor.before,
beforeId: response.next_cursor.before_id,
}
: null,
};
}

View File

@@ -0,0 +1,16 @@
export type UserNote = {
id: string;
pubkey: string;
createdAt: number;
content: string;
};
export type UserNotesCursor = {
before: number;
beforeId: string;
};
export type UserNotesResponse = {
notes: UserNote[];
nextCursor: UserNotesCursor | null;
};

View File

@@ -389,8 +389,6 @@ export type ManagedAgentPrereqs = {
mcp: CommandAvailability;
};
// ── Model discovery types ─────────────────────────────────────────────────────
export type AgentModelsResponse = {
agentName: string;
agentVersion: string;
@@ -399,19 +397,16 @@ export type AgentModelsResponse = {
selectedModel: string | null;
supportsSwitching: boolean;
};
export type AgentModelInfo = {
id: string;
name: string | null;
description: string | null;
};
export type UpdateManagedAgentInput = {
pubkey: string;
model?: string | null;
systemPrompt?: string | null;
};
export type AgentPersona = {
id: string;
displayName: string;
@@ -442,9 +437,6 @@ export type UpdatePersonaInput = {
provider?: string;
model?: string;
};
// ── Team types ────────────────────────────────────────────────────────────────
export type AgentTeam = {
id: string;
name: string;
@@ -466,8 +458,6 @@ export type UpdateTeamInput = {
description?: string;
personaIds: string[];
};
// ── Workflow types (re-exported from workflowTypes.ts) ────────────────────
export type {
ApprovalActionResponse,
Workflow,
@@ -480,8 +470,11 @@ export type {
TraceEntry,
TriggerWorkflowResponse,
} from "@/shared/api/workflowTypes";
// ── Forum types ───────────────────────────────────────────────────────────────
export type {
UserNote,
UserNotesCursor,
UserNotesResponse,
} from "./socialTypes";
export type ThreadSummary = {
replyCount: number;