@builder.io/ai-utils 0.84.0-dev.202607212345.137e4170f → 0.84.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.84.0-dev.202607212345.137e4170f",
3
+ "version": "0.84.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
package/src/events.d.ts CHANGED
@@ -1300,34 +1300,7 @@ export declare const McpPrototypePulledV1: {
1300
1300
  eventName: "mcp.prototype.pulled";
1301
1301
  version: "1";
1302
1302
  };
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;
1303
+ 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;
1331
1304
  export interface ModelPermissionRequiredEvent {
1332
1305
  type: "assistant.model.permission.required";
1333
1306
  data: {
package/src/events.js CHANGED
@@ -162,11 +162,3 @@ 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
- };
package/src/projects.d.ts CHANGED
@@ -1490,8 +1490,9 @@ export declare const ProjectHostingSchema: z.ZodObject<{
1490
1490
  uploading: "uploading";
1491
1491
  }>>;
1492
1492
  publishedCommit: z.ZodOptional<z.ZodString>;
1493
+ customDomain: z.ZodOptional<z.ZodString>;
1494
+ customDomainVerified: z.ZodOptional<z.ZodBoolean>;
1493
1495
  autoDeploy: z.ZodOptional<z.ZodBoolean>;
1494
- domainIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1495
1496
  }, z.core.$strip>;
1496
1497
  export type ProjectHosting = z.infer<typeof ProjectHostingSchema>;
1497
1498
  /**
@@ -1710,113 +1711,6 @@ export declare const GetDeploysResponseSchema: z.ZodObject<{
1710
1711
  }, z.core.$strip>>;
1711
1712
  }, z.core.$strip>;
1712
1713
  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>;
1820
1714
  export declare const CloneProjectOptionsSchema: z.ZodObject<{
1821
1715
  sourceProjectId: z.ZodString;
1822
1716
  sourceBranchName: z.ZodDefault<z.ZodString>;
package/src/projects.js CHANGED
@@ -324,13 +324,12 @@ export const ProjectHostingSchema = z.object({
324
324
  lastDeployStatus: DeployStatusSchema.optional(),
325
325
  /** Git commit currently live at the project's hosting URL (set on go-live). */
326
326
  publishedCommit: z.string().optional(),
327
+ customDomain: z.string().optional(),
328
+ customDomainVerified: z.boolean().optional(),
327
329
  autoDeploy: z
328
330
  .boolean()
329
331
  .optional()
330
332
  .meta({ description: "auto-deploy on push/merge" }),
331
- domainIds: z.array(z.string()).optional().meta({
332
- description: "Doc keys (normalized domains) in `hosting-domains` attached to this project. The domain docs are the source of truth; this is only the back-pointer.",
333
- }),
334
333
  });
335
334
  /**
336
335
  * Canonical "is this project hostable" predicate. Keys off the explicit
@@ -616,90 +615,6 @@ export const GetDeploysRequestSchema = z.object({
616
615
  export const GetDeploysResponseSchema = z.object({
617
616
  deploys: z.array(DeployListItemSchema),
618
617
  });
619
- export const HostingDomainStatusSchema = z.enum([
620
- "pending",
621
- "verifying",
622
- "provisioning",
623
- "active",
624
- "failed",
625
- ]);
626
- export const HostingDomainKindSchema = z.enum(["apex", "subdomain"]);
627
- /**
628
- * Custom domain record, stored at `hosting-domains/{domain}`.
629
- * The normalized domain is the doc key — global uniqueness comes for free.
630
- * This doc is both the record AND the claim for the domain.
631
- */
632
- export const HostingDomainSchema = z.object({
633
- domain: z
634
- .string()
635
- .meta({ description: "Doc key — normalized (punycode) domain." }),
636
- kind: HostingDomainKindSchema,
637
- projectId: z.string(),
638
- ownerId: z.string(),
639
- status: HostingDomainStatusSchema,
640
- dnsAuthId: z
641
- .string()
642
- .meta({ description: "GCP DNS authorization resource name." }),
643
- delegationTarget: z.string().meta({
644
- description: "_acme-challenge CNAME value the customer must add.",
645
- }),
646
- trafficTarget: z.string().optional().meta({
647
- description: "The traffic record value: ALB anycast IP for apex domains, `cname.builder.cloud` for subdomains. Persisted so the UI can reconstruct both DNS records after page reload.",
648
- }),
649
- certId: z
650
- .string()
651
- .optional()
652
- .meta({ description: "Certificate Manager cert resource name." }),
653
- certMapEntryName: z.string().optional(),
654
- httpRouteName: z.string().optional(),
655
- createdAt: z.number(),
656
- pendingSince: z.number().meta({
657
- description: "TTL anchor: set on entering `pending`, re-stamped on `failed`→`pending`.",
658
- }),
659
- verifyingSince: z.number().optional().meta({
660
- description: "Set when the delegation-check poll loop starts (on entering `verifying`). Used for the poll timeout and UI. Cleared on promotion to `provisioning` or on failure.",
661
- }),
662
- attemptId: z.string().optional().meta({
663
- description: "Per-verify-attempt nonce, set on entering `verifying`. Delegation-check polls whose attemptId no longer matches are stale (a newer retry superseded them) and stop early.",
664
- }),
665
- verifiedAt: z.number().optional(),
666
- error: z.string().optional(),
667
- failedStep: z.enum(["dns", "https"]).optional().meta({
668
- description: "Which setup step failed, set alongside `status: failed` so the UI can attribute the failure. `dns` = delegation verification, `https` = cert/route provisioning.",
669
- }),
670
- createdBy: z.string(),
671
- });
672
- export const AddDomainRequestSchema = z.object({
673
- projectId: z.string(),
674
- domain: z.string(),
675
- });
676
- const DnsRecordSchema = z.object({
677
- recordType: z.enum(["A", "CNAME"]),
678
- name: z.string(),
679
- value: z.string(),
680
- });
681
- export const AddDomainResponseSchema = z.object({
682
- domain: z.string(),
683
- kind: HostingDomainKindSchema,
684
- records: z.object({
685
- traffic: DnsRecordSchema,
686
- validation: DnsRecordSchema,
687
- }),
688
- });
689
- export const VerifyDomainRequestSchema = z.object({
690
- projectId: z.string(),
691
- domain: z.string(),
692
- });
693
- export const VerifyDomainResponseSchema = z.object({
694
- status: HostingDomainStatusSchema,
695
- });
696
- export const RemoveDomainRequestSchema = z.object({
697
- projectId: z.string(),
698
- domain: z.string(),
699
- });
700
- export const RemoveDomainResponseSchema = z.object({
701
- success: z.literal(true),
702
- });
703
618
  export const CloneProjectOptionsSchema = z.object({
704
619
  sourceProjectId: z.string().min(1).meta({
705
620
  description: "Project to clone from.",
@@ -1,88 +0,0 @@
1
- import { z } from "zod";
2
- export declare const PermissionSchema: z.ZodEnum<{
3
- list: "list";
4
- read: "read";
5
- write: "write";
6
- }>;
7
- export type Permission = z.infer<typeof PermissionSchema>;
8
- export declare const AclEntrySchema: z.ZodObject<{
9
- action: z.ZodEnum<{
10
- allow: "allow";
11
- deny: "deny";
12
- }>;
13
- resource: z.ZodString;
14
- permissions: z.ZodArray<z.ZodEnum<{
15
- list: "list";
16
- read: "read";
17
- write: "write";
18
- }>>;
19
- description: z.ZodOptional<z.ZodString>;
20
- principals: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
- }, z.core.$strip>;
22
- export type AclEntry = z.infer<typeof AclEntrySchema>;
23
- export declare const AclPolicySchema: z.ZodObject<{
24
- secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
- entries: z.ZodOptional<z.ZodArray<z.ZodObject<{
26
- action: z.ZodEnum<{
27
- allow: "allow";
28
- deny: "deny";
29
- }>;
30
- resource: z.ZodString;
31
- permissions: z.ZodArray<z.ZodEnum<{
32
- list: "list";
33
- read: "read";
34
- write: "write";
35
- }>>;
36
- description: z.ZodOptional<z.ZodString>;
37
- principals: z.ZodOptional<z.ZodArray<z.ZodString>>;
38
- }, z.core.$strip>>>;
39
- denyDescription: z.ZodOptional<z.ZodString>;
40
- }, z.core.$strip>;
41
- export type AclPolicy = z.infer<typeof AclPolicySchema>;
42
- export declare const AclDenialSchema: z.ZodObject<{
43
- kind: z.ZodEnum<{
44
- "command-allowlist": "command-allowlist";
45
- "command-security": "command-security";
46
- "file-access": "file-access";
47
- }>;
48
- reason: z.ZodEnum<{
49
- "deny-pattern-matched": "deny-pattern-matched";
50
- "no-allow-match": "no-allow-match";
51
- "security-policy": "security-policy";
52
- "shell-metacharacter": "shell-metacharacter";
53
- }>;
54
- resource: z.ZodString;
55
- command: z.ZodOptional<z.ZodString>;
56
- permission: z.ZodOptional<z.ZodEnum<{
57
- list: "list";
58
- read: "read";
59
- write: "write";
60
- }>>;
61
- policy: z.ZodOptional<z.ZodString>;
62
- matchedPattern: z.ZodOptional<z.ZodString>;
63
- matchedEntry: z.ZodOptional<z.ZodObject<{
64
- action: z.ZodEnum<{
65
- allow: "allow";
66
- deny: "deny";
67
- }>;
68
- resource: z.ZodString;
69
- permissions: z.ZodArray<z.ZodEnum<{
70
- list: "list";
71
- read: "read";
72
- write: "write";
73
- }>>;
74
- description: z.ZodOptional<z.ZodString>;
75
- principals: z.ZodOptional<z.ZodArray<z.ZodString>>;
76
- }, z.core.$strip>>;
77
- message: z.ZodString;
78
- }, z.core.$strip>;
79
- export type AclDenial = z.infer<typeof AclDenialSchema>;
80
- export interface AccessResult {
81
- allowed: boolean;
82
- message: string;
83
- matchedEntry?: AclEntry;
84
- matchedPattern?: string;
85
- reason?: "deny-pattern-matched" | "no-allow-match";
86
- requestedResource?: string;
87
- requestedPermission?: Permission;
88
- }
package/src/acl-schema.js DELETED
@@ -1,71 +0,0 @@
1
- import { z } from "zod";
2
- export const PermissionSchema = z
3
- .enum(["read", "write", "list"])
4
- .meta({ title: "Permission" });
5
- // One ACL rule
6
- export const AclEntrySchema = z
7
- .object({
8
- action: z
9
- .enum(["allow", "deny"])
10
- .meta({ description: "whether this rule allows or denies access" }),
11
- resource: z
12
- .string()
13
- .meta({ description: "what — supports glob patterns like /files/*.txt" }),
14
- permissions: z
15
- .array(PermissionSchema)
16
- .meta({ description: "actions this rule applies to" }),
17
- description: z.string().optional().meta({
18
- description: "custom message, in deny case, this is the error message. This will override denyDescription on AclPolicy if defined.",
19
- }),
20
- principals: z.array(z.string()).optional().meta({
21
- description: "array of teams/roles this rule applies to (e.g., ['developer', 'admin'])",
22
- }),
23
- })
24
- .meta({ title: "AclEntry" });
25
- // A full ACL policy is just a list of rules
26
- export const AclPolicySchema = z
27
- .object({
28
- secrets: z.array(z.string()).optional(),
29
- entries: z.array(AclEntrySchema).optional(),
30
- denyDescription: z.string().optional().meta({
31
- description: "Default message to use when a resource is denied access",
32
- }),
33
- })
34
- .meta({ title: "AclPolicy" });
35
- // Structured description of an ACL/policy denial. Travels with the tool result
36
- // so internal tools can show admins exactly which rule blocked a command/file,
37
- // and both UIs can render a distinct "blocked, did not run" treatment.
38
- export const AclDenialSchema = z
39
- .object({
40
- kind: z
41
- .enum(["command-security", "command-allowlist", "file-access"])
42
- .meta({ description: "which gate produced the denial" }),
43
- reason: z
44
- .enum([
45
- "security-policy",
46
- "deny-pattern-matched",
47
- "no-allow-match",
48
- "shell-metacharacter",
49
- ])
50
- .meta({ description: "why the denial happened" }),
51
- resource: z.string().meta({
52
- description: "the file path or command that was blocked",
53
- }),
54
- command: z.string().optional().meta({
55
- description: "the full command, when the denial is command-related",
56
- }),
57
- permission: PermissionSchema.optional().meta({
58
- description: "the requested permission, for file-access denials",
59
- }),
60
- policy: z.string().optional().meta({
61
- description: "named security policy that matched, when applicable",
62
- }),
63
- matchedPattern: z.string().optional().meta({
64
- description: "the glob/pattern that matched the resource or command",
65
- }),
66
- matchedEntry: AclEntrySchema.optional().meta({
67
- description: "the full ACL entry that matched, for file-access denials",
68
- }),
69
- message: z.string().meta({ description: "human-readable explanation" }),
70
- })
71
- .meta({ title: "AclDenial" });
@@ -1,116 +0,0 @@
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;
@@ -1,122 +0,0 @@
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
- }
@@ -1,49 +0,0 @@
1
- /** Fields common to all VPC connectivity types. */
2
- interface VpcConnectionBase {
3
- id: string;
4
- ownerId: string;
5
- type: string;
6
- gcpRegion: string;
7
- customerDnsServers: string[];
8
- proxyIp: string;
9
- enabled: boolean;
10
- createdAt: number;
11
- updatedAt: number;
12
- }
13
- /** Traditional VPC Peering via bridge VPC. */
14
- export interface VpcGcpPeering extends VpcConnectionBase {
15
- type: "gcp-peering";
16
- gcpProjectId: string;
17
- gcpNetworkName: string;
18
- bridgeCidr: string;
19
- importCustomRoutes: boolean;
20
- }
21
- /**
22
- * PSC Network Attachment — customer creates the network attachment in their VPC,
23
- * our proxy VM connects to it via a PSC interface on nic1.
24
- * No bridge VPC or bridge CIDR needed on our side.
25
- */
26
- export interface VpcGcpNetworkAttachment extends VpcConnectionBase {
27
- type: "gcp-network-attachment";
28
- gcpProjectId: string;
29
- networkAttachmentName: string;
30
- }
31
- /** Discriminated union of all VPC connectivity types. */
32
- export type VpcPeering = VpcGcpPeering | VpcGcpNetworkAttachment;
33
- export interface CreateVpcGcpPeeringParams {
34
- type: "gcp-peering";
35
- gcpRegion: string;
36
- gcpProjectId: string;
37
- gcpNetworkName: string;
38
- bridgeCidr: string;
39
- customerDnsServers: string[];
40
- importCustomRoutes?: boolean;
41
- }
42
- export interface CreateVpcGcpNetworkAttachmentParams {
43
- type: "gcp-network-attachment";
44
- gcpProjectId: string;
45
- networkAttachmentName: string;
46
- customerDnsServers: string[];
47
- }
48
- export type CreateVpcPeeringParams = CreateVpcGcpPeeringParams | CreateVpcGcpNetworkAttachmentParams;
49
- export {};
@@ -1 +0,0 @@
1
- export {};