ei-tui 1.7.0 → 1.8.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.
@@ -1,5 +1,6 @@
1
1
  import type { PromptOutput, ParticipantContext } from "./types.js";
2
2
  import type { Person, Message } from "../../core/types.js";
3
+ import type { PersonIdentifier } from "../../core/types/data-items.js";
3
4
  import { formatMessagesAsPlaceholders } from "../message-utils.js";
4
5
 
5
6
  export interface PersonUpdatePromptData {
@@ -12,6 +13,7 @@ export interface PersonUpdatePromptData {
12
13
  persona_name: string;
13
14
  participant_context?: ParticipantContext;
14
15
  known_identifier_types?: string[];
16
+ suggested_identifiers?: PersonIdentifier[];
15
17
  }
16
18
 
17
19
  function participantContextSection(ctx: ParticipantContext | undefined): string {
@@ -171,20 +173,29 @@ The description should NOT:
171
173
  ? `CRITICAL: The HUMAN USER is ${humanName}. They wrote these messages. Do NOT assign their names, nicknames, or handles as identifiers for this person's record — UNLESS this IS the user's own Self record (relationship: "Self").`
172
174
  : `CRITICAL: The HUMAN USER wrote these messages. Do NOT assign their own names or handles as identifiers for this person's record — UNLESS this IS the user's own Self record (relationship: "Self"). Do NOT return \`relationship: "Self"\` unless you are certain this record is about the human user themselves.`;
173
175
 
176
+ const attributionGuard = `\nONLY add an identifier if it is explicitly stated about THIS SPECIFIC PERSON — not inferred from proximity in the conversation. If two different people are discussed near each other, do NOT attribute one person's handle, email, or name to the other.`;
174
177
  const isUnknownNewPerson = isNewItem && personName === 'Unknown';
175
178
  const unknownIdentifierGuard = isUnknownNewPerson
176
- ? `\nThis person's name is not yet known. ONLY add \`identifiers\` if their name, handle, or email is explicitly stated in the conversation about THEM specifically — not inferred, not guessed.`
179
+ ? `\nThis person's name is not yet known be especially careful: only record an identifier the conversation names for THEM specifically.`
177
180
  : '';
178
181
 
179
- const identifierSection = `${identityGuard}${unknownIdentifierGuard}
182
+ const suggestedIdentifiers = data.suggested_identifiers ?? [];
183
+ const suggestedIdentifiersBlock = !isNewItem && suggestedIdentifiers.length > 0
184
+ ? `\n\nThe scan flagged these identifiers as POSSIBLY belonging to this person: ${suggestedIdentifiers.map(i => `\`${i.type}=${i.value}\``).join(', ')}.
185
+ For EACH, add it to \`identifiers_to_add\` ONLY if the Most Recent Messages confirm it belongs to THIS SPECIFIC PERSON. If any actually belongs to someone else mentioned in the conversation, omit it. Do not add any you cannot confirm from the conversation.`
186
+ : '';
187
+
188
+ const identifierSection = `${identityGuard}${attributionGuard}${unknownIdentifierGuard}
180
189
 
181
190
  If you spot a platform handle, username, email, nickname, or full name explicitly mentioned in the conversation that isn't already in the person's identifiers, include it in \`identifiers_to_add\` (updates) or \`identifiers\` (new records). Always mark exactly one identifier as \`"is_primary": true\` — prefer the most formal or complete name.
182
191
 
192
+ Example of what NOT to do: if the conversation says "I talked to Priya and Marcus — Marcus's GitHub is @mcodes", do NOT add @mcodes to Priya's record; it belongs to Marcus only.
193
+
183
194
  For persons with a known relationship (Father, Mother, Sibling, etc.), also look for informal terms the HUMAN USER uses to address or refer to THAT SPECIFIC PERSON (\`Dad\`, \`Pop\`, \`Mom\`, \`Sis\`, etc.) and add them as \`{ "type": "Relationship", "value": "..." }\` identifiers.
184
195
 
185
196
  NEVER add dates, ages, birthdays, or anniversaries as identifiers. These are not identifying labels — if known, include them in the description instead.
186
197
 
187
- Known identifier types: ${allTypes}. If unsure of type, use \`Nickname\`.`;
198
+ Known identifier types: ${allTypes}. If unsure of type, use \`Nickname\`.${suggestedIdentifiersBlock}`;
188
199
 
189
200
  // ── OUTPUT FORMAT ─────────────────────────────────────────────────────────
190
201