Add rasterLayers module: ephemeral buffer-backed raster layers#133
Draft
claude[bot] wants to merge 1 commit into
Draft
Add rasterLayers module: ephemeral buffer-backed raster layers#133claude[bot] wants to merge 1 commit into
claude[bot] wants to merge 1 commit into
Conversation
Adds a new `rasterLayers` controller so extensions can create client-only raster layers backed by a typed array (RGBA8) buffer and update the pixels as close to realtime as possible: - createEphemeralRasterLayer / updateEphemeralRasterLayer / setEphemeralRasterLayerCoordinates / deleteEphemeralRasterLayer - schema (zod message definitions) + controller + types, wired into the main schema/controller aggregation and the client barrel export - methodWithTransfer helper in lib/interface so the pixel ArrayBuffer is transferred (zero-copy) rather than structured-cloned Companion to felt/felt's ephemeral buffer-raster layer support. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1J3UqXizsTiiYRa2Ja4Tx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Kevin · Slack thread
Companion to felt/felt#20737. Adds a
rasterLayerscontroller so extensions can emit their own ephemeral, client-only raster layers backed by a typed array buffer and update the pixels as close to realtime as possible.Before: the SDK could only add vector (GeoJSON) ephemeral layers. There was no way to push raw pixels onto the map.
After: an extension can create a client-only raster layer from an RGBA8
ArrayBufferand repeatedly overwrite it to animate the raster in near-realtime (heatmaps, sensor fields, decoded video frames, simulation grids).How it works
src/modules/rasterLayers/(schema.ts+controller.ts+types.ts+index.ts) declaring four methods:createEphemeralRasterLayer,updateEphemeralRasterLayer,setEphemeralRasterLayerCoordinates,deleteEphemeralRasterLayer.modules/main/schema.ts(allModules+AllModules),modules/main/controller.ts(makeController+FeltController), and theclient.tsbarrel export.methodWithTransferhelper inlib/interface.ts: posts the method message with the pixelArrayBufferin thepostMessagetransfer list (zero-copy) instead of structured-cloning it. This detaches the buffer in the caller, so animation loops should allocate a fresh buffer per frame (documented on the controller).minorchangeset.Notes for the felt/felt side
The extension bridge is schema-gated by this package (
handler.ts'sAllMessagesSchemarejects unknown method types), so felt/felt cannot dispatch these methods until this change is published and its pinned@feltmaps/js-sdk-nextversion is bumped.🤖 Generated with Claude Code
https://claude.ai/code/session_01L1J3UqXizsTiiYRa2Ja4Tx
Generated by Claude Code