Derived from the cocosair-assets skill and its canonical docs/source pointers; reorganized on 2026-10-11. Source annotations below identify repository inputs, not files guaranteed to ship to npm consumers.
Contracts
- There is no Editor asset pipeline.
resourcesresolves by symbol name on the default bundle face, but the export is a barenew Bundle()(src/cocos/asset/asset-manager/bundle.ts:655);assetManager.resources(src/cocos/asset/asset-manager/asset-manager.ts:369-370) andassetManager.getBundle(name)(:482-483) read the module-levelbundlescache (src/cocos/asset/asset-manager/shared.ts:35), which the manager also exposes aspublic bundles(src/cocos/asset/asset-manager/asset-manager.ts:162), and only a Creator-format config puts anything in it (src/cocos/asset/asset-manager/factory.ts:84maps the nameresourcesonto that singleton). With nothing registered the getter isnull, soloadAssetAsyncskips the bundle branch entirely (src/air/utils/load-asset.ts:47-48); if you do hand it an unconfigured bundle,Bundle.loadrejects throughBundle ${item.bundle} doesn't contain ${item.path}(src/cocos/asset/asset-manager/url-transformer.ts:106) andloadAssetAsyncswallows that rejection and falls through to the registry (src/air/utils/load-asset.ts:49-57).Bundle,Config,PackManager,VariantandCacheare not export names on the default face, so a bundle instance is only reachable throughassetManager.getBundle(...)andassetManager.assetsis a plain string-keyed map (src/cocos/asset/asset-manager/cache.ts:184-189,get:206,has:225,remove:244). loadAssetAsync(src/air/utils/load-asset.ts:32typed overload,:38url overload,:39implementation) resolves in a fixed order: glTF whentype === GLTFAssetor the path is.gltf/.glb(:40-43), then theresourcesbundle when present (:47-51), then the registryassetManager.assets.get(path)gated oncached instanceof type(:60-62), then a registry hit keyed by path before anything is fetched. With atypeand no hit it throws[cocosair] loadAssetAsync: '<path>' not found. Register it via assetManager.assets.add('<path>', asset), or set up a resources bundle.(:64). Without atypeit fetches and engine-deserializes, falling back toJSON.parsewhen the payload is not serialized (:68-77), and a non-2xx response throws[cocosair] loadAssetAsync failed: <url> (<status>)(:70). Both message shapes are the contract recorded atdocs/manual/asset-loading-and-lifetime.md:20,:22.- The registry is a cache, not a guard.
assetManager.assets.add(key, asset)silently overwrites an existing key (src/cocos/asset/asset-manager/cache.ts:184-189), adestroy()only takes effect at the end of the frame, and a destroyed asset stays reachable through its key until youremoveit -loadAssetAsync(path, type)will hand back the dead instance (docs/manual/asset-loading-and-lifetime.md:26-34, items 1 through 5). Same-key reload therefore requires the sequenceremove(key)-> rebuild ->add(key)->loadAssetAsync, and every consumer must callisValid(asset)after a load (examples/ui-asset-loading/src/main.tsruns exactly that round-trip and is bound to theasset-loadedvalidator). loadRemoteis a method, not an import: neitherloadnorloadRemotenorloadAnyappears as an export name, so reach them asassetManager.loadRemote(url, optionsOrExt?, onComplete?)(src/cocos/asset/asset-manager/asset-manager.ts:649-651). Its first statement is the URL-keyed short circuit: whenreloadAssetis falsy andassets.has(url)it returns the cached asset immediately (:654-656), which is how a destroyedAudioClipor texture comes back afterdestroy()alone -examples/audio-basic/main.js:523-530documents exactly that recovery, and the fix isassetManager.releaseAsset(asset)(src/cocos/asset/asset-manager/asset-manager.ts:754-755, which runsreleaseManager.tryRelease(asset, true)).AssetBanksidesteps the trap by always sendingreloadAsset: truewith an explicitext(src/air/assets/asset-bank.ts:362).AssetBank(src/air/assets/asset-bank.ts:146, re-exported atsrc/air/ui-kit.ts:142) is a Promise wrapper with reference counting, not a second asset system:load(:173),release(:264),refCount(:160),inFlightCount(:157),size(:154),releaseAll(:288) and the hard-codedstatic underlyingCancelSupported = false(:148) are the whole public surface, and the genericTonloadis a caller assertion the bank never checks (:9). The cache key isurlalone or`${url}|ext=${ext.toLowerCase()}`(:80-82, lower-cased once at:175), soextis part of identity and the same URL under twoextvalues is two entries.extrules are strict: it must match/^[a-zA-Z0-9]{1,16}$/orAIR_E_INVALID_EXTthrows (:77,:94), and a URL with no suffix requires an explicitextorAIR_E_EXT_REQUIREDthrows (:85-90,:100). The value reaches the engine as.${ext}withreloadAsset: true(:362); a suffix-only URL keeps the native cache path (:365).signalcancels the subscription only - the waiter is removed from the shared in-flight record (:318), the network request still completes, and an orphaned late result is balanced with a net-zeroaddRef/decRefpair (:391-398). Progress is honestly two-phase,onProgress(0, 1)at subscribe and(1, 1)at settle (:328,:406), becauseloadRemoteexposes no task-level progress at all (:144). A cache hit is delivered in a microtask (:212, rationale:188), so a same-tickabortorreleasewins and refunds only that subscription (:193-207).- The
AIR_E_*codes are typed but not importable:AirAssetErrorCodeis the union atsrc/air/assets/asset-bank.ts:61-67andAirAssetErrorthe class at:70, both re-exported fromsrc/air/ui-kit.ts:143as types only, so neither name resolves in the default bundle export block and you match onerr.code. Throw sites:AIR_E_ABORTEDat:183,:207,:225,:320,:414via:428;AIR_E_PROGRESS_ERRORat:220,:332,:408;AIR_E_REVOKEDat:301,:229,:414;AIR_E_LOAD_FAILEDat:386with the shared body at:425-428.releasenever force-releases (:258-263), andreleaseAllrevokes in-flight waiters under an identity guard so a late callback cannot delete a newer same-key record (:290-302,:349). - A runtime texture is two objects.
ImageAsset(src/cocos/asset/assets/image-asset.ts:182) describes CPU pixels and acceptsHTMLCanvasElement | HTMLImageElement | IMemoryImageSource | ImageBitmapthroughreset(:670,:154);Texture2D(src/cocos/asset/assets/texture-2d.ts:85) is the GPU sampler.texture.image = imgismipmaps = [img]and clears every other level (:161-163,:150-155);reset(info)leaves the gfx resource invalid until youuploadData(:192-202,src/cocos/asset/assets/simple-texture.ts:151). There is nogenerateMipmapsmethod - levels come fromupdateMipmaps(firstLevel, count)(src/cocos/asset/assets/texture-2d.ts:232) and from create-time generation only when the mip filter is notNONE(src/cocos/asset/assets/simple-texture.ts:325-329), and the power-of-two test is skipped on WebGL2 (:47-51). Sampling issetWrapMode/setFilters/setMipFilter/setAnisotropyonTextureBase(src/cocos/asset/assets/texture-base.ts:205,:226,:242,:256), whose serialized wrap defaults areREPEAT(:122,:128,:134) -docs/manual/textures.md:33claimsCLAMP_TO_EDGEand is stale. Over-size is a soft log, not a throw (errorID(9100...)atsrc/cocos/gfx/webgl2/webgl2-commands.ts:931-933), againstcapabilities.maxTextureSize(src/cocos/gfx/webgl/webgl-device.ts:180). SpriteFramebinding is untracked.Sprite'sspriteFramesetter and its_applySpriteFramenever calladdRef()ordecRef()(src/cocos/2d/components/sprite.ts:207-218,:691), andLabel.fontdoes the same for aBitmapFont(src/cocos/2d/components/label.ts:466-487), so a bound component is invisible to every handle guard in this skill. Ref before you bind and unref after you unbind (docs/manual/atlas-loading.md:42,docs/manual/bitmap-font-loading.md:37), and expectAIR_E_ATLAS_IN_USE(src/air/assets/atlas/atlas-factory.ts:106-frame.refCount > 1) orAIR_E_FNT_IN_USE(src/air/assets/bmfont.ts:123) when you forget.- libGDX atlases:
parseAtlasText(text)(src/air/assets/atlas/atlas-parser.ts:143) accepts the legacy (xy+size,orig+offset) and compact (bounds,offsets) dialects and rejects mixing them, unknown keys, and Creator.plistinput (:213-264).rectkeepsxywith top-left origin and no page flip (src/air/assets/atlas/atlas-factory.ts:46, ruling recorded at:7-9anddocs/manual/atlas-loading.md:35), rotation stays arotatedflag rather than a rect change (:43), and the engine consumesrectas UV directly (src/cocos/2d/assets/sprite-frame.ts:1038,:1088).createAtlasHandletakes exactly one reference per page texture and per frame (src/air/assets/atlas/atlas-factory.ts:89-90) and destroys everything it built if any region fails (:85-88);loadAtlasis PNG-only on the auto path (src/air/assets/atlas/atlas-loader.ts:48,:53,:57) and indexes page loads bypageIndexso completion order cannot reorder textures (:89,:96-107). - BMFont:
parseFnt(src/air/assets/bmfont.ts:36) is text-dialect only - XML and binary input throwsAIR_E_FNT_FORMAT(:37) - and enforcespages=1,page id=0,char page=0and unpacked (:63,:64,:73), so a multi-page or packed font never reaches the factory.createBitmapFont(:104) demands a full unrotated page matchingscaleW/scaleHon both the frame rect and the texture (:105-109), elseAIR_E_FNT_PAGE_TEXTURE(:110); a trimmed sub-rectangle cannot be a font page.loadBitmapFont(:132) loads the.fntand one.pngthrough a caller-suppliedAssetBank, and the assembler picks the bmfont path whenevercomp.font instanceof BitmapFontbeforecacheModeis consulted (src/cocos/2d/assembler/label/index.ts:34-40), which makescacheModeeffectively inert for a BMFont label (src/cocos/2d/components/label.ts:489-495). - Keep the three capability layers apart.
assetManager,AssetManager,resources,loadAssetAsync,AssetBank,Texture2D,ImageAsset,SpriteFrame,SpriteAtlas,BitmapFont,Font,Asset,TextAsset,JsonAsset,EffectAsset,parseFnt,createBitmapFont,loadBitmapFont,parseAtlasText,createAtlasHandle,createAtlasSpriteFrame,loadAtlasandisValideach resolve by symbol name in the singleexport { ... }block ofbuild/cocosair.module.js;load,loadRemote,loadAny,Bundle,PackManager,Config,Variant,Cache,SimpleTexture,TextureBase,AirAssetErrorandAirAssetErrorCodedo not, so those last two are compile-time-only shapes. Browser-verified at candidate fingerprint2f089f6ce25eaccd:ui-asset-loadingbindsloadAssetAsync,ImageAsset,Texture2DandSpriteFrame.createWithImagetoasset-loadedandAssetManager.releaseAssetplusTexture2D.destroytoresource-released;texture-basicbindsImageAsset/Texture2Dtomaterial-property;static-modelbindsloadAssetAsynctoscene-readyonly;texture2d-opsbinds twelveTexture2Dmembers tono-runtime-erroralone withreads = 0, so it proves the calls do not throw, not that pixels are correct. Noresults[]entry bindsAssetBank,loadRemote, any atlas function or any bitmap-font function, anddocs/evidence/port-gap/eg3-installed-atlas-s11.json(gateEG3,execution.status: PASS,scope.subset: true,completed: false) is the only tracked atlas record -docs/manual/asset-bank-loading.md:5states its own jsdom boundary too.