plugin-agent-orchestrator 1.0.28 → 1.0.33
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 +114 -112
- package/dist/client/index.js +1 -1
- package/dist/client-v2/{214.723affb37c13bf7a.js → 214.79650a549273f163.js} +1 -1
- package/dist/client-v2/264.718a107e43fc163c.js +10 -0
- package/dist/client-v2/373.f5d5292e53c4e832.js +10 -0
- package/dist/client-v2/{41.1805b2edfaa4afe2.js → 41.ba6e080cc0488143.js} +1 -1
- package/dist/client-v2/418.29e713f79131eece.js +10 -0
- package/dist/client-v2/619.bd3c5698b40705c3.js +10 -0
- package/dist/client-v2/677.a991ce0250ff5c77.js +10 -0
- package/dist/client-v2/{70.a15d7fcec7c41768.js → 70.bda9518881c05360.js} +1 -1
- package/dist/client-v2/925.f5370de8f6632d65.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +7 -10
- package/dist/locale/en-US.json +94 -25
- package/dist/locale/vi-VN.json +94 -25
- package/dist/locale/zh-CN.json +94 -25
- package/dist/server/collections/agent-execution-spans.js +37 -0
- package/dist/server/collections/agent-harness-profiles.js +2 -2
- package/dist/server/collections/agent-memory-contexts.js +125 -0
- package/dist/server/collections/orchestrator-logs.js +2 -2
- package/dist/server/migrations/20260425000000-add-interaction-schema.js +3 -1
- package/dist/server/migrations/20260427000000-change-packages-to-text.js +3 -1
- package/dist/server/migrations/20260427000001-change-other-json-to-text.js +6 -2
- package/dist/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.js +21 -19
- package/dist/server/migrations/20260621000000-native-policy-profile-defaults.js +193 -0
- package/dist/server/plugin.js +128 -74
- package/dist/server/resources/agent-monitor.js +454 -0
- package/dist/server/services/AgentHarness.js +24 -499
- package/dist/server/services/AgentMemoryContextService.js +216 -0
- package/dist/server/services/ExecutionSpanService.js +2 -2
- package/dist/server/services/NativeSubAgentObserver.js +413 -0
- package/dist/server/skill-hub/plugin.js +81 -5
- package/dist/server/skill-hub/tasks/SkillExecutionTask.js +9 -3
- package/dist/server/tools/delegate-task.js +11 -589
- package/dist/server/utils/skill-settings.js +18 -1
- package/package.json +47 -49
- package/src/client/AIEmployeesContext.tsx +5 -18
- package/src/client/AgentRunsTab.tsx +2 -771
- package/src/client/HarnessProfilesTab.tsx +2 -257
- package/src/client/OrchestratorSettings.tsx +97 -106
- package/src/client/RulesTab.tsx +2 -788
- package/src/client/plugin.tsx +0 -2
- package/src/client/skill-hub/components/ExecutionHistory.tsx +200 -202
- package/src/client/skill-hub/components/ExecutionProgress.tsx +51 -55
- package/src/client/skill-hub/components/LoopSettings.tsx +331 -331
- package/src/client/skill-hub/components/SkillEditor.tsx +43 -39
- package/src/client/skill-hub/components/SkillManager.tsx +194 -181
- package/src/client/skill-hub/components/SkillTestPanel.tsx +141 -145
- package/src/client/skill-hub/locale.ts +16 -16
- package/src/client/skill-hub/tools/SkillHubCard.tsx +104 -109
- package/src/client/skill-hub/tools/loopTemplates.ts +52 -52
- package/src/client/skill-hub/utils/jsonFields.ts +7 -3
- package/src/client-v2/components/AIEmployeesContext.tsx +3 -16
- package/src/client-v2/components/AgentRunsTab.tsx +494 -767
- package/src/client-v2/components/HarnessProfilesTab.tsx +34 -31
- package/src/client-v2/components/RulesTab.tsx +2 -782
- package/src/client-v2/components/TracingTab.tsx +432 -432
- package/src/client-v2/hooks/useApiRequest.ts +121 -114
- package/src/client-v2/pages/RulesPage.tsx +2 -2
- package/src/client-v2/plugin.tsx +3 -3
- package/src/locale/en-US.json +94 -25
- package/src/locale/vi-VN.json +94 -25
- package/src/locale/zh-CN.json +94 -25
- package/src/server/__tests__/native-sub-agent-observer.test.ts +246 -0
- package/src/server/__tests__/skill-settings.test.ts +6 -6
- package/src/server/__tests__/smoke.test.ts +1 -0
- package/src/server/collections/agent-execution-spans.ts +37 -0
- package/src/server/collections/agent-harness-profiles.ts +59 -59
- package/src/server/collections/agent-loop-events.ts +71 -71
- package/src/server/collections/agent-loop-steps.ts +144 -144
- package/src/server/collections/agent-memory-contexts.ts +95 -0
- package/src/server/collections/orchestrator-logs.ts +4 -4
- package/src/server/collections/skill-definitions.ts +111 -111
- package/src/server/collections/skill-executions.ts +106 -106
- package/src/server/collections/skill-loop-configs.ts +65 -65
- package/src/server/migrations/20260423000000-add-progress-fields.ts +14 -14
- package/src/server/migrations/20260425000000-add-interaction-schema.ts +3 -1
- package/src/server/migrations/20260427000000-change-packages-to-text.ts +4 -2
- package/src/server/migrations/20260427000001-change-other-json-to-text.ts +9 -5
- package/src/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.ts +30 -30
- package/src/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.ts +145 -142
- package/src/server/migrations/20260615000000-normalize-ai-employee-tool-bindings.ts +2 -2
- package/src/server/migrations/20260621000000-native-policy-profile-defaults.ts +193 -0
- package/src/server/plugin.ts +151 -94
- package/src/server/resources/agent-monitor.ts +482 -0
- package/src/server/services/AgentHarness.ts +38 -623
- package/src/server/services/AgentMemoryContextService.ts +256 -0
- package/src/server/services/AgentPlanValidator.ts +73 -73
- package/src/server/services/ExecutionSpanService.ts +110 -106
- package/src/server/services/FileManager.ts +144 -144
- package/src/server/services/NativeSubAgentObserver.ts +507 -0
- package/src/server/services/SkillManager.ts +583 -583
- package/src/server/services/SkillRepositoryService.ts +5 -7
- package/src/server/services/TokenTracker.ts +3 -3
- package/src/server/services/WorkerEnvManager.ts +1 -2
- package/src/server/skill-hub/actions/git-import.ts +5 -7
- package/src/server/skill-hub/plugin.ts +1016 -933
- package/src/server/skill-hub/tasks/SkillExecutionTask.ts +20 -10
- package/src/server/skill-hub/utils/json-fields.ts +1 -1
- package/src/server/tools/delegate-task.ts +13 -847
- package/src/server/utils/skill-settings.ts +24 -6
- package/dist/client-v2/264.0533912e6c5ea2d7.js +0 -10
- package/dist/client-v2/418.5ae055abf141820e.js +0 -10
- package/dist/client-v2/619.d99d3c9e61c99064.js +0 -10
- package/dist/client-v2/892.72db4161511c8a16.js +0 -10
- package/dist/client-v2/926.87f660b670d85bcc.js +0 -10
- package/src/client/tools/PlanApprovalCard.tsx +0 -176
- package/src/client/tools/registerOrchestratorCards.ts +0 -17
|
@@ -1,767 +1,494 @@
|
|
|
1
|
-
import React, { useMemo, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Alert,
|
|
4
|
-
Button,
|
|
5
|
-
Card,
|
|
6
|
-
Collapse,
|
|
7
|
-
Descriptions,
|
|
8
|
-
Drawer,
|
|
9
|
-
Empty,
|
|
10
|
-
Form,
|
|
11
|
-
message,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} from '
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
setPage(nextPage);
|
|
496
|
-
if (nextSize && nextSize !== pageSize) setPageSize(nextSize);
|
|
497
|
-
},
|
|
498
|
-
}}
|
|
499
|
-
locale={{
|
|
500
|
-
emptyText: <Empty description={hasFilters ? 'No runs match the current filters' : 'No agent runs yet'} />,
|
|
501
|
-
}}
|
|
502
|
-
/>
|
|
503
|
-
</Card>
|
|
504
|
-
|
|
505
|
-
<Drawer
|
|
506
|
-
title="Agent Run Detail"
|
|
507
|
-
width={980}
|
|
508
|
-
onClose={() => {
|
|
509
|
-
setSelectedRun(null);
|
|
510
|
-
setDetail(null);
|
|
511
|
-
}}
|
|
512
|
-
open={!!selectedRun}
|
|
513
|
-
>
|
|
514
|
-
{run && (
|
|
515
|
-
<Spin spinning={detailLoading}>
|
|
516
|
-
<Space direction="vertical" size={16} style={{ width: '100%' }}>
|
|
517
|
-
<Space wrap>
|
|
518
|
-
<Button icon={<ReloadOutlined />} onClick={() => fetchDetail(run.id)} loading={detailLoading}>
|
|
519
|
-
Refresh
|
|
520
|
-
</Button>
|
|
521
|
-
{run.status === 'waiting_user' && (
|
|
522
|
-
<Button
|
|
523
|
-
type="primary"
|
|
524
|
-
icon={<PlayCircleOutlined />}
|
|
525
|
-
loading={actionLoading}
|
|
526
|
-
onClick={() => runAction('resume', run.id)}
|
|
527
|
-
>
|
|
528
|
-
Resume
|
|
529
|
-
</Button>
|
|
530
|
-
)}
|
|
531
|
-
{!terminalRunStatuses.has(run.status) && (
|
|
532
|
-
<Popconfirm title="Cancel this run?" onConfirm={() => runAction('cancel', run.id)}>
|
|
533
|
-
<Button danger icon={<StopOutlined />} loading={actionLoading}>
|
|
534
|
-
Cancel run
|
|
535
|
-
</Button>
|
|
536
|
-
</Popconfirm>
|
|
537
|
-
)}
|
|
538
|
-
</Space>
|
|
539
|
-
|
|
540
|
-
<Descriptions bordered size="small" column={2}>
|
|
541
|
-
<Descriptions.Item label="Status">
|
|
542
|
-
<StatusTag status={run.status} />
|
|
543
|
-
</Descriptions.Item>
|
|
544
|
-
<Descriptions.Item label="Leader">
|
|
545
|
-
<Tag color="blue">{employeeMap.get(run.leaderUsername) || run.leaderUsername || '-'}</Tag>
|
|
546
|
-
</Descriptions.Item>
|
|
547
|
-
<Descriptions.Item label="Root run">
|
|
548
|
-
<Text code>{run.rootRunId || '-'}</Text>
|
|
549
|
-
</Descriptions.Item>
|
|
550
|
-
<Descriptions.Item label="Current step">
|
|
551
|
-
<Text code>{run.currentStepId || '-'}</Text>
|
|
552
|
-
</Descriptions.Item>
|
|
553
|
-
<Descriptions.Item label="Iterations">{run.iterationCount || 0}</Descriptions.Item>
|
|
554
|
-
<Descriptions.Item label="Approval">{run.approvalStatus || '-'}</Descriptions.Item>
|
|
555
|
-
<Descriptions.Item label="Plan version">{run.planVersion || '-'}</Descriptions.Item>
|
|
556
|
-
<Descriptions.Item label="Harness">{run.metadata?.harnessTag || '-'}</Descriptions.Item>
|
|
557
|
-
<Descriptions.Item label="Duration">
|
|
558
|
-
{formatDuration(run.startedAt || run.createdAt, run.endedAt)}
|
|
559
|
-
</Descriptions.Item>
|
|
560
|
-
<Descriptions.Item label="Started">{formatDate(run.startedAt || run.createdAt)}</Descriptions.Item>
|
|
561
|
-
<Descriptions.Item label="Ended">{formatDate(run.endedAt)}</Descriptions.Item>
|
|
562
|
-
</Descriptions>
|
|
563
|
-
|
|
564
|
-
<Card title="Goal" size="small">
|
|
565
|
-
<TextBlock value={run.goal} rows={6} />
|
|
566
|
-
</Card>
|
|
567
|
-
|
|
568
|
-
<Card title="Plan" size="small" extra={<BranchesOutlined />}>
|
|
569
|
-
<Table
|
|
570
|
-
rowKey="id"
|
|
571
|
-
size="small"
|
|
572
|
-
dataSource={steps}
|
|
573
|
-
columns={stepColumns}
|
|
574
|
-
pagination={false}
|
|
575
|
-
scroll={{ x: 'max-content' }}
|
|
576
|
-
expandable={{
|
|
577
|
-
expandedRowRender: (record: any) => (
|
|
578
|
-
<Space direction="vertical" size={12} style={{ width: '100%' }}>
|
|
579
|
-
<Card size="small" title="Input">
|
|
580
|
-
<TextBlock value={record.input} rows={8} />
|
|
581
|
-
</Card>
|
|
582
|
-
<Card size="small" title="Output">
|
|
583
|
-
<TextBlock value={record.output} rows={8} />
|
|
584
|
-
</Card>
|
|
585
|
-
{record.approval && Object.keys(record.approval).length > 0 && (
|
|
586
|
-
<Card size="small" title="Approval">
|
|
587
|
-
<TextBlock value={record.approval} rows={8} />
|
|
588
|
-
</Card>
|
|
589
|
-
)}
|
|
590
|
-
{record.error && (
|
|
591
|
-
<Card size="small" title="Error" style={{ borderColor: '#ffa39e' }}>
|
|
592
|
-
<TextBlock value={record.error} rows={8} />
|
|
593
|
-
</Card>
|
|
594
|
-
)}
|
|
595
|
-
</Space>
|
|
596
|
-
),
|
|
597
|
-
}}
|
|
598
|
-
locale={{ emptyText: <Empty description="No plan steps" /> }}
|
|
599
|
-
/>
|
|
600
|
-
</Card>
|
|
601
|
-
|
|
602
|
-
<Card title="Event Timeline" size="small">
|
|
603
|
-
{events.length ? (
|
|
604
|
-
<Timeline
|
|
605
|
-
items={events.map((event: any) => ({
|
|
606
|
-
key: event.id,
|
|
607
|
-
color: timelineColor(event.status),
|
|
608
|
-
children: (
|
|
609
|
-
<Space direction="vertical" size={2} style={{ width: '100%' }}>
|
|
610
|
-
<Space wrap>
|
|
611
|
-
<Text strong>{event.title || event.type}</Text>
|
|
612
|
-
<StatusTag status={event.status} />
|
|
613
|
-
{event.stepId && <Text type="secondary">step #{event.stepId}</Text>}
|
|
614
|
-
</Space>
|
|
615
|
-
<Text type="secondary">{formatDate(event.createdAt)}</Text>
|
|
616
|
-
{event.content && <TextBlock value={event.content} rows={4} />}
|
|
617
|
-
</Space>
|
|
618
|
-
),
|
|
619
|
-
}))}
|
|
620
|
-
/>
|
|
621
|
-
) : (
|
|
622
|
-
<Empty description="No events captured" />
|
|
623
|
-
)}
|
|
624
|
-
</Card>
|
|
625
|
-
|
|
626
|
-
<Collapse
|
|
627
|
-
items={[
|
|
628
|
-
{
|
|
629
|
-
key: 'spans',
|
|
630
|
-
label: `Linked spans (${spans.length})`,
|
|
631
|
-
children: spans.length ? (
|
|
632
|
-
<Table
|
|
633
|
-
rowKey="id"
|
|
634
|
-
size="small"
|
|
635
|
-
dataSource={spans}
|
|
636
|
-
pagination={false}
|
|
637
|
-
scroll={{ x: 'max-content' }}
|
|
638
|
-
columns={[
|
|
639
|
-
{
|
|
640
|
-
title: 'Type',
|
|
641
|
-
dataIndex: 'type',
|
|
642
|
-
key: 'type',
|
|
643
|
-
width: 110,
|
|
644
|
-
render: (value: string) => <Tag>{value}</Tag>,
|
|
645
|
-
},
|
|
646
|
-
{
|
|
647
|
-
title: 'Status',
|
|
648
|
-
dataIndex: 'status',
|
|
649
|
-
key: 'status',
|
|
650
|
-
width: 110,
|
|
651
|
-
render: (value: string) => <StatusTag status={value} />,
|
|
652
|
-
},
|
|
653
|
-
{ title: 'Title', dataIndex: 'title', key: 'title' },
|
|
654
|
-
{
|
|
655
|
-
title: 'Tool',
|
|
656
|
-
dataIndex: 'toolName',
|
|
657
|
-
key: 'toolName',
|
|
658
|
-
render: (value: string) => (value ? <Text code>{value}</Text> : '-'),
|
|
659
|
-
},
|
|
660
|
-
{
|
|
661
|
-
title: 'Duration',
|
|
662
|
-
dataIndex: 'durationMs',
|
|
663
|
-
key: 'durationMs',
|
|
664
|
-
width: 100,
|
|
665
|
-
render: (value: number) => (value ? `${value}ms` : '-'),
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
title: 'Skill Exec',
|
|
669
|
-
dataIndex: 'skillExecutionId',
|
|
670
|
-
key: 'skillExecutionId',
|
|
671
|
-
width: 110,
|
|
672
|
-
render: (value: any) => value || '-',
|
|
673
|
-
},
|
|
674
|
-
]}
|
|
675
|
-
/>
|
|
676
|
-
) : (
|
|
677
|
-
<Empty description="No linked spans" />
|
|
678
|
-
),
|
|
679
|
-
},
|
|
680
|
-
{
|
|
681
|
-
key: 'skills',
|
|
682
|
-
label: `Skill executions (${skillExecutions.length})`,
|
|
683
|
-
children: skillExecutions.length ? (
|
|
684
|
-
<Space direction="vertical" size={12} style={{ width: '100%' }}>
|
|
685
|
-
{skillExecutions.map((execution: any) => {
|
|
686
|
-
const files = parseJsonText<any[]>(execution.outputFiles, []);
|
|
687
|
-
return (
|
|
688
|
-
<Card
|
|
689
|
-
key={execution.id}
|
|
690
|
-
size="small"
|
|
691
|
-
title={
|
|
692
|
-
<Space wrap>
|
|
693
|
-
<Text>Skill execution #{execution.id}</Text>
|
|
694
|
-
<StatusTag status={execution.status} />
|
|
695
|
-
{execution.agentLoopStepId && (
|
|
696
|
-
<Text type="secondary">step #{execution.agentLoopStepId}</Text>
|
|
697
|
-
)}
|
|
698
|
-
</Space>
|
|
699
|
-
}
|
|
700
|
-
>
|
|
701
|
-
<Space direction="vertical" size={8} style={{ width: '100%' }}>
|
|
702
|
-
<Descriptions size="small" column={2}>
|
|
703
|
-
<Descriptions.Item label="Duration">
|
|
704
|
-
{execution.durationMs ? `${execution.durationMs}ms` : '-'}
|
|
705
|
-
</Descriptions.Item>
|
|
706
|
-
<Descriptions.Item label="Created">
|
|
707
|
-
{formatDate(execution.createdAt)}
|
|
708
|
-
</Descriptions.Item>
|
|
709
|
-
</Descriptions>
|
|
710
|
-
<Collapse
|
|
711
|
-
size="small"
|
|
712
|
-
items={[
|
|
713
|
-
{
|
|
714
|
-
key: 'stdout',
|
|
715
|
-
label: 'stdout',
|
|
716
|
-
children: <TextBlock value={execution.stdout} rows={10} />,
|
|
717
|
-
},
|
|
718
|
-
{
|
|
719
|
-
key: 'stderr',
|
|
720
|
-
label: 'stderr',
|
|
721
|
-
children: <TextBlock value={execution.stderr} rows={10} />,
|
|
722
|
-
},
|
|
723
|
-
{
|
|
724
|
-
key: 'files',
|
|
725
|
-
label: `files (${files.length})`,
|
|
726
|
-
children: files.length ? (
|
|
727
|
-
<Space direction="vertical">
|
|
728
|
-
{files.map((file: any, index: number) =>
|
|
729
|
-
renderSkillFileLink(execution, file, index),
|
|
730
|
-
)}
|
|
731
|
-
</Space>
|
|
732
|
-
) : (
|
|
733
|
-
<Empty description="No files" />
|
|
734
|
-
),
|
|
735
|
-
},
|
|
736
|
-
]}
|
|
737
|
-
/>
|
|
738
|
-
</Space>
|
|
739
|
-
</Card>
|
|
740
|
-
);
|
|
741
|
-
})}
|
|
742
|
-
</Space>
|
|
743
|
-
) : (
|
|
744
|
-
<Empty description="No linked skill executions" />
|
|
745
|
-
),
|
|
746
|
-
},
|
|
747
|
-
]}
|
|
748
|
-
/>
|
|
749
|
-
|
|
750
|
-
{(run.finalAnswer || run.summary) && (
|
|
751
|
-
<Card title="Final Output" size="small">
|
|
752
|
-
{run.summary && (
|
|
753
|
-
<Paragraph style={{ whiteSpace: 'pre-wrap', marginBottom: 12 }}>
|
|
754
|
-
<Text strong>Summary: </Text>
|
|
755
|
-
{run.summary}
|
|
756
|
-
</Paragraph>
|
|
757
|
-
)}
|
|
758
|
-
<TextBlock value={run.finalAnswer} rows={16} />
|
|
759
|
-
</Card>
|
|
760
|
-
)}
|
|
761
|
-
</Space>
|
|
762
|
-
</Spin>
|
|
763
|
-
)}
|
|
764
|
-
</Drawer>
|
|
765
|
-
</div>
|
|
766
|
-
);
|
|
767
|
-
};
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Alert,
|
|
4
|
+
Button,
|
|
5
|
+
Card,
|
|
6
|
+
Collapse,
|
|
7
|
+
Descriptions,
|
|
8
|
+
Drawer,
|
|
9
|
+
Empty,
|
|
10
|
+
Form,
|
|
11
|
+
message,
|
|
12
|
+
Select,
|
|
13
|
+
Space,
|
|
14
|
+
Spin,
|
|
15
|
+
Table,
|
|
16
|
+
Tag,
|
|
17
|
+
Timeline,
|
|
18
|
+
Typography,
|
|
19
|
+
} from 'antd';
|
|
20
|
+
import { CheckCircleOutlined, CloseCircleOutlined, EyeOutlined, ReloadOutlined, SyncOutlined } from '@ant-design/icons';
|
|
21
|
+
import { useApiClient as useAPIClient, useRequest } from '../hooks/useApiRequest';
|
|
22
|
+
import { useAIEmployees } from './AIEmployeesContext';
|
|
23
|
+
import { useT } from '../skill-hub/locale';
|
|
24
|
+
|
|
25
|
+
const { Paragraph, Text } = Typography;
|
|
26
|
+
|
|
27
|
+
type FilterState = {
|
|
28
|
+
leader?: string;
|
|
29
|
+
subAgent?: string;
|
|
30
|
+
status?: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
function statusColor(status?: string) {
|
|
34
|
+
switch (status) {
|
|
35
|
+
case 'success':
|
|
36
|
+
return 'success';
|
|
37
|
+
case 'error':
|
|
38
|
+
return 'error';
|
|
39
|
+
case 'running':
|
|
40
|
+
return 'processing';
|
|
41
|
+
default:
|
|
42
|
+
return 'default';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function statusIcon(status?: string) {
|
|
47
|
+
if (status === 'success') return <CheckCircleOutlined />;
|
|
48
|
+
if (status === 'error') return <CloseCircleOutlined />;
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function StatusTag({ status }: { status?: string }) {
|
|
53
|
+
return (
|
|
54
|
+
<Tag color={statusColor(status)} icon={statusIcon(status)}>
|
|
55
|
+
{status || '-'}
|
|
56
|
+
</Tag>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function formatDate(value?: string) {
|
|
61
|
+
return value ? new Date(value).toLocaleString() : '-';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function formatDurationMs(value?: number) {
|
|
65
|
+
if (!value) return '-';
|
|
66
|
+
if (value >= 60000) return `${Math.round(value / 60000)}m`;
|
|
67
|
+
if (value >= 1000) return `${(value / 1000).toFixed(1)}s`;
|
|
68
|
+
return `${value}ms`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function formatJson(value: unknown) {
|
|
72
|
+
if (value === undefined || value === null || value === '') return '';
|
|
73
|
+
if (typeof value === 'string') return value;
|
|
74
|
+
try {
|
|
75
|
+
return JSON.stringify(value, null, 2);
|
|
76
|
+
} catch {
|
|
77
|
+
return String(value);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function TextBlock({ value, rows = 8 }: { value: unknown; rows?: number }) {
|
|
82
|
+
const text = formatJson(value);
|
|
83
|
+
if (!text) return <Text type="secondary">-</Text>;
|
|
84
|
+
return (
|
|
85
|
+
<Paragraph
|
|
86
|
+
style={{ whiteSpace: 'pre-wrap', wordBreak: 'break-word', margin: 0, fontSize: 12 }}
|
|
87
|
+
ellipsis={{ rows, expandable: true }}
|
|
88
|
+
>
|
|
89
|
+
{text}
|
|
90
|
+
</Paragraph>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const AgentRunsTab: React.FC = () => {
|
|
95
|
+
const api = useAPIClient();
|
|
96
|
+
const t = useT();
|
|
97
|
+
const { employees, employeeMap } = useAIEmployees();
|
|
98
|
+
const [filters, setFilters] = useState<FilterState>({});
|
|
99
|
+
const [page, setPage] = useState(1);
|
|
100
|
+
const [pageSize, setPageSize] = useState(20);
|
|
101
|
+
const [selectedRun, setSelectedRun] = useState<any>(null);
|
|
102
|
+
const [detailLoading, setDetailLoading] = useState(false);
|
|
103
|
+
const [syncLoading, setSyncLoading] = useState(false);
|
|
104
|
+
|
|
105
|
+
const requestParams = useMemo(() => {
|
|
106
|
+
const filter: Record<string, string> = {};
|
|
107
|
+
if (filters.leader) filter.leaderUsername = filters.leader;
|
|
108
|
+
if (filters.subAgent) filter.subAgentUsername = filters.subAgent;
|
|
109
|
+
if (filters.status) filter.status = filters.status;
|
|
110
|
+
return {
|
|
111
|
+
sort: ['-createdAt'],
|
|
112
|
+
page,
|
|
113
|
+
pageSize,
|
|
114
|
+
filter,
|
|
115
|
+
};
|
|
116
|
+
}, [filters, page, pageSize]);
|
|
117
|
+
|
|
118
|
+
const { data, loading, refresh } = useRequest(
|
|
119
|
+
{
|
|
120
|
+
url: 'agentMonitor:list',
|
|
121
|
+
params: requestParams,
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
refreshDeps: [requestParams],
|
|
125
|
+
},
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
const runs = useMemo(() => {
|
|
129
|
+
const rows = (data as any)?.data;
|
|
130
|
+
return Array.isArray(rows) ? rows : [];
|
|
131
|
+
}, [data]);
|
|
132
|
+
|
|
133
|
+
const total = useMemo(() => {
|
|
134
|
+
const count = (data as any)?.meta?.count;
|
|
135
|
+
return typeof count === 'number' ? count : 0;
|
|
136
|
+
}, [data]);
|
|
137
|
+
|
|
138
|
+
const employeeOptions = useMemo(
|
|
139
|
+
() =>
|
|
140
|
+
employees.map((employee) => ({
|
|
141
|
+
label: employee.nickname || employee.username,
|
|
142
|
+
value: employee.username,
|
|
143
|
+
})),
|
|
144
|
+
[employees],
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const updateFilter = (patch: Partial<FilterState>) => {
|
|
148
|
+
setFilters((prev) => ({ ...prev, ...patch }));
|
|
149
|
+
setPage(1);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const resetFilters = () => {
|
|
153
|
+
setFilters({});
|
|
154
|
+
setPage(1);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const fetchDetail = async (record: any) => {
|
|
158
|
+
setSelectedRun(record);
|
|
159
|
+
setDetailLoading(true);
|
|
160
|
+
try {
|
|
161
|
+
const res = await api.request({
|
|
162
|
+
url: 'agentMonitor:get',
|
|
163
|
+
params: { filterByTk: record.id },
|
|
164
|
+
});
|
|
165
|
+
setSelectedRun((res as any)?.data?.data?.data || (res as any)?.data?.data || record);
|
|
166
|
+
} finally {
|
|
167
|
+
setDetailLoading(false);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const syncNativeRuns = async () => {
|
|
172
|
+
setSyncLoading(true);
|
|
173
|
+
try {
|
|
174
|
+
const res = await api.request({
|
|
175
|
+
url: 'agentMonitor:sync',
|
|
176
|
+
method: 'post',
|
|
177
|
+
data: { limit: 500 },
|
|
178
|
+
});
|
|
179
|
+
const result = (res as any)?.data?.data || {};
|
|
180
|
+
message.success(t('Synced {{count}} native runs', { count: result.created || 0 }));
|
|
181
|
+
refresh();
|
|
182
|
+
} catch (error: any) {
|
|
183
|
+
const text = error?.response?.data?.errors?.[0]?.message || error?.message || t('Sync failed');
|
|
184
|
+
message.error(text);
|
|
185
|
+
} finally {
|
|
186
|
+
setSyncLoading(false);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const hasFilters = Boolean(filters.leader || filters.subAgent || filters.status);
|
|
191
|
+
const trace = Array.isArray(selectedRun?.trace) ? selectedRun.trace : [];
|
|
192
|
+
const toolMessages = Array.isArray(selectedRun?.toolMessages) ? selectedRun.toolMessages : [];
|
|
193
|
+
const nativeMessages = Array.isArray(selectedRun?.nativeMessages) ? selectedRun.nativeMessages : [];
|
|
194
|
+
|
|
195
|
+
const columns = [
|
|
196
|
+
{
|
|
197
|
+
title: t('Time'),
|
|
198
|
+
dataIndex: 'createdAt',
|
|
199
|
+
key: 'createdAt',
|
|
200
|
+
width: 170,
|
|
201
|
+
render: formatDate,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
title: t('Leader'),
|
|
205
|
+
dataIndex: 'leaderUsername',
|
|
206
|
+
key: 'leaderUsername',
|
|
207
|
+
width: 160,
|
|
208
|
+
render: (username: string) => <Tag color="blue">{employeeMap.get(username) || username || '-'}</Tag>,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
title: t('Sub-Agent'),
|
|
212
|
+
dataIndex: 'subAgentUsername',
|
|
213
|
+
key: 'subAgentUsername',
|
|
214
|
+
width: 160,
|
|
215
|
+
render: (username: string) => <Tag color="green">{employeeMap.get(username) || username || '-'}</Tag>,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
title: t('Task'),
|
|
219
|
+
dataIndex: 'task',
|
|
220
|
+
key: 'task',
|
|
221
|
+
render: (task: string) => (
|
|
222
|
+
<Text ellipsis style={{ maxWidth: 360 }}>
|
|
223
|
+
{task || '-'}
|
|
224
|
+
</Text>
|
|
225
|
+
),
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
title: t('Status'),
|
|
229
|
+
dataIndex: 'status',
|
|
230
|
+
key: 'status',
|
|
231
|
+
width: 110,
|
|
232
|
+
render: (status: string) => <StatusTag status={status} />,
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
title: t('Duration'),
|
|
236
|
+
dataIndex: 'durationMs',
|
|
237
|
+
key: 'durationMs',
|
|
238
|
+
width: 100,
|
|
239
|
+
render: formatDurationMs,
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
title: t('Context'),
|
|
243
|
+
dataIndex: 'memoryContextApplied',
|
|
244
|
+
key: 'memoryContextApplied',
|
|
245
|
+
width: 100,
|
|
246
|
+
render: (applied: boolean) => (applied ? <Tag color="purple">memory</Tag> : <Text type="secondary">-</Text>),
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
title: '',
|
|
250
|
+
key: 'actions',
|
|
251
|
+
width: 90,
|
|
252
|
+
render: (_: unknown, record: any) => (
|
|
253
|
+
<Button type="link" size="small" icon={<EyeOutlined />} onClick={() => fetchDetail(record)}>
|
|
254
|
+
{t('Detail')}
|
|
255
|
+
</Button>
|
|
256
|
+
),
|
|
257
|
+
},
|
|
258
|
+
];
|
|
259
|
+
|
|
260
|
+
return (
|
|
261
|
+
<div>
|
|
262
|
+
<Alert
|
|
263
|
+
type="info"
|
|
264
|
+
showIcon
|
|
265
|
+
style={{ marginBottom: 16 }}
|
|
266
|
+
message={t('Native Agent Runs')}
|
|
267
|
+
description={
|
|
268
|
+
<Text type="secondary">
|
|
269
|
+
{t(
|
|
270
|
+
'Native plugin-ai sub-agent dispatches captured by the orchestrator observer. Execution still runs through AIEmployee/SubAgentsDispatcher.',
|
|
271
|
+
)}
|
|
272
|
+
</Text>
|
|
273
|
+
}
|
|
274
|
+
/>
|
|
275
|
+
|
|
276
|
+
<Card bordered={false}>
|
|
277
|
+
<Form layout="inline" style={{ marginBottom: 16, rowGap: 8, flexWrap: 'wrap' }}>
|
|
278
|
+
<Form.Item label={t('Leader')}>
|
|
279
|
+
<Select
|
|
280
|
+
allowClear
|
|
281
|
+
showSearch
|
|
282
|
+
optionFilterProp="label"
|
|
283
|
+
placeholder={t('Any leader')}
|
|
284
|
+
style={{ minWidth: 180 }}
|
|
285
|
+
options={employeeOptions}
|
|
286
|
+
value={filters.leader}
|
|
287
|
+
onChange={(value) => updateFilter({ leader: value })}
|
|
288
|
+
/>
|
|
289
|
+
</Form.Item>
|
|
290
|
+
<Form.Item label={t('Sub-Agent')}>
|
|
291
|
+
<Select
|
|
292
|
+
allowClear
|
|
293
|
+
showSearch
|
|
294
|
+
optionFilterProp="label"
|
|
295
|
+
placeholder={t('Any sub-agent')}
|
|
296
|
+
style={{ minWidth: 180 }}
|
|
297
|
+
options={employeeOptions}
|
|
298
|
+
value={filters.subAgent}
|
|
299
|
+
onChange={(value) => updateFilter({ subAgent: value })}
|
|
300
|
+
/>
|
|
301
|
+
</Form.Item>
|
|
302
|
+
<Form.Item label={t('Status')}>
|
|
303
|
+
<Select
|
|
304
|
+
allowClear
|
|
305
|
+
placeholder={t('Any status')}
|
|
306
|
+
style={{ minWidth: 140 }}
|
|
307
|
+
value={filters.status}
|
|
308
|
+
onChange={(value) => updateFilter({ status: value })}
|
|
309
|
+
options={[
|
|
310
|
+
{ label: t('Running'), value: 'running' },
|
|
311
|
+
{ label: t('Success'), value: 'success' },
|
|
312
|
+
{ label: t('Error'), value: 'error' },
|
|
313
|
+
]}
|
|
314
|
+
/>
|
|
315
|
+
</Form.Item>
|
|
316
|
+
<Form.Item>
|
|
317
|
+
<Space>
|
|
318
|
+
<Button onClick={resetFilters} disabled={!hasFilters}>
|
|
319
|
+
{t('Reset')}
|
|
320
|
+
</Button>
|
|
321
|
+
<Button icon={<ReloadOutlined />} onClick={refresh}>
|
|
322
|
+
{t('Refresh')}
|
|
323
|
+
</Button>
|
|
324
|
+
<Button icon={<SyncOutlined />} onClick={syncNativeRuns} loading={syncLoading}>
|
|
325
|
+
{t('Sync')}
|
|
326
|
+
</Button>
|
|
327
|
+
</Space>
|
|
328
|
+
</Form.Item>
|
|
329
|
+
</Form>
|
|
330
|
+
|
|
331
|
+
<Table
|
|
332
|
+
rowKey="id"
|
|
333
|
+
loading={loading}
|
|
334
|
+
dataSource={runs}
|
|
335
|
+
columns={columns}
|
|
336
|
+
scroll={{ x: 'max-content' }}
|
|
337
|
+
pagination={{
|
|
338
|
+
current: page,
|
|
339
|
+
pageSize,
|
|
340
|
+
total,
|
|
341
|
+
showSizeChanger: true,
|
|
342
|
+
pageSizeOptions: [10, 20, 50, 100],
|
|
343
|
+
showTotal: (count) => t('{{count}} runs', { count }),
|
|
344
|
+
onChange: (nextPage, nextSize) => {
|
|
345
|
+
setPage(nextPage);
|
|
346
|
+
if (nextSize && nextSize !== pageSize) setPageSize(nextSize);
|
|
347
|
+
},
|
|
348
|
+
}}
|
|
349
|
+
locale={{
|
|
350
|
+
emptyText: (
|
|
351
|
+
<Empty description={hasFilters ? t('No runs match the current filters') : t('No native runs yet')} />
|
|
352
|
+
),
|
|
353
|
+
}}
|
|
354
|
+
/>
|
|
355
|
+
</Card>
|
|
356
|
+
|
|
357
|
+
<Drawer title={t('Native Run Detail')} width={960} onClose={() => setSelectedRun(null)} open={!!selectedRun}>
|
|
358
|
+
{selectedRun && (
|
|
359
|
+
<Spin spinning={detailLoading}>
|
|
360
|
+
<Space direction="vertical" size={16} style={{ width: '100%' }}>
|
|
361
|
+
<Descriptions bordered size="small" column={2}>
|
|
362
|
+
<Descriptions.Item label={t('Status')}>
|
|
363
|
+
<StatusTag status={selectedRun.status} />
|
|
364
|
+
</Descriptions.Item>
|
|
365
|
+
<Descriptions.Item label={t('Harness')}>{selectedRun.harnessTag || 'default'}</Descriptions.Item>
|
|
366
|
+
<Descriptions.Item label={t('Leader')}>
|
|
367
|
+
<Tag color="blue">
|
|
368
|
+
{employeeMap.get(selectedRun.leaderUsername) || selectedRun.leaderUsername || '-'}
|
|
369
|
+
</Tag>
|
|
370
|
+
</Descriptions.Item>
|
|
371
|
+
<Descriptions.Item label={t('Sub-Agent')}>
|
|
372
|
+
<Tag color="green">
|
|
373
|
+
{employeeMap.get(selectedRun.subAgentUsername) || selectedRun.subAgentUsername || '-'}
|
|
374
|
+
</Tag>
|
|
375
|
+
</Descriptions.Item>
|
|
376
|
+
<Descriptions.Item label={t('Parent session')}>
|
|
377
|
+
<Text code>{selectedRun.parentSessionId || '-'}</Text>
|
|
378
|
+
</Descriptions.Item>
|
|
379
|
+
<Descriptions.Item label={t('Sub session')}>
|
|
380
|
+
<Text code>{selectedRun.subSessionId || '-'}</Text>
|
|
381
|
+
</Descriptions.Item>
|
|
382
|
+
<Descriptions.Item label={t('Tool call')}>
|
|
383
|
+
<Text code>{selectedRun.toolCallId || '-'}</Text>
|
|
384
|
+
</Descriptions.Item>
|
|
385
|
+
<Descriptions.Item label={t('Duration')}>{formatDurationMs(selectedRun.durationMs)}</Descriptions.Item>
|
|
386
|
+
<Descriptions.Item label={t('Started')}>
|
|
387
|
+
{formatDate(selectedRun.startedAt || selectedRun.createdAt)}
|
|
388
|
+
</Descriptions.Item>
|
|
389
|
+
<Descriptions.Item label={t('Ended')}>{formatDate(selectedRun.endedAt)}</Descriptions.Item>
|
|
390
|
+
</Descriptions>
|
|
391
|
+
|
|
392
|
+
<Card title={t('Task')} size="small">
|
|
393
|
+
<TextBlock value={selectedRun.task || selectedRun.input?.question} rows={6} />
|
|
394
|
+
</Card>
|
|
395
|
+
|
|
396
|
+
<Card title={t('Execution Flow')} size="small">
|
|
397
|
+
{trace.length ? (
|
|
398
|
+
<Timeline
|
|
399
|
+
items={trace.map((item: any) => ({
|
|
400
|
+
key: item.id,
|
|
401
|
+
color: item.status === 'error' ? 'red' : item.status === 'running' ? 'blue' : 'green',
|
|
402
|
+
children: (
|
|
403
|
+
<Space direction="vertical" size={2} style={{ width: '100%' }}>
|
|
404
|
+
<Space wrap>
|
|
405
|
+
<Text strong>{item.title || item.type}</Text>
|
|
406
|
+
<Tag>{item.type}</Tag>
|
|
407
|
+
<StatusTag status={item.status} />
|
|
408
|
+
{item.toolName && <Text code>{item.toolName}</Text>}
|
|
409
|
+
{item.durationMs ? <Text type="secondary">{formatDurationMs(item.durationMs)}</Text> : null}
|
|
410
|
+
</Space>
|
|
411
|
+
<Text type="secondary">{formatDate(item.at)}</Text>
|
|
412
|
+
{item.content ? <TextBlock value={item.content} rows={4} /> : null}
|
|
413
|
+
</Space>
|
|
414
|
+
),
|
|
415
|
+
}))}
|
|
416
|
+
/>
|
|
417
|
+
) : (
|
|
418
|
+
<Empty description={t('No execution flow captured')} />
|
|
419
|
+
)}
|
|
420
|
+
</Card>
|
|
421
|
+
|
|
422
|
+
<Collapse
|
|
423
|
+
items={[
|
|
424
|
+
{
|
|
425
|
+
key: 'toolMessages',
|
|
426
|
+
label: t('Native tool messages ({{count}})', { count: toolMessages.length }),
|
|
427
|
+
children: toolMessages.length ? (
|
|
428
|
+
<Table
|
|
429
|
+
rowKey={(record: any) => `${record.sessionId}:${record.toolCallId}`}
|
|
430
|
+
size="small"
|
|
431
|
+
pagination={false}
|
|
432
|
+
dataSource={toolMessages}
|
|
433
|
+
scroll={{ x: 'max-content' }}
|
|
434
|
+
columns={[
|
|
435
|
+
{ title: t('Session'), dataIndex: 'sessionId', key: 'sessionId' },
|
|
436
|
+
{ title: t('Tool'), dataIndex: 'toolName', key: 'toolName' },
|
|
437
|
+
{
|
|
438
|
+
title: t('Status'),
|
|
439
|
+
dataIndex: 'status',
|
|
440
|
+
key: 'status',
|
|
441
|
+
render: (value: string) => <StatusTag status={value === 'error' ? 'error' : value} />,
|
|
442
|
+
},
|
|
443
|
+
{ title: t('Invoke'), dataIndex: 'invokeStatus', key: 'invokeStatus' },
|
|
444
|
+
{
|
|
445
|
+
title: t('Content'),
|
|
446
|
+
dataIndex: 'content',
|
|
447
|
+
key: 'content',
|
|
448
|
+
render: (value: unknown) => <TextBlock value={value} rows={3} />,
|
|
449
|
+
},
|
|
450
|
+
]}
|
|
451
|
+
/>
|
|
452
|
+
) : (
|
|
453
|
+
<Empty description={t('No native tool messages')} />
|
|
454
|
+
),
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
key: 'messages',
|
|
458
|
+
label: t('Native messages ({{count}})', { count: nativeMessages.length }),
|
|
459
|
+
children: nativeMessages.length ? (
|
|
460
|
+
<Space direction="vertical" size={8} style={{ width: '100%' }}>
|
|
461
|
+
{nativeMessages.map((item: any) => (
|
|
462
|
+
<Card
|
|
463
|
+
key={`${item.sessionId}:${item.messageId}`}
|
|
464
|
+
size="small"
|
|
465
|
+
title={`${item.role} #${item.messageId}`}
|
|
466
|
+
>
|
|
467
|
+
<TextBlock value={item.content || item.metadata} rows={6} />
|
|
468
|
+
</Card>
|
|
469
|
+
))}
|
|
470
|
+
</Space>
|
|
471
|
+
) : (
|
|
472
|
+
<Empty description={t('No native messages loaded')} />
|
|
473
|
+
),
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
key: 'metadata',
|
|
477
|
+
label: t('Monitor metadata'),
|
|
478
|
+
children: <TextBlock value={selectedRun.metadata} rows={10} />,
|
|
479
|
+
},
|
|
480
|
+
]}
|
|
481
|
+
/>
|
|
482
|
+
|
|
483
|
+
{(selectedRun.output || selectedRun.error) && (
|
|
484
|
+
<Card title={selectedRun.error ? t('Error') : t('Result')} size="small">
|
|
485
|
+
<TextBlock value={selectedRun.error || selectedRun.output} rows={12} />
|
|
486
|
+
</Card>
|
|
487
|
+
)}
|
|
488
|
+
</Space>
|
|
489
|
+
</Spin>
|
|
490
|
+
)}
|
|
491
|
+
</Drawer>
|
|
492
|
+
</div>
|
|
493
|
+
);
|
|
494
|
+
};
|