fix(coding): remediate ML-07 plugin authority

This commit is contained in:
2026-08-27 20:40:58 +08:00
parent 9407c67df2
commit cf13aa7eba
29 changed files with 1008 additions and 214 deletions

View File

@@ -11,9 +11,32 @@ function projection(): CodingPluginProject {
policyStatus: 'current',
items: [{
id: 'makelore.data-service', version: '1.0.0', displayName: '开发数据服务', description: '为当前项目提供 JSON 数据。',
contractVersion: 1, requiresBackend: true,
enabled: false, state: 'disabled', backend: { status: 'unconfigured' },
skills: [{ id: 'data-service', assignedAgentIds: ['agent-1'] }],
capabilities: [{ id: 'data-service.control', operations: [{ id: 'inspect', billing: { mode: 'included', availability: 'available', notice: 'Fixed quotas apply' } }] }],
capabilities: [
{ id: 'data-service.control', operations: [{
id: 'inspect',
billing: { mode: 'included', availability: 'available', notice: 'Fixed quotas apply' },
tool: {
name: 'data_service_inspect', label: 'Inspect', description: 'Inspect data',
mutation: 'read', permissions: ['project.data.read'],
},
}] },
{ id: 'data-service.documents', operations: [{
id: 'put_document',
billing: { mode: 'external_account', availability: 'available', notice: 'Provider billed' },
tool: {
name: 'data_service_put_document', label: 'Put', description: 'Put data',
mutation: 'write', permissions: ['project.data.write'],
},
}] },
{ id: 'data-service.preview', operations: [{
id: 'get',
billing: { mode: 'platform_metered', availability: 'unavailable', notice: 'Pricing unavailable' },
tool: null,
}] },
],
settingsSurface: 'data-service',
}],
};
@@ -29,6 +52,12 @@ describe('Project Plugin Center', () => {
expect(screen.getByText('当前包含,不按单次调用扣点')).toBeVisible();
expect(screen.getByText('小明')).toBeVisible();
expect(screen.getByText('data-service.control')).toBeVisible();
expect(screen.getByText('data-service.documents')).toBeVisible();
expect(screen.getByText('data-service.preview')).toBeVisible();
expect(screen.getByText('data_service_inspect')).toBeVisible();
expect(screen.getByText('SDK')).toBeVisible();
expect(screen.getByText('由外部服务商计费,不计入 Token Point。')).toBeVisible();
expect(screen.getByText('计费策略暂不可用,相关调用已停用。')).toBeVisible();
expect(screen.queryByText('local-only-id')).not.toBeInTheDocument();
expect(screen.queryByText('11111111-1111-4111-8111-111111111111')).not.toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '启用开发数据服务' }));
@@ -44,6 +73,7 @@ describe('Project Plugin Center', () => {
it('explains unknown billing and keeps invocation unavailable', () => {
const value = projection();
value.items[0].state = 'unavailable';
value.items[0].capabilities = [value.items[0].capabilities[0]];
value.items[0].capabilities[0].operations[0].billing = { mode: 'platform_metered', availability: 'unavailable', notice: 'pricing unavailable' };
render(<MemoryRouter><ProjectPluginsView projectName="Demo" projection={value} dataService={null} pending={{}} agentNames={{}} onRefresh={vi.fn()} onSetEnabled={vi.fn()} onConfigure={vi.fn()} onReset={vi.fn()} onRemoveCollection={vi.fn()} onRemoveProject={vi.fn()} /></MemoryRouter>);
expect(screen.getByText('计费策略暂不可用,相关调用已停用。')).toBeVisible();