@memori.ai/memori-react 8.40.0 → 8.40.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.
@@ -43,7 +43,7 @@ DefaultLayout.args = {
43
43
  uiLang: 'IT',
44
44
  spokenLang: 'IT',
45
45
  integrationID: '0b1256c1-530c-4e67-aef8-36667c8887bb',
46
- autoStart: false,
46
+ autoStart: true,
47
47
  sessionID: '' as string | undefined,
48
48
  showUpload: true,
49
49
  showReasoning: false,
@@ -70,6 +70,26 @@ function readNumber(
70
70
  return typeof value === 'number' ? value : undefined;
71
71
  }
72
72
 
73
+ /**
74
+ * Unwraps the `currentState` of a `dialog_text_entered_response`.
75
+ *
76
+ * The async (NATS) response wraps the dialog state one level deeper than the
77
+ * synchronous HTTP response: `currentState` is a `ResponseSpec` that *contains*
78
+ * the actual `DialogState` under a nested `currentState` key. We unwrap it so
79
+ * downstream consumers always receive the `DialogState` directly, while still
80
+ * accepting the already-flat shape for backward compatibility.
81
+ */
82
+ function unwrapDialogState(value: unknown): unknown {
83
+ if (
84
+ value &&
85
+ typeof value === 'object' &&
86
+ 'currentState' in (value as Record<string, unknown>)
87
+ ) {
88
+ return (value as Record<string, unknown>).currentState;
89
+ }
90
+ return value;
91
+ }
92
+
73
93
  /**
74
94
  * Normalizes raw NATS payloads (snake_case or camelCase) into typed events.
75
95
  */
@@ -102,7 +122,7 @@ export function normalizeNatsEvent(raw: Record<string, unknown>): NatsSessionEve
102
122
  typeof raw.resultCode === 'number' ? raw.resultCode : undefined,
103
123
  resultMessage:
104
124
  typeof raw.resultMessage === 'string' ? raw.resultMessage : undefined,
105
- currentState: raw.currentState,
125
+ currentState: unwrapDialogState(raw.currentState),
106
126
  correlationID,
107
127
  };
108
128
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
- export const version = '8.40.0';
2
+ export const version = '8.40.2';