agent-native icon indicating copy to clipboard operation
agent-native copied to clipboard

[wip]

Open shomix opened this issue 5 months ago • 7 comments

Summary

Adds a direct-to-GCS resumable upload path for the Clips recorder, allowing the browser to PUT video chunks straight to GCS via a resumable session URI — bypassing the per-chunk app-server hop.

Problem

Previously, every video chunk recorded in the browser was routed through the app server before reaching GCS/Builder.io storage. This added unnecessary latency and load on the server for each chunk during upload.

Solution

When BUILDER_PRIVATE_KEY is configured, the server initiates a GCS resumable session and returns the session URI to the browser. The browser then PUTs chunks directly to GCS using Content-Range headers. After all chunks are uploaded, the browser calls a completion endpoint that registers the asset with Builder.io and finalizes the recording row.

Key Changes

  • packages/core/src/file-upload/builder.ts: Added requestBuilderResumableSession() to initiate a GCS resumable upload session via the Builder.io /api/v1/upload/signed-url?isResumable=true endpoint, and completeBuilderResumableUpload() to register the completed upload and retrieve the CDN URL.
  • packages/core/src/file-upload/index.ts: Exported the two new functions and the BuilderResumableSession type.
  • templates/clips/server/routes/api/uploads/[recordingId]/init-resumable.post.ts: New route (POST /api/uploads/:recordingId/init-resumable) that authenticates the user, validates the request, and returns a resumableSessionUri + assetId for the browser to use.
  • templates/clips/server/routes/api/uploads/[recordingId]/complete.post.ts: New route (POST /api/uploads/:recordingId/complete) that calls completeBuilderResumableUpload() and then invokes finalizeRecording with the resulting CDN URL, skipping chunk assembly entirely.
  • templates/clips/actions/create-recording.ts: Returns supportsResumableUpload: true when BUILDER_PRIVATE_KEY is set, signaling to the frontend that the direct upload path is available.
  • templates/clips/actions/finalize-recording.ts: Added videoUrl and videoSizeBytes input fields; when videoUrl is provided, chunk assembly and server-side upload are skipped and the recording is marked ready immediately.
  • templates/clips/app/routes/record.tsx: Passes useResumableUpload flag to the recorder engine based on the supportsResumableUpload flag returned from recording creation.

Edit in Builder  Preview


To clone this PR locally use the Github CLI with command gh pr checkout 1462

You can tag me at @builderio for anything you want me to fix or change

shomix avatar Jun 24 '26 21:06 shomix

Deploy Preview for agent-native-voice ready!

Name Link
Latest commit 1147d37ed09375e4c4c00c4ce4c489b1754d41a8
Latest deploy log https://app.netlify.com/projects/agent-native-voice/deploys/6a3c4e066ec5220008f55271
Deploy Preview https://deploy-preview-1462--agent-native-voice.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify avatar Jun 24 '26 21:06 netlify

Deploy Preview for agent-native-brain ready!

Name Link
Latest commit 1147d37ed09375e4c4c00c4ce4c489b1754d41a8
Latest deploy log https://app.netlify.com/projects/agent-native-brain/deploys/6a3c4e06ef1b670008079944
Deploy Preview https://deploy-preview-1462--agent-native-brain.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify avatar Jun 24 '26 21:06 netlify

Here's a visual recap of what changed:

Visual recap

Open the full interactive recap

github-actions[bot] avatar Jun 24 '26 21:06 github-actions[bot]

Deploy Preview for agent-native-meeting-notes ready!

Name Link
Latest commit 1147d37ed09375e4c4c00c4ce4c489b1754d41a8
Latest deploy log https://app.netlify.com/projects/agent-native-meeting-notes/deploys/6a3c4e06ccdac40008ba4e39
Deploy Preview https://deploy-preview-1462--agent-native-meeting-notes.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify avatar Jun 24 '26 21:06 netlify

Deploy Preview for agent-native-scheduling ready!

Name Link
Latest commit 1147d37ed09375e4c4c00c4ce4c489b1754d41a8
Latest deploy log https://app.netlify.com/projects/agent-native-scheduling/deploys/6a3c4e06bead230008bb686a
Deploy Preview https://deploy-preview-1462--agent-native-scheduling.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify avatar Jun 24 '26 21:06 netlify

Deploy Preview for agent-native-images ready!

Name Link
Latest commit 1147d37ed09375e4c4c00c4ce4c489b1754d41a8
Latest deploy log https://app.netlify.com/projects/agent-native-images/deploys/6a3c4e0633f0f3000879dd32
Deploy Preview https://deploy-preview-1462--agent-native-images.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify avatar Jun 24 '26 21:06 netlify

Deploy Preview for agent-native-design ready!

Name Link
Latest commit 1147d37ed09375e4c4c00c4ce4c489b1754d41a8
Latest deploy log https://app.netlify.com/projects/agent-native-design/deploys/6a3c4e0633f0f3000879dd30
Deploy Preview https://deploy-preview-1462--agent-native-design.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify avatar Jun 24 '26 21:06 netlify