agentleFS
AWSKnown publisherawslabs/visual-asset-management-system/web/src/visualizerPlugin/CLAUDE.md

visual-asset-management-system / visualizerPlugin

CLAUDE.md144 starsChanged 2 months agoApache-2.0View on GitHub

Auto-loaded when working within web/src/visualizerPlugin/. See web/CLAUDE.md for the frontend-wide steering. The 3D/media viewer system uses a plugin-based architecture: Viewer plugins live under viewers/{Name}ViewerPlugin/ — each plugin ID below maps to a directory of that form (e.g. potree-viewer → viewers/PotreeViewerPlugin/). Per-viewer custom-install scripts live in web/customInstalls/ (one dir per viewer, plus a shared utility/ helper dir) and are executed by the postinstall chain in web/package.json.

The file

We split this CLAUDE.md into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Step 1: Create the viewer directory:

    line 52
  2. Very specific:

    Step 2: Create the component implementing ViewerPluginProps:

    line 61
  3. Very specific:

    Step 3: Add to viewers/manifest.ts:

    line 94
  4. Very specific:

    Step 5: If the viewer has external dependencies, create a custom install script in web/customInstalls/myviewer/ and add it to the …

    line 122
  5. Very specific:

    When adding a viewer that needs eval, add the feature-flag gate and update the deployment configuration reference in …

    line 161

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md - VAMS Viewer Plugin System

Auto-loaded when working within web/src/visualizerPlugin/. See web/CLAUDE.md for the frontend-wide steering.


Architecture

The 3D/media viewer system uses a plugin-based architecture:

  • PluginRegistry (core/PluginRegistry.ts) — Singleton that manages all viewer plugins
  • viewerConfig.json (config/viewerConfig.json) — JSON configuration for all plugins
  • manifest.ts (viewers/manifest.ts) — Vite static-analysis paths for dynamic imports
  • StylesheetManager (core/StylesheetManager.ts) — Per-plugin CSS lifecycle management
  • types.ts (core/types.ts) — Shared ViewerPluginProps and config interfaces

Viewer plugins live under viewers/{Name}ViewerPlugin/ — each plugin ID below maps to a directory of that form (e.g. potree-viewer → viewers/PotreeViewerPlugin/). Per-viewer custom-install scripts live in web/customInstalls/ (one dir per viewer, plus a shared utility/ helper dir) and are executed by the postinstall chain in web/package.json.


Current Viewers

IDNameCategoryExtensionsStatus
online3d-viewerOnline 3D Viewer3d.3dm, .amf, .bim, .off, .wrlenabled
potree-viewerPotree Viewer3d.e57, .las, .laz, .plyenabled
image-viewerImage Viewermedia.png, .jpg, .jpeg, .svg, .gifenabled
html-viewerHTML Viewerdocument.htmlenabled
video-viewerVideo Playermedia.mp4, .webm, .mov, .avi, .mkv, .flv, .wmv, .m4venabled
audio-viewerAudio Playermedia.mp3, .wav, .ogg, .aac, .flac, .m4aenabled
columnar-viewerColumnar Data Viewerdata.fcs, .csvenabled
pdf-viewerPDF Viewerdocument.pdfenabled
cesium-viewerCesium 3D Tileset3d.jsonenabled
text-viewerText Viewerdocument.txt, .json, .xml, .html, .yaml, .md, .py, .js, .ts, .sql, etc.enabled
gaussian-splat-viewer-babylonjsBabylonJS Gaussian Splat3d.ply, .spzenabled
supersplat-viewerSuperSplat Editor (PlayCanvas)3d.lcc, .ply, .sog, .splatenabled (requires ALLOWUNSAFEEVAL, iframe-embedded)
gaussian-splat-viewer-playcanvasPlayCanvas Gaussian Splat3d.ply, .sogenabled
vntana-viewerVNTANA 3D Viewer3d.glbdisabled (licensed)
veerum-viewerVEERUM 3D Viewer3d.e57, .las, .laz, .ply, .jsondisabled (licensed)
needletools-usd-viewerNeedle USD Viewer3d.usd, .usda, .usdc, .usdzenabled (requires ALLOWUNSAFEEVAL)
threejs-viewerThree.js Viewer3d.gltf, .glb, .obj, .fbx, .stl, .ply, .dae, .3ds, .3mf, .stp, .step, .iges, .igs, .brepenabled
physna-viewerPhysna Viewer3d.3ds, .asm, .catpart, .catproduct, .glb, .iam, .iges, .igs, .ipt, .jt, .obj, .par, .prt, .sldasm, .sldprt, .stl, .step, .stp, .x_b, .x_tenabled (requires PHYSNA_ADDON)
thatopenwebifc-viewerThatOpen IFC BIM Viewer3d.ifc, .ifczipenabled (requires ALLOWUNSAFEEVAL)
preview-viewerPreview Viewerpreview* (wildcard)enabled

supersplat-viewer is an iframe-embedded viewer — it self-hosts a from-source SuperSplat build under public/viewers/supersplat/ and loads files via a presigned URL ?load= parameter. The build is WebGPU-only (no WebGL2 fallback). Under the production CSP its <base> element, inline script, and embedded pc-icon data-URI font are blocked without breaking the editor.


Adding a New Viewer Plugin

Step 1: Create the viewer directory:

viewers/MyViewerPlugin/
  MyViewerComponent.tsx     # The React component
  dependencies.ts           # Optional: dependency loader
  MyViewer.module.css       # Optional: scoped styles

Step 2: Create the component implementing ViewerPluginProps:

/*
 * Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0
 */

import React, { useEffect, useRef } from "react";
import { ViewerPluginProps } from "../../core/types";

const MyViewerComponent: React.FC<ViewerPluginProps> = ({
    asset,
    files,
    databaseId,
    onFullscreen,
    viewerConfig,
}) => {
    const containerRef = useRef<HTMLDivElement>(null);

    useEffect(() => {
        // Initialize viewer
        return () => {
            // Cleanup on unmount
        };
    }, []);

    return <div ref={containerRef} style={{ width: "100%", height: "100%" }} />;
};

export default MyViewerComponent;

Step 3: Add to viewers/manifest.ts:

export const VIEWER_COMPONENTS = {
    // ... existing entries
    "./viewers/MyViewerPlugin/MyViewerComponent": "./MyViewerPlugin/MyViewerComponent",
};

Step 4: Add to config/viewerConfig.json:

{
    "id": "my-viewer",
    "name": "My Viewer",
    "description": "Description of the viewer",
    "componentPath": "./viewers/MyViewerPlugin/MyViewerComponent",
    "supportedExtensions": [".xyz"],
    "supportsMultiFile": false,
    "canFullscreen": true,
    "priority": 1,
    "dependencies": [],
    "loadStrategy": "lazy",
    "category": "3d",
    "enabled": true
}

Step 5: If the viewer has external dependencies, create a custom install script in web/customInstalls/myviewer/ and add it to the postinstall chain in web/package.json.


Plugin Config Fields

FieldTypeDescription
idstringUnique plugin identifier
componentPathstringPath for manifest lookup
dependencyManagerstring?Path to dependency loader module
dependencyManagerClassstring?Class name in dependency module
dependencyManagerMethodstring?Load method name
dependencyCleanupMethodstring?Cleanup method name
supportedExtensionsstring[]File extensions this viewer handles
supportsMultiFilebooleanCan handle multiple files at once
canFullscreenbooleanSupports fullscreen mode
prioritynumberLower = preferred when multiple viewers match
loadStrategy"lazy" | "eager"When to load the component
categorystringViewer category (3d, media, document, data, preview)
featuresEnabledRestrictionstring[]?Required feature flags
isPreviewViewerboolean?True for the preview-only viewer
enabledbooleanWhether the plugin is active
customParametersobject?Viewer-specific configuration

CSP / unsafe-eval

Some viewers require the ALLOWUNSAFEEVAL feature flag because their loaders (WASM or JIT) use eval. Three carry the gate in viewerConfig.json (featuresEnabledRestriction: ["ALLOWUNSAFEEVAL"]), so the registry does not offer them at all when the deployment has not enabled allowUnsafeEvalFeatures:

  • Needle USD Viewer
  • SuperSplat Editor (also iframe-embedded)
  • ThatOpen IFC BIM Viewer (web-ifc)

The Three.js viewer is deliberately not gated: its mesh formats (.glb, .obj, .stl, …) need no eval, and gating the whole plugin would remove them too. Only its OCCT CAD path (.stp/.step/.iges/.igs/.brep) has the heavier requirements, and loadFile() in ThreeJSViewerPlugin/utils/fileLoaders.ts reports them as a message on the file rather than hiding the viewer — it checks for SharedArrayBuffer (the COI headers) and for the OCCT bundle before loading.

cesium-viewer carried the gate until this release. The viewer now builds a CesiumWidget from the widget-less @cesium/engine (CesiumViewerComponent.tsx), which drops the @cesium/widgets Knockout layer whose new Function binding compiler was what required unsafe-eval; 'wasm-unsafe-eval' in the base CSP covers what remains. See web/customInstalls/cesium/README.md for the build. KTX2/Basis textures and .spz splats are the known content types that still need the broader directive.

When adding a viewer that needs eval, add the feature-flag gate and update the deployment configuration reference in documentation/docusaurus-site/docs/deployment/configuration-reference.md.


A Framed Viewer Must Not Receive a Signed URL in the Query String

A presigned Amazon S3 URL is a bearer credential: anyone holding it can read the object until it expires. Putting one in an iframe's query string writes it into CloudFront or ALB access logs, which are not treated as containing credentials and are retained for the log group's retention period.

supersplat-viewer currently does this (SuperSplatViewerComponent.tsx builds ?load=<presigned>&filename=…) and ships as a documented known issue for 2.6.0 — one object, expiring, but logged. Do not copy the pattern into a new viewer. Use the URL fragment instead: browsers do not transmit a fragment, so nothing reaches the server or its logs.

For a vendored build that reads location.search and cannot be changed at the call site, inject a shim into its index.html from that viewer's customInstalls/ script which moves the fragment into the query string with history.replaceState before the bundle runs — replaceState issues no request, so the value stays client-side. Patch the HTML entry rather than the minified bundle: the bundle is regenerated from a pinned upstream tag on every npm install, so a regex against its internals breaks on the next version bump while an injected <script> does not.

Note the encoding interaction if you move an existing viewer: SuperSplat decodes load twice, so its value is deliberately double-encoded (see the comment in SuperSplatViewerComponent.tsx). Moving the same string to a fragment must preserve that double encoding byte-for-byte, or the presigned signature breaks and S3 returns 400.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.