Skip to content

FE-629: Compile Petrinaut user code through an HIR to buffer-native programs#8955

Draft
kube wants to merge 3 commits into
cf/h-6519-add-uuid-boolean-and-int-discrete-typesfrom
petrinaut-lang
Draft

FE-629: Compile Petrinaut user code through an HIR to buffer-native programs#8955
kube wants to merge 3 commits into
cf/h-6519-add-uuid-boolean-and-int-discrete-typesfrom
petrinaut-lang

Conversation

@kube

@kube kube commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

Introduces an HIR (high-level intermediate representation) as the single compiler for Petrinaut user code (dynamics, lambdas, transition kernels), replacing the Babel + new Function pipeline. The HIR is a typed, source-spanned, JSON-serializable expression tree that supports:

  • Static analysis: distribution DAGs inside transition kernels (nodes, .map derivation edges, output sinks, shared draws), dependency sets (which parameters/token attributes a lambda reads), determinism classification, and semantic lints surfaced in the LSP with exact source ranges.
  • Schema-checked compilation to a minimal-overhead buffer ABI: compiled programs read token attributes at statically resolved offsets in the packed frame floats (tokenValues[slotBases[slot] + attr]) — no per-combination record decode/encode, no allocation in the hot loop.
  • A future DSL frontend and WASM/GPU backends targeting the same HIR (design docs included).

The design doc lives at libs/@hashintel/petrinaut-core/src/hir/README.md; the planned OCaml-flavoured DSL sketch at src/hir/dsl-sketch.md.

🔗 Related links

🔍 What does this change?

HIR pipeline (petrinaut-core/src/hir/, new ./hir + ./hir-runtime package entries):

  • TS→HIR lowering with positioned diagnostics; the subset covers const (incl. destructuring like const { a, b } = parameters and const [a, b] = input.Place), guard-clause if/early returns, ternaries, Math.*, token/parameter access, .map(...), and first-class Distribution.* nodes
  • Typecheck against the Colour/parameter schema (unknown/missing attributes, discrete derivatives, Distribution-into-discrete, arc-weight bounds, output-place coverage) — a clean typecheck gates buffer emission
  • Analyses: dependency sets, distribution DAG, binding usage, constant folding
  • Emitters: buffer-ABI lambda (tokenValues, slotBases) => rate and kernel (tokenValues, slotBases, out, distSink) => void (deferred distribution sampling ordered by output float index → exact legacy RNG-stream parity), buffer-native dynamics Float64Array loop, plus an object-convention fallback for shapes that don't scalarize

Engine (simulation/engine, simulation/monte-carlo):

  • Both hot loops prefer buffer programs with reusable per-transition scratch (slotBases Int32Array, staging Float64Array); token records are built lazily only for object-fallback programs
  • buildSimulation consumes SimulationInput.hirArtifacts only — the engine bundles no compiler; missing artifacts fail per item with a pointer to the Diagnostics tab
  • @babel/standalone and compile-user-code.ts are deleted; simulation/monte-carlo worker bundles shrink from ~3 MB to ~40 kB each

LSP + UI:

  • New sdcpn/compileHirArtifacts worker request / LanguageClient.requestHirArtifacts; the simulation and experiments providers compile artifacts before starting runs
  • HIR semantic lints in the checker (source: "hir", codes 99001+): Math.random reproducibility warning, transition-never-fires, shared-sample notes, unused bindings; out-of-subset code is an error
  • Play now gates on error-severity diagnostics only (DiagnosticsSnapshot.errorCount); the diagnostics indicator shows amber for warnings-only vs red for errors
  • HIR Playground story (HIR/Playground in the petrinaut Storybook): type user code + edit the model schema, inspect the HIR tree, diagnostics, inferred types, dependencies, distribution DAG, and both emitted programs live

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • modifies an npm-publishable library and I have added a changeset file(s)

📜 Does this require a change to the docs?

The changes in this PR:

  • require changes to docs which are made as part of this PR
    • petri-net-extensions.md documents the supported code subset and the error/warning split; simulation.md updated for error-only Play gating. Screenshots showing the diagnostics indicator may want refreshing (new amber warnings-only state).

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

⚠️ Known issues

  • Structural shapes the buffer emitter cannot scalarize (conditionals over whole records, dynamic token indices) run the object-convention HIR program per item — still compiled, just with record decode around it. All shipped examples reach the buffer ABI (enforced by test).
  • Kernels run the object program when stochasticity is disabled (that wrapper carries the distributions-forbidden runtime check).
  • Metrics/scenarios keep their new Function compilation (they never used Babel); visualizer JSX keeps @babel/standalone in the UI package.
  • Out-of-subset user TypeScript that previously executed via Babel no longer runs (deliberate: the subset is what makes analysis and buffer compilation possible); it surfaces as an error diagnostic with a rewrite hint.
  • Static storybook build output fails to render for all stories in this package (pre-existing react/jsx-runtime resolution issue); use yarn dev.

🐾 Next steps

  • Skip materializeEngineFrame in the single-run engine (buffer path only needs offsets/counts + token floats)
  • Buffer kernels under disabled stochasticity; cross-token dynamics shapes
  • Metrics/scenarios on the HIR (needs reduce/filter comprehension nodes)
  • WASM backend (the buffer ABI is already the right shape), GPU dynamics/Monte-Carlo
  • DSL frontend lowering to the same HIR (src/hir/dsl-sketch.md)
  • Artifact caching keyed by content hash

🛡 What tests cover this?

  • 623 petrinaut-core tests + 131 petrinaut tests, including:
    • build-simulation-hir.test.ts — buffer vs object programs produce bit-identical frames over 50 stochastic steps (incl. RNG stream through distribution sampling); stale-artifact fallback; missing-artifact errors
    • hir/compile.test.ts — coverage gate: every example model compiles fully, and every dynamics/lambda/kernel reaches the buffer ABI
    • Unit tests for lowering (destructuring, guards, spans), typecheck rules, analyses (DAG/deps/folding), and both emitters
  • The playground story was verified headless (Playwright): all panels populate, surface switching works, schema edits produce live diagnostics, zero console errors

❓ How to test this?

  1. cd libs/@hashintel/petrinaut && yarn dev → open HIR → Playground: type code, break it (add a for loop), edit the schema (make an attribute "integer" and feed it a Distribution)
  2. Open the Petrinaut editor, load any example (e.g. Supply Chain), check the Diagnostics tab, and run a simulation / Monte-Carlo experiment — behaviour is unchanged, now via HIR artifacts
  3. yarn workspace @hashintel/petrinaut-core test:unit run

🤖 Generated with Claude Code

kube and others added 3 commits July 4, 2026 02:23
Introduce a typed, source-spanned, JSON-serializable HIR as the single
compiler for dynamics/lambda/kernel user code:

- TS->HIR lowering (const destructuring, guard if/early-return, .map
  comprehensions, first-class distributions) with positioned diagnostics
- Schema-checked typing against Color/parameter definitions; analyses for
  dependency sets, distribution DAGs (nodes/edges/sinks/shared draws),
  binding usage and constant folding
- Buffer-ABI emitters: lambdas read token attributes at statically
  resolved offsets (tokenValues[slotBases[slot] + attr]); kernels write
  place-major staging floats with deferred distribution sampling ordered
  by output index (exact legacy RNG-stream parity); dynamics compile to
  allocation-free Float64Array loops
- Engine hot loops (single-run + Monte Carlo) prefer buffer programs and
  fall back to object-convention HIR programs per item
- HirArtifacts v2 compiled in the LSP worker (sdcpn/compileHirArtifacts
  request) and threaded through simulation/experiment configs; the
  engine no longer bundles any compiler (simulation workers: ~3MB -> ~40kB)
- HIR semantic lints in the LSP checker (source "hir", codes 99001+);
  out-of-subset code is an error and Play gates on error severity only
- Remove @babel/standalone and compile-user-code.ts; fix H-6519
  violations in the supply-chain example; shipped examples are the
  buffer-ABI coverage gate

Design docs: src/hir/README.md (architecture) and src/hir/dsl-sketch.md
(planned OCaml-flavoured DSL lowering to the same HIR).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Interactive playground for the HIR pipeline: type dynamics/lambda/kernel
TypeScript on the left, and inspect everything it compiles to on the
right — the spanned HIR tree, diagnostics with exact ranges, the inferred
return type, dependency sets, the distribution DAG (derivation edges,
output sinks, shared draws), and both emitted programs (buffer-ABI fast
path and object-convention fallback). The model schema (parameters,
places, attribute types) is editable JSON and re-checks live.

Exposes the compiler via new `@hashintel/petrinaut-core/hir` and
`/hir-runtime` entries (typescript declared as an optional peer — only
the ./hir entry needs it).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 4, 2026 00:52
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment Jul 4, 2026 1:07am
petrinaut Ready Ready Preview, Comment Jul 4, 2026 1:07am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Jul 4, 2026 1:07am

@cursor

cursor Bot commented Jul 4, 2026

Copy link
Copy Markdown

PR Summary

High Risk
This is a core simulation compilation swap with a breaking contract (subset-only code, mandatory artifacts) and correctness depends on buffer vs legacy RNG parity; mistakes would change stochastic results or block runs.

Overview
Replaces the Babel/new Function path for dynamics, lambdas, and transition kernels with a TypeScript→HIR pipeline that typechecks against colour schemas, analyzes distributions/dependencies, and emits buffer-ABI programs (static token offsets in packed Float64Array frames) plus an object-convention fallback.

@hashintel/petrinaut-core drops @babel/standalone, adds optional typescript peer and ./hir / ./hir-runtime exports; workers only instantiate precompiled artifacts, shrinking simulation bundles sharply. Runs now require hirArtifacts from the LSP (requestHirArtifacts); code outside the supported subset is a blocking error with positioned diagnostics (destructuring and guard-clause if/early returns are in-subset).

Also tightens discrete token attribute rules (H-6519): dynamics derivatives only on reals, distributions only on real kernel outputs, typed defaults/AI cheatsheet, and a supply-chain example fix (priority → real).

Reviewed by Cursor Bugbot for commit 1cecf1b. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team area/apps > hash.design Affects the `hash.design` design site (app) labels Jul 4, 2026
@kube kube changed the base branch from main to cf/h-6519-add-uuid-boolean-and-int-discrete-types July 4, 2026 00:53
@kube

kube commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator Author

Stacked on #8764 (H-6519 discrete attribute types) — this PR's base is set to that branch so the diff shows only the HIR work; GitHub will retarget to main when #8764 merges.

case "let":
// `let` only appears as a function/callback body; those emit blocks.
// eslint-disable-next-line no-use-before-define -- mutual recursion
return `(() => ${emitBody(expr, scope)})()`;

function instantiate(source: string): unknown {
// eslint-disable-next-line no-new-func, @typescript-eslint/no-implied-eval, @typescript-eslint/no-unsafe-call
return new Function("__dist", `"use strict"; return (${source});`)(
return new Function(
"__dist",
"__params",
`"use strict"; return (${source});`,

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces Petrinaut’s Babel + new Function compilation for dynamics/lambdas/kernels with a typed, source-spanned HIR pipeline, enabling static analysis and emitting buffer-ABI programs that operate directly on packed frame buffers. It also introduces discrete token attribute types (integer/boolean), updates UI/editor flows to reflect typed attributes, and wires simulation/Monte-Carlo runs to require precompiled HIR artifacts produced by the LSP worker.

Changes:

  • Add Petrinaut-core HIR compiler + runtime instantiation entrypoints, with LSP integration for compilation and diagnostics (including HIR semantic lints).
  • Update simulation and Monte-Carlo engines/workers to execute buffer-ABI programs (with object-convention fallback) and to require hirArtifacts provided by the UI via the language worker.
  • Introduce typed token attributes (real/integer/boolean) end-to-end (schema/types, encoding/decoding, scenario/metric typing, UI token type editor + spreadsheet boolean/integer handling) and update docs accordingly.

Reviewed changes

Copilot reviewed 65 out of 66 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
yarn.lock Removes Babel standalone from petrinaut-core dependency set; adds optional TS peer metadata.
libs/@hashintel/petrinaut/src/ui/views/shared/place-state-visualization.tsx Uses frame reader token decoding (getPlaceTokens) and TokenRecord typing for visualizer inputs.
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/scenarios/view-scenario-drawer.tsx Updates scenario initial-state typing to TokenAttributeValue.
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/scenarios/scenario-mapping.ts Updates comments/wording for typed token rows.
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/scenarios/scenario-form.tsx Threads spreadsheet typed cell values + element types through scenario form state.
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/PropertiesPanel/type-properties/subviews/main.tsx Adds per-dimension type dropdown (real/integer/boolean) and related styling.
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/PropertiesPanel/place-properties/subviews/place-initial-state/subview.tsx Passes full place into initial-state editor; supports read-only scenario display.
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/PropertiesPanel/place-properties/subviews/place-initial-state/initial-state-editor.tsx Supports typed spreadsheet cells and defaults based on element type; uses decoded frame tokens.
libs/@hashintel/petrinaut/src/ui/views/Editor/components/BottomBar/diagnostics-indicator.tsx Adds warning state (amber) and separates error count from total count.
libs/@hashintel/petrinaut/src/ui/views/Editor/components/BottomBar/bottom-bar.tsx Gates simulation on error-severity diagnostics only.
libs/@hashintel/petrinaut/src/ui/lib/compile-visualizer.ts Expands visualizer token typing to include booleans.
libs/@hashintel/petrinaut/src/ui/components/spreadsheet.tsx Adds typed columns and boolean cell UX; supports integer rounding and defaults per type.
libs/@hashintel/petrinaut/src/ui/components/spreadsheet.stories.tsx Updates story types for SpreadsheetCellValue.
libs/@hashintel/petrinaut/src/react/simulation/provider.tsx Requests HIR artifacts from language worker before starting simulation; passes hirArtifacts to engine.
libs/@hashintel/petrinaut/src/react/lsp/provider.tsx Exposes errorDiagnosticsCount and requestHirArtifacts via context.
libs/@hashintel/petrinaut/src/react/lsp/context.ts Adds requestHirArtifacts and errorDiagnosticsCount to context contract/defaults.
libs/@hashintel/petrinaut/src/react/experiments/provider.tsx Requests HIR artifacts before starting Monte-Carlo experiments; passes hirArtifacts.
libs/@hashintel/petrinaut/docs/simulation.md Documents error-only Play gating (warnings/hints don’t block).
libs/@hashintel/petrinaut/docs/petri-net-extensions.md Documents typed dimensions, discrete semantics, diagnostics severity split, and supported subset.
libs/@hashintel/petrinaut-core/vite.config.ts Adds hir and hir-runtime entries; externalizes typescript as optional peer for compiler entry.
libs/@hashintel/petrinaut-core/src/types/sdcpn.ts Introduces ColorElementType, TokenAttributeValue, TokenRecord; updates scenario typing.
libs/@hashintel/petrinaut-core/src/simulation/worker/simulation.worker.ts Passes hirArtifacts through init message into runtime.
libs/@hashintel/petrinaut-core/src/simulation/worker/messages.ts Adds optional hirArtifacts to simulation worker init payload.
libs/@hashintel/petrinaut-core/src/simulation/runtime/simulation.ts Forwards hirArtifacts into worker initialization.
libs/@hashintel/petrinaut-core/src/simulation/monte-carlo/worker/monte-carlo.worker.ts Passes hirArtifacts through Monte-Carlo init.
libs/@hashintel/petrinaut-core/src/simulation/monte-carlo/worker/messages.ts Adds optional hirArtifacts to Monte-Carlo worker init payload.
libs/@hashintel/petrinaut-core/src/simulation/monte-carlo/types.ts Threads optional hirArtifacts into Monte-Carlo simulator config.
libs/@hashintel/petrinaut-core/src/simulation/monte-carlo/transition-effect.ts Adds buffer-ABI fast path for lambdas/kernels; typed token decode/encode; lazy object decoding.
libs/@hashintel/petrinaut-core/src/simulation/monte-carlo/runtime/experiment.ts Threads hirArtifacts through experiment creation and worker init.
libs/@hashintel/petrinaut-core/src/simulation/monte-carlo/run-state.ts Passes hirArtifacts into simulation created for each run.
libs/@hashintel/petrinaut-core/src/simulation/monte-carlo/monte-carlo-simulator.test.ts Compiles/threads HIR artifacts in tests now that engine no longer compiles user code.
libs/@hashintel/petrinaut-core/src/simulation/frames/frame-reader.ts Decodes typed token attribute values when producing token records.
libs/@hashintel/petrinaut-core/src/simulation/engine/types.ts Adds buffer-program scratch/type plumbing and hirArtifacts to simulation input.
libs/@hashintel/petrinaut-core/src/simulation/engine/token-values.ts New helpers to coerce/encode/decode typed token attributes and records.
libs/@hashintel/petrinaut-core/src/simulation/engine/execute-transitions.test.ts Updates compiled transition test scaffolding to include element metadata + buffer field.
libs/@hashintel/petrinaut-core/src/simulation/engine/compute-possible-transition.ts Adds buffer-ABI fast path; typed token decode/encode; lazy object decoding.
libs/@hashintel/petrinaut-core/src/simulation/engine/compute-possible-transition.test.ts Adds typed token decode/encode test; updates scaffolding for new transition shape.
libs/@hashintel/petrinaut-core/src/simulation/engine/compute-next-frame.test.ts Compiles/threads HIR artifacts in tests now that engine no longer compiles user code.
libs/@hashintel/petrinaut-core/src/simulation/engine/build-simulation.test.ts Updates tests for typed attributes and new “missing compiled code” error behavior; threads artifacts in tests.
libs/@hashintel/petrinaut-core/src/simulation/engine/build-simulation-hir.test.ts New end-to-end equivalence tests for buffer vs object programs and missing/stale artifacts behavior.
libs/@hashintel/petrinaut-core/src/simulation/engine/buffer-transition.ts New shared helpers for buffer-ABI kernel execution, slot-base fill, and staging→add-map conversion.
libs/@hashintel/petrinaut-core/src/simulation/authoring/user-code/distribution.ts Removes injected Distribution runtime source string; documents new HIR runtime injection approach.
libs/@hashintel/petrinaut-core/src/simulation/authoring/user-code/compile-user-code.ts Deletes legacy Babel + new Function compiler for dynamics/lambdas/kernels.
libs/@hashintel/petrinaut-core/src/simulation/authoring/user-code/compile-user-code.test.ts Deletes tests for the removed legacy compiler.
libs/@hashintel/petrinaut-core/src/simulation/authoring/scenario/compile-scenario.ts Coerces typed token row/record values; reports coercion errors as compile errors instead of throwing.
libs/@hashintel/petrinaut-core/src/simulation/authoring/scenario/compile-scenario.test.ts Adds coverage for typed token row coercion behavior.
libs/@hashintel/petrinaut-core/src/simulation/authoring/metric/compile-metric.ts Updates metric token typing to TokenRecord.
libs/@hashintel/petrinaut-core/src/simulation/ARCHITECTURE.md Updates architecture notes to reflect HIR as sole compiler for dynamics/lambdas/kernels.
libs/@hashintel/petrinaut-core/src/simulation/api.ts Threads hirArtifacts into public config; updates initial marking typing and frame-reader token typing.
libs/@hashintel/petrinaut-core/src/schemas/scenario-schema.ts Allows boolean cell values in per-place token rows.
libs/@hashintel/petrinaut-core/src/schemas/metric-schema.ts Updates metric docs to reflect typed token objects.
libs/@hashintel/petrinaut-core/src/schemas/entity-schemas.ts Updates schema docs for discrete attributes and distribution constraints for outputs/dynamics.
libs/@hashintel/petrinaut-core/src/lsp/worker/protocol.ts Adds sdcpn/compileHirArtifacts request type.
libs/@hashintel/petrinaut-core/src/lsp/worker/language-server.worker.ts Implements sdcpn/compileHirArtifacts by calling compileHirArtifacts.
libs/@hashintel/petrinaut-core/src/lsp/lib/ts-to-lsp.ts Preserves TS diagnostic source when present (so HIR lints can be source: "hir").
libs/@hashintel/petrinaut-core/src/lsp/lib/generate-virtual-files.ts Updates generated TS types for discrete dynamics derivatives and kernel outputs (Distribution only for real).
libs/@hashintel/petrinaut-core/src/lsp/lib/checker.ts Integrates HIR semantic lints into diagnostics pipeline when TS has no errors; adjusts validity logic to error-only.
libs/@hashintel/petrinaut-core/src/lsp/lib/check-hir.ts New bridge from HIR diagnostics to TS-shaped diagnostics with stable numeric codes and source: "hir".
libs/@hashintel/petrinaut-core/src/lsp/language-client.ts Tracks error-only diagnostic count; adds requestHirArtifacts client method and wire protocol call.
libs/@hashintel/petrinaut-core/src/index.ts Exposes HIR-related types (type-only) from main entry.
libs/@hashintel/petrinaut-core/src/hir/README.md New design doc for HIR pipeline, subset, ABI, and integration.
libs/@hashintel/petrinaut-core/src/hir/lint.ts New HIR semantic linting combining lowering/typecheck/analysis.
libs/@hashintel/petrinaut-core/src/hir/lint.test.ts Adds unit tests for HIR linting rules and subset handling.
libs/@hashintel/petrinaut-core/src/hir/instantiate.ts New dependency-free artifact instantiation and distribution runtime injection.
libs/@hashintel/petrinaut-core/src/hir/emit-js.test.ts Adds tests for object-convention HIR emit helpers.
libs/@hashintel/petrinaut-core/src/hir/emit-buffer-js.test.ts Adds tests for buffer-ABI HIR emission and runtime behavior.
libs/@hashintel/petrinaut-core/src/hir/dsl-sketch.md Adds planned DSL sketch that lowers to HIR.
libs/@hashintel/petrinaut-core/src/hir/compile.ts New batch compilation to HirArtifacts for root net + subnets, with buffer/object emission choices.
libs/@hashintel/petrinaut-core/src/hir/compile.test.ts Adds compilation coverage gates for all shipped example models + buffer ABI coverage.
libs/@hashintel/petrinaut-core/src/hir/analyze.test.ts Adds tests for dependency analysis, distribution DAG extraction, and constant folding.
libs/@hashintel/petrinaut-core/src/hir.ts New public compiler entrypoint aggregating HIR APIs.
libs/@hashintel/petrinaut-core/src/hir-runtime.ts New runtime-only entrypoint (no typescript) for worker/engine consumption.
libs/@hashintel/petrinaut-core/src/examples/supply-chain-with-disruption.ts Fixes discrete-attribute violations uncovered by HIR typechecking (and adjusts dynamics accordingly).
libs/@hashintel/petrinaut-core/src/default-codes.ts Updates default code templates to respect discrete vs real attributes (dynamics derivatives, kernel defaults).
libs/@hashintel/petrinaut-core/src/ai.ts Updates AI prompt “code-surface” contract notes to reflect typed attributes and discrete semantics.
libs/@hashintel/petrinaut-core/package.json Adds ./hir and ./hir-runtime exports; removes Babel standalone; declares optional TS peer.
.changeset/petrinaut-hir-compiler.md Changeset for HIR compiler + runtime export additions and behavior changes.
.changeset/h-6519-discrete-token-attribute-types.md Changeset for discrete token attribute types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +75 to +79
requestHirArtifacts: () =>
Promise.resolve({
artifacts: { version: 2, dynamics: {}, lambdas: {}, kernels: {} },
failures: [],
}),
Comment on lines +78 to +89
let currentRngState = rngState;
for (const pendingIndex of order) {
const dist: RuntimeDistribution = pendingDists[pendingIndex]!;
const [sampled, nextRngState] = sampleDistribution(dist, currentRngState);
currentRngState = nextRngState;
kernelStaging[pendingSlots[pendingIndex]!] = sampled;
}
// Clear per-call sample caches so the next firing draws fresh values:
// emitted kernels construct fresh distribution objects per call, so this
// is defensive only.
pendingSlots.length = 0;
pendingDists.length = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash.design Affects the `hash.design` design site (app) area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

3 participants