@auxiora/personality 1.3.0 → 1.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.
Files changed (73) hide show
  1. package/dist/__tests__/architect-awareness-collector.test.js +42 -0
  2. package/dist/__tests__/architect-awareness-collector.test.js.map +1 -1
  3. package/dist/architect-awareness-collector.d.ts +6 -0
  4. package/dist/architect-awareness-collector.d.ts.map +1 -1
  5. package/dist/architect-awareness-collector.js +16 -0
  6. package/dist/architect-awareness-collector.js.map +1 -1
  7. package/dist/architect-bridge.d.ts +4 -0
  8. package/dist/architect-bridge.d.ts.map +1 -1
  9. package/dist/architect-bridge.js +9 -2
  10. package/dist/architect-bridge.js.map +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/lib/custom-weights.d.ts +7 -1
  14. package/lib/custom-weights.js +17 -0
  15. package/lib/decision-log.d.ts +41 -0
  16. package/lib/decision-log.js +145 -0
  17. package/lib/feedback-store.d.ts +45 -0
  18. package/lib/feedback-store.js +152 -0
  19. package/lib/index.d.ts +33 -160
  20. package/lib/index.d.ts.map +1 -1
  21. package/lib/index.js +31 -483
  22. package/lib/index.js.map +1 -1
  23. package/lib/persistence.d.ts +6 -0
  24. package/lib/persistence.js +9 -2
  25. package/lib/preference-history.d.ts +45 -0
  26. package/lib/preference-history.js +132 -0
  27. package/lib/schema.d.ts +6 -0
  28. package/lib/schema.d.ts.map +1 -1
  29. package/lib/system-prompt.js +11 -1
  30. package/lib/the-architect/context-detector.js.map +1 -1
  31. package/lib/the-architect/conversation-context.d.ts.map +1 -0
  32. package/lib/the-architect/conversation-export.d.ts.map +1 -0
  33. package/lib/the-architect/conversation-export.js.map +1 -0
  34. package/lib/the-architect/custom-weights.d.ts +7 -1
  35. package/lib/the-architect/custom-weights.d.ts.map +1 -0
  36. package/lib/the-architect/custom-weights.js +17 -0
  37. package/lib/the-architect/custom-weights.js.map +1 -0
  38. package/lib/the-architect/decision-log.d.ts +41 -0
  39. package/lib/the-architect/decision-log.d.ts.map +1 -0
  40. package/lib/the-architect/decision-log.js +145 -0
  41. package/lib/the-architect/decision-log.js.map +1 -0
  42. package/lib/the-architect/emotional-tracker.d.ts.map +1 -0
  43. package/lib/the-architect/emotional-tracker.js.map +1 -0
  44. package/lib/the-architect/feedback-store.d.ts +45 -0
  45. package/lib/the-architect/feedback-store.d.ts.map +1 -0
  46. package/lib/the-architect/feedback-store.js +152 -0
  47. package/lib/the-architect/feedback-store.js.map +1 -0
  48. package/lib/the-architect/index.d.ts +48 -5
  49. package/lib/the-architect/index.d.ts.map +1 -1
  50. package/lib/the-architect/index.js +142 -8
  51. package/lib/the-architect/index.js.map +1 -1
  52. package/lib/the-architect/persistence-adapter.d.ts.map +1 -0
  53. package/lib/the-architect/persistence-adapter.js.map +1 -0
  54. package/lib/the-architect/persistence.d.ts +6 -0
  55. package/lib/the-architect/persistence.d.ts.map +1 -0
  56. package/lib/the-architect/persistence.js +9 -2
  57. package/lib/the-architect/persistence.js.map +1 -0
  58. package/lib/the-architect/preference-history.d.ts +45 -0
  59. package/lib/the-architect/preference-history.d.ts.map +1 -0
  60. package/lib/the-architect/preference-history.js +132 -0
  61. package/lib/the-architect/preference-history.js.map +1 -0
  62. package/lib/the-architect/recommender.d.ts.map +1 -0
  63. package/lib/the-architect/recommender.js.map +1 -0
  64. package/lib/the-architect/system-prompt.d.ts.map +1 -1
  65. package/lib/the-architect/system-prompt.js +11 -1
  66. package/lib/the-architect/system-prompt.js.map +1 -1
  67. package/lib/the-architect/user-model-synthesizer.d.ts +100 -0
  68. package/lib/the-architect/user-model-synthesizer.d.ts.map +1 -0
  69. package/lib/the-architect/user-model-synthesizer.js +224 -0
  70. package/lib/the-architect/user-model-synthesizer.js.map +1 -0
  71. package/lib/user-model-synthesizer.d.ts +100 -0
  72. package/lib/user-model-synthesizer.js +224 -0
  73. package/package.json +4 -4
package/lib/index.d.ts CHANGED
@@ -1,161 +1,34 @@
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;
1
+ export { TheArchitect, createArchitect } from './the-architect/index.js';
2
+ export { ARCHITECT_BASE_PROMPT } from './the-architect/system-prompt.js';
3
+ export { CONTEXT_PROFILES } from './the-architect/context-profiles.js';
4
+ export { SOURCE_MAP } from './the-architect/source-map.js';
5
+ export { TRAIT_TO_INSTRUCTION } from './the-architect/trait-to-instruction.js';
6
+ export { detectContext, scoreAllDomains } from './the-architect/context-detector.js';
7
+ export { assemblePromptModifier, getActiveSources } from './the-architect/prompt-assembler.js';
8
+ export { EMOTIONAL_OVERRIDES, applyEmotionalOverride } from './the-architect/emotional-overrides.js';
9
+ export type { TraitMix, TraitValue, TaskContext, TraitSource, ContextDomain, EmotionalRegister, ContextSignal, PromptOutput, } from './schema.js';
10
+ export { CorrectionStore } from './the-architect/correction-store.js';
11
+ export type { DetectionCorrection, CorrectionPattern } from './the-architect/correction-store.js';
12
+ export { InMemoryEncryptedStorage, VaultStorageAdapter } from './the-architect/persistence-adapter.js';
13
+ export type { EncryptedStorage, VaultLike } from './the-architect/persistence-adapter.js';
14
+ export { ArchitectPersistence } from './the-architect/persistence.js';
15
+ export type { ArchitectPreferences } from './the-architect/persistence.js';
16
+ export { ContextRecommender } from './the-architect/recommender.js';
17
+ export type { ContextRecommendation } from './the-architect/recommender.js';
18
+ export { ConversationContext } from './the-architect/conversation-context.js';
19
+ export type { ConversationSummary, ConversationState, DetectionRecord } from './the-architect/conversation-context.js';
20
+ export { EmotionalTracker, estimateIntensity } from './the-architect/emotional-tracker.js';
21
+ export type { EmotionalTrajectory, EffectiveEmotion } from './the-architect/emotional-tracker.js';
22
+ export { CustomWeights, WEIGHT_PRESETS } from './the-architect/custom-weights.js';
23
+ export type { WeightPreset } from './the-architect/custom-weights.js';
24
+ export { ConversationExporter } from './the-architect/conversation-export.js';
25
+ export type { ChatMessage, AssistantMetadata, ExportedMessage, ExportedConversation } from './the-architect/conversation-export.js';
26
+ export { PreferenceHistory } from './the-architect/preference-history.js';
27
+ export type { PreferenceEntry, PreferenceConflict } from './the-architect/preference-history.js';
28
+ export { DecisionLog } from './the-architect/decision-log.js';
29
+ export type { Decision, DecisionQuery, DecisionStatus } from './the-architect/decision-log.js';
30
+ export { FeedbackStore } from './the-architect/feedback-store.js';
31
+ export type { FeedbackRating, FeedbackEntry, FeedbackInsight } from './the-architect/feedback-store.js';
32
+ export { UserModelSynthesizer } from './the-architect/user-model-synthesizer.js';
33
+ export type { UserModel, DomainProfile, CommunicationStyle, SatisfactionProfile, CorrectionSummary } from './the-architect/user-model-synthesizer.js';
161
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,YAAY,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,YAAY,GACb,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;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