@builder.io/ai-utils 0.98.0 → 0.99.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.98.0",
3
+ "version": "0.99.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
package/src/codegen.d.ts CHANGED
@@ -374,6 +374,7 @@ export declare const BuilderEditToolInputSchema: z.ZodObject<{
374
374
  filePath: z.ZodString;
375
375
  old_str: z.ZodString;
376
376
  new_str: z.ZodString;
377
+ replace_all: z.ZodOptional<z.ZodBoolean>;
377
378
  activeLocale: z.ZodOptional<z.ZodString>;
378
379
  }, z.core.$strip>;
379
380
  export type BuilderEditToolInput = z.infer<typeof BuilderEditToolInputSchema>;
@@ -1553,6 +1554,7 @@ export declare const CodeGenToolMapSchema: z.ZodObject<{
1553
1554
  filePath: z.ZodString;
1554
1555
  old_str: z.ZodString;
1555
1556
  new_str: z.ZodString;
1557
+ replace_all: z.ZodOptional<z.ZodBoolean>;
1556
1558
  activeLocale: z.ZodOptional<z.ZodString>;
1557
1559
  }, z.core.$strip>;
1558
1560
  WebFetch: z.ZodObject<{
package/src/codegen.js CHANGED
@@ -567,6 +567,9 @@ export const BuilderEditToolInputSchema = z
567
567
  new_str: z.string().meta({
568
568
  description: "New content to replace the old content with",
569
569
  }),
570
+ replace_all: z.boolean().optional().meta({
571
+ description: "Replace every occurrence of old_str instead of only the first. Matches old_str as an exact substring, so it is not restricted to complete lines — use it to change a word repeated throughout a long rich-text body. Only use it when every occurrence should get the same replacement.",
572
+ }),
570
573
  activeLocale: z.string().min(1).optional().meta({
571
574
  description: 'Locale to edit. Use "Default" for the default locale, or one of the configured available locales.',
572
575
  }),
@@ -10,6 +10,7 @@ export declare const EditorAiReadRequestSchema: z.ZodObject<{
10
10
  offset: z.ZodOptional<z.ZodNumber>;
11
11
  limit: z.ZodOptional<z.ZodNumber>;
12
12
  activeLocale: z.ZodOptional<z.ZodString>;
13
+ baseContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13
14
  }, z.core.$strip>;
14
15
  export type EditorAiReadRequest = z.infer<typeof EditorAiReadRequestSchema>;
15
16
  export declare const EditorAiReadResponseSchema: z.ZodObject<{
@@ -25,11 +26,13 @@ export declare const EditorAiEditRequestSchema: z.ZodObject<{
25
26
  contentId: z.ZodString;
26
27
  old_str: z.ZodString;
27
28
  new_str: z.ZodString;
29
+ replace_all: z.ZodOptional<z.ZodBoolean>;
28
30
  activeLocale: z.ZodOptional<z.ZodString>;
29
31
  components: z.ZodOptional<z.ZodArray<z.ZodObject<{
30
32
  name: z.ZodString;
31
33
  }, z.core.$loose>>>;
32
34
  allowedComponentNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
35
+ baseContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
33
36
  }, z.core.$strip>;
34
37
  export type EditorAiEditRequest = z.infer<typeof EditorAiEditRequestSchema>;
35
38
  export declare const EditorAiEditResponseSchema: z.ZodObject<{
@@ -46,6 +49,7 @@ export declare const EditorAiWriteRequestSchema: z.ZodObject<{
46
49
  name: z.ZodString;
47
50
  }, z.core.$loose>>>;
48
51
  allowedComponentNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
52
+ baseContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
49
53
  }, z.core.$strip>;
50
54
  export type EditorAiWriteRequest = z.infer<typeof EditorAiWriteRequestSchema>;
51
55
  export declare const EditorAiWriteResponseSchema: z.ZodObject<{
package/src/editor-ai.js CHANGED
@@ -16,6 +16,9 @@ const componentsField = z.array(EditorAiComponentSchema).optional();
16
16
  // Omitted is unrestricted; empty forbids every component. Only components-only
17
17
  // spaces send it.
18
18
  const allowedComponentNamesField = z.array(z.string().min(1)).optional();
19
+ // Edit this instead of the stored document, letting a caller work on an
20
+ // unpublished revision. Ownership still checked against stored. Blocks decoded.
21
+ const baseContentField = z.record(z.string(), z.unknown()).optional();
19
22
  export const EditorAiReadRequestSchema = z
20
23
  .object({
21
24
  contentId: z.string().min(1),
@@ -23,6 +26,7 @@ export const EditorAiReadRequestSchema = z
23
26
  limit: z.number().int().min(1).max(EDITOR_AI_READ_MAX_LIMIT).optional(),
24
27
  // Locale to operate on; defaults to "Default" when omitted.
25
28
  activeLocale: z.string().min(1).optional(),
29
+ baseContent: baseContentField,
26
30
  })
27
31
  .meta({ title: "EditorAiReadRequest" });
28
32
  export const EditorAiReadResponseSchema = z
@@ -45,10 +49,13 @@ export const EditorAiEditRequestSchema = z
45
49
  message: "old_str must not be only whitespace",
46
50
  }),
47
51
  new_str: z.string(),
52
+ // Exact-substring replace of every occurrence, skipping the fuzzy line diff.
53
+ replace_all: z.boolean().optional(),
48
54
  // Locale to operate on; defaults to "Default" when omitted.
49
55
  activeLocale: z.string().min(1).optional(),
50
56
  components: componentsField,
51
57
  allowedComponentNames: allowedComponentNamesField,
58
+ baseContent: baseContentField,
52
59
  })
53
60
  .meta({ title: "EditorAiEditRequest" });
54
61
  export const EditorAiEditResponseSchema = z
@@ -66,6 +73,7 @@ export const EditorAiWriteRequestSchema = z
66
73
  activeLocale: z.string().min(1).optional(),
67
74
  components: componentsField,
68
75
  allowedComponentNames: allowedComponentNamesField,
76
+ baseContent: baseContentField,
69
77
  })
70
78
  .meta({ title: "EditorAiWriteRequest" });
71
79
  export const EditorAiWriteResponseSchema = z