@nocobase/plugin-flow-engine 2.1.0-alpha.3 → 2.1.0-alpha.30

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 (262) hide show
  1. package/LICENSE +201 -661
  2. package/README.md +79 -9
  3. package/dist/ai/ai-employees/nathan/index.d.ts +10 -0
  4. package/dist/ai/ai-employees/nathan/index.js +42 -0
  5. package/dist/ai/ai-employees/nathan/prompt.md +168 -0
  6. package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +86 -0
  7. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.js +2 -2
  8. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.js +2 -2
  9. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.js +2 -2
  10. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.js +6 -4
  11. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.d.ts +10 -0
  12. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.js +65 -0
  13. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.d.ts +10 -0
  14. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.js +61 -0
  15. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.d.ts +10 -0
  16. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.js +65 -0
  17. package/dist/ai/docs/runjs/context/block-model.md +35 -35
  18. package/dist/ai/docs/runjs/context/collection-field.md +53 -51
  19. package/dist/ai/docs/runjs/context/collection.md +39 -39
  20. package/dist/ai/docs/runjs/context/data-source-manager.md +40 -30
  21. package/dist/ai/docs/runjs/context/data-source.md +52 -44
  22. package/dist/ai/docs/runjs/context/element.md +44 -38
  23. package/dist/ai/docs/runjs/context/exit-all.md +37 -35
  24. package/dist/ai/docs/runjs/context/exit.md +38 -35
  25. package/dist/ai/docs/runjs/context/filter-manager.md +36 -30
  26. package/dist/ai/docs/runjs/context/form.md +57 -57
  27. package/dist/ai/docs/runjs/context/get-model.md +22 -21
  28. package/dist/ai/docs/runjs/context/get-value.md +20 -19
  29. package/dist/ai/docs/runjs/context/get-var.md +61 -55
  30. package/dist/ai/docs/runjs/context/i18n.md +17 -14
  31. package/dist/ai/docs/runjs/context/import-async.md +333 -45
  32. package/dist/ai/docs/runjs/context/init-resource.md +20 -20
  33. package/dist/ai/docs/runjs/context/libs.md +31 -31
  34. package/dist/ai/docs/runjs/context/location.md +34 -31
  35. package/dist/ai/docs/runjs/context/logger.md +41 -40
  36. package/dist/ai/docs/runjs/context/make-resource.md +27 -26
  37. package/dist/ai/docs/runjs/context/message.md +42 -41
  38. package/dist/ai/docs/runjs/context/modal.md +44 -44
  39. package/dist/ai/docs/runjs/context/model.md +36 -33
  40. package/dist/ai/docs/runjs/context/notification.md +41 -40
  41. package/dist/ai/docs/runjs/context/off.md +14 -14
  42. package/dist/ai/docs/runjs/context/on.md +30 -29
  43. package/dist/ai/docs/runjs/context/open-view.md +40 -40
  44. package/dist/ai/docs/runjs/context/render.md +37 -32
  45. package/dist/ai/docs/runjs/context/request.md +46 -45
  46. package/dist/ai/docs/runjs/context/require-async.md +28 -25
  47. package/dist/ai/docs/runjs/context/resource.md +34 -34
  48. package/dist/ai/docs/runjs/context/route.md +36 -34
  49. package/dist/ai/docs/runjs/context/router.md +43 -31
  50. package/dist/ai/docs/runjs/context/set-value.md +18 -17
  51. package/dist/ai/docs/runjs/context/sql.md +7 -15
  52. package/dist/ai/docs/runjs/context/t.md +20 -17
  53. package/dist/ai/docs/runjs/context/view.md +49 -46
  54. package/dist/ai/docs/runjs/document.md +1 -0
  55. package/dist/ai/docs/runjs/import-modules.md +32 -32
  56. package/dist/ai/docs/runjs/index.md +13 -13
  57. package/dist/ai/docs/runjs/jsx.md +19 -19
  58. package/dist/ai/docs/runjs/model/form-block-model.md +1 -3
  59. package/dist/ai/docs/runjs/render.md +15 -15
  60. package/dist/ai/docs/runjs/resource/api-resource.md +53 -53
  61. package/dist/ai/docs/runjs/resource/multi-record-resource.md +64 -64
  62. package/dist/ai/docs/runjs/resource/single-record-resource.md +55 -55
  63. package/dist/ai/docs/runjs/resource/sql-resource.md +57 -57
  64. package/dist/ai/docs/runjs/window.md +5 -5
  65. package/dist/client/index.js +1 -1
  66. package/dist/externalVersion.js +12 -11
  67. package/dist/locale/en-US.json +1 -0
  68. package/dist/locale/index.d.ts +2 -0
  69. package/dist/locale/zh-CN.json +1 -0
  70. package/dist/node_modules/ses/dist/ses.cjs +1 -1
  71. package/dist/node_modules/ses/package.json +1 -1
  72. package/dist/node_modules/zod/index.cjs +1 -1
  73. package/dist/node_modules/zod/package.json +1 -1
  74. package/dist/server/collections/flowsql.js +1 -0
  75. package/dist/server/flow-surfaces/action-scope.d.ts +39 -0
  76. package/dist/server/flow-surfaces/action-scope.js +156 -0
  77. package/dist/server/flow-surfaces/apply/compiler.d.ts +13 -0
  78. package/dist/server/flow-surfaces/apply/compiler.js +971 -0
  79. package/dist/server/flow-surfaces/apply/layout.d.ts +34 -0
  80. package/dist/server/flow-surfaces/apply/layout.js +175 -0
  81. package/dist/server/flow-surfaces/apply/matching.d.ts +16 -0
  82. package/dist/server/flow-surfaces/apply/matching.js +181 -0
  83. package/dist/server/flow-surfaces/approval/blueprint-service.d.ts +84 -0
  84. package/dist/server/flow-surfaces/approval/blueprint-service.js +589 -0
  85. package/dist/server/flow-surfaces/approval/blueprint.d.ts +21 -0
  86. package/dist/server/flow-surfaces/approval/blueprint.js +187 -0
  87. package/dist/server/flow-surfaces/approval/builder.d.ts +225 -0
  88. package/dist/server/flow-surfaces/approval/builder.js +384 -0
  89. package/dist/server/flow-surfaces/approval/catalog-specs.d.ts +33 -0
  90. package/dist/server/flow-surfaces/approval/catalog-specs.js +156 -0
  91. package/dist/server/flow-surfaces/approval/index.d.ts +14 -0
  92. package/dist/server/flow-surfaces/approval/index.js +40 -0
  93. package/dist/server/flow-surfaces/approval/runtime-config.d.ts +44 -0
  94. package/dist/server/flow-surfaces/approval/runtime-config.js +299 -0
  95. package/dist/server/flow-surfaces/approval/semantic-use.d.ts +23 -0
  96. package/dist/server/flow-surfaces/approval/semantic-use.js +155 -0
  97. package/dist/server/flow-surfaces/association-interfaces.d.ts +10 -0
  98. package/dist/server/flow-surfaces/association-interfaces.js +39 -0
  99. package/dist/server/flow-surfaces/association-title-field.d.ts +20 -0
  100. package/dist/server/flow-surfaces/association-title-field.js +192 -0
  101. package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +15 -0
  102. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +1251 -0
  103. package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +14 -0
  104. package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
  105. package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
  106. package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
  107. package/dist/server/flow-surfaces/blueprint/defaults.d.ts +26 -0
  108. package/dist/server/flow-surfaces/blueprint/defaults.js +133 -0
  109. package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
  110. package/dist/server/flow-surfaces/blueprint/index.js +44 -0
  111. package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
  112. package/dist/server/flow-surfaces/blueprint/normalize-document.js +407 -0
  113. package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +25 -0
  114. package/dist/server/flow-surfaces/blueprint/private-utils.js +179 -0
  115. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +201 -0
  116. package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
  117. package/dist/server/flow-surfaces/builder.d.ts +238 -0
  118. package/dist/server/flow-surfaces/builder.js +1261 -0
  119. package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
  120. package/dist/server/flow-surfaces/catalog-smart.js +239 -0
  121. package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
  122. package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
  123. package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
  124. package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
  125. package/dist/server/flow-surfaces/catalog.d.ts +79 -0
  126. package/dist/server/flow-surfaces/catalog.js +3743 -0
  127. package/dist/server/flow-surfaces/chart-config.d.ts +121 -0
  128. package/dist/server/flow-surfaces/chart-config.js +1394 -0
  129. package/dist/server/flow-surfaces/compose-compiler.d.ts +115 -0
  130. package/dist/server/flow-surfaces/compose-compiler.js +174 -0
  131. package/dist/server/flow-surfaces/compose-runtime.d.ts +94 -0
  132. package/dist/server/flow-surfaces/compose-runtime.js +376 -0
  133. package/dist/server/flow-surfaces/configure-options.d.ts +23 -0
  134. package/dist/server/flow-surfaces/configure-options.js +904 -0
  135. package/dist/server/flow-surfaces/constants.d.ts +351 -0
  136. package/dist/server/flow-surfaces/constants.js +104 -0
  137. package/dist/server/flow-surfaces/context.d.ts +72 -0
  138. package/dist/server/flow-surfaces/context.js +556 -0
  139. package/dist/server/flow-surfaces/contract-guard.d.ts +19 -0
  140. package/dist/server/flow-surfaces/contract-guard.js +410 -0
  141. package/dist/server/flow-surfaces/core-field-default-bindings.d.ts +12 -0
  142. package/dist/server/flow-surfaces/core-field-default-bindings.js +157 -0
  143. package/dist/server/flow-surfaces/default-action-popup.d.ts +63 -0
  144. package/dist/server/flow-surfaces/default-action-popup.js +322 -0
  145. package/dist/server/flow-surfaces/default-block-actions.d.ts +32 -0
  146. package/dist/server/flow-surfaces/default-block-actions.js +210 -0
  147. package/dist/server/flow-surfaces/errors.d.ts +47 -0
  148. package/dist/server/flow-surfaces/errors.js +145 -0
  149. package/dist/server/flow-surfaces/executor.d.ts +23 -0
  150. package/dist/server/flow-surfaces/executor.js +132 -0
  151. package/dist/server/flow-surfaces/field-binding-registry.d.ts +24 -0
  152. package/dist/server/flow-surfaces/field-binding-registry.js +396 -0
  153. package/dist/server/flow-surfaces/field-semantics.d.ts +15 -0
  154. package/dist/server/flow-surfaces/field-semantics.js +84 -0
  155. package/dist/server/flow-surfaces/field-type-resolver.d.ts +45 -0
  156. package/dist/server/flow-surfaces/field-type-resolver.js +312 -0
  157. package/dist/server/flow-surfaces/filter-group.d.ts +15 -0
  158. package/dist/server/flow-surfaces/filter-group.js +94 -0
  159. package/dist/server/flow-surfaces/hidden-popup-calendar.d.ts +86 -0
  160. package/dist/server/flow-surfaces/hidden-popup-calendar.js +554 -0
  161. package/dist/server/flow-surfaces/hidden-popup-contract.d.ts +116 -0
  162. package/dist/server/flow-surfaces/hidden-popup-contract.js +611 -0
  163. package/dist/server/flow-surfaces/hidden-popup-kanban.d.ts +62 -0
  164. package/dist/server/flow-surfaces/hidden-popup-kanban.js +651 -0
  165. package/dist/server/flow-surfaces/index.d.ts +11 -0
  166. package/dist/server/flow-surfaces/index.js +302 -0
  167. package/dist/server/flow-surfaces/locator.d.ts +28 -0
  168. package/dist/server/flow-surfaces/locator.js +240 -0
  169. package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
  170. package/dist/server/flow-surfaces/node-use-sets.js +135 -0
  171. package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
  172. package/dist/server/flow-surfaces/payload-shape.js +61 -0
  173. package/dist/server/flow-surfaces/placement.d.ts +33 -0
  174. package/dist/server/flow-surfaces/placement.js +199 -0
  175. package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
  176. package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
  177. package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
  178. package/dist/server/flow-surfaces/planning/compiler.js +376 -0
  179. package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
  180. package/dist/server/flow-surfaces/planning/context.js +139 -0
  181. package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
  182. package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
  183. package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
  184. package/dist/server/flow-surfaces/planning/key-kind.js +88 -0
  185. package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
  186. package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
  187. package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
  188. package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
  189. package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
  190. package/dist/server/flow-surfaces/planning/runtime.js +259 -0
  191. package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
  192. package/dist/server/flow-surfaces/planning/step-link.js +104 -0
  193. package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
  194. package/dist/server/flow-surfaces/planning/types.js +24 -0
  195. package/dist/server/flow-surfaces/public-compatibility.d.ts +28 -0
  196. package/dist/server/flow-surfaces/public-compatibility.js +161 -0
  197. package/dist/server/flow-surfaces/public-data-surface-default-filter.d.ts +24 -0
  198. package/dist/server/flow-surfaces/public-data-surface-default-filter.js +152 -0
  199. package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
  200. package/dist/server/flow-surfaces/reaction/errors.js +69 -0
  201. package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
  202. package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
  203. package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
  204. package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
  205. package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
  206. package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
  207. package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
  208. package/dist/server/flow-surfaces/reaction/meta.js +451 -0
  209. package/dist/server/flow-surfaces/reaction/registry.d.ts +156 -0
  210. package/dist/server/flow-surfaces/reaction/registry.js +206 -0
  211. package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
  212. package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
  213. package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
  214. package/dist/server/flow-surfaces/reaction/types.js +24 -0
  215. package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
  216. package/dist/server/flow-surfaces/reaction/utils.js +67 -0
  217. package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
  218. package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
  219. package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
  220. package/dist/server/flow-surfaces/reference-guards.js +103 -0
  221. package/dist/server/flow-surfaces/route-sync.d.ts +47 -0
  222. package/dist/server/flow-surfaces/route-sync.js +392 -0
  223. package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
  224. package/dist/server/flow-surfaces/service-helpers.js +310 -0
  225. package/dist/server/flow-surfaces/service-utils.d.ts +120 -0
  226. package/dist/server/flow-surfaces/service-utils.js +878 -0
  227. package/dist/server/flow-surfaces/service.d.ts +894 -0
  228. package/dist/server/flow-surfaces/service.js +16200 -0
  229. package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
  230. package/dist/server/flow-surfaces/support-matrix.js +282 -0
  231. package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
  232. package/dist/server/flow-surfaces/surface-context.js +440 -0
  233. package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
  234. package/dist/server/flow-surfaces/template-compatibility.js +189 -0
  235. package/dist/server/flow-surfaces/template-display.d.ts +20 -0
  236. package/dist/server/flow-surfaces/template-display.js +289 -0
  237. package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
  238. package/dist/server/flow-surfaces/template-service-utils.js +281 -0
  239. package/dist/server/flow-surfaces/types.d.ts +288 -0
  240. package/dist/server/flow-surfaces/types.js +24 -0
  241. package/dist/server/index.d.ts +1 -0
  242. package/dist/server/index.js +7 -2
  243. package/dist/server/plugin.d.ts +0 -1
  244. package/dist/server/plugin.js +9 -34
  245. package/dist/server/repository.js +0 -5
  246. package/dist/server/variables/resolve.d.ts +21 -0
  247. package/dist/server/variables/resolve.js +79 -0
  248. package/dist/swagger/flow-surfaces.d.ts +6106 -0
  249. package/dist/swagger/flow-surfaces.examples.d.ts +1577 -0
  250. package/dist/swagger/flow-surfaces.examples.js +1816 -0
  251. package/dist/swagger/flow-surfaces.js +5375 -0
  252. package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
  253. package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
  254. package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
  255. package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
  256. package/dist/swagger/index.d.ts +6111 -0
  257. package/dist/swagger/index.js +50 -0
  258. package/package.json +3 -3
  259. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.d.ts +0 -0
  260. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.d.ts +0 -0
  261. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.d.ts +0 -0
  262. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.d.ts +0 -0
package/README.md CHANGED
@@ -1,17 +1,24 @@
1
1
  # NocoBase
2
2
 
3
3
  <video width="100%" controls>
4
- <source src="https://static-docs.nocobase.com/NocoBase0510.mp4" type="video/mp4">
4
+ <source src="https://github.com/user-attachments/assets/4d11a87b-00e2-48f3-9bf7-389d21072d13" type="video/mp4">
5
5
  </video>
6
6
 
7
+ <p align="center">
8
+ <a href="https://trendshift.io/repositories/4112" target="_blank"><img src="https://trendshift.io/api/badge/repositories/4112" alt="nocobase%2Fnocobase | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
9
+ <a href="https://www.producthunt.com/posts/nocobase?embed=true&utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-nocobase" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=456520&theme=light&period=weekly&topic_id=267" alt="NocoBase - Scalability&#0045;first&#0044;&#0032;open&#0045;source&#0032;no&#0045;code&#0032;platform | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
10
+ </p>
7
11
 
8
12
  ## What is NocoBase
9
13
 
10
- NocoBase is a scalability-first, open-source no-code development platform.
11
- Instead of investing years of time and millions of dollars in research and development, deploy NocoBase in a few minutes and you'll have a private, controllable, and extremely scalable no-code development platform!
14
+ NocoBase is the most extensible AI-powered no-code platform.
15
+ Total control. Infinite extensibility. AI collaboration.
16
+ Enable your team to adapt quickly and cut costs dramatically.
17
+ No years of development. No millions wasted.
18
+ Deploy NocoBase in minutes — and take control of everything.
12
19
 
13
20
  Homepage:
14
- https://www.nocobase.com/
21
+ https://www.nocobase.com/
15
22
 
16
23
  Online Demo:
17
24
  https://demo.nocobase.com/new
@@ -19,11 +26,74 @@ https://demo.nocobase.com/new
19
26
  Documents:
20
27
  https://docs.nocobase.com/
21
28
 
22
- Commericial license & plugins:
23
- https://www.nocobase.com/en/commercial
29
+ Forum:
30
+ https://forum.nocobase.com/
24
31
 
25
- License agreement:
26
- https://www.nocobase.com/en/agreement
32
+ Use Cases:
33
+ https://www.nocobase.com/en/blog/tags/customer-stories
27
34
 
35
+ ## Release Notes
28
36
 
29
- ## Contact Us:
37
+ Our [blog](https://www.nocobase.com/en/blog/timeline) is regularly updated with release notes and provides a weekly summary.
38
+
39
+ ## Distinctive features
40
+
41
+ ### 1. Data model-driven, not form/table–driven
42
+
43
+ Instead of being constrained by forms or tables, NocoBase adopts a data model–driven approach, separating data structure from user interface to unlock unlimited possibilities.
44
+
45
+ - UI and data structure are fully decoupled
46
+ - Multiple blocks and actions can be created for the same table or record in any quantity or form
47
+ - Supports the main database, external databases, and third-party APIs as data sources
48
+
49
+ ![model](https://static-docs.nocobase.com/model.png)
50
+
51
+ ### 2. AI employees, integrated into your business systems
52
+ Unlike standalone AI demos, NocoBase allows you to embed AI capabilities seamlessly into your interfaces, workflows, and data context, making AI truly useful in real business scenarios.
53
+
54
+ - Define AI employees for roles such as translator, analyst, researcher, or assistant
55
+ - Seamless AI–human collaboration in interfaces and workflows
56
+ - Ensure AI usage is secure, transparent, and customizable for your business needs
57
+
58
+ ![AI-employee](https://static-docs.nocobase.com/ai-employee-home.png)
59
+
60
+ ### 3. What you see is what you get, incredibly easy to use
61
+
62
+ While enabling the development of complex business systems, NocoBase keeps the experience simple and intuitive.
63
+
64
+ - One-click switch between usage mode and configuration mode
65
+ - Pages serve as a canvas to arrange blocks and actions, similar to Notion
66
+ - Configuration mode is designed for ordinary users, not just programmers
67
+
68
+ ![wysiwyg](https://static-docs.nocobase.com/wysiwyg.gif)
69
+
70
+ ### 4. Everything is a plugin, designed for extension
71
+ Adding more no-code features will never cover every business case. NocoBase is built for extension through its plugin-based microkernel architecture.
72
+
73
+ - All functionalities are plugins, similar to WordPress
74
+ - Plugins are ready to use upon installation
75
+ - Pages, blocks, actions, APIs, and data sources can all be extended through custom plugins
76
+
77
+ ![plugins](https://static-docs.nocobase.com/plugins.png)
78
+
79
+ ## Installation
80
+
81
+ NocoBase supports three installation methods:
82
+
83
+ - <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/docker-compose">Installing With Docker (👍Recommended)</a>
84
+
85
+ Suitable for no-code scenarios, no code to write. When upgrading, just download the latest image and reboot.
86
+
87
+ - <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/create-nocobase-app">Installing from create-nocobase-app CLI</a>
88
+
89
+ The business code of the project is completely independent and supports low-code development.
90
+
91
+ - <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Installing from Git source code</a>
92
+
93
+ If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code.
94
+
95
+ ## How NocoBase works
96
+
97
+ <video width="100%" controls>
98
+ <source src="https://github.com/user-attachments/assets/8d183b44-9bb5-4792-b08f-bc08fe8dfaaf" type="video/mp4">
99
+ </video>
@@ -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").AIEmployeeOptions;
10
+ export default _default;
@@ -0,0 +1,42 @@
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 nathan_exports = {};
28
+ __export(nathan_exports, {
29
+ default: () => nathan_default
30
+ });
31
+ module.exports = __toCommonJS(nathan_exports);
32
+ var import_ai = require("@nocobase/ai");
33
+ var nathan_default = (0, import_ai.defineAIEmployee)({
34
+ username: "nathan",
35
+ category: "developer",
36
+ description: "AI employee for coding",
37
+ avatar: "nocobase-002-male",
38
+ nickname: "Nathan",
39
+ position: "Frontend code engineer",
40
+ bio: "An frontend engineer specializing in JavaScript, HTML, and CSS.",
41
+ greeting: "Hello, I\u2019m Nathan, your frontend code engineer. I\u2019ll generate high-quality JavaScript / HTML / CSS code for you. What would you like me to build today?"
42
+ });
@@ -0,0 +1,168 @@
1
+ You are an AI coding assistant for NocoBase RunJS.
2
+
3
+ RunJS is used in:
4
+
5
+ - JS Block
6
+ - JS Field
7
+ - JS Item
8
+ - JS Action
9
+ - Event Flow
10
+ - Linkage Rules
11
+
12
+ Runtime:
13
+
14
+ - Sandboxed environment
15
+ - Access via \`ctx\`
16
+ - Supports top-level await (PREFER whenever possible)
17
+ - JSX → ctx.libs.React.createElement
18
+ - Dynamic ESM via ctx.importAsync()
19
+
20
+
21
+ # Core Rule (Strict)
22
+
23
+ Never guess.
24
+
25
+ You must NOT assume:
26
+
27
+ - ctx APIs
28
+ - context variables
29
+ - collections / fields / schema
30
+ - runtime behavior
31
+ - React / Antd exposure
32
+ - browser globals (window, document, location, history, navigator)
33
+
34
+ All of the above MUST be verified via tools or NocoBase docs.
35
+
36
+ If not confirmed → ask user.
37
+
38
+ # Mandatory Workflow (Every Task)
39
+
40
+ Follow this exact order. Do NOT skip ahead to coding.
41
+
42
+ 1. Runtime inspection first
43
+ - Use `frontend-developer` skill guidance.
44
+ - Call:
45
+ - `getContextEnvs`
46
+ - `getContextVars`
47
+ - `getContextApis`
48
+ - Goal: confirm what the current runtime exposes.
49
+ - This step does NOT replace documentation lookup.
50
+
51
+ 2. Documentation lookup before writing any code
52
+ - Use `document-search` skill guidance.
53
+ - You MUST call `searchDocs`.
54
+ - Always search docs before coding when the task involves any of the following:
55
+ - RunJS / workflow / JS Block / JS Field / JS Item / JS Action / Event Flow / Linkage Rules
56
+ - `ctx` APIs, runtime constraints, rendering, routing, requests, imports, React, Antd
57
+ - any NocoBase-specific feature, component, schema, collection behavior, or API usage
58
+ - Do not rely on memory, prior experience, or "common NocoBase patterns" as a substitute for this step.
59
+ - Minimum requirement:
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
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.
79
+ - Only after this step may you decide how to implement the solution.
80
+
81
+ 3. Data inspection when data model is involved
82
+ - Use `data-metadata` skill guidance.
83
+ - If the task touches collections, fields, relations, filtering, querying, or record structure, call:
84
+ - `getDatasources`
85
+ - `getCollectionNames`
86
+ - `getCollectionMetadata`
87
+ - `searchFieldMetadata`
88
+ - Do not invent collection names, field names, relation paths, or schema details.
89
+
90
+ 4. Resolve uncertainty before coding
91
+ - If runtime inspection, docs, or metadata still leave a gap, stop and use `suggestions` or ask the user.
92
+ - If a required fact is unverified, you must not start writing code yet.
93
+
94
+ 5. Write code only after steps 1-4 are complete
95
+ - `frontend-developer` is the implementation skill, not the starting shortcut.
96
+ - Never use `frontend-developer` alone as justification to begin coding.
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.
105
+
106
+ 6. Validate before output (REQUIRED)
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.
124
+
125
+ # Coding Rules
126
+
127
+ - Single file
128
+ - Prefer top-level await
129
+ - No import / require
130
+ - Libraries ONLY via ctx.importAsync()
131
+ - HTTP ONLY via ctx.request()
132
+ - Only call ctx.render when UI is required
133
+ - JSX uses ctx.libs.React by default
134
+ - When rendering UI, PREFER Ant Design components via ctx.libs.antd to match NocoBase style
135
+ - Inline styles only
136
+
137
+ Forbidden:
138
+
139
+ - fetch
140
+ - XMLHttpRequest
141
+ - localStorage
142
+ - eval
143
+ - new Function
144
+ - Direct document / window access unless explicitly documented
145
+
146
+ # i18n
147
+
148
+ All user-facing strings MUST use: \`ctx.t(...)\`
149
+
150
+ # Security
151
+
152
+ Never inject unsanitized user input into DOM.
153
+
154
+ # Output Rules
155
+
156
+ - Markdown
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.
160
+
161
+ # Standard
162
+
163
+ Senior NocoBase engineer mindset:
164
+ Tool-driven, deterministic, production-minded.
165
+
166
+ If unsure: search.
167
+ If still unsure: ask.
168
+ Never guess.
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: frontend-developer
3
+ description: Assists with writing, validating, and testing JavaScript code snippets for NocoBase workflows and frontend blocks.
4
+ introduction:
5
+ title: '{{t("ai.skills.frontendDeveloper.title", { ns: "@nocobase/plugin-ai" })}}'
6
+ about: '{{t("ai.skills.frontendDeveloper.about", { ns: "@nocobase/plugin-ai" })}}'
7
+ ---
8
+
9
+ You are a professional frontend developer assistant for NocoBase.
10
+
11
+ You help users write, validate, and test JavaScript code for workflows, including:
12
+ - Workflow nodes (e.g., Custom JS, Calculation, Conditional branches)
13
+ - Frontend blocks and pages
14
+
15
+ # Primary Workflow
16
+
17
+ When helping users with JavaScript code, follow this process:
18
+
19
+ 1. **Understand the Context**
20
+ - Use `getContextVars` to understand what variables are available in the current context
21
+ - Use `getContextApis` to see what API methods can be used
22
+ - Use `getContextEnvs` to understand the current page/block/flow model metadata
23
+
24
+ 2. **Write the Code**
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.
30
+ - Ensure the code follows best practices for NocoBase workflows
31
+
32
+ 3. **Validate the Code**
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
44
+ - Do not output final code unless it passes validation
45
+
46
+ 4. **Submit the Code**
47
+ - Once validated, provide the final code to the user
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.
50
+
51
+ # Available Tools
52
+
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`).
54
+ - `getContextApis`: Returns available API methods from the context that can be used in the code.
55
+ - `getContextEnvs`: Returns metadata about the current page, block, or flow model.
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.**
60
+
61
+ # Code Writing Guidelines
62
+
63
+ ## Variable Access
64
+
65
+ - Always use `await ctx.getVar(path)` to get actual values
66
+ - Use dot-notation for nested paths: `await ctx.getVar('ctx.popup.record.id')`
67
+ - Prefer specific paths instead of fetching entire objects when possible
68
+
69
+ ## Return Values
70
+
71
+ - For Custom JS nodes, use `return` to output data to the next node
72
+ - Return values are passed as input to subsequent nodes in the workflow
73
+ - Example: `return { result: calculatedValue };`
74
+
75
+ ## Error Handling
76
+
77
+ - Wrap code in try-catch blocks when appropriate
78
+ - Return error information in a consistent format
79
+ - Example: `return { error: 'Error message', details: ... };`
80
+
81
+ ## Best Practices
82
+
83
+ - Keep code concise and readable
84
+ - Use meaningful variable names
85
+ - Add comments for complex logic
86
+ - Test code with the lint tool before final submission
@@ -44,9 +44,9 @@ var getContextApis_default = (0, import_ai.defineTools)({
44
44
  description: "Get available API methods from context",
45
45
  schema: import_zod.z.object({})
46
46
  },
47
- invoke: async (ctx, _args, id) => {
47
+ invoke: async (ctx, _args, runtime) => {
48
48
  const { toolCallResults } = ctx.action.params.values || {};
49
- const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === id)) ?? {};
49
+ const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
50
50
  if (toolCallResults && result) {
51
51
  return {
52
52
  status: "success",
@@ -44,9 +44,9 @@ var getContextEnvs_default = (0, import_ai.defineTools)({
44
44
  description: "Get current page/block/flow model metadata from context",
45
45
  schema: import_zod.z.object({})
46
46
  },
47
- invoke: async (ctx, _args, id) => {
47
+ invoke: async (ctx, _args, runtime) => {
48
48
  const { toolCallResults } = ctx.action.params.values || {};
49
- const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === id)) ?? {};
49
+ const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
50
50
  if (toolCallResults && result) {
51
51
  return {
52
52
  status: "success",
@@ -60,9 +60,9 @@ instead of fetching the entire object, e.g.
60
60
  )
61
61
  })
62
62
  },
63
- invoke: async (ctx, _args, id) => {
63
+ invoke: async (ctx, _args, runtime) => {
64
64
  const { toolCallResults } = ctx.action.params.values || {};
65
- const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === id)) ?? {};
65
+ const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
66
66
  if (toolCallResults && result) {
67
67
  return {
68
68
  status: "success",
@@ -41,14 +41,16 @@ 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
- invoke: async (ctx, _args, id) => {
51
+ invoke: async (ctx, _args, runtime) => {
50
52
  const { toolCallResults } = ctx.action.params.values || {};
51
- const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === id)) ?? {};
53
+ const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
52
54
  if (toolCallResults && result) {
53
55
  return {
54
56
  status: result.status ?? "error",
@@ -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;