@builder.io/ai-utils 0.58.1 → 0.60.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/claw.d.ts +6 -0
- package/src/claw.js +9 -0
- package/src/claw.spec.js +27 -0
- package/src/codegen.d.ts +2818 -1003
- package/src/codegen.js +1885 -0
- package/src/design-systems.d.ts +38 -0
- package/src/design-systems.js +14 -0
- package/src/events.d.ts +2 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/mapping.d.ts +13 -12
- package/src/mapping.js +15 -1
- package/src/messages.d.ts +305 -107
- package/src/messages.js +158 -0
- package/src/projects.d.ts +145 -16
- package/src/projects.js +24 -0
package/src/messages.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
export function getContentText(message) {
|
|
2
3
|
if (typeof message === "string") {
|
|
3
4
|
return message;
|
|
@@ -14,3 +15,160 @@ export function getContentAttachments(message) {
|
|
|
14
15
|
.filter((item) => item.type === "image")
|
|
15
16
|
.map((item) => item.source);
|
|
16
17
|
}
|
|
18
|
+
export const URLSchema = z
|
|
19
|
+
.object({ type: z.literal("url"), value: z.string() })
|
|
20
|
+
.meta({ title: "URL" });
|
|
21
|
+
export const FileUploadSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
type: z.literal("upload"),
|
|
24
|
+
contentType: z.enum([
|
|
25
|
+
"image/webp",
|
|
26
|
+
"image/png",
|
|
27
|
+
"image/jpeg",
|
|
28
|
+
"image/gif",
|
|
29
|
+
"application/pdf",
|
|
30
|
+
"application/json",
|
|
31
|
+
"text/plain",
|
|
32
|
+
]),
|
|
33
|
+
name: z.string(),
|
|
34
|
+
dataUrl: z.string(),
|
|
35
|
+
text: z.string().optional(),
|
|
36
|
+
size: z.number(),
|
|
37
|
+
id: z.string(),
|
|
38
|
+
originalUrl: z.string().optional(),
|
|
39
|
+
ephemeral: z.boolean().optional(),
|
|
40
|
+
})
|
|
41
|
+
.meta({ title: "FileUpload" });
|
|
42
|
+
export const TemplateSchema = z
|
|
43
|
+
.object({ type: z.literal("template"), name: z.string(), id: z.number() })
|
|
44
|
+
.meta({ title: "Template" });
|
|
45
|
+
export const BuilderContentAttachmentSchema = z
|
|
46
|
+
.object({ type: z.literal("builder"), html: z.string() })
|
|
47
|
+
.meta({ title: "BuilderContentAttachment" });
|
|
48
|
+
export const FigmaContentAttachmentSchema = z
|
|
49
|
+
.object({ type: z.literal("figma"), html: z.string() })
|
|
50
|
+
.meta({ title: "FigmaContentAttachment" });
|
|
51
|
+
export const AttachmentSchema = z
|
|
52
|
+
.discriminatedUnion("type", [
|
|
53
|
+
FileUploadSchema,
|
|
54
|
+
TemplateSchema,
|
|
55
|
+
URLSchema,
|
|
56
|
+
BuilderContentAttachmentSchema,
|
|
57
|
+
FigmaContentAttachmentSchema,
|
|
58
|
+
])
|
|
59
|
+
.meta({ title: "Attachment" });
|
|
60
|
+
export const CitationCharLocationParamSchema = z
|
|
61
|
+
.object({
|
|
62
|
+
cited_text: z.string(),
|
|
63
|
+
document_index: z.number(),
|
|
64
|
+
document_title: z.string().nullable(),
|
|
65
|
+
end_char_index: z.number(),
|
|
66
|
+
start_char_index: z.number(),
|
|
67
|
+
type: z.literal("char_location"),
|
|
68
|
+
})
|
|
69
|
+
.meta({ title: "CitationCharLocationParam" });
|
|
70
|
+
export const CitationContentBlockLocationParamSchema = z
|
|
71
|
+
.object({
|
|
72
|
+
cited_text: z.string(),
|
|
73
|
+
document_index: z.number(),
|
|
74
|
+
document_title: z.string().nullable(),
|
|
75
|
+
end_block_index: z.number(),
|
|
76
|
+
start_block_index: z.number(),
|
|
77
|
+
type: z.literal("content_block_location"),
|
|
78
|
+
})
|
|
79
|
+
.meta({ title: "CitationContentBlockLocationParam" });
|
|
80
|
+
export const CitationPageLocationParamSchema = z
|
|
81
|
+
.object({
|
|
82
|
+
cited_text: z.string(),
|
|
83
|
+
document_index: z.number(),
|
|
84
|
+
document_title: z.string().nullable(),
|
|
85
|
+
end_page_number: z.number(),
|
|
86
|
+
start_page_number: z.number(),
|
|
87
|
+
type: z.literal("page_location"),
|
|
88
|
+
})
|
|
89
|
+
.meta({ title: "CitationPageLocationParam" });
|
|
90
|
+
export const CitationWebSearchResultLocationParamSchema = z
|
|
91
|
+
.object({
|
|
92
|
+
cited_text: z.string(),
|
|
93
|
+
encrypted_index: z.string(),
|
|
94
|
+
title: z.string().nullable(),
|
|
95
|
+
type: z.literal("web_search_result_location"),
|
|
96
|
+
url: z.string(),
|
|
97
|
+
})
|
|
98
|
+
.meta({ title: "CitationWebSearchResultLocationParam" });
|
|
99
|
+
export const TextCitationParamSchema = z
|
|
100
|
+
.discriminatedUnion("type", [
|
|
101
|
+
CitationCharLocationParamSchema,
|
|
102
|
+
CitationPageLocationParamSchema,
|
|
103
|
+
CitationContentBlockLocationParamSchema,
|
|
104
|
+
CitationWebSearchResultLocationParamSchema,
|
|
105
|
+
])
|
|
106
|
+
.meta({ title: "TextCitationParam" });
|
|
107
|
+
export const ImageBase64SourceSchema = z
|
|
108
|
+
.object({
|
|
109
|
+
type: z.literal("base64"),
|
|
110
|
+
media_type: z.enum(["image/webp", "image/png", "image/jpeg", "image/gif"]),
|
|
111
|
+
data: z.string(),
|
|
112
|
+
original_url: z.string().optional(),
|
|
113
|
+
})
|
|
114
|
+
.meta({ title: "ImageBase64Source" });
|
|
115
|
+
export const ImageUrlSourceSchema = z
|
|
116
|
+
.object({
|
|
117
|
+
type: z.literal("url"),
|
|
118
|
+
url: z.string(),
|
|
119
|
+
})
|
|
120
|
+
.meta({ title: "ImageUrlSource" });
|
|
121
|
+
export const ContentMessageItemTextSchema = z
|
|
122
|
+
.object({
|
|
123
|
+
type: z.literal("text"),
|
|
124
|
+
text: z.string(),
|
|
125
|
+
cache: z.boolean().optional(),
|
|
126
|
+
citations: z.array(TextCitationParamSchema).nullish(),
|
|
127
|
+
ephemeral: z.boolean().optional(),
|
|
128
|
+
thoughtSignature: z.string().optional(),
|
|
129
|
+
tag: z.string().optional(),
|
|
130
|
+
})
|
|
131
|
+
.meta({ title: "ContentMessageItemText" });
|
|
132
|
+
export const ContentMessageItemImageSchema = z
|
|
133
|
+
.object({
|
|
134
|
+
type: z.literal("image"),
|
|
135
|
+
source: z.discriminatedUnion("type", [
|
|
136
|
+
ImageBase64SourceSchema,
|
|
137
|
+
ImageUrlSourceSchema,
|
|
138
|
+
]),
|
|
139
|
+
cache: z.boolean().optional(),
|
|
140
|
+
ephemeral: z.boolean().optional(),
|
|
141
|
+
})
|
|
142
|
+
.meta({ title: "ContentMessageItemImage" });
|
|
143
|
+
export const ContentMessageItemResourceSchema = z
|
|
144
|
+
.object({
|
|
145
|
+
type: z.literal("resource"),
|
|
146
|
+
resource: z.object({
|
|
147
|
+
uri: z.string(),
|
|
148
|
+
mimeType: z.string().optional(),
|
|
149
|
+
text: z.string().optional(),
|
|
150
|
+
blob: z.string().optional(),
|
|
151
|
+
}),
|
|
152
|
+
})
|
|
153
|
+
.meta({ title: "ContentMessageItemResource" });
|
|
154
|
+
export const ContentMessageItemToolResultSchema = z
|
|
155
|
+
.object({
|
|
156
|
+
type: z.literal("tool_result"),
|
|
157
|
+
tool_use_id: z.string(),
|
|
158
|
+
tool_name: z.string().optional(),
|
|
159
|
+
tool_input: z.string().optional(),
|
|
160
|
+
title: z.string().optional(),
|
|
161
|
+
content: z.union([
|
|
162
|
+
z.string(),
|
|
163
|
+
z.array(z.discriminatedUnion("type", [
|
|
164
|
+
ContentMessageItemTextSchema,
|
|
165
|
+
ContentMessageItemImageSchema,
|
|
166
|
+
ContentMessageItemResourceSchema,
|
|
167
|
+
])),
|
|
168
|
+
]),
|
|
169
|
+
is_error: z.boolean().optional(),
|
|
170
|
+
cache: z.boolean().optional(),
|
|
171
|
+
ephemeral: z.boolean().optional(),
|
|
172
|
+
structured_result: z.record(z.string(), z.any()).optional(),
|
|
173
|
+
})
|
|
174
|
+
.meta({ title: "ContentMessageItemToolResult" });
|
package/src/projects.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import type { ConnectivityErrorCode, CheckType, LikelyCause } from "./connectivity/types.js";
|
|
2
3
|
import type { FileOverride, EnvironmentVariable, LaunchServerState, LaunchServerStatus, BranchBackup, CommitMode, CustomInstruction, CustomAgentDefinition, GitSnapshot, AutoPushMode, GenerateUserMessage, CodeGenToolMap, GenerateCompletionStep, ReviewEffort } from "./codegen";
|
|
3
4
|
import type { FallbackTokensPrivate } from "./organization";
|
|
@@ -224,6 +225,7 @@ export interface GitConfig {
|
|
|
224
225
|
export type GitConfigs = Record<string, GitConfig>;
|
|
225
226
|
export declare const EXAMPLE_REPOS: string[];
|
|
226
227
|
export declare const STARTER_REPO = "BuilderIO/fusion-starter";
|
|
228
|
+
export declare const DSI_PREVIEW_REPO = "BuilderIO/dsi-starter";
|
|
227
229
|
export declare const EXAMPLE_OR_STARTER_REPOS: string[];
|
|
228
230
|
export declare const EXAMPLE_OR_STARTER_REPOS_URLS: string[];
|
|
229
231
|
export interface GitBackupUploadUrlResult {
|
|
@@ -326,21 +328,34 @@ export type ShutdownResponse = {
|
|
|
326
328
|
export type ShutdownResponseSerialized = Omit<ShutdownResponse, "error"> & {
|
|
327
329
|
error?: string;
|
|
328
330
|
};
|
|
329
|
-
export
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
export
|
|
337
|
-
key:
|
|
338
|
-
type: "script"
|
|
339
|
-
name:
|
|
340
|
-
script:
|
|
341
|
-
}
|
|
331
|
+
export declare const SetupMiseDependencySchema: z.ZodObject<{
|
|
332
|
+
key: z.ZodString;
|
|
333
|
+
type: z.ZodLiteral<"mise">;
|
|
334
|
+
tool: z.ZodString;
|
|
335
|
+
version: z.ZodOptional<z.ZodString>;
|
|
336
|
+
}, z.core.$strip>;
|
|
337
|
+
export type SetupMiseDependency = z.infer<typeof SetupMiseDependencySchema>;
|
|
338
|
+
export declare const SetupScriptDependencySchema: z.ZodObject<{
|
|
339
|
+
key: z.ZodString;
|
|
340
|
+
type: z.ZodLiteral<"script">;
|
|
341
|
+
name: z.ZodString;
|
|
342
|
+
script: z.ZodString;
|
|
343
|
+
}, z.core.$strip>;
|
|
344
|
+
export type SetupScriptDependency = z.infer<typeof SetupScriptDependencySchema>;
|
|
345
|
+
export declare const SetupDependencySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
346
|
+
key: z.ZodString;
|
|
347
|
+
type: z.ZodLiteral<"mise">;
|
|
348
|
+
tool: z.ZodString;
|
|
349
|
+
version: z.ZodOptional<z.ZodString>;
|
|
350
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
351
|
+
key: z.ZodString;
|
|
352
|
+
type: z.ZodLiteral<"script">;
|
|
353
|
+
name: z.ZodString;
|
|
354
|
+
script: z.ZodString;
|
|
355
|
+
}, z.core.$strip>], "type">;
|
|
356
|
+
export type SetupDependency = z.infer<typeof SetupDependencySchema>;
|
|
342
357
|
export type FusionExecutionEnvironment = "containerized" | "container-less" | "cloud" | "cloud-v2";
|
|
343
|
-
export type AgentType = "setup-project" | "project-configuration" | "org-agent" | "code-review-orchestrator";
|
|
358
|
+
export type AgentType = "setup-project" | "project-configuration" | "org-agent" | "code-review-orchestrator" | "design-system-indexer" | "builder-publish-integration";
|
|
344
359
|
export interface PartialBranchData {
|
|
345
360
|
name?: string;
|
|
346
361
|
createdBy: string;
|
|
@@ -445,7 +460,7 @@ export interface OrgAgentConfig {
|
|
|
445
460
|
enabledTools: string[];
|
|
446
461
|
longLived: boolean;
|
|
447
462
|
}
|
|
448
|
-
export type BranchType = "code-review" | "setup-project" | "org-agent" | "default";
|
|
463
|
+
export type BranchType = "code-review" | "setup-project" | "org-agent" | "design-system-indexing" | "default";
|
|
449
464
|
/** Category of work a branch represents, auto-assigned during prompt analysis. */
|
|
450
465
|
export type BranchCategory = "feature" | "fix" | "research" | "other";
|
|
451
466
|
export interface BranchSharedData {
|
|
@@ -598,15 +613,25 @@ export interface PreviewPasswordProtection {
|
|
|
598
613
|
password?: string;
|
|
599
614
|
}
|
|
600
615
|
export interface Project {
|
|
616
|
+
/** Unique project identifier. */
|
|
601
617
|
id: string;
|
|
618
|
+
/** Display name of the project. */
|
|
602
619
|
name: string;
|
|
620
|
+
/** ID of the space (organization) that owns this project. */
|
|
603
621
|
ownerId: string;
|
|
622
|
+
/** Full repo name in the form "owner/repo", e.g. "acme/frontend". */
|
|
604
623
|
repoFullName: string | undefined;
|
|
624
|
+
/** Git hosting provider: "github", "gitlab", "azure", "bitbucket", etc. */
|
|
605
625
|
repoProvider: string;
|
|
626
|
+
/** Clone protocol: "https" or "ssh". */
|
|
606
627
|
repoProtocol: string | undefined;
|
|
628
|
+
/** Optional human-readable description of the project. */
|
|
607
629
|
description?: string;
|
|
630
|
+
/** Description pulled from the connected git repository's metadata. */
|
|
608
631
|
repoDescription?: string;
|
|
632
|
+
/** Whether the connected repository is private. */
|
|
609
633
|
repoPrivate: boolean;
|
|
634
|
+
/** Full clone URL of the repository. */
|
|
610
635
|
repoUrl: string | undefined;
|
|
611
636
|
/** 8-character SHA-256 hash of normalized repoUrl for cross-project matching */
|
|
612
637
|
repoHash?: string;
|
|
@@ -614,103 +639,195 @@ export interface Project {
|
|
|
614
639
|
createdDate: InMigrationDate;
|
|
615
640
|
/** MIGRATION: accepts both string and number during migration period */
|
|
616
641
|
updatedAt: InMigrationDate;
|
|
642
|
+
/** When true, the project appears at the top of the project list. */
|
|
617
643
|
pinned?: boolean;
|
|
644
|
+
/** Sort order among pinned projects. */
|
|
618
645
|
pinOrder?: number;
|
|
646
|
+
/** When true, the project is archived and hidden from the default view. */
|
|
619
647
|
archived?: boolean;
|
|
648
|
+
/** User ID of the person who created the project. */
|
|
620
649
|
createdBy: string;
|
|
650
|
+
/** User ID of the last person to update the project. */
|
|
621
651
|
lastUpdateBy?: string;
|
|
652
|
+
/** Internal counter tracking CI check run outcomes per status. */
|
|
622
653
|
checkRunCounts?: Record<string, number>;
|
|
654
|
+
/** User ID of whoever added the repository connection. */
|
|
623
655
|
repoAddedBy?: string;
|
|
656
|
+
/** Internal counter tracking pipeline run outcomes per status. */
|
|
624
657
|
pipelineCounts?: Record<string, number>;
|
|
658
|
+
/** When true, the project has not completed initial setup. */
|
|
625
659
|
needSetup?: boolean;
|
|
660
|
+
/** Project purpose: general app or design-system indexing target. */
|
|
626
661
|
projectType?: "app" | "repo-indexing";
|
|
662
|
+
/** Custom domains associated with this project. */
|
|
627
663
|
domains?: string[];
|
|
664
|
+
/** Whether the project is publicly accessible. */
|
|
628
665
|
accessMode?: "public" | "private";
|
|
666
|
+
/** Fine-grained access control configuration for the project. */
|
|
629
667
|
projectAccess?: ProjectAccessControl;
|
|
630
668
|
settings: {
|
|
669
|
+
/** When true, this is a native (mobile/desktop) app with no web dev server. */
|
|
631
670
|
isNativeApp?: boolean;
|
|
671
|
+
/** When true, automatically detect the dev server URL from command output (Desktop app only). */
|
|
632
672
|
autoDetectDevServer?: boolean;
|
|
673
|
+
/** Regex patterns matched against dev command output to detect the server URL. */
|
|
633
674
|
autoDetectDevServerPatterns?: string[];
|
|
675
|
+
/** Execution environment for the Fusion runtime (cloud, containerized, container-less). */
|
|
634
676
|
fusionEnvironment?: FusionExecutionEnvironment;
|
|
677
|
+
/** Port the dev server listens on inside the container. Use 0 for auto-assign. Default: 3000. */
|
|
635
678
|
devServerPort?: number;
|
|
679
|
+
/** @internal Explicit dev server URL; overrides auto-detection. Set by the system, not user-configurable. */
|
|
636
680
|
devServerUrl?: string;
|
|
681
|
+
/** @internal Whether to reload the preview when files change. Managed by the app UI. */
|
|
637
682
|
refreshPreview?: boolean;
|
|
683
|
+
/** Commands to install dependencies before starting the dev server (e.g. "npm install"). */
|
|
638
684
|
installCommand?: string;
|
|
685
|
+
/** @internal Command to run validation checks. Used internally by the setup agent. */
|
|
639
686
|
validateCommand?: string;
|
|
687
|
+
/** @internal URL origin used for the dev server proxy. Related to Electron proxy configuration. Exposed via specific UI; not a free-text field. */
|
|
640
688
|
proxyOrigin?: string;
|
|
689
|
+
/** @internal Default proxy origin, resolved at runtime. */
|
|
641
690
|
proxyDefaultOrigin?: string;
|
|
691
|
+
/** @internal Mode for automatically pushing AI commits. Managed by the app. */
|
|
642
692
|
defaultAutoPush?: AutoPushMode;
|
|
693
|
+
/** How branch names are generated: ai-session ID, descriptive name, or a custom pattern. */
|
|
643
694
|
gitBranchNamingStrategy?: "ai-session" | "branch-name" | "custom";
|
|
695
|
+
/** @internal Mise tools and custom scripts run before the setup command. Managed via builder.config.json. */
|
|
644
696
|
setupDependencies?: SetupDependency[];
|
|
697
|
+
/** Custom branch name pattern used when gitBranchNamingStrategy is "custom". */
|
|
645
698
|
gitBranchNamingCustom?: string;
|
|
699
|
+
/** When true, the user is prompted to provide a branch name before a new branch is created. */
|
|
646
700
|
askUserForBranchName?: boolean;
|
|
701
|
+
/** Command to start the dev server (e.g. "npm run dev"). */
|
|
647
702
|
devServerCommand?: string;
|
|
703
|
+
/** CPU tier for the container: "performance", "standard", or "shared". */
|
|
648
704
|
cpuKind?: CpuKind;
|
|
705
|
+
/** Number of vCPUs allocated to the container: 1, 2, or 4. */
|
|
649
706
|
cpus?: 1 | 2 | 4;
|
|
707
|
+
/** RAM allocated to the container in MB. Higher values (8192/16384) are enterprise-only. Default: 4096. */
|
|
650
708
|
memory?: 2048 | 4096 | 8192 | 16384;
|
|
651
|
-
/** @deprecated */
|
|
709
|
+
/** @deprecated Use {@link memory} instead. */
|
|
652
710
|
memoryLimit?: 1024 | 2048 | 4096 | 8192 | 16384;
|
|
711
|
+
/** Idle behavior for the container: stop, suspend, or stay on. Default: "suspend". */
|
|
653
712
|
autoStop?: MachineAutoStop;
|
|
713
|
+
/** Base branch used when cloning and creating new branches. Default: "main". */
|
|
654
714
|
mainBranchName?: string;
|
|
715
|
+
/** Minimum number of machines kept alive at all times. Default: 0. */
|
|
655
716
|
minMachinesRunning?: number;
|
|
717
|
+
/** Persistent disk size in GB. Default: 5. */
|
|
656
718
|
volumeSize?: 5 | 10 | 12 | 15 | 20 | 25 | 30 | 50;
|
|
719
|
+
/** @internal Subpath within the repository to use as the working root. */
|
|
657
720
|
includePath?: string;
|
|
721
|
+
/** Glob patterns limiting which paths are included when cloning or processing. */
|
|
658
722
|
includePatterns?: string[];
|
|
723
|
+
/** Environment variables injected into the dev container. */
|
|
659
724
|
environmentVariables?: EnvironmentVariable[];
|
|
725
|
+
/** Files injected into the container during setup, written before installCommand runs. */
|
|
660
726
|
fileOverrides?: FileOverride[];
|
|
727
|
+
/** Structured instruction rules applied to AI sessions (name, content, scope, tool allowlists). */
|
|
661
728
|
customInstructions?: CustomInstruction[];
|
|
729
|
+
/** Definitions for specialized sub-agents with custom system prompts, tools, and model overrides. */
|
|
662
730
|
customAgents?: CustomAgentDefinition[];
|
|
731
|
+
/** How the AI commits changes: direct commits, draft PRs, or ready-for-review PRs. Default: "draft-prs". */
|
|
663
732
|
commitMode?: CommitMode;
|
|
733
|
+
/** Default visibility for new branches: shared (team-visible) or private. Default: "private". */
|
|
664
734
|
defaultBranchType?: "shared" | "private";
|
|
735
|
+
/** Custom container image path (e.g. ghcr.io/org/image:tag). Overrides nodeVersion when set. */
|
|
665
736
|
dockerImagePath?: string;
|
|
737
|
+
/** Node.js version to use in the container (e.g. "22"). Ignored when dockerImagePath is set. */
|
|
666
738
|
nodeVersion?: string;
|
|
739
|
+
/** Named design systems to expose for AI assistance. */
|
|
667
740
|
designSystems?: string[];
|
|
741
|
+
/** @internal Use @antfu/ni for package management instead of direct npm/yarn/pnpm commands. */
|
|
668
742
|
useNI?: boolean;
|
|
743
|
+
/** Additional repositories cloned alongside the main repo for extra AI context. */
|
|
669
744
|
folders?: Array<{
|
|
745
|
+
/** Identifier for this workspace folder (kebab/snake case recommended). */
|
|
670
746
|
name: string;
|
|
747
|
+
/** Full clone URL of the repository (must end in .git for GitHub/GitLab). */
|
|
671
748
|
remoteUrl: string;
|
|
749
|
+
/** Base branch to clone. Default: "main". */
|
|
672
750
|
mainBranchName?: string;
|
|
751
|
+
/** Subpath within this repo to use as the working root. */
|
|
673
752
|
includePath?: string;
|
|
753
|
+
/** User ID of whoever added this folder. */
|
|
674
754
|
addedBy?: string;
|
|
755
|
+
/** Detected or specified git provider. */
|
|
675
756
|
repoProvider?: string;
|
|
757
|
+
/** Clone protocol: "https" or "ssh". */
|
|
676
758
|
repoProtocol?: string;
|
|
759
|
+
/** Whether to track git history for this folder. */
|
|
677
760
|
enableGit?: boolean;
|
|
678
761
|
}>;
|
|
762
|
+
/** Freeform workspace-level AI instructions, equivalent to an AGENTS.md file. */
|
|
679
763
|
agentsMD?: string;
|
|
764
|
+
/** One-time command run after the repo is first cloned, before installCommand. */
|
|
680
765
|
initializationCommand?: string;
|
|
766
|
+
/** @internal Subpath within the repo recommended by auto-detection as the project root. */
|
|
681
767
|
repoSubpath?: string;
|
|
768
|
+
/** @internal Workspace root recommended by auto-setup analysis; not user-configurable. */
|
|
682
769
|
recommendedRoot?: string;
|
|
770
|
+
/** Enable HTTPS for the dev server proxy. Default: false. */
|
|
683
771
|
https?: boolean;
|
|
772
|
+
/** Custom local domain for HTTPS (e.g. "myapp.local"). */
|
|
684
773
|
localHttpsDomain?: string;
|
|
774
|
+
/** Browser automation configuration for AI-driven end-to-end testing and visual verification. */
|
|
685
775
|
browserAutomation?: {
|
|
776
|
+
/** Run browser automation tasks as background agents. */
|
|
686
777
|
backgroundAgents?: boolean;
|
|
778
|
+
/** Custom instructions for the browser agent. */
|
|
687
779
|
instructions?: string;
|
|
780
|
+
/** Username for sites requiring authentication. */
|
|
688
781
|
authUser?: string;
|
|
782
|
+
/** Password for sites requiring authentication. */
|
|
689
783
|
authPassword?: string;
|
|
690
784
|
};
|
|
785
|
+
/** Automated PR reviewer configuration. */
|
|
691
786
|
prReviewer?: {
|
|
787
|
+
/** Whether the automated reviewer is enabled. */
|
|
692
788
|
enabled: boolean;
|
|
789
|
+
/** Custom review guidelines for the reviewer. */
|
|
693
790
|
instructions?: string;
|
|
791
|
+
/** How deeply to review: "low", "medium" (default), or "high". */
|
|
694
792
|
reviewEffort?: ReviewEffort;
|
|
695
793
|
};
|
|
794
|
+
/** Enable volume snapshots so session state can be saved and restored. */
|
|
696
795
|
enableSnapshots?: boolean;
|
|
796
|
+
/** When true, the AI captures memories after a branch is merged for use in future sessions. */
|
|
697
797
|
postMergeMemories?: boolean;
|
|
798
|
+
/** @internal Custom instructions for AI-generated commit messages. */
|
|
698
799
|
commitInstructions?: string;
|
|
800
|
+
/** Maximum number of AI completions allowed per agent session. */
|
|
699
801
|
maxAgentCompletions?: number;
|
|
802
|
+
/** @internal Bypass command security restrictions. Admin use only. */
|
|
700
803
|
skipCommandSecurity?: boolean;
|
|
804
|
+
/** File path to the HTTPS private key. */
|
|
701
805
|
httpsServerKeyPath?: string;
|
|
806
|
+
/** File path to the HTTPS certificate. */
|
|
702
807
|
httpsServerCertPath?: string;
|
|
808
|
+
/** File path to the HTTPS CA certificate. */
|
|
703
809
|
httpsServerCaPath?: string;
|
|
810
|
+
/** HTTPS private key content as a string (alternative to httpsServerKeyPath). */
|
|
704
811
|
httpsServerKeyContent?: string;
|
|
812
|
+
/** HTTPS certificate content as a string (alternative to httpsServerCertPath). */
|
|
705
813
|
httpsServerCertContent?: string;
|
|
814
|
+
/** HTTPS CA certificate content as a string (alternative to httpsServerCaPath). */
|
|
706
815
|
httpsServerCaContent?: string;
|
|
816
|
+
/** PFX/PKCS12 bundle for HTTPS. */
|
|
707
817
|
httpsServerPfx?: string;
|
|
818
|
+
/** Passphrase for an encrypted HTTPS private key or PFX. */
|
|
708
819
|
httpsServerPassphrase?: string;
|
|
820
|
+
/** Secure protocol string passed to Node.js https.createServer (e.g. "TLSv1_2_method"). */
|
|
709
821
|
httpsServerSecureProtocol?: string;
|
|
822
|
+
/** Numeric TLS options bitmask passed to Node.js https.createServer. */
|
|
710
823
|
httpsServerSecureOptions?: number;
|
|
824
|
+
/** Cipher suite string (OpenSSL format) for the HTTPS server. */
|
|
711
825
|
httpsServerCiphers?: string;
|
|
826
|
+
/** When true, the server's cipher order takes precedence over the client's. */
|
|
712
827
|
httpsServerHonorCipherOrder?: boolean;
|
|
828
|
+
/** When true, the server requests a client certificate. */
|
|
713
829
|
httpsServerRequestCert?: boolean;
|
|
830
|
+
/** When false, self-signed or untrusted client certificates are accepted. */
|
|
714
831
|
httpsServerRejectUnauthorized?: boolean;
|
|
715
832
|
/**
|
|
716
833
|
* When true, this project is the preferred project for its connected repository.
|
|
@@ -720,23 +837,35 @@ export interface Project {
|
|
|
720
837
|
/** Single tenancy config ID for this project. Overrides the space-level defaultSingleTenancyConfig.
|
|
721
838
|
* References a document in the singleTenancyConfigurations collection. */
|
|
722
839
|
singleTenancyConfig?: string;
|
|
840
|
+
/** Password-protect the preview URL. */
|
|
723
841
|
previewPasswordProtection?: PreviewPasswordProtection;
|
|
724
842
|
};
|
|
843
|
+
/** URL of the project's screenshot thumbnail, or null if none has been captured. */
|
|
725
844
|
screenshot: string | null;
|
|
845
|
+
/** When true, this project is a built-in example shown to new users. */
|
|
726
846
|
isExample?: boolean;
|
|
847
|
+
/** When true, the project is publicly accessible without authentication. */
|
|
727
848
|
isPublic?: boolean;
|
|
849
|
+
/** Volume snapshot metadata for restoring container state. */
|
|
728
850
|
snapshotVolume?: {
|
|
851
|
+
/** Fly.io volume identifier. */
|
|
729
852
|
volumeId: string;
|
|
853
|
+
/** Fly.io app name associated with the snapshot. */
|
|
730
854
|
appName: string;
|
|
855
|
+
/** Unix timestamp (ms) when the snapshot was created. */
|
|
731
856
|
createdAt: number;
|
|
732
857
|
};
|
|
858
|
+
/** When true, this project was created from a user-defined template. */
|
|
733
859
|
isFromUserTemplate?: boolean;
|
|
860
|
+
/** ID of the template used to create this project, if any. */
|
|
734
861
|
templateId?: string | null;
|
|
862
|
+
/** Local filesystem path for desktop-app projects. */
|
|
735
863
|
localPath?: string | null;
|
|
736
864
|
/** The state of the project. Use `isProjectDeleted()` helper for backwards-compatible checks. */
|
|
737
865
|
state?: EntityState;
|
|
738
866
|
/** MIGRATION: accepts both string and number during migration period */
|
|
739
867
|
deletedAt?: InMigrationDateNullable;
|
|
868
|
+
/** User ID of whoever deleted the project. */
|
|
740
869
|
deletedBy?: string;
|
|
741
870
|
/**
|
|
742
871
|
* When true, branches are stored in the standalone `branches` collection
|
package/src/projects.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
/**
|
|
2
3
|
* Detect git provider from a repository URL (HTTPS or SSH).
|
|
3
4
|
* Used by both error diagnostics and connectivity checks for consistent provider labeling.
|
|
@@ -33,8 +34,31 @@ export const EXAMPLE_REPOS = [
|
|
|
33
34
|
"BuilderIO/org-agent-starter",
|
|
34
35
|
];
|
|
35
36
|
export const STARTER_REPO = "BuilderIO/fusion-starter";
|
|
37
|
+
export const DSI_PREVIEW_REPO = "BuilderIO/dsi-starter";
|
|
36
38
|
export const EXAMPLE_OR_STARTER_REPOS = [...EXAMPLE_REPOS, STARTER_REPO];
|
|
37
39
|
export const EXAMPLE_OR_STARTER_REPOS_URLS = EXAMPLE_OR_STARTER_REPOS.map((repo) => `https://github.com/${repo}`);
|
|
40
|
+
export const SetupMiseDependencySchema = z
|
|
41
|
+
.object({
|
|
42
|
+
key: z.string(),
|
|
43
|
+
type: z.literal("mise"),
|
|
44
|
+
tool: z.string(),
|
|
45
|
+
version: z.string().optional(),
|
|
46
|
+
})
|
|
47
|
+
.meta({ title: "SetupMiseDependency" });
|
|
48
|
+
export const SetupScriptDependencySchema = z
|
|
49
|
+
.object({
|
|
50
|
+
key: z.string(),
|
|
51
|
+
type: z.literal("script"),
|
|
52
|
+
name: z.string(),
|
|
53
|
+
script: z.string(),
|
|
54
|
+
})
|
|
55
|
+
.meta({ title: "SetupScriptDependency" });
|
|
56
|
+
export const SetupDependencySchema = z
|
|
57
|
+
.discriminatedUnion("type", [
|
|
58
|
+
SetupMiseDependencySchema,
|
|
59
|
+
SetupScriptDependencySchema,
|
|
60
|
+
])
|
|
61
|
+
.meta({ title: "SetupDependency" });
|
|
38
62
|
export const checkIsNewBranch = (branch) => {
|
|
39
63
|
return "projectId" in branch;
|
|
40
64
|
};
|