ei-tui 0.6.1 → 0.6.3

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": "ei-tui",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "author": "Flare576",
5
5
  "repository": {
6
6
  "type": "git",
@@ -123,9 +123,9 @@ export async function handleFactFind(response: LLMResponse, state: StateManager)
123
123
  continue;
124
124
  }
125
125
 
126
- // Skip if the LLM returned a null/empty value — don't store null descriptions
127
- if (!factResult.value) {
128
- console.log(`[handleFactFind] Skipping fact with null/empty value: "${factResult.name}"`);
126
+ // Skip if the LLM returned a null/empty/non-string value — don't store booleans or nulls
127
+ if (!factResult.value || typeof factResult.value !== 'string') {
128
+ console.log(`[handleFactFind] Skipping fact with null/empty/non-string value: "${factResult.name}" (got ${typeof factResult.value})`);
129
129
  continue;
130
130
  }
131
131
 
@@ -122,6 +122,7 @@ export async function handleTopicUpdate(response: LLMResponse, state: StateManag
122
122
  const personaDisplayName = response.request.data.personaDisplayName as string;
123
123
  const roomId = response.request.data.roomId as string | undefined;
124
124
  const candidateCategory = response.request.data.candidateCategory as string | undefined;
125
+ const candidateName = response.request.data.candidateName as string | undefined;
125
126
 
126
127
  const personaIds = personaId.split("|").filter(Boolean);
127
128
  const primaryId = personaIds[0] ?? personaId;
@@ -143,7 +144,7 @@ export async function handleTopicUpdate(response: LLMResponse, state: StateManag
143
144
 
144
145
  const existingTopic = isNewItem ? undefined : human.topics.find(t => t.id === existingItemId);
145
146
 
146
- const resolvedName = result.name || existingTopic?.name;
147
+ const resolvedName = result.name || existingTopic?.name || candidateName;
147
148
  const resolvedDescription = typeof result.description === 'string' ? result.description : existingTopic?.description;
148
149
 
149
150
  if (!resolvedName || !resolvedDescription || result.sentiment === undefined) {
@@ -215,10 +216,6 @@ export async function handlePersonUpdate(response: LLMResponse, state: StateMana
215
216
  const candidateRelationship = response.request.data.candidateRelationship as string | undefined;
216
217
  const candidateIdentifiers = (response.request.data.candidateIdentifiers ?? []) as PersonIdentifier[];
217
218
 
218
- if (!result.description || result.sentiment === undefined) {
219
- throw new Error(`[handlePersonUpdate] Missing required fields: description=${!!result.description}, sentiment=${result.sentiment}`);
220
- }
221
-
222
219
  const candidateName = response.request.data.candidateName as string;
223
220
  const personaIds = personaId.split("|").filter(Boolean);
224
221
  const primaryId = personaIds[0] ?? personaId;
@@ -240,11 +237,18 @@ export async function handlePersonUpdate(response: LLMResponse, state: StateMana
240
237
 
241
238
  const existingPerson = isNewItem ? undefined : human.people.find(p => p.id === existingItemId);
242
239
 
240
+ const resolvedDescription = typeof result.description === 'string' ? result.description : existingPerson?.description;
241
+ const resolvedSentiment = result.sentiment !== undefined ? result.sentiment : existingPerson?.sentiment;
242
+
243
+ if (!resolvedDescription || resolvedSentiment === undefined) {
244
+ throw new Error(`[handlePersonUpdate] Missing required fields: description=${!!resolvedDescription}, sentiment=${resolvedSentiment}`);
245
+ }
246
+
243
247
  let embedding: number[] | undefined;
244
248
  try {
245
249
  const embeddingService = getEmbeddingService();
246
250
  const relationship = result.relationship ?? candidateRelationship ?? existingPerson?.relationship;
247
- const text = getPersonEmbeddingText({ name: candidateName, relationship, description: result.description });
251
+ const text = getPersonEmbeddingText({ name: candidateName, relationship, description: resolvedDescription });
248
252
  embedding = await embeddingService.embed(text);
249
253
  } catch (err) {
250
254
  console.warn(`[handlePersonUpdate] Failed to compute embedding for person "${candidateName}":`, err);
@@ -294,8 +298,8 @@ export async function handlePersonUpdate(response: LLMResponse, state: StateMana
294
298
  const person: Person = {
295
299
  id: itemId,
296
300
  name: candidateName,
297
- description: result.description,
298
- sentiment: result.sentiment,
301
+ description: resolvedDescription,
302
+ sentiment: resolvedSentiment,
299
303
  relationship: result.relationship ?? candidateRelationship ?? existingPerson?.relationship ?? "Unknown",
300
304
  exposure_current: calculateExposureCurrent(exposureImpact, existingPerson?.exposure_current ?? 0),
301
305
  exposure_desired: result.exposure_desired ?? 0.5,
@@ -422,6 +422,7 @@ export function queueTopicUpdate(
422
422
  roomId: context.roomId,
423
423
  isNewItem,
424
424
  existingItemId: existingItem?.id,
425
+ candidateName: isNewItem ? context.candidateName : undefined,
425
426
  candidateCategory: context.candidateCategory,
426
427
  analyze_from_timestamp: getAnalyzeFromTimestamp(chunk),
427
428
  },