-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathmodels.ts
More file actions
156 lines (143 loc) · 4.48 KB
/
Copy pathmodels.ts
File metadata and controls
156 lines (143 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
export interface ModelInfo {
description: string;
mode: string;
provider: string | null;
label?: string;
}
export interface ModelConfigEntry {
label: string;
description: string;
subheading: string | null;
has_new_tag: boolean;
subscription_tier: string;
non_reasoning_model: string | null;
reasoning_model: string | null;
text_only_model: boolean;
audience?: string | null;
is_default?: boolean;
}
export interface ModelsConfigResponse {
models: Record<string, ModelInfo>;
config: ModelConfigEntry[];
default_models: Record<string, string>;
agentic_research_compare_models?: string[];
}
export interface RateLimitMode {
available: boolean;
remaining_detail: {
kind: string;
remaining?: number;
};
}
export interface RateLimitResponse {
modes: Record<string, RateLimitMode>;
sources: Record<string, RateLimitMode>;
}
export type ModelsConfigSource = "live" | "cache" | "fallback" | "empty";
export type RefreshTier = "got-scraping" | "impit" | "browser";
export interface SpeedBoostStatus {
installed: boolean;
version: string | null;
installedAt: string | null;
runtimeDir: string;
}
/**
* Runtime auth state written by the daemon after every init/reinit/shutdown.
* Lives at profiles/<name>/daemon-status.json. Null when the file does not
* exist (stdio-only installs, first run, daemon not yet started).
*/
export interface DaemonAuthStatus {
authenticated: boolean;
tier: "Anonymous" | "Authenticated" | "Pro" | "Max" | "Enterprise";
userId: string | null;
pid: number;
lastInit: string; // ISO timestamp when init/reinit completed
initDurationMs: number;
error: string | null; // non-null only when init/reinit threw
/**
* Machine-readable reason the daemon is unauthenticated, so the UI can be
* honest instead of always saying "use Refresh state to reconnect":
* - "ok" authenticated (or status not applicable)
* - "vault-locked" the profile's vault could not be unsealed by the daemon
* (passphrase missing/wrong in the daemon process) — a
* plain reinit will NOT recover; the passphrase must be
* re-supplied (see POST /daemon/reinit).
* - "not-logged-in" no saved session for this profile (run login).
* Optional for back-compat with statuses written by older daemons.
*/
reason?: "ok" | "vault-locked" | "not-logged-in";
}
export interface AccountSnapshot {
loggedIn: boolean;
userId: string | null;
tier: "Anonymous" | "Authenticated" | "Pro" | "Max" | "Enterprise";
canUseComputer: boolean;
modelsConfig: ModelsConfigResponse | null;
modelsConfigSource: ModelsConfigSource;
rateLimits: RateLimitResponse | null;
configDir: string;
browserProfileDir: string;
lastUpdated: string | null;
/** Which tier last satisfied a live refresh — null when no refresh has completed yet. */
lastRefreshTier: RefreshTier | null;
speedBoost: SpeedBoostStatus;
/**
* Live auth state from the running daemon. Null when daemon-status.json does
* not exist (stdio mode, first run, or daemon not yet started). When present
* and authenticated=false while loggedIn=true, the daemon sees anonymous mode
* despite stored credentials — the Refresh button can trigger a reinit.
*/
daemonAuth: DaemonAuthStatus | null;
}
export interface SavedResearchSummary {
id: string;
query: string;
tool: string;
model: string | null;
status: "completed" | "pending" | "failed";
createdAt: string;
completedAt?: string;
threadUrl?: string;
answerPreview: string;
sourceCount: number;
fileCount: number;
error?: string;
}
export interface HistorySource {
n: number;
title: string;
url: string;
snippet?: string;
}
export interface HistoryAttachment {
filename: string;
relPath: string;
mimeType?: string;
sizeBytes?: number;
kind?: "image" | "file";
}
export interface HistoryItem {
id: string;
tool: string;
query: string;
model: string | null;
mode: string | null;
language: string | null;
createdAt: string;
answerPreview: string;
sourceCount: number;
threadUrl?: string;
status?: "completed" | "pending" | "failed";
completedAt?: string;
tier?: "Max" | "Pro" | "Enterprise" | "Authenticated" | "Anonymous";
threadSlug?: string | null;
backendUuid?: string | null;
readWriteToken?: string | null;
sources?: HistorySource[];
attachments?: HistoryAttachment[];
tags?: string[];
pinned?: boolean;
source?: "mcp" | "cloud";
cloudHydratedAt?: string;
error?: string;
}