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
|
@@ -0,0 +1,157 @@
|
|
|
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 __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var SkillRepositoryService_exports = {};
|
|
38
|
+
__export(SkillRepositoryService_exports, {
|
|
39
|
+
SkillRepositoryService: () => SkillRepositoryService
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(SkillRepositoryService_exports);
|
|
42
|
+
var import_fs = require("fs");
|
|
43
|
+
var import_path = require("path");
|
|
44
|
+
var import_adm_zip = __toESM(require("adm-zip"));
|
|
45
|
+
var import_json_fields = require("../skill-hub/utils/json-fields");
|
|
46
|
+
class SkillRepositoryService {
|
|
47
|
+
baseDir;
|
|
48
|
+
constructor(storagePath) {
|
|
49
|
+
this.baseDir = (0, import_path.resolve)(storagePath, "skills");
|
|
50
|
+
if (!(0, import_fs.existsSync)(this.baseDir)) {
|
|
51
|
+
(0, import_fs.mkdirSync)(this.baseDir, { recursive: true });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Extract a zip file to the repository.
|
|
56
|
+
* Returns parsed metadata from SKILL.md / skill.yaml
|
|
57
|
+
*/
|
|
58
|
+
async extractSkillPackage(skillName, zipFilePath) {
|
|
59
|
+
const targetDir = (0, import_path.resolve)(this.baseDir, skillName);
|
|
60
|
+
if ((0, import_fs.existsSync)(targetDir)) {
|
|
61
|
+
(0, import_fs.rmSync)(targetDir, { recursive: true, force: true });
|
|
62
|
+
}
|
|
63
|
+
(0, import_fs.mkdirSync)(targetDir, { recursive: true });
|
|
64
|
+
const zip = new import_adm_zip.default(zipFilePath);
|
|
65
|
+
zip.extractAllTo(targetDir, true);
|
|
66
|
+
return this.readSkillPackage(targetDir);
|
|
67
|
+
}
|
|
68
|
+
getSkillPath(skillName) {
|
|
69
|
+
return (0, import_path.resolve)(this.baseDir, skillName);
|
|
70
|
+
}
|
|
71
|
+
getSkillCode(skillName) {
|
|
72
|
+
const dir = this.getSkillPath(skillName);
|
|
73
|
+
if (!(0, import_fs.existsSync)(dir)) return null;
|
|
74
|
+
return this.getSkillCodeFromDir(dir);
|
|
75
|
+
}
|
|
76
|
+
copySkillPackageTo(skillName, destDir) {
|
|
77
|
+
const srcDir = this.getSkillPath(skillName);
|
|
78
|
+
this.copyDirectoryTo(srcDir, destDir);
|
|
79
|
+
}
|
|
80
|
+
readSkillPackage(packageDir) {
|
|
81
|
+
const rootDir = (0, import_path.resolve)(packageDir);
|
|
82
|
+
if (!(0, import_fs.existsSync)(rootDir)) {
|
|
83
|
+
return {
|
|
84
|
+
path: rootDir,
|
|
85
|
+
metadata: {},
|
|
86
|
+
instructions: "",
|
|
87
|
+
code: null
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
let metadata = {};
|
|
91
|
+
let instructions = "";
|
|
92
|
+
const skillMdPath = (0, import_path.resolve)(rootDir, "SKILL.md");
|
|
93
|
+
if ((0, import_fs.existsSync)(skillMdPath)) {
|
|
94
|
+
const content = (0, import_fs.readFileSync)(skillMdPath, "utf8");
|
|
95
|
+
const parsed = (0, import_json_fields.parseSkillMarkdown)(content);
|
|
96
|
+
metadata = parsed.metadata;
|
|
97
|
+
instructions = parsed.body;
|
|
98
|
+
}
|
|
99
|
+
instructions += this.aggregateOtherMarkdownFiles(rootDir);
|
|
100
|
+
return {
|
|
101
|
+
path: rootDir,
|
|
102
|
+
metadata,
|
|
103
|
+
instructions: instructions.trim(),
|
|
104
|
+
code: this.getSkillCodeFromDir(rootDir)
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
copyDirectoryTo(srcDir, destDir) {
|
|
108
|
+
if (!(0, import_fs.existsSync)(srcDir)) return;
|
|
109
|
+
(0, import_fs.cpSync)(srcDir, destDir, {
|
|
110
|
+
recursive: true,
|
|
111
|
+
force: true,
|
|
112
|
+
filter: (src) => {
|
|
113
|
+
const name = src.split(/[\\/]/).pop();
|
|
114
|
+
return !["node_modules", ".git", "__pycache__"].includes(name || "") && !src.endsWith(".pyc");
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
getSkillCodeFromDir(dir) {
|
|
119
|
+
if ((0, import_fs.existsSync)((0, import_path.resolve)(dir, "index.py"))) {
|
|
120
|
+
return (0, import_fs.readFileSync)((0, import_path.resolve)(dir, "index.py"), "utf8");
|
|
121
|
+
}
|
|
122
|
+
if ((0, import_fs.existsSync)((0, import_path.resolve)(dir, "index.js"))) {
|
|
123
|
+
return (0, import_fs.readFileSync)((0, import_path.resolve)(dir, "index.js"), "utf8");
|
|
124
|
+
}
|
|
125
|
+
if ((0, import_fs.existsSync)((0, import_path.resolve)(dir, "main.py"))) {
|
|
126
|
+
return (0, import_fs.readFileSync)((0, import_path.resolve)(dir, "main.py"), "utf8");
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
aggregateOtherMarkdownFiles(dir, baseDir = dir) {
|
|
131
|
+
let combined = "";
|
|
132
|
+
if (!(0, import_fs.existsSync)(dir)) return combined;
|
|
133
|
+
const items = (0, import_fs.readdirSync)(dir);
|
|
134
|
+
for (const item of items) {
|
|
135
|
+
const fullPath = (0, import_path.resolve)(dir, item);
|
|
136
|
+
const stat = (0, import_fs.statSync)(fullPath);
|
|
137
|
+
if (stat.isDirectory()) {
|
|
138
|
+
if (item !== "node_modules" && item !== ".git") {
|
|
139
|
+
combined += this.aggregateOtherMarkdownFiles(fullPath, baseDir);
|
|
140
|
+
}
|
|
141
|
+
} else if (stat.isFile() && item.toLowerCase().endsWith(".md") && item.toUpperCase() !== "SKILL.md") {
|
|
142
|
+
const relPath = (0, import_path.relative)(baseDir, fullPath);
|
|
143
|
+
const content = (0, import_fs.readFileSync)(fullPath, "utf8");
|
|
144
|
+
combined += `
|
|
145
|
+
|
|
146
|
+
--- Content from ${relPath} ---
|
|
147
|
+
|
|
148
|
+
${content}`;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return combined;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
155
|
+
0 && (module.exports = {
|
|
156
|
+
SkillRepositoryService
|
|
157
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Application from '@nocobase/server';
|
|
2
|
+
import { Database } from '@nocobase/database';
|
|
3
|
+
type WorkerEnvConfig = {
|
|
4
|
+
npmRegistryUrl?: string;
|
|
5
|
+
npmAuthToken?: string;
|
|
6
|
+
pypiIndexUrl?: string;
|
|
7
|
+
pypiTrustedHost?: string;
|
|
8
|
+
aptMirrorUrl?: string;
|
|
9
|
+
aptGpgKeyUrl?: string;
|
|
10
|
+
customPackages?: {
|
|
11
|
+
python?: string[];
|
|
12
|
+
node?: string[];
|
|
13
|
+
apt?: string[];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare class WorkerEnvManager {
|
|
17
|
+
private readonly app;
|
|
18
|
+
private readonly db;
|
|
19
|
+
private readonly storagePath;
|
|
20
|
+
constructor(app: Application, db: Database, storagePath: string);
|
|
21
|
+
getOrCreateConfig(): Promise<any>;
|
|
22
|
+
initEnvironment(config: WorkerEnvConfig): Promise<string>;
|
|
23
|
+
executeInit(payload: WorkerEnvConfig): Promise<void>;
|
|
24
|
+
parsePackageWhitelist(config: any): Record<"node" | "python" | "apt", string[]>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
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 WorkerEnvManager_exports = {};
|
|
28
|
+
__export(WorkerEnvManager_exports, {
|
|
29
|
+
WorkerEnvManager: () => WorkerEnvManager
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(WorkerEnvManager_exports);
|
|
32
|
+
var import_json_fields = require("../skill-hub/utils/json-fields");
|
|
33
|
+
const DEFAULT_WHITELIST = {
|
|
34
|
+
python: [
|
|
35
|
+
"python-docx",
|
|
36
|
+
"openpyxl",
|
|
37
|
+
"pandas",
|
|
38
|
+
"matplotlib",
|
|
39
|
+
"Pillow",
|
|
40
|
+
"reportlab",
|
|
41
|
+
"jinja2",
|
|
42
|
+
"pyyaml",
|
|
43
|
+
"tabulate",
|
|
44
|
+
"xlsxwriter",
|
|
45
|
+
"python-pptx"
|
|
46
|
+
],
|
|
47
|
+
node: ["xlsx", "docx", "pdfkit", "csv-parse", "archiver", "sharp", "lodash", "dayjs"],
|
|
48
|
+
apt: ["python3", "python3-pip", "python3-venv"]
|
|
49
|
+
};
|
|
50
|
+
class WorkerEnvManager {
|
|
51
|
+
constructor(app, db, storagePath) {
|
|
52
|
+
this.app = app;
|
|
53
|
+
this.db = db;
|
|
54
|
+
this.storagePath = storagePath;
|
|
55
|
+
}
|
|
56
|
+
async getOrCreateConfig() {
|
|
57
|
+
const repo = this.db.getRepository("skillWorkerConfigs");
|
|
58
|
+
let config = await repo.findOne();
|
|
59
|
+
if (config) return config;
|
|
60
|
+
config = await repo.create({
|
|
61
|
+
values: {
|
|
62
|
+
retentionHours: 24,
|
|
63
|
+
initStatus: "idle",
|
|
64
|
+
initProgressPercent: 0,
|
|
65
|
+
packageWhitelist: (0, import_json_fields.stringifyJsonText)(DEFAULT_WHITELIST, DEFAULT_WHITELIST),
|
|
66
|
+
customPackages: (0, import_json_fields.stringifyJsonText)({ python: [], node: [], apt: [] }, { python: [], node: [], apt: [] })
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return config;
|
|
70
|
+
}
|
|
71
|
+
async initEnvironment(config) {
|
|
72
|
+
const current = await this.getOrCreateConfig();
|
|
73
|
+
await current.update({
|
|
74
|
+
initStatus: "running",
|
|
75
|
+
initProgressPercent: 0,
|
|
76
|
+
initProgressLog: "Queued sandbox environment refresh",
|
|
77
|
+
lastInitLog: "",
|
|
78
|
+
customPackages: (0, import_json_fields.stringifyJsonText)(config.customPackages || { python: [], node: [], apt: [] }, {
|
|
79
|
+
python: [],
|
|
80
|
+
node: [],
|
|
81
|
+
apt: []
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
await this.app.pubSubManager.publish("skill-hub.init-env", {
|
|
85
|
+
...config,
|
|
86
|
+
storagePath: this.storagePath,
|
|
87
|
+
queuedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
88
|
+
});
|
|
89
|
+
return "Sandbox environment refresh queued on available workers.";
|
|
90
|
+
}
|
|
91
|
+
async executeInit(payload) {
|
|
92
|
+
const customPackages = payload.customPackages || { python: [], node: [], apt: [] };
|
|
93
|
+
const whitelist = {
|
|
94
|
+
python: Array.from(/* @__PURE__ */ new Set([...DEFAULT_WHITELIST.python || [], ...customPackages.python || []])),
|
|
95
|
+
node: Array.from(/* @__PURE__ */ new Set([...DEFAULT_WHITELIST.node || [], ...customPackages.node || []])),
|
|
96
|
+
apt: Array.from(/* @__PURE__ */ new Set([...DEFAULT_WHITELIST.apt || [], ...customPackages.apt || []]))
|
|
97
|
+
};
|
|
98
|
+
await this.app.pubSubManager.publish("skill-hub.init-env.progress", {
|
|
99
|
+
percent: 25,
|
|
100
|
+
log: "Resolved sandbox package whitelist"
|
|
101
|
+
});
|
|
102
|
+
await this.app.pubSubManager.publish("skill-hub.init-env.progress", {
|
|
103
|
+
percent: 75,
|
|
104
|
+
log: "Sandbox runtime uses the local worker environment"
|
|
105
|
+
});
|
|
106
|
+
await this.app.pubSubManager.publish("skill-hub.init-env.done", {
|
|
107
|
+
status: "succeeded",
|
|
108
|
+
log: "Sandbox environment is ready on this worker. Package installation is managed by the worker image/runtime; whitelist was refreshed.",
|
|
109
|
+
whitelist
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
parsePackageWhitelist(config) {
|
|
113
|
+
var _a;
|
|
114
|
+
return (0, import_json_fields.parseJsonText)(((_a = config == null ? void 0 : config.get) == null ? void 0 : _a.call(config, "packageWhitelist")) ?? (config == null ? void 0 : config.packageWhitelist), DEFAULT_WHITELIST);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
WorkerEnvManager
|
|
120
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Context } from '@nocobase/actions';
|
|
2
|
+
/**
|
|
3
|
+
* Git integration actions for skill-hub.
|
|
4
|
+
*
|
|
5
|
+
* Supported manifest shape:
|
|
6
|
+
* {
|
|
7
|
+
* "skills": [
|
|
8
|
+
* { "folder": "my-skill", "name": "my-skill", "language": "python" },
|
|
9
|
+
* { "name": "pptx-advanced-export", "storageType": "plugin", "pluginSource": "pptx-advanced-export" }
|
|
10
|
+
* ]
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export declare function gitListSkills(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Sync selected skills from git into skillDefinitions.
|
|
16
|
+
*
|
|
17
|
+
* Code is optional. Regular git skills may provide code via codeTemplate,
|
|
18
|
+
* codeFile, or conventional files under skills/<folder>. Plugin skills only
|
|
19
|
+
* need storageType=plugin and pluginSource.
|
|
20
|
+
*/
|
|
21
|
+
export declare function gitSyncSkills(ctx: Context, next: () => Promise<void>): Promise<void>;
|