plugin-agent-orchestrator 1.1.3 → 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 +1 -1
- 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 +15 -1
- 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,185 @@
|
|
|
1
|
+
import type { Database, Model } from '@nocobase/database';
|
|
2
|
+
import type { CompiledHarness } from './HarnessCompiler';
|
|
3
|
+
import type { LoopPatternPolicy } from './LoopPatternSchema';
|
|
4
|
+
import type { LoopRunStateMachine } from './LoopRunStateMachine';
|
|
5
|
+
import type { PluginAiRuntimeAdapter } from './PluginAiRuntimeAdapter';
|
|
6
|
+
import { parseVerificationVerdict } from './VerificationSchema';
|
|
7
|
+
import type { VerificationVerdict } from './VerificationSchema';
|
|
8
|
+
|
|
9
|
+
export type VerificationRequest = {
|
|
10
|
+
runId: number;
|
|
11
|
+
goal: string;
|
|
12
|
+
autonomyLevel: 'L1' | 'L2' | 'L3';
|
|
13
|
+
verifierUsername: string;
|
|
14
|
+
leaderUsername: string;
|
|
15
|
+
makerUsernames: string[];
|
|
16
|
+
verifierHarness: CompiledHarness;
|
|
17
|
+
policy: LoopPatternPolicy;
|
|
18
|
+
makerSummary: string;
|
|
19
|
+
userId?: number;
|
|
20
|
+
workerId: string;
|
|
21
|
+
leaseToken: string;
|
|
22
|
+
signal: AbortSignal;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type VerificationOutcome = {
|
|
26
|
+
verdict: VerificationVerdict;
|
|
27
|
+
finalStatus: 'succeeded' | 'waiting_human' | 'failed';
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function read(record: Model | Record<string, unknown>, key: string) {
|
|
31
|
+
const model = record as Model & { get?: (name: string) => unknown };
|
|
32
|
+
return typeof model.get === 'function' ? model.get(key) : (record as Record<string, unknown>)[key];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// The verifier answers in prose around its JSON verdict, so the object is located rather than
|
|
36
|
+
// assumed to be the whole response.
|
|
37
|
+
function extractVerdictObject(content: string): unknown {
|
|
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
|
+
|
|
48
|
+
function verifierPrompt(input: VerificationRequest, artifacts: Array<Record<string, unknown>>) {
|
|
49
|
+
const catalogue = artifacts.length
|
|
50
|
+
? artifacts.map((artifact) => `- id=${artifact.id} kind=${artifact.kind} title=${artifact.title || ''}`).join('\n')
|
|
51
|
+
: '- (none)';
|
|
52
|
+
return [
|
|
53
|
+
'You are the independent verifier for an autonomous run. You did not produce this work.',
|
|
54
|
+
`Goal: ${input.goal}`,
|
|
55
|
+
'',
|
|
56
|
+
'Reported result:',
|
|
57
|
+
input.makerSummary || '(the maker produced no textual summary)',
|
|
58
|
+
'',
|
|
59
|
+
'Evidence artifacts recorded for this run:',
|
|
60
|
+
catalogue,
|
|
61
|
+
'',
|
|
62
|
+
`Required checks: ${input.policy.verification.requiredChecks.join(', ')}`,
|
|
63
|
+
'',
|
|
64
|
+
'Reply with a single JSON object and nothing else:',
|
|
65
|
+
'{"verdict":"pass|reject|escalate","summary":"...","checks":[{"name":"...","status":"pass|fail|skipped",',
|
|
66
|
+
'"evidenceArtifactIds":[<artifact ids from the list above>]}],"residualRisks":["..."]}',
|
|
67
|
+
'Every check you mark "pass" must cite at least one artifact id from the list above.',
|
|
68
|
+
'If the evidence does not support the goal, answer "reject". Never invent artifact ids.',
|
|
69
|
+
].join('\n');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export class VerificationService {
|
|
73
|
+
constructor(
|
|
74
|
+
private readonly database: Database,
|
|
75
|
+
private readonly runtime: PluginAiRuntimeAdapter,
|
|
76
|
+
private readonly stateMachine: LoopRunStateMachine,
|
|
77
|
+
) {}
|
|
78
|
+
|
|
79
|
+
async verifyAndFinalize(input: VerificationRequest): Promise<VerificationOutcome> {
|
|
80
|
+
this.assertIndependentVerifier(input);
|
|
81
|
+
const artifacts = await this.runArtifacts(input.runId);
|
|
82
|
+
const verdict = await this.collectVerdict(input, artifacts);
|
|
83
|
+
await this.assertEvidenceBelongsToRun(verdict, artifacts, input.verifierUsername);
|
|
84
|
+
|
|
85
|
+
const finalStatus = this.finalStatusFor(verdict, input.autonomyLevel);
|
|
86
|
+
await this.stateMachine.transition({
|
|
87
|
+
runId: input.runId,
|
|
88
|
+
to: finalStatus,
|
|
89
|
+
actorType: 'worker',
|
|
90
|
+
actorIdentity: input.workerId,
|
|
91
|
+
leaseToken: input.leaseToken,
|
|
92
|
+
eventType: 'run_verified',
|
|
93
|
+
title: `Verifier returned ${verdict.verdict}`,
|
|
94
|
+
content: verdict.summary,
|
|
95
|
+
correlationKey: `verified:${input.runId}:${verdict.verdict}`,
|
|
96
|
+
values: {
|
|
97
|
+
verifierVerdict: verdict.verdict,
|
|
98
|
+
verifierEvidence: verdict,
|
|
99
|
+
summary: verdict.summary,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
return { verdict, finalStatus };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
private assertIndependentVerifier(input: VerificationRequest) {
|
|
106
|
+
const verifier = input.verifierUsername.trim();
|
|
107
|
+
if (!verifier) throw new Error('The run snapshot does not name a verifier.');
|
|
108
|
+
if (verifier === input.leaderUsername || input.makerUsernames.includes(verifier)) {
|
|
109
|
+
throw new Error('The verifier must be a different employee from the leader and every maker.');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private async collectVerdict(input: VerificationRequest, artifacts: Array<Record<string, unknown>>) {
|
|
114
|
+
const sessionId = await this.runtime.createConversation({
|
|
115
|
+
username: input.verifierUsername,
|
|
116
|
+
userId: input.userId,
|
|
117
|
+
runId: input.runId,
|
|
118
|
+
title: `Verification of run ${input.runId}`,
|
|
119
|
+
});
|
|
120
|
+
const outcome = await this.runtime.invoke({
|
|
121
|
+
username: input.verifierUsername,
|
|
122
|
+
sessionId,
|
|
123
|
+
userId: input.userId,
|
|
124
|
+
systemMessage:
|
|
125
|
+
'You verify completed work against its stated goal using only recorded evidence. You never modify anything.',
|
|
126
|
+
harness: input.verifierHarness,
|
|
127
|
+
prompt: verifierPrompt(input, artifacts),
|
|
128
|
+
signal: input.signal,
|
|
129
|
+
});
|
|
130
|
+
// A verifier that stops to ask for approval cannot produce a trustworthy verdict, and its
|
|
131
|
+
// interrupted tool call would otherwise be silently dropped.
|
|
132
|
+
if (outcome.interrupted.length) {
|
|
133
|
+
throw new Error('The verifier requested an approval-gated tool; verification cannot complete.');
|
|
134
|
+
}
|
|
135
|
+
const verdict = parseVerificationVerdict(extractVerdictObject(outcome.content));
|
|
136
|
+
const required = new Set(input.policy.verification.requiredChecks);
|
|
137
|
+
for (const check of verdict.checks) required.delete(check.name);
|
|
138
|
+
if (required.size) {
|
|
139
|
+
throw new Error(`The verifier omitted required checks: ${Array.from(required).join(', ')}.`);
|
|
140
|
+
}
|
|
141
|
+
return verdict;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private async assertEvidenceBelongsToRun(
|
|
145
|
+
verdict: VerificationVerdict,
|
|
146
|
+
artifacts: Array<Record<string, unknown>>,
|
|
147
|
+
verifierUsername: string,
|
|
148
|
+
) {
|
|
149
|
+
const owned = new Map(artifacts.map((artifact) => [Number(artifact.id), artifact]));
|
|
150
|
+
for (const check of verdict.checks) {
|
|
151
|
+
for (const artifactId of check.evidenceArtifactIds) {
|
|
152
|
+
const artifact = owned.get(artifactId);
|
|
153
|
+
if (!artifact) {
|
|
154
|
+
throw new Error(`Evidence artifact ${artifactId} does not belong to this run.`);
|
|
155
|
+
}
|
|
156
|
+
if (String(artifact.producerUsername || '') === verifierUsername) {
|
|
157
|
+
throw new Error(`Evidence artifact ${artifactId} was produced by the verifier itself.`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private finalStatusFor(verdict: VerificationVerdict, autonomyLevel: 'L1' | 'L2' | 'L3') {
|
|
164
|
+
if (verdict.verdict !== 'pass') {
|
|
165
|
+
return verdict.verdict === 'escalate' ? ('waiting_human' as const) : ('failed' as const);
|
|
166
|
+
}
|
|
167
|
+
const passesEveryCheck = verdict.checks.every(
|
|
168
|
+
(check) => check.status === 'pass' && check.evidenceArtifactIds.length > 0,
|
|
169
|
+
);
|
|
170
|
+
if (!passesEveryCheck) return 'failed' as const;
|
|
171
|
+
// L1 only ever reports, so a passing verdict is final. Anything that touched a repository
|
|
172
|
+
// still needs a human to accept the change.
|
|
173
|
+
return autonomyLevel === 'L1' ? ('succeeded' as const) : ('waiting_human' as const);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private async runArtifacts(runId: number) {
|
|
177
|
+
const rows = await this.database.getRepository('agentLoopArtifacts').find({ filter: { runId } });
|
|
178
|
+
return rows.map((row) => ({
|
|
179
|
+
id: Number(read(row, 'id')),
|
|
180
|
+
kind: String(read(row, 'kind') || ''),
|
|
181
|
+
title: String(read(row, 'title') || ''),
|
|
182
|
+
producerUsername: String(read(row, 'producerUsername') || ''),
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -177,6 +177,20 @@ describe('Skill Hub Git import', () => {
|
|
|
177
177
|
expect(service.readFile).not.toHaveBeenCalled();
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
+
it('localizes Git Manager bridge setup errors', async () => {
|
|
181
|
+
const { context } = createContext({ params: { repositoryId: 42, rootFolder: 'skills' } });
|
|
182
|
+
const translate = vi.fn((key: string) => `localized:${key}`);
|
|
183
|
+
(context as unknown as { t: typeof translate }).t = translate;
|
|
184
|
+
|
|
185
|
+
await expect(gitListSkills(context, vi.fn())).rejects.toMatchObject({
|
|
186
|
+
status: 424,
|
|
187
|
+
message: 'localized:Git Manager is not enabled for Skill Hub imports.',
|
|
188
|
+
});
|
|
189
|
+
expect(translate).toHaveBeenCalledWith('Git Manager is not enabled for Skill Hub imports.', {
|
|
190
|
+
ns: 'plugin-agent-orchestrator',
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
|
|
180
194
|
it('uses a virtual manifest without writing a Git checkout when skills.json is missing', async () => {
|
|
181
195
|
const service = createContentService({
|
|
182
196
|
listTree: vi.fn().mockImplementation(async ({ rootPath }: { rootPath: string }) => skillsRootEntries(rootPath)),
|
|
@@ -518,7 +532,7 @@ describe('Skill Hub Git import', () => {
|
|
|
518
532
|
actor,
|
|
519
533
|
);
|
|
520
534
|
expect(created).toEqual([
|
|
521
|
-
expect.objectContaining({ name: 'alpha', storageUrl: `git://42/agent-assets/skills@${commitSha}
|
|
535
|
+
expect.objectContaining({ name: 'alpha', storageUrl: `git://42/agent-assets/skills/alpha@${commitSha}` }),
|
|
522
536
|
]);
|
|
523
537
|
});
|
|
524
538
|
|
|
@@ -152,7 +152,7 @@ export async function gitListSkills(ctx: Context, next: () => Promise<void>) {
|
|
|
152
152
|
const rootFolder = normalizeRootFolder(ctx.action.params.rootFolder);
|
|
153
153
|
|
|
154
154
|
if (!repositoryId) {
|
|
155
|
-
ctx.throw(400, 'repositoryId and rootFolder are required');
|
|
155
|
+
ctx.throw(400, translateGitImportMessage(ctx, 'repositoryId and rootFolder are required'));
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
try {
|
|
@@ -216,7 +216,7 @@ export async function gitSyncSkills(ctx: Context, next: () => Promise<void>) {
|
|
|
216
216
|
const { skills: selectedKeys, overwrite = false, prefix = '' } = ctx.action.params.values || ctx.action.params;
|
|
217
217
|
|
|
218
218
|
if (!repositoryId || !Array.isArray(selectedKeys) || selectedKeys.length === 0) {
|
|
219
|
-
ctx.throw(400, 'repositoryId, rootFolder and skills[] are required');
|
|
219
|
+
ctx.throw(400, translateGitImportMessage(ctx, 'repositoryId, rootFolder and skills[] are required'));
|
|
220
220
|
}
|
|
221
221
|
const selectedSkillKeys = selectedKeys.filter(
|
|
222
222
|
(key): key is string => typeof key === 'string' && key.trim().length > 0,
|
|
@@ -414,6 +414,7 @@ function getGitManagerContentService(ctx: Context): GitManagerContentService {
|
|
|
414
414
|
'GIT_MANAGER_CONTENT_UNAVAILABLE',
|
|
415
415
|
424,
|
|
416
416
|
'Git Manager is not enabled for Skill Hub imports.',
|
|
417
|
+
{ key: 'Git Manager is not enabled for Skill Hub imports.' },
|
|
417
418
|
);
|
|
418
419
|
}
|
|
419
420
|
|
|
@@ -423,6 +424,7 @@ function getGitManagerContentService(ctx: Context): GitManagerContentService {
|
|
|
423
424
|
'GIT_MANAGER_CONTENT_UNAVAILABLE',
|
|
424
425
|
424,
|
|
425
426
|
'Git Manager must support actor-aware content reads for Skill Hub imports.',
|
|
427
|
+
{ key: 'Git Manager must support actor-aware content reads for Skill Hub imports.' },
|
|
426
428
|
);
|
|
427
429
|
}
|
|
428
430
|
|
|
@@ -445,6 +447,7 @@ function getGitManagerContentService(ctx: Context): GitManagerContentService {
|
|
|
445
447
|
'GIT_MANAGER_CONTENT_UNAVAILABLE',
|
|
446
448
|
424,
|
|
447
449
|
'Git Manager must support actor-aware content reads for Skill Hub imports.',
|
|
450
|
+
{ key: 'Git Manager must support actor-aware content reads for Skill Hub imports.' },
|
|
448
451
|
);
|
|
449
452
|
}
|
|
450
453
|
return service as GitManagerContentService;
|
|
@@ -457,6 +460,7 @@ function accessFromContext(ctx: Context): GitManagerAccessContext {
|
|
|
457
460
|
'SKILL_HUB_REPOSITORY_ACCESS_DENIED',
|
|
458
461
|
403,
|
|
459
462
|
'A valid user role context is required to import skills from Git Manager.',
|
|
463
|
+
{ key: 'A valid user role context is required to import skills from Git Manager.' },
|
|
460
464
|
);
|
|
461
465
|
}
|
|
462
466
|
return { kind: 'user', roles: currentRoles };
|
|
@@ -495,7 +499,9 @@ function throwGitImportError(ctx: Context, error: unknown): never {
|
|
|
495
499
|
case MISSING_GIT_FILE_CODE:
|
|
496
500
|
return throwHttpError(ctx, 404, errorMessage(error));
|
|
497
501
|
default:
|
|
498
|
-
return throwHttpError(ctx, 502, 'Git Manager could not read the requested repository content.'
|
|
502
|
+
return throwHttpError(ctx, 502, 'Git Manager could not read the requested repository content.', {
|
|
503
|
+
key: 'Git Manager could not read the requested repository content.',
|
|
504
|
+
});
|
|
499
505
|
}
|
|
500
506
|
}
|
|
501
507
|
|
|
@@ -33,11 +33,7 @@ function positiveLimit(value: string | undefined, fallback: number, maximum: num
|
|
|
33
33
|
return Number.isSafeInteger(parsed) && parsed > 0 && parsed <= maximum ? parsed : fallback;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const MAX_REGISTRY_SKILL_SNAPSHOTS = positiveLimit(
|
|
37
|
-
process.env.SKILL_REGISTRY_MAX_SOURCE_ITEMS,
|
|
38
|
-
1000,
|
|
39
|
-
10_000,
|
|
40
|
-
);
|
|
36
|
+
const MAX_REGISTRY_SKILL_SNAPSHOTS = positiveLimit(process.env.SKILL_REGISTRY_MAX_SOURCE_ITEMS, 1000, 10_000);
|
|
41
37
|
const MAX_REGISTRY_TEXT_BYTES = 10 * 1024 * 1024;
|
|
42
38
|
|
|
43
39
|
const registryExportFilter = {
|
|
@@ -48,9 +48,7 @@ describe('RegistrySkillSnapshotService', () => {
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
it('bounds provider discovery before returning an unbounded definition list', async () => {
|
|
51
|
-
const find = vi
|
|
52
|
-
.fn()
|
|
53
|
-
.mockResolvedValue(Array.from({ length: 1001 }, (_, id) => ({ get: () => id + 1 })));
|
|
51
|
+
const find = vi.fn().mockResolvedValue(Array.from({ length: 1001 }, (_, id) => ({ get: () => id + 1 })));
|
|
54
52
|
const database = {
|
|
55
53
|
getRepository: vi.fn().mockReturnValue({ find }),
|
|
56
54
|
} as unknown as Database;
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -5,7 +5,6 @@ import { trimText, toPlain } from './ctx-utils';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Log (or update) a delegation event in the orchestratorLogs collection.
|
|
8
|
-
* Used by both delegate-task.ts and AgentHarness.ts.
|
|
9
8
|
*/
|
|
10
9
|
export async function logDelegation(ctx: any, plugin: any, data: DelegationLogData) {
|
|
11
10
|
try {
|
|
@@ -0,0 +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,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),l=r(59),o=r(375),u=r(608),i=r(603);function c(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,l,o){try{var u=e[l](o),i=u.value}catch(e){r(e);return}u.done?t(i):Promise.resolve(i).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 l=[],o=!0,u=!1;try{for(a=a.call(e);!(o=(r=a.next()).done)&&(l.push(r.value),!t||l.length!==t);o=!0);}catch(e){u=!0,n=e}finally{try{o||null==a.return||a.return()}finally{if(u)throw n}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(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 c(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.")}()}l.Typography.Title,l.Typography.Text;var d=function(){var e=(0,u.R)(),t=(0,i.k)(),r=f((0,n.useState)([]),2),c=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,l;return function(e,t){var r,n,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(o,"next",{value:i(0)}),u(o,"throw",{value:i(1)}),u(o,"return",{value:i(2)}),"function"==typeof Symbol&&u(o,Symbol.iterator,{value:function(){return this}}),o;function i(u){return function(i){var c=[u,i];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(l=0)),l;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,n=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(a=(a=l.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){l.label=c[1];break}if(6===c[0]&&l.label<a[1]){l.label=a[1],a=c;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(c);break}a[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:b(!0),o.label=1;case 1:return o.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(l=null!=(t=null!=(r=null==(a=o.sent().data)||null==(n=a.data)?void 0:n.data)?r:null==a?void 0:a.data)?t:[])?l:[]),[3,5];case 3:return o.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 l=t.apply(e,r);function o(e){s(l,n,a,o,u,"next",e)}function u(e){s(l,n,a,o,u,"throw",e)}o(void 0)})})()},[e]);(0,n.useEffect)(function(){v()},[v]);var m=(0,n.useMemo)(function(){var e=c.length,t=c.filter(function(e){return"succeeded"===e.status}).length,r=c.filter(function(e){return"failed"===e.status}).length,n=c.filter(function(e){return"timeout"===e.status}).length,a=c.filter(function(e){return"canceled"===e.status}).length,l={};return c.forEach(function(e){var t,r,n=(null==(t=e.skill)?void 0:t.title)||(null==(r=e.skill)?void 0:r.name)||"Unknown";l[n]||(l[n]={name:n,total:0,succeeded:0,failed:0,timeout:0,canceled:0,totalDuration:0,durationCount:0}),l[n].total+=1,l[n][e.status]=(l[n][e.status]||0)+1,e.durationMs&&(l[n].totalDuration+=e.durationMs,l[n].durationCount+=1)}),{total:e,succeeded:t,failed:r,timeout:n,canceled:a,skillData:Object.values(l).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})}},[c]),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(l.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(l.Space,{direction:"vertical",size:"large",style:{width:"100%",padding:"0 16px"}},a().createElement(l.Row,{gutter:16},a().createElement(l.Col,{span:6},a().createElement(l.Card,{size:"small"},a().createElement(l.Statistic,{title:t("Total Executions (Recent)"),value:m.total,prefix:a().createElement(o.SyncOutlined,null)}))),a().createElement(l.Col,{span:6},a().createElement(l.Card,{size:"small"},a().createElement(l.Statistic,{title:t("Succeeded"),value:m.succeeded,valueStyle:{color:"#3f8600"},prefix:a().createElement(o.CheckCircleOutlined,null)}))),a().createElement(l.Col,{span:6},a().createElement(l.Card,{size:"small"},a().createElement(l.Statistic,{title:t("Failed"),value:m.failed,valueStyle:{color:"#cf1322"},prefix:a().createElement(o.CloseCircleOutlined,null)}))),a().createElement(l.Col,{span:6},a().createElement(l.Card,{size:"small"},a().createElement(l.Statistic,{title:t("Timeout/Canceled"),value:m.timeout+m.canceled,valueStyle:{color:"#faad14"},prefix:a().createElement(o.ClockCircleOutlined,null)})))),a().createElement(l.Card,{title:t("Metrics by Skill (Recent)")},a().createElement(l.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 c},b:function(){return s}});var n=r(485),a=r(155);function l(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 o(e,t,r,n,a,l,o){try{var u=e[l](o),i=u.value}catch(e){r(e);return}u.done?t(i):Promise.resolve(i).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 l=[],o=!0,u=!1;try{for(a=a.call(e);!(o=(r=a.next()).done)&&(l.push(r.value),!t||l.length!==t);o=!0);}catch(e){u=!0,n=e}finally{try{o||null==a.return||a.return()}finally{if(u)throw n}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(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 l(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 i(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function c(){return(0,n.useApp)().apiClient}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=c(),n=t.manual,l=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)(!l),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.useCallback)(function(e){var t;return(t=function(){var t,n,a,l,o,u,c;return function(e,t){var r,n,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(o,"next",{value:i(0)}),u(o,"throw",{value:i(1)}),u(o,"return",{value:i(2)}),"function"==typeof Symbol&&u(o,Symbol.iterator,{value:function(){return this}}),o;function i(u){return function(i){var c=[u,i];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(l=0)),l;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,n=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(a=(a=l.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){l.label=c[1];break}if(6===c[0]&&l.label<a[1]){l.label=a[1],a=c;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(c);break}a[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(s){switch(s.label){case 0:t=S.current,h(!0),w(void 0),s.label=1;case 1:if(s.trys.push([1,6,7,8]),"function"!=typeof t)return[3,3];return[4,t()];case 2:return a=s.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:a=(o=null==(l=s.sent())?void 0:l.data)&&(void 0===o?"undefined":i(o))==="object"&&o.data&&"object"===i(o.data)&&"data"in o.data?o.data:o,s.label=5;case 5:return b(a),null==(n=k.current)||n.call(k,a),[2,a];case 6:return w(u=s.sent()),null==(c=j.current)||c.call(j,u),[2,void 0];case 7:return h(!1),[7];case 8:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,a){var l=t.apply(e,r);function u(e){o(l,n,a,u,i,"next",e)}function i(e){o(l,n,a,u,i,"throw",e)}u(void 0)})})()},[r]),x=(0,a.useCallback)(function(){E()},[E]);return(0,a.useEffect)(function(){l||E()},void 0===s?[]:s),{data:y,loading:m,error:O,refresh:x,run:E}}},603:function(e,t,r){r.d(t,{k:function(){return l}});var n=r(485),a=r(155);function l(){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([["253"],{740:function(e,t,r){r.r(t),r.d(t,{default:function(){return f}});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}var s=function(){var e,t=(0,c.k)(),r=function(e){if(Array.isArray(e))return e}(e=(0,n.useState)(!1))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(t=n.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e)||function(e){if(e){if("string"==typeof e)return i(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),s=r[0],f=r[1],d=(0,u.b)({url:"agentKnowledgeInsights:accessMatrix"}),y=(0,n.useMemo)(function(){var e;return Array.isArray(null==(e=d.data)?void 0:e.data)?e.data:[]},[d.data]),p=(0,n.useMemo)(function(){return s?y.filter(function(e){return"denied"===e.access}):y},[y,s]),m=[{title:t("AI Employee"),dataIndex:"employeeUsername",key:"employeeUsername"},{title:t("Knowledge Base"),dataIndex:"knowledgeBaseName",key:"knowledgeBaseName",render:function(e,t){return a().createElement(o.Space,{size:4,wrap:!0},a().createElement("span",null,e),a().createElement(o.Tag,null,t.knowledgeBaseType))}},{title:t("Assignment"),dataIndex:"assigned",key:"assigned",width:120,render:function(e){return a().createElement(o.Tag,{color:e?"blue":"default"},e?t("Assigned"):t("Not assigned"))}},{title:t("Agent access"),dataIndex:"access",key:"access",width:130,render:function(e){return a().createElement(o.Tag,{color:"allowed"===e?"success":"error"},"allowed"===e?t("Allowed"):t("Denied"))}},{title:t("Reason"),dataIndex:"reason",key:"reason",render:function(e){return a().createElement(o.Typography.Text,null,e)}},{title:t("Runtime user gate"),dataIndex:"userGate",key:"userGate",render:function(e){return a().createElement(o.Tooltip,{title:e},a().createElement(o.Typography.Text,{ellipsis:!0,style:{maxWidth:260}},e))}}];return a().createElement(o.Card,{bordered:!1},a().createElement(o.Space,{direction:"vertical",size:16,style:{width:"100%"}},a().createElement(o.Typography.Text,{type:"secondary"},t("This matrix checks employee assignment and static agent policy. BASIC and SHARED user access is still evaluated when a run starts.")),a().createElement(o.Space,{wrap:!0},a().createElement(o.Button,{type:s?"primary":"default",onClick:function(){return f(function(e){return!e})}},s?t("Show all"):t("Show denied only")),a().createElement(o.Button,{icon:a().createElement(l.ReloadOutlined,null),onClick:d.refresh},t("Refresh"))),a().createElement(o.Table,{rowKey:"key",loading:d.loading,dataSource:p,columns:m,scroll:{x:"max-content"},pagination:{pageSize:50,showSizeChanger:!0}})))},f=function(){return a().createElement("div",{style:{padding:"0 24px 24px"}},a().createElement(s,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,y=u((0,a.useState)(void 0),2),p=y[0],m=y[1],b=u((0,a.useState)(!o),2),h=b[0],v=b[1],g=u((0,a.useState)(void 0),2),w=g[0],S=g[1],k=(0,a.useRef)(e);k.current=e;var E=(0,a.useRef)(f);E.current=f;var O=(0,a.useRef)(d);O.current=d;var A=(0,a.useCallback)(function(e){var t;return(t=function(){var t,n,a,o,l,u,i;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(s){switch(s.label){case 0:t=k.current,v(!0),S(void 0),s.label=1;case 1:if(s.trys.push([1,6,7,8]),"function"!=typeof t)return[3,3];return[4,t()];case 2:return a=s.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:a=(l=null==(o=s.sent())?void 0:o.data)&&(void 0===l?"undefined":c(l))==="object"&&l.data&&"object"===c(l.data)&&"data"in l.data?l.data:l,s.label=5;case 5:return m(a),null==(n=E.current)||n.call(E,a),[2,a];case 6:return S(u=s.sent()),null==(i=O.current)||i.call(O,u),[2,void 0];case 7:return v(!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]),x=(0,a.useCallback)(function(){A()},[A]);return(0,a.useEffect)(function(){o||A()},void 0===s?[]:s),{data:p,loading:h,error:w,refresh:x,run:A}}},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([["264"],{715:function(e,t,r){r.r(t),r.d(t,{default:function(){return b}});var n=r(155),a=r.n(n),o=r(59),u=r(375),l=r(608),i=r(603),c=r(204),s=r(472);function f(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 d(e,t,r,n,a,o,u){try{var l=e[o](u),i=l.value}catch(e){r(e);return}l.done?t(i):Promise.resolve(i).then(n,a)}function p(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function u(e){d(o,n,a,u,l,"next",e)}function l(e){d(o,n,a,u,l,"throw",e)}u(void 0)})}}function y(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=[],u=!0,l=!1;try{for(a=a.call(e);!(u=(r=a.next()).done)&&(o.push(r.value),!t||o.length!==t);u=!0);}catch(e){l=!0,n=e}finally{try{u||null==a.return||a.return()}finally{if(l)throw n}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(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 f(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 h(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(r)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var v={pending:"default",running:"processing",succeeded:"success",failed:"error",canceled:"warning",timeout:"error"},m=function(){var e=(0,l.R)(),t=(0,i.k)(),r=y((0,n.useState)([]),2),f=r[0],d=r[1],m=y((0,n.useState)(!1),2),b=m[0],g=m[1],w=y((0,n.useState)(1),2),S=w[0],k=w[1],x=y((0,n.useState)(0),2),E=x[0],O=x[1],j=(0,n.useCallback)(function(){return p(function(){var t,r,n,a,o,u;return h(this,function(l){switch(l.label){case 0:g(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,e.request({url:"skillExecutions:list",params:{page:S,pageSize:20,sort:["-createdAt"],appends:["skill","triggeredBy"]}})];case 2:return d(Array.isArray(u=null!=(t=null!=(r=null==(o=l.sent().data)||null==(n=o.data)?void 0:n.data)?r:null==o?void 0:o.data)?t:[])?u:[]),O((null==o||null==(a=o.meta)?void 0:a.count)||0),[3,5];case 3:return l.sent(),[3,5];case 4:return g(!1),[7];case 5:return[2]}})})()},[e,S]);(0,n.useEffect)(function(){j()},[j]);var A=[{title:"ID",dataIndex:"id",key:"id",width:80},{title:t("Skill"),dataIndex:["skill","title"],key:"skill",width:180},{title:t("Status"),dataIndex:"status",key:"status",width:120,render:function(e){return a().createElement(o.Tag,{color:v[e]||"default"},e)}},{title:t("Duration"),dataIndex:"durationMs",key:"duration",width:100,render:function(e){return e?"".concat((e/1e3).toFixed(1),"s"):"-"}},{title:t("Files"),dataIndex:"outputFiles",key:"files",width:250,render:function(e,t){var r=(0,c.lk)(e,[]);if(!Array.isArray(r)||!r.length)return"-";var n=r.map(function(e){return{name:e.name,url:"/api/skillHub:download?execId=".concat(t.id,"&filename=").concat(encodeURIComponent(e.name))}});return a().createElement(s.H,{files:n})}},{title:t("Triggered By"),dataIndex:["triggeredBy","nickname"],key:"triggeredBy",width:120,render:function(e){return e||"-"}},{title:t("Created At"),dataIndex:"createdAt",key:"createdAt",width:180,render:function(e){return e?new Date(e).toLocaleString():"-"}},{title:t("Output"),key:"output",width:200,render:function(e,t){return a().createElement(o.Space,{direction:"vertical",size:0},t.stdout&&a().createElement(o.Tooltip,{title:t.stdout},a().createElement(o.Typography.Text,{style:{fontSize:12,maxWidth:200},ellipsis:!0},t.stdout)),t.stderr&&a().createElement(o.Tooltip,{title:t.stderr},a().createElement(o.Typography.Text,{type:"danger",style:{fontSize:12,maxWidth:200},ellipsis:!0},t.stderr)))}},{title:t("Actions"),key:"actions",width:80,fixed:"right",render:function(r,n){return a().createElement(o.Space,{size:"middle"},a().createElement(o.Popconfirm,{title:t("Are you sure to delete this execution history and its files?"),onConfirm:function(){var r;return r=n.id,p(function(){var n,a,u,l,i;return h(this,function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),[4,e.request({url:"skillExecutions:destroy",method:"POST",params:{filterByTk:r}})];case 1:return c.sent(),o.message.success(t("Deleted successfully")),j(),[3,3];case 2:return n=c.sent(),o.message.error((null==n||null==(i=n.response)||null==(l=i.data)||null==(u=l.errors)||null==(a=u[0])?void 0:a.message)||t("Delete failed")),[3,3];case 3:return[2]}})})()},okText:t("Yes"),cancelText:t("No")},a().createElement(o.Button,{type:"text",danger:!0,icon:a().createElement(u.DeleteOutlined,null),size:"small"})))}}];return a().createElement(o.Card,{title:t("Execution History"),extra:a().createElement(o.Space,null,a().createElement(o.Button,{icon:a().createElement(u.ReloadOutlined,null),onClick:j,loading:b},t("Refresh")))},a().createElement(o.Table,{dataSource:f,columns:A,rowKey:"id",loading:b,size:"middle",pagination:{current:S,pageSize:20,total:E,onChange:k,showTotal:function(e){return"Total: ".concat(e)}},scroll:{x:1200}}))},b=function(){return a().createElement("div",{style:{padding:"0 24px 24px"}},a().createElement(m,null))}},472:function(e,t,r){r.d(t,{H:function(){return l}});var n=r(155),a=r.n(n),o=r(59),u=r(375),l=function(e){var t=e.files;return Array.isArray(t)&&0!==t.length?a().createElement(o.Space,{direction:"vertical",size:2,style:{width:"100%"}},t.map(function(e,t){var r=e.downloadUrl||e.url,n=e.name||"file-".concat(t+1);return r?a().createElement("a",{key:"".concat(n,"-").concat(t),href:r,target:"_blank",rel:"noreferrer"},a().createElement(u.PaperClipOutlined,null)," ",n):a().createElement(o.Typography.Text,{key:"".concat(n,"-").concat(t)},a().createElement(u.PaperClipOutlined,null)," ",n)})):a().createElement(o.Typography.Text,{type:"secondary"},"-")}},608:function(e,t,r){r.d(t,{R:function(){return c},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 u(e,t,r,n,a,o,u){try{var l=e[o](u),i=l.value}catch(e){r(e);return}l.done?t(i):Promise.resolve(i).then(n,a)}function l(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=[],u=!0,l=!1;try{for(a=a.call(e);!(u=(r=a.next()).done)&&(o.push(r.value),!t||o.length!==t);u=!0);}catch(e){l=!0,n=e}finally{try{u||null==a.return||a.return()}finally{if(l)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 i(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function c(){return(0,n.useApp)().apiClient}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=c(),n=t.manual,o=void 0!==n&&n,s=t.refreshDeps,f=t.onSuccess,d=t.onError,p=l((0,a.useState)(void 0),2),y=p[0],h=p[1],v=l((0,a.useState)(!o),2),m=v[0],b=v[1],g=l((0,a.useState)(void 0),2),w=g[0],S=g[1],k=(0,a.useRef)(e);k.current=e;var x=(0,a.useRef)(f);x.current=f;var E=(0,a.useRef)(d);E.current=d;var O=(0,a.useCallback)(function(e){var t;return(t=function(){var t,n,a,o,u,l,c;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:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(r)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(s){switch(s.label){case 0:t=k.current,b(!0),S(void 0),s.label=1;case 1:if(s.trys.push([1,6,7,8]),"function"!=typeof t)return[3,3];return[4,t()];case 2:return a=s.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:a=(u=null==(o=s.sent())?void 0:o.data)&&(void 0===u?"undefined":i(u))==="object"&&u.data&&"object"===i(u.data)&&"data"in u.data?u.data:u,s.label=5;case 5:return h(a),null==(n=x.current)||n.call(x,a),[2,a];case 6:return S(l=s.sent()),null==(c=E.current)||c.call(E,l),[2,void 0];case 7:return b(!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 l(e){u(o,n,a,l,i,"next",e)}function i(e){u(o,n,a,l,i,"throw",e)}l(void 0)})})()},[r]),j=(0,a.useCallback)(function(){O()},[O]);return(0,a.useEffect)(function(){o||O()},void 0===s?[]:s),{data:y,loading:m,error:w,refresh:j,run:O}}},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])}},204:function(e,t,r){function n(e,t){if(null==e||""===e)return t;if("string"!=typeof e)return e;var r=e.trim(),n=r.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i),a=n?n[1].trim():r;try{var o=JSON.parse(a);if("string"==typeof o){var u=o.trim(),l=u.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i),i=l?l[1].trim():u;try{o=JSON.parse(i)}catch(e){}}return o}catch(e){return t}}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=n(e,void 0),a=void 0===r?null==e||""===e?t:e:r;return null==a?"":"string"==typeof a?a:JSON.stringify(a,null,2)}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=n(e,void 0),a=void 0===r?null==e||""===e?t:e:r;return"```json\n".concat(JSON.stringify(a,null,2),"\n```")}r.d(t,{Bz:function(){return a},Nx:function(){return o},lk:function(){return n}})}}]);
|
|
@@ -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([["418"],{393:function(e,t,r){r.r(t),r.d(t,{default:function(){return g}});var n=r(155),a=r.n(n),l=r(59),o=r(375),i=r(608),u=r(603);function c(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,l,o){try{var i=e[l](o),u=i.value}catch(e){r(e);return}i.done?t(u):Promise.resolve(u).then(n,a)}function f(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var l=e.apply(t,r);function o(e){s(l,n,a,o,i,"next",e)}function i(e){s(l,n,a,o,i,"throw",e)}o(void 0)})}}function p(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 l=[],o=!0,i=!1;try{for(a=a.call(e);!(o=(r=a.next()).done)&&(l.push(r.value),!t||l.length!==t);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==a.return||a.return()}finally{if(i)throw n}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(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 c(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 d(e,t){var r,n,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:u(0)}),i(o,"throw",{value:u(1)}),i(o,"return",{value:u(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function u(i){return function(u){var c=[i,u];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(l=0)),l;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,n=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(a=(a=l.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){l.label=c[1];break}if(6===c[0]&&l.label<a[1]){l.label=a[1],a=c;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(c);break}a[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var m=l.Typography.Text,y=function(e){var t=String(e||"").trim();return t?JSON.parse(t):{}},b=function(){var e=(0,i.R)(),t=(0,u.k)(),r=p(a().useState(!1),2),n=r[0],c=r[1],s=p(a().useState(null),2),b=s[0],g=s[1],v=p(l.Form.useForm(),1)[0],h=(0,i.b)({url:"agentHarnessProfiles:list",params:{sort:["tag"],pageSize:100}}),w=h.data,O=h.loading,S=h.refresh,E=a().useMemo(function(){var e=null==w?void 0:w.data;return Array.isArray(e)?e:[]},[w]),P=function(e){var t,r;g(e||null),v.resetFields(),v.setFieldsValue(e?(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={settingsText:JSON.stringify(e.settings||{},null,2)},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):{tag:"",title:"",description:"",enabled:!0,settingsText:JSON.stringify({nativeObserverEnabled:!0,memoryInjectionEnabled:!0,memoryScopes:["public","user","agent_user"],maxMemoryContextChars:6e3,tracingRetentionDays:30},null,2)}),c(!0)},j=function(){c(!1),g(null)},k=[{title:t("Tag"),dataIndex:"tag",key:"tag",width:140,render:function(e){return a().createElement(l.Tag,{color:"blue"},e)}},{title:t("Title"),dataIndex:"title",key:"title",render:function(e,t){return e||t.tag}},{title:t("Enabled"),dataIndex:"enabled",key:"enabled",width:90,render:function(t,r){return a().createElement(l.Switch,{size:"small",checked:!1!==t,onChange:function(t){return f(function(){return d(this,function(n){switch(n.label){case 0:return[4,e.request({url:"agentHarnessProfiles:update",method:"put",params:{filterByTk:r.id},data:{enabled:t}})];case 1:return n.sent(),S(),[2]}})})()}})}},{title:t("Settings"),key:"settings",render:function(e,t){return a().createElement(l.Space,{size:4,wrap:!0},Object.entries(t.settings||{}).slice(0,5).map(function(e){var t=p(e,2),r=t[0],n=t[1];return a().createElement(l.Tag,{key:r},r,": ",String(n))}))}},{title:t("Actions"),key:"actions",width:150,render:function(r,n){return a().createElement(l.Space,null,a().createElement(l.Button,{type:"link",size:"small",icon:a().createElement(o.EditOutlined,null),onClick:function(){return P(n)}},t("Edit")),a().createElement(l.Popconfirm,{title:t("Delete this profile?"),onConfirm:function(){var r;return r=n.id,f(function(){var n;return d(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,e.request({url:"agentHarnessProfiles:destroy",method:"delete",params:{filterByTk:r}})];case 1:return a.sent(),l.message.success(t("Policy profile deleted")),S(),[3,3];case 2:return n=a.sent(),l.message.error(t("Delete failed: {{message}}",{message:(null==n?void 0:n.message)||t("unknown error")})),[3,3];case 3:return[2]}})})()}},a().createElement(l.Button,{type:"link",size:"small",danger:!0,icon:a().createElement(o.DeleteOutlined,null)},t("Delete"))))}}];return a().createElement("div",null,a().createElement(l.Card,{bordered:!1},a().createElement(l.Space,{direction:"vertical",size:16,style:{width:"100%"}},a().createElement("div",{style:{display:"flex",justifyContent:"space-between",gap:16}},a().createElement(m,{type:"secondary"},t("Policy profiles control native observation, memory scopes, and tracing retention.")),a().createElement(l.Button,{type:"primary",icon:a().createElement(o.PlusOutlined,null),onClick:function(){return P()}},t("New Policy"))),a().createElement(l.Table,{rowKey:"id",loading:O,dataSource:E,columns:k,pagination:!1,scroll:{x:"max-content"}}))),a().createElement(l.Drawer,{title:b?t("Edit Policy Profile"):t("New Policy Profile"),width:560,open:n,onClose:j,extra:a().createElement(l.Space,null,a().createElement(l.Button,{onClick:j},t("Cancel")),a().createElement(l.Button,{type:"primary",onClick:function(){return v.submit()}},t("Save")))},a().createElement(l.Form,{form:v,layout:"vertical",onFinish:function(r){return f(function(){var n,a,o,i,u,c,s,f;return d(this,function(p){switch(p.label){case 0:try{n=y(r.settingsText)}catch(e){return l.message.error(t("Settings JSON is invalid: {{message}}",{message:(null==e?void 0:e.message)||e})),[2]}a={tag:String(r.tag||"").trim(),title:r.title,description:r.description,enabled:!1!==r.enabled,settings:n},p.label=1;case 1:if(p.trys.push([1,6,,7]),!b)return[3,3];return[4,e.request({url:"agentHarnessProfiles:update",method:"put",params:{filterByTk:b.id},data:a})];case 2:return p.sent(),l.message.success(t("Policy profile updated")),[3,5];case 3:return[4,e.request({url:"agentHarnessProfiles:create",method:"post",data:a})];case 4:p.sent(),l.message.success(t("Policy profile created")),p.label=5;case 5:return j(),S(),[3,7];case 6:return f=(null==(o=p.sent())||null==(s=o.response)||null==(c=s.data)||null==(u=c.errors)||null==(i=u[0])?void 0:i.message)||(null==o?void 0:o.message)||"unknown error",l.message.error(t("Save failed: {{message}}",{message:f})),[3,7];case 7:return[2]}})})()}},a().createElement(l.Form.Item,{name:"tag",label:t("Tag"),rules:[{required:!0,message:t("Tag is required")}]},a().createElement(l.Input,{placeholder:t("default"),disabled:(null==b?void 0:b.tag)==="default"})),a().createElement(l.Form.Item,{name:"title",label:t("Title")},a().createElement(l.Input,null)),a().createElement(l.Form.Item,{name:"description",label:t("Description")},a().createElement(l.Input.TextArea,{rows:3})),a().createElement(l.Form.Item,{name:"settingsText",label:t("Settings JSON"),rules:[{required:!0,message:t("Settings JSON is required")}]},a().createElement(l.Input.TextArea,{rows:12,spellCheck:!1})),a().createElement(l.Form.Item,{name:"enabled",label:t("Enabled"),valuePropName:"checked"},a().createElement(l.Switch,null)))))},g=function(){return a().createElement("div",{style:{padding:"0 24px 24px"}},a().createElement(b,null))}},608:function(e,t,r){r.d(t,{R:function(){return c},b:function(){return s}});var n=r(485),a=r(155);function l(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 o(e,t,r,n,a,l,o){try{var i=e[l](o),u=i.value}catch(e){r(e);return}i.done?t(u):Promise.resolve(u).then(n,a)}function i(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 l=[],o=!0,i=!1;try{for(a=a.call(e);!(o=(r=a.next()).done)&&(l.push(r.value),!t||l.length!==t);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==a.return||a.return()}finally{if(i)throw n}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(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 l(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 u(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function c(){return(0,n.useApp)().apiClient}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=c(),n=t.manual,l=void 0!==n&&n,s=t.refreshDeps,f=t.onSuccess,p=t.onError,d=i((0,a.useState)(void 0),2),m=d[0],y=d[1],b=i((0,a.useState)(!l),2),g=b[0],v=b[1],h=i((0,a.useState)(void 0),2),w=h[0],O=h[1],S=(0,a.useRef)(e);S.current=e;var E=(0,a.useRef)(f);E.current=f;var P=(0,a.useRef)(p);P.current=p;var j=(0,a.useCallback)(function(e){var t;return(t=function(){var t,n,a,l,o,i,c;return function(e,t){var r,n,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:u(0)}),i(o,"throw",{value:u(1)}),i(o,"return",{value:u(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function u(i){return function(u){var c=[i,u];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(l=0)),l;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,n=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(a=(a=l.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){l.label=c[1];break}if(6===c[0]&&l.label<a[1]){l.label=a[1],a=c;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(c);break}a[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(s){switch(s.label){case 0:t=S.current,v(!0),O(void 0),s.label=1;case 1:if(s.trys.push([1,6,7,8]),"function"!=typeof t)return[3,3];return[4,t()];case 2:return a=s.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:a=(o=null==(l=s.sent())?void 0:l.data)&&(void 0===o?"undefined":u(o))==="object"&&o.data&&"object"===u(o.data)&&"data"in o.data?o.data:o,s.label=5;case 5:return y(a),null==(n=E.current)||n.call(E,a),[2,a];case 6:return O(i=s.sent()),null==(c=P.current)||c.call(P,i),[2,void 0];case 7:return v(!1),[7];case 8:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,a){var l=t.apply(e,r);function i(e){o(l,n,a,i,u,"next",e)}function u(e){o(l,n,a,i,u,"throw",e)}i(void 0)})})()},[r]),k=(0,a.useCallback)(function(){j()},[j]);return(0,a.useEffect)(function(){l||j()},void 0===s?[]:s),{data:m,loading:g,error:w,refresh:k,run:j}}},603:function(e,t,r){r.d(t,{k:function(){return l}});var n=r(485),a=r(155);function l(){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])}}}]);
|