@builder.io/ai-utils 0.85.0-dev.202607231533.14c8ab346 → 0.85.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.85.0-dev.202607231533.14c8ab346",
3
+ "version": "0.85.1",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
@@ -450,6 +450,7 @@ interface Role {
450
450
  export interface Organization {
451
451
  name?: string;
452
452
  id?: string;
453
+ "@originId"?: string;
453
454
  createdDate?: number;
454
455
  intent?: string;
455
456
  ecommerceBackend?: string;
package/src/projects.d.ts CHANGED
@@ -628,6 +628,70 @@ export interface NewBranch extends BranchSharedData, RequiredBranchSharedData {
628
628
  */
629
629
  export type Branch = NewBranch | LegacyBranch;
630
630
  export declare const checkIsNewBranch: (branch: Branch) => branch is NewBranch;
631
+ /**
632
+ * Request options for `GET /projects/branches/list`. Owner/org scope comes from
633
+ * the authenticated request context; `ownerId` here is a superuser-only override.
634
+ */
635
+ export declare const ListBranchesOptionsSchema: z.ZodObject<{
636
+ projectId: z.ZodOptional<z.ZodString>;
637
+ projectIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
638
+ kanbanColumn: z.ZodOptional<z.ZodEnum<{
639
+ archived: "archived";
640
+ "awaiting-feedback": "awaiting-feedback";
641
+ "in-progress": "in-progress";
642
+ "in-review": "in-review";
643
+ merged: "merged";
644
+ }>>;
645
+ states: z.ZodOptional<z.ZodArray<z.ZodEnum<{
646
+ active: "active";
647
+ archived: "archived";
648
+ deleted: "deleted";
649
+ }>>>;
650
+ includeHidden: z.ZodOptional<z.ZodBoolean>;
651
+ search: z.ZodOptional<z.ZodString>;
652
+ category: z.ZodOptional<z.ZodArray<z.ZodEnum<{
653
+ feature: "feature";
654
+ fix: "fix";
655
+ other: "other";
656
+ research: "research";
657
+ }>>>;
658
+ prStatus: z.ZodOptional<z.ZodArray<z.ZodEnum<{
659
+ closed: "closed";
660
+ draft: "draft";
661
+ merged: "merged";
662
+ none: "none";
663
+ open: "open";
664
+ }>>>;
665
+ createdBy: z.ZodOptional<z.ZodString>;
666
+ assignedTo: z.ZodOptional<z.ZodString>;
667
+ notYetReviewed: z.ZodOptional<z.ZodBoolean>;
668
+ showOnlyRepoConnected: z.ZodOptional<z.ZodBoolean>;
669
+ sortBy: z.ZodOptional<z.ZodEnum<{
670
+ alphabetical: "alphabetical";
671
+ dateCreated: "dateCreated";
672
+ recentlyUpdated: "recentlyUpdated";
673
+ }>>;
674
+ sortByLastActivity: z.ZodOptional<z.ZodBoolean>;
675
+ sortDirection: z.ZodOptional<z.ZodEnum<{
676
+ asc: "asc";
677
+ desc: "desc";
678
+ }>>;
679
+ limit: z.ZodOptional<z.ZodNumber>;
680
+ cursor: z.ZodOptional<z.ZodString>;
681
+ ownerId: z.ZodOptional<z.ZodString>;
682
+ }, z.core.$strip>;
683
+ export type ListBranchesOptions = z.infer<typeof ListBranchesOptionsSchema>;
684
+ /** Response body for the paginated branches list endpoint. */
685
+ export interface ListBranchesResult {
686
+ branches: Branch[];
687
+ /** Opaque cursor to pass as `cursor` for the next page, or null when there is no next page. */
688
+ nextCursor: string | null;
689
+ hasNextPage: boolean;
690
+ /** Total number of branches matching the filters, across all pages. */
691
+ totalCount: number;
692
+ /** True when `totalCount` comes from the eventually-consistent Mongo index, so it may lag reality slightly. */
693
+ totalCountIsApproximate?: boolean;
694
+ }
631
695
  export type CpuKind = "performance" | "standard" | "shared";
632
696
  export type MachineAutoStop = "stop" | "off" | "suspend";
633
697
  export interface ProjectRolePermissions {
@@ -1809,8 +1873,6 @@ export declare const HostingDomainSchema: z.ZodObject<{
1809
1873
  dns: "dns";
1810
1874
  https: "https";
1811
1875
  }>>;
1812
- routeError: z.ZodOptional<z.ZodString>;
1813
- routeErrorAt: z.ZodOptional<z.ZodNumber>;
1814
1876
  createdBy: z.ZodString;
1815
1877
  }, z.core.$strip>;
1816
1878
  export type HostingDomain = z.infer<typeof HostingDomainSchema>;
@@ -1869,22 +1931,6 @@ export declare const RemoveDomainResponseSchema: z.ZodObject<{
1869
1931
  success: z.ZodLiteral<true>;
1870
1932
  }, z.core.$strip>;
1871
1933
  export type RemoveDomainResponse = z.infer<typeof RemoveDomainResponseSchema>;
1872
- export declare const RepairDomainRequestSchema: z.ZodObject<{
1873
- projectId: z.ZodString;
1874
- domain: z.ZodString;
1875
- }, z.core.$strip>;
1876
- export type RepairDomainRequest = z.infer<typeof RepairDomainRequestSchema>;
1877
- export declare const RepairDomainResponseSchema: z.ZodObject<{
1878
- status: z.ZodEnum<{
1879
- active: "active";
1880
- failed: "failed";
1881
- pending: "pending";
1882
- provisioning: "provisioning";
1883
- verifying: "verifying";
1884
- }>;
1885
- routeError: z.ZodOptional<z.ZodString>;
1886
- }, z.core.$strip>;
1887
- export type RepairDomainResponse = z.infer<typeof RepairDomainResponseSchema>;
1888
1934
  export declare const CloneProjectOptionsSchema: z.ZodObject<{
1889
1935
  sourceProjectId: z.ZodString;
1890
1936
  sourceBranchName: z.ZodDefault<z.ZodString>;
package/src/projects.js CHANGED
@@ -49,6 +49,91 @@ export const EXAMPLE_OR_STARTER_REPOS_URLS = EXAMPLE_OR_STARTER_REPOS.map((repo)
49
49
  export const checkIsNewBranch = (branch) => {
50
50
  return "projectId" in branch;
51
51
  };
52
+ /**
53
+ * Request options for `GET /projects/branches/list`. Owner/org scope comes from
54
+ * the authenticated request context; `ownerId` here is a superuser-only override.
55
+ */
56
+ export const ListBranchesOptionsSchema = z.object({
57
+ projectId: z.string().optional().meta({
58
+ description: "Filter to a single project. Omit to list all branches in the owner's org.",
59
+ }),
60
+ projectIds: z.array(z.string()).optional().meta({
61
+ description: "Filter to any of these projects, unioned with projectId.",
62
+ }),
63
+ kanbanColumn: z
64
+ .enum([
65
+ "in-progress",
66
+ "in-review",
67
+ "awaiting-feedback",
68
+ "merged",
69
+ "archived",
70
+ ])
71
+ .optional()
72
+ .meta({
73
+ description: "Kanban column to scope to. Derives column membership from state, PR url/status and reviewers, and overrides `states`.",
74
+ }),
75
+ states: z
76
+ .array(z.enum(["active", "deleted", "archived"]))
77
+ .optional()
78
+ .meta({
79
+ description: 'Lifecycle states to include. Defaults to ["active"]. Ignored when kanbanColumn is set.',
80
+ }),
81
+ includeHidden: z.boolean().optional().meta({
82
+ description: "Superuser-only; superusers see hidden branches by default and pass false to opt out. Ignored for non-superusers.",
83
+ }),
84
+ search: z.string().optional().meta({
85
+ description: "Case-insensitive substring match over friendlyName, name and description.",
86
+ }),
87
+ category: z
88
+ .array(z.enum(["feature", "fix", "research", "other"]))
89
+ .optional()
90
+ .meta({ description: "Filter by auto-assigned work category." }),
91
+ prStatus: z
92
+ .array(z.enum(["open", "draft", "merged", "closed", "none"]))
93
+ .optional()
94
+ .meta({
95
+ description: "Filter by derived PR status (none = no PR opened yet).",
96
+ }),
97
+ createdBy: z
98
+ .string()
99
+ .optional()
100
+ .meta({ description: "Only branches created by this user id." }),
101
+ assignedTo: z
102
+ .string()
103
+ .optional()
104
+ .meta({ description: "Only branches where this user id is a reviewer." }),
105
+ notYetReviewed: z.boolean().optional().meta({
106
+ description: "With assignedTo, exclude branches whose reviews already contain that user.",
107
+ }),
108
+ showOnlyRepoConnected: z.boolean().optional().meta({
109
+ description: "Exclude the default main branch and commit-mode branches.",
110
+ }),
111
+ sortBy: z
112
+ .enum(["recentlyUpdated", "alphabetical", "dateCreated"])
113
+ .optional()
114
+ .meta({
115
+ description: "Sort key. recentlyUpdated (default) sorts by lastUpdatedAt.",
116
+ }),
117
+ sortByLastActivity: z.boolean().optional().meta({
118
+ description: "When true, recentlyUpdated keys off lastActivityAt (falling back to lastUpdatedAt). Ignored for other sort keys.",
119
+ }),
120
+ sortDirection: z.enum(["asc", "desc"]).optional().meta({
121
+ description: "Defaults to desc for date sorts, asc for alphabetical.",
122
+ }),
123
+ limit: z
124
+ .number()
125
+ .int()
126
+ .min(1)
127
+ .max(200)
128
+ .optional()
129
+ .meta({ description: "Page size, clamped to 1–200. Defaults to 50." }),
130
+ cursor: z.string().optional().meta({
131
+ description: "Opaque pagination cursor from a prior response's nextCursor.",
132
+ }),
133
+ ownerId: z.string().optional().meta({
134
+ description: "Superuser-only: list branches for a different owner/org.",
135
+ }),
136
+ });
52
137
  /** Grace period before scheduled Neon deletions run (reconciler + schedule APIs). */
53
138
  export const NEON_DELETION_GRACE_PERIOD_MS = 30 * 24 * 60 * 60 * 1000;
54
139
  /**
@@ -735,12 +820,6 @@ export const HostingDomainSchema = z.object({
735
820
  failedStep: z.enum(["dns", "https"]).optional().meta({
736
821
  description: "Which setup step failed, set alongside `status: failed` so the UI can attribute the failure. `dns` = delegation verification, `https` = cert/route provisioning.",
737
822
  }),
738
- routeError: z.string().optional().meta({
739
- description: "Non-fatal health signal on an otherwise verified (`provisioning`/`active`) domain: set when re-creating the Envoy HTTPRoute failed on republish, so the site's cert is valid but the custom domain has no live route (bare 404). `status` stays `active`; this drives a degraded banner + Fix action. Cleared once the route is recreated.",
740
- }),
741
- routeErrorAt: z.number().optional().meta({
742
- description: "When `routeError` was last set.",
743
- }),
744
823
  createdBy: z.string(),
745
824
  });
746
825
  export const AddDomainRequestSchema = z.object({
@@ -774,14 +853,6 @@ export const RemoveDomainRequestSchema = z.object({
774
853
  export const RemoveDomainResponseSchema = z.object({
775
854
  success: z.literal(true),
776
855
  });
777
- export const RepairDomainRequestSchema = z.object({
778
- projectId: z.string(),
779
- domain: z.string(),
780
- });
781
- export const RepairDomainResponseSchema = z.object({
782
- status: HostingDomainStatusSchema,
783
- routeError: z.string().optional(),
784
- });
785
856
  export const CloneProjectOptionsSchema = z.object({
786
857
  sourceProjectId: z.string().min(1).meta({
787
858
  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,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 {};