plugin-agent-orchestrator 1.0.17 → 1.0.18
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/dist/client/AIEmployeeSelect.d.ts +11 -0
- package/dist/client/AIEmployeesContext.d.ts +30 -0
- package/dist/client/AgentRunsTab.d.ts +2 -0
- package/dist/client/HarnessProfilesTab.d.ts +2 -0
- package/dist/client/OrchestratorSettings.d.ts +3 -0
- package/dist/client/RulesTab.d.ts +2 -0
- package/dist/client/TracingTab.d.ts +2 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +1 -1
- package/dist/client/plugin.d.ts +6 -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/LoopSettings.d.ts +2 -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 +11 -0
- package/dist/client/skill-hub/locale.d.ts +3 -0
- package/dist/client/skill-hub/tools/InteractionSchemasProvider.d.ts +6 -0
- package/dist/client/skill-hub/tools/SkillHubCard.d.ts +3 -0
- package/dist/client/skill-hub/tools/loopTemplates.d.ts +22 -0
- package/dist/client/skill-hub/tools/registerSkillLoopCards.d.ts +1 -0
- package/dist/client/skill-hub/utils/jsonFields.d.ts +3 -0
- package/dist/client/tools/PlanApprovalCard.d.ts +3 -0
- package/dist/client/tools/registerOrchestratorCards.d.ts +1 -0
- package/dist/externalVersion.js +6 -6
- package/dist/index.d.ts +2 -0
- package/dist/server/collections/agent-execution-spans.d.ts +9 -0
- package/dist/server/collections/agent-harness-profiles.d.ts +2 -0
- package/dist/server/collections/agent-harness-profiles.js +89 -0
- package/dist/server/collections/agent-loop-events.d.ts +2 -0
- package/dist/server/collections/agent-loop-events.js +101 -0
- package/dist/server/collections/agent-loop-runs.d.ts +2 -0
- package/dist/server/collections/agent-loop-runs.js +188 -0
- package/dist/server/collections/agent-loop-steps.d.ts +2 -0
- package/dist/server/collections/agent-loop-steps.js +174 -0
- package/dist/server/collections/orchestrator-config.d.ts +2 -0
- package/dist/server/collections/orchestrator-config.js +7 -0
- package/dist/server/collections/orchestrator-logs.d.ts +8 -0
- package/dist/server/collections/skill-definitions.d.ts +3 -0
- package/dist/server/collections/skill-executions.d.ts +3 -0
- package/dist/server/collections/skill-executions.js +12 -0
- package/dist/server/collections/skill-loop-configs.d.ts +3 -0
- package/dist/server/collections/skill-loop-configs.js +94 -0
- package/dist/server/collections/skill-worker-configs.d.ts +3 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/migrations/20260423000000-add-progress-fields.d.ts +4 -0
- package/dist/server/migrations/20260425000000-add-interaction-schema.d.ts +4 -0
- package/dist/server/migrations/20260427000000-add-tracing-detail-fields.d.ts +7 -0
- package/dist/server/migrations/20260427000000-change-packages-to-text.d.ts +4 -0
- package/dist/server/migrations/20260427000001-change-other-json-to-text.d.ts +4 -0
- package/dist/server/migrations/20260429000000-add-llm-fields.d.ts +7 -0
- package/dist/server/migrations/20260429000000-fix-inputargs-json-to-text.d.ts +16 -0
- package/dist/server/migrations/20260503000000-add-orchestrator-trace-fields.d.ts +7 -0
- package/dist/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.d.ts +7 -0
- package/dist/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.js +55 -0
- package/dist/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.d.ts +12 -0
- package/dist/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.js +162 -0
- package/dist/server/plugin.d.ts +16 -0
- package/dist/server/plugin.js +13 -0
- package/dist/server/resources/agent-loop.d.ts +3 -0
- package/dist/server/resources/agent-loop.js +205 -0
- package/dist/server/resources/tracing.d.ts +7 -0
- package/dist/server/services/AgentHarness.d.ts +42 -0
- package/dist/server/services/AgentHarness.js +565 -0
- package/dist/server/services/AgentLoopController.d.ts +205 -0
- package/dist/server/services/AgentLoopController.js +940 -0
- package/dist/server/services/AgentLoopRepository.d.ts +20 -0
- package/dist/server/services/AgentLoopRepository.js +210 -0
- package/dist/server/services/AgentLoopService.d.ts +149 -0
- package/dist/server/services/AgentLoopService.js +133 -0
- package/dist/server/services/AgentPlanValidator.d.ts +4 -0
- package/dist/server/services/AgentPlanValidator.js +99 -0
- package/dist/server/services/AgentPlannerService.d.ts +8 -0
- package/dist/server/services/AgentPlannerService.js +119 -0
- package/dist/server/services/AgentRegistryService.d.ts +13 -0
- package/dist/server/services/AgentRegistryService.js +178 -0
- package/dist/server/services/CodeValidator.d.ts +32 -0
- package/dist/server/services/ExecutionSpanService.d.ts +46 -0
- package/dist/server/services/FileManager.d.ts +28 -0
- package/dist/server/services/SandboxRunner.d.ts +41 -0
- package/dist/server/services/SkillManager.d.ts +6 -0
- package/dist/server/services/SkillRepositoryService.d.ts +22 -0
- package/dist/server/services/WorkerEnvManager.d.ts +26 -0
- package/dist/server/skill-hub/actions/git-import.d.ts +21 -0
- package/dist/server/skill-hub/mcp/McpController.d.ts +15 -0
- package/dist/server/skill-hub/plugin.d.ts +61 -0
- package/dist/server/skill-hub/plugin.js +137 -54
- package/dist/server/skill-hub/tasks/SkillExecutionTask.d.ts +16 -0
- package/dist/server/skill-hub/utils/json-fields.d.ts +7 -0
- package/dist/server/tools/agent-loop.d.ts +235 -0
- package/dist/server/tools/agent-loop.js +406 -0
- package/dist/server/tools/delegate-task.d.ts +19 -0
- package/dist/server/tools/delegate-task.js +19 -368
- package/dist/server/tools/external-rag-search.d.ts +42 -0
- package/dist/server/tools/orchestrator-plan.d.ts +205 -0
- package/dist/server/tools/orchestrator-plan.js +291 -0
- package/dist/server/tools/skill-execute.d.ts +36 -0
- package/dist/server/tools/skill-execute.js +2 -0
- package/package.json +1 -1
- package/src/client/AgentRunsTab.tsx +764 -0
- package/src/client/HarnessProfilesTab.tsx +247 -0
- package/src/client/OrchestratorSettings.tsx +40 -2
- package/src/client/RulesTab.tsx +103 -6
- package/src/client/plugin.tsx +27 -54
- package/src/client/skill-hub/components/LoopSettings.tsx +331 -0
- package/src/client/skill-hub/index.tsx +51 -75
- package/src/client/skill-hub/tools/InteractionSchemasProvider.tsx +56 -16
- package/src/client/skill-hub/tools/SkillHubCard.tsx +35 -4
- package/src/client/skill-hub/tools/loopTemplates.ts +52 -0
- package/src/client/skill-hub/tools/registerSkillLoopCards.ts +58 -0
- package/src/client/tools/PlanApprovalCard.tsx +175 -0
- package/src/client/tools/registerOrchestratorCards.ts +7 -0
- package/src/server/collections/agent-harness-profiles.ts +59 -0
- package/src/server/collections/agent-loop-events.ts +71 -0
- package/src/server/collections/agent-loop-runs.ts +158 -0
- package/src/server/collections/agent-loop-steps.ts +144 -0
- package/src/server/collections/orchestrator-config.ts +7 -0
- package/src/server/collections/skill-executions.ts +63 -51
- package/src/server/collections/skill-loop-configs.ts +65 -0
- package/src/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.ts +30 -0
- package/src/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.ts +142 -0
- package/src/server/plugin.ts +15 -0
- package/src/server/resources/agent-loop.ts +183 -0
- package/src/server/services/AgentHarness.ts +663 -0
- package/src/server/services/AgentLoopController.ts +1128 -0
- package/src/server/services/AgentLoopRepository.ts +194 -0
- package/src/server/services/AgentLoopService.ts +161 -0
- package/src/server/services/AgentPlanValidator.ts +73 -0
- package/src/server/services/AgentPlannerService.ts +93 -0
- package/src/server/services/AgentRegistryService.ts +169 -0
- package/src/server/services/ExecutionSpanService.ts +2 -0
- package/src/server/skill-hub/plugin.ts +881 -771
- package/src/server/tools/agent-loop.ts +399 -0
- package/src/server/tools/delegate-task.ts +23 -485
- package/src/server/tools/orchestrator-plan.ts +279 -0
- package/src/server/tools/skill-execute.ts +68 -64
|
@@ -0,0 +1,174 @@
|
|
|
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 agent_loop_steps_exports = {};
|
|
28
|
+
__export(agent_loop_steps_exports, {
|
|
29
|
+
default: () => agent_loop_steps_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(agent_loop_steps_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var agent_loop_steps_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "agentLoopSteps",
|
|
35
|
+
title: "Agent Loop Steps",
|
|
36
|
+
fields: [
|
|
37
|
+
{
|
|
38
|
+
name: "id",
|
|
39
|
+
type: "bigInt",
|
|
40
|
+
autoIncrement: true,
|
|
41
|
+
primaryKey: true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "run",
|
|
45
|
+
type: "belongsTo",
|
|
46
|
+
target: "agentLoopRuns",
|
|
47
|
+
foreignKey: "runId"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "parentStep",
|
|
51
|
+
type: "belongsTo",
|
|
52
|
+
target: "agentLoopSteps",
|
|
53
|
+
foreignKey: "parentStepId"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "planKey",
|
|
57
|
+
type: "string",
|
|
58
|
+
length: 100
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "index",
|
|
62
|
+
type: "integer",
|
|
63
|
+
defaultValue: 0
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "title",
|
|
67
|
+
type: "string",
|
|
68
|
+
length: 500
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "description",
|
|
72
|
+
type: "text"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "type",
|
|
76
|
+
type: "string",
|
|
77
|
+
length: 30,
|
|
78
|
+
comment: "reasoning, skill, tool, sub_agent, verification"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "target",
|
|
82
|
+
type: "string",
|
|
83
|
+
length: 200
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "input",
|
|
87
|
+
type: "json",
|
|
88
|
+
defaultValue: {}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "output",
|
|
92
|
+
type: "json",
|
|
93
|
+
defaultValue: {}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "status",
|
|
97
|
+
type: "string",
|
|
98
|
+
length: 30,
|
|
99
|
+
defaultValue: "pending",
|
|
100
|
+
comment: "pending, running, waiting_user, succeeded, failed, skipped"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "attempt",
|
|
104
|
+
type: "integer",
|
|
105
|
+
defaultValue: 0
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "maxAttempts",
|
|
109
|
+
type: "integer",
|
|
110
|
+
defaultValue: 2
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "dependsOn",
|
|
114
|
+
type: "json",
|
|
115
|
+
defaultValue: []
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: "dependencyPolicy",
|
|
119
|
+
type: "string",
|
|
120
|
+
length: 30,
|
|
121
|
+
defaultValue: "require_success",
|
|
122
|
+
comment: "require_success or allow_skipped"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "approval",
|
|
126
|
+
type: "json",
|
|
127
|
+
defaultValue: {}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "error",
|
|
131
|
+
type: "text"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: "agentExecutionSpanId",
|
|
135
|
+
type: "bigInt"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "skillExecutionId",
|
|
139
|
+
type: "bigInt"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "metadata",
|
|
143
|
+
type: "json",
|
|
144
|
+
defaultValue: {}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "startedAt",
|
|
148
|
+
type: "date"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "endedAt",
|
|
152
|
+
type: "date"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "createdAt",
|
|
156
|
+
type: "date"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "updatedAt",
|
|
160
|
+
type: "date"
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
indexes: [
|
|
164
|
+
{
|
|
165
|
+
fields: ["runId"]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
fields: ["status"]
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
fields: ["planKey"]
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
});
|
|
@@ -75,6 +75,13 @@ var orchestrator_config_default = (0, import_database.defineCollection)({
|
|
|
75
75
|
defaultValue: 50,
|
|
76
76
|
comment: "Max LangGraph reasoning steps (tool-call + LLM-step iterations) per delegation. Lower = safer; higher = more complex multi-step tasks. Default 50."
|
|
77
77
|
},
|
|
78
|
+
{
|
|
79
|
+
name: "harnessTag",
|
|
80
|
+
type: "string",
|
|
81
|
+
length: 100,
|
|
82
|
+
defaultValue: "default",
|
|
83
|
+
comment: "Harness profile tag used by the orchestrator controller and approval flow."
|
|
84
|
+
},
|
|
78
85
|
{
|
|
79
86
|
name: "llmService",
|
|
80
87
|
type: "string",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stores delegation execution logs for Swarm Tracing (Phase 5).
|
|
3
|
+
*
|
|
4
|
+
* Since createReactAgent doesn't create aiConversation records,
|
|
5
|
+
* we log delegation events to a dedicated table for observability.
|
|
6
|
+
*/
|
|
7
|
+
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
8
|
+
export default _default;
|
|
@@ -109,6 +109,18 @@ var skill_executions_default = {
|
|
|
109
109
|
length: 100,
|
|
110
110
|
allowNull: true
|
|
111
111
|
},
|
|
112
|
+
{
|
|
113
|
+
name: "agentLoopRunId",
|
|
114
|
+
type: "string",
|
|
115
|
+
length: 100,
|
|
116
|
+
allowNull: true
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "agentLoopStepId",
|
|
120
|
+
type: "string",
|
|
121
|
+
length: 100,
|
|
122
|
+
allowNull: true
|
|
123
|
+
},
|
|
112
124
|
{
|
|
113
125
|
name: "triggeredBy",
|
|
114
126
|
type: "belongsTo",
|
|
@@ -0,0 +1,94 @@
|
|
|
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 skill_loop_configs_exports = {};
|
|
28
|
+
__export(skill_loop_configs_exports, {
|
|
29
|
+
default: () => skill_loop_configs_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(skill_loop_configs_exports);
|
|
32
|
+
var skill_loop_configs_default = {
|
|
33
|
+
name: "skillLoopConfigs",
|
|
34
|
+
title: "Skill Loop Configs",
|
|
35
|
+
fields: [
|
|
36
|
+
{
|
|
37
|
+
name: "id",
|
|
38
|
+
type: "bigInt",
|
|
39
|
+
autoIncrement: true,
|
|
40
|
+
primaryKey: true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "skill",
|
|
44
|
+
type: "belongsTo",
|
|
45
|
+
target: "skillDefinitions",
|
|
46
|
+
foreignKey: "skillId"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "enabled",
|
|
50
|
+
type: "boolean",
|
|
51
|
+
defaultValue: true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "title",
|
|
55
|
+
type: "string",
|
|
56
|
+
length: 200
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "templateKey",
|
|
60
|
+
type: "string",
|
|
61
|
+
length: 80,
|
|
62
|
+
defaultValue: "confirm"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "prompt",
|
|
66
|
+
type: "text"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
// Resolved interaction schema consumed by the generic Skill Hub UI card.
|
|
70
|
+
name: "schema",
|
|
71
|
+
type: "text"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
// Optional template-specific state for future loop renderers.
|
|
75
|
+
name: "config",
|
|
76
|
+
type: "text",
|
|
77
|
+
defaultValue: null
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "createdAt",
|
|
81
|
+
type: "date"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "updatedAt",
|
|
85
|
+
type: "date"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "createdBy",
|
|
89
|
+
type: "belongsTo",
|
|
90
|
+
target: "users",
|
|
91
|
+
foreignKey: "createdById"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Migration } from '@nocobase/server';
|
|
2
|
+
/**
|
|
3
|
+
* Fix: inputArgs column in skillExecutions was json type but should be text.
|
|
4
|
+
*
|
|
5
|
+
* Root cause: The column was created as `json` from an older schema version,
|
|
6
|
+
* but the collection defines it as `text`. The `stringifyJsonText()` utility
|
|
7
|
+
* wraps values in markdown code fences (```json\n...\n```) which PostgreSQL
|
|
8
|
+
* rejects as invalid JSON syntax, causing SequelizeDatabaseError on every
|
|
9
|
+
* skill execution attempt.
|
|
10
|
+
*/
|
|
11
|
+
export default class FixInputArgsJsonToText extends Migration {
|
|
12
|
+
on: string;
|
|
13
|
+
appVersion: string;
|
|
14
|
+
up(): Promise<void>;
|
|
15
|
+
down(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var add_agent_loop_fields_to_skill_executions_exports = {};
|
|
28
|
+
__export(add_agent_loop_fields_to_skill_executions_exports, {
|
|
29
|
+
default: () => AddAgentLoopFieldsToSkillExecutions
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(add_agent_loop_fields_to_skill_executions_exports);
|
|
32
|
+
var import_server = require("@nocobase/server");
|
|
33
|
+
class AddAgentLoopFieldsToSkillExecutions extends import_server.Migration {
|
|
34
|
+
on = "afterLoad";
|
|
35
|
+
appVersion = ">=0.1.0";
|
|
36
|
+
async up() {
|
|
37
|
+
const queryInterface = this.db.sequelize.getQueryInterface();
|
|
38
|
+
const tablePrefix = this.db.options.tablePrefix || "";
|
|
39
|
+
const tableName = `${tablePrefix}skillExecutions`;
|
|
40
|
+
const tableExists = await queryInterface.tableExists(tableName).catch(() => false);
|
|
41
|
+
if (!tableExists) return;
|
|
42
|
+
const tableDesc = await queryInterface.describeTable(tableName);
|
|
43
|
+
const addIfMissing = async (name) => {
|
|
44
|
+
if (tableDesc[name]) return;
|
|
45
|
+
await queryInterface.addColumn(tableName, name, {
|
|
46
|
+
type: "VARCHAR(100)",
|
|
47
|
+
allowNull: true
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
await addIfMissing("agentLoopRunId");
|
|
51
|
+
await addIfMissing("agentLoopStepId");
|
|
52
|
+
}
|
|
53
|
+
async down() {
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Migration } from '@nocobase/server';
|
|
2
|
+
export default class AddPlanApprovalAndHarnessProfiles extends Migration {
|
|
3
|
+
on: string;
|
|
4
|
+
appVersion: string;
|
|
5
|
+
up(): Promise<void>;
|
|
6
|
+
addRunColumns(queryInterface: any, tableName: string): Promise<void>;
|
|
7
|
+
addStepColumns(queryInterface: any, tableName: string): Promise<void>;
|
|
8
|
+
addConfigColumns(queryInterface: any, tableName: string): Promise<void>;
|
|
9
|
+
ensureHarnessProfiles(queryInterface: any, tableName: string): Promise<void>;
|
|
10
|
+
seedDefaultProfiles(): Promise<void>;
|
|
11
|
+
down(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var add_plan_approval_and_harness_profiles_exports = {};
|
|
28
|
+
__export(add_plan_approval_and_harness_profiles_exports, {
|
|
29
|
+
default: () => AddPlanApprovalAndHarnessProfiles
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(add_plan_approval_and_harness_profiles_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var import_server = require("@nocobase/server");
|
|
34
|
+
class AddPlanApprovalAndHarnessProfiles extends import_server.Migration {
|
|
35
|
+
on = "afterLoad";
|
|
36
|
+
appVersion = ">=0.1.0";
|
|
37
|
+
async up() {
|
|
38
|
+
const db = this.db;
|
|
39
|
+
const queryInterface = db.sequelize.getQueryInterface();
|
|
40
|
+
const tablePrefix = db.options.tablePrefix || "";
|
|
41
|
+
await this.addRunColumns(queryInterface, `${tablePrefix}agentLoopRuns`);
|
|
42
|
+
await this.addStepColumns(queryInterface, `${tablePrefix}agentLoopSteps`);
|
|
43
|
+
await this.addConfigColumns(queryInterface, `${tablePrefix}orchestratorConfig`);
|
|
44
|
+
await this.ensureHarnessProfiles(queryInterface, `${tablePrefix}agentHarnessProfiles`);
|
|
45
|
+
await this.seedDefaultProfiles();
|
|
46
|
+
}
|
|
47
|
+
async addRunColumns(queryInterface, tableName) {
|
|
48
|
+
const tableExists = await queryInterface.tableExists(tableName).catch(() => false);
|
|
49
|
+
if (!tableExists) return;
|
|
50
|
+
const tableDesc = await queryInterface.describeTable(tableName);
|
|
51
|
+
const addIfMissing = async (name, spec) => {
|
|
52
|
+
if (tableDesc[name]) return;
|
|
53
|
+
await queryInterface.addColumn(tableName, name, spec);
|
|
54
|
+
};
|
|
55
|
+
await addIfMissing("approvalStatus", { type: import_database.DataTypes.STRING(30), allowNull: true, defaultValue: "none" });
|
|
56
|
+
await addIfMissing("approvedById", { type: import_database.DataTypes.BIGINT, allowNull: true });
|
|
57
|
+
await addIfMissing("approvedAt", { type: import_database.DataTypes.DATE, allowNull: true });
|
|
58
|
+
await addIfMissing("rejectionReason", { type: import_database.DataTypes.TEXT, allowNull: true });
|
|
59
|
+
await addIfMissing("changeRequest", { type: import_database.DataTypes.TEXT, allowNull: true });
|
|
60
|
+
await addIfMissing("planVersion", { type: import_database.DataTypes.INTEGER, allowNull: true, defaultValue: 1 });
|
|
61
|
+
await addIfMissing("planSource", { type: import_database.DataTypes.STRING(50), allowNull: true });
|
|
62
|
+
await addIfMissing("plannerModel", { type: import_database.DataTypes.STRING(100), allowNull: true });
|
|
63
|
+
await addIfMissing("lockedBy", { type: import_database.DataTypes.STRING(100), allowNull: true });
|
|
64
|
+
await addIfMissing("lockedUntil", { type: import_database.DataTypes.DATE, allowNull: true });
|
|
65
|
+
}
|
|
66
|
+
async addStepColumns(queryInterface, tableName) {
|
|
67
|
+
const tableExists = await queryInterface.tableExists(tableName).catch(() => false);
|
|
68
|
+
if (!tableExists) return;
|
|
69
|
+
const tableDesc = await queryInterface.describeTable(tableName);
|
|
70
|
+
if (!tableDesc.dependencyPolicy) {
|
|
71
|
+
await queryInterface.addColumn(tableName, "dependencyPolicy", {
|
|
72
|
+
type: import_database.DataTypes.STRING(30),
|
|
73
|
+
allowNull: true,
|
|
74
|
+
defaultValue: "require_success"
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async addConfigColumns(queryInterface, tableName) {
|
|
79
|
+
const tableExists = await queryInterface.tableExists(tableName).catch(() => false);
|
|
80
|
+
if (!tableExists) return;
|
|
81
|
+
const tableDesc = await queryInterface.describeTable(tableName);
|
|
82
|
+
if (!tableDesc.harnessTag) {
|
|
83
|
+
await queryInterface.addColumn(tableName, "harnessTag", {
|
|
84
|
+
type: import_database.DataTypes.STRING(100),
|
|
85
|
+
allowNull: true,
|
|
86
|
+
defaultValue: "default"
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async ensureHarnessProfiles(queryInterface, tableName) {
|
|
91
|
+
const tableExists = await queryInterface.tableExists(tableName).catch(() => false);
|
|
92
|
+
if (tableExists) return;
|
|
93
|
+
await queryInterface.createTable(tableName, {
|
|
94
|
+
id: { type: import_database.DataTypes.BIGINT, primaryKey: true, autoIncrement: true },
|
|
95
|
+
tag: { type: import_database.DataTypes.STRING(100), allowNull: false, unique: true },
|
|
96
|
+
title: { type: import_database.DataTypes.STRING(200), allowNull: true },
|
|
97
|
+
description: { type: import_database.DataTypes.TEXT, allowNull: true },
|
|
98
|
+
enabled: { type: import_database.DataTypes.BOOLEAN, allowNull: true, defaultValue: true },
|
|
99
|
+
settings: { type: import_database.DataTypes.JSON, allowNull: true, defaultValue: {} },
|
|
100
|
+
createdAt: { type: import_database.DataTypes.DATE, allowNull: true },
|
|
101
|
+
updatedAt: { type: import_database.DataTypes.DATE, allowNull: true }
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
async seedDefaultProfiles() {
|
|
105
|
+
const repo = this.db.getRepository("agentHarnessProfiles");
|
|
106
|
+
if (!repo) return;
|
|
107
|
+
const profiles = [
|
|
108
|
+
{
|
|
109
|
+
tag: "default",
|
|
110
|
+
title: "Default",
|
|
111
|
+
description: "Balanced profile for normal multi-agent work.",
|
|
112
|
+
settings: {
|
|
113
|
+
requirePlanApproval: true,
|
|
114
|
+
allowSubAgents: true,
|
|
115
|
+
allowToolCalls: true,
|
|
116
|
+
maxParallelSubAgents: 3,
|
|
117
|
+
maxControllerSteps: 100
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
tag: "safe",
|
|
122
|
+
title: "Safe",
|
|
123
|
+
description: "Strict approval-first profile for higher-risk work.",
|
|
124
|
+
settings: {
|
|
125
|
+
requirePlanApproval: true,
|
|
126
|
+
allowSubAgents: true,
|
|
127
|
+
allowToolCalls: true,
|
|
128
|
+
maxParallelSubAgents: 1,
|
|
129
|
+
maxControllerSteps: 50,
|
|
130
|
+
requireVerification: true
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
tag: "file-heavy",
|
|
135
|
+
title: "File Heavy",
|
|
136
|
+
description: "Profile for tasks that inspect or transform many attachments/files.",
|
|
137
|
+
settings: {
|
|
138
|
+
requirePlanApproval: true,
|
|
139
|
+
allowSubAgents: true,
|
|
140
|
+
allowToolCalls: true,
|
|
141
|
+
maxParallelSubAgents: 2,
|
|
142
|
+
maxControllerSteps: 120,
|
|
143
|
+
preferFileTools: true
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
];
|
|
147
|
+
for (const profile of profiles) {
|
|
148
|
+
const existing = await repo.findOne({ filter: { tag: profile.tag } });
|
|
149
|
+
if (existing) continue;
|
|
150
|
+
await repo.create({
|
|
151
|
+
values: {
|
|
152
|
+
...profile,
|
|
153
|
+
enabled: true,
|
|
154
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
155
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
async down() {
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Plugin } from '@nocobase/server';
|
|
2
|
+
import SkillHubSubFeature from './skill-hub/plugin';
|
|
3
|
+
import { AgentLoopService } from './services/AgentLoopService';
|
|
4
|
+
export declare class PluginAgentOrchestratorServer extends Plugin {
|
|
5
|
+
skillHub: SkillHubSubFeature;
|
|
6
|
+
agentLoopService: AgentLoopService;
|
|
7
|
+
afterAdd(): Promise<void>;
|
|
8
|
+
beforeLoad(): Promise<void>;
|
|
9
|
+
load(): Promise<void>;
|
|
10
|
+
install(): Promise<void>;
|
|
11
|
+
afterEnable(): Promise<void>;
|
|
12
|
+
afterDisable(): Promise<void>;
|
|
13
|
+
remove(): Promise<void>;
|
|
14
|
+
beforeStop(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export default PluginAgentOrchestratorServer;
|