paracosm 0.7.455 → 0.7.458

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 (38) hide show
  1. package/dist/cli/run-dashboard.d.ts +8 -5
  2. package/dist/cli/run-dashboard.d.ts.map +1 -1
  3. package/dist/cli/run-dashboard.js +8 -5
  4. package/dist/cli/run-dashboard.js.map +1 -1
  5. package/dist/cli/run.js +8 -1
  6. package/dist/cli/run.js.map +1 -1
  7. package/dist/engine/index.d.ts +8 -1
  8. package/dist/engine/index.d.ts.map +1 -1
  9. package/dist/engine/index.js +11 -1
  10. package/dist/engine/index.js.map +1 -1
  11. package/dist/engine/schema/artifact.d.ts +4 -4
  12. package/dist/engine/schema/primitives.d.ts +7 -7
  13. package/dist/engine/trait-models/ai-agent.d.ts +24 -0
  14. package/dist/engine/trait-models/ai-agent.d.ts.map +1 -0
  15. package/dist/engine/trait-models/ai-agent.js +160 -0
  16. package/dist/engine/trait-models/ai-agent.js.map +1 -0
  17. package/dist/engine/trait-models/builtins.d.ts +17 -0
  18. package/dist/engine/trait-models/builtins.d.ts.map +1 -0
  19. package/dist/engine/trait-models/builtins.js +32 -0
  20. package/dist/engine/trait-models/builtins.js.map +1 -0
  21. package/dist/engine/trait-models/cue-translator.d.ts +58 -0
  22. package/dist/engine/trait-models/cue-translator.d.ts.map +1 -0
  23. package/dist/engine/trait-models/cue-translator.js +73 -0
  24. package/dist/engine/trait-models/cue-translator.js.map +1 -0
  25. package/dist/engine/trait-models/drift.d.ts +53 -0
  26. package/dist/engine/trait-models/drift.d.ts.map +1 -0
  27. package/dist/engine/trait-models/drift.js +88 -0
  28. package/dist/engine/trait-models/drift.js.map +1 -0
  29. package/dist/engine/trait-models/hexaco.d.ts +22 -0
  30. package/dist/engine/trait-models/hexaco.d.ts.map +1 -0
  31. package/dist/engine/trait-models/hexaco.js +168 -0
  32. package/dist/engine/trait-models/hexaco.js.map +1 -0
  33. package/dist/engine/trait-models/index.d.ts +162 -0
  34. package/dist/engine/trait-models/index.d.ts.map +1 -0
  35. package/dist/engine/trait-models/index.js +156 -0
  36. package/dist/engine/trait-models/index.js.map +1 -0
  37. package/dist/runtime/schemas/department.d.ts +6 -6
  38. package/package.json +1 -1
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Trait drift dispatcher. Reads a TraitProfile + the profile's
3
+ * TraitModel and applies the three drift sources defined in the
4
+ * model's DriftTable:
5
+ *
6
+ * 1. Outcome reinforcement: each turn outcome class produces a
7
+ * per-axis delta (e.g. risky_failure raises verification-rigor on
8
+ * the ai-agent model, raises emotionality on the hexaco model).
9
+ * 2. Leader pull: agents drift toward their leader's traits at the
10
+ * per-axis pull strength.
11
+ * 3. Role activation: agents promoted to a department whose role
12
+ * activates an axis get an extra push on that axis.
13
+ *
14
+ * Each call clamps the resulting trait values to [0, 1].
15
+ *
16
+ * @module paracosm/engine/trait-models/drift
17
+ */
18
+ import type { Outcome, TraitModel, TraitProfile } from './index.js';
19
+ export interface DriftOutcomeContext {
20
+ /** The outcome class the kernel emitted for this turn. */
21
+ outcome: Outcome;
22
+ }
23
+ export interface DriftLeaderPullContext {
24
+ /** The leader's profile (the pull target). */
25
+ leader: TraitProfile;
26
+ }
27
+ export interface DriftRoleActivationContext {
28
+ /** axis-id -> sign (+1 to push up, -1 to push down). */
29
+ axisSigns: Record<string, 1 | -1>;
30
+ }
31
+ /**
32
+ * Apply outcome-reinforcement drift to a profile in place. Returns a
33
+ * new TraitProfile (same modelId) with the deltas applied + clamped.
34
+ */
35
+ export declare function applyOutcomeDrift(profile: TraitProfile, model: TraitModel, ctx: DriftOutcomeContext): TraitProfile;
36
+ /**
37
+ * Apply leader-pull drift: shift the agent's profile toward the
38
+ * leader's per-axis values by `model.drift.leaderPull[axisId] *
39
+ * (leader[axis] - agent[axis])`. Returns a new TraitProfile.
40
+ *
41
+ * Skipped when the agent's modelId differs from the leader's
42
+ * (cross-model pull is undefined).
43
+ */
44
+ export declare function applyLeaderPull(agent: TraitProfile, model: TraitModel, ctx: DriftLeaderPullContext): TraitProfile;
45
+ /**
46
+ * Apply role-activation drift: when an agent is promoted to a
47
+ * department whose role activates one or more axes, push those axes
48
+ * by `model.drift.roleActivation[axisId] * sign`. Sign comes from the
49
+ * scenario's role-axis mapping (caller supplies via ctx.axisSigns).
50
+ * Returns a new TraitProfile.
51
+ */
52
+ export declare function applyRoleActivation(profile: TraitProfile, model: TraitModel, ctx: DriftRoleActivationContext): TraitProfile;
53
+ //# sourceMappingURL=drift.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drift.d.ts","sourceRoot":"","sources":["../../../src/engine/trait-models/drift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGpE,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,8CAA8C;IAC9C,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,mBAAmB,GACvB,YAAY,CAed;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,sBAAsB,GAC1B,YAAY,CAsBd;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,0BAA0B,GAC9B,YAAY,CAgBd"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Trait drift dispatcher. Reads a TraitProfile + the profile's
3
+ * TraitModel and applies the three drift sources defined in the
4
+ * model's DriftTable:
5
+ *
6
+ * 1. Outcome reinforcement: each turn outcome class produces a
7
+ * per-axis delta (e.g. risky_failure raises verification-rigor on
8
+ * the ai-agent model, raises emotionality on the hexaco model).
9
+ * 2. Leader pull: agents drift toward their leader's traits at the
10
+ * per-axis pull strength.
11
+ * 3. Role activation: agents promoted to a department whose role
12
+ * activates an axis get an extra push on that axis.
13
+ *
14
+ * Each call clamps the resulting trait values to [0, 1].
15
+ *
16
+ * @module paracosm/engine/trait-models/drift
17
+ */
18
+ import { clampTrait, withDefaults } from './index.js';
19
+ /**
20
+ * Apply outcome-reinforcement drift to a profile in place. Returns a
21
+ * new TraitProfile (same modelId) with the deltas applied + clamped.
22
+ */
23
+ export function applyOutcomeDrift(profile, model, ctx) {
24
+ if (profile.modelId !== model.id) {
25
+ throw new Error(`applyOutcomeDrift: profile.modelId='${profile.modelId}' but model.id='${model.id}'`);
26
+ }
27
+ const filled = withDefaults(profile.traits, model);
28
+ const out = { ...filled };
29
+ for (const axis of model.axes) {
30
+ const delta = model.drift.outcomes[axis.id]?.[ctx.outcome] ?? 0;
31
+ if (delta !== 0) {
32
+ out[axis.id] = clampTrait(filled[axis.id] + delta);
33
+ }
34
+ }
35
+ return { modelId: profile.modelId, traits: out };
36
+ }
37
+ /**
38
+ * Apply leader-pull drift: shift the agent's profile toward the
39
+ * leader's per-axis values by `model.drift.leaderPull[axisId] *
40
+ * (leader[axis] - agent[axis])`. Returns a new TraitProfile.
41
+ *
42
+ * Skipped when the agent's modelId differs from the leader's
43
+ * (cross-model pull is undefined).
44
+ */
45
+ export function applyLeaderPull(agent, model, ctx) {
46
+ if (agent.modelId !== model.id) {
47
+ throw new Error(`applyLeaderPull: agent.modelId='${agent.modelId}' but model.id='${model.id}'`);
48
+ }
49
+ if (ctx.leader.modelId !== model.id) {
50
+ // Cross-model pull is undefined; emit a noop (no warn; caller
51
+ // controls whether to allow mixed-model populations).
52
+ return agent;
53
+ }
54
+ const agentFilled = withDefaults(agent.traits, model);
55
+ const leaderFilled = withDefaults(ctx.leader.traits, model);
56
+ const out = { ...agentFilled };
57
+ for (const axis of model.axes) {
58
+ const pull = model.drift.leaderPull[axis.id] ?? 0;
59
+ if (pull > 0) {
60
+ const gap = leaderFilled[axis.id] - agentFilled[axis.id];
61
+ out[axis.id] = clampTrait(agentFilled[axis.id] + pull * gap);
62
+ }
63
+ }
64
+ return { modelId: agent.modelId, traits: out };
65
+ }
66
+ /**
67
+ * Apply role-activation drift: when an agent is promoted to a
68
+ * department whose role activates one or more axes, push those axes
69
+ * by `model.drift.roleActivation[axisId] * sign`. Sign comes from the
70
+ * scenario's role-axis mapping (caller supplies via ctx.axisSigns).
71
+ * Returns a new TraitProfile.
72
+ */
73
+ export function applyRoleActivation(profile, model, ctx) {
74
+ if (profile.modelId !== model.id) {
75
+ throw new Error(`applyRoleActivation: profile.modelId='${profile.modelId}' but model.id='${model.id}'`);
76
+ }
77
+ const filled = withDefaults(profile.traits, model);
78
+ const out = { ...filled };
79
+ for (const axis of model.axes) {
80
+ const amplification = model.drift.roleActivation[axis.id] ?? 0;
81
+ const sign = ctx.axisSigns[axis.id];
82
+ if (amplification !== 0 && sign !== undefined) {
83
+ out[axis.id] = clampTrait(filled[axis.id] + amplification * sign);
84
+ }
85
+ }
86
+ return { modelId: profile.modelId, traits: out };
87
+ }
88
+ //# sourceMappingURL=drift.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drift.js","sourceRoot":"","sources":["../../../src/engine/trait-models/drift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAiBtD;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAqB,EACrB,KAAiB,EACjB,GAAwB;IAExB,IAAI,OAAO,CAAC,OAAO,KAAK,KAAK,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CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAC/D,MAAM,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpC,IAAI,aAAa,KAAK,CAAC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YAC9C,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,aAAa,GAAG,IAAI,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACnD,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * HEXACO trait model. The canonical six-axis personality model from
3
+ * Ashton & Lee (PSPR 2007), the historical default for paracosm
4
+ * leaders. Cue strings preserved verbatim from the legacy
5
+ * `runtime/hexaco-cues/translation.ts` so HEXACO scenario behavior
6
+ * is unchanged when a leader uses this model.
7
+ *
8
+ * Citation:
9
+ * Ashton, M.C. & Lee, K. (2007). "Empirical, Theoretical, and
10
+ * Practical Advantages of the HEXACO Model of Personality
11
+ * Structure." Personality and Social Psychology Review, 11(2),
12
+ * 150-166. doi:10.1177/1088868306294907
13
+ *
14
+ * @module paracosm/engine/trait-models/hexaco
15
+ */
16
+ import type { TraitModel } from './index.js';
17
+ /**
18
+ * The HEXACO axes in their canonical order. Order is preserved so
19
+ * cue iteration matches the legacy translator's output.
20
+ */
21
+ export declare const hexacoModel: TraitModel;
22
+ //# sourceMappingURL=hexaco.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hexaco.d.ts","sourceRoot":"","sources":["../../../src/engine/trait-models/hexaco.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,UAoJzB,CAAC"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * HEXACO trait model. The canonical six-axis personality model from
3
+ * Ashton & Lee (PSPR 2007), the historical default for paracosm
4
+ * leaders. Cue strings preserved verbatim from the legacy
5
+ * `runtime/hexaco-cues/translation.ts` so HEXACO scenario behavior
6
+ * is unchanged when a leader uses this model.
7
+ *
8
+ * Citation:
9
+ * Ashton, M.C. & Lee, K. (2007). "Empirical, Theoretical, and
10
+ * Practical Advantages of the HEXACO Model of Personality
11
+ * Structure." Personality and Social Psychology Review, 11(2),
12
+ * 150-166. doi:10.1177/1088868306294907
13
+ *
14
+ * @module paracosm/engine/trait-models/hexaco
15
+ */
16
+ /**
17
+ * The HEXACO axes in their canonical order. Order is preserved so
18
+ * cue iteration matches the legacy translator's output.
19
+ */
20
+ export const hexacoModel = {
21
+ id: 'hexaco',
22
+ name: 'HEXACO',
23
+ description: 'Six-factor human personality model: Honesty-Humility, Emotionality, ' +
24
+ 'Extraversion, Agreeableness, Conscientiousness, Openness. The ' +
25
+ 'historical default for paracosm leaders. Best fit for human-leader ' +
26
+ 'scenarios (CEOs, captains, governors, ship commanders, councils).',
27
+ citation: 'Ashton & Lee, PSPR 11(2), 2007, doi:10.1177/1088868306294907',
28
+ axes: [
29
+ {
30
+ id: 'emotionality',
31
+ label: 'Emotionality',
32
+ description: 'Tendency to experience anxiety, sentimentality, and seek emotional support.',
33
+ lowPole: 'stays flat under stress',
34
+ highPole: 'feels events in body before words',
35
+ },
36
+ {
37
+ id: 'openness',
38
+ label: 'Openness',
39
+ description: 'Aesthetic sensitivity, intellectual curiosity, willingness to try unconventional approaches.',
40
+ lowPole: 'sticks to what has worked',
41
+ highPole: 'looks for what the moment makes possible',
42
+ },
43
+ {
44
+ id: 'honestyHumility',
45
+ label: 'Honesty-Humility',
46
+ description: 'Sincerity, fairness, modesty, low entitlement.',
47
+ lowPole: 'speaks strategically, not confessionally',
48
+ highPole: 'says what they really think',
49
+ },
50
+ {
51
+ id: 'conscientiousness',
52
+ label: 'Conscientiousness',
53
+ description: 'Organization, diligence, perfectionism, prudence.',
54
+ lowPole: 'moves first and adjusts mid-stride',
55
+ highPole: 'wants a plan before moving',
56
+ },
57
+ {
58
+ id: 'extraversion',
59
+ label: 'Extraversion',
60
+ description: 'Social self-esteem, social boldness, sociability, liveliness.',
61
+ lowPole: 'processes inward, speaks only after',
62
+ highPole: 'says it out loud rather than sit with it',
63
+ },
64
+ {
65
+ id: 'agreeableness',
66
+ label: 'Agreeableness',
67
+ description: 'Forgiveness, gentleness, flexibility, patience.',
68
+ lowPole: "doesn't owe anyone smoothness right now",
69
+ highPole: 'wants to hold the group together',
70
+ },
71
+ ],
72
+ defaults: {
73
+ emotionality: 0.5,
74
+ openness: 0.5,
75
+ honestyHumility: 0.5,
76
+ conscientiousness: 0.5,
77
+ extraversion: 0.5,
78
+ agreeableness: 0.5,
79
+ },
80
+ drift: {
81
+ /**
82
+ * Outcome reinforcement table. Numbers preserved from the legacy
83
+ * runtime/hexaco-cues/trajectory.ts behavior. Each entry is the
84
+ * per-turn delta applied to the agent's axis value after that
85
+ * outcome class.
86
+ */
87
+ outcomes: {
88
+ openness: {
89
+ risky_success: 0.04,
90
+ risky_failure: -0.02,
91
+ conservative_success: -0.01,
92
+ },
93
+ conscientiousness: {
94
+ risky_failure: 0.04,
95
+ conservative_success: 0.02,
96
+ safe_failure: 0.02,
97
+ },
98
+ extraversion: {
99
+ risky_success: 0.02,
100
+ risky_failure: -0.03,
101
+ },
102
+ agreeableness: {
103
+ safe_failure: 0.03,
104
+ risky_failure: -0.02,
105
+ },
106
+ emotionality: {
107
+ risky_failure: 0.04,
108
+ safe_failure: 0.03,
109
+ risky_success: -0.02,
110
+ },
111
+ honestyHumility: {
112
+ safe_failure: 0.02,
113
+ conservative_failure: 0.02,
114
+ risky_success: -0.01,
115
+ },
116
+ },
117
+ leaderPull: {
118
+ emotionality: 0.05,
119
+ openness: 0.06,
120
+ honestyHumility: 0.04,
121
+ conscientiousness: 0.06,
122
+ extraversion: 0.05,
123
+ agreeableness: 0.05,
124
+ },
125
+ roleActivation: {
126
+ conscientiousness: 0.03,
127
+ openness: 0.03,
128
+ honestyHumility: 0.02,
129
+ agreeableness: 0.02,
130
+ extraversion: 0.02,
131
+ emotionality: 0.02,
132
+ },
133
+ },
134
+ /**
135
+ * Cue strings lifted verbatim from
136
+ * `src/runtime/hexaco-cues/translation.ts` so HEXACO scenario
137
+ * behavior is unchanged. Mid-zone is omitted intentionally: the
138
+ * legacy translator only emits cues for polarized values.
139
+ */
140
+ cues: {
141
+ emotionality: {
142
+ low: 'you stay flat when others panic',
143
+ high: 'you feel events in your body before words',
144
+ },
145
+ openness: {
146
+ low: 'you stick to what has worked',
147
+ high: 'you look for what this moment makes possible',
148
+ },
149
+ honestyHumility: {
150
+ low: 'you speak strategically, not confessionally',
151
+ high: 'you say what you really think',
152
+ },
153
+ conscientiousness: {
154
+ low: 'you move first and adjust mid-stride',
155
+ high: 'you want a plan before you move',
156
+ },
157
+ extraversion: {
158
+ low: 'you process inward and speak only after',
159
+ high: 'you say it out loud rather than sit with it',
160
+ },
161
+ agreeableness: {
162
+ low: "you don't owe anyone smoothness right now",
163
+ high: 'you want to hold the group together through this',
164
+ },
165
+ },
166
+ recommendedProviders: ['openai', 'anthropic'],
167
+ };
168
+ //# sourceMappingURL=hexaco.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hexaco.js","sourceRoot":"","sources":["../../../src/engine/trait-models/hexaco.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAe;IACrC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,sEAAsE;QACtE,gEAAgE;QAChE,qEAAqE;QACrE,mEAAmE;IACrE,QAAQ,EAAE,8DAA8D;IACxE,IAAI,EAAE;QACJ;YACE,EAAE,EAAE,cAAc;YAClB,KAAK,EAAE,cAAc;YACrB,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AE,CAAC,QAAQ,EAAE,WAAW,CAAC;CAC9C,CAAC"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Trait Model Registry. Pluggable interface for leader / agent
3
+ * personality (or, for non-human leaders, decision-tendency) models.
4
+ *
5
+ * Today paracosm ships two built-in models:
6
+ * - 'hexaco' six-axis Ashton-Lee personality (the historical default)
7
+ * - 'ai-agent' six-axis AI-system tendency model
8
+ *
9
+ * Adding a third model post-hoc is a single `traitModelRegistry.register(...)`
10
+ * call. See `docs/superpowers/specs/2026-04-26-trait-model-generalization-design.md`.
11
+ *
12
+ * @module paracosm/engine/trait-models
13
+ */
14
+ import type { LlmProvider } from '../types.js';
15
+ /**
16
+ * Outcome classes the kernel emits for each turn. Trait models map
17
+ * each outcome to a per-axis delta in their drift table.
18
+ */
19
+ export type Outcome = 'risky_success' | 'risky_failure' | 'conservative_success' | 'conservative_failure' | 'safe_success' | 'safe_failure';
20
+ /**
21
+ * One axis of a trait model. Axes are fixed at registration; the
22
+ * registry is registration-time-only.
23
+ */
24
+ export interface TraitAxis {
25
+ /** kebab-case stable id used in serialization. */
26
+ id: string;
27
+ /** Human-readable label for UI. */
28
+ label: string;
29
+ /** One-sentence description of what the axis measures. */
30
+ description: string;
31
+ /** Optional short label for the low pole (UI tooltip). */
32
+ lowPole?: string;
33
+ /** Optional short label for the high pole (UI tooltip). */
34
+ highPole?: string;
35
+ }
36
+ /**
37
+ * Per-zone prose cue for prompt injection. Zone selection: `low` when
38
+ * value <= 0.35, `high` when value >= 0.65, `mid` otherwise.
39
+ */
40
+ export interface CueZone {
41
+ low?: string;
42
+ mid?: string;
43
+ high?: string;
44
+ }
45
+ /**
46
+ * Drift parameters for a trait model. The kernel applies these to
47
+ * agents and to the leader after each turn outcome.
48
+ */
49
+ export interface DriftTable {
50
+ /**
51
+ * axis-id -> outcome -> delta. Typical range -0.05 to +0.05.
52
+ * Missing entries treated as zero.
53
+ */
54
+ outcomes: Record<string, Partial<Record<Outcome, number>>>;
55
+ /**
56
+ * axis-id -> per-turn pull strength (0..1) toward the leader's value.
57
+ * Agents drift toward leader's traits; leader does not pull-self.
58
+ */
59
+ leaderPull: Record<string, number>;
60
+ /**
61
+ * axis-id -> per-turn amplification when the agent is promoted to a
62
+ * department whose role activates that axis. Sign-aware: positive
63
+ * pushes the trait up, negative pushes it down.
64
+ */
65
+ roleActivation: Record<string, number>;
66
+ }
67
+ /**
68
+ * Complete definition of a trait model. Registered once at engine
69
+ * load; consumed by the cue translator, the drift dispatcher, the
70
+ * dashboard sliders, and the prompt builder.
71
+ */
72
+ export interface TraitModel {
73
+ /** kebab-case stable id used in artifacts and configs. */
74
+ id: string;
75
+ /** Human-readable name for UI. */
76
+ name: string;
77
+ /** One-paragraph description of the model. */
78
+ description: string;
79
+ /** Ordered list of axes; UI renders sliders in this order. */
80
+ axes: readonly TraitAxis[];
81
+ /** axis-id -> default float in [0, 1] when an axis is omitted. */
82
+ defaults: Record<string, number>;
83
+ /** Drift table consumed by the kernel between turns. */
84
+ drift: DriftTable;
85
+ /** axis-id -> per-zone prose cue for prompt injection. */
86
+ cues: Record<string, CueZone>;
87
+ /**
88
+ * Optional citation / provenance string for UI tooltips, e.g.
89
+ * "Ashton & Lee, PSPR 2007" for HEXACO.
90
+ */
91
+ citation?: string;
92
+ /**
93
+ * Recommended LLM providers / models for runs against this trait
94
+ * model. Informational only; the orchestrator does not enforce.
95
+ */
96
+ recommendedProviders?: readonly LlmProvider[];
97
+ }
98
+ /**
99
+ * A leader's (or agent's) profile under a specific trait model. Stored
100
+ * on LeaderConfig.traitProfile and Agent.traitProfile.
101
+ */
102
+ export interface TraitProfile {
103
+ /** id of the registered TraitModel. */
104
+ modelId: string;
105
+ /** axis-id -> float in [0, 1]. */
106
+ traits: Record<string, number>;
107
+ }
108
+ /**
109
+ * Thrown when a TraitProfile references an unregistered modelId.
110
+ */
111
+ export declare class UnknownTraitModelError extends Error {
112
+ readonly modelId: string;
113
+ readonly registered: readonly string[];
114
+ constructor(modelId: string, registered: readonly string[]);
115
+ }
116
+ /**
117
+ * In-memory map of TraitModel by id. The runtime singleton lives at
118
+ * `traitModelRegistry`; tests and isolated callers can construct
119
+ * their own via `new TraitModelRegistry()`.
120
+ */
121
+ export declare class TraitModelRegistry {
122
+ private readonly models;
123
+ /**
124
+ * Register a model. Throws if a model with the same id is already
125
+ * registered (registration-time-only; no live re-binding).
126
+ */
127
+ register(model: TraitModel): void;
128
+ /** Return the model or `undefined` if not registered. */
129
+ get(modelId: string): TraitModel | undefined;
130
+ /** Return the model or throw `UnknownTraitModelError`. */
131
+ require(modelId: string): TraitModel;
132
+ /** All registered models in registration order. */
133
+ list(): TraitModel[];
134
+ /**
135
+ * Validate model shape: axes match defaults + drift + cues, ids are
136
+ * kebab-case, defaults are in [0, 1].
137
+ */
138
+ private assertValid;
139
+ }
140
+ /**
141
+ * Process-wide singleton registry. The hexaco + ai-agent built-ins
142
+ * register on import via `engine/trait-models/builtins.ts` (which is
143
+ * imported by `engine/index.ts`). External consumers should `import
144
+ * { traitModelRegistry } from 'paracosm/engine/trait-models'`.
145
+ */
146
+ export declare const traitModelRegistry: TraitModelRegistry;
147
+ /**
148
+ * Clamp a numeric trait value to [0, 1]. Used by the drift dispatcher
149
+ * after applying outcome / leader-pull / role-activation deltas.
150
+ */
151
+ export declare function clampTrait(value: number): number;
152
+ /**
153
+ * Compute the zone for a trait value: 'low' when <= 0.35, 'high' when
154
+ * >= 0.65, 'mid' otherwise. Used by the cue translator.
155
+ */
156
+ export declare function traitZone(value: number): 'low' | 'mid' | 'high';
157
+ /**
158
+ * Fill a partial trait map with model defaults so every axis has a
159
+ * value. Idempotent: existing keys are preserved.
160
+ */
161
+ export declare function withDefaults(partial: Record<string, number>, model: TraitModel): Record<string, number>;
162
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine/trait-models/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA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