45 Commits
Author SHA1 Message Date
Yiling-J c55804a548 feat(operations): add create_project operation across agent, mcp, and cli (#529)
* feat(operations): add create_project operation across agent, mcp, and cli

* fix(api): remove legacy team creation endpoint

* fix(api): preserve ProjectInfo response on POST /teams/:teamId/projects
2026-11-13 11:43:08 +08:00
Yiling-J 4e3e17a547 docs: simplify AGENTS.md developer guide (#501) 2026-10-27 15:26:42 +08:00
Yiling-J b3cae4f2b0 feat: move MCP to /mcp and add teammate operations (#500)
* feat(operations): move MCP to /mcp and add search, comment, metadata, version, and upload operations

- Serve the MCP server at /mcp instead of /api/mcp
- Add search_assets, copy_assets, get_folder_instructions, list_comments,
  create_comment, resolve_comment, list_metadata_fields,
  update_asset_metadata, create_version_stack, list_versions, and
  remove_version on the agent, MCP, and CLI
- Add create_file and create_version (agent, MCP) with Creation Context
  metadata, and complete_upload (MCP) for presigned two-step uploads
- Replace the native agent create_file/create_version tools with
  Operation-backed ones
- Route the comment-complete, metadata, copy, version stack, and
  AGENTS.md read REST endpoints through their Operations

* docs(readme): add built-in MCP server and CLI to features list
2026-10-27 14:37:26 +08:00
Yiling-J 50fbd97953 feat: expose read_asset and download_asset on MCP and the CLI (#499)
* feat(asset-read): expose read_asset on MCP and the CLI

Enable the mcp and cli surfaces for read_asset and get_asset_render.

- MCP: add per-Operation tool extensions. The read presenter attaches up
  to 8 images (2 MB each) inline, lists image links, supports
  inlineImages: false, and tells the model to call get_asset_render when
  a render is pending. Storage keys are stripped from the result.
- CLI: generated commands can flatten object inputs into prefixed flags
  (cli.flatten) and omit fields (cli.omit); add per-command extensions.
  New `read` and `render` commands print image links, download them with
  --out, and support --no-wait with a printed `render <taskId>` hint.
- Round frame timestamps in labels to 3 decimals.

* fix(mcp): make tool input schemas portable to single-type dialects

Nullable inputs were emitted as `type: ["number", "null"]` (or a `null`
anyOf branch), which clients that map tool schemas onto an OpenAPI-style
subset (e.g. Gemini function declarations) may reject.

- Make read_asset's startPage, endPage, and degree optional instead of
  nullable.
- Move null handling into a shared dropNullOptionals helper in
  @shumai/operations that also strips nulls inside nested config
  objects. The agent uses it, and the MCP server applies it before the
  SDK validates arguments, so models that send null keep working.
- Test that no Operation input schema (and no listed MCP tool) uses a
  nullable type.

* feat(asset-download): share download_asset across agent, MCP and CLI

Turn the agent-only download_asset tool into an Operation on all three
surfaces.

- download_asset takes up to 50 file or version stack IDs and returns
  presigned links. proxy (default true) picks the web preview when there
  is one, as the agent always did; proxy: false returns the original.
  Folders are rejected. Read is checked on every ID before anything runs.
- Agent: an extension saves the files into the .pi sandbox and keeps the
  agent-only storage key mode (e.g. frames from read_asset). Agent tool
  extensions gain description, parameterOverrides and intercept.
- CLI: `shumai-cli download <assetId...> [--out <dir>] [--original]`
  streams files to disk without overwriting existing names.
- read_asset's unsupported-type error now names the right way to
  download on each surface (download_asset, or `shumai-cli download`).
- Add the Download Asset toggle to agent settings.
2026-10-27 08:09:11 +08:00
Yiling-J 155fb95a0e feat(asset-read): rewrite read_asset as a reader registry and Operations (#498)
Replace the monolithic agent read_asset tool with a reader registry in
@shumai/core/src/asset-read (model3d, image, video, document) behind a
shared pipeline that handles access checks, version stacks, annotations,
render tasks, and waiting.

- Add read_asset and get_asset_render Operations (agent surface only).
  Renders that outlast the caller's wait budget return "pending" with the
  workflow task ID; the read request is stored on the task payload so
  get_asset_render works across restarts and instances (requester only).
- Add workflowService.waitFor and presign expiry support.
- Keep agent output compatible via an agent tool extension (s3KeyOnly,
  image blocks, session image details); autofill keeps its team-scoped tool.
- Cap video frames at 20 per call; add the get_asset_render agent toggle.
2026-10-27 08:09:10 +08:00
Yiling-J 76057ccd21 feat(operations): add shared Operation layer for agent capabilities (#494)
Introduce @shumai/operations (pure definitions: Zod schemas, metadata,
CLI hints) and @shumai/core/src/operations (implementOperation and the
runOperation pipeline: validate, authorize, prepare, execute, validate
output, audit).

Migrate list_assets, create_folder, rename_asset, move_assets and
delete_asset to Operations, and add list_projects. The agent now builds
these tools from the registry, and the folder create/rename, file
rename and reparent routes call the same Operations.

Audit logs gain a nullable via column recording the surface. A lint
rule keeps the Prisma client out of Operation implementations.
2026-10-27 08:09:09 +08:00
Yiling-J 5cf6d31794 chore(deps): upgrade bun to 1.4.4 and migrate to bun fmt (#488)
- Upgrade Bun to 1.4.4 across Dockerfiles, CI workflows, and release configurations.
- Update @types/bun and bun-types.
- Remove eslint-plugin-prettier and update format script to use native bun fmt.
- Configure .prettierignore to exclude packages/webui/public and minified files.
2026-10-22 20:25:54 +08:00
Yiling-J 1fcd7245ea fix(transcode): ensure durable file exchange and crash recovery across workflow steps (#484)
* fix(transcode): ensure durable file exchange and crash recovery across workflow steps

* fix(transcode): recognize AWS SDK NoSuchKey by name and add workflow E2E recovery test
2026-10-20 11:29:22 +08:00
Yiling-J 176b7f0eab feat(workflow): migrate workflow engine from temporal to dbos (#481)
* feat(workflow): migrate workflow engine from temporal to dbos

Replace Temporal and LocalExecutor with DBOS Transact (@dbos-inc/dbos-sdk) as the unified workflow engine. Background tasks, media transcoding, and AI agent workflows now execute with durable steps and task queues directly against PostgreSQL, eliminating the need for an external Temporal cluster and separate polling executors.

* fix(workflow): submit tasks via DBOSClient to allow enqueueing from steps

Enqueuing workflows using DBOS.enqueueWorkflowWithOptions threw a
DBOSInvalidWorkflowTransitionError when triggered from within a running
step or activity (e.g. creating embedding or autofill tasks during
video transcoding).

Use DBOSClient to submit and cancel workflow tasks directly against the
system database, detaching execution from the ambient workflow/step
context.

* feat(web): support SHUMAI_WORKERS environment variable

* fix(workflow): ensure CLI tasks are enqueued to DBOS and run DBOS migrations in global setup

- Initialize workflows and wait for pending DBOS submissions in shumai regenerate-embeddings CLI
- Remove no-op submit bypass and enqueue tasks via DBOSClient in producer and CLI contexts
- Add DBOS migration runner in test global setup to avoid concurrent migration deadlocks across test forks
- Update changelog and add regression tests

* fix(workflow): ensure unique per-instance executor identity for worker replicas

- Derive unique per-instance DBOS executor IDs across worker replicas

- Support SHUMAI_WORKER_ID, DBOS__VMID, and POD_NAME (Kubernetes Downward API)

- Disambiguate multi-replica bare metal/container deployments with host, PID, and instance suffix

- Prevent startup recovery from re-enqueueing workflows actively executed by other live workers

- Add multi-instance startup recovery tests and update deployment documentation

* fix(workflow): only register listened queues and update concurrency on change

- Only register queues that the executor instance actively listens to

- Use always_update conflict resolution so environment variable changes take effect on restart

- Prevent dedicated workers from overwriting unmanaged queue concurrency configurations

- Add tests verifying concurrency updates and queue isolation across worker roles

* refactor(workflow): simplify activities to use defineStep and direct calls (#482)

* refactor(workflow): simplify activities to use defineStep and direct calls

- Wrap activities using defineStep from @shumai/workflow-core
- Remove obsolete getActivities, registerActivities, dynamic activity proxies, and workerQueue arguments
- Remove executor.ts and registry.ts, consolidating workflow registration into workflow.ts
- Call activities directly across transcode and agent workflows
- Update all corresponding workflow tests and developer guide documentation

* fix(workflow): properly detect DBOSWorkflowCancelledError in runOnCancel fallback

- DBOSWorkflowCancelledError in DBOS SDK does not set name, inheriting 'Error'
- Implement isDbosWorkflowCancelledError checking instanceof, constructor.name, and dbosErrorCode
- Update unit tests to verify real DBOS SDK cancellation error instances

* docs(workflow): update documentation and readme for dbos migration

- Rename docs/configuration/temporal.mdx to docs/configuration/distributed.mdx
- Document DBOS-based distributed worker architecture and task queues
- Remove obsolete docker-compose/temporal/
- Update environment variables documentation in docs/configuration/env-variables.mdx
- Update references in README.md, README_CN.md, docs/docs.json, and related guides

* feat(deploy): implement KEDA ScaledJob and scale-to-zero On-Demand transcoding (#483)

* feat(deploy): add shumai-transcode docker image and k8s autoscaling example with garage s3

* docs(k8s): document port-forwarding and in-cluster s3 domain mapping

* feat(storage): support public s3 endpoint for browser uploads and update k8s example

* fix(k8s): configure s3 bucket cors rules in garage initialization

* fix(k8s): increase transcode worker memory limit to 4Gi for 4K video encoding

* feat(deploy): add AWS EKS deployment with Graviton3 Spot nodegroups and autoscaling

* docs(deploy): redesign EKS documentation, rename k8s to eks, and add scalable deployment feature

* docs: rephrase DBOS feature bullet to Durable Workflows via DBOS

* docs(eks): upgrade default instances to Graviton5 c9g.large and c9g.xlarge

* feat(eks): use On-Demand for general nodegroup and add spot capacity diversification

* docs(eks): fix Architecture diagram to locate all transcode worker pods in Transcode Compute Pool

* feat(deploy): implement KEDA ScaledJob and scale-to-zero On-Demand transcoding

* feat(transcode): support idle-timeout auto-drain for KEDA scaled jobs

* fix(deploy): fix EKS deployment manifests and documentation based on cluster verification
2026-10-19 15:35:08 +08:00
Yiling-J e007054f47 feat(transcode): add multi-resolution strategy with configurable ladders and fallback (#438)
* feat(transcode): add multi-resolution strategy with configurable ladders and fallback

* feat(settings): show toast on settings update and add manual verification plan to PR template

* fix(webui): preserve video resolution and fix 480p label in download dropdowns

* fix(webui): display standard short-side resolution for vertical videos in seekbar

* fix(webui): fix portrait transcode resolution labeling and serialize settings toggles
2026-10-01 13:27:50 +08:00
Yiling-J b52b2ce7d8 fix(transcode): preserve trashed status during background jobs and handle permanent purge (#416)
* fix(transcode): preserve trashed status during background jobs and handle permanent purge

* fix(workflow): clear heartbeat and add info logs on task cancellation

* fix(transcode): terminate media processes and guard task activities on cancellation

- Pass AbortSignal to ffmpeg and pdftoppm child processes in transcodeService to terminate processes on task cancellation
- Add local task AbortController context and cancellation guards in executeActivity to prevent subsequent workflow activities
- Forward taskId and cancellation signals in transcode, screenshot, and PDF activities
- Use updateMany instead of update in task activities to eliminate Prisma P2025 errors on purged task records

* fix(workflow): allow cleanup activities in finally blocks during task cancellation

Remove blanket cancellation check in executeActivity so that workflows can execute cleanup and failure handling activities in catch and finally blocks upon cancellation, while relying on AbortSignal in active activities to abort execution.

* docs(changelog): improve user friendliness of changelog entries and formatting example

* docs(agents): update changelog guidelines to emphasize end-user friendly descriptions

* fix(transcode): handle queued cancellation and delete races in media workflow
2026-09-19 10:40:49 +08:00
Yiling-J 3a509537fd feat(changelog): add CHANGELOG.md, release extraction script, and developer guidelines (#414)
* feat(changelog): add CHANGELOG.md, release extraction script, and developer guidelines

* docs(agents): simplify changelog guidelines for brevity
2026-09-18 11:57:25 +08:00
Yiling-J c91867b8eb chore: split e2e scripts into app and webui targets (#280)
Split the monolithic test:e2e script into:

- test:e2e:app: fullstack web app e2e (playwright --project=app-chromium)
- test:e2e:webui: harness UI integration tests
  (E2E_SKIP_APP_SERVER=true --project=harness-chromium)

Remove the now-unused test:e2e:ui and test:e2e:report scripts, and update
the AGENTS.md submission rules and e2e README to reference the new
commands.
2026-08-08 13:20:52 +08:00
Yiling-J 624a3a6a54 feat(webui): remove original-file display fallbacks, use proxies only (#273)
* feat(webui): remove original-file display fallbacks, use proxies only

WebUI now never uses the raw original file for display. All viewers
(image, video, compare, pdf) render exclusively from transcoded proxies;
when no proxy exists the viewer shows an unavailable placeholder instead
of falling back to media.original.

- getBestTranscode: drop the isRaw fallback candidates
- video-viewer / compare-video-pane: remove the synthetic 'Original'
  resolution entry and the original.downloadUrl hasMedia gate
- image-viewer / compare-image-pane: remove original.downloadUrl default
- pdf-viewer: require pdfTranscode.url (no original fallback)
- download menus (video-control-bar, breadcrumb-nav): use
  media.original.key for the 'Original' download option instead of the
  isRaw transcode marker entry

Backend:
- transcode-video workflow no longer pushes the isRaw:true marker entry
  into videoTranscodes (it pointed at the original file key)
- remove media.original.downloadUrl from the DTO, asset service mapping,
  MediaInfo DB type, and transcode workflows/activities (it was only
  consumed by the removed display fallbacks; downloads already use key
  via the download-url endpoints)

Tests/fixtures updated; docs updated to state the proxy-only display
policy.

* refactor: remove isRaw field via data migration, clean legacy media JSON

Add a Prisma data migration that cleans legacy media JSONB on both
assets and watermark_files:
- drop the raw-original marker entries (isRaw: true) from
  videoTranscodes / imageTranscodes — they pointed at the original file
  key and were only used by the removed display fallbacks / download
  menus, which now use media.original.key directly
- strip the isRaw field from remaining transcode entries
- drop original.downloadUrl (removed from the AssetInfo DTO)

The migration is generated via prisma migrate dev --create-only and
applied automatically by migrate deploy in production. It is guarded by
a test (packages/db/src/clean-media-migration.test.ts) that seeds legacy
media JSON, runs the migration SQL, and asserts the transform on both
tables.

With the data cleaned, remove the isRaw field entirely from the codebase:
- DTO schemas + ImageTranscode/VideoTranscode interfaces
- PrismaJson MediaInfo transcode types
- watermark activity isRaw skip (and its test), watermark proxy mapping,
  agent-embedding transcode selection, webui transcode filters, and all
  test fixtures

AGENTS.md: clarify that the no-manual-migration rule applies to DDL;
data migrations (pure SQL transforms, no schema change) are allowed
inside a --create-only generated migration and must be tested.
2026-08-07 22:40:06 +08:00
yiling 043cde9fcc update agentsmd 2026-08-03 17:09:46 +08:00
yiling 3789366d35 test(e2e): add file, share, and collection web app e2e tests
Add six domain-level web app e2e tests covering team member removal,
file upload/delete/restore, share link creation and password protection,
and collection creation. Introduce a parametrized 'file' fixture with
configurable media types (text/binary/image/video/pdf) for future
type-scoped tests, plus helpers for share APIs and team member seeding.

Also document all web app e2e test cases in apps/web/e2e/README.md and
require this documentation in AGENTS.md.
2026-08-03 16:34:37 +08:00
yiling b2a11c5ce9 docs: add Web App E2E Tests section to developer guide 2026-08-03 15:32:38 +08:00
yiling 29995a64fd fix(transcode): add fontName to Linux TTC fonts, Windows CJK paths, and Droid fallback 2026-07-20 09:35:49 +08:00
yiling 1970535aa6 fix(transcode): use csv-parse for CSV parsing and pin pdfkit exact version 2026-07-19 22:46:13 +08:00
yiling 081dbf6d39 feat(transcode): add PDF proxy support for TXT and CSV files 2026-07-19 21:19:43 +08:00
yiling 6f369625d8 docs(agents): update AGENTS.md with E2E workflow testing requirements 2026-07-15 12:04:45 +08:00
yiling a7dc7bbff2 perf(agent): optimize active task lookup using indexed sessionId column 2026-07-14 15:44:10 +08:00
yiling c3d88bb972 docs: add concise route code-splitting guideline to AGENTS.md 2026-07-09 15:32:15 +08:00
yiling 6c3d3ea2b3 feat(webui): add compare versions view for version stacks
Add a Compare Versions mode to the file detail page (authenticated and
public share) that splits the viewer into two 50/50 panes showing two
versions side by side.

- Breadcrumb file menu gains a Compare Versions entry (version stacks
  with >=2 versions); the file segment is hidden in compare mode.
- URL-driven state (compare/cmpLeft/cmpRight/cmpActive) on both file
  routes so the view is refresh/share-safe.
- Per-side topbar with filename, version, version-switch dropdown, an
  active-side highlight, and an X exit button.
- Shared control bar reflects the active pane; for same-type media it
  coordinates both panes (play/pause, seek, frame-step, zoom, pan sync),
  seekbar length matches the active side while the shorter side holds its
  last frame; only the active side plays audio; resolution/download apply
  to the active side; fullscreen covers the whole compare view.
- Right sidebar (comments/fields) binds to the active side; comment
  selection seeks the active pane and annotations/comments can be created.
- Reuses useFramePlayer + DrawingCanvas without modifying the existing
  single-file video player.
- Unit tests for compare selection/clamp logic.
2026-07-04 10:20:16 +08:00
yiling 914855a25c chore(webui): move paraglide directory to packages/webui root and update imports 2026-06-26 13:35:27 +08:00
Yiling-Jandgemini-code-assist[bot] c7b0346782 Apply suggestions from code review
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-06-26 13:28:53 +08:00
yiling b6ff60f8b8 docs: add paraglide-js i18n rules and usage guide to AGENTS.md 2026-06-26 10:44:49 +08:00
yiling 50777d332b style(webui): fix search dialog layout height, scroll areas, and restrict filter toggle click 2026-06-19 12:11:19 +08:00
yiling f16a8a7069 refactor(transcode): relocate TranscodeService to core and flatten API package 2026-06-16 09:47:27 +08:00
yiling 688e1a4ede feat(api,webui): implement image compression, auto-refresh for uploads, and infinite pagination for collections/shares 2026-06-08 12:14:14 +08:00
yiling 4264849f36 feat(workflow): strictly enforce queue redirection and activity registration rules 2026-06-03 09:21:51 +08:00
yiling 35cfe68280 feat(workflow): integrate temporal workflow bundles and support dev/prod mode 2026-06-03 09:10:31 +08:00
yiling 5947c3c9a7 refactor(workflow): eliminate worker-db package and simplify workflows 2026-06-02 16:06:24 +08:00
yiling 57f645c97a docs: add TypeScript path mapping rules to AGENTS.md 2026-06-02 10:28:26 +08:00
yiling 998f88c6d3 docs: update monorepo architecture and dependency management rules in AGENTS.md 2026-06-02 10:27:32 +08:00
yiling 3505b5b2ef docs: update AGENTS.md for workspace monorepo and direct database access rules 2026-06-02 09:17:31 +08:00
yiling 69d1e7c5d0 style(upload): adapt card design to use system color variables & document ui rules in AGENTS.md 2026-06-01 11:08:00 +08:00
yiling 023f256e00 refactor(error): refactor standard throws to non-retryable ApplicationFailure in workflows and activities 2026-05-28 10:43:54 +08:00
yiling 3b08ade55d refactor(workflow): throw non-retryable ApplicationFailure for validation errors 2026-05-28 09:57:30 +08:00
yiling 11d2e89a48 refactor(workflow): enforce strict nested type safety for WorkflowTaskPayload 2026-05-28 09:48:05 +08:00
yiling a0379964f9 fix(asset): prevent infinite recursion in copy and fix cross-project attachment scoping 2026-05-25 10:45:10 +08:00
yiling 6655cdb767 feat(asset): convert purge log to structured format and add logging guide to AGENTS.md 2026-05-24 09:40:53 +08:00
yiling c990e77478 fix(ui): prevent UI freeze when deleting project and update AGENTS.md 2026-05-24 09:36:23 +08:00
yiling 13af691aa5 refactor(workflow): separate database and agent activities 2026-05-22 09:49:22 +08:00
yiling 9cad96210c initial commit 2026-05-19 16:05:09 +08:00