chore: init main branch
This commit is contained in:
commit
549c8b5b13
231 files changed
+27286
No files matched your search
@@ -0,0 +1,110 @@
|
||||
// Dashboard types — match the Rust structs in src-tauri/src/dashboard.rs (camelCase serde)
|
||||
|
||||
export interface TotalsRow {
|
||||
requests: number;
|
||||
inputOther: number;
|
||||
output: number;
|
||||
inputCacheRead: number;
|
||||
inputCacheCreation: number;
|
||||
costUsd: number;
|
||||
totalTokens: number;
|
||||
cacheHitRate: number;
|
||||
}
|
||||
|
||||
export interface DailyRow extends TotalsRow {
|
||||
date: string;
|
||||
byModel: Record<string, number>;
|
||||
byProvider: Record<string, number>;
|
||||
byProviderModel: Record<string, Record<string, number>>;
|
||||
}
|
||||
|
||||
export interface ModelRow extends TotalsRow {
|
||||
model: string;
|
||||
modelDisplay: string;
|
||||
modelResolved: string;
|
||||
priceId: string;
|
||||
costEstimated: boolean;
|
||||
}
|
||||
|
||||
export interface RecentRow {
|
||||
time: number;
|
||||
model: string;
|
||||
modelDisplay: string;
|
||||
modelResolved: string;
|
||||
inputOther: number;
|
||||
output: number;
|
||||
inputCacheRead: number;
|
||||
inputCacheCreation: number;
|
||||
totalTokens: number;
|
||||
costUsd: number;
|
||||
costEstimated: boolean;
|
||||
priceId: string;
|
||||
fromEnv: boolean;
|
||||
}
|
||||
|
||||
export interface RangeStats {
|
||||
range: string;
|
||||
totals: TotalsRow;
|
||||
daily: DailyRow[];
|
||||
models: ModelRow[];
|
||||
recent: RecentRow[];
|
||||
recentTotal: number;
|
||||
recentLimit: number;
|
||||
}
|
||||
|
||||
export interface HeatmapCell {
|
||||
date: string;
|
||||
dow: number;
|
||||
weekIndex: number;
|
||||
requests: number;
|
||||
totalTokens: number;
|
||||
costUsd: number;
|
||||
cacheHitRate: number;
|
||||
level: number;
|
||||
}
|
||||
|
||||
export interface MonthLabel {
|
||||
weekIndex: number;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface HeatmapData {
|
||||
weeks: number;
|
||||
start: string;
|
||||
end: string;
|
||||
maxTokens: number;
|
||||
cells: HeatmapCell[];
|
||||
monthLabels: MonthLabel[];
|
||||
}
|
||||
|
||||
export interface ScanMeta {
|
||||
filesScanned: number;
|
||||
linesSeen: number;
|
||||
recordCount: number;
|
||||
home: string;
|
||||
sessionsRoot: string;
|
||||
errors: string[];
|
||||
}
|
||||
|
||||
export interface AllModelRow {
|
||||
model: string;
|
||||
modelDisplay: string;
|
||||
requests: number;
|
||||
totalTokens: number;
|
||||
costUsd: number;
|
||||
costEstimated: boolean;
|
||||
cacheHitRate: number;
|
||||
}
|
||||
|
||||
export interface SummaryResult {
|
||||
home: string;
|
||||
valid: boolean;
|
||||
scannedAt: number;
|
||||
meta: ScanMeta;
|
||||
range: string;
|
||||
stats: RangeStats;
|
||||
heatmap: HeatmapData;
|
||||
allModels: AllModelRow[];
|
||||
allModelCount: number;
|
||||
rangeTotals: Record<string, TotalsRow>;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
export interface IconMetadata {
|
||||
/** 图标名称(小写,如 "openai") */
|
||||
name: string;
|
||||
/** 显示名称(如 "OpenAI") */
|
||||
displayName: string;
|
||||
/** 分类(如 "ai-provider", "cloud", "tool") */
|
||||
category: string;
|
||||
/** 搜索关键词 */
|
||||
keywords: string[];
|
||||
/** 默认颜色 */
|
||||
defaultColor?: string;
|
||||
}
|
||||
|
||||
export interface IconPreset {
|
||||
[key: string]: IconMetadata;
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
export type Agent = "kimi_code" | "pi";
|
||||
|
||||
export type ProviderType =
|
||||
| "kimi"
|
||||
| "anthropic"
|
||||
| "openai"
|
||||
| "openai_responses"
|
||||
| "google-genai"
|
||||
| "vertexai";
|
||||
|
||||
export interface Provider {
|
||||
name: string;
|
||||
provider_type: ProviderType;
|
||||
base_url: string | null;
|
||||
api_key: string | null;
|
||||
env: Record<string, string>;
|
||||
/** Optional note / remark for the provider. */
|
||||
note?: string | null;
|
||||
/** Optional official website URL. */
|
||||
official_url?: string | null;
|
||||
/** Managed/OAuth providers skip credential validation. */
|
||||
managed?: boolean;
|
||||
/** Whether the provider is enabled/activated. */
|
||||
enabled?: boolean;
|
||||
/** Whether this provider is the currently active one for Kimi Code. */
|
||||
active?: boolean;
|
||||
/** Manually selected brand icon key (from extracted icons). */
|
||||
icon?: string | null;
|
||||
/** Custom icon color; falls back to icon metadata defaultColor. */
|
||||
icon_color?: string | null;
|
||||
/**
|
||||
* Usage query kinds (e.g. "balance:deepseek", "plan:kimi_coding").
|
||||
* Merged in by the Rust side on load (SQLite settings / base_url detect)
|
||||
* and persisted back to SQLite on save; never written to config.toml.
|
||||
*/
|
||||
usageKinds?: string[];
|
||||
/** Extra agent-specific provider fields preserved across edits. */
|
||||
raw_other?: unknown;
|
||||
}
|
||||
|
||||
export interface Model {
|
||||
alias: string;
|
||||
provider: string;
|
||||
model: string;
|
||||
max_context_size: number;
|
||||
display_name: string | null;
|
||||
/** Whether the model declares extended context / thinking support. */
|
||||
supports_1m?: boolean;
|
||||
/** Agent-specific capability flags (e.g. Kimi Code `capabilities`). */
|
||||
capabilities?: string[];
|
||||
/** Extra agent-specific model fields preserved across edits. */
|
||||
raw_other?: unknown;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
default_model: string | null;
|
||||
providers: Record<string, Provider>;
|
||||
models: Record<string, Model>;
|
||||
raw_other?: unknown;
|
||||
}
|
||||
|
||||
/** A model discovered from a provider's API endpoint. */
|
||||
export interface DiscoveredModel {
|
||||
id: string;
|
||||
display_name: string | null;
|
||||
max_context_size: number | null;
|
||||
}
|
||||
|
||||
export interface ThinkingConfig {
|
||||
enabled?: boolean;
|
||||
effort?: "low" | "medium" | "high" | "max";
|
||||
keep?: "all" | false | 0 | "no" | "off" | "none" | null;
|
||||
}
|
||||
|
||||
export interface LoopControlConfig {
|
||||
max_retries_per_step?: number;
|
||||
reserved_context_size?: number;
|
||||
}
|
||||
|
||||
export interface BackgroundConfig {
|
||||
max_running_tasks?: number;
|
||||
keep_alive_on_exit?: boolean;
|
||||
}
|
||||
|
||||
export interface PermissionRule {
|
||||
decision?: "allow" | "deny" | "ask";
|
||||
scope?: string;
|
||||
pattern?: string;
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
export interface Hook {
|
||||
event?: string;
|
||||
matcher?: string;
|
||||
command?: string;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
export interface AgentSettings {
|
||||
thinking?: ThinkingConfig;
|
||||
loop_control?: LoopControlConfig;
|
||||
background?: BackgroundConfig;
|
||||
permission?: { rules?: PermissionRule[] };
|
||||
hooks?: Hook[];
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Session management types — match Rust structs in dashboard.rs (camelCase serde)
|
||||
|
||||
export interface WorkspaceRow {
|
||||
id: string;
|
||||
name: string;
|
||||
root: string | null;
|
||||
createdAt: string | null;
|
||||
lastOpenedAt: string | null;
|
||||
activeCount: number;
|
||||
archivedCount: number;
|
||||
empty: boolean;
|
||||
}
|
||||
|
||||
export interface SessionRow {
|
||||
id: string;
|
||||
workspaceId: string;
|
||||
status: "active" | "archived" | string;
|
||||
title: string | null;
|
||||
workDir: string | null;
|
||||
createdAt: string | null;
|
||||
updatedAt: string | null;
|
||||
bytes: number;
|
||||
files: number;
|
||||
}
|
||||
|
||||
export interface SessionsResult {
|
||||
home: string;
|
||||
archiveRoot: string;
|
||||
workspaces: WorkspaceRow[];
|
||||
sessions: SessionRow[];
|
||||
}
|
||||
|
||||
export interface ActionResponse {
|
||||
ok: boolean;
|
||||
workspaceId: string;
|
||||
sessionId: string;
|
||||
status?: string | null;
|
||||
path?: string | null;
|
||||
deleted?: boolean | null;
|
||||
}
|
||||
|
||||
export interface PreviewMessage {
|
||||
role: string;
|
||||
time: number | null;
|
||||
text: string;
|
||||
}
|
||||
|
||||
export interface PreviewResult {
|
||||
workspaceId: string;
|
||||
sessionId: string;
|
||||
status: string;
|
||||
title: string | null;
|
||||
workDir: string | null;
|
||||
createdAt: string | null;
|
||||
updatedAt: string | null;
|
||||
messageCount: number;
|
||||
truncated: boolean;
|
||||
messages: PreviewMessage[];
|
||||
}
|
||||
|
||||
export type SessionStatusFilter = "active" | "archived" | "all";
|
||||
Reference in new issue
Block a user