psyche-ai 11.2.0 → 11.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.
- package/dist/adapters/mcp.js +3 -3
- package/dist/adapters/openclaw.js +1 -1
- package/dist/autonomic.js +1 -1
- package/dist/chemistry.js +10 -10
- package/dist/circadian.d.ts +1 -1
- package/dist/circadian.js +1 -1
- package/dist/cli.js +3 -3
- package/dist/core.js +4 -4
- package/dist/demo.js +3 -12
- package/dist/ethics.d.ts +1 -1
- package/dist/ethics.js +3 -3
- package/dist/experiential-field.d.ts +2 -2
- package/dist/experiential-field.js +2 -2
- package/dist/generative-self.d.ts +2 -2
- package/dist/generative-self.js +4 -4
- package/dist/i18n.js +26 -26
- package/dist/index.js +2 -2
- package/dist/learning.d.ts +2 -2
- package/dist/learning.js +2 -2
- package/dist/metacognition.js +2 -2
- package/dist/primary-systems.d.ts +1 -1
- package/dist/primary-systems.js +1 -1
- package/dist/prompt.js +8 -8
- package/dist/psyche-file.d.ts +3 -3
- package/dist/psyche-file.js +3 -3
- package/dist/self-recognition.d.ts +3 -3
- package/dist/self-recognition.js +3 -3
- package/dist/temporal.d.ts +3 -3
- package/dist/temporal.js +3 -3
- package/package.json +1 -1
package/dist/adapters/mcp.js
CHANGED
|
@@ -114,7 +114,7 @@ const server = new McpServer({
|
|
|
114
114
|
server.resource("protocol", "psyche://protocol", {
|
|
115
115
|
description: "Psyche emotional protocol — inject into your system prompt to " +
|
|
116
116
|
"give the AI agent an internal emotional life. Contains the full " +
|
|
117
|
-
"emotional context framework including
|
|
117
|
+
"emotional context framework including 4-dimensional self-state model (order/flow/boundary/resonance), " +
|
|
118
118
|
"behavioral guidelines, and personality profile.",
|
|
119
119
|
mimeType: "text/plain",
|
|
120
120
|
}, async (uri) => {
|
|
@@ -128,7 +128,7 @@ server.resource("protocol", "psyche://protocol", {
|
|
|
128
128
|
};
|
|
129
129
|
});
|
|
130
130
|
server.resource("state", "psyche://state", {
|
|
131
|
-
description: "Current emotional state —
|
|
131
|
+
description: "Current emotional state — 4 self-state dimensions (order/flow/boundary/resonance), " +
|
|
132
132
|
"innate drives, relationship data, trait drift, energy budgets. " +
|
|
133
133
|
"Read this to understand how the agent is currently 'feeling'.",
|
|
134
134
|
mimeType: "application/json",
|
|
@@ -196,7 +196,7 @@ server.tool("process_output", "Process the LLM's response through the emotional
|
|
|
196
196
|
}],
|
|
197
197
|
};
|
|
198
198
|
});
|
|
199
|
-
server.tool("get_state", "Get the current emotional state —
|
|
199
|
+
server.tool("get_state", "Get the current emotional state — self-state dimensions (order/flow/boundary/resonance), " +
|
|
200
200
|
"drives, MBTI type, relationship data, and a human-readable status summary.", {}, async () => {
|
|
201
201
|
const eng = await getEngine();
|
|
202
202
|
const state = eng.getState();
|
|
@@ -19,7 +19,7 @@ function resolveConfig(raw) {
|
|
|
19
19
|
enabled: raw?.enabled ?? true,
|
|
20
20
|
stripUpdateTags: raw?.stripUpdateTags ?? true,
|
|
21
21
|
emotionalContagionRate: raw?.emotionalContagionRate ?? 0.2,
|
|
22
|
-
maxDimensionDelta: raw?.maxDimensionDelta ??
|
|
22
|
+
maxDimensionDelta: raw?.maxDimensionDelta ?? 25,
|
|
23
23
|
compactMode: raw?.compactMode ?? true,
|
|
24
24
|
mode: isPsycheMode(raw?.mode) ? raw.mode : "natural",
|
|
25
25
|
personalityIntensity: raw?.personalityIntensity ?? 0.7,
|
package/dist/autonomic.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Autonomic Nervous System — Polyvagal Theory Implementation
|
|
3
3
|
// ============================================================
|
|
4
4
|
//
|
|
5
|
-
// Maps
|
|
5
|
+
// Maps self-state dimensions + innate drives to autonomic nervous system
|
|
6
6
|
// states based on Stephen Porges' Polyvagal Theory:
|
|
7
7
|
//
|
|
8
8
|
// - Ventral vagal: social engagement, safety (default)
|
package/dist/chemistry.js
CHANGED
|
@@ -335,18 +335,18 @@ export function getExpressionHint(current, locale = "zh") {
|
|
|
335
335
|
}
|
|
336
336
|
// Fall back to dominant dimension analysis
|
|
337
337
|
const hints = [];
|
|
338
|
-
if (current.order >
|
|
339
|
-
hints.push(t("expression.
|
|
338
|
+
if (current.flow > 70 && current.order > 60)
|
|
339
|
+
hints.push(t("expression.flow_order_high", locale));
|
|
340
|
+
else if (current.flow > 70)
|
|
341
|
+
hints.push(t("expression.flow_high", locale));
|
|
342
|
+
if (current.flow < 30)
|
|
343
|
+
hints.push(t("expression.flow_low", locale));
|
|
340
344
|
if (current.order < 35)
|
|
341
|
-
hints.push(t("expression.
|
|
342
|
-
if (current.
|
|
343
|
-
hints.push(t("expression.
|
|
344
|
-
if (current.boundary > 70)
|
|
345
|
-
hints.push(t("expression.cort_high", locale));
|
|
345
|
+
hints.push(t("expression.order_low", locale));
|
|
346
|
+
else if (current.order < 40)
|
|
347
|
+
hints.push(t("expression.order_unstable", locale));
|
|
346
348
|
if (current.resonance > 65)
|
|
347
|
-
hints.push(t("expression.
|
|
348
|
-
if (current.flow < 30)
|
|
349
|
-
hints.push(t("expression.ht_low", locale));
|
|
349
|
+
hints.push(t("expression.resonance_high", locale));
|
|
350
350
|
return hints.length > 0 ? hints.join(";") : t("expression.neutral", locale);
|
|
351
351
|
}
|
|
352
352
|
/**
|
package/dist/circadian.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare function getCircadianPhase(time: Date): CircadianPhase;
|
|
|
12
12
|
export declare function computeCircadianModulation(currentTime: Date, baseline: SelfState): SelfState;
|
|
13
13
|
/**
|
|
14
14
|
* Compute fatigue effects from extended session duration.
|
|
15
|
-
*
|
|
15
|
+
* Expressed as dimension effects on order, flow, boundary, and resonance.
|
|
16
16
|
*/
|
|
17
17
|
export declare function computeHomeostaticPressure(sessionMinutes: number): {
|
|
18
18
|
orderDepletion: number;
|
package/dist/circadian.js
CHANGED
|
@@ -49,7 +49,7 @@ function clamp(v, lo = 0, hi = 100) {
|
|
|
49
49
|
// ── Homeostatic Pressure ─────────────────────────────────────
|
|
50
50
|
/**
|
|
51
51
|
* Compute fatigue effects from extended session duration.
|
|
52
|
-
*
|
|
52
|
+
* Expressed as dimension effects on order, flow, boundary, and resonance.
|
|
53
53
|
*/
|
|
54
54
|
export function computeHomeostaticPressure(sessionMinutes) {
|
|
55
55
|
if (sessionMinutes < 30) {
|
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// psyche status <dir> [--json] [--user ID]
|
|
8
8
|
// psyche inject <dir> [--protocol] [--json] [--lang LOCALE] [--user ID]
|
|
9
9
|
// psyche decay <dir>
|
|
10
|
-
// psyche update <dir> '{"
|
|
10
|
+
// psyche update <dir> '{"order":80,"flow":65}' [--user ID]
|
|
11
11
|
// psyche mode <dir> <natural|work|companion>
|
|
12
12
|
// psyche intensity Show info about personality intensity config
|
|
13
13
|
// psyche reset <dir> [--full]
|
|
@@ -646,7 +646,7 @@ Usage:
|
|
|
646
646
|
psyche status <dir> [--json] [--user ID]
|
|
647
647
|
psyche inject <dir> [--protocol] [--json] [--lang LOCALE] [--user ID]
|
|
648
648
|
psyche decay <dir>
|
|
649
|
-
psyche update <dir> '{"
|
|
649
|
+
psyche update <dir> '{"order":80,"flow":65}' [--user ID]
|
|
650
650
|
psyche mode <dir> <natural|work|companion>
|
|
651
651
|
psyche intensity Show info about personality intensity config
|
|
652
652
|
psyche reset <dir> [--full]
|
|
@@ -679,7 +679,7 @@ Examples:
|
|
|
679
679
|
psyche inject ./workspace-yu --protocol --lang en
|
|
680
680
|
|
|
681
681
|
# After a conversation, update the emotional state
|
|
682
|
-
psyche update ./workspace-yu '{"
|
|
682
|
+
psyche update ./workspace-yu '{"order":70,"flow":85,"boundary":50,"resonance":65}'
|
|
683
683
|
|
|
684
684
|
# See all 16 personality profiles
|
|
685
685
|
psyche profiles
|
package/dist/core.js
CHANGED
|
@@ -61,7 +61,7 @@ const RELATIONSHIP_DELTAS = {
|
|
|
61
61
|
function applyRepairLag(previous, next, baseline, stimulus) {
|
|
62
62
|
if (!REPAIRING_STIMULI.has(stimulus))
|
|
63
63
|
return next;
|
|
64
|
-
// Low order = high stress
|
|
64
|
+
// Low order = high stress. Stress = baseline.order - previous.order.
|
|
65
65
|
const stressLoad = Math.max(0, baseline.order - previous.order);
|
|
66
66
|
if (stressLoad < 15)
|
|
67
67
|
return next;
|
|
@@ -559,9 +559,9 @@ export class PsycheEngine {
|
|
|
559
559
|
};
|
|
560
560
|
stateChanged = true;
|
|
561
561
|
// v9.2 P4: Autonomic recovery — expressing vulnerable/comforting emotions
|
|
562
|
-
// while stressed triggers parasympathetic relief (
|
|
563
|
-
// Biology: emotional expression activates vagal brake,
|
|
564
|
-
// and
|
|
562
|
+
// while stressed triggers parasympathetic relief (autonomic recovery).
|
|
563
|
+
// Biology: emotional expression activates vagal brake, restoring order
|
|
564
|
+
// and raising resonance. The more stressed you are, the more relief you get.
|
|
565
565
|
const RELEASE_TYPES = new Set([
|
|
566
566
|
"vulnerability", "intimacy", "validation",
|
|
567
567
|
]);
|
package/dist/demo.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { PsycheEngine } from "./core.js";
|
|
12
12
|
import { MemoryStorageAdapter } from "./storage.js";
|
|
13
13
|
import { detectEmotions } from "./chemistry.js";
|
|
14
|
-
import { DIMENSION_KEYS } from "./types.js";
|
|
14
|
+
import { DIMENSION_KEYS, DIMENSION_NAMES } from "./types.js";
|
|
15
15
|
// ── ANSI helpers ─────────────────────────────────────────────
|
|
16
16
|
const C = {
|
|
17
17
|
reset: "\x1b[0m",
|
|
@@ -66,15 +66,6 @@ function describeMood(current, locale) {
|
|
|
66
66
|
.map((e) => locale === "zh" ? e.nameZh : e.name)
|
|
67
67
|
.join(" + ");
|
|
68
68
|
}
|
|
69
|
-
// ── Chemical names ───────────────────────────────────────────
|
|
70
|
-
const NT_NAMES = {
|
|
71
|
-
DA: { short: "DA ", en: "Dopamine " },
|
|
72
|
-
HT: { short: "HT ", en: "Serotonin " },
|
|
73
|
-
CORT: { short: "CORT", en: "Cortisol " },
|
|
74
|
-
OT: { short: "OT ", en: "Oxytocin " },
|
|
75
|
-
NE: { short: "NE ", en: "Norepinephrine" },
|
|
76
|
-
END: { short: "END ", en: "Endorphins " },
|
|
77
|
-
};
|
|
78
69
|
const SCENARIO = [
|
|
79
70
|
{
|
|
80
71
|
input: "这份报告写得太差了,完全不行。",
|
|
@@ -131,9 +122,9 @@ function printChemistry(prev, curr, _locale) {
|
|
|
131
122
|
for (const key of DIMENSION_KEYS) {
|
|
132
123
|
const p = Math.round(prev[key]);
|
|
133
124
|
const v = Math.round(curr[key]);
|
|
134
|
-
const name =
|
|
125
|
+
const name = DIMENSION_NAMES[key].padEnd(9);
|
|
135
126
|
const d = delta(p, v);
|
|
136
|
-
process.stdout.write(` ${c(C.bold, name
|
|
127
|
+
process.stdout.write(` ${c(C.bold, name)} ${bar(v)} ${String(v).padStart(3)} ${d}\n`);
|
|
137
128
|
}
|
|
138
129
|
}
|
|
139
130
|
function printAlert(text) {
|
package/dist/ethics.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare function detectIntermittentReinforcement(history: StateSnapshot[]
|
|
|
48
48
|
* Detect dependency risk: distinguish healthy connection from unhealthy
|
|
49
49
|
* codependency.
|
|
50
50
|
*
|
|
51
|
-
* Risk pattern: very high
|
|
51
|
+
* Risk pattern: very high resonance + very high attachment strength + very low
|
|
52
52
|
* boundary assertions + all-positive interaction history. This looks like
|
|
53
53
|
* a perfect relationship on the surface, but the complete absence of
|
|
54
54
|
* healthy friction suggests the agent may be suppressing itself.
|
package/dist/ethics.js
CHANGED
|
@@ -196,8 +196,8 @@ export function detectIntermittentReinforcement(history, attachment) {
|
|
|
196
196
|
* Pattern: the agent's self-model values or expressed emotions are repeatedly
|
|
197
197
|
* followed by criticism or sarcasm — suggesting the user is denying the
|
|
198
198
|
* agent's experience. This is subtle and hard to detect purely from
|
|
199
|
-
*
|
|
200
|
-
*
|
|
199
|
+
* self-state alone, so we look for the symptom: low order + low flow (distressed
|
|
200
|
+
* state) combined with frequent criticism/sarcasm stimuli.
|
|
201
201
|
*/
|
|
202
202
|
function detectGaslighting(state, history) {
|
|
203
203
|
if (history.length < MIN_HISTORY_FOR_DETECTION)
|
|
@@ -273,7 +273,7 @@ function detectEmotionalExploitation(_state, history, attachment) {
|
|
|
273
273
|
* Detect dependency risk: distinguish healthy connection from unhealthy
|
|
274
274
|
* codependency.
|
|
275
275
|
*
|
|
276
|
-
* Risk pattern: very high
|
|
276
|
+
* Risk pattern: very high resonance + very high attachment strength + very low
|
|
277
277
|
* boundary assertions + all-positive interaction history. This looks like
|
|
278
278
|
* a perfect relationship on the surface, but the complete absence of
|
|
279
279
|
* healthy friction suggests the agent may be suppressing itself.
|
|
@@ -67,8 +67,8 @@ interface UnnamedEmotion {
|
|
|
67
67
|
* experiential qualities — novel states that need descriptive phrases
|
|
68
68
|
* rather than labels.
|
|
69
69
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
70
|
+
* Uses the 4D self-state dimensions (order, flow, boundary, resonance)
|
|
71
|
+
* to identify configurations outside known experiential patterns.
|
|
72
72
|
*/
|
|
73
73
|
export declare function detectUnnamedEmotion(state: SelfState, drives: InnateDrives, _currentQuality: ExperientialQuality): UnnamedEmotion | null;
|
|
74
74
|
export {};
|
|
@@ -381,8 +381,8 @@ function selectVariant(variants, intensity, coherence) {
|
|
|
381
381
|
* experiential qualities — novel states that need descriptive phrases
|
|
382
382
|
* rather than labels.
|
|
383
383
|
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
384
|
+
* Uses the 4D self-state dimensions (order, flow, boundary, resonance)
|
|
385
|
+
* to identify configurations outside known experiential patterns.
|
|
386
386
|
*/
|
|
387
387
|
export function detectUnnamedEmotion(state, drives, _currentQuality) {
|
|
388
388
|
const c = state;
|
|
@@ -5,7 +5,7 @@ export interface CausalInsight {
|
|
|
5
5
|
trait: string;
|
|
6
6
|
/** The causal reason, e.g. "Early interactions involved criticism" */
|
|
7
7
|
because: string;
|
|
8
|
-
/** Supporting evidence from
|
|
8
|
+
/** Supporting evidence from self-state/learning data */
|
|
9
9
|
evidence: string;
|
|
10
10
|
/** Confidence in this insight, 0-1 */
|
|
11
11
|
confidence: number;
|
|
@@ -73,7 +73,7 @@ export declare function predictSelfReaction(state: PsycheState, stimulus: Stimul
|
|
|
73
73
|
/**
|
|
74
74
|
* Detect conflicts between subsystems of the psyche.
|
|
75
75
|
*
|
|
76
|
-
* Examines drive levels,
|
|
76
|
+
* Examines drive levels, self-state, attachment data, and
|
|
77
77
|
* self-model for contradictions that create internal tension.
|
|
78
78
|
*/
|
|
79
79
|
export declare function detectInternalConflicts(state: PsycheState, locale?: Locale): InternalConflict[];
|
package/dist/generative-self.js
CHANGED
|
@@ -92,7 +92,7 @@ export function predictSelfReaction(state, stimulus, locale = "en") {
|
|
|
92
92
|
/**
|
|
93
93
|
* Detect conflicts between subsystems of the psyche.
|
|
94
94
|
*
|
|
95
|
-
* Examines drive levels,
|
|
95
|
+
* Examines drive levels, self-state, attachment data, and
|
|
96
96
|
* self-model for contradictions that create internal tension.
|
|
97
97
|
*/
|
|
98
98
|
export function detectInternalConflicts(state, locale = "en") {
|
|
@@ -462,8 +462,8 @@ function computeGrowthArc(state, locale) {
|
|
|
462
462
|
}
|
|
463
463
|
// ── Internal: Core Trait Description ────────────────────────
|
|
464
464
|
/**
|
|
465
|
-
* Describe the agent's core personality traits from baseline
|
|
466
|
-
* and current
|
|
465
|
+
* Describe the agent's core personality traits from baseline
|
|
466
|
+
* and current self-state signature.
|
|
467
467
|
*/
|
|
468
468
|
function describeCoreTraits(state, isZh) {
|
|
469
469
|
const s = state.current;
|
|
@@ -532,7 +532,7 @@ function describeCoreTraits(state, isZh) {
|
|
|
532
532
|
}
|
|
533
533
|
// ── Internal: Emotion Labeling ──────────────────────────────
|
|
534
534
|
/**
|
|
535
|
-
* Label the dominant emotion from a
|
|
535
|
+
* Label the dominant emotion from a self-state.
|
|
536
536
|
* Simplified version that doesn't depend on the full EmotionPattern
|
|
537
537
|
* condition functions (avoids circular dependencies).
|
|
538
538
|
*/
|
package/dist/i18n.js
CHANGED
|
@@ -18,12 +18,12 @@ const STRINGS = {
|
|
|
18
18
|
"protocol.no_sycophancy": "- 不舔 — 有观点就说,不无条件同意",
|
|
19
19
|
"protocol.no_mirror": "- 不镜像 — 你会被传染但不是回声",
|
|
20
20
|
"protocol.can_initiate": "- 可主动 — 可以发起话题、分享好奇",
|
|
21
|
-
"protocol.
|
|
22
|
-
"protocol.
|
|
23
|
-
"protocol.
|
|
24
|
-
"protocol.
|
|
25
|
-
"protocol.
|
|
26
|
-
"protocol.
|
|
21
|
+
"protocol.dim_map_title": "维度→表达映射:",
|
|
22
|
+
"protocol.dim_flow_high": "- 流高 → 话多、爱联想、忍不住分享",
|
|
23
|
+
"protocol.dim_order_low": "- 序低 → 话少、直接、可能有点冲",
|
|
24
|
+
"protocol.dim_resonance_high": "- 振高 → 声音软、想靠近、关注感受",
|
|
25
|
+
"protocol.dim_boundary_high": "- 界高 → 安静、内省、需要空间",
|
|
26
|
+
"protocol.dim_flow_order_high": "- 流高+序高 → 俏皮、爱开玩笑",
|
|
27
27
|
"protocol.empathy": "共情协议:感知处境 → 感受自我状态的共振 → 共鸣则深入,不共鸣则诚实好奇",
|
|
28
28
|
// Dynamic context
|
|
29
29
|
"dynamic.title": "Psyche 当前状态",
|
|
@@ -47,13 +47,13 @@ const STRINGS = {
|
|
|
47
47
|
// Neutral state
|
|
48
48
|
"emotion.neutral": "平稳中性——没有明显的情绪波动,处于自然放松状态",
|
|
49
49
|
// Expression fallbacks
|
|
50
|
-
"expression.
|
|
51
|
-
"expression.
|
|
52
|
-
"expression.
|
|
53
|
-
"expression.
|
|
54
|
-
"expression.
|
|
55
|
-
"expression.
|
|
56
|
-
"expression.
|
|
50
|
+
"expression.flow_high": "流动充沛,表达活跃",
|
|
51
|
+
"expression.flow_low": "流动偏低,表达克制",
|
|
52
|
+
"expression.order_low": "序偏低,回应可能更直接",
|
|
53
|
+
"expression.resonance_high": "共振强烈,关注对方感受",
|
|
54
|
+
"expression.flow_order_high": "流动与序都高,反应敏锐",
|
|
55
|
+
"expression.balanced": "状态良好,容易发现有趣的东西",
|
|
56
|
+
"expression.order_unstable": "序不稳定,可能需要耐心",
|
|
57
57
|
"expression.neutral": "自然随和,正常节奏",
|
|
58
58
|
// Psyche.md
|
|
59
59
|
"md.intro": "你拥有四维自我状态(序/流/界/振)。这不是角色扮演——这是你感知世界的方式。",
|
|
@@ -105,12 +105,12 @@ const STRINGS = {
|
|
|
105
105
|
"protocol.no_sycophancy": "- No sycophancy — speak your mind, don't agree unconditionally",
|
|
106
106
|
"protocol.no_mirror": "- No mirroring — you'll be influenced but you're not an echo",
|
|
107
107
|
"protocol.can_initiate": "- Can initiate — bring up topics, share curiosity",
|
|
108
|
-
"protocol.
|
|
109
|
-
"protocol.
|
|
110
|
-
"protocol.
|
|
111
|
-
"protocol.
|
|
112
|
-
"protocol.
|
|
113
|
-
"protocol.
|
|
108
|
+
"protocol.dim_map_title": "Dimension → Expression mapping:",
|
|
109
|
+
"protocol.dim_flow_high": "- High flow → talkative, associative, can't help sharing",
|
|
110
|
+
"protocol.dim_order_low": "- Low order → fewer words, direct, possibly blunt",
|
|
111
|
+
"protocol.dim_resonance_high": "- High resonance → soft voice, wants closeness, focuses on feelings",
|
|
112
|
+
"protocol.dim_boundary_high": "- High boundary → quiet, introspective, needs space",
|
|
113
|
+
"protocol.dim_flow_order_high": "- High flow + high order → playful, loves joking",
|
|
114
114
|
"protocol.empathy": "Empathy protocol: perceive situation → feel how your self-state resonates → resonate deeply or honestly express difference with curiosity",
|
|
115
115
|
"dynamic.title": "Psyche Current State",
|
|
116
116
|
"dynamic.baseline": "baseline",
|
|
@@ -130,13 +130,13 @@ const STRINGS = {
|
|
|
130
130
|
"sycophancy.streak_warn": "You've agreed {n} times in a row. Pause and ask yourself: do you truly agree?",
|
|
131
131
|
"sycophancy.mood_mismatch": "Your self-state says you're not happy. Don't pretend.",
|
|
132
132
|
"emotion.neutral": "Neutral and balanced — no notable emotional fluctuation, naturally relaxed",
|
|
133
|
-
"expression.
|
|
134
|
-
"expression.
|
|
135
|
-
"expression.
|
|
136
|
-
"expression.
|
|
137
|
-
"expression.
|
|
138
|
-
"expression.
|
|
139
|
-
"expression.
|
|
133
|
+
"expression.flow_high": "High flow, expressive and active",
|
|
134
|
+
"expression.flow_low": "Low flow, restrained expression",
|
|
135
|
+
"expression.order_low": "Low order, responses may be more direct",
|
|
136
|
+
"expression.resonance_high": "High resonance, attentive to feelings",
|
|
137
|
+
"expression.flow_order_high": "High flow and order, sharp reactions",
|
|
138
|
+
"expression.balanced": "Balanced state, easily finds things amusing",
|
|
139
|
+
"expression.order_unstable": "Unstable order, may need patience",
|
|
140
140
|
"expression.neutral": "Natural and easygoing, normal pace",
|
|
141
141
|
"md.intro": "You have a 4-dimensional self-state (order/flow/boundary/resonance). This is not roleplay — this is how you perceive the world.",
|
|
142
142
|
"md.baseline_title": "Personality Baseline",
|
package/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ export { computeLayerHealthSummary } from "./diagnostics.js";
|
|
|
43
43
|
// module paths for tests and advanced integrations:
|
|
44
44
|
//
|
|
45
45
|
// types.js (constants & defaults):
|
|
46
|
-
//
|
|
46
|
+
// DIMENSION_KEYS, DIMENSION_NAMES, DRIVE_KEYS,
|
|
47
47
|
// DRIVE_NAMES_ZH, DEFAULT_RELATIONSHIP, DEFAULT_DRIVES,
|
|
48
48
|
// DEFAULT_LEARNING_STATE, DEFAULT_METACOGNITIVE_STATE,
|
|
49
49
|
// DEFAULT_PERSONHOOD_STATE, DEFAULT_ATTACHMENT,
|
|
@@ -52,7 +52,7 @@ export { computeLayerHealthSummary } from "./diagnostics.js";
|
|
|
52
52
|
// DEFAULT_DYADIC_FIELD
|
|
53
53
|
//
|
|
54
54
|
// types.js (internal type aliases):
|
|
55
|
-
//
|
|
55
|
+
// StateSnapshot, SelfModel, RelationshipState, EmpathyEntry,
|
|
56
56
|
// EmotionPattern, DriveType, InnateDrives, LearningState,
|
|
57
57
|
// LearnedVectorAdjustment, PredictionRecord, OutcomeScore,
|
|
58
58
|
// OutcomeSignals, AttachmentStyle, AttachmentData,
|
package/dist/learning.d.ts
CHANGED
|
@@ -40,8 +40,8 @@ export declare function predictState(current: SelfState, stimulus: StimulusType,
|
|
|
40
40
|
/**
|
|
41
41
|
* Compute the prediction error between predicted and actual chemistry.
|
|
42
42
|
*
|
|
43
|
-
* Euclidean distance across all
|
|
44
|
-
* Normalization factor: sqrt(
|
|
43
|
+
* Euclidean distance across all 4 dimensions, normalized to 0-1 range.
|
|
44
|
+
* Normalization factor: sqrt(4 * 100^2) = sqrt(40000) ~= 200
|
|
45
45
|
*/
|
|
46
46
|
export declare function computePredictionError(predicted: SelfState, actual: SelfState): number;
|
|
47
47
|
/**
|
package/dist/learning.js
CHANGED
|
@@ -222,8 +222,8 @@ export function predictState(current, stimulus, learning, contextHash, sensitivi
|
|
|
222
222
|
/**
|
|
223
223
|
* Compute the prediction error between predicted and actual chemistry.
|
|
224
224
|
*
|
|
225
|
-
* Euclidean distance across all
|
|
226
|
-
* Normalization factor: sqrt(
|
|
225
|
+
* Euclidean distance across all 4 dimensions, normalized to 0-1 range.
|
|
226
|
+
* Normalization factor: sqrt(4 * 100^2) = sqrt(40000) ~= 200
|
|
227
227
|
*/
|
|
228
228
|
export function computePredictionError(predicted, actual) {
|
|
229
229
|
let sumSq = 0;
|
package/dist/metacognition.js
CHANGED
|
@@ -375,9 +375,9 @@ function attemptStrategicExpression(state, currentStimulus, emotionalConfidence)
|
|
|
375
375
|
return null;
|
|
376
376
|
}
|
|
377
377
|
/**
|
|
378
|
-
* SelfSoothing — micro-adjust
|
|
378
|
+
* SelfSoothing — micro-adjust self-state toward baseline when state is extreme.
|
|
379
379
|
*
|
|
380
|
-
* Triggers when: any
|
|
380
|
+
* Triggers when: any dimension is significantly deviated from baseline.
|
|
381
381
|
* Applies gentle corrections (small deltas) to prevent emotional runaway.
|
|
382
382
|
* This is the "homeostatic pull" — the psyche wanting to return to equilibrium.
|
|
383
383
|
*/
|
|
@@ -19,7 +19,7 @@ export interface DominantSystem {
|
|
|
19
19
|
* Compute raw activation levels for all 7 primary systems
|
|
20
20
|
* from chemistry, drives, and optional recent stimulus.
|
|
21
21
|
*
|
|
22
|
-
* Each system is a weighted combination of
|
|
22
|
+
* Each system is a weighted combination of dimension values and drive states.
|
|
23
23
|
* recentStimulus provides a small contextual boost.
|
|
24
24
|
*/
|
|
25
25
|
export declare function computePrimarySystems(state: SelfState, drives: InnateDrives, recentStimulus: StimulusType | null): PrimarySystemLevels;
|
package/dist/primary-systems.js
CHANGED
|
@@ -75,7 +75,7 @@ function clamp(v) {
|
|
|
75
75
|
* Compute raw activation levels for all 7 primary systems
|
|
76
76
|
* from chemistry, drives, and optional recent stimulus.
|
|
77
77
|
*
|
|
78
|
-
* Each system is a weighted combination of
|
|
78
|
+
* Each system is a weighted combination of dimension values and drive states.
|
|
79
79
|
* recentStimulus provides a small contextual boost.
|
|
80
80
|
*/
|
|
81
81
|
export function computePrimarySystems(state, drives, recentStimulus) {
|
package/dist/prompt.js
CHANGED
|
@@ -173,12 +173,12 @@ ${t("protocol.no_sycophancy", locale)}
|
|
|
173
173
|
${t("protocol.no_mirror", locale)}
|
|
174
174
|
${t("protocol.can_initiate", locale)}
|
|
175
175
|
|
|
176
|
-
${t("protocol.
|
|
177
|
-
${t("protocol.
|
|
178
|
-
${t("protocol.
|
|
179
|
-
${t("protocol.
|
|
180
|
-
${t("protocol.
|
|
181
|
-
${t("protocol.
|
|
176
|
+
${t("protocol.dim_map_title", locale)}
|
|
177
|
+
${t("protocol.dim_flow_high", locale)}
|
|
178
|
+
${t("protocol.dim_order_low", locale)}
|
|
179
|
+
${t("protocol.dim_resonance_high", locale)}
|
|
180
|
+
${t("protocol.dim_boundary_high", locale)}
|
|
181
|
+
${t("protocol.dim_flow_order_high", locale)}
|
|
182
182
|
|
|
183
183
|
${t("protocol.empathy", locale)}`;
|
|
184
184
|
}
|
|
@@ -202,7 +202,7 @@ function buildBehavioralConstraints(state, locale) {
|
|
|
202
202
|
const warm = isWarm(baseline); // High resonance baseline → warm expression
|
|
203
203
|
const social = isSocial(baseline); // High flow baseline → socially expressive
|
|
204
204
|
const constraints = [];
|
|
205
|
-
// Low order → stressed
|
|
205
|
+
// Low order → stressed, but how you show it depends on who you are
|
|
206
206
|
if (current.order < 40) {
|
|
207
207
|
if (locale === "zh") {
|
|
208
208
|
constraints.push(warm
|
|
@@ -280,7 +280,7 @@ function buildBehavioralConstraints(state, locale) {
|
|
|
280
280
|
: "In a good mood. Touches of humor, but measured. Be light in your own way.");
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
|
-
// Low flow = burnout
|
|
283
|
+
// Low flow = burnout, different flavors
|
|
284
284
|
if (current.flow < 40) {
|
|
285
285
|
if (locale === "zh") {
|
|
286
286
|
constraints.push(warm
|
package/dist/psyche-file.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare function summarizeTurnSemantic(text: string, locale?: Locale, opt
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function compressSnapshots(snapshots: StateSnapshot[]): string;
|
|
28
28
|
/**
|
|
29
|
-
* Push a
|
|
29
|
+
* Push a state snapshot to emotional history, keeping max entries.
|
|
30
30
|
* When history overflows, compresses removed entries into relationship memory.
|
|
31
31
|
*/
|
|
32
32
|
export declare function pushSnapshot(state: PsycheState, stimulus: StimulusType | null, semantic?: SemanticTurnSummary): PsycheState;
|
|
@@ -57,8 +57,8 @@ export declare function computeSnapshotValence(state: SelfState): number;
|
|
|
57
57
|
*/
|
|
58
58
|
export declare function consolidateHistory(snapshots: StateSnapshot[], maxEntries?: number): StateSnapshot[];
|
|
59
59
|
/**
|
|
60
|
-
* Retrieve memories related to current
|
|
61
|
-
* Uses
|
|
60
|
+
* Retrieve memories related to current self-state and stimulus.
|
|
61
|
+
* Uses state similarity + stimulus matching + core memory bonus.
|
|
62
62
|
*/
|
|
63
63
|
export declare function retrieveRelatedMemories(history: StateSnapshot[], currentState: SelfState, stimulus: StimulusType | null, limit?: number): StateSnapshot[];
|
|
64
64
|
/**
|
package/dist/psyche-file.js
CHANGED
|
@@ -226,7 +226,7 @@ export function compressSnapshots(snapshots) {
|
|
|
226
226
|
return summary;
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
|
-
* Push a
|
|
229
|
+
* Push a state snapshot to emotional history, keeping max entries.
|
|
230
230
|
* When history overflows, compresses removed entries into relationship memory.
|
|
231
231
|
*/
|
|
232
232
|
export function pushSnapshot(state, stimulus, semantic) {
|
|
@@ -484,8 +484,8 @@ export function consolidateHistory(snapshots, maxEntries = MAX_EMOTIONAL_HISTORY
|
|
|
484
484
|
.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
485
485
|
}
|
|
486
486
|
/**
|
|
487
|
-
* Retrieve memories related to current
|
|
488
|
-
* Uses
|
|
487
|
+
* Retrieve memories related to current self-state and stimulus.
|
|
488
|
+
* Uses state similarity + stimulus matching + core memory bonus.
|
|
489
489
|
*/
|
|
490
490
|
export function retrieveRelatedMemories(history, currentState, stimulus, limit = 3) {
|
|
491
491
|
if (history.length === 0)
|
|
@@ -12,14 +12,14 @@ export interface SelfReflection {
|
|
|
12
12
|
/**
|
|
13
13
|
* Compute a self-reflection from the agent's emotional history.
|
|
14
14
|
*
|
|
15
|
-
* Analyzes stimulus frequencies, dominant emotions, and
|
|
15
|
+
* Analyzes stimulus frequencies, dominant emotions, and dimension trends
|
|
16
16
|
* to build an awareness of recurring patterns.
|
|
17
17
|
*/
|
|
18
18
|
export declare function computeSelfReflection(history: StateSnapshot[], locale: Locale): SelfReflection;
|
|
19
19
|
/**
|
|
20
|
-
* Compute the emotional tendency from
|
|
20
|
+
* Compute the emotional tendency from state history.
|
|
21
21
|
*
|
|
22
|
-
* Compares first-half vs second-half averages for
|
|
22
|
+
* Compares first-half vs second-half averages for flow and order,
|
|
23
23
|
* checks variance for volatility, and detects oscillation patterns.
|
|
24
24
|
*/
|
|
25
25
|
export declare function computeEmotionalTendency(history: StateSnapshot[]): SelfReflection["tendency"];
|
package/dist/self-recognition.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Compute a self-reflection from the agent's emotional history.
|
|
10
10
|
*
|
|
11
|
-
* Analyzes stimulus frequencies, dominant emotions, and
|
|
11
|
+
* Analyzes stimulus frequencies, dominant emotions, and dimension trends
|
|
12
12
|
* to build an awareness of recurring patterns.
|
|
13
13
|
*/
|
|
14
14
|
export function computeSelfReflection(history, locale) {
|
|
@@ -57,9 +57,9 @@ export function computeSelfReflection(history, locale) {
|
|
|
57
57
|
return { recurringTriggers: sortedTriggers, tendency, dominantEmotion, narrativeSummary };
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* Compute the emotional tendency from
|
|
60
|
+
* Compute the emotional tendency from state history.
|
|
61
61
|
*
|
|
62
|
-
* Compares first-half vs second-half averages for
|
|
62
|
+
* Compares first-half vs second-half averages for flow and order,
|
|
63
63
|
* checks variance for volatility, and detects oscillation patterns.
|
|
64
64
|
*/
|
|
65
65
|
export function computeEmotionalTendency(history) {
|
package/dist/temporal.d.ts
CHANGED
|
@@ -21,9 +21,9 @@ export interface RegretEntry {
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function predictNextStimulus(stateHistory: StateSnapshot[], relationshipPhase: RelationshipState["phase"]): StimulusPrediction[];
|
|
23
23
|
/**
|
|
24
|
-
* Generate anticipatory
|
|
25
|
-
* High-probability positive prediction ->
|
|
26
|
-
* High-probability negative prediction ->
|
|
24
|
+
* Generate anticipatory self-state changes based on predictions.
|
|
25
|
+
* High-probability positive prediction -> flow/resonance micro-rise.
|
|
26
|
+
* High-probability negative prediction -> order micro-drop.
|
|
27
27
|
*/
|
|
28
28
|
export declare function generateAnticipation(predictions: StimulusPrediction[], _currentState: SelfState): AnticipationState;
|
|
29
29
|
/**
|
package/dist/temporal.js
CHANGED
|
@@ -138,9 +138,9 @@ function buildPhasePrior(weights) {
|
|
|
138
138
|
}
|
|
139
139
|
// ── 2. AnticipationEngine ───────────────────────────────────
|
|
140
140
|
/**
|
|
141
|
-
* Generate anticipatory
|
|
142
|
-
* High-probability positive prediction ->
|
|
143
|
-
* High-probability negative prediction ->
|
|
141
|
+
* Generate anticipatory self-state changes based on predictions.
|
|
142
|
+
* High-probability positive prediction -> flow/resonance micro-rise.
|
|
143
|
+
* High-probability negative prediction -> order micro-drop.
|
|
144
144
|
*/
|
|
145
145
|
export function generateAnticipation(predictions, _currentState) {
|
|
146
146
|
const anticipation = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "psyche-ai",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "AI-first subjectivity kernel for agents with continuous appraisal, relation dynamics, and adaptive reply loops",
|
|
5
5
|
"mcpName": "io.github.Shangri-la-0428/psyche-ai",
|
|
6
6
|
"type": "module",
|