@letta-ai/letta-code 0.6.3 → 0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letta-ai/letta-code",
3
- "version": "0.6.3",
3
+ "version": "0.7.0",
4
4
  "description": "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,12 +1,17 @@
1
- import { useEffect } from 'react';
1
+ import { useEffect, useRef } from 'react';
2
2
  import parseKeypress, { nonAlphanumericKeys } from '../parse-keypress.js';
3
3
  import reconciler from '../reconciler.js';
4
4
  import useStdin from './use-stdin.js';
5
5
 
6
6
  // Patched for bracketed paste: propagate "isPasted" and avoid leaking ESC sequences
7
+ // Also patched to use ref for inputHandler to avoid effect churn with inline handlers
7
8
  const useInput = (inputHandler, options = {}) => {
8
9
  const { stdin, setRawMode, internal_exitOnCtrlC, internal_eventEmitter } = useStdin();
9
10
 
11
+ // Store handler in ref to avoid re-subscribing when handler identity changes
12
+ const handlerRef = useRef(inputHandler);
13
+ handlerRef.current = inputHandler;
14
+
10
15
  useEffect(() => {
11
16
  if (options.isActive === false) {
12
17
  return;
@@ -43,7 +48,7 @@ const useInput = (inputHandler, options = {}) => {
43
48
  isPasted: true
44
49
  };
45
50
  reconciler.batchedUpdates(() => {
46
- inputHandler(data.sequence || data.raw || '', key);
51
+ handlerRef.current(data.sequence || data.raw || '', key);
47
52
  });
48
53
  return;
49
54
  }
@@ -84,7 +89,7 @@ const useInput = (inputHandler, options = {}) => {
84
89
 
85
90
  if (!(input === 'c' && key.ctrl) || !internal_exitOnCtrlC) {
86
91
  reconciler.batchedUpdates(() => {
87
- inputHandler(input, key);
92
+ handlerRef.current(input, key);
88
93
  });
89
94
  }
90
95
  };
@@ -93,7 +98,7 @@ const useInput = (inputHandler, options = {}) => {
93
98
  return () => {
94
99
  internal_eventEmitter?.removeListener('input', handleData);
95
100
  };
96
- }, [options.isActive, stdin, internal_exitOnCtrlC, inputHandler]);
101
+ }, [options.isActive, stdin, internal_exitOnCtrlC]);
97
102
  };
98
103
 
99
104
  export default useInput;