feat(sdk): variable declaration read APIs + browser-safe variables entry#2046
Open
jrusso1020 wants to merge 1 commit into
Open
Conversation
Collaborator
Author
This was referenced Jul 8, 2026
First PR of the template-variables Studio stack — the SDK read surface.
- @hyperframes/core/variables: new browser-safe subpath bundling the full
composition-variables surface in one import: schema types,
parseCompositionVariables, getVariables/readDeclaredDefaults,
validateVariables. The core/parsers root barrels pull Node-only modules
and break browser bundles (verified against the studio build).
- parsers: move parseCompositionVariables out of htmlParser.ts into a
browser-safe module; re-export from the root and ./composition entries.
- sdk: new read-only Composition methods:
- getVariableDeclarations() — strict canonical schema parse
- getVariableValues(overrides?) — mirrors the runtime getVariables()
merge exactly (loose defaults + overrides, undeclared keys pass through)
- validateVariableValues(values) — same checks as --strict-variables
- re-export CompositionVariable/CompositionVariableType/
VariableValidationIssue types from the SDK for consumers.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
df8c269 to
9e24243
Compare
Fallow audit reportFound 1 finding. Details
Generated by fallow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
First PR of the template-variables Studio stack (#2046 → #2052): the SDK read surface for composition variables, plus a new browser-safe
@hyperframes/core/variablesentry point.comp.getVariableDeclarations()— the typed schema fromdata-composition-variables(same strict filter the render pipeline uses)comp.getVariableValues(overrides?)— resolves values exactly like the runtime'sgetVariables()(loose defaults merged under overrides, undeclared keys pass through), so callers can predict what a composition script will read for a given--variablespayloadcomp.validateVariableValues(values)— same checks as--strict-variables(undeclared / type-mismatch / enum-out-of-range)@hyperframes/core/variables: one browser-safe import for the whole variables surface (schema types,parseCompositionVariables,getVariables/readDeclaredDefaults,validateVariables)parseCompositionVariablesmoved out of the linkedom-heavyhtmlParser.tsinto a browser-safe module (re-exported from the root and./compositionentries)Why
The variables backend (runtime merge, CLI/Lambda injection, validation) is complete, but Studio and embedders had no API to inspect a composition's variable contract. This PR is the foundation the rest of the stack (edit ops → studio-server plumbing → Variables panel) builds on, SDK-first so agents and embedded hosts get the same contract as Studio.
How
The subpath exists because the core/parsers root barrels pull Node-only modules and break browser bundles — verified by building the studio against a root import (it fails on
node:pathinassetPaths.ts).getVariableValuesdeliberately uses the runtime's loose defaults extraction, not the strict declaration parser, so its output matches render behavior byte-for-byte even for malformed entries the strict parser drops (covered by a dedicated test).Test plan
session.variables.test.ts(declarations parsing, runtime-parity merge including the loose-vs-strict divergence case, validation issues)🤖 Generated with Claude Code