storage/framework/browser-auto-imports.json is treated across the docs as the authority on what an stx template gets for free. AGENTS.md says so in as many words, and stacks-composables now defers to it. But the manifest is a compile-time artifact, and the names it declares are not the names the stx runtime provides.
What I can show
1. Nothing in the framework reads the manifest at build time. It is written by generateAutoImportFiles in storage/framework/core/server/src/imports.ts:1157 and read by exactly three things: buddy docs:agent-counts, agents-md-auto-imports.test.ts, and composables-skill-auto-imports.test.ts. All three are checks. No bundler step, no plugin, no injection.
$ grep -rn "browser-auto-imports.json" --include="*.ts" storage/framework/core/ | grep -v dist
storage/framework/core/server/src/imports.ts:1157 # writes it
storage/framework/core/buddy/src/commands/docs/agent-counts.ts:149,177 # checks it
2. What it feeds is a declaration file. imports.ts derives the JSON from the pruned types/browser-auto-imports.d.ts by scraping const NAME: lines. Ambient const declarations tell tsc the name resolves. They do not put anything on the page.
3. The stx runtime ships a different set. From the installed package:
$ grep -rhoE "function (use[A-Z][A-Za-z0-9]*)" node_modules/@stacksjs/stx/dist/*.js | sort -u | wc -l
54
Cross-referencing those 54 against the manifest's 27 use*, the overlap is roughly six (useDark, useFetch, useOnline, usePreferredDark, useScrollLock, useToggle). The rest of the manifest's list, including useAbs, useAuth, useDateFormat, useForm, useNow, useStorage, useSum, useTimeoutFn and the store composables, do not appear as runtime functions in that dist.
The runtime has plenty the manifest lacks, too (useClipboard, useCookie, useHead, useRoute, useQuery, useVirtualList, ...), which is the same gap in the other direction: names that work and are typed as errors.
Why it matters
If a manifest name is not a runtime global, referencing it in a template is a ReferenceError thrown during setup, before any binding applies. That does not degrade the one call; it takes the whole page down. And because the name is in the .d.ts, buddy typecheck passes, so nothing catches it before the browser does.
This is the failure mode AGENTS.md already documents for a different reason - it carries a correction about having listed ref, computed, useColorMode, useLocalStorage and friends as auto-imported when they are in neither manifest. The concern here is one layer deeper: names that ARE in the manifest and still are not there at runtime.
What I have not established
Whether the served /_stx/runtime.js matches the package dist I grepped, and whether some path outside storage/framework/core/ supplies the missing names. Both need a running dev server, which is why this is an issue rather than a patch - I did not want to "fix" the documented list on an inference and make it wrong in a new way.
The cheap confirmation, from a running app:
grep -o 'function use[A-Z][A-Za-z0-9]*' <(curl -s localhost:3000/_stx/runtime.js) | sort -u
Compare that against jq -r '.globals | keys[]' storage/framework/browser-auto-imports.json. Whichever way it comes out, the answer belongs in a test: the manifest and the runtime should not be free to disagree, in either direction.
If it is confirmed
The docs are currently accurate about the manifest and would be wrong about reality. AGENTS.md's auto-import section and the free list in stacks-composables both derive from the manifest (the latter is delimited by <!-- auto-imported:begin --> markers and checked by a test, so there is one place to change). Both would need to derive from whatever turns out to be authoritative instead.
Found while giving the composables skill an accurate list of what a template gets for free (0c46e3c218); it corrected "All are auto-imported" to the manifest's 27, which is right about the manifest and possibly not right about the browser.
storage/framework/browser-auto-imports.jsonis treated across the docs as the authority on what an stx template gets for free.AGENTS.mdsays so in as many words, andstacks-composablesnow defers to it. But the manifest is a compile-time artifact, and the names it declares are not the names the stx runtime provides.What I can show
1. Nothing in the framework reads the manifest at build time. It is written by
generateAutoImportFilesinstorage/framework/core/server/src/imports.ts:1157and read by exactly three things:buddy docs:agent-counts,agents-md-auto-imports.test.ts, andcomposables-skill-auto-imports.test.ts. All three are checks. No bundler step, no plugin, no injection.2. What it feeds is a declaration file.
imports.tsderives the JSON from the prunedtypes/browser-auto-imports.d.tsby scrapingconst NAME:lines. Ambient const declarations telltscthe name resolves. They do not put anything on the page.3. The stx runtime ships a different set. From the installed package:
Cross-referencing those 54 against the manifest's 27
use*, the overlap is roughly six (useDark,useFetch,useOnline,usePreferredDark,useScrollLock,useToggle). The rest of the manifest's list, includinguseAbs,useAuth,useDateFormat,useForm,useNow,useStorage,useSum,useTimeoutFnand the store composables, do not appear as runtime functions in that dist.The runtime has plenty the manifest lacks, too (
useClipboard,useCookie,useHead,useRoute,useQuery,useVirtualList, ...), which is the same gap in the other direction: names that work and are typed as errors.Why it matters
If a manifest name is not a runtime global, referencing it in a template is a
ReferenceErrorthrown during setup, before any binding applies. That does not degrade the one call; it takes the whole page down. And because the name is in the.d.ts,buddy typecheckpasses, so nothing catches it before the browser does.This is the failure mode
AGENTS.mdalready documents for a different reason - it carries a correction about having listedref,computed,useColorMode,useLocalStorageand friends as auto-imported when they are in neither manifest. The concern here is one layer deeper: names that ARE in the manifest and still are not there at runtime.What I have not established
Whether the served
/_stx/runtime.jsmatches the package dist I grepped, and whether some path outsidestorage/framework/core/supplies the missing names. Both need a running dev server, which is why this is an issue rather than a patch - I did not want to "fix" the documented list on an inference and make it wrong in a new way.The cheap confirmation, from a running app:
Compare that against
jq -r '.globals | keys[]' storage/framework/browser-auto-imports.json. Whichever way it comes out, the answer belongs in a test: the manifest and the runtime should not be free to disagree, in either direction.If it is confirmed
The docs are currently accurate about the manifest and would be wrong about reality.
AGENTS.md's auto-import section and the free list instacks-composablesboth derive from the manifest (the latter is delimited by<!-- auto-imported:begin -->markers and checked by a test, so there is one place to change). Both would need to derive from whatever turns out to be authoritative instead.Found while giving the composables skill an accurate list of what a template gets for free (0c46e3c218); it corrected "All are auto-imported" to the manifest's 27, which is right about the manifest and possibly not right about the browser.