@molroo-io/sdk 0.9.0 → 0.10.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/dist/cjs/defaults/index.d.ts.map +1 -1
- package/dist/cjs/defaults/index.js +10 -5
- package/dist/cjs/events/types.d.ts +1 -1
- package/dist/cjs/events/types.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/llm/resolve.d.ts.map +1 -1
- package/dist/cjs/llm/resolve.js +2 -1
- package/dist/cjs/llm/schema.d.ts +0 -114
- package/dist/cjs/llm/schema.d.ts.map +1 -1
- package/dist/cjs/llm/schema.js +1 -44
- package/dist/cjs/persona/chat-orchestrator.d.ts +18 -3
- package/dist/cjs/persona/chat-orchestrator.d.ts.map +1 -1
- package/dist/cjs/persona/chat-orchestrator.js +29 -109
- package/dist/cjs/persona/conversation.d.ts +22 -1
- package/dist/cjs/persona/conversation.d.ts.map +1 -1
- package/dist/cjs/persona/conversation.js +2 -0
- package/dist/cjs/persona/memory-pipeline.d.ts.map +1 -1
- package/dist/cjs/persona/memory-pipeline.js +30 -4
- package/dist/cjs/persona.d.ts +330 -36
- package/dist/cjs/persona.d.ts.map +1 -1
- package/dist/cjs/persona.js +302 -19
- package/dist/cjs/shared/errors.d.ts +5 -1
- package/dist/cjs/shared/errors.d.ts.map +1 -1
- package/dist/cjs/shared/errors.js +4 -0
- package/dist/cjs/types.d.ts +18 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/world/world-persona.d.ts +20 -5
- package/dist/cjs/world/world-persona.d.ts.map +1 -1
- package/dist/cjs/world/world-persona.js +21 -5
- package/dist/cjs/world/world.d.ts +23 -3
- package/dist/cjs/world/world.d.ts.map +1 -1
- package/dist/cjs/world/world.js +24 -1
- package/dist/esm/api-client.js +2 -2
- package/dist/esm/defaults/index.d.ts.map +1 -1
- package/dist/esm/defaults/index.js +10 -2
- package/dist/esm/errors.js +1 -1
- package/dist/esm/events/types.d.ts +1 -1
- package/dist/esm/events/types.d.ts.map +1 -1
- package/dist/esm/generate/persona.js +2 -2
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +6 -6
- package/dist/esm/llm/resolve.d.ts.map +1 -1
- package/dist/esm/llm/resolve.js +3 -2
- package/dist/esm/llm/schema.d.ts +0 -114
- package/dist/esm/llm/schema.d.ts.map +1 -1
- package/dist/esm/llm/schema.js +0 -43
- package/dist/esm/llm/vercel-ai/index.js +2 -2
- package/dist/esm/package.json +1 -0
- package/dist/esm/persona/chat-orchestrator.d.ts +18 -3
- package/dist/esm/persona/chat-orchestrator.d.ts.map +1 -1
- package/dist/esm/persona/chat-orchestrator.js +32 -112
- package/dist/esm/persona/conversation.d.ts +22 -1
- package/dist/esm/persona/conversation.d.ts.map +1 -1
- package/dist/esm/persona/conversation.js +2 -0
- package/dist/esm/persona/memory-pipeline.d.ts.map +1 -1
- package/dist/esm/persona/memory-pipeline.js +31 -5
- package/dist/esm/persona.d.ts +330 -36
- package/dist/esm/persona.d.ts.map +1 -1
- package/dist/esm/persona.js +308 -26
- package/dist/esm/shared/errors.d.ts +5 -1
- package/dist/esm/shared/errors.d.ts.map +1 -1
- package/dist/esm/shared/errors.js +4 -0
- package/dist/esm/types.d.ts +18 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js +1 -1
- package/dist/esm/world/client.js +2 -2
- package/dist/esm/world/errors.js +1 -1
- package/dist/esm/world/index.js +5 -5
- package/dist/esm/world/world-domain.js +3 -3
- package/dist/esm/world/world-persona.d.ts +20 -5
- package/dist/esm/world/world-persona.d.ts.map +1 -1
- package/dist/esm/world/world-persona.js +23 -7
- package/dist/esm/world/world.d.ts +23 -3
- package/dist/esm/world/world.d.ts.map +1 -1
- package/dist/esm/world/world.js +27 -4
- package/package.json +3 -3
- package/dist/cjs/defaults/persona.json +0 -17
- package/dist/esm/defaults/persona.json +0 -17
package/dist/esm/persona.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { resolveLLM } from './llm/resolve';
|
|
2
|
-
import { MolrooApiError, MolrooErrorCode } from './errors';
|
|
3
|
-
import { createApiClient, unwrap } from './api-client';
|
|
4
|
-
import { postPerceive } from './persona/memory-pipeline';
|
|
5
|
-
import { chat as chatOrchestrator } from './persona/chat-orchestrator';
|
|
6
|
-
import { Conversation } from './persona/conversation';
|
|
1
|
+
import { resolveLLM } from './llm/resolve.js';
|
|
2
|
+
import { MolrooApiError, MolrooErrorCode } from './errors.js';
|
|
3
|
+
import { createApiClient, unwrap } from './api-client.js';
|
|
4
|
+
import { postPerceive } from './persona/memory-pipeline.js';
|
|
5
|
+
import { chat as chatOrchestrator } from './persona/chat-orchestrator.js';
|
|
6
|
+
import { Conversation } from './persona/conversation.js';
|
|
7
7
|
// ── SDK Persona Types ──
|
|
8
8
|
const DEFAULT_BASE_URL = 'https://api.molroo.io';
|
|
9
9
|
// ── MolrooPersona ──
|
|
@@ -22,7 +22,6 @@ export class MolrooPersona {
|
|
|
22
22
|
this.events = config.events ?? null;
|
|
23
23
|
this.memoryAdapter = config.memory ?? null;
|
|
24
24
|
this.memoryRecallConfig = config.recall;
|
|
25
|
-
this.appraisalMode = config.appraisalMode ?? 'direct';
|
|
26
25
|
}
|
|
27
26
|
// ── Properties ──
|
|
28
27
|
/** Unique persona instance ID. */
|
|
@@ -40,7 +39,7 @@ export class MolrooPersona {
|
|
|
40
39
|
throw new MolrooApiError('LLM adapter is required when using description string. ' +
|
|
41
40
|
'Provide llm option or use explicit PersonaConfigData.', MolrooErrorCode.LLM_REQUIRED, 400);
|
|
42
41
|
}
|
|
43
|
-
const { generatePersona } = await import('./generate/persona');
|
|
42
|
+
const { generatePersona } = await import('./generate/persona.js');
|
|
44
43
|
const llm = await resolveLLM(config.llm);
|
|
45
44
|
const personaConfig = await generatePersona(llm, input);
|
|
46
45
|
return MolrooPersona.createWithConfig(config, personaConfig);
|
|
@@ -171,15 +170,41 @@ export class MolrooPersona {
|
|
|
171
170
|
return this.perceive(description, { ...options, type });
|
|
172
171
|
}
|
|
173
172
|
/**
|
|
174
|
-
*
|
|
173
|
+
* Register a received message with the emotion engine and update the persona's emotional state.
|
|
175
174
|
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
175
|
+
* This is the **core API** for the `hear() + getState()` pattern. Apps that build their own
|
|
176
|
+
* LLM prompts should call `hear()` after each user message to keep the emotion engine in sync,
|
|
177
|
+
* then call `getState()` to read updated state for prompt assembly.
|
|
179
178
|
*
|
|
180
|
-
* @
|
|
179
|
+
* Use {@link chat} when you want the SDK to handle prompt assembly and LLM orchestration.
|
|
180
|
+
* Use `hear()` + `getState()` when your app owns the LLM call.
|
|
181
|
+
*
|
|
182
|
+
* @param message - The incoming message text (user utterance, narration, etc.).
|
|
183
|
+
* @param from - Who sent the message. A plain string is used as the source entity name.
|
|
184
|
+
* Pass an {@link InterlocutorContext} object for richer context (description, extensions).
|
|
185
|
+
* @returns Emotion engine response with updated VAD, discrete emotion, and any side effects
|
|
186
|
+
* (memory episodes, social updates, stage transitions, etc.).
|
|
187
|
+
*
|
|
188
|
+
* @example Basic hear + getState pattern
|
|
189
|
+
* ```typescript
|
|
190
|
+
* // Step 1: register message with emotion engine
|
|
191
|
+
* await persona.hear('You did a great job today!', 'Alice');
|
|
192
|
+
*
|
|
193
|
+
* // Step 2: read updated psychological state
|
|
194
|
+
* const state = await persona.getState();
|
|
195
|
+
*
|
|
196
|
+
* // Step 3: assemble your own system prompt
|
|
197
|
+
* const systemPrompt = buildPrompt(myPersonaConfig, state);
|
|
198
|
+
* const { text } = await myLLM.generate({ system: systemPrompt, messages });
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* @example With structured interlocutor context
|
|
181
202
|
* ```typescript
|
|
182
|
-
*
|
|
203
|
+
* await persona.hear('I need your help', {
|
|
204
|
+
* name: 'Alice',
|
|
205
|
+
* description: 'A regular customer, slightly anxious',
|
|
206
|
+
* extensions: { mood: 'stressed' },
|
|
207
|
+
* });
|
|
183
208
|
* ```
|
|
184
209
|
*/
|
|
185
210
|
async hear(message, from) {
|
|
@@ -254,8 +279,7 @@ export class MolrooPersona {
|
|
|
254
279
|
memoryAdapter: this.memoryAdapter,
|
|
255
280
|
memoryRecallConfig: this.memoryRecallConfig,
|
|
256
281
|
events: this.events,
|
|
257
|
-
|
|
258
|
-
getPromptContext: (suffix, source) => this.getPromptContext(suffix, source),
|
|
282
|
+
getPromptContext: (opts) => this.getPromptContext(opts),
|
|
259
283
|
perceive: (msg, opts) => this.perceive(msg, opts),
|
|
260
284
|
};
|
|
261
285
|
return chatOrchestrator(deps, message, options);
|
|
@@ -342,9 +366,44 @@ export class MolrooPersona {
|
|
|
342
366
|
}
|
|
343
367
|
// ── State ──
|
|
344
368
|
/**
|
|
345
|
-
*
|
|
369
|
+
* Fetch the full psychological state of this persona from the emotion engine.
|
|
370
|
+
*
|
|
371
|
+
* Returns all active subsystems: emotion, soul stage, mask, mood, somatic sensations,
|
|
372
|
+
* narrative self-perception, emotion regulation, self-esteem, TMT state, and relationship.
|
|
373
|
+
*
|
|
374
|
+
* This is the primary data source for apps that build their own LLM prompts. Combine with
|
|
375
|
+
* `hear()` to implement the recommended `hear() + getState()` pattern:
|
|
376
|
+
*
|
|
377
|
+
* ```
|
|
378
|
+
* user message → hear() → emotion engine updates state → getState() → build prompt → LLM
|
|
379
|
+
* ```
|
|
380
|
+
*
|
|
381
|
+
* @returns All psychological subsystems as a {@link PersonaState} object.
|
|
382
|
+
*
|
|
383
|
+
* @example Building a custom system prompt
|
|
384
|
+
* ```typescript
|
|
385
|
+
* const state = await persona.getState();
|
|
346
386
|
*
|
|
347
|
-
*
|
|
387
|
+
* const lines: string[] = [
|
|
388
|
+
* `You are ${name}.`,
|
|
389
|
+
* `Emotion: ${state.emotion.discrete.primary} (${state.emotion.discrete.intensity.toFixed(2)})`,
|
|
390
|
+
* ];
|
|
391
|
+
*
|
|
392
|
+
* if (state.mood) {
|
|
393
|
+
* lines.push(`Mood: valence=${state.mood.V.toFixed(2)} arousal=${state.mood.A.toFixed(2)}`);
|
|
394
|
+
* }
|
|
395
|
+
* if (state.narrative) {
|
|
396
|
+
* lines.push(`Narrative: agency=${state.narrative.agency.toFixed(2)} tone=${state.narrative.tone.toFixed(2)}`);
|
|
397
|
+
* }
|
|
398
|
+
* if (state.selfEsteem) {
|
|
399
|
+
* lines.push(`Self-esteem: ${state.selfEsteem.global.toFixed(2)}`);
|
|
400
|
+
* }
|
|
401
|
+
* if (state.tmt && state.tmt.mortalitySalience > 0.5) {
|
|
402
|
+
* lines.push(`Existential tension is high. Defense mode: ${state.tmt.defenseMode}`);
|
|
403
|
+
* }
|
|
404
|
+
*
|
|
405
|
+
* const systemPrompt = lines.join('\n');
|
|
406
|
+
* ```
|
|
348
407
|
*/
|
|
349
408
|
async getState() {
|
|
350
409
|
const { data } = await this.client.GET('/personas/{id}/state', {
|
|
@@ -352,6 +411,24 @@ export class MolrooPersona {
|
|
|
352
411
|
});
|
|
353
412
|
return unwrap(data);
|
|
354
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* Fetch this persona's identity config (identity, personality, goals).
|
|
416
|
+
*
|
|
417
|
+
* Returns a {@link PersonaIdentity} suitable for passing to {@link buildPrompt}
|
|
418
|
+
* when assembling system prompts entirely client-side.
|
|
419
|
+
*/
|
|
420
|
+
async getIdentity() {
|
|
421
|
+
const { data } = await this.client.GET('/personas/{id}', {
|
|
422
|
+
params: { path: { id: this._personaId } },
|
|
423
|
+
});
|
|
424
|
+
const result = unwrap(data);
|
|
425
|
+
const config = result?.persona?.config ?? {};
|
|
426
|
+
return {
|
|
427
|
+
identity: config.identity ?? { name: 'Unknown' },
|
|
428
|
+
personality: config.personality ?? { O: 0.5, C: 0.5, E: 0.5, A: 0.5, N: 0.5, H: 0.5 },
|
|
429
|
+
goals: config.goals,
|
|
430
|
+
};
|
|
431
|
+
}
|
|
355
432
|
/**
|
|
356
433
|
* Get a full snapshot of the persona (config + engine state).
|
|
357
434
|
* Useful for backup, migration, or debugging.
|
|
@@ -409,21 +486,58 @@ export class MolrooPersona {
|
|
|
409
486
|
// ── Prompt / Memory ──
|
|
410
487
|
/**
|
|
411
488
|
* Fetch the server-assembled system prompt for this persona.
|
|
412
|
-
* Includes identity, behavioral instructions, psychological state,
|
|
413
|
-
* expression style (if StyleProfile set), and consumerSuffix.
|
|
414
489
|
*
|
|
415
|
-
*
|
|
490
|
+
* The server builds a complete system prompt from the persona's live state. It includes:
|
|
491
|
+
* 1. **Identity** — name, role, core values, speaking style, description
|
|
492
|
+
* 2. **Behavioral instructions** — stay in character, embody state, match language
|
|
493
|
+
* 3. **Psychological state** — emotion, mood, somatic, narrative, goals (from live engine)
|
|
494
|
+
* 4. **Expression constraints** — message length, formality, patterns (only if StyleProfile set)
|
|
495
|
+
* 5. **consumerRules** — behavioral constraints and absolute rules (e.g., "Never break character")
|
|
496
|
+
* 6. **consumerExamples** — few-shot example messages for style/behavior reference
|
|
497
|
+
* 7. **consumerSuffix** — your app-specific context, appended last
|
|
498
|
+
*
|
|
499
|
+
* This is a **middle-tier API** — between the low-level `getState()` (raw data) and the
|
|
500
|
+
* high-level `chat()` (full orchestration). Use it when you want to drive the LLM yourself
|
|
501
|
+
* but still benefit from server-side prompt assembly.
|
|
416
502
|
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
503
|
+
* Called automatically by {@link chat}. Call directly when:
|
|
504
|
+
* - You use a custom LLM framework not supported by the SDK
|
|
505
|
+
* - You need to inspect or transform the system prompt before sending
|
|
506
|
+
* - You need prompt + state in a single round-trip (avoids a separate `getState()` call)
|
|
507
|
+
*
|
|
508
|
+
* **Do NOT** include identity, personality, or emotion in `consumerSuffix` — those are
|
|
509
|
+
* already present. Duplicating them wastes tokens and may confuse the LLM.
|
|
510
|
+
*
|
|
511
|
+
* @param options - Prompt context options.
|
|
512
|
+
* @param options.consumerSuffix - Free-form app-specific context appended to the system prompt as-is.
|
|
513
|
+
* Examples: scene description, available actions, current quest objective.
|
|
514
|
+
* @param options.consumerRules - Behavioral constraints and absolute rules.
|
|
515
|
+
* Examples: "Never break character", "Always respond in Korean", "Do not discuss competitors".
|
|
516
|
+
* @param options.consumerExamples - Few-shot example messages for style/behavior reference.
|
|
517
|
+
* Helps the LLM match a specific tone or response format.
|
|
518
|
+
* @param options.sourceEntity - Name of the conversation partner for interlocutor-aware rendering.
|
|
519
|
+
* @returns `systemPrompt` (ready to pass to LLM), `personaPrompt` (structured breakdown),
|
|
520
|
+
* and optional `tools` (if the persona has tools configured).
|
|
521
|
+
*
|
|
522
|
+
* @example Custom LLM call with server-assembled prompt
|
|
523
|
+
* ```typescript
|
|
524
|
+
* const { systemPrompt } = await persona.getPromptContext({
|
|
525
|
+
* consumerSuffix: 'Available actions: [flee, fight, negotiate]',
|
|
526
|
+
* consumerRules: 'Always respond in English. Never break character.',
|
|
527
|
+
* sourceEntity: 'Alice',
|
|
528
|
+
* });
|
|
529
|
+
* const response = await myLLM.complete({ system: systemPrompt, messages });
|
|
530
|
+
* await persona.hear(userMessage, 'Alice');
|
|
531
|
+
* ```
|
|
421
532
|
*/
|
|
422
|
-
async getPromptContext(
|
|
533
|
+
async getPromptContext(options) {
|
|
534
|
+
const { consumerSuffix, consumerRules, consumerExamples, sourceEntity } = options ?? {};
|
|
423
535
|
const { data } = await this.client.POST('/personas/{id}/prompt-context', {
|
|
424
536
|
params: { path: { id: this._personaId } },
|
|
425
537
|
body: {
|
|
426
538
|
...(consumerSuffix ? { consumerSuffix } : {}),
|
|
539
|
+
...(consumerRules ? { consumerRules } : {}),
|
|
540
|
+
...(consumerExamples ? { consumerExamples } : {}),
|
|
427
541
|
...(sourceEntity ? { sourceEntity } : {}),
|
|
428
542
|
},
|
|
429
543
|
});
|
|
@@ -458,6 +572,70 @@ export class MolrooPersona {
|
|
|
458
572
|
engineLlm: this.engineLlm,
|
|
459
573
|
};
|
|
460
574
|
}
|
|
575
|
+
// ── v1.0 unified API (additive — old methods still work) ─────────────
|
|
576
|
+
// `react()` collapses perceive/event/hear/experience/socialize into one
|
|
577
|
+
// discriminated input. `update()` collapses the 6 admin setters into one
|
|
578
|
+
// patch shape. Both delegate to the existing implementations.
|
|
579
|
+
/**
|
|
580
|
+
* Unified input method. Replaces perceive/event/hear/experience/socialize.
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* ```ts
|
|
584
|
+
* await persona.react({ kind: 'hear', message: 'hi', from: 'Alice' });
|
|
585
|
+
* await persona.react({ kind: 'experience', description: 'sun set', appraisal });
|
|
586
|
+
* await persona.react({ kind: 'event', type: 'gift', description: 'got flowers', appraisal });
|
|
587
|
+
* ```
|
|
588
|
+
*/
|
|
589
|
+
async react(input, options) {
|
|
590
|
+
switch (input.kind) {
|
|
591
|
+
case 'perceive':
|
|
592
|
+
return this.perceive(input.message, { ...options, ...input.options });
|
|
593
|
+
case 'hear':
|
|
594
|
+
return this.perceive(input.message, {
|
|
595
|
+
...options,
|
|
596
|
+
from: input.from,
|
|
597
|
+
type: 'chat_message',
|
|
598
|
+
});
|
|
599
|
+
case 'experience':
|
|
600
|
+
return this.perceive(input.description, {
|
|
601
|
+
...options,
|
|
602
|
+
appraisal: input.appraisal,
|
|
603
|
+
type: 'environment',
|
|
604
|
+
});
|
|
605
|
+
case 'event':
|
|
606
|
+
return this.perceive(input.description, {
|
|
607
|
+
...options,
|
|
608
|
+
appraisal: input.appraisal,
|
|
609
|
+
type: input.type,
|
|
610
|
+
});
|
|
611
|
+
case 'socialize':
|
|
612
|
+
return this.perceive(input.message, {
|
|
613
|
+
...options,
|
|
614
|
+
from: input.from,
|
|
615
|
+
relationshipContext: input.relationship,
|
|
616
|
+
type: 'chat_message',
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Unified admin/patch method. Replaces setEmotion, annotate, setNextResponse,
|
|
622
|
+
* setStyleProfile, patch, putSnapshot. Multiple fields can be applied in one
|
|
623
|
+
* call; they run sequentially in declaration order.
|
|
624
|
+
*/
|
|
625
|
+
async update(patch) {
|
|
626
|
+
if (patch.emotion)
|
|
627
|
+
await this.setEmotion(patch.emotion);
|
|
628
|
+
if (patch.annotation !== undefined)
|
|
629
|
+
await this.annotate(patch.annotation);
|
|
630
|
+
if (patch.nextResponse !== undefined)
|
|
631
|
+
await this.setNextResponse(patch.nextResponse);
|
|
632
|
+
if (patch.styleProfile)
|
|
633
|
+
await this.setStyleProfile(patch.styleProfile);
|
|
634
|
+
if (patch.config)
|
|
635
|
+
await this.patch({ config: patch.config });
|
|
636
|
+
if (patch.snapshot)
|
|
637
|
+
await this.putSnapshot(patch.snapshot);
|
|
638
|
+
}
|
|
461
639
|
requireLLM() {
|
|
462
640
|
if (!this.llm) {
|
|
463
641
|
throw new MolrooApiError('LLM adapter is required for chat(). Provide llm option, or use perceive() directly.', MolrooErrorCode.LLM_NOT_CONFIGURED, 400);
|
|
@@ -465,3 +643,107 @@ export class MolrooPersona {
|
|
|
465
643
|
return this.llm;
|
|
466
644
|
}
|
|
467
645
|
}
|
|
646
|
+
// ── Client-side Prompt Assembly ──
|
|
647
|
+
/**
|
|
648
|
+
* Assemble a system prompt entirely client-side from a {@link PersonaIdentity} and
|
|
649
|
+
* {@link PersonaState}.
|
|
650
|
+
*
|
|
651
|
+
* Use this with the `hear() + getState()` pattern when you own the LLM call:
|
|
652
|
+
* ```
|
|
653
|
+
* await persona.hear(userMessage);
|
|
654
|
+
* const [identity, state] = await Promise.all([persona.getIdentity(), persona.getState()]);
|
|
655
|
+
* const systemPrompt = buildPrompt(identity, state, { consumerSuffix: 'Scene: coffee shop.' });
|
|
656
|
+
* ```
|
|
657
|
+
*
|
|
658
|
+
* @param identity - Persona config from {@link MolrooPersona.getIdentity}.
|
|
659
|
+
* @param state - Live emotional state from {@link MolrooPersona.getState}.
|
|
660
|
+
* @param options - Optional consumer-provided context appended to the prompt.
|
|
661
|
+
*/
|
|
662
|
+
export function buildPrompt(identity, state, options) {
|
|
663
|
+
const { identity: id } = identity;
|
|
664
|
+
const lines = [];
|
|
665
|
+
// ── Identity ──
|
|
666
|
+
lines.push(`Name: ${id.name}`);
|
|
667
|
+
if (id.role)
|
|
668
|
+
lines.push(`Role: ${id.role}`);
|
|
669
|
+
if (id.coreValues?.length)
|
|
670
|
+
lines.push(`Core values: ${id.coreValues.join(', ')}`);
|
|
671
|
+
if (id.speakingStyle)
|
|
672
|
+
lines.push(`Speaking style: ${id.speakingStyle}`);
|
|
673
|
+
if (id.description)
|
|
674
|
+
lines.push(id.description);
|
|
675
|
+
if (id.backstory) {
|
|
676
|
+
lines.push('', '## Backstory', id.backstory);
|
|
677
|
+
}
|
|
678
|
+
if (id.relationships && Object.keys(id.relationships).length) {
|
|
679
|
+
lines.push('', '## Key Relationships');
|
|
680
|
+
for (const [k, v] of Object.entries(id.relationships))
|
|
681
|
+
lines.push(`- ${k}: ${v}`);
|
|
682
|
+
}
|
|
683
|
+
if (id.interests?.length) {
|
|
684
|
+
lines.push('', `Interests: ${id.interests.join(', ')}`);
|
|
685
|
+
}
|
|
686
|
+
if (id.speechPatterns?.length) {
|
|
687
|
+
lines.push('', '## Speech Patterns');
|
|
688
|
+
for (const p of id.speechPatterns)
|
|
689
|
+
lines.push(`- ${p}`);
|
|
690
|
+
}
|
|
691
|
+
if (id.emotionalPatterns && Object.keys(id.emotionalPatterns).length) {
|
|
692
|
+
lines.push('', '## Emotional Patterns');
|
|
693
|
+
for (const [k, v] of Object.entries(id.emotionalPatterns))
|
|
694
|
+
lines.push(`- ${k}: ${v}`);
|
|
695
|
+
}
|
|
696
|
+
if (id.quirks?.length) {
|
|
697
|
+
lines.push('', '## Quirks');
|
|
698
|
+
for (const q of id.quirks)
|
|
699
|
+
lines.push(`- ${q}`);
|
|
700
|
+
}
|
|
701
|
+
if (id.extensions && Object.keys(id.extensions).length) {
|
|
702
|
+
for (const [k, v] of Object.entries(id.extensions)) {
|
|
703
|
+
lines.push('', `## ${k}`, v);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
// ── Behavioral Instructions ──
|
|
707
|
+
lines.push('', 'Stay in character.', 'Embody your psychological state naturally in your responses.', 'Respond in the same language as the user.');
|
|
708
|
+
// ── Psychological State ──
|
|
709
|
+
lines.push('', '## Current Psychological State');
|
|
710
|
+
const { primary, secondary, intensity } = state.emotion.discrete;
|
|
711
|
+
const emotionLabel = secondary ? `${primary} / ${secondary}` : primary;
|
|
712
|
+
lines.push(`Emotion: ${emotionLabel} (intensity: ${intensity.toFixed(2)})`);
|
|
713
|
+
const { V, A, D } = state.emotion.vad;
|
|
714
|
+
lines.push(`VAD: V=${V.toFixed(2)} A=${A.toFixed(2)} D=${D.toFixed(2)}`);
|
|
715
|
+
if (state.mood) {
|
|
716
|
+
lines.push(`Mood: V=${state.mood.V.toFixed(2)} A=${state.mood.A.toFixed(2)} D=${state.mood.D.toFixed(2)}`);
|
|
717
|
+
}
|
|
718
|
+
if (state.somatic) {
|
|
719
|
+
const active = Object.entries(state.somatic).filter(([, v]) => v >= 0.1);
|
|
720
|
+
if (active.length) {
|
|
721
|
+
const somaticStr = active.map(([k, v]) => `${k} (${v.toFixed(2)})`).join(', ');
|
|
722
|
+
lines.push(`Somatic: ${somaticStr}. These bodily sensations unconsciously color your responses.`);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if (state.narrative) {
|
|
726
|
+
const n = state.narrative;
|
|
727
|
+
lines.push(`Narrative self-perception: tone=${n.tone.toFixed(2)} agency=${n.agency.toFixed(2)} coherence=${n.coherence.toFixed(2)}`);
|
|
728
|
+
}
|
|
729
|
+
lines.push(`Soul stage: ${state.soulStage.name}`);
|
|
730
|
+
if (state.relationship) {
|
|
731
|
+
const r = state.relationship;
|
|
732
|
+
const attachment = r.attachmentStyle ? ` attachment=${r.attachmentStyle}` : '';
|
|
733
|
+
lines.push(`Relationship: trust=${r.trust.toFixed(2)} intimacy=${r.intimacy.toFixed(2)}${attachment}`);
|
|
734
|
+
}
|
|
735
|
+
if (state.mask.state !== 'stable') {
|
|
736
|
+
lines.push(`Mask: ${state.mask.state} (integrity=${state.mask.integrity.toFixed(2)})`);
|
|
737
|
+
}
|
|
738
|
+
// ── Consumer Context ──
|
|
739
|
+
if (options?.consumerRules) {
|
|
740
|
+
lines.push('', '## Rules', options.consumerRules);
|
|
741
|
+
}
|
|
742
|
+
if (options?.consumerExamples) {
|
|
743
|
+
lines.push('', '## Examples', options.consumerExamples);
|
|
744
|
+
}
|
|
745
|
+
if (options?.consumerSuffix) {
|
|
746
|
+
lines.push('', options.consumerSuffix);
|
|
747
|
+
}
|
|
748
|
+
return lines.join('\n');
|
|
749
|
+
}
|
|
@@ -28,7 +28,11 @@ export declare enum MolrooErrorCode {
|
|
|
28
28
|
/** Authentication failed — invalid or missing API key. */
|
|
29
29
|
UNAUTHORIZED = "UNAUTHORIZED",
|
|
30
30
|
/** API returned an unexpected error not covered by other codes. */
|
|
31
|
-
API_ERROR = "API_ERROR"
|
|
31
|
+
API_ERROR = "API_ERROR",
|
|
32
|
+
/** Feature is not yet implemented. */
|
|
33
|
+
NOT_IMPLEMENTED = "NOT_IMPLEMENTED",
|
|
34
|
+
/** Memory pipeline operation failed (fire-and-forget, non-blocking). */
|
|
35
|
+
PIPELINE_ERROR = "PIPELINE_ERROR"
|
|
32
36
|
}
|
|
33
37
|
export declare class MolrooApiError extends Error {
|
|
34
38
|
/** Machine-readable error code. Use {@link MolrooErrorCode} for type-safe matching. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/shared/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,oEAAoE;AACpE,oBAAY,eAAe;IACzB,mFAAmF;IACnF,YAAY,iBAAiB;IAC7B,2FAA2F;IAC3F,kBAAkB,uBAAuB;IACzC,6DAA6D;IAC7D,gBAAgB,qBAAqB;IACrC,0DAA0D;IAC1D,YAAY,iBAAiB;IAC7B,mEAAmE;IACnE,SAAS,cAAc;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/shared/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,oEAAoE;AACpE,oBAAY,eAAe;IACzB,mFAAmF;IACnF,YAAY,iBAAiB;IAC7B,2FAA2F;IAC3F,kBAAkB,uBAAuB;IACzC,6DAA6D;IAC7D,gBAAgB,qBAAqB;IACrC,0DAA0D;IAC1D,YAAY,iBAAiB;IAC7B,mEAAmE;IACnE,SAAS,cAAc;IACvB,sCAAsC;IACtC,eAAe,oBAAoB;IACnC,wEAAwE;IACxE,cAAc,mBAAmB;CAClC;AAED,qBAAa,cAAe,SAAQ,KAAK;IAGrC,uFAAuF;aACvE,IAAI,EAAE,MAAM;IAC5B,wBAAwB;aACR,MAAM,EAAE,MAAM;gBAJ9B,OAAO,EAAE,MAAM;IACf,uFAAuF;IACvE,IAAI,EAAE,MAAM;IAC5B,wBAAwB;IACR,MAAM,EAAE,MAAM;CAKjC;AAED,qBAAa,aAAc,SAAQ,cAAc;gBACnC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAI1D"}
|
|
@@ -30,6 +30,10 @@ export var MolrooErrorCode;
|
|
|
30
30
|
MolrooErrorCode["UNAUTHORIZED"] = "UNAUTHORIZED";
|
|
31
31
|
/** API returned an unexpected error not covered by other codes. */
|
|
32
32
|
MolrooErrorCode["API_ERROR"] = "API_ERROR";
|
|
33
|
+
/** Feature is not yet implemented. */
|
|
34
|
+
MolrooErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
|
|
35
|
+
/** Memory pipeline operation failed (fire-and-forget, non-blocking). */
|
|
36
|
+
MolrooErrorCode["PIPELINE_ERROR"] = "PIPELINE_ERROR";
|
|
33
37
|
})(MolrooErrorCode || (MolrooErrorCode = {}));
|
|
34
38
|
export class MolrooApiError extends Error {
|
|
35
39
|
constructor(message,
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -222,6 +222,18 @@ export interface Identity {
|
|
|
222
222
|
coreValues?: string[];
|
|
223
223
|
culturalIdentity?: string;
|
|
224
224
|
description?: string;
|
|
225
|
+
/** Character backstory or personal history. */
|
|
226
|
+
backstory?: string;
|
|
227
|
+
/** Key relationships and how the persona perceives them. e.g. {"mom": "strict but loving"} */
|
|
228
|
+
relationships?: Record<string, string>;
|
|
229
|
+
/** Interests, hobbies, or topics the persona cares about. */
|
|
230
|
+
interests?: string[];
|
|
231
|
+
/** Characteristic speech patterns or verbal tics. e.g. ["ends sentences with ~잖아", "says 진짜 when surprised"] */
|
|
232
|
+
speechPatterns?: string[];
|
|
233
|
+
/** Emotional reaction patterns. e.g. {"angry": "goes quiet and terse", "happy": "talks fast"} */
|
|
234
|
+
emotionalPatterns?: Record<string, string>;
|
|
235
|
+
/** Distinctive habits or quirks. e.g. ["taps fingers when thinking", "avoids eye contact when lying"] */
|
|
236
|
+
quirks?: string[];
|
|
225
237
|
extensions?: Record<string, string>;
|
|
226
238
|
}
|
|
227
239
|
export interface Goal {
|
|
@@ -237,6 +249,12 @@ export interface PersonaConfigData {
|
|
|
237
249
|
goals?: Goal[];
|
|
238
250
|
[key: string]: unknown;
|
|
239
251
|
}
|
|
252
|
+
/** Persona identity config as returned by {@link MolrooPersona.getIdentity}. */
|
|
253
|
+
export interface PersonaIdentity {
|
|
254
|
+
identity: Identity;
|
|
255
|
+
personality: PersonalityTraits;
|
|
256
|
+
goals?: Goal[];
|
|
257
|
+
}
|
|
240
258
|
export interface MotivationContext {
|
|
241
259
|
goals: Goal[];
|
|
242
260
|
activeGoal?: Goal;
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":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,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE;AAC3G,MAAM,WAAW,kBAAkB;IAAG,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE;AAC9E,MAAM,WAAW,eAAe;IAAG,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,qBAAqB,EAAE,mBAAmB,EAAE,CAAC;IAAC,eAAe,EAAE,gBAAgB,GAAG,IAAI,CAAA;CAAE;AAErK,MAAM,WAAW,KAAK;IACpB,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,KAAK,CAAC,GAAG,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,SAAS,CAAC;IACtB,gBAAgB,EAAE,eAAe,CAAC;IAClC,kBAAkB,CAAC,EAAE,GAAG,CAAC;IACzB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,OAAO,EAAE,YAAY,CAAC;IACtB,eAAe,EAAE,mBAAmB,CAAC;IACrC,aAAa,EAAE,kBAAkB,CAAC;IAClC,UAAU,EAAE,eAAe,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAID,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/esm/types.js
CHANGED
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
// Pipeline: Engine Zod schemas → @hono/zod-openapi → OpenAPI JSON → openapi-typescript → api.d.ts
|
|
9
9
|
// ============================================================================
|
|
10
10
|
// ── Error (re-exported from errors.ts) ──
|
|
11
|
-
export { MolrooApiError, MolrooErrorCode } from './errors';
|
|
11
|
+
export { MolrooApiError, MolrooErrorCode } from './errors.js';
|
package/dist/esm/world/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WorldApiError } from './errors';
|
|
2
|
-
import { createTypedClient, unwrap } from '../shared/client-factory';
|
|
1
|
+
import { WorldApiError } from './errors.js';
|
|
2
|
+
import { createTypedClient, unwrap } from '../shared/client-factory.js';
|
|
3
3
|
/**
|
|
4
4
|
* Create a typed API client for the molroo World API.
|
|
5
5
|
*
|
package/dist/esm/world/errors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { WorldApiError } from '../shared/errors';
|
|
1
|
+
export { WorldApiError } from '../shared/errors.js';
|
package/dist/esm/world/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Primary
|
|
2
|
-
export { Molroo } from './world';
|
|
3
|
-
export { World } from './world-domain';
|
|
4
|
-
export { WorldPersona } from './world-persona';
|
|
2
|
+
export { Molroo } from './world.js';
|
|
3
|
+
export { World } from './world-domain.js';
|
|
4
|
+
export { WorldPersona } from './world-persona.js';
|
|
5
5
|
// Error
|
|
6
|
-
export { WorldApiError } from './errors';
|
|
6
|
+
export { WorldApiError } from './errors.js';
|
|
7
7
|
// Advanced
|
|
8
|
-
export { createWorldClient } from './client';
|
|
8
|
+
export { createWorldClient } from './client.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// INFO: @F001 Domain class wrapping World API — see plan step 3
|
|
2
|
-
import { unwrap } from './client';
|
|
3
|
-
import { WorldPersona } from './world-persona';
|
|
4
|
-
import { toWireAppraisal, fromWireAppraisal } from '../shared/appraisal';
|
|
2
|
+
import { unwrap } from './client.js';
|
|
3
|
+
import { WorldPersona } from './world-persona.js';
|
|
4
|
+
import { toWireAppraisal, fromWireAppraisal } from '../shared/appraisal.js';
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
6
6
|
// World class (domain)
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { type ApiClient } from './client';
|
|
11
11
|
import type { Appraisal } from './types';
|
|
12
12
|
import type { LLMAdapter } from '../llm/adapter';
|
|
13
|
+
import type { ZodSchema } from 'zod';
|
|
13
14
|
export type LLMMessage = {
|
|
14
15
|
role: 'user' | 'assistant' | 'system';
|
|
15
16
|
content: string;
|
|
@@ -71,7 +72,7 @@ export interface PersonaDetail {
|
|
|
71
72
|
};
|
|
72
73
|
state: WorldPersonaState | null;
|
|
73
74
|
}
|
|
74
|
-
export interface ReactOptions {
|
|
75
|
+
export interface ReactOptions<T = string> {
|
|
75
76
|
/** Who is performing the action (e.g. 'yongjun'). */
|
|
76
77
|
actor?: string;
|
|
77
78
|
actorType?: 'user' | 'persona';
|
|
@@ -80,7 +81,7 @@ export interface ReactOptions {
|
|
|
80
81
|
/** Prior conversation turns for context. */
|
|
81
82
|
history?: LLMMessage[];
|
|
82
83
|
/** Zod schema for structured output. Omit for plain text. */
|
|
83
|
-
schema?:
|
|
84
|
+
schema?: ZodSchema<T>;
|
|
84
85
|
temperature?: number;
|
|
85
86
|
}
|
|
86
87
|
export interface ReactResult<T = string> {
|
|
@@ -117,8 +118,22 @@ export declare class WorldPersona {
|
|
|
117
118
|
getState(): Promise<WorldPersonaState>;
|
|
118
119
|
/** Get speaking style from persona config (identity.speakingStyle). */
|
|
119
120
|
getSpeakingStyle(): Promise<string | undefined>;
|
|
120
|
-
/**
|
|
121
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Get LLM system prompt assembled from all persona subsystems + world context.
|
|
123
|
+
*
|
|
124
|
+
* @param options - Prompt context options.
|
|
125
|
+
* @param options.sourceEntity - Name of the conversation partner for interlocutor-aware rendering.
|
|
126
|
+
* @param options.consumerSuffix - Free-form app-specific context appended to the system prompt as-is.
|
|
127
|
+
* @param options.consumerRules - Behavioral constraints and absolute rules.
|
|
128
|
+
* Examples: "Never break character", "Always respond in Korean".
|
|
129
|
+
* @param options.consumerExamples - Few-shot example messages for style/behavior reference.
|
|
130
|
+
*/
|
|
131
|
+
getPromptContext(options?: {
|
|
132
|
+
sourceEntity?: string;
|
|
133
|
+
consumerSuffix?: string;
|
|
134
|
+
consumerRules?: string;
|
|
135
|
+
consumerExamples?: string;
|
|
136
|
+
}): Promise<PromptContext>;
|
|
122
137
|
/**
|
|
123
138
|
* Send a predefined action to this persona's emotion engine.
|
|
124
139
|
* Invalidates cached state.
|
|
@@ -183,6 +198,6 @@ export declare class WorldPersona {
|
|
|
183
198
|
* console.log(r2.narrative.dialogue); // typed
|
|
184
199
|
* ```
|
|
185
200
|
*/
|
|
186
|
-
react<T = string>(action: string, options: ReactOptions): Promise<ReactResult<T>>;
|
|
201
|
+
react<T = string>(action: string, options: ReactOptions<T>): Promise<ReactResult<T>>;
|
|
187
202
|
}
|
|
188
203
|
//# sourceMappingURL=world-persona.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world-persona.d.ts","sourceRoot":"","sources":["../../../src/world/world-persona.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"world-persona.d.ts","sourceRoot":"","sources":["../../../src/world/world-persona.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAMrC,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;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