plugin-agent-orchestrator 1.1.4 → 1.1.6
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 +204 -114
- package/dist/client/index.js +1 -1
- package/dist/client-v2/117.7565cff57c39318a.js +10 -0
- package/dist/client-v2/214.106635011859dede.js +10 -0
- package/dist/client-v2/418.41ed200e7d6da332.js +10 -0
- package/dist/client-v2/53.349fff8db80b19d4.js +10 -0
- package/dist/client-v2/981.e4a1f41cfc94a856.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +7 -8
- package/dist/locale/en-US.json +226 -170
- package/dist/locale/vi-VN.json +226 -170
- package/dist/locale/zh-CN.json +226 -170
- package/dist/server/collections/agent-execution-spans.js +8 -0
- package/dist/server/collections/agent-loop-action-approvals.js +1 -0
- package/dist/server/collections/agent-loop-runs.js +7 -1
- package/dist/server/collections/agent-loop-steps.js +7 -0
- package/dist/server/collections/skill-executions.js +8 -0
- package/dist/server/plugin.js +3 -1
- package/dist/server/resources/agent-harness-profile.js +117 -0
- package/dist/server/resources/agent-knowledge-insights.js +1 -3
- package/dist/server/resources/agent-loop-approval.js +25 -0
- package/dist/server/resources/agent-loop.js +3 -1
- package/dist/server/services/AgentMemoryContextService.js +34 -0
- package/dist/server/services/HarnessCompiler.js +35 -2
- package/dist/server/services/HarnessProfileService.js +74 -9
- package/dist/server/services/HarnessSchema.js +30 -3
- package/dist/server/services/LoopPatternSchema.js +16 -1
- package/dist/server/services/LoopRunRepository.js +80 -0
- package/dist/server/services/LoopRunStateMachine.js +92 -3
- package/dist/server/services/LoopTriggerService.js +37 -0
- package/dist/server/services/LoopWorkerService.js +261 -23
- package/dist/server/services/NativeSubAgentObserver.js +165 -23
- package/dist/server/services/PluginAiRuntimeAdapter.js +16 -5
- package/dist/server/services/ToolLoopDetectionService.js +210 -0
- package/dist/server/services/VerificationService.js +66 -0
- package/dist/server/services/harness-runtime-policy.js +139 -0
- package/dist/server/skill-hub/plugin.js +36 -3
- package/dist/server/skill-hub/tasks/SkillExecutionTask.js +29 -0
- package/package.json +53 -53
- package/src/client/ApprovalsTab.tsx +2 -0
- package/src/client/OrchestratorSettings.tsx +11 -0
- package/src/client/skill-hub/components/GitSkillImport.tsx +3 -3
- package/src/client/skill-hub/components/SkillMetrics.tsx +15 -10
- package/src/client/skill-hub/index.tsx +0 -52
- package/src/client-v2/components/AgentRunsTab.tsx +576 -576
- package/src/client-v2/components/ApprovalsTab.tsx +337 -0
- package/src/client-v2/components/HarnessProfilesTab.tsx +385 -105
- package/src/client-v2/components/MemoryInspectorTab.tsx +141 -141
- package/src/client-v2/components/TracingTab.tsx +515 -515
- package/src/client-v2/hooks/useApiRequest.ts +141 -141
- package/src/client-v2/pages/ApprovalsPage.tsx +10 -0
- package/src/client-v2/plugin.tsx +6 -6
- package/src/client-v2/skill-hub/components/SkillMetrics.tsx +5 -2
- package/src/locale/en-US.json +226 -174
- package/src/locale/vi-VN.json +226 -174
- package/src/locale/zh-CN.json +226 -174
- package/src/server/__tests__/circuit-breaker.test.ts +248 -248
- package/src/server/__tests__/harness-compiler.test.ts +83 -0
- package/src/server/__tests__/harness-profile-service.test.ts +51 -0
- package/src/server/__tests__/harness-runtime-policy.test.ts +293 -0
- package/src/server/__tests__/harness-tool-plan.test.ts +24 -0
- package/src/server/__tests__/loop-approval-decision.test.ts +512 -0
- package/src/server/__tests__/loop-approval-expiry.test.ts +258 -0
- package/src/server/__tests__/loop-budget-service.test.ts +255 -255
- package/src/server/__tests__/loop-control-plane-backfill.test.ts +266 -266
- package/src/server/__tests__/loop-pattern-schema.test.ts +18 -1
- package/src/server/__tests__/loop-pattern-service.test.ts +148 -148
- package/src/server/__tests__/loop-run-state-machine.test.ts +11 -0
- package/src/server/__tests__/loop-trigger-service.test.ts +148 -0
- package/src/server/__tests__/loop-worker-claim.test.ts +341 -341
- package/src/server/__tests__/loop-worker-execution.test.ts +82 -1
- package/src/server/__tests__/native-sub-agent-observer.test.ts +288 -4
- package/src/server/__tests__/path-lock-service.test.ts +254 -254
- package/src/server/__tests__/skill-execution-task-policy.test.ts +140 -0
- package/src/server/__tests__/smoke.test.ts +162 -162
- package/src/server/__tests__/tool-loop-detection.test.ts +275 -0
- package/src/server/collections/agent-execution-spans.ts +8 -0
- package/src/server/collections/agent-harness-profile-versions.ts +26 -26
- package/src/server/collections/agent-harness-profiles.ts +71 -71
- package/src/server/collections/agent-loop-action-approvals.ts +1 -0
- package/src/server/collections/agent-loop-artifacts.ts +25 -25
- package/src/server/collections/agent-loop-circuit-states.ts +23 -23
- package/src/server/collections/agent-loop-control-settings.ts +21 -21
- package/src/server/collections/agent-loop-events.ts +98 -98
- package/src/server/collections/agent-loop-path-locks.ts +27 -27
- package/src/server/collections/agent-loop-patterns.ts +42 -42
- package/src/server/collections/agent-loop-runs.ts +7 -1
- package/src/server/collections/agent-loop-steps.ts +7 -0
- package/src/server/collections/agent-loop-usage-buckets.ts +22 -22
- package/src/server/collections/agent-loop-worktrees.ts +25 -25
- package/src/server/collections/skill-executions.ts +8 -0
- package/src/server/migrations/20260427000002-change-packages-to-text.ts +52 -52
- package/src/server/migrations/20260429000000-add-llm-fields.ts +47 -47
- package/src/server/migrations/20260429000001-fix-inputargs-json-to-text.ts +45 -45
- package/src/server/migrations/20260503000000-add-orchestrator-trace-fields.ts +33 -33
- package/src/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.ts +31 -31
- package/src/server/migrations/20260803010000-backfill-loop-control-plane-data.ts +293 -293
- package/src/server/plugin.ts +3 -1
- package/src/server/resources/agent-harness-profile.ts +94 -0
- package/src/server/resources/agent-knowledge-insights.ts +5 -3
- package/src/server/resources/agent-loop-approval.ts +32 -0
- package/src/server/resources/agent-loop-artifact.ts +56 -56
- package/src/server/resources/agent-loop-events-stream.ts +105 -105
- package/src/server/resources/agent-loop.ts +3 -1
- package/src/server/resources/resource-helpers.ts +33 -33
- package/src/server/resources/tracing.ts +266 -266
- package/src/server/services/AgentMemoryContextService.ts +44 -0
- package/src/server/services/DurableCircuitBreakerService.ts +239 -239
- package/src/server/services/ExecutionSpanService.ts +2 -0
- package/src/server/services/HarnessCompiler.ts +37 -0
- package/src/server/services/HarnessProfileService.ts +92 -10
- package/src/server/services/HarnessSchema.ts +31 -0
- package/src/server/services/LoopBudgetService.ts +275 -275
- package/src/server/services/LoopControlService.ts +124 -124
- package/src/server/services/LoopPatternSchema.ts +19 -1
- package/src/server/services/LoopPatternService.ts +143 -143
- package/src/server/services/LoopRunRepository.ts +99 -0
- package/src/server/services/LoopRunStateMachine.ts +100 -3
- package/src/server/services/LoopSchedulerService.ts +199 -199
- package/src/server/services/LoopTriggerService.ts +42 -0
- package/src/server/services/LoopWorkerService.ts +327 -27
- package/src/server/services/NativeSubAgentObserver.ts +186 -21
- package/src/server/services/PathLockService.ts +321 -321
- package/src/server/services/PluginAiRuntimeAdapter.ts +24 -7
- package/src/server/services/ToolLoopDetectionService.ts +213 -0
- package/src/server/services/VerificationSchema.ts +31 -31
- package/src/server/services/VerificationService.ts +81 -2
- package/src/server/services/harness-runtime-policy.ts +141 -0
- package/src/server/skill-hub/plugin.ts +41 -3
- package/src/server/skill-hub/services/RegistrySkillSnapshotService.ts +235 -235
- package/src/server/skill-hub/services/__tests__/RegistrySkillSnapshotService.test.ts +61 -61
- package/src/server/skill-hub/tasks/SkillExecutionTask.ts +43 -2
- package/src/server/utils/ensure-indexes.ts +96 -96
- package/src/server/utils/logging.ts +62 -62
- package/src/server/utils/loop-pattern-context.ts +20 -20
- package/dist/client-v2/214.b063f33ba044a808.js +0 -10
- package/dist/client-v2/373.f5d5292e53c4e832.js +0 -10
- package/dist/client-v2/418.58fa350f5496efd3.js +0 -10
- package/dist/client-v2/53.9a10455323390f14.js +0 -10
- package/dist/client-v2/677.a991ce0250ff5c77.js +0 -10
- package/dist/client-v2/925.e5925bf21ed68e7a.js +0 -10
- package/src/client/AIEmployeeSelect.tsx +0 -47
- package/src/client/AIEmployeesContext.tsx +0 -102
- package/src/client/RulesTab.tsx +0 -2
- package/src/client/TracingTab.tsx +0 -436
- package/src/client/skill-hub/components/ExecutionProgress.tsx +0 -51
- package/src/client-v2/components/RulesTab.tsx +0 -2
- package/src/client-v2/pages/AgentRunsPage.tsx +0 -13
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import type { Database } from '@nocobase/database';
|
|
2
|
-
|
|
3
|
-
import { RegistrySkillSnapshotService } from '../RegistrySkillSnapshotService';
|
|
4
|
-
|
|
5
|
-
describe('RegistrySkillSnapshotService', () => {
|
|
6
|
-
it('does not expose registry-installed local projections as Skill Hub sources', async () => {
|
|
7
|
-
const find = vi.fn().mockResolvedValue([{ get: () => 42 }]);
|
|
8
|
-
const database = {
|
|
9
|
-
getRepository: vi.fn().mockReturnValue({ find }),
|
|
10
|
-
} as unknown as Database;
|
|
11
|
-
const service = new RegistrySkillSnapshotService(database);
|
|
12
|
-
|
|
13
|
-
await expect(service.listSkillSnapshots()).resolves.toEqual([{ id: '42' }]);
|
|
14
|
-
expect(find).toHaveBeenCalledWith({
|
|
15
|
-
fields: ['id'],
|
|
16
|
-
filter: {
|
|
17
|
-
registryPackageId: null,
|
|
18
|
-
registryVersionId: null,
|
|
19
|
-
registryInstallationId: null,
|
|
20
|
-
registryInstallStatus: null,
|
|
21
|
-
registryExportEnabled: true,
|
|
22
|
-
},
|
|
23
|
-
sort: ['id'],
|
|
24
|
-
limit: 1001,
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('does not return a snapshot without a provider-owned export grant', async () => {
|
|
29
|
-
const findOne = vi.fn().mockResolvedValue(null);
|
|
30
|
-
const database = {
|
|
31
|
-
getRepository: vi.fn().mockReturnValue({ findOne }),
|
|
32
|
-
} as unknown as Database;
|
|
33
|
-
const service = new RegistrySkillSnapshotService(database);
|
|
34
|
-
|
|
35
|
-
await expect(service.getSkillSnapshot('42')).rejects.toMatchObject({
|
|
36
|
-
code: 'REGISTRY_EXPORT_NOT_GRANTED',
|
|
37
|
-
});
|
|
38
|
-
expect(findOne).toHaveBeenCalledWith({
|
|
39
|
-
filter: {
|
|
40
|
-
id: '42',
|
|
41
|
-
registryPackageId: null,
|
|
42
|
-
registryVersionId: null,
|
|
43
|
-
registryInstallationId: null,
|
|
44
|
-
registryInstallStatus: null,
|
|
45
|
-
registryExportEnabled: true,
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('bounds provider discovery before returning an unbounded definition list', async () => {
|
|
51
|
-
const find = vi.fn().mockResolvedValue(Array.from({ length: 1001 }, (_, id) => ({ get: () => id + 1 })));
|
|
52
|
-
const database = {
|
|
53
|
-
getRepository: vi.fn().mockReturnValue({ find }),
|
|
54
|
-
} as unknown as Database;
|
|
55
|
-
const service = new RegistrySkillSnapshotService(database);
|
|
56
|
-
|
|
57
|
-
await expect(service.listSkillSnapshots()).rejects.toThrow(
|
|
58
|
-
'Skill Hub registry export exceeds the configured source-item limit.',
|
|
59
|
-
);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
1
|
+
import type { Database } from '@nocobase/database';
|
|
2
|
+
|
|
3
|
+
import { RegistrySkillSnapshotService } from '../RegistrySkillSnapshotService';
|
|
4
|
+
|
|
5
|
+
describe('RegistrySkillSnapshotService', () => {
|
|
6
|
+
it('does not expose registry-installed local projections as Skill Hub sources', async () => {
|
|
7
|
+
const find = vi.fn().mockResolvedValue([{ get: () => 42 }]);
|
|
8
|
+
const database = {
|
|
9
|
+
getRepository: vi.fn().mockReturnValue({ find }),
|
|
10
|
+
} as unknown as Database;
|
|
11
|
+
const service = new RegistrySkillSnapshotService(database);
|
|
12
|
+
|
|
13
|
+
await expect(service.listSkillSnapshots()).resolves.toEqual([{ id: '42' }]);
|
|
14
|
+
expect(find).toHaveBeenCalledWith({
|
|
15
|
+
fields: ['id'],
|
|
16
|
+
filter: {
|
|
17
|
+
registryPackageId: null,
|
|
18
|
+
registryVersionId: null,
|
|
19
|
+
registryInstallationId: null,
|
|
20
|
+
registryInstallStatus: null,
|
|
21
|
+
registryExportEnabled: true,
|
|
22
|
+
},
|
|
23
|
+
sort: ['id'],
|
|
24
|
+
limit: 1001,
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('does not return a snapshot without a provider-owned export grant', async () => {
|
|
29
|
+
const findOne = vi.fn().mockResolvedValue(null);
|
|
30
|
+
const database = {
|
|
31
|
+
getRepository: vi.fn().mockReturnValue({ findOne }),
|
|
32
|
+
} as unknown as Database;
|
|
33
|
+
const service = new RegistrySkillSnapshotService(database);
|
|
34
|
+
|
|
35
|
+
await expect(service.getSkillSnapshot('42')).rejects.toMatchObject({
|
|
36
|
+
code: 'REGISTRY_EXPORT_NOT_GRANTED',
|
|
37
|
+
});
|
|
38
|
+
expect(findOne).toHaveBeenCalledWith({
|
|
39
|
+
filter: {
|
|
40
|
+
id: '42',
|
|
41
|
+
registryPackageId: null,
|
|
42
|
+
registryVersionId: null,
|
|
43
|
+
registryInstallationId: null,
|
|
44
|
+
registryInstallStatus: null,
|
|
45
|
+
registryExportEnabled: true,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('bounds provider discovery before returning an unbounded definition list', async () => {
|
|
51
|
+
const find = vi.fn().mockResolvedValue(Array.from({ length: 1001 }, (_, id) => ({ get: () => id + 1 })));
|
|
52
|
+
const database = {
|
|
53
|
+
getRepository: vi.fn().mockReturnValue({ find }),
|
|
54
|
+
} as unknown as Database;
|
|
55
|
+
const service = new RegistrySkillSnapshotService(database);
|
|
56
|
+
|
|
57
|
+
await expect(service.listSkillSnapshots()).rejects.toThrow(
|
|
58
|
+
'Skill Hub registry export exceeds the configured source-item limit.',
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import Application from '@nocobase/server';
|
|
2
|
-
import { cpSync, existsSync, readFileSync, rmSync } from 'fs';
|
|
2
|
+
import { cpSync, existsSync, readFileSync, rmSync, statSync, writeFileSync } from 'fs';
|
|
3
3
|
import { resolve, sep } from 'path';
|
|
4
4
|
import { SandboxRunner } from '../../services/SandboxRunner';
|
|
5
5
|
import { FileManager } from '../../services/FileManager';
|
|
6
6
|
import { SkillRepositoryService } from '../../services/SkillRepositoryService';
|
|
7
7
|
import { CodeValidator } from '../../services/CodeValidator';
|
|
8
|
+
import { spilledText } from '../../services/harness-runtime-policy';
|
|
8
9
|
import { createHash } from 'crypto';
|
|
9
10
|
import { assertSkillToolNameAvailable, buildSkillToolName } from '../../utils/skill-tool-name';
|
|
10
|
-
import { parseJsonText, stringifyJsonText } from '../utils/json-fields';
|
|
11
|
+
import { parseJsonLike, parseJsonText, stringifyJsonText } from '../utils/json-fields';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Lightweight abort controller compatible with the SandboxRunner signal interface.
|
|
@@ -159,6 +160,20 @@ export class SkillExecutionTask {
|
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
162
|
|
|
163
|
+
// Harness-derived overrides resolved when the execution was queued. They cap (never widen)
|
|
164
|
+
// the skill's own limits, so a permissive skill cannot outrun a restrictive harness.
|
|
165
|
+
const runtimePolicy = parseJsonLike(
|
|
166
|
+
this.execution.get ? this.execution.get('runtimePolicy') : this.execution.runtimePolicy,
|
|
167
|
+
{},
|
|
168
|
+
) as Record<string, unknown>;
|
|
169
|
+
if (typeof runtimePolicy?.timeoutSeconds === 'number' && runtimePolicy.timeoutSeconds > 0) {
|
|
170
|
+
timeoutSeconds = Math.min(Number(timeoutSeconds) || 60, runtimePolicy.timeoutSeconds);
|
|
171
|
+
}
|
|
172
|
+
const spillMaxInlineBytes =
|
|
173
|
+
typeof runtimePolicy?.spillMaxInlineBytes === 'number' && runtimePolicy.spillMaxInlineBytes > 0
|
|
174
|
+
? runtimePolicy.spillMaxInlineBytes
|
|
175
|
+
: null;
|
|
176
|
+
|
|
162
177
|
if (!rawCodeTemplate) {
|
|
163
178
|
throw new Error(
|
|
164
179
|
`Skill "${skillName}" has no codeTemplate. Add a code file, inline codeTemplate, or bind it to an installed plugin skill.`,
|
|
@@ -282,6 +297,32 @@ export class SkillExecutionTask {
|
|
|
282
297
|
status = result.success ? 'succeeded' : 'failed';
|
|
283
298
|
}
|
|
284
299
|
|
|
300
|
+
// Spill oversized stdout: the full text moves to the execution's output directory (served
|
|
301
|
+
// by the existing download endpoint) and the inline result becomes a head/tail preview, so
|
|
302
|
+
// one huge output cannot blow up the model's context.
|
|
303
|
+
if (spillMaxInlineBytes && typeof result.stdout === 'string') {
|
|
304
|
+
const spillName = 'stdout-full.txt';
|
|
305
|
+
const spillPath = resolve(this.fileManager.getOutputDir(execId), spillName);
|
|
306
|
+
const locator = `/api/skillHub:download?execId=${execId}&f=${Buffer.from(spillName).toString('base64url')}`;
|
|
307
|
+
const replaced = spilledText(result.stdout, spillMaxInlineBytes, locator);
|
|
308
|
+
if (replaced) {
|
|
309
|
+
try {
|
|
310
|
+
writeFileSync(spillPath, result.stdout, 'utf8');
|
|
311
|
+
result.stdout = replaced;
|
|
312
|
+
result.files = [
|
|
313
|
+
...(result.files || []),
|
|
314
|
+
{ name: spillName, size: statSync(spillPath).size, mimeType: 'text/plain' },
|
|
315
|
+
];
|
|
316
|
+
} catch (spillError) {
|
|
317
|
+
// Best effort like dsh: a spill failure keeps the original inline output rather
|
|
318
|
+
// than turning a successful execution into an error.
|
|
319
|
+
(this as any).app.logger.warn(`[skill-hub] Task ${execId}: stdout spill failed`, {
|
|
320
|
+
error: spillError,
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
285
326
|
const completed = await this.updateIfOwned(execId, workerId, {
|
|
286
327
|
status,
|
|
287
328
|
stdout: result.stdout,
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import type { Database } from '@nocobase/database';
|
|
2
|
-
|
|
3
|
-
const INDEXED_COLLECTIONS = [
|
|
4
|
-
'agentExecutionSpans',
|
|
5
|
-
'agentHarnessProfiles',
|
|
6
|
-
'agentHarnessProfileVersions',
|
|
7
|
-
'agentLoopActionApprovals',
|
|
8
|
-
'agentLoopArtifacts',
|
|
9
|
-
'agentLoopCircuitStates',
|
|
10
|
-
'agentLoopControlSettings',
|
|
11
|
-
'agentLoopEvents',
|
|
12
|
-
'agentLoopPathLocks',
|
|
13
|
-
'agentLoopPatterns',
|
|
14
|
-
'agentLoopRuns',
|
|
15
|
-
'agentLoopSteps',
|
|
16
|
-
'agentLoopUsageBuckets',
|
|
17
|
-
'agentLoopWorktrees',
|
|
18
|
-
'agentMemoryContexts',
|
|
19
|
-
'orchestratorConfig',
|
|
20
|
-
'skillRegistryInstallations',
|
|
21
|
-
] as const;
|
|
22
|
-
|
|
23
|
-
type PhysicalIndex = {
|
|
24
|
-
name?: string;
|
|
25
|
-
fields?: Array<{ attribute?: string } | string>;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
function resolvePhysicalField(collection: ReturnType<Database['getCollection']>, field: unknown): string | null {
|
|
29
|
-
if (typeof field === 'string') {
|
|
30
|
-
return collection.model.rawAttributes[field]?.field || field;
|
|
31
|
-
}
|
|
32
|
-
if (field && typeof field === 'object' && 'name' in field && typeof (field as { name: unknown }).name === 'string') {
|
|
33
|
-
const name = (field as { name: string }).name;
|
|
34
|
-
return collection.model.rawAttributes[name]?.field || name;
|
|
35
|
-
}
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function deriveIndexName(tableName: unknown, fieldNames: string[]) {
|
|
40
|
-
const table =
|
|
41
|
-
typeof tableName === 'string' ? tableName : String((tableName as { tableName?: string })?.tableName ?? '');
|
|
42
|
-
return `${table}_${fieldNames.join('_')}`.replace(/[^a-zA-Z0-9_]/g, '_');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function physicalIndexFieldKey(index: PhysicalIndex): string {
|
|
46
|
-
return (index.fields || []).map((field) => (typeof field === 'string' ? field : field?.attribute || '')).join(',');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export async function ensureAgentOrchestratorIndexes(database: Database) {
|
|
50
|
-
const queryInterface = database.sequelize.getQueryInterface();
|
|
51
|
-
|
|
52
|
-
for (const collectionName of INDEXED_COLLECTIONS) {
|
|
53
|
-
const collection = database.getCollection(collectionName);
|
|
54
|
-
if (!collection) continue;
|
|
55
|
-
|
|
56
|
-
const tableName = collection.getTableNameWithSchema();
|
|
57
|
-
const physicalIndexes = (await queryInterface.showIndex(tableName)) as PhysicalIndex[];
|
|
58
|
-
const physicalIndexNames = new Set(physicalIndexes.flatMap((index) => (index.name ? [index.name] : [])));
|
|
59
|
-
// Track existing indexes by their ordered column composition so we skip an
|
|
60
|
-
// index the framework's own db.sync() already created under a different name.
|
|
61
|
-
const physicalFieldKeys = new Set(physicalIndexes.map(physicalIndexFieldKey));
|
|
62
|
-
|
|
63
|
-
for (const index of collection.model.options.indexes || []) {
|
|
64
|
-
if (!index.fields?.length) continue;
|
|
65
|
-
|
|
66
|
-
const physicalFieldNames = index.fields
|
|
67
|
-
.map((field) => resolvePhysicalField(collection, field))
|
|
68
|
-
.filter((name): name is string => !!name);
|
|
69
|
-
if (physicalFieldKeys.has(physicalFieldNames.join(','))) continue;
|
|
70
|
-
|
|
71
|
-
const resolvedFields = index.fields.map((field) => {
|
|
72
|
-
if (typeof field === 'string') {
|
|
73
|
-
return collection.model.rawAttributes[field]?.field || field;
|
|
74
|
-
}
|
|
75
|
-
if (field && typeof field === 'object' && 'name' in field && typeof field.name === 'string') {
|
|
76
|
-
return {
|
|
77
|
-
...field,
|
|
78
|
-
name: collection.model.rawAttributes[field.name]?.field || field.name,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return field;
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const indexName = index.name || deriveIndexName(tableName, physicalFieldNames);
|
|
85
|
-
if (physicalIndexNames.has(indexName)) continue;
|
|
86
|
-
|
|
87
|
-
await queryInterface.addIndex(tableName, {
|
|
88
|
-
name: indexName,
|
|
89
|
-
fields: resolvedFields,
|
|
90
|
-
unique: index.unique,
|
|
91
|
-
});
|
|
92
|
-
physicalIndexNames.add(indexName);
|
|
93
|
-
physicalFieldKeys.add(physicalFieldNames.join(','));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
1
|
+
import type { Database } from '@nocobase/database';
|
|
2
|
+
|
|
3
|
+
const INDEXED_COLLECTIONS = [
|
|
4
|
+
'agentExecutionSpans',
|
|
5
|
+
'agentHarnessProfiles',
|
|
6
|
+
'agentHarnessProfileVersions',
|
|
7
|
+
'agentLoopActionApprovals',
|
|
8
|
+
'agentLoopArtifacts',
|
|
9
|
+
'agentLoopCircuitStates',
|
|
10
|
+
'agentLoopControlSettings',
|
|
11
|
+
'agentLoopEvents',
|
|
12
|
+
'agentLoopPathLocks',
|
|
13
|
+
'agentLoopPatterns',
|
|
14
|
+
'agentLoopRuns',
|
|
15
|
+
'agentLoopSteps',
|
|
16
|
+
'agentLoopUsageBuckets',
|
|
17
|
+
'agentLoopWorktrees',
|
|
18
|
+
'agentMemoryContexts',
|
|
19
|
+
'orchestratorConfig',
|
|
20
|
+
'skillRegistryInstallations',
|
|
21
|
+
] as const;
|
|
22
|
+
|
|
23
|
+
type PhysicalIndex = {
|
|
24
|
+
name?: string;
|
|
25
|
+
fields?: Array<{ attribute?: string } | string>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function resolvePhysicalField(collection: ReturnType<Database['getCollection']>, field: unknown): string | null {
|
|
29
|
+
if (typeof field === 'string') {
|
|
30
|
+
return collection.model.rawAttributes[field]?.field || field;
|
|
31
|
+
}
|
|
32
|
+
if (field && typeof field === 'object' && 'name' in field && typeof (field as { name: unknown }).name === 'string') {
|
|
33
|
+
const name = (field as { name: string }).name;
|
|
34
|
+
return collection.model.rawAttributes[name]?.field || name;
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function deriveIndexName(tableName: unknown, fieldNames: string[]) {
|
|
40
|
+
const table =
|
|
41
|
+
typeof tableName === 'string' ? tableName : String((tableName as { tableName?: string })?.tableName ?? '');
|
|
42
|
+
return `${table}_${fieldNames.join('_')}`.replace(/[^a-zA-Z0-9_]/g, '_');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function physicalIndexFieldKey(index: PhysicalIndex): string {
|
|
46
|
+
return (index.fields || []).map((field) => (typeof field === 'string' ? field : field?.attribute || '')).join(',');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function ensureAgentOrchestratorIndexes(database: Database) {
|
|
50
|
+
const queryInterface = database.sequelize.getQueryInterface();
|
|
51
|
+
|
|
52
|
+
for (const collectionName of INDEXED_COLLECTIONS) {
|
|
53
|
+
const collection = database.getCollection(collectionName);
|
|
54
|
+
if (!collection) continue;
|
|
55
|
+
|
|
56
|
+
const tableName = collection.getTableNameWithSchema();
|
|
57
|
+
const physicalIndexes = (await queryInterface.showIndex(tableName)) as PhysicalIndex[];
|
|
58
|
+
const physicalIndexNames = new Set(physicalIndexes.flatMap((index) => (index.name ? [index.name] : [])));
|
|
59
|
+
// Track existing indexes by their ordered column composition so we skip an
|
|
60
|
+
// index the framework's own db.sync() already created under a different name.
|
|
61
|
+
const physicalFieldKeys = new Set(physicalIndexes.map(physicalIndexFieldKey));
|
|
62
|
+
|
|
63
|
+
for (const index of collection.model.options.indexes || []) {
|
|
64
|
+
if (!index.fields?.length) continue;
|
|
65
|
+
|
|
66
|
+
const physicalFieldNames = index.fields
|
|
67
|
+
.map((field) => resolvePhysicalField(collection, field))
|
|
68
|
+
.filter((name): name is string => !!name);
|
|
69
|
+
if (physicalFieldKeys.has(physicalFieldNames.join(','))) continue;
|
|
70
|
+
|
|
71
|
+
const resolvedFields = index.fields.map((field) => {
|
|
72
|
+
if (typeof field === 'string') {
|
|
73
|
+
return collection.model.rawAttributes[field]?.field || field;
|
|
74
|
+
}
|
|
75
|
+
if (field && typeof field === 'object' && 'name' in field && typeof field.name === 'string') {
|
|
76
|
+
return {
|
|
77
|
+
...field,
|
|
78
|
+
name: collection.model.rawAttributes[field.name]?.field || field.name,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return field;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const indexName = index.name || deriveIndexName(tableName, physicalFieldNames);
|
|
85
|
+
if (physicalIndexNames.has(indexName)) continue;
|
|
86
|
+
|
|
87
|
+
await queryInterface.addIndex(tableName, {
|
|
88
|
+
name: indexName,
|
|
89
|
+
fields: resolvedFields,
|
|
90
|
+
unique: index.unique,
|
|
91
|
+
});
|
|
92
|
+
physicalIndexNames.add(indexName);
|
|
93
|
+
physicalFieldKeys.add(physicalFieldNames.join(','));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
// ── Shared logging for delegation events ───────────────────────────────
|
|
2
|
-
|
|
3
|
-
import { DelegationLogData } from '../types';
|
|
4
|
-
import { trimText, toPlain } from './ctx-utils';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Log (or update) a delegation event in the orchestratorLogs collection.
|
|
8
|
-
*/
|
|
9
|
-
export async function logDelegation(ctx: any, plugin: any, data: DelegationLogData) {
|
|
10
|
-
try {
|
|
11
|
-
const logsRepo = plugin.db.getRepository('orchestratorLogs');
|
|
12
|
-
if (!logsRepo) {
|
|
13
|
-
plugin.app.log?.warn?.('[AgentOrchestrator] orchestratorLogs repository not found — skipping log');
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
let userId: number | string | undefined = data.userId;
|
|
18
|
-
if (userId == null) {
|
|
19
|
-
try {
|
|
20
|
-
userId = ctx?.auth?.user?.id || ctx?.state?.currentUser?.id;
|
|
21
|
-
} catch {
|
|
22
|
-
// ctx lifecycle ended
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const values = {
|
|
27
|
-
leaderUsername: data.leaderUsername,
|
|
28
|
-
subAgentUsername: data.subAgentUsername,
|
|
29
|
-
toolName: data.toolName,
|
|
30
|
-
task: trimText(data.task, 10000),
|
|
31
|
-
context: trimText(data.context || '', 10000),
|
|
32
|
-
result: trimText(data.result || '', 50000),
|
|
33
|
-
status: data.status,
|
|
34
|
-
depth: data.depth,
|
|
35
|
-
durationMs: data.durationMs,
|
|
36
|
-
error: trimText(data.error || '', 10000),
|
|
37
|
-
trace: data.trace || [],
|
|
38
|
-
messages: data.messages || [],
|
|
39
|
-
userId,
|
|
40
|
-
updatedAt: new Date(),
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
if (data.id) {
|
|
44
|
-
await logsRepo.update({
|
|
45
|
-
filterByTk: data.id,
|
|
46
|
-
values,
|
|
47
|
-
});
|
|
48
|
-
return { id: data.id };
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const record = await logsRepo.create({
|
|
52
|
-
values: {
|
|
53
|
-
...values,
|
|
54
|
-
createdAt: new Date(),
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
return toPlain(record);
|
|
58
|
-
} catch (e) {
|
|
59
|
-
plugin.app.log?.warn?.('[AgentOrchestrator] Failed to log delegation event', e);
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
// ── Shared logging for delegation events ───────────────────────────────
|
|
2
|
+
|
|
3
|
+
import { DelegationLogData } from '../types';
|
|
4
|
+
import { trimText, toPlain } from './ctx-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Log (or update) a delegation event in the orchestratorLogs collection.
|
|
8
|
+
*/
|
|
9
|
+
export async function logDelegation(ctx: any, plugin: any, data: DelegationLogData) {
|
|
10
|
+
try {
|
|
11
|
+
const logsRepo = plugin.db.getRepository('orchestratorLogs');
|
|
12
|
+
if (!logsRepo) {
|
|
13
|
+
plugin.app.log?.warn?.('[AgentOrchestrator] orchestratorLogs repository not found — skipping log');
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let userId: number | string | undefined = data.userId;
|
|
18
|
+
if (userId == null) {
|
|
19
|
+
try {
|
|
20
|
+
userId = ctx?.auth?.user?.id || ctx?.state?.currentUser?.id;
|
|
21
|
+
} catch {
|
|
22
|
+
// ctx lifecycle ended
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const values = {
|
|
27
|
+
leaderUsername: data.leaderUsername,
|
|
28
|
+
subAgentUsername: data.subAgentUsername,
|
|
29
|
+
toolName: data.toolName,
|
|
30
|
+
task: trimText(data.task, 10000),
|
|
31
|
+
context: trimText(data.context || '', 10000),
|
|
32
|
+
result: trimText(data.result || '', 50000),
|
|
33
|
+
status: data.status,
|
|
34
|
+
depth: data.depth,
|
|
35
|
+
durationMs: data.durationMs,
|
|
36
|
+
error: trimText(data.error || '', 10000),
|
|
37
|
+
trace: data.trace || [],
|
|
38
|
+
messages: data.messages || [],
|
|
39
|
+
userId,
|
|
40
|
+
updatedAt: new Date(),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
if (data.id) {
|
|
44
|
+
await logsRepo.update({
|
|
45
|
+
filterByTk: data.id,
|
|
46
|
+
values,
|
|
47
|
+
});
|
|
48
|
+
return { id: data.id };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const record = await logsRepo.create({
|
|
52
|
+
values: {
|
|
53
|
+
...values,
|
|
54
|
+
createdAt: new Date(),
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
return toPlain(record);
|
|
58
|
+
} catch (e) {
|
|
59
|
+
plugin.app.log?.warn?.('[AgentOrchestrator] Failed to log delegation event', e);
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type { Plugin } from '@nocobase/server';
|
|
2
|
-
import { asObject } from './ctx-utils';
|
|
3
|
-
|
|
4
|
-
export function worktreeCapability(plugin: Plugin) {
|
|
5
|
-
const pluginManager = plugin.app.pm as unknown as { get?: (name: string) => unknown };
|
|
6
|
-
const gitManager = pluginManager.get?.('plugin-git-manager') as { loopWorktreeService?: unknown } | undefined;
|
|
7
|
-
return {
|
|
8
|
-
available: Boolean(gitManager?.loopWorktreeService),
|
|
9
|
-
provider: gitManager?.loopWorktreeService ? 'plugin-git-manager' : undefined,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function employeeHarnessResolver(plugin: Plugin) {
|
|
14
|
-
return async (username: string) => {
|
|
15
|
-
const employee = await plugin.db.getRepository('aiEmployees')?.findOne({ filter: { username } });
|
|
16
|
-
if (!employee) return undefined;
|
|
17
|
-
const skillSettings = asObject(employee.get?.('skillSettings'));
|
|
18
|
-
return skillSettings.orchestratorHarness;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
1
|
+
import type { Plugin } from '@nocobase/server';
|
|
2
|
+
import { asObject } from './ctx-utils';
|
|
3
|
+
|
|
4
|
+
export function worktreeCapability(plugin: Plugin) {
|
|
5
|
+
const pluginManager = plugin.app.pm as unknown as { get?: (name: string) => unknown };
|
|
6
|
+
const gitManager = pluginManager.get?.('plugin-git-manager') as { loopWorktreeService?: unknown } | undefined;
|
|
7
|
+
return {
|
|
8
|
+
available: Boolean(gitManager?.loopWorktreeService),
|
|
9
|
+
provider: gitManager?.loopWorktreeService ? 'plugin-git-manager' : undefined,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function employeeHarnessResolver(plugin: Plugin) {
|
|
14
|
+
return async (username: string) => {
|
|
15
|
+
const employee = await plugin.db.getRepository('aiEmployees')?.findOne({ filter: { username } });
|
|
16
|
+
if (!employee) return undefined;
|
|
17
|
+
const skillSettings = asObject(employee.get?.('skillSettings'));
|
|
18
|
+
return skillSettings.orchestratorHarness;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
"use strict";(self.webpackChunkplugin_agent_orchestrator_client_v2=self.webpackChunkplugin_agent_orchestrator_client_v2||[]).push([["214"],{349:function(e,t,r){r.r(t),r.d(t,{default:function(){return p}});var n=r(155),a=r.n(n),o=r(59),l=r(375),u=r(608),c=r(603);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t,r,n,a,o,l){try{var u=e[o](l),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,a)}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],l=!0,u=!1;try{for(a=a.call(e);!(l=(r=a.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{l||null==a.return||a.return()}finally{if(u)throw n}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}o.Typography.Title,o.Typography.Text;var d=function(){var e=(0,u.R)(),t=(0,c.k)(),r=f((0,n.useState)([]),2),i=r[0],d=r[1],p=f((0,n.useState)(!1),2),y=p[0],b=p[1],v=(0,n.useCallback)(function(){var t;return(t=function(){var t,r,n,a,o;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:c(0)}),u(l,"throw",{value:c(1)}),u(l,"return",{value:c(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function c(u){return function(c){var i=[u,c];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,i[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:b(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,e.request({url:"skillExecutions:list",params:{pageSize:1e3,sort:["-createdAt"],appends:["skill"]}})];case 2:return d(Array.isArray(o=null!=(t=null!=(r=null==(a=l.sent().data)||null==(n=a.data)?void 0:n.data)?r:null==a?void 0:a.data)?t:[])?o:[]),[3,5];case 3:return l.sent(),[3,5];case 4:return b(!1),[7];case 5:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,a){var o=t.apply(e,r);function l(e){s(o,n,a,l,u,"next",e)}function u(e){s(o,n,a,l,u,"throw",e)}l(void 0)})})()},[e]);(0,n.useEffect)(function(){v()},[v]);var m=(0,n.useMemo)(function(){var e=i.length,t=i.filter(function(e){return"succeeded"===e.status}).length,r=i.filter(function(e){return"failed"===e.status}).length,n=i.filter(function(e){return"timeout"===e.status}).length,a=i.filter(function(e){return"canceled"===e.status}).length,o={};return i.forEach(function(e){var t,r,n=(null==(t=e.skill)?void 0:t.title)||(null==(r=e.skill)?void 0:r.name)||"Unknown";o[n]||(o[n]={name:n,total:0,succeeded:0,failed:0,timeout:0,canceled:0,totalDuration:0,durationCount:0}),o[n].total+=1,o[n][e.status]=(o[n][e.status]||0)+1,e.durationMs&&(o[n].totalDuration+=e.durationMs,o[n].durationCount+=1)}),{total:e,succeeded:t,failed:r,timeout:n,canceled:a,skillData:Object.values(o).map(function(e){var t,r;return t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},e),r=r={successRate:e.total>0?e.succeeded/e.total*100:0,avgDuration:e.durationCount>0?(e.totalDuration/e.durationCount/1e3).toFixed(2):0},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t}).sort(function(e,t){return t.total-e.total})}},[i]),h=[{title:t("Skill"),dataIndex:"name",key:"name",width:200},{title:t("Total Runs"),dataIndex:"total",key:"total",width:100},{title:t("Success Rate"),dataIndex:"successRate",key:"successRate",width:150,render:function(e){return a().createElement(o.Progress,{percent:Math.round(e),size:"small",status:100===e?"success":e>50?"active":"exception"})}},{title:t("Success"),dataIndex:"succeeded",key:"succeeded",width:100},{title:t("Failed"),dataIndex:"failed",key:"failed",width:100},{title:t("Timeout"),dataIndex:"timeout",key:"timeout",width:100},{title:t("Avg Duration (s)"),dataIndex:"avgDuration",key:"avgDuration",width:120}];return a().createElement(o.Space,{direction:"vertical",size:"large",style:{width:"100%",padding:"0 16px"}},a().createElement(o.Row,{gutter:16},a().createElement(o.Col,{span:6},a().createElement(o.Card,{size:"small"},a().createElement(o.Statistic,{title:t("Total Executions (Recent)"),value:m.total,prefix:a().createElement(l.SyncOutlined,null)}))),a().createElement(o.Col,{span:6},a().createElement(o.Card,{size:"small"},a().createElement(o.Statistic,{title:t("Succeeded"),value:m.succeeded,valueStyle:{color:"#3f8600"},prefix:a().createElement(l.CheckCircleOutlined,null)}))),a().createElement(o.Col,{span:6},a().createElement(o.Card,{size:"small"},a().createElement(o.Statistic,{title:t("Failed"),value:m.failed,valueStyle:{color:"#cf1322"},prefix:a().createElement(l.CloseCircleOutlined,null)}))),a().createElement(o.Col,{span:6},a().createElement(o.Card,{size:"small"},a().createElement(o.Statistic,{title:t("Timeout/Canceled"),value:m.timeout+m.canceled,valueStyle:{color:"#faad14"},prefix:a().createElement(l.ClockCircleOutlined,null)})))),a().createElement(o.Card,{title:t("Metrics by Skill (Recent)")},a().createElement(o.Table,{dataSource:m.skillData,columns:h,rowKey:"name",loading:y,pagination:!1,size:"middle",scroll:{x:"max-content"}})))},p=function(){return a().createElement("div",{style:{padding:"0 24px 24px"}},a().createElement(d,null))}},608:function(e,t,r){r.d(t,{R:function(){return i},b:function(){return s}});var n=r(485),a=r(155);function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t,r,n,a,o,l){try{var u=e[o](l),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,a)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],l=!0,u=!1;try{for(a=a.call(e);!(l=(r=a.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{l||null==a.return||a.return()}finally{if(u)throw n}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function i(){return(0,n.useApp)().apiClient}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(),n=t.manual,o=void 0!==n&&n,s=t.refreshDeps,f=t.onSuccess,d=t.onError,p=u((0,a.useState)(void 0),2),y=p[0],b=p[1],v=u((0,a.useState)(!o),2),m=v[0],h=v[1],g=u((0,a.useState)(void 0),2),O=g[0],w=g[1],S=(0,a.useRef)(e);S.current=e;var k=(0,a.useRef)(f);k.current=f;var j=(0,a.useRef)(d);j.current=d;var E=(0,a.useRef)(!0),x=(0,a.useRef)(0);(0,a.useEffect)(function(){return E.current=!0,function(){E.current=!1}},[]);var C=(0,a.useCallback)(function(e){var t;return(t=function(){var t,n,a,o,l,u,i,s,f;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:c(0)}),u(l,"throw",{value:c(1)}),u(l,"return",{value:c(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function c(u){return function(c){var i=[u,c];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,i[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}(this,function(d){switch(d.label){case 0:t=S.current,n=++x.current,a=function(){return E.current&&n===x.current},h(!0),w(void 0),d.label=1;case 1:if(d.trys.push([1,6,7,8]),"function"!=typeof t)return[3,3];return[4,t()];case 2:return l=d.sent(),[3,5];case 3:return[4,r.request({url:t.url,method:t.method||"get",params:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},t.params||{},e||{}),data:t.data})];case 4:l=(i=null==(u=d.sent())?void 0:u.data)&&(void 0===i?"undefined":c(i))==="object"&&i.data&&"object"===c(i.data)&&"data"in i.data?i.data:i,d.label=5;case 5:if(!a())return[2,void 0];return b(l),null==(o=k.current)||o.call(k,l),[2,l];case 6:if(s=d.sent(),!a())return[2,void 0];return w(s),null==(f=j.current)||f.call(j,s),[2,void 0];case 7:return a()&&h(!1),[7];case 8:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,a){var o=t.apply(e,r);function u(e){l(o,n,a,u,c,"next",e)}function c(e){l(o,n,a,u,c,"throw",e)}u(void 0)})})()},[r]),P=(0,a.useCallback)(function(){C()},[C]);return(0,a.useEffect)(function(){o||C()},void 0===s?[]:s),{data:y,loading:m,error:O,refresh:P,run:C}}},603:function(e,t,r){r.d(t,{k:function(){return o}});var n=r(485),a=r(155);function o(){var e=(0,n.useApp)();return(0,a.useCallback)(function(t,r){return e.i18n.t(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({ns:["plugin-agent-orchestrator","client"]},r))},[e.i18n])}}}]);
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
"use strict";(self.webpackChunkplugin_agent_orchestrator_client_v2=self.webpackChunkplugin_agent_orchestrator_client_v2||[]).push([["373"],{380:function(e,t,n){n.r(t);var l=n(155),r=n.n(l),a=n(532),c=n(804);t.default=function(){return r().createElement(a.l,null,r().createElement("div",{style:{padding:"0 24px 24px"}},r().createElement(c.H,null)))}}}]);
|