@auxiora/personality 1.0.0 → 1.3.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.
Files changed (162) hide show
  1. package/dist/__tests__/architect-awareness-collector.test.d.ts +2 -0
  2. package/dist/__tests__/architect-awareness-collector.test.d.ts.map +1 -0
  3. package/dist/__tests__/architect-awareness-collector.test.js +57 -0
  4. package/dist/__tests__/architect-awareness-collector.test.js.map +1 -0
  5. package/dist/__tests__/architect-bridge.test.d.ts +2 -0
  6. package/dist/__tests__/architect-bridge.test.d.ts.map +1 -0
  7. package/dist/__tests__/architect-bridge.test.js +59 -0
  8. package/dist/__tests__/architect-bridge.test.js.map +1 -0
  9. package/dist/__tests__/soul-bias-parser.test.d.ts +2 -0
  10. package/dist/__tests__/soul-bias-parser.test.d.ts.map +1 -0
  11. package/dist/__tests__/soul-bias-parser.test.js +47 -0
  12. package/dist/__tests__/soul-bias-parser.test.js.map +1 -0
  13. package/dist/architect-awareness-collector.d.ts +20 -0
  14. package/dist/architect-awareness-collector.d.ts.map +1 -0
  15. package/dist/architect-awareness-collector.js +41 -0
  16. package/dist/architect-awareness-collector.js.map +1 -0
  17. package/dist/architect-bridge.d.ts +35 -0
  18. package/dist/architect-bridge.d.ts.map +1 -0
  19. package/dist/architect-bridge.js +70 -0
  20. package/dist/architect-bridge.js.map +1 -0
  21. package/dist/index.d.ts +5 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +6 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/marketplace/schema.d.ts +6 -6
  26. package/dist/soul-bias-parser.d.ts +10 -0
  27. package/dist/soul-bias-parser.d.ts.map +1 -0
  28. package/dist/soul-bias-parser.js +48 -0
  29. package/dist/soul-bias-parser.js.map +1 -0
  30. package/lib/context-detector.d.ts +23 -0
  31. package/lib/context-detector.js +275 -0
  32. package/lib/context-profiles.d.ts +3 -0
  33. package/lib/context-profiles.js +550 -0
  34. package/lib/conversation-context.d.ts +70 -0
  35. package/lib/conversation-context.js +144 -0
  36. package/lib/conversation-export.d.ts +77 -0
  37. package/lib/conversation-export.js +254 -0
  38. package/lib/correction-store.d.ts +53 -0
  39. package/lib/correction-store.js +185 -0
  40. package/lib/custom-weights.d.ts +43 -0
  41. package/lib/custom-weights.js +164 -0
  42. package/lib/emotional-overrides.d.ts +14 -0
  43. package/lib/emotional-overrides.js +86 -0
  44. package/lib/emotional-tracker.d.ts +41 -0
  45. package/lib/emotional-tracker.js +210 -0
  46. package/lib/index.d.ts +161 -0
  47. package/lib/index.d.ts.map +1 -0
  48. package/lib/index.js +486 -0
  49. package/lib/index.js.map +1 -0
  50. package/lib/persistence-adapter.d.ts +55 -0
  51. package/lib/persistence-adapter.js +50 -0
  52. package/lib/persistence.d.ts +49 -0
  53. package/lib/persistence.js +116 -0
  54. package/lib/prompt-assembler.d.ts +16 -0
  55. package/lib/prompt-assembler.js +66 -0
  56. package/lib/recommender.d.ts +25 -0
  57. package/lib/recommender.js +125 -0
  58. package/lib/schema.d.ts +173 -0
  59. package/lib/schema.d.ts.map +1 -0
  60. package/lib/schema.js +2 -0
  61. package/lib/schema.js.map +1 -0
  62. package/lib/source-map.d.ts +9 -0
  63. package/lib/source-map.js +223 -0
  64. package/lib/system-prompt.d.ts +2 -0
  65. package/lib/system-prompt.js +102 -0
  66. package/lib/the-architect/context-detector.d.ts +23 -0
  67. package/lib/the-architect/context-detector.d.ts.map +1 -0
  68. package/lib/the-architect/context-detector.js +275 -0
  69. package/lib/the-architect/context-detector.js.map +1 -0
  70. package/lib/the-architect/context-profiles.d.ts +3 -0
  71. package/lib/the-architect/context-profiles.d.ts.map +1 -0
  72. package/lib/the-architect/context-profiles.js +550 -0
  73. package/lib/the-architect/context-profiles.js.map +1 -0
  74. package/lib/the-architect/conversation-context.d.ts +70 -0
  75. package/lib/the-architect/conversation-context.js +144 -0
  76. package/lib/the-architect/conversation-context.js.map +1 -0
  77. package/lib/the-architect/conversation-export.d.ts +77 -0
  78. package/lib/the-architect/conversation-export.js +254 -0
  79. package/lib/the-architect/correction-store.d.ts +53 -0
  80. package/lib/the-architect/correction-store.d.ts.map +1 -0
  81. package/lib/the-architect/correction-store.js +185 -0
  82. package/lib/the-architect/correction-store.js.map +1 -0
  83. package/lib/the-architect/custom-weights.d.ts +43 -0
  84. package/lib/the-architect/custom-weights.js +164 -0
  85. package/lib/the-architect/emotional-overrides.d.ts +14 -0
  86. package/lib/the-architect/emotional-overrides.d.ts.map +1 -0
  87. package/lib/the-architect/emotional-overrides.js +86 -0
  88. package/lib/the-architect/emotional-overrides.js.map +1 -0
  89. package/lib/the-architect/emotional-tracker.d.ts +41 -0
  90. package/lib/the-architect/emotional-tracker.js +210 -0
  91. package/lib/the-architect/index.d.ts +161 -0
  92. package/lib/the-architect/index.d.ts.map +1 -0
  93. package/lib/the-architect/index.js +486 -0
  94. package/lib/the-architect/index.js.map +1 -0
  95. package/lib/the-architect/persistence-adapter.d.ts +55 -0
  96. package/lib/the-architect/persistence-adapter.js +50 -0
  97. package/lib/the-architect/persistence.d.ts +49 -0
  98. package/lib/the-architect/persistence.js +116 -0
  99. package/lib/the-architect/prompt-assembler.d.ts +16 -0
  100. package/lib/the-architect/prompt-assembler.d.ts.map +1 -0
  101. package/lib/the-architect/prompt-assembler.js +66 -0
  102. package/lib/the-architect/prompt-assembler.js.map +1 -0
  103. package/lib/the-architect/recommender.d.ts +25 -0
  104. package/lib/the-architect/recommender.js +125 -0
  105. package/lib/the-architect/source-map.d.ts +9 -0
  106. package/lib/the-architect/source-map.d.ts.map +1 -0
  107. package/lib/the-architect/source-map.js +223 -0
  108. package/lib/the-architect/source-map.js.map +1 -0
  109. package/lib/the-architect/system-prompt.d.ts +2 -0
  110. package/lib/the-architect/system-prompt.d.ts.map +1 -0
  111. package/lib/the-architect/system-prompt.js +102 -0
  112. package/lib/the-architect/system-prompt.js.map +1 -0
  113. package/lib/the-architect/trait-to-instruction.d.ts +12 -0
  114. package/lib/the-architect/trait-to-instruction.d.ts.map +1 -0
  115. package/lib/the-architect/trait-to-instruction.js +330 -0
  116. package/lib/the-architect/trait-to-instruction.js.map +1 -0
  117. package/lib/trait-to-instruction.d.ts +12 -0
  118. package/lib/trait-to-instruction.js +330 -0
  119. package/package.json +15 -3
  120. package/modes/advisor.md +0 -24
  121. package/modes/analyst.md +0 -25
  122. package/modes/companion.md +0 -24
  123. package/modes/legal.md +0 -1188
  124. package/modes/operator.md +0 -24
  125. package/modes/roast.md +0 -24
  126. package/modes/socratic.md +0 -24
  127. package/modes/writer.md +0 -23
  128. package/src/__tests__/builder.test.ts +0 -78
  129. package/src/__tests__/conversation-builder.test.ts +0 -386
  130. package/src/__tests__/escalation.test.ts +0 -172
  131. package/src/__tests__/manager.test.ts +0 -141
  132. package/src/__tests__/parser.test.ts +0 -101
  133. package/src/__tests__/security-floor.test.ts +0 -212
  134. package/src/builder.ts +0 -75
  135. package/src/conversation-builder.ts +0 -279
  136. package/src/escalation.ts +0 -162
  137. package/src/index.ts +0 -55
  138. package/src/manager.ts +0 -119
  139. package/src/marketplace/__tests__/scanner.test.ts +0 -159
  140. package/src/marketplace/__tests__/schema.test.ts +0 -269
  141. package/src/marketplace/scanner.ts +0 -85
  142. package/src/marketplace/schema.ts +0 -141
  143. package/src/modes/__tests__/mode-detector.test.ts +0 -149
  144. package/src/modes/__tests__/mode-loader.test.ts +0 -143
  145. package/src/modes/__tests__/prompt-assembler.test.ts +0 -291
  146. package/src/modes/mode-detector.ts +0 -84
  147. package/src/modes/mode-loader.ts +0 -105
  148. package/src/modes/prompt-assembler.ts +0 -278
  149. package/src/modes/types.ts +0 -67
  150. package/src/parser.ts +0 -132
  151. package/src/security-floor.ts +0 -147
  152. package/src/types.ts +0 -27
  153. package/src/voice-profiles.ts +0 -88
  154. package/templates/chill.md +0 -30
  155. package/templates/creative.md +0 -29
  156. package/templates/friendly.md +0 -28
  157. package/templates/mentor.md +0 -31
  158. package/templates/minimal.md +0 -24
  159. package/templates/professional.md +0 -28
  160. package/templates/technical.md +0 -30
  161. package/tsconfig.json +0 -12
  162. package/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,210 @@
1
+ // ────────────────────────────────────────────────────────────────────────────
2
+ // Constants
3
+ // ────────────────────────────────────────────────────────────────────────────
4
+ /** How many recent messages the sliding window considers. */
5
+ const WINDOW_SIZE = 5;
6
+ /** Emotions considered negative for escalation detection. */
7
+ const NEGATIVE_EMOTIONS = new Set(['frustrated', 'stressed']);
8
+ /** Minimum consecutive negative-and-increasing entries for escalation. */
9
+ const ESCALATION_MIN_STREAK = 3;
10
+ /** Minimum messages and intensity threshold for escalation alert. */
11
+ const ALERT_MIN_MESSAGES = 4;
12
+ const ALERT_INTENSITY_THRESHOLD = 0.7;
13
+ /** Minimum emotion changes in the window for volatile classification. */
14
+ const VOLATILE_CHANGE_THRESHOLD = 3;
15
+ // ────────────────────────────────────────────────────────────────────────────
16
+ // Intensity estimation
17
+ // ────────────────────────────────────────────────────────────────────────────
18
+ /**
19
+ * Estimate emotional intensity from message text.
20
+ *
21
+ * Heuristic signals:
22
+ * - Excessive punctuation (!! or ??)
23
+ * - ALL CAPS segments
24
+ * - Explicit intensity words ("extremely", "so", "really", "very")
25
+ * - Profanity / frustration markers
26
+ * - Message length (longer rants → higher intensity)
27
+ */
28
+ export function estimateIntensity(message, emotion) {
29
+ if (emotion === 'neutral')
30
+ return 0.2;
31
+ let intensity = 0.4; // base for any non-neutral emotion
32
+ const lower = message.toLowerCase();
33
+ // Punctuation intensity
34
+ const exclamations = (message.match(/!/g) ?? []).length;
35
+ const questions = (message.match(/\?/g) ?? []).length;
36
+ if (exclamations >= 3)
37
+ intensity += 0.15;
38
+ else if (exclamations >= 1)
39
+ intensity += 0.05;
40
+ if (questions >= 3)
41
+ intensity += 0.1;
42
+ // CAPS intensity
43
+ const capsRatio = message.replace(/[^A-Z]/g, '').length / Math.max(message.replace(/\s/g, '').length, 1);
44
+ if (capsRatio > 0.5 && message.length > 10)
45
+ intensity += 0.15;
46
+ // Intensity words
47
+ const intensifiers = ['extremely', 'incredibly', 'absolutely', 'totally', 'completely', 'so frustrated', 'so tired', 'really', 'very', 'cannot believe', "can't stand"];
48
+ for (const word of intensifiers) {
49
+ if (lower.includes(word)) {
50
+ intensity += 0.08;
51
+ break; // only count once
52
+ }
53
+ }
54
+ // Frustration markers
55
+ const frustrationMarkers = ['ugh', 'argh', 'ffs', 'wtf', 'omg', 'seriously', 'again', 'still broken', 'still not working'];
56
+ for (const marker of frustrationMarkers) {
57
+ if (lower.includes(marker)) {
58
+ intensity += 0.08;
59
+ break;
60
+ }
61
+ }
62
+ // Length-based (longer messages in negative emotions → venting → higher intensity)
63
+ if (NEGATIVE_EMOTIONS.has(emotion)) {
64
+ const wordCount = message.split(/\s+/).length;
65
+ if (wordCount > 50)
66
+ intensity += 0.1;
67
+ else if (wordCount > 25)
68
+ intensity += 0.05;
69
+ }
70
+ return Math.min(intensity, 1.0);
71
+ }
72
+ // ────────────────────────────────────────────────────────────────────────────
73
+ // EmotionalTracker
74
+ // ────────────────────────────────────────────────────────────────────────────
75
+ /**
76
+ * Tracks emotional state across multiple messages, detecting escalation
77
+ * patterns that a single-message detector would miss.
78
+ *
79
+ * If a user is getting progressively more frustrated over 4-5 messages,
80
+ * the engine should amplify empathy before they reach a breaking point.
81
+ */
82
+ export class EmotionalTracker {
83
+ history = [];
84
+ // ── Recording ───────────────────────────────────────────────────────────
85
+ /** Record a detected emotion with its intensity and source message. */
86
+ recordEmotion(emotion, intensity, message) {
87
+ this.history.push({
88
+ emotion,
89
+ intensity: Math.min(Math.max(intensity, 0), 1),
90
+ timestamp: Date.now(),
91
+ message,
92
+ });
93
+ }
94
+ // ── Effective emotion ──────────────────────────────────────────────────
95
+ /**
96
+ * Get the effective emotional state considering trajectory across the
97
+ * conversation window.
98
+ */
99
+ getEffectiveEmotion() {
100
+ if (this.history.length === 0) {
101
+ return { emotion: 'neutral', intensity: 0, trajectory: 'stable', escalationAlert: false };
102
+ }
103
+ const latest = this.history[this.history.length - 1];
104
+ if (this.history.length < 2) {
105
+ return { emotion: latest.emotion, intensity: latest.intensity, trajectory: 'stable', escalationAlert: false };
106
+ }
107
+ // Sliding window: last WINDOW_SIZE entries
108
+ const window = this.history.slice(-WINDOW_SIZE);
109
+ // Predominant emotion (mode)
110
+ const emotionCounts = new Map();
111
+ let totalIntensity = 0;
112
+ for (const entry of window) {
113
+ emotionCounts.set(entry.emotion, (emotionCounts.get(entry.emotion) ?? 0) + 1);
114
+ totalIntensity += entry.intensity;
115
+ }
116
+ const averageIntensity = totalIntensity / window.length;
117
+ let predominant = 'neutral';
118
+ let maxCount = 0;
119
+ for (const [emotion, count] of emotionCounts) {
120
+ if (count > maxCount) {
121
+ maxCount = count;
122
+ predominant = emotion;
123
+ }
124
+ }
125
+ // Detect trajectory
126
+ const trajectory = this.detectTrajectory(window);
127
+ // Escalation alert
128
+ const escalationAlert = trajectory === 'escalating' &&
129
+ averageIntensity > ALERT_INTENSITY_THRESHOLD &&
130
+ window.length >= ALERT_MIN_MESSAGES;
131
+ return {
132
+ emotion: predominant,
133
+ intensity: averageIntensity,
134
+ trajectory,
135
+ escalationAlert,
136
+ };
137
+ }
138
+ // ── Trajectory detection ───────────────────────────────────────────────
139
+ detectTrajectory(window) {
140
+ // Count distinct emotion changes
141
+ let emotionChanges = 0;
142
+ for (let i = 1; i < window.length; i++) {
143
+ if (window[i].emotion !== window[i - 1].emotion) {
144
+ emotionChanges++;
145
+ }
146
+ }
147
+ // VOLATILE: 3+ emotion changes in window
148
+ if (emotionChanges >= VOLATILE_CHANGE_THRESHOLD) {
149
+ return 'volatile';
150
+ }
151
+ // ESCALATING: last 3+ messages show increasing intensity of negative emotions
152
+ if (window.length >= ESCALATION_MIN_STREAK) {
153
+ const tail = window.slice(-ESCALATION_MIN_STREAK);
154
+ const allNegative = tail.every(e => NEGATIVE_EMOTIONS.has(e.emotion));
155
+ if (allNegative) {
156
+ let increasing = true;
157
+ for (let i = 1; i < tail.length; i++) {
158
+ if (tail[i].intensity < tail[i - 1].intensity) {
159
+ increasing = false;
160
+ break;
161
+ }
162
+ }
163
+ if (increasing)
164
+ return 'escalating';
165
+ }
166
+ }
167
+ // DE_ESCALATING: was negative, trending toward neutral/positive
168
+ if (window.length >= 2) {
169
+ const earlier = window.slice(0, Math.ceil(window.length / 2));
170
+ const later = window.slice(Math.ceil(window.length / 2));
171
+ const earlierNegativeRatio = earlier.filter(e => NEGATIVE_EMOTIONS.has(e.emotion)).length / earlier.length;
172
+ const laterNegativeRatio = later.filter(e => NEGATIVE_EMOTIONS.has(e.emotion)).length / later.length;
173
+ if (earlierNegativeRatio > 0.5 && laterNegativeRatio < earlierNegativeRatio) {
174
+ return 'de_escalating';
175
+ }
176
+ }
177
+ // SHIFTING: one distinct change (not same emotion throughout, not volatile)
178
+ if (emotionChanges >= 1 && emotionChanges < VOLATILE_CHANGE_THRESHOLD) {
179
+ // Only call it shifting if the latest emotion differs from the earlier predominant
180
+ const earlierEmotions = window.slice(0, -1);
181
+ const earlierMode = this.mode(earlierEmotions.map(e => e.emotion));
182
+ if (window[window.length - 1].emotion !== earlierMode) {
183
+ return 'shifting';
184
+ }
185
+ }
186
+ // STABLE: same emotion for 3+ messages or no significant change
187
+ return 'stable';
188
+ }
189
+ mode(values) {
190
+ const counts = new Map();
191
+ for (const v of values) {
192
+ counts.set(v, (counts.get(v) ?? 0) + 1);
193
+ }
194
+ let best = 'neutral';
195
+ let bestCount = 0;
196
+ for (const [val, count] of counts) {
197
+ if (count > bestCount) {
198
+ bestCount = count;
199
+ best = val;
200
+ }
201
+ }
202
+ return best;
203
+ }
204
+ // ── Lifecycle ──────────────────────────────────────────────────────────
205
+ /** Reset for a new conversation — clears all history. */
206
+ reset() {
207
+ this.history = [];
208
+ }
209
+ }
210
+ //# sourceMappingURL=emotional-tracker.js.map
@@ -0,0 +1,161 @@
1
+ import type { TraitMix, TaskContext, TraitSource, ContextDomain, PromptOutput } from '../schema.js';
2
+ import { CorrectionStore } from './correction-store.js';
3
+ import type { ArchitectPreferences } from './persistence.js';
4
+ import type { EncryptedStorage } from './persistence-adapter.js';
5
+ import type { WeightPreset } from './custom-weights.js';
6
+ import type { ChatMessage, ExportedConversation } from './conversation-export.js';
7
+ export type { TraitMix, TraitValue, TaskContext, TraitSource, ContextDomain, EmotionalRegister, ContextSignal, PromptOutput, } from '../schema.js';
8
+ export { ARCHITECT_BASE_PROMPT } from './system-prompt.js';
9
+ export { CONTEXT_PROFILES } from './context-profiles.js';
10
+ export { EMOTIONAL_OVERRIDES, applyEmotionalOverride } from './emotional-overrides.js';
11
+ export { detectContext, scoreAllDomains } from './context-detector.js';
12
+ export { assemblePromptModifier, getActiveSources } from './prompt-assembler.js';
13
+ export { SOURCE_MAP } from './source-map.js';
14
+ export { TRAIT_TO_INSTRUCTION } from './trait-to-instruction.js';
15
+ export { CorrectionStore } from './correction-store.js';
16
+ export type { DetectionCorrection, CorrectionPattern } from './correction-store.js';
17
+ export { ContextRecommender } from './recommender.js';
18
+ export type { ContextRecommendation } from './recommender.js';
19
+ export { ConversationContext } from './conversation-context.js';
20
+ export type { ConversationSummary, ConversationState, DetectionRecord } from './conversation-context.js';
21
+ export { EmotionalTracker, estimateIntensity } from './emotional-tracker.js';
22
+ export type { EmotionalTrajectory, EffectiveEmotion } from './emotional-tracker.js';
23
+ export { CustomWeights, WEIGHT_PRESETS } from './custom-weights.js';
24
+ export type { WeightPreset } from './custom-weights.js';
25
+ export { ConversationExporter } from './conversation-export.js';
26
+ export type { ChatMessage, AssistantMetadata, ExportedMessage, ExportedConversation } from './conversation-export.js';
27
+ export { ArchitectPersistence } from './persistence.js';
28
+ export type { ArchitectPreferences } from './persistence.js';
29
+ export type { EncryptedStorage } from './persistence-adapter.js';
30
+ export { InMemoryEncryptedStorage, VaultStorageAdapter } from './persistence-adapter.js';
31
+ export type { VaultLike } from './persistence-adapter.js';
32
+ type Message = {
33
+ role: string;
34
+ content: string;
35
+ };
36
+ /**
37
+ * The Architect personality engine.
38
+ *
39
+ * Takes a user message and optional conversation history, detects the
40
+ * operational context, selects and modulates traits, and assembles a
41
+ * complete prompt with full provenance for every active trait.
42
+ *
43
+ * When constructed with an EncryptedStorage instance, persistence is enabled:
44
+ * corrections, usage history, and preferences are stored encrypted at rest.
45
+ * Call `initialize()` once after construction to load persisted state.
46
+ */
47
+ export declare class TheArchitect {
48
+ private contextOverride;
49
+ private correctionStore;
50
+ private recommender;
51
+ private conversationContext;
52
+ private emotionalTracker;
53
+ private customWeights;
54
+ private persistence?;
55
+ private preferences?;
56
+ private initialized;
57
+ constructor(storage?: EncryptedStorage);
58
+ /**
59
+ * Load persisted state (corrections, preferences, usage history).
60
+ * Call once after construction. Safe to call multiple times (idempotent).
61
+ * No-op when persistence is not configured.
62
+ */
63
+ initialize(): Promise<void>;
64
+ /**
65
+ * Primary method: user message in, complete prompt out.
66
+ *
67
+ * Detects context, selects the domain profile, applies emotional
68
+ * overrides, assembles a weight-scaled prompt modifier, and returns
69
+ * the full prompt with active trait sources for transparency.
70
+ *
71
+ * Also records usage asynchronously (fire-and-forget) and checks
72
+ * the recommender for context suggestions.
73
+ */
74
+ generatePrompt(userMessage: string, history?: Message[]): PromptOutput;
75
+ /**
76
+ * Detects the full task context from a user message and optional
77
+ * conversation history. Exposed publicly for debugging and testing.
78
+ */
79
+ detectContext(userMessage: string, history?: Message[]): TaskContext;
80
+ /**
81
+ * Returns the fully modulated trait mix for a given context.
82
+ * Applies the domain's base profile and then emotional overrides.
83
+ */
84
+ getTraitMix(context: TaskContext): TraitMix;
85
+ /** Returns the static base personality prompt. */
86
+ getBasePrompt(): string;
87
+ /**
88
+ * Forces a specific domain regardless of context detection.
89
+ * Pass `null` to return to automatic detection.
90
+ */
91
+ setContextOverride(domain: ContextDomain | null): void;
92
+ /**
93
+ * Returns all 17 context domains with human-readable labels
94
+ * and one-line descriptions for UI rendering.
95
+ */
96
+ listContextDomains(): Array<{
97
+ domain: ContextDomain;
98
+ label: string;
99
+ description: string;
100
+ }>;
101
+ /**
102
+ * Returns the active trait sources for the given mix, or for
103
+ * the general profile if no mix is provided.
104
+ */
105
+ getActiveSources(mix?: TraitMix): TraitSource[];
106
+ /** Reset conversation context and emotional tracker for a new conversation. */
107
+ resetConversation(): void;
108
+ /** Get the conversation context summary. */
109
+ getConversationSummary(): import("./conversation-context.js").ConversationSummary;
110
+ /** Get the current emotional trajectory. */
111
+ getEmotionalState(): import("./emotional-tracker.js").EffectiveEmotion;
112
+ /** Set a custom trait weight offset. Persists if storage is available. */
113
+ setTraitOverride(trait: keyof TraitMix, offset: number): Promise<void>;
114
+ /** Remove a custom trait weight override. */
115
+ removeTraitOverride(trait: keyof TraitMix): Promise<void>;
116
+ /** Load a preset weight configuration. */
117
+ loadPreset(presetName: string): Promise<void>;
118
+ /** Returns available weight presets. */
119
+ listPresets(): Record<string, WeightPreset>;
120
+ /** Returns current custom weight overrides. */
121
+ getActiveOverrides(): Partial<Record<keyof TraitMix, number>>;
122
+ /** Persist custom weights to encrypted storage. */
123
+ private persistCustomWeights;
124
+ /**
125
+ * Apply trajectory-based multipliers on top of standard emotional overrides.
126
+ * Caps all values at 1.0.
127
+ */
128
+ private applyTrajectoryMultipliers;
129
+ /**
130
+ * Records a user correction so the engine can learn from misclassifications.
131
+ * Also persists the updated corrections to encrypted storage when available.
132
+ */
133
+ recordCorrection(userMessage: string, detectedDomain: ContextDomain, correctedDomain: ContextDomain): Promise<void>;
134
+ /** Load corrections from serialized data (e.g. from encrypted vault). */
135
+ loadCorrections(serializedData: string): void;
136
+ /** Export corrections as a serialized string for encrypted storage. */
137
+ exportCorrections(): string;
138
+ /** Get correction statistics for debugging and transparency. */
139
+ getCorrectionStats(): ReturnType<CorrectionStore['getStats']>;
140
+ /** Returns the current preferences. Falls back to in-memory defaults. */
141
+ getPreferences(): Promise<ArchitectPreferences>;
142
+ /** Update a single preference and persist. */
143
+ updatePreference<K extends keyof ArchitectPreferences>(key: K, value: ArchitectPreferences[K]): Promise<void>;
144
+ /** Clear all persisted data: corrections, preferences, usage history. */
145
+ clearAllData(): Promise<void>;
146
+ /**
147
+ * Export a conversation with full personality engine metadata.
148
+ * Returns an ExportedConversation that can be serialized to JSON, Markdown, or CSV.
149
+ */
150
+ exportConversation(messages: ChatMessage[], conversationId: string): ExportedConversation;
151
+ /**
152
+ * Export a conversation in the specified format.
153
+ * @param format - 'json' | 'markdown' | 'csv'
154
+ */
155
+ exportConversationAs(messages: ChatMessage[], conversationId: string, format: 'json' | 'markdown' | 'csv'): string;
156
+ /** Export all stored data as JSON string (data portability). */
157
+ exportData(): Promise<string>;
158
+ }
159
+ /** Creates a new Architect instance, optionally with encrypted persistence. */
160
+ export declare function createArchitect(storage?: EncryptedStorage): TheArchitect;
161
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAMpG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,YAAY,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAMpF,KAAK,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AA8BjD;;;;;;GAMG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,eAAe,CAA0C;IAEjE;;;;;;OAMG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,YAAY;IAoBtE;;;OAGG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,WAAW;IAIpE;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,QAAQ;IAK3C,kDAAkD;IAClD,aAAa,IAAI,MAAM;IAIvB;;;OAGG;IACH,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI;IAItD;;;OAGG;IACH,kBAAkB,IAAI,KAAK,CAAC;QAAE,MAAM,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAI1F;;;OAGG;IACH,gBAAgB,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,WAAW,EAAE;IAO/C;;;OAGG;IACH,gBAAgB,CACd,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,aAAa,EAC7B,eAAe,EAAE,aAAa,GAC7B,IAAI;IAWP,yEAAyE;IACzE,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI;IAI7C,uEAAuE;IACvE,iBAAiB,IAAI,MAAM;IAI3B,gEAAgE;IAChE,kBAAkB,IAAI,UAAU,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;CAG9D;AAMD,wCAAwC;AACxC,wBAAgB,eAAe,IAAI,YAAY,CAE9C"}