Skip to content

feat(web): clip ingestion endpoint for OpenClaw worker#1

Open
NewCoder3294 wants to merge 1 commit into
mainfrom
feat/p3-clip-ingestion
Open

feat(web): clip ingestion endpoint for OpenClaw worker#1
NewCoder3294 wants to merge 1 commit into
mainfrom
feat/p3-clip-ingestion

Conversation

@NewCoder3294
Copy link
Copy Markdown
Owner

Summary

  • Adds POST /api/clips/ingest accepting multipart payloads (video + thumbnail + metadata) from the OpenClaw camera detector
  • Validates with zod, uploads to clips (private) and thumbnails (public) Supabase Storage buckets, inserts a clips row, attaches optional tags
  • Bearer auth via new INGEST_SECRET env var (set in Vercel: Production / Preview / Development)
  • Introduces vitest to apps/web for the first time; 18 unit tests cover the pure parsing + path-building helpers

Wire contract (for the OpenClaw worker)

POST /api/clips/ingest
Authorization: Bearer $INGEST_SECRET
multipart/form-data:
  caltrans_id   (string, e.g. "TVD04--001")
  started_at    (ISO 8601 with offset)
  duration_s    (positive int, <= 3600)
  tags          (optional, comma-separated)
  incident_id   (optional UUID — attaches clip to existing incident)
  video         (Blob)
  thumbnail     (Blob)
→ 201 { clipId, storagePath, thumbnailPath }

Test plan

  • pnpm typecheck — clean across all 3 packages
  • pnpm test (apps/web) — 18/18 passing
  • Manual: hit the endpoint with curl + a real caltrans_id once OpenClaw is wired
  • Manual: confirm incident page (incidents agent's work) shows the ingested clip thumbnail

Adds POST /api/clips/ingest accepting multipart payloads from the camera
detector (video + thumbnail + metadata), validating with zod, uploading
to the clips and thumbnails Supabase Storage buckets, and inserting a
row into the clips table. Bearer-auth gated by INGEST_SECRET.

Pure parsing logic (extFromMime, buildStoragePaths, ingest schema) is
factored into lib/ingest/parse.ts and unit-tested under vitest, which is
introduced to apps/web for the first time.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
caltrans-cctv Error Error May 16, 2026 8:07pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant