@builder.io/ai-utils 0.72.0 → 0.74.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/codegen.d.ts +106 -10
- package/src/codegen.js +49 -9
- package/src/design-systems.d.ts +63 -10
- package/src/design-systems.js +51 -7
- package/src/events.d.ts +2 -0
package/package.json
CHANGED
package/src/codegen.d.ts
CHANGED
|
@@ -28,6 +28,11 @@ export declare const ProjectFileSchema: z.ZodObject<{
|
|
|
28
28
|
virtual: z.ZodOptional<z.ZodBoolean>;
|
|
29
29
|
}, z.core.$strip>;
|
|
30
30
|
export type ProjectFile = z.infer<typeof ProjectFileSchema>;
|
|
31
|
+
export declare const CustomAgentInfoSchema: z.ZodObject<{
|
|
32
|
+
name: z.ZodString;
|
|
33
|
+
description: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type CustomAgentInfo = z.infer<typeof CustomAgentInfoSchema>;
|
|
31
36
|
export declare const CustomInstructionSchema: z.ZodObject<{
|
|
32
37
|
id: z.ZodString;
|
|
33
38
|
name: z.ZodString;
|
|
@@ -45,11 +50,16 @@ export declare const CustomInstructionSchema: z.ZodObject<{
|
|
|
45
50
|
disableModelInvocation: z.ZodOptional<z.ZodBoolean>;
|
|
46
51
|
userInvocable: z.ZodOptional<z.ZodBoolean>;
|
|
47
52
|
scope: z.ZodOptional<z.ZodEnum<{
|
|
53
|
+
builtin: "builtin";
|
|
48
54
|
plugin: "plugin";
|
|
49
55
|
project: "project";
|
|
50
56
|
user: "user";
|
|
51
57
|
}>>;
|
|
52
58
|
pluginName: z.ZodOptional<z.ZodString>;
|
|
59
|
+
ownedAgents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
60
|
+
name: z.ZodString;
|
|
61
|
+
description: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>>>;
|
|
53
63
|
}, z.core.$strip>;
|
|
54
64
|
export type CustomInstruction = z.infer<typeof CustomInstructionSchema>;
|
|
55
65
|
/** Reasoning effort level for LLM completions. */
|
|
@@ -64,11 +74,6 @@ export declare const ReasoningEffortSchema: z.ZodEnum<{
|
|
|
64
74
|
xhigh: "xhigh";
|
|
65
75
|
}>;
|
|
66
76
|
export type ReasoningEffort = z.infer<typeof ReasoningEffortSchema>;
|
|
67
|
-
export declare const CustomAgentInfoSchema: z.ZodObject<{
|
|
68
|
-
name: z.ZodString;
|
|
69
|
-
description: z.ZodOptional<z.ZodString>;
|
|
70
|
-
}, z.core.$strip>;
|
|
71
|
-
export type CustomAgentInfo = z.infer<typeof CustomAgentInfoSchema>;
|
|
72
77
|
/** Per-agent model overrides. String = fixed model, string[] = round-robin. */
|
|
73
78
|
export declare const AgentModelOverridesSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
74
79
|
export type AgentModelOverrides = z.infer<typeof AgentModelOverridesSchema>;
|
|
@@ -1295,6 +1300,28 @@ export declare const SubmitPRReviewToolInputSchema: z.ZodObject<{
|
|
|
1295
1300
|
}>>;
|
|
1296
1301
|
}, z.core.$strip>;
|
|
1297
1302
|
export type SubmitPRReviewToolInput = z.infer<typeof SubmitPRReviewToolInputSchema>;
|
|
1303
|
+
/**
|
|
1304
|
+
* AddComment - a generic, UI-only tool for attaching a typed comment to the
|
|
1305
|
+
* session. It never posts anywhere external; the service only validates the
|
|
1306
|
+
* call and the dev-tools CLI emits a `comment-added` step from the tool input
|
|
1307
|
+
* so the UI can render it. The `type` discriminates how the UI renders the
|
|
1308
|
+
* comment (e.g. `"code-review"`), and `metadata` carries type-specific fields.
|
|
1309
|
+
*
|
|
1310
|
+
* Example (code-review skill):
|
|
1311
|
+
* addComment({
|
|
1312
|
+
* type: "code-review",
|
|
1313
|
+
* content: "Unawaited async call will fail in serverless",
|
|
1314
|
+
* metadata: { filePath: "src/x.ts", startLine: 264, endLine: 264, severity: "high" }
|
|
1315
|
+
* })
|
|
1316
|
+
*/
|
|
1317
|
+
export declare const AddCommentToolInputSchema: z.ZodObject<{
|
|
1318
|
+
type: z.ZodString;
|
|
1319
|
+
content: z.ZodString;
|
|
1320
|
+
metadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
1321
|
+
}, z.core.$strip>;
|
|
1322
|
+
export type AddCommentToolInput = Omit<z.infer<typeof AddCommentToolInputSchema>, "metadata"> & {
|
|
1323
|
+
metadata?: AddedCommentMetadata;
|
|
1324
|
+
};
|
|
1298
1325
|
export declare const ResolveQACommentsToolInputSchema: z.ZodObject<{
|
|
1299
1326
|
thread_node_ids: z.ZodArray<z.ZodString>;
|
|
1300
1327
|
}, z.core.$strip>;
|
|
@@ -1639,6 +1666,11 @@ export declare const CodeGenToolMapSchema: z.ZodObject<{
|
|
|
1639
1666
|
looks_good: "looks_good";
|
|
1640
1667
|
}>>;
|
|
1641
1668
|
}, z.core.$strip>;
|
|
1669
|
+
AddComment: z.ZodObject<{
|
|
1670
|
+
type: z.ZodString;
|
|
1671
|
+
content: z.ZodString;
|
|
1672
|
+
metadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
1673
|
+
}, z.core.$strip>;
|
|
1642
1674
|
ProposeConfig: z.ZodObject<{
|
|
1643
1675
|
config: z.ZodObject<{
|
|
1644
1676
|
projectOverview: z.ZodObject<{
|
|
@@ -1930,6 +1962,7 @@ export declare const CodeGenToolMapSchema: z.ZodObject<{
|
|
|
1930
1962
|
}, z.core.$strip>;
|
|
1931
1963
|
export type CodeGenToolMap = z.infer<typeof CodeGenToolMapSchema>;
|
|
1932
1964
|
export declare const CodeGenToolsSchema: z.ZodEnum<{
|
|
1965
|
+
AddComment: "AddComment";
|
|
1933
1966
|
AddMemory: "AddMemory";
|
|
1934
1967
|
Agent: "Agent";
|
|
1935
1968
|
ArchiveBranch: "ArchiveBranch";
|
|
@@ -2424,11 +2457,16 @@ export declare const CodeGenInputOptionsSchema: z.ZodObject<{
|
|
|
2424
2457
|
disableModelInvocation: z.ZodOptional<z.ZodBoolean>;
|
|
2425
2458
|
userInvocable: z.ZodOptional<z.ZodBoolean>;
|
|
2426
2459
|
scope: z.ZodOptional<z.ZodEnum<{
|
|
2460
|
+
builtin: "builtin";
|
|
2427
2461
|
plugin: "plugin";
|
|
2428
2462
|
project: "project";
|
|
2429
2463
|
user: "user";
|
|
2430
2464
|
}>>;
|
|
2431
2465
|
pluginName: z.ZodOptional<z.ZodString>;
|
|
2466
|
+
ownedAgents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2467
|
+
name: z.ZodString;
|
|
2468
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2469
|
+
}, z.core.$strip>>>;
|
|
2432
2470
|
}, z.core.$strip>>>;
|
|
2433
2471
|
customAgents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2434
2472
|
name: z.ZodString;
|
|
@@ -2649,6 +2687,7 @@ export declare const CodeGenInputOptionsSchema: z.ZodObject<{
|
|
|
2649
2687
|
}, z.core.$strip>>;
|
|
2650
2688
|
recommendedRoot: z.ZodOptional<z.ZodString>;
|
|
2651
2689
|
enabledTools: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
2690
|
+
AddComment: "AddComment";
|
|
2652
2691
|
AddMemory: "AddMemory";
|
|
2653
2692
|
Agent: "Agent";
|
|
2654
2693
|
ArchiveBranch: "ArchiveBranch";
|
|
@@ -3194,6 +3233,37 @@ export interface GenerateCompletionStepGit {
|
|
|
3194
3233
|
pendingValidation: boolean;
|
|
3195
3234
|
unmergedFiles: string[];
|
|
3196
3235
|
}
|
|
3236
|
+
/**
|
|
3237
|
+
* A typed comment added to the session via the generic `AddComment` tool. The
|
|
3238
|
+
* `commentType` mirrors the tool's `type` field (e.g. `"code-review"`) and
|
|
3239
|
+
* drives how the UI renders it; `metadata` carries type-specific fields (for
|
|
3240
|
+
* code review: `filePath`, `startLine`, optional `endLine`, optional
|
|
3241
|
+
* `severity`).
|
|
3242
|
+
*/
|
|
3243
|
+
export interface AddedCommentOriginalSnippet {
|
|
3244
|
+
filePath: string;
|
|
3245
|
+
startLine: number;
|
|
3246
|
+
endLine: number;
|
|
3247
|
+
lines: string[];
|
|
3248
|
+
}
|
|
3249
|
+
export interface AddedCommentMetadata extends Record<string, unknown> {
|
|
3250
|
+
originalSnippet?: AddedCommentOriginalSnippet;
|
|
3251
|
+
}
|
|
3252
|
+
export interface AddedComment {
|
|
3253
|
+
commentType: string;
|
|
3254
|
+
content: string;
|
|
3255
|
+
metadata?: AddedCommentMetadata;
|
|
3256
|
+
}
|
|
3257
|
+
/**
|
|
3258
|
+
* Emitted when a comment is added via the `AddComment` tool. The UI renders the
|
|
3259
|
+
* comment based on its `commentType`. No external posting happens for this
|
|
3260
|
+
* event — it is UI-only.
|
|
3261
|
+
*/
|
|
3262
|
+
export interface GenerateCompletionStepCommentAdded {
|
|
3263
|
+
type: "comment-added";
|
|
3264
|
+
id: string;
|
|
3265
|
+
comment: AddedComment;
|
|
3266
|
+
}
|
|
3197
3267
|
export interface GenerateCompletionStepClose {
|
|
3198
3268
|
type: "close";
|
|
3199
3269
|
}
|
|
@@ -3216,7 +3286,7 @@ export interface CustomInstructionDefinition {
|
|
|
3216
3286
|
glob?: string;
|
|
3217
3287
|
isSkill?: boolean;
|
|
3218
3288
|
userInvocable?: boolean;
|
|
3219
|
-
scope?: "project" | "user" | "plugin";
|
|
3289
|
+
scope?: "project" | "user" | "plugin" | "builtin";
|
|
3220
3290
|
pluginName?: string;
|
|
3221
3291
|
}
|
|
3222
3292
|
export interface GenerateCompletionStepSession {
|
|
@@ -3313,7 +3383,7 @@ export interface GenerateCompletionStepUpdateSetupValue {
|
|
|
3313
3383
|
};
|
|
3314
3384
|
reason: string;
|
|
3315
3385
|
}
|
|
3316
|
-
export type GenerateCompletionStep = GenerateCompletionStepThinking | GenerateCompletionStepStart | GenerateCompletionStepDelta | GenerateCompletionStepUser | GenerateCompletionStepFile | GenerateCompletionStepDiff | GenerateCompletionStepTool | GenerateCompletionStepError | GenerateCompletionStepContinue | GenerateCompletionStepWaitForInput | GenerateCompletionStepAbort | GenerateCompletionStepDone | GenerateCompletionStepUserInput | GenerateCompletionStepText | GenerateCompletionStepRestore | GenerateCompletionStepState | GenerateCompletionStepStdio | GenerateCompletionStepSession | GenerateCompletionStepServerToolResult | GenerateCompletionStepGit | GenerateCompletionStepBuilderAction | GenerateCompletionStepLocalMCPAuthComplete | GenerateCompletionStepToolResult | GenerateCompletionStepFusionConfigPatch | GenerateCompletionStepToolCallRequest | GenerateCodeEventMCPStatus | GenerateCodeEventMCPAuthRequired | GenerateCompletionStepDevServerState | GenerateCompletionStepAgent | GenerateCompletionStepBatch | GenerateCompletionStepTerminals | GenerateCompletionStepMetadata | GenerateCompletionStepMessageQueue | GenerateCompletionStepProposeConfig | GenerateCompletionStepUpdateSetupValue | GenerateCompletionStepIde;
|
|
3386
|
+
export type GenerateCompletionStep = GenerateCompletionStepThinking | GenerateCompletionStepStart | GenerateCompletionStepDelta | GenerateCompletionStepUser | GenerateCompletionStepFile | GenerateCompletionStepDiff | GenerateCompletionStepTool | GenerateCompletionStepError | GenerateCompletionStepContinue | GenerateCompletionStepWaitForInput | GenerateCompletionStepAbort | GenerateCompletionStepDone | GenerateCompletionStepUserInput | GenerateCompletionStepText | GenerateCompletionStepRestore | GenerateCompletionStepState | GenerateCompletionStepStdio | GenerateCompletionStepSession | GenerateCompletionStepServerToolResult | GenerateCompletionStepGit | GenerateCompletionStepBuilderAction | GenerateCompletionStepLocalMCPAuthComplete | GenerateCompletionStepToolResult | GenerateCompletionStepFusionConfigPatch | GenerateCompletionStepToolCallRequest | GenerateCodeEventMCPStatus | GenerateCodeEventMCPAuthRequired | GenerateCompletionStepDevServerState | GenerateCompletionStepAgent | GenerateCompletionStepBatch | GenerateCompletionStepTerminals | GenerateCompletionStepMetadata | GenerateCompletionStepMessageQueue | GenerateCompletionStepProposeConfig | GenerateCompletionStepUpdateSetupValue | GenerateCompletionStepCommentAdded | GenerateCompletionStepIde;
|
|
3317
3387
|
export interface ApplyActionsResult {
|
|
3318
3388
|
filePath: string;
|
|
3319
3389
|
addedLines: number;
|
|
@@ -3560,12 +3630,10 @@ export interface UserInput {
|
|
|
3560
3630
|
/** @deprecated */
|
|
3561
3631
|
repair?: boolean;
|
|
3562
3632
|
}
|
|
3563
|
-
|
|
3564
|
-
state: "running" | "done" | "error";
|
|
3633
|
+
interface CodegenTurnBase {
|
|
3565
3634
|
unixTime: number;
|
|
3566
3635
|
completionId: string;
|
|
3567
3636
|
title: string;
|
|
3568
|
-
nextUrl: string | undefined;
|
|
3569
3637
|
user: UserSource;
|
|
3570
3638
|
creditsUsed: number;
|
|
3571
3639
|
actions: ActionItem[];
|
|
@@ -3577,7 +3645,34 @@ export interface CodegenTurn {
|
|
|
3577
3645
|
lastCommit: GitSnapshot | undefined;
|
|
3578
3646
|
cachedToolResults?: ContentMessageItemToolResult[];
|
|
3579
3647
|
autoContinue: boolean;
|
|
3648
|
+
/**
|
|
3649
|
+
* Only set on synthetic per-user-message checkpoints (the non-linear
|
|
3650
|
+
* `getSessionTurns` result). `completionId` always stays the checkpoint's
|
|
3651
|
+
* own identity — for these synthetic turns, the user message's id — which is
|
|
3652
|
+
* exactly what restoring "before this point" needs (the factual commit at
|
|
3653
|
+
* that moment). `finalCompletionId` separately carries the last agent turn in
|
|
3654
|
+
* the message's range that holds the post-message commit (`afterCommit`), for
|
|
3655
|
+
* callers that want to restore to the "after" state. Undefined for ordinary
|
|
3656
|
+
* (linear) turns.
|
|
3657
|
+
*/
|
|
3658
|
+
finalCompletionId?: string;
|
|
3659
|
+
}
|
|
3660
|
+
/**
|
|
3661
|
+
* A completed turn. Invariant: a `done` turn ALWAYS has a `nextUrl` (the
|
|
3662
|
+
* continuation pointer the server emits on the `done` event / persists as the
|
|
3663
|
+
* session's last completion). Encoded in the type so `state === "done"` narrows
|
|
3664
|
+
* `nextUrl` to `string` — restore/anchor logic can rely on it.
|
|
3665
|
+
*/
|
|
3666
|
+
export interface CodegenTurnDone extends CodegenTurnBase {
|
|
3667
|
+
state: "done";
|
|
3668
|
+
nextUrl: string;
|
|
3669
|
+
}
|
|
3670
|
+
/** A turn that is still running, or errored before completing. */
|
|
3671
|
+
export interface CodegenTurnPending extends CodegenTurnBase {
|
|
3672
|
+
state: "running" | "error";
|
|
3673
|
+
nextUrl: string | undefined;
|
|
3580
3674
|
}
|
|
3675
|
+
export type CodegenTurn = CodegenTurnDone | CodegenTurnPending;
|
|
3581
3676
|
export interface GetSessionTurnsResult {
|
|
3582
3677
|
turns: CodegenTurn[];
|
|
3583
3678
|
allIds: string[];
|
|
@@ -4656,3 +4751,4 @@ export interface SessionData {
|
|
|
4656
4751
|
numNormalUserMessages: number;
|
|
4657
4752
|
metadata?: Record<string, any>;
|
|
4658
4753
|
}
|
|
4754
|
+
export {};
|
package/src/codegen.js
CHANGED
|
@@ -22,6 +22,12 @@ export const ProjectFileSchema = z
|
|
|
22
22
|
virtual: z.boolean().optional(),
|
|
23
23
|
})
|
|
24
24
|
.meta({ title: "ProjectFile" });
|
|
25
|
+
export const CustomAgentInfoSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
name: z.string(),
|
|
28
|
+
description: z.string().optional(),
|
|
29
|
+
})
|
|
30
|
+
.meta({ title: "CustomAgentInfo" });
|
|
25
31
|
export const CustomInstructionSchema = z
|
|
26
32
|
.object({
|
|
27
33
|
id: z.string(),
|
|
@@ -38,28 +44,31 @@ export const CustomInstructionSchema = z
|
|
|
38
44
|
userInvocable: z.boolean().optional(),
|
|
39
45
|
/**
|
|
40
46
|
* Where this instruction was discovered. Drives precedence on name
|
|
41
|
-
* collision: `project` > `user` > `plugin`. Set by the
|
|
42
|
-
* not by the parsed file itself.
|
|
47
|
+
* collision: `project` > `user` > `plugin` > `builtin`. Set by the
|
|
48
|
+
* discovery loader, not by the parsed file itself. `builtin` marks
|
|
49
|
+
* product-level skills shipped with dev-tools.
|
|
43
50
|
*/
|
|
44
|
-
scope: z.enum(["project", "user", "plugin"]).optional(),
|
|
51
|
+
scope: z.enum(["project", "user", "plugin", "builtin"]).optional(),
|
|
45
52
|
/**
|
|
46
53
|
* Name of the plugin that contributed this instruction, if any. Set by
|
|
47
54
|
* the plugin loader (Phase 2); always `undefined` for project-level and
|
|
48
55
|
* user-level standalone files (Phase 1).
|
|
49
56
|
*/
|
|
50
57
|
pluginName: z.string().optional(),
|
|
58
|
+
/**
|
|
59
|
+
* Subagents owned by this skill (name + description only). When the skill
|
|
60
|
+
* is invoked, the service registers these into the available agents so the
|
|
61
|
+
* model can spawn them within the same request's agent loop. The CLI holds
|
|
62
|
+
* the full agent definitions; only the metadata travels here. Used by
|
|
63
|
+
* built-in skills (e.g. `code-review`).
|
|
64
|
+
*/
|
|
65
|
+
ownedAgents: z.array(CustomAgentInfoSchema).optional(),
|
|
51
66
|
})
|
|
52
67
|
.meta({ title: "CustomInstruction" });
|
|
53
68
|
/** Reasoning effort level for LLM completions. */
|
|
54
69
|
export const ReasoningEffortSchema = z
|
|
55
70
|
.enum(["auto", "none", "minimal", "low", "medium", "high", "xhigh", "max"])
|
|
56
71
|
.meta({ title: "ReasoningEffort" });
|
|
57
|
-
export const CustomAgentInfoSchema = z
|
|
58
|
-
.object({
|
|
59
|
-
name: z.string(),
|
|
60
|
-
description: z.string().optional(),
|
|
61
|
-
})
|
|
62
|
-
.meta({ title: "CustomAgentInfo" });
|
|
63
72
|
/** Per-agent model overrides. String = fixed model, string[] = round-robin. */
|
|
64
73
|
export const AgentModelOverridesSchema = z
|
|
65
74
|
.record(z.string(), z.union([z.string(), z.array(z.string())]))
|
|
@@ -1329,6 +1338,36 @@ export const SubmitPRReviewToolInputSchema = z
|
|
|
1329
1338
|
verdict: ReviewVerdictSchema.optional(),
|
|
1330
1339
|
})
|
|
1331
1340
|
.meta({ title: "SubmitPRReviewToolInput" });
|
|
1341
|
+
/**
|
|
1342
|
+
* AddComment - a generic, UI-only tool for attaching a typed comment to the
|
|
1343
|
+
* session. It never posts anywhere external; the service only validates the
|
|
1344
|
+
* call and the dev-tools CLI emits a `comment-added` step from the tool input
|
|
1345
|
+
* so the UI can render it. The `type` discriminates how the UI renders the
|
|
1346
|
+
* comment (e.g. `"code-review"`), and `metadata` carries type-specific fields.
|
|
1347
|
+
*
|
|
1348
|
+
* Example (code-review skill):
|
|
1349
|
+
* addComment({
|
|
1350
|
+
* type: "code-review",
|
|
1351
|
+
* content: "Unawaited async call will fail in serverless",
|
|
1352
|
+
* metadata: { filePath: "src/x.ts", startLine: 264, endLine: 264, severity: "high" }
|
|
1353
|
+
* })
|
|
1354
|
+
*/
|
|
1355
|
+
export const AddCommentToolInputSchema = z
|
|
1356
|
+
.object({
|
|
1357
|
+
type: z.string().min(1).meta({
|
|
1358
|
+
description: "Comment category that drives how the UI renders it, e.g. 'code-review'",
|
|
1359
|
+
}),
|
|
1360
|
+
content: z.string().min(1).meta({
|
|
1361
|
+
description: "The comment body (plain text or markdown)",
|
|
1362
|
+
}),
|
|
1363
|
+
// `looseObject` (not `z.record`) so the JSON schema emits
|
|
1364
|
+
// `additionalProperties` rather than `propertyNames`, which OpenAI's strict
|
|
1365
|
+
// tool-schema mode rejects.
|
|
1366
|
+
metadata: z.looseObject({}).optional().meta({
|
|
1367
|
+
description: "Type-specific fields. For 'code-review': filePath (string), startLine (number), endLine (number, optional), severity ('high' | 'medium' | 'low'), and originalSnippet when available",
|
|
1368
|
+
}),
|
|
1369
|
+
})
|
|
1370
|
+
.meta({ title: "AddCommentToolInput" });
|
|
1332
1371
|
export const ResolveQACommentsToolInputSchema = z
|
|
1333
1372
|
.object({
|
|
1334
1373
|
thread_node_ids: z.array(z.string()).meta({
|
|
@@ -1488,6 +1527,7 @@ export const CodeGenToolMapSchema = z.object({
|
|
|
1488
1527
|
ReadMcpResource: ReadMcpResourceToolInputSchema,
|
|
1489
1528
|
RecordFrame: RecordFrameToolInputSchema,
|
|
1490
1529
|
SubmitPRReview: SubmitPRReviewToolInputSchema,
|
|
1530
|
+
AddComment: AddCommentToolInputSchema,
|
|
1491
1531
|
ProposeConfig: ProposeConfigToolInputSchema,
|
|
1492
1532
|
UpdateSetupValue: UpdateSetupValueToolInputSchema,
|
|
1493
1533
|
Exit: ExitToolInputSchema,
|
package/src/design-systems.d.ts
CHANGED
|
@@ -35,10 +35,6 @@ export interface GenerateDesignSystemFormFields {
|
|
|
35
35
|
*/
|
|
36
36
|
export declare const GITHUB_REPO_URL_REGEX: RegExp;
|
|
37
37
|
export interface GenerateDesignSystemRequest extends GenerateDesignSystemFormFields {
|
|
38
|
-
/**
|
|
39
|
-
* Mixed list of uploaded files in any order. Sent as repeated
|
|
40
|
-
* `attachments` fields in the multipart body.
|
|
41
|
-
*/
|
|
42
38
|
attachments: File[];
|
|
43
39
|
}
|
|
44
40
|
export interface GenerateDesignSystemResponse {
|
|
@@ -58,18 +54,75 @@ export interface GenerateDesignSystemErrorResponse {
|
|
|
58
54
|
export declare const GENERATE_DESIGN_SYSTEM_MAX_FILE_BYTES: number;
|
|
59
55
|
export declare const GENERATE_DESIGN_SYSTEM_MAX_ATTACHMENTS = 50;
|
|
60
56
|
export declare const GENERATE_DESIGN_SYSTEM_MIN_ATTACHMENTS = 1;
|
|
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>;
|
|
61
65
|
/**
|
|
62
|
-
*
|
|
63
|
-
* Files are parsed out of the body by multer before this schema runs.
|
|
66
|
+
* Signed-URL upload flow.
|
|
64
67
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
68
|
+
* Clients no longer post `.fig` bytes through the service (Cloud Run caps
|
|
69
|
+
* request bodies at 32 MiB). Instead they call `upload/start` to get a
|
|
70
|
+
* temporary signed resumable-upload URL per attachment, stream the bytes
|
|
71
|
+
* directly to GCS, then call `/generate` with the returned upload tokens.
|
|
72
|
+
* See `tech-specs/signed-url-figma-upload`.
|
|
67
73
|
*/
|
|
68
|
-
|
|
74
|
+
/** A single attachment the client declares when starting an upload. */
|
|
75
|
+
export declare const uploadStartAttachmentSchema: z.ZodObject<{
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
mimetype: z.ZodString;
|
|
78
|
+
declaredSize: z.ZodNumber;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
export type UploadStartAttachment = z.infer<typeof uploadStartAttachmentSchema>;
|
|
81
|
+
/** Request body for `POST /design-systems/v1/upload/start`. */
|
|
82
|
+
export declare const uploadStartBodySchema: z.ZodObject<{
|
|
83
|
+
attachments: z.ZodArray<z.ZodObject<{
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
mimetype: z.ZodString;
|
|
86
|
+
declaredSize: z.ZodNumber;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
export type UploadStartBody = z.infer<typeof uploadStartBodySchema>;
|
|
90
|
+
/**
|
|
91
|
+
* Claims encoded inside a signed `uploadToken`. Bound to the GCS object at
|
|
92
|
+
* `upload/start` and verified at `/generate`, so a client cannot point the
|
|
93
|
+
* decode worker at an object it did not upload.
|
|
94
|
+
*/
|
|
95
|
+
export declare const uploadTokenPayloadSchema: z.ZodObject<{
|
|
96
|
+
jobId: z.ZodString;
|
|
97
|
+
gcsObject: z.ZodString;
|
|
98
|
+
ownerId: z.ZodString;
|
|
99
|
+
mimetype: z.ZodString;
|
|
100
|
+
originalName: z.ZodString;
|
|
101
|
+
idx: z.ZodNumber;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
export type UploadTokenPayload = z.infer<typeof uploadTokenPayloadSchema>;
|
|
104
|
+
export interface UploadStartResponseItem {
|
|
105
|
+
idx: number;
|
|
106
|
+
/** Signed URL the client POSTs to (with `x-goog-resumable: start`) to begin the resumable upload. */
|
|
107
|
+
uploadUrl: string;
|
|
108
|
+
/** Opaque signed token the client passes back to `/generate`. */
|
|
109
|
+
uploadToken: string;
|
|
110
|
+
}
|
|
111
|
+
export interface UploadStartResponse {
|
|
112
|
+
jobId: string;
|
|
113
|
+
uploads: UploadStartResponseItem[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Request body for the signed-URL variant of `POST /design-systems/v1/generate`.
|
|
117
|
+
* Same non-file fields as the legacy multipart form, plus the `uploads`
|
|
118
|
+
* tokens returned by `upload/start` (one per attachment).
|
|
119
|
+
*/
|
|
120
|
+
export declare const generateDesignSystemRequestSchema: z.ZodObject<{
|
|
69
121
|
projectName: z.ZodOptional<z.ZodString>;
|
|
70
122
|
devToolsVersion: z.ZodOptional<z.ZodString>;
|
|
71
123
|
selection: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>>;
|
|
72
124
|
githubRepoUrl: z.ZodOptional<z.ZodString>;
|
|
73
125
|
connectedProjectId: z.ZodOptional<z.ZodString>;
|
|
126
|
+
uploads: z.ZodArray<z.ZodString>;
|
|
74
127
|
}, z.core.$strip>;
|
|
75
|
-
export type
|
|
128
|
+
export type GenerateDesignSystemRequestBody = z.infer<typeof generateDesignSystemRequestSchema>;
|
package/src/design-systems.js
CHANGED
|
@@ -8,13 +8,6 @@ export const GITHUB_REPO_URL_REGEX = /^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[
|
|
|
8
8
|
export const GENERATE_DESIGN_SYSTEM_MAX_FILE_BYTES = 2 * 1024 * 1024 * 1024;
|
|
9
9
|
export const GENERATE_DESIGN_SYSTEM_MAX_ATTACHMENTS = 50;
|
|
10
10
|
export const GENERATE_DESIGN_SYSTEM_MIN_ATTACHMENTS = 1;
|
|
11
|
-
/**
|
|
12
|
-
* Validation for non-file fields posted alongside the multipart upload.
|
|
13
|
-
* Files are parsed out of the body by multer before this schema runs.
|
|
14
|
-
*
|
|
15
|
-
* The inferred type matches `GenerateDesignSystemFormFields` so the wire
|
|
16
|
-
* contract stays in lockstep with the shared type.
|
|
17
|
-
*/
|
|
18
11
|
export const generateDesignSystemBodySchema = z.object({
|
|
19
12
|
projectName: z.string().trim().min(1).max(200).optional(),
|
|
20
13
|
devToolsVersion: z.string().trim().min(1).max(64).optional(),
|
|
@@ -40,3 +33,54 @@ export const generateDesignSystemBodySchema = z.object({
|
|
|
40
33
|
.optional(),
|
|
41
34
|
connectedProjectId: z.string().trim().min(1).max(128).optional(),
|
|
42
35
|
});
|
|
36
|
+
/**
|
|
37
|
+
* Signed-URL upload flow.
|
|
38
|
+
*
|
|
39
|
+
* Clients no longer post `.fig` bytes through the service (Cloud Run caps
|
|
40
|
+
* request bodies at 32 MiB). Instead they call `upload/start` to get a
|
|
41
|
+
* temporary signed resumable-upload URL per attachment, stream the bytes
|
|
42
|
+
* directly to GCS, then call `/generate` with the returned upload tokens.
|
|
43
|
+
* See `tech-specs/signed-url-figma-upload`.
|
|
44
|
+
*/
|
|
45
|
+
/** A single attachment the client declares when starting an upload. */
|
|
46
|
+
export const uploadStartAttachmentSchema = z.object({
|
|
47
|
+
name: z.string().trim().min(1).max(512),
|
|
48
|
+
mimetype: z.string().trim().min(1).max(255),
|
|
49
|
+
declaredSize: z
|
|
50
|
+
.number()
|
|
51
|
+
.int()
|
|
52
|
+
.positive()
|
|
53
|
+
.max(GENERATE_DESIGN_SYSTEM_MAX_FILE_BYTES),
|
|
54
|
+
});
|
|
55
|
+
/** Request body for `POST /design-systems/v1/upload/start`. */
|
|
56
|
+
export const uploadStartBodySchema = z.object({
|
|
57
|
+
attachments: z
|
|
58
|
+
.array(uploadStartAttachmentSchema)
|
|
59
|
+
.min(GENERATE_DESIGN_SYSTEM_MIN_ATTACHMENTS)
|
|
60
|
+
.max(GENERATE_DESIGN_SYSTEM_MAX_ATTACHMENTS),
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Claims encoded inside a signed `uploadToken`. Bound to the GCS object at
|
|
64
|
+
* `upload/start` and verified at `/generate`, so a client cannot point the
|
|
65
|
+
* decode worker at an object it did not upload.
|
|
66
|
+
*/
|
|
67
|
+
export const uploadTokenPayloadSchema = z.object({
|
|
68
|
+
jobId: z.string().min(1),
|
|
69
|
+
gcsObject: z.string().min(1),
|
|
70
|
+
ownerId: z.string().min(1),
|
|
71
|
+
mimetype: z.string().min(1),
|
|
72
|
+
originalName: z.string().min(1),
|
|
73
|
+
idx: z.number().int().nonnegative(),
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Request body for the signed-URL variant of `POST /design-systems/v1/generate`.
|
|
77
|
+
* Same non-file fields as the legacy multipart form, plus the `uploads`
|
|
78
|
+
* tokens returned by `upload/start` (one per attachment).
|
|
79
|
+
*/
|
|
80
|
+
export const generateDesignSystemRequestSchema = z.object({
|
|
81
|
+
...generateDesignSystemBodySchema.shape,
|
|
82
|
+
uploads: z
|
|
83
|
+
.array(z.string().min(1))
|
|
84
|
+
.min(GENERATE_DESIGN_SYSTEM_MIN_ATTACHMENTS)
|
|
85
|
+
.max(GENERATE_DESIGN_SYSTEM_MAX_ATTACHMENTS),
|
|
86
|
+
});
|
package/src/events.d.ts
CHANGED
|
@@ -1039,6 +1039,8 @@ export type FigmaDecodeJobV1 = FusionEventVariant<"figma.decode.job", {
|
|
|
1039
1039
|
projectId: string;
|
|
1040
1040
|
projectName: string;
|
|
1041
1041
|
figmaName: string;
|
|
1042
|
+
/** Design-system record this job feeds; updated with the branch once created. */
|
|
1043
|
+
designSystemId?: string;
|
|
1042
1044
|
/**
|
|
1043
1045
|
* GCS object paths (relative to the configured bucket) of every attachment
|
|
1044
1046
|
* uploaded for this job. The worker streams these back down, runs
|