plugin-agent-orchestrator 1.2.0 → 1.2.2

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 (223) hide show
  1. package/LICENSE +201 -0
  2. package/dist/client/{117.2e4cb0477da3db1f.js → 117.6c69b6a87751dd18.js} +1 -1
  3. package/dist/client/{253.93deb9e0192e76a5.js → 253.52f62e1bc0e9520a.js} +1 -1
  4. package/dist/client/{404.498d2d9516dd1dce.js → 404.86593f98c9768ed5.js} +1 -1
  5. package/dist/client/{627.fdd60bcc0f3a9cf6.js → 453.fa2d169576262213.js} +1 -1
  6. package/dist/client/{53.774ff07505d521fa.js → 53.567db3ae078650c6.js} +1 -1
  7. package/dist/client/{619.e342b0fa467d39ca.js → 619.01713281e5e951d3.js} +1 -1
  8. package/dist/client/652.69da1598312b3a3f.js +10 -0
  9. package/dist/client/773.648965568ff476f9.js +10 -0
  10. package/dist/client/{981.e0546ffc34afedcd.js → 981.37e7aeecdb1ef6fa.js} +1 -1
  11. package/dist/client/{993.5d04b510835ab0d2.js → 993.ac89f3852990918d.js} +1 -1
  12. package/dist/client/index.js +1 -1
  13. package/dist/client-v2/{117.ccf43ae8631f7d74.js → 117.c982d79ff68738f5.js} +1 -1
  14. package/dist/client-v2/{214.cdf76752053a8990.js → 214.94c4257bf2838577.js} +1 -1
  15. package/dist/client-v2/{253.1198df22f5baf304.js → 253.8e19956d2a44dfb8.js} +1 -1
  16. package/dist/client-v2/{264.78887ff88f969467.js → 264.80e8e358c8c6c2e5.js} +1 -1
  17. package/dist/client-v2/{404.9ba964c28a151c81.js → 404.ab032b79c95dab6f.js} +1 -1
  18. package/dist/client-v2/{41.b28cf7a675a603d1.js → 41.cd5610fcf7446127.js} +1 -1
  19. package/dist/client-v2/{627.e16f4a0dd596c3e6.js → 453.42c6d70628d56cc2.js} +1 -1
  20. package/dist/client-v2/{53.282081f97e4308c6.js → 53.37c08089a648f89a.js} +1 -1
  21. package/dist/client-v2/{619.8c03913873785fb6.js → 619.6e9618550101e819.js} +1 -1
  22. package/dist/client-v2/652.eeba4e0c38367321.js +10 -0
  23. package/dist/client-v2/{70.9166ed70906d041f.js → 70.332698e53eb59677.js} +1 -1
  24. package/dist/client-v2/773.4de2ba5acb07318c.js +10 -0
  25. package/dist/client-v2/981.76060f466e6f7c11.js +10 -0
  26. package/dist/client-v2/{993.ca5b28f1e2b4c1ef.js → 993.f8cdb5172566ce75.js} +1 -1
  27. package/dist/client-v2/index.js +1 -1
  28. package/dist/externalVersion.js +4 -1
  29. package/dist/locale/en-US.json +80 -1
  30. package/dist/locale/vi-VN.json +5 -1
  31. package/dist/locale/zh-CN.json +80 -1
  32. package/dist/node_modules/acorn/LICENSE +21 -0
  33. package/dist/node_modules/acorn/bin/acorn +4 -0
  34. package/dist/node_modules/acorn/dist/acorn.d.mts +857 -0
  35. package/dist/node_modules/acorn/dist/acorn.d.ts +857 -0
  36. package/dist/node_modules/acorn/dist/acorn.js +1 -0
  37. package/dist/node_modules/acorn/dist/bin.js +90 -0
  38. package/dist/node_modules/acorn/package.json +1 -0
  39. package/dist/node_modules/acorn-walk/LICENSE +21 -0
  40. package/dist/node_modules/acorn-walk/dist/walk.d.mts +177 -0
  41. package/dist/node_modules/acorn-walk/dist/walk.d.ts +177 -0
  42. package/dist/node_modules/acorn-walk/dist/walk.js +1 -0
  43. package/dist/node_modules/acorn-walk/node_modules/.bin/acorn +15 -0
  44. package/dist/node_modules/acorn-walk/node_modules/.bin/acorn.cmd +7 -0
  45. package/dist/node_modules/acorn-walk/node_modules/acorn/bin/acorn +4 -0
  46. package/dist/node_modules/acorn-walk/node_modules/acorn/dist/acorn.d.mts +866 -0
  47. package/dist/node_modules/acorn-walk/node_modules/acorn/dist/acorn.d.ts +866 -0
  48. package/dist/node_modules/acorn-walk/node_modules/acorn/dist/acorn.js +6174 -0
  49. package/dist/node_modules/acorn-walk/node_modules/acorn/dist/bin.js +90 -0
  50. package/dist/node_modules/acorn-walk/node_modules/acorn/package.json +50 -0
  51. package/dist/node_modules/acorn-walk/package.json +1 -0
  52. package/dist/node_modules/adm-zip/package.json +1 -1
  53. package/dist/node_modules/ajv/package.json +1 -1
  54. package/dist/node_modules/zod/package.json +1 -1
  55. package/dist/server/collections/agent-auto-approval-checkpoints.js +47 -0
  56. package/dist/server/collections/agent-execution-spans.js +3 -3
  57. package/dist/server/collections/agent-hierarchy-invocations.js +59 -0
  58. package/dist/server/collections/agent-routing-graph-locks.js +40 -0
  59. package/dist/server/collections/agent-session-auto-approvals.js +45 -0
  60. package/dist/server/collections/orchestrator-config.js +17 -0
  61. package/dist/server/migrations/20261119000000-widen-native-employee-identifiers.js +59 -0
  62. package/dist/server/plugin.js +80 -12
  63. package/dist/server/resources/agent-auto-approval.js +80 -0
  64. package/dist/server/resources/hierarchical-routing.js +60 -0
  65. package/dist/server/services/AutoApprovalCheckpoint.js +133 -0
  66. package/dist/server/services/CodeValidator.js +8 -4
  67. package/dist/server/services/GovernanceAdmission.js +60 -0
  68. package/dist/server/services/HarnessCompiler.js +3 -0
  69. package/dist/server/services/HarnessSchema.js +13 -1
  70. package/dist/server/services/HierarchicalAgentRuntime.js +925 -0
  71. package/dist/server/services/HierarchyEnrollmentGuard.js +216 -0
  72. package/dist/server/services/HierarchyInvocationJournal.js +157 -0
  73. package/dist/server/services/HierarchyRequestCancellation.js +150 -0
  74. package/dist/server/services/LoopRunRepository.js +1 -1
  75. package/dist/server/services/LoopRunStateMachine.js +2 -2
  76. package/dist/server/services/LoopWorkerService.js +7 -7
  77. package/dist/server/services/ParallelInterruptActionsPatch.js +132 -0
  78. package/dist/server/services/PluginAiRuntimeAdapter.js +107 -9
  79. package/dist/server/services/RoutingBindingRepository.js +156 -0
  80. package/dist/server/services/RoutingBindingValidation.js +161 -0
  81. package/dist/server/services/SandboxRunner.js +19 -0
  82. package/dist/server/services/SessionAutoApproval.js +173 -0
  83. package/dist/server/services/VerificationService.js +2 -2
  84. package/dist/server/skill-hub/plugin.js +17 -0
  85. package/dist/server/skill-hub/services/RegistrySkillInstallationService.js +2 -2
  86. package/dist/server/skill-hub/services/registry-node-package.js +191 -0
  87. package/dist/server/skill-hub/tasks/SkillExecutionTask.js +21 -6
  88. package/dist/server/tools/skill-execute.js +1 -0
  89. package/dist/server/utils/ensure-indexes.js +1 -0
  90. package/package.json +5 -2
  91. package/src/client/SkillPages.tsx +1 -8
  92. package/src/client/__tests__/embedded-settings.test.tsx +1 -8
  93. package/src/client/plugin.tsx +3 -8
  94. package/src/client/skill-hub/tools/InteractionSchemasProvider.tsx +21 -6
  95. package/src/client/skill-hub/tools/SkillHubCard.tsx +22 -16
  96. package/src/client/skill-hub/tools/__tests__/skill-hub-card.test.tsx +255 -0
  97. package/src/client/skill-hub/tools/registerSkillLoopCards.ts +12 -3
  98. package/src/client-v2/__tests__/embedded-settings.test.tsx +20 -11
  99. package/src/client-v2/__tests__/hierarchical-routing-settings.test.tsx +350 -0
  100. package/src/client-v2/auto-approval/AutoApprovalBridge.tsx +513 -0
  101. package/src/client-v2/auto-approval/AutoApprovalProvider.tsx +399 -0
  102. package/src/client-v2/auto-approval/__tests__/session-auto-approval.test.tsx +1676 -0
  103. package/src/client-v2/components/AgentBindingsTab.tsx +275 -3
  104. package/src/client-v2/components/AgentRunsTab.tsx +1 -8
  105. package/src/client-v2/components/EmployeeGovernanceTab.tsx +1 -8
  106. package/src/client-v2/components/HarnessProfilesTab.tsx +4 -8
  107. package/src/client-v2/components/HarnessSettingsForm.tsx +221 -0
  108. package/src/client-v2/components/UsageGovernanceTab.tsx +1 -8
  109. package/src/client-v2/pages/AgentBindingsPage.tsx +1 -8
  110. package/src/client-v2/pages/ApprovalsPage.tsx +1 -8
  111. package/src/client-v2/pages/EmployeeGovernancePage.tsx +1 -8
  112. package/src/client-v2/pages/ExecutionHistoryPage.tsx +1 -8
  113. package/src/client-v2/pages/HarnessProfilesPage.tsx +1 -8
  114. package/src/client-v2/pages/KnowledgeAccessPage.tsx +1 -8
  115. package/src/client-v2/pages/LoopSettingsPage.tsx +1 -8
  116. package/src/client-v2/pages/MemoryInspectorPage.tsx +1 -8
  117. package/src/client-v2/pages/RetrievalTracePage.tsx +1 -8
  118. package/src/client-v2/pages/RulesPage.tsx +1 -8
  119. package/src/client-v2/pages/SkillDefinitionsPage.tsx +1 -8
  120. package/src/client-v2/pages/SkillMetricsPage.tsx +1 -8
  121. package/src/client-v2/pages/TracingPage.tsx +1 -8
  122. package/src/client-v2/pages/UsageGovernancePage.tsx +1 -8
  123. package/src/client-v2/plugin.tsx +3 -8
  124. package/src/client-v2/skill-hub/tools/__tests__/interactions.test.ts +17 -1
  125. package/src/client-v2/skill-hub/tools/interactions.ts +12 -3
  126. package/src/locale/en-US.json +80 -1
  127. package/src/locale/vi-VN.json +5 -1
  128. package/src/locale/zh-CN.json +80 -1
  129. package/src/server/__tests__/agent-governance.integration.test.ts +1 -8
  130. package/src/server/__tests__/agent-monitor-acl.integration.test.ts +1 -8
  131. package/src/server/__tests__/agent-usage-report.integration.test.ts +1 -8
  132. package/src/server/__tests__/auto-approval-checkpoint.integration.test.ts +295 -0
  133. package/src/server/__tests__/harness-capabilities.test.ts +1 -8
  134. package/src/server/__tests__/harness-compiler.test.ts +64 -0
  135. package/src/server/__tests__/harness-tool-plan.test.ts +1 -8
  136. package/src/server/__tests__/hierarchical-routing.integration.test.ts +2318 -0
  137. package/src/server/__tests__/hierarchy-invocation-journal.integration.test.ts +119 -0
  138. package/src/server/__tests__/loop-approval-decision.test.ts +59 -12
  139. package/src/server/__tests__/loop-budget-service.test.ts +1 -8
  140. package/src/server/__tests__/loop-run-repository.test.ts +1 -8
  141. package/src/server/__tests__/loop-trigger-service.test.ts +1 -8
  142. package/src/server/__tests__/loop-worker-claim.test.ts +46 -9
  143. package/src/server/__tests__/loop-worker-execution.test.ts +1 -8
  144. package/src/server/__tests__/native-agent-monitor-sync.test.ts +1 -8
  145. package/src/server/__tests__/native-hierarchy-probe.integration.test.ts +527 -0
  146. package/src/server/__tests__/native-sub-agent-observer.test.ts +1 -8
  147. package/src/server/__tests__/native-usage-attribution.integration.test.ts +1 -8
  148. package/src/server/__tests__/parallel-interrupt-actions.test.ts +342 -0
  149. package/src/server/__tests__/plugin-ai-runtime-adapter.test.ts +403 -0
  150. package/src/server/__tests__/registry-node-package.test.ts +299 -0
  151. package/src/server/__tests__/routing-binding-graph.integration.test.ts +217 -0
  152. package/src/server/__tests__/routing-binding-validation.test.ts +256 -0
  153. package/src/server/__tests__/session-auto-approval.integration.test.ts +329 -0
  154. package/src/server/__tests__/skill-execute.test.ts +11 -0
  155. package/src/server/__tests__/skill-review-guard.test.ts +171 -0
  156. package/src/server/__tests__/token-tracker.test.ts +1 -8
  157. package/src/server/__tests__/tracing-retention-policy.test.ts +1 -8
  158. package/src/server/__tests__/usage-ledger.integration.test.ts +1 -8
  159. package/src/server/collections/agent-auto-approval-checkpoints.ts +18 -0
  160. package/src/server/collections/agent-execution-spans.ts +4 -11
  161. package/src/server/collections/agent-governance-audit-events.ts +1 -8
  162. package/src/server/collections/agent-governance-policies.ts +1 -8
  163. package/src/server/collections/agent-governance-policy-versions.ts +1 -8
  164. package/src/server/collections/agent-governance-prompt-bindings.ts +1 -8
  165. package/src/server/collections/agent-hierarchy-invocations.ts +30 -0
  166. package/src/server/collections/agent-loop-runs.ts +1 -8
  167. package/src/server/collections/agent-routing-graph-locks.ts +11 -0
  168. package/src/server/collections/agent-session-auto-approvals.ts +16 -0
  169. package/src/server/collections/orchestrator-config.ts +26 -0
  170. package/src/server/migrations/20261110000000-add-usage-pricing-snapshots.ts +1 -8
  171. package/src/server/migrations/20261110010000-add-usage-department-attribution.ts +1 -8
  172. package/src/server/migrations/20261119000000-widen-native-employee-identifiers.ts +37 -0
  173. package/src/server/plugin.ts +72 -8
  174. package/src/server/resources/agent-auto-approval.ts +51 -0
  175. package/src/server/resources/agent-governance.ts +1 -8
  176. package/src/server/resources/agent-harness-profile.ts +1 -8
  177. package/src/server/resources/agent-monitor.ts +1 -8
  178. package/src/server/resources/agent-usage.ts +1 -8
  179. package/src/server/resources/hierarchical-routing.ts +39 -0
  180. package/src/server/resources/native-monitor-format.ts +1 -8
  181. package/src/server/resources/tracing.ts +1 -8
  182. package/src/server/services/AgentGovernanceService.ts +1 -8
  183. package/src/server/services/AutoApprovalCheckpoint.ts +140 -0
  184. package/src/server/services/CodeValidator.ts +23 -4
  185. package/src/server/services/DepartmentAttribution.ts +1 -8
  186. package/src/server/services/ExecutionSpanService.ts +1 -8
  187. package/src/server/services/GovernanceAdmission.ts +83 -8
  188. package/src/server/services/HarnessCapabilities.ts +1 -8
  189. package/src/server/services/HarnessCompiler.ts +12 -0
  190. package/src/server/services/HarnessSchema.ts +30 -0
  191. package/src/server/services/HierarchicalAgentRuntime.ts +1052 -0
  192. package/src/server/services/HierarchyEnrollmentGuard.ts +211 -0
  193. package/src/server/services/HierarchyInvocationJournal.ts +172 -0
  194. package/src/server/services/HierarchyRequestCancellation.ts +132 -0
  195. package/src/server/services/LoopBudgetService.ts +1 -8
  196. package/src/server/services/LoopRunRepository.ts +2 -9
  197. package/src/server/services/LoopRunStateMachine.ts +3 -10
  198. package/src/server/services/LoopTriggerService.ts +1 -8
  199. package/src/server/services/LoopWorkerService.ts +8 -19
  200. package/src/server/services/ManagedPromptProtection.ts +1 -8
  201. package/src/server/services/NativeAgentMonitorSyncService.ts +1 -8
  202. package/src/server/services/NativeSubAgentObserver.ts +1 -8
  203. package/src/server/services/NativeUsageAttribution.ts +1 -8
  204. package/src/server/services/ParallelInterruptActionsPatch.ts +164 -0
  205. package/src/server/services/PluginAiRuntimeAdapter.ts +140 -9
  206. package/src/server/services/RoutingBindingRepository.ts +146 -0
  207. package/src/server/services/RoutingBindingValidation.ts +161 -0
  208. package/src/server/services/SandboxRunner.ts +35 -1
  209. package/src/server/services/SessionAutoApproval.ts +167 -0
  210. package/src/server/services/TokenTracker.ts +1 -8
  211. package/src/server/services/TracingRetentionPolicy.ts +1 -8
  212. package/src/server/services/VerificationService.ts +3 -10
  213. package/src/server/skill-hub/plugin.ts +40 -0
  214. package/src/server/skill-hub/services/RegistrySkillInstallationService.ts +11 -1
  215. package/src/server/skill-hub/services/registry-node-package.ts +191 -0
  216. package/src/server/skill-hub/tasks/SkillExecutionTask.ts +34 -5
  217. package/src/server/tools/skill-execute.ts +10 -0
  218. package/src/server/utils/ensure-indexes.ts +2 -8
  219. package/dist/client/418.6f01da17774a5a25.js +0 -10
  220. package/dist/client/652.477e21bfff67bc1c.js +0 -10
  221. package/dist/client-v2/418.55b6b28cda8bb5f3.js +0 -10
  222. package/dist/client-v2/652.1a48364774d5383a.js +0 -10
  223. package/dist/client-v2/981.a81521f0296c7db8.js +0 -10
@@ -1,11 +1,4 @@
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
- */
1
+ // SPDX-License-Identifier: Apache-2.0
9
2
 
10
3
  import { Plugin } from '@nocobase/server';
11
4
  import type { Context } from '@nocobase/actions';
@@ -21,6 +14,9 @@ import { registerAgentLoopEventsStreamResource } from './resources/agent-loop-ev
21
14
  import { registerAgentKnowledgeInsightsResource } from './resources/agent-knowledge-insights';
22
15
  import { registerAgentGovernanceResource } from './resources/agent-governance';
23
16
  import { registerAgentUsageResource } from './resources/agent-usage';
17
+ import { registerHierarchicalRoutingResource } from './resources/hierarchical-routing';
18
+ import { registerAgentAutoApprovalResource } from './resources/agent-auto-approval';
19
+ import { guardAutoApprovalDecision } from './services/SessionAutoApproval';
24
20
  import SkillHubSubFeature from './skill-hub/plugin';
25
21
  import { NativeSubAgentObserver } from './services/NativeSubAgentObserver';
26
22
  import { NativeAgentMonitorSyncService } from './services/NativeAgentMonitorSyncService';
@@ -42,6 +38,12 @@ import { resolveTracingRetentionDays } from './services/TracingRetentionPolicy';
42
38
  import { createGovernanceAdmission } from './services/GovernanceAdmission';
43
39
  import { installManagedPromptProtection, ManagedPromptError } from './services/ManagedPromptProtection';
44
40
  import { installNativeUsageAttribution } from './services/NativeUsageAttribution';
41
+ import { createHierarchicalAgentTools } from './services/HierarchicalAgentRuntime';
42
+ import { validateRoutingBindingAction } from './services/RoutingBindingValidation';
43
+ import { initializeRoutingGraphLock, RoutingBindingRepository } from './services/RoutingBindingRepository';
44
+ import { guardHierarchyEnrollment, guardManagedChildActions } from './services/HierarchyEnrollmentGuard';
45
+ import { HierarchyRequestCancellation } from './services/HierarchyRequestCancellation';
46
+ import { installParallelInterruptActionsPatch } from './services/ParallelInterruptActionsPatch';
45
47
 
46
48
  function normalizeOptionalString(value: unknown) {
47
49
  return typeof value === 'string' ? value.trim() : '';
@@ -161,6 +163,7 @@ async function validateAgentMemoryContextValues(ctx: any) {
161
163
  }
162
164
 
163
165
  export class PluginAgentOrchestratorServer extends Plugin {
166
+ private readonly hierarchyCancellation = new HierarchyRequestCancellation(this);
164
167
  skillHub: SkillHubSubFeature;
165
168
  registrySkillSnapshotService: RegistrySkillSnapshotService;
166
169
  registrySkillInstallationService: RegistrySkillInstallationService;
@@ -170,6 +173,7 @@ export class PluginAgentOrchestratorServer extends Plugin {
170
173
  private removeNativeMonitorHook?: () => void;
171
174
  private removeManagedPromptProtection?: () => void;
172
175
  private removeNativeUsageAttribution?: () => void;
176
+ private removeParallelInterruptActionsPatch?: () => void;
173
177
  private governanceEnabled = true;
174
178
  loopScheduler: LoopSchedulerService;
175
179
  loopWorker: LoopWorkerService;
@@ -196,6 +200,7 @@ export class PluginAgentOrchestratorServer extends Plugin {
196
200
  }
197
201
 
198
202
  async beforeLoad() {
203
+ this.db.registerRepositories({ RoutingBindingRepository });
199
204
  // Import collection definitions
200
205
  this.db.import({ directory: path.resolve(__dirname, 'collections') });
201
206
 
@@ -218,6 +223,7 @@ export class PluginAgentOrchestratorServer extends Plugin {
218
223
  'agentMonitor:*',
219
224
  'agentUsage:*',
220
225
  'agentGovernance:*',
226
+ 'agentHierarchy:*',
221
227
  'agentKnowledgeInsights:*',
222
228
  'agentMemoryContexts:*',
223
229
  'agentLoopRuns:*',
@@ -257,8 +263,26 @@ export class PluginAgentOrchestratorServer extends Plugin {
257
263
  this.app.acl.allow('agentLoopApprovals', ['list', 'get', 'decide'], 'loggedIn');
258
264
  this.app.acl.allow('agentLoopArtifactsView', ['list', 'get'], 'loggedIn');
259
265
  this.app.acl.allow('agentLoopEventsStream', ['stream'], 'loggedIn');
266
+ this.app.acl.allow('agentAutoApproval', ['get', 'set', 'eligible'], 'loggedIn');
260
267
 
261
268
  this.installGovernanceHooks();
269
+ this.installParallelInterruptActionsFix();
270
+ this.app.resourceManager.use(
271
+ async (ctx, next) => {
272
+ if (
273
+ [
274
+ 'agentHierarchyInvocations',
275
+ 'agentSessionAutoApprovals',
276
+ 'agentAutoApprovalCheckpoints',
277
+ 'agentRoutingGraphLocks',
278
+ ].includes(ctx.action?.resourceName ?? '')
279
+ ) {
280
+ return ctx.throw(403, ctx.t('Hierarchy invocation records are not directly accessible.'));
281
+ }
282
+ return next();
283
+ },
284
+ { tag: 'orchestrator-hierarchy-record-protection', after: 'acl' },
285
+ );
262
286
  this.app.resourceManager.use(
263
287
  async (ctx, next) => {
264
288
  const { resourceName, actionName } = ctx.action || {};
@@ -290,6 +314,27 @@ export class PluginAgentOrchestratorServer extends Plugin {
290
314
  after: 'acl',
291
315
  });
292
316
 
317
+ this.app.resourceManager.use(async (ctx, next) => validateRoutingBindingAction(ctx as Context, next), {
318
+ tag: 'orchestrator-routing-binding-validation',
319
+ after: 'acl',
320
+ });
321
+ this.app.resourceManager.use(async (ctx, next) => guardHierarchyEnrollment(ctx as Context, next), {
322
+ tag: 'orchestrator-hierarchy-enrollment',
323
+ after: 'acl',
324
+ });
325
+ this.app.resourceManager.use(async (ctx, next) => guardManagedChildActions(ctx as Context, next), {
326
+ tag: 'orchestrator-hierarchy-child-protection',
327
+ after: 'orchestrator-hierarchy-enrollment',
328
+ });
329
+ this.app.resourceManager.use(async (ctx, next) => guardAutoApprovalDecision(ctx as Context, next), {
330
+ tag: 'orchestrator-auto-approval-decision',
331
+ after: 'orchestrator-hierarchy-child-protection',
332
+ });
333
+ this.app.resourceManager.use(async (ctx, next) => this.hierarchyCancellation.middleware(ctx as Context, next), {
334
+ tag: 'orchestrator-hierarchy-cancellation',
335
+ after: 'orchestrator-hierarchy-child-protection',
336
+ });
337
+
293
338
  // Data scoping for skillExecutions: a logged-in non-admin user may only
294
339
  // read their own executions. Rows hold inputArgs / stdout / output files,
295
340
  // so an unscoped list/get would leak one user's data to another. Admins
@@ -408,6 +453,7 @@ export class PluginAgentOrchestratorServer extends Plugin {
408
453
  // drives work through the Loop Control Plane (trigger → durable run → worker → verifier).
409
454
  const toolsManager = getAIToolsManager(this.app);
410
455
  toolsManager.registerTools(createExternalRagSearchTool(this));
456
+ toolsManager.registerTools(createHierarchicalAgentTools(this));
411
457
 
412
458
  // --- Loop Control Plane runtime ---
413
459
  const patterns = new LoopPatternService(this.db, employeeHarnessResolver(this), async () =>
@@ -425,6 +471,8 @@ export class PluginAgentOrchestratorServer extends Plugin {
425
471
  registerAgentLoopEventsStreamResource(this);
426
472
  registerAgentHarnessProfileResource(this);
427
473
  registerAgentGovernanceResource(this);
474
+ registerHierarchicalRoutingResource(this);
475
+ registerAgentAutoApprovalResource(this);
428
476
  registerAgentUsageResource(this);
429
477
 
430
478
  // --- Native plugin-ai Monitor Resource ---
@@ -596,24 +644,30 @@ export class PluginAgentOrchestratorServer extends Plugin {
596
644
 
597
645
  async install() {
598
646
  await this.skillHub.install();
647
+ await initializeRoutingGraphLock(this.db);
599
648
  await ensureAgentOrchestratorIndexes(this.db);
600
649
  }
601
650
 
602
651
  async upgrade() {
652
+ await initializeRoutingGraphLock(this.db);
603
653
  await ensureAgentOrchestratorIndexes(this.db);
604
654
  }
605
655
 
606
656
  async afterEnable() {
607
657
  this.governanceEnabled = true;
608
658
  this.installGovernanceHooks();
659
+ this.installParallelInterruptActionsFix();
609
660
  this.installNativeMonitorHook();
610
661
  }
611
662
  async afterDisable() {
612
663
  this.governanceEnabled = false;
664
+ this.hierarchyCancellation.abortAll();
613
665
  this.removeManagedPromptProtection?.();
614
666
  this.removeManagedPromptProtection = undefined;
615
667
  this.removeNativeUsageAttribution?.();
616
668
  this.removeNativeUsageAttribution = undefined;
669
+ this.removeParallelInterruptActionsPatch?.();
670
+ this.removeParallelInterruptActionsPatch = undefined;
617
671
  this.nativeObserver?.uninstall();
618
672
  this.removeNativeMonitorHook?.();
619
673
  this.removeNativeMonitorHook = undefined;
@@ -622,10 +676,13 @@ export class PluginAgentOrchestratorServer extends Plugin {
622
676
 
623
677
  async beforeStop() {
624
678
  this.governanceEnabled = false;
679
+ this.hierarchyCancellation.abortAll();
625
680
  this.removeManagedPromptProtection?.();
626
681
  this.removeManagedPromptProtection = undefined;
627
682
  this.removeNativeUsageAttribution?.();
628
683
  this.removeNativeUsageAttribution = undefined;
684
+ this.removeParallelInterruptActionsPatch?.();
685
+ this.removeParallelInterruptActionsPatch = undefined;
629
686
  this.app.off?.('afterStart', this.installNativeObserver);
630
687
  this.app.removeListener?.('afterStart', this.installNativeObserver);
631
688
  this.app.off?.('afterStart', this.startLoopWorker);
@@ -640,6 +697,7 @@ export class PluginAgentOrchestratorServer extends Plugin {
640
697
  }
641
698
 
642
699
  async handleSyncMessage(message: unknown) {
700
+ this.hierarchyCancellation.handleSyncMessage(message);
643
701
  await this.loopScheduler?.handleSyncMessage(message);
644
702
  await this.loopWorker?.handleSyncMessage(message);
645
703
  }
@@ -654,6 +712,12 @@ export class PluginAgentOrchestratorServer extends Plugin {
654
712
  if (!this.removeNativeUsageAttribution) this.removeNativeUsageAttribution = installNativeUsageAttribution(this);
655
713
  }
656
714
 
715
+ private installParallelInterruptActionsFix() {
716
+ if (!this.removeParallelInterruptActionsPatch) {
717
+ this.removeParallelInterruptActionsPatch = installParallelInterruptActionsPatch();
718
+ }
719
+ }
720
+
657
721
  private installNativeMonitorHook() {
658
722
  if (this.removeNativeMonitorHook || !this.agentRuntimeLifecycle || !this.nativeMonitorSyncService) return;
659
723
  this.removeNativeMonitorHook = this.agentRuntimeLifecycle.registerAfterRunHook('native-monitor', (context) => {
@@ -0,0 +1,51 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import type { Context } from '@nocobase/actions';
3
+ import type { Plugin } from '@nocobase/server';
4
+ import { autoApprovalCall, isAutoApprovalEligible, sessionAutoApprovalEnabled } from '../services/SessionAutoApproval';
5
+ import { valuesFromCtx } from '../utils/ctx-utils';
6
+ import { read } from '../utils/record-utils';
7
+
8
+ async function ownedSession(ctx: Context): Promise<{ ownerId: number; sessionId: string }> {
9
+ const ownerId = Number(ctx.auth?.user?.id);
10
+ if (!Number.isSafeInteger(ownerId) || ownerId <= 0) ctx.throw(401, ctx.t('Authentication is required.'));
11
+ const values = valuesFromCtx(ctx);
12
+ const sessionId = values.sessionId;
13
+ if (typeof sessionId !== 'string' || !sessionId.trim() || sessionId.length > 100) {
14
+ ctx.throw(400, ctx.t('A conversation is required.'));
15
+ }
16
+ const conversation = await ctx.db
17
+ .getRepository('aiConversations')
18
+ .findOne({ filter: { sessionId, userId: ownerId } });
19
+ if (!conversation || read(conversation, 'from') === 'sub-agent') {
20
+ ctx.throw(404, ctx.t('The current conversation is unavailable.'));
21
+ }
22
+ return { ownerId, sessionId };
23
+ }
24
+
25
+ export function registerAgentAutoApprovalResource(plugin: Plugin) {
26
+ plugin.app.resource({
27
+ name: 'agentAutoApproval',
28
+ actions: {
29
+ async get(ctx, next) {
30
+ const { sessionId } = await ownedSession(ctx as Context);
31
+ ctx.body = { enabled: await sessionAutoApprovalEnabled(ctx as Context, sessionId) };
32
+ await next();
33
+ },
34
+ async set(ctx, next) {
35
+ const { ownerId, sessionId } = await ownedSession(ctx as Context);
36
+ const { enabled } = valuesFromCtx(ctx);
37
+ if (typeof enabled !== 'boolean') ctx.throw(400, ctx.t('An auto-approval setting is required.'));
38
+ await ctx.db.getModel('agentSessionAutoApprovals').upsert({ ownerId, sessionId, enabled });
39
+ ctx.body = { enabled };
40
+ await next();
41
+ },
42
+ async eligible(ctx, next) {
43
+ await ownedSession(ctx as Context);
44
+ const call = autoApprovalCall(valuesFromCtx(ctx));
45
+ if (!call) return ctx.throw(400, ctx.t('A tool call is required.'));
46
+ ctx.body = { eligible: await isAutoApprovalEligible(ctx as Context, call) };
47
+ await next();
48
+ },
49
+ },
50
+ });
51
+ }
@@ -1,11 +1,4 @@
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
- */
1
+ // SPDX-License-Identifier: Apache-2.0
9
2
 
10
3
  import type { Context } from '@nocobase/actions';
11
4
  import type { Plugin } from '@nocobase/server';
@@ -1,11 +1,4 @@
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
- */
1
+ // SPDX-License-Identifier: Apache-2.0
9
2
 
10
3
  import type { Plugin } from '@nocobase/server';
11
4
  import type { Context } from '@nocobase/actions';
@@ -1,11 +1,4 @@
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
- */
1
+ // SPDX-License-Identifier: Apache-2.0
9
2
 
10
3
  import type { Plugin } from '@nocobase/server';
11
4
  import { Op, Sequelize } from 'sequelize';
@@ -1,11 +1,4 @@
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
- */
1
+ // SPDX-License-Identifier: Apache-2.0
9
2
 
10
3
  import type { Database } from '@nocobase/database';
11
4
  import type { Plugin } from '@nocobase/server';
@@ -0,0 +1,39 @@
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
+ import type { Context } from '@nocobase/actions';
11
+ import type { Plugin } from '@nocobase/server';
12
+ import { HierarchicalAgentRuntime } from '../services/HierarchicalAgentRuntime';
13
+ import { valuesFromCtx } from '../utils/ctx-utils';
14
+ import { requireAdminActor, throwResourceError } from './resource-helpers';
15
+
16
+ /** Preview uses the requesting administrator's own real session and the runtime's resolver. */
17
+ export function registerHierarchicalRoutingResource(plugin: Plugin) {
18
+ const runtime = new HierarchicalAgentRuntime(plugin);
19
+ plugin.app.resource({
20
+ name: 'agentHierarchy',
21
+ actions: {
22
+ async preview(ctx, next) {
23
+ const values = valuesFromCtx(ctx);
24
+ const username = typeof values.username === 'string' ? values.username.trim() : '';
25
+ const sessionId = typeof values.sessionId === 'string' ? values.sessionId.trim() : '';
26
+ const specialistUsername =
27
+ typeof values.specialistUsername === 'string' ? values.specialistUsername.trim() : '';
28
+ if (!username || !sessionId) ctx.throw(400, ctx.t('A conversation and target employee are required.'));
29
+ try {
30
+ requireAdminActor(ctx as Context);
31
+ ctx.body = { data: await runtime.preview(ctx as Context, username, specialistUsername || undefined) };
32
+ } catch (error) {
33
+ throwResourceError(ctx as Context, error);
34
+ }
35
+ await next();
36
+ },
37
+ },
38
+ });
39
+ }
@@ -1,11 +1,4 @@
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
- */
1
+ // SPDX-License-Identifier: Apache-2.0
9
2
 
10
3
  import { asObject, toPlain } from '../utils/ctx-utils';
11
4
 
@@ -1,11 +1,4 @@
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
- */
1
+ // SPDX-License-Identifier: Apache-2.0
9
2
 
10
3
  import type { Plugin } from '@nocobase/server';
11
4
  import type { Context as ActionContext } from '@nocobase/actions';
@@ -1,11 +1,4 @@
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
- */
1
+ // SPDX-License-Identifier: Apache-2.0
9
2
 
10
3
  import { AsyncLocalStorage } from 'node:async_hooks';
11
4
  import { createHash } from 'node:crypto';
@@ -0,0 +1,140 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { createHash } from 'node:crypto';
3
+ import type { Context } from '@nocobase/actions';
4
+ import { asRecord, read } from '../utils/record-utils';
5
+ import type { AutoApprovalCall } from './SessionAutoApproval';
6
+
7
+ export type AutoApprovalCheckpoint = {
8
+ checkpointKey: string;
9
+ ownerId: number;
10
+ sessionId: string;
11
+ messageId: string;
12
+ interruptId: string;
13
+ callIds: string[];
14
+ };
15
+
16
+ /** Read the checkpoint from a conversation owned by the caller. */
17
+ export async function autoApprovalCheckpoint(
18
+ ctx: Context,
19
+ call: AutoApprovalCall,
20
+ ): Promise<AutoApprovalCheckpoint | null | undefined> {
21
+ const ownerId = Number(ctx.auth?.user?.id);
22
+ if (!Number.isSafeInteger(ownerId) || ownerId <= 0) return undefined;
23
+ const conversation = await ctx.db.getRepository('aiConversations').findOne({
24
+ filter: { sessionId: call.sessionId, userId: ownerId },
25
+ });
26
+ if (!conversation || read(conversation, 'from') === 'sub-agent') return undefined;
27
+ const username = read(conversation, 'aiEmployeeUsername');
28
+ if (typeof username !== 'string' || !username) return undefined;
29
+ const message = await ctx.db.getRepository('aiMessages').findOne({
30
+ filter: { sessionId: call.sessionId, messageId: call.messageId, role: username },
31
+ });
32
+ const calls = read(message, 'toolCalls');
33
+ if (!Array.isArray(calls) || !calls.length) return undefined;
34
+ const callIds = calls.map((item) => asRecord(item).id);
35
+ if (
36
+ call.messageId.length > 100 ||
37
+ callIds.some((id) => typeof id !== 'string' || !id) ||
38
+ new Set(callIds).size !== callIds.length ||
39
+ !callIds.includes(call.toolCallId)
40
+ )
41
+ return undefined;
42
+ const interruptId = asRecord(read(message, 'metadata')).interruptId;
43
+ if (typeof interruptId !== 'string' || !interruptId) return undefined;
44
+ if (callIds.length === 1) return null;
45
+ const checkpointKey = createHash('sha256')
46
+ .update(JSON.stringify([ownerId, call.sessionId, call.messageId, interruptId]))
47
+ .digest('hex');
48
+ return {
49
+ checkpointKey,
50
+ ownerId,
51
+ sessionId: call.sessionId,
52
+ messageId: call.messageId,
53
+ interruptId,
54
+ callIds: callIds as string[],
55
+ };
56
+ }
57
+
58
+ /** Enroll once before an automatic decision reaches the native action. */
59
+ export async function enrollAutoApprovalCheckpoint(ctx: Context, checkpoint: AutoApprovalCheckpoint) {
60
+ const model = ctx.db.getModel('agentAutoApprovalCheckpoints');
61
+ const where = { checkpointKey: checkpoint.checkpointKey };
62
+ if (await model.findOne({ where })) return;
63
+ try {
64
+ await model.create({
65
+ ...where,
66
+ ownerId: checkpoint.ownerId,
67
+ sessionId: checkpoint.sessionId,
68
+ messageId: checkpoint.messageId,
69
+ interruptId: checkpoint.interruptId,
70
+ status: 'pending',
71
+ });
72
+ } catch (error) {
73
+ if (!(error instanceof Error) || error.name !== 'SequelizeUniqueConstraintError') throw error;
74
+ if (!(await model.findOne({ where }))) throw error;
75
+ }
76
+ }
77
+
78
+ /** Native decisions are retained; only one callback may execute frontend tools and resume. */
79
+ export async function coordinateAutoApprovalDecision(
80
+ ctx: Context,
81
+ checkpoint: AutoApprovalCheckpoint,
82
+ call: AutoApprovalCall,
83
+ ) {
84
+ const model = ctx.db.getModel('agentAutoApprovalCheckpoints');
85
+ const where = { checkpointKey: checkpoint.checkpointKey, ownerId: checkpoint.ownerId };
86
+ if (!(await model.findOne({ where }))) return;
87
+ const body = asRecord(ctx.body);
88
+ const originalUpdated = body.updated;
89
+ const calls = Array.isArray(body.toolCalls) ? body.toolCalls.map(asRecord) : [];
90
+ const ids = calls.map((item) => item.id);
91
+ const validSnapshot =
92
+ calls.length === checkpoint.callIds.length &&
93
+ ids.every((id) => typeof id === 'string' && checkpoint.callIds.includes(id)) &&
94
+ new Set(ids).size === ids.length &&
95
+ calls.every((item) => typeof item.willInterrupt === 'boolean');
96
+ const current = await autoApprovalCheckpoint(ctx, call);
97
+ let sameCheckpoint =
98
+ current?.checkpointKey === checkpoint.checkpointKey &&
99
+ current.callIds.length === checkpoint.callIds.length &&
100
+ current.callIds.every((id) => checkpoint.callIds.includes(id));
101
+ const interruptedCalls = calls.filter((item) => item.willInterrupt === true);
102
+ const ready =
103
+ validSnapshot &&
104
+ sameCheckpoint &&
105
+ interruptedCalls.some((item) => item.id === call.toolCallId) &&
106
+ interruptedCalls.every((item) => item.invokeStatus === 'waiting');
107
+ let canFinalize = false;
108
+ if (originalUpdated === 1 && ready) {
109
+ canFinalize = await ctx.db.sequelize.transaction(async (transaction) => {
110
+ const message = await ctx.db.getModel('aiMessages').findOne({
111
+ where: { sessionId: checkpoint.sessionId, messageId: checkpoint.messageId },
112
+ transaction,
113
+ lock: transaction.LOCK.UPDATE,
114
+ });
115
+ const messageCalls = read(message, 'toolCalls');
116
+ const messageIds = Array.isArray(messageCalls) ? messageCalls.map((item) => asRecord(item).id) : [];
117
+ sameCheckpoint =
118
+ asRecord(read(message, 'metadata')).interruptId === checkpoint.interruptId &&
119
+ messageIds.length === checkpoint.callIds.length &&
120
+ messageIds.every((id) => typeof id === 'string' && checkpoint.callIds.includes(id)) &&
121
+ new Set(messageIds).size === messageIds.length;
122
+ if (!sameCheckpoint) return false;
123
+ const [updated] = await model.update(
124
+ { status: 'issued' },
125
+ { where: { ...where, status: 'pending' }, transaction },
126
+ );
127
+ return updated === 1;
128
+ });
129
+ }
130
+ ctx.body = {
131
+ ...body,
132
+ updated: canFinalize ? originalUpdated : 0,
133
+ agentAutoApprovalCheckpoint: {
134
+ interruptId: checkpoint.interruptId,
135
+ decisionRecorded: originalUpdated === 1,
136
+ canFinalize,
137
+ validSnapshot: validSnapshot && sameCheckpoint,
138
+ },
139
+ };
140
+ }
@@ -1,8 +1,21 @@
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
+
1
10
  interface ForbiddenPattern {
2
11
  pattern: RegExp;
3
12
  reason: string;
4
13
  }
5
14
 
15
+ const NODE_ENV_PATTERN = /process\.env(?!\s*\.OUTPUT_DIR)/;
16
+ const REGISTRY_NODE_ENV_PATTERN =
17
+ /process\.env(?!\s*\.OUTPUT_DIR)(?!\s*\.SKILL_INPUT_FILE(?![$\u200C\u200D\p{ID_Continue}\\]))/u;
18
+
6
19
  const DANGEROUS_NODE_PATTERNS: ForbiddenPattern[] = [
7
20
  { pattern: /require\s*\(\s*['"]child_process['"]\s*\)/, reason: 'child_process module not allowed' },
8
21
  { pattern: /require\s*\(\s*['"]cluster['"]\s*\)/, reason: 'cluster module not allowed' },
@@ -15,7 +28,7 @@ const DANGEROUS_NODE_PATTERNS: ForbiddenPattern[] = [
15
28
  { pattern: /require\s*\(\s*['"]inspector['"]\s*\)/, reason: 'inspector module not allowed' },
16
29
  { pattern: /require\s*\(\s*['"]v8['"]\s*\)/, reason: 'v8 module not allowed' },
17
30
  { pattern: /process\.exit/, reason: 'process.exit not allowed' },
18
- { pattern: /process\.env(?!\s*\.OUTPUT_DIR)/, reason: 'process.env access not allowed (use OUTPUT_DIR only)' },
31
+ { pattern: NODE_ENV_PATTERN, reason: 'process.env access not allowed (use OUTPUT_DIR only)' },
19
32
  { pattern: /process\.kill/, reason: 'process.kill not allowed' },
20
33
  { pattern: /process\.binding\s*\(/, reason: 'process.binding not allowed' },
21
34
  { pattern: /\bglobalThis\b/, reason: 'globalThis access not allowed' },
@@ -142,12 +155,18 @@ export class CodeValidator {
142
155
  * Check code against forbidden patterns (dangerous modules/functions).
143
156
  * @throws CodeValidationError if a forbidden pattern is found.
144
157
  */
145
- validate(code: string, language: 'node' | 'python'): void {
158
+ validate(code: string, language: 'node' | 'python', options?: { allowSkillInputFile?: boolean }): void {
146
159
  const patterns = language === 'node' ? DANGEROUS_NODE_PATTERNS : DANGEROUS_PYTHON_PATTERNS;
147
160
 
148
161
  for (const { pattern, reason } of patterns) {
149
- if (pattern.test(code)) {
150
- throw new CodeValidationError(reason, pattern.source);
162
+ const checkedPattern =
163
+ options?.allowSkillInputFile && pattern === NODE_ENV_PATTERN ? REGISTRY_NODE_ENV_PATTERN : pattern;
164
+ if (checkedPattern.test(code)) {
165
+ const message =
166
+ checkedPattern === REGISTRY_NODE_ENV_PATTERN
167
+ ? 'process.env access not allowed (use OUTPUT_DIR or SKILL_INPUT_FILE only)'
168
+ : reason;
169
+ throw new CodeValidationError(message, checkedPattern.source);
151
170
  }
152
171
  }
153
172
  }
@@ -1,11 +1,4 @@
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
- */
1
+ // SPDX-License-Identifier: Apache-2.0
9
2
 
10
3
  import type { Database } from '@nocobase/database';
11
4
  import { literal } from 'sequelize';
@@ -1,11 +1,4 @@
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
- */
1
+ // SPDX-License-Identifier: Apache-2.0
9
2
 
10
3
  import { toPlain } from '../utils/ctx-utils';
11
4
  import { getAgentExecutionContext } from './AgentExecutionContext';