@builder.io/ai-utils 0.83.0 → 0.84.0-dev.202607212345.137e4170f
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/package.json +1 -1
- package/src/acl-schema.d.ts +88 -0
- package/src/acl-schema.js +71 -0
- package/src/claw.d.ts +1 -0
- package/src/claw.js +9 -0
- package/src/claw.spec.js +11 -1
- package/src/codegen.d.ts +11 -0
- package/src/codegen.js +21 -1
- package/src/design-systems.d.ts +160 -60
- package/src/design-systems.js +91 -39
- package/src/events.d.ts +32 -1
- package/src/events.js +8 -0
- package/src/perf-report.d.ts +116 -0
- package/src/perf-report.js +122 -0
- package/src/projects.d.ts +111 -4
- package/src/projects.js +89 -2
- package/src/repo-indexing.d.ts +12 -0
- package/src/vpc-peering.d.ts +49 -0
- package/src/vpc-peering.js +1 -0
package/src/design-systems.js
CHANGED
|
@@ -1,45 +1,19 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
/**
|
|
3
3
|
* Accepts `https://github.com/<owner>/<repo>` (optionally with a trailing
|
|
4
|
-
* `.git` or path segments). Used to gate
|
|
5
|
-
* `/design-systems/v1/generate` endpoint.
|
|
4
|
+
* `.git` or path segments). Used to gate public-repo inputs before cloning.
|
|
6
5
|
*/
|
|
7
6
|
export const GITHUB_REPO_URL_REGEX = /^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?:\.git)?\/?$/;
|
|
8
7
|
export const GENERATE_DESIGN_SYSTEM_MAX_FILE_BYTES = 2 * 1024 * 1024 * 1024;
|
|
9
8
|
export const GENERATE_DESIGN_SYSTEM_MAX_ATTACHMENTS = 50;
|
|
10
9
|
export const GENERATE_DESIGN_SYSTEM_MIN_ATTACHMENTS = 0;
|
|
11
|
-
export const generateDesignSystemBodySchema = z.object({
|
|
12
|
-
projectName: z.string().trim().min(1).max(200).optional(),
|
|
13
|
-
devToolsVersion: z.string().trim().min(1).max(64).optional(),
|
|
14
|
-
selection: z
|
|
15
|
-
.preprocess((v) => {
|
|
16
|
-
if (typeof v !== "string")
|
|
17
|
-
return v;
|
|
18
|
-
const trimmed = v.trim();
|
|
19
|
-
if (!trimmed)
|
|
20
|
-
return undefined;
|
|
21
|
-
try {
|
|
22
|
-
return JSON.parse(trimmed);
|
|
23
|
-
}
|
|
24
|
-
catch (_a) {
|
|
25
|
-
return v;
|
|
26
|
-
}
|
|
27
|
-
}, z.record(z.string(), z.array(z.string().min(1)).max(10000)))
|
|
28
|
-
.optional(),
|
|
29
|
-
githubRepoUrl: z
|
|
30
|
-
.string()
|
|
31
|
-
.trim()
|
|
32
|
-
.regex(GITHUB_REPO_URL_REGEX, "must be a public github.com repo URL")
|
|
33
|
-
.optional(),
|
|
34
|
-
connectedProjectId: z.string().trim().min(1).max(128).optional(),
|
|
35
|
-
});
|
|
36
10
|
/**
|
|
37
11
|
* Signed-URL upload flow.
|
|
38
12
|
*
|
|
39
13
|
* Clients no longer post `.fig` bytes through the service (Cloud Run caps
|
|
40
14
|
* request bodies at 32 MiB). Instead they call `upload/start` to get a
|
|
41
15
|
* temporary signed resumable-upload URL per attachment, stream the bytes
|
|
42
|
-
* directly to GCS, then call `/
|
|
16
|
+
* directly to GCS, then call `/index` with the returned upload tokens.
|
|
43
17
|
* See `tech-specs/signed-url-figma-upload`.
|
|
44
18
|
*/
|
|
45
19
|
/** A single attachment the client declares when starting an upload. */
|
|
@@ -61,7 +35,7 @@ export const uploadStartBodySchema = z.object({
|
|
|
61
35
|
});
|
|
62
36
|
/**
|
|
63
37
|
* Claims encoded inside a signed `uploadToken`. Bound to the GCS object at
|
|
64
|
-
* `upload/start` and verified at `/
|
|
38
|
+
* `upload/start` and verified at `/index`, so a client cannot point the
|
|
65
39
|
* decode worker at an object it did not upload.
|
|
66
40
|
*/
|
|
67
41
|
export const uploadTokenPayloadSchema = z.object({
|
|
@@ -73,15 +47,93 @@ export const uploadTokenPayloadSchema = z.object({
|
|
|
73
47
|
idx: z.number().int().nonnegative(),
|
|
74
48
|
declaredSize: z.number().int().nonnegative().optional(),
|
|
75
49
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
export const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
50
|
+
export const indexDesignSystemScopeSchema = z.enum([
|
|
51
|
+
"space",
|
|
52
|
+
"organization",
|
|
53
|
+
"global",
|
|
54
|
+
]);
|
|
55
|
+
export const fullLibrarySourceKindSchema = z.enum([
|
|
56
|
+
"connected-repo",
|
|
57
|
+
"public-repo",
|
|
58
|
+
"package",
|
|
59
|
+
]);
|
|
60
|
+
const connectedRepoSourceSchema = z.object({
|
|
61
|
+
kind: z.literal("connected-repo"),
|
|
62
|
+
fusionProjectId: z.string().min(1),
|
|
63
|
+
include: z.array(z.string()).optional(),
|
|
64
|
+
exclude: z.array(z.string()).optional(),
|
|
65
|
+
instructions: z.string().optional(),
|
|
66
|
+
});
|
|
67
|
+
const publicRepoSourceSchema = z.object({
|
|
68
|
+
kind: z.literal("public-repo"),
|
|
69
|
+
repoUrl: z.string().url(),
|
|
70
|
+
include: z.array(z.string()).optional(),
|
|
71
|
+
exclude: z.array(z.string()).optional(),
|
|
72
|
+
instructions: z.string().optional(),
|
|
73
|
+
});
|
|
74
|
+
const packageSourceSchema = z.object({
|
|
75
|
+
kind: z.literal("package"),
|
|
76
|
+
package: z.string().min(1),
|
|
77
|
+
registry: z.string().optional(),
|
|
78
|
+
token: z.string().optional(),
|
|
79
|
+
instructions: z.string().optional(),
|
|
80
|
+
});
|
|
81
|
+
export const fullLibrarySourceSchema = z.discriminatedUnion("kind", [
|
|
82
|
+
connectedRepoSourceSchema,
|
|
83
|
+
publicRepoSourceSchema,
|
|
84
|
+
packageSourceSchema,
|
|
85
|
+
]);
|
|
86
|
+
export const fileSourceSchema = z.object({
|
|
87
|
+
kind: z.literal("file"),
|
|
88
|
+
uploadToken: z.string().min(1).optional(),
|
|
89
|
+
uploadGcsPath: z.string().min(1).optional(),
|
|
90
|
+
/** Optional map of filename → page/frame GUIDs to restrict Figma indexing. */
|
|
91
|
+
selection: z.record(z.string(), z.array(z.string().min(1))).optional(),
|
|
92
|
+
instructions: z.string().optional(),
|
|
93
|
+
});
|
|
94
|
+
export const designSystemSourceSchema = z
|
|
95
|
+
.discriminatedUnion("kind", [
|
|
96
|
+
connectedRepoSourceSchema,
|
|
97
|
+
publicRepoSourceSchema,
|
|
98
|
+
packageSourceSchema,
|
|
99
|
+
fileSourceSchema,
|
|
100
|
+
])
|
|
101
|
+
.refine((s) => s.kind !== "file" || !!s.uploadToken || !!s.uploadGcsPath, {
|
|
102
|
+
message: "File sources require either uploadToken or uploadGcsPath.",
|
|
103
|
+
});
|
|
104
|
+
export const resolvePackageOptionsSchema = z.object({
|
|
105
|
+
/** Package name, optionally with an embedded version ("@ionic/core@7.0.0"). */
|
|
106
|
+
package: z.string().min(1),
|
|
107
|
+
registry: z.string().optional(),
|
|
108
|
+
token: z.string().optional(),
|
|
109
|
+
specifier: z.string().optional(),
|
|
110
|
+
});
|
|
111
|
+
export const indexDesignSystemBodySchema = z.object({
|
|
112
|
+
designSystemName: z.string().optional(),
|
|
113
|
+
scope: indexDesignSystemScopeSchema.optional(),
|
|
114
|
+
sources: z
|
|
115
|
+
.array(designSystemSourceSchema)
|
|
116
|
+
.min(1)
|
|
86
117
|
.max(GENERATE_DESIGN_SYSTEM_MAX_ATTACHMENTS),
|
|
87
118
|
});
|
|
119
|
+
export const sourceFileEntrySchema = z.object({
|
|
120
|
+
name: z.string(),
|
|
121
|
+
/** Repo-relative path (POSIX separators). */
|
|
122
|
+
path: z.string(),
|
|
123
|
+
type: z.enum(["dir", "file"]),
|
|
124
|
+
});
|
|
125
|
+
export const listSourceFilesQuerySchema = z.object({
|
|
126
|
+
projectId: z.string().min(1),
|
|
127
|
+
/** Directory to list, repo-relative. Empty/omitted → repo root. */
|
|
128
|
+
path: z.string().optional(),
|
|
129
|
+
/** Git ref (branch or sha). Omitted → the repo's default branch. */
|
|
130
|
+
ref: z.string().optional(),
|
|
131
|
+
});
|
|
132
|
+
export const listPublicSourceFilesQuerySchema = z.object({
|
|
133
|
+
/** Full repo URL (e.g. https://github.com/owner/repo). GitHub only. */
|
|
134
|
+
repoUrl: z.string().url(),
|
|
135
|
+
/** Directory to list, repo-relative. Empty/omitted → repo root. */
|
|
136
|
+
path: z.string().optional(),
|
|
137
|
+
/** Git ref (branch or sha). Omitted → the repo's default branch. */
|
|
138
|
+
ref: z.string().optional(),
|
|
139
|
+
});
|
package/src/events.d.ts
CHANGED
|
@@ -1071,6 +1071,8 @@ export type FigmaDecodeJobV1 = FusionEventVariant<"figma.decode.job", {
|
|
|
1071
1071
|
* file-local, so they must be scoped per attachment.
|
|
1072
1072
|
*/
|
|
1073
1073
|
selection?: Record<string, string[]>;
|
|
1074
|
+
/** Freeform notes to guide indexing, forwarded to the indexer agent. */
|
|
1075
|
+
instructions?: string;
|
|
1074
1076
|
}, {}, 1>;
|
|
1075
1077
|
export declare const FigmaDecodeJobV1: {
|
|
1076
1078
|
eventName: "figma.decode.job";
|
|
@@ -1157,6 +1159,8 @@ export interface FigmaFrameManifest {
|
|
|
1157
1159
|
githubRepo?: FigmaGithubRepoSource;
|
|
1158
1160
|
/** True if one or more frame chunk uploads failed; some frames may be missing. */
|
|
1159
1161
|
partialFailure?: boolean;
|
|
1162
|
+
/** Freeform notes from the caller to guide indexing. */
|
|
1163
|
+
instructions?: string;
|
|
1160
1164
|
}
|
|
1161
1165
|
export type PrReviewRequestedV1 = FusionEventVariant<"pr.review.requested", {
|
|
1162
1166
|
repoFullName: string;
|
|
@@ -1296,7 +1300,34 @@ export declare const McpPrototypePulledV1: {
|
|
|
1296
1300
|
eventName: "mcp.prototype.pulled";
|
|
1297
1301
|
version: "1";
|
|
1298
1302
|
};
|
|
1299
|
-
export type
|
|
1303
|
+
export type HostingCustomDomainCertCheckV1 = FusionEventVariant<"hosting.custom-domain.cert-check", {
|
|
1304
|
+
domain: string;
|
|
1305
|
+
projectId: string;
|
|
1306
|
+
certId: string;
|
|
1307
|
+
attemptId: string;
|
|
1308
|
+
startedAtMs: number;
|
|
1309
|
+
timeoutMs: number;
|
|
1310
|
+
}, {
|
|
1311
|
+
projectId: string;
|
|
1312
|
+
}, 1>;
|
|
1313
|
+
export declare const HostingCustomDomainCertCheckV1: {
|
|
1314
|
+
eventName: "hosting.custom-domain.cert-check";
|
|
1315
|
+
version: "1";
|
|
1316
|
+
};
|
|
1317
|
+
export type HostingCustomDomainDelegationCheckV1 = FusionEventVariant<"hosting.custom-domain.delegation-check", {
|
|
1318
|
+
domain: string;
|
|
1319
|
+
projectId: string;
|
|
1320
|
+
attemptId: string;
|
|
1321
|
+
startedAtMs: number;
|
|
1322
|
+
timeoutMs: number;
|
|
1323
|
+
}, {
|
|
1324
|
+
projectId: string;
|
|
1325
|
+
}, 1>;
|
|
1326
|
+
export declare const HostingCustomDomainDelegationCheckV1: {
|
|
1327
|
+
eventName: "hosting.custom-domain.delegation-check";
|
|
1328
|
+
version: "1";
|
|
1329
|
+
};
|
|
1330
|
+
export type FusionEvent = ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | ClientDevtoolsToolCallRequestV1 | ClientDevtoolsToolCallV1 | ClientDevtoolsToolResultV1 | ClientDevtoolsBuildMigratedV1 | ClientDevtoolsBuildCompletedV1 | ClientDevtoolsBuildUploadedV1 | ClientDevtoolsBuildFailedV1 | FusionProjectCreatedV1 | SetupAgentCompletedV1 | GitPrMergedV1 | GitPrCreatedV1 | GitPrClosedV1 | ForceSetupAgentV1 | ClawMessageSentV1 | CodegenCompletionV1 | CodegenUserPromptV1 | GitWebhooksRegisterV1 | FusionProjectSettingsUpdatedV1 | VideoRecordingCompletedV1 | TimelineRecordingReadyV1 | FusionBranchCreatedV1 | FusionContainerStartedV1 | FusionContainerFailedV1 | FusionBranchFailedV1 | BotMentionGitHubExternalPrV1 | BotMentionGitHubInternalPrV1 | BotMentionGitLabPrV1 | BotMentionBitbucketPrV1 | BotMentionAzurePrV1 | ReviewSubmittedV1 | PrReviewRequestedV1 | FigmaDecodeJobV1 | ProjectSnapshotRefreshV1 | ProjectSnapshotCapturedV1 | ProjectSnapshotCreatedV1 | ProjectSnapshotFailedV1 | ProjectSnapshotReadyCheckV1 | ProjectSnapshotPodWatchV1 | McpPrototypePulledV1 | HostingCustomDomainCertCheckV1 | HostingCustomDomainDelegationCheckV1;
|
|
1300
1331
|
export interface ModelPermissionRequiredEvent {
|
|
1301
1332
|
type: "assistant.model.permission.required";
|
|
1302
1333
|
data: {
|
package/src/events.js
CHANGED
|
@@ -162,3 +162,11 @@ export const McpPrototypePulledV1 = {
|
|
|
162
162
|
eventName: "mcp.prototype.pulled",
|
|
163
163
|
version: "1",
|
|
164
164
|
};
|
|
165
|
+
export const HostingCustomDomainCertCheckV1 = {
|
|
166
|
+
eventName: "hosting.custom-domain.cert-check",
|
|
167
|
+
version: "1",
|
|
168
|
+
};
|
|
169
|
+
export const HostingCustomDomainDelegationCheckV1 = {
|
|
170
|
+
eventName: "hosting.custom-domain.delegation-check",
|
|
171
|
+
version: "1",
|
|
172
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CURRENT_PERF_REPORT_SCHEMA_VERSION = 1;
|
|
3
|
+
export declare const PerfIncidentTypeSchema: z.ZodEnum<{
|
|
4
|
+
hang: "hang";
|
|
5
|
+
"memory-pressure": "memory-pressure";
|
|
6
|
+
"recovered-hang": "recovered-hang";
|
|
7
|
+
"recovered-unclean-exit": "recovered-unclean-exit";
|
|
8
|
+
"renderer-crash": "renderer-crash";
|
|
9
|
+
}>;
|
|
10
|
+
export type PerfIncidentType = z.infer<typeof PerfIncidentTypeSchema>;
|
|
11
|
+
export declare const PerfProcessSchema: z.ZodObject<{
|
|
12
|
+
kind: z.ZodEnum<{
|
|
13
|
+
browser: "browser";
|
|
14
|
+
child: "child";
|
|
15
|
+
gpu: "gpu";
|
|
16
|
+
renderer: "renderer";
|
|
17
|
+
utility: "utility";
|
|
18
|
+
}>;
|
|
19
|
+
pid: z.ZodNumber;
|
|
20
|
+
memoryKb: z.ZodNumber;
|
|
21
|
+
cpuPercent: z.ZodNumber;
|
|
22
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type PerfProcess = z.infer<typeof PerfProcessSchema>;
|
|
25
|
+
export declare const PerfTabSchema: z.ZodObject<{
|
|
26
|
+
tabId: z.ZodString;
|
|
27
|
+
route: z.ZodOptional<z.ZodString>;
|
|
28
|
+
feature: z.ZodOptional<z.ZodString>;
|
|
29
|
+
jsHeapUsedKb: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
jsHeapLimitKb: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
subsystems: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
32
|
+
livenessLatencyMs: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type PerfTab = z.infer<typeof PerfTabSchema>;
|
|
35
|
+
export declare const PerfSampleSchema: z.ZodObject<{
|
|
36
|
+
t: z.ZodNumber;
|
|
37
|
+
desktopFootprintKb: z.ZodNumber;
|
|
38
|
+
freeMemoryKb: z.ZodNumber;
|
|
39
|
+
perTabHeapKb: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type PerfSample = z.infer<typeof PerfSampleSchema>;
|
|
42
|
+
export declare const PerfReportSchema: z.ZodObject<{
|
|
43
|
+
schemaVersion: z.ZodNumber;
|
|
44
|
+
incidentType: z.ZodEnum<{
|
|
45
|
+
hang: "hang";
|
|
46
|
+
"memory-pressure": "memory-pressure";
|
|
47
|
+
"recovered-hang": "recovered-hang";
|
|
48
|
+
"recovered-unclean-exit": "recovered-unclean-exit";
|
|
49
|
+
"renderer-crash": "renderer-crash";
|
|
50
|
+
}>;
|
|
51
|
+
sessionId: z.ZodString;
|
|
52
|
+
deviceId: z.ZodString;
|
|
53
|
+
appVersion: z.ZodString;
|
|
54
|
+
platform: z.ZodEnum<{
|
|
55
|
+
darwin: "darwin";
|
|
56
|
+
linux: "linux";
|
|
57
|
+
win32: "win32";
|
|
58
|
+
}>;
|
|
59
|
+
channel: z.ZodEnum<{
|
|
60
|
+
alpha: "alpha";
|
|
61
|
+
stable: "stable";
|
|
62
|
+
}>;
|
|
63
|
+
timestamp: z.ZodNumber;
|
|
64
|
+
machine: z.ZodObject<{
|
|
65
|
+
totalMemoryKb: z.ZodNumber;
|
|
66
|
+
freeMemoryKb: z.ZodNumber;
|
|
67
|
+
desktopFootprintKb: z.ZodNumber;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
processes: z.ZodArray<z.ZodObject<{
|
|
70
|
+
kind: z.ZodEnum<{
|
|
71
|
+
browser: "browser";
|
|
72
|
+
child: "child";
|
|
73
|
+
gpu: "gpu";
|
|
74
|
+
renderer: "renderer";
|
|
75
|
+
utility: "utility";
|
|
76
|
+
}>;
|
|
77
|
+
pid: z.ZodNumber;
|
|
78
|
+
memoryKb: z.ZodNumber;
|
|
79
|
+
cpuPercent: z.ZodNumber;
|
|
80
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strip>>;
|
|
82
|
+
tabs: z.ZodArray<z.ZodObject<{
|
|
83
|
+
tabId: z.ZodString;
|
|
84
|
+
route: z.ZodOptional<z.ZodString>;
|
|
85
|
+
feature: z.ZodOptional<z.ZodString>;
|
|
86
|
+
jsHeapUsedKb: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
jsHeapLimitKb: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
subsystems: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
89
|
+
livenessLatencyMs: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
}, z.core.$strip>>;
|
|
91
|
+
crash: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
reason: z.ZodString;
|
|
93
|
+
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
oom: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
+
}, z.core.$strip>>;
|
|
96
|
+
hang: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
startedAt: z.ZodNumber;
|
|
98
|
+
durationMs: z.ZodNumber;
|
|
99
|
+
recovered: z.ZodBoolean;
|
|
100
|
+
surface: z.ZodString;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
samples: z.ZodArray<z.ZodObject<{
|
|
103
|
+
t: z.ZodNumber;
|
|
104
|
+
desktopFootprintKb: z.ZodNumber;
|
|
105
|
+
freeMemoryKb: z.ZodNumber;
|
|
106
|
+
perTabHeapKb: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
107
|
+
}, z.core.$strip>>;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
export type PerfReport = z.infer<typeof PerfReportSchema>;
|
|
110
|
+
/**
|
|
111
|
+
* Collapses opaque identifiers out of a route/URL so a report can't carry a
|
|
112
|
+
* project/space id. Keeps the structural shape (which screen was open) while
|
|
113
|
+
* masking the specific resource.
|
|
114
|
+
*/
|
|
115
|
+
export declare function redactPerfRoute(route: string | undefined): string | undefined;
|
|
116
|
+
export declare function redactPerfReport(report: PerfReport): PerfReport;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Desktop performance & crash monitoring wire contract.
|
|
4
|
+
//
|
|
5
|
+
// Canonical schema. The Electron desktop app lives in a separate workspace and
|
|
6
|
+
// cannot import this file, so it keeps a hand-mirrored TypeScript type in
|
|
7
|
+
// code/packages/electron-app/src/perf-report.types.ts. Keep the two in sync and
|
|
8
|
+
// bump CURRENT_PERF_REPORT_SCHEMA_VERSION on any breaking shape change.
|
|
9
|
+
// ============================================================================
|
|
10
|
+
export const CURRENT_PERF_REPORT_SCHEMA_VERSION = 1;
|
|
11
|
+
export const PerfIncidentTypeSchema = z.enum([
|
|
12
|
+
"renderer-crash",
|
|
13
|
+
"hang",
|
|
14
|
+
"recovered-hang",
|
|
15
|
+
"memory-pressure",
|
|
16
|
+
"recovered-unclean-exit",
|
|
17
|
+
]);
|
|
18
|
+
export const PerfProcessSchema = z.object({
|
|
19
|
+
kind: z.enum(["browser", "renderer", "gpu", "utility", "child"]),
|
|
20
|
+
pid: z.number(),
|
|
21
|
+
memoryKb: z.number(),
|
|
22
|
+
cpuPercent: z.number(),
|
|
23
|
+
tabId: z.string().optional(),
|
|
24
|
+
});
|
|
25
|
+
export const PerfTabSchema = z.object({
|
|
26
|
+
tabId: z.string(),
|
|
27
|
+
route: z.string().optional(),
|
|
28
|
+
feature: z.string().optional(),
|
|
29
|
+
jsHeapUsedKb: z.number().optional(),
|
|
30
|
+
jsHeapLimitKb: z.number().optional(),
|
|
31
|
+
subsystems: z.record(z.string(), z.number()),
|
|
32
|
+
livenessLatencyMs: z.number().optional(),
|
|
33
|
+
});
|
|
34
|
+
export const PerfSampleSchema = z.object({
|
|
35
|
+
t: z.number(),
|
|
36
|
+
desktopFootprintKb: z.number(),
|
|
37
|
+
freeMemoryKb: z.number(),
|
|
38
|
+
perTabHeapKb: z.record(z.string(), z.number()),
|
|
39
|
+
});
|
|
40
|
+
export const PerfReportSchema = z.object({
|
|
41
|
+
schemaVersion: z.number(),
|
|
42
|
+
incidentType: PerfIncidentTypeSchema,
|
|
43
|
+
sessionId: z.string(),
|
|
44
|
+
deviceId: z.string(),
|
|
45
|
+
appVersion: z.string(),
|
|
46
|
+
platform: z.enum(["darwin", "win32", "linux"]),
|
|
47
|
+
channel: z.enum(["stable", "alpha"]),
|
|
48
|
+
timestamp: z.number(),
|
|
49
|
+
machine: z.object({
|
|
50
|
+
totalMemoryKb: z.number(),
|
|
51
|
+
freeMemoryKb: z.number(),
|
|
52
|
+
desktopFootprintKb: z.number(),
|
|
53
|
+
}),
|
|
54
|
+
processes: z.array(PerfProcessSchema),
|
|
55
|
+
tabs: z.array(PerfTabSchema),
|
|
56
|
+
crash: z
|
|
57
|
+
.object({
|
|
58
|
+
reason: z.string(),
|
|
59
|
+
exitCode: z.number().optional(),
|
|
60
|
+
oom: z.boolean().optional(),
|
|
61
|
+
})
|
|
62
|
+
.optional(),
|
|
63
|
+
hang: z
|
|
64
|
+
.object({
|
|
65
|
+
startedAt: z.number(),
|
|
66
|
+
durationMs: z.number(),
|
|
67
|
+
recovered: z.boolean(),
|
|
68
|
+
surface: z.string(),
|
|
69
|
+
})
|
|
70
|
+
.optional(),
|
|
71
|
+
samples: z.array(PerfSampleSchema),
|
|
72
|
+
});
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
// Route/URL redaction. The desktop client redacts before sending; this runs
|
|
75
|
+
// again at ingest (defense in depth) because the service cannot import the
|
|
76
|
+
// renderer's redactSnapshot helper across the workspace boundary.
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
const PROJECT_ID_SEGMENTS = new Set([
|
|
79
|
+
"projects",
|
|
80
|
+
"content",
|
|
81
|
+
"fusion",
|
|
82
|
+
"space",
|
|
83
|
+
"org",
|
|
84
|
+
"organization",
|
|
85
|
+
]);
|
|
86
|
+
/**
|
|
87
|
+
* Collapses opaque identifiers out of a route/URL so a report can't carry a
|
|
88
|
+
* project/space id. Keeps the structural shape (which screen was open) while
|
|
89
|
+
* masking the specific resource.
|
|
90
|
+
*/
|
|
91
|
+
export function redactPerfRoute(route) {
|
|
92
|
+
if (!route) {
|
|
93
|
+
return route;
|
|
94
|
+
}
|
|
95
|
+
const [pathPart] = route.split("?");
|
|
96
|
+
const segments = pathPart.split("/");
|
|
97
|
+
const redacted = segments.map((segment, index) => {
|
|
98
|
+
var _a;
|
|
99
|
+
if (!segment) {
|
|
100
|
+
return segment;
|
|
101
|
+
}
|
|
102
|
+
const previous = (_a = segments[index - 1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
103
|
+
if (previous && PROJECT_ID_SEGMENTS.has(previous)) {
|
|
104
|
+
return ":id";
|
|
105
|
+
}
|
|
106
|
+
// Bare id-looking segments (uuids, long hex/base62 tokens).
|
|
107
|
+
if (/^[0-9a-f]{16,}$/i.test(segment) || /^[0-9a-z]{20,}$/i.test(segment)) {
|
|
108
|
+
return ":id";
|
|
109
|
+
}
|
|
110
|
+
return segment;
|
|
111
|
+
});
|
|
112
|
+
return redacted.join("/");
|
|
113
|
+
}
|
|
114
|
+
export function redactPerfReport(report) {
|
|
115
|
+
return {
|
|
116
|
+
...report,
|
|
117
|
+
tabs: report.tabs.map((tab) => ({
|
|
118
|
+
...tab,
|
|
119
|
+
route: redactPerfRoute(tab.route),
|
|
120
|
+
})),
|
|
121
|
+
};
|
|
122
|
+
}
|
package/src/projects.d.ts
CHANGED
|
@@ -229,6 +229,7 @@ export type GitConfigs = Record<string, GitConfig>;
|
|
|
229
229
|
export declare const EXAMPLE_REPOS: string[];
|
|
230
230
|
export declare const STARTER_REPO = "BuilderIO/fusion-starter";
|
|
231
231
|
export declare const DSI_PREVIEW_REPO = "BuilderIO/dsi-starter";
|
|
232
|
+
export declare const DSI_PLACEHOLDER_REPO = "BuilderIO/dsi-placeholder";
|
|
232
233
|
export declare const AGENT_NATIVE_STARTER_REPO = "BuilderIO/builder-agent-native-starter";
|
|
233
234
|
export declare const EXAMPLE_OR_STARTER_REPOS: string[];
|
|
234
235
|
export declare const EXAMPLE_OR_STARTER_REPOS_URLS: string[];
|
|
@@ -378,7 +379,7 @@ export interface ProjectSkillUrl extends ProjectSkillBase {
|
|
|
378
379
|
}
|
|
379
380
|
export type ProjectSkill = ProjectSkillSource | ProjectSkillNpm | ProjectSkillGithub | ProjectSkillUrl;
|
|
380
381
|
export type FusionExecutionEnvironment = "containerized" | "container-less" | "cloud" | "cloud-v2";
|
|
381
|
-
export type AgentType = "setup-project" | "project-configuration" | "org-agent" | "code-review-orchestrator" | "design-system-indexer" | "builder-publish-integration";
|
|
382
|
+
export type AgentType = "setup-project" | "project-configuration" | "org-agent" | "code-review-orchestrator" | "design-system-indexer" | "repo-indexer" | "builder-publish-integration";
|
|
382
383
|
export interface PartialBranchData {
|
|
383
384
|
name?: string;
|
|
384
385
|
createdBy: string;
|
|
@@ -489,7 +490,7 @@ export interface OrgAgentConfig {
|
|
|
489
490
|
}
|
|
490
491
|
export type BranchType = "code-review" | "setup-project"
|
|
491
492
|
/** Hidden branch the webapp creates when the user picks manual setup. */
|
|
492
|
-
| "manual-setup" | "org-agent" | "snapshot-build" | "design-system-indexing" | "deploy" | "default";
|
|
493
|
+
| "manual-setup" | "org-agent" | "snapshot-build" | "design-system-indexing" | "repo-indexing" | "deploy" | "default";
|
|
493
494
|
/** Category of work a branch represents, auto-assigned during prompt analysis. */
|
|
494
495
|
export type BranchCategory = "feature" | "fix" | "research" | "other";
|
|
495
496
|
export interface BranchSharedData {
|
|
@@ -1489,9 +1490,8 @@ export declare const ProjectHostingSchema: z.ZodObject<{
|
|
|
1489
1490
|
uploading: "uploading";
|
|
1490
1491
|
}>>;
|
|
1491
1492
|
publishedCommit: z.ZodOptional<z.ZodString>;
|
|
1492
|
-
customDomain: z.ZodOptional<z.ZodString>;
|
|
1493
|
-
customDomainVerified: z.ZodOptional<z.ZodBoolean>;
|
|
1494
1493
|
autoDeploy: z.ZodOptional<z.ZodBoolean>;
|
|
1494
|
+
domainIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1495
1495
|
}, z.core.$strip>;
|
|
1496
1496
|
export type ProjectHosting = z.infer<typeof ProjectHostingSchema>;
|
|
1497
1497
|
/**
|
|
@@ -1710,6 +1710,113 @@ export declare const GetDeploysResponseSchema: z.ZodObject<{
|
|
|
1710
1710
|
}, z.core.$strip>>;
|
|
1711
1711
|
}, z.core.$strip>;
|
|
1712
1712
|
export type GetDeploysResponse = z.infer<typeof GetDeploysResponseSchema>;
|
|
1713
|
+
export declare const HostingDomainStatusSchema: z.ZodEnum<{
|
|
1714
|
+
active: "active";
|
|
1715
|
+
failed: "failed";
|
|
1716
|
+
pending: "pending";
|
|
1717
|
+
provisioning: "provisioning";
|
|
1718
|
+
verifying: "verifying";
|
|
1719
|
+
}>;
|
|
1720
|
+
export type HostingDomainStatus = z.infer<typeof HostingDomainStatusSchema>;
|
|
1721
|
+
export declare const HostingDomainKindSchema: z.ZodEnum<{
|
|
1722
|
+
apex: "apex";
|
|
1723
|
+
subdomain: "subdomain";
|
|
1724
|
+
}>;
|
|
1725
|
+
export type HostingDomainKind = z.infer<typeof HostingDomainKindSchema>;
|
|
1726
|
+
/**
|
|
1727
|
+
* Custom domain record, stored at `hosting-domains/{domain}`.
|
|
1728
|
+
* The normalized domain is the doc key — global uniqueness comes for free.
|
|
1729
|
+
* This doc is both the record AND the claim for the domain.
|
|
1730
|
+
*/
|
|
1731
|
+
export declare const HostingDomainSchema: z.ZodObject<{
|
|
1732
|
+
domain: z.ZodString;
|
|
1733
|
+
kind: z.ZodEnum<{
|
|
1734
|
+
apex: "apex";
|
|
1735
|
+
subdomain: "subdomain";
|
|
1736
|
+
}>;
|
|
1737
|
+
projectId: z.ZodString;
|
|
1738
|
+
ownerId: z.ZodString;
|
|
1739
|
+
status: z.ZodEnum<{
|
|
1740
|
+
active: "active";
|
|
1741
|
+
failed: "failed";
|
|
1742
|
+
pending: "pending";
|
|
1743
|
+
provisioning: "provisioning";
|
|
1744
|
+
verifying: "verifying";
|
|
1745
|
+
}>;
|
|
1746
|
+
dnsAuthId: z.ZodString;
|
|
1747
|
+
delegationTarget: z.ZodString;
|
|
1748
|
+
trafficTarget: z.ZodOptional<z.ZodString>;
|
|
1749
|
+
certId: z.ZodOptional<z.ZodString>;
|
|
1750
|
+
certMapEntryName: z.ZodOptional<z.ZodString>;
|
|
1751
|
+
httpRouteName: z.ZodOptional<z.ZodString>;
|
|
1752
|
+
createdAt: z.ZodNumber;
|
|
1753
|
+
pendingSince: z.ZodNumber;
|
|
1754
|
+
verifyingSince: z.ZodOptional<z.ZodNumber>;
|
|
1755
|
+
attemptId: z.ZodOptional<z.ZodString>;
|
|
1756
|
+
verifiedAt: z.ZodOptional<z.ZodNumber>;
|
|
1757
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1758
|
+
failedStep: z.ZodOptional<z.ZodEnum<{
|
|
1759
|
+
dns: "dns";
|
|
1760
|
+
https: "https";
|
|
1761
|
+
}>>;
|
|
1762
|
+
createdBy: z.ZodString;
|
|
1763
|
+
}, z.core.$strip>;
|
|
1764
|
+
export type HostingDomain = z.infer<typeof HostingDomainSchema>;
|
|
1765
|
+
export declare const AddDomainRequestSchema: z.ZodObject<{
|
|
1766
|
+
projectId: z.ZodString;
|
|
1767
|
+
domain: z.ZodString;
|
|
1768
|
+
}, z.core.$strip>;
|
|
1769
|
+
export type AddDomainRequest = z.infer<typeof AddDomainRequestSchema>;
|
|
1770
|
+
export declare const AddDomainResponseSchema: z.ZodObject<{
|
|
1771
|
+
domain: z.ZodString;
|
|
1772
|
+
kind: z.ZodEnum<{
|
|
1773
|
+
apex: "apex";
|
|
1774
|
+
subdomain: "subdomain";
|
|
1775
|
+
}>;
|
|
1776
|
+
records: z.ZodObject<{
|
|
1777
|
+
traffic: z.ZodObject<{
|
|
1778
|
+
recordType: z.ZodEnum<{
|
|
1779
|
+
A: "A";
|
|
1780
|
+
CNAME: "CNAME";
|
|
1781
|
+
}>;
|
|
1782
|
+
name: z.ZodString;
|
|
1783
|
+
value: z.ZodString;
|
|
1784
|
+
}, z.core.$strip>;
|
|
1785
|
+
validation: z.ZodObject<{
|
|
1786
|
+
recordType: z.ZodEnum<{
|
|
1787
|
+
A: "A";
|
|
1788
|
+
CNAME: "CNAME";
|
|
1789
|
+
}>;
|
|
1790
|
+
name: z.ZodString;
|
|
1791
|
+
value: z.ZodString;
|
|
1792
|
+
}, z.core.$strip>;
|
|
1793
|
+
}, z.core.$strip>;
|
|
1794
|
+
}, z.core.$strip>;
|
|
1795
|
+
export type AddDomainResponse = z.infer<typeof AddDomainResponseSchema>;
|
|
1796
|
+
export declare const VerifyDomainRequestSchema: z.ZodObject<{
|
|
1797
|
+
projectId: z.ZodString;
|
|
1798
|
+
domain: z.ZodString;
|
|
1799
|
+
}, z.core.$strip>;
|
|
1800
|
+
export type VerifyDomainRequest = z.infer<typeof VerifyDomainRequestSchema>;
|
|
1801
|
+
export declare const VerifyDomainResponseSchema: z.ZodObject<{
|
|
1802
|
+
status: z.ZodEnum<{
|
|
1803
|
+
active: "active";
|
|
1804
|
+
failed: "failed";
|
|
1805
|
+
pending: "pending";
|
|
1806
|
+
provisioning: "provisioning";
|
|
1807
|
+
verifying: "verifying";
|
|
1808
|
+
}>;
|
|
1809
|
+
}, z.core.$strip>;
|
|
1810
|
+
export type VerifyDomainResponse = z.infer<typeof VerifyDomainResponseSchema>;
|
|
1811
|
+
export declare const RemoveDomainRequestSchema: z.ZodObject<{
|
|
1812
|
+
projectId: z.ZodString;
|
|
1813
|
+
domain: z.ZodString;
|
|
1814
|
+
}, z.core.$strip>;
|
|
1815
|
+
export type RemoveDomainRequest = z.infer<typeof RemoveDomainRequestSchema>;
|
|
1816
|
+
export declare const RemoveDomainResponseSchema: z.ZodObject<{
|
|
1817
|
+
success: z.ZodLiteral<true>;
|
|
1818
|
+
}, z.core.$strip>;
|
|
1819
|
+
export type RemoveDomainResponse = z.infer<typeof RemoveDomainResponseSchema>;
|
|
1713
1820
|
export declare const CloneProjectOptionsSchema: z.ZodObject<{
|
|
1714
1821
|
sourceProjectId: z.ZodString;
|
|
1715
1822
|
sourceBranchName: z.ZodDefault<z.ZodString>;
|