mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-29 20:34: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:
@@ -5,6 +5,7 @@ import type { AgentToolResult } from '@earendil-works/pi-agent-core'
|
||||
import { downloadAsset, MAX_DOWNLOAD_ASSETS, type DownloadAssetOutput } from '@shumai/operations'
|
||||
import type { User } from '@shumai/db'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { assertStorageKeyNotArchived } from '@shumai/core/src/asset/asset-archive'
|
||||
import { storageBucket } from '@shumai/core/src/asset-read'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { sanitizeFilename } from '@shumai/core/src/utils/filename'
|
||||
@@ -54,6 +55,7 @@ async function downloadKey(key: string, userId: string): Promise<AgentToolResult
|
||||
type: ResourceType.Asset,
|
||||
id: owningAssetId,
|
||||
})
|
||||
await assertStorageKeyNotArchived(key)
|
||||
const filename = sanitizeFilename(path.basename(key)) || 'downloaded_file'
|
||||
const saved = await saveToSandbox(key, filename)
|
||||
return {
|
||||
|
||||
@@ -67,6 +67,7 @@ describe('operation-backed agent tools', () => {
|
||||
.map((t) => t.name)
|
||||
.sort(),
|
||||
).toEqual([
|
||||
'archive_assets',
|
||||
'copy_assets',
|
||||
'create_comment',
|
||||
'create_file',
|
||||
@@ -87,6 +88,7 @@ describe('operation-backed agent tools', () => {
|
||||
'remove_version',
|
||||
'rename_asset',
|
||||
'resolve_comment',
|
||||
'restore_archived_assets',
|
||||
'search_assets',
|
||||
'update_asset_metadata',
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user