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.
- package/lib/runtime/runtime.js +5 -4
- package/package.json +1 -1
package/lib/runtime/runtime.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
19
|
+
return globalThis[RUNTIME_KEY];
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export function setCurrentRuntime(runtime) {
|
|
22
|
-
|
|
23
|
+
globalThis[RUNTIME_KEY] = runtime;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export function clearCurrentRuntime() {
|
|
26
|
-
|
|
27
|
+
globalThis[RUNTIME_KEY] = null;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
/**
|