@builder.io/ai-utils 0.83.0 → 0.84.0-dev.202607212345.137e4170f
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/acl-schema.d.ts +88 -0
- package/src/acl-schema.js +71 -0
- package/src/claw.d.ts +1 -0
- package/src/claw.js +9 -0
- package/src/claw.spec.js +11 -1
- package/src/codegen.d.ts +11 -0
- package/src/codegen.js +21 -1
- package/src/design-systems.d.ts +160 -60
- package/src/design-systems.js +91 -39
- package/src/events.d.ts +32 -1
- package/src/events.js +8 -0
- package/src/perf-report.d.ts +116 -0
- package/src/perf-report.js +122 -0
- package/src/projects.d.ts +111 -4
- package/src/projects.js +89 -2
- package/src/repo-indexing.d.ts +12 -0
- package/src/vpc-peering.d.ts +49 -0
- package/src/vpc-peering.js +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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" });
|
package/src/claw.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ export type ChannelType<P extends KnownPlatform> = (typeof CHANNEL_TYPES)[P][num
|
|
|
101
101
|
/** Union of every channel sub-type across all platforms. */
|
|
102
102
|
export type AnyChannelType = ChannelType<KnownPlatform>;
|
|
103
103
|
export declare function isChannelType<P extends KnownPlatform>(platform: P, type: string): type is ChannelType<P>;
|
|
104
|
+
export declare function isBuilderBranchChannelId(channelId: string): boolean;
|
|
104
105
|
/** Platform recorded on a logged message; "unknown" when the channelId fails to parse. */
|
|
105
106
|
export type ChannelSource = KnownPlatform | "unknown";
|
|
106
107
|
/** Channel sub-type recorded on a logged message; "unknown" when parsing fails. */
|
package/src/claw.js
CHANGED
|
@@ -81,6 +81,15 @@ export const CHANNEL_TYPES = {
|
|
|
81
81
|
export function isChannelType(platform, type) {
|
|
82
82
|
return CHANNEL_TYPES[platform].includes(type);
|
|
83
83
|
}
|
|
84
|
+
export function isBuilderBranchChannelId(channelId) {
|
|
85
|
+
try {
|
|
86
|
+
const channel = parseChannelId(channelId);
|
|
87
|
+
return channel.platform === "builder" && channel.type === "branch";
|
|
88
|
+
}
|
|
89
|
+
catch (_a) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
84
93
|
/**
|
|
85
94
|
* Converts a Builder channel_id URI to a clickable URL for the
|
|
86
95
|
* corresponding platform (Slack, Jira, etc.).
|
package/src/claw.spec.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { convertChannelIdToUrl, formatIncomingMessage, formatWorkerMessage, formatWorkerReport, } from "./claw";
|
|
2
|
+
import { convertChannelIdToUrl, formatIncomingMessage, formatWorkerMessage, formatWorkerReport, isBuilderBranchChannelId, } from "./claw";
|
|
3
|
+
describe("isBuilderBranchChannelId", () => {
|
|
4
|
+
it("recognizes Builder branch channel IDs", () => {
|
|
5
|
+
expect(isBuilderBranchChannelId("builder/branch/proj-id/my-branch")).toBe(true);
|
|
6
|
+
});
|
|
7
|
+
it("rejects other and invalid channel IDs", () => {
|
|
8
|
+
expect(isBuilderBranchChannelId("slack/channel/team/channel")).toBe(false);
|
|
9
|
+
expect(isBuilderBranchChannelId("builder/project/proj-id")).toBe(false);
|
|
10
|
+
expect(isBuilderBranchChannelId("invalid")).toBe(false);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
3
13
|
describe("convertChannelIdToUrl", () => {
|
|
4
14
|
describe("slack/thread format", () => {
|
|
5
15
|
it("converts a thread channel ID to a Slack app_redirect URL", () => {
|
package/src/codegen.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { type EnvironmentVariable, type SetupDependency } from "./common-schemas
|
|
|
6
6
|
import type { ForcedBackup, GitDiagnostics, ProjectSkill } from "./projects";
|
|
7
7
|
import type { Feature } from "./features";
|
|
8
8
|
import type { CpuKind, BranchType } from "./projects";
|
|
9
|
+
import type { FullLibrarySourceInput } from "./design-systems";
|
|
9
10
|
export declare const GitSnapshotSchema: z.ZodString;
|
|
10
11
|
export type GitSnapshot = z.infer<typeof GitSnapshotSchema>;
|
|
11
12
|
export declare const ImportTypeSchema: z.ZodEnum<{
|
|
@@ -229,6 +230,10 @@ export declare const DevServerLogsInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
|
229
230
|
export type DevServerLogsInput = z.infer<typeof DevServerLogsInputSchema>;
|
|
230
231
|
export declare const GenerateDesignSystemAgentMdInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
231
232
|
export type GenerateDesignSystemAgentMdInput = z.infer<typeof GenerateDesignSystemAgentMdInputSchema>;
|
|
233
|
+
export declare const ComputeDocHashInputSchema: z.ZodObject<{
|
|
234
|
+
relevantFiles: z.ZodArray<z.ZodString>;
|
|
235
|
+
}, z.core.$strip>;
|
|
236
|
+
export type ComputeDocHashInput = z.infer<typeof ComputeDocHashInputSchema>;
|
|
232
237
|
export declare const DevServerRestartInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
233
238
|
export type DevServerRestartInput = z.infer<typeof DevServerRestartInputSchema>;
|
|
234
239
|
export declare const BashToolInputSchema: z.ZodObject<{
|
|
@@ -1974,6 +1979,9 @@ export declare const CodeGenToolMapSchema: z.ZodObject<{
|
|
|
1974
1979
|
purpose: z.ZodOptional<z.ZodString>;
|
|
1975
1980
|
}, z.core.$strip>;
|
|
1976
1981
|
GenerateDesignSystemAgentMd: z.ZodObject<{}, z.core.$strip>;
|
|
1982
|
+
ComputeDocHash: z.ZodObject<{
|
|
1983
|
+
relevantFiles: z.ZodArray<z.ZodString>;
|
|
1984
|
+
}, z.core.$strip>;
|
|
1977
1985
|
}, z.core.$strip>;
|
|
1978
1986
|
export type CodeGenToolMap = z.infer<typeof CodeGenToolMapSchema>;
|
|
1979
1987
|
export declare const CodeGenToolsSchema: z.ZodEnum<{
|
|
@@ -1984,6 +1992,7 @@ export declare const CodeGenToolsSchema: z.ZodEnum<{
|
|
|
1984
1992
|
AskUserQuestion: "AskUserQuestion";
|
|
1985
1993
|
Bash: "Bash";
|
|
1986
1994
|
BuilderEdit: "BuilderEdit";
|
|
1995
|
+
ComputeDocHash: "ComputeDocHash";
|
|
1987
1996
|
ConnectMCP: "ConnectMCP";
|
|
1988
1997
|
CreateProject: "CreateProject";
|
|
1989
1998
|
DevServerControl: "DevServerControl";
|
|
@@ -2708,6 +2717,7 @@ export declare const CodeGenInputOptionsSchema: z.ZodObject<{
|
|
|
2708
2717
|
AskUserQuestion: "AskUserQuestion";
|
|
2709
2718
|
Bash: "Bash";
|
|
2710
2719
|
BuilderEdit: "BuilderEdit";
|
|
2720
|
+
ComputeDocHash: "ComputeDocHash";
|
|
2711
2721
|
ConnectMCP: "ConnectMCP";
|
|
2712
2722
|
CreateProject: "CreateProject";
|
|
2713
2723
|
DevServerControl: "DevServerControl";
|
|
@@ -4235,6 +4245,7 @@ export interface FusionConfig {
|
|
|
4235
4245
|
* `branchType === "design-system-indexing"` branches.
|
|
4236
4246
|
*/
|
|
4237
4247
|
figmaDecodeJobId?: string;
|
|
4248
|
+
designSystemIndexSources?: FullLibrarySourceInput[];
|
|
4238
4249
|
featureBranch?: string;
|
|
4239
4250
|
/** When set, init checks out this exact git commit after cloning featureBranch. */
|
|
4240
4251
|
checkoutCommit?: string;
|
package/src/codegen.js
CHANGED
|
@@ -211,6 +211,25 @@ export const GenerateDesignSystemAgentMdInputSchema = z.object({}).meta({
|
|
|
211
211
|
" globs `.builder/output/tokens/components/*.css` for component slugs." +
|
|
212
212
|
" Call this as the final step after all CSS files have been written.",
|
|
213
213
|
});
|
|
214
|
+
export const ComputeDocHashInputSchema = z
|
|
215
|
+
.object({
|
|
216
|
+
relevantFiles: z
|
|
217
|
+
.array(z.string())
|
|
218
|
+
.min(1)
|
|
219
|
+
.meta({
|
|
220
|
+
description: "Workspace-relative paths of the source files that define this doc" +
|
|
221
|
+
" (the same `relevantFiles` recorded in the doc's meta.json). The" +
|
|
222
|
+
" hash is computed deterministically from these files' contents.",
|
|
223
|
+
}),
|
|
224
|
+
})
|
|
225
|
+
.meta({
|
|
226
|
+
title: "ComputeDocHashInput",
|
|
227
|
+
description: "Deterministically computes the content hash for an indexed design-system" +
|
|
228
|
+
" doc from its `relevantFiles`, using the exact algorithm the repo-indexing" +
|
|
229
|
+
" CLI uses (sorted files, BOM-stripped contents joined with newlines," +
|
|
230
|
+
" SHA-256). Use this to fill the `hash` field of a component/token/icon" +
|
|
231
|
+
" meta.json — never invent a hash yourself.",
|
|
232
|
+
});
|
|
214
233
|
export const DevServerRestartInputSchema = z.object({}).meta({
|
|
215
234
|
title: "DevServerRestartInput",
|
|
216
235
|
description: "Restarts the dev server with current configuration.",
|
|
@@ -1229,7 +1248,7 @@ export const SendMessageToolInputSchema = z
|
|
|
1229
1248
|
description: "When true, send the response as a voice message using text-to-speech. Only supported for Telegram channels. Only set to true when the user's original message was a voice/audio message (look for '[Voice message transcription]' or '[Audio' markers), the channel is Telegram, and the response is short and conversational with no URLs, code, lists, or other content that doesn't translate to audio. Default to false (text) for all text-originated messages.",
|
|
1230
1249
|
}),
|
|
1231
1250
|
from_user_id: z.string().optional().meta({
|
|
1232
|
-
description: "Builder.io user ID this message is from / should be attributed to. Only allowed when channel_id is 'builder/branch/{project_id}/{branch_name}'. When set, the message is delivered to the target branch as coming from this user (role 'user') instead of from the agent.
|
|
1251
|
+
description: "Builder.io user ID this message is from / should be attributed to. Only allowed when channel_id is 'builder/branch/{project_id}/{branch_name}'. When set, the message is delivered to the target branch as coming from this user (role 'user') instead of from the agent. Defaults to the current requester when omitted. Set this explicitly when relaying a message on behalf of someone other than the person who sent the current message — even if it was composed, summarized, or merged from multiple people.",
|
|
1233
1252
|
}),
|
|
1234
1253
|
})
|
|
1235
1254
|
.meta({ title: "SendMessageToolInput" });
|
|
@@ -1587,6 +1606,7 @@ export const CodeGenToolMapSchema = z.object({
|
|
|
1587
1606
|
EnsurePR: EnsurePRToolInputSchema,
|
|
1588
1607
|
EnableDatabase: EnableDatabaseToolInputSchema,
|
|
1589
1608
|
GenerateDesignSystemAgentMd: GenerateDesignSystemAgentMdInputSchema,
|
|
1609
|
+
ComputeDocHash: ComputeDocHashInputSchema,
|
|
1590
1610
|
});
|
|
1591
1611
|
export const CodeGenToolsSchema = CodeGenToolMapSchema.keyof().meta({
|
|
1592
1612
|
title: "CodeGenTools",
|
package/src/design-systems.d.ts
CHANGED
|
@@ -11,64 +11,21 @@ export interface FigmaHydrationResponse {
|
|
|
11
11
|
manifest: import("./events.js").FigmaFrameManifest | null;
|
|
12
12
|
files: FigmaHydrationFile[];
|
|
13
13
|
}
|
|
14
|
-
export type GenerateDesignSystemAttachmentKind = "fig" | "image" | "pdf" | "text";
|
|
15
|
-
export interface GenerateDesignSystemFormFields {
|
|
16
|
-
/**
|
|
17
|
-
* Human-friendly project name. If omitted, the server generates one from
|
|
18
|
-
* the uploaded `.fig` filenames.
|
|
19
|
-
*/
|
|
20
|
-
projectName?: string;
|
|
21
|
-
devToolsVersion?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Optional map of filename → page/frame GUIDs to restrict indexing.
|
|
24
|
-
* GUIDs are file-local, so they must be scoped per attachment.
|
|
25
|
-
*/
|
|
26
|
-
selection?: Record<string, string[]>;
|
|
27
|
-
githubRepoUrl?: string;
|
|
28
|
-
/** Id of a connected Fusion project whose repo is cloned as supplementary context. Takes precedence over `githubRepoUrl`. */
|
|
29
|
-
connectedProjectId?: string;
|
|
30
|
-
}
|
|
31
14
|
/**
|
|
32
15
|
* Accepts `https://github.com/<owner>/<repo>` (optionally with a trailing
|
|
33
|
-
* `.git` or path segments). Used to gate
|
|
34
|
-
* `/design-systems/v1/generate` endpoint.
|
|
16
|
+
* `.git` or path segments). Used to gate public-repo inputs before cloning.
|
|
35
17
|
*/
|
|
36
18
|
export declare const GITHUB_REPO_URL_REGEX: RegExp;
|
|
37
|
-
export interface GenerateDesignSystemRequest extends GenerateDesignSystemFormFields {
|
|
38
|
-
attachments: File[];
|
|
39
|
-
}
|
|
40
|
-
export interface GenerateDesignSystemResponse {
|
|
41
|
-
projectId: string;
|
|
42
|
-
/**
|
|
43
|
-
* Decode job id. Attachments are processed asynchronously in the
|
|
44
|
-
* `ai-queue-subscribers` worker. Clients should listen on the
|
|
45
|
-
* `figmaDecodeJobs/{jobId}` Firestore document for progress and the
|
|
46
|
-
* resolved `branchName` / `branchUrl`.
|
|
47
|
-
*/
|
|
48
|
-
jobId: string;
|
|
49
|
-
designSystemId: string;
|
|
50
|
-
}
|
|
51
|
-
export interface GenerateDesignSystemErrorResponse {
|
|
52
|
-
error: string | Record<string, unknown>;
|
|
53
|
-
}
|
|
54
19
|
export declare const GENERATE_DESIGN_SYSTEM_MAX_FILE_BYTES: number;
|
|
55
20
|
export declare const GENERATE_DESIGN_SYSTEM_MAX_ATTACHMENTS = 50;
|
|
56
21
|
export declare const GENERATE_DESIGN_SYSTEM_MIN_ATTACHMENTS = 0;
|
|
57
|
-
export declare const generateDesignSystemBodySchema: z.ZodObject<{
|
|
58
|
-
projectName: z.ZodOptional<z.ZodString>;
|
|
59
|
-
devToolsVersion: z.ZodOptional<z.ZodString>;
|
|
60
|
-
selection: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>>;
|
|
61
|
-
githubRepoUrl: z.ZodOptional<z.ZodString>;
|
|
62
|
-
connectedProjectId: z.ZodOptional<z.ZodString>;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
export type GenerateDesignSystemBody = z.infer<typeof generateDesignSystemBodySchema>;
|
|
65
22
|
/**
|
|
66
23
|
* Signed-URL upload flow.
|
|
67
24
|
*
|
|
68
25
|
* Clients no longer post `.fig` bytes through the service (Cloud Run caps
|
|
69
26
|
* request bodies at 32 MiB). Instead they call `upload/start` to get a
|
|
70
27
|
* temporary signed resumable-upload URL per attachment, stream the bytes
|
|
71
|
-
* directly to GCS, then call `/
|
|
28
|
+
* directly to GCS, then call `/index` with the returned upload tokens.
|
|
72
29
|
* See `tech-specs/signed-url-figma-upload`.
|
|
73
30
|
*/
|
|
74
31
|
/** A single attachment the client declares when starting an upload. */
|
|
@@ -89,7 +46,7 @@ export declare const uploadStartBodySchema: z.ZodObject<{
|
|
|
89
46
|
export type UploadStartBody = z.infer<typeof uploadStartBodySchema>;
|
|
90
47
|
/**
|
|
91
48
|
* Claims encoded inside a signed `uploadToken`. Bound to the GCS object at
|
|
92
|
-
* `upload/start` and verified at `/
|
|
49
|
+
* `upload/start` and verified at `/index`, so a client cannot point the
|
|
93
50
|
* decode worker at an object it did not upload.
|
|
94
51
|
*/
|
|
95
52
|
export declare const uploadTokenPayloadSchema: z.ZodObject<{
|
|
@@ -106,24 +63,167 @@ export interface UploadStartResponseItem {
|
|
|
106
63
|
idx: number;
|
|
107
64
|
/** Signed URL the client POSTs to (with `x-goog-resumable: start`) to begin the resumable upload. */
|
|
108
65
|
uploadUrl: string;
|
|
109
|
-
/** Opaque signed token the client passes back to `/
|
|
66
|
+
/** Opaque signed token the client passes back to `/index`. */
|
|
110
67
|
uploadToken: string;
|
|
111
68
|
}
|
|
112
69
|
export interface UploadStartResponse {
|
|
113
70
|
jobId: string;
|
|
114
71
|
uploads: UploadStartResponseItem[];
|
|
115
72
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
export
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
73
|
+
export declare const indexDesignSystemScopeSchema: z.ZodEnum<{
|
|
74
|
+
global: "global";
|
|
75
|
+
organization: "organization";
|
|
76
|
+
space: "space";
|
|
77
|
+
}>;
|
|
78
|
+
export type IndexDesignSystemScope = z.infer<typeof indexDesignSystemScopeSchema>;
|
|
79
|
+
export declare const fullLibrarySourceKindSchema: z.ZodEnum<{
|
|
80
|
+
"connected-repo": "connected-repo";
|
|
81
|
+
package: "package";
|
|
82
|
+
"public-repo": "public-repo";
|
|
83
|
+
}>;
|
|
84
|
+
export type FullLibrarySourceKind = z.infer<typeof fullLibrarySourceKindSchema>;
|
|
85
|
+
export declare const fullLibrarySourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
86
|
+
kind: z.ZodLiteral<"connected-repo">;
|
|
87
|
+
fusionProjectId: z.ZodString;
|
|
88
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
89
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
90
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
92
|
+
kind: z.ZodLiteral<"public-repo">;
|
|
93
|
+
repoUrl: z.ZodString;
|
|
94
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
95
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
96
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
97
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
98
|
+
kind: z.ZodLiteral<"package">;
|
|
99
|
+
package: z.ZodString;
|
|
100
|
+
registry: z.ZodOptional<z.ZodString>;
|
|
101
|
+
token: z.ZodOptional<z.ZodString>;
|
|
102
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strip>], "kind">;
|
|
104
|
+
export type FullLibrarySourceInput = z.infer<typeof fullLibrarySourceSchema>;
|
|
105
|
+
export type ConnectedRepoSourceInput = Extract<FullLibrarySourceInput, {
|
|
106
|
+
kind: "connected-repo";
|
|
107
|
+
}>;
|
|
108
|
+
export type PublicRepoSourceInput = Extract<FullLibrarySourceInput, {
|
|
109
|
+
kind: "public-repo";
|
|
110
|
+
}>;
|
|
111
|
+
export type PackageSourceInput = Extract<FullLibrarySourceInput, {
|
|
112
|
+
kind: "package";
|
|
113
|
+
}>;
|
|
114
|
+
export declare const fileSourceSchema: z.ZodObject<{
|
|
115
|
+
kind: z.ZodLiteral<"file">;
|
|
116
|
+
uploadToken: z.ZodOptional<z.ZodString>;
|
|
117
|
+
uploadGcsPath: z.ZodOptional<z.ZodString>;
|
|
118
|
+
selection: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
119
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
export type FileSourceInput = z.infer<typeof fileSourceSchema>;
|
|
122
|
+
export declare const designSystemSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
123
|
+
kind: z.ZodLiteral<"connected-repo">;
|
|
124
|
+
fusionProjectId: z.ZodString;
|
|
125
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
126
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
127
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
129
|
+
kind: z.ZodLiteral<"public-repo">;
|
|
130
|
+
repoUrl: z.ZodString;
|
|
131
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
132
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
133
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
134
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
135
|
+
kind: z.ZodLiteral<"package">;
|
|
136
|
+
package: z.ZodString;
|
|
137
|
+
registry: z.ZodOptional<z.ZodString>;
|
|
138
|
+
token: z.ZodOptional<z.ZodString>;
|
|
139
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
140
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
141
|
+
kind: z.ZodLiteral<"file">;
|
|
142
|
+
uploadToken: z.ZodOptional<z.ZodString>;
|
|
143
|
+
uploadGcsPath: z.ZodOptional<z.ZodString>;
|
|
144
|
+
selection: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
145
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, z.core.$strip>], "kind">;
|
|
147
|
+
export type DesignSystemSourceInput = z.infer<typeof designSystemSourceSchema>;
|
|
148
|
+
export declare const resolvePackageOptionsSchema: z.ZodObject<{
|
|
149
|
+
package: z.ZodString;
|
|
150
|
+
registry: z.ZodOptional<z.ZodString>;
|
|
151
|
+
token: z.ZodOptional<z.ZodString>;
|
|
152
|
+
specifier: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, z.core.$strip>;
|
|
154
|
+
export type ResolvePackageOptions = z.infer<typeof resolvePackageOptionsSchema>;
|
|
155
|
+
export interface ResolvePackageResult {
|
|
156
|
+
/** Whether the package resolved successfully from the registry. */
|
|
157
|
+
ok: boolean;
|
|
158
|
+
package: string;
|
|
159
|
+
/** Registry actually queried (defaults to the public npm registry). */
|
|
160
|
+
registry: string;
|
|
161
|
+
/** Specifier requested (defaults to "latest"). */
|
|
162
|
+
specifier: string;
|
|
163
|
+
/** Concrete version the specifier resolved to, when ok. */
|
|
164
|
+
version?: string;
|
|
165
|
+
/** Tarball URL for the resolved version, when ok. */
|
|
166
|
+
tarball?: string;
|
|
167
|
+
/** Human-readable failure reason, when not ok. */
|
|
168
|
+
error?: string;
|
|
169
|
+
}
|
|
170
|
+
export declare const indexDesignSystemBodySchema: z.ZodObject<{
|
|
171
|
+
designSystemName: z.ZodOptional<z.ZodString>;
|
|
172
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
173
|
+
global: "global";
|
|
174
|
+
organization: "organization";
|
|
175
|
+
space: "space";
|
|
176
|
+
}>>;
|
|
177
|
+
sources: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
178
|
+
kind: z.ZodLiteral<"connected-repo">;
|
|
179
|
+
fusionProjectId: z.ZodString;
|
|
180
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
181
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
182
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
183
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
184
|
+
kind: z.ZodLiteral<"public-repo">;
|
|
185
|
+
repoUrl: z.ZodString;
|
|
186
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
187
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
188
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
189
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
190
|
+
kind: z.ZodLiteral<"package">;
|
|
191
|
+
package: z.ZodString;
|
|
192
|
+
registry: z.ZodOptional<z.ZodString>;
|
|
193
|
+
token: z.ZodOptional<z.ZodString>;
|
|
194
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
195
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
196
|
+
kind: z.ZodLiteral<"file">;
|
|
197
|
+
uploadToken: z.ZodOptional<z.ZodString>;
|
|
198
|
+
uploadGcsPath: z.ZodOptional<z.ZodString>;
|
|
199
|
+
selection: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
200
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
201
|
+
}, z.core.$strip>], "kind">>;
|
|
202
|
+
}, z.core.$strip>;
|
|
203
|
+
export type IndexDesignSystemBody = z.infer<typeof indexDesignSystemBodySchema>;
|
|
204
|
+
export declare const sourceFileEntrySchema: z.ZodObject<{
|
|
205
|
+
name: z.ZodString;
|
|
206
|
+
path: z.ZodString;
|
|
207
|
+
type: z.ZodEnum<{
|
|
208
|
+
dir: "dir";
|
|
209
|
+
file: "file";
|
|
210
|
+
}>;
|
|
211
|
+
}, z.core.$strip>;
|
|
212
|
+
export type SourceFileEntry = z.infer<typeof sourceFileEntrySchema>;
|
|
213
|
+
export declare const listSourceFilesQuerySchema: z.ZodObject<{
|
|
214
|
+
projectId: z.ZodString;
|
|
215
|
+
path: z.ZodOptional<z.ZodString>;
|
|
216
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
217
|
+
}, z.core.$strip>;
|
|
218
|
+
export type ListSourceFilesQuery = z.infer<typeof listSourceFilesQuerySchema>;
|
|
219
|
+
export interface ListSourceFilesResponse {
|
|
220
|
+
/** The directory that was listed (repo-relative; "" for root). */
|
|
221
|
+
path: string;
|
|
222
|
+
entries: SourceFileEntry[];
|
|
223
|
+
}
|
|
224
|
+
export declare const listPublicSourceFilesQuerySchema: z.ZodObject<{
|
|
225
|
+
repoUrl: z.ZodString;
|
|
226
|
+
path: z.ZodOptional<z.ZodString>;
|
|
227
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
128
228
|
}, z.core.$strip>;
|
|
129
|
-
export type
|
|
229
|
+
export type ListPublicSourceFilesQuery = z.infer<typeof listPublicSourceFilesQuerySchema>;
|