From fc6ad2032995216bf4fcad65ef260b27ed8b4cbd Mon Sep 17 00:00:00 2001 From: yiling Date: Tue, 16 Jun 2026 12:15:53 +0800 Subject: [PATCH] docs: improve and restructure shumai documentation --- docs/configuration/env-variables.mdx | 72 ++++++++++++ docs/docs.json | 42 ++++++- docs/getting-started/overview.mdx | 67 +++++++++++ docs/getting-started/quickstart.mdx | 107 ++++++++++++++++++ docs/introduction.mdx | 15 ++- docs/using-shumai/agent-providers.mdx | 39 +++++++ docs/using-shumai/agent-sandbox.mdx | 40 +++++++ docs/using-shumai/agent-skills.mdx | 47 ++++++++ docs/using-shumai/agents.mdx | 49 ++++++++ docs/using-shumai/collections.mdx | 68 +++++++++++ docs/using-shumai/comments.mdx | 55 +++++++++ docs/using-shumai/metadata.mdx | 46 ++++++++ docs/using-shumai/notifications.mdx | 40 +++++++ docs/using-shumai/semantic-search.mdx | 39 +++++++ docs/using-shumai/share-links.mdx | 45 ++++++++ docs/using-shumai/sort-and-search.mdx | 34 ++++++ docs/using-shumai/team-project-management.mdx | 46 ++++++++ docs/using-shumai/transcode-settings.mdx | 39 +++++++ docs/using-shumai/upload.mdx | 49 ++++++++ docs/using-shumai/version-stack.mdx | 42 +++++++ 20 files changed, 977 insertions(+), 4 deletions(-) create mode 100644 docs/configuration/env-variables.mdx create mode 100644 docs/getting-started/overview.mdx create mode 100644 docs/getting-started/quickstart.mdx create mode 100644 docs/using-shumai/agent-providers.mdx create mode 100644 docs/using-shumai/agent-sandbox.mdx create mode 100644 docs/using-shumai/agent-skills.mdx create mode 100644 docs/using-shumai/agents.mdx create mode 100644 docs/using-shumai/collections.mdx create mode 100644 docs/using-shumai/comments.mdx create mode 100644 docs/using-shumai/metadata.mdx create mode 100644 docs/using-shumai/notifications.mdx create mode 100644 docs/using-shumai/semantic-search.mdx create mode 100644 docs/using-shumai/share-links.mdx create mode 100644 docs/using-shumai/sort-and-search.mdx create mode 100644 docs/using-shumai/team-project-management.mdx create mode 100644 docs/using-shumai/transcode-settings.mdx create mode 100644 docs/using-shumai/upload.mdx create mode 100644 docs/using-shumai/version-stack.mdx diff --git a/docs/configuration/env-variables.mdx b/docs/configuration/env-variables.mdx new file mode 100644 index 00000000..3f09f452 --- /dev/null +++ b/docs/configuration/env-variables.mdx @@ -0,0 +1,72 @@ +--- +title: Environment Variables +description: Comprehensive configuration reference for Shumai. +--- + +Shumai is configured via environment variables. You can define these variables in a `.env` file at the root of your application workspace, or pass them directly to your Docker containers. + +--- + +## Database Config + +| Variable | Description | Example / Default | +| :------------- | :----------------------------------------------------------------------------------------- | :------------------------------------------------------- | +| `DATABASE_URL` | PostgreSQL connection URL. Must target a database with the `pgvector` extension installed. | `postgresql://user:pass@localhost:5432/db?schema=public` | + +--- + +## Authentication 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` | + +--- + +## Storage Config + +Shumai supports storing files locally or on S3-compatible endpoints. + +| Variable | Description | Example / Default | +| :------------------------- | :------------------------------------------------------------------------------------------------ | :-------------------------------- | +| `STORAGE_BACKEND` | Storage type. Use `local` for local file system storage, or `s3` for S3-compatible cloud storage. | `local` (default) or `s3` | +| `AWS_ENDPOINT_URL_S3` | Custom endpoint for S3 storage. Must change to public domain/IP if deploying remotely. | `http://localhost:3000` (default) | +| `S3_BUCKET` | S3 bucket name. | `shumai` (default) | +| `S3_ACCESS_KEY_ID` | Access key credentials for S3. | `minioadmin` (default) | +| `S3_SECRET_ACCESS_KEY` | Secret key credentials for S3. | `minioadmin` (default) | +| `S3_REGION` | S3 storage region. | `auto` (default) | +| `S3_USE_SSL` | Set to `true` to use HTTPS for S3 endpoints. | `false` (default) | +| `PRESIGNED_URL_EXPIRES_IN` | Number of hours for which generated presigned download/upload links are valid. | `5` (default) | + +--- + +## Workflow Config + +Configures whether background transcoding and AI agents are executed locally or offloaded to a Temporal cluster. + +| 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) | + +--- + +## Logging Config + +| Variable | Description | Example / Default | +| :----------- | :--------------------------------------------------------------------------------------------------- | :---------------- | +| `LOG_LEVEL` | Pino logging level. Options: `debug`, `info`, `warn`, `error`. | `info` (default) | +| `LOG_FORMAT` | Log format style. Use `json` for production logging, or `pretty` for human-readable terminal output. | `json` (default) | + +--- + +## AI Credentials Backup + +Optional global keys to pre-authorize the built-in AI providers on startup. + +| Variable | Description | Example / Default | +| :------------------ | :------------------------------------- | :---------------- | +| `GEMINI_API_KEY` | Global key for Google Gemini provider. | `AIzaSy...` | +| `OPENAI_API_KEY` | Global key for OpenAI provider. | `sk-proj-...` | +| `ANTHROPIC_API_KEY` | Global key for Anthropic provider. | `sk-ant-...` | diff --git a/docs/docs.json b/docs/docs.json index a3ee7a60..155538ba 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -16,7 +16,47 @@ "groups": [ { "group": "Getting Started", - "pages": ["introduction", "getting-started/docker"] + "pages": [ + "introduction", + "getting-started/overview", + "getting-started/quickstart", + "getting-started/docker" + ] + }, + { + "group": "Using Shumai", + "pages": [ + "using-shumai/upload", + "using-shumai/comments", + "using-shumai/version-stack", + "using-shumai/sort-and-search", + "using-shumai/team-project-management", + "using-shumai/notifications", + "using-shumai/metadata", + "using-shumai/collections", + "using-shumai/share-links" + ] + }, + { + "group": "Shumai Agent (Admin)", + "pages": [ + "using-shumai/agent-providers", + "using-shumai/agents", + "using-shumai/agent-skills", + "using-shumai/agent-sandbox" + ] + }, + { + "group": "Media Transcoding (Admin)", + "pages": ["using-shumai/transcode-settings"] + }, + { + "group": "Advanced Search", + "pages": ["using-shumai/semantic-search"] + }, + { + "group": "Configuration", + "pages": ["configuration/env-variables"] } ] } diff --git a/docs/getting-started/overview.mdx b/docs/getting-started/overview.mdx new file mode 100644 index 00000000..9622013c --- /dev/null +++ b/docs/getting-started/overview.mdx @@ -0,0 +1,67 @@ +--- +title: Overview +description: Learn about Shumai, a modern AI agent and media processing platform for creative work. +--- + +## What is Shumai? + +**Shumai** is a highly modular, self-hosted media collaboration platform and AI agent playground. It allows teams to securely store, organize, and review creative assets (video, audio, images, etc.) while leveraging advanced AI capabilities to automate metadata tagging, perform semantic visual searches, and run sandboxed automation scripts. + +![Shumai Overview Placeholder](https://placehold.co/800x450/2C2E3E/D95A66?text=Shumai+Dashboard+Overview) +_Placeholder: Dashboard view showing the file explorer, active projects, and sidebar options._ + +--- + +## High-Level Features + +- **S3-Compatible & Local FS Storage**: Flexibly store creative assets locally or connect directly to standard S3-compatible providers (AWS S3, Cloudflare R2, MinIO, etc.). +- **Media Commenting & Drawing**: Leave frame-level and timestamped feedback with sketch overlays on image and video assets. +- **Version Stacking**: Version control for assets by stacking multiple file revisions together. +- **AI-Powered Metadata & Search**: Automatically analyze files using Gemini to populate metadata fields, and search them visually or semantically via vector databases. +- **Custom Agent Skills**: Write scripts to automate repetitive workflow actions inside secure sandboxed environments. +- **Production-Ready Media Transcoding**: Offload heavy media processing workloads using distributed workers. + +--- + +## Architectural Layout + +Shumai is developed as a modern, strictly decoupled monorepo managed with **Bun Workspaces**. Its architecture ensures clear separations of concerns across the following layers: + +```mermaid +graph TD + WebUI[WebUI: packages/webui - React & Tailwind] --> API[API Layer: packages/api - Hono] + API --> Core[Core Service Layer: packages/core - Business Logic] + Core --> DB[Database Layer: packages/db - Prisma] + Core --> DTOs[DTO Layer: packages/dtos - Shared Schemas] + Core --> Workers[Workers: Agent/Transcode Workflows] +``` + +### The Monorepo Packages + +1. **WebUI (`packages/webui`)**: The user interface. Built on React and styled with Tailwind CSS and Shadcn UI. +2. **API (`packages/api`)**: The HTTP server. Built on Hono and Bun. Acts as the entrypoint for all frontend requests. +3. **Core (`packages/core`)**: The business logic and services layer. Interacts with the database, S3 storage, and external providers. +4. **Database (`packages/db`)**: Holds the database schema, Prisma client generation, and migrations (using PostgreSQL with `pgvector`). +5. **DTOs (`packages/dtos`)**: Shared data transfer object definitions and Zod schemas, guaranteeing end-to-end type safety between the frontend and backend. +6. **Workers**: Specialized packages for running background operations: + - `@shumai/workflow-core`: Common workflow engine logic. + - `@shumai/agent`: AI agent workflows and activities. + - `@shumai/transcode`: Media processing workflows and activities. + +--- + +## Dual Workflow Engines + +To cater to different environments, Shumai implements a custom background execution layer that supports two modes: + +### 1. Local Executor (Default) + +In local development or lightweight self-hosted setups, Shumai uses a polling-based engine. It continuously polls the database for pending background tasks (such as metadata autofill, embedding generation, or transcoding) and executes them directly on the main application container. + +### 2. Temporal Executor (Production-Ready) + +For heavy production workflows, Shumai decouples background task execution entirely using **Temporal**. + +- **Orchestration**: The main Hono application registers tasks to the Temporal Cluster. +- **Specialized Workers**: Separate worker machines run `@shumai/transcode` and `@shumai/agent` processes. They poll tasks from the Temporal queue and execute them independently. +- **S3 Requirement**: In Temporal mode, **you must use an S3-compatible storage backend**. Because workers run on separate machines, they cannot access a local filesystem to retrieve or write files. diff --git a/docs/getting-started/quickstart.mdx b/docs/getting-started/quickstart.mdx new file mode 100644 index 00000000..8842289f --- /dev/null +++ b/docs/getting-started/quickstart.mdx @@ -0,0 +1,107 @@ +--- +title: Quickstart +description: Get Shumai up and running in minutes using Docker, NPM, or from source. +--- + +We support three installation paths depending on your needs. For most users, **Docker Compose** is the fastest and easiest way to run Shumai. + +--- + +## Option 1: Docker Compose (Recommended) + +Docker Compose configures and runs all required services (web application, PostgreSQL with pgvector, and S3 local storage) automatically. + +### Local Stack + +A lightweight setup to run the core API and frontend using pre-built images. + +1. Download the docker-compose configuration: + ```bash + curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/docker-compose.yaml + ``` +2. Spin up the containers: + ```bash + docker compose up -d + ``` +3. Open your browser and navigate to **`http://localhost:3000`** to access the Shumai Web UI. + +### Temporal Stack (Production-Ready / Development) + +For details on running the full Temporal worker orchestration stack, refer to the [Docker Setup Guide](/getting-started/docker). + +--- + +## Option 2: Install from NPM + +You can run Shumai as a global npm package. This requires installing the system-level dependencies manually. + +### Prerequisites + +1. **FFmpeg & FFprobe**: Required for media transcoding and metadata extraction. + - **macOS**: `brew install ffmpeg` + - **Linux**: `sudo apt-get install ffmpeg` +2. **Sandbox Executable Dependencies**: Shumai runs AI agents inside secure, isolated sandboxes. + - **macOS**: Requires `ripgrep` (`brew install ripgrep`). + - **Linux**: Requires `bubblewrap`, `socat`, and `ripgrep` (`sudo apt-get install bubblewrap socat ripgrep`). On Ubuntu 24.04+, run: + ```bash + sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + ``` + +### Step-by-Step NPM Setup + +1. **Start PostgreSQL with 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 pgvector/pgvector:pg18 + ``` +2. **Install Shumai globally**: + ```bash + npm install -g @shumai-one/shumai + ``` +3. **Configure Environment Variables**: + Create a new directory and save a `.env` file inside it: + ```bash + mkdir shumai && cd shumai + ``` + Create `.env`: + ```env + DATABASE_URL=postgresql://shumai:shumai_password@localhost:5432/shumai_db?schema=public + BETTER_AUTH_SECRET=your-random-32-byte-secret-key + STORAGE_BACKEND=local + AWS_ENDPOINT_URL_S3=http://localhost:3000 + ``` +4. **Run the application**: + ```bash + shumai + ``` + Access the UI at `http://localhost:3000`. + +--- + +## Option 3: Run from Source (For Developers) + +Follow these steps to run Shumai locally for development: + +1. **Clone the Repository & Install Dependencies**: + ```bash + git clone https://github.com/shumaiOne/shumai.git + cd shumai + bun install + ``` +2. **Start the Database**: + Spin up a `pgvector` container as shown in the NPM option above. +3. **Prepare Environment Variables**: + Copy the environment variables template or create a `.env` file at the root of the workspace. +4. **Run Database Migrations**: + ```bash + bun run db:migrate + ``` +5. **Start the Development Server**: + ```bash + bun run dev + ``` + This launches the React frontend (running on port `3000`) and the Hono API backend simultaneously. diff --git a/docs/introduction.mdx b/docs/introduction.mdx index ad2cf2ac..8f6b1441 100644 --- a/docs/introduction.mdx +++ b/docs/introduction.mdx @@ -17,10 +17,19 @@ description: Welcome to Shumai, a modern AI agent and media processing platform. ## Explore the Documentation -Start by setting up Shumai on your local machine using our step-by-step guides. +Get started with Shumai by exploring the guides below: - - Learn how to build and spin up the Shumai stack quickly using Docker Compose. + + Learn about Shumai's core concepts, features, and system architecture. + + + Set up Shumai quickly using NPM, from source, or using pre-built Docker containers. + + + Spin up the production-ready Temporal or local developer stack with Docker Compose. + + + Reference all environment variables and S3/database settings. diff --git a/docs/using-shumai/agent-providers.mdx b/docs/using-shumai/agent-providers.mdx new file mode 100644 index 00000000..f05b0872 --- /dev/null +++ b/docs/using-shumai/agent-providers.mdx @@ -0,0 +1,39 @@ +--- +title: AI Providers +description: Connect Shumai to OpenAI, Anthropic, Gemini, or custom LLM gateways. +--- + +thought +To enable AI Agents, metadata autofill, and semantic search, Shumai must be connected to an AI model provider. Team Owners can manage these credentials under the **AI Providers** settings tab. + +--- + +## Built-In Providers + +Shumai ships with pre-configured settings for major LLM providers: + +- **Google Gemini**: Recommended for multimodal asset tagging (Autofill Agent) and reasoning tasks. +- **OpenAI**: Supports GPT-4, GPT-4o, and reasoning models. +- **Anthropic**: Supports the Claude 3.5 Sonnet and Haiku models. + +### Global Keys (Environment-level) + +If you define environment variables like `GEMINI_API_KEY`, `OPENAI_API_KEY`, or `ANTHROPIC_API_KEY` in your `.env` file, the respective built-in provider will use these global credentials automatically, making them immediately available to the entire team. + +--- + +## Custom Provider Configurations + +If you want to use local models (e.g. via Ollama or vLLM) or private enterprise proxy gateways, you can register custom providers: + +1. Navigate to **Team Settings** > **AI Providers**. +2. Click **Add Provider**. +3. Fill in the configuration parameters: + - **Provider Name**: e.g., `Ollama-Local` or `Enterprise-Gateway`. + - **Base URL**: The target API URL (e.g., `http://localhost:11434/v1` for Ollama). + - **API Key**: The authentication token (use `nokey` if local/unauthenticated). +4. **Register Models**: Define the list of model IDs and names (e.g., model ID `llama3`, name `Llama 3`) that this provider exposes. +5. Click **Save**. + +![AI Providers List Placeholder](https://placehold.co/800x400/2C2E3E/D95A66?text=AI+Providers+Management) +_Placeholder: Table view of active AI providers showing their status, built-in badges, and active models._ diff --git a/docs/using-shumai/agent-sandbox.mdx b/docs/using-shumai/agent-sandbox.mdx new file mode 100644 index 00000000..1dc04028 --- /dev/null +++ b/docs/using-shumai/agent-sandbox.mdx @@ -0,0 +1,40 @@ +--- +title: Agent Sandbox +description: Secure execution environment and network domain restrictions for AI agent scripts. +--- + +Running untrusted or LLM-generated code poses security risks. Shumai resolves this by executing all agent skills inside a secure, containerized, and restricted **Agent Sandbox** environment. + +--- + +## Sandbox Architecture + +The sandbox restricts the execution process from accessing the host filesystem, system processes, and internal networks: + +- **macOS Isolation**: Uses the native `sandbox-exec` utility with custom profiles that prevent unauthorized read/write access. +- **Linux Isolation**: Uses `bubblewrap` (bwrap) to build an unprivileged user namespace container with a minimal read-only root mount and strict seccomp system call filters. +- **Network Bridging**: External network calls from inside the sandbox are intercepted and routed through a secure proxy bridge (`socat`). + +--- + +## Domain Whitelisting + +By default, sandboxed code cannot make outbound HTTP requests to the internet. Team Owners must explicitly authorize external APIs by managing domain access: + +### Allowed Domains + +A list of domains (with wildcard support) that sandboxed scripts are permitted to access. + +- Default whitelisted domains include standard package registries: `registry.npmjs.org`, `pypi.org`, and public repositories like `github.com`. +- If a script needs to call a webhook or external API (e.g. `api.slack.com`), the admin must add it to the allowed list. + +### Pending Domains + +When an agent script attempts to reach a domain that is not currently authorized: + +1. The outbound connection is blocked immediately. +2. The target domain is logged and added to the **Pending Domains** list in settings. +3. Admins can review this list and click **Approve** to transfer it to Allowed Domains, or **Reject** to keep it blocked. + +![Agent Sandbox Settings Placeholder](https://placehold.co/800x400/2C2E3E/D95A66?text=Agent+Sandbox+Domain+Manager) +_Placeholder: Security settings page showing lists of Allowed Domains, Pending Domains with Approve/Deny buttons, and sandbox audit logs._ diff --git a/docs/using-shumai/agent-skills.mdx b/docs/using-shumai/agent-skills.mdx new file mode 100644 index 00000000..6d155dd9 --- /dev/null +++ b/docs/using-shumai/agent-skills.mdx @@ -0,0 +1,47 @@ +--- +title: Agent Skills +description: Extend your agents' capabilities with custom JavaScript/TypeScript tool scripts. +--- + +By default, LLMs can only process text. In Shumai, you can extend your agents' capabilities by registering **Skills**—custom scripts that the agent can choose to execute when solving a task. + +--- + +## How Skills Work + +Shumai skills are structured as standard functions that accept a JSON input payload and execute inside a secure, sandboxed environment. + +- **Function Declarations**: When you register a skill, you write a description and declare a parameters schema using JSON Schema format. +- **Tool Calling**: The LLM reads this schema. If it decides it needs to use the skill (e.g. to search a folder or calculate a statistic), it outputs a structured tool call. +- **Execution**: Shumai catches the tool call, spins up a secure sandbox, runs your skill script with the LLM's arguments, and returns the result back to the LLM to complete its response. + +--- + +## Registering a Skill + +To add a new skill, navigate to **Team Settings** > **Skills**: + +1. Click **Create Skill**. +2. Fill in the parameters: + - **Name**: E.g., `image_resizer` or `slack_notify`. + - **Description**: A clear explanation of what the tool does (the LLM reads this description to understand when to invoke it). + - **Parameters Schema**: A JSON Schema describing the input arguments. + - **Script Code**: The actual JavaScript code to be executed. +3. Click **Save**. +4. Navigate to **Agents** and check the box to assign this skill to your chosen Chat Agent. + +```javascript +// Example Skill Script: slack_notify +// Receives parameter: { channel: string, message: string } +async function main(args) { + const response = await fetch(`https://hooks.slack.com/services/${args.channel}`, { + method: 'POST', + body: JSON.stringify({ text: args.message }), + headers: { 'Content-Type': 'application/json' }, + }) + return response.ok ? 'Notification sent' : 'Failed to send' +} +``` + +![Skills List View Placeholder](https://placehold.co/800x400/2C2E3E/D95A66?text=Agent+Skills+List) +_Placeholder: Table displaying custom skills, their descriptions, code editors, and the list of agents currently utilizing them._ diff --git a/docs/using-shumai/agents.mdx b/docs/using-shumai/agents.mdx new file mode 100644 index 00000000..64cfef0e --- /dev/null +++ b/docs/using-shumai/agents.mdx @@ -0,0 +1,49 @@ +--- +title: AI Agents +description: Create and configure specialized AI agents for chat, metadata autofill, and vector embedding. +--- + +Shumai uses specialized AI Agents to perform background automation, chat workflows, and semantic indexing. Team Owners can create and manage multiple agents. + +--- + +## Agent Types + +Shumai supports three types of agents: + +### 1. Chat Agent (`chat`) + +An interactive, conversational bot that appears in your project workspace. + +- You can start an active chat session with the agent inside any project. +- The agent is context-aware: it can read files, search the project folder, inspect metadata, and read comment threads. +- You can attach custom "Skills" to a chat agent, enabling it to write files, run scripts, or interact with external APIs on your behalf. + +### 2. Autofill Agent (`autofill`) + +A background agent that monitors file uploads. + +- Once a file is uploaded, the Autofill Agent is triggered. +- It analyzes the file's content (multimodal images, text descriptions) and populates any metadata fields flagged for "AI Autofill". +- This is highly effective for automating tags, description summaries, camera settings, and video transcripts. + +### 3. Embedding Agent (`embedding`) + +A specialized utility agent that processes assets to generate vector embeddings. + +- It runs embedding models (like OpenAI's `text-embedding-3-small` or local variants) on asset text, captions, or image descriptions. +- These vectors are saved in the `asset_embeddings` table to power Shumai's natural language semantic search capabilities. + +--- + +## Configuring an Agent + +To edit or create an agent, navigate to **Team Settings** > **Agents**: + +- **Enabled / Disabled Toggle**: Stop or start the agent. If the embedding agent is disabled, semantic search indexing is paused. +- **System Prompt / Soul**: The core instructions that define the agent's behavior, guidelines, formatting requirements, and operational limits. +- **Model Provider**: Select which registered provider and model the agent should use for execution. +- **Assigned Skills**: Select which custom javascript skills this agent is permitted to execute. + +![Agent Config Panel Placeholder](https://placehold.co/800x450/2C2E3E/D95A66?text=Agent+Configuration+Dashboard) +_Placeholder: Configuration screen showing an agent's soul text editor, model dropdown, and assigned skills checkbox list._ diff --git a/docs/using-shumai/collections.mdx b/docs/using-shumai/collections.mdx new file mode 100644 index 00000000..7b2f02f4 --- /dev/null +++ b/docs/using-shumai/collections.mdx @@ -0,0 +1,68 @@ +--- +title: Collections +description: Build dynamic virtual folders using metadata filters and search criteria. +--- + +Instead of copying files into static folders, Shumai uses **Collections**—dynamic, query-based virtual views. A collection automatically groups files that match specific criteria in real-time. + +--- + +## What is a Collection? + +A **Collection** does not move or duplicate files on disk. Instead, it runs a pre-defined filter query against your project assets database. Whenever a new file is uploaded or metadata is updated to match the collection's query, the file automatically appears inside the collection. + +--- + +## Setting Up Collection Filters + +When creating or editing a collection, you specify a name and set up a **Collection Filter**: + +```json +{ + "sourceFolderId": "ulid_of_root_folder", + "searchFilter": { + "operator": "AND", + "conditions": [ + { + "field": "metadata.status", + "operator": "eq", + "value": "Approved" + }, + { + "field": "type", + "operator": "is", + "value": "file" + } + ] + } +} +``` + +### 1. Source Folder + +Specify the folder root where the query starts. The collection will scan this directory and all its nested subfolders recursively. + +### 2. Operators and Conditions + +- **Logical Operators**: Combine conditions using `AND` (all conditions must be met) or `OR` (at least one condition must be met). +- **Fields**: Filter on standard fields (name, type, size, etc.) or custom metadata fields (using the `metadata.` prefix). +- **Comparison Operators**: + - `is`, `eq` (equals), `neq` (not equal) + - `contains`, `notContains` (substring matches) + - `gt` (greater than), `gte`, `lt`, `lte` (numeric/date ranges) + - `isEmpty`, `isNotEmpty` (checks if field contains values) + +### 3. Collection Default Sorting + +Define a custom sorting rule specific to the collection (e.g., sort by the custom field "Publication Date" ascending) to override the default project sort order. + +--- + +## Example Use Cases + +- **Review Dashboard**: A collection named "Pending Review" that displays assets where `metadata.status` equals `In Review`. +- **Daily Deliverables**: A collection filtering files uploaded in the last 24 hours with `type` equal to `file`. +- **Approved Marketing Assets**: A collection filtering assets matching `metadata.tag` contains `marketing` AND `metadata.approved` is `true`. + +![Collection Creation Placeholder](https://placehold.co/800x450/2C2E3E/D95A66?text=Create+Collection+Query+Builder) +_Placeholder: Interface modal of the Collection builder, displaying how filters are added and previewed._ diff --git a/docs/using-shumai/comments.mdx b/docs/using-shumai/comments.mdx new file mode 100644 index 00000000..fe3e8854 --- /dev/null +++ b/docs/using-shumai/comments.mdx @@ -0,0 +1,55 @@ +--- +title: Comments & Annotations +description: Collaborate on media assets using frame-level drawings and timestamped comments. +--- + +Shumai provides a feedback workflow designed for video, audio, and image review. Instead of generic text comments, you can drop timestamped feedback and sketch directly onto video frames or images. + +--- + +## Time-Based Comments + +When reviewing video or audio assets, comments can be anchored to specific moments in time: + +1. Play or scrub the video to the desired timestamp. +2. Type your feedback in the comment input box. +3. Click **Submit**. The comment is saved with the exact timestamp (`second` field in the database) and shown as a marker on the player timeline. +4. Clicking a comment card in the comments sidebar automatically jumps the media player to that exact timestamp. + +![Timestamp Comments Placeholder](https://placehold.co/800x400/2C2E3E/D95A66?text=Video+Player+with+Comment+Timeline) +_Placeholder: Screenshot of the video review interface showing comments linked to timestamp markers on the timeline._ + +--- + +## Draw Annotations (Canvas) + +To give precise visual feedback, you can draw directly onto image or video frames: + +1. Pause the video on the frame you wish to comment on. +2. Select a drawing tool (brush, rectangle, circle, arrow) from the annotation toolbar overlay. +3. Draw directly on the video player/canvas. +4. Your drawing coordinates are captured and saved as a JSON payload (`annotation` field in `AssetComment`) associated with your comment. +5. When other users click on your comment, the drawing is overlaid on the video player canvas at the corresponding frame. + +![Draw Annotations Placeholder](https://placehold.co/800x400/2C2E3E/D95A66?text=Frame-Level+Drawing+Overlay) +_Placeholder: Screenshot showing the drawing canvas overlay over a video frame with visual arrows and circles._ + +--- + +## Comment Threads (Replies) + +You can reply to any comment to create threaded discussions: + +- Click **Reply** on any comment card. +- Type your message. Replies are nested under the parent comment using the `replyToId` field. +- Threaded comments are sorted chronologically. + +--- + +## Comment Attachments + +Need to attach a reference image, PDF, or document to your feedback? + +- Click the **Paperclip** icon inside the comment input. +- Select the file to upload. +- Attachments are uploaded to the storage backend and linked to the comment via the `AssetCommentAttachment` relation. diff --git a/docs/using-shumai/metadata.mdx b/docs/using-shumai/metadata.mdx new file mode 100644 index 00000000..59a38430 --- /dev/null +++ b/docs/using-shumai/metadata.mdx @@ -0,0 +1,46 @@ +--- +title: Asset Metadata +description: Customize your assets with dynamic, team-scoped metadata fields and AI autofill features. +--- + +Standard file systems restrict you to basic properties like file size and modified dates. Shumai allows you to create a custom, structured schema of metadata fields tailored to your production pipeline. + +--- + +## Metadata Field Scopes + +Metadata fields can be scoped to different structural levels: + +- **System Scope**: Universal fields defined by system admins that appear across all teams and projects. +- **Team Scope**: Fields inherited by all projects within a specific team. Useful for maintaining company-wide tagging or department standards. +- **Project Scope**: Custom fields restricted to a single project workspace. + +--- + +## Field Types + +When creating a new metadata field, you can choose from the following data types: + +- **String**: Simple text fields, descriptions, or status labels. +- **Number**: Numeric values (e.g. frame rates, rating scores). +- **Boolean**: Simple toggles (e.g. `Approved`, `Needs Transcoding`). +- **Date**: Calendar selection (e.g. `Due Date`, `Publication Date`). +- **JSON**: Structured JSON objects for storing complex key-value configurations or custom logs. + +--- + +## Field Settings + +### Read-Only + +When enabled, standard users cannot edit the metadata value through the dashboard interface. This is ideal for system values populated by background services (like transcode resolutions or AI confidence scores). + +### AI Autofill + +If a field is flagged for **AI Autofill**, Shumai's background worker will automatically analyze the asset contents (using the team's default Gemini model) upon upload. + +- For video/images: The AI analyzes the visuals to extract descriptions, suggest tags, or classify genres. +- The metadata values are updated automatically when the asset moves to `processed` status. + +![Metadata Manager Placeholder](https://placehold.co/800x400/2C2E3E/D95A66?text=Metadata+Schema+Builder) +_Placeholder: Screenshot of the metadata builder interface, demonstrating creating a new field with the AI Autofill toggle._ diff --git a/docs/using-shumai/notifications.mdx b/docs/using-shumai/notifications.mdx new file mode 100644 index 00000000..b4293531 --- /dev/null +++ b/docs/using-shumai/notifications.mdx @@ -0,0 +1,40 @@ +--- +title: Notifications +description: Stay updated on comment activity, uploads, and project updates. +--- + +Shumai includes a built-in notification system to keep you informed of team activities, file statuses, and review comments. + +--- + +## Notification Types + +The following actions trigger system notifications: + +- **Comment Created**: Triggered when a new comment is posted on an asset you created or are watching. +- **Reply Created**: Triggered when someone replies directly to a comment thread you participated in. +- **Mentions**: Sent immediately if a collaborator tags you (using `@username`) in any comment. +- **Upload Complete**: Sent when a file you uploaded transitions from the `processing` state to `processed`. +- **Metadata Status Update**: Sent when a custom metadata field representing progress or status is modified. +- **User Joins**: Notifies owners when a new user joins the Team or Project via an invite link. + +--- + +## Project-Level Notification Toggles + +If you find yourself in a highly active project, you can toggle notifications off for that specific project: + +1. Navigate to your **Project Settings**. +2. Locate the **Enable Notifications** toggle. +3. Turn it off. You will stop receiving updates for file uploads and standard comments in this project, but direct `@mentions` will still be delivered to your inbox. + +![Notification Toggles Placeholder](https://placehold.co/800x300/2C2E3E/D95A66?text=Project+Notification+Settings) +_Placeholder: Settings view showcasing user preference toggles for email and in-app notifications._ + +--- + +## The Notification Inbox + +- The bell icon in the navigation bar displays a red badge when you have unread notifications. +- Clicking it opens your inbox list. +- Clicking a notification card (like a new comment) will mark it as read and redirect you directly to the relevant asset and comment thread. diff --git a/docs/using-shumai/semantic-search.mdx b/docs/using-shumai/semantic-search.mdx new file mode 100644 index 00000000..63061dca --- /dev/null +++ b/docs/using-shumai/semantic-search.mdx @@ -0,0 +1,39 @@ +--- +title: Semantic Search +description: Find files based on visual and textual meaning using AI vector similarity. +--- + +Traditional search relies on matching exact characters (e.g., searching "dog" will not find files named "golden_retriever.jpg"). Shumai resolves this with **Semantic Search**, which indexes the conceptual meaning of your files. + +--- + +## How Semantic Search Works + +Semantic search translates text and media into high-dimensional numerical vectors (embeddings) where similar concepts sit close to each other. + +```mermaid +graph LR + UserQuery["User Query: 'sunset at the beach'"] --> EmbedAPI[Embedding Model] + EmbedAPI --> VectorQuery[Query Vector] + VectorQuery --> SimilarityMatch[Cosine Distance Comparison] + DB[(PostgreSQL + pgvector)] --> SimilarityMatch + SimilarityMatch --> Results[Return: 'ocean_dusk.mp4'] +``` + +1. **Ingestion**: When an asset is uploaded and processed, the **Embedding Agent** converts the file's description, text, or visual tags into a 1536-dimensional vector. +2. **Storage**: These vectors are stored in the `asset_embeddings` table in PostgreSQL, utilizing the **`pgvector`** extension for indexing. +3. **Querying**: When you search with the "Semantic" toggle enabled, Shumai converts your search query into a vector and queries the database for the closest vector matches using cosine distance. + +--- + +## Setting Up Semantic Search + +To activate semantic search in your team workspace: + +1. Navigate to **Team Settings** > **Agents**. +2. Verify that you have created an **Embedding Agent** (`type` set to `embedding`) and it is toggled **Enabled**. +3. Ensure the agent is linked to a valid embedding model (e.g., `text-embedding-3-small` from OpenAI, or a supported Google Gemini embedding endpoint). +4. Once the agent is active, Shumai will automatically begin indexing new uploads, and the **Semantic Search** toggle will appear on your file search explorer. + +![Semantic Search Toggle Placeholder](https://placehold.co/800x200/2C2E3E/D95A66?text=Semantic+Search+Toggle+UI) +_Placeholder: Screenshot of the search bar, emphasizing the active "Semantic" toggle option next to the text input._ diff --git a/docs/using-shumai/share-links.mdx b/docs/using-shumai/share-links.mdx new file mode 100644 index 00000000..32b83311 --- /dev/null +++ b/docs/using-shumai/share-links.mdx @@ -0,0 +1,45 @@ +--- +title: Share Links +description: Share files and folders securely with external clients and stakeholders. +--- + +Shumai allows you to collaborate with external stakeholders who do not have accounts in your workspace. Using **Share Links**, you can grant view and comment access to specific folders or assets. + +--- + +## Creating a Share Link + +1. Hover over a file or folder and click the **Share** icon, or open the asset and click **Share** in the sidebar. +2. Click **Create New Share Link**. +3. Configure the settings described below and click **Generate**. +4. Copy the URL and send it to your client. + +![Share Link Modal Placeholder](https://placehold.co/800x400/2C2E3E/D95A66?text=Share+Link+Configuration+Modal) +_Placeholder: Share modal settings including password input, expiration calendar, and field toggles._ + +--- + +## Security and Settings + +### Expiration Date + +Set an optional date and time after which the link becomes inactive. Once the date passes, the link returns a `404 Not Found` page to anyone attempting to access it. + +### Password Protection + +Secure sensitive work by adding a password. External users visiting the link will be prompted to enter the correct password before they can view the assets. + +### Default Sort Order + +Set a default sorting rule for the shared page (e.g. sorting by name or version) to ensure the client views the files in the intended order. + +### Metadata Field Visibility + +To protect proprietary information, you can configure exactly which metadata fields are visible to external users. For example: + +- **Visible**: `Asset Name`, `Resolution`, `Download Link`. +- **Hidden**: `Internal Budget Code`, `Assignee Notes`, `Cost`. + +### Disabling a Link + +If you need to revoke access immediately, navigate to the **Share Links** tab under Project settings and toggle the **Disabled** switch. You can re-enable the link at any time. diff --git a/docs/using-shumai/sort-and-search.mdx b/docs/using-shumai/sort-and-search.mdx new file mode 100644 index 00000000..1415d70b --- /dev/null +++ b/docs/using-shumai/sort-and-search.mdx @@ -0,0 +1,34 @@ +--- +title: Sort & Search +description: Fast filtering, Ngram text searching, and ordering controls for assets. +--- + +As your projects grow, finding the right media files quickly is critical. Shumai provides Ngram-based textual search and customizable sorting parameters. + +--- + +## Searching Assets + +The main search bar at the top of the file explorer allows you to perform exact and partial keyword matches. + +![Search Bar UI Placeholder](https://placehold.co/800x250/2C2E3E/D95A66?text=File+Explorer+Search+Bar) +_Placeholder: Screenshot of the search input with toggle buttons for "Recursive Search" and "Filter by Type"._ + +### Search Mechanics + +- **Ngram Indexing**: Shumai decomposes asset names into character sequences (Ngrams) stored in the database (`nameNgram` field) and indexed using a **PostgreSQL GIN (Generalized Inverted Index)**. This allows for instant partial matches and fuzzy auto-completions as you type. +- **Recursive Search**: Toggle between searching only in the **Current Folder** or **Recursively** down the entire nested folder tree. +- **Asset Type Filtering**: Restrict your search query to return only folders or only files. +- **Symlinks Toggle**: Choose whether to display symlinked assets (virtual links to files in other directories) in your search results. + +--- + +## Sorting Assets + +You can sort lists of assets by clicking the column headers or selecting a sorting preference from the sort dropdown: + +- **Default Sort (ULID Sort)**: By default, assets are sorted by `id` descending. Because Shumai uses **ULIDs (Universally Unique Lexicographical Sortable Identifiers)** for asset IDs, sorting by ID descending automatically lists the newest uploads first without requiring an index on a `createdAt` timestamp. +- **Name**: Sort alphabetically. +- **Size**: Sort by file size in bytes. +- **Type**: Group folders together followed by files and version stacks. +- **Custom Metadata Columns**: If your project has defined custom metadata fields (such as "Due Date" or "Priority"), you can click those headers to sort the file list by these dynamic values. diff --git a/docs/using-shumai/team-project-management.mdx b/docs/using-shumai/team-project-management.mdx new file mode 100644 index 00000000..e59699a7 --- /dev/null +++ b/docs/using-shumai/team-project-management.mdx @@ -0,0 +1,46 @@ +--- +title: Team & Project Management +description: Set up workspace boundaries, define roles, and invite collaborators. +--- + +Shumai uses a two-tier organizational hierarchy—**Teams** and **Projects**—to manage file access and access permissions. + +--- + +## Teams vs. Projects + +| Level | Scope | Administration | +| :---------- | :---------------------------------------------------------------------------------------------------------------- | :------------------------- | +| **Team** | The parent organization boundary. Houses shared settings, integrations, AI providers, custom skills, and billing. | Managed by Team Owners. | +| **Project** | A specific workspace containing folders, assets, comments, and collections. | Managed by Project Owners. | + +--- + +## Member Roles + +Shumai implements role-based access control (RBAC) to restrict what actions users can perform: + +### Team Roles + +- **Owner**: Full admin control over team settings, custom skills, provider credentials, and sandbox restrictions. +- **Member**: General access to the team and its public projects. + +### Project Roles + +- **Owner**: Can configure project settings, manage invites, create collections, generate share links, and delete assets. +- **Editor**: Can upload files, delete their own assets, edit custom metadata values, and create comments or annotations. +- **Reviewer**: Read-only access to assets. Can view files, toggle versions, and leave text comments and drawings, but cannot edit metadata or delete files. + +--- + +## Inviting Members + +To add new members to a Team or Project: + +1. Navigate to the **Members** tab in your Team or Project settings. +2. Click **Create Invite Link**. +3. Select the invite role (Editor or Reviewer) and set the access duration. +4. Copy the generated invite URL. When a recipient opens the link, they will be prompted to sign up or log in, after which they will automatically join the Team or Project. + +![Invites List Placeholder](https://placehold.co/800x350/2C2E3E/D95A66?text=Invite+Link+Generator) +_Placeholder: Member management panel with active invites, active members list, and the "Generate Invite" button._ diff --git a/docs/using-shumai/transcode-settings.mdx b/docs/using-shumai/transcode-settings.mdx new file mode 100644 index 00000000..eb6cf9e8 --- /dev/null +++ b/docs/using-shumai/transcode-settings.mdx @@ -0,0 +1,39 @@ +--- +title: Media Transcoding Settings +description: Configure video transcode strategies, proxy generation, and background transcoding workers. +--- + +High-resolution camera formats and raw media files (ProRes, DNxHR, MKV, etc.) cannot be rendered natively in web browsers. Shumai transcodes these assets into web-friendly streaming formats in the background. + +--- + +## Video Transcode Strategies + +Team Owners can select how aggressive the transcoding engine should be: + +### 1. Best Match (`best_match`) + +- **Behavior**: Shumai inspects the container, codecs, and bitrate of the uploaded file. +- **Skip Transcoding**: If the file is already a web-compatible H.264/AAC MP4, WebM, or MOV that browser engines can play directly, transcoding is skipped. +- **Transcode**: If the file format is incompatible, it is transcoded. This is the recommended option as it saves processing time and storage space. + +### 2. Transcode All (`all`) + +- **Behavior**: Every single uploaded video is forced through the transcoding pipeline. +- **Output**: Converts the file into a standardized, web-optimized H.264/AAC MP4 profile. This ensures consistent streaming performance and compatibility across all client devices and browsers, regardless of the source. + +![Transcode Settings Placeholder](https://placehold.co/800x350/2C2E3E/D95A66?text=Media+Processing+Transcode+Strategy) +_Placeholder: Web UI Settings screen displaying the Media Processing tab with the strategy toggle selectors._ + +--- + +## Transcoding Architecture + +Transcoding is highly resource-intensive. Depending on your scaling needs: + +- **Local Executor**: Running in local mode, the main application container runs the transcoding task using the local CPU. This is suitable for low-volume uploads. +- **Temporal Executor**: In production, transcoding tasks are offloaded to **Temporal**. You can spin up multiple transcoding worker machines running `@shumai-one/shumai-transcode` (preferably close to your S3 storage server) to process files in parallel. + +### System Requirements + +Every machine running the transcode process (the main container in Local mode, or the transcode worker in Temporal mode) must have `ffmpeg` and `ffprobe` installed and configured on the system PATH. diff --git a/docs/using-shumai/upload.mdx b/docs/using-shumai/upload.mdx new file mode 100644 index 00000000..faa7a151 --- /dev/null +++ b/docs/using-shumai/upload.mdx @@ -0,0 +1,49 @@ +--- +title: Upload File & Folder +description: How to upload, organize, and monitor assets in Shumai. +--- + +Shumai makes it easy to bring creative media into your workspace. It supports standard file uploads, directory/folder structure preservation, and real-time upload progress indicators. + +--- + +## Uploading Assets + +You can upload files and folders in two ways: + +1. **Drag and Drop**: Drag files or entire folders directly from your system file explorer and drop them anywhere on the Shumai dashboard interface. +2. **Upload Buttons**: Click on the **Upload File** or **Upload Folder** buttons in the top-right toolbar. + +![Upload Interface Placeholder](https://placehold.co/800x400/2C2E3E/D95A66?text=Drag+and+Drop+Upload+Zone) +_Placeholder: Screenshot showing the dash upload dropzone with a progress indicator for incoming files._ + +--- + +## Folder Uploads and Hierarchy + +When you upload a folder, Shumai reads the directory structure and replicates it inside your project. + +- New folders are created in the database as `AssetType.folder` assets. +- Nested files are linked to their parent folders using the `parentId` field. +- There is no depth limit for nested subfolders. + +--- + +## Asset Status Lifecycle + +Once an upload is initiated, the asset moves through the following database statuses: + +- `uploading`: The file chunks are actively being sent to the S3-compatible or local storage backend. The UI displays a progress bar indicating percentage completion. +- `uploaded`: The storage transfer is complete. +- `processing`: Shumai has queued background tasks for the asset. This includes extracting media metadata (resolution, codec, duration) and generating proxy files (transcoding) for web playback. +- `processed`: The file metadata is fully populated, transcoding is complete, and the asset is ready for viewing, search, and collaboration. +- `trashed`: The asset has been deleted by a user but is kept in the trash bin before permanent purging. + +--- + +## Storage Backends + +Depending on your configuration: + +- **Local Storage (`STORAGE_BACKEND=local`)**: Files are uploaded and stored directly on the host machine running Shumai. +- **S3 Storage (`STORAGE_BACKEND=s3`)**: Files are uploaded directly to your S3 bucket (e.g. Cloudflare R2, MinIO, AWS S3) via presigned URLs generated by the API, minimizing load on the Hono backend server. diff --git a/docs/using-shumai/version-stack.mdx b/docs/using-shumai/version-stack.mdx new file mode 100644 index 00000000..9b3360ef --- /dev/null +++ b/docs/using-shumai/version-stack.mdx @@ -0,0 +1,42 @@ +--- +title: File Version Stack +description: Group multiple revisions of an asset under a single version-controlled stack. +--- + +When collaborating on creative assets, files naturally go through multiple iterations (e.g. `edit_v1.mp4`, `edit_v2.mp4`, `edit_final.mp4`). To prevent workspace clutter, Shumai allows you to bundle these revisions into a **Version Stack**. + +--- + +## What is a Version Stack? + +A **Version Stack** is a special asset type (`AssetType.version_stack`) that acts as a container for multiple files. Instead of showing three separate files in the directory list, Shumai collapses them into a single file entry with a version selector dropdown. + +![Version Stack Selector Placeholder](https://placehold.co/800x350/2C2E3E/D95A66?text=Version+Stack+Selector) +_Placeholder: File list view showing an asset with a version badge (e.g., "V3") and a dropdown list of older versions._ + +--- + +## Creating a Version Stack + +1. Select two or more files inside a folder using the checkboxes. +2. Click **Create Version Stack** in the bulk actions toolbar. +3. The system creates a new version stack asset. The selected files are moved inside the stack, and their parent folder's file count is updated accordingly. + +_Note: All files grouped into a version stack must reside in the same parent folder._ + +--- + +## Managing Versions + +### Active Version + +The file with the highest priority (first in the list) is the **Active Version**. This is the version displayed on the project dashboard, search results, and metadata panels. + +### Reordering and Reverting Versions + +You can promote a past version or reorder the stack structure: + +- Open the version stack details view. +- Drag and drop the versions to change their order. +- Shumai uses fractional indexing (`sortIndex` column in the database) to instantly update the list order in transactions, avoiding global re-indexing. +- To remove a file from the version stack, drag it out or select **Unstack**. This moves the file back to the parent directory as a standalone asset.