@builder.io/ai-utils 0.73.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 +77 -7
- package/src/codegen.js +49 -9
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;
|
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,
|