mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-05 15:44:28 +00:00
feat(storage): add archive storage support for assets (#514)
* feat(storage): add archive storage support for assets * fix(webui): show archive icon in front of file name in breadcrumb bar * fix(webui): display archive icon in breadcrumbs when restoring * refactor(transcode): simplify restore asset workflow to single while loop * docs(configuration): add archive storage documentation and readme entries * fix(webui): show archive icon in front of version names and prevent version card overflow * fix(webui): fix overflow in manage versions dialog scroll area * fix(webui): prevent manage versions dialog overflow on long file names * docs(configuration): fix archive storage environment variables and defaults * fix(storage): address code review findings for archive storage
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { z } from 'zod'
|
||||
import { defineOperation } from '../define'
|
||||
|
||||
export const archiveAssets = defineOperation({
|
||||
name: 'archive_assets',
|
||||
title: 'Archive Assets',
|
||||
description:
|
||||
'Move the original raw file(s) of one or more assets (files, version stacks, or folders) to ' +
|
||||
'cold archive storage. All transcoded proxies, previews, and thumbnails remain in main ' +
|
||||
'storage so assets stay viewable, while original raw file downloads are disabled until restored.',
|
||||
input: z.object({
|
||||
assetIds: z
|
||||
.array(z.string().min(1))
|
||||
.min(1)
|
||||
.describe(
|
||||
'The IDs of the assets (files, version stacks, or folders) to archive. Archiving a folder or version stack archives all eligible files inside it.',
|
||||
),
|
||||
}),
|
||||
output: z.object({
|
||||
archivedAssetIds: z.array(z.string()).describe('IDs of the file assets queued for archiving.'),
|
||||
taskIds: z.array(z.string()).describe('IDs of the archive workflow tasks created.'),
|
||||
skippedCount: z
|
||||
.number()
|
||||
.describe(
|
||||
'Number of candidate files skipped (e.g. already archived or currently archiving).',
|
||||
),
|
||||
}),
|
||||
surfaces: ['agent', 'mcp', 'cli'],
|
||||
annotations: { readOnly: false, destructive: false, idempotent: true },
|
||||
cli: {
|
||||
command: ['archive'],
|
||||
positional: ['assetIds'],
|
||||
format: (output) =>
|
||||
`Queued ${output.archivedAssetIds.length} asset(s) for archiving (${output.skippedCount} skipped)`,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,36 @@
|
||||
import { z } from 'zod'
|
||||
import { defineOperation } from '../define'
|
||||
|
||||
export const restoreArchivedAssets = defineOperation({
|
||||
name: 'restore_archived_assets',
|
||||
title: 'Restore Archived Assets',
|
||||
description:
|
||||
'Restore the original raw file(s) of one or more archived assets (files, version stacks, or ' +
|
||||
'folders) from cold archive storage back to main storage.',
|
||||
input: z.object({
|
||||
assetIds: z
|
||||
.array(z.string().min(1))
|
||||
.min(1)
|
||||
.describe(
|
||||
'The IDs of the archived assets (files, version stacks, or folders) to restore back to main storage.',
|
||||
),
|
||||
}),
|
||||
output: z.object({
|
||||
restoredAssetIds: z
|
||||
.array(z.string())
|
||||
.describe('IDs of the file assets queued for restoration.'),
|
||||
taskIds: z.array(z.string()).describe('IDs of the restore workflow tasks created.'),
|
||||
skippedCount: z
|
||||
.number()
|
||||
.describe('Number of candidate files skipped (e.g. not archived or already restoring).'),
|
||||
}),
|
||||
surfaces: ['agent', 'mcp', 'cli'],
|
||||
annotations: { readOnly: false, destructive: false, idempotent: true },
|
||||
cli: {
|
||||
command: ['unarchive'],
|
||||
aliases: ['restore-archive'],
|
||||
positional: ['assetIds'],
|
||||
format: (output) =>
|
||||
`Queued ${output.restoredAssetIds.length} asset(s) for restoration from archive (${output.skippedCount} skipped)`,
|
||||
},
|
||||
})
|
||||
@@ -28,7 +28,7 @@ const conditionSchema = z.object({
|
||||
.min(1)
|
||||
.describe(
|
||||
'Metadata field key from list_metadata_fields (e.g. "status"), or one of "name", ' +
|
||||
'"sizeByte", "createdAt", "updatedAt".',
|
||||
'"sizeByte", "createdAt", "updatedAt", "isArchived".',
|
||||
),
|
||||
operator: z
|
||||
.enum(SEARCH_CONDITION_OPERATORS)
|
||||
|
||||
Reference in New Issue
Block a user