@novoagents/react 0.2.0-alpha.0 → 0.2.0-alpha.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0-alpha.1 - 2026-07-14
4
+
5
+ - `useNovoRun` normalizes `enabled` and `runKey` before its dependency arrays,
6
+ so identity toggles (`enabled: undefined <-> true`, `runKey: undefined <->
7
+ null`) no longer dispose and recreate a live controller.
8
+ - Picks up `novoagents` 0.4.0-alpha.1 controller fixes: fatal (non-retried)
9
+ initial-connect errors, per-drop `transportError` publication, a final
10
+ `disposed` snapshot published before listeners detach, and interaction-race
11
+ hardening.
12
+
3
13
  ## 0.2.0-alpha.0 - 2026-07-14
4
14
 
5
15
  - Replaced the alpha store/transport hooks with effect-owned bindings over the
@@ -54,34 +54,38 @@ export function useNovoRun(options) {
54
54
  slotRef.current ??= createControllerSlot();
55
55
  const slot = slotRef.current;
56
56
  const ownedRunKeyRef = useRef(UNOWNED_RUN_KEY);
57
+ // Normalize before any dependency array: `enabled: undefined <-> true` and
58
+ // `runKey: undefined <-> null` toggles are identity changes and must not
59
+ // dispose and recreate a live controller.
60
+ const enabled = options.enabled !== false;
61
+ const runKey = options.runKey ?? null;
57
62
  useEffect(() => {
58
- if (options.enabled === false) {
63
+ if (!enabled) {
59
64
  slot.setController(undefined);
60
65
  return;
61
66
  }
62
67
  const controller = factoryRef.current();
63
- ownedRunKeyRef.current = options.runKey ?? null;
68
+ ownedRunKeyRef.current = runKey;
64
69
  slot.setController(controller);
65
70
  return () => {
66
71
  controller.stop();
67
72
  controller.dispose();
68
- if (ownedRunKeyRef.current === (options.runKey ?? null)) {
73
+ if (ownedRunKeyRef.current === runKey) {
69
74
  ownedRunKeyRef.current = UNOWNED_RUN_KEY;
70
75
  }
71
76
  if (slot.getController() === controller)
72
77
  slot.setController(undefined);
73
78
  };
74
- }, [options.enabled, options.runKey, slot]);
79
+ }, [enabled, runKey, slot]);
75
80
  useEffect(() => {
76
- if (options.enabled !== false &&
81
+ if (enabled &&
77
82
  options.autoStart !== false &&
78
- ownedRunKeyRef.current === (options.runKey ?? null)) {
83
+ ownedRunKeyRef.current === runKey) {
79
84
  void slot.getController()?.start();
80
85
  }
81
- }, [options.autoStart, options.enabled, options.runKey, slot]);
86
+ }, [options.autoStart, enabled, runKey, slot]);
82
87
  const observedState = useSyncExternalStore(slot.subscribe, slot.getSnapshot, () => NOVO_IDLE_RUN_STATE);
83
- const ownsRenderedKey = options.enabled !== false &&
84
- ownedRunKeyRef.current === (options.runKey ?? null);
88
+ const ownsRenderedKey = enabled && ownedRunKeyRef.current === runKey;
85
89
  const state = ownsRenderedKey
86
90
  ? observedState
87
91
  : NOVO_IDLE_RUN_STATE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novoagents/react",
3
- "version": "0.2.0-alpha.0",
3
+ "version": "0.2.0-alpha.1",
4
4
  "description": "Browser-safe React hooks for Novo Agents streams and interactions.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -23,7 +23,7 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "novoagents": "0.4.0-alpha.0"
26
+ "novoagents": "0.4.0-alpha.1"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": "^18.0.0 || ^19.0.0"