@builder.io/ai-utils 0.74.1 → 0.74.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.74.1",
3
+ "version": "0.74.3",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
package/src/codegen.d.ts CHANGED
@@ -1317,7 +1317,16 @@ export type SubmitPRReviewToolInput = z.infer<typeof SubmitPRReviewToolInputSche
1317
1317
  export declare const AddCommentToolInputSchema: z.ZodObject<{
1318
1318
  type: z.ZodString;
1319
1319
  content: z.ZodString;
1320
- metadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
1320
+ metadata: z.ZodOptional<z.ZodObject<{
1321
+ filePath: z.ZodOptional<z.ZodString>;
1322
+ startLine: z.ZodOptional<z.ZodNumber>;
1323
+ endLine: z.ZodOptional<z.ZodNumber>;
1324
+ severity: z.ZodOptional<z.ZodEnum<{
1325
+ high: "high";
1326
+ low: "low";
1327
+ medium: "medium";
1328
+ }>>;
1329
+ }, z.core.$loose>>;
1321
1330
  }, z.core.$strip>;
1322
1331
  export type AddCommentToolInput = Omit<z.infer<typeof AddCommentToolInputSchema>, "metadata"> & {
1323
1332
  metadata?: AddedCommentMetadata;
@@ -1358,15 +1367,6 @@ export declare const IDEDiagnosticsToolInputSchema: z.ZodObject<{
1358
1367
  file_path: z.ZodOptional<z.ZodString>;
1359
1368
  }, z.core.$strip>;
1360
1369
  export type IDEDiagnosticsToolInput = z.infer<typeof IDEDiagnosticsToolInputSchema>;
1361
- export declare const GetCodegenEventToolInputSchema: z.ZodObject<{
1362
- event_id: z.ZodString;
1363
- }, z.core.$strip>;
1364
- export type GetCodegenEventToolInput = z.infer<typeof GetCodegenEventToolInputSchema>;
1365
- export declare const ListCodegenSessionEventsToolInputSchema: z.ZodObject<{
1366
- session_or_event_id: z.ZodString;
1367
- limit: z.ZodOptional<z.ZodNumber>;
1368
- }, z.core.$strip>;
1369
- export type ListCodegenSessionEventsToolInput = z.infer<typeof ListCodegenSessionEventsToolInputSchema>;
1370
1370
  export declare const PullPrototypeToolInputSchema: z.ZodObject<{
1371
1371
  url: z.ZodString;
1372
1372
  project_id: z.ZodOptional<z.ZodString>;
@@ -1669,7 +1669,16 @@ export declare const CodeGenToolMapSchema: z.ZodObject<{
1669
1669
  AddComment: z.ZodObject<{
1670
1670
  type: z.ZodString;
1671
1671
  content: z.ZodString;
1672
- metadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
1672
+ metadata: z.ZodOptional<z.ZodObject<{
1673
+ filePath: z.ZodOptional<z.ZodString>;
1674
+ startLine: z.ZodOptional<z.ZodNumber>;
1675
+ endLine: z.ZodOptional<z.ZodNumber>;
1676
+ severity: z.ZodOptional<z.ZodEnum<{
1677
+ high: "high";
1678
+ low: "low";
1679
+ medium: "medium";
1680
+ }>>;
1681
+ }, z.core.$loose>>;
1673
1682
  }, z.core.$strip>;
1674
1683
  ProposeConfig: z.ZodObject<{
1675
1684
  config: z.ZodObject<{
@@ -1952,13 +1961,6 @@ export declare const CodeGenToolMapSchema: z.ZodObject<{
1952
1961
  draft: z.ZodOptional<z.ZodBoolean>;
1953
1962
  }, z.core.$strip>;
1954
1963
  GenerateDesignSystemAgentMd: z.ZodObject<{}, z.core.$strip>;
1955
- GetCodegenEvent: z.ZodObject<{
1956
- event_id: z.ZodString;
1957
- }, z.core.$strip>;
1958
- ListCodegenSessionEvents: z.ZodObject<{
1959
- session_or_event_id: z.ZodString;
1960
- limit: z.ZodOptional<z.ZodNumber>;
1961
- }, z.core.$strip>;
1962
1964
  }, z.core.$strip>;
1963
1965
  export type CodeGenToolMap = z.infer<typeof CodeGenToolMapSchema>;
1964
1966
  export declare const CodeGenToolsSchema: z.ZodEnum<{
@@ -1984,14 +1986,12 @@ export declare const CodeGenToolsSchema: z.ZodEnum<{
1984
1986
  FindMedia: "FindMedia";
1985
1987
  GenerateDesignSystemAgentMd: "GenerateDesignSystemAgentMd";
1986
1988
  GetAvailableRepos: "GetAvailableRepos";
1987
- GetCodegenEvent: "GetCodegenEvent";
1988
1989
  GetLastBrowserTest: "GetLastBrowserTest";
1989
1990
  GetScreenshot: "GetScreenshot";
1990
1991
  GetStyleInspiration: "GetStyleInspiration";
1991
1992
  Glob: "Glob";
1992
1993
  Grep: "Grep";
1993
1994
  IDEDiagnostics: "IDEDiagnostics";
1994
- ListCodegenSessionEvents: "ListCodegenSessionEvents";
1995
1995
  Media: "Media";
1996
1996
  MultiEdit: "MultiEdit";
1997
1997
  NavigatePreview: "NavigatePreview";
@@ -2709,14 +2709,12 @@ export declare const CodeGenInputOptionsSchema: z.ZodObject<{
2709
2709
  FindMedia: "FindMedia";
2710
2710
  GenerateDesignSystemAgentMd: "GenerateDesignSystemAgentMd";
2711
2711
  GetAvailableRepos: "GetAvailableRepos";
2712
- GetCodegenEvent: "GetCodegenEvent";
2713
2712
  GetLastBrowserTest: "GetLastBrowserTest";
2714
2713
  GetScreenshot: "GetScreenshot";
2715
2714
  GetStyleInspiration: "GetStyleInspiration";
2716
2715
  Glob: "Glob";
2717
2716
  Grep: "Grep";
2718
2717
  IDEDiagnostics: "IDEDiagnostics";
2719
- ListCodegenSessionEvents: "ListCodegenSessionEvents";
2720
2718
  Media: "Media";
2721
2719
  MultiEdit: "MultiEdit";
2722
2720
  NavigatePreview: "NavigatePreview";
package/src/codegen.js CHANGED
@@ -1362,9 +1362,30 @@ export const AddCommentToolInputSchema = z
1362
1362
  }),
1363
1363
  // `looseObject` (not `z.record`) so the JSON schema emits
1364
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",
1365
+ // tool-schema mode rejects. The location fields are declared explicitly
1366
+ // (rather than left to an open object) because typed fields get filled far
1367
+ // more consistently by the model. They are optional in the schema since
1368
+ // `metadata` is shared across comment types; for 'code-review', filePath and
1369
+ // startLine are enforced as required server-side (see AddComment tool).
1370
+ metadata: z
1371
+ .looseObject({
1372
+ filePath: z.string().min(1).optional().meta({
1373
+ description: "Project-relative file path the comment refers to. Required for 'code-review'.",
1374
+ }),
1375
+ startLine: z.number().int().positive().optional().meta({
1376
+ description: "1-indexed start line the comment refers to. Required for 'code-review'. Use the [L:N] markers from the annotated diff.",
1377
+ }),
1378
+ endLine: z.number().int().positive().optional().meta({
1379
+ description: "1-indexed end line; defaults to startLine when omitted.",
1380
+ }),
1381
+ severity: z
1382
+ .enum(["high", "medium", "low"])
1383
+ .optional()
1384
+ .meta({ description: "Finding severity for 'code-review'." }),
1385
+ })
1386
+ .optional()
1387
+ .meta({
1388
+ description: "Type-specific fields. For 'code-review': filePath and startLine are required; endLine and severity are optional. originalSnippet is populated automatically.",
1368
1389
  }),
1369
1390
  })
1370
1391
  .meta({ title: "AddCommentToolInput" });
@@ -1432,23 +1453,6 @@ export const IDEDiagnosticsToolInputSchema = z
1432
1453
  }),
1433
1454
  })
1434
1455
  .meta({ title: "IDEDiagnosticsToolInput" });
1435
- export const GetCodegenEventToolInputSchema = z
1436
- .object({
1437
- event_id: z.string().meta({
1438
- description: "The codegen event ID to load (e.g. cgen-<eventId>).",
1439
- }),
1440
- })
1441
- .meta({ title: "GetCodegenEventToolInput" });
1442
- export const ListCodegenSessionEventsToolInputSchema = z
1443
- .object({
1444
- session_or_event_id: z.string().meta({
1445
- description: "A session ID or codegen event ID. When an event ID is given, its session is resolved first.",
1446
- }),
1447
- limit: z.number().optional().meta({
1448
- description: "Maximum number of events to return.",
1449
- }),
1450
- })
1451
- .meta({ title: "ListCodegenSessionEventsToolInput" });
1452
1456
  export const PullPrototypeToolInputSchema = z
1453
1457
  .object({
1454
1458
  url: z.string().meta({
@@ -1556,8 +1560,6 @@ export const CodeGenToolMapSchema = z.object({
1556
1560
  ConnectMCP: ConnectMCPToolInputSchema,
1557
1561
  EnsurePR: EnsurePRToolInputSchema,
1558
1562
  GenerateDesignSystemAgentMd: GenerateDesignSystemAgentMdInputSchema,
1559
- GetCodegenEvent: GetCodegenEventToolInputSchema,
1560
- ListCodegenSessionEvents: ListCodegenSessionEventsToolInputSchema,
1561
1563
  });
1562
1564
  export const CodeGenToolsSchema = CodeGenToolMapSchema.keyof().meta({
1563
1565
  title: "CodeGenTools",