@molroo-io/sdk 0.8.4 → 0.9.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.
Files changed (73) hide show
  1. package/dist/cjs/errors.d.ts +1 -1
  2. package/dist/cjs/errors.d.ts.map +1 -1
  3. package/dist/cjs/errors.js +2 -1
  4. package/dist/cjs/events/types.d.ts +1 -1
  5. package/dist/cjs/events/types.d.ts.map +1 -1
  6. package/dist/cjs/index.d.ts +4 -2
  7. package/dist/cjs/index.d.ts.map +1 -1
  8. package/dist/cjs/index.js +5 -1
  9. package/dist/cjs/llm/resolve.d.ts.map +1 -1
  10. package/dist/cjs/llm/resolve.js +2 -1
  11. package/dist/cjs/llm/schema.d.ts +0 -114
  12. package/dist/cjs/llm/schema.d.ts.map +1 -1
  13. package/dist/cjs/llm/schema.js +1 -44
  14. package/dist/cjs/persona/chat-orchestrator.d.ts +18 -3
  15. package/dist/cjs/persona/chat-orchestrator.d.ts.map +1 -1
  16. package/dist/cjs/persona/chat-orchestrator.js +29 -109
  17. package/dist/cjs/persona/conversation.d.ts +84 -0
  18. package/dist/cjs/persona/conversation.d.ts.map +1 -0
  19. package/dist/cjs/persona/conversation.js +72 -0
  20. package/dist/cjs/persona/memory-pipeline.d.ts.map +1 -1
  21. package/dist/cjs/persona/memory-pipeline.js +30 -4
  22. package/dist/cjs/persona.d.ts +441 -22
  23. package/dist/cjs/persona.d.ts.map +1 -1
  24. package/dist/cjs/persona.js +418 -6
  25. package/dist/cjs/shared/errors.d.ts +32 -2
  26. package/dist/cjs/shared/errors.d.ts.map +1 -1
  27. package/dist/cjs/shared/errors.js +33 -2
  28. package/dist/cjs/types.d.ts +70 -5
  29. package/dist/cjs/types.d.ts.map +1 -1
  30. package/dist/cjs/types.js +2 -1
  31. package/dist/cjs/world/world-persona.d.ts +20 -5
  32. package/dist/cjs/world/world-persona.d.ts.map +1 -1
  33. package/dist/cjs/world/world-persona.js +21 -5
  34. package/dist/cjs/world/world.d.ts +28 -5
  35. package/dist/cjs/world/world.d.ts.map +1 -1
  36. package/dist/cjs/world/world.js +29 -3
  37. package/dist/esm/errors.d.ts +1 -1
  38. package/dist/esm/errors.d.ts.map +1 -1
  39. package/dist/esm/errors.js +1 -1
  40. package/dist/esm/events/types.d.ts +1 -1
  41. package/dist/esm/events/types.d.ts.map +1 -1
  42. package/dist/esm/index.d.ts +4 -2
  43. package/dist/esm/index.d.ts.map +1 -1
  44. package/dist/esm/index.js +3 -1
  45. package/dist/esm/llm/resolve.d.ts.map +1 -1
  46. package/dist/esm/llm/resolve.js +2 -1
  47. package/dist/esm/llm/schema.d.ts +0 -114
  48. package/dist/esm/llm/schema.d.ts.map +1 -1
  49. package/dist/esm/llm/schema.js +0 -43
  50. package/dist/esm/persona/chat-orchestrator.d.ts +18 -3
  51. package/dist/esm/persona/chat-orchestrator.d.ts.map +1 -1
  52. package/dist/esm/persona/chat-orchestrator.js +29 -109
  53. package/dist/esm/persona/conversation.d.ts +84 -0
  54. package/dist/esm/persona/conversation.d.ts.map +1 -0
  55. package/dist/esm/persona/conversation.js +68 -0
  56. package/dist/esm/persona/memory-pipeline.d.ts.map +1 -1
  57. package/dist/esm/persona/memory-pipeline.js +30 -4
  58. package/dist/esm/persona.d.ts +441 -22
  59. package/dist/esm/persona.d.ts.map +1 -1
  60. package/dist/esm/persona.js +418 -7
  61. package/dist/esm/shared/errors.d.ts +32 -2
  62. package/dist/esm/shared/errors.d.ts.map +1 -1
  63. package/dist/esm/shared/errors.js +32 -1
  64. package/dist/esm/types.d.ts +70 -5
  65. package/dist/esm/types.d.ts.map +1 -1
  66. package/dist/esm/types.js +1 -1
  67. package/dist/esm/world/world-persona.d.ts +20 -5
  68. package/dist/esm/world/world-persona.d.ts.map +1 -1
  69. package/dist/esm/world/world-persona.js +21 -5
  70. package/dist/esm/world/world.d.ts +28 -5
  71. package/dist/esm/world/world.d.ts.map +1 -1
  72. package/dist/esm/world/world.js +29 -3
  73. package/package.json +1 -1
@@ -2,7 +2,9 @@ import type { LLMAdapter, Message } from './llm/adapter';
2
2
  import { type LLMInput } from './llm/resolve';
3
3
  import type { MemoryAdapter, RecallLimits } from './memory/types';
4
4
  import type { EventAdapter } from './events/types';
5
- import type { AgentResponse, AppraisalMode, AppraisalVector, InterlocutorContext, PersonaSnapshot, PersonaConfigData, PerceiveOptions } from './types';
5
+ import type { AgentResponse, AppraisalVector, InterlocutorContext, RelationshipContext, PersonaSnapshot, PersonaConfigData, PerceiveOptions, PersonaIdentity } from './types';
6
+ import type { StyleProfile } from './expression';
7
+ import { Conversation, type ConversationOptions } from './persona/conversation';
6
8
  /** Configuration for connecting to a standalone persona instance. */
7
9
  export interface MolrooPersonaConfig {
8
10
  /** Base URL of the molroo API. Defaults to 'https://api.molroo.io'. */
@@ -30,8 +32,6 @@ export interface MolrooPersonaConfig {
30
32
  * memory_consolidated, reflection_generated, etc.).
31
33
  */
32
34
  events?: EventAdapter;
33
- /** Appraisal generation mode for `chat()`. Defaults to `direct`. */
34
- appraisalMode?: AppraisalMode;
35
35
  }
36
36
  /** Summary of a persona instance, returned by list operations. */
37
37
  export interface PersonaSummary {
@@ -41,37 +41,140 @@ export interface PersonaSummary {
41
41
  engineVersion: string;
42
42
  createdAt: number;
43
43
  }
44
- /** Current emotional and psychological state of a persona. */
44
+ /**
45
+ * Current emotional and psychological state of a persona, as returned by {@link MolrooPersona.getState}.
46
+ *
47
+ * This is the primary data structure apps use to assemble system prompts without relying on
48
+ * `chat()`. All subsystems computed by the emotion engine are included here.
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * const state = await persona.getState();
53
+ *
54
+ * // Build your own system prompt
55
+ * const systemPrompt = [
56
+ * `You are ${myPersonaName}.`,
57
+ * `Current emotion: ${state.emotion.discrete?.primary} (intensity ${state.emotion.discrete?.intensity.toFixed(2)})`,
58
+ * state.mood ? `Mood: V=${state.mood.V.toFixed(2)} A=${state.mood.A.toFixed(2)}` : '',
59
+ * state.selfEsteem ? `Self-esteem: ${state.selfEsteem.global.toFixed(2)}` : '',
60
+ * ].filter(Boolean).join('\n');
61
+ *
62
+ * const { text } = await myLLM.generate({ system: systemPrompt, messages });
63
+ * await persona.hear(lastUserMessage);
64
+ * ```
65
+ */
45
66
  export interface PersonaState {
46
- /** Current emotion in VAD (Valence-Arousal-Dominance) space with discrete label. */
67
+ /**
68
+ * Current emotion in VAD (Valence-Arousal-Dominance) space with discrete label.
69
+ * Use this to communicate the persona's felt emotional tone to the LLM.
70
+ * - `vad.V`: Valence (−1 = negative, +1 = positive)
71
+ * - `vad.A`: Arousal (0 = calm, 1 = activated)
72
+ * - `vad.D`: Dominance (0 = submissive, 1 = dominant)
73
+ * - `discrete.primary`: Named emotion label (e.g. "joy", "anger", "sadness")
74
+ */
47
75
  emotion: {
48
76
  vad: {
49
77
  V: number;
50
78
  A: number;
51
79
  D: number;
52
80
  };
53
- discrete?: {
81
+ discrete: {
54
82
  primary: string;
55
83
  secondary?: string;
56
84
  intensity: number;
57
85
  };
58
86
  };
59
- /** Background mood (slower-changing than emotion). */
60
- mood?: {
61
- vad: {
62
- V: number;
63
- A: number;
64
- D: number;
87
+ /**
88
+ * Soul stage — the persona's current developmental/personality phase.
89
+ * Governs the blending ratio between rational and irrational response styles.
90
+ * Include in prompts to modulate how impulsive or deliberate the persona acts.
91
+ */
92
+ soulStage: {
93
+ id: number;
94
+ name: string;
95
+ blendTable: {
96
+ rational: number;
97
+ irrational: number;
65
98
  };
99
+ turnsInStage: number;
66
100
  };
67
- /** Active somatic (body) sensations. */
68
- somatic?: string[];
69
- /** Narrative self-perception (tone, agency, coherence). */
101
+ /**
102
+ * Persona mask — the gap between true emotion and presented face.
103
+ * - `integrity`: 0 (mask fully intact) to 1 (mask broken, raw emotion exposed)
104
+ * - `state`: "stable" | "cracking" | "broken"
105
+ * Low integrity indicates emotional leakage — the persona may show truer feelings.
106
+ */
107
+ mask: {
108
+ integrity: number;
109
+ state: string;
110
+ };
111
+ /**
112
+ * Background mood — slower-changing than emotion, sets the ambient emotional color.
113
+ * VAD values directly (not nested): `{ V, A, D }`.
114
+ * Useful for setting a sustained tone across a conversation (e.g., melancholy all day).
115
+ */
116
+ mood?: {
117
+ V: number;
118
+ A: number;
119
+ D: number;
120
+ };
121
+ /**
122
+ * Active somatic (body) sensations as intensity values.
123
+ * Keys are sensation names (e.g. "chest_tightness", "warmth"), values are 0–1 intensities.
124
+ * Use this to add embodied, physical descriptions to the persona's responses.
125
+ */
126
+ somatic?: {
127
+ [key: string]: number;
128
+ };
129
+ /**
130
+ * Narrative self-perception — how the persona understands their own story.
131
+ * - `tone`: −1 (tragic) to +1 (hopeful)
132
+ * - `agency`: 0 (helpless) to 1 (in control)
133
+ * - `coherence`: 0 (fragmented) to 1 (integrated)
134
+ * High agency + high tone = optimistic protagonist. Low agency + low tone = victim narrative.
135
+ */
70
136
  narrative?: {
71
137
  tone: number;
72
138
  agency: number;
73
139
  coherence: number;
74
140
  };
141
+ /**
142
+ * Active emotion regulation strategy.
143
+ * `null` if the persona is not actively regulating.
144
+ * Include to let the LLM know whether the persona is suppressing, reappraising, etc.
145
+ */
146
+ regulation?: {
147
+ activeStrategy: string | null;
148
+ };
149
+ /**
150
+ * Global self-esteem level (0–1).
151
+ * Low self-esteem shapes how the persona responds to praise, criticism, and challenges.
152
+ */
153
+ selfEsteem?: {
154
+ global: number;
155
+ };
156
+ /**
157
+ * Terror Management Theory (TMT) state — existential anxiety subsystem.
158
+ * - `mortalitySalience`: how front-of-mind death awareness is (0–1)
159
+ * - `deathAnxiety`: underlying anxiety level (0–1)
160
+ * - `defenseMode`: "proximal" (denial) | "distal" (worldview defense) | "none"
161
+ */
162
+ tmt?: {
163
+ mortalitySalience: number;
164
+ deathAnxiety: number;
165
+ defenseMode: 'proximal' | 'distal' | 'none';
166
+ };
167
+ /**
168
+ * Relationship state with the current interlocutor.
169
+ * - `trust`: 0–1
170
+ * - `intimacy`: 0–1
171
+ * - `attachmentStyle`: e.g. "secure" | "anxious" | "avoidant"
172
+ */
173
+ relationship?: {
174
+ trust: number;
175
+ intimacy: number;
176
+ attachmentStyle?: string;
177
+ };
75
178
  }
76
179
  /** Result of a persona chat interaction, including LLM text and emotion data. */
77
180
  export interface PersonaChatResult {
@@ -97,12 +200,13 @@ export declare class MolrooPersona {
97
200
  private memoryRecallConfig;
98
201
  private events;
99
202
  private _personaId;
100
- private appraisalMode;
101
203
  constructor(config: MolrooPersonaConfig & {
102
204
  llm?: LLMAdapter;
103
205
  engineLlm?: LLMAdapter;
104
206
  });
207
+ /** Unique persona instance ID. */
105
208
  get id(): string;
209
+ /** @deprecated Use {@link id} instead. */
106
210
  get personaId(): string;
107
211
  /**
108
212
  * Create a new persona from a natural language description.
@@ -124,7 +228,6 @@ export declare class MolrooPersona {
124
228
  memory?: MemoryAdapter;
125
229
  recall?: RecallLimits;
126
230
  events?: EventAdapter;
127
- appraisalMode?: AppraisalMode;
128
231
  }, description: string): Promise<MolrooPersona>;
129
232
  /**
130
233
  * Create a new persona with explicit configuration.
@@ -145,7 +248,6 @@ export declare class MolrooPersona {
145
248
  memory?: MemoryAdapter;
146
249
  recall?: RecallLimits;
147
250
  events?: EventAdapter;
148
- appraisalMode?: AppraisalMode;
149
251
  }, personaConfig: PersonaConfigData): Promise<MolrooPersona>;
150
252
  /**
151
253
  * Internal implementation for creating persona with resolved config.
@@ -164,8 +266,24 @@ export declare class MolrooPersona {
164
266
  memory?: MemoryAdapter;
165
267
  recall?: RecallLimits;
166
268
  events?: EventAdapter;
167
- appraisalMode?: AppraisalMode;
168
269
  }, description: string): Promise<MolrooPersona>;
270
+ /**
271
+ * Connect to an existing persona by ID.
272
+ *
273
+ * @param config - Connection configuration (apiKey required).
274
+ * @param personaId - The persona instance ID to connect to.
275
+ * @returns A connected MolrooPersona instance.
276
+ *
277
+ * @deprecated Use {@link Molroo.connectPersona} instead.
278
+ *
279
+ * @example
280
+ * ```typescript
281
+ * const sera = await MolrooPersona.connect(
282
+ * { apiKey: 'mk_...', llm: openaiAdapter },
283
+ * 'persona_abc123'
284
+ * );
285
+ * ```
286
+ */
169
287
  static connect(config: {
170
288
  baseUrl?: string;
171
289
  apiKey: string;
@@ -174,8 +292,13 @@ export declare class MolrooPersona {
174
292
  memory?: MemoryAdapter;
175
293
  recall?: RecallLimits;
176
294
  events?: EventAdapter;
177
- appraisalMode?: AppraisalMode;
178
295
  }, personaId: string): Promise<MolrooPersona>;
296
+ /**
297
+ * List all personas for the authenticated tenant.
298
+ *
299
+ * @param config - API connection config.
300
+ * @returns Paginated list of persona summaries.
301
+ */
179
302
  static listPersonas(config: {
180
303
  baseUrl?: string;
181
304
  apiKey: string;
@@ -183,23 +306,158 @@ export declare class MolrooPersona {
183
306
  personas: PersonaSummary[];
184
307
  nextCursor?: string;
185
308
  }>;
309
+ /**
310
+ * Send a stimulus to the persona's emotion engine and get the updated emotional response.
311
+ * This is the low-level API — for common cases, prefer {@link hear}, {@link experience}, or {@link chat}.
312
+ *
313
+ * @param message - The stimulus text (user message, event description, etc.).
314
+ * @param options - Appraisal, source, relationship context, and other options.
315
+ * @returns Emotion engine response with VAD, discrete emotion, and side effects.
316
+ */
186
317
  perceive(message: string, options?: PerceiveOptions): Promise<AgentResponse>;
318
+ /**
319
+ * Send a custom event with a required appraisal vector.
320
+ *
321
+ * @param type - Custom event type (e.g., 'gift_received', 'argument').
322
+ * @param description - Human-readable event description.
323
+ * @param options - Must include a pre-computed appraisal vector.
324
+ * @returns Emotion engine response.
325
+ */
187
326
  event(type: string, description: string, options: Omit<PerceiveOptions, 'type'> & {
188
327
  appraisal: AppraisalVector;
189
328
  }): Promise<AgentResponse>;
329
+ /**
330
+ * Register a received message with the emotion engine and update the persona's emotional state.
331
+ *
332
+ * This is the **core API** for the `hear() + getState()` pattern. Apps that build their own
333
+ * LLM prompts should call `hear()` after each user message to keep the emotion engine in sync,
334
+ * then call `getState()` to read updated state for prompt assembly.
335
+ *
336
+ * Use {@link chat} when you want the SDK to handle prompt assembly and LLM orchestration.
337
+ * Use `hear()` + `getState()` when your app owns the LLM call.
338
+ *
339
+ * @param message - The incoming message text (user utterance, narration, etc.).
340
+ * @param from - Who sent the message. A plain string is used as the source entity name.
341
+ * Pass an {@link InterlocutorContext} object for richer context (description, extensions).
342
+ * @returns Emotion engine response with updated VAD, discrete emotion, and any side effects
343
+ * (memory episodes, social updates, stage transitions, etc.).
344
+ *
345
+ * @example Basic hear + getState pattern
346
+ * ```typescript
347
+ * // Step 1: register message with emotion engine
348
+ * await persona.hear('You did a great job today!', 'Alice');
349
+ *
350
+ * // Step 2: read updated psychological state
351
+ * const state = await persona.getState();
352
+ *
353
+ * // Step 3: assemble your own system prompt
354
+ * const systemPrompt = buildPrompt(myPersonaConfig, state);
355
+ * const { text } = await myLLM.generate({ system: systemPrompt, messages });
356
+ * ```
357
+ *
358
+ * @example With structured interlocutor context
359
+ * ```typescript
360
+ * await persona.hear('I need your help', {
361
+ * name: 'Alice',
362
+ * description: 'A regular customer, slightly anxious',
363
+ * extensions: { mood: 'stressed' },
364
+ * });
365
+ * ```
366
+ */
367
+ hear(message: string, from?: string | InterlocutorContext): Promise<AgentResponse>;
368
+ /**
369
+ * Perceive an environmental or narrative event with a pre-computed appraisal.
370
+ *
371
+ * @param description - What happened (e.g., 'The sun set over the ocean').
372
+ * @param appraisal - 9-dimensional Scherer CPM appraisal vector.
373
+ * @returns Emotion engine response.
374
+ *
375
+ * @example
376
+ * ```typescript
377
+ * const response = await persona.experience('Received a surprise gift', {
378
+ * goal_relevance: 0.8, goal_congruence: 0.9, expectedness: 0.2,
379
+ * controllability: 0.5, agency: 0.3, norm_compatibility: 0.8,
380
+ * internal_standards: 0.7, adjustment_potential: 0.6, urgency: 0.3,
381
+ * });
382
+ * ```
383
+ */
384
+ experience(description: string, appraisal: AppraisalVector): Promise<AgentResponse>;
385
+ /**
386
+ * Perceive a social interaction with relationship context for trust/intimacy computation.
387
+ *
388
+ * @param message - The interaction message.
389
+ * @param from - Who the interaction is from.
390
+ * @param relationship - Current relationship state (closeness, trust, familiarity).
391
+ * @returns Emotion engine response including socialUpdates.
392
+ *
393
+ * @example
394
+ * ```typescript
395
+ * const response = await persona.socialize('I missed you!', 'Bob', {
396
+ * closeness: 0.7, trust: 0.8, familiarity: 0.9, type: 'friend',
397
+ * });
398
+ * console.log(response.socialUpdates); // trust/intimacy deltas
399
+ * ```
400
+ */
401
+ socialize(message: string, from: string | InterlocutorContext, relationship: RelationshipContext): Promise<AgentResponse>;
402
+ /**
403
+ * Send a message and get an LLM-generated response with emotion processing.
404
+ * This is the primary method for conversational interactions.
405
+ *
406
+ * The system prompt is assembled server-side via {@link getPromptContext} and includes:
407
+ * identity, behavioral instructions, current psychological state, expression style,
408
+ * and consumerSuffix. Do NOT duplicate these in consumerSuffix.
409
+ *
410
+ * @param message - User message to respond to.
411
+ * @param options - Conversation history, source entity, and app-specific suffix.
412
+ * @returns LLM response text, emotion data, and updated conversation history.
413
+ *
414
+ * @example
415
+ * ```typescript
416
+ * const result = await persona.chat('Tell me about yourself', {
417
+ * from: 'Alice',
418
+ * history: previousMessages,
419
+ * });
420
+ * console.log(result.text); // LLM response
421
+ * console.log(result.response.emotion); // updated VAD
422
+ * ```
423
+ */
190
424
  chat(message: string, options?: {
191
425
  from?: string | InterlocutorContext;
192
426
  history?: Message[];
427
+ /** Free-form app-specific context appended to the system prompt as-is. */
193
428
  consumerSuffix?: string;
429
+ /**
430
+ * Behavioral constraints and absolute rules for this conversation.
431
+ * Examples: "Never break character", "Always respond in Korean".
432
+ */
433
+ consumerRules?: string;
434
+ /**
435
+ * Few-shot example messages that demonstrate the desired style or behavior.
436
+ * Used to guide the LLM's tone and response format.
437
+ */
438
+ consumerExamples?: string;
194
439
  onToolCall?: (call: {
195
440
  name: string;
196
441
  args: Record<string, unknown>;
197
442
  result: unknown;
198
443
  }) => void;
199
444
  }): Promise<PersonaChatResult>;
445
+ /**
446
+ * Advance persona simulation time. Triggers idle decay, body budget recovery,
447
+ * need regression, and timeline advancement.
448
+ *
449
+ * @param seconds - Number of seconds to advance (must be >= 1).
450
+ * @returns Any pending internal events generated by threshold checks.
451
+ */
200
452
  tick(seconds: number): Promise<{
201
453
  pendingEvents?: unknown[];
202
454
  }>;
455
+ /**
456
+ * Override the persona's current emotion to a specific VAD point.
457
+ * Useful for testing or narrative-driven emotion control.
458
+ *
459
+ * @param vad - Partial VAD values to set (V: valence, A: arousal, D: dominance).
460
+ */
203
461
  setEmotion(vad: Partial<{
204
462
  V: number;
205
463
  A: number;
@@ -220,7 +478,14 @@ export declare class MolrooPersona {
220
478
  * Once set, expression constraints (promptText) are automatically
221
479
  * included in getPromptContext() and modulated by current emotion.
222
480
  */
223
- setStyleProfile(profile: Record<string, unknown>): Promise<void>;
481
+ /**
482
+ * Set a StyleProfile for expression-aware prompt generation.
483
+ * Once set, expression constraints are automatically included in
484
+ * {@link getPromptContext} and modulated by current emotion.
485
+ *
486
+ * @param profile - StyleProfile object (lexical, structural, register features, etc.).
487
+ */
488
+ setStyleProfile(profile: StyleProfile): Promise<void>;
224
489
  /**
225
490
  * Extract a StyleProfile from a text corpus and save it to this persona.
226
491
  * Delegates extraction to the API server (keeps expression logic server-side).
@@ -233,20 +498,174 @@ export declare class MolrooPersona {
233
498
  timestamps?: number[];
234
499
  otherMessages?: string[];
235
500
  }): Promise<Record<string, unknown>>;
501
+ /**
502
+ * Fetch the full psychological state of this persona from the emotion engine.
503
+ *
504
+ * Returns all active subsystems: emotion, soul stage, mask, mood, somatic sensations,
505
+ * narrative self-perception, emotion regulation, self-esteem, TMT state, and relationship.
506
+ *
507
+ * This is the primary data source for apps that build their own LLM prompts. Combine with
508
+ * `hear()` to implement the recommended `hear() + getState()` pattern:
509
+ *
510
+ * ```
511
+ * user message → hear() → emotion engine updates state → getState() → build prompt → LLM
512
+ * ```
513
+ *
514
+ * @returns All psychological subsystems as a {@link PersonaState} object.
515
+ *
516
+ * @example Building a custom system prompt
517
+ * ```typescript
518
+ * const state = await persona.getState();
519
+ *
520
+ * const lines: string[] = [
521
+ * `You are ${name}.`,
522
+ * `Emotion: ${state.emotion.discrete.primary} (${state.emotion.discrete.intensity.toFixed(2)})`,
523
+ * ];
524
+ *
525
+ * if (state.mood) {
526
+ * lines.push(`Mood: valence=${state.mood.V.toFixed(2)} arousal=${state.mood.A.toFixed(2)}`);
527
+ * }
528
+ * if (state.narrative) {
529
+ * lines.push(`Narrative: agency=${state.narrative.agency.toFixed(2)} tone=${state.narrative.tone.toFixed(2)}`);
530
+ * }
531
+ * if (state.selfEsteem) {
532
+ * lines.push(`Self-esteem: ${state.selfEsteem.global.toFixed(2)}`);
533
+ * }
534
+ * if (state.tmt && state.tmt.mortalitySalience > 0.5) {
535
+ * lines.push(`Existential tension is high. Defense mode: ${state.tmt.defenseMode}`);
536
+ * }
537
+ *
538
+ * const systemPrompt = lines.join('\n');
539
+ * ```
540
+ */
236
541
  getState(): Promise<PersonaState>;
542
+ /**
543
+ * Fetch this persona's identity config (identity, personality, goals).
544
+ *
545
+ * Returns a {@link PersonaIdentity} suitable for passing to {@link buildPrompt}
546
+ * when assembling system prompts entirely client-side.
547
+ */
548
+ getIdentity(): Promise<PersonaIdentity>;
549
+ /**
550
+ * Get a full snapshot of the persona (config + engine state).
551
+ * Useful for backup, migration, or debugging.
552
+ *
553
+ * @returns Full persona snapshot including config and internal state.
554
+ */
237
555
  getSnapshot(): Promise<PersonaSnapshot>;
556
+ /**
557
+ * Restore a persona from a snapshot. Overwrites current state entirely.
558
+ *
559
+ * @param snapshot - Full persona snapshot to restore.
560
+ */
238
561
  putSnapshot(snapshot: PersonaSnapshot): Promise<void>;
562
+ /**
563
+ * Partially update persona configuration (identity, personality, goals, etc.).
564
+ *
565
+ * @param updates - Fields to update. Only provided fields are changed.
566
+ */
239
567
  patch(updates: {
240
568
  config?: PersonaConfigData;
241
569
  }): Promise<void>;
570
+ /**
571
+ * Soft-delete this persona. Can be restored within retention period via {@link restore}.
572
+ */
242
573
  destroy(): Promise<void>;
574
+ /** Restore a soft-deleted persona. */
243
575
  restore(): Promise<void>;
244
- getPromptContext(consumerSuffix?: string, sourceEntity?: string): Promise<{
576
+ /**
577
+ * Fetch the server-assembled system prompt for this persona.
578
+ *
579
+ * The server builds a complete system prompt from the persona's live state. It includes:
580
+ * 1. **Identity** — name, role, core values, speaking style, description
581
+ * 2. **Behavioral instructions** — stay in character, embody state, match language
582
+ * 3. **Psychological state** — emotion, mood, somatic, narrative, goals (from live engine)
583
+ * 4. **Expression constraints** — message length, formality, patterns (only if StyleProfile set)
584
+ * 5. **consumerRules** — behavioral constraints and absolute rules (e.g., "Never break character")
585
+ * 6. **consumerExamples** — few-shot example messages for style/behavior reference
586
+ * 7. **consumerSuffix** — your app-specific context, appended last
587
+ *
588
+ * This is a **middle-tier API** — between the low-level `getState()` (raw data) and the
589
+ * high-level `chat()` (full orchestration). Use it when you want to drive the LLM yourself
590
+ * but still benefit from server-side prompt assembly.
591
+ *
592
+ * Called automatically by {@link chat}. Call directly when:
593
+ * - You use a custom LLM framework not supported by the SDK
594
+ * - You need to inspect or transform the system prompt before sending
595
+ * - You need prompt + state in a single round-trip (avoids a separate `getState()` call)
596
+ *
597
+ * **Do NOT** include identity, personality, or emotion in `consumerSuffix` — those are
598
+ * already present. Duplicating them wastes tokens and may confuse the LLM.
599
+ *
600
+ * @param options - Prompt context options.
601
+ * @param options.consumerSuffix - Free-form app-specific context appended to the system prompt as-is.
602
+ * Examples: scene description, available actions, current quest objective.
603
+ * @param options.consumerRules - Behavioral constraints and absolute rules.
604
+ * Examples: "Never break character", "Always respond in Korean", "Do not discuss competitors".
605
+ * @param options.consumerExamples - Few-shot example messages for style/behavior reference.
606
+ * Helps the LLM match a specific tone or response format.
607
+ * @param options.sourceEntity - Name of the conversation partner for interlocutor-aware rendering.
608
+ * @returns `systemPrompt` (ready to pass to LLM), `personaPrompt` (structured breakdown),
609
+ * and optional `tools` (if the persona has tools configured).
610
+ *
611
+ * @example Custom LLM call with server-assembled prompt
612
+ * ```typescript
613
+ * const { systemPrompt } = await persona.getPromptContext({
614
+ * consumerSuffix: 'Available actions: [flee, fight, negotiate]',
615
+ * consumerRules: 'Always respond in English. Never break character.',
616
+ * sourceEntity: 'Alice',
617
+ * });
618
+ * const response = await myLLM.complete({ system: systemPrompt, messages });
619
+ * await persona.hear(userMessage, 'Alice');
620
+ * ```
621
+ */
622
+ getPromptContext(options?: {
623
+ consumerSuffix?: string;
624
+ consumerRules?: string;
625
+ consumerExamples?: string;
626
+ sourceEntity?: string;
627
+ }): Promise<{
245
628
  systemPrompt: string;
246
629
  personaPrompt: Record<string, unknown>;
247
630
  tools?: Array<Record<string, unknown>>;
248
631
  }>;
632
+ /**
633
+ * Create a conversation session that auto-manages message history.
634
+ * Each `.send()` call automatically appends to the history.
635
+ *
636
+ * @param options - Max messages or custom chat options.
637
+ * @returns A new Conversation instance bound to this persona.
638
+ *
639
+ * @example
640
+ * ```typescript
641
+ * const conv = persona.conversation({ maxMessages: 20 });
642
+ * const r1 = await conv.send('Hello!');
643
+ * const r2 = await conv.send('Tell me more'); // history auto-managed
644
+ * console.log(conv.messages); // full conversation
645
+ * ```
646
+ */
647
+ conversation(options?: ConversationOptions): Conversation;
249
648
  private get memoryPipelineDeps();
250
649
  private requireLLM;
251
650
  }
651
+ /**
652
+ * Assemble a system prompt entirely client-side from a {@link PersonaIdentity} and
653
+ * {@link PersonaState}.
654
+ *
655
+ * Use this with the `hear() + getState()` pattern when you own the LLM call:
656
+ * ```
657
+ * await persona.hear(userMessage);
658
+ * const [identity, state] = await Promise.all([persona.getIdentity(), persona.getState()]);
659
+ * const systemPrompt = buildPrompt(identity, state, { consumerSuffix: 'Scene: coffee shop.' });
660
+ * ```
661
+ *
662
+ * @param identity - Persona config from {@link MolrooPersona.getIdentity}.
663
+ * @param state - Live emotional state from {@link MolrooPersona.getState}.
664
+ * @param options - Optional consumer-provided context appended to the prompt.
665
+ */
666
+ export declare function buildPrompt(identity: PersonaIdentity, state: PersonaState, options?: {
667
+ consumerRules?: string;
668
+ consumerExamples?: string;
669
+ consumerSuffix?: string;
670
+ }): string;
252
671
  //# sourceMappingURL=persona.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"persona.d.ts","sourceRoot":"","sources":["../../src/persona.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,eAAe,EAEhB,MAAM,SAAS,CAAC;AAejB,qEAAqE;AACrE,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,oEAAoE;IACpE,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,kEAAkE;AAClE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,oFAAoF;IACpF,OAAO,EAAE;QACP,GAAG,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,C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