@builder.io/ai-utils 0.85.0 → 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",
3
+ "version": "0.85.1",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
package/src/events.d.ts CHANGED
@@ -598,6 +598,8 @@ export type BotMentionGitHubInternalPrV1 = FusionEventVariant<"bot.mention.githu
598
598
  /** Numeric GitHub comment ID (for reaction / reply threading) */
599
599
  commentNumericId?: number;
600
600
  commentType: "issue" | "pr";
601
+ /** Whether the normal bot-mention pipeline should post successful agent text. */
602
+ postSuccessResultComment?: boolean;
601
603
  /** GitHub Enterprise hostname, if applicable */
602
604
  hostname?: string;
603
605
  /** For review comments: the comment being replied to */
@@ -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 {
@@ -1491,6 +1555,14 @@ export declare const ProjectHostingSchema: z.ZodObject<{
1491
1555
  }>>;
1492
1556
  publishedCommit: z.ZodOptional<z.ZodString>;
1493
1557
  autoDeploy: z.ZodOptional<z.ZodBoolean>;
1558
+ unpublishTrigger: z.ZodOptional<z.ZodEnum<{
1559
+ system: "system";
1560
+ user: "user";
1561
+ }>>;
1562
+ systemUnpublishReason: z.ZodOptional<z.ZodEnum<{
1563
+ "bandwidth-cap": "bandwidth-cap";
1564
+ "web-request-cap": "web-request-cap";
1565
+ }>>;
1494
1566
  domainIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1495
1567
  }, z.core.$strip>;
1496
1568
  export type ProjectHosting = z.infer<typeof ProjectHostingSchema>;
@@ -1549,6 +1621,36 @@ export declare const HostingSlugSchema: z.ZodObject<{
1549
1621
  createdBy: z.ZodString;
1550
1622
  }, z.core.$strip>;
1551
1623
  export type HostingSlug = z.infer<typeof HostingSlugSchema>;
1624
+ /**
1625
+ * Per-Neon-project charged-through watermarks inside a space's hosting usage
1626
+ * snapshot. Storage folds root + child branch bytes-month into one field.
1627
+ */
1628
+ export declare const HostingNeonProjectUsageSchema: z.ZodObject<{
1629
+ computeUnitSecondsChargedThrough: z.ZodNumber;
1630
+ storageBytesMonthChargedThrough: z.ZodNumber;
1631
+ transferBytesChargedThrough: z.ZodNumber;
1632
+ }, z.core.$strip>;
1633
+ export type HostingNeonProjectUsage = z.infer<typeof HostingNeonProjectUsageSchema>;
1634
+ /**
1635
+ * Reconciler idempotency watermark for a space's Netlify + Neon hosting costs,
1636
+ * stored at `hostingUsageSnapshots/{spaceId}`. Netlify is one account-level
1637
+ * scalar; Neon is a per-project map. `freeDeployCount` gates the free 5/mo
1638
+ * deploy cap (cost itself is inside Netlify's partner_account_usage total).
1639
+ */
1640
+ export declare const HostingUsageSnapshotSchema: z.ZodObject<{
1641
+ ownerId: z.ZodString;
1642
+ periodKey: z.ZodString;
1643
+ netlifyConsumptionCycleStart: z.ZodString;
1644
+ netlifyCreditsChargedThrough: z.ZodNumber;
1645
+ neonByProject: z.ZodRecord<z.ZodString, z.ZodObject<{
1646
+ computeUnitSecondsChargedThrough: z.ZodNumber;
1647
+ storageBytesMonthChargedThrough: z.ZodNumber;
1648
+ transferBytesChargedThrough: z.ZodNumber;
1649
+ }, z.core.$strip>>;
1650
+ freeDeployCount: z.ZodNumber;
1651
+ updatedAt: z.ZodNumber;
1652
+ }, z.core.$strip>;
1653
+ export type HostingUsageSnapshot = z.infer<typeof HostingUsageSnapshotSchema>;
1552
1654
  /**
1553
1655
  * Deploy lease lock with fencing token, stored at
1554
1656
  * `hosting-locks/{projectId}__{checkoutBranch}` (the key uses the resolved ref
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
  /**
@@ -328,6 +413,26 @@ export const ProjectHostingSchema = z.object({
328
413
  .boolean()
329
414
  .optional()
330
415
  .meta({ description: "auto-deploy on push/merge" }),
416
+ /**
417
+ * Who last drove the site into `publishStatus: "unpublished"`. Absent is
418
+ * treated as `"user"`. `"system"` means free-tier usage-cap enforcement took
419
+ * the site down (deleted the HTTPRoute, kept the Netlify site) and the
420
+ * reconciler **may** auto-restore it — routing-only, no rebuild — once the cap
421
+ * clears. `"user"` (or absent) means the user unpublished, so the reconciler
422
+ * must leave it down. The publish/unpublish hosting lock keeps this honest:
423
+ * whichever operation wins the lock is the one that writes `publishStatus`
424
+ * and this field, so they never disagree.
425
+ */
426
+ unpublishTrigger: z.enum(["system", "user"]).optional().meta({
427
+ description: "Who last unpublished the site. Absent === user. 'system' lets the reconciler auto-restore a usage-cap takedown; 'user' does not.",
428
+ }),
429
+ /**
430
+ * Why the system unpublished the site. Set iff `unpublishTrigger === "system"`;
431
+ * drives the projects-grid "suspended" card and takedown observability.
432
+ */
433
+ systemUnpublishReason: z
434
+ .enum(["bandwidth-cap", "web-request-cap"])
435
+ .optional(),
331
436
  domainIds: z.array(z.string()).optional().meta({
332
437
  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
438
  }),
@@ -411,6 +516,42 @@ export const HostingSlugSchema = z.object({
411
516
  description: "user ID of the user who first clicked Publish on the project",
412
517
  }),
413
518
  });
519
+ /**
520
+ * Per-Neon-project charged-through watermarks inside a space's hosting usage
521
+ * snapshot. Storage folds root + child branch bytes-month into one field.
522
+ */
523
+ export const HostingNeonProjectUsageSchema = z.object({
524
+ computeUnitSecondsChargedThrough: z.number(),
525
+ storageBytesMonthChargedThrough: z.number().meta({
526
+ description: "root + child branch bytes-month already billed",
527
+ }),
528
+ transferBytesChargedThrough: z.number().meta({
529
+ description: "public network transfer bytes already billed",
530
+ }),
531
+ });
532
+ /**
533
+ * Reconciler idempotency watermark for a space's Netlify + Neon hosting costs,
534
+ * stored at `hostingUsageSnapshots/{spaceId}`. Netlify is one account-level
535
+ * scalar; Neon is a per-project map. `freeDeployCount` gates the free 5/mo
536
+ * deploy cap (cost itself is inside Netlify's partner_account_usage total).
537
+ */
538
+ export const HostingUsageSnapshotSchema = z.object({
539
+ ownerId: z.string(),
540
+ periodKey: z.string().meta({
541
+ description: "Builder billing cycle; resets the Neon watermarks",
542
+ }),
543
+ netlifyConsumptionCycleStart: z.string().meta({
544
+ description: "Netlify consumption_cycle_start_date; watermark resets when this advances",
545
+ }),
546
+ netlifyCreditsChargedThrough: z.number().meta({
547
+ description: "Netlify credits already billed this Netlify cycle",
548
+ }),
549
+ neonByProject: z.record(z.string(), HostingNeonProjectUsageSchema),
550
+ freeDeployCount: z.number().meta({
551
+ description: "Deploys this Builder cycle, for the free 5/mo cap",
552
+ }),
553
+ updatedAt: z.number(),
554
+ });
414
555
  /**
415
556
  * Deploy lease lock with fencing token, stored at
416
557
  * `hosting-locks/{projectId}__{checkoutBranch}` (the key uses the resolved ref