-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathapi-types.ts
More file actions
334 lines (289 loc) · 7.72 KB
/
Copy pathapi-types.ts
File metadata and controls
334 lines (289 loc) · 7.72 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
/**
* Centralized API types - imports and re-exports types from worker
* This file serves as the single source of truth for frontend-worker API communication
*/
import { SessionResponse } from 'worker/types/auth-types';
import { AuthUser } from './api-types';
export type { SecretTemplate } from 'worker/types/secretsTemplates';
// Base API Response Types
export type { ControllerResponse, ApiResponse } from 'worker/api/controllers/types';
// Database Types
export type {
PaginationInfo,
EnhancedAppData,
AppWithFavoriteStatus,
TimePeriod,
AppSortOption,
SortOrder,
AppQueryOptions,
PublicAppQueryOptions
} from 'worker/database/types';
// App-related API Types
export type {
AppsListData,
PublicAppsData,
SingleAppData,
FavoriteToggleData,
CreateAppData,
UpdateAppVisibilityData,
AppDeleteData,
AppWithUserAndStats
} from 'worker/api/controllers/apps/types';
export type {
AppDetailsData,
AppStarToggleData,
GeneratedCodeFile,
GitCloneTokenData,
PreviewTokenData
} from 'worker/api/controllers/appView/types';
// User-related API Types
export type {
UserAppsData,
ProfileUpdateData,
} from 'worker/api/controllers/user/types';
// Stats API Types
export type {
UserStatsData,
UserActivityData
} from 'worker/api/controllers/stats/types';
// Analytics API Types
export type {
UserAnalyticsResponseData,
AgentAnalyticsResponseData,
} from 'worker/api/controllers/analytics/types';
export type { PlatformStatusData } from 'worker/api/controllers/status/types';
export type { CapabilitiesData } from 'worker/api/controllers/capabilities/types';
export type {
ViewMode,
FeatureCapabilities,
FeatureDefinition,
ViewDefinition,
PlatformCapabilities,
PlatformCapabilitiesConfig,
} from 'worker/agents/core/features/types';
export {
DEFAULT_FEATURE_DEFINITIONS,
getBehaviorTypeForProject,
} from 'worker/agents/core/features';
// Model Config API Types
export type {
ModelConfigsData,
ModelConfigData,
ModelConfigUpdateData,
ModelConfigTestData,
ModelConfigResetData,
ModelConfigDefaultsData,
ModelConfigDeleteData,
ByokProvidersData,
UserProviderStatus,
ModelsByProvider
} from 'worker/api/controllers/modelConfig/types';
// Model Provider API Types
export type {
ModelProvidersListData,
ModelProviderData,
ModelProviderCreateData,
ModelProviderUpdateData,
ModelProviderDeleteData,
ModelProviderTestData,
CreateProviderRequest,
UpdateProviderRequest,
TestProviderRequest
} from 'worker/api/controllers/modelProviders/types';
// Frontend model config update interface that matches backend schema
export interface ModelConfigUpdate {
modelName?: string | null;
maxTokens?: number | null;
temperature?: number | null;
reasoningEffort?: string | null;
fallbackModel?: string | null;
isUserOverride?: boolean;
}
// Secrets API Types
export type { SecretTemplatesData } from 'worker/api/controllers/secrets/types';
// Vault API Types
export type {
VaultConfig,
VaultConfigResponse,
VaultStatusResponse,
SetupVaultRequest,
KdfAlgorithm,
Argon2Params,
SecretMetadata,
} from 'worker/services/secrets/vault-types';
// Agent/CodeGen API Types
export type {
AgentConnectionData,
} from 'worker/api/controllers/agent/types';
// Template Types
export type {
TemplateDetails,
} from 'worker/services/sandbox/sandboxTypes';
// WebSocket Types
export type {
WebSocketMessage,
WebSocketMessageData,
CodeFixEdits,
ModelConfigsInfoMessage,
AgentDisplayConfig,
ModelConfigsInfo,
CloudflareDeploymentErrorCode
} from 'worker/api/websocketTypes';
// Database/Schema Types commonly used in frontend
export type {
App,
User,
UserModelConfig,
UserModelProvider
} from 'worker/database/schema';
export type {
FavoriteToggleResult,
UserStats,
UserActivity,
UserModelConfigWithMetadata,
ModelTestResult
} from 'worker/database/types';
// Agent/Generator Types
export type {
Blueprint as BlueprintType,
PhasicBlueprint,
CodeReviewOutputType,
FileConceptType,
FileOutputType as GeneratedFile,
} from 'worker/agents/schemas';
export type {
AgentState,
PhasicState
} from 'worker/agents/core/state';
export type {
BehaviorType,
ProjectType
} from 'worker/agents/core/types';
export { isAgenticLikeBehavior } from 'worker/agents/core/types';
export type {
ConversationMessage,
} from 'worker/agents/inferutils/common';
export type {
RuntimeError,
StaticAnalysisResponse
} from 'worker/services/sandbox/sandboxTypes';
// Config/Inference Types
export type {
AgentActionKey,
AgentConfig,
ModelConfig,
ReasoningEffortType as ReasoningEffort,
ProviderOverrideType as ProviderOverride
} from 'worker/agents/inferutils/config.types';
export type { RateLimitError } from "worker/services/rate-limit/errors";
export type { AgentPreviewResponse, CodeGenArgs } from 'worker/api/controllers/agent/types';
export { MAX_AGENT_QUERY_LENGTH } from 'worker/api/controllers/agent/types';
// App Database (DB tab) types
export type {
AppDatabaseColumn,
AppDatabaseTable,
AppDatabaseReadResult,
ListAppTablesResponse,
QueryAppTableResponse,
WipeAppDatabaseResponse,
} from 'worker/api/controllers/appDatabase/types';
export type { RateLimitErrorResponse } from 'worker/api/responses';
export { RateLimitExceededError, SecurityError, SecurityErrorType } from '../shared/types/errors.js';
export type { AIModels } from 'worker/agents/inferutils/config.types';
// Model selection types
export type ModelSelectionMode = 'platform' | 'byok' | 'custom';
// Match chat FileType interface
export interface FileType {
filePath: string;
fileContents: string;
explanation?: string;
isGenerating?: boolean;
needsFixing?: boolean;
hasErrors?: boolean;
language?: string;
}
// Streaming response wrapper types for agent session creation
export interface StreamingResponse {
success: boolean;
stream: Response;
}
export type AgentStreamingResponse = StreamingResponse;
export {
type ImageAttachment,
isSupportedImageType,
MAX_IMAGE_SIZE_BYTES,
MAX_IMAGES_PER_MESSAGE,
SUPPORTED_IMAGE_MIME_TYPES
} from 'worker/types/image-attachment';
// Auth types imported from worker
export type {
AuthSession,
ApiKeyInfo,
AuthResult,
AuthUser,
OAuthProvider
} from 'worker/types/auth-types';
export type {
SessionResponse
} from 'worker/types/auth-types';
// Auth API Response Types (using existing worker types)
export type LoginResponseData = SessionResponse;
export type RegisterResponseData = SessionResponse & {
requiresVerification?: boolean;
};
export type ProfileResponseData = {
user: AuthUser;
sessionId: string;
};
export interface AuthProvidersResponseData {
providers: {
google: boolean;
github: boolean;
cloudflare: boolean;
email: boolean;
};
hasOAuth: boolean;
requiresEmailAuth: boolean;
csrfToken?: string;
csrfExpiresIn?: number;
}
export interface CsrfTokenResponseData {
token: string;
headerName: string;
expiresIn?: number;
}
// Active Sessions Response - matches getUserSessions + isCurrent from controller
export interface ActiveSessionsData {
sessions: Array<{
id: string;
userAgent: string | null;
ipAddress: string | null;
lastActivity: Date;
createdAt: Date;
isCurrent: boolean;
}>;
}
// Linked OAuth Identities Response - matches getLinkedIdentities controller format
export interface LinkedIdentitiesData {
identities: Array<{
provider: string;
email: string | null;
emailVerified: boolean;
createdAt: Date | null;
}>;
}
// API Keys Response - matches controller response format
export interface ApiKeysData {
keys: Array<{
id: string;
name: string;
keyPreview: string;
createdAt: Date | null;
lastUsed: Date | null;
isActive: boolean;
}>;
}
export type {
GitHubExportOptions,
GitHubExportResult,
} from 'worker/services/github/types';