mirror of
https://github.com/block/buzz.git
synced 2026-12-01 13:42:45 +00:00
[codex] Show recent notes in user popovers (#270)
This commit is contained in:
55
desktop/src/shared/api/social.ts
Normal file
55
desktop/src/shared/api/social.ts
Normal 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,
|
||||
};
|
||||
}
|
||||
16
desktop/src/shared/api/socialTypes.ts
Normal file
16
desktop/src/shared/api/socialTypes.ts
Normal 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;
|
||||
};
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user