plugin-agent-orchestrator 1.1.2 → 1.1.4
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/index.js +1 -1
- package/dist/client-v2/214.b063f33ba044a808.js +10 -0
- package/dist/client-v2/253.59577b40d9875be0.js +10 -0
- package/dist/client-v2/264.7ed8bee71fa5935c.js +10 -0
- package/dist/client-v2/{41.ba6e080cc0488143.js → 41.3deb9e57a0f64fc4.js} +1 -1
- package/dist/client-v2/418.58fa350f5496efd3.js +10 -0
- package/dist/client-v2/{53.7c29c28043e9112d.js → 53.9a10455323390f14.js} +1 -1
- package/dist/client-v2/619.0a2144aaffefe018.js +10 -0
- package/dist/client-v2/{70.bda9518881c05360.js → 70.ffff2997c10fd4b0.js} +1 -1
- package/dist/client-v2/{794.9bbb8d3a61b2bdf2.js → 794.a67a2614405ba627.js} +1 -1
- package/dist/client-v2/925.e5925bf21ed68e7a.js +10 -0
- package/dist/client-v2/{993.82778b6fd6db3cb1.js → 993.b0688fdc5ccb000a.js} +1 -1
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +8 -6
- package/dist/locale/en-US.json +48 -28
- package/dist/locale/vi-VN.json +48 -28
- package/dist/locale/zh-CN.json +48 -28
- package/dist/server/collections/agent-execution-spans.js +47 -0
- package/dist/server/collections/agent-harness-profile-versions.js +56 -0
- package/dist/server/collections/agent-harness-profiles.js +12 -0
- package/dist/server/collections/agent-loop-action-approvals.js +68 -0
- package/dist/server/collections/agent-loop-artifacts.js +55 -0
- package/dist/server/collections/agent-loop-circuit-states.js +53 -0
- package/dist/server/collections/agent-loop-control-settings.js +51 -0
- package/dist/server/collections/agent-loop-events.js +27 -0
- package/dist/server/collections/agent-loop-path-locks.js +57 -0
- package/dist/server/collections/agent-loop-patterns.js +72 -0
- package/dist/server/collections/agent-loop-runs.js +163 -2
- package/dist/server/collections/agent-loop-steps.js +69 -0
- package/dist/server/collections/agent-loop-usage-buckets.js +52 -0
- package/dist/server/collections/agent-loop-worktrees.js +55 -0
- package/dist/server/migrations/{20260427000000-change-packages-to-text.js → 20260427000002-change-packages-to-text.js} +2 -0
- package/dist/server/migrations/20260429000000-add-llm-fields.js +3 -2
- package/dist/server/migrations/{20260429000000-fix-inputargs-json-to-text.js → 20260429000001-fix-inputargs-json-to-text.js} +14 -6
- package/dist/server/migrations/20260503000000-add-orchestrator-trace-fields.js +2 -1
- package/dist/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.js +2 -1
- package/dist/server/migrations/20260803010000-backfill-loop-control-plane-data.js +262 -0
- package/dist/server/plugin.js +52 -150
- package/dist/server/resources/agent-loop-approval.js +83 -0
- package/dist/server/resources/agent-loop-artifact.js +86 -0
- package/dist/server/resources/agent-loop-events-stream.js +130 -0
- package/dist/server/resources/agent-loop.js +181 -139
- package/dist/server/resources/resource-helpers.js +63 -0
- package/dist/server/resources/tracing.js +121 -107
- package/dist/server/services/DurableCircuitBreakerService.js +229 -0
- package/dist/server/services/HarnessCompiler.js +142 -0
- package/dist/server/services/HarnessProfileService.js +168 -0
- package/dist/server/services/HarnessSchema.js +167 -0
- package/dist/server/services/LoopBudgetService.js +269 -0
- package/dist/server/services/LoopControlService.js +139 -0
- package/dist/server/services/LoopPatternSchema.js +180 -0
- package/dist/server/services/LoopPatternService.js +132 -0
- package/dist/server/services/LoopRunRepository.js +205 -0
- package/dist/server/services/LoopRunStateMachine.js +389 -0
- package/dist/server/services/LoopSchedulerService.js +193 -0
- package/dist/server/services/LoopTriggerService.js +128 -0
- package/dist/server/services/LoopWorkerService.js +461 -0
- package/dist/server/services/PathLockService.js +288 -0
- package/dist/server/services/PluginAiRuntimeAdapter.js +215 -0
- package/dist/server/services/VerificationSchema.js +59 -0
- package/dist/server/services/VerificationService.js +169 -0
- package/dist/server/skill-hub/actions/git-import.js +13 -7
- package/dist/server/skill-hub/services/RegistrySkillSnapshotService.js +1 -5
- package/dist/server/utils/ensure-indexes.js +111 -0
- package/dist/server/utils/loop-pattern-context.js +56 -0
- package/package.json +2 -2
- package/src/client/OrchestratorSettings.tsx +44 -0
- package/src/client-v2/components/AgentRunsTab.tsx +576 -494
- package/src/client-v2/components/HarnessProfilesTab.tsx +13 -8
- package/src/client-v2/components/MemoryInspectorTab.tsx +19 -3
- package/src/client-v2/components/TracingTab.tsx +515 -432
- package/src/client-v2/hooks/useApiRequest.ts +141 -121
- package/src/client-v2/skill-hub/components/SkillMetrics.tsx +8 -6
- package/src/locale/en-US.json +52 -28
- package/src/locale/vi-VN.json +52 -28
- package/src/locale/zh-CN.json +52 -28
- package/src/server/__tests__/circuit-breaker.test.ts +225 -146
- package/src/server/__tests__/harness-compiler.test.ts +131 -0
- package/src/server/__tests__/harness-profile-service.test.ts +116 -0
- package/src/server/__tests__/harness-tool-plan.test.ts +148 -0
- package/src/server/__tests__/loop-budget-service.test.ts +255 -0
- package/src/server/__tests__/loop-control-plane-backfill.test.ts +266 -0
- package/src/server/__tests__/loop-pattern-schema.test.ts +56 -0
- package/src/server/__tests__/loop-pattern-service.test.ts +148 -0
- package/src/server/__tests__/loop-run-state-machine.test.ts +90 -0
- package/src/server/__tests__/loop-worker-claim.test.ts +341 -0
- package/src/server/__tests__/loop-worker-execution.test.ts +236 -0
- package/src/server/__tests__/path-lock-service.test.ts +254 -0
- package/src/server/__tests__/smoke.test.ts +62 -21
- package/src/server/collections/agent-execution-spans.ts +47 -0
- package/src/server/collections/agent-harness-profile-versions.ts +26 -0
- package/src/server/collections/agent-harness-profiles.ts +12 -0
- package/src/server/collections/agent-loop-action-approvals.ts +38 -0
- package/src/server/collections/agent-loop-artifacts.ts +25 -0
- package/src/server/collections/agent-loop-circuit-states.ts +23 -0
- package/src/server/collections/agent-loop-control-settings.ts +21 -0
- package/src/server/collections/agent-loop-events.ts +27 -0
- package/src/server/collections/agent-loop-path-locks.ts +27 -0
- package/src/server/collections/agent-loop-patterns.ts +42 -0
- package/src/server/collections/agent-loop-runs.ts +163 -2
- package/src/server/collections/agent-loop-steps.ts +69 -0
- package/src/server/collections/agent-loop-usage-buckets.ts +22 -0
- package/src/server/collections/agent-loop-worktrees.ts +25 -0
- package/src/server/migrations/{20260427000000-change-packages-to-text.ts → 20260427000002-change-packages-to-text.ts} +3 -0
- package/src/server/migrations/20260429000000-add-llm-fields.ts +3 -2
- package/src/server/migrations/{20260429000000-fix-inputargs-json-to-text.ts → 20260429000001-fix-inputargs-json-to-text.ts} +13 -6
- package/src/server/migrations/20260503000000-add-orchestrator-trace-fields.ts +2 -1
- package/src/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.ts +2 -1
- package/src/server/migrations/20260803010000-backfill-loop-control-plane-data.ts +293 -0
- package/src/server/plugin.ts +53 -167
- package/src/server/resources/agent-loop-approval.ts +52 -0
- package/src/server/resources/agent-loop-artifact.ts +56 -0
- package/src/server/resources/agent-loop-events-stream.ts +105 -0
- package/src/server/resources/agent-loop.ts +202 -143
- package/src/server/resources/agent-monitor.ts +482 -482
- package/src/server/resources/resource-helpers.ts +33 -0
- package/src/server/resources/tracing.ts +145 -137
- package/src/server/services/DurableCircuitBreakerService.ts +239 -0
- package/src/server/services/HarnessCompiler.ts +133 -0
- package/src/server/services/HarnessProfileService.ts +157 -0
- package/src/server/services/HarnessSchema.ts +163 -0
- package/src/server/services/LoopBudgetService.ts +275 -0
- package/src/server/services/LoopControlService.ts +124 -0
- package/src/server/services/LoopPatternSchema.ts +167 -0
- package/src/server/services/LoopPatternService.ts +143 -0
- package/src/server/services/LoopRunRepository.ts +237 -0
- package/src/server/services/LoopRunStateMachine.ts +432 -0
- package/src/server/services/LoopSchedulerService.ts +199 -0
- package/src/server/services/LoopTriggerService.ts +115 -0
- package/src/server/services/LoopWorkerService.ts +522 -0
- package/src/server/services/PathLockService.ts +321 -0
- package/src/server/services/PluginAiRuntimeAdapter.ts +315 -0
- package/src/server/services/VerificationSchema.ts +31 -0
- package/src/server/services/VerificationService.ts +185 -0
- package/src/server/skill-hub/actions/__tests__/git-import.test.ts +62 -0
- package/src/server/skill-hub/actions/git-import.ts +9 -3
- package/src/server/skill-hub/services/RegistrySkillSnapshotService.ts +1 -5
- package/src/server/skill-hub/services/__tests__/RegistrySkillSnapshotService.test.ts +1 -3
- package/src/server/utils/ensure-indexes.ts +96 -0
- package/src/server/utils/logging.ts +0 -1
- package/src/server/utils/loop-pattern-context.ts +20 -0
- package/dist/client-v2/214.79650a549273f163.js +0 -10
- package/dist/client-v2/253.9f0537713cee9e6c.js +0 -10
- package/dist/client-v2/264.718a107e43fc163c.js +0 -10
- package/dist/client-v2/418.ce8f5b2b8a229d1d.js +0 -10
- package/dist/client-v2/619.bd3c5698b40705c3.js +0 -10
- package/dist/client-v2/925.f5370de8f6632d65.js +0 -10
- package/dist/server/services/AgentHarness.js +0 -81
- package/dist/server/services/AgentLoopController.js +0 -1023
- package/dist/server/services/AgentLoopRepository.js +0 -192
- package/dist/server/services/AgentLoopService.js +0 -142
- package/dist/server/services/AgentPlanValidator.js +0 -99
- package/dist/server/services/AgentPlannerService.js +0 -99
- package/dist/server/services/CircuitBreaker.js +0 -125
- package/dist/server/services/ContextAggregator.js +0 -201
- package/dist/server/services/PlanningPromptService.js +0 -95
- package/dist/server/tools/agent-loop.js +0 -373
- package/dist/server/tools/orchestrator-plan.js +0 -254
- package/src/server/__tests__/agent-loop-controller.test.ts +0 -375
- package/src/server/__tests__/context-aggregator.test.ts +0 -222
- package/src/server/__tests__/parallel-execution.test.ts +0 -318
- package/src/server/__tests__/planning-prompt-service.test.ts +0 -23
- package/src/server/services/AgentHarness.ts +0 -67
- package/src/server/services/AgentLoopController.ts +0 -1263
- package/src/server/services/AgentLoopRepository.ts +0 -178
- package/src/server/services/AgentLoopService.ts +0 -177
- package/src/server/services/AgentPlanValidator.ts +0 -73
- package/src/server/services/AgentPlannerService.ts +0 -80
- package/src/server/services/CircuitBreaker.ts +0 -126
- package/src/server/services/ContextAggregator.ts +0 -239
- package/src/server/services/PlanningPromptService.ts +0 -72
- package/src/server/tools/agent-loop.ts +0 -360
- package/src/server/tools/orchestrator-plan.ts +0 -255
|
@@ -0,0 +1,169 @@
|
|
|
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 VerificationService_exports = {};
|
|
28
|
+
__export(VerificationService_exports, {
|
|
29
|
+
VerificationService: () => VerificationService
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(VerificationService_exports);
|
|
32
|
+
var import_VerificationSchema = require("./VerificationSchema");
|
|
33
|
+
function read(record, key) {
|
|
34
|
+
const model = record;
|
|
35
|
+
return typeof model.get === "function" ? model.get(key) : record[key];
|
|
36
|
+
}
|
|
37
|
+
function extractVerdictObject(content) {
|
|
38
|
+
const fenced = content.match(/```(?:json)?\s*([\s\S]*?)```/i);
|
|
39
|
+
const candidate = fenced ? fenced[1] : content;
|
|
40
|
+
const start = candidate.indexOf("{");
|
|
41
|
+
const end = candidate.lastIndexOf("}");
|
|
42
|
+
if (start < 0 || end <= start) {
|
|
43
|
+
throw new Error("The verifier did not return a structured verdict object.");
|
|
44
|
+
}
|
|
45
|
+
return JSON.parse(candidate.slice(start, end + 1));
|
|
46
|
+
}
|
|
47
|
+
function verifierPrompt(input, artifacts) {
|
|
48
|
+
const catalogue = artifacts.length ? artifacts.map((artifact) => `- id=${artifact.id} kind=${artifact.kind} title=${artifact.title || ""}`).join("\n") : "- (none)";
|
|
49
|
+
return [
|
|
50
|
+
"You are the independent verifier for an autonomous run. You did not produce this work.",
|
|
51
|
+
`Goal: ${input.goal}`,
|
|
52
|
+
"",
|
|
53
|
+
"Reported result:",
|
|
54
|
+
input.makerSummary || "(the maker produced no textual summary)",
|
|
55
|
+
"",
|
|
56
|
+
"Evidence artifacts recorded for this run:",
|
|
57
|
+
catalogue,
|
|
58
|
+
"",
|
|
59
|
+
`Required checks: ${input.policy.verification.requiredChecks.join(", ")}`,
|
|
60
|
+
"",
|
|
61
|
+
"Reply with a single JSON object and nothing else:",
|
|
62
|
+
'{"verdict":"pass|reject|escalate","summary":"...","checks":[{"name":"...","status":"pass|fail|skipped",',
|
|
63
|
+
'"evidenceArtifactIds":[<artifact ids from the list above>]}],"residualRisks":["..."]}',
|
|
64
|
+
'Every check you mark "pass" must cite at least one artifact id from the list above.',
|
|
65
|
+
'If the evidence does not support the goal, answer "reject". Never invent artifact ids.'
|
|
66
|
+
].join("\n");
|
|
67
|
+
}
|
|
68
|
+
class VerificationService {
|
|
69
|
+
constructor(database, runtime, stateMachine) {
|
|
70
|
+
this.database = database;
|
|
71
|
+
this.runtime = runtime;
|
|
72
|
+
this.stateMachine = stateMachine;
|
|
73
|
+
}
|
|
74
|
+
async verifyAndFinalize(input) {
|
|
75
|
+
this.assertIndependentVerifier(input);
|
|
76
|
+
const artifacts = await this.runArtifacts(input.runId);
|
|
77
|
+
const verdict = await this.collectVerdict(input, artifacts);
|
|
78
|
+
await this.assertEvidenceBelongsToRun(verdict, artifacts, input.verifierUsername);
|
|
79
|
+
const finalStatus = this.finalStatusFor(verdict, input.autonomyLevel);
|
|
80
|
+
await this.stateMachine.transition({
|
|
81
|
+
runId: input.runId,
|
|
82
|
+
to: finalStatus,
|
|
83
|
+
actorType: "worker",
|
|
84
|
+
actorIdentity: input.workerId,
|
|
85
|
+
leaseToken: input.leaseToken,
|
|
86
|
+
eventType: "run_verified",
|
|
87
|
+
title: `Verifier returned ${verdict.verdict}`,
|
|
88
|
+
content: verdict.summary,
|
|
89
|
+
correlationKey: `verified:${input.runId}:${verdict.verdict}`,
|
|
90
|
+
values: {
|
|
91
|
+
verifierVerdict: verdict.verdict,
|
|
92
|
+
verifierEvidence: verdict,
|
|
93
|
+
summary: verdict.summary
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return { verdict, finalStatus };
|
|
97
|
+
}
|
|
98
|
+
assertIndependentVerifier(input) {
|
|
99
|
+
const verifier = input.verifierUsername.trim();
|
|
100
|
+
if (!verifier) throw new Error("The run snapshot does not name a verifier.");
|
|
101
|
+
if (verifier === input.leaderUsername || input.makerUsernames.includes(verifier)) {
|
|
102
|
+
throw new Error("The verifier must be a different employee from the leader and every maker.");
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async collectVerdict(input, artifacts) {
|
|
106
|
+
const sessionId = await this.runtime.createConversation({
|
|
107
|
+
username: input.verifierUsername,
|
|
108
|
+
userId: input.userId,
|
|
109
|
+
runId: input.runId,
|
|
110
|
+
title: `Verification of run ${input.runId}`
|
|
111
|
+
});
|
|
112
|
+
const outcome = await this.runtime.invoke({
|
|
113
|
+
username: input.verifierUsername,
|
|
114
|
+
sessionId,
|
|
115
|
+
userId: input.userId,
|
|
116
|
+
systemMessage: "You verify completed work against its stated goal using only recorded evidence. You never modify anything.",
|
|
117
|
+
harness: input.verifierHarness,
|
|
118
|
+
prompt: verifierPrompt(input, artifacts),
|
|
119
|
+
signal: input.signal
|
|
120
|
+
});
|
|
121
|
+
if (outcome.interrupted.length) {
|
|
122
|
+
throw new Error("The verifier requested an approval-gated tool; verification cannot complete.");
|
|
123
|
+
}
|
|
124
|
+
const verdict = (0, import_VerificationSchema.parseVerificationVerdict)(extractVerdictObject(outcome.content));
|
|
125
|
+
const required = new Set(input.policy.verification.requiredChecks);
|
|
126
|
+
for (const check of verdict.checks) required.delete(check.name);
|
|
127
|
+
if (required.size) {
|
|
128
|
+
throw new Error(`The verifier omitted required checks: ${Array.from(required).join(", ")}.`);
|
|
129
|
+
}
|
|
130
|
+
return verdict;
|
|
131
|
+
}
|
|
132
|
+
async assertEvidenceBelongsToRun(verdict, artifacts, verifierUsername) {
|
|
133
|
+
const owned = new Map(artifacts.map((artifact) => [Number(artifact.id), artifact]));
|
|
134
|
+
for (const check of verdict.checks) {
|
|
135
|
+
for (const artifactId of check.evidenceArtifactIds) {
|
|
136
|
+
const artifact = owned.get(artifactId);
|
|
137
|
+
if (!artifact) {
|
|
138
|
+
throw new Error(`Evidence artifact ${artifactId} does not belong to this run.`);
|
|
139
|
+
}
|
|
140
|
+
if (String(artifact.producerUsername || "") === verifierUsername) {
|
|
141
|
+
throw new Error(`Evidence artifact ${artifactId} was produced by the verifier itself.`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
finalStatusFor(verdict, autonomyLevel) {
|
|
147
|
+
if (verdict.verdict !== "pass") {
|
|
148
|
+
return verdict.verdict === "escalate" ? "waiting_human" : "failed";
|
|
149
|
+
}
|
|
150
|
+
const passesEveryCheck = verdict.checks.every(
|
|
151
|
+
(check) => check.status === "pass" && check.evidenceArtifactIds.length > 0
|
|
152
|
+
);
|
|
153
|
+
if (!passesEveryCheck) return "failed";
|
|
154
|
+
return autonomyLevel === "L1" ? "succeeded" : "waiting_human";
|
|
155
|
+
}
|
|
156
|
+
async runArtifacts(runId) {
|
|
157
|
+
const rows = await this.database.getRepository("agentLoopArtifacts").find({ filter: { runId } });
|
|
158
|
+
return rows.map((row) => ({
|
|
159
|
+
id: Number(read(row, "id")),
|
|
160
|
+
kind: String(read(row, "kind") || ""),
|
|
161
|
+
title: String(read(row, "title") || ""),
|
|
162
|
+
producerUsername: String(read(row, "producerUsername") || "")
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
167
|
+
0 && (module.exports = {
|
|
168
|
+
VerificationService
|
|
169
|
+
});
|
|
@@ -61,7 +61,7 @@ async function gitListSkills(ctx, next) {
|
|
|
61
61
|
const { repositoryId, ref = "HEAD", prefix = "" } = ctx.action.params;
|
|
62
62
|
const rootFolder = normalizeRootFolder(ctx.action.params.rootFolder);
|
|
63
63
|
if (!repositoryId) {
|
|
64
|
-
ctx.throw(400, "repositoryId and rootFolder are required");
|
|
64
|
+
ctx.throw(400, translateGitImportMessage(ctx, "repositoryId and rootFolder are required"));
|
|
65
65
|
}
|
|
66
66
|
try {
|
|
67
67
|
const service = getGitManagerContentService(ctx);
|
|
@@ -108,7 +108,7 @@ async function gitSyncSkills(ctx, next) {
|
|
|
108
108
|
const rootFolder = normalizeRootFolder(ctx.action.params.rootFolder);
|
|
109
109
|
const { skills: selectedKeys, overwrite = false, prefix = "" } = ctx.action.params.values || ctx.action.params;
|
|
110
110
|
if (!repositoryId || !Array.isArray(selectedKeys) || selectedKeys.length === 0) {
|
|
111
|
-
ctx.throw(400, "repositoryId, rootFolder and skills[] are required");
|
|
111
|
+
ctx.throw(400, translateGitImportMessage(ctx, "repositoryId, rootFolder and skills[] are required"));
|
|
112
112
|
}
|
|
113
113
|
const selectedSkillKeys = selectedKeys.filter(
|
|
114
114
|
(key) => typeof key === "string" && key.trim().length > 0
|
|
@@ -278,7 +278,8 @@ function getGitManagerContentService(ctx) {
|
|
|
278
278
|
throw new GitImportError(
|
|
279
279
|
"GIT_MANAGER_CONTENT_UNAVAILABLE",
|
|
280
280
|
424,
|
|
281
|
-
"Git Manager is not enabled for Skill Hub imports."
|
|
281
|
+
"Git Manager is not enabled for Skill Hub imports.",
|
|
282
|
+
{ key: "Git Manager is not enabled for Skill Hub imports." }
|
|
282
283
|
);
|
|
283
284
|
}
|
|
284
285
|
const service = plugin.skillHubContentService;
|
|
@@ -286,7 +287,8 @@ function getGitManagerContentService(ctx) {
|
|
|
286
287
|
throw new GitImportError(
|
|
287
288
|
"GIT_MANAGER_CONTENT_UNAVAILABLE",
|
|
288
289
|
424,
|
|
289
|
-
"Git Manager must support actor-aware content reads for Skill Hub imports."
|
|
290
|
+
"Git Manager must support actor-aware content reads for Skill Hub imports.",
|
|
291
|
+
{ key: "Git Manager must support actor-aware content reads for Skill Hub imports." }
|
|
290
292
|
);
|
|
291
293
|
}
|
|
292
294
|
const candidate = service;
|
|
@@ -297,7 +299,8 @@ function getGitManagerContentService(ctx) {
|
|
|
297
299
|
throw new GitImportError(
|
|
298
300
|
"GIT_MANAGER_CONTENT_UNAVAILABLE",
|
|
299
301
|
424,
|
|
300
|
-
"Git Manager must support actor-aware content reads for Skill Hub imports."
|
|
302
|
+
"Git Manager must support actor-aware content reads for Skill Hub imports.",
|
|
303
|
+
{ key: "Git Manager must support actor-aware content reads for Skill Hub imports." }
|
|
301
304
|
);
|
|
302
305
|
}
|
|
303
306
|
return service;
|
|
@@ -309,7 +312,8 @@ function accessFromContext(ctx) {
|
|
|
309
312
|
throw new GitImportError(
|
|
310
313
|
"SKILL_HUB_REPOSITORY_ACCESS_DENIED",
|
|
311
314
|
403,
|
|
312
|
-
"A valid user role context is required to import skills from Git Manager."
|
|
315
|
+
"A valid user role context is required to import skills from Git Manager.",
|
|
316
|
+
{ key: "A valid user role context is required to import skills from Git Manager." }
|
|
313
317
|
);
|
|
314
318
|
}
|
|
315
319
|
return { kind: "user", roles: currentRoles };
|
|
@@ -342,7 +346,9 @@ function throwGitImportError(ctx, error) {
|
|
|
342
346
|
case MISSING_GIT_FILE_CODE:
|
|
343
347
|
return throwHttpError(ctx, 404, errorMessage(error));
|
|
344
348
|
default:
|
|
345
|
-
return throwHttpError(ctx, 502, "Git Manager could not read the requested repository content."
|
|
349
|
+
return throwHttpError(ctx, 502, "Git Manager could not read the requested repository content.", {
|
|
350
|
+
key: "Git Manager could not read the requested repository content."
|
|
351
|
+
});
|
|
346
352
|
}
|
|
347
353
|
}
|
|
348
354
|
function translateGitImportMessage(ctx, key, values, fallback = key) {
|
|
@@ -38,11 +38,7 @@ function positiveLimit(value2, fallback, maximum) {
|
|
|
38
38
|
const parsed = Number(value2);
|
|
39
39
|
return Number.isSafeInteger(parsed) && parsed > 0 && parsed <= maximum ? parsed : fallback;
|
|
40
40
|
}
|
|
41
|
-
const MAX_REGISTRY_SKILL_SNAPSHOTS = positiveLimit(
|
|
42
|
-
process.env.SKILL_REGISTRY_MAX_SOURCE_ITEMS,
|
|
43
|
-
1e3,
|
|
44
|
-
1e4
|
|
45
|
-
);
|
|
41
|
+
const MAX_REGISTRY_SKILL_SNAPSHOTS = positiveLimit(process.env.SKILL_REGISTRY_MAX_SOURCE_ITEMS, 1e3, 1e4);
|
|
46
42
|
const MAX_REGISTRY_TEXT_BYTES = 10 * 1024 * 1024;
|
|
47
43
|
const registryExportFilter = {
|
|
48
44
|
registryPackageId: null,
|
|
@@ -0,0 +1,111 @@
|
|
|
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 ensure_indexes_exports = {};
|
|
28
|
+
__export(ensure_indexes_exports, {
|
|
29
|
+
ensureAgentOrchestratorIndexes: () => ensureAgentOrchestratorIndexes
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(ensure_indexes_exports);
|
|
32
|
+
const INDEXED_COLLECTIONS = [
|
|
33
|
+
"agentExecutionSpans",
|
|
34
|
+
"agentHarnessProfiles",
|
|
35
|
+
"agentHarnessProfileVersions",
|
|
36
|
+
"agentLoopActionApprovals",
|
|
37
|
+
"agentLoopArtifacts",
|
|
38
|
+
"agentLoopCircuitStates",
|
|
39
|
+
"agentLoopControlSettings",
|
|
40
|
+
"agentLoopEvents",
|
|
41
|
+
"agentLoopPathLocks",
|
|
42
|
+
"agentLoopPatterns",
|
|
43
|
+
"agentLoopRuns",
|
|
44
|
+
"agentLoopSteps",
|
|
45
|
+
"agentLoopUsageBuckets",
|
|
46
|
+
"agentLoopWorktrees",
|
|
47
|
+
"agentMemoryContexts",
|
|
48
|
+
"orchestratorConfig",
|
|
49
|
+
"skillRegistryInstallations"
|
|
50
|
+
];
|
|
51
|
+
function resolvePhysicalField(collection, field) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
if (typeof field === "string") {
|
|
54
|
+
return ((_a = collection.model.rawAttributes[field]) == null ? void 0 : _a.field) || field;
|
|
55
|
+
}
|
|
56
|
+
if (field && typeof field === "object" && "name" in field && typeof field.name === "string") {
|
|
57
|
+
const name = field.name;
|
|
58
|
+
return ((_b = collection.model.rawAttributes[name]) == null ? void 0 : _b.field) || name;
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
function deriveIndexName(tableName, fieldNames) {
|
|
63
|
+
const table = typeof tableName === "string" ? tableName : String((tableName == null ? void 0 : tableName.tableName) ?? "");
|
|
64
|
+
return `${table}_${fieldNames.join("_")}`.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
65
|
+
}
|
|
66
|
+
function physicalIndexFieldKey(index) {
|
|
67
|
+
return (index.fields || []).map((field) => typeof field === "string" ? field : (field == null ? void 0 : field.attribute) || "").join(",");
|
|
68
|
+
}
|
|
69
|
+
async function ensureAgentOrchestratorIndexes(database) {
|
|
70
|
+
var _a;
|
|
71
|
+
const queryInterface = database.sequelize.getQueryInterface();
|
|
72
|
+
for (const collectionName of INDEXED_COLLECTIONS) {
|
|
73
|
+
const collection = database.getCollection(collectionName);
|
|
74
|
+
if (!collection) continue;
|
|
75
|
+
const tableName = collection.getTableNameWithSchema();
|
|
76
|
+
const physicalIndexes = await queryInterface.showIndex(tableName);
|
|
77
|
+
const physicalIndexNames = new Set(physicalIndexes.flatMap((index) => index.name ? [index.name] : []));
|
|
78
|
+
const physicalFieldKeys = new Set(physicalIndexes.map(physicalIndexFieldKey));
|
|
79
|
+
for (const index of collection.model.options.indexes || []) {
|
|
80
|
+
if (!((_a = index.fields) == null ? void 0 : _a.length)) continue;
|
|
81
|
+
const physicalFieldNames = index.fields.map((field) => resolvePhysicalField(collection, field)).filter((name) => !!name);
|
|
82
|
+
if (physicalFieldKeys.has(physicalFieldNames.join(","))) continue;
|
|
83
|
+
const resolvedFields = index.fields.map((field) => {
|
|
84
|
+
var _a2, _b;
|
|
85
|
+
if (typeof field === "string") {
|
|
86
|
+
return ((_a2 = collection.model.rawAttributes[field]) == null ? void 0 : _a2.field) || field;
|
|
87
|
+
}
|
|
88
|
+
if (field && typeof field === "object" && "name" in field && typeof field.name === "string") {
|
|
89
|
+
return {
|
|
90
|
+
...field,
|
|
91
|
+
name: ((_b = collection.model.rawAttributes[field.name]) == null ? void 0 : _b.field) || field.name
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return field;
|
|
95
|
+
});
|
|
96
|
+
const indexName = index.name || deriveIndexName(tableName, physicalFieldNames);
|
|
97
|
+
if (physicalIndexNames.has(indexName)) continue;
|
|
98
|
+
await queryInterface.addIndex(tableName, {
|
|
99
|
+
name: indexName,
|
|
100
|
+
fields: resolvedFields,
|
|
101
|
+
unique: index.unique
|
|
102
|
+
});
|
|
103
|
+
physicalIndexNames.add(indexName);
|
|
104
|
+
physicalFieldKeys.add(physicalFieldNames.join(","));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
109
|
+
0 && (module.exports = {
|
|
110
|
+
ensureAgentOrchestratorIndexes
|
|
111
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
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 loop_pattern_context_exports = {};
|
|
28
|
+
__export(loop_pattern_context_exports, {
|
|
29
|
+
employeeHarnessResolver: () => employeeHarnessResolver,
|
|
30
|
+
worktreeCapability: () => worktreeCapability
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(loop_pattern_context_exports);
|
|
33
|
+
var import_ctx_utils = require("./ctx-utils");
|
|
34
|
+
function worktreeCapability(plugin) {
|
|
35
|
+
var _a;
|
|
36
|
+
const pluginManager = plugin.app.pm;
|
|
37
|
+
const gitManager = (_a = pluginManager.get) == null ? void 0 : _a.call(pluginManager, "plugin-git-manager");
|
|
38
|
+
return {
|
|
39
|
+
available: Boolean(gitManager == null ? void 0 : gitManager.loopWorktreeService),
|
|
40
|
+
provider: (gitManager == null ? void 0 : gitManager.loopWorktreeService) ? "plugin-git-manager" : void 0
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function employeeHarnessResolver(plugin) {
|
|
44
|
+
return async (username) => {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
const employee = await ((_a = plugin.db.getRepository("aiEmployees")) == null ? void 0 : _a.findOne({ filter: { username } }));
|
|
47
|
+
if (!employee) return void 0;
|
|
48
|
+
const skillSettings = (0, import_ctx_utils.asObject)((_b = employee.get) == null ? void 0 : _b.call(employee, "skillSettings"));
|
|
49
|
+
return skillSettings.orchestratorHarness;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
employeeHarnessResolver,
|
|
55
|
+
worktreeCapability
|
|
56
|
+
});
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "代理协调器",
|
|
5
5
|
"displayName.vi-VN": "Điều phối Agent",
|
|
6
6
|
"description": "Native AI Employee sub-agent monitoring, policy, and memory context layer for NocoBase plugin-ai.",
|
|
7
|
-
"version": "1.1.
|
|
7
|
+
"version": "1.1.4",
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
9
|
"main": "dist/server/index.js",
|
|
10
10
|
"keywords": [
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@nocobase/plugin-ai": "2.x",
|
|
44
44
|
"@nocobase/client-v2": "2.x",
|
|
45
45
|
"@nocobase/flow-engine": "2.x",
|
|
46
|
-
"plugin-git-manager": "^2.
|
|
46
|
+
"plugin-git-manager": "^1.2.24"
|
|
47
47
|
},
|
|
48
48
|
"peerDependenciesMeta": {
|
|
49
49
|
"plugin-git-manager": {
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Tabs } from 'antd';
|
|
3
3
|
import {
|
|
4
|
+
ApiOutlined,
|
|
4
5
|
BarChartOutlined,
|
|
5
6
|
CheckCircleOutlined,
|
|
6
7
|
CodeOutlined,
|
|
8
|
+
DatabaseOutlined,
|
|
7
9
|
HistoryOutlined,
|
|
8
10
|
MonitorOutlined,
|
|
11
|
+
NodeIndexOutlined,
|
|
9
12
|
SettingOutlined,
|
|
13
|
+
TeamOutlined,
|
|
10
14
|
} from '@ant-design/icons';
|
|
11
15
|
import { TracingTab } from '../client-v2/components/TracingTab';
|
|
16
|
+
import { AgentBindingsTab } from '../client-v2/components/AgentBindingsTab';
|
|
17
|
+
import { KnowledgeAccessTab } from '../client-v2/components/KnowledgeAccessTab';
|
|
18
|
+
import { RetrievalTraceTab } from '../client-v2/components/RetrievalTraceTab';
|
|
19
|
+
import { MemoryInspectorTab } from '../client-v2/components/MemoryInspectorTab';
|
|
12
20
|
import { AgentRunsTab } from './AgentRunsTab';
|
|
13
21
|
import { HarnessProfilesTab } from './HarnessProfilesTab';
|
|
14
22
|
import { AIEmployeesProvider } from '../client-v2/components/AIEmployeesContext';
|
|
@@ -51,6 +59,42 @@ const OrchestratorSettings: React.FC = () => {
|
|
|
51
59
|
),
|
|
52
60
|
children: <HarnessProfilesTab />,
|
|
53
61
|
},
|
|
62
|
+
{
|
|
63
|
+
key: 'agent-bindings',
|
|
64
|
+
label: (
|
|
65
|
+
<span>
|
|
66
|
+
<TeamOutlined /> {t('Agent Bindings')}
|
|
67
|
+
</span>
|
|
68
|
+
),
|
|
69
|
+
children: <AgentBindingsTab />,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
key: 'knowledge-access',
|
|
73
|
+
label: (
|
|
74
|
+
<span>
|
|
75
|
+
<ApiOutlined /> {t('Knowledge Access')}
|
|
76
|
+
</span>
|
|
77
|
+
),
|
|
78
|
+
children: <KnowledgeAccessTab />,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
key: 'retrieval-trace',
|
|
82
|
+
label: (
|
|
83
|
+
<span>
|
|
84
|
+
<NodeIndexOutlined /> {t('Retrieval Trace')}
|
|
85
|
+
</span>
|
|
86
|
+
),
|
|
87
|
+
children: <RetrievalTraceTab />,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
key: 'memory-inspector',
|
|
91
|
+
label: (
|
|
92
|
+
<span>
|
|
93
|
+
<DatabaseOutlined /> {t('Memory Inspector')}
|
|
94
|
+
</span>
|
|
95
|
+
),
|
|
96
|
+
children: <MemoryInspectorTab />,
|
|
97
|
+
},
|
|
54
98
|
{
|
|
55
99
|
key: 'skill-definitions',
|
|
56
100
|
label: (
|