feat(onebot): expose group folder upload metadata

Decode the folder modifier metadata returned by group file listings and project it as last upload time, uploader ID, and uploader name for both folder listing actions.

Regenerate the MCP catalog and add protocol, bridge, OneBot projection, and action schema coverage for the new fields.

Closes #248
This commit is contained in:
DrSmoothl committed 2026-07-19 18:34:53 +08:00
1 parent f3e0c4e45a
commit e6a69b05a7
10 files changed
+208 -4

No files matched your search

+15
View File
@@ -22,6 +22,21 @@ describe('action-docs', () => {
expect(duration).toMatchObject({ type: 'int', required: false, default: 1800 });
});
it.each(['get_group_root_files', 'get_group_files_by_folder'])(
'documents folder last-upload metadata for %s',
(name) => {
const action = docs.find((d) => d.name === name);
const properties = action?.returnsSchema?.properties as Record<string, any> | undefined;
const folderProperties = properties?.folders?.items?.properties as Record<string, unknown> | undefined;
expect(folderProperties).toEqual(expect.objectContaining({
last_upload_time: expect.objectContaining({ type: 'integer' }),
last_uploader: expect.objectContaining({ type: 'integer' }),
last_uploader_name: expect.objectContaining({ type: 'string' }),
}));
},
);
it('renders markdown with header + an action section', () => {
const md = renderActionDocsMarkdown(docs);
expect(md).toContain('# OneBot Actions');
@@ -11,6 +11,7 @@ import type {
import {
getFriendList,
getGroupInfo,
getGroupFiles,
getGroupList,
getGroupMemberInfo,
getGroupMemberList,
@@ -164,6 +165,35 @@ describe('onebot/contact-actions / getFriendList', () => {
});
});
describe('onebot/contact-actions / getGroupFiles', () => {
it('returns folder last-upload metadata in OneBot field names', async () => {
const list = vi.fn(async () => ({
files: [],
folders: [{
folderId: 'd1',
folderName: 'dir',
createTime: 100,
creator: 123,
creatorName: 'creator',
totalFileCount: 2,
lastUploadTime: 200,
lastUploader: 5_000_000_001,
lastUploaderName: 'uploader',
}],
}));
const bridge = fakeBridge({ apis: { groupFile: { list } } });
const out = await getGroupFiles(bridge, 12345, '/');
expect(out.folders).toEqual([expect.objectContaining({
last_upload_time: 200,
last_uploader: 5_000_000_001,
last_uploader_name: 'uploader',
})]);
expect(list).toHaveBeenCalledWith(12345, '/');
});
});
describe('onebot/contact-actions / getGroupList', () => {
it('triggers fetch when the in-memory roster is empty', async () => {
const fetched = [makeGroup(100, 'Group A')];