@molroo-io/sdk 0.7.3 → 0.8.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.
- package/dist/cjs/expression/index.d.ts +103 -0
- package/dist/cjs/expression/index.d.ts.map +1 -0
- package/dist/cjs/expression/index.js +18 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/llm/schema.d.ts +114 -0
- package/dist/cjs/llm/schema.d.ts.map +1 -1
- package/dist/cjs/llm/schema.js +44 -1
- package/dist/cjs/persona/chat-orchestrator.d.ts +2 -1
- package/dist/cjs/persona/chat-orchestrator.d.ts.map +1 -1
- package/dist/cjs/persona/chat-orchestrator.js +139 -33
- package/dist/cjs/persona.d.ts +26 -1
- package/dist/cjs/persona.d.ts.map +1 -1
- package/dist/cjs/persona.js +34 -1
- package/dist/cjs/types.d.ts +18 -5
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/expression/index.d.ts +103 -0
- package/dist/esm/expression/index.d.ts.map +1 -0
- package/dist/esm/expression/index.js +17 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/llm/schema.d.ts +114 -0
- package/dist/esm/llm/schema.d.ts.map +1 -1
- package/dist/esm/llm/schema.js +43 -0
- package/dist/esm/persona/chat-orchestrator.d.ts +2 -1
- package/dist/esm/persona/chat-orchestrator.d.ts.map +1 -1
- package/dist/esm/persona/chat-orchestrator.js +139 -33
- package/dist/esm/persona.d.ts +26 -1
- package/dist/esm/persona.d.ts.map +1 -1
- package/dist/esm/persona.js +34 -1
- package/dist/esm/types.d.ts +18 -5
- package/dist/esm/types.d.ts.map +1 -1
- package/package.json +25 -16
|
@@ -29,6 +29,49 @@ function buildInterlocutorBlock(ctx) {
|
|
|
29
29
|
}
|
|
30
30
|
return parts.join('\n');
|
|
31
31
|
}
|
|
32
|
+
function buildDirectAppraisalInstruction() {
|
|
33
|
+
return [
|
|
34
|
+
'',
|
|
35
|
+
'## Appraisal Task',
|
|
36
|
+
"Evaluate how RECEIVING the user's message affects this persona emotionally.",
|
|
37
|
+
'The event you are appraising is the message itself arriving, not the described situation.',
|
|
38
|
+
"When the user shares their own experience, appraise through the persona's relational goals.",
|
|
39
|
+
"Rate each dimension from the persona's subjective perspective.",
|
|
40
|
+
'An insult should produce negative goal_congruence and norm_compatibility.',
|
|
41
|
+
'A compliment should produce positive values. Neutral small talk should be near zero.',
|
|
42
|
+
].join('\n');
|
|
43
|
+
}
|
|
44
|
+
function buildEventAppraisalInstruction() {
|
|
45
|
+
return [
|
|
46
|
+
'',
|
|
47
|
+
'## Event Classification Task',
|
|
48
|
+
"Classify the user's message into the ontology event format before emotion is computed.",
|
|
49
|
+
'',
|
|
50
|
+
'### Step 1: interaction_type (required)',
|
|
51
|
+
'Determine the conversation mode: chat (small talk), inform (sharing info/news), humor (jokes/playfulness), express (emotional/relational event), goodbye (farewell/parting).',
|
|
52
|
+
'',
|
|
53
|
+
'### Step 2: event_type (only when interaction_type is "express")',
|
|
54
|
+
'If the message contains a relationship event, classify it: praise, criticism, support, rejection, apology, request, betrayal, or neglect.',
|
|
55
|
+
'Omit event_type for chat, inform, humor, or goodbye — these do not carry relationship events.',
|
|
56
|
+
'',
|
|
57
|
+
'### Step 3: agent_role, target_role, relationship, intensity',
|
|
58
|
+
'agent_role: who performed the action. target_role: who is affected by or receives the action.',
|
|
59
|
+
'Example: "you did great" → interaction=express, event=praise, agent=user, target=self.',
|
|
60
|
+
'Example: "nice weather" → interaction=chat, no event_type, agent=user, target=self.',
|
|
61
|
+
'Example: "my friend betrayed me" → interaction=express, event=betrayal, agent=other, target=user.',
|
|
62
|
+
].join('\n');
|
|
63
|
+
}
|
|
64
|
+
/** Convert an EventAppraisal to the ontologyEvent shape for API. */
|
|
65
|
+
function toOntologyEvent(event) {
|
|
66
|
+
return {
|
|
67
|
+
interaction_type: event.interaction_type,
|
|
68
|
+
...(event.event_type ? { event_type: event.event_type } : {}),
|
|
69
|
+
agent_role: event.agent_role,
|
|
70
|
+
target_role: event.target_role,
|
|
71
|
+
relationship: event.relationship,
|
|
72
|
+
intensity: event.intensity,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
32
75
|
export async function chat(deps, message, options) {
|
|
33
76
|
const fromOption = options?.from ?? 'user';
|
|
34
77
|
const from = typeof fromOption === 'string' ? fromOption : fromOption.name;
|
|
@@ -62,30 +105,33 @@ export async function chat(deps, message, options) {
|
|
|
62
105
|
}
|
|
63
106
|
let responseText;
|
|
64
107
|
let appraisal;
|
|
108
|
+
let ontologyEvent;
|
|
65
109
|
let earlyPerceiveResponse;
|
|
66
110
|
// Split mode: engineLlm handles appraisal, primary llm handles response text
|
|
67
111
|
if (deps.engineLlm && deps.engineLlm !== deps.llm) {
|
|
68
|
-
const { AppraisalVectorSchema } = await import('../llm/schema');
|
|
69
|
-
const appraisalInstruction = [
|
|
70
|
-
'',
|
|
71
|
-
'## Appraisal Task',
|
|
72
|
-
"Evaluate how RECEIVING the user's message affects this persona emotionally.",
|
|
73
|
-
'The event you are appraising is the message itself arriving — not the described situation.',
|
|
74
|
-
"When the user shares their own experience (e.g. loss, success), appraise through the persona's relational goals: caring about the speaker makes their suffering relevant and incongruent.",
|
|
75
|
-
"Rate each dimension from the persona's subjective perspective.",
|
|
76
|
-
'An insult should produce negative goal_congruence and norm_compatibility.',
|
|
77
|
-
'A compliment should produce positive values. Neutral small talk should be near zero.',
|
|
78
|
-
].join('\n');
|
|
79
112
|
const appraisalMessages = messages.length <= 5 ? messages : messages.slice(-5);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
113
|
+
if (deps.appraisalMode === 'event') {
|
|
114
|
+
const { EventAppraisalSchema } = await import('../llm/schema');
|
|
115
|
+
const { object: appraisalResult } = await deps.engineLlm.generateObject({
|
|
116
|
+
system: systemPrompt + buildEventAppraisalInstruction(),
|
|
117
|
+
messages: appraisalMessages,
|
|
118
|
+
schema: EventAppraisalSchema,
|
|
119
|
+
});
|
|
120
|
+
ontologyEvent = toOntologyEvent(appraisalResult);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
const { AppraisalVectorSchema } = await import('../llm/schema');
|
|
124
|
+
const { object: appraisalResult } = await deps.engineLlm.generateObject({
|
|
125
|
+
system: systemPrompt + buildDirectAppraisalInstruction(),
|
|
126
|
+
messages: appraisalMessages,
|
|
127
|
+
schema: AppraisalVectorSchema,
|
|
128
|
+
});
|
|
129
|
+
appraisal = clampAppraisal(appraisalResult);
|
|
130
|
+
}
|
|
86
131
|
earlyPerceiveResponse = await deps.perceive(message, {
|
|
87
132
|
from,
|
|
88
|
-
appraisal,
|
|
133
|
+
...(appraisal ? { appraisal } : {}),
|
|
134
|
+
...(ontologyEvent ? { ontologyEvent } : {}),
|
|
89
135
|
priorEpisodes: recalledEpisodes.length > 0 ? recalledEpisodes : undefined,
|
|
90
136
|
skipMemory: true,
|
|
91
137
|
});
|
|
@@ -112,17 +158,30 @@ export async function chat(deps, message, options) {
|
|
|
112
158
|
else if (hasTools) {
|
|
113
159
|
const result = await generateWithToolLoop(deps, systemPrompt, messages, options?.onToolCall);
|
|
114
160
|
responseText = result.text;
|
|
115
|
-
appraisal =
|
|
161
|
+
appraisal = result.appraisal;
|
|
162
|
+
ontologyEvent = result.ontologyEvent;
|
|
116
163
|
}
|
|
117
164
|
else {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
165
|
+
if (deps.appraisalMode === 'event') {
|
|
166
|
+
const { LLMEventResponseSchema } = await import('../llm/schema');
|
|
167
|
+
const { object: llmResult } = await deps.llm.generateObject({
|
|
168
|
+
system: systemPrompt + buildEventAppraisalInstruction(),
|
|
169
|
+
messages,
|
|
170
|
+
schema: LLMEventResponseSchema,
|
|
171
|
+
});
|
|
172
|
+
responseText = llmResult.response;
|
|
173
|
+
ontologyEvent = toOntologyEvent(llmResult);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
const { LLMResponseSchema } = await import('../llm/schema');
|
|
177
|
+
const { object: llmResult } = await deps.llm.generateObject({
|
|
178
|
+
system: systemPrompt,
|
|
179
|
+
messages,
|
|
180
|
+
schema: LLMResponseSchema,
|
|
181
|
+
});
|
|
182
|
+
responseText = llmResult.response;
|
|
183
|
+
appraisal = clampAppraisal(llmResult.appraisal ?? { ...NEUTRAL_APPRAISAL });
|
|
184
|
+
}
|
|
126
185
|
}
|
|
127
186
|
// 4. Send to API for emotion processing (skip if already done in split mode)
|
|
128
187
|
let response;
|
|
@@ -132,7 +191,8 @@ export async function chat(deps, message, options) {
|
|
|
132
191
|
else {
|
|
133
192
|
response = await deps.perceive(responseText, {
|
|
134
193
|
from,
|
|
135
|
-
appraisal:
|
|
194
|
+
...(appraisal ? { appraisal } : {}),
|
|
195
|
+
...(ontologyEvent ? { ontologyEvent } : {}),
|
|
136
196
|
priorEpisodes: recalledEpisodes.length > 0 ? recalledEpisodes : undefined,
|
|
137
197
|
skipMemory: true,
|
|
138
198
|
});
|
|
@@ -158,18 +218,53 @@ export async function chat(deps, message, options) {
|
|
|
158
218
|
}
|
|
159
219
|
async function generateWithToolLoop(deps, system, messages, onToolCall) {
|
|
160
220
|
const MAX_TOOL_ITERATIONS = 3;
|
|
161
|
-
const {
|
|
221
|
+
const { LLMEventResponseSchema, LLMEventResponseWithToolsSchema, LLMResponseSchema, LLMResponseWithToolsSchema, } = await import('../llm/schema');
|
|
162
222
|
let currentSystem = system;
|
|
163
223
|
for (let iteration = 0; iteration < MAX_TOOL_ITERATIONS; iteration++) {
|
|
224
|
+
if (deps.appraisalMode === 'event') {
|
|
225
|
+
const { object: llmResult } = await deps.llm.generateObject({
|
|
226
|
+
system: currentSystem + buildEventAppraisalInstruction(),
|
|
227
|
+
messages,
|
|
228
|
+
schema: LLMEventResponseWithToolsSchema,
|
|
229
|
+
});
|
|
230
|
+
if (!llmResult.search_memory) {
|
|
231
|
+
return {
|
|
232
|
+
text: llmResult.response,
|
|
233
|
+
ontologyEvent: toOntologyEvent(llmResult),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
const query = llmResult.search_memory;
|
|
237
|
+
let episodes = [];
|
|
238
|
+
try {
|
|
239
|
+
episodes = await deps.searchMemory(query);
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
// Memory search failed — continue without results
|
|
243
|
+
}
|
|
244
|
+
if (onToolCall) {
|
|
245
|
+
onToolCall({ name: 'search_memory', args: { query }, result: episodes });
|
|
246
|
+
}
|
|
247
|
+
const resultBlock = episodes.length > 0
|
|
248
|
+
? `\n\n## Memory Search Results (query: "${query}")\n${episodes.map(ep => {
|
|
249
|
+
const ts = ep.timestamp ? new Date(ep.timestamp).toISOString() : 'unknown';
|
|
250
|
+
const source = ep.sourceEntity ?? 'unknown';
|
|
251
|
+
const context = ep.context ?? 'no context';
|
|
252
|
+
return `- [${ts}] ${source}: ${context}`;
|
|
253
|
+
}).join('\n')}`
|
|
254
|
+
: `\n\n## Memory Search Results (query: "${query}")\nNo matching memories found.`;
|
|
255
|
+
currentSystem = currentSystem + resultBlock;
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
164
258
|
const { object: llmResult } = await deps.llm.generateObject({
|
|
165
259
|
system: currentSystem,
|
|
166
260
|
messages,
|
|
167
261
|
schema: LLMResponseWithToolsSchema,
|
|
168
262
|
});
|
|
169
263
|
if (!llmResult.search_memory) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
264
|
+
return {
|
|
265
|
+
text: llmResult.response,
|
|
266
|
+
appraisal: clampAppraisal(llmResult.appraisal ?? { ...NEUTRAL_APPRAISAL }),
|
|
267
|
+
};
|
|
173
268
|
}
|
|
174
269
|
const query = llmResult.search_memory;
|
|
175
270
|
let episodes = [];
|
|
@@ -192,6 +287,17 @@ async function generateWithToolLoop(deps, system, messages, onToolCall) {
|
|
|
192
287
|
: `\n\n## Memory Search Results (query: "${query}")\nNo matching memories found.`;
|
|
193
288
|
currentSystem = currentSystem + resultBlock;
|
|
194
289
|
}
|
|
290
|
+
if (deps.appraisalMode === 'event') {
|
|
291
|
+
const { object: finalResult } = await deps.llm.generateObject({
|
|
292
|
+
system: currentSystem + buildEventAppraisalInstruction(),
|
|
293
|
+
messages,
|
|
294
|
+
schema: LLMEventResponseSchema,
|
|
295
|
+
});
|
|
296
|
+
return {
|
|
297
|
+
text: finalResult.response,
|
|
298
|
+
ontologyEvent: toOntologyEvent(finalResult),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
195
301
|
const { object: finalResult } = await deps.llm.generateObject({
|
|
196
302
|
system: currentSystem,
|
|
197
303
|
messages,
|
|
@@ -199,6 +305,6 @@ async function generateWithToolLoop(deps, system, messages, onToolCall) {
|
|
|
199
305
|
});
|
|
200
306
|
return {
|
|
201
307
|
text: finalResult.response,
|
|
202
|
-
appraisal: finalResult.appraisal ?? { ...NEUTRAL_APPRAISAL },
|
|
308
|
+
appraisal: clampAppraisal(finalResult.appraisal ?? { ...NEUTRAL_APPRAISAL }),
|
|
203
309
|
};
|
|
204
310
|
}
|
package/dist/esm/persona.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ 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, AppraisalVector, InterlocutorContext, PersonaSnapshot, PersonaConfigData, PerceiveOptions } from './types';
|
|
5
|
+
import type { AgentResponse, AppraisalMode, AppraisalVector, InterlocutorContext, PersonaSnapshot, PersonaConfigData, PerceiveOptions } from './types';
|
|
6
6
|
/** Configuration for connecting to a standalone persona instance. */
|
|
7
7
|
export interface MolrooPersonaConfig {
|
|
8
8
|
/** Base URL of the molroo API. Defaults to 'https://api.molroo.io'. */
|
|
@@ -30,6 +30,8 @@ export interface MolrooPersonaConfig {
|
|
|
30
30
|
* memory_consolidated, reflection_generated, etc.).
|
|
31
31
|
*/
|
|
32
32
|
events?: EventAdapter;
|
|
33
|
+
/** Appraisal generation mode for `chat()`. Defaults to `direct`. */
|
|
34
|
+
appraisalMode?: AppraisalMode;
|
|
33
35
|
}
|
|
34
36
|
/** Summary of a persona instance, returned by list operations. */
|
|
35
37
|
export interface PersonaSummary {
|
|
@@ -95,6 +97,7 @@ export declare class MolrooPersona {
|
|
|
95
97
|
private memoryRecallConfig;
|
|
96
98
|
private events;
|
|
97
99
|
private _personaId;
|
|
100
|
+
private appraisalMode;
|
|
98
101
|
constructor(config: MolrooPersonaConfig & {
|
|
99
102
|
llm?: LLMAdapter;
|
|
100
103
|
engineLlm?: LLMAdapter;
|
|
@@ -121,6 +124,7 @@ export declare class MolrooPersona {
|
|
|
121
124
|
memory?: MemoryAdapter;
|
|
122
125
|
recall?: RecallLimits;
|
|
123
126
|
events?: EventAdapter;
|
|
127
|
+
appraisalMode?: AppraisalMode;
|
|
124
128
|
}, description: string): Promise<MolrooPersona>;
|
|
125
129
|
/**
|
|
126
130
|
* Create a new persona with explicit configuration.
|
|
@@ -141,6 +145,7 @@ export declare class MolrooPersona {
|
|
|
141
145
|
memory?: MemoryAdapter;
|
|
142
146
|
recall?: RecallLimits;
|
|
143
147
|
events?: EventAdapter;
|
|
148
|
+
appraisalMode?: AppraisalMode;
|
|
144
149
|
}, personaConfig: PersonaConfigData): Promise<MolrooPersona>;
|
|
145
150
|
/**
|
|
146
151
|
* Internal implementation for creating persona with resolved config.
|
|
@@ -159,6 +164,7 @@ export declare class MolrooPersona {
|
|
|
159
164
|
memory?: MemoryAdapter;
|
|
160
165
|
recall?: RecallLimits;
|
|
161
166
|
events?: EventAdapter;
|
|
167
|
+
appraisalMode?: AppraisalMode;
|
|
162
168
|
}, description: string): Promise<MolrooPersona>;
|
|
163
169
|
static connect(config: {
|
|
164
170
|
baseUrl?: string;
|
|
@@ -168,6 +174,7 @@ export declare class MolrooPersona {
|
|
|
168
174
|
memory?: MemoryAdapter;
|
|
169
175
|
recall?: RecallLimits;
|
|
170
176
|
events?: EventAdapter;
|
|
177
|
+
appraisalMode?: AppraisalMode;
|
|
171
178
|
}, personaId: string): Promise<MolrooPersona>;
|
|
172
179
|
static listPersonas(config: {
|
|
173
180
|
baseUrl?: string;
|
|
@@ -198,6 +205,24 @@ export declare class MolrooPersona {
|
|
|
198
205
|
A: number;
|
|
199
206
|
D: number;
|
|
200
207
|
}>): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Set StyleProfile extracted from a text corpus.
|
|
210
|
+
* Once set, expression constraints (promptText) are automatically
|
|
211
|
+
* included in getPromptContext() and modulated by current emotion.
|
|
212
|
+
*/
|
|
213
|
+
setStyleProfile(profile: Record<string, unknown>): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Extract a StyleProfile from a text corpus and save it to this persona.
|
|
216
|
+
* Delegates extraction to the API server (keeps expression logic server-side).
|
|
217
|
+
*
|
|
218
|
+
* @param corpus - Array of messages from this persona's author (min 50 recommended)
|
|
219
|
+
* @param options - Optional extraction configuration (timestamps, otherMessages)
|
|
220
|
+
* @returns The extracted StyleProfile
|
|
221
|
+
*/
|
|
222
|
+
extractStyleProfile(corpus: string[], options?: {
|
|
223
|
+
timestamps?: number[];
|
|
224
|
+
otherMessages?: string[];
|
|
225
|
+
}): Promise<Record<string, unknown>>;
|
|
201
226
|
getState(): Promise<PersonaState>;
|
|
202
227
|
getSnapshot(): Promise<PersonaSnapshot>;
|
|
203
228
|
putSnapshot(snapshot: PersonaSnapshot): Promise<void>;
|
|
@@ -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,E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MAAM,EAAE,OAAO,CAAC,CAAC;IAW7B,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC;IAOjC,WAAW,IAAI,OAAO,CAAC,eAAe,CAAC;IAOvC,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IASrD,KAAK,CAAC,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,iBAAiB,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAUxB,gBAAgB,CACpB,cAAc,CAAC,EAAE,MAAM,EACvB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;KAAE,CAAC;IAW9G,YAAY,CAChB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GAClD,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAe1C,OAAO,KAAK,kBAAkB,GAQ7B;IAED,OAAO,CAAC,UAAU;CAUnB"}
|
package/dist/esm/persona.js
CHANGED
|
@@ -21,6 +21,7 @@ export class MolrooPersona {
|
|
|
21
21
|
this.events = config.events ?? null;
|
|
22
22
|
this.memoryAdapter = config.memory ?? null;
|
|
23
23
|
this.memoryRecallConfig = config.recall;
|
|
24
|
+
this.appraisalMode = config.appraisalMode ?? 'direct';
|
|
24
25
|
}
|
|
25
26
|
// ── Properties ──
|
|
26
27
|
get id() {
|
|
@@ -107,9 +108,13 @@ export class MolrooPersona {
|
|
|
107
108
|
relationshipContext: options?.relationshipContext,
|
|
108
109
|
}
|
|
109
110
|
: undefined;
|
|
111
|
+
// Pass ontologyEvent alongside event/context — API converts to appraisal internally
|
|
112
|
+
const ontologyEvent = (!options?.appraisal && options?.ontologyEvent)
|
|
113
|
+
? options.ontologyEvent
|
|
114
|
+
: undefined;
|
|
110
115
|
const { data } = await this.client.POST('/personas/{id}/perceive', {
|
|
111
116
|
params: { path: { id: this._personaId } },
|
|
112
|
-
body: { event, context },
|
|
117
|
+
body: { event, context, ...(ontologyEvent ? { ontologyEvent } : {}) },
|
|
113
118
|
});
|
|
114
119
|
const response = unwrap(data);
|
|
115
120
|
if (!options?.skipMemory && response.memoryEpisode && this.memoryAdapter) {
|
|
@@ -132,6 +137,7 @@ export class MolrooPersona {
|
|
|
132
137
|
memoryAdapter: this.memoryAdapter,
|
|
133
138
|
memoryRecallConfig: this.memoryRecallConfig,
|
|
134
139
|
events: this.events,
|
|
140
|
+
appraisalMode: this.appraisalMode,
|
|
135
141
|
getPromptContext: (suffix, source) => this.getPromptContext(suffix, source),
|
|
136
142
|
perceive: (msg, opts) => this.perceive(msg, opts),
|
|
137
143
|
searchMemory: (query) => this.searchMemory(query),
|
|
@@ -151,6 +157,33 @@ export class MolrooPersona {
|
|
|
151
157
|
body: { vad },
|
|
152
158
|
});
|
|
153
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Set StyleProfile extracted from a text corpus.
|
|
162
|
+
* Once set, expression constraints (promptText) are automatically
|
|
163
|
+
* included in getPromptContext() and modulated by current emotion.
|
|
164
|
+
*/
|
|
165
|
+
async setStyleProfile(profile) {
|
|
166
|
+
await this.client.POST('/personas/{id}/style-profile', {
|
|
167
|
+
params: { path: { id: this._personaId } },
|
|
168
|
+
body: { profile },
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Extract a StyleProfile from a text corpus and save it to this persona.
|
|
173
|
+
* Delegates extraction to the API server (keeps expression logic server-side).
|
|
174
|
+
*
|
|
175
|
+
* @param corpus - Array of messages from this persona's author (min 50 recommended)
|
|
176
|
+
* @param options - Optional extraction configuration (timestamps, otherMessages)
|
|
177
|
+
* @returns The extracted StyleProfile
|
|
178
|
+
*/
|
|
179
|
+
async extractStyleProfile(corpus, options) {
|
|
180
|
+
const { data } = await this.client.POST('/personas/{id}/style-profile/extract', {
|
|
181
|
+
params: { path: { id: this._personaId } },
|
|
182
|
+
body: { corpus, ...(options ? { options } : {}) },
|
|
183
|
+
});
|
|
184
|
+
const result = unwrap(data);
|
|
185
|
+
return result.styleProfile;
|
|
186
|
+
}
|
|
154
187
|
// ── State ──
|
|
155
188
|
async getState() {
|
|
156
189
|
const { data } = await this.client.GET('/personas/{id}/state', {
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -24,12 +24,16 @@ export interface InterlocutorContext {
|
|
|
24
24
|
type PerceiveBody = RequestBody<'/personas/{id}/perceive', 'post'>;
|
|
25
25
|
export type PerceiveEvent = PerceiveBody['event'];
|
|
26
26
|
export type PerceiveContext = NonNullable<PerceiveBody['context']>;
|
|
27
|
+
export type AppraisalMode = 'direct' | 'event';
|
|
27
28
|
/** Options for {@link MolrooPersona.perceive}. */
|
|
28
29
|
export interface PerceiveOptions {
|
|
29
30
|
/** Source entity — a name string or structured {@link InterlocutorContext}. */
|
|
30
31
|
from?: string | InterlocutorContext;
|
|
31
32
|
/** Pre-computed appraisal vector (maps to event.appraisal). */
|
|
32
33
|
appraisal?: AppraisalVector;
|
|
34
|
+
/** Ontology-classified event — API converts to appraisal internally.
|
|
35
|
+
* Mutually exclusive with `appraisal`; if both provided, `appraisal` takes precedence. */
|
|
36
|
+
ontologyEvent?: EventAppraisal;
|
|
33
37
|
/** Event type (default: 'chat_message'). */
|
|
34
38
|
type?: string;
|
|
35
39
|
/** Low-level stimulus overrides (bodyBudgetDelta, vadOverride, etc.). */
|
|
@@ -38,14 +42,22 @@ export interface PerceiveOptions {
|
|
|
38
42
|
payload?: Record<string, unknown>;
|
|
39
43
|
/** Prior episodic memories for context-aware appraisal. */
|
|
40
44
|
priorEpisodes?: Episode[];
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
/** Full relationship state for social update computation.
|
|
46
|
+
* When provided, the engine computes trust/intimacy/proximity deltas
|
|
47
|
+
* and emits socialUpdates in the response.
|
|
48
|
+
* Typically sourced from World-level storage (D1). */
|
|
49
|
+
relationshipContext?: Record<string, unknown>;
|
|
46
50
|
/** Skip saving memoryEpisode to the episode store. Default: false. */
|
|
47
51
|
skipMemory?: boolean;
|
|
48
52
|
}
|
|
53
|
+
export interface EventAppraisal {
|
|
54
|
+
interaction_type: 'chat' | 'inform' | 'humor' | 'express' | 'goodbye';
|
|
55
|
+
event_type?: 'praise' | 'criticism' | 'support' | 'rejection' | 'apology' | 'request' | 'betrayal' | 'neglect';
|
|
56
|
+
agent_role: 'user' | 'self' | 'other';
|
|
57
|
+
target_role: 'user' | 'self' | 'other';
|
|
58
|
+
relationship: 'friend' | 'romantic' | 'authority' | 'stranger';
|
|
59
|
+
intensity: number;
|
|
60
|
+
}
|
|
49
61
|
export type PersonaDynamicState = Record<string, unknown>;
|
|
50
62
|
export type BlendRatio = Record<string, number>;
|
|
51
63
|
export interface AgentResponse {
|
|
@@ -63,6 +75,7 @@ export interface AgentResponse {
|
|
|
63
75
|
stageTransition?: StageTransition;
|
|
64
76
|
maskExposure?: MaskExposure;
|
|
65
77
|
goalChanges?: GoalChanges;
|
|
78
|
+
behaviorModifiers?: Record<string, number>;
|
|
66
79
|
[key: string]: unknown;
|
|
67
80
|
}
|
|
68
81
|
export interface ApiResponse<T> {
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAI7C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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,MAAM,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molroo-io/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Unified SDK for molroo emotion engine — persona, world, LLM integration",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -25,24 +25,21 @@
|
|
|
25
25
|
"types": "./dist/cjs/world/index.d.ts",
|
|
26
26
|
"default": "./dist/cjs/world/index.js"
|
|
27
27
|
}
|
|
28
|
+
},
|
|
29
|
+
"./expression": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/esm/expression/index.d.ts",
|
|
32
|
+
"default": "./dist/esm/expression/index.js"
|
|
33
|
+
},
|
|
34
|
+
"require": {
|
|
35
|
+
"types": "./dist/cjs/expression/index.d.ts",
|
|
36
|
+
"default": "./dist/cjs/expression/index.js"
|
|
37
|
+
}
|
|
28
38
|
}
|
|
29
39
|
},
|
|
30
40
|
"files": [
|
|
31
41
|
"dist"
|
|
32
42
|
],
|
|
33
|
-
"scripts": {
|
|
34
|
-
"build": "rm -rf dist && tsc -p tsconfig.build.json && tsc -p tsconfig.esm.json",
|
|
35
|
-
"test": "vitest run",
|
|
36
|
-
"test:watch": "vitest",
|
|
37
|
-
"test:coverage": "vitest run --coverage",
|
|
38
|
-
"lint": "eslint src/",
|
|
39
|
-
"lint:fix": "eslint src/ --fix",
|
|
40
|
-
"format": "prettier --write 'src/**/*.ts'",
|
|
41
|
-
"format:check": "prettier --check 'src/**/*.ts'",
|
|
42
|
-
"clean": "rm -rf dist",
|
|
43
|
-
"docs": "typedoc",
|
|
44
|
-
"gen:types": "node ../../molroo-io/api/persona/scripts/dump-spec.mjs && openapi-typescript ../../molroo-io/api/persona/dist/openapi.json -o src/generated/api.d.ts"
|
|
45
|
-
},
|
|
46
43
|
"keywords": [
|
|
47
44
|
"emotion",
|
|
48
45
|
"persona",
|
|
@@ -91,7 +88,6 @@
|
|
|
91
88
|
}
|
|
92
89
|
},
|
|
93
90
|
"devDependencies": {
|
|
94
|
-
"@molroo-io/core": "workspace:*",
|
|
95
91
|
"@ai-sdk/anthropic": "^3.0.50",
|
|
96
92
|
"@ai-sdk/google-vertex": "^4.0.68",
|
|
97
93
|
"@ai-sdk/openai": "^3.0.37",
|
|
@@ -107,5 +103,18 @@
|
|
|
107
103
|
"typescript": "^5.3.3",
|
|
108
104
|
"typescript-eslint": "^8.56.0",
|
|
109
105
|
"vitest": "^4.0.18"
|
|
106
|
+
},
|
|
107
|
+
"scripts": {
|
|
108
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && tsc -p tsconfig.esm.json",
|
|
109
|
+
"test": "vitest run",
|
|
110
|
+
"test:watch": "vitest",
|
|
111
|
+
"test:coverage": "vitest run --coverage",
|
|
112
|
+
"lint": "eslint src/",
|
|
113
|
+
"lint:fix": "eslint src/ --fix",
|
|
114
|
+
"format": "prettier --write 'src/**/*.ts'",
|
|
115
|
+
"format:check": "prettier --check 'src/**/*.ts'",
|
|
116
|
+
"clean": "rm -rf dist",
|
|
117
|
+
"docs": "typedoc",
|
|
118
|
+
"gen:types": "node ../../molroo-io/api/persona/scripts/dump-spec.mjs && openapi-typescript ../../molroo-io/api/persona/dist/openapi.json -o src/generated/api.d.ts"
|
|
110
119
|
}
|
|
111
|
-
}
|
|
120
|
+
}
|