@molroo-io/sdk 0.7.2 → 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.
Files changed (45) hide show
  1. package/dist/cjs/emotion.d.ts +7 -0
  2. package/dist/cjs/emotion.d.ts.map +1 -0
  3. package/dist/cjs/emotion.js +15 -0
  4. package/dist/cjs/expression/index.d.ts +103 -0
  5. package/dist/cjs/expression/index.d.ts.map +1 -0
  6. package/dist/cjs/expression/index.js +18 -0
  7. package/dist/cjs/index.d.ts +3 -1
  8. package/dist/cjs/index.d.ts.map +1 -1
  9. package/dist/cjs/index.js +4 -1
  10. package/dist/cjs/llm/schema.d.ts +114 -0
  11. package/dist/cjs/llm/schema.d.ts.map +1 -1
  12. package/dist/cjs/llm/schema.js +44 -1
  13. package/dist/cjs/persona/chat-orchestrator.d.ts +2 -1
  14. package/dist/cjs/persona/chat-orchestrator.d.ts.map +1 -1
  15. package/dist/cjs/persona/chat-orchestrator.js +139 -33
  16. package/dist/cjs/persona.d.ts +26 -1
  17. package/dist/cjs/persona.d.ts.map +1 -1
  18. package/dist/cjs/persona.js +34 -1
  19. package/dist/cjs/types.d.ts +18 -5
  20. package/dist/cjs/types.d.ts.map +1 -1
  21. package/dist/cjs/world/world-persona.d.ts +3 -2
  22. package/dist/cjs/world/world-persona.d.ts.map +1 -1
  23. package/dist/esm/emotion.d.ts +7 -0
  24. package/dist/esm/emotion.d.ts.map +1 -0
  25. package/dist/esm/emotion.js +12 -0
  26. package/dist/esm/expression/index.d.ts +103 -0
  27. package/dist/esm/expression/index.d.ts.map +1 -0
  28. package/dist/esm/expression/index.js +17 -0
  29. package/dist/esm/index.d.ts +3 -1
  30. package/dist/esm/index.d.ts.map +1 -1
  31. package/dist/esm/index.js +2 -0
  32. package/dist/esm/llm/schema.d.ts +114 -0
  33. package/dist/esm/llm/schema.d.ts.map +1 -1
  34. package/dist/esm/llm/schema.js +43 -0
  35. package/dist/esm/persona/chat-orchestrator.d.ts +2 -1
  36. package/dist/esm/persona/chat-orchestrator.d.ts.map +1 -1
  37. package/dist/esm/persona/chat-orchestrator.js +139 -33
  38. package/dist/esm/persona.d.ts +26 -1
  39. package/dist/esm/persona.d.ts.map +1 -1
  40. package/dist/esm/persona.js +34 -1
  41. package/dist/esm/types.d.ts +18 -5
  42. package/dist/esm/types.d.ts.map +1 -1
  43. package/dist/esm/world/world-persona.d.ts +3 -2
  44. package/dist/esm/world/world-persona.d.ts.map +1 -1
  45. package/package.json +25 -15
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Canonical emotion labels — mirrors engine/core EMOTION_LABELS.
3
+ * Kept in sync via sdk/__tests__/emotion-labels-sync.test.ts.
4
+ */
5
+ export declare const EMOTION_LABELS: readonly ["joy", "excitement", "contentment", "love", "pride", "gratitude", "amusement", "relief", "anger", "fear", "sadness", "anxiety", "disgust", "shame", "guilt", "surprise", "trust", "calm", "numbness"];
6
+ export type EmotionLabel = (typeof EMOTION_LABELS)[number];
7
+ //# sourceMappingURL=emotion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emotion.d.ts","sourceRoot":"","sources":["../../src/emotion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,cAAc,iNAOjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EMOTION_LABELS = void 0;
4
+ /**
5
+ * Canonical emotion labels — mirrors engine/core EMOTION_LABELS.
6
+ * Kept in sync via sdk/__tests__/emotion-labels-sync.test.ts.
7
+ */
8
+ exports.EMOTION_LABELS = [
9
+ // Positive (8)
10
+ 'joy', 'excitement', 'contentment', 'love', 'pride', 'gratitude', 'amusement', 'relief',
11
+ // Negative (7)
12
+ 'anger', 'fear', 'sadness', 'anxiety', 'disgust', 'shame', 'guilt',
13
+ // Neutral / Mixed (4)
14
+ 'surprise', 'trust', 'calm', 'numbness',
15
+ ];
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @molroo-io/sdk/expression — StyleProfile type definitions
3
+ *
4
+ * Style extraction is now handled server-side via the API.
5
+ * Use `persona.extractStyleProfile(corpus)` to extract and save a StyleProfile.
6
+ *
7
+ * Types inlined from @molroo-io/expression (private package).
8
+ * These must stay in sync with lib/expression/src/types/index.ts.
9
+ *
10
+ * Usage:
11
+ * ```typescript
12
+ * import type { StyleProfile } from '@molroo-io/sdk/expression';
13
+ *
14
+ * const profile = await persona.extractStyleProfile(chatCorpus);
15
+ * ```
16
+ */
17
+ export interface ExtractionOptions {
18
+ /** Timestamps for turn grouping (same length as messages) */
19
+ timestamps?: number[];
20
+ /** Messages from other participants (for TF-IDF signature detection) */
21
+ otherMessages?: string[];
22
+ }
23
+ export interface LexicalFeatures {
24
+ /** Type-Token Ratio: unique_words / total_words */
25
+ vocabRichness: number;
26
+ /** Yule's K characteristic: 10^4 * (M2 - M1) / M1^2 */
27
+ yuleK: number;
28
+ /** Words appearing only once / total words */
29
+ hapaxRatio: number;
30
+ /** Average word length in characters */
31
+ avgWordLength: number;
32
+ /** Function word (particles, conjunctions) frequency distribution */
33
+ functionWordDist: Record<string, number>;
34
+ }
35
+ export interface StructuralFeatures {
36
+ /** Average message length in characters */
37
+ avgMessageLength: number;
38
+ /** Standard deviation of message length */
39
+ messageLengthStd: number;
40
+ /** Ratio of turns with multiple messages */
41
+ multiMessageRatio: number;
42
+ /** Average number of messages per turn */
43
+ avgMessagesPerTurn: number;
44
+ /** Ratio of messages ending with ? */
45
+ questionRatio: number;
46
+ }
47
+ export interface PunctuationFeatures {
48
+ /** Period usage style */
49
+ periodStyle: 'none' | 'single' | 'double' | 'triple';
50
+ /** Emoji count per message (mean) */
51
+ emojiFrequency: number;
52
+ /** Top N most-used emoji */
53
+ emojiSet: string[];
54
+ /** Laugh expression patterns (e.g. ㅋㅋ, ㅎㅎ, ㅋㅋㅋㅋ) */
55
+ laughStyle: string[];
56
+ /** Laugh expressions per message (mean) */
57
+ laughFrequency: number;
58
+ /** Exclamation mark usage rate */
59
+ exclamationRate: number;
60
+ /** Ellipsis (...) usage rate */
61
+ ellipsisRate: number;
62
+ }
63
+ export interface RegisterFeatures {
64
+ /** 0 (casual/banmal) ~ 1 (formal/jondaenmal) */
65
+ formalityScore: number;
66
+ /** Honorific patterns used */
67
+ honorificPatterns: string[];
68
+ /** How the person addresses the interlocutor */
69
+ addressTerms: string[];
70
+ }
71
+ export interface IdiosyncraticFeatures {
72
+ /** Filler words (아, 음, 근데, etc.) */
73
+ fillerWords: string[];
74
+ /** Contraction patterns (ㄱㅊ, ㅇㅇ, ㄴㄴ, etc.) */
75
+ contractions: string[];
76
+ /** Statistically significant personal expressions */
77
+ signaturePatterns: string[];
78
+ /** Sentence ending pattern distribution */
79
+ sentenceEnders: Record<string, number>;
80
+ }
81
+ export interface ResponsePatterns {
82
+ /** Ratio of conversation initiations */
83
+ initiationRatio: number;
84
+ /** Topic change style description */
85
+ topicChangeStyle: string;
86
+ }
87
+ export interface StatisticalSignature {
88
+ /** Character n-gram frequency distribution (n=2,3) */
89
+ charNgramDist: Record<string, number>;
90
+ /** Word n-gram frequency distribution (n=2) */
91
+ wordNgramDist: Record<string, number>;
92
+ }
93
+ /** Complete individual expression fingerprint */
94
+ export interface StyleProfile {
95
+ lexical: LexicalFeatures;
96
+ structural: StructuralFeatures;
97
+ punctuation: PunctuationFeatures;
98
+ register: RegisterFeatures;
99
+ idiosyncratic: IdiosyncraticFeatures;
100
+ response: ResponsePatterns;
101
+ signature: StatisticalSignature;
102
+ }
103
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/expression/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,UAAU,CAAC,EA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M,WAAW,qBAAqB;IACpC,oCAAoC;IACpC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,8CAA8C;IAC9C,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,qDAAqD;IACrD,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,sDAAsD;IACtD,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,+CAA+C;IAC/C,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,WAAW,EAAE,mBAAmB,CAAC;IACjC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,aAAa,EAAE,qBAAqB,CAAC;IACrC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,EAAE,oBAAoB,CAAC;CACjC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * @molroo-io/sdk/expression — StyleProfile type definitions
4
+ *
5
+ * Style extraction is now handled server-side via the API.
6
+ * Use `persona.extractStyleProfile(corpus)` to extract and save a StyleProfile.
7
+ *
8
+ * Types inlined from @molroo-io/expression (private package).
9
+ * These must stay in sync with lib/expression/src/types/index.ts.
10
+ *
11
+ * Usage:
12
+ * ```typescript
13
+ * import type { StyleProfile } from '@molroo-io/sdk/expression';
14
+ *
15
+ * const profile = await persona.extractStyleProfile(chatCorpus);
16
+ * ```
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -37,10 +37,12 @@ export type { LLMAdapter, Message, GenerateTextOptions, GenerateObjectOptions, }
37
37
  export type { LLMInput } from './llm/resolve';
38
38
  export type { MemoryAdapter, RecallQuery, SemanticRecallOptions, RecallLimits, Reflection, } from './memory/types';
39
39
  export type { PersonaSummary, PersonaState, PersonaChatResult, } from './persona';
40
- export type { InterlocutorContext, PerceiveOptions, PerceiveEvent, PerceiveContext, } from './types';
40
+ export type { AppraisalMode, EventAppraisal, InterlocutorContext, PerceiveOptions, PerceiveEvent, PerceiveContext, } from './types';
41
41
  export type { AgentResponse, VAD, Velocity, AppraisalVector, State, SoulStage, CatastropheState, MetacogState, AffectDynamicsState, InterpersonalState, RegulationState, RegulationStrategy, RegulationPhase, ActiveRegulation, RegulationRecord, EffectivenessRecord, NeedState, Episode, SocialUpdate, ReflectionPrompt, } from './types';
42
42
  export type { PersonaSnapshot, PersonaConfigData, PersonalityTraits, Identity, Goal, MotivationContext, } from './types';
43
43
  export type { ApiResponse, ApiErrorResponse, PersonaDynamicState, } from './types';
44
44
  export type { LLMPrompt, LLMResponse, } from './llm/types';
45
+ export { EMOTION_LABELS } from './emotion';
46
+ export type { EmotionLabel } from './emotion';
45
47
  export { DEFAULT_PERSONA, withDefaults } from './defaults';
46
48
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC3F,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD,YAAY,EACV,UAAU,EACV,OAAO,EACP,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,YAAY,EACV,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,YAAY,EACZ,UAAU,GACX,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,cAAc,EACd,YAAY,EACZ,iBAAiB,GAClB,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,eAAe,GAChB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,aAAa,EACb,GAAG,EACH,QAAQ,EACR,eAAe,EACf,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,EACT,OAAO,EACP,YAAY,EACZ,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,EACR,IAAI,EACJ,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,SAAS,EACT,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE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AAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -30,7 +30,7 @@
30
30
  * ```
31
31
  */
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.withDefaults = exports.DEFAULT_PERSONA = exports.fromWireAppraisal = exports.toWireAppraisal = exports.NEUTRAL_APPRAISAL = exports.WorldApiError = exports.MolrooApiError = exports.Molroo = void 0;
33
+ exports.withDefaults = exports.DEFAULT_PERSONA = exports.EMOTION_LABELS = exports.fromWireAppraisal = exports.toWireAppraisal = exports.NEUTRAL_APPRAISAL = exports.WorldApiError = exports.MolrooApiError = exports.Molroo = void 0;
34
34
  // ── Main exports ──
35
35
  var world_1 = require("./world/world");
36
36
  Object.defineProperty(exports, "Molroo", { enumerable: true, get: function () { return world_1.Molroo; } });
@@ -42,6 +42,9 @@ var appraisal_1 = require("./shared/appraisal");
42
42
  Object.defineProperty(exports, "NEUTRAL_APPRAISAL", { enumerable: true, get: function () { return appraisal_1.NEUTRAL_APPRAISAL; } });
43
43
  Object.defineProperty(exports, "toWireAppraisal", { enumerable: true, get: function () { return appraisal_1.toWireAppraisal; } });
44
44
  Object.defineProperty(exports, "fromWireAppraisal", { enumerable: true, get: function () { return appraisal_1.fromWireAppraisal; } });
45
+ // ── Emotion labels (synced with engine/core) ──
46
+ var emotion_1 = require("./emotion");
47
+ Object.defineProperty(exports, "EMOTION_LABELS", { enumerable: true, get: function () { return emotion_1.EMOTION_LABELS; } });
45
48
  // ── Defaults ──
46
49
  var defaults_1 = require("./defaults");
47
50
  Object.defineProperty(exports, "DEFAULT_PERSONA", { enumerable: true, get: function () { return defaults_1.DEFAULT_PERSONA; } });
@@ -18,6 +18,43 @@ export declare const AppraisalVectorSchema: z.ZodObject<{
18
18
  adjustment_potential: z.ZodPipe<z.ZodNumber, z.ZodTransform<number, number>>;
19
19
  urgency: z.ZodPipe<z.ZodNumber, z.ZodTransform<number, number>>;
20
20
  }, z.core.$strip>;
21
+ export declare const EventAppraisalSchema: z.ZodObject<{
22
+ interaction_type: z.ZodEnum<{
23
+ chat: "chat";
24
+ inform: "inform";
25
+ humor: "humor";
26
+ express: "express";
27
+ goodbye: "goodbye";
28
+ }>;
29
+ event_type: z.ZodOptional<z.ZodEnum<{
30
+ praise: "praise";
31
+ criticism: "criticism";
32
+ support: "support";
33
+ rejection: "rejection";
34
+ apology: "apology";
35
+ request: "request";
36
+ betrayal: "betrayal";
37
+ neglect: "neglect";
38
+ }>>;
39
+ agent_role: z.ZodEnum<{
40
+ user: "user";
41
+ self: "self";
42
+ other: "other";
43
+ }>;
44
+ target_role: z.ZodEnum<{
45
+ user: "user";
46
+ self: "self";
47
+ other: "other";
48
+ }>;
49
+ relationship: z.ZodEnum<{
50
+ friend: "friend";
51
+ romantic: "romantic";
52
+ authority: "authority";
53
+ stranger: "stranger";
54
+ }>;
55
+ intensity: z.ZodPipe<z.ZodNumber, z.ZodTransform<number, number>>;
56
+ }, z.core.$strip>;
57
+ export type EventAppraisalOutput = z.infer<typeof EventAppraisalSchema>;
21
58
  /**
22
59
  * Full LLM response schema — response text + appraisal vector.
23
60
  */
@@ -36,6 +73,44 @@ export declare const LLMResponseSchema: z.ZodObject<{
36
73
  }, z.core.$strip>;
37
74
  }, z.core.$strip>;
38
75
  export type LLMResponseOutput = z.infer<typeof LLMResponseSchema>;
76
+ export declare const LLMEventResponseSchema: z.ZodObject<{
77
+ response: z.ZodString;
78
+ interaction_type: z.ZodEnum<{
79
+ chat: "chat";
80
+ inform: "inform";
81
+ humor: "humor";
82
+ express: "express";
83
+ goodbye: "goodbye";
84
+ }>;
85
+ event_type: z.ZodOptional<z.ZodEnum<{
86
+ praise: "praise";
87
+ criticism: "criticism";
88
+ support: "support";
89
+ rejection: "rejection";
90
+ apology: "apology";
91
+ request: "request";
92
+ betrayal: "betrayal";
93
+ neglect: "neglect";
94
+ }>>;
95
+ agent_role: z.ZodEnum<{
96
+ user: "user";
97
+ self: "self";
98
+ other: "other";
99
+ }>;
100
+ target_role: z.ZodEnum<{
101
+ user: "user";
102
+ self: "self";
103
+ other: "other";
104
+ }>;
105
+ relationship: z.ZodEnum<{
106
+ friend: "friend";
107
+ romantic: "romantic";
108
+ authority: "authority";
109
+ stranger: "stranger";
110
+ }>;
111
+ intensity: z.ZodPipe<z.ZodNumber, z.ZodTransform<number, number>>;
112
+ }, z.core.$strip>;
113
+ export type LLMEventResponseOutput = z.infer<typeof LLMEventResponseSchema>;
39
114
  /**
40
115
  * Tool-use aware LLM response schema.
41
116
  * The LLM can either produce a normal response or request a memory search.
@@ -57,4 +132,43 @@ export declare const LLMResponseWithToolsSchema: z.ZodObject<{
57
132
  search_memory: z.ZodOptional<z.ZodString>;
58
133
  }, z.core.$strip>;
59
134
  export type LLMResponseWithToolsOutput = z.infer<typeof LLMResponseWithToolsSchema>;
135
+ export declare const LLMEventResponseWithToolsSchema: z.ZodObject<{
136
+ response: z.ZodString;
137
+ interaction_type: z.ZodEnum<{
138
+ chat: "chat";
139
+ inform: "inform";
140
+ humor: "humor";
141
+ express: "express";
142
+ goodbye: "goodbye";
143
+ }>;
144
+ event_type: z.ZodOptional<z.ZodEnum<{
145
+ praise: "praise";
146
+ criticism: "criticism";
147
+ support: "support";
148
+ rejection: "rejection";
149
+ apology: "apology";
150
+ request: "request";
151
+ betrayal: "betrayal";
152
+ neglect: "neglect";
153
+ }>>;
154
+ agent_role: z.ZodEnum<{
155
+ user: "user";
156
+ self: "self";
157
+ other: "other";
158
+ }>;
159
+ target_role: z.ZodEnum<{
160
+ user: "user";
161
+ self: "self";
162
+ other: "other";
163
+ }>;
164
+ relationship: z.ZodEnum<{
165
+ friend: "friend";
166
+ romantic: "romantic";
167
+ authority: "authority";
168
+ stranger: "stranger";
169
+ }>;
170
+ intensity: z.ZodPipe<z.ZodNumber, z.ZodTransform<number, number>>;
171
+ search_memory: z.ZodOptional<z.ZodString>;
172
+ }, z.core.$strip>;
173
+ export type LLMEventResponseWithToolsOutput = z.infer<typeof LLMEventResponseWithToolsSchema>;
60
174
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/llm/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;iBAuDhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;iBAK5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;iBAarC,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/llm/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;iBAuDhC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoB/B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;iBAK5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQjC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;iBAarC,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEpF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgB1C,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
@@ -1,7 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LLMResponseWithToolsSchema = exports.LLMResponseSchema = exports.AppraisalVectorSchema = void 0;
3
+ exports.LLMEventResponseWithToolsSchema = exports.LLMResponseWithToolsSchema = exports.LLMEventResponseSchema = exports.LLMResponseSchema = exports.EventAppraisalSchema = exports.AppraisalVectorSchema = void 0;
4
4
  const zod_1 = require("zod");
5
+ // Ontology constants inlined from @molroo-io/core (private package).
6
+ // These must stay in sync with engine/core/src/modules/ontology/types.ts.
7
+ const INTERACTION_TYPES = ['chat', 'inform', 'humor', 'express', 'goodbye'];
8
+ const EVENT_TYPES = [
9
+ 'praise', 'criticism', 'support', 'rejection',
10
+ 'apology', 'request', 'betrayal', 'neglect',
11
+ ];
12
+ const AGENT_ROLES = ['user', 'self', 'other'];
13
+ const TARGET_ROLES = ['user', 'self', 'other'];
14
+ const RELATIONSHIP_TYPES = ['friend', 'romantic', 'authority', 'stranger'];
5
15
  /** Clamp a number to [lo, hi]. */
6
16
  const clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v));
7
17
  /**
@@ -50,6 +60,17 @@ exports.AppraisalVectorSchema = zod_1.z.object({
50
60
  .describe('How much time pressure or immediate action is needed? 0: settled/past event/no rush, 0.5: moderate, 1: immediate action required/acute emergency. For past losses: low. For active threats: high. Use 0-1 range.')
51
61
  .transform((v) => clamp(v, 0, 1)),
52
62
  });
63
+ exports.EventAppraisalSchema = zod_1.z.object({
64
+ interaction_type: zod_1.z.enum(INTERACTION_TYPES).describe('Conversation mode: chat (small talk), inform (sharing info/news), humor (jokes), express (emotional/relational event), goodbye (farewell).'),
65
+ event_type: zod_1.z.enum(EVENT_TYPES).optional().describe('Relationship event type. Required when interaction_type is "express". Omit for chat/inform/humor/goodbye. One of: praise, criticism, support, rejection, apology, request, betrayal, neglect.'),
66
+ agent_role: zod_1.z.enum(AGENT_ROLES).describe('Primary role responsible for the event from the persona perspective: user, self, or other.'),
67
+ target_role: zod_1.z.enum(TARGET_ROLES).describe('Who is affected by or receives the event: self (persona), user (conversation partner), or other (third party).'),
68
+ relationship: zod_1.z.enum(RELATIONSHIP_TYPES).describe('Relationship context for this event: friend, romantic, authority, or stranger.'),
69
+ intensity: zod_1.z
70
+ .number()
71
+ .describe('Impact strength from 0 to 1.5. Use 1.0 for a normal event and >1.0 for unusually strong events.')
72
+ .transform((v) => clamp(v, 0, 1.5)),
73
+ });
53
74
  /**
54
75
  * Full LLM response schema — response text + appraisal vector.
55
76
  */
@@ -57,6 +78,15 @@ exports.LLMResponseSchema = zod_1.z.object({
57
78
  response: zod_1.z.string().describe('Response message from persona to user'),
58
79
  appraisal: exports.AppraisalVectorSchema.describe("Scherer 9-dimensional emotion appraisal of user input from persona's perspective"),
59
80
  });
81
+ exports.LLMEventResponseSchema = zod_1.z.object({
82
+ response: zod_1.z.string().describe('Response message from persona to user'),
83
+ interaction_type: exports.EventAppraisalSchema.shape.interaction_type,
84
+ event_type: exports.EventAppraisalSchema.shape.event_type,
85
+ agent_role: exports.EventAppraisalSchema.shape.agent_role,
86
+ target_role: exports.EventAppraisalSchema.shape.target_role,
87
+ relationship: exports.EventAppraisalSchema.shape.relationship,
88
+ intensity: exports.EventAppraisalSchema.shape.intensity,
89
+ });
60
90
  /**
61
91
  * Tool-use aware LLM response schema.
62
92
  * The LLM can either produce a normal response or request a memory search.
@@ -70,3 +100,16 @@ exports.LLMResponseWithToolsSchema = zod_1.z.object({
70
100
  .optional()
71
101
  .describe('If you need to recall a specific memory before responding, set this to your search query. Leave empty/omit when you can respond without searching.'),
72
102
  });
103
+ exports.LLMEventResponseWithToolsSchema = zod_1.z.object({
104
+ response: zod_1.z.string().describe('Response message from persona to user. Set to empty string "" if you need to search memory first.'),
105
+ interaction_type: exports.EventAppraisalSchema.shape.interaction_type,
106
+ event_type: exports.EventAppraisalSchema.shape.event_type,
107
+ agent_role: exports.EventAppraisalSchema.shape.agent_role,
108
+ target_role: exports.EventAppraisalSchema.shape.target_role,
109
+ relationship: exports.EventAppraisalSchema.shape.relationship,
110
+ intensity: exports.EventAppraisalSchema.shape.intensity,
111
+ search_memory: zod_1.z
112
+ .string()
113
+ .optional()
114
+ .describe('If you need to recall a specific memory before responding, set this to your search query. Leave empty/omit when you can respond without searching.'),
115
+ });
@@ -5,7 +5,7 @@
5
5
  * All external dependencies are injected via ChatOrchestratorDeps.
6
6
  */
7
7
  import type { LLMAdapter, Message } from '../llm/adapter';
8
- import type { AgentResponse, InterlocutorContext, PerceiveOptions } from '../types';
8
+ import type { AgentResponse, AppraisalMode, InterlocutorContext, PerceiveOptions } from '../types';
9
9
  import type { RecallLimits } from '../memory/types';
10
10
  import type { MemoryAdapter } from '../memory/types';
11
11
  import type { EventAdapter } from '../events/types';
@@ -21,6 +21,7 @@ export interface ChatOrchestratorDeps {
21
21
  memoryAdapter: MemoryAdapter | null;
22
22
  memoryRecallConfig: RecallLimits | undefined;
23
23
  events: EventAdapter | null;
24
+ appraisalMode: AppraisalMode;
24
25
  getPromptContext: (consumerSuffix?: string, sourceEntity?: string) => Promise<PromptContextResult>;
25
26
  perceive: (message: string, options?: PerceiveOptions) => Promise<AgentResponse>;
26
27
  searchMemory: (query: string) => Promise<Array<Record<string, unknown>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"chat-orchestrator.d.ts","sourceRoot":"","sources":["../../../src/persona/chat-orchestrator.ts"],"names":[],"mappings":"AAAA;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