← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / frontend / src / features / artifacts / README.md

frontend/src/features/artifacts

中文说明

F-17 artifacts + Files (M-03). Version cache, Files search/filter/pagination/deep link, renderer catalog onto window.OpenAI4SScientificRenderers (null defense kept), and the ten scientific renderer glues. Does not edit stores/ or compat/window-exports.ts above the lane-additions marker.

Files

File Responsibility
api.ts Same-origin api(), ApiError, bytes, looksBinary, el/icon, isReady window calls.
artifacts.css Files toolbar / filter / Load more / stale-version banner.
boot.test.ts DOM mount ordering and initial-route-before-deep-link regression coverage.
boot.ts bootArtifacts / installArtifacts. Assigns parseTable + renderSheet.
cache.test.ts Version cache, in-place dock mutate, stale loadArtifacts.
cache.ts artifactCacheKey / syncArtifactVersion / artUrl (exact version never uses latest).
catalog.test.ts UMD null defense, compatibility renderer ids, PDB CA points.
catalog.ts scientificRenderers() empty-value defense, catalog + descriptor fetch.
copy.ts M-03 search/filter/deep-link copy, plus the provenance Environment panel's no-snapshot and unknown/not-applicable package-count strings (does not rewrite generated i18n).
deeplink.test.ts Query parse; exact version; no silent latest fallback.
deeplink.ts ?artifact=&version_id= parse/serialize/resolve. Empty versions → not-found.
events.test.ts artifact_created version sync + live figure; stub nbRender is skipped.
events.ts Remaining 32-line artifact_created body (app.js:5314-5346).
files-index.test.ts Cursor lifecycle (filter/project drop), no array-route fallback, first page ≤50.
files-index.ts B-06 GET .../artifact-index only. Filter fingerprint drops stale cursors.
http-stub.ts JSON Response stand-in for Vitest.
index.ts Public re-exports.
load.ts loadArtifacts / loadProjectArtifacts / setFilesScope.
preview.ts Scoped exact-version grant upgrade with a per-version grant cache, the retargeted caption, and the inert /preview/<id-or-version> fallback once a grant is refused.
preview.test.ts Production renderer grant lifecycle, grant reuse and expiry, origin/path rejection, exact-version fallback, non-loopback inertness, and detached iframe regression tests.
renderers.ts Ten scientific glues + image/pdf/html/3Dmol islands via isReady. PDF iframe gets F-18 sandbox="".
sheet.test.ts sheetShape union keys; 5000×100 cap.
sheet.ts renderSheet / sheetShape (app.js:8771-8802).
state.ts Lane-local M-03 signals. Not promoted into stores/.
thumbs.ts Tile thumbs, parseMolPoints / molSvg.
types.ts Artifact DTO, page size 50/100, TEXT_EXT / MOL_EXT.
ui.ts Files grid, Viewer, openViewer, ⌘K/deep-link hit. Provided version_id never silent-latest.
ui.test.ts Deep-link apply / openViewer exact pin / stale does not open latest.