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.
- package/README.md +16 -291
- package/dist/client/AIEmployeesContext.d.ts +7 -0
- package/dist/client/OrchestratorSettings.d.ts +2 -1
- package/dist/client/index.js +1 -1
- package/dist/client/plugin.d.ts +1 -0
- package/dist/client/skill-hub/components/ExecutionHistory.d.ts +2 -0
- package/dist/client/skill-hub/components/ExecutionProgress.d.ts +20 -0
- package/dist/client/skill-hub/components/GitSkillImport.d.ts +7 -0
- package/dist/client/skill-hub/components/SkillEditor.d.ts +7 -0
- package/dist/client/skill-hub/components/SkillManager.d.ts +2 -0
- package/dist/client/skill-hub/components/SkillMetrics.d.ts +2 -0
- package/dist/client/skill-hub/components/SkillTestPanel.d.ts +7 -0
- package/dist/client/skill-hub/index.d.ts +10 -0
- package/dist/client/skill-hub/locale.d.ts +3 -0
- package/dist/client/skill-hub/tools/InteractionSchemasProvider.d.ts +19 -0
- package/dist/client/skill-hub/tools/SkillHubCard.d.ts +3 -0
- package/dist/client/skill-hub/utils/jsonFields.d.ts +3 -0
- package/dist/externalVersion.js +6 -6
- package/dist/node_modules/adm-zip/LICENSE +21 -0
- package/dist/node_modules/adm-zip/adm-zip.js +1 -0
- package/dist/node_modules/adm-zip/headers/entryHeader.js +377 -0
- package/dist/node_modules/adm-zip/headers/index.js +2 -0
- package/dist/node_modules/adm-zip/headers/mainHeader.js +130 -0
- package/dist/node_modules/adm-zip/methods/deflater.js +33 -0
- package/dist/node_modules/adm-zip/methods/index.js +3 -0
- package/dist/node_modules/adm-zip/methods/inflater.js +34 -0
- package/dist/node_modules/adm-zip/methods/zipcrypto.js +175 -0
- package/dist/node_modules/adm-zip/package.json +1 -0
- package/dist/node_modules/adm-zip/util/constants.js +142 -0
- package/dist/node_modules/adm-zip/util/decoder.js +5 -0
- package/dist/node_modules/adm-zip/util/errors.js +63 -0
- package/dist/node_modules/adm-zip/util/fattr.js +76 -0
- package/dist/node_modules/adm-zip/util/index.js +5 -0
- package/dist/node_modules/adm-zip/util/utils.js +339 -0
- package/dist/node_modules/adm-zip/zipEntry.js +405 -0
- package/dist/node_modules/adm-zip/zipFile.js +446 -0
- package/dist/node_modules/simple-git/dist/cjs/index.js +7399 -0
- package/dist/node_modules/simple-git/dist/esm/index.js +4745 -0
- package/dist/node_modules/simple-git/dist/esm/package.json +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/api.d.ts +13 -0
- package/dist/node_modules/simple-git/dist/src/lib/args/log-format.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/errors/git-construct-error.d.ts +15 -0
- package/dist/node_modules/simple-git/dist/src/lib/errors/git-error.d.ts +30 -0
- package/dist/node_modules/simple-git/dist/src/lib/errors/git-plugin-error.d.ts +7 -0
- package/dist/node_modules/simple-git/dist/src/lib/errors/git-response-error.d.ts +32 -0
- package/dist/node_modules/simple-git/dist/src/lib/errors/task-configuration-error.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/git-factory.d.ts +15 -0
- package/dist/node_modules/simple-git/dist/src/lib/git-logger.d.ts +21 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-branch-delete.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-branch.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-commit.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-diff-summary.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-fetch.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-list-log-summary.d.ts +6 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-merge.d.ts +11 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-move.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-pull.d.ts +6 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-push.d.ts +4 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-remote-messages.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-remote-objects.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/abort-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/block-unsafe-operations-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/command-config-prefixing-plugin.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/completion-detection.plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/custom-binary.plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/error-detection.plugin.d.ts +7 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/index.d.ts +11 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/plugin-store.d.ts +11 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/progress-monitor-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/simple-git-plugin.d.ts +48 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/spawn-options-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/suffix-paths.plugin.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/timout-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/BranchDeleteSummary.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/BranchSummary.d.ts +14 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/CheckIgnore.d.ts +4 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/CleanSummary.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/ConfigList.d.ts +13 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/DiffSummary.d.ts +10 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/FileStatusSummary.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/GetRemoteSummary.d.ts +11 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/InitSummary.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/MergeSummary.d.ts +16 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/PullSummary.d.ts +25 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/StatusSummary.d.ts +19 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/TagList.d.ts +7 -0
- package/dist/node_modules/simple-git/dist/src/lib/runners/git-executor-chain.d.ts +25 -0
- package/dist/node_modules/simple-git/dist/src/lib/runners/git-executor.d.ts +14 -0
- package/dist/node_modules/simple-git/dist/src/lib/runners/promise-wrapped.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/runners/scheduler.d.ts +11 -0
- package/dist/node_modules/simple-git/dist/src/lib/runners/tasks-pending-queue.d.ts +23 -0
- package/dist/node_modules/simple-git/dist/src/lib/simple-git-api.d.ts +20 -0
- package/dist/node_modules/simple-git/dist/src/lib/task-callback.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/apply-patch.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/branch.d.ts +7 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/change-working-directory.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/check-ignore.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/check-is-repo.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/checkout.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/clean.d.ts +25 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/clone.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/commit.d.ts +4 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/config.d.ts +8 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/count-objects.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/diff-name-status.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/diff.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/fetch.d.ts +4 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/first-commit.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/grep.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/hash-object.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/init.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/log.d.ts +32 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/merge.d.ts +4 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/move.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/pull.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/push.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/remote.d.ts +8 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/reset.d.ts +11 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/show.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts +4 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/status.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/sub-module.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/tag.d.ts +18 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/task.d.ts +14 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/version.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/types/handlers.d.ts +21 -0
- package/dist/node_modules/simple-git/dist/src/lib/types/index.d.ts +136 -0
- package/dist/node_modules/simple-git/dist/src/lib/types/tasks.d.ts +19 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/argument-filters.d.ts +14 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/exit-codes.d.ts +10 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/git-output-streams.d.ts +7 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/index.d.ts +8 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/line-parser.d.ts +15 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/simple-git-options.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/task-options.d.ts +13 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/task-parser.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/util.d.ts +47 -0
- package/dist/node_modules/simple-git/dist/typings/errors.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/typings/index.d.ts +14 -0
- package/dist/node_modules/simple-git/dist/typings/response.d.ts +556 -0
- package/dist/node_modules/simple-git/dist/typings/simple-git.d.ts +1033 -0
- package/dist/node_modules/simple-git/dist/typings/types.d.ts +22 -0
- package/dist/node_modules/simple-git/node_modules/debug/package.json +64 -0
- package/dist/node_modules/simple-git/node_modules/debug/src/browser.js +272 -0
- package/dist/node_modules/simple-git/node_modules/debug/src/common.js +292 -0
- package/dist/node_modules/simple-git/node_modules/debug/src/index.js +10 -0
- package/dist/node_modules/simple-git/node_modules/debug/src/node.js +263 -0
- package/dist/node_modules/simple-git/package.json +1 -0
- package/dist/node_modules/simple-git/promise.js +17 -0
- package/dist/server/collections/agent-execution-spans.d.ts +9 -0
- package/dist/server/collections/agent-execution-spans.js +152 -0
- package/dist/server/collections/orchestrator-config.js +16 -0
- package/dist/server/collections/orchestrator-logs.js +19 -2
- package/dist/server/collections/skill-definitions.d.ts +3 -0
- package/dist/server/collections/skill-definitions.js +158 -0
- package/dist/server/collections/skill-executions.d.ts +3 -0
- package/dist/server/collections/skill-executions.js +123 -0
- package/dist/server/collections/skill-worker-configs.d.ts +3 -0
- package/dist/server/collections/skill-worker-configs.js +115 -0
- package/dist/server/migrations/20260423000000-add-progress-fields.d.ts +4 -0
- package/dist/server/migrations/20260423000000-add-progress-fields.js +69 -0
- package/dist/server/migrations/20260425000000-add-interaction-schema.d.ts +4 -0
- package/dist/server/migrations/20260425000000-add-interaction-schema.js +61 -0
- package/dist/server/migrations/20260427000000-add-tracing-detail-fields.d.ts +7 -0
- package/dist/server/migrations/20260427000000-add-tracing-detail-fields.js +62 -0
- package/dist/server/migrations/20260427000000-change-packages-to-text.d.ts +4 -0
- package/dist/server/migrations/20260427000000-change-packages-to-text.js +70 -0
- package/dist/server/migrations/20260427000001-change-other-json-to-text.d.ts +4 -0
- package/dist/server/migrations/20260427000001-change-other-json-to-text.js +80 -0
- package/dist/server/migrations/20260429000000-add-llm-fields.d.ts +7 -0
- package/dist/server/migrations/20260429000000-add-llm-fields.js +68 -0
- package/dist/server/migrations/20260429000000-fix-inputargs-json-to-text.d.ts +16 -0
- package/dist/server/migrations/20260429000000-fix-inputargs-json-to-text.js +51 -0
- package/dist/server/migrations/20260503000000-add-orchestrator-trace-fields.d.ts +7 -0
- package/dist/server/migrations/20260503000000-add-orchestrator-trace-fields.js +57 -0
- package/dist/server/plugin.d.ts +3 -0
- package/dist/server/plugin.js +37 -1
- package/dist/server/resources/tracing.js +160 -12
- package/dist/server/services/CodeValidator.d.ts +32 -0
- package/dist/server/services/CodeValidator.js +205 -0
- package/dist/server/services/ExecutionSpanService.d.ts +44 -0
- package/dist/server/services/ExecutionSpanService.js +104 -0
- package/dist/server/services/FileManager.d.ts +28 -0
- package/dist/server/services/FileManager.js +151 -0
- package/dist/server/services/SandboxRunner.d.ts +41 -0
- package/dist/server/services/SandboxRunner.js +167 -0
- package/dist/server/services/SkillManager.d.ts +6 -0
- package/dist/server/services/SkillManager.js +640 -0
- package/dist/server/services/SkillRepositoryService.d.ts +22 -0
- package/dist/server/services/SkillRepositoryService.js +157 -0
- package/dist/server/services/WorkerEnvManager.d.ts +26 -0
- package/dist/server/services/WorkerEnvManager.js +120 -0
- package/dist/server/skill-hub/actions/git-import.d.ts +21 -0
- package/dist/server/skill-hub/actions/git-import.js +413 -0
- package/dist/server/skill-hub/mcp/McpController.d.ts +15 -0
- package/dist/server/skill-hub/mcp/McpController.js +111 -0
- package/dist/server/skill-hub/plugin.d.ts +58 -0
- package/dist/server/skill-hub/plugin.js +694 -0
- package/dist/server/skill-hub/sandbox-config.json +6 -0
- package/dist/server/skill-hub/tasks/SkillExecutionTask.d.ts +14 -0
- package/dist/server/skill-hub/tasks/SkillExecutionTask.js +267 -0
- package/dist/server/skill-hub/utils/json-fields.d.ts +7 -0
- package/dist/server/skill-hub/utils/json-fields.js +88 -0
- package/dist/server/tools/delegate-task.d.ts +4 -0
- package/dist/server/tools/delegate-task.js +832 -119
- package/dist/server/tools/skill-execute.d.ts +36 -0
- package/dist/server/tools/skill-execute.js +167 -0
- package/package.json +3 -1
- package/src/client/AIEmployeeSelect.tsx +1 -3
- package/src/client/AIEmployeesContext.tsx +28 -13
- package/src/client/OrchestratorSettings.tsx +43 -5
- package/src/client/RulesTab.tsx +368 -21
- package/src/client/TracingTab.tsx +316 -102
- package/src/client/plugin.tsx +39 -0
- package/src/client/skill-hub/components/ExecutionHistory.tsx +201 -0
- package/src/client/skill-hub/components/ExecutionProgress.tsx +55 -0
- package/src/client/skill-hub/components/GitSkillImport.tsx +555 -0
- package/src/client/skill-hub/components/SkillEditor.tsx +456 -0
- package/src/client/skill-hub/components/SkillManager.tsx +181 -0
- package/src/client/skill-hub/components/SkillMetrics.tsx +124 -0
- package/src/client/skill-hub/components/SkillTestPanel.tsx +144 -0
- package/src/client/skill-hub/index.tsx +75 -0
- package/src/client/skill-hub/locale.ts +16 -0
- package/src/client/skill-hub/tools/InteractionSchemasProvider.tsx +59 -0
- package/src/client/skill-hub/tools/SkillHubCard.tsx +78 -0
- package/src/client/skill-hub/utils/jsonFields.ts +37 -0
- package/src/server/collections/agent-execution-spans.ts +129 -0
- package/src/server/collections/orchestrator-config.ts +17 -0
- package/src/server/collections/orchestrator-logs.ts +19 -2
- package/src/server/collections/skill-definitions.ts +128 -0
- package/src/server/collections/skill-executions.ts +94 -0
- package/src/server/collections/skill-worker-configs.ts +86 -0
- package/src/server/migrations/20260423000000-add-progress-fields.ts +50 -0
- package/src/server/migrations/20260425000000-add-interaction-schema.ts +35 -0
- package/src/server/migrations/20260427000000-add-tracing-detail-fields.ts +41 -0
- package/src/server/migrations/20260427000000-change-packages-to-text.ts +47 -0
- package/src/server/migrations/20260427000001-change-other-json-to-text.ts +57 -0
- package/src/server/migrations/20260429000000-add-llm-fields.ts +46 -0
- package/src/server/migrations/20260429000000-fix-inputargs-json-to-text.ts +38 -0
- package/src/server/migrations/20260503000000-add-orchestrator-trace-fields.ts +32 -0
- package/src/server/plugin.ts +51 -3
- package/src/server/resources/tracing.ts +187 -16
- package/src/server/services/CodeValidator.ts +159 -0
- package/src/server/services/ExecutionSpanService.ts +106 -0
- package/src/server/services/FileManager.ts +144 -0
- package/src/server/services/SandboxRunner.ts +205 -0
- package/src/server/services/SkillManager.ts +623 -0
- package/src/server/services/SkillRepositoryService.ts +142 -0
- package/src/server/services/WorkerEnvManager.ts +113 -0
- package/src/server/skill-hub/actions/git-import.ts +486 -0
- package/src/server/skill-hub/mcp/McpController.ts +86 -0
- package/src/server/skill-hub/plugin.ts +771 -0
- package/src/server/skill-hub/sandbox-config.json +6 -0
- package/src/server/skill-hub/tasks/SkillExecutionTask.ts +297 -0
- package/src/server/skill-hub/utils/json-fields.ts +57 -0
- package/src/server/tools/delegate-task.ts +1085 -147
- package/src/server/tools/skill-execute.ts +157 -0
package/README.md
CHANGED
|
@@ -1,291 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- Giới hạn số lớp delegation (ví dụ: `maxDepth: 1` = Leader gọi Sub-Agent, Sub-Agent không được gọi tiếp)
|
|
18
|
-
- Ngăn chặn vòng lặp vô hạn (circular delegation) — các tool `delegate_to_*` tự động bị loại khỏi Sub-Agent
|
|
19
|
-
|
|
20
|
-
### ⏱️ Timeout & Abort
|
|
21
|
-
- Mỗi rule cấu hình thời gian chờ tối đa (mặc định 120s)
|
|
22
|
-
- Khi timeout, stream LLM bị hủy ngay lập tức qua `AbortController` — không tốn thêm token
|
|
23
|
-
|
|
24
|
-
### 🛡️ Per-Leader Scoping
|
|
25
|
-
- Chỉ Leader được cấu hình mới có thể gọi Sub-Agent tương ứng
|
|
26
|
-
- Kiểm tra tại thời điểm invoke — không phụ thuộc vào core API
|
|
27
|
-
|
|
28
|
-
### 📊 Swarm Tracing (Giám sát)
|
|
29
|
-
- Ghi log mỗi lần delegation: ai gọi ai, task gì, kết quả ra sao, mất bao lâu
|
|
30
|
-
- Trang admin trực quan để theo dõi và debug multi-agent flows
|
|
31
|
-
|
|
32
|
-
### 🔌 Zero Core Modification
|
|
33
|
-
- Chỉ sử dụng **public APIs** từ `@nocobase/ai` và `@nocobase/plugin-ai`
|
|
34
|
-
- Không import private classes, không patch core code
|
|
35
|
-
- Tương thích NocoBase 2.x — upgrade-safe
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## 📐 Kiến trúc
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
┌──────────────────────────────────────────────────────────┐
|
|
43
|
-
│ User Chat Session │
|
|
44
|
-
│ "Hãy phân tích doanh thu Q4 và tạo báo cáo" │
|
|
45
|
-
└─────────────────────┬────────────────────────────────────┘
|
|
46
|
-
│
|
|
47
|
-
▼
|
|
48
|
-
┌──────────────────────────────────────────────────────────┐
|
|
49
|
-
│ Leader AI Employee (ví dụ: "Project Manager") │
|
|
50
|
-
│ │
|
|
51
|
-
│ Tools available: │
|
|
52
|
-
│ ├── delegate_to_sql_expert ← plugin-agent-orch │
|
|
53
|
-
│ ├── delegate_to_report_writer ← plugin-agent-orch │
|
|
54
|
-
│ └── other_skills ← plugin-ai built-in │
|
|
55
|
-
└────┬─────────────────────┬───────────────────────────────┘
|
|
56
|
-
│ tool_call │ tool_call
|
|
57
|
-
▼ ▼
|
|
58
|
-
┌────────────────┐ ┌─────────────────┐
|
|
59
|
-
│ SQL Expert │ │ Report Writer │
|
|
60
|
-
│ (Sub-Agent) │ │ (Sub-Agent) │
|
|
61
|
-
│ │ │ │
|
|
62
|
-
│ createReact │ │ createReact │
|
|
63
|
-
│ Agent + tools │ │ Agent + tools │
|
|
64
|
-
└───────┬────────┘ └────────┬────────┘
|
|
65
|
-
│ result │ result
|
|
66
|
-
└─────────┬───────────┘
|
|
67
|
-
▼
|
|
68
|
-
┌──────────────────────────────────────────────────────────┐
|
|
69
|
-
│ Leader tổng hợp kết quả → trả lời user │
|
|
70
|
-
└──────────────────────────────────────────────────────────┘
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
## 🚀 Cài đặt & Kích hoạt
|
|
76
|
-
|
|
77
|
-
### Yêu cầu
|
|
78
|
-
- NocoBase `>= 2.0`
|
|
79
|
-
- Plugin `@nocobase/plugin-ai` đã kích hoạt
|
|
80
|
-
- Ít nhất 2 AI Employees đã được tạo (1 Leader, 1+ Sub-Agent)
|
|
81
|
-
|
|
82
|
-
### Bước 1: Cài đặt plugin
|
|
83
|
-
```bash
|
|
84
|
-
# Trong monorepo NocoBase
|
|
85
|
-
yarn build plugin-agent-orchestrator
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Bước 2: Kích hoạt
|
|
89
|
-
Vào **Settings → Plugin Manager** → tìm "Agent Orchestrator" → **Enable**
|
|
90
|
-
|
|
91
|
-
### Bước 3: Cấu hình
|
|
92
|
-
Sau khi kích hoạt, vào **Settings → AI → Agent Orchestrator**
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## 📖 Hướng dẫn sử dụng
|
|
97
|
-
|
|
98
|
-
### Tab 1: Orchestration Rules
|
|
99
|
-
|
|
100
|
-
Đây là nơi cấu hình quan hệ Leader ↔ Sub-Agent.
|
|
101
|
-
|
|
102
|
-
#### Tạo rule mới
|
|
103
|
-
1. Nhấn **New Rule**
|
|
104
|
-
2. Chọn **Leader (Orchestrator)**: AI Employee đóng vai trò điều phối
|
|
105
|
-
3. Chọn **Sub-Agent**: AI Employee sẽ nhận nhiệm vụ được ủy thác
|
|
106
|
-
4. Cấu hình:
|
|
107
|
-
- **Max Delegation Depth**: Độ sâu tối đa (1-3)
|
|
108
|
-
- `1` = Leader gọi Sub-Agent, Sub-Agent chỉ dùng tool của mình
|
|
109
|
-
- `2` = Sub-Agent có thể gọi tiếp Sub-Agent khác (nếu được cấu hình)
|
|
110
|
-
- **Timeout (ms)**: Thời gian chờ tối đa
|
|
111
|
-
- `120000` (2 phút) — khuyến nghị cho tác vụ đơn giản
|
|
112
|
-
- `300000` (5 phút) — cho tác vụ phức tạp
|
|
113
|
-
- **Enabled**: Bật/tắt rule
|
|
114
|
-
5. Nhấn **Save**
|
|
115
|
-
|
|
116
|
-
#### Ví dụ cấu hình
|
|
117
|
-
|
|
118
|
-
| Leader | Sub-Agent | Max Depth | Timeout | Mô tả |
|
|
119
|
-
|--------|-----------|-----------|---------|-------|
|
|
120
|
-
| PM Bot | SQL Expert | 1 | 120s | PM giao truy vấn DB cho SQL Expert |
|
|
121
|
-
| PM Bot | Report Writer | 1 | 300s | PM giao viết báo cáo |
|
|
122
|
-
| PM Bot | Code Reviewer | 1 | 180s | PM giao review code |
|
|
123
|
-
|
|
124
|
-
> **Lưu ý**: Leader và Sub-Agent không được trùng nhau. Một Sub-Agent có thể phục vụ nhiều Leader.
|
|
125
|
-
|
|
126
|
-
### Tab 2: Swarm Tracing
|
|
127
|
-
|
|
128
|
-
Trang giám sát hiển thị log tất cả các lần delegation:
|
|
129
|
-
|
|
130
|
-
| Cột | Mô tả |
|
|
131
|
-
|-----|-------|
|
|
132
|
-
| **Time** | Thời điểm thực thi |
|
|
133
|
-
| **Sub-Agent** | Agent được gọi |
|
|
134
|
-
| **Task** | Mô tả nhiệm vụ |
|
|
135
|
-
| **Status** | ✅ success hoặc ❌ error |
|
|
136
|
-
| **Duration** | Thời gian thực thi |
|
|
137
|
-
| **Depth** | Độ sâu delegation (0 = cấp đầu tiên) |
|
|
138
|
-
|
|
139
|
-
Nhấn **Detail** để xem chi tiết: task gốc, kết quả đầy đủ, lỗi (nếu có).
|
|
140
|
-
|
|
141
|
-
---
|
|
142
|
-
|
|
143
|
-
## 💡 Best Practices
|
|
144
|
-
|
|
145
|
-
### 1. Thiết kế Agent hiệu quả
|
|
146
|
-
|
|
147
|
-
```
|
|
148
|
-
✅ NÊN: Mỗi Sub-Agent chuyên một lĩnh vực rõ ràng
|
|
149
|
-
- "SQL Query Expert" — chỉ chạy truy vấn
|
|
150
|
-
- "Document Writer" — chỉ viết tài liệu
|
|
151
|
-
|
|
152
|
-
❌ KHÔNG NÊN: Sub-Agent làm quá nhiều việc
|
|
153
|
-
- "General Assistant" — quá rộng, Leader không biết khi nào nên gọi
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### 2. System Prompt cho Leader
|
|
157
|
-
|
|
158
|
-
Thêm hướng dẫn trong system prompt của Leader để nó biết khi nào nên delegate:
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
Bạn là Project Manager. Khi nhận yêu cầu:
|
|
162
|
-
- Cần truy vấn database → delegate cho SQL Expert
|
|
163
|
-
- Cần viết báo cáo → delegate cho Report Writer
|
|
164
|
-
- Có thể tự trả lời → trả lời trực tiếp
|
|
165
|
-
|
|
166
|
-
KHÔNG BAO GIỜ tự viết SQL. Luôn delegate cho SQL Expert.
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### 3. Bio/About cho Sub-Agent
|
|
170
|
-
|
|
171
|
-
Viết mô tả rõ ràng trong trường `About` của Sub-Agent — nội dung này được LLM đọc để quyết định có gọi agent đó không:
|
|
172
|
-
|
|
173
|
-
```
|
|
174
|
-
Chuyên gia truy vấn PostgreSQL. Có khả năng:
|
|
175
|
-
- Viết và tối ưu SQL queries
|
|
176
|
-
- Phân tích schema và index
|
|
177
|
-
- Giải thích execution plan
|
|
178
|
-
Không xử lý: tạo báo cáo, viết code ứng dụng.
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### 4. Timeout hợp lý
|
|
182
|
-
|
|
183
|
-
| Loại tác vụ | Timeout khuyến nghị |
|
|
184
|
-
|-------------|---------------------|
|
|
185
|
-
| Truy vấn DB đơn giản | 30s - 60s |
|
|
186
|
-
| Phân tích dữ liệu | 120s |
|
|
187
|
-
| Viết tài liệu dài | 300s |
|
|
188
|
-
| Tác vụ phức tạp + tool calls | 300s - 600s |
|
|
189
|
-
|
|
190
|
-
---
|
|
191
|
-
|
|
192
|
-
## 🔧 Chi tiết kỹ thuật
|
|
193
|
-
|
|
194
|
-
### Collections
|
|
195
|
-
|
|
196
|
-
| Collection | Mục đích |
|
|
197
|
-
|------------|----------|
|
|
198
|
-
| `orchestratorConfig` | Lưu rules Leader ↔ Sub-Agent |
|
|
199
|
-
| `orchestratorLogs` | Lưu log delegation (cho Tracing) |
|
|
200
|
-
|
|
201
|
-
### APIs
|
|
202
|
-
|
|
203
|
-
| Endpoint | Mô tả |
|
|
204
|
-
|----------|-------|
|
|
205
|
-
| `orchestratorConfig:list` | Danh sách rules |
|
|
206
|
-
| `orchestratorConfig:create` | Tạo rule mới |
|
|
207
|
-
| `orchestratorConfig:update` | Cập nhật rule |
|
|
208
|
-
| `orchestratorConfig:destroy` | Xóa rule |
|
|
209
|
-
| `orchestratorTracing:list` | Danh sách log delegation |
|
|
210
|
-
| `orchestratorTracing:get` | Chi tiết một log |
|
|
211
|
-
|
|
212
|
-
### Execution Flow
|
|
213
|
-
|
|
214
|
-
```
|
|
215
|
-
1. Plugin load
|
|
216
|
-
└─ registerDynamicTools() → đăng ký delegate_to_* tools vào core toolsManager
|
|
217
|
-
|
|
218
|
-
2. User chat với Leader
|
|
219
|
-
└─ Leader LLM nhận tool list (bao gồm delegate_to_*)
|
|
220
|
-
└─ LLM quyết định gọi delegate_to_sql_expert({ task: "..." })
|
|
221
|
-
|
|
222
|
-
3. Tool invoke
|
|
223
|
-
├─ Check per-leader scoping (allowedLeaders)
|
|
224
|
-
├─ Check depth limit (ORCHESTRATOR_DEPTH_KEY)
|
|
225
|
-
├─ Resolve LLM model từ Sub-Agent's modelSettings
|
|
226
|
-
├─ Resolve tools từ Sub-Agent's skillSettings
|
|
227
|
-
├─ createReactAgent({ llm, tools })
|
|
228
|
-
├─ executor.stream({ messages: [system, human] }, { signal })
|
|
229
|
-
├─ Collect AI response chunks
|
|
230
|
-
├─ Log to orchestratorLogs
|
|
231
|
-
└─ Return result to Leader
|
|
232
|
-
|
|
233
|
-
4. Leader tổng hợp và trả lời user
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
### Dependencies
|
|
237
|
-
|
|
238
|
-
| Package | Version | Mục đích |
|
|
239
|
-
|---------|---------|----------|
|
|
240
|
-
| `@langchain/core` | ^0.3.0 | DynamicStructuredTool, Messages |
|
|
241
|
-
| `@langchain/langgraph` | ^0.2.0 | createReactAgent |
|
|
242
|
-
| `zod` | ^3.23.0 | Tool schema validation |
|
|
243
|
-
|
|
244
|
-
---
|
|
245
|
-
|
|
246
|
-
## 📁 Cấu trúc project
|
|
247
|
-
|
|
248
|
-
```
|
|
249
|
-
plugin-agent-orchestrator/
|
|
250
|
-
├── package.json
|
|
251
|
-
├── README.md
|
|
252
|
-
├── src/
|
|
253
|
-
│ ├── index.ts
|
|
254
|
-
│ ├── client/
|
|
255
|
-
│ │ ├── index.tsx
|
|
256
|
-
│ │ ├── plugin.tsx # Đăng ký settings page
|
|
257
|
-
│ │ ├── AIEmployeesContext.tsx # Shared context (P3 optimization)
|
|
258
|
-
│ │ ├── AIEmployeeSelect.tsx # Reusable select component
|
|
259
|
-
│ │ ├── OrchestratorSettings.tsx # Main settings page
|
|
260
|
-
│ │ ├── RulesTab.tsx # CRUD rules
|
|
261
|
-
│ │ └── TracingTab.tsx # Tracing dashboard
|
|
262
|
-
│ ├── server/
|
|
263
|
-
│ │ ├── index.ts
|
|
264
|
-
│ │ ├── plugin.ts # Main server plugin
|
|
265
|
-
│ │ ├── collections/
|
|
266
|
-
│ │ │ ├── orchestrator-config.ts
|
|
267
|
-
│ │ │ └── orchestrator-logs.ts
|
|
268
|
-
│ │ ├── resources/
|
|
269
|
-
│ │ │ └── tracing.ts # Custom read-only resource
|
|
270
|
-
│ │ └── tools/
|
|
271
|
-
│ │ └── delegate-task.ts # Core delegation logic
|
|
272
|
-
│ └── locale/
|
|
273
|
-
│ ├── en-US.json
|
|
274
|
-
│ └── vi-VN.json
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
---
|
|
278
|
-
|
|
279
|
-
## ⚠️ Lưu ý quan trọng
|
|
280
|
-
|
|
281
|
-
1. **Không sửa core plugin-ai**: Plugin này hoàn toàn standalone, chỉ dùng public APIs
|
|
282
|
-
2. **Sub-Agent cần có LLM model**: Mỗi Sub-Agent phải được cấu hình `modelSettings` (llmService + model) trong AI Employee settings
|
|
283
|
-
3. **Sub-Agent cần có skills**: Tools/skills được gán cho Sub-Agent trong `skillSettings` sẽ được cấp cho nó khi thực thi delegation
|
|
284
|
-
4. **Circular prevention**: Các tool `delegate_to_*` tự động bị loại khỏi Sub-Agent → Sub-Agent không thể gọi lại Leader
|
|
285
|
-
5. **Log retention**: `orchestratorLogs` tích lũy theo thời gian — cân nhắc cleanup định kỳ cho production
|
|
286
|
-
|
|
287
|
-
---
|
|
288
|
-
|
|
289
|
-
## 📜 License
|
|
290
|
-
|
|
291
|
-
Apache-2.0
|
|
1
|
+
# plugin-agent-orchestrator
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Hierarchical Multi-Agent orchestration for NocoBase AI Employees. Enables Leader agents to delegate tasks to Sub-Agent employees without modifying core plugin-ai.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
- **Hierarchical Delegation**: Allows AI Leader agents to break down complex tasks and assign them to specialized sub-agents.
|
|
8
|
+
- **Seamless Integration**: Plugs directly into the existing AI Employee framework.
|
|
9
|
+
- **Execution Tracking**: Monitor sub-agent task execution and responses within the main chat interface.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
1. Enable the plugin in the NocoBase Plugin Manager.
|
|
13
|
+
2. Navigate to the AI Employee configuration page.
|
|
14
|
+
3. Configure a primary "Leader" agent.
|
|
15
|
+
4. Add available "Sub-Agents" as tools or skills to the Leader agent.
|
|
16
|
+
5. Interact with the Leader agent; it will automatically delegate tasks when necessary.
|
|
@@ -3,15 +3,22 @@ interface AIEmployeeInfo {
|
|
|
3
3
|
username: string;
|
|
4
4
|
nickname: string;
|
|
5
5
|
about?: string;
|
|
6
|
+
skills: string[];
|
|
6
7
|
}
|
|
7
8
|
interface AIEmployeesContextType {
|
|
8
9
|
employees: AIEmployeeInfo[];
|
|
9
10
|
employeeMap: Map<string, string>;
|
|
11
|
+
skillsMap: Map<string, Set<string>>;
|
|
10
12
|
loading: boolean;
|
|
13
|
+
refresh: () => void;
|
|
11
14
|
}
|
|
12
15
|
/**
|
|
13
16
|
* P3 FIX: Shared context provider that fetches aiEmployees once
|
|
14
17
|
* and shares the data across RulesTab, TracingTab, and AIEmployeeSelect.
|
|
18
|
+
*
|
|
19
|
+
* Also exposes each employee's configured skills so RulesTab can warn when
|
|
20
|
+
* a delegation rule exists but the leader hasn't added the corresponding
|
|
21
|
+
* delegate_<leader>_to_<sub> tool to its skillSettings.
|
|
15
22
|
*/
|
|
16
23
|
export declare const AIEmployeesProvider: React.FC<{
|
|
17
24
|
children: React.ReactNode;
|