chore: import upstream snapshot with attribution
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:20:55 +08:00
commit d25d482dc2
13754 changed files with 4996608 additions and 0 deletions
+102
View File
@@ -0,0 +1,102 @@
/**
* Defense-in-depth ceiling on the size of any single workspace file upload.
* Enforced both server-side (presigned route) and client-side (Files tab) so
* users get fast feedback before bytes are streamed.
*/
export const MAX_WORKSPACE_FILE_SIZE = 5 * 1024 * 1024 * 1024
/**
* Cap on the legacy FormData upload route, which buffers the whole file in
* worker memory. Direct-to-storage uploads use {@link MAX_WORKSPACE_FILE_SIZE}.
*/
export const MAX_WORKSPACE_FORMDATA_FILE_SIZE = 100 * 1024 * 1024
export type StorageContext =
| 'knowledge-base'
| 'chat'
| 'copilot'
| 'mothership'
| 'execution'
| 'workspace'
| 'profile-pictures'
| 'og-images'
| 'logs'
| 'workspace-logos'
/**
* Contexts exempt from storage quota checks. Includes system-internal contexts
* (`logs` — written by the execution pipeline, not user-initiated) and small
* metadata assets (`profile-pictures`, `workspace-logos`, `og-images`). All
* other contexts are user-driven uploads and must pass quota validation.
*
* Note: every quota-exempt context is excluded from `ALLOWED_UPLOAD_CONTEXTS`
* in the multipart endpoint, so none are reachable there — the exemption applies
* only to the single-part upload paths (presigned/FormData) those small assets
* actually use. The multipart endpoint therefore only ever serves
* quota-enforced contexts.
*/
export const QUOTA_EXEMPT_STORAGE_CONTEXTS = new Set<StorageContext>([
'profile-pictures',
'workspace-logos',
'og-images',
'logs',
])
export interface FileInfo {
path: string
key: string
name: string
size: number
type: string
}
export interface StorageConfig {
bucket?: string
region?: string
containerName?: string
accountName?: string
accountKey?: string
connectionString?: string
}
export interface UploadFileOptions {
file: Buffer
fileName: string
contentType: string
context: StorageContext
preserveKey?: boolean
customKey?: string
metadata?: Record<string, string>
}
export interface DownloadFileOptions {
key: string
context?: StorageContext
maxBytes?: number
}
export interface DeleteFileOptions {
key: string
context?: StorageContext
}
export interface GeneratePresignedUrlOptions {
fileName: string
contentType: string
fileSize: number
context: StorageContext
userId?: string
expirationSeconds?: number
metadata?: Record<string, string>
/**
* When provided, overrides the default `${context}/${timestamp}-${id}-${name}` key derivation.
* The caller takes responsibility for uniqueness and prefix conventions.
*/
customKey?: string
}
export interface PresignedUrlResponse {
url: string
key: string
uploadHeaders?: Record<string, string>
}