soulbridge 0.0.8 → 0.0.9
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.
|
@@ -67,7 +67,10 @@ export declare class Soul {
|
|
|
67
67
|
visibility?: Visibility;
|
|
68
68
|
}): string;
|
|
69
69
|
/** Verb 4: session end. */
|
|
70
|
-
reflect(turns: Turn[],
|
|
70
|
+
reflect(turns: Turn[], options?: {
|
|
71
|
+
llm?: LlmFn;
|
|
72
|
+
updateEmotion?: boolean;
|
|
73
|
+
}): Promise<ReflectResult>;
|
|
71
74
|
stats(): {
|
|
72
75
|
memories: number;
|
|
73
76
|
emotion: Emotion;
|
|
@@ -139,8 +139,14 @@ export class Soul {
|
|
|
139
139
|
return id;
|
|
140
140
|
}
|
|
141
141
|
/** Verb 4: session end. */
|
|
142
|
-
async reflect(turns,
|
|
143
|
-
return reflect(this.store, {
|
|
142
|
+
async reflect(turns, options = {}) {
|
|
143
|
+
return reflect(this.store, {
|
|
144
|
+
soulId: this.soulId,
|
|
145
|
+
userId: this.userId,
|
|
146
|
+
turns,
|
|
147
|
+
llm: options.llm,
|
|
148
|
+
updateEmotion: options.updateEmotion,
|
|
149
|
+
});
|
|
144
150
|
}
|
|
145
151
|
stats() {
|
|
146
152
|
return {
|
|
@@ -34,6 +34,12 @@ export interface ReflectOptions {
|
|
|
34
34
|
userId: string;
|
|
35
35
|
turns: Turn[];
|
|
36
36
|
now?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Whether this call also advances emotion (default true). A caller that runs
|
|
39
|
+
* reflect per turn, alongside observe(), must pass false or the turn is
|
|
40
|
+
* counted twice.
|
|
41
|
+
*/
|
|
42
|
+
updateEmotion?: boolean;
|
|
37
43
|
/** Reserved for richer extraction; unused in v0. */
|
|
38
44
|
llm?: LlmFn;
|
|
39
45
|
}
|
|
@@ -144,7 +144,10 @@ export async function reflect(store, options) {
|
|
|
144
144
|
store.put(memory);
|
|
145
145
|
written += 1;
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
let emotion = store.emotion(options.soulId, options.userId);
|
|
148
|
+
if (options.updateEmotion !== false) {
|
|
149
|
+
emotion = nextEmotion(emotion, options.turns);
|
|
150
|
+
store.saveEmotion(options.soulId, options.userId, emotion);
|
|
151
|
+
}
|
|
149
152
|
return { memories: written, superseded: 0, emotion };
|
|
150
153
|
}
|