@cf-vibesdk/sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1562 -0
- package/dist/index.js +501 -0
- package/dist/node.d.ts +67 -0
- package/dist/node.js +12 -0
- package/package.json +37 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1562 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
import z from 'zod';
|
|
4
|
+
|
|
5
|
+
declare const FileOutputSchema: z.ZodObject<{
|
|
6
|
+
filePath: z.ZodString;
|
|
7
|
+
fileContents: z.ZodString;
|
|
8
|
+
filePurpose: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
filePath: string;
|
|
11
|
+
fileContents: string;
|
|
12
|
+
filePurpose: string;
|
|
13
|
+
}, {
|
|
14
|
+
filePath: string;
|
|
15
|
+
fileContents: string;
|
|
16
|
+
filePurpose: string;
|
|
17
|
+
}>;
|
|
18
|
+
declare const FileConceptSchema: z.ZodObject<{
|
|
19
|
+
path: z.ZodString;
|
|
20
|
+
purpose: z.ZodString;
|
|
21
|
+
changes: z.ZodNullable<z.ZodString>;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
path: string;
|
|
24
|
+
purpose: string;
|
|
25
|
+
changes: string | null;
|
|
26
|
+
}, {
|
|
27
|
+
path: string;
|
|
28
|
+
purpose: string;
|
|
29
|
+
changes: string | null;
|
|
30
|
+
}>;
|
|
31
|
+
declare const PhaseConceptSchema: z.ZodObject<{
|
|
32
|
+
name: z.ZodString;
|
|
33
|
+
description: z.ZodString;
|
|
34
|
+
files: z.ZodArray<z.ZodObject<{
|
|
35
|
+
path: z.ZodString;
|
|
36
|
+
purpose: z.ZodString;
|
|
37
|
+
changes: z.ZodNullable<z.ZodString>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
path: string;
|
|
40
|
+
purpose: string;
|
|
41
|
+
changes: string | null;
|
|
42
|
+
}, {
|
|
43
|
+
path: string;
|
|
44
|
+
purpose: string;
|
|
45
|
+
changes: string | null;
|
|
46
|
+
}>, "many">;
|
|
47
|
+
lastPhase: z.ZodBoolean;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
files: {
|
|
52
|
+
path: string;
|
|
53
|
+
purpose: string;
|
|
54
|
+
changes: string | null;
|
|
55
|
+
}[];
|
|
56
|
+
lastPhase: boolean;
|
|
57
|
+
}, {
|
|
58
|
+
name: string;
|
|
59
|
+
description: string;
|
|
60
|
+
files: {
|
|
61
|
+
path: string;
|
|
62
|
+
purpose: string;
|
|
63
|
+
changes: string | null;
|
|
64
|
+
}[];
|
|
65
|
+
lastPhase: boolean;
|
|
66
|
+
}>;
|
|
67
|
+
declare const CodeReviewOutput: z.ZodObject<{
|
|
68
|
+
dependenciesNotMet: z.ZodArray<z.ZodString, "many">;
|
|
69
|
+
issuesFound: z.ZodBoolean;
|
|
70
|
+
frontendIssues: z.ZodArray<z.ZodString, "many">;
|
|
71
|
+
backendIssues: z.ZodArray<z.ZodString, "many">;
|
|
72
|
+
filesToFix: z.ZodArray<z.ZodObject<{
|
|
73
|
+
filePath: z.ZodString;
|
|
74
|
+
issues: z.ZodArray<z.ZodString, "many">;
|
|
75
|
+
require_code_changes: z.ZodBoolean;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
issues: string[];
|
|
78
|
+
filePath: string;
|
|
79
|
+
require_code_changes: boolean;
|
|
80
|
+
}, {
|
|
81
|
+
issues: string[];
|
|
82
|
+
filePath: string;
|
|
83
|
+
require_code_changes: boolean;
|
|
84
|
+
}>, "many">;
|
|
85
|
+
commands: z.ZodArray<z.ZodString, "many">;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
commands: string[];
|
|
88
|
+
dependenciesNotMet: string[];
|
|
89
|
+
issuesFound: boolean;
|
|
90
|
+
frontendIssues: string[];
|
|
91
|
+
backendIssues: string[];
|
|
92
|
+
filesToFix: {
|
|
93
|
+
issues: string[];
|
|
94
|
+
filePath: string;
|
|
95
|
+
require_code_changes: boolean;
|
|
96
|
+
}[];
|
|
97
|
+
}, {
|
|
98
|
+
commands: string[];
|
|
99
|
+
dependenciesNotMet: string[];
|
|
100
|
+
issuesFound: boolean;
|
|
101
|
+
frontendIssues: string[];
|
|
102
|
+
backendIssues: string[];
|
|
103
|
+
filesToFix: {
|
|
104
|
+
issues: string[];
|
|
105
|
+
filePath: string;
|
|
106
|
+
require_code_changes: boolean;
|
|
107
|
+
}[];
|
|
108
|
+
}>;
|
|
109
|
+
declare const PhasicBlueprintSchema: z.ZodObject<{
|
|
110
|
+
title: z.ZodString;
|
|
111
|
+
projectName: z.ZodString;
|
|
112
|
+
description: z.ZodString;
|
|
113
|
+
colorPalette: z.ZodArray<z.ZodString, "many">;
|
|
114
|
+
} & {
|
|
115
|
+
detailedDescription: z.ZodString;
|
|
116
|
+
views: z.ZodArray<z.ZodObject<{
|
|
117
|
+
name: z.ZodString;
|
|
118
|
+
description: z.ZodString;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
name: string;
|
|
121
|
+
description: string;
|
|
122
|
+
}, {
|
|
123
|
+
name: string;
|
|
124
|
+
description: string;
|
|
125
|
+
}>, "many">;
|
|
126
|
+
userFlow: z.ZodObject<{
|
|
127
|
+
uiLayout: z.ZodString;
|
|
128
|
+
uiDesign: z.ZodString;
|
|
129
|
+
userJourney: z.ZodString;
|
|
130
|
+
}, "strip", z.ZodTypeAny, {
|
|
131
|
+
uiLayout: string;
|
|
132
|
+
uiDesign: string;
|
|
133
|
+
userJourney: string;
|
|
134
|
+
}, {
|
|
135
|
+
uiLayout: string;
|
|
136
|
+
uiDesign: string;
|
|
137
|
+
userJourney: string;
|
|
138
|
+
}>;
|
|
139
|
+
dataFlow: z.ZodString;
|
|
140
|
+
architecture: z.ZodObject<{
|
|
141
|
+
dataFlow: z.ZodString;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
dataFlow: string;
|
|
144
|
+
}, {
|
|
145
|
+
dataFlow: string;
|
|
146
|
+
}>;
|
|
147
|
+
pitfalls: z.ZodArray<z.ZodString, "many">;
|
|
148
|
+
frameworks: z.ZodArray<z.ZodString, "many">;
|
|
149
|
+
implementationRoadmap: z.ZodArray<z.ZodObject<{
|
|
150
|
+
phase: z.ZodString;
|
|
151
|
+
description: z.ZodString;
|
|
152
|
+
}, "strip", z.ZodTypeAny, {
|
|
153
|
+
description: string;
|
|
154
|
+
phase: string;
|
|
155
|
+
}, {
|
|
156
|
+
description: string;
|
|
157
|
+
phase: string;
|
|
158
|
+
}>, "many">;
|
|
159
|
+
initialPhase: z.ZodObject<{
|
|
160
|
+
name: z.ZodString;
|
|
161
|
+
description: z.ZodString;
|
|
162
|
+
files: z.ZodArray<z.ZodObject<{
|
|
163
|
+
path: z.ZodString;
|
|
164
|
+
purpose: z.ZodString;
|
|
165
|
+
changes: z.ZodNullable<z.ZodString>;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
path: string;
|
|
168
|
+
purpose: string;
|
|
169
|
+
changes: string | null;
|
|
170
|
+
}, {
|
|
171
|
+
path: string;
|
|
172
|
+
purpose: string;
|
|
173
|
+
changes: string | null;
|
|
174
|
+
}>, "many">;
|
|
175
|
+
lastPhase: z.ZodBoolean;
|
|
176
|
+
}, "strip", z.ZodTypeAny, {
|
|
177
|
+
name: string;
|
|
178
|
+
description: string;
|
|
179
|
+
files: {
|
|
180
|
+
path: string;
|
|
181
|
+
purpose: string;
|
|
182
|
+
changes: string | null;
|
|
183
|
+
}[];
|
|
184
|
+
lastPhase: boolean;
|
|
185
|
+
}, {
|
|
186
|
+
name: string;
|
|
187
|
+
description: string;
|
|
188
|
+
files: {
|
|
189
|
+
path: string;
|
|
190
|
+
purpose: string;
|
|
191
|
+
changes: string | null;
|
|
192
|
+
}[];
|
|
193
|
+
lastPhase: boolean;
|
|
194
|
+
}>;
|
|
195
|
+
}, "strip", z.ZodTypeAny, {
|
|
196
|
+
description: string;
|
|
197
|
+
title: string;
|
|
198
|
+
projectName: string;
|
|
199
|
+
colorPalette: string[];
|
|
200
|
+
frameworks: string[];
|
|
201
|
+
detailedDescription: string;
|
|
202
|
+
views: {
|
|
203
|
+
name: string;
|
|
204
|
+
description: string;
|
|
205
|
+
}[];
|
|
206
|
+
userFlow: {
|
|
207
|
+
uiLayout: string;
|
|
208
|
+
uiDesign: string;
|
|
209
|
+
userJourney: string;
|
|
210
|
+
};
|
|
211
|
+
dataFlow: string;
|
|
212
|
+
architecture: {
|
|
213
|
+
dataFlow: string;
|
|
214
|
+
};
|
|
215
|
+
pitfalls: string[];
|
|
216
|
+
implementationRoadmap: {
|
|
217
|
+
description: string;
|
|
218
|
+
phase: string;
|
|
219
|
+
}[];
|
|
220
|
+
initialPhase: {
|
|
221
|
+
name: string;
|
|
222
|
+
description: string;
|
|
223
|
+
files: {
|
|
224
|
+
path: string;
|
|
225
|
+
purpose: string;
|
|
226
|
+
changes: string | null;
|
|
227
|
+
}[];
|
|
228
|
+
lastPhase: boolean;
|
|
229
|
+
};
|
|
230
|
+
}, {
|
|
231
|
+
description: string;
|
|
232
|
+
title: string;
|
|
233
|
+
projectName: string;
|
|
234
|
+
colorPalette: string[];
|
|
235
|
+
frameworks: string[];
|
|
236
|
+
detailedDescription: string;
|
|
237
|
+
views: {
|
|
238
|
+
name: string;
|
|
239
|
+
description: string;
|
|
240
|
+
}[];
|
|
241
|
+
userFlow: {
|
|
242
|
+
uiLayout: string;
|
|
243
|
+
uiDesign: string;
|
|
244
|
+
userJourney: string;
|
|
245
|
+
};
|
|
246
|
+
dataFlow: string;
|
|
247
|
+
architecture: {
|
|
248
|
+
dataFlow: string;
|
|
249
|
+
};
|
|
250
|
+
pitfalls: string[];
|
|
251
|
+
implementationRoadmap: {
|
|
252
|
+
description: string;
|
|
253
|
+
phase: string;
|
|
254
|
+
}[];
|
|
255
|
+
initialPhase: {
|
|
256
|
+
name: string;
|
|
257
|
+
description: string;
|
|
258
|
+
files: {
|
|
259
|
+
path: string;
|
|
260
|
+
purpose: string;
|
|
261
|
+
changes: string | null;
|
|
262
|
+
}[];
|
|
263
|
+
lastPhase: boolean;
|
|
264
|
+
};
|
|
265
|
+
}>;
|
|
266
|
+
declare const AgenticBlueprintSchema: z.ZodObject<{
|
|
267
|
+
title: z.ZodString;
|
|
268
|
+
projectName: z.ZodString;
|
|
269
|
+
description: z.ZodString;
|
|
270
|
+
colorPalette: z.ZodArray<z.ZodString, "many">;
|
|
271
|
+
frameworks: z.ZodArray<z.ZodString, "many">;
|
|
272
|
+
} & {
|
|
273
|
+
plan: z.ZodArray<z.ZodString, "many">;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
description: string;
|
|
276
|
+
title: string;
|
|
277
|
+
projectName: string;
|
|
278
|
+
colorPalette: string[];
|
|
279
|
+
frameworks: string[];
|
|
280
|
+
plan: string[];
|
|
281
|
+
}, {
|
|
282
|
+
description: string;
|
|
283
|
+
title: string;
|
|
284
|
+
projectName: string;
|
|
285
|
+
colorPalette: string[];
|
|
286
|
+
frameworks: string[];
|
|
287
|
+
plan: string[];
|
|
288
|
+
}>;
|
|
289
|
+
type PhasicBlueprint = z.infer<typeof PhasicBlueprintSchema>;
|
|
290
|
+
type AgenticBlueprint = z.infer<typeof AgenticBlueprintSchema>;
|
|
291
|
+
type FileConceptType = z.infer<typeof FileConceptSchema>;
|
|
292
|
+
type PhaseConceptType = z.infer<typeof PhaseConceptSchema>;
|
|
293
|
+
type FileOutputType = z.infer<typeof FileOutputSchema>;
|
|
294
|
+
type CodeReviewOutputType = z.infer<typeof CodeReviewOutput>;
|
|
295
|
+
type Blueprint = z.infer<typeof PhasicBlueprintSchema> | z.infer<typeof AgenticBlueprintSchema>;
|
|
296
|
+
type InferenceMetadata = {
|
|
297
|
+
agentId: string;
|
|
298
|
+
userId: string;
|
|
299
|
+
};
|
|
300
|
+
type CredentialsPayload = {
|
|
301
|
+
providers?: Record<string, {
|
|
302
|
+
apiKey: string;
|
|
303
|
+
}>;
|
|
304
|
+
aiGateway?: {
|
|
305
|
+
baseUrl: string;
|
|
306
|
+
token: string;
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
interface FileTreeNode {
|
|
310
|
+
path: string;
|
|
311
|
+
type: "file" | "directory";
|
|
312
|
+
children?: FileTreeNode[];
|
|
313
|
+
}
|
|
314
|
+
declare const RuntimeErrorSchema: z.ZodObject<{
|
|
315
|
+
timestamp: z.ZodString;
|
|
316
|
+
level: z.ZodNumber;
|
|
317
|
+
message: z.ZodString;
|
|
318
|
+
rawOutput: z.ZodString;
|
|
319
|
+
}, "strip", z.ZodTypeAny, {
|
|
320
|
+
message: string;
|
|
321
|
+
timestamp: string;
|
|
322
|
+
level: number;
|
|
323
|
+
rawOutput: string;
|
|
324
|
+
}, {
|
|
325
|
+
message: string;
|
|
326
|
+
timestamp: string;
|
|
327
|
+
level: number;
|
|
328
|
+
rawOutput: string;
|
|
329
|
+
}>;
|
|
330
|
+
type RuntimeError = z.infer<typeof RuntimeErrorSchema>;
|
|
331
|
+
declare const TemplateDetailsSchema: z.ZodObject<{
|
|
332
|
+
name: z.ZodString;
|
|
333
|
+
language: z.ZodOptional<z.ZodString>;
|
|
334
|
+
frameworks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
335
|
+
projectType: z.ZodDefault<z.ZodEnum<[
|
|
336
|
+
"app",
|
|
337
|
+
"workflow",
|
|
338
|
+
"presentation",
|
|
339
|
+
"general"
|
|
340
|
+
]>>;
|
|
341
|
+
description: z.ZodObject<{
|
|
342
|
+
selection: z.ZodString;
|
|
343
|
+
usage: z.ZodString;
|
|
344
|
+
}, "strip", z.ZodTypeAny, {
|
|
345
|
+
selection: string;
|
|
346
|
+
usage: string;
|
|
347
|
+
}, {
|
|
348
|
+
selection: string;
|
|
349
|
+
usage: string;
|
|
350
|
+
}>;
|
|
351
|
+
renderMode: z.ZodOptional<z.ZodEnum<[
|
|
352
|
+
"sandbox",
|
|
353
|
+
"browser"
|
|
354
|
+
]>>;
|
|
355
|
+
slideDirectory: z.ZodOptional<z.ZodString>;
|
|
356
|
+
disabled: z.ZodBoolean;
|
|
357
|
+
} & {
|
|
358
|
+
fileTree: z.ZodType<FileTreeNode, z.ZodTypeDef, FileTreeNode>;
|
|
359
|
+
allFiles: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
360
|
+
deps: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
361
|
+
importantFiles: z.ZodArray<z.ZodString, "many">;
|
|
362
|
+
dontTouchFiles: z.ZodArray<z.ZodString, "many">;
|
|
363
|
+
redactedFiles: z.ZodArray<z.ZodString, "many">;
|
|
364
|
+
}, "strip", z.ZodTypeAny, {
|
|
365
|
+
projectType: "app" | "workflow" | "presentation" | "general";
|
|
366
|
+
name: string;
|
|
367
|
+
description: {
|
|
368
|
+
selection: string;
|
|
369
|
+
usage: string;
|
|
370
|
+
};
|
|
371
|
+
disabled: boolean;
|
|
372
|
+
fileTree: FileTreeNode;
|
|
373
|
+
allFiles: Record<string, string>;
|
|
374
|
+
deps: Record<string, string>;
|
|
375
|
+
importantFiles: string[];
|
|
376
|
+
dontTouchFiles: string[];
|
|
377
|
+
redactedFiles: string[];
|
|
378
|
+
frameworks?: string[] | undefined;
|
|
379
|
+
language?: string | undefined;
|
|
380
|
+
renderMode?: "sandbox" | "browser" | undefined;
|
|
381
|
+
slideDirectory?: string | undefined;
|
|
382
|
+
}, {
|
|
383
|
+
name: string;
|
|
384
|
+
description: {
|
|
385
|
+
selection: string;
|
|
386
|
+
usage: string;
|
|
387
|
+
};
|
|
388
|
+
disabled: boolean;
|
|
389
|
+
fileTree: FileTreeNode;
|
|
390
|
+
allFiles: Record<string, string>;
|
|
391
|
+
deps: Record<string, string>;
|
|
392
|
+
importantFiles: string[];
|
|
393
|
+
dontTouchFiles: string[];
|
|
394
|
+
redactedFiles: string[];
|
|
395
|
+
projectType?: "app" | "workflow" | "presentation" | "general" | undefined;
|
|
396
|
+
frameworks?: string[] | undefined;
|
|
397
|
+
language?: string | undefined;
|
|
398
|
+
renderMode?: "sandbox" | "browser" | undefined;
|
|
399
|
+
slideDirectory?: string | undefined;
|
|
400
|
+
}>;
|
|
401
|
+
export type TemplateDetails = z.infer<typeof TemplateDetailsSchema>;
|
|
402
|
+
declare const PreviewSchema: z.ZodObject<{
|
|
403
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
404
|
+
previewURL: z.ZodOptional<z.ZodString>;
|
|
405
|
+
tunnelURL: z.ZodOptional<z.ZodString>;
|
|
406
|
+
}, "strip", z.ZodTypeAny, {
|
|
407
|
+
runId?: string | undefined;
|
|
408
|
+
previewURL?: string | undefined;
|
|
409
|
+
tunnelURL?: string | undefined;
|
|
410
|
+
}, {
|
|
411
|
+
runId?: string | undefined;
|
|
412
|
+
previewURL?: string | undefined;
|
|
413
|
+
tunnelURL?: string | undefined;
|
|
414
|
+
}>;
|
|
415
|
+
type PreviewType = z.infer<typeof PreviewSchema>;
|
|
416
|
+
declare const CodeIssueSchema: z.ZodObject<{
|
|
417
|
+
message: z.ZodString;
|
|
418
|
+
filePath: z.ZodString;
|
|
419
|
+
line: z.ZodNumber;
|
|
420
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
421
|
+
severity: z.ZodEnum<[
|
|
422
|
+
"error",
|
|
423
|
+
"warning",
|
|
424
|
+
"info"
|
|
425
|
+
]>;
|
|
426
|
+
ruleId: z.ZodOptional<z.ZodString>;
|
|
427
|
+
source: z.ZodOptional<z.ZodString>;
|
|
428
|
+
}, "strip", z.ZodTypeAny, {
|
|
429
|
+
message: string;
|
|
430
|
+
filePath: string;
|
|
431
|
+
line: number;
|
|
432
|
+
severity: "error" | "warning" | "info";
|
|
433
|
+
source?: string | undefined;
|
|
434
|
+
column?: number | undefined;
|
|
435
|
+
ruleId?: string | undefined;
|
|
436
|
+
}, {
|
|
437
|
+
message: string;
|
|
438
|
+
filePath: string;
|
|
439
|
+
line: number;
|
|
440
|
+
severity: "error" | "warning" | "info";
|
|
441
|
+
source?: string | undefined;
|
|
442
|
+
column?: number | undefined;
|
|
443
|
+
ruleId?: string | undefined;
|
|
444
|
+
}>;
|
|
445
|
+
type CodeIssue = z.infer<typeof CodeIssueSchema>;
|
|
446
|
+
declare const StaticAnalysisResponseSchema: z.ZodObject<{
|
|
447
|
+
success: z.ZodBoolean;
|
|
448
|
+
lint: z.ZodObject<{
|
|
449
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
450
|
+
message: z.ZodString;
|
|
451
|
+
filePath: z.ZodString;
|
|
452
|
+
line: z.ZodNumber;
|
|
453
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
454
|
+
severity: z.ZodEnum<[
|
|
455
|
+
"error",
|
|
456
|
+
"warning",
|
|
457
|
+
"info"
|
|
458
|
+
]>;
|
|
459
|
+
ruleId: z.ZodOptional<z.ZodString>;
|
|
460
|
+
source: z.ZodOptional<z.ZodString>;
|
|
461
|
+
}, "strip", z.ZodTypeAny, {
|
|
462
|
+
message: string;
|
|
463
|
+
filePath: string;
|
|
464
|
+
line: number;
|
|
465
|
+
severity: "error" | "warning" | "info";
|
|
466
|
+
source?: string | undefined;
|
|
467
|
+
column?: number | undefined;
|
|
468
|
+
ruleId?: string | undefined;
|
|
469
|
+
}, {
|
|
470
|
+
message: string;
|
|
471
|
+
filePath: string;
|
|
472
|
+
line: number;
|
|
473
|
+
severity: "error" | "warning" | "info";
|
|
474
|
+
source?: string | undefined;
|
|
475
|
+
column?: number | undefined;
|
|
476
|
+
ruleId?: string | undefined;
|
|
477
|
+
}>, "many">;
|
|
478
|
+
summary: z.ZodOptional<z.ZodObject<{
|
|
479
|
+
errorCount: z.ZodNumber;
|
|
480
|
+
warningCount: z.ZodNumber;
|
|
481
|
+
infoCount: z.ZodNumber;
|
|
482
|
+
}, "strip", z.ZodTypeAny, {
|
|
483
|
+
errorCount: number;
|
|
484
|
+
warningCount: number;
|
|
485
|
+
infoCount: number;
|
|
486
|
+
}, {
|
|
487
|
+
errorCount: number;
|
|
488
|
+
warningCount: number;
|
|
489
|
+
infoCount: number;
|
|
490
|
+
}>>;
|
|
491
|
+
rawOutput: z.ZodOptional<z.ZodString>;
|
|
492
|
+
}, "strip", z.ZodTypeAny, {
|
|
493
|
+
issues: {
|
|
494
|
+
message: string;
|
|
495
|
+
filePath: string;
|
|
496
|
+
line: number;
|
|
497
|
+
severity: "error" | "warning" | "info";
|
|
498
|
+
source?: string | undefined;
|
|
499
|
+
column?: number | undefined;
|
|
500
|
+
ruleId?: string | undefined;
|
|
501
|
+
}[];
|
|
502
|
+
rawOutput?: string | undefined;
|
|
503
|
+
summary?: {
|
|
504
|
+
errorCount: number;
|
|
505
|
+
warningCount: number;
|
|
506
|
+
infoCount: number;
|
|
507
|
+
} | undefined;
|
|
508
|
+
}, {
|
|
509
|
+
issues: {
|
|
510
|
+
message: string;
|
|
511
|
+
filePath: string;
|
|
512
|
+
line: number;
|
|
513
|
+
severity: "error" | "warning" | "info";
|
|
514
|
+
source?: string | undefined;
|
|
515
|
+
column?: number | undefined;
|
|
516
|
+
ruleId?: string | undefined;
|
|
517
|
+
}[];
|
|
518
|
+
rawOutput?: string | undefined;
|
|
519
|
+
summary?: {
|
|
520
|
+
errorCount: number;
|
|
521
|
+
warningCount: number;
|
|
522
|
+
infoCount: number;
|
|
523
|
+
} | undefined;
|
|
524
|
+
}>;
|
|
525
|
+
typecheck: z.ZodObject<{
|
|
526
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
527
|
+
message: z.ZodString;
|
|
528
|
+
filePath: z.ZodString;
|
|
529
|
+
line: z.ZodNumber;
|
|
530
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
531
|
+
severity: z.ZodEnum<[
|
|
532
|
+
"error",
|
|
533
|
+
"warning",
|
|
534
|
+
"info"
|
|
535
|
+
]>;
|
|
536
|
+
ruleId: z.ZodOptional<z.ZodString>;
|
|
537
|
+
source: z.ZodOptional<z.ZodString>;
|
|
538
|
+
}, "strip", z.ZodTypeAny, {
|
|
539
|
+
message: string;
|
|
540
|
+
filePath: string;
|
|
541
|
+
line: number;
|
|
542
|
+
severity: "error" | "warning" | "info";
|
|
543
|
+
source?: string | undefined;
|
|
544
|
+
column?: number | undefined;
|
|
545
|
+
ruleId?: string | undefined;
|
|
546
|
+
}, {
|
|
547
|
+
message: string;
|
|
548
|
+
filePath: string;
|
|
549
|
+
line: number;
|
|
550
|
+
severity: "error" | "warning" | "info";
|
|
551
|
+
source?: string | undefined;
|
|
552
|
+
column?: number | undefined;
|
|
553
|
+
ruleId?: string | undefined;
|
|
554
|
+
}>, "many">;
|
|
555
|
+
summary: z.ZodOptional<z.ZodObject<{
|
|
556
|
+
errorCount: z.ZodNumber;
|
|
557
|
+
warningCount: z.ZodNumber;
|
|
558
|
+
infoCount: z.ZodNumber;
|
|
559
|
+
}, "strip", z.ZodTypeAny, {
|
|
560
|
+
errorCount: number;
|
|
561
|
+
warningCount: number;
|
|
562
|
+
infoCount: number;
|
|
563
|
+
}, {
|
|
564
|
+
errorCount: number;
|
|
565
|
+
warningCount: number;
|
|
566
|
+
infoCount: number;
|
|
567
|
+
}>>;
|
|
568
|
+
rawOutput: z.ZodOptional<z.ZodString>;
|
|
569
|
+
}, "strip", z.ZodTypeAny, {
|
|
570
|
+
issues: {
|
|
571
|
+
message: string;
|
|
572
|
+
filePath: string;
|
|
573
|
+
line: number;
|
|
574
|
+
severity: "error" | "warning" | "info";
|
|
575
|
+
source?: string | undefined;
|
|
576
|
+
column?: number | undefined;
|
|
577
|
+
ruleId?: string | undefined;
|
|
578
|
+
}[];
|
|
579
|
+
rawOutput?: string | undefined;
|
|
580
|
+
summary?: {
|
|
581
|
+
errorCount: number;
|
|
582
|
+
warningCount: number;
|
|
583
|
+
infoCount: number;
|
|
584
|
+
} | undefined;
|
|
585
|
+
}, {
|
|
586
|
+
issues: {
|
|
587
|
+
message: string;
|
|
588
|
+
filePath: string;
|
|
589
|
+
line: number;
|
|
590
|
+
severity: "error" | "warning" | "info";
|
|
591
|
+
source?: string | undefined;
|
|
592
|
+
column?: number | undefined;
|
|
593
|
+
ruleId?: string | undefined;
|
|
594
|
+
}[];
|
|
595
|
+
rawOutput?: string | undefined;
|
|
596
|
+
summary?: {
|
|
597
|
+
errorCount: number;
|
|
598
|
+
warningCount: number;
|
|
599
|
+
infoCount: number;
|
|
600
|
+
} | undefined;
|
|
601
|
+
}>;
|
|
602
|
+
error: z.ZodOptional<z.ZodString>;
|
|
603
|
+
}, "strip", z.ZodTypeAny, {
|
|
604
|
+
success: boolean;
|
|
605
|
+
lint: {
|
|
606
|
+
issues: {
|
|
607
|
+
message: string;
|
|
608
|
+
filePath: string;
|
|
609
|
+
line: number;
|
|
610
|
+
severity: "error" | "warning" | "info";
|
|
611
|
+
source?: string | undefined;
|
|
612
|
+
column?: number | undefined;
|
|
613
|
+
ruleId?: string | undefined;
|
|
614
|
+
}[];
|
|
615
|
+
rawOutput?: string | undefined;
|
|
616
|
+
summary?: {
|
|
617
|
+
errorCount: number;
|
|
618
|
+
warningCount: number;
|
|
619
|
+
infoCount: number;
|
|
620
|
+
} | undefined;
|
|
621
|
+
};
|
|
622
|
+
typecheck: {
|
|
623
|
+
issues: {
|
|
624
|
+
message: string;
|
|
625
|
+
filePath: string;
|
|
626
|
+
line: number;
|
|
627
|
+
severity: "error" | "warning" | "info";
|
|
628
|
+
source?: string | undefined;
|
|
629
|
+
column?: number | undefined;
|
|
630
|
+
ruleId?: string | undefined;
|
|
631
|
+
}[];
|
|
632
|
+
rawOutput?: string | undefined;
|
|
633
|
+
summary?: {
|
|
634
|
+
errorCount: number;
|
|
635
|
+
warningCount: number;
|
|
636
|
+
infoCount: number;
|
|
637
|
+
} | undefined;
|
|
638
|
+
};
|
|
639
|
+
error?: string | undefined;
|
|
640
|
+
}, {
|
|
641
|
+
success: boolean;
|
|
642
|
+
lint: {
|
|
643
|
+
issues: {
|
|
644
|
+
message: string;
|
|
645
|
+
filePath: string;
|
|
646
|
+
line: number;
|
|
647
|
+
severity: "error" | "warning" | "info";
|
|
648
|
+
source?: string | undefined;
|
|
649
|
+
column?: number | undefined;
|
|
650
|
+
ruleId?: string | undefined;
|
|
651
|
+
}[];
|
|
652
|
+
rawOutput?: string | undefined;
|
|
653
|
+
summary?: {
|
|
654
|
+
errorCount: number;
|
|
655
|
+
warningCount: number;
|
|
656
|
+
infoCount: number;
|
|
657
|
+
} | undefined;
|
|
658
|
+
};
|
|
659
|
+
typecheck: {
|
|
660
|
+
issues: {
|
|
661
|
+
message: string;
|
|
662
|
+
filePath: string;
|
|
663
|
+
line: number;
|
|
664
|
+
severity: "error" | "warning" | "info";
|
|
665
|
+
source?: string | undefined;
|
|
666
|
+
column?: number | undefined;
|
|
667
|
+
ruleId?: string | undefined;
|
|
668
|
+
}[];
|
|
669
|
+
rawOutput?: string | undefined;
|
|
670
|
+
summary?: {
|
|
671
|
+
errorCount: number;
|
|
672
|
+
warningCount: number;
|
|
673
|
+
infoCount: number;
|
|
674
|
+
} | undefined;
|
|
675
|
+
};
|
|
676
|
+
error?: string | undefined;
|
|
677
|
+
}>;
|
|
678
|
+
type StaticAnalysisResponse = z.infer<typeof StaticAnalysisResponseSchema>;
|
|
679
|
+
type MessageRole = "system" | "user" | "assistant" | "function" | "tool";
|
|
680
|
+
type TextContent = {
|
|
681
|
+
type: "text";
|
|
682
|
+
text: string;
|
|
683
|
+
};
|
|
684
|
+
type ImageContent = {
|
|
685
|
+
type: "image_url";
|
|
686
|
+
image_url: {
|
|
687
|
+
url: string;
|
|
688
|
+
detail?: "auto" | "low" | "high";
|
|
689
|
+
};
|
|
690
|
+
};
|
|
691
|
+
type MessageContent = string | (TextContent | ImageContent)[] | null;
|
|
692
|
+
type ToolCall = {
|
|
693
|
+
id: string;
|
|
694
|
+
type: "function";
|
|
695
|
+
function: {
|
|
696
|
+
name: string;
|
|
697
|
+
arguments: string;
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
type Message = {
|
|
701
|
+
role: MessageRole;
|
|
702
|
+
content: MessageContent;
|
|
703
|
+
name?: string;
|
|
704
|
+
tool_calls?: ToolCall[];
|
|
705
|
+
tool_call_id?: string;
|
|
706
|
+
};
|
|
707
|
+
interface ConversationMessage extends Message {
|
|
708
|
+
conversationId: string;
|
|
709
|
+
}
|
|
710
|
+
interface ConversationState {
|
|
711
|
+
id: string;
|
|
712
|
+
runningHistory: ConversationMessage[];
|
|
713
|
+
fullHistory: ConversationMessage[];
|
|
714
|
+
}
|
|
715
|
+
declare const SUPPORTED_IMAGE_MIME_TYPES: readonly [
|
|
716
|
+
"image/png",
|
|
717
|
+
"image/jpeg",
|
|
718
|
+
"image/webp"
|
|
719
|
+
];
|
|
720
|
+
type SupportedImageMimeType = typeof SUPPORTED_IMAGE_MIME_TYPES[number];
|
|
721
|
+
interface ImageAttachment {
|
|
722
|
+
/** Unique identifier for this attachment */
|
|
723
|
+
id: string;
|
|
724
|
+
/** Original filename */
|
|
725
|
+
filename: string;
|
|
726
|
+
/** MIME type of the image */
|
|
727
|
+
mimeType: SupportedImageMimeType;
|
|
728
|
+
/** Base64-encoded image data (without data URL prefix) */
|
|
729
|
+
base64Data: string;
|
|
730
|
+
/** Size of the original file in bytes */
|
|
731
|
+
size?: number;
|
|
732
|
+
/** Optional dimensions if available */
|
|
733
|
+
dimensions?: {
|
|
734
|
+
width: number;
|
|
735
|
+
height: number;
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
type BehaviorType = "phasic" | "agentic";
|
|
739
|
+
type ProjectType = "app" | "workflow" | "presentation" | "general";
|
|
740
|
+
type Plan = string;
|
|
741
|
+
interface AllIssues {
|
|
742
|
+
runtimeErrors: RuntimeError[];
|
|
743
|
+
staticAnalysis: StaticAnalysisResponse;
|
|
744
|
+
}
|
|
745
|
+
interface FileState extends FileOutputType {
|
|
746
|
+
lastDiff: string;
|
|
747
|
+
}
|
|
748
|
+
interface FileServingToken {
|
|
749
|
+
token: string;
|
|
750
|
+
createdAt: number;
|
|
751
|
+
}
|
|
752
|
+
interface PhaseState extends PhaseConceptType {
|
|
753
|
+
completed: boolean;
|
|
754
|
+
}
|
|
755
|
+
declare enum CurrentDevState {
|
|
756
|
+
IDLE = 0,
|
|
757
|
+
PHASE_GENERATING = 1,
|
|
758
|
+
PHASE_IMPLEMENTING = 2,
|
|
759
|
+
REVIEWING = 3,
|
|
760
|
+
FINALIZING = 4
|
|
761
|
+
}
|
|
762
|
+
interface BaseProjectState {
|
|
763
|
+
behaviorType: BehaviorType;
|
|
764
|
+
projectType: ProjectType;
|
|
765
|
+
projectName: string;
|
|
766
|
+
query: string;
|
|
767
|
+
sessionId: string;
|
|
768
|
+
hostname: string;
|
|
769
|
+
blueprint: Blueprint;
|
|
770
|
+
templateName: string | "custom";
|
|
771
|
+
readonly metadata: InferenceMetadata;
|
|
772
|
+
shouldBeGenerating: boolean;
|
|
773
|
+
generatedFilesMap: Record<string, FileState>;
|
|
774
|
+
sandboxInstanceId?: string;
|
|
775
|
+
fileServingToken?: FileServingToken;
|
|
776
|
+
commandsHistory?: string[];
|
|
777
|
+
lastPackageJson?: string;
|
|
778
|
+
pendingUserInputs: string[];
|
|
779
|
+
projectUpdatesAccumulator: string[];
|
|
780
|
+
lastDeepDebugTranscript: string | null;
|
|
781
|
+
mvpGenerated: boolean;
|
|
782
|
+
reviewingInitiated: boolean;
|
|
783
|
+
}
|
|
784
|
+
interface PhasicState extends BaseProjectState {
|
|
785
|
+
behaviorType: "phasic";
|
|
786
|
+
blueprint: PhasicBlueprint;
|
|
787
|
+
generatedPhases: PhaseState[];
|
|
788
|
+
phasesCounter: number;
|
|
789
|
+
currentDevState: CurrentDevState;
|
|
790
|
+
reviewCycles?: number;
|
|
791
|
+
currentPhase?: PhaseConceptType;
|
|
792
|
+
}
|
|
793
|
+
interface AgenticState extends BaseProjectState {
|
|
794
|
+
behaviorType: "agentic";
|
|
795
|
+
blueprint: AgenticBlueprint;
|
|
796
|
+
currentPlan: Plan;
|
|
797
|
+
}
|
|
798
|
+
export type AgentState = PhasicState | AgenticState;
|
|
799
|
+
interface FileObject {
|
|
800
|
+
filePath: string;
|
|
801
|
+
fileContents: string;
|
|
802
|
+
}
|
|
803
|
+
interface FixedIssue {
|
|
804
|
+
/** TypeScript error code (e.g., 'TS2307') */
|
|
805
|
+
issueCode: string;
|
|
806
|
+
/** File path where the issue was located */
|
|
807
|
+
filePath: string;
|
|
808
|
+
/** Line number of the issue */
|
|
809
|
+
line: number;
|
|
810
|
+
/** Column number of the issue (optional) */
|
|
811
|
+
column?: number;
|
|
812
|
+
/** Original error message from TypeScript */
|
|
813
|
+
originalMessage: string;
|
|
814
|
+
/** Description of the fix that was applied */
|
|
815
|
+
fixApplied: string;
|
|
816
|
+
/** Type of fix that was applied */
|
|
817
|
+
fixType: "import_fix" | "export_fix" | "stub_creation" | "declaration_fix";
|
|
818
|
+
}
|
|
819
|
+
interface UnfixableIssue {
|
|
820
|
+
/** TypeScript error code (e.g., 'TS2307') */
|
|
821
|
+
issueCode: string;
|
|
822
|
+
/** File path where the issue was located */
|
|
823
|
+
filePath: string;
|
|
824
|
+
/** Line number of the issue */
|
|
825
|
+
line: number;
|
|
826
|
+
/** Column number of the issue (optional) */
|
|
827
|
+
column?: number;
|
|
828
|
+
/** Original error message from TypeScript */
|
|
829
|
+
originalMessage: string;
|
|
830
|
+
/** Reason why the issue could not be fixed */
|
|
831
|
+
reason: string;
|
|
832
|
+
}
|
|
833
|
+
interface CodeFixResult {
|
|
834
|
+
/** Issues that were successfully fixed */
|
|
835
|
+
fixedIssues: FixedIssue[];
|
|
836
|
+
/** Issues that could not be fixed automatically */
|
|
837
|
+
unfixableIssues: UnfixableIssue[];
|
|
838
|
+
/** Files that were modified with fixes applied */
|
|
839
|
+
modifiedFiles: FileObject[];
|
|
840
|
+
/** New files that were created (e.g., stubs) */
|
|
841
|
+
newFiles?: FileObject[];
|
|
842
|
+
}
|
|
843
|
+
declare class IssueReport {
|
|
844
|
+
readonly runtimeErrors: RuntimeError[];
|
|
845
|
+
readonly staticAnalysis: StaticAnalysisResponse;
|
|
846
|
+
constructor(runtimeErrors: RuntimeError[], staticAnalysis: StaticAnalysisResponse);
|
|
847
|
+
/**
|
|
848
|
+
* Create report from all issues
|
|
849
|
+
*/
|
|
850
|
+
static from(issues: AllIssues): IssueReport;
|
|
851
|
+
/**
|
|
852
|
+
* Check if there are any issues
|
|
853
|
+
*/
|
|
854
|
+
hasIssues(): boolean;
|
|
855
|
+
/**
|
|
856
|
+
* Check if there are runtime errors
|
|
857
|
+
*/
|
|
858
|
+
hasRuntimeErrors(): boolean;
|
|
859
|
+
/**
|
|
860
|
+
* Check if there are static analysis issues
|
|
861
|
+
*/
|
|
862
|
+
hasStaticAnalysisIssues(): boolean;
|
|
863
|
+
/**
|
|
864
|
+
* Get total issue count
|
|
865
|
+
*/
|
|
866
|
+
getTotalIssueCount(): number;
|
|
867
|
+
/**
|
|
868
|
+
* Get a summary of all issues
|
|
869
|
+
*/
|
|
870
|
+
getSummary(): string;
|
|
871
|
+
/**
|
|
872
|
+
* Create an empty issue report
|
|
873
|
+
*/
|
|
874
|
+
static empty(): IssueReport;
|
|
875
|
+
}
|
|
876
|
+
declare enum RateLimitType {
|
|
877
|
+
API_RATE_LIMIT = "apiRateLimit",
|
|
878
|
+
AUTH_RATE_LIMIT = "authRateLimit",
|
|
879
|
+
APP_CREATION = "appCreation",
|
|
880
|
+
LLM_CALLS = "llmCalls"
|
|
881
|
+
}
|
|
882
|
+
interface RateLimitError {
|
|
883
|
+
message: string;
|
|
884
|
+
limitType: RateLimitType;
|
|
885
|
+
limit?: number;
|
|
886
|
+
period?: number;
|
|
887
|
+
suggestions?: string[];
|
|
888
|
+
}
|
|
889
|
+
declare enum SecurityErrorType {
|
|
890
|
+
UNAUTHORIZED = "UNAUTHORIZED",
|
|
891
|
+
FORBIDDEN = "FORBIDDEN",
|
|
892
|
+
INVALID_TOKEN = "INVALID_TOKEN",
|
|
893
|
+
TOKEN_EXPIRED = "TOKEN_EXPIRED",
|
|
894
|
+
RATE_LIMITED = "RATE_LIMITED",
|
|
895
|
+
INVALID_INPUT = "INVALID_INPUT",
|
|
896
|
+
CSRF_VIOLATION = "CSRF_VIOLATION"
|
|
897
|
+
}
|
|
898
|
+
declare class SecurityError extends Error {
|
|
899
|
+
type: SecurityErrorType;
|
|
900
|
+
statusCode: number;
|
|
901
|
+
constructor(type: SecurityErrorType, message: string, statusCode?: number);
|
|
902
|
+
}
|
|
903
|
+
declare class RateLimitExceededError extends SecurityError {
|
|
904
|
+
limitType: RateLimitType;
|
|
905
|
+
limit?: number | undefined;
|
|
906
|
+
period?: number | undefined;
|
|
907
|
+
suggestions?: string[] | undefined;
|
|
908
|
+
details: RateLimitError;
|
|
909
|
+
constructor(message: string, limitType: RateLimitType, limit?: number | undefined, period?: number | undefined, suggestions?: string[] | undefined);
|
|
910
|
+
static fromRateLimitError(error: RateLimitError): RateLimitExceededError;
|
|
911
|
+
}
|
|
912
|
+
type ErrorMessage = {
|
|
913
|
+
type: "error";
|
|
914
|
+
error: string;
|
|
915
|
+
};
|
|
916
|
+
type StateMessage = {
|
|
917
|
+
type: "cf_agent_state";
|
|
918
|
+
state: AgentState;
|
|
919
|
+
};
|
|
920
|
+
type AgentConnectedMessage = {
|
|
921
|
+
type: "agent_connected";
|
|
922
|
+
state: AgentState;
|
|
923
|
+
templateDetails: TemplateDetails;
|
|
924
|
+
previewUrl?: string;
|
|
925
|
+
};
|
|
926
|
+
type TemplateUpdatedMessage = {
|
|
927
|
+
type: "template_updated";
|
|
928
|
+
templateDetails: TemplateDetails;
|
|
929
|
+
};
|
|
930
|
+
type ConversationStateMessage = {
|
|
931
|
+
type: "conversation_state";
|
|
932
|
+
state: ConversationState;
|
|
933
|
+
deepDebugSession?: {
|
|
934
|
+
conversationId: string;
|
|
935
|
+
} | null;
|
|
936
|
+
};
|
|
937
|
+
type RateLimitErrorMessage = {
|
|
938
|
+
type: "rate_limit_error";
|
|
939
|
+
error: RateLimitExceededError;
|
|
940
|
+
};
|
|
941
|
+
type GenerationStartedMessage = {
|
|
942
|
+
type: "generation_started";
|
|
943
|
+
message: string;
|
|
944
|
+
totalFiles: number;
|
|
945
|
+
};
|
|
946
|
+
type FileGeneratingMessage = {
|
|
947
|
+
type: "file_generating";
|
|
948
|
+
filePath: string;
|
|
949
|
+
filePurpose: string;
|
|
950
|
+
};
|
|
951
|
+
type FileRegeneratingMessage = {
|
|
952
|
+
type: "file_regenerating";
|
|
953
|
+
filePath: string;
|
|
954
|
+
original_issues?: string;
|
|
955
|
+
};
|
|
956
|
+
type FileChunkGeneratedMessage = {
|
|
957
|
+
type: "file_chunk_generated";
|
|
958
|
+
filePath: string;
|
|
959
|
+
chunk: string;
|
|
960
|
+
};
|
|
961
|
+
type FileGeneratedMessage = {
|
|
962
|
+
type: "file_generated";
|
|
963
|
+
file: FileOutputType;
|
|
964
|
+
};
|
|
965
|
+
type FileRegeneratedMessage = {
|
|
966
|
+
type: "file_regenerated";
|
|
967
|
+
file: FileOutputType;
|
|
968
|
+
original_issues: string;
|
|
969
|
+
};
|
|
970
|
+
type GenerationCompleteMessage = {
|
|
971
|
+
type: "generation_complete";
|
|
972
|
+
instanceId?: string;
|
|
973
|
+
previewURL?: string;
|
|
974
|
+
};
|
|
975
|
+
type DeploymentStartedMessage = {
|
|
976
|
+
type: "deployment_started";
|
|
977
|
+
message: string;
|
|
978
|
+
files: {
|
|
979
|
+
filePath: string;
|
|
980
|
+
}[];
|
|
981
|
+
};
|
|
982
|
+
type DeploymentFailedMessage = {
|
|
983
|
+
type: "deployment_failed";
|
|
984
|
+
error: string;
|
|
985
|
+
};
|
|
986
|
+
type DeploymentCompletedMessage = {
|
|
987
|
+
type: "deployment_completed";
|
|
988
|
+
previewURL: string;
|
|
989
|
+
tunnelURL: string;
|
|
990
|
+
instanceId: string;
|
|
991
|
+
message: string;
|
|
992
|
+
};
|
|
993
|
+
type PreviewForceRefreshMessage = {
|
|
994
|
+
type: "preview_force_refresh";
|
|
995
|
+
};
|
|
996
|
+
type CommandExecutingMessage = {
|
|
997
|
+
type: "command_executing";
|
|
998
|
+
message: string;
|
|
999
|
+
commands: string[];
|
|
1000
|
+
};
|
|
1001
|
+
type CommandExecutedMessage = {
|
|
1002
|
+
type: "command_executed";
|
|
1003
|
+
message: string;
|
|
1004
|
+
commands: string[];
|
|
1005
|
+
output?: string;
|
|
1006
|
+
};
|
|
1007
|
+
type CommandExecutionFailedMessage = {
|
|
1008
|
+
type: "command_execution_failed";
|
|
1009
|
+
message: string;
|
|
1010
|
+
commands: string[];
|
|
1011
|
+
error?: string;
|
|
1012
|
+
};
|
|
1013
|
+
type CodeReviewingMessage = {
|
|
1014
|
+
type: "code_reviewing";
|
|
1015
|
+
message: string;
|
|
1016
|
+
staticAnalysis?: StaticAnalysisResponse;
|
|
1017
|
+
runtimeErrors: RuntimeError[];
|
|
1018
|
+
};
|
|
1019
|
+
type CodeReviewedMessage = {
|
|
1020
|
+
type: "code_reviewed";
|
|
1021
|
+
message: string;
|
|
1022
|
+
review: CodeReviewOutputType;
|
|
1023
|
+
};
|
|
1024
|
+
type RuntimeErrorFoundMessage = {
|
|
1025
|
+
type: "runtime_error_found";
|
|
1026
|
+
errors: RuntimeError[];
|
|
1027
|
+
count: number;
|
|
1028
|
+
};
|
|
1029
|
+
type CodeFixEdits = {
|
|
1030
|
+
type: "code_fix_edits";
|
|
1031
|
+
filePath: string;
|
|
1032
|
+
search: string;
|
|
1033
|
+
replacement: string;
|
|
1034
|
+
};
|
|
1035
|
+
type StaticAnalysisResults = {
|
|
1036
|
+
type: "static_analysis_results";
|
|
1037
|
+
staticAnalysis: StaticAnalysisResponse;
|
|
1038
|
+
};
|
|
1039
|
+
type PhaseGeneratingMessage = {
|
|
1040
|
+
type: "phase_generating";
|
|
1041
|
+
message: string;
|
|
1042
|
+
phase?: {
|
|
1043
|
+
name: string;
|
|
1044
|
+
description: string;
|
|
1045
|
+
files: FileConceptType[];
|
|
1046
|
+
};
|
|
1047
|
+
issues?: IssueReport;
|
|
1048
|
+
userSuggestions?: string[];
|
|
1049
|
+
};
|
|
1050
|
+
type PhaseGeneratedMessage = {
|
|
1051
|
+
type: "phase_generated";
|
|
1052
|
+
message: string;
|
|
1053
|
+
phase: {
|
|
1054
|
+
name: string;
|
|
1055
|
+
description: string;
|
|
1056
|
+
files: FileConceptType[];
|
|
1057
|
+
};
|
|
1058
|
+
};
|
|
1059
|
+
type PhaseImplementingMessage = {
|
|
1060
|
+
type: "phase_implementing";
|
|
1061
|
+
message: string;
|
|
1062
|
+
phase: {
|
|
1063
|
+
name: string;
|
|
1064
|
+
description: string;
|
|
1065
|
+
files: FileConceptType[];
|
|
1066
|
+
};
|
|
1067
|
+
issues?: IssueReport;
|
|
1068
|
+
};
|
|
1069
|
+
type PhaseImplementedMessage = {
|
|
1070
|
+
type: "phase_implemented";
|
|
1071
|
+
message: string;
|
|
1072
|
+
phase: {
|
|
1073
|
+
name: string;
|
|
1074
|
+
description: string;
|
|
1075
|
+
files: FileConceptType[];
|
|
1076
|
+
};
|
|
1077
|
+
};
|
|
1078
|
+
type PhaseValidatingMessage = {
|
|
1079
|
+
type: "phase_validating";
|
|
1080
|
+
message: string;
|
|
1081
|
+
phase: {
|
|
1082
|
+
name: string;
|
|
1083
|
+
description: string;
|
|
1084
|
+
files: FileConceptType[];
|
|
1085
|
+
};
|
|
1086
|
+
};
|
|
1087
|
+
type PhaseValidatedMessage = {
|
|
1088
|
+
type: "phase_validated";
|
|
1089
|
+
message: string;
|
|
1090
|
+
phase: {
|
|
1091
|
+
name: string;
|
|
1092
|
+
description: string;
|
|
1093
|
+
files: FileConceptType[];
|
|
1094
|
+
};
|
|
1095
|
+
};
|
|
1096
|
+
type GenerationStoppedMessage = {
|
|
1097
|
+
type: "generation_stopped";
|
|
1098
|
+
message: string;
|
|
1099
|
+
instanceId: string;
|
|
1100
|
+
};
|
|
1101
|
+
type GenerationResumedMessage = {
|
|
1102
|
+
type: "generation_resumed";
|
|
1103
|
+
message: string;
|
|
1104
|
+
instanceId: string;
|
|
1105
|
+
};
|
|
1106
|
+
type CloudflareDeploymentStartedMessage = {
|
|
1107
|
+
type: "cloudflare_deployment_started";
|
|
1108
|
+
message: string;
|
|
1109
|
+
instanceId: string;
|
|
1110
|
+
};
|
|
1111
|
+
type CloudflareDeploymentCompletedMessage = {
|
|
1112
|
+
type: "cloudflare_deployment_completed";
|
|
1113
|
+
message: string;
|
|
1114
|
+
instanceId: string;
|
|
1115
|
+
deploymentUrl: string;
|
|
1116
|
+
workersUrl?: string;
|
|
1117
|
+
};
|
|
1118
|
+
type CloudflareDeploymentErrorMessage = {
|
|
1119
|
+
type: "cloudflare_deployment_error";
|
|
1120
|
+
message: string;
|
|
1121
|
+
instanceId: string;
|
|
1122
|
+
error: string;
|
|
1123
|
+
};
|
|
1124
|
+
type ScreenshotCaptureStartedMessage = {
|
|
1125
|
+
type: "screenshot_capture_started";
|
|
1126
|
+
message: string;
|
|
1127
|
+
url: string;
|
|
1128
|
+
viewport: {
|
|
1129
|
+
width: number;
|
|
1130
|
+
height: number;
|
|
1131
|
+
};
|
|
1132
|
+
};
|
|
1133
|
+
type ScreenshotCaptureSuccessMessage = {
|
|
1134
|
+
type: "screenshot_capture_success";
|
|
1135
|
+
message: string;
|
|
1136
|
+
url: string;
|
|
1137
|
+
viewport: {
|
|
1138
|
+
width: number;
|
|
1139
|
+
height: number;
|
|
1140
|
+
};
|
|
1141
|
+
screenshotSize: number;
|
|
1142
|
+
timestamp: string;
|
|
1143
|
+
};
|
|
1144
|
+
type ScreenshotCaptureErrorMessage = {
|
|
1145
|
+
type: "screenshot_capture_error";
|
|
1146
|
+
error: string;
|
|
1147
|
+
url: string;
|
|
1148
|
+
viewport: {
|
|
1149
|
+
width: number;
|
|
1150
|
+
height: number;
|
|
1151
|
+
};
|
|
1152
|
+
statusCode?: number;
|
|
1153
|
+
statusText?: string;
|
|
1154
|
+
apiResponse?: unknown;
|
|
1155
|
+
screenshotCaptured?: boolean;
|
|
1156
|
+
databaseError?: boolean;
|
|
1157
|
+
configurationError?: boolean;
|
|
1158
|
+
};
|
|
1159
|
+
type ScreenshotAnalysisResultMessage = {
|
|
1160
|
+
type: "screenshot_analysis_result";
|
|
1161
|
+
message: string;
|
|
1162
|
+
analysis: {
|
|
1163
|
+
hasIssues: boolean;
|
|
1164
|
+
issues: string[];
|
|
1165
|
+
suggestions: string[];
|
|
1166
|
+
uiCompliance: {
|
|
1167
|
+
matchesBlueprint: boolean;
|
|
1168
|
+
deviations: string[];
|
|
1169
|
+
};
|
|
1170
|
+
};
|
|
1171
|
+
};
|
|
1172
|
+
type GitHubExportStartedMessage = {
|
|
1173
|
+
type: "github_export_started";
|
|
1174
|
+
message: string;
|
|
1175
|
+
repositoryName: string;
|
|
1176
|
+
isPrivate: boolean;
|
|
1177
|
+
};
|
|
1178
|
+
type GitHubExportProgressMessage = {
|
|
1179
|
+
type: "github_export_progress";
|
|
1180
|
+
message: string;
|
|
1181
|
+
step: "creating_repository" | "uploading_files" | "finalizing";
|
|
1182
|
+
progress: number;
|
|
1183
|
+
};
|
|
1184
|
+
type GitHubExportCompletedMessage = {
|
|
1185
|
+
type: "github_export_completed";
|
|
1186
|
+
message: string;
|
|
1187
|
+
repositoryUrl: string;
|
|
1188
|
+
};
|
|
1189
|
+
type GitHubExportErrorMessage = {
|
|
1190
|
+
type: "github_export_error";
|
|
1191
|
+
message: string;
|
|
1192
|
+
error: string;
|
|
1193
|
+
};
|
|
1194
|
+
type UserSuggestionsProcessingMessage = {
|
|
1195
|
+
type: "user_suggestions_processing";
|
|
1196
|
+
message: string;
|
|
1197
|
+
suggestions: string[];
|
|
1198
|
+
};
|
|
1199
|
+
type ConversationResponseMessage = {
|
|
1200
|
+
type: "conversation_response";
|
|
1201
|
+
message: string;
|
|
1202
|
+
conversationId?: string;
|
|
1203
|
+
enhancedRequest?: string;
|
|
1204
|
+
pendingInputsCount?: number;
|
|
1205
|
+
isStreaming?: boolean;
|
|
1206
|
+
tool?: {
|
|
1207
|
+
name: string;
|
|
1208
|
+
status: "start" | "success" | "error";
|
|
1209
|
+
args?: Record<string, unknown>;
|
|
1210
|
+
result?: string;
|
|
1211
|
+
};
|
|
1212
|
+
};
|
|
1213
|
+
type ConversationClearedMessage = {
|
|
1214
|
+
type: "conversation_cleared";
|
|
1215
|
+
message: string;
|
|
1216
|
+
clearedMessageCount: number;
|
|
1217
|
+
};
|
|
1218
|
+
type ProjectNameUpdatedMessage = {
|
|
1219
|
+
type: "project_name_updated";
|
|
1220
|
+
message: string;
|
|
1221
|
+
projectName: string;
|
|
1222
|
+
};
|
|
1223
|
+
type BlueprintUpdatedMessage = {
|
|
1224
|
+
type: "blueprint_updated";
|
|
1225
|
+
message: string;
|
|
1226
|
+
updatedKeys: string[];
|
|
1227
|
+
};
|
|
1228
|
+
type BlueprintChunkMessage = {
|
|
1229
|
+
type: "blueprint_chunk";
|
|
1230
|
+
chunk: string;
|
|
1231
|
+
};
|
|
1232
|
+
type DeterministicCodeFixStartedMessage = {
|
|
1233
|
+
type: "deterministic_code_fix_started";
|
|
1234
|
+
message: string;
|
|
1235
|
+
issues: CodeIssue[];
|
|
1236
|
+
};
|
|
1237
|
+
type DeterministicCodeFixCompletedMessage = {
|
|
1238
|
+
type: "deterministic_code_fix_completed";
|
|
1239
|
+
message: string;
|
|
1240
|
+
fixResult: CodeFixResult;
|
|
1241
|
+
issues: CodeIssue[];
|
|
1242
|
+
};
|
|
1243
|
+
type ModelConfigsInfoMessage = {
|
|
1244
|
+
type: "model_configs_info";
|
|
1245
|
+
message: string;
|
|
1246
|
+
configs: {
|
|
1247
|
+
agents: Array<{
|
|
1248
|
+
key: string;
|
|
1249
|
+
name: string;
|
|
1250
|
+
description: string;
|
|
1251
|
+
constraint?: {
|
|
1252
|
+
enabled: boolean;
|
|
1253
|
+
allowedModels: string[];
|
|
1254
|
+
};
|
|
1255
|
+
}>;
|
|
1256
|
+
userConfigs: Record<string, {
|
|
1257
|
+
name?: string;
|
|
1258
|
+
max_tokens?: number;
|
|
1259
|
+
temperature?: number;
|
|
1260
|
+
reasoning_effort?: string;
|
|
1261
|
+
fallbackModel?: string;
|
|
1262
|
+
isUserOverride?: boolean;
|
|
1263
|
+
}>;
|
|
1264
|
+
defaultConfigs: Record<string, {
|
|
1265
|
+
name?: string;
|
|
1266
|
+
max_tokens?: number;
|
|
1267
|
+
temperature?: number;
|
|
1268
|
+
reasoning_effort?: string;
|
|
1269
|
+
fallbackModel?: string;
|
|
1270
|
+
}>;
|
|
1271
|
+
};
|
|
1272
|
+
};
|
|
1273
|
+
type TerminalCommandMessage = {
|
|
1274
|
+
type: "terminal_command";
|
|
1275
|
+
command: string;
|
|
1276
|
+
timestamp: number;
|
|
1277
|
+
};
|
|
1278
|
+
type TerminalOutputMessage = {
|
|
1279
|
+
type: "terminal_output";
|
|
1280
|
+
output: string;
|
|
1281
|
+
outputType: "stdout" | "stderr" | "info";
|
|
1282
|
+
timestamp: number;
|
|
1283
|
+
};
|
|
1284
|
+
type ServerLogMessage = {
|
|
1285
|
+
type: "server_log";
|
|
1286
|
+
message: string;
|
|
1287
|
+
level: "info" | "warn" | "error" | "debug";
|
|
1288
|
+
timestamp: number;
|
|
1289
|
+
source?: string;
|
|
1290
|
+
};
|
|
1291
|
+
type VaultUnlockedMessage = {
|
|
1292
|
+
type: "vault_unlocked";
|
|
1293
|
+
};
|
|
1294
|
+
type VaultLockedMessage = {
|
|
1295
|
+
type: "vault_locked";
|
|
1296
|
+
};
|
|
1297
|
+
type VaultRequiredMessage = {
|
|
1298
|
+
type: "vault_required";
|
|
1299
|
+
reason: string;
|
|
1300
|
+
provider?: string;
|
|
1301
|
+
envVarName?: string;
|
|
1302
|
+
secretId?: string;
|
|
1303
|
+
};
|
|
1304
|
+
export type WebSocketMessage = StateMessage | AgentConnectedMessage | TemplateUpdatedMessage | ConversationStateMessage | GenerationStartedMessage | FileGeneratingMessage | FileRegeneratingMessage | FileChunkGeneratedMessage | FileGeneratedMessage | FileRegeneratedMessage | GenerationCompleteMessage | DeploymentStartedMessage | DeploymentCompletedMessage | DeploymentFailedMessage | PreviewForceRefreshMessage | CodeReviewingMessage | CodeReviewedMessage | CommandExecutingMessage | CommandExecutedMessage | CommandExecutionFailedMessage | RuntimeErrorFoundMessage | CodeFixEdits | StaticAnalysisResults | PhaseGeneratingMessage | PhaseGeneratedMessage | PhaseImplementingMessage | PhaseImplementedMessage | PhaseValidatingMessage | PhaseValidatedMessage | GenerationStoppedMessage | GenerationResumedMessage | CloudflareDeploymentStartedMessage | CloudflareDeploymentCompletedMessage | CloudflareDeploymentErrorMessage | ScreenshotCaptureStartedMessage | ScreenshotCaptureSuccessMessage | ScreenshotCaptureErrorMessage | ScreenshotAnalysisResultMessage | GitHubExportStartedMessage | GitHubExportProgressMessage | GitHubExportCompletedMessage | GitHubExportErrorMessage | ErrorMessage | RateLimitErrorMessage | UserSuggestionsProcessingMessage | ConversationResponseMessage | ConversationClearedMessage | ProjectNameUpdatedMessage | BlueprintUpdatedMessage | BlueprintChunkMessage | DeterministicCodeFixStartedMessage | DeterministicCodeFixCompletedMessage | ModelConfigsInfoMessage | TerminalCommandMessage | TerminalOutputMessage | ServerLogMessage | VaultUnlockedMessage | VaultLockedMessage | VaultRequiredMessage;
|
|
1305
|
+
type WebSocketMessageType = WebSocketMessage["type"];
|
|
1306
|
+
type WebSocketMessagePayload<T extends WebSocketMessageType> = Extract<WebSocketMessage, {
|
|
1307
|
+
type: T;
|
|
1308
|
+
}>;
|
|
1309
|
+
export type WebSocketMessageData<T extends WebSocketMessageType> = Omit<WebSocketMessagePayload<T>, "type">;
|
|
1310
|
+
interface CodeGenArgs {
|
|
1311
|
+
query: string;
|
|
1312
|
+
language?: string;
|
|
1313
|
+
frameworks?: string[];
|
|
1314
|
+
selectedTemplate?: string;
|
|
1315
|
+
behaviorType?: BehaviorType;
|
|
1316
|
+
projectType?: ProjectType;
|
|
1317
|
+
images?: ImageAttachment[];
|
|
1318
|
+
/** Optional ephemeral credentials (BYOK / gateway override) for sdk */
|
|
1319
|
+
credentials?: CredentialsPayload;
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Data structure for connectToExistingAgent response
|
|
1323
|
+
*/
|
|
1324
|
+
export interface AgentConnectionData {
|
|
1325
|
+
websocketUrl: string;
|
|
1326
|
+
agentId: string;
|
|
1327
|
+
}
|
|
1328
|
+
export type AgentPreviewResponse = PreviewType;
|
|
1329
|
+
type BehaviorType$1 = BehaviorType;
|
|
1330
|
+
type ProjectType$1 = ProjectType;
|
|
1331
|
+
export type Credentials = NonNullable<CodeGenArgs["credentials"]>;
|
|
1332
|
+
type CodeGenArgs$1 = CodeGenArgs;
|
|
1333
|
+
export type BuildOptions = Omit<CodeGenArgs$1, "query"> & {
|
|
1334
|
+
/**
|
|
1335
|
+
* If true (default), connect to the agent websocket immediately.
|
|
1336
|
+
*/
|
|
1337
|
+
autoConnect?: boolean;
|
|
1338
|
+
/**
|
|
1339
|
+
* If true (default), send `{ type: 'generate_all' }` after websocket connection.
|
|
1340
|
+
*/
|
|
1341
|
+
autoGenerate?: boolean;
|
|
1342
|
+
/**
|
|
1343
|
+
* Called for each blueprint chunk emitted by the create-agent stream.
|
|
1344
|
+
*/
|
|
1345
|
+
onBlueprintChunk?: (chunk: string) => void;
|
|
1346
|
+
};
|
|
1347
|
+
export type BuildStartEvent = {
|
|
1348
|
+
message?: string;
|
|
1349
|
+
agentId: string;
|
|
1350
|
+
websocketUrl: string;
|
|
1351
|
+
httpStatusUrl?: string;
|
|
1352
|
+
behaviorType?: BehaviorType$1;
|
|
1353
|
+
projectType?: string;
|
|
1354
|
+
template?: {
|
|
1355
|
+
name: string;
|
|
1356
|
+
files?: unknown;
|
|
1357
|
+
};
|
|
1358
|
+
};
|
|
1359
|
+
export type ApiResponse<T> = {
|
|
1360
|
+
success: true;
|
|
1361
|
+
data: T;
|
|
1362
|
+
message?: string;
|
|
1363
|
+
} | {
|
|
1364
|
+
success: false;
|
|
1365
|
+
error: {
|
|
1366
|
+
message: string;
|
|
1367
|
+
};
|
|
1368
|
+
message?: string;
|
|
1369
|
+
};
|
|
1370
|
+
export type PublicAppsQuery = {
|
|
1371
|
+
limit?: number;
|
|
1372
|
+
page?: number;
|
|
1373
|
+
sort?: string;
|
|
1374
|
+
order?: string;
|
|
1375
|
+
period?: string;
|
|
1376
|
+
framework?: string;
|
|
1377
|
+
search?: string;
|
|
1378
|
+
};
|
|
1379
|
+
export type AppListItem = {
|
|
1380
|
+
id: string;
|
|
1381
|
+
title: string;
|
|
1382
|
+
description?: string | null;
|
|
1383
|
+
framework?: string | null;
|
|
1384
|
+
updatedAt?: string | null;
|
|
1385
|
+
createdAt?: string | null;
|
|
1386
|
+
visibility?: "public" | "private";
|
|
1387
|
+
previewUrl?: string;
|
|
1388
|
+
};
|
|
1389
|
+
export type AppDetails = Record<string, unknown> & {
|
|
1390
|
+
id: string;
|
|
1391
|
+
previewUrl?: string;
|
|
1392
|
+
cloudflareUrl?: string;
|
|
1393
|
+
};
|
|
1394
|
+
type AgentWsServerMessage = WebSocketMessage;
|
|
1395
|
+
type AgentWsClientMessage = {
|
|
1396
|
+
type: "session_init";
|
|
1397
|
+
credentials: Credentials;
|
|
1398
|
+
} | {
|
|
1399
|
+
type: "generate_all";
|
|
1400
|
+
} | {
|
|
1401
|
+
type: "stop_generation";
|
|
1402
|
+
} | {
|
|
1403
|
+
type: "resume_generation";
|
|
1404
|
+
} | {
|
|
1405
|
+
type: "preview";
|
|
1406
|
+
} | {
|
|
1407
|
+
type: "deploy";
|
|
1408
|
+
} | {
|
|
1409
|
+
type: "get_conversation_state";
|
|
1410
|
+
} | {
|
|
1411
|
+
type: "clear_conversation";
|
|
1412
|
+
} | {
|
|
1413
|
+
type: "user_suggestion";
|
|
1414
|
+
message: string;
|
|
1415
|
+
images?: unknown[];
|
|
1416
|
+
};
|
|
1417
|
+
export type AgentWebSocketMessage = AgentWsServerMessage | AgentWsClientMessage;
|
|
1418
|
+
type WsMessageOf<TType extends AgentWsServerMessage["type"]> = Extract<AgentWsServerMessage, {
|
|
1419
|
+
type: TType;
|
|
1420
|
+
}>;
|
|
1421
|
+
export type AgentEventMap = {
|
|
1422
|
+
"ws:open": undefined;
|
|
1423
|
+
"ws:close": {
|
|
1424
|
+
code: number;
|
|
1425
|
+
reason: string;
|
|
1426
|
+
};
|
|
1427
|
+
"ws:error": {
|
|
1428
|
+
error: unknown;
|
|
1429
|
+
};
|
|
1430
|
+
/** Raw server->client message */
|
|
1431
|
+
"ws:message": AgentWsServerMessage;
|
|
1432
|
+
connected: WsMessageOf<"agent_connected">;
|
|
1433
|
+
conversation: WsMessageOf<"conversation_response" | "conversation_state">;
|
|
1434
|
+
phase: WsMessageOf<"phase_generating" | "phase_generated" | "phase_implementing" | "phase_implemented" | "phase_validating" | "phase_validated">;
|
|
1435
|
+
file: WsMessageOf<"file_chunk_generated" | "file_generated" | "file_generating" | "file_regenerating" | "file_regenerated">;
|
|
1436
|
+
preview: WsMessageOf<"deployment_completed" | "deployment_started" | "deployment_failed">;
|
|
1437
|
+
/** User-friendly error derived from `{ type: 'error' }` message */
|
|
1438
|
+
error: {
|
|
1439
|
+
error: string;
|
|
1440
|
+
};
|
|
1441
|
+
};
|
|
1442
|
+
type WebSocketLike = {
|
|
1443
|
+
send: (data: string) => void;
|
|
1444
|
+
close: () => void;
|
|
1445
|
+
addEventListener?: (type: "open" | "close" | "error" | "message", listener: (event: unknown) => void) => void;
|
|
1446
|
+
on?: (type: string, listener: (...args: unknown[]) => void) => void;
|
|
1447
|
+
};
|
|
1448
|
+
export type AgentConnectionOptions = {
|
|
1449
|
+
/** Override Origin header for WS (browser-like security). */
|
|
1450
|
+
origin?: string;
|
|
1451
|
+
/** Optional per-connection ephemeral credentials (used by `session_init`). */
|
|
1452
|
+
credentials?: Credentials;
|
|
1453
|
+
/** Additional headers (Node/Bun via ws factory). */
|
|
1454
|
+
headers?: Record<string, string>;
|
|
1455
|
+
/** Optional WebSocket factory for Node/Bun runtimes. */
|
|
1456
|
+
webSocketFactory?: (url: string, protocols?: string | string[], headers?: Record<string, string>) => WebSocketLike;
|
|
1457
|
+
};
|
|
1458
|
+
export type AgentConnection = {
|
|
1459
|
+
send: (msg: AgentWsClientMessage) => void;
|
|
1460
|
+
close: () => void;
|
|
1461
|
+
on: <K extends keyof AgentEventMap>(event: K, cb: (payload: AgentEventMap[K]) => void) => () => void;
|
|
1462
|
+
onAny: (cb: (event: keyof AgentEventMap, payload: AgentEventMap[keyof AgentEventMap]) => void) => () => void;
|
|
1463
|
+
waitFor: <K extends keyof AgentEventMap>(event: K, predicate?: (payload: AgentEventMap[K]) => boolean, timeoutMs?: number) => Promise<AgentEventMap[K]>;
|
|
1464
|
+
};
|
|
1465
|
+
export type VibeClientOptions = {
|
|
1466
|
+
baseUrl: string;
|
|
1467
|
+
/**
|
|
1468
|
+
* Current platform requirement: JWT access token. In future this will be minted from `apiKey`.
|
|
1469
|
+
*/
|
|
1470
|
+
token?: string;
|
|
1471
|
+
/** Future: VibeSDK API key. */
|
|
1472
|
+
apiKey?: string;
|
|
1473
|
+
defaultHeaders?: Record<string, string>;
|
|
1474
|
+
/** Used as Origin header for WS (optional but often required). */
|
|
1475
|
+
websocketOrigin?: string;
|
|
1476
|
+
/** Optional WebSocket factory for Node/Bun runtimes. */
|
|
1477
|
+
webSocketFactory?: AgentConnectionOptions["webSocketFactory"];
|
|
1478
|
+
fetchFn?: typeof fetch;
|
|
1479
|
+
};
|
|
1480
|
+
type WaitUntilReadyOptions = {
|
|
1481
|
+
timeoutMs?: number;
|
|
1482
|
+
};
|
|
1483
|
+
type BuildSessionInit = {
|
|
1484
|
+
getAuthToken?: () => string | undefined;
|
|
1485
|
+
defaultCredentials?: Credentials;
|
|
1486
|
+
};
|
|
1487
|
+
export declare class BuildSession {
|
|
1488
|
+
private clientOptions;
|
|
1489
|
+
private init;
|
|
1490
|
+
readonly agentId: string;
|
|
1491
|
+
readonly websocketUrl: string;
|
|
1492
|
+
readonly behaviorType: BehaviorType$1 | undefined;
|
|
1493
|
+
readonly projectType: ProjectType$1 | string | undefined;
|
|
1494
|
+
private connection;
|
|
1495
|
+
constructor(clientOptions: VibeClientOptions, start: BuildStartEvent, init?: BuildSessionInit);
|
|
1496
|
+
isConnected(): boolean;
|
|
1497
|
+
connect(options?: AgentConnectionOptions): AgentConnection;
|
|
1498
|
+
startGeneration(): void;
|
|
1499
|
+
stop(): void;
|
|
1500
|
+
followUp(message: string, options?: {
|
|
1501
|
+
images?: unknown[];
|
|
1502
|
+
}): void;
|
|
1503
|
+
requestConversationState(): void;
|
|
1504
|
+
deployPreview(): void;
|
|
1505
|
+
deployCloudflare(): void;
|
|
1506
|
+
waitUntilReady(options?: WaitUntilReadyOptions): Promise<void>;
|
|
1507
|
+
on: AgentConnection["on"];
|
|
1508
|
+
onAny: AgentConnection["onAny"];
|
|
1509
|
+
onMessageType<TType extends AgentWsServerMessage["type"]>(type: TType, cb: (message: WsMessageOf<TType>) => void): () => void;
|
|
1510
|
+
waitForMessageType<TType extends AgentWsServerMessage["type"]>(type: TType, timeoutMs?: number): Promise<WsMessageOf<TType>>;
|
|
1511
|
+
close(): void;
|
|
1512
|
+
private assertConnected;
|
|
1513
|
+
}
|
|
1514
|
+
export declare class VibeClient {
|
|
1515
|
+
private options;
|
|
1516
|
+
private http;
|
|
1517
|
+
constructor(options: VibeClientOptions);
|
|
1518
|
+
get baseUrl(): string;
|
|
1519
|
+
/**
|
|
1520
|
+
* Creates a new agent/app from a prompt and returns a BuildSession.
|
|
1521
|
+
*
|
|
1522
|
+
* Current platform requirement: `token` must be a valid JWT access token.
|
|
1523
|
+
* Later: `apiKey` will be exchanged for a short-lived JWT.
|
|
1524
|
+
*/
|
|
1525
|
+
build(prompt: string, options?: BuildOptions): Promise<BuildSession>;
|
|
1526
|
+
/** Connect to an existing agent/app by id. */
|
|
1527
|
+
connect(agentId: string, options?: {
|
|
1528
|
+
credentials?: Credentials;
|
|
1529
|
+
}): Promise<BuildSession>;
|
|
1530
|
+
apps: {
|
|
1531
|
+
listPublic: (query?: PublicAppsQuery) => Promise<ApiResponse<{
|
|
1532
|
+
apps: AppListItem[];
|
|
1533
|
+
pagination?: unknown;
|
|
1534
|
+
}>>;
|
|
1535
|
+
listMine: () => Promise<ApiResponse<{
|
|
1536
|
+
apps: AppListItem[];
|
|
1537
|
+
}>>;
|
|
1538
|
+
get: (appId: string) => Promise<ApiResponse<AppDetails>>;
|
|
1539
|
+
getGitCloneToken: (appId: string) => Promise<ApiResponse<{
|
|
1540
|
+
token: string;
|
|
1541
|
+
expiresIn: number;
|
|
1542
|
+
expiresAt: string;
|
|
1543
|
+
cloneUrl: string;
|
|
1544
|
+
}>>;
|
|
1545
|
+
};
|
|
1546
|
+
}
|
|
1547
|
+
export declare class AgenticClient extends VibeClient {
|
|
1548
|
+
constructor(options: VibeClientOptions);
|
|
1549
|
+
build(prompt: string, options?: Parameters<VibeClient["build"]>[1]): Promise<BuildSession>;
|
|
1550
|
+
}
|
|
1551
|
+
export declare class PhasicClient extends VibeClient {
|
|
1552
|
+
constructor(options: VibeClientOptions);
|
|
1553
|
+
build(prompt: string, options?: Parameters<VibeClient["build"]>[1]): Promise<BuildSession>;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
export {
|
|
1557
|
+
BehaviorType$1 as BehaviorType,
|
|
1558
|
+
CodeGenArgs$1 as CodeGenArgs,
|
|
1559
|
+
ProjectType$1 as ProjectType,
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1562
|
+
export {};
|