@builder.io/ai-utils 0.67.0 → 0.69.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 +1 -1
- package/src/builder-config.d.ts +28 -0
- package/src/builder-config.js +22 -0
- package/src/codegen.d.ts +1 -1
- package/src/design-systems.d.ts +10 -1
- package/src/design-systems.js +11 -0
- package/src/events.d.ts +176 -4
- package/src/events.js +17 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/organization.d.ts +1 -0
- package/src/projects.d.ts +126 -9
- package/src/projects.js +71 -10
package/package.json
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Server-side view of the on-disk `builder.config.json` file, scoped to the
|
|
4
|
+
* fields the backend provisioning read path cares about (currently just
|
|
5
|
+
* `database`).
|
|
6
|
+
*
|
|
7
|
+
* This is intentionally a separate, parallel model from {@link FusionConfig}
|
|
8
|
+
* (codegen.ts), which is the dev-tools CLI's full view of the same file
|
|
9
|
+
* (parsed there as `Partial<FusionConfig>`). The two are different consumers:
|
|
10
|
+
* dev-tools owns launch/runtime config; this schema owns the server's
|
|
11
|
+
* database-provisioning read. `FusionConfig` has no `database` field, so this
|
|
12
|
+
* is additive rather than duplicative — keep new server-only config fields
|
|
13
|
+
* here and dev-tools/runtime fields on `FusionConfig`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const BuilderConfigDatabaseSchema: z.ZodObject<{
|
|
16
|
+
kind: z.ZodLiteral<"postgres">;
|
|
17
|
+
migrations: z.ZodLiteral<"drizzle">;
|
|
18
|
+
schemaDir: z.ZodDefault<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type BuilderConfigDatabase = z.infer<typeof BuilderConfigDatabaseSchema>;
|
|
21
|
+
export declare const BuilderConfigSchema: z.ZodObject<{
|
|
22
|
+
database: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
kind: z.ZodLiteral<"postgres">;
|
|
24
|
+
migrations: z.ZodLiteral<"drizzle">;
|
|
25
|
+
schemaDir: z.ZodDefault<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type BuilderConfig = z.infer<typeof BuilderConfigSchema>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Server-side view of the on-disk `builder.config.json` file, scoped to the
|
|
4
|
+
* fields the backend provisioning read path cares about (currently just
|
|
5
|
+
* `database`).
|
|
6
|
+
*
|
|
7
|
+
* This is intentionally a separate, parallel model from {@link FusionConfig}
|
|
8
|
+
* (codegen.ts), which is the dev-tools CLI's full view of the same file
|
|
9
|
+
* (parsed there as `Partial<FusionConfig>`). The two are different consumers:
|
|
10
|
+
* dev-tools owns launch/runtime config; this schema owns the server's
|
|
11
|
+
* database-provisioning read. `FusionConfig` has no `database` field, so this
|
|
12
|
+
* is additive rather than duplicative — keep new server-only config fields
|
|
13
|
+
* here and dev-tools/runtime fields on `FusionConfig`.
|
|
14
|
+
*/
|
|
15
|
+
export const BuilderConfigDatabaseSchema = z.object({
|
|
16
|
+
kind: z.literal("postgres"),
|
|
17
|
+
migrations: z.literal("drizzle"),
|
|
18
|
+
schemaDir: z.string().default("drizzle"),
|
|
19
|
+
});
|
|
20
|
+
export const BuilderConfigSchema = z.object({
|
|
21
|
+
database: BuilderConfigDatabaseSchema.optional(),
|
|
22
|
+
});
|
package/src/codegen.d.ts
CHANGED
|
@@ -3993,7 +3993,7 @@ export interface FusionConfig {
|
|
|
3993
3993
|
/** Whether this branch is for a code review - affects enabled agents and tools */
|
|
3994
3994
|
branchType?: BranchType;
|
|
3995
3995
|
/**
|
|
3996
|
-
* When set, launch.ts hydrates `.builder/
|
|
3996
|
+
* When set, launch.ts hydrates `.builder/sources/<...>` from the corresponding
|
|
3997
3997
|
* GCS frame manifest before the agent starts. Only used on
|
|
3998
3998
|
* `branchType === "design-system-indexing"` branches.
|
|
3999
3999
|
*/
|
package/src/design-systems.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export interface FigmaHydrationFile {
|
|
3
|
-
/** Relative path to write under `.builder/
|
|
3
|
+
/** Relative path to write under `.builder/sources/`. */
|
|
4
4
|
localPath: string;
|
|
5
5
|
downloadUrl: string;
|
|
6
6
|
contentType: string;
|
|
@@ -24,7 +24,14 @@ export interface GenerateDesignSystemFormFields {
|
|
|
24
24
|
* GUIDs are file-local, so they must be scoped per attachment.
|
|
25
25
|
*/
|
|
26
26
|
selection?: Record<string, string[]>;
|
|
27
|
+
githubRepoUrl?: string;
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Accepts `https://github.com/<owner>/<repo>` (optionally with a trailing
|
|
31
|
+
* `.git` or path segments). Used to gate the public-repo input on the
|
|
32
|
+
* `/design-systems/v1/generate` endpoint.
|
|
33
|
+
*/
|
|
34
|
+
export declare const GITHUB_REPO_URL_REGEX: RegExp;
|
|
28
35
|
export interface GenerateDesignSystemRequest extends GenerateDesignSystemFormFields {
|
|
29
36
|
/**
|
|
30
37
|
* Mixed list of uploaded files in any order. Sent as repeated
|
|
@@ -41,6 +48,7 @@ export interface GenerateDesignSystemResponse {
|
|
|
41
48
|
* resolved `branchName` / `branchUrl`.
|
|
42
49
|
*/
|
|
43
50
|
jobId: string;
|
|
51
|
+
designSystemId: string;
|
|
44
52
|
}
|
|
45
53
|
export interface GenerateDesignSystemErrorResponse {
|
|
46
54
|
error: string | Record<string, unknown>;
|
|
@@ -59,5 +67,6 @@ export declare const generateDesignSystemBodySchema: z.ZodObject<{
|
|
|
59
67
|
projectName: z.ZodOptional<z.ZodString>;
|
|
60
68
|
devToolsVersion: z.ZodOptional<z.ZodString>;
|
|
61
69
|
selection: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>>;
|
|
70
|
+
githubRepoUrl: z.ZodOptional<z.ZodString>;
|
|
62
71
|
}, z.core.$strip>;
|
|
63
72
|
export type GenerateDesignSystemBody = z.infer<typeof generateDesignSystemBodySchema>;
|
package/src/design-systems.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Accepts `https://github.com/<owner>/<repo>` (optionally with a trailing
|
|
4
|
+
* `.git` or path segments). Used to gate the public-repo input on the
|
|
5
|
+
* `/design-systems/v1/generate` endpoint.
|
|
6
|
+
*/
|
|
7
|
+
export const GITHUB_REPO_URL_REGEX = /^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?:\.git)?\/?$/;
|
|
2
8
|
export const GENERATE_DESIGN_SYSTEM_MAX_FILE_BYTES = 2 * 1024 * 1024 * 1024;
|
|
3
9
|
export const GENERATE_DESIGN_SYSTEM_MAX_ATTACHMENTS = 50;
|
|
4
10
|
export const GENERATE_DESIGN_SYSTEM_MIN_ATTACHMENTS = 1;
|
|
@@ -27,4 +33,9 @@ export const generateDesignSystemBodySchema = z.object({
|
|
|
27
33
|
}
|
|
28
34
|
}, z.record(z.string(), z.array(z.string().min(1)).max(10000)))
|
|
29
35
|
.optional(),
|
|
36
|
+
githubRepoUrl: z
|
|
37
|
+
.string()
|
|
38
|
+
.trim()
|
|
39
|
+
.regex(GITHUB_REPO_URL_REGEX, "must be a public github.com repo URL")
|
|
40
|
+
.optional(),
|
|
30
41
|
});
|
package/src/events.d.ts
CHANGED
|
@@ -528,7 +528,7 @@ export declare const ReviewSubmittedV1: {
|
|
|
528
528
|
eventName: "review.submitted";
|
|
529
529
|
version: "1";
|
|
530
530
|
};
|
|
531
|
-
export type
|
|
531
|
+
export type BotMentionGitHubExternalPrV1 = FusionEventVariant<"bot.mention.external-pr", {
|
|
532
532
|
projectId: string;
|
|
533
533
|
repoFullName: string;
|
|
534
534
|
prNumber: number;
|
|
@@ -554,10 +554,148 @@ export type BotMentionExternalPrV1 = FusionEventVariant<"bot.mention.external-pr
|
|
|
554
554
|
}, {
|
|
555
555
|
projectId: string;
|
|
556
556
|
}, 1>;
|
|
557
|
-
export declare const
|
|
557
|
+
export declare const BotMentionGitHubExternalPrV1: {
|
|
558
558
|
eventName: "bot.mention.external-pr";
|
|
559
559
|
version: "1";
|
|
560
560
|
};
|
|
561
|
+
/**
|
|
562
|
+
* Common fields shared by all four bot-mention PR events.
|
|
563
|
+
*
|
|
564
|
+
* Extracting this base makes the future consolidation into a single
|
|
565
|
+
* `bot.mention.pr` event straightforward: the unified type will be
|
|
566
|
+
* `BaseBotMentionEventData & { provider: ..., ...providerSpecificOptionals }`.
|
|
567
|
+
*/
|
|
568
|
+
export type BaseBotMentionEventData = {
|
|
569
|
+
/** Fusion project ID resolved from PR metadata */
|
|
570
|
+
projectId: string;
|
|
571
|
+
/** Fusion branch name resolved from PR metadata */
|
|
572
|
+
branchName: string;
|
|
573
|
+
/** Raw comment body that triggered the bot mention */
|
|
574
|
+
comment: string;
|
|
575
|
+
commentLink?: string;
|
|
576
|
+
/** Dedup lock key — composite of comment ID and delivery ID */
|
|
577
|
+
commentIdStr: string;
|
|
578
|
+
userName?: string;
|
|
579
|
+
/** Provider-specific user ID as string (for credits / analytics) */
|
|
580
|
+
gitUserId?: string;
|
|
581
|
+
/** Commenter email when available from the provider (preferred for user resolution) */
|
|
582
|
+
userEmail?: string;
|
|
583
|
+
/** Original webhook delivery ID — passed through for logging */
|
|
584
|
+
webhookEventId: string;
|
|
585
|
+
};
|
|
586
|
+
/**
|
|
587
|
+
* Emitted when @builderio-bot is mentioned on a Fusion (internal) GitHub PR comment.
|
|
588
|
+
* Pre-flight checks (project existence, installation token, GitHub App rights) have
|
|
589
|
+
* already passed before this event is published. The heavy work — container
|
|
590
|
+
* provisioning and AI processing — is handled asynchronously by the subscriber.
|
|
591
|
+
*/
|
|
592
|
+
export type BotMentionGitHubInternalPrV1 = FusionEventVariant<"bot.mention.github-internal-pr", BaseBotMentionEventData & {
|
|
593
|
+
provider: "github";
|
|
594
|
+
repoFullName: string;
|
|
595
|
+
prNumber: number;
|
|
596
|
+
/** Numeric GitHub comment ID (for reaction / reply threading) */
|
|
597
|
+
commentNumericId?: number;
|
|
598
|
+
commentType: "issue" | "pr";
|
|
599
|
+
/** GitHub Enterprise hostname, if applicable */
|
|
600
|
+
hostname?: string;
|
|
601
|
+
/** For review comments: the comment being replied to */
|
|
602
|
+
inReplyToCommentId?: number;
|
|
603
|
+
/** For review comments: unified diff context */
|
|
604
|
+
diffHunk?: string;
|
|
605
|
+
/** For review comments: file path */
|
|
606
|
+
filePath?: string;
|
|
607
|
+
/** For review comments: first line of the comment range */
|
|
608
|
+
startLine?: number;
|
|
609
|
+
/** For review comments: last line of the comment range */
|
|
610
|
+
endLine?: number;
|
|
611
|
+
/** For review comments: reply target comment ID */
|
|
612
|
+
replyToCommentId?: number;
|
|
613
|
+
}, {
|
|
614
|
+
projectId: string;
|
|
615
|
+
}, 1>;
|
|
616
|
+
export declare const BotMentionGitHubInternalPrV1: {
|
|
617
|
+
eventName: "bot.mention.github-internal-pr";
|
|
618
|
+
version: "1";
|
|
619
|
+
};
|
|
620
|
+
/**
|
|
621
|
+
* Emitted when @builderio-bot is mentioned on a GitLab MR comment.
|
|
622
|
+
* Pre-flight checks have already passed before this event is published.
|
|
623
|
+
* Container provisioning and AI processing happen asynchronously in the subscriber.
|
|
624
|
+
*/
|
|
625
|
+
export type BotMentionGitLabPrV1 = FusionEventVariant<"bot.mention.gitlab-pr", BaseBotMentionEventData & {
|
|
626
|
+
provider: "gitlab";
|
|
627
|
+
/** GitLab numeric project ID (needed to re-fetch token and post comments) */
|
|
628
|
+
gitlabProjectId: number;
|
|
629
|
+
/** GitLab MR IID */
|
|
630
|
+
mrId: number;
|
|
631
|
+
/**
|
|
632
|
+
* Thread discussion ID for threaded replies.
|
|
633
|
+
* GitLab sends this as a hex SHA string (e.g. "6a9c1750b37d..."),
|
|
634
|
+
* not a number — used only in URL interpolation.
|
|
635
|
+
*/
|
|
636
|
+
discussionId?: string;
|
|
637
|
+
/** GitLab Enterprise hostname, if applicable */
|
|
638
|
+
hostname?: string;
|
|
639
|
+
}, {
|
|
640
|
+
projectId: string;
|
|
641
|
+
}, 1>;
|
|
642
|
+
export declare const BotMentionGitLabPrV1: {
|
|
643
|
+
eventName: "bot.mention.gitlab-pr";
|
|
644
|
+
version: "1";
|
|
645
|
+
};
|
|
646
|
+
/**
|
|
647
|
+
* Emitted when @builderio-bot is mentioned on a Bitbucket PR comment.
|
|
648
|
+
* Pre-flight checks have already passed before this event is published.
|
|
649
|
+
*/
|
|
650
|
+
export type BotMentionBitbucketPrV1 = FusionEventVariant<"bot.mention.bitbucket-pr", BaseBotMentionEventData & {
|
|
651
|
+
provider: "bitbucket";
|
|
652
|
+
/** e.g. "workspace/repo" */
|
|
653
|
+
repositorySlug: string;
|
|
654
|
+
workspace?: string;
|
|
655
|
+
pullRequestId: number;
|
|
656
|
+
/** Numeric Bitbucket comment ID — used as parentCommentId for reply threading */
|
|
657
|
+
parentCommentId?: number;
|
|
658
|
+
/** PR browser URL (links.html.href from the pullrequest payload) */
|
|
659
|
+
pullRequestUrl?: string;
|
|
660
|
+
/** PR title from the pullrequest payload */
|
|
661
|
+
pullRequestTitle?: string;
|
|
662
|
+
/** PR description from the pullrequest payload */
|
|
663
|
+
pullRequestDescription?: string;
|
|
664
|
+
}, {
|
|
665
|
+
projectId: string;
|
|
666
|
+
}, 1>;
|
|
667
|
+
export declare const BotMentionBitbucketPrV1: {
|
|
668
|
+
eventName: "bot.mention.bitbucket-pr";
|
|
669
|
+
version: "1";
|
|
670
|
+
};
|
|
671
|
+
/**
|
|
672
|
+
* Emitted when @builderio-bot is mentioned on an Azure DevOps PR comment.
|
|
673
|
+
* Pre-flight checks have already passed before this event is published.
|
|
674
|
+
*/
|
|
675
|
+
export type BotMentionAzurePrV1 = FusionEventVariant<"bot.mention.azure-pr", BaseBotMentionEventData & {
|
|
676
|
+
provider: "azure";
|
|
677
|
+
azureOrg: string;
|
|
678
|
+
azureProject: string;
|
|
679
|
+
pullRequestId: number;
|
|
680
|
+
/** Repository ID extracted from comment links */
|
|
681
|
+
repositoryId: string;
|
|
682
|
+
/** Thread link URL — used for reply threading and thread context */
|
|
683
|
+
threadLink: string;
|
|
684
|
+
/**
|
|
685
|
+
* The actual Azure DevOps REST URL of the pull request
|
|
686
|
+
* (event.resource.url or pullRequest.url from the webhook payload).
|
|
687
|
+
* Distinct from commentLink which is the comment resource URL.
|
|
688
|
+
*/
|
|
689
|
+
pullRequestUrl?: string;
|
|
690
|
+
/** PR description from the pullrequest payload */
|
|
691
|
+
pullRequestDescription?: string;
|
|
692
|
+
}, {
|
|
693
|
+
projectId: string;
|
|
694
|
+
}, 1>;
|
|
695
|
+
export declare const BotMentionAzurePrV1: {
|
|
696
|
+
eventName: "bot.mention.azure-pr";
|
|
697
|
+
version: "1";
|
|
698
|
+
};
|
|
561
699
|
export type ClientDevtoolsSessionStartedEvent = FusionEventVariant<"client.devtools.session.started", {
|
|
562
700
|
sessionId?: string;
|
|
563
701
|
sessionType?: string;
|
|
@@ -914,7 +1052,21 @@ export type FigmaDecodeJobV1 = FusionEventVariant<"figma.decode.job", {
|
|
|
914
1052
|
mimetype: string;
|
|
915
1053
|
size: number;
|
|
916
1054
|
}>;
|
|
1055
|
+
/**
|
|
1056
|
+
* Optional public GitHub repo URL to include as supplementary context.
|
|
1057
|
+
* Recorded in the frame manifest; the container shallow-clones it into
|
|
1058
|
+
* `.builder/sources/<repo>/` at hydration time.
|
|
1059
|
+
*/
|
|
1060
|
+
githubRepoUrl?: string;
|
|
917
1061
|
devToolsVersion?: string;
|
|
1062
|
+
/**
|
|
1063
|
+
* Optional map of `.fig` filename → page/frame GUID keys
|
|
1064
|
+
* (`"sessionID:localID"`) to restrict extraction to. When a filename is
|
|
1065
|
+
* present, only the listed pages/frames are decoded into the manifest;
|
|
1066
|
+
* filenames absent from the map are processed in full. GUIDs are
|
|
1067
|
+
* file-local, so they must be scoped per attachment.
|
|
1068
|
+
*/
|
|
1069
|
+
selection?: Record<string, string[]>;
|
|
918
1070
|
}, {}, 1>;
|
|
919
1071
|
export declare const FigmaDecodeJobV1: {
|
|
920
1072
|
eventName: "figma.decode.job";
|
|
@@ -948,16 +1100,36 @@ export interface FigmaFrameManifestEntry {
|
|
|
948
1100
|
export interface FigmaFrameAsset {
|
|
949
1101
|
/** Bucket-relative GCS path. */
|
|
950
1102
|
gcsPath: string;
|
|
951
|
-
/** Relative path under `.builder/figma/` (e.g. `images/abc123.png`). */
|
|
1103
|
+
/** Relative path under `.builder/sources/figma/` (e.g. `images/abc123.png`). */
|
|
952
1104
|
localPath: string;
|
|
953
1105
|
contentType: string;
|
|
954
1106
|
}
|
|
1107
|
+
/**
|
|
1108
|
+
* A plain-text / markdown attachment uploaded alongside the `.fig` files.
|
|
1109
|
+
*/
|
|
1110
|
+
export interface FigmaTextSource {
|
|
1111
|
+
/** Relative path under `.builder/sources/` (e.g. `brand-guidelines.md`). */
|
|
1112
|
+
localPath: string;
|
|
1113
|
+
gcsPath: string;
|
|
1114
|
+
originalName: string;
|
|
1115
|
+
contentType: string;
|
|
1116
|
+
sizeBytes: number;
|
|
1117
|
+
}
|
|
1118
|
+
export interface FigmaGithubRepoSource {
|
|
1119
|
+
url: string;
|
|
1120
|
+
/** Directory name under `.builder/sources/` to clone into. */
|
|
1121
|
+
localDir: string;
|
|
1122
|
+
}
|
|
955
1123
|
export interface FigmaFrameManifest {
|
|
956
1124
|
jobId: string;
|
|
957
1125
|
figmaName: string;
|
|
958
1126
|
frames: FigmaFrameManifestEntry[];
|
|
959
1127
|
/** Raster assets referenced by frame HTML via relative `images/…` URLs. */
|
|
960
1128
|
assets?: FigmaFrameAsset[];
|
|
1129
|
+
/** Uploaded plain-text / markdown supplementary sources. */
|
|
1130
|
+
textSources?: FigmaTextSource[];
|
|
1131
|
+
/** Optional public GitHub repo to clone as supplementary context. */
|
|
1132
|
+
githubRepo?: FigmaGithubRepoSource;
|
|
961
1133
|
}
|
|
962
1134
|
export type PrReviewRequestedV1 = FusionEventVariant<"pr.review.requested", {
|
|
963
1135
|
repoFullName: string;
|
|
@@ -1030,7 +1202,7 @@ export declare const ClientDevtoolsToolResultV1: {
|
|
|
1030
1202
|
eventName: "client.devtools.tool.result";
|
|
1031
1203
|
version: "1";
|
|
1032
1204
|
};
|
|
1033
|
-
export type FusionEvent = ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | ClientDevtoolsToolCallRequestV1 | ClientDevtoolsToolCallV1 | ClientDevtoolsToolResultV1 | FusionProjectCreatedV1 | SetupAgentCompletedV1 | GitPrMergedV1 | GitPrCreatedV1 | GitPrClosedV1 | ForceSetupAgentV1 | ClawMessageSentV1 | CodegenCompletionV1 | CodegenUserPromptV1 | GitWebhooksRegisterV1 | FusionProjectSettingsUpdatedV1 | VideoRecordingCompletedV1 | TimelineRecordingReadyV1 | FusionBranchCreatedV1 | FusionContainerStartedV1 | FusionContainerFailedV1 | FusionBranchFailedV1 |
|
|
1205
|
+
export type FusionEvent = ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | ClientDevtoolsToolCallRequestV1 | ClientDevtoolsToolCallV1 | ClientDevtoolsToolResultV1 | 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;
|
|
1034
1206
|
export interface ModelPermissionRequiredEvent {
|
|
1035
1207
|
type: "assistant.model.permission.required";
|
|
1036
1208
|
data: {
|
package/src/events.js
CHANGED
|
@@ -14,10 +14,26 @@ export const ReviewSubmittedV1 = {
|
|
|
14
14
|
eventName: "review.submitted",
|
|
15
15
|
version: "1",
|
|
16
16
|
};
|
|
17
|
-
export const
|
|
17
|
+
export const BotMentionGitHubExternalPrV1 = {
|
|
18
18
|
eventName: "bot.mention.external-pr",
|
|
19
19
|
version: "1",
|
|
20
20
|
};
|
|
21
|
+
export const BotMentionGitHubInternalPrV1 = {
|
|
22
|
+
eventName: "bot.mention.github-internal-pr",
|
|
23
|
+
version: "1",
|
|
24
|
+
};
|
|
25
|
+
export const BotMentionGitLabPrV1 = {
|
|
26
|
+
eventName: "bot.mention.gitlab-pr",
|
|
27
|
+
version: "1",
|
|
28
|
+
};
|
|
29
|
+
export const BotMentionBitbucketPrV1 = {
|
|
30
|
+
eventName: "bot.mention.bitbucket-pr",
|
|
31
|
+
version: "1",
|
|
32
|
+
};
|
|
33
|
+
export const BotMentionAzurePrV1 = {
|
|
34
|
+
eventName: "bot.mention.azure-pr",
|
|
35
|
+
version: "1",
|
|
36
|
+
};
|
|
21
37
|
export const ClientDevtoolsSessionStartedEvent = {
|
|
22
38
|
eventName: "client.devtools.session.started",
|
|
23
39
|
version: "1",
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
package/src/organization.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ interface OrganizationSettings {
|
|
|
70
70
|
enableModelValidationHooks?: boolean;
|
|
71
71
|
enableOrgInsights?: boolean;
|
|
72
72
|
enableBuilderHosting?: boolean;
|
|
73
|
+
enableFusionHosting?: boolean;
|
|
73
74
|
allowLegacyPlanSubscriptions?: boolean;
|
|
74
75
|
enforceMaxUsers?: boolean;
|
|
75
76
|
ssoRestrictedMode?: boolean;
|
package/src/projects.d.ts
CHANGED
|
@@ -435,7 +435,7 @@ export interface OrgAgentConfig {
|
|
|
435
435
|
enabledTools: string[];
|
|
436
436
|
longLived: boolean;
|
|
437
437
|
}
|
|
438
|
-
export type BranchType = "code-review" | "setup-project" | "org-agent" | "snapshot-build" | "design-system-indexing" | "default";
|
|
438
|
+
export type BranchType = "code-review" | "setup-project" | "org-agent" | "snapshot-build" | "design-system-indexing" | "deploy" | "default";
|
|
439
439
|
/** Category of work a branch represents, auto-assigned during prompt analysis. */
|
|
440
440
|
export type BranchCategory = "feature" | "fix" | "research" | "other";
|
|
441
441
|
export interface BranchSharedData {
|
|
@@ -526,6 +526,7 @@ export interface BranchSharedData {
|
|
|
526
526
|
lastReviewId?: string | null;
|
|
527
527
|
/** Timestamp of the last PR review */
|
|
528
528
|
lastReviewAt?: number | null;
|
|
529
|
+
database?: BranchDatabase;
|
|
529
530
|
}
|
|
530
531
|
/**
|
|
531
532
|
* fields that are required in the new branch format, but optional in the legacy branch format.
|
|
@@ -864,9 +865,53 @@ export interface Project {
|
|
|
864
865
|
userInitiatedAutoSetup?: boolean;
|
|
865
866
|
/** When true, automatically apply verified setup configuration when the setup agent completes */
|
|
866
867
|
autoApplySetup?: boolean;
|
|
867
|
-
/** Settings related to Fusion
|
|
868
|
+
/** Settings related to Fusion first class hosting */
|
|
868
869
|
hosting?: ProjectHosting;
|
|
870
|
+
database?: ProjectDatabase;
|
|
869
871
|
}
|
|
872
|
+
export interface ProjectDatabase {
|
|
873
|
+
ownerId: string;
|
|
874
|
+
neonOrgId: string;
|
|
875
|
+
neonOrgTier: "free" | "paid";
|
|
876
|
+
neonProjectId: string;
|
|
877
|
+
mainBranchId: string;
|
|
878
|
+
mainEndpointHost: string;
|
|
879
|
+
mainEndpointPoolerHost: string;
|
|
880
|
+
role: string;
|
|
881
|
+
/** @internal Plaintext credential — Firestore IAM enforces access. Never serialize to client responses. */
|
|
882
|
+
password: string;
|
|
883
|
+
region: string;
|
|
884
|
+
createdAt: number;
|
|
885
|
+
createdBy: string;
|
|
886
|
+
lastActivityAt: number;
|
|
887
|
+
}
|
|
888
|
+
export interface BranchDatabase {
|
|
889
|
+
ownerId: string;
|
|
890
|
+
projectId: string;
|
|
891
|
+
neonProjectId: string;
|
|
892
|
+
neonBranchId: string;
|
|
893
|
+
endpointHost: string;
|
|
894
|
+
endpointPoolerHost: string;
|
|
895
|
+
createdAt: number;
|
|
896
|
+
createdBy: string;
|
|
897
|
+
}
|
|
898
|
+
interface DatabaseDeletionBase {
|
|
899
|
+
id: string;
|
|
900
|
+
ownerId: string;
|
|
901
|
+
projectId: string;
|
|
902
|
+
neonProjectId: string;
|
|
903
|
+
pendingDeleteAt: number;
|
|
904
|
+
createdAt: number;
|
|
905
|
+
createdBy: string;
|
|
906
|
+
reason?: string;
|
|
907
|
+
}
|
|
908
|
+
export type DatabaseDeletion = (DatabaseDeletionBase & {
|
|
909
|
+
neonBranchId: string;
|
|
910
|
+
neonProjectAllBranches?: never;
|
|
911
|
+
}) | (DatabaseDeletionBase & {
|
|
912
|
+
neonBranchId?: never;
|
|
913
|
+
neonProjectAllBranches: true;
|
|
914
|
+
});
|
|
870
915
|
/**
|
|
871
916
|
* Get the state of a branch, checking `state` first and falling back to `deleted` for backwards compatibility.
|
|
872
917
|
*/
|
|
@@ -1221,9 +1266,13 @@ export interface ShouldDeletePodResponse {
|
|
|
1221
1266
|
* - deploying — queue handler is pushing artifacts to Netlify + updating Envoy HTTPRoute
|
|
1222
1267
|
* - live — terminal: site is serving traffic
|
|
1223
1268
|
* - failed — terminal: see `error` for the one-line reason
|
|
1269
|
+
* - canceled — terminal: a concurrent unpublish (or an expired-lock takeover by a
|
|
1270
|
+
* newer deploy) stole the lock, and this deploy aborted at a fencing
|
|
1271
|
+
* gate before going live — see "Concurrency & Locking" in the spec
|
|
1224
1272
|
*/
|
|
1225
1273
|
export declare const DeployStatusSchema: z.ZodEnum<{
|
|
1226
1274
|
building: "building";
|
|
1275
|
+
canceled: "canceled";
|
|
1227
1276
|
deploying: "deploying";
|
|
1228
1277
|
failed: "failed";
|
|
1229
1278
|
live: "live";
|
|
@@ -1249,17 +1298,27 @@ export declare const ProjectHostingSchema: z.ZodObject<{
|
|
|
1249
1298
|
buildCommand: z.ZodOptional<z.ZodString>;
|
|
1250
1299
|
nodeVersion: z.ZodOptional<z.ZodString>;
|
|
1251
1300
|
}, z.core.$strip>>;
|
|
1252
|
-
environment: z.ZodOptional<z.
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1301
|
+
environment: z.ZodOptional<z.ZodObject<{
|
|
1302
|
+
build: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1303
|
+
key: z.ZodString;
|
|
1304
|
+
value: z.ZodString;
|
|
1305
|
+
isSecret: z.ZodBoolean;
|
|
1306
|
+
placeholder: z.ZodOptional<z.ZodBoolean>;
|
|
1307
|
+
explanation: z.ZodOptional<z.ZodString>;
|
|
1308
|
+
}, z.core.$strip>>>;
|
|
1309
|
+
prod: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1310
|
+
key: z.ZodString;
|
|
1311
|
+
value: z.ZodString;
|
|
1312
|
+
isSecret: z.ZodBoolean;
|
|
1313
|
+
placeholder: z.ZodOptional<z.ZodBoolean>;
|
|
1314
|
+
explanation: z.ZodOptional<z.ZodString>;
|
|
1315
|
+
}, z.core.$strip>>>;
|
|
1316
|
+
}, z.core.$strip>>;
|
|
1259
1317
|
lastDeployId: z.ZodOptional<z.ZodString>;
|
|
1260
1318
|
lastDeployAt: z.ZodOptional<z.ZodNumber>;
|
|
1261
1319
|
lastDeployStatus: z.ZodOptional<z.ZodEnum<{
|
|
1262
1320
|
building: "building";
|
|
1321
|
+
canceled: "canceled";
|
|
1263
1322
|
deploying: "deploying";
|
|
1264
1323
|
failed: "failed";
|
|
1265
1324
|
live: "live";
|
|
@@ -1280,8 +1339,10 @@ export declare const DeploySchema: z.ZodObject<{
|
|
|
1280
1339
|
ownerId: z.ZodString;
|
|
1281
1340
|
checkoutBranch: z.ZodOptional<z.ZodString>;
|
|
1282
1341
|
deployBranchId: z.ZodOptional<z.ZodString>;
|
|
1342
|
+
devBranchId: z.ZodOptional<z.ZodString>;
|
|
1283
1343
|
status: z.ZodEnum<{
|
|
1284
1344
|
building: "building";
|
|
1345
|
+
canceled: "canceled";
|
|
1285
1346
|
deploying: "deploying";
|
|
1286
1347
|
failed: "failed";
|
|
1287
1348
|
live: "live";
|
|
@@ -1314,4 +1375,60 @@ export declare const HostingSlugSchema: z.ZodObject<{
|
|
|
1314
1375
|
createdBy: z.ZodString;
|
|
1315
1376
|
}, z.core.$strip>;
|
|
1316
1377
|
export type HostingSlug = z.infer<typeof HostingSlugSchema>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Deploy lease lock with fencing token, stored at
|
|
1380
|
+
* `hosting-locks/{projectId}__{checkoutBranch}` (the key uses the resolved ref
|
|
1381
|
+
* string, not a branchId, because `main` has no backing fusion-branch doc in PRs
|
|
1382
|
+
* mode).
|
|
1383
|
+
*
|
|
1384
|
+
* Serializes deploys per `(projectId, checkoutBranch)` and lets unpublish preempt an
|
|
1385
|
+
* in-flight deploy. Created by the `POST /projects/deploy` acquire transaction,
|
|
1386
|
+
* force-stolen by `DELETE /projects/hosting`, and deleted on any terminal deploy
|
|
1387
|
+
* state (`live` / `failed` / `canceled`) or after unpublish teardown. A crashed
|
|
1388
|
+
* holder's lock is reclaimed lazily via `expiresAt` rather than auto-released.
|
|
1389
|
+
*/
|
|
1390
|
+
export declare const HostingLockSchema: z.ZodObject<{
|
|
1391
|
+
ownerId: z.ZodString;
|
|
1392
|
+
holderId: z.ZodString;
|
|
1393
|
+
holderKind: z.ZodEnum<{
|
|
1394
|
+
deploy: "deploy";
|
|
1395
|
+
unpublish: "unpublish";
|
|
1396
|
+
}>;
|
|
1397
|
+
deployId: z.ZodOptional<z.ZodString>;
|
|
1398
|
+
acquiredAt: z.ZodNumber;
|
|
1399
|
+
expiresAt: z.ZodNumber;
|
|
1400
|
+
}, z.core.$strip>;
|
|
1401
|
+
export type HostingLock = z.infer<typeof HostingLockSchema>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Response item for `GET /projects/deploys`. The same shape backs both the deploy
|
|
1404
|
+
* history list and the single-deploy poll, so the frontend can render both with one
|
|
1405
|
+
* renderer.
|
|
1406
|
+
*/
|
|
1407
|
+
export declare const DeployListItemSchema: z.ZodObject<{
|
|
1408
|
+
id: z.ZodString;
|
|
1409
|
+
status: z.ZodEnum<{
|
|
1410
|
+
building: "building";
|
|
1411
|
+
canceled: "canceled";
|
|
1412
|
+
deploying: "deploying";
|
|
1413
|
+
failed: "failed";
|
|
1414
|
+
live: "live";
|
|
1415
|
+
queued: "queued";
|
|
1416
|
+
uploading: "uploading";
|
|
1417
|
+
}>;
|
|
1418
|
+
url: z.ZodOptional<z.ZodString>;
|
|
1419
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1420
|
+
createdAt: z.ZodNumber;
|
|
1421
|
+
completedAt: z.ZodOptional<z.ZodNumber>;
|
|
1422
|
+
}, z.core.$strip>;
|
|
1423
|
+
export type DeployListItem = z.infer<typeof DeployListItemSchema>;
|
|
1424
|
+
/**
|
|
1425
|
+
* Shape of the `manifest.json` the deploy pod uploads to GCS alongside
|
|
1426
|
+
* `artifact.tar.gz`. Modeled on Netlify's deploy file map: static files are hashed
|
|
1427
|
+
* with sha1, serverless functions with sha256 (per Netlify's contract).
|
|
1428
|
+
*/
|
|
1429
|
+
export declare const DeployArtifactManifestSchema: z.ZodObject<{
|
|
1430
|
+
files: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1431
|
+
functions: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1432
|
+
}, z.core.$strip>;
|
|
1433
|
+
export type DeployArtifactManifest = z.infer<typeof DeployArtifactManifestSchema>;
|
|
1317
1434
|
export {};
|
package/src/projects.js
CHANGED
|
@@ -180,6 +180,9 @@ export function parseExitPlanMode(chunk) {
|
|
|
180
180
|
* - deploying — queue handler is pushing artifacts to Netlify + updating Envoy HTTPRoute
|
|
181
181
|
* - live — terminal: site is serving traffic
|
|
182
182
|
* - failed — terminal: see `error` for the one-line reason
|
|
183
|
+
* - canceled — terminal: a concurrent unpublish (or an expired-lock takeover by a
|
|
184
|
+
* newer deploy) stole the lock, and this deploy aborted at a fencing
|
|
185
|
+
* gate before going live — see "Concurrency & Locking" in the spec
|
|
183
186
|
*/
|
|
184
187
|
export const DeployStatusSchema = z.enum([
|
|
185
188
|
"queued",
|
|
@@ -188,6 +191,7 @@ export const DeployStatusSchema = z.enum([
|
|
|
188
191
|
"deploying",
|
|
189
192
|
"live",
|
|
190
193
|
"failed",
|
|
194
|
+
"canceled",
|
|
191
195
|
]);
|
|
192
196
|
export const ProjectHostingBuildConfigSchema = z.object({
|
|
193
197
|
buildCommand: z.string().optional(),
|
|
@@ -222,9 +226,16 @@ export const ProjectHostingSchema = z.object({
|
|
|
222
226
|
* plaintext in Firestore, masked on the read path before responses leave ai-services
|
|
223
227
|
* (see "Secret handling" in the hosting spec).
|
|
224
228
|
*/
|
|
225
|
-
environment: z
|
|
226
|
-
|
|
227
|
-
|
|
229
|
+
environment: z
|
|
230
|
+
.object({
|
|
231
|
+
build: z.array(EnvironmentVariableSchema).optional().meta({
|
|
232
|
+
description: "Env vars available to the build itself",
|
|
233
|
+
}),
|
|
234
|
+
prod: z.array(EnvironmentVariableSchema).optional().meta({
|
|
235
|
+
description: "Env vars for the production deploy served via Netlify",
|
|
236
|
+
}),
|
|
237
|
+
})
|
|
238
|
+
.optional(),
|
|
228
239
|
lastDeployId: z.string().optional(),
|
|
229
240
|
lastDeployAt: z.number().optional(),
|
|
230
241
|
lastDeployStatus: DeployStatusSchema.optional(),
|
|
@@ -250,13 +261,11 @@ export const DeploySchema = z.object({
|
|
|
250
261
|
"for row 2 in v2). This is the value passed as `checkoutBranch` when the " +
|
|
251
262
|
"deploy pod was created.",
|
|
252
263
|
}),
|
|
253
|
-
deployBranchId: z
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
description:
|
|
258
|
-
"build. Cleared after the pod terminates so historical Deploy docs don't " +
|
|
259
|
-
"hold references to garbage-collected branch state.",
|
|
264
|
+
deployBranchId: z.string().optional().meta({
|
|
265
|
+
description: 'Fusion branch id of the ephemeral hidden deploy branch (`type: "deploy"`) that ran the build.',
|
|
266
|
+
}),
|
|
267
|
+
devBranchId: z.string().optional().meta({
|
|
268
|
+
description: "Fusion dev branch's id (unset if we are deploying project default branch)",
|
|
260
269
|
}),
|
|
261
270
|
status: DeployStatusSchema,
|
|
262
271
|
netlifyDeployId: z.string().optional(),
|
|
@@ -289,3 +298,55 @@ export const HostingSlugSchema = z.object({
|
|
|
289
298
|
description: "user ID of the user who first clicked Publish on the project",
|
|
290
299
|
}),
|
|
291
300
|
});
|
|
301
|
+
/**
|
|
302
|
+
* Deploy lease lock with fencing token, stored at
|
|
303
|
+
* `hosting-locks/{projectId}__{checkoutBranch}` (the key uses the resolved ref
|
|
304
|
+
* string, not a branchId, because `main` has no backing fusion-branch doc in PRs
|
|
305
|
+
* mode).
|
|
306
|
+
*
|
|
307
|
+
* Serializes deploys per `(projectId, checkoutBranch)` and lets unpublish preempt an
|
|
308
|
+
* in-flight deploy. Created by the `POST /projects/deploy` acquire transaction,
|
|
309
|
+
* force-stolen by `DELETE /projects/hosting`, and deleted on any terminal deploy
|
|
310
|
+
* state (`live` / `failed` / `canceled`) or after unpublish teardown. A crashed
|
|
311
|
+
* holder's lock is reclaimed lazily via `expiresAt` rather than auto-released.
|
|
312
|
+
*/
|
|
313
|
+
export const HostingLockSchema = z.object({
|
|
314
|
+
ownerId: z.string(),
|
|
315
|
+
holderId: z.string().meta({
|
|
316
|
+
description: "unique per acquisition (the fencing token); == deployId for a deploy holder",
|
|
317
|
+
}),
|
|
318
|
+
holderKind: z.enum(["deploy", "unpublish"]),
|
|
319
|
+
deployId: z.string().optional().meta({
|
|
320
|
+
description: 'set when holderKind === "deploy"',
|
|
321
|
+
}),
|
|
322
|
+
acquiredAt: z.number().meta({ description: "unix time (ms)" }),
|
|
323
|
+
expiresAt: z.number().meta({
|
|
324
|
+
description: "acquiredAt + 15min (same ceiling as the deploy lazy-timeout)",
|
|
325
|
+
}),
|
|
326
|
+
});
|
|
327
|
+
/**
|
|
328
|
+
* Response item for `GET /projects/deploys`. The same shape backs both the deploy
|
|
329
|
+
* history list and the single-deploy poll, so the frontend can render both with one
|
|
330
|
+
* renderer.
|
|
331
|
+
*/
|
|
332
|
+
export const DeployListItemSchema = DeploySchema.pick({
|
|
333
|
+
id: true,
|
|
334
|
+
status: true,
|
|
335
|
+
url: true,
|
|
336
|
+
createdAt: true,
|
|
337
|
+
completedAt: true,
|
|
338
|
+
error: true,
|
|
339
|
+
}).meta({ title: "DeployListItem" });
|
|
340
|
+
/**
|
|
341
|
+
* Shape of the `manifest.json` the deploy pod uploads to GCS alongside
|
|
342
|
+
* `artifact.tar.gz`. Modeled on Netlify's deploy file map: static files are hashed
|
|
343
|
+
* with sha1, serverless functions with sha256 (per Netlify's contract).
|
|
344
|
+
*/
|
|
345
|
+
export const DeployArtifactManifestSchema = z.object({
|
|
346
|
+
files: z.record(z.string(), z.string()).meta({
|
|
347
|
+
description: "static file path → sha1 hash",
|
|
348
|
+
}),
|
|
349
|
+
functions: z.record(z.string(), z.string()).meta({
|
|
350
|
+
description: "serverless function name → sha256 hash",
|
|
351
|
+
}),
|
|
352
|
+
});
|