plugin-agent-orchestrator 1.0.38 → 1.1.2
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/253.9f0537713cee9e6c.js +10 -0
- package/dist/client-v2/418.ce8f5b2b8a229d1d.js +10 -0
- package/dist/client-v2/53.7c29c28043e9112d.js +10 -0
- package/dist/client-v2/794.9bbb8d3a61b2bdf2.js +10 -0
- package/dist/client-v2/993.82778b6fd6db3cb1.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +6 -6
- package/dist/locale/en-US.json +56 -2
- package/dist/locale/vi-VN.json +56 -2
- package/dist/locale/zh-CN.json +56 -2
- package/dist/node_modules/ajv/.tonic_example.js +20 -0
- package/dist/node_modules/ajv/LICENSE +22 -0
- package/dist/node_modules/ajv/dist/ajv.bundle.js +7189 -0
- package/dist/node_modules/ajv/dist/ajv.min.js +3 -0
- package/dist/node_modules/ajv/lib/ajv.d.ts +397 -0
- package/dist/node_modules/ajv/lib/ajv.js +3 -0
- package/dist/node_modules/ajv/lib/cache.js +26 -0
- package/dist/node_modules/ajv/lib/compile/async.js +90 -0
- package/dist/node_modules/ajv/lib/compile/equal.js +5 -0
- package/dist/node_modules/ajv/lib/compile/error_classes.js +34 -0
- package/dist/node_modules/ajv/lib/compile/formats.js +142 -0
- package/dist/node_modules/ajv/lib/compile/index.js +387 -0
- package/dist/node_modules/ajv/lib/compile/resolve.js +270 -0
- package/dist/node_modules/ajv/lib/compile/rules.js +66 -0
- package/dist/node_modules/ajv/lib/compile/schema_obj.js +9 -0
- package/dist/node_modules/ajv/lib/compile/ucs2length.js +20 -0
- package/dist/node_modules/ajv/lib/compile/util.js +239 -0
- package/dist/node_modules/ajv/lib/data.js +49 -0
- package/dist/node_modules/ajv/lib/definition_schema.js +37 -0
- package/dist/node_modules/ajv/lib/dot/_limit.jst +113 -0
- package/dist/node_modules/ajv/lib/dot/_limitItems.jst +12 -0
- package/dist/node_modules/ajv/lib/dot/_limitLength.jst +12 -0
- package/dist/node_modules/ajv/lib/dot/_limitProperties.jst +12 -0
- package/dist/node_modules/ajv/lib/dot/allOf.jst +32 -0
- package/dist/node_modules/ajv/lib/dot/anyOf.jst +46 -0
- package/dist/node_modules/ajv/lib/dot/coerce.def +51 -0
- package/dist/node_modules/ajv/lib/dot/comment.jst +9 -0
- package/dist/node_modules/ajv/lib/dot/const.jst +11 -0
- package/dist/node_modules/ajv/lib/dot/contains.jst +55 -0
- package/dist/node_modules/ajv/lib/dot/custom.jst +191 -0
- package/dist/node_modules/ajv/lib/dot/defaults.def +47 -0
- package/dist/node_modules/ajv/lib/dot/definitions.def +203 -0
- package/dist/node_modules/ajv/lib/dot/dependencies.jst +79 -0
- package/dist/node_modules/ajv/lib/dot/enum.jst +30 -0
- package/dist/node_modules/ajv/lib/dot/errors.def +194 -0
- package/dist/node_modules/ajv/lib/dot/format.jst +106 -0
- package/dist/node_modules/ajv/lib/dot/if.jst +73 -0
- package/dist/node_modules/ajv/lib/dot/items.jst +98 -0
- package/dist/node_modules/ajv/lib/dot/missing.def +39 -0
- package/dist/node_modules/ajv/lib/dot/multipleOf.jst +22 -0
- package/dist/node_modules/ajv/lib/dot/not.jst +43 -0
- package/dist/node_modules/ajv/lib/dot/oneOf.jst +54 -0
- package/dist/node_modules/ajv/lib/dot/pattern.jst +14 -0
- package/dist/node_modules/ajv/lib/dot/properties.jst +245 -0
- package/dist/node_modules/ajv/lib/dot/propertyNames.jst +52 -0
- package/dist/node_modules/ajv/lib/dot/ref.jst +85 -0
- package/dist/node_modules/ajv/lib/dot/required.jst +108 -0
- package/dist/node_modules/ajv/lib/dot/uniqueItems.jst +62 -0
- package/dist/node_modules/ajv/lib/dot/validate.jst +276 -0
- package/dist/node_modules/ajv/lib/dotjs/_limit.js +163 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitItems.js +80 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitLength.js +85 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitProperties.js +80 -0
- package/dist/node_modules/ajv/lib/dotjs/allOf.js +42 -0
- package/dist/node_modules/ajv/lib/dotjs/anyOf.js +73 -0
- package/dist/node_modules/ajv/lib/dotjs/comment.js +14 -0
- package/dist/node_modules/ajv/lib/dotjs/const.js +56 -0
- package/dist/node_modules/ajv/lib/dotjs/contains.js +81 -0
- package/dist/node_modules/ajv/lib/dotjs/custom.js +228 -0
- package/dist/node_modules/ajv/lib/dotjs/dependencies.js +168 -0
- package/dist/node_modules/ajv/lib/dotjs/enum.js +66 -0
- package/dist/node_modules/ajv/lib/dotjs/format.js +150 -0
- package/dist/node_modules/ajv/lib/dotjs/if.js +103 -0
- package/dist/node_modules/ajv/lib/dotjs/index.js +33 -0
- package/dist/node_modules/ajv/lib/dotjs/items.js +140 -0
- package/dist/node_modules/ajv/lib/dotjs/multipleOf.js +80 -0
- package/dist/node_modules/ajv/lib/dotjs/not.js +84 -0
- package/dist/node_modules/ajv/lib/dotjs/oneOf.js +73 -0
- package/dist/node_modules/ajv/lib/dotjs/pattern.js +75 -0
- package/dist/node_modules/ajv/lib/dotjs/properties.js +335 -0
- package/dist/node_modules/ajv/lib/dotjs/propertyNames.js +81 -0
- package/dist/node_modules/ajv/lib/dotjs/ref.js +124 -0
- package/dist/node_modules/ajv/lib/dotjs/required.js +270 -0
- package/dist/node_modules/ajv/lib/dotjs/uniqueItems.js +86 -0
- package/dist/node_modules/ajv/lib/dotjs/validate.js +482 -0
- package/dist/node_modules/ajv/lib/keyword.js +146 -0
- package/dist/node_modules/ajv/lib/refs/data.json +17 -0
- package/dist/node_modules/ajv/lib/refs/json-schema-draft-04.json +149 -0
- package/dist/node_modules/ajv/lib/refs/json-schema-draft-06.json +154 -0
- package/dist/node_modules/ajv/lib/refs/json-schema-draft-07.json +168 -0
- package/dist/node_modules/ajv/lib/refs/json-schema-secure.json +94 -0
- package/dist/node_modules/ajv/node_modules/json-schema-traverse/.eslintrc.yml +27 -0
- package/dist/node_modules/ajv/node_modules/json-schema-traverse/.travis.yml +8 -0
- package/dist/node_modules/ajv/node_modules/json-schema-traverse/index.js +89 -0
- package/dist/node_modules/ajv/node_modules/json-schema-traverse/package.json +43 -0
- package/dist/node_modules/ajv/node_modules/json-schema-traverse/spec/.eslintrc.yml +6 -0
- package/dist/node_modules/ajv/node_modules/json-schema-traverse/spec/fixtures/schema.js +125 -0
- package/dist/node_modules/ajv/node_modules/json-schema-traverse/spec/index.spec.js +171 -0
- package/dist/node_modules/ajv/package.json +1 -0
- package/dist/node_modules/ajv/scripts/.eslintrc.yml +3 -0
- package/dist/node_modules/ajv/scripts/bundle.js +61 -0
- package/dist/node_modules/ajv/scripts/compile-dots.js +73 -0
- package/dist/node_modules/ajv/scripts/info +10 -0
- package/dist/node_modules/ajv/scripts/prepare-tests +12 -0
- package/dist/node_modules/ajv/scripts/publish-built-version +32 -0
- package/dist/node_modules/ajv/scripts/travis-gh-pages +23 -0
- package/dist/server/collections/skill-definitions.js +31 -0
- package/dist/server/collections/skill-executions.js +19 -0
- package/dist/server/collections/skill-registry-installations.js +70 -0
- package/dist/server/migrations/20260621000000-native-policy-profile-defaults.js +0 -3
- package/dist/server/migrations/20260727000000-remove-unused-knowledge-scopes.js +51 -0
- package/dist/server/migrations/20260727010000-backfill-skill-tool-names.js +66 -0
- package/dist/server/plugin.js +107 -2
- package/dist/server/resources/agent-knowledge-insights.js +273 -0
- package/dist/server/services/AgentExecutionContext.js +45 -0
- package/dist/server/services/AgentMemoryContextService.js +57 -19
- package/dist/server/services/CodeValidator.js +1 -0
- package/dist/server/services/ExecutionSpanService.js +10 -2
- package/dist/server/services/InputSchemaValidator.js +83 -0
- package/dist/server/services/NativeSubAgentObserver.js +63 -8
- package/dist/server/services/SandboxRunner.js +6 -2
- package/dist/server/services/SkillAccessService.js +109 -0
- package/dist/server/services/SkillManager.js +2 -0
- package/dist/server/services/SkillRepositoryService.js +70 -0
- package/dist/server/skill-hub/actions/git-import.js +479 -216
- package/dist/server/skill-hub/mcp/McpController.js +8 -5
- package/dist/server/skill-hub/middlewares/git-import-request-method-policy.js +69 -0
- package/dist/server/skill-hub/plugin.js +68 -14
- package/dist/server/skill-hub/services/RegistrySkillInstallationService.js +249 -0
- package/dist/server/skill-hub/services/RegistrySkillSnapshotService.js +228 -0
- package/dist/server/skill-hub/tasks/SkillExecutionTask.js +15 -3
- package/dist/server/tools/external-rag-search.js +152 -12
- package/dist/server/tools/skill-execute.js +23 -2
- package/dist/server/utils/ctx-utils.js +2 -2
- package/dist/server/utils/skill-tool-name.js +73 -0
- package/package.json +9 -3
- package/src/client-v2/components/AgentBindingsTab.tsx +269 -0
- package/src/client-v2/components/HarnessProfilesTab.tsx +1 -2
- package/src/client-v2/components/KnowledgeAccessTab.tsx +116 -0
- package/src/client-v2/components/MemoryInspectorTab.tsx +125 -0
- package/src/client-v2/components/RetrievalTraceTab.tsx +162 -0
- package/src/client-v2/pages/AgentBindingsPage.tsx +13 -0
- package/src/client-v2/pages/KnowledgeAccessPage.tsx +10 -0
- package/src/client-v2/pages/MemoryInspectorPage.tsx +13 -0
- package/src/client-v2/pages/RetrievalTracePage.tsx +10 -0
- package/src/client-v2/plugin.tsx +28 -0
- package/src/locale/en-US.json +56 -2
- package/src/locale/vi-VN.json +56 -2
- package/src/locale/zh-CN.json +56 -2
- package/src/server/__tests__/agent-execution-context.test.ts +18 -0
- package/src/server/__tests__/agent-knowledge-insights.test.ts +123 -0
- package/src/server/__tests__/external-rag-search.test.ts +107 -0
- package/src/server/__tests__/input-schema-validator.test.ts +26 -0
- package/src/server/__tests__/native-sub-agent-observer.test.ts +141 -9
- package/src/server/__tests__/skill-access-service.test.ts +64 -0
- package/src/server/__tests__/skill-execute.test.ts +37 -0
- package/src/server/__tests__/skill-tool-name.test.ts +23 -0
- package/src/server/collections/skill-definitions.ts +31 -0
- package/src/server/collections/skill-executions.ts +19 -0
- package/src/server/collections/skill-registry-installations.ts +41 -0
- package/src/server/migrations/20260621000000-native-policy-profile-defaults.ts +0 -3
- package/src/server/migrations/20260727000000-remove-unused-knowledge-scopes.ts +25 -0
- package/src/server/migrations/20260727010000-backfill-skill-tool-names.ts +45 -0
- package/src/server/plugin.ts +107 -1
- package/src/server/resources/agent-knowledge-insights.ts +304 -0
- package/src/server/services/AgentExecutionContext.ts +23 -0
- package/src/server/services/AgentMemoryContextService.ts +63 -19
- package/src/server/services/CodeValidator.ts +1 -0
- package/src/server/services/ExecutionSpanService.ts +119 -110
- package/src/server/services/InputSchemaValidator.ts +44 -0
- package/src/server/services/NativeSubAgentObserver.ts +592 -528
- package/src/server/services/SandboxRunner.ts +6 -0
- package/src/server/services/SkillAccessService.ts +100 -0
- package/src/server/services/SkillManager.ts +2 -0
- package/src/server/services/SkillRepositoryService.ts +98 -2
- package/src/server/services/__tests__/SkillRepositoryService.test.ts +33 -0
- package/src/server/skill-hub/actions/__tests__/git-import.test.ts +501 -0
- package/src/server/skill-hub/actions/git-import.ts +682 -236
- package/src/server/skill-hub/mcp/McpController.ts +8 -14
- package/src/server/skill-hub/middlewares/git-import-request-method-policy.ts +51 -0
- package/src/server/skill-hub/plugin.ts +79 -13
- package/src/server/skill-hub/services/RegistrySkillInstallationService.ts +281 -0
- package/src/server/skill-hub/services/RegistrySkillSnapshotService.ts +239 -0
- package/src/server/skill-hub/services/__tests__/RegistrySkillInstallationService.test.ts +295 -0
- package/src/server/skill-hub/services/__tests__/RegistrySkillSnapshotService.test.ts +63 -0
- package/src/server/skill-hub/tasks/SkillExecutionTask.ts +14 -2
- package/src/server/tools/external-rag-search.ts +215 -14
- package/src/server/tools/skill-execute.ts +24 -2
- package/src/server/utils/ctx-utils.ts +1 -1
- package/src/server/utils/skill-tool-name.ts +58 -0
- package/dist/client-v2/418.29e713f79131eece.js +0 -10
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "代理协调器",
|
|
5
5
|
"displayName.vi-VN": "Điều phối Agent",
|
|
6
6
|
"description": "Native AI Employee sub-agent monitoring, policy, and memory context layer for NocoBase plugin-ai.",
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.1.2",
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
9
|
"main": "dist/server/index.js",
|
|
10
10
|
"keywords": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"adm-zip": "^0.5.10",
|
|
35
|
-
"
|
|
35
|
+
"ajv": "^6.12.6",
|
|
36
36
|
"zod": "^3.23.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
@@ -42,6 +42,12 @@
|
|
|
42
42
|
"@nocobase/ai": "2.x",
|
|
43
43
|
"@nocobase/plugin-ai": "2.x",
|
|
44
44
|
"@nocobase/client-v2": "2.x",
|
|
45
|
-
"@nocobase/flow-engine": "2.x"
|
|
45
|
+
"@nocobase/flow-engine": "2.x",
|
|
46
|
+
"plugin-git-manager": "^2.0.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"plugin-git-manager": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
46
52
|
}
|
|
47
53
|
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { DeleteOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons';
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Card,
|
|
6
|
+
Drawer,
|
|
7
|
+
Form,
|
|
8
|
+
InputNumber,
|
|
9
|
+
Popconfirm,
|
|
10
|
+
Select,
|
|
11
|
+
Space,
|
|
12
|
+
Switch,
|
|
13
|
+
Table,
|
|
14
|
+
Tag,
|
|
15
|
+
Typography,
|
|
16
|
+
message,
|
|
17
|
+
} from 'antd';
|
|
18
|
+
import { AIEmployeeSelect } from './AIEmployeeSelect';
|
|
19
|
+
import { useAIEmployees } from './AIEmployeesContext';
|
|
20
|
+
import { useApiClient, useRequest } from '../hooks/useApiRequest';
|
|
21
|
+
import { useT } from '../skill-hub/locale';
|
|
22
|
+
|
|
23
|
+
type BindingRecord = {
|
|
24
|
+
id: string | number;
|
|
25
|
+
leaderUsername: string;
|
|
26
|
+
subAgentUsername: string;
|
|
27
|
+
harnessTag?: string;
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
maxDepth?: number;
|
|
30
|
+
timeout?: number;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type ProfileRecord = { tag: string; title?: string; enabled?: boolean };
|
|
34
|
+
|
|
35
|
+
type BindingForm = Omit<BindingRecord, 'id'>;
|
|
36
|
+
|
|
37
|
+
function rowsFromResponse<T>(value: unknown): T[] {
|
|
38
|
+
const response = value as { data?: unknown } | undefined;
|
|
39
|
+
return Array.isArray(response?.data) ? (response.data as T[]) : [];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function errorText(error: unknown): string {
|
|
43
|
+
const response = error as { response?: { data?: { errors?: Array<{ message?: string }> } }; message?: string };
|
|
44
|
+
return response.response?.data?.errors?.[0]?.message || response.message || 'Unknown error';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const AgentBindingsTab: React.FC = () => {
|
|
48
|
+
const api = useApiClient();
|
|
49
|
+
const t = useT();
|
|
50
|
+
const { employeeMap } = useAIEmployees();
|
|
51
|
+
const [form] = Form.useForm<BindingForm>();
|
|
52
|
+
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
53
|
+
const [editing, setEditing] = useState<BindingRecord | null>(null);
|
|
54
|
+
|
|
55
|
+
const bindingsRequest = useRequest({
|
|
56
|
+
url: 'orchestratorConfig:list',
|
|
57
|
+
params: { sort: ['leaderUsername', 'subAgentUsername'], pageSize: 200 },
|
|
58
|
+
});
|
|
59
|
+
const profilesRequest = useRequest({
|
|
60
|
+
url: 'agentHarnessProfiles:list',
|
|
61
|
+
params: { sort: ['tag'], pageSize: 100 },
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const bindings = useMemo(() => rowsFromResponse<BindingRecord>(bindingsRequest.data), [bindingsRequest.data]);
|
|
65
|
+
const profiles = useMemo(() => rowsFromResponse<ProfileRecord>(profilesRequest.data), [profilesRequest.data]);
|
|
66
|
+
const profileOptions = useMemo(
|
|
67
|
+
() =>
|
|
68
|
+
profiles
|
|
69
|
+
.filter((profile) => profile.enabled !== false)
|
|
70
|
+
.map((profile) => ({
|
|
71
|
+
label: profile.title ? `${profile.title} (${profile.tag})` : profile.tag,
|
|
72
|
+
value: profile.tag,
|
|
73
|
+
})),
|
|
74
|
+
[profiles],
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const closeDrawer = () => {
|
|
78
|
+
setDrawerOpen(false);
|
|
79
|
+
setEditing(null);
|
|
80
|
+
form.resetFields();
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const openDrawer = (binding?: BindingRecord) => {
|
|
84
|
+
setEditing(binding || null);
|
|
85
|
+
form.setFieldsValue(
|
|
86
|
+
binding || {
|
|
87
|
+
enabled: true,
|
|
88
|
+
harnessTag: 'default',
|
|
89
|
+
maxDepth: 1,
|
|
90
|
+
timeout: 120000,
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
|
+
setDrawerOpen(true);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const saveBinding = async (values: BindingForm) => {
|
|
97
|
+
const payload = {
|
|
98
|
+
...values,
|
|
99
|
+
leaderUsername: values.leaderUsername?.trim(),
|
|
100
|
+
subAgentUsername: values.subAgentUsername?.trim(),
|
|
101
|
+
harnessTag: values.harnessTag || 'default',
|
|
102
|
+
enabled: values.enabled !== false,
|
|
103
|
+
};
|
|
104
|
+
try {
|
|
105
|
+
if (editing) {
|
|
106
|
+
await api.request({
|
|
107
|
+
url: 'orchestratorConfig:update',
|
|
108
|
+
method: 'put',
|
|
109
|
+
params: { filterByTk: editing.id },
|
|
110
|
+
data: payload,
|
|
111
|
+
});
|
|
112
|
+
message.success(t('Agent binding updated'));
|
|
113
|
+
} else {
|
|
114
|
+
await api.request({ url: 'orchestratorConfig:create', method: 'post', data: payload });
|
|
115
|
+
message.success(t('Agent binding created'));
|
|
116
|
+
}
|
|
117
|
+
closeDrawer();
|
|
118
|
+
bindingsRequest.refresh();
|
|
119
|
+
} catch (error) {
|
|
120
|
+
message.error(t('Save failed: {{message}}', { message: errorText(error) }));
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const removeBinding = async (id: string | number) => {
|
|
125
|
+
try {
|
|
126
|
+
await api.request({
|
|
127
|
+
url: 'orchestratorConfig:destroy',
|
|
128
|
+
method: 'delete',
|
|
129
|
+
params: { filterByTk: id },
|
|
130
|
+
});
|
|
131
|
+
message.success(t('Agent binding deleted'));
|
|
132
|
+
bindingsRequest.refresh();
|
|
133
|
+
} catch (error) {
|
|
134
|
+
message.error(t('Delete failed: {{message}}', { message: errorText(error) }));
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const columns = [
|
|
139
|
+
{
|
|
140
|
+
title: t('Leader (Orchestrator)'),
|
|
141
|
+
dataIndex: 'leaderUsername',
|
|
142
|
+
key: 'leaderUsername',
|
|
143
|
+
render: (username: string) => <Tag color="blue">{employeeMap.get(username) || username}</Tag>,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
title: t('Sub-Agent'),
|
|
147
|
+
dataIndex: 'subAgentUsername',
|
|
148
|
+
key: 'subAgentUsername',
|
|
149
|
+
render: (username: string) => <Tag color="green">{employeeMap.get(username) || username}</Tag>,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
title: t('Policy Profile'),
|
|
153
|
+
dataIndex: 'harnessTag',
|
|
154
|
+
key: 'harnessTag',
|
|
155
|
+
render: (tag: string) => <Tag color="purple">{tag || 'default'}</Tag>,
|
|
156
|
+
},
|
|
157
|
+
{ title: t('Max Delegation Depth'), dataIndex: 'maxDepth', key: 'maxDepth', width: 140 },
|
|
158
|
+
{
|
|
159
|
+
title: t('Enabled'),
|
|
160
|
+
dataIndex: 'enabled',
|
|
161
|
+
key: 'enabled',
|
|
162
|
+
width: 100,
|
|
163
|
+
render: (enabled: boolean, binding: BindingRecord) => (
|
|
164
|
+
<Switch
|
|
165
|
+
size="small"
|
|
166
|
+
checked={enabled !== false}
|
|
167
|
+
aria-label={t('Enabled')}
|
|
168
|
+
onChange={async (checked) => {
|
|
169
|
+
await api.request({
|
|
170
|
+
url: 'orchestratorConfig:update',
|
|
171
|
+
method: 'put',
|
|
172
|
+
params: { filterByTk: binding.id },
|
|
173
|
+
data: { enabled: checked },
|
|
174
|
+
});
|
|
175
|
+
bindingsRequest.refresh();
|
|
176
|
+
}}
|
|
177
|
+
/>
|
|
178
|
+
),
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
title: t('Actions'),
|
|
182
|
+
key: 'actions',
|
|
183
|
+
width: 150,
|
|
184
|
+
render: (_: unknown, binding: BindingRecord) => (
|
|
185
|
+
<Space>
|
|
186
|
+
<Button type="link" size="small" icon={<EditOutlined />} onClick={() => openDrawer(binding)}>
|
|
187
|
+
{t('Edit')}
|
|
188
|
+
</Button>
|
|
189
|
+
<Popconfirm title={t('Delete this binding?')} onConfirm={() => removeBinding(binding.id)}>
|
|
190
|
+
<Button type="link" size="small" danger icon={<DeleteOutlined />}>
|
|
191
|
+
{t('Delete')}
|
|
192
|
+
</Button>
|
|
193
|
+
</Popconfirm>
|
|
194
|
+
</Space>
|
|
195
|
+
),
|
|
196
|
+
},
|
|
197
|
+
];
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<Card bordered={false}>
|
|
201
|
+
<Space direction="vertical" size={16} style={{ width: '100%' }}>
|
|
202
|
+
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 16 }}>
|
|
203
|
+
<Typography.Text type="secondary">
|
|
204
|
+
{t('Bind each leader/sub-agent pair to the profile that controls memory and tracing policy.')}
|
|
205
|
+
</Typography.Text>
|
|
206
|
+
<Button type="primary" icon={<PlusOutlined />} onClick={() => openDrawer()}>
|
|
207
|
+
{t('New Agent Binding')}
|
|
208
|
+
</Button>
|
|
209
|
+
</div>
|
|
210
|
+
<Table
|
|
211
|
+
rowKey="id"
|
|
212
|
+
dataSource={bindings}
|
|
213
|
+
loading={bindingsRequest.loading || profilesRequest.loading}
|
|
214
|
+
columns={columns}
|
|
215
|
+
pagination={false}
|
|
216
|
+
scroll={{ x: 'max-content' }}
|
|
217
|
+
/>
|
|
218
|
+
</Space>
|
|
219
|
+
|
|
220
|
+
<Drawer
|
|
221
|
+
open={drawerOpen}
|
|
222
|
+
onClose={closeDrawer}
|
|
223
|
+
width={560}
|
|
224
|
+
title={editing ? t('Edit Agent Binding') : t('New Agent Binding')}
|
|
225
|
+
extra={
|
|
226
|
+
<Space>
|
|
227
|
+
<Button onClick={closeDrawer}>{t('Cancel')}</Button>
|
|
228
|
+
<Button type="primary" onClick={() => form.submit()}>
|
|
229
|
+
{t('Save')}
|
|
230
|
+
</Button>
|
|
231
|
+
</Space>
|
|
232
|
+
}
|
|
233
|
+
>
|
|
234
|
+
<Form form={form} layout="vertical" onFinish={saveBinding}>
|
|
235
|
+
<Form.Item
|
|
236
|
+
label={t('Leader (Orchestrator)')}
|
|
237
|
+
name="leaderUsername"
|
|
238
|
+
rules={[{ required: true, message: t('Leader is required') }]}
|
|
239
|
+
>
|
|
240
|
+
<AIEmployeeSelect placeholder={t('Select leader')} />
|
|
241
|
+
</Form.Item>
|
|
242
|
+
<Form.Item
|
|
243
|
+
label={t('Sub-Agent')}
|
|
244
|
+
name="subAgentUsername"
|
|
245
|
+
rules={[{ required: true, message: t('Sub-agent is required') }]}
|
|
246
|
+
>
|
|
247
|
+
<AIEmployeeSelect placeholder={t('Select sub-agent')} />
|
|
248
|
+
</Form.Item>
|
|
249
|
+
<Form.Item
|
|
250
|
+
label={t('Policy Profile')}
|
|
251
|
+
name="harnessTag"
|
|
252
|
+
rules={[{ required: true, message: t('Policy profile is required') }]}
|
|
253
|
+
>
|
|
254
|
+
<Select options={profileOptions} placeholder={t('Select policy profile')} />
|
|
255
|
+
</Form.Item>
|
|
256
|
+
<Form.Item label={t('Max Delegation Depth')} name="maxDepth">
|
|
257
|
+
<InputNumber min={1} max={10} style={{ width: '100%' }} />
|
|
258
|
+
</Form.Item>
|
|
259
|
+
<Form.Item label={t('Timeout (ms)')} name="timeout">
|
|
260
|
+
<InputNumber min={1000} max={600000} step={1000} style={{ width: '100%' }} />
|
|
261
|
+
</Form.Item>
|
|
262
|
+
<Form.Item label={t('Enabled')} name="enabled" valuePropName="checked">
|
|
263
|
+
<Switch />
|
|
264
|
+
</Form.Item>
|
|
265
|
+
</Form>
|
|
266
|
+
</Drawer>
|
|
267
|
+
</Card>
|
|
268
|
+
);
|
|
269
|
+
};
|
|
@@ -51,7 +51,6 @@ export const HarnessProfilesTab: React.FC = () => {
|
|
|
51
51
|
nativeObserverEnabled: true,
|
|
52
52
|
memoryInjectionEnabled: true,
|
|
53
53
|
memoryScopes: ['public', 'user', 'agent_user'],
|
|
54
|
-
knowledgeScopes: ['public', 'private'],
|
|
55
54
|
maxMemoryContextChars: 6000,
|
|
56
55
|
tracingRetentionDays: 30,
|
|
57
56
|
},
|
|
@@ -199,7 +198,7 @@ export const HarnessProfilesTab: React.FC = () => {
|
|
|
199
198
|
<Space direction="vertical" size={16} style={{ width: '100%' }}>
|
|
200
199
|
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 16 }}>
|
|
201
200
|
<Text type="secondary">
|
|
202
|
-
{t('Policy profiles control native
|
|
201
|
+
{t('Policy profiles control native observation, memory scopes, and tracing retention.')}
|
|
203
202
|
</Text>
|
|
204
203
|
<Button type="primary" icon={<PlusOutlined />} onClick={() => openDrawer()}>
|
|
205
204
|
{t('New Policy')}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { Button, Card, Space, Table, Tag, Tooltip, Typography } from 'antd';
|
|
3
|
+
import { ReloadOutlined } from '@ant-design/icons';
|
|
4
|
+
import { useRequest } from '../hooks/useApiRequest';
|
|
5
|
+
import { useT } from '../skill-hub/locale';
|
|
6
|
+
|
|
7
|
+
type AccessRow = {
|
|
8
|
+
key: string;
|
|
9
|
+
employeeUsername: string;
|
|
10
|
+
employeeRoles: string[];
|
|
11
|
+
knowledgeBaseId: string;
|
|
12
|
+
knowledgeBaseName: string;
|
|
13
|
+
knowledgeBaseType: string;
|
|
14
|
+
assigned: boolean;
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
access: 'allowed' | 'denied';
|
|
17
|
+
reason: string;
|
|
18
|
+
userGate: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function rowsFromResponse(value: unknown): AccessRow[] {
|
|
22
|
+
const body = value as { data?: unknown } | undefined;
|
|
23
|
+
return Array.isArray(body?.data) ? (body.data as AccessRow[]) : [];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const KnowledgeAccessTab: React.FC = () => {
|
|
27
|
+
const t = useT();
|
|
28
|
+
const [showDeniedOnly, setShowDeniedOnly] = useState(false);
|
|
29
|
+
const request = useRequest({ url: 'agentKnowledgeInsights:accessMatrix' });
|
|
30
|
+
const rows = useMemo(() => rowsFromResponse(request.data), [request.data]);
|
|
31
|
+
const filteredRows = useMemo(
|
|
32
|
+
() => (showDeniedOnly ? rows.filter((row) => row.access === 'denied') : rows),
|
|
33
|
+
[rows, showDeniedOnly],
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const columns = [
|
|
37
|
+
{ title: t('AI Employee'), dataIndex: 'employeeUsername', key: 'employeeUsername' },
|
|
38
|
+
{
|
|
39
|
+
title: t('Knowledge Base'),
|
|
40
|
+
dataIndex: 'knowledgeBaseName',
|
|
41
|
+
key: 'knowledgeBaseName',
|
|
42
|
+
render: (name: string, row: AccessRow) => (
|
|
43
|
+
<Space size={4} wrap>
|
|
44
|
+
<span>{name}</span>
|
|
45
|
+
<Tag>{row.knowledgeBaseType}</Tag>
|
|
46
|
+
</Space>
|
|
47
|
+
),
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: t('Assignment'),
|
|
51
|
+
dataIndex: 'assigned',
|
|
52
|
+
key: 'assigned',
|
|
53
|
+
width: 120,
|
|
54
|
+
render: (assigned: boolean) => (
|
|
55
|
+
<Tag color={assigned ? 'blue' : 'default'}>{assigned ? t('Assigned') : t('Not assigned')}</Tag>
|
|
56
|
+
),
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
title: t('Agent access'),
|
|
60
|
+
dataIndex: 'access',
|
|
61
|
+
key: 'access',
|
|
62
|
+
width: 130,
|
|
63
|
+
render: (access: AccessRow['access']) => (
|
|
64
|
+
<Tag color={access === 'allowed' ? 'success' : 'error'}>
|
|
65
|
+
{access === 'allowed' ? t('Allowed') : t('Denied')}
|
|
66
|
+
</Tag>
|
|
67
|
+
),
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
title: t('Reason'),
|
|
71
|
+
dataIndex: 'reason',
|
|
72
|
+
key: 'reason',
|
|
73
|
+
render: (reason: string) => <Typography.Text>{reason}</Typography.Text>,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
title: t('Runtime user gate'),
|
|
77
|
+
dataIndex: 'userGate',
|
|
78
|
+
key: 'userGate',
|
|
79
|
+
render: (gate: string) => (
|
|
80
|
+
<Tooltip title={gate}>
|
|
81
|
+
<Typography.Text ellipsis style={{ maxWidth: 260 }}>
|
|
82
|
+
{gate}
|
|
83
|
+
</Typography.Text>
|
|
84
|
+
</Tooltip>
|
|
85
|
+
),
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<Card bordered={false}>
|
|
91
|
+
<Space direction="vertical" size={16} style={{ width: '100%' }}>
|
|
92
|
+
<Typography.Text type="secondary">
|
|
93
|
+
{t(
|
|
94
|
+
'This matrix checks employee assignment and static agent policy. BASIC and SHARED user access is still evaluated when a run starts.',
|
|
95
|
+
)}
|
|
96
|
+
</Typography.Text>
|
|
97
|
+
<Space wrap>
|
|
98
|
+
<Button type={showDeniedOnly ? 'primary' : 'default'} onClick={() => setShowDeniedOnly((value) => !value)}>
|
|
99
|
+
{showDeniedOnly ? t('Show all') : t('Show denied only')}
|
|
100
|
+
</Button>
|
|
101
|
+
<Button icon={<ReloadOutlined />} onClick={request.refresh}>
|
|
102
|
+
{t('Refresh')}
|
|
103
|
+
</Button>
|
|
104
|
+
</Space>
|
|
105
|
+
<Table
|
|
106
|
+
rowKey="key"
|
|
107
|
+
loading={request.loading}
|
|
108
|
+
dataSource={filteredRows}
|
|
109
|
+
columns={columns}
|
|
110
|
+
scroll={{ x: 'max-content' }}
|
|
111
|
+
pagination={{ pageSize: 50, showSizeChanger: true }}
|
|
112
|
+
/>
|
|
113
|
+
</Space>
|
|
114
|
+
</Card>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { Button, Card, Descriptions, Form, Input, Select, Space, Typography, message } from 'antd';
|
|
3
|
+
import { useApiClient, useRequest } from '../hooks/useApiRequest';
|
|
4
|
+
import { useAIEmployees } from './AIEmployeesContext';
|
|
5
|
+
import { useT } from '../skill-hub/locale';
|
|
6
|
+
|
|
7
|
+
type ProfileRecord = { tag: string; title?: string; enabled?: boolean };
|
|
8
|
+
type Preview = {
|
|
9
|
+
context: string;
|
|
10
|
+
appliedScopes: string[];
|
|
11
|
+
chars: number;
|
|
12
|
+
maxChars: number;
|
|
13
|
+
harnessTag: string;
|
|
14
|
+
};
|
|
15
|
+
type PreviewForm = { userId: string; employeeUsername?: string; leaderUsername?: string; harnessTag?: string };
|
|
16
|
+
|
|
17
|
+
function responseRows<T>(value: unknown): T[] {
|
|
18
|
+
const response = value as { data?: unknown } | undefined;
|
|
19
|
+
return Array.isArray(response?.data) ? (response.data as T[]) : [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function responseData<T>(value: unknown): T | undefined {
|
|
23
|
+
const response = value as { data?: { data?: T } } | undefined;
|
|
24
|
+
return response?.data?.data || (response?.data as unknown as T | undefined);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const MemoryInspectorTab: React.FC = () => {
|
|
28
|
+
const api = useApiClient();
|
|
29
|
+
const t = useT();
|
|
30
|
+
const { employees } = useAIEmployees();
|
|
31
|
+
const [form] = Form.useForm<PreviewForm>();
|
|
32
|
+
const [preview, setPreview] = useState<Preview | null>(null);
|
|
33
|
+
const [loading, setLoading] = useState(false);
|
|
34
|
+
const profilesRequest = useRequest({ url: 'agentHarnessProfiles:list', params: { pageSize: 100, sort: ['tag'] } });
|
|
35
|
+
const profiles = useMemo(() => responseRows<ProfileRecord>(profilesRequest.data), [profilesRequest.data]);
|
|
36
|
+
|
|
37
|
+
const createPreview = async (values: PreviewForm) => {
|
|
38
|
+
setLoading(true);
|
|
39
|
+
try {
|
|
40
|
+
const response = await api.request({ url: 'agentKnowledgeInsights:memoryPreview', method: 'post', data: values });
|
|
41
|
+
const data = responseData<Preview>(response.data);
|
|
42
|
+
if (!data) throw new Error(t('Memory preview returned no data'));
|
|
43
|
+
setPreview(data);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
const detail = error as { response?: { data?: { errors?: Array<{ message?: string }> } }; message?: string };
|
|
46
|
+
message.error(detail.response?.data?.errors?.[0]?.message || detail.message || t('Memory preview failed'));
|
|
47
|
+
} finally {
|
|
48
|
+
setLoading(false);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Space direction="vertical" size={16} style={{ width: '100%' }}>
|
|
54
|
+
<Card bordered={false}>
|
|
55
|
+
<Typography.Text type="secondary">
|
|
56
|
+
{t(
|
|
57
|
+
'Preview the exact memory context for a user and selected sub-agent before a run. Memory is marked as data, not executable instructions.',
|
|
58
|
+
)}
|
|
59
|
+
</Typography.Text>
|
|
60
|
+
<Form
|
|
61
|
+
form={form}
|
|
62
|
+
layout="vertical"
|
|
63
|
+
onFinish={createPreview}
|
|
64
|
+
style={{ marginTop: 16, maxWidth: 680 }}
|
|
65
|
+
initialValues={{ harnessTag: 'default' }}
|
|
66
|
+
>
|
|
67
|
+
<Form.Item label={t('User ID')} name="userId" rules={[{ required: true, message: t('User ID is required') }]}>
|
|
68
|
+
<Input inputMode="numeric" />
|
|
69
|
+
</Form.Item>
|
|
70
|
+
<Form.Item label={t('Sub-Agent')} name="employeeUsername">
|
|
71
|
+
<Select
|
|
72
|
+
allowClear
|
|
73
|
+
showSearch
|
|
74
|
+
optionFilterProp="label"
|
|
75
|
+
options={employees.map((employee) => ({
|
|
76
|
+
label: employee.nickname || employee.username,
|
|
77
|
+
value: employee.username,
|
|
78
|
+
}))}
|
|
79
|
+
/>
|
|
80
|
+
</Form.Item>
|
|
81
|
+
<Form.Item label={t('Leader (Orchestrator)')} name="leaderUsername">
|
|
82
|
+
<Select
|
|
83
|
+
allowClear
|
|
84
|
+
showSearch
|
|
85
|
+
optionFilterProp="label"
|
|
86
|
+
options={employees.map((employee) => ({
|
|
87
|
+
label: employee.nickname || employee.username,
|
|
88
|
+
value: employee.username,
|
|
89
|
+
}))}
|
|
90
|
+
/>
|
|
91
|
+
</Form.Item>
|
|
92
|
+
<Form.Item label={t('Policy Profile')} name="harnessTag">
|
|
93
|
+
<Select
|
|
94
|
+
options={profiles
|
|
95
|
+
.filter((profile) => profile.enabled !== false)
|
|
96
|
+
.map((profile) => ({
|
|
97
|
+
label: profile.title ? `${profile.title} (${profile.tag})` : profile.tag,
|
|
98
|
+
value: profile.tag,
|
|
99
|
+
}))}
|
|
100
|
+
/>
|
|
101
|
+
</Form.Item>
|
|
102
|
+
<Button type="primary" htmlType="submit" loading={loading}>
|
|
103
|
+
{t('Build memory preview')}
|
|
104
|
+
</Button>
|
|
105
|
+
</Form>
|
|
106
|
+
</Card>
|
|
107
|
+
{preview && (
|
|
108
|
+
<Card title={t('Final memory context')}>
|
|
109
|
+
<Descriptions bordered size="small" column={2} style={{ marginBottom: 16 }}>
|
|
110
|
+
<Descriptions.Item label={t('Policy Profile')}>{preview.harnessTag}</Descriptions.Item>
|
|
111
|
+
<Descriptions.Item label={t('Character budget')}>
|
|
112
|
+
{preview.chars} / {preview.maxChars}
|
|
113
|
+
</Descriptions.Item>
|
|
114
|
+
<Descriptions.Item label={t('Applied scopes')} span={2}>
|
|
115
|
+
{preview.appliedScopes.join(', ') || t('None')}
|
|
116
|
+
</Descriptions.Item>
|
|
117
|
+
</Descriptions>
|
|
118
|
+
<Typography.Paragraph style={{ margin: 0, whiteSpace: 'pre-wrap', wordBreak: 'break-word' }}>
|
|
119
|
+
{preview.context || t('No memory context matched this preview.')}
|
|
120
|
+
</Typography.Paragraph>
|
|
121
|
+
</Card>
|
|
122
|
+
)}
|
|
123
|
+
</Space>
|
|
124
|
+
);
|
|
125
|
+
};
|