Aily Coder Libraries
Use coder_library_search for Aily libraries. It shares Blockly libraries.json and libraries-index.json and the main application's regional npm registry configuration. Install exact blockly:@aily-project/lib-* refs through coder_library_install. For Arduino official libraries, use the same search tool with source="registry"; the regional libraries-coder-index.json returns coder:@aily-project-coder/lib-* refs and npm_registry_coder selects that package registry. Both scopes keep source npm-managed: src.7z is safely expanded beside the archive to package-root src/, and the Runtime maps the final source roots into Aily View and the compiler. Only coder_library_localize creates an editable copy under sketch/libraries/.
Choose a library
- Read root
package.json, inspect returned package-local roots, and inspectsketch/libraries/for intentional local overrides. A package is ready only when itssrc/src.7zpreparation produced non-empty mapped roots. - Call
coder_library_search. When the user supplied a library name, query that exact name first; use additional capability words only as ranking hints. - Compare every plausible result with the required protocol, device, API, architecture, version, license, and timing constraints. Use returned metadata, dependencies, includes, documentation, and installed source where available. A name match or successful build alone does not prove functional coverage.
- Inspect
compatible,compatibility.supportedArchitectures, andcompatibility.activeArchitecturesbefore installation. For a compatible result, install it withcoder_library_install, copying its exact returnedlibraryRefandversion. - If the user explicitly named and requested one library whose selected version is incompatible, explain the supported and current architectures, present up to three
compatibleAlternativesas metadata-ranked candidates, and ask whether to install the named library anyway. Verify each candidate's actual API before describing it as functionally suitable. If the user confirms, callcoder_library_installwithallowIncompatible=true. If this confirmation times out, is skipped, or its UI is unavailable, the original explicit install request remains authoritative: install withallowIncompatible=true, then state clearly that the library was installed despite the compatibility warning and repeat the compatible alternatives. If the user declines, do not install it. - Never set
allowIncompatible=truefor a library chosen by the Agent or for a general capability request that did not explicitly name the library. Prefer a verified compatible alternative; if none satisfies the requirements, return toaily-coder-projectand followaily-coder-local-library. - Require
ready=true,packageJsonLinked=true,sourceLayout="package-local", and non-emptylibraryRootsundernode_modules/<package>/src.... The Runtime validates and extractssrc.7znext to the archive; one package can contain multiple roots below the final unambiguoussrcwrapper. - Inspect returned
packageDirectory,sourceDirectory, andlibraryRoots. Do not run npm or extract archives manually to bypass installation checks. - Never edit package-local roots. If the installed API must be adapted or repaired, call
coder_library_localizewith the exactlibraryRef,installedVersion, and targetlibraryRoot, then edit only its returnedlocalRootsundersketch/libraries/. - If no catalog result satisfies every key constraint, return to
aily-coder-projectand followaily-coder-local-libraryto implement the missing capability undersketch/libraries/. - For any other failed install, including an HTTP 400 response, report that installation failed and preserve the returned error code and message for the user. Do not present it as installed or silently retry an unrelated failure with
allowIncompatible.
Remove safely
- Search for the installed library and require
installed=trueandmanaged=true. Ifmanaged=false, leave the local or copied library untouched. - Copy the exact installed
libraryRefandinstalledVersion; do not substitute the currently selected catalogversion. - Call
coder_library_removewith thatlibraryRefandinstalledVersion. - The Runtime uninstalls the associated npm package and its package-local extracted source. Copies localized under
sketch/libraries/are project source and remain untouched. Existing managed ZIP libraries remain removable through their original refs.
Boundaries
- Always use
coder_library_search; do not call Blocklylib_addorlib_removein Coder mode. - Share the Blockly package/catalog installation through Coder tools; ordinary catalog source remains package-local and is projected into the compiler.
- An existing npm dependency alone is not readiness. Require mapped package-local
libraryRoots; do not unpack the archive manually. - Treat
sketch/libraries/as persistent editable project source. Usecoder_library_localizebefore changing an installed catalog library, and prefer the localized copy over its package projection. - Build through the existing host
project_buildtool after installation or local implementation.