SPB Git forge

spb/polyllm

Public
15commits 1branches 0releases
2.2 MBsize
maindefault branch
13 days agolast push
TypeScript 97.4% SQL 1% JavaScript 0.9% CSS 0.6%
4.8 KB · 77 lines typescript
Raw Blame History
1/** Client-safe types re-exported from server modules (type-only imports are erased at build). */2export type { PolyModel, ProviderId, ModelCapabilities, ModelParameters, ModelPricing, ReasoningEffort, UnifiedGenerationSettings, Usage, PolyProviderErrorShape, PolyErrorCode } from "@/lib/ai/core/types";3export type { PublicConversation } from "@/lib/conversations/service";4export type { PublicMessage, StoredPart } from "@/lib/chat/service";5export type { PublicConnection } from "@/lib/providers/keys";6export type { GenerationSettingsInput, ChatRequestInput } from "@/lib/chat/schemas";7export type { ModelPreset, PromptPreset, Folder, UserPreferences, ArenaSession, ArenaResponse } from "@/db/schema";8export type { Project, ProjectFile, Prompt, CustomEndpoint, ArenaVote } from "@/db/schema-workspace";910export interface ModelsResponse {11  models: import("@/lib/ai/core/types").PolyModel[];12  favorites: string[];13  recents: string[];14  /** User labels per model key. */15  labels: Record<string, string>;16  connectedProviders: import("@/lib/ai/core/types").ProviderId[];17}1819export interface ConversationsResponse {20  conversations: import("@/lib/conversations/service").PublicConversation[];21  nextCursor: string | null;22}2324export interface ConversationDetail {25  conversation: import("@/lib/conversations/service").PublicConversation;26  messages: import("@/lib/chat/service").PublicMessage[];27}2829/** Events emitted by POST /api/chat (SSE). */30export type ChatStreamEvent =31  | { type: "meta"; conversationId: string; isNewConversation: boolean; userMessage: import("@/lib/chat/service").PublicMessage | null; assistantMessageId: string; modelKey: string; clientId?: string }32  | { type: "text-delta"; text: string }33  | { type: "reasoning-delta"; text: string }34  | { type: "tool-start"; id: string; name: string }35  | { type: "tool-delta"; id: string; argumentsDelta: string }36  | { type: "tool-end"; id: string; name: string; arguments: Record<string, unknown>; argumentsText?: string }37  | { type: "tool-result"; id: string; name: string; result: unknown; isError: boolean; durationMs: number }38  | { type: "server-tool"; name: string; status: "started" | "completed"; data?: unknown }39  | { type: "citation"; citation: { url?: string; title?: string; snippet?: string } }40  | { type: "refusal"; category?: string | null; explanation?: string | null }41  | { type: "error"; error: import("@/lib/ai/core/types").PolyProviderErrorShape }42  | { type: "done"; message: import("@/lib/chat/service").PublicMessage; usage?: import("@/lib/ai/core/types").Usage; costUsd: number | null; latencyMs: number; ttftMs?: number; status: "complete" | "stopped" | "error"; title?: string; error?: import("@/lib/ai/core/types").PolyProviderErrorShape };4344/** Extra fields the chat `meta` event carries since the 1.0 upgrade (workstream A). */45export interface ChatMetaExtras {46  /** Temporary chat — nothing persisted except the usage record; `conversationId` is the "ephemeral" sentinel. */47  ephemeral?: boolean;48  /** Server request id (X-Request-Id) for the error details sheet. */49  requestId?: string;50}51/** Diagnostics stored on a failed assistant message (see `lib/chat/service.ts` `StoredMessageError`). */52export type { StoredMessageError } from "@/lib/chat/service";53/** Response of POST /api/chat/adopt. */54export interface ChatAdoptResponse {55  conversation: import("@/lib/conversations/service").PublicConversation;56  userMessage: import("@/lib/chat/service").PublicMessage | null;57  message: import("@/lib/chat/service").PublicMessage;58  isNewConversation: boolean;59}6061/** Workspace (Projects / Library / Prompt library) public shapes — appended by the Projects workstream. */62export type { PublicProject, ProjectDetail } from "@/lib/projects/service";63export type { PublicProjectFile, PendingAttachment } from "@/lib/library/service";64export type { PublicPrompt, PromptKind, UsePromptResult } from "@/lib/prompts/service";65export type { PromptVariable } from "@/lib/prompts/variables";6667// --- Search / share / export (workstream G) -------------------------------------------------------68export type { SearchResponse, SearchGroup, SearchConversationHit, SearchMessageHit, SearchModelHit, SearchPromptHit, SearchProjectHit, SearchPresetHit } from "@/lib/search/service";69export type { ShareLinkItem, ExportFormat, ShareSnapshotMeta } from "@/lib/conversations/service";70export type { ParsedQuery, FilterToken, FilterKey } from "@/lib/search/query";7172// --- Usage analytics, providers, custom endpoints (workstream E) ------------------------------73export type { PublicEndpoint, EndpointInput, EndpointPatch, EndpointProbeResult } from "@/lib/endpoints/service";74export type { ManualModel } from "@/lib/ai/providers/custom";75export type { UsageSummary, UsageKpis, UsageSeriesPoint, ProviderAgg, ModelAgg, UsageProjection, RecentRecord } from "@/lib/usage/service";76export type { SavingsOpportunity } from "@/lib/usage/savings";77