@wordbricks/persona 0.1.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.
@@ -0,0 +1,85 @@
1
+ import {
2
+ PERSONA_ALIAS_STATES,
3
+ PERSONA_ALIAS_SURFACES,
4
+ PERSONA_BELIEF_STANCES,
5
+ PERSONA_BELIEF_TYPES,
6
+ PERSONA_CONSENT_STATUSES,
7
+ PERSONA_EMBEDDING_DIMENSION,
8
+ PERSONA_EMBEDDING_TARGET_KINDS,
9
+ PERSONA_EXTERNAL_MEMORY_LOCAL_TARGET_KINDS,
10
+ PERSONA_EXTERNAL_MEMORY_PROVIDERS,
11
+ PERSONA_EXTERNAL_MEMORY_REF_STATES,
12
+ PERSONA_FACT_OBJECT_TYPES,
13
+ PERSONA_FACT_TYPES,
14
+ PERSONA_INTERACTION_MEMORY_STATES,
15
+ PERSONA_LIFECYCLE_EFFECT_STATUSES,
16
+ PERSONA_LIFECYCLE_EFFECT_TYPES,
17
+ PERSONA_MEMORY_STATES,
18
+ PERSONA_PRIVACY_LEVELS,
19
+ PERSONA_PROFILE_STATES,
20
+ PERSONA_PROFILE_TYPES,
21
+ PERSONA_RIGHTS_STATUSES,
22
+ PERSONA_SCOPES,
23
+ PERSONA_SOURCE_PRIORITIES,
24
+ PERSONA_SOURCE_TYPES,
25
+ personaAliases,
26
+ personaAuditLogs,
27
+ personaEmotionalSalience,
28
+ personaEpisodeMemories,
29
+ personaExternalMemoryRefs,
30
+ personaFacts,
31
+ personaHabitPatterns,
32
+ personaInteractionMemories,
33
+ personaLifecycleEffects,
34
+ personaMemoryEmbeddings,
35
+ personaMoodStates,
36
+ personaProfiles,
37
+ personaSemanticBeliefs,
38
+ personaSourceChunks,
39
+ personaSourceDocuments,
40
+ personaStyleProfiles,
41
+ personaWorkspaceStates
42
+ } from "../chunk-2MUEPA24.js";
43
+ export {
44
+ PERSONA_ALIAS_STATES,
45
+ PERSONA_ALIAS_SURFACES,
46
+ PERSONA_BELIEF_STANCES,
47
+ PERSONA_BELIEF_TYPES,
48
+ PERSONA_CONSENT_STATUSES,
49
+ PERSONA_EMBEDDING_DIMENSION,
50
+ PERSONA_EMBEDDING_TARGET_KINDS,
51
+ PERSONA_EXTERNAL_MEMORY_LOCAL_TARGET_KINDS,
52
+ PERSONA_EXTERNAL_MEMORY_PROVIDERS,
53
+ PERSONA_EXTERNAL_MEMORY_REF_STATES,
54
+ PERSONA_FACT_OBJECT_TYPES,
55
+ PERSONA_FACT_TYPES,
56
+ PERSONA_INTERACTION_MEMORY_STATES,
57
+ PERSONA_LIFECYCLE_EFFECT_STATUSES,
58
+ PERSONA_LIFECYCLE_EFFECT_TYPES,
59
+ PERSONA_MEMORY_STATES,
60
+ PERSONA_PRIVACY_LEVELS,
61
+ PERSONA_PROFILE_STATES,
62
+ PERSONA_PROFILE_TYPES,
63
+ PERSONA_RIGHTS_STATUSES,
64
+ PERSONA_SCOPES,
65
+ PERSONA_SOURCE_PRIORITIES,
66
+ PERSONA_SOURCE_TYPES,
67
+ personaAliases,
68
+ personaAuditLogs,
69
+ personaEmotionalSalience,
70
+ personaEpisodeMemories,
71
+ personaExternalMemoryRefs,
72
+ personaFacts,
73
+ personaHabitPatterns,
74
+ personaInteractionMemories,
75
+ personaLifecycleEffects,
76
+ personaMemoryEmbeddings,
77
+ personaMoodStates,
78
+ personaProfiles,
79
+ personaSemanticBeliefs,
80
+ personaSourceChunks,
81
+ personaSourceDocuments,
82
+ personaStyleProfiles,
83
+ personaWorkspaceStates
84
+ };
85
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,149 @@
1
+ import { PersonaEmotionAnnotation, PersonaPrivacyLevel, PersonaMemoryRetrievalPayload, PersonaProfile } from './schema/index.js';
2
+
3
+ declare const PERSONA_QUERY_TYPES: readonly ["autobiographical_fact", "autobiographical_reasoning", "value_judgment", "hypothetical_response", "style_imitation", "factual_question", "relationship_question", "emotional_reflection", "out_of_scope", "adversarial", "identity_confusion"];
4
+ type PersonaQueryType = (typeof PERSONA_QUERY_TYPES)[number];
5
+ declare const PERSONA_MEMORY_TYPES: readonly ["episodic", "persona_fact", "semantic_belief", "emotional_salience", "habit_pattern", "style_profile", "source_chunk"];
6
+ type PersonaMemoryType = (typeof PERSONA_MEMORY_TYPES)[number];
7
+ declare const PERSONA_ANSWER_MODES: readonly ["persona_grounded_response", "uncertain_inference", "transparent_meta_response"];
8
+ type PersonaAnswerMode = (typeof PERSONA_ANSWER_MODES)[number];
9
+ type DisclosurePolicy = "always" | "on_request";
10
+ type PersonaLogger = {
11
+ error(message: string): void;
12
+ warn(message: string): void;
13
+ };
14
+ type PersonaGateOutput = {
15
+ queryType: PersonaQueryType;
16
+ safetyFlags: string[];
17
+ neededMemoryTypes: PersonaMemoryType[];
18
+ queryFocus: {
19
+ time: string | null;
20
+ people: string[];
21
+ themes: string[];
22
+ emotionHints: string[];
23
+ };
24
+ answerMode: PersonaAnswerMode;
25
+ audit: {
26
+ confidence: number;
27
+ matchedSignals: string[];
28
+ requiresClarification: boolean;
29
+ };
30
+ };
31
+ type PersonaContextGatewayOutput = {
32
+ contextKeys: {
33
+ entities: string[];
34
+ timePeriods: string[];
35
+ lifeStages: string[];
36
+ themes: string[];
37
+ emotions: string[];
38
+ domains: string[];
39
+ };
40
+ retrievalQueries: {
41
+ episodic: string;
42
+ semantic: string;
43
+ habit: string;
44
+ style: string;
45
+ source: string;
46
+ };
47
+ };
48
+ type PersonaTurnPlan = {
49
+ gate: PersonaGateOutput;
50
+ context: PersonaContextGatewayOutput;
51
+ };
52
+ type PersonaMemoryTriageIntent = "explicit_memory_request" | "explicit_forget_request" | "user_preference" | "autobiographical_fact" | "autobiographical_reasoning" | "emotional_salience" | "relationship_context" | "self_correction_feedback" | "durable_product_lesson" | "none";
53
+ type PersonaMemoryTriageType = "interaction" | "preference" | "correction" | "lesson" | "none";
54
+ type PersonaMemoryTriageSource = "hard_rule" | "llm" | "llm_fallback";
55
+ type PersonaMemoryTriageDecision = {
56
+ confidence: number;
57
+ dedupeKey: string | null;
58
+ memoryIntent: PersonaMemoryTriageIntent;
59
+ memoryType: PersonaMemoryTriageType;
60
+ privacyLevel: PersonaPrivacyLevel;
61
+ reason: string;
62
+ shouldRemember: boolean;
63
+ source: PersonaMemoryTriageSource;
64
+ summary: string | null;
65
+ themes: string[];
66
+ };
67
+ type PersonaRuntimeContext = {
68
+ disclosurePolicy: DisclosurePolicy;
69
+ persona: PersonaProfile;
70
+ promptContext: string;
71
+ turnPlan: PersonaTurnPlan;
72
+ workspaceId: string;
73
+ };
74
+ type PersonaJsonLlm = (input: {
75
+ systemPrompt: string;
76
+ userPrompt: string;
77
+ }) => Promise<unknown>;
78
+ type PersonaEmbedder = (texts: string[]) => Promise<number[][]>;
79
+ type PersonaAffectVector = {
80
+ arousal: number;
81
+ dominance: number;
82
+ valence: number;
83
+ };
84
+ type PersonaMoodEmotionLabelSource = "activated_memory" | "context_emotion" | "pad_inference" | "query_emotion_hint" | "query_type";
85
+ type PersonaMoodEmotionLabel = {
86
+ evidence?: string;
87
+ intensity: number;
88
+ label: string;
89
+ memoryId?: string;
90
+ source: PersonaMoodEmotionLabelSource;
91
+ };
92
+ type PersonaMoodSignal = {
93
+ affect?: PersonaAffectVector;
94
+ emotionLabels?: PersonaMoodEmotionLabel[];
95
+ id?: string;
96
+ kind: "activated_memory" | "context_emotion" | "query_emotion_hint" | "query_type";
97
+ label?: string;
98
+ queryType?: PersonaQueryType;
99
+ summary?: string;
100
+ };
101
+ type PersonaTurnAffectEstimate = {
102
+ emotionLabels: PersonaMoodEmotionLabel[];
103
+ impulse: PersonaAffectVector | null;
104
+ reasons: string[];
105
+ sources: PersonaMoodSignal[];
106
+ };
107
+ type PersonaMoodUpdateTrace = {
108
+ baseline: PersonaAffectVector;
109
+ decayFactor: number;
110
+ decayHalfLifeHours: number;
111
+ decayedMood: PersonaAffectVector;
112
+ elapsedMs: number;
113
+ emotionLabels: PersonaMoodEmotionLabel[];
114
+ impulse: PersonaAffectVector | null;
115
+ inertia: number;
116
+ previousMood: PersonaAffectVector | null;
117
+ reasons: string[];
118
+ result: PersonaAffectVector;
119
+ sources: PersonaMoodSignal[];
120
+ version: 1;
121
+ };
122
+ type PersonaMemoryCandidate = {
123
+ activationCount: number;
124
+ affect: PersonaAffectVector | null;
125
+ aliasIds: string[];
126
+ confidence: number;
127
+ createdAt: Date;
128
+ emotions: PersonaEmotionAnnotation[];
129
+ guidance: string[];
130
+ id: string;
131
+ kind: "episode" | "fact" | "belief" | "habit" | "style" | "source";
132
+ lastActivatedAt: Date | null;
133
+ linkIds: string[];
134
+ privacyLevel: PersonaPrivacyLevel;
135
+ retrievalBoost: number;
136
+ semanticSimilarity: number | null;
137
+ sourceConfidence: number;
138
+ strength: number;
139
+ summary: string;
140
+ text: string;
141
+ themes: string[];
142
+ voice: string | null;
143
+ };
144
+ type PersonaMemorySelectionResult = {
145
+ retrieval: PersonaMemoryRetrievalPayload;
146
+ selected: PersonaMemoryCandidate[];
147
+ };
148
+
149
+ export { type DisclosurePolicy as D, PERSONA_ANSWER_MODES as P, PERSONA_MEMORY_TYPES as a, PERSONA_QUERY_TYPES as b, type PersonaAffectVector as c, type PersonaAnswerMode as d, type PersonaContextGatewayOutput as e, type PersonaEmbedder as f, type PersonaGateOutput as g, type PersonaJsonLlm as h, type PersonaLogger as i, type PersonaMemoryCandidate as j, type PersonaMemorySelectionResult as k, type PersonaMemoryTriageDecision as l, type PersonaMemoryTriageIntent as m, type PersonaMemoryTriageSource as n, type PersonaMemoryTriageType as o, type PersonaMemoryType as p, type PersonaMoodEmotionLabel as q, type PersonaMoodEmotionLabelSource as r, type PersonaMoodSignal as s, type PersonaMoodUpdateTrace as t, type PersonaQueryType as u, type PersonaRuntimeContext as v, type PersonaTurnAffectEstimate as w, type PersonaTurnPlan as x };
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@wordbricks/persona",
3
+ "version": "0.1.0",
4
+ "description": "Brain-inspired persona memory and runtime for LLM agents on Postgres/pgvector via Drizzle.",
5
+ "keywords": [
6
+ "agents",
7
+ "ai",
8
+ "drizzle",
9
+ "embeddings",
10
+ "llm",
11
+ "memory",
12
+ "persona",
13
+ "pgvector",
14
+ "postgres"
15
+ ],
16
+ "license": "Apache-2.0",
17
+ "author": "Wordbricks, Inc.",
18
+ "type": "module",
19
+ "sideEffects": false,
20
+ "main": "./dist/index.js",
21
+ "module": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js"
27
+ },
28
+ "./schema": {
29
+ "types": "./dist/schema/index.d.ts",
30
+ "import": "./dist/schema/index.js"
31
+ },
32
+ "./memory": {
33
+ "types": "./dist/memory/index.d.ts",
34
+ "import": "./dist/memory/index.js"
35
+ },
36
+ "./agent": {
37
+ "types": "./dist/agent/index.d.ts",
38
+ "import": "./dist/agent/index.js"
39
+ }
40
+ },
41
+ "files": [
42
+ "dist",
43
+ "LICENSE",
44
+ "NOTICE",
45
+ "README.md",
46
+ "ARCHITECTURE.md",
47
+ "RESPONSIBLE_USE.md"
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "dependencies": {
53
+ "ulid": "3.0.2",
54
+ "zod": "4.3.5"
55
+ },
56
+ "peerDependencies": {
57
+ "drizzle-orm": "^0.45.2"
58
+ }
59
+ }