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
@@ -1,257 +1,2 @@
1
- import React from 'react';
2
- import { Button, Card, Drawer, Form, Input, Popconfirm, Space, Switch, Table, Tag, Typography, message } from 'antd';
3
- import { DeleteOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons';
4
- import { useRequest } from 'ahooks';
5
- import { useApp } from '@nocobase/client-v2';
6
-
7
- const { Text } = Typography;
8
-
9
- const parseSettings = (value: string) => {
10
- const text = String(value || '').trim();
11
- if (!text) return {};
12
- return JSON.parse(text);
13
- };
14
-
15
- export const HarnessProfilesTab: React.FC = () => {
16
- const api = useApp().apiClient;
17
- const [open, setOpen] = React.useState(false);
18
- const [editingRecord, setEditingRecord] = React.useState<any>(null);
19
- const [form] = Form.useForm();
20
-
21
- const { data, loading, refresh } = useRequest(() =>
22
- api.request({
23
- url: 'agentHarnessProfiles:list',
24
- params: {
25
- sort: ['tag'],
26
- pageSize: 100,
27
- },
28
- }),
29
- );
30
-
31
- const rows = React.useMemo(() => {
32
- const raw = (data as any)?.data;
33
- return Array.isArray(raw) ? raw : [];
34
- }, [data]);
35
-
36
- const openDrawer = (record?: any) => {
37
- setEditingRecord(record || null);
38
- form.resetFields();
39
- form.setFieldsValue(
40
- record
41
- ? {
42
- ...record,
43
- settingsText: JSON.stringify(record.settings || {}, null, 2),
44
- }
45
- : {
46
- tag: '',
47
- title: '',
48
- description: '',
49
- enabled: true,
50
- settingsText: JSON.stringify(
51
- {
52
- requirePlanApproval: true,
53
- allowSubAgents: true,
54
- allowToolCalls: true,
55
- maxParallelSubAgents: 3,
56
- maxControllerSteps: 100,
57
- },
58
- null,
59
- 2,
60
- ),
61
- },
62
- );
63
- setOpen(true);
64
- };
65
-
66
- const closeDrawer = () => {
67
- setOpen(false);
68
- setEditingRecord(null);
69
- };
70
-
71
- const saveProfile = async (values: any) => {
72
- let settings: any;
73
- try {
74
- settings = parseSettings(values.settingsText);
75
- } catch (error: any) {
76
- message.error(`Settings JSON is invalid: ${error?.message || error}`);
77
- return;
78
- }
79
-
80
- const payload = {
81
- tag: String(values.tag || '').trim(),
82
- title: values.title,
83
- description: values.description,
84
- enabled: values.enabled !== false,
85
- settings,
86
- };
87
-
88
- try {
89
- if (editingRecord) {
90
- await api.request({
91
- url: 'agentHarnessProfiles:update',
92
- method: 'put',
93
- params: { filterByTk: editingRecord.id },
94
- data: payload,
95
- });
96
- message.success('Harness profile updated');
97
- } else {
98
- await api.request({
99
- url: 'agentHarnessProfiles:create',
100
- method: 'post',
101
- data: payload,
102
- });
103
- message.success('Harness profile created');
104
- }
105
- closeDrawer();
106
- refresh();
107
- } catch (error: any) {
108
- const msg = error?.response?.data?.errors?.[0]?.message || error?.message || 'unknown error';
109
- message.error(`Save failed: ${msg}`);
110
- }
111
- };
112
-
113
- const deleteProfile = async (id: string | number) => {
114
- try {
115
- await api.request({
116
- url: 'agentHarnessProfiles:destroy',
117
- method: 'delete',
118
- params: { filterByTk: id },
119
- });
120
- message.success('Harness profile deleted');
121
- refresh();
122
- } catch (error: any) {
123
- message.error(`Delete failed: ${error?.message || 'unknown error'}`);
124
- }
125
- };
126
-
127
- const columns = [
128
- {
129
- title: 'Tag',
130
- dataIndex: 'tag',
131
- key: 'tag',
132
- width: 140,
133
- render: (tag: string) => <Tag color="blue">{tag}</Tag>,
134
- },
135
- {
136
- title: 'Title',
137
- dataIndex: 'title',
138
- key: 'title',
139
- render: (title: string, record: any) => title || record.tag,
140
- },
141
- {
142
- title: 'Enabled',
143
- dataIndex: 'enabled',
144
- key: 'enabled',
145
- width: 90,
146
- render: (enabled: boolean, record: any) => (
147
- <Switch
148
- size="small"
149
- checked={enabled !== false}
150
- onChange={async (checked) => {
151
- await api.request({
152
- url: 'agentHarnessProfiles:update',
153
- method: 'put',
154
- params: { filterByTk: record.id },
155
- data: { enabled: checked },
156
- });
157
- refresh();
158
- }}
159
- />
160
- ),
161
- },
162
- {
163
- title: 'Settings',
164
- key: 'settings',
165
- render: (_: any, record: any) => (
166
- <Space size={4} wrap>
167
- {Object.entries(record.settings || {})
168
- .slice(0, 5)
169
- .map(([key, value]) => (
170
- <Tag key={key}>
171
- {key}: {String(value)}
172
- </Tag>
173
- ))}
174
- </Space>
175
- ),
176
- },
177
- {
178
- title: 'Actions',
179
- key: 'actions',
180
- width: 150,
181
- render: (_: any, record: any) => (
182
- <Space>
183
- <Button type="link" size="small" icon={<EditOutlined />} onClick={() => openDrawer(record)}>
184
- Edit
185
- </Button>
186
- <Popconfirm title="Delete this profile?" onConfirm={() => deleteProfile(record.id)}>
187
- <Button type="link" size="small" danger icon={<DeleteOutlined />}>
188
- Delete
189
- </Button>
190
- </Popconfirm>
191
- </Space>
192
- ),
193
- },
194
- ];
195
-
196
- return (
197
- <div>
198
- <Card bordered={false}>
199
- <Space direction="vertical" size={16} style={{ width: '100%' }}>
200
- <div style={{ display: 'flex', justifyContent: 'space-between', gap: 16 }}>
201
- <Text type="secondary">
202
- Harness profiles are selected by orchestration rules through the harnessTag field.
203
- </Text>
204
- <Button type="primary" icon={<PlusOutlined />} onClick={() => openDrawer()}>
205
- New Profile
206
- </Button>
207
- </div>
208
- <Table
209
- rowKey="id"
210
- loading={loading}
211
- dataSource={rows}
212
- columns={columns}
213
- pagination={false}
214
- scroll={{ x: 'max-content' }}
215
- />
216
- </Space>
217
- </Card>
218
-
219
- <Drawer
220
- title={editingRecord ? 'Edit Harness Profile' : 'New Harness Profile'}
221
- width={560}
222
- open={open}
223
- onClose={closeDrawer}
224
- extra={
225
- <Space>
226
- <Button onClick={closeDrawer}>Cancel</Button>
227
- <Button type="primary" onClick={() => form.submit()}>
228
- Save
229
- </Button>
230
- </Space>
231
- }
232
- >
233
- <Form form={form} layout="vertical" onFinish={saveProfile}>
234
- <Form.Item name="tag" label="Tag" rules={[{ required: true, message: 'Tag is required' }]}>
235
- <Input placeholder="default" disabled={editingRecord?.tag === 'default'} />
236
- </Form.Item>
237
- <Form.Item name="title" label="Title">
238
- <Input />
239
- </Form.Item>
240
- <Form.Item name="description" label="Description">
241
- <Input.TextArea rows={3} />
242
- </Form.Item>
243
- <Form.Item
244
- name="settingsText"
245
- label="Settings JSON"
246
- rules={[{ required: true, message: 'Settings JSON is required' }]}
247
- >
248
- <Input.TextArea rows={12} spellCheck={false} />
249
- </Form.Item>
250
- <Form.Item name="enabled" label="Enabled" valuePropName="checked">
251
- <Switch />
252
- </Form.Item>
253
- </Form>
254
- </Drawer>
255
- </div>
256
- );
257
- };
1
+ export { HarnessProfilesTab } from '../client-v2/components/HarnessProfilesTab';
2
+ export { HarnessProfilesTab as default } from '../client-v2/components/HarnessProfilesTab';
@@ -1,106 +1,97 @@
1
- import React from 'react';
2
- import { Tabs } from 'antd';
3
- import {
4
- ApartmentOutlined,
5
- BarChartOutlined,
6
- CheckCircleOutlined,
7
- CodeOutlined,
8
- HistoryOutlined,
9
- MonitorOutlined,
10
- ProfileOutlined,
11
- SettingOutlined,
12
- } from '@ant-design/icons';
13
- import { RulesTab } from './RulesTab';
14
- import { TracingTab } from './TracingTab';
15
- import { AgentRunsTab } from './AgentRunsTab';
16
- import { HarnessProfilesTab } from './HarnessProfilesTab';
17
- import { AIEmployeesProvider } from './AIEmployeesContext';
18
- import { SkillManager, ExecutionHistory, SkillMetrics, LoopSettings } from './skill-hub';
19
-
20
- const OrchestratorSettings: React.FC = () => {
21
- return (
22
- <AIEmployeesProvider>
23
- <div style={{ padding: '0 24px 24px' }}>
24
- <Tabs
25
- defaultActiveKey="rules"
26
- items={[
27
- {
28
- key: 'rules',
29
- label: (
30
- <span>
31
- <ApartmentOutlined /> Orchestration Rules
32
- </span>
33
- ),
34
- children: <RulesTab />,
35
- },
36
- {
37
- key: 'tracing',
38
- label: (
39
- <span>
40
- <MonitorOutlined /> Execution Tracing
41
- </span>
42
- ),
43
- children: <TracingTab />,
44
- },
45
- {
46
- key: 'agent-runs',
47
- label: (
48
- <span>
49
- <ProfileOutlined /> Agent Runs
50
- </span>
51
- ),
52
- children: <AgentRunsTab />,
53
- },
54
- {
55
- key: 'harness-profiles',
56
- label: (
57
- <span>
58
- <SettingOutlined /> Harness Profiles
59
- </span>
60
- ),
61
- children: <HarnessProfilesTab />,
62
- },
63
- {
64
- key: 'skill-definitions',
65
- label: (
66
- <span>
67
- <CodeOutlined /> Skill Hub Definitions
68
- </span>
69
- ),
70
- children: <SkillManager />,
71
- },
72
- {
73
- key: 'skill-executions',
74
- label: (
75
- <span>
76
- <HistoryOutlined /> Execution History
77
- </span>
78
- ),
79
- children: <ExecutionHistory />,
80
- },
81
- {
82
- key: 'skill-loop-settings',
83
- label: (
84
- <span>
85
- <CheckCircleOutlined /> Skill Review Settings
86
- </span>
87
- ),
88
- children: <LoopSettings />,
89
- },
90
- {
91
- key: 'skill-metrics',
92
- label: (
93
- <span>
94
- <BarChartOutlined /> Metrics
95
- </span>
96
- ),
97
- children: <SkillMetrics />,
98
- },
99
- ]}
100
- />
101
- </div>
102
- </AIEmployeesProvider>
103
- );
104
- };
105
-
106
- export { OrchestratorSettings };
1
+ import React from 'react';
2
+ import { Tabs } from 'antd';
3
+ import {
4
+ BarChartOutlined,
5
+ CheckCircleOutlined,
6
+ CodeOutlined,
7
+ HistoryOutlined,
8
+ MonitorOutlined,
9
+ SettingOutlined,
10
+ } from '@ant-design/icons';
11
+ import { TracingTab } from '../client-v2/components/TracingTab';
12
+ import { AgentRunsTab } from './AgentRunsTab';
13
+ import { HarnessProfilesTab } from './HarnessProfilesTab';
14
+ import { AIEmployeesProvider } from '../client-v2/components/AIEmployeesContext';
15
+ import { useT } from './skill-hub/locale';
16
+ import { SkillManager, ExecutionHistory, SkillMetrics, LoopSettings } from './skill-hub';
17
+
18
+ const OrchestratorSettings: React.FC = () => {
19
+ const t = useT();
20
+
21
+ return (
22
+ <AIEmployeesProvider>
23
+ <div style={{ padding: '0 24px 24px' }}>
24
+ <Tabs
25
+ defaultActiveKey="native-monitor"
26
+ items={[
27
+ {
28
+ key: 'native-monitor',
29
+ label: (
30
+ <span>
31
+ <MonitorOutlined /> {t('Native Monitor')}
32
+ </span>
33
+ ),
34
+ children: <AgentRunsTab />,
35
+ },
36
+ {
37
+ key: 'tracing',
38
+ label: (
39
+ <span>
40
+ <MonitorOutlined /> {t('Execution Tracing')}
41
+ </span>
42
+ ),
43
+ children: <TracingTab />,
44
+ },
45
+ {
46
+ key: 'harness-profiles',
47
+ label: (
48
+ <span>
49
+ <SettingOutlined /> {t('Policy Profiles')}
50
+ </span>
51
+ ),
52
+ children: <HarnessProfilesTab />,
53
+ },
54
+ {
55
+ key: 'skill-definitions',
56
+ label: (
57
+ <span>
58
+ <CodeOutlined /> {t('Skill Hub Definitions')}
59
+ </span>
60
+ ),
61
+ children: <SkillManager />,
62
+ },
63
+ {
64
+ key: 'skill-executions',
65
+ label: (
66
+ <span>
67
+ <HistoryOutlined /> {t('Execution History')}
68
+ </span>
69
+ ),
70
+ children: <ExecutionHistory />,
71
+ },
72
+ {
73
+ key: 'skill-loop-settings',
74
+ label: (
75
+ <span>
76
+ <CheckCircleOutlined /> {t('Skill Review Settings')}
77
+ </span>
78
+ ),
79
+ children: <LoopSettings />,
80
+ },
81
+ {
82
+ key: 'skill-metrics',
83
+ label: (
84
+ <span>
85
+ <BarChartOutlined /> {t('Metrics')}
86
+ </span>
87
+ ),
88
+ children: <SkillMetrics />,
89
+ },
90
+ ]}
91
+ />
92
+ </div>
93
+ </AIEmployeesProvider>
94
+ );
95
+ };
96
+
97
+ export { OrchestratorSettings };