agent-state-machine 1.0.0 → 1.0.2

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.
@@ -12,18 +12,19 @@ import readline from 'readline';
12
12
  import { createMemoryProxy } from './memory.js';
13
13
 
14
14
  // Global runtime reference for agent() and memory access
15
- let currentRuntime = null;
15
+ // stored on globalThis to ensure singleton access across different module instances (CLI vs local)
16
+ const RUNTIME_KEY = Symbol.for('agent-state-machine.runtime');
16
17
 
17
18
  export function getCurrentRuntime() {
18
- return currentRuntime;
19
+ return globalThis[RUNTIME_KEY];
19
20
  }
20
21
 
21
22
  export function setCurrentRuntime(runtime) {
22
- currentRuntime = runtime;
23
+ globalThis[RUNTIME_KEY] = runtime;
23
24
  }
24
25
 
25
26
  export function clearCurrentRuntime() {
26
- currentRuntime = null;
27
+ globalThis[RUNTIME_KEY] = null;
27
28
  }
28
29
 
29
30
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-state-machine",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "description": "A workflow orchestrator for running agents and scripts in sequence with state management",
6
6
  "main": "lib/index.js",