@blokkli/editor 2.0.0-alpha.60 → 2.0.0-alpha.62

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.
Files changed (130) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -1
  3. package/dist/modules/agent/index.mjs +2 -5
  4. package/dist/modules/agent/runtime/app/features/agent/Container.vue +3 -3
  5. package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue +15 -3
  6. package/dist/modules/agent/runtime/app/features/agent/index.vue +5 -1
  7. package/dist/modules/agent/runtime/app/features/agent/types.d.ts +2 -1
  8. package/dist/modules/agent/runtime/app/helpers/mutationResult.d.ts +38 -0
  9. package/dist/modules/agent/runtime/app/helpers/mutationResult.js +49 -0
  10. package/dist/modules/agent/runtime/app/prompts/fixReadability.js +3 -3
  11. package/dist/modules/agent/runtime/app/providers/agentProvider.d.ts +2 -1
  12. package/dist/modules/agent/runtime/app/providers/agentProvider.js +6 -6
  13. package/dist/modules/agent/runtime/app/providers/toolsProvider.js +3 -13
  14. package/dist/modules/agent/runtime/app/tools/add_content_search_paragraphs/index.d.ts +25 -0
  15. package/dist/modules/agent/runtime/app/tools/add_content_search_paragraphs/index.js +3 -2
  16. package/dist/modules/agent/runtime/app/tools/add_fragment/index.d.ts +22 -0
  17. package/dist/modules/agent/runtime/app/tools/add_fragment/index.js +3 -2
  18. package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.d.ts +24 -0
  19. package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.js +3 -2
  20. package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.d.ts +32 -0
  21. package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.js +6 -4
  22. package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.d.ts +22 -0
  23. package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.js +3 -2
  24. package/dist/modules/agent/runtime/app/tools/add_template/index.d.ts +22 -0
  25. package/dist/modules/agent/runtime/app/tools/add_template/index.js +5 -3
  26. package/dist/modules/agent/runtime/app/tools/ask_question/index.d.ts +3 -3
  27. package/dist/modules/agent/runtime/app/tools/ask_question/index.js +7 -6
  28. package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/index.d.ts +10 -1
  29. package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/index.js +4 -4
  30. package/dist/modules/agent/runtime/app/tools/check_readability_for_texts/index.d.ts +17 -0
  31. package/dist/modules/agent/runtime/app/tools/check_readability_for_texts/index.js +2 -2
  32. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.d.ts +10 -1
  33. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.js +3 -2
  34. package/dist/modules/agent/runtime/app/tools/delete_paragraphs/index.d.ts +16 -0
  35. package/dist/modules/agent/runtime/app/tools/delete_paragraphs/index.js +3 -2
  36. package/dist/modules/agent/runtime/app/tools/detach_reusable_paragraph/index.d.ts +16 -0
  37. package/dist/modules/agent/runtime/app/tools/detach_reusable_paragraph/index.js +3 -2
  38. package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.d.ts +22 -0
  39. package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.js +5 -3
  40. package/dist/modules/agent/runtime/app/tools/find_paragraphs/index.d.ts +31 -0
  41. package/dist/modules/agent/runtime/app/tools/find_paragraphs/index.js +7 -7
  42. package/dist/modules/agent/runtime/app/tools/get_all_fragments/index.d.ts +7 -0
  43. package/dist/modules/agent/runtime/app/tools/get_all_fragments/index.js +2 -2
  44. package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.d.ts +10 -0
  45. package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.js +2 -2
  46. package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.d.ts +35 -0
  47. package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.js +2 -2
  48. package/dist/modules/agent/runtime/app/tools/get_child_paragraphs/index.d.ts +20 -0
  49. package/dist/modules/agent/runtime/app/tools/get_child_paragraphs/index.js +2 -2
  50. package/dist/modules/agent/runtime/app/tools/get_content_fields/index.d.ts +30 -0
  51. package/dist/modules/agent/runtime/app/tools/get_content_fields/index.js +7 -6
  52. package/dist/modules/agent/runtime/app/tools/get_mutation_history/index.d.ts +25 -0
  53. package/dist/modules/agent/runtime/app/tools/get_mutation_history/index.js +2 -2
  54. package/dist/modules/agent/runtime/app/tools/get_page_structure/index.d.ts +8 -0
  55. package/dist/modules/agent/runtime/app/tools/get_page_structure/index.js +2 -2
  56. package/dist/modules/agent/runtime/app/tools/get_page_text/index.d.ts +6 -0
  57. package/dist/modules/agent/runtime/app/tools/get_page_text/index.js +2 -2
  58. package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.d.ts +81 -0
  59. package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +20 -12
  60. package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.d.ts +14 -0
  61. package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.js +2 -2
  62. package/dist/modules/agent/runtime/app/tools/get_paragraphs_in_viewport/index.d.ts +38 -0
  63. package/dist/modules/agent/runtime/app/tools/get_paragraphs_in_viewport/index.js +7 -6
  64. package/dist/modules/agent/runtime/app/tools/get_readability_issues/index.d.ts +12 -0
  65. package/dist/modules/agent/runtime/app/tools/get_readability_issues/index.js +2 -2
  66. package/dist/modules/agent/runtime/app/tools/get_referenced_entities/index.d.ts +14 -0
  67. package/dist/modules/agent/runtime/app/tools/get_referenced_entities/index.js +2 -2
  68. package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.d.ts +9 -0
  69. package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.js +2 -2
  70. package/dist/modules/agent/runtime/app/tools/go_to_history_index/index.d.ts +16 -0
  71. package/dist/modules/agent/runtime/app/tools/go_to_history_index/index.js +3 -2
  72. package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.d.ts +22 -0
  73. package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.js +3 -2
  74. package/dist/modules/agent/runtime/app/tools/rearrange_paragraphs/index.d.ts +21 -0
  75. package/dist/modules/agent/runtime/app/tools/rearrange_paragraphs/index.js +3 -2
  76. package/dist/modules/agent/runtime/app/tools/replace_content_search_item/index.d.ts +20 -0
  77. package/dist/modules/agent/runtime/app/tools/replace_content_search_item/index.js +3 -2
  78. package/dist/modules/agent/runtime/app/tools/replace_media_field/index.d.ts +19 -0
  79. package/dist/modules/agent/runtime/app/tools/replace_media_field/index.js +3 -2
  80. package/dist/modules/agent/runtime/app/tools/schemas.d.ts +13 -5
  81. package/dist/modules/agent/runtime/app/tools/schemas.js +17 -10
  82. package/dist/modules/agent/runtime/app/tools/search_content/index.d.ts +15 -0
  83. package/dist/modules/agent/runtime/app/tools/search_content/index.js +8 -7
  84. package/dist/modules/agent/runtime/app/tools/search_media/index.d.ts +5 -1
  85. package/dist/modules/agent/runtime/app/tools/search_media/index.js +2 -2
  86. package/dist/modules/agent/runtime/app/tools/search_reusable_paragraphs/index.d.ts +16 -0
  87. package/dist/modules/agent/runtime/app/tools/search_reusable_paragraphs/index.js +2 -2
  88. package/dist/modules/agent/runtime/app/tools/search_templates/index.d.ts +13 -0
  89. package/dist/modules/agent/runtime/app/tools/search_templates/index.js +2 -2
  90. package/dist/modules/agent/runtime/app/tools/search_text/index.d.ts +15 -0
  91. package/dist/modules/agent/runtime/app/tools/search_text/index.js +2 -2
  92. package/dist/modules/agent/runtime/app/tools/select_media/index.d.ts +2 -2
  93. package/dist/modules/agent/runtime/app/tools/select_media/index.js +2 -2
  94. package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.d.ts +19 -0
  95. package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.js +3 -2
  96. package/dist/modules/agent/runtime/app/tools/swap_paragraphs/index.d.ts +17 -0
  97. package/dist/modules/agent/runtime/app/tools/swap_paragraphs/index.js +3 -2
  98. package/dist/modules/agent/runtime/app/tools/update_text_fields/index.d.ts +13 -4
  99. package/dist/modules/agent/runtime/app/tools/update_text_fields/index.js +8 -7
  100. package/dist/modules/agent/runtime/app/tools/web_fetch/index.d.ts +17 -0
  101. package/dist/modules/agent/runtime/app/tools/web_fetch/index.js +2 -2
  102. package/dist/modules/agent/runtime/app/types/index.d.ts +6 -9
  103. package/dist/modules/agent/runtime/app/types/index.js +4 -3
  104. package/dist/modules/agent/runtime/server/agent.js +1 -1
  105. package/dist/modules/agent/runtime/server/classes/Session/index.d.ts +2 -2
  106. package/dist/modules/agent/runtime/server/classes/Session/index.js +6 -5
  107. package/dist/modules/agent/runtime/server/default-system-prompts/important-rules.js +2 -1
  108. package/dist/modules/agent/runtime/shared/toolParams.d.ts +19 -0
  109. package/dist/modules/agent/runtime/shared/toolParams.js +6 -0
  110. package/dist/modules/agent/runtime/shared/types.d.ts +23 -4
  111. package/dist/modules/agent/runtime/shared/types.js +6 -1
  112. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue +4 -13
  113. package/dist/modules/drupal/runtime/adapter/index.js +36 -26
  114. package/dist/runtime/editor/components/Actions/Title/index.vue +7 -6
  115. package/dist/runtime/editor/components/DiffApproval/index.vue +2 -2
  116. package/dist/runtime/editor/components/Dropdown/index.vue +0 -39
  117. package/dist/runtime/editor/components/DropdownItem/index.d.vue.ts +12 -2
  118. package/dist/runtime/editor/components/DropdownItem/index.vue +46 -2
  119. package/dist/runtime/editor/components/DropdownItem/index.vue.d.ts +12 -2
  120. package/dist/runtime/editor/components/FlexTextarea/index.d.vue.ts +1 -1
  121. package/dist/runtime/editor/components/FlexTextarea/index.vue.d.ts +1 -1
  122. package/dist/runtime/editor/css/output.css +1 -1
  123. package/dist/runtime/editor/features/changelog/changelog.json +9 -1
  124. package/dist/runtime/editor/plugins/Sidebar/Detached/index.d.vue.ts +1 -1
  125. package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue.d.ts +1 -1
  126. package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +2 -2
  127. package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +2 -2
  128. package/dist/runtime/editor/translations/de.json +2 -0
  129. package/dist/runtime/editor/translations/gsw_CH.json +9 -0
  130. package/package.json +3 -2
@@ -1,2 +1,21 @@
1
+ import { z } from 'zod';
2
+ export declare const paramsSchema: z.ZodObject<{
3
+ uuid: z.ZodString;
4
+ field: z.ZodString;
5
+ mediaId: z.ZodString;
6
+ mediaBundle: z.ZodString;
7
+ }, z.core.$strip>;
8
+ export declare const resultSchema: z.ZodUnion<readonly [z.ZodObject<{
9
+ type: z.ZodEnum<{
10
+ rewrite: "rewrite";
11
+ delete: "delete";
12
+ add: "add";
13
+ move: "move";
14
+ options: "options";
15
+ }>;
16
+ label: z.ZodString;
17
+ }, z.core.$strip>, z.ZodObject<{
18
+ error: z.ZodString;
19
+ }, z.core.$strip>]>;
1
20
  declare const _default: any;
2
21
  export default _default;
@@ -5,12 +5,13 @@ import {
5
5
  requireBundlePermission,
6
6
  requireNoRestrictedAncestor
7
7
  } from "../../helpers/validation.js";
8
- const paramsSchema = z.object({
8
+ export const paramsSchema = z.object({
9
9
  uuid: z.string().describe("The paragraph UUID or entity UUID containing the media field"),
10
10
  field: z.string().describe("The content field name (reference type)"),
11
11
  mediaId: z.string().describe("The media item ID (from search_media results)"),
12
12
  mediaBundle: z.string().describe('The media bundle type (e.g., "image")')
13
13
  });
14
+ export const resultSchema = mutationResultSchema;
14
15
  export default defineBlokkliAgentTool({
15
16
  name: "replace_media_field",
16
17
  description: "Replace the media on an existing paragraph field. Use get_content_fields first to see available reference fields, then search_media to find media items.",
@@ -22,7 +23,7 @@ export default defineBlokkliAgentTool({
22
23
  return $t("aiAgentReplaceMediaRunning", "Replacing media", { more: true });
23
24
  },
24
25
  paramsSchema,
25
- resultSchema: mutationResultSchema,
26
+ resultSchema,
26
27
  requiredAdapterMethods: ["mediaLibraryReplaceMedia"],
27
28
  execute(ctx, params) {
28
29
  const { blocks, types, $t, context } = ctx.app;
@@ -100,16 +100,23 @@ export declare const fieldDiffResultSchema: z.ZodObject<{
100
100
  agentMessage: z.ZodOptional<z.ZodString>;
101
101
  historyIndex: z.ZodOptional<z.ZodNumber>;
102
102
  }, z.core.$strip>;
103
+ /**
104
+ * Schema for a single entry in a mutation's `newParagraphs` payload. Recursive
105
+ * so nested children appear under their parent's `children` keyed by paragraph
106
+ * field name — mirroring the input shape of `add_paragraphs`.
107
+ */
108
+ type NewParagraphEntry = {
109
+ uuid: string;
110
+ bundle: string;
111
+ paragraphFields?: string[];
112
+ children?: Record<string, NewParagraphEntry[]>;
113
+ };
103
114
  /**
104
115
  * Schema for the success result sent back to the AI after mutation is applied.
105
116
  */
106
117
  export declare const mutationSuccessSchema: z.ZodUnion<readonly [z.ZodObject<{
107
118
  success: z.ZodLiteral<true>;
108
- newParagraphs: z.ZodOptional<z.ZodArray<z.ZodObject<{
109
- uuid: z.ZodString;
110
- bundle: z.ZodString;
111
- paragraphFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
112
- }, z.core.$strip>>>;
119
+ newParagraphs: z.ZodOptional<z.ZodArray<z.ZodType<NewParagraphEntry, unknown, z.core.$ZodTypeInternals<NewParagraphEntry, unknown>>>>;
113
120
  historyIndex: z.ZodNumber;
114
121
  }, z.core.$strip>, z.ZodObject<{
115
122
  success: z.ZodLiteral<false>;
@@ -117,3 +124,4 @@ export declare const mutationSuccessSchema: z.ZodUnion<readonly [z.ZodObject<{
117
124
  }, z.core.$strip>, z.ZodObject<{
118
125
  error: z.ZodString;
119
126
  }, z.core.$strip>]>;
127
+ export {};
@@ -89,19 +89,26 @@ export const fieldDiffResultSchema = z.object({
89
89
  ),
90
90
  historyIndex: z.number().optional().describe("The mutation history index after applying changes")
91
91
  });
92
+ const newParagraphEntrySchema = z.lazy(
93
+ () => z.object({
94
+ uuid: z.string(),
95
+ bundle: z.string(),
96
+ paragraphFields: z.array(z.string()).optional().describe(
97
+ "Paragraph fields on this new paragraph that can hold nested paragraphs. Call get_child_paragraphs with this paragraph's UUID to add paragraphs to these fields."
98
+ ),
99
+ children: z.record(
100
+ z.string().describe("Paragraph field name"),
101
+ z.array(newParagraphEntrySchema)
102
+ ).optional().describe(
103
+ "Nested paragraphs created inside this entry, keyed by paragraph field name. Mirrors the `children` shape used by add_paragraphs \u2014 the structure round-trips, so a child here means it actually landed inside this parent."
104
+ )
105
+ })
106
+ );
92
107
  export const mutationSuccessSchema = z.union([
93
108
  z.object({
94
109
  success: z.literal(true),
95
- newParagraphs: z.array(
96
- z.object({
97
- uuid: z.string(),
98
- bundle: z.string(),
99
- paragraphFields: z.array(z.string()).optional().describe(
100
- "Paragraph fields on this new paragraph that can hold nested paragraphs. Call get_child_paragraphs with this paragraph's UUID to add paragraphs to these fields."
101
- )
102
- })
103
- ).optional().describe(
104
- "Paragraphs created by this mutation (for add/duplicate operations), with their UUIDs and bundle types"
110
+ newParagraphs: z.array(newParagraphEntrySchema).optional().describe(
111
+ "Top-level paragraphs created by this mutation (for add/duplicate operations). Nested children appear under each entry's `children` keyed by paragraph field name; the tree mirrors what was requested."
105
112
  ),
106
113
  historyIndex: z.number().describe("Current position in mutation history (-1 = pristine)")
107
114
  }),
@@ -1,2 +1,17 @@
1
+ import { z } from 'zod';
2
+ export declare const paramsSchema: z.ZodObject<{
3
+ tab: z.ZodString;
4
+ query: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export declare const resultSchema: z.ZodArray<z.ZodObject<{
7
+ id: z.ZodString;
8
+ title: z.ZodString;
9
+ entityType: z.ZodString;
10
+ entityBundle: z.ZodString;
11
+ targetBundles: z.ZodArray<z.ZodString>;
12
+ context: z.ZodOptional<z.ZodString>;
13
+ text: z.ZodOptional<z.ZodString>;
14
+ imageUrl: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>>;
1
16
  declare const _default: any;
2
17
  export default _default;
@@ -1,6 +1,12 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
- const resultSchema = z.array(
3
+ export const paramsSchema = z.object({
4
+ tab: z.string().describe(
5
+ "The tab ID to search in. See the system prompt for available tab IDs."
6
+ ),
7
+ query: z.string().describe("The search query")
8
+ });
9
+ export const resultSchema = z.array(
4
10
  z.object({
5
11
  id: z.string().describe("The unique ID of the content item"),
6
12
  title: z.string().describe("The display title of the content item"),
@@ -24,12 +30,7 @@ export default defineBlokkliAgentTool({
24
30
  more: true
25
31
  });
26
32
  },
27
- paramsSchema: z.object({
28
- tab: z.string().describe(
29
- "The tab ID to search in. See the system prompt for available tab IDs."
30
- ),
31
- query: z.string().describe("The search query")
32
- }),
33
+ paramsSchema,
33
34
  resultSchema,
34
35
  async execute(ctx, params) {
35
36
  const tabs = await ctx.adapter.getContentSearchTabs();
@@ -1,5 +1,9 @@
1
1
  import { z } from 'zod';
2
- declare const resultSchema: z.ZodObject<{
2
+ export declare const paramsSchema: z.ZodObject<{
3
+ query: z.ZodOptional<z.ZodString>;
4
+ bundle: z.ZodOptional<z.ZodString>;
5
+ }, z.core.$strip>;
6
+ export declare const resultSchema: z.ZodObject<{
3
7
  items: z.ZodArray<z.ZodObject<{
4
8
  mediaId: z.ZodString;
5
9
  label: z.ZodString;
@@ -1,12 +1,12 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
- const paramsSchema = z.object({
3
+ export const paramsSchema = z.object({
4
4
  query: z.string().optional().describe(
5
5
  'Search text to filter media items. Searching for "foobar test" will search the exact full string, so prefer searching single for words.'
6
6
  ),
7
7
  bundle: z.string().optional().describe('Media bundle filter (e.g., "image", "video")')
8
8
  });
9
- const resultSchema = z.object({
9
+ export const resultSchema = z.object({
10
10
  items: z.array(
11
11
  z.object({
12
12
  mediaId: z.string().describe("The unique ID of the media item"),
@@ -1,2 +1,18 @@
1
+ import { z } from 'zod';
2
+ export declare const paramsSchema: z.ZodObject<{
3
+ parent: z.ZodOptional<z.ZodObject<{
4
+ type: z.ZodString;
5
+ uuid: z.ZodString;
6
+ field: z.ZodString;
7
+ }, z.core.$strip>>;
8
+ }, z.core.$strip>;
9
+ export declare const resultSchema: z.ZodObject<{
10
+ items: z.ZodArray<z.ZodObject<{
11
+ uuid: z.ZodString;
12
+ label: z.ZodString;
13
+ bundle: z.ZodString;
14
+ }, z.core.$strip>>;
15
+ total: z.ZodNumber;
16
+ }, z.core.$strip>;
1
17
  declare const _default: any;
2
18
  export default _default;
@@ -3,7 +3,7 @@ import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
3
  import { parentSchema } from "../schemas.js";
4
4
  import { fromLibraryBlockBundle } from "#blokkli-build/config";
5
5
  import { resolveHost } from "../helpers.js";
6
- const paramsSchema = z.object({
6
+ export const paramsSchema = z.object({
7
7
  parent: parentSchema.optional().describe(
8
8
  "The parent entity where a reusable paragraph would be added. When provided, results are filtered to only include bundles allowed in this field."
9
9
  )
@@ -13,7 +13,7 @@ const reusableParagraphSchema = z.object({
13
13
  label: z.string().describe("The display label"),
14
14
  bundle: z.string().describe("The paragraph bundle type of the reusable paragraph")
15
15
  });
16
- const resultSchema = z.object({
16
+ export const resultSchema = z.object({
17
17
  items: z.array(reusableParagraphSchema).describe("Matching reusable paragraphs"),
18
18
  total: z.number().describe("Total number of matching reusable paragraphs")
19
19
  });
@@ -1,2 +1,15 @@
1
+ import { z } from 'zod';
2
+ export declare const paramsSchema: z.ZodObject<{
3
+ query: z.ZodOptional<z.ZodString>;
4
+ }, z.core.$strip>;
5
+ export declare const resultSchema: z.ZodObject<{
6
+ templates: z.ZodArray<z.ZodObject<{
7
+ uuid: z.ZodString;
8
+ label: z.ZodString;
9
+ description: z.ZodOptional<z.ZodString>;
10
+ itemBundles: z.ZodArray<z.ZodString>;
11
+ }, z.core.$strip>>;
12
+ total: z.ZodNumber;
13
+ }, z.core.$strip>;
1
14
  declare const _default: any;
2
15
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
- const paramsSchema = z.object({
3
+ export const paramsSchema = z.object({
4
4
  query: z.string().optional().describe("Search text to filter templates")
5
5
  });
6
6
  const templateSchema = z.object({
@@ -9,7 +9,7 @@ const templateSchema = z.object({
9
9
  description: z.string().optional().describe("A short description of the template"),
10
10
  itemBundles: z.array(z.string()).describe("Paragraph types contained in the template")
11
11
  });
12
- const resultSchema = z.object({
12
+ export const resultSchema = z.object({
13
13
  templates: z.array(templateSchema).describe("Matching templates"),
14
14
  total: z.number().describe("Total number of matching templates")
15
15
  });
@@ -1,2 +1,17 @@
1
+ import { z } from 'zod';
2
+ export declare const paramsSchema: z.ZodObject<{
3
+ query: z.ZodString;
4
+ bundle: z.ZodOptional<z.ZodString>;
5
+ limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
6
+ }, z.core.$strip>;
7
+ export declare const resultSchema: z.ZodObject<{
8
+ matches: z.ZodArray<z.ZodObject<{
9
+ uuid: z.ZodString;
10
+ bundle: z.ZodString;
11
+ matchedText: z.ZodString;
12
+ matchCount: z.ZodNumber;
13
+ }, z.core.$strip>>;
14
+ totalMatches: z.ZodNumber;
15
+ }, z.core.$strip>;
1
16
  declare const _default: any;
2
17
  export default _default;
@@ -1,13 +1,13 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
- const paramsSchema = z.object({
3
+ export const paramsSchema = z.object({
4
4
  query: z.string().describe(
5
5
  'The text to search for. For regex, use JavaScript regex literal format: /pattern/flags (e.g., "/hello|world/gi" to match either word case-insensitively). Plain text is matched case-insensitively by default.'
6
6
  ),
7
7
  bundle: z.string().optional().describe("Optional: only search in paragraphs of this bundle type"),
8
8
  limit: z.coerce.number().optional().default(20).describe("Maximum number of results to return (default: 20)")
9
9
  });
10
- const resultSchema = z.object({
10
+ export const resultSchema = z.object({
11
11
  matches: z.array(
12
12
  z.object({
13
13
  uuid: z.string().describe("The paragraph UUID"),
@@ -5,7 +5,7 @@ declare const mediaItemSchema: z.ZodObject<{
5
5
  mediaBundle: z.ZodString;
6
6
  thumbnail: z.ZodOptional<z.ZodString>;
7
7
  }, z.core.$strip>;
8
- declare const paramsSchema: z.ZodObject<{
8
+ export declare const paramsSchema: z.ZodObject<{
9
9
  items: z.ZodArray<z.ZodObject<{
10
10
  mediaId: z.ZodString;
11
11
  label: z.ZodString;
@@ -14,7 +14,7 @@ declare const paramsSchema: z.ZodObject<{
14
14
  }, z.core.$strip>>;
15
15
  prompt: z.ZodOptional<z.ZodString>;
16
16
  }, z.core.$strip>;
17
- declare const resultSchema: z.ZodObject<{
17
+ export declare const resultSchema: z.ZodObject<{
18
18
  selected: z.ZodNullable<z.ZodObject<{
19
19
  mediaId: z.ZodString;
20
20
  label: z.ZodString;
@@ -7,11 +7,11 @@ const mediaItemSchema = z.object({
7
7
  mediaBundle: z.string().describe('The media type (e.g., "image", "video")'),
8
8
  thumbnail: z.string().optional().describe("URL of the thumbnail image")
9
9
  });
10
- const paramsSchema = z.object({
10
+ export const paramsSchema = z.object({
11
11
  items: z.array(mediaItemSchema).describe("Media items from search_media to display for selection"),
12
12
  prompt: z.string().optional().describe("Optional message to show the user explaining what to select")
13
13
  });
14
- const resultSchema = z.object({
14
+ export const resultSchema = z.object({
15
15
  selected: mediaItemSchema.nullable().describe("The selected media item, or null if the user cancelled"),
16
16
  label: z.string().optional().describe("Human-readable label of the prompt (for UI display)")
17
17
  });
@@ -1,2 +1,21 @@
1
+ import { z } from 'zod';
2
+ export declare const paramsSchema: z.ZodObject<{
3
+ paragraphs: z.ZodArray<z.ZodObject<{
4
+ uuid: z.ZodString;
5
+ options: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodString>]>>;
6
+ }, z.core.$strip>>;
7
+ }, z.core.$strip>;
8
+ export declare const resultSchema: z.ZodUnion<readonly [z.ZodObject<{
9
+ type: z.ZodEnum<{
10
+ rewrite: "rewrite";
11
+ delete: "delete";
12
+ add: "add";
13
+ move: "move";
14
+ options: "options";
15
+ }>;
16
+ label: z.ZodString;
17
+ }, z.core.$strip>, z.ZodObject<{
18
+ error: z.ZodString;
19
+ }, z.core.$strip>]>;
1
20
  declare const _default: any;
2
21
  export default _default;
@@ -12,9 +12,10 @@ const paragraphOptionsSchema = z.object({
12
12
  uuid: z.string().describe("The paragraph UUID"),
13
13
  options: z.record(z.string(), optionValueSchema).describe("Options to set as key-value pairs")
14
14
  });
15
- const paramsSchema = z.object({
15
+ export const paramsSchema = z.object({
16
16
  paragraphs: z.array(paragraphOptionsSchema).describe("Array of paragraphs with their options to set")
17
17
  });
18
+ export const resultSchema = mutationResultSchema;
18
19
  export default defineBlokkliAgentTool({
19
20
  name: "set_paragraph_options",
20
21
  description: "Set options on one or more paragraphs. Each paragraph entry contains a UUID and an options object with key-value pairs.",
@@ -28,7 +29,7 @@ export default defineBlokkliAgentTool({
28
29
  },
29
30
  lazy: true,
30
31
  paramsSchema,
31
- resultSchema: mutationResultSchema,
32
+ resultSchema,
32
33
  requiredAdapterMethods: ["updateOptions"],
33
34
  execute(ctx, params) {
34
35
  const { blocks, selection } = ctx.app;
@@ -1,2 +1,19 @@
1
+ import { z } from 'zod';
2
+ export declare const paramsSchema: z.ZodObject<{
3
+ uuid1: z.ZodString;
4
+ uuid2: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export declare const resultSchema: z.ZodUnion<readonly [z.ZodObject<{
7
+ type: z.ZodEnum<{
8
+ rewrite: "rewrite";
9
+ delete: "delete";
10
+ add: "add";
11
+ move: "move";
12
+ options: "options";
13
+ }>;
14
+ label: z.ZodString;
15
+ }, z.core.$strip>, z.ZodObject<{
16
+ error: z.ZodString;
17
+ }, z.core.$strip>]>;
1
18
  declare const _default: any;
2
19
  export default _default;
@@ -2,10 +2,11 @@ import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
3
  import { mutationResultSchema } from "../schemas.js";
4
4
  import { getSwapDisabledReason } from "#blokkli/editor/helpers/swap";
5
- const paramsSchema = z.object({
5
+ export const paramsSchema = z.object({
6
6
  uuid1: z.string().describe("First paragraph UUID"),
7
7
  uuid2: z.string().describe("Second paragraph UUID")
8
8
  });
9
+ export const resultSchema = mutationResultSchema;
9
10
  export default defineBlokkliAgentTool({
10
11
  name: "swap_paragraphs",
11
12
  description: "Swap the positions of two paragraphs, either in the same field or different fields.",
@@ -17,7 +18,7 @@ export default defineBlokkliAgentTool({
17
18
  },
18
19
  lazy: true,
19
20
  paramsSchema,
20
- resultSchema: mutationResultSchema,
21
+ resultSchema,
21
22
  requiredAdapterMethods: ["swapBlocks"],
22
23
  execute(ctx, params) {
23
24
  const { blocks, types, $t, permissions } = ctx.app;
@@ -6,14 +6,14 @@ declare const operationSchema: z.ZodObject<{
6
6
  fieldName: z.ZodString;
7
7
  search: z.ZodString;
8
8
  replace: z.ZodString;
9
- selector: any;
9
+ selector: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
10
10
  }, z.core.$strip>;
11
11
  declare const updateSchema: z.ZodObject<{
12
12
  uuid: z.ZodString;
13
13
  fieldName: z.ZodString;
14
14
  value: z.ZodString;
15
15
  }, z.core.$strip>;
16
- declare const paramsSchema: z.ZodObject<{
16
+ export declare const paramsSchema: z.ZodObject<{
17
17
  updates: z.ZodOptional<z.ZodArray<z.ZodObject<{
18
18
  uuid: z.ZodString;
19
19
  fieldName: z.ZodString;
@@ -24,9 +24,9 @@ declare const paramsSchema: z.ZodObject<{
24
24
  fieldName: z.ZodString;
25
25
  search: z.ZodString;
26
26
  replace: z.ZodString;
27
- selector: any;
27
+ selector: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
28
28
  }, z.core.$strip>>>;
29
- requireApproval: any;
29
+ requireApproval: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
30
30
  }, z.core.$strip>;
31
31
  export type BatchRewriteParams = z.infer<typeof paramsSchema>;
32
32
  export type BatchRewriteResult = z.infer<typeof fieldDiffResultSchema>;
@@ -42,5 +42,14 @@ export type ComponentParams = {
42
42
  requireApproval?: boolean;
43
43
  skipped: SkippedField[];
44
44
  };
45
+ export declare const resultSchema: z.ZodObject<{
46
+ acceptedCount: z.ZodNumber;
47
+ rejectedByUser: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
48
+ reasonForRejection: z.ZodString;
49
+ }, z.core.$strip>>>;
50
+ label: z.ZodString;
51
+ agentMessage: z.ZodOptional<z.ZodString>;
52
+ historyIndex: z.ZodOptional<z.ZodNumber>;
53
+ }, z.core.$strip>;
45
54
  declare const _default: any;
46
55
  export default _default;
@@ -6,7 +6,7 @@ import {
6
6
  } from "../../helpers/validation.js";
7
7
  import { onlyUnique } from "#blokkli/helpers";
8
8
  import { fieldDiffResultSchema } from "../schemas.js";
9
- import { booleanParam } from "#blokkli/agent/shared/toolParams";
9
+ import { optionalBooleanParam } from "../../../shared/toolParams.js";
10
10
  import { resolveHost } from "../helpers.js";
11
11
  import { skippedFieldsMessage } from "../fieldDiffApproval.js";
12
12
  import Component from "./Component.vue";
@@ -20,26 +20,27 @@ const operationSchema = z.object({
20
20
  replace: z.string().describe(
21
21
  "The replacement text (or innerHTML when search is a CSS selector)"
22
22
  ),
23
- selector: booleanParam(
23
+ selector: optionalBooleanParam(
24
24
  "Set to true when search is a CSS selector instead of a text search"
25
- ).optional()
25
+ )
26
26
  });
27
27
  const updateSchema = z.object({
28
28
  uuid: z.string().describe("The paragraph UUID"),
29
29
  fieldName: z.string().describe("The editable field name"),
30
30
  value: z.string().describe("The complete new field value \u2014 overwrites the entire field")
31
31
  });
32
- const paramsSchema = z.object({
32
+ export const paramsSchema = z.object({
33
33
  updates: z.array(updateSchema).optional().describe(
34
34
  "Full-replacement mode: a list of { uuid, fieldName, value } entries. Each overwrites the entire field with the given value. Use when the value changes substantially or you already have the final text."
35
35
  ),
36
36
  operations: z.array(operationSchema).optional().describe(
37
37
  "Patch mode: search/replace operations applied to each field's CURRENT value, so `search` must match the existing content exactly. Best for small targeted edits like typo fixes \u2014 avoids re-sending the whole value. If `search` is not found, that field is left unchanged."
38
38
  ),
39
- requireApproval: booleanParam(
39
+ requireApproval: optionalBooleanParam(
40
40
  "The approval UI is shown by default. Set to false to apply the changes immediately without confirmation \u2014 only when the user supplied the exact text themselves."
41
- ).optional()
41
+ )
42
42
  });
43
+ export const resultSchema = fieldDiffResultSchema;
43
44
  export default defineBlokkliAgentTool({
44
45
  name: "update_text_fields",
45
46
  description: "Update text content fields on one or more paragraphs. Two modes, which may be combined in a single call:\n- Full replacement via `updates`: a list of { uuid, fieldName, value } entries, each overwriting the entire field with a complete new value. Use when the value changes substantially or you already have the final text.\n- Patch via `operations`: search/replace pairs applied to each field's CURRENT value (so `search` must match the existing content). Best for small edits like typo fixes, since you only send the changed part. Set `selector: true` on an operation to treat `search` as a CSS selector (e.g. \"p:nth-child(3)\") and `replace` as the matched element's innerHTML.\nThe approval UI is shown by default; set requireApproval to false to apply immediately (only when the user supplied the exact text).",
@@ -53,7 +54,7 @@ export default defineBlokkliAgentTool({
53
54
  });
54
55
  },
55
56
  paramsSchema,
56
- resultSchema: fieldDiffResultSchema,
57
+ resultSchema,
57
58
  requiredAdapterMethods: ["updateFieldValueBatched"],
58
59
  component: Component,
59
60
  detailsComponent: DetailsComponent,
@@ -1,2 +1,19 @@
1
+ import { z } from 'zod';
2
+ export declare const paramsSchema: z.ZodObject<{
3
+ url: z.ZodString;
4
+ format: z.ZodDefault<z.ZodEnum<{
5
+ markdown: "markdown";
6
+ html: "html";
7
+ }>>;
8
+ }, z.core.$strip>;
9
+ export declare const resultSchema: z.ZodObject<{
10
+ content: z.ZodString;
11
+ title: z.ZodString;
12
+ format: z.ZodEnum<{
13
+ markdown: "markdown";
14
+ html: "html";
15
+ }>;
16
+ url: z.ZodString;
17
+ }, z.core.$strip>;
1
18
  declare const _default: any;
2
19
  export default _default;
@@ -1,13 +1,13 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
3
  import { routeFetch } from "#blokkli-build/agent-client";
4
- const paramsSchema = z.object({
4
+ export const paramsSchema = z.object({
5
5
  url: z.string().url().describe("The URL to fetch content from"),
6
6
  format: z.enum(["markdown", "html"]).default("markdown").describe(
7
7
  'Output format: "markdown" (default) converts HTML to readable Markdown preserving structure, "html" returns cleaned raw HTML'
8
8
  )
9
9
  });
10
- const resultSchema = z.object({
10
+ export const resultSchema = z.object({
11
11
  content: z.string().describe("The page content in the requested format (markdown or html)"),
12
12
  title: z.string().describe("The page title"),
13
13
  format: z.enum(["markdown", "html"]).describe("The format of the content"),
@@ -1,11 +1,12 @@
1
1
  import type { BlokkliApp } from '#blokkli/editor/types/app';
2
2
  import type { FullBlokkliAdapter, MutationResponseLike, AdapterMethods } from '#blokkli/editor/adapter';
3
3
  import type { EditMode } from '#blokkli/editor/types/state';
4
- import { type UsageTurn } from '#blokkli/agent/shared/types';
4
+ import { type SelectedBlock, type UsageTurn } from '#blokkli/agent/shared/types';
5
5
  import { z } from 'zod';
6
6
  import type { Component } from 'vue';
7
7
  import type { AgentToolName, AgentSkillName, AgentToolMap } from '#blokkli-build/agent-client';
8
8
  import type { TextProvider } from '#blokkli/editor/providers/texts';
9
+ import type { NewParagraphNode } from '#blokkli/agent/app/helpers/mutationResult';
9
10
  /**
10
11
  * A host entity (parent of a block).
11
12
  * Used consistently across tools for specifying block locations.
@@ -23,11 +24,7 @@ export type McpToolCategory = 'query' | 'mutation';
23
24
  export type MutationToolResult = {
24
25
  success: true;
25
26
  historyIndex: number;
26
- newParagraphs?: Array<{
27
- uuid: string;
28
- bundle: string;
29
- paragraphFields?: string[];
30
- }>;
27
+ newParagraphs?: NewParagraphNode[];
31
28
  } | {
32
29
  success: false;
33
30
  rejected?: true;
@@ -312,7 +309,7 @@ export type AgentPromptDefinition = {
312
309
  */
313
310
  preExecute?: (ctx: {
314
311
  app: BlokkliApp;
315
- selectedUuids: string[];
312
+ selectedBlocks: SelectedBlock[];
316
313
  runTool: <T extends AgentToolName>(toolName: T, params: AgentToolMap[T]['params']) => Promise<PreSeededToolResult & {
317
314
  result: AgentToolMap[T]['result'];
318
315
  }>;
@@ -365,7 +362,7 @@ declare const userConversationItemSchema: z.ZodObject<{
365
362
  sendContext: z.ZodOptional<z.ZodObject<{
366
363
  promptId: z.ZodOptional<z.ZodString>;
367
364
  serverPrompt: z.ZodOptional<z.ZodString>;
368
- selectedUuids: z.ZodOptional<z.ZodArray<z.ZodString>>;
365
+ selectedBlocks: z.ZodOptional<z.ZodArray<any>>;
369
366
  autoLoadTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
370
367
  autoLoadSkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
371
368
  preSeededResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -470,7 +467,7 @@ export declare const conversationItemSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
470
467
  sendContext: z.ZodOptional<z.ZodObject<{
471
468
  promptId: z.ZodOptional<z.ZodString>;
472
469
  serverPrompt: z.ZodOptional<z.ZodString>;
473
- selectedUuids: z.ZodOptional<z.ZodArray<z.ZodString>>;
470
+ selectedBlocks: z.ZodOptional<z.ZodArray<any>>;
474
471
  autoLoadTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
475
472
  autoLoadSkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
476
473
  preSeededResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1,5 +1,6 @@
1
1
  import {
2
- agentErrorTypeSchema
2
+ agentErrorTypeSchema,
3
+ selectedBlockSchema
3
4
  } from "#blokkli/agent/shared/types";
4
5
  import { z } from "zod";
5
6
  const conversationItemBase = z.object({
@@ -35,7 +36,7 @@ const userConversationItemSchema = conversationItemBase.extend({
35
36
  * Original send parameters captured so retry produces byte-identical
36
37
  * execution — important for prompt-definition-driven sends where the
37
38
  * displayed text is a friendly label but the real work was driven by
38
- * `selectedUuids`, pre-computed tool results, auto-executed tools, and
39
+ * `selectedBlocks`, pre-computed tool results, auto-executed tools, and
39
40
  * auto-loaded tools/skills.
40
41
  *
41
42
  * Retry replays this context as-is. Edit discards `preSeededResults` and
@@ -45,7 +46,7 @@ const userConversationItemSchema = conversationItemBase.extend({
45
46
  sendContext: z.object({
46
47
  promptId: z.string().optional(),
47
48
  serverPrompt: z.string().optional(),
48
- selectedUuids: z.array(z.string()).optional(),
49
+ selectedBlocks: z.array(selectedBlockSchema).optional(),
49
50
  autoLoadTools: z.array(z.string()).optional(),
50
51
  autoLoadSkills: z.array(z.string()).optional(),
51
52
  preSeededResults: z.array(
@@ -85,7 +85,7 @@ export default defineWebSocketHandler({
85
85
  data.prompt,
86
86
  apiKey,
87
87
  authSecret,
88
- data.selectedUuids,
88
+ data.selectedBlocks,
89
89
  data.autoLoadTools,
90
90
  data.autoLoadSkills,
91
91
  data.preSeededResults,