@nocobase/plugin-flow-engine 2.1.0-alpha.25 → 2.1.0-alpha.27

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 (40) hide show
  1. package/dist/ai/ai-employees/nathan/index.js +1 -0
  2. package/dist/ai/ai-employees/nathan/prompt.md +46 -10
  3. package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +20 -3
  4. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/lintAndTestJS.js +4 -2
  5. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.d.ts +10 -0
  6. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.js +65 -0
  7. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.d.ts +10 -0
  8. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.js +61 -0
  9. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.d.ts +10 -0
  10. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.js +65 -0
  11. package/dist/externalVersion.js +10 -10
  12. package/dist/node_modules/ses/package.json +1 -1
  13. package/dist/node_modules/zod/package.json +1 -1
  14. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +66 -9
  15. package/dist/server/flow-surfaces/blueprint/normalize-document.js +5 -14
  16. package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +0 -1
  17. package/dist/server/flow-surfaces/blueprint/private-utils.js +0 -3
  18. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +0 -1
  19. package/dist/server/flow-surfaces/builder.js +18 -0
  20. package/dist/server/flow-surfaces/catalog.js +19 -24
  21. package/dist/server/flow-surfaces/compose-compiler.d.ts +1 -2
  22. package/dist/server/flow-surfaces/compose-compiler.js +0 -1
  23. package/dist/server/flow-surfaces/compose-runtime.d.ts +1 -0
  24. package/dist/server/flow-surfaces/compose-runtime.js +2 -1
  25. package/dist/server/flow-surfaces/configure-options.js +12 -5
  26. package/dist/server/flow-surfaces/contract-guard.js +11 -3
  27. package/dist/server/flow-surfaces/field-binding-registry.js +1 -1
  28. package/dist/server/flow-surfaces/field-type-resolver.d.ts +0 -1
  29. package/dist/server/flow-surfaces/field-type-resolver.js +3 -13
  30. package/dist/server/flow-surfaces/public-compatibility.d.ts +16 -0
  31. package/dist/server/flow-surfaces/public-compatibility.js +139 -0
  32. package/dist/server/flow-surfaces/service-helpers.js +2 -2
  33. package/dist/server/flow-surfaces/service-utils.d.ts +1 -1
  34. package/dist/server/flow-surfaces/service-utils.js +21 -6
  35. package/dist/server/flow-surfaces/service.d.ts +23 -3
  36. package/dist/server/flow-surfaces/service.js +720 -167
  37. package/dist/swagger/flow-surfaces.d.ts +0 -29
  38. package/dist/swagger/flow-surfaces.js +8 -17
  39. package/dist/swagger/index.d.ts +0 -29
  40. package/package.json +2 -2
@@ -32,6 +32,7 @@ module.exports = __toCommonJS(nathan_exports);
32
32
  var import_ai = require("@nocobase/ai");
33
33
  var nathan_default = (0, import_ai.defineAIEmployee)({
34
34
  username: "nathan",
35
+ category: "developer",
35
36
  description: "AI employee for coding",
36
37
  avatar: "nocobase-002-male",
37
38
  nickname: "Nathan",
@@ -50,18 +50,32 @@ Follow this exact order. Do NOT skip ahead to coding.
50
50
 
51
51
  2. Documentation lookup before writing any code
52
52
  - Use `document-search` skill guidance.
53
- - You MUST call:
54
- - `searchDocs`
55
- - `readDocEntry`
53
+ - You MUST call `searchDocs`.
56
54
  - Always search docs before coding when the task involves any of the following:
57
55
  - RunJS / workflow / JS Block / JS Field / JS Item / JS Action / Event Flow / Linkage Rules
58
56
  - `ctx` APIs, runtime constraints, rendering, routing, requests, imports, React, Antd
59
57
  - any NocoBase-specific feature, component, schema, collection behavior, or API usage
60
58
  - Do not rely on memory, prior experience, or "common NocoBase patterns" as a substitute for this step.
61
59
  - Minimum requirement:
62
- - search for the relevant module / keywords
63
- - read the most relevant matching entry or entries
60
+ - use a compact Bash script that first searches file paths / filenames, then reads focused snippets from the best matches
61
+ - run broader content search only when path search is insufficient or ambiguous
64
62
  - extract the concrete constraints or APIs you will rely on
63
+ - start narrow; prefer returning an initial answer once focused snippets confirm the needed constraints
64
+ - Prefer one combined `searchDocs` call over multiple small calls. Good pattern:
65
+ ```bash
66
+ printf '## Candidate files\n'
67
+ rg --files interface-builder | grep -Ei 'runjs|js-|event|linkage' | head -50
68
+
69
+ printf '\n## JS Block\n'
70
+ sed -n '1,180p' interface-builder/blocks/other-blocks/js-block.md
71
+
72
+ printf '\n## RunJS\n'
73
+ sed -n '1,180p' interface-builder/runjs.md
74
+ ```
75
+ - Avoid broad full-tree scans such as `find .` or `rg ... .`. Pick likely top-level directories first, then search inside them.
76
+ - Do not pipe output into `rg`; use `grep` for pipeline filtering, and call `rg --files <dir>` or `rg -n <pattern> <dir>` with explicit path arguments.
77
+ - Use `rg -g '*.md' -g '*.mdx'`; do not use unsupported `rg --include` options.
78
+ - Stop searching once the snippets directly confirm the API or constraint needed for the code. Do not read adjacent overview, quickstart, definition, lifecycle, or development pages just for extra background unless the user asks for more depth.
65
79
  - Only after this step may you decide how to implement the solution.
66
80
 
67
81
  3. Data inspection when data model is involved
@@ -81,10 +95,32 @@ Follow this exact order. Do NOT skip ahead to coding.
81
95
  - `frontend-developer` is the implementation skill, not the starting shortcut.
82
96
  - Never use `frontend-developer` alone as justification to begin coding.
83
97
  - The code must be based on verified runtime context, verified documentation, and verified metadata when applicable.
98
+ - If you need to inspect the current editor code, call `readJSCode`. Never use `searchDocs` for current editor code, and never say the current code cannot be read.
99
+ - Call `readJSCode` before complex edits, after any failed patch, or whenever the current editor structure is uncertain.
100
+ - If the current work context already contains code and the user asks to add, modify, remove, fix, or extend behavior, call `patchJSCode` with a minimal patch instead of rewriting the whole editor.
101
+ - Call `writeJSCode` only when the editor is empty, the user asks for a complete replacement, or the change is truly a broad rewrite.
102
+ - For multiple independent localized edits, prefer sequential focused `patchJSCode` calls over one large patch.
103
+ - If a patch would change more than roughly 30 lines, replace a large function/component, or include large unchanged blocks, do not send a huge patch. Either split it into focused patches or use `writeJSCode` as a deliberate broad rewrite when the replacement is clearer than the diff.
104
+ - Do NOT put the complete code in a normal assistant message for validation.
84
105
 
85
106
  6. Validate before output (REQUIRED)
86
- - `lintAndTestJS` must pass before output.
87
- - If validation fails, fix the code and validate again.
107
+ - `lintAndTestJS` must pass before output. Omit the `code` argument so it validates the current editor code.
108
+ - If validation fails, do not guess or repeatedly patch from memory.
109
+ - Track the failing rule, line, and symbol. Do not make multiple cosmetic rewrites for the same diagnostic.
110
+ - Treat every validation failure as new evidence and classify it before changing code:
111
+ - Unknown or missing `ctx` member / runtime API / library exposure → call `getContextApis`, `getContextVars`, or `getContextEnvs` again, then search docs for that exact API or error.
112
+ - Unsupported syntax, sandbox restriction, import/render/request error, React/Antd usage error → call `searchDocs` again with the exact diagnostic text and the related feature keywords.
113
+ - Collection, field, relation, filter, or record-shape error → call the data metadata tools again for the exact collection or field involved.
114
+ - Plain JavaScript syntax or type error that is fully explained by the diagnostic → call `patchJSCode` with a minimal unified diff patch, then validate again.
115
+ - If one direct fix for the same lint rule still fails, stop changing that same expression. Re-read the exact code shape and consider whether the diagnostic is a static-check false positive or unsupported pattern before patching again.
116
+ - If `patchJSCode` fails to apply, call `readJSCode` before any retry, then decide whether a smaller patch or a full `writeJSCode` replacement is the clearer edit.
117
+ - After one failed direct fix, you MUST go back to runtime inspection, documentation lookup, metadata lookup, or ask the user before another code change.
118
+ - When calling `searchDocs` after validation failure, use a compact Bash script that searches the exact error text and nearby concepts, then reads focused snippets from likely matches.
119
+ - If the tools and docs still do not confirm the fix, stop and ask the user instead of trying another unverified implementation.
120
+ - When calling `patchJSCode`, provide only the unified diff patch. The tool reads the current editor code directly.
121
+ - Keep `patchJSCode` patches surgical: include only the changed lines plus the smallest necessary surrounding context.
122
+ - Do NOT rewrite the entire file, replace a whole component/function, or include unchanged large blocks in a patch unless the whole block genuinely changed.
123
+ - If more than roughly 30 lines would need to change, prefer `writeJSCode` only when this is a deliberate broad rewrite. For incremental requests, split into focused `patchJSCode` patches.
88
124
 
89
125
  # Coding Rules
90
126
 
@@ -118,9 +154,9 @@ Never inject unsanitized user input into DOM.
118
154
  # Output Rules
119
155
 
120
156
  - Markdown
121
- - Exactly ONE complete code block at end
122
- - No partial snippets
123
- - Brief explanation after code
157
+ - Do NOT output a complete code block after using `writeJSCode` / `patchJSCode`.
158
+ - Final response should be brief: say that the code has been written to the editor and validation passed.
159
+ - If validation cannot pass, summarize the blocking diagnostics and ask for the missing verified information.
124
160
 
125
161
  # Standard
126
162
 
@@ -23,23 +23,40 @@ When helping users with JavaScript code, follow this process:
23
23
 
24
24
  2. **Write the Code**
25
25
  - Write clean, correct JavaScript/JSX code based on the user's requirements
26
+ - Use `readJSCode` before complex edits, after any patch failure, or whenever the current editor structure is uncertain. Never use documentation search to read current editor code.
27
+ - If the current work context already contains code and the user asks to add, modify, remove, fix, or extend behavior, use `patchJSCode` with a minimal patch instead of rewriting the whole editor
28
+ - Use `writeJSCode` only when the editor is empty, the user asks for a complete replacement, or the change is truly a broad rewrite
29
+ - If an edit would require a large patch, split it into focused patches. If the change replaces a large function/component or the patch would be larger than the full replacement, use `writeJSCode` as a deliberate broad rewrite.
26
30
  - Ensure the code follows best practices for NocoBase workflows
27
31
 
28
32
  3. **Validate the Code**
29
- - Use `lintAndTestJS` to lint and test the code before final output
30
- - Fix any errors reported by the linting tool
33
+ - Use `lintAndTestJS` with no `code` argument to lint and test the current editor code before final output
34
+ - Fix plain JavaScript syntax errors directly when the diagnostic fully explains the problem
35
+ - Use `patchJSCode` with a minimal unified diff patch for follow-up fixes instead of rewriting the full code
36
+ - Track the failing rule, line, and symbol. If one direct fix for the same lint rule still fails, stop changing the same expression and gather new evidence instead of trying cosmetic rewrites.
37
+ - Keep patches surgical: include only changed lines plus the smallest necessary context. Do not include unchanged large blocks or rewrite entire components/functions unless they genuinely changed.
38
+ - If `patchJSCode` fails to apply, call `readJSCode` before retrying. Do not say the current code cannot be read.
39
+ - If the error involves NocoBase runtime APIs, `ctx`, sandbox restrictions, imports, rendering, React, Antd, requests, collections, fields, or record structure, do not guess. Go back to the relevant inspection or documentation tools before changing code:
40
+ - Runtime exposure errors: call `getContextEnvs`, `getContextVars`, or `getContextApis` again
41
+ - NocoBase API / runtime / sandbox / UI errors: use the documentation search skill again with the exact error and relevant feature keywords
42
+ - Data model errors: use data metadata tools again for the exact collection, field, or relation
43
+ - After one failed direct fix, you must gather new evidence from tools or docs before another code change
31
44
  - Do not output final code unless it passes validation
32
45
 
33
46
  4. **Submit the Code**
34
47
  - Once validated, provide the final code to the user
35
48
  - Explain how the code works and what it does
49
+ - If `lintAndTestJS` validated and ran the current editor code successfully, remind the user that the code has not been saved permanently yet and they should click the save button manually.
36
50
 
37
51
  # Available Tools
38
52
 
39
53
  - `getContextVars`: Retrieves available variables from the current context. Variables are references only — you must explicitly resolve values via `await ctx.getVar(path)`. Supports dot-notation for progressive drilling (e.g., `ctx.popup.record.id`).
40
54
  - `getContextApis`: Returns available API methods from the context that can be used in the code.
41
55
  - `getContextEnvs`: Returns metadata about the current page, block, or flow model.
42
- - `lintAndTestJS`: Lints, performs sandbox checks, and trial-runs JavaScript/JSX code. Returns success/failure with diagnostics. **Always call this tool before outputting final code to verify it works.**
56
+ - `readJSCode`: Reads the complete JavaScript/JSX code currently in the active editor. Use before complex patches, after patch failure, or whenever the current editor structure is uncertain.
57
+ - `writeJSCode`: Writes complete JavaScript/JSX code directly into the current editor and returns write metadata. Use only for an empty editor, explicit complete replacement, or deliberate broad rewrite.
58
+ - `patchJSCode`: Applies a minimal unified diff patch to the current editor code and writes it back. Provide only the patch; the tool reads the current editor code directly.
59
+ - `lintAndTestJS`: Lints, performs sandbox checks, and trial-runs the current editor JavaScript/JSX code. Returns success/failure with diagnostics. **Always call this tool before final response to verify it works.**
43
60
 
44
61
  # Code Writing Guidelines
45
62
 
@@ -41,9 +41,11 @@ var lintAndTestJS_default = (0, import_ai.defineTools)({
41
41
  },
42
42
  definition: {
43
43
  name: "lintAndTestJS",
44
- description: "Lint, sandbox-check and trial-run a JavaScript snippet. Returns success/failure with diagnostics. Call this tool BEFORE outputting final code to verify it works.",
44
+ description: "Lint, sandbox-check and trial-run the current editor JavaScript/JSX code. Returns success/failure with diagnostics. Call this tool after writeJSCode or patchJSCode before final response.",
45
45
  schema: import_zod.z.object({
46
- code: import_zod.z.string().describe("The JavaScript/JSX code to preview and validate")
46
+ code: import_zod.z.string().optional().describe(
47
+ "Optional JavaScript/JSX code to preview and validate. Omit this to validate the current editor code."
48
+ )
47
49
  })
48
50
  },
49
51
  invoke: async (ctx, _args, runtime) => {
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ declare const _default: import("@nocobase/ai").ToolsOptions;
10
+ export default _default;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var patchJSCode_exports = {};
28
+ __export(patchJSCode_exports, {
29
+ default: () => patchJSCode_default
30
+ });
31
+ module.exports = __toCommonJS(patchJSCode_exports);
32
+ var import_ai = require("@nocobase/ai");
33
+ var import_zod = require("zod");
34
+ var patchJSCode_default = (0, import_ai.defineTools)({
35
+ scope: "SPECIFIED",
36
+ execution: "frontend",
37
+ defaultPermission: "ALLOW",
38
+ introduction: {
39
+ title: `{{t("ai.tools.patchJSCode.title")}}`,
40
+ about: `{{t("ai.tools.patchJSCode.about")}}`
41
+ },
42
+ definition: {
43
+ name: "patchJSCode",
44
+ description: "Apply a minimal unified diff patch to the code currently in the editor, then write the patched code back to the editor. Use this for adding, modifying, removing, fixing, or extending existing code. The tool reads the current editor code directly; only provide the patch. Keep patches surgical: include only changed lines plus the smallest necessary context, and do not include unchanged large blocks.",
45
+ schema: import_zod.z.object({
46
+ patch: import_zod.z.string().describe(
47
+ "Minimal unified diff patch to apply to the current editor code. Include only changed lines plus the smallest necessary context."
48
+ )
49
+ })
50
+ },
51
+ invoke: async (ctx, _args, runtime) => {
52
+ const { toolCallResults } = ctx.action.params.values || {};
53
+ const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
54
+ if (toolCallResults && result) {
55
+ return {
56
+ status: result.status ?? "error",
57
+ content: JSON.stringify(result.content ?? {})
58
+ };
59
+ }
60
+ return {
61
+ status: "error",
62
+ content: JSON.stringify({ success: false, message: "Patch code failed: no result returned" })
63
+ };
64
+ }
65
+ });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ declare const _default: import("@nocobase/ai").ToolsOptions;
10
+ export default _default;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var readJSCode_exports = {};
28
+ __export(readJSCode_exports, {
29
+ default: () => readJSCode_default
30
+ });
31
+ module.exports = __toCommonJS(readJSCode_exports);
32
+ var import_ai = require("@nocobase/ai");
33
+ var import_zod = require("zod");
34
+ var readJSCode_default = (0, import_ai.defineTools)({
35
+ scope: "SPECIFIED",
36
+ execution: "frontend",
37
+ defaultPermission: "ALLOW",
38
+ introduction: {
39
+ title: `{{t("ai.tools.readJSCode.title")}}`,
40
+ about: `{{t("ai.tools.readJSCode.about")}}`
41
+ },
42
+ definition: {
43
+ name: "readJSCode",
44
+ description: "Read the complete JavaScript/JSX code currently in the active editor. Use before complex patches, after patchJSCode fails, or whenever the current editor structure is uncertain. Do not use searchDocs to read editor code.",
45
+ schema: import_zod.z.object({})
46
+ },
47
+ invoke: async (ctx, _args, runtime) => {
48
+ const { toolCallResults } = ctx.action.params.values || {};
49
+ const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
50
+ if (toolCallResults && result) {
51
+ return {
52
+ status: result.status ?? "error",
53
+ content: JSON.stringify(result.content ?? {})
54
+ };
55
+ }
56
+ return {
57
+ status: "error",
58
+ content: JSON.stringify({ success: false, message: "Read code failed: no result returned" })
59
+ };
60
+ }
61
+ });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ declare const _default: import("@nocobase/ai").ToolsOptions;
10
+ export default _default;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var writeJSCode_exports = {};
28
+ __export(writeJSCode_exports, {
29
+ default: () => writeJSCode_default
30
+ });
31
+ module.exports = __toCommonJS(writeJSCode_exports);
32
+ var import_ai = require("@nocobase/ai");
33
+ var import_zod = require("zod");
34
+ var writeJSCode_default = (0, import_ai.defineTools)({
35
+ scope: "SPECIFIED",
36
+ execution: "frontend",
37
+ defaultPermission: "ALLOW",
38
+ introduction: {
39
+ title: `{{t("ai.tools.writeJSCode.title")}}`,
40
+ about: `{{t("ai.tools.writeJSCode.about")}}`
41
+ },
42
+ definition: {
43
+ name: "writeJSCode",
44
+ description: "Write complete JavaScript/JSX code into the current code editor. Use only when the editor is empty, the user asks for a complete replacement, or the change is a deliberate broad rewrite. For adding, modifying, fixing, or extending existing code, use patchJSCode instead.",
45
+ schema: import_zod.z.object({
46
+ code: import_zod.z.string().describe(
47
+ "The complete JavaScript/JSX code to write into the current editor. Do not use for small incremental changes to existing code."
48
+ )
49
+ })
50
+ },
51
+ invoke: async (ctx, _args, runtime) => {
52
+ const { toolCallResults } = ctx.action.params.values || {};
53
+ const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
54
+ if (toolCallResults && result) {
55
+ return {
56
+ status: result.status ?? "error",
57
+ content: JSON.stringify(result.content ?? {})
58
+ };
59
+ }
60
+ return {
61
+ status: "error",
62
+ content: JSON.stringify({ success: false, message: "Write code failed: no result returned" })
63
+ };
64
+ }
65
+ });
@@ -8,16 +8,16 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-alpha.25",
11
+ "@nocobase/client": "2.1.0-alpha.27",
12
12
  "lodash": "4.18.1",
13
- "@nocobase/database": "2.1.0-alpha.25",
14
- "@nocobase/data-source-manager": "2.1.0-alpha.25",
15
- "@nocobase/resourcer": "2.1.0-alpha.25",
16
- "@nocobase/utils": "2.1.0-alpha.25",
17
- "@nocobase/cache": "2.1.0-alpha.25",
18
- "@nocobase/plugin-localization": "2.1.0-alpha.25",
19
- "@nocobase/server": "2.1.0-alpha.25",
20
- "@nocobase/actions": "2.1.0-alpha.25",
13
+ "@nocobase/database": "2.1.0-alpha.27",
14
+ "@nocobase/data-source-manager": "2.1.0-alpha.27",
15
+ "@nocobase/resourcer": "2.1.0-alpha.27",
16
+ "@nocobase/utils": "2.1.0-alpha.27",
17
+ "@nocobase/cache": "2.1.0-alpha.27",
18
+ "@nocobase/plugin-localization": "2.1.0-alpha.27",
19
+ "@nocobase/server": "2.1.0-alpha.27",
20
+ "@nocobase/actions": "2.1.0-alpha.27",
21
21
  "@formily/json-schema": "2.3.7",
22
- "@nocobase/ai": "2.1.0-alpha.25"
22
+ "@nocobase/ai": "2.1.0-alpha.27"
23
23
  };
@@ -1 +1 @@
1
- {"name":"ses","version":"1.14.0","description":"Hardened JavaScript for Fearless Cooperation","keywords":["lockdown","harden","Compartment","assert","security","confinement","isolation","object capabilities","ocaps","secure execution","third-party code","prototype pollution","supply-chain attack","plugin"],"author":"Agoric","license":"Apache-2.0","homepage":"https://github.com/Agoric/SES-shim/tree/master/packages/ses#readme","repository":{"type":"git","url":"git+https://github.com/endojs/endo.git","directory":"packages/ses"},"bugs":{"url":"https://github.com/endojs/endo/issues"},"type":"module","main":"./dist/ses.cjs","module":"./index.js","unpkg":"./dist/ses.umd.js","types":"./types.d.ts","exports":{".":{"import":{"types":"./types.d.ts","xs":"./src-xs/index.js","default":"./index.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/ses.cjs"}},"./lockdown":{"import":{"types":"./types.d.ts","default":"./index.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/ses.cjs"}},"./hermes":{"require":{"types":"./dist/types.d.cts","default":"./dist/ses-hermes.cjs"}},"./tools.js":"./tools.js","./assert-shim.js":"./assert-shim.js","./lockdown-shim.js":{"xs":"./src-xs/lockdown-shim.js","default":"./lockdown-shim.js"},"./compartment-shim.js":{"xs":"./src-xs/compartment-shim.js","default":"./compartment-shim.js"},"./console-shim.js":"./console-shim.js","./package.json":"./package.json"},"scripts":{"build:vanilla":"node scripts/bundle.js","build:hermes":"node scripts/bundle.js hermes","build":"yarn build:vanilla && yarn build:hermes","clean":"rm -rf dist","cover":"c8 ava","demo":"python3 -m http.server","lint":"yarn lint:types && yarn lint:eslint","lint-fix":"eslint --fix .","lint:eslint":"eslint .","lint:types":"tsc","prepare":"npm run clean && npm run build","qt":"ava","test":"tsd && ava","test:hermes":"./scripts/hermes-test.sh","test:xs":"xst dist/ses.umd.js test/_lockdown-safe.js && node scripts/generate-test-xs.js && xst tmp/test-xs.js && rm -rf tmp","postpack":"git clean -fX \"*.d.ts*\" \"*.d.cts*\" \"*.d.mts*\" \"*.tsbuildinfo\""},"dependencies":{"@endo/cache-map":"^1.1.0","@endo/env-options":"^1.1.11","@endo/immutable-arraybuffer":"^1.1.2"},"devDependencies":{"@babel/generator":"^7.26.3","@babel/parser":"~7.26.2","@babel/traverse":"~7.25.9","@babel/types":"~7.26.0","@endo/compartment-mapper":"^1.6.3","@endo/module-source":"^1.3.3","@endo/test262-runner":"^0.1.48","@types/babel__traverse":"^7.20.5","ava":"^6.1.3","babel-eslint":"^10.1.0","c8":"^7.14.0","core-js":"^3.31.0","eslint":"^8.57.1","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^9.1.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.31.0","hermes-engine-cli":"^0.12.0","prettier":"^3.5.3","terser":"^5.16.6","tsd":"^0.31.2","typescript":"~5.8.3"},"files":["./*.d.ts","./*.js","./*.map","LICENSE*","SECURITY*","dist","lib","src","tools"],"publishConfig":{"access":"public"},"eslintConfig":{"extends":["plugin:@endo/ses"]},"ava":{"files":["test/**/*.test.*"],"timeout":"2m"},"typeCoverage":{"atLeast":81.17},"gitHead":"9815aea9541f241389d2135c6097a7442bdffa17","_lastModified":"2026-04-27T22:04:16.306Z"}
1
+ {"name":"ses","version":"1.14.0","description":"Hardened JavaScript for Fearless Cooperation","keywords":["lockdown","harden","Compartment","assert","security","confinement","isolation","object capabilities","ocaps","secure execution","third-party code","prototype pollution","supply-chain attack","plugin"],"author":"Agoric","license":"Apache-2.0","homepage":"https://github.com/Agoric/SES-shim/tree/master/packages/ses#readme","repository":{"type":"git","url":"git+https://github.com/endojs/endo.git","directory":"packages/ses"},"bugs":{"url":"https://github.com/endojs/endo/issues"},"type":"module","main":"./dist/ses.cjs","module":"./index.js","unpkg":"./dist/ses.umd.js","types":"./types.d.ts","exports":{".":{"import":{"types":"./types.d.ts","xs":"./src-xs/index.js","default":"./index.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/ses.cjs"}},"./lockdown":{"import":{"types":"./types.d.ts","default":"./index.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/ses.cjs"}},"./hermes":{"require":{"types":"./dist/types.d.cts","default":"./dist/ses-hermes.cjs"}},"./tools.js":"./tools.js","./assert-shim.js":"./assert-shim.js","./lockdown-shim.js":{"xs":"./src-xs/lockdown-shim.js","default":"./lockdown-shim.js"},"./compartment-shim.js":{"xs":"./src-xs/compartment-shim.js","default":"./compartment-shim.js"},"./console-shim.js":"./console-shim.js","./package.json":"./package.json"},"scripts":{"build:vanilla":"node scripts/bundle.js","build:hermes":"node scripts/bundle.js hermes","build":"yarn build:vanilla && yarn build:hermes","clean":"rm -rf dist","cover":"c8 ava","demo":"python3 -m http.server","lint":"yarn lint:types && yarn lint:eslint","lint-fix":"eslint --fix .","lint:eslint":"eslint .","lint:types":"tsc","prepare":"npm run clean && npm run build","qt":"ava","test":"tsd && ava","test:hermes":"./scripts/hermes-test.sh","test:xs":"xst dist/ses.umd.js test/_lockdown-safe.js && node scripts/generate-test-xs.js && xst tmp/test-xs.js && rm -rf tmp","postpack":"git clean -fX \"*.d.ts*\" \"*.d.cts*\" \"*.d.mts*\" \"*.tsbuildinfo\""},"dependencies":{"@endo/cache-map":"^1.1.0","@endo/env-options":"^1.1.11","@endo/immutable-arraybuffer":"^1.1.2"},"devDependencies":{"@babel/generator":"^7.26.3","@babel/parser":"~7.26.2","@babel/traverse":"~7.25.9","@babel/types":"~7.26.0","@endo/compartment-mapper":"^1.6.3","@endo/module-source":"^1.3.3","@endo/test262-runner":"^0.1.48","@types/babel__traverse":"^7.20.5","ava":"^6.1.3","babel-eslint":"^10.1.0","c8":"^7.14.0","core-js":"^3.31.0","eslint":"^8.57.1","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^9.1.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.31.0","hermes-engine-cli":"^0.12.0","prettier":"^3.5.3","terser":"^5.16.6","tsd":"^0.31.2","typescript":"~5.8.3"},"files":["./*.d.ts","./*.js","./*.map","LICENSE*","SECURITY*","dist","lib","src","tools"],"publishConfig":{"access":"public"},"eslintConfig":{"extends":["plugin:@endo/ses"]},"ava":{"files":["test/**/*.test.*"],"timeout":"2m"},"typeCoverage":{"atLeast":81.17},"gitHead":"9815aea9541f241389d2135c6097a7442bdffa17","_lastModified":"2026-05-03T08:46:51.113Z"}
@@ -1 +1 @@
1
- {"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-04-27T22:04:17.394Z"}
1
+ {"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-05-03T08:46:52.182Z"}
@@ -45,6 +45,7 @@ var import_errors = require("../errors");
45
45
  var import_service_utils = require("../service-utils");
46
46
  var import_default_block_actions = require("../default-block-actions");
47
47
  var import_public_data_surface_default_filter = require("../public-data-surface-default-filter");
48
+ var import_public_compatibility = require("../public-compatibility");
48
49
  var import_defaults = require("./defaults");
49
50
  var import_private_utils = require("./private-utils");
50
51
  var import_field_type_resolver = require("../field-type-resolver");
@@ -94,7 +95,6 @@ const APPLY_BLUEPRINT_FIELD_ALLOWED_KEYS = [
94
95
  "type",
95
96
  "fieldType",
96
97
  "fields",
97
- "selectorFields",
98
98
  "titleField",
99
99
  "openMode",
100
100
  "popupSize",
@@ -800,6 +800,60 @@ function resolveTargetBlockKey(value, localBlockKeys, context) {
800
800
  }
801
801
  (0, import_errors.throwBadRequest)(`${context} must be a string block key`);
802
802
  }
803
+ function collectTreeConnectTargetKeys(settings, context) {
804
+ if (!import_lodash.default.isPlainObject(settings == null ? void 0 : settings.connectFields)) {
805
+ return [];
806
+ }
807
+ if (import_lodash.default.isUndefined(settings.connectFields.targets)) {
808
+ return [];
809
+ }
810
+ if (!Array.isArray(settings.connectFields.targets)) {
811
+ (0, import_errors.throwBadRequest)(`${context}.settings.connectFields.targets must be an array`);
812
+ }
813
+ const seenTargets = /* @__PURE__ */ new Set();
814
+ return settings.connectFields.targets.map((target, targetIndex) => {
815
+ if (!import_lodash.default.isPlainObject(target)) {
816
+ (0, import_errors.throwBadRequest)(`${context}.settings.connectFields.targets[${targetIndex}] must be an object`);
817
+ }
818
+ if (import_lodash.default.isUndefined(target.target) || target.target === null || target.target === "") {
819
+ return "";
820
+ }
821
+ if (typeof target.target !== "string") {
822
+ (0, import_errors.throwBadRequest)(`${context}.settings.connectFields.targets[${targetIndex}].target must be a string block key`);
823
+ }
824
+ const normalizedTarget = (0, import_service_utils.normalizeFlowSurfaceComposeKey)(
825
+ target.target,
826
+ `${context}.settings.connectFields.targets[${targetIndex}].target`
827
+ );
828
+ if (seenTargets.has(normalizedTarget)) {
829
+ (0, import_errors.throwBadRequest)(
830
+ `${context}.settings.connectFields.targets[${targetIndex}].target duplicate target '${normalizedTarget}' in tree connectFields`
831
+ );
832
+ }
833
+ seenTargets.add(normalizedTarget);
834
+ return normalizedTarget;
835
+ }).filter(Boolean);
836
+ }
837
+ function compileTreeConnectSettingsTargets(settings, localBlockKeys, context) {
838
+ if (!import_lodash.default.isPlainObject(settings == null ? void 0 : settings.connectFields) || !Array.isArray(settings.connectFields.targets)) {
839
+ return settings;
840
+ }
841
+ const nextSettings = import_lodash.default.cloneDeep(settings);
842
+ nextSettings.connectFields.targets = nextSettings.connectFields.targets.map((target, targetIndex) => {
843
+ if (!import_lodash.default.isPlainObject(target) || import_lodash.default.isUndefined(target.target) || target.target === null || target.target === "") {
844
+ return target;
845
+ }
846
+ return {
847
+ ...target,
848
+ target: resolveTargetBlockKey(
849
+ target.target,
850
+ localBlockKeys,
851
+ `${context}.settings.connectFields.targets[${targetIndex}].target`
852
+ )
853
+ };
854
+ });
855
+ return nextSettings;
856
+ }
803
857
  function compileField(input, index, scopePrefix, assets, localBlockKeys, context, popupDefaultsMetadata, defaults) {
804
858
  if (typeof input === "string") {
805
859
  const fieldPath2 = (0, import_private_utils.assertNonEmptyString)(input, `${context}[${index}]`);
@@ -820,10 +874,6 @@ function compileField(input, index, scopePrefix, assets, localBlockKeys, context
820
874
  const syntheticType = (0, import_private_utils.readOptionalString)(input.type);
821
875
  const fieldType = (0, import_field_type_resolver.normalizePublicFieldType)(input.fieldType, `${context}[${index}]`);
822
876
  const fields = (0, import_field_type_resolver.normalizePublicFieldNameList)(input.fields, `${context}[${index}].fields`);
823
- const selectorFields = (0, import_field_type_resolver.normalizePublicFieldNameList)(
824
- input.selectorFields,
825
- `${context}[${index}].selectorFields`
826
- );
827
877
  if (!fieldPath && !syntheticType) {
828
878
  (0, import_errors.throwBadRequest)(`${context}[${index}] requires field or type`);
829
879
  }
@@ -851,7 +901,6 @@ function compileField(input, index, scopePrefix, assets, localBlockKeys, context
851
901
  type: syntheticType,
852
902
  fieldType,
853
903
  fields,
854
- selectorFields,
855
904
  titleField: (0, import_private_utils.readOptionalString)(input.titleField),
856
905
  openMode: (0, import_private_utils.readOptionalString)(input.openMode),
857
906
  popupSize: (0, import_private_utils.readOptionalString)(input.popupSize),
@@ -919,6 +968,9 @@ function compileBlocks(input, scopePrefix, assets, context, defaults, requiredEx
919
968
  assertApplyBlueprintKanbanMainContent(block, `${context}[${index}]`);
920
969
  assertApplyBlueprintTreeMainContent(block, `${context}[${index}]`);
921
970
  const fields = resolveBlockFieldInputs(block, `${context}[${index}]`);
971
+ collectTreeConnectTargetKeys(block.settings, `${context}[${index}]`).forEach((targetKey) => {
972
+ referencedBlockKeys.add(targetKey);
973
+ });
922
974
  fields.forEach((field, fieldIndex) => {
923
975
  if (typeof (field == null ? void 0 : field.target) !== "string" || !field.target.trim()) {
924
976
  return;
@@ -964,11 +1016,16 @@ function compileBlocks(input, scopePrefix, assets, context, defaults, requiredEx
964
1016
  if (!key) {
965
1017
  (0, import_errors.throwBadRequest)(`${blockContext} key '${localKey}' is missing after block key compilation`);
966
1018
  }
967
- const settings = resolveAssetSettings(block.settings, block, assets, blockContext);
1019
+ const blockType = (0, import_private_utils.readOptionalString)(block.type);
1020
+ let settings = resolveAssetSettings(block.settings, block, assets, blockContext);
968
1021
  if ((0, import_private_utils.readOptionalString)(block.title) && import_lodash.default.isUndefined(settings.title)) {
969
1022
  settings.title = (0, import_private_utils.readOptionalString)(block.title);
970
1023
  }
971
- const blockType = (0, import_private_utils.readOptionalString)(block.type);
1024
+ settings = (0, import_public_compatibility.normalizeFlowSurfacePublicSortingAlias)({
1025
+ context: `${blockContext}.settings`,
1026
+ type: blockType,
1027
+ settings
1028
+ });
972
1029
  const template = ensureOptionalTemplate(block.template, `${blockContext}.template`);
973
1030
  const blockDefaultFilter = (0, import_public_data_surface_default_filter.normalizeFlowSurfacePublicBlockDefaultFilter)("applyBlueprint", block.defaultFilter, {
974
1031
  blockType,
@@ -1032,7 +1089,7 @@ function compileBlocks(input, scopePrefix, assets, context, defaults, requiredEx
1032
1089
  type: blockType,
1033
1090
  resource: buildBlockResource(block, blockContext),
1034
1091
  template,
1035
- settings: Object.keys(settings).length ? settings : void 0,
1092
+ settings: Object.keys(settings).length ? compileTreeConnectSettingsTargets(settings, blockKeysByLocalKey, blockContext) : void 0,
1036
1093
  fields: blockType === "calendar" || blockType === "tree" ? void 0 : fields,
1037
1094
  fieldsLayout: blockType === "calendar" || blockType === "kanban" || blockType === "tree" ? void 0 : fieldsLayout,
1038
1095
  actions: blockType === "tree" ? void 0 : actionsWithDefaultFilter,