@blokkli/editor 2.0.0-alpha.64 → 2.0.0-alpha.66

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 (52) hide show
  1. package/dist/module.d.mts +2 -2
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +48 -2
  4. package/dist/modules/agent/index.d.mts +1 -1
  5. package/dist/modules/agent/runtime/app/helpers/mutationResult.d.ts +12 -0
  6. package/dist/modules/agent/runtime/app/helpers/mutationResult.js +34 -0
  7. package/dist/modules/agent/runtime/app/providers/toolsProvider.js +13 -7
  8. package/dist/modules/agent/runtime/app/tools/.nuxt/app.config.d.mts +4 -0
  9. package/dist/modules/agent/runtime/app/tools/.nuxt/app.config.js +21 -0
  10. package/dist/modules/agent/runtime/app/tools/.nuxt/components.d.ts +66 -0
  11. package/dist/modules/agent/runtime/app/tools/.nuxt/imports.d.ts +30 -0
  12. package/dist/modules/agent/runtime/app/tools/.nuxt/manifest/meta/test.json +1 -0
  13. package/dist/modules/agent/runtime/app/tools/.nuxt/types/app.config.d.ts +35 -0
  14. package/dist/modules/agent/runtime/app/tools/.nuxt/types/build.d.ts +23 -0
  15. package/dist/modules/agent/runtime/app/tools/.nuxt/types/builder-env.d.ts +1 -0
  16. package/dist/modules/agent/runtime/app/tools/.nuxt/types/components.d.ts +71 -0
  17. package/dist/modules/agent/runtime/app/tools/.nuxt/types/imports.d.ts +386 -0
  18. package/dist/modules/agent/runtime/app/tools/.nuxt/types/middleware.d.ts +11 -0
  19. package/dist/modules/agent/runtime/app/tools/.nuxt/types/modules.d.ts +79 -0
  20. package/dist/modules/agent/runtime/app/tools/.nuxt/types/nitro-layouts.d.ts +17 -0
  21. package/dist/modules/agent/runtime/app/tools/.nuxt/types/nitro-nuxt.d.ts +64 -0
  22. package/dist/modules/agent/runtime/app/tools/.nuxt/types/plugins.d.ts +29 -0
  23. package/dist/modules/agent/runtime/app/tools/.nuxt/types/runtime-config.d.ts +32 -0
  24. package/dist/modules/agent/runtime/app/tools/.nuxt/types/shared-imports.d.ts +10 -0
  25. package/dist/modules/agent/runtime/app/tools/.nuxt/types/vue-shim.d.ts +0 -0
  26. package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.d.ts +15 -4
  27. package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.js +43 -15
  28. package/dist/modules/agent/runtime/server/server-tools/load_tools/index.d.ts +1 -3
  29. package/dist/modules/agent/runtime/server/server-tools/load_tools/index.js +3 -1
  30. package/dist/modules/charts/index.d.mts +1 -1
  31. package/dist/modules/drupal/graphql/base/query.pbConfig.graphql +2 -2
  32. package/dist/modules/drupal/index.d.mts +1 -1
  33. package/dist/modules/iframes/index.d.mts +1 -1
  34. package/dist/modules/index.d.mts +1 -1
  35. package/dist/modules/readability/index.d.mts +1 -1
  36. package/dist/modules/table-of-contents/index.d.mts +1 -1
  37. package/dist/runtime/css/output.css +1 -0
  38. package/dist/runtime/editor/components/FlexTextarea/index.d.vue.ts +1 -1
  39. package/dist/runtime/editor/components/FlexTextarea/index.vue.d.ts +1 -1
  40. package/dist/runtime/editor/css/output.css +1 -1
  41. package/dist/runtime/editor/features/changelog/changelog.json +0 -32
  42. package/dist/runtime/editor/plugins/ItemAction/index.d.vue.ts +1 -1
  43. package/dist/runtime/editor/plugins/ItemAction/index.vue.d.ts +1 -1
  44. package/dist/runtime/editor/plugins/Sidebar/Detached/index.d.vue.ts +1 -1
  45. package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue.d.ts +1 -1
  46. package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +2 -2
  47. package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +2 -2
  48. package/dist/runtime/editor/providers/state.d.ts +17 -1
  49. package/dist/runtime/editor/providers/state.js +14 -0
  50. package/dist/shared/{editor.BDyiQvbV.d.mts → editor.S5sA3rij.d.mts} +19 -1
  51. package/dist/types.d.mts +1 -1
  52. package/package.json +6 -6
@@ -0,0 +1,64 @@
1
+
2
+ /// <reference path="nitro-layouts.d.ts" />
3
+ /// <reference path="app.config.d.ts" />
4
+ /// <reference path="runtime-config.d.ts" />
5
+ /// <reference path="../../../../../../../../node_modules/@nuxt/nitro-server/dist/index.d.mts" />
6
+ /// <reference path="middleware.d.ts" />
7
+
8
+ import type { RuntimeConfig } from 'nuxt/schema'
9
+ import type { H3Event } from 'h3'
10
+ import type { LogObject } from 'consola'
11
+ import type { NuxtIslandContext, NuxtIslandResponse, NuxtRenderHTMLContext } from 'nuxt/app'
12
+
13
+ declare module 'nitropack' {
14
+ interface NitroRuntimeConfigApp {
15
+ buildAssetsDir: string
16
+ cdnURL: string
17
+ }
18
+ interface NitroRuntimeConfig extends RuntimeConfig {}
19
+ interface NitroRouteConfig {
20
+ ssr?: boolean
21
+ noScripts?: boolean
22
+ /** @deprecated Use `noScripts` instead */
23
+ experimentalNoScripts?: boolean
24
+ }
25
+ interface NitroRouteRules {
26
+ ssr?: boolean
27
+ noScripts?: boolean
28
+ /** @deprecated Use `noScripts` instead */
29
+ experimentalNoScripts?: boolean
30
+ appMiddleware?: Record<string, boolean>
31
+ appLayout?: string | false
32
+ }
33
+ interface NitroRuntimeHooks {
34
+ 'dev:ssr-logs': (ctx: { logs: LogObject[], path: string }) => void | Promise<void>
35
+ 'render:html': (htmlContext: NuxtRenderHTMLContext, context: { event: H3Event }) => void | Promise<void>
36
+ 'render:island': (islandResponse: NuxtIslandResponse, context: { event: H3Event, islandContext: NuxtIslandContext }) => void | Promise<void>
37
+ }
38
+ }
39
+ declare module 'nitropack/types' {
40
+ interface NitroRuntimeConfigApp {
41
+ buildAssetsDir: string
42
+ cdnURL: string
43
+ }
44
+ interface NitroRuntimeConfig extends RuntimeConfig {}
45
+ interface NitroRouteConfig {
46
+ ssr?: boolean
47
+ noScripts?: boolean
48
+ /** @deprecated Use `noScripts` instead */
49
+ experimentalNoScripts?: boolean
50
+ }
51
+ interface NitroRouteRules {
52
+ ssr?: boolean
53
+ noScripts?: boolean
54
+ /** @deprecated Use `noScripts` instead */
55
+ experimentalNoScripts?: boolean
56
+ appMiddleware?: Record<string, boolean>
57
+ appLayout?: string | false
58
+ }
59
+ interface NitroRuntimeHooks {
60
+ 'dev:ssr-logs': (ctx: { logs: LogObject[], path: string }) => void | Promise<void>
61
+ 'render:html': (htmlContext: NuxtRenderHTMLContext, context: { event: H3Event }) => void | Promise<void>
62
+ 'render:island': (islandResponse: NuxtIslandResponse, context: { event: H3Event, islandContext: NuxtIslandContext }) => void | Promise<void>
63
+ }
64
+ }
@@ -0,0 +1,29 @@
1
+ // Generated by Nuxt'
2
+ import type { Plugin } from '#app'
3
+
4
+ type Decorate<T extends Record<string, any>> = { [K in keyof T as K extends string ? `$${K}` : never]: T[K] }
5
+
6
+ type InjectionType<A extends Plugin> = A extends {default: Plugin<infer T>} ? Decorate<T> : unknown
7
+
8
+ type NuxtAppInjections =
9
+ InjectionType<typeof import("../../../../../../../../node_modules/nuxt/dist/app/plugins/revive-payload.client.js")> &
10
+ InjectionType<typeof import("../../../../../../../../node_modules/nuxt/dist/head/runtime/plugins/unhead.js")> &
11
+ InjectionType<typeof import("../../../../../../../../node_modules/nuxt/dist/app/plugins/router.js")> &
12
+ InjectionType<typeof import("../../../../../../../../node_modules/nuxt/dist/app/plugins/navigation-repaint.client.js")> &
13
+ InjectionType<typeof import("../../../../../../../../node_modules/nuxt/dist/app/plugins/check-outdated-build.client.js")> &
14
+ InjectionType<typeof import("../../../../../../../../node_modules/nuxt/dist/app/plugins/revive-payload.server.js")> &
15
+ InjectionType<typeof import("../../../../../../../../node_modules/nuxt/dist/app/plugins/chunk-reload.client.js")>
16
+
17
+ declare module '#app' {
18
+ interface NuxtApp extends NuxtAppInjections { }
19
+
20
+ interface NuxtAppLiterals {
21
+ pluginName: 'nuxt:revive-payload:client' | 'nuxt:head' | 'nuxt:router' | 'nuxt:revive-payload:server' | 'nuxt:chunk-reload' | 'nuxt:global-components'
22
+ }
23
+ }
24
+
25
+ declare module 'vue' {
26
+ interface ComponentCustomProperties extends NuxtAppInjections { }
27
+ }
28
+
29
+ export { }
@@ -0,0 +1,32 @@
1
+ import { RuntimeConfig as UserRuntimeConfig, PublicRuntimeConfig as UserPublicRuntimeConfig } from 'nuxt/schema'
2
+ interface SharedRuntimeConfig {
3
+ app: {
4
+ buildId: string,
5
+
6
+ baseURL: string,
7
+
8
+ buildAssetsDir: string,
9
+
10
+ cdnURL: string,
11
+ },
12
+
13
+ nitro: {
14
+ envPrefix: string,
15
+ },
16
+ }
17
+ interface SharedPublicRuntimeConfig {
18
+
19
+ }
20
+ declare module '@nuxt/schema' {
21
+ interface RuntimeConfig extends UserRuntimeConfig {}
22
+ interface PublicRuntimeConfig extends UserPublicRuntimeConfig {}
23
+ }
24
+ declare module 'nuxt/schema' {
25
+ interface RuntimeConfig extends SharedRuntimeConfig {}
26
+ interface PublicRuntimeConfig extends SharedPublicRuntimeConfig {}
27
+ }
28
+ declare module 'vue' {
29
+ interface ComponentCustomProperties {
30
+ $config: UserRuntimeConfig
31
+ }
32
+ }
@@ -0,0 +1,10 @@
1
+ // Generated by auto imports
2
+ export {}
3
+ declare global {
4
+ const useRuntimeConfig: (event?: import('h3').H3Event) => import('nuxt/schema').RuntimeConfig
5
+ const useAppConfig: () => import('nuxt/schema').AppConfig
6
+ const defineAppConfig: <C extends import('nuxt/schema').AppConfigInput>(config: C) => C
7
+ const createError: typeof import('h3')['createError']
8
+ const setResponseStatus: typeof import('h3')['setResponseStatus']
9
+
10
+ }
@@ -1,11 +1,22 @@
1
1
  import { z } from 'zod';
2
2
  type OptionValue = string | boolean | number | string[];
3
+ /**
4
+ * The accepted input shapes for a single content-field value, mirroring
5
+ * `contentFieldValueSchema`. Normalized to `CanonicalFieldValue` before use.
6
+ */
7
+ type ContentFieldInput = string | {
8
+ uri: string;
9
+ title?: string;
10
+ } | {
11
+ entityType: string;
12
+ entityId: string;
13
+ } | {
14
+ target_id: string;
15
+ target_type?: string;
16
+ };
3
17
  type BlockInput = {
4
18
  bundle: string;
5
- contentFields?: Record<string, string | {
6
- entityType: string;
7
- entityId: string;
8
- }>;
19
+ contentFields?: Record<string, ContentFieldInput>;
9
20
  options?: Record<string, OptionValue>;
10
21
  children?: Record<string, BlockInput[]>;
11
22
  };
@@ -17,23 +17,48 @@ import { validateFieldCardinality } from "../../helpers/validation.js";
17
17
  import { getFieldKey } from "#blokkli/helpers";
18
18
  import { optionValueToStorable } from "#blokkli/editor/helpers/options";
19
19
  import { countNewParagraphs } from "#blokkli/agent/app/helpers/mutationResult";
20
- const contentFieldValueSchema = z.union([
21
- z.string().describe(
22
- "Text value for plain/markup content fields, or a URL string (starting with http) for link content fields"
23
- ),
24
- z.object({
25
- entityType: z.string().describe('Entity type (e.g., "media", "node")'),
26
- entityId: z.string().describe("Entity ID")
27
- }).describe(
28
- "Entity reference for reference content fields (media, content references)"
29
- )
30
- ]);
20
+ const contentFieldValueSchema = z.union(
21
+ [
22
+ z.string().describe(
23
+ "Text for plain/markup fields, or a URL/link URI (https://\u2026, mailto:, tel:, internal:/path, entity:type/id) for link fields."
24
+ ),
25
+ z.object({
26
+ uri: z.string().describe("The link target: an absolute URL or a backend link URI."),
27
+ title: z.string().optional().describe(
28
+ "Optional link text. Accepted, but the URI is what gets stored \u2014 some backends do not persist the title yet."
29
+ )
30
+ }).describe("Link field value with an optional title."),
31
+ z.object({
32
+ entityType: z.string().describe('Entity type (e.g. "media", "node").'),
33
+ entityId: z.string().describe("Entity ID.")
34
+ }).describe(
35
+ "Entity reference for reference fields (media, content references), from search_media / search_content results."
36
+ ),
37
+ z.object({
38
+ target_id: z.string().describe("The referenced entity ID."),
39
+ target_type: z.string().optional().describe("The referenced entity type, if known.")
40
+ }).describe(
41
+ "Entity reference in the backend-native { target_id } shape (equivalent to { entityType, entityId })."
42
+ )
43
+ ],
44
+ {
45
+ error: "Content field value must be one of: a text/URL string; a link object { uri, title? }; or an entity reference { entityType, entityId } or { target_id, target_type? }."
46
+ }
47
+ );
31
48
  const contentFieldsSchema = z.record(
32
49
  z.string().describe("The content field name"),
33
50
  contentFieldValueSchema
34
51
  ).optional().describe(
35
52
  "Content field values to set on the new paragraph, keyed by field name. Use this to set text content and media/entity references in one step."
36
53
  );
54
+ function normalizeContentFieldValue(value) {
55
+ if (typeof value === "string") return value;
56
+ if ("uri" in value) return value.uri;
57
+ if ("target_id" in value) {
58
+ return { entityType: value.target_type ?? "", entityId: value.target_id };
59
+ }
60
+ return { entityType: value.entityType, entityId: value.entityId };
61
+ }
37
62
  const blockSchema = z.object({
38
63
  bundle: z.string().describe("The paragraph bundle to add"),
39
64
  contentFields: contentFieldsSchema,
@@ -54,7 +79,10 @@ export const paramsSchema = z.object({
54
79
  });
55
80
  function validateContentFields(ctx, block, path) {
56
81
  if (!block.contentFields) return void 0;
57
- for (const [fieldName, fieldValue] of Object.entries(block.contentFields)) {
82
+ for (const [fieldName, rawFieldValue] of Object.entries(
83
+ block.contentFields
84
+ )) {
85
+ const fieldValue = normalizeContentFieldValue(rawFieldValue);
58
86
  const editableConfig = ctx.app.types.editableFieldConfig.forName(
59
87
  ctx.itemEntityType,
60
88
  block.bundle,
@@ -76,7 +104,7 @@ function validateContentFields(ctx, block, path) {
76
104
  }
77
105
  if (droppableConfig) {
78
106
  if (typeof fieldValue === "string" && droppableConfig.type !== "link") {
79
- return `${path}: Field "${fieldName}" is a reference field and expects { entityType, entityId }, got a string.`;
107
+ return `${path}: Field "${fieldName}" is a reference field and expects { entityType, entityId } (or { target_id }), got a string.`;
80
108
  }
81
109
  }
82
110
  }
@@ -161,7 +189,7 @@ function buildEventBlocks(ctx, blocks, parentBundle) {
161
189
  const blockUuid = generateUUID();
162
190
  const values = block.contentFields ? Object.entries(block.contentFields).map(([fieldName, fieldValue]) => ({
163
191
  fieldName,
164
- fieldValue
192
+ fieldValue: normalizeContentFieldValue(fieldValue)
165
193
  })) : void 0;
166
194
  let options;
167
195
  if (block.options) {
@@ -229,7 +257,7 @@ function collectAllUuids(blocks) {
229
257
  export const resultSchema = mutationResultSchema;
230
258
  export default defineBlokkliAgentTool({
231
259
  name: "add_paragraphs",
232
- description: "Add one or more new paragraphs to the page. Supports nested structures via the `children` property \u2014 define entire paragraph trees in a single call. IMPORTANT: Always provide content field values (text, media/entity references) directly via contentFields, instead of adding empty paragraphs! For reference content fields (media), set the value to { entityType, entityId } from search_media results. NOTE: You can ONLY provide content fields, NOT paragraph fields! For nested paragraphs, use the `children` property keyed by paragraph field name. You can also set paragraph options inline via the `options` property (key-value pairs). The success result mirrors the input shape: each top-level entry in `newParagraphs` includes its own `children` keyed by paragraph field, so the structure round-trips and a nested child does NOT appear as a sibling \u2014 treat the tree as the source of truth instead of guessing from order.",
260
+ description: "Add one or more new paragraphs to the page. Supports nested structures via the `children` property \u2014 define entire paragraph trees in a single call. IMPORTANT: Always provide content field values (text, media/entity references) directly via contentFields, instead of adding empty paragraphs! For reference content fields (media), set the value to { entityType, entityId } from search_media results. For link fields, set a URL string or { uri, title }. NOTE: You can ONLY provide content fields, NOT paragraph fields! For nested paragraphs, use the `children` property keyed by paragraph field name. You can also set paragraph options inline via the `options` property (key-value pairs). The success result mirrors the input shape: each top-level entry in `newParagraphs` includes its own `children` keyed by paragraph field, so the structure round-trips and a nested child does NOT appear as a sibling \u2014 treat the tree as the source of truth instead of guessing from order.",
233
261
  category: "mutation",
234
262
  lazy: false,
235
263
  prunedSummary: (r) => r.success ? `added ${countNewParagraphs(r.newParagraphs ?? [])} paragraphs` : "rejected",
@@ -1,7 +1,5 @@
1
1
  import { z } from 'zod';
2
2
  declare const _default: import("..").ServerSideTool<z.ZodObject<{
3
- tools: z.ZodArray<z.ZodEnum<{
4
- [x: string]: string;
5
- }>>;
3
+ tools: z.ZodArray<z.ZodString>;
6
4
  }, z.core.$strip>>;
7
5
  export default _default;
@@ -5,7 +5,9 @@ export default defineServerSideTool({
5
5
  description: 'Load additional tools by name before using them. You must call this before using any tool listed under "Additional Tools" in the system prompt.',
6
6
  inputSchema(ctx) {
7
7
  return z.object({
8
- tools: z.array(z.enum(ctx.lazyToolNames)).describe("Tool names to activate")
8
+ tools: z.array(z.string()).describe(
9
+ ctx.lazyToolNames.length ? `Tool names to activate. Loadable tools: ${ctx.lazyToolNames.join(", ")}.` : "Tool names to activate."
10
+ )
9
11
  });
10
12
  },
11
13
  isAvailable(ctx) {
@@ -1,4 +1,4 @@
1
- import { B as BlokkliModule } from '../../shared/editor.BDyiQvbV.mjs';
1
+ import { B as BlokkliModule } from '../../shared/editor.S5sA3rij.mjs';
2
2
  import 'nuxt/schema';
3
3
  import 'consola';
4
4
  import '../../../dist/global/types/definitions.js';
@@ -16,8 +16,8 @@ fragment paragraphsBlokkliCurrentUser on ParagraphsBlokkliUser {
16
16
  permission: "manage default paragraph templates"
17
17
  )
18
18
 
19
- create_comments: hasPermission(permission: "post comments")
20
- view_comments: hasPermission(permission: "access comments")
19
+ create_comments: hasPermission(permission: "post blokkli comments")
20
+ view_comments: hasPermission(permission: "view blokkli comments")
21
21
  use_agent: hasPermission(permission: "use paragraphs blokkli agent")
22
22
  manage_agent_conversations: hasPermission(
23
23
  permission: "manage all blokkli agent conversations"
@@ -1,4 +1,4 @@
1
- import { B as BlokkliModule } from '../../shared/editor.BDyiQvbV.mjs';
1
+ import { B as BlokkliModule } from '../../shared/editor.S5sA3rij.mjs';
2
2
  import 'nuxt/schema';
3
3
  import 'consola';
4
4
  import '../../../dist/global/types/definitions.js';
@@ -1,4 +1,4 @@
1
- import { B as BlokkliModule } from '../../shared/editor.BDyiQvbV.mjs';
1
+ import { B as BlokkliModule } from '../../shared/editor.S5sA3rij.mjs';
2
2
  import 'nuxt/schema';
3
3
  import 'consola';
4
4
  import '../../../dist/global/types/definitions.js';
@@ -1,4 +1,4 @@
1
- export { b as Blokkli, B as BlokkliModule, d as defineBlokkliModule } from '../shared/editor.BDyiQvbV.mjs';
1
+ export { b as Blokkli, B as BlokkliModule, d as defineBlokkliModule } from '../shared/editor.S5sA3rij.mjs';
2
2
  import 'nuxt/schema';
3
3
  import 'consola';
4
4
  import '../../dist/global/types/definitions.js';
@@ -1,4 +1,4 @@
1
- import { B as BlokkliModule } from '../../shared/editor.BDyiQvbV.mjs';
1
+ import { B as BlokkliModule } from '../../shared/editor.S5sA3rij.mjs';
2
2
  import 'nuxt/schema';
3
3
  import 'consola';
4
4
  import '../../../dist/global/types/definitions.js';
@@ -1,4 +1,4 @@
1
- import { B as BlokkliModule } from '../../shared/editor.BDyiQvbV.mjs';
1
+ import { B as BlokkliModule } from '../../shared/editor.S5sA3rij.mjs';
2
2
  import 'nuxt/schema';
3
3
  import 'consola';
4
4
  import '../../../dist/global/types/definitions.js';