@almadar/runtime 5.6.0 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { createLogger, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, StateMachineManager, createContextFromBindings, validateEventPayload, formatPayloadValidationError, EffectExecutor } from './chunk-BRN3VJT5.js';
2
- export { InMemoryPersistence } from './chunk-BRN3VJT5.js';
1
+ import { createLogger, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, StateMachineManager, createContextFromBindings, validateEventPayload, formatPayloadValidationError, EffectExecutor } from './chunk-54YR5TKO.js';
2
+ export { InMemoryPersistence } from './chunk-54YR5TKO.js';
3
3
  import './chunk-PZ5AY32C.js';
4
4
  import { Router } from 'express';
5
5
  import * as fs from 'fs';
@@ -363,6 +363,9 @@ var effectLog = createLogger("almadar:runtime:effects");
363
363
  var busLog = createLogger("almadar:runtime:bus");
364
364
  var renderLog = createLogger("almadar:runtime:render-ui");
365
365
  var xOrbitalLog = createLogger("almadar:runtime:cross-orbital");
366
+ function isNodeEnv() {
367
+ return typeof process !== "undefined" && Boolean(process.versions?.node);
368
+ }
366
369
  function collectDeclaredConfigDefaults(trait) {
367
370
  if (!trait) return void 0;
368
371
  const schema = trait.config;
@@ -441,12 +444,13 @@ var OrbitalServerRuntime = class {
441
444
  } else {
442
445
  this.persistence = config.persistence || new InMemoryPersistence();
443
446
  }
444
- if (config.localStorageRoot) {
447
+ if (config.localStorageRoot && isNodeEnv()) {
445
448
  this.localPersistence = new LocalPersistenceAdapter(config.localStorageRoot);
446
449
  }
447
- this.osHandlers = createOsHandlers({
450
+ this.osHandlers = isNodeEnv() ? createOsHandlers({
448
451
  emitEvent: (type, payload) => this.eventBus.emit(type, payload)
449
- });
452
+ }) : { handlers: {}, cleanup: () => {
453
+ } };
450
454
  this.config.effectHandlers = {
451
455
  ...this.osHandlers.handlers,
452
456
  ...this.config.effectHandlers
@@ -1934,6 +1938,11 @@ var OrbitalServerRuntime = class {
1934
1938
  * - POST /:orbital/events - Send event to orbital (includes data from `fetch` effects)
1935
1939
  */
1936
1940
  router() {
1941
+ if (!isNodeEnv()) {
1942
+ throw new Error(
1943
+ "OrbitalServerRuntime.router() is Node-only (uses Express). For in-browser use, mount <BrowserPlayground> from @almadar/ui instead."
1944
+ );
1945
+ }
1937
1946
  const router = Router();
1938
1947
  router.get("/", (_req, res) => {
1939
1948
  const orbitals = Array.from(this.orbitals.entries()).map(