plugin-agent-orchestrator 1.0.27 → 1.0.32

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.
Files changed (110) hide show
  1. package/README.md +9 -7
  2. package/dist/client/index.js +1 -1
  3. package/dist/client-v2/{214.723affb37c13bf7a.js → 214.79650a549273f163.js} +1 -1
  4. package/dist/client-v2/264.718a107e43fc163c.js +10 -0
  5. package/dist/client-v2/373.f5d5292e53c4e832.js +10 -0
  6. package/dist/client-v2/{41.1805b2edfaa4afe2.js → 41.ba6e080cc0488143.js} +1 -1
  7. package/dist/client-v2/418.29e713f79131eece.js +10 -0
  8. package/dist/client-v2/619.bd3c5698b40705c3.js +10 -0
  9. package/dist/client-v2/677.a991ce0250ff5c77.js +10 -0
  10. package/dist/client-v2/{70.a15d7fcec7c41768.js → 70.bda9518881c05360.js} +1 -1
  11. package/dist/client-v2/925.f5370de8f6632d65.js +10 -0
  12. package/dist/client-v2/index.js +1 -1
  13. package/dist/externalVersion.js +7 -10
  14. package/dist/locale/en-US.json +94 -25
  15. package/dist/locale/vi-VN.json +94 -25
  16. package/dist/locale/zh-CN.json +94 -25
  17. package/dist/server/collections/agent-execution-spans.js +37 -0
  18. package/dist/server/collections/agent-harness-profiles.js +2 -2
  19. package/dist/server/collections/agent-memory-contexts.js +125 -0
  20. package/dist/server/collections/orchestrator-logs.js +2 -2
  21. package/dist/server/migrations/20260425000000-add-interaction-schema.js +3 -1
  22. package/dist/server/migrations/20260427000000-change-packages-to-text.js +3 -1
  23. package/dist/server/migrations/20260427000001-change-other-json-to-text.js +6 -2
  24. package/dist/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.js +21 -19
  25. package/dist/server/migrations/20260621000000-native-policy-profile-defaults.js +193 -0
  26. package/dist/server/plugin.js +128 -74
  27. package/dist/server/resources/agent-monitor.js +454 -0
  28. package/dist/server/services/AgentHarness.js +24 -499
  29. package/dist/server/services/AgentMemoryContextService.js +216 -0
  30. package/dist/server/services/ExecutionSpanService.js +2 -2
  31. package/dist/server/services/NativeSubAgentObserver.js +413 -0
  32. package/dist/server/skill-hub/mcp/McpController.js +16 -5
  33. package/dist/server/skill-hub/plugin.js +81 -5
  34. package/dist/server/skill-hub/tasks/SkillExecutionTask.js +9 -3
  35. package/dist/server/tools/delegate-task.js +11 -589
  36. package/dist/server/utils/skill-settings.js +18 -1
  37. package/package.json +47 -49
  38. package/src/client/AIEmployeesContext.tsx +5 -18
  39. package/src/client/AgentRunsTab.tsx +2 -771
  40. package/src/client/HarnessProfilesTab.tsx +2 -257
  41. package/src/client/OrchestratorSettings.tsx +97 -106
  42. package/src/client/RulesTab.tsx +2 -788
  43. package/src/client/plugin.tsx +0 -2
  44. package/src/client/skill-hub/components/ExecutionHistory.tsx +200 -202
  45. package/src/client/skill-hub/components/ExecutionProgress.tsx +51 -55
  46. package/src/client/skill-hub/components/LoopSettings.tsx +331 -331
  47. package/src/client/skill-hub/components/SkillEditor.tsx +43 -39
  48. package/src/client/skill-hub/components/SkillManager.tsx +194 -181
  49. package/src/client/skill-hub/components/SkillTestPanel.tsx +141 -145
  50. package/src/client/skill-hub/locale.ts +16 -16
  51. package/src/client/skill-hub/tools/SkillHubCard.tsx +104 -109
  52. package/src/client/skill-hub/tools/loopTemplates.ts +52 -52
  53. package/src/client/skill-hub/utils/jsonFields.ts +7 -3
  54. package/src/client-v2/components/AIEmployeesContext.tsx +3 -16
  55. package/src/client-v2/components/AgentRunsTab.tsx +182 -455
  56. package/src/client-v2/components/HarnessProfilesTab.tsx +34 -31
  57. package/src/client-v2/components/RulesTab.tsx +2 -782
  58. package/src/client-v2/components/TracingTab.tsx +1 -1
  59. package/src/client-v2/hooks/useApiRequest.ts +8 -1
  60. package/src/client-v2/pages/RulesPage.tsx +2 -2
  61. package/src/client-v2/plugin.tsx +3 -3
  62. package/src/locale/en-US.json +94 -25
  63. package/src/locale/vi-VN.json +94 -25
  64. package/src/locale/zh-CN.json +94 -25
  65. package/src/server/__tests__/native-sub-agent-observer.test.ts +246 -0
  66. package/src/server/__tests__/skill-settings.test.ts +6 -6
  67. package/src/server/__tests__/smoke.test.ts +1 -0
  68. package/src/server/collections/agent-execution-spans.ts +37 -0
  69. package/src/server/collections/agent-harness-profiles.ts +59 -59
  70. package/src/server/collections/agent-loop-events.ts +71 -71
  71. package/src/server/collections/agent-loop-steps.ts +144 -144
  72. package/src/server/collections/agent-memory-contexts.ts +95 -0
  73. package/src/server/collections/orchestrator-logs.ts +4 -4
  74. package/src/server/collections/skill-definitions.ts +111 -111
  75. package/src/server/collections/skill-executions.ts +106 -106
  76. package/src/server/collections/skill-loop-configs.ts +65 -65
  77. package/src/server/migrations/20260423000000-add-progress-fields.ts +14 -14
  78. package/src/server/migrations/20260425000000-add-interaction-schema.ts +3 -1
  79. package/src/server/migrations/20260427000000-change-packages-to-text.ts +4 -2
  80. package/src/server/migrations/20260427000001-change-other-json-to-text.ts +9 -5
  81. package/src/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.ts +30 -30
  82. package/src/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.ts +145 -142
  83. package/src/server/migrations/20260615000000-normalize-ai-employee-tool-bindings.ts +2 -2
  84. package/src/server/migrations/20260621000000-native-policy-profile-defaults.ts +193 -0
  85. package/src/server/plugin.ts +151 -94
  86. package/src/server/resources/agent-monitor.ts +482 -0
  87. package/src/server/services/AgentHarness.ts +38 -623
  88. package/src/server/services/AgentMemoryContextService.ts +256 -0
  89. package/src/server/services/AgentPlanValidator.ts +73 -73
  90. package/src/server/services/ExecutionSpanService.ts +6 -2
  91. package/src/server/services/FileManager.ts +144 -144
  92. package/src/server/services/NativeSubAgentObserver.ts +507 -0
  93. package/src/server/services/SkillManager.ts +583 -583
  94. package/src/server/services/SkillRepositoryService.ts +5 -7
  95. package/src/server/services/TokenTracker.ts +3 -3
  96. package/src/server/services/WorkerEnvManager.ts +1 -2
  97. package/src/server/skill-hub/actions/git-import.ts +5 -7
  98. package/src/server/skill-hub/mcp/McpController.ts +41 -14
  99. package/src/server/skill-hub/plugin.ts +89 -6
  100. package/src/server/skill-hub/tasks/SkillExecutionTask.ts +470 -460
  101. package/src/server/skill-hub/utils/json-fields.ts +1 -1
  102. package/src/server/tools/delegate-task.ts +13 -847
  103. package/src/server/utils/skill-settings.ts +24 -6
  104. package/dist/client-v2/264.0533912e6c5ea2d7.js +0 -10
  105. package/dist/client-v2/418.5ae055abf141820e.js +0 -10
  106. package/dist/client-v2/619.d99d3c9e61c99064.js +0 -10
  107. package/dist/client-v2/892.72db4161511c8a16.js +0 -10
  108. package/dist/client-v2/926.87f660b670d85bcc.js +0 -10
  109. package/src/client/tools/PlanApprovalCard.tsx +0 -176
  110. package/src/client/tools/registerOrchestratorCards.ts +0 -17
@@ -2,7 +2,6 @@ import { Plugin } from '@nocobase/client';
2
2
  import { OrchestratorSettings } from './OrchestratorSettings';
3
3
  import { InteractionSchemasProvider } from './skill-hub/tools/InteractionSchemasProvider';
4
4
  import { registerSkillLoopCards } from './skill-hub/tools/registerSkillLoopCards';
5
- import { registerOrchestratorCards } from './tools/registerOrchestratorCards';
6
5
 
7
6
  export class PluginAgentOrchestratorClient extends Plugin {
8
7
  async load() {
@@ -26,7 +25,6 @@ export class PluginAgentOrchestratorClient extends Plugin {
26
25
  }
27
26
 
28
27
  private async registerSkillUiCards() {
29
- await registerOrchestratorCards((this as any).app);
30
28
  await registerSkillLoopCards((this as any).app);
31
29
  }
32
30
  }
@@ -1,202 +1,200 @@
1
- import React, { useState, useEffect, useCallback } from 'react';
2
- import { Card, Table, Tag, Button, Typography, Space, Tooltip, Popconfirm, message } from 'antd';
3
- import { ReloadOutlined, DownloadOutlined, DeleteOutlined } from '@ant-design/icons';
4
- import { Upload } from '@nocobase/client';
5
- import { useApp } from '@nocobase/client-v2';
6
- import { useT } from '../locale';
7
- import { parseJsonText } from '../utils/jsonFields';
8
-
9
- const STATUS_COLORS: Record<string, string> = {
10
- pending: 'default',
11
- running: 'processing',
12
- succeeded: 'success',
13
- failed: 'error',
14
- canceled: 'warning',
15
- timeout: 'error',
16
- };
17
-
18
- export const ExecutionHistory: React.FC = () => {
19
- const api = useApp().apiClient;
20
- const t = useT();
21
- const [executions, setExecutions] = useState<any[]>([]);
22
- const [loading, setLoading] = useState(false);
23
- const [page, setPage] = useState(1);
24
- const [total, setTotal] = useState(0);
25
- const pageSize = 20;
26
-
27
- const fetchExecutions = useCallback(async () => {
28
- setLoading(true);
29
- try {
30
- const { data } = await api.request({
31
- url: 'skillExecutions:list',
32
- params: {
33
- page,
34
- pageSize,
35
- sort: ['-createdAt'],
36
- appends: ['skill', 'triggeredBy'],
37
- },
38
- });
39
- const rawData = data?.data?.data ?? data?.data ?? [];
40
- setExecutions(Array.isArray(rawData) ? rawData : []);
41
- setTotal(data?.meta?.count || 0);
42
- } catch {
43
- // ignore
44
- } finally {
45
- setLoading(false);
46
- }
47
- }, [api, page]);
48
-
49
- useEffect(() => {
50
- fetchExecutions();
51
- }, [fetchExecutions]);
52
-
53
- const handleDelete = async (id: number) => {
54
- try {
55
- await api.request({
56
- url: `skillExecutions:destroy`,
57
- method: 'POST',
58
- params: {
59
- filterByTk: id
60
- }
61
- });
62
- message.success(t('Deleted successfully'));
63
- fetchExecutions();
64
- } catch (err: any) {
65
- message.error(err?.response?.data?.errors?.[0]?.message || t('Delete failed'));
66
- }
67
- };
68
-
69
- const columns = [
70
- {
71
- title: 'ID',
72
- dataIndex: 'id',
73
- key: 'id',
74
- width: 80,
75
- },
76
- {
77
- title: t('Skill'),
78
- dataIndex: ['skill', 'title'],
79
- key: 'skill',
80
- width: 180,
81
- },
82
- {
83
- title: t('Status'),
84
- dataIndex: 'status',
85
- key: 'status',
86
- width: 120,
87
- render: (status: string) => (
88
- <Tag color={STATUS_COLORS[status] || 'default'}>{status}</Tag>
89
- ),
90
- },
91
- {
92
- title: t('Duration'),
93
- dataIndex: 'durationMs',
94
- key: 'duration',
95
- width: 100,
96
- render: (ms: number) => (ms ? `${(ms / 1000).toFixed(1)}s` : '-'),
97
- },
98
- {
99
- title: t('Files'),
100
- dataIndex: 'outputFiles',
101
- key: 'files',
102
- width: 250,
103
- render: (files: any[], record: any) => {
104
- files = parseJsonText(files, []);
105
- if (!Array.isArray(files) || !files.length) return '-';
106
- const formattedFiles = files.map((f, i) => ({
107
- id: `${record.id}-${f.name}-${i}`,
108
- title: f.name,
109
- filename: f.name,
110
- extname: f.name.includes('.') ? `.${f.name.split('.').pop()}` : '',
111
- url: `/api/skillHub:download?execId=${record.id}&filename=${encodeURIComponent(f.name)}`,
112
- status: 'done'
113
- }));
114
- return <Upload.ReadPretty value={formattedFiles} multiple={true} showFileName={true} />;
115
- },
116
- },
117
- {
118
- title: t('Triggered By'),
119
- dataIndex: ['triggeredBy', 'nickname'],
120
- key: 'triggeredBy',
121
- width: 120,
122
- render: (v: string) => v || '-',
123
- },
124
- {
125
- title: t('Created At'),
126
- dataIndex: 'createdAt',
127
- key: 'createdAt',
128
- width: 180,
129
- render: (v: string) => (v ? new Date(v).toLocaleString() : '-'),
130
- },
131
- {
132
- title: t('Output'),
133
- key: 'output',
134
- width: 200,
135
- render: (_: any, record: any) => (
136
- <Space direction="vertical" size={0}>
137
- {record.stdout && (
138
- <Tooltip title={record.stdout}>
139
- <Typography.Text style={{ fontSize: 12, maxWidth: 200 }} ellipsis>
140
- {record.stdout}
141
- </Typography.Text>
142
- </Tooltip>
143
- )}
144
- {record.stderr && (
145
- <Tooltip title={record.stderr}>
146
- <Typography.Text type="danger" style={{ fontSize: 12, maxWidth: 200 }} ellipsis>
147
- {record.stderr}
148
- </Typography.Text>
149
- </Tooltip>
150
- )}
151
- </Space>
152
- ),
153
- },
154
- {
155
- title: t('Actions'),
156
- key: 'actions',
157
- width: 80,
158
- fixed: 'right' as const,
159
- render: (_: any, record: any) => (
160
- <Space size="middle">
161
- <Popconfirm
162
- title={t('Are you sure to delete this execution history and its files?')}
163
- onConfirm={() => handleDelete(record.id)}
164
- okText={t('Yes')}
165
- cancelText={t('No')}
166
- >
167
- <Button type="text" danger icon={<DeleteOutlined />} size="small" />
168
- </Popconfirm>
169
- </Space>
170
- ),
171
- },
172
- ];
173
-
174
- return (
175
- <Card
176
- title={t('Execution History')}
177
- extra={
178
- <Space>
179
- <Button icon={<ReloadOutlined />} onClick={fetchExecutions} loading={loading}>
180
- {t('Refresh')}
181
- </Button>
182
- </Space>
183
- }
184
- >
185
- <Table
186
- dataSource={executions}
187
- columns={columns}
188
- rowKey="id"
189
- loading={loading}
190
- size="middle"
191
- pagination={{
192
- current: page,
193
- pageSize,
194
- total,
195
- onChange: setPage,
196
- showTotal: (t) => `Total: ${t}`,
197
- }}
198
- scroll={{ x: 1200 }}
199
- />
200
- </Card>
201
- );
202
- };
1
+ import React, { useState, useEffect, useCallback } from 'react';
2
+ import { Card, Table, Tag, Button, Typography, Space, Tooltip, Popconfirm, message } from 'antd';
3
+ import { ReloadOutlined, DownloadOutlined, DeleteOutlined } from '@ant-design/icons';
4
+ import { Upload } from '@nocobase/client';
5
+ import { useApp } from '@nocobase/client-v2';
6
+ import { useT } from '../locale';
7
+ import { parseJsonText } from '../utils/jsonFields';
8
+
9
+ const STATUS_COLORS: Record<string, string> = {
10
+ pending: 'default',
11
+ running: 'processing',
12
+ succeeded: 'success',
13
+ failed: 'error',
14
+ canceled: 'warning',
15
+ timeout: 'error',
16
+ };
17
+
18
+ export const ExecutionHistory: React.FC = () => {
19
+ const api = useApp().apiClient;
20
+ const t = useT();
21
+ const [executions, setExecutions] = useState<any[]>([]);
22
+ const [loading, setLoading] = useState(false);
23
+ const [page, setPage] = useState(1);
24
+ const [total, setTotal] = useState(0);
25
+ const pageSize = 20;
26
+
27
+ const fetchExecutions = useCallback(async () => {
28
+ setLoading(true);
29
+ try {
30
+ const { data } = await api.request({
31
+ url: 'skillExecutions:list',
32
+ params: {
33
+ page,
34
+ pageSize,
35
+ sort: ['-createdAt'],
36
+ appends: ['skill', 'triggeredBy'],
37
+ },
38
+ });
39
+ const rawData = data?.data?.data ?? data?.data ?? [];
40
+ setExecutions(Array.isArray(rawData) ? rawData : []);
41
+ setTotal(data?.meta?.count || 0);
42
+ } catch {
43
+ // ignore
44
+ } finally {
45
+ setLoading(false);
46
+ }
47
+ }, [api, page]);
48
+
49
+ useEffect(() => {
50
+ fetchExecutions();
51
+ }, [fetchExecutions]);
52
+
53
+ const handleDelete = async (id: number) => {
54
+ try {
55
+ await api.request({
56
+ url: `skillExecutions:destroy`,
57
+ method: 'POST',
58
+ params: {
59
+ filterByTk: id,
60
+ },
61
+ });
62
+ message.success(t('Deleted successfully'));
63
+ fetchExecutions();
64
+ } catch (err: any) {
65
+ message.error(err?.response?.data?.errors?.[0]?.message || t('Delete failed'));
66
+ }
67
+ };
68
+
69
+ const columns = [
70
+ {
71
+ title: 'ID',
72
+ dataIndex: 'id',
73
+ key: 'id',
74
+ width: 80,
75
+ },
76
+ {
77
+ title: t('Skill'),
78
+ dataIndex: ['skill', 'title'],
79
+ key: 'skill',
80
+ width: 180,
81
+ },
82
+ {
83
+ title: t('Status'),
84
+ dataIndex: 'status',
85
+ key: 'status',
86
+ width: 120,
87
+ render: (status: string) => <Tag color={STATUS_COLORS[status] || 'default'}>{status}</Tag>,
88
+ },
89
+ {
90
+ title: t('Duration'),
91
+ dataIndex: 'durationMs',
92
+ key: 'duration',
93
+ width: 100,
94
+ render: (ms: number) => (ms ? `${(ms / 1000).toFixed(1)}s` : '-'),
95
+ },
96
+ {
97
+ title: t('Files'),
98
+ dataIndex: 'outputFiles',
99
+ key: 'files',
100
+ width: 250,
101
+ render: (files: any[], record: any) => {
102
+ files = parseJsonText(files, []);
103
+ if (!Array.isArray(files) || !files.length) return '-';
104
+ const formattedFiles = files.map((f, i) => ({
105
+ id: `${record.id}-${f.name}-${i}`,
106
+ title: f.name,
107
+ filename: f.name,
108
+ extname: f.name.includes('.') ? `.${f.name.split('.').pop()}` : '',
109
+ url: `/api/skillHub:download?execId=${record.id}&filename=${encodeURIComponent(f.name)}`,
110
+ status: 'done',
111
+ }));
112
+ return <Upload.ReadPretty value={formattedFiles} multiple={true} showFileName={true} />;
113
+ },
114
+ },
115
+ {
116
+ title: t('Triggered By'),
117
+ dataIndex: ['triggeredBy', 'nickname'],
118
+ key: 'triggeredBy',
119
+ width: 120,
120
+ render: (v: string) => v || '-',
121
+ },
122
+ {
123
+ title: t('Created At'),
124
+ dataIndex: 'createdAt',
125
+ key: 'createdAt',
126
+ width: 180,
127
+ render: (v: string) => (v ? new Date(v).toLocaleString() : '-'),
128
+ },
129
+ {
130
+ title: t('Output'),
131
+ key: 'output',
132
+ width: 200,
133
+ render: (_: any, record: any) => (
134
+ <Space direction="vertical" size={0}>
135
+ {record.stdout && (
136
+ <Tooltip title={record.stdout}>
137
+ <Typography.Text style={{ fontSize: 12, maxWidth: 200 }} ellipsis>
138
+ {record.stdout}
139
+ </Typography.Text>
140
+ </Tooltip>
141
+ )}
142
+ {record.stderr && (
143
+ <Tooltip title={record.stderr}>
144
+ <Typography.Text type="danger" style={{ fontSize: 12, maxWidth: 200 }} ellipsis>
145
+ {record.stderr}
146
+ </Typography.Text>
147
+ </Tooltip>
148
+ )}
149
+ </Space>
150
+ ),
151
+ },
152
+ {
153
+ title: t('Actions'),
154
+ key: 'actions',
155
+ width: 80,
156
+ fixed: 'right' as const,
157
+ render: (_: any, record: any) => (
158
+ <Space size="middle">
159
+ <Popconfirm
160
+ title={t('Are you sure to delete this execution history and its files?')}
161
+ onConfirm={() => handleDelete(record.id)}
162
+ okText={t('Yes')}
163
+ cancelText={t('No')}
164
+ >
165
+ <Button type="text" danger icon={<DeleteOutlined />} size="small" />
166
+ </Popconfirm>
167
+ </Space>
168
+ ),
169
+ },
170
+ ];
171
+
172
+ return (
173
+ <Card
174
+ title={t('Execution History')}
175
+ extra={
176
+ <Space>
177
+ <Button icon={<ReloadOutlined />} onClick={fetchExecutions} loading={loading}>
178
+ {t('Refresh')}
179
+ </Button>
180
+ </Space>
181
+ }
182
+ >
183
+ <Table
184
+ dataSource={executions}
185
+ columns={columns}
186
+ rowKey="id"
187
+ loading={loading}
188
+ size="middle"
189
+ pagination={{
190
+ current: page,
191
+ pageSize,
192
+ total,
193
+ onChange: setPage,
194
+ showTotal: (t) => `Total: ${t}`,
195
+ }}
196
+ scroll={{ x: 1200 }}
197
+ />
198
+ </Card>
199
+ );
200
+ };
@@ -1,55 +1,51 @@
1
- import React from 'react';
2
- import { Progress, Typography } from 'antd';
3
- import { LoadingOutlined, CheckCircleOutlined } from '@ant-design/icons';
4
-
5
- interface ExecutionProgressProps {
6
- execId: string;
7
- skillName: string;
8
- percent: number;
9
- log: string;
10
- }
11
-
12
- /**
13
- * Progress component rendered inside chat UI when receiving
14
- * SSE custom event: {action: "skillProgress", body: {...}}
15
- *
16
- * Usage in chat message renderer:
17
- * ```
18
- * if (event.action === 'skillProgress') {
19
- * return <ExecutionProgress {...event.body} />;
20
- * }
21
- * ```
22
- */
23
- export const ExecutionProgress: React.FC<ExecutionProgressProps> = ({
24
- skillName,
25
- percent,
26
- log,
27
- }) => {
28
- const isDone = percent >= 100;
29
-
30
- return (
31
- <div style={{ padding: '8px 12px', background: '#fafafa', borderRadius: 6, margin: '4px 0' }}>
32
- <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4 }}>
33
- {isDone ? (
34
- <CheckCircleOutlined style={{ color: '#52c41a' }} />
35
- ) : (
36
- <LoadingOutlined style={{ color: '#1890ff' }} />
37
- )}
38
- <Typography.Text strong style={{ fontSize: 13 }}>
39
- {skillName}
40
- </Typography.Text>
41
- </div>
42
- <Progress
43
- percent={percent}
44
- size="small"
45
- status={isDone ? 'success' : 'active'}
46
- strokeColor={isDone ? '#52c41a' : '#1890ff'}
47
- />
48
- {log && (
49
- <Typography.Text type="secondary" style={{ fontSize: 12 }}>
50
- {log}
51
- </Typography.Text>
52
- )}
53
- </div>
54
- );
55
- };
1
+ import React from 'react';
2
+ import { Progress, Typography } from 'antd';
3
+ import { LoadingOutlined, CheckCircleOutlined } from '@ant-design/icons';
4
+
5
+ interface ExecutionProgressProps {
6
+ execId: string;
7
+ skillName: string;
8
+ percent: number;
9
+ log: string;
10
+ }
11
+
12
+ /**
13
+ * Progress component rendered inside chat UI when receiving
14
+ * SSE custom event: {action: "skillProgress", body: {...}}
15
+ *
16
+ * Usage in chat message renderer:
17
+ * ```
18
+ * if (event.action === 'skillProgress') {
19
+ * return <ExecutionProgress {...event.body} />;
20
+ * }
21
+ * ```
22
+ */
23
+ export const ExecutionProgress: React.FC<ExecutionProgressProps> = ({ skillName, percent, log }) => {
24
+ const isDone = percent >= 100;
25
+
26
+ return (
27
+ <div style={{ padding: '8px 12px', background: '#fafafa', borderRadius: 6, margin: '4px 0' }}>
28
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4 }}>
29
+ {isDone ? (
30
+ <CheckCircleOutlined style={{ color: '#52c41a' }} />
31
+ ) : (
32
+ <LoadingOutlined style={{ color: '#1890ff' }} />
33
+ )}
34
+ <Typography.Text strong style={{ fontSize: 13 }}>
35
+ {skillName}
36
+ </Typography.Text>
37
+ </div>
38
+ <Progress
39
+ percent={percent}
40
+ size="small"
41
+ status={isDone ? 'success' : 'active'}
42
+ strokeColor={isDone ? '#52c41a' : '#1890ff'}
43
+ />
44
+ {log && (
45
+ <Typography.Text type="secondary" style={{ fontSize: 12 }}>
46
+ {log}
47
+ </Typography.Text>
48
+ )}
49
+ </div>
50
+ );
51
+ };