plugin-agent-orchestrator 1.0.6 → 1.0.14

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 (257) hide show
  1. package/README.md +16 -291
  2. package/dist/client/AIEmployeesContext.d.ts +7 -0
  3. package/dist/client/OrchestratorSettings.d.ts +2 -1
  4. package/dist/client/index.js +1 -1
  5. package/dist/client/plugin.d.ts +1 -0
  6. package/dist/client/skill-hub/components/ExecutionHistory.d.ts +2 -0
  7. package/dist/client/skill-hub/components/ExecutionProgress.d.ts +20 -0
  8. package/dist/client/skill-hub/components/GitSkillImport.d.ts +7 -0
  9. package/dist/client/skill-hub/components/SkillEditor.d.ts +7 -0
  10. package/dist/client/skill-hub/components/SkillManager.d.ts +2 -0
  11. package/dist/client/skill-hub/components/SkillMetrics.d.ts +2 -0
  12. package/dist/client/skill-hub/components/SkillTestPanel.d.ts +7 -0
  13. package/dist/client/skill-hub/index.d.ts +10 -0
  14. package/dist/client/skill-hub/locale.d.ts +3 -0
  15. package/dist/client/skill-hub/tools/InteractionSchemasProvider.d.ts +19 -0
  16. package/dist/client/skill-hub/tools/SkillHubCard.d.ts +3 -0
  17. package/dist/client/skill-hub/utils/jsonFields.d.ts +3 -0
  18. package/dist/externalVersion.js +6 -6
  19. package/dist/node_modules/adm-zip/LICENSE +21 -0
  20. package/dist/node_modules/adm-zip/adm-zip.js +1 -0
  21. package/dist/node_modules/adm-zip/headers/entryHeader.js +377 -0
  22. package/dist/node_modules/adm-zip/headers/index.js +2 -0
  23. package/dist/node_modules/adm-zip/headers/mainHeader.js +130 -0
  24. package/dist/node_modules/adm-zip/methods/deflater.js +33 -0
  25. package/dist/node_modules/adm-zip/methods/index.js +3 -0
  26. package/dist/node_modules/adm-zip/methods/inflater.js +34 -0
  27. package/dist/node_modules/adm-zip/methods/zipcrypto.js +175 -0
  28. package/dist/node_modules/adm-zip/package.json +1 -0
  29. package/dist/node_modules/adm-zip/util/constants.js +142 -0
  30. package/dist/node_modules/adm-zip/util/decoder.js +5 -0
  31. package/dist/node_modules/adm-zip/util/errors.js +63 -0
  32. package/dist/node_modules/adm-zip/util/fattr.js +76 -0
  33. package/dist/node_modules/adm-zip/util/index.js +5 -0
  34. package/dist/node_modules/adm-zip/util/utils.js +339 -0
  35. package/dist/node_modules/adm-zip/zipEntry.js +405 -0
  36. package/dist/node_modules/adm-zip/zipFile.js +446 -0
  37. package/dist/node_modules/simple-git/dist/cjs/index.js +7399 -0
  38. package/dist/node_modules/simple-git/dist/esm/index.js +4745 -0
  39. package/dist/node_modules/simple-git/dist/esm/package.json +3 -0
  40. package/dist/node_modules/simple-git/dist/src/lib/api.d.ts +13 -0
  41. package/dist/node_modules/simple-git/dist/src/lib/args/log-format.d.ts +9 -0
  42. package/dist/node_modules/simple-git/dist/src/lib/errors/git-construct-error.d.ts +15 -0
  43. package/dist/node_modules/simple-git/dist/src/lib/errors/git-error.d.ts +30 -0
  44. package/dist/node_modules/simple-git/dist/src/lib/errors/git-plugin-error.d.ts +7 -0
  45. package/dist/node_modules/simple-git/dist/src/lib/errors/git-response-error.d.ts +32 -0
  46. package/dist/node_modules/simple-git/dist/src/lib/errors/task-configuration-error.d.ts +12 -0
  47. package/dist/node_modules/simple-git/dist/src/lib/git-factory.d.ts +15 -0
  48. package/dist/node_modules/simple-git/dist/src/lib/git-logger.d.ts +21 -0
  49. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-branch-delete.d.ts +5 -0
  50. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-branch.d.ts +2 -0
  51. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-commit.d.ts +2 -0
  52. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-diff-summary.d.ts +3 -0
  53. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-fetch.d.ts +2 -0
  54. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-list-log-summary.d.ts +6 -0
  55. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-merge.d.ts +11 -0
  56. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-move.d.ts +2 -0
  57. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-pull.d.ts +6 -0
  58. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-push.d.ts +4 -0
  59. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-remote-messages.d.ts +5 -0
  60. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-remote-objects.d.ts +3 -0
  61. package/dist/node_modules/simple-git/dist/src/lib/plugins/abort-plugin.d.ts +3 -0
  62. package/dist/node_modules/simple-git/dist/src/lib/plugins/block-unsafe-operations-plugin.d.ts +3 -0
  63. package/dist/node_modules/simple-git/dist/src/lib/plugins/command-config-prefixing-plugin.d.ts +2 -0
  64. package/dist/node_modules/simple-git/dist/src/lib/plugins/completion-detection.plugin.d.ts +3 -0
  65. package/dist/node_modules/simple-git/dist/src/lib/plugins/custom-binary.plugin.d.ts +3 -0
  66. package/dist/node_modules/simple-git/dist/src/lib/plugins/error-detection.plugin.d.ts +7 -0
  67. package/dist/node_modules/simple-git/dist/src/lib/plugins/index.d.ts +11 -0
  68. package/dist/node_modules/simple-git/dist/src/lib/plugins/plugin-store.d.ts +11 -0
  69. package/dist/node_modules/simple-git/dist/src/lib/plugins/progress-monitor-plugin.d.ts +3 -0
  70. package/dist/node_modules/simple-git/dist/src/lib/plugins/simple-git-plugin.d.ts +48 -0
  71. package/dist/node_modules/simple-git/dist/src/lib/plugins/spawn-options-plugin.d.ts +3 -0
  72. package/dist/node_modules/simple-git/dist/src/lib/plugins/suffix-paths.plugin.d.ts +2 -0
  73. package/dist/node_modules/simple-git/dist/src/lib/plugins/timout-plugin.d.ts +3 -0
  74. package/dist/node_modules/simple-git/dist/src/lib/responses/BranchDeleteSummary.d.ts +12 -0
  75. package/dist/node_modules/simple-git/dist/src/lib/responses/BranchSummary.d.ts +14 -0
  76. package/dist/node_modules/simple-git/dist/src/lib/responses/CheckIgnore.d.ts +4 -0
  77. package/dist/node_modules/simple-git/dist/src/lib/responses/CleanSummary.d.ts +9 -0
  78. package/dist/node_modules/simple-git/dist/src/lib/responses/ConfigList.d.ts +13 -0
  79. package/dist/node_modules/simple-git/dist/src/lib/responses/DiffSummary.d.ts +10 -0
  80. package/dist/node_modules/simple-git/dist/src/lib/responses/FileStatusSummary.d.ts +9 -0
  81. package/dist/node_modules/simple-git/dist/src/lib/responses/GetRemoteSummary.d.ts +11 -0
  82. package/dist/node_modules/simple-git/dist/src/lib/responses/InitSummary.d.ts +9 -0
  83. package/dist/node_modules/simple-git/dist/src/lib/responses/MergeSummary.d.ts +16 -0
  84. package/dist/node_modules/simple-git/dist/src/lib/responses/PullSummary.d.ts +25 -0
  85. package/dist/node_modules/simple-git/dist/src/lib/responses/StatusSummary.d.ts +19 -0
  86. package/dist/node_modules/simple-git/dist/src/lib/responses/TagList.d.ts +7 -0
  87. package/dist/node_modules/simple-git/dist/src/lib/runners/git-executor-chain.d.ts +25 -0
  88. package/dist/node_modules/simple-git/dist/src/lib/runners/git-executor.d.ts +14 -0
  89. package/dist/node_modules/simple-git/dist/src/lib/runners/promise-wrapped.d.ts +2 -0
  90. package/dist/node_modules/simple-git/dist/src/lib/runners/scheduler.d.ts +11 -0
  91. package/dist/node_modules/simple-git/dist/src/lib/runners/tasks-pending-queue.d.ts +23 -0
  92. package/dist/node_modules/simple-git/dist/src/lib/simple-git-api.d.ts +20 -0
  93. package/dist/node_modules/simple-git/dist/src/lib/task-callback.d.ts +2 -0
  94. package/dist/node_modules/simple-git/dist/src/lib/tasks/apply-patch.d.ts +3 -0
  95. package/dist/node_modules/simple-git/dist/src/lib/tasks/branch.d.ts +7 -0
  96. package/dist/node_modules/simple-git/dist/src/lib/tasks/change-working-directory.d.ts +2 -0
  97. package/dist/node_modules/simple-git/dist/src/lib/tasks/check-ignore.d.ts +2 -0
  98. package/dist/node_modules/simple-git/dist/src/lib/tasks/check-is-repo.d.ts +9 -0
  99. package/dist/node_modules/simple-git/dist/src/lib/tasks/checkout.d.ts +2 -0
  100. package/dist/node_modules/simple-git/dist/src/lib/tasks/clean.d.ts +25 -0
  101. package/dist/node_modules/simple-git/dist/src/lib/tasks/clone.d.ts +9 -0
  102. package/dist/node_modules/simple-git/dist/src/lib/tasks/commit.d.ts +4 -0
  103. package/dist/node_modules/simple-git/dist/src/lib/tasks/config.d.ts +8 -0
  104. package/dist/node_modules/simple-git/dist/src/lib/tasks/count-objects.d.ts +12 -0
  105. package/dist/node_modules/simple-git/dist/src/lib/tasks/diff-name-status.d.ts +12 -0
  106. package/dist/node_modules/simple-git/dist/src/lib/tasks/diff.d.ts +5 -0
  107. package/dist/node_modules/simple-git/dist/src/lib/tasks/fetch.d.ts +4 -0
  108. package/dist/node_modules/simple-git/dist/src/lib/tasks/first-commit.d.ts +2 -0
  109. package/dist/node_modules/simple-git/dist/src/lib/tasks/grep.d.ts +12 -0
  110. package/dist/node_modules/simple-git/dist/src/lib/tasks/hash-object.d.ts +5 -0
  111. package/dist/node_modules/simple-git/dist/src/lib/tasks/init.d.ts +3 -0
  112. package/dist/node_modules/simple-git/dist/src/lib/tasks/log.d.ts +32 -0
  113. package/dist/node_modules/simple-git/dist/src/lib/tasks/merge.d.ts +4 -0
  114. package/dist/node_modules/simple-git/dist/src/lib/tasks/move.d.ts +3 -0
  115. package/dist/node_modules/simple-git/dist/src/lib/tasks/pull.d.ts +3 -0
  116. package/dist/node_modules/simple-git/dist/src/lib/tasks/push.d.ts +9 -0
  117. package/dist/node_modules/simple-git/dist/src/lib/tasks/remote.d.ts +8 -0
  118. package/dist/node_modules/simple-git/dist/src/lib/tasks/reset.d.ts +11 -0
  119. package/dist/node_modules/simple-git/dist/src/lib/tasks/show.d.ts +2 -0
  120. package/dist/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts +4 -0
  121. package/dist/node_modules/simple-git/dist/src/lib/tasks/status.d.ts +3 -0
  122. package/dist/node_modules/simple-git/dist/src/lib/tasks/sub-module.d.ts +5 -0
  123. package/dist/node_modules/simple-git/dist/src/lib/tasks/tag.d.ts +18 -0
  124. package/dist/node_modules/simple-git/dist/src/lib/tasks/task.d.ts +14 -0
  125. package/dist/node_modules/simple-git/dist/src/lib/tasks/version.d.ts +9 -0
  126. package/dist/node_modules/simple-git/dist/src/lib/types/handlers.d.ts +21 -0
  127. package/dist/node_modules/simple-git/dist/src/lib/types/index.d.ts +136 -0
  128. package/dist/node_modules/simple-git/dist/src/lib/types/tasks.d.ts +19 -0
  129. package/dist/node_modules/simple-git/dist/src/lib/utils/argument-filters.d.ts +14 -0
  130. package/dist/node_modules/simple-git/dist/src/lib/utils/exit-codes.d.ts +10 -0
  131. package/dist/node_modules/simple-git/dist/src/lib/utils/git-output-streams.d.ts +7 -0
  132. package/dist/node_modules/simple-git/dist/src/lib/utils/index.d.ts +8 -0
  133. package/dist/node_modules/simple-git/dist/src/lib/utils/line-parser.d.ts +15 -0
  134. package/dist/node_modules/simple-git/dist/src/lib/utils/simple-git-options.d.ts +2 -0
  135. package/dist/node_modules/simple-git/dist/src/lib/utils/task-options.d.ts +13 -0
  136. package/dist/node_modules/simple-git/dist/src/lib/utils/task-parser.d.ts +5 -0
  137. package/dist/node_modules/simple-git/dist/src/lib/utils/util.d.ts +47 -0
  138. package/dist/node_modules/simple-git/dist/typings/errors.d.ts +5 -0
  139. package/dist/node_modules/simple-git/dist/typings/index.d.ts +14 -0
  140. package/dist/node_modules/simple-git/dist/typings/response.d.ts +556 -0
  141. package/dist/node_modules/simple-git/dist/typings/simple-git.d.ts +1033 -0
  142. package/dist/node_modules/simple-git/dist/typings/types.d.ts +22 -0
  143. package/dist/node_modules/simple-git/node_modules/debug/package.json +64 -0
  144. package/dist/node_modules/simple-git/node_modules/debug/src/browser.js +272 -0
  145. package/dist/node_modules/simple-git/node_modules/debug/src/common.js +292 -0
  146. package/dist/node_modules/simple-git/node_modules/debug/src/index.js +10 -0
  147. package/dist/node_modules/simple-git/node_modules/debug/src/node.js +263 -0
  148. package/dist/node_modules/simple-git/package.json +1 -0
  149. package/dist/node_modules/simple-git/promise.js +17 -0
  150. package/dist/server/collections/agent-execution-spans.d.ts +9 -0
  151. package/dist/server/collections/agent-execution-spans.js +152 -0
  152. package/dist/server/collections/orchestrator-config.js +16 -0
  153. package/dist/server/collections/orchestrator-logs.js +19 -2
  154. package/dist/server/collections/skill-definitions.d.ts +3 -0
  155. package/dist/server/collections/skill-definitions.js +158 -0
  156. package/dist/server/collections/skill-executions.d.ts +3 -0
  157. package/dist/server/collections/skill-executions.js +123 -0
  158. package/dist/server/collections/skill-worker-configs.d.ts +3 -0
  159. package/dist/server/collections/skill-worker-configs.js +115 -0
  160. package/dist/server/migrations/20260423000000-add-progress-fields.d.ts +4 -0
  161. package/dist/server/migrations/20260423000000-add-progress-fields.js +69 -0
  162. package/dist/server/migrations/20260425000000-add-interaction-schema.d.ts +4 -0
  163. package/dist/server/migrations/20260425000000-add-interaction-schema.js +61 -0
  164. package/dist/server/migrations/20260427000000-add-tracing-detail-fields.d.ts +7 -0
  165. package/dist/server/migrations/20260427000000-add-tracing-detail-fields.js +62 -0
  166. package/dist/server/migrations/20260427000000-change-packages-to-text.d.ts +4 -0
  167. package/dist/server/migrations/20260427000000-change-packages-to-text.js +70 -0
  168. package/dist/server/migrations/20260427000001-change-other-json-to-text.d.ts +4 -0
  169. package/dist/server/migrations/20260427000001-change-other-json-to-text.js +80 -0
  170. package/dist/server/migrations/20260429000000-add-llm-fields.d.ts +7 -0
  171. package/dist/server/migrations/20260429000000-add-llm-fields.js +68 -0
  172. package/dist/server/migrations/20260429000000-fix-inputargs-json-to-text.d.ts +16 -0
  173. package/dist/server/migrations/20260429000000-fix-inputargs-json-to-text.js +51 -0
  174. package/dist/server/migrations/20260503000000-add-orchestrator-trace-fields.d.ts +7 -0
  175. package/dist/server/migrations/20260503000000-add-orchestrator-trace-fields.js +57 -0
  176. package/dist/server/plugin.d.ts +3 -0
  177. package/dist/server/plugin.js +37 -1
  178. package/dist/server/resources/tracing.js +160 -12
  179. package/dist/server/services/CodeValidator.d.ts +32 -0
  180. package/dist/server/services/CodeValidator.js +205 -0
  181. package/dist/server/services/ExecutionSpanService.d.ts +44 -0
  182. package/dist/server/services/ExecutionSpanService.js +104 -0
  183. package/dist/server/services/FileManager.d.ts +28 -0
  184. package/dist/server/services/FileManager.js +151 -0
  185. package/dist/server/services/SandboxRunner.d.ts +41 -0
  186. package/dist/server/services/SandboxRunner.js +167 -0
  187. package/dist/server/services/SkillManager.d.ts +6 -0
  188. package/dist/server/services/SkillManager.js +640 -0
  189. package/dist/server/services/SkillRepositoryService.d.ts +22 -0
  190. package/dist/server/services/SkillRepositoryService.js +157 -0
  191. package/dist/server/services/WorkerEnvManager.d.ts +26 -0
  192. package/dist/server/services/WorkerEnvManager.js +120 -0
  193. package/dist/server/skill-hub/actions/git-import.d.ts +21 -0
  194. package/dist/server/skill-hub/actions/git-import.js +413 -0
  195. package/dist/server/skill-hub/mcp/McpController.d.ts +15 -0
  196. package/dist/server/skill-hub/mcp/McpController.js +111 -0
  197. package/dist/server/skill-hub/plugin.d.ts +58 -0
  198. package/dist/server/skill-hub/plugin.js +694 -0
  199. package/dist/server/skill-hub/sandbox-config.json +6 -0
  200. package/dist/server/skill-hub/tasks/SkillExecutionTask.d.ts +14 -0
  201. package/dist/server/skill-hub/tasks/SkillExecutionTask.js +267 -0
  202. package/dist/server/skill-hub/utils/json-fields.d.ts +7 -0
  203. package/dist/server/skill-hub/utils/json-fields.js +88 -0
  204. package/dist/server/tools/delegate-task.d.ts +4 -0
  205. package/dist/server/tools/delegate-task.js +832 -119
  206. package/dist/server/tools/skill-execute.d.ts +36 -0
  207. package/dist/server/tools/skill-execute.js +167 -0
  208. package/package.json +3 -1
  209. package/src/client/AIEmployeeSelect.tsx +1 -3
  210. package/src/client/AIEmployeesContext.tsx +28 -13
  211. package/src/client/OrchestratorSettings.tsx +43 -5
  212. package/src/client/RulesTab.tsx +368 -21
  213. package/src/client/TracingTab.tsx +316 -102
  214. package/src/client/plugin.tsx +39 -0
  215. package/src/client/skill-hub/components/ExecutionHistory.tsx +201 -0
  216. package/src/client/skill-hub/components/ExecutionProgress.tsx +55 -0
  217. package/src/client/skill-hub/components/GitSkillImport.tsx +555 -0
  218. package/src/client/skill-hub/components/SkillEditor.tsx +456 -0
  219. package/src/client/skill-hub/components/SkillManager.tsx +181 -0
  220. package/src/client/skill-hub/components/SkillMetrics.tsx +124 -0
  221. package/src/client/skill-hub/components/SkillTestPanel.tsx +144 -0
  222. package/src/client/skill-hub/index.tsx +75 -0
  223. package/src/client/skill-hub/locale.ts +16 -0
  224. package/src/client/skill-hub/tools/InteractionSchemasProvider.tsx +59 -0
  225. package/src/client/skill-hub/tools/SkillHubCard.tsx +78 -0
  226. package/src/client/skill-hub/utils/jsonFields.ts +37 -0
  227. package/src/server/collections/agent-execution-spans.ts +129 -0
  228. package/src/server/collections/orchestrator-config.ts +17 -0
  229. package/src/server/collections/orchestrator-logs.ts +19 -2
  230. package/src/server/collections/skill-definitions.ts +128 -0
  231. package/src/server/collections/skill-executions.ts +94 -0
  232. package/src/server/collections/skill-worker-configs.ts +86 -0
  233. package/src/server/migrations/20260423000000-add-progress-fields.ts +50 -0
  234. package/src/server/migrations/20260425000000-add-interaction-schema.ts +35 -0
  235. package/src/server/migrations/20260427000000-add-tracing-detail-fields.ts +41 -0
  236. package/src/server/migrations/20260427000000-change-packages-to-text.ts +47 -0
  237. package/src/server/migrations/20260427000001-change-other-json-to-text.ts +57 -0
  238. package/src/server/migrations/20260429000000-add-llm-fields.ts +46 -0
  239. package/src/server/migrations/20260429000000-fix-inputargs-json-to-text.ts +38 -0
  240. package/src/server/migrations/20260503000000-add-orchestrator-trace-fields.ts +32 -0
  241. package/src/server/plugin.ts +51 -3
  242. package/src/server/resources/tracing.ts +187 -16
  243. package/src/server/services/CodeValidator.ts +159 -0
  244. package/src/server/services/ExecutionSpanService.ts +106 -0
  245. package/src/server/services/FileManager.ts +144 -0
  246. package/src/server/services/SandboxRunner.ts +205 -0
  247. package/src/server/services/SkillManager.ts +623 -0
  248. package/src/server/services/SkillRepositoryService.ts +142 -0
  249. package/src/server/services/WorkerEnvManager.ts +113 -0
  250. package/src/server/skill-hub/actions/git-import.ts +486 -0
  251. package/src/server/skill-hub/mcp/McpController.ts +86 -0
  252. package/src/server/skill-hub/plugin.ts +771 -0
  253. package/src/server/skill-hub/sandbox-config.json +6 -0
  254. package/src/server/skill-hub/tasks/SkillExecutionTask.ts +297 -0
  255. package/src/server/skill-hub/utils/json-fields.ts +57 -0
  256. package/src/server/tools/delegate-task.ts +1085 -147
  257. package/src/server/tools/skill-execute.ts +157 -0
@@ -0,0 +1,68 @@
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 add_llm_fields_exports = {};
28
+ __export(add_llm_fields_exports, {
29
+ default: () => AddLlmFieldsToOrchestratorConfig
30
+ });
31
+ module.exports = __toCommonJS(add_llm_fields_exports);
32
+ var import_server = require("@nocobase/server");
33
+ class AddLlmFieldsToOrchestratorConfig extends import_server.Migration {
34
+ on = "afterLoad";
35
+ appVersion = ">=0.1.0";
36
+ async up() {
37
+ const queryInterface = this.db.sequelize.getQueryInterface();
38
+ const tablePrefix = this.db.options.tablePrefix || "";
39
+ const tableName = `${tablePrefix}orchestratorConfig`;
40
+ const tableExists = await queryInterface.tableExists(tableName);
41
+ if (!tableExists) return;
42
+ const tableDesc = await queryInterface.describeTable(tableName);
43
+ if (!tableDesc["llmService"]) {
44
+ await queryInterface.addColumn(tableName, "llmService", {
45
+ type: "VARCHAR(255)",
46
+ allowNull: true
47
+ });
48
+ console.log(`[AgentOrchestrator] Added llmService column to ${tableName}`);
49
+ }
50
+ if (!tableDesc["model"]) {
51
+ await queryInterface.addColumn(tableName, "model", {
52
+ type: "VARCHAR(255)",
53
+ allowNull: true
54
+ });
55
+ console.log(`[AgentOrchestrator] Added model column to ${tableName}`);
56
+ }
57
+ if (!tableDesc["recursionLimit"]) {
58
+ await queryInterface.addColumn(tableName, "recursionLimit", {
59
+ type: "INTEGER",
60
+ allowNull: true,
61
+ defaultValue: 50
62
+ });
63
+ console.log(`[AgentOrchestrator] Added recursionLimit column to ${tableName}`);
64
+ }
65
+ }
66
+ async down() {
67
+ }
68
+ }
@@ -0,0 +1,16 @@
1
+ import { Migration } from '@nocobase/server';
2
+ /**
3
+ * Fix: inputArgs column in skillExecutions was json type but should be text.
4
+ *
5
+ * Root cause: The column was created as `json` from an older schema version,
6
+ * but the collection defines it as `text`. The `stringifyJsonText()` utility
7
+ * wraps values in markdown code fences (```json\n...\n```) which PostgreSQL
8
+ * rejects as invalid JSON syntax, causing SequelizeDatabaseError on every
9
+ * skill execution attempt.
10
+ */
11
+ export default class FixInputArgsJsonToText extends Migration {
12
+ on: string;
13
+ appVersion: string;
14
+ up(): Promise<void>;
15
+ down(): Promise<void>;
16
+ }
@@ -0,0 +1,51 @@
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 fix_inputargs_json_to_text_exports = {};
28
+ __export(fix_inputargs_json_to_text_exports, {
29
+ default: () => FixInputArgsJsonToText
30
+ });
31
+ module.exports = __toCommonJS(fix_inputargs_json_to_text_exports);
32
+ var import_server = require("@nocobase/server");
33
+ class FixInputArgsJsonToText extends import_server.Migration {
34
+ on = "afterLoad";
35
+ appVersion = ">=0.1.0";
36
+ async up() {
37
+ const queryInterface = this.db.sequelize.getQueryInterface();
38
+ const tableDesc = await queryInterface.describeTable("skillExecutions").catch(() => null);
39
+ if (!tableDesc) return;
40
+ const col = tableDesc["inputArgs"];
41
+ if (!col) return;
42
+ if (col.type && col.type.toLowerCase().includes("json")) {
43
+ await this.db.sequelize.query(
44
+ `ALTER TABLE "skillExecutions" ALTER COLUMN "inputArgs" TYPE text USING "inputArgs"::text`
45
+ );
46
+ console.log("[skill-hub] Migration: converted skillExecutions.inputArgs from json to text");
47
+ }
48
+ }
49
+ async down() {
50
+ }
51
+ }
@@ -0,0 +1,7 @@
1
+ import { Migration } from '@nocobase/server';
2
+ export default class AddOrchestratorTraceFieldsToSkillExecutions extends Migration {
3
+ on: string;
4
+ appVersion: string;
5
+ up(): Promise<void>;
6
+ down(): Promise<void>;
7
+ }
@@ -0,0 +1,57 @@
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 add_orchestrator_trace_fields_exports = {};
28
+ __export(add_orchestrator_trace_fields_exports, {
29
+ default: () => AddOrchestratorTraceFieldsToSkillExecutions
30
+ });
31
+ module.exports = __toCommonJS(add_orchestrator_trace_fields_exports);
32
+ var import_server = require("@nocobase/server");
33
+ class AddOrchestratorTraceFieldsToSkillExecutions extends import_server.Migration {
34
+ on = "afterLoad";
35
+ appVersion = ">=0.1.0";
36
+ async up() {
37
+ const queryInterface = this.db.sequelize.getQueryInterface();
38
+ const tablePrefix = this.db.options.tablePrefix || "";
39
+ const tableName = `${tablePrefix}skillExecutions`;
40
+ const tableExists = await queryInterface.tableExists(tableName).catch(() => false);
41
+ if (!tableExists) return;
42
+ const tableDesc = await queryInterface.describeTable(tableName);
43
+ const addIfMissing = async (name) => {
44
+ if (tableDesc[name]) return;
45
+ await queryInterface.addColumn(tableName, name, {
46
+ type: "VARCHAR(100)",
47
+ allowNull: true
48
+ });
49
+ };
50
+ await addIfMissing("orchestratorRootRunId");
51
+ await addIfMissing("orchestratorSpanId");
52
+ await addIfMissing("orchestratorParentSpanId");
53
+ await addIfMissing("orchestratorToolCallId");
54
+ }
55
+ async down() {
56
+ }
57
+ }
@@ -1,5 +1,7 @@
1
1
  import { Plugin } from '@nocobase/server';
2
+ import SkillHubSubFeature from './skill-hub/plugin';
2
3
  export declare class PluginAgentOrchestratorServer extends Plugin {
4
+ skillHub: SkillHubSubFeature;
3
5
  afterAdd(): Promise<void>;
4
6
  beforeLoad(): Promise<void>;
5
7
  load(): Promise<void>;
@@ -7,5 +9,6 @@ export declare class PluginAgentOrchestratorServer extends Plugin {
7
9
  afterEnable(): Promise<void>;
8
10
  afterDisable(): Promise<void>;
9
11
  remove(): Promise<void>;
12
+ beforeStop(): Promise<void>;
10
13
  }
11
14
  export default PluginAgentOrchestratorServer;
@@ -44,22 +44,55 @@ var import_server = require("@nocobase/server");
44
44
  var import_path = __toESM(require("path"));
45
45
  var import_delegate_task = require("./tools/delegate-task");
46
46
  var import_tracing = require("./resources/tracing");
47
+ var import_plugin = __toESM(require("./skill-hub/plugin"));
47
48
  class PluginAgentOrchestratorServer extends import_server.Plugin {
49
+ skillHub;
48
50
  async afterAdd() {
51
+ this.skillHub = new import_plugin.default(this);
49
52
  }
50
53
  async beforeLoad() {
51
54
  this.db.import({ directory: import_path.default.resolve(__dirname, "collections") });
55
+ this.db.addMigrations({
56
+ namespace: this.name,
57
+ directory: import_path.default.resolve(__dirname, "migrations"),
58
+ context: { plugin: this }
59
+ });
52
60
  }
53
61
  async load() {
62
+ await this.skillHub.load();
54
63
  this.app.acl.registerSnippet({
55
64
  name: `pm.${this.name}`,
56
- actions: ["orchestratorConfig:*"]
65
+ actions: ["orchestratorConfig:*", "orchestratorTracing:*", "agentExecutionSpans:*", "skillDefinitions:*", "skillExecutions:*", "skillHub:*", "skillWorkerConfigs:*"]
57
66
  });
58
67
  const toolsManager = this.app.aiManager.toolsManager;
59
68
  toolsManager.registerDynamicTools((0, import_delegate_task.createDelegateToolsProvider)(this));
60
69
  (0, import_tracing.registerTracingResource)(this);
70
+ this.app.cronJobManager.addJob({
71
+ cronTime: "0 30 2 * * *",
72
+ onTick: async () => {
73
+ try {
74
+ const days = Number(process.env.ORCHESTRATOR_LOG_RETENTION_DAYS || 30);
75
+ if (!Number.isFinite(days) || days <= 0) return;
76
+ const cutoff = new Date(Date.now() - days * 864e5);
77
+ const repo = this.db.getRepository("orchestratorLogs");
78
+ const spansRepo = this.db.getRepository("agentExecutionSpans");
79
+ const deletedLogs = repo ? await repo.destroy({
80
+ filter: { createdAt: { $lt: cutoff.toISOString() } }
81
+ }) : 0;
82
+ const deletedSpans = spansRepo ? await spansRepo.destroy({
83
+ filter: { createdAt: { $lt: cutoff.toISOString() } }
84
+ }) : 0;
85
+ this.app.log.info(
86
+ `[AgentOrchestrator] Pruned ${deletedLogs} orchestratorLogs and ${deletedSpans} agentExecutionSpans rows older than ${days} day(s).`
87
+ );
88
+ } catch (e) {
89
+ this.app.log.error("[AgentOrchestrator] Log retention job failed", e);
90
+ }
91
+ }
92
+ });
61
93
  }
62
94
  async install() {
95
+ await this.skillHub.install();
63
96
  }
64
97
  async afterEnable() {
65
98
  }
@@ -67,6 +100,9 @@ class PluginAgentOrchestratorServer extends import_server.Plugin {
67
100
  }
68
101
  async remove() {
69
102
  }
103
+ async beforeStop() {
104
+ await this.skillHub.beforeStop();
105
+ }
70
106
  }
71
107
  var plugin_default = PluginAgentOrchestratorServer;
72
108
  // Annotate the CommonJS export names for ESM import in node:
@@ -29,6 +29,94 @@ __export(tracing_exports, {
29
29
  registerTracingResource: () => registerTracingResource
30
30
  });
31
31
  module.exports = __toCommonJS(tracing_exports);
32
+ function toPlain(row) {
33
+ var _a;
34
+ return ((_a = row == null ? void 0 : row.toJSON) == null ? void 0 : _a.call(row)) || row;
35
+ }
36
+ function normalizeSpanFilter(filter = {}) {
37
+ const next = { ...filter };
38
+ if (next.subAgentUsername) {
39
+ next.employeeUsername = next.subAgentUsername;
40
+ delete next.subAgentUsername;
41
+ }
42
+ return next;
43
+ }
44
+ function spanTitle(row) {
45
+ if (row.title) return row.title;
46
+ if (row.type === "sub_agent") return `${row.leaderUsername || "-"} -> ${row.employeeUsername || "-"}`;
47
+ return row.toolName || row.type || "span";
48
+ }
49
+ function formatSpanListRow(raw) {
50
+ const row = toPlain(raw);
51
+ const metadata = row.metadata || {};
52
+ const input = row.input || {};
53
+ return {
54
+ id: row.id,
55
+ rootRunId: row.rootRunId,
56
+ parentSpanId: row.parentSpanId,
57
+ type: row.type,
58
+ leaderUsername: row.leaderUsername,
59
+ subAgentUsername: row.employeeUsername,
60
+ employeeUsername: row.employeeUsername,
61
+ toolName: row.toolName,
62
+ task: input.task || metadata.task || row.title || "",
63
+ context: input.context || "",
64
+ result: row.output,
65
+ status: row.status,
66
+ depth: metadata.depth ?? 0,
67
+ durationMs: row.durationMs,
68
+ error: row.error,
69
+ userId: row.userId,
70
+ createdAt: row.createdAt || row.startedAt,
71
+ traceCount: metadata.traceCount || 0,
72
+ messageCount: Array.isArray(metadata.messages) ? metadata.messages.length : metadata.messageCount || 0,
73
+ hasUnifiedTrace: true
74
+ };
75
+ }
76
+ function buildSpanTree(rows) {
77
+ const plainRows = rows.map(toPlain);
78
+ const byId = /* @__PURE__ */ new Map();
79
+ const roots = [];
80
+ for (const row of plainRows) {
81
+ const node = { ...row, children: [] };
82
+ byId.set(String(row.id), node);
83
+ }
84
+ for (const row of byId.values()) {
85
+ if (row.parentSpanId && byId.has(String(row.parentSpanId))) {
86
+ byId.get(String(row.parentSpanId)).children.push(row);
87
+ } else {
88
+ roots.push(row);
89
+ }
90
+ }
91
+ const sortTree = (items) => {
92
+ items.sort(
93
+ (a, b) => new Date(a.startedAt || a.createdAt || 0).getTime() - new Date(b.startedAt || b.createdAt || 0).getTime()
94
+ );
95
+ for (const item of items) sortTree(item.children || []);
96
+ };
97
+ sortTree(roots);
98
+ return roots;
99
+ }
100
+ function flattenSpanTimeline(rows) {
101
+ return rows.map(toPlain).sort(
102
+ (a, b) => new Date(a.startedAt || a.createdAt || 0).getTime() - new Date(b.startedAt || b.createdAt || 0).getTime()
103
+ ).map((row) => {
104
+ const input = row.input || {};
105
+ const metadata = row.metadata || {};
106
+ return {
107
+ type: row.type,
108
+ at: row.startedAt || row.createdAt,
109
+ title: spanTitle(row),
110
+ toolName: row.toolName,
111
+ args: row.type === "tool" || row.type === "skill" ? input : void 0,
112
+ status: row.status,
113
+ content: row.output || row.error || input.task || metadata.summary || "",
114
+ spanId: row.id,
115
+ parentSpanId: row.parentSpanId,
116
+ skillExecutionId: row.skillExecutionId
117
+ };
118
+ });
119
+ }
32
120
  function registerTracingResource(plugin) {
33
121
  const app = plugin.app;
34
122
  app.resource({
@@ -38,10 +126,38 @@ function registerTracingResource(plugin) {
38
126
  * List all delegation execution logs.
39
127
  */
40
128
  async list(ctx, next) {
41
- const repo = ctx.db.getRepository("orchestratorLogs");
42
- const { page = 1, pageSize = 50, sort = ["-createdAt"] } = ctx.action.params;
129
+ const { page = 1, pageSize = 50, sort = ["-createdAt"], filter = {} } = ctx.action.params;
43
130
  try {
131
+ const spanRepo = ctx.db.getRepository("agentExecutionSpans");
132
+ if (spanRepo) {
133
+ const spanFilter = {
134
+ ...normalizeSpanFilter(filter),
135
+ parentSpanId: null,
136
+ type: "sub_agent"
137
+ };
138
+ const [spanRows, spanCount] = await spanRepo.findAndCount({
139
+ filter: spanFilter,
140
+ sort,
141
+ offset: (Number(page) - 1) * Number(pageSize),
142
+ limit: Number(pageSize)
143
+ });
144
+ if (spanCount > 0) {
145
+ ctx.body = {
146
+ data: spanRows.map(formatSpanListRow),
147
+ meta: {
148
+ count: spanCount,
149
+ page: Number(page),
150
+ pageSize: Number(pageSize),
151
+ totalPage: Math.ceil(spanCount / Number(pageSize))
152
+ }
153
+ };
154
+ await next();
155
+ return;
156
+ }
157
+ }
158
+ const repo = ctx.db.getRepository("orchestratorLogs");
44
159
  const [rows, count] = await repo.findAndCount({
160
+ filter,
45
161
  sort,
46
162
  offset: (Number(page) - 1) * Number(pageSize),
47
163
  limit: Number(pageSize)
@@ -53,13 +169,17 @@ function registerTracingResource(plugin) {
53
169
  subAgentUsername: row.subAgentUsername,
54
170
  toolName: row.toolName,
55
171
  task: row.task,
172
+ context: row.context,
56
173
  result: row.result,
57
174
  status: row.status,
58
175
  depth: row.depth,
59
176
  durationMs: row.durationMs,
60
177
  error: row.error,
61
178
  userId: row.userId,
62
- createdAt: row.createdAt
179
+ createdAt: row.createdAt,
180
+ traceCount: Array.isArray(row.trace) ? row.trace.length : 0,
181
+ messageCount: Array.isArray(row.messages) ? row.messages.length : 0,
182
+ hasUnifiedTrace: false
63
183
  })),
64
184
  meta: {
65
185
  count,
@@ -70,7 +190,7 @@ function registerTracingResource(plugin) {
70
190
  };
71
191
  } catch (e) {
72
192
  ctx.log.error("[AgentOrchestrator] Tracing list error", e);
73
- ctx.body = { data: [], meta: { count: 0 } };
193
+ ctx.throw(500, (e == null ? void 0 : e.message) || "Failed to load tracing logs");
74
194
  }
75
195
  await next();
76
196
  },
@@ -78,29 +198,57 @@ function registerTracingResource(plugin) {
78
198
  * Get a single delegation log by ID.
79
199
  */
80
200
  async get(ctx, next) {
81
- const { filterByTk } = ctx.action.params;
201
+ var _a;
202
+ const { filterByTk, source } = ctx.action.params;
82
203
  if (!filterByTk) {
83
204
  ctx.throw(400, "id is required");
84
205
  return;
85
206
  }
86
207
  try {
208
+ const spanRepo = ctx.db.getRepository("agentExecutionSpans");
209
+ if (spanRepo && source !== "log") {
210
+ const span = await spanRepo.findOne({
211
+ filter: { id: filterByTk }
212
+ });
213
+ if (span) {
214
+ const plainSpan = toPlain(span);
215
+ const rows = await spanRepo.find({
216
+ filter: { rootRunId: plainSpan.rootRunId },
217
+ sort: ["createdAt"]
218
+ });
219
+ const tree = buildSpanTree(rows);
220
+ const timeline = flattenSpanTimeline(rows);
221
+ const rootRow = formatSpanListRow(plainSpan);
222
+ const metadata = plainSpan.metadata || {};
223
+ ctx.body = {
224
+ data: {
225
+ ...rootRow,
226
+ input: plainSpan.input,
227
+ output: plainSpan.output,
228
+ metadata,
229
+ trace: timeline,
230
+ messages: metadata.messages || [],
231
+ children: tree
232
+ }
233
+ };
234
+ await next();
235
+ return;
236
+ }
237
+ }
87
238
  const repo = ctx.db.getRepository("orchestratorLogs");
88
- const log = await repo.findOne({
239
+ const log = source === "span" ? null : await repo.findOne({
89
240
  filter: { id: filterByTk }
90
241
  });
91
- ctx.body = { data: log };
242
+ const plainLog = ((_a = log == null ? void 0 : log.toJSON) == null ? void 0 : _a.call(log)) || log;
243
+ ctx.body = { data: plainLog ? { ...plainLog, hasUnifiedTrace: false } : null };
92
244
  } catch (e) {
93
245
  ctx.log.error("[AgentOrchestrator] Tracing get error", e);
94
- ctx.body = { data: null };
246
+ ctx.throw(500, (e == null ? void 0 : e.message) || "Failed to load tracing log");
95
247
  }
96
248
  await next();
97
249
  }
98
250
  }
99
251
  });
100
- app.acl.registerSnippet({
101
- name: `pm.${plugin.name}.tracing`,
102
- actions: ["orchestratorTracing:list", "orchestratorTracing:get"]
103
- });
104
252
  }
105
253
  // Annotate the CommonJS export names for ESM import in node:
106
254
  0 && (module.exports = {
@@ -0,0 +1,32 @@
1
+ export declare class CodeValidator {
2
+ /**
3
+ * Check code against forbidden patterns (dangerous modules/functions).
4
+ * @throws CodeValidationError if a forbidden pattern is found.
5
+ */
6
+ validate(code: string, language: 'node' | 'python'): void;
7
+ /**
8
+ * Validate that code only imports packages in the whitelist.
9
+ * Called after the basic forbidden pattern check.
10
+ * Skips validation if whitelist is empty (env not initialized yet).
11
+ *
12
+ * @param code - The code to validate
13
+ * @param language - 'node' or 'python'
14
+ * @param whitelist - Array of allowed package names (from skillWorkerConfigs.packageWhitelist)
15
+ */
16
+ validateImports(code: string, language: 'node' | 'python', whitelist: string[]): void;
17
+ /**
18
+ * Check Node.js require() calls against the whitelist.
19
+ * Built-in modules (fs, path, etc.) are always allowed.
20
+ */
21
+ private validateNodeImports;
22
+ /**
23
+ * Check Python import/from statements against the whitelist.
24
+ * Built-in modules (os, sys, json, etc.) are always allowed.
25
+ * Handles PyPI→import name mapping (e.g., python-docx → docx, Pillow → PIL).
26
+ */
27
+ private validatePythonImports;
28
+ }
29
+ export declare class CodeValidationError extends Error {
30
+ matchedPattern: string;
31
+ constructor(message: string, matchedPattern: string);
32
+ }