mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-20 21:09:46 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e05a23bcc2 | ||
|
|
d957ab2339 | ||
|
|
1fcd7245ea | ||
|
|
176b7f0eab | ||
|
|
f7ed3bafdf | ||
|
|
9f76e61e23 | ||
|
|
7c297895e5 | ||
|
|
0f318b4050 | ||
|
|
1a46f63160 | ||
|
|
6cc90bf973 | ||
|
|
b7271777e0 | ||
|
|
c302c162a0 | ||
|
|
432be04a96 | ||
|
|
6c95d14fb3 | ||
|
|
3263580e89 | ||
|
|
f3da916905 | ||
|
|
fe8d404a44 | ||
|
|
0f9d213b1d | ||
|
|
f952318b34 | ||
|
|
43a2eced75 | ||
|
|
e894457275 | ||
|
|
4b1b64fe2b | ||
|
|
f8beb195dd | ||
|
|
a97996cb59 | ||
|
|
f870ca9b49 | ||
|
|
2e5ff281a8 | ||
|
|
de8decf113 | ||
|
|
dd57fb9ed2 | ||
|
|
9a640632aa | ||
|
|
e61641d7ec | ||
|
|
7ca8ba8b2a | ||
|
|
8805d5799a | ||
|
|
013c4a8156 | ||
|
|
20b5ebeefd | ||
|
|
daa20aed20 | ||
|
|
3564d4d164 | ||
|
|
206763e966 | ||
|
|
4e4da595a6 | ||
|
|
a21a0c9655 | ||
|
|
fc7282581f | ||
|
|
e007054f47 | ||
|
|
a84da8678e | ||
|
|
123a8cb5f4 | ||
|
|
5fe22ac52c | ||
|
|
11d21444cf | ||
|
|
f2b0415580 | ||
|
|
c9d0b476cd | ||
|
|
bf5ac566b6 | ||
|
|
af8f24aa95 | ||
|
|
d98f486c9d | ||
|
|
94ea4c917a | ||
|
|
941bf0fd1b | ||
|
|
59742dde78 | ||
|
|
29cd5d807c | ||
|
|
f6e27095a5 | ||
|
|
55637bc9a8 | ||
|
|
0d6671c3e1 | ||
|
|
c3375ee935 | ||
|
|
f579947770 | ||
|
|
53c9485f10 | ||
|
|
75bf9b3b88 | ||
|
|
657cd761bc | ||
|
|
de634a5dc5 | ||
|
|
09b65a1eb6 | ||
|
|
b52b2ce7d8 | ||
|
|
145aa6bfb4 | ||
|
|
a91d8c4521 | ||
|
|
3a509537fd |
@@ -68,18 +68,42 @@ jobs:
|
||||
- name: Build NPM packages
|
||||
run: bun run build-npm
|
||||
|
||||
- name: Generate release notes
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
CHANGELOG_NOTES=$(bun run scripts/extract-changelog.ts "${{ env.RELEASE_TAG }}" 2>/dev/null || true)
|
||||
PR_NOTES=$(gh api "repos/${{ github.repository }}/releases/generate-notes" -f tag_name="${{ env.RELEASE_TAG }}" --jq .body 2>/dev/null || true)
|
||||
|
||||
{
|
||||
if [ -n "$CHANGELOG_NOTES" ]; then
|
||||
echo "$CHANGELOG_NOTES"
|
||||
echo ""
|
||||
echo "---"
|
||||
echo ""
|
||||
fi
|
||||
if [ -n "$PR_NOTES" ]; then
|
||||
echo "$PR_NOTES"
|
||||
fi
|
||||
} > /tmp/release-notes.md
|
||||
|
||||
- name: Create GitHub Release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
if [ ! -s /tmp/release-notes.md ]; then
|
||||
NOTES_FLAG="--generate-notes"
|
||||
else
|
||||
NOTES_FLAG="--notes-file /tmp/release-notes.md"
|
||||
fi
|
||||
if gh release view "${{ env.RELEASE_TAG }}" >/dev/null 2>&1; then
|
||||
gh release edit "${{ env.RELEASE_TAG }}" \
|
||||
--title "${{ env.RELEASE_TAG }}" \
|
||||
--generate-notes
|
||||
$NOTES_FLAG
|
||||
else
|
||||
gh release create "${{ env.RELEASE_TAG }}" \
|
||||
--title "${{ env.RELEASE_TAG }}" \
|
||||
--generate-notes
|
||||
$NOTES_FLAG
|
||||
fi
|
||||
|
||||
- name: Upgrade npm for trusted publishing
|
||||
|
||||
@@ -4,6 +4,16 @@ on:
|
||||
push:
|
||||
branches: ['main']
|
||||
tags: ['v*']
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Docker image tag (e.g. feature-vaapi)'
|
||||
required: false
|
||||
type: string
|
||||
pr:
|
||||
description: 'Pull request number (e.g. 449)'
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
@@ -14,7 +24,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.pr && format('refs/pull/{0}/head', inputs.pr) || github.ref }}
|
||||
|
||||
# Set up Docker Buildx
|
||||
- name: Set up Docker Buildx
|
||||
@@ -45,7 +58,11 @@ jobs:
|
||||
crpi-000nkafzu6xvpwsc.cn-hongkong.personal.cr.aliyuncs.com/shumai-one/shumai
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=ref,event=branch
|
||||
type=ref,event=branch,enable=${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.pr && !inputs.tag) }}
|
||||
type=raw,value=pr-${{ inputs.pr }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.pr != '' && inputs.tag == '' }}
|
||||
type=raw,value=${{ inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.tag != '' }}
|
||||
labels: |
|
||||
org.opencontainers.image.revision=${{ steps.checkout.outputs.commit }}
|
||||
|
||||
# Build and push Docker image
|
||||
- name: Build and push Docker image
|
||||
@@ -57,3 +74,31 @@ jobs:
|
||||
provenance: false
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
# Extract metadata for Docker (Transcode Worker)
|
||||
- name: Extract metadata for Docker (Transcode Worker)
|
||||
id: meta-transcode
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
shumaione/shumai-transcode
|
||||
crpi-000nkafzu6xvpwsc.cn-hongkong.personal.cr.aliyuncs.com/shumai-one/shumai-transcode
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=ref,event=branch,enable=${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.pr && !inputs.tag) }}
|
||||
type=raw,value=pr-${{ inputs.pr }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.pr != '' && inputs.tag == '' }}
|
||||
type=raw,value=${{ inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.tag != '' }}
|
||||
labels: |
|
||||
org.opencontainers.image.revision=${{ steps.checkout.outputs.commit }}
|
||||
|
||||
# Build and push Docker image (Transcode Worker)
|
||||
- name: Build and push Docker image (Transcode Worker)
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
context: .
|
||||
file: ./Dockerfile.transcode
|
||||
push: true
|
||||
provenance: false
|
||||
tags: ${{ steps.meta-transcode.outputs.tags }}
|
||||
labels: ${{ steps.meta-transcode.outputs.labels }}
|
||||
|
||||
@@ -25,3 +25,5 @@ code_quality.md
|
||||
# Paraglide JS
|
||||
packages/webui/paraglide
|
||||
|
||||
runner-package.json
|
||||
|
||||
|
||||
+2
-1
@@ -7,4 +7,5 @@ packages/core/src/generated
|
||||
src/ui/components/ui
|
||||
packages/webui/paraglide
|
||||
*.md
|
||||
**/*.md
|
||||
**/*.md
|
||||
docs/changelog.mdx
|
||||
|
||||
@@ -14,9 +14,10 @@ Complete the task on that branch.
|
||||
|
||||
After finishing the work and verifying that all checks pass:
|
||||
|
||||
1. Stage and commit your changes.
|
||||
2. Push the branch to `origin`.
|
||||
3. Open a pull request using the GitHub CLI.
|
||||
1. Update `CHANGELOG.md` under `## [Unreleased]` for user-facing changes (see [Changelog Guidelines](#changelog-guidelines)).
|
||||
2. Stage and commit your changes.
|
||||
3. Push the branch to `origin`.
|
||||
4. Open a pull request using the GitHub CLI.
|
||||
|
||||
```bash
|
||||
git add .
|
||||
@@ -61,6 +62,19 @@ https://www.conventionalcommits.org/en/v1.0.0/#summary
|
||||
|
||||
---
|
||||
|
||||
## Changelog Guidelines
|
||||
|
||||
We maintain `CHANGELOG.md` following [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
Before opening a pull request, add an entry under `## [Unreleased]` for any user-facing changes:
|
||||
|
||||
- **End-User Friendly**: Make entries easy to understand for end users. For new features, explain what they actually do in plain language without heavy technical jargon. For bug fixes, describe what the bug was in a friendly, relatable way rather than focusing on internal code mechanics, file paths, or private symbols.
|
||||
- **Formatting**: `- **<scope>**: <Description>` (e.g. `- **asset**: Fix an issue where moving a video to trash while it was still transcoding could cause it to lose its trashed status`).
|
||||
- **No PR Numbers**: Do not include PR numbers or links; the release pipeline automatically appends the detailed PR list.
|
||||
- **Internal Changes**: Routine refactors, test additions, or internal chores without external behavior changes may omit changelog updates.
|
||||
|
||||
---
|
||||
|
||||
## Pull Request Template
|
||||
|
||||
```md
|
||||
@@ -78,6 +92,13 @@ Briefly describe what this PR changes and why.
|
||||
- Describe the checks or tests you ran.
|
||||
- Include relevant outputs if applicable.
|
||||
|
||||
## Manual Verification Plan
|
||||
|
||||
- Provide concise instructions for manually verifying this change.
|
||||
- Assume familiarity with the project and existing development workflow.
|
||||
- Skip boilerplate steps (e.g. starting the app, logging in, opening common pages) unless they are part of the change.
|
||||
- Focus on what needs to be verified, including scenarios, edge cases, and expected results.
|
||||
|
||||
## Notes
|
||||
|
||||
Add any additional context, caveats, or follow-up work.
|
||||
@@ -278,7 +299,7 @@ describe('Team API', () => {
|
||||
### Workflow E2E Tests
|
||||
|
||||
- Located in `packages/e2e/workflow/**/*.test.ts`.
|
||||
- Run via `bun run test:e2e:workflow` (which executes tests against both `local` and `temporal` executors dynamically).
|
||||
- Run via `bun run test:e2e:workflow`.
|
||||
- **Mandatory test coverage**: When creating or updating workflows or activities, you MUST create or update the corresponding E2E tests.
|
||||
- **Mocking**: Mock ONLY AI API calls. Do not mock S3, databases, or media/transcode extraction services.
|
||||
- Mock the AI response by spying on `AgentHarness.prototype.prompt`:
|
||||
@@ -356,64 +377,75 @@ model Example {
|
||||
- The default `limit` should be **20**.
|
||||
- Always use the `paginateQuery` helper function from `packages/core/src/pagination.ts` for consistent cursor pagination.
|
||||
|
||||
## Temporal Workflow & Activities
|
||||
## DBOS Workflow & Activities
|
||||
|
||||
We use a custom workflow engine that supports both **Local** (polling-based) and **Temporal** (production-grade) execution.
|
||||
We use **DBOS Transact** (`@dbos-inc/dbos-sdk`) as our unified workflow engine for reliable, distributed background execution.
|
||||
|
||||
### Architecture
|
||||
|
||||
1. **Workflows**: Orchestrate multiple activities. They must be deterministic and compatible with Temporal's V8 isolate. Defined in worker packages (e.g., `@shumai/agent/src/workflows`, `@shumai/transcode/src/workflows`).
|
||||
2. **Activities**: Perform the actual work (DB updates, API calls, media processing). Grouped by domain in worker packages (e.g., `@shumai/agent/src/activities`, `@shumai/transcode/src/activities`).
|
||||
1. **Workflows**: Orchestrate multiple steps/activities reliably. Defined in worker packages (e.g., `@shumai/agent/src/workflows`, `@shumai/transcode/src/workflows`).
|
||||
2. **Activities (Steps)**: Perform the actual work (DB updates, API calls, media processing). Grouped by domain in worker packages (e.g., `@shumai/agent/src/activities`, `@shumai/transcode/src/activities`).
|
||||
3. **Executors**:
|
||||
- `LocalExecutor` (in `@shumai/workflow-core`): Polls the database for `pending` tasks and executes them directly.
|
||||
- `TemporalExecutor` (in `@shumai/workflow-core`): Submits tasks to a Temporal cluster.
|
||||
4. **Automatic Submission**: New `WorkflowTask` records are automatically submitted to the `WorkflowService` via a Prisma Client Extension defined in `@shumai/db`.
|
||||
- `DbosExecutor` (in `@shumai/workflow-core`): Coordinates workflow and step dispatching via DBOS queues against PostgreSQL.
|
||||
4. **Automatic Submission**: New `WorkflowTask` records are automatically enqueued to `WorkflowService` via a Prisma Client Extension defined in `@shumai/db`.
|
||||
|
||||
### Dynamic Registration
|
||||
|
||||
To avoid circular dependencies, workflows and activities are dynamically registered onto the `LocalExecutor` registry at bootstrap time via initializer functions (e.g., `initAgentWorkflows()`, `initTranscodeWorkflows()`).
|
||||
To avoid circular dependencies, workflows are dynamically registered onto the workflow registry at bootstrap time via initializer functions (e.g., `initAgentWorkflows()`, `initTranscodeWorkflows()`).
|
||||
|
||||
### Non-Retryable Error Handling
|
||||
|
||||
To prevent Temporal from indefinitely retrying fatal, expected business validation failures (e.g., missing records, invalid configurations, missing parameters), **never throw standard `Error` objects from workflow or activity logic.** Instead, throw a non-retryable `ApplicationFailure`.
|
||||
To prevent the engine from indefinitely retrying fatal, expected business validation failures (e.g., missing records, invalid configurations, missing parameters), **never throw standard `Error` objects from workflow or activity logic.** Instead, throw a non-retryable `ApplicationFailure` (alias of `WorkflowFailure`).
|
||||
|
||||
**Mandatory Requirement**: You **MUST** set `nonRetryable: true` in the options object passed to `ApplicationFailure.create`. Standard errors or `ApplicationFailure` objects without `nonRetryable: true` will cause Temporal to retry the activity or workflow indefinitely.
|
||||
**Mandatory Requirement**: You **MUST** set `nonRetryable: true` in the options object passed to `ApplicationFailure.create`. Standard errors or failure objects without `nonRetryable: true` will cause DBOS to retry the activity or workflow according to its retry policy.
|
||||
|
||||
- **Workflow Boundary**: In workflows, import `ApplicationFailure` from `@temporalio/workflow`:
|
||||
- **Import**: Import `ApplicationFailure` from `@shumai/workflow-core`:
|
||||
```typescript
|
||||
import { ApplicationFailure } from '@temporalio/workflow'
|
||||
import { ApplicationFailure } from '@shumai/workflow-core'
|
||||
throw ApplicationFailure.create({ message: 'agentId missing in payload', nonRetryable: true })
|
||||
```
|
||||
- **Activity Boundary**: In activities, import `ApplicationFailure` from `@temporalio/activity`:
|
||||
```typescript
|
||||
import { ApplicationFailure } from '@temporalio/activity'
|
||||
throw ApplicationFailure.create({
|
||||
message: 'no autofill agent found for team',
|
||||
nonRetryable: true,
|
||||
})
|
||||
```
|
||||
|
||||
### Temporal Workflow Patterns
|
||||
### Workflow Patterns
|
||||
|
||||
- **Definition**: Define workflows as exported async functions.
|
||||
```typescript
|
||||
import { activityA, activityB } from '../activities/my-activities'
|
||||
|
||||
export async function myWorkflow(task: WorkflowTask): Promise<void> {
|
||||
const { activityA, activityB } = getActivities()
|
||||
await activityA({ ... })
|
||||
await activityB({ ... })
|
||||
}
|
||||
```
|
||||
- **Environment Compatibility**: Always use `getActivities()` from `@shumai/workflow-core` to ensure the code works in both Local and Temporal environments.
|
||||
- **Activity Access**: Activities should be accessed via `getActivities()` within a workflow. Do not call services directly inside a workflow function to maintain Temporal compatibility.
|
||||
- **Queue Redirection**: Production Temporal workers use worker-specific unique queues for data locality (e.g., local disk access) and consistent state.
|
||||
- Every workflow MUST first call `getAgentWorkerQueueActivity` or `getTranscodeWorkerQueueActivity` via the shared domain queue (e.g., `TaskQueueAgent` or `TaskQueueTranscode`) to obtain the specific queue name for that worker instance.
|
||||
- ALL subsequent activities (including shared DB activities like updating task status) MUST be executed on that specific discovered queue.
|
||||
- The shared domain worker ONLY registers the queue discovery activities. All other activities (shared and domain-specific) are registered on the specific worker.
|
||||
- **Activity Invocation**: Workflows import and call activities directly as standard async functions.
|
||||
- **Queues**: Workflows are dispatched to dedicated task queues (e.g. `TaskQueueTranscode`, `TaskQueueAgent`) managed by DBOS.
|
||||
|
||||
### Activity Patterns
|
||||
|
||||
- **Definition**: Wrap exported activity functions with `defineStep` from `@shumai/workflow-core`.
|
||||
```typescript
|
||||
export const myActivity = defineStep(
|
||||
async function myActivity(params: MyActivityParams): Promise<MyActivityResult> {
|
||||
...
|
||||
},
|
||||
{ runOnCancel: false }, // optional: set runOnCancel: true for cleanup/status handlers
|
||||
)
|
||||
```
|
||||
- **Implementation**: Activities _can_ and _should_ call other services (e.g., `aiService`, `transcodeService`) or interact with the database directly. Database (Prisma) queries or updates are allowed in all activity types (e.g., agent or transcode) for simplicity.
|
||||
|
||||
### Worker Identity & Multi-Instance Deployments
|
||||
|
||||
In multi-replica deployments (e.g., multiple transcode or agent worker instances), each worker instance MUST have a unique executor ID to prevent startup recovery from re-enqueueing workflows being actively processed by other live workers.
|
||||
|
||||
- **Identity Derivation**: `DbosExecutor` automatically derives a unique per-instance ID:
|
||||
- If `SHUMAI_WORKER_ID` or `DBOS__VMID` is set, it is used as the instance identifier.
|
||||
- In Kubernetes, set `POD_NAME` (via Downward API: `fieldRef: { fieldPath: metadata.name }`) to provide stable, per-pod identity across StatefulSet restarts.
|
||||
- In Docker/container environments, `HOSTNAME` (container ID) is automatically used.
|
||||
- On bare metal/multi-process hosts, `process.pid` and an instance suffix are appended to guarantee uniqueness.
|
||||
|
||||
### Durable Step File Exchange
|
||||
|
||||
Intermediate files passed across steps must be saved to durable storage (S3) by the producing step, consuming steps must use `ensureLocalMediaFile` (or S3 fetch) rather than assuming local `/tmp` presence, and any purely temporary S3 scratch files must be cleaned up in a `finally` block.
|
||||
|
||||
## Import conventions
|
||||
|
||||
- When importing across workspace packages, always use absolute workspace imports (e.g. `import { prisma } from '@shumai/db'`, `import { teamService } from '@shumai/core/src/team/team'`).
|
||||
|
||||
+831
@@ -0,0 +1,831 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
### Fixed
|
||||
|
||||
### Changed
|
||||
|
||||
## [0.6.0] - 2026-10-20
|
||||
|
||||
### Added
|
||||
|
||||
* **deploy**: Add dedicated `shumaione/shumai-transcode` Docker image and a complete AWS EKS deployment example (`eks/`) featuring KEDA queue-driven autoscaling, idle-timeout auto-drain worker mode, and Scale-to-Zero On-Demand Graviton5 instances for media processing
|
||||
* **storage**: Support configuring a separate public endpoint (`AWS_PUBLIC_ENDPOINT_URL_S3`) for browser-facing presigned URLs while preserving internal cluster endpoints for backend workers
|
||||
|
||||
### Fixed
|
||||
|
||||
* **transcode**: Fix an issue where PDF, 3D model, and image background transcode workflows could fail with missing temporary file errors if a worker restarted or recovered midway through processing
|
||||
* **webui**: Improve file list and detail loading with matching skeleton layouts, a persistent sidebar carousel to eliminate layout shift, and smoothed video poster previews
|
||||
|
||||
### Changed
|
||||
|
||||
* **workflow**: Migrate the background workflow engine to DBOS, unifying all-in-one and dedicated worker deployments using the existing PostgreSQL database without requiring a separate Temporal cluster
|
||||
|
||||
## [0.5.3] - 2026-10-16
|
||||
|
||||
### Added
|
||||
|
||||
* **cli**: Add administrative `shumai regenerate-embeddings` command to regenerate multimodal vector embeddings for all existing media files across active teams
|
||||
* **docker**: Provide three Docker Compose deployment tiers (Lite, with Embedding Server, and Full) with recommended memory specifications
|
||||
* **agent**: Save video chunk embeddings incrementally to the database as each chunk finishes, preserving completed progress on failure and resuming from where it left off on retry
|
||||
* **agent**: Add support for local LiteRT-LM Gemma Embedding 2 (`gemma-embedding-2-openai`) provider and environment-enforced read-only embedding agents with automatic 768-dimensional vector search indexing
|
||||
|
||||
### Fixed
|
||||
|
||||
### Changed
|
||||
|
||||
* **search**: Display search results in a responsive card grid with interactive hover video sprite scrubbing, semantic match chunk time range previews, and new-tab opening on click
|
||||
* **search**: Significantly improve semantic search response times by generating query text embeddings directly with in-memory caching instead of dispatching background tasks
|
||||
|
||||
## [0.5.2] - 2026-10-13
|
||||
|
||||
### Added
|
||||
|
||||
* **3d asset**: Add support for 3D model files (.glb, .gltf, .obj, .fbx, .stl, .dae, .usd, .usda, .usdc, .usdz) with automated turntable video rendering, hover sprite scrubbing, and an interactive 3D turntable viewer featuring 360° ruler scrubbing and degree-based markup comments
|
||||
* **kanban**: Related assets on a task are now clickable, taking you directly to that file or folder in its project
|
||||
* **settings**: Add an Integrations section to Team Settings with dedicated configuration for Gotenberg Document Converter, supporting connection testing and environment variable override protection
|
||||
|
||||
### Fixed
|
||||
|
||||
* **transcode**: Fix an issue where portrait photos from cameras and phones appeared sideways in thumbnails, previews, watermarked share links and annotated snapshots, and were listed with their width and height swapped
|
||||
|
||||
### Changed
|
||||
|
||||
## [0.5.1] - 2026-10-06
|
||||
|
||||
### Added
|
||||
|
||||
* **notification**: Notification cards are now clickable, taking you directly to the relevant file
|
||||
* **transcode**: Add hardware decoding and GPU scaling support for NVIDIA NVENC, Intel QuickSync Video (QSV), Rockchip (RKMPP), and VA-API (Intel and AMD GPUs), significantly speeding up video proxy and HLS rendition generation across supported platforms. Set `SHUMAI_HW_DECODE=false` to turn hardware decoding off
|
||||
* **transcode**: Add `dcraw_emu` fallback to generate WebP previews for camera RAW files without embedded JPEG previews
|
||||
|
||||
### Fixed
|
||||
|
||||
### Changed
|
||||
|
||||
|
||||
## [0.5.0] - 2026-10-02
|
||||
|
||||
### Added
|
||||
|
||||
* **transcode**: Add configurable target resolution ladders (480p, 720p, 1080p, 1440p, 2160p) for MP4 Multi Resolutions transcoding in team settings, with unified resolution matching and lowest-resolution fallback for both MP4 and HLS
|
||||
* **transcode**: Add HLS live streaming with fMP4/CMAF adaptive bitrate ladders (480p, 720p, 1080p, 1440p, 2160p), configurable in Transcode Settings, with automatic quality switching, manual resolution selection in the video viewer, seamless rendition switching, and full watermarking support for shared links
|
||||
* **transcode**: Add basic camera RAW image support for popular camera formats (including Sony ARW, Canon CR2/CR3, Nikon NEF, Adobe DNG, Fujifilm RAF, and Panasonic RW2), extracting high-quality embedded JPEG previews and automatically applying camera orientation for fast thumbnail and proxy generation
|
||||
|
||||
### Fixed
|
||||
|
||||
- **asset**: Fix an issue where media files remained stuck in a perpetual "Preparing..." state when transcoding failed, by displaying a clear failed status and error details in the file list and file viewer
|
||||
|
||||
* **transcode**: Fix an issue where videos or audio-only files containing attached cover art or picture streams could cause transcoding to fail during poster generation or select a single static image instead of the video
|
||||
|
||||
* **webui**: Fix inconsistent video resolution labels across download menus, mobile file headers, and the video player by correctly deriving resolutions from the video's short side, including portrait videos and 480p videos
|
||||
|
||||
* **trash**: Fix an issue where the "Empty Trash" confirmation dialog would close immediately instead of showing a loading state while files were being permanently deleted
|
||||
|
||||
### Changed
|
||||
|
||||
* **settings**: Redesign team Video Transcoding settings with dedicated cards for Transcode Policy, Hardware Acceleration, and FFmpeg Threads, clearly explaining MP4 and HLS playback vs download behavior and storage implications
|
||||
* **settings**: Rename AI Settings group to Team AI Settings in settings navigation
|
||||
|
||||
## [0.4.9] - 2026-09-28
|
||||
|
||||
### Added
|
||||
|
||||
- **notification**: You can now receive notifications via email, with batched digest emails and configurable team-level SMTP settings
|
||||
- **transcode**: Add VA-API hardware acceleration support for Linux hosts and Docker environments with Intel and AMD GPUs, featuring automatic DRI render node discovery, variable bitrate control, and structured transcoding observability logs
|
||||
- **transcode**: Add automatic fallback to software transcoding (libx264) when hardware-accelerated video encoding encounters GPU resolution constraints or runtime driver errors
|
||||
- **docker**: Add modular hardware-accelerated transcoding presets matching Immich's compose configuration via `hwaccel.transcoding.yaml` with support for NVENC, QuickSync, RKMPP, and VA-API
|
||||
|
||||
### Fixed
|
||||
|
||||
### Changed
|
||||
|
||||
- **transcode**: Improve video poster selection using intelligent scene detection and color variance filtering to automatically skip black frames, fade-ins, and blank intros in favor of representative video content
|
||||
- **transcode**: Optimize video sprite generation for large and long videos using a concurrent fast-seek pool and image compositing, avoiding full-video decoding while preserving instant single-pass generation for short clips
|
||||
|
||||
## [0.4.8] - 2026-09-24
|
||||
|
||||
### Added
|
||||
|
||||
- **transcode**: Add HDR video proxy support: HDR videos automatically generate HDR video proxies and preview videos preserving HDR color characteristics, tone-mapped SDR thumbnails and posters, and automatic HDR player playback on supported displays with hardware EDR acceleration
|
||||
- **docs**: Add a Changelog section to the documentation site so users can explore release notes and updates directly in Mintlify
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Only show the center play button and darkened tint on initial video open before playback starts; once played, pausing or scrubbing back to start keeps the video canvas clean and unobstructed for review
|
||||
- **transcode**: Fix an issue where videos with orientation or rotation metadata (such as smartphone vertical videos) were incorrectly displayed with stretched aspect ratios in the video player
|
||||
- **cli**: Only manage and check PID files in daemon mode, preventing stale PID files, crash-loop conflicts, or spurious process checks during normal foreground and Docker execution
|
||||
|
||||
### Changed
|
||||
|
||||
- **transcode**: Improve video proxy visual quality and disable B-frames for smoother frame-by-frame seeking and scrubbing
|
||||
|
||||
|
||||
## [0.4.7] - 2026-09-19
|
||||
|
||||
### Added
|
||||
|
||||
- **changelog**: Introduce Keep a Changelog support, historical release summaries, and automated release notes extraction
|
||||
- **release**: Automatically populate GitHub release bodies from CHANGELOG.md and promote unreleased notes during version bumps
|
||||
- **settings**: Add FFmpeg threads slider to team media processing settings
|
||||
- **asset**: Show previews of a folder's contents and a "days left" countdown for each item in Recently Deleted
|
||||
- **asset**: Show the poster and hover preview for a video in the file list while it is still transcoding, with a gently pulsing cover (or an animated waiting circle before the poster is ready), "Uploading..."/"Preparing..." labels, and the duration hidden until it is ready
|
||||
|
||||
### Fixed
|
||||
|
||||
- **asset**: Fix an issue where moving a video to trash while it was still transcoding could cause it to lose its trashed status
|
||||
- **transcode**: Immediately stop background video processing and transcoding when a file is permanently deleted from the trash
|
||||
- **asset**: Fix proxy download filename using original file extension instead of proxy extension
|
||||
- **asset**: Fix an issue where deleting or restoring a version stack from the file list did nothing
|
||||
- **webui**: Center breadcrumb file action popup menu on the chevron icon
|
||||
|
||||
## [0.4.6] - 2026-09-17
|
||||
|
||||
### Added
|
||||
|
||||
- **comment**: Add emoji reaction support for comments ([#405](https://github.com/shumaiOne/shumai/pull/405))
|
||||
- **premiere-uxp**: Introduce Adobe Premiere Pro UXP plugin for Shumai ([#407](https://github.com/shumaiOne/shumai/pull/407))
|
||||
- **settings**: Add team appearance setting to hide agent features ([#411](https://github.com/shumaiOne/shumai/pull/411))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **premiere-uxp**: Preserve remote cloud storage presigned URLs in asset resolution ([#408](https://github.com/shumaiOne/shumai/pull/408))
|
||||
- **premiere-uxp**: Scope sequence links by server endpoint and surface sync errors ([#409](https://github.com/shumaiOne/shumai/pull/409))
|
||||
- **api**: Enforce SHUMAI_DEMO_MODE for API token and CLI requests ([#413](https://github.com/shumaiOne/shumai/pull/413))
|
||||
|
||||
### Documentation
|
||||
|
||||
- Add NLE export and Premiere Pro UXP plugin documentation ([#412](https://github.com/shumaiOne/shumai/pull/412))
|
||||
|
||||
## [0.4.5] - 2026-09-13
|
||||
|
||||
### Added
|
||||
|
||||
- **core**: Export comments to FCP, Premiere, Media Composer, and Resolve ([#400](https://github.com/shumaiOne/shumai/pull/400))
|
||||
- **webui**: Add NLE comments export and migrate export API to POST ([#401](https://github.com/shumaiOne/shumai/pull/401))
|
||||
- **webui**: Add space key quick preview for files and folders ([#402](https://github.com/shumaiOne/shumai/pull/402))
|
||||
- **webui**: Show comments count badge in file card preview area ([#403](https://github.com/shumaiOne/shumai/pull/403))
|
||||
- **agent**: Use deterministic storage keys for preset avatars ([#404](https://github.com/shumaiOne/shumai/pull/404))
|
||||
|
||||
## [0.4.4] - 2026-09-09
|
||||
|
||||
### Added
|
||||
|
||||
- **upload**: S3 multipart upload with offline resume and wake lock ([#391](https://github.com/shumaiOne/shumai/pull/391))
|
||||
- **transcode**: Optimize video operations using ffmpeg http range requests ([#393](https://github.com/shumaiOne/shumai/pull/393))
|
||||
- **agent**: Enable read_asset tool for autofill agent ([#396](https://github.com/shumaiOne/shumai/pull/396))
|
||||
- **sandbox**: Abstract SandboxService and hot-reload allowed domains ([#398](https://github.com/shumaiOne/shumai/pull/398))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **s3**: Stream downloadToFile and putObject to prevent OOM on large files ([#392](https://github.com/shumaiOne/shumai/pull/392))
|
||||
- **agent**: Pass agent thinkingLevel to session name generation ([#395](https://github.com/shumaiOne/shumai/pull/395))
|
||||
- **agent**: Restrict pageCount and duration recommendations to matching media types ([#397](https://github.com/shumaiOne/shumai/pull/397))
|
||||
- **transcode**: Co-locate screenshots and derived artifacts in asset storage directory ([#399](https://github.com/shumaiOne/shumai/pull/399))
|
||||
|
||||
## [0.4.3] - 2026-09-06
|
||||
|
||||
### Added
|
||||
|
||||
- **asset**: Record and display agent provenance on assets and audit logs ([#380](https://github.com/shumaiOne/shumai/pull/380))
|
||||
- **agent**: Store preset avatars as real files in s3 storage ([#381](https://github.com/shumaiOne/shumai/pull/381))
|
||||
- **agent**: Add built-in image and video generation tools and settings ([#382](https://github.com/shumaiOne/shumai/pull/382))
|
||||
- **media-generation**: Add gemini-omni-1.1-flash video model and redesign settings UI ([#383](https://github.com/shumaiOne/shumai/pull/383))
|
||||
- **settings**: Redesign image/video settings to provider dialog with model toggles ([#385](https://github.com/shumaiOne/shumai/pull/385))
|
||||
- **agent**: Add asset management tools and CLI commands ([#387](https://github.com/shumaiOne/shumai/pull/387))
|
||||
- **cli**: Control asset deletion via SHUMAI_ALLOW_DELETE env var ([#388](https://github.com/shumaiOne/shumai/pull/388))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Clamp file card creation info to 2 lines and show tooltip on hover ([#390](https://github.com/shumaiOne/shumai/pull/390))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **agents**: Add documentation for image and video generation settings ([#389](https://github.com/shumaiOne/shumai/pull/389))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **deps**: Upgrade bun to 1.4.2 and update packages ([#384](https://github.com/shumaiOne/shumai/pull/384))
|
||||
- **i18n**: Update paraglide-js to 2.25.0 and stop checking in generated code ([#386](https://github.com/shumaiOne/shumai/pull/386))
|
||||
|
||||
## [0.4.2] - 2026-09-03
|
||||
|
||||
### Added
|
||||
|
||||
- **chat**: Support markups, attachments, and timestamps in agent 1-to-1 chat ([#368](https://github.com/shumaiOne/shumai/pull/368))
|
||||
- **agent**: Move thread metadata to structured context XML ([#373](https://github.com/shumaiOne/shumai/pull/373))
|
||||
- **agent**: Improve timestamp precision and proxy selection for video screenshots ([#374](https://github.com/shumaiOne/shumai/pull/374))
|
||||
- **agent**: Support dynamic annotationId resolution across chat and comments ([#375](https://github.com/shumaiOne/shumai/pull/375))
|
||||
- **agent**: Consolidate media tools into read_asset and add S3 key support to download_asset ([#376](https://github.com/shumaiOne/shumai/pull/376))
|
||||
- **provider**: Optimize provider and model configuration management ([#377](https://github.com/shumaiOne/shumai/pull/377))
|
||||
- **provider**: Add provider and model sync feature with vendored generator ([#378](https://github.com/shumaiOne/shumai/pull/378))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **agent**: Set empty details in asset tool results to avoid data duplication ([#370](https://github.com/shumaiOne/shumai/pull/370))
|
||||
- **webui**: Strip styles and preserve multiline text on paste in chat input ([#371](https://github.com/shumaiOne/shumai/pull/371))
|
||||
- **agent**: Hide main comment sessions in dashboard sessions list ([#372](https://github.com/shumaiOne/shumai/pull/372))
|
||||
|
||||
### Changed
|
||||
|
||||
- **webui**: Use semantic system colors in notification settings ([#379](https://github.com/shumaiOne/shumai/pull/379))
|
||||
|
||||
## [0.4.1] - 2026-08-30
|
||||
|
||||
### Added
|
||||
|
||||
- **webui**: Add manage versions option to file card context menu ([#364](https://github.com/shumaiOne/shumai/pull/364))
|
||||
- **agent**: Refactor message context into unified shumai_message ([#365](https://github.com/shumaiOne/shumai/pull/365))
|
||||
- **webui**: Redesign comment attachment display into compact rows ([#366](https://github.com/shumaiOne/shumai/pull/366))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **asset,webui**: Disallow dropping version stacks onto files and version stacks ([#363](https://github.com/shumaiOne/shumai/pull/363))
|
||||
- **webui**: Prevent empty folder flash during initial loading ([#367](https://github.com/shumaiOne/shumai/pull/367))
|
||||
|
||||
### Changed
|
||||
|
||||
- **agent**: Remove executeAgentToolWorkflow and invoke core services directly ([#362](https://github.com/shumaiOne/shumai/pull/362))
|
||||
|
||||
## [0.4.0] - 2026-08-28
|
||||
|
||||
### Added
|
||||
|
||||
- **transcode**: Add hardware-accelerated video transcoding support ([#352](https://github.com/shumaiOne/shumai/pull/352))
|
||||
- **webui**: Truncate long file names with 100ms hover tooltip ([#355](https://github.com/shumaiOne/shumai/pull/355))
|
||||
- **webui**: Add simplified mobile-friendly layout for file and share lists ([#356](https://github.com/shumaiOne/shumai/pull/356))
|
||||
- **webui**: Add mobile friendly file detail and public share view ([#359](https://github.com/shumaiOne/shumai/pull/359))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **transcode**: Apply team hardware acceleration and source bitrate capping to watermark transcoding ([#353](https://github.com/shumaiOne/shumai/pull/353))
|
||||
- **share**: Hide and soft-delete symlinks when target assets are trashed ([#354](https://github.com/shumaiOne/shumai/pull/354))
|
||||
- **webui**: Fix breadcrumb file dropdown trigger stretching and alignment ([#360](https://github.com/shumaiOne/shumai/pull/360))
|
||||
- **webui**: Align mobile comment cards and thread vertical indicator ([#361](https://github.com/shumaiOne/shumai/pull/361))
|
||||
|
||||
### Documentation
|
||||
|
||||
- Add SECURITY.md with a private disclosure path ([#357](https://github.com/shumaiOne/shumai/pull/357))
|
||||
|
||||
## [0.3.11] - 2026-08-25
|
||||
|
||||
### Added
|
||||
|
||||
- **auth**: Add admin password reset CLI command and reset password web UI ([#347](https://github.com/shumaiOne/shumai/pull/347))
|
||||
- **project**: Add recent viewed files section to project folder tree ([#348](https://github.com/shumaiOne/shumai/pull/348))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Prevent left carousel remounting and scroll jump on file selection ([#351](https://github.com/shumaiOne/shumai/pull/351))
|
||||
|
||||
## [0.3.10] - 2026-08-23
|
||||
|
||||
### Added
|
||||
|
||||
- **agentic kanban**: Phase 1 not-agentic kanban board ([#330](https://github.com/shumaiOne/shumai/pull/330))
|
||||
- **kanban**: Resolve latest version for linked version stack assets and update demo login text ([#342](https://github.com/shumaiOne/shumai/pull/342))
|
||||
- **kanban**: Update task status permissions, reporter defaults, and participant access ([#345](https://github.com/shumaiOne/shumai/pull/345))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **kanban**: Use true thumbnail and poster for task asset previews ([#343](https://github.com/shumaiOne/shumai/pull/343))
|
||||
- **webui**: Sidebar selection styling, kanban active state, pointer cursors, and owner dashboard ([#344](https://github.com/shumaiOne/shumai/pull/344))
|
||||
- **kanban**: Improve drag-drop to column bottom, remove empty drop line, and fix timeline alignment ([#346](https://github.com/shumaiOne/shumai/pull/346))
|
||||
|
||||
## [0.3.9] - 2026-08-18
|
||||
|
||||
### Added
|
||||
|
||||
- **agent**: Add permission controls for chat agents ([#313](https://github.com/shumaiOne/shumai/pull/313))
|
||||
- **authz**: Enforce project-aware roles for agent/skill/mcp permissions ([#314](https://github.com/shumaiOne/shumai/pull/314))
|
||||
- **webui**: Use project members for asset comment mentions ([#315](https://github.com/shumaiOne/shumai/pull/315))
|
||||
- **quota**: Add 2-level database-backed resource quota system ([#318](https://github.com/shumaiOne/shumai/pull/318))
|
||||
- **settings**: Reorganize settings into personal, team, and AI sections ([#324](https://github.com/shumaiOne/shumai/pull/324))
|
||||
- **quota**: Move usage monitoring to team dashboard ([#327](https://github.com/shumaiOne/shumai/pull/327))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Preserve selected chatbot agent preference on reload ([#323](https://github.com/shumaiOne/shumai/pull/323))
|
||||
- **quota**: Exclude agents from quota rules and usage records ([#325](https://github.com/shumaiOne/shumai/pull/325))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **team-settings**: Add resource quotas documentation and update readme features ([#326](https://github.com/shumaiOne/shumai/pull/326))
|
||||
|
||||
## [0.3.8] - 2026-08-15
|
||||
|
||||
### Added
|
||||
|
||||
- **webui**: Replace legacy markdown editor with new lexical wysiwyg editor ([#308](https://github.com/shumaiOne/shumai/pull/308))
|
||||
- **agent**: Add nested agents.md support across backend and webui ([#309](https://github.com/shumaiOne/shumai/pull/309))
|
||||
- **webui**: Improve AGENTS.md editor placeholder and read-only notice ([#310](https://github.com/shumaiOne/shumai/pull/310))
|
||||
- **version-stack**: Add manage versions dialog and version removal ([#311](https://github.com/shumaiOne/shumai/pull/311))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **core**: Rename latest version child record on version stack rename ([#312](https://github.com/shumaiOne/shumai/pull/312))
|
||||
|
||||
## [0.3.7] - 2026-08-14
|
||||
|
||||
### Added
|
||||
|
||||
- **metadata**: Replace aiAutofill boolean with autofillSource enum ([#302](https://github.com/shumaiOne/shumai/pull/302))
|
||||
- **agent**: Type-safe CREATION_CONTEXT metadata on create_file/create_version ([#303](https://github.com/shumaiOne/shumai/pull/303))
|
||||
- **sandbox**: Default Network Sandbox to off and add settings toggle switch ([#304](https://github.com/shumaiOne/shumai/pull/304))
|
||||
- **webui**: Redesign select metadata fields and improve long text field widget ([#305](https://github.com/shumaiOne/shumai/pull/305))
|
||||
- **agent**: Support dynamic newOption in select and selectMulti metadata fields ([#306](https://github.com/shumaiOne/shumai/pull/306))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Fix select field height and multi-select overflow/interaction issues ([#307](https://github.com/shumaiOne/shumai/pull/307))
|
||||
|
||||
## [0.3.6] - 2026-08-12
|
||||
|
||||
### Added
|
||||
|
||||
- **mcp**: Add MCP server support with proxy tool and OAuth flow ([#289](https://github.com/shumaiOne/shumai/pull/289))
|
||||
- **mcp**: Support tool-level directTools array and 3-state UI configuration ([#297](https://github.com/shumaiOne/shumai/pull/297))
|
||||
- **webui**: Direct canvas PDF rendering with selectable text ([#299](https://github.com/shumaiOne/shumai/pull/299))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **agent**: Prevent agents from accessing disabled skills ([#292](https://github.com/shumaiOne/shumai/pull/292))
|
||||
- **agent**: Resolve version stack name and size in list_assets ([#296](https://github.com/shumaiOne/shumai/pull/296))
|
||||
- **webui**: Content-only pinch-zoom and two-finger pan in media viewers ([#298](https://github.com/shumaiOne/shumai/pull/298))
|
||||
- **i18n**: Update Chinese translation for dashboard to 仪表板 ([#301](https://github.com/shumaiOne/shumai/pull/301))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **mcp**: Add MCP support documentation to README and docs ([#300](https://github.com/shumaiOne/shumai/pull/300))
|
||||
|
||||
## [0.3.5] - 2026-08-09
|
||||
|
||||
### Added
|
||||
|
||||
- **transcode**: Add Gotenberg support for Office, HTML, CSV, and Markdown PDF proxies ([#283](https://github.com/shumaiOne/shumai/pull/283))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Resolve upload card freeze for unsupported files ([#284](https://github.com/shumaiOne/shumai/pull/284))
|
||||
- **webui**: Exclude file extension when selecting file name during inline rename ([#285](https://github.com/shumaiOne/shumai/pull/285))
|
||||
- Use renamed asset name in download Content-Disposition ([#286](https://github.com/shumaiOne/shumai/pull/286))
|
||||
- **webui**: Batch download no longer flashes a tab per file ([#287](https://github.com/shumaiOne/shumai/pull/287))
|
||||
- **webui**: Enable rename and delete actions in file detail top bar breadcrumb ([#288](https://github.com/shumaiOne/shumai/pull/288))
|
||||
|
||||
## [0.3.4] - 2026-08-08
|
||||
|
||||
### Added
|
||||
|
||||
- **sharelink**: Add sharelink watermark support ([#270](https://github.com/shumaiOne/shumai/pull/270))
|
||||
- **webui**: Remove original-file display fallbacks, use proxies only ([#273](https://github.com/shumaiOne/shumai/pull/273))
|
||||
- **share**: Add allow download config to share links ([#275](https://github.com/shumaiOne/shumai/pull/275))
|
||||
- **transcode**: Update preview thumbnail resolution to 300p with max length constraint ([#281](https://github.com/shumaiOne/shumai/pull/281))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **share**: Resolve symlink asset downloads in public share pages ([#274](https://github.com/shumaiOne/shumai/pull/274))
|
||||
- **webui**: Persist project sorting and prevent full page flash ([#276](https://github.com/shumaiOne/shumai/pull/276))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **share-links**: Document allow download and lazy watermark settings ([#278](https://github.com/shumaiOne/shumai/pull/278))
|
||||
- **agent**: Clarify create_file/create_version context param guidance ([#282](https://github.com/shumaiOne/shumai/pull/282))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **e2e**: Watermarked download-disabled share link coverage (image + video) ([#277](https://github.com/shumaiOne/shumai/pull/277))
|
||||
- **e2e**: Stabilize watermark share spec on Firefox ([#279](https://github.com/shumaiOne/shumai/pull/279))
|
||||
- Split e2e scripts into app and webui targets ([#280](https://github.com/shumaiOne/shumai/pull/280))
|
||||
|
||||
## [0.3.3] - 2026-08-05
|
||||
|
||||
### Added
|
||||
|
||||
- **agent**: Enable LLM API call retries in AgentHarness ([#250](https://github.com/shumaiOne/shumai/pull/250))
|
||||
- **audit**: Add audit log support for APIs and WebUI dashboard ([#251](https://github.com/shumaiOne/shumai/pull/251))
|
||||
- **webui**: Persist agent preference in localStorage ([#254](https://github.com/shumaiOne/shumai/pull/254))
|
||||
- **e2e**: Add file domain comment and draw tests ([#260](https://github.com/shumaiOne/shumai/pull/260))
|
||||
- **agent**: Restrict bash access for non-owner users ([#262](https://github.com/shumaiOne/shumai/pull/262))
|
||||
- **agent**: Allow create_file tool to create files directly from content ([#263](https://github.com/shumaiOne/shumai/pull/263))
|
||||
- **agent**: Propagate autofill context from chat to autofill workflow ([#264](https://github.com/shumaiOne/shumai/pull/264))
|
||||
- **webui**: Render select options in field creation mode and pick random option color ([#265](https://github.com/shumaiOne/shumai/pull/265))
|
||||
- **project**: Include team-scoped members in project member list and add 3-section dialog layout ([#267](https://github.com/shumaiOne/shumai/pull/267))
|
||||
- **webui**: Disable role dropdown for project-scoped members in team view ([#269](https://github.com/shumaiOne/shumai/pull/269))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Mention popup avatars, keyboard auto-scroll, and non-sticky section headers ([#256](https://github.com/shumaiOne/shumai/pull/256))
|
||||
- **webui**: Persist field order on drag and drop ([#266](https://github.com/shumaiOne/shumai/pull/266))
|
||||
|
||||
### Changed
|
||||
|
||||
- **agent**: Load models directly from database without pi fallback ([#253](https://github.com/shumaiOne/shumai/pull/253))
|
||||
- **core**: Replace generated provider files with pi-ai dynamic methods ([#255](https://github.com/shumaiOne/shumai/pull/255))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **core**: Add missing tests for methods introduced in 97069042 ([#252](https://github.com/shumaiOne/shumai/pull/252))
|
||||
- **e2e**: Add domain-based auth and project web app e2e tests ([#257](https://github.com/shumaiOne/shumai/pull/257))
|
||||
- **e2e**: Add file, share, and collection web app e2e tests ([#258](https://github.com/shumaiOne/shumai/pull/258))
|
||||
- **e2e**: Add project-level invite and file-move e2e tests ([#259](https://github.com/shumaiOne/shumai/pull/259))
|
||||
- **e2e**: Add search in file list and save-search-as-collection cases ([#261](https://github.com/shumaiOne/shumai/pull/261))
|
||||
- **e2e**: Add member permission change tests ([#268](https://github.com/shumaiOne/shumai/pull/268))
|
||||
|
||||
## [0.3.2] - 2026-07-30
|
||||
|
||||
### Added
|
||||
|
||||
- **agent**: Add output truncation and streaming limits to sandboxed bash tool ([#248](https://github.com/shumaiOne/shumai/pull/248))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **agent**: Download original document asset instead of pdf proxy ([#247](https://github.com/shumaiOne/shumai/pull/247))
|
||||
- **webui**: Persist chatbot sidebar input text across route navigation ([#249](https://github.com/shumaiOne/shumai/pull/249))
|
||||
|
||||
## [0.3.1] - 2026-07-30
|
||||
|
||||
### Added
|
||||
|
||||
- **transcode**: Trigger ai metadata autofill post transcode ([#234](https://github.com/shumaiOne/shumai/pull/234))
|
||||
- **dashboard**: Add agent sessions view for team owners ([#237](https://github.com/shumaiOne/shumai/pull/237))
|
||||
- **db**: Preserve agent sessions on asset deletion by setting onDelete to SetNull ([#240](https://github.com/shumaiOne/shumai/pull/240))
|
||||
- **agent**: Add download_asset tool and prompt instructions ([#242](https://github.com/shumaiOne/shumai/pull/242))
|
||||
- **db**: Update Asset.sizeByte and AiUsage token fields to BigInt ([#244](https://github.com/shumaiOne/shumai/pull/244))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **agent**: Include select option labels and field name in autofill schema ([#235](https://github.com/shumaiOne/shumai/pull/235))
|
||||
- **agent**: Scope agent comment sessions to thread sessions anchored at root comments ([#239](https://github.com/shumaiOne/shumai/pull/239))
|
||||
- **agent**: Disable tools for session naming and make naming non-blocking ([#241](https://github.com/shumaiOne/shumai/pull/241))
|
||||
- **webui**: Update file size formatting to SI decimal standard ([#245](https://github.com/shumaiOne/shumai/pull/245))
|
||||
- **s3**: Enforce property syntax in S3Service interface and fix ReadableStream handling in S3StorageService ([#246](https://github.com/shumaiOne/shumai/pull/246))
|
||||
|
||||
## [0.3.0] - 2026-07-28
|
||||
|
||||
### Added
|
||||
|
||||
- **file-browser**: Add copy name and path option to context menu ([#225](https://github.com/shumaiOne/shumai/pull/225))
|
||||
- **agent**: Inject user name and role into chat context ([#226](https://github.com/shumaiOne/shumai/pull/226))
|
||||
- **agent**: Refactor database session storage to normalized DAG entries and lazy thread sync ([#229](https://github.com/shumaiOne/shumai/pull/229))
|
||||
- **agent**: Support ENABLE_WEAKER_NESTED_SANDBOX environment variable ([#233](https://github.com/shumaiOne/shumai/pull/233))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **agent**: Ensure atomic appendEntry and persist leaf entries in DatabaseSessionStorage ([#224](https://github.com/shumaiOne/shumai/pull/224))
|
||||
- Sharp version mismatch bug ([#230](https://github.com/shumaiOne/shumai/pull/230))
|
||||
- **agent**: Resolve S3 MIME type detection and prompt parameter in image analysis ([#232](https://github.com/shumaiOne/shumai/pull/232))
|
||||
|
||||
### Changed
|
||||
|
||||
- **agent**: Remove implicit agent mention trigger in comment threads ([#227](https://github.com/shumaiOne/shumai/pull/227))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **workflow**: Add docker compose deployment verification job ([#231](https://github.com/shumaiOne/shumai/pull/231))
|
||||
|
||||
## [0.2.3] - 2026-07-25
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Show right sidebar by default on file detail page ([#219](https://github.com/shumaiOne/shumai/pull/219))
|
||||
- **webui**: Refresh file list and detail when agent executes asset creation tools ([#220](https://github.com/shumaiOne/shumai/pull/220))
|
||||
- **webui**: Fix space key drag overlay and shift range selection for version stacks ([#221](https://github.com/shumaiOne/shumai/pull/221))
|
||||
- **transcode**: Handle timestamp rounding tolerance for screenshot annotations ([#223](https://github.com/shumaiOne/shumai/pull/223))
|
||||
|
||||
### Changed
|
||||
|
||||
- **e2e**: Split transcode workflow E2E tests into per-workflow test files ([#222](https://github.com/shumaiOne/shumai/pull/222))
|
||||
|
||||
## [0.2.2] - 2026-07-23
|
||||
|
||||
### Added
|
||||
|
||||
- **webui**: Integrate AI usage API into dashboard page ([#216](https://github.com/shumaiOne/shumai/pull/216))
|
||||
- **ai-usage**: Add team and member token usage tracking and APIs ([#215](https://github.com/shumaiOne/shumai/pull/215))
|
||||
- **transcode**: Add PSD support via ImageMagick and enforce sRGB conversion ([#217](https://github.com/shumaiOne/shumai/pull/217))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **search**: Fix buildSqlCondition date range, numeric metadata, and string parsing bugs ([#213](https://github.com/shumaiOne/shumai/pull/213))
|
||||
- **webui**: Prevent horizontal overflow in search dialog result rows ([#214](https://github.com/shumaiOne/shumai/pull/214))
|
||||
- **webui**: Invalidate upload tasks query when upload task starts and completes ([#218](https://github.com/shumaiOne/shumai/pull/218))
|
||||
|
||||
## [0.2.1] - 2026-07-22
|
||||
|
||||
### Added
|
||||
|
||||
- **skill**: Add team owner skill permission control ([#209](https://github.com/shumaiOne/shumai/pull/209))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **agent**: Handle non-builtin models in getModelFromDb and upgrade pi-ai ([#211](https://github.com/shumaiOne/shumai/pull/211))
|
||||
- **provider**: Preserve model ids on provider update ([#212](https://github.com/shumaiOne/shumai/pull/212))
|
||||
|
||||
### Changed
|
||||
|
||||
- **core**: Split generated providers into per-provider files ([#210](https://github.com/shumaiOne/shumai/pull/210))
|
||||
|
||||
## [0.2.0] - 2026-07-21
|
||||
|
||||
### Added
|
||||
|
||||
- **transcode**: Add PDF preview, sprite generation, and annotation support ([#193](https://github.com/shumaiOne/shumai/pull/193))
|
||||
- **web**: Register pdf.worker route in production ([#195](https://github.com/shumaiOne/shumai/pull/195))
|
||||
- **agent**: Add read_pdf_pages tool and PDF page context support ([#196](https://github.com/shumaiOne/shumai/pull/196))
|
||||
- **transcode**: Split monolithic transcodeMedia into focused workflows ([#197](https://github.com/shumaiOne/shumai/pull/197))
|
||||
- **transcode**: Add PDF proxy support for TXT and CSV files ([#199](https://github.com/shumaiOne/shumai/pull/199))
|
||||
- **asset**: Replace mediaType/mimeType logic with proxyType ([#200](https://github.com/shumaiOne/shumai/pull/200))
|
||||
- **docker**: Install fonts-noto-cjk in runner stage ([#202](https://github.com/shumaiOne/shumai/pull/202))
|
||||
- **transcode**: Add markdown file to pdf proxy support ([#203](https://github.com/shumaiOne/shumai/pull/203))
|
||||
- **chat**: Track context asset changes and update agent context ([#204](https://github.com/shumaiOne/shumai/pull/204))
|
||||
- **agent**: Refactor media tools to static injection with mandatory assetId and authz ([#208](https://github.com/shumaiOne/shumai/pull/208))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **transcode**: Mark pdfkit as external and extract for docker runtime ([#201](https://github.com/shumaiOne/shumai/pull/201))
|
||||
- **agent**: Include skill id in formatSkillsForPrompt ([#205](https://github.com/shumaiOne/shumai/pull/205))
|
||||
- **asset**: Exclude soft-deleted children from latestChildren preview ([#206](https://github.com/shumaiOne/shumai/pull/206))
|
||||
- **agent**: Pass latest version asset from version stack to prompt builder ([#207](https://github.com/shumaiOne/shumai/pull/207))
|
||||
|
||||
## [0.1.10] - 2026-07-16
|
||||
|
||||
### Added
|
||||
|
||||
- **workflow-e2e**: Add E2E tests for agentAutofillMedia workflow ([#188](https://github.com/shumaiOne/shumai/pull/188))
|
||||
- **comments**: Support comment deletion and video player shortcuts ([#191](https://github.com/shumaiOne/shumai/pull/191))
|
||||
- **agent**: Support disabling specific tools for agents ([#192](https://github.com/shumaiOne/shumai/pull/192))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **e2e**: Add E2E workflow tests for remaining agent and transcode services ([#189](https://github.com/shumaiOne/shumai/pull/189))
|
||||
|
||||
## [0.1.9] - 2026-07-14
|
||||
|
||||
### Added
|
||||
|
||||
- **e2e**: Set up fullstack app-level e2e test framework and signup test case ([#184](https://github.com/shumaiOne/shumai/pull/184))
|
||||
- **chat**: Chatbot UI ([#185](https://github.com/shumaiOne/shumai/pull/185))
|
||||
- **agent**: Support aborting agent execution ([#186](https://github.com/shumaiOne/shumai/pull/186))
|
||||
|
||||
### Changed
|
||||
|
||||
- **api/chat**: Remove direct Prisma query from API layer ([#187](https://github.com/shumaiOne/shumai/pull/187))
|
||||
|
||||
## [0.1.8] - 2026-07-10
|
||||
|
||||
### Added
|
||||
|
||||
- **chatbot**: Implement type-safe Chat APIs with compaction support ([#180](https://github.com/shumaiOne/shumai/pull/180))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Enable build splitting and code-split all page routes ([#183](https://github.com/shumaiOne/shumai/pull/183))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **readme**: Clarify displayed file size represents original file size ([#182](https://github.com/shumaiOne/shumai/pull/182))
|
||||
|
||||
## [0.1.7] - 2026-07-06
|
||||
|
||||
### Added
|
||||
|
||||
- **audio**: Support frame-accurate audio playback, comments, and AI safeguards ([#175](https://github.com/shumaiOne/shumai/pull/175))
|
||||
- **i18n**: Localize members dialog, notifications, uploads, user menus, dates, and players ([#178](https://github.com/shumaiOne/shumai/pull/178))
|
||||
- **comments**: Allow marking comments as complete or incomplete ([#179](https://github.com/shumaiOne/shumai/pull/179))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **upload**: Resolve empty and generic MIME types in confirmFileUpload ([#176](https://github.com/shumaiOne/shumai/pull/176))
|
||||
|
||||
### Changed
|
||||
|
||||
- **webui**: Modularize file viewer components into registry-driven architecture ([#174](https://github.com/shumaiOne/shumai/pull/174))
|
||||
|
||||
### Documentation
|
||||
|
||||
- Improve documentation and examples for S3 compatible storage ([#177](https://github.com/shumaiOne/shumai/pull/177))
|
||||
|
||||
## [0.1.6] - 2026-07-04
|
||||
|
||||
### Added
|
||||
|
||||
- **file-browser**: Show video duration on file card preview ([#170](https://github.com/shumaiOne/shumai/pull/170))
|
||||
- **webui**: Compare versions view for version stacks ([#171](https://github.com/shumaiOne/shumai/pull/171))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Resolve conditional hooks and setState-in-render errors ([#167](https://github.com/shumaiOne/shumai/pull/167))
|
||||
- **webui**: Resolve video player total frames mismatch ([#172](https://github.com/shumaiOne/shumai/pull/172))
|
||||
- **version-stack**: Resolve correct latest version ID of version stack ([#173](https://github.com/shumaiOne/shumai/pull/173))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **webui**: Video player e2e framework + Safari playhead fix ([#166](https://github.com/shumaiOne/shumai/pull/166))
|
||||
- **webui**: Add frame-accurate comment seek roundtrip e2e ([#168](https://github.com/shumaiOne/shumai/pull/168))
|
||||
- **webui**: Verify video player restarts playback after end ([#169](https://github.com/shumaiOne/shumai/pull/169))
|
||||
|
||||
## [0.1.5] - 2026-07-02
|
||||
|
||||
### Changed
|
||||
|
||||
- **storage**: Use original filenames for stored files ([#165](https://github.com/shumaiOne/shumai/pull/165))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **release**: Add Aliyun ACR push to release workflow ([#164](https://github.com/shumaiOne/shumai/pull/164))
|
||||
|
||||
## [0.1.4] - 2026-07-01
|
||||
|
||||
### Added
|
||||
|
||||
- **transcode**: Change video poster resolution to 480p ([#161](https://github.com/shumaiOne/shumai/pull/161))
|
||||
- **auth**: Allow setting user locale on signup ([#163](https://github.com/shumaiOne/shumai/pull/163))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Preserve video ended state by skipping playhead snap on ended ([#162](https://github.com/shumaiOne/shumai/pull/162))
|
||||
|
||||
## [0.1.3] - 2026-06-30
|
||||
|
||||
### Added
|
||||
|
||||
- **webui**: Add i18n support using paraglide-js ([#156](https://github.com/shumaiOne/shumai/pull/156))
|
||||
- **video**: Add frame-accurate video player, SMPTE timecodes, and format switcher ([#157](https://github.com/shumaiOne/shumai/pull/157))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Align video timeline duration and formatting with frameio ([#158](https://github.com/shumaiOne/shumai/pull/158))
|
||||
- **webui**: Fix missing left sidebar for nested folders ([#159](https://github.com/shumaiOne/shumai/pull/159))
|
||||
- **api**: Fix update team settings and make request schema type-safe ([#160](https://github.com/shumaiOne/shumai/pull/160))
|
||||
|
||||
## [0.1.2] - 2026-06-25
|
||||
|
||||
### Changed
|
||||
|
||||
- **s3**: Remove automatic port appending to AWS_ENDPOINT_URL_S3 ([#155](https://github.com/shumaiOne/shumai/pull/155))
|
||||
|
||||
## [0.1.1] - 2026-06-23
|
||||
|
||||
### Added
|
||||
|
||||
- **docker**: Add root entrypoint with privilege dropping for data volumes ([#151](https://github.com/shumaiOne/shumai/pull/151))
|
||||
|
||||
## [0.1.0] - 2026-06-22
|
||||
|
||||
### Added
|
||||
|
||||
- **share**: Secure share info API and fix wrong password feedback ([#150](https://github.com/shumaiOne/shumai/pull/150))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Truncate long folder, collection, and share link names in sidebar ([#149](https://github.com/shumaiOne/shumai/pull/149))
|
||||
|
||||
## [0.0.11] - 2026-06-22
|
||||
|
||||
### Added
|
||||
|
||||
- **cli**: Add shumai-cli and token authentication ([#144](https://github.com/shumaiOne/shumai/pull/144))
|
||||
- **settings**: Use singular headers and remove collapse/counters for single agent types ([#145](https://github.com/shumaiOne/shumai/pull/145))
|
||||
- **folders**: Auto expand folder tree in left sidebar on navigation ([#146](https://github.com/shumaiOne/shumai/pull/146))
|
||||
- **metadata**: Add single user and multiple user custom fields ([#147](https://github.com/shumaiOne/shumai/pull/147))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **cli**: Rename npm package to @shumai-one/shumai-cli ([#148](https://github.com/shumaiOne/shumai/pull/148))
|
||||
|
||||
## [0.0.10] - 2026-06-21
|
||||
|
||||
### Changed
|
||||
|
||||
- **web**: Dynamically register production HTML bundle routes ([#142](https://github.com/shumaiOne/shumai/pull/142))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **readme**: Polish structure, correct grammar, and add dependencies table ([#143](https://github.com/shumaiOne/shumai/pull/143))
|
||||
|
||||
## [0.0.9] - 2026-06-20
|
||||
|
||||
### Added
|
||||
|
||||
- **webui**: Show app version in avatar menu ([#139](https://github.com/shumaiOne/shumai/pull/139))
|
||||
- **cli**: Add background daemonization and subcommands ([#141](https://github.com/shumaiOne/shumai/pull/141))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **release**: Add smoke tests to local release stage ([#140](https://github.com/shumaiOne/shumai/pull/140))
|
||||
|
||||
## [0.0.8] - 2026-06-19
|
||||
|
||||
### Added
|
||||
|
||||
- **api**: Implement read-only mode for reviewers ([#122](https://github.com/shumaiOne/shumai/pull/122))
|
||||
- **server**: Allow customizing server port via SHUMAI_SERVER_PORT ([#124](https://github.com/shumaiOne/shumai/pull/124))
|
||||
- **embedding**: Defer embedding workflow, use transcoded assets, and execute chunks in separate activities ([#125](https://github.com/shumaiOne/shumai/pull/125))
|
||||
- **webui**: Add external drag-and-drop file and folder upload support ([#126](https://github.com/shumaiOne/shumai/pull/126))
|
||||
- **agent**: Implement overlapping video chunks for semantic search ([#127](https://github.com/shumaiOne/shumai/pull/127))
|
||||
- **webui**: Support jumping to video timestamp from search results ([#128](https://github.com/shumaiOne/shumai/pull/128))
|
||||
- **auth**: Add demo mode support ([#131](https://github.com/shumaiOne/shumai/pull/131))
|
||||
- **auth**: Refine demo mode support ([#132](https://github.com/shumaiOne/shumai/pull/132))
|
||||
- **webui**: Default right sidebar to collapsed for new users ([#133](https://github.com/shumaiOne/shumai/pull/133))
|
||||
- **webui**: Use Shadcn Switch in toggle field and Rating component in search filter panel ([#137](https://github.com/shumaiOne/shumai/pull/137))
|
||||
- **upload**: Track byte-level progress with XMLHttpRequest ([#138](https://github.com/shumaiOne/shumai/pull/138))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **transcode**: Handle high-precision FPS using rational fractions ([#123](https://github.com/shumaiOne/shumai/pull/123))
|
||||
- **db**: Automatically update project updatedAt on asset modification ([#129](https://github.com/shumaiOne/shumai/pull/129))
|
||||
- **webui**: Use system colors for fields and improve search filter select options ([#130](https://github.com/shumaiOne/shumai/pull/130))
|
||||
- **search**: Fix hasAny and hasNone operators on metadata filter ([#134](https://github.com/shumaiOne/shumai/pull/134))
|
||||
- **webui**: Resolve folder tree sync, search dialog reset, and sidebar actions issues ([#136](https://github.com/shumaiOne/shumai/pull/136))
|
||||
|
||||
### Changed
|
||||
|
||||
- **webui**: Fix search dialog layout height, scroll areas, and restrict filter toggle click ([#135](https://github.com/shumaiOne/shumai/pull/135))
|
||||
|
||||
## [0.0.7] - 2026-06-17
|
||||
|
||||
### Added
|
||||
|
||||
- **workflow**: Configure transcode and agent concurrency via environment variables ([#116](https://github.com/shumaiOne/shumai/pull/116))
|
||||
- **webui**: Replace hardcoded colors with system tokens ([#119](https://github.com/shumaiOne/shumai/pull/119))
|
||||
- **webui**: Replace native overflow with shadcn ScrollArea in settings ([#120](https://github.com/shumaiOne/shumai/pull/120))
|
||||
- **api**: Use enum for API protocol in provider config ([#121](https://github.com/shumaiOne/shumai/pull/121))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Reload video player and reset state when switching assets ([#114](https://github.com/shumaiOne/shumai/pull/114))
|
||||
|
||||
### Changed
|
||||
|
||||
- **transcode**: Relocate TranscodeService to core and flatten API package ([#115](https://github.com/shumaiOne/shumai/pull/115))
|
||||
|
||||
### Documentation
|
||||
|
||||
- Improve and restructure shumai documentation ([#118](https://github.com/shumaiOne/shumai/pull/118))
|
||||
|
||||
## [0.0.6] - 2026-06-15
|
||||
|
||||
### Added
|
||||
|
||||
- **sandbox**: Add pending domains support for network sandbox ([#109](https://github.com/shumaiOne/shumai/pull/109))
|
||||
- **webui**: Always show right sidebar and implement left vertical carousel ([#111](https://github.com/shumaiOne/shumai/pull/111))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **build**: Propagate termination signals to active child process in wrappers ([#102](https://github.com/shumaiOne/shumai/pull/102))
|
||||
- **transcode**: Make deterministic transcode activity failures non-retryable in Temporal ([#104](https://github.com/shumaiOne/shumai/pull/104))
|
||||
- **player**: Implement seekbar dragging and match hover highlight color ([#108](https://github.com/shumaiOne/shumai/pull/108))
|
||||
- **webui**: Avoid refetching all pages on file/folder reorder ([#112](https://github.com/shumaiOne/shumai/pull/112))
|
||||
- **webui**: Force video-player mime type to video/mp4 ([#113](https://github.com/shumaiOne/shumai/pull/113))
|
||||
|
||||
### Changed
|
||||
|
||||
- **webui**: Use system color design tokens in video player components ([#106](https://github.com/shumaiOne/shumai/pull/106))
|
||||
- **webui**: Use requestAnimationFrame for smooth video progress bar updates ([#107](https://github.com/shumaiOne/shumai/pull/107))
|
||||
- **webui**: Fetch agents in mention input list dynamically ([#110](https://github.com/shumaiOne/shumai/pull/110))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **readme**: Add comprehensive README.md ([#103](https://github.com/shumaiOne/shumai/pull/103))
|
||||
- **readme**: Improve remote deployment and temporal execution instructions ([#105](https://github.com/shumaiOne/shumai/pull/105))
|
||||
|
||||
## [0.0.5] - 2026-06-13
|
||||
|
||||
### Added
|
||||
|
||||
- **npm**: Auto deploy database migrations on package start ([#101](https://github.com/shumaiOne/shumai/pull/101))
|
||||
|
||||
## [0.0.4] - 2026-06-12
|
||||
|
||||
### Fixed
|
||||
|
||||
- **cli/docker**: Resolve global CLI external dependencies and fix Docker 404 error ([#100](https://github.com/shumaiOne/shumai/pull/100))
|
||||
|
||||
## [0.0.3] - 2026-06-12
|
||||
|
||||
### Fixed
|
||||
|
||||
- **cli**: Resolve platform binary path resolution under nested node_modules ([#99](https://github.com/shumaiOne/shumai/pull/99))
|
||||
|
||||
## [0.0.2] - 2026-06-12
|
||||
|
||||
### Fixed
|
||||
|
||||
- **npm**: Add repository metadata to package.json for provenance verification ([#98](https://github.com/shumaiOne/shumai/pull/98))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- Add release-npm.yaml workflow ([#97](https://github.com/shumaiOne/shumai/pull/97))
|
||||
|
||||
## [0.0.1] - 2026-06-12
|
||||
|
||||
### Added
|
||||
|
||||
- Initial release of Shumai
|
||||
+22
-9
@@ -30,11 +30,7 @@ RUN bun run scripts/extract-runtime-deps.ts
|
||||
# Stage 2: Runner
|
||||
FROM oven/bun:1.4.2 AS runner
|
||||
|
||||
# Install ffmpeg/ffprobe
|
||||
COPY --from=mwader/static-ffmpeg:8.1 /ffmpeg /usr/local/bin/
|
||||
COPY --from=mwader/static-ffmpeg:8.1 /ffprobe /usr/local/bin/
|
||||
|
||||
# Install system dependencies for sandbox runtime and agent
|
||||
# Install system dependencies and Jellyfin-FFmpeg (with VA-API support)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
python3 \
|
||||
make \
|
||||
@@ -56,11 +52,26 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
poppler-utils \
|
||||
imagemagick \
|
||||
fonts-noto-cjk \
|
||||
libraw-bin \
|
||||
libimage-exiftool-perl \
|
||||
&& . /etc/os-release \
|
||||
&& TARGETARCH=$(dpkg --print-architecture) \
|
||||
&& FFMPEG_VERSION="8.1.2-5" \
|
||||
&& curl -fsSL -o /tmp/jellyfin-ffmpeg.deb "https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v${FFMPEG_VERSION}/jellyfin-ffmpeg8_${FFMPEG_VERSION}-${VERSION_CODENAME}_${TARGETARCH}.deb" \
|
||||
&& apt-get install -y --no-install-recommends /tmp/jellyfin-ffmpeg.deb \
|
||||
&& rm -f /tmp/jellyfin-ffmpeg.deb \
|
||||
&& ldconfig /usr/lib/jellyfin-ffmpeg/lib \
|
||||
&& ln -sf /usr/lib/jellyfin-ffmpeg/ffmpeg /usr/local/bin/ffmpeg \
|
||||
&& ln -sf /usr/lib/jellyfin-ffmpeg/ffprobe /usr/local/bin/ffprobe \
|
||||
&& ln -sf /usr/lib/jellyfin-ffmpeg/ffmpeg /usr/bin/ffmpeg \
|
||||
&& ln -sf /usr/lib/jellyfin-ffmpeg/ffprobe /usr/bin/ffprobe \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set up working directory and make it owned by the bun user
|
||||
RUN mkdir -p /app/data && chown -R bun:bun /app
|
||||
# Set up working directory and make it owned by the bun user, ensure video/render group access
|
||||
RUN usermod -a -G video,render bun 2>/dev/null || true \
|
||||
&& mkdir -p /app/data \
|
||||
&& chown -R bun:bun /app
|
||||
|
||||
# Switch to the non-root bun user
|
||||
USER bun
|
||||
@@ -83,9 +94,11 @@ USER root
|
||||
COPY scripts/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
# Expose "bun index.js" as "shumai" CLI command (and alias "shuami")
|
||||
# Expose "bun index.js" as "shumai" CLI command (and worker commands "shumai-transcode", "shumai-agent")
|
||||
RUN printf '#!/bin/sh\nexec bun /app/index.js "$@"\n' > /usr/local/bin/shumai \
|
||||
&& chmod +x /usr/local/bin/shumai \
|
||||
&& printf '#!/bin/sh\nexec bun /app/transcode-worker.js "$@"\n' > /usr/local/bin/shumai-transcode \
|
||||
&& printf '#!/bin/sh\nexec bun /app/agent-worker.js "$@"\n' > /usr/local/bin/shumai-agent \
|
||||
&& chmod +x /usr/local/bin/shumai /usr/local/bin/shumai-transcode /usr/local/bin/shumai-agent \
|
||||
&& ln -s /usr/local/bin/shumai /usr/local/bin/shuami
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
#syntax=docker/dockerfile:1.7-labs
|
||||
# Stage 1: Builder
|
||||
FROM oven/bun:1.4.2 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package.json bun.lock ./
|
||||
COPY --parents packages/*/package.json ./
|
||||
COPY --parents apps/*/package.json ./
|
||||
COPY patches/ ./patches/
|
||||
|
||||
# Install dependencies (including devDependencies for build tools)
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build transcode worker bundle
|
||||
RUN bun run build.ts transcode
|
||||
|
||||
# Generate runner-package.json for the runner stage
|
||||
RUN bun run scripts/extract-runtime-deps.ts
|
||||
|
||||
# Stage 2: Runner
|
||||
FROM oven/bun:1.4.2 AS runner
|
||||
|
||||
# Install transcoding system dependencies and Jellyfin-FFmpeg (with VA-API/hardware acceleration support)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
ca-certificates \
|
||||
gosu \
|
||||
poppler-utils \
|
||||
imagemagick \
|
||||
fonts-noto-cjk \
|
||||
libraw-bin \
|
||||
libimage-exiftool-perl \
|
||||
&& . /etc/os-release \
|
||||
&& TARGETARCH=$(dpkg --print-architecture) \
|
||||
&& FFMPEG_VERSION="8.1.2-5" \
|
||||
&& curl -fsSL -o /tmp/jellyfin-ffmpeg.deb "https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v${FFMPEG_VERSION}/jellyfin-ffmpeg8_${FFMPEG_VERSION}-${VERSION_CODENAME}_${TARGETARCH}.deb" \
|
||||
&& apt-get install -y --no-install-recommends /tmp/jellyfin-ffmpeg.deb \
|
||||
&& rm -f /tmp/jellyfin-ffmpeg.deb \
|
||||
&& ldconfig /usr/lib/jellyfin-ffmpeg/lib \
|
||||
&& ln -sf /usr/lib/jellyfin-ffmpeg/ffmpeg /usr/local/bin/ffmpeg \
|
||||
&& ln -sf /usr/lib/jellyfin-ffmpeg/ffprobe /usr/local/bin/ffprobe \
|
||||
&& ln -sf /usr/lib/jellyfin-ffmpeg/ffmpeg /usr/bin/ffmpeg \
|
||||
&& ln -sf /usr/lib/jellyfin-ffmpeg/ffprobe /usr/bin/ffprobe \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set up working directory and make it owned by the bun user, ensure video/render group access
|
||||
RUN usermod -a -G video,render bun 2>/dev/null || true \
|
||||
&& mkdir -p /app/data \
|
||||
&& chown -R bun:bun /app
|
||||
|
||||
# Switch to the non-root bun user
|
||||
USER bun
|
||||
WORKDIR /app
|
||||
|
||||
# Install runtime dependencies with exact matching versions extracted from the builder stage
|
||||
COPY --chown=bun:bun --from=builder /app/runner-package.json ./package.json
|
||||
RUN bun install
|
||||
|
||||
# Copy build artifacts
|
||||
COPY --chown=bun:bun --from=builder /app/dist ./
|
||||
|
||||
# Switch back to root at the end so the container runs the entrypoint as root
|
||||
USER root
|
||||
COPY scripts/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
# Expose "bun transcode-worker.js" as "shumai-transcode" CLI command
|
||||
RUN printf '#!/bin/sh\nexec bun /app/transcode-worker.js "$@"\n' > /usr/local/bin/shumai-transcode \
|
||||
&& chmod +x /usr/local/bin/shumai-transcode
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
# Default command: start transcode worker
|
||||
CMD ["shumai-transcode"]
|
||||
@@ -29,11 +29,14 @@ Shumai is an open-source Frame.io alternative built for creative teams to collab
|
||||
* **Frame-by-Frame Annotations & Comments**: Leave precise feedback with frame-specific drawing tools and timestamped comments on both video and image assets.
|
||||
* **Secure Sharing & Collections**: Create private share links and curated media collections for clients, stakeholders, and collaborators.
|
||||
* **Granular Access Control**: Manage workspace permissions with team-level and project-level role-based access control.
|
||||
* **Distributed Transcoding via Temporal**: Offload resource-intensive video transcoding to a background worker pool orchestrated by Temporal.
|
||||
* **Durable Workflows via DBOS**: Run background tasks and AI agent workflows orchestrated reliably by DBOS on PostgreSQL with automatic recovery and fault tolerance.
|
||||
* **Scalable Deployment on Kubernetes**: Horizontally autoscale video transcoding on multiple instances. See [EKS Deployment Example](eks/README.md).
|
||||
* **Custom Asset Metadata**: Define dynamic metadata fields tailored to your production pipeline.
|
||||
* **Share Link Watermarking**: Protect shared media with customizable text and image watermarks, and save watermark as reusable templates.
|
||||
* **Wide File Format Support**: Preview common creative file formats, including images (with PSD support), videos, audio, and documents, while allowing any file type to be uploaded and stored.
|
||||
* **3D Asset Turntable Previews**: Generate interactive 3D model turntable previews and videos for formats like GLB, FBX, OBJ, STL, USD, and DAE using [turntable-renderer](https://docs.shumai.one/using-shumai/3d-asset-support).
|
||||
* **Office & Document PDF Proxying via Gotenberg**: Convert Word, PowerPoint, Excel, Markdown, HTML, and CSV documents to high-quality PDF proxies for in-browser previewing using [Gotenberg](https://docs.shumai.one/using-shumai/gotenberg).
|
||||
* **Semantic Search**: Find assets by visual or conceptual meaning using vector embeddings. See [documentation](https://docs.shumai.one/using-shumai/semantic-search).
|
||||
* **NLE Export & Premiere Pro Plugin (Experimental)**: Export timestamped review comments to your favorite non-linear editor (Premiere Pro XML, DaVinci Resolve EDL, Final Cut Pro, Avid Media Composer) or use the experimental Premiere Pro UXP plugin to import media assets and auto-sync comments directly to sequence timeline markers. See [documentation](https://docs.shumai.one/using-shumai/nle-and-premiere).
|
||||
|
||||
But Shumai goes beyond being a Frame.io alternative. With modern models like GPT-Image-2 and Seedance 2.5, AI can already handle a surprising amount of creative work. That means you can create or update videos and images from a simple prompt without having to jump back into Photoshop, Premiere or Houdini. That is why Shumai includes a powerful agent system:
|
||||
@@ -46,7 +49,6 @@ But Shumai goes beyond being a Frame.io alternative. With modern models like GPT
|
||||
* **Model Context Protocol (MCP)**: Connect agents to external tools and APIs through remote MCP servers, with OAuth authentication and per-agent MCP access.
|
||||
* **Isolated Sandbox Execution**: Run agent-submitted scripts safely in a sandboxed environment.
|
||||
* **AI Metadata Autofill**: Automatically fill in custom metadata for new assets.
|
||||
* **Semantic Search**: Find assets by visual or conceptual meaning using vector embeddings (Gemini Embedding 2).
|
||||
* **Resource Quotas**: Set usage limits on AI tokens, costs, and tool execution per member, role, or team-wide, with real-time tracking.
|
||||
|
||||
Here is a short demo video showing what the Shumai agent can do:
|
||||
@@ -72,7 +74,7 @@ The ultimate goal is an **agentic Kanban**, where agents and team members can wo
|
||||
|
||||
## Installation
|
||||
|
||||
Below is a quickstart guide for running Shumai with local storage. For advanced configuration options (including S3-compatible storage and Temporal workflow orchestration), see our [Documentation](https://docs.shumai.one/getting-started/overview).
|
||||
Below is a quickstart guide for running Shumai with local storage. For advanced configuration options (including S3-compatible storage and distributed worker orchestration), see our [Documentation](https://docs.shumai.one/getting-started/overview).
|
||||
|
||||
### Option 1: Docker Compose
|
||||
|
||||
@@ -82,10 +84,25 @@ Docker Compose is the fastest way to get Shumai running. You do not need to clon
|
||||
```bash
|
||||
mkdir shumai && cd shumai
|
||||
```
|
||||
2. Download the `docker-compose.yaml` file:
|
||||
```bash
|
||||
curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/docker-compose.yaml
|
||||
```
|
||||
2. Download your preferred `docker-compose.yaml` configuration based on your needs and available RAM:
|
||||
|
||||
* **Lite (Suggested RAM: 2 GB+)**: Minimal deployment containing Shumai and PostgreSQL database.
|
||||
```bash
|
||||
curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/docker-compose.yaml
|
||||
```
|
||||
|
||||
* **With Embedding Server (Suggested RAM: 4 GB+)**: Adds local multimodal semantic search powered by `shumaiOne/embedding-server` (`EmbeddingGemma 2 740M`).
|
||||
```bash
|
||||
curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/docker-compose.embedding.yaml
|
||||
```
|
||||
|
||||
* **Full (Suggested RAM: 8 GB+)**: All-in-one setup including `embedding-server`, `turntable-renderer` (3D previews), and `Gotenberg` (document PDF proxying).
|
||||
```bash
|
||||
curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/docker-compose.full.yaml
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> By default, the Docker Compose setups use CPU software transcoding. If your server has a GPU (NVIDIA NVENC, Intel QuickSync, AMD/Intel VA-API, or Rockchip RKMPP) and you want to enable GPU hardware acceleration, check the [Hardware Transcoding Guide](https://docs.shumai.one/configuration/hardware-transcoding).
|
||||
3. Configure environment variables (optional):
|
||||
|
||||
* `SHUMAI_SERVER_PORT` controls the port the Shumai server listens on. The default is `3000`.
|
||||
@@ -125,188 +142,7 @@ Docker Compose is the fastest way to get Shumai running. You do not need to clon
|
||||
```
|
||||
6. Open your browser and access Shumai at `http://localhost:3000` (or `http://<your-server-ip>:3000` for remote deployments).
|
||||
|
||||
### Option 2: Install via NPM / Package Manager
|
||||
|
||||
Shumai is published as `@shumai-one/shumai` on NPM. This option allows you to run Shumai globally or locally.
|
||||
|
||||
#### Step 1: Start PostgreSQL with pgvector
|
||||
|
||||
Shumai requires PostgreSQL with the `pgvector` extension. Start a pre-configured database container using Docker:
|
||||
|
||||
```bash
|
||||
docker run --name shumai_postgres \
|
||||
-e POSTGRES_USER=shumai \
|
||||
-e POSTGRES_PASSWORD=shumai_password \
|
||||
-e POSTGRES_DB=shumai_db \
|
||||
-p 5432:5432 \
|
||||
-d pgvector/pgvector:pg18
|
||||
```
|
||||
|
||||
#### Step 2: Create a workspace folder
|
||||
|
||||
Create a dedicated directory to store your environment configuration and media files (which are saved in a `./data` directory by default):
|
||||
|
||||
```bash
|
||||
mkdir shumai && cd shumai
|
||||
```
|
||||
|
||||
#### Step 3: Install Platform-Specific Dependencies
|
||||
|
||||
#### Linux
|
||||
|
||||
Shumai requires the following system packages on Linux:
|
||||
|
||||
- **`ffmpeg`** – Used for media transcoding and metadata extraction.
|
||||
- **`poppler`** (`poppler-utils`) – Used for PDF page image extraction and PDF sprite preview generation (`pdftoppm`).
|
||||
- **`imagemagick`** – Used for PSD format transcoding and color profile conversion to sRGB.
|
||||
- **`bubblewrap`**, **`socat`**, and **`ripgrep`** – Required by the AI agent sandbox (`anthropic-experimental/sandbox-runtime`) for process isolation, networking, and workspace search.
|
||||
|
||||
Install all required packages with one command:
|
||||
|
||||
> Ubuntu/Debian
|
||||
```bash
|
||||
sudo apt install -y ffmpeg poppler-utils imagemagick bubblewrap socat ripgrep
|
||||
```
|
||||
|
||||
> Fedora
|
||||
```bash
|
||||
sudo dnf install -y ffmpeg poppler-utils ImageMagick bubblewrap socat ripgrep
|
||||
```
|
||||
|
||||
> Arch Linux
|
||||
```bash
|
||||
sudo pacman -S --noconfirm ffmpeg poppler imagemagick bubblewrap socat ripgrep
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> **Ubuntu 24.04+** restricts unprivileged user namespaces by default. This prevents `anthropic-experimental/sandbox-runtime` from using `bubblewrap` for sandbox isolation.
|
||||
>
|
||||
> To temporarily allow user namespaces:
|
||||
>
|
||||
> ```bash
|
||||
> sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
|
||||
> ```
|
||||
>
|
||||
> Alternatively, configure an AppArmor profile that grants the required `userns` permission to the relevant binaries.
|
||||
|
||||
---
|
||||
|
||||
#### macOS
|
||||
|
||||
Shumai requires:
|
||||
|
||||
- **`ffmpeg`** – Used for media transcoding and metadata extraction.
|
||||
- **`poppler`** – Used for PDF page image extraction and PDF sprite preview generation (`pdftoppm`).
|
||||
- **`imagemagick`** – Used for PSD format transcoding and color profile conversion to sRGB.
|
||||
- **`ripgrep`** – Required by the AI agent sandbox (`anthropic-experimental/sandbox-runtime`).
|
||||
|
||||
Install the required packages with Homebrew:
|
||||
|
||||
```bash
|
||||
brew install ffmpeg poppler imagemagick ripgrep
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Windows (alpha)
|
||||
|
||||
> [!WARNING]
|
||||
> Windows support in anthropic-experimental/sandbox-runtime is **alpha and the design is in flux**.
|
||||
>
|
||||
> The current implementation provides:
|
||||
> - Network egress filtering via the **Windows Filtering Platform (WFP)**.
|
||||
> - File read/write denial via **ACL stamping**.
|
||||
>
|
||||
> However, it is **not a security boundary against a deliberately adversarial sandboxed process**.
|
||||
>
|
||||
> The sandbox implementation will be substantially revised in a future release, where sandboxed processes will run under a dedicated sandbox user account.
|
||||
|
||||
Shumai requires:
|
||||
|
||||
- **`ffmpeg`** – Used for media transcoding and metadata extraction.
|
||||
- **`imagemagick`** – Used for PSD format transcoding and color profile conversion to sRGB.
|
||||
|
||||
Install required packages using your preferred package manager:
|
||||
|
||||
**winget**
|
||||
```powershell
|
||||
winget install Gyan.FFmpeg ImageMagick.ImageMagick
|
||||
```
|
||||
|
||||
**Chocolatey**
|
||||
```powershell
|
||||
choco install ffmpeg imagemagick
|
||||
```
|
||||
|
||||
#### Step 4: Install Shumai globally
|
||||
|
||||
Install Shumai globally using your preferred package manager:
|
||||
|
||||
```bash
|
||||
# NPM
|
||||
npm install -g @shumai-one/shumai
|
||||
|
||||
# PNPM
|
||||
pnpm add -g @shumai-one/shumai
|
||||
|
||||
# Bun
|
||||
bun add -g @shumai-one/shumai
|
||||
```
|
||||
|
||||
#### Step 5: Configure Environment Variables
|
||||
|
||||
Create a `.env` file in your workspace folder (`shumai/`) and add the following configuration:
|
||||
|
||||
```env
|
||||
DATABASE_URL=postgresql://shumai:shumai_password@localhost:5432/shumai_db?schema=public
|
||||
BETTER_AUTH_SECRET=ySxs7DxzHDZBbeeHNPEwBuspYwipBqz5Gk5XdBjNhWw=
|
||||
STORAGE_BACKEND=local
|
||||
SHUMAI_SERVER_PORT=3000
|
||||
AWS_ENDPOINT_URL_S3=http://localhost:3000
|
||||
# Optional: base URL for MCP OAuth redirects (defaults to BETTER_AUTH_URL)
|
||||
MCP_OAUTH_REDIRECT_BASE_URL=http://localhost:3000
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> `SHUMAI_SERVER_PORT` sets the port the server starts on, while `AWS_ENDPOINT_URL_S3` is used by the browser to build file upload URLs.
|
||||
> If deploying on a remote server (e.g. `http://123.456.7.8`) with a mapped port (e.g. `12345:3000` in docker-compose), set `AWS_ENDPOINT_URL_S3` to `http://123.456.7.8:12345`.
|
||||
> `MCP_OAUTH_REDIRECT_BASE_URL` is only needed when MCP servers use OAuth: the authorization redirect URI defaults to `{BETTER_AUTH_URL}/api/mcp/oauth/callback`; set it to an externally reachable URL if the app is served behind a proxy.
|
||||
|
||||
#### Step 6: Run Shumai
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **For Bun Users:** Since the published package binaries contain a `#!/usr/bin/env node` shebang, running the global command directly (e.g., `shumai`) will execute under Node.js. If you installed with Bun and want to run under the Bun runtime, you must prefix all commands with `bun run --bun` (e.g., `bun run --bun shumai`, `bun run --bun shumai -d`, `bun run --bun shumai stop`).
|
||||
|
||||
Start the application from your workspace folder:
|
||||
|
||||
```bash
|
||||
shumai
|
||||
```
|
||||
|
||||
Alternatively, you can run and manage Shumai in daemon mode:
|
||||
|
||||
- **Start in daemon mode**:
|
||||
```bash
|
||||
shumai -d
|
||||
```
|
||||
- **Stop Shumai**:
|
||||
```bash
|
||||
shumai stop
|
||||
```
|
||||
- **Restart Shumai**:
|
||||
```bash
|
||||
shumai restart
|
||||
```
|
||||
- **Show/tail logs**:
|
||||
```bash
|
||||
shumai logs
|
||||
```
|
||||
|
||||
On startup, Shumai will automatically run database migrations and start the web server at `http://localhost:3000`.
|
||||
|
||||
---
|
||||
|
||||
### Option 3: Run from Source (Development)
|
||||
### Option 2: Run from Source (Development)
|
||||
|
||||
To set up Shumai locally for development:
|
||||
|
||||
@@ -316,8 +152,23 @@ To set up Shumai locally for development:
|
||||
cd shumai
|
||||
bun install
|
||||
```
|
||||
2. Start the `pgvector` database container (as described in **Option 2, Step 1**).
|
||||
3. Create a `.env` file at the root of the workspace using the configuration from **Option 2, Step 5**.
|
||||
2. Start the `pgvector` database container:
|
||||
```bash
|
||||
docker run --name shumai_postgres \
|
||||
-e POSTGRES_USER=shumai \
|
||||
-e POSTGRES_PASSWORD=shumai_password \
|
||||
-e POSTGRES_DB=shumai_db \
|
||||
-p 5432:5432 \
|
||||
-d pgvector/pgvector:pg18
|
||||
```
|
||||
3. Create a `.env` file at the root of the workspace:
|
||||
```env
|
||||
DATABASE_URL=postgresql://shumai:shumai_password@localhost:5432/shumai_db?schema=public
|
||||
BETTER_AUTH_SECRET=ySxs7DxzHDZBbeeHNPEwBuspYwipBqz5Gk5XdBjNhWw=
|
||||
STORAGE_BACKEND=local
|
||||
SHUMAI_SERVER_PORT=3000
|
||||
AWS_ENDPOINT_URL_S3=http://localhost:3000
|
||||
```
|
||||
4. Generate i18n translation files:
|
||||
```bash
|
||||
bun run i18n:compile
|
||||
@@ -333,6 +184,9 @@ To set up Shumai locally for development:
|
||||
bun run dev
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Looking to install Shumai globally via NPM or your package manager? See our [NPM Installation Guide](https://docs.shumai.one/getting-started/quickstart).
|
||||
|
||||
---
|
||||
|
||||
## Command Line Interface (CLI)
|
||||
|
||||
+61
-221
@@ -29,11 +29,14 @@ Shumai 是一个开源的 Frame.io 替代方案,专为创意团队打造,让
|
||||
* **逐帧标注和评论**:支持按帧进行精确反馈,可以直接在视频和图片素材上画重点、写评论,还能留下时间戳。
|
||||
* **安全分享和合集管理**:可以生成私密分享链接,也能整理成精选合集,方便给客户、同事和合作方查看。
|
||||
* **细粒度权限控制**:支持按团队、项目设置角色权限,方便管理不同成员的访问范围。
|
||||
* **基于 Temporal 的分布式转码**:把吃资源的视频转码任务交给后台 worker 池处理,由 Temporal 统一调度。
|
||||
* **基于 DBOS 的持久化工作流**:后台任务与 AI 工作流基于 PostgreSQL 由 DBOS 统一持久化编排与调度,具备自动恢复和容错能力。
|
||||
* **Kubernetes 弹性扩缩容部署**:支持在多个实例上横向自动扩缩容视频转码工作负载。详见 [EKS 部署示例](eks/README.md)。
|
||||
* **自定义素材元数据**:可以按你的制作流程,自由定义动态元数据字段。
|
||||
* **分享链接水印**:通过可自定义的文字和图片水印保护共享媒体,并将水印配置保存为模板以便重复使用。
|
||||
* **丰富的文件格式支持**:支持预览常见创意文件格式,包括图片(支持 PSD)、视频、音频和文档,同时可上传和存储任意类型的文件。
|
||||
* **基于转盘渲染服务的 3D 资产预览**:通过集成 [turntable-renderer](https://docs.shumai.one/using-shumai/3d-asset-support) 支持为 GLB、FBX、OBJ、STL、USD 和 DAE 等 3D 模型生成高质量的交互式转盘预览与视频。
|
||||
* **基于 Gotenberg 的文档 PDF 转码代理**:通过集成 [Gotenberg](https://docs.shumai.one/using-shumai/gotenberg) 支持将 Word、PowerPoint、Excel、Markdown、HTML 和 CSV 文档高质量转换为 PDF 代理文件进行在线预览。
|
||||
* **语义搜索**:支持按画面内容或概念含义搜索素材,底层基于向量嵌入技术。详见[相关文档](https://docs.shumai.one/using-shumai/semantic-search)。
|
||||
* **非编剪辑导出与 Premiere 插件(实验性)**:支持将时间戳审阅评论导出至常用非编软件(Premiere Pro XML、DaVinci Resolve EDL、Final Cut Pro、Avid Media Composer),或使用实验性的 Premiere Pro 原生 UXP 插件导入媒体素材并将评论自动同步为时间轴标记。详见[相关文档](https://docs.shumai.one/using-shumai/nle-and-premiere)。
|
||||
|
||||
但 Shumai 不仅仅只满足于 Frame.io 的开源替代。随着 GPT-Image-2、Seedance 2.5 这类强大模型的问世,AI已经生成产品级的图片/视频。很多时候,你只要给一句提示词,就能直接生成或修改图片和视频,而不用再打开 Photoshop、Premiere 或者 Houdini。也正因为这样,Shumai 才把 AI Agent 做成了核心能力:
|
||||
@@ -44,7 +47,6 @@ Shumai 是一个开源的 Frame.io 替代方案,专为创意团队打造,让
|
||||
* **Model Context Protocol (MCP) 支持**:通过远程 MCP 服务端为 Agent 接入外部工具与 API,支持 OAuth 鉴权与按 Agent 独立分配访问权限。
|
||||
* **沙箱隔离执行**:Agent 生成的脚本会在隔离环境里运行,更安全。
|
||||
* **AI 自动补全元数据**:新素材上传后,系统可以自动帮你补一些元数据。
|
||||
* **语义搜索**:支持按画面内容或语义找素材,底层用的是向量 embedding(Gemini Embedding 2)。
|
||||
* **资源配额**:支持按成员、角色或全团队对 AI Token、成本和工具调用设置使用上限与实时用量监控。
|
||||
|
||||
下面是一个简短的 demo 视频,展示了 Shumai Agent 能做什么:
|
||||
@@ -68,7 +70,7 @@ Shumai 也将项目管理融入了创意工作流程。 内置的看板可以帮
|
||||
|
||||
## 安装指南
|
||||
|
||||
以下是使用本地存储运行 Shumai 的快速上手指南。如需了解高级配置(包括 S3 兼容存储配置、Temporal 工作流编排等),请参阅我们的[官方文档](https://docs.shumai.one/getting-started/overview)。
|
||||
以下是使用本地存储运行 Shumai 的快速上手指南。如需了解高级配置(包括 S3 兼容存储配置、分布式 worker 编排等),请参阅我们的[官方文档](https://docs.shumai.one/getting-started/overview)。
|
||||
|
||||
### 方案一:使用 Docker Compose(推荐)
|
||||
<details>
|
||||
@@ -98,11 +100,25 @@ https://gh-proxy.com/https://raw.githubusercontent.com/shumaiOne/shumai/main/REA
|
||||
|
||||
```
|
||||
|
||||
2. 下载 `docker-compose.yaml` 配置文件:
|
||||
```bash
|
||||
curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/docker-compose-aliyun.yaml
|
||||
2. 根据您的需求和机器可用内存,下载对应的 `docker-compose.yaml` 配置文件:
|
||||
|
||||
```
|
||||
* **精简版(建议内存:2 GB+)**:包含 Shumai 核心应用与 PostgreSQL 数据库。
|
||||
```bash
|
||||
curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/docker-compose-aliyun.yaml
|
||||
```
|
||||
|
||||
* **含嵌入向量服务版(建议内存:4 GB+)**:新增基于 `shumaiOne/embedding-server` (`EmbeddingGemma 2 740M`) 的本地多模态语义搜索能力。
|
||||
```bash
|
||||
curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/docker-compose-aliyun.embedding.yaml
|
||||
```
|
||||
|
||||
* **完整版(建议内存:8 GB+)**:一站式全功能套件,包含 `embedding-server`、`turntable-renderer`(3D 模型交互转盘预览)与 `Gotenberg`(文档与表格 PDF 代理转码)。
|
||||
```bash
|
||||
curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/docker-compose-aliyun.full.yaml
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> 默认的 Docker Compose 配置使用基于 CPU 的软件转码。如果您的服务器配备了支持的显卡(NVIDIA NVENC、Intel QuickSync、AMD/Intel VA-API 或 Rockchip RKMPP)并需要开启 GPU 硬件加速转码,请参考 [硬件加速转码配置文档](https://docs.shumai.one/configuration/hardware-transcoding)。
|
||||
|
||||
|
||||
3. 配置环境变量(可选):
|
||||
@@ -149,231 +165,55 @@ https://gh-proxy.com/https://raw.githubusercontent.com/shumaiOne/shumai/main/REA
|
||||
|
||||
5. 打开浏览器,访问 `http://localhost:3000` 即可开始使用(若是远程部署,请访问 `http://<您的服务器IP>:3000`)。
|
||||
|
||||
### 方案二:通过 NPM / 包管理器安装
|
||||
|
||||
通过 NPM 上的 `@shumai-one/shumai` 进行安装。
|
||||
|
||||
#### 第一步:启动带 pgvector 支持的 PostgreSQL
|
||||
|
||||
Shumai 依赖支持 `pgvector` 扩展的 PostgreSQL 数据库。您可以使用 Docker 快速启动一个预配置好的数据库容器:
|
||||
|
||||
```bash
|
||||
docker run --name shumai_postgres \
|
||||
-e POSTGRES_USER=shumai \
|
||||
-e POSTGRES_PASSWORD=shumai_password \
|
||||
-e POSTGRES_DB=shumai_db \
|
||||
-p 5432:5432 \
|
||||
-d docker.m.daocloud.io/pgvector/pgvector:pg18
|
||||
|
||||
```
|
||||
|
||||
#### 第二步:创建工作区目录
|
||||
|
||||
创建一个专属目录用来存放环境配置和媒体文件(媒体文件默认会保存在 `./data` 目录下):
|
||||
|
||||
```bash
|
||||
mkdir shumai && cd shumai
|
||||
|
||||
```
|
||||
|
||||
#### 步骤 3:安装平台依赖
|
||||
|
||||
#### Linux
|
||||
|
||||
在 Linux 上运行 Shumai 需要安装以下系统依赖:
|
||||
|
||||
- **`ffmpeg`** —— 用于媒体转码和元数据提取。
|
||||
- **`poppler`** (`poppler-utils`) —— 用于 PDF 页面图像提取和 PDF 雪碧图预览生成 (`pdftoppm`)。
|
||||
- **`imagemagick`** —— 用于 PSD 格式图像转码和 sRGB 色彩空间转换。
|
||||
- **`bubblewrap`**、**`socat`** 和 **`ripgrep`** —— AI Agent 沙箱(`anthropic-experimental/sandbox-runtime`)所需,用于进程隔离、网络通信和工作区搜索。
|
||||
|
||||
可以使用以下命令一次性安装所有依赖:
|
||||
|
||||
> Ubuntu/Debian
|
||||
```bash
|
||||
sudo apt install -y ffmpeg poppler-utils imagemagick bubblewrap socat ripgrep
|
||||
```
|
||||
|
||||
> Fedora
|
||||
```bash
|
||||
sudo dnf install -y ffmpeg poppler-utils ImageMagick bubblewrap socat ripgrep
|
||||
```
|
||||
|
||||
> Arch Linux
|
||||
```bash
|
||||
sudo pacman -S --noconfirm ffmpeg poppler imagemagick bubblewrap socat ripgrep
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> **Ubuntu 24.04+** 默认限制非特权用户创建 User Namespace,这会导致 `anthropic-experimental/sandbox-runtime` 无法使用 `bubblewrap` 提供沙箱隔离。
|
||||
>
|
||||
> 如需临时启用 User Namespace,请执行:
|
||||
>
|
||||
> ```bash
|
||||
> sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
|
||||
> ```
|
||||
>
|
||||
> 或者,配置 AppArmor Profile,为相关可执行文件授予所需的 `userns` 权限。
|
||||
|
||||
---
|
||||
|
||||
#### macOS
|
||||
|
||||
在 macOS 上运行 Shumai 需要:
|
||||
|
||||
- **`ffmpeg`** —— 用于媒体转码和元数据提取。
|
||||
- **`poppler`** —— 用于 PDF 页面图像提取和 PDF 雪碧图预览生成 (`pdftoppm`)。
|
||||
- **`imagemagick`** —— 用于 PSD 格式图像转码和 sRGB 色彩空间转换。
|
||||
- **`ripgrep`** —— AI Agent 沙箱(`anthropic-experimental/sandbox-runtime`)所需。
|
||||
|
||||
使用 Homebrew 安装所需依赖:
|
||||
|
||||
```bash
|
||||
brew install ffmpeg poppler imagemagick ripgrep
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Windows(Alpha)
|
||||
|
||||
> [!WARNING]
|
||||
> anthropic-experimental/sandbox-runtime 的 Windows 支持目前仍处于 **Alpha** 阶段,整体设计仍在持续调整中。
|
||||
>
|
||||
> 当前实现提供了以下能力:
|
||||
> - 通过 **Windows Filtering Platform (WFP)** 实现网络出口(egress)过滤。
|
||||
> - 通过 **ACL Stamping** 实现文件读写权限限制。
|
||||
>
|
||||
> **但这并不能作为针对恶意沙箱进程的安全边界(security boundary)**。
|
||||
>
|
||||
> 未来版本将对沙箱机制进行重大调整,届时沙箱进程将运行在独立的沙箱用户账户下。
|
||||
|
||||
在 Windows 上运行 Shumai 需要:
|
||||
|
||||
- **`ffmpeg`** —— 用于媒体转码和元数据提取。
|
||||
- **`imagemagick`** —— 用于 PSD 格式图像转码和 sRGB 色彩空间转换。
|
||||
|
||||
使用你偏好的包管理器安装所需依赖:
|
||||
|
||||
**winget**
|
||||
```powershell
|
||||
winget install Gyan.FFmpeg ImageMagick.ImageMagick
|
||||
```
|
||||
|
||||
**Chocolatey**
|
||||
```powershell
|
||||
choco install ffmpeg imagemagick
|
||||
```
|
||||
|
||||
#### 第四步:全局安装 Shumai
|
||||
|
||||
使用您常用的包管理器进行全局安装:
|
||||
|
||||
```bash
|
||||
# 使用 NPM
|
||||
npm install -g @shumai-one/shumai
|
||||
|
||||
# 使用 PNPM
|
||||
pnpm add -g @shumai-one/shumai
|
||||
|
||||
# 使用 Bun
|
||||
bun add -g @shumai-one/shumai
|
||||
|
||||
```
|
||||
|
||||
#### 第五步:配置环境配置
|
||||
|
||||
在刚才创建的工作区目录(`shumai/`)下新建一个 `.env` 文件,并填入以下配置:
|
||||
|
||||
```env
|
||||
DATABASE_URL=postgresql://shumai:shumai_password@localhost:5432/shumai_db?schema=public
|
||||
BETTER_AUTH_SECRET=ySxs7DxzHDZBbeeHNPEwBuspYwipBqz5Gk5XdBjNhWw=
|
||||
STORAGE_BACKEND=local
|
||||
SHUMAI_SERVER_PORT=3000
|
||||
AWS_ENDPOINT_URL_S3=http://localhost:3000
|
||||
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> `SHUMAI_SERVER_PORT` 用于设置 Web 服务的启动端口,而 `AWS_ENDPOINT_URL_S3` 供浏览器端构建文件上传链接。
|
||||
> 如果您部署在远程服务器(如 `http://123.456.7.8`)并且做了端口映射(如 Docker 中的 `12345:3000`),请将 `AWS_ENDPOINT_URL_S3` 设置为 `http://123.456.7.8:12345`。
|
||||
|
||||
#### 第六步:启动 Shumai
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Bun 用户特别提示:** 由于发布的包二进制文件包含 `#!/usr/bin/env node` 头部声明(Shebang),直接在终端执行全局命令(例如 `shumai`)默认会通过 Node.js 运行。如果您是用 Bun 安装的并且希望调用 Bun 运行时,请在所有命令前加上 `bun run --bun` 前缀(例如:`bun run --bun shumai`、`bun run --bun shumai -d`、`bun run --bun shumai stop`)。
|
||||
|
||||
在您的工作区目录下执行以下命令启动应用:
|
||||
|
||||
```bash
|
||||
shumai
|
||||
|
||||
```
|
||||
|
||||
您也可以让 Shumai 在后台以守护进程(Daemon)模式运行和管理:
|
||||
|
||||
* **后台模式启动**:
|
||||
```bash
|
||||
shumai -d
|
||||
|
||||
```
|
||||
|
||||
|
||||
* **停止服务**:
|
||||
```bash
|
||||
shumai stop
|
||||
|
||||
```
|
||||
|
||||
|
||||
* **重启服务**:
|
||||
```bash
|
||||
shumai restart
|
||||
|
||||
```
|
||||
|
||||
|
||||
* **查看并跟踪实时日志**:
|
||||
```bash
|
||||
shumai logs
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
启动时,Shumai 会自动执行数据库迁移(Migration)并在 `http://localhost:3000` 拉起 Web 服务。
|
||||
|
||||
---
|
||||
|
||||
### 方案三:源码编译运行(开发环境)
|
||||
### 方案二:源码编译运行(开发环境)
|
||||
|
||||
如果您希望在本地参与 Shumai 的开发,请按以下步骤配置开发环境:
|
||||
|
||||
1. 克隆代码仓库并安装依赖项:
|
||||
```bash
|
||||
git clone [https://github.com/shumaiOne/shumai.git](https://github.com/shumaiOne/shumai.git)
|
||||
cd shumai
|
||||
bun install
|
||||
```bash
|
||||
git clone https://github.com/shumaiOne/shumai.git
|
||||
cd shumai
|
||||
bun install
|
||||
```
|
||||
|
||||
```
|
||||
2. 启动 `pgvector` 数据库容器:
|
||||
```bash
|
||||
docker run --name shumai_postgres \
|
||||
-e POSTGRES_USER=shumai \
|
||||
-e POSTGRES_PASSWORD=shumai_password \
|
||||
-e POSTGRES_DB=shumai_db \
|
||||
-p 5432:5432 \
|
||||
-d docker.m.daocloud.io/pgvector/pgvector:pg18
|
||||
```
|
||||
|
||||
3. 在项目根目录下创建一个 `.env` 文件,填入以下基础配置:
|
||||
```env
|
||||
DATABASE_URL=postgresql://shumai:shumai_password@localhost:5432/shumai_db?schema=public
|
||||
BETTER_AUTH_SECRET=ySxs7DxzHDZBbeeHNPEwBuspYwipBqz5Gk5XdBjNhWw=
|
||||
STORAGE_BACKEND=local
|
||||
SHUMAI_SERVER_PORT=3000
|
||||
AWS_ENDPOINT_URL_S3=http://localhost:3000
|
||||
```
|
||||
|
||||
2. 启动 `pgvector` 数据库容器(参考**方案二中的第一步**)。
|
||||
3. 参照**方案二中的第五步**,在项目根目录下创建一个 `.env` 文件。
|
||||
4. 生成多语言国际化(i18n)代码:
|
||||
```bash
|
||||
bun run i18n:compile
|
||||
```
|
||||
> [!TIP]
|
||||
> 在前端开发过程中,可以在单独的终端窗口中运行 `bun run i18n:watch`,在修改 `packages/webui/messages/` 下的翻译文案时自动重新编译。
|
||||
```bash
|
||||
bun run i18n:compile
|
||||
```
|
||||
> [!TIP]
|
||||
> 在前端开发过程中,可以在单独的终端窗口中运行 `bun run i18n:watch`,在修改 `packages/webui/messages/` 下的翻译文案时自动重新编译。
|
||||
|
||||
5. 执行数据库结构迁移:
|
||||
```bash
|
||||
bun run db:migrate
|
||||
```
|
||||
```bash
|
||||
bun run db:migrate
|
||||
```
|
||||
|
||||
6. 启动本地开发服务器:
|
||||
```bash
|
||||
bun run dev
|
||||
```
|
||||
```bash
|
||||
bun run dev
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> 如需通过 NPM 或包管理器全局安装运行 Shumai,请参考[官方 NPM 安装指南](https://docs.shumai.one/getting-started/quickstart)。
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/agent-app",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
+1
-10
@@ -21,16 +21,7 @@ async function run() {
|
||||
|
||||
console.log('🚀 Starting Agent Worker...')
|
||||
|
||||
const options: { workflowBundle?: unknown; workflowsPath?: string } = {}
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
// @ts-ignore: Bun temporal plugin macro
|
||||
const { default: workflowBundle } = await import('./workflows.ts:::workflow')
|
||||
options.workflowBundle = workflowBundle
|
||||
} else {
|
||||
options.workflowsPath = new URL('./workflows.ts', import.meta.url).pathname
|
||||
}
|
||||
|
||||
await workflowService.startWorkers(TaskQueueAgent, options)
|
||||
await workflowService.startWorkers(TaskQueueAgent)
|
||||
}
|
||||
|
||||
handleDaemonCommands('shumai-agent', run).catch((err) => {
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export * from '@shumai/agent/src/workflows/agent-autofill'
|
||||
export * from '@shumai/agent/src/workflows/agent-chat'
|
||||
export * from '@shumai/agent/src/workflows/agent-embedding'
|
||||
export * from '@shumai/agent/src/workflows/query-embedding-for-search'
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/cli",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/premiere-uxp",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"private": true,
|
||||
"type": "commonjs",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/transcode-app",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -14,18 +14,85 @@ async function run() {
|
||||
// Initialize workflows and activities
|
||||
initTranscodeWorkflows()
|
||||
|
||||
console.log('🚀 Starting Transcode Worker...')
|
||||
let idleTimeoutMs = process.env.SHUMAI_WORKER_IDLE_TIMEOUT_MS
|
||||
? parseInt(process.env.SHUMAI_WORKER_IDLE_TIMEOUT_MS, 10)
|
||||
: 0
|
||||
|
||||
const options: { workflowBundle?: unknown; workflowsPath?: string } = {}
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
// @ts-ignore: Bun temporal plugin macro
|
||||
const { default: workflowBundle } = await import('./workflows.ts:::workflow')
|
||||
options.workflowBundle = workflowBundle
|
||||
} else {
|
||||
options.workflowsPath = new URL('./workflows.ts', import.meta.url).pathname
|
||||
const idleTimeoutArg = process.argv.find((arg) => arg.startsWith('--idle-timeout='))
|
||||
if (idleTimeoutArg) {
|
||||
const val = parseInt(idleTimeoutArg.split('=')[1], 10)
|
||||
if (!isNaN(val)) idleTimeoutMs = val
|
||||
}
|
||||
|
||||
await workflowService.startWorkers(TaskQueueTranscode, options)
|
||||
if (idleTimeoutMs > 0) {
|
||||
console.log(
|
||||
`🚀 Starting Transcode Worker with idle timeout (${idleTimeoutMs / 1000}s auto-drain)...`,
|
||||
)
|
||||
} else {
|
||||
console.log('🚀 Starting Transcode Worker (persistent daemon mode)...')
|
||||
}
|
||||
|
||||
await workflowService.startWorkers(TaskQueueTranscode)
|
||||
|
||||
let isShuttingDown = false
|
||||
let idleTimer: Timer | null = null
|
||||
let activeWorkflows = 0
|
||||
|
||||
const shutdown = async () => {
|
||||
if (isShuttingDown) return
|
||||
isShuttingDown = true
|
||||
if (idleTimer) {
|
||||
clearTimeout(idleTimer)
|
||||
idleTimer = null
|
||||
}
|
||||
console.log('Shutting down Transcode Worker gracefully...')
|
||||
try {
|
||||
await workflowService.shutdownWorkers()
|
||||
} catch (err) {
|
||||
console.error('Error during Transcode Worker shutdown:', err)
|
||||
}
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
if (idleTimeoutMs > 0) {
|
||||
const resetIdleTimer = () => {
|
||||
if (idleTimer) {
|
||||
clearTimeout(idleTimer)
|
||||
idleTimer = null
|
||||
}
|
||||
if (activeWorkflows === 0 && !isShuttingDown) {
|
||||
idleTimer = setTimeout(async () => {
|
||||
console.log(
|
||||
`[Transcode Worker] Inactive for ${idleTimeoutMs / 1000}s with no active workflows, shutting down.`,
|
||||
)
|
||||
await shutdown()
|
||||
}, idleTimeoutMs)
|
||||
}
|
||||
}
|
||||
|
||||
// Start idle timer immediately on startup in case no tasks are enqueued
|
||||
resetIdleTimer()
|
||||
|
||||
workflowService.getExecutor().on('workflowStarted', (task) => {
|
||||
activeWorkflows++
|
||||
console.log(
|
||||
`[Transcode Worker] Claimed task ${task.id} (active: ${activeWorkflows}), cancelling idle timer.`,
|
||||
)
|
||||
if (idleTimer) {
|
||||
clearTimeout(idleTimer)
|
||||
idleTimer = null
|
||||
}
|
||||
})
|
||||
|
||||
workflowService.getExecutor().on('workflowFinished', async ({ taskId }) => {
|
||||
activeWorkflows = Math.max(0, activeWorkflows - 1)
|
||||
console.log(`[Transcode Worker] Completed task ${taskId} (active: ${activeWorkflows}).`)
|
||||
resetIdleTimer()
|
||||
})
|
||||
}
|
||||
|
||||
process.on('SIGINT', shutdown)
|
||||
process.on('SIGTERM', shutdown)
|
||||
}
|
||||
|
||||
handleDaemonCommands('shumai-transcode', run).catch((err) => {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export * from '@shumai/transcode/src/workflows/transcode'
|
||||
@@ -73,6 +73,8 @@ apps/web/e2e/
|
||||
| Owner creates a project with a cover image | `tests/project/create-project.spec.ts` |
|
||||
| Owner uploads a file or an unsupported file via the "Upload File" context menu action | `tests/project/upload-file.spec.ts` |
|
||||
| Owner deletes a file, finds it in recently deleted, and restores it | `tests/project/delete-restore.spec.ts` |
|
||||
| Owner deletes a folder and still sees its contents preview and countdown in recently deleted | `tests/project/delete-restore.spec.ts` |
|
||||
| Owner deletes a version stack and restores it from recently deleted | `tests/project/delete-restore.spec.ts` |
|
||||
| Owner creates a share link from a file context menu and lands on the share page | `tests/project/create-share-link.spec.ts` |
|
||||
| Owner protects a share with a password; guests must enter it to view | `tests/project/share-password.spec.ts` |
|
||||
| Owner creates a collection from the sidebar; the collection shows project files | `tests/project/create-collection.spec.ts` |
|
||||
@@ -103,6 +105,8 @@ apps/web/e2e/
|
||||
| Upload an image file, wait for transcode, and create a comment with draw | `tests/file/image-draw-comment.spec.ts` |
|
||||
| Upload a video file, wait for transcode, and create a comment with draw at a non-zero timestamp | `tests/file/video-draw-comment.spec.ts` |
|
||||
| Upload an audio file, wait for transcode, and create a comment at a non-zero timestamp | `tests/file/audio-timestamp-comment.spec.ts` |
|
||||
| Show a breathing poster preview and "Preparing..." while a video is still transcoding | `tests/file/processing-preview.spec.ts` |
|
||||
| Show a preparing circle before the poster is generated | `tests/file/processing-preview.spec.ts` |
|
||||
|
||||
## Conventions
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ async function start() {
|
||||
process.env.BETTER_AUTH_URL = 'http://localhost:5200'
|
||||
process.env.NODE_ENV = 'development'
|
||||
process.env.SHUMAI_E2E = 'true'
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'false'
|
||||
|
||||
// Write variables to .env.e2e file so the teardown can load them
|
||||
const envContent = [`DATABASE_URL=${process.env.DATABASE_URL}`, `S3_BUCKET=${bucketName}`].join(
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
import { expect, test } from '../../fixtures'
|
||||
import { fileCard } from '../../helpers/files'
|
||||
|
||||
// Uploaded as a binary file so no real transcode task races with the simulated mid-transcode
|
||||
// state we set up directly in the database.
|
||||
test.use({ fileOptions: { mediaType: 'binary' } })
|
||||
|
||||
test('shows the poster preview and "Preparing..." while a video is still transcoding', async ({
|
||||
file,
|
||||
prisma,
|
||||
}) => {
|
||||
const { page, projectId, fileId, fileName } = file
|
||||
|
||||
// Simulate a video that is mid-transcode: the poster/sprite preview already exists, but the
|
||||
// asset is still marked as processing.
|
||||
const assetDir = `files/e2e/${fileId}`
|
||||
await prisma.asset.update({
|
||||
where: { id: fileId },
|
||||
data: {
|
||||
status: 'processing',
|
||||
mediaType: 'video/mp4',
|
||||
media: {
|
||||
duration: 10,
|
||||
filesize: 0,
|
||||
frames: 300,
|
||||
proxyType: 'video',
|
||||
imageTranscodes: [],
|
||||
videoTranscodes: [],
|
||||
sprite: { key: `${assetDir}/sprite.webp`, frames: 100, tileX: 10, tileY: 10 },
|
||||
poster: { key: `${assetDir}/poster.webp` },
|
||||
finishedAt: new Date().toISOString(),
|
||||
metadata: {
|
||||
originalWidth: 1920,
|
||||
originalHeight: 1080,
|
||||
hasAudio: false,
|
||||
duration: 10,
|
||||
bitRate: 0,
|
||||
frameRate: 30,
|
||||
totalFrames: 300,
|
||||
startTimecode: '00:00:00:00',
|
||||
format: {},
|
||||
},
|
||||
original: { key: `${assetDir}/original.mp4`, filesizeInBytes: 0, codec: '' },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await page.goto(`/projects/${projectId}`)
|
||||
|
||||
const card = fileCard(page, fileName)
|
||||
await expect(card).toBeVisible()
|
||||
|
||||
// The preview (poster thumbnail used as the sprite scrubber base) is rendered instead of a
|
||||
// blank placeholder, and its opacity breathes while transcoding is in progress.
|
||||
await expect(card.locator('img[alt="Thumbnail"]')).toBeVisible()
|
||||
await expect(card.getByTestId('file-card-preview-media')).toHaveClass(/animate-pulse/)
|
||||
|
||||
// The creator row is replaced by a "Preparing..." label while transcoding.
|
||||
await expect(card.getByText(/Preparing|准备中/i)).toBeVisible()
|
||||
|
||||
// The duration badge is hidden until the asset is ready.
|
||||
await expect(card.getByText('00:10')).toHaveCount(0)
|
||||
})
|
||||
|
||||
test('shows a preparing circle before the poster is generated', async ({ file, prisma }) => {
|
||||
const { page, projectId, fileId, fileName } = file
|
||||
|
||||
// Simulate an asset whose upload finished but whose poster does not exist yet.
|
||||
await prisma.asset.update({
|
||||
where: { id: fileId },
|
||||
data: { status: 'processing', mediaType: 'video/mp4' },
|
||||
})
|
||||
|
||||
await page.goto(`/projects/${projectId}`)
|
||||
|
||||
const card = fileCard(page, fileName)
|
||||
await expect(card).toBeVisible()
|
||||
|
||||
// A size-breathing circle stands in until the poster is available, with a "Preparing..." label.
|
||||
await expect(card.getByTestId('file-card-preparing-circle')).toBeVisible()
|
||||
await expect(card.getByText(/Preparing|准备中/i)).toBeVisible()
|
||||
})
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from '../../fixtures'
|
||||
import { seedFile, seedFolder } from '../../helpers/assets'
|
||||
import { fileCard } from '../../helpers/files'
|
||||
|
||||
test('owner deletes a file, finds it in recently deleted, and restores it', async ({
|
||||
@@ -43,3 +44,121 @@ test('owner deletes a file, finds it in recently deleted, and restores it', asyn
|
||||
await page.goto(`/projects/${projectId}`)
|
||||
await expect(fileCard(page, fileName)).toBeVisible()
|
||||
})
|
||||
|
||||
test('owner deletes a folder and still sees its contents preview and countdown in recently deleted', async ({
|
||||
project,
|
||||
prisma,
|
||||
}) => {
|
||||
const { page, projectId, rootFolderId } = project
|
||||
const folderName = `e2e-deleted-folder-${Date.now()}`
|
||||
|
||||
const folder = await seedFolder(prisma, projectId, rootFolderId, folderName)
|
||||
await seedFile(prisma, projectId, folder.id, 'inside-1.png')
|
||||
await seedFile(prisma, projectId, folder.id, 'inside-2.png')
|
||||
|
||||
await page.goto(`/projects/${projectId}`)
|
||||
await expect(fileCard(page, folderName)).toBeVisible()
|
||||
|
||||
// Delete the folder through the context menu + confirmation dialog
|
||||
await fileCard(page, folderName).click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click()
|
||||
|
||||
const deleteDialog = page.getByRole('alertdialog')
|
||||
await expect(deleteDialog.getByText('Delete Asset?')).toBeVisible()
|
||||
await deleteDialog.getByRole('button', { name: 'Delete' }).click()
|
||||
await expect(fileCard(page, folderName)).not.toBeVisible()
|
||||
|
||||
// Navigate to the Recently Deleted view
|
||||
await page.getByText('Recently Deleted').click()
|
||||
await expect(page).toHaveURL(/\/recently-deleted/)
|
||||
|
||||
const deletedFolderCard = fileCard(page, folderName)
|
||||
await expect(deletedFolderCard).toBeVisible()
|
||||
// The folder still shows previews of the files that were deleted with it
|
||||
await expect(deletedFolderCard.getByTestId('folder-preview-grid')).toBeVisible()
|
||||
// And each item shows how many days are left before permanent deletion
|
||||
await expect(deletedFolderCard.getByTestId('folder-card-days-left')).toHaveText(/30\s*(d|天)/)
|
||||
})
|
||||
|
||||
test('owner deletes a version stack and restores it from recently deleted', async ({
|
||||
project,
|
||||
prisma,
|
||||
}) => {
|
||||
const { page, projectId, rootFolderId } = project
|
||||
const latestVersionName = `e2e-stack-latest-${Date.now()}.png`
|
||||
const olderVersionName = `e2e-stack-older-${Date.now()}.png`
|
||||
|
||||
const stack = await prisma.asset.create({
|
||||
data: {
|
||||
name: `e2e-stack-${Date.now()}`,
|
||||
type: 'version_stack',
|
||||
status: 'processed',
|
||||
projectId,
|
||||
parentId: rootFolderId,
|
||||
fileCount: 2,
|
||||
sizeByte: 20,
|
||||
},
|
||||
})
|
||||
await prisma.asset.create({
|
||||
data: {
|
||||
name: latestVersionName,
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
sizeByte: 10,
|
||||
sortIndex: 'a0',
|
||||
projectId,
|
||||
parentId: stack.id,
|
||||
},
|
||||
})
|
||||
await prisma.asset.create({
|
||||
data: {
|
||||
name: olderVersionName,
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
sizeByte: 10,
|
||||
sortIndex: 'a1',
|
||||
projectId,
|
||||
parentId: stack.id,
|
||||
},
|
||||
})
|
||||
|
||||
// The stack card is labelled with its latest version's name
|
||||
await page.goto(`/projects/${projectId}`)
|
||||
await expect(fileCard(page, latestVersionName)).toBeVisible()
|
||||
|
||||
await fileCard(page, latestVersionName).click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click()
|
||||
|
||||
const deleteDialog = page.getByRole('alertdialog')
|
||||
await expect(deleteDialog.getByText('Delete Asset?')).toBeVisible()
|
||||
await deleteDialog.getByRole('button', { name: 'Delete' }).click()
|
||||
await expect(fileCard(page, latestVersionName)).not.toBeVisible()
|
||||
|
||||
// The whole stack is soft-deleted, including its versions
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const row = await prisma.asset.findUnique({ where: { id: stack.id } })
|
||||
return row?.isDeleted
|
||||
})
|
||||
.toBe(true)
|
||||
|
||||
// Restore it from the Recently Deleted view
|
||||
await page.getByText('Recently Deleted').click()
|
||||
await expect(page).toHaveURL(/\/recently-deleted/)
|
||||
await expect(fileCard(page, latestVersionName)).toBeVisible()
|
||||
|
||||
await fileCard(page, latestVersionName).click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Restore' }).click()
|
||||
await expect(fileCard(page, latestVersionName)).not.toBeVisible()
|
||||
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const row = await prisma.asset.findUnique({ where: { id: stack.id } })
|
||||
return row?.isDeleted
|
||||
})
|
||||
.toBe(false)
|
||||
|
||||
// Back at the project root the stack is visible again
|
||||
await page.goto(`/projects/${projectId}`)
|
||||
await expect(fileCard(page, latestVersionName)).toBeVisible()
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/web-app",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
|
||||
+53
-22
@@ -12,10 +12,13 @@ import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
import { initTranscodeWorkflows } from '@shumai/transcode'
|
||||
import { workflowService } from '@shumai/workflow-core'
|
||||
import { migrateLegacyAgentAvatars } from '@shumai/core/src/agent/migration'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
|
||||
import { handleDaemonCommands } from '@shumai/core/src/utils/daemon'
|
||||
import { authService } from '@shumai/core/src/auth/auth'
|
||||
import { embeddingService } from '@shumai/core/src/search/embedding-service'
|
||||
import { sandboxService } from '@shumai/core'
|
||||
import { notificationJobService } from '@shumai/core/src/notification/notification-job'
|
||||
|
||||
if (process.argv.includes('--check')) {
|
||||
console.log('✅ Web app evaluated successfully!')
|
||||
@@ -46,6 +49,32 @@ if (resetCmdIndex !== -1) {
|
||||
}
|
||||
}
|
||||
|
||||
const regenCmdIndex = cliArgs.findIndex((arg) => arg === 'regenerate-embeddings')
|
||||
|
||||
if (regenCmdIndex !== -1) {
|
||||
try {
|
||||
initAgentWorkflows()
|
||||
initTranscodeWorkflows()
|
||||
console.log('🔄 Regenerating embeddings...')
|
||||
const result = await embeddingService.regenerateEmbeddings()
|
||||
await workflowService.waitForPendingSubmissions()
|
||||
console.log(
|
||||
`✅ Successfully queued ${result.tasksCreated} embedding tasks for ${result.totalAssets} assets.`,
|
||||
)
|
||||
if (result.skippedTeams.length > 0) {
|
||||
console.warn(
|
||||
`⚠️ Skipped ${result.skippedTeams.length} team(s) without an active embedding agent.`,
|
||||
)
|
||||
}
|
||||
console.log('The background workers will process the embedding tasks.')
|
||||
process.exit(0)
|
||||
} catch (err: unknown) {
|
||||
const message = err instanceof Error ? err.message : 'Unknown error'
|
||||
console.error(`Error: ${message}`)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
async function run() {
|
||||
// Initialize workflows and activities for local executor mode
|
||||
initAgentWorkflows()
|
||||
@@ -57,31 +86,31 @@ async function run() {
|
||||
// Start services
|
||||
await metadataService.syncSystemFields().catch(console.error)
|
||||
await migrateLegacyAgentAvatars().catch(console.error)
|
||||
await agentService.ensureSystemEmbeddingAgents().catch(console.error)
|
||||
assetService.startCleanupJob()
|
||||
workflowService.start()
|
||||
if (process.env.WORKFLOW_EXECUTOR === 'temporal') {
|
||||
const args = process.argv.slice(2)
|
||||
let workersOption = ''
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
if (args[i] === '--workers') {
|
||||
workersOption = args[i + 1] || ''
|
||||
} else if (args[i].startsWith('--workers=')) {
|
||||
workersOption = args[i].split('=')[1]
|
||||
}
|
||||
notificationJobService.start()
|
||||
const args = process.argv.slice(2)
|
||||
let workersOption = process.env.SHUMAI_WORKERS || 'all'
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
if (args[i] === '--workers') {
|
||||
workersOption = args[i + 1] || workersOption
|
||||
} else if (args[i].startsWith('--workers=')) {
|
||||
workersOption = args[i].split('=')[1] || workersOption
|
||||
}
|
||||
|
||||
const queuesToStart: string[] = []
|
||||
if (workersOption === 'agent' || workersOption === 'ai') {
|
||||
queuesToStart.push('agent_queue')
|
||||
} else if (workersOption === 'transcode') {
|
||||
queuesToStart.push('transcode_queue')
|
||||
} else if (workersOption === 'all') {
|
||||
queuesToStart.push('agent_queue', 'transcode_queue')
|
||||
}
|
||||
|
||||
Promise.all(queuesToStart.map((q) => workflowService.startWorkers(q))).catch(console.error)
|
||||
}
|
||||
|
||||
let listenQueues: string[] = ['agent_queue', 'transcode_queue']
|
||||
if (workersOption === 'none') {
|
||||
listenQueues = []
|
||||
} else if (workersOption === 'agent' || workersOption === 'ai') {
|
||||
listenQueues = ['agent_queue']
|
||||
} else if (workersOption === 'transcode') {
|
||||
listenQueues = ['transcode_queue']
|
||||
}
|
||||
|
||||
workflowService.start(listenQueues)
|
||||
workflowService.startStaleTaskRecovery()
|
||||
|
||||
const isProd = process.env.NODE_ENV === 'production'
|
||||
|
||||
const port = process.env.SHUMAI_SERVER_PORT ? parseInt(process.env.SHUMAI_SERVER_PORT) : 3000
|
||||
@@ -178,8 +207,10 @@ async function run() {
|
||||
|
||||
console.log(`🚀 Server running at ${server.url}`)
|
||||
|
||||
const shutdown = () => {
|
||||
const shutdown = async () => {
|
||||
console.log('\nShutting down gracefully...')
|
||||
workflowService.stopStaleTaskRecovery()
|
||||
await workflowService.shutdownWorkers().catch(() => {})
|
||||
assetService.stopCleanupJob()
|
||||
server.stop(true)
|
||||
process.exit(0)
|
||||
|
||||
@@ -3,47 +3,58 @@ import { bunPluginPino } from 'bun-plugin-pino'
|
||||
import tailwindPlugin from 'bun-plugin-tailwind'
|
||||
import { existsSync } from 'fs'
|
||||
import { rm } from 'fs/promises'
|
||||
import { temporalWorkflow } from './packages/workflow-core/src/bun-temporal-plugin'
|
||||
|
||||
console.log('\n🚀 Starting build process...\n')
|
||||
|
||||
const outdir = 'dist'
|
||||
const target = process.argv[2] || 'all'
|
||||
|
||||
if (existsSync(outdir)) {
|
||||
if (existsSync(outdir) && target === 'all') {
|
||||
console.log(`🗑️ Cleaning previous build at ${outdir}`)
|
||||
await rm(outdir, { recursive: true, force: true })
|
||||
}
|
||||
|
||||
await Bun.build({
|
||||
entrypoints: ['./apps/web/src/index.ts'],
|
||||
root: '.',
|
||||
target: 'bun',
|
||||
outdir: outdir,
|
||||
minify: true,
|
||||
splitting: true,
|
||||
naming: '[name].[ext]',
|
||||
plugins: [
|
||||
temporalWorkflow({
|
||||
bundleOptions: {},
|
||||
}),
|
||||
tailwindPlugin,
|
||||
bunPluginPino({ transports: ['pino-pretty'] }),
|
||||
],
|
||||
external: [
|
||||
'@temporalio/activity',
|
||||
'@temporalio/client',
|
||||
'@temporalio/worker',
|
||||
'@temporalio/workflow',
|
||||
'pdfkit',
|
||||
],
|
||||
// compile: {
|
||||
// outfile: 'Shumai',
|
||||
// autoloadBunfig: true,
|
||||
// autoloadDotenv: true,
|
||||
// autoloadTsconfig: true,
|
||||
// autoloadPackageJson: true,
|
||||
// },
|
||||
define: {
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
if (target === 'all' || target === 'web') {
|
||||
await Bun.build({
|
||||
entrypoints: ['./apps/web/src/index.ts'],
|
||||
root: '.',
|
||||
target: 'bun',
|
||||
outdir: outdir,
|
||||
minify: true,
|
||||
splitting: true,
|
||||
naming: '[name].[ext]',
|
||||
plugins: [tailwindPlugin, bunPluginPino({ transports: ['pino-pretty'] })],
|
||||
external: ['@dbos-inc/dbos-sdk', 'pg', 'pdfkit'],
|
||||
define: {
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const allWorkers = [
|
||||
{
|
||||
name: 'transcode',
|
||||
entrypoint: './apps/transcode/src/index.ts',
|
||||
naming: 'transcode-worker.[ext]',
|
||||
},
|
||||
})
|
||||
{ name: 'agent', entrypoint: './apps/agent/src/index.ts', naming: 'agent-worker.[ext]' },
|
||||
]
|
||||
|
||||
const workersToBuild = target === 'all' ? allWorkers : allWorkers.filter((w) => w.name === target)
|
||||
|
||||
for (const worker of workersToBuild) {
|
||||
await Bun.build({
|
||||
entrypoints: [worker.entrypoint],
|
||||
root: '.',
|
||||
target: 'bun',
|
||||
outdir: outdir,
|
||||
minify: true,
|
||||
splitting: false,
|
||||
naming: worker.naming,
|
||||
plugins: [bunPluginPino({ transports: ['pino-pretty'] })],
|
||||
external: ['@dbos-inc/dbos-sdk', 'pg', 'pdfkit'],
|
||||
define: {
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
},
|
||||
"apps/agent": {
|
||||
"name": "@shumai/agent-app",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"bin": {
|
||||
"shumai-agent": "./src/index.ts",
|
||||
},
|
||||
@@ -45,7 +45,7 @@
|
||||
},
|
||||
"apps/cli": {
|
||||
"name": "@shumai/cli",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"bin": {
|
||||
"shumai-cli": "./src/index.ts",
|
||||
},
|
||||
@@ -60,7 +60,7 @@
|
||||
},
|
||||
"apps/premiere-uxp": {
|
||||
"name": "@shumai/premiere-uxp",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@shumai/api": "workspace:*",
|
||||
"@shumai/dtos": "workspace:*",
|
||||
@@ -114,7 +114,7 @@
|
||||
},
|
||||
"apps/transcode": {
|
||||
"name": "@shumai/transcode-app",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"bin": {
|
||||
"shumai-transcode": "./src/index.ts",
|
||||
},
|
||||
@@ -126,7 +126,7 @@
|
||||
},
|
||||
"apps/web": {
|
||||
"name": "@shumai/web-app",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@shumai/agent": "workspace:*",
|
||||
"@shumai/api": "workspace:*",
|
||||
@@ -146,21 +146,19 @@
|
||||
},
|
||||
"packages/agent": {
|
||||
"name": "@shumai/agent",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@anthropic-ai/sandbox-runtime": "0.0.74",
|
||||
"@earendil-works/pi-agent-core": "0.82.1",
|
||||
"@earendil-works/pi-ai": "0.82.1",
|
||||
"@google/genai": "2.19.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
"@shumai/dtos": "workspace:*",
|
||||
"@shumai/workflow-core": "workspace:*",
|
||||
"@temporalio/activity": "1.23.0",
|
||||
"@temporalio/worker": "1.23.0",
|
||||
"@temporalio/workflow": "1.23.0",
|
||||
"adm-zip": "0.6.0",
|
||||
"jittered-fractional-indexing": "1.0.1",
|
||||
"sharp": "0.35.4",
|
||||
"typebox": "1.3.22",
|
||||
"ulid": "3.0.2",
|
||||
"zod": "4.5.4",
|
||||
@@ -171,7 +169,7 @@
|
||||
},
|
||||
"packages/api": {
|
||||
"name": "@shumai/api",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@hono/zod-validator": "0.7.6",
|
||||
"@shumai/core": "workspace:*",
|
||||
@@ -185,7 +183,7 @@
|
||||
},
|
||||
"packages/core": {
|
||||
"name": "@shumai/core",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@ai-sdk/alibaba": "2.0.38",
|
||||
"@ai-sdk/amazon-bedrock": "5.0.67",
|
||||
@@ -210,6 +208,7 @@
|
||||
"@aws-sdk/s3-request-presigner": "3.1121.0",
|
||||
"@earendil-works/pi-agent-core": "0.82.1",
|
||||
"@earendil-works/pi-ai": "0.82.1",
|
||||
"@google/genai": "2.28.0",
|
||||
"@modelcontextprotocol/client": "2.0.0",
|
||||
"@shumai/db": "workspace:*",
|
||||
"@shumai/dtos": "workspace:*",
|
||||
@@ -221,9 +220,11 @@
|
||||
"date-fns": "4.4.0",
|
||||
"dotenv": "17.4.2",
|
||||
"dotenv-expand": "13.0.0",
|
||||
"exiftool-vendored": "38.1.0",
|
||||
"extract-zip": "2.0.1",
|
||||
"hono": "4.13.5",
|
||||
"jittered-fractional-indexing": "1.0.1",
|
||||
"nodemailer": "10.0.10",
|
||||
"pdfkit": "0.20.1",
|
||||
"pino": "10.3.1",
|
||||
"sharp": "0.35.4",
|
||||
@@ -237,12 +238,13 @@
|
||||
"@modelcontextprotocol/server": "2.0.0",
|
||||
"@types/adm-zip": "0.5.8",
|
||||
"@types/extract-zip": "2.0.3",
|
||||
"@types/nodemailer": "8.0.2",
|
||||
"@types/pdfkit": "0.17.6",
|
||||
},
|
||||
},
|
||||
"packages/db": {
|
||||
"name": "@shumai/db",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-agent-core": "0.82.1",
|
||||
"@prisma/adapter-pg": "7.10.0",
|
||||
@@ -258,7 +260,7 @@
|
||||
},
|
||||
"packages/dtos": {
|
||||
"name": "@shumai/dtos",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-agent-core": "0.82.1",
|
||||
"zod": "4.5.4",
|
||||
@@ -266,10 +268,10 @@
|
||||
},
|
||||
"packages/e2e": {
|
||||
"name": "@shumai/e2e",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-agent-core": "0.82.1",
|
||||
"@google/genai": "2.19.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@shumai/agent": "workspace:*",
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
@@ -281,25 +283,22 @@
|
||||
},
|
||||
"packages/tableprinter": {
|
||||
"name": "@shumai/tableprinter",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
},
|
||||
"packages/transcode": {
|
||||
"name": "@shumai/transcode",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
"@shumai/dtos": "workspace:*",
|
||||
"@shumai/workflow-core": "workspace:*",
|
||||
"@temporalio/activity": "1.23.0",
|
||||
"@temporalio/worker": "1.23.0",
|
||||
"@temporalio/workflow": "1.23.0",
|
||||
"ulid": "3.0.2",
|
||||
},
|
||||
},
|
||||
"packages/webui": {
|
||||
"name": "@shumai/webui",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@base-ui/react": "1.7.0",
|
||||
"@dnd-kit/abstract": "0.5.0",
|
||||
@@ -359,6 +358,7 @@
|
||||
"cmdk": "1.1.1",
|
||||
"date-fns": "4.4.0",
|
||||
"embla-carousel-react": "8.6.0",
|
||||
"hls.js": "1.7.3",
|
||||
"hono": "4.13.5",
|
||||
"input-otp": "1.5.0",
|
||||
"konva": "10.3.2",
|
||||
@@ -382,7 +382,6 @@
|
||||
"ulid": "3.0.2",
|
||||
"use-image": "1.1.4",
|
||||
"vaul": "1.1.2",
|
||||
"video.js": "8.24.0",
|
||||
"zod": "4.5.4",
|
||||
"zustand": "5.0.15",
|
||||
},
|
||||
@@ -401,14 +400,12 @@
|
||||
},
|
||||
"packages/workflow-core": {
|
||||
"name": "@shumai/workflow-core",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@dbos-inc/dbos-sdk": "5.2.11",
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
"@shumai/dtos": "workspace:*",
|
||||
"@temporalio/client": "1.23.0",
|
||||
"@temporalio/worker": "1.23.0",
|
||||
"@temporalio/workflow": "1.23.0",
|
||||
"ulid": "3.0.2",
|
||||
},
|
||||
},
|
||||
@@ -595,6 +592,8 @@
|
||||
|
||||
"@date-fns/tz": ["@date-fns/tz@1.5.0", "", {}, "sha512-lwYN/vDPeNRULcepoE/LO2Pgx+7/RV+S9ARfbc9lr2DtGkOD7pAiruHvbR1RX3Qyf6ja47EWJDMsNK5vK08DJg=="],
|
||||
|
||||
"@dbos-inc/dbos-sdk": ["@dbos-inc/dbos-sdk@5.2.11", "", { "dependencies": { "commander": "^12.0.0", "pg": "^8.11.3", "serialize-error": "^8.1.0", "superjson": "^1.13.3", "ws": "^8.18.1", "yaml": "^2.8.3" }, "bin": { "dbos": "dist/src/cli/cli.js", "dbos-sdk": "dist/src/cli/cli.js" } }, "sha512-qrqWGA+7bt48viESoxRIEt518pcYbJXGy1KZJ3GRaK4WI0sR3f2xmvTqc8+Rhs/tbfROso5zFb9bgnUnMKNqbg=="],
|
||||
|
||||
"@dnd-kit/abstract": ["@dnd-kit/abstract@0.5.0", "", { "dependencies": { "@dnd-kit/geometry": "^0.5.0", "@dnd-kit/state": "^0.5.0", "tslib": "^2.6.2" } }, "sha512-hi13iMJgjPX/KDYVKg5VeDIhmYiV6buc9bAX+tCLYf4QdyYjPbsXjn2sPo6m7fQ6SGJBEFgHJ2PemeKDUbwBaA=="],
|
||||
|
||||
"@dnd-kit/collision": ["@dnd-kit/collision@0.5.0", "", { "dependencies": { "@dnd-kit/abstract": "^0.5.0", "@dnd-kit/geometry": "^0.5.0", "tslib": "^2.6.2" } }, "sha512-xUqRn3lS7oqLkT0AnnHS/STh/Czvwe1UapZFYiLbsUGxopMsQd4teaPCzPouOThoMdGEe+dHWjfqJl6t9iG4mQ=="],
|
||||
@@ -647,7 +646,7 @@
|
||||
|
||||
"@floating-ui/utils": ["@floating-ui/utils@0.2.12", "", {}, "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww=="],
|
||||
|
||||
"@google/genai": ["@google/genai@2.19.0", "", { "dependencies": { "google-auth-library": "^10.3.0", "p-retry": "^4.6.2", "protobufjs": "^7.5.4", "ws": "^8.18.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": "^1.25.2" }, "optionalPeers": ["@modelcontextprotocol/sdk"] }, "sha512-IM3u1FjpOLyOPsPh0smGA6Ntj2olUWCPbTs/WQj7cA/2AKCGw/652W7IaySx0XtwuscFnMYBoraebQusSZ0zSQ=="],
|
||||
"@google/genai": ["@google/genai@2.28.0", "", { "dependencies": { "google-auth-library": "^10.3.0", "p-retry": "^4.6.2", "protobufjs": "^7.5.4", "ws": "^8.18.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": "^1.25.2" }, "optionalPeers": ["@modelcontextprotocol/sdk"] }, "sha512-hyNAJj+ywu3L46qlZod6KO/JvcT3QONz6VCiPevC/FWOjAD+LQb7DMLUoV8vzoLpt61Q0ruQX99iqbxEjPJWmw=="],
|
||||
|
||||
"@grpc/grpc-js": ["@grpc/grpc-js@1.14.4", "", { "dependencies": { "@grpc/proto-loader": "^0.8.0", "@js-sdsl/ordered-map": "^4.4.2" } }, "sha512-k9Dj3DV/itK9D06Y8f190Qgop7/Ui+D0njFV3LHMPwPT75DpXLQohE9Wmz0QElrJnzsjB7KPWiKJbOl7IPDArQ=="],
|
||||
|
||||
@@ -735,42 +734,12 @@
|
||||
|
||||
"@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
|
||||
|
||||
"@jridgewell/source-map": ["@jridgewell/source-map@0.3.11", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25" } }, "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA=="],
|
||||
|
||||
"@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.6.0", "", {}, "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw=="],
|
||||
|
||||
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
|
||||
|
||||
"@js-sdsl/ordered-map": ["@js-sdsl/ordered-map@4.4.2", "", {}, "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw=="],
|
||||
|
||||
"@jsonjoy.com/base64": ["@jsonjoy.com/base64@1.1.2", "", { "peerDependencies": { "tslib": "2" } }, "sha512-q6XAnWQDIMA3+FTiOYajoYqySkO+JSat0ytXGSuRdq9uXE7o92gzuQwQM14xaCRlBLGq3v5miDGC4vkVTn54xA=="],
|
||||
|
||||
"@jsonjoy.com/buffers": ["@jsonjoy.com/buffers@17.67.0", "", { "peerDependencies": { "tslib": "2" } }, "sha512-tfExRpYxBvi32vPs9ZHaTjSP4fHAfzSmcahOfNxtvGHcyJel+aibkPlGeBB+7AoC6hL7lXIE++8okecBxx7lcw=="],
|
||||
|
||||
"@jsonjoy.com/codegen": ["@jsonjoy.com/codegen@1.0.0", "", { "peerDependencies": { "tslib": "2" } }, "sha512-E8Oy+08cmCf0EK/NMxpaJZmOxPqM+6iSe2S4nlSBrPZOORoDJILxtbSUEDKQyTamm/BVAhIGllOBNU79/dwf0g=="],
|
||||
|
||||
"@jsonjoy.com/fs-core": ["@jsonjoy.com/fs-core@4.68.2", "", { "dependencies": { "@jsonjoy.com/fs-node-builtins": "4.68.2", "@jsonjoy.com/fs-node-utils": "4.68.2", "thingies": "^2.5.0" }, "peerDependencies": { "tslib": "2" } }, "sha512-PoBeUNEbjyLKKwCap2z8LkkqdhdfttS4rTHCALVuP65BdF+sAoyBqHo1m+uGTRBiQWv3H7MGfr8f7lY4pDwanw=="],
|
||||
|
||||
"@jsonjoy.com/fs-fsa": ["@jsonjoy.com/fs-fsa@4.68.2", "", { "dependencies": { "@jsonjoy.com/fs-core": "4.68.2", "@jsonjoy.com/fs-node-builtins": "4.68.2", "@jsonjoy.com/fs-node-utils": "4.68.2", "thingies": "^2.5.0" }, "peerDependencies": { "tslib": "2" } }, "sha512-h6eGXlLGGMyPfNliDQrbuHKTB9Z29ksCLjreAmdBqrDOBdfrTrHssi+b9WLfrF+J2KzAbIt9OMjJu6AEpTnYkg=="],
|
||||
|
||||
"@jsonjoy.com/fs-node": ["@jsonjoy.com/fs-node@4.68.2", "", { "dependencies": { "@jsonjoy.com/fs-core": "4.68.2", "@jsonjoy.com/fs-node-builtins": "4.68.2", "@jsonjoy.com/fs-node-utils": "4.68.2", "@jsonjoy.com/fs-print": "4.68.2", "@jsonjoy.com/fs-snapshot": "4.68.2", "glob-to-regex.js": "^1.0.0", "thingies": "^2.5.0" }, "peerDependencies": { "tslib": "2" } }, "sha512-Kpj519Qk4OXG4+mZ8vTf9BEflliJrPueIDEVcbx8tAOufMJJ8IxR0WwdbcEvJol2KQog3PJjtALXVclorE+xbQ=="],
|
||||
|
||||
"@jsonjoy.com/fs-node-builtins": ["@jsonjoy.com/fs-node-builtins@4.68.2", "", { "peerDependencies": { "tslib": "2" } }, "sha512-V8WzQsW2YIrH3RxBGY6HZisxn+dDUltHgksVRuCdPEOXEkAfXuhL/01eHFrabNu84Dn13XuLqvcQUKOYVKAUOA=="],
|
||||
|
||||
"@jsonjoy.com/fs-node-to-fsa": ["@jsonjoy.com/fs-node-to-fsa@4.68.2", "", { "dependencies": { "@jsonjoy.com/fs-fsa": "4.68.2", "@jsonjoy.com/fs-node-builtins": "4.68.2", "@jsonjoy.com/fs-node-utils": "4.68.2" }, "peerDependencies": { "tslib": "2" } }, "sha512-4O1K4w5G4oJIpKpoa3WSLG83AsQYVnGv+aUSBGOvIUph9Axm6bB1mPlvldkNg2tBx/4dkiTlZnqNrK5SQ21Wtg=="],
|
||||
|
||||
"@jsonjoy.com/fs-node-utils": ["@jsonjoy.com/fs-node-utils@4.68.2", "", { "dependencies": { "@jsonjoy.com/fs-node-builtins": "4.68.2", "glob-to-regex.js": "^1.0.1" }, "peerDependencies": { "tslib": "2" } }, "sha512-CxFwyG9fJr7dAKAd1uanNRNrRMtDDqbYJA8do53+M4LY7SxcBEEmMjC1zi9MOsBlVLHTXvA7OP9+n639UqtIcw=="],
|
||||
|
||||
"@jsonjoy.com/fs-print": ["@jsonjoy.com/fs-print@4.68.2", "", { "dependencies": { "@jsonjoy.com/fs-node-utils": "4.68.2", "tree-dump": "^1.1.0" }, "peerDependencies": { "tslib": "2" } }, "sha512-cBABQmZJXig6bahwNka3+yPNGUF1GeMWbR76ZM1N2ajgCd+S+twZigCoe9+0ueZmkhM9xd2a7688Gy/ch7T+2w=="],
|
||||
|
||||
"@jsonjoy.com/fs-snapshot": ["@jsonjoy.com/fs-snapshot@4.68.2", "", { "dependencies": { "@jsonjoy.com/buffers": "^17.65.0", "@jsonjoy.com/fs-node-utils": "4.68.2", "@jsonjoy.com/json-pack": "^17.65.0", "@jsonjoy.com/util": "^17.65.0" }, "peerDependencies": { "tslib": "2" } }, "sha512-Aix7+NM38LzvewM0T3PICSgFdF5BVCtVgsjNsrlDPGc9hiMgJzReTDDl2/elgl0A9USMl3QP27x5WwxZSOtrfw=="],
|
||||
|
||||
"@jsonjoy.com/json-pack": ["@jsonjoy.com/json-pack@1.21.0", "", { "dependencies": { "@jsonjoy.com/base64": "^1.1.2", "@jsonjoy.com/buffers": "^1.2.0", "@jsonjoy.com/codegen": "^1.0.0", "@jsonjoy.com/json-pointer": "^1.0.2", "@jsonjoy.com/util": "^1.9.0", "hyperdyperid": "^1.2.0", "thingies": "^2.5.0", "tree-dump": "^1.1.0" }, "peerDependencies": { "tslib": "2" } }, "sha512-+AKG+R2cfZMShzrF2uQw34v3zbeDYUqnQ+jg7ORic3BGtfw9p/+N6RJbq/kkV8JmYZaINknaEQ2m0/f693ZPpg=="],
|
||||
|
||||
"@jsonjoy.com/json-pointer": ["@jsonjoy.com/json-pointer@1.0.2", "", { "dependencies": { "@jsonjoy.com/codegen": "^1.0.0", "@jsonjoy.com/util": "^1.9.0" }, "peerDependencies": { "tslib": "2" } }, "sha512-Fsn6wM2zlDzY1U+v4Nc8bo3bVqgfNTGcn6dMgs6FjrEnt4ZCe60o6ByKRjOGlI2gow0aE/Q41QOigdTqkyK5fg=="],
|
||||
|
||||
"@jsonjoy.com/util": ["@jsonjoy.com/util@1.9.0", "", { "dependencies": { "@jsonjoy.com/buffers": "^1.0.0", "@jsonjoy.com/codegen": "^1.0.0" }, "peerDependencies": { "tslib": "2" } }, "sha512-pLuQo+VPRnN8hfPqUTLTHk126wuYdXVxE6aDmjSeV4NCAgyxWbiOIeNJVtID3h1Vzpoi9m4jXezf73I6LgabgQ=="],
|
||||
|
||||
"@kwsites/file-exists": ["@kwsites/file-exists@1.1.1", "", { "dependencies": { "debug": "^4.1.1" } }, "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw=="],
|
||||
|
||||
"@lexical/a11y": ["@lexical/a11y@0.49.0", "", { "dependencies": { "@lexical/extension": "0.49.0", "@lexical/utils": "0.49.0", "lexical": "0.49.0" }, "peerDependencies": { "typescript": ">=5.2" }, "optionalPeers": ["typescript"] }, "sha512-ypvO0SI9DCzEAjxkRLq+gNzRqfjg632RCkwu16Hk94PCBrEmcDhx5iUGg3SRJC7WnM2wXC/F/SB8yWDEfq7tEw=="],
|
||||
@@ -907,6 +876,8 @@
|
||||
|
||||
"@oxc-project/types": ["@oxc-project/types@0.147.0", "", {}, "sha512-IJ3s6ltHLp45S0bh7phkX+gJO7A1Wuz2EaqpAhb8WjqDwbzMiWKHhyyT42tskaWjEYXtHtVCPpnBJVT9+dcRLg=="],
|
||||
|
||||
"@photostructure/tz-lookup": ["@photostructure/tz-lookup@11.7.0", "", {}, "sha512-QbKHXvleluMIlAHf2JiQTJNU5rLQBeQhLobyRqgXZ6NNGKqNikaRkjYviJ4nMU7Y75QE7bBYM8xjiFGjAukyhw=="],
|
||||
|
||||
"@pinojs/redact": ["@pinojs/redact@0.4.0", "", {}, "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg=="],
|
||||
|
||||
"@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="],
|
||||
@@ -1373,38 +1344,8 @@
|
||||
|
||||
"@swc-uxp-wrappers/utils": ["@swc-uxp-wrappers/utils@2.0.1", "", { "dependencies": { "@swc-uxp-internal/base": "npm:@spectrum-web-components/base@0.37.0", "@swc-uxp-internal/icon": "npm:@spectrum-web-components/icon@0.37.0", "@swc-uxp-internal/icons": "npm:@spectrum-web-components/icons@0.37.0", "@swc-uxp-internal/icons-ui": "npm:@spectrum-web-components/icons-ui@0.37.0", "@swc-uxp-internal/icons-workflow": "npm:@spectrum-web-components/icons-workflow@0.37.0", "@swc-uxp-internal/iconset": "npm:@spectrum-web-components/iconset@0.37.0", "@swc-uxp-internal/reactive-controllers": "npm:@spectrum-web-components/reactive-controllers@0.37.0", "@swc-uxp-internal/shared": "npm:@spectrum-web-components/shared@0.37.0", "@swc-uxp-internal/styles": "npm:@spectrum-web-components/styles@0.37.0", "@swc-uxp-internal/theme": "npm:@spectrum-web-components/theme@0.37.0" } }, "sha512-8vbd6fOok2/f8Tp0KPlBPUJYlMhnMGmEhiiySf/dhsOR85kiFMKf3VwILWkd0No2+fViARviDCVZbk+5F8EtNA=="],
|
||||
|
||||
"@swc/core": ["@swc/core@1.16.1", "", { "dependencies": { "@swc/counter": "^0.1.3", "@swc/types": "^0.1.28" }, "optionalDependencies": { "@swc/core-darwin-arm64": "1.16.1", "@swc/core-darwin-x64": "1.16.1", "@swc/core-linux-arm-gnueabihf": "1.16.1", "@swc/core-linux-arm64-gnu": "1.16.1", "@swc/core-linux-arm64-musl": "1.16.1", "@swc/core-linux-ppc64-gnu": "1.16.1", "@swc/core-linux-s390x-gnu": "1.16.1", "@swc/core-linux-x64-gnu": "1.16.1", "@swc/core-linux-x64-musl": "1.16.1", "@swc/core-win32-arm64-msvc": "1.16.1", "@swc/core-win32-ia32-msvc": "1.16.1", "@swc/core-win32-x64-msvc": "1.16.1" }, "peerDependencies": { "@swc/helpers": ">=0.5.17" }, "optionalPeers": ["@swc/helpers"] }, "sha512-nUaeu91O5QZKrQdaDCHd402ogUIoNOOjpkZNq0UomWK0G6gDaGmLhvddF1/3BXf5O8aLyo6ZPY/aMDWvaJQ/hg=="],
|
||||
|
||||
"@swc/core-darwin-arm64": ["@swc/core-darwin-arm64@1.16.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-zlJblJ8ncErD43lKdxjbUaUskJQf+LxiPXYcWXD8/8ZMV+7uuAT+CwjciLXpyZBd5Pq/S726bMpeeAwSeL1hhg=="],
|
||||
|
||||
"@swc/core-darwin-x64": ["@swc/core-darwin-x64@1.16.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-IN0BmPWb0YAh/17mmlWB/HDBtTw2MfuW4hulf/tQAgTQBRH17l+z499bNJLK6LizSjqs0P7V+jU38Zj+vJC1DA=="],
|
||||
|
||||
"@swc/core-linux-arm-gnueabihf": ["@swc/core-linux-arm-gnueabihf@1.16.1", "", { "os": "linux", "cpu": "arm" }, "sha512-EYgrx2YOCQ2Twz2S793kqNjPkpvYVUPzzR95bIb7by+VQcyaai4lZZ2iz/tZvcFVKSNcN3/JTKwx+aBn2ZL52A=="],
|
||||
|
||||
"@swc/core-linux-arm64-gnu": ["@swc/core-linux-arm64-gnu@1.16.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-moyKm0YZlHdHohzm1YwgAyesqnE853rO0REMfJLFAova51wF9BNi+3ZW2PeS7Vqvn6HeJuepLpAHbBdZctxpHA=="],
|
||||
|
||||
"@swc/core-linux-arm64-musl": ["@swc/core-linux-arm64-musl@1.16.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-kKGBO9wdapiSzuf5ZzZ2fYtlu1BNSYtIIUxvH1ir/gcelTOREEHGDCLTDFx/2Knf878nU11A40z7LxwasEFxqA=="],
|
||||
|
||||
"@swc/core-linux-ppc64-gnu": ["@swc/core-linux-ppc64-gnu@1.16.1", "", { "os": "linux", "cpu": "ppc64" }, "sha512-nZ6qahtLxC3PM54cWOQZHxt4lTCF/3J4LIoWWzz6v7A+rLs8Dx54anYQf7mH3eIi8KlNpgKci/ie8ZSqFN8O7A=="],
|
||||
|
||||
"@swc/core-linux-s390x-gnu": ["@swc/core-linux-s390x-gnu@1.16.1", "", { "os": "linux", "cpu": "s390x" }, "sha512-4ji5PNzhYq193Z4/4xUaSoNJza6iCkDJSzhetrbB6KOYxsr+kxtQr8ePWhMJUiMt6JUWtXaZ1PYT8FhtED+nGA=="],
|
||||
|
||||
"@swc/core-linux-x64-gnu": ["@swc/core-linux-x64-gnu@1.16.1", "", { "os": "linux", "cpu": "x64" }, "sha512-VJQxqrisHV+B394IgrOu8YsIIXZgffnf5tO+yc9Z/hoUpuZEvuQTjWwlnpZdpyD+0nx6LTD1/3k646JYm43yJA=="],
|
||||
|
||||
"@swc/core-linux-x64-musl": ["@swc/core-linux-x64-musl@1.16.1", "", { "os": "linux", "cpu": "x64" }, "sha512-r9oV1mwxxsIGcLV1IQ/tw76MW3doatKze1QFWuC+a7QqJUkhY/bKTSVk6NpKKUGm2LDsE33Va8VqSClfA7vSiQ=="],
|
||||
|
||||
"@swc/core-win32-arm64-msvc": ["@swc/core-win32-arm64-msvc@1.16.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-6huNRessoBLxWEqBm5zJXyCQ27TO7anvkdiuQ5MDO4CJni0nOXEqKtV9RllQ2TdyENKKsUMXVnIfW2hIXx/R5Q=="],
|
||||
|
||||
"@swc/core-win32-ia32-msvc": ["@swc/core-win32-ia32-msvc@1.16.1", "", { "os": "win32", "cpu": "ia32" }, "sha512-OVKJFUzphrGmsh+BGtcZDesx0YryV7/Yvy5XGgTqnrZfjnyfcr5uaqYQugCckdIlupc5Vs3XtDjRAj12z4ZPlw=="],
|
||||
|
||||
"@swc/core-win32-x64-msvc": ["@swc/core-win32-x64-msvc@1.16.1", "", { "os": "win32", "cpu": "x64" }, "sha512-Bt+VIhWYCGk4urklnkkteLUOeLv1VxigwTCeB/xC6rBZxY6IIKdDwCJf6on3E3SUGsIqmQS6QqtuJQc1VxF4Aw=="],
|
||||
|
||||
"@swc/counter": ["@swc/counter@0.1.3", "", {}, "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ=="],
|
||||
|
||||
"@swc/helpers": ["@swc/helpers@0.5.23", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw=="],
|
||||
|
||||
"@swc/types": ["@swc/types@0.1.28", "", { "dependencies": { "@swc/counter": "^0.1.3" } }, "sha512-V6Mnml8v09QALx6K0elJ7o9K/MkVDtW3t6L+7Ou/JcWtb3xwId2AH4FeOceySd2JaO87IMw4+6vSZxLm34LPbw=="],
|
||||
|
||||
"@tailwindcss/node": ["@tailwindcss/node@4.3.3", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "enhanced-resolve": "^5.24.1", "jiti": "^2.7.0", "lightningcss": "1.32.0", "magic-string": "^0.30.21", "source-map-js": "^1.2.1", "tailwindcss": "4.3.3" } }, "sha512-/T8IKEsf9VTU6tLjgC7+sv2mOPtQxzE2jMw7u4Tt40Tx+QSZxpzh95/H6cMKoja9XuW7iMdLJYBB0o9G1CaAgg=="],
|
||||
|
||||
"@tailwindcss/oxide": ["@tailwindcss/oxide@4.3.3", "", { "optionalDependencies": { "@tailwindcss/oxide-android-arm64": "4.3.3", "@tailwindcss/oxide-darwin-arm64": "4.3.3", "@tailwindcss/oxide-darwin-x64": "4.3.3", "@tailwindcss/oxide-freebsd-x64": "4.3.3", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.3", "@tailwindcss/oxide-linux-arm64-gnu": "4.3.3", "@tailwindcss/oxide-linux-arm64-musl": "4.3.3", "@tailwindcss/oxide-linux-x64-gnu": "4.3.3", "@tailwindcss/oxide-linux-x64-musl": "4.3.3", "@tailwindcss/oxide-wasm32-wasi": "4.3.3", "@tailwindcss/oxide-win32-arm64-msvc": "4.3.3", "@tailwindcss/oxide-win32-x64-msvc": "4.3.3" } }, "sha512-krXjAikiaFSPaK/FkAQT5UTx3VormQaiZ5hBFlJZ9UFQGB/rwg1MZIhHAG9smMQRTdyJxP6Qt5MwMtdyU5FWrA=="],
|
||||
@@ -1475,22 +1416,6 @@
|
||||
|
||||
"@tanstack/virtual-file-routes": ["@tanstack/virtual-file-routes@1.162.0", "", {}, "sha512-uhOeFyxLcU41HzvrxsGpiWdcMbScY1EDgbZ5K7DVRMYInbLYWAC0EA/kx9wXAoSM8q82bUG2hRl8+EAjE6XAbA=="],
|
||||
|
||||
"@temporalio/activity": ["@temporalio/activity@1.23.0", "", { "dependencies": { "@temporalio/client": "1.23.0", "@temporalio/common": "1.23.0" } }, "sha512-BVeiizVD08yk0Ls6MhKCK+g3fPIWbVM9MLx+o990KwhCaZtRM6o1+du1/qfIIShHl6YjHk+H0ewkx2x14QQ6bA=="],
|
||||
|
||||
"@temporalio/client": ["@temporalio/client@1.23.0", "", { "dependencies": { "@grpc/grpc-js": "^1.12.4", "@temporalio/common": "1.23.0", "@temporalio/proto": "1.23.0", "abort-controller": "^3.0.0", "long": "^5.3.2", "nexus-rpc": "^0.0.3", "uuid": "^11.1.0" } }, "sha512-E9nXZPiKDGEDbPpRi0EyQ9i1x70fEIG26aMXZO88kKslKZnEKNPphs06xIic7bhuDoSrPsgVfdDap6o3l6IO2A=="],
|
||||
|
||||
"@temporalio/common": ["@temporalio/common@1.23.0", "", { "dependencies": { "@temporalio/proto": "1.23.0", "long": "^5.3.2", "ms": "3.0.0-canary.1", "nexus-rpc": "^0.0.3", "protobufjs": "^8.7.1" } }, "sha512-TaZYb/ruzgzJ8jd42EqRUCI4ispLZETt2Jigc9szES6q9edDmfncRw143HyvPi7b8n9naohYmA/IxTe9COH/dg=="],
|
||||
|
||||
"@temporalio/core-bridge": ["@temporalio/core-bridge@1.23.0", "", { "dependencies": { "@grpc/grpc-js": "^1.12.4", "@temporalio/common": "1.23.0" } }, "sha512-sid14odlYnci9WgB+iDLyxFbzkq+qBbRPp+CW9U1v+DLRfHlFJwpznQ1AZl4mHjtAZRGQFvDsDG0XNncl9ESSA=="],
|
||||
|
||||
"@temporalio/nexus": ["@temporalio/nexus@1.23.0", "", { "dependencies": { "@temporalio/client": "1.23.0", "@temporalio/common": "1.23.0", "@temporalio/proto": "1.23.0", "long": "^5.3.2", "nexus-rpc": "^0.0.3" } }, "sha512-mObGNp3thR+mTXdtKXpUvFpsdjEI9xpVjewhblKXao7Nqv6xrs7RpFiLdKfJhkEvDyfRgIk/dH5RkiCbZ58I9w=="],
|
||||
|
||||
"@temporalio/proto": ["@temporalio/proto@1.23.0", "", { "dependencies": { "long": "^5.3.2", "protobufjs": "^8.7.1" } }, "sha512-90JWnYEs1wyq97/SXkQGknRVMr/BCV9sZ0pOnK3fHTedVinfvz3/PBVFkeAJyU3CJqMQGnzRs9IIfsBTT1icrA=="],
|
||||
|
||||
"@temporalio/worker": ["@temporalio/worker@1.23.0", "", { "dependencies": { "@grpc/grpc-js": "^1.12.4", "@swc/core": "^1.3.102", "@temporalio/activity": "1.23.0", "@temporalio/client": "1.23.0", "@temporalio/common": "1.23.0", "@temporalio/core-bridge": "1.23.0", "@temporalio/nexus": "1.23.0", "@temporalio/proto": "1.23.0", "@temporalio/workflow": "1.23.0", "heap-js": "^2.6.0", "memfs": "^4.6.0", "nexus-rpc": "^0.0.3", "protobufjs": "^8.7.1", "rxjs": "^7.8.1", "source-map": "^0.7.4", "source-map-loader": "^5.0.0", "supports-color": "^8.1.1", "swc-loader": "^0.2.3", "unionfs": "^4.5.1", "webpack": "^5.108.4" } }, "sha512-k1MrK10lD1s7U66PFqAwGlQMRsVrfU5nCB+CjIAg5RyL7JpOzidDCz/E/jB2HobXzZnxtMcDBfBHh/BYUoyhxw=="],
|
||||
|
||||
"@temporalio/workflow": ["@temporalio/workflow@1.23.0", "", { "dependencies": { "@temporalio/common": "1.23.0", "@temporalio/proto": "1.23.0", "nexus-rpc": "^0.0.3" } }, "sha512-dHQnYmxU/QN7VfTmdfCfpdfTS1w0hoW/NQ7Zefr55QnqLwZw+E0Vn6S4fAbJrpfHrsAmezUZQFVLi+Z4Sq+jzA=="],
|
||||
|
||||
"@testcontainers/postgresql": ["@testcontainers/postgresql@12.1.0", "", { "dependencies": { "testcontainers": "^12.1.0" } }, "sha512-Pjf2VSVNirEPfz36nidyrVAnZvc2YhajOznY4VgyEsvfTd5qiMNOuPq96drREvxAUtXl5SFLX7vXj7sSq4aTcA=="],
|
||||
|
||||
"@testing-library/dom": ["@testing-library/dom@10.4.1", "", { "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^5.0.1", "aria-query": "5.3.0", "dom-accessibility-api": "^0.5.9", "lz-string": "^1.5.0", "picocolors": "1.1.1", "pretty-format": "^27.0.2" } }, "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg=="],
|
||||
@@ -1557,12 +1482,16 @@
|
||||
|
||||
"@types/lodash": ["@types/lodash@4.17.25", "", {}, "sha512-+K1NIO8I+F9/wNulfVvu23QYd0Pe9/OCqRrim4NoYIf1VoEDL90Ve4ClzpyqBLc7NpGGWRvYNCKZ1BE/Jpf8dQ=="],
|
||||
|
||||
"@types/luxon": ["@types/luxon@3.7.5", "", {}, "sha512-jJ41Q4z6ZVO260MNDdHfW7+7a5iMiX8Mr6ZJHcmgrvhZha6dz5704o/lF2kKl6URjH6ivEL97w9xS/MgpJEphg=="],
|
||||
|
||||
"@types/mdast": ["@types/mdast@4.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA=="],
|
||||
|
||||
"@types/ms": ["@types/ms@2.1.0", "", {}, "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA=="],
|
||||
|
||||
"@types/node": ["@types/node@25.9.1", "", { "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } }, "sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg=="],
|
||||
|
||||
"@types/nodemailer": ["@types/nodemailer@8.0.2", "", { "dependencies": { "@types/node": "*" } }, "sha512-c7M5ox8p0nEOfbJ2E9Qcmt8/QCu/VzsiAhzBiZbvky2PhKZDHpKB3sQHBM5MEZNkCfBOaS6S9//AGPRTNB7IaA=="],
|
||||
|
||||
"@types/pdfkit": ["@types/pdfkit@0.17.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-tIwzxk2uWKp0Cq9JIluQXJid77lYhF52EsIOwhsMF4iWLA6YneoBR1xVKYYdAysHuepUB0OX4tdwMiUDdGKmig=="],
|
||||
|
||||
"@types/pg": ["@types/pg@8.23.1", "", { "dependencies": { "@types/node": "*", "pg-protocol": "*", "pg-types": "^2.2.0" } }, "sha512-fKVHpikPdg4GKks3JuLEhvwSyvwzF23hnabPy6DD8ljVbC7+6J5dQzdv4arV6jqq57djnMgs1HKBxX4P8aBI3A=="],
|
||||
@@ -1621,12 +1550,6 @@
|
||||
|
||||
"@vercel/oidc": ["@vercel/oidc@3.2.0", "", {}, "sha512-UycprH3T6n3jH0k44NHMa7pnFHGu/N05MjojYr+Mc6I7obkoLIJujSWwin1pCvdy/eOxrI/l3uDLQsmcrOb4ug=="],
|
||||
|
||||
"@videojs/http-streaming": ["@videojs/http-streaming@3.17.5", "", { "dependencies": { "@babel/runtime": "^7.12.5", "@videojs/vhs-utils": "^4.1.2", "aes-decrypter": "^4.0.2", "global": "^4.4.0", "m3u8-parser": "^7.2.0", "mpd-parser": "^1.4.0", "mux.js": "7.1.0", "video.js": "^7 || ^8" } }, "sha512-PRRQVu0hYW5h0XvRWpIyIpEatpMZzZtf7L1avV89Hnu+69f+0c7oLsSL9jwpg2nbvzGkdX5rQxQkz5Vc7tFR9w=="],
|
||||
|
||||
"@videojs/vhs-utils": ["@videojs/vhs-utils@4.1.2", "", { "dependencies": { "@babel/runtime": "^7.12.5", "global": "^4.4.0" } }, "sha512-1Dsv5dtWOq0LP1G37O46FQFA2tKAZON5UMe6dFPxT7JvPhEx8QIXcFQxan8+hHI3fX6aomFRFrUBJNgRYQDSXA=="],
|
||||
|
||||
"@videojs/xhr": ["@videojs/xhr@2.7.0", "", { "dependencies": { "@babel/runtime": "^7.5.5", "global": "~4.4.0", "is-function": "^1.0.1" } }, "sha512-giab+EVRanChIupZK7gXjHy90y3nncA2phIOyG3Ne5fvpiMJzvqYwiTOnEVW2S4CoYcuKJkomat7bMXA/UoUZQ=="],
|
||||
|
||||
"@visx/curve": ["@visx/curve@4.0.1-alpha.0", "", { "dependencies": { "@visx/vendor": "4.0.0-alpha.0" } }, "sha512-jRu61Uz274pV1zyioXmboyrLutYbnKsgjj4njSGCnhdXj5GkZvZbg+ThDb6oOzoAnJOBRLz4rzPlWvNJOzuVMg=="],
|
||||
|
||||
"@visx/event": ["@visx/event@4.0.1-alpha.0", "", { "dependencies": { "@types/react": "*", "@visx/point": "4.0.1-alpha.0" } }, "sha512-EQqCMSv/s8NbFjo+hz3FKsvvYfP+2QslsFJ/24/O5l/W+7UC6J6aAvO0ujVwrTwdYbuQ+vhxKi1xdPdKR/qj1g=="],
|
||||
@@ -1659,44 +1582,8 @@
|
||||
|
||||
"@vitest/utils": ["@vitest/utils@4.1.11", "", { "dependencies": { "@vitest/pretty-format": "4.1.11", "convert-source-map": "^2.0.0", "tinyrainbow": "^3.1.0" } }, "sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ=="],
|
||||
|
||||
"@webassemblyjs/ast": ["@webassemblyjs/ast@1.14.1", "", { "dependencies": { "@webassemblyjs/helper-numbers": "1.13.2", "@webassemblyjs/helper-wasm-bytecode": "1.13.2" } }, "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ=="],
|
||||
|
||||
"@webassemblyjs/floating-point-hex-parser": ["@webassemblyjs/floating-point-hex-parser@1.13.2", "", {}, "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA=="],
|
||||
|
||||
"@webassemblyjs/helper-api-error": ["@webassemblyjs/helper-api-error@1.13.2", "", {}, "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ=="],
|
||||
|
||||
"@webassemblyjs/helper-buffer": ["@webassemblyjs/helper-buffer@1.14.1", "", {}, "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA=="],
|
||||
|
||||
"@webassemblyjs/helper-numbers": ["@webassemblyjs/helper-numbers@1.13.2", "", { "dependencies": { "@webassemblyjs/floating-point-hex-parser": "1.13.2", "@webassemblyjs/helper-api-error": "1.13.2", "@xtuc/long": "4.2.2" } }, "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA=="],
|
||||
|
||||
"@webassemblyjs/helper-wasm-bytecode": ["@webassemblyjs/helper-wasm-bytecode@1.13.2", "", {}, "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA=="],
|
||||
|
||||
"@webassemblyjs/helper-wasm-section": ["@webassemblyjs/helper-wasm-section@1.14.1", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", "@webassemblyjs/helper-wasm-bytecode": "1.13.2", "@webassemblyjs/wasm-gen": "1.14.1" } }, "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw=="],
|
||||
|
||||
"@webassemblyjs/ieee754": ["@webassemblyjs/ieee754@1.13.2", "", { "dependencies": { "@xtuc/ieee754": "^1.2.0" } }, "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw=="],
|
||||
|
||||
"@webassemblyjs/leb128": ["@webassemblyjs/leb128@1.13.2", "", { "dependencies": { "@xtuc/long": "4.2.2" } }, "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw=="],
|
||||
|
||||
"@webassemblyjs/utf8": ["@webassemblyjs/utf8@1.13.2", "", {}, "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ=="],
|
||||
|
||||
"@webassemblyjs/wasm-edit": ["@webassemblyjs/wasm-edit@1.14.1", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", "@webassemblyjs/helper-wasm-bytecode": "1.13.2", "@webassemblyjs/helper-wasm-section": "1.14.1", "@webassemblyjs/wasm-gen": "1.14.1", "@webassemblyjs/wasm-opt": "1.14.1", "@webassemblyjs/wasm-parser": "1.14.1", "@webassemblyjs/wast-printer": "1.14.1" } }, "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ=="],
|
||||
|
||||
"@webassemblyjs/wasm-gen": ["@webassemblyjs/wasm-gen@1.14.1", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-wasm-bytecode": "1.13.2", "@webassemblyjs/ieee754": "1.13.2", "@webassemblyjs/leb128": "1.13.2", "@webassemblyjs/utf8": "1.13.2" } }, "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg=="],
|
||||
|
||||
"@webassemblyjs/wasm-opt": ["@webassemblyjs/wasm-opt@1.14.1", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", "@webassemblyjs/wasm-gen": "1.14.1", "@webassemblyjs/wasm-parser": "1.14.1" } }, "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw=="],
|
||||
|
||||
"@webassemblyjs/wasm-parser": ["@webassemblyjs/wasm-parser@1.14.1", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-api-error": "1.13.2", "@webassemblyjs/helper-wasm-bytecode": "1.13.2", "@webassemblyjs/ieee754": "1.13.2", "@webassemblyjs/leb128": "1.13.2", "@webassemblyjs/utf8": "1.13.2" } }, "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ=="],
|
||||
|
||||
"@webassemblyjs/wast-printer": ["@webassemblyjs/wast-printer@1.14.1", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@xtuc/long": "4.2.2" } }, "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw=="],
|
||||
|
||||
"@workflow/serde": ["@workflow/serde@4.1.0", "", {}, "sha512-pav4F2BoirECWR7Nf1TKt+2eETcBj7jj4cBefQ8VXQCA6NPkaKeLfj/zMgi+3zYV5ZIBT4GuUiphsj0/b9hPQQ=="],
|
||||
|
||||
"@xmldom/xmldom": ["@xmldom/xmldom@0.8.15", "", {}, "sha512-/5NV/vDALVFDXgLmfsy9TRCBlKwO2LNBFzpzvb9iIj+jR+eSc6DLYYvVOdivT/jm7MtU6TebYuRmzEOI7w40UA=="],
|
||||
|
||||
"@xtuc/ieee754": ["@xtuc/ieee754@1.2.0", "", {}, "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA=="],
|
||||
|
||||
"@xtuc/long": ["@xtuc/long@4.2.2", "", {}, "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="],
|
||||
|
||||
"abort-controller": ["abort-controller@3.0.0", "", { "dependencies": { "event-target-shim": "^5.0.0" } }, "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg=="],
|
||||
|
||||
"acorn": ["acorn@8.18.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ=="],
|
||||
@@ -1705,18 +1592,12 @@
|
||||
|
||||
"adm-zip": ["adm-zip@0.6.0", "", {}, "sha512-XleryMhbuksdKtofnWZ9Sk+4CUTbms4Mb/EU32SZwToAyZ5RgVos/ki8n+yr0LWHOGKuakbXTuuYNHLQjhddgg=="],
|
||||
|
||||
"aes-decrypter": ["aes-decrypter@4.0.2", "", { "dependencies": { "@babel/runtime": "^7.12.5", "@videojs/vhs-utils": "^4.1.1", "global": "^4.4.0", "pkcs7": "^1.0.4" } }, "sha512-lc+/9s6iJvuaRe5qDlMTpCFjnwpkeOXp8qP3oiZ5jsj1MRg+SBVUmmICrhxHvc8OELSmc+fEyyxAuppY6hrWzw=="],
|
||||
|
||||
"agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="],
|
||||
|
||||
"ai": ["ai@7.0.84", "", { "dependencies": { "@ai-sdk/gateway": "4.0.68", "@ai-sdk/provider": "4.0.8", "@ai-sdk/provider-utils": "5.0.33" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-znHNBWADOy79k8EK7636kDm5LmnjF4tMzegC2TfmlLDobDZbs0z0OXD2sxtH3eDTp5Re+pJQESvjinWJ6+kadQ=="],
|
||||
|
||||
"ajv": ["ajv@6.15.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
|
||||
|
||||
"ajv-formats": ["ajv-formats@2.1.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA=="],
|
||||
|
||||
"ajv-keywords": ["ajv-keywords@5.1.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3" }, "peerDependencies": { "ajv": "^8.8.2" } }, "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw=="],
|
||||
|
||||
"ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
||||
|
||||
"ansi-styles": ["ansi-styles@5.2.0", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="],
|
||||
@@ -1789,6 +1670,8 @@
|
||||
|
||||
"baseline-browser-mapping": ["baseline-browser-mapping@2.11.20", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw=="],
|
||||
|
||||
"batch-cluster": ["batch-cluster@19.2.0", "", {}, "sha512-mvozaN/7TYxl+lmXDYH+HocCcRMvW25QmghrJux2y93o+NhHPQ4wir0nBS1p8oTlinjc/l5LaNX+VFxNISrqgQ=="],
|
||||
|
||||
"bcrypt-pbkdf": ["bcrypt-pbkdf@1.0.2", "", { "dependencies": { "tweetnacl": "^0.14.3" } }, "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w=="],
|
||||
|
||||
"better-auth": ["better-auth@1.6.11", "", { "dependencies": { "@better-auth/core": "1.6.11", "@better-auth/drizzle-adapter": "1.6.11", "@better-auth/kysely-adapter": "1.6.11", "@better-auth/memory-adapter": "1.6.11", "@better-auth/mongo-adapter": "1.6.11", "@better-auth/prisma-adapter": "1.6.11", "@better-auth/telemetry": "1.6.11", "@better-auth/utils": "0.4.0", "@better-fetch/fetch": "1.1.21", "@noble/ciphers": "^2.1.1", "@noble/hashes": "^2.0.1", "better-call": "1.3.5", "defu": "^6.1.4", "jose": "^6.1.3", "kysely": "^0.28.17", "nanostores": "^1.1.1", "zod": "^4.3.6" }, "peerDependencies": { "@lynx-js/react": "*", "@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0", "@sveltejs/kit": "^2.0.0", "@tanstack/react-start": "^1.0.0", "@tanstack/solid-start": "^1.0.0", "better-sqlite3": "^12.0.0", "drizzle-kit": ">=0.31.4", "drizzle-orm": "^0.45.2", "mongodb": "^6.0.0 || ^7.0.0", "mysql2": "^3.0.0", "next": "^14.0.0 || ^15.0.0 || ^16.0.0", "pg": "^8.0.0", "prisma": "^5.0.0 || ^6.0.0 || ^7.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0", "solid-js": "^1.0.0", "svelte": "^4.0.0 || ^5.0.0", "vitest": "^2.0.0 || ^3.0.0 || ^4.0.0", "vue": "^3.0.0" }, "optionalPeers": ["@lynx-js/react", "@prisma/client", "@sveltejs/kit", "@tanstack/react-start", "@tanstack/solid-start", "better-sqlite3", "drizzle-kit", "drizzle-orm", "mongodb", "mysql2", "next", "pg", "prisma", "react", "react-dom", "solid-js", "svelte", "vitest", "vue"] }, "sha512-Wwt6+q07dwIhsp6XiM7L1qSXVUWBEtNl+eZvwM778CguFqDZFBN9Pt6LtFaHl55t8Z+Zc//5kxcbgDY8/79vFQ=="],
|
||||
@@ -1815,8 +1698,6 @@
|
||||
|
||||
"buffer-equal-constant-time": ["buffer-equal-constant-time@1.0.1", "", {}, "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="],
|
||||
|
||||
"buffer-from": ["buffer-from@1.1.2", "", {}, "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="],
|
||||
|
||||
"buffer-image-size": ["buffer-image-size@0.6.4", "", { "dependencies": { "@types/node": "*" } }, "sha512-nEh+kZOPY1w+gcCMobZ6ETUp9WfibndnosbpwB1iJk/8Gt5ZF2bhS6+B6bPYz424KtwsR6Rflc3tCz1/ghX2dQ=="],
|
||||
|
||||
"buildcheck": ["buildcheck@0.0.7", "", {}, "sha512-lHblz4ahamxpTmnsk+MNTRWsjYKv965MwOrSJyeD588rR3Jcu7swE+0wN5F+PbL5cjgu/9ObkhfzEPuofEMwLA=="],
|
||||
@@ -1859,8 +1740,6 @@
|
||||
|
||||
"chownr": ["chownr@1.1.4", "", {}, "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="],
|
||||
|
||||
"chrome-trace-event": ["chrome-trace-event@1.0.4", "", {}, "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ=="],
|
||||
|
||||
"class-variance-authority": ["class-variance-authority@0.7.1", "", { "dependencies": { "clsx": "^2.1.1" } }, "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg=="],
|
||||
|
||||
"classnames": ["classnames@2.5.1", "", {}, "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow=="],
|
||||
@@ -1899,6 +1778,8 @@
|
||||
|
||||
"cookie-es": ["cookie-es@3.1.1", "", {}, "sha512-UaXxwISYJPTr9hwQxMFYZ7kNhSXboMXP+Z3TRX6f1/NyaGPfuNUZOWP1pUEb75B2HjfklIYLVRfWiFZJyC6Npg=="],
|
||||
|
||||
"copy-anything": ["copy-anything@3.0.5", "", { "dependencies": { "is-what": "^4.1.8" } }, "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w=="],
|
||||
|
||||
"core-util-is": ["core-util-is@1.0.3", "", {}, "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="],
|
||||
|
||||
"cpu-features": ["cpu-features@0.0.10", "", { "dependencies": { "buildcheck": "~0.0.6", "nan": "^2.19.0" } }, "sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA=="],
|
||||
@@ -1995,8 +1876,6 @@
|
||||
|
||||
"dom-accessibility-api": ["dom-accessibility-api@0.5.16", "", {}, "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg=="],
|
||||
|
||||
"dom-walk": ["dom-walk@0.1.2", "", {}, "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w=="],
|
||||
|
||||
"dotenv": ["dotenv@17.4.2", "", {}, "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw=="],
|
||||
|
||||
"dotenv-expand": ["dotenv-expand@13.0.0", "", { "dependencies": { "dotenv": "^17.4.2" } }, "sha512-aBfBS8eYIeXmpHI9ThIlA7/WLq+SLt18iXUZhb52rW89QLKQFoIpPG1bPeewoPZsTyjSSO3T7234FBVUM1V2rA=="],
|
||||
@@ -2099,6 +1978,12 @@
|
||||
|
||||
"eventsource-parser": ["eventsource-parser@3.1.1", "", {}, "sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ=="],
|
||||
|
||||
"exiftool-vendored": ["exiftool-vendored@38.1.0", "", { "dependencies": { "@photostructure/tz-lookup": "^11.7.0", "@types/luxon": "^3.7.5", "batch-cluster": "^19.2.0", "he": "^1.2.0", "luxon": "^3.7.2" }, "optionalDependencies": { "exiftool-vendored.exe": "13.59.2", "exiftool-vendored.pl": "13.59.2" } }, "sha512-LIERqM/Qb0oqJlSswLFKWsxGVH81skp7omsX2BPKA/dEzfLP5syNO5KL7k5UlMCf+m0jqEXrKTQr/xV5vScPow=="],
|
||||
|
||||
"exiftool-vendored.exe": ["exiftool-vendored.exe@13.59.2", "", { "os": "win32" }, "sha512-U0l0CApIGO+AjpFYCiNCApQsMdlf6sqCyEl4wlKKqvwVAEVcvMRw91k7zj32OPFZE+/+XlLFsc6876MpOqBLiw=="],
|
||||
|
||||
"exiftool-vendored.pl": ["exiftool-vendored.pl@13.59.2", "", { "os": "!win32", "bin": { "exiftool": "bin/exiftool" } }, "sha512-5B80JT9phZSUsc7zz77rQ6DfW0YssTpJ5qW/1bOH1N8XQq/jcn+9eRW9HFwhVT9uoIliw9Fg007ST3pUzQIzyw=="],
|
||||
|
||||
"expect-type": ["expect-type@1.4.0", "", {}, "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA=="],
|
||||
|
||||
"exsolve": ["exsolve@1.1.1", "", {}, "sha512-9U/jZUgjnSGyntRr6y5Muu1MJcwFl6kPu7k8qLF0IMNfLqvw0NZ4nnVDq0RVoZ0RvCyumib4Ez3KYrVfilrw+g=="],
|
||||
@@ -2163,8 +2048,6 @@
|
||||
|
||||
"fs-constants": ["fs-constants@1.0.0", "", {}, "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="],
|
||||
|
||||
"fs-monkey": ["fs-monkey@1.1.0", "", {}, "sha512-QMUezzXWII9EV5aTFXW1UBVUO77wYPpjqIF8/AviUCThNeSYZykpoTixUeaNNBwmCev0AMDWMAni+f8Hxb1IFw=="],
|
||||
|
||||
"fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
|
||||
@@ -2205,10 +2088,6 @@
|
||||
|
||||
"glob-parent": ["glob-parent@6.0.2", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="],
|
||||
|
||||
"glob-to-regex.js": ["glob-to-regex.js@1.2.0", "", { "peerDependencies": { "tslib": "2" } }, "sha512-QMwlOQKU/IzqMUOAZWubUOT8Qft+Y0KQWnX9nK3ch0CJg0tTp4TvGZsTfudYKv2NzoQSyPcnA6TYeIQ3jGichQ=="],
|
||||
|
||||
"global": ["global@4.4.0", "", { "dependencies": { "min-document": "^2.19.0", "process": "^0.11.10" } }, "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w=="],
|
||||
|
||||
"globals": ["globals@17.11.0", "", {}, "sha512-Z2I8hM+PbJDXQDq3Icgpzv+mPdwr68iZUU9d5WW4FuXfDUQfkZaZuvjMv42/5crNyw154+9+VWXbYrUgDXbxNw=="],
|
||||
|
||||
"globalthis": ["globalthis@1.0.4", "", { "dependencies": { "define-properties": "^1.2.1", "gopd": "^1.0.1" } }, "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ=="],
|
||||
@@ -2231,8 +2110,6 @@
|
||||
|
||||
"has-bigints": ["has-bigints@1.1.0", "", {}, "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg=="],
|
||||
|
||||
"has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
|
||||
|
||||
"has-property-descriptors": ["has-property-descriptors@1.0.2", "", { "dependencies": { "es-define-property": "^1.0.0" } }, "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg=="],
|
||||
|
||||
"has-proto": ["has-proto@1.2.0", "", { "dependencies": { "dunder-proto": "^1.0.0" } }, "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ=="],
|
||||
@@ -2247,10 +2124,12 @@
|
||||
|
||||
"hast-util-whitespace": ["hast-util-whitespace@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw=="],
|
||||
|
||||
"heap-js": ["heap-js@2.7.1", "", {}, "sha512-EQfezRg0NCZGNlhlDR3Evrw1FVL2G3LhU7EgPoxufQKruNBSYA8MiRPHeWbU+36o+Fhel0wMwM+sLEiBAlNLJA=="],
|
||||
"he": ["he@1.2.0", "", { "bin": { "he": "bin/he" } }, "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="],
|
||||
|
||||
"help-me": ["help-me@5.0.0", "", {}, "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg=="],
|
||||
|
||||
"hls.js": ["hls.js@1.7.3", "", {}, "sha512-MsPlx6yVW4Qv4C7mEVou4/gk/5cN2dVxOTnrNjPSmyH2f0Ln+/UkG10Ax1PE6OvrmTVPKgQYozTtBaPOuCzq7A=="],
|
||||
|
||||
"hono": ["hono@4.13.5", "", {}, "sha512-O6+/eCYRkzzzy0rPWwKLiGBR1nFuUPZynnwjxN1MBA62NNqbT0wQEzQyK2gSO5yDIDB336sXQleAhOHrzlYyKw=="],
|
||||
|
||||
"html-url-attributes": ["html-url-attributes@3.0.1", "", {}, "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ=="],
|
||||
@@ -2259,8 +2138,6 @@
|
||||
|
||||
"https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="],
|
||||
|
||||
"hyperdyperid": ["hyperdyperid@1.2.0", "", {}, "sha512-Y93lCzHYgGWdrJ66yIktxiaGULYc6oGiABxhcO5AufBeOyoIdZF7bIfLaOrbM0iGIOXQQgxxRrFEnb+Y6w1n4A=="],
|
||||
|
||||
"iconv-lite": ["iconv-lite@0.7.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ=="],
|
||||
|
||||
"ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
|
||||
@@ -2311,8 +2188,6 @@
|
||||
|
||||
"is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="],
|
||||
|
||||
"is-function": ["is-function@1.0.2", "", {}, "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ=="],
|
||||
|
||||
"is-generator-function": ["is-generator-function@1.1.2", "", { "dependencies": { "call-bound": "^1.0.4", "generator-function": "^2.0.0", "get-proto": "^1.0.1", "has-tostringtag": "^1.0.2", "safe-regex-test": "^1.1.0" } }, "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA=="],
|
||||
|
||||
"is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="],
|
||||
@@ -2351,6 +2226,8 @@
|
||||
|
||||
"is-weakset": ["is-weakset@2.0.4", "", { "dependencies": { "call-bound": "^1.0.3", "get-intrinsic": "^1.2.6" } }, "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ=="],
|
||||
|
||||
"is-what": ["is-what@4.1.16", "", {}, "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A=="],
|
||||
|
||||
"isarray": ["isarray@2.0.5", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="],
|
||||
|
||||
"isbot": ["isbot@5.2.2", "", {}, "sha512-iQcBXcd+Rv/pkubRyGh2utW2j1oPG5hZY6TUhVPpqK4G+o3IbxpJNx04hgksjc/N7GK5pEorUxDeg31cFgEk/w=="],
|
||||
@@ -2365,8 +2242,6 @@
|
||||
|
||||
"jackspeak": ["jackspeak@3.4.3", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw=="],
|
||||
|
||||
"jest-worker": ["jest-worker@27.5.1", "", { "dependencies": { "@types/node": "*", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" } }, "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg=="],
|
||||
|
||||
"jiti": ["jiti@2.7.0", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="],
|
||||
|
||||
"jittered-fractional-indexing": ["jittered-fractional-indexing@1.0.1", "", { "dependencies": { "fractional-indexing": "^3.2.0" } }, "sha512-OpKFkVr4hU5ivd1ZCjZfHvVpWekraJvcePcMusBmgBmCVQK5JiRCA+4TT1vAUTLqGD9MkhqFwO0l3QspvlZgzw=="],
|
||||
@@ -2465,9 +2340,9 @@
|
||||
|
||||
"lucide-react": ["lucide-react@1.37.0", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-LPsB4rD1TD6wZu1djKOf9vUnS1jTNaHbolXebXDgiTdb6jeA1agIJhJsIybCmjKmQClcOaal1o1OaiYahEftyQ=="],
|
||||
|
||||
"lz-string": ["lz-string@1.5.0", "", { "bin": { "lz-string": "bin/bin.js" } }, "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ=="],
|
||||
"luxon": ["luxon@3.7.2", "", {}, "sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew=="],
|
||||
|
||||
"m3u8-parser": ["m3u8-parser@7.2.0", "", { "dependencies": { "@babel/runtime": "^7.12.5", "@videojs/vhs-utils": "^4.1.1", "global": "^4.4.0" } }, "sha512-CRatFqpjVtMiMaKXxNvuI3I++vUumIXVVT/JpCpdU/FynV/ceVw1qpPyyBNindL+JlPMSesx+WX1QJaZEJSaMQ=="],
|
||||
"lz-string": ["lz-string@1.5.0", "", { "bin": { "lz-string": "bin/bin.js" } }, "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ=="],
|
||||
|
||||
"magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
|
||||
|
||||
@@ -2489,10 +2364,6 @@
|
||||
|
||||
"mdast-util-to-string": ["mdast-util-to-string@4.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0" } }, "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg=="],
|
||||
|
||||
"memfs": ["memfs@4.68.2", "", { "dependencies": { "@jsonjoy.com/fs-core": "4.68.2", "@jsonjoy.com/fs-fsa": "4.68.2", "@jsonjoy.com/fs-node": "4.68.2", "@jsonjoy.com/fs-node-builtins": "4.68.2", "@jsonjoy.com/fs-node-to-fsa": "4.68.2", "@jsonjoy.com/fs-node-utils": "4.68.2", "@jsonjoy.com/fs-print": "4.68.2", "@jsonjoy.com/fs-snapshot": "4.68.2", "@jsonjoy.com/json-pack": "^1.11.0", "@jsonjoy.com/util": "^1.9.0", "glob-to-regex.js": "^1.0.1", "thingies": "^2.5.0", "tree-dump": "^1.0.3", "tslib": "^2.0.0" } }, "sha512-Un1ElEBoIdPI9kg0sm3LebVEuEViodfIvlaG8Z1MFXa7ZnR9vWuPKUo3dt/vuWY2ivc05l76B5QOjdgCzAzmGw=="],
|
||||
|
||||
"merge-stream": ["merge-stream@2.0.0", "", {}, "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w=="],
|
||||
|
||||
"micromark": ["micromark@4.0.2", "", { "dependencies": { "@types/debug": "^4.0.0", "debug": "^4.0.0", "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "micromark-core-commonmark": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-combine-extensions": "^2.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-encode": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-sanitize-uri": "^2.0.0", "micromark-util-subtokenize": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA=="],
|
||||
|
||||
"micromark-core-commonmark": ["micromark-core-commonmark@2.0.3", "", { "dependencies": { "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "micromark-factory-destination": "^2.0.0", "micromark-factory-label": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-factory-title": "^2.0.0", "micromark-factory-whitespace": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-classify-character": "^2.0.0", "micromark-util-html-tag-name": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-subtokenize": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg=="],
|
||||
@@ -2535,30 +2406,20 @@
|
||||
|
||||
"micromark-util-types": ["micromark-util-types@2.0.2", "", {}, "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA=="],
|
||||
|
||||
"mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="],
|
||||
|
||||
"mime-match": ["mime-match@1.0.2", "", { "dependencies": { "wildcard": "^1.1.0" } }, "sha512-VXp/ugGDVh3eCLOBCiHZMYWQaTNUHv2IJrut+yXA6+JbLPXHglHwfS/5A5L0ll+jkCY7fIzRJcH6OIunF+c6Cg=="],
|
||||
|
||||
"min-document": ["min-document@2.19.2", "", { "dependencies": { "dom-walk": "^0.1.0" } }, "sha512-8S5I8db/uZN8r9HSLFVWPdJCvYOejMcEC82VIzNUc6Zkklf/d1gg2psfE79/vyhWOj4+J8MtwmoOz3TmvaGu5A=="],
|
||||
|
||||
"minimatch": ["minimatch@10.2.6", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="],
|
||||
|
||||
"minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="],
|
||||
|
||||
"minimizer-webpack-plugin": ["minimizer-webpack-plugin@5.8.0", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.31", "jest-worker": "^27.4.5", "schema-utils": "^4.3.3", "terser": "^5.51.0" }, "peerDependencies": { "@minify-html/node": "*", "@swc/core": "*", "@swc/css": "*", "@swc/html": "*", "clean-css": "*", "cssnano": "*", "csso": "*", "esbuild": "*", "html-minifier-terser": "*", "lightningcss": "*", "postcss": "*", "uglify-js": "*", "webpack": "^5.1.0" }, "optionalPeers": ["@minify-html/node", "@swc/core", "@swc/css", "@swc/html", "clean-css", "cssnano", "csso", "esbuild", "html-minifier-terser", "lightningcss", "postcss", "uglify-js"] }, "sha512-2cT9+goJfBhtMz+gJqejSf09ClgmYhPhccRb/fb0ztVbixt0BkO8mRuI26FoPPuUNkRk6iEDryWAIouc5W8eJA=="],
|
||||
|
||||
"minipass": ["minipass@7.1.3", "", {}, "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A=="],
|
||||
|
||||
"mkdirp": ["mkdirp@3.0.1", "", { "bin": { "mkdirp": "dist/cjs/src/bin.js" } }, "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg=="],
|
||||
|
||||
"mkdirp-classic": ["mkdirp-classic@0.5.3", "", {}, "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="],
|
||||
|
||||
"mpd-parser": ["mpd-parser@1.4.0", "", { "dependencies": { "@babel/runtime": "^7.12.5", "@videojs/vhs-utils": "^4.1.2", "@xmldom/xmldom": "^0.8.3", "global": "^4.4.0" }, "bin": { "mpd-to-m3u8-json": "bin/parse.js" } }, "sha512-blbA7XpAaOdC/PR0Tu8GiUxlx6CpBuRowQPYV7lhi9Yr9G9+dkPXIUjqjzc/NCn/uZZPopluaJlIYntIEI/VLw=="],
|
||||
|
||||
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
|
||||
|
||||
"mux.js": ["mux.js@7.1.0", "", { "dependencies": { "@babel/runtime": "^7.11.2", "global": "^4.4.0" }, "bin": { "muxjs-transmux": "bin/transmux.js" } }, "sha512-NTxawK/BBELJrYsZThEulyUMDVlLizKdxyAsMuzoCD1eFj97BVaA8D/CvKsKu6FOLYkFojN5CbM9h++ZTZtknA=="],
|
||||
|
||||
"mysql2": ["mysql2@3.15.3", "", { "dependencies": { "aws-ssl-profiles": "^1.1.1", "denque": "^2.1.0", "generate-function": "^2.3.1", "iconv-lite": "^0.7.0", "long": "^5.2.1", "lru.min": "^1.0.0", "named-placeholders": "^1.1.3", "seq-queue": "^0.0.5", "sqlstring": "^2.3.2" } }, "sha512-FBrGau0IXmuqg4haEZRBfHNWB5mUARw6hNwPDXXGg0XzVJ50mr/9hb267lvpVMnhZ1FON3qNd4Xfcez1rbFwSg=="],
|
||||
|
||||
"named-placeholders": ["named-placeholders@1.1.6", "", { "dependencies": { "lru.min": "^1.1.0" } }, "sha512-Tz09sEL2EEuv5fFowm419c1+a/jSMiBjI9gHxVLrVdbUkkNUUfjsVYs9pVZu5oCon/kmRh9TfLEObFtkVxmY0w=="],
|
||||
@@ -2573,12 +2434,8 @@
|
||||
|
||||
"natural-compare": ["natural-compare@1.4.0", "", {}, "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="],
|
||||
|
||||
"neo-async": ["neo-async@2.6.2", "", {}, "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw=="],
|
||||
|
||||
"next-themes": ["next-themes@0.4.6", "", { "peerDependencies": { "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc", "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" } }, "sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA=="],
|
||||
|
||||
"nexus-rpc": ["nexus-rpc@0.0.3", "", {}, "sha512-ksIBeYHDv6FHAR1h3Vwk0kQ6REhdo1STqDHXMzu/yn/VN/XzgOor2IUjewG6paoA7IgxlIPZoOU/PD78PC6HTg=="],
|
||||
|
||||
"node-domexception": ["node-domexception@1.0.0", "", {}, "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ=="],
|
||||
|
||||
"node-emoji": ["node-emoji@2.2.0", "", { "dependencies": { "@sindresorhus/is": "^4.6.0", "char-regex": "^1.0.2", "emojilib": "^2.4.0", "skin-tone": "^2.0.0" } }, "sha512-Z3lTE9pLaJF47NyMhd4ww1yFTAP8YhYI8SleJiHzM46Fgpm5cnNzSl9XfzFNqbaz+VlJrIj3fXQ4DeN1Rjm6cw=="],
|
||||
@@ -2591,6 +2448,8 @@
|
||||
|
||||
"node-releases": ["node-releases@2.0.54", "", {}, "sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ=="],
|
||||
|
||||
"nodemailer": ["nodemailer@10.0.10", "", {}, "sha512-He9XskOFms62SyAKkLu8CcGcYHAo+BSHSsORI8s4PJH8qZgZY4L4lDfvyN0twvmbpyG+eGrxpyBlskj9d9rJ8A=="],
|
||||
|
||||
"normalize-path": ["normalize-path@3.0.0", "", {}, "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="],
|
||||
|
||||
"object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="],
|
||||
@@ -2687,8 +2546,6 @@
|
||||
|
||||
"pkce-challenge": ["pkce-challenge@5.0.1", "", {}, "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ=="],
|
||||
|
||||
"pkcs7": ["pkcs7@1.0.4", "", { "dependencies": { "@babel/runtime": "^7.5.5" }, "bin": { "pkcs7": "bin/cli.js" } }, "sha512-afRERtHn54AlwaF2/+LFszyAANTCggGilmcmILUzEjvs3XgFZT+xE6+QWQcAGmu4xajy+Xtj7acLOPdx5/eXWQ=="],
|
||||
|
||||
"pkg-types": ["pkg-types@2.3.1", "", { "dependencies": { "confbox": "^0.2.4", "exsolve": "^1.0.8", "pathe": "^2.0.3" } }, "sha512-y+ichcgc2LrADuhLNAx8DFjVfgz91pRxfZdI3UDhxHvcVEZsenLO+7XaU5vOp0u/7V/wZ+plyuQxtrDlZJ+yeg=="],
|
||||
|
||||
"playwright": ["playwright@1.61.1", "", { "dependencies": { "playwright-core": "1.61.1" }, "optionalDependencies": { "fsevents": "2.3.2" }, "bin": { "playwright": "cli.js" } }, "sha512-DWnY5o3YbLWK4GovuAVwpqL+1VwGNdUGrRr++8j8PtQQzvAVZUIMjKQ90fY689sEJZJBbZVw1rXaOKSTitkzPQ=="],
|
||||
@@ -2829,8 +2686,6 @@
|
||||
|
||||
"rou3": ["rou3@0.7.12", "", {}, "sha512-iFE4hLDuloSWcD7mjdCDhx2bKcIsYbtOTpfH5MHHLSKMOUyjqQXTeZVa289uuwEGEKFoE/BAPbhaU4B774nceg=="],
|
||||
|
||||
"rxjs": ["rxjs@7.8.2", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA=="],
|
||||
|
||||
"safe-array-concat": ["safe-array-concat@1.1.4", "", { "dependencies": { "call-bind": "^1.0.9", "call-bound": "^1.0.4", "get-intrinsic": "^1.3.0", "has-symbols": "^1.1.0", "isarray": "^2.0.5" } }, "sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg=="],
|
||||
|
||||
"safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
|
||||
@@ -2847,14 +2702,14 @@
|
||||
|
||||
"scheduler": ["scheduler@0.27.0", "", {}, "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q=="],
|
||||
|
||||
"schema-utils": ["schema-utils@4.3.3", "", { "dependencies": { "@types/json-schema": "^7.0.9", "ajv": "^8.9.0", "ajv-formats": "^2.1.1", "ajv-keywords": "^5.1.0" } }, "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA=="],
|
||||
|
||||
"secure-json-parse": ["secure-json-parse@4.1.0", "", {}, "sha512-l4KnYfEyqYJxDwlNVyRfO2E4NTHfMKAWdUuA8J0yve2Dz/E/PdBepY03RvyJpssIpRFwJoCD55wA+mEDs6ByWA=="],
|
||||
|
||||
"semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
|
||||
|
||||
"seq-queue": ["seq-queue@0.0.5", "", {}, "sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q=="],
|
||||
|
||||
"serialize-error": ["serialize-error@8.1.0", "", { "dependencies": { "type-fest": "^0.20.2" } }, "sha512-3NnuWfM6vBYoy5gZFvHiYsVbafvI9vZv/+jlIigFn4oP4zjNPK3LhcY0xSCgeb1a5L8jO71Mit9LlNoi2UfDDQ=="],
|
||||
|
||||
"seroval": ["seroval@1.6.4", "", {}, "sha512-LErWMNS2RRFdu2RMA5u/PA59/IWs0XsikyEXGQ2/36iEWFrdG0ABmg17E17cikrv76891kOAMq3TkTFXpwAHXw=="],
|
||||
|
||||
"seroval-plugins": ["seroval-plugins@1.6.4", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-R0f1U9hmn38+dFMz6b6ab8lwucmw4AtiY7St+JPWudy1dm+Bs3g884nyrsH9Cy6rKpZKLYayXuMda9GZ/fl8JQ=="],
|
||||
@@ -2891,14 +2746,8 @@
|
||||
|
||||
"sonner": ["sonner@2.0.8", "", { "peerDependencies": { "@types/react": "^18.0.0 || ^19.0.0", "react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc", "react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-UM/ByIoFra8yzV75n1o0Puu0bw5U/9UNnDacrJNspekBewIfsQ3D6ez1nvlWpt7aTsO6rujQtifBpycwIivqlg=="],
|
||||
|
||||
"source-map": ["source-map@0.7.6", "", {}, "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ=="],
|
||||
|
||||
"source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],
|
||||
|
||||
"source-map-loader": ["source-map-loader@5.0.0", "", { "dependencies": { "iconv-lite": "^0.6.3", "source-map-js": "^1.0.2" }, "peerDependencies": { "webpack": "^5.72.1" } }, "sha512-k2Dur7CbSLcAH73sBcIkV5xjPV4SzqO1NJ7+XaQl8if3VODDUj3FNchNGpqgJSKbvUfJuhVdv8K2Eu8/TNl2eA=="],
|
||||
|
||||
"source-map-support": ["source-map-support@0.5.21", "", { "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w=="],
|
||||
|
||||
"space-separated-tokens": ["space-separated-tokens@2.0.2", "", {}, "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q=="],
|
||||
|
||||
"split-ca": ["split-ca@1.0.1", "", {}, "sha512-Q5thBSxp5t8WPTTJQS59LrGqOZqOsrhDGDVm8azCqIBjSBd7nd9o2PM+mDulQQkh8h//4U6hFZnc/mul8t5pWQ=="],
|
||||
@@ -2949,12 +2798,10 @@
|
||||
|
||||
"style-to-object": ["style-to-object@1.0.14", "", { "dependencies": { "inline-style-parser": "0.2.7" } }, "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw=="],
|
||||
|
||||
"supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
|
||||
"superjson": ["superjson@1.13.3", "", { "dependencies": { "copy-anything": "^3.0.2" } }, "sha512-mJiVjfd2vokfDxsQPOwJ/PtanO87LhpYY88ubI5dUB1Ab58Txbyje3+jpm+/83R/fevaq/107NNhtYBLuoTrFg=="],
|
||||
|
||||
"supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="],
|
||||
|
||||
"swc-loader": ["swc-loader@0.2.7", "", { "dependencies": { "@swc/counter": "^0.1.3" }, "peerDependencies": { "@swc/core": "^1.2.147", "webpack": ">=2" } }, "sha512-nwYWw3Fh9ame3Rtm7StS9SBLpHRRnYcK7bnpF3UKZmesAK0gw2/ADvlURFAINmPvKtDLzp+GBiP9yLoEjg6S9w=="],
|
||||
|
||||
"synckit": ["synckit@0.11.13", "", { "dependencies": { "@pkgr/core": "^0.3.6" } }, "sha512-eNRKgb3z66Yp3D2CixVujOUvXLFUTij/zVnV8KRyvFdQwpz7I5DS8UfRkTeLzb64u+dkzDSdelE24izu+zSSUg=="],
|
||||
|
||||
"tabbable": ["tabbable@6.5.0", "", {}, "sha512-wieBHXygIm7OyQOu5hQlkk62/WyCFYGlWg7L6/ZCUZwx0o398Zkn4pVmMyfYhfMG8kGrj/Krt8eIk6UKC6VzwA=="],
|
||||
@@ -2973,14 +2820,10 @@
|
||||
|
||||
"teex": ["teex@1.0.1", "", { "dependencies": { "streamx": "^2.12.5" } }, "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg=="],
|
||||
|
||||
"terser": ["terser@5.51.2", "", { "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.15.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, "bin": { "terser": "bin/terser" } }, "sha512-bWnjSNscmuI+GJze6ZupnHP8G/cTcsJF+bXCeQknk2SHQsgbNJnLrqiH9jZ2W4STPVXH2mDKKRX3iwPhc9Cn/Q=="],
|
||||
|
||||
"testcontainers": ["testcontainers@12.1.0", "", { "dependencies": { "@balena/dockerignore": "^1.0.2", "@types/dockerode": "^4.0.1", "archiver": "^7.0.1", "async-lock": "^1.4.1", "byline": "^5.0.0", "debug": "^4.4.3", "docker-compose": "^1.4.2", "dockerode": "^5.0.1", "get-port": "^5.1.1", "proper-lockfile": "^4.1.2", "properties-reader": "^3.0.1", "ssh-remote-port-forward": "^1.0.4", "tar-fs": "^3.1.3", "tmp": "^0.2.7", "undici": "^8.9.0" } }, "sha512-YjDLqIITuhGLMnM10yhg3oV6lIG5IMpz1R1DPBZoOOks83q7i7IVpeSWRTiyl7roozjiyLmwIoLK/KY8OnZmIA=="],
|
||||
|
||||
"text-decoder": ["text-decoder@1.2.7", "", { "dependencies": { "b4a": "^1.6.4" } }, "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ=="],
|
||||
|
||||
"thingies": ["thingies@2.6.1", "", { "peerDependencies": { "tslib": "^2" } }, "sha512-cV/CMGTK3M4MlnJ/0At6ismOw/A0EEniDNScajjz/Br3c1sqE72YD01rGpPTKwd27wAxI5Pr+6+0w8yofzFRYw=="],
|
||||
|
||||
"thread-stream": ["thread-stream@4.2.0", "", { "dependencies": { "real-require": "^1.0.0" } }, "sha512-e2zZ96wSChazBsbENf/Pcm/4swHt2cEKQ92rhUjkL9GCKiTDJIaTBenjE/m9DXi0QBmTMDkFDdOomUy20A1tDQ=="],
|
||||
|
||||
"tiny-inflate": ["tiny-inflate@1.0.3", "", {}, "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw=="],
|
||||
@@ -2997,8 +2840,6 @@
|
||||
|
||||
"tmp": ["tmp@0.2.7", "", {}, "sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw=="],
|
||||
|
||||
"tree-dump": ["tree-dump@1.1.0", "", { "peerDependencies": { "tslib": "2" } }, "sha512-rMuvhU4MCDbcbnleZTFezWsaZXRFemSqAM+7jPnzUl1fo9w3YEKOxAeui0fz3OI4EU4hf23iyA7uQRVko+UaBA=="],
|
||||
|
||||
"trim-lines": ["trim-lines@3.0.1", "", {}, "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="],
|
||||
|
||||
"trough": ["trough@2.2.0", "", {}, "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw=="],
|
||||
@@ -3019,6 +2860,8 @@
|
||||
|
||||
"type-check": ["type-check@0.4.0", "", { "dependencies": { "prelude-ls": "^1.2.1" } }, "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew=="],
|
||||
|
||||
"type-fest": ["type-fest@0.20.2", "", {}, "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ=="],
|
||||
|
||||
"typebox": ["typebox@1.3.22", "", {}, "sha512-YoX6QdtuJR/+YpP/qXf9gJXTxvSuiUlKYgW3AilsOSLlsZe/VH6ILR5vhoJM5QXY//uzIRE7NYij3h2+nG9vRQ=="],
|
||||
|
||||
"typed-array-buffer": ["typed-array-buffer@1.0.3", "", { "dependencies": { "call-bound": "^1.0.3", "es-errors": "^1.3.0", "is-typed-array": "^1.1.14" } }, "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw=="],
|
||||
@@ -3051,8 +2894,6 @@
|
||||
|
||||
"unified": ["unified@11.0.5", "", { "dependencies": { "@types/unist": "^3.0.0", "bail": "^2.0.0", "devlop": "^1.0.0", "extend": "^3.0.0", "is-plain-obj": "^4.0.0", "trough": "^2.0.0", "vfile": "^6.0.0" } }, "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA=="],
|
||||
|
||||
"unionfs": ["unionfs@4.6.0", "", { "dependencies": { "fs-monkey": "^1.0.0" } }, "sha512-fJAy3gTHjFi5S3TP5EGdjs/OUMFFvI/ady3T8qVuZfkv8Qi8prV/Q8BuFEgODJslhZTT2z2qdD2lGdee9qjEnA=="],
|
||||
|
||||
"unist-util-is": ["unist-util-is@6.0.1", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g=="],
|
||||
|
||||
"unist-util-position": ["unist-util-position@5.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA=="],
|
||||
@@ -3081,7 +2922,7 @@
|
||||
|
||||
"util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],
|
||||
|
||||
"uuid": ["uuid@11.1.1", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ=="],
|
||||
"uuid": ["uuid@14.0.2", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-xZe/16rV4aa+HGSOCiY2YeLT1OybRLrrkL/Rqaq7p7GMVXjFh+6wN4oMYgjFmnSnhY8t6Xpdl2l9qmnHYuMHwQ=="],
|
||||
|
||||
"valibot": ["valibot@1.4.2", "", { "peerDependencies": { "typescript": ">=5" }, "optionalPeers": ["typescript"] }, "sha512-gjdCvJ6d3RyHAneqxMYMW9QMCwYMb3jpOO0IyHZV1bnRHFBHrX3VkIILt5XYR0WhwHiH7Mty8ovuPZ/O3gamrg=="],
|
||||
|
||||
@@ -3093,28 +2934,14 @@
|
||||
|
||||
"victory-vendor": ["victory-vendor@37.3.6", "", { "dependencies": { "@types/d3-array": "^3.0.3", "@types/d3-ease": "^3.0.0", "@types/d3-interpolate": "^3.0.1", "@types/d3-scale": "^4.0.2", "@types/d3-shape": "^3.1.0", "@types/d3-time": "^3.0.0", "@types/d3-timer": "^3.0.0", "d3-array": "^3.1.6", "d3-ease": "^3.0.1", "d3-interpolate": "^3.0.1", "d3-scale": "^4.0.2", "d3-shape": "^3.1.0", "d3-time": "^3.0.0", "d3-timer": "^3.0.1" } }, "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ=="],
|
||||
|
||||
"video.js": ["video.js@8.24.0", "", { "dependencies": { "@babel/runtime": "^7.28.4", "@videojs/http-streaming": "^3.17.5", "@videojs/vhs-utils": "^4.1.2", "@videojs/xhr": "2.7.0", "aes-decrypter": "^4.0.2", "global": "4.4.0", "m3u8-parser": "^7.2.0", "mpd-parser": "^1.4.0", "mux.js": "^7.0.1", "videojs-contrib-quality-levels": "4.1.0", "videojs-font": "4.2.0", "videojs-vtt.js": "0.15.5" } }, "sha512-ZUuxTlDRkEWhpp2mvGCSFzI0Tc3zcC6IUZbIhBcZ3QW0Ms+IRp/tzYkhqexcMYwrcukRFiWWJmRANsLKvv8Vsg=="],
|
||||
|
||||
"videojs-contrib-quality-levels": ["videojs-contrib-quality-levels@4.1.0", "", { "dependencies": { "global": "^4.4.0" }, "peerDependencies": { "video.js": "^8" } }, "sha512-TfrXJJg1Bv4t6TOCMEVMwF/CoS8iENYsWNKip8zfhB5kTcegiFYezEA0eHAJPU64ZC8NQbxQgOwAsYU8VXbOWA=="],
|
||||
|
||||
"videojs-font": ["videojs-font@4.2.0", "", {}, "sha512-YPq+wiKoGy2/M7ccjmlvwi58z2xsykkkfNMyIg4xb7EZQQNwB71hcSsB3o75CqQV7/y5lXkXhI/rsGAS7jfEmQ=="],
|
||||
|
||||
"videojs-vtt.js": ["videojs-vtt.js@0.15.5", "", { "dependencies": { "global": "^4.3.1" } }, "sha512-yZbBxvA7QMYn15Lr/ZfhhLPrNpI/RmCSCqgIff57GC2gIrV5YfyzLfLyZMj0NnZSAz8syB4N0nHXpZg9MyrMOQ=="],
|
||||
|
||||
"vite": ["vite@8.2.2", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.5", "postcss": "^8.5.26", "rolldown": "~1.2.4", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.4.0 || ^0.5.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-cFKLV/PRgAUlIRm5WjMjJ86jrftzpqcgH+Us+DS8mI3CDNiH30Whrz8uHL3+MOLPAgqbMBAqWdAHAphOAM+z/Q=="],
|
||||
|
||||
"vite-tsconfig-paths": ["vite-tsconfig-paths@6.1.1", "", { "dependencies": { "debug": "^4.1.1", "globrex": "^0.1.2", "tsconfck": "^3.0.3" }, "peerDependencies": { "vite": "*" } }, "sha512-2cihq7zliibCCZ8P9cKJrQBkfgdvcFkOOc3Y02o3GWUDLgqjWsZudaoiuOwO/gzTzy17cS5F7ZPo4bsnS4DGkg=="],
|
||||
|
||||
"vitest": ["vitest@4.1.11", "", { "dependencies": { "@vitest/expect": "4.1.11", "@vitest/mocker": "4.1.11", "@vitest/pretty-format": "4.1.11", "@vitest/runner": "4.1.11", "@vitest/snapshot": "4.1.11", "@vitest/spy": "4.1.11", "@vitest/utils": "4.1.11", "es-module-lexer": "^2.0.0", "expect-type": "^1.3.0", "magic-string": "^0.30.21", "obug": "^2.1.1", "pathe": "^2.0.3", "picomatch": "^4.0.3", "std-env": "^4.0.0-rc.1", "tinybench": "^2.9.0", "tinyexec": "^1.0.2", "tinyglobby": "^0.2.15", "tinyrainbow": "^3.1.0", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", "why-is-node-running": "^2.3.0" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "4.1.11", "@vitest/browser-preview": "4.1.11", "@vitest/browser-webdriverio": "4.1.11", "@vitest/coverage-istanbul": "4.1.11", "@vitest/coverage-v8": "4.1.11", "@vitest/ui": "4.1.11", "happy-dom": "*", "jsdom": "*" }, "optionalPeers": ["@edge-runtime/vm", "@opentelemetry/api", "@types/node", "@vitest/browser-playwright", "@vitest/browser-preview", "@vitest/browser-webdriverio", "@vitest/coverage-istanbul", "@vitest/coverage-v8", "@vitest/ui", "happy-dom", "jsdom"], "bin": { "vitest": "./vitest.mjs" } }, "sha512-fhACrNXUidIbGSBr5FlbuBkO7VWC1ZyLl0DO4CU2DrQoAPxX84Ysxs+HeGQpii5lZWV1Q4gBZTTu49mF+A6Edw=="],
|
||||
|
||||
"watchpack": ["watchpack@2.5.2", "", { "dependencies": { "graceful-fs": "^4.1.2" } }, "sha512-6i/00NBjP4yGPs+caKSyRfpTF/8Torsu0MOW3mMzIbhgISFder8i7xbqgHlLMwJrdiN8ndBV3UA1/AfzPSr+jg=="],
|
||||
|
||||
"web-streams-polyfill": ["web-streams-polyfill@3.3.3", "", {}, "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw=="],
|
||||
|
||||
"webpack": ["webpack@5.110.1", "", { "dependencies": { "@types/estree": "^1.0.8", "@types/json-schema": "^7.0.15", "@webassemblyjs/ast": "^1.14.1", "@webassemblyjs/wasm-edit": "^1.14.1", "@webassemblyjs/wasm-parser": "^1.14.1", "acorn": "^8.16.0", "browserslist": "^4.28.1", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.24.4", "es-module-lexer": "^2.1.0", "events": "^3.2.0", "graceful-fs": "^4.2.11", "mime-db": "^1.54.0", "minimizer-webpack-plugin": "^5.7.0", "neo-async": "^2.6.2", "schema-utils": "^4.3.3", "tapable": "^2.3.0", "watchpack": "^2.5.2", "webpack-sources": "^3.5.1" }, "peerDependencies": { "webpack-cli": "*" }, "optionalPeers": ["webpack-cli"], "bin": { "webpack": "bin/webpack.js" } }, "sha512-gInQB+jxXxgnZyvPwuzT5NGQmECDqeu85oxcrjinrYHqPoBex0hCAN2SFTJVyPVrK0Pq9E44VFP+e89fAc10/w=="],
|
||||
|
||||
"webpack-sources": ["webpack-sources@3.5.1", "", {}, "sha512-jyuiGJdtvY434z5bUZrjz67v76/ePNvFZTp9Mdz29IlH4+GPsgyGjiv0fKI+M7BdkU6ADjulUcKAd3tUK3WlEw=="],
|
||||
|
||||
"webpack-virtual-modules": ["webpack-virtual-modules@0.6.2", "", {}, "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ=="],
|
||||
|
||||
"whatwg-mimetype": ["whatwg-mimetype@3.0.0", "", {}, "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q=="],
|
||||
@@ -3195,6 +3022,8 @@
|
||||
|
||||
"@base-ui/utils/reselect": ["reselect@5.3.0", "", {}, "sha512-XGoLeRAVzUTcJ1qkxPQhDJyIZ5d6zzZD9nT7AEZOaaU9UbWclhycElmhO+VD5bFeLuzhPBaOV2oXC8uG35ZSpg=="],
|
||||
|
||||
"@dbos-inc/dbos-sdk/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="],
|
||||
|
||||
"@earendil-works/pi-agent-core/ignore": ["ignore@7.0.5", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="],
|
||||
|
||||
"@earendil-works/pi-agent-core/typebox": ["typebox@1.1.38", "", {}, "sha512-pZ0aQPmMmXoUvSbeuWf/Hzsc+avNw/Zd6VeE8CFgkVGWyuHPJvqeJJDeJqLve+K70LvjYIoleGcoJHPT17cWoA=="],
|
||||
@@ -3209,22 +3038,12 @@
|
||||
|
||||
"@inlang/sdk/@sinclair/typebox": ["@sinclair/typebox@0.31.30", "", {}, "sha512-MGsM7bVmHg3sUKCphlu3SGQ+T+5JTbygZWYArfKQCW5anJeACHeqLhcnf+R7XlCWZ+QR3C8JTBx3kCKJTN69ow=="],
|
||||
|
||||
"@inlang/sdk/uuid": ["uuid@14.0.2", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-xZe/16rV4aa+HGSOCiY2YeLT1OybRLrrkL/Rqaq7p7GMVXjFh+6wN4oMYgjFmnSnhY8t6Xpdl2l9qmnHYuMHwQ=="],
|
||||
|
||||
"@isaacs/cliui/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
|
||||
|
||||
"@isaacs/cliui/strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="],
|
||||
|
||||
"@isaacs/cliui/wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="],
|
||||
|
||||
"@jsonjoy.com/fs-snapshot/@jsonjoy.com/json-pack": ["@jsonjoy.com/json-pack@17.67.0", "", { "dependencies": { "@jsonjoy.com/base64": "17.67.0", "@jsonjoy.com/buffers": "17.67.0", "@jsonjoy.com/codegen": "17.67.0", "@jsonjoy.com/json-pointer": "17.67.0", "@jsonjoy.com/util": "17.67.0", "hyperdyperid": "^1.2.0", "thingies": "^2.5.0", "tree-dump": "^1.1.0" }, "peerDependencies": { "tslib": "2" } }, "sha512-t0ejURcGaZsn1ClbJ/3kFqSOjlryd92eQY465IYrezsXmPcfHPE/av4twRSxf6WE+TkZgLY+71vCZbiIiFKA/w=="],
|
||||
|
||||
"@jsonjoy.com/fs-snapshot/@jsonjoy.com/util": ["@jsonjoy.com/util@17.67.0", "", { "dependencies": { "@jsonjoy.com/buffers": "17.67.0", "@jsonjoy.com/codegen": "17.67.0" }, "peerDependencies": { "tslib": "2" } }, "sha512-6+8xBaz1rLSohlGh68D1pdw3AwDi9xydm8QNlAFkvnavCJYSze+pxoW2VKP8p308jtlMRLs5NTHfPlZLd4w7ew=="],
|
||||
|
||||
"@jsonjoy.com/json-pack/@jsonjoy.com/buffers": ["@jsonjoy.com/buffers@1.2.1", "", { "peerDependencies": { "tslib": "2" } }, "sha512-12cdlDwX4RUM3QxmUbVJWqZ/mrK6dFQH4Zxq6+r1YXKXYBNgZXndx2qbCJwh3+WWkCSn67IjnlG3XYTvmvYtgA=="],
|
||||
|
||||
"@jsonjoy.com/util/@jsonjoy.com/buffers": ["@jsonjoy.com/buffers@1.2.1", "", { "peerDependencies": { "tslib": "2" } }, "sha512-12cdlDwX4RUM3QxmUbVJWqZ/mrK6dFQH4Zxq6+r1YXKXYBNgZXndx2qbCJwh3+WWkCSn67IjnlG3XYTvmvYtgA=="],
|
||||
|
||||
"@prisma/dev/std-env": ["std-env@3.10.0", "", {}, "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg=="],
|
||||
|
||||
"@prisma/engines/@prisma/get-platform": ["@prisma/get-platform@7.10.0", "", { "dependencies": { "@prisma/debug": "7.10.0" } }, "sha512-0bra1LFYi8xNw0yqV62bHJNQk4BKleOngZiqPWIQc7a3+9q6rqsnqJ15BuepP8943PFMvtmgnP52juZsyYkA6w=="],
|
||||
@@ -3357,14 +3176,6 @@
|
||||
|
||||
"@tanstack/router-plugin/unplugin": ["unplugin@3.3.0", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "picomatch": "^4.0.4", "webpack-virtual-modules": "^0.6.2" }, "peerDependencies": { "@farmfe/core": "*", "@rspack/core": "*", "bun-types-no-globals": "*", "esbuild": "*", "rolldown": "*", "rollup": "*", "unloader": "*", "vite": "*", "webpack": "*" }, "optionalPeers": ["@farmfe/core", "@rspack/core", "bun-types-no-globals", "esbuild", "rolldown", "rollup", "unloader", "vite", "webpack"] }, "sha512-qa66K+crbfyE6JK10GjvbJeRrOsuC/JpbnHctfyp/i4oBTxWOzJfRZyDiOk1PtErMFRu8JhsU/wPvOdBNWe5Rg=="],
|
||||
|
||||
"@temporalio/common/ms": ["ms@3.0.0-canary.1", "", {}, "sha512-kh8ARjh8rMN7Du2igDRO9QJnqCb2xYTJxyQYK7vJJS4TvLLmsbyhiKpSW+t+y26gyOyMd0riphX0GeWKU3ky5g=="],
|
||||
|
||||
"@temporalio/common/protobufjs": ["protobufjs@8.8.0", "", { "dependencies": { "long": "^5.3.2" } }, "sha512-N3xhQ5yyBx3vQq4gubBfASzYhJGNzeDbjqBpu61g7UVylsN/qyffU96TKWD3GbbLOKF82VGNRNvv1+BFgE31Eg=="],
|
||||
|
||||
"@temporalio/proto/protobufjs": ["protobufjs@8.8.0", "", { "dependencies": { "long": "^5.3.2" } }, "sha512-N3xhQ5yyBx3vQq4gubBfASzYhJGNzeDbjqBpu61g7UVylsN/qyffU96TKWD3GbbLOKF82VGNRNvv1+BFgE31Eg=="],
|
||||
|
||||
"@temporalio/worker/protobufjs": ["protobufjs@8.8.0", "", { "dependencies": { "long": "^5.3.2" } }, "sha512-N3xhQ5yyBx3vQq4gubBfASzYhJGNzeDbjqBpu61g7UVylsN/qyffU96TKWD3GbbLOKF82VGNRNvv1+BFgE31Eg=="],
|
||||
|
||||
"@types/ssh2/@types/node": ["@types/node@18.19.130", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg=="],
|
||||
|
||||
"@typescript-eslint/eslint-plugin/ignore": ["ignore@7.0.6", "", {}, "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw=="],
|
||||
@@ -3391,10 +3202,6 @@
|
||||
|
||||
"@visx/vendor/d3-format": ["d3-format@3.1.0", "", {}, "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA=="],
|
||||
|
||||
"ajv-formats/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"ajv-keywords/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"bcrypt-pbkdf/tweetnacl": ["tweetnacl@0.14.5", "", {}, "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA=="],
|
||||
|
||||
"better-call/@better-auth/utils": ["@better-auth/utils@0.4.2", "", { "dependencies": { "@noble/hashes": "^2.0.1" } }, "sha512-AUxrvu+HaaODsUyzDxFgwd/8RZ1yZaYo42LXKSrU2oGgR38pS1ij8nqQKNgtTWoYGpNevNXtCfgTy6loHveW9A=="],
|
||||
@@ -3447,18 +3254,10 @@
|
||||
|
||||
"readdir-glob/minimatch": ["minimatch@5.1.9", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw=="],
|
||||
|
||||
"schema-utils/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"sharp/semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
|
||||
|
||||
"source-map-loader/iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="],
|
||||
|
||||
"source-map-support/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
|
||||
|
||||
"ssh-remote-port-forward/@types/ssh2": ["@types/ssh2@0.5.52", "", { "dependencies": { "@types/node": "*", "@types/ssh2-streams": "*" } }, "sha512-lbLLlXxdCZOSJMCInKH2+9V/77ET2J6NPQHpFI0kda61Dd1KglJs+fPQBchizmzYSOJBgdTajhPqBO1xxLywvg=="],
|
||||
|
||||
"terser/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="],
|
||||
|
||||
"thread-stream/real-require": ["real-require@1.0.0", "", {}, "sha512-P4nbQYQfePJxRSmY+v/KINxVucm4NF3p3s7pJveMTtom52FR4YGltUQLB8idDXwDDWW+eYrWDFbuzUnjoWHF7g=="],
|
||||
|
||||
"wrap-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
@@ -3473,14 +3272,6 @@
|
||||
|
||||
"@isaacs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="],
|
||||
|
||||
"@jsonjoy.com/fs-snapshot/@jsonjoy.com/json-pack/@jsonjoy.com/base64": ["@jsonjoy.com/base64@17.67.0", "", { "peerDependencies": { "tslib": "2" } }, "sha512-5SEsJGsm15aP8TQGkDfJvz9axgPwAEm98S5DxOuYe8e1EbfajcDmgeXXzccEjh+mLnjqEKrkBdjHWS5vFNwDdw=="],
|
||||
|
||||
"@jsonjoy.com/fs-snapshot/@jsonjoy.com/json-pack/@jsonjoy.com/codegen": ["@jsonjoy.com/codegen@17.67.0", "", { "peerDependencies": { "tslib": "2" } }, "sha512-idnkUplROpdBOV0HMcwhsCUS5TRUi9poagdGs70A6S4ux9+/aPuKbh8+UYRTLYQHtXvAdNfQWXDqZEx5k4Dj2Q=="],
|
||||
|
||||
"@jsonjoy.com/fs-snapshot/@jsonjoy.com/json-pack/@jsonjoy.com/json-pointer": ["@jsonjoy.com/json-pointer@17.67.0", "", { "dependencies": { "@jsonjoy.com/util": "17.67.0" }, "peerDependencies": { "tslib": "2" } }, "sha512-+iqOFInH+QZGmSuaybBUNdh7yvNrXvqR+h3wjXm0N/3JK1EyyFAeGJvqnmQL61d1ARLlk/wJdFKSL+LHJ1eaUA=="],
|
||||
|
||||
"@jsonjoy.com/fs-snapshot/@jsonjoy.com/util/@jsonjoy.com/codegen": ["@jsonjoy.com/codegen@17.67.0", "", { "peerDependencies": { "tslib": "2" } }, "sha512-idnkUplROpdBOV0HMcwhsCUS5TRUi9poagdGs70A6S4ux9+/aPuKbh8+UYRTLYQHtXvAdNfQWXDqZEx5k4Dj2Q=="],
|
||||
|
||||
"@prisma/streams-local/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"@prisma/studio-core/@radix-ui/react-toggle/@radix-ui/primitive": ["@radix-ui/primitive@1.1.3", "", {}, "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg=="],
|
||||
@@ -3573,10 +3364,6 @@
|
||||
|
||||
"@visx/vendor/@types/d3-scale/@types/d3-time": ["@types/d3-time@3.0.4", "", {}, "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g=="],
|
||||
|
||||
"ajv-formats/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"ajv-keywords/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"dockerode/tar-fs/tar-stream": ["tar-stream@2.2.0", "", { "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^3.1.1" } }, "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ=="],
|
||||
|
||||
"eslint-plugin-react/minimatch/brace-expansion": ["brace-expansion@1.1.18", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw=="],
|
||||
@@ -3591,8 +3378,6 @@
|
||||
|
||||
"readdir-glob/minimatch/brace-expansion": ["brace-expansion@2.1.4", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg=="],
|
||||
|
||||
"schema-utils/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"@prisma/studio-core/@radix-ui/react-toggle/@radix-ui/react-primitive/@radix-ui/react-slot": ["@radix-ui/react-slot@1.2.3", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A=="],
|
||||
|
||||
"@prisma/studio-core/@radix-ui/react-toggle/@radix-ui/react-use-controllable-state/@radix-ui/react-use-effect-event": ["@radix-ui/react-use-effect-event@0.0.2", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Qp8WbZOBe+blgpuUT+lw2xheLP8q0oatc9UpmiemEICxGvFLYmHm9QowVZGHtJlGbS6A6yJ3iViad/2cVjnOiA=="],
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
services:
|
||||
postgres:
|
||||
image: docker.m.daocloud.io/pgvector/pgvector:pg18
|
||||
container_name: shumai_postgres
|
||||
environment:
|
||||
POSTGRES_USER: shumai
|
||||
POSTGRES_PASSWORD: shumai_password
|
||||
POSTGRES_DB: shumai_db
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/18/docker
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'pg_isready -U shumai -d shumai_db']
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
embedding-server:
|
||||
image: shumaione/embedding-server:latest
|
||||
container_name: shumai_embedding
|
||||
restart: unless-stopped
|
||||
|
||||
shumai:
|
||||
image: crpi-000nkafzu6xvpwsc.cn-hongkong.personal.cr.aliyuncs.com/shumai-one/shumai:latest
|
||||
cap_add:
|
||||
- SYS_ADMIN
|
||||
security_opt:
|
||||
- apparmor=unconfined
|
||||
- seccomp=unconfined
|
||||
container_name: shumai_app
|
||||
ports:
|
||||
- '3000:3000'
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
# Hardware Acceleration (NVENC / QuickSync / VA-API / RKMPP)
|
||||
# Uncomment the extends section below for hardware acceleration:
|
||||
# extends:
|
||||
# file: hwaccel.transcoding.yaml
|
||||
# service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
|
||||
environment:
|
||||
# Database Configuration
|
||||
DATABASE_URL: postgres://shumai:shumai_password@shumai_postgres:5432/shumai_db?search_path=public&sslmode=disable
|
||||
|
||||
# Server Configuration
|
||||
SHUMAI_SERVER_PORT: 3000
|
||||
|
||||
# S3 Configuration
|
||||
STORAGE_BACKEND: local
|
||||
AWS_ENDPOINT_URL_S3: http://localhost:3000
|
||||
|
||||
# Better Auth
|
||||
BETTER_AUTH_SECRET: qSxs9DxzHDZBbeeTNPEwBuspYwipBqz5Gk5XdBjNhWw=
|
||||
|
||||
# Sandbox Configuration
|
||||
ENABLE_WEAKER_NESTED_SANDBOX: 'true'
|
||||
|
||||
# Embedding Configuration
|
||||
EMBEDDING_PROVIDER: gemma-embedding-2-openai
|
||||
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
|
||||
ENABLE_EMBEDDING_AGENT: 'true'
|
||||
CONCURRENCY_AGENT: 1
|
||||
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
embedding-server:
|
||||
condition: service_started
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
@@ -0,0 +1,89 @@
|
||||
services:
|
||||
postgres:
|
||||
image: docker.m.daocloud.io/pgvector/pgvector:pg18
|
||||
container_name: shumai_postgres
|
||||
environment:
|
||||
POSTGRES_USER: shumai
|
||||
POSTGRES_PASSWORD: shumai_password
|
||||
POSTGRES_DB: shumai_db
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/18/docker
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'pg_isready -U shumai -d shumai_db']
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
embedding-server:
|
||||
image: shumaione/embedding-server:latest
|
||||
container_name: shumai_embedding
|
||||
restart: unless-stopped
|
||||
|
||||
turntable-renderer:
|
||||
image: shumaione/turntable-renderer:latest
|
||||
container_name: shumai_turntable
|
||||
restart: unless-stopped
|
||||
|
||||
gotenberg:
|
||||
image: gotenberg/gotenberg:8
|
||||
container_name: shumai_gotenberg
|
||||
restart: unless-stopped
|
||||
|
||||
shumai:
|
||||
image: crpi-000nkafzu6xvpwsc.cn-hongkong.personal.cr.aliyuncs.com/shumai-one/shumai:latest
|
||||
cap_add:
|
||||
- SYS_ADMIN
|
||||
security_opt:
|
||||
- apparmor=unconfined
|
||||
- seccomp=unconfined
|
||||
container_name: shumai_app
|
||||
ports:
|
||||
- '3000:3000'
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
# Hardware Acceleration (NVENC / QuickSync / VA-API / RKMPP)
|
||||
# Uncomment the extends section below for hardware acceleration:
|
||||
# extends:
|
||||
# file: hwaccel.transcoding.yaml
|
||||
# service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
|
||||
environment:
|
||||
# Database Configuration
|
||||
DATABASE_URL: postgres://shumai:shumai_password@shumai_postgres:5432/shumai_db?search_path=public&sslmode=disable
|
||||
|
||||
# Server Configuration
|
||||
SHUMAI_SERVER_PORT: 3000
|
||||
|
||||
# S3 Configuration
|
||||
STORAGE_BACKEND: local
|
||||
AWS_ENDPOINT_URL_S3: http://localhost:3000
|
||||
|
||||
# Better Auth
|
||||
BETTER_AUTH_SECRET: qSxs9DxzHDZBbeeTNPEwBuspYwipBqz5Gk5XdBjNhWw=
|
||||
|
||||
# Sandbox Configuration
|
||||
ENABLE_WEAKER_NESTED_SANDBOX: 'true'
|
||||
|
||||
# Embedding Configuration
|
||||
EMBEDDING_PROVIDER: gemma-embedding-2-openai
|
||||
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
|
||||
ENABLE_EMBEDDING_AGENT: 'true'
|
||||
CONCURRENCY_AGENT: 1
|
||||
|
||||
# 3D Turntable Renderer Configuration
|
||||
TURNTABLE_RENDERER_URL: http://turntable-renderer:3000
|
||||
|
||||
# Gotenberg Document Converter Configuration
|
||||
GOTENBERG_URL: http://gotenberg:3000
|
||||
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
embedding-server:
|
||||
condition: service_started
|
||||
turntable-renderer:
|
||||
condition: service_started
|
||||
gotenberg:
|
||||
condition: service_started
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
@@ -6,8 +6,6 @@ services:
|
||||
POSTGRES_USER: shumai
|
||||
POSTGRES_PASSWORD: shumai_password
|
||||
POSTGRES_DB: shumai_db
|
||||
ports:
|
||||
- '5432:5432'
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/18/docker
|
||||
healthcheck:
|
||||
@@ -28,6 +26,11 @@ services:
|
||||
- '3000:3000'
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
# Hardware Acceleration (NVENC / QuickSync / VA-API / RKMPP)
|
||||
# Uncomment the extends section below for hardware acceleration:
|
||||
# extends:
|
||||
# file: hwaccel.transcoding.yaml
|
||||
# service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
|
||||
environment:
|
||||
# Database Configuration
|
||||
DATABASE_URL: postgres://shumai:shumai_password@shumai_postgres:5432/shumai_db?search_path=public&sslmode=disable
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
services:
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg18
|
||||
container_name: shumai_postgres
|
||||
environment:
|
||||
POSTGRES_USER: shumai
|
||||
POSTGRES_PASSWORD: shumai_password
|
||||
POSTGRES_DB: shumai_db
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/18/docker
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'pg_isready -U shumai -d shumai_db']
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
embedding-server:
|
||||
image: shumaione/embedding-server:latest
|
||||
container_name: shumai_embedding
|
||||
restart: unless-stopped
|
||||
|
||||
shumai:
|
||||
image: shumaione/shumai:latest
|
||||
cap_add:
|
||||
- SYS_ADMIN
|
||||
security_opt:
|
||||
- apparmor=unconfined
|
||||
- seccomp=unconfined
|
||||
container_name: shumai_app
|
||||
ports:
|
||||
- '3000:3000'
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
# Hardware Acceleration (NVENC / QuickSync / VA-API / RKMPP)
|
||||
# Uncomment the extends section below for hardware acceleration:
|
||||
# extends:
|
||||
# file: hwaccel.transcoding.yaml
|
||||
# service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
|
||||
environment:
|
||||
# Database Configuration
|
||||
DATABASE_URL: postgres://shumai:shumai_password@shumai_postgres:5432/shumai_db?search_path=public&sslmode=disable
|
||||
|
||||
# Server Configuration
|
||||
SHUMAI_SERVER_PORT: 3000
|
||||
|
||||
# S3 Configuration
|
||||
STORAGE_BACKEND: local
|
||||
AWS_ENDPOINT_URL_S3: http://localhost:3000
|
||||
|
||||
# Better Auth
|
||||
BETTER_AUTH_SECRET: qSxs9DxzHDZBbeeTNPEwBuspYwipBqz5Gk5XdBjNhWw=
|
||||
|
||||
# Sandbox Configuration
|
||||
ENABLE_WEAKER_NESTED_SANDBOX: 'true'
|
||||
|
||||
# Embedding Configuration
|
||||
EMBEDDING_PROVIDER: gemma-embedding-2-openai
|
||||
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
|
||||
ENABLE_EMBEDDING_AGENT: 'true'
|
||||
CONCURRENCY_AGENT: 1
|
||||
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
embedding-server:
|
||||
condition: service_started
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
@@ -0,0 +1,89 @@
|
||||
services:
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg18
|
||||
container_name: shumai_postgres
|
||||
environment:
|
||||
POSTGRES_USER: shumai
|
||||
POSTGRES_PASSWORD: shumai_password
|
||||
POSTGRES_DB: shumai_db
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/18/docker
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'pg_isready -U shumai -d shumai_db']
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
embedding-server:
|
||||
image: shumaione/embedding-server:latest
|
||||
container_name: shumai_embedding
|
||||
restart: unless-stopped
|
||||
|
||||
turntable-renderer:
|
||||
image: shumaione/turntable-renderer:latest
|
||||
container_name: shumai_turntable
|
||||
restart: unless-stopped
|
||||
|
||||
gotenberg:
|
||||
image: gotenberg/gotenberg:8
|
||||
container_name: shumai_gotenberg
|
||||
restart: unless-stopped
|
||||
|
||||
shumai:
|
||||
image: shumaione/shumai:latest
|
||||
cap_add:
|
||||
- SYS_ADMIN
|
||||
security_opt:
|
||||
- apparmor=unconfined
|
||||
- seccomp=unconfined
|
||||
container_name: shumai_app
|
||||
ports:
|
||||
- '3000:3000'
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
# Hardware Acceleration (NVENC / QuickSync / VA-API / RKMPP)
|
||||
# Uncomment the extends section below for hardware acceleration:
|
||||
# extends:
|
||||
# file: hwaccel.transcoding.yaml
|
||||
# service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
|
||||
environment:
|
||||
# Database Configuration
|
||||
DATABASE_URL: postgres://shumai:shumai_password@shumai_postgres:5432/shumai_db?search_path=public&sslmode=disable
|
||||
|
||||
# Server Configuration
|
||||
SHUMAI_SERVER_PORT: 3000
|
||||
|
||||
# S3 Configuration
|
||||
STORAGE_BACKEND: local
|
||||
AWS_ENDPOINT_URL_S3: http://localhost:3000
|
||||
|
||||
# Better Auth
|
||||
BETTER_AUTH_SECRET: qSxs9DxzHDZBbeeTNPEwBuspYwipBqz5Gk5XdBjNhWw=
|
||||
|
||||
# Sandbox Configuration
|
||||
ENABLE_WEAKER_NESTED_SANDBOX: 'true'
|
||||
|
||||
# Embedding Configuration
|
||||
EMBEDDING_PROVIDER: gemma-embedding-2-openai
|
||||
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
|
||||
ENABLE_EMBEDDING_AGENT: 'true'
|
||||
CONCURRENCY_AGENT: 1
|
||||
|
||||
# 3D Turntable Renderer Configuration
|
||||
TURNTABLE_RENDERER_URL: http://turntable-renderer:3000
|
||||
|
||||
# Gotenberg Document Converter Configuration
|
||||
GOTENBERG_URL: http://gotenberg:3000
|
||||
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
embedding-server:
|
||||
condition: service_started
|
||||
turntable-renderer:
|
||||
condition: service_started
|
||||
gotenberg:
|
||||
condition: service_started
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
@@ -6,8 +6,6 @@ services:
|
||||
POSTGRES_USER: shumai
|
||||
POSTGRES_PASSWORD: shumai_password
|
||||
POSTGRES_DB: shumai_db
|
||||
ports:
|
||||
- '5432:5432'
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/18/docker
|
||||
healthcheck:
|
||||
@@ -28,6 +26,11 @@ services:
|
||||
- '3000:3000'
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
# Hardware Acceleration (NVENC / QuickSync / VA-API / RKMPP)
|
||||
# Uncomment the extends section below for hardware acceleration:
|
||||
# extends:
|
||||
# file: hwaccel.transcoding.yaml
|
||||
# service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
|
||||
environment:
|
||||
# Database Configuration
|
||||
DATABASE_URL: postgres://shumai:shumai_password@shumai_postgres:5432/shumai_db?search_path=public&sslmode=disable
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# Configurations for hardware-accelerated transcoding
|
||||
services:
|
||||
cpu: {}
|
||||
|
||||
nvenc:
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: 1
|
||||
capabilities:
|
||||
- gpu
|
||||
- compute
|
||||
- video
|
||||
|
||||
quicksync:
|
||||
devices:
|
||||
- /dev/dri:/dev/dri
|
||||
|
||||
rkmpp:
|
||||
security_opt: # enables full access to /sys and /proc, still far better than privileged: true
|
||||
- systempaths=unconfined
|
||||
- apparmor=unconfined
|
||||
group_add:
|
||||
- video
|
||||
devices:
|
||||
- /dev/rga:/dev/rga
|
||||
- /dev/dri:/dev/dri
|
||||
- /dev/dma_heap:/dev/dma_heap
|
||||
- /dev/mpp_service:/dev/mpp_service
|
||||
|
||||
vaapi:
|
||||
devices:
|
||||
- /dev/dri:/dev/dri
|
||||
|
||||
vaapi-wsl: # use this for VAAPI if running in WSL2
|
||||
devices:
|
||||
- /dev/dri:/dev/dri
|
||||
- /dev/dxg:/dev/dxg
|
||||
volumes:
|
||||
- /usr/lib/wsl:/usr/lib/wsl
|
||||
environment:
|
||||
- LIBVA_DRIVER_NAME=d3d12
|
||||
@@ -1,86 +0,0 @@
|
||||
services:
|
||||
# --- Shumai Application Services ---
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg18
|
||||
container_name: shumai_postgres
|
||||
environment:
|
||||
POSTGRES_USER: shumai
|
||||
POSTGRES_PASSWORD: shumai_password
|
||||
POSTGRES_DB: shumai_db
|
||||
ports:
|
||||
- '5432:5432'
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'pg_isready -U shumai -d shumai_db']
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
shumai:
|
||||
image: shumaione/shumai:latest
|
||||
container_name: shumai_app
|
||||
ports:
|
||||
- '3000:3000'
|
||||
volumes:
|
||||
- shumai_data:/app/data
|
||||
environment:
|
||||
DATABASE_URL: postgres://shumai:shumai_password@postgres:5432/shumai_db?search_path=public&sslmode=disable
|
||||
STORAGE_BACKEND: s3
|
||||
AWS_ENDPOINT_URL_S3: S3_ENDPOINT_URL
|
||||
S3_REGION: S3_REGION
|
||||
S3_BUCKET: BUCKET_NAME
|
||||
S3_ACCESS_KEY_ID: ID
|
||||
S3_SECRET_ACCESS_KEY: KEY
|
||||
BETTER_AUTH_SECRET: qSxs9DxzHDZBbeeTNPEwBuspYwipBqz5Gk5XdBjNhWw=
|
||||
WORKFLOW_EXECUTOR: temporal
|
||||
TEMPORAL_ADDRESS: temporal:7233
|
||||
GEMINI_API_KEY: KEY
|
||||
ENABLE_WEAKER_NESTED_SANDBOX: 'true'
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
temporal:
|
||||
condition: service_healthy
|
||||
|
||||
# --- Temporal Services ---
|
||||
temporal:
|
||||
image: temporalio/auto-setup:latest
|
||||
container_name: temporal_server
|
||||
environment:
|
||||
- DB=postgres12
|
||||
- DB_PORT=5432
|
||||
- POSTGRES_USER=shumai
|
||||
- POSTGRES_PWD=shumai_password
|
||||
- POSTGRES_SEEDS=postgres
|
||||
- BIND_ON_IP=0.0.0.0
|
||||
ports:
|
||||
- '7233:7233'
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'temporal operator cluster health --address localhost:7233 || temporal operator cluster health --address $$(hostname -i):7233',
|
||||
]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
start_period: 30s
|
||||
retries: 10
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
temporal-ui:
|
||||
image: temporalio/ui:latest
|
||||
container_name: temporal_ui
|
||||
environment:
|
||||
- TEMPORAL_ADDRESS=temporal:7233
|
||||
ports:
|
||||
- '8080:8080'
|
||||
depends_on:
|
||||
temporal:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
shumai_data:
|
||||
@@ -0,0 +1,926 @@
|
||||
---
|
||||
title: "Changelog"
|
||||
description: "Recent updates, new features, and improvements in Shumai"
|
||||
---
|
||||
|
||||
<Update label="v0.6.0" description="October 20, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
* **deploy**: Add dedicated `shumaione/shumai-transcode` Docker image and a complete AWS EKS deployment example (`eks/`) featuring KEDA queue-driven autoscaling, idle-timeout auto-drain worker mode, and Scale-to-Zero On-Demand Graviton5 instances for media processing
|
||||
* **storage**: Support configuring a separate public endpoint (`AWS_PUBLIC_ENDPOINT_URL_S3`) for browser-facing presigned URLs while preserving internal cluster endpoints for backend workers
|
||||
|
||||
### Fixed
|
||||
|
||||
* **transcode**: Fix an issue where PDF, 3D model, and image background transcode workflows could fail with missing temporary file errors if a worker restarted or recovered midway through processing
|
||||
* **webui**: Improve file list and detail loading with matching skeleton layouts, a persistent sidebar carousel to eliminate layout shift, and smoothed video poster previews
|
||||
|
||||
### Changed
|
||||
|
||||
* **workflow**: Migrate the background workflow engine to DBOS, unifying all-in-one and dedicated worker deployments using the existing PostgreSQL database without requiring a separate Temporal cluster
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.5.3" description="October 16, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
* **cli**: Add administrative `shumai regenerate-embeddings` command to regenerate multimodal vector embeddings for all existing media files across active teams
|
||||
* **docker**: Provide three Docker Compose deployment tiers (Lite, with Embedding Server, and Full) with recommended memory specifications
|
||||
* **agent**: Save video chunk embeddings incrementally to the database as each chunk finishes, preserving completed progress on failure and resuming from where it left off on retry
|
||||
* **agent**: Add support for local LiteRT-LM Gemma Embedding 2 (`gemma-embedding-2-openai`) provider and environment-enforced read-only embedding agents with automatic 768-dimensional vector search indexing
|
||||
|
||||
### Fixed
|
||||
|
||||
### Changed
|
||||
|
||||
* **search**: Display search results in a responsive card grid with interactive hover video sprite scrubbing, semantic match chunk time range previews, and new-tab opening on click
|
||||
* **search**: Significantly improve semantic search response times by generating query text embeddings directly with in-memory caching instead of dispatching background tasks
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.5.2" description="October 13, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
* **3d asset**: Add support for 3D model files (.glb, .gltf, .obj, .fbx, .stl, .dae, .usd, .usda, .usdc, .usdz) with automated turntable video rendering, hover sprite scrubbing, and an interactive 3D turntable viewer featuring 360° ruler scrubbing and degree-based markup comments
|
||||
* **kanban**: Related assets on a task are now clickable, taking you directly to that file or folder in its project
|
||||
* **settings**: Add an Integrations section to Team Settings with dedicated configuration for Gotenberg Document Converter, supporting connection testing and environment variable override protection
|
||||
|
||||
### Fixed
|
||||
|
||||
* **transcode**: Fix an issue where portrait photos from cameras and phones appeared sideways in thumbnails, previews, watermarked share links and annotated snapshots, and were listed with their width and height swapped
|
||||
|
||||
### Changed
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.5.1" description="October 6, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
* **notification**: Notification cards are now clickable, taking you directly to the relevant file
|
||||
* **transcode**: Add hardware decoding and GPU scaling support for NVIDIA NVENC, Intel QuickSync Video (QSV), Rockchip (RKMPP), and VA-API (Intel and AMD GPUs), significantly speeding up video proxy and HLS rendition generation across supported platforms. Set `SHUMAI_HW_DECODE=false` to turn hardware decoding off
|
||||
* **transcode**: Add `dcraw_emu` fallback to generate WebP previews for camera RAW files without embedded JPEG previews
|
||||
|
||||
### Fixed
|
||||
|
||||
### Changed
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.5.0" description="October 2, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
* **transcode**: Add configurable target resolution ladders (480p, 720p, 1080p, 1440p, 2160p) for MP4 Multi Resolutions transcoding in team settings, with unified resolution matching and lowest-resolution fallback for both MP4 and HLS
|
||||
* **transcode**: Add HLS live streaming with fMP4/CMAF adaptive bitrate ladders (480p, 720p, 1080p, 1440p, 2160p), configurable in Transcode Settings, with automatic quality switching, manual resolution selection in the video viewer, seamless rendition switching, and full watermarking support for shared links
|
||||
* **transcode**: Add basic camera RAW image support for popular camera formats (including Sony ARW, Canon CR2/CR3, Nikon NEF, Adobe DNG, Fujifilm RAF, and Panasonic RW2), extracting high-quality embedded JPEG previews and automatically applying camera orientation for fast thumbnail and proxy generation
|
||||
|
||||
### Fixed
|
||||
|
||||
- **asset**: Fix an issue where media files remained stuck in a perpetual "Preparing..." state when transcoding failed, by displaying a clear failed status and error details in the file list and file viewer
|
||||
|
||||
* **transcode**: Fix an issue where videos or audio-only files containing attached cover art or picture streams could cause transcoding to fail during poster generation or select a single static image instead of the video
|
||||
|
||||
* **webui**: Fix inconsistent video resolution labels across download menus, mobile file headers, and the video player by correctly deriving resolutions from the video's short side, including portrait videos and 480p videos
|
||||
|
||||
* **trash**: Fix an issue where the "Empty Trash" confirmation dialog would close immediately instead of showing a loading state while files were being permanently deleted
|
||||
|
||||
### Changed
|
||||
|
||||
* **settings**: Redesign team Video Transcoding settings with dedicated cards for Transcode Policy, Hardware Acceleration, and FFmpeg Threads, clearly explaining MP4 and HLS playback vs download behavior and storage implications
|
||||
* **settings**: Rename AI Settings group to Team AI Settings in settings navigation
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.4.9" description="September 28, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **notification**: You can now receive notifications via email, with batched digest emails and configurable team-level SMTP settings
|
||||
- **transcode**: Add VA-API hardware acceleration support for Linux hosts and Docker environments with Intel and AMD GPUs, featuring automatic DRI render node discovery, variable bitrate control, and structured transcoding observability logs
|
||||
- **transcode**: Add automatic fallback to software transcoding (libx264) when hardware-accelerated video encoding encounters GPU resolution constraints or runtime driver errors
|
||||
- **docker**: Add modular hardware-accelerated transcoding presets matching Immich's compose configuration via `hwaccel.transcoding.yaml` with support for NVENC, QuickSync, RKMPP, and VA-API
|
||||
|
||||
### Fixed
|
||||
|
||||
### Changed
|
||||
|
||||
- **transcode**: Improve video poster selection using intelligent scene detection and color variance filtering to automatically skip black frames, fade-ins, and blank intros in favor of representative video content
|
||||
- **transcode**: Optimize video sprite generation for large and long videos using a concurrent fast-seek pool and image compositing, avoiding full-video decoding while preserving instant single-pass generation for short clips
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.4.8" description="September 24, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **transcode**: Add HDR video proxy support: HDR videos automatically generate HDR video proxies and preview videos preserving HDR color characteristics, tone-mapped SDR thumbnails and posters, and automatic HDR player playback on supported displays with hardware EDR acceleration
|
||||
- **docs**: Add a Changelog section to the documentation site so users can explore release notes and updates directly in Mintlify
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Only show the center play button and darkened tint on initial video open before playback starts; once played, pausing or scrubbing back to start keeps the video canvas clean and unobstructed for review
|
||||
- **transcode**: Fix an issue where videos with orientation or rotation metadata (such as smartphone vertical videos) were incorrectly displayed with stretched aspect ratios in the video player
|
||||
- **cli**: Only manage and check PID files in daemon mode, preventing stale PID files, crash-loop conflicts, or spurious process checks during normal foreground and Docker execution
|
||||
|
||||
### Changed
|
||||
|
||||
- **transcode**: Improve video proxy visual quality and disable B-frames for smoother frame-by-frame seeking and scrubbing
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.4.7" description="September 19, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **changelog**: Introduce Keep a Changelog support, historical release summaries, and automated release notes extraction
|
||||
- **release**: Automatically populate GitHub release bodies from CHANGELOG.md and promote unreleased notes during version bumps
|
||||
- **settings**: Add FFmpeg threads slider to team media processing settings
|
||||
- **asset**: Show previews of a folder's contents and a "days left" countdown for each item in Recently Deleted
|
||||
- **asset**: Show the poster and hover preview for a video in the file list while it is still transcoding, with a gently pulsing cover (or an animated waiting circle before the poster is ready), "Uploading..."/"Preparing..." labels, and the duration hidden until it is ready
|
||||
|
||||
### Fixed
|
||||
|
||||
- **asset**: Fix an issue where moving a video to trash while it was still transcoding could cause it to lose its trashed status
|
||||
- **transcode**: Immediately stop background video processing and transcoding when a file is permanently deleted from the trash
|
||||
- **asset**: Fix proxy download filename using original file extension instead of proxy extension
|
||||
- **asset**: Fix an issue where deleting or restoring a version stack from the file list did nothing
|
||||
- **webui**: Center breadcrumb file action popup menu on the chevron icon
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.4.6" description="September 17, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **comment**: Add emoji reaction support for comments ([#405](https://github.com/shumaiOne/shumai/pull/405))
|
||||
- **premiere-uxp**: Introduce Adobe Premiere Pro UXP plugin for Shumai ([#407](https://github.com/shumaiOne/shumai/pull/407))
|
||||
- **settings**: Add team appearance setting to hide agent features ([#411](https://github.com/shumaiOne/shumai/pull/411))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **premiere-uxp**: Preserve remote cloud storage presigned URLs in asset resolution ([#408](https://github.com/shumaiOne/shumai/pull/408))
|
||||
- **premiere-uxp**: Scope sequence links by server endpoint and surface sync errors ([#409](https://github.com/shumaiOne/shumai/pull/409))
|
||||
- **api**: Enforce SHUMAI_DEMO_MODE for API token and CLI requests ([#413](https://github.com/shumaiOne/shumai/pull/413))
|
||||
|
||||
### Documentation
|
||||
|
||||
- Add NLE export and Premiere Pro UXP plugin documentation ([#412](https://github.com/shumaiOne/shumai/pull/412))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.4.5" description="September 13, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **core**: Export comments to FCP, Premiere, Media Composer, and Resolve ([#400](https://github.com/shumaiOne/shumai/pull/400))
|
||||
- **webui**: Add NLE comments export and migrate export API to POST ([#401](https://github.com/shumaiOne/shumai/pull/401))
|
||||
- **webui**: Add space key quick preview for files and folders ([#402](https://github.com/shumaiOne/shumai/pull/402))
|
||||
- **webui**: Show comments count badge in file card preview area ([#403](https://github.com/shumaiOne/shumai/pull/403))
|
||||
- **agent**: Use deterministic storage keys for preset avatars ([#404](https://github.com/shumaiOne/shumai/pull/404))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.4.4" description="September 9, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **upload**: S3 multipart upload with offline resume and wake lock ([#391](https://github.com/shumaiOne/shumai/pull/391))
|
||||
- **transcode**: Optimize video operations using ffmpeg http range requests ([#393](https://github.com/shumaiOne/shumai/pull/393))
|
||||
- **agent**: Enable read_asset tool for autofill agent ([#396](https://github.com/shumaiOne/shumai/pull/396))
|
||||
- **sandbox**: Abstract SandboxService and hot-reload allowed domains ([#398](https://github.com/shumaiOne/shumai/pull/398))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **s3**: Stream downloadToFile and putObject to prevent OOM on large files ([#392](https://github.com/shumaiOne/shumai/pull/392))
|
||||
- **agent**: Pass agent thinkingLevel to session name generation ([#395](https://github.com/shumaiOne/shumai/pull/395))
|
||||
- **agent**: Restrict pageCount and duration recommendations to matching media types ([#397](https://github.com/shumaiOne/shumai/pull/397))
|
||||
- **transcode**: Co-locate screenshots and derived artifacts in asset storage directory ([#399](https://github.com/shumaiOne/shumai/pull/399))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.4.3" description="September 6, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **asset**: Record and display agent provenance on assets and audit logs ([#380](https://github.com/shumaiOne/shumai/pull/380))
|
||||
- **agent**: Store preset avatars as real files in s3 storage ([#381](https://github.com/shumaiOne/shumai/pull/381))
|
||||
- **agent**: Add built-in image and video generation tools and settings ([#382](https://github.com/shumaiOne/shumai/pull/382))
|
||||
- **media-generation**: Add gemini-omni-1.1-flash video model and redesign settings UI ([#383](https://github.com/shumaiOne/shumai/pull/383))
|
||||
- **settings**: Redesign image/video settings to provider dialog with model toggles ([#385](https://github.com/shumaiOne/shumai/pull/385))
|
||||
- **agent**: Add asset management tools and CLI commands ([#387](https://github.com/shumaiOne/shumai/pull/387))
|
||||
- **cli**: Control asset deletion via SHUMAI_ALLOW_DELETE env var ([#388](https://github.com/shumaiOne/shumai/pull/388))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Clamp file card creation info to 2 lines and show tooltip on hover ([#390](https://github.com/shumaiOne/shumai/pull/390))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **agents**: Add documentation for image and video generation settings ([#389](https://github.com/shumaiOne/shumai/pull/389))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **deps**: Upgrade bun to 1.4.2 and update packages ([#384](https://github.com/shumaiOne/shumai/pull/384))
|
||||
- **i18n**: Update paraglide-js to 2.25.0 and stop checking in generated code ([#386](https://github.com/shumaiOne/shumai/pull/386))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.4.2" description="September 3, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **chat**: Support markups, attachments, and timestamps in agent 1-to-1 chat ([#368](https://github.com/shumaiOne/shumai/pull/368))
|
||||
- **agent**: Move thread metadata to structured context XML ([#373](https://github.com/shumaiOne/shumai/pull/373))
|
||||
- **agent**: Improve timestamp precision and proxy selection for video screenshots ([#374](https://github.com/shumaiOne/shumai/pull/374))
|
||||
- **agent**: Support dynamic annotationId resolution across chat and comments ([#375](https://github.com/shumaiOne/shumai/pull/375))
|
||||
- **agent**: Consolidate media tools into read_asset and add S3 key support to download_asset ([#376](https://github.com/shumaiOne/shumai/pull/376))
|
||||
- **provider**: Optimize provider and model configuration management ([#377](https://github.com/shumaiOne/shumai/pull/377))
|
||||
- **provider**: Add provider and model sync feature with vendored generator ([#378](https://github.com/shumaiOne/shumai/pull/378))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **agent**: Set empty details in asset tool results to avoid data duplication ([#370](https://github.com/shumaiOne/shumai/pull/370))
|
||||
- **webui**: Strip styles and preserve multiline text on paste in chat input ([#371](https://github.com/shumaiOne/shumai/pull/371))
|
||||
- **agent**: Hide main comment sessions in dashboard sessions list ([#372](https://github.com/shumaiOne/shumai/pull/372))
|
||||
|
||||
### Changed
|
||||
|
||||
- **webui**: Use semantic system colors in notification settings ([#379](https://github.com/shumaiOne/shumai/pull/379))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.4.1" description="August 30, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **webui**: Add manage versions option to file card context menu ([#364](https://github.com/shumaiOne/shumai/pull/364))
|
||||
- **agent**: Refactor message context into unified shumai_message ([#365](https://github.com/shumaiOne/shumai/pull/365))
|
||||
- **webui**: Redesign comment attachment display into compact rows ([#366](https://github.com/shumaiOne/shumai/pull/366))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **asset,webui**: Disallow dropping version stacks onto files and version stacks ([#363](https://github.com/shumaiOne/shumai/pull/363))
|
||||
- **webui**: Prevent empty folder flash during initial loading ([#367](https://github.com/shumaiOne/shumai/pull/367))
|
||||
|
||||
### Changed
|
||||
|
||||
- **agent**: Remove executeAgentToolWorkflow and invoke core services directly ([#362](https://github.com/shumaiOne/shumai/pull/362))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.4.0" description="August 28, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **transcode**: Add hardware-accelerated video transcoding support ([#352](https://github.com/shumaiOne/shumai/pull/352))
|
||||
- **webui**: Truncate long file names with 100ms hover tooltip ([#355](https://github.com/shumaiOne/shumai/pull/355))
|
||||
- **webui**: Add simplified mobile-friendly layout for file and share lists ([#356](https://github.com/shumaiOne/shumai/pull/356))
|
||||
- **webui**: Add mobile friendly file detail and public share view ([#359](https://github.com/shumaiOne/shumai/pull/359))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **transcode**: Apply team hardware acceleration and source bitrate capping to watermark transcoding ([#353](https://github.com/shumaiOne/shumai/pull/353))
|
||||
- **share**: Hide and soft-delete symlinks when target assets are trashed ([#354](https://github.com/shumaiOne/shumai/pull/354))
|
||||
- **webui**: Fix breadcrumb file dropdown trigger stretching and alignment ([#360](https://github.com/shumaiOne/shumai/pull/360))
|
||||
- **webui**: Align mobile comment cards and thread vertical indicator ([#361](https://github.com/shumaiOne/shumai/pull/361))
|
||||
|
||||
### Documentation
|
||||
|
||||
- Add SECURITY.md with a private disclosure path ([#357](https://github.com/shumaiOne/shumai/pull/357))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.3.11" description="August 25, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **auth**: Add admin password reset CLI command and reset password web UI ([#347](https://github.com/shumaiOne/shumai/pull/347))
|
||||
- **project**: Add recent viewed files section to project folder tree ([#348](https://github.com/shumaiOne/shumai/pull/348))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Prevent left carousel remounting and scroll jump on file selection ([#351](https://github.com/shumaiOne/shumai/pull/351))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.3.10" description="August 23, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **agentic kanban**: Phase 1 not-agentic kanban board ([#330](https://github.com/shumaiOne/shumai/pull/330))
|
||||
- **kanban**: Resolve latest version for linked version stack assets and update demo login text ([#342](https://github.com/shumaiOne/shumai/pull/342))
|
||||
- **kanban**: Update task status permissions, reporter defaults, and participant access ([#345](https://github.com/shumaiOne/shumai/pull/345))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **kanban**: Use true thumbnail and poster for task asset previews ([#343](https://github.com/shumaiOne/shumai/pull/343))
|
||||
- **webui**: Sidebar selection styling, kanban active state, pointer cursors, and owner dashboard ([#344](https://github.com/shumaiOne/shumai/pull/344))
|
||||
- **kanban**: Improve drag-drop to column bottom, remove empty drop line, and fix timeline alignment ([#346](https://github.com/shumaiOne/shumai/pull/346))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.3.9" description="August 18, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **agent**: Add permission controls for chat agents ([#313](https://github.com/shumaiOne/shumai/pull/313))
|
||||
- **authz**: Enforce project-aware roles for agent/skill/mcp permissions ([#314](https://github.com/shumaiOne/shumai/pull/314))
|
||||
- **webui**: Use project members for asset comment mentions ([#315](https://github.com/shumaiOne/shumai/pull/315))
|
||||
- **quota**: Add 2-level database-backed resource quota system ([#318](https://github.com/shumaiOne/shumai/pull/318))
|
||||
- **settings**: Reorganize settings into personal, team, and AI sections ([#324](https://github.com/shumaiOne/shumai/pull/324))
|
||||
- **quota**: Move usage monitoring to team dashboard ([#327](https://github.com/shumaiOne/shumai/pull/327))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Preserve selected chatbot agent preference on reload ([#323](https://github.com/shumaiOne/shumai/pull/323))
|
||||
- **quota**: Exclude agents from quota rules and usage records ([#325](https://github.com/shumaiOne/shumai/pull/325))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **team-settings**: Add resource quotas documentation and update readme features ([#326](https://github.com/shumaiOne/shumai/pull/326))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.3.8" description="August 15, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **webui**: Replace legacy markdown editor with new lexical wysiwyg editor ([#308](https://github.com/shumaiOne/shumai/pull/308))
|
||||
- **agent**: Add nested agents.md support across backend and webui ([#309](https://github.com/shumaiOne/shumai/pull/309))
|
||||
- **webui**: Improve AGENTS.md editor placeholder and read-only notice ([#310](https://github.com/shumaiOne/shumai/pull/310))
|
||||
- **version-stack**: Add manage versions dialog and version removal ([#311](https://github.com/shumaiOne/shumai/pull/311))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **core**: Rename latest version child record on version stack rename ([#312](https://github.com/shumaiOne/shumai/pull/312))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.3.7" description="August 14, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **metadata**: Replace aiAutofill boolean with autofillSource enum ([#302](https://github.com/shumaiOne/shumai/pull/302))
|
||||
- **agent**: Type-safe CREATION_CONTEXT metadata on create_file/create_version ([#303](https://github.com/shumaiOne/shumai/pull/303))
|
||||
- **sandbox**: Default Network Sandbox to off and add settings toggle switch ([#304](https://github.com/shumaiOne/shumai/pull/304))
|
||||
- **webui**: Redesign select metadata fields and improve long text field widget ([#305](https://github.com/shumaiOne/shumai/pull/305))
|
||||
- **agent**: Support dynamic newOption in select and selectMulti metadata fields ([#306](https://github.com/shumaiOne/shumai/pull/306))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Fix select field height and multi-select overflow/interaction issues ([#307](https://github.com/shumaiOne/shumai/pull/307))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.3.6" description="August 12, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **mcp**: Add MCP server support with proxy tool and OAuth flow ([#289](https://github.com/shumaiOne/shumai/pull/289))
|
||||
- **mcp**: Support tool-level directTools array and 3-state UI configuration ([#297](https://github.com/shumaiOne/shumai/pull/297))
|
||||
- **webui**: Direct canvas PDF rendering with selectable text ([#299](https://github.com/shumaiOne/shumai/pull/299))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **agent**: Prevent agents from accessing disabled skills ([#292](https://github.com/shumaiOne/shumai/pull/292))
|
||||
- **agent**: Resolve version stack name and size in list_assets ([#296](https://github.com/shumaiOne/shumai/pull/296))
|
||||
- **webui**: Content-only pinch-zoom and two-finger pan in media viewers ([#298](https://github.com/shumaiOne/shumai/pull/298))
|
||||
- **i18n**: Update Chinese translation for dashboard to 仪表板 ([#301](https://github.com/shumaiOne/shumai/pull/301))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **mcp**: Add MCP support documentation to README and docs ([#300](https://github.com/shumaiOne/shumai/pull/300))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.3.5" description="August 9, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **transcode**: Add Gotenberg support for Office, HTML, CSV, and Markdown PDF proxies ([#283](https://github.com/shumaiOne/shumai/pull/283))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Resolve upload card freeze for unsupported files ([#284](https://github.com/shumaiOne/shumai/pull/284))
|
||||
- **webui**: Exclude file extension when selecting file name during inline rename ([#285](https://github.com/shumaiOne/shumai/pull/285))
|
||||
- Use renamed asset name in download Content-Disposition ([#286](https://github.com/shumaiOne/shumai/pull/286))
|
||||
- **webui**: Batch download no longer flashes a tab per file ([#287](https://github.com/shumaiOne/shumai/pull/287))
|
||||
- **webui**: Enable rename and delete actions in file detail top bar breadcrumb ([#288](https://github.com/shumaiOne/shumai/pull/288))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.3.4" description="August 8, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **sharelink**: Add sharelink watermark support ([#270](https://github.com/shumaiOne/shumai/pull/270))
|
||||
- **webui**: Remove original-file display fallbacks, use proxies only ([#273](https://github.com/shumaiOne/shumai/pull/273))
|
||||
- **share**: Add allow download config to share links ([#275](https://github.com/shumaiOne/shumai/pull/275))
|
||||
- **transcode**: Update preview thumbnail resolution to 300p with max length constraint ([#281](https://github.com/shumaiOne/shumai/pull/281))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **share**: Resolve symlink asset downloads in public share pages ([#274](https://github.com/shumaiOne/shumai/pull/274))
|
||||
- **webui**: Persist project sorting and prevent full page flash ([#276](https://github.com/shumaiOne/shumai/pull/276))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **share-links**: Document allow download and lazy watermark settings ([#278](https://github.com/shumaiOne/shumai/pull/278))
|
||||
- **agent**: Clarify create_file/create_version context param guidance ([#282](https://github.com/shumaiOne/shumai/pull/282))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **e2e**: Watermarked download-disabled share link coverage (image + video) ([#277](https://github.com/shumaiOne/shumai/pull/277))
|
||||
- **e2e**: Stabilize watermark share spec on Firefox ([#279](https://github.com/shumaiOne/shumai/pull/279))
|
||||
- Split e2e scripts into app and webui targets ([#280](https://github.com/shumaiOne/shumai/pull/280))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.3.3" description="August 5, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **agent**: Enable LLM API call retries in AgentHarness ([#250](https://github.com/shumaiOne/shumai/pull/250))
|
||||
- **audit**: Add audit log support for APIs and WebUI dashboard ([#251](https://github.com/shumaiOne/shumai/pull/251))
|
||||
- **webui**: Persist agent preference in localStorage ([#254](https://github.com/shumaiOne/shumai/pull/254))
|
||||
- **e2e**: Add file domain comment and draw tests ([#260](https://github.com/shumaiOne/shumai/pull/260))
|
||||
- **agent**: Restrict bash access for non-owner users ([#262](https://github.com/shumaiOne/shumai/pull/262))
|
||||
- **agent**: Allow create_file tool to create files directly from content ([#263](https://github.com/shumaiOne/shumai/pull/263))
|
||||
- **agent**: Propagate autofill context from chat to autofill workflow ([#264](https://github.com/shumaiOne/shumai/pull/264))
|
||||
- **webui**: Render select options in field creation mode and pick random option color ([#265](https://github.com/shumaiOne/shumai/pull/265))
|
||||
- **project**: Include team-scoped members in project member list and add 3-section dialog layout ([#267](https://github.com/shumaiOne/shumai/pull/267))
|
||||
- **webui**: Disable role dropdown for project-scoped members in team view ([#269](https://github.com/shumaiOne/shumai/pull/269))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Mention popup avatars, keyboard auto-scroll, and non-sticky section headers ([#256](https://github.com/shumaiOne/shumai/pull/256))
|
||||
- **webui**: Persist field order on drag and drop ([#266](https://github.com/shumaiOne/shumai/pull/266))
|
||||
|
||||
### Changed
|
||||
|
||||
- **agent**: Load models directly from database without pi fallback ([#253](https://github.com/shumaiOne/shumai/pull/253))
|
||||
- **core**: Replace generated provider files with pi-ai dynamic methods ([#255](https://github.com/shumaiOne/shumai/pull/255))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **core**: Add missing tests for methods introduced in 97069042 ([#252](https://github.com/shumaiOne/shumai/pull/252))
|
||||
- **e2e**: Add domain-based auth and project web app e2e tests ([#257](https://github.com/shumaiOne/shumai/pull/257))
|
||||
- **e2e**: Add file, share, and collection web app e2e tests ([#258](https://github.com/shumaiOne/shumai/pull/258))
|
||||
- **e2e**: Add project-level invite and file-move e2e tests ([#259](https://github.com/shumaiOne/shumai/pull/259))
|
||||
- **e2e**: Add search in file list and save-search-as-collection cases ([#261](https://github.com/shumaiOne/shumai/pull/261))
|
||||
- **e2e**: Add member permission change tests ([#268](https://github.com/shumaiOne/shumai/pull/268))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.3.2" description="July 30, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **agent**: Add output truncation and streaming limits to sandboxed bash tool ([#248](https://github.com/shumaiOne/shumai/pull/248))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **agent**: Download original document asset instead of pdf proxy ([#247](https://github.com/shumaiOne/shumai/pull/247))
|
||||
- **webui**: Persist chatbot sidebar input text across route navigation ([#249](https://github.com/shumaiOne/shumai/pull/249))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.3.1" description="July 30, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **transcode**: Trigger ai metadata autofill post transcode ([#234](https://github.com/shumaiOne/shumai/pull/234))
|
||||
- **dashboard**: Add agent sessions view for team owners ([#237](https://github.com/shumaiOne/shumai/pull/237))
|
||||
- **db**: Preserve agent sessions on asset deletion by setting onDelete to SetNull ([#240](https://github.com/shumaiOne/shumai/pull/240))
|
||||
- **agent**: Add download_asset tool and prompt instructions ([#242](https://github.com/shumaiOne/shumai/pull/242))
|
||||
- **db**: Update Asset.sizeByte and AiUsage token fields to BigInt ([#244](https://github.com/shumaiOne/shumai/pull/244))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **agent**: Include select option labels and field name in autofill schema ([#235](https://github.com/shumaiOne/shumai/pull/235))
|
||||
- **agent**: Scope agent comment sessions to thread sessions anchored at root comments ([#239](https://github.com/shumaiOne/shumai/pull/239))
|
||||
- **agent**: Disable tools for session naming and make naming non-blocking ([#241](https://github.com/shumaiOne/shumai/pull/241))
|
||||
- **webui**: Update file size formatting to SI decimal standard ([#245](https://github.com/shumaiOne/shumai/pull/245))
|
||||
- **s3**: Enforce property syntax in S3Service interface and fix ReadableStream handling in S3StorageService ([#246](https://github.com/shumaiOne/shumai/pull/246))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.3.0" description="July 28, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **file-browser**: Add copy name and path option to context menu ([#225](https://github.com/shumaiOne/shumai/pull/225))
|
||||
- **agent**: Inject user name and role into chat context ([#226](https://github.com/shumaiOne/shumai/pull/226))
|
||||
- **agent**: Refactor database session storage to normalized DAG entries and lazy thread sync ([#229](https://github.com/shumaiOne/shumai/pull/229))
|
||||
- **agent**: Support ENABLE_WEAKER_NESTED_SANDBOX environment variable ([#233](https://github.com/shumaiOne/shumai/pull/233))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **agent**: Ensure atomic appendEntry and persist leaf entries in DatabaseSessionStorage ([#224](https://github.com/shumaiOne/shumai/pull/224))
|
||||
- Sharp version mismatch bug ([#230](https://github.com/shumaiOne/shumai/pull/230))
|
||||
- **agent**: Resolve S3 MIME type detection and prompt parameter in image analysis ([#232](https://github.com/shumaiOne/shumai/pull/232))
|
||||
|
||||
### Changed
|
||||
|
||||
- **agent**: Remove implicit agent mention trigger in comment threads ([#227](https://github.com/shumaiOne/shumai/pull/227))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **workflow**: Add docker compose deployment verification job ([#231](https://github.com/shumaiOne/shumai/pull/231))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.2.3" description="July 25, 2026">
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Show right sidebar by default on file detail page ([#219](https://github.com/shumaiOne/shumai/pull/219))
|
||||
- **webui**: Refresh file list and detail when agent executes asset creation tools ([#220](https://github.com/shumaiOne/shumai/pull/220))
|
||||
- **webui**: Fix space key drag overlay and shift range selection for version stacks ([#221](https://github.com/shumaiOne/shumai/pull/221))
|
||||
- **transcode**: Handle timestamp rounding tolerance for screenshot annotations ([#223](https://github.com/shumaiOne/shumai/pull/223))
|
||||
|
||||
### Changed
|
||||
|
||||
- **e2e**: Split transcode workflow E2E tests into per-workflow test files ([#222](https://github.com/shumaiOne/shumai/pull/222))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.2.2" description="July 23, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **webui**: Integrate AI usage API into dashboard page ([#216](https://github.com/shumaiOne/shumai/pull/216))
|
||||
- **ai-usage**: Add team and member token usage tracking and APIs ([#215](https://github.com/shumaiOne/shumai/pull/215))
|
||||
- **transcode**: Add PSD support via ImageMagick and enforce sRGB conversion ([#217](https://github.com/shumaiOne/shumai/pull/217))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **search**: Fix buildSqlCondition date range, numeric metadata, and string parsing bugs ([#213](https://github.com/shumaiOne/shumai/pull/213))
|
||||
- **webui**: Prevent horizontal overflow in search dialog result rows ([#214](https://github.com/shumaiOne/shumai/pull/214))
|
||||
- **webui**: Invalidate upload tasks query when upload task starts and completes ([#218](https://github.com/shumaiOne/shumai/pull/218))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.2.1" description="July 22, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **skill**: Add team owner skill permission control ([#209](https://github.com/shumaiOne/shumai/pull/209))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **agent**: Handle non-builtin models in getModelFromDb and upgrade pi-ai ([#211](https://github.com/shumaiOne/shumai/pull/211))
|
||||
- **provider**: Preserve model ids on provider update ([#212](https://github.com/shumaiOne/shumai/pull/212))
|
||||
|
||||
### Changed
|
||||
|
||||
- **core**: Split generated providers into per-provider files ([#210](https://github.com/shumaiOne/shumai/pull/210))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.2.0" description="July 21, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **transcode**: Add PDF preview, sprite generation, and annotation support ([#193](https://github.com/shumaiOne/shumai/pull/193))
|
||||
- **web**: Register pdf.worker route in production ([#195](https://github.com/shumaiOne/shumai/pull/195))
|
||||
- **agent**: Add read_pdf_pages tool and PDF page context support ([#196](https://github.com/shumaiOne/shumai/pull/196))
|
||||
- **transcode**: Split monolithic transcodeMedia into focused workflows ([#197](https://github.com/shumaiOne/shumai/pull/197))
|
||||
- **transcode**: Add PDF proxy support for TXT and CSV files ([#199](https://github.com/shumaiOne/shumai/pull/199))
|
||||
- **asset**: Replace mediaType/mimeType logic with proxyType ([#200](https://github.com/shumaiOne/shumai/pull/200))
|
||||
- **docker**: Install fonts-noto-cjk in runner stage ([#202](https://github.com/shumaiOne/shumai/pull/202))
|
||||
- **transcode**: Add markdown file to pdf proxy support ([#203](https://github.com/shumaiOne/shumai/pull/203))
|
||||
- **chat**: Track context asset changes and update agent context ([#204](https://github.com/shumaiOne/shumai/pull/204))
|
||||
- **agent**: Refactor media tools to static injection with mandatory assetId and authz ([#208](https://github.com/shumaiOne/shumai/pull/208))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **transcode**: Mark pdfkit as external and extract for docker runtime ([#201](https://github.com/shumaiOne/shumai/pull/201))
|
||||
- **agent**: Include skill id in formatSkillsForPrompt ([#205](https://github.com/shumaiOne/shumai/pull/205))
|
||||
- **asset**: Exclude soft-deleted children from latestChildren preview ([#206](https://github.com/shumaiOne/shumai/pull/206))
|
||||
- **agent**: Pass latest version asset from version stack to prompt builder ([#207](https://github.com/shumaiOne/shumai/pull/207))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.1.10" description="July 16, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **workflow-e2e**: Add E2E tests for agentAutofillMedia workflow ([#188](https://github.com/shumaiOne/shumai/pull/188))
|
||||
- **comments**: Support comment deletion and video player shortcuts ([#191](https://github.com/shumaiOne/shumai/pull/191))
|
||||
- **agent**: Support disabling specific tools for agents ([#192](https://github.com/shumaiOne/shumai/pull/192))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **e2e**: Add E2E workflow tests for remaining agent and transcode services ([#189](https://github.com/shumaiOne/shumai/pull/189))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.1.9" description="July 14, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **e2e**: Set up fullstack app-level e2e test framework and signup test case ([#184](https://github.com/shumaiOne/shumai/pull/184))
|
||||
- **chat**: Chatbot UI ([#185](https://github.com/shumaiOne/shumai/pull/185))
|
||||
- **agent**: Support aborting agent execution ([#186](https://github.com/shumaiOne/shumai/pull/186))
|
||||
|
||||
### Changed
|
||||
|
||||
- **api/chat**: Remove direct Prisma query from API layer ([#187](https://github.com/shumaiOne/shumai/pull/187))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.1.8" description="July 10, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **chatbot**: Implement type-safe Chat APIs with compaction support ([#180](https://github.com/shumaiOne/shumai/pull/180))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Enable build splitting and code-split all page routes ([#183](https://github.com/shumaiOne/shumai/pull/183))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **readme**: Clarify displayed file size represents original file size ([#182](https://github.com/shumaiOne/shumai/pull/182))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.1.7" description="July 6, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **audio**: Support frame-accurate audio playback, comments, and AI safeguards ([#175](https://github.com/shumaiOne/shumai/pull/175))
|
||||
- **i18n**: Localize members dialog, notifications, uploads, user menus, dates, and players ([#178](https://github.com/shumaiOne/shumai/pull/178))
|
||||
- **comments**: Allow marking comments as complete or incomplete ([#179](https://github.com/shumaiOne/shumai/pull/179))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **upload**: Resolve empty and generic MIME types in confirmFileUpload ([#176](https://github.com/shumaiOne/shumai/pull/176))
|
||||
|
||||
### Changed
|
||||
|
||||
- **webui**: Modularize file viewer components into registry-driven architecture ([#174](https://github.com/shumaiOne/shumai/pull/174))
|
||||
|
||||
### Documentation
|
||||
|
||||
- Improve documentation and examples for S3 compatible storage ([#177](https://github.com/shumaiOne/shumai/pull/177))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.1.6" description="July 4, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **file-browser**: Show video duration on file card preview ([#170](https://github.com/shumaiOne/shumai/pull/170))
|
||||
- **webui**: Compare versions view for version stacks ([#171](https://github.com/shumaiOne/shumai/pull/171))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Resolve conditional hooks and setState-in-render errors ([#167](https://github.com/shumaiOne/shumai/pull/167))
|
||||
- **webui**: Resolve video player total frames mismatch ([#172](https://github.com/shumaiOne/shumai/pull/172))
|
||||
- **version-stack**: Resolve correct latest version ID of version stack ([#173](https://github.com/shumaiOne/shumai/pull/173))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **webui**: Video player e2e framework + Safari playhead fix ([#166](https://github.com/shumaiOne/shumai/pull/166))
|
||||
- **webui**: Add frame-accurate comment seek roundtrip e2e ([#168](https://github.com/shumaiOne/shumai/pull/168))
|
||||
- **webui**: Verify video player restarts playback after end ([#169](https://github.com/shumaiOne/shumai/pull/169))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.1.5" description="July 2, 2026">
|
||||
|
||||
### Changed
|
||||
|
||||
- **storage**: Use original filenames for stored files ([#165](https://github.com/shumaiOne/shumai/pull/165))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **release**: Add Aliyun ACR push to release workflow ([#164](https://github.com/shumaiOne/shumai/pull/164))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.1.4" description="July 1, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **transcode**: Change video poster resolution to 480p ([#161](https://github.com/shumaiOne/shumai/pull/161))
|
||||
- **auth**: Allow setting user locale on signup ([#163](https://github.com/shumaiOne/shumai/pull/163))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Preserve video ended state by skipping playhead snap on ended ([#162](https://github.com/shumaiOne/shumai/pull/162))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.1.3" description="June 30, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **webui**: Add i18n support using paraglide-js ([#156](https://github.com/shumaiOne/shumai/pull/156))
|
||||
- **video**: Add frame-accurate video player, SMPTE timecodes, and format switcher ([#157](https://github.com/shumaiOne/shumai/pull/157))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Align video timeline duration and formatting with frameio ([#158](https://github.com/shumaiOne/shumai/pull/158))
|
||||
- **webui**: Fix missing left sidebar for nested folders ([#159](https://github.com/shumaiOne/shumai/pull/159))
|
||||
- **api**: Fix update team settings and make request schema type-safe ([#160](https://github.com/shumaiOne/shumai/pull/160))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.1.2" description="June 25, 2026">
|
||||
|
||||
### Changed
|
||||
|
||||
- **s3**: Remove automatic port appending to AWS_ENDPOINT_URL_S3 ([#155](https://github.com/shumaiOne/shumai/pull/155))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.1.1" description="June 23, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **docker**: Add root entrypoint with privilege dropping for data volumes ([#151](https://github.com/shumaiOne/shumai/pull/151))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.1.0" description="June 22, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **share**: Secure share info API and fix wrong password feedback ([#150](https://github.com/shumaiOne/shumai/pull/150))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Truncate long folder, collection, and share link names in sidebar ([#149](https://github.com/shumaiOne/shumai/pull/149))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.0.11" description="June 22, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **cli**: Add shumai-cli and token authentication ([#144](https://github.com/shumaiOne/shumai/pull/144))
|
||||
- **settings**: Use singular headers and remove collapse/counters for single agent types ([#145](https://github.com/shumaiOne/shumai/pull/145))
|
||||
- **folders**: Auto expand folder tree in left sidebar on navigation ([#146](https://github.com/shumaiOne/shumai/pull/146))
|
||||
- **metadata**: Add single user and multiple user custom fields ([#147](https://github.com/shumaiOne/shumai/pull/147))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **cli**: Rename npm package to @shumai-one/shumai-cli ([#148](https://github.com/shumaiOne/shumai/pull/148))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.0.10" description="June 21, 2026">
|
||||
|
||||
### Changed
|
||||
|
||||
- **web**: Dynamically register production HTML bundle routes ([#142](https://github.com/shumaiOne/shumai/pull/142))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **readme**: Polish structure, correct grammar, and add dependencies table ([#143](https://github.com/shumaiOne/shumai/pull/143))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.0.9" description="June 20, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **webui**: Show app version in avatar menu ([#139](https://github.com/shumaiOne/shumai/pull/139))
|
||||
- **cli**: Add background daemonization and subcommands ([#141](https://github.com/shumaiOne/shumai/pull/141))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **release**: Add smoke tests to local release stage ([#140](https://github.com/shumaiOne/shumai/pull/140))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.0.8" description="June 19, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **api**: Implement read-only mode for reviewers ([#122](https://github.com/shumaiOne/shumai/pull/122))
|
||||
- **server**: Allow customizing server port via SHUMAI_SERVER_PORT ([#124](https://github.com/shumaiOne/shumai/pull/124))
|
||||
- **embedding**: Defer embedding workflow, use transcoded assets, and execute chunks in separate activities ([#125](https://github.com/shumaiOne/shumai/pull/125))
|
||||
- **webui**: Add external drag-and-drop file and folder upload support ([#126](https://github.com/shumaiOne/shumai/pull/126))
|
||||
- **agent**: Implement overlapping video chunks for semantic search ([#127](https://github.com/shumaiOne/shumai/pull/127))
|
||||
- **webui**: Support jumping to video timestamp from search results ([#128](https://github.com/shumaiOne/shumai/pull/128))
|
||||
- **auth**: Add demo mode support ([#131](https://github.com/shumaiOne/shumai/pull/131))
|
||||
- **auth**: Refine demo mode support ([#132](https://github.com/shumaiOne/shumai/pull/132))
|
||||
- **webui**: Default right sidebar to collapsed for new users ([#133](https://github.com/shumaiOne/shumai/pull/133))
|
||||
- **webui**: Use Shadcn Switch in toggle field and Rating component in search filter panel ([#137](https://github.com/shumaiOne/shumai/pull/137))
|
||||
- **upload**: Track byte-level progress with XMLHttpRequest ([#138](https://github.com/shumaiOne/shumai/pull/138))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **transcode**: Handle high-precision FPS using rational fractions ([#123](https://github.com/shumaiOne/shumai/pull/123))
|
||||
- **db**: Automatically update project updatedAt on asset modification ([#129](https://github.com/shumaiOne/shumai/pull/129))
|
||||
- **webui**: Use system colors for fields and improve search filter select options ([#130](https://github.com/shumaiOne/shumai/pull/130))
|
||||
- **search**: Fix hasAny and hasNone operators on metadata filter ([#134](https://github.com/shumaiOne/shumai/pull/134))
|
||||
- **webui**: Resolve folder tree sync, search dialog reset, and sidebar actions issues ([#136](https://github.com/shumaiOne/shumai/pull/136))
|
||||
|
||||
### Changed
|
||||
|
||||
- **webui**: Fix search dialog layout height, scroll areas, and restrict filter toggle click ([#135](https://github.com/shumaiOne/shumai/pull/135))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.0.7" description="June 17, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **workflow**: Configure transcode and agent concurrency via environment variables ([#116](https://github.com/shumaiOne/shumai/pull/116))
|
||||
- **webui**: Replace hardcoded colors with system tokens ([#119](https://github.com/shumaiOne/shumai/pull/119))
|
||||
- **webui**: Replace native overflow with shadcn ScrollArea in settings ([#120](https://github.com/shumaiOne/shumai/pull/120))
|
||||
- **api**: Use enum for API protocol in provider config ([#121](https://github.com/shumaiOne/shumai/pull/121))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **webui**: Reload video player and reset state when switching assets ([#114](https://github.com/shumaiOne/shumai/pull/114))
|
||||
|
||||
### Changed
|
||||
|
||||
- **transcode**: Relocate TranscodeService to core and flatten API package ([#115](https://github.com/shumaiOne/shumai/pull/115))
|
||||
|
||||
### Documentation
|
||||
|
||||
- Improve and restructure shumai documentation ([#118](https://github.com/shumaiOne/shumai/pull/118))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.0.6" description="June 15, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **sandbox**: Add pending domains support for network sandbox ([#109](https://github.com/shumaiOne/shumai/pull/109))
|
||||
- **webui**: Always show right sidebar and implement left vertical carousel ([#111](https://github.com/shumaiOne/shumai/pull/111))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **build**: Propagate termination signals to active child process in wrappers ([#102](https://github.com/shumaiOne/shumai/pull/102))
|
||||
- **transcode**: Make deterministic transcode activity failures non-retryable in Temporal ([#104](https://github.com/shumaiOne/shumai/pull/104))
|
||||
- **player**: Implement seekbar dragging and match hover highlight color ([#108](https://github.com/shumaiOne/shumai/pull/108))
|
||||
- **webui**: Avoid refetching all pages on file/folder reorder ([#112](https://github.com/shumaiOne/shumai/pull/112))
|
||||
- **webui**: Force video-player mime type to video/mp4 ([#113](https://github.com/shumaiOne/shumai/pull/113))
|
||||
|
||||
### Changed
|
||||
|
||||
- **webui**: Use system color design tokens in video player components ([#106](https://github.com/shumaiOne/shumai/pull/106))
|
||||
- **webui**: Use requestAnimationFrame for smooth video progress bar updates ([#107](https://github.com/shumaiOne/shumai/pull/107))
|
||||
- **webui**: Fetch agents in mention input list dynamically ([#110](https://github.com/shumaiOne/shumai/pull/110))
|
||||
|
||||
### Documentation
|
||||
|
||||
- **readme**: Add comprehensive README.md ([#103](https://github.com/shumaiOne/shumai/pull/103))
|
||||
- **readme**: Improve remote deployment and temporal execution instructions ([#105](https://github.com/shumaiOne/shumai/pull/105))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.0.5" description="June 13, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **npm**: Auto deploy database migrations on package start ([#101](https://github.com/shumaiOne/shumai/pull/101))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.0.4" description="June 12, 2026">
|
||||
|
||||
### Fixed
|
||||
|
||||
- **cli/docker**: Resolve global CLI external dependencies and fix Docker 404 error ([#100](https://github.com/shumaiOne/shumai/pull/100))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.0.3" description="June 12, 2026">
|
||||
|
||||
### Fixed
|
||||
|
||||
- **cli**: Resolve platform binary path resolution under nested node_modules ([#99](https://github.com/shumaiOne/shumai/pull/99))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.0.2" description="June 12, 2026">
|
||||
|
||||
### Fixed
|
||||
|
||||
- **npm**: Add repository metadata to package.json for provenance verification ([#98](https://github.com/shumaiOne/shumai/pull/98))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- Add release-npm.yaml workflow ([#97](https://github.com/shumaiOne/shumai/pull/97))
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.0.1" description="June 12, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- Initial release of Shumai
|
||||
|
||||
</Update>
|
||||
@@ -0,0 +1,173 @@
|
||||
---
|
||||
title: Deploy with Distributed Workers
|
||||
description: Configure a high-scale production deployment using dedicated background workers, DBOS, and S3-compatible storage.
|
||||
---
|
||||
|
||||
For production environments or workloads with high-volume video processing and heavy AI agent usage, running background tasks on a single server can cause bottlenecks. Shumai resolves this by decoupling the web dashboard from background processing through dedicated worker nodes orchestrated by **DBOS Transact**.
|
||||
|
||||
All background tasks (media transcoding, AI embeddings, agent tasks) are dispatched to durable task queues (`transcode_queue` and `agent_queue`) hosted directly in PostgreSQL. No separate external cluster (like Temporal) is required.
|
||||
|
||||
---
|
||||
|
||||
## How it Works
|
||||
|
||||
In a distributed deployment, the core Shumai web application handles user requests, database updates, and file uploads, while delegating durable background workflows to specialized worker instances via PostgreSQL task queues.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
UserUpload[User Uploads Video / Triggers Agent] --> WebApp[Shumai Web UI / API]
|
||||
WebApp -->|Enqueue Task| DB[(PostgreSQL / DBOS Queues)]
|
||||
DB -->|Queue: transcode_queue| TranscodeWorker[Transcode Worker Machine]
|
||||
DB -->|Queue: agent_queue| AgentWorker[Agent Worker Machine]
|
||||
```
|
||||
|
||||
- **Transcoding Workers**: Can be run on GPU-accelerated or high-CPU compute instances.
|
||||
- **AI Agent Workers**: Can be run on isolated, sandboxed hosts to safely execute automation scripts.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Storage Requirement**: Because the core application and the background workers run on separate machines in a distributed setup, **you must configure an S3-compatible storage backend** (such as AWS S3, Cloudflare R2, or MinIO). Local storage (`STORAGE_BACKEND=local`) is not supported in this mode because the workers and the web application do not share a common filesystem.
|
||||
|
||||
---
|
||||
|
||||
## Step 1: Deploy the Core Web Application
|
||||
|
||||
On your primary host machine, run PostgreSQL and the main Shumai web application.
|
||||
|
||||
To instruct the main web application to handle only API and UI traffic without running background worker queues locally, set `SHUMAI_WORKERS=none`:
|
||||
|
||||
```env
|
||||
DATABASE_URL=postgresql://shumai:shumai_password@localhost:5432/shumai_db?schema=public
|
||||
STORAGE_BACKEND=s3
|
||||
AWS_ENDPOINT_URL_S3=https://your-s3-endpoint.com
|
||||
S3_BUCKET=shumai
|
||||
S3_REGION=us-east-1
|
||||
S3_ACCESS_KEY_ID=your-access-key-id
|
||||
S3_SECRET_ACCESS_KEY=your-secret-access-key
|
||||
SHUMAI_WORKERS=none
|
||||
BETTER_AUTH_SECRET=your-random-32-character-secret-key
|
||||
```
|
||||
|
||||
When started with `SHUMAI_WORKERS=none` (or `--workers=none`), the web server starts immediately without polling or consuming tasks from the transcode or agent queues.
|
||||
|
||||
---
|
||||
|
||||
## Step 2: Configure & Run Dedicated Workers
|
||||
|
||||
On your specialized worker machines, configure each worker with a `.env` file referencing the shared PostgreSQL database and S3 storage:
|
||||
|
||||
```env
|
||||
DATABASE_URL=postgresql://shumai:shumai_password@<primary-host-ip>:5432/shumai_db?schema=public
|
||||
STORAGE_BACKEND=s3
|
||||
AWS_ENDPOINT_URL_S3=https://your-s3-endpoint.com
|
||||
S3_BUCKET=shumai
|
||||
S3_REGION=us-east-1
|
||||
S3_ACCESS_KEY_ID=your-access-key-id
|
||||
S3_SECRET_ACCESS_KEY=your-secret-access-key
|
||||
CONCURRENCY_TRANSCODE=1
|
||||
CONCURRENCY_AGENT=5
|
||||
```
|
||||
|
||||
### Media Transcoding Worker
|
||||
|
||||
Run this on your media processing nodes (requires system installations of `ffmpeg` and `ffprobe`):
|
||||
|
||||
```bash
|
||||
npm install -g @shumai-one/shumai-transcode
|
||||
shumai-transcode
|
||||
```
|
||||
|
||||
Alternatively, you can run the transcode worker using the dedicated lightweight Docker image:
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name shumai-transcode-worker \
|
||||
--env-file .env \
|
||||
shumaione/shumai-transcode:latest
|
||||
```
|
||||
|
||||
(You can also use the all-in-one image: `docker run -d --name shumai-transcode-worker --env-file .env shumaione/shumai:latest shumai-transcode`.)
|
||||
|
||||
### AI Agent Worker
|
||||
|
||||
Run this on your sandboxed agent execution nodes (requires sandbox dependencies like `bubblewrap` or `sandbox-exec`):
|
||||
|
||||
```bash
|
||||
npm install -g @shumai-one/shumai-agent
|
||||
shumai-agent
|
||||
```
|
||||
|
||||
Alternatively, you can run the agent worker using the official Docker image:
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name shumai-agent-worker \
|
||||
--env-file .env \
|
||||
--cap-add=SYS_ADMIN \
|
||||
shumaione/shumai:latest shumai-agent
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **For Bun Users:** Since the worker package binaries contain a `#!/usr/bin/env node` shebang, running `shumai-transcode` or `shumai-agent` directly will run under Node.js. If you wish to run them using Bun, prefix the commands with `bun run --bun` (e.g., `bun run --bun shumai-transcode` or `bun run --bun shumai-agent`).
|
||||
|
||||
---
|
||||
|
||||
## Worker Concurrency & Multi-Instance Deployments
|
||||
|
||||
### Concurrency Tuning
|
||||
|
||||
Workers pull tasks from PostgreSQL queues based on configurable concurrency limits:
|
||||
|
||||
- `CONCURRENCY_TRANSCODE`: Maximum concurrent video transcoding jobs per worker (defaults to `1`).
|
||||
- `CONCURRENCY_AGENT`: Maximum concurrent agent and embedding workflows per worker (defaults to `5`, recommend setting to `1` when paired with a local `embedding-server`).
|
||||
|
||||
### Replica Identity
|
||||
|
||||
When running multiple replicas of the transcode or agent worker across multiple machines or pods:
|
||||
|
||||
- `DbosExecutor` automatically derives a unique per-instance ID from the machine hostname and process ID to ensure startup recovery only re-enqueues tasks belonging to that specific instance.
|
||||
- **Custom Worker ID**: Set `SHUMAI_WORKERS_ID` (or `SHUMAI_WORKER_ID`) if you wish to assign an explicit identifier.
|
||||
- **Kubernetes**: In Kubernetes Pods, set `POD_NAME` (via Downward API `fieldRef: { fieldPath: metadata.name }`) to provide stable, unique per-pod identity across pod restarts.
|
||||
|
||||
---
|
||||
|
||||
## Scalable Deployment on Kubernetes & AWS EKS
|
||||
|
||||
For production cloud deployments requiring high-throughput media processing, Shumai can be deployed on Kubernetes or **AWS Elastic Kubernetes Service (AWS EKS)** with automated scale-to-zero queue-driven scaling via **KEDA (Kubernetes Event-driven Autoscaling)**.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
User([User / Web Browser]) -->|Port 80/3000| Server[Pod: shumai-server<br/>SHUMAI_WORKERS=agent]
|
||||
Server -->|Enqueue to transcode_queue| DB[(PostgreSQL: pgvector18<br/>dbos.workflow_status)]
|
||||
Server -->|Direct Uploads / Stream Proxies| Storage[(S3 / Garage Storage)]
|
||||
|
||||
KEDA[KEDA ScaledJob<br/>PostgreSQL Trigger<br/>min: 0, max: 10] -.->|Monitors Queue| DB
|
||||
KEDA -->|Spawns Jobs for queue| Job1[Job: shumai-transcode-1<br/>Auto-drain worker]
|
||||
KEDA -->|Spawns Jobs for queue| JobN[Job: shumai-transcode-N<br/>Auto-drain worker]
|
||||
|
||||
Job1 -->|Fetch Source / Store Proxies| Storage
|
||||
JobN -->|Fetch Source / Store Proxies| Storage
|
||||
Job1 -->|Mark Complete & Exit 0| DB
|
||||
JobN -->|Mark Complete & Exit 0| DB
|
||||
|
||||
CA[Cluster Autoscaler / Karpenter] -.->|Scale-to-Zero On-Demand Nodes<br/>0 to 10 instances| JobN
|
||||
```
|
||||
|
||||
### Key Architectural Highlights
|
||||
|
||||
- **Decoupled Stateless Workers**: The main web and API server, database, and storage run on reliable On-Demand compute (`c9g.large`, `SHUMAI_WORKERS=agent`), delegating media transcoding to background workers orchestrated via DBOS task queues in PostgreSQL.
|
||||
- **Dedicated Graviton5 On-Demand Compute (`c9g.xlarge`)**: Media encoding runs on 4 vCPU / 8 GiB RAM AWS Graviton5 On-Demand instances (~$0.174/hr), utilizing ARM64 vector optimizations and high-speed DDR5 memory without involuntary Spot interruptions.
|
||||
- **Queue-Driven Scale-to-Zero via KEDA**: KEDA monitors `dbos.workflow_status` for enqueued and pending transcode tasks and dynamically provisions Kubernetes `ScaledJob` resources (scaling 0 to 10). When the queue is empty, transcode nodes scale down to zero (`minSize: 0`), incurring **$0/hr** in worker costs.
|
||||
- **Idle-Timeout Auto-Drain**: Worker pods continuously process queued tasks with concurrency `1`. When the queue is fully drained and a pod has been idle for 10 seconds (`SHUMAI_WORKER_IDLE_TIMEOUT_MS=10000`), it exits `0` cleanly so the node can scale down, processing batch uploads without cold-start pod churn.
|
||||
- **Automated Stale Task Recovery**: The core web server runs an integrated recovery sweep that detects stale or orphaned tasks (e.g. from node crash) and resumes them automatically in DBOS, with a 3-attempt cap to safely handle poison-pill media.
|
||||
|
||||
### Complete Deployment Example & Source Code
|
||||
|
||||
For the full, production-ready manifests, declarative `eksctl` cluster configuration, and step-by-step walkthrough, see the **[EKS Deployment Example](https://github.com/shumaiOne/shumai/tree/main/eks)** in the Shumai repository:
|
||||
|
||||
👉 **[View the EKS Deployment Guide & Manifests on GitHub](https://github.com/shumaiOne/shumai/tree/main/eks)**
|
||||
|
||||
The repository includes:
|
||||
|
||||
- [`eks/eks-cluster.yaml`](https://github.com/shumaiOne/shumai/blob/main/eks/eks-cluster.yaml): Complete `eksctl` ClusterConfig with compute tiering.
|
||||
- [`eks/kustomization.yaml`](https://github.com/shumaiOne/shumai/blob/main/eks/kustomization.yaml): Single-command Kustomize deployment for all services.
|
||||
- Detailed instructions for setting up public endpoints, automated Cluster Autoscaler, and zero-downtime graceful shutdown.
|
||||
@@ -24,12 +24,13 @@ Shumai is configured via environment variables. You can define these variables i
|
||||
|
||||
---
|
||||
|
||||
## Authentication Config
|
||||
## Authentication & Application Config
|
||||
|
||||
| Variable | Description | Example / Default |
|
||||
| :------------------- | :--------------------------------------------------------------------- | :--------------------------------------------------------------- |
|
||||
| `BETTER_AUTH_SECRET` | A secure, random 32-byte secret used to sign session cookies and JWTs. | Generate with `openssl rand -base64 32` |
|
||||
| `BETTER_AUTH_URL` | The public URL of your Hono backend API. Used for redirect flows. | `http://localhost:3000` (respects `SHUMAI_SERVER_PORT` fallback) |
|
||||
| Variable | Description | Example / Default |
|
||||
| :------------------- | :--------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------- |
|
||||
| `BETTER_AUTH_SECRET` | A secure, random 32-byte secret used to sign session cookies and JWTs. | Generate with `openssl rand -base64 32` |
|
||||
| `BETTER_AUTH_URL` | The public URL of your Hono backend API. Used for redirect flows and notification email links fallback. | `http://localhost:3000` (respects `SHUMAI_SERVER_PORT` fallback) |
|
||||
| `APP_URL` | The public URL of the web application. Used for notification email deep links (falls back to `BETTER_AUTH_URL`). | `https://shumai.example.com` |
|
||||
|
||||
---
|
||||
|
||||
@@ -63,14 +64,27 @@ For example, if you deploy Shumai on a remote server at `http://123.456.7.8` and
|
||||
|
||||
## Workflow Config
|
||||
|
||||
Configures whether background transcoding and AI agents are executed locally or offloaded to a Temporal cluster.
|
||||
Configures background worker execution, concurrency limits, and worker identity for DBOS Transact queues.
|
||||
|
||||
| Variable | Description | Example / Default |
|
||||
| :------------------------- | :------------------------------------------------------------------------------------------------- | :------------------------------ |
|
||||
| `WORKFLOW_EXECUTOR` | Engine choice. Use `local` for in-process database polling, or `temporal` for distributed workers. | `local` (default) or `temporal` |
|
||||
| `TEMPORAL_ADDRESS` | Host and port of the Temporal cluster gRPC service. | `localhost:7233` (default) |
|
||||
| `EMBEDDING_CHUNK_DURATION` | The duration in seconds for each video chunk when generating video embeddings. | `60.0` (default) |
|
||||
| `EMBEDDING_CHUNK_OVERLAP` | The duration in seconds to overlap video chunks when generating video embeddings. | `5.0` (default) |
|
||||
| Variable | Description | Example / Default |
|
||||
| :---------------------- | :-------------------------------------------------------------------------------------------------------------------------------- | :---------------- |
|
||||
| `SHUMAI_WORKERS` | Queues listened to by the web server. Options: `all` (default), `none` (API/UI only), `agent` (or `ai`), `transcode`. | `all` (default) |
|
||||
| `CONCURRENCY_TRANSCODE` | Maximum concurrent media transcoding tasks executed by workers. | `1` (default) |
|
||||
| `CONCURRENCY_AGENT` | Maximum concurrent AI tasks executed by workers. Set to `1` when running local `embedding-server`. | `5` (default) |
|
||||
| `SHUMAI_WORKER_ID` | Optional explicit instance ID for worker replicas in multi-node deployments (auto-derived from hostname and process ID if unset). | `worker-1` |
|
||||
| `POD_NAME` | Kubernetes pod name, used to provide stable per-pod worker identity across StatefulSet restarts. | `transcode-pod-0` |
|
||||
|
||||
---
|
||||
|
||||
## Embedding Config
|
||||
|
||||
| Variable | Description | Example / Default |
|
||||
| :-------------------------------- | :------------------------------------------------------------------------------------------------------------ | :-------------------------------- |
|
||||
| `EMBEDDING_PROVIDER` | Multimodal embedding provider. Options: `gemini-embedding-2`, `gemma-embedding-2-openai`. | `gemini-embedding-2` (default) |
|
||||
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | Base URL of the OpenAI-compatible LiteRT-LM embedding server. | `http://embedding-server:9379/v1` |
|
||||
| `ENABLE_EMBEDDING_AGENT` | When set to `true`, automatically provisions and enables the system embedding agent for all teams on startup. | `false` (default) |
|
||||
| `EMBEDDING_CHUNK_DURATION` | The duration in seconds for each video chunk when generating video embeddings. | `60.0` (default) |
|
||||
| `EMBEDDING_CHUNK_OVERLAP` | The duration in seconds to overlap video chunks when generating video embeddings. | `5.0` (default) |
|
||||
|
||||
## Sandbox Config
|
||||
|
||||
@@ -98,3 +112,29 @@ API keys to AI providers on startup.
|
||||
| `GEMINI_API_KEY` | API key for Google Gemini provider. | `AIzaSy...` |
|
||||
| `OPENAI_API_KEY` | API key for OpenAI provider. | `sk-proj-...` |
|
||||
| `ANTHROPIC_API_KEY` | API key for Anthropic provider. | `sk-ant-...` |
|
||||
|
||||
---
|
||||
|
||||
## External Integrations Config
|
||||
|
||||
Environment variables can configure external microservices globally. When set, these environment variables take precedence over any team-level settings configured in **Team Settings → Integrations**, and lock the corresponding settings fields in the WebUI to read-only.
|
||||
|
||||
### Gotenberg Document Converter
|
||||
|
||||
Used to convert Office documents, HTML, Markdown, and CSV files into high-fidelity PDF proxies for in-browser previewing. See the [Gotenberg Guide](/using-shumai/gotenberg) for setup instructions.
|
||||
|
||||
| Variable | Description | Example / Default |
|
||||
| :------------------------------ | :----------------------------------------------------------------------- | :---------------------- |
|
||||
| `GOTENBERG_URL` | Base URL of the external Gotenberg conversion API. | `http://gotenberg:3000` |
|
||||
| `GOTENBERG_BASIC_AUTH_USERNAME` | Username when Basic Authentication is enabled on the Gotenberg instance. | `admin` |
|
||||
| `GOTENBERG_BASIC_AUTH_PASSWORD` | Password when Basic Authentication is enabled on the Gotenberg instance. | `secret` |
|
||||
|
||||
### 3D Turntable Renderer
|
||||
|
||||
Used to convert 3D model files (GLB, OBJ, FBX, USD, STL, DAE) into interactive 360° turntable video proxies, posters, and hover sprites. See the [3D Asset Support Guide](/using-shumai/3d-asset-support) for setup instructions.
|
||||
|
||||
| Variable | Description | Example / Default |
|
||||
| :--------------------------------------- | :-------------------------------------------------------------------------------------------------------------- | :------------------------------- |
|
||||
| `TURNTABLE_RENDERER_URL` | Base URL of the external turntable-renderer service. | `http://turntable-renderer:3000` |
|
||||
| `TURNTABLE_RENDERER_BASIC_AUTH_USERNAME` | Username when Basic Authentication is enabled on the turntable renderer (alias: `TURNTABLE_RENDERER_USERNAME`). | `admin` |
|
||||
| `TURNTABLE_RENDERER_BASIC_AUTH_PASSWORD` | Password when Basic Authentication is enabled on the turntable renderer (alias: `TURNTABLE_RENDERER_PASSWORD`). | `secret` |
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
---
|
||||
title: Hardware Transcoding
|
||||
description: Accelerate video transcoding and reduce CPU load with GPU hardware acceleration.
|
||||
---
|
||||
|
||||
High-resolution camera recordings, phone videos, and animation media files require proxy transcoding to play smoothly in web browsers. Shumai transcodes these assets in the background, generating a universal `180p` proxy for instant scrubbing alongside full-resolution preview streams.
|
||||
|
||||
Hardware-accelerated transcoding allows you to offload video encoding to a dedicated or integrated GPU, dramatically speeding up processing and freeing host CPU cores for other services.
|
||||
|
||||
Shumai includes a built-in usability probe that tests hardware encoders at startup, alongside automatic runtime fallback during video processing. If GPU drivers or device nodes are unavailable, or if a hardware encoder encounters hardware limits (such as resolution or dimension constraints on certain GPUs) or runtime driver errors, Shumai seamlessly falls back to software encoding (`libx264`) without failing user tasks.
|
||||
|
||||
---
|
||||
|
||||
## Supported Backends
|
||||
|
||||
| Backend | Hardware Platform | Container Driver / Devices |
|
||||
| :-------------- | :--------------------------------- | :----------------------------------------------- |
|
||||
| **`nvenc`** | NVIDIA GPUs | NVIDIA Container Toolkit (`gpu, compute, video`) |
|
||||
| **`quicksync`** | Intel Integrated & Arc GPUs | `/dev/dri` render nodes |
|
||||
| **`vaapi`** | AMD & Intel GPUs | `/dev/dri` render nodes |
|
||||
| **`rkmpp`** | Rockchip ARM SoCs (e.g. RK3588) | `/dev/rga`, `/dev/dri`, `/dev/mpp_service` |
|
||||
| **`vaapi-wsl`** | Windows Subsystem for Linux (WSL2) | `/dev/dri`, `/dev/dxg`, `/usr/lib/wsl` |
|
||||
|
||||
---
|
||||
|
||||
## Limitations
|
||||
|
||||
- The instructions on this page focus on **Docker Compose**. Other container orchestrators (such as Kubernetes or Podman) require equivalent device passthrough configurations.
|
||||
- **Docker Desktop on macOS** runs inside a Linux virtual machine and does not support Apple Silicon VideoToolbox passthrough. (VideoToolbox hardware acceleration is supported when running Shumai natively via NPM or from source).
|
||||
- Hardware transcoding produces slightly different bitrate characteristics compared to software encoding. Shumai uses adaptive variable bitrate (VBR) rate control tailored to web streaming to maintain visual fidelity.
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### NVENC (NVIDIA)
|
||||
|
||||
1. Ensure the official NVIDIA graphics driver is installed on the host:
|
||||
```bash
|
||||
nvidia-smi
|
||||
```
|
||||
2. Install the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) on the host and restart Docker:
|
||||
```bash
|
||||
sudo apt-get install -y nvidia-container-toolkit
|
||||
sudo nvidia-ctk runtime configure --runtime=docker
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
### QuickSync & VA-API (Intel / AMD)
|
||||
|
||||
1. Verify that the Linux kernel has initialized the Direct Rendering Infrastructure (DRI) render node:
|
||||
```bash
|
||||
ls -la /dev/dri
|
||||
```
|
||||
You should see `card0` and `renderD128` (or similar).
|
||||
2. Shumai's Docker image automatically adjusts group permissions on container startup so the non-root application user can access host `/dev/dri` devices without permission errors.
|
||||
|
||||
#### GPU decoding
|
||||
|
||||
With VA-API, Shumai decodes and resizes video on the GPU as well as encoding it, so frames never leave GPU memory. This is much faster than decoding on the CPU, especially for 4K sources on integrated graphics. (Other backends currently decode on the CPU and encode on the GPU.)
|
||||
|
||||
Some videos automatically use CPU decoding with GPU encoding instead:
|
||||
|
||||
- Codecs your GPU cannot decode, such as HEVC or 10-bit video on older Intel chips. Shumai tries the GPU first and retries on the CPU within a second.
|
||||
- Rotated videos, such as portrait phone recordings, so they keep the correct orientation.
|
||||
- Watermarked share links and HDR sources.
|
||||
|
||||
If a GPU-decode attempt stops making progress for 2 minutes (some driver bugs make ffmpeg hang instead of failing), Shumai stops it and retries on the CPU. Change the limit with `SHUMAI_HW_DECODE_STALL_TIMEOUT` (in seconds).
|
||||
|
||||
To always decode on the CPU, set `SHUMAI_HW_DECODE=false` on the `shumai` service.
|
||||
|
||||
### WSL2 (Windows)
|
||||
|
||||
- Ensure you are running Windows 11 with WSL2 and have installed the appropriate GPU drivers on the Windows host.
|
||||
- Use the `vaapi-wsl` preset which maps `/dev/dxg` and `/usr/lib/wsl` into the container.
|
||||
|
||||
---
|
||||
|
||||
## Setup with Docker Compose
|
||||
|
||||
Shumai uses a modular `hwaccel.transcoding.yaml` companion file to configure hardware devices.
|
||||
|
||||
### Step 1: Download Configuration Files
|
||||
|
||||
In your Shumai deployment directory, download the companion `hwaccel.transcoding.yaml` alongside `docker-compose.yaml`:
|
||||
|
||||
```bash
|
||||
# Global / Official
|
||||
curl -o hwaccel.transcoding.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/hwaccel.transcoding.yaml
|
||||
|
||||
# Accelerated Mirror (Mainland China)
|
||||
curl -o hwaccel.transcoding.yaml https://gh-proxy.com/https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/hwaccel.transcoding.yaml
|
||||
```
|
||||
|
||||
### Step 2: Enable Hardware Acceleration in Docker Compose
|
||||
|
||||
Open `docker-compose.yaml` (or `docker-compose-aliyun.yaml`), find the commented `extends` block under the `shumai` service, and uncomment it:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
shumai:
|
||||
# ...
|
||||
# Hardware Acceleration (NVENC / QuickSync / VA-API / RKMPP)
|
||||
extends:
|
||||
file: hwaccel.transcoding.yaml
|
||||
service: nvenc # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl]
|
||||
```
|
||||
|
||||
Replace `nvenc` with your target backend:
|
||||
|
||||
- `nvenc` for NVIDIA GPUs
|
||||
- `quicksync` for Intel Quick Sync
|
||||
- `vaapi` for AMD or Intel VA-API
|
||||
- `rkmpp` for Rockchip SoCs
|
||||
- `vaapi-wsl` for WSL2 on Windows
|
||||
|
||||
### Step 3: Start the Stack
|
||||
|
||||
Restart or recreate the Shumai container:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Single Compose File Setup (Unraid / Portainer)
|
||||
|
||||
If your environment or container manager does not support multi-file `extends`, you can inline the hardware configuration directly into the `shumai` service in `docker-compose.yaml`:
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="NVIDIA NVENC">
|
||||
```yaml
|
||||
services:
|
||||
shumai:
|
||||
# ...
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: 1
|
||||
capabilities:
|
||||
- gpu
|
||||
- compute
|
||||
- video
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Intel QuickSync / AMD VA-API">
|
||||
```yaml services: shumai: # ... devices: - /dev/dri:/dev/dri ```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="WSL2 (Windows)">
|
||||
```yaml services: shumai: # ... devices: - /dev/dri:/dev/dri - /dev/dxg:/dev/dxg volumes: -
|
||||
/usr/lib/wsl:/usr/lib/wsl environment: - LIBVA_DRIVER_NAME=d3d12 ```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Rockchip RKMPP">
|
||||
```yaml
|
||||
services:
|
||||
shumai:
|
||||
# ...
|
||||
security_opt:
|
||||
- systempaths=unconfined
|
||||
- apparmor=unconfined
|
||||
group_add:
|
||||
- video
|
||||
devices:
|
||||
- /dev/rga:/dev/rga
|
||||
- /dev/dri:/dev/dri
|
||||
- /dev/dma_heap:/dev/dma_heap
|
||||
- /dev/mpp_service:/dev/mpp_service
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
---
|
||||
|
||||
## Web UI Settings
|
||||
|
||||
In the Shumai Web UI, navigate to **Team Settings** > **Transcoding Settings**.
|
||||
|
||||
- **Auto (Recommended)**: Shumai automatically probes candidate hardware encoders in optimal order (`h264_nvenc` → `h264_vaapi` → `h264_qsv` → `h264_amf` → `libx264`). If hardware acceleration is unavailable, it gracefully uses software encoding.
|
||||
- **Explicit Encoder**: You can pin the transcode pipeline to a specific encoder (e.g. `NVENC`, `Quick Sync`, `VA-API`).
|
||||
- **Off**: Forces CPU software encoding (`libx264`) for all video jobs.
|
||||
|
||||
---
|
||||
|
||||
## Verification & Monitoring
|
||||
|
||||
### Check Transcode Logs
|
||||
|
||||
When video transcoding begins on an uploaded asset, Shumai writes a structured log indicating the chosen encoder:
|
||||
|
||||
```bash
|
||||
docker compose logs -f shumai
|
||||
```
|
||||
|
||||
Look for the `Starting video transcoding` log entry:
|
||||
|
||||
```json
|
||||
{
|
||||
"level": 30,
|
||||
"time": 1790414665096,
|
||||
"encoder": "h264_nvenc",
|
||||
"hardwareAcceleration": "auto",
|
||||
"inputFile": "/tmp/transcode-.../video.mp4",
|
||||
"outputFile": "/tmp/transcode-.../video-180p.mp4",
|
||||
"msg": "Starting video transcoding"
|
||||
}
|
||||
```
|
||||
|
||||
If hardware acceleration was successfully initialized, `encoder` will show `h264_nvenc`, `h264_vaapi`, or `h264_qsv`.
|
||||
|
||||
### Monitor GPU Utilization
|
||||
|
||||
While transcoding a video, you can observe hardware utilization on the host:
|
||||
|
||||
- **NVIDIA**:
|
||||
```bash
|
||||
nvidia-smi
|
||||
# or
|
||||
nvtop
|
||||
```
|
||||
- **Intel**:
|
||||
```bash
|
||||
sudo intel_gpu_top
|
||||
```
|
||||
- **AMD**:
|
||||
```bash
|
||||
sudo radeontop
|
||||
```
|
||||
@@ -1,85 +0,0 @@
|
||||
---
|
||||
title: Deploy with Temporal
|
||||
description: Configure a high-scale production deployment using Temporal and S3-compatible storage.
|
||||
---
|
||||
|
||||
For production environments or workloads with high-volume video processing and heavy AI agent usage, running background tasks on a single server can cause bottlenecks. Shumai resolves this by offloading task queue management, retries, and background executions to **Temporal**.
|
||||
|
||||
This allows you to decouple workloads and run specialized worker nodes on separate, dedicated machines.
|
||||
|
||||
---
|
||||
|
||||
## How it Works
|
||||
|
||||
When configured for Temporal, the core Shumai web application does not process background jobs itself. Instead, it publishes tasks to a Temporal Cluster queue.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
UserUpload[User Uploads Video] --> WebApp[Shumai Web UI / API]
|
||||
WebApp -->|Register Task| Temporal[Temporal Cluster]
|
||||
Temporal -->|Queue: Transcoding| TranscodeWorker[Transcode Worker Machine]
|
||||
Temporal -->|Queue: AI Agents| AgentWorker[Agent Worker Machine]
|
||||
```
|
||||
|
||||
- **Transcoding Workers**: Can be run on GPU-accelerated or high-CPU compute instances.
|
||||
- **AI Agent Workers**: Can be run on isolated, sandboxed hosts to safely execute automation scripts.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Storage Requirement**: Because the core application and the background workers run on separate machines in a distributed setup, **you must configure an S3-compatible storage backend** (such as AWS S3, Cloudflare R2, or MinIO). Local storage (`STORAGE_BACKEND=local`) is not supported in this mode because the workers and the web application do not share a common filesystem.
|
||||
|
||||
---
|
||||
|
||||
## Step 1: Deploy the Core Stack
|
||||
|
||||
On your primary host machine, spin up the database, Temporal cluster services, and the main Shumai web application:
|
||||
|
||||
1. **Download the Temporal Stack Configuration**:
|
||||
```bash
|
||||
curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/temporal/docker-compose.yaml
|
||||
```
|
||||
2. **Configure S3 Settings**:
|
||||
Open the `docker-compose.yaml` file and set your S3 credentials and endpoint environment variables under the `shumai` service.
|
||||
3. **Start the Services**:
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
This exposes the web application on port `3000`, the database on `5432`, the Temporal gRPC service on `7233`, and the Temporal management dashboard on `8080`.
|
||||
|
||||
---
|
||||
|
||||
## Step 2: Configure & Run Workers
|
||||
|
||||
On your specialized worker machines, you will run the dedicated background worker services. Each worker requires a `.env` file referencing the database, S3 storage, and the Temporal cluster:
|
||||
|
||||
```env
|
||||
DATABASE_URL=postgresql://shumai:shumai_password@<primary-host-ip>:5432/shumai_db?schema=public
|
||||
WORKFLOW_EXECUTOR=temporal
|
||||
TEMPORAL_ADDRESS=<primary-host-ip>:7233
|
||||
STORAGE_BACKEND=s3
|
||||
AWS_ENDPOINT_URL_S3=https://your-s3-endpoint.com
|
||||
S3_BUCKET=shumai
|
||||
S3_REGION=us-east-1
|
||||
S3_ACCESS_KEY_ID=your-access-key-id
|
||||
S3_SECRET_ACCESS_KEY=your-secret-access-key
|
||||
```
|
||||
|
||||
### Media Transcoding Worker
|
||||
|
||||
Run this on your media processing nodes (requires system installations of `ffmpeg` and `ffprobe`):
|
||||
|
||||
```bash
|
||||
npm install -g @shumai-one/shumai-transcode
|
||||
shumai-transcode
|
||||
```
|
||||
|
||||
### AI Agent Worker
|
||||
|
||||
Run this on your sandboxed agent execution nodes (requires sandbox dependencies like `bubblewrap` or `sandbox-exec`):
|
||||
|
||||
```bash
|
||||
npm install -g @shumai-one/shumai-agent
|
||||
shumai-agent
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **For Bun Users:** Since the worker package binaries contain a `#!/usr/bin/env node` shebang, running `shumai-transcode` or `shumai-agent` directly will run under Node.js. If you wish to run them using Bun, prefix the commands with `bun run --bun` (e.g., `bun run --bun shumai-transcode` or `bun run --bun shumai-agent`).
|
||||
+19
-4
@@ -12,6 +12,14 @@
|
||||
"light": "#F5B895",
|
||||
"dark": "#A8384D"
|
||||
},
|
||||
"navbar": {
|
||||
"links": [
|
||||
{
|
||||
"label": "Changelog",
|
||||
"href": "/changelog"
|
||||
}
|
||||
]
|
||||
},
|
||||
"navigation": {
|
||||
"groups": [
|
||||
{
|
||||
@@ -36,7 +44,9 @@
|
||||
"using-shumai/collections",
|
||||
"using-shumai/share-links",
|
||||
"using-shumai/nle-and-premiere",
|
||||
"using-shumai/gotenberg"
|
||||
"using-shumai/3d-asset-support",
|
||||
"using-shumai/gotenberg",
|
||||
"using-shumai/embedding-server"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -57,16 +67,21 @@
|
||||
"pages": [
|
||||
"using-shumai/transcode-settings",
|
||||
"using-shumai/quotas-settings",
|
||||
"using-shumai/email-notifications",
|
||||
"using-shumai/password-reset"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Configuration",
|
||||
"pages": ["configuration/env-variables"]
|
||||
"pages": ["configuration/env-variables", "configuration/hardware-transcoding"]
|
||||
},
|
||||
{
|
||||
"group": "Temporal Deployment",
|
||||
"pages": ["configuration/temporal"]
|
||||
"group": "Distributed Deployment",
|
||||
"pages": ["configuration/distributed"]
|
||||
},
|
||||
{
|
||||
"group": "Releases",
|
||||
"pages": ["changelog"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -32,6 +32,6 @@ Ideal for small teams, local development, or low-volume workflows. In this setup
|
||||
|
||||
### 2. High-Scale Distributed Deployment
|
||||
|
||||
Recommended for production environments with high-volume video uploads. In this setup, background tasks are managed via a centralized queue (Temporal). This allows you to offload heavy workloads to specialized worker machines (for example, putting video transcoding tasks on high-CPU/GPU machines and AI agents on separate sandboxed environments).
|
||||
Recommended for production environments with high-volume video uploads. In this setup, background tasks are managed via durable queues (orchestrated by DBOS directly in PostgreSQL). This allows you to offload heavy workloads to specialized worker machines (for example, putting video transcoding tasks on high-CPU/GPU machines and AI agents on separate sandboxed environments).
|
||||
|
||||
_Note: S3-compatible cloud storage is required for distributed deployments so that all workers can access the uploaded files._
|
||||
|
||||
@@ -12,9 +12,14 @@ We support three installation options. For most administrators, **Docker Compose
|
||||
Docker Compose automatically configures and spins up all required services (the web application, a database, and local storage).
|
||||
|
||||
1. **Download the Configuration**:
|
||||
|
||||
```bash
|
||||
curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/docker-compose.yaml
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> **Hardware Acceleration:** By default, the standard Compose stack uses CPU-based software transcoding. If your server has a dedicated or integrated GPU (NVIDIA, Intel, AMD, or Rockchip), see the [Hardware Transcoding Guide](/configuration/hardware-transcoding) to enable GPU acceleration via the companion `hwaccel.transcoding.yaml`.
|
||||
|
||||
2. **Start the Services**:
|
||||
```bash
|
||||
docker compose up -d
|
||||
@@ -22,9 +27,9 @@ Docker Compose automatically configures and spins up all required services (the
|
||||
3. **Access the Dashboard**:
|
||||
Open your browser and navigate to **`http://localhost:3000`** to access the Shumai Web UI.
|
||||
|
||||
### Production Deployments (Temporal)
|
||||
### Production Deployments (Distributed Workers)
|
||||
|
||||
If you are deploying Shumai for a production team with high-volume video uploads, we recommend setting up a distributed deployment using **Temporal** and an S3-compatible storage backend. This offloads resource-heavy video transcoding and AI agents to separate, dedicated worker nodes to keep your main dashboard fast and responsive. For setup instructions, see the [Deploy with Temporal](/configuration/temporal) guide.
|
||||
If you are deploying Shumai for a production team with high-volume video uploads, we recommend setting up a distributed deployment using dedicated workers and an S3-compatible storage backend. This offloads resource-heavy video transcoding and AI agents to separate, dedicated worker nodes to keep your main dashboard fast and responsive. For setup instructions, see the [Deploy with Distributed Workers](/configuration/distributed) guide.
|
||||
|
||||
---
|
||||
|
||||
@@ -39,6 +44,9 @@ To handle media processing and security isolation, the host machine must have th
|
||||
- **FFmpeg & FFprobe**: Required for video transcoding and metadata extraction.
|
||||
- _macOS_: `brew install ffmpeg`
|
||||
- _Linux (Ubuntu/Debian)_: `sudo apt-get install ffmpeg`
|
||||
- **dcraw_emu (LibRaw)**: Required for camera RAW image decoding and preview generation.
|
||||
- _macOS_: `brew install libraw`
|
||||
- _Linux (Ubuntu/Debian)_: `sudo apt-get install libraw-bin`
|
||||
- **Agent Sandbox Utilities**: Used to run custom automation scripts securely.
|
||||
- _macOS_: `brew install ripgrep`
|
||||
- _Linux (Ubuntu/Debian)_: `sudo apt-get install bubblewrap socat ripgrep`
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
---
|
||||
title: 3D Asset Support with Turntable Renderer
|
||||
description: Render interactive 3D model turntable previews, sprite scrubbing, and video proxies using turntable-renderer.
|
||||
---
|
||||
|
||||
3D models and mesh assets cannot always be rendered consistently or inspected reliably across diverse client web browsers and mobile devices. Shumai integrates with [turntable-renderer](https://github.com/shumaiOne/turntable-renderer) — a standalone service that executes isolated, headless Blender 5.2 LTS subprocesses — to convert 3D model uploads into standardized, high-fidelity turntable previews.
|
||||
|
||||
Turntable Renderer automatically produces:
|
||||
|
||||
- **1080×1080 Turntable Video (`turntable.mp4`)**: A 4-second, 24-frame, 6 fps video rotating the model 360° (15° per frame) clockwise under dark studio lighting with a pure black background.
|
||||
- **Poster Image (`poster.webp`)**: A crisp still poster for grid cards and immediate file display.
|
||||
- **Hover Sprite Sheet (`sprite.webp`)**: A fast scrubbing sheet allowing users to rotate and inspect the model directly from the file browser on hover.
|
||||
- **Interactive 3D Viewer**: A specialized web viewer featuring 360° ruler scrubbing, rotation angle control (0° to 345°), playback controls, and angle-specific review comments and visual markups.
|
||||
|
||||
---
|
||||
|
||||
## Supported File Types
|
||||
|
||||
When turntable-renderer is configured, Shumai automatically generates 3D turntable proxies for the following formats:
|
||||
|
||||
| Format / Standard | Extensions |
|
||||
| --------------------------- | --------------------------------- |
|
||||
| Binary glTF | `.glb` |
|
||||
| Universal Scene Description | `.usd`, `.usda`, `.usdc`, `.usdz` |
|
||||
| Autodesk FBX | `.fbx` |
|
||||
| Wavefront OBJ | `.obj` |
|
||||
| Stereolithography (STL) | `.stl` |
|
||||
| COLLADA | `.dae` |
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
|
||||
Shumai supports configuring the turntable renderer either through the **WebUI** or via **Environment Variables**.
|
||||
|
||||
### 1. WebUI (Team Settings → Integrations)
|
||||
|
||||
Team owners can configure the turntable renderer directly from the web interface:
|
||||
|
||||
1. Navigate to **Team Settings** from the sidebar.
|
||||
2. Select the **Integrations** tab.
|
||||
3. Under **3D Turntable Renderer**, enter the **Server URL** (e.g. `http://turntable-renderer:3000` or `http://localhost:3003`).
|
||||
4. Enter the **Username** and **Password** if Basic Authentication is enabled on the service.
|
||||
5. Click **Test Connection** to verify that Shumai can communicate with the renderer and check the detected Blender version.
|
||||
6. Click **Save Changes**.
|
||||
|
||||
### 2. Environment Variables
|
||||
|
||||
You can also configure turntable-renderer globally across the system using environment variables on the machine running Shumai or the transcode workers:
|
||||
|
||||
| Variable | Required | Description |
|
||||
| ---------------------------------------- | --------------- | ------------------------------------------------------------------------------------- |
|
||||
| `TURNTABLE_RENDERER_URL` | Yes (to enable) | Base URL of the turntable renderer service, e.g. `http://turntable-renderer:3000`. |
|
||||
| `TURNTABLE_RENDERER_BASIC_AUTH_USERNAME` | No | Username when Basic Authentication is enabled (alias: `TURNTABLE_RENDERER_USERNAME`). |
|
||||
| `TURNTABLE_RENDERER_BASIC_AUTH_PASSWORD` | No | Password when Basic Authentication is enabled (alias: `TURNTABLE_RENDERER_PASSWORD`). |
|
||||
|
||||
### Configuration Priority & Read-Only Mode
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Environment variables take highest priority.** If `TURNTABLE_RENDERER_URL` is set in your environment, Shumai will always use the environment variable configuration.
|
||||
>
|
||||
> When configured via environment variables, the settings in **Team Settings → Integrations** will display a **Configured via environment variables (Read-only)** badge, and the input fields will be locked to prevent accidental changes or configuration drift.
|
||||
|
||||
---
|
||||
|
||||
## Deploying Turntable Renderer
|
||||
|
||||
### Docker Quickstart
|
||||
|
||||
The easiest way to run `turntable-renderer` is using the prebuilt Docker image:
|
||||
|
||||
```bash
|
||||
docker run -d --rm \
|
||||
--name turntable-renderer \
|
||||
-p 3003:3000 \
|
||||
-e TURNTABLE_RENDERER_API_BASIC_AUTH_USERNAME=admin \
|
||||
-e TURNTABLE_RENDERER_API_BASIC_AUTH_PASSWORD=your_password \
|
||||
shumaione/turntable-renderer:latest
|
||||
```
|
||||
|
||||
> **Note**: Host port `3003` maps to internal container port `3000`.
|
||||
|
||||
### Docker Compose Setup
|
||||
|
||||
Add a `turntable-renderer` service to your `docker-compose.yaml`:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
turntable-renderer:
|
||||
image: shumaione/turntable-renderer:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- '3003:3000'
|
||||
environment:
|
||||
TURNTABLE_RENDERER_API_BASIC_AUTH_USERNAME: admin
|
||||
TURNTABLE_RENDERER_API_BASIC_AUTH_PASSWORD: your_password
|
||||
```
|
||||
|
||||
Then point Shumai at it:
|
||||
|
||||
```bash
|
||||
TURNTABLE_RENDERER_URL=http://localhost:3003
|
||||
TURNTABLE_RENDERER_BASIC_AUTH_USERNAME=admin
|
||||
TURNTABLE_RENDERER_BASIC_AUTH_PASSWORD=your_password
|
||||
```
|
||||
|
||||
_(If both Shumai and turntable-renderer run within the same Docker Compose network, use `http://turntable-renderer:3000` as the URL)._
|
||||
|
||||
### GPU Acceleration
|
||||
|
||||
A dedicated GPU is optional — turntable-renderer's CPU rendering pipeline is fast enough for modest hardware. When a GPU is passed into the container, it is automatically detected and leveraged.
|
||||
|
||||
#### Intel / AMD (Open Source Drivers)
|
||||
|
||||
Pass the DRI render node:
|
||||
|
||||
```bash
|
||||
docker run -d --rm \
|
||||
--name turntable-renderer \
|
||||
--shm-size=1gb \
|
||||
-p 3003:3000 \
|
||||
--device /dev/dri \
|
||||
-e TURNTABLE_RENDERER_API_BASIC_AUTH_USERNAME=admin \
|
||||
-e TURNTABLE_RENDERER_API_BASIC_AUTH_PASSWORD=your_password \
|
||||
shumaione/turntable-renderer:latest
|
||||
```
|
||||
|
||||
#### NVIDIA (Proprietary Drivers)
|
||||
|
||||
Requires host driver 580+ and the NVIDIA Container Toolkit (`--runtime nvidia`):
|
||||
|
||||
```bash
|
||||
docker run -d --rm \
|
||||
--name turntable-renderer \
|
||||
--shm-size=1gb \
|
||||
-p 3003:3000 \
|
||||
--runtime nvidia \
|
||||
--gpus all \
|
||||
--device /dev/nvidia-modeset \
|
||||
-e TURNTABLE_RENDERER_API_BASIC_AUTH_USERNAME=admin \
|
||||
-e TURNTABLE_RENDERER_API_BASIC_AUTH_PASSWORD=your_password \
|
||||
shumaione/turntable-renderer:latest
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Behavior Without Turntable Renderer
|
||||
|
||||
If turntable-renderer is not configured or unreachable:
|
||||
|
||||
- The 3D model upload completes successfully with status `processed`.
|
||||
- No turntable video proxy, sprite, or poster is generated.
|
||||
- The original raw 3D file is safely preserved and can be downloaded by team members.
|
||||
@@ -0,0 +1,127 @@
|
||||
---
|
||||
title: Email Notifications
|
||||
description: Configure team SMTP settings, deliver batched activity digest emails, and send test emails.
|
||||
---
|
||||
|
||||
Shumai includes a built-in email notification system that delivers updates on team activities—such as comments, mentions, new asset uploads, status changes, and Kanban tasks—directly to team members' inboxes.
|
||||
|
||||
To prevent inbox clutter and notification fatigue, Shumai does not send emails for every single action individually. Instead, a background delivery service aggregates pending notifications and sends periodic, batched digest emails with inline thumbnails and deep links.
|
||||
|
||||
---
|
||||
|
||||
## Configuring SMTP Settings
|
||||
|
||||
Email notification settings are managed at the team level by **Team Owners**.
|
||||
|
||||
To configure outgoing mail:
|
||||
|
||||
1. Click on **Team Settings** in the sidebar.
|
||||
2. Select the **Email Notifications** tab.
|
||||
3. Turn on the **Enable Email Notifications** switch.
|
||||
4. Fill in your SMTP server credentials and sender information.
|
||||
5. Click **Save** or **Save and Send Test Email**.
|
||||
|
||||
### SMTP Server Settings
|
||||
|
||||
| Field | Description | Example / Default |
|
||||
| :---------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------- |
|
||||
| **SMTP Host** | The hostname or IP address of your outgoing SMTP server. | `smtp.example.com` or `smtp.sendgrid.net` |
|
||||
| **SMTP Port** | The port used to connect to your SMTP server. | `587` (default, STARTTLS), `465` (SSL/TLS), or `25` |
|
||||
| **Username** | The username or API key required to authenticate with the SMTP server. | `user@example.com` or `apikey` |
|
||||
| **Password** | The authentication password or API secret. | `••••••••` |
|
||||
| **SSL / TLS (SMTPS)** | Connect directly using SSL/TLS encryption. Typically required when connecting over port `465`. | `Disabled` (default) |
|
||||
| **Ignore Certificate Errors** | Allows connections with self-signed, invalid, or unverified TLS certificates. Useful for local testing (e.g. Mailpit, MailHog) or private corporate relays. | `Disabled` (default) |
|
||||
|
||||
> [!TIP]
|
||||
> **Password Retention**: When updating existing email settings, you can leave the password input blank to keep the currently stored password. For security, stored passwords are never returned in cleartext to the client.
|
||||
|
||||
### Sender Information
|
||||
|
||||
| Field | Description | Example / Default |
|
||||
| :----------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------- |
|
||||
| **From** | The sender name and email address that will appear in the `From` header. Ensure your SMTP provider is authorized to send on behalf of this address. | `Shumai <noreply@example.com>` |
|
||||
| **Reply-To** | _(Optional)_ An email address to receive replies if members respond directly to a notification email. | `support@example.com` |
|
||||
|
||||
---
|
||||
|
||||
## Testing SMTP Delivery
|
||||
|
||||
Before relying on email delivery, you can verify your configuration and credentials directly from the settings page:
|
||||
|
||||
1. Click **Save and Send Test Email**.
|
||||
2. In the **Send Test Email** modal, verify or adjust the sender `From` address.
|
||||
3. Click **Send Test Email**.
|
||||
|
||||
Shumai will perform an active handshake verification (`transport.verify()`) against your SMTP server and dispatch a styled test message to the email address of the currently logged-in administrator.
|
||||
|
||||
If the handshake or delivery fails (for example, due to an invalid password, blocked outbound port, or rejected sender address), an error toast is displayed with the exact message returned by the SMTP server.
|
||||
|
||||
---
|
||||
|
||||
## Delivery Architecture & Digest Batching
|
||||
|
||||
Shumai uses an asynchronous, batched architecture for email delivery:
|
||||
|
||||
```
|
||||
[ Team Activity ]
|
||||
(Comments, Uploads, Mentions, Kanban)
|
||||
│
|
||||
▼
|
||||
[ Database Queue ] (status: pending)
|
||||
│
|
||||
▼ (Every 3 minutes)
|
||||
[ Notification Background Job ]
|
||||
│
|
||||
├─ Filter recipients (check user preferences & project scope)
|
||||
├─ Exclude self-actions and AI agents
|
||||
├─ Group & collapse items (clusters > 3 summarized)
|
||||
├─ Fetch avatars & thumbnails as inline CID attachments
|
||||
│
|
||||
▼
|
||||
[ Nodemailer Transport ] ──> SMTP Server ──> [ Member Inboxes ]
|
||||
```
|
||||
|
||||
### 1. Periodic Background Delivery
|
||||
|
||||
Notifications are queued in PostgreSQL with a `pending` status. A background job runs periodically every **3 minutes**, acquiring pending notifications using atomic queue locking (`FOR UPDATE SKIP LOCKED`). This ensures safe delivery without duplicate emails even when multiple server instances run concurrently.
|
||||
|
||||
### 2. Digest Bundling
|
||||
|
||||
Rather than sending an email immediately for each action, all notifications collected for a recipient during the 3-minute window are combined into a single digest email. This keeps team communication organized and eliminates inbox spam during heavy collaboration sessions.
|
||||
|
||||
### 3. Smart Activity Collapsing
|
||||
|
||||
When an event cluster contains a high volume of items (for example, when an editor uploads dozens of video clips at once), Shumai automatically groups and collapses the items:
|
||||
|
||||
- If **3 or fewer** items are in a group, each item is displayed with its individual thumbnail and details.
|
||||
- If **more than 3** items are uploaded together, Shumai summarizes them into a single concise notification (e.g., _"Alice uploaded 12 new files to Project Alpha"_) with a preview of the first three file names.
|
||||
|
||||
### 4. Inline CID Attachments
|
||||
|
||||
Avatars and video/image asset thumbnails are retrieved from storage and embedded directly into the email as inline MIME attachments (`cid:...`).
|
||||
|
||||
Unlike external image links, inline CID attachments:
|
||||
|
||||
- Display immediately in desktop and mobile email clients (such as Apple Mail, Gmail, and Outlook) without being blocked by "show remote content" security warnings.
|
||||
- Do not require publicly accessible S3 URLs or reverse-proxy authentication to render.
|
||||
|
||||
### 5. Deep Linking
|
||||
|
||||
Every notification card in the email includes deep-linking action buttons (such as **View Asset**, **View Project**, or **View Task**) that navigate members straight to the corresponding resource in Shumai.
|
||||
|
||||
To ensure links point to your public domain instead of `localhost`, configure the `APP_URL` or `BETTER_AUTH_URL` environment variable on your Shumai server:
|
||||
|
||||
```bash
|
||||
APP_URL=https://shumai.example.com
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Member Preferences & Filtering
|
||||
|
||||
Email delivery respects team permissions and member choices:
|
||||
|
||||
- **Personal Preferences**: Team members can independently choose which types of activities they receive by opening **Team Settings > Notifications**. If a user disables notifications for a category (e.g. general comments or status updates), Shumai will not include those items in their email digests.
|
||||
- **Self-Action Suppression**: Members never receive notification emails for their own comments, uploads, or task updates (unless they explicitly enable the **Your Uploads** preference to be notified when their own media transcoding completes).
|
||||
- **Project Scope**: Members whose access is restricted to specific projects only receive email digests for activities within those assigned projects, unless they are explicitly `@mentioned`.
|
||||
- **AI Agents**: Automated AI agent accounts are automatically excluded from receiving email notifications.
|
||||
@@ -0,0 +1,131 @@
|
||||
---
|
||||
title: Embedding Server Setup (EmbeddingGemma 2)
|
||||
description: Run local, offline multimodal vector embeddings for semantic search using shumaiOne/embedding-server.
|
||||
---
|
||||
|
||||
Shumai supports local, self-hosted multimodal vector embeddings for semantic search through [shumaiOne/embedding-server](https://github.com/shumaiOne/embedding-server) — a standalone Docker service powered by Google AI Edge's **LiteRT-LM** and **EmbeddingGemma 2 740M**.
|
||||
|
||||
The embedding server provides a unified 768-dimensional vector space across text, images, and video frames with an OpenAI-compatible HTTP API (`/v1/embeddings`). Because the model weights are pre-baked directly into the Docker image, the server operates completely offline and air-gapped without requiring external network access or third-party cloud API keys.
|
||||
|
||||
---
|
||||
|
||||
## Model Architecture & Specs
|
||||
|
||||
| Property | Value |
|
||||
| :------------------------ | :------------------------------------------------------- |
|
||||
| **Model** | `EmbeddingGemma 2 740M` (`google/embeddinggemma-2-740m`) |
|
||||
| **Runtime** | Google AI Edge LiteRT-LM (Python 3.14 Debian slim) |
|
||||
| **Vector Dimensionality** | 768 dimensions (multimodal: text, image, and video) |
|
||||
| **Context Window** | 2,048 tokens |
|
||||
| **Network Mode** | Completely offline capable (`--network none`) |
|
||||
| **API Standard** | OpenAI-compatible `/v1/embeddings` |
|
||||
|
||||
---
|
||||
|
||||
## Video Processing & Sampling
|
||||
|
||||
For video assets, Shumai breaks videos into standardized segments and extracts keyframes:
|
||||
|
||||
- **Chunking**: Videos are divided into **60-second chunks** with a **5-second overlap** at segment boundaries to preserve narrative and visual context.
|
||||
- **Frame Extraction Rate**: Shumai extracts **15 frames per minute** from each chunk.
|
||||
- **Adaptive Frame Bounding**:
|
||||
- For standard aspect ratios (1:1, 4:3, 3:4, 16:9, 9:16, 21:9), Shumai extracts 15 frames, which produces ~1,982 prompt tokens and stays safely within the 2,048-token context window.
|
||||
- For non-standard or custom aspect ratios (e.g. 5:3, 1.4:1), Shumai automatically samples 14 frames (~1,990 tokens) to mathematically guarantee that prompt length never exceeds 2,048 tokens, preventing out-of-memory errors on the embedding server.
|
||||
|
||||
---
|
||||
|
||||
## Important: Changing Embedding Providers Breaks Existing Embeddings
|
||||
|
||||
> [!WARNING]
|
||||
> **Vector spaces from different embedding models are completely incompatible.**
|
||||
>
|
||||
> If you change your embedding provider (for example, switching from Google Gemini's 1536-dimensional embeddings to EmbeddingGemma's 768-dimensional embeddings, or vice versa), **all existing vector embeddings in your database become invalid**.
|
||||
>
|
||||
> To protect production databases from accidental corruption and search failures, **Shumai intentionally does not provide a WebUI toggle to change the embedding provider**. The provider can only be configured by an administrator via environment variables (`EMBEDDING_PROVIDER` and `GEMMA_EMBEDDING_OPENAI_BASE_URL`).
|
||||
|
||||
---
|
||||
|
||||
## Regenerating Embeddings via CLI
|
||||
|
||||
When you do switch embedding providers or configure the embedding server on an existing Shumai deployment, you can regenerate embeddings for all existing media files using the administrative CLI command:
|
||||
|
||||
### Inside Docker
|
||||
|
||||
```bash
|
||||
docker exec -it <shumai-container-name> shumai regenerate-embeddings
|
||||
```
|
||||
|
||||
### Local / Bare Metal
|
||||
|
||||
```bash
|
||||
shumai regenerate-embeddings
|
||||
```
|
||||
|
||||
_(Alternatively, `bun apps/web/src/index.ts regenerate-embeddings`)_
|
||||
|
||||
### What the Command Does
|
||||
|
||||
1. **Scans Teams**: Checks all teams in your workspace. If a team does not have an active (enabled) embedding agent, it logs a warning and safely skips that team.
|
||||
2. **Clears Existing Embeddings**: Purges all previous embeddings and cancels any pending/in-progress embedding tasks for eligible assets to ensure a clean transition to the new provider.
|
||||
3. **Enqueues Fresh Tasks**: Queues new background `ai_embedding` tasks for all eligible assets (images, videos, and 3D assets with rendered previews) across active teams.
|
||||
4. **Background Execution**: Background workers process the queued tasks according to your configured concurrency limits.
|
||||
|
||||
---
|
||||
|
||||
## Deployment & Configuration
|
||||
|
||||
### Docker Quickstart
|
||||
|
||||
To run the standalone embedding server container:
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name shumai_embedding \
|
||||
-p 9379:9379 \
|
||||
shumaione/embedding-server:latest
|
||||
```
|
||||
|
||||
### Docker Compose Setup
|
||||
|
||||
In Docker Compose environments, add `embedding-server` to your `docker-compose.yaml` and configure Shumai to connect to it over Docker's internal network:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
embedding-server:
|
||||
image: shumaione/embedding-server:latest
|
||||
container_name: shumai_embedding
|
||||
restart: unless-stopped
|
||||
|
||||
shumai:
|
||||
image: shumaione/shumai:latest
|
||||
environment:
|
||||
# Embedding Server Configuration
|
||||
EMBEDDING_PROVIDER: gemma-embedding-2-openai
|
||||
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
|
||||
ENABLE_EMBEDDING_AGENT: 'true'
|
||||
CONCURRENCY_AGENT: 1
|
||||
depends_on:
|
||||
- embedding-server
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Since Shumai communicates with `embedding-server` over Docker's internal network, `embedding-server` does not need to expose any ports to the host machine.
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Variable | Required | Description | Default |
|
||||
| :-------------------------------- | :---------- | :---------------------------------------------------------------------------------------------------------------------------- | :------------------------- |
|
||||
| `EMBEDDING_PROVIDER` | Yes | Set to `gemma-embedding-2-openai` to use the local LiteRT-LM server. | `gemini-embedding-2` |
|
||||
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | Yes | HTTP base URL of the embedding server (e.g. `http://embedding-server:9379/v1`). | `http://localhost:9379/v1` |
|
||||
| `ENABLE_EMBEDDING_AGENT` | No | Automatically provisions and enables the system embedding agent for all teams on startup. | `false` |
|
||||
| `CONCURRENCY_AGENT` | Recommended | Maximum concurrent AI tasks executed by workers. **Set to `1`** when running `embedding-server` to prevent high memory usage. | `5` |
|
||||
|
||||
---
|
||||
|
||||
## Hardware & Resource Requirements
|
||||
|
||||
- **Memory (RAM)**:
|
||||
- We recommend at least **4 GB+ of dedicated system RAM** for the `embedding-server` container.
|
||||
- Overall host system memory should be **4 GB+** when running the Lite+Embedding compose stack, and **8 GB+** for the full stack.
|
||||
- **Concurrency**:
|
||||
- Always set `CONCURRENCY_AGENT=1` in your Shumai configuration when using `embedding-server`. Parallel multimodal embedding generations consume significant memory and can cause Docker containers to be terminated by the OS Out-Of-Memory (OOM) killer on low-resource machines.
|
||||
@@ -32,7 +32,22 @@ When Gotenberg is configured, Shumai automatically generates a PDF proxy for the
|
||||
|
||||
## Configuration
|
||||
|
||||
Gotenberg support is opt-in and controlled by the following environment variables on the machine running the transcode workers:
|
||||
Shumai supports configuring Gotenberg either through the **WebUI** or via **Environment Variables**.
|
||||
|
||||
### 1. WebUI (Team Settings → Integrations)
|
||||
|
||||
Team owners can configure Gotenberg directly from the web interface:
|
||||
|
||||
1. Navigate to **Team Settings** from the sidebar.
|
||||
2. Select the **Integrations** tab.
|
||||
3. Under **Gotenberg Document Converter**, enter the **Server URL** (e.g. `http://gotenberg:3000` or `http://localhost:3000`).
|
||||
4. Enter the **Username** and **Password** if Basic Authentication is enabled on the service.
|
||||
5. Click **Test Connection** to test communication with Gotenberg and verify its health.
|
||||
6. Click **Save Changes**.
|
||||
|
||||
### 2. Environment Variables
|
||||
|
||||
Gotenberg can also be configured globally across the system using environment variables on the machine running Shumai or the transcode workers:
|
||||
|
||||
| Variable | Required | Description |
|
||||
| ------------------------------- | --------------- | ---------------------------------------------------------------- |
|
||||
@@ -40,6 +55,15 @@ Gotenberg support is opt-in and controlled by the following environment variable
|
||||
| `GOTENBERG_BASIC_AUTH_USERNAME` | No | Username when Basic Authentication is enabled on Gotenberg. |
|
||||
| `GOTENBERG_BASIC_AUTH_PASSWORD` | No | Password when Basic Authentication is enabled on Gotenberg. |
|
||||
|
||||
### Configuration Priority & Read-Only Mode
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Environment variables take highest priority.** If `GOTENBERG_URL` is set in your environment, Shumai will always use the environment variable configuration.
|
||||
>
|
||||
> When configured via environment variables, the settings in **Team Settings → Integrations** will display a **Configured via environment variables (Read-only)** badge, and the input fields will be locked to prevent accidental changes or configuration drift.
|
||||
|
||||
### Deploying Gotenberg
|
||||
|
||||
### Docker Quickstart
|
||||
|
||||
You can start a Gotenberg container with a single command:
|
||||
|
||||
@@ -44,3 +44,11 @@ If you want to mute a specific project entirely (except for direct `@mentions` w
|
||||
- The **Bell** icon in the navigation bar displays a red badge when you have unread notifications.
|
||||
- Click the bell to open your notification feed panel.
|
||||
- Click any notification card to mark it as read and jump directly to the relevant file and comment thread.
|
||||
|
||||
---
|
||||
|
||||
## Email Notifications
|
||||
|
||||
In addition to in-app notifications, Team Owners can configure outgoing SMTP settings to deliver batched activity digest emails to team members. The email delivery engine honors each member's individual notification preferences configured above.
|
||||
|
||||
See the [Email Notifications Guide](/using-shumai/email-notifications) for full SMTP setup instructions, test email workflows, and delivery architecture details.
|
||||
|
||||
@@ -12,11 +12,10 @@ Traditional search relies on matching exact characters (e.g., searching "dog" wi
|
||||
Semantic search translates text queries and file contents into conceptual profiles. Similar ideas and visuals are mapped near each other.
|
||||
|
||||
1. **Index Generation**: When you upload an asset, Shumai's background agent scans the file's visual elements, text contents, or descriptions, translating them into a concept profile.
|
||||
- **Video Processing**: Shumai uses **gemini-embedding-2** for video indexing.
|
||||
- **Chunking**: For long videos, Shumai breaks them into chunks to ensure high-quality indexing. By default, chunks are **60 seconds** long with a **5-second overlap** to ensure no context is lost at the boundaries.
|
||||
- **Sampling**: The model processes a maximum of 32 frames per chunk: short chunks (≤32s) are sampled at 1 fps, while longer chunks are uniformly sampled to 32 frames.
|
||||
- **Optimization**: To optimize processing, Shumai automatically transcodes each chunk to **1 FPS** and **removes the audio track** before sending it to the embedding agent.
|
||||
- **Configuration**: Administrators can customize these settings using the `EMBEDDING_CHUNK_DURATION` and `EMBEDDING_CHUNK_OVERLAP` environment variables.
|
||||
- **Multimodal Embedding Providers**: Shumai supports two embedding providers:
|
||||
- **EmbeddingGemma 2 (Local)**: Powered by `shumaiOne/embedding-server` with 768-dimensional multimodal vectors running completely offline. Videos are sampled at **15 frames per minute** (14 frames for non-standard aspect ratios) per 60-second chunk. See the [Embedding Server Setup Guide](./embedding-server) for full details.
|
||||
- **Gemini Embedding 2 (Cloud)**: Powered by Google's `gemini-embedding-2` API with 1536-dimensional vectors. Videos are chunked into 60-second segments (sampled up to 32 frames per chunk at 1 fps with audio stripped).
|
||||
- **Chunking Configuration**: Administrators can customize chunk duration and overlap using the `EMBEDDING_CHUNK_DURATION` (default: 60s) and `EMBEDDING_CHUNK_OVERLAP` (default: 5s) environment variables.
|
||||
2. **Concept Matching**: When you search with the "Semantic" toggle enabled, Shumai matches the conceptual meaning of your query against your assets.
|
||||
3. **Result**: Searching "sunset at the beach" will successfully find a video file of ocean waves at dusk, even if the filename is `IMG_4029.mp4`.
|
||||
|
||||
|
||||
@@ -1,36 +1,82 @@
|
||||
---
|
||||
title: Media Transcoding Settings
|
||||
description: Configure video transcode strategies and preview proxy generation.
|
||||
title: Video Transcoding
|
||||
description: Configure video transcode policies, MP4 and HLS streaming resolutions, hardware acceleration, and FFmpeg threads.
|
||||
---
|
||||
|
||||
High-resolution camera formats and raw media files cannot be rendered natively in web browsers. Shumai transcodes these assets into web-friendly streaming formats in the background.
|
||||
High-resolution camera formats and raw media files cannot be rendered natively in web browsers. Shumai transcodes video assets into web-friendly streaming and preview formats in the background.
|
||||
|
||||
Team Owners can customize video transcoding behavior from the **Team Settings > Video Transcoding** page.
|
||||
|
||||
Regardless of the selected transcoding strategy, Shumai's pipeline will **always** generate at least one lightweight `180p` proxy version of the raw file to ensure fast scrubbing, thumbnail generation, and instant previews.
|
||||
|
||||
---
|
||||
|
||||
## Video Transcode Strategies
|
||||
## Transcode Policy
|
||||
|
||||
Team Owners can select how the transcoding engine handles uploaded files. Shumai evaluates the original file's dimensions against its standard target resolutions (2160p, 1080p, 720p, 540p, and 360p) to determine the output.
|
||||
The **Transcode Policy** card configures both MP4 video transcoding and HLS adaptive streaming.
|
||||
|
||||
### 1. Best Match
|
||||
### Playback and Download Behavior
|
||||
|
||||
- **Behavior**: Shumai checks the longest dimension (width or height) of the uploaded file. It then finds the highest standard resolution that is equal to or smaller than the original file, preventing unnecessary upscaling. If the original video is exceptionally small, it defaults to a minimum target of `360p`.
|
||||
- **Output**: Generates exactly two web-optimized files: the universal `180p` proxy and the single calculated "best match" resolution.
|
||||
- **Use Case**: This is the recommended option. It ensures web compatibility without wasting processing time and storage space on redundant lower-resolution versions.
|
||||
Shumai uses a dual-format strategy for video delivery:
|
||||
|
||||
### 2. Transcode All
|
||||
- **When HLS is disabled**: Both in-browser video playback and file downloads will use the generated MP4 file(s).
|
||||
- **When HLS is enabled**: In-browser video playback uses HLS (HTTP Live Streaming) for smooth, adaptive bitrate playback, while file downloads will use the generated MP4 file(s).
|
||||
|
||||
- **Behavior**: Shumai calculates the "best match" resolution exactly as it does in the previous strategy. However, instead of stopping at one version, it processes the video into the best match _and_ every standard resolution smaller than it.
|
||||
- **Output**: Generates a full cascade of files. For example, if the best match for an upload is `1080p`, Shumai will generate the `180p` proxy, `1080p`, `720p`, `540p`, and `360p` versions.
|
||||
- **Use Case**: Ideal for environments requiring adaptive bitrate streaming, ensuring consistent playback performance across all client devices regardless of varying network conditions.
|
||||
<Warning>
|
||||
**Storage Usage Notice**: Enabling HLS generates multi-bitrate segment files (`.ts` / `.m4s`) and
|
||||
playlist manifests in addition to standard MP4 proxies. This can significantly increase storage
|
||||
consumption on your storage bucket.
|
||||
</Warning>
|
||||
|
||||

|
||||
### MP4 Transcoding
|
||||
|
||||
Generate web-compatible MP4 files for file downloads and standard video playback. Team Owners can select how MP4 transcodes are generated for uploaded files:
|
||||
|
||||
#### 1. Best Match
|
||||
|
||||
- **Behavior**: Shumai checks the longest dimension of the uploaded video and generates a single optimal resolution matching or smaller than the source quality, preventing unnecessary upscaling.
|
||||
- **Output**: Generates the lightweight `180p` proxy and the calculated best-match MP4 file.
|
||||
- **Use Case**: Recommended default. Minimizes processing time and storage space while ensuring universal playback and download compatibility.
|
||||
|
||||
#### 2. Multi Resolutions
|
||||
|
||||
- **Behavior**: Select specific target resolution ladders to generate: `480p`, `720p`, `1080p`, `1440p`, and `2160p`. Resolutions are only generated up to the source video resolution (content is never upscaled).
|
||||
- **Output**: Generates the `180p` proxy plus all selected resolution ladders that do not exceed the source resolution.
|
||||
- **Use Case**: Ideal when users need to download multiple specific resolutions (e.g. 720p for fast sharing and 1080p for review).
|
||||
|
||||
### HLS Streaming
|
||||
|
||||
When **HLS Streaming** is toggled on, Shumai produces an adaptive bitrate HLS package for uploaded videos:
|
||||
|
||||
- **Resolution Ladders**: Configure which resolutions to generate for HLS streaming (`480p`, `720p`, `1080p`, `1440p`, `2160p`). Ladders are only generated up to the original video resolution.
|
||||
- **Player Integration**: The web player will automatically stream via HLS when available, dynamically switching bitrates based on client network bandwidth.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Hardware Acceleration
|
||||
|
||||
To offload encoding workloads from CPUs to GPUs, Shumai supports hardware-accelerated video encoding:
|
||||
|
||||
- **Disabled (Software)**: Uses the standard CPU `libx264` software encoder with Constant Rate Factor (CRF).
|
||||
- **Auto Detect**: Automatically probes and leverages available GPU/hardware acceleration (NVIDIA NVENC, Intel QuickSync, AMD/Intel VA-API, Apple VideoToolbox, Rockchip RKMPP).
|
||||
|
||||
See the [Hardware Transcoding Guide](/configuration/hardware-transcoding) for Docker Compose configuration, GPU passthrough, and driver prerequisites.
|
||||
|
||||
---
|
||||
|
||||
## FFmpeg Threads
|
||||
|
||||
The **FFmpeg Threads** slider controls the maximum number of CPU threads used by FFmpeg during transcoding tasks:
|
||||
|
||||
- **Auto (0)**: FFmpeg automatically selects the optimal thread count based on host CPU core availability.
|
||||
- **Manual (1 - 32)**: Restricts FFmpeg to a fixed number of threads, useful for throttling CPU consumption on shared worker nodes.
|
||||
|
||||
---
|
||||
|
||||
## Processing Architecture
|
||||
|
||||
Transcoding is resource-intensive. Depending on your scaling needs, your administrator can run the transcode engine on the main server (Single-Server mode) or delegate tasks to specialized transcoding worker machines (Temporal Worker mode).
|
||||
Transcoding is resource-intensive. Depending on your scaling needs, your administrator can run the transcode engine on the main server (Single-Server mode) or delegate tasks to specialized transcoding worker machines (Dedicated Worker mode).
|
||||
|
||||
Note: In all modes, the processing machine must have the standard system media utilities (`ffmpeg` and `ffprobe`) installed.
|
||||
In all modes, the processing machine must have system media utilities (`ffmpeg` and `ffprobe`) installed. See the [Distributed Deployment Guide](/configuration/distributed) for setting up dedicated transcoding workers.
|
||||
|
||||
+245
@@ -0,0 +1,245 @@
|
||||
# Shumai on AWS EKS with KEDA & Scale-to-Zero On-Demand Workers
|
||||
|
||||
This directory contains a complete, production-ready Kubernetes deployment example for running Shumai on **Amazon Elastic Kubernetes Service (Amazon EKS)**, using **KEDA (Kubernetes Event-driven Autoscaling)** and **Scale-to-Zero On-Demand AWS Graviton5 instances** for compute-intensive media processing.
|
||||
|
||||
The example should also be straightforward to adapt to any standard Kubernetes cluster.
|
||||
|
||||
To demonstrate a fully self-hosted setup, it uses Garage as an S3-compatible object storage solution. However, if you're deploying on AWS, consider using **Amazon S3** instead of running your own S3-compatible storage server, as it is managed and highly scalable.
|
||||
|
||||
---
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
```text
|
||||
[ User / Internet ]
|
||||
│
|
||||
┌────────────────────┴────────────────────┐
|
||||
│ (Port 80/3000) │ (Port 3900)
|
||||
▼ ▼
|
||||
┌───────────────────────┐ ┌───────────────────────┐
|
||||
│ shumai-server (ELB) │ │ garage-public (ELB) │
|
||||
└───────────┬───────────┘ └───────────┬───────────┘
|
||||
│ │ Direct Browser Uploads
|
||||
│ ▼ (Presigned URLs)
|
||||
┌───────────────────┼─────────────────────────────────────────────────────────────────┐
|
||||
│ General Workload Node (c9g.large On-Demand, ~$0.087/hr) │
|
||||
│ │ │
|
||||
│ ▼ │
|
||||
│ ┌───────────────────────┐ Enqueue DBOS Tasks ┌───────────────────┐ │
|
||||
│ │ shumai-server ├────────────────────────►│ shumai-postgres │ │
|
||||
│ │(SHUMAI_WORKERS=agent) │ (transcode_queue) │ (pgvector:pg18) │ │
|
||||
│ │ [Stale Recovery Loop] │ │ │ │
|
||||
│ └───────────┬───────────┘ └─────────┬─────────┘ │
|
||||
│ │ Internal S3 Traffic │ │
|
||||
│ ▼ │ │
|
||||
│ ┌───────────────────────┐ │ │
|
||||
│ │ garage-s3 │ │ │
|
||||
│ │ (dxflrs/garage) │ │ │
|
||||
│ └───────────▲───────────┘ │ │
|
||||
└───────────────────┼───────────────────────────────────────────────┼─────────────────┘
|
||||
│ Read Source / Write Proxies │
|
||||
│ │ KEDA monitors
|
||||
│ ▼ dbos.workflow_status
|
||||
│ ┌───────────────────────────────────────┐
|
||||
│ │ KEDA Controller: ScaledJob │
|
||||
│ │ Spawns Jobs based on pending tasks │
|
||||
│ └───────────────────┬───────────────────┘
|
||||
│ │
|
||||
│ ▼ Creates K8s Jobs
|
||||
┌───────────────────┴─────────────────────────────────────────────────────────────────┐
|
||||
│ Transcode Compute Pool (c9g.xlarge Graviton5 On-Demand, minSize: 0, maxSize: 5) │
|
||||
│ │
|
||||
│ ┌──────────────────────────┐ ┌──────────────────────────┐ ┌────────────────────┐ │
|
||||
│ │ Job: transcode-job-1 │ │ Job: transcode-job-2 │ │Job: transcode-job-N│ │
|
||||
│ │ (Auto-Drain Worker) │ │ (Auto-Drain Worker) │ │ (Auto-Drain Worker)│ │
|
||||
│ └────────────┬─────────────┘ └────────────┬─────────────┘ └──────────┬─────────┘ │
|
||||
│ ▼ ▼ ▼ │
|
||||
│ ┌──────────────────────────┐ ┌──────────────────────────┐ ┌────────────────────┐ │
|
||||
│ │ Node 1: c9g.xlarge │ │ Node 2: c9g.xlarge │ │ Node N: c9g.xlarge │ │
|
||||
│ │ (On-Demand) │ │ (On-Demand) │ │ (On-Demand) │ │
|
||||
│ └──────────────────────────┘ └──────────────────────────┘ └────────────────────┘ │
|
||||
│ │
|
||||
│ Scale-to-Zero: When queue is empty, 0 Jobs run and 0 EC2 instances are billed! │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Core Design Principles
|
||||
|
||||
### 1. Scale-to-Zero On-Demand Instances (`minSize: 0`)
|
||||
|
||||
Media transcoding with FFmpeg is bursty: hours may pass with zero transcoding activity, followed by sudden batches of 4K video uploads.
|
||||
|
||||
- **Zero Idle Cost**: The transcode node group [`eks/eks-cluster.yaml`](./eks-cluster.yaml) is configured with `minSize: 0` and `desiredCapacity: 0`. When no media transcoding tasks are active, **zero transcode EC2 instances exist**, costing **$0/hr**.
|
||||
- **No Spot Interruption Risk**: Transcoding jobs run on AWS Graviton5 **On-Demand** instances (`c9g.xlarge`, ~$0.174/hr). This eliminates the risk of Spot instances being reclaimed mid-encode by AWS, preventing wasted CPU cycles and avoiding unexpected transcoding delays.
|
||||
|
||||
### 2. KEDA `ScaledJob` vs. `Deployment` / `StatefulSet`
|
||||
|
||||
Standard Kubernetes Horizontal Pod Autoscaler (HPA) scales `Deployment` replicas based on metrics like CPU utilization. However, HPAs on Deployments suffer from severe limitations during video processing:
|
||||
1. When a 1-minute video finishes on Pod A while a 30-minute video is still encoding on Pod B, CPU drops and HPA reduces replica count, which can arbitrarily terminate Pod B mid-encode.
|
||||
2. StatefulSets scale down in strict ordinal order (`pod-4`, `pod-3`, etc.), which would terminate `pod-4` even if `pod-4` is the only pod currently transcoding!
|
||||
|
||||
**KEDA `ScaledJob` solves this natively**:
|
||||
- KEDA queries PostgreSQL directly:
|
||||
```sql
|
||||
SELECT COUNT(*) FROM dbos.workflow_status WHERE queue_name = 'transcode_queue' AND status IN ('ENQUEUED', 'PENDING');
|
||||
```
|
||||
- KEDA spawns independent Kubernetes `Job` pods based on enqueued workload.
|
||||
- Each Job runs the transcode worker with an idle timeout (`SHUMAI_WORKER_IDLE_TIMEOUT_MS=10000`).
|
||||
- When the job drains its tasks and becomes idle, the pod exits `0` and Kubernetes marks the Job completed.
|
||||
- Completing or terminating one job **never impacts any other job**!
|
||||
|
||||
### 3. Idle-Timeout Auto-Drain (10s Inactivity Shutdown)
|
||||
|
||||
In [`eks/shumai-transcode.yaml`](./shumai-transcode.yaml), the worker container runs with `SHUMAI_WORKER_IDLE_TIMEOUT_MS: "10000"`:
|
||||
- **Concurrency Isolation**: Transcode concurrency is set to `1` per pod (`CONCURRENCY_TRANSCODE=1`). Each pod has exclusive access to the node's 4 vCPUs for FFmpeg.
|
||||
- **Batch Processing Without Cold Starts**: Unlike single-task execution, a running worker continuously pulls tasks from `transcode_queue`. When a user uploads 100 images or multiple video files, a warm worker processes them back-to-back in seconds without restarting the container or control plane churn.
|
||||
- **Automatic Scale-to-Zero**: When `activeWorkflows === 0` and no new task arrives within 10 consecutive seconds, the worker initiates graceful DBOS shutdown and exits with code `0`.
|
||||
- The completed Job pod terminates, freeing the node so Cluster Autoscaler can terminate the EC2 instance down to zero.
|
||||
|
||||
---
|
||||
|
||||
## Step-by-Step Deployment Guide
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- [AWS CLI](https://aws.amazon.com/cli/) installed and configured (`aws configure`).
|
||||
- [`eksctl`](https://eksctl.io/) installed.
|
||||
- [`kubectl`](https://kubernetes.io/docs/tasks/tools/) installed.
|
||||
- [`helm`](https://helm.sh/) installed.
|
||||
|
||||
### Step 1: Provision the EKS Cluster
|
||||
|
||||
Create the cluster using the declarative [`eks/eks-cluster.yaml`](./eks-cluster.yaml) configuration:
|
||||
|
||||
```bash
|
||||
eksctl create cluster -f eks/eks-cluster.yaml
|
||||
```
|
||||
|
||||
This provisions:
|
||||
- An EKS 1.31 control plane in `us-east-1` across multiple AZs. *(Note: AWS Graviton5 `c9g` instances are available in `us-east-1`. If deploying to a region where `c9g` is not yet offered, substitute `c7g.large` / `c7g.xlarge` or `c8g` in `eks/eks-cluster.yaml`.)*
|
||||
- `shumai-general`: 1x `c9g.large` On-Demand instance (labeled `workload: general`) for API, database, and storage.
|
||||
- `shumai-transcode`: Scale-to-zero `c9g.xlarge` On-Demand instance pool (`minSize: 0`, `maxSize: 5`, `desiredCapacity: 0`, tainted `dedicated=transcode:NoSchedule`).
|
||||
- AWS EBS CSI Driver with IAM OIDC roles.
|
||||
|
||||
### Step 2: Install KEDA
|
||||
|
||||
Install KEDA using Helm:
|
||||
|
||||
```bash
|
||||
helm repo add kedacore https://kedacore.github.io/charts
|
||||
helm repo update
|
||||
helm install keda kedacore/keda --namespace keda --create-namespace
|
||||
```
|
||||
|
||||
Wait for the KEDA operator to reach `Running` state:
|
||||
|
||||
```bash
|
||||
kubectl wait --namespace keda --for=condition=ready pod -l app.kubernetes.io/name=keda-operator --timeout=120s
|
||||
```
|
||||
|
||||
### Step 3: Deploy the Shumai Stack
|
||||
|
||||
Deploy all components with Kustomize:
|
||||
|
||||
```bash
|
||||
kubectl apply -k eks/
|
||||
```
|
||||
|
||||
This applies:
|
||||
- [`eks/storageclass.yaml`](./storageclass.yaml): Configures `gp3` as the default StorageClass using `ebs.csi.aws.com` with `WaitForFirstConsumer` binding and dynamic EBS volume expansion.
|
||||
- PostgreSQL (`pgvector:pg18`) with durable EBS storage.
|
||||
- Garage S3 object store with automatic bucket and CORS initialization (`garage-init` job).
|
||||
- Shumai API & Web server.
|
||||
- KEDA `ScaledJob` for transcode worker auto-scaling.
|
||||
|
||||
Wait for the core database and storage services to initialize:
|
||||
|
||||
```bash
|
||||
# Wait for PostgreSQL and Garage S3 pods to become Ready
|
||||
kubectl wait --namespace shumai --for=condition=ready pod -l app=shumai-postgres --timeout=180s
|
||||
kubectl wait --namespace shumai --for=condition=ready pod -l app=garage --timeout=180s
|
||||
|
||||
# Wait for the bucket initialization job to complete
|
||||
kubectl wait --namespace shumai --for=condition=complete job/garage-init --timeout=180s
|
||||
|
||||
# Verify all pods in the shumai namespace
|
||||
kubectl get pods -n shumai -o wide
|
||||
```
|
||||
|
||||
*(Note: On first startup, `shumai-server` automatically runs database migrations against PostgreSQL; this may take 30–60 seconds before the server reaches `Running (1/1)`.)*
|
||||
|
||||
### Step 4: Configure Public Access & S3 Endpoint
|
||||
|
||||
AWS automatically provisions external Elastic Load Balancers for `shumai-server` and `garage-public`. Because AWS takes 30–60 seconds to allocate external hostnames, wait for the hostnames to become available:
|
||||
|
||||
```bash
|
||||
# Wait for AWS to assign external hostnames to the LoadBalancers
|
||||
echo "Waiting for LoadBalancer external hostnames..."
|
||||
until [ -n "$(kubectl get svc garage-public -n shumai -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')" ]; do
|
||||
sleep 5
|
||||
done
|
||||
|
||||
GARAGE_ELB=$(kubectl get svc garage-public -n shumai -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
|
||||
SERVER_ELB=$(kubectl get svc shumai-server -n shumai -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
|
||||
|
||||
echo "Garage S3 Hostname: http://${GARAGE_ELB}:3900"
|
||||
echo "Shumai Web UI: http://${SERVER_ELB}"
|
||||
```
|
||||
|
||||
Inject the public Garage S3 hostname into `shumai-server` so that browsers generate correct presigned upload URLs:
|
||||
|
||||
```bash
|
||||
kubectl set env deployment/shumai-server -n shumai AWS_PUBLIC_ENDPOINT_URL_S3="http://${GARAGE_ELB}:3900"
|
||||
```
|
||||
|
||||
*(Note: In production with custom domains, point your DNS CNAME records to the load balancers and configure `AWS_PUBLIC_ENDPOINT_URL_S3: https://s3.mycompany.com` in [`eks/config.yaml`](./config.yaml).)*
|
||||
|
||||
### Step 5: Deploy Kubernetes Cluster Autoscaler
|
||||
|
||||
Deploy Cluster Autoscaler to dynamically provision `c9g.xlarge` EC2 nodes when KEDA jobs are created:
|
||||
|
||||
```bash
|
||||
curl -s https://raw.githubusercontent.com/kubernetes/autoscaler/master/cluster-autoscaler/cloudprovider/aws/examples/cluster-autoscaler-autodiscover.yaml \
|
||||
| sed 's/<YOUR CLUSTER NAME>/shumai-eks/g' \
|
||||
| kubectl apply -f -
|
||||
|
||||
# Pin autoscaler to the general workload node
|
||||
kubectl patch deployment cluster-autoscaler -n kube-system -p '{"spec":{"template":{"spec":{"nodeSelector":{"workload":"general"}}}}}'
|
||||
```
|
||||
|
||||
### Step 6: Test Scale-to-Zero Queue-Driven Autoscaling
|
||||
|
||||
1. Open `http://${SERVER_ELB}` in your browser and register an account via **Sign Up**. *(The first registered account automatically becomes the instance administrator).*
|
||||
2. Create a project and upload a batch of 5–10 video files simultaneously.
|
||||
3. Observe KEDA detecting pending DBOS tasks and spawning individual Kubernetes Jobs:
|
||||
```bash
|
||||
kubectl get scaledjobs -n shumai
|
||||
kubectl get jobs -n shumai -w
|
||||
kubectl get pods -n shumai -l app=shumai-transcode -o wide
|
||||
kubectl get nodes -L role,workload
|
||||
```
|
||||
4. Watch Cluster Autoscaler dynamically provision dedicated `c9g.xlarge` Graviton5 EC2 instances for the Jobs.
|
||||
5. As each video finishes transcoding, its worker pod exits `0` and completes immediately.
|
||||
6. Once all jobs are done, KEDA holds 0 jobs, and Cluster Autoscaler terminates all transcode EC2 instances, returning the transcode pool to **0 nodes ($0/hr)**!
|
||||
|
||||
### Step 7: Cluster Teardown & Cost Cleanup
|
||||
|
||||
When you are finished testing, delete all resources to prevent ongoing cloud charges:
|
||||
|
||||
```bash
|
||||
# 1. Delete Kubernetes namespace first to release AWS ELB load balancers and EBS volumes
|
||||
# (Important: Wait for this to complete so AWS SecurityGroups can be deleted without dependency conflicts)
|
||||
kubectl delete namespace shumai
|
||||
|
||||
# 2. Uninstall KEDA
|
||||
helm uninstall keda -n keda
|
||||
kubectl delete namespace keda
|
||||
|
||||
# 3. Delete the EKS cluster and CloudFormation stacks
|
||||
eksctl delete cluster -f eks/eks-cluster.yaml --wait
|
||||
|
||||
# 4. Confirm all AWS resources are released
|
||||
aws eks list-clusters --region us-east-1
|
||||
```
|
||||
@@ -0,0 +1,31 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: shumai-config
|
||||
namespace: shumai
|
||||
data:
|
||||
# S3 Storage Configuration (Garage S3)
|
||||
STORAGE_BACKEND: 's3'
|
||||
AWS_ENDPOINT_URL_S3: 'http://garage.shumai.svc.cluster.local:3900'
|
||||
S3_BUCKET: 'shumai'
|
||||
S3_REGION: 'garage'
|
||||
S3_FORCE_PATH_STYLE: 'true'
|
||||
|
||||
# Server & Worker Configuration
|
||||
SHUMAI_SERVER_PORT: '3000'
|
||||
CONCURRENCY_TRANSCODE: '1'
|
||||
SHUMAI_WORKER_DRAIN_TIMEOUT_MS: '290000'
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: shumai-secret
|
||||
namespace: shumai
|
||||
type: Opaque
|
||||
stringData:
|
||||
DATABASE_URL: 'postgresql://shumai:shumai_password@shumai-postgres.shumai.svc.cluster.local:5432/shumai_db?schema=public'
|
||||
KEDA_DATABASE_URL: 'postgresql://shumai:shumai_password@shumai-postgres.shumai.svc.cluster.local:5432/shumai_db?sslmode=disable'
|
||||
BETTER_AUTH_SECRET: 'qSxs9DxzHDZBbeeTNPEwBuspYwipBqz5Gk5XdBjNhWw='
|
||||
S3_ACCESS_KEY_ID: 'GKshumaiaccesskeyid001'
|
||||
S3_SECRET_ACCESS_KEY: 'shumaisecretaccesskey00000000000000001'
|
||||
GARAGE_ADMIN_TOKEN: 'admin-secret-token'
|
||||
@@ -0,0 +1,57 @@
|
||||
apiVersion: eksctl.io/v1alpha5
|
||||
kind: ClusterConfig
|
||||
|
||||
metadata:
|
||||
name: shumai-eks
|
||||
region: us-east-1
|
||||
version: '1.31'
|
||||
|
||||
iam:
|
||||
withOIDC: true
|
||||
|
||||
addons:
|
||||
- name: aws-ebs-csi-driver
|
||||
wellKnownPolicies:
|
||||
ebsCSIController: true
|
||||
|
||||
managedNodeGroups:
|
||||
# General system workload: Web UI, REST API, DBOS PostgreSQL, and Garage S3
|
||||
# Runs on On-Demand instances to guarantee database & storage durability without spot interruptions
|
||||
- name: shumai-general
|
||||
instanceType: c9g.large # 2 vCPU, 4 GiB RAM (Graviton5 On-Demand, ~$0.087/hr)
|
||||
spot: false
|
||||
minSize: 1
|
||||
maxSize: 2
|
||||
desiredCapacity: 1
|
||||
amiFamily: AmazonLinux2023
|
||||
volumeSize: 50
|
||||
volumeType: gp3
|
||||
labels:
|
||||
workload: general
|
||||
iam:
|
||||
withAddonPolicies:
|
||||
autoScaler: true
|
||||
ebs: true
|
||||
|
||||
# Transcoding compute pool: High-CPU media processing
|
||||
# Uses On-Demand instances with scale-to-zero (minSize: 0) managed by Cluster Autoscaler / Karpenter
|
||||
- name: shumai-transcode
|
||||
instanceType: c9g.xlarge # 4 vCPU, 8 GiB RAM (Graviton5 On-Demand, ~$0.174/hr)
|
||||
spot: false
|
||||
minSize: 0
|
||||
maxSize: 5
|
||||
desiredCapacity: 0
|
||||
amiFamily: AmazonLinux2023
|
||||
volumeSize: 50
|
||||
volumeType: gp3
|
||||
labels:
|
||||
workload: transcode
|
||||
role: transcode
|
||||
taints:
|
||||
- key: dedicated
|
||||
value: transcode
|
||||
effect: NoSchedule
|
||||
iam:
|
||||
withAddonPolicies:
|
||||
autoScaler: true
|
||||
ebs: true
|
||||
+238
@@ -0,0 +1,238 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: garage-config
|
||||
namespace: shumai
|
||||
data:
|
||||
garage.toml: |
|
||||
metadata_dir = "/var/lib/garage/meta"
|
||||
data_dir = "/var/lib/garage/data"
|
||||
db_engine = "sqlite"
|
||||
replication_factor = 1
|
||||
|
||||
rpc_bind_addr = "0.0.0.0:3901"
|
||||
rpc_secret = "c7d7e35b7501a91e5cfb3874026315579930f367fa3b7e4a1e94cf67484a86cf"
|
||||
|
||||
[s3_api]
|
||||
s3_region = "garage"
|
||||
api_bind_addr = "0.0.0.0:3900"
|
||||
root_domain = ".s3.garage"
|
||||
|
||||
[admin]
|
||||
api_bind_addr = "0.0.0.0:3903"
|
||||
admin_token = "admin-secret-token"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: garage
|
||||
namespace: shumai
|
||||
labels:
|
||||
app: garage
|
||||
spec:
|
||||
ports:
|
||||
- port: 3900
|
||||
name: s3-api
|
||||
- port: 3901
|
||||
name: rpc
|
||||
- port: 3903
|
||||
name: admin
|
||||
selector:
|
||||
app: garage
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: garage-public
|
||||
namespace: shumai
|
||||
labels:
|
||||
app: garage
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 3900
|
||||
targetPort: 3900
|
||||
name: s3-api
|
||||
selector:
|
||||
app: garage
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: garage
|
||||
namespace: shumai
|
||||
spec:
|
||||
serviceName: garage
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: garage
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: garage
|
||||
spec:
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: eks.amazonaws.com/nodegroup
|
||||
operator: In
|
||||
values:
|
||||
- shumai-general
|
||||
- shumai-general-spot
|
||||
- matchExpressions:
|
||||
- key: workload
|
||||
operator: In
|
||||
values:
|
||||
- general
|
||||
containers:
|
||||
- name: garage
|
||||
image: dxflrs/garage:v2.4.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: ['/garage', 'server']
|
||||
ports:
|
||||
- containerPort: 3900
|
||||
name: s3-api
|
||||
- containerPort: 3901
|
||||
name: rpc
|
||||
- containerPort: 3903
|
||||
name: admin
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/garage.toml
|
||||
subPath: garage.toml
|
||||
- name: garage-meta
|
||||
mountPath: /var/lib/garage/meta
|
||||
- name: garage-data
|
||||
mountPath: /var/lib/garage/data
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: garage-config
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: garage-meta
|
||||
spec:
|
||||
accessModes: ['ReadWriteOnce']
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
- metadata:
|
||||
name: garage-data
|
||||
spec:
|
||||
accessModes: ['ReadWriteOnce']
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: garage-init
|
||||
namespace: shumai
|
||||
spec:
|
||||
backoffLimit: 10
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: garage-init
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: init
|
||||
image: alpine:3.20
|
||||
env:
|
||||
- name: S3_BUCKET
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: shumai-config
|
||||
key: S3_BUCKET
|
||||
- name: S3_ACCESS_KEY_ID
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: shumai-secret
|
||||
key: S3_ACCESS_KEY_ID
|
||||
- name: S3_SECRET_ACCESS_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: shumai-secret
|
||||
key: S3_SECRET_ACCESS_KEY
|
||||
- name: GARAGE_ADMIN_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: shumai-secret
|
||||
key: GARAGE_ADMIN_TOKEN
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
set -e
|
||||
apk add --no-cache curl jq aws-cli >/dev/null 2>&1
|
||||
|
||||
echo "Waiting for Garage Admin API to respond..."
|
||||
until curl -s -f -H "Authorization: Bearer ${GARAGE_ADMIN_TOKEN}" http://garage:3903/v2/GetClusterStatus >/dev/null 2>&1; do
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "Garage Admin API is online. Retrieving cluster status..."
|
||||
STATUS=$(curl -s -H "Authorization: Bearer ${GARAGE_ADMIN_TOKEN}" http://garage:3903/v2/GetClusterStatus)
|
||||
NODE_ID=$(echo "$STATUS" | jq -r '.nodes[0].id // empty')
|
||||
if [ -z "$NODE_ID" ]; then
|
||||
echo "Error: Node ID not found"
|
||||
exit 1
|
||||
fi
|
||||
echo "Discovered Node ID: $NODE_ID"
|
||||
|
||||
ROLE=$(echo "$STATUS" | jq -r '.nodes[0].role // empty')
|
||||
if [ -z "$ROLE" ] || [ "$ROLE" = "null" ]; then
|
||||
echo "Assigning layout role to node..."
|
||||
curl -s -f -X POST http://garage:3903/v2/UpdateClusterLayout \
|
||||
-H "Authorization: Bearer ${GARAGE_ADMIN_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"roles\": [{\"id\": \"$NODE_ID\", \"zone\": \"dc1\", \"capacity\": 10737418240, \"tags\": []}]}" >/dev/null
|
||||
|
||||
echo "Applying cluster layout (version 1)..."
|
||||
curl -s -f -X POST http://garage:3903/v2/ApplyClusterLayout \
|
||||
-H "Authorization: Bearer ${GARAGE_ADMIN_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"version": 1}' >/dev/null || true
|
||||
fi
|
||||
|
||||
echo "Importing S3 Access Key..."
|
||||
curl -s -f -X POST http://garage:3903/v2/ImportKey \
|
||||
-H "Authorization: Bearer ${GARAGE_ADMIN_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"name\": \"shumai-key\", \"accessKeyId\": \"${S3_ACCESS_KEY_ID}\", \"secretAccessKey\": \"${S3_SECRET_ACCESS_KEY}\"}" >/dev/null || true
|
||||
|
||||
echo "Creating S3 bucket '${S3_BUCKET}'..."
|
||||
BUCKET_RESP=$(curl -s -X POST http://garage:3903/v2/CreateBucket \
|
||||
-H "Authorization: Bearer ${GARAGE_ADMIN_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"globalAlias\": \"${S3_BUCKET}\"}")
|
||||
echo "$BUCKET_RESP"
|
||||
|
||||
BUCKET_ID=$(echo "$BUCKET_RESP" | jq -r '.id // empty')
|
||||
if [ -z "$BUCKET_ID" ]; then
|
||||
# Fetch existing bucket ID if already created
|
||||
BUCKET_ID=$(curl -s -H "Authorization: Bearer ${GARAGE_ADMIN_TOKEN}" "http://garage:3903/v2/GetBucketInfo?globalAlias=${S3_BUCKET}" | jq -r '.id // empty')
|
||||
fi
|
||||
|
||||
if [ -n "$BUCKET_ID" ]; then
|
||||
echo "Granting bucket permissions for key on bucket ID $BUCKET_ID..."
|
||||
curl -s -f -X POST http://garage:3903/v2/AllowBucketKey \
|
||||
-H "Authorization: Bearer ${GARAGE_ADMIN_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"bucketId\": \"${BUCKET_ID}\", \"accessKeyId\": \"${S3_ACCESS_KEY_ID}\", \"permissions\": {\"read\": true, \"write\": true, \"owner\": true}}" >/dev/null || true
|
||||
fi
|
||||
|
||||
echo "Configuring S3 bucket CORS for web uploads..."
|
||||
AWS_ACCESS_KEY_ID=${S3_ACCESS_KEY_ID} \
|
||||
AWS_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY} \
|
||||
AWS_DEFAULT_REGION=garage \
|
||||
aws --endpoint-url http://garage:3900 s3api put-bucket-cors \
|
||||
--bucket "${S3_BUCKET}" \
|
||||
--cors-configuration '{"CORSRules":[{"AllowedHeaders":["*"],"AllowedMethods":["GET","PUT","POST","DELETE","HEAD"],"AllowedOrigins":["*"],"ExposeHeaders":["ETag"],"MaxAgeSeconds":3000}]}' || true
|
||||
|
||||
echo "✅ Garage S3 storage cluster initialized successfully!"
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- storageclass.yaml
|
||||
- config.yaml
|
||||
- postgres.yaml
|
||||
- garage.yaml
|
||||
- shumai-server.yaml
|
||||
- shumai-transcode.yaml
|
||||
@@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: shumai
|
||||
@@ -0,0 +1,79 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: shumai-postgres
|
||||
namespace: shumai
|
||||
labels:
|
||||
app: shumai-postgres
|
||||
spec:
|
||||
ports:
|
||||
- port: 5432
|
||||
name: postgres
|
||||
selector:
|
||||
app: shumai-postgres
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: shumai-postgres
|
||||
namespace: shumai
|
||||
spec:
|
||||
serviceName: shumai-postgres
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: shumai-postgres
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: shumai-postgres
|
||||
spec:
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: eks.amazonaws.com/nodegroup
|
||||
operator: In
|
||||
values:
|
||||
- shumai-general
|
||||
- shumai-general-spot
|
||||
- matchExpressions:
|
||||
- key: workload
|
||||
operator: In
|
||||
values:
|
||||
- general
|
||||
containers:
|
||||
- name: postgres
|
||||
image: pgvector/pgvector:pg18
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
name: postgres
|
||||
env:
|
||||
- name: POSTGRES_USER
|
||||
value: 'shumai'
|
||||
- name: POSTGRES_PASSWORD
|
||||
value: 'shumai_password'
|
||||
- name: POSTGRES_DB
|
||||
value: 'shumai_db'
|
||||
- name: PGDATA
|
||||
value: '/var/lib/postgresql/18/docker/pgdata'
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- pg_isready -U shumai -d shumai_db
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
volumeMounts:
|
||||
- name: postgres-data
|
||||
mountPath: /var/lib/postgresql/18/docker
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: postgres-data
|
||||
spec:
|
||||
accessModes: ['ReadWriteOnce']
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
@@ -0,0 +1,85 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: shumai-server
|
||||
namespace: shumai
|
||||
labels:
|
||||
app: shumai-server
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 3000
|
||||
name: http
|
||||
- port: 3000
|
||||
targetPort: 3000
|
||||
name: http-alt
|
||||
selector:
|
||||
app: shumai-server
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: shumai-server
|
||||
namespace: shumai
|
||||
labels:
|
||||
app: shumai-server
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: shumai-server
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: shumai-server
|
||||
spec:
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: eks.amazonaws.com/nodegroup
|
||||
operator: In
|
||||
values:
|
||||
- shumai-general
|
||||
- shumai-general-spot
|
||||
- matchExpressions:
|
||||
- key: workload
|
||||
operator: In
|
||||
values:
|
||||
- general
|
||||
containers:
|
||||
- name: server
|
||||
image: shumaione/shumai:latest
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: SHUMAI_WORKERS
|
||||
value: 'agent'
|
||||
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: shumai-config
|
||||
- secretRef:
|
||||
name: shumai-secret
|
||||
ports:
|
||||
- containerPort: 3000
|
||||
name: http
|
||||
resources:
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 512Mi
|
||||
limits:
|
||||
cpu: 2000m
|
||||
memory: 2Gi
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 3000
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 5
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: 3000
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
@@ -0,0 +1,90 @@
|
||||
apiVersion: keda.sh/v1alpha1
|
||||
kind: TriggerAuthentication
|
||||
metadata:
|
||||
name: keda-postgres-auth
|
||||
namespace: shumai
|
||||
spec:
|
||||
secretTargetRef:
|
||||
- parameter: connection
|
||||
name: shumai-secret
|
||||
key: KEDA_DATABASE_URL
|
||||
---
|
||||
apiVersion: keda.sh/v1alpha1
|
||||
kind: ScaledJob
|
||||
metadata:
|
||||
name: shumai-transcode-scaler
|
||||
namespace: shumai
|
||||
labels:
|
||||
app: shumai-transcode
|
||||
spec:
|
||||
jobTargetRef:
|
||||
parallelism: 1
|
||||
completions: 1
|
||||
backoffLimit: 0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: shumai-transcode
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
terminationGracePeriodSeconds: 300
|
||||
tolerations:
|
||||
- key: dedicated
|
||||
operator: Equal
|
||||
value: transcode
|
||||
effect: NoSchedule
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: role
|
||||
operator: In
|
||||
values:
|
||||
- transcode
|
||||
- matchExpressions:
|
||||
- key: workload
|
||||
operator: In
|
||||
values:
|
||||
- transcode
|
||||
- matchExpressions:
|
||||
- key: eks.amazonaws.com/nodegroup
|
||||
operator: In
|
||||
values:
|
||||
- shumai-transcode
|
||||
containers:
|
||||
- name: worker
|
||||
image: shumaione/shumai-transcode:latest
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: SHUMAI_WORKER_IDLE_TIMEOUT_MS
|
||||
value: '10000'
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: shumai-config
|
||||
- secretRef:
|
||||
name: shumai-secret
|
||||
resources:
|
||||
requests:
|
||||
cpu: 3000m
|
||||
memory: 4Gi
|
||||
limits:
|
||||
cpu: 3900m
|
||||
memory: 6Gi
|
||||
pollingInterval: 10
|
||||
successfulJobsHistoryLimit: 5
|
||||
failedJobsHistoryLimit: 10
|
||||
maxReplicaCount: 5
|
||||
scalingStrategy:
|
||||
strategy: default
|
||||
triggers:
|
||||
- type: postgresql
|
||||
metadata:
|
||||
query: "SELECT COUNT(*) FROM dbos.workflow_status WHERE queue_name = 'transcode_queue' AND status IN ('ENQUEUED', 'PENDING');"
|
||||
targetQueryValue: '1'
|
||||
authenticationRef:
|
||||
name: keda-postgres-auth
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: gp3
|
||||
annotations:
|
||||
storageclass.kubernetes.io/is-default-class: 'true'
|
||||
provisioner: ebs.csi.aws.com
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
allowVolumeExpansion: true
|
||||
parameters:
|
||||
type: gp3
|
||||
fsType: ext4
|
||||
+5
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "shumai",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"repository": {
|
||||
@@ -38,7 +38,10 @@
|
||||
"release:local": "bun run scripts/release-local.ts",
|
||||
"release:patch": "bun run scripts/release.ts patch",
|
||||
"release:minor": "bun run scripts/release.ts minor",
|
||||
"release:major": "bun run scripts/release.ts major"
|
||||
"release:major": "bun run scripts/release.ts major",
|
||||
"changelog:extract": "bun run scripts/extract-changelog.ts",
|
||||
"docs:changelog": "bun run scripts/generate-docs-changelog.ts",
|
||||
"docs:changelog:check": "bun run scripts/generate-docs-changelog.ts --check"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "10.0.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/agent",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
@@ -9,16 +9,14 @@
|
||||
"@anthropic-ai/sandbox-runtime": "0.0.74",
|
||||
"@earendil-works/pi-agent-core": "0.82.1",
|
||||
"@earendil-works/pi-ai": "0.82.1",
|
||||
"@google/genai": "2.19.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
"@shumai/dtos": "workspace:*",
|
||||
"@shumai/workflow-core": "workspace:*",
|
||||
"@temporalio/activity": "1.23.0",
|
||||
"@temporalio/worker": "1.23.0",
|
||||
"@temporalio/workflow": "1.23.0",
|
||||
"adm-zip": "0.6.0",
|
||||
"jittered-fractional-indexing": "1.0.1",
|
||||
"sharp": "0.35.4",
|
||||
"typebox": "1.3.22",
|
||||
"ulid": "3.0.2",
|
||||
"zod": "4.5.4"
|
||||
|
||||
@@ -23,8 +23,7 @@ import {
|
||||
import * as piAgent from '../index'
|
||||
import { type AgentHarness, type Session } from '@earendil-works/pi-agent-core'
|
||||
import { DatabaseSessionStorage, type DatabaseSessionMetadata } from '../database-session-storage'
|
||||
import { triggerLocalCancel } from '@shumai/workflow-core'
|
||||
import { Context } from '@temporalio/activity'
|
||||
import { triggerLocalCancel, runInLocalTaskContext } from '@shumai/workflow-core'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
|
||||
import {
|
||||
@@ -50,9 +49,6 @@ vi.mock('../index', async () => {
|
||||
describe('Agent Activities', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
vi.spyOn(Context, 'current').mockImplementation(() => {
|
||||
throw new Error('Not in Temporal')
|
||||
})
|
||||
})
|
||||
|
||||
it('should call agentChatActivity and prompt the harness', async () => {
|
||||
@@ -240,13 +236,7 @@ describe('Agent Activities', () => {
|
||||
await executionPromise
|
||||
})
|
||||
|
||||
it('should listen to Temporal cancellation signal and call harness.abort when cancelled in Temporal mode', async () => {
|
||||
const mockTemporalContext = {
|
||||
cancellationSignal: new EventTarget(),
|
||||
heartbeat: vi.fn(),
|
||||
} as unknown as Context
|
||||
vi.spyOn(Context, 'current').mockReturnValue(mockTemporalContext)
|
||||
|
||||
it('should listen to abort signal and call harness.abort when cancelled', async () => {
|
||||
let resolvePrompt!: (value: {
|
||||
content: Array<{ type: string; text: string } | { type: string }>
|
||||
usage: { input: number; output: number }
|
||||
@@ -280,42 +270,36 @@ describe('Agent Activities', () => {
|
||||
allowedDomains: [],
|
||||
} as unknown as AgentExecutionContext
|
||||
|
||||
const addEventListenerSpy = vi.spyOn(mockTemporalContext.cancellationSignal, 'addEventListener')
|
||||
const removeEventListenerSpy = vi.spyOn(
|
||||
mockTemporalContext.cancellationSignal,
|
||||
'removeEventListener',
|
||||
)
|
||||
const taskId = 'test-abort-task'
|
||||
const abortController = new AbortController()
|
||||
|
||||
const executionPromise = agentChatActivity({
|
||||
teamId: 't1',
|
||||
agentId: 'b1',
|
||||
message: 'Hi',
|
||||
imageUrls: [],
|
||||
projectId: 'p1',
|
||||
folderId: 'f1',
|
||||
sessionId: 'mock-session-id',
|
||||
context,
|
||||
await runInLocalTaskContext({ taskId, abortController }, async () => {
|
||||
const executionPromise = agentChatActivity({
|
||||
taskId,
|
||||
teamId: 't1',
|
||||
agentId: 'b1',
|
||||
message: 'Hi',
|
||||
imageUrls: [],
|
||||
projectId: 'p1',
|
||||
folderId: 'f1',
|
||||
sessionId: 'mock-session-id',
|
||||
context,
|
||||
})
|
||||
|
||||
// Yield to let the asynchronous setup add the abort event listener
|
||||
await new Promise((resolve) => setTimeout(resolve, 50))
|
||||
|
||||
abortController.abort()
|
||||
expect(mockHarness.abort).toHaveBeenCalled()
|
||||
|
||||
// Resolve the prompt promise to allow the activity to finish clean
|
||||
resolvePrompt({
|
||||
content: [{ type: 'text', text: 'AI response' }],
|
||||
usage: { input: 10, output: 20 },
|
||||
})
|
||||
|
||||
await executionPromise
|
||||
})
|
||||
|
||||
// Yield to let the asynchronous setup add the abort event listener
|
||||
await new Promise((resolve) => setTimeout(resolve, 50))
|
||||
|
||||
expect(addEventListenerSpy).toHaveBeenCalledWith('abort', expect.any(Function), { once: true })
|
||||
|
||||
// Simulate Temporal cancellation event
|
||||
mockTemporalContext.cancellationSignal.dispatchEvent(new Event('abort'))
|
||||
expect(mockHarness.abort).toHaveBeenCalled()
|
||||
|
||||
// Resolve the prompt promise to allow the activity to finish clean
|
||||
resolvePrompt({
|
||||
content: [{ type: 'text', text: 'AI response' }],
|
||||
usage: { input: 10, output: 20 },
|
||||
})
|
||||
|
||||
await executionPromise
|
||||
expect(removeEventListenerSpy).toHaveBeenCalledWith('abort', expect.any(Function))
|
||||
addEventListenerSpy.mockRestore()
|
||||
removeEventListenerSpy.mockRestore()
|
||||
})
|
||||
|
||||
it('should include error message in text when stopReason is error', async () => {
|
||||
@@ -662,6 +646,23 @@ describe('Agent Activities', () => {
|
||||
const pdfPrompt = mockHarness.prompt.mock.calls[1]?.[0] ?? ''
|
||||
expect(pdfPrompt).toContain('Document pages: 50')
|
||||
expect(pdfPrompt).not.toContain('Video duration')
|
||||
|
||||
// For a 3D asset, should produce 3D Model recommendation
|
||||
await autofillAiActivity({
|
||||
teamId: 't1',
|
||||
assetId: 'model-3',
|
||||
assetName: 'robot.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
images: [],
|
||||
fields: [{ id: 'f1', config: { name: 'F1', type: 'text' } }],
|
||||
context,
|
||||
})
|
||||
|
||||
const modelPrompt = mockHarness.prompt.mock.calls[2]?.[0] ?? ''
|
||||
expect(modelPrompt).toContain('3D Model: This asset has an orthogonal 4-view composite image')
|
||||
expect(modelPrompt).toContain(
|
||||
'Front view at top-left, Right side view at top-right, Back view at bottom-left, Left side view at bottom-right',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1170,6 +1171,43 @@ describe('Agent Database Activities Integration', () => {
|
||||
expect((rootEntry as any)?.details?.thread).toBeUndefined()
|
||||
})
|
||||
|
||||
it('should set media position to degree for 3D asset comments', async () => {
|
||||
const asset3d = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'robot.glb',
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
mediaType: 'model/gltf-binary',
|
||||
media: { proxyType: '3d' } as unknown as PrismaJson.MediaInfo,
|
||||
projectId: project.id,
|
||||
},
|
||||
})
|
||||
|
||||
const comment3d = await prisma.assetComment.create({
|
||||
data: {
|
||||
assetId: asset3d.id,
|
||||
message: 'Nice angle',
|
||||
creatorId: user.id,
|
||||
second: 0.5, // 45°
|
||||
},
|
||||
})
|
||||
|
||||
const sessionId = await initializeAgentSessionActivity({
|
||||
teamId: team.id,
|
||||
agentId: 'test-agent-id',
|
||||
userCommentId: comment3d.id,
|
||||
userId: user.id,
|
||||
})
|
||||
|
||||
const storage = new DatabaseSessionStorage(sessionId)
|
||||
const pathEntries = await storage.getPathToRoot(comment3d.id)
|
||||
const entry = pathEntries.find((e) => e.id === comment3d.id)
|
||||
|
||||
expect(entry).toBeDefined()
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- test entry position parsing
|
||||
expect((entry as any)?.details?.position).toEqual({ type: 'degree', degree: 45 })
|
||||
})
|
||||
|
||||
it('should return user name and role for team member', async () => {
|
||||
const info = await getUserTeamInfoActivity({
|
||||
userId: user.id,
|
||||
@@ -2105,5 +2143,83 @@ describe('Agent Database Activities Integration', () => {
|
||||
expect(systemPromptArg).toContain('<thread id="..." reply_count="..." />')
|
||||
expect(systemPromptArg).toContain('read_thread')
|
||||
})
|
||||
|
||||
it('agentChatActivity injects # 3D Model Inspection into systemPrompt', async () => {
|
||||
const user = await prisma.user.create({
|
||||
data: { name: 'User_3d_Prompt', email: `prompt-3d-${Date.now()}@example.com` },
|
||||
})
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'Team_3d_Prompt_' + Date.now() },
|
||||
})
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'Project_3d_Prompt', teamId: team.id },
|
||||
})
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'robot.glb',
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
mediaType: 'model/gltf-binary',
|
||||
media: { proxyType: '3d' } as unknown as PrismaJson.MediaInfo,
|
||||
projectId: project.id,
|
||||
},
|
||||
})
|
||||
|
||||
const comment = await prisma.assetComment.create({
|
||||
data: {
|
||||
assetId: asset.id,
|
||||
creatorId: user.id,
|
||||
message: 'Check this 3d model',
|
||||
},
|
||||
})
|
||||
|
||||
const mockSession = {
|
||||
id: 'mock-session-id',
|
||||
subscribe: vi.fn(),
|
||||
getEntries: vi.fn().mockResolvedValue([]),
|
||||
getStorage: vi.fn().mockReturnValue({ sessionId: 'mock-session-id' }),
|
||||
}
|
||||
const mockHarness = {
|
||||
subscribe: vi.fn(),
|
||||
prompt: vi.fn().mockResolvedValue({
|
||||
content: [{ type: 'text', text: 'Response' }],
|
||||
usage: { input: 10, output: 20 },
|
||||
}),
|
||||
}
|
||||
|
||||
vi.mocked(piAgent.createAgentSession).mockResolvedValue({
|
||||
session: mockSession as unknown as Session<DatabaseSessionMetadata>,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Mock AgentHarness instance for activity test
|
||||
harness: mockHarness as unknown as AgentHarness<any, any, any, any>,
|
||||
})
|
||||
|
||||
const context = {
|
||||
agent: { id: 'agent-1', provider: { name: 'google' }, modelRef: { modelId: 'gemini' } },
|
||||
dbProviders: [],
|
||||
teamSkills: [],
|
||||
allowedDomains: [],
|
||||
} as unknown as AgentExecutionContext
|
||||
|
||||
await agentChatActivity({
|
||||
teamId: team.id,
|
||||
agentId: 'agent-1',
|
||||
message: 'Hello',
|
||||
imageUrls: [],
|
||||
projectId: project.id,
|
||||
folderId: asset.id,
|
||||
assetId: asset.id,
|
||||
sessionId: 'mock-session-id',
|
||||
userCommentId: comment.id,
|
||||
userId: user.id,
|
||||
context,
|
||||
})
|
||||
|
||||
const lastCall = vi.mocked(piAgent.createAgentSession).mock.calls.at(-1)
|
||||
const systemPromptArg = lastCall?.[0].systemPrompt as string
|
||||
expect(systemPromptArg).toContain('# 3D Model Inspection')
|
||||
expect(systemPromptArg).toContain('media_type="3d"')
|
||||
expect(systemPromptArg).toContain('config3d')
|
||||
expect(systemPromptArg).toContain('<position type="degree" degree="..." />')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,19 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import {
|
||||
generateTextEmbeddingActivity,
|
||||
extractAiMetadataActivity,
|
||||
getEmbeddingContextActivity,
|
||||
saveAssetEmbeddingsActivity,
|
||||
deleteAssetEmbeddingsActivity,
|
||||
generateImageEmbeddingActivity,
|
||||
generateVideoChunkEmbeddingActivity,
|
||||
generateEmbeddingActivity,
|
||||
getGemmaEmbeddingTargetFrameCount,
|
||||
} from './ai'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { transcodeService } from '@shumai/core'
|
||||
import { prisma, AssetType, AssetStatus } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import sharp from 'sharp'
|
||||
|
||||
vi.mock('fs', async (importOriginal) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- importOriginal returns the raw fs module, typed dynamically as any here
|
||||
@@ -54,7 +56,6 @@ vi.mock('child_process', () => {
|
||||
const execFileMock: any = vi.fn((file: any, args: any, cb: any) => {
|
||||
cb(null, '120.0\n', '')
|
||||
})
|
||||
// Setup custom promisify behavior to return { stdout, stderr }
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mock functions dynamically return varying types based on test command calls
|
||||
execFileMock[Symbol.for('nodejs.util.promisify.custom')] = vi.fn(async (file: any) => {
|
||||
if (file === 'ffprobe') {
|
||||
@@ -90,6 +91,14 @@ describe('AI Activities Unit Tests', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
process.env.GEMINI_API_KEY = 'test-key'
|
||||
delete process.env.EMBEDDING_PROVIDER
|
||||
delete process.env.GEMMA_EMBEDDING_OPENAI_BASE_URL
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals()
|
||||
delete process.env.EMBEDDING_PROVIDER
|
||||
delete process.env.GEMMA_EMBEDDING_OPENAI_BASE_URL
|
||||
})
|
||||
|
||||
it('should generate image embedding', async () => {
|
||||
@@ -126,33 +135,6 @@ describe('AI Activities Unit Tests', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('should resolve video input via resolveInput and avoid downloadToFile in generateEmbeddingActivity', async () => {
|
||||
vi.mocked(s3Service.downloadToFile).mockClear()
|
||||
vi.mocked(s3Service.resolveInput).mockClear()
|
||||
vi.mocked(s3Service.resolveInput).mockResolvedValue(
|
||||
'https://mock-storage/files/asset-123/video.mp4',
|
||||
)
|
||||
|
||||
const res = await generateEmbeddingActivity({
|
||||
teamId: 't1',
|
||||
assetId: 'asset-123',
|
||||
context: {
|
||||
agent: {},
|
||||
asset: {
|
||||
mediaType: 'video/mp4',
|
||||
name: 'sample.mp4',
|
||||
storageKey: { key: 'files/asset-123/video.mp4' },
|
||||
media: { proxyType: 'video' },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
expect(s3Service.resolveInput).toHaveBeenCalledWith('shumai', 'files/asset-123/video.mp4')
|
||||
expect(s3Service.downloadToFile).not.toHaveBeenCalled()
|
||||
expect(s3Service.getObject).not.toHaveBeenCalledWith('shumai', 'files/asset-123/video.mp4')
|
||||
expect(res.embeddings.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('should generate text embedding successfully', async () => {
|
||||
const res = await generateTextEmbeddingActivity({
|
||||
text: 'Search query',
|
||||
@@ -172,6 +154,356 @@ describe('AI Activities Unit Tests', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('should generate text embedding successfully with gemma-embedding-2-openai', async () => {
|
||||
process.env.EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
||||
const mockFetch = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
model: 'embeddinggemma-2',
|
||||
data: [{ embedding: Array(768).fill(0.1) }],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
usage: { prompt_tokens: 15 },
|
||||
}),
|
||||
})
|
||||
vi.stubGlobal('fetch', mockFetch)
|
||||
|
||||
const res = await generateTextEmbeddingActivity({
|
||||
text: 'Search query',
|
||||
teamId: 't1',
|
||||
})
|
||||
|
||||
expect(res.embedding).toHaveLength(768)
|
||||
expect(res.usage.model).toBe('embeddinggemma-2')
|
||||
expect(res.usage.inputTokens).toBe(15)
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
'http://localhost:9379/v1/embeddings',
|
||||
expect.objectContaining({
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
model: 'embeddinggemma-2',
|
||||
input: 'task: search query | text: Search query',
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('should generate image embedding successfully with gemma-embedding-2-openai', async () => {
|
||||
process.env.EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
||||
const mockFetch = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
model: 'embeddinggemma-2',
|
||||
data: [{ embedding: Array(768).fill(0.2) }],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
usage: { prompt_tokens: 140 },
|
||||
}),
|
||||
})
|
||||
vi.stubGlobal('fetch', mockFetch)
|
||||
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from('test-image'),
|
||||
contentType: 'image/png',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
const res = await generateImageEmbeddingActivity({
|
||||
teamId: 't1',
|
||||
assetKey: 'img.png',
|
||||
mediaType: 'image/png',
|
||||
})
|
||||
|
||||
expect(res.embedding).toHaveLength(768)
|
||||
expect(res.usage.model).toBe('embeddinggemma-2')
|
||||
expect(res.usage.inputTokens).toBe(140)
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
'http://localhost:9379/v1/embeddings',
|
||||
expect.objectContaining({
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
model: 'embeddinggemma-2',
|
||||
input: [
|
||||
{
|
||||
type: 'image_url',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
image_url: {
|
||||
url: `data:image/png;base64,${Buffer.from('test-image').toString('base64')}`,
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('should respect custom GEMMA_EMBEDDING_OPENAI_BASE_URL with or without /v1 suffix', async () => {
|
||||
process.env.EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
||||
const mockFetch = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
model: 'embeddinggemma-2',
|
||||
data: [{ embedding: Array(768).fill(0.2) }],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
usage: { prompt_tokens: 10 },
|
||||
}),
|
||||
})
|
||||
vi.stubGlobal('fetch', mockFetch)
|
||||
|
||||
// Test with /v1
|
||||
process.env.GEMMA_EMBEDDING_OPENAI_BASE_URL = 'http://custom-host:9379/v1'
|
||||
await generateTextEmbeddingActivity({ text: 'test query', teamId: 't1' })
|
||||
expect(mockFetch).toHaveBeenLastCalledWith(
|
||||
'http://custom-host:9379/v1/embeddings',
|
||||
expect.anything(),
|
||||
)
|
||||
|
||||
// Test without /v1
|
||||
process.env.GEMMA_EMBEDDING_OPENAI_BASE_URL = 'http://custom-host:9379'
|
||||
await generateTextEmbeddingActivity({ text: 'test query', teamId: 't1' })
|
||||
expect(mockFetch).toHaveBeenLastCalledWith(
|
||||
'http://custom-host:9379/v1/embeddings',
|
||||
expect.anything(),
|
||||
)
|
||||
})
|
||||
|
||||
it('should convert webp image to jpeg with gemma-embedding-2-openai', async () => {
|
||||
process.env.EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
||||
const mockFetch = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
model: 'embeddinggemma-2',
|
||||
data: [{ embedding: Array(768).fill(0.2) }],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
usage: { prompt_tokens: 140 },
|
||||
}),
|
||||
})
|
||||
vi.stubGlobal('fetch', mockFetch)
|
||||
|
||||
const webpBuffer = await sharp({
|
||||
create: { width: 10, height: 10, channels: 3, background: { r: 255, g: 0, b: 0 } },
|
||||
})
|
||||
.webp()
|
||||
.toBuffer()
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: webpBuffer,
|
||||
contentType: 'image/webp',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
const res = await generateImageEmbeddingActivity({
|
||||
teamId: 't1',
|
||||
assetKey: 'img.webp',
|
||||
mediaType: 'image/webp',
|
||||
})
|
||||
|
||||
expect(res.embedding).toHaveLength(768)
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
'http://localhost:9379/v1/embeddings',
|
||||
expect.objectContaining({
|
||||
method: 'POST',
|
||||
body: expect.stringContaining('data:image/jpeg;base64,'),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('should generate video chunk embedding from tar archive with gemma-embedding-2-openai', async () => {
|
||||
process.env.EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
||||
const mockFetch = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
model: 'embeddinggemma-2',
|
||||
data: [{ embedding: Array(768).fill(0.3) }],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
usage: { prompt_tokens: 140 },
|
||||
}),
|
||||
})
|
||||
vi.stubGlobal('fetch', mockFetch)
|
||||
|
||||
const sampleArchive = new Bun.Archive({
|
||||
'frame_0001.jpg': Buffer.from('frame-1'),
|
||||
})
|
||||
const archiveBytes = await sampleArchive.bytes()
|
||||
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from(archiveBytes.buffer, archiveBytes.byteOffset, archiveBytes.byteLength),
|
||||
contentType: 'application/x-tar',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
const res = await generateVideoChunkEmbeddingActivity({
|
||||
teamId: 't1',
|
||||
chunkKey: 'files/asset-1/tmp-embedding-chunks/frames-0-60.tar',
|
||||
})
|
||||
|
||||
expect(res.embedding).toHaveLength(768)
|
||||
expect(res.usage.model).toBe('embeddinggemma-2')
|
||||
expect(mockFetch).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
describe('getGemmaEmbeddingTargetFrameCount', () => {
|
||||
it('should return 15 for standard aspect ratios', () => {
|
||||
// 16:9
|
||||
expect(getGemmaEmbeddingTargetFrameCount(1920, 1080)).toBe(15)
|
||||
expect(getGemmaEmbeddingTargetFrameCount(1280, 720)).toBe(15)
|
||||
expect(getGemmaEmbeddingTargetFrameCount(854, 480)).toBe(15)
|
||||
// 9:16
|
||||
expect(getGemmaEmbeddingTargetFrameCount(1080, 1920)).toBe(15)
|
||||
// 1:1
|
||||
expect(getGemmaEmbeddingTargetFrameCount(1080, 1080)).toBe(15)
|
||||
expect(getGemmaEmbeddingTargetFrameCount(480, 480)).toBe(15)
|
||||
// 4:3
|
||||
expect(getGemmaEmbeddingTargetFrameCount(1440, 1080)).toBe(15)
|
||||
expect(getGemmaEmbeddingTargetFrameCount(640, 480)).toBe(15)
|
||||
// 3:4
|
||||
expect(getGemmaEmbeddingTargetFrameCount(1080, 1440)).toBe(15)
|
||||
// 21:9
|
||||
expect(getGemmaEmbeddingTargetFrameCount(2560, 1080)).toBe(15)
|
||||
expect(getGemmaEmbeddingTargetFrameCount(3440, 1440)).toBe(15)
|
||||
})
|
||||
|
||||
it('should return 14 for non-standard aspect ratios and missing/invalid dimensions', () => {
|
||||
expect(getGemmaEmbeddingTargetFrameCount(1000, 600)).toBe(14) // 5:3
|
||||
expect(getGemmaEmbeddingTargetFrameCount(700, 500)).toBe(14) // 1.4:1
|
||||
expect(getGemmaEmbeddingTargetFrameCount(854, 672)).toBe(14) // ~1.27:1
|
||||
expect(getGemmaEmbeddingTargetFrameCount(undefined, undefined)).toBe(14)
|
||||
expect(getGemmaEmbeddingTargetFrameCount(0, 0)).toBe(14)
|
||||
expect(getGemmaEmbeddingTargetFrameCount(-100, 100)).toBe(14)
|
||||
})
|
||||
})
|
||||
|
||||
it('should sample uniform 15 frames when chunk archive contains standard 16:9 frames', async () => {
|
||||
process.env.EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
||||
const mockFetch = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
model: 'embeddinggemma-2',
|
||||
data: [{ embedding: Array(768).fill(0.3) }],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
usage: { prompt_tokens: 140 },
|
||||
}),
|
||||
})
|
||||
vi.stubGlobal('fetch', mockFetch)
|
||||
|
||||
const sampleJpg = await sharp({
|
||||
create: {
|
||||
width: 160,
|
||||
height: 90,
|
||||
channels: 3,
|
||||
background: { r: 0, g: 0, b: 0 },
|
||||
},
|
||||
})
|
||||
.jpeg()
|
||||
.toBuffer()
|
||||
|
||||
const frames: Record<string, Buffer> = {}
|
||||
for (let i = 1; i <= 30; i++) {
|
||||
frames[`frame_${String(i).padStart(4, '0')}.jpg`] = sampleJpg
|
||||
}
|
||||
const sampleArchive = new Bun.Archive(frames)
|
||||
const archiveBytes = await sampleArchive.bytes()
|
||||
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from(archiveBytes.buffer, archiveBytes.byteOffset, archiveBytes.byteLength),
|
||||
contentType: 'application/x-tar',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
const res = await generateVideoChunkEmbeddingActivity({
|
||||
teamId: 't1',
|
||||
chunkKey: 'files/asset-1/tmp-embedding-chunks/frames-0-60.tar',
|
||||
})
|
||||
|
||||
expect(res.embedding).toHaveLength(768)
|
||||
const requestBody = JSON.parse(mockFetch.mock.calls[0][1].body)
|
||||
expect(requestBody.input).toHaveLength(15)
|
||||
})
|
||||
|
||||
it('should fallback to 14 frames when chunk archive contains non-standard or unparseable frames', async () => {
|
||||
process.env.EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
||||
const mockFetch = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
model: 'embeddinggemma-2',
|
||||
data: [{ embedding: Array(768).fill(0.3) }],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
usage: { prompt_tokens: 140 },
|
||||
}),
|
||||
})
|
||||
vi.stubGlobal('fetch', mockFetch)
|
||||
|
||||
const frames: Record<string, Buffer> = {}
|
||||
for (let i = 1; i <= 30; i++) {
|
||||
frames[`frame_${String(i).padStart(4, '0')}.jpg`] = Buffer.from(`frame-${i}`)
|
||||
}
|
||||
const sampleArchive = new Bun.Archive(frames)
|
||||
const archiveBytes = await sampleArchive.bytes()
|
||||
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from(archiveBytes.buffer, archiveBytes.byteOffset, archiveBytes.byteLength),
|
||||
contentType: 'application/x-tar',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
const res = await generateVideoChunkEmbeddingActivity({
|
||||
teamId: 't1',
|
||||
chunkKey: 'files/asset-1/tmp-embedding-chunks/frames-0-60.tar',
|
||||
})
|
||||
|
||||
expect(res.embedding).toHaveLength(768)
|
||||
const requestBody = JSON.parse(mockFetch.mock.calls[0][1].body)
|
||||
expect(requestBody.input).toHaveLength(14)
|
||||
})
|
||||
|
||||
it('should throw non-retryable ApplicationFailure when chunk archive contains no valid frames', async () => {
|
||||
process.env.EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
||||
const sampleArchive = new Bun.Archive({
|
||||
'info.txt': Buffer.from('not an image'),
|
||||
})
|
||||
const archiveBytes = await sampleArchive.bytes()
|
||||
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from(archiveBytes.buffer, archiveBytes.byteOffset, archiveBytes.byteLength),
|
||||
contentType: 'application/x-tar',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
await expect(
|
||||
generateVideoChunkEmbeddingActivity({
|
||||
teamId: 't1',
|
||||
chunkKey: 'files/asset-1/tmp-embedding-chunks/frames-0-60.tar',
|
||||
}),
|
||||
).rejects.toThrow('No extracted frames found in chunk archive')
|
||||
})
|
||||
|
||||
it('should throw non-retryable ApplicationFailure when chunk archive data is corrupted', async () => {
|
||||
process.env.EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from('corrupted non-tar bytes'),
|
||||
contentType: 'application/x-tar',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
await expect(
|
||||
generateVideoChunkEmbeddingActivity({
|
||||
teamId: 't1',
|
||||
chunkKey: 'files/asset-1/tmp-embedding-chunks/frames-0-60.tar',
|
||||
}),
|
||||
).rejects.toThrow('Failed to read chunk archive')
|
||||
})
|
||||
|
||||
it('should throw non-retryable ApplicationFailure when an extracted frame is empty (0 bytes)', async () => {
|
||||
process.env.EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
||||
const sampleArchive = new Bun.Archive({
|
||||
'frame_0001.jpg': Buffer.alloc(0),
|
||||
})
|
||||
const archiveBytes = await sampleArchive.bytes()
|
||||
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from(archiveBytes.buffer, archiveBytes.byteOffset, archiveBytes.byteLength),
|
||||
contentType: 'application/x-tar',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
await expect(
|
||||
generateVideoChunkEmbeddingActivity({
|
||||
teamId: 't1',
|
||||
chunkKey: 'files/asset-1/tmp-embedding-chunks/frames-0-60.tar',
|
||||
}),
|
||||
).rejects.toThrow('is empty (0 bytes)')
|
||||
})
|
||||
|
||||
describe('extractAiMetadataActivity', () => {
|
||||
it('should return existing images if they are already in S3 storage', async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mock returned object cast as any due to partial implementation
|
||||
@@ -331,6 +663,18 @@ describe('AI Database Activities Integration', () => {
|
||||
expect(ctx.agent.id).toBe(user.id)
|
||||
expect(ctx.asset.id).toBe(asset.id)
|
||||
expect(ctx.asset.mediaType).toBe('video/mp4')
|
||||
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'false'
|
||||
try {
|
||||
await expect(
|
||||
getEmbeddingContextActivity({
|
||||
teamId: team.id,
|
||||
assetId: asset.id,
|
||||
}),
|
||||
).rejects.toThrow('embedding feature is disabled or agent not found')
|
||||
} finally {
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
}
|
||||
})
|
||||
|
||||
it('should parse valid positive chunk duration and fallback on invalid or negative ones', async () => {
|
||||
@@ -389,6 +733,45 @@ describe('AI Database Activities Integration', () => {
|
||||
delete process.env.EMBEDDING_CHUNK_DURATION
|
||||
delete process.env.EMBEDDING_CHUNK_OVERLAP
|
||||
})
|
||||
|
||||
it('should return existing embeddings for the asset', async () => {
|
||||
// Ensure agent exists
|
||||
await prisma.agent.upsert({
|
||||
where: { id: user.id },
|
||||
update: {},
|
||||
create: {
|
||||
id: user.id,
|
||||
teamId: team.id,
|
||||
type: 'embedding',
|
||||
enabled: true,
|
||||
config: { provider: 'openai', model: 'gpt-4' },
|
||||
},
|
||||
})
|
||||
|
||||
await saveAssetEmbeddingsActivity({
|
||||
assetId: asset.id,
|
||||
embeddings: [
|
||||
{ embedding: Array(1536).fill(0.01), startTime: 0.0, endTime: 60.0 },
|
||||
{ embedding: Array(768).fill(0.02), startTime: 55.0, endTime: 115.0 },
|
||||
],
|
||||
})
|
||||
|
||||
const ctx = await getEmbeddingContextActivity({
|
||||
teamId: team.id,
|
||||
assetId: asset.id,
|
||||
})
|
||||
|
||||
expect(ctx.existingEmbeddings).toHaveLength(2)
|
||||
const chunk1 = ctx.existingEmbeddings.find((e) => e.startTime === 0)
|
||||
expect(chunk1).toBeDefined()
|
||||
expect(chunk1?.has1536).toBe(true)
|
||||
expect(chunk1?.has768).toBe(false)
|
||||
|
||||
const chunk2 = ctx.existingEmbeddings.find((e) => e.startTime === 55)
|
||||
expect(chunk2).toBeDefined()
|
||||
expect(chunk2?.has1536).toBe(false)
|
||||
expect(chunk2?.has768).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('saveAssetEmbeddingsActivity', () => {
|
||||
@@ -423,5 +806,85 @@ describe('AI Database Activities Integration', () => {
|
||||
expect(dbEmbeddings[0].endTime).toBe(60.0)
|
||||
expect(dbEmbeddings[1].startTime).toBeNull()
|
||||
})
|
||||
|
||||
it('should save 768-dim embeddings to embedding_768 column in database', async () => {
|
||||
const embeddings = [
|
||||
{
|
||||
embedding: Array(768).fill(0.01),
|
||||
startTime: 0.0,
|
||||
endTime: 60.0,
|
||||
},
|
||||
{
|
||||
embedding: Array(768).fill(0.02),
|
||||
},
|
||||
]
|
||||
|
||||
await saveAssetEmbeddingsActivity({
|
||||
assetId: asset.id,
|
||||
embeddings,
|
||||
})
|
||||
|
||||
// Query raw embeddings from DB
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- db query output is a raw postgres result array typed as any
|
||||
const dbEmbeddings: any[] = await prisma.$queryRaw`
|
||||
SELECT id, asset_id as "assetId", (embedding_768 IS NOT NULL) as "has768", (embedding IS NOT NULL) as "has1536"
|
||||
FROM asset_embeddings
|
||||
WHERE asset_id = ${asset.id}
|
||||
`
|
||||
|
||||
expect(dbEmbeddings.length).toBe(2)
|
||||
expect(dbEmbeddings[0].has768).toBe(true)
|
||||
expect(dbEmbeddings[0].has1536).toBe(false)
|
||||
expect(dbEmbeddings[1].has768).toBe(true)
|
||||
expect(dbEmbeddings[1].has1536).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('deleteAssetEmbeddingsActivity', () => {
|
||||
it('should delete specific embeddings by id', async () => {
|
||||
await saveAssetEmbeddingsActivity({
|
||||
assetId: asset.id,
|
||||
embeddings: [
|
||||
{ embedding: Array(1536).fill(0.01), startTime: 0, endTime: 60 },
|
||||
{ embedding: Array(1536).fill(0.02), startTime: 55, endTime: 115 },
|
||||
],
|
||||
})
|
||||
|
||||
const before = await prisma.assetEmbedding.findMany({
|
||||
where: { assetId: asset.id },
|
||||
})
|
||||
expect(before).toHaveLength(2)
|
||||
|
||||
const targetId = before[0].id
|
||||
await deleteAssetEmbeddingsActivity({
|
||||
assetId: asset.id,
|
||||
ids: [targetId],
|
||||
})
|
||||
|
||||
const after = await prisma.assetEmbedding.findMany({
|
||||
where: { assetId: asset.id },
|
||||
})
|
||||
expect(after).toHaveLength(1)
|
||||
expect(after[0].id).not.toBe(targetId)
|
||||
})
|
||||
|
||||
it('should delete all embeddings for an asset when ids is not provided', async () => {
|
||||
await saveAssetEmbeddingsActivity({
|
||||
assetId: asset.id,
|
||||
embeddings: [
|
||||
{ embedding: Array(1536).fill(0.01), startTime: 0, endTime: 60 },
|
||||
{ embedding: Array(1536).fill(0.02), startTime: 55, endTime: 115 },
|
||||
],
|
||||
})
|
||||
|
||||
await deleteAssetEmbeddingsActivity({
|
||||
assetId: asset.id,
|
||||
})
|
||||
|
||||
const after = await prisma.assetEmbedding.findMany({
|
||||
where: { assetId: asset.id },
|
||||
})
|
||||
expect(after).toHaveLength(0)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
+575
-289
@@ -1,15 +1,15 @@
|
||||
import { GoogleGenAI } from '@google/genai'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { transcodeService } from '@shumai/core'
|
||||
import { execFile } from 'child_process'
|
||||
import * as fs from 'fs'
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import { execFile } from 'child_process'
|
||||
import { promisify } from 'util'
|
||||
import { ApplicationFailure } from '@temporalio/activity'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { getProxyType } from '@shumai/core/src/utils/mime'
|
||||
import { ulid } from 'ulid'
|
||||
import { ApplicationFailure, defineStep } from '@shumai/workflow-core'
|
||||
import { prisma } from '@shumai/db'
|
||||
import sharp from 'sharp'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
|
||||
@@ -25,15 +25,6 @@ export interface GeneratedEmbedding {
|
||||
endTime?: number
|
||||
}
|
||||
|
||||
export interface GenerateEmbeddingParams {
|
||||
teamId: string
|
||||
assetId: string
|
||||
context: {
|
||||
agent: unknown
|
||||
asset: unknown
|
||||
}
|
||||
}
|
||||
|
||||
async function generateMultimodalEmbedding(
|
||||
ai: GoogleGenAI,
|
||||
buffer: Buffer,
|
||||
@@ -62,179 +53,109 @@ async function generateMultimodalEmbedding(
|
||||
return values
|
||||
}
|
||||
|
||||
export async function generateEmbeddingActivity(params: GenerateEmbeddingParams): Promise<{
|
||||
embeddings: GeneratedEmbedding[]
|
||||
interface OpenAiEmbeddingItem {
|
||||
type?: string
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
image_url?: {
|
||||
url: string
|
||||
}
|
||||
}
|
||||
|
||||
async function callGemmaEmbeddingServer(input: string | OpenAiEmbeddingItem[]): Promise<{
|
||||
embedding: number[]
|
||||
usage: Usage
|
||||
}> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- context properties are fetched as JSON from the DB activity
|
||||
const { asset } = params.context as any
|
||||
const rawBaseUrl = process.env.GEMMA_EMBEDDING_OPENAI_BASE_URL || 'http://localhost:9379/v1'
|
||||
|
||||
if (!asset.mediaType) {
|
||||
throw ApplicationFailure.create({ message: 'asset has no media type', nonRetryable: true })
|
||||
}
|
||||
const normalized = rawBaseUrl.replace(/\/+$/, '')
|
||||
const endpoint = normalized.endsWith('/embeddings')
|
||||
? normalized
|
||||
: normalized.endsWith('/v1')
|
||||
? `${normalized}/embeddings`
|
||||
: `${normalized}/v1/embeddings`
|
||||
|
||||
const apiKey = process.env.GEMINI_API_KEY
|
||||
if (!apiKey) {
|
||||
const response = await fetch(endpoint, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
model: 'embeddinggemma-2',
|
||||
input,
|
||||
}),
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text()
|
||||
throw ApplicationFailure.create({
|
||||
message: 'GEMINI_API_KEY environment variable is not configured',
|
||||
nonRetryable: true,
|
||||
message: `Embedding server returned status ${response.status}: ${errorText}`,
|
||||
nonRetryable: false,
|
||||
})
|
||||
}
|
||||
|
||||
const resolvedApiKey = process.env[apiKey] || apiKey
|
||||
const ai = new GoogleGenAI({ apiKey: resolvedApiKey })
|
||||
|
||||
const usage: Usage = {
|
||||
model: 'gemini-embedding-2',
|
||||
inputTokens: 0,
|
||||
outputTokens: 0,
|
||||
}
|
||||
|
||||
const proxyType =
|
||||
(asset.media as PrismaJson.MediaInfo | null)?.proxyType ||
|
||||
getProxyType(asset.mediaType, asset.name)
|
||||
const isImage = proxyType === 'image'
|
||||
const isVideo = proxyType === 'video'
|
||||
|
||||
if (!isImage && !isVideo) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- response json shape is dynamic from external endpoint
|
||||
const json: any = await response.json()
|
||||
const embedding = json.data?.[0]?.embedding
|
||||
if (!embedding || !Array.isArray(embedding)) {
|
||||
throw ApplicationFailure.create({
|
||||
message: `unsupported media type for embeddings: ${asset.mediaType}`,
|
||||
nonRetryable: true,
|
||||
message: 'Invalid embedding returned from embedding server',
|
||||
nonRetryable: false,
|
||||
})
|
||||
}
|
||||
|
||||
const key = asset.storageKey?.key
|
||||
if (!key) {
|
||||
throw ApplicationFailure.create({ message: 'asset has no key', nonRetryable: true })
|
||||
}
|
||||
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
const results: GeneratedEmbedding[] = []
|
||||
|
||||
if (isImage) {
|
||||
const { buffer: data } = await s3Service.getObject(bucket, key)
|
||||
const embVec = await generateMultimodalEmbedding(ai, data, asset.mediaType)
|
||||
results.push({ embedding: embVec })
|
||||
} else if (isVideo) {
|
||||
const inputSource = await s3Service.resolveInput(bucket, key)
|
||||
const isRemote = inputSource.startsWith('http://') || inputSource.startsWith('https://')
|
||||
|
||||
const { stdout } = await execFileAsync('ffprobe', [
|
||||
'-v',
|
||||
'error',
|
||||
'-show_entries',
|
||||
'format=duration',
|
||||
'-of',
|
||||
'default=noprint_wrappers=1:nokey=1',
|
||||
inputSource,
|
||||
])
|
||||
const duration = parseFloat(stdout.trim())
|
||||
if (isNaN(duration)) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'failed to parse video duration',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
const chunkSize = 60.0
|
||||
for (let start = 0.0; start < duration; start += chunkSize) {
|
||||
let end = start + chunkSize
|
||||
if (end > duration) end = duration
|
||||
|
||||
const chunkTmp = path.join(os.tmpdir(), `video-chunk-${Date.now()}-${ulid()}.mp4`)
|
||||
try {
|
||||
await execFileAsync('ffmpeg', [
|
||||
'-y',
|
||||
'-loglevel',
|
||||
'warning',
|
||||
...(isRemote
|
||||
? ['-reconnect', '1', '-reconnect_streamed', '1', '-reconnect_delay_max', '5']
|
||||
: []),
|
||||
'-ss',
|
||||
start.toString(),
|
||||
'-i',
|
||||
inputSource,
|
||||
'-t',
|
||||
(end - start).toString(),
|
||||
'-c',
|
||||
'copy',
|
||||
chunkTmp,
|
||||
])
|
||||
|
||||
const chunkData = fs.readFileSync(chunkTmp)
|
||||
|
||||
try {
|
||||
const embVec = await generateMultimodalEmbedding(ai, chunkData, 'video/mp4')
|
||||
results.push({ embedding: embVec, startTime: start, endTime: end })
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (e: any) {
|
||||
console.error(
|
||||
`failed to generate video embedding for chunk ${start}-${end}: ${e.message}`,
|
||||
)
|
||||
}
|
||||
} finally {
|
||||
if (fs.existsSync(chunkTmp)) {
|
||||
fs.unlinkSync(chunkTmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
embeddings: results,
|
||||
usage,
|
||||
embedding,
|
||||
usage: {
|
||||
model: json.model || 'gemma-embedding-2-openai',
|
||||
inputTokens: json.usage?.prompt_tokens ?? 0,
|
||||
outputTokens: 0,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
import { textEmbeddingService } from '@shumai/core/src/search/text-embedding'
|
||||
|
||||
export interface GenerateTextEmbeddingParams {
|
||||
text: string
|
||||
teamId: string
|
||||
}
|
||||
|
||||
export async function generateTextEmbeddingActivity(params: GenerateTextEmbeddingParams): Promise<{
|
||||
embedding: number[]
|
||||
usage: Usage
|
||||
}> {
|
||||
const apiKey = process.env.GEMINI_API_KEY
|
||||
if (!apiKey) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'GEMINI_API_KEY environment variable is not configured',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
export const generateTextEmbeddingActivity = defineStep(
|
||||
async function generateTextEmbeddingActivity(params: GenerateTextEmbeddingParams): Promise<{
|
||||
embedding: number[]
|
||||
usage: Usage
|
||||
}> {
|
||||
const provider = process.env.EMBEDDING_PROVIDER || 'gemini-embedding-2'
|
||||
if (provider !== 'gemma-embedding-2-openai' && !process.env.GEMINI_API_KEY) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'GEMINI_API_KEY environment variable is not configured',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
const resolvedApiKey = process.env[apiKey] || apiKey
|
||||
const ai = new GoogleGenAI({ apiKey: resolvedApiKey })
|
||||
try {
|
||||
const result = await textEmbeddingService.generateEmbedding(params.text, {
|
||||
teamId: params.teamId,
|
||||
skipCache: true,
|
||||
})
|
||||
|
||||
const usage: Usage = {
|
||||
model: 'gemini-embedding-2',
|
||||
inputTokens: 0,
|
||||
outputTokens: 0,
|
||||
}
|
||||
|
||||
const response = await ai.models.embedContent({
|
||||
model: 'gemini-embedding-2',
|
||||
contents: [
|
||||
{
|
||||
parts: [{ text: params.text }],
|
||||
role: 'user',
|
||||
},
|
||||
],
|
||||
config: {
|
||||
outputDimensionality: 1536,
|
||||
},
|
||||
})
|
||||
|
||||
const values = response.embeddings?.[0]?.values
|
||||
if (!values) {
|
||||
throw new Error('No embedding values returned from gemini-embedding-2')
|
||||
}
|
||||
|
||||
return {
|
||||
embedding: values,
|
||||
usage,
|
||||
}
|
||||
}
|
||||
return {
|
||||
embedding: result.embedding,
|
||||
usage: {
|
||||
model: result.usage?.model || provider,
|
||||
inputTokens: result.usage?.inputTokens ?? 0,
|
||||
outputTokens: result.usage?.outputTokens ?? 0,
|
||||
},
|
||||
}
|
||||
} catch (err) {
|
||||
if (err instanceof ApplicationFailure) {
|
||||
throw err
|
||||
}
|
||||
throw ApplicationFailure.create({
|
||||
message: err instanceof Error ? err.message : String(err),
|
||||
nonRetryable: false,
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
export interface ExtractAiMetadataParams {
|
||||
assetKey: string
|
||||
@@ -243,7 +164,7 @@ export interface ExtractAiMetadataParams {
|
||||
isImage: boolean
|
||||
}
|
||||
|
||||
export async function extractAiMetadataActivity(
|
||||
export const extractAiMetadataActivity = defineStep(async function extractAiMetadataActivity(
|
||||
params: ExtractAiMetadataParams,
|
||||
): Promise<string[]> {
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
@@ -294,119 +215,232 @@ export async function extractAiMetadataActivity(
|
||||
}
|
||||
|
||||
return generatedFiles
|
||||
}
|
||||
})
|
||||
|
||||
export async function getEmbeddingContextActivity(params: { teamId: string; assetId: string }) {
|
||||
const team = await prisma.team.findUnique({
|
||||
where: { id: params.teamId },
|
||||
})
|
||||
if (!team) {
|
||||
throw ApplicationFailure.create({ message: 'failed to get team', nonRetryable: true })
|
||||
}
|
||||
|
||||
const agent = await prisma.agent.findFirst({
|
||||
where: {
|
||||
type: 'embedding',
|
||||
enabled: true,
|
||||
user: { teamMembers: { some: { teamId: params.teamId } } },
|
||||
},
|
||||
})
|
||||
if (!agent) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'embedding feature is disabled or agent not found',
|
||||
nonRetryable: true,
|
||||
export const getEmbeddingContextActivity = defineStep(
|
||||
async function getEmbeddingContextActivity(params: { teamId: string; assetId: string }) {
|
||||
const team = await prisma.team.findUnique({
|
||||
where: { id: params.teamId },
|
||||
})
|
||||
}
|
||||
|
||||
const asset = await prisma.asset.findUnique({
|
||||
where: { id: params.assetId },
|
||||
include: { storageKey: true },
|
||||
})
|
||||
if (!asset) {
|
||||
throw ApplicationFailure.create({ message: 'failed to get asset', nonRetryable: true })
|
||||
}
|
||||
if (!asset.mediaType) {
|
||||
throw ApplicationFailure.create({ message: 'asset has no media type', nonRetryable: true })
|
||||
}
|
||||
|
||||
const parsedDuration = parseFloat(process.env.EMBEDDING_CHUNK_DURATION || '')
|
||||
const chunkDuration =
|
||||
Number.isFinite(parsedDuration) && parsedDuration > 0 ? parsedDuration : 60.0
|
||||
|
||||
const parsedOverlap = parseFloat(process.env.EMBEDDING_CHUNK_OVERLAP || '')
|
||||
const chunkOverlap = Number.isFinite(parsedOverlap) && parsedOverlap >= 0 ? parsedOverlap : 5.0
|
||||
|
||||
return {
|
||||
agent,
|
||||
asset,
|
||||
chunkDuration,
|
||||
chunkOverlap,
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveAssetEmbeddingsActivity(params: {
|
||||
assetId: string
|
||||
embeddings: Array<{
|
||||
embedding: number[]
|
||||
startTime?: number
|
||||
endTime?: number
|
||||
}>
|
||||
}) {
|
||||
for (const item of params.embeddings) {
|
||||
const embVec = JSON.stringify(item.embedding)
|
||||
if (item.startTime !== undefined && item.endTime !== undefined) {
|
||||
await prisma.$executeRaw`
|
||||
INSERT INTO asset_embeddings (id, asset_id, embedding, start_time, end_time, updated_at)
|
||||
VALUES (gen_random_uuid()::text, ${params.assetId}, ${embVec}::vector, ${item.startTime}, ${item.endTime}, NOW())
|
||||
`
|
||||
} else {
|
||||
await prisma.$executeRaw`
|
||||
INSERT INTO asset_embeddings (id, asset_id, embedding, updated_at)
|
||||
VALUES (gen_random_uuid()::text, ${params.assetId}, ${embVec}::vector, NOW())
|
||||
`
|
||||
if (!team) {
|
||||
throw ApplicationFailure.create({ message: 'failed to get team', nonRetryable: true })
|
||||
}
|
||||
}
|
||||
|
||||
const agent = await prisma.agent.findFirst({
|
||||
where: {
|
||||
type: 'embedding',
|
||||
enabled: true,
|
||||
user: { teamMembers: { some: { teamId: params.teamId } } },
|
||||
},
|
||||
})
|
||||
if (!agent || process.env.ENABLE_EMBEDDING_AGENT === 'false') {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'embedding feature is disabled or agent not found',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
const asset = await prisma.asset.findUnique({
|
||||
where: { id: params.assetId },
|
||||
include: { storageKey: true },
|
||||
})
|
||||
if (!asset) {
|
||||
throw ApplicationFailure.create({ message: 'failed to get asset', nonRetryable: true })
|
||||
}
|
||||
if (!asset.mediaType) {
|
||||
throw ApplicationFailure.create({ message: 'asset has no media type', nonRetryable: true })
|
||||
}
|
||||
|
||||
const parsedDuration = parseFloat(process.env.EMBEDDING_CHUNK_DURATION || '')
|
||||
const chunkDuration =
|
||||
Number.isFinite(parsedDuration) && parsedDuration > 0 ? parsedDuration : 60.0
|
||||
|
||||
const parsedOverlap = parseFloat(process.env.EMBEDDING_CHUNK_OVERLAP || '')
|
||||
const chunkOverlap = Number.isFinite(parsedOverlap) && parsedOverlap >= 0 ? parsedOverlap : 5.0
|
||||
const embeddingProvider = process.env.EMBEDDING_PROVIDER || 'gemini-embedding-2'
|
||||
|
||||
const existingEmbeddings = await prisma.$queryRaw<ExistingAssetEmbeddingInfo[]>`
|
||||
SELECT
|
||||
id,
|
||||
start_time as "startTime",
|
||||
end_time as "endTime",
|
||||
(embedding IS NOT NULL) as "has1536",
|
||||
(embedding_768 IS NOT NULL) as "has768"
|
||||
FROM asset_embeddings
|
||||
WHERE asset_id = ${params.assetId}
|
||||
`
|
||||
|
||||
return {
|
||||
agent,
|
||||
asset,
|
||||
chunkDuration,
|
||||
chunkOverlap,
|
||||
embeddingProvider,
|
||||
existingEmbeddings,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
export interface ExistingAssetEmbeddingInfo {
|
||||
id: string
|
||||
startTime: number | null
|
||||
endTime: number | null
|
||||
has1536: boolean
|
||||
has768: boolean
|
||||
}
|
||||
|
||||
export const deleteAssetEmbeddingsActivity = defineStep(
|
||||
async function deleteAssetEmbeddingsActivity(params: { assetId: string; ids?: string[] }) {
|
||||
if (params.ids && params.ids.length > 0) {
|
||||
await prisma.assetEmbedding.deleteMany({
|
||||
where: {
|
||||
assetId: params.assetId,
|
||||
id: { in: params.ids },
|
||||
},
|
||||
})
|
||||
} else {
|
||||
await prisma.assetEmbedding.deleteMany({
|
||||
where: {
|
||||
assetId: params.assetId,
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
export const saveAssetEmbeddingsActivity = defineStep(
|
||||
async function saveAssetEmbeddingsActivity(params: {
|
||||
assetId: string
|
||||
embeddings: Array<{
|
||||
embedding: number[]
|
||||
startTime?: number
|
||||
endTime?: number
|
||||
}>
|
||||
}) {
|
||||
for (const item of params.embeddings) {
|
||||
const embVec = JSON.stringify(item.embedding)
|
||||
const is768 = item.embedding.length === 768
|
||||
|
||||
if (item.startTime !== undefined && item.endTime !== undefined) {
|
||||
if (is768) {
|
||||
await prisma.$executeRaw`
|
||||
INSERT INTO asset_embeddings (id, asset_id, embedding_768, start_time, end_time, updated_at)
|
||||
VALUES (gen_random_uuid()::text, ${params.assetId}, ${embVec}::vector, ${item.startTime}, ${item.endTime}, NOW())
|
||||
`
|
||||
} else {
|
||||
await prisma.$executeRaw`
|
||||
INSERT INTO asset_embeddings (id, asset_id, embedding, start_time, end_time, updated_at)
|
||||
VALUES (gen_random_uuid()::text, ${params.assetId}, ${embVec}::vector, ${item.startTime}, ${item.endTime}, NOW())
|
||||
`
|
||||
}
|
||||
} else {
|
||||
if (is768) {
|
||||
await prisma.$executeRaw`
|
||||
INSERT INTO asset_embeddings (id, asset_id, embedding_768, updated_at)
|
||||
VALUES (gen_random_uuid()::text, ${params.assetId}, ${embVec}::vector, NOW())
|
||||
`
|
||||
} else {
|
||||
await prisma.$executeRaw`
|
||||
INSERT INTO asset_embeddings (id, asset_id, embedding, updated_at)
|
||||
VALUES (gen_random_uuid()::text, ${params.assetId}, ${embVec}::vector, NOW())
|
||||
`
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
export interface GenerateImageEmbeddingParams {
|
||||
teamId: string
|
||||
assetKey: string
|
||||
mediaType: string
|
||||
}
|
||||
|
||||
export async function generateImageEmbeddingActivity(
|
||||
params: GenerateImageEmbeddingParams,
|
||||
): Promise<{
|
||||
embedding: number[]
|
||||
usage: Usage
|
||||
}> {
|
||||
const apiKey = process.env.GEMINI_API_KEY
|
||||
if (!apiKey) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'GEMINI_API_KEY environment variable is not configured',
|
||||
nonRetryable: true,
|
||||
})
|
||||
export const generateImageEmbeddingActivity = defineStep(
|
||||
async function generateImageEmbeddingActivity(params: GenerateImageEmbeddingParams): Promise<{
|
||||
embedding: number[]
|
||||
usage: Usage
|
||||
}> {
|
||||
const provider = process.env.EMBEDDING_PROVIDER || 'gemini-embedding-2'
|
||||
const { buffer: data } = await s3Service.getObject(
|
||||
process.env.S3_BUCKET || 'shumai',
|
||||
params.assetKey,
|
||||
)
|
||||
|
||||
if (provider === 'gemma-embedding-2-openai') {
|
||||
let imgData = data
|
||||
let mimeType = params.mediaType || 'image/jpeg'
|
||||
if (mimeType !== 'image/jpeg' && mimeType !== 'image/png') {
|
||||
imgData = await sharp(data).jpeg().toBuffer()
|
||||
mimeType = 'image/jpeg'
|
||||
}
|
||||
return callGemmaEmbeddingServer([
|
||||
{
|
||||
type: 'image_url',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
image_url: {
|
||||
url: `data:${mimeType};base64,${imgData.toString('base64')}`,
|
||||
},
|
||||
},
|
||||
])
|
||||
}
|
||||
|
||||
const apiKey = process.env.GEMINI_API_KEY
|
||||
if (!apiKey) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'GEMINI_API_KEY environment variable is not configured',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
const resolvedApiKey = process.env[apiKey] || apiKey
|
||||
const ai = new GoogleGenAI({ apiKey: resolvedApiKey })
|
||||
|
||||
const usage: Usage = {
|
||||
model: 'gemini-embedding-2',
|
||||
inputTokens: 0,
|
||||
outputTokens: 0,
|
||||
}
|
||||
|
||||
const embVec = await generateMultimodalEmbedding(ai, data, params.mediaType)
|
||||
|
||||
return {
|
||||
embedding: embVec,
|
||||
usage,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
/**
|
||||
* Standard aspect ratios for video embedding:
|
||||
* 1:1, 4:3, 3:4, 16:9, 9:16, 21:9 (including ultrawide 64:27), and 9:21.
|
||||
*
|
||||
* For these standard ratios, 15 frames guarantees that total input tokens stay strictly
|
||||
* within the 2048 token signature bucket (<= 1982 tokens). For non-standard or custom
|
||||
* aspect ratios (e.g. 5:3, 1.4:1), 14 frames is used to mathematically guarantee
|
||||
* that sequence length never exceeds 2048 tokens (<= 1990 tokens), preventing OOM errors.
|
||||
*/
|
||||
export function getGemmaEmbeddingTargetFrameCount(width?: number, height?: number): number {
|
||||
if (!width || !height || width <= 0 || height <= 0) {
|
||||
return 14
|
||||
}
|
||||
|
||||
const resolvedApiKey = process.env[apiKey] || apiKey
|
||||
const ai = new GoogleGenAI({ apiKey: resolvedApiKey })
|
||||
const ratio = width / height
|
||||
const standardRatios = [
|
||||
1 / 1, // 1:1
|
||||
4 / 3, // 4:3
|
||||
3 / 4, // 3:4
|
||||
16 / 9, // 16:9
|
||||
9 / 16, // 9:16
|
||||
21 / 9, // 21:9
|
||||
64 / 27, // 21:9 ultrawide (2560x1080, 3440x1440)
|
||||
9 / 21, // 9:21
|
||||
27 / 64, // 9:21 ultrawide portrait
|
||||
]
|
||||
|
||||
const usage: Usage = {
|
||||
model: 'gemini-embedding-2',
|
||||
inputTokens: 0,
|
||||
outputTokens: 0,
|
||||
}
|
||||
|
||||
const { buffer: data } = await s3Service.getObject(
|
||||
process.env.S3_BUCKET || 'shumai',
|
||||
params.assetKey,
|
||||
)
|
||||
const embVec = await generateMultimodalEmbedding(ai, data, params.mediaType)
|
||||
|
||||
return {
|
||||
embedding: embVec,
|
||||
usage,
|
||||
}
|
||||
// Allow up to 3% relative tolerance for minor encoder rounding (e.g. 854x480 vs 16:9)
|
||||
const isStandard = standardRatios.some((std) => Math.abs(ratio - std) / std <= 0.03)
|
||||
return isStandard ? 15 : 14
|
||||
}
|
||||
|
||||
export interface GenerateVideoChunkEmbeddingParams {
|
||||
@@ -414,44 +448,296 @@ export interface GenerateVideoChunkEmbeddingParams {
|
||||
chunkKey: string
|
||||
}
|
||||
|
||||
export async function generateVideoChunkEmbeddingActivity(
|
||||
params: GenerateVideoChunkEmbeddingParams,
|
||||
): Promise<{
|
||||
embedding: number[]
|
||||
usage: Usage
|
||||
}> {
|
||||
const apiKey = process.env.GEMINI_API_KEY
|
||||
if (!apiKey) {
|
||||
export const generateVideoChunkEmbeddingActivity = defineStep(
|
||||
async function generateVideoChunkEmbeddingActivity(
|
||||
params: GenerateVideoChunkEmbeddingParams,
|
||||
): Promise<{
|
||||
embedding: number[]
|
||||
usage: Usage
|
||||
}> {
|
||||
const provider = process.env.EMBEDDING_PROVIDER || 'gemini-embedding-2'
|
||||
const isGemma = provider === 'gemma-embedding-2-openai' || params.chunkKey.endsWith('.tar')
|
||||
|
||||
if (isGemma) {
|
||||
const { buffer: data } = await s3Service.getObject(
|
||||
process.env.S3_BUCKET || 'shumai',
|
||||
params.chunkKey,
|
||||
)
|
||||
|
||||
let filesMap: Map<string, File>
|
||||
try {
|
||||
const archive = new Bun.Archive(data)
|
||||
filesMap = await archive.files()
|
||||
} catch (err) {
|
||||
throw ApplicationFailure.create({
|
||||
message: `Failed to read chunk archive ${params.chunkKey}: ${err instanceof Error ? err.message : String(err)}`,
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
const frameFiles = Array.from(filesMap.keys())
|
||||
.filter((f) => /\.(jpe?g|png|webp)$/i.test(f))
|
||||
.sort()
|
||||
|
||||
if (frameFiles.length === 0) {
|
||||
throw ApplicationFailure.create({
|
||||
message: `No extracted frames found in chunk archive ${params.chunkKey}`,
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
let targetFrameCount = 14
|
||||
try {
|
||||
const firstFile = filesMap.get(frameFiles[0])
|
||||
if (firstFile) {
|
||||
const firstFileBytes = await firstFile.bytes()
|
||||
if (firstFileBytes.byteLength > 0) {
|
||||
const meta = await sharp(Buffer.from(firstFileBytes)).metadata()
|
||||
targetFrameCount = getGemmaEmbeddingTargetFrameCount(meta.width, meta.height)
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
targetFrameCount = 14
|
||||
}
|
||||
|
||||
let selectedFrames = frameFiles
|
||||
if (selectedFrames.length > targetFrameCount) {
|
||||
const step = (selectedFrames.length - 1) / (targetFrameCount - 1)
|
||||
selectedFrames = Array.from(
|
||||
{ length: targetFrameCount },
|
||||
(_, i) => selectedFrames[Math.round(i * step)],
|
||||
)
|
||||
}
|
||||
|
||||
const input: OpenAiEmbeddingItem[] = await Promise.all(
|
||||
selectedFrames.map(async (f) => {
|
||||
const file = filesMap.get(f)!
|
||||
const fileBytes = await file.bytes()
|
||||
if (fileBytes.byteLength === 0) {
|
||||
throw ApplicationFailure.create({
|
||||
message: `Extracted frame ${f} in chunk archive ${params.chunkKey} is empty (0 bytes)`,
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
return {
|
||||
type: 'image_url',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
image_url: {
|
||||
url: `data:image/jpeg;base64,${Buffer.from(fileBytes).toString('base64')}`,
|
||||
},
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
return await callGemmaEmbeddingServer(input)
|
||||
}
|
||||
|
||||
const apiKey = process.env.GEMINI_API_KEY
|
||||
if (!apiKey) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'GEMINI_API_KEY environment variable is not configured',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
const resolvedApiKey = process.env[apiKey] || apiKey
|
||||
const ai = new GoogleGenAI({ apiKey: resolvedApiKey })
|
||||
|
||||
const usage: Usage = {
|
||||
model: 'gemini-embedding-2',
|
||||
inputTokens: 0,
|
||||
outputTokens: 0,
|
||||
}
|
||||
|
||||
try {
|
||||
const { buffer: data } = await s3Service.getObject(
|
||||
process.env.S3_BUCKET || 'shumai',
|
||||
params.chunkKey,
|
||||
)
|
||||
|
||||
const embVec = await generateMultimodalEmbedding(ai, data, 'video/mp4')
|
||||
return {
|
||||
embedding: embVec,
|
||||
usage,
|
||||
}
|
||||
} catch (err) {
|
||||
throw ApplicationFailure.create({
|
||||
message: `Failed to generate video chunk embedding for key ${params.chunkKey}: ${err instanceof Error ? err.message : String(err)}`,
|
||||
nonRetryable: false,
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
export interface TranscodeVideoChunkParams {
|
||||
assetId: string
|
||||
assetKey?: string
|
||||
filePath?: string
|
||||
startTime: number
|
||||
endTime: number
|
||||
format?: 'video' | 'frames'
|
||||
}
|
||||
|
||||
export const transcodeVideoChunkActivity = defineStep(async function transcodeVideoChunkActivity(
|
||||
params: TranscodeVideoChunkParams,
|
||||
): Promise<{ chunkKey: string }> {
|
||||
if (!params.filePath && !params.assetKey) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'GEMINI_API_KEY environment variable is not configured',
|
||||
message: 'Neither filePath nor assetKey was provided for video chunk transcoding',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
const resolvedApiKey = process.env[apiKey] || apiKey
|
||||
const ai = new GoogleGenAI({ apiKey: resolvedApiKey })
|
||||
if (params.format === 'frames') {
|
||||
const tmpDir = transcodeService.createTempDir('video-chunk-frames-')
|
||||
try {
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
const inputSource =
|
||||
params.filePath ||
|
||||
(params.assetKey ? await s3Service.resolveInput(bucket, params.assetKey) : '')
|
||||
if (!inputSource) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'Neither filePath nor assetKey was provided for video chunk transcoding',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
const isRemote = inputSource.startsWith('http://') || inputSource.startsWith('https://')
|
||||
|
||||
const usage: Usage = {
|
||||
model: 'gemini-embedding-2',
|
||||
inputTokens: 0,
|
||||
outputTokens: 0,
|
||||
const duration = Math.max(0.1, params.endTime - params.startTime)
|
||||
const fpsFilter = duration > 16 ? `fps=${16 / duration}` : 'fps=1'
|
||||
const vframesArgs = duration > 16 ? ['-vframes', '16'] : []
|
||||
|
||||
await execFileAsync('ffmpeg', [
|
||||
'-y',
|
||||
'-loglevel',
|
||||
'warning',
|
||||
...(isRemote
|
||||
? ['-reconnect', '1', '-reconnect_streamed', '1', '-reconnect_delay_max', '5']
|
||||
: []),
|
||||
'-ss',
|
||||
params.startTime.toString(),
|
||||
'-i',
|
||||
inputSource,
|
||||
'-map',
|
||||
'0:V:0',
|
||||
'-t',
|
||||
duration.toString(),
|
||||
'-vf',
|
||||
fpsFilter,
|
||||
...vframesArgs,
|
||||
'-q:v',
|
||||
'2',
|
||||
path.join(tmpDir, 'frame_%04d.jpg'),
|
||||
])
|
||||
|
||||
const frameFiles = fs
|
||||
.readdirSync(tmpDir)
|
||||
.filter((f) => /\.(jpe?g|png|webp)$/i.test(f))
|
||||
.sort()
|
||||
|
||||
const archiveEntries: Record<string, Buffer> = {}
|
||||
for (const file of frameFiles) {
|
||||
archiveEntries[file] = fs.readFileSync(path.join(tmpDir, file))
|
||||
}
|
||||
|
||||
const archive = new Bun.Archive(archiveEntries)
|
||||
const archiveBytes = await archive.bytes()
|
||||
const archiveData = Buffer.from(
|
||||
archiveBytes.buffer,
|
||||
archiveBytes.byteOffset,
|
||||
archiveBytes.byteLength,
|
||||
)
|
||||
const key = `files/${params.assetId}/tmp-embedding-chunks/frames-${params.startTime}-${params.endTime}-${ulid()}.tar`
|
||||
await s3Service.putObject(bucket, key, archiveData, archiveData.length, 'application/x-tar')
|
||||
|
||||
return { chunkKey: key }
|
||||
} catch (err) {
|
||||
if (err instanceof ApplicationFailure) {
|
||||
throw err
|
||||
}
|
||||
throw ApplicationFailure.create({
|
||||
message: `Failed to extract video chunk frames for ${params.startTime}-${params.endTime}: ${err instanceof Error ? err.message : String(err)}`,
|
||||
nonRetryable: false,
|
||||
})
|
||||
} finally {
|
||||
transcodeService.removeDir(tmpDir)
|
||||
}
|
||||
}
|
||||
|
||||
const chunkTmp = path.join(os.tmpdir(), `video-chunk-${Date.now()}-${ulid()}.mp4`)
|
||||
try {
|
||||
const { buffer: data } = await s3Service.getObject(
|
||||
process.env.S3_BUCKET || 'shumai',
|
||||
params.chunkKey,
|
||||
)
|
||||
|
||||
const embVec = await generateMultimodalEmbedding(ai, data, 'video/mp4')
|
||||
return {
|
||||
embedding: embVec,
|
||||
usage,
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
const inputSource =
|
||||
params.filePath ||
|
||||
(params.assetKey ? await s3Service.resolveInput(bucket, params.assetKey) : '')
|
||||
if (!inputSource) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'Neither filePath nor assetKey was provided for video chunk transcoding',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
const isRemote = inputSource.startsWith('http://') || inputSource.startsWith('https://')
|
||||
|
||||
// Slice video segment using ffmpeg, force 1fps and remove audio for gemini-embedding-2 optimization
|
||||
// Note: -ss placed before -i for fast input seeking via demuxer Range requests
|
||||
await execFileAsync('ffmpeg', [
|
||||
'-y',
|
||||
'-loglevel',
|
||||
'warning',
|
||||
...(isRemote
|
||||
? ['-reconnect', '1', '-reconnect_streamed', '1', '-reconnect_delay_max', '5']
|
||||
: []),
|
||||
'-ss',
|
||||
params.startTime.toString(),
|
||||
'-i',
|
||||
inputSource,
|
||||
'-map',
|
||||
'0:V:0',
|
||||
'-t',
|
||||
(params.endTime - params.startTime).toString(),
|
||||
'-vf',
|
||||
'fps=1',
|
||||
'-c:v',
|
||||
'libx264',
|
||||
'-preset',
|
||||
'ultrafast',
|
||||
'-crf',
|
||||
'28',
|
||||
'-an',
|
||||
chunkTmp,
|
||||
])
|
||||
|
||||
const chunkData = fs.readFileSync(chunkTmp)
|
||||
|
||||
// Upload to S3
|
||||
const key = `files/${params.assetId}/tmp-embedding-chunks/chunk-${params.startTime}-${params.endTime}-${ulid()}.mp4`
|
||||
|
||||
await s3Service.putObject(bucket, key, chunkData, chunkData.length, 'video/mp4')
|
||||
|
||||
return { chunkKey: key }
|
||||
} catch (err) {
|
||||
if (err instanceof ApplicationFailure) {
|
||||
throw err
|
||||
}
|
||||
throw ApplicationFailure.create({
|
||||
message: `Failed to generate video chunk embedding for key ${params.chunkKey}: ${err instanceof Error ? err.message : String(err)}`,
|
||||
message: `Failed to transcode video chunk for ${params.startTime}-${params.endTime}: ${err instanceof Error ? err.message : String(err)}`,
|
||||
nonRetryable: false,
|
||||
})
|
||||
} finally {
|
||||
if (fs.existsSync(chunkTmp)) {
|
||||
try {
|
||||
fs.unlinkSync(chunkTmp)
|
||||
} catch (e) {
|
||||
console.error('Failed to cleanup local chunk file:', e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export const deleteS3ObjectActivity = defineStep(
|
||||
async function deleteS3ObjectActivity(params: { key: string }): Promise<void> {
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
await s3Service.deleteObject(bucket, params.key)
|
||||
},
|
||||
{ runOnCancel: true },
|
||||
)
|
||||
|
||||
@@ -350,5 +350,24 @@ describe('serializeContextToXml', () => {
|
||||
'<context>\n <annotation id="test<id>&"123"" />\n</context>',
|
||||
)
|
||||
})
|
||||
|
||||
it('serializes position type="degree" with integer degree attribute without seconds', () => {
|
||||
const context: ShumaiMessageContext = {
|
||||
currentAsset: {
|
||||
id: 'ast_3d',
|
||||
name: 'robot.glb',
|
||||
type: 'file',
|
||||
mediaType: '3d',
|
||||
path: 'robot.glb',
|
||||
},
|
||||
position: {
|
||||
type: 'degree',
|
||||
degree: 45,
|
||||
},
|
||||
}
|
||||
expect(serializeContextToXml(context)).toBe(
|
||||
'<context>\n <current_asset id="ast_3d" name="robot.glb" type="file" media_type="3d" path="robot.glb" />\n <position type="degree" degree="45" />\n</context>',
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -604,42 +604,35 @@ export function formatSkillsForPrompt(
|
||||
}
|
||||
|
||||
import { WorkflowTaskType } from '@shumai/db'
|
||||
import { registerActivities, registerWorkflow } from '@shumai/workflow-core'
|
||||
import * as agentActivities from './activities/agent'
|
||||
import * as aiActivities from './activities/ai'
|
||||
import { registerWorkflow } from '@shumai/workflow-core'
|
||||
import { agentAutofillMedia } from './workflows/agent-autofill'
|
||||
import { agentChat } from './workflows/agent-chat'
|
||||
import { agentEmbeddingMedia } from './workflows/agent-embedding'
|
||||
import { queryEmbeddingForSearch } from './workflows/query-embedding-for-search'
|
||||
|
||||
export function initAgentWorkflows() {
|
||||
registerWorkflow(WorkflowTaskType.ai_embedding, agentEmbeddingMedia)
|
||||
registerWorkflow(WorkflowTaskType.query_embedding_for_search, queryEmbeddingForSearch)
|
||||
registerWorkflow(WorkflowTaskType.ai_metadata_autofill, agentAutofillMedia)
|
||||
registerWorkflow(WorkflowTaskType.chat, agentChat)
|
||||
|
||||
registerActivities(agentActivities)
|
||||
registerActivities(aiActivities)
|
||||
}
|
||||
|
||||
export * from './activities/agent'
|
||||
export {
|
||||
extractAiMetadataActivity,
|
||||
generateEmbeddingActivity,
|
||||
generateImageEmbeddingActivity,
|
||||
generateTextEmbeddingActivity,
|
||||
generateVideoChunkEmbeddingActivity,
|
||||
saveAssetEmbeddingsActivity,
|
||||
deleteAssetEmbeddingsActivity,
|
||||
type ExtractAiMetadataParams,
|
||||
type GeneratedEmbedding,
|
||||
type GenerateEmbeddingParams,
|
||||
type GenerateTextEmbeddingParams,
|
||||
type ExistingAssetEmbeddingInfo,
|
||||
} from './activities/ai'
|
||||
export * from './database-session-storage'
|
||||
export * from './context/serialize-context'
|
||||
export * from './workflows/agent-autofill'
|
||||
export * from './workflows/agent-chat'
|
||||
export * from './workflows/agent-embedding'
|
||||
export * from './workflows/query-embedding-for-search'
|
||||
export * from './tools/generate-image'
|
||||
export * from './tools/generate-video'
|
||||
export * from './tools/rename-asset'
|
||||
|
||||
@@ -4,6 +4,7 @@ import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { resolveAnnotationsById } from './annotation-resolver'
|
||||
import { DatabaseSessionStorage } from '../database-session-storage'
|
||||
import type { SessionTreeEntry } from '@earendil-works/pi-agent-core'
|
||||
import { degreeToSecond } from '@shumai/core/src/utils/model3d'
|
||||
|
||||
describe('resolveAnnotationsById', () => {
|
||||
setupTestDbHooks()
|
||||
@@ -210,6 +211,89 @@ describe('resolveAnnotationsById', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('resolves annotations and degree position timestamp from 1-on-1 chat AgentSessionEntry for 3D assets', async () => {
|
||||
const user = await prisma.user.create({
|
||||
data: { name: 'User 3D', email: 'user3d@test.com', password: 'pw' },
|
||||
})
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'Team 3D' },
|
||||
})
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'Project 3D', teamId: team.id },
|
||||
})
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'robot.glb',
|
||||
type: 'file',
|
||||
projectId: project.id,
|
||||
status: 'uploaded',
|
||||
},
|
||||
})
|
||||
const agentUser = await prisma.user.create({
|
||||
data: { name: 'Agent 3D', email: 'agent3d@example.com', type: 'agent' },
|
||||
})
|
||||
const agent = await prisma.agent.create({
|
||||
data: {
|
||||
id: agentUser.id,
|
||||
teamId: team.id,
|
||||
type: 'chat',
|
||||
config: { provider: 'test-provider', model: 'test-model' },
|
||||
},
|
||||
})
|
||||
|
||||
const storage = await DatabaseSessionStorage.create({
|
||||
agentId: agent.id,
|
||||
userId: user.id,
|
||||
assetId: asset.id,
|
||||
})
|
||||
|
||||
storage.currentMessageContext = {
|
||||
currentAsset: {
|
||||
id: asset.id,
|
||||
name: asset.name,
|
||||
type: 'file',
|
||||
path: asset.name,
|
||||
},
|
||||
position: { type: 'degree', degree: 45 },
|
||||
annotation: true,
|
||||
annotations: [
|
||||
{
|
||||
type: 'rectangle',
|
||||
x: 10,
|
||||
y: 20,
|
||||
width: 30,
|
||||
height: 40,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const userEntry: SessionTreeEntry = {
|
||||
type: 'message',
|
||||
id: '01JTEST3DENTRY123456789',
|
||||
parentId: null,
|
||||
timestamp: new Date().toISOString(),
|
||||
message: {
|
||||
role: 'user',
|
||||
content: 'Check markup at 45 degrees',
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
}
|
||||
|
||||
await storage.appendEntry(userEntry)
|
||||
|
||||
const result = await resolveAnnotationsById(asset.id, '01JTEST3DENTRY123456789')
|
||||
expect(result.timestamp).toBeCloseTo(degreeToSecond(45))
|
||||
expect(result.annotations).toEqual([
|
||||
{
|
||||
type: 'rectangle',
|
||||
x: 10,
|
||||
y: 20,
|
||||
width: 30,
|
||||
height: 40,
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
it('throws an error when AgentSessionEntry belongs to a different asset', async () => {
|
||||
const user = await prisma.user.create({
|
||||
data: { name: 'User', email: 'user3@test.com', password: 'pw' },
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import type { ShumaiMessageContext } from '@shumai/dtos'
|
||||
import { degreeToSecond } from '@shumai/core/src/utils/model3d'
|
||||
|
||||
export async function resolveAnnotationsById(
|
||||
assetId: string,
|
||||
@@ -44,7 +45,14 @@ export async function resolveAnnotationsById(
|
||||
const list = details?.annotations
|
||||
const annotations =
|
||||
Array.isArray(list) && list.length > 0 ? (list as unknown as PrismaJson.AnnotationList) : null
|
||||
const timestamp = details?.position?.type === 'time' ? details.position.seconds : null
|
||||
let timestamp: number | null = null
|
||||
if (details?.position?.type === 'time') {
|
||||
timestamp = details.position.seconds
|
||||
} else if (details?.position?.type === 'degree') {
|
||||
timestamp = degreeToSecond(details.position.degree)
|
||||
} else if (details?.position?.type === 'page') {
|
||||
timestamp = details.position.page
|
||||
}
|
||||
return { annotations, timestamp }
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { workflowService } from '@shumai/workflow-core'
|
||||
import { authzService } from '@shumai/core/src/authz/authz'
|
||||
import * as annotationResolver from './annotation-resolver'
|
||||
import { degreeToSecond } from '@shumai/core/src/utils/model3d'
|
||||
|
||||
vi.mock('@shumai/db', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('@shumai/db')>()
|
||||
@@ -211,6 +212,476 @@ describe('readAssetTool', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('3D Assets', () => {
|
||||
it('should read 3D asset 4-views image and return image with quadrant layout description', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue()
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'model-1',
|
||||
name: 'robot.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
storageKey: { key: 'raw/robot.glb' },
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
imageTranscodes: [{ key: 'proxy/views.webp' }],
|
||||
},
|
||||
} as unknown as Asset)
|
||||
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from('fake-views-bytes'),
|
||||
contentType: 'image/webp',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
const tool = createReadAssetTool('user-1')
|
||||
const result = await tool.execute('call-3d', {
|
||||
assetId: 'model-1',
|
||||
annotationId: null,
|
||||
imageConfig: null,
|
||||
videoConfig: null,
|
||||
docConfig: null,
|
||||
})
|
||||
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: { id: 'user-1' },
|
||||
permission: 'Read',
|
||||
type: 'asset',
|
||||
id: 'model-1',
|
||||
})
|
||||
expect(s3Service.getObject).toHaveBeenCalledWith('shumai', 'proxy/views.webp')
|
||||
|
||||
const textItem = result.content[0] as { type: 'text'; text: string }
|
||||
const imageItem = result.content[1] as { type: 'image'; data: string; mimeType: string }
|
||||
|
||||
expect(textItem.text).toContain('Orthogonal 4-view composite image')
|
||||
expect(textItem.text).toContain('Top-Left quadrant: Front view (0°)')
|
||||
expect(textItem.text).toContain('Top-Right quadrant: Right side view (90°)')
|
||||
expect(textItem.text).toContain('Bottom-Left quadrant: Back view (180°)')
|
||||
expect(textItem.text).toContain('Bottom-Right quadrant: Left side view (270°)')
|
||||
expect(imageItem.type).toBe('image')
|
||||
expect(imageItem.data).toBe(Buffer.from('fake-views-bytes').toString('base64'))
|
||||
expect(result.details.key).toBe('proxy/views.webp')
|
||||
})
|
||||
|
||||
it('should support s3KeyOnly mode for 3D assets', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue()
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'model-1',
|
||||
name: 'robot.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
imageTranscodes: [{ key: 'proxy/views.webp' }],
|
||||
},
|
||||
} as unknown as Asset)
|
||||
|
||||
const tool = createReadAssetTool('user-1')
|
||||
const result = await tool.execute('call-3d-s3', {
|
||||
assetId: 'model-1',
|
||||
annotationId: null,
|
||||
s3KeyOnly: true,
|
||||
imageConfig: null,
|
||||
videoConfig: null,
|
||||
docConfig: null,
|
||||
})
|
||||
|
||||
expect(result.content).toHaveLength(1)
|
||||
const textItem = result.content[0] as { type: 'text'; text: string }
|
||||
expect(textItem.text).toContain('proxy/views.webp')
|
||||
expect(textItem.text).toContain('Front view (0°)')
|
||||
expect(result.details.key).toBe('proxy/views.webp')
|
||||
})
|
||||
|
||||
it('should throw error if videoConfig is passed for 3D assets', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue()
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'model-1',
|
||||
name: 'robot.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
imageTranscodes: [{ key: 'proxy/views.webp' }],
|
||||
},
|
||||
} as unknown as Asset)
|
||||
|
||||
const tool = createReadAssetTool('user-1')
|
||||
await expect(
|
||||
tool.execute('call-3d-err', {
|
||||
assetId: 'model-1',
|
||||
annotationId: null,
|
||||
imageConfig: null,
|
||||
videoConfig: { start: 0, end: 4, count: 4 },
|
||||
docConfig: null,
|
||||
}),
|
||||
).rejects.toThrow(
|
||||
"To inspect specific angles pass 'config3d: { degree: ... }'; do not pass videoConfig",
|
||||
)
|
||||
})
|
||||
|
||||
it('should throw error if 3D asset imageTranscodes is missing when overview is requested', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue()
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'model-1',
|
||||
name: 'robot.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
imageTranscodes: [],
|
||||
},
|
||||
} as unknown as Asset)
|
||||
|
||||
const tool = createReadAssetTool('user-1')
|
||||
await expect(
|
||||
tool.execute('call-3d-err2', {
|
||||
assetId: 'model-1',
|
||||
annotationId: null,
|
||||
imageConfig: null,
|
||||
videoConfig: null,
|
||||
docConfig: null,
|
||||
}),
|
||||
).rejects.toThrow('4-views image (views.webp) is missing')
|
||||
})
|
||||
|
||||
it('should extract specific turntable frame when config3d.degree is provided', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue()
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'model-1',
|
||||
name: 'robot.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
projectId: 'proj-1',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
videoTranscodes: [{ key: 'proxy/turntable.mp4' }],
|
||||
imageTranscodes: [{ key: 'proxy/views.webp' }],
|
||||
},
|
||||
} as unknown as Asset)
|
||||
|
||||
vi.mocked(prisma.workflowTask.create).mockResolvedValue({
|
||||
id: 'task-shot-3d',
|
||||
} as unknown as WorkflowTask)
|
||||
|
||||
vi.mocked(workflowService.executeWait).mockResolvedValue({
|
||||
id: 'task-shot-3d',
|
||||
status: WorkflowTaskStatus.completed,
|
||||
output: {
|
||||
screenshots: [{ key: 'proxy/shot-45.webp', timestamp: 0.5833 }],
|
||||
},
|
||||
} as unknown as WorkflowTask)
|
||||
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from('fake-shot-45-bytes'),
|
||||
contentType: 'image/webp',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
const tool = createReadAssetTool('user-1')
|
||||
const result = await tool.execute('call-3d-degree', {
|
||||
assetId: 'model-1',
|
||||
annotationId: null,
|
||||
config3d: { degree: 45 },
|
||||
imageConfig: null,
|
||||
videoConfig: null,
|
||||
docConfig: null,
|
||||
})
|
||||
|
||||
expect(prisma.workflowTask.create).toHaveBeenCalledWith({
|
||||
data: expect.objectContaining({
|
||||
type: WorkflowTaskType.transcode_screenshot,
|
||||
assetId: 'model-1',
|
||||
payload: {
|
||||
projectId: 'proj-1',
|
||||
screenshot: {
|
||||
start: expect.any(Number),
|
||||
end: expect.any(Number),
|
||||
count: 1,
|
||||
commentTimestamp: expect.any(Number),
|
||||
annotations: undefined,
|
||||
},
|
||||
},
|
||||
}),
|
||||
})
|
||||
|
||||
const textItem = result.content[0] as { type: 'text'; text: string }
|
||||
const imageItem = result.content[1] as { type: 'image'; data: string; mimeType: string }
|
||||
|
||||
expect(textItem.text).toContain('view at 45°:')
|
||||
expect(imageItem.data).toBe(Buffer.from('fake-shot-45-bytes').toString('base64'))
|
||||
expect(result.details.key).toBe('proxy/shot-45.webp')
|
||||
})
|
||||
|
||||
it('should throw error when config3d.degree is not a multiple of 15 or out of range', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue()
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'model-1',
|
||||
name: 'robot.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
videoTranscodes: [{ key: 'proxy/turntable.mp4' }],
|
||||
},
|
||||
} as unknown as Asset)
|
||||
|
||||
const tool = createReadAssetTool('user-1')
|
||||
|
||||
await expect(
|
||||
tool.execute('call-3d-invalid-deg', {
|
||||
assetId: 'model-1',
|
||||
annotationId: null,
|
||||
config3d: { degree: 40 },
|
||||
imageConfig: null,
|
||||
videoConfig: null,
|
||||
docConfig: null,
|
||||
}),
|
||||
).rejects.toThrow('Invalid turntable degree: 40')
|
||||
|
||||
await expect(
|
||||
tool.execute('call-3d-out-of-range', {
|
||||
assetId: 'model-1',
|
||||
annotationId: null,
|
||||
config3d: { degree: 360 },
|
||||
imageConfig: null,
|
||||
videoConfig: null,
|
||||
docConfig: null,
|
||||
}),
|
||||
).rejects.toThrow('Invalid turntable degree: 360')
|
||||
})
|
||||
|
||||
it('should extract frame with overlaid markups when annotationId is provided on 3D asset', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue()
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'model-1',
|
||||
name: 'robot.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
projectId: 'proj-1',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
videoTranscodes: [{ key: 'proxy/turntable.mp4' }],
|
||||
},
|
||||
} as unknown as Asset)
|
||||
|
||||
vi.spyOn(annotationResolver, 'resolveAnnotationsById').mockResolvedValue({
|
||||
annotations: [
|
||||
{
|
||||
type: 'freehand',
|
||||
color: '#ff0000',
|
||||
points: [
|
||||
[0, 0],
|
||||
[10, 10],
|
||||
],
|
||||
},
|
||||
],
|
||||
timestamp: 0.5, // 0.5s = 45°
|
||||
})
|
||||
|
||||
vi.mocked(prisma.workflowTask.create).mockResolvedValue({
|
||||
id: 'task-shot-ann',
|
||||
} as unknown as WorkflowTask)
|
||||
|
||||
vi.mocked(workflowService.executeWait).mockResolvedValue({
|
||||
id: 'task-shot-ann',
|
||||
status: WorkflowTaskStatus.completed,
|
||||
output: {
|
||||
screenshots: [{ key: 'proxy/shot-annotated.webp', timestamp: 0.5 }],
|
||||
},
|
||||
} as unknown as WorkflowTask)
|
||||
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from('fake-shot-ann-bytes'),
|
||||
contentType: 'image/webp',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
const tool = createReadAssetTool('user-1')
|
||||
const result = await tool.execute('call-3d-ann', {
|
||||
assetId: 'model-1',
|
||||
annotationId: 'comm-1',
|
||||
config3d: null,
|
||||
imageConfig: null,
|
||||
videoConfig: null,
|
||||
docConfig: null,
|
||||
})
|
||||
|
||||
expect(prisma.workflowTask.create).toHaveBeenCalledWith({
|
||||
data: expect.objectContaining({
|
||||
type: WorkflowTaskType.transcode_screenshot,
|
||||
assetId: 'model-1',
|
||||
payload: {
|
||||
projectId: 'proj-1',
|
||||
screenshot: {
|
||||
start: 0.5,
|
||||
end: 0.5,
|
||||
count: 1,
|
||||
commentTimestamp: 0.5,
|
||||
annotations: [
|
||||
{
|
||||
type: 'freehand',
|
||||
color: '#ff0000',
|
||||
points: [
|
||||
[0, 0],
|
||||
[10, 10],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}),
|
||||
})
|
||||
|
||||
const textItem = result.content[0] as { type: 'text'; text: string }
|
||||
expect(textItem.text).toContain('view at 45° with visual markups overlaid:')
|
||||
expect(result.details.key).toBe('proxy/shot-annotated.webp')
|
||||
})
|
||||
|
||||
it('should extract turntable frame at resolved degree angle for 3D session annotations', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue()
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'model-1',
|
||||
name: 'robot.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
projectId: 'proj-1',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
videoTranscodes: [{ key: 'proxy/turntable.mp4' }],
|
||||
},
|
||||
} as unknown as Asset)
|
||||
|
||||
const expectedTime = degreeToSecond(90)
|
||||
vi.spyOn(annotationResolver, 'resolveAnnotationsById').mockResolvedValue({
|
||||
annotations: [
|
||||
{
|
||||
type: 'box',
|
||||
color: '#00ff00',
|
||||
points: [
|
||||
[10, 20],
|
||||
[40, 60],
|
||||
],
|
||||
},
|
||||
],
|
||||
timestamp: expectedTime,
|
||||
})
|
||||
|
||||
vi.mocked(prisma.workflowTask.create).mockResolvedValue({
|
||||
id: 'task-shot-3d-session',
|
||||
} as unknown as WorkflowTask)
|
||||
|
||||
vi.mocked(workflowService.executeWait).mockResolvedValue({
|
||||
id: 'task-shot-3d-session',
|
||||
status: WorkflowTaskStatus.completed,
|
||||
output: {
|
||||
screenshots: [{ key: 'proxy/shot-annotated-90.webp', timestamp: expectedTime }],
|
||||
},
|
||||
} as unknown as WorkflowTask)
|
||||
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from('fake-shot-90-bytes'),
|
||||
contentType: 'image/webp',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
const tool = createReadAssetTool('user-1')
|
||||
const result = await tool.execute('call-3d-session-ann', {
|
||||
assetId: 'model-1',
|
||||
annotationId: 'session-entry-1',
|
||||
config3d: null,
|
||||
imageConfig: null,
|
||||
videoConfig: null,
|
||||
docConfig: null,
|
||||
})
|
||||
|
||||
expect(prisma.workflowTask.create).toHaveBeenCalledWith({
|
||||
data: expect.objectContaining({
|
||||
type: WorkflowTaskType.transcode_screenshot,
|
||||
assetId: 'model-1',
|
||||
payload: {
|
||||
projectId: 'proj-1',
|
||||
screenshot: {
|
||||
start: expectedTime,
|
||||
end: expectedTime,
|
||||
count: 1,
|
||||
commentTimestamp: expectedTime,
|
||||
annotations: [
|
||||
{
|
||||
type: 'box',
|
||||
color: '#00ff00',
|
||||
points: [
|
||||
[10, 20],
|
||||
[40, 60],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}),
|
||||
})
|
||||
|
||||
const textItem = result.content[0] as { type: 'text'; text: string }
|
||||
expect(textItem.text).toContain('view at 90° with visual markups overlaid:')
|
||||
expect(result.details.key).toBe('proxy/shot-annotated-90.webp')
|
||||
})
|
||||
|
||||
it('should throw error if config3d.degree conflicts with annotation angle', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue()
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'model-1',
|
||||
name: 'robot.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
projectId: 'proj-1',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
videoTranscodes: [{ key: 'proxy/turntable.mp4' }],
|
||||
},
|
||||
} as unknown as Asset)
|
||||
|
||||
vi.spyOn(annotationResolver, 'resolveAnnotationsById').mockResolvedValue({
|
||||
annotations: [
|
||||
{
|
||||
type: 'box',
|
||||
color: '#ff0000',
|
||||
points: [
|
||||
[0, 0],
|
||||
[10, 10],
|
||||
],
|
||||
},
|
||||
],
|
||||
timestamp: 0.5, // 45°
|
||||
})
|
||||
|
||||
const tool = createReadAssetTool('user-1')
|
||||
await expect(
|
||||
tool.execute('call-3d-conflict', {
|
||||
assetId: 'model-1',
|
||||
annotationId: 'comm-1',
|
||||
config3d: { degree: 90 }, // Conflicts with 45°
|
||||
imageConfig: null,
|
||||
videoConfig: null,
|
||||
docConfig: null,
|
||||
}),
|
||||
).rejects.toThrow(
|
||||
'Annotation "comm-1" was drawn at 45°, but degree 90° was specified. Do not pass a conflicting degree with annotationId.',
|
||||
)
|
||||
})
|
||||
|
||||
it('should throw error if 3D asset turntable video is missing when angle inspection is requested', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue()
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'model-1',
|
||||
name: 'robot.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
videoTranscodes: [],
|
||||
},
|
||||
} as unknown as Asset)
|
||||
|
||||
const tool = createReadAssetTool('user-1')
|
||||
await expect(
|
||||
tool.execute('call-3d-missing-turntable', {
|
||||
assetId: 'model-1',
|
||||
annotationId: null,
|
||||
config3d: { degree: 45 },
|
||||
imageConfig: null,
|
||||
videoConfig: null,
|
||||
docConfig: null,
|
||||
}),
|
||||
).rejects.toThrow('turntable video (turntable.mp4) is missing')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Video Assets', () => {
|
||||
it('should throw error if videoConfig is missing for video assets', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue()
|
||||
|
||||
@@ -7,6 +7,12 @@ import { workflowService } from '@shumai/workflow-core'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { resolveAnnotationsById } from './annotation-resolver'
|
||||
import { getFileMimeType } from '@shumai/core/src/utils/file-mime'
|
||||
import { is3dModel } from '@shumai/core/src/utils/mime'
|
||||
import {
|
||||
isValidTurntableDegree,
|
||||
secondToDegree,
|
||||
degreeToSecond,
|
||||
} from '@shumai/core/src/utils/model3d'
|
||||
|
||||
export const readAssetSchema = Type.Object(
|
||||
{
|
||||
@@ -37,6 +43,31 @@ export const readAssetSchema = Type.Object(
|
||||
),
|
||||
Type.Null(),
|
||||
]),
|
||||
config3d: Type.Optional(
|
||||
Type.Union([
|
||||
Type.Object(
|
||||
{
|
||||
degree: Type.Optional(
|
||||
Type.Union([
|
||||
Type.Integer({
|
||||
minimum: 0,
|
||||
maximum: 345,
|
||||
description:
|
||||
'Turntable rotation degree (integer: 0, 15, 30, ..., 345 in 15° increments) to inspect a specific angle of a 3D model. Leave null/omitted to view the 4-view composite overview.',
|
||||
}),
|
||||
Type.Null(),
|
||||
]),
|
||||
),
|
||||
},
|
||||
{
|
||||
additionalProperties: false,
|
||||
description:
|
||||
'Configuration for 3D model assets. Pass null if inspecting another asset type. Optionally pass degree to inspect a specific turntable angle, or leave null/omitted to view the 4-view composite overview.',
|
||||
},
|
||||
),
|
||||
Type.Null(),
|
||||
]),
|
||||
),
|
||||
videoConfig: Type.Union([
|
||||
Type.Object(
|
||||
{
|
||||
@@ -167,12 +198,12 @@ export function createReadAssetTool(
|
||||
label: 'Read Asset',
|
||||
description:
|
||||
'Inspects and reads the content of an asset in the workspace. ' +
|
||||
'Supports visual analysis for images, video frame extraction, PDF page rendering, and direct text reading for text/markdown files. ' +
|
||||
'Pass assetId, and provide the specific config (imageConfig, videoConfig, or docConfig) while setting unused configs to null. ' +
|
||||
'Supports visual analysis for images, 3D models (overview or specific degree angle), video frame extraction, PDF page rendering, and direct text reading for text/markdown files. ' +
|
||||
'Pass assetId, and provide the specific config (imageConfig, config3d, videoConfig, or docConfig) while setting unused configs to null. ' +
|
||||
'Optionally provide annotationId to view visual markups drawn on the asset.',
|
||||
parameters: readAssetSchema,
|
||||
execute: async (_toolCallId, params) => {
|
||||
const { assetId, annotationId, s3KeyOnly, videoConfig, docConfig } = params
|
||||
const { assetId, annotationId, s3KeyOnly, config3d, videoConfig, docConfig } = params
|
||||
|
||||
if (agentType === 'autofill' && !userId) {
|
||||
if (!targetAssetId) {
|
||||
@@ -243,6 +274,209 @@ export function createReadAssetTool(
|
||||
const filename = asset.name?.toLowerCase() || ''
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Branch 0: 3D Assets (Orthogonal 4-View Composite Image or Degree Angle)
|
||||
// ----------------------------------------------------------------------
|
||||
const is3d = proxyType === '3d' || is3dModel(mediaType, filename)
|
||||
if (is3d) {
|
||||
if (videoConfig) {
|
||||
throw new Error(
|
||||
`Asset ${asset.id} is a 3D model. To inspect specific angles pass 'config3d: { degree: ... }'; do not pass videoConfig.`,
|
||||
)
|
||||
}
|
||||
|
||||
if (config3d?.degree !== undefined && config3d?.degree !== null) {
|
||||
if (!isValidTurntableDegree(config3d.degree)) {
|
||||
throw new Error(
|
||||
`Invalid turntable degree: ${config3d.degree}. Degree must be an integer multiple of 15 between 0 and 345 (e.g. 0, 15, 30, 45, ..., 345).`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
let annotations: PrismaJson.AnnotationList | null = null
|
||||
let commentTimestamp: number | null = null
|
||||
if (annotationId) {
|
||||
const resolved = await resolveAnnotationsById(asset.id, annotationId)
|
||||
annotations = resolved.annotations
|
||||
commentTimestamp = resolved.timestamp
|
||||
if (commentTimestamp !== null && commentTimestamp !== undefined) {
|
||||
const commentDegree = secondToDegree(commentTimestamp)
|
||||
if (
|
||||
config3d?.degree !== undefined &&
|
||||
config3d?.degree !== null &&
|
||||
config3d.degree !== commentDegree
|
||||
) {
|
||||
throw new Error(
|
||||
`Annotation "${annotationId}" was drawn at ${commentDegree}°, but degree ${config3d.degree}° was specified. Do not pass a conflicting degree with annotationId.`,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((config3d?.degree !== undefined && config3d?.degree !== null) || annotationId) {
|
||||
if (!mediaInfo?.videoTranscodes || mediaInfo.videoTranscodes.length === 0) {
|
||||
throw new Error(
|
||||
`Asset ${asset.id} is a 3D model, but its turntable video (turntable.mp4) is missing.`,
|
||||
)
|
||||
}
|
||||
|
||||
let targetDegree: number
|
||||
let targetSecond: number
|
||||
|
||||
if (config3d?.degree !== undefined && config3d?.degree !== null) {
|
||||
targetDegree = config3d.degree
|
||||
targetSecond = degreeToSecond(targetDegree)
|
||||
} else {
|
||||
targetSecond =
|
||||
commentTimestamp !== null && commentTimestamp !== undefined ? commentTimestamp : 0
|
||||
targetDegree = secondToDegree(targetSecond)
|
||||
}
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
assetId: asset.id,
|
||||
projectId: asset.projectId || 'none',
|
||||
type: WorkflowTaskType.transcode_screenshot,
|
||||
status: WorkflowTaskStatus.pending,
|
||||
payload: {
|
||||
projectId: asset.projectId || 'none',
|
||||
screenshot: {
|
||||
start: targetSecond,
|
||||
end: targetSecond,
|
||||
count: 1,
|
||||
commentTimestamp: targetSecond,
|
||||
annotations: annotations ?? undefined,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const completedTask = await workflowService.executeWait(task)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- transcode screenshot output
|
||||
const output = completedTask.output as any
|
||||
const screenshots = output?.screenshots as
|
||||
| Array<{ key: string; timestamp: number }>
|
||||
| undefined
|
||||
|
||||
if (!screenshots || screenshots.length === 0) {
|
||||
throw new Error(
|
||||
`Failed to extract 3D turntable frame for asset ${asset.id} at ${targetDegree}°.`,
|
||||
)
|
||||
}
|
||||
|
||||
const shotKey = screenshots[0].key
|
||||
const downloadUrl = await s3Service.presign(
|
||||
bucket,
|
||||
shotKey,
|
||||
'GET',
|
||||
true,
|
||||
asset.name || undefined,
|
||||
)
|
||||
|
||||
const content: Array<TextContent | ImageContent> = []
|
||||
const hasMarkup = Boolean(annotations && annotations.length > 0)
|
||||
const textDescription = hasMarkup
|
||||
? `3D asset "${asset.name}" (ID: ${asset.id}, S3 Key: "${shotKey}") view at ${targetDegree}° with visual markups overlaid:`
|
||||
: `3D asset "${asset.name}" (ID: ${asset.id}, S3 Key: "${shotKey}") view at ${targetDegree}°:`
|
||||
|
||||
if (s3KeyOnly) {
|
||||
content.push({
|
||||
type: 'text',
|
||||
text: textDescription,
|
||||
})
|
||||
} else {
|
||||
const { buffer, contentType } = await s3Service.getObject(bucket, shotKey)
|
||||
const actualMimeType =
|
||||
contentType && contentType !== 'application/octet-stream' ? contentType : 'image/webp'
|
||||
content.push({
|
||||
type: 'text',
|
||||
text: textDescription,
|
||||
})
|
||||
content.push({
|
||||
type: 'image',
|
||||
data: buffer.toString('base64'),
|
||||
mimeType: actualMimeType,
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
content,
|
||||
details: {
|
||||
assetId: asset.id,
|
||||
name: asset.name,
|
||||
mediaType: asset.mediaType,
|
||||
key: shotKey,
|
||||
downloadUrl,
|
||||
sourceKeys: [shotKey],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if (!mediaInfo?.imageTranscodes || mediaInfo.imageTranscodes.length === 0) {
|
||||
throw new Error(
|
||||
`Asset ${asset.id} is a 3D model, but its 4-views image (views.webp) is missing.`,
|
||||
)
|
||||
}
|
||||
|
||||
const mediaKey = mediaInfo.imageTranscodes[0].key
|
||||
if (!mediaKey) {
|
||||
throw new Error(`Asset ${asset.id} is a 3D model, but its 4-views image key is missing.`)
|
||||
}
|
||||
|
||||
const keyToUse = mediaKey
|
||||
const mimeType = 'image/webp'
|
||||
|
||||
const downloadUrl = await s3Service.presign(
|
||||
bucket,
|
||||
keyToUse,
|
||||
'GET',
|
||||
true,
|
||||
asset.name || undefined,
|
||||
)
|
||||
|
||||
const content: Array<TextContent | ImageContent> = []
|
||||
const textDescription = [
|
||||
`3D asset "${asset.name}" (ID: ${asset.id}, MIME: ${mimeType}, S3 Key: "${keyToUse}"):`,
|
||||
'Orthogonal 4-view composite image (2x2 grid across 360° rotation):',
|
||||
'- Top-Left quadrant: Front view (0°)',
|
||||
'- Top-Right quadrant: Right side view (90°)',
|
||||
'- Bottom-Left quadrant: Back view (180°)',
|
||||
'- Bottom-Right quadrant: Left side view (270°)',
|
||||
].join('\n')
|
||||
|
||||
if (s3KeyOnly) {
|
||||
content.push({
|
||||
type: 'text',
|
||||
text: textDescription,
|
||||
})
|
||||
} else {
|
||||
const { buffer, contentType } = await s3Service.getObject(bucket, keyToUse)
|
||||
const actualMimeType =
|
||||
contentType && contentType !== 'application/octet-stream' ? contentType : mimeType
|
||||
content.push({
|
||||
type: 'text',
|
||||
text: textDescription,
|
||||
})
|
||||
content.push({
|
||||
type: 'image',
|
||||
data: buffer.toString('base64'),
|
||||
mimeType: actualMimeType,
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
content,
|
||||
details: {
|
||||
assetId: asset.id,
|
||||
name: asset.name,
|
||||
mediaType: asset.mediaType,
|
||||
key: keyToUse,
|
||||
downloadUrl,
|
||||
sourceKeys: [keyToUse],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Branch 1: Image Assets
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -129,6 +129,42 @@ describe('createReadThreadTool', () => {
|
||||
expect(textContent).toContain('- [Ai Agent] (id: reply-1, has_markup: false): Agent answer')
|
||||
})
|
||||
|
||||
it('should format 3d asset comment timestamps as degree: X°', async () => {
|
||||
vi.mocked(prisma.assetComment.findUnique).mockResolvedValue({
|
||||
id: 'root-3d',
|
||||
message: 'Notice this angle',
|
||||
creator: { name: 'Alice' },
|
||||
second: 0.5,
|
||||
annotation: [{ type: 'box' }],
|
||||
asset: {
|
||||
media: { proxyType: '3d' },
|
||||
mediaType: 'model/gltf-binary',
|
||||
name: 'robot.glb',
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
vi.mocked(prisma.assetComment.findMany).mockResolvedValue([
|
||||
{
|
||||
id: 'reply-3d-1',
|
||||
message: 'Looking at back side',
|
||||
creator: { name: 'Bob' },
|
||||
second: 2.0,
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
] as any)
|
||||
|
||||
const tool = createReadThreadTool()
|
||||
const result = await tool.execute('call-3d', { threadId: 'root-3d' })
|
||||
const textContent = (result.content[0] as { text: string }).text
|
||||
|
||||
expect(textContent).toContain(
|
||||
'Thread Root [Alice] (id: root-3d, degree: 45°, has_markup: true): Notice this angle',
|
||||
)
|
||||
expect(textContent).toContain(
|
||||
'- [Bob] (id: reply-3d-1, degree: 180°, has_markup: false): Looking at back side',
|
||||
)
|
||||
})
|
||||
|
||||
it('should describe threadId parameter as referencing <thread id="..." /> in <context>', () => {
|
||||
const tool = createReadThreadTool()
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import { Type } from 'typebox'
|
||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||
import { secondToDegree } from '@shumai/core/src/utils/model3d'
|
||||
import { getProxyType } from '@shumai/core/src/utils/mime'
|
||||
|
||||
const readThreadSchema = Type.Object({
|
||||
threadId: Type.String({
|
||||
@@ -9,14 +11,21 @@ const readThreadSchema = Type.Object({
|
||||
}),
|
||||
})
|
||||
|
||||
function formatCommentMeta(c: {
|
||||
id: string
|
||||
second?: number | null
|
||||
annotation?: unknown
|
||||
}): string {
|
||||
function formatCommentMeta(
|
||||
c: {
|
||||
id: string
|
||||
second?: number | null
|
||||
annotation?: unknown
|
||||
},
|
||||
proxyType?: string,
|
||||
): string {
|
||||
const parts = [`id: ${c.id}`]
|
||||
if (c.second !== null && c.second !== undefined) {
|
||||
parts.push(`time: ${c.second}s`)
|
||||
if (proxyType === '3d') {
|
||||
parts.push(`degree: ${secondToDegree(c.second)}°`)
|
||||
} else {
|
||||
parts.push(`time: ${c.second}s`)
|
||||
}
|
||||
}
|
||||
const hasMarkup = Boolean(c.annotation && Array.isArray(c.annotation) && c.annotation.length > 0)
|
||||
parts.push(`has_markup: ${hasMarkup}`)
|
||||
@@ -34,7 +43,10 @@ export const createReadThreadTool = (): AgentTool<
|
||||
execute: async (_toolCallId, params) => {
|
||||
const rootComment = await prisma.assetComment.findUnique({
|
||||
where: { id: params.threadId },
|
||||
include: { creator: true },
|
||||
include: {
|
||||
creator: true,
|
||||
asset: { select: { media: true, mediaType: true, name: true } },
|
||||
},
|
||||
})
|
||||
|
||||
if (!rootComment) {
|
||||
@@ -61,9 +73,14 @@ export const createReadThreadTool = (): AgentTool<
|
||||
include: { creator: true },
|
||||
})
|
||||
|
||||
const proxyType =
|
||||
(rootComment.asset?.media as PrismaJson.MediaInfo | null)?.proxyType ||
|
||||
getProxyType(rootComment.asset?.mediaType, rootComment.asset?.name) ||
|
||||
undefined
|
||||
|
||||
const isRootAgent = rootComment.creator?.type === 'agent' || rootComment.sessionId !== null
|
||||
const rootAuthor = rootComment.creator?.name || (isRootAgent ? 'Ai Agent' : 'User')
|
||||
const rootMeta = formatCommentMeta(rootComment)
|
||||
const rootMeta = formatCommentMeta(rootComment, proxyType)
|
||||
let output = `Thread Root [${rootAuthor}] ${rootMeta}: ${rootComment.message || ''}\n\nReplies (${replies.length}):`
|
||||
|
||||
if (replies.length === 0) {
|
||||
@@ -72,7 +89,7 @@ export const createReadThreadTool = (): AgentTool<
|
||||
for (const reply of replies) {
|
||||
const isAgent = reply.creator?.type === 'agent' || reply.sessionId !== null
|
||||
const author = reply.creator?.name || (isAgent ? 'Ai Agent' : 'User')
|
||||
const replyMeta = formatCommentMeta(reply)
|
||||
const replyMeta = formatCommentMeta(reply, proxyType)
|
||||
output += `\n- [${author}] ${replyMeta}: ${reply.message || ''}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,29 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { agentAutofillMedia } from './agent-autofill'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import * as workflowUtils from '@shumai/workflow-core'
|
||||
import * as workflowCore from '@shumai/workflow-core'
|
||||
import * as agentActivities from '../activities/agent'
|
||||
|
||||
vi.mock('@shumai/workflow-core', async () => {
|
||||
const actual = await vi.importActual('@shumai/workflow-core')
|
||||
return {
|
||||
...actual,
|
||||
getActivities: vi.fn(),
|
||||
executeActivity: vi.fn(),
|
||||
updateTaskStatusActivity: vi.fn(),
|
||||
updateTaskUsageActivity: vi.fn(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../activities/agent', async () => {
|
||||
const actual = await vi.importActual('../activities/agent')
|
||||
return {
|
||||
...actual,
|
||||
getAssetActivity: vi.fn(),
|
||||
getProjectAutofillFieldsActivity: vi.fn(),
|
||||
getAgentAutofillContextActivity: vi.fn(),
|
||||
autofillAiActivity: vi.fn(),
|
||||
updateAssetMetadataActivity: vi.fn(),
|
||||
createCommentActivity: vi.fn(),
|
||||
updateCommentActivity: vi.fn(),
|
||||
}
|
||||
})
|
||||
|
||||
@@ -23,32 +38,17 @@ describe('Agent Autofill Workflow', () => {
|
||||
vi.clearAllMocks()
|
||||
|
||||
mockActivities = {
|
||||
updateTaskStatusActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'updateTaskStatusActivity',
|
||||
}),
|
||||
getAssetActivity: Object.assign(vi.fn(), { _activityName: 'getAssetActivity' }),
|
||||
getProjectAutofillFieldsActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getProjectAutofillFieldsActivity',
|
||||
}),
|
||||
getAgentAutofillContextActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getAgentAutofillContextActivity',
|
||||
}),
|
||||
getAssetAutofillContextActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getAssetAutofillContextActivity',
|
||||
}),
|
||||
autofillAiActivity: Object.assign(vi.fn(), { _activityName: 'autofillAiActivity' }),
|
||||
updateTaskUsageActivity: Object.assign(vi.fn(), { _activityName: 'updateTaskUsageActivity' }),
|
||||
updateAssetMetadataActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'updateAssetMetadataActivity',
|
||||
}),
|
||||
createCommentActivity: Object.assign(vi.fn(), { _activityName: 'createCommentActivity' }),
|
||||
updateCommentActivity: Object.assign(vi.fn(), { _activityName: 'updateCommentActivity' }),
|
||||
getAgentWorkerQueueActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getAgentWorkerQueueActivity',
|
||||
}),
|
||||
updateTaskStatusActivity: vi.mocked(workflowCore.updateTaskStatusActivity),
|
||||
getAssetActivity: vi.mocked(agentActivities.getAssetActivity),
|
||||
getProjectAutofillFieldsActivity: vi.mocked(agentActivities.getProjectAutofillFieldsActivity),
|
||||
getAgentAutofillContextActivity: vi.mocked(agentActivities.getAgentAutofillContextActivity),
|
||||
autofillAiActivity: vi.mocked(agentActivities.autofillAiActivity),
|
||||
updateTaskUsageActivity: vi.mocked(workflowCore.updateTaskUsageActivity),
|
||||
updateAssetMetadataActivity: vi.mocked(agentActivities.updateAssetMetadataActivity),
|
||||
createCommentActivity: vi.mocked(agentActivities.createCommentActivity),
|
||||
updateCommentActivity: vi.mocked(agentActivities.updateCommentActivity),
|
||||
}
|
||||
|
||||
mockActivities.getAgentWorkerQueueActivity.mockResolvedValue('agent_queue')
|
||||
mockActivities.updateTaskStatusActivity.mockResolvedValue({})
|
||||
mockActivities.createCommentActivity.mockResolvedValue({ id: 'comment-placeholder-id' })
|
||||
mockActivities.getAssetActivity.mockResolvedValue({
|
||||
@@ -69,13 +69,6 @@ describe('Agent Autofill Workflow', () => {
|
||||
sessionId: 'session-123',
|
||||
usage: { inputTokens: 10, outputTokens: 15, model: 'gemini-model' },
|
||||
})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mockActivities contains vi.fn mock functions which are cast to expected activity proxy types
|
||||
vi.mocked(workflowUtils.getActivities).mockReturnValue(mockActivities as any)
|
||||
vi.mocked(workflowUtils.executeActivity).mockImplementation(async (_queue, act, ...args) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- act is one of the mocked activities
|
||||
return (act as any)(...args)
|
||||
})
|
||||
})
|
||||
|
||||
it('should run agent autofill workflow successfully', async () => {
|
||||
@@ -93,9 +86,6 @@ describe('Agent Autofill Workflow', () => {
|
||||
|
||||
await agentAutofillMedia(task)
|
||||
|
||||
// Verify queue discovery
|
||||
expect(mockActivities.getAgentWorkerQueueActivity).toHaveBeenCalled()
|
||||
|
||||
// Verify task processing status
|
||||
expect(mockActivities.updateTaskStatusActivity).toHaveBeenCalledWith({
|
||||
taskId: task.id,
|
||||
|
||||
@@ -1,38 +1,33 @@
|
||||
import type { WorkflowTask } from '@shumai/db'
|
||||
import { executeActivity, getActivities, TaskQueueAgent } from '@shumai/workflow-core'
|
||||
import { ApplicationFailure } from '@temporalio/workflow'
|
||||
import {
|
||||
ApplicationFailure,
|
||||
updateTaskStatusActivity,
|
||||
updateTaskUsageActivity,
|
||||
} from '@shumai/workflow-core'
|
||||
import { getProxyType } from '@shumai/core/src/utils/mime'
|
||||
import {
|
||||
autofillAiActivity,
|
||||
createCommentActivity,
|
||||
getAgentAutofillContextActivity,
|
||||
getAssetActivity,
|
||||
getProjectAutofillFieldsActivity,
|
||||
updateAssetMetadataActivity,
|
||||
updateCommentActivity,
|
||||
} from '../activities/agent'
|
||||
|
||||
export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
||||
const {
|
||||
updateTaskStatusActivity,
|
||||
getAssetActivity,
|
||||
getProjectAutofillFieldsActivity,
|
||||
getAgentAutofillContextActivity,
|
||||
autofillAiActivity,
|
||||
updateTaskUsageActivity,
|
||||
updateAssetMetadataActivity,
|
||||
createCommentActivity,
|
||||
updateCommentActivity,
|
||||
getAgentWorkerQueueActivity,
|
||||
} = getActivities()
|
||||
|
||||
let placeholderCommentId: string | undefined
|
||||
let agentWorkerQueue = ''
|
||||
|
||||
try {
|
||||
// 0. Discover queues
|
||||
agentWorkerQueue = await executeActivity(TaskQueueAgent, getAgentWorkerQueueActivity)
|
||||
|
||||
// Update status to processing
|
||||
await executeActivity(agentWorkerQueue, updateTaskStatusActivity, {
|
||||
await updateTaskStatusActivity({
|
||||
taskId: task.id,
|
||||
status: 'processing',
|
||||
})
|
||||
|
||||
// 0. Create Placeholder Comment
|
||||
const payload = task.payload
|
||||
const placeholder = await executeActivity(agentWorkerQueue, createCommentActivity, {
|
||||
const placeholder = await createCommentActivity({
|
||||
assetId: task.assetId,
|
||||
message: '__AUTOFILL__',
|
||||
sessionId: payload?.agent?.sessionId || task.id,
|
||||
@@ -41,7 +36,7 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
||||
placeholderCommentId = placeholder.id
|
||||
|
||||
// 1. Get Asset
|
||||
const asset = await executeActivity(agentWorkerQueue, getAssetActivity, task.assetId)
|
||||
const asset = await getAssetActivity(task.assetId)
|
||||
if (!asset || !asset.project) {
|
||||
throw ApplicationFailure.create({ message: 'Asset or project not found', nonRetryable: true })
|
||||
}
|
||||
@@ -49,19 +44,15 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
||||
const projectId = asset.project.id
|
||||
|
||||
// 2. Get Project Autofill Fields
|
||||
const fields = await executeActivity(
|
||||
agentWorkerQueue,
|
||||
getProjectAutofillFieldsActivity,
|
||||
projectId,
|
||||
)
|
||||
const fields = await getProjectAutofillFieldsActivity(projectId)
|
||||
if (fields.length === 0) {
|
||||
if (placeholderCommentId) {
|
||||
await executeActivity(agentWorkerQueue, updateCommentActivity, {
|
||||
await updateCommentActivity({
|
||||
commentId: placeholderCommentId,
|
||||
message: 'Autofill completed: No autofill fields defined in project.',
|
||||
})
|
||||
}
|
||||
await executeActivity(agentWorkerQueue, updateTaskStatusActivity, {
|
||||
await updateTaskStatusActivity({
|
||||
taskId: task.id,
|
||||
status: 'completed',
|
||||
})
|
||||
@@ -69,7 +60,7 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
|
||||
// 3. Fetch Agent Context
|
||||
const context = await executeActivity(agentWorkerQueue, getAgentAutofillContextActivity, {
|
||||
const context = await getAgentAutofillContextActivity({
|
||||
teamId,
|
||||
})
|
||||
|
||||
@@ -91,7 +82,7 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
||||
: undefined
|
||||
: undefined
|
||||
|
||||
const aiResult = await executeActivity(agentWorkerQueue, autofillAiActivity, {
|
||||
const aiResult = await autofillAiActivity({
|
||||
teamId,
|
||||
assetId: asset.id,
|
||||
assetName: asset.name,
|
||||
@@ -99,19 +90,17 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
||||
duration,
|
||||
pageCount,
|
||||
projectId: asset.projectId ?? undefined,
|
||||
fields: fields.map(
|
||||
(f: { key: string; config: Record<string, unknown>; description?: string | null }) => ({
|
||||
id: f.key,
|
||||
config: f.config as unknown as PrismaJson.FieldConfig,
|
||||
description: f.description,
|
||||
}),
|
||||
),
|
||||
fields: fields.map((f) => ({
|
||||
id: f.key,
|
||||
config: (f.config as unknown as PrismaJson.FieldConfig) ?? {},
|
||||
description: f.description,
|
||||
})),
|
||||
context,
|
||||
})
|
||||
|
||||
if (aiResult.usage) {
|
||||
// Update Usage
|
||||
await executeActivity(agentWorkerQueue, updateTaskUsageActivity, {
|
||||
await updateTaskUsageActivity({
|
||||
taskId: task.id,
|
||||
inputTokens: aiResult.usage.inputTokens,
|
||||
outputTokens: aiResult.usage.outputTokens,
|
||||
@@ -129,7 +118,7 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
||||
}))
|
||||
|
||||
if (metadataUpdates.length > 0) {
|
||||
await executeActivity(agentWorkerQueue, updateAssetMetadataActivity, {
|
||||
await updateAssetMetadataActivity({
|
||||
assetId: asset.id,
|
||||
metadata: metadataUpdates,
|
||||
})
|
||||
@@ -137,7 +126,7 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
||||
|
||||
// 7. Update Placeholder Comment
|
||||
if (placeholderCommentId) {
|
||||
await executeActivity(agentWorkerQueue, updateCommentActivity, {
|
||||
await updateCommentActivity({
|
||||
commentId: placeholderCommentId,
|
||||
message: 'Autofill completed successfully.',
|
||||
sessionId: aiResult.sessionId,
|
||||
@@ -145,7 +134,7 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
|
||||
// Update status to completed
|
||||
await executeActivity(agentWorkerQueue, updateTaskStatusActivity, {
|
||||
await updateTaskStatusActivity({
|
||||
taskId: task.id,
|
||||
status: 'completed',
|
||||
})
|
||||
@@ -153,9 +142,9 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
||||
console.error(`AgentAutofillMedia failed for task ${task.id}:`, err)
|
||||
|
||||
// Update placeholder comment with error message
|
||||
if (placeholderCommentId && agentWorkerQueue) {
|
||||
if (placeholderCommentId) {
|
||||
try {
|
||||
await executeActivity(agentWorkerQueue, updateCommentActivity, {
|
||||
await updateCommentActivity({
|
||||
commentId: placeholderCommentId,
|
||||
message: `Autofill failed: ${err instanceof Error ? err.message : String(err)}`,
|
||||
})
|
||||
@@ -165,13 +154,11 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
|
||||
// Update status to failed
|
||||
if (agentWorkerQueue) {
|
||||
await executeActivity(agentWorkerQueue, updateTaskStatusActivity, {
|
||||
taskId: task.id,
|
||||
status: 'failed',
|
||||
output: { error: err instanceof Error ? err.message : String(err) },
|
||||
})
|
||||
}
|
||||
await updateTaskStatusActivity({
|
||||
taskId: task.id,
|
||||
status: 'failed',
|
||||
output: { error: err instanceof Error ? err.message : String(err) },
|
||||
})
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,34 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { agentChat } from './agent-chat'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import * as workflowUtils from '@shumai/workflow-core'
|
||||
import * as workflowCore from '@shumai/workflow-core'
|
||||
import * as agentActivities from '../activities/agent'
|
||||
|
||||
vi.mock('@shumai/workflow-core', async () => {
|
||||
const actual = await vi.importActual('@shumai/workflow-core')
|
||||
return {
|
||||
...actual,
|
||||
getActivities: vi.fn(),
|
||||
executeActivity: vi.fn(),
|
||||
updateTaskStatusActivity: vi.fn(),
|
||||
updateTaskUsageActivity: vi.fn(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../activities/agent', async () => {
|
||||
const actual = await vi.importActual('../activities/agent')
|
||||
return {
|
||||
...actual,
|
||||
getCommentActivity: vi.fn(),
|
||||
createCommentActivity: vi.fn(),
|
||||
getAssetActivity: vi.fn(),
|
||||
initializeAgentSessionActivity: vi.fn(),
|
||||
getAgentChatContextActivity: vi.fn(),
|
||||
agentChatActivity: vi.fn(),
|
||||
updateCommentActivity: vi.fn(),
|
||||
deleteCommentActivity: vi.fn(),
|
||||
getAssetPathHierarchyActivity: vi.fn(),
|
||||
getAssetPathContextActivity: vi.fn(),
|
||||
generateSessionNameActivity: vi.fn(),
|
||||
getUserTeamInfoActivity: vi.fn(),
|
||||
}
|
||||
})
|
||||
|
||||
@@ -23,40 +43,22 @@ describe('Agent Chat Workflow', () => {
|
||||
vi.clearAllMocks()
|
||||
|
||||
mockActivities = {
|
||||
updateTaskStatusActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'updateTaskStatusActivity',
|
||||
}),
|
||||
getCommentActivity: Object.assign(vi.fn(), { _activityName: 'getCommentActivity' }),
|
||||
createCommentActivity: Object.assign(vi.fn(), { _activityName: 'createCommentActivity' }),
|
||||
getAssetActivity: Object.assign(vi.fn(), { _activityName: 'getAssetActivity' }),
|
||||
initializeAgentSessionActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'initializeAgentSessionActivity',
|
||||
}),
|
||||
getAgentChatContextActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getAgentChatContextActivity',
|
||||
}),
|
||||
getAgentWorkerQueueActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getAgentWorkerQueueActivity',
|
||||
}),
|
||||
agentChatActivity: Object.assign(vi.fn(), { _activityName: 'agentChatActivity' }),
|
||||
updateCommentActivity: Object.assign(vi.fn(), { _activityName: 'updateCommentActivity' }),
|
||||
updateTaskUsageActivity: Object.assign(vi.fn(), { _activityName: 'updateTaskUsageActivity' }),
|
||||
deleteCommentActivity: Object.assign(vi.fn(), { _activityName: 'deleteCommentActivity' }),
|
||||
getAssetPathHierarchyActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getAssetPathHierarchyActivity',
|
||||
}),
|
||||
getAssetPathContextActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getAssetPathContextActivity',
|
||||
}),
|
||||
generateSessionNameActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'generateSessionNameActivity',
|
||||
}),
|
||||
getUserTeamInfoActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getUserTeamInfoActivity',
|
||||
}),
|
||||
updateTaskStatusActivity: vi.mocked(workflowCore.updateTaskStatusActivity),
|
||||
getCommentActivity: vi.mocked(agentActivities.getCommentActivity),
|
||||
createCommentActivity: vi.mocked(agentActivities.createCommentActivity),
|
||||
getAssetActivity: vi.mocked(agentActivities.getAssetActivity),
|
||||
initializeAgentSessionActivity: vi.mocked(agentActivities.initializeAgentSessionActivity),
|
||||
getAgentChatContextActivity: vi.mocked(agentActivities.getAgentChatContextActivity),
|
||||
agentChatActivity: vi.mocked(agentActivities.agentChatActivity),
|
||||
updateCommentActivity: vi.mocked(agentActivities.updateCommentActivity),
|
||||
updateTaskUsageActivity: vi.mocked(workflowCore.updateTaskUsageActivity),
|
||||
deleteCommentActivity: vi.mocked(agentActivities.deleteCommentActivity),
|
||||
getAssetPathHierarchyActivity: vi.mocked(agentActivities.getAssetPathHierarchyActivity),
|
||||
getAssetPathContextActivity: vi.mocked(agentActivities.getAssetPathContextActivity),
|
||||
generateSessionNameActivity: vi.mocked(agentActivities.generateSessionNameActivity),
|
||||
getUserTeamInfoActivity: vi.mocked(agentActivities.getUserTeamInfoActivity),
|
||||
}
|
||||
|
||||
mockActivities.getAgentWorkerQueueActivity.mockResolvedValue('agent_queue')
|
||||
mockActivities.updateTaskStatusActivity.mockResolvedValue({})
|
||||
mockActivities.createCommentActivity.mockResolvedValue({ id: 'comment-placeholder-id' })
|
||||
mockActivities.generateSessionNameActivity.mockResolvedValue(undefined)
|
||||
@@ -92,13 +94,6 @@ describe('Agent Chat Workflow', () => {
|
||||
sessionId: 'session-123',
|
||||
usage: { inputTokens: 10, outputTokens: 20, model: 'gemini-model' },
|
||||
})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mockActivities contains vi.fn mock functions which are cast to expected activity proxy types
|
||||
vi.mocked(workflowUtils.getActivities).mockReturnValue(mockActivities as any)
|
||||
vi.mocked(workflowUtils.executeActivity).mockImplementation(async (_queue, act, ...args) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- act is one of the mocked activities
|
||||
return (act as any)(...args)
|
||||
})
|
||||
})
|
||||
|
||||
it('should run agent chat workflow successfully with default configurations', async () => {
|
||||
@@ -116,9 +111,6 @@ describe('Agent Chat Workflow', () => {
|
||||
|
||||
await agentChat(task)
|
||||
|
||||
// Verify queue discovery
|
||||
expect(mockActivities.getAgentWorkerQueueActivity).toHaveBeenCalled()
|
||||
|
||||
// Verify task status processing
|
||||
expect(mockActivities.updateTaskStatusActivity).toHaveBeenCalledWith({
|
||||
taskId: task.id,
|
||||
@@ -806,4 +798,89 @@ describe('Agent Chat Workflow', () => {
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('should format mediaPosition as degree for 3D assets in 1-on-1 chat', async () => {
|
||||
mockActivities.getAssetActivity.mockResolvedValue({
|
||||
id: 'a-3d',
|
||||
project: { teamId: 't1' },
|
||||
type: 'file',
|
||||
name: 'model.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
media: { proxyType: '3d' },
|
||||
parentId: null,
|
||||
})
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'chat',
|
||||
status: 'pending',
|
||||
assetId: 'a-3d',
|
||||
payload: {
|
||||
projectId: 'p1',
|
||||
agent: {
|
||||
agentId: 'b1',
|
||||
prompt: 'Look at this angle',
|
||||
sessionId: 'session-3d-1',
|
||||
second: 0.5, // 0.5s turntable time = 45°
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await agentChat(task)
|
||||
|
||||
expect(mockActivities.agentChatActivity).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
messageContext: expect.objectContaining({
|
||||
position: { type: 'degree', degree: 45 },
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('should format mediaPosition as degree for 3D assets in comment mode', async () => {
|
||||
mockActivities.getAssetActivity.mockResolvedValue({
|
||||
id: 'a-3d',
|
||||
project: { teamId: 't1' },
|
||||
type: 'file',
|
||||
name: 'model.glb',
|
||||
mediaType: 'model/gltf-binary',
|
||||
media: { proxyType: '3d' },
|
||||
parentId: null,
|
||||
})
|
||||
|
||||
mockActivities.getCommentActivity.mockResolvedValue({
|
||||
id: 'comment-3d-1',
|
||||
creatorId: 'user-c1',
|
||||
message: 'Look at the back',
|
||||
replyToId: null,
|
||||
second: 2.0, // 2.0s = 180°
|
||||
attachments: [],
|
||||
})
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'chat',
|
||||
status: 'pending',
|
||||
assetId: 'a-3d',
|
||||
payload: {
|
||||
projectId: 'p1',
|
||||
agent: {
|
||||
agentId: 'b1',
|
||||
userCommentId: 'comment-3d-1',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await agentChat(task)
|
||||
|
||||
expect(mockActivities.agentChatActivity).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
messageContext: expect.objectContaining({
|
||||
position: { type: 'degree', degree: 180 },
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,6 +1,22 @@
|
||||
import { ApplicationFailure } from '@temporalio/workflow'
|
||||
import type { WorkflowTask } from '@shumai/db'
|
||||
import { executeActivity, getActivities, TaskQueueAgent } from '@shumai/workflow-core'
|
||||
import {
|
||||
ApplicationFailure,
|
||||
updateTaskStatusActivity,
|
||||
updateTaskUsageActivity,
|
||||
} from '@shumai/workflow-core'
|
||||
import {
|
||||
agentChatActivity,
|
||||
createCommentActivity,
|
||||
generateSessionNameActivity,
|
||||
getAgentChatContextActivity,
|
||||
getAssetActivity,
|
||||
getAssetPathContextActivity,
|
||||
getAssetPathHierarchyActivity,
|
||||
getCommentActivity,
|
||||
getUserTeamInfoActivity,
|
||||
initializeAgentSessionActivity,
|
||||
updateCommentActivity,
|
||||
} from '../activities/agent'
|
||||
import type {
|
||||
ShumaiMessageContext,
|
||||
ShumaiAssetContext,
|
||||
@@ -8,34 +24,14 @@ import type {
|
||||
ShumaiMediaPosition,
|
||||
} from '@shumai/dtos'
|
||||
import { getProxyType } from '@shumai/core/src/utils/mime'
|
||||
import { secondToDegree } from '@shumai/core/src/utils/model3d'
|
||||
|
||||
export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
const {
|
||||
updateTaskStatusActivity,
|
||||
getAssetActivity,
|
||||
getCommentActivity,
|
||||
getAgentChatContextActivity,
|
||||
agentChatActivity,
|
||||
createCommentActivity,
|
||||
updateCommentActivity,
|
||||
updateTaskUsageActivity,
|
||||
getAgentWorkerQueueActivity,
|
||||
initializeAgentSessionActivity,
|
||||
getAssetPathHierarchyActivity,
|
||||
getAssetPathContextActivity,
|
||||
generateSessionNameActivity,
|
||||
getUserTeamInfoActivity,
|
||||
} = getActivities()
|
||||
|
||||
let placeholderCommentId: string | undefined
|
||||
let agentWorkerQueue = ''
|
||||
|
||||
try {
|
||||
// 0. Discover queue
|
||||
agentWorkerQueue = await executeActivity(TaskQueueAgent, getAgentWorkerQueueActivity)
|
||||
|
||||
// Update status to processing
|
||||
await executeActivity(agentWorkerQueue, updateTaskStatusActivity, {
|
||||
await updateTaskStatusActivity({
|
||||
taskId: task.id,
|
||||
status: 'processing',
|
||||
})
|
||||
@@ -64,7 +60,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
let commentAnnotations: unknown[] | undefined
|
||||
|
||||
if (userCommentId) {
|
||||
userComment = await executeActivity(agentWorkerQueue, getCommentActivity, userCommentId)
|
||||
userComment = await getCommentActivity(userCommentId)
|
||||
if (!userComment) {
|
||||
throw ApplicationFailure.create({ message: 'User comment not found', nonRetryable: true })
|
||||
}
|
||||
@@ -83,7 +79,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
|
||||
// 2. Create Placeholder Comment
|
||||
const placeholder = await executeActivity(agentWorkerQueue, createCommentActivity, {
|
||||
const placeholder = await createCommentActivity({
|
||||
assetId: task.assetId,
|
||||
message: '__CHAT__',
|
||||
sessionId: sessionId || 'pending',
|
||||
@@ -118,7 +114,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
|
||||
// 3. Get Asset
|
||||
const asset = await executeActivity(agentWorkerQueue, getAssetActivity, task.assetId)
|
||||
const asset = await getAssetActivity(task.assetId)
|
||||
if (!asset || !asset.project) {
|
||||
throw ApplicationFailure.create({ message: 'Asset or project not found', nonRetryable: true })
|
||||
}
|
||||
@@ -133,7 +129,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
sessionId = await executeActivity(agentWorkerQueue, initializeAgentSessionActivity, {
|
||||
sessionId = await initializeAgentSessionActivity({
|
||||
teamId,
|
||||
agentId: agentId,
|
||||
userCommentId,
|
||||
@@ -143,18 +139,14 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
|
||||
// 4b. Fetch Agent Context
|
||||
const context = await executeActivity(agentWorkerQueue, getAgentChatContextActivity, {
|
||||
const context = await getAgentChatContextActivity({
|
||||
teamId,
|
||||
agentId: agentId,
|
||||
userId: payload.agent?.userId,
|
||||
projectId: payload.projectId,
|
||||
})
|
||||
|
||||
const pathHierarchy = await executeActivity(
|
||||
agentWorkerQueue,
|
||||
getAssetPathHierarchyActivity,
|
||||
task.assetId,
|
||||
)
|
||||
const pathHierarchy = await getAssetPathHierarchyActivity(task.assetId)
|
||||
const assetPath = pathHierarchy?.path || ''
|
||||
const ancestors = pathHierarchy?.ancestors || []
|
||||
|
||||
@@ -179,11 +171,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
if (userCommentId && userComment?.attachments) {
|
||||
for (const att of userComment.attachments) {
|
||||
if (att.asset) {
|
||||
const filePath = await executeActivity(
|
||||
agentWorkerQueue,
|
||||
getAssetPathContextActivity,
|
||||
att.asset.id,
|
||||
)
|
||||
const filePath = await getAssetPathContextActivity(att.asset.id)
|
||||
const attProxyType =
|
||||
(att.asset.media as PrismaJson.MediaInfo | null)?.proxyType ||
|
||||
getProxyType(att.asset.mediaType, att.asset.name) ||
|
||||
@@ -202,13 +190,9 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
} else if (payload.agent?.attachedFiles) {
|
||||
for (const fileId of payload.agent.attachedFiles) {
|
||||
const file = await executeActivity(agentWorkerQueue, getAssetActivity, fileId)
|
||||
const file = await getAssetActivity(fileId)
|
||||
if (file) {
|
||||
const filePath = await executeActivity(
|
||||
agentWorkerQueue,
|
||||
getAssetPathContextActivity,
|
||||
fileId,
|
||||
)
|
||||
const filePath = await getAssetPathContextActivity(fileId)
|
||||
const fileProxyType =
|
||||
(file.media as PrismaJson.MediaInfo | null)?.proxyType ||
|
||||
getProxyType(file.mediaType, file.name) ||
|
||||
@@ -231,13 +215,9 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
const referencedAssets: ShumaiAttachedFileContext[] = []
|
||||
if (payload.agent?.assetIds) {
|
||||
for (const assetId of payload.agent.assetIds) {
|
||||
const referencedAsset = await executeActivity(agentWorkerQueue, getAssetActivity, assetId)
|
||||
const referencedAsset = await getAssetActivity(assetId)
|
||||
if (referencedAsset) {
|
||||
const filePath = await executeActivity(
|
||||
agentWorkerQueue,
|
||||
getAssetPathContextActivity,
|
||||
assetId,
|
||||
)
|
||||
const filePath = await getAssetPathContextActivity(assetId)
|
||||
const refProxyType =
|
||||
(referencedAsset.media as PrismaJson.MediaInfo | null)?.proxyType ||
|
||||
getProxyType(referencedAsset.mediaType, referencedAsset.name) ||
|
||||
@@ -264,7 +244,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
const targetUserId = userCommentId ? commentCreatorId : payload.agent?.userId
|
||||
let userInfo: { name: string; role: string } | null = null
|
||||
if (targetUserId) {
|
||||
userInfo = await executeActivity(agentWorkerQueue, getUserTeamInfoActivity, {
|
||||
userInfo = await getUserTeamInfoActivity({
|
||||
userId: targetUserId,
|
||||
teamId,
|
||||
})
|
||||
@@ -273,7 +253,9 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
// Build position
|
||||
let mediaPosition: ShumaiMediaPosition | undefined
|
||||
if (commentTimestamp !== undefined && commentTimestamp !== null) {
|
||||
if (proxyType === 'pdf') {
|
||||
if (proxyType === '3d') {
|
||||
mediaPosition = { type: 'degree', degree: secondToDegree(commentTimestamp) }
|
||||
} else if (proxyType === 'pdf') {
|
||||
mediaPosition = { type: 'page', page: Math.round(commentTimestamp) }
|
||||
} else {
|
||||
mediaPosition = { type: 'time', seconds: commentTimestamp }
|
||||
@@ -322,7 +304,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
folderId = asset.parentId
|
||||
}
|
||||
|
||||
const aiResult = await executeActivity(agentWorkerQueue, agentChatActivity, {
|
||||
const aiResult = await agentChatActivity({
|
||||
taskId: task.id,
|
||||
teamId,
|
||||
agentId: agentId,
|
||||
@@ -341,7 +323,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
|
||||
// 7. Update Placeholder Comment
|
||||
if (placeholderCommentId) {
|
||||
await executeActivity(agentWorkerQueue, updateCommentActivity, {
|
||||
await updateCommentActivity({
|
||||
commentId: placeholderCommentId,
|
||||
message: aiResult.text,
|
||||
sessionId: aiResult.sessionId,
|
||||
@@ -350,7 +332,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
|
||||
// 8. Update Usage
|
||||
if (aiResult.usage) {
|
||||
await executeActivity(agentWorkerQueue, updateTaskUsageActivity, {
|
||||
await updateTaskUsageActivity({
|
||||
taskId: task.id,
|
||||
inputTokens: aiResult.usage.inputTokens,
|
||||
outputTokens: aiResult.usage.outputTokens,
|
||||
@@ -360,7 +342,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
|
||||
// 9. Generate Session Name for new chats
|
||||
if (isNewChat) {
|
||||
await executeActivity(agentWorkerQueue, generateSessionNameActivity, {
|
||||
await generateSessionNameActivity({
|
||||
teamId,
|
||||
agentId,
|
||||
prompt,
|
||||
@@ -372,7 +354,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
|
||||
// Update status to completed
|
||||
await executeActivity(agentWorkerQueue, updateTaskStatusActivity, {
|
||||
await updateTaskStatusActivity({
|
||||
taskId: task.id,
|
||||
status: 'completed',
|
||||
output: { sessionId: aiResult.sessionId },
|
||||
@@ -381,7 +363,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
console.error(`AgentChat failed for task ${task.id}:`, err)
|
||||
|
||||
// Update placeholder comment with error message
|
||||
if (placeholderCommentId && agentWorkerQueue) {
|
||||
if (placeholderCommentId) {
|
||||
try {
|
||||
let errorMessage = 'Sorry, I encountered an error while processing your request.'
|
||||
if (err instanceof Error) {
|
||||
@@ -403,7 +385,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
errorMessage = 'Agent execution stopped.'
|
||||
}
|
||||
|
||||
await executeActivity(agentWorkerQueue, updateCommentActivity, {
|
||||
await updateCommentActivity({
|
||||
commentId: placeholderCommentId,
|
||||
message: errorMessage,
|
||||
})
|
||||
@@ -413,13 +395,11 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
|
||||
// Update status to failed
|
||||
if (agentWorkerQueue) {
|
||||
await executeActivity(agentWorkerQueue, updateTaskStatusActivity, {
|
||||
taskId: task.id,
|
||||
status: 'failed',
|
||||
output: { error: err instanceof Error ? err.message : String(err) },
|
||||
})
|
||||
}
|
||||
await updateTaskStatusActivity({
|
||||
taskId: task.id,
|
||||
status: 'failed',
|
||||
output: { error: err instanceof Error ? err.message : String(err) },
|
||||
})
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,39 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { agentEmbeddingMedia } from './agent-embedding'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import * as workflowUtils from '@shumai/workflow-core'
|
||||
import * as workflowCore from '@shumai/workflow-core'
|
||||
import * as agentActivities from '../activities/agent'
|
||||
import * as aiActivities from '../activities/ai'
|
||||
|
||||
vi.mock('@shumai/workflow-core', async () => {
|
||||
const actual = await vi.importActual('@shumai/workflow-core')
|
||||
return {
|
||||
...actual,
|
||||
getActivities: vi.fn(),
|
||||
executeActivity: vi.fn(),
|
||||
updateTaskStatusActivity: vi.fn(),
|
||||
updateTaskUsageActivity: vi.fn(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../activities/agent', async () => {
|
||||
const actual = await vi.importActual('../activities/agent')
|
||||
return {
|
||||
...actual,
|
||||
createCommentActivity: vi.fn(),
|
||||
updateCommentActivity: vi.fn(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../activities/ai', async () => {
|
||||
const actual = await vi.importActual('../activities/ai')
|
||||
return {
|
||||
...actual,
|
||||
getEmbeddingContextActivity: vi.fn(),
|
||||
generateImageEmbeddingActivity: vi.fn(),
|
||||
generateVideoChunkEmbeddingActivity: vi.fn(),
|
||||
saveAssetEmbeddingsActivity: vi.fn(),
|
||||
deleteAssetEmbeddingsActivity: vi.fn(),
|
||||
transcodeVideoChunkActivity: vi.fn(),
|
||||
deleteS3ObjectActivity: vi.fn(),
|
||||
}
|
||||
})
|
||||
|
||||
@@ -23,46 +48,23 @@ describe('Agent Embedding Workflow', () => {
|
||||
vi.clearAllMocks()
|
||||
|
||||
mockActivities = {
|
||||
updateTaskStatusActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'updateTaskStatusActivity',
|
||||
}),
|
||||
getEmbeddingContextActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getEmbeddingContextActivity',
|
||||
}),
|
||||
generateImageEmbeddingActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'generateImageEmbeddingActivity',
|
||||
}),
|
||||
generateVideoChunkEmbeddingActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'generateVideoChunkEmbeddingActivity',
|
||||
}),
|
||||
saveAssetEmbeddingsActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'saveAssetEmbeddingsActivity',
|
||||
}),
|
||||
updateTaskUsageActivity: Object.assign(vi.fn(), { _activityName: 'updateTaskUsageActivity' }),
|
||||
createCommentActivity: Object.assign(vi.fn(), { _activityName: 'createCommentActivity' }),
|
||||
updateCommentActivity: Object.assign(vi.fn(), { _activityName: 'updateCommentActivity' }),
|
||||
getAgentWorkerQueueActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getAgentWorkerQueueActivity',
|
||||
}),
|
||||
getTranscodeWorkerQueueActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getTranscodeWorkerQueueActivity',
|
||||
}),
|
||||
downloadMediaToTmpActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'downloadMediaToTmpActivity',
|
||||
}),
|
||||
cleanupTmpDirActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'cleanupTmpDirActivity',
|
||||
}),
|
||||
transcodeVideoChunkActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'transcodeVideoChunkActivity',
|
||||
}),
|
||||
deleteS3ObjectActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'deleteS3ObjectActivity',
|
||||
}),
|
||||
updateTaskStatusActivity: vi.mocked(workflowCore.updateTaskStatusActivity),
|
||||
getEmbeddingContextActivity: vi.mocked(aiActivities.getEmbeddingContextActivity),
|
||||
generateImageEmbeddingActivity: vi.mocked(aiActivities.generateImageEmbeddingActivity),
|
||||
generateVideoChunkEmbeddingActivity: vi.mocked(
|
||||
aiActivities.generateVideoChunkEmbeddingActivity,
|
||||
),
|
||||
saveAssetEmbeddingsActivity: vi.mocked(aiActivities.saveAssetEmbeddingsActivity),
|
||||
deleteAssetEmbeddingsActivity: vi.mocked(aiActivities.deleteAssetEmbeddingsActivity),
|
||||
updateTaskUsageActivity: vi.mocked(workflowCore.updateTaskUsageActivity),
|
||||
createCommentActivity: vi.mocked(agentActivities.createCommentActivity),
|
||||
updateCommentActivity: vi.mocked(agentActivities.updateCommentActivity),
|
||||
downloadMediaToTmpActivity: vi.fn(),
|
||||
cleanupTmpDirActivity: vi.fn(),
|
||||
transcodeVideoChunkActivity: vi.mocked(aiActivities.transcodeVideoChunkActivity),
|
||||
deleteS3ObjectActivity: vi.mocked(aiActivities.deleteS3ObjectActivity),
|
||||
}
|
||||
|
||||
mockActivities.getAgentWorkerQueueActivity.mockResolvedValue('agent_queue')
|
||||
mockActivities.getTranscodeWorkerQueueActivity.mockResolvedValue('transcode_queue')
|
||||
mockActivities.updateTaskStatusActivity.mockResolvedValue({})
|
||||
mockActivities.createCommentActivity.mockResolvedValue({ id: 'comment-placeholder-id' })
|
||||
mockActivities.getEmbeddingContextActivity.mockResolvedValue({
|
||||
@@ -96,13 +98,6 @@ describe('Agent Embedding Workflow', () => {
|
||||
)
|
||||
mockActivities.deleteS3ObjectActivity.mockResolvedValue(undefined)
|
||||
mockActivities.cleanupTmpDirActivity.mockResolvedValue(undefined)
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mockActivities contains vi.fn mock functions which are cast to expected activity proxy types
|
||||
vi.mocked(workflowUtils.getActivities).mockReturnValue(mockActivities as any)
|
||||
vi.mocked(workflowUtils.executeActivity).mockImplementation(async (_queue, act, ...args) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- act is one of the mocked activities
|
||||
return (act as any)(...args)
|
||||
})
|
||||
})
|
||||
|
||||
it('should run agent embedding workflow successfully for image', async () => {
|
||||
@@ -121,9 +116,6 @@ describe('Agent Embedding Workflow', () => {
|
||||
|
||||
await agentEmbeddingMedia(task)
|
||||
|
||||
// Verify queue discovery
|
||||
expect(mockActivities.getAgentWorkerQueueActivity).toHaveBeenCalled()
|
||||
|
||||
// Verify task processing status
|
||||
expect(mockActivities.updateTaskStatusActivity).toHaveBeenCalledWith({
|
||||
taskId: task.id,
|
||||
@@ -211,6 +203,68 @@ describe('Agent Embedding Workflow', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('should run agent embedding workflow successfully for 3D asset using 4-views image', async () => {
|
||||
mockActivities.getEmbeddingContextActivity.mockResolvedValue({
|
||||
agent: { id: 'b1' },
|
||||
asset: {
|
||||
id: 'model-1',
|
||||
mediaType: 'model/gltf-binary',
|
||||
storageKey: { key: 'raw/model.glb' },
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
imageTranscodes: [{ key: 'files/views.webp', format: 'webp' }],
|
||||
},
|
||||
},
|
||||
chunkDuration: 60.0,
|
||||
chunkOverlap: 5.0,
|
||||
})
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'ai_embedding',
|
||||
status: 'pending',
|
||||
assetId: 'model-1',
|
||||
teamId: 't1',
|
||||
},
|
||||
})
|
||||
|
||||
await agentEmbeddingMedia(task)
|
||||
|
||||
expect(mockActivities.generateImageEmbeddingActivity).toHaveBeenCalledWith({
|
||||
teamId: 't1',
|
||||
assetKey: 'files/views.webp',
|
||||
mediaType: 'image/webp',
|
||||
})
|
||||
})
|
||||
|
||||
it('should reject 3D asset for embeddings if imageTranscodes is missing', async () => {
|
||||
mockActivities.getEmbeddingContextActivity.mockResolvedValue({
|
||||
agent: { id: 'b1' },
|
||||
asset: {
|
||||
id: 'model-1',
|
||||
mediaType: 'model/gltf-binary',
|
||||
storageKey: { key: 'raw/model.glb' },
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
imageTranscodes: [],
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'ai_embedding',
|
||||
status: 'pending',
|
||||
assetId: 'model-1',
|
||||
teamId: 't1',
|
||||
},
|
||||
})
|
||||
|
||||
await expect(agentEmbeddingMedia(task)).rejects.toThrow(
|
||||
'unsupported media type for embeddings: model/gltf-binary',
|
||||
)
|
||||
})
|
||||
|
||||
it('should run agent embedding workflow successfully for video in chunks', async () => {
|
||||
mockActivities.getEmbeddingContextActivity.mockResolvedValue({
|
||||
agent: { id: 'b1' },
|
||||
@@ -242,9 +296,6 @@ describe('Agent Embedding Workflow', () => {
|
||||
|
||||
await agentEmbeddingMedia(task)
|
||||
|
||||
// Verify video transcode queue discovery
|
||||
expect(mockActivities.getTranscodeWorkerQueueActivity).toHaveBeenCalled()
|
||||
|
||||
// Verify video chunk slicing activity called 3 times on transcode queue
|
||||
expect(mockActivities.transcodeVideoChunkActivity).toHaveBeenCalledTimes(3)
|
||||
expect(mockActivities.transcodeVideoChunkActivity).toHaveBeenNthCalledWith(1, {
|
||||
@@ -252,18 +303,21 @@ describe('Agent Embedding Workflow', () => {
|
||||
assetKey: 'test-transcoded.mp4',
|
||||
startTime: 0,
|
||||
endTime: 60,
|
||||
format: 'video',
|
||||
})
|
||||
expect(mockActivities.transcodeVideoChunkActivity).toHaveBeenNthCalledWith(2, {
|
||||
assetId: 'a1',
|
||||
assetKey: 'test-transcoded.mp4',
|
||||
startTime: 55,
|
||||
endTime: 115,
|
||||
format: 'video',
|
||||
})
|
||||
expect(mockActivities.transcodeVideoChunkActivity).toHaveBeenNthCalledWith(3, {
|
||||
assetId: 'a1',
|
||||
assetKey: 'test-transcoded.mp4',
|
||||
startTime: 110,
|
||||
endTime: 150,
|
||||
format: 'video',
|
||||
})
|
||||
|
||||
// Verify video chunk embedding generation (3 chunks) on agent queue
|
||||
@@ -295,14 +349,19 @@ describe('Agent Embedding Workflow', () => {
|
||||
model: 'gemini-embedding-2',
|
||||
})
|
||||
|
||||
// Verify embeddings saved
|
||||
expect(mockActivities.saveAssetEmbeddingsActivity).toHaveBeenCalledWith({
|
||||
// Verify embeddings saved per chunk immediately
|
||||
expect(mockActivities.saveAssetEmbeddingsActivity).toHaveBeenCalledTimes(3)
|
||||
expect(mockActivities.saveAssetEmbeddingsActivity).toHaveBeenNthCalledWith(1, {
|
||||
assetId: 'a1',
|
||||
embeddings: [
|
||||
{ embedding: [0.3, 0.4], startTime: 0, endTime: 60 },
|
||||
{ embedding: [0.3, 0.4], startTime: 55, endTime: 115 },
|
||||
{ embedding: [0.3, 0.4], startTime: 110, endTime: 150 },
|
||||
],
|
||||
embeddings: [{ embedding: [0.3, 0.4], startTime: 0, endTime: 60 }],
|
||||
})
|
||||
expect(mockActivities.saveAssetEmbeddingsActivity).toHaveBeenNthCalledWith(2, {
|
||||
assetId: 'a1',
|
||||
embeddings: [{ embedding: [0.3, 0.4], startTime: 55, endTime: 115 }],
|
||||
})
|
||||
expect(mockActivities.saveAssetEmbeddingsActivity).toHaveBeenNthCalledWith(3, {
|
||||
assetId: 'a1',
|
||||
embeddings: [{ embedding: [0.3, 0.4], startTime: 110, endTime: 150 }],
|
||||
})
|
||||
})
|
||||
|
||||
@@ -388,6 +447,49 @@ describe('Agent Embedding Workflow', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('should save completed chunks to DB immediately before subsequent chunk failure', async () => {
|
||||
mockActivities.getEmbeddingContextActivity.mockResolvedValue({
|
||||
agent: { id: 'b1' },
|
||||
asset: {
|
||||
id: 'a1',
|
||||
mediaType: 'video/mp4',
|
||||
storageKey: { key: 'test.mp4' },
|
||||
media: {
|
||||
duration: 150.0,
|
||||
videoTranscodes: [{ key: 'test-transcoded.mp4' }],
|
||||
},
|
||||
},
|
||||
chunkDuration: 60.0,
|
||||
chunkOverlap: 5.0,
|
||||
})
|
||||
|
||||
// Chunk 1 succeeds, Chunk 2 fails
|
||||
mockActivities.generateVideoChunkEmbeddingActivity
|
||||
.mockResolvedValueOnce({
|
||||
embedding: [0.1, 0.2],
|
||||
usage: { inputTokens: 3, outputTokens: 3, model: 'gemini-embedding-2' },
|
||||
})
|
||||
.mockRejectedValueOnce(new Error('Rate limit exceeded at chunk 2'))
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'ai_embedding',
|
||||
status: 'pending',
|
||||
assetId: 'a1',
|
||||
teamId: 't1',
|
||||
},
|
||||
})
|
||||
|
||||
await expect(agentEmbeddingMedia(task)).rejects.toThrow('Rate limit exceeded at chunk 2')
|
||||
|
||||
// Chunk 1 MUST have been saved to the database before chunk 2 failed
|
||||
expect(mockActivities.saveAssetEmbeddingsActivity).toHaveBeenCalledTimes(1)
|
||||
expect(mockActivities.saveAssetEmbeddingsActivity).toHaveBeenCalledWith({
|
||||
assetId: 'a1',
|
||||
embeddings: [{ embedding: [0.1, 0.2], startTime: 0, endTime: 60 }],
|
||||
})
|
||||
})
|
||||
|
||||
it('should not create redundant chunks when video exactly matches chunk duration', async () => {
|
||||
mockActivities.getEmbeddingContextActivity.mockResolvedValue({
|
||||
agent: { id: 'b1' },
|
||||
@@ -423,4 +525,137 @@ describe('Agent Embedding Workflow', () => {
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('should run agent embedding workflow for video with gemma-embedding-2-openai requesting frames format', async () => {
|
||||
mockActivities.getEmbeddingContextActivity.mockResolvedValue({
|
||||
agent: { id: 'b1' },
|
||||
asset: {
|
||||
id: 'a1',
|
||||
mediaType: 'video/mp4',
|
||||
storageKey: { key: 'test.mp4' },
|
||||
media: {
|
||||
duration: 30.0,
|
||||
},
|
||||
},
|
||||
chunkDuration: 60.0,
|
||||
chunkOverlap: 5.0,
|
||||
embeddingProvider: 'gemma-embedding-2-openai',
|
||||
})
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'ai_embedding',
|
||||
status: 'pending',
|
||||
assetId: 'a1',
|
||||
teamId: 't1',
|
||||
},
|
||||
})
|
||||
|
||||
await agentEmbeddingMedia(task)
|
||||
|
||||
expect(mockActivities.transcodeVideoChunkActivity).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
startTime: 0,
|
||||
endTime: 30,
|
||||
format: 'frames',
|
||||
}),
|
||||
)
|
||||
expect(mockActivities.updateTaskUsageActivity).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
model: 'gemma-embedding-2-openai',
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('should skip already completed chunks when resuming a video embedding task', async () => {
|
||||
mockActivities.getEmbeddingContextActivity.mockResolvedValue({
|
||||
agent: { id: 'b1' },
|
||||
asset: {
|
||||
id: 'a1',
|
||||
mediaType: 'video/mp4',
|
||||
storageKey: { key: 'test.mp4' },
|
||||
media: {
|
||||
duration: 150.0,
|
||||
videoTranscodes: [{ key: 'test-transcoded.mp4' }],
|
||||
},
|
||||
},
|
||||
chunkDuration: 60.0,
|
||||
chunkOverlap: 5.0,
|
||||
existingEmbeddings: [
|
||||
{
|
||||
id: 'emb-1',
|
||||
startTime: 0,
|
||||
endTime: 60,
|
||||
has1536: true,
|
||||
has768: false,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'ai_embedding',
|
||||
status: 'pending',
|
||||
assetId: 'a1',
|
||||
teamId: 't1',
|
||||
},
|
||||
})
|
||||
|
||||
await agentEmbeddingMedia(task)
|
||||
|
||||
// Chunk 1 (0-60) should be skipped; only chunk 2 (55-115) and chunk 3 (110-150) should be transcoded and embedded
|
||||
expect(mockActivities.transcodeVideoChunkActivity).toHaveBeenCalledTimes(2)
|
||||
expect(mockActivities.transcodeVideoChunkActivity).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
expect.objectContaining({ startTime: 55, endTime: 115 }),
|
||||
)
|
||||
expect(mockActivities.transcodeVideoChunkActivity).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
expect.objectContaining({ startTime: 110, endTime: 150 }),
|
||||
)
|
||||
|
||||
expect(mockActivities.saveAssetEmbeddingsActivity).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
it('should purge incompatible embeddings before processing', async () => {
|
||||
mockActivities.getEmbeddingContextActivity.mockResolvedValue({
|
||||
agent: { id: 'b1' },
|
||||
asset: {
|
||||
id: 'a1',
|
||||
mediaType: 'image/png',
|
||||
storageKey: { key: 'test.png' },
|
||||
},
|
||||
embeddingProvider: 'gemma-embedding-2-openai',
|
||||
existingEmbeddings: [
|
||||
{
|
||||
id: 'old-gemini-emb',
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
has1536: true,
|
||||
has768: false,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'ai_embedding',
|
||||
status: 'pending',
|
||||
assetId: 'a1',
|
||||
teamId: 't1',
|
||||
},
|
||||
})
|
||||
|
||||
await agentEmbeddingMedia(task)
|
||||
|
||||
// Should purge incompatible old-gemini-emb
|
||||
expect(mockActivities.deleteAssetEmbeddingsActivity).toHaveBeenCalledWith({
|
||||
assetId: 'a1',
|
||||
ids: ['old-gemini-emb'],
|
||||
})
|
||||
|
||||
// Should generate and save new embedding
|
||||
expect(mockActivities.generateImageEmbeddingActivity).toHaveBeenCalled()
|
||||
expect(mockActivities.saveAssetEmbeddingsActivity).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
import { ApplicationFailure } from '@temporalio/workflow'
|
||||
import type { WorkflowTask } from '@shumai/db'
|
||||
import {
|
||||
getActivities,
|
||||
executeActivity,
|
||||
TaskQueueAgent,
|
||||
TaskQueueTranscode,
|
||||
ApplicationFailure,
|
||||
updateTaskStatusActivity,
|
||||
updateTaskUsageActivity,
|
||||
} from '@shumai/workflow-core'
|
||||
import { createCommentActivity, updateCommentActivity } from '../activities/agent'
|
||||
import {
|
||||
deleteAssetEmbeddingsActivity,
|
||||
deleteS3ObjectActivity,
|
||||
generateImageEmbeddingActivity,
|
||||
generateVideoChunkEmbeddingActivity,
|
||||
getEmbeddingContextActivity,
|
||||
saveAssetEmbeddingsActivity,
|
||||
transcodeVideoChunkActivity,
|
||||
type ExistingAssetEmbeddingInfo,
|
||||
} from '../activities/ai'
|
||||
|
||||
export interface GeneratedEmbedding {
|
||||
embedding: number[]
|
||||
@@ -13,43 +22,21 @@ export interface GeneratedEmbedding {
|
||||
endTime?: number
|
||||
}
|
||||
|
||||
export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
const {
|
||||
updateTaskStatusActivity,
|
||||
getEmbeddingContextActivity,
|
||||
generateImageEmbeddingActivity,
|
||||
generateVideoChunkEmbeddingActivity,
|
||||
saveAssetEmbeddingsActivity,
|
||||
updateTaskUsageActivity,
|
||||
createCommentActivity,
|
||||
updateCommentActivity,
|
||||
getAgentWorkerQueueActivity,
|
||||
getTranscodeWorkerQueueActivity,
|
||||
transcodeVideoChunkActivity,
|
||||
deleteS3ObjectActivity,
|
||||
} = getActivities()
|
||||
export type { ExistingAssetEmbeddingInfo }
|
||||
|
||||
export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
let placeholderCommentId: string | undefined
|
||||
let agentWorkerQueue = ''
|
||||
let transcodeWorkerQueue: string
|
||||
|
||||
try {
|
||||
// 0. Discover queues
|
||||
agentWorkerQueue = await executeActivity(TaskQueueAgent, getAgentWorkerQueueActivity)
|
||||
transcodeWorkerQueue = await executeActivity(
|
||||
TaskQueueTranscode,
|
||||
getTranscodeWorkerQueueActivity,
|
||||
)
|
||||
|
||||
// Update status to processing
|
||||
await executeActivity(agentWorkerQueue, updateTaskStatusActivity, {
|
||||
await updateTaskStatusActivity({
|
||||
taskId: task.id,
|
||||
status: 'processing',
|
||||
})
|
||||
|
||||
// 0. Create Placeholder Comment
|
||||
const payload = task.payload
|
||||
const placeholder = await executeActivity(agentWorkerQueue, createCommentActivity, {
|
||||
const placeholder = await createCommentActivity({
|
||||
assetId: task.assetId,
|
||||
message: '__EMBEDDING__',
|
||||
sessionId: payload?.agent?.sessionId || task.id,
|
||||
@@ -62,15 +49,45 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
|
||||
// 1. Fetch Agent Context
|
||||
const context = await executeActivity(agentWorkerQueue, getEmbeddingContextActivity, {
|
||||
const context = (await getEmbeddingContextActivity({
|
||||
teamId: task.teamId,
|
||||
assetId: task.assetId,
|
||||
})
|
||||
})) as unknown as {
|
||||
asset: {
|
||||
id: string
|
||||
mediaType: string | null
|
||||
storageKey?: { key: string } | null
|
||||
media?: unknown
|
||||
}
|
||||
chunkDuration: number
|
||||
chunkOverlap: number
|
||||
embeddingProvider: string
|
||||
existingEmbeddings?: ExistingAssetEmbeddingInfo[]
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const { asset, chunkDuration, chunkOverlap } = context as any
|
||||
const { asset, chunkDuration, chunkOverlap, embeddingProvider, existingEmbeddings } = context
|
||||
const isGemmaProvider = embeddingProvider === 'gemma-embedding-2-openai'
|
||||
|
||||
const isImage = asset.mediaType?.startsWith('image/')
|
||||
const existing = existingEmbeddings || []
|
||||
|
||||
// Purge incompatible embeddings (e.g. 1536d when Gemma is used, or 768d when Gemini is used)
|
||||
const incompatibleIds = existing
|
||||
.filter((e) => (isGemmaProvider ? e.has1536 || !e.has768 : e.has768 || !e.has1536))
|
||||
.map((e) => e.id)
|
||||
|
||||
if (incompatibleIds.length > 0) {
|
||||
await deleteAssetEmbeddingsActivity({
|
||||
assetId: task.assetId,
|
||||
ids: incompatibleIds,
|
||||
})
|
||||
}
|
||||
|
||||
const validExistingChunks = existing.filter((e) => !incompatibleIds.includes(e.id))
|
||||
|
||||
const mediaInfo = asset.media as PrismaJson.MediaInfo | null
|
||||
const is3dWithViews =
|
||||
mediaInfo?.proxyType === '3d' && (mediaInfo.imageTranscodes?.length ?? 0) > 0
|
||||
const isImage = asset.mediaType?.startsWith('image/') || is3dWithViews
|
||||
const isVideo = asset.mediaType?.startsWith('video/')
|
||||
|
||||
if (!isImage && !isVideo) {
|
||||
@@ -110,23 +127,30 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
throw ApplicationFailure.create({ message: 'asset has no key', nonRetryable: true })
|
||||
}
|
||||
|
||||
const results: GeneratedEmbedding[] = []
|
||||
const usage = {
|
||||
model: 'gemini-embedding-2',
|
||||
model: isGemmaProvider ? 'gemma-embedding-2-openai' : 'gemini-embedding-2',
|
||||
inputTokens: 0,
|
||||
outputTokens: 0,
|
||||
}
|
||||
|
||||
if (isImage) {
|
||||
const result = await executeActivity(agentWorkerQueue, generateImageEmbeddingActivity, {
|
||||
teamId: task.teamId,
|
||||
assetKey: embeddingKey,
|
||||
mediaType: embeddingMediaType,
|
||||
})
|
||||
results.push({ embedding: result.embedding })
|
||||
if (result.usage) {
|
||||
usage.inputTokens += result.usage.inputTokens || 0
|
||||
usage.outputTokens += result.usage.outputTokens || 0
|
||||
const alreadyEmbedded = validExistingChunks.some(
|
||||
(e) => e.startTime === null && e.endTime === null,
|
||||
)
|
||||
if (!alreadyEmbedded) {
|
||||
const result = await generateImageEmbeddingActivity({
|
||||
teamId: task.teamId,
|
||||
assetKey: embeddingKey,
|
||||
mediaType: embeddingMediaType || 'image/jpeg',
|
||||
})
|
||||
await saveAssetEmbeddingsActivity({
|
||||
assetId: task.assetId,
|
||||
embeddings: [{ embedding: result.embedding }],
|
||||
})
|
||||
if (result.usage) {
|
||||
usage.inputTokens += result.usage.inputTokens || 0
|
||||
usage.outputTokens += result.usage.outputTokens || 0
|
||||
}
|
||||
}
|
||||
} else if (isVideo) {
|
||||
// Get video duration
|
||||
@@ -142,30 +166,50 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
end = duration
|
||||
}
|
||||
|
||||
// Check if this chunk is already completed
|
||||
const chunkExists = validExistingChunks.some(
|
||||
(c) =>
|
||||
c.startTime !== null &&
|
||||
c.endTime !== null &&
|
||||
Math.abs(c.startTime - start) < 0.1 &&
|
||||
Math.abs(c.endTime - end) < 0.1,
|
||||
)
|
||||
|
||||
if (chunkExists) {
|
||||
// If this chunk reached the end of the video, stop
|
||||
if (end >= duration) {
|
||||
break
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// Step A: Slice chunk on transcode worker and upload to S3
|
||||
const chunkRes = await executeActivity(transcodeWorkerQueue, transcodeVideoChunkActivity, {
|
||||
const chunkRes = await transcodeVideoChunkActivity({
|
||||
assetId: asset.id,
|
||||
assetKey: embeddingKey,
|
||||
startTime: start,
|
||||
endTime: end,
|
||||
format: isGemmaProvider ? 'frames' : 'video',
|
||||
})
|
||||
const { chunkKey } = chunkRes
|
||||
|
||||
try {
|
||||
// Step B: Generate embedding on agent worker
|
||||
const chunkResult = await executeActivity(
|
||||
agentWorkerQueue,
|
||||
generateVideoChunkEmbeddingActivity,
|
||||
{
|
||||
teamId: task.teamId,
|
||||
chunkKey,
|
||||
},
|
||||
)
|
||||
const chunkResult = await generateVideoChunkEmbeddingActivity({
|
||||
teamId: task.teamId,
|
||||
chunkKey,
|
||||
})
|
||||
|
||||
results.push({
|
||||
embedding: chunkResult.embedding,
|
||||
startTime: start,
|
||||
endTime: end,
|
||||
// Step C: Save chunk embedding to database immediately
|
||||
await saveAssetEmbeddingsActivity({
|
||||
assetId: task.assetId,
|
||||
embeddings: [
|
||||
{
|
||||
embedding: chunkResult.embedding,
|
||||
startTime: start,
|
||||
endTime: end,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
if (chunkResult.usage) {
|
||||
@@ -173,8 +217,8 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
usage.outputTokens += chunkResult.usage.outputTokens || 0
|
||||
}
|
||||
} finally {
|
||||
// Step C: Delete temporary chunk from S3
|
||||
await executeActivity(transcodeWorkerQueue, deleteS3ObjectActivity, {
|
||||
// Step D: Delete temporary chunk from S3
|
||||
await deleteS3ObjectActivity({
|
||||
key: chunkKey,
|
||||
})
|
||||
}
|
||||
@@ -186,16 +230,8 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
// Save computed embeddings
|
||||
if (results.length > 0) {
|
||||
await executeActivity(agentWorkerQueue, saveAssetEmbeddingsActivity, {
|
||||
assetId: task.assetId,
|
||||
embeddings: results,
|
||||
})
|
||||
}
|
||||
|
||||
// Update Usage
|
||||
await executeActivity(agentWorkerQueue, updateTaskUsageActivity, {
|
||||
await updateTaskUsageActivity({
|
||||
taskId: task.id,
|
||||
inputTokens: usage.inputTokens,
|
||||
outputTokens: usage.outputTokens,
|
||||
@@ -204,14 +240,14 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
|
||||
// 7. Update Placeholder Comment
|
||||
if (placeholderCommentId) {
|
||||
await executeActivity(agentWorkerQueue, updateCommentActivity, {
|
||||
await updateCommentActivity({
|
||||
commentId: placeholderCommentId,
|
||||
message: 'Embedding completed successfully.',
|
||||
})
|
||||
}
|
||||
|
||||
// Update status to completed
|
||||
await executeActivity(agentWorkerQueue, updateTaskStatusActivity, {
|
||||
await updateTaskStatusActivity({
|
||||
taskId: task.id,
|
||||
status: 'completed',
|
||||
})
|
||||
@@ -219,9 +255,9 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
console.error(`AgentEmbeddingMedia failed for task ${task.id}:`, err)
|
||||
|
||||
// Update placeholder comment with error message
|
||||
if (placeholderCommentId && agentWorkerQueue) {
|
||||
if (placeholderCommentId) {
|
||||
try {
|
||||
await executeActivity(agentWorkerQueue, updateCommentActivity, {
|
||||
await updateCommentActivity({
|
||||
commentId: placeholderCommentId,
|
||||
message: `Embedding failed: ${err instanceof Error ? err.message : String(err)}`,
|
||||
})
|
||||
@@ -231,13 +267,11 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
|
||||
// Update status to failed
|
||||
if (agentWorkerQueue) {
|
||||
await executeActivity(agentWorkerQueue, updateTaskStatusActivity, {
|
||||
taskId: task.id,
|
||||
status: 'failed',
|
||||
output: { error: err instanceof Error ? err.message : String(err) },
|
||||
})
|
||||
}
|
||||
await updateTaskStatusActivity({
|
||||
taskId: task.id,
|
||||
status: 'failed',
|
||||
output: { error: err instanceof Error ? err.message : String(err) },
|
||||
})
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { queryEmbeddingForSearch } from './query-embedding-for-search'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import * as workflowUtils from '@shumai/workflow-core'
|
||||
|
||||
vi.mock('@shumai/workflow-core', async () => {
|
||||
const actual = await vi.importActual('@shumai/workflow-core')
|
||||
return {
|
||||
...actual,
|
||||
getActivities: vi.fn(),
|
||||
executeActivity: vi.fn(),
|
||||
}
|
||||
})
|
||||
|
||||
describe('Query Embedding For Search Workflow', () => {
|
||||
setupTestDbHooks()
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mockActivities holds mock functions cast to expected types
|
||||
let mockActivities: any
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
|
||||
mockActivities = {
|
||||
updateWorkflowTaskActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'updateWorkflowTaskActivity',
|
||||
}),
|
||||
generateTextEmbeddingActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'generateTextEmbeddingActivity',
|
||||
}),
|
||||
getAgentWorkerQueueActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getAgentWorkerQueueActivity',
|
||||
}),
|
||||
}
|
||||
|
||||
mockActivities.getAgentWorkerQueueActivity.mockResolvedValue('agent_queue')
|
||||
mockActivities.updateWorkflowTaskActivity.mockResolvedValue({})
|
||||
mockActivities.generateTextEmbeddingActivity.mockResolvedValue({
|
||||
embedding: [0.1, 0.2, 0.3],
|
||||
usage: { inputTokens: 4, outputTokens: 0, model: 'gemini-embedding-2' },
|
||||
})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mockActivities contains vi.fn mock functions which are cast to expected activity proxy types
|
||||
vi.mocked(workflowUtils.getActivities).mockReturnValue(mockActivities as any)
|
||||
vi.mocked(workflowUtils.executeActivity).mockImplementation(async (_queue, act, ...args) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- act is one of the mocked activities
|
||||
return (act as any)(...args)
|
||||
})
|
||||
})
|
||||
|
||||
it('should run query embedding workflow successfully', async () => {
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'query_embedding_for_search',
|
||||
status: 'pending',
|
||||
teamId: 't1',
|
||||
assetId: 'a1',
|
||||
payload: {
|
||||
projectId: 'p1',
|
||||
queryEmbeddingForSearch: {
|
||||
text: 'search query',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await queryEmbeddingForSearch(task)
|
||||
|
||||
// Verify queue discovery
|
||||
expect(mockActivities.getAgentWorkerQueueActivity).toHaveBeenCalled()
|
||||
|
||||
// Verify task processing status
|
||||
expect(mockActivities.updateWorkflowTaskActivity).toHaveBeenCalledWith({
|
||||
taskId: task.id,
|
||||
status: 'processing',
|
||||
heartbeat: true,
|
||||
})
|
||||
|
||||
// Verify embedding generation
|
||||
expect(mockActivities.generateTextEmbeddingActivity).toHaveBeenCalledWith({
|
||||
text: 'search query',
|
||||
teamId: 't1',
|
||||
})
|
||||
|
||||
// Verify completed status and details
|
||||
expect(mockActivities.updateWorkflowTaskActivity).toHaveBeenCalledWith({
|
||||
taskId: task.id,
|
||||
status: 'completed',
|
||||
output: { embedding: [0.1, 0.2, 0.3] },
|
||||
inputTokens: 4,
|
||||
outputTokens: 0,
|
||||
model: 'gemini-embedding-2',
|
||||
})
|
||||
})
|
||||
|
||||
it('should throw immediately if text is missing', async () => {
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'query_embedding_for_search',
|
||||
status: 'pending',
|
||||
teamId: 't1',
|
||||
assetId: 'a1',
|
||||
},
|
||||
})
|
||||
|
||||
await expect(queryEmbeddingForSearch(task)).rejects.toThrow(
|
||||
'Missing text in query_embedding_for_search task payload',
|
||||
)
|
||||
|
||||
// Should not call any activities because it throws before queue discovery
|
||||
expect(mockActivities.getAgentWorkerQueueActivity).not.toHaveBeenCalled()
|
||||
expect(mockActivities.updateWorkflowTaskActivity).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should handle activity failure and update task status to failed', async () => {
|
||||
mockActivities.generateTextEmbeddingActivity.mockRejectedValue(
|
||||
new Error('Embedding API failed'),
|
||||
)
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'query_embedding_for_search',
|
||||
status: 'pending',
|
||||
teamId: 't1',
|
||||
assetId: 'a1',
|
||||
payload: {
|
||||
projectId: 'p1',
|
||||
queryEmbeddingForSearch: {
|
||||
text: 'search query',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await expect(queryEmbeddingForSearch(task)).rejects.toThrow('Embedding API failed')
|
||||
|
||||
// Verify it updates task to failed
|
||||
expect(mockActivities.updateWorkflowTaskActivity).toHaveBeenCalledWith({
|
||||
taskId: task.id,
|
||||
status: 'failed',
|
||||
output: { error: 'Embedding API failed' },
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,56 +0,0 @@
|
||||
import type { WorkflowTask } from '@shumai/db'
|
||||
import { getActivities, executeActivity, TaskQueueAgent } from '@shumai/workflow-core'
|
||||
|
||||
export async function queryEmbeddingForSearch(task: WorkflowTask): Promise<void> {
|
||||
const { generateTextEmbeddingActivity, updateWorkflowTaskActivity, getAgentWorkerQueueActivity } =
|
||||
getActivities()
|
||||
|
||||
let agentWorkerQueue = ''
|
||||
|
||||
const payload = task.payload as PrismaJson.WorkflowTaskPayload | null
|
||||
const text = payload?.queryEmbeddingForSearch?.text
|
||||
|
||||
if (!text) {
|
||||
throw new Error('Missing text in query_embedding_for_search task payload')
|
||||
}
|
||||
|
||||
try {
|
||||
// 0. Discover queue
|
||||
agentWorkerQueue = await executeActivity(TaskQueueAgent, getAgentWorkerQueueActivity)
|
||||
|
||||
// 1. Mark as processing
|
||||
await executeActivity(agentWorkerQueue, updateWorkflowTaskActivity, {
|
||||
taskId: task.id,
|
||||
status: 'processing',
|
||||
heartbeat: true,
|
||||
})
|
||||
|
||||
// 2. Generate embedding
|
||||
const result = await executeActivity(agentWorkerQueue, generateTextEmbeddingActivity, {
|
||||
text,
|
||||
teamId: task.teamId!,
|
||||
})
|
||||
|
||||
// 3. Save output and complete
|
||||
await executeActivity(agentWorkerQueue, updateWorkflowTaskActivity, {
|
||||
taskId: task.id,
|
||||
status: 'completed',
|
||||
output: { embedding: result.embedding },
|
||||
inputTokens: result.usage.inputTokens,
|
||||
outputTokens: result.usage.outputTokens,
|
||||
model: result.usage.model,
|
||||
})
|
||||
} catch (err) {
|
||||
console.error(`queryEmbeddingForSearch failed for task ${task.id}:`, err)
|
||||
if (agentWorkerQueue) {
|
||||
await executeActivity(agentWorkerQueue, updateWorkflowTaskActivity, {
|
||||
taskId: task.id,
|
||||
status: 'failed',
|
||||
output: {
|
||||
error: err instanceof Error ? err.message : String(err),
|
||||
},
|
||||
})
|
||||
}
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/api",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { authzService } from '@shumai/core/src/authz/authz'
|
||||
@@ -210,6 +210,30 @@ describe('Agent API', () => {
|
||||
itemId: 'agent1',
|
||||
})
|
||||
})
|
||||
|
||||
it('returns 403 when updating embedding agent and ENABLE_EMBEDDING_AGENT is true', async () => {
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'true'
|
||||
try {
|
||||
vi.mocked(agentService.getAgent).mockResolvedValueOnce({
|
||||
id: 'agent1',
|
||||
teamId: 'team1',
|
||||
type: 'embedding',
|
||||
} as unknown as Awaited<ReturnType<typeof agentService.getAgent>>)
|
||||
|
||||
const res = await app.request('/agents/agent1', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
name: 'Updated Embedding Agent',
|
||||
type: 'embedding',
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
} finally {
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('DELETE /agents/:agentId', () => {
|
||||
@@ -227,6 +251,25 @@ describe('Agent API', () => {
|
||||
itemId: 'agent1',
|
||||
})
|
||||
})
|
||||
|
||||
it('returns 403 when deleting embedding agent and ENABLE_EMBEDDING_AGENT is true', async () => {
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'true'
|
||||
try {
|
||||
vi.mocked(agentService.getAgent).mockResolvedValueOnce({
|
||||
id: 'agent1',
|
||||
teamId: 'team1',
|
||||
type: 'embedding',
|
||||
} as unknown as Awaited<ReturnType<typeof agentService.getAgent>>)
|
||||
|
||||
const res = await app.request('/agents/agent1', {
|
||||
method: 'DELETE',
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
} finally {
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('PATCH /agents/:agentId/permission', () => {
|
||||
@@ -271,6 +314,27 @@ describe('Agent API', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('returns 403 when modifying embedding agent permission and ENABLE_EMBEDDING_AGENT is true', async () => {
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'true'
|
||||
try {
|
||||
vi.mocked(agentService.getAgent).mockResolvedValueOnce({
|
||||
id: 'agent1',
|
||||
teamId: 'team1',
|
||||
type: 'embedding',
|
||||
} as unknown as Awaited<ReturnType<typeof agentService.getAgent>>)
|
||||
|
||||
const res = await app.request('/agents/agent1/permission', {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ permission: 'owner' }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
} finally {
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
}
|
||||
})
|
||||
|
||||
it('denies access when user is not admin', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockRejectedValue(
|
||||
new HTTPException(403, { message: 'Forbidden' }),
|
||||
@@ -410,4 +474,138 @@ describe('Agent API', () => {
|
||||
expect(agentService.listProjectChatAgents).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('read-only embedding agent when ENABLE_EMBEDDING_AGENT is true', () => {
|
||||
beforeEach(() => {
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'true'
|
||||
vi.mocked(agentService.getAgent).mockResolvedValue({
|
||||
id: 'emb1',
|
||||
teamId: 'team1',
|
||||
type: 'embedding',
|
||||
} as unknown as Awaited<ReturnType<typeof agentService.getAgent>>)
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
})
|
||||
|
||||
it('rejects PUT /agents/:agentId with 403', async () => {
|
||||
const res = await app.request('/agents/emb1', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
name: 'Updated Embedding',
|
||||
type: 'embedding',
|
||||
enabled: false,
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(agentService.updateAgent).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects DELETE /agents/:agentId with 403', async () => {
|
||||
const res = await app.request('/agents/emb1', {
|
||||
method: 'DELETE',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(agentService.deleteAgent).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects PATCH /agents/:agentId/permission with 403', async () => {
|
||||
const res = await app.request('/agents/emb1/permission', {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
permission: 'owner',
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(agentService.updateAgentPermission).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects POST /teams/:teamId/agents with 403 for embedding agent', async () => {
|
||||
const res = await app.request('/teams/team1/agents', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
name: 'Manual Embedding',
|
||||
type: 'embedding',
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(agentService.createAgent).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('read-only embedding agent when ENABLE_EMBEDDING_AGENT is false', () => {
|
||||
beforeEach(() => {
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'false'
|
||||
vi.mocked(agentService.getAgent).mockResolvedValue({
|
||||
id: 'emb1',
|
||||
teamId: 'team1',
|
||||
type: 'embedding',
|
||||
} as unknown as Awaited<ReturnType<typeof agentService.getAgent>>)
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
})
|
||||
|
||||
it('rejects PUT /agents/:agentId with 403', async () => {
|
||||
const res = await app.request('/agents/emb1', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
name: 'Updated Embedding',
|
||||
type: 'embedding',
|
||||
enabled: false,
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(agentService.updateAgent).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects DELETE /agents/:agentId with 403', async () => {
|
||||
const res = await app.request('/agents/emb1', {
|
||||
method: 'DELETE',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(agentService.deleteAgent).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects PATCH /agents/:agentId/permission with 403', async () => {
|
||||
const res = await app.request('/agents/emb1/permission', {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
permission: 'owner',
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(agentService.updateAgentPermission).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects POST /teams/:teamId/agents with 403 for embedding agent', async () => {
|
||||
const res = await app.request('/teams/team1/agents', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
name: 'Manual Embedding',
|
||||
type: 'embedding',
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(agentService.createAgent).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Hono } from 'hono'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { zValidator } from '@hono/zod-validator'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
@@ -62,6 +63,16 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const isEmbeddingManagedByEnv =
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'true' ||
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'false'
|
||||
|
||||
if (req.type === 'embedding' && isEmbeddingManagedByEnv) {
|
||||
throw new HTTPException(403, {
|
||||
message: 'Embedding agent is managed by environment configuration and cannot be created',
|
||||
})
|
||||
}
|
||||
|
||||
const agent = await agentService.createAgent({
|
||||
teamId,
|
||||
...req,
|
||||
@@ -92,6 +103,17 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: agentId,
|
||||
})
|
||||
|
||||
const isEmbeddingManagedByEnv =
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'true' ||
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'false'
|
||||
|
||||
const existingAgent = await agentService.getAgent({ agentId })
|
||||
if (existingAgent?.type === 'embedding' && isEmbeddingManagedByEnv) {
|
||||
throw new HTTPException(403, {
|
||||
message: 'Embedding agent is managed by environment configuration and cannot be modified',
|
||||
})
|
||||
}
|
||||
|
||||
const agent = await agentService.updateAgent({
|
||||
agentId,
|
||||
...req,
|
||||
@@ -123,6 +145,17 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: agentId,
|
||||
})
|
||||
|
||||
const isEmbeddingManagedByEnv =
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'true' ||
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'false'
|
||||
|
||||
const existingAgent = await agentService.getAgent({ agentId })
|
||||
if (existingAgent?.type === 'embedding' && isEmbeddingManagedByEnv) {
|
||||
throw new HTTPException(403, {
|
||||
message: 'Embedding agent is managed by environment configuration and cannot be modified',
|
||||
})
|
||||
}
|
||||
|
||||
const agent = await agentService.updateAgentPermission(agentId, req.permission)
|
||||
|
||||
await auditLogService.logAction({
|
||||
@@ -148,7 +181,16 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: agentId,
|
||||
})
|
||||
|
||||
const isEmbeddingManagedByEnv =
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'true' ||
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'false'
|
||||
|
||||
const existingAgent = await agentService.getAgent({ agentId })
|
||||
if (existingAgent?.type === 'embedding' && isEmbeddingManagedByEnv) {
|
||||
throw new HTTPException(403, {
|
||||
message: 'Embedding agent is managed by environment configuration and cannot be deleted',
|
||||
})
|
||||
}
|
||||
|
||||
await agentService.deleteAgent({
|
||||
agentId,
|
||||
|
||||
@@ -774,4 +774,47 @@ describe('file api', () => {
|
||||
|
||||
mockGetProjectIds.mockRestore()
|
||||
})
|
||||
|
||||
describe('GET /files/:fileId/m3u8 routes', () => {
|
||||
it('returns master playlist with correct content-type', async () => {
|
||||
const mockMaster = vi
|
||||
.spyOn(assetService, 'getHlsMasterPlaylist')
|
||||
.mockResolvedValue('#EXTM3U\n#EXT-X-STREAM-INF:BANDWIDTH=4628000\n1080p/index.m3u8\n')
|
||||
|
||||
const app = new Hono().use('*', authMiddleware).route('/', fileRoute)
|
||||
const res = await app.request('/files/asset-1/m3u8/master.m3u8')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.headers.get('content-type')).toContain('application/vnd.apple.mpegurl')
|
||||
const text = await res.text()
|
||||
expect(text).toContain('#EXTM3U')
|
||||
expect(text).toContain('1080p/index.m3u8')
|
||||
expect(mockMaster).toHaveBeenCalledWith({ assetId: 'asset-1' })
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: { id: 'user1', name: 'Test User' },
|
||||
permission: Permission.Read,
|
||||
type: 'asset',
|
||||
id: 'asset-1',
|
||||
})
|
||||
mockMaster.mockRestore()
|
||||
})
|
||||
|
||||
it('returns variant playlist with rewritten URLs', async () => {
|
||||
const mockVariant = vi
|
||||
.spyOn(assetService, 'getHlsVariantPlaylist')
|
||||
.mockResolvedValue(
|
||||
'#EXTM3U\n#EXT-X-MAP:URI="http://presigned/init.mp4"\nhttp://presigned/seg0.m4s\n',
|
||||
)
|
||||
|
||||
const app = new Hono().use('*', authMiddleware).route('/', fileRoute)
|
||||
const res = await app.request('/files/asset-1/m3u8/1080p/index.m3u8')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.headers.get('content-type')).toContain('application/vnd.apple.mpegurl')
|
||||
const text = await res.text()
|
||||
expect(text).toContain('http://presigned/init.mp4')
|
||||
expect(mockVariant).toHaveBeenCalledWith({ assetId: 'asset-1', resolution: '1080p' })
|
||||
mockVariant.mockRestore()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -480,5 +480,70 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
return c.json({ url })
|
||||
},
|
||||
)
|
||||
.get('/files/:fileId/m3u8', async (c) => {
|
||||
const fileId = c.req.param('fileId')
|
||||
const user = c.get('user')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Asset,
|
||||
id: fileId,
|
||||
})
|
||||
|
||||
const playlist = await assetService.getHlsMasterPlaylist({ assetId: fileId })
|
||||
c.header('Content-Type', 'application/vnd.apple.mpegurl')
|
||||
return c.body(playlist)
|
||||
})
|
||||
.get('/files/:fileId/m3u8/master.m3u8', async (c) => {
|
||||
const fileId = c.req.param('fileId')
|
||||
const user = c.get('user')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Asset,
|
||||
id: fileId,
|
||||
})
|
||||
|
||||
const playlist = await assetService.getHlsMasterPlaylist({ assetId: fileId })
|
||||
c.header('Content-Type', 'application/vnd.apple.mpegurl')
|
||||
return c.body(playlist)
|
||||
})
|
||||
.get('/files/:fileId/m3u8/:resolution', async (c) => {
|
||||
const fileId = c.req.param('fileId')
|
||||
let resolution = c.req.param('resolution')
|
||||
if (resolution.endsWith('.m3u8')) {
|
||||
resolution = resolution.replace(/\.m3u8$/, '')
|
||||
}
|
||||
const user = c.get('user')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Asset,
|
||||
id: fileId,
|
||||
})
|
||||
|
||||
const playlist = await assetService.getHlsVariantPlaylist({ assetId: fileId, resolution })
|
||||
c.header('Content-Type', 'application/vnd.apple.mpegurl')
|
||||
return c.body(playlist)
|
||||
})
|
||||
.get('/files/:fileId/m3u8/:resolution/index.m3u8', async (c) => {
|
||||
const fileId = c.req.param('fileId')
|
||||
const resolution = c.req.param('resolution')
|
||||
const user = c.get('user')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Asset,
|
||||
id: fileId,
|
||||
})
|
||||
|
||||
const playlist = await assetService.getHlsVariantPlaylist({ assetId: fileId, resolution })
|
||||
c.header('Content-Type', 'application/vnd.apple.mpegurl')
|
||||
return c.body(playlist)
|
||||
})
|
||||
|
||||
export default route
|
||||
|
||||
@@ -2,27 +2,34 @@ import { describe, expect, it, vi, beforeEach } from 'vitest'
|
||||
import { Hono, type Context, type Next } from 'hono'
|
||||
import notificationRoute from './notification'
|
||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
import { emailService } from '@shumai/core/src/notification/email'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { userMetadataService } from '@shumai/core/src/user-metadata/user-metadata'
|
||||
|
||||
const mockUser = { id: 'user1', name: 'Test User', email: 'test@example.com' }
|
||||
|
||||
vi.mock('./middleware/auth', () => ({
|
||||
authMiddleware: async (
|
||||
c: Context<{ Variables: { user: { id: string; name: string } } }>,
|
||||
next: Next,
|
||||
) => {
|
||||
c.set('user', { id: 'user1', name: 'Test User' })
|
||||
authMiddleware: async (c: Context<{ Variables: { user: typeof mockUser } }>, next: Next) => {
|
||||
c.set('user', mockUser)
|
||||
await next()
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/core/src/authz/authz')
|
||||
vi.mock('@shumai/core/src/notification/notification')
|
||||
vi.mock('@shumai/core/src/notification/email', () => ({
|
||||
emailService: {
|
||||
getEmailSettings: vi.fn(),
|
||||
updateEmailSettings: vi.fn(),
|
||||
sendTestEmail: vi.fn(),
|
||||
},
|
||||
}))
|
||||
vi.mock('@shumai/core/src/user-metadata/user-metadata')
|
||||
|
||||
describe('notification api', () => {
|
||||
const app = new Hono<{ Variables: { user: { id: string; name: string } } }>()
|
||||
const app = new Hono<{ Variables: { user: typeof mockUser } }>()
|
||||
.use('*', async (c, next) => {
|
||||
c.set('user', { id: 'user1', name: 'Test User' })
|
||||
c.set('user', mockUser)
|
||||
await next()
|
||||
})
|
||||
.route('/', notificationRoute)
|
||||
@@ -155,4 +162,100 @@ describe('notification api', () => {
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
it('GET /teams/:teamId/notifications/email - requires admin and returns settings', async () => {
|
||||
const mockSettings = {
|
||||
enabled: true,
|
||||
host: 'smtp.example.com',
|
||||
port: 587,
|
||||
username: 'user',
|
||||
password: 'secret-password',
|
||||
smtps: true,
|
||||
ignoreCert: false,
|
||||
from: 'noreply@example.com',
|
||||
replyTo: '',
|
||||
}
|
||||
vi.mocked(emailService.getEmailSettings).mockResolvedValue(mockSettings)
|
||||
|
||||
const res = await app.request('/teams/t1/notifications/email')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const json = await res.json()
|
||||
expect(json).toEqual(mockSettings)
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: expect.objectContaining({ id: 'user1' }),
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
})
|
||||
expect(emailService.getEmailSettings).toHaveBeenCalledWith('t1')
|
||||
})
|
||||
|
||||
it('PUT /teams/:teamId/notifications/email - requires admin and updates settings', async () => {
|
||||
const updateInput = {
|
||||
enabled: true,
|
||||
host: 'mail.example.com',
|
||||
port: 465,
|
||||
username: 'user',
|
||||
password: 'new-password',
|
||||
smtps: true,
|
||||
ignoreCert: false,
|
||||
from: 'shumai@example.com',
|
||||
replyTo: 'support@example.com',
|
||||
}
|
||||
vi.mocked(emailService.updateEmailSettings).mockResolvedValue(updateInput)
|
||||
|
||||
const res = await app.request('/teams/t1/notifications/email', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(updateInput),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const json = await res.json()
|
||||
expect(json).toEqual(updateInput)
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: expect.objectContaining({ id: 'user1' }),
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
})
|
||||
expect(emailService.updateEmailSettings).toHaveBeenCalledWith('t1', updateInput)
|
||||
})
|
||||
|
||||
it('POST /teams/:teamId/notifications/email/test - requires admin and sends test email', async () => {
|
||||
const testReq = {
|
||||
host: 'smtp.example.com',
|
||||
port: 587,
|
||||
from: 'noreply@example.com',
|
||||
}
|
||||
vi.mocked(emailService.sendTestEmail).mockResolvedValue({
|
||||
success: true,
|
||||
messageId: '<test-msg-id@example.com>',
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/notifications/email/test', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(testReq),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const json = await res.json()
|
||||
expect(json).toEqual({
|
||||
success: true,
|
||||
messageId: '<test-msg-id@example.com>',
|
||||
})
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: expect.objectContaining({ id: 'user1' }),
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
})
|
||||
expect(emailService.sendTestEmail).toHaveBeenCalledWith(
|
||||
't1',
|
||||
expect.objectContaining({ id: 'user1', email: 'test@example.com' }),
|
||||
testReq,
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { zValidator } from '@hono/zod-validator'
|
||||
import { Hono } from 'hono'
|
||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
import { emailService } from '@shumai/core/src/notification/email'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import {
|
||||
listNotificationsRequestSchema,
|
||||
markNotificationReadRequestSchema,
|
||||
notificationSettingsSchema,
|
||||
updateEmailNotificationSettingsSchema,
|
||||
testEmailRequestSchema,
|
||||
} from '@shumai/dtos'
|
||||
import { userMetadataService } from '@shumai/core/src/user-metadata/user-metadata'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
@@ -109,5 +112,57 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
return c.json({ success: true })
|
||||
},
|
||||
)
|
||||
.get('/teams/:teamId/notifications/email', async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
const user = c.get('user')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const settings = await emailService.getEmailSettings(teamId)
|
||||
return c.json(settings)
|
||||
})
|
||||
.put(
|
||||
'/teams/:teamId/notifications/email',
|
||||
zValidator('json', updateEmailNotificationSettingsSchema),
|
||||
async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
const user = c.get('user')
|
||||
const req = c.req.valid('json')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const settings = await emailService.updateEmailSettings(teamId, req)
|
||||
return c.json(settings)
|
||||
},
|
||||
)
|
||||
.post(
|
||||
'/teams/:teamId/notifications/email/test',
|
||||
zValidator('json', testEmailRequestSchema),
|
||||
async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
const user = c.get('user')
|
||||
const req = c.req.valid('json')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const result = await emailService.sendTestEmail(teamId, user, req)
|
||||
return c.json(result)
|
||||
},
|
||||
)
|
||||
|
||||
export default route
|
||||
|
||||
@@ -38,9 +38,12 @@ import type { AssetInfo } from '@shumai/dtos'
|
||||
async function applyWatermarkToAssetMedia(
|
||||
asset: AssetInfo,
|
||||
watermarkMedia: PrismaJson.MediaInfo | null,
|
||||
shareId?: string,
|
||||
password?: string,
|
||||
): Promise<AssetInfo> {
|
||||
if (!asset.media) return asset
|
||||
if (asset.proxyType !== 'video' && asset.proxyType !== 'image') return asset
|
||||
if (asset.proxyType !== 'video' && asset.proxyType !== 'image' && asset.proxyType !== '3d')
|
||||
return asset
|
||||
|
||||
const updatedMedia = { ...asset.media }
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
@@ -55,10 +58,28 @@ async function applyWatermarkToAssetMedia(
|
||||
width: vt.width ?? 0,
|
||||
height: vt.height ?? 0,
|
||||
size: 0,
|
||||
hdr: vt.hdr,
|
||||
resolution: vt.resolution,
|
||||
})),
|
||||
)
|
||||
: []
|
||||
|
||||
if (watermarkMedia?.videoTranscodes && watermarkMedia.videoTranscodes.length > 0) {
|
||||
if (updatedMedia.videoPreview) {
|
||||
const watermarkedKey =
|
||||
watermarkMedia.videoPreview?.key || watermarkMedia.videoTranscodes[0]?.key
|
||||
if (watermarkedKey) {
|
||||
updatedMedia.videoPreview = {
|
||||
...updatedMedia.videoPreview,
|
||||
key: watermarkedKey,
|
||||
url: await s3Service.presign(bucket, watermarkedKey, 'GET'),
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
delete updatedMedia.videoPreview
|
||||
}
|
||||
|
||||
updatedMedia.imageTranscodes =
|
||||
watermarkMedia?.imageTranscodes && watermarkMedia.imageTranscodes.length > 0
|
||||
? await Promise.all(
|
||||
@@ -73,6 +94,19 @@ async function applyWatermarkToAssetMedia(
|
||||
)
|
||||
: []
|
||||
|
||||
if (watermarkMedia?.isHls && watermarkMedia.hls?.key && shareId) {
|
||||
const pwQuery = password ? `?p=${encodeURIComponent(password)}` : ''
|
||||
updatedMedia.isHls = true
|
||||
updatedMedia.hls = {
|
||||
key: watermarkMedia.hls.key,
|
||||
url: `/api/shares/${shareId}/files/${asset.id}/m3u8/master.m3u8${pwQuery}`,
|
||||
resolutions: watermarkMedia.hls.resolutions,
|
||||
}
|
||||
} else {
|
||||
updatedMedia.isHls = false
|
||||
delete updatedMedia.hls
|
||||
}
|
||||
|
||||
return {
|
||||
...asset,
|
||||
media: updatedMedia,
|
||||
@@ -169,7 +203,8 @@ const route = app
|
||||
zValidator('query', sharedChildrenRequestSchema),
|
||||
async (c) => {
|
||||
const folderId = c.req.param('folderId')
|
||||
const password = c.req.header('x-share-password')
|
||||
const password =
|
||||
c.req.header('x-share-password') || c.req.query('password') || c.req.query('p')
|
||||
const req = c.req.valid('query')
|
||||
|
||||
try {
|
||||
@@ -196,7 +231,7 @@ const route = app
|
||||
// Resolve symlink targets once and reuse for the media lookup, so each
|
||||
// item costs a single query instead of two.
|
||||
const targetIds = await Promise.all(
|
||||
res.data.map((item) => assetService.resolveTargetAssetId(item.id)),
|
||||
res.data.map((item) => assetService.resolveLatestVersionId(item.id)),
|
||||
)
|
||||
const wfMap = await watermarkService.getCompletedWatermarkMediaMap(
|
||||
targetIds,
|
||||
@@ -205,9 +240,21 @@ const route = app
|
||||
|
||||
res.data = await Promise.all(
|
||||
res.data.map(async (item, index) =>
|
||||
applyWatermarkToAssetMedia(item, wfMap.get(targetIds[index]) ?? null),
|
||||
applyWatermarkToAssetMedia(
|
||||
item,
|
||||
wfMap.get(targetIds[index]) ?? null,
|
||||
shareLink.id,
|
||||
password,
|
||||
),
|
||||
),
|
||||
)
|
||||
} else if (res.data.length > 0) {
|
||||
const pwQuery = password ? `?p=${encodeURIComponent(password)}` : ''
|
||||
for (const item of res.data) {
|
||||
if (item.media?.isHls && item.media.hls?.key) {
|
||||
item.media.hls.url = `/api/shares/${shareLink.id}/files/${item.id}/m3u8/master.m3u8${pwQuery}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return c.json(res)
|
||||
@@ -218,25 +265,33 @@ const route = app
|
||||
)
|
||||
.get('/shares/:shareId/files/:fileId', async (c) => {
|
||||
const fileId = c.req.param('fileId')
|
||||
const password = c.req.header('x-share-password')
|
||||
const password = c.req.header('x-share-password') || c.req.query('password') || c.req.query('p')
|
||||
|
||||
try {
|
||||
const shareLink = await shareService.verifyPublicAccess(fileId, password)
|
||||
|
||||
let asset = await assetService.getAsset({ assetId: fileId })
|
||||
|
||||
// Only video/image assets are subject to watermark protection; skip the
|
||||
// Only video/image/3d assets are subject to watermark protection; skip the
|
||||
// watermark lookup entirely for other media types (pdf, audio, ...).
|
||||
if (
|
||||
shareLink.watermarkConfigId &&
|
||||
(asset.proxyType === 'video' || asset.proxyType === 'image')
|
||||
(asset.proxyType === 'video' || asset.proxyType === 'image' || asset.proxyType === '3d')
|
||||
) {
|
||||
const targetAssetId = await assetService.resolveTargetAssetId(fileId)
|
||||
const targetAssetId = await assetService.resolveLatestVersionId(fileId)
|
||||
const wfMap = await watermarkService.getCompletedWatermarkMediaMap(
|
||||
[targetAssetId],
|
||||
shareLink.watermarkConfigId,
|
||||
)
|
||||
asset = await applyWatermarkToAssetMedia(asset, wfMap.get(targetAssetId) ?? null)
|
||||
asset = await applyWatermarkToAssetMedia(
|
||||
asset,
|
||||
wfMap.get(targetAssetId) ?? null,
|
||||
shareLink.id,
|
||||
password,
|
||||
)
|
||||
} else if (asset.media?.isHls && asset.media.hls?.key) {
|
||||
const pwQuery = password ? `?p=${encodeURIComponent(password)}` : ''
|
||||
asset.media.hls.url = `/api/shares/${shareLink.id}/files/${asset.id}/m3u8/master.m3u8${pwQuery}`
|
||||
}
|
||||
|
||||
return c.json(asset)
|
||||
@@ -359,5 +414,92 @@ const route = app
|
||||
}
|
||||
},
|
||||
)
|
||||
.get('/shares/:shareId/files/:fileId/m3u8', async (c) => {
|
||||
const fileId = c.req.param('fileId')
|
||||
const password = c.req.header('x-share-password') || c.req.query('password') || c.req.query('p')
|
||||
|
||||
try {
|
||||
const shareLink = await shareService.verifyPublicAccess(fileId, password)
|
||||
const targetAssetId = await assetService.resolveLatestVersionId(fileId)
|
||||
let playlist = await assetService.getHlsMasterPlaylist({
|
||||
assetId: targetAssetId,
|
||||
watermarkConfigId: shareLink.watermarkConfigId,
|
||||
})
|
||||
if (password) {
|
||||
playlist = playlist.replace(
|
||||
/([0-9]+p\/index\.m3u8)/g,
|
||||
`$1?p=${encodeURIComponent(password)}`,
|
||||
)
|
||||
}
|
||||
c.header('Content-Type', 'application/vnd.apple.mpegurl')
|
||||
return c.body(playlist)
|
||||
} catch (err) {
|
||||
return handlePublicShareError(c, err)
|
||||
}
|
||||
})
|
||||
.get('/shares/:shareId/files/:fileId/m3u8/master.m3u8', async (c) => {
|
||||
const fileId = c.req.param('fileId')
|
||||
const password = c.req.header('x-share-password') || c.req.query('password') || c.req.query('p')
|
||||
|
||||
try {
|
||||
const shareLink = await shareService.verifyPublicAccess(fileId, password)
|
||||
const targetAssetId = await assetService.resolveLatestVersionId(fileId)
|
||||
let playlist = await assetService.getHlsMasterPlaylist({
|
||||
assetId: targetAssetId,
|
||||
watermarkConfigId: shareLink.watermarkConfigId,
|
||||
})
|
||||
if (password) {
|
||||
playlist = playlist.replace(
|
||||
/([0-9]+p\/index\.m3u8)/g,
|
||||
`$1?p=${encodeURIComponent(password)}`,
|
||||
)
|
||||
}
|
||||
c.header('Content-Type', 'application/vnd.apple.mpegurl')
|
||||
return c.body(playlist)
|
||||
} catch (err) {
|
||||
return handlePublicShareError(c, err)
|
||||
}
|
||||
})
|
||||
.get('/shares/:shareId/files/:fileId/m3u8/:resolution', async (c) => {
|
||||
const fileId = c.req.param('fileId')
|
||||
let resolution = c.req.param('resolution')
|
||||
if (resolution.endsWith('.m3u8')) {
|
||||
resolution = resolution.replace(/\.m3u8$/, '')
|
||||
}
|
||||
const password = c.req.header('x-share-password') || c.req.query('password') || c.req.query('p')
|
||||
|
||||
try {
|
||||
const shareLink = await shareService.verifyPublicAccess(fileId, password)
|
||||
const targetAssetId = await assetService.resolveLatestVersionId(fileId)
|
||||
const playlist = await assetService.getHlsVariantPlaylist({
|
||||
assetId: targetAssetId,
|
||||
resolution,
|
||||
watermarkConfigId: shareLink.watermarkConfigId,
|
||||
})
|
||||
c.header('Content-Type', 'application/vnd.apple.mpegurl')
|
||||
return c.body(playlist)
|
||||
} catch (err) {
|
||||
return handlePublicShareError(c, err)
|
||||
}
|
||||
})
|
||||
.get('/shares/:shareId/files/:fileId/m3u8/:resolution/index.m3u8', async (c) => {
|
||||
const fileId = c.req.param('fileId')
|
||||
const resolution = c.req.param('resolution')
|
||||
const password = c.req.header('x-share-password') || c.req.query('password') || c.req.query('p')
|
||||
|
||||
try {
|
||||
const shareLink = await shareService.verifyPublicAccess(fileId, password)
|
||||
const targetAssetId = await assetService.resolveLatestVersionId(fileId)
|
||||
const playlist = await assetService.getHlsVariantPlaylist({
|
||||
assetId: targetAssetId,
|
||||
resolution,
|
||||
watermarkConfigId: shareLink.watermarkConfigId,
|
||||
})
|
||||
c.header('Content-Type', 'application/vnd.apple.mpegurl')
|
||||
return c.body(playlist)
|
||||
} catch (err) {
|
||||
return handlePublicShareError(c, err)
|
||||
}
|
||||
})
|
||||
|
||||
export default route
|
||||
|
||||
@@ -277,6 +277,12 @@ describe('Share API', () => {
|
||||
},
|
||||
],
|
||||
imageTranscodes: [],
|
||||
isHls: true,
|
||||
hls: {
|
||||
key: 'files/orig-hls/master.m3u8',
|
||||
url: '/api/files/video-pending/m3u8/master.m3u8',
|
||||
resolutions: [{ resolution: '1080p', width: 1920, height: 1080 }],
|
||||
},
|
||||
original: { key: 'files/orig.mp4' },
|
||||
},
|
||||
},
|
||||
@@ -331,9 +337,11 @@ describe('Share API', () => {
|
||||
size: 0,
|
||||
},
|
||||
])
|
||||
// Pending item → original transcodes emptied
|
||||
// Pending item → original transcodes emptied and HLS cleared
|
||||
expect(body.data[1].media.videoTranscodes).toEqual([])
|
||||
expect(body.data[1].media.imageTranscodes).toEqual([])
|
||||
expect(body.data[1].media.isHls).toBe(false)
|
||||
expect(body.data[1].media.hls).toBeUndefined()
|
||||
// Non-media item → untouched
|
||||
expect(body.data[2].media.pdfTranscode).toEqual({ url: 'u', key: 'files/doc.pdf' })
|
||||
})
|
||||
@@ -418,6 +426,51 @@ describe('Share API', () => {
|
||||
expect(body.media.imageTranscodes).toEqual([])
|
||||
})
|
||||
|
||||
test('serves watermarked transcodes with hdr flags preserved when watermark enabled and completed', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue(shareLinkWithWatermark)
|
||||
vi.spyOn(watermarkService, 'getCompletedWatermarkMediaMap').mockResolvedValue(
|
||||
new Map([
|
||||
[
|
||||
'file1',
|
||||
watermarkMediaInfo({
|
||||
videoTranscodes: [
|
||||
{ key: 'files/watermarked-1080p.mp4', width: 1920, height: 1080, hdr: false },
|
||||
{ key: 'files/watermarked-1080p-hdr.mp4', width: 1920, height: 1080, hdr: true },
|
||||
],
|
||||
}),
|
||||
],
|
||||
]),
|
||||
)
|
||||
|
||||
const res = await app.request('/shares/share1/files/file1', {
|
||||
method: 'GET',
|
||||
headers: { 'x-share-password': 'pass' },
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body.media.videoTranscodes).toEqual([
|
||||
{
|
||||
id: 'files/watermarked-1080p.mp4',
|
||||
url: 'http://s3/presigned',
|
||||
key: 'files/watermarked-1080p.mp4',
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
size: 0,
|
||||
hdr: false,
|
||||
},
|
||||
{
|
||||
id: 'files/watermarked-1080p-hdr.mp4',
|
||||
url: 'http://s3/presigned',
|
||||
key: 'files/watermarked-1080p-hdr.mp4',
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
size: 0,
|
||||
hdr: true,
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
test('serves empty transcode arrays while watermark transcoding is in flight', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue(shareLinkWithWatermark)
|
||||
vi.spyOn(watermarkService, 'getCompletedWatermarkMediaMap').mockResolvedValue(new Map())
|
||||
@@ -433,6 +486,148 @@ describe('Share API', () => {
|
||||
expect(body.media.imageTranscodes).toEqual([])
|
||||
})
|
||||
|
||||
test('clears HLS fields while watermark transcoding is in flight', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue(shareLinkWithWatermark)
|
||||
vi.spyOn(watermarkService, 'getCompletedWatermarkMediaMap').mockResolvedValue(new Map())
|
||||
vi.spyOn(assetService, 'getAsset').mockResolvedValue({
|
||||
...videoAsset,
|
||||
media: {
|
||||
...videoAsset.media,
|
||||
isHls: true,
|
||||
hls: {
|
||||
key: 'files/hls/master.m3u8',
|
||||
url: '/api/files/file1/m3u8/master.m3u8',
|
||||
resolutions: [{ resolution: '1080p', width: 1920, height: 1080 }],
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const res = await app.request('/shares/share1/files/file1', {
|
||||
method: 'GET',
|
||||
headers: { 'x-share-password': 'pass' },
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body.media.isHls).toBe(false)
|
||||
expect(body.media.hls).toBeUndefined()
|
||||
})
|
||||
|
||||
test('serves watermarked turntable video for a 3d asset when watermark enabled and completed', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue(shareLinkWithWatermark)
|
||||
const asset3d = {
|
||||
id: 'file1',
|
||||
name: 'model.glb',
|
||||
sizeByte: 1024,
|
||||
fileCount: 0,
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
proxyType: '3d',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
videoPreview: {
|
||||
url: 'http://s3/unwatermarked-turntable.mp4',
|
||||
key: 'files/turntable.mp4',
|
||||
},
|
||||
videoTranscodes: [
|
||||
{
|
||||
id: 'orig-turntable',
|
||||
url: 'http://s3/unwatermarked-turntable.mp4',
|
||||
key: 'files/turntable.mp4',
|
||||
width: 1080,
|
||||
height: 1080,
|
||||
},
|
||||
],
|
||||
original: { key: 'files/model.glb' },
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any
|
||||
vi.spyOn(assetService, 'getAsset').mockResolvedValue(asset3d)
|
||||
vi.spyOn(watermarkService, 'getCompletedWatermarkMediaMap').mockResolvedValue(
|
||||
new Map([
|
||||
[
|
||||
'file1',
|
||||
watermarkMediaInfo({
|
||||
proxyType: '3d',
|
||||
videoTranscodes: [
|
||||
{
|
||||
key: 'files/watermarked-turntable.mp4',
|
||||
width: 1080,
|
||||
height: 1080,
|
||||
resolution: '1080p',
|
||||
},
|
||||
],
|
||||
videoPreview: { key: 'files/watermarked-turntable.mp4', width: 1080, height: 1080 },
|
||||
}),
|
||||
],
|
||||
]),
|
||||
)
|
||||
|
||||
const res = await app.request('/shares/share1/files/file1', {
|
||||
method: 'GET',
|
||||
headers: { 'x-share-password': 'pass' },
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body.media.videoTranscodes).toEqual([
|
||||
{
|
||||
id: 'files/watermarked-turntable.mp4',
|
||||
url: 'http://s3/presigned',
|
||||
key: 'files/watermarked-turntable.mp4',
|
||||
width: 1080,
|
||||
height: 1080,
|
||||
size: 0,
|
||||
resolution: '1080p',
|
||||
},
|
||||
])
|
||||
expect(body.media.videoPreview?.url).toBe('http://s3/presigned')
|
||||
expect(body.media.videoPreview?.key).toBe('files/watermarked-turntable.mp4')
|
||||
})
|
||||
|
||||
test('strips videoPreview url and serves empty videoTranscodes for a 3d asset while watermark is in flight', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue(shareLinkWithWatermark)
|
||||
const asset3d = {
|
||||
id: 'file1',
|
||||
name: 'model.glb',
|
||||
sizeByte: 1024,
|
||||
fileCount: 0,
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
proxyType: '3d',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
videoPreview: {
|
||||
url: 'http://s3/unwatermarked-turntable.mp4',
|
||||
key: 'files/turntable.mp4',
|
||||
},
|
||||
videoTranscodes: [
|
||||
{
|
||||
id: 'orig-turntable',
|
||||
url: 'http://s3/unwatermarked-turntable.mp4',
|
||||
key: 'files/turntable.mp4',
|
||||
width: 1080,
|
||||
height: 1080,
|
||||
},
|
||||
],
|
||||
original: { key: 'files/model.glb' },
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any
|
||||
vi.spyOn(assetService, 'getAsset').mockResolvedValue(asset3d)
|
||||
vi.spyOn(watermarkService, 'getCompletedWatermarkMediaMap').mockResolvedValue(new Map())
|
||||
|
||||
const res = await app.request('/shares/share1/files/file1', {
|
||||
method: 'GET',
|
||||
headers: { 'x-share-password': 'pass' },
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body.media.videoTranscodes).toEqual([])
|
||||
expect(body.media.videoPreview?.url).toBeUndefined()
|
||||
})
|
||||
|
||||
test('leaves non-video/image media untouched when watermark enabled', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue(shareLinkWithWatermark)
|
||||
vi.spyOn(assetService, 'getAsset').mockResolvedValue({
|
||||
@@ -821,4 +1016,81 @@ describe('Share API', () => {
|
||||
expect(getDownloadUrlSpy).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('GET /shares/:shareId/files/:fileId/m3u8 routes', () => {
|
||||
test('returns master playlist with query password preserved in variant URLs', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({
|
||||
id: 'share1',
|
||||
watermarkConfigId: null,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
vi.spyOn(assetService, 'getHlsMasterPlaylist').mockResolvedValue(
|
||||
'#EXTM3U\n#EXT-X-STREAM-INF:BANDWIDTH=4628000\n1080p/index.m3u8\n',
|
||||
)
|
||||
|
||||
const res = await app.request('/shares/share1/files/file1/m3u8/master.m3u8?p=secret123')
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.headers.get('content-type')).toContain('application/vnd.apple.mpegurl')
|
||||
const text = await res.text()
|
||||
expect(text).toContain('1080p/index.m3u8?p=secret123')
|
||||
expect(shareService.verifyPublicAccess).toHaveBeenCalledWith('file1', 'secret123')
|
||||
expect(assetService.getHlsMasterPlaylist).toHaveBeenCalledWith({
|
||||
assetId: 'file1',
|
||||
watermarkConfigId: null,
|
||||
})
|
||||
})
|
||||
|
||||
test('returns variant playlist with rewritten segment URLs', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({
|
||||
id: 'share1',
|
||||
watermarkConfigId: 'wm1',
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
vi.spyOn(assetService, 'getHlsVariantPlaylist').mockResolvedValue(
|
||||
'#EXTM3U\n#EXT-X-MAP:URI="http://presigned/init.mp4"\nhttp://presigned/seg0.m4s\n',
|
||||
)
|
||||
|
||||
const res = await app.request('/shares/share1/files/file1/m3u8/1080p/index.m3u8')
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.headers.get('content-type')).toContain('application/vnd.apple.mpegurl')
|
||||
const text = await res.text()
|
||||
expect(text).toContain('http://presigned/init.mp4')
|
||||
expect(assetService.getHlsVariantPlaylist).toHaveBeenCalledWith({
|
||||
assetId: 'file1',
|
||||
resolution: '1080p',
|
||||
watermarkConfigId: 'wm1',
|
||||
})
|
||||
})
|
||||
|
||||
test('returns 401 when password is invalid', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockRejectedValue(
|
||||
new ShareLinkPasswordInvalidError('Invalid password'),
|
||||
)
|
||||
|
||||
const res = await app.request('/shares/share1/files/file1/m3u8/master.m3u8?p=wrong')
|
||||
expect(res.status).toBe(401)
|
||||
const body = await res.json()
|
||||
expect(body.error).toBe('Unauthorized')
|
||||
})
|
||||
|
||||
test('resolves latest version id when fileId is a symlink to a version stack', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({
|
||||
id: 'share1',
|
||||
watermarkConfigId: null,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
vi.spyOn(assetService, 'resolveLatestVersionId').mockResolvedValue('child-version-file-id')
|
||||
vi.spyOn(assetService, 'getHlsMasterPlaylist').mockResolvedValue(
|
||||
'#EXTM3U\n#EXT-X-STREAM-INF:BANDWIDTH=4628000\n1080p/index.m3u8\n',
|
||||
)
|
||||
|
||||
const res = await app.request('/shares/share1/files/symlink1/m3u8/master.m3u8')
|
||||
expect(res.status).toBe(200)
|
||||
expect(assetService.resolveLatestVersionId).toHaveBeenCalledWith('symlink1')
|
||||
expect(assetService.getHlsMasterPlaylist).toHaveBeenCalledWith({
|
||||
assetId: 'child-version-file-id',
|
||||
watermarkConfigId: null,
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -52,6 +52,22 @@ vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/core/src/turntable/turntable', () => ({
|
||||
turntableService: {
|
||||
getSettings: vi.fn(),
|
||||
updateSettings: vi.fn(),
|
||||
testConnection: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/core/src/gotenberg/gotenberg', () => ({
|
||||
gotenbergService: {
|
||||
getSettings: vi.fn(),
|
||||
updateSettings: vi.fn(),
|
||||
testConnection: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
describe('team api', () => {
|
||||
const app = new Hono().use('*', authMiddleware).route('/', teamRoute)
|
||||
let mockCreateTeam: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
@@ -223,18 +239,39 @@ describe('team api', () => {
|
||||
expect(mockGetSettings).toHaveBeenCalledWith('t1')
|
||||
})
|
||||
|
||||
it('GET /teams/:teamId/settings does not return emailNotification to readers', async () => {
|
||||
mockGetSettings.mockResolvedValue({
|
||||
semanticSearchEnabled: false,
|
||||
transcode: { videoStrategy: 'best_match', hardwareAcceleration: 'off', threads: 0 },
|
||||
appearance: { hideAgent: false },
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/settings')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.emailNotification).toBeUndefined()
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
permission: Permission.Read,
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('PATCH /teams/:teamId/settings updates settings', async () => {
|
||||
mockUpdateSettings.mockResolvedValue({ transcode: { videoStrategy: 'all' } })
|
||||
mockUpdateSettings.mockResolvedValue({ transcode: { videoStrategy: 'multi' } })
|
||||
|
||||
const res = await app.request('/teams/t1/settings', {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ key: 'transcode.videoStrategy', value: 'all' }),
|
||||
body: JSON.stringify({ key: 'transcode.videoStrategy', value: 'multi' }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.transcode.videoStrategy).toBe('all')
|
||||
expect(data.transcode.videoStrategy).toBe('multi')
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: ResourceType.Team,
|
||||
@@ -242,7 +279,30 @@ describe('team api', () => {
|
||||
permission: Permission.Admin,
|
||||
}),
|
||||
)
|
||||
expect(mockUpdateSettings).toHaveBeenCalledWith('t1', 'transcode.videoStrategy', 'all')
|
||||
expect(mockUpdateSettings).toHaveBeenCalledWith('t1', 'transcode.videoStrategy', 'multi')
|
||||
})
|
||||
|
||||
it('PATCH /teams/:teamId/settings updates transcode.videoResolutions', async () => {
|
||||
mockUpdateSettings.mockResolvedValue({
|
||||
transcode: { videoResolutions: ['720p', '1080p'] },
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/settings', {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
key: 'transcode.videoResolutions',
|
||||
value: ['720p', '1080p'],
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.transcode.videoResolutions).toEqual(['720p', '1080p'])
|
||||
expect(mockUpdateSettings).toHaveBeenCalledWith('t1', 'transcode.videoResolutions', [
|
||||
'720p',
|
||||
'1080p',
|
||||
])
|
||||
})
|
||||
|
||||
it('PATCH /teams/:teamId/settings updates transcode.hardwareAcceleration', async () => {
|
||||
@@ -260,6 +320,44 @@ describe('team api', () => {
|
||||
expect(mockUpdateSettings).toHaveBeenCalledWith('t1', 'transcode.hardwareAcceleration', 'auto')
|
||||
})
|
||||
|
||||
it('PATCH /teams/:teamId/settings updates transcode.threads', async () => {
|
||||
mockUpdateSettings.mockResolvedValue({ transcode: { threads: 8 } })
|
||||
|
||||
const res = await app.request('/teams/t1/settings', {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ key: 'transcode.threads', value: 8 }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.transcode.threads).toBe(8)
|
||||
expect(mockUpdateSettings).toHaveBeenCalledWith('t1', 'transcode.threads', 8)
|
||||
})
|
||||
|
||||
it('PATCH /teams/:teamId/settings rejects invalid transcode.threads', async () => {
|
||||
const resNegative = await app.request('/teams/t1/settings', {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ key: 'transcode.threads', value: -1 }),
|
||||
})
|
||||
expect(resNegative.status).toBe(400)
|
||||
|
||||
const resTooLarge = await app.request('/teams/t1/settings', {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ key: 'transcode.threads', value: 33 }),
|
||||
})
|
||||
expect(resTooLarge.status).toBe(400)
|
||||
|
||||
const resFloat = await app.request('/teams/t1/settings', {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ key: 'transcode.threads', value: 4.5 }),
|
||||
})
|
||||
expect(resFloat.status).toBe(400)
|
||||
})
|
||||
|
||||
it('PATCH /teams/:teamId/settings updates appearance.hideAgent', async () => {
|
||||
mockUpdateSettings.mockResolvedValue({ appearance: { hideAgent: true } })
|
||||
|
||||
@@ -556,5 +654,208 @@ describe('team api', () => {
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('GET /teams/:teamId/turntable-settings returns turntable settings', async () => {
|
||||
const { turntableService } = await import('@shumai/core/src/turntable/turntable')
|
||||
vi.mocked(turntableService.getSettings).mockResolvedValue({
|
||||
url: 'http://localhost:3001',
|
||||
username: 'user',
|
||||
hasPassword: true,
|
||||
isEnvConfigured: false,
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/turntable-settings')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data).toEqual({
|
||||
url: 'http://localhost:3001',
|
||||
username: 'user',
|
||||
hasPassword: true,
|
||||
isEnvConfigured: false,
|
||||
})
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('PUT /teams/:teamId/turntable-settings updates settings when not env configured', async () => {
|
||||
const { turntableService } = await import('@shumai/core/src/turntable/turntable')
|
||||
vi.mocked(turntableService.updateSettings).mockResolvedValue({
|
||||
url: 'http://custom:3001',
|
||||
username: 'newuser',
|
||||
hasPassword: true,
|
||||
isEnvConfigured: false,
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/turntable-settings', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
url: 'http://custom:3001',
|
||||
username: 'newuser',
|
||||
password: 'secretpassword',
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.url).toBe('http://custom:3001')
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('PUT /teams/:teamId/turntable-settings returns 400 when env configured', async () => {
|
||||
const { turntableService } = await import('@shumai/core/src/turntable/turntable')
|
||||
vi.mocked(turntableService.updateSettings).mockRejectedValue(
|
||||
new Error(
|
||||
'Turntable settings are configured via environment variables and cannot be edited',
|
||||
),
|
||||
)
|
||||
|
||||
const res = await app.request('/teams/t1/turntable-settings', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
url: 'http://custom:3001',
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(400)
|
||||
const data = await res.json()
|
||||
expect(data.message).toContain('configured via environment variables')
|
||||
})
|
||||
|
||||
it('POST /teams/:teamId/turntable-settings/test tests connection', async () => {
|
||||
const { turntableService } = await import('@shumai/core/src/turntable/turntable')
|
||||
vi.mocked(turntableService.testConnection).mockResolvedValue({
|
||||
ok: true,
|
||||
version: '1.0.0',
|
||||
blender: '5.2.0',
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/turntable-settings/test', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
url: 'http://custom:3001',
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.ok).toBe(true)
|
||||
expect(data.blender).toBe('5.2.0')
|
||||
})
|
||||
|
||||
it('GET /teams/:teamId/gotenberg-settings returns gotenberg settings', async () => {
|
||||
const { gotenbergService } = await import('@shumai/core/src/gotenberg/gotenberg')
|
||||
vi.mocked(gotenbergService.getSettings).mockResolvedValue({
|
||||
url: 'http://localhost:3000',
|
||||
username: 'user',
|
||||
hasPassword: true,
|
||||
isEnvConfigured: false,
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/gotenberg-settings')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data).toEqual({
|
||||
url: 'http://localhost:3000',
|
||||
username: 'user',
|
||||
hasPassword: true,
|
||||
isEnvConfigured: false,
|
||||
})
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('PUT /teams/:teamId/gotenberg-settings updates settings when not env configured', async () => {
|
||||
const { gotenbergService } = await import('@shumai/core/src/gotenberg/gotenberg')
|
||||
vi.mocked(gotenbergService.updateSettings).mockResolvedValue({
|
||||
url: 'http://custom:3000',
|
||||
username: 'newuser',
|
||||
hasPassword: true,
|
||||
isEnvConfigured: false,
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/gotenberg-settings', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
url: 'http://custom:3000',
|
||||
username: 'newuser',
|
||||
password: 'secretpassword',
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.url).toBe('http://custom:3000')
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('PUT /teams/:teamId/gotenberg-settings returns 400 when env configured', async () => {
|
||||
const { gotenbergService } = await import('@shumai/core/src/gotenberg/gotenberg')
|
||||
vi.mocked(gotenbergService.updateSettings).mockRejectedValue(
|
||||
new Error(
|
||||
'Gotenberg settings are configured via environment variables and cannot be edited',
|
||||
),
|
||||
)
|
||||
|
||||
const res = await app.request('/teams/t1/gotenberg-settings', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
url: 'http://custom:3000',
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(400)
|
||||
const data = await res.json()
|
||||
expect(data.message).toContain('configured via environment variables')
|
||||
})
|
||||
|
||||
it('POST /teams/:teamId/gotenberg-settings/test tests connection', async () => {
|
||||
const { gotenbergService } = await import('@shumai/core/src/gotenberg/gotenberg')
|
||||
vi.mocked(gotenbergService.testConnection).mockResolvedValue({
|
||||
ok: true,
|
||||
version: '8.3.0',
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/gotenberg-settings/test', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
url: 'http://custom:3000',
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.ok).toBe(true)
|
||||
expect(data.version).toBe('8.3.0')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -10,6 +10,8 @@ import {
|
||||
updateTeamSettingsRequestSchema,
|
||||
listMembersQuerySchema,
|
||||
updateSandboxSettingsRequestSchema,
|
||||
updateTurntableSettingsRequestSchema,
|
||||
updateGotenbergSettingsRequestSchema,
|
||||
updateMeRequestSchema,
|
||||
updateTeamMemberRoleRequestSchema,
|
||||
createApiTokenRequestSchema,
|
||||
@@ -23,6 +25,8 @@ import {
|
||||
import { apiTokenService } from '@shumai/core/src/user/api-token'
|
||||
import { aiUsageService } from '@shumai/core/src/ai-usage/ai-usage'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import { turntableService } from '@shumai/core/src/turntable/turntable'
|
||||
import { gotenbergService } from '@shumai/core/src/gotenberg/gotenberg'
|
||||
import { NotificationType } from '@shumai/db'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
|
||||
@@ -265,6 +269,120 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
return c.json(sandbox)
|
||||
},
|
||||
)
|
||||
.get('/teams/:teamId/turntable-settings', async (c) => {
|
||||
const user = c.get('user')
|
||||
const teamId = c.req.param('teamId')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const settings = await turntableService.getSettings(teamId)
|
||||
return c.json(settings)
|
||||
})
|
||||
.put(
|
||||
'/teams/:teamId/turntable-settings',
|
||||
zValidator('json', updateTurntableSettingsRequestSchema),
|
||||
async (c) => {
|
||||
const user = c.get('user')
|
||||
const teamId = c.req.param('teamId')
|
||||
const req = c.req.valid('json')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
try {
|
||||
const settings = await turntableService.updateSettings(teamId, req)
|
||||
return c.json(settings)
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err)
|
||||
return c.json({ message }, 400)
|
||||
}
|
||||
},
|
||||
)
|
||||
.post(
|
||||
'/teams/:teamId/turntable-settings/test',
|
||||
zValidator('json', updateTurntableSettingsRequestSchema.partial()),
|
||||
async (c) => {
|
||||
const user = c.get('user')
|
||||
const teamId = c.req.param('teamId')
|
||||
const req = c.req.valid('json')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const res = await turntableService.testConnection(req, teamId)
|
||||
return c.json(res)
|
||||
},
|
||||
)
|
||||
.get('/teams/:teamId/gotenberg-settings', async (c) => {
|
||||
const user = c.get('user')
|
||||
const teamId = c.req.param('teamId')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const settings = await gotenbergService.getSettings(teamId)
|
||||
return c.json(settings)
|
||||
})
|
||||
.put(
|
||||
'/teams/:teamId/gotenberg-settings',
|
||||
zValidator('json', updateGotenbergSettingsRequestSchema),
|
||||
async (c) => {
|
||||
const user = c.get('user')
|
||||
const teamId = c.req.param('teamId')
|
||||
const req = c.req.valid('json')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
try {
|
||||
const settings = await gotenbergService.updateSettings(teamId, req)
|
||||
return c.json(settings)
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err)
|
||||
return c.json({ message }, 400)
|
||||
}
|
||||
},
|
||||
)
|
||||
.post(
|
||||
'/teams/:teamId/gotenberg-settings/test',
|
||||
zValidator('json', updateGotenbergSettingsRequestSchema.partial()),
|
||||
async (c) => {
|
||||
const user = c.get('user')
|
||||
const teamId = c.req.param('teamId')
|
||||
const req = c.req.valid('json')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const res = await gotenbergService.testConnection(req, teamId)
|
||||
return c.json(res)
|
||||
},
|
||||
)
|
||||
.get('/teams/:teamId/user-metadata', async (c) => {
|
||||
const user = c.get('user')
|
||||
const teamId = c.req.param('teamId')
|
||||
|
||||
@@ -105,15 +105,17 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
await uploadService.confirmFileUpload(user.id, taskId, req)
|
||||
|
||||
if (!req.errorMessage) {
|
||||
const context = await assetService.getAssetContext(req.fileId)
|
||||
|
||||
await notificationService.create({
|
||||
type: NotificationType.successful_file_uploaded,
|
||||
teamId: teamId,
|
||||
projectId: context.projectId,
|
||||
creatorId: user.id,
|
||||
assetId: req.fileId,
|
||||
taskId: taskId,
|
||||
})
|
||||
|
||||
const context = await assetService.getAssetContext(req.fileId)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.file_create,
|
||||
teamId: teamId,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/core",
|
||||
"version": "0.4.6",
|
||||
"version": "0.6.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
@@ -29,6 +29,7 @@
|
||||
"@aws-sdk/s3-request-presigner": "3.1121.0",
|
||||
"@earendil-works/pi-agent-core": "0.82.1",
|
||||
"@earendil-works/pi-ai": "0.82.1",
|
||||
"@google/genai": "2.28.0",
|
||||
"@modelcontextprotocol/client": "2.0.0",
|
||||
"@shumai/db": "workspace:*",
|
||||
"@shumai/dtos": "workspace:*",
|
||||
@@ -40,9 +41,11 @@
|
||||
"date-fns": "4.4.0",
|
||||
"dotenv": "17.4.2",
|
||||
"dotenv-expand": "13.0.0",
|
||||
"exiftool-vendored": "38.1.0",
|
||||
"extract-zip": "2.0.1",
|
||||
"hono": "4.13.5",
|
||||
"jittered-fractional-indexing": "1.0.1",
|
||||
"nodemailer": "10.0.10",
|
||||
"pdfkit": "0.20.1",
|
||||
"pino": "10.3.1",
|
||||
"sharp": "0.35.4",
|
||||
@@ -56,6 +59,7 @@
|
||||
"@modelcontextprotocol/server": "2.0.0",
|
||||
"@types/adm-zip": "0.5.8",
|
||||
"@types/extract-zip": "2.0.3",
|
||||
"@types/nodemailer": "8.0.2",
|
||||
"@types/pdfkit": "0.17.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -976,4 +976,171 @@ describe('AgentService', () => {
|
||||
expect(ids).toHaveLength(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('ensureEmbeddingAgent', () => {
|
||||
test('creates embedding agent when ENABLE_EMBEDDING_AGENT is true', async () => {
|
||||
const db = prisma
|
||||
const svc = new AgentService()
|
||||
const { team } = await setupTestData(db)
|
||||
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'true'
|
||||
try {
|
||||
await svc.ensureEmbeddingAgentForTeam(team.id)
|
||||
const agent = await db.agent.findFirst({
|
||||
where: { teamId: team.id, type: 'embedding' },
|
||||
include: { user: true, skills: { include: { skill: true } }, mcpServers: true },
|
||||
})
|
||||
expect(agent).toBeDefined()
|
||||
const info = await svc.toAgentInfo(agent!)
|
||||
expect(info.name).toBe('embedding-agent')
|
||||
expect(info.type).toBe('embedding')
|
||||
expect(info.enabled).toBe(true)
|
||||
expect(info.avatarPreset).toBe('avatar-1')
|
||||
expect(info.avatar).toContain('avatar-1.webp')
|
||||
expect(info.readOnly).toBe(true)
|
||||
|
||||
// Ensure idempotency
|
||||
await svc.ensureEmbeddingAgentForTeam(team.id)
|
||||
const count = await db.agent.count({
|
||||
where: { teamId: team.id, type: 'embedding' },
|
||||
})
|
||||
expect(count).toBe(1)
|
||||
} finally {
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
}
|
||||
})
|
||||
|
||||
test('enables existing embedding agent when ENABLE_EMBEDDING_AGENT is true', async () => {
|
||||
const db = prisma
|
||||
const svc = new AgentService()
|
||||
const { team } = await setupTestData(db)
|
||||
|
||||
const bot = await db.user.create({
|
||||
data: { name: 'Existing Embedding', email: 'existing-emb@shumai.ai', type: 'agent' },
|
||||
})
|
||||
await db.agent.create({
|
||||
data: {
|
||||
id: bot.id,
|
||||
teamId: team.id,
|
||||
type: 'embedding',
|
||||
enabled: false,
|
||||
config: { provider: '', model: '' },
|
||||
},
|
||||
})
|
||||
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'true'
|
||||
try {
|
||||
await svc.ensureEmbeddingAgentForTeam(team.id)
|
||||
const agent = await db.agent.findFirst({
|
||||
where: { teamId: team.id, type: 'embedding' },
|
||||
include: { user: true, skills: { include: { skill: true } }, mcpServers: true },
|
||||
})
|
||||
expect(agent?.id).toBe(bot.id)
|
||||
expect(agent?.enabled).toBe(true)
|
||||
const info = await svc.toAgentInfo(agent!)
|
||||
expect(info.readOnly).toBe(true)
|
||||
} finally {
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
}
|
||||
})
|
||||
|
||||
test('does nothing when ENABLE_EMBEDDING_AGENT is not set', async () => {
|
||||
const db = prisma
|
||||
const svc = new AgentService()
|
||||
const team = await db.team.create({ data: { name: 'Team No Agent' } })
|
||||
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
await svc.ensureEmbeddingAgentForTeam(team.id)
|
||||
const agent = await db.agent.findFirst({
|
||||
where: { teamId: team.id, type: 'embedding' },
|
||||
})
|
||||
expect(agent).toBeNull()
|
||||
})
|
||||
|
||||
test('does not create embedding agent when ENABLE_EMBEDDING_AGENT is false and agent does not exist', async () => {
|
||||
const db = prisma
|
||||
const svc = new AgentService()
|
||||
const { team } = await setupTestData(db)
|
||||
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'false'
|
||||
try {
|
||||
await svc.ensureEmbeddingAgentForTeam(team.id)
|
||||
const agent = await db.agent.findFirst({
|
||||
where: { teamId: team.id, type: 'embedding' },
|
||||
})
|
||||
expect(agent).toBeNull()
|
||||
} finally {
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
}
|
||||
})
|
||||
|
||||
test('disables existing embedding agent and marks readOnly: true when ENABLE_EMBEDDING_AGENT is false', async () => {
|
||||
const db = prisma
|
||||
const svc = new AgentService()
|
||||
const { team } = await setupTestData(db)
|
||||
|
||||
const bot = await db.user.create({
|
||||
data: { name: 'Existing Embedding', email: 'existing-emb-false@shumai.ai', type: 'agent' },
|
||||
})
|
||||
await db.agent.create({
|
||||
data: {
|
||||
id: bot.id,
|
||||
teamId: team.id,
|
||||
type: 'embedding',
|
||||
enabled: true,
|
||||
config: { provider: '', model: '' },
|
||||
},
|
||||
})
|
||||
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'false'
|
||||
try {
|
||||
await svc.ensureEmbeddingAgentForTeam(team.id)
|
||||
const agent = await db.agent.findFirst({
|
||||
where: { teamId: team.id, type: 'embedding' },
|
||||
include: { user: true, skills: { include: { skill: true } }, mcpServers: true },
|
||||
})
|
||||
expect(agent?.id).toBe(bot.id)
|
||||
expect(agent?.enabled).toBe(false)
|
||||
const info = await svc.toAgentInfo(agent!)
|
||||
expect(info.readOnly).toBe(true)
|
||||
expect(info.enabled).toBe(false)
|
||||
} finally {
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
}
|
||||
})
|
||||
|
||||
test('ensureSystemEmbeddingAgents updates all teams when ENABLE_EMBEDDING_AGENT is false', async () => {
|
||||
const db = prisma
|
||||
const svc = new AgentService()
|
||||
const { team: team1 } = await setupTestData(db)
|
||||
const team2 = await db.team.create({ data: { name: 'Team 2' } })
|
||||
|
||||
// Create enabled embedding agent on team1
|
||||
const bot1 = await db.user.create({
|
||||
data: { name: 'Bot 1', email: 'b1-false@shumai.ai', type: 'agent' },
|
||||
})
|
||||
await db.agent.create({
|
||||
data: {
|
||||
id: bot1.id,
|
||||
teamId: team1.id,
|
||||
type: 'embedding',
|
||||
enabled: true,
|
||||
config: { provider: '', model: '' },
|
||||
},
|
||||
})
|
||||
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'false'
|
||||
try {
|
||||
await svc.ensureSystemEmbeddingAgents()
|
||||
|
||||
const a1 = await db.agent.findFirst({ where: { teamId: team1.id, type: 'embedding' } })
|
||||
const a2 = await db.agent.findFirst({ where: { teamId: team2.id, type: 'embedding' } })
|
||||
|
||||
expect(a1?.enabled).toBe(false)
|
||||
expect(a2).toBeNull()
|
||||
} finally {
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -43,8 +43,8 @@ interface AgentInfoSource {
|
||||
config: unknown
|
||||
soul: string | null
|
||||
user: { name: string; image: string | null }
|
||||
skills: Array<{ id: string; skillId: string; skill: { id: string; name: string } }>
|
||||
mcpServers: Array<{ mcpServerId: string }>
|
||||
skills?: Array<{ id: string; skillId: string; skill: { id: string; name: string } }>
|
||||
mcpServers?: Array<{ mcpServerId: string }>
|
||||
}
|
||||
|
||||
function extractS3Key(urlOrKey?: string | null): string | null | undefined {
|
||||
@@ -462,6 +462,11 @@ export class AgentService {
|
||||
*/
|
||||
async toAgentInfo(agent: AgentInfoSource): Promise<AgentInfo> {
|
||||
const config = agent.config as unknown as PrismaJson.AgentConfig
|
||||
const isManagedByEnv =
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'true' ||
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'false'
|
||||
const isReadOnly = agent.type === 'embedding' && isManagedByEnv
|
||||
|
||||
return {
|
||||
id: agent.id,
|
||||
name: agent.user.name,
|
||||
@@ -475,13 +480,14 @@ export class AgentService {
|
||||
thinkingLevel: config.thinkingLevel || 'off',
|
||||
systemPrompt: config.systemPrompt,
|
||||
soul: agent.soul || undefined,
|
||||
skills: agent.skills.map((s) => ({
|
||||
skills: (agent.skills || []).map((s) => ({
|
||||
id: s.id,
|
||||
skillId: s.skillId,
|
||||
skill: s.skill,
|
||||
})),
|
||||
mcpServerIds: (agent.mcpServers || []).map((m) => m.mcpServerId),
|
||||
deniedTools: config.deniedTools || [],
|
||||
readOnly: isReadOnly,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,6 +724,60 @@ export class AgentService {
|
||||
params,
|
||||
)
|
||||
}
|
||||
|
||||
async ensureSystemEmbeddingAgents(): Promise<void> {
|
||||
const envVal = process.env.ENABLE_EMBEDDING_AGENT
|
||||
if (envVal !== 'true' && envVal !== 'false') {
|
||||
return
|
||||
}
|
||||
|
||||
const teams = await this.prismaClient.team.findMany({
|
||||
select: { id: true },
|
||||
})
|
||||
|
||||
for (const team of teams) {
|
||||
await this.ensureEmbeddingAgentForTeam(team.id)
|
||||
}
|
||||
}
|
||||
|
||||
async ensureEmbeddingAgentForTeam(teamId: string): Promise<void> {
|
||||
const envVal = process.env.ENABLE_EMBEDDING_AGENT
|
||||
if (envVal !== 'true' && envVal !== 'false') {
|
||||
return
|
||||
}
|
||||
|
||||
const existing = await this.prismaClient.agent.findFirst({
|
||||
where: {
|
||||
teamId,
|
||||
type: 'embedding',
|
||||
},
|
||||
})
|
||||
|
||||
if (envVal === 'true') {
|
||||
if (!existing) {
|
||||
await this.createAgent({
|
||||
teamId,
|
||||
name: 'embedding-agent',
|
||||
type: 'embedding',
|
||||
avatar: 'avatar-1',
|
||||
thinkingLevel: 'off',
|
||||
enabled: true,
|
||||
})
|
||||
} else if (!existing.enabled) {
|
||||
await this.prismaClient.agent.update({
|
||||
where: { id: existing.id },
|
||||
data: { enabled: true },
|
||||
})
|
||||
}
|
||||
} else if (envVal === 'false') {
|
||||
if (existing && existing.enabled) {
|
||||
await this.prismaClient.agent.update({
|
||||
where: { id: existing.id },
|
||||
data: { enabled: false },
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const agentService = new AgentService()
|
||||
|
||||
@@ -3,18 +3,20 @@ import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
|
||||
import { AssetType, AssetStatus, Prisma } from '@shumai/db'
|
||||
import { AssetType, AssetStatus, Prisma, WorkflowTaskType, WorkflowTaskStatus } from '@shumai/db'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { uploadService } from '@shumai/core/src/upload/upload'
|
||||
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
import { AssetService } from './asset'
|
||||
|
||||
import { ensureJpegInStorage } from '@shumai/core/src/s3/preview-converter'
|
||||
import { workflowService } from '@shumai/workflow-core'
|
||||
|
||||
vi.mock('@shumai/core/src/s3/s3', () => ({
|
||||
s3Service: {
|
||||
presign: vi.fn().mockResolvedValue('http://mock-s3-url'),
|
||||
putObject: vi.fn().mockResolvedValue(undefined),
|
||||
getObject: vi.fn().mockResolvedValue({ buffer: Buffer.from('') }),
|
||||
deleteObject: vi.fn().mockResolvedValue(1),
|
||||
deletePrefix: vi.fn().mockResolvedValue(1),
|
||||
copyObject: vi.fn().mockResolvedValue(undefined),
|
||||
@@ -1929,6 +1931,36 @@ describe('AssetService', () => {
|
||||
expect(info.preview?.duration).toBeUndefined()
|
||||
})
|
||||
|
||||
it('toPreviewInfo handles 3d asset with proxyType 3d and omits duration', async () => {
|
||||
const { project, user } = await setupBasicAssets()
|
||||
|
||||
const model = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'model.glb',
|
||||
type: AssetType.file,
|
||||
projectId: project.id,
|
||||
creatorId: user.id,
|
||||
sizeByte: 8000,
|
||||
mediaType: 'model/gltf-binary',
|
||||
status: 'processed',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
poster: { key: 'poster-key' },
|
||||
sprite: { key: 'sprite-key', frames: 100, tileX: 10, tileY: 10 },
|
||||
metadata: { originalWidth: 1080, originalHeight: 1080, duration: 4 },
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any,
|
||||
},
|
||||
})
|
||||
|
||||
const info = await assetService.getAsset({ assetId: model.id })
|
||||
|
||||
expect(info.preview).toBeDefined()
|
||||
expect(info.preview?.proxyType).toBe('3d')
|
||||
expect(info.preview?.duration).toBeUndefined()
|
||||
expect(info.preview?.spriteUrl).toBeDefined()
|
||||
})
|
||||
|
||||
it('converts webp thumbnail to jpeg on demand when hasJpegPreview is false', async () => {
|
||||
vi.mocked(ensureJpegInStorage).mockClear()
|
||||
const { project, user } = await setupBasicAssets()
|
||||
@@ -2529,6 +2561,209 @@ describe('AssetService', () => {
|
||||
expect(updatedEntry?.sessionId).toBe(session.id)
|
||||
})
|
||||
})
|
||||
|
||||
describe('listChildren with showDeleted', () => {
|
||||
const createImageFile = async (params: {
|
||||
name: string
|
||||
projectId: string
|
||||
parentId: string
|
||||
creatorId: string
|
||||
thumbnailKey: string
|
||||
duration?: number
|
||||
sortIndex?: string
|
||||
}) => {
|
||||
return prisma.asset.create({
|
||||
data: {
|
||||
name: params.name,
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.processed,
|
||||
isDeleted: true,
|
||||
projectId: params.projectId,
|
||||
parentId: params.parentId,
|
||||
creatorId: params.creatorId,
|
||||
sizeByte: 100,
|
||||
sortIndex: params.sortIndex,
|
||||
mediaType: 'image/png',
|
||||
media: {
|
||||
duration: 0,
|
||||
filesize: 0,
|
||||
frames: 0,
|
||||
imageTranscodes: [],
|
||||
videoTranscodes: [],
|
||||
finishedAt: new Date(0).toISOString(),
|
||||
metadata:
|
||||
params.duration === undefined
|
||||
? null
|
||||
: {
|
||||
originalHeight: 0,
|
||||
originalWidth: 0,
|
||||
hasAudio: false,
|
||||
duration: params.duration,
|
||||
bitRate: 0,
|
||||
frameRate: 0,
|
||||
totalFrames: 0,
|
||||
startTimecode: '00:00:00:00',
|
||||
format: null,
|
||||
},
|
||||
original: null,
|
||||
proxyType: 'image',
|
||||
thumbnail: {
|
||||
key: params.thumbnailKey,
|
||||
width: 0,
|
||||
height: 0,
|
||||
quality: 0,
|
||||
format: 'png',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
it('returns previews for children of a folder trashed via deleteAssets', async () => {
|
||||
const { project, user, assets } = await setupBasicAssets()
|
||||
|
||||
const folder = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Trashed Folder',
|
||||
type: AssetType.folder,
|
||||
status: AssetStatus.uploaded,
|
||||
projectId: project.id,
|
||||
parentId: assets.root.id,
|
||||
creatorId: user.id,
|
||||
},
|
||||
})
|
||||
|
||||
await createImageFile({
|
||||
name: 'inside-1.png',
|
||||
projectId: project.id,
|
||||
parentId: folder.id,
|
||||
creatorId: user.id,
|
||||
thumbnailKey: 'thumb-1',
|
||||
})
|
||||
await createImageFile({
|
||||
name: 'inside-2.png',
|
||||
projectId: project.id,
|
||||
parentId: folder.id,
|
||||
creatorId: user.id,
|
||||
thumbnailKey: 'thumb-2',
|
||||
})
|
||||
|
||||
await assetService.deleteAssets([folder.id])
|
||||
|
||||
const result = await assetService.listChildren({
|
||||
projectId: project.id,
|
||||
showDeleted: true,
|
||||
assetType: 'folder',
|
||||
})
|
||||
|
||||
expect(result.data).toHaveLength(1)
|
||||
expect(result.data[0].id).toBe(folder.id)
|
||||
expect(result.data[0].deletedAt).not.toBeNull()
|
||||
expect(result.data[0].latestChildren).toHaveLength(2)
|
||||
expect(result.data[0].latestChildren?.every((c) => c.preview?.thumbnailUrl)).toBe(true)
|
||||
})
|
||||
|
||||
it('resolves the latest deleted version for a trashed version stack child', async () => {
|
||||
const { project, user, assets } = await setupBasicAssets()
|
||||
|
||||
const folder = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Trashed Folder With Stack',
|
||||
type: AssetType.folder,
|
||||
status: AssetStatus.uploaded,
|
||||
projectId: project.id,
|
||||
parentId: assets.root.id,
|
||||
creatorId: user.id,
|
||||
},
|
||||
})
|
||||
|
||||
const stack = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'clip',
|
||||
type: AssetType.version_stack,
|
||||
status: AssetStatus.processed,
|
||||
projectId: project.id,
|
||||
parentId: folder.id,
|
||||
creatorId: user.id,
|
||||
},
|
||||
})
|
||||
|
||||
await createImageFile({
|
||||
name: 'clip-v1.png',
|
||||
projectId: project.id,
|
||||
parentId: stack.id,
|
||||
creatorId: user.id,
|
||||
thumbnailKey: 'v1-thumb',
|
||||
duration: 11,
|
||||
sortIndex: 'a1',
|
||||
})
|
||||
await createImageFile({
|
||||
name: 'clip-v2.png',
|
||||
projectId: project.id,
|
||||
parentId: stack.id,
|
||||
creatorId: user.id,
|
||||
thumbnailKey: 'v2-thumb',
|
||||
duration: 42,
|
||||
sortIndex: 'a0',
|
||||
})
|
||||
|
||||
await assetService.deleteAssets([folder.id])
|
||||
|
||||
const result = await assetService.listChildren({
|
||||
projectId: project.id,
|
||||
showDeleted: true,
|
||||
assetType: 'folder',
|
||||
})
|
||||
|
||||
const previews = result.data[0].latestChildren ?? []
|
||||
expect(previews).toHaveLength(1)
|
||||
// The latest version (lowest sortIndex) must be the one used for the preview
|
||||
expect(previews[0].preview?.duration).toBe(42)
|
||||
expect(previews[0].preview?.thumbnailUrl).toBeDefined()
|
||||
})
|
||||
|
||||
it('still hides soft-deleted children when browsing a folder normally', async () => {
|
||||
const { project, user, assets } = await setupBasicAssets()
|
||||
|
||||
const folder = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Active Folder',
|
||||
type: AssetType.folder,
|
||||
status: AssetStatus.uploaded,
|
||||
projectId: project.id,
|
||||
parentId: assets.root.id,
|
||||
creatorId: user.id,
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.asset.create({
|
||||
data: {
|
||||
name: 'active.png',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.processed,
|
||||
isDeleted: false,
|
||||
projectId: project.id,
|
||||
parentId: folder.id,
|
||||
creatorId: user.id,
|
||||
},
|
||||
})
|
||||
await prisma.asset.create({
|
||||
data: {
|
||||
name: 'deleted.png',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.processed,
|
||||
isDeleted: true,
|
||||
deletedAt: new Date(),
|
||||
projectId: project.id,
|
||||
parentId: folder.id,
|
||||
creatorId: user.id,
|
||||
},
|
||||
})
|
||||
|
||||
const folderInfo = await assetService.getAsset({ assetId: folder.id })
|
||||
expect(folderInfo.latestChildren).toHaveLength(1)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('AssetService — natural sort by name', () => {
|
||||
@@ -3004,6 +3239,65 @@ describe('AssetService — natural sort by name', () => {
|
||||
|
||||
await expect(assetService.emptyTrash(project.id)).resolves.not.toThrow()
|
||||
})
|
||||
|
||||
it('should purge trashed assets whose status was processed, cancel their in-flight tasks, and delete WorkflowTasks', async () => {
|
||||
const cancelSpy = vi.spyOn(workflowService, 'cancel').mockResolvedValue(undefined)
|
||||
|
||||
const team = await prisma.team.create({ data: { name: 'Purge Task Team' } })
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'Purge Task Project', teamId: team.id },
|
||||
})
|
||||
const rootFolder = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'root',
|
||||
type: AssetType.folder,
|
||||
projectId: project.id,
|
||||
status: AssetStatus.uploaded,
|
||||
},
|
||||
})
|
||||
const user = await prisma.user.create({
|
||||
data: { name: 'Test User Purge', email: `test-purge-${Date.now()}@example.com` },
|
||||
})
|
||||
|
||||
// Asset was deleted, but status was set to 'processed' by background activity
|
||||
const file = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'skewed-status.mp4',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.processed,
|
||||
isDeleted: true,
|
||||
deletedAt: new Date(),
|
||||
project: { connect: { id: project.id } },
|
||||
parent: { connect: { id: rootFolder.id } },
|
||||
creator: { connect: { id: user.id } },
|
||||
storageKey: { create: { key: 'files/skewed-status/raw.mp4' } },
|
||||
},
|
||||
})
|
||||
|
||||
// In-flight task for this asset
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
assetId: file.id,
|
||||
type: WorkflowTaskType.transcode_video,
|
||||
status: WorkflowTaskStatus.processing,
|
||||
},
|
||||
})
|
||||
|
||||
await assetService.emptyTrash(project.id)
|
||||
|
||||
// Asset should be deleted from DB
|
||||
const assetInDb = await prisma.asset.findUnique({ where: { id: file.id } })
|
||||
expect(assetInDb).toBeNull()
|
||||
|
||||
// Task should be cancelled
|
||||
expect(cancelSpy).toHaveBeenCalledWith(task.id)
|
||||
|
||||
// WorkflowTask should be deleted from DB
|
||||
const taskInDb = await prisma.workflowTask.findUnique({ where: { id: task.id } })
|
||||
expect(taskInDb).toBeNull()
|
||||
|
||||
cancelSpy.mockRestore()
|
||||
})
|
||||
})
|
||||
|
||||
describe('expireTrashedAssets', () => {
|
||||
@@ -3116,7 +3410,53 @@ describe('AssetService — natural sort by name', () => {
|
||||
'files/01TESTULID000000000000000/test-720p.mp4',
|
||||
'GET',
|
||||
true,
|
||||
'test.mp4',
|
||||
'test-720p.mp4',
|
||||
)
|
||||
})
|
||||
|
||||
it('downloading video proxy for test.mov should use proxy filename with mp4 extension instead of test.mov', async () => {
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'test.mov',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.uploaded,
|
||||
storageKey: {
|
||||
create: { key: 'files/01TESTULID000000000000000/test.mov' },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await assetService.getDownloadUrl(asset.id, 'files/01TESTULID000000000000000/test-1080p.mp4')
|
||||
|
||||
expect(s3Service.presign).toHaveBeenCalledWith(
|
||||
expect.any(String),
|
||||
'files/01TESTULID000000000000000/test-1080p.mp4',
|
||||
'GET',
|
||||
true,
|
||||
'test-1080p.mp4',
|
||||
)
|
||||
})
|
||||
|
||||
it('downloading proxy for a renamed asset should preserve new stem with proxy resolution and extension', async () => {
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'awesome.mov',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.uploaded,
|
||||
storageKey: {
|
||||
create: { key: 'files/01TESTULID000000000000000/test.mov' },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await assetService.getDownloadUrl(asset.id, 'files/01TESTULID000000000000000/test-1080p.mp4')
|
||||
|
||||
expect(s3Service.presign).toHaveBeenCalledWith(
|
||||
expect.any(String),
|
||||
'files/01TESTULID000000000000000/test-1080p.mp4',
|
||||
'GET',
|
||||
true,
|
||||
'awesome-1080p.mp4',
|
||||
)
|
||||
})
|
||||
|
||||
@@ -4858,4 +5198,195 @@ describe('AssetService — natural sort by name', () => {
|
||||
expect(stackInfo?.commentsCount).toBe(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe('restoreAssets with in-flight transcoding', () => {
|
||||
it('should restore asset with status "processing" if a transcode task is still active', async () => {
|
||||
const team = await prisma.team.create({ data: { name: 'Restore Transcode Team' } })
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'Restore Transcode Project', teamId: team.id },
|
||||
})
|
||||
const rootFolder = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'root',
|
||||
type: AssetType.folder,
|
||||
projectId: project.id,
|
||||
status: AssetStatus.uploaded,
|
||||
},
|
||||
})
|
||||
const file = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'transcoding-video.mp4',
|
||||
type: AssetType.file,
|
||||
projectId: project.id,
|
||||
parentId: rootFolder.id,
|
||||
status: AssetStatus.trashed,
|
||||
isDeleted: true,
|
||||
deletedAt: new Date(),
|
||||
},
|
||||
})
|
||||
|
||||
// Create an active transcode task
|
||||
await prisma.workflowTask.create({
|
||||
data: {
|
||||
assetId: file.id,
|
||||
type: WorkflowTaskType.transcode_video,
|
||||
status: WorkflowTaskStatus.processing,
|
||||
},
|
||||
})
|
||||
|
||||
await assetService.restoreAssets([file.id])
|
||||
|
||||
const restored = await prisma.asset.findUnique({ where: { id: file.id } })
|
||||
expect(restored?.isDeleted).toBe(false)
|
||||
expect(restored?.status).toBe(AssetStatus.processing)
|
||||
})
|
||||
|
||||
it('should restore asset with status "processed" if no active transcode task exists', async () => {
|
||||
const team = await prisma.team.create({ data: { name: 'Restore Completed Team' } })
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'Restore Completed Project', teamId: team.id },
|
||||
})
|
||||
const rootFolder = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'root',
|
||||
type: AssetType.folder,
|
||||
projectId: project.id,
|
||||
status: AssetStatus.uploaded,
|
||||
},
|
||||
})
|
||||
const file = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'completed-video.mp4',
|
||||
type: AssetType.file,
|
||||
projectId: project.id,
|
||||
parentId: rootFolder.id,
|
||||
status: AssetStatus.trashed,
|
||||
isDeleted: true,
|
||||
deletedAt: new Date(),
|
||||
},
|
||||
})
|
||||
|
||||
// Completed transcode task
|
||||
await prisma.workflowTask.create({
|
||||
data: {
|
||||
assetId: file.id,
|
||||
type: WorkflowTaskType.transcode_video,
|
||||
status: WorkflowTaskStatus.completed,
|
||||
},
|
||||
})
|
||||
|
||||
await assetService.restoreAssets([file.id])
|
||||
|
||||
const restored = await prisma.asset.findUnique({ where: { id: file.id } })
|
||||
expect(restored?.isDeleted).toBe(false)
|
||||
expect(restored?.status).toBe(AssetStatus.processed)
|
||||
})
|
||||
})
|
||||
|
||||
describe('HLS playlists', () => {
|
||||
const setupHlsAssets = async () => {
|
||||
const team = await prisma.team.create({ data: { name: 'hls-team-' + Date.now() } })
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'hls-proj-' + Date.now(), teamId: team.id },
|
||||
})
|
||||
const rootFolder = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'root',
|
||||
type: AssetType.folder,
|
||||
projectId: project.id,
|
||||
status: AssetStatus.processed,
|
||||
},
|
||||
})
|
||||
return { team, project, rootFolder }
|
||||
}
|
||||
|
||||
it('getHlsMasterPlaylist throws 404 if asset is not HLS', async () => {
|
||||
const { project, rootFolder } = await setupHlsAssets()
|
||||
const file = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'regular.mp4',
|
||||
type: AssetType.file,
|
||||
projectId: project.id,
|
||||
parentId: rootFolder.id,
|
||||
status: AssetStatus.processed,
|
||||
media: {
|
||||
isHls: false,
|
||||
} as PrismaJson.MediaInfo,
|
||||
},
|
||||
})
|
||||
|
||||
await expect(assetService.getHlsMasterPlaylist({ assetId: file.id })).rejects.toThrow(
|
||||
'HLS playlist not found',
|
||||
)
|
||||
})
|
||||
|
||||
it('getHlsMasterPlaylist returns playlist string when asset is HLS', async () => {
|
||||
const { project, rootFolder } = await setupHlsAssets()
|
||||
const file = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'hls-video.mp4',
|
||||
type: AssetType.file,
|
||||
projectId: project.id,
|
||||
parentId: rootFolder.id,
|
||||
status: AssetStatus.processed,
|
||||
media: {
|
||||
isHls: true,
|
||||
hls: {
|
||||
key: 'files/asset/hls/master.m3u8',
|
||||
resolutions: [
|
||||
{ resolution: '1080p', width: 1920, height: 1080 },
|
||||
{ resolution: '720p', width: 1280, height: 720 },
|
||||
],
|
||||
},
|
||||
} as PrismaJson.MediaInfo,
|
||||
},
|
||||
})
|
||||
|
||||
const masterContent = '#EXTM3U\n#EXT-X-STREAM-INF:BANDWIDTH=4628000\n1080p/index.m3u8\n'
|
||||
vi.mocked(s3Service.getObject).mockResolvedValueOnce({
|
||||
buffer: Buffer.from(masterContent),
|
||||
} as unknown as Awaited<ReturnType<typeof s3Service.getObject>>)
|
||||
|
||||
const res = await assetService.getHlsMasterPlaylist({ assetId: file.id })
|
||||
expect(res).toBe(masterContent)
|
||||
expect(s3Service.getObject).toHaveBeenCalledWith(
|
||||
expect.any(String),
|
||||
'files/asset/hls/master.m3u8',
|
||||
)
|
||||
})
|
||||
|
||||
it('getHlsVariantPlaylist fetches and rewrites segment URLs', async () => {
|
||||
const { project, rootFolder } = await setupHlsAssets()
|
||||
const file = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'hls-video.mp4',
|
||||
type: AssetType.file,
|
||||
projectId: project.id,
|
||||
parentId: rootFolder.id,
|
||||
status: AssetStatus.processed,
|
||||
media: {
|
||||
isHls: true,
|
||||
hls: {
|
||||
key: 'files/asset/hls/master.m3u8',
|
||||
resolutions: [{ resolution: '1080p', width: 1920, height: 1080 }],
|
||||
},
|
||||
} as PrismaJson.MediaInfo,
|
||||
},
|
||||
})
|
||||
|
||||
const sampleVariant = '#EXTM3U\n#EXT-X-MAP:URI="init.mp4"\nsegment_000.m4s\n'
|
||||
vi.mocked(s3Service.getObject).mockResolvedValueOnce({
|
||||
buffer: Buffer.from(sampleVariant),
|
||||
} as unknown as Awaited<ReturnType<typeof s3Service.getObject>>)
|
||||
vi.mocked(s3Service.presign).mockResolvedValue('http://mock-s3-url')
|
||||
|
||||
const variant = await assetService.getHlsVariantPlaylist({
|
||||
assetId: file.id,
|
||||
resolution: '1080p',
|
||||
})
|
||||
expect(variant).toBeDefined()
|
||||
expect(variant).toContain('#EXT-X-MAP:URI="http://mock-s3-url"')
|
||||
expect(variant).toContain('http://mock-s3-url')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import { cancelWorkflowTask, prisma } from '@shumai/db'
|
||||
import {
|
||||
AncestorFolder,
|
||||
AssetInfo,
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
ListRecentsRequest,
|
||||
CommentExportFormat,
|
||||
PreviewFormat,
|
||||
TRASH_RETENTION_DAYS,
|
||||
} from '@shumai/dtos'
|
||||
import {
|
||||
exportCommentsToFormat,
|
||||
@@ -28,7 +29,15 @@ import {
|
||||
type ExportOptions,
|
||||
type ExportResult,
|
||||
} from './comments-export'
|
||||
import { type Asset, AssetStatus, AssetType, Prisma, type StorageKey } from '@shumai/db'
|
||||
import {
|
||||
type Asset,
|
||||
AssetStatus,
|
||||
AssetType,
|
||||
Prisma,
|
||||
type StorageKey,
|
||||
WorkflowTaskStatus,
|
||||
WorkflowTaskType,
|
||||
} from '@shumai/db'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { PaginatedData, paginateQuery, PaginationParams } from '@shumai/core/src/pagination'
|
||||
@@ -46,6 +55,9 @@ import { getAgentRequiredLevel, getRoleLevel } from '@shumai/core/src/agent/perm
|
||||
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
|
||||
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
import { uploadService } from '@shumai/core/src/upload/upload'
|
||||
import path from 'path'
|
||||
import { stemFromKey } from '@shumai/core/src/utils/filename'
|
||||
import { rewriteM3u8WithPresignedUrls } from '@shumai/core/src/transcode/transcode'
|
||||
|
||||
export const assetInclude = {
|
||||
creator: true,
|
||||
@@ -88,6 +100,31 @@ export type AssetWithIncludes = Prisma.AssetGetPayload<{
|
||||
include: typeof assetInclude
|
||||
}>
|
||||
|
||||
/**
|
||||
* Same shape as {@link assetInclude}, but keeps soft-deleted children.
|
||||
*
|
||||
* The "Recently Deleted" view needs this because deleting a folder soft-deletes
|
||||
* all of its descendants by cascade, so filtering out deleted children leaves
|
||||
* the folder card with no previews of what was inside it.
|
||||
*/
|
||||
export const assetIncludeIncludingDeletedChildren = {
|
||||
...assetInclude,
|
||||
target: {
|
||||
...assetInclude.target,
|
||||
include: {
|
||||
...assetInclude.target.include,
|
||||
children: {
|
||||
...assetInclude.target.include.children,
|
||||
where: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
children: {
|
||||
...assetInclude.children,
|
||||
where: {},
|
||||
},
|
||||
} as const
|
||||
|
||||
type CommentWithIncludes = Prisma.AssetCommentGetPayload<{
|
||||
include: {
|
||||
creator: true
|
||||
@@ -688,7 +725,7 @@ export class AssetService {
|
||||
throw new Error('ProjectID is required when ShowDeleted is true')
|
||||
}
|
||||
const thirtyDaysAgo = new Date()
|
||||
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30)
|
||||
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - TRASH_RETENTION_DAYS)
|
||||
|
||||
where = {
|
||||
projectId: req.projectId,
|
||||
@@ -741,11 +778,13 @@ export class AssetService {
|
||||
break
|
||||
}
|
||||
|
||||
const include = req.showDeleted ? assetIncludeIncludingDeletedChildren : assetInclude
|
||||
|
||||
const { data: assets, pageInfo } = await paginateQuery(
|
||||
async (skip, take) => {
|
||||
return this.prismaClient.asset.findMany({
|
||||
where,
|
||||
include: assetInclude,
|
||||
include,
|
||||
orderBy,
|
||||
skip,
|
||||
take,
|
||||
@@ -755,7 +794,9 @@ export class AssetService {
|
||||
req,
|
||||
)
|
||||
|
||||
const infos = await this.toAssetInfos(assets)
|
||||
const infos = await this.toAssetInfos(assets, undefined, {
|
||||
includeDeletedChildren: req.showDeleted,
|
||||
})
|
||||
|
||||
return { data: infos, pageInfo }
|
||||
}
|
||||
@@ -1341,7 +1382,7 @@ export class AssetService {
|
||||
private async cascadeStatusToPendingPurge(rootIds: string[]): Promise<void> {
|
||||
if (rootIds.length === 0) return
|
||||
|
||||
await this.prismaClient.$executeRaw`
|
||||
const rows = await this.prismaClient.$queryRaw<{ id: string }[]>`
|
||||
WITH RECURSIVE descendant AS (
|
||||
SELECT id FROM assets WHERE id = ANY(${rootIds})
|
||||
UNION ALL
|
||||
@@ -1356,15 +1397,35 @@ export class AssetService {
|
||||
WHERE s.type = 'symlink' AND s.target_id IN (SELECT id FROM all_purging_targets)
|
||||
)
|
||||
UPDATE assets SET status = 'pending_purge', updated_at = NOW()
|
||||
WHERE id IN (SELECT id FROM all_purging_targets) OR id IN (SELECT id FROM all_affected_symlinks);
|
||||
WHERE id IN (SELECT id FROM all_purging_targets) OR id IN (SELECT id FROM all_affected_symlinks)
|
||||
RETURNING id;
|
||||
`
|
||||
|
||||
const affectedIds = rows.map((r) => r.id)
|
||||
if (affectedIds.length > 0) {
|
||||
const inFlightTasks = await this.prismaClient.workflowTask.findMany({
|
||||
where: {
|
||||
assetId: { in: affectedIds },
|
||||
status: { in: [WorkflowTaskStatus.pending, WorkflowTaskStatus.processing] },
|
||||
},
|
||||
select: { id: true },
|
||||
})
|
||||
|
||||
for (const task of inFlightTasks) {
|
||||
try {
|
||||
logger.info({ taskId: task.id }, 'Cancelling in-flight workflow task for purging asset')
|
||||
await cancelWorkflowTask(task.id)
|
||||
} catch (err) {
|
||||
logger.warn({ taskId: task.id, err }, 'Failed to cancel workflow task during purge')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async emptyTrash(projectId: string): Promise<void> {
|
||||
const trashedRoots = await this.prismaClient.asset.findMany({
|
||||
where: {
|
||||
projectId,
|
||||
status: 'trashed',
|
||||
isDeleted: true,
|
||||
},
|
||||
select: { id: true },
|
||||
@@ -1411,14 +1472,14 @@ export class AssetService {
|
||||
* Cascade the 'pending_purge' status to all their descendants.
|
||||
*/
|
||||
private async expireTrashedAssets() {
|
||||
const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)
|
||||
const thirtyDaysAgo = new Date(Date.now() - TRASH_RETENTION_DAYS * 24 * 60 * 60 * 1000)
|
||||
|
||||
// Find up to 100 expired roots, ordered by oldest first to avoid starvation
|
||||
const expiredRoots = await this.prismaClient.asset.findMany({
|
||||
where: {
|
||||
status: 'trashed',
|
||||
deletedAt: { lt: thirtyDaysAgo },
|
||||
isDeleted: true,
|
||||
status: { not: AssetStatus.pending_purge },
|
||||
deletedAt: { lt: thirtyDaysAgo },
|
||||
},
|
||||
orderBy: { deletedAt: 'asc' },
|
||||
select: { id: true },
|
||||
@@ -1433,6 +1494,35 @@ export class AssetService {
|
||||
* Stage 2: Delete DB records for assets marked as 'pending_purge'.
|
||||
*/
|
||||
private async purgePendingAssets() {
|
||||
const pendingAssets = await this.prismaClient.asset.findMany({
|
||||
where: { status: AssetStatus.pending_purge },
|
||||
select: { id: true },
|
||||
})
|
||||
const pendingAssetIds = pendingAssets.map((a) => a.id)
|
||||
|
||||
if (pendingAssetIds.length > 0) {
|
||||
const inFlightTasks = await this.prismaClient.workflowTask.findMany({
|
||||
where: {
|
||||
assetId: { in: pendingAssetIds },
|
||||
status: { in: [WorkflowTaskStatus.pending, WorkflowTaskStatus.processing] },
|
||||
},
|
||||
select: { id: true },
|
||||
})
|
||||
|
||||
for (const task of inFlightTasks) {
|
||||
try {
|
||||
logger.info({ taskId: task.id }, 'Cancelling in-flight workflow task before purge')
|
||||
await cancelWorkflowTask(task.id)
|
||||
} catch (err) {
|
||||
logger.warn({ taskId: task.id, err }, 'Failed to cancel workflow task during purge')
|
||||
}
|
||||
}
|
||||
|
||||
await this.prismaClient.workflowTask.deleteMany({
|
||||
where: { assetId: { in: pendingAssetIds } },
|
||||
})
|
||||
}
|
||||
|
||||
const { count } = await this.prismaClient.asset.deleteMany({
|
||||
where: { status: AssetStatus.pending_purge },
|
||||
})
|
||||
@@ -1575,11 +1665,30 @@ export class AssetService {
|
||||
}
|
||||
}
|
||||
|
||||
const activeTask = await tx.workflowTask.findFirst({
|
||||
where: {
|
||||
assetId: a.id,
|
||||
status: { in: [WorkflowTaskStatus.pending, WorkflowTaskStatus.processing] },
|
||||
type: {
|
||||
in: [
|
||||
WorkflowTaskType.transcode,
|
||||
WorkflowTaskType.transcode_video,
|
||||
WorkflowTaskType.transcode_image,
|
||||
WorkflowTaskType.transcode_pdf,
|
||||
WorkflowTaskType.transcode_pdf_pages,
|
||||
WorkflowTaskType.transcode_screenshot,
|
||||
WorkflowTaskType.transcode_image_annotation,
|
||||
WorkflowTaskType.transcode_watermark,
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await tx.asset.update({
|
||||
where: { id: a.id },
|
||||
data: {
|
||||
isDeleted: false,
|
||||
status: 'processed',
|
||||
status: activeTask ? AssetStatus.processing : AssetStatus.processed,
|
||||
deletedAt: null,
|
||||
},
|
||||
})
|
||||
@@ -2045,7 +2154,9 @@ export class AssetService {
|
||||
async toAssetInfos(
|
||||
assets: AssetWithIncludes[],
|
||||
previewFormat?: PreviewFormat,
|
||||
options?: { includeDeletedChildren?: boolean },
|
||||
): Promise<AssetInfo[]> {
|
||||
const includeDeletedChildren = options?.includeDeletedChildren ?? false
|
||||
const stackIds = new Set<string>()
|
||||
|
||||
for (const a of assets) {
|
||||
@@ -2076,7 +2187,10 @@ export class AssetService {
|
||||
const versionsMap = new Map<string, AssetWithIncludes['children'][0][]>()
|
||||
if (stackIds.size > 0) {
|
||||
const allVersions = await this.prismaClient.asset.findMany({
|
||||
where: { parentId: { in: Array.from(stackIds) }, isDeleted: false },
|
||||
where: {
|
||||
parentId: { in: Array.from(stackIds) },
|
||||
...(includeDeletedChildren ? {} : { isDeleted: false }),
|
||||
},
|
||||
include: {
|
||||
creator: true,
|
||||
agent: { include: { user: true } },
|
||||
@@ -2202,7 +2316,7 @@ export class AssetService {
|
||||
folderForPreview.children
|
||||
) {
|
||||
for (const child of folderForPreview.children) {
|
||||
if (child.isDeleted) continue
|
||||
if (!includeDeletedChildren && child.isDeleted) continue
|
||||
let previewAsset = child as Asset
|
||||
let mediaType = child.mediaType
|
||||
|
||||
@@ -2273,6 +2387,9 @@ export class AssetService {
|
||||
'GET',
|
||||
)
|
||||
}
|
||||
if (media && media.isHls && media.hls?.key) {
|
||||
media.hls.url = `/api/files/${latestVersion.id}/m3u8/master.m3u8`
|
||||
}
|
||||
|
||||
const key = latestVersion.storageKey?.key
|
||||
if (key) {
|
||||
@@ -2290,7 +2407,13 @@ export class AssetService {
|
||||
}
|
||||
}
|
||||
|
||||
const proxyType = (media?.proxyType || null) as 'image' | 'video' | 'audio' | 'pdf' | null
|
||||
const proxyType = (media?.proxyType || null) as
|
||||
| 'image'
|
||||
| 'video'
|
||||
| 'audio'
|
||||
| 'pdf'
|
||||
| '3d'
|
||||
| null
|
||||
|
||||
result.push({
|
||||
id: a.id,
|
||||
@@ -2594,6 +2717,7 @@ export class AssetService {
|
||||
|
||||
let storageKey = asset.storageKey.key
|
||||
let assetDir = storageKey.substring(0, storageKey.lastIndexOf('/') + 1)
|
||||
let targetName = asset.name
|
||||
|
||||
if (!key.startsWith(assetDir) && asset.parentId) {
|
||||
// Check if requested key belongs to another version in the same version stack
|
||||
@@ -2603,11 +2727,14 @@ export class AssetService {
|
||||
isDeleted: false,
|
||||
storageKey: { key: { startsWith: key.substring(0, key.lastIndexOf('/') + 1) } },
|
||||
},
|
||||
select: { storageKey: { select: { key: true } } },
|
||||
select: { name: true, storageKey: { select: { key: true } } },
|
||||
})
|
||||
if (sibling?.storageKey?.key) {
|
||||
storageKey = sibling.storageKey.key
|
||||
assetDir = storageKey.substring(0, storageKey.lastIndexOf('/') + 1)
|
||||
if (sibling.name) {
|
||||
targetName = sibling.name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2615,13 +2742,35 @@ export class AssetService {
|
||||
throw new Error('Key does not belong to this asset')
|
||||
}
|
||||
|
||||
return s3Service.presign(
|
||||
process.env.S3_BUCKET || 'shumai',
|
||||
key,
|
||||
'GET',
|
||||
true,
|
||||
asset.name ?? undefined,
|
||||
)
|
||||
let downloadFilename: string | undefined
|
||||
if (key === storageKey) {
|
||||
downloadFilename = targetName ?? undefined
|
||||
} else {
|
||||
const keyBasename = path.posix.basename(key)
|
||||
const originalStem = stemFromKey(storageKey)
|
||||
const assetStem = targetName ? stemFromKey(targetName) : originalStem
|
||||
|
||||
if (
|
||||
originalStem &&
|
||||
assetStem &&
|
||||
originalStem !== assetStem &&
|
||||
keyBasename.startsWith(originalStem + '-')
|
||||
) {
|
||||
downloadFilename = assetStem + keyBasename.slice(originalStem.length)
|
||||
} else if (
|
||||
originalStem &&
|
||||
assetStem &&
|
||||
originalStem !== assetStem &&
|
||||
keyBasename.startsWith('watermark-' + originalStem + '-')
|
||||
) {
|
||||
downloadFilename =
|
||||
'watermark-' + assetStem + keyBasename.slice(('watermark-' + originalStem).length)
|
||||
} else {
|
||||
downloadFilename = keyBasename
|
||||
}
|
||||
}
|
||||
|
||||
return s3Service.presign(process.env.S3_BUCKET || 'shumai', key, 'GET', true, downloadFilename)
|
||||
}
|
||||
|
||||
async toPreviewInfo(
|
||||
@@ -2630,7 +2779,13 @@ export class AssetService {
|
||||
): Promise<PreviewInfo | null> {
|
||||
if (!asset.media) return null
|
||||
|
||||
const proxyType = (asset.media?.proxyType || null) as 'image' | 'video' | 'audio' | 'pdf' | null
|
||||
const proxyType = (asset.media?.proxyType || null) as
|
||||
| 'image'
|
||||
| 'video'
|
||||
| 'audio'
|
||||
| 'pdf'
|
||||
| '3d'
|
||||
| null
|
||||
|
||||
let rawThumbKey: string | undefined
|
||||
if (proxyType === 'image' && asset.media.thumbnail?.key) {
|
||||
@@ -2683,7 +2838,7 @@ export class AssetService {
|
||||
originalHeight: asset.media.metadata?.originalHeight,
|
||||
originalWidth: asset.media.metadata?.originalWidth,
|
||||
spriteUrl,
|
||||
duration: asset.media.metadata?.duration,
|
||||
duration: proxyType === '3d' ? undefined : asset.media.metadata?.duration,
|
||||
pageCount: asset.media.metadata?.totalFrames,
|
||||
}
|
||||
}
|
||||
@@ -3057,6 +3212,95 @@ export class AssetService {
|
||||
req,
|
||||
)
|
||||
}
|
||||
|
||||
async getHlsMasterPlaylist(params: {
|
||||
assetId: string
|
||||
watermarkConfigId?: string | null
|
||||
}): Promise<string> {
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
const targetAssetId = await this.resolveLatestVersionId(params.assetId)
|
||||
|
||||
if (params.watermarkConfigId) {
|
||||
const wf = await this.prismaClient.watermarkFile.findUnique({
|
||||
where: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
assetId_watermarkConfigId: {
|
||||
assetId: targetAssetId,
|
||||
watermarkConfigId: params.watermarkConfigId,
|
||||
},
|
||||
},
|
||||
})
|
||||
const media = wf?.media as PrismaJson.MediaInfo | null
|
||||
if (!media?.isHls || !media.hls?.key) {
|
||||
throw new HTTPException(404, { message: 'HLS playlist not found' })
|
||||
}
|
||||
const obj = await s3Service.getObject(bucket, media.hls.key)
|
||||
return obj.buffer.toString('utf-8')
|
||||
}
|
||||
|
||||
const asset = await this.prismaClient.asset.findUnique({
|
||||
where: { id: targetAssetId },
|
||||
})
|
||||
if (!asset) {
|
||||
throw new HTTPException(404, { message: 'Asset not found' })
|
||||
}
|
||||
const media = asset.media as PrismaJson.MediaInfo | null
|
||||
if (!media?.isHls || !media.hls?.key) {
|
||||
throw new HTTPException(404, { message: 'HLS playlist not found' })
|
||||
}
|
||||
const obj = await s3Service.getObject(bucket, media.hls.key)
|
||||
return obj.buffer.toString('utf-8')
|
||||
}
|
||||
|
||||
async getHlsVariantPlaylist(params: {
|
||||
assetId: string
|
||||
resolution: string
|
||||
watermarkConfigId?: string | null
|
||||
}): Promise<string> {
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
if (!/^\d+p$/.test(params.resolution)) {
|
||||
throw new HTTPException(400, { message: 'Invalid resolution format' })
|
||||
}
|
||||
|
||||
const targetAssetId = await this.resolveLatestVersionId(params.assetId)
|
||||
let media: PrismaJson.MediaInfo | null
|
||||
|
||||
if (params.watermarkConfigId) {
|
||||
const wf = await this.prismaClient.watermarkFile.findUnique({
|
||||
where: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
assetId_watermarkConfigId: {
|
||||
assetId: targetAssetId,
|
||||
watermarkConfigId: params.watermarkConfigId,
|
||||
},
|
||||
},
|
||||
})
|
||||
media = (wf?.media as PrismaJson.MediaInfo | null) ?? null
|
||||
} else {
|
||||
const asset = await this.prismaClient.asset.findUnique({
|
||||
where: { id: targetAssetId },
|
||||
})
|
||||
if (!asset) {
|
||||
throw new HTTPException(404, { message: 'Asset not found' })
|
||||
}
|
||||
media = (asset.media as PrismaJson.MediaInfo | null) ?? null
|
||||
}
|
||||
|
||||
if (!media?.isHls || !media.hls?.key) {
|
||||
throw new HTTPException(404, { message: 'HLS playlist not found' })
|
||||
}
|
||||
|
||||
const matchedRes = media.hls.resolutions?.find((r) => r.resolution === params.resolution)
|
||||
const variantKey =
|
||||
matchedRes?.key ||
|
||||
path.posix.join(path.posix.dirname(media.hls.key), params.resolution, 'index.m3u8')
|
||||
|
||||
const obj = await s3Service.getObject(bucket, variantKey)
|
||||
const rawM3u8 = obj.buffer.toString('utf-8')
|
||||
const s3Prefix = path.posix.dirname(variantKey)
|
||||
|
||||
return await rewriteM3u8WithPresignedUrls(rawM3u8, s3Prefix, bucket)
|
||||
}
|
||||
}
|
||||
|
||||
export const assetService = new AssetService()
|
||||
|
||||
@@ -2,9 +2,12 @@ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import * as os from 'os'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { GotenbergService } from './gotenberg'
|
||||
|
||||
describe('GotenbergService', () => {
|
||||
setupTestDbHooks()
|
||||
const originalEnv = process.env
|
||||
let tmpDir: string
|
||||
let testFilePath: string
|
||||
@@ -216,4 +219,148 @@ describe('GotenbergService', () => {
|
||||
expect(indexHtmlText).toContain('{{ toHTML "file.md" }}')
|
||||
})
|
||||
})
|
||||
|
||||
describe('team settings & fallback', () => {
|
||||
it('resolves config from team settings when env is not set', async () => {
|
||||
delete process.env.GOTENBERG_URL
|
||||
const team = await prisma.team.create({
|
||||
data: {
|
||||
name: 'Gotenberg Team',
|
||||
settings: {
|
||||
gotenberg: {
|
||||
url: 'http://custom-gotenberg:4000',
|
||||
username: 'team-user',
|
||||
password: 'team-password',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const service = new GotenbergService()
|
||||
const config = await service.resolveConfig(team.id)
|
||||
|
||||
expect(config).toEqual({
|
||||
url: 'http://custom-gotenberg:4000',
|
||||
username: 'team-user',
|
||||
password: 'team-password',
|
||||
isEnv: false,
|
||||
})
|
||||
})
|
||||
|
||||
it('prioritizes environment variables over team settings', async () => {
|
||||
process.env.GOTENBERG_URL = 'http://env-gotenberg:3000'
|
||||
const team = await prisma.team.create({
|
||||
data: {
|
||||
name: 'Gotenberg Team',
|
||||
settings: {
|
||||
gotenberg: {
|
||||
url: 'http://custom-gotenberg:4000',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const service = new GotenbergService()
|
||||
const config = await service.resolveConfig(team.id)
|
||||
|
||||
expect(config.url).toBe('http://env-gotenberg:3000')
|
||||
expect(config.isEnv).toBe(true)
|
||||
})
|
||||
|
||||
it('getSettings returns masked settings response', async () => {
|
||||
delete process.env.GOTENBERG_URL
|
||||
const team = await prisma.team.create({
|
||||
data: {
|
||||
name: 'Gotenberg Team',
|
||||
settings: {
|
||||
gotenberg: {
|
||||
url: 'http://custom-gotenberg:4000',
|
||||
username: 'team-user',
|
||||
password: 'team-password',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const service = new GotenbergService()
|
||||
const settings = await service.getSettings(team.id)
|
||||
|
||||
expect(settings).toEqual({
|
||||
url: 'http://custom-gotenberg:4000',
|
||||
username: 'team-user',
|
||||
hasPassword: true,
|
||||
isEnvConfigured: false,
|
||||
})
|
||||
})
|
||||
|
||||
it('updateSettings updates team settings and rejects edits when env is set', async () => {
|
||||
delete process.env.GOTENBERG_URL
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'Gotenberg Team' },
|
||||
})
|
||||
|
||||
const service = new GotenbergService()
|
||||
const updated = await service.updateSettings(team.id, {
|
||||
url: 'http://new-gotenberg:3000',
|
||||
username: 'admin',
|
||||
password: 'secret-password',
|
||||
})
|
||||
|
||||
expect(updated.url).toBe('http://new-gotenberg:3000')
|
||||
expect(updated.username).toBe('admin')
|
||||
expect(updated.hasPassword).toBe(true)
|
||||
|
||||
// When env is set, reject update
|
||||
process.env.GOTENBERG_URL = 'http://env-gotenberg:3000'
|
||||
await expect(service.updateSettings(team.id, { url: 'http://another:3000' })).rejects.toThrow(
|
||||
'Gotenberg settings are configured via environment variables and cannot be edited',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('testConnection', () => {
|
||||
it('returns error when url is empty and no team settings exist', async () => {
|
||||
delete process.env.GOTENBERG_URL
|
||||
const service = new GotenbergService()
|
||||
const result = await service.testConnection({})
|
||||
expect(result.ok).toBe(false)
|
||||
expect(result.error).toBe('URL is required')
|
||||
})
|
||||
|
||||
it('successfully connects to /health and enriches with /version', async () => {
|
||||
const fetchSpy = vi.spyOn(globalThis, 'fetch').mockImplementation(async (url) => {
|
||||
const urlStr = String(url)
|
||||
if (urlStr.endsWith('/health')) {
|
||||
return { ok: true, status: 200 } as Response
|
||||
}
|
||||
if (urlStr.endsWith('/version')) {
|
||||
return {
|
||||
ok: true,
|
||||
status: 200,
|
||||
json: async () => ({ version: '8.3.0' }),
|
||||
} as Response
|
||||
}
|
||||
return { ok: false, status: 404 } as Response
|
||||
})
|
||||
|
||||
const service = new GotenbergService()
|
||||
const result = await service.testConnection({
|
||||
url: 'http://gotenberg.local:3000',
|
||||
username: 'test-user',
|
||||
password: 'test-pass',
|
||||
})
|
||||
|
||||
expect(result.ok).toBe(true)
|
||||
expect(result.version).toBe('8.3.0')
|
||||
expect(fetchSpy).toHaveBeenCalledWith(
|
||||
'http://gotenberg.local:3000/health',
|
||||
expect.objectContaining({
|
||||
method: 'GET',
|
||||
headers: expect.objectContaining({
|
||||
Authorization: expect.stringMatching(/^Basic /),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,40 +1,135 @@
|
||||
import * as fs from 'fs'
|
||||
import type { GotenbergSettingsResponse, UpdateGotenbergSettingsRequest } from '@shumai/dtos'
|
||||
import {
|
||||
IntegrationDefinition,
|
||||
resolveIntegrationConfig,
|
||||
getIntegrationSettings,
|
||||
updateIntegrationSettings,
|
||||
resolveTestConnectionConfig,
|
||||
getIntegrationBasicAuthHeader,
|
||||
ResolvedIntegrationConfig,
|
||||
} from '@shumai/core/src/integrations/helper'
|
||||
|
||||
export const GOTENBERG_INTEGRATION_DEF: IntegrationDefinition<'gotenberg'> = {
|
||||
name: 'Gotenberg',
|
||||
settingsKey: 'gotenberg',
|
||||
envKeys: {
|
||||
url: ['GOTENBERG_URL'],
|
||||
username: ['GOTENBERG_BASIC_AUTH_USERNAME'],
|
||||
password: ['GOTENBERG_BASIC_AUTH_PASSWORD'],
|
||||
},
|
||||
}
|
||||
|
||||
export interface GotenbergConvertOptions {
|
||||
landscape?: boolean
|
||||
teamId?: string
|
||||
}
|
||||
|
||||
export class GotenbergService {
|
||||
private getUrl(): string | undefined {
|
||||
const url = process.env.GOTENBERG_URL?.trim()
|
||||
return url ? url.replace(/\/+$/, '') : undefined
|
||||
async resolveConfig(teamId?: string): Promise<ResolvedIntegrationConfig> {
|
||||
return resolveIntegrationConfig(GOTENBERG_INTEGRATION_DEF, teamId)
|
||||
}
|
||||
|
||||
private getAuthHeader(): string | undefined {
|
||||
const username = process.env.GOTENBERG_BASIC_AUTH_USERNAME
|
||||
const password = process.env.GOTENBERG_BASIC_AUTH_PASSWORD
|
||||
private getAuthHeader(config: { username?: string; password?: string }): string | undefined {
|
||||
return getIntegrationBasicAuthHeader(config)
|
||||
}
|
||||
|
||||
if (username && password) {
|
||||
const credentials = Buffer.from(`${username}:${password}`).toString('base64')
|
||||
return `Basic ${credentials}`
|
||||
async getSettings(teamId: string): Promise<GotenbergSettingsResponse> {
|
||||
return getIntegrationSettings(GOTENBERG_INTEGRATION_DEF, teamId)
|
||||
}
|
||||
|
||||
async updateSettings(
|
||||
teamId: string,
|
||||
req: UpdateGotenbergSettingsRequest,
|
||||
): Promise<GotenbergSettingsResponse> {
|
||||
return updateIntegrationSettings(GOTENBERG_INTEGRATION_DEF, teamId, req)
|
||||
}
|
||||
|
||||
async testConnection(
|
||||
config?: UpdateGotenbergSettingsRequest,
|
||||
teamId?: string,
|
||||
): Promise<{ ok: boolean; version?: string; error?: string }> {
|
||||
const target = await resolveTestConnectionConfig(GOTENBERG_INTEGRATION_DEF, config, teamId)
|
||||
|
||||
if (!target.resolvedUrl) {
|
||||
return { ok: false, error: 'URL is required' }
|
||||
}
|
||||
const cleanUrl = target.resolvedUrl.replace(/\/+$/, '')
|
||||
|
||||
try {
|
||||
const headers: Record<string, string> = {}
|
||||
const authHeader = this.getAuthHeader({
|
||||
username: target.resolvedUsername,
|
||||
password: target.resolvedPassword,
|
||||
})
|
||||
if (authHeader) {
|
||||
headers['Authorization'] = authHeader
|
||||
}
|
||||
|
||||
const response = await fetch(`${cleanUrl}/health`, {
|
||||
method: 'GET',
|
||||
headers,
|
||||
signal: AbortSignal.timeout(5000),
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
const errText = await response.text().catch(() => '')
|
||||
return {
|
||||
ok: false,
|
||||
error: `Health check returned status ${response.status}: ${errText || response.statusText}`,
|
||||
}
|
||||
}
|
||||
|
||||
// Optionally try /version to obtain version string
|
||||
let version: string | undefined
|
||||
try {
|
||||
const versionRes = await fetch(`${cleanUrl}/version`, {
|
||||
method: 'GET',
|
||||
headers,
|
||||
signal: AbortSignal.timeout(2000),
|
||||
})
|
||||
if (versionRes.ok) {
|
||||
const vData = (await versionRes.json().catch(() => null)) as
|
||||
| { version?: string }
|
||||
| string
|
||||
| null
|
||||
if (vData && typeof vData === 'object' && 'version' in vData) {
|
||||
version = String(vData.version)
|
||||
} else if (typeof vData === 'string') {
|
||||
version = vData
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// Version endpoint is optional in some Gotenberg versions
|
||||
}
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
version,
|
||||
}
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : String(err)
|
||||
return {
|
||||
ok: false,
|
||||
error: msg,
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
async isAvailable(): Promise<boolean> {
|
||||
const baseUrl = this.getUrl()
|
||||
if (!baseUrl) {
|
||||
async isAvailable(teamId?: string): Promise<boolean> {
|
||||
const config = await this.resolveConfig(teamId)
|
||||
if (!config.url) {
|
||||
return false
|
||||
}
|
||||
|
||||
try {
|
||||
const headers: Record<string, string> = {}
|
||||
const authHeader = this.getAuthHeader()
|
||||
const authHeader = this.getAuthHeader(config)
|
||||
if (authHeader) {
|
||||
headers['Authorization'] = authHeader
|
||||
}
|
||||
|
||||
const response = await fetch(`${baseUrl}/health`, {
|
||||
const response = await fetch(`${config.url}/health`, {
|
||||
method: 'GET',
|
||||
headers,
|
||||
signal: AbortSignal.timeout(3000),
|
||||
@@ -50,9 +145,11 @@ export class GotenbergService {
|
||||
filePath: string,
|
||||
filename: string,
|
||||
options: GotenbergConvertOptions = {},
|
||||
teamId?: string,
|
||||
): Promise<Buffer> {
|
||||
const baseUrl = this.getUrl()
|
||||
if (!baseUrl) {
|
||||
const effectiveTeamId = teamId ?? options.teamId
|
||||
const config = await this.resolveConfig(effectiveTeamId)
|
||||
if (!config.url) {
|
||||
throw new Error('Gotenberg URL is not configured.')
|
||||
}
|
||||
|
||||
@@ -65,12 +162,12 @@ export class GotenbergService {
|
||||
}
|
||||
|
||||
const headers: Record<string, string> = {}
|
||||
const authHeader = this.getAuthHeader()
|
||||
const authHeader = this.getAuthHeader(config)
|
||||
if (authHeader) {
|
||||
headers['Authorization'] = authHeader
|
||||
}
|
||||
|
||||
const response = await fetch(`${baseUrl}/forms/libreoffice/convert`, {
|
||||
const response = await fetch(`${config.url}/forms/libreoffice/convert`, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: formData,
|
||||
@@ -88,9 +185,9 @@ export class GotenbergService {
|
||||
return Buffer.from(arrayBuffer)
|
||||
}
|
||||
|
||||
async convertHtmlToPdf(filePath: string, filename: string): Promise<Buffer> {
|
||||
const baseUrl = this.getUrl()
|
||||
if (!baseUrl) {
|
||||
async convertHtmlToPdf(filePath: string, filename: string, teamId?: string): Promise<Buffer> {
|
||||
const config = await this.resolveConfig(teamId)
|
||||
if (!config.url) {
|
||||
throw new Error('Gotenberg URL is not configured.')
|
||||
}
|
||||
|
||||
@@ -103,12 +200,12 @@ export class GotenbergService {
|
||||
formData.append('files', new Blob([fileBytes]), targetFilename)
|
||||
|
||||
const headers: Record<string, string> = {}
|
||||
const authHeader = this.getAuthHeader()
|
||||
const authHeader = this.getAuthHeader(config)
|
||||
if (authHeader) {
|
||||
headers['Authorization'] = authHeader
|
||||
}
|
||||
|
||||
const response = await fetch(`${baseUrl}/forms/chromium/convert/html`, {
|
||||
const response = await fetch(`${config.url}/forms/chromium/convert/html`, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: formData,
|
||||
@@ -126,9 +223,9 @@ export class GotenbergService {
|
||||
return Buffer.from(arrayBuffer)
|
||||
}
|
||||
|
||||
async convertMarkdownToPdf(filePath: string, filename: string): Promise<Buffer> {
|
||||
const baseUrl = this.getUrl()
|
||||
if (!baseUrl) {
|
||||
async convertMarkdownToPdf(filePath: string, filename: string, teamId?: string): Promise<Buffer> {
|
||||
const config = await this.resolveConfig(teamId)
|
||||
if (!config.url) {
|
||||
throw new Error('Gotenberg URL is not configured.')
|
||||
}
|
||||
|
||||
@@ -151,12 +248,12 @@ export class GotenbergService {
|
||||
formData.append('files', new Blob([fileBytes]), mdFilename)
|
||||
|
||||
const headers: Record<string, string> = {}
|
||||
const authHeader = this.getAuthHeader()
|
||||
const authHeader = this.getAuthHeader(config)
|
||||
if (authHeader) {
|
||||
headers['Authorization'] = authHeader
|
||||
}
|
||||
|
||||
const response = await fetch(`${baseUrl}/forms/chromium/convert/markdown`, {
|
||||
const response = await fetch(`${config.url}/forms/chromium/convert/markdown`, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: formData,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user