Skip to content

feat(emergent-time): @ruvector/emergent-time WASM package + TypeScript SDK#566

Open
ruvnet wants to merge 1 commit into
mainfrom
feat/emergent-time-wasm
Open

feat(emergent-time): @ruvector/emergent-time WASM package + TypeScript SDK#566
ruvnet wants to merge 1 commit into
mainfrom
feat/emergent-time-wasm

Conversation

@ruvnet

@ruvnet ruvnet commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Adds @ruvector/emergent-time — a WebAssembly build of the emergent-time crate's Agentic Time layer, with a TypeScript SDK. Published to npm as @ruvector/emergent-time@0.1.0.

Contents

  • crates/emergent-time-wasm/wasm-bindgen cdylib wrapping emergent-time (path dep). opt-level="z", lto, strip, dlmalloc allocator. Excluded from the workspace so the cdylib is not built on the host by the workspace CI shards.
  • npm/packages/emergent-time/ — the published package: built pkg/ (wasm + JS glue + .d.ts), package.json, scripts/build.sh, and a detailed README.

SDK

Centers on the agentic-time API (hand-rolled getters, no serde, to keep the wasm small):

  • AgenticClock — feed six-channel StateDeltas, get explainable Ticks, cumulative agentic time, the Agentic Time Index (ATI), and 7-state health classification.
  • WindowedDeltaClock (rolling z-score) and PageHinkleyDetector (adaptive CUSUM) change-point detectors.
  • LearnedWeights — inference of an offline-trained logistic scorer.

The physics modules (Wheeler–DeWitt, Page–Wootters, entropic, thermal) are not wrapped — they operate on dense complex matrices that don't serialize cheaply over the JS boundary; the README points to the emergent-time crate on crates.io for those.

Sizes / validation

  • WASM: 62.5 KB raw → 55.0 KB after wasm-opt -Oz; wasm-tools validate passes.
  • Tarball: 40.5 KB packed; 6 files including README + both .d.ts.
  • Node smoke test (--target web loaded via initSync): constructs a clock, feeds synthetic deltas, walks Healthy→Drifting→NeedsReplan→Collapsing→NeedsHumanReview as contradiction climbs; both detectors fire at the planted change-point.
  • tsc --noEmit --strict passes against a usage example.

Honesty note

The README carries the same caveat as the crate/ADR-251: the agentic clock is a diagnostic signal; it does not establish an early-warning lead over a fair baseline on real traces. Both fair baselines are exported so users can compare.

🤖 Generated with claude-flow

… Time

Wrap the agentic-time layer of the dependency-free `emergent-time` crate in a
tiny wasm-bindgen surface for the browser, edge, and Node.

- crates/emergent-time-wasm: standalone cdylib (workspace-excluded so it carries
  its own opt-level="z" / lto / strip / panic=abort release profile and dlmalloc
  global allocator, mirroring crates/rvf/rvf-wasm). Hand-rolled getters, no serde,
  to keep the wasm tiny.
- SDK surface: AgenticClock (tick → explainable Tick{class,reason,deltaTime,
  per-channel}; cumulativeTime, ATI, 7-state health), StateDelta, Tick,
  TickClassJs, AgentHealthJs, WindowedDeltaClock + PageHinkleyDetector
  change-point detectors, LearnedWeights inference, version().
- Physics core (Wheeler-DeWitt / Page-Wootters / entropic / thermal / Structural
  Proper Time) deliberately not wrapped: dense matrices don't serialize cheaply
  over the JS boundary and would bloat the wasm. Documented in the README.
- npm/packages/emergent-time: package.json (@ruvector/emergent-time@0.1.0, ESM,
  main/module/types → pkg, files include pkg + README, publishConfig public),
  detailed README, build.sh pipeline (cargo @1.89 → wasm-bindgen --target web →
  wasm-opt -Oz with bulk-memory/nontrapping-float-to-int enabled), and the built
  pkg/ (wasm + JS glue + .d.ts).

Validation: wasm raw 62475B / opt 55009B (wasm-tools VALID); Node ESM smoke test
passes end-to-end (AgenticClock Healthy→Drifting→NeedsReplan→Collapsing→
NeedsHumanReview, cumulativeTime 19.36, both detectors fire at the planted jump);
tsc --noEmit --strict on a usage example against the shipped .d.ts exits 0;
npm pack --dry-run lists README.md + .wasm + .js + .d.ts.

Honest scope (mirrors ADR-251): the agentic clock is a diagnostic signal; it does
not establish an early-warning lead over a fair baseline on real traces. Both
fair baselines (windowed z-score, Page-Hinkley) are exported.

Co-Authored-By: claude-flow <ruv@ruv.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant